shopify-theme-devtools 2.2.0 → 2.2.2

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.
@@ -1,4 +1,4 @@
1
- var __defProp=Object.defineProperty,__defNormalProp=(t,e,i)=>e in t?__defProp(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,__publicField=(t,e,i)=>__defNormalProp(t,"symbol"!=typeof e?e+"":e,i);!function(){"use strict";var t;const e=globalThis,i=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,s=Symbol(),a=new WeakMap;let r=class{constructor(t,e,i){if(this._$cssResult$=!0,i!==s)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(i&&void 0===t){const i=void 0!==e&&1===e.length;i&&(t=a.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&a.set(e,t))}return t}toString(){return this.cssText}};const n=(t,...e)=>{const i=1===t.length?t[0]:e.reduce((e,i,s)=>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.")})(i)+t[s+1],t[0]);return new r(i,t,s)},o=i?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return(t=>new r("string"==typeof t?t:t+"",void 0,s))(e)})(t):t,{is:l,defineProperty:d,getOwnPropertyDescriptor:c,getOwnPropertyNames:p,getOwnPropertySymbols:u,getPrototypeOf:h}=Object,g=globalThis,v=g.trustedTypes,m=v?v.emptyScript:"",b=g.reactiveElementPolyfillSupport,f=(t,e)=>t,y={toAttribute(t,e){switch(e){case Boolean:t=t?m:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let i=t;switch(e){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(s){i=null}}return i}},x=(t,e)=>!l(t,e),_={attribute:!0,type:String,converter:y,reflect:!1,useDefault:!1,hasChanged:x};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),g.litPropertyMetadata??(g.litPropertyMetadata=new WeakMap);let w=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??(this.l=[])).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=_){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){const i=Symbol(),s=this.getPropertyDescriptor(t,i,e);void 0!==s&&d(this.prototype,t,s)}}static getPropertyDescriptor(t,e,i){const{get:s,set:a}=c(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get:s,set(e){const r=null==s?void 0:s.call(this);null==a||a.call(this,e),this.requestUpdate(t,r,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??_}static _$Ei(){if(this.hasOwnProperty(f("elementProperties")))return;const t=h(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(f("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(f("properties"))){const t=this.properties,e=[...p(t),...u(t)];for(const i of e)this.createProperty(i,t[i])}const t=this[Symbol.metadata];if(null!==t){const e=litPropertyMetadata.get(t);if(void 0!==e)for(const[t,i]of e)this.elementProperties.set(t,i)}this._$Eh=new Map;for(const[e,i]of this.elementProperties){const t=this._$Eu(e,i);void 0!==t&&this._$Eh.set(t,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const t of i)e.unshift(o(t))}else void 0!==t&&e.push(o(t));return e}static _$Eu(t,e){const i=e.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(){var t;this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),null==(t=this.constructor.l)||t.forEach(t=>t(this))}addController(t){var e;(this._$EO??(this._$EO=new Set)).add(t),void 0!==this.renderRoot&&this.isConnected&&(null==(e=t.hostConnected)||e.call(t))}removeController(t){var e;null==(e=this._$EO)||e.delete(t)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const i of e.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((t,s)=>{if(i)t.adoptedStyleSheets=s.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const i of s){const s=document.createElement("style"),a=e.litNonce;void 0!==a&&s.setAttribute("nonce",a),s.textContent=i.cssText,t.appendChild(s)}})(t,this.constructor.elementStyles),t}connectedCallback(){var t;this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null==(t=this._$EO)||t.forEach(t=>{var e;return null==(e=t.hostConnected)?void 0:e.call(t)})}enableUpdating(t){}disconnectedCallback(){var t;null==(t=this._$EO)||t.forEach(t=>{var e;return null==(e=t.hostDisconnected)?void 0:e.call(t)})}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$ET(t,e){var i;const s=this.constructor.elementProperties.get(t),a=this.constructor._$Eu(t,s);if(void 0!==a&&!0===s.reflect){const r=(void 0!==(null==(i=s.converter)?void 0:i.toAttribute)?s.converter:y).toAttribute(e,s.type);this._$Em=t,null==r?this.removeAttribute(a):this.setAttribute(a,r),this._$Em=null}}_$AK(t,e){var i,s;const a=this.constructor,r=a._$Eh.get(t);if(void 0!==r&&this._$Em!==r){const t=a.getPropertyOptions(r),n="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==(null==(i=t.converter)?void 0:i.fromAttribute)?t.converter:y;this._$Em=r;const o=n.fromAttribute(e,t.type);this[r]=o??(null==(s=this._$Ej)?void 0:s.get(r))??o,this._$Em=null}}requestUpdate(t,e,i,s=!1,a){var r;if(void 0!==t){const n=this.constructor;if(!1===s&&(a=this[t]),i??(i=n.getPropertyOptions(t)),!((i.hasChanged??x)(a,e)||i.useDefault&&i.reflect&&a===(null==(r=this._$Ej)?void 0:r.get(t))&&!this.hasAttribute(n._$Eu(t,i))))return;this.C(t,e,i)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(t,e,{useDefault:i,reflect:s,wrapped:a},r){i&&!(this._$Ej??(this._$Ej=new Map)).has(t)&&(this._$Ej.set(t,r??e??this[t]),!0!==a||void 0!==r)||(this._$AL.has(t)||(this.hasUpdated||i||(e=void 0),this._$AL.set(t,e)),!0===s&&this._$Em!==t&&(this._$Eq??(this._$Eq=new Set)).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var t;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(const[t,e]of this._$Ep)this[t]=e;this._$Ep=void 0}const t=this.constructor.elementProperties;if(t.size>0)for(const[e,i]of t){const{wrapped:t}=i,s=this[e];!0!==t||this._$AL.has(e)||void 0===s||this.C(e,void 0,i,s)}}let e=!1;const i=this._$AL;try{e=this.shouldUpdate(i),e?(this.willUpdate(i),null==(t=this._$EO)||t.forEach(t=>{var e;return null==(e=t.hostUpdate)?void 0:e.call(t)}),this.update(i)):this._$EM()}catch(s){throw e=!1,this._$EM(),s}e&&this._$AE(i)}willUpdate(t){}_$AE(t){var e;null==(e=this._$EO)||e.forEach(t=>{var e;return null==(e=t.hostUpdated)?void 0:e.call(t)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&(this._$Eq=this._$Eq.forEach(t=>this._$ET(t,this[t]))),this._$EM()}updated(t){}firstUpdated(t){}};w.elementStyles=[],w.shadowRootOptions={mode:"open"},w[f("elementProperties")]=new Map,w[f("finalized")]=new Map,null==b||b({ReactiveElement:w}),(g.reactiveElementVersions??(g.reactiveElementVersions=[])).push("2.1.2");const k=globalThis,$=t=>t,S=k.trustedTypes,T=S?S.createPolicy("lit-html",{createHTML:t=>t}):void 0,C="$lit$",E=`lit$${Math.random().toFixed(9).slice(2)}$`,A="?"+E,O=`<${A}>`,L=document,j=()=>L.createComment(""),z=t=>null===t||"object"!=typeof t&&"function"!=typeof t,q=Array.isArray,P="[ \t\n\f\r]",I=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,R=/-->/g,N=/>/g,D=RegExp(`>|${P}(?:([^\\s"'>=/]+)(${P}*=${P}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),F=/'/g,M=/"/g,H=/^(?:script|style|textarea|title)$/i,U=(K=1,(t,...e)=>({_$litType$:K,strings:t,values:e})),B=Symbol.for("lit-noChange"),V=Symbol.for("lit-nothing"),J=new WeakMap,G=L.createTreeWalker(L,129);var K;function Q(t,e){if(!q(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==T?T.createHTML(e):e}class W{constructor({strings:t,_$litType$:e},i){let s;this.parts=[];let a=0,r=0;const n=t.length-1,o=this.parts,[l,d]=((t,e)=>{const i=t.length-1,s=[];let a,r=2===e?"<svg>":3===e?"<math>":"",n=I;for(let o=0;o<i;o++){const e=t[o];let i,l,d=-1,c=0;for(;c<e.length&&(n.lastIndex=c,l=n.exec(e),null!==l);)c=n.lastIndex,n===I?"!--"===l[1]?n=R:void 0!==l[1]?n=N:void 0!==l[2]?(H.test(l[2])&&(a=RegExp("</"+l[2],"g")),n=D):void 0!==l[3]&&(n=D):n===D?">"===l[0]?(n=a??I,d=-1):void 0===l[1]?d=-2:(d=n.lastIndex-l[2].length,i=l[1],n=void 0===l[3]?D:'"'===l[3]?M:F):n===M||n===F?n=D:n===R||n===N?n=I:(n=D,a=void 0);const p=n===D&&t[o+1].startsWith("/>")?" ":"";r+=n===I?e+O:d>=0?(s.push(i),e.slice(0,d)+C+e.slice(d)+E+p):e+E+(-2===d?o:p)}return[Q(t,r+(t[i]||"<?>")+(2===e?"</svg>":3===e?"</math>":"")),s]})(t,e);if(this.el=W.createElement(l,i),G.currentNode=this.el.content,2===e||3===e){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(s=G.nextNode())&&o.length<n;){if(1===s.nodeType){if(s.hasAttributes())for(const t of s.getAttributeNames())if(t.endsWith(C)){const e=d[r++],i=s.getAttribute(t).split(E),n=/([.?@])?(.*)/.exec(e);o.push({type:1,index:a,name:n[2],strings:i,ctor:"."===n[1]?et:"?"===n[1]?it:"@"===n[1]?st:tt}),s.removeAttribute(t)}else t.startsWith(E)&&(o.push({type:6,index:a}),s.removeAttribute(t));if(H.test(s.tagName)){const t=s.textContent.split(E),e=t.length-1;if(e>0){s.textContent=S?S.emptyScript:"";for(let i=0;i<e;i++)s.append(t[i],j()),G.nextNode(),o.push({type:2,index:++a});s.append(t[e],j())}}}else if(8===s.nodeType)if(s.data===A)o.push({type:2,index:a});else{let t=-1;for(;-1!==(t=s.data.indexOf(E,t+1));)o.push({type:7,index:a}),t+=E.length-1}a++}}static createElement(t,e){const i=L.createElement("template");return i.innerHTML=t,i}}function Y(t,e,i=t,s){var a,r;if(e===B)return e;let n=void 0!==s?null==(a=i._$Co)?void 0:a[s]:i._$Cl;const o=z(e)?void 0:e._$litDirective$;return(null==n?void 0:n.constructor)!==o&&(null==(r=null==n?void 0:n._$AO)||r.call(n,!1),void 0===o?n=void 0:(n=new o(t),n._$AT(t,i,s)),void 0!==s?(i._$Co??(i._$Co=[]))[s]=n:i._$Cl=n),void 0!==n&&(e=Y(t,n._$AS(t,e.values),n,s)),e}class X{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:e},parts:i}=this._$AD,s=((null==t?void 0:t.creationScope)??L).importNode(e,!0);G.currentNode=s;let a=G.nextNode(),r=0,n=0,o=i[0];for(;void 0!==o;){if(r===o.index){let e;2===o.type?e=new Z(a,a.nextSibling,this,t):1===o.type?e=new o.ctor(a,o.name,o.strings,this,t):6===o.type&&(e=new at(a,this,t)),this._$AV.push(e),o=i[++n]}r!==(null==o?void 0:o.index)&&(a=G.nextNode(),r++)}return G.currentNode=L,s}p(t){let e=0;for(const i of this._$AV)void 0!==i&&(void 0!==i.strings?(i._$AI(t,i,e),e+=i.strings.length-2):i._$AI(t[e])),e++}}class Z{get _$AU(){var t;return(null==(t=this._$AM)?void 0:t._$AU)??this._$Cv}constructor(t,e,i,s){this.type=2,this._$AH=V,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,this.options=s,this._$Cv=(null==s?void 0:s.isConnected)??!0}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===(null==t?void 0:t.nodeType)&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=Y(this,t,e),z(t)?t===V||null==t||""===t?(this._$AH!==V&&this._$AR(),this._$AH=V):t!==this._$AH&&t!==B&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):(t=>q(t)||"function"==typeof(null==t?void 0:t[Symbol.iterator]))(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!==V&&z(this._$AH)?this._$AA.nextSibling.data=t:this.T(L.createTextNode(t)),this._$AH=t}$(t){var e;const{values:i,_$litType$:s}=t,a="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=W.createElement(Q(s.h,s.h[0]),this.options)),s);if((null==(e=this._$AH)?void 0:e._$AD)===a)this._$AH.p(i);else{const t=new X(a,this),e=t.u(this.options);t.p(i),this.T(e),this._$AH=t}}_$AC(t){let e=J.get(t.strings);return void 0===e&&J.set(t.strings,e=new W(t)),e}k(t){q(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let i,s=0;for(const a of t)s===e.length?e.push(i=new Z(this.O(j()),this.O(j()),this,this.options)):i=e[s],i._$AI(a),s++;s<e.length&&(this._$AR(i&&i._$AB.nextSibling,s),e.length=s)}_$AR(t=this._$AA.nextSibling,e){var i;for(null==(i=this._$AP)||i.call(this,!1,!0,e);t!==this._$AB;){const e=$(t).nextSibling;$(t).remove(),t=e}}setConnected(t){var e;void 0===this._$AM&&(this._$Cv=t,null==(e=this._$AP)||e.call(this,t))}}class tt{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,i,s,a){this.type=1,this._$AH=V,this._$AN=void 0,this.element=t,this.name=e,this._$AM=s,this.options=a,i.length>2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=V}_$AI(t,e=this,i,s){const a=this.strings;let r=!1;if(void 0===a)t=Y(this,t,e,0),r=!z(t)||t!==this._$AH&&t!==B,r&&(this._$AH=t);else{const s=t;let n,o;for(t=a[0],n=0;n<a.length-1;n++)o=Y(this,s[i+n],e,n),o===B&&(o=this._$AH[n]),r||(r=!z(o)||o!==this._$AH[n]),o===V?t=V:t!==V&&(t+=(o??"")+a[n+1]),this._$AH[n]=o}r&&!s&&this.j(t)}j(t){t===V?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class et extends tt{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===V?void 0:t}}class it extends tt{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==V)}}class st extends tt{constructor(t,e,i,s,a){super(t,e,i,s,a),this.type=5}_$AI(t,e=this){if((t=Y(this,t,e,0)??V)===B)return;const i=this._$AH,s=t===V&&i!==V||t.capture!==i.capture||t.once!==i.once||t.passive!==i.passive,a=t!==V&&(i===V||s);s&&this.element.removeEventListener(this.name,this,i),a&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e;"function"==typeof this._$AH?this._$AH.call((null==(e=this.options)?void 0:e.host)??this.element,t):this._$AH.handleEvent(t)}}class at{constructor(t,e,i){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(t){Y(this,t)}}const rt=k.litHtmlPolyfillSupport;null==rt||rt(W,Z),(k.litHtmlVersions??(k.litHtmlVersions=[])).push("3.3.2");const nt=globalThis;class ot extends w{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t;const e=super.createRenderRoot();return(t=this.renderOptions).renderBefore??(t.renderBefore=e.firstChild),e}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=((t,e,i)=>{const s=(null==i?void 0:i.renderBefore)??e;let a=s._$litPart$;if(void 0===a){const t=(null==i?void 0:i.renderBefore)??null;s._$litPart$=a=new Z(e.insertBefore(j(),t),t,void 0,i??{})}return a._$AI(t),a})(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),null==(t=this._$Do)||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),null==(t=this._$Do)||t.setConnected(!1)}render(){return B}}ot._$litElement$=!0,ot.finalized=!0,null==(t=nt.litElementHydrateSupport)||t.call(nt,{LitElement:ot});const lt=nt.litElementPolyfillSupport;null==lt||lt({LitElement:ot}),(nt.litElementVersions??(nt.litElementVersions=[])).push("4.2.2");const dt={dark:{"--tdt-bg":"#1a1a1a","--tdt-bg-secondary":"#242424","--tdt-bg-hover":"#2a2a2a","--tdt-border":"#333","--tdt-text":"#e0e0e0","--tdt-text-muted":"#888","--tdt-accent":"#3b82f6","--tdt-accent-hover":"#2563eb","--tdt-success":"#22c55e","--tdt-warning":"#eab308","--tdt-error":"#ef4444","--tdt-danger":"#ef4444","--tdt-string":"#a5d6ff","--tdt-number":"#79c0ff","--tdt-boolean":"#ff7b72","--tdt-null":"#888","--tdt-key":"#c792ea","--tdt-serp-bg":"#202124","--tdt-serp-border":"#3c4043","--tdt-serp-favicon-bg":"#303134","--tdt-serp-domain":"#bdc1c6","--tdt-serp-breadcrumb":"#9aa0a6","--tdt-serp-title":"#8ab4f8","--tdt-serp-description":"#bdc1c6"},light:{"--tdt-bg":"#ffffff","--tdt-bg-secondary":"#f5f5f5","--tdt-bg-hover":"#ebebeb","--tdt-border":"#e0e0e0","--tdt-text":"#1a1a1a","--tdt-text-muted":"#666","--tdt-accent":"#2563eb","--tdt-accent-hover":"#1d4ed8","--tdt-success":"#16a34a","--tdt-warning":"#ca8a04","--tdt-error":"#dc2626","--tdt-danger":"#dc2626","--tdt-string":"#0969da","--tdt-number":"#0550ae","--tdt-boolean":"#cf222e","--tdt-null":"#666","--tdt-key":"#8250df","--tdt-serp-bg":"#ffffff","--tdt-serp-border":"#dfe1e5","--tdt-serp-favicon-bg":"#f1f3f4","--tdt-serp-domain":"#202124","--tdt-serp-breadcrumb":"#5f6368","--tdt-serp-title":"#1a0dab","--tdt-serp-description":"#4d5156"}},ct={small:.9,medium:1,large:1.15},pt=n`
1
+ var __defProp=Object.defineProperty,__defNormalProp=(t,e,i)=>e in t?__defProp(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,__publicField=(t,e,i)=>__defNormalProp(t,"symbol"!=typeof e?e+"":e,i);!function(){"use strict";var t;const e=globalThis,i=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,s=Symbol(),a=new WeakMap;let r=class{constructor(t,e,i){if(this._$cssResult$=!0,i!==s)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(i&&void 0===t){const i=void 0!==e&&1===e.length;i&&(t=a.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&a.set(e,t))}return t}toString(){return this.cssText}};const n=(t,...e)=>{const i=1===t.length?t[0]:e.reduce((e,i,s)=>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.")})(i)+t[s+1],t[0]);return new r(i,t,s)},o=i?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return(t=>new r("string"==typeof t?t:t+"",void 0,s))(e)})(t):t,{is:l,defineProperty:d,getOwnPropertyDescriptor:c,getOwnPropertyNames:p,getOwnPropertySymbols:u,getPrototypeOf:h}=Object,g=globalThis,v=g.trustedTypes,m=v?v.emptyScript:"",f=g.reactiveElementPolyfillSupport,b=(t,e)=>t,y={toAttribute(t,e){switch(e){case Boolean:t=t?m:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let i=t;switch(e){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(s){i=null}}return i}},x=(t,e)=>!l(t,e),_={attribute:!0,type:String,converter:y,reflect:!1,useDefault:!1,hasChanged:x};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),g.litPropertyMetadata??(g.litPropertyMetadata=new WeakMap);let w=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??(this.l=[])).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=_){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){const i=Symbol(),s=this.getPropertyDescriptor(t,i,e);void 0!==s&&d(this.prototype,t,s)}}static getPropertyDescriptor(t,e,i){const{get:s,set:a}=c(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get:s,set(e){const r=null==s?void 0:s.call(this);null==a||a.call(this,e),this.requestUpdate(t,r,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??_}static _$Ei(){if(this.hasOwnProperty(b("elementProperties")))return;const t=h(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(b("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(b("properties"))){const t=this.properties,e=[...p(t),...u(t)];for(const i of e)this.createProperty(i,t[i])}const t=this[Symbol.metadata];if(null!==t){const e=litPropertyMetadata.get(t);if(void 0!==e)for(const[t,i]of e)this.elementProperties.set(t,i)}this._$Eh=new Map;for(const[e,i]of this.elementProperties){const t=this._$Eu(e,i);void 0!==t&&this._$Eh.set(t,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const t of i)e.unshift(o(t))}else void 0!==t&&e.push(o(t));return e}static _$Eu(t,e){const i=e.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(){var t;this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),null==(t=this.constructor.l)||t.forEach(t=>t(this))}addController(t){var e;(this._$EO??(this._$EO=new Set)).add(t),void 0!==this.renderRoot&&this.isConnected&&(null==(e=t.hostConnected)||e.call(t))}removeController(t){var e;null==(e=this._$EO)||e.delete(t)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const i of e.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((t,s)=>{if(i)t.adoptedStyleSheets=s.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const i of s){const s=document.createElement("style"),a=e.litNonce;void 0!==a&&s.setAttribute("nonce",a),s.textContent=i.cssText,t.appendChild(s)}})(t,this.constructor.elementStyles),t}connectedCallback(){var t;this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null==(t=this._$EO)||t.forEach(t=>{var e;return null==(e=t.hostConnected)?void 0:e.call(t)})}enableUpdating(t){}disconnectedCallback(){var t;null==(t=this._$EO)||t.forEach(t=>{var e;return null==(e=t.hostDisconnected)?void 0:e.call(t)})}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$ET(t,e){var i;const s=this.constructor.elementProperties.get(t),a=this.constructor._$Eu(t,s);if(void 0!==a&&!0===s.reflect){const r=(void 0!==(null==(i=s.converter)?void 0:i.toAttribute)?s.converter:y).toAttribute(e,s.type);this._$Em=t,null==r?this.removeAttribute(a):this.setAttribute(a,r),this._$Em=null}}_$AK(t,e){var i,s;const a=this.constructor,r=a._$Eh.get(t);if(void 0!==r&&this._$Em!==r){const t=a.getPropertyOptions(r),n="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==(null==(i=t.converter)?void 0:i.fromAttribute)?t.converter:y;this._$Em=r;const o=n.fromAttribute(e,t.type);this[r]=o??(null==(s=this._$Ej)?void 0:s.get(r))??o,this._$Em=null}}requestUpdate(t,e,i,s=!1,a){var r;if(void 0!==t){const n=this.constructor;if(!1===s&&(a=this[t]),i??(i=n.getPropertyOptions(t)),!((i.hasChanged??x)(a,e)||i.useDefault&&i.reflect&&a===(null==(r=this._$Ej)?void 0:r.get(t))&&!this.hasAttribute(n._$Eu(t,i))))return;this.C(t,e,i)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(t,e,{useDefault:i,reflect:s,wrapped:a},r){i&&!(this._$Ej??(this._$Ej=new Map)).has(t)&&(this._$Ej.set(t,r??e??this[t]),!0!==a||void 0!==r)||(this._$AL.has(t)||(this.hasUpdated||i||(e=void 0),this._$AL.set(t,e)),!0===s&&this._$Em!==t&&(this._$Eq??(this._$Eq=new Set)).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var t;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(const[t,e]of this._$Ep)this[t]=e;this._$Ep=void 0}const t=this.constructor.elementProperties;if(t.size>0)for(const[e,i]of t){const{wrapped:t}=i,s=this[e];!0!==t||this._$AL.has(e)||void 0===s||this.C(e,void 0,i,s)}}let e=!1;const i=this._$AL;try{e=this.shouldUpdate(i),e?(this.willUpdate(i),null==(t=this._$EO)||t.forEach(t=>{var e;return null==(e=t.hostUpdate)?void 0:e.call(t)}),this.update(i)):this._$EM()}catch(s){throw e=!1,this._$EM(),s}e&&this._$AE(i)}willUpdate(t){}_$AE(t){var e;null==(e=this._$EO)||e.forEach(t=>{var e;return null==(e=t.hostUpdated)?void 0:e.call(t)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&(this._$Eq=this._$Eq.forEach(t=>this._$ET(t,this[t]))),this._$EM()}updated(t){}firstUpdated(t){}};w.elementStyles=[],w.shadowRootOptions={mode:"open"},w[b("elementProperties")]=new Map,w[b("finalized")]=new Map,null==f||f({ReactiveElement:w}),(g.reactiveElementVersions??(g.reactiveElementVersions=[])).push("2.1.2");const k=globalThis,$=t=>t,S=k.trustedTypes,T=S?S.createPolicy("lit-html",{createHTML:t=>t}):void 0,C="$lit$",E=`lit$${Math.random().toFixed(9).slice(2)}$`,A="?"+E,q=`<${A}>`,O=document,z=()=>O.createComment(""),j=t=>null===t||"object"!=typeof t&&"function"!=typeof t,L=Array.isArray,P="[ \t\n\f\r]",I=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,R=/-->/g,N=/>/g,F=RegExp(`>|${P}(?:([^\\s"'>=/]+)(${P}*=${P}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),D=/'/g,M=/"/g,H=/^(?:script|style|textarea|title)$/i,U=(K=1,(t,...e)=>({_$litType$:K,strings:t,values:e})),B=Symbol.for("lit-noChange"),V=Symbol.for("lit-nothing"),J=new WeakMap,G=O.createTreeWalker(O,129);var K;function Q(t,e){if(!L(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==T?T.createHTML(e):e}class W{constructor({strings:t,_$litType$:e},i){let s;this.parts=[];let a=0,r=0;const n=t.length-1,o=this.parts,[l,d]=((t,e)=>{const i=t.length-1,s=[];let a,r=2===e?"<svg>":3===e?"<math>":"",n=I;for(let o=0;o<i;o++){const e=t[o];let i,l,d=-1,c=0;for(;c<e.length&&(n.lastIndex=c,l=n.exec(e),null!==l);)c=n.lastIndex,n===I?"!--"===l[1]?n=R:void 0!==l[1]?n=N:void 0!==l[2]?(H.test(l[2])&&(a=RegExp("</"+l[2],"g")),n=F):void 0!==l[3]&&(n=F):n===F?">"===l[0]?(n=a??I,d=-1):void 0===l[1]?d=-2:(d=n.lastIndex-l[2].length,i=l[1],n=void 0===l[3]?F:'"'===l[3]?M:D):n===M||n===D?n=F:n===R||n===N?n=I:(n=F,a=void 0);const p=n===F&&t[o+1].startsWith("/>")?" ":"";r+=n===I?e+q:d>=0?(s.push(i),e.slice(0,d)+C+e.slice(d)+E+p):e+E+(-2===d?o:p)}return[Q(t,r+(t[i]||"<?>")+(2===e?"</svg>":3===e?"</math>":"")),s]})(t,e);if(this.el=W.createElement(l,i),G.currentNode=this.el.content,2===e||3===e){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(s=G.nextNode())&&o.length<n;){if(1===s.nodeType){if(s.hasAttributes())for(const t of s.getAttributeNames())if(t.endsWith(C)){const e=d[r++],i=s.getAttribute(t).split(E),n=/([.?@])?(.*)/.exec(e);o.push({type:1,index:a,name:n[2],strings:i,ctor:"."===n[1]?et:"?"===n[1]?it:"@"===n[1]?st:tt}),s.removeAttribute(t)}else t.startsWith(E)&&(o.push({type:6,index:a}),s.removeAttribute(t));if(H.test(s.tagName)){const t=s.textContent.split(E),e=t.length-1;if(e>0){s.textContent=S?S.emptyScript:"";for(let i=0;i<e;i++)s.append(t[i],z()),G.nextNode(),o.push({type:2,index:++a});s.append(t[e],z())}}}else if(8===s.nodeType)if(s.data===A)o.push({type:2,index:a});else{let t=-1;for(;-1!==(t=s.data.indexOf(E,t+1));)o.push({type:7,index:a}),t+=E.length-1}a++}}static createElement(t,e){const i=O.createElement("template");return i.innerHTML=t,i}}function Y(t,e,i=t,s){var a,r;if(e===B)return e;let n=void 0!==s?null==(a=i._$Co)?void 0:a[s]:i._$Cl;const o=j(e)?void 0:e._$litDirective$;return(null==n?void 0:n.constructor)!==o&&(null==(r=null==n?void 0:n._$AO)||r.call(n,!1),void 0===o?n=void 0:(n=new o(t),n._$AT(t,i,s)),void 0!==s?(i._$Co??(i._$Co=[]))[s]=n:i._$Cl=n),void 0!==n&&(e=Y(t,n._$AS(t,e.values),n,s)),e}class X{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:e},parts:i}=this._$AD,s=((null==t?void 0:t.creationScope)??O).importNode(e,!0);G.currentNode=s;let a=G.nextNode(),r=0,n=0,o=i[0];for(;void 0!==o;){if(r===o.index){let e;2===o.type?e=new Z(a,a.nextSibling,this,t):1===o.type?e=new o.ctor(a,o.name,o.strings,this,t):6===o.type&&(e=new at(a,this,t)),this._$AV.push(e),o=i[++n]}r!==(null==o?void 0:o.index)&&(a=G.nextNode(),r++)}return G.currentNode=O,s}p(t){let e=0;for(const i of this._$AV)void 0!==i&&(void 0!==i.strings?(i._$AI(t,i,e),e+=i.strings.length-2):i._$AI(t[e])),e++}}class Z{get _$AU(){var t;return(null==(t=this._$AM)?void 0:t._$AU)??this._$Cv}constructor(t,e,i,s){this.type=2,this._$AH=V,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,this.options=s,this._$Cv=(null==s?void 0:s.isConnected)??!0}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===(null==t?void 0:t.nodeType)&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=Y(this,t,e),j(t)?t===V||null==t||""===t?(this._$AH!==V&&this._$AR(),this._$AH=V):t!==this._$AH&&t!==B&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):(t=>L(t)||"function"==typeof(null==t?void 0:t[Symbol.iterator]))(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!==V&&j(this._$AH)?this._$AA.nextSibling.data=t:this.T(O.createTextNode(t)),this._$AH=t}$(t){var e;const{values:i,_$litType$:s}=t,a="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=W.createElement(Q(s.h,s.h[0]),this.options)),s);if((null==(e=this._$AH)?void 0:e._$AD)===a)this._$AH.p(i);else{const t=new X(a,this),e=t.u(this.options);t.p(i),this.T(e),this._$AH=t}}_$AC(t){let e=J.get(t.strings);return void 0===e&&J.set(t.strings,e=new W(t)),e}k(t){L(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let i,s=0;for(const a of t)s===e.length?e.push(i=new Z(this.O(z()),this.O(z()),this,this.options)):i=e[s],i._$AI(a),s++;s<e.length&&(this._$AR(i&&i._$AB.nextSibling,s),e.length=s)}_$AR(t=this._$AA.nextSibling,e){var i;for(null==(i=this._$AP)||i.call(this,!1,!0,e);t!==this._$AB;){const e=$(t).nextSibling;$(t).remove(),t=e}}setConnected(t){var e;void 0===this._$AM&&(this._$Cv=t,null==(e=this._$AP)||e.call(this,t))}}class tt{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,i,s,a){this.type=1,this._$AH=V,this._$AN=void 0,this.element=t,this.name=e,this._$AM=s,this.options=a,i.length>2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=V}_$AI(t,e=this,i,s){const a=this.strings;let r=!1;if(void 0===a)t=Y(this,t,e,0),r=!j(t)||t!==this._$AH&&t!==B,r&&(this._$AH=t);else{const s=t;let n,o;for(t=a[0],n=0;n<a.length-1;n++)o=Y(this,s[i+n],e,n),o===B&&(o=this._$AH[n]),r||(r=!j(o)||o!==this._$AH[n]),o===V?t=V:t!==V&&(t+=(o??"")+a[n+1]),this._$AH[n]=o}r&&!s&&this.j(t)}j(t){t===V?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class et extends tt{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===V?void 0:t}}class it extends tt{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==V)}}class st extends tt{constructor(t,e,i,s,a){super(t,e,i,s,a),this.type=5}_$AI(t,e=this){if((t=Y(this,t,e,0)??V)===B)return;const i=this._$AH,s=t===V&&i!==V||t.capture!==i.capture||t.once!==i.once||t.passive!==i.passive,a=t!==V&&(i===V||s);s&&this.element.removeEventListener(this.name,this,i),a&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e;"function"==typeof this._$AH?this._$AH.call((null==(e=this.options)?void 0:e.host)??this.element,t):this._$AH.handleEvent(t)}}class at{constructor(t,e,i){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(t){Y(this,t)}}const rt=k.litHtmlPolyfillSupport;null==rt||rt(W,Z),(k.litHtmlVersions??(k.litHtmlVersions=[])).push("3.3.2");const nt=globalThis;class ot extends w{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t;const e=super.createRenderRoot();return(t=this.renderOptions).renderBefore??(t.renderBefore=e.firstChild),e}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=((t,e,i)=>{const s=(null==i?void 0:i.renderBefore)??e;let a=s._$litPart$;if(void 0===a){const t=(null==i?void 0:i.renderBefore)??null;s._$litPart$=a=new Z(e.insertBefore(z(),t),t,void 0,i??{})}return a._$AI(t),a})(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),null==(t=this._$Do)||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),null==(t=this._$Do)||t.setConnected(!1)}render(){return B}}ot._$litElement$=!0,ot.finalized=!0,null==(t=nt.litElementHydrateSupport)||t.call(nt,{LitElement:ot});const lt=nt.litElementPolyfillSupport;null==lt||lt({LitElement:ot}),(nt.litElementVersions??(nt.litElementVersions=[])).push("4.2.2");const dt={dark:{"--tdt-bg":"#1a1a1a","--tdt-bg-secondary":"#242424","--tdt-bg-hover":"#2a2a2a","--tdt-border":"#333","--tdt-text":"#e0e0e0","--tdt-text-muted":"#888","--tdt-accent":"#3b82f6","--tdt-accent-hover":"#2563eb","--tdt-success":"#22c55e","--tdt-warning":"#eab308","--tdt-error":"#ef4444","--tdt-danger":"#ef4444","--tdt-string":"#a5d6ff","--tdt-number":"#79c0ff","--tdt-boolean":"#ff7b72","--tdt-null":"#888","--tdt-key":"#c792ea","--tdt-serp-bg":"#202124","--tdt-serp-border":"#3c4043","--tdt-serp-favicon-bg":"#303134","--tdt-serp-domain":"#bdc1c6","--tdt-serp-breadcrumb":"#9aa0a6","--tdt-serp-title":"#8ab4f8","--tdt-serp-description":"#bdc1c6"},light:{"--tdt-bg":"#ffffff","--tdt-bg-secondary":"#f5f5f5","--tdt-bg-hover":"#ebebeb","--tdt-border":"#e0e0e0","--tdt-text":"#1a1a1a","--tdt-text-muted":"#666","--tdt-accent":"#2563eb","--tdt-accent-hover":"#1d4ed8","--tdt-success":"#16a34a","--tdt-warning":"#ca8a04","--tdt-error":"#dc2626","--tdt-danger":"#dc2626","--tdt-string":"#0969da","--tdt-number":"#0550ae","--tdt-boolean":"#cf222e","--tdt-null":"#666","--tdt-key":"#8250df","--tdt-serp-bg":"#ffffff","--tdt-serp-border":"#dfe1e5","--tdt-serp-favicon-bg":"#f1f3f4","--tdt-serp-domain":"#202124","--tdt-serp-breadcrumb":"#5f6368","--tdt-serp-title":"#1a0dab","--tdt-serp-description":"#4d5156"}},ct={small:.9,medium:1,large:1.15},pt=n`
2
2
  :host {
3
3
  /* Inherit all CSS custom properties from parent */
4
4
  font-family: var(--tdt-font);
@@ -149,7 +149,7 @@ var __defProp=Object.defineProperty,__defNormalProp=(t,e,i)=>e in t?__defProp(t,
149
149
  *, *::before, *::after {
150
150
  box-sizing: border-box;
151
151
  }
152
- `;const ht=new class{constructor(){this.context=null}parse(){const t=document.getElementById("__THEME_DEVTOOLS_CONTEXT__");if(!t)return console.warn("[Theme Devtools] Context element not found"),null;try{return this.context=JSON.parse(t.textContent),this.context}catch(e){return console.error("[Theme Devtools] Failed to parse context:",e),null}}get(t){if(this.context)return t.split(".").reduce((t,e)=>null==t?void 0:t[e],this.context)}getMeta(){var t;return(null==(t=this.context)?void 0:t.meta)||{}}getObjects(){var t;return(null==(t=this.context)?void 0:t.objects)||{}}};function gt(t){try{return JSON.parse(JSON.stringify(t))}catch{return t}}const vt=class t{constructor(){this.listeners=new Set,this.currentCart=null,this.cartHistory=[],this.pollInterval=null,this._isRestoring=!1,this._restoreEndTime=0,this._loadPersistedHistory()}startRestore(){this._isRestoring=!0}endRestore(t=null){this._isRestoring=!1,this._restoreEndTime=Date.now()+500,t&&(this.currentCart=t)}isRestoring(){return this._isRestoring||Date.now()<this._restoreEndTime}_loadPersistedHistory(){try{const e=sessionStorage.getItem(t.STORAGE_KEY);e&&(this.cartHistory=JSON.parse(e))}catch(e){console.warn("[Theme Devtools] Failed to load cart history:",e)}}_persistHistory(){try{const e=this.cartHistory.slice(-50);sessionStorage.setItem(t.STORAGE_KEY,JSON.stringify(e))}catch(e){}}cartsEqual(t,e){var i,s,a,r;if(!t||!e)return!1;if(t.item_count!==e.item_count)return!1;if(t.total_price!==e.total_price)return!1;if((t.note||"")!==(e.note||""))return!1;if(JSON.stringify(t.attributes||{})!==JSON.stringify(e.attributes||{}))return!1;const n=t.items||[],o=e.items||[];if(n.length!==o.length)return!1;for(let l=0;l<n.length;l++){const t=n[l],e=o[l];if(t.variant_id!==e.variant_id)return!1;if(t.quantity!==e.quantity)return!1;if(JSON.stringify(t.properties||{})!==JSON.stringify(e.properties||{}))return!1;if((null==(s=null==(i=t.selling_plan_allocation)?void 0:i.selling_plan)?void 0:s.id)!==(null==(r=null==(a=e.selling_plan_allocation)?void 0:a.selling_plan)?void 0:r.id))return!1}return!0}async fetch(){try{const t=await fetch("/cart.js",{headers:{Accept:"application/json"},_tdtInternal:!0});return await t.json()}catch(t){return console.error("[Theme Devtools] Cart fetch failed:",t),null}}async update(t){try{const e=await fetch("/cart/update.js",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({updates:t})}),i=await e.json();return this.setCart(i),i}catch(e){return console.error("[Theme Devtools] Cart update failed:",e),null}}async change(t,e){try{const i=await fetch("/cart/change.js",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({line:t,quantity:e})}),s=await i.json();return this.setCart(s),s}catch(i){return console.error("[Theme Devtools] Cart change failed:",i),null}}async clear(){try{const t=await fetch("/cart/clear.js",{method:"POST",headers:{Accept:"application/json"}}),e=await t.json();return this.setCart(e),e}catch(t){return console.error("[Theme Devtools] Cart clear failed:",t),null}}setCart(t){const e=this.currentCart;if(this.currentCart=t,this.isRestoring())this.notify(t,e);else if(e&&this.cartsEqual(e,t))this.notify(t,e);else{if(e){const i=this.cartHistory[this.cartHistory.length-1];i&&this.cartsEqual(i.snapshot,e)||(this.cartHistory.push({timestamp:Date.now(),diff:this.diffCart(e,t),snapshot:gt(e)}),this.cartHistory.length>50&&this.cartHistory.shift(),this._persistHistory())}this.notify(t,e)}}diffCart(t,e){const i={itemCount:{old:(null==t?void 0:t.item_count)||0,new:(null==e?void 0:e.item_count)||0},totalPrice:{old:(null==t?void 0:t.total_price)||0,new:(null==e?void 0:e.total_price)||0},items:{added:[],removed:[],modified:[]},noteChanged:((null==t?void 0:t.note)||"")!==((null==e?void 0:e.note)||""),attributesChanged:JSON.stringify((null==t?void 0:t.attributes)||{})!==JSON.stringify((null==e?void 0:e.attributes)||{}),discountChanged:JSON.stringify((null==t?void 0:t.discount_codes)||[])!==JSON.stringify((null==e?void 0:e.discount_codes)||[])},s=new Map(((null==t?void 0:t.items)||[]).map(t=>[t.key,t])),a=new Map(((null==e?void 0:e.items)||[]).map(t=>[t.key,t]));return a.forEach((t,e)=>{const a=s.get(e);a?a.quantity!==t.quantity&&i.items.modified.push({item:t,oldQuantity:a.quantity,newQuantity:t.quantity}):i.items.added.push(t)}),s.forEach((t,e)=>{a.has(e)||i.items.removed.push(t)}),i}subscribe(t){return this.listeners.add(t),()=>this.listeners.delete(t)}notify(t,e){this.listeners.forEach(i=>{try{i(t,e)}catch(s){console.error("[Theme Devtools] Cart listener error:",s)}})}startPolling(t=2e3){if(this.pollInterval)return;const e=async()=>{const t=await this.fetch();t&&JSON.stringify(t)!==JSON.stringify(this.currentCart)&&this.setCart(t)};e(),this.pollInterval=setInterval(e,t)}stopPolling(){this.pollInterval&&(clearInterval(this.pollInterval),this.pollInterval=null)}interceptAjax(){const t=this,e=window.fetch;window.fetch=async function(i,s){const a=await e.apply(this,arguments);if("string"==typeof i&&i.includes("/cart"))try{const e=a.clone(),i=await e.json();i&&void 0!==i.item_count&&(t.isRestoring()?(t.currentCart=i,t.notify(i,null)):setTimeout(()=>t.setCart(i),0))}catch{}return a};const i=XMLHttpRequest.prototype.open;XMLHttpRequest.prototype.open=function(e,s){return"string"==typeof s&&s.includes("/cart")&&this.addEventListener("load",function(){try{const e=JSON.parse(this.responseText);e&&void 0!==e.item_count&&(t.isRestoring()?(t.currentCart=e,t.notify(e,null)):setTimeout(()=>t.setCart(e),0))}catch{}}),i.apply(this,arguments)}}};__publicField(vt,"STORAGE_KEY","tdt-cart-history");const mt=new vt;const bt=new class{constructor(){this.currentProduct=null,this.listeners=new Set,this._fetchPromise=null}async fetch(t){if(!t)return null;try{const e=await fetch(`/products/${t}.json`,{headers:{Accept:"application/json"}});if(!e.ok)return console.warn(`[Theme Devtools] Product fetch failed: ${e.status}`),null;return(await e.json()).product||null}catch(e){return console.error("[Theme Devtools] Product fetch failed:",e),null}}async initialize(t){if(!(null==t?void 0:t.handle))return this.currentProduct=t,t;if(this._fetchPromise)return this._fetchPromise;this._fetchPromise=this._doInitialize(t);const e=await this._fetchPromise;return this._fetchPromise=null,e}async _doInitialize(t){const e=await this.fetch(t.handle);return this.currentProduct=e?{...t,variants:e.variants||[],images:e.images||[],options:e.options||t.options,body_html:e.body_html,selected_variant:t.selected_variant,selected_or_first_available_variant:t.selected_or_first_available_variant,metafields_count:t.metafields_count}:t,this.notify(this.currentProduct),this.currentProduct}getVariant(t){var e;return(null==(e=this.currentProduct)?void 0:e.variants)&&this.currentProduct.variants.find(e=>e.id===t)||null}getVariants(){var t;return(null==(t=this.currentProduct)?void 0:t.variants)||[]}getImages(){var t;return(null==(t=this.currentProduct)?void 0:t.images)||[]}subscribe(t){return this.listeners.add(t),()=>this.listeners.delete(t)}notify(t){this.listeners.forEach(e=>{try{e(t)}catch(i){console.error("[Theme Devtools] Product listener error:",i)}})}};const ft=new class{constructor(){this.overlay=null,this.currentSection=null}init(){this.overlay=document.createElement("div"),this.overlay.className="tdt-section-overlay",Object.assign(this.overlay.style,{position:"fixed",pointerEvents:"none",border:"2px solid #3b82f6",backgroundColor:"rgba(59, 130, 246, 0.1)",zIndex:"2147483646",display:"none",transition:"all 0.2s ease"}),document.body.appendChild(this.overlay)}findSections(){const t=[];Array.from(document.querySelectorAll('[id^="shopify-section-"]')).forEach(e=>{var i;const s=e.id.replace("shopify-section-",""),a=e.dataset.sectionType||(null==(i=e.className.match(/section-(\w+)/))?void 0:i[1])||"unknown",r=Array.from(e.querySelectorAll('[data-block-id], [id*="block"]'));t.push({id:s,type:a,element:e,blockCount:r.length,rect:e.getBoundingClientRect()})});return Array.from(document.querySelectorAll("[data-section-id]")).forEach(e=>{const i=e.dataset.sectionId;if(!t.find(t=>t.id===i)){const s=e.dataset.sectionType||"unknown",a=Array.from(e.querySelectorAll("[data-block-id]"));t.push({id:i,type:s,element:e,blockCount:a.length,rect:e.getBoundingClientRect()})}}),t}highlight(t){const e=this.findSections().find(e=>e.id===t);if(!e||!e.element)return void this.hide();const i=e.element.getBoundingClientRect();Object.assign(this.overlay.style,{display:"block",top:`${i.top}px`,left:`${i.left}px`,width:`${i.width}px`,height:`${i.height}px`}),this.currentSection=t,e.element.scrollIntoView({behavior:"smooth",block:"center"})}hide(){this.overlay&&(this.overlay.style.display="none"),this.currentSection=null}destroy(){this.overlay&&this.overlay.parentNode&&this.overlay.parentNode.removeChild(this.overlay)}},yt={theme:"dark",fontSize:"medium",defaultTab:"objects",panelHeight:"50",panelPosition:"bottom",persistAcrossSessions:!0,keyboardShortcut:{key:"D",ctrl:!0,shift:!0,alt:!1,meta:!1}},xt=class t{constructor(){this._settings={...yt},this._listeners=new Set,this._load()}getAll(){return{...this._settings}}get(t){return this._settings[t]}set(t,e){const i=this._settings[t];this._settings[t]=e,this._save(),this._notify(t,e,i)}setMultiple(t){const e={};for(const[i,s]of Object.entries(t))this._settings[i]!==s&&(e[i]={old:this._settings[i],new:s},this._settings[i]=s);this._save();for(const[i,{old:s,new:a}]of Object.entries(e))this._notify(i,a,s)}reset(){this._settings={...yt},this._save(),this._notify("*",this._settings,null)}subscribe(t){return this._listeners.add(t),()=>this._listeners.delete(t)}getStorage(){return this._settings.persistAcrossSessions?localStorage:sessionStorage}matchesShortcut(t){const e=this._settings.keyboardShortcut,i=t.key.toUpperCase()===e.key.toUpperCase(),s=t.ctrlKey===e.ctrl,a=t.shiftKey===e.shift,r=t.altKey===e.alt,n=t.metaKey===e.meta;return navigator.platform.toUpperCase().indexOf("MAC")>=0&&e.ctrl&&!e.meta?i&&(s||t.metaKey)&&a&&r:i&&s&&a&&r&&n}formatShortcut(){const t=this._settings.keyboardShortcut,e=navigator.platform.toUpperCase().indexOf("MAC")>=0,i=[];return t.ctrl&&i.push(e?"⌃":"Ctrl"),t.meta&&i.push(e?"⌘":"Win"),t.alt&&i.push(e?"⌥":"Alt"),t.shift&&i.push(e?"⇧":"Shift"),i.push(t.key.toUpperCase()),i.join(e?"":"+")}_load(){try{let e=localStorage.getItem(t.STORAGE_KEY);if(e||(e=sessionStorage.getItem(t.STORAGE_KEY)),e){const t=JSON.parse(e);this._settings={...yt,...t}}}catch(e){console.warn("[Theme Devtools] Failed to load settings:",e)}}_save(){try{const e=JSON.stringify(this._settings);this._settings.persistAcrossSessions?(localStorage.setItem(t.STORAGE_KEY,e),sessionStorage.removeItem(t.STORAGE_KEY)):(sessionStorage.setItem(t.STORAGE_KEY,e),localStorage.removeItem(t.STORAGE_KEY))}catch(e){console.warn("[Theme Devtools] Failed to save settings:",e)}}_notify(t,e,i){this._listeners.forEach(s=>{try{s(t,e,i)}catch(a){console.error("[Theme Devtools] Settings listener error:",a)}})}};__publicField(xt,"STORAGE_KEY","tdt-settings");const _t=new xt;class wt extends ot{constructor(){super(),this.data=null,this.path="",this.expanded=new Set,this.searchQuery="",this.forceExpandAll=!1,this._matchingPaths=new Set,this._lastForceExpandAll=!1}updated(t){(t.has("searchQuery")||t.has("data"))&&this._updateMatchingPaths(),t.has("forceExpandAll")&&(this.forceExpandAll&&!this._lastForceExpandAll?this._expandAllPaths():!this.forceExpandAll&&this._lastForceExpandAll&&(this.expanded=new Set),this._lastForceExpandAll=this.forceExpandAll)}_expandAllPaths(){const t=new Set;this._collectAllPaths(this.data,this.path,t),this.expanded=t}_collectAllPaths(t,e,i){if(null==t)return;if(!this._isExpandable(t))return;let s;i.add(e);try{s=Object.entries(t)}catch{return}for(const[a,r]of s){const t=e?`${e}.${a}`:a;this._collectAllPaths(r,t,i)}}_updateMatchingPaths(){const t=(this.searchQuery||"").toLowerCase().trim();if(!t||!this.data)return this._matchingPaths=new Set,void this._dispatchMatchCount(0);const e=new Set;if(this._findMatches(this.data,this.path,t,e),this._matchingPaths=e,this._dispatchMatchCount(e.size),e.size>0){const t=new Set(this.expanded);for(const i of e){const e=i.split(".");let s="";for(let i=0;i<e.length-1;i++)s=s?`${s}.${e[i]}`:e[i],t.add(s)}this.expanded=t}}_dispatchMatchCount(t){this.dispatchEvent(new CustomEvent("match-count-changed",{detail:{count:t},bubbles:!0,composed:!0}))}_findMatches(t,e,i,s){if(null==t)return;const a=this._getType(t);if("object"!==a&&"array"!==a){return void(String(t).toLowerCase().includes(i)&&s.add(e))}let r;try{r=Object.entries(t)}catch{return}for(const[n,o]of r){const t=e?`${e}.${n}`:n;n.toLowerCase().includes(i)&&s.add(t),this._findMatches(o,t,i,s)}}_isPathVisible(t){if(!this.searchQuery||0===this._matchingPaths.size)return!0;for(const e of this._matchingPaths)if(e===t||e.startsWith(t+"."))return!0;return!1}_highlightText(t,e){if(!e)return t;const i=String(t).toLowerCase(),s=e.toLowerCase(),a=i.indexOf(s);if(-1===a)return t;const r=String(t).slice(0,a),n=String(t).slice(a,a+e.length),o=String(t).slice(a+e.length);return U`${r}<span class="highlight">${n}</span>${o}`}_getType(t){return null===t?"null":void 0===t?"undefined":Array.isArray(t)?"array":typeof t}_isExpandable(t){if(null==t)return!1;const e=this._getType(t);if("object"!==e&&"array"!==e)return!1;try{return Object.keys(t).length>0}catch{return!1}}_getKeys(t){try{return Object.keys(t)}catch{return[]}}_isURL(t){return"string"==typeof t&&(/^(https?:\/\/|\/\/|\/[a-z])/i.test(t)||/\.(jpg|jpeg|png|gif|webp|svg|css|js|json)(\?|$)/i.test(t))}_toggleExpand(t,e){e.stopPropagation();const i=new Set(this.expanded);i.has(t)?i.delete(t):i.add(t),this.expanded=i}async _copyPath(t,e){e.stopPropagation();const i=t.replace(/^objects\./,"").replace(/^meta\./,"");try{await navigator.clipboard.writeText(`{{ ${i} }}`);const t=e.target;t.classList.add("key--copied"),setTimeout(()=>t.classList.remove("key--copied"),1e3)}catch(s){console.error("Failed to copy:",s)}}async _copyValue(t,e){let i;if(e.stopPropagation(),"object"==typeof t&&null!==t)try{i=JSON.stringify(t,null,2)}catch{i=String(t)}else i=String(t);try{await navigator.clipboard.writeText(i);const t=e.target;t.classList.add("copy-value-btn--copied"),t.textContent="✓",setTimeout(()=>{t.classList.remove("copy-value-btn--copied"),t.textContent="copy"},1e3)}catch(s){console.error("Failed to copy value:",s)}}_openURL(t,e){e.stopPropagation();let i=t;t.startsWith("//")?i=window.location.protocol+t:t.startsWith("/")&&(i=window.location.origin+t),window.open(i,"_blank")}_renderValue(t,e){switch(e){case"string":const e=this._isURL(t),i=t.length>80?t.slice(0,80)+"...":t;return e?U`<span class="value value--url" @click=${e=>this._openURL(t,e)} title="Click to open: ${t}">"${i}"</span>`:U`<span class="value value--string">"${i}"</span>`;case"number":return U`<span class="value value--number">${t}</span>`;case"boolean":return U`<span class="value value--boolean">${t}</span>`;case"null":return U`<span class="value value--null">null</span>`;case"undefined":return U`<span class="value value--undefined">undefined</span>`;case"object":case"array":return U`<span class="preview">{}</span>`;default:return U`<span class="value">${String(t)}</span>`}}_renderValueWithHighlight(t,e,i){if(!i)return this._renderValue(t,e);switch(e){case"string":const e=this._isURL(t),s=t.length>80?t.slice(0,80)+"...":t;return e?U`<span class="value value--url" @click=${e=>this._openURL(t,e)} title="Click to open: ${t}">"${this._highlightText(s,i)}"</span>`:U`<span class="value value--string">"${this._highlightText(s,i)}"</span>`;case"number":return U`<span class="value value--number">${this._highlightText(String(t),i)}</span>`;case"boolean":return U`<span class="value value--boolean">${this._highlightText(String(t),i)}</span>`;case"null":return U`<span class="value value--null">null</span>`;case"undefined":return U`<span class="value value--undefined">undefined</span>`;case"object":case"array":return U`<span class="preview">{}</span>`;default:return U`<span class="value">${this._highlightText(String(t),i)}</span>`}}_renderPreview(t,e){let i;try{i=Object.keys(t).length}catch{i=0}if("array"===e){const e=[],s=3;for(let r=0;r<Math.min(i,s);r++){const i=t[r],s=this._getType(i);if("string"===s){const t=i.length>15?i.slice(0,15)+"…":i;e.push(U`<span class="array-preview-item array-preview-item--string">"${t}"</span>`)}else"number"===s?e.push(U`<span class="array-preview-item array-preview-item--number">${i}</span>`):"object"===s||"array"===s?e.push(U`<span class="array-preview-item">{…}</span>`):e.push(U`<span class="array-preview-item">${String(i)}</span>`)}const a=i>s;return U`
152
+ `;const ht=new class{constructor(){this.context=null}parse(){const t=document.getElementById("__THEME_DEVTOOLS_CONTEXT__");if(!t)return console.warn("[Theme Devtools] Context element not found"),null;try{return this.context=JSON.parse(t.textContent),this.context}catch(e){return console.error("[Theme Devtools] Failed to parse context:",e),null}}get(t){if(this.context)return t.split(".").reduce((t,e)=>null==t?void 0:t[e],this.context)}getMeta(){var t;return(null==(t=this.context)?void 0:t.meta)||{}}getObjects(){var t;return(null==(t=this.context)?void 0:t.objects)||{}}};function gt(t){try{return JSON.parse(JSON.stringify(t))}catch{return t}}const vt=class t{constructor(){this.listeners=new Set,this.currentCart=null,this.cartHistory=[],this.pollInterval=null,this._isRestoring=!1,this._restoreEndTime=0,this._loadPersistedHistory()}startRestore(){this._isRestoring=!0}endRestore(t=null){this._isRestoring=!1,this._restoreEndTime=Date.now()+500,t&&(this.currentCart=t)}isRestoring(){return this._isRestoring||Date.now()<this._restoreEndTime}_loadPersistedHistory(){try{const e=sessionStorage.getItem(t.STORAGE_KEY);e&&(this.cartHistory=JSON.parse(e))}catch(e){console.warn("[Theme Devtools] Failed to load cart history:",e)}}_persistHistory(){try{const e=this.cartHistory.slice(-50);sessionStorage.setItem(t.STORAGE_KEY,JSON.stringify(e))}catch(e){}}cartsEqual(t,e){var i,s,a,r;if(!t||!e)return!1;if(t.item_count!==e.item_count)return!1;if(t.total_price!==e.total_price)return!1;if((t.note||"")!==(e.note||""))return!1;if(JSON.stringify(t.attributes||{})!==JSON.stringify(e.attributes||{}))return!1;const n=t.items||[],o=e.items||[];if(n.length!==o.length)return!1;for(let l=0;l<n.length;l++){const t=n[l],e=o[l];if(t.variant_id!==e.variant_id)return!1;if(t.quantity!==e.quantity)return!1;if(JSON.stringify(t.properties||{})!==JSON.stringify(e.properties||{}))return!1;if((null==(s=null==(i=t.selling_plan_allocation)?void 0:i.selling_plan)?void 0:s.id)!==(null==(r=null==(a=e.selling_plan_allocation)?void 0:a.selling_plan)?void 0:r.id))return!1}return!0}async fetch(){try{const t=await fetch("/cart.js",{headers:{Accept:"application/json"},_tdtInternal:!0});return await t.json()}catch(t){return console.error("[Theme Devtools] Cart fetch failed:",t),null}}async update(t){try{const e=await fetch("/cart/update.js",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({updates:t})}),i=await e.json();return this.setCart(i),i}catch(e){return console.error("[Theme Devtools] Cart update failed:",e),null}}async change(t,e){try{const i=await fetch("/cart/change.js",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({line:t,quantity:e})}),s=await i.json();return this.setCart(s),s}catch(i){return console.error("[Theme Devtools] Cart change failed:",i),null}}async clear(){try{const t=await fetch("/cart/clear.js",{method:"POST",headers:{Accept:"application/json"}}),e=await t.json();return this.setCart(e),e}catch(t){return console.error("[Theme Devtools] Cart clear failed:",t),null}}setCart(t){const e=this.currentCart;if(this.currentCart=t,this.isRestoring())this.notify(t,e);else if(e&&this.cartsEqual(e,t))this.notify(t,e);else{if(e){const i=this.cartHistory[this.cartHistory.length-1];i&&this.cartsEqual(i.snapshot,e)||(this.cartHistory.push({timestamp:Date.now(),diff:this.diffCart(e,t),snapshot:gt(e)}),this.cartHistory.length>50&&this.cartHistory.shift(),this._persistHistory())}this.notify(t,e)}}diffCart(t,e){const i={itemCount:{old:(null==t?void 0:t.item_count)||0,new:(null==e?void 0:e.item_count)||0},totalPrice:{old:(null==t?void 0:t.total_price)||0,new:(null==e?void 0:e.total_price)||0},items:{added:[],removed:[],modified:[]},noteChanged:((null==t?void 0:t.note)||"")!==((null==e?void 0:e.note)||""),attributesChanged:JSON.stringify((null==t?void 0:t.attributes)||{})!==JSON.stringify((null==e?void 0:e.attributes)||{}),discountChanged:JSON.stringify((null==t?void 0:t.discount_codes)||[])!==JSON.stringify((null==e?void 0:e.discount_codes)||[])},s=new Map(((null==t?void 0:t.items)||[]).map(t=>[t.key,t])),a=new Map(((null==e?void 0:e.items)||[]).map(t=>[t.key,t]));return a.forEach((t,e)=>{const a=s.get(e);a?a.quantity!==t.quantity&&i.items.modified.push({item:t,oldQuantity:a.quantity,newQuantity:t.quantity}):i.items.added.push(t)}),s.forEach((t,e)=>{a.has(e)||i.items.removed.push(t)}),i}subscribe(t){return this.listeners.add(t),()=>this.listeners.delete(t)}notify(t,e){this.listeners.forEach(i=>{try{i(t,e)}catch(s){console.error("[Theme Devtools] Cart listener error:",s)}})}startPolling(t=2e3){if(this.pollInterval)return;const e=async()=>{const t=await this.fetch();t&&JSON.stringify(t)!==JSON.stringify(this.currentCart)&&this.setCart(t)};e(),this.pollInterval=setInterval(e,t)}stopPolling(){this.pollInterval&&(clearInterval(this.pollInterval),this.pollInterval=null)}interceptAjax(){const t=this,e=window.fetch;window.fetch=async function(i,s){const a=await e.apply(this,arguments);if("string"==typeof i&&i.includes("/cart"))try{const e=a.clone(),i=await e.json();i&&void 0!==i.item_count&&(t.isRestoring()?(t.currentCart=i,t.notify(i,null)):setTimeout(()=>t.setCart(i),0))}catch{}return a};const i=XMLHttpRequest.prototype.open;XMLHttpRequest.prototype.open=function(e,s){return"string"==typeof s&&s.includes("/cart")&&this.addEventListener("load",function(){try{const e=JSON.parse(this.responseText);e&&void 0!==e.item_count&&(t.isRestoring()?(t.currentCart=e,t.notify(e,null)):setTimeout(()=>t.setCart(e),0))}catch{}}),i.apply(this,arguments)}}};__publicField(vt,"STORAGE_KEY","tdt-cart-history");const mt=new vt;const ft=new class{constructor(){this.currentProduct=null,this.listeners=new Set,this._fetchPromise=null}async fetch(t){if(!t)return null;try{const e=await fetch(`/products/${t}.json`,{headers:{Accept:"application/json"}});if(!e.ok)return console.warn(`[Theme Devtools] Product fetch failed: ${e.status}`),null;return(await e.json()).product||null}catch(e){return console.error("[Theme Devtools] Product fetch failed:",e),null}}async initialize(t){if(!(null==t?void 0:t.handle))return this.currentProduct=t,t;if(this._fetchPromise)return this._fetchPromise;this._fetchPromise=this._doInitialize(t);const e=await this._fetchPromise;return this._fetchPromise=null,e}async _doInitialize(t){const e=await this.fetch(t.handle);return this.currentProduct=e?{...t,variants:e.variants||[],images:e.images||[],options:e.options||t.options,body_html:e.body_html,selected_variant:t.selected_variant,selected_or_first_available_variant:t.selected_or_first_available_variant,metafields_count:t.metafields_count}:t,this.notify(this.currentProduct),this.currentProduct}getVariant(t){var e;return(null==(e=this.currentProduct)?void 0:e.variants)&&this.currentProduct.variants.find(e=>e.id===t)||null}getVariants(){var t;return(null==(t=this.currentProduct)?void 0:t.variants)||[]}getImages(){var t;return(null==(t=this.currentProduct)?void 0:t.images)||[]}subscribe(t){return this.listeners.add(t),()=>this.listeners.delete(t)}notify(t){this.listeners.forEach(e=>{try{e(t)}catch(i){console.error("[Theme Devtools] Product listener error:",i)}})}};const bt=new class{constructor(){this.overlay=null,this.currentSection=null}init(){this.overlay=document.createElement("div"),this.overlay.className="tdt-section-overlay",Object.assign(this.overlay.style,{position:"fixed",pointerEvents:"none",border:"2px solid #3b82f6",backgroundColor:"rgba(59, 130, 246, 0.1)",zIndex:"2147483646",display:"none",transition:"all 0.2s ease"}),document.body.appendChild(this.overlay)}findSections(){const t=[];Array.from(document.querySelectorAll('[id^="shopify-section-"]')).forEach(e=>{var i;const s=e.id.replace("shopify-section-",""),a=e.dataset.sectionType||(null==(i=e.className.match(/section-(\w+)/))?void 0:i[1])||"unknown",r=Array.from(e.querySelectorAll('[data-block-id], [id*="block"]'));t.push({id:s,type:a,element:e,blockCount:r.length,rect:e.getBoundingClientRect()})});return Array.from(document.querySelectorAll("[data-section-id]")).forEach(e=>{const i=e.dataset.sectionId;if(!t.find(t=>t.id===i)){const s=e.dataset.sectionType||"unknown",a=Array.from(e.querySelectorAll("[data-block-id]"));t.push({id:i,type:s,element:e,blockCount:a.length,rect:e.getBoundingClientRect()})}}),t}highlight(t){const e=this.findSections().find(e=>e.id===t);if(!e||!e.element)return void this.hide();const i=e.element.getBoundingClientRect();Object.assign(this.overlay.style,{display:"block",top:`${i.top}px`,left:`${i.left}px`,width:`${i.width}px`,height:`${i.height}px`}),this.currentSection=t,e.element.scrollIntoView({behavior:"smooth",block:"center"})}hide(){this.overlay&&(this.overlay.style.display="none"),this.currentSection=null}destroy(){this.overlay&&this.overlay.parentNode&&this.overlay.parentNode.removeChild(this.overlay)}},yt={theme:"dark",fontSize:"medium",defaultTab:"objects",panelHeight:"50",panelPosition:"bottom",persistAcrossSessions:!0,keyboardShortcut:{key:"D",ctrl:!0,shift:!0,alt:!1,meta:!1}},xt=class t{constructor(){this._settings={...yt},this._listeners=new Set,this._load()}getAll(){return{...this._settings}}get(t){return this._settings[t]}set(t,e){const i=this._settings[t];this._settings[t]=e,this._save(),this._notify(t,e,i)}setMultiple(t){const e={};for(const[i,s]of Object.entries(t))this._settings[i]!==s&&(e[i]={old:this._settings[i],new:s},this._settings[i]=s);this._save();for(const[i,{old:s,new:a}]of Object.entries(e))this._notify(i,a,s)}reset(){this._settings={...yt},this._save(),this._notify("*",this._settings,null)}subscribe(t){return this._listeners.add(t),()=>this._listeners.delete(t)}getStorage(){return this._settings.persistAcrossSessions?localStorage:sessionStorage}matchesShortcut(t){const e=this._settings.keyboardShortcut,i=t.key.toUpperCase()===e.key.toUpperCase(),s=t.ctrlKey===e.ctrl,a=t.shiftKey===e.shift,r=t.altKey===e.alt,n=t.metaKey===e.meta;return navigator.platform.toUpperCase().indexOf("MAC")>=0&&e.ctrl&&!e.meta?i&&(s||t.metaKey)&&a&&r:i&&s&&a&&r&&n}formatShortcut(){const t=this._settings.keyboardShortcut,e=navigator.platform.toUpperCase().indexOf("MAC")>=0,i=[];return t.ctrl&&i.push(e?"⌃":"Ctrl"),t.meta&&i.push(e?"⌘":"Win"),t.alt&&i.push(e?"⌥":"Alt"),t.shift&&i.push(e?"⇧":"Shift"),i.push(t.key.toUpperCase()),i.join(e?"":"+")}_load(){try{let e=localStorage.getItem(t.STORAGE_KEY);if(e||(e=sessionStorage.getItem(t.STORAGE_KEY)),e){const t=JSON.parse(e);this._settings={...yt,...t}}}catch(e){console.warn("[Theme Devtools] Failed to load settings:",e)}}_save(){try{const e=JSON.stringify(this._settings);this._settings.persistAcrossSessions?(localStorage.setItem(t.STORAGE_KEY,e),sessionStorage.removeItem(t.STORAGE_KEY)):(sessionStorage.setItem(t.STORAGE_KEY,e),localStorage.removeItem(t.STORAGE_KEY))}catch(e){console.warn("[Theme Devtools] Failed to save settings:",e)}}_notify(t,e,i){this._listeners.forEach(s=>{try{s(t,e,i)}catch(a){console.error("[Theme Devtools] Settings listener error:",a)}})}};__publicField(xt,"STORAGE_KEY","tdt-settings");const _t=new xt;class wt extends ot{constructor(){super(),this.data=null,this.path="",this.expanded=new Set,this.searchQuery="",this.forceExpandAll=!1,this._matchingPaths=new Set,this._lastForceExpandAll=!1}updated(t){(t.has("searchQuery")||t.has("data"))&&this._updateMatchingPaths(),t.has("forceExpandAll")&&(this.forceExpandAll&&!this._lastForceExpandAll?this._expandAllPaths():!this.forceExpandAll&&this._lastForceExpandAll&&(this.expanded=new Set),this._lastForceExpandAll=this.forceExpandAll)}_expandAllPaths(){const t=new Set;this._collectAllPaths(this.data,this.path,t),this.expanded=t}_collectAllPaths(t,e,i){if(null==t)return;if(!this._isExpandable(t))return;let s;i.add(e);try{s=Object.entries(t)}catch{return}for(const[a,r]of s){const t=e?`${e}.${a}`:a;this._collectAllPaths(r,t,i)}}_updateMatchingPaths(){const t=(this.searchQuery||"").toLowerCase().trim();if(!t||!this.data)return this._matchingPaths=new Set,void this._dispatchMatchCount(0);const e=new Set;if(this._findMatches(this.data,this.path,t,e),this._matchingPaths=e,this._dispatchMatchCount(e.size),e.size>0){const t=new Set(this.expanded);for(const i of e){const e=i.split(".");let s="";for(let i=0;i<e.length-1;i++)s=s?`${s}.${e[i]}`:e[i],t.add(s)}this.expanded=t}}_dispatchMatchCount(t){this.dispatchEvent(new CustomEvent("match-count-changed",{detail:{count:t},bubbles:!0,composed:!0}))}_findMatches(t,e,i,s){if(null==t)return;const a=this._getType(t);if("object"!==a&&"array"!==a){return void(String(t).toLowerCase().includes(i)&&s.add(e))}let r;try{r=Object.entries(t)}catch{return}for(const[n,o]of r){const t=e?`${e}.${n}`:n;n.toLowerCase().includes(i)&&s.add(t),this._findMatches(o,t,i,s)}}_isPathVisible(t){if(!this.searchQuery||0===this._matchingPaths.size)return!0;for(const e of this._matchingPaths)if(e===t||e.startsWith(t+"."))return!0;return!1}_highlightText(t,e){if(!e)return t;const i=String(t).toLowerCase(),s=e.toLowerCase(),a=i.indexOf(s);if(-1===a)return t;const r=String(t).slice(0,a),n=String(t).slice(a,a+e.length),o=String(t).slice(a+e.length);return U`${r}<span class="highlight">${n}</span>${o}`}_getType(t){return null===t?"null":void 0===t?"undefined":Array.isArray(t)?"array":typeof t}_isExpandable(t){if(null==t)return!1;const e=this._getType(t);if("object"!==e&&"array"!==e)return!1;try{return Object.keys(t).length>0}catch{return!1}}_getKeys(t){try{return Object.keys(t)}catch{return[]}}_isURL(t){return"string"==typeof t&&(/^(https?:\/\/|\/\/|\/[a-z])/i.test(t)||/\.(jpg|jpeg|png|gif|webp|svg|css|js|json)(\?|$)/i.test(t))}_toggleExpand(t,e){e.stopPropagation();const i=new Set(this.expanded);i.has(t)?i.delete(t):i.add(t),this.expanded=i}async _copyPath(t,e){e.stopPropagation();const i=t.replace(/^objects\./,"").replace(/^meta\./,"");try{await navigator.clipboard.writeText(`{{ ${i} }}`);const t=e.target;t.classList.add("key--copied"),setTimeout(()=>t.classList.remove("key--copied"),1e3)}catch(s){console.error("Failed to copy:",s)}}async _copyValue(t,e){let i;if(e.stopPropagation(),"object"==typeof t&&null!==t)try{i=JSON.stringify(t,null,2)}catch{i=String(t)}else i=String(t);try{await navigator.clipboard.writeText(i);const t=e.target;t.classList.add("copy-value-btn--copied"),t.textContent="✓",setTimeout(()=>{t.classList.remove("copy-value-btn--copied"),t.textContent="copy"},1e3)}catch(s){console.error("Failed to copy value:",s)}}_openURL(t,e){e.stopPropagation();let i=t;t.startsWith("//")?i=window.location.protocol+t:t.startsWith("/")&&(i=window.location.origin+t),window.open(i,"_blank")}_renderValue(t,e){switch(e){case"string":const e=this._isURL(t),i=t.length>80?t.slice(0,80)+"...":t;return e?U`<span class="value value--url" @click=${e=>this._openURL(t,e)} title="Click to open: ${t}">"${i}"</span>`:U`<span class="value value--string">"${i}"</span>`;case"number":return U`<span class="value value--number">${t}</span>`;case"boolean":return U`<span class="value value--boolean">${t}</span>`;case"null":return U`<span class="value value--null">null</span>`;case"undefined":return U`<span class="value value--undefined">undefined</span>`;case"object":case"array":return U`<span class="preview">{}</span>`;default:return U`<span class="value">${String(t)}</span>`}}_renderValueWithHighlight(t,e,i){if(!i)return this._renderValue(t,e);switch(e){case"string":const e=this._isURL(t),s=t.length>80?t.slice(0,80)+"...":t;return e?U`<span class="value value--url" @click=${e=>this._openURL(t,e)} title="Click to open: ${t}">"${this._highlightText(s,i)}"</span>`:U`<span class="value value--string">"${this._highlightText(s,i)}"</span>`;case"number":return U`<span class="value value--number">${this._highlightText(String(t),i)}</span>`;case"boolean":return U`<span class="value value--boolean">${this._highlightText(String(t),i)}</span>`;case"null":return U`<span class="value value--null">null</span>`;case"undefined":return U`<span class="value value--undefined">undefined</span>`;case"object":case"array":return U`<span class="preview">{}</span>`;default:return U`<span class="value">${this._highlightText(String(t),i)}</span>`}}_renderPreview(t,e){let i;try{i=Object.keys(t).length}catch{i=0}if("array"===e){const e=[],s=3;for(let r=0;r<Math.min(i,s);r++){const i=t[r],s=this._getType(i);if("string"===s){const t=i.length>15?i.slice(0,15)+"…":i;e.push(U`<span class="array-preview-item array-preview-item--string">"${t}"</span>`)}else"number"===s?e.push(U`<span class="array-preview-item array-preview-item--number">${i}</span>`):"object"===s||"array"===s?e.push(U`<span class="array-preview-item">{…}</span>`):e.push(U`<span class="array-preview-item">${String(i)}</span>`)}const a=i>s;return U`
153
153
  <span class="preview">Array(${i})</span>
154
154
  ${e.length>0?U`
155
155
  <span class="preview-keys">[${e.map((t,i)=>U`${t}${i<e.length-1?", ":""}`)}${a?", …":""}]</span>
@@ -612,7 +612,7 @@ var __defProp=Object.defineProperty,__defNormalProp=(t,e,i)=>e in t?__defProp(t,
612
612
  text-transform: uppercase;
613
613
  letter-spacing: 0.5px;
614
614
  }
615
- `]);let $t=kt;customElements.define("tdt-objects-panel",$t);const St=class t extends ot{constructor(){super(),this.cart=null,this.previousCart=null,this.diff=null,this.showHistory=!1,this.cartHistory=[],this.showAddProduct=!1,this.showAttributes=!1,this.showDiscountInput=!1,this.expandedItems=new Set,this.variantIdInput="",this.quantityInput=1,this.discountInput="",this.editingNote=!1,this.noteInput="",this.editingAttributes=!1,this.attributesInput={},this._toastTimeout=null,this.showScenarios=!1,this.scenarios=[],this.editingScenario=null,this.scenarioNameInput="",this._loadScenarios()}_loadScenarios(){try{const e=localStorage.getItem(t.SCENARIOS_STORAGE_KEY);e&&(this.scenarios=JSON.parse(e))}catch(e){console.warn("[TDT] Failed to load scenarios:",e)}}_saveScenarios(){try{localStorage.setItem(t.SCENARIOS_STORAGE_KEY,JSON.stringify(this.scenarios))}catch(e){console.warn("[TDT] Failed to save scenarios:",e)}}updated(t){if(t.has("cart")&&this.cart){const e=t.get("cart");e&&(this.previousCart=e,this.diff=mt.diffCart(e,this.cart)),this.showHistory&&(this.cartHistory=[...mt.cartHistory].reverse())}}async _refresh(){const t=await mt.fetch();t&&mt.setCart(t)}async _clear(){confirm("Clear entire cart?")&&await mt.clear()}async _updateQuantity(t,e){await mt.change(t+1,e)}async _remove(t){await mt.change(t+1,0)}_formatMoney(t){return null==t?"—":`$${(t/100).toFixed(2)}`}_exportCartJSON(){if(!this.cart)return;const t=JSON.stringify(this.cart,null,2),e=new Blob([t],{type:"application/json"}),i=URL.createObjectURL(e),s=document.createElement("a");s.href=i,s.download=`cart-${(new Date).toISOString().slice(0,10)}.json`,document.body.appendChild(s),s.click(),document.body.removeChild(s),URL.revokeObjectURL(i)}_copyCartPermalink(){if(!this.cart||0===this.cart.items.length)return;const t=this.cart.items.map(t=>`${t.variant_id}:${t.quantity}`).join(","),e=`${window.location.origin}/cart/${t}`;navigator.clipboard.writeText(e),this._showToast("Cart permalink copied!")}_showToast(t){this._toastTimeout&&clearTimeout(this._toastTimeout),this._toastMessage=t,this.requestUpdate(),this._toastTimeout=setTimeout(()=>{this._toastMessage=null,this.requestUpdate()},2e3)}_toggleHistory(){this.showHistory=!this.showHistory,this.showHistory&&(this.cartHistory=[...mt.cartHistory].reverse())}_formatHistoryTime(t){const e=new Date(t),i=new Date-e;return i<6e4?"Just now":i<36e5?`${Math.floor(i/6e4)}m ago`:i<864e5?`${Math.floor(i/36e5)}h ago`:e.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}async _restoreCart(t){if(!t.snapshot)return;const e=t.snapshot;try{if(mt.startRestore(),await mt.clear(),e.items&&e.items.length>0){const t=e.items.map(t=>{var e,i;const s={id:t.variant_id,quantity:t.quantity};return t.properties&&Object.keys(t.properties).length>0&&(s.properties=t.properties),(null==(i=null==(e=t.selling_plan_allocation)?void 0:e.selling_plan)?void 0:i.id)&&(s.selling_plan=t.selling_plan_allocation.selling_plan.id),s});await fetch("/cart/add.js",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({items:t})})}const t={};e.attributes&&Object.keys(e.attributes).length>0&&(t.attributes=e.attributes),e.note&&(t.note=e.note),Object.keys(t).length>0&&await fetch("/cart/update.js",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(t)});const i=await mt.fetch();mt.endRestore(i),i&&mt.notify(i,null),this._showToast("Cart restored!")}catch(i){mt.endRestore(),console.error("[Theme Devtools] Cart restore failed:",i),this._showToast(`Restore failed: ${i.message}`)}}_getHistoryLabel(t){var e,i,s,a,r,n,o,l,d,c;const p=[];if((null==(i=null==(e=t.items)?void 0:e.added)?void 0:i.length)>0&&t.items.added.forEach(t=>{const e=t.product_title||t.title||"Item";p.push({text:`+ ${e}`,class:"diff__added"})}),(null==(a=null==(s=t.items)?void 0:s.removed)?void 0:a.length)>0&&t.items.removed.forEach(t=>{const e=t.product_title||t.title||"Item";p.push({text:`− ${e}`,class:"diff__removed"})}),(null==(n=null==(r=t.items)?void 0:r.modified)?void 0:n.length)>0&&t.items.modified.forEach(t=>{var e,i;const s=(null==(e=t.item)?void 0:e.product_title)||(null==(i=t.item)?void 0:i.title)||"Item";p.push({text:`${s}: ${t.oldQuantity} → ${t.newQuantity}`,class:"diff__modified"})}),t.noteChanged&&p.push({text:"Note updated",class:""}),t.attributesChanged&&p.push({text:"Attrs updated",class:""}),t.discountChanged&&p.push({text:"Discount changed",class:""}),0===p.length){const e=(null==(o=t.itemCount)?void 0:o.old)??0,i=(null==(l=t.itemCount)?void 0:l.new)??0;i>e?p.push({text:`+${i-e} item(s) added`,class:"diff__added"}):i<e?p.push({text:`−${e-i} item(s) removed`,class:"diff__removed"}):(null==(d=t.totalPrice)?void 0:d.old)!==(null==(c=t.totalPrice)?void 0:c.new)?p.push({text:"Price changed",class:""}):p.push({text:"Cart refreshed",class:""})}return p}_clearHistory(){0!==this.cartHistory.length&&confirm("Clear cart history?")&&(mt.cartHistory=[],sessionStorage.removeItem(mt.constructor.STORAGE_KEY),this.cartHistory=[])}_renderHistoryPanel(){return this.showHistory?U`
615
+ `]);let $t=kt;customElements.define("tdt-objects-panel",$t);const St=[{name:"[Property] GWP Validation",description:"Gift-with-purchase items need price & source tracking",rules:[{id:1,name:"GWP has required metadata",type:"property-dependency",config:{ifProperty:{key:"_is_gwp",value:"true",operator:"equals"},requiredProperties:["_gwp_price","_gwp_source","_gwp_campaign"]}}]},{name:"[Property] Personalization Check",description:"Personalized items must have engraving text",rules:[{id:1,name:"Engraving requires text",type:"property-dependency",config:{ifProperty:{key:"_personalized",value:"true",operator:"equals"},requiredProperties:["_engraving_text","_engraving_font"]}}]},{name:"[Property] Pre-order Validation",description:"Pre-order items must have expected ship date",rules:[{id:1,name:"Pre-order has ship date",type:"property-dependency",config:{ifProperty:{key:"_preorder",operator:"exists",value:""},requiredProperties:["_expected_ship_date"]}}]},{name:"[Field] Gift Card Qty = 1",description:"Gift cards cannot have quantity > 1",rules:[{id:1,name:"Gift card single qty",type:"field-value",config:{ifField:{field:"product_type",value:"Gift Card",operator:"equals"},thenField:{field:"quantity",value:"1",operator:"equals"}}}]},{name:"[Field] Subscription Valid",description:"Items with selling plans must have valid plan ID",rules:[{id:1,name:"Selling plan exists",type:"field-value",config:{ifField:{field:"selling_plan_allocation",value:"",operator:"exists"},thenField:{field:"selling_plan_allocation.selling_plan.id",value:"",operator:"exists"}}}]},{name:"[Field] Digital Products Check",description:"Digital products should not require shipping",rules:[{id:1,name:"Digital = no shipping",type:"field-value",config:{ifField:{field:"product_type",value:"Digital",operator:"equals"},thenField:{field:"requires_shipping",value:"false",operator:"equals"}}}]},{name:"[Field] SKU Required",description:"All items must have a SKU assigned",rules:[{id:1,name:"SKU exists",type:"field-value",config:{ifField:{field:"variant_id",value:"",operator:"exists"},thenField:{field:"sku",value:"",operator:"exists"}}}]},{name:"[Composition] Warranty Required",description:"Electronics must have warranty in cart",rules:[{id:1,name:"Electronics need warranty",type:"cart-composition",config:{ifItem:{field:"product_type",value:"Electronics"},requiresItem:{field:"product_type",value:"Warranty"}}}]},{name:"[Composition] Bundle Check",description:"Main product requires accessory",rules:[{id:1,name:"Phone needs case",type:"cart-composition",config:{ifItem:{field:"handle",value:"iphone-15-pro"},requiresItem:{field:"product_type",value:"Phone Case"}}}]},{name:"[Composition] Subscription + Setup",description:"Subscription box needs setup fee on first order",rules:[{id:1,name:"Sub box needs setup",type:"cart-composition",config:{ifItem:{field:"product_type",value:"Subscription Box"},requiresItem:{field:"handle",value:"setup-fee"}}}]},{name:"[Qty] Max Per Item (10)",description:"No item can have more than 10 quantity",rules:[{id:1,name:"Max 10 each",type:"quantity",config:{scope:"per-item",min:null,max:10,multiple:null,filterField:"",filterValue:""}}]},{name:"[Qty] Cart Max (50 items)",description:"Total cart cannot exceed 50 items",rules:[{id:1,name:"Cart max 50",type:"quantity",config:{scope:"cart-total",min:null,max:50,multiple:null,filterField:"",filterValue:""}}]},{name:"[Qty] Minimum Order (2+)",description:"Cart must have at least 2 items",rules:[{id:1,name:"Min 2 items",type:"quantity",config:{scope:"cart-total",min:2,max:null,multiple:null,filterField:"",filterValue:""}}]},{name:"[Qty] Pack of 6 Only",description:"Items must be bought in multiples of 6",rules:[{id:1,name:"Multiples of 6",type:"quantity",config:{scope:"per-item",min:null,max:null,multiple:6,filterField:"",filterValue:""}}]},{name:"[Qty] Samples Max 3",description:"Sample products limited to 3 total",rules:[{id:1,name:"Max 3 samples",type:"quantity",config:{scope:"cart-total",min:null,max:3,multiple:null,filterField:"product_type",filterValue:"Sample"}}]},{name:"[Qty] B2B Min 10 per SKU",description:"Wholesale orders require min 10 of each item",rules:[{id:1,name:"Min 10 per item",type:"quantity",config:{scope:"per-item",min:10,max:null,multiple:null,filterField:"",filterValue:""}}]}],Tt=class t extends ot{constructor(){super(),this.cart=null,this.previousCart=null,this.diff=null,this.showHistory=!1,this.cartHistory=[],this.showAddProduct=!1,this.showAttributes=!1,this.showDiscountInput=!1,this.expandedItems=new Set,this.variantIdInput="",this.quantityInput=1,this.discountInput="",this.editingNote=!1,this.noteInput="",this.editingAttributes=!1,this.attributesInput={},this._toastTimeout=null,this.showScenarios=!1,this.scenarios=[],this.editingScenario=null,this.scenarioNameInput="",this._loadScenarios(),this.showTests=!1,this.tests=[],this.editingTest=null,this.testResults=null,this.autoRunTests=!1,this.showTemplatesMenu=!1,this._testNameInput="",this._newPropInput="",this._loadTests()}_loadScenarios(){try{const e=localStorage.getItem(t.SCENARIOS_STORAGE_KEY);e&&(this.scenarios=JSON.parse(e))}catch(e){console.warn("[TDT] Failed to load scenarios:",e)}}_saveScenarios(){try{localStorage.setItem(t.SCENARIOS_STORAGE_KEY,JSON.stringify(this.scenarios))}catch(e){console.warn("[TDT] Failed to save scenarios:",e)}}_loadTests(){try{const e=localStorage.getItem(t.TESTS_STORAGE_KEY);e&&(this.tests=JSON.parse(e));const i=localStorage.getItem(t.TESTS_AUTORUN_KEY);this.autoRunTests="true"===i}catch(e){console.warn("[TDT] Failed to load tests:",e)}}_saveTests(){try{localStorage.setItem(t.TESTS_STORAGE_KEY,JSON.stringify(this.tests)),localStorage.setItem(t.TESTS_AUTORUN_KEY,String(this.autoRunTests))}catch(e){console.warn("[TDT] Failed to save tests:",e)}}_exportTests(){if(0===this.tests.length)return void this._showToast("No tests to export");const t=JSON.stringify(this.tests,null,2),e=new Blob([t],{type:"application/json"}),i=URL.createObjectURL(e),s=document.createElement("a");s.href=i,s.download=`cart-tests-${(new Date).toISOString().slice(0,10)}.json`,document.body.appendChild(s),s.click(),document.body.removeChild(s),URL.revokeObjectURL(i),this._showToast("Tests exported!")}async _handleImportFile(t){var e;const i=null==(e=t.target.files)?void 0:e[0];if(i)try{const t=await i.text(),e=JSON.parse(t);if(!Array.isArray(e))throw new Error("Invalid format: expected array of tests");const s=e.map(t=>({...t,id:Date.now()+Math.random(),createdAt:t.createdAt||(new Date).toISOString()}));this.tests=[...this.tests,...s],this._saveTests(),this._showToast(`Imported ${s.length} test(s)`)}catch(s){this._showToast(`Import failed: ${s.message}`)}t.target.value=""}updated(t){if(t.has("cart")&&this.cart){const e=t.get("cart");e&&(this.previousCart=e,this.diff=mt.diffCart(e,this.cart)),this.showHistory&&(this.cartHistory=[...mt.cartHistory].reverse()),this.autoRunTests&&this.tests.length>0&&this._runAllTests()}}async _refresh(){const t=await mt.fetch();t&&mt.setCart(t)}async _clear(){confirm("Clear entire cart?")&&await mt.clear()}async _updateQuantity(t,e){await mt.change(t+1,e)}async _remove(t){await mt.change(t+1,0)}_formatMoney(t){return null==t?"—":`$${(t/100).toFixed(2)}`}_exportCartJSON(){if(!this.cart)return;const t=JSON.stringify(this.cart,null,2),e=new Blob([t],{type:"application/json"}),i=URL.createObjectURL(e),s=document.createElement("a");s.href=i,s.download=`cart-${(new Date).toISOString().slice(0,10)}.json`,document.body.appendChild(s),s.click(),document.body.removeChild(s),URL.revokeObjectURL(i)}_copyCartPermalink(){if(!this.cart||0===this.cart.items.length)return;const t=this.cart.items.map(t=>`${t.variant_id}:${t.quantity}`).join(","),e=`${window.location.origin}/cart/${t}`;navigator.clipboard.writeText(e),this._showToast("Cart permalink copied!")}_showToast(t){this._toastTimeout&&clearTimeout(this._toastTimeout),this._toastMessage=t,this.requestUpdate(),this._toastTimeout=setTimeout(()=>{this._toastMessage=null,this.requestUpdate()},2e3)}_toggleHistory(){this.showHistory=!this.showHistory,this.showHistory&&(this.cartHistory=[...mt.cartHistory].reverse())}_formatHistoryTime(t){const e=new Date(t),i=new Date-e;return i<6e4?"Just now":i<36e5?`${Math.floor(i/6e4)}m ago`:i<864e5?`${Math.floor(i/36e5)}h ago`:e.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}async _restoreCart(t){if(!t.snapshot)return;const e=t.snapshot;try{if(mt.startRestore(),await mt.clear(),e.items&&e.items.length>0){const t=e.items.map(t=>{var e,i;const s={id:t.variant_id,quantity:t.quantity};return t.properties&&Object.keys(t.properties).length>0&&(s.properties=t.properties),(null==(i=null==(e=t.selling_plan_allocation)?void 0:e.selling_plan)?void 0:i.id)&&(s.selling_plan=t.selling_plan_allocation.selling_plan.id),s});await fetch("/cart/add.js",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({items:t})})}const t={};e.attributes&&Object.keys(e.attributes).length>0&&(t.attributes=e.attributes),e.note&&(t.note=e.note),Object.keys(t).length>0&&await fetch("/cart/update.js",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(t)});const i=await mt.fetch();mt.endRestore(i),i&&mt.notify(i,null),this._showToast("Cart restored!")}catch(i){mt.endRestore(),console.error("[Theme Devtools] Cart restore failed:",i),this._showToast(`Restore failed: ${i.message}`)}}_getHistoryLabel(t){var e,i,s,a,r,n,o,l,d,c;const p=[];if((null==(i=null==(e=t.items)?void 0:e.added)?void 0:i.length)>0&&t.items.added.forEach(t=>{const e=t.product_title||t.title||"Item";p.push({text:`+ ${e}`,class:"diff__added"})}),(null==(a=null==(s=t.items)?void 0:s.removed)?void 0:a.length)>0&&t.items.removed.forEach(t=>{const e=t.product_title||t.title||"Item";p.push({text:`− ${e}`,class:"diff__removed"})}),(null==(n=null==(r=t.items)?void 0:r.modified)?void 0:n.length)>0&&t.items.modified.forEach(t=>{var e,i;const s=(null==(e=t.item)?void 0:e.product_title)||(null==(i=t.item)?void 0:i.title)||"Item";p.push({text:`${s}: ${t.oldQuantity} → ${t.newQuantity}`,class:"diff__modified"})}),t.noteChanged&&p.push({text:"Note updated",class:""}),t.attributesChanged&&p.push({text:"Attrs updated",class:""}),t.discountChanged&&p.push({text:"Discount changed",class:""}),0===p.length){const e=(null==(o=t.itemCount)?void 0:o.old)??0,i=(null==(l=t.itemCount)?void 0:l.new)??0;i>e?p.push({text:`+${i-e} item(s) added`,class:"diff__added"}):i<e?p.push({text:`−${e-i} item(s) removed`,class:"diff__removed"}):(null==(d=t.totalPrice)?void 0:d.old)!==(null==(c=t.totalPrice)?void 0:c.new)?p.push({text:"Price changed",class:""}):p.push({text:"Cart refreshed",class:""})}return p}_clearHistory(){0!==this.cartHistory.length&&confirm("Clear cart history?")&&(mt.cartHistory=[],sessionStorage.removeItem(mt.constructor.STORAGE_KEY),this.cartHistory=[])}_renderHistoryPanel(){return this.showHistory?U`
616
616
  <div class="history-panel">
617
617
  <div class="history-header">
618
618
  <span>Cart History</span>
@@ -643,7 +643,7 @@ var __defProp=Object.defineProperty,__defNormalProp=(t,e,i)=>e in t?__defProp(t,
643
643
  </div>
644
644
  `}
645
645
  </div>
646
- `:""}async _addByVariantId(){const t=this.variantIdInput.trim();if(t)try{const e=await fetch("/cart/add.js",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({items:[{id:parseInt(t,10),quantity:this.quantityInput||1}]})});if(!e.ok){const t=await e.json();return void this._showToast(`Error: ${t.message||t.description||"Failed to add"}`)}this.variantIdInput="",this.quantityInput=1,this._showToast("Product added!"),await this._refresh()}catch(e){this._showToast(`Error: ${e.message}`)}}async _applyDiscount(){const t=this.discountInput.trim().toUpperCase();if(t)try{const e=`/discount/${encodeURIComponent(t)}?redirect=/cart`;window.location.href=e}catch(e){this._showToast(`Error: ${e.message}`)}}async _updateNote(){try{await fetch("/cart/update.js",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({note:this.noteInput})}),this.editingNote=!1,this._showToast("Note updated!"),await this._refresh()}catch(t){this._showToast(`Error: ${t.message}`)}}async _updateAttributes(){try{await fetch("/cart/update.js",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({attributes:this.attributesInput})}),this.editingAttributes=!1,this._showToast("Attributes updated!"),await this._refresh()}catch(t){this._showToast(`Error: ${t.message}`)}}_startEditingAttributes(){var t;this.attributesInput={...(null==(t=this.cart)?void 0:t.attributes)||{}},this.editingAttributes=!0}_startEditingNote(){var t;this.noteInput=(null==(t=this.cart)?void 0:t.note)||"",this.editingNote=!0}_toggleItemExpand(t){const e=new Set(this.expandedItems);e.has(t)?e.delete(t):e.add(t),this.expandedItems=e}async _duplicateItem(t){try{await fetch("/cart/add.js",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({items:[{id:t.variant_id,quantity:t.quantity,properties:t.properties||{}}]})}),this._showToast("Item duplicated!"),await this._refresh()}catch(e){this._showToast(`Error: ${e.message}`)}}_copyVariantId(t){navigator.clipboard.writeText(String(t.variant_id)),this._showToast("Variant ID copied!")}_copyProductId(t){navigator.clipboard.writeText(String(t.product_id)),this._showToast("Product ID copied!")}_copyItemKey(t){navigator.clipboard.writeText(t.key),this._showToast("Item key copied!")}_getDiscountPercent(t,e){return!t||t<=e?0:Math.round(100*(1-e/t))}_renderQuickAddRow(){return U`
646
+ `:""}async _addByVariantId(){const t=this.variantIdInput.trim();if(t)try{const e=await fetch("/cart/add.js",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({items:[{id:parseInt(t,10),quantity:this.quantityInput||1}]})});if(!e.ok){const t=await e.json();return void this._showToast(`Error: ${t.message||t.description||"Failed to add"}`)}this.variantIdInput="",this.quantityInput=1,this._showToast("Product added!"),await this._refresh()}catch(e){this._showToast(`Error: ${e.message}`)}}async _applyDiscount(){const t=this.discountInput.trim().toUpperCase();if(t)try{const e=`/discount/${encodeURIComponent(t)}?redirect=/cart`;window.location.href=e}catch(e){this._showToast(`Error: ${e.message}`)}}async _updateNote(){try{await fetch("/cart/update.js",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({note:this.noteInput})}),this.editingNote=!1,this._showToast("Note updated!"),await this._refresh()}catch(t){this._showToast(`Error: ${t.message}`)}}async _updateAttributes(){try{await fetch("/cart/update.js",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({attributes:this.attributesInput})}),this.editingAttributes=!1,this._showToast("Attributes updated!"),await this._refresh()}catch(t){this._showToast(`Error: ${t.message}`)}}_startEditingAttributes(){var t;this.attributesInput={...(null==(t=this.cart)?void 0:t.attributes)||{}},this.editingAttributes=!0}_startEditingNote(){var t;this.noteInput=(null==(t=this.cart)?void 0:t.note)||"",this.editingNote=!0}_toggleItemExpand(t){const e=new Set(this.expandedItems);e.has(t)?e.delete(t):e.add(t),this.expandedItems=e}async _duplicateItem(t){try{await fetch("/cart/add.js",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({items:[{id:t.variant_id,quantity:t.quantity,properties:t.properties||{}}]})}),this._showToast("Item duplicated!"),await this._refresh()}catch(e){this._showToast(`Error: ${e.message}`)}}_copyVariantId(t){navigator.clipboard.writeText(String(t.variant_id)),this._showToast("Variant ID copied!")}_copyProductId(t){navigator.clipboard.writeText(String(t.product_id)),this._showToast("Product ID copied!")}_copyItemKey(t){navigator.clipboard.writeText(t.key),this._showToast("Item key copied!")}_getDiscountPercent(t,e){return!t||t<=e?0:Math.round(100*(1-e/t))}_toggleTests(){this.showTests=!this.showTests,this.showTests||(this.editingTest=null,this.showTemplatesMenu=!1)}_toggleAutoRun(){this.autoRunTests=!this.autoRunTests,this._saveTests(),this.autoRunTests&&this.cart&&this._runAllTests()}_createNewTest(){this.editingTest={id:null,name:"",enabled:!0,rules:[{id:Date.now(),name:"New Rule",type:"property-dependency",config:{ifProperty:{key:"",value:"",operator:"equals"},requiredProperties:[]}}]},this._testNameInput=""}_createTestFromTemplate(t){this.editingTest={id:null,name:t.name,enabled:!0,rules:t.rules.map(t=>({...t,id:Date.now()+Math.random()}))},this._testNameInput=t.name,this.showTemplatesMenu=!1}_editTest(t){this.editingTest={...t,rules:t.rules.map(t=>({...t,config:JSON.parse(JSON.stringify(t.config))}))},this._testNameInput=t.name}_deleteTest(t){if(confirm("Delete this test?")&&(this.tests=this.tests.filter(e=>e.id!==t),this._saveTests(),this._showToast("Test deleted"),this.testResults)){const e={...this.testResults};delete e[t],this.testResults=e}}_cancelEditTest(){this.editingTest=null,this._testNameInput=""}_saveEditingTest(){if(!this._testNameInput.trim())return void this._showToast("Please enter a test name");const t=this.editingTest.rules.filter(t=>t.name.trim());if(0===t.length)return void this._showToast("Add at least one rule");const e={...this.editingTest,name:this._testNameInput.trim(),rules:t,id:this.editingTest.id||Date.now(),createdAt:this.editingTest.createdAt||(new Date).toISOString(),updatedAt:(new Date).toISOString()};this.editingTest.id?this.tests=this.tests.map(t=>t.id===e.id?e:t):this.tests=[...this.tests,e],this._saveTests(),this.editingTest=null,this._testNameInput="",this._showToast("Test saved!"),this.cart&&this._runAllTests()}_toggleTestEnabled(t){this.tests=this.tests.map(e=>e.id===t?{...e,enabled:!e.enabled}:e),this._saveTests(),this.cart&&this._runAllTests()}_addRule(){const t={id:Date.now(),name:"New Rule",type:"property-dependency",config:{ifProperty:{key:"",value:"",operator:"equals"},requiredProperties:[]}};this.editingTest={...this.editingTest,rules:[...this.editingTest.rules,t]}}_removeRule(t){this.editingTest={...this.editingTest,rules:this.editingTest.rules.filter(e=>e.id!==t)}}_updateRule(t,e){this.editingTest={...this.editingTest,rules:this.editingTest.rules.map(i=>i.id===t?{...i,...e}:i)}}_updateRuleConfig(t,e,i){this.editingTest={...this.editingTest,rules:this.editingTest.rules.map(s=>{if(s.id!==t)return s;const a=JSON.parse(JSON.stringify(s.config)),r=e.split(".");let n=a;for(let t=0;t<r.length-1;t++)n=n[r[t]];return n[r[r.length-1]]=i,{...s,config:a}})}}_changeRuleType(t,e){const i={"property-dependency":{ifProperty:{key:"",value:"",operator:"equals"},requiredProperties:[]},"field-value":{ifField:{field:"",value:"",operator:"equals"},thenField:{field:"",value:"",operator:"equals"}},"cart-composition":{ifItem:{field:"handle",value:""},requiresItem:{field:"handle",value:""}},quantity:{scope:"per-item",min:null,max:null,multiple:null,filterField:"",filterValue:""}};this.editingTest={...this.editingTest,rules:this.editingTest.rules.map(s=>s.id===t?{...s,type:e,config:i[e]}:s)}}_addRequiredProperty(t,e){const i=(e||this._newPropInput||"").trim();i&&(this.editingTest={...this.editingTest,rules:this.editingTest.rules.map(e=>e.id!==t?e:{...e,config:{...e.config,requiredProperties:[...e.config.requiredProperties||[],i]}})},this._newPropInput="")}_removeRequiredProperty(t,e){this.editingTest={...this.editingTest,rules:this.editingTest.rules.map(i=>i.id!==t?i:{...i,config:{...i.config,requiredProperties:i.config.requiredProperties.filter(t=>t!==e)}})}}_runAllTests(){if(!this.cart)return;const t={},e=this.tests.filter(t=>t.enabled);e.forEach(e=>{t[e.id]=this._runTest(e)}),this.testResults=t}_runTest(t){const e=[];return t.rules.forEach(t=>{const i=this._evaluateRule(t);e.push(...i)}),{testId:t.id,passed:0===e.length,timestamp:(new Date).toISOString(),failures:e}}_evaluateRule(t){var e,i,s,a;const r=[],n=(null==(e=this.cart)?void 0:e.items)||[];switch(t.type){case"property-dependency":n.forEach(e=>{if(this._matchesCondition(e,t.config.ifProperty,"property")){const i=e.properties||{},s=t.config.requiredProperties.filter(t=>!(t in i));s.length>0&&r.push({ruleId:t.id,ruleName:t.name,message:`Missing required properties: ${s.join(", ")}`,itemKey:e.key,itemTitle:e.product_title})}});break;case"field-value":n.forEach(e=>{if(this._matchesCondition(e,t.config.ifField,"field")&&!this._matchesCondition(e,t.config.thenField,"field")){const i=t.config.thenField;r.push({ruleId:t.id,ruleName:t.name,message:`${i.field} should ${i.operator} "${i.value}"`,itemKey:e.key,itemTitle:e.product_title})}});break;case"cart-composition":const e=n.filter(e=>this._getNestedValue(e,t.config.ifItem.field)===t.config.ifItem.value);if(e.length>0){n.some(e=>this._getNestedValue(e,t.config.requiresItem.field)===t.config.requiresItem.value)||r.push({ruleId:t.id,ruleName:t.name,message:`Cart should contain item with ${t.config.requiresItem.field}="${t.config.requiresItem.value}"`,itemKey:e[0].key,itemTitle:e[0].product_title})}break;case"quantity":const{scope:o,min:l,max:d,multiple:c,filterField:p,filterValue:u}=t.config;let h=n;if(p&&u&&(h=n.filter(t=>String(this._getNestedValue(t,p))===String(u))),"per-item"===o)h.forEach(e=>{const i=e.quantity;null!==l&&""!==l&&i<Number(l)&&r.push({ruleId:t.id,ruleName:t.name,message:`Quantity ${i} is below minimum ${l}`,itemKey:e.key,itemTitle:e.product_title}),null!==d&&""!==d&&i>Number(d)&&r.push({ruleId:t.id,ruleName:t.name,message:`Quantity ${i} exceeds maximum ${d}`,itemKey:e.key,itemTitle:e.product_title}),null!==c&&""!==c&&i%Number(c)!==0&&r.push({ruleId:t.id,ruleName:t.name,message:`Quantity ${i} must be a multiple of ${c}`,itemKey:e.key,itemTitle:e.product_title})});else if("cart-total"===o){const e=h.reduce((t,e)=>t+e.quantity,0);null!==l&&""!==l&&e<Number(l)&&r.push({ruleId:t.id,ruleName:t.name,message:`Cart total quantity ${e} is below minimum ${l}`,itemKey:(null==(i=h[0])?void 0:i.key)||"cart",itemTitle:"Cart Total"}),null!==d&&""!==d&&e>Number(d)&&r.push({ruleId:t.id,ruleName:t.name,message:`Cart total quantity ${e} exceeds maximum ${d}`,itemKey:(null==(s=h[0])?void 0:s.key)||"cart",itemTitle:"Cart Total"}),null!==c&&""!==c&&e%Number(c)!==0&&r.push({ruleId:t.id,ruleName:t.name,message:`Cart total quantity ${e} must be a multiple of ${c}`,itemKey:(null==(a=h[0])?void 0:a.key)||"cart",itemTitle:"Cart Total"})}}return r}_matchesCondition(t,e,i){let s;switch(s="property"===i?(t.properties||{})[e.key]:this._getNestedValue(t,e.field),e.operator){case"equals":return String(s)===String(e.value);case"not-equals":return String(s)!==String(e.value);case"contains":return String(s||"").includes(e.value);case"exists":return null!=s&&""!==s;case"less-than":return Number(s)<Number(e.value);case"greater-than":return Number(s)>Number(e.value);default:return!1}}_getNestedValue(t,e){if(e)return e.split(".").reduce((t,e)=>(t||{})[e],t)}_getFailedItemKeys(){if(!this.testResults)return new Set;const t=new Set;return Object.values(this.testResults).forEach(e=>{e.failures.forEach(e=>t.add(e.itemKey))}),t}_getTestsSummary(){if(!this.testResults)return{total:0,passed:0,failed:0};const t=Object.values(this.testResults);return{total:t.length,passed:t.filter(t=>t.passed).length,failed:t.filter(t=>!t.passed).length}}_getAllFailures(){if(!this.testResults)return[];const t=[];return Object.values(this.testResults).forEach(e=>{t.push(...e.failures)}),t}_renderQuickAddRow(){return U`
647
647
  <div class="quick-add-row">
648
648
  <span class="label">Add:</span>
649
649
  <input
@@ -827,13 +827,17 @@ var __defProp=Object.defineProperty,__defNormalProp=(t,e,i)=>e in t?__defProp(t,
827
827
 
828
828
  ${a?U`
829
829
  <div class="item-properties">
830
- <div class="item-properties-title">Line Item Properties:</div>
831
- ${Object.entries(s).map(([t,e])=>U`
832
- <div class="item-detail-row">
833
- <span class="item-detail-label">${t}:</span>
834
- <span class="item-detail-value">${e}</span>
835
- </div>
836
- `)}
830
+ <div class="item-properties-title">Properties</div>
831
+ <table class="item-properties-table">
832
+ <tbody>
833
+ ${Object.entries(s).map(([t,e])=>U`
834
+ <tr>
835
+ <td class="prop-key">${t}</td>
836
+ <td class="prop-value">${e}</td>
837
+ </tr>
838
+ `)}
839
+ </tbody>
840
+ </table>
837
841
  </div>
838
842
  `:""}
839
843
 
@@ -933,13 +937,14 @@ var __defProp=Object.defineProperty,__defNormalProp=(t,e,i)=>e in t?__defProp(t,
933
937
  @input=${t=>this._updateScenarioItem(e,"quantity",parseInt(t.target.value,10)||1)}
934
938
  >
935
939
  <div class="scenario-item-props">
936
- ${Object.entries(t.properties).map(([t,i])=>U`
937
- <div class="scenario-item-props-row">
940
+ ${Object.entries(t.properties).map(([t,i],s)=>U`
941
+ <div class="scenario-item-props-row" data-prop-index="${s}">
938
942
  <input
939
943
  type="text"
940
944
  placeholder="key"
941
945
  .value=${t}
942
- @input=${s=>this._updateScenarioItemProperty(e,t,s.target.value,i)}
946
+ @change=${s=>this._updateScenarioItemProperty(e,t,s.target.value,i)}
947
+ @blur=${s=>this._updateScenarioItemProperty(e,t,s.target.value,i)}
943
948
  >
944
949
  <input
945
950
  type="text"
@@ -968,7 +973,362 @@ var __defProp=Object.defineProperty,__defNormalProp=(t,e,i)=>e in t?__defProp(t,
968
973
  <button class="scenario-btn scenario-btn--primary" @click=${this._saveEditingScenario}>Save Scenario</button>
969
974
  </div>
970
975
  </div>
971
- `}render(){if(!this.cart)return U`<div class="empty-state">Loading cart...</div>`;const t=this.diff&&(this.diff.items.added.length>0||this.diff.items.removed.length>0||this.diff.items.modified.length>0);return U`
976
+ `}_renderTestsPanel(){if(!this.showTests)return"";const t=this._getTestsSummary(),e=this._getAllFailures();return U`
977
+ <div class="tests-panel">
978
+ <div class="tests-header">
979
+ <span>Cart Tests</span>
980
+ <div class="tests-header-actions">
981
+ ${t.total>0?U`
982
+ <span class="tests-status ${t.failed>0?"tests-status--fail":"tests-status--pass"}">
983
+ ${t.failed>0?`${t.failed} failed`:`${t.passed} passed`}
984
+ </span>
985
+ `:U`
986
+ <span class="tests-status tests-status--idle">No tests</span>
987
+ `}
988
+ <label class="autorun-toggle" title="Auto-run tests when cart changes">
989
+ <input type="checkbox" ?checked=${this.autoRunTests} @change=${this._toggleAutoRun}>
990
+ Auto
991
+ </label>
992
+ <button class="test-btn" @click=${this._runAllTests} title="Run all tests">
993
+ Run
994
+ </button>
995
+ <div class="templates-dropdown">
996
+ <button class="test-btn" @click=${()=>this.showTemplatesMenu=!this.showTemplatesMenu}>
997
+ Templates ▾
998
+ </button>
999
+ ${this.showTemplatesMenu?U`
1000
+ <div class="templates-menu">
1001
+ ${St.map(t=>U`
1002
+ <div class="templates-menu-item" @click=${()=>this._createTestFromTemplate(t)}>
1003
+ <div class="templates-menu-item-name">${t.name}</div>
1004
+ <div class="templates-menu-item-desc">${t.description}</div>
1005
+ </div>
1006
+ `)}
1007
+ </div>
1008
+ `:""}
1009
+ </div>
1010
+ <label class="test-btn" title="Import tests" style="cursor:pointer;">
1011
+ Import
1012
+ <input
1013
+ type="file"
1014
+ accept=".json"
1015
+ style="position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0;"
1016
+ @change=${this._handleImportFile}
1017
+ >
1018
+ </label>
1019
+ <button class="test-btn" @click=${this._exportTests} title="Export tests">
1020
+ Export
1021
+ </button>
1022
+ <button class="test-btn test-btn--primary" @click=${this._createNewTest}>
1023
+ + New
1024
+ </button>
1025
+ </div>
1026
+ </div>
1027
+
1028
+ ${this.editingTest?this._renderTestEditor():U`
1029
+ ${0===this.tests.length?U`
1030
+ <div class="tests-empty">
1031
+ No tests created yet. Create a new test or use a template.
1032
+ </div>
1033
+ `:U`
1034
+ <div class="test-list">
1035
+ ${this.tests.map(t=>{var e;const i=null==(e=this.testResults)?void 0:e[t.id],s=i&&!i.passed;return U`
1036
+ <div class="test-item ${s?"test-item--failed":""}">
1037
+ <div
1038
+ class="test-toggle ${t.enabled?"enabled":""}"
1039
+ @click=${()=>this._toggleTestEnabled(t.id)}
1040
+ title="${t.enabled?"Disable test":"Enable test"}"
1041
+ ></div>
1042
+ <div class="test-info">
1043
+ <div class="test-name">
1044
+ ${t.name}
1045
+ ${i?U`
1046
+ <span class="test-badge ${i.passed?"test-badge--pass":"test-badge--fail"}">
1047
+ ${i.passed?"✓ Pass":`✗ ${i.failures.length} fail`}
1048
+ </span>
1049
+ `:""}
1050
+ </div>
1051
+ <div class="test-meta">
1052
+ ${t.rules.length} rule${1!==t.rules.length?"s":""}
1053
+ </div>
1054
+ </div>
1055
+ <div class="test-actions">
1056
+ <button class="test-btn" @click=${()=>this._editTest(t)} title="Edit test">
1057
+ Edit
1058
+ </button>
1059
+ <button class="test-btn test-btn--danger" @click=${()=>this._deleteTest(t.id)} title="Delete">
1060
+ ×
1061
+ </button>
1062
+ </div>
1063
+ </div>
1064
+ `})}
1065
+ </div>
1066
+ `}
1067
+ `}
1068
+
1069
+ ${e.length>0&&!this.editingTest?U`
1070
+ <div class="test-results">
1071
+ <div class="test-results-summary">
1072
+ <span style="color: var(--tdt-danger); font-weight: 600;">
1073
+ ${e.length} failure${1!==e.length?"s":""} found
1074
+ </span>
1075
+ </div>
1076
+ <div class="test-failures">
1077
+ ${e.slice(0,5).map(t=>U`
1078
+ <div class="test-failure-item">
1079
+ <div class="failure-rule">${t.ruleName}</div>
1080
+ <div class="failure-message">${t.message}</div>
1081
+ <div class="failure-item-ref">Item: ${t.itemTitle}</div>
1082
+ </div>
1083
+ `)}
1084
+ ${e.length>5?U`
1085
+ <div style="padding: 6px 8px; color: var(--tdt-text-muted); font-size: calc(10px * var(--tdt-scale, 1));">
1086
+ ... and ${e.length-5} more
1087
+ </div>
1088
+ `:""}
1089
+ </div>
1090
+ </div>
1091
+ `:""}
1092
+ </div>
1093
+ `}_renderTestEditor(){return U`
1094
+ <div class="test-editor">
1095
+ <div class="test-editor-header">
1096
+ <input
1097
+ type="text"
1098
+ placeholder="Test name..."
1099
+ .value=${this._testNameInput}
1100
+ @input=${t=>this._testNameInput=t.target.value}
1101
+ >
1102
+ </div>
1103
+
1104
+ <div class="rules-list">
1105
+ ${this.editingTest.rules.map(t=>U`
1106
+ <div class="rule-item">
1107
+ <div class="rule-header">
1108
+ <input
1109
+ type="text"
1110
+ placeholder="Rule name"
1111
+ .value=${t.name}
1112
+ @input=${e=>this._updateRule(t.id,{name:e.target.value})}
1113
+ >
1114
+ <select
1115
+ .value=${t.type}
1116
+ @change=${e=>this._changeRuleType(t.id,e.target.value)}
1117
+ >
1118
+ <option value="property-dependency">Property Dependency</option>
1119
+ <option value="field-value">Field Value</option>
1120
+ <option value="cart-composition">Cart Composition</option>
1121
+ <option value="quantity">Quantity</option>
1122
+ </select>
1123
+ ${this.editingTest.rules.length>1?U`
1124
+ <button class="test-btn test-btn--danger" @click=${()=>this._removeRule(t.id)}>×</button>
1125
+ `:""}
1126
+ </div>
1127
+
1128
+ <div class="rule-config">
1129
+ ${this._renderRuleConfig(t)}
1130
+ </div>
1131
+ </div>
1132
+ `)}
1133
+ </div>
1134
+
1135
+ <button class="add-rule-btn" @click=${this._addRule}>
1136
+ + Add Rule
1137
+ </button>
1138
+
1139
+ <div class="test-editor-actions">
1140
+ <button class="test-btn" @click=${this._cancelEditTest}>Cancel</button>
1141
+ <button class="test-btn test-btn--primary" @click=${this._saveEditingTest}>Save Test</button>
1142
+ </div>
1143
+ </div>
1144
+ `}_renderRuleConfig(t){var e,i,s,a,r,n,o,l,d,c,p,u,h,g,v,m;switch(t.type){case"property-dependency":return U`
1145
+ <div class="rule-config-row">
1146
+ <label>IF property</label>
1147
+ <input
1148
+ type="text"
1149
+ placeholder="key"
1150
+ style="max-width: 100px;"
1151
+ .value=${(null==(e=t.config.ifProperty)?void 0:e.key)||""}
1152
+ @input=${e=>this._updateRuleConfig(t.id,"ifProperty.key",e.target.value)}
1153
+ >
1154
+ <select
1155
+ .value=${(null==(i=t.config.ifProperty)?void 0:i.operator)||"equals"}
1156
+ @change=${e=>this._updateRuleConfig(t.id,"ifProperty.operator",e.target.value)}
1157
+ >
1158
+ <option value="equals">equals</option>
1159
+ <option value="exists">exists</option>
1160
+ <option value="contains">contains</option>
1161
+ </select>
1162
+ ${"exists"!==(null==(s=t.config.ifProperty)?void 0:s.operator)?U`
1163
+ <input
1164
+ type="text"
1165
+ placeholder="value"
1166
+ .value=${(null==(a=t.config.ifProperty)?void 0:a.value)||""}
1167
+ @input=${e=>this._updateRuleConfig(t.id,"ifProperty.value",e.target.value)}
1168
+ >
1169
+ `:""}
1170
+ </div>
1171
+ <div class="rule-config-row">
1172
+ <label>THEN require properties:</label>
1173
+ </div>
1174
+ <div class="rule-props-list">
1175
+ ${(t.config.requiredProperties||[]).map(e=>U`
1176
+ <span class="rule-prop-tag">
1177
+ ${e}
1178
+ <button @click=${()=>this._removeRequiredProperty(t.id,e)}>×</button>
1179
+ </span>
1180
+ `)}
1181
+ <input
1182
+ type="text"
1183
+ placeholder="+ add property"
1184
+ style="width: 100px; font-size: calc(9px * var(--tdt-scale, 1));"
1185
+ @keypress=${e=>{"Enter"===e.key&&e.target.value.trim()&&(this._addRequiredProperty(t.id,e.target.value),e.target.value="")}}
1186
+ >
1187
+ </div>
1188
+ `;case"field-value":return U`
1189
+ <div class="rule-config-row">
1190
+ <label>IF field</label>
1191
+ <input
1192
+ type="text"
1193
+ placeholder="field (e.g. product_type)"
1194
+ .value=${(null==(r=t.config.ifField)?void 0:r.field)||""}
1195
+ @input=${e=>this._updateRuleConfig(t.id,"ifField.field",e.target.value)}
1196
+ >
1197
+ <select
1198
+ .value=${(null==(n=t.config.ifField)?void 0:n.operator)||"equals"}
1199
+ @change=${e=>this._updateRuleConfig(t.id,"ifField.operator",e.target.value)}
1200
+ >
1201
+ <option value="equals">equals</option>
1202
+ <option value="not-equals">not equals</option>
1203
+ <option value="contains">contains</option>
1204
+ <option value="exists">exists</option>
1205
+ </select>
1206
+ ${"exists"!==(null==(o=t.config.ifField)?void 0:o.operator)?U`
1207
+ <input
1208
+ type="text"
1209
+ placeholder="value"
1210
+ .value=${(null==(l=t.config.ifField)?void 0:l.value)||""}
1211
+ @input=${e=>this._updateRuleConfig(t.id,"ifField.value",e.target.value)}
1212
+ >
1213
+ `:""}
1214
+ </div>
1215
+ <div class="rule-config-row">
1216
+ <label>THEN field</label>
1217
+ <input
1218
+ type="text"
1219
+ placeholder="field (e.g. quantity)"
1220
+ .value=${(null==(d=t.config.thenField)?void 0:d.field)||""}
1221
+ @input=${e=>this._updateRuleConfig(t.id,"thenField.field",e.target.value)}
1222
+ >
1223
+ <select
1224
+ .value=${(null==(c=t.config.thenField)?void 0:c.operator)||"equals"}
1225
+ @change=${e=>this._updateRuleConfig(t.id,"thenField.operator",e.target.value)}
1226
+ >
1227
+ <option value="equals">equals</option>
1228
+ <option value="not-equals">not equals</option>
1229
+ <option value="less-than">less than</option>
1230
+ <option value="greater-than">greater than</option>
1231
+ <option value="exists">exists</option>
1232
+ </select>
1233
+ ${"exists"!==(null==(p=t.config.thenField)?void 0:p.operator)?U`
1234
+ <input
1235
+ type="text"
1236
+ placeholder="value"
1237
+ .value=${(null==(u=t.config.thenField)?void 0:u.value)||""}
1238
+ @input=${e=>this._updateRuleConfig(t.id,"thenField.value",e.target.value)}
1239
+ >
1240
+ `:""}
1241
+ </div>
1242
+ `;case"cart-composition":return U`
1243
+ <div class="rule-config-row">
1244
+ <label>IF cart has item with</label>
1245
+ <input
1246
+ type="text"
1247
+ placeholder="field"
1248
+ style="max-width: 80px;"
1249
+ .value=${(null==(h=t.config.ifItem)?void 0:h.field)||""}
1250
+ @input=${e=>this._updateRuleConfig(t.id,"ifItem.field",e.target.value)}
1251
+ >
1252
+ <span>=</span>
1253
+ <input
1254
+ type="text"
1255
+ placeholder="value"
1256
+ .value=${(null==(g=t.config.ifItem)?void 0:g.value)||""}
1257
+ @input=${e=>this._updateRuleConfig(t.id,"ifItem.value",e.target.value)}
1258
+ >
1259
+ </div>
1260
+ <div class="rule-config-row">
1261
+ <label>THEN cart must also have item with</label>
1262
+ <input
1263
+ type="text"
1264
+ placeholder="field"
1265
+ style="max-width: 80px;"
1266
+ .value=${(null==(v=t.config.requiresItem)?void 0:v.field)||""}
1267
+ @input=${e=>this._updateRuleConfig(t.id,"requiresItem.field",e.target.value)}
1268
+ >
1269
+ <span>=</span>
1270
+ <input
1271
+ type="text"
1272
+ placeholder="value"
1273
+ .value=${(null==(m=t.config.requiresItem)?void 0:m.value)||""}
1274
+ @input=${e=>this._updateRuleConfig(t.id,"requiresItem.value",e.target.value)}
1275
+ >
1276
+ </div>
1277
+ `;case"quantity":return U`
1278
+ <div class="rule-config-row">
1279
+ <label>Scope</label>
1280
+ <select
1281
+ .value=${t.config.scope||"per-item"}
1282
+ @change=${e=>this._updateRuleConfig(t.id,"scope",e.target.value)}
1283
+ >
1284
+ <option value="per-item">Per Item</option>
1285
+ <option value="cart-total">Cart Total</option>
1286
+ </select>
1287
+ </div>
1288
+ <div class="rule-config-row">
1289
+ <label>Min</label>
1290
+ <input
1291
+ type="number"
1292
+ placeholder="—"
1293
+ style="width: 60px;"
1294
+ .value=${t.config.min??""}
1295
+ @input=${e=>this._updateRuleConfig(t.id,"min",e.target.value?Number(e.target.value):null)}
1296
+ >
1297
+ <label>Max</label>
1298
+ <input
1299
+ type="number"
1300
+ placeholder="—"
1301
+ style="width: 60px;"
1302
+ .value=${t.config.max??""}
1303
+ @input=${e=>this._updateRuleConfig(t.id,"max",e.target.value?Number(e.target.value):null)}
1304
+ >
1305
+ <label>Multiple of</label>
1306
+ <input
1307
+ type="number"
1308
+ placeholder="—"
1309
+ style="width: 60px;"
1310
+ .value=${t.config.multiple??""}
1311
+ @input=${e=>this._updateRuleConfig(t.id,"multiple",e.target.value?Number(e.target.value):null)}
1312
+ >
1313
+ </div>
1314
+ <div class="rule-config-row">
1315
+ <label>Filter (optional)</label>
1316
+ <input
1317
+ type="text"
1318
+ placeholder="field"
1319
+ style="width: 80px;"
1320
+ .value=${t.config.filterField||""}
1321
+ @input=${e=>this._updateRuleConfig(t.id,"filterField",e.target.value)}
1322
+ >
1323
+ <span>=</span>
1324
+ <input
1325
+ type="text"
1326
+ placeholder="value"
1327
+ .value=${t.config.filterValue||""}
1328
+ @input=${e=>this._updateRuleConfig(t.id,"filterValue",e.target.value)}
1329
+ >
1330
+ </div>
1331
+ `;default:return U`<div>Unknown rule type</div>`}}render(){if(!this.cart)return U`<div class="empty-state">Loading cart...</div>`;const t=this.diff&&(this.diff.items.added.length>0||this.diff.items.removed.length>0||this.diff.items.modified.length>0);return U`
972
1332
  <div class="toolbar">
973
1333
  <div class="stats">
974
1334
  <span><strong>${this.cart.item_count}</strong> items</span>
@@ -977,6 +1337,14 @@ var __defProp=Object.defineProperty,__defNormalProp=(t,e,i)=>e in t?__defProp(t,
977
1337
  ${this._renderInlineDiscounts()}
978
1338
  </div>
979
1339
  <div class="actions">
1340
+ <button
1341
+ class="history-toggle ${this.showTests?"active":""}"
1342
+ @click=${this._toggleTests}
1343
+ title="Cart tests"
1344
+ >
1345
+ Tests ${this.tests.length>0?`(${this.tests.length})`:""}
1346
+ ${this._getTestsSummary().failed>0?U`<span style="color: var(--tdt-danger);">!</span>`:""}
1347
+ </button>
980
1348
  <button
981
1349
  class="history-toggle ${this.showScenarios?"active":""}"
982
1350
  @click=${this._toggleScenarios}
@@ -1005,6 +1373,7 @@ var __defProp=Object.defineProperty,__defNormalProp=(t,e,i)=>e in t?__defProp(t,
1005
1373
  ${this._renderQuickAddRow()}
1006
1374
  ${this._renderMetaRow()}
1007
1375
  ${this._renderMetaPanel()}
1376
+ ${this._renderTestsPanel()}
1008
1377
  ${this._renderScenarioPanel()}
1009
1378
  ${this._renderHistoryPanel()}
1010
1379
 
@@ -1037,13 +1406,16 @@ var __defProp=Object.defineProperty,__defNormalProp=(t,e,i)=>e in t?__defProp(t,
1037
1406
  </tr>
1038
1407
  </thead>
1039
1408
  <tbody>
1040
- ${this.cart.items.map((t,e)=>{var i,s;const a=this.expandedItems.has(t.key),r=t.original_line_price&&t.original_line_price>t.line_price,n=this._getDiscountPercent(t.original_line_price,t.line_price),o=t.properties&&Object.keys(t.properties).length>0,l=!!t.selling_plan_allocation;return U`
1041
- <tr class="item-row ${a?"expanded":""}" @click=${()=>this._toggleItemExpand(t.key)}>
1409
+ ${this.cart.items.map((t,e)=>{var i,s;const a=this.expandedItems.has(t.key),r=t.original_line_price&&t.original_line_price>t.line_price,n=this._getDiscountPercent(t.original_line_price,t.line_price),o=t.properties&&Object.keys(t.properties).length>0,l=!!t.selling_plan_allocation,d=this._getFailedItemKeys().has(t.key);return U`
1410
+ <tr class="item-row ${a?"expanded":""} ${d?"test-failed":""}" @click=${()=>this._toggleItemExpand(t.key)}>
1042
1411
  <td class="col-img">
1043
1412
  ${t.image?U`<img class="item-img" src="${t.image.replace(/(\.[^.]+)$/,"_60x60$1")}" alt="">`:U`<div class="item-img"></div>`}
1044
1413
  </td>
1045
1414
  <td>
1046
- <div class="item-title" title="${t.product_title}">${t.product_title}</div>
1415
+ <div class="item-title" title="${t.product_title}">
1416
+ ${t.product_title}
1417
+ ${d?U`<span class="test-fail-indicator">✗ Test failed</span>`:""}
1418
+ </div>
1047
1419
  ${t.variant_title?U`<div class="item-variant">${t.variant_title}</div>`:""}
1048
1420
  ${l?U`
1049
1421
  <span class="selling-plan-badge" style="margin-top: 2px;">
@@ -1091,7 +1463,7 @@ var __defProp=Object.defineProperty,__defNormalProp=(t,e,i)=>e in t?__defProp(t,
1091
1463
  </tbody>
1092
1464
  </table>
1093
1465
  `}
1094
- `}};__publicField(St,"properties",{cart:{type:Object},previousCart:{type:Object,state:!0},diff:{type:Object,state:!0},showHistory:{type:Boolean,state:!0},cartHistory:{type:Array,state:!0},showAddProduct:{type:Boolean,state:!0},showAttributes:{type:Boolean,state:!0},showDiscountInput:{type:Boolean,state:!0},expandedItems:{type:Set,state:!0},variantIdInput:{type:String,state:!0},quantityInput:{type:Number,state:!0},discountInput:{type:String,state:!0},editingNote:{type:Boolean,state:!0},noteInput:{type:String,state:!0},editingAttributes:{type:Boolean,state:!0},attributesInput:{type:Object,state:!0},showScenarios:{type:Boolean,state:!0},scenarios:{type:Array,state:!0},editingScenario:{type:Object,state:!0},scenarioNameInput:{type:String,state:!0}}),__publicField(St,"SCENARIOS_STORAGE_KEY","tdt_cart_scenarios"),__publicField(St,"styles",[pt,n`
1466
+ `}};__publicField(Tt,"properties",{cart:{type:Object},previousCart:{type:Object,state:!0},diff:{type:Object,state:!0},showHistory:{type:Boolean,state:!0},cartHistory:{type:Array,state:!0},showAddProduct:{type:Boolean,state:!0},showAttributes:{type:Boolean,state:!0},showDiscountInput:{type:Boolean,state:!0},expandedItems:{type:Set,state:!0},variantIdInput:{type:String,state:!0},quantityInput:{type:Number,state:!0},discountInput:{type:String,state:!0},editingNote:{type:Boolean,state:!0},noteInput:{type:String,state:!0},editingAttributes:{type:Boolean,state:!0},attributesInput:{type:Object,state:!0},showScenarios:{type:Boolean,state:!0},scenarios:{type:Array,state:!0},editingScenario:{type:Object,state:!0},scenarioNameInput:{type:String,state:!0},showTests:{type:Boolean,state:!0},tests:{type:Array,state:!0},editingTest:{type:Object,state:!0},testResults:{type:Object,state:!0},autoRunTests:{type:Boolean,state:!0},showTemplatesMenu:{type:Boolean,state:!0}}),__publicField(Tt,"SCENARIOS_STORAGE_KEY","tdt_cart_scenarios"),__publicField(Tt,"TESTS_STORAGE_KEY","tdt_cart_tests"),__publicField(Tt,"TESTS_AUTORUN_KEY","tdt_cart_tests_autorun"),__publicField(Tt,"styles",[pt,n`
1095
1467
  :host {
1096
1468
  display: block;
1097
1469
  padding: 8px 12px;
@@ -1606,15 +1978,45 @@ var __defProp=Object.defineProperty,__defNormalProp=(t,e,i)=>e in t?__defProp(t,
1606
1978
 
1607
1979
  .item-properties {
1608
1980
  margin-top: 6px;
1609
- padding: 6px 8px;
1610
1981
  background: var(--tdt-bg-secondary);
1611
1982
  border-radius: var(--tdt-radius);
1983
+ overflow: hidden;
1612
1984
  }
1613
1985
 
1614
1986
  .item-properties-title {
1615
1987
  font-weight: 600;
1616
1988
  color: var(--tdt-text-muted);
1617
- margin-bottom: 4px;
1989
+ padding: 4px 8px;
1990
+ background: var(--tdt-bg-tertiary);
1991
+ font-size: calc(10px * var(--tdt-scale, 1));
1992
+ }
1993
+
1994
+ .item-properties-table {
1995
+ width: 100%;
1996
+ border-collapse: collapse;
1997
+ font-size: calc(10px * var(--tdt-scale, 1));
1998
+ }
1999
+
2000
+ .item-properties-table td {
2001
+ padding: 3px 8px;
2002
+ border-bottom: 1px solid var(--tdt-border);
2003
+ }
2004
+
2005
+ .item-properties-table tr:last-child td {
2006
+ border-bottom: none;
2007
+ }
2008
+
2009
+ .item-properties-table .prop-key {
2010
+ color: var(--tdt-text-muted);
2011
+ white-space: nowrap;
2012
+ width: 1%;
2013
+ padding-right: 12px;
2014
+ }
2015
+
2016
+ .item-properties-table .prop-value {
2017
+ color: var(--tdt-text);
2018
+ font-family: var(--tdt-font-mono);
2019
+ word-break: break-all;
1618
2020
  }
1619
2021
 
1620
2022
  .selling-plan-badge {
@@ -1953,7 +2355,497 @@ var __defProp=Object.defineProperty,__defNormalProp=(t,e,i)=>e in t?__defProp(t,
1953
2355
  color: var(--tdt-text);
1954
2356
  border-color: var(--tdt-accent);
1955
2357
  }
1956
- `]);let Tt=St;customElements.define("tdt-cart-panel",Tt);class Ct extends ot{constructor(){super(),this.meta={}}_renderSection(t,e){return U`
2358
+
2359
+ /* Cart Tests Styles */
2360
+ .tests-panel {
2361
+ background: var(--tdt-bg-secondary);
2362
+ border: 1px solid var(--tdt-border);
2363
+ border-radius: var(--tdt-radius);
2364
+ margin-bottom: 12px;
2365
+ }
2366
+
2367
+ .tests-header {
2368
+ display: flex;
2369
+ align-items: center;
2370
+ justify-content: space-between;
2371
+ padding: 8px 12px;
2372
+ background: var(--tdt-bg);
2373
+ border-bottom: 1px solid var(--tdt-border);
2374
+ font-size: calc(11px * var(--tdt-scale, 1));
2375
+ font-weight: 600;
2376
+ }
2377
+
2378
+ .tests-header-actions {
2379
+ display: flex;
2380
+ gap: 6px;
2381
+ align-items: center;
2382
+ }
2383
+
2384
+ .tests-status {
2385
+ display: inline-flex;
2386
+ align-items: center;
2387
+ gap: 4px;
2388
+ padding: 2px 8px;
2389
+ border-radius: 10px;
2390
+ font-size: calc(10px * var(--tdt-scale, 1));
2391
+ font-weight: 500;
2392
+ }
2393
+
2394
+ .tests-status--pass {
2395
+ background: rgba(16, 185, 129, 0.15);
2396
+ color: var(--tdt-success);
2397
+ }
2398
+
2399
+ .tests-status--fail {
2400
+ background: rgba(239, 68, 68, 0.15);
2401
+ color: var(--tdt-danger);
2402
+ }
2403
+
2404
+ .tests-status--idle {
2405
+ background: var(--tdt-bg-secondary);
2406
+ color: var(--tdt-text-muted);
2407
+ }
2408
+
2409
+ .test-list {
2410
+ max-height: 300px;
2411
+ overflow-y: auto;
2412
+ }
2413
+
2414
+ .test-item {
2415
+ display: flex;
2416
+ align-items: center;
2417
+ padding: 10px 12px;
2418
+ border-bottom: 1px solid var(--tdt-border);
2419
+ font-size: calc(11px * var(--tdt-scale, 1));
2420
+ gap: 10px;
2421
+ }
2422
+
2423
+ .test-item:last-child {
2424
+ border-bottom: none;
2425
+ }
2426
+
2427
+ .test-item:hover {
2428
+ background: var(--tdt-bg-hover);
2429
+ }
2430
+
2431
+ .test-item--failed {
2432
+ background: rgba(239, 68, 68, 0.05);
2433
+ }
2434
+
2435
+ .test-toggle {
2436
+ width: 32px;
2437
+ height: 18px;
2438
+ border-radius: 9px;
2439
+ background: var(--tdt-bg-tertiary);
2440
+ border: 1px solid var(--tdt-border);
2441
+ cursor: pointer;
2442
+ position: relative;
2443
+ flex-shrink: 0;
2444
+ transition: background 0.2s;
2445
+ }
2446
+
2447
+ .test-toggle::after {
2448
+ content: '';
2449
+ position: absolute;
2450
+ width: 14px;
2451
+ height: 14px;
2452
+ border-radius: 50%;
2453
+ background: white;
2454
+ top: 1px;
2455
+ left: 1px;
2456
+ transition: transform 0.2s;
2457
+ }
2458
+
2459
+ .test-toggle.enabled {
2460
+ background: var(--tdt-accent);
2461
+ border-color: var(--tdt-accent);
2462
+ }
2463
+
2464
+ .test-toggle.enabled::after {
2465
+ transform: translateX(14px);
2466
+ }
2467
+
2468
+ .test-info {
2469
+ flex: 1;
2470
+ min-width: 0;
2471
+ }
2472
+
2473
+ .test-name {
2474
+ font-weight: 600;
2475
+ color: var(--tdt-text);
2476
+ display: flex;
2477
+ align-items: center;
2478
+ gap: 6px;
2479
+ }
2480
+
2481
+ .test-meta {
2482
+ font-size: calc(10px * var(--tdt-scale, 1));
2483
+ color: var(--tdt-text-muted);
2484
+ margin-top: 2px;
2485
+ }
2486
+
2487
+ .test-badge {
2488
+ display: inline-flex;
2489
+ align-items: center;
2490
+ padding: 1px 6px;
2491
+ border-radius: 3px;
2492
+ font-size: calc(9px * var(--tdt-scale, 1));
2493
+ font-weight: 500;
2494
+ }
2495
+
2496
+ .test-badge--pass {
2497
+ background: rgba(16, 185, 129, 0.15);
2498
+ color: var(--tdt-success);
2499
+ }
2500
+
2501
+ .test-badge--fail {
2502
+ background: rgba(239, 68, 68, 0.15);
2503
+ color: var(--tdt-danger);
2504
+ }
2505
+
2506
+ .test-actions {
2507
+ display: flex;
2508
+ gap: 4px;
2509
+ flex-shrink: 0;
2510
+ }
2511
+
2512
+ .test-btn {
2513
+ padding: 4px 8px;
2514
+ font-size: calc(9px * var(--tdt-scale, 1));
2515
+ background: var(--tdt-bg-secondary);
2516
+ border: 1px solid var(--tdt-border);
2517
+ border-radius: var(--tdt-radius);
2518
+ color: var(--tdt-text-muted);
2519
+ cursor: pointer;
2520
+ }
2521
+
2522
+ .test-btn:hover {
2523
+ background: var(--tdt-bg-hover);
2524
+ color: var(--tdt-text);
2525
+ }
2526
+
2527
+ .test-btn--primary {
2528
+ background: var(--tdt-accent);
2529
+ border-color: var(--tdt-accent);
2530
+ color: white;
2531
+ }
2532
+
2533
+ .test-btn--primary:hover {
2534
+ opacity: 0.9;
2535
+ }
2536
+
2537
+ .test-btn--danger {
2538
+ color: var(--tdt-danger);
2539
+ }
2540
+
2541
+ .test-btn--danger:hover {
2542
+ background: var(--tdt-danger);
2543
+ border-color: var(--tdt-danger);
2544
+ color: white;
2545
+ }
2546
+
2547
+ .tests-empty {
2548
+ padding: 20px;
2549
+ text-align: center;
2550
+ color: var(--tdt-text-muted);
2551
+ font-size: calc(11px * var(--tdt-scale, 1));
2552
+ }
2553
+
2554
+ /* Test Editor */
2555
+ .test-editor {
2556
+ padding: 12px;
2557
+ background: var(--tdt-bg);
2558
+ border-top: 1px solid var(--tdt-border);
2559
+ }
2560
+
2561
+ .test-editor-header {
2562
+ display: flex;
2563
+ align-items: center;
2564
+ gap: 8px;
2565
+ margin-bottom: 12px;
2566
+ }
2567
+
2568
+ .test-editor-header input {
2569
+ flex: 1;
2570
+ padding: 6px 10px;
2571
+ font-size: calc(11px * var(--tdt-scale, 1));
2572
+ border: 1px solid var(--tdt-border);
2573
+ border-radius: var(--tdt-radius);
2574
+ background: var(--tdt-bg-secondary);
2575
+ color: var(--tdt-text);
2576
+ }
2577
+
2578
+ .rules-list {
2579
+ display: flex;
2580
+ flex-direction: column;
2581
+ gap: 8px;
2582
+ margin-bottom: 12px;
2583
+ max-height: 250px;
2584
+ overflow-y: auto;
2585
+ }
2586
+
2587
+ .rule-item {
2588
+ padding: 10px;
2589
+ background: var(--tdt-bg-secondary);
2590
+ border-radius: var(--tdt-radius);
2591
+ border: 1px solid var(--tdt-border);
2592
+ }
2593
+
2594
+ .rule-header {
2595
+ display: flex;
2596
+ align-items: center;
2597
+ gap: 8px;
2598
+ margin-bottom: 8px;
2599
+ }
2600
+
2601
+ .rule-header input {
2602
+ flex: 1;
2603
+ padding: 4px 8px;
2604
+ font-size: calc(10px * var(--tdt-scale, 1));
2605
+ border: 1px solid var(--tdt-border);
2606
+ border-radius: 3px;
2607
+ background: var(--tdt-bg);
2608
+ color: var(--tdt-text);
2609
+ }
2610
+
2611
+ .rule-header select {
2612
+ padding: 4px 8px;
2613
+ font-size: calc(10px * var(--tdt-scale, 1));
2614
+ border: 1px solid var(--tdt-border);
2615
+ border-radius: 3px;
2616
+ background: var(--tdt-bg);
2617
+ color: var(--tdt-text);
2618
+ cursor: pointer;
2619
+ }
2620
+
2621
+ .rule-config {
2622
+ display: flex;
2623
+ flex-direction: column;
2624
+ gap: 6px;
2625
+ font-size: calc(10px * var(--tdt-scale, 1));
2626
+ }
2627
+
2628
+ .rule-config-row {
2629
+ display: flex;
2630
+ align-items: center;
2631
+ gap: 6px;
2632
+ flex-wrap: wrap;
2633
+ }
2634
+
2635
+ .rule-config-row label {
2636
+ color: var(--tdt-text-muted);
2637
+ min-width: 50px;
2638
+ }
2639
+
2640
+ .rule-config-row input,
2641
+ .rule-config-row select {
2642
+ padding: 4px 8px;
2643
+ font-size: calc(10px * var(--tdt-scale, 1));
2644
+ border: 1px solid var(--tdt-border);
2645
+ border-radius: 3px;
2646
+ background: var(--tdt-bg);
2647
+ color: var(--tdt-text);
2648
+ }
2649
+
2650
+ .rule-config-row input {
2651
+ flex: 1;
2652
+ min-width: 80px;
2653
+ }
2654
+
2655
+ .rule-props-list {
2656
+ display: flex;
2657
+ flex-wrap: wrap;
2658
+ gap: 4px;
2659
+ margin-top: 4px;
2660
+ }
2661
+
2662
+ .rule-prop-tag {
2663
+ display: inline-flex;
2664
+ align-items: center;
2665
+ gap: 4px;
2666
+ padding: 2px 6px;
2667
+ background: var(--tdt-bg);
2668
+ border: 1px solid var(--tdt-border);
2669
+ border-radius: 3px;
2670
+ font-size: calc(9px * var(--tdt-scale, 1));
2671
+ }
2672
+
2673
+ .rule-prop-tag button {
2674
+ background: none;
2675
+ border: none;
2676
+ color: var(--tdt-text-muted);
2677
+ cursor: pointer;
2678
+ padding: 0;
2679
+ font-size: calc(10px * var(--tdt-scale, 1));
2680
+ line-height: 1;
2681
+ }
2682
+
2683
+ .rule-prop-tag button:hover {
2684
+ color: var(--tdt-danger);
2685
+ }
2686
+
2687
+ .add-rule-btn {
2688
+ display: flex;
2689
+ align-items: center;
2690
+ justify-content: center;
2691
+ padding: 8px;
2692
+ background: var(--tdt-bg-secondary);
2693
+ border: 1px dashed var(--tdt-border);
2694
+ border-radius: var(--tdt-radius);
2695
+ color: var(--tdt-text-muted);
2696
+ cursor: pointer;
2697
+ font-size: calc(10px * var(--tdt-scale, 1));
2698
+ margin-bottom: 12px;
2699
+ }
2700
+
2701
+ .add-rule-btn:hover {
2702
+ background: var(--tdt-bg-hover);
2703
+ color: var(--tdt-text);
2704
+ border-color: var(--tdt-accent);
2705
+ }
2706
+
2707
+ .test-editor-actions {
2708
+ display: flex;
2709
+ gap: 8px;
2710
+ justify-content: flex-end;
2711
+ padding-top: 8px;
2712
+ border-top: 1px solid var(--tdt-border);
2713
+ }
2714
+
2715
+ /* Test Results */
2716
+ .test-results {
2717
+ padding: 10px 12px;
2718
+ background: var(--tdt-bg);
2719
+ border-top: 1px solid var(--tdt-border);
2720
+ }
2721
+
2722
+ .test-results-summary {
2723
+ display: flex;
2724
+ align-items: center;
2725
+ gap: 12px;
2726
+ margin-bottom: 8px;
2727
+ font-size: calc(11px * var(--tdt-scale, 1));
2728
+ }
2729
+
2730
+ .test-failures {
2731
+ font-size: calc(10px * var(--tdt-scale, 1));
2732
+ }
2733
+
2734
+ .test-failure-item {
2735
+ padding: 6px 8px;
2736
+ background: rgba(239, 68, 68, 0.05);
2737
+ border-left: 2px solid var(--tdt-danger);
2738
+ margin-bottom: 4px;
2739
+ border-radius: 0 3px 3px 0;
2740
+ }
2741
+
2742
+ .test-failure-item:last-child {
2743
+ margin-bottom: 0;
2744
+ }
2745
+
2746
+ .failure-rule {
2747
+ font-weight: 600;
2748
+ color: var(--tdt-danger);
2749
+ }
2750
+
2751
+ .failure-message {
2752
+ color: var(--tdt-text);
2753
+ margin-top: 2px;
2754
+ }
2755
+
2756
+ .failure-item-ref {
2757
+ color: var(--tdt-text-muted);
2758
+ font-family: var(--tdt-font-mono);
2759
+ font-size: calc(9px * var(--tdt-scale, 1));
2760
+ margin-top: 2px;
2761
+ }
2762
+
2763
+ /* Templates dropdown */
2764
+ .templates-dropdown {
2765
+ position: relative;
2766
+ }
2767
+
2768
+ .templates-menu {
2769
+ position: absolute;
2770
+ top: 100%;
2771
+ right: 0;
2772
+ background: var(--tdt-bg);
2773
+ border: 1px solid var(--tdt-border);
2774
+ border-radius: var(--tdt-radius);
2775
+ box-shadow: 0 4px 12px rgba(0,0,0,0.15);
2776
+ min-width: 220px;
2777
+ max-height: 300px;
2778
+ overflow-y: auto;
2779
+ z-index: 100;
2780
+ margin-top: 4px;
2781
+ }
2782
+
2783
+ .templates-menu-item {
2784
+ padding: 8px 12px;
2785
+ cursor: pointer;
2786
+ border-bottom: 1px solid var(--tdt-border);
2787
+ font-size: calc(10px * var(--tdt-scale, 1));
2788
+ }
2789
+
2790
+ .templates-menu-item:last-child {
2791
+ border-bottom: none;
2792
+ }
2793
+
2794
+ .templates-menu-item:hover {
2795
+ background: var(--tdt-bg-hover);
2796
+ }
2797
+
2798
+ .templates-menu-item-name {
2799
+ font-weight: 600;
2800
+ color: var(--tdt-text);
2801
+ }
2802
+
2803
+ .templates-menu-item-desc {
2804
+ color: var(--tdt-text-muted);
2805
+ margin-top: 2px;
2806
+ }
2807
+
2808
+ /* Auto-run toggle */
2809
+ .autorun-toggle {
2810
+ display: flex;
2811
+ align-items: center;
2812
+ gap: 6px;
2813
+ font-size: calc(10px * var(--tdt-scale, 1));
2814
+ color: var(--tdt-text-muted);
2815
+ cursor: pointer;
2816
+ padding: 4px 8px;
2817
+ border-radius: var(--tdt-radius);
2818
+ }
2819
+
2820
+ .autorun-toggle:hover {
2821
+ background: var(--tdt-bg-hover);
2822
+ }
2823
+
2824
+ .autorun-toggle input {
2825
+ cursor: pointer;
2826
+ }
2827
+
2828
+ /* Failed item indicator in cart table */
2829
+ .item-row.test-failed {
2830
+ background: rgba(239, 68, 68, 0.05);
2831
+ }
2832
+
2833
+ .item-row.test-failed td:first-child {
2834
+ border-left: 3px solid var(--tdt-danger);
2835
+ }
2836
+
2837
+ .test-fail-indicator {
2838
+ display: inline-flex;
2839
+ align-items: center;
2840
+ gap: 3px;
2841
+ padding: 1px 5px;
2842
+ background: rgba(239, 68, 68, 0.15);
2843
+ border-radius: 3px;
2844
+ font-size: calc(9px * var(--tdt-scale, 1));
2845
+ color: var(--tdt-danger);
2846
+ margin-left: 6px;
2847
+ }
2848
+ `]);let Ct=Tt;customElements.define("tdt-cart-panel",Ct);class Et extends ot{constructor(){super(),this.meta={}}_renderSection(t,e){return U`
1957
2849
  <div class="section">
1958
2850
  <h4 class="section__title">${t}</h4>
1959
2851
  <table class="table">
@@ -1965,9 +2857,9 @@ var __defProp=Object.defineProperty,__defNormalProp=(t,e,i)=>e in t?__defProp(t,
1965
2857
  `)}
1966
2858
  </table>
1967
2859
  </div>
1968
- `}render(){var t,e,i,s,a,r,n,o,l,d,c,p,u,h,g,v,m,b,f,y,x,_,w,k,$,S,T;if(!this.meta)return U`<div class="empty-state">No metadata available</div>`;const C=[{title:"Theme",items:[["ID",null==(t=this.meta.theme)?void 0:t.id],["Name",null==(e=this.meta.theme)?void 0:e.name],["Role",null==(i=this.meta.theme)?void 0:i.role]]},{title:"Template",items:[["Name",null==(s=this.meta.template)?void 0:s.name],["Suffix",(null==(a=this.meta.template)?void 0:a.suffix)||"—"],["Directory",(null==(r=this.meta.template)?void 0:r.directory)||"—"]]},{title:"Request",items:[["Page Type",null==(n=this.meta.request)?void 0:n.page_type],["Path",null==(o=this.meta.request)?void 0:o.path],["Host",null==(l=this.meta.request)?void 0:l.host],["Design Mode",(null==(d=this.meta.request)?void 0:d.design_mode)?"Yes":"No"],["Visual Preview",(null==(c=this.meta.request)?void 0:c.visual_preview_mode)?"Yes":"No"]]},{title:"Localization",items:[["Locale",`${(null==(u=null==(p=this.meta.request)?void 0:p.locale)?void 0:u.name)||""} (${(null==(g=null==(h=this.meta.request)?void 0:h.locale)?void 0:g.iso_code)||""})`],["Country",`${(null==(m=null==(v=this.meta.localization)?void 0:v.country)?void 0:m.name)||""} (${(null==(f=null==(b=this.meta.localization)?void 0:b.country)?void 0:f.iso_code)||""})`],["Currency",`${(null==(_=null==(x=null==(y=this.meta.localization)?void 0:y.country)?void 0:x.currency)?void 0:_.symbol)||""} ${(null==($=null==(k=null==(w=this.meta.localization)?void 0:w.country)?void 0:k.currency)?void 0:$.iso_code)||""}`],["Market",(null==(T=null==(S=this.meta.localization)?void 0:S.market)?void 0:T.handle)||"—"]]}];return U`
2860
+ `}render(){var t,e,i,s,a,r,n,o,l,d,c,p,u,h,g,v,m,f,b,y,x,_,w,k,$,S,T;if(!this.meta)return U`<div class="empty-state">No metadata available</div>`;const C=[{title:"Theme",items:[["ID",null==(t=this.meta.theme)?void 0:t.id],["Name",null==(e=this.meta.theme)?void 0:e.name],["Role",null==(i=this.meta.theme)?void 0:i.role]]},{title:"Template",items:[["Name",null==(s=this.meta.template)?void 0:s.name],["Suffix",(null==(a=this.meta.template)?void 0:a.suffix)||"—"],["Directory",(null==(r=this.meta.template)?void 0:r.directory)||"—"]]},{title:"Request",items:[["Page Type",null==(n=this.meta.request)?void 0:n.page_type],["Path",null==(o=this.meta.request)?void 0:o.path],["Host",null==(l=this.meta.request)?void 0:l.host],["Design Mode",(null==(d=this.meta.request)?void 0:d.design_mode)?"Yes":"No"],["Visual Preview",(null==(c=this.meta.request)?void 0:c.visual_preview_mode)?"Yes":"No"]]},{title:"Localization",items:[["Locale",`${(null==(u=null==(p=this.meta.request)?void 0:p.locale)?void 0:u.name)||""} (${(null==(g=null==(h=this.meta.request)?void 0:h.locale)?void 0:g.iso_code)||""})`],["Country",`${(null==(m=null==(v=this.meta.localization)?void 0:v.country)?void 0:m.name)||""} (${(null==(b=null==(f=this.meta.localization)?void 0:f.country)?void 0:b.iso_code)||""})`],["Currency",`${(null==(_=null==(x=null==(y=this.meta.localization)?void 0:y.country)?void 0:x.currency)?void 0:_.symbol)||""} ${(null==($=null==(k=null==(w=this.meta.localization)?void 0:w.country)?void 0:k.currency)?void 0:$.iso_code)||""}`],["Market",(null==(T=null==(S=this.meta.localization)?void 0:S.market)?void 0:T.handle)||"—"]]}];return U`
1969
2861
  ${C.map(t=>this._renderSection(t.title,t.items))}
1970
- `}}__publicField(Ct,"properties",{meta:{type:Object}}),__publicField(Ct,"styles",[pt,n`
2862
+ `}}__publicField(Et,"properties",{meta:{type:Object}}),__publicField(Et,"styles",[pt,n`
1971
2863
  :host {
1972
2864
  display: block;
1973
2865
  padding: 12px;
@@ -2009,7 +2901,7 @@ var __defProp=Object.defineProperty,__defNormalProp=(t,e,i)=>e in t?__defProp(t,
2009
2901
  color: var(--tdt-text);
2010
2902
  word-break: break-all;
2011
2903
  }
2012
- `]),customElements.define("tdt-info-panel",Ct);class Et extends ot{constructor(){super(),this.metafields=null,this.metafieldsSchema=null,this.searchQuery="",this.expandedPaths=new Set,this.copiedPath=null,this.showEmptyFields=!0,this.activeResource=null}_getMergedData(){var t,e,i;const s={},a=this.metafieldsSchema||{},r=this.metafields||{};for(const[n,o]of Object.entries(a))if(Array.isArray(o)&&0!==o.length){s[n]={schema:o,values:r[n]||{},byNamespace:{}};for(const i of o){const a=i.namespace;s[n].byNamespace[a]||(s[n].byNamespace[a]=[]);const o=null==(e=null==(t=r[n])?void 0:t[a])?void 0:e[i.key];s[n].byNamespace[a].push({...i,hasValue:null!=o,actualValue:null==o?void 0:o.value,actualType:null==o?void 0:o.type})}}for(const[n,o]of Object.entries(r))if(o&&"object"==typeof o){s[n]||(s[n]={schema:[],values:o,byNamespace:{}});for(const[t,e]of Object.entries(o))if(e&&"object"==typeof e){s[n].byNamespace[t]||(s[n].byNamespace[t]=[]);for(const[a,r]of Object.entries(e)){(null==(i=s[n].byNamespace[t])?void 0:i.find(t=>t.key===a))||s[n].byNamespace[t].push({key:a,namespace:t,name:a,description:"",type:{name:(null==r?void 0:r.type)||"unknown",category:"UNKNOWN"},hasValue:!0,actualValue:null==r?void 0:r.value,actualType:null==r?void 0:r.type})}}}return s}_getResourceStats(t){let e=0,i=0;for(const s of Object.values(t.byNamespace))e+=s.length,i+=s.filter(t=>t.hasValue).length;return{total:e,filled:i}}_getTypeClass(t){if(!t)return"unknown";const e=t.toLowerCase().replace(/\./g,"_");return e.startsWith("list_")?"list":e.includes("text")?e.includes("multi")||e.includes("rich")?"multi_line_text_field":"single_line_text_field":e.includes("number")||e.includes("integer")||e.includes("decimal")?"number_integer":e.includes("boolean")?"boolean":e.includes("json")?"json":e.includes("date")?"date":e.includes("url")?"url":e.includes("color")?"color":e.includes("file")?"file_reference":e.includes("product")||e.includes("collection")||e.includes("metaobject")?"product_reference":e.includes("rating")?"rating":e.includes("money")?"money":"unknown"}_toggleNamespace(t){const e=new Set(this.expandedPaths);e.has(t)?e.delete(t):e.add(t),this.expandedPaths=e}async _copyLiquidPath(t,e,i,s){null==s||s.stopPropagation();const a=`{{ ${t}.metafields.${e}.${i} }}`;try{await navigator.clipboard.writeText(a),this.copiedPath=`${t}.${e}.${i}`,setTimeout(()=>{this.copiedPath=null},1500)}catch(r){console.error("Failed to copy:",r)}}async _copyValue(t,e){null==e||e.stopPropagation();const i="object"==typeof t?JSON.stringify(t,null,2):String(t);try{await navigator.clipboard.writeText(i)}catch(s){console.error("Failed to copy value:",s)}}_formatValue(t){if(null==t)return U`<span class="value--null">null</span>`;if("object"==typeof t){const e=JSON.stringify(t,null,2);return U`<span class="value--json">${e}</span>`}return"string"==typeof t?U`<span class="value--string">"${t}"</span>`:"number"==typeof t?U`<span class="value--number">${t}</span>`:"boolean"==typeof t?U`<span class="value--boolean">${t}</span>`:U`<span>${String(t)}</span>`}_deepSearchValue(t,e){if(null==t)return!1;if("object"!=typeof t)return String(t).toLowerCase().includes(e);if(Array.isArray(t))return t.some(t=>this._deepSearchValue(t,e));for(const[i,s]of Object.entries(t)){if(i.toLowerCase().includes(e))return!0;if(this._deepSearchValue(s,e))return!0}return!1}_filterData(t){if(!this.searchQuery.trim())return t;const e=this.searchQuery.toLowerCase(),i={};for(const[s,a]of Object.entries(t)){const t={};for(const[i,s]of Object.entries(a.byNamespace)){const a=s.filter(t=>{var s,a;const r=t.key.toLowerCase().includes(e),n=i.toLowerCase().includes(e),o=null==(s=t.name)?void 0:s.toLowerCase().includes(e),l=null==(a=t.description)?void 0:a.toLowerCase().includes(e),d=void 0!==t.actualValue&&null!==t.actualValue&&this._deepSearchValue(t.actualValue,e);return r||n||o||l||d});a.length>0&&(t[i]=a)}Object.keys(t).length>0&&(i[s]={...a,byNamespace:t})}return i}_renderMetafield(t,e){var i,s;const a=`${t}.${e.namespace}.${e.key}`,r=this.copiedPath===a,n=(null==(i=e.type)?void 0:i.name)||e.actualType||"unknown";return this.showEmptyFields||e.hasValue?U`
2904
+ `]),customElements.define("tdt-info-panel",Et);class At extends ot{constructor(){super(),this.metafields=null,this.metafieldsSchema=null,this.searchQuery="",this.expandedPaths=new Set,this.copiedPath=null,this.showEmptyFields=!0,this.activeResource=null}_getMergedData(){var t,e,i;const s={},a=this.metafieldsSchema||{},r=this.metafields||{};for(const[n,o]of Object.entries(a))if(Array.isArray(o)&&0!==o.length){s[n]={schema:o,values:r[n]||{},byNamespace:{}};for(const i of o){const a=i.namespace;s[n].byNamespace[a]||(s[n].byNamespace[a]=[]);const o=null==(e=null==(t=r[n])?void 0:t[a])?void 0:e[i.key];s[n].byNamespace[a].push({...i,hasValue:null!=o,actualValue:null==o?void 0:o.value,actualType:null==o?void 0:o.type})}}for(const[n,o]of Object.entries(r))if(o&&"object"==typeof o){s[n]||(s[n]={schema:[],values:o,byNamespace:{}});for(const[t,e]of Object.entries(o))if(e&&"object"==typeof e){s[n].byNamespace[t]||(s[n].byNamespace[t]=[]);for(const[a,r]of Object.entries(e)){(null==(i=s[n].byNamespace[t])?void 0:i.find(t=>t.key===a))||s[n].byNamespace[t].push({key:a,namespace:t,name:a,description:"",type:{name:(null==r?void 0:r.type)||"unknown",category:"UNKNOWN"},hasValue:!0,actualValue:null==r?void 0:r.value,actualType:null==r?void 0:r.type})}}}return s}_getResourceStats(t){let e=0,i=0;for(const s of Object.values(t.byNamespace))e+=s.length,i+=s.filter(t=>t.hasValue).length;return{total:e,filled:i}}_getTypeClass(t){if(!t)return"unknown";const e=t.toLowerCase().replace(/\./g,"_");return e.startsWith("list_")?"list":e.includes("text")?e.includes("multi")||e.includes("rich")?"multi_line_text_field":"single_line_text_field":e.includes("number")||e.includes("integer")||e.includes("decimal")?"number_integer":e.includes("boolean")?"boolean":e.includes("json")?"json":e.includes("date")?"date":e.includes("url")?"url":e.includes("color")?"color":e.includes("file")?"file_reference":e.includes("product")||e.includes("collection")||e.includes("metaobject")?"product_reference":e.includes("rating")?"rating":e.includes("money")?"money":"unknown"}_toggleNamespace(t){const e=new Set(this.expandedPaths);e.has(t)?e.delete(t):e.add(t),this.expandedPaths=e}async _copyLiquidPath(t,e,i,s){null==s||s.stopPropagation();const a=`{{ ${t}.metafields.${e}.${i} }}`;try{await navigator.clipboard.writeText(a),this.copiedPath=`${t}.${e}.${i}`,setTimeout(()=>{this.copiedPath=null},1500)}catch(r){console.error("Failed to copy:",r)}}async _copyValue(t,e){null==e||e.stopPropagation();const i="object"==typeof t?JSON.stringify(t,null,2):String(t);try{await navigator.clipboard.writeText(i)}catch(s){console.error("Failed to copy value:",s)}}_formatValue(t){if(null==t)return U`<span class="value--null">null</span>`;if("object"==typeof t){const e=JSON.stringify(t,null,2);return U`<span class="value--json">${e}</span>`}return"string"==typeof t?U`<span class="value--string">"${t}"</span>`:"number"==typeof t?U`<span class="value--number">${t}</span>`:"boolean"==typeof t?U`<span class="value--boolean">${t}</span>`:U`<span>${String(t)}</span>`}_deepSearchValue(t,e){if(null==t)return!1;if("object"!=typeof t)return String(t).toLowerCase().includes(e);if(Array.isArray(t))return t.some(t=>this._deepSearchValue(t,e));for(const[i,s]of Object.entries(t)){if(i.toLowerCase().includes(e))return!0;if(this._deepSearchValue(s,e))return!0}return!1}_filterData(t){if(!this.searchQuery.trim())return t;const e=this.searchQuery.toLowerCase(),i={};for(const[s,a]of Object.entries(t)){const t={};for(const[i,s]of Object.entries(a.byNamespace)){const a=s.filter(t=>{var s,a;const r=t.key.toLowerCase().includes(e),n=i.toLowerCase().includes(e),o=null==(s=t.name)?void 0:s.toLowerCase().includes(e),l=null==(a=t.description)?void 0:a.toLowerCase().includes(e),d=void 0!==t.actualValue&&null!==t.actualValue&&this._deepSearchValue(t.actualValue,e);return r||n||o||l||d});a.length>0&&(t[i]=a)}Object.keys(t).length>0&&(i[s]={...a,byNamespace:t})}return i}_renderMetafield(t,e){var i,s;const a=`${t}.${e.namespace}.${e.key}`,r=this.copiedPath===a,n=(null==(i=e.type)?void 0:i.name)||e.actualType||"unknown";return this.showEmptyFields||e.hasValue?U`
2013
2905
  <div class="metafield ${e.hasValue?"":"metafield--empty"}">
2014
2906
  <div class="metafield__header">
2015
2907
  <span
@@ -2108,7 +3000,7 @@ var __defProp=Object.defineProperty,__defNormalProp=(t,e,i)=>e in t?__defProp(t,
2108
3000
  </div>
2109
3001
 
2110
3002
  ${r?Object.entries(a.byNamespace).map(([t,e])=>this._renderNamespace(this.activeResource,t,e)):U`<div class="no-results">No metafields match "${this.searchQuery}"</div>`}
2111
- `}}__publicField(Et,"properties",{metafields:{type:Object},metafieldsSchema:{type:Object},searchQuery:{type:String,state:!0},expandedPaths:{type:Object,state:!0},copiedPath:{type:String,state:!0},showEmptyFields:{type:Boolean,state:!0},activeResource:{type:String,state:!0}}),__publicField(Et,"styles",[pt,n`
3003
+ `}}__publicField(At,"properties",{metafields:{type:Object},metafieldsSchema:{type:Object},searchQuery:{type:String,state:!0},expandedPaths:{type:Object,state:!0},copiedPath:{type:String,state:!0},showEmptyFields:{type:Boolean,state:!0},activeResource:{type:String,state:!0}}),__publicField(At,"styles",[pt,n`
2112
3004
  :host {
2113
3005
  display: block;
2114
3006
  padding: 8px 12px;
@@ -2482,7 +3374,7 @@ var __defProp=Object.defineProperty,__defNormalProp=(t,e,i)=>e in t?__defProp(t,
2482
3374
  margin-bottom: 4px;
2483
3375
  color: var(--tdt-accent);
2484
3376
  }
2485
- `]),customElements.define("tdt-metafields-panel",Et);class At extends ot{constructor(){super(),this.cookies=[],this.filter="",this.editingCookie=null,this.newCookie=null}connectedCallback(){super.connectedCallback(),this._loadCookies()}_loadCookies(){const t=document.cookie;this.cookies=t?t.split(";").map(t=>{const[e,...i]=t.trim().split("="),s=i.join("=");return{name:e.trim(),value:decodeURIComponent(s||""),rawValue:s}}).filter(t=>t.name):[]}_filterCookies(t){this.filter=t.target.value}_getFilteredCookies(){if(!this.filter)return this.cookies;const t=this.filter.toLowerCase();return this.cookies.filter(e=>e.name.toLowerCase().includes(t)||e.value.toLowerCase().includes(t))}_copyValue(t){navigator.clipboard.writeText(t.value)}_copyName(t){navigator.clipboard.writeText(t.name)}_deleteCookie(t){document.cookie=`${t.name}=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/`,document.cookie=`${t.name}=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/; domain=${window.location.hostname}`,document.cookie=`${t.name}=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/; domain=.${window.location.hostname}`,this._loadCookies()}_openAddModal(){this.newCookie={name:"",value:"",path:"/",days:7,secure:"https:"===window.location.protocol,sameSite:"Lax"}}_openEditModal(t){this.editingCookie={originalName:t.name,name:t.name,value:t.value,path:"/",days:7,secure:"https:"===window.location.protocol,sameSite:"Lax"}}_closeModal(){this.newCookie=null,this.editingCookie=null}_saveCookie(){const t=this.newCookie||this.editingCookie;if(!t||!t.name)return;this.editingCookie&&this.editingCookie.originalName!==t.name&&this._deleteCookie({name:this.editingCookie.originalName});const e=new Date;e.setTime(e.getTime()+24*t.days*60*60*1e3);let i=`${encodeURIComponent(t.name)}=${encodeURIComponent(t.value)}`;i+=`; expires=${e.toUTCString()}`,i+=`; path=${t.path}`,t.secure&&(i+="; secure"),i+=`; samesite=${t.sameSite}`,document.cookie=i,this._loadCookies(),this._closeModal()}_updateCookieField(t,e){this.newCookie?this.newCookie={...this.newCookie,[t]:e}:this.editingCookie&&(this.editingCookie={...this.editingCookie,[t]:e})}_formatSize(t){const e=new Blob([t]).size;return e<1024?`${e} B`:`${(e/1024).toFixed(1)} KB`}_clearAllCookies(){0!==this.cookies.length&&confirm(`Clear all ${this.cookies.length} cookies? This may log you out.`)&&(this.cookies.forEach(t=>{document.cookie=`${t.name}=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/`,document.cookie=`${t.name}=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/; domain=${window.location.hostname}`,document.cookie=`${t.name}=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/; domain=.${window.location.hostname}`}),this._loadCookies())}_renderModal(){const t=this.newCookie||this.editingCookie;if(!t)return null;const e=!!this.editingCookie;return U`
3377
+ `]),customElements.define("tdt-metafields-panel",At);class qt extends ot{constructor(){super(),this.cookies=[],this.filter="",this.editingCookie=null,this.newCookie=null}connectedCallback(){super.connectedCallback(),this._loadCookies()}_loadCookies(){const t=document.cookie;this.cookies=t?t.split(";").map(t=>{const[e,...i]=t.trim().split("="),s=i.join("=");return{name:e.trim(),value:decodeURIComponent(s||""),rawValue:s}}).filter(t=>t.name):[]}_filterCookies(t){this.filter=t.target.value}_getFilteredCookies(){if(!this.filter)return this.cookies;const t=this.filter.toLowerCase();return this.cookies.filter(e=>e.name.toLowerCase().includes(t)||e.value.toLowerCase().includes(t))}_copyValue(t){navigator.clipboard.writeText(t.value)}_copyName(t){navigator.clipboard.writeText(t.name)}_deleteCookie(t){document.cookie=`${t.name}=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/`,document.cookie=`${t.name}=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/; domain=${window.location.hostname}`,document.cookie=`${t.name}=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/; domain=.${window.location.hostname}`,this._loadCookies()}_openAddModal(){this.newCookie={name:"",value:"",path:"/",days:7,secure:"https:"===window.location.protocol,sameSite:"Lax"}}_openEditModal(t){this.editingCookie={originalName:t.name,name:t.name,value:t.value,path:"/",days:7,secure:"https:"===window.location.protocol,sameSite:"Lax"}}_closeModal(){this.newCookie=null,this.editingCookie=null}_saveCookie(){const t=this.newCookie||this.editingCookie;if(!t||!t.name)return;this.editingCookie&&this.editingCookie.originalName!==t.name&&this._deleteCookie({name:this.editingCookie.originalName});const e=new Date;e.setTime(e.getTime()+24*t.days*60*60*1e3);let i=`${encodeURIComponent(t.name)}=${encodeURIComponent(t.value)}`;i+=`; expires=${e.toUTCString()}`,i+=`; path=${t.path}`,t.secure&&(i+="; secure"),i+=`; samesite=${t.sameSite}`,document.cookie=i,this._loadCookies(),this._closeModal()}_updateCookieField(t,e){this.newCookie?this.newCookie={...this.newCookie,[t]:e}:this.editingCookie&&(this.editingCookie={...this.editingCookie,[t]:e})}_formatSize(t){const e=new Blob([t]).size;return e<1024?`${e} B`:`${(e/1024).toFixed(1)} KB`}_clearAllCookies(){0!==this.cookies.length&&confirm(`Clear all ${this.cookies.length} cookies? This may log you out.`)&&(this.cookies.forEach(t=>{document.cookie=`${t.name}=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/`,document.cookie=`${t.name}=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/; domain=${window.location.hostname}`,document.cookie=`${t.name}=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/; domain=.${window.location.hostname}`}),this._loadCookies())}_renderModal(){const t=this.newCookie||this.editingCookie;if(!t)return null;const e=!!this.editingCookie;return U`
2486
3378
  <div class="modal-overlay" @click=${this._closeModal}>
2487
3379
  <div class="modal" @click=${t=>t.stopPropagation()}>
2488
3380
  <div class="modal-title">${e?"Edit Cookie":"Add Cookie"}</div>
@@ -2612,7 +3504,7 @@ var __defProp=Object.defineProperty,__defNormalProp=(t,e,i)=>e in t?__defProp(t,
2612
3504
  `}
2613
3505
 
2614
3506
  ${this._renderModal()}
2615
- `}}__publicField(At,"properties",{cookies:{type:Array,state:!0},filter:{type:String,state:!0},editingCookie:{type:Object,state:!0},newCookie:{type:Object,state:!0}}),__publicField(At,"styles",[pt,n`
3507
+ `}}__publicField(qt,"properties",{cookies:{type:Array,state:!0},filter:{type:String,state:!0},editingCookie:{type:Object,state:!0},newCookie:{type:Object,state:!0}}),__publicField(qt,"styles",[pt,n`
2616
3508
  :host {
2617
3509
  display: block;
2618
3510
  padding: 12px;
@@ -2887,7 +3779,7 @@ var __defProp=Object.defineProperty,__defNormalProp=(t,e,i)=>e in t?__defProp(t,
2887
3779
  font-weight: 600;
2888
3780
  color: var(--tdt-text);
2889
3781
  }
2890
- `]),customElements.define("tdt-cookies-panel",At);class Ot extends ot{constructor(){super(),__publicField(this,"_handleStorageChange",()=>{this._loadItems()}),this.activeStorage="local",this.items=[],this.filter="",this.editingItem=null,this.newItem=null,this.expandedItems=new Set}connectedCallback(){super.connectedCallback(),this._loadItems(),window.addEventListener("storage",this._handleStorageChange)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("storage",this._handleStorageChange)}_getStorage(){return"local"===this.activeStorage?localStorage:sessionStorage}_loadItems(){const t=this._getStorage(),e=[];for(let i=0;i<t.length;i++){const s=t.key(i),a=t.getItem(s);let r=a,n=!1;try{r=JSON.parse(a),n="object"==typeof r&&null!==r}catch{n=!1}e.push({key:s,value:a,parsedValue:n?r:a,isJson:n,size:new Blob([a]).size})}e.sort((t,e)=>t.key.localeCompare(e.key)),this.items=e}_switchStorage(t){this.activeStorage=t,this.expandedItems=new Set,this._loadItems()}_filterItems(t){this.filter=t.target.value}_getFilteredItems(){if(!this.filter)return this.items;const t=this.filter.toLowerCase();return this.items.filter(e=>e.key.toLowerCase().includes(t)||e.value.toLowerCase().includes(t))}_toggleExpand(t,e){e.stopPropagation();const i=new Set(this.expandedItems);i.has(t)?i.delete(t):i.add(t),this.expandedItems=i}_copyKey(t,e){e.stopPropagation(),navigator.clipboard.writeText(t.key)}_copyValue(t,e){e.stopPropagation(),navigator.clipboard.writeText(t.value)}_deleteItem(t,e){e.stopPropagation(),this._getStorage().removeItem(t.key),this._loadItems()}_clearAll(){confirm(`Clear all ${"local"===this.activeStorage?"localStorage":"sessionStorage"} items?`)&&(this._getStorage().clear(),this._loadItems())}_openAddModal(){this.newItem={key:"",value:""}}_openEditModal(t,e){e.stopPropagation(),this.editingItem={originalKey:t.key,key:t.key,value:t.value}}_closeModal(){this.newItem=null,this.editingItem=null}_saveItem(){const t=this.newItem||this.editingItem;if(!t||!t.key)return;const e=this._getStorage();this.editingItem&&this.editingItem.originalKey!==t.key&&e.removeItem(this.editingItem.originalKey),e.setItem(t.key,t.value),this._loadItems(),this._closeModal()}_updateItemField(t,e){this.newItem?this.newItem={...this.newItem,[t]:e}:this.editingItem&&(this.editingItem={...this.editingItem,[t]:e})}_formatSize(t){return t<1024?`${t} B`:`${(t/1024).toFixed(1)} KB`}_getTotalSize(){return this.items.reduce((t,e)=>t+e.size+e.key.length,0)}_renderModal(){const t=this.newItem||this.editingItem;if(!t)return null;const e=!!this.editingItem;return U`
3782
+ `]),customElements.define("tdt-cookies-panel",qt);class Ot extends ot{constructor(){super(),__publicField(this,"_handleStorageChange",()=>{this._loadItems()}),this.activeStorage="local",this.items=[],this.filter="",this.editingItem=null,this.newItem=null,this.expandedItems=new Set}connectedCallback(){super.connectedCallback(),this._loadItems(),window.addEventListener("storage",this._handleStorageChange)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("storage",this._handleStorageChange)}_getStorage(){return"local"===this.activeStorage?localStorage:sessionStorage}_loadItems(){const t=this._getStorage(),e=[];for(let i=0;i<t.length;i++){const s=t.key(i),a=t.getItem(s);let r=a,n=!1;try{r=JSON.parse(a),n="object"==typeof r&&null!==r}catch{n=!1}e.push({key:s,value:a,parsedValue:n?r:a,isJson:n,size:new Blob([a]).size})}e.sort((t,e)=>t.key.localeCompare(e.key)),this.items=e}_switchStorage(t){this.activeStorage=t,this.expandedItems=new Set,this._loadItems()}_filterItems(t){this.filter=t.target.value}_getFilteredItems(){if(!this.filter)return this.items;const t=this.filter.toLowerCase();return this.items.filter(e=>e.key.toLowerCase().includes(t)||e.value.toLowerCase().includes(t))}_toggleExpand(t,e){e.stopPropagation();const i=new Set(this.expandedItems);i.has(t)?i.delete(t):i.add(t),this.expandedItems=i}_copyKey(t,e){e.stopPropagation(),navigator.clipboard.writeText(t.key)}_copyValue(t,e){e.stopPropagation(),navigator.clipboard.writeText(t.value)}_deleteItem(t,e){e.stopPropagation(),this._getStorage().removeItem(t.key),this._loadItems()}_clearAll(){confirm(`Clear all ${"local"===this.activeStorage?"localStorage":"sessionStorage"} items?`)&&(this._getStorage().clear(),this._loadItems())}_openAddModal(){this.newItem={key:"",value:""}}_openEditModal(t,e){e.stopPropagation(),this.editingItem={originalKey:t.key,key:t.key,value:t.value}}_closeModal(){this.newItem=null,this.editingItem=null}_saveItem(){const t=this.newItem||this.editingItem;if(!t||!t.key)return;const e=this._getStorage();this.editingItem&&this.editingItem.originalKey!==t.key&&e.removeItem(this.editingItem.originalKey),e.setItem(t.key,t.value),this._loadItems(),this._closeModal()}_updateItemField(t,e){this.newItem?this.newItem={...this.newItem,[t]:e}:this.editingItem&&(this.editingItem={...this.editingItem,[t]:e})}_formatSize(t){return t<1024?`${t} B`:`${(t/1024).toFixed(1)} KB`}_getTotalSize(){return this.items.reduce((t,e)=>t+e.size+e.key.length,0)}_renderModal(){const t=this.newItem||this.editingItem;if(!t)return null;const e=!!this.editingItem;return U`
2891
3783
  <div class="modal-overlay" @click=${this._closeModal}>
2892
3784
  <div class="modal" @click=${t=>t.stopPropagation()}>
2893
3785
  <div class="modal-title">${e?"Edit Item":"Add Item"}</div>
@@ -3332,7 +4224,7 @@ var __defProp=Object.defineProperty,__defNormalProp=(t,e,i)=>e in t?__defProp(t,
3332
4224
  font-weight: 600;
3333
4225
  color: var(--tdt-text);
3334
4226
  }
3335
- `]),customElements.define("tdt-storage-panel",Ot);class Lt{constructor(t,e,i,s,a){this.kind=t,this.input=e,this.begin=i,this.end=s,this.file=a}getText(){return this.input.slice(this.begin,this.end)}getPosition(){let[t,e]=[1,1];for(let i=0;i<this.begin;i++)"\n"===this.input[i]?(t++,e=1):e++;return[t,e]}size(){return this.end-this.begin}}class jt{liquidMethodMissing(t,e){}}const zt=Object.prototype.toString,qt=String.prototype.toLowerCase,Pt=Object.hasOwnProperty;function It(t){return"string"==typeof t}function Rt(t){return"function"==typeof t}function Nt(t){return t&&Rt(t.then)}function Dt(t){return t&&Rt(t.next)&&Rt(t.throw)&&Rt(t.return)}function Ft(t){return It(t=Ut(t))?t:Gt(t)?"":Qt(t)?t.map(t=>Ft(t)).join(""):String(t)}function Mt(t){return Qt(t=Ut(t))?t:It(t)&&t.length>0?[t]:Zt(e=t)&&Symbol.iterator in e?Array.from(t):Zt(t)?Object.keys(t).map(e=>[e,t[e]]):[];var e}function Ht(t){return Gt(t=Ut(t))?[]:Qt(t)?t:[t]}function Ut(t){return t instanceof jt&&Rt(t.valueOf)?t.valueOf():t}function Bt(t){return+Ut(t)||0}function Vt(t){return"number"==typeof t}function Jt(t){return t&&Rt(t.toLiquid)?Jt(t.toLiquid()):t}function Gt(t){return null==t}function Kt(t){return void 0===t}function Qt(t){return"[object Array]"===zt.call(t)}function Wt(t){return t&&Vt(t.length)}function Yt(t,e){t=t||{};for(const i in t)if(Pt.call(t,i)&&!1===e(t[i],i,t))break;return t}function Xt(t){return t[t.length-1]}function Zt(t){const e=typeof t;return null!==t&&("object"===e||"function"===e)}function te(t,e,i=1){const s=[];for(let a=t;a<e;a+=i)s.push(a);return s}function ee(t,e,i=" "){return ie(t,e,i,(t,e)=>e+t)}function ie(t,e,i,s){let a=e-(t=String(t)).length;for(;a-- >0;)t=s(t,i);return t}function se(t){return t}function ae(t,e){return null==t&&null==e?0:null==t?1:null==e||(t=qt.call(t))<(e=qt.call(e))?-1:t>e?1:0}function re(t){return function(...e){return t.call(this,...e.map(Ut))}}function ne(t){return function(...e){return t.call(this,...e.map(Bt))}}function oe(t){return t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")}function*le(t){const e=new Set;for(const i of t){const t=JSON.stringify(i);e.has(t)||(e.add(t),yield i)}}const de="__liquidClass__";class ce extends Error{constructor(t,e){super("string"==typeof t?t:t.message),this.context="","string"!=typeof t&&Object.defineProperty(this,"originalError",{value:t,enumerable:!1}),Object.defineProperty(this,"token",{value:e,enumerable:!1}),Object.defineProperty(this,de,{value:"LiquidError",enumerable:!1})}update(){Object.defineProperty(this,"context",{value:fe(this.token),enumerable:!1}),this.message=function(t,e){e.file&&(t+=`, file:${e.file}`);const[i,s]=e.getPosition();return t+=`, line:${i}, col:${s}`}(this.message,this.token),this.stack=this.message+"\n"+this.context+"\n"+this.stack,this.originalError&&(this.stack+="\nFrom "+this.originalError.stack)}static is(t){return"LiquidError"===(null==t?void 0:t[de])}}class pe extends ce{constructor(t,e){super(t,e),this.name="TokenizationError",super.update()}}class ue extends ce{constructor(t,e){super(t,e),this.name="ParseError",this.message=t.message,super.update()}}class he extends ce{constructor(t,e){super(t,e.token),this.name="RenderError",this.message=t.message,super.update()}static is(t){return"RenderError"===t.name}}class ge extends ce{constructor(t){super(t[0],t[0].token),this.errors=t,this.name="LiquidErrors";const e=t.length>1?"s":"";this.message=`${t.length} error${e} found`,super.update()}static is(t){return"LiquidErrors"===t.name}}class ve extends ce{constructor(t,e){super(t,e),this.name="UndefinedVariableError",this.message=t.message,super.update()}}class me extends Error{constructor(t){super(`undefined variable: ${t}`),this.name="InternalUndefinedVariableError",this.variableName=t}}class be extends Error{constructor(t){super(t),this.name="AssertionError",this.message=t+""}}function fe(t){const[e,i]=t.getPosition(),s=t.input.split("\n"),a=Math.max(e-2,1),r=Math.min(e+3,s.length);return te(a,r+1).map(t=>{let a=`${t===e?">> ":" "}${ee(String(t),String(r).length)}| `;const n=t===e?"\n"+ee("^",i+a.length):"";return a+=s[t-1],a+=n,a}).join("\n")}const ye=[0,0,0,0,0,0,0,0,0,20,4,4,4,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,20,2,8,0,0,0,0,8,0,0,0,64,0,65,0,0,33,33,33,33,33,33,33,33,33,33,0,0,2,2,2,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0];function xe(t){const e=t.charCodeAt(0);return e>=128?!ye[e]:!!(1&ye[e])}function _e(t,e){if(!t){const i="function"==typeof e?e():e||`expect ${t} to be true`;throw new be(i)}}function we(t,e=`unexpected ${JSON.stringify(t)}`){_e(!t,e)}ye[160]=ye[5760]=ye[6158]=ye[8192]=ye[8193]=ye[8194]=ye[8195]=ye[8196]=ye[8197]=ye[8198]=ye[8199]=ye[8200]=ye[8201]=ye[8202]=ye[8232]=ye[8233]=ye[8239]=ye[8287]=ye[12288]=4,ye[8220]=ye[8221]=128;class ke extends jt{equals(t){return!(t instanceof ke)&&(It(t=Ut(t))||Qt(t)?0===t.length:!!Zt(t)&&0===Object.keys(t).length)}gt(){return!1}geq(){return!1}lt(){return!1}leq(){return!1}valueOf(){return""}static is(t){return t instanceof ke}}class $e extends ke{equals(t){return!1===t||(!!Gt(Ut(t))||(It(t)?/^\s*$/.test(t):super.equals(t)))}static is(t){return t instanceof $e}}class Se extends jt{constructor(t,e,i){super(),this.i=0,this.length=t,this.name=`${i}-${e}`}next(){this.i++}index0(){return this.i}index(){return this.i+1}first(){return 0===this.i}last(){return this.i===this.length-1}rindex(){return this.length-this.i}rindex0(){return this.length-this.i-1}valueOf(){return JSON.stringify(this)}}class Te{constructor(){this.buffer=""}write(t){this.buffer+=Ft(t)}}class Ce{constructor(){throw this.buffer="",this.stream=null,new Error("streaming not supported in browser")}}class Ee{constructor(){this.buffer=""}write(t){"string"!=typeof(t=Ut(t))&&""===this.buffer?this.buffer=t:this.buffer=Ft(this.buffer)+Ft(t)}}class Ae extends jt{constructor(t=()=>""){super(),this.superBlockRender=t}*super(){const t=new Te;return yield this.superBlockRender(t),t.buffer}}function Oe(t){return t&&Rt(t.equals)&&Rt(t.gt)&&Rt(t.geq)&&Rt(t.lt)&&Rt(t.leq)}const Le=new class extends jt{equals(t){return Gt(Ut(t))}gt(){return!1}geq(){return!1}lt(){return!1}leq(){return!1}valueOf(){return null}},je={true:!0,false:!1,nil:Le,null:Le,empty:new ke,blank:new $e};function ze(t){const e={};for(const[i,s]of Object.entries(t)){let t=e;for(let e=0;e<i.length;e++){const s=i[e];t[s]=t[s]||{},e===i.length-1&&xe(i[e])&&(t[s].needBoundary=!0),t=t[s]}t.data=s,t.end=!0}return e}var qe=function(){return qe=Object.assign||function(t){for(var e,i=1,s=arguments.length;i<s;i++)for(var a in e=arguments[i])Object.prototype.hasOwnProperty.call(e,a)&&(t[a]=e[a]);return t},qe.apply(this,arguments)};function Pe(t,e,i,s){return new(i||(i=Promise))(function(e,a){function r(t){try{o(s.next(t))}catch(e){a(e)}}function n(t){try{o(s.throw(t))}catch(e){a(e)}}function o(t){var s;t.done?e(t.value):(s=t.value,s instanceof i?s:new i(function(t){t(s)})).then(r,n)}o((s=s.apply(t,[])).next())})}function Ie(t){return Pe(this,0,void 0,function*(){if(!Dt(t))return t;let e,i=!1,s="next";do{const r=t[s](e);i=r.done,e=r.value,s="next";try{Dt(e)&&(e=Ie(e)),Nt(e)&&(e=yield e)}catch(a){s="throw",e=a}}while(!i);return e})}function Re(t){if(!Dt(t))return t;let e,i=!1,s="next";do{const r=t[s](e);if(i=r.done,e=r.value,s="next",Dt(e))try{e=Re(e)}catch(a){s="throw",e=a}}while(!i);return e}const Ne=/%([-_0^#:]+)?(\d+)?([EO])?(.)/;function De(t){const e=function(t){const e=t.getFullYear();return!(3&e||!(e%100||e%400==0&&e))}(t)?29:28;return[31,e,31,30,31,30,31,31,30,31,30,31]}function Fe(t){let e=0;for(let i=0;i<t.getMonth();++i)e+=De(t)[i];return e+t.getDate()}function Me(t,e){const i=Fe(t)+(e-t.getDay()),s=7-new Date(t.getFullYear(),0,1).getDay()+e;return String(Math.floor((i-s)/7)+1)}const He={d:2,e:2,H:2,I:2,j:3,k:2,l:2,L:3,m:2,M:2,S:2,U:2,W:2},Ue=new Set("aAbBceklpP");function Be(t,e){const i=Math.abs(t.getTimezoneOffset()),s=Math.floor(i/60),a=i%60;return(t.getTimezoneOffset()>0?"-":"+")+ee(s,2,"0")+(e.flags[":"]?":":"")+ee(a,2,"0")}const Ve={a:t=>t.getShortWeekdayName(),A:t=>t.getLongWeekdayName(),b:t=>t.getShortMonthName(),B:t=>t.getLongMonthName(),c:t=>t.toLocaleString(),C:t=>function(t){return parseInt(t.getFullYear().toString().substring(0,2),10)}(t),d:t=>t.getDate(),e:t=>t.getDate(),H:t=>t.getHours(),I:t=>String(t.getHours()%12||12),j:t=>Fe(t),k:t=>t.getHours(),l:t=>String(t.getHours()%12||12),L:t=>t.getMilliseconds(),m:t=>t.getMonth()+1,M:t=>t.getMinutes(),N:(t,e)=>{const i=Number(e.width)||9;return function(t,e,i=" "){return ie(t,e,i,(t,e)=>t+e)}(String(t.getMilliseconds()).slice(0,i),i,"0")},p:t=>t.getHours()<12?"AM":"PM",P:t=>t.getHours()<12?"am":"pm",q:t=>function(t){const e=t.getDate();if([11,12,13].includes(e))return"th";switch(e%10){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}}(t),s:t=>Math.round(t.getTime()/1e3),S:t=>t.getSeconds(),u:t=>t.getDay()||7,U:t=>Me(t,0),w:t=>t.getDay(),W:t=>Me(t,1),x:t=>t.toLocaleDateString(),X:t=>t.toLocaleTimeString(),y:t=>t.getFullYear().toString().slice(2,4),Y:t=>t.getFullYear(),z:Be,Z:(t,e)=>t.getTimeZoneName()||Be(t,e),t:()=>"\t",n:()=>"\n","%":()=>"%"};function Je(t,e){let i,s="",a=e;for(;i=Ne.exec(a);)s+=a.slice(0,i.index),a=a.slice(i.index+i[0].length),s+=Ge(t,i);return s+a}function Ge(t,e){const[i,s="",a,r,n]=e,o=Ve[n];if(!o)return i;const l={};for(const h of s)l[h]=!0;let d=String(o(t,{flags:l,width:a,modifier:r})),c=Ue.has(n)?" ":"0",p=a||He[n]||0;var u;return l["^"]?d=d.toUpperCase():l["#"]&&(u=d,d=[...u].some(t=>t>="a"&&t<="z")?u.toUpperCase():u.toLowerCase()),l._?c=" ":l[0]&&(c="0"),l["-"]&&(p=0),ee(d,p,c)}function Ke(){return"undefined"!=typeof Intl?Intl.DateTimeFormat:void 0}Ve.h=Ve.b;const Qe=/([zZ]|([+-])(\d{2}):?(\d{2}))$/,We=["January","February","March","April","May","June","July","August","September","October","November","December"],Ye=We.map(t=>t.slice(0,3)),Xe=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],Ze=Xe.map(t=>t.slice(0,3));class ti{constructor(t,e,i){this.locale=e,this.DateTimeFormat=Ke(),this.date=new Date(t),this.timezoneFixed=void 0!==i,void 0===i&&(i=this.date.getTimezoneOffset()),this.timezoneOffset=It(i)?ti.getTimezoneOffset(i,this.date):i,this.timezoneName=It(i)?i:"";const s=6e4*(this.date.getTimezoneOffset()-this.timezoneOffset),a=this.date.getTime()+s;this.displayDate=new Date(a)}getTime(){return this.displayDate.getTime()}getMilliseconds(){return this.displayDate.getMilliseconds()}getSeconds(){return this.displayDate.getSeconds()}getMinutes(){return this.displayDate.getMinutes()}getHours(){return this.displayDate.getHours()}getDay(){return this.displayDate.getDay()}getDate(){return this.displayDate.getDate()}getMonth(){return this.displayDate.getMonth()}getFullYear(){return this.displayDate.getFullYear()}toLocaleString(t,e){return(null==e?void 0:e.timeZone)?this.date.toLocaleString(t,e):this.displayDate.toLocaleString(t,e)}toLocaleTimeString(t){return this.displayDate.toLocaleTimeString(t)}toLocaleDateString(t){return this.displayDate.toLocaleDateString(t)}getTimezoneOffset(){return this.timezoneOffset}getTimeZoneName(){return this.timezoneFixed?this.timezoneName:this.DateTimeFormat?this.DateTimeFormat().resolvedOptions().timeZone:void 0}getLongMonthName(){var t;return null!==(t=this.format({month:"long"}))&&void 0!==t?t:We[this.getMonth()]}getShortMonthName(){var t;return null!==(t=this.format({month:"short"}))&&void 0!==t?t:Ye[this.getMonth()]}getLongWeekdayName(){var t;return null!==(t=this.format({weekday:"long"}))&&void 0!==t?t:Xe[this.displayDate.getDay()]}getShortWeekdayName(){var t;return null!==(t=this.format({weekday:"short"}))&&void 0!==t?t:Ze[this.displayDate.getDay()]}valid(){return!isNaN(this.getTime())}format(t){return this.DateTimeFormat&&this.DateTimeFormat(this.locale,t).format(this.displayDate)}static createDateFixedToTimezone(t,e){const i=t.match(Qe);if(i&&"Z"===i[1])return new ti(+new Date(t),e,0);if(i&&i[2]&&i[3]&&i[4]){const[,,s,a,r]=i,n=("+"===s?-1:1)*(60*parseInt(a,10)+parseInt(r,10));return new ti(+new Date(t),e,n)}return new ti(t,e)}static getTimezoneOffset(t,e){const i=e.toLocaleString("en-US",{timeZone:t}),s=e.toLocaleString("en-US",{timeZone:"UTC"}),a=new Date(i);return(+new Date(s)-+a)/6e4}}class ei{constructor(t,e){this.base=0,this.message=`${t} limit exceeded`,this.limit=e}use(t){t=+t||0,_e(this.base+t<=this.limit,this.message),this.base+=t}check(t){_e((t=+t||0)<=this.limit,this.message)}}class ii extends Lt{constructor(t,[e,i],s,a,r,n,o,l){super(t,s,a,r,l),this.trimLeft=!1,this.trimRight=!1;const d="-"===s[e],c="-"===s[i-1];let p=d?e+1:e,u=c?i-1:i;for(;p<u&&4&ye[s.charCodeAt(p)];)p++;for(;u>p&&4&ye[s.charCodeAt(u-1)];)u--;this.contentRange=[p,u],this.trimLeft=d||n,this.trimRight=c||o}get content(){return this.input.slice(this.contentRange[0],this.contentRange[1])}}class si extends ii{constructor(t,e,i,s,a){const{trimTagLeft:r,trimTagRight:n,tagDelimiterLeft:o,tagDelimiterRight:l}=s,[d,c]=[e+o.length,i-l.length];super(xs.Tag,[d,c],t,e,i,r,n,a),this.tokenizer=new Wi(t,s.operators,a,this.contentRange),this.name=this.tokenizer.readTagName(),this.tokenizer.assert(this.name,"illegal tag syntax, tag name expected"),this.tokenizer.skipBlank(),this.args=this.tokenizer.input.slice(this.tokenizer.p,this.contentRange[1])}}class ai extends ii{constructor(t,e,i,s,a){const{trimOutputLeft:r,trimOutputRight:n,outputDelimiterLeft:o,outputDelimiterRight:l}=s,d=[e+o.length,i-l.length];super(xs.Output,d,t,e,i,r,n,a)}}class ri extends Lt{constructor(t,e,i,s){super(xs.HTML,t,e,i,s),this.input=t,this.begin=e,this.end=i,this.file=s,this.trimLeft=0,this.trimRight=0}getContent(){return this.input.slice(this.begin+this.trimLeft,this.end-this.trimRight)}}class ni extends Lt{constructor(t,e,i,s){super(xs.Number,t,e,i,s),this.input=t,this.begin=e,this.end=i,this.file=s,this.content=Number(this.getText())}}class oi extends Lt{constructor(t,e,i,s){super(xs.Word,t,e,i,s),this.input=t,this.begin=e,this.end=i,this.file=s,this.content=this.getText()}}class li extends Lt{constructor(t,e,i,s){super(xs.Literal,t,e,i,s),this.input=t,this.begin=e,this.end=i,this.file=s,this.literal=this.getText(),this.content=je[this.literal]}}const di={"==":2,"!=":2,">":2,"<":2,">=":2,"<=":2,contains:2,not:1,and:0,or:0},ci={"==":0,"!=":0,">":0,"<":0,">=":0,"<=":0,contains:0,not:1,and:0,or:0};class pi extends Lt{constructor(t,e,i,s){super(xs.Operator,t,e,i,s),this.input=t,this.begin=e,this.end=i,this.file=s,this.operator=this.getText()}getPrecedence(){const t=this.getText();return t in di?di[t]:1}}class ui extends Lt{constructor(t,e,i,s,a,r){super(xs.PropertyAccess,i,s,a,r),this.variable=t,this.props=e}}class hi extends Lt{constructor(t,e,i,s,a,r){super(xs.Filter,i,s,a,r),this.name=t,this.args=e}}class gi extends Lt{constructor(t,e,i,s,a,r){super(xs.Hash,t,e,i,r),this.input=t,this.begin=e,this.end=i,this.name=s,this.value=a,this.file=r}}const vi=/[\da-fA-F]/,mi=/[0-7]/,bi={b:"\b",f:"\f",n:"\n",r:"\r",t:"\t",v:"\v"};function fi(t){const e=t.charCodeAt(0);return e>=97?e-87:e>=65?e-55:e-48}class yi extends Lt{constructor(t,e,i,s){super(xs.Quoted,t,e,i,s),this.input=t,this.begin=e,this.end=i,this.file=s,this.content=function(t){let e="";for(let i=1;i<t.length-1;i++)if("\\"===t[i])if(void 0!==bi[t[i+1]])e+=bi[t[++i]];else if("u"===t[i+1]){let s=0,a=i+2;for(;a<=i+5&&vi.test(t[a]);)s=16*s+fi(t[a++]);i=a-1,e+=String.fromCharCode(s)}else if(mi.test(t[i+1])){let s=i+1,a=0;for(;s<=i+3&&mi.test(t[s]);)a=8*a+fi(t[s++]);i=s-1,e+=String.fromCharCode(a)}else e+=t[++i];else e+=t[i];return e}(this.getText())}}class xi extends Lt{constructor(t,e,i,s,a,r){super(xs.Range,t,e,i,r),this.input=t,this.begin=e,this.end=i,this.lhs=s,this.rhs=a,this.file=r}}class _i extends ii{constructor(t,e,i,s,a){super(xs.Tag,[e,i],t,e,i,!1,!1,a),this.tokenizer=new Wi(t,s.operators,a,this.contentRange),this.name=this.tokenizer.readTagName(),this.tokenizer.assert(this.name,"illegal liquid tag syntax"),this.tokenizer.skipBlank()}get args(){return this.tokenizer.input.slice(this.tokenizer.p,this.contentRange[1])}}class wi extends Lt{constructor(t,e,i,s,a,r){super(xs.FilteredValue,i,s,a,r),this.initial=t,this.filters=e,this.input=i,this.begin=s,this.end=a,this.file=r}}const ki={now:()=>Date.now()};function $i(){return"object"==typeof global&&global.performance||"object"==typeof window&&window.performance||ki}class Si{renderTemplatesToNodeStream(t,e){const i=new Ce;return Promise.resolve().then(()=>Ie(this.renderTemplates(t,e,i))).then(()=>i.end(),t=>i.error(t)),i.stream}*renderTemplates(t,e,i){i||(i=e.opts.keepOutputType?new Ee:new Te);const s=[];for(const r of t){e.renderLimit.check($i().now());try{const t=yield r.render(e,i);if(t&&i.write(t),e.breakCalled||e.continueCalled)break}catch(a){const t=ce.is(a)?a:new he(a,r);if(!e.opts.catchAllErrors)throw t;s.push(t)}}if(s.length)throw new ge(s);return i.buffer}}class Ti{constructor(t){this.postfix=[...Ei(t)]}*evaluate(t,e){_e(t,"unable to evaluate: context not defined");const i=[];for(const s of this.postfix)if(Cs(s)){const e=i.pop();let a;if(1===ci[s.operator])a=yield t.opts.operators[s.operator](e,t);else{const r=i.pop();a=yield t.opts.operators[s.operator](r,e,t)}i.push(a)}else i.push(yield Ci(s,t,e));return i[0]}valid(){return!!this.postfix.length}}function*Ci(t,e,i=!1){if(t)return"content"in t?t.content:js(t)?yield function*(t,e,i){const s=[];for(const r of t.props)s.push(yield Ci(r,e,!1));try{if(t.variable){const a=yield Ci(t.variable,e,i);return yield e._getFromScope(a,s)}return yield e._get(s)}catch(a){if(i&&"InternalUndefinedVariableError"===a.name)return null;throw new ve(a,t)}}(t,e,i):qs(t)?yield function*(t,e){const i=yield Ci(t.lhs,e),s=yield Ci(t.rhs,e);return e.memoryLimit.use(s-i+1),te(+i,+s+1)}(t,e):void 0}function*Ei(t){const e=[];for(const i of t)if(Cs(i)){for(;e.length&&e[e.length-1].getPrecedence()>i.getPrecedence();)yield e.pop();e.push(i)}else yield i;for(;e.length;)yield e.pop()}function Ai(t,e){return!Oi(t,e)}function Oi(t,e){return t=Ut(t),e.opts.jsTruthy?!t:!1===t||null==t}const Li={"==":ji,"!=":(t,e)=>!ji(t,e),">":(t,e)=>Oe(t)?t.gt(e):Oe(e)?e.lt(t):Ut(t)>Ut(e),"<":(t,e)=>Oe(t)?t.lt(e):Oe(e)?e.gt(t):Ut(t)<Ut(e),">=":(t,e)=>Oe(t)?t.geq(e):Oe(e)?e.leq(t):Ut(t)>=Ut(e),"<=":(t,e)=>Oe(t)?t.leq(e):Oe(e)?e.geq(t):Ut(t)<=Ut(e),contains:(t,e)=>Qt(t=Ut(t))?t.some(t=>ji(t,e)):!!Rt(null==t?void 0:t.indexOf)&&t.indexOf(Ut(e))>-1,not:(t,e)=>Oi(Ut(t),e),and:(t,e,i)=>Ai(Ut(t),i)&&Ai(Ut(e),i),or:(t,e,i)=>Ai(Ut(t),i)||Ai(Ut(e),i)};function ji(t,e){return Oe(t)?t.equals(e):Oe(e)?e.equals(t):(t=Ut(t),e=Ut(e),Qt(t)?Qt(e)&&function(t,e){return t.length===e.length&&!t.some((t,i)=>!ji(t,e[i]))}(t,e):t===e)}let zi=class{constructor(t,e,i,s){this.key=t,this.value=e,this.next=i,this.prev=s}};class qi{constructor(t,e=0){this.limit=t,this.size=e,this.cache={},this.head=new zi("HEAD",null,null,null),this.tail=new zi("TAIL",null,null,null),this.head.next=this.tail,this.tail.prev=this.head}write(t,e){if(this.cache[t])this.cache[t].value=e;else{const i=new zi(t,e,this.head.next,this.head);this.head.next.prev=i,this.head.next=i,this.cache[t]=i,this.size++,this.ensureLimit()}}read(t){if(!this.cache[t])return;const{value:e}=this.cache[t];return this.remove(t),this.write(t,e),e}remove(t){const e=this.cache[t];e.prev.next=e.next,e.next.prev=e.prev,delete this.cache[t],this.size--}clear(){this.head.next=this.tail,this.tail.prev=this.head,this.size=0,this.cache={}}ensureLimit(){this.size>this.limit&&this.remove(this.tail.prev.key)}}function Pi(t,e){const i=document.createElement("base");i.href=t;const s=document.getElementsByTagName("head")[0];s.insertBefore(i,s.firstChild);const a=document.createElement("a");a.href=e;const r=a.href;return s.removeChild(i),r}var Ii=Object.freeze({__proto__:null,resolve:function(t,e,i){return t.length&&"/"!==Xt(t)&&(t+="/"),Pi(t,e).replace(/^(\w+:\/\/[^/]+)(\/[^?]+)/,(t,e,s)=>{const a=s.split("/").pop();return/\.\w+$/.test(a)?t:e+s+i})},readFile:function(t){return Pe(this,0,void 0,function*(){return new Promise((e,i)=>{const s=new XMLHttpRequest;s.onload=()=>{s.status>=200&&s.status<300?e(s.responseText):i(new Error(s.statusText))},s.onerror=()=>{i(new Error("An error occurred whilst receiving the response."))},s.open("GET",t),s.send()})})},readFileSync:function(t){const e=new XMLHttpRequest;if(e.open("GET",t,!1),e.send(),e.status<200||e.status>=300)throw new Error(e.statusText);return e.responseText},exists:function(t){return Pe(this,0,void 0,function*(){return!0})},existsSync:function(t){return!0},dirname:function(t){return Pi(t,".")},sep:"/"});function Ri(t,e=0){return JSON.stringify(t,null,e)}var Ni={default:function(t,e,...i){return Qt(t=Ut(t))||It(t)?t.length?t:e:(!1!==t||!new Map(i).get("allow_false"))&&(Oi(t,this.context)?e:t)},raw:{raw:!0,handler:se},jsonify:Ri,to_integer:function(t){return Number(t)},json:Ri,inspect:function(t,e=0){const i=[];return JSON.stringify(t,function(t,e){if("object"!=typeof e||null===e)return e;for(;i.length>0&&i[i.length-1]!==this;)i.pop();return i.includes(e)?"[Circular]":(i.push(e),e)},e)}};const Di={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&#34;","'":"&#39;"},Fi={"&amp;":"&","&lt;":"<","&gt;":">","&#34;":'"',"&#39;":"'"};function Mi(t){return t=Ft(t),this.context.memoryLimit.use(t.length),t.replace(/&|<|>|"|'/g,t=>Di[t])}function Hi(t){return t=Ft(t),this.context.memoryLimit.use(t.length),t.replace(/&(amp|lt|gt|#34|#39);/g,t=>Fi[t])}var Ui=Object.freeze({__proto__:null,escape:Mi,xml_escape:function(t){return Mi.call(this,t)},escape_once:function(t){return Mi.call(this,Hi.call(this,t))},newline_to_br:function(t){const e=Ft(t);return this.context.memoryLimit.use(e.length),e.replace(/\r?\n/gm,"<br />\n")},strip_html:function(t){const e=Ft(t);return this.context.memoryLimit.use(e.length),e.replace(/<script[\s\S]*?<\/script>|<style[\s\S]*?<\/style>|<.*?>|<!--[\s\S]*?-->/g,"")}});class Bi{constructor(t){this.mapping=t,this.sep="/"}exists(t){return Pe(this,0,void 0,function*(){return this.existsSync(t)})}existsSync(t){return!Gt(this.mapping[t])}readFile(t){return Pe(this,0,void 0,function*(){return this.readFileSync(t)})}readFileSync(t){const e=this.mapping[t];if(Gt(e))throw new Error(`ENOENT: ${t}`);return e}dirname(t){const e=t.split(this.sep);return e.pop(),e.join(this.sep)}resolve(t,e,i){if(e+=i,"."===t)return e;const s=t.split(/\/+/);for(const a of e.split(this.sep))"."!==a&&""!==a&&(".."===a?(s.length>1||""!==s[0])&&s.pop():s.push(a));return s.join(this.sep)}}const Vi={root:["."],layouts:["."],partials:["."],relativeReference:!0,jekyllInclude:!1,keyValueSeparator:":",cache:void 0,extname:"",fs:Ii,dynamicPartials:!0,jsTruthy:!1,dateFormat:"%A, %B %-e, %Y at %-l:%M %P %z",locale:"",trimTagRight:!1,trimTagLeft:!1,trimOutputRight:!1,trimOutputLeft:!1,greedy:!0,tagDelimiterLeft:"{%",tagDelimiterRight:"%}",outputDelimiterLeft:"{{",outputDelimiterRight:"}}",preserveTimezones:!1,strictFilters:!1,strictVariables:!1,ownPropertyOnly:!0,lenientIf:!1,globals:{},keepOutputType:!1,operators:Li,memoryLimit:1/0,parseLimit:1/0,renderLimit:1/0};function Ji(t){var e,i,s;if(t.hasOwnProperty("root")&&(t.hasOwnProperty("partials")||(t.partials=t.root),t.hasOwnProperty("layouts")||(t.layouts=t.root)),t.hasOwnProperty("cache")){let e;e="number"==typeof t.cache?t.cache>0?new qi(t.cache):void 0:"object"==typeof t.cache?t.cache:t.cache?new qi(1024):void 0,t.cache=e}return(t=Object.assign(Object.assign(Object.assign({},Vi),t.jekyllInclude?{dynamicPartials:!1}:{}),t)).fs.dirname&&t.fs.sep||!t.relativeReference||(console.warn("[LiquidJS] `fs.dirname` and `fs.sep` are required for relativeReference, set relativeReference to `false` to suppress this warning"),t.relativeReference=!1),t.root=Gi(t.root),t.partials=Gi(t.partials),t.layouts=Gi(t.layouts),t.outputEscape=t.outputEscape&&("escape"===(s=t.outputEscape)?Mi:"json"===s?Ni.json:(_e(Rt(s),"`outputEscape` need to be of type string or function"),s)),t.locale||(t.locale=null!==(i=null===(e=Ke())||void 0===e?void 0:e().resolvedOptions().locale)&&void 0!==i?i:"en-US"),t.templates&&(t.fs=new Bi(t.templates),t.relativeReference=!0,t.root=t.partials=t.layouts="."),t}function Gi(t){let e=[];return Qt(t)&&(e=t),It(t)&&(e=[t]),e}function Ki(t,e){if(!t||!Es(t))return;const i=e?4:16;for(;ye[t.input.charCodeAt(t.end-1-t.trimRight)]&i;)t.trimRight++}function Qi(t,e){if(!t||!Es(t))return;const i=e?4:16;for(;ye[t.input.charCodeAt(t.begin+t.trimLeft)]&i;)t.trimLeft++;"\n"===t.input.charAt(t.begin+t.trimLeft)&&t.trimLeft++}class Wi{constructor(t,e=Vi.operators,i,s){this.input=t,this.file=i,this.rawBeginAt=-1,this.p=s?s[0]:0,this.N=s?s[1]:t.length,this.opTrie=ze(e),this.literalTrie=ze(je)}readExpression(){return new Ti(this.readExpressionTokens())}*readExpressionTokens(){for(;this.p<this.N;){const t=this.readOperator();if(t){yield t;continue}const e=this.readValue();if(!e)return;yield e}}readOperator(){this.skipBlank();const t=this.matchTrie(this.opTrie);if(-1!==t)return new pi(this.input,this.p,this.p=t,this.file)}matchTrie(t){let e,i=t,s=this.p;for(;i[this.input[s]]&&s<this.N;)i=i[this.input[s++]],i.end&&(e=i);return e?e.needBoundary&&xe(this.peek(s-this.p))?-1:s:-1}readFilteredValue(){const t=this.p,e=this.readExpression();this.assert(e.valid(),`invalid value expression: ${this.snapshot()}`);const i=this.readFilters();return new wi(e,i,this.input,t,this.p,this.file)}readFilters(){const t=[];for(;;){const e=this.readFilter();if(!e)return t;t.push(e)}}readFilter(){if(this.skipBlank(),this.end())return null;this.assert("|"===this.read(),'expected "|" before filter');const t=this.readIdentifier();if(!t.size())return this.assert(this.end(),"expected filter name"),null;const e=[];if(this.skipBlank(),":"===this.peek())do{++this.p;const t=this.readFilterArg();t&&e.push(t),this.skipBlank(),this.assert(this.end()||","===this.peek()||"|"===this.peek(),()=>`unexpected character ${this.snapshot()}`)}while(","===this.peek());else if("|"!==this.peek()&&!this.end())throw this.error('expected ":" after filter name');return new hi(t.getText(),e,this.input,t.begin,this.p,this.file)}readFilterArg(){const t=this.readValue();if(!t)return;if(this.skipBlank(),":"!==this.peek())return t;++this.p;const e=this.readValue();return[t.getText(),e]}readTopLevelTokens(t=Vi){const e=[];for(;this.p<this.N;){const i=this.readTopLevelToken(t);e.push(i)}return function(t,e){let i=!1;for(let s=0;s<t.length;s++){const a=t[s];Ts(a)&&(!i&&a.trimLeft&&Ki(t[s-1],e.greedy),As(a)&&("raw"===a.name?i=!0:"endraw"===a.name&&(i=!1)),!i&&a.trimRight&&Qi(t[s+1],e.greedy))}}(e,t),e}readTopLevelToken(t){const{tagDelimiterLeft:e,outputDelimiterLeft:i}=t;return this.rawBeginAt>-1?this.readEndrawOrRawContent(t):this.match(e)?this.readTagToken(t):this.match(i)?this.readOutputToken(t):this.readHTMLToken([e,i])}readHTMLToken(t){const e=this.p;for(;this.p<this.N&&!t.some(t=>this.match(t));)++this.p;return new ri(this.input,e,this.p,this.file)}readTagToken(t){const{file:e,input:i}=this,s=this.p;if(-1===this.readToDelimiter(t.tagDelimiterRight))throw this.error(`tag ${this.snapshot(s)} not closed`,s);const a=new si(i,s,this.p,t,e);return"raw"===a.name&&(this.rawBeginAt=s),a}readToDelimiter(t,e=!1){for(this.skipBlank();this.p<this.N;)if(e&&8&this.peekType())this.readQuoted();else if(++this.p,this.rmatch(t))return this.p;return-1}readOutputToken(t=Vi){const{file:e,input:i}=this,{outputDelimiterRight:s}=t,a=this.p;if(-1===this.readToDelimiter(s,!0))throw this.error(`output ${this.snapshot(a)} not closed`,a);return new ai(i,a,this.p,t,e)}readEndrawOrRawContent(t){const{tagDelimiterLeft:e,tagDelimiterRight:i}=t,s=this.p;let a=this.readTo(e)-e.length;for(;this.p<this.N;)if("endraw"===this.readIdentifier().getText())for(;this.p<=this.N;){if(this.rmatch(i)){const e=this.p;return s===a?(this.rawBeginAt=-1,new si(this.input,s,e,t,this.file)):(this.p=a,new ri(this.input,s,a,this.file))}if(this.rmatch(e))break;this.p++}else a=this.readTo(e)-e.length;throw this.error(`raw ${this.snapshot(this.rawBeginAt)} not closed`,s)}readLiquidTagTokens(t=Vi){const e=[];for(;this.p<this.N;){const i=this.readLiquidTagToken(t);i&&e.push(i)}return e}readLiquidTagToken(t){if(this.skipBlank(),this.end())return;const e=this.p;this.readToDelimiter("\n");const i=this.p;return new _i(this.input,e,i,t,this.file)}error(t,e=this.p){return new pe(t,new oi(this.input,e,this.N,this.file))}assert(t,e,i){if(!t)throw this.error("function"==typeof e?e():e,i)}snapshot(t=this.p){return JSON.stringify((e=this.input.slice(t,this.N),i=32,e.length>i?e.slice(0,i-3)+"...":e));var e,i}readWord(){return this.readIdentifier()}readIdentifier(){this.skipBlank();const t=this.p;for(;!this.end()&&xe(this.peek());)++this.p;return new oi(this.input,t,this.p,this.file)}readNonEmptyIdentifier(){const t=this.readIdentifier();return t.size()?t:void 0}readTagName(){return this.skipBlank(),"#"===this.input[this.p]?this.input.slice(this.p,++this.p):this.readIdentifier().getText()}readHashes(t){const e=[];for(;;){const i=this.readHash(t);if(!i)return e;e.push(i)}}readHash(t){this.skipBlank(),","===this.peek()&&++this.p;const e=this.p,i=this.readNonEmptyIdentifier();if(!i)return;let s;this.skipBlank();const a=It(t)?t:t?"=":":";return this.peek()===a&&(++this.p,s=this.readValue()),new gi(this.input,e,this.p,i,s,this.file)}remaining(){return this.input.slice(this.p,this.N)}advance(t=1){this.p+=t}end(){return this.p>=this.N}read(){return this.input[this.p++]}readTo(t){for(;this.p<this.N;)if(++this.p,this.rmatch(t))return this.p;return-1}readValue(){this.skipBlank();const t=this.p,e=this.readLiteral()||this.readQuoted()||this.readRange()||this.readNumber(),i=this.readProperties(!e);return i.length?new ui(e,i,this.input,t,this.p):e}readScopeValue(){this.skipBlank();const t=this.p,e=this.readProperties();if(e.length)return new ui(void 0,e,this.input,t,this.p)}readProperties(t=!0){const e=[];for(;;){if("["===this.peek()){this.p++;const t=this.readValue()||new oi(this.input,this.p,this.p,this.file);this.assert(-1!==this.readTo("]"),"[ not closed"),e.push(t);continue}if(t&&!e.length){const t=this.readNonEmptyIdentifier();if(t){e.push(t);continue}}if("."===this.peek()&&"."!==this.peek(1)){this.p++;const t=this.readNonEmptyIdentifier();if(!t)break;e.push(t);continue}break}return e}readNumber(){this.skipBlank();let t=!1,e=!1,i=0;for(64&this.peekType()&&i++;this.p+i<=this.N;)if(32&this.peekType(i))e=!0,i++;else{if("."!==this.peek(i)||"."===this.peek(i+1))break;if(t||!e)return;t=!0,i++}if(e&&!xe(this.peek(i))){const t=new ni(this.input,this.p,this.p+i,this.file);return this.advance(i),t}}readLiteral(){this.skipBlank();const t=this.matchTrie(this.literalTrie);if(-1===t)return;const e=new li(this.input,this.p,t,this.file);return this.p=t,e}readRange(){this.skipBlank();const t=this.p;if("("!==this.peek())return;++this.p;const e=this.readValueOrThrow();this.skipBlank(),this.assert("."===this.read()&&"."===this.read(),"invalid range syntax");const i=this.readValueOrThrow();return this.skipBlank(),this.assert(")"===this.read(),"invalid range syntax"),new xi(this.input,t,this.p,e,i,this.file)}readValueOrThrow(){const t=this.readValue();return this.assert(t,()=>`unexpected token ${this.snapshot()}, value expected`),t}readQuoted(){this.skipBlank();const t=this.p;if(!(8&this.peekType()))return;++this.p;let e=!1;for(;this.p<this.N&&(++this.p,this.input[this.p-1]!==this.input[t]||e);)e?e=!1:"\\"===this.input[this.p-1]&&(e=!0);return new yi(this.input,t,this.p,this.file)}*readFileNameTemplate(t){const{outputDelimiterLeft:e}=t,i=[","," ",e],s=new Set(i);for(;this.p<this.N&&!s.has(this.peek());)yield this.match(e)?this.readOutputToken(t):this.readHTMLToken(i)}match(t){for(let e=0;e<t.length;e++)if(t[e]!==this.input[this.p+e])return!1;return!0}rmatch(t){for(let e=0;e<t.length;e++)if(t[t.length-1-e]!==this.input[this.p-1-e])return!1;return!0}peekType(t=0){return this.p+t>=this.N?0:ye[this.input.charCodeAt(this.p+t)]}peek(t=0){return this.p+t>=this.N?"":this.input[this.p+t]}skipBlank(){for(;4&this.peekType();)++this.p}}class Yi{constructor(t,e){this.handlers={},this.stopRequested=!1,this.tokens=t,this.parseToken=e}on(t,e){return this.handlers[t]=e,this}trigger(t,e){const i=this.handlers[t];return!!i&&(i.call(this,e),!0)}start(){let t;for(this.trigger("start");!this.stopRequested&&(t=this.tokens.shift());){if(this.trigger("token",t))continue;if(As(t)&&this.trigger(`tag:${t.name}`,t))continue;const e=this.parseToken(t,this.tokens);this.trigger("template",e)}return this.stopRequested||this.trigger("end"),this}stop(){return this.stopRequested=!0,this}}class Xi{constructor(t){this.token=t}}class Zi extends Xi{constructor(t,e,i){super(t),this.name=t.name,this.liquid=i,this.tokenizer=t.tokenizer}}class ts{constructor(t,e){this.hash={};const i=t instanceof Wi?t:new Wi(t,{});for(const s of i.readHashes(e))this.hash[s.name.content]=s.value}*render(t){const e={};for(const i of Object.keys(this.hash))e[i]=void 0===this.hash[i]||(yield Ci(this.hash[i],t));return e}}function es(t){return Qt(t)}class is{constructor(t,e,i){this.token=t,this.name=t.name,this.handler=Rt(e)?e:Rt(null==e?void 0:e.handler)?e.handler:se,this.raw=!Rt(e)&&!!(null==e?void 0:e.raw),this.args=t.args,this.liquid=i}*render(t,e){const i=[];for(const s of this.args)es(s)?i.push([s[0],yield Ci(s[1],e)]):i.push(yield Ci(s,e));return yield this.handler.apply({context:e,token:this.token,liquid:this.liquid},[t,...i])}}class ss{constructor(t,e){this.filters=[];const i="string"==typeof t?new Wi(t,e.options.operators).readFilteredValue():t;this.initial=i.initial,this.filters=i.filters.map(t=>new is(t,this.getFilter(e,t.name),e))}*value(t,e){e=e||t.opts.lenientIf&&this.filters.length>0&&"default"===this.filters[0].name;let i=yield this.initial.evaluate(t,e);for(const s of this.filters)i=yield s.render(i,t);return i}getFilter(t,e){const i=t.filters[e];return _e(i||!t.options.strictFilters,()=>`undefined filter: ${e}`),i}}class as extends Xi{constructor(t,e){var i;super(t);const s=new Wi(t.input,e.options.operators,t.file,t.contentRange);this.value=new ss(s.readFilteredValue(),e);const a=this.value.filters,r=e.options.outputEscape;if(!(null===(i=a[a.length-1])||void 0===i?void 0:i.raw)&&r){const t=new hi(toString.call(r),[],"",0,0);a.push(new is(t,r,e))}}*render(t,e){const i=yield this.value.value(t,!1);e.write(i)}*arguments(){yield this.value}}class rs extends Xi{constructor(t){super(t),this.str=t.getContent()}*render(t,e){e.write(this.str)}}class ns{constructor(t,e){this.segments=t,this.location=e}toString(){return bs(this.segments,!0)}toArray(){return Array.from(function*t(...e){for(const i of e)i instanceof ns?yield Array.from(t(...i.segments)):yield i}(...this.segments))}}class os{constructor(){this.map=new Map}get(t){const e=bs([t.segments[0]]);return this.map.has(e)||this.map.set(e,[]),this.map.get(e)}has(t){return this.map.has(bs([t.segments[0]]))}push(t){this.get(t).push(t)}asObject(){return Object.fromEntries(this.map)}}const ls={partials:!0};function*ds(t,e,i){const s=new os,a=new os,r=new os,n=new us(new Set),o=new Set;function l(t,e){s.push(t);const i=e.alias(t);if(void 0!==i){const t=i.segments[0];It(t)&&!n.has(t)&&a.push(i)}else{const i=t.segments[0];It(i)&&!e.has(i)&&a.push(t)}for(const s of t.segments)s instanceof ns&&l(s,e)}function*d(t,s){if(t.arguments)for(const e of t.arguments())for(const t of hs(e))l(t,s);if(t.localScope)for(const e of t.localScope()){s.add(e.content),s.deleteAlias(e.content);const[t,i]=e.getPosition();r.push(new ns([e.content],{row:t,col:i,file:e.file}))}if(t.children)if(t.partialScope){const a=t.partialScope();if(void 0===a){for(const a of yield t.children(e,i))yield d(a,s);return}if(o.has(a.name))return;const r=new Set,n=a.isolated?new us(r):s.push(r);for(const t of a.scope)if(It(t))r.add(t);else{const[e,i]=t;r.add(e);const s=Array.from(hs(i));s.length&&n.setAlias(e,s[0].segments)}for(const s of yield t.children(e,i))yield d(s,n),o.add(a.name);n.pop()}else{t.blockScope&&s.push(new Set(t.blockScope()));for(const a of yield t.children(e,i))yield d(a,s);t.blockScope&&s.pop()}}for(const c of t)yield d(c,n);return{variables:s.asObject(),globals:a.asObject(),locals:r.asObject()}}function cs(t,e={}){return Ie(ds(t,Object.assign(Object.assign({},ls),e).partials,!1))}function ps(t,e={}){return Re(ds(t,Object.assign(Object.assign({},ls),e).partials,!0))}class us{constructor(t){this.stack=[{names:t,aliases:new Map}]}has(t){for(const e of this.stack)if(e.names.has(t))return!0;return!1}push(t){return this.stack.push({names:t,aliases:new Map}),this}pop(){var t;return null===(t=this.stack.pop())||void 0===t?void 0:t.names}add(t){this.stack[0].names.add(t)}alias(t){const e=t.segments[0];if(!It(e))return;const i=this.getAlias(e);return void 0!==i?new ns([...i,...t.segments.slice(1)],t.location):void 0}setAlias(t,e){this.stack[this.stack.length-1].aliases.set(t,e)}deleteAlias(t){this.stack[this.stack.length-1].aliases.delete(t)}getAlias(t){for(const e of this.stack){if(e.aliases.has(t))return e.aliases.get(t);if(e.names.has(t))return}}}function*hs(t){Ps(t)?yield*gs(t):t instanceof ss&&(yield*function*(t){for(const e of t.initial.postfix)Ps(e)&&(yield*gs(e));for(const e of t.filters)for(const t of e.args)es(t)&&t[1]?yield*gs(t[1]):Ps(t)&&(yield*gs(t))}(t))}function*gs(t){qs(t)?(yield*gs(t.lhs),yield*gs(t.rhs)):js(t)&&(yield vs(t))}function vs(t){const e=[];let i=t.file;const s=t.props[0];i=i||s.file,Os(s)||Ls(s)||zs(s)?e.push(s.content):js(s)&&e.push(...vs(s).segments);for(const n of t.props.slice(1))i=i||n.file,Os(n)||Ls(n)||zs(n)?e.push(n.content):js(n)&&e.push(vs(n));const[a,r]=t.getPosition();return new ns(e,{row:a,col:r,file:i})}const ms=/^[\u0080-\uFFFFa-zA-Z_][\u0080-\uFFFFa-zA-Z0-9_-]*$/;function bs(t,e=!1){const i=[],s=t[0];It(s)&&(!e||s.match(ms)?i.push(`${s}`):i.push(`['${s}']`));for(const a of t.slice(1))a instanceof ns?i.push(`[${bs(a.segments)}]`):It(a)?a.match(ms)?i.push(`.${a}`):i.push(`['${a}']`):i.push(`[${a}]`);return i.join("")}var fs,ys,xs,_s,ws,ks;(ys=fs||(fs={})).Partials="partials",ys.Layouts="layouts",ys.Root="root";class $s{constructor(t){if(this.options=t,t.relativeReference){const e=t.fs.sep;_e(e,"`fs.sep` is required for relative reference");const i=new RegExp(["."+e,".."+e,"./","../"].map(t=>t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")).join("|"));this.shouldLoadRelative=t=>i.test(t)}else this.shouldLoadRelative=t=>!1;this.contains=this.options.fs.contains||(()=>!0)}*lookup(t,e,i,s){const{fs:a}=this.options,r=this.options[e];for(const n of this.candidates(t,r,s,e!==fs.Root))if(i?a.existsSync(n):yield a.exists(n))return n;throw this.lookupError(t,r)}*candidates(t,e,i,s){const{fs:a,extname:r}=this.options;if(this.shouldLoadRelative(t)&&i){const n=a.resolve(this.dirname(i),t,r);for(const t of e)if(!s||this.contains(t,n)){yield n;break}}for(const n of e){const e=a.resolve(n,t,r);s&&!this.contains(n,e)||(yield e)}if(void 0!==a.fallback){const e=a.fallback(t);void 0!==e&&(yield e)}}dirname(t){const e=this.options.fs;return _e(e.dirname,"`fs.dirname` is required for relative reference"),e.dirname(t)}lookupError(t,e){const i=new Error("ENOENT");return i.message=`ENOENT: Failed to lookup "${t}" in "${e}"`,i.code="ENOENT",i}}class Ss{constructor(t){this.liquid=t,this.cache=this.liquid.options.cache,this.fs=this.liquid.options.fs,this.parseFile=this.cache?this._parseFileCached:this._parseFile,this.loader=new $s(this.liquid.options),this.parseLimit=new ei("parse length",t.options.parseLimit)}parse(t,e){t=String(t),this.parseLimit.use(t.length);const i=new Wi(t,this.liquid.options.operators,e).readTopLevelTokens(this.liquid.options);return this.parseTokens(i)}parseTokens(t){let e;const i=[],s=[];for(;e=t.shift();)try{i.push(this.parseToken(e,t))}catch(a){if(!this.liquid.options.catchAllErrors)throw a;s.push(a)}if(s.length)throw new ge(s);return i}parseToken(t,e){try{if(As(t)){const i=this.liquid.tags[t.name];return _e(i,`tag "${t.name}" not found`),new i(t,e,this.liquid,this)}return Is(t)===xs.Output?new as(t,this.liquid):new rs(t)}catch(i){if(ce.is(i))throw i;throw new ue(i,t)}}parseStream(t){return new Yi(t,(t,e)=>this.parseToken(t,e))}*_parseFileCached(t,e,i=fs.Root,s){const a=this.cache,r=this.loader.shouldLoadRelative(t)?s+","+t:i+":"+t,n=yield a.read(r);if(n)return n;const o=this._parseFile(t,e,i,s),l=e?yield o:Ie(o);a.write(r,l);try{return yield l}catch(d){throw a.remove(r),d}}*_parseFile(t,e,i=fs.Root,s){const a=yield this.loader.lookup(t,i,e,s);return this.parse(e?this.fs.readFileSync(a):yield this.fs.readFile(a),a)}}function Ts(t){return!!(Is(t)&xs.Delimited)}function Cs(t){return Is(t)===xs.Operator}function Es(t){return Is(t)===xs.HTML}function As(t){return Is(t)===xs.Tag}function Os(t){return Is(t)===xs.Quoted}function Ls(t){return Is(t)===xs.Number}function js(t){return Is(t)===xs.PropertyAccess}function zs(t){return Is(t)===xs.Word}function qs(t){return Is(t)===xs.Range}function Ps(t){return(1667&Is(t))>0}function Is(t){return t?t.kind:-1}(_s=xs||(xs={}))[_s.Number=1]="Number",_s[_s.Literal=2]="Literal",_s[_s.Tag=4]="Tag",_s[_s.Output=8]="Output",_s[_s.HTML=16]="HTML",_s[_s.Filter=32]="Filter",_s[_s.Hash=64]="Hash",_s[_s.PropertyAccess=128]="PropertyAccess",_s[_s.Word=256]="Word",_s[_s.Range=512]="Range",_s[_s.Quoted=1024]="Quoted",_s[_s.Operator=2048]="Operator",_s[_s.FilteredValue=4096]="FilteredValue",_s[_s.Delimited=12]="Delimited";class Rs{constructor(t={},e=Vi,i={},{memoryLimit:s,renderLimit:a}={}){var r,n,o,l,d;this.scopes=[{}],this.registers={},this.breakCalled=!1,this.continueCalled=!1,this.sync=!!i.sync,this.opts=e,this.globals=null!==(r=i.globals)&&void 0!==r?r:e.globals,this.environments=Zt(t)?t:Object(t),this.strictVariables=null!==(n=i.strictVariables)&&void 0!==n?n:this.opts.strictVariables,this.ownPropertyOnly=null!==(o=i.ownPropertyOnly)&&void 0!==o?o:e.ownPropertyOnly,this.memoryLimit=null!=s?s:new ei("memory alloc",null!==(l=i.memoryLimit)&&void 0!==l?l:e.memoryLimit),this.renderLimit=null!=a?a:new ei("template render",$i().now()+(null!==(d=i.renderLimit)&&void 0!==d?d:e.renderLimit))}getRegister(t){return this.registers[t]=this.registers[t]||{}}setRegister(t,e){return this.registers[t]=e}saveRegister(...t){return t.map(t=>[t,this.getRegister(t)])}restoreRegister(t){return t.forEach(([t,e])=>this.setRegister(t,e))}getAll(){return[this.globals,this.environments,...this.scopes].reduce((t,e)=>qe(t,e),{})}get(t){return this.getSync(t)}getSync(t){return Re(this._get(t))}*_get(t){const e=this.findScope(t[0]);return yield this._getFromScope(e,t)}getFromScope(t,e){return Re(this._getFromScope(t,e))}*_getFromScope(t,e,i=this.strictVariables){It(e)&&(e=e.split("."));for(let s=0;s<e.length;s++)if(t=yield this.readProperty(t,e[s]),i&&Kt(t))throw new me(e.slice(0,s+1).join("."));return t}push(t){return this.scopes.push(t)}pop(){return this.scopes.pop()}bottom(){return this.scopes[0]}spawn(t={}){return new Rs(t,this.opts,{sync:this.sync,globals:this.globals,strictVariables:this.strictVariables},{renderLimit:this.renderLimit,memoryLimit:this.memoryLimit})}findScope(t){for(let e=this.scopes.length-1;e>=0;e--){const i=this.scopes[e];if(t in i)return i}return t in this.environments?this.environments:this.globals}readProperty(t,e){if(t=Jt(t),e=Ut(e),Gt(t))return t;if(Qt(t)&&e<0)return t[t.length+ +e];const i=function(t,e,i){return!i||Pt.call(t,e)||t instanceof jt?t[e]:void 0}(t,e,this.ownPropertyOnly);return void 0===i&&t instanceof jt?t.liquidMethodMissing(e,this):Rt(i)?i.call(t):"size"===e?function(t){if(Pt.call(t,"size")||void 0!==t.size)return t.size;if(Qt(t)||It(t))return t.length;if("object"==typeof t)return Object.keys(t).length}(t):"first"===e?function(t){return Qt(t)?t[0]:t.first}(t):"last"===e?function(t){return Qt(t)?t[t.length-1]:t.last}(t):i}}(ks=ws||(ws={}))[ks.OUTPUT=0]="OUTPUT",ks[ks.STORE=1]="STORE";const Ns=ne(Math.abs),Ds=ne(Math.max),Fs=ne(Math.min),Ms=ne(Math.ceil),Hs=ne((t,e,i=!1)=>i?Math.floor(t/e):t/e),Us=ne(Math.floor),Bs=ne((t,e)=>t-e),Vs=ne((t,e)=>t+e),Js=ne((t,e)=>t%e),Gs=ne((t,e)=>t*e);var Ks=Object.freeze({__proto__:null,abs:Ns,at_least:Ds,at_most:Fs,ceil:Ms,divided_by:Hs,floor:Us,minus:Bs,plus:Vs,modulo:Js,times:Gs,round:function(t,e=0){t=Bt(t),e=Bt(e);const i=Math.pow(10,e);return Math.round(t*i)/i}});const Qs=/[^\p{M}\p{L}\p{Nd}]+/gu,Ws={raw:/\s+/g,default:Qs,pretty:/[^\p{M}\p{L}\p{Nd}._~!$&'()+,;=@]+/gu,ascii:/[^A-Za-z0-9]+/g,latin:Qs,none:null};var Ys=Object.freeze({__proto__:null,url_decode:t=>decodeURIComponent(Ft(t)).replace(/\+/g," "),url_encode:t=>encodeURIComponent(Ft(t)).replace(/%20/g,"+"),cgi_escape:t=>encodeURIComponent(Ft(t)).replace(/%20/g,"+").replace(/[!'()*]/g,t=>"%"+t.charCodeAt(0).toString(16).toUpperCase()),uri_escape:t=>encodeURI(Ft(t)).replace(/%5B/g,"[").replace(/%5D/g,"]"),slugify:function(t,e="default",i=!1){t=Ft(t);const s=Ws[e];return s&&("latin"===e&&(t=function(t){return t.replace(/[àáâãäå]/g,"a").replace(/[æ]/g,"ae").replace(/[ç]/g,"c").replace(/[èéêë]/g,"e").replace(/[ìíîï]/g,"i").replace(/[ð]/g,"d").replace(/[ñ]/g,"n").replace(/[òóôõöø]/g,"o").replace(/[ùúûü]/g,"u").replace(/[ýÿ]/g,"y").replace(/[ß]/g,"ss").replace(/[œ]/g,"oe").replace(/[þ]/g,"th").replace(/[ẞ]/g,"SS").replace(/[Œ]/g,"OE").replace(/[Þ]/g,"TH")}(t)),t=t.replace(s,"-").replace(/^-|-$/g,"")),i?t:t.toLowerCase()}});const Xs=re(function(t,e){const i=Ht(t),s=Gt(e)?" ":Ft(e),a=i.length*(1+s.length);return this.context.memoryLimit.use(a),i.join(s)}),Zs=re(t=>Wt(t)?Xt(t):""),ta=re(t=>Wt(t)?t[0]:""),ea=re(function(t){const e=Ht(t);return this.context.memoryLimit.use(e.length),[...e].reverse()});function ia(t,e=[]){const i=Ht(t),s=Ht(e);return this.context.memoryLimit.use(i.length+s.length),i.concat(s)}function sa(t){return this.context.opts.jekyllWhere?e=>{return ke.is(t)?ji(e,t):Qt(e)?(i=t,e.some(t=>ji(t,i))):ji(e,t);var i}:void 0===t?t=>Ai(t,this.context):e=>ji(e,t)}function*aa(t,e,i,s){const a=[];e=Ht(e),this.context.memoryLimit.use(e.length);const r=new Wi(Ft(i)).readScopeValue();for(const o of e)a.push(yield Ci(r,this.context.spawn(o)));const n=sa.call(this,s);return e.filter((e,i)=>n(a[i])===t)}function*ra(t,e,i,s){const a=[],r=new ss(Ft(s),this.liquid),n=Ht(e);this.context.memoryLimit.use(n.length);for(const o of n){this.context.push({[i]:o});const e=yield r.value(this.context);this.context.pop(),e===t&&a.push(o)}return a}function*na(t,e,i){const s=new Wi(Ft(e)).readScopeValue(),a=Ht(t),r=sa.call(this,i);for(let n=0;n<a.length;n++){if(r(yield Ci(s,this.context.spawn(a[n]))))return[n,a[n]]}}function*oa(t,e,i){const s=new ss(Ft(i),this.liquid),a=Ht(t);for(let r=0;r<a.length;r++){this.context.push({[e]:a[r]});const t=yield s.value(this.context);if(this.context.pop(),t)return[r,a[r]]}}var la=Object.freeze({__proto__:null,join:Xs,last:Zs,first:ta,reverse:ea,sort:function*(t,e){const i=[],s=Ht(t);this.context.memoryLimit.use(s.length);for(const a of s)i.push([a,e?yield this.context._getFromScope(a,Ft(e).split("."),!1):a]);return i.sort((t,e)=>{const i=t[1],s=e[1];return i<s?-1:i>s?1:0}).map(t=>t[0])},sort_natural:function(t,e){const i=Ft(e),s=void 0===e?ae:(t,e)=>ae(t[i],e[i]),a=Ht(t);return this.context.memoryLimit.use(a.length),[...a].sort(s)},size:t=>t&&t.length||0,map:function*(t,e){const i=[],s=Ht(t);this.context.memoryLimit.use(s.length);for(const a of s)i.push(yield this.context._getFromScope(a,Ft(e),!1));return i},sum:function*(t,e){let i=0;const s=Ht(t);for(const a of s){const t=Number(e?yield this.context._getFromScope(a,Ft(e),!1):a);i+=Number.isNaN(t)?0:t}return i},compact:function(t){const e=Ht(t);return this.context.memoryLimit.use(e.length),e.filter(t=>!Gt(Ut(t)))},concat:ia,push:function(t,e){return ia.call(this,t,[e])},unshift:function(t,e){const i=Ht(t);this.context.memoryLimit.use(i.length);const s=[...i];return s.unshift(e),s},pop:function(t){const e=[...Ht(t)];return e.pop(),e},shift:function(t){const e=Ht(t);this.context.memoryLimit.use(e.length);const i=[...e];return i.shift(),i},slice:function(t,e,i=1){return Gt(t=Ut(t))?[]:(Qt(t)||(t=Ft(t)),e=e<0?t.length+e:e,this.context.memoryLimit.use(i),t.slice(e,e+i))},where:function*(t,e,i){return yield*aa.call(this,!0,t,e,i)},reject:function*(t,e,i){return yield*aa.call(this,!1,t,e,i)},where_exp:function*(t,e,i){return yield*ra.call(this,!0,t,e,i)},reject_exp:function*(t,e,i){return yield*ra.call(this,!1,t,e,i)},group_by:function*(t,e){const i=new Map;t=Mt(t);const s=new Wi(Ft(e)).readScopeValue();this.context.memoryLimit.use(t.length);for(const a of t){const t=yield Ci(s,this.context.spawn(a));i.has(t)||i.set(t,[]),i.get(t).push(a)}return[...i.entries()].map(([t,e])=>({name:t,items:e}))},group_by_exp:function*(t,e,i){const s=new Map,a=new ss(Ft(i),this.liquid);t=Mt(t),this.context.memoryLimit.use(t.length);for(const r of t){this.context.push({[e]:r});const t=yield a.value(this.context);this.context.pop(),s.has(t)||s.set(t,[]),s.get(t).push(r)}return[...s.entries()].map(([t,e])=>({name:t,items:e}))},has:function*(t,e,i){return!!(yield*na.call(this,t,e,i))},has_exp:function*(t,e,i){return!!(yield*oa.call(this,t,e,i))},find_index:function*(t,e,i){const s=yield*na.call(this,t,e,i);return s?s[0]:void 0},find_index_exp:function*(t,e,i){const s=yield*oa.call(this,t,e,i);return s?s[0]:void 0},find:function*(t,e,i){const s=yield*na.call(this,t,e,i);return s?s[1]:void 0},find_exp:function*(t,e,i){const s=yield*oa.call(this,t,e,i);return s?s[1]:void 0},uniq:function(t){return t=Ht(t),this.context.memoryLimit.use(t.length),[...new Set(t)]},sample:function(t,e=1){if(Gt(t=Ut(t)))return[];Qt(t)||(t=Ft(t)),this.context.memoryLimit.use(e);const i=[...t].sort(()=>Math.random()-.5);return 1===e?i[0]:i.slice(0,e)}});function da(t,e,i){var s,a,r;const n=(null!==(s=null==t?void 0:t.length)&&void 0!==s?s:0)+(null!==(a=null==e?void 0:e.length)&&void 0!==a?a:0)+(null!==(r=null==i?void 0:i.length)&&void 0!==r?r:0);this.context.memoryLimit.use(n);const o=pa(t,this.context.opts,i);return o?Je(o,e=Gt(e=Ut(e))?this.context.opts.dateFormat:Ft(e)):t}function ca(t,e,i,s){const a=pa(t,this.context.opts);if(!a)return t;if("ordinal"===i){const t=a.getDate();return Je(a,"US"===s?`${e} ${t}%q, %Y`:`${t}%q ${e} %Y`)}return Je(a,`%d ${e} %Y`)}function pa(t,e,i){let s;const a=null!=i?i:e.timezoneOffset,r=e.locale;return s="now"===(t=Ut(t))||"today"===t?new ti(Date.now(),r,a):Vt(t)?new ti(1e3*t,r,a):It(t)?/^\d+$/.test(t)?new ti(1e3*+t,r,a):e.preserveTimezones&&void 0===i?ti.createDateFixedToTimezone(t,r):new ti(t,r,a):new ti(t,r,a),s.valid()?s:void 0}var ua=Object.freeze({__proto__:null,date:da,date_to_xmlschema:function(t){return da.call(this,t,"%Y-%m-%dT%H:%M:%S%:z")},date_to_rfc822:function(t){return da.call(this,t,"%a, %d %b %Y %H:%M:%S %z")},date_to_string:function(t,e,i){return ca.call(this,t,"%b",e,i)},date_to_long_string:function(t,e,i){return ca.call(this,t,"%B",e,i)}});const ha=/[\u4E00-\u9FFF\uF900-\uFAFF\u3400-\u4DBF\u3040-\u309F\u30A0-\u30FF\uAC00-\uD7AF]/gu,ga=/[^\u4E00-\u9FFF\uF900-\uFAFF\u3400-\u4DBF\u3040-\u309F\u30A0-\u30FF\uAC00-\uD7AF\s]+/gu;var va=Object.freeze({__proto__:null,append:function(t,e){_e(2===arguments.length,"append expect 2 arguments");const i=Ft(t),s=Ft(e);return this.context.memoryLimit.use(i.length+s.length),i+s},prepend:function(t,e){_e(2===arguments.length,"prepend expect 2 arguments");const i=Ft(t),s=Ft(e);return this.context.memoryLimit.use(i.length+s.length),s+i},lstrip:function(t,e){const i=Ft(t);return this.context.memoryLimit.use(i.length),e?(e=oe(Ft(e)),i.replace(new RegExp(`^[${e}]+`,"g"),"")):i.replace(/^\s+/,"")},downcase:function(t){const e=Ft(t);return this.context.memoryLimit.use(e.length),e.toLowerCase()},upcase:function(t){const e=Ft(t);return this.context.memoryLimit.use(e.length),Ft(e).toUpperCase()},remove:function(t,e){const i=Ft(t);return this.context.memoryLimit.use(i.length),i.split(Ft(e)).join("")},remove_first:function(t,e){const i=Ft(t);return this.context.memoryLimit.use(i.length),i.replace(Ft(e),"")},remove_last:function(t,e){const i=Ft(t);this.context.memoryLimit.use(i.length);const s=Ft(e),a=i.lastIndexOf(s);return-1===a?i:i.substring(0,a)+i.substring(a+s.length)},rstrip:function(t,e){return t=Ft(t),this.context.memoryLimit.use(t.length),e?(e=oe(Ft(e)),t.replace(new RegExp(`[${e}]+$`,"g"),"")):t.replace(/\s+$/,"")},split:function(t,e){const i=Ft(t);this.context.memoryLimit.use(i.length);const s=i.split(Ft(e));for(;s.length&&""===s[s.length-1];)s.pop();return s},strip:function(t,e){const i=Ft(t);return this.context.memoryLimit.use(i.length),e?(e=oe(Ft(e)),i.replace(new RegExp(`^[${e}]+`,"g"),"").replace(new RegExp(`[${e}]+$`,"g"),"")):i.trim()},strip_newlines:function(t){const e=Ft(t);return this.context.memoryLimit.use(e.length),e.replace(/\r?\n/gm,"")},capitalize:function(t){return t=Ft(t),this.context.memoryLimit.use(t.length),t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()},replace:function(t,e,i){const s=Ft(t);return this.context.memoryLimit.use(s.length),s.split(Ft(e)).join(i)},replace_first:function(t,e,i){const s=Ft(t);return this.context.memoryLimit.use(s.length),s.replace(Ft(e),i)},replace_last:function(t,e,i){const s=Ft(t);this.context.memoryLimit.use(s.length);const a=Ft(e),r=s.lastIndexOf(a);if(-1===r)return s;const n=Ft(i);return s.substring(0,r)+n+s.substring(r+a.length)},truncate:function(t,e=50,i="..."){const s=Ft(t);return this.context.memoryLimit.use(s.length),s.length<=e?t:s.substring(0,e-i.length)+i},truncatewords:function(t,e=15,i="..."){const s=Ft(t);this.context.memoryLimit.use(s.length);const a=s.split(/\s+/);e<=0&&(e=1);let r=a.slice(0,e).join(" ");return a.length>=e&&(r+=i),r},normalize_whitespace:function(t){const e=Ft(t);return this.context.memoryLimit.use(e.length),e.replace(/\s+/g," ")},number_of_words:function(t,e){const i=Ft(t);if(this.context.memoryLimit.use(i.length),!(t=i.trim()))return 0;switch(e){case"cjk":return(t.match(ha)||[]).length+(t.match(ga)||[]).length;case"auto":return ha.test(t)?t.match(ha).length+(t.match(ga)||[]).length:t.split(/\s+/).length;default:return t.split(/\s+/).length}},array_to_sentence_string:function(t,e="and"){switch(this.context.memoryLimit.use(t.length),t.length){case 0:return"";case 1:return t[0];case 2:return`${t[0]} ${e} ${t[1]}`;default:return`${t.slice(0,-1).join(", ")}, ${e} ${t[t.length-1]}`}}});var ma=Object.freeze({__proto__:null,base64_encode:function(t){const e=Ft(t);return this.context.memoryLimit.use(e.length),function(t){return btoa(String.fromCharCode(...(new TextEncoder).encode(t)))}(e)},base64_decode:function(t){const e=Ft(t);return this.context.memoryLimit.use(e.length),function(t){return(new TextDecoder).decode(Uint8Array.from(atob(t),t=>t.charCodeAt(0)))}(e)}});const ba=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},Ui),Ks),Ys),la),ua),va),ma),Ni);const fa=["offset","limit","reversed"];function ya(t,e,i){if(e.options.dynamicPartials){const e=t.readValue();if(t.assert(e,"illegal file path"),"none"===e.getText())return;if(Os(e)){return xa(i.parse(e.content))}return e}const s=[...t.readFileNameTemplate(e.options)],a=xa(i.parseTokens(s));return"none"===a?void 0:a}function xa(t){return 1===t.length&&Es(t[0].token)?t[0].token.getContent():t}function*_a(t,e,i){return"string"==typeof t?t:Array.isArray(t)?i.renderer.renderTemplates(t,e):yield Ci(t,e)}class wa extends Se{constructor(t,e,i,s){super(t,i,s),this.length=t,this.cols=e}row(){return Math.floor(this.i/this.cols)+1}col0(){return this.i%this.cols}col(){return this.col0()+1}col_first(){return 0===this.col0()}col_last(){return this.col()===this.cols}}const ka={assign:class extends Zi{constructor(t,e,i){super(t,e,i),this.identifier=this.tokenizer.readIdentifier(),this.key=this.identifier.content,this.tokenizer.assert(this.key,"expected variable name"),this.tokenizer.skipBlank(),this.tokenizer.assert("="===this.tokenizer.peek(),'expected "="'),this.tokenizer.advance(),this.value=new ss(this.tokenizer.readFilteredValue(),this.liquid)}*render(t){t.bottom()[this.key]=yield this.value.value(t,this.liquid.options.lenientIf)}*arguments(){yield this.value}*localScope(){yield this.identifier}},for:class extends Zi{constructor(t,e,i,s){super(t,e,i);const a=this.tokenizer.readIdentifier(),r=this.tokenizer.readIdentifier(),n=this.tokenizer.readValue();if(!a.size()||"in"!==r.content||!n)throw new Error(`illegal tag: ${t.getText()}`);let o;this.variable=a.content,this.collection=n,this.hash=new ts(this.tokenizer,i.options.keyValueSeparator),this.templates=[],this.elseTemplates=[];const l=s.parseStream(e).on("start",()=>o=this.templates).on("tag:else",t=>{we(t.args),o=this.elseTemplates}).on("tag:endfor",t=>{we(t.args),l.stop()}).on("template",t=>o.push(t)).on("end",()=>{throw new Error(`tag ${t.getText()} not closed`)});l.start()}*render(t,e){const i=this.liquid.renderer;let s=Mt(yield Ci(this.collection,t));if(!s.length)return void(yield i.renderTemplates(this.elseTemplates,t,e));const a="continue-"+this.variable+"-"+this.collection.getText();t.push({continue:t.getRegister(a)});const r=yield this.hash.render(t);t.pop();s=(this.liquid.options.orderedFilterParameters?Object.keys(r).filter(t=>fa.includes(t)):fa.filter(t=>void 0!==r[t])).reduce((t,e)=>{return"offset"===e?(i=t,s=r.offset,i.slice(s)):"limit"===e?function(t,e){return t.slice(0,e)}(t,r.limit):function(t){return[...t].reverse()}(t);var i,s},s),t.setRegister(a,(r.offset||0)+s.length);const n={forloop:new Se(s.length,this.collection.getText(),this.variable)};t.push(n);for(const o of s){if(n[this.variable]=o,t.continueCalled=t.breakCalled=!1,yield i.renderTemplates(this.templates,t,e),t.breakCalled)break;n.forloop.next()}t.continueCalled=t.breakCalled=!1,t.pop()}*children(){const t=this.templates.slice();return this.elseTemplates&&t.push(...this.elseTemplates),t}*arguments(){yield this.collection;for(const t of Object.values(this.hash.hash))Ps(t)&&(yield t)}blockScope(){return[this.variable,"forloop"]}},capture:class extends Zi{constructor(t,e,i,s){for(super(t,e,i),this.templates=[],this.identifier=this.readVariable(),this.variable=this.identifier.content;e.length;){const t=e.shift();if(As(t)&&"endcapture"===t.name)return;this.templates.push(s.parseToken(t,e))}throw new Error(`tag ${t.getText()} not closed`)}readVariable(){let t=this.tokenizer.readIdentifier();if(t.content)return t;if(t=this.tokenizer.readQuoted(),t)return t;throw this.tokenizer.error("invalid capture name")}*render(t){const e=this.liquid.renderer,i=yield e.renderTemplates(this.templates,t);t.bottom()[this.variable]=i}*children(){return this.templates}*localScope(){yield this.identifier}},case:class extends Zi{constructor(t,e,i,s){super(t,e,i),this.branches=[],this.elseTemplates=[],this.value=new ss(this.tokenizer.readFilteredValue(),this.liquid),this.elseTemplates=[];let a=[],r=0;const n=s.parseStream(e).on("tag:when",t=>{if(r>0)return;a=[];const e=[];for(;!t.tokenizer.end();)e.push(t.tokenizer.readValueOrThrow()),t.tokenizer.skipBlank(),","===t.tokenizer.peek()?t.tokenizer.readTo(","):t.tokenizer.readTo("or");this.branches.push({values:e,templates:a})}).on("tag:else",()=>{r++,a=this.elseTemplates}).on("tag:endcase",()=>n.stop()).on("template",t=>{a===this.elseTemplates&&1!==r||a.push(t)}).on("end",()=>{throw new Error(`tag ${t.getText()} not closed`)});n.start()}*render(t,e){const i=this.liquid.renderer,s=Ut(yield this.value.value(t,t.opts.lenientIf));let a=!1;for(const r of this.branches)for(const n of r.values){if(ji(s,yield Ci(n,t,t.opts.lenientIf))){yield i.renderTemplates(r.templates,t,e),a=!0;break}}a||(yield i.renderTemplates(this.elseTemplates,t,e))}*arguments(){yield this.value,yield*this.branches.flatMap(t=>t.values)}*children(){const t=this.branches.flatMap(t=>t.templates);return this.elseTemplates&&t.push(...this.elseTemplates),t}},comment:class extends Zi{constructor(t,e,i){for(super(t,e,i);e.length;){const t=e.shift();if(As(t)&&"endcomment"===t.name)return}throw new Error(`tag ${t.getText()} not closed`)}render(){}},include:class extends Zi{constructor(t,e,i,s){super(t,e,i);const{tokenizer:a}=t;this.file=ya(a,this.liquid,s),this.currentFile=t.file;const r=a.p;"with"===a.readIdentifier().content?(a.skipBlank(),":"!==a.peek()?this.withVar=a.readValue():a.p=r):a.p=r,this.hash=new ts(a,i.options.jekyllInclude||i.options.keyValueSeparator)}*render(t,e){const{liquid:i,hash:s,withVar:a}=this,{renderer:r}=i,n=yield _a(this.file,t,i);_e(n,()=>`illegal file path "${n}"`);const o=t.saveRegister("blocks","blockMode");t.setRegister("blocks",{}),t.setRegister("blockMode",ws.OUTPUT);const l=yield s.render(t);a&&(l[n]=yield Ci(a,t));const d=yield i._parsePartialFile(n,t.sync,this.currentFile);t.push(t.opts.jekyllInclude?{include:l}:l),yield r.renderTemplates(d,t,e),t.pop(),t.restoreRegister(o)}*children(t,e){return t&&It(this.file)?yield this.liquid._parsePartialFile(this.file,e,this.currentFile):[]}partialScope(){if(It(this.file)){let t;return this.liquid.options.jekyllInclude?t=["include"]:(t=Object.keys(this.hash.hash),this.withVar&&t.push([this.file,this.withVar])),{name:this.file,isolated:!1,scope:t}}}*arguments(){yield*Object.values(this.hash.hash).filter(Ps),Ps(this.file)&&(yield this.file),Ps(this.withVar)&&(yield this.withVar)}},render:class extends Zi{constructor(t,e,i,s){super(t,e,i);const a=this.tokenizer;for(this.file=ya(a,this.liquid,s),this.currentFile=t.file;!a.end();){a.skipBlank();const t=a.p,e=a.readIdentifier();if(("with"===e.content||"for"===e.content)&&(a.skipBlank(),":"!==a.peek())){const t=a.readValue();if(t){const i=a.p;let s;"as"===a.readIdentifier().content?s=a.readIdentifier():a.p=i,this[e.content]={value:t,alias:s&&s.content},a.skipBlank(),","===a.peek()&&a.advance();continue}}a.p=t;break}this.hash=new ts(a,i.options.keyValueSeparator)}*render(t,e){const{liquid:i,hash:s}=this,a=yield _a(this.file,t,i);_e(a,()=>`illegal file path "${a}"`);const r=t.spawn(),n=r.bottom();if(qe(n,yield s.render(t)),this.with){const{value:e,alias:i}=this.with;n[i||a]=yield Ci(e,t)}if(this.for){const{value:s,alias:o}=this.for,l=Mt(yield Ci(s,t));n.forloop=new Se(l.length,s.getText(),o);for(const t of l){n[o]=t;const s=yield i._parsePartialFile(a,r.sync,this.currentFile);yield i.renderer.renderTemplates(s,r,e),n.forloop.next()}}else{const t=yield i._parsePartialFile(a,r.sync,this.currentFile);yield i.renderer.renderTemplates(t,r,e)}}*children(t,e){return t&&It(this.file)?yield this.liquid._parsePartialFile(this.file,e,this.currentFile):[]}partialScope(){if(It(this.file)){const t=Object.keys(this.hash.hash);if(this.with){const{value:e,alias:i}=this.with;It(i)?t.push([i,e]):It(this.file)&&t.push([this.file,e])}if(this.for){const{value:e,alias:i}=this.for;It(i)?t.push([i,e]):It(this.file)&&t.push([this.file,e])}return{name:this.file,isolated:!0,scope:t}}}*arguments(){for(const t of Object.values(this.hash.hash))Ps(t)&&(yield t);if(this.with){const{value:t}=this.with;Ps(t)&&(yield t)}if(this.for){const{value:t}=this.for;Ps(t)&&(yield t)}}},decrement:class extends Zi{constructor(t,e,i){super(t,e,i),this.identifier=this.tokenizer.readIdentifier(),this.variable=this.identifier.content}render(t,e){const i=t.environments;Vt(i[this.variable])||(i[this.variable]=0),e.write(Ft(--i[this.variable]))}*localScope(){yield this.identifier}},increment:class extends Zi{constructor(t,e,i){super(t,e,i),this.identifier=this.tokenizer.readIdentifier(),this.variable=this.identifier.content}render(t,e){const i=t.environments;Vt(i[this.variable])||(i[this.variable]=0);const s=i[this.variable];i[this.variable]++,e.write(Ft(s))}*localScope(){yield this.identifier}},cycle:class extends Zi{constructor(t,e,i){super(t,e,i),this.candidates=[];const s=this.tokenizer.readValue();for(this.tokenizer.skipBlank(),s&&(":"===this.tokenizer.peek()?(this.group=s,this.tokenizer.advance()):this.candidates.push(s));!this.tokenizer.end();){const t=this.tokenizer.readValue();t&&this.candidates.push(t),this.tokenizer.readTo(",")}this.tokenizer.assert(this.candidates.length,()=>`empty candidates: "${t.getText()}"`)}*render(t,e){const i=`cycle:${yield Ci(this.group,t)}:`+this.candidates.join(","),s=t.getRegister("cycle");let a=s[i];void 0===a&&(a=s[i]=0);const r=this.candidates[a];return a=(a+1)%this.candidates.length,s[i]=a,yield Ci(r,t)}*arguments(){yield*this.candidates,this.group&&(yield this.group)}},if:class extends Zi{constructor(t,e,i,s){super(t,e,i),this.branches=[];let a=[];s.parseStream(e).on("start",()=>this.branches.push({value:new ss(t.tokenizer.readFilteredValue(),this.liquid),templates:a=[]})).on("tag:elsif",t=>{_e(!this.elseTemplates,"unexpected elsif after else"),this.branches.push({value:new ss(t.tokenizer.readFilteredValue(),this.liquid),templates:a=[]})}).on("tag:else",t=>{we(t.args),_e(!this.elseTemplates,"duplicated else"),a=this.elseTemplates=[]}).on("tag:endif",function(t){we(t.args),this.stop()}).on("template",t=>a.push(t)).on("end",()=>{throw new Error(`tag ${t.getText()} not closed`)}).start()}*render(t,e){const i=this.liquid.renderer;for(const{value:s,templates:a}of this.branches){if(Ai(yield s.value(t,t.opts.lenientIf),t))return void(yield i.renderTemplates(a,t,e))}yield i.renderTemplates(this.elseTemplates||[],t,e)}*children(){const t=this.branches.flatMap(t=>t.templates);return this.elseTemplates&&t.push(...this.elseTemplates),t}arguments(){return this.branches.map(t=>t.value)}},layout:class extends Zi{constructor(t,e,i,s){super(t,e,i),this.file=ya(this.tokenizer,this.liquid,s),this.currentFile=t.file,this.args=new ts(this.tokenizer,i.options.keyValueSeparator),this.templates=s.parseTokens(e)}*render(t,e){const{liquid:i,args:s,file:a}=this,{renderer:r}=i;if(void 0===a)return t.setRegister("blockMode",ws.OUTPUT),void(yield r.renderTemplates(this.templates,t,e));const n=yield _a(this.file,t,i);_e(n,()=>`illegal file path "${n}"`);const o=yield i._parseLayoutFile(n,t.sync,this.currentFile);t.setRegister("blockMode",ws.STORE);const l=yield r.renderTemplates(this.templates,t),d=t.getRegister("blocks");void 0===d[""]&&(d[""]=(t,e)=>e.write(l)),t.setRegister("blockMode",ws.OUTPUT),t.push(yield s.render(t)),yield r.renderTemplates(o,t,e),t.pop()}*children(t){const e=this.templates.slice();return t&&It(this.file)&&e.push(...yield this.liquid._parsePartialFile(this.file,!0,this.currentFile)),e}*arguments(){for(const t of Object.values(this.args.hash))Ps(t)&&(yield t);Ps(this.file)&&(yield this.file)}partialScope(){if(It(this.file))return{name:this.file,isolated:!1,scope:Object.keys(this.args.hash)}}},block:class extends Zi{constructor(t,e,i,s){super(t,e,i),this.templates=[];const a=/\w+/.exec(t.args);for(this.block=a?a[0]:"";e.length;){const t=e.shift();if(As(t)&&"endblock"===t.name)return;const i=s.parseToken(t,e);this.templates.push(i)}throw new Error(`tag ${t.getText()} not closed`)}*render(t,e){const i=this.getBlockRender(t);t.getRegister("blockMode")===ws.STORE?t.getRegister("blocks")[this.block]=i:yield i(new Ae,e)}getBlockRender(t){const{liquid:e,templates:i}=this,s=t.getRegister("blocks")[this.block],a=function*(s,a){t.push({block:s}),yield e.renderer.renderTemplates(i,t,a),t.pop()};return s?(t,e)=>s(new Ae(e=>a(t,e)),e):a}*children(){return this.templates}blockScope(){return["block"]}},raw:class extends Zi{constructor(t,e,i){for(super(t,e,i),this.tokens=[];e.length;){const t=e.shift();if(As(t)&&"endraw"===t.name)return;this.tokens.push(t)}throw new Error(`tag ${t.getText()} not closed`)}render(){return this.tokens.map(t=>t.getText()).join("")}},tablerow:class extends Zi{constructor(t,e,i,s){super(t,e,i);const a=this.tokenizer.readIdentifier();this.tokenizer.skipBlank();const r=this.tokenizer.readIdentifier(),n=this.tokenizer.readValue();if("in"!==r.content||!n)throw new Error(`illegal tag: ${t.getText()}`);let o;this.variable=a.content,this.collection=n,this.args=new ts(this.tokenizer,i.options.keyValueSeparator),this.templates=[];const l=s.parseStream(e).on("start",()=>o=this.templates).on("tag:endtablerow",()=>l.stop()).on("template",t=>o.push(t)).on("end",()=>{throw new Error(`tag ${t.getText()} not closed`)});l.start()}*render(t,e){let i=Mt(yield Ci(this.collection,t));const s=yield this.args.render(t),a=s.offset||0,r=void 0===s.limit?i.length:s.limit;i=i.slice(a,a+r);const n=s.cols||i.length,o=this.liquid.renderer,l=new wa(i.length,n,this.collection.getText(),this.variable),d={tablerowloop:l};t.push(d);for(let c=0;c<i.length;c++,l.next())d[this.variable]=i[c],0===l.col0()&&(1!==l.row()&&e.write("</tr>"),e.write(`<tr class="row${l.row()}">`)),e.write(`<td class="col${l.col()}">`),yield o.renderTemplates(this.templates,t,e),e.write("</td>");i.length&&e.write("</tr>"),t.pop()}*children(){return this.templates}*arguments(){yield this.collection;for(const t of Object.values(this.args.hash))Ps(t)&&(yield t)}blockScope(){return[this.variable,"tablerowloop"]}},unless:class extends Zi{constructor(t,e,i,s){super(t,e,i),this.branches=[],this.elseTemplates=[];let a=[],r=0;s.parseStream(e).on("start",()=>this.branches.push({value:new ss(t.tokenizer.readFilteredValue(),this.liquid),test:Oi,templates:a=[]})).on("tag:elsif",t=>{r>0?a=[]:this.branches.push({value:new ss(t.tokenizer.readFilteredValue(),this.liquid),test:Ai,templates:a=[]})}).on("tag:else",()=>{r++,a=this.elseTemplates}).on("tag:endunless",function(){this.stop()}).on("template",t=>{a===this.elseTemplates&&1!==r||a.push(t)}).on("end",()=>{throw new Error(`tag ${t.getText()} not closed`)}).start()}*render(t,e){const i=this.liquid.renderer;for(const{value:s,test:a,templates:r}of this.branches){if(a(yield s.value(t,t.opts.lenientIf),t))return void(yield i.renderTemplates(r,t,e))}yield i.renderTemplates(this.elseTemplates,t,e)}*children(){const t=this.branches.flatMap(t=>t.templates);return this.elseTemplates&&t.push(...this.elseTemplates),t}arguments(){return this.branches.map(t=>t.value)}},break:class extends Zi{render(t,e){t.breakCalled=!0}},continue:class extends Zi{render(t,e){t.continueCalled=!0}},echo:class extends Zi{constructor(t,e,i){super(t,e,i),this.tokenizer.skipBlank(),this.tokenizer.end()||(this.value=new ss(this.tokenizer.readFilteredValue(),this.liquid))}*render(t,e){if(!this.value)return;const i=yield this.value.value(t,!1);e.write(i)}*arguments(){this.value&&(yield this.value)}},liquid:class extends Zi{constructor(t,e,i,s){super(t,e,i);const a=this.tokenizer.readLiquidTagTokens(this.liquid.options);this.templates=s.parseTokens(a)}*render(t,e){yield this.liquid.renderer.renderTemplates(this.templates,t,e)}*children(){return this.templates}},"#":class extends Zi{constructor(t,e,i){if(super(t,e,i),-1!==t.args.search(/\n\s*[^#\s]/g))throw new Error("every line of an inline comment must start with a '#' character")}render(){}}};class $a{constructor(t={}){this.renderer=new Si,this.filters={},this.tags={},this.options=Ji(t),this.parser=new Ss(this),Yt(ka,(t,e)=>this.registerTag(e,t)),Yt(ba,(t,e)=>this.registerFilter(e,t))}parse(t,e){return new Ss(this).parse(t,e)}_render(t,e,i){const s=e instanceof Rs?e:new Rs(e,this.options,i);return this.renderer.renderTemplates(t,s)}render(t,e,i){return Pe(this,0,void 0,function*(){return Ie(this._render(t,e,Object.assign(Object.assign({},i),{sync:!1})))})}renderSync(t,e,i){return Re(this._render(t,e,Object.assign(Object.assign({},i),{sync:!0})))}renderToNodeStream(t,e,i={}){const s=new Rs(e,this.options,i);return this.renderer.renderTemplatesToNodeStream(t,s)}_parseAndRender(t,e,i){const s=this.parse(t);return this._render(s,e,i)}parseAndRender(t,e,i){return Pe(this,0,void 0,function*(){return Ie(this._parseAndRender(t,e,Object.assign(Object.assign({},i),{sync:!1})))})}parseAndRenderSync(t,e,i){return Re(this._parseAndRender(t,e,Object.assign(Object.assign({},i),{sync:!0})))}_parsePartialFile(t,e,i){return new Ss(this).parseFile(t,e,fs.Partials,i)}_parseLayoutFile(t,e,i){return new Ss(this).parseFile(t,e,fs.Layouts,i)}_parseFile(t,e,i,s){return new Ss(this).parseFile(t,e,i,s)}parseFile(t,e){return Pe(this,0,void 0,function*(){return Ie(new Ss(this).parseFile(t,!1,e))})}parseFileSync(t,e){return Re(new Ss(this).parseFile(t,!0,e))}*_renderFile(t,e,i){const s=yield this._parseFile(t,i.sync,i.lookupType);return yield this._render(s,e,i)}renderFile(t,e,i){return Pe(this,0,void 0,function*(){return Ie(this._renderFile(t,e,Object.assign(Object.assign({},i),{sync:!1})))})}renderFileSync(t,e,i){return Re(this._renderFile(t,e,Object.assign(Object.assign({},i),{sync:!0})))}renderFileToNodeStream(t,e,i){return Pe(this,0,void 0,function*(){const s=yield this.parseFile(t);return this.renderToNodeStream(s,e,i)})}_evalValue(t,e){const i=new ss(t,this),s=e instanceof Rs?e:new Rs(e,this.options);return i.value(s)}evalValue(t,e){return Pe(this,0,void 0,function*(){return Ie(this._evalValue(t,e))})}evalValueSync(t,e){return Re(this._evalValue(t,e))}registerFilter(t,e){this.filters[t]=e}registerTag(t,e){var i;this.tags[t]=Rt(e)?e:(i=e,class extends Zi{constructor(t,e,s){super(t,e,s),Rt(i.parse)&&i.parse.call(this,t,e)}*render(t,e){const s=yield new ts(this.token.args,t.opts.keyValueSeparator).render(t);return yield i.render.call(this,t,e,s)}})}plugin(t){return t.call(this,$a)}express(){const t=this;let e=!0;return function(i,s,a){if(e){e=!1;const i=Gi(this.root);t.options.root.unshift(...i),t.options.layouts.unshift(...i),t.options.partials.unshift(...i)}t.renderFile(i,s).then(t=>a(null,t),a)}}analyze(t,e={}){return Pe(this,0,void 0,function*(){return cs(t,e)})}analyzeSync(t,e={}){return ps(t,e)}parseAndAnalyze(t,e,i={}){return Pe(this,0,void 0,function*(){return cs(this.parse(t,e),i)})}parseAndAnalyzeSync(t,e,i={}){return ps(this.parse(t,e),i)}variables(t,e={}){return Pe(this,0,void 0,function*(){const i=yield cs(It(t)?this.parse(t):t,e);return Object.keys(i.variables)})}variablesSync(t,e={}){const i=ps(It(t)?this.parse(t):t,e);return Object.keys(i.variables)}fullVariables(t,e={}){return Pe(this,0,void 0,function*(){const i=yield cs(It(t)?this.parse(t):t,e);return Array.from(new Set(Object.values(i.variables).flatMap(t=>t.map(t=>String(t)))))})}fullVariablesSync(t,e={}){const i=ps(It(t)?this.parse(t):t,e);return Array.from(new Set(Object.values(i.variables).flatMap(t=>t.map(t=>String(t)))))}variableSegments(t,e={}){return Pe(this,0,void 0,function*(){const i=yield cs(It(t)?this.parse(t):t,e);return Array.from(le(Object.values(i.variables).flatMap(t=>t.map(t=>t.toArray()))))})}variableSegmentsSync(t,e={}){const i=ps(It(t)?this.parse(t):t,e);return Array.from(le(Object.values(i.variables).flatMap(t=>t.map(t=>t.toArray()))))}globalVariables(t,e={}){return Pe(this,0,void 0,function*(){const i=yield cs(It(t)?this.parse(t):t,e);return Object.keys(i.globals)})}globalVariablesSync(t,e={}){const i=ps(It(t)?this.parse(t):t,e);return Object.keys(i.globals)}globalFullVariables(t,e={}){return Pe(this,0,void 0,function*(){const i=yield cs(It(t)?this.parse(t):t,e);return Array.from(new Set(Object.values(i.globals).flatMap(t=>t.map(t=>String(t)))))})}globalFullVariablesSync(t,e={}){const i=ps(It(t)?this.parse(t):t,e);return Array.from(new Set(Object.values(i.globals).flatMap(t=>t.map(t=>String(t)))))}globalVariableSegments(t,e={}){return Pe(this,0,void 0,function*(){const i=yield cs(It(t)?this.parse(t):t,e);return Array.from(le(Object.values(i.globals).flatMap(t=>t.map(t=>t.toArray()))))})}globalVariableSegmentsSync(t,e={}){const i=ps(It(t)?this.parse(t):t,e);return Array.from(le(Object.values(i.globals).flatMap(t=>t.map(t=>t.toArray()))))}}const Sa=new class{constructor(){this.context=null,this.flattenedContext=null,this.history=[],this.maxHistory=50,this.engine=new $a({strictFilters:!1,strictVariables:!1,lenientIf:!0}),this._registerShopifyFilters()}_registerShopifyFilters(){this.engine.registerFilter("money",t=>"$"+(Number(t)/100).toFixed(2)),this.engine.registerFilter("money_without_currency",t=>(Number(t)/100).toFixed(2)),this.engine.registerFilter("money_with_currency",t=>{var e,i,s;const a=Number(t)/100,r=(null==(s=null==(i=null==(e=this.context)?void 0:e.objects)?void 0:i.shop)?void 0:s.currency)||"USD";return"$"+a.toFixed(2)+" "+r}),this.engine.registerFilter("type_of",t=>null==t?"nil":Array.isArray(t)?"array":typeof t),this.engine.registerFilter("json_pretty",t=>JSON.stringify(t,null,2)),this.engine.registerFilter("asset_url",t=>`/assets/${t}`),this.engine.registerFilter("img_url",(t,e="medium")=>"string"==typeof t?t:(null==t?void 0:t.src)||""),this.engine.registerFilter("handle",t=>String(t).toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")),this.engine.registerFilter("handleize",t=>String(t).toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")),this.engine.registerFilter("pluralize",(t,e,i)=>1===t?e:i||e+"s"),this.engine.registerFilter("within",(t,e)=>e&&e.url?`${e.url}${t}`:t),this.engine.registerFilter("link_to",(t,e,i="")=>`<a href="${e}" title="${i}">${t}</a>`),this.engine.registerFilter("link_to_tag",(t,e=null)=>`<a href="/collections/all/${t}">${t}</a>`),this.engine.registerFilter("link_to_vendor",t=>`<a href="/collections/vendors?q=${encodeURIComponent(t)}">${t}</a>`),this.engine.registerFilter("link_to_type",t=>`<a href="/collections/types?q=${encodeURIComponent(t)}">${t}</a>`),this.engine.registerFilter("highlight",(t,e)=>{if(!e)return t;const i=new RegExp(`(${e})`,"gi");return String(t).replace(i,"<strong>$1</strong>")}),this.engine.registerFilter("metafield_value",t=>t&&"object"==typeof t&&"value"in t?t.value:t)}setContext(t){this.context=t,this.flattenedContext=null}_buildLiquidContext(){var t,e,i,s;if(!this.context)return{};const a=mt.currentCart,r=bt.currentProduct,n={...this.context.objects||{},...a?{cart:a}:{},...r?{product:r}:{},template:null==(t=this.context.meta)?void 0:t.template,request:null==(e=this.context.meta)?void 0:e.request,theme:null==(i=this.context.meta)?void 0:i.theme,localization:null==(s=this.context.meta)?void 0:s.localization,settings:this.context.settings};if(this.context.metafields)for(const[o,l]of Object.entries(this.context.metafields))if(n[o]){const t={};for(const[e,i]of Object.entries(l)){t[e]={};for(const[s,a]of Object.entries(i))t[e][s]=(null==a?void 0:a.value)??a}n[o]={...n[o],metafields:t}}return n}async evaluate(t){if(!t||!t.trim())return{success:!1,error:"Empty expression",expression:t};const e=t.trim(),i=this._buildLiquidContext();try{if(/^[\w.\[\]0-9]+$/.test(e)&&!e.includes("{%")&&!e.includes("{{")&&!e.includes("|")){const t=this._resolvePath(e,i);return this.addToHistory(e),{success:!0,value:t,expression:e}}let t=e;e.includes("{%")||e.includes("{{")||(t=`{{ ${e} }}`);const s=await this.engine.parseAndRender(t,i);this.addToHistory(e);return{success:!0,value:this._parseResult(s.trim()),expression:e}}catch(s){return{success:!1,error:s.message,expression:e}}}_resolvePath(t,e){if(!e)return;const i=t.replace(/\[(\d+)\]/g,".$1").split(".").filter(t=>""!==t);let s=e;for(const a of i){if(null==s)return;s=s[a]}return s}_parseResult(t){if(""===t)return"";if(""===t||"nil"===t||"null"===t)return null;if("true"===t)return!0;if("false"===t)return!1;if(/^-?\d+(\.\d+)?$/.test(t))return Number(t);if(t.startsWith("[")&&t.endsWith("]")||t.startsWith("{")&&t.endsWith("}"))try{return JSON.parse(t)}catch{}return t}getCompletions(t){if(!this.context)return[];let e=t.replace(/^\{\{\s*/,"").replace(/\s*\}\}$/,"").trim();const i=e.match(/\{%\s*(\w+)?\s*$/);if(i)return this._getTagCompletions(i[1]||"");const s=e.lastIndexOf("|");if(-1!==s){const t=e.slice(s+1).trim();if(""===t||/^\w*$/.test(t))return this._getFilterCompletions(t)}const a=e.match(/^(.+\[\d+\])\.(\w*)$/);if(a){const t=a[1],e=a[2];return this._getDynamicCompletions(t,e)}const r=this._getAllPaths(),n=e.toLowerCase();return r.filter(t=>t.path.toLowerCase().startsWith(n)).slice(0,20).map(t=>({value:t.path,type:t.type,preview:t.preview}))}_getDynamicCompletions(t,e){const i=this._buildLiquidContext(),s=this._resolvePath(t,i);if(null==s||"object"!=typeof s)return[];const a=[],r=e.toLowerCase();for(const[n,o]of Object.entries(s))if(n.toLowerCase().startsWith(r)){const e=`${t}.${n}`;let i="property",s=o;Array.isArray(o)?(i="array",s=`[${o.length} items]`):"object"==typeof o&&null!==o?(i="object",s=`{${Object.keys(o).length} keys}`):"string"==typeof o?(i="string",s=o.length>50?o.substring(0,50)+"...":o):"number"==typeof o?i="number":"boolean"==typeof o&&(i="boolean"),a.push({value:e,type:i,preview:s})}return a.slice(0,20)}_getTagCompletions(t){const e=t.toLowerCase();return[{value:"if",type:"tag",preview:"Conditional"},{value:"elsif",type:"tag",preview:"Else if"},{value:"else",type:"tag",preview:"Else"},{value:"endif",type:"tag",preview:"End if"},{value:"unless",type:"tag",preview:"Negative conditional"},{value:"endunless",type:"tag",preview:"End unless"},{value:"case",type:"tag",preview:"Switch statement"},{value:"when",type:"tag",preview:"Case option"},{value:"endcase",type:"tag",preview:"End case"},{value:"for",type:"tag",preview:"Loop"},{value:"endfor",type:"tag",preview:"End loop"},{value:"break",type:"tag",preview:"Exit loop"},{value:"continue",type:"tag",preview:"Skip iteration"},{value:"assign",type:"tag",preview:"Assign variable"},{value:"capture",type:"tag",preview:"Capture output"},{value:"endcapture",type:"tag",preview:"End capture"},{value:"increment",type:"tag",preview:"Increment counter"},{value:"decrement",type:"tag",preview:"Decrement counter"},{value:"comment",type:"tag",preview:"Comment block"},{value:"endcomment",type:"tag",preview:"End comment"},{value:"raw",type:"tag",preview:"Raw output"},{value:"endraw",type:"tag",preview:"End raw"},{value:"render",type:"tag",preview:"Render snippet"},{value:"section",type:"tag",preview:"Render section"},{value:"form",type:"tag",preview:"Form tag"},{value:"endform",type:"tag",preview:"End form"},{value:"paginate",type:"tag",preview:"Pagination"},{value:"endpaginate",type:"tag",preview:"End pagination"}].filter(t=>t.value.startsWith(e)).slice(0,15)}_getFilterCompletions(t){const e=t.toLowerCase();return[{value:"append",preview:"Append string"},{value:"prepend",preview:"Prepend string"},{value:"capitalize",preview:"Capitalize first letter"},{value:"downcase",preview:"Convert to lowercase"},{value:"upcase",preview:"Convert to uppercase"},{value:"strip",preview:"Trim whitespace"},{value:"lstrip",preview:"Trim left whitespace"},{value:"rstrip",preview:"Trim right whitespace"},{value:"strip_html",preview:"Remove HTML tags"},{value:"strip_newlines",preview:"Remove newlines"},{value:"newline_to_br",preview:"Convert newlines to <br>"},{value:"replace",preview:"Replace substring"},{value:"replace_first",preview:"Replace first occurrence"},{value:"remove",preview:"Remove substring"},{value:"remove_first",preview:"Remove first occurrence"},{value:"truncate",preview:"Truncate to length"},{value:"truncatewords",preview:"Truncate to word count"},{value:"split",preview:"Split into array"},{value:"slice",preview:"Extract substring"},{value:"escape",preview:"HTML escape"},{value:"escape_once",preview:"HTML escape once"},{value:"url_encode",preview:"URL encode"},{value:"url_decode",preview:"URL decode"},{value:"base64_encode",preview:"Base64 encode"},{value:"base64_decode",preview:"Base64 decode"},{value:"handle",preview:"Convert to handle"},{value:"handleize",preview:"Convert to handle"},{value:"abs",preview:"Absolute value"},{value:"ceil",preview:"Round up"},{value:"floor",preview:"Round down"},{value:"round",preview:"Round to precision"},{value:"plus",preview:"Add number"},{value:"minus",preview:"Subtract number"},{value:"times",preview:"Multiply"},{value:"divided_by",preview:"Divide"},{value:"modulo",preview:"Remainder"},{value:"at_least",preview:"Minimum value"},{value:"at_most",preview:"Maximum value"},{value:"join",preview:"Join array"},{value:"first",preview:"Get first element"},{value:"last",preview:"Get last element"},{value:"size",preview:"Get length"},{value:"reverse",preview:"Reverse array"},{value:"sort",preview:"Sort array"},{value:"sort_natural",preview:"Natural sort"},{value:"uniq",preview:"Remove duplicates"},{value:"map",preview:"Extract property"},{value:"where",preview:"Filter array"},{value:"compact",preview:"Remove nil values"},{value:"concat",preview:"Concatenate arrays"},{value:"date",preview:"Format date"},{value:"default",preview:"Default if nil"},{value:"json",preview:"Convert to JSON"},{value:"json_pretty",preview:"Pretty JSON"},{value:"type_of",preview:"Get type"},{value:"money",preview:"Format as money"},{value:"money_with_currency",preview:"Money with currency"},{value:"money_without_currency",preview:"Money without currency"},{value:"asset_url",preview:"Asset URL"},{value:"img_url",preview:"Image URL"},{value:"link_to",preview:"Create link"},{value:"pluralize",preview:"Pluralize word"},{value:"highlight",preview:"Highlight text"},{value:"metafield_value",preview:"Get metafield value"}].filter(t=>t.value.startsWith(e)).slice(0,15).map(t=>({...t,type:"filter"}))}_getAllPaths(){var t,e,i,s,a,r,n,o;if(!this.flattenedContext){const a=[];if(null==(t=this.context)?void 0:t.objects)for(const[t,e]of Object.entries(this.context.objects))null!=e&&"cart"!==t&&"product"!==t&&this._addPaths(a,t,e,3);if((null==(e=this.context)?void 0:e.meta)&&(this._addPaths(a,"template",this.context.meta.template,2),this._addPaths(a,"request",this.context.meta.request,2),this._addPaths(a,"theme",this.context.meta.theme,2)),null==(i=this.context)?void 0:i.metafields)for(const[t,e]of Object.entries(this.context.metafields))if(e&&(null==(s=this.context.objects)?void 0:s[t]))for(const[i,s]of Object.entries(e))for(const[e,r]of Object.entries(s))a.push({path:`${t}.metafields.${i}.${e}`,type:(null==r?void 0:r.type)||"metafield",preview:null==r?void 0:r.value});this.flattenedContext=a}const l=[...this.flattenedContext],d=mt.currentCart;d?this._addPaths(l,"cart",d,3):(null==(r=null==(a=this.context)?void 0:a.objects)?void 0:r.cart)&&this._addPaths(l,"cart",this.context.objects.cart,3);const c=bt.currentProduct;return c?this._addPaths(l,"product",c,3):(null==(o=null==(n=this.context)?void 0:n.objects)?void 0:o.product)&&this._addPaths(l,"product",this.context.objects.product,3),l}_addPaths(t,e,i,s,a=0){if(a>=s||null==i)return;const r=Array.isArray(i)?"array":typeof i;if(t.push({path:e,type:r,preview:this._getPreview(i)}),"object"!=typeof i||Array.isArray(i))Array.isArray(i)&&i.length>0&&this._addPaths(t,`${e}[0]`,i[0],s,a+1);else for(const[n,o]of Object.entries(i))n.startsWith("_")||this._addPaths(t,`${e}.${n}`,o,s,a+1)}_getPreview(t){return null==t?"null":"string"==typeof t?t.length>50?t.slice(0,50)+"...":t:"number"==typeof t||"boolean"==typeof t?t:Array.isArray(t)?`Array(${t.length})`:"object"==typeof t?`Object(${Object.keys(t).length})`:String(t)}addToHistory(t){this.history[this.history.length-1]!==t&&(this.history.push(t),this.history.length>this.maxHistory&&(this.history=this.history.slice(-this.maxHistory)))}getHistory(){return[...this.history]}clearHistory(){this.history=[]}};class Ta extends ot{constructor(){super(),this.liquidErrors=[],this.evalLogs=[],this.expandedLogs=new Set,this.inputValue="",this.historyIndex=-1,this.suggestions=[],this.selectedSuggestion=-1,this.showSuggestions=!1,this.context=null}connectedCallback(){super.connectedCallback(),this._scanForLiquidErrors()}updated(t){super.updated(t),t.has("context")&&this.context&&Sa.setContext(this.context)}willUpdate(t){t.has("context")&&this.context&&!Sa.context&&Sa.setContext(this.context)}_scanForLiquidErrors(){const t=[],e=new Set,i=(i,s,a=null)=>{const r=i.trim();e.has(r)||(e.add(r),t.push({id:Date.now()+Math.random(),type:"liquid",category:s,message:r,timestamp:new Date,element:a?this._getElementPath(a):null}))},s=document.createTreeWalker(document.body,NodeFilter.SHOW_COMMENT,null,!1);for(;s.nextNode();){const t=s.currentNode.textContent;(t.includes("Liquid error")||t.includes("Liquid syntax error"))&&i(t,"comment")}const a=document.body.innerHTML;[{pattern:/Liquid\s+error\s*\(line\s*\d+\):\s*[^<\n]+/gi,category:"inline"},{pattern:/Liquid\s+error:\s*[^<\n]+/gi,category:"inline"},{pattern:/Liquid\s+syntax\s+error\s*\(line\s*\d+\):\s*[^<\n]+/gi,category:"inline"},{pattern:/Liquid\s+syntax\s+error:\s*[^<\n]+/gi,category:"inline"},{pattern:/Error\s+in\s+schema:\s*[^<\n]+/gi,category:"schema"},{pattern:/Invalid\s+JSON\s+in\s+schema\s+tag/gi,category:"schema"},{pattern:/Error\s+parsing\s+schema:\s*[^<\n]+/gi,category:"schema"}].forEach(({pattern:t,category:e})=>{let s;for(;null!==(s=t.exec(a));)i(s[0],e)});const r=/\{"error"\s*:\s*"([^"]+)"\}/gi;let n;for(;null!==(n=r.exec(a));){const t=n[1];i(`JSON filter error: ${t} — This occurs when using | json on objects that cannot be serialized`,"json")}const o=/#<(?:Shopify::)?(?:Liquid::)?(\w+)Drop:0x[a-f0-9]+>/gi;let l;for(;null!==(l=o.exec(a));){const t=l[1];i(`Raw ${t} Drop object rendered: ${l[0]} — Use .title, .url, or other property instead of outputting the object directly`,"drop")}const d=/\b(Shop|Product|Collection|Cart|Customer|Article|Blog|Page|Variant|Image|Metafield|Address|Order|LineItem|Fulfillment|Transaction|Country|Currency|Locale|Market|Policy|Section|Block|Theme|Font|Link|Linklist|Comment|Form|Paginate|TableRow|ForLoop)Drop\b/g;let c;for(;null!==(c=d.exec(a));){const t=c[1];i(`Raw ${t}Drop object rendered on page — Use a property like .title, .name, .url instead of outputting {{ ${t.toLowerCase()} }} directly`,"drop")}const p=document.createTreeWalker(document.body,NodeFilter.SHOW_TEXT,{acceptNode:t=>{var e;const i=t.parentElement;if(!i)return NodeFilter.FILTER_REJECT;const s=null==(e=i.tagName)?void 0:e.toLowerCase();return"script"===s||"style"===s||"noscript"===s?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}});for(;p.nextNode();){const t=p.currentNode.textContent;if(/Liquid\s+(error|syntax error)/i.test(t)){const e=t.match(/Liquid\s+(?:error|syntax error)[^]*/i);e&&i(e[0],"text",p.currentNode.parentElement)}if(/#<\w+Drop:0x/i.test(t)){const e=t.match(/#<(?:Shopify::)?(?:Liquid::)?(\w+)Drop:0x[a-f0-9]+>/i);e&&i(`Raw ${e[1]} Drop object in page: ${e[0]}`,"drop",p.currentNode.parentElement)}/unknown\s+image\s+file/i.test(t)&&i(`Unknown image file error: ${t.substring(0,200)}`,"asset",p.currentNode.parentElement)}document.querySelectorAll("img").forEach(t=>{const e=t.src||t.dataset.src,s=t.alt;s&&/Liquid\s+error|Could\s+not\s+find\s+asset/i.test(s)&&i(`Image error: ${s}`,"asset",t),e&&/Liquid%20error|Could%20not%20find/i.test(e)&&i(`Broken image URL contains error: ${decodeURIComponent(e.substring(0,200))}`,"asset",t)});document.querySelectorAll(".shopify-section, [data-section-type], .template-").forEach(t=>{const e=t.textContent;if(/form\s+'product'\s+needs\s+a\s+product\s+object/i.test(e)&&i("Liquid error: form 'product' needs a product object","form",t),/form\s+'customer_address'\s+requires\s+an\s+address/i.test(e)&&i("Liquid error: form 'customer_address' requires an address","form",t),/invalid\s+form\s+type/i.test(e)){const s=e.match(/invalid\s+form\s+type\s*['"]?(\w+)['"]?/i);i(`Liquid error: invalid form type '${(null==s?void 0:s[1])||"unknown"}'`,"form",t)}}),this.liquidErrors=t}_getElementPath(t){var e;if(!t)return null;const i=[];let s=t;for(;s&&s!==document.body&&i.length<5;){let t=(null==(e=s.tagName)?void 0:e.toLowerCase())||"";if(s.id)t+=`#${s.id}`;else if(s.className&&"string"==typeof s.className){const e=s.className.split(" ").filter(t=>t&&!t.startsWith("js-")).slice(0,2);e.length&&(t+=`.${e.join(".")}`)}t&&i.unshift(t),s=s.parentElement}return i.join(" > ")}_clearEvalLogs(){this.evalLogs=[]}_toggleExpand(t){const e=new Set(this.expandedLogs);e.has(t)?e.delete(t):e.add(t),this.expandedLogs=e}_handleInputKeydown(t){switch(t.key){case"Enter":if(t.shiftKey)return;t.preventDefault(),this.showSuggestions&&this.selectedSuggestion>=0?this._selectSuggestion(this.selectedSuggestion):this._evaluateExpression();break;case"ArrowUp":this.showSuggestions&&this.suggestions.length>0?(t.preventDefault(),this.selectedSuggestion=this.selectedSuggestion<=0?this.suggestions.length-1:this.selectedSuggestion-1,this._scrollSuggestionIntoView()):this.inputValue.includes("\n")&&!this._isAtFirstLine(t.target)||(t.preventDefault(),this._navigateHistory(-1));break;case"ArrowDown":this.showSuggestions&&this.suggestions.length>0?(t.preventDefault(),this.selectedSuggestion=this.selectedSuggestion>=this.suggestions.length-1?0:this.selectedSuggestion+1,this._scrollSuggestionIntoView()):this.inputValue.includes("\n")&&!this._isAtLastLine(t.target)||(t.preventDefault(),this._navigateHistory(1));break;case"Tab":if(this.showSuggestions&&this.suggestions.length>0){t.preventDefault();const e=this.selectedSuggestion>=0?this.selectedSuggestion:0;this._selectSuggestion(e)}break;case"Escape":this.showSuggestions&&(t.preventDefault(),this.showSuggestions=!1,this.selectedSuggestion=-1)}}_isAtFirstLine(t){const e=t.selectionStart;return!t.value.substring(0,e).includes("\n")}_isAtLastLine(t){const e=t.selectionStart;return!t.value.substring(e).includes("\n")}_scrollSuggestionIntoView(){this.updateComplete.then(()=>{const t=this.shadowRoot.querySelector(".autocomplete-dropdown"),e=this.shadowRoot.querySelector(".autocomplete-item--selected");t&&e&&e.scrollIntoView({block:"nearest",behavior:"smooth"})})}_handleInput(t){this.inputValue=t.target.value,this.historyIndex=-1,this._updateSuggestions(),this._autoGrowTextarea(t.target)}_autoGrowTextarea(t){t.style.height="auto",t.style.height=Math.min(t.scrollHeight,150)+"px"}_updateSuggestions(){if(!this.inputValue.trim())return this.suggestions=[],this.showSuggestions=!1,void(this.selectedSuggestion=-1);this.suggestions=Sa.getCompletions(this.inputValue),this.showSuggestions=this.suggestions.length>0,this.selectedSuggestion=-1}_selectSuggestion(t){const e=this.suggestions[t];if(!e)return;const i=this.inputValue.lastIndexOf("|");-1!==i&&"filter"===e.type?this.inputValue=this.inputValue.slice(0,i+1)+" "+e.value:this.inputValue=e.value,this.showSuggestions=!1,this.selectedSuggestion=-1,this.updateComplete.then(()=>{const t=this.shadowRoot.querySelector(".console-input");t&&(t.focus(),t.setSelectionRange(t.value.length,t.value.length),this._autoGrowTextarea(t))})}_navigateHistory(t){const e=Sa.getHistory();0!==e.length&&(-1===t?this.historyIndex<e.length-1&&(this.historyIndex++,this.inputValue=e[e.length-1-this.historyIndex]):this.historyIndex>0?(this.historyIndex--,this.inputValue=e[e.length-1-this.historyIndex]):0===this.historyIndex&&(this.historyIndex=-1,this.inputValue=""),this.showSuggestions=!1)}async _evaluateExpression(){if(!this.inputValue.trim())return;const t=this.inputValue;this.inputValue="",this.historyIndex=-1,this.showSuggestions=!1;const e=await Sa.evaluate(t),i={id:Date.now()+Math.random(),type:"eval",expression:e.expression,result:e.success?e.value:null,error:e.success?null:e.error,success:e.success,timestamp:new Date};this.evalLogs=[...this.evalLogs,i],this.updateComplete.then(()=>{const t=this.shadowRoot.querySelector(".console-content");t&&(t.scrollTop=t.scrollHeight)})}_formatTime(t){return t instanceof Date||(t=new Date(t)),isNaN(t.getTime())?"--:--:--":t.toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit",fractionalSecondDigits:3})}_renderEvalResult(t){if(!t.success)return U`<span class="eval-result eval-result--error">${t.error}</span>`;const e=t.result;return void 0===e?U`<span class="eval-result eval-result--undefined">undefined</span>`:null===e?U`<span class="eval-result eval-result--null">null</span>`:"string"==typeof e?U`<span class="eval-result eval-result--string">"${e}"</span>`:"number"==typeof e?U`<span class="eval-result eval-result--number">${e}</span>`:"boolean"==typeof e?U`<span class="eval-result eval-result--boolean">${e}</span>`:"object"==typeof e?U`
4227
+ `]),customElements.define("tdt-storage-panel",Ot);class zt{constructor(t,e,i,s,a){this.kind=t,this.input=e,this.begin=i,this.end=s,this.file=a}getText(){return this.input.slice(this.begin,this.end)}getPosition(){let[t,e]=[1,1];for(let i=0;i<this.begin;i++)"\n"===this.input[i]?(t++,e=1):e++;return[t,e]}size(){return this.end-this.begin}}class jt{liquidMethodMissing(t,e){}}const Lt=Object.prototype.toString,Pt=String.prototype.toLowerCase,It=Object.hasOwnProperty;function Rt(t){return"string"==typeof t}function Nt(t){return"function"==typeof t}function Ft(t){return t&&Nt(t.then)}function Dt(t){return t&&Nt(t.next)&&Nt(t.throw)&&Nt(t.return)}function Mt(t){return Rt(t=Bt(t))?t:Kt(t)?"":Wt(t)?t.map(t=>Mt(t)).join(""):String(t)}function Ht(t){return Wt(t=Bt(t))?t:Rt(t)&&t.length>0?[t]:te(e=t)&&Symbol.iterator in e?Array.from(t):te(t)?Object.keys(t).map(e=>[e,t[e]]):[];var e}function Ut(t){return Kt(t=Bt(t))?[]:Wt(t)?t:[t]}function Bt(t){return t instanceof jt&&Nt(t.valueOf)?t.valueOf():t}function Vt(t){return+Bt(t)||0}function Jt(t){return"number"==typeof t}function Gt(t){return t&&Nt(t.toLiquid)?Gt(t.toLiquid()):t}function Kt(t){return null==t}function Qt(t){return void 0===t}function Wt(t){return"[object Array]"===Lt.call(t)}function Yt(t){return t&&Jt(t.length)}function Xt(t,e){t=t||{};for(const i in t)if(It.call(t,i)&&!1===e(t[i],i,t))break;return t}function Zt(t){return t[t.length-1]}function te(t){const e=typeof t;return null!==t&&("object"===e||"function"===e)}function ee(t,e,i=1){const s=[];for(let a=t;a<e;a+=i)s.push(a);return s}function ie(t,e,i=" "){return se(t,e,i,(t,e)=>e+t)}function se(t,e,i,s){let a=e-(t=String(t)).length;for(;a-- >0;)t=s(t,i);return t}function ae(t){return t}function re(t,e){return null==t&&null==e?0:null==t?1:null==e||(t=Pt.call(t))<(e=Pt.call(e))?-1:t>e?1:0}function ne(t){return function(...e){return t.call(this,...e.map(Bt))}}function oe(t){return function(...e){return t.call(this,...e.map(Vt))}}function le(t){return t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")}function*de(t){const e=new Set;for(const i of t){const t=JSON.stringify(i);e.has(t)||(e.add(t),yield i)}}const ce="__liquidClass__";class pe extends Error{constructor(t,e){super("string"==typeof t?t:t.message),this.context="","string"!=typeof t&&Object.defineProperty(this,"originalError",{value:t,enumerable:!1}),Object.defineProperty(this,"token",{value:e,enumerable:!1}),Object.defineProperty(this,ce,{value:"LiquidError",enumerable:!1})}update(){Object.defineProperty(this,"context",{value:ye(this.token),enumerable:!1}),this.message=function(t,e){e.file&&(t+=`, file:${e.file}`);const[i,s]=e.getPosition();return t+=`, line:${i}, col:${s}`}(this.message,this.token),this.stack=this.message+"\n"+this.context+"\n"+this.stack,this.originalError&&(this.stack+="\nFrom "+this.originalError.stack)}static is(t){return"LiquidError"===(null==t?void 0:t[ce])}}class ue extends pe{constructor(t,e){super(t,e),this.name="TokenizationError",super.update()}}class he extends pe{constructor(t,e){super(t,e),this.name="ParseError",this.message=t.message,super.update()}}class ge extends pe{constructor(t,e){super(t,e.token),this.name="RenderError",this.message=t.message,super.update()}static is(t){return"RenderError"===t.name}}class ve extends pe{constructor(t){super(t[0],t[0].token),this.errors=t,this.name="LiquidErrors";const e=t.length>1?"s":"";this.message=`${t.length} error${e} found`,super.update()}static is(t){return"LiquidErrors"===t.name}}class me extends pe{constructor(t,e){super(t,e),this.name="UndefinedVariableError",this.message=t.message,super.update()}}class fe extends Error{constructor(t){super(`undefined variable: ${t}`),this.name="InternalUndefinedVariableError",this.variableName=t}}class be extends Error{constructor(t){super(t),this.name="AssertionError",this.message=t+""}}function ye(t){const[e,i]=t.getPosition(),s=t.input.split("\n"),a=Math.max(e-2,1),r=Math.min(e+3,s.length);return ee(a,r+1).map(t=>{let a=`${t===e?">> ":" "}${ie(String(t),String(r).length)}| `;const n=t===e?"\n"+ie("^",i+a.length):"";return a+=s[t-1],a+=n,a}).join("\n")}const xe=[0,0,0,0,0,0,0,0,0,20,4,4,4,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,20,2,8,0,0,0,0,8,0,0,0,64,0,65,0,0,33,33,33,33,33,33,33,33,33,33,0,0,2,2,2,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0];function _e(t){const e=t.charCodeAt(0);return e>=128?!xe[e]:!!(1&xe[e])}function we(t,e){if(!t){const i="function"==typeof e?e():e||`expect ${t} to be true`;throw new be(i)}}function ke(t,e=`unexpected ${JSON.stringify(t)}`){we(!t,e)}xe[160]=xe[5760]=xe[6158]=xe[8192]=xe[8193]=xe[8194]=xe[8195]=xe[8196]=xe[8197]=xe[8198]=xe[8199]=xe[8200]=xe[8201]=xe[8202]=xe[8232]=xe[8233]=xe[8239]=xe[8287]=xe[12288]=4,xe[8220]=xe[8221]=128;class $e extends jt{equals(t){return!(t instanceof $e)&&(Rt(t=Bt(t))||Wt(t)?0===t.length:!!te(t)&&0===Object.keys(t).length)}gt(){return!1}geq(){return!1}lt(){return!1}leq(){return!1}valueOf(){return""}static is(t){return t instanceof $e}}class Se extends $e{equals(t){return!1===t||(!!Kt(Bt(t))||(Rt(t)?/^\s*$/.test(t):super.equals(t)))}static is(t){return t instanceof Se}}class Te extends jt{constructor(t,e,i){super(),this.i=0,this.length=t,this.name=`${i}-${e}`}next(){this.i++}index0(){return this.i}index(){return this.i+1}first(){return 0===this.i}last(){return this.i===this.length-1}rindex(){return this.length-this.i}rindex0(){return this.length-this.i-1}valueOf(){return JSON.stringify(this)}}class Ce{constructor(){this.buffer=""}write(t){this.buffer+=Mt(t)}}class Ee{constructor(){throw this.buffer="",this.stream=null,new Error("streaming not supported in browser")}}class Ae{constructor(){this.buffer=""}write(t){"string"!=typeof(t=Bt(t))&&""===this.buffer?this.buffer=t:this.buffer=Mt(this.buffer)+Mt(t)}}class qe extends jt{constructor(t=()=>""){super(),this.superBlockRender=t}*super(){const t=new Ce;return yield this.superBlockRender(t),t.buffer}}function Oe(t){return t&&Nt(t.equals)&&Nt(t.gt)&&Nt(t.geq)&&Nt(t.lt)&&Nt(t.leq)}const ze=new class extends jt{equals(t){return Kt(Bt(t))}gt(){return!1}geq(){return!1}lt(){return!1}leq(){return!1}valueOf(){return null}},je={true:!0,false:!1,nil:ze,null:ze,empty:new $e,blank:new Se};function Le(t){const e={};for(const[i,s]of Object.entries(t)){let t=e;for(let e=0;e<i.length;e++){const s=i[e];t[s]=t[s]||{},e===i.length-1&&_e(i[e])&&(t[s].needBoundary=!0),t=t[s]}t.data=s,t.end=!0}return e}var Pe=function(){return Pe=Object.assign||function(t){for(var e,i=1,s=arguments.length;i<s;i++)for(var a in e=arguments[i])Object.prototype.hasOwnProperty.call(e,a)&&(t[a]=e[a]);return t},Pe.apply(this,arguments)};function Ie(t,e,i,s){return new(i||(i=Promise))(function(e,a){function r(t){try{o(s.next(t))}catch(e){a(e)}}function n(t){try{o(s.throw(t))}catch(e){a(e)}}function o(t){var s;t.done?e(t.value):(s=t.value,s instanceof i?s:new i(function(t){t(s)})).then(r,n)}o((s=s.apply(t,[])).next())})}function Re(t){return Ie(this,0,void 0,function*(){if(!Dt(t))return t;let e,i=!1,s="next";do{const r=t[s](e);i=r.done,e=r.value,s="next";try{Dt(e)&&(e=Re(e)),Ft(e)&&(e=yield e)}catch(a){s="throw",e=a}}while(!i);return e})}function Ne(t){if(!Dt(t))return t;let e,i=!1,s="next";do{const r=t[s](e);if(i=r.done,e=r.value,s="next",Dt(e))try{e=Ne(e)}catch(a){s="throw",e=a}}while(!i);return e}const Fe=/%([-_0^#:]+)?(\d+)?([EO])?(.)/;function De(t){const e=function(t){const e=t.getFullYear();return!(3&e||!(e%100||e%400==0&&e))}(t)?29:28;return[31,e,31,30,31,30,31,31,30,31,30,31]}function Me(t){let e=0;for(let i=0;i<t.getMonth();++i)e+=De(t)[i];return e+t.getDate()}function He(t,e){const i=Me(t)+(e-t.getDay()),s=7-new Date(t.getFullYear(),0,1).getDay()+e;return String(Math.floor((i-s)/7)+1)}const Ue={d:2,e:2,H:2,I:2,j:3,k:2,l:2,L:3,m:2,M:2,S:2,U:2,W:2},Be=new Set("aAbBceklpP");function Ve(t,e){const i=Math.abs(t.getTimezoneOffset()),s=Math.floor(i/60),a=i%60;return(t.getTimezoneOffset()>0?"-":"+")+ie(s,2,"0")+(e.flags[":"]?":":"")+ie(a,2,"0")}const Je={a:t=>t.getShortWeekdayName(),A:t=>t.getLongWeekdayName(),b:t=>t.getShortMonthName(),B:t=>t.getLongMonthName(),c:t=>t.toLocaleString(),C:t=>function(t){return parseInt(t.getFullYear().toString().substring(0,2),10)}(t),d:t=>t.getDate(),e:t=>t.getDate(),H:t=>t.getHours(),I:t=>String(t.getHours()%12||12),j:t=>Me(t),k:t=>t.getHours(),l:t=>String(t.getHours()%12||12),L:t=>t.getMilliseconds(),m:t=>t.getMonth()+1,M:t=>t.getMinutes(),N:(t,e)=>{const i=Number(e.width)||9;return function(t,e,i=" "){return se(t,e,i,(t,e)=>t+e)}(String(t.getMilliseconds()).slice(0,i),i,"0")},p:t=>t.getHours()<12?"AM":"PM",P:t=>t.getHours()<12?"am":"pm",q:t=>function(t){const e=t.getDate();if([11,12,13].includes(e))return"th";switch(e%10){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}}(t),s:t=>Math.round(t.getTime()/1e3),S:t=>t.getSeconds(),u:t=>t.getDay()||7,U:t=>He(t,0),w:t=>t.getDay(),W:t=>He(t,1),x:t=>t.toLocaleDateString(),X:t=>t.toLocaleTimeString(),y:t=>t.getFullYear().toString().slice(2,4),Y:t=>t.getFullYear(),z:Ve,Z:(t,e)=>t.getTimeZoneName()||Ve(t,e),t:()=>"\t",n:()=>"\n","%":()=>"%"};function Ge(t,e){let i,s="",a=e;for(;i=Fe.exec(a);)s+=a.slice(0,i.index),a=a.slice(i.index+i[0].length),s+=Ke(t,i);return s+a}function Ke(t,e){const[i,s="",a,r,n]=e,o=Je[n];if(!o)return i;const l={};for(const h of s)l[h]=!0;let d=String(o(t,{flags:l,width:a,modifier:r})),c=Be.has(n)?" ":"0",p=a||Ue[n]||0;var u;return l["^"]?d=d.toUpperCase():l["#"]&&(u=d,d=[...u].some(t=>t>="a"&&t<="z")?u.toUpperCase():u.toLowerCase()),l._?c=" ":l[0]&&(c="0"),l["-"]&&(p=0),ie(d,p,c)}function Qe(){return"undefined"!=typeof Intl?Intl.DateTimeFormat:void 0}Je.h=Je.b;const We=/([zZ]|([+-])(\d{2}):?(\d{2}))$/,Ye=["January","February","March","April","May","June","July","August","September","October","November","December"],Xe=Ye.map(t=>t.slice(0,3)),Ze=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],ti=Ze.map(t=>t.slice(0,3));class ei{constructor(t,e,i){this.locale=e,this.DateTimeFormat=Qe(),this.date=new Date(t),this.timezoneFixed=void 0!==i,void 0===i&&(i=this.date.getTimezoneOffset()),this.timezoneOffset=Rt(i)?ei.getTimezoneOffset(i,this.date):i,this.timezoneName=Rt(i)?i:"";const s=6e4*(this.date.getTimezoneOffset()-this.timezoneOffset),a=this.date.getTime()+s;this.displayDate=new Date(a)}getTime(){return this.displayDate.getTime()}getMilliseconds(){return this.displayDate.getMilliseconds()}getSeconds(){return this.displayDate.getSeconds()}getMinutes(){return this.displayDate.getMinutes()}getHours(){return this.displayDate.getHours()}getDay(){return this.displayDate.getDay()}getDate(){return this.displayDate.getDate()}getMonth(){return this.displayDate.getMonth()}getFullYear(){return this.displayDate.getFullYear()}toLocaleString(t,e){return(null==e?void 0:e.timeZone)?this.date.toLocaleString(t,e):this.displayDate.toLocaleString(t,e)}toLocaleTimeString(t){return this.displayDate.toLocaleTimeString(t)}toLocaleDateString(t){return this.displayDate.toLocaleDateString(t)}getTimezoneOffset(){return this.timezoneOffset}getTimeZoneName(){return this.timezoneFixed?this.timezoneName:this.DateTimeFormat?this.DateTimeFormat().resolvedOptions().timeZone:void 0}getLongMonthName(){var t;return null!==(t=this.format({month:"long"}))&&void 0!==t?t:Ye[this.getMonth()]}getShortMonthName(){var t;return null!==(t=this.format({month:"short"}))&&void 0!==t?t:Xe[this.getMonth()]}getLongWeekdayName(){var t;return null!==(t=this.format({weekday:"long"}))&&void 0!==t?t:Ze[this.displayDate.getDay()]}getShortWeekdayName(){var t;return null!==(t=this.format({weekday:"short"}))&&void 0!==t?t:ti[this.displayDate.getDay()]}valid(){return!isNaN(this.getTime())}format(t){return this.DateTimeFormat&&this.DateTimeFormat(this.locale,t).format(this.displayDate)}static createDateFixedToTimezone(t,e){const i=t.match(We);if(i&&"Z"===i[1])return new ei(+new Date(t),e,0);if(i&&i[2]&&i[3]&&i[4]){const[,,s,a,r]=i,n=("+"===s?-1:1)*(60*parseInt(a,10)+parseInt(r,10));return new ei(+new Date(t),e,n)}return new ei(t,e)}static getTimezoneOffset(t,e){const i=e.toLocaleString("en-US",{timeZone:t}),s=e.toLocaleString("en-US",{timeZone:"UTC"}),a=new Date(i);return(+new Date(s)-+a)/6e4}}class ii{constructor(t,e){this.base=0,this.message=`${t} limit exceeded`,this.limit=e}use(t){t=+t||0,we(this.base+t<=this.limit,this.message),this.base+=t}check(t){we((t=+t||0)<=this.limit,this.message)}}class si extends zt{constructor(t,[e,i],s,a,r,n,o,l){super(t,s,a,r,l),this.trimLeft=!1,this.trimRight=!1;const d="-"===s[e],c="-"===s[i-1];let p=d?e+1:e,u=c?i-1:i;for(;p<u&&4&xe[s.charCodeAt(p)];)p++;for(;u>p&&4&xe[s.charCodeAt(u-1)];)u--;this.contentRange=[p,u],this.trimLeft=d||n,this.trimRight=c||o}get content(){return this.input.slice(this.contentRange[0],this.contentRange[1])}}class ai extends si{constructor(t,e,i,s,a){const{trimTagLeft:r,trimTagRight:n,tagDelimiterLeft:o,tagDelimiterRight:l}=s,[d,c]=[e+o.length,i-l.length];super(_s.Tag,[d,c],t,e,i,r,n,a),this.tokenizer=new Yi(t,s.operators,a,this.contentRange),this.name=this.tokenizer.readTagName(),this.tokenizer.assert(this.name,"illegal tag syntax, tag name expected"),this.tokenizer.skipBlank(),this.args=this.tokenizer.input.slice(this.tokenizer.p,this.contentRange[1])}}class ri extends si{constructor(t,e,i,s,a){const{trimOutputLeft:r,trimOutputRight:n,outputDelimiterLeft:o,outputDelimiterRight:l}=s,d=[e+o.length,i-l.length];super(_s.Output,d,t,e,i,r,n,a)}}class ni extends zt{constructor(t,e,i,s){super(_s.HTML,t,e,i,s),this.input=t,this.begin=e,this.end=i,this.file=s,this.trimLeft=0,this.trimRight=0}getContent(){return this.input.slice(this.begin+this.trimLeft,this.end-this.trimRight)}}class oi extends zt{constructor(t,e,i,s){super(_s.Number,t,e,i,s),this.input=t,this.begin=e,this.end=i,this.file=s,this.content=Number(this.getText())}}class li extends zt{constructor(t,e,i,s){super(_s.Word,t,e,i,s),this.input=t,this.begin=e,this.end=i,this.file=s,this.content=this.getText()}}class di extends zt{constructor(t,e,i,s){super(_s.Literal,t,e,i,s),this.input=t,this.begin=e,this.end=i,this.file=s,this.literal=this.getText(),this.content=je[this.literal]}}const ci={"==":2,"!=":2,">":2,"<":2,">=":2,"<=":2,contains:2,not:1,and:0,or:0},pi={"==":0,"!=":0,">":0,"<":0,">=":0,"<=":0,contains:0,not:1,and:0,or:0};class ui extends zt{constructor(t,e,i,s){super(_s.Operator,t,e,i,s),this.input=t,this.begin=e,this.end=i,this.file=s,this.operator=this.getText()}getPrecedence(){const t=this.getText();return t in ci?ci[t]:1}}class hi extends zt{constructor(t,e,i,s,a,r){super(_s.PropertyAccess,i,s,a,r),this.variable=t,this.props=e}}class gi extends zt{constructor(t,e,i,s,a,r){super(_s.Filter,i,s,a,r),this.name=t,this.args=e}}class vi extends zt{constructor(t,e,i,s,a,r){super(_s.Hash,t,e,i,r),this.input=t,this.begin=e,this.end=i,this.name=s,this.value=a,this.file=r}}const mi=/[\da-fA-F]/,fi=/[0-7]/,bi={b:"\b",f:"\f",n:"\n",r:"\r",t:"\t",v:"\v"};function yi(t){const e=t.charCodeAt(0);return e>=97?e-87:e>=65?e-55:e-48}class xi extends zt{constructor(t,e,i,s){super(_s.Quoted,t,e,i,s),this.input=t,this.begin=e,this.end=i,this.file=s,this.content=function(t){let e="";for(let i=1;i<t.length-1;i++)if("\\"===t[i])if(void 0!==bi[t[i+1]])e+=bi[t[++i]];else if("u"===t[i+1]){let s=0,a=i+2;for(;a<=i+5&&mi.test(t[a]);)s=16*s+yi(t[a++]);i=a-1,e+=String.fromCharCode(s)}else if(fi.test(t[i+1])){let s=i+1,a=0;for(;s<=i+3&&fi.test(t[s]);)a=8*a+yi(t[s++]);i=s-1,e+=String.fromCharCode(a)}else e+=t[++i];else e+=t[i];return e}(this.getText())}}class _i extends zt{constructor(t,e,i,s,a,r){super(_s.Range,t,e,i,r),this.input=t,this.begin=e,this.end=i,this.lhs=s,this.rhs=a,this.file=r}}class wi extends si{constructor(t,e,i,s,a){super(_s.Tag,[e,i],t,e,i,!1,!1,a),this.tokenizer=new Yi(t,s.operators,a,this.contentRange),this.name=this.tokenizer.readTagName(),this.tokenizer.assert(this.name,"illegal liquid tag syntax"),this.tokenizer.skipBlank()}get args(){return this.tokenizer.input.slice(this.tokenizer.p,this.contentRange[1])}}class ki extends zt{constructor(t,e,i,s,a,r){super(_s.FilteredValue,i,s,a,r),this.initial=t,this.filters=e,this.input=i,this.begin=s,this.end=a,this.file=r}}const $i={now:()=>Date.now()};function Si(){return"object"==typeof global&&global.performance||"object"==typeof window&&window.performance||$i}class Ti{renderTemplatesToNodeStream(t,e){const i=new Ee;return Promise.resolve().then(()=>Re(this.renderTemplates(t,e,i))).then(()=>i.end(),t=>i.error(t)),i.stream}*renderTemplates(t,e,i){i||(i=e.opts.keepOutputType?new Ae:new Ce);const s=[];for(const r of t){e.renderLimit.check(Si().now());try{const t=yield r.render(e,i);if(t&&i.write(t),e.breakCalled||e.continueCalled)break}catch(a){const t=pe.is(a)?a:new ge(a,r);if(!e.opts.catchAllErrors)throw t;s.push(t)}}if(s.length)throw new ve(s);return i.buffer}}class Ci{constructor(t){this.postfix=[...Ai(t)]}*evaluate(t,e){we(t,"unable to evaluate: context not defined");const i=[];for(const s of this.postfix)if(Es(s)){const e=i.pop();let a;if(1===pi[s.operator])a=yield t.opts.operators[s.operator](e,t);else{const r=i.pop();a=yield t.opts.operators[s.operator](r,e,t)}i.push(a)}else i.push(yield Ei(s,t,e));return i[0]}valid(){return!!this.postfix.length}}function*Ei(t,e,i=!1){if(t)return"content"in t?t.content:js(t)?yield function*(t,e,i){const s=[];for(const r of t.props)s.push(yield Ei(r,e,!1));try{if(t.variable){const a=yield Ei(t.variable,e,i);return yield e._getFromScope(a,s)}return yield e._get(s)}catch(a){if(i&&"InternalUndefinedVariableError"===a.name)return null;throw new me(a,t)}}(t,e,i):Ps(t)?yield function*(t,e){const i=yield Ei(t.lhs,e),s=yield Ei(t.rhs,e);return e.memoryLimit.use(s-i+1),ee(+i,+s+1)}(t,e):void 0}function*Ai(t){const e=[];for(const i of t)if(Es(i)){for(;e.length&&e[e.length-1].getPrecedence()>i.getPrecedence();)yield e.pop();e.push(i)}else yield i;for(;e.length;)yield e.pop()}function qi(t,e){return!Oi(t,e)}function Oi(t,e){return t=Bt(t),e.opts.jsTruthy?!t:!1===t||null==t}const zi={"==":ji,"!=":(t,e)=>!ji(t,e),">":(t,e)=>Oe(t)?t.gt(e):Oe(e)?e.lt(t):Bt(t)>Bt(e),"<":(t,e)=>Oe(t)?t.lt(e):Oe(e)?e.gt(t):Bt(t)<Bt(e),">=":(t,e)=>Oe(t)?t.geq(e):Oe(e)?e.leq(t):Bt(t)>=Bt(e),"<=":(t,e)=>Oe(t)?t.leq(e):Oe(e)?e.geq(t):Bt(t)<=Bt(e),contains:(t,e)=>Wt(t=Bt(t))?t.some(t=>ji(t,e)):!!Nt(null==t?void 0:t.indexOf)&&t.indexOf(Bt(e))>-1,not:(t,e)=>Oi(Bt(t),e),and:(t,e,i)=>qi(Bt(t),i)&&qi(Bt(e),i),or:(t,e,i)=>qi(Bt(t),i)||qi(Bt(e),i)};function ji(t,e){return Oe(t)?t.equals(e):Oe(e)?e.equals(t):(t=Bt(t),e=Bt(e),Wt(t)?Wt(e)&&function(t,e){return t.length===e.length&&!t.some((t,i)=>!ji(t,e[i]))}(t,e):t===e)}let Li=class{constructor(t,e,i,s){this.key=t,this.value=e,this.next=i,this.prev=s}};class Pi{constructor(t,e=0){this.limit=t,this.size=e,this.cache={},this.head=new Li("HEAD",null,null,null),this.tail=new Li("TAIL",null,null,null),this.head.next=this.tail,this.tail.prev=this.head}write(t,e){if(this.cache[t])this.cache[t].value=e;else{const i=new Li(t,e,this.head.next,this.head);this.head.next.prev=i,this.head.next=i,this.cache[t]=i,this.size++,this.ensureLimit()}}read(t){if(!this.cache[t])return;const{value:e}=this.cache[t];return this.remove(t),this.write(t,e),e}remove(t){const e=this.cache[t];e.prev.next=e.next,e.next.prev=e.prev,delete this.cache[t],this.size--}clear(){this.head.next=this.tail,this.tail.prev=this.head,this.size=0,this.cache={}}ensureLimit(){this.size>this.limit&&this.remove(this.tail.prev.key)}}function Ii(t,e){const i=document.createElement("base");i.href=t;const s=document.getElementsByTagName("head")[0];s.insertBefore(i,s.firstChild);const a=document.createElement("a");a.href=e;const r=a.href;return s.removeChild(i),r}var Ri=Object.freeze({__proto__:null,resolve:function(t,e,i){return t.length&&"/"!==Zt(t)&&(t+="/"),Ii(t,e).replace(/^(\w+:\/\/[^/]+)(\/[^?]+)/,(t,e,s)=>{const a=s.split("/").pop();return/\.\w+$/.test(a)?t:e+s+i})},readFile:function(t){return Ie(this,0,void 0,function*(){return new Promise((e,i)=>{const s=new XMLHttpRequest;s.onload=()=>{s.status>=200&&s.status<300?e(s.responseText):i(new Error(s.statusText))},s.onerror=()=>{i(new Error("An error occurred whilst receiving the response."))},s.open("GET",t),s.send()})})},readFileSync:function(t){const e=new XMLHttpRequest;if(e.open("GET",t,!1),e.send(),e.status<200||e.status>=300)throw new Error(e.statusText);return e.responseText},exists:function(t){return Ie(this,0,void 0,function*(){return!0})},existsSync:function(t){return!0},dirname:function(t){return Ii(t,".")},sep:"/"});function Ni(t,e=0){return JSON.stringify(t,null,e)}var Fi={default:function(t,e,...i){return Wt(t=Bt(t))||Rt(t)?t.length?t:e:(!1!==t||!new Map(i).get("allow_false"))&&(Oi(t,this.context)?e:t)},raw:{raw:!0,handler:ae},jsonify:Ni,to_integer:function(t){return Number(t)},json:Ni,inspect:function(t,e=0){const i=[];return JSON.stringify(t,function(t,e){if("object"!=typeof e||null===e)return e;for(;i.length>0&&i[i.length-1]!==this;)i.pop();return i.includes(e)?"[Circular]":(i.push(e),e)},e)}};const Di={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&#34;","'":"&#39;"},Mi={"&amp;":"&","&lt;":"<","&gt;":">","&#34;":'"',"&#39;":"'"};function Hi(t){return t=Mt(t),this.context.memoryLimit.use(t.length),t.replace(/&|<|>|"|'/g,t=>Di[t])}function Ui(t){return t=Mt(t),this.context.memoryLimit.use(t.length),t.replace(/&(amp|lt|gt|#34|#39);/g,t=>Mi[t])}var Bi=Object.freeze({__proto__:null,escape:Hi,xml_escape:function(t){return Hi.call(this,t)},escape_once:function(t){return Hi.call(this,Ui.call(this,t))},newline_to_br:function(t){const e=Mt(t);return this.context.memoryLimit.use(e.length),e.replace(/\r?\n/gm,"<br />\n")},strip_html:function(t){const e=Mt(t);return this.context.memoryLimit.use(e.length),e.replace(/<script[\s\S]*?<\/script>|<style[\s\S]*?<\/style>|<.*?>|<!--[\s\S]*?-->/g,"")}});class Vi{constructor(t){this.mapping=t,this.sep="/"}exists(t){return Ie(this,0,void 0,function*(){return this.existsSync(t)})}existsSync(t){return!Kt(this.mapping[t])}readFile(t){return Ie(this,0,void 0,function*(){return this.readFileSync(t)})}readFileSync(t){const e=this.mapping[t];if(Kt(e))throw new Error(`ENOENT: ${t}`);return e}dirname(t){const e=t.split(this.sep);return e.pop(),e.join(this.sep)}resolve(t,e,i){if(e+=i,"."===t)return e;const s=t.split(/\/+/);for(const a of e.split(this.sep))"."!==a&&""!==a&&(".."===a?(s.length>1||""!==s[0])&&s.pop():s.push(a));return s.join(this.sep)}}const Ji={root:["."],layouts:["."],partials:["."],relativeReference:!0,jekyllInclude:!1,keyValueSeparator:":",cache:void 0,extname:"",fs:Ri,dynamicPartials:!0,jsTruthy:!1,dateFormat:"%A, %B %-e, %Y at %-l:%M %P %z",locale:"",trimTagRight:!1,trimTagLeft:!1,trimOutputRight:!1,trimOutputLeft:!1,greedy:!0,tagDelimiterLeft:"{%",tagDelimiterRight:"%}",outputDelimiterLeft:"{{",outputDelimiterRight:"}}",preserveTimezones:!1,strictFilters:!1,strictVariables:!1,ownPropertyOnly:!0,lenientIf:!1,globals:{},keepOutputType:!1,operators:zi,memoryLimit:1/0,parseLimit:1/0,renderLimit:1/0};function Gi(t){var e,i,s;if(t.hasOwnProperty("root")&&(t.hasOwnProperty("partials")||(t.partials=t.root),t.hasOwnProperty("layouts")||(t.layouts=t.root)),t.hasOwnProperty("cache")){let e;e="number"==typeof t.cache?t.cache>0?new Pi(t.cache):void 0:"object"==typeof t.cache?t.cache:t.cache?new Pi(1024):void 0,t.cache=e}return(t=Object.assign(Object.assign(Object.assign({},Ji),t.jekyllInclude?{dynamicPartials:!1}:{}),t)).fs.dirname&&t.fs.sep||!t.relativeReference||(console.warn("[LiquidJS] `fs.dirname` and `fs.sep` are required for relativeReference, set relativeReference to `false` to suppress this warning"),t.relativeReference=!1),t.root=Ki(t.root),t.partials=Ki(t.partials),t.layouts=Ki(t.layouts),t.outputEscape=t.outputEscape&&("escape"===(s=t.outputEscape)?Hi:"json"===s?Fi.json:(we(Nt(s),"`outputEscape` need to be of type string or function"),s)),t.locale||(t.locale=null!==(i=null===(e=Qe())||void 0===e?void 0:e().resolvedOptions().locale)&&void 0!==i?i:"en-US"),t.templates&&(t.fs=new Vi(t.templates),t.relativeReference=!0,t.root=t.partials=t.layouts="."),t}function Ki(t){let e=[];return Wt(t)&&(e=t),Rt(t)&&(e=[t]),e}function Qi(t,e){if(!t||!As(t))return;const i=e?4:16;for(;xe[t.input.charCodeAt(t.end-1-t.trimRight)]&i;)t.trimRight++}function Wi(t,e){if(!t||!As(t))return;const i=e?4:16;for(;xe[t.input.charCodeAt(t.begin+t.trimLeft)]&i;)t.trimLeft++;"\n"===t.input.charAt(t.begin+t.trimLeft)&&t.trimLeft++}class Yi{constructor(t,e=Ji.operators,i,s){this.input=t,this.file=i,this.rawBeginAt=-1,this.p=s?s[0]:0,this.N=s?s[1]:t.length,this.opTrie=Le(e),this.literalTrie=Le(je)}readExpression(){return new Ci(this.readExpressionTokens())}*readExpressionTokens(){for(;this.p<this.N;){const t=this.readOperator();if(t){yield t;continue}const e=this.readValue();if(!e)return;yield e}}readOperator(){this.skipBlank();const t=this.matchTrie(this.opTrie);if(-1!==t)return new ui(this.input,this.p,this.p=t,this.file)}matchTrie(t){let e,i=t,s=this.p;for(;i[this.input[s]]&&s<this.N;)i=i[this.input[s++]],i.end&&(e=i);return e?e.needBoundary&&_e(this.peek(s-this.p))?-1:s:-1}readFilteredValue(){const t=this.p,e=this.readExpression();this.assert(e.valid(),`invalid value expression: ${this.snapshot()}`);const i=this.readFilters();return new ki(e,i,this.input,t,this.p,this.file)}readFilters(){const t=[];for(;;){const e=this.readFilter();if(!e)return t;t.push(e)}}readFilter(){if(this.skipBlank(),this.end())return null;this.assert("|"===this.read(),'expected "|" before filter');const t=this.readIdentifier();if(!t.size())return this.assert(this.end(),"expected filter name"),null;const e=[];if(this.skipBlank(),":"===this.peek())do{++this.p;const t=this.readFilterArg();t&&e.push(t),this.skipBlank(),this.assert(this.end()||","===this.peek()||"|"===this.peek(),()=>`unexpected character ${this.snapshot()}`)}while(","===this.peek());else if("|"!==this.peek()&&!this.end())throw this.error('expected ":" after filter name');return new gi(t.getText(),e,this.input,t.begin,this.p,this.file)}readFilterArg(){const t=this.readValue();if(!t)return;if(this.skipBlank(),":"!==this.peek())return t;++this.p;const e=this.readValue();return[t.getText(),e]}readTopLevelTokens(t=Ji){const e=[];for(;this.p<this.N;){const i=this.readTopLevelToken(t);e.push(i)}return function(t,e){let i=!1;for(let s=0;s<t.length;s++){const a=t[s];Cs(a)&&(!i&&a.trimLeft&&Qi(t[s-1],e.greedy),qs(a)&&("raw"===a.name?i=!0:"endraw"===a.name&&(i=!1)),!i&&a.trimRight&&Wi(t[s+1],e.greedy))}}(e,t),e}readTopLevelToken(t){const{tagDelimiterLeft:e,outputDelimiterLeft:i}=t;return this.rawBeginAt>-1?this.readEndrawOrRawContent(t):this.match(e)?this.readTagToken(t):this.match(i)?this.readOutputToken(t):this.readHTMLToken([e,i])}readHTMLToken(t){const e=this.p;for(;this.p<this.N&&!t.some(t=>this.match(t));)++this.p;return new ni(this.input,e,this.p,this.file)}readTagToken(t){const{file:e,input:i}=this,s=this.p;if(-1===this.readToDelimiter(t.tagDelimiterRight))throw this.error(`tag ${this.snapshot(s)} not closed`,s);const a=new ai(i,s,this.p,t,e);return"raw"===a.name&&(this.rawBeginAt=s),a}readToDelimiter(t,e=!1){for(this.skipBlank();this.p<this.N;)if(e&&8&this.peekType())this.readQuoted();else if(++this.p,this.rmatch(t))return this.p;return-1}readOutputToken(t=Ji){const{file:e,input:i}=this,{outputDelimiterRight:s}=t,a=this.p;if(-1===this.readToDelimiter(s,!0))throw this.error(`output ${this.snapshot(a)} not closed`,a);return new ri(i,a,this.p,t,e)}readEndrawOrRawContent(t){const{tagDelimiterLeft:e,tagDelimiterRight:i}=t,s=this.p;let a=this.readTo(e)-e.length;for(;this.p<this.N;)if("endraw"===this.readIdentifier().getText())for(;this.p<=this.N;){if(this.rmatch(i)){const e=this.p;return s===a?(this.rawBeginAt=-1,new ai(this.input,s,e,t,this.file)):(this.p=a,new ni(this.input,s,a,this.file))}if(this.rmatch(e))break;this.p++}else a=this.readTo(e)-e.length;throw this.error(`raw ${this.snapshot(this.rawBeginAt)} not closed`,s)}readLiquidTagTokens(t=Ji){const e=[];for(;this.p<this.N;){const i=this.readLiquidTagToken(t);i&&e.push(i)}return e}readLiquidTagToken(t){if(this.skipBlank(),this.end())return;const e=this.p;this.readToDelimiter("\n");const i=this.p;return new wi(this.input,e,i,t,this.file)}error(t,e=this.p){return new ue(t,new li(this.input,e,this.N,this.file))}assert(t,e,i){if(!t)throw this.error("function"==typeof e?e():e,i)}snapshot(t=this.p){return JSON.stringify((e=this.input.slice(t,this.N),i=32,e.length>i?e.slice(0,i-3)+"...":e));var e,i}readWord(){return this.readIdentifier()}readIdentifier(){this.skipBlank();const t=this.p;for(;!this.end()&&_e(this.peek());)++this.p;return new li(this.input,t,this.p,this.file)}readNonEmptyIdentifier(){const t=this.readIdentifier();return t.size()?t:void 0}readTagName(){return this.skipBlank(),"#"===this.input[this.p]?this.input.slice(this.p,++this.p):this.readIdentifier().getText()}readHashes(t){const e=[];for(;;){const i=this.readHash(t);if(!i)return e;e.push(i)}}readHash(t){this.skipBlank(),","===this.peek()&&++this.p;const e=this.p,i=this.readNonEmptyIdentifier();if(!i)return;let s;this.skipBlank();const a=Rt(t)?t:t?"=":":";return this.peek()===a&&(++this.p,s=this.readValue()),new vi(this.input,e,this.p,i,s,this.file)}remaining(){return this.input.slice(this.p,this.N)}advance(t=1){this.p+=t}end(){return this.p>=this.N}read(){return this.input[this.p++]}readTo(t){for(;this.p<this.N;)if(++this.p,this.rmatch(t))return this.p;return-1}readValue(){this.skipBlank();const t=this.p,e=this.readLiteral()||this.readQuoted()||this.readRange()||this.readNumber(),i=this.readProperties(!e);return i.length?new hi(e,i,this.input,t,this.p):e}readScopeValue(){this.skipBlank();const t=this.p,e=this.readProperties();if(e.length)return new hi(void 0,e,this.input,t,this.p)}readProperties(t=!0){const e=[];for(;;){if("["===this.peek()){this.p++;const t=this.readValue()||new li(this.input,this.p,this.p,this.file);this.assert(-1!==this.readTo("]"),"[ not closed"),e.push(t);continue}if(t&&!e.length){const t=this.readNonEmptyIdentifier();if(t){e.push(t);continue}}if("."===this.peek()&&"."!==this.peek(1)){this.p++;const t=this.readNonEmptyIdentifier();if(!t)break;e.push(t);continue}break}return e}readNumber(){this.skipBlank();let t=!1,e=!1,i=0;for(64&this.peekType()&&i++;this.p+i<=this.N;)if(32&this.peekType(i))e=!0,i++;else{if("."!==this.peek(i)||"."===this.peek(i+1))break;if(t||!e)return;t=!0,i++}if(e&&!_e(this.peek(i))){const t=new oi(this.input,this.p,this.p+i,this.file);return this.advance(i),t}}readLiteral(){this.skipBlank();const t=this.matchTrie(this.literalTrie);if(-1===t)return;const e=new di(this.input,this.p,t,this.file);return this.p=t,e}readRange(){this.skipBlank();const t=this.p;if("("!==this.peek())return;++this.p;const e=this.readValueOrThrow();this.skipBlank(),this.assert("."===this.read()&&"."===this.read(),"invalid range syntax");const i=this.readValueOrThrow();return this.skipBlank(),this.assert(")"===this.read(),"invalid range syntax"),new _i(this.input,t,this.p,e,i,this.file)}readValueOrThrow(){const t=this.readValue();return this.assert(t,()=>`unexpected token ${this.snapshot()}, value expected`),t}readQuoted(){this.skipBlank();const t=this.p;if(!(8&this.peekType()))return;++this.p;let e=!1;for(;this.p<this.N&&(++this.p,this.input[this.p-1]!==this.input[t]||e);)e?e=!1:"\\"===this.input[this.p-1]&&(e=!0);return new xi(this.input,t,this.p,this.file)}*readFileNameTemplate(t){const{outputDelimiterLeft:e}=t,i=[","," ",e],s=new Set(i);for(;this.p<this.N&&!s.has(this.peek());)yield this.match(e)?this.readOutputToken(t):this.readHTMLToken(i)}match(t){for(let e=0;e<t.length;e++)if(t[e]!==this.input[this.p+e])return!1;return!0}rmatch(t){for(let e=0;e<t.length;e++)if(t[t.length-1-e]!==this.input[this.p-1-e])return!1;return!0}peekType(t=0){return this.p+t>=this.N?0:xe[this.input.charCodeAt(this.p+t)]}peek(t=0){return this.p+t>=this.N?"":this.input[this.p+t]}skipBlank(){for(;4&this.peekType();)++this.p}}class Xi{constructor(t,e){this.handlers={},this.stopRequested=!1,this.tokens=t,this.parseToken=e}on(t,e){return this.handlers[t]=e,this}trigger(t,e){const i=this.handlers[t];return!!i&&(i.call(this,e),!0)}start(){let t;for(this.trigger("start");!this.stopRequested&&(t=this.tokens.shift());){if(this.trigger("token",t))continue;if(qs(t)&&this.trigger(`tag:${t.name}`,t))continue;const e=this.parseToken(t,this.tokens);this.trigger("template",e)}return this.stopRequested||this.trigger("end"),this}stop(){return this.stopRequested=!0,this}}class Zi{constructor(t){this.token=t}}class ts extends Zi{constructor(t,e,i){super(t),this.name=t.name,this.liquid=i,this.tokenizer=t.tokenizer}}class es{constructor(t,e){this.hash={};const i=t instanceof Yi?t:new Yi(t,{});for(const s of i.readHashes(e))this.hash[s.name.content]=s.value}*render(t){const e={};for(const i of Object.keys(this.hash))e[i]=void 0===this.hash[i]||(yield Ei(this.hash[i],t));return e}}function is(t){return Wt(t)}class ss{constructor(t,e,i){this.token=t,this.name=t.name,this.handler=Nt(e)?e:Nt(null==e?void 0:e.handler)?e.handler:ae,this.raw=!Nt(e)&&!!(null==e?void 0:e.raw),this.args=t.args,this.liquid=i}*render(t,e){const i=[];for(const s of this.args)is(s)?i.push([s[0],yield Ei(s[1],e)]):i.push(yield Ei(s,e));return yield this.handler.apply({context:e,token:this.token,liquid:this.liquid},[t,...i])}}class as{constructor(t,e){this.filters=[];const i="string"==typeof t?new Yi(t,e.options.operators).readFilteredValue():t;this.initial=i.initial,this.filters=i.filters.map(t=>new ss(t,this.getFilter(e,t.name),e))}*value(t,e){e=e||t.opts.lenientIf&&this.filters.length>0&&"default"===this.filters[0].name;let i=yield this.initial.evaluate(t,e);for(const s of this.filters)i=yield s.render(i,t);return i}getFilter(t,e){const i=t.filters[e];return we(i||!t.options.strictFilters,()=>`undefined filter: ${e}`),i}}class rs extends Zi{constructor(t,e){var i;super(t);const s=new Yi(t.input,e.options.operators,t.file,t.contentRange);this.value=new as(s.readFilteredValue(),e);const a=this.value.filters,r=e.options.outputEscape;if(!(null===(i=a[a.length-1])||void 0===i?void 0:i.raw)&&r){const t=new gi(toString.call(r),[],"",0,0);a.push(new ss(t,r,e))}}*render(t,e){const i=yield this.value.value(t,!1);e.write(i)}*arguments(){yield this.value}}class ns extends Zi{constructor(t){super(t),this.str=t.getContent()}*render(t,e){e.write(this.str)}}class os{constructor(t,e){this.segments=t,this.location=e}toString(){return bs(this.segments,!0)}toArray(){return Array.from(function*t(...e){for(const i of e)i instanceof os?yield Array.from(t(...i.segments)):yield i}(...this.segments))}}class ls{constructor(){this.map=new Map}get(t){const e=bs([t.segments[0]]);return this.map.has(e)||this.map.set(e,[]),this.map.get(e)}has(t){return this.map.has(bs([t.segments[0]]))}push(t){this.get(t).push(t)}asObject(){return Object.fromEntries(this.map)}}const ds={partials:!0};function*cs(t,e,i){const s=new ls,a=new ls,r=new ls,n=new hs(new Set),o=new Set;function l(t,e){s.push(t);const i=e.alias(t);if(void 0!==i){const t=i.segments[0];Rt(t)&&!n.has(t)&&a.push(i)}else{const i=t.segments[0];Rt(i)&&!e.has(i)&&a.push(t)}for(const s of t.segments)s instanceof os&&l(s,e)}function*d(t,s){if(t.arguments)for(const e of t.arguments())for(const t of gs(e))l(t,s);if(t.localScope)for(const e of t.localScope()){s.add(e.content),s.deleteAlias(e.content);const[t,i]=e.getPosition();r.push(new os([e.content],{row:t,col:i,file:e.file}))}if(t.children)if(t.partialScope){const a=t.partialScope();if(void 0===a){for(const a of yield t.children(e,i))yield d(a,s);return}if(o.has(a.name))return;const r=new Set,n=a.isolated?new hs(r):s.push(r);for(const t of a.scope)if(Rt(t))r.add(t);else{const[e,i]=t;r.add(e);const s=Array.from(gs(i));s.length&&n.setAlias(e,s[0].segments)}for(const s of yield t.children(e,i))yield d(s,n),o.add(a.name);n.pop()}else{t.blockScope&&s.push(new Set(t.blockScope()));for(const a of yield t.children(e,i))yield d(a,s);t.blockScope&&s.pop()}}for(const c of t)yield d(c,n);return{variables:s.asObject(),globals:a.asObject(),locals:r.asObject()}}function ps(t,e={}){return Re(cs(t,Object.assign(Object.assign({},ds),e).partials,!1))}function us(t,e={}){return Ne(cs(t,Object.assign(Object.assign({},ds),e).partials,!0))}class hs{constructor(t){this.stack=[{names:t,aliases:new Map}]}has(t){for(const e of this.stack)if(e.names.has(t))return!0;return!1}push(t){return this.stack.push({names:t,aliases:new Map}),this}pop(){var t;return null===(t=this.stack.pop())||void 0===t?void 0:t.names}add(t){this.stack[0].names.add(t)}alias(t){const e=t.segments[0];if(!Rt(e))return;const i=this.getAlias(e);return void 0!==i?new os([...i,...t.segments.slice(1)],t.location):void 0}setAlias(t,e){this.stack[this.stack.length-1].aliases.set(t,e)}deleteAlias(t){this.stack[this.stack.length-1].aliases.delete(t)}getAlias(t){for(const e of this.stack){if(e.aliases.has(t))return e.aliases.get(t);if(e.names.has(t))return}}}function*gs(t){Is(t)?yield*vs(t):t instanceof as&&(yield*function*(t){for(const e of t.initial.postfix)Is(e)&&(yield*vs(e));for(const e of t.filters)for(const t of e.args)is(t)&&t[1]?yield*vs(t[1]):Is(t)&&(yield*vs(t))}(t))}function*vs(t){Ps(t)?(yield*vs(t.lhs),yield*vs(t.rhs)):js(t)&&(yield ms(t))}function ms(t){const e=[];let i=t.file;const s=t.props[0];i=i||s.file,Os(s)||zs(s)||Ls(s)?e.push(s.content):js(s)&&e.push(...ms(s).segments);for(const n of t.props.slice(1))i=i||n.file,Os(n)||zs(n)||Ls(n)?e.push(n.content):js(n)&&e.push(ms(n));const[a,r]=t.getPosition();return new os(e,{row:a,col:r,file:i})}const fs=/^[\u0080-\uFFFFa-zA-Z_][\u0080-\uFFFFa-zA-Z0-9_-]*$/;function bs(t,e=!1){const i=[],s=t[0];Rt(s)&&(!e||s.match(fs)?i.push(`${s}`):i.push(`['${s}']`));for(const a of t.slice(1))a instanceof os?i.push(`[${bs(a.segments)}]`):Rt(a)?a.match(fs)?i.push(`.${a}`):i.push(`['${a}']`):i.push(`[${a}]`);return i.join("")}var ys,xs,_s,ws,ks,$s;(xs=ys||(ys={})).Partials="partials",xs.Layouts="layouts",xs.Root="root";class Ss{constructor(t){if(this.options=t,t.relativeReference){const e=t.fs.sep;we(e,"`fs.sep` is required for relative reference");const i=new RegExp(["."+e,".."+e,"./","../"].map(t=>t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")).join("|"));this.shouldLoadRelative=t=>i.test(t)}else this.shouldLoadRelative=t=>!1;this.contains=this.options.fs.contains||(()=>!0)}*lookup(t,e,i,s){const{fs:a}=this.options,r=this.options[e];for(const n of this.candidates(t,r,s,e!==ys.Root))if(i?a.existsSync(n):yield a.exists(n))return n;throw this.lookupError(t,r)}*candidates(t,e,i,s){const{fs:a,extname:r}=this.options;if(this.shouldLoadRelative(t)&&i){const n=a.resolve(this.dirname(i),t,r);for(const t of e)if(!s||this.contains(t,n)){yield n;break}}for(const n of e){const e=a.resolve(n,t,r);s&&!this.contains(n,e)||(yield e)}if(void 0!==a.fallback){const e=a.fallback(t);void 0!==e&&(yield e)}}dirname(t){const e=this.options.fs;return we(e.dirname,"`fs.dirname` is required for relative reference"),e.dirname(t)}lookupError(t,e){const i=new Error("ENOENT");return i.message=`ENOENT: Failed to lookup "${t}" in "${e}"`,i.code="ENOENT",i}}class Ts{constructor(t){this.liquid=t,this.cache=this.liquid.options.cache,this.fs=this.liquid.options.fs,this.parseFile=this.cache?this._parseFileCached:this._parseFile,this.loader=new Ss(this.liquid.options),this.parseLimit=new ii("parse length",t.options.parseLimit)}parse(t,e){t=String(t),this.parseLimit.use(t.length);const i=new Yi(t,this.liquid.options.operators,e).readTopLevelTokens(this.liquid.options);return this.parseTokens(i)}parseTokens(t){let e;const i=[],s=[];for(;e=t.shift();)try{i.push(this.parseToken(e,t))}catch(a){if(!this.liquid.options.catchAllErrors)throw a;s.push(a)}if(s.length)throw new ve(s);return i}parseToken(t,e){try{if(qs(t)){const i=this.liquid.tags[t.name];return we(i,`tag "${t.name}" not found`),new i(t,e,this.liquid,this)}return Rs(t)===_s.Output?new rs(t,this.liquid):new ns(t)}catch(i){if(pe.is(i))throw i;throw new he(i,t)}}parseStream(t){return new Xi(t,(t,e)=>this.parseToken(t,e))}*_parseFileCached(t,e,i=ys.Root,s){const a=this.cache,r=this.loader.shouldLoadRelative(t)?s+","+t:i+":"+t,n=yield a.read(r);if(n)return n;const o=this._parseFile(t,e,i,s),l=e?yield o:Re(o);a.write(r,l);try{return yield l}catch(d){throw a.remove(r),d}}*_parseFile(t,e,i=ys.Root,s){const a=yield this.loader.lookup(t,i,e,s);return this.parse(e?this.fs.readFileSync(a):yield this.fs.readFile(a),a)}}function Cs(t){return!!(Rs(t)&_s.Delimited)}function Es(t){return Rs(t)===_s.Operator}function As(t){return Rs(t)===_s.HTML}function qs(t){return Rs(t)===_s.Tag}function Os(t){return Rs(t)===_s.Quoted}function zs(t){return Rs(t)===_s.Number}function js(t){return Rs(t)===_s.PropertyAccess}function Ls(t){return Rs(t)===_s.Word}function Ps(t){return Rs(t)===_s.Range}function Is(t){return(1667&Rs(t))>0}function Rs(t){return t?t.kind:-1}(ws=_s||(_s={}))[ws.Number=1]="Number",ws[ws.Literal=2]="Literal",ws[ws.Tag=4]="Tag",ws[ws.Output=8]="Output",ws[ws.HTML=16]="HTML",ws[ws.Filter=32]="Filter",ws[ws.Hash=64]="Hash",ws[ws.PropertyAccess=128]="PropertyAccess",ws[ws.Word=256]="Word",ws[ws.Range=512]="Range",ws[ws.Quoted=1024]="Quoted",ws[ws.Operator=2048]="Operator",ws[ws.FilteredValue=4096]="FilteredValue",ws[ws.Delimited=12]="Delimited";class Ns{constructor(t={},e=Ji,i={},{memoryLimit:s,renderLimit:a}={}){var r,n,o,l,d;this.scopes=[{}],this.registers={},this.breakCalled=!1,this.continueCalled=!1,this.sync=!!i.sync,this.opts=e,this.globals=null!==(r=i.globals)&&void 0!==r?r:e.globals,this.environments=te(t)?t:Object(t),this.strictVariables=null!==(n=i.strictVariables)&&void 0!==n?n:this.opts.strictVariables,this.ownPropertyOnly=null!==(o=i.ownPropertyOnly)&&void 0!==o?o:e.ownPropertyOnly,this.memoryLimit=null!=s?s:new ii("memory alloc",null!==(l=i.memoryLimit)&&void 0!==l?l:e.memoryLimit),this.renderLimit=null!=a?a:new ii("template render",Si().now()+(null!==(d=i.renderLimit)&&void 0!==d?d:e.renderLimit))}getRegister(t){return this.registers[t]=this.registers[t]||{}}setRegister(t,e){return this.registers[t]=e}saveRegister(...t){return t.map(t=>[t,this.getRegister(t)])}restoreRegister(t){return t.forEach(([t,e])=>this.setRegister(t,e))}getAll(){return[this.globals,this.environments,...this.scopes].reduce((t,e)=>Pe(t,e),{})}get(t){return this.getSync(t)}getSync(t){return Ne(this._get(t))}*_get(t){const e=this.findScope(t[0]);return yield this._getFromScope(e,t)}getFromScope(t,e){return Ne(this._getFromScope(t,e))}*_getFromScope(t,e,i=this.strictVariables){Rt(e)&&(e=e.split("."));for(let s=0;s<e.length;s++)if(t=yield this.readProperty(t,e[s]),i&&Qt(t))throw new fe(e.slice(0,s+1).join("."));return t}push(t){return this.scopes.push(t)}pop(){return this.scopes.pop()}bottom(){return this.scopes[0]}spawn(t={}){return new Ns(t,this.opts,{sync:this.sync,globals:this.globals,strictVariables:this.strictVariables},{renderLimit:this.renderLimit,memoryLimit:this.memoryLimit})}findScope(t){for(let e=this.scopes.length-1;e>=0;e--){const i=this.scopes[e];if(t in i)return i}return t in this.environments?this.environments:this.globals}readProperty(t,e){if(t=Gt(t),e=Bt(e),Kt(t))return t;if(Wt(t)&&e<0)return t[t.length+ +e];const i=function(t,e,i){return!i||It.call(t,e)||t instanceof jt?t[e]:void 0}(t,e,this.ownPropertyOnly);return void 0===i&&t instanceof jt?t.liquidMethodMissing(e,this):Nt(i)?i.call(t):"size"===e?function(t){if(It.call(t,"size")||void 0!==t.size)return t.size;if(Wt(t)||Rt(t))return t.length;if("object"==typeof t)return Object.keys(t).length}(t):"first"===e?function(t){return Wt(t)?t[0]:t.first}(t):"last"===e?function(t){return Wt(t)?t[t.length-1]:t.last}(t):i}}($s=ks||(ks={}))[$s.OUTPUT=0]="OUTPUT",$s[$s.STORE=1]="STORE";const Fs=oe(Math.abs),Ds=oe(Math.max),Ms=oe(Math.min),Hs=oe(Math.ceil),Us=oe((t,e,i=!1)=>i?Math.floor(t/e):t/e),Bs=oe(Math.floor),Vs=oe((t,e)=>t-e),Js=oe((t,e)=>t+e),Gs=oe((t,e)=>t%e),Ks=oe((t,e)=>t*e);var Qs=Object.freeze({__proto__:null,abs:Fs,at_least:Ds,at_most:Ms,ceil:Hs,divided_by:Us,floor:Bs,minus:Vs,plus:Js,modulo:Gs,times:Ks,round:function(t,e=0){t=Vt(t),e=Vt(e);const i=Math.pow(10,e);return Math.round(t*i)/i}});const Ws=/[^\p{M}\p{L}\p{Nd}]+/gu,Ys={raw:/\s+/g,default:Ws,pretty:/[^\p{M}\p{L}\p{Nd}._~!$&'()+,;=@]+/gu,ascii:/[^A-Za-z0-9]+/g,latin:Ws,none:null};var Xs=Object.freeze({__proto__:null,url_decode:t=>decodeURIComponent(Mt(t)).replace(/\+/g," "),url_encode:t=>encodeURIComponent(Mt(t)).replace(/%20/g,"+"),cgi_escape:t=>encodeURIComponent(Mt(t)).replace(/%20/g,"+").replace(/[!'()*]/g,t=>"%"+t.charCodeAt(0).toString(16).toUpperCase()),uri_escape:t=>encodeURI(Mt(t)).replace(/%5B/g,"[").replace(/%5D/g,"]"),slugify:function(t,e="default",i=!1){t=Mt(t);const s=Ys[e];return s&&("latin"===e&&(t=function(t){return t.replace(/[àáâãäå]/g,"a").replace(/[æ]/g,"ae").replace(/[ç]/g,"c").replace(/[èéêë]/g,"e").replace(/[ìíîï]/g,"i").replace(/[ð]/g,"d").replace(/[ñ]/g,"n").replace(/[òóôõöø]/g,"o").replace(/[ùúûü]/g,"u").replace(/[ýÿ]/g,"y").replace(/[ß]/g,"ss").replace(/[œ]/g,"oe").replace(/[þ]/g,"th").replace(/[ẞ]/g,"SS").replace(/[Œ]/g,"OE").replace(/[Þ]/g,"TH")}(t)),t=t.replace(s,"-").replace(/^-|-$/g,"")),i?t:t.toLowerCase()}});const Zs=ne(function(t,e){const i=Ut(t),s=Kt(e)?" ":Mt(e),a=i.length*(1+s.length);return this.context.memoryLimit.use(a),i.join(s)}),ta=ne(t=>Yt(t)?Zt(t):""),ea=ne(t=>Yt(t)?t[0]:""),ia=ne(function(t){const e=Ut(t);return this.context.memoryLimit.use(e.length),[...e].reverse()});function sa(t,e=[]){const i=Ut(t),s=Ut(e);return this.context.memoryLimit.use(i.length+s.length),i.concat(s)}function aa(t){return this.context.opts.jekyllWhere?e=>{return $e.is(t)?ji(e,t):Wt(e)?(i=t,e.some(t=>ji(t,i))):ji(e,t);var i}:void 0===t?t=>qi(t,this.context):e=>ji(e,t)}function*ra(t,e,i,s){const a=[];e=Ut(e),this.context.memoryLimit.use(e.length);const r=new Yi(Mt(i)).readScopeValue();for(const o of e)a.push(yield Ei(r,this.context.spawn(o)));const n=aa.call(this,s);return e.filter((e,i)=>n(a[i])===t)}function*na(t,e,i,s){const a=[],r=new as(Mt(s),this.liquid),n=Ut(e);this.context.memoryLimit.use(n.length);for(const o of n){this.context.push({[i]:o});const e=yield r.value(this.context);this.context.pop(),e===t&&a.push(o)}return a}function*oa(t,e,i){const s=new Yi(Mt(e)).readScopeValue(),a=Ut(t),r=aa.call(this,i);for(let n=0;n<a.length;n++){if(r(yield Ei(s,this.context.spawn(a[n]))))return[n,a[n]]}}function*la(t,e,i){const s=new as(Mt(i),this.liquid),a=Ut(t);for(let r=0;r<a.length;r++){this.context.push({[e]:a[r]});const t=yield s.value(this.context);if(this.context.pop(),t)return[r,a[r]]}}var da=Object.freeze({__proto__:null,join:Zs,last:ta,first:ea,reverse:ia,sort:function*(t,e){const i=[],s=Ut(t);this.context.memoryLimit.use(s.length);for(const a of s)i.push([a,e?yield this.context._getFromScope(a,Mt(e).split("."),!1):a]);return i.sort((t,e)=>{const i=t[1],s=e[1];return i<s?-1:i>s?1:0}).map(t=>t[0])},sort_natural:function(t,e){const i=Mt(e),s=void 0===e?re:(t,e)=>re(t[i],e[i]),a=Ut(t);return this.context.memoryLimit.use(a.length),[...a].sort(s)},size:t=>t&&t.length||0,map:function*(t,e){const i=[],s=Ut(t);this.context.memoryLimit.use(s.length);for(const a of s)i.push(yield this.context._getFromScope(a,Mt(e),!1));return i},sum:function*(t,e){let i=0;const s=Ut(t);for(const a of s){const t=Number(e?yield this.context._getFromScope(a,Mt(e),!1):a);i+=Number.isNaN(t)?0:t}return i},compact:function(t){const e=Ut(t);return this.context.memoryLimit.use(e.length),e.filter(t=>!Kt(Bt(t)))},concat:sa,push:function(t,e){return sa.call(this,t,[e])},unshift:function(t,e){const i=Ut(t);this.context.memoryLimit.use(i.length);const s=[...i];return s.unshift(e),s},pop:function(t){const e=[...Ut(t)];return e.pop(),e},shift:function(t){const e=Ut(t);this.context.memoryLimit.use(e.length);const i=[...e];return i.shift(),i},slice:function(t,e,i=1){return Kt(t=Bt(t))?[]:(Wt(t)||(t=Mt(t)),e=e<0?t.length+e:e,this.context.memoryLimit.use(i),t.slice(e,e+i))},where:function*(t,e,i){return yield*ra.call(this,!0,t,e,i)},reject:function*(t,e,i){return yield*ra.call(this,!1,t,e,i)},where_exp:function*(t,e,i){return yield*na.call(this,!0,t,e,i)},reject_exp:function*(t,e,i){return yield*na.call(this,!1,t,e,i)},group_by:function*(t,e){const i=new Map;t=Ht(t);const s=new Yi(Mt(e)).readScopeValue();this.context.memoryLimit.use(t.length);for(const a of t){const t=yield Ei(s,this.context.spawn(a));i.has(t)||i.set(t,[]),i.get(t).push(a)}return[...i.entries()].map(([t,e])=>({name:t,items:e}))},group_by_exp:function*(t,e,i){const s=new Map,a=new as(Mt(i),this.liquid);t=Ht(t),this.context.memoryLimit.use(t.length);for(const r of t){this.context.push({[e]:r});const t=yield a.value(this.context);this.context.pop(),s.has(t)||s.set(t,[]),s.get(t).push(r)}return[...s.entries()].map(([t,e])=>({name:t,items:e}))},has:function*(t,e,i){return!!(yield*oa.call(this,t,e,i))},has_exp:function*(t,e,i){return!!(yield*la.call(this,t,e,i))},find_index:function*(t,e,i){const s=yield*oa.call(this,t,e,i);return s?s[0]:void 0},find_index_exp:function*(t,e,i){const s=yield*la.call(this,t,e,i);return s?s[0]:void 0},find:function*(t,e,i){const s=yield*oa.call(this,t,e,i);return s?s[1]:void 0},find_exp:function*(t,e,i){const s=yield*la.call(this,t,e,i);return s?s[1]:void 0},uniq:function(t){return t=Ut(t),this.context.memoryLimit.use(t.length),[...new Set(t)]},sample:function(t,e=1){if(Kt(t=Bt(t)))return[];Wt(t)||(t=Mt(t)),this.context.memoryLimit.use(e);const i=[...t].sort(()=>Math.random()-.5);return 1===e?i[0]:i.slice(0,e)}});function ca(t,e,i){var s,a,r;const n=(null!==(s=null==t?void 0:t.length)&&void 0!==s?s:0)+(null!==(a=null==e?void 0:e.length)&&void 0!==a?a:0)+(null!==(r=null==i?void 0:i.length)&&void 0!==r?r:0);this.context.memoryLimit.use(n);const o=ua(t,this.context.opts,i);return o?Ge(o,e=Kt(e=Bt(e))?this.context.opts.dateFormat:Mt(e)):t}function pa(t,e,i,s){const a=ua(t,this.context.opts);if(!a)return t;if("ordinal"===i){const t=a.getDate();return Ge(a,"US"===s?`${e} ${t}%q, %Y`:`${t}%q ${e} %Y`)}return Ge(a,`%d ${e} %Y`)}function ua(t,e,i){let s;const a=null!=i?i:e.timezoneOffset,r=e.locale;return s="now"===(t=Bt(t))||"today"===t?new ei(Date.now(),r,a):Jt(t)?new ei(1e3*t,r,a):Rt(t)?/^\d+$/.test(t)?new ei(1e3*+t,r,a):e.preserveTimezones&&void 0===i?ei.createDateFixedToTimezone(t,r):new ei(t,r,a):new ei(t,r,a),s.valid()?s:void 0}var ha=Object.freeze({__proto__:null,date:ca,date_to_xmlschema:function(t){return ca.call(this,t,"%Y-%m-%dT%H:%M:%S%:z")},date_to_rfc822:function(t){return ca.call(this,t,"%a, %d %b %Y %H:%M:%S %z")},date_to_string:function(t,e,i){return pa.call(this,t,"%b",e,i)},date_to_long_string:function(t,e,i){return pa.call(this,t,"%B",e,i)}});const ga=/[\u4E00-\u9FFF\uF900-\uFAFF\u3400-\u4DBF\u3040-\u309F\u30A0-\u30FF\uAC00-\uD7AF]/gu,va=/[^\u4E00-\u9FFF\uF900-\uFAFF\u3400-\u4DBF\u3040-\u309F\u30A0-\u30FF\uAC00-\uD7AF\s]+/gu;var ma=Object.freeze({__proto__:null,append:function(t,e){we(2===arguments.length,"append expect 2 arguments");const i=Mt(t),s=Mt(e);return this.context.memoryLimit.use(i.length+s.length),i+s},prepend:function(t,e){we(2===arguments.length,"prepend expect 2 arguments");const i=Mt(t),s=Mt(e);return this.context.memoryLimit.use(i.length+s.length),s+i},lstrip:function(t,e){const i=Mt(t);return this.context.memoryLimit.use(i.length),e?(e=le(Mt(e)),i.replace(new RegExp(`^[${e}]+`,"g"),"")):i.replace(/^\s+/,"")},downcase:function(t){const e=Mt(t);return this.context.memoryLimit.use(e.length),e.toLowerCase()},upcase:function(t){const e=Mt(t);return this.context.memoryLimit.use(e.length),Mt(e).toUpperCase()},remove:function(t,e){const i=Mt(t);return this.context.memoryLimit.use(i.length),i.split(Mt(e)).join("")},remove_first:function(t,e){const i=Mt(t);return this.context.memoryLimit.use(i.length),i.replace(Mt(e),"")},remove_last:function(t,e){const i=Mt(t);this.context.memoryLimit.use(i.length);const s=Mt(e),a=i.lastIndexOf(s);return-1===a?i:i.substring(0,a)+i.substring(a+s.length)},rstrip:function(t,e){return t=Mt(t),this.context.memoryLimit.use(t.length),e?(e=le(Mt(e)),t.replace(new RegExp(`[${e}]+$`,"g"),"")):t.replace(/\s+$/,"")},split:function(t,e){const i=Mt(t);this.context.memoryLimit.use(i.length);const s=i.split(Mt(e));for(;s.length&&""===s[s.length-1];)s.pop();return s},strip:function(t,e){const i=Mt(t);return this.context.memoryLimit.use(i.length),e?(e=le(Mt(e)),i.replace(new RegExp(`^[${e}]+`,"g"),"").replace(new RegExp(`[${e}]+$`,"g"),"")):i.trim()},strip_newlines:function(t){const e=Mt(t);return this.context.memoryLimit.use(e.length),e.replace(/\r?\n/gm,"")},capitalize:function(t){return t=Mt(t),this.context.memoryLimit.use(t.length),t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()},replace:function(t,e,i){const s=Mt(t);return this.context.memoryLimit.use(s.length),s.split(Mt(e)).join(i)},replace_first:function(t,e,i){const s=Mt(t);return this.context.memoryLimit.use(s.length),s.replace(Mt(e),i)},replace_last:function(t,e,i){const s=Mt(t);this.context.memoryLimit.use(s.length);const a=Mt(e),r=s.lastIndexOf(a);if(-1===r)return s;const n=Mt(i);return s.substring(0,r)+n+s.substring(r+a.length)},truncate:function(t,e=50,i="..."){const s=Mt(t);return this.context.memoryLimit.use(s.length),s.length<=e?t:s.substring(0,e-i.length)+i},truncatewords:function(t,e=15,i="..."){const s=Mt(t);this.context.memoryLimit.use(s.length);const a=s.split(/\s+/);e<=0&&(e=1);let r=a.slice(0,e).join(" ");return a.length>=e&&(r+=i),r},normalize_whitespace:function(t){const e=Mt(t);return this.context.memoryLimit.use(e.length),e.replace(/\s+/g," ")},number_of_words:function(t,e){const i=Mt(t);if(this.context.memoryLimit.use(i.length),!(t=i.trim()))return 0;switch(e){case"cjk":return(t.match(ga)||[]).length+(t.match(va)||[]).length;case"auto":return ga.test(t)?t.match(ga).length+(t.match(va)||[]).length:t.split(/\s+/).length;default:return t.split(/\s+/).length}},array_to_sentence_string:function(t,e="and"){switch(this.context.memoryLimit.use(t.length),t.length){case 0:return"";case 1:return t[0];case 2:return`${t[0]} ${e} ${t[1]}`;default:return`${t.slice(0,-1).join(", ")}, ${e} ${t[t.length-1]}`}}});var fa=Object.freeze({__proto__:null,base64_encode:function(t){const e=Mt(t);return this.context.memoryLimit.use(e.length),function(t){return btoa(String.fromCharCode(...(new TextEncoder).encode(t)))}(e)},base64_decode:function(t){const e=Mt(t);return this.context.memoryLimit.use(e.length),function(t){return(new TextDecoder).decode(Uint8Array.from(atob(t),t=>t.charCodeAt(0)))}(e)}});const ba=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},Bi),Qs),Xs),da),ha),ma),fa),Fi);const ya=["offset","limit","reversed"];function xa(t,e,i){if(e.options.dynamicPartials){const e=t.readValue();if(t.assert(e,"illegal file path"),"none"===e.getText())return;if(Os(e)){return _a(i.parse(e.content))}return e}const s=[...t.readFileNameTemplate(e.options)],a=_a(i.parseTokens(s));return"none"===a?void 0:a}function _a(t){return 1===t.length&&As(t[0].token)?t[0].token.getContent():t}function*wa(t,e,i){return"string"==typeof t?t:Array.isArray(t)?i.renderer.renderTemplates(t,e):yield Ei(t,e)}class ka extends Te{constructor(t,e,i,s){super(t,i,s),this.length=t,this.cols=e}row(){return Math.floor(this.i/this.cols)+1}col0(){return this.i%this.cols}col(){return this.col0()+1}col_first(){return 0===this.col0()}col_last(){return this.col()===this.cols}}const $a={assign:class extends ts{constructor(t,e,i){super(t,e,i),this.identifier=this.tokenizer.readIdentifier(),this.key=this.identifier.content,this.tokenizer.assert(this.key,"expected variable name"),this.tokenizer.skipBlank(),this.tokenizer.assert("="===this.tokenizer.peek(),'expected "="'),this.tokenizer.advance(),this.value=new as(this.tokenizer.readFilteredValue(),this.liquid)}*render(t){t.bottom()[this.key]=yield this.value.value(t,this.liquid.options.lenientIf)}*arguments(){yield this.value}*localScope(){yield this.identifier}},for:class extends ts{constructor(t,e,i,s){super(t,e,i);const a=this.tokenizer.readIdentifier(),r=this.tokenizer.readIdentifier(),n=this.tokenizer.readValue();if(!a.size()||"in"!==r.content||!n)throw new Error(`illegal tag: ${t.getText()}`);let o;this.variable=a.content,this.collection=n,this.hash=new es(this.tokenizer,i.options.keyValueSeparator),this.templates=[],this.elseTemplates=[];const l=s.parseStream(e).on("start",()=>o=this.templates).on("tag:else",t=>{ke(t.args),o=this.elseTemplates}).on("tag:endfor",t=>{ke(t.args),l.stop()}).on("template",t=>o.push(t)).on("end",()=>{throw new Error(`tag ${t.getText()} not closed`)});l.start()}*render(t,e){const i=this.liquid.renderer;let s=Ht(yield Ei(this.collection,t));if(!s.length)return void(yield i.renderTemplates(this.elseTemplates,t,e));const a="continue-"+this.variable+"-"+this.collection.getText();t.push({continue:t.getRegister(a)});const r=yield this.hash.render(t);t.pop();s=(this.liquid.options.orderedFilterParameters?Object.keys(r).filter(t=>ya.includes(t)):ya.filter(t=>void 0!==r[t])).reduce((t,e)=>{return"offset"===e?(i=t,s=r.offset,i.slice(s)):"limit"===e?function(t,e){return t.slice(0,e)}(t,r.limit):function(t){return[...t].reverse()}(t);var i,s},s),t.setRegister(a,(r.offset||0)+s.length);const n={forloop:new Te(s.length,this.collection.getText(),this.variable)};t.push(n);for(const o of s){if(n[this.variable]=o,t.continueCalled=t.breakCalled=!1,yield i.renderTemplates(this.templates,t,e),t.breakCalled)break;n.forloop.next()}t.continueCalled=t.breakCalled=!1,t.pop()}*children(){const t=this.templates.slice();return this.elseTemplates&&t.push(...this.elseTemplates),t}*arguments(){yield this.collection;for(const t of Object.values(this.hash.hash))Is(t)&&(yield t)}blockScope(){return[this.variable,"forloop"]}},capture:class extends ts{constructor(t,e,i,s){for(super(t,e,i),this.templates=[],this.identifier=this.readVariable(),this.variable=this.identifier.content;e.length;){const t=e.shift();if(qs(t)&&"endcapture"===t.name)return;this.templates.push(s.parseToken(t,e))}throw new Error(`tag ${t.getText()} not closed`)}readVariable(){let t=this.tokenizer.readIdentifier();if(t.content)return t;if(t=this.tokenizer.readQuoted(),t)return t;throw this.tokenizer.error("invalid capture name")}*render(t){const e=this.liquid.renderer,i=yield e.renderTemplates(this.templates,t);t.bottom()[this.variable]=i}*children(){return this.templates}*localScope(){yield this.identifier}},case:class extends ts{constructor(t,e,i,s){super(t,e,i),this.branches=[],this.elseTemplates=[],this.value=new as(this.tokenizer.readFilteredValue(),this.liquid),this.elseTemplates=[];let a=[],r=0;const n=s.parseStream(e).on("tag:when",t=>{if(r>0)return;a=[];const e=[];for(;!t.tokenizer.end();)e.push(t.tokenizer.readValueOrThrow()),t.tokenizer.skipBlank(),","===t.tokenizer.peek()?t.tokenizer.readTo(","):t.tokenizer.readTo("or");this.branches.push({values:e,templates:a})}).on("tag:else",()=>{r++,a=this.elseTemplates}).on("tag:endcase",()=>n.stop()).on("template",t=>{a===this.elseTemplates&&1!==r||a.push(t)}).on("end",()=>{throw new Error(`tag ${t.getText()} not closed`)});n.start()}*render(t,e){const i=this.liquid.renderer,s=Bt(yield this.value.value(t,t.opts.lenientIf));let a=!1;for(const r of this.branches)for(const n of r.values){if(ji(s,yield Ei(n,t,t.opts.lenientIf))){yield i.renderTemplates(r.templates,t,e),a=!0;break}}a||(yield i.renderTemplates(this.elseTemplates,t,e))}*arguments(){yield this.value,yield*this.branches.flatMap(t=>t.values)}*children(){const t=this.branches.flatMap(t=>t.templates);return this.elseTemplates&&t.push(...this.elseTemplates),t}},comment:class extends ts{constructor(t,e,i){for(super(t,e,i);e.length;){const t=e.shift();if(qs(t)&&"endcomment"===t.name)return}throw new Error(`tag ${t.getText()} not closed`)}render(){}},include:class extends ts{constructor(t,e,i,s){super(t,e,i);const{tokenizer:a}=t;this.file=xa(a,this.liquid,s),this.currentFile=t.file;const r=a.p;"with"===a.readIdentifier().content?(a.skipBlank(),":"!==a.peek()?this.withVar=a.readValue():a.p=r):a.p=r,this.hash=new es(a,i.options.jekyllInclude||i.options.keyValueSeparator)}*render(t,e){const{liquid:i,hash:s,withVar:a}=this,{renderer:r}=i,n=yield wa(this.file,t,i);we(n,()=>`illegal file path "${n}"`);const o=t.saveRegister("blocks","blockMode");t.setRegister("blocks",{}),t.setRegister("blockMode",ks.OUTPUT);const l=yield s.render(t);a&&(l[n]=yield Ei(a,t));const d=yield i._parsePartialFile(n,t.sync,this.currentFile);t.push(t.opts.jekyllInclude?{include:l}:l),yield r.renderTemplates(d,t,e),t.pop(),t.restoreRegister(o)}*children(t,e){return t&&Rt(this.file)?yield this.liquid._parsePartialFile(this.file,e,this.currentFile):[]}partialScope(){if(Rt(this.file)){let t;return this.liquid.options.jekyllInclude?t=["include"]:(t=Object.keys(this.hash.hash),this.withVar&&t.push([this.file,this.withVar])),{name:this.file,isolated:!1,scope:t}}}*arguments(){yield*Object.values(this.hash.hash).filter(Is),Is(this.file)&&(yield this.file),Is(this.withVar)&&(yield this.withVar)}},render:class extends ts{constructor(t,e,i,s){super(t,e,i);const a=this.tokenizer;for(this.file=xa(a,this.liquid,s),this.currentFile=t.file;!a.end();){a.skipBlank();const t=a.p,e=a.readIdentifier();if(("with"===e.content||"for"===e.content)&&(a.skipBlank(),":"!==a.peek())){const t=a.readValue();if(t){const i=a.p;let s;"as"===a.readIdentifier().content?s=a.readIdentifier():a.p=i,this[e.content]={value:t,alias:s&&s.content},a.skipBlank(),","===a.peek()&&a.advance();continue}}a.p=t;break}this.hash=new es(a,i.options.keyValueSeparator)}*render(t,e){const{liquid:i,hash:s}=this,a=yield wa(this.file,t,i);we(a,()=>`illegal file path "${a}"`);const r=t.spawn(),n=r.bottom();if(Pe(n,yield s.render(t)),this.with){const{value:e,alias:i}=this.with;n[i||a]=yield Ei(e,t)}if(this.for){const{value:s,alias:o}=this.for,l=Ht(yield Ei(s,t));n.forloop=new Te(l.length,s.getText(),o);for(const t of l){n[o]=t;const s=yield i._parsePartialFile(a,r.sync,this.currentFile);yield i.renderer.renderTemplates(s,r,e),n.forloop.next()}}else{const t=yield i._parsePartialFile(a,r.sync,this.currentFile);yield i.renderer.renderTemplates(t,r,e)}}*children(t,e){return t&&Rt(this.file)?yield this.liquid._parsePartialFile(this.file,e,this.currentFile):[]}partialScope(){if(Rt(this.file)){const t=Object.keys(this.hash.hash);if(this.with){const{value:e,alias:i}=this.with;Rt(i)?t.push([i,e]):Rt(this.file)&&t.push([this.file,e])}if(this.for){const{value:e,alias:i}=this.for;Rt(i)?t.push([i,e]):Rt(this.file)&&t.push([this.file,e])}return{name:this.file,isolated:!0,scope:t}}}*arguments(){for(const t of Object.values(this.hash.hash))Is(t)&&(yield t);if(this.with){const{value:t}=this.with;Is(t)&&(yield t)}if(this.for){const{value:t}=this.for;Is(t)&&(yield t)}}},decrement:class extends ts{constructor(t,e,i){super(t,e,i),this.identifier=this.tokenizer.readIdentifier(),this.variable=this.identifier.content}render(t,e){const i=t.environments;Jt(i[this.variable])||(i[this.variable]=0),e.write(Mt(--i[this.variable]))}*localScope(){yield this.identifier}},increment:class extends ts{constructor(t,e,i){super(t,e,i),this.identifier=this.tokenizer.readIdentifier(),this.variable=this.identifier.content}render(t,e){const i=t.environments;Jt(i[this.variable])||(i[this.variable]=0);const s=i[this.variable];i[this.variable]++,e.write(Mt(s))}*localScope(){yield this.identifier}},cycle:class extends ts{constructor(t,e,i){super(t,e,i),this.candidates=[];const s=this.tokenizer.readValue();for(this.tokenizer.skipBlank(),s&&(":"===this.tokenizer.peek()?(this.group=s,this.tokenizer.advance()):this.candidates.push(s));!this.tokenizer.end();){const t=this.tokenizer.readValue();t&&this.candidates.push(t),this.tokenizer.readTo(",")}this.tokenizer.assert(this.candidates.length,()=>`empty candidates: "${t.getText()}"`)}*render(t,e){const i=`cycle:${yield Ei(this.group,t)}:`+this.candidates.join(","),s=t.getRegister("cycle");let a=s[i];void 0===a&&(a=s[i]=0);const r=this.candidates[a];return a=(a+1)%this.candidates.length,s[i]=a,yield Ei(r,t)}*arguments(){yield*this.candidates,this.group&&(yield this.group)}},if:class extends ts{constructor(t,e,i,s){super(t,e,i),this.branches=[];let a=[];s.parseStream(e).on("start",()=>this.branches.push({value:new as(t.tokenizer.readFilteredValue(),this.liquid),templates:a=[]})).on("tag:elsif",t=>{we(!this.elseTemplates,"unexpected elsif after else"),this.branches.push({value:new as(t.tokenizer.readFilteredValue(),this.liquid),templates:a=[]})}).on("tag:else",t=>{ke(t.args),we(!this.elseTemplates,"duplicated else"),a=this.elseTemplates=[]}).on("tag:endif",function(t){ke(t.args),this.stop()}).on("template",t=>a.push(t)).on("end",()=>{throw new Error(`tag ${t.getText()} not closed`)}).start()}*render(t,e){const i=this.liquid.renderer;for(const{value:s,templates:a}of this.branches){if(qi(yield s.value(t,t.opts.lenientIf),t))return void(yield i.renderTemplates(a,t,e))}yield i.renderTemplates(this.elseTemplates||[],t,e)}*children(){const t=this.branches.flatMap(t=>t.templates);return this.elseTemplates&&t.push(...this.elseTemplates),t}arguments(){return this.branches.map(t=>t.value)}},layout:class extends ts{constructor(t,e,i,s){super(t,e,i),this.file=xa(this.tokenizer,this.liquid,s),this.currentFile=t.file,this.args=new es(this.tokenizer,i.options.keyValueSeparator),this.templates=s.parseTokens(e)}*render(t,e){const{liquid:i,args:s,file:a}=this,{renderer:r}=i;if(void 0===a)return t.setRegister("blockMode",ks.OUTPUT),void(yield r.renderTemplates(this.templates,t,e));const n=yield wa(this.file,t,i);we(n,()=>`illegal file path "${n}"`);const o=yield i._parseLayoutFile(n,t.sync,this.currentFile);t.setRegister("blockMode",ks.STORE);const l=yield r.renderTemplates(this.templates,t),d=t.getRegister("blocks");void 0===d[""]&&(d[""]=(t,e)=>e.write(l)),t.setRegister("blockMode",ks.OUTPUT),t.push(yield s.render(t)),yield r.renderTemplates(o,t,e),t.pop()}*children(t){const e=this.templates.slice();return t&&Rt(this.file)&&e.push(...yield this.liquid._parsePartialFile(this.file,!0,this.currentFile)),e}*arguments(){for(const t of Object.values(this.args.hash))Is(t)&&(yield t);Is(this.file)&&(yield this.file)}partialScope(){if(Rt(this.file))return{name:this.file,isolated:!1,scope:Object.keys(this.args.hash)}}},block:class extends ts{constructor(t,e,i,s){super(t,e,i),this.templates=[];const a=/\w+/.exec(t.args);for(this.block=a?a[0]:"";e.length;){const t=e.shift();if(qs(t)&&"endblock"===t.name)return;const i=s.parseToken(t,e);this.templates.push(i)}throw new Error(`tag ${t.getText()} not closed`)}*render(t,e){const i=this.getBlockRender(t);t.getRegister("blockMode")===ks.STORE?t.getRegister("blocks")[this.block]=i:yield i(new qe,e)}getBlockRender(t){const{liquid:e,templates:i}=this,s=t.getRegister("blocks")[this.block],a=function*(s,a){t.push({block:s}),yield e.renderer.renderTemplates(i,t,a),t.pop()};return s?(t,e)=>s(new qe(e=>a(t,e)),e):a}*children(){return this.templates}blockScope(){return["block"]}},raw:class extends ts{constructor(t,e,i){for(super(t,e,i),this.tokens=[];e.length;){const t=e.shift();if(qs(t)&&"endraw"===t.name)return;this.tokens.push(t)}throw new Error(`tag ${t.getText()} not closed`)}render(){return this.tokens.map(t=>t.getText()).join("")}},tablerow:class extends ts{constructor(t,e,i,s){super(t,e,i);const a=this.tokenizer.readIdentifier();this.tokenizer.skipBlank();const r=this.tokenizer.readIdentifier(),n=this.tokenizer.readValue();if("in"!==r.content||!n)throw new Error(`illegal tag: ${t.getText()}`);let o;this.variable=a.content,this.collection=n,this.args=new es(this.tokenizer,i.options.keyValueSeparator),this.templates=[];const l=s.parseStream(e).on("start",()=>o=this.templates).on("tag:endtablerow",()=>l.stop()).on("template",t=>o.push(t)).on("end",()=>{throw new Error(`tag ${t.getText()} not closed`)});l.start()}*render(t,e){let i=Ht(yield Ei(this.collection,t));const s=yield this.args.render(t),a=s.offset||0,r=void 0===s.limit?i.length:s.limit;i=i.slice(a,a+r);const n=s.cols||i.length,o=this.liquid.renderer,l=new ka(i.length,n,this.collection.getText(),this.variable),d={tablerowloop:l};t.push(d);for(let c=0;c<i.length;c++,l.next())d[this.variable]=i[c],0===l.col0()&&(1!==l.row()&&e.write("</tr>"),e.write(`<tr class="row${l.row()}">`)),e.write(`<td class="col${l.col()}">`),yield o.renderTemplates(this.templates,t,e),e.write("</td>");i.length&&e.write("</tr>"),t.pop()}*children(){return this.templates}*arguments(){yield this.collection;for(const t of Object.values(this.args.hash))Is(t)&&(yield t)}blockScope(){return[this.variable,"tablerowloop"]}},unless:class extends ts{constructor(t,e,i,s){super(t,e,i),this.branches=[],this.elseTemplates=[];let a=[],r=0;s.parseStream(e).on("start",()=>this.branches.push({value:new as(t.tokenizer.readFilteredValue(),this.liquid),test:Oi,templates:a=[]})).on("tag:elsif",t=>{r>0?a=[]:this.branches.push({value:new as(t.tokenizer.readFilteredValue(),this.liquid),test:qi,templates:a=[]})}).on("tag:else",()=>{r++,a=this.elseTemplates}).on("tag:endunless",function(){this.stop()}).on("template",t=>{a===this.elseTemplates&&1!==r||a.push(t)}).on("end",()=>{throw new Error(`tag ${t.getText()} not closed`)}).start()}*render(t,e){const i=this.liquid.renderer;for(const{value:s,test:a,templates:r}of this.branches){if(a(yield s.value(t,t.opts.lenientIf),t))return void(yield i.renderTemplates(r,t,e))}yield i.renderTemplates(this.elseTemplates,t,e)}*children(){const t=this.branches.flatMap(t=>t.templates);return this.elseTemplates&&t.push(...this.elseTemplates),t}arguments(){return this.branches.map(t=>t.value)}},break:class extends ts{render(t,e){t.breakCalled=!0}},continue:class extends ts{render(t,e){t.continueCalled=!0}},echo:class extends ts{constructor(t,e,i){super(t,e,i),this.tokenizer.skipBlank(),this.tokenizer.end()||(this.value=new as(this.tokenizer.readFilteredValue(),this.liquid))}*render(t,e){if(!this.value)return;const i=yield this.value.value(t,!1);e.write(i)}*arguments(){this.value&&(yield this.value)}},liquid:class extends ts{constructor(t,e,i,s){super(t,e,i);const a=this.tokenizer.readLiquidTagTokens(this.liquid.options);this.templates=s.parseTokens(a)}*render(t,e){yield this.liquid.renderer.renderTemplates(this.templates,t,e)}*children(){return this.templates}},"#":class extends ts{constructor(t,e,i){if(super(t,e,i),-1!==t.args.search(/\n\s*[^#\s]/g))throw new Error("every line of an inline comment must start with a '#' character")}render(){}}};class Sa{constructor(t={}){this.renderer=new Ti,this.filters={},this.tags={},this.options=Gi(t),this.parser=new Ts(this),Xt($a,(t,e)=>this.registerTag(e,t)),Xt(ba,(t,e)=>this.registerFilter(e,t))}parse(t,e){return new Ts(this).parse(t,e)}_render(t,e,i){const s=e instanceof Ns?e:new Ns(e,this.options,i);return this.renderer.renderTemplates(t,s)}render(t,e,i){return Ie(this,0,void 0,function*(){return Re(this._render(t,e,Object.assign(Object.assign({},i),{sync:!1})))})}renderSync(t,e,i){return Ne(this._render(t,e,Object.assign(Object.assign({},i),{sync:!0})))}renderToNodeStream(t,e,i={}){const s=new Ns(e,this.options,i);return this.renderer.renderTemplatesToNodeStream(t,s)}_parseAndRender(t,e,i){const s=this.parse(t);return this._render(s,e,i)}parseAndRender(t,e,i){return Ie(this,0,void 0,function*(){return Re(this._parseAndRender(t,e,Object.assign(Object.assign({},i),{sync:!1})))})}parseAndRenderSync(t,e,i){return Ne(this._parseAndRender(t,e,Object.assign(Object.assign({},i),{sync:!0})))}_parsePartialFile(t,e,i){return new Ts(this).parseFile(t,e,ys.Partials,i)}_parseLayoutFile(t,e,i){return new Ts(this).parseFile(t,e,ys.Layouts,i)}_parseFile(t,e,i,s){return new Ts(this).parseFile(t,e,i,s)}parseFile(t,e){return Ie(this,0,void 0,function*(){return Re(new Ts(this).parseFile(t,!1,e))})}parseFileSync(t,e){return Ne(new Ts(this).parseFile(t,!0,e))}*_renderFile(t,e,i){const s=yield this._parseFile(t,i.sync,i.lookupType);return yield this._render(s,e,i)}renderFile(t,e,i){return Ie(this,0,void 0,function*(){return Re(this._renderFile(t,e,Object.assign(Object.assign({},i),{sync:!1})))})}renderFileSync(t,e,i){return Ne(this._renderFile(t,e,Object.assign(Object.assign({},i),{sync:!0})))}renderFileToNodeStream(t,e,i){return Ie(this,0,void 0,function*(){const s=yield this.parseFile(t);return this.renderToNodeStream(s,e,i)})}_evalValue(t,e){const i=new as(t,this),s=e instanceof Ns?e:new Ns(e,this.options);return i.value(s)}evalValue(t,e){return Ie(this,0,void 0,function*(){return Re(this._evalValue(t,e))})}evalValueSync(t,e){return Ne(this._evalValue(t,e))}registerFilter(t,e){this.filters[t]=e}registerTag(t,e){var i;this.tags[t]=Nt(e)?e:(i=e,class extends ts{constructor(t,e,s){super(t,e,s),Nt(i.parse)&&i.parse.call(this,t,e)}*render(t,e){const s=yield new es(this.token.args,t.opts.keyValueSeparator).render(t);return yield i.render.call(this,t,e,s)}})}plugin(t){return t.call(this,Sa)}express(){const t=this;let e=!0;return function(i,s,a){if(e){e=!1;const i=Ki(this.root);t.options.root.unshift(...i),t.options.layouts.unshift(...i),t.options.partials.unshift(...i)}t.renderFile(i,s).then(t=>a(null,t),a)}}analyze(t,e={}){return Ie(this,0,void 0,function*(){return ps(t,e)})}analyzeSync(t,e={}){return us(t,e)}parseAndAnalyze(t,e,i={}){return Ie(this,0,void 0,function*(){return ps(this.parse(t,e),i)})}parseAndAnalyzeSync(t,e,i={}){return us(this.parse(t,e),i)}variables(t,e={}){return Ie(this,0,void 0,function*(){const i=yield ps(Rt(t)?this.parse(t):t,e);return Object.keys(i.variables)})}variablesSync(t,e={}){const i=us(Rt(t)?this.parse(t):t,e);return Object.keys(i.variables)}fullVariables(t,e={}){return Ie(this,0,void 0,function*(){const i=yield ps(Rt(t)?this.parse(t):t,e);return Array.from(new Set(Object.values(i.variables).flatMap(t=>t.map(t=>String(t)))))})}fullVariablesSync(t,e={}){const i=us(Rt(t)?this.parse(t):t,e);return Array.from(new Set(Object.values(i.variables).flatMap(t=>t.map(t=>String(t)))))}variableSegments(t,e={}){return Ie(this,0,void 0,function*(){const i=yield ps(Rt(t)?this.parse(t):t,e);return Array.from(de(Object.values(i.variables).flatMap(t=>t.map(t=>t.toArray()))))})}variableSegmentsSync(t,e={}){const i=us(Rt(t)?this.parse(t):t,e);return Array.from(de(Object.values(i.variables).flatMap(t=>t.map(t=>t.toArray()))))}globalVariables(t,e={}){return Ie(this,0,void 0,function*(){const i=yield ps(Rt(t)?this.parse(t):t,e);return Object.keys(i.globals)})}globalVariablesSync(t,e={}){const i=us(Rt(t)?this.parse(t):t,e);return Object.keys(i.globals)}globalFullVariables(t,e={}){return Ie(this,0,void 0,function*(){const i=yield ps(Rt(t)?this.parse(t):t,e);return Array.from(new Set(Object.values(i.globals).flatMap(t=>t.map(t=>String(t)))))})}globalFullVariablesSync(t,e={}){const i=us(Rt(t)?this.parse(t):t,e);return Array.from(new Set(Object.values(i.globals).flatMap(t=>t.map(t=>String(t)))))}globalVariableSegments(t,e={}){return Ie(this,0,void 0,function*(){const i=yield ps(Rt(t)?this.parse(t):t,e);return Array.from(de(Object.values(i.globals).flatMap(t=>t.map(t=>t.toArray()))))})}globalVariableSegmentsSync(t,e={}){const i=us(Rt(t)?this.parse(t):t,e);return Array.from(de(Object.values(i.globals).flatMap(t=>t.map(t=>t.toArray()))))}}const Ta=new class{constructor(){this.context=null,this.flattenedContext=null,this.history=[],this.maxHistory=50,this.engine=new Sa({strictFilters:!1,strictVariables:!1,lenientIf:!0}),this._registerShopifyFilters()}_registerShopifyFilters(){this.engine.registerFilter("money",t=>"$"+(Number(t)/100).toFixed(2)),this.engine.registerFilter("money_without_currency",t=>(Number(t)/100).toFixed(2)),this.engine.registerFilter("money_with_currency",t=>{var e,i,s;const a=Number(t)/100,r=(null==(s=null==(i=null==(e=this.context)?void 0:e.objects)?void 0:i.shop)?void 0:s.currency)||"USD";return"$"+a.toFixed(2)+" "+r}),this.engine.registerFilter("type_of",t=>null==t?"nil":Array.isArray(t)?"array":typeof t),this.engine.registerFilter("json_pretty",t=>JSON.stringify(t,null,2)),this.engine.registerFilter("asset_url",t=>`/assets/${t}`),this.engine.registerFilter("img_url",(t,e="medium")=>"string"==typeof t?t:(null==t?void 0:t.src)||""),this.engine.registerFilter("handle",t=>String(t).toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")),this.engine.registerFilter("handleize",t=>String(t).toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")),this.engine.registerFilter("pluralize",(t,e,i)=>1===t?e:i||e+"s"),this.engine.registerFilter("within",(t,e)=>e&&e.url?`${e.url}${t}`:t),this.engine.registerFilter("link_to",(t,e,i="")=>`<a href="${e}" title="${i}">${t}</a>`),this.engine.registerFilter("link_to_tag",(t,e=null)=>`<a href="/collections/all/${t}">${t}</a>`),this.engine.registerFilter("link_to_vendor",t=>`<a href="/collections/vendors?q=${encodeURIComponent(t)}">${t}</a>`),this.engine.registerFilter("link_to_type",t=>`<a href="/collections/types?q=${encodeURIComponent(t)}">${t}</a>`),this.engine.registerFilter("highlight",(t,e)=>{if(!e)return t;const i=new RegExp(`(${e})`,"gi");return String(t).replace(i,"<strong>$1</strong>")}),this.engine.registerFilter("metafield_value",t=>t&&"object"==typeof t&&"value"in t?t.value:t)}setContext(t){this.context=t,this.flattenedContext=null}_buildLiquidContext(){var t,e,i,s;if(!this.context)return{};const a=mt.currentCart,r=ft.currentProduct,n={...this.context.objects||{},...a?{cart:a}:{},...r?{product:r}:{},template:null==(t=this.context.meta)?void 0:t.template,request:null==(e=this.context.meta)?void 0:e.request,theme:null==(i=this.context.meta)?void 0:i.theme,localization:null==(s=this.context.meta)?void 0:s.localization,settings:this.context.settings};if(this.context.metafields)for(const[o,l]of Object.entries(this.context.metafields))if(n[o]){const t={};for(const[e,i]of Object.entries(l)){t[e]={};for(const[s,a]of Object.entries(i))t[e][s]=(null==a?void 0:a.value)??a}n[o]={...n[o],metafields:t}}return n}async evaluate(t){if(!t||!t.trim())return{success:!1,error:"Empty expression",expression:t};const e=t.trim(),i=this._buildLiquidContext();try{if(/^[\w.\[\]0-9]+$/.test(e)&&!e.includes("{%")&&!e.includes("{{")&&!e.includes("|")){const t=this._resolvePath(e,i);return this.addToHistory(e),{success:!0,value:t,expression:e}}let t=e;e.includes("{%")||e.includes("{{")||(t=`{{ ${e} }}`);const s=await this.engine.parseAndRender(t,i);this.addToHistory(e);return{success:!0,value:this._parseResult(s.trim()),expression:e}}catch(s){return{success:!1,error:s.message,expression:e}}}_resolvePath(t,e){if(!e)return;const i=t.replace(/\[(\d+)\]/g,".$1").split(".").filter(t=>""!==t);let s=e;for(const a of i){if(null==s)return;s=s[a]}return s}_parseResult(t){if(""===t)return"";if(""===t||"nil"===t||"null"===t)return null;if("true"===t)return!0;if("false"===t)return!1;if(/^-?\d+(\.\d+)?$/.test(t))return Number(t);if(t.startsWith("[")&&t.endsWith("]")||t.startsWith("{")&&t.endsWith("}"))try{return JSON.parse(t)}catch{}return t}getCompletions(t){if(!this.context)return[];let e=t.replace(/^\{\{\s*/,"").replace(/\s*\}\}$/,"").trim();const i=e.match(/\{%\s*(\w+)?\s*$/);if(i)return this._getTagCompletions(i[1]||"");const s=e.lastIndexOf("|");if(-1!==s){const t=e.slice(s+1).trim();if(""===t||/^\w*$/.test(t))return this._getFilterCompletions(t)}const a=e.match(/^(.+\[\d+\])\.(\w*)$/);if(a){const t=a[1],e=a[2];return this._getDynamicCompletions(t,e)}const r=this._getAllPaths(),n=e.toLowerCase();return r.filter(t=>t.path.toLowerCase().startsWith(n)).slice(0,20).map(t=>({value:t.path,type:t.type,preview:t.preview}))}_getDynamicCompletions(t,e){const i=this._buildLiquidContext(),s=this._resolvePath(t,i);if(null==s||"object"!=typeof s)return[];const a=[],r=e.toLowerCase();for(const[n,o]of Object.entries(s))if(n.toLowerCase().startsWith(r)){const e=`${t}.${n}`;let i="property",s=o;Array.isArray(o)?(i="array",s=`[${o.length} items]`):"object"==typeof o&&null!==o?(i="object",s=`{${Object.keys(o).length} keys}`):"string"==typeof o?(i="string",s=o.length>50?o.substring(0,50)+"...":o):"number"==typeof o?i="number":"boolean"==typeof o&&(i="boolean"),a.push({value:e,type:i,preview:s})}return a.slice(0,20)}_getTagCompletions(t){const e=t.toLowerCase();return[{value:"if",type:"tag",preview:"Conditional"},{value:"elsif",type:"tag",preview:"Else if"},{value:"else",type:"tag",preview:"Else"},{value:"endif",type:"tag",preview:"End if"},{value:"unless",type:"tag",preview:"Negative conditional"},{value:"endunless",type:"tag",preview:"End unless"},{value:"case",type:"tag",preview:"Switch statement"},{value:"when",type:"tag",preview:"Case option"},{value:"endcase",type:"tag",preview:"End case"},{value:"for",type:"tag",preview:"Loop"},{value:"endfor",type:"tag",preview:"End loop"},{value:"break",type:"tag",preview:"Exit loop"},{value:"continue",type:"tag",preview:"Skip iteration"},{value:"assign",type:"tag",preview:"Assign variable"},{value:"capture",type:"tag",preview:"Capture output"},{value:"endcapture",type:"tag",preview:"End capture"},{value:"increment",type:"tag",preview:"Increment counter"},{value:"decrement",type:"tag",preview:"Decrement counter"},{value:"comment",type:"tag",preview:"Comment block"},{value:"endcomment",type:"tag",preview:"End comment"},{value:"raw",type:"tag",preview:"Raw output"},{value:"endraw",type:"tag",preview:"End raw"},{value:"render",type:"tag",preview:"Render snippet"},{value:"section",type:"tag",preview:"Render section"},{value:"form",type:"tag",preview:"Form tag"},{value:"endform",type:"tag",preview:"End form"},{value:"paginate",type:"tag",preview:"Pagination"},{value:"endpaginate",type:"tag",preview:"End pagination"}].filter(t=>t.value.startsWith(e)).slice(0,15)}_getFilterCompletions(t){const e=t.toLowerCase();return[{value:"append",preview:"Append string"},{value:"prepend",preview:"Prepend string"},{value:"capitalize",preview:"Capitalize first letter"},{value:"downcase",preview:"Convert to lowercase"},{value:"upcase",preview:"Convert to uppercase"},{value:"strip",preview:"Trim whitespace"},{value:"lstrip",preview:"Trim left whitespace"},{value:"rstrip",preview:"Trim right whitespace"},{value:"strip_html",preview:"Remove HTML tags"},{value:"strip_newlines",preview:"Remove newlines"},{value:"newline_to_br",preview:"Convert newlines to <br>"},{value:"replace",preview:"Replace substring"},{value:"replace_first",preview:"Replace first occurrence"},{value:"remove",preview:"Remove substring"},{value:"remove_first",preview:"Remove first occurrence"},{value:"truncate",preview:"Truncate to length"},{value:"truncatewords",preview:"Truncate to word count"},{value:"split",preview:"Split into array"},{value:"slice",preview:"Extract substring"},{value:"escape",preview:"HTML escape"},{value:"escape_once",preview:"HTML escape once"},{value:"url_encode",preview:"URL encode"},{value:"url_decode",preview:"URL decode"},{value:"base64_encode",preview:"Base64 encode"},{value:"base64_decode",preview:"Base64 decode"},{value:"handle",preview:"Convert to handle"},{value:"handleize",preview:"Convert to handle"},{value:"abs",preview:"Absolute value"},{value:"ceil",preview:"Round up"},{value:"floor",preview:"Round down"},{value:"round",preview:"Round to precision"},{value:"plus",preview:"Add number"},{value:"minus",preview:"Subtract number"},{value:"times",preview:"Multiply"},{value:"divided_by",preview:"Divide"},{value:"modulo",preview:"Remainder"},{value:"at_least",preview:"Minimum value"},{value:"at_most",preview:"Maximum value"},{value:"join",preview:"Join array"},{value:"first",preview:"Get first element"},{value:"last",preview:"Get last element"},{value:"size",preview:"Get length"},{value:"reverse",preview:"Reverse array"},{value:"sort",preview:"Sort array"},{value:"sort_natural",preview:"Natural sort"},{value:"uniq",preview:"Remove duplicates"},{value:"map",preview:"Extract property"},{value:"where",preview:"Filter array"},{value:"compact",preview:"Remove nil values"},{value:"concat",preview:"Concatenate arrays"},{value:"date",preview:"Format date"},{value:"default",preview:"Default if nil"},{value:"json",preview:"Convert to JSON"},{value:"json_pretty",preview:"Pretty JSON"},{value:"type_of",preview:"Get type"},{value:"money",preview:"Format as money"},{value:"money_with_currency",preview:"Money with currency"},{value:"money_without_currency",preview:"Money without currency"},{value:"asset_url",preview:"Asset URL"},{value:"img_url",preview:"Image URL"},{value:"link_to",preview:"Create link"},{value:"pluralize",preview:"Pluralize word"},{value:"highlight",preview:"Highlight text"},{value:"metafield_value",preview:"Get metafield value"}].filter(t=>t.value.startsWith(e)).slice(0,15).map(t=>({...t,type:"filter"}))}_getAllPaths(){var t,e,i,s,a,r,n,o;if(!this.flattenedContext){const a=[];if(null==(t=this.context)?void 0:t.objects)for(const[t,e]of Object.entries(this.context.objects))null!=e&&"cart"!==t&&"product"!==t&&this._addPaths(a,t,e,3);if((null==(e=this.context)?void 0:e.meta)&&(this._addPaths(a,"template",this.context.meta.template,2),this._addPaths(a,"request",this.context.meta.request,2),this._addPaths(a,"theme",this.context.meta.theme,2)),null==(i=this.context)?void 0:i.metafields)for(const[t,e]of Object.entries(this.context.metafields))if(e&&(null==(s=this.context.objects)?void 0:s[t]))for(const[i,s]of Object.entries(e))for(const[e,r]of Object.entries(s))a.push({path:`${t}.metafields.${i}.${e}`,type:(null==r?void 0:r.type)||"metafield",preview:null==r?void 0:r.value});this.flattenedContext=a}const l=[...this.flattenedContext],d=mt.currentCart;d?this._addPaths(l,"cart",d,3):(null==(r=null==(a=this.context)?void 0:a.objects)?void 0:r.cart)&&this._addPaths(l,"cart",this.context.objects.cart,3);const c=ft.currentProduct;return c?this._addPaths(l,"product",c,3):(null==(o=null==(n=this.context)?void 0:n.objects)?void 0:o.product)&&this._addPaths(l,"product",this.context.objects.product,3),l}_addPaths(t,e,i,s,a=0){if(a>=s||null==i)return;const r=Array.isArray(i)?"array":typeof i;if(t.push({path:e,type:r,preview:this._getPreview(i)}),"object"!=typeof i||Array.isArray(i))Array.isArray(i)&&i.length>0&&this._addPaths(t,`${e}[0]`,i[0],s,a+1);else for(const[n,o]of Object.entries(i))n.startsWith("_")||this._addPaths(t,`${e}.${n}`,o,s,a+1)}_getPreview(t){return null==t?"null":"string"==typeof t?t.length>50?t.slice(0,50)+"...":t:"number"==typeof t||"boolean"==typeof t?t:Array.isArray(t)?`Array(${t.length})`:"object"==typeof t?`Object(${Object.keys(t).length})`:String(t)}addToHistory(t){this.history[this.history.length-1]!==t&&(this.history.push(t),this.history.length>this.maxHistory&&(this.history=this.history.slice(-this.maxHistory)))}getHistory(){return[...this.history]}clearHistory(){this.history=[]}};class Ca extends ot{constructor(){super(),this.liquidErrors=[],this.evalLogs=[],this.expandedLogs=new Set,this.inputValue="",this.historyIndex=-1,this.suggestions=[],this.selectedSuggestion=-1,this.showSuggestions=!1,this.context=null}connectedCallback(){super.connectedCallback(),this._scanForLiquidErrors()}updated(t){super.updated(t),t.has("context")&&this.context&&Ta.setContext(this.context)}willUpdate(t){t.has("context")&&this.context&&!Ta.context&&Ta.setContext(this.context)}_scanForLiquidErrors(){const t=[],e=new Set,i=(i,s,a=null)=>{const r=i.trim();e.has(r)||(e.add(r),t.push({id:Date.now()+Math.random(),type:"liquid",category:s,message:r,timestamp:new Date,element:a?this._getElementPath(a):null}))},s=document.createTreeWalker(document.body,NodeFilter.SHOW_COMMENT,null,!1);for(;s.nextNode();){const t=s.currentNode.textContent;(t.includes("Liquid error")||t.includes("Liquid syntax error"))&&i(t,"comment")}const a=document.body.innerHTML;[{pattern:/Liquid\s+error\s*\(line\s*\d+\):\s*[^<\n]+/gi,category:"inline"},{pattern:/Liquid\s+error:\s*[^<\n]+/gi,category:"inline"},{pattern:/Liquid\s+syntax\s+error\s*\(line\s*\d+\):\s*[^<\n]+/gi,category:"inline"},{pattern:/Liquid\s+syntax\s+error:\s*[^<\n]+/gi,category:"inline"},{pattern:/Error\s+in\s+schema:\s*[^<\n]+/gi,category:"schema"},{pattern:/Invalid\s+JSON\s+in\s+schema\s+tag/gi,category:"schema"},{pattern:/Error\s+parsing\s+schema:\s*[^<\n]+/gi,category:"schema"}].forEach(({pattern:t,category:e})=>{let s;for(;null!==(s=t.exec(a));)i(s[0],e)});const r=/\{"error"\s*:\s*"([^"]+)"\}/gi;let n;for(;null!==(n=r.exec(a));){const t=n[1];i(`JSON filter error: ${t} — This occurs when using | json on objects that cannot be serialized`,"json")}const o=/#<(?:Shopify::)?(?:Liquid::)?(\w+)Drop:0x[a-f0-9]+>/gi;let l;for(;null!==(l=o.exec(a));){const t=l[1];i(`Raw ${t} Drop object rendered: ${l[0]} — Use .title, .url, or other property instead of outputting the object directly`,"drop")}const d=/\b(Shop|Product|Collection|Cart|Customer|Article|Blog|Page|Variant|Image|Metafield|Address|Order|LineItem|Fulfillment|Transaction|Country|Currency|Locale|Market|Policy|Section|Block|Theme|Font|Link|Linklist|Comment|Form|Paginate|TableRow|ForLoop)Drop\b/g;let c;for(;null!==(c=d.exec(a));){const t=c[1];i(`Raw ${t}Drop object rendered on page — Use a property like .title, .name, .url instead of outputting {{ ${t.toLowerCase()} }} directly`,"drop")}const p=document.createTreeWalker(document.body,NodeFilter.SHOW_TEXT,{acceptNode:t=>{var e;const i=t.parentElement;if(!i)return NodeFilter.FILTER_REJECT;const s=null==(e=i.tagName)?void 0:e.toLowerCase();return"script"===s||"style"===s||"noscript"===s?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}});for(;p.nextNode();){const t=p.currentNode.textContent;if(/Liquid\s+(error|syntax error)/i.test(t)){const e=t.match(/Liquid\s+(?:error|syntax error)[^]*/i);e&&i(e[0],"text",p.currentNode.parentElement)}if(/#<\w+Drop:0x/i.test(t)){const e=t.match(/#<(?:Shopify::)?(?:Liquid::)?(\w+)Drop:0x[a-f0-9]+>/i);e&&i(`Raw ${e[1]} Drop object in page: ${e[0]}`,"drop",p.currentNode.parentElement)}/unknown\s+image\s+file/i.test(t)&&i(`Unknown image file error: ${t.substring(0,200)}`,"asset",p.currentNode.parentElement)}document.querySelectorAll("img").forEach(t=>{const e=t.src||t.dataset.src,s=t.alt;s&&/Liquid\s+error|Could\s+not\s+find\s+asset/i.test(s)&&i(`Image error: ${s}`,"asset",t),e&&/Liquid%20error|Could%20not%20find/i.test(e)&&i(`Broken image URL contains error: ${decodeURIComponent(e.substring(0,200))}`,"asset",t)});document.querySelectorAll(".shopify-section, [data-section-type], .template-").forEach(t=>{const e=t.textContent;if(/form\s+'product'\s+needs\s+a\s+product\s+object/i.test(e)&&i("Liquid error: form 'product' needs a product object","form",t),/form\s+'customer_address'\s+requires\s+an\s+address/i.test(e)&&i("Liquid error: form 'customer_address' requires an address","form",t),/invalid\s+form\s+type/i.test(e)){const s=e.match(/invalid\s+form\s+type\s*['"]?(\w+)['"]?/i);i(`Liquid error: invalid form type '${(null==s?void 0:s[1])||"unknown"}'`,"form",t)}}),this.liquidErrors=t}_getElementPath(t){var e;if(!t)return null;const i=[];let s=t;for(;s&&s!==document.body&&i.length<5;){let t=(null==(e=s.tagName)?void 0:e.toLowerCase())||"";if(s.id)t+=`#${s.id}`;else if(s.className&&"string"==typeof s.className){const e=s.className.split(" ").filter(t=>t&&!t.startsWith("js-")).slice(0,2);e.length&&(t+=`.${e.join(".")}`)}t&&i.unshift(t),s=s.parentElement}return i.join(" > ")}_clearEvalLogs(){this.evalLogs=[]}_toggleExpand(t){const e=new Set(this.expandedLogs);e.has(t)?e.delete(t):e.add(t),this.expandedLogs=e}_handleInputKeydown(t){switch(t.key){case"Enter":if(t.shiftKey)return;t.preventDefault(),this.showSuggestions&&this.selectedSuggestion>=0?this._selectSuggestion(this.selectedSuggestion):this._evaluateExpression();break;case"ArrowUp":this.showSuggestions&&this.suggestions.length>0?(t.preventDefault(),this.selectedSuggestion=this.selectedSuggestion<=0?this.suggestions.length-1:this.selectedSuggestion-1,this._scrollSuggestionIntoView()):this.inputValue.includes("\n")&&!this._isAtFirstLine(t.target)||(t.preventDefault(),this._navigateHistory(-1));break;case"ArrowDown":this.showSuggestions&&this.suggestions.length>0?(t.preventDefault(),this.selectedSuggestion=this.selectedSuggestion>=this.suggestions.length-1?0:this.selectedSuggestion+1,this._scrollSuggestionIntoView()):this.inputValue.includes("\n")&&!this._isAtLastLine(t.target)||(t.preventDefault(),this._navigateHistory(1));break;case"Tab":if(this.showSuggestions&&this.suggestions.length>0){t.preventDefault();const e=this.selectedSuggestion>=0?this.selectedSuggestion:0;this._selectSuggestion(e)}break;case"Escape":this.showSuggestions&&(t.preventDefault(),this.showSuggestions=!1,this.selectedSuggestion=-1)}}_isAtFirstLine(t){const e=t.selectionStart;return!t.value.substring(0,e).includes("\n")}_isAtLastLine(t){const e=t.selectionStart;return!t.value.substring(e).includes("\n")}_scrollSuggestionIntoView(){this.updateComplete.then(()=>{const t=this.shadowRoot.querySelector(".autocomplete-dropdown"),e=this.shadowRoot.querySelector(".autocomplete-item--selected");t&&e&&e.scrollIntoView({block:"nearest",behavior:"smooth"})})}_handleInput(t){this.inputValue=t.target.value,this.historyIndex=-1,this._updateSuggestions(),this._autoGrowTextarea(t.target)}_autoGrowTextarea(t){t.style.height="auto",t.style.height=Math.min(t.scrollHeight,150)+"px"}_updateSuggestions(){if(!this.inputValue.trim())return this.suggestions=[],this.showSuggestions=!1,void(this.selectedSuggestion=-1);this.suggestions=Ta.getCompletions(this.inputValue),this.showSuggestions=this.suggestions.length>0,this.selectedSuggestion=-1}_selectSuggestion(t){const e=this.suggestions[t];if(!e)return;const i=this.inputValue.lastIndexOf("|");-1!==i&&"filter"===e.type?this.inputValue=this.inputValue.slice(0,i+1)+" "+e.value:this.inputValue=e.value,this.showSuggestions=!1,this.selectedSuggestion=-1,this.updateComplete.then(()=>{const t=this.shadowRoot.querySelector(".console-input");t&&(t.focus(),t.setSelectionRange(t.value.length,t.value.length),this._autoGrowTextarea(t))})}_navigateHistory(t){const e=Ta.getHistory();0!==e.length&&(-1===t?this.historyIndex<e.length-1&&(this.historyIndex++,this.inputValue=e[e.length-1-this.historyIndex]):this.historyIndex>0?(this.historyIndex--,this.inputValue=e[e.length-1-this.historyIndex]):0===this.historyIndex&&(this.historyIndex=-1,this.inputValue=""),this.showSuggestions=!1)}async _evaluateExpression(){if(!this.inputValue.trim())return;const t=this.inputValue;this.inputValue="",this.historyIndex=-1,this.showSuggestions=!1;const e=await Ta.evaluate(t),i={id:Date.now()+Math.random(),type:"eval",expression:e.expression,result:e.success?e.value:null,error:e.success?null:e.error,success:e.success,timestamp:new Date};this.evalLogs=[...this.evalLogs,i],this.updateComplete.then(()=>{const t=this.shadowRoot.querySelector(".console-content");t&&(t.scrollTop=t.scrollHeight)})}_formatTime(t){return t instanceof Date||(t=new Date(t)),isNaN(t.getTime())?"--:--:--":t.toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit",fractionalSecondDigits:3})}_renderEvalResult(t){if(!t.success)return U`<span class="eval-result eval-result--error">${t.error}</span>`;const e=t.result;return void 0===e?U`<span class="eval-result eval-result--undefined">undefined</span>`:null===e?U`<span class="eval-result eval-result--null">null</span>`:"string"==typeof e?U`<span class="eval-result eval-result--string">"${e}"</span>`:"number"==typeof e?U`<span class="eval-result eval-result--number">${e}</span>`:"boolean"==typeof e?U`<span class="eval-result eval-result--boolean">${e}</span>`:"object"==typeof e?U`
3336
4228
  <div class="eval-result">
3337
4229
  <tdt-object-inspector .data=${e} .path=${"result"}></tdt-object-inspector>
3338
4230
  </div>
@@ -3476,7 +4368,7 @@ var __defProp=Object.defineProperty,__defNormalProp=(t,e,i)=>e in t?__defProp(t,
3476
4368
  Uses LiquidJS engine — results may differ slightly from Shopify's native Liquid
3477
4369
  </div>
3478
4370
  </div>
3479
- `}}__publicField(Ta,"properties",{liquidErrors:{type:Array,state:!0},evalLogs:{type:Array,state:!0},expandedLogs:{type:Set,state:!0},inputValue:{type:String,state:!0},historyIndex:{type:Number,state:!0},suggestions:{type:Array,state:!0},selectedSuggestion:{type:Number,state:!0},showSuggestions:{type:Boolean,state:!0},context:{type:Object}}),__publicField(Ta,"styles",[pt,n`
4371
+ `}}__publicField(Ca,"properties",{liquidErrors:{type:Array,state:!0},evalLogs:{type:Array,state:!0},expandedLogs:{type:Set,state:!0},inputValue:{type:String,state:!0},historyIndex:{type:Number,state:!0},suggestions:{type:Array,state:!0},selectedSuggestion:{type:Number,state:!0},showSuggestions:{type:Boolean,state:!0},context:{type:Object}}),__publicField(Ca,"styles",[pt,n`
3480
4372
  :host {
3481
4373
  display: block;
3482
4374
  padding: 12px;
@@ -3910,7 +4802,7 @@ var __defProp=Object.defineProperty,__defNormalProp=(t,e,i)=>e in t?__defProp(t,
3910
4802
  .eval-result--null {
3911
4803
  color: var(--tdt-text-muted);
3912
4804
  }
3913
- `]),customElements.define("tdt-console-panel",Ta);const Ca=class t extends ot{constructor(){super(),this.meta={},this.translations=[],this.missingTranslations=[],this.availableLocales=[],this.availableCountries=[],this.filter="",this.activeTab="overview",this._selectedLocale=null,this._selectedCountry=null}connectedCallback(){super.connectedCallback(),this._scanTranslations(),this._loadAvailableLocales()}updated(t){var e,i,s,a;t.has("meta")&&this.meta&&(this._selectedLocale=null==(i=null==(e=this.meta.request)?void 0:e.locale)?void 0:i.iso_code,this._selectedCountry=null==(a=null==(s=this.meta.localization)?void 0:s.country)?void 0:a.iso_code)}_loadAvailableLocales(){var t,e,i;const s=document.querySelector("[data-locale-selector]")||document.querySelector('form[action*="/localization"]');if(s){const t=s.querySelectorAll("option[value], [data-locale]");this.availableLocales=Array.from(t).map(t=>{var e;return{code:t.value||t.dataset.locale,name:(null==(e=t.textContent)?void 0:e.trim())||t.value}})}const a=document.querySelector("[data-country-selector]")||document.querySelector('select[name="country_code"]');if(a){const t=a.querySelectorAll("option[value]");this.availableCountries=Array.from(t).map(t=>{var e;return{code:t.value,name:(null==(e=t.textContent)?void 0:e.trim())||t.value}})}if(0===this.availableLocales.length){const s=null==(i=null==(e=null==(t=window.__THEME_DEVTOOLS_CONTEXT__)?void 0:t.objects)?void 0:e.shop)?void 0:i.enabled_locales;s&&(this.availableLocales=s.map(t=>({code:t,name:new Intl.DisplayNames(["en"],{type:"language"}).of(t)||t})))}}_scanTranslations(){var t;const e=[],i=[],s=document.body.innerHTML,a=new Set;[/\{\{\s*['"]([^'"]+)['"]\s*\|\s*t\s*\}\}/g,/\{\{\s*['"]([^'"]+)['"]\s*\|\s*t:\s*[^}]+\}\}/g,/data-translation-key=["']([^"']+)["']/g].forEach(t=>{let e;for(;null!==(e=t.exec(s));)a.has(e[1])||a.add(e[1])});const r=document.createTreeWalker(document.body,NodeFilter.SHOW_TEXT,null,!1);for(;r.nextNode();){const e=r.currentNode.textContent.trim();if(e.startsWith("translation missing:")||e.includes("Translation missing")||e.match(/^[a-z_]+\.[a-z_]+(\.[a-z_]+)*$/i)){const s=e.match(/translation missing:\s*([^\s]+)/i)||e.match(/^([a-z_]+\.[a-z_]+(?:\.[a-z_]+)*)$/i);s&&i.push({key:s[1],context:(null==(t=r.currentNode.parentElement)?void 0:t.tagName)||"unknown",element:r.currentNode.parentElement})}}document.querySelectorAll("[data-t], [data-translate]").forEach(t=>{var s;const a=t.dataset.t||t.dataset.translate,r=null==(s=t.textContent)?void 0:s.trim();a&&(e.push({key:a,value:r||"(empty)",element:t.tagName,isMissing:!r||r.includes("translation missing")}),r&&!r.includes("translation missing")||i.push({key:a,context:t.tagName,element:t}))}),a.forEach(t=>{e.some(e=>e.key===t)||e.push({key:t,value:"(rendered)",element:"Liquid",isMissing:!1})}),this.translations=e,this.missingTranslations=i}_getFlag(e,i="country"){if("language"===i){const i=e.split("-")[0].toLowerCase();return t.LANGUAGE_FLAGS[i]||"🌐"}return t.COUNTRY_FLAGS[null==e?void 0:e.toUpperCase()]||"🏳️"}_setTab(t){this.activeTab=t}_filterTranslations(t){this.filter=t.target.value}_getFilteredTranslations(){const t="missing"===this.activeTab?this.missingTranslations:this.translations;if(!this.filter)return t;const e=this.filter.toLowerCase();return t.filter(t=>t.key.toLowerCase().includes(e)||t.value&&t.value.toLowerCase().includes(e))}_copyKey(t){const e=`{{ '${t}' | t }}`;navigator.clipboard.writeText(e)}_selectLocale(t){this._selectedLocale=t,this.requestUpdate()}_selectCountry(t){this._selectedCountry=t,this.requestUpdate()}_buildLocaleUrl(){var t,e,i,s,a;const r=new URL(window.location.href),n=r.pathname.split("/").filter(Boolean);null==(e=null==(t=this.meta.request)?void 0:t.locale)||e.iso_code;const o=this._selectedLocale;this._selectedCountry,(null==(i=n[0])?void 0:i.match(/^[a-z]{2}(-[a-z]{2})?$/i))&&n.shift();let l="";return o&&o!==(null==(a=null==(s=this.meta.request)?void 0:s.locale)?void 0:a.primary_locale)&&(l=`/${o}`),l+="/"+n.join("/"),r.pathname=l||"/",r.toString()}_goToLocale(){const t=this._buildLocaleUrl();window.location.href=t}_copyLocaleUrl(){const t=this._buildLocaleUrl();navigator.clipboard.writeText(t)}_renderMarketInfo(){var t,e,i,s,a,r,n,o,l,d,c,p,u;const{localization:h,request:g}=this.meta,v=null==(t=window.Shopify)?void 0:t.currency,m=null==v?void 0:v.rate,b=null==v?void 0:v.active;return U`
4805
+ `]),customElements.define("tdt-console-panel",Ca);const Ea=class t extends ot{constructor(){super(),this.meta={},this.translations=[],this.missingTranslations=[],this.availableLocales=[],this.availableCountries=[],this.filter="",this.activeTab="overview",this._selectedLocale=null,this._selectedCountry=null}connectedCallback(){super.connectedCallback(),this._scanTranslations(),this._loadAvailableLocales()}updated(t){var e,i,s,a;t.has("meta")&&this.meta&&(this._selectedLocale=null==(i=null==(e=this.meta.request)?void 0:e.locale)?void 0:i.iso_code,this._selectedCountry=null==(a=null==(s=this.meta.localization)?void 0:s.country)?void 0:a.iso_code)}_loadAvailableLocales(){var t,e,i;const s=document.querySelector("[data-locale-selector]")||document.querySelector('form[action*="/localization"]');if(s){const t=s.querySelectorAll("option[value], [data-locale]");this.availableLocales=Array.from(t).map(t=>{var e;return{code:t.value||t.dataset.locale,name:(null==(e=t.textContent)?void 0:e.trim())||t.value}})}const a=document.querySelector("[data-country-selector]")||document.querySelector('select[name="country_code"]');if(a){const t=a.querySelectorAll("option[value]");this.availableCountries=Array.from(t).map(t=>{var e;return{code:t.value,name:(null==(e=t.textContent)?void 0:e.trim())||t.value}})}if(0===this.availableLocales.length){const s=null==(i=null==(e=null==(t=window.__THEME_DEVTOOLS_CONTEXT__)?void 0:t.objects)?void 0:e.shop)?void 0:i.enabled_locales;s&&(this.availableLocales=s.map(t=>({code:t,name:new Intl.DisplayNames(["en"],{type:"language"}).of(t)||t})))}}_scanTranslations(){var t;const e=[],i=[],s=document.body.innerHTML,a=new Set;[/\{\{\s*['"]([^'"]+)['"]\s*\|\s*t\s*\}\}/g,/\{\{\s*['"]([^'"]+)['"]\s*\|\s*t:\s*[^}]+\}\}/g,/data-translation-key=["']([^"']+)["']/g].forEach(t=>{let e;for(;null!==(e=t.exec(s));)a.has(e[1])||a.add(e[1])});const r=document.createTreeWalker(document.body,NodeFilter.SHOW_TEXT,null,!1);for(;r.nextNode();){const e=r.currentNode.textContent.trim();if(e.startsWith("translation missing:")||e.includes("Translation missing")||e.match(/^[a-z_]+\.[a-z_]+(\.[a-z_]+)*$/i)){const s=e.match(/translation missing:\s*([^\s]+)/i)||e.match(/^([a-z_]+\.[a-z_]+(?:\.[a-z_]+)*)$/i);s&&i.push({key:s[1],context:(null==(t=r.currentNode.parentElement)?void 0:t.tagName)||"unknown",element:r.currentNode.parentElement})}}document.querySelectorAll("[data-t], [data-translate]").forEach(t=>{var s;const a=t.dataset.t||t.dataset.translate,r=null==(s=t.textContent)?void 0:s.trim();a&&(e.push({key:a,value:r||"(empty)",element:t.tagName,isMissing:!r||r.includes("translation missing")}),r&&!r.includes("translation missing")||i.push({key:a,context:t.tagName,element:t}))}),a.forEach(t=>{e.some(e=>e.key===t)||e.push({key:t,value:"(rendered)",element:"Liquid",isMissing:!1})}),this.translations=e,this.missingTranslations=i}_getFlag(e,i="country"){if("language"===i){const i=e.split("-")[0].toLowerCase();return t.LANGUAGE_FLAGS[i]||"🌐"}return t.COUNTRY_FLAGS[null==e?void 0:e.toUpperCase()]||"🏳️"}_setTab(t){this.activeTab=t}_filterTranslations(t){this.filter=t.target.value}_getFilteredTranslations(){const t="missing"===this.activeTab?this.missingTranslations:this.translations;if(!this.filter)return t;const e=this.filter.toLowerCase();return t.filter(t=>t.key.toLowerCase().includes(e)||t.value&&t.value.toLowerCase().includes(e))}_copyKey(t){const e=`{{ '${t}' | t }}`;navigator.clipboard.writeText(e)}_selectLocale(t){this._selectedLocale=t,this.requestUpdate()}_selectCountry(t){this._selectedCountry=t,this.requestUpdate()}_buildLocaleUrl(){var t,e,i,s,a;const r=new URL(window.location.href),n=r.pathname.split("/").filter(Boolean);null==(e=null==(t=this.meta.request)?void 0:t.locale)||e.iso_code;const o=this._selectedLocale;this._selectedCountry,(null==(i=n[0])?void 0:i.match(/^[a-z]{2}(-[a-z]{2})?$/i))&&n.shift();let l="";return o&&o!==(null==(a=null==(s=this.meta.request)?void 0:s.locale)?void 0:a.primary_locale)&&(l=`/${o}`),l+="/"+n.join("/"),r.pathname=l||"/",r.toString()}_goToLocale(){const t=this._buildLocaleUrl();window.location.href=t}_copyLocaleUrl(){const t=this._buildLocaleUrl();navigator.clipboard.writeText(t)}_renderMarketInfo(){var t,e,i,s,a,r,n,o,l,d,c,p,u;const{localization:h,request:g}=this.meta,v=null==(t=window.Shopify)?void 0:t.currency,m=null==v?void 0:v.rate,f=null==v?void 0:v.active;return U`
3914
4806
  <div class="market-info">
3915
4807
  <div class="info-card">
3916
4808
  <div class="info-card__label">Country</div>
@@ -3926,7 +4818,7 @@ var __defProp=Object.defineProperty,__defNormalProp=(t,e,i)=>e in t?__defProp(t,
3926
4818
 
3927
4819
  <div class="info-card">
3928
4820
  <div class="info-card__label">Currency</div>
3929
- <div class="info-card__value">${b||(null==(l=null==(o=null==h?void 0:h.country)?void 0:o.currency)?void 0:l.iso_code)||"—"}</div>
4821
+ <div class="info-card__value">${f||(null==(l=null==(o=null==h?void 0:h.country)?void 0:o.currency)?void 0:l.iso_code)||"—"}</div>
3930
4822
  <div class="info-card__subvalue">${(null==(c=null==(d=null==h?void 0:h.country)?void 0:d.currency)?void 0:c.symbol)||""}</div>
3931
4823
  </div>
3932
4824
 
@@ -4053,7 +4945,7 @@ var __defProp=Object.defineProperty,__defNormalProp=(t,e,i)=>e in t?__defProp(t,
4053
4945
  <div class="section-title">Translation Keys on Page</div>
4054
4946
  ${this._renderTranslations()}
4055
4947
  </div>
4056
- `}};__publicField(Ca,"properties",{meta:{type:Object},translations:{type:Array,state:!0},missingTranslations:{type:Array,state:!0},availableLocales:{type:Array,state:!0},availableCountries:{type:Array,state:!0},filter:{type:String,state:!0},activeTab:{type:String,state:!0}}),__publicField(Ca,"styles",[pt,n`
4948
+ `}};__publicField(Ea,"properties",{meta:{type:Object},translations:{type:Array,state:!0},missingTranslations:{type:Array,state:!0},availableLocales:{type:Array,state:!0},availableCountries:{type:Array,state:!0},filter:{type:String,state:!0},activeTab:{type:String,state:!0}}),__publicField(Ea,"styles",[pt,n`
4057
4949
  :host {
4058
4950
  display: block;
4059
4951
  padding: 12px;
@@ -4420,7 +5312,7 @@ var __defProp=Object.defineProperty,__defNormalProp=(t,e,i)=>e in t?__defProp(t,
4420
5312
  .stat-value--warning {
4421
5313
  color: var(--tdt-warning);
4422
5314
  }
4423
- `]),__publicField(Ca,"COUNTRY_FLAGS",{US:"🇺🇸",CA:"🇨🇦",GB:"🇬🇧",AU:"🇦🇺",DE:"🇩🇪",FR:"🇫🇷",ES:"🇪🇸",IT:"🇮🇹",JP:"🇯🇵",CN:"🇨🇳",BR:"🇧🇷",MX:"🇲🇽",NL:"🇳🇱",SE:"🇸🇪",NO:"🇳🇴",DK:"🇩🇰",FI:"🇫🇮",PL:"🇵🇱",AT:"🇦🇹",CH:"🇨🇭",BE:"🇧🇪",IE:"🇮🇪",NZ:"🇳🇿",SG:"🇸🇬",HK:"🇭🇰",KR:"🇰🇷",IN:"🇮🇳",AE:"🇦🇪",SA:"🇸🇦",ZA:"🇿🇦",PT:"🇵🇹",CZ:"🇨🇿",RO:"🇷🇴",HU:"🇭🇺",IL:"🇮🇱"}),__publicField(Ca,"LANGUAGE_FLAGS",{en:"🇬🇧",es:"🇪🇸",fr:"🇫🇷",de:"🇩🇪",it:"🇮🇹",pt:"🇵🇹",nl:"🇳🇱",pl:"🇵🇱",ja:"🇯🇵",zh:"🇨🇳",ko:"🇰🇷",ar:"🇸🇦",ru:"🇷🇺",sv:"🇸🇪",da:"🇩🇰",fi:"🇫🇮",no:"🇳🇴",cs:"🇨🇿",hu:"🇭🇺",ro:"🇷🇴"});let Ea=Ca;customElements.define("tdt-localization-panel",Ea);const Aa=class t extends ot{constructor(){super(),this.events=[],this.dataLayerSnapshots=[],this.filter="",this.activeFilter="all",this.expandedEvents=new Set,this.isPaused=!1,this._detectedProviders=new Set}connectedCallback(){super.connectedCallback(),this._loadPersistedEvents(),this._detectProviders(),this._interceptDataLayer(),this._interceptGtag(),this._interceptGaUniversal(),this._interceptFbPixel(),this._interceptTikTok(),this._interceptPinterest(),this._interceptSnapchat(),this._interceptKlaviyo(),this._interceptShopifyAnalytics(),this._interceptWebPixels(),this._interceptCustomEvents()}disconnectedCallback(){super.disconnectedCallback(),this._restoreInterceptors()}_loadPersistedEvents(){try{const e=sessionStorage.getItem(t.STORAGE_KEY);if(e){const t=JSON.parse(e);this.events=t.map(t=>({...t,timestamp:new Date(t.timestamp),isLive:!1}))}}catch(e){console.warn("[TDT] Failed to load persisted events:",e)}}_persistEvents(){try{const e=this.events.slice(-500).map(t=>({id:t.id,provider:t.provider,eventName:t.eventName,data:this._safeCloneData(t.data),timestamp:t.timestamp.toISOString(),isConversion:t.isConversion,isLive:t.isLive,count:t.count}));sessionStorage.setItem(t.STORAGE_KEY,JSON.stringify(e))}catch(e){console.warn("[TDT] Failed to persist events:",e)}}_safeCloneData(t,e=new WeakSet){if(null===t||"object"!=typeof t)return t;if(e.has(t))return"[Circular]";if(t instanceof Element||t instanceof Node)return"[DOM Element]";if("function"==typeof t)return"[Function]";if(e.add(t),Array.isArray(t))return t.map(t=>this._safeCloneData(t,e));const i={};for(const s of Object.keys(t))try{const a=t[s];if("renderOptions"===s||"host"===s||s.startsWith("__"))continue;i[s]=this._safeCloneData(a,e)}catch{i[s]="[Unserializable]"}return i}_detectProviders(){var t;window.dataLayer&&this._detectedProviders.add("datalayer"),window.gtag&&this._detectedProviders.add("ga4"),window.ga&&this._detectedProviders.add("ga"),window.fbq&&this._detectedProviders.add("fbpixel"),window.ttq&&this._detectedProviders.add("tiktok"),window.pintrk&&this._detectedProviders.add("pinterest"),window.snaptr&&this._detectedProviders.add("snapchat"),window._learnq&&this._detectedProviders.add("klaviyo"),(null==(t=window.Shopify)?void 0:t.analytics)&&this._detectedProviders.add("shopify")}_interceptDataLayer(){window.dataLayer||(window.dataLayer=[]);const t=window.dataLayer.push.bind(window.dataLayer),e=this;window.dataLayer.push=function(...i){return i.forEach(t=>{!e.isPaused&&t&&"object"==typeof t&&e._addEvent("datalayer",t.event||"push",t)}),t(...i)},this._originalDataLayerPush=t,window.dataLayer.forEach(t=>{t&&"object"==typeof t&&this._addEvent("datalayer",t.event||"push",t,!1)})}_interceptGtag(){if(!window.gtag)return;const t=window.gtag,e=this;window.gtag=function(i,...s){if(!e.isPaused)if("event"===i){const[t,i]=s;e._addEvent("ga4",t,i||{}),e._detectedProviders.add("ga4")}else"config"===i&&e._addEvent("ga4","config",{measurementId:s[0],...s[1]});return t.call(this,i,...s)},this._originalGtag=t}_interceptGaUniversal(){if(!window.ga)return;const t=window.ga,e=this;window.ga=function(i,...s){if(!e.isPaused)if("send"===i){const[t,...i]=s;if("event"===t){const[t,s,a,r]=i;e._addEvent("ga",s||"event",{category:t,action:s,label:a,value:r})}else"pageview"===t&&e._addEvent("ga","pageview",{page:i[0]});e._detectedProviders.add("ga")}else"function"==typeof i||"create"===i&&e._addEvent("ga","create",{trackingId:s[0],...s[1]});return t.call(this,i,...s)},this._originalGa=t}_interceptFbPixel(){if(!window.fbq)return;const t=window.fbq,e=this;window.fbq=function(i,...s){if(!e.isPaused)if("track"===i||"trackCustom"===i){const[t,i]=s;e._addEvent("fbpixel",t,i||{}),e._detectedProviders.add("fbpixel")}else"init"===i&&e._addEvent("fbpixel","init",{pixelId:s[0]});return t.call(this,i,...s)},this._originalFbq=t}_interceptTikTok(){if(!window.ttq)return;const t=window.ttq,e=this;if(t.track){const i=t.track.bind(t);t.track=function(t,s){return e.isPaused||(e._addEvent("tiktok",t,s||{}),e._detectedProviders.add("tiktok")),i(t,s)},this._originalTtqTrack=i}if(t.page){const i=t.page.bind(t);t.page=function(){return e.isPaused||(e._addEvent("tiktok","PageView",{}),e._detectedProviders.add("tiktok")),i()},this._originalTtqPage=i}}_interceptPinterest(){if(!window.pintrk)return;const t=window.pintrk,e=this;window.pintrk=function(i,...s){if(!e.isPaused)if("track"===i){const[t,i]=s;e._addEvent("pinterest",t,i||{}),e._detectedProviders.add("pinterest")}else"load"===i&&e._addEvent("pinterest","load",{tagId:s[0]});return t.call(this,i,...s)},this._originalPintrk=t}_interceptSnapchat(){if(!window.snaptr)return;const t=window.snaptr,e=this;window.snaptr=function(i,...s){if(!e.isPaused)if("track"===i){const[t,i]=s;e._addEvent("snapchat",t,i||{}),e._detectedProviders.add("snapchat")}else"init"===i&&e._addEvent("snapchat","init",{pixelId:s[0]});return t.call(this,i,...s)},this._originalSnaptr=t}_interceptKlaviyo(){if(!window._learnq)return;const t=window._learnq,e=this;if(Array.isArray(t)){const i=t.push.bind(t);t.push=function(t){if(!e.isPaused&&Array.isArray(t)){const[i,...s]=t;if("track"===i){const[t,i]=s;e._addEvent("klaviyo",t,i||{}),e._detectedProviders.add("klaviyo")}else"identify"===i&&e._addEvent("klaviyo","identify",s[0]||{})}return i(t)},this._originalLearnqPush=i}}_interceptShopifyAnalytics(){var t;if(!(null==(t=window.Shopify)?void 0:t.analytics))return;const e=window.Shopify.analytics,i=this;if(e.publish){const t=e.publish.bind(e);e.publish=function(e,s){return i.isPaused||(i._addEvent("shopify",e,s||{}),i._detectedProviders.add("shopify")),t(e,s)},this._originalShopifyPublish=t}}_interceptWebPixels(){var t,e;if(!(null==(e=null==(t=window.Shopify)?void 0:t.analytics)?void 0:e.subscribe))return;const i=window.Shopify.analytics,s=this,a=i.subscribe.bind(i);i.subscribe=function(t,e){return a(t,i=>(s.isPaused||(s._addEvent("webpixel",t,i||{}),s._detectedProviders.add("webpixel")),e(i)))},this._originalWebPixelSubscribe=a}_interceptCustomEvents(){const t=this;this._customEventHandler=e=>{!t.isPaused&&e.detail&&t._addEvent("custom",e.type,e.detail)},["analytics","tracking","gtm","conversion"].forEach(t=>{document.addEventListener(t,this._customEventHandler)})}_restoreInterceptors(){this._originalDataLayerPush&&window.dataLayer&&(window.dataLayer.push=this._originalDataLayerPush),this._originalGtag&&(window.gtag=this._originalGtag),this._originalFbq&&(window.fbq=this._originalFbq),["analytics","tracking","gtm","conversion"].forEach(t=>{document.removeEventListener(t,this._customEventHandler)})}_getEventKey(t,e,i){return`${t}:${e}:${JSON.stringify(i,Object.keys(i||{}).sort())}`}_addEvent(e,i,s,a=!0){const r=t.CONVERSION_EVENTS.some(t=>i.toLowerCase().includes(t.toLowerCase())),n=this._getEventKey(e,i,s),o=this.events.find(t=>Date.now()-t.timestamp.getTime()<500&&this._getEventKey(t.provider,t.eventName,t.data)===n);if(o)return o.count=(o.count||1)+1,this.events=[...this.events],void this._persistEvents();const l={id:Date.now()+Math.random(),provider:e,eventName:i,data:s,timestamp:new Date,isConversion:r,isLive:a,count:1};this.events=a?[...this.events,l]:[l,...this.events],a&&this._persistEvents()}_togglePause(){this.isPaused=!this.isPaused}_clearEvents(){this.events=[],sessionStorage.removeItem(t.STORAGE_KEY)}_exportEvents(){const t=this._getFilteredEvents().map(t=>({provider:t.provider,eventName:t.eventName,data:t.data,timestamp:t.timestamp.toISOString(),isConversion:t.isConversion,count:t.count||1})),e=new Blob([JSON.stringify(t,null,2)],{type:"application/json"}),i=URL.createObjectURL(e),s=document.createElement("a");s.href=i,s.download=`analytics-events-${(new Date).toISOString().slice(0,10)}.json`,s.click(),URL.revokeObjectURL(i)}async _copyEvent(t,e){e.stopPropagation();const i={provider:t.provider,eventName:t.eventName,data:t.data,timestamp:t.timestamp.toISOString(),isConversion:t.isConversion};try{await navigator.clipboard.writeText(JSON.stringify(i,null,2));const t=e.target;t.classList.add("btn-copy--copied"),t.textContent="Copied!",setTimeout(()=>{t.classList.remove("btn-copy--copied"),t.textContent="Copy"},1500)}catch(s){console.error("[TDT] Failed to copy event:",s)}}_filterEvents(t){this.filter=t.target.value}_setFilter(t){this.activeFilter=t}_toggleExpand(t){const e=new Set(this.expandedEvents);e.has(t)?e.delete(t):e.add(t),this.expandedEvents=e}_getFilteredEvents(){let t=this.events;if("all"!==this.activeFilter&&(t="conversion"===this.activeFilter?t.filter(t=>t.isConversion):t.filter(t=>t.provider===this.activeFilter)),this.filter){const e=this.filter.toLowerCase();t=t.filter(t=>t.eventName.toLowerCase().includes(e)||JSON.stringify(t.data).toLowerCase().includes(e))}return t}_getCounts(){const e={all:this.events.length,conversion:this.events.filter(t=>t.isConversion).length},i=Object.keys(t.PROVIDERS);for(const t of i)e[t]=this.events.filter(e=>e.provider===t).length;return e}_formatTime(t){return t instanceof Date||(t=new Date(t)),isNaN(t.getTime())?"--:--:--":t.toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit",fractionalSecondDigits:3})}_getEventSummary(t){var e,i;const{data:s}=t,a=[];return s.currency&&a.push({label:"Currency",value:s.currency}),void 0!==s.value&&a.push({label:"Value",value:s.value}),s.transaction_id&&a.push({label:"Order",value:s.transaction_id}),(null==(e=s.items)?void 0:e.length)&&a.push({label:"Items",value:s.items.length}),s.item_id&&a.push({label:"Item ID",value:s.item_id}),s.item_name&&a.push({label:"Item",value:s.item_name}),s.content_name&&a.push({label:"Content",value:s.content_name}),(null==(i=s.content_ids)?void 0:i.length)&&a.push({label:"IDs",value:s.content_ids.length}),a}_renderProviderBadges(){const e=["ga4","ga","fbpixel","tiktok","pinterest","snapchat","klaviyo","shopify","webpixel","datalayer"].filter(t=>this._detectedProviders.has(t));return 0===e.length?U`<span style="color: var(--tdt-text-muted); font-size: calc(10px * var(--tdt-scale, 1));">None detected</span>`:U`
5315
+ `]),__publicField(Ea,"COUNTRY_FLAGS",{US:"🇺🇸",CA:"🇨🇦",GB:"🇬🇧",AU:"🇦🇺",DE:"🇩🇪",FR:"🇫🇷",ES:"🇪🇸",IT:"🇮🇹",JP:"🇯🇵",CN:"🇨🇳",BR:"🇧🇷",MX:"🇲🇽",NL:"🇳🇱",SE:"🇸🇪",NO:"🇳🇴",DK:"🇩🇰",FI:"🇫🇮",PL:"🇵🇱",AT:"🇦🇹",CH:"🇨🇭",BE:"🇧🇪",IE:"🇮🇪",NZ:"🇳🇿",SG:"🇸🇬",HK:"🇭🇰",KR:"🇰🇷",IN:"🇮🇳",AE:"🇦🇪",SA:"🇸🇦",ZA:"🇿🇦",PT:"🇵🇹",CZ:"🇨🇿",RO:"🇷🇴",HU:"🇭🇺",IL:"🇮🇱"}),__publicField(Ea,"LANGUAGE_FLAGS",{en:"🇬🇧",es:"🇪🇸",fr:"🇫🇷",de:"🇩🇪",it:"🇮🇹",pt:"🇵🇹",nl:"🇳🇱",pl:"🇵🇱",ja:"🇯🇵",zh:"🇨🇳",ko:"🇰🇷",ar:"🇸🇦",ru:"🇷🇺",sv:"🇸🇪",da:"🇩🇰",fi:"🇫🇮",no:"🇳🇴",cs:"🇨🇿",hu:"🇭🇺",ro:"🇷🇴"});let Aa=Ea;customElements.define("tdt-localization-panel",Aa);const qa=class t extends ot{constructor(){super(),this.events=[],this.dataLayerSnapshots=[],this.filter="",this.activeFilter="all",this.expandedEvents=new Set,this.isPaused=!1,this._detectedProviders=new Set}connectedCallback(){super.connectedCallback(),this._loadPersistedEvents(),this._detectProviders(),this._interceptDataLayer(),this._interceptGtag(),this._interceptGaUniversal(),this._interceptFbPixel(),this._interceptTikTok(),this._interceptPinterest(),this._interceptSnapchat(),this._interceptKlaviyo(),this._interceptShopifyAnalytics(),this._interceptWebPixels(),this._interceptCustomEvents()}disconnectedCallback(){super.disconnectedCallback(),this._restoreInterceptors()}_loadPersistedEvents(){try{const e=sessionStorage.getItem(t.STORAGE_KEY);if(e){const t=JSON.parse(e);this.events=t.map(t=>({...t,timestamp:new Date(t.timestamp),isLive:!1}))}}catch(e){console.warn("[TDT] Failed to load persisted events:",e)}}_persistEvents(){try{const e=this.events.slice(-500).map(t=>({id:t.id,provider:t.provider,eventName:t.eventName,data:this._safeCloneData(t.data),timestamp:t.timestamp.toISOString(),isConversion:t.isConversion,isLive:t.isLive,count:t.count}));sessionStorage.setItem(t.STORAGE_KEY,JSON.stringify(e))}catch(e){console.warn("[TDT] Failed to persist events:",e)}}_safeCloneData(t,e=new WeakSet){if(null===t||"object"!=typeof t)return t;if(e.has(t))return"[Circular]";if(t instanceof Element||t instanceof Node)return"[DOM Element]";if("function"==typeof t)return"[Function]";if(e.add(t),Array.isArray(t))return t.map(t=>this._safeCloneData(t,e));const i={};for(const s of Object.keys(t))try{const a=t[s];if("renderOptions"===s||"host"===s||s.startsWith("__"))continue;i[s]=this._safeCloneData(a,e)}catch{i[s]="[Unserializable]"}return i}_detectProviders(){var t;window.dataLayer&&this._detectedProviders.add("datalayer"),window.gtag&&this._detectedProviders.add("ga4"),window.ga&&this._detectedProviders.add("ga"),window.fbq&&this._detectedProviders.add("fbpixel"),window.ttq&&this._detectedProviders.add("tiktok"),window.pintrk&&this._detectedProviders.add("pinterest"),window.snaptr&&this._detectedProviders.add("snapchat"),window._learnq&&this._detectedProviders.add("klaviyo"),(null==(t=window.Shopify)?void 0:t.analytics)&&this._detectedProviders.add("shopify")}_interceptDataLayer(){window.dataLayer||(window.dataLayer=[]);const t=window.dataLayer.push.bind(window.dataLayer),e=this;window.dataLayer.push=function(...i){return i.forEach(t=>{!e.isPaused&&t&&"object"==typeof t&&e._addEvent("datalayer",t.event||"push",t)}),t(...i)},this._originalDataLayerPush=t,window.dataLayer.forEach(t=>{t&&"object"==typeof t&&this._addEvent("datalayer",t.event||"push",t,!1)})}_interceptGtag(){if(!window.gtag)return;const t=window.gtag,e=this;window.gtag=function(i,...s){if(!e.isPaused)if("event"===i){const[t,i]=s;e._addEvent("ga4",t,i||{}),e._detectedProviders.add("ga4")}else"config"===i&&e._addEvent("ga4","config",{measurementId:s[0],...s[1]});return t.call(this,i,...s)},this._originalGtag=t}_interceptGaUniversal(){if(!window.ga)return;const t=window.ga,e=this;window.ga=function(i,...s){if(!e.isPaused)if("send"===i){const[t,...i]=s;if("event"===t){const[t,s,a,r]=i;e._addEvent("ga",s||"event",{category:t,action:s,label:a,value:r})}else"pageview"===t&&e._addEvent("ga","pageview",{page:i[0]});e._detectedProviders.add("ga")}else"function"==typeof i||"create"===i&&e._addEvent("ga","create",{trackingId:s[0],...s[1]});return t.call(this,i,...s)},this._originalGa=t}_interceptFbPixel(){if(!window.fbq)return;const t=window.fbq,e=this;window.fbq=function(i,...s){if(!e.isPaused)if("track"===i||"trackCustom"===i){const[t,i]=s;e._addEvent("fbpixel",t,i||{}),e._detectedProviders.add("fbpixel")}else"init"===i&&e._addEvent("fbpixel","init",{pixelId:s[0]});return t.call(this,i,...s)},this._originalFbq=t}_interceptTikTok(){if(!window.ttq)return;const t=window.ttq,e=this;if(t.track){const i=t.track.bind(t);t.track=function(t,s){return e.isPaused||(e._addEvent("tiktok",t,s||{}),e._detectedProviders.add("tiktok")),i(t,s)},this._originalTtqTrack=i}if(t.page){const i=t.page.bind(t);t.page=function(){return e.isPaused||(e._addEvent("tiktok","PageView",{}),e._detectedProviders.add("tiktok")),i()},this._originalTtqPage=i}}_interceptPinterest(){if(!window.pintrk)return;const t=window.pintrk,e=this;window.pintrk=function(i,...s){if(!e.isPaused)if("track"===i){const[t,i]=s;e._addEvent("pinterest",t,i||{}),e._detectedProviders.add("pinterest")}else"load"===i&&e._addEvent("pinterest","load",{tagId:s[0]});return t.call(this,i,...s)},this._originalPintrk=t}_interceptSnapchat(){if(!window.snaptr)return;const t=window.snaptr,e=this;window.snaptr=function(i,...s){if(!e.isPaused)if("track"===i){const[t,i]=s;e._addEvent("snapchat",t,i||{}),e._detectedProviders.add("snapchat")}else"init"===i&&e._addEvent("snapchat","init",{pixelId:s[0]});return t.call(this,i,...s)},this._originalSnaptr=t}_interceptKlaviyo(){if(!window._learnq)return;const t=window._learnq,e=this;if(Array.isArray(t)){const i=t.push.bind(t);t.push=function(t){if(!e.isPaused&&Array.isArray(t)){const[i,...s]=t;if("track"===i){const[t,i]=s;e._addEvent("klaviyo",t,i||{}),e._detectedProviders.add("klaviyo")}else"identify"===i&&e._addEvent("klaviyo","identify",s[0]||{})}return i(t)},this._originalLearnqPush=i}}_interceptShopifyAnalytics(){var t;if(!(null==(t=window.Shopify)?void 0:t.analytics))return;const e=window.Shopify.analytics,i=this;if(e.publish){const t=e.publish.bind(e);e.publish=function(e,s){return i.isPaused||(i._addEvent("shopify",e,s||{}),i._detectedProviders.add("shopify")),t(e,s)},this._originalShopifyPublish=t}}_interceptWebPixels(){var t,e;if(!(null==(e=null==(t=window.Shopify)?void 0:t.analytics)?void 0:e.subscribe))return;const i=window.Shopify.analytics,s=this,a=i.subscribe.bind(i);i.subscribe=function(t,e){return a(t,i=>(s.isPaused||(s._addEvent("webpixel",t,i||{}),s._detectedProviders.add("webpixel")),e(i)))},this._originalWebPixelSubscribe=a}_interceptCustomEvents(){const t=this;this._customEventHandler=e=>{!t.isPaused&&e.detail&&t._addEvent("custom",e.type,e.detail)},["analytics","tracking","gtm","conversion"].forEach(t=>{document.addEventListener(t,this._customEventHandler)})}_restoreInterceptors(){this._originalDataLayerPush&&window.dataLayer&&(window.dataLayer.push=this._originalDataLayerPush),this._originalGtag&&(window.gtag=this._originalGtag),this._originalFbq&&(window.fbq=this._originalFbq),["analytics","tracking","gtm","conversion"].forEach(t=>{document.removeEventListener(t,this._customEventHandler)})}_getEventKey(t,e,i){return`${t}:${e}:${JSON.stringify(i,Object.keys(i||{}).sort())}`}_addEvent(e,i,s,a=!0){const r=t.CONVERSION_EVENTS.some(t=>i.toLowerCase().includes(t.toLowerCase())),n=this._getEventKey(e,i,s),o=this.events.find(t=>Date.now()-t.timestamp.getTime()<500&&this._getEventKey(t.provider,t.eventName,t.data)===n);if(o)return o.count=(o.count||1)+1,this.events=[...this.events],void this._persistEvents();const l={id:Date.now()+Math.random(),provider:e,eventName:i,data:s,timestamp:new Date,isConversion:r,isLive:a,count:1};this.events=a?[...this.events,l]:[l,...this.events],a&&this._persistEvents()}_togglePause(){this.isPaused=!this.isPaused}_clearEvents(){this.events=[],sessionStorage.removeItem(t.STORAGE_KEY)}_exportEvents(){const t=this._getFilteredEvents().map(t=>({provider:t.provider,eventName:t.eventName,data:t.data,timestamp:t.timestamp.toISOString(),isConversion:t.isConversion,count:t.count||1})),e=new Blob([JSON.stringify(t,null,2)],{type:"application/json"}),i=URL.createObjectURL(e),s=document.createElement("a");s.href=i,s.download=`analytics-events-${(new Date).toISOString().slice(0,10)}.json`,s.click(),URL.revokeObjectURL(i)}async _copyEvent(t,e){e.stopPropagation();const i={provider:t.provider,eventName:t.eventName,data:t.data,timestamp:t.timestamp.toISOString(),isConversion:t.isConversion};try{await navigator.clipboard.writeText(JSON.stringify(i,null,2));const t=e.target;t.classList.add("btn-copy--copied"),t.textContent="Copied!",setTimeout(()=>{t.classList.remove("btn-copy--copied"),t.textContent="Copy"},1500)}catch(s){console.error("[TDT] Failed to copy event:",s)}}_filterEvents(t){this.filter=t.target.value}_setFilter(t){this.activeFilter=t}_toggleExpand(t){const e=new Set(this.expandedEvents);e.has(t)?e.delete(t):e.add(t),this.expandedEvents=e}_getFilteredEvents(){let t=this.events;if("all"!==this.activeFilter&&(t="conversion"===this.activeFilter?t.filter(t=>t.isConversion):t.filter(t=>t.provider===this.activeFilter)),this.filter){const e=this.filter.toLowerCase();t=t.filter(t=>t.eventName.toLowerCase().includes(e)||JSON.stringify(t.data).toLowerCase().includes(e))}return t}_getCounts(){const e={all:this.events.length,conversion:this.events.filter(t=>t.isConversion).length},i=Object.keys(t.PROVIDERS);for(const t of i)e[t]=this.events.filter(e=>e.provider===t).length;return e}_formatTime(t){return t instanceof Date||(t=new Date(t)),isNaN(t.getTime())?"--:--:--":t.toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit",fractionalSecondDigits:3})}_getEventSummary(t){var e,i;const{data:s}=t,a=[];return s.currency&&a.push({label:"Currency",value:s.currency}),void 0!==s.value&&a.push({label:"Value",value:s.value}),s.transaction_id&&a.push({label:"Order",value:s.transaction_id}),(null==(e=s.items)?void 0:e.length)&&a.push({label:"Items",value:s.items.length}),s.item_id&&a.push({label:"Item ID",value:s.item_id}),s.item_name&&a.push({label:"Item",value:s.item_name}),s.content_name&&a.push({label:"Content",value:s.content_name}),(null==(i=s.content_ids)?void 0:i.length)&&a.push({label:"IDs",value:s.content_ids.length}),a}_renderProviderBadges(){const e=["ga4","ga","fbpixel","tiktok","pinterest","snapchat","klaviyo","shopify","webpixel","datalayer"].filter(t=>this._detectedProviders.has(t));return 0===e.length?U`<span style="color: var(--tdt-text-muted); font-size: calc(10px * var(--tdt-scale, 1));">None detected</span>`:U`
4424
5316
  <div class="detected-providers">
4425
5317
  ${e.map(e=>{const i=t.PROVIDERS[e];return U`
4426
5318
  <span class="provider-badge provider-badge--active">
@@ -4535,7 +5427,7 @@ var __defProp=Object.defineProperty,__defNormalProp=(t,e,i)=>e in t?__defProp(t,
4535
5427
  `})}
4536
5428
  </div>
4537
5429
  `}
4538
- `}};__publicField(Aa,"properties",{events:{type:Array,state:!0},dataLayerSnapshots:{type:Array,state:!0},filter:{type:String,state:!0},activeFilter:{type:String,state:!0},expandedEvents:{type:Set,state:!0},isPaused:{type:Boolean,state:!0}}),__publicField(Aa,"styles",[pt,n`
5430
+ `}};__publicField(qa,"properties",{events:{type:Array,state:!0},dataLayerSnapshots:{type:Array,state:!0},filter:{type:String,state:!0},activeFilter:{type:String,state:!0},expandedEvents:{type:Set,state:!0},isPaused:{type:Boolean,state:!0}}),__publicField(qa,"styles",[pt,n`
4539
5431
  :host {
4540
5432
  display: block;
4541
5433
  padding: 12px;
@@ -4970,7 +5862,7 @@ var __defProp=Object.defineProperty,__defNormalProp=(t,e,i)=>e in t?__defProp(t,
4970
5862
  background: rgba(92, 106, 196, 0.2);
4971
5863
  color: #5c6ac4;
4972
5864
  }
4973
- `]),__publicField(Aa,"CONVERSION_EVENTS",["purchase","add_to_cart","begin_checkout","add_payment_info","add_shipping_info","view_item","view_item_list","select_item","remove_from_cart","view_cart","sign_up","login","search","Purchase","AddToCart","InitiateCheckout","AddPaymentInfo","ViewContent","Lead","CompleteRegistration","Subscribe"]),__publicField(Aa,"PROVIDERS",{ga4:{name:"GA4",color:"#4285f4"},ga:{name:"GA Universal",color:"#e37400"},fbpixel:{name:"FB Pixel",color:"#1877f2"},tiktok:{name:"TikTok",color:"#000000"},pinterest:{name:"Pinterest",color:"#e60023"},snapchat:{name:"Snapchat",color:"#fffc00"},klaviyo:{name:"Klaviyo",color:"#2d2d2d"},shopify:{name:"Shopify",color:"#96bf48"},webpixel:{name:"Web Pixel",color:"#5c6ac4"},datalayer:{name:"DataLayer",color:"#f9ab00"},custom:{name:"Custom",color:"#9382ff"}}),__publicField(Aa,"STORAGE_KEY","tdt-analytics-events");let Oa=Aa;customElements.define("tdt-analytics-panel",Oa);const La=class t extends ot{constructor(){super(),this.metaTags=[],this.jsonLdData=[],this.openGraph={},this.twitterCard={},this.images=[],this.issues=[],this.activeTab="overview",this.headings=[],this.links={internal:[],external:[],nofollow:[]},this.contentStats={},this.copiedField=null,this._expandedSchemas=new Set,this._previewType="google"}connectedCallback(){super.connectedCallback(),this._scanPage()}_scanPage(){this._scanMetaTags(),this._scanOpenGraph(),this._scanTwitterCard(),this._scanJsonLd(),this._scanImages(),this._scanHeadings(),this._scanLinks(),this._analyzeContent(),this._generateIssues()}_scanMetaTags(){var e;const i=[];t.REQUIRED_META.forEach(t=>{const e=document.querySelector(t.selector);let s="";e&&(s=t.attr?e.getAttribute(t.attr):e.textContent);const a=(null==s?void 0:s.length)||0;let r="success",n="";s?t.maxLength&&a>t.maxLength?(r="warning",n=`Too long (${a}/${t.maxLength} chars)`):t.minLength&&a<t.minLength&&(r="warning",n=`Too short (${a}/${t.minLength} min chars)`):(r="error",n="Missing - this tag is required"),i.push({name:t.name,value:s||null,length:a,maxLength:t.maxLength,minLength:t.minLength,status:r,hint:n})});const s=document.querySelector('link[rel="canonical"]');i.push({name:"canonical",value:(null==s?void 0:s.href)||null,status:s?"success":"warning",hint:s?"":"Recommended for SEO"});const a=document.querySelector('meta[name="robots"]');i.push({name:"robots",value:(null==a?void 0:a.content)||null,status:"success",hint:(null==(e=null==a?void 0:a.content)?void 0:e.includes("noindex"))?"⚠️ Page is set to noindex":""}),this.metaTags=i}_scanOpenGraph(){const e={};t.OG_TAGS.forEach(t=>{const i=document.querySelector(`meta[property="${t.name}"]`);e[t.name]={value:(null==i?void 0:i.content)||null,required:t.required}}),this.openGraph=e}_scanTwitterCard(){const e={};t.TWITTER_TAGS.forEach(t=>{const i=document.querySelector(`meta[name="${t.name}"]`);e[t.name]={value:(null==i?void 0:i.content)||null,required:t.required}}),this.twitterCard=e}_scanJsonLd(){const t=document.querySelectorAll('script[type="application/ld+json"]'),e=[];t.forEach((t,i)=>{try{const s=JSON.parse(t.textContent);(Array.isArray(s)?s:[s]).forEach(t=>{e.push({id:`schema-${i}-${e.length}`,type:t["@type"]||"Unknown",data:t,isValid:!0})})}catch(s){e.push({id:`schema-${i}`,type:"Invalid JSON",data:{error:s.message,raw:t.textContent.substring(0,200)},isValid:!1})}}),this.jsonLdData=e}_scanImages(){const t=document.querySelectorAll("img"),e=[];t.forEach((t,i)=>{const s=t.getAttribute("alt"),a=t.src||t.dataset.src;a&&!a.startsWith("data:")&&e.push({id:i,src:a,alt:s,hasAlt:null!==s&&""!==s,width:t.naturalWidth||t.width,height:t.naturalHeight||t.height,loading:t.loading,isLazy:"lazy"===t.loading||t.dataset.src})}),this.images=e}_scanHeadings(){const t=[];document.querySelectorAll("h1, h2, h3, h4, h5, h6").forEach((e,i)=>{var s;const a=parseInt(e.tagName[1]),r=(null==(s=e.textContent)?void 0:s.trim())||"";(null!==e.offsetParent||e.closest('[style*="display: none"]'))&&t.push({id:i,level:a,tag:e.tagName.toLowerCase(),text:r.substring(0,200),isEmpty:!r})}),this.headings=t}_scanLinks(){const t=document.querySelectorAll("a[href]"),e=[],i=[],s=[],a=window.location.hostname;t.forEach((t,r)=>{var n;const o=t.href,l=(null==(n=t.textContent)?void 0:n.trim().substring(0,100))||"",d=t.getAttribute("rel")||"",c=d.includes("nofollow");try{const t=new URL(o),n=t.hostname===a||t.hostname.endsWith("."+a),p={id:r,href:o,text:l,rel:d,isNofollow:c};c&&s.push(p),n?e.push(p):t.protocol.startsWith("http")&&i.push(p)}catch{}}),this.links={internal:e,external:i,nofollow:s}}_analyzeContent(){const t=document.body.innerText||"",e=t.split(/\s+/).filter(t=>t.length>0).length,i=Math.ceil(e/200),s=t.split(/[.!?]+/).filter(t=>t.trim().length>0).length,a=document.querySelectorAll("p").length;this.contentStats={wordCount:e,readingTime:i,sentences:s,paragraphs:a,charCount:t.length}}_generateIssues(){var t,e;const i=[],s=this.metaTags.find(t=>"title"===t.name);(null==s?void 0:s.value)?s.length>60&&i.push({type:"warning",title:"Title too long",description:`Title is ${s.length} characters (recommended: 60 max)`}):i.push({type:"error",title:"Missing page title",description:"Every page should have a unique title tag"});const a=this.metaTags.find(t=>"description"===t.name);(null==a?void 0:a.value)?a.length>160&&i.push({type:"warning",title:"Description too long",description:`Description is ${a.length} characters (recommended: 160 max)`}):i.push({type:"error",title:"Missing meta description",description:"Add a meta description for better SEO"}),(null==(t=this.openGraph["og:image"])?void 0:t.value)||i.push({type:"warning",title:"Missing og:image",description:"Add an Open Graph image for social sharing"}),(null==(e=this.openGraph["og:title"])?void 0:e.value)||i.push({type:"warning",title:"Missing og:title",description:"Add an Open Graph title for social sharing"});const r=this.images.filter(t=>!t.hasAlt);r.length>0&&i.push({type:"warning",title:`${r.length} image${r.length>1?"s":""} missing alt text`,description:"Alt text improves accessibility and SEO"});this.jsonLdData.filter(t=>!t.isValid).length>0&&i.push({type:"error",title:"Invalid JSON-LD schema",description:"Fix JSON syntax errors in structured data"});const n=this.metaTags.find(t=>"canonical"===t.name);(null==n?void 0:n.value)||i.push({type:"warning",title:"Missing canonical URL",description:"Add a canonical link to prevent duplicate content issues"});const o=this.headings.filter(t=>1===t.level).length;0===o?i.push({type:"error",title:"Missing H1 heading",description:"Every page should have exactly one H1 tag"}):o>1&&i.push({type:"warning",title:"Multiple H1 headings",description:`Found ${o} H1 tags. Recommended: 1`});const l=this.headings.map(t=>t.level);for(let d=1;d<l.length;d++)if(l[d]>l[d-1]+1){i.push({type:"warning",title:"Skipped heading level",description:`H${l[d-1]} followed by H${l[d]}. Don't skip levels.`});break}this.issues=i}async _copyValue(t,e){if(t)try{await navigator.clipboard.writeText(t),this.copiedField=e,setTimeout(()=>{this.copiedField=null},1500)}catch(i){console.error("Failed to copy:",i)}}_exportReport(){var t,e,i,s;const a=null==(t=this.metaTags.find(t=>"title"===t.name))?void 0:t.value,r=null==(e=this.metaTags.find(t=>"description"===t.name))?void 0:e.value,n={exportedAt:(new Date).toISOString(),url:window.location.href,score:this._getScore(),meta:{title:{value:a,length:(null==a?void 0:a.length)||0,maxLength:60},description:{value:r,length:(null==r?void 0:r.length)||0,maxLength:160},canonical:null==(i=this.metaTags.find(t=>"canonical"===t.name))?void 0:i.value,robots:null==(s=this.metaTags.find(t=>"robots"===t.name))?void 0:s.value},openGraph:Object.fromEntries(Object.entries(this.openGraph).map(([t,e])=>[t,e.value])),twitterCard:Object.fromEntries(Object.entries(this.twitterCard).map(([t,e])=>[t,e.value])),headings:{structure:this.headings.map(t=>({tag:t.tag,text:t.text})),h1Count:this.headings.filter(t=>1===t.level).length,totalHeadings:this.headings.length},links:{internalCount:this.links.internal.length,externalCount:this.links.external.length,nofollowCount:this.links.nofollow.length,internal:this.links.internal.slice(0,50).map(t=>({href:t.href,text:t.text})),external:this.links.external.slice(0,50).map(t=>({href:t.href,text:t.text}))},content:this.contentStats,images:{total:this.images.length,missingAlt:this.images.filter(t=>!t.hasAlt).length,withAlt:this.images.filter(t=>t.hasAlt).length},schema:this.jsonLdData.map(t=>({type:t.type,isValid:t.isValid,data:t.data})),issues:this.issues},o=new Blob([JSON.stringify(n,null,2)],{type:"application/json"}),l=URL.createObjectURL(o),d=document.createElement("a");d.href=l,d.download=`seo-report-${(new Date).toISOString().slice(0,10)}.json`,d.click(),URL.revokeObjectURL(l)}_getScore(){let t=10;return this.issues.forEach(e=>{"error"===e.type?t-=2:"warning"===e.type&&(t-=1)}),Math.max(0,t)}_getScoreClass(t){return t>=8?"good":t>=5?"warning":"error"}_setTab(t){this.activeTab=t}_setPreviewType(t){this._previewType=t,this.requestUpdate()}_toggleSchema(t){const e=new Set(this._expandedSchemas);e.has(t)?e.delete(t):e.add(t),this._expandedSchemas=e,this.requestUpdate()}_openRichResultsTest(){const t=`https://search.google.com/test/rich-results?url=${encodeURIComponent(window.location.href)}`;window.open(t,"_blank")}_renderOverview(){var t,e;const i=this._getScore(),s=this._getScoreClass(i),a=this.issues.filter(t=>"error"===t.type).length,r=this.issues.filter(t=>"warning"===t.type).length,n=(null==(t=this.metaTags.find(t=>"title"===t.name))?void 0:t.value)||"",o=(null==(e=this.metaTags.find(t=>"description"===t.name))?void 0:e.value)||"";return U`
5865
+ `]),__publicField(qa,"CONVERSION_EVENTS",["purchase","add_to_cart","begin_checkout","add_payment_info","add_shipping_info","view_item","view_item_list","select_item","remove_from_cart","view_cart","sign_up","login","search","Purchase","AddToCart","InitiateCheckout","AddPaymentInfo","ViewContent","Lead","CompleteRegistration","Subscribe"]),__publicField(qa,"PROVIDERS",{ga4:{name:"GA4",color:"#4285f4"},ga:{name:"GA Universal",color:"#e37400"},fbpixel:{name:"FB Pixel",color:"#1877f2"},tiktok:{name:"TikTok",color:"#000000"},pinterest:{name:"Pinterest",color:"#e60023"},snapchat:{name:"Snapchat",color:"#fffc00"},klaviyo:{name:"Klaviyo",color:"#2d2d2d"},shopify:{name:"Shopify",color:"#96bf48"},webpixel:{name:"Web Pixel",color:"#5c6ac4"},datalayer:{name:"DataLayer",color:"#f9ab00"},custom:{name:"Custom",color:"#9382ff"}}),__publicField(qa,"STORAGE_KEY","tdt-analytics-events");let Oa=qa;customElements.define("tdt-analytics-panel",Oa);const za=class t extends ot{constructor(){super(),this.metaTags=[],this.jsonLdData=[],this.openGraph={},this.twitterCard={},this.images=[],this.issues=[],this.activeTab="overview",this.headings=[],this.links={internal:[],external:[],nofollow:[]},this.contentStats={},this.copiedField=null,this._expandedSchemas=new Set,this._previewType="google"}connectedCallback(){super.connectedCallback(),this._scanPage()}_scanPage(){this._scanMetaTags(),this._scanOpenGraph(),this._scanTwitterCard(),this._scanJsonLd(),this._scanImages(),this._scanHeadings(),this._scanLinks(),this._analyzeContent(),this._generateIssues()}_scanMetaTags(){var e;const i=[];t.REQUIRED_META.forEach(t=>{const e=document.querySelector(t.selector);let s="";e&&(s=t.attr?e.getAttribute(t.attr):e.textContent);const a=(null==s?void 0:s.length)||0;let r="success",n="";s?t.maxLength&&a>t.maxLength?(r="warning",n=`Too long (${a}/${t.maxLength} chars)`):t.minLength&&a<t.minLength&&(r="warning",n=`Too short (${a}/${t.minLength} min chars)`):(r="error",n="Missing - this tag is required"),i.push({name:t.name,value:s||null,length:a,maxLength:t.maxLength,minLength:t.minLength,status:r,hint:n})});const s=document.querySelector('link[rel="canonical"]');i.push({name:"canonical",value:(null==s?void 0:s.href)||null,status:s?"success":"warning",hint:s?"":"Recommended for SEO"});const a=document.querySelector('meta[name="robots"]');i.push({name:"robots",value:(null==a?void 0:a.content)||null,status:"success",hint:(null==(e=null==a?void 0:a.content)?void 0:e.includes("noindex"))?"⚠️ Page is set to noindex":""}),this.metaTags=i}_scanOpenGraph(){const e={};t.OG_TAGS.forEach(t=>{const i=document.querySelector(`meta[property="${t.name}"]`);e[t.name]={value:(null==i?void 0:i.content)||null,required:t.required}}),this.openGraph=e}_scanTwitterCard(){const e={};t.TWITTER_TAGS.forEach(t=>{const i=document.querySelector(`meta[name="${t.name}"]`);e[t.name]={value:(null==i?void 0:i.content)||null,required:t.required}}),this.twitterCard=e}_scanJsonLd(){const t=document.querySelectorAll('script[type="application/ld+json"]'),e=[];t.forEach((t,i)=>{try{const s=JSON.parse(t.textContent);(Array.isArray(s)?s:[s]).forEach(t=>{e.push({id:`schema-${i}-${e.length}`,type:t["@type"]||"Unknown",data:t,isValid:!0})})}catch(s){e.push({id:`schema-${i}`,type:"Invalid JSON",data:{error:s.message,raw:t.textContent.substring(0,200)},isValid:!1})}}),this.jsonLdData=e}_scanImages(){const t=document.querySelectorAll("img"),e=[];t.forEach((t,i)=>{const s=t.getAttribute("alt"),a=t.src||t.dataset.src;a&&!a.startsWith("data:")&&e.push({id:i,src:a,alt:s,hasAlt:null!==s&&""!==s,width:t.naturalWidth||t.width,height:t.naturalHeight||t.height,loading:t.loading,isLazy:"lazy"===t.loading||t.dataset.src})}),this.images=e}_scanHeadings(){const t=[];document.querySelectorAll("h1, h2, h3, h4, h5, h6").forEach((e,i)=>{var s;const a=parseInt(e.tagName[1]),r=(null==(s=e.textContent)?void 0:s.trim())||"";(null!==e.offsetParent||e.closest('[style*="display: none"]'))&&t.push({id:i,level:a,tag:e.tagName.toLowerCase(),text:r.substring(0,200),isEmpty:!r})}),this.headings=t}_scanLinks(){const t=document.querySelectorAll("a[href]"),e=[],i=[],s=[],a=window.location.hostname;t.forEach((t,r)=>{var n;const o=t.href,l=(null==(n=t.textContent)?void 0:n.trim().substring(0,100))||"",d=t.getAttribute("rel")||"",c=d.includes("nofollow");try{const t=new URL(o),n=t.hostname===a||t.hostname.endsWith("."+a),p={id:r,href:o,text:l,rel:d,isNofollow:c};c&&s.push(p),n?e.push(p):t.protocol.startsWith("http")&&i.push(p)}catch{}}),this.links={internal:e,external:i,nofollow:s}}_analyzeContent(){const t=document.body.innerText||"",e=t.split(/\s+/).filter(t=>t.length>0).length,i=Math.ceil(e/200),s=t.split(/[.!?]+/).filter(t=>t.trim().length>0).length,a=document.querySelectorAll("p").length;this.contentStats={wordCount:e,readingTime:i,sentences:s,paragraphs:a,charCount:t.length}}_generateIssues(){var t,e;const i=[],s=this.metaTags.find(t=>"title"===t.name);(null==s?void 0:s.value)?s.length>60&&i.push({type:"warning",title:"Title too long",description:`Title is ${s.length} characters (recommended: 60 max)`}):i.push({type:"error",title:"Missing page title",description:"Every page should have a unique title tag"});const a=this.metaTags.find(t=>"description"===t.name);(null==a?void 0:a.value)?a.length>160&&i.push({type:"warning",title:"Description too long",description:`Description is ${a.length} characters (recommended: 160 max)`}):i.push({type:"error",title:"Missing meta description",description:"Add a meta description for better SEO"}),(null==(t=this.openGraph["og:image"])?void 0:t.value)||i.push({type:"warning",title:"Missing og:image",description:"Add an Open Graph image for social sharing"}),(null==(e=this.openGraph["og:title"])?void 0:e.value)||i.push({type:"warning",title:"Missing og:title",description:"Add an Open Graph title for social sharing"});const r=this.images.filter(t=>!t.hasAlt);r.length>0&&i.push({type:"warning",title:`${r.length} image${r.length>1?"s":""} missing alt text`,description:"Alt text improves accessibility and SEO"});this.jsonLdData.filter(t=>!t.isValid).length>0&&i.push({type:"error",title:"Invalid JSON-LD schema",description:"Fix JSON syntax errors in structured data"});const n=this.metaTags.find(t=>"canonical"===t.name);(null==n?void 0:n.value)||i.push({type:"warning",title:"Missing canonical URL",description:"Add a canonical link to prevent duplicate content issues"});const o=this.headings.filter(t=>1===t.level).length;0===o?i.push({type:"error",title:"Missing H1 heading",description:"Every page should have exactly one H1 tag"}):o>1&&i.push({type:"warning",title:"Multiple H1 headings",description:`Found ${o} H1 tags. Recommended: 1`});const l=this.headings.map(t=>t.level);for(let d=1;d<l.length;d++)if(l[d]>l[d-1]+1){i.push({type:"warning",title:"Skipped heading level",description:`H${l[d-1]} followed by H${l[d]}. Don't skip levels.`});break}this.issues=i}async _copyValue(t,e){if(t)try{await navigator.clipboard.writeText(t),this.copiedField=e,setTimeout(()=>{this.copiedField=null},1500)}catch(i){console.error("Failed to copy:",i)}}_exportReport(){var t,e,i,s;const a=null==(t=this.metaTags.find(t=>"title"===t.name))?void 0:t.value,r=null==(e=this.metaTags.find(t=>"description"===t.name))?void 0:e.value,n={exportedAt:(new Date).toISOString(),url:window.location.href,score:this._getScore(),meta:{title:{value:a,length:(null==a?void 0:a.length)||0,maxLength:60},description:{value:r,length:(null==r?void 0:r.length)||0,maxLength:160},canonical:null==(i=this.metaTags.find(t=>"canonical"===t.name))?void 0:i.value,robots:null==(s=this.metaTags.find(t=>"robots"===t.name))?void 0:s.value},openGraph:Object.fromEntries(Object.entries(this.openGraph).map(([t,e])=>[t,e.value])),twitterCard:Object.fromEntries(Object.entries(this.twitterCard).map(([t,e])=>[t,e.value])),headings:{structure:this.headings.map(t=>({tag:t.tag,text:t.text})),h1Count:this.headings.filter(t=>1===t.level).length,totalHeadings:this.headings.length},links:{internalCount:this.links.internal.length,externalCount:this.links.external.length,nofollowCount:this.links.nofollow.length,internal:this.links.internal.slice(0,50).map(t=>({href:t.href,text:t.text})),external:this.links.external.slice(0,50).map(t=>({href:t.href,text:t.text}))},content:this.contentStats,images:{total:this.images.length,missingAlt:this.images.filter(t=>!t.hasAlt).length,withAlt:this.images.filter(t=>t.hasAlt).length},schema:this.jsonLdData.map(t=>({type:t.type,isValid:t.isValid,data:t.data})),issues:this.issues},o=new Blob([JSON.stringify(n,null,2)],{type:"application/json"}),l=URL.createObjectURL(o),d=document.createElement("a");d.href=l,d.download=`seo-report-${(new Date).toISOString().slice(0,10)}.json`,d.click(),URL.revokeObjectURL(l)}_getScore(){let t=10;return this.issues.forEach(e=>{"error"===e.type?t-=2:"warning"===e.type&&(t-=1)}),Math.max(0,t)}_getScoreClass(t){return t>=8?"good":t>=5?"warning":"error"}_setTab(t){this.activeTab=t}_setPreviewType(t){this._previewType=t,this.requestUpdate()}_toggleSchema(t){const e=new Set(this._expandedSchemas);e.has(t)?e.delete(t):e.add(t),this._expandedSchemas=e,this.requestUpdate()}_openRichResultsTest(){const t=`https://search.google.com/test/rich-results?url=${encodeURIComponent(window.location.href)}`;window.open(t,"_blank")}_renderOverview(){var t,e;const i=this._getScore(),s=this._getScoreClass(i),a=this.issues.filter(t=>"error"===t.type).length,r=this.issues.filter(t=>"warning"===t.type).length,n=(null==(t=this.metaTags.find(t=>"title"===t.name))?void 0:t.value)||"",o=(null==(e=this.metaTags.find(t=>"description"===t.name))?void 0:e.value)||"";return U`
4974
5866
  <div class="score-card">
4975
5867
  <div class="score score--${s}">${i}/10</div>
4976
5868
  <div class="score-details">
@@ -5496,7 +6388,7 @@ var __defProp=Object.defineProperty,__defNormalProp=(t,e,i)=>e in t?__defProp(t,
5496
6388
  ${"content"===this.activeTab?this._renderContent():""}
5497
6389
  ${"schema"===this.activeTab?this._renderSchema():""}
5498
6390
  ${"images"===this.activeTab?this._renderImages():""}
5499
- `}};__publicField(La,"properties",{metaTags:{type:Array,state:!0},jsonLdData:{type:Array,state:!0},openGraph:{type:Object,state:!0},twitterCard:{type:Object,state:!0},images:{type:Array,state:!0},issues:{type:Array,state:!0},activeTab:{type:String,state:!0},headings:{type:Array,state:!0},links:{type:Object,state:!0},contentStats:{type:Object,state:!0},copiedField:{type:String,state:!0}}),__publicField(La,"styles",[pt,n`
6391
+ `}};__publicField(za,"properties",{metaTags:{type:Array,state:!0},jsonLdData:{type:Array,state:!0},openGraph:{type:Object,state:!0},twitterCard:{type:Object,state:!0},images:{type:Array,state:!0},issues:{type:Array,state:!0},activeTab:{type:String,state:!0},headings:{type:Array,state:!0},links:{type:Object,state:!0},contentStats:{type:Object,state:!0},copiedField:{type:String,state:!0}}),__publicField(za,"styles",[pt,n`
5500
6392
  :host {
5501
6393
  display: block;
5502
6394
  padding: 12px;
@@ -6381,7 +7273,7 @@ var __defProp=Object.defineProperty,__defNormalProp=(t,e,i)=>e in t?__defProp(t,
6381
7273
  border-color: var(--tdt-accent);
6382
7274
  color: white;
6383
7275
  }
6384
- `]),__publicField(La,"REQUIRED_META",[{name:"title",selector:"title",maxLength:60,minLength:30},{name:"description",selector:'meta[name="description"]',attr:"content",maxLength:160,minLength:70},{name:"viewport",selector:'meta[name="viewport"]',attr:"content"},{name:"charset",selector:"meta[charset]",attr:"charset"}]),__publicField(La,"OG_TAGS",[{name:"og:title",required:!0},{name:"og:description",required:!0},{name:"og:image",required:!0},{name:"og:url",required:!0},{name:"og:type",required:!1},{name:"og:site_name",required:!1}]),__publicField(La,"TWITTER_TAGS",[{name:"twitter:card",required:!0},{name:"twitter:title",required:!1},{name:"twitter:description",required:!1},{name:"twitter:image",required:!1}]);let ja=La;customElements.define("tdt-seo-panel",ja);const za=class t extends ot{constructor(){super(),this.appBlocks=[],this.scripts=[],this.appEmbeds=[],this.pixelScripts=[],this.activeTab="all",this.searchTerm="",this._expandedItems=new Set}connectedCallback(){super.connectedCallback(),this._scanPage()}_scanPage(){this._scanAppBlocks(),this._scanScripts(),this._scanAppEmbeds(),this._categorizeScripts()}_scanAppBlocks(){const t=[];document.querySelectorAll('[data-shopify-editor-block], [data-block-type*="shopify://apps"], .shopify-app-block').forEach((e,i)=>{var s;const a=e.getAttribute("data-block-type")||"",r=e.getAttribute("data-block-id")||e.id||`block-${i}`,n=(null==(s=e.closest("[data-section-id]"))?void 0:s.getAttribute("data-section-id"))||"unknown";let o="Unknown App";const l=a.match(/shopify:\/\/apps\/([^/]+)/);l&&(o=l[1].replace(/-/g," ").replace(/\b\w/g,t=>t.toUpperCase())),t.push({id:r,type:"app-block",name:o,blockType:a,sectionId:n,element:e,tagName:e.tagName.toLowerCase(),classes:Array.from(e.classList).slice(0,5).join(", ")})});document.querySelectorAll('[id*="shopify-block"], [class*="shopify-app"]').forEach((e,i)=>{t.find(t=>t.element===e)||t.push({id:e.id||`theme-block-${i}`,type:"theme-block",name:"Theme App Block",element:e,tagName:e.tagName.toLowerCase(),classes:Array.from(e.classList).slice(0,5).join(", ")})}),this.appBlocks=t}_scanScripts(){const t=[];document.querySelectorAll("script").forEach((e,i)=>{var s;const a=e.src||"",r=e.type||"text/javascript",n=e.async,o=e.defer,l=!a,d=l?null==(s=e.textContent)?void 0:s.substring(0,500):"";if(l&&!(null==d?void 0:d.trim()))return;const c=this._identifyVendor(a||d),p=this._isPixelScript(a,d),u=this._isShopifyCoreScript(a),h=this._extractVersion(a,d);u&&!p||t.push({id:`script-${i}`,src:a,type:r,isAsync:n,isDefer:o,isInline:l,content:d,vendor:c,isPixel:p,version:h,element:e,size:l?new Blob([d]).size:null})}),this.scripts=t}_scanAppEmbeds(){const t=[];document.querySelectorAll("[data-app-embed], [data-shopify-app-embed], .shopify-app-embed").forEach((e,i)=>{const s=e.getAttribute("data-app-embed")||e.getAttribute("data-shopify-app-embed")||"";t.push({id:`embed-${i}`,type:"embed",appId:s,element:e,tagName:e.tagName.toLowerCase(),position:this._getPosition(e)})});document.querySelectorAll('[style*="position: fixed"], [style*="position:fixed"]').forEach((e,i)=>{if(e.closest("theme-devtools"))return;const s=this._identifyVendorFromElement(e);if(s){t.find(t=>t.element===e)||t.push({id:`widget-${i}`,type:"widget",name:s.name,vendor:s.key,element:e,tagName:e.tagName.toLowerCase(),position:this._getPosition(e)})}}),this.appEmbeds=t}_categorizeScripts(){this.pixelScripts=this.scripts.filter(t=>t.isPixel)}_extractVersion(t,e=""){const i=[/[?&/]v(\d+\.\d+(?:\.\d+)?)/i,/version[=:](\d+\.\d+(?:\.\d+)?)/i,/@(\d+\.\d+(?:\.\d+)?)/,/\/(\d+\.\d+\.\d+)\//,/[-.](\d+\.\d+\.\d+)\.(?:min\.)?js/i,/_v(\d+\.\d+(?:\.\d+)?)/i];for(const s of i){const e=t.match(s);if(e)return e[1]}if(e){const t=[/version['":\s]+['"]?(\d+\.\d+(?:\.\d+)?)/i,/VERSION\s*[=:]\s*['"](\d+\.\d+(?:\.\d+)?)/i,/\bv(\d+\.\d+\.\d+)\b/,/shopify-(\d+\.\d+\.\d+)/i];for(const i of t){const t=e.match(i);if(t)return t[1]}}return null}_identifyVendor(e){const i=e.toLowerCase();for(const[s,a]of Object.entries(t.KNOWN_APPS))if(a.patterns.some(t=>i.includes(t)))return{key:s,...a};return null}_identifyVendorFromElement(e){var i,s,a;const r=(null==(i=e.className)?void 0:i.toLowerCase())||"",n=(null==(s=e.id)?void 0:s.toLowerCase())||"",o=(null==(a=e.innerHTML)?void 0:a.substring(0,1e3).toLowerCase())||"";for(const[l,d]of Object.entries(t.KNOWN_APPS))if(d.patterns.some(t=>r.includes(t)||n.includes(t)||o.includes(t)))return{key:l,...d};return null}_isPixelScript(t,e){const i=(t+e).toLowerCase();return["fbevents","facebook","pixel","gtag","gtm.js","googletagmanager","google-analytics","analytics.tiktok","tiktok","pintrk","pinterest","snapchat","sc-static","monorail","trekkie"].some(t=>i.includes(t))}_isShopifyCoreScript(t){return["cdn.shopify.com/shopifycloud","cdn.shopify.com/s/files","/assets/"].some(e=>t.includes(e))}_getPosition(t){t.getBoundingClientRect();const e=window.getComputedStyle(t);return{top:e.top,right:e.right,bottom:e.bottom,left:e.left,position:e.position}}_toggleExpand(t){this._expandedItems.has(t)?this._expandedItems.delete(t):this._expandedItems.add(t),this.requestUpdate()}_highlightElement(t){if(!t)return;t.scrollIntoView({behavior:"smooth",block:"center"});const e=t.style.outline,i=t.style.transition;t.style.transition="outline 0.2s ease",t.style.outline="3px solid #3b82f6",setTimeout(()=>{t.style.outline=e,t.style.transition=i},2e3)}_copyToClipboard(t){navigator.clipboard.writeText(t).then(()=>{this._showFeedback("Copied!")})}_showFeedback(t){const e=new CustomEvent("show-feedback",{detail:{message:t},bubbles:!0,composed:!0});this.dispatchEvent(e)}_setActiveTab(t){this.activeTab=t}_handleSearch(t){this.searchTerm=t.target.value}_getFilteredItems(){const t=this.searchTerm.toLowerCase();let e=[];return"all"!==this.activeTab&&"blocks"!==this.activeTab||(e=[...e,...this.appBlocks.map(t=>({...t,category:"block"}))]),"all"!==this.activeTab&&"scripts"!==this.activeTab||(e=[...e,...this.scripts.filter(t=>!t.isPixel).map(t=>({...t,category:"script"}))]),"all"!==this.activeTab&&"pixels"!==this.activeTab||(e=[...e,...this.pixelScripts.map(t=>({...t,category:"pixel"}))]),"all"!==this.activeTab&&"embeds"!==this.activeTab||(e=[...e,...this.appEmbeds.map(t=>({...t,category:"embed"}))]),t&&(e=e.filter(e=>this._matchesSearch(e,t))),e}_matchesSearch(t,e){var i;if((t.name||(null==(i=t.vendor)?void 0:i.name)||"").toLowerCase().includes(e))return!0;if((t.src||"").toLowerCase().includes(e))return!0;if((t.blockType||"").toLowerCase().includes(e))return!0;if((t.appId||"").toLowerCase().includes(e))return!0;if((t.content||"").toLowerCase().includes(e))return!0;if((t.classes||"").toLowerCase().includes(e))return!0;return!!(t.version||"").toLowerCase().includes(e)}_getVendorIcon(t){return t?U`<span class="vendor-icon vendor-icon--${t.key}">${t.icon}</span>`:U`<span class="vendor-icon vendor-icon--unknown">?</span>`}_renderItem(t){const e=this._expandedItems.has(t.id),i=t.vendor,s=t.name||(null==i?void 0:i.name)||this._extractNameFromSrc(t.src)||"Unknown";return U`
7276
+ `]),__publicField(za,"REQUIRED_META",[{name:"title",selector:"title",maxLength:60,minLength:30},{name:"description",selector:'meta[name="description"]',attr:"content",maxLength:160,minLength:70},{name:"viewport",selector:'meta[name="viewport"]',attr:"content"},{name:"charset",selector:"meta[charset]",attr:"charset"}]),__publicField(za,"OG_TAGS",[{name:"og:title",required:!0},{name:"og:description",required:!0},{name:"og:image",required:!0},{name:"og:url",required:!0},{name:"og:type",required:!1},{name:"og:site_name",required:!1}]),__publicField(za,"TWITTER_TAGS",[{name:"twitter:card",required:!0},{name:"twitter:title",required:!1},{name:"twitter:description",required:!1},{name:"twitter:image",required:!1}]);let ja=za;customElements.define("tdt-seo-panel",ja);const La=class t extends ot{constructor(){super(),this.appBlocks=[],this.scripts=[],this.appEmbeds=[],this.pixelScripts=[],this.activeTab="all",this.searchTerm="",this._expandedItems=new Set}connectedCallback(){super.connectedCallback(),this._scanPage()}_scanPage(){this._scanAppBlocks(),this._scanScripts(),this._scanAppEmbeds(),this._categorizeScripts()}_scanAppBlocks(){const t=[];document.querySelectorAll('[data-shopify-editor-block], [data-block-type*="shopify://apps"], .shopify-app-block').forEach((e,i)=>{var s;const a=e.getAttribute("data-block-type")||"",r=e.getAttribute("data-block-id")||e.id||`block-${i}`,n=(null==(s=e.closest("[data-section-id]"))?void 0:s.getAttribute("data-section-id"))||"unknown";let o="Unknown App";const l=a.match(/shopify:\/\/apps\/([^/]+)/);l&&(o=l[1].replace(/-/g," ").replace(/\b\w/g,t=>t.toUpperCase())),t.push({id:r,type:"app-block",name:o,blockType:a,sectionId:n,element:e,tagName:e.tagName.toLowerCase(),classes:Array.from(e.classList).slice(0,5).join(", ")})});document.querySelectorAll('[id*="shopify-block"], [class*="shopify-app"]').forEach((e,i)=>{t.find(t=>t.element===e)||t.push({id:e.id||`theme-block-${i}`,type:"theme-block",name:"Theme App Block",element:e,tagName:e.tagName.toLowerCase(),classes:Array.from(e.classList).slice(0,5).join(", ")})}),this.appBlocks=t}_scanScripts(){const t=[];document.querySelectorAll("script").forEach((e,i)=>{var s;const a=e.src||"",r=e.type||"text/javascript",n=e.async,o=e.defer,l=!a,d=l?null==(s=e.textContent)?void 0:s.substring(0,500):"";if(l&&!(null==d?void 0:d.trim()))return;const c=this._identifyVendor(a||d),p=this._isPixelScript(a,d),u=this._isShopifyCoreScript(a),h=this._extractVersion(a,d);u&&!p||t.push({id:`script-${i}`,src:a,type:r,isAsync:n,isDefer:o,isInline:l,content:d,vendor:c,isPixel:p,version:h,element:e,size:l?new Blob([d]).size:null})}),this.scripts=t}_scanAppEmbeds(){const t=[];document.querySelectorAll("[data-app-embed], [data-shopify-app-embed], .shopify-app-embed").forEach((e,i)=>{const s=e.getAttribute("data-app-embed")||e.getAttribute("data-shopify-app-embed")||"";t.push({id:`embed-${i}`,type:"embed",appId:s,element:e,tagName:e.tagName.toLowerCase(),position:this._getPosition(e)})});document.querySelectorAll('[style*="position: fixed"], [style*="position:fixed"]').forEach((e,i)=>{if(e.closest("theme-devtools"))return;const s=this._identifyVendorFromElement(e);if(s){t.find(t=>t.element===e)||t.push({id:`widget-${i}`,type:"widget",name:s.name,vendor:s.key,element:e,tagName:e.tagName.toLowerCase(),position:this._getPosition(e)})}}),this.appEmbeds=t}_categorizeScripts(){this.pixelScripts=this.scripts.filter(t=>t.isPixel)}_extractVersion(t,e=""){const i=[/[?&/]v(\d+\.\d+(?:\.\d+)?)/i,/version[=:](\d+\.\d+(?:\.\d+)?)/i,/@(\d+\.\d+(?:\.\d+)?)/,/\/(\d+\.\d+\.\d+)\//,/[-.](\d+\.\d+\.\d+)\.(?:min\.)?js/i,/_v(\d+\.\d+(?:\.\d+)?)/i];for(const s of i){const e=t.match(s);if(e)return e[1]}if(e){const t=[/version['":\s]+['"]?(\d+\.\d+(?:\.\d+)?)/i,/VERSION\s*[=:]\s*['"](\d+\.\d+(?:\.\d+)?)/i,/\bv(\d+\.\d+\.\d+)\b/,/shopify-(\d+\.\d+\.\d+)/i];for(const i of t){const t=e.match(i);if(t)return t[1]}}return null}_identifyVendor(e){const i=e.toLowerCase();for(const[s,a]of Object.entries(t.KNOWN_APPS))if(a.patterns.some(t=>i.includes(t)))return{key:s,...a};return null}_identifyVendorFromElement(e){var i,s,a;const r=(null==(i=e.className)?void 0:i.toLowerCase())||"",n=(null==(s=e.id)?void 0:s.toLowerCase())||"",o=(null==(a=e.innerHTML)?void 0:a.substring(0,1e3).toLowerCase())||"";for(const[l,d]of Object.entries(t.KNOWN_APPS))if(d.patterns.some(t=>r.includes(t)||n.includes(t)||o.includes(t)))return{key:l,...d};return null}_isPixelScript(t,e){const i=(t+e).toLowerCase();return["fbevents","facebook","pixel","gtag","gtm.js","googletagmanager","google-analytics","analytics.tiktok","tiktok","pintrk","pinterest","snapchat","sc-static","monorail","trekkie"].some(t=>i.includes(t))}_isShopifyCoreScript(t){return["cdn.shopify.com/shopifycloud","cdn.shopify.com/s/files","/assets/"].some(e=>t.includes(e))}_getPosition(t){t.getBoundingClientRect();const e=window.getComputedStyle(t);return{top:e.top,right:e.right,bottom:e.bottom,left:e.left,position:e.position}}_toggleExpand(t){this._expandedItems.has(t)?this._expandedItems.delete(t):this._expandedItems.add(t),this.requestUpdate()}_highlightElement(t){if(!t)return;t.scrollIntoView({behavior:"smooth",block:"center"});const e=t.style.outline,i=t.style.transition;t.style.transition="outline 0.2s ease",t.style.outline="3px solid #3b82f6",setTimeout(()=>{t.style.outline=e,t.style.transition=i},2e3)}_copyToClipboard(t){navigator.clipboard.writeText(t).then(()=>{this._showFeedback("Copied!")})}_showFeedback(t){const e=new CustomEvent("show-feedback",{detail:{message:t},bubbles:!0,composed:!0});this.dispatchEvent(e)}_setActiveTab(t){this.activeTab=t}_handleSearch(t){this.searchTerm=t.target.value}_getFilteredItems(){const t=this.searchTerm.toLowerCase();let e=[];return"all"!==this.activeTab&&"blocks"!==this.activeTab||(e=[...e,...this.appBlocks.map(t=>({...t,category:"block"}))]),"all"!==this.activeTab&&"scripts"!==this.activeTab||(e=[...e,...this.scripts.filter(t=>!t.isPixel).map(t=>({...t,category:"script"}))]),"all"!==this.activeTab&&"pixels"!==this.activeTab||(e=[...e,...this.pixelScripts.map(t=>({...t,category:"pixel"}))]),"all"!==this.activeTab&&"embeds"!==this.activeTab||(e=[...e,...this.appEmbeds.map(t=>({...t,category:"embed"}))]),t&&(e=e.filter(e=>this._matchesSearch(e,t))),e}_matchesSearch(t,e){var i;if((t.name||(null==(i=t.vendor)?void 0:i.name)||"").toLowerCase().includes(e))return!0;if((t.src||"").toLowerCase().includes(e))return!0;if((t.blockType||"").toLowerCase().includes(e))return!0;if((t.appId||"").toLowerCase().includes(e))return!0;if((t.content||"").toLowerCase().includes(e))return!0;if((t.classes||"").toLowerCase().includes(e))return!0;return!!(t.version||"").toLowerCase().includes(e)}_getVendorIcon(t){return t?U`<span class="vendor-icon vendor-icon--${t.key}">${t.icon}</span>`:U`<span class="vendor-icon vendor-icon--unknown">?</span>`}_renderItem(t){const e=this._expandedItems.has(t.id),i=t.vendor,s=t.name||(null==i?void 0:i.name)||this._extractNameFromSrc(t.src)||"Unknown";return U`
6385
7277
  <div class="item item--${"pixel"===t.category?"warning":"embed"===t.category?"success":"info"}">
6386
7278
  <div class="item__header" @click=${()=>this._toggleExpand(t.id)}>
6387
7279
  <div class="item__main">
@@ -6552,7 +7444,7 @@ var __defProp=Object.defineProperty,__defNormalProp=(t,e,i)=>e in t?__defProp(t,
6552
7444
  ${t.map(t=>this._renderItem(t))}
6553
7445
  </div>
6554
7446
  `}
6555
- `}};__publicField(za,"properties",{appBlocks:{type:Array,state:!0},scripts:{type:Array,state:!0},appEmbeds:{type:Array,state:!0},pixelScripts:{type:Array,state:!0},activeTab:{type:String,state:!0},searchTerm:{type:String,state:!0}}),__publicField(za,"styles",[pt,n`
7447
+ `}};__publicField(La,"properties",{appBlocks:{type:Array,state:!0},scripts:{type:Array,state:!0},appEmbeds:{type:Array,state:!0},pixelScripts:{type:Array,state:!0},activeTab:{type:String,state:!0},searchTerm:{type:String,state:!0}}),__publicField(La,"styles",[pt,n`
6556
7448
  :host {
6557
7449
  display: block;
6558
7450
  padding: 12px;
@@ -6954,7 +7846,7 @@ var __defProp=Object.defineProperty,__defNormalProp=(t,e,i)=>e in t?__defProp(t,
6954
7846
  .vendor-icon--pinterest { background: #e60023; color: white; }
6955
7847
  .vendor-icon--hotjar { background: #fd3a5c; color: white; }
6956
7848
  .vendor-icon--unknown { background: var(--tdt-bg-secondary); color: var(--tdt-text-muted); }
6957
- `]),__publicField(za,"KNOWN_APPS",{klaviyo:{name:"Klaviyo",icon:"K",patterns:["klaviyo","klviyo"]},judgeme:{name:"Judge.me",icon:"J",patterns:["judge.me","judgeme"]},yotpo:{name:"Yotpo",icon:"Y",patterns:["yotpo"]},loox:{name:"Loox",icon:"L",patterns:["loox"]},stamped:{name:"Stamped",icon:"S",patterns:["stamped"]},okendo:{name:"Okendo",icon:"O",patterns:["okendo"]},"reviews-io":{name:"Reviews.io",icon:"R",patterns:["reviews.io","reviewsio"]},trustpilot:{name:"Trustpilot",icon:"T",patterns:["trustpilot"]},bazaarvoice:{name:"Bazaarvoice",icon:"B",patterns:["bazaarvoice","bvapi"]},recharge:{name:"ReCharge",icon:"R",patterns:["recharge","rechargepayments"]},bold:{name:"Bold",icon:"B",patterns:["boldapps","boldcommerce"]},afterpay:{name:"Afterpay",icon:"A",patterns:["afterpay","portal.afterpay"]},klarna:{name:"Klarna",icon:"K",patterns:["klarna"]},affirm:{name:"Affirm",icon:"A",patterns:["affirm"]},sezzle:{name:"Sezzle",icon:"S",patterns:["sezzle"]},clearpay:{name:"Clearpay",icon:"C",patterns:["clearpay"]},zip:{name:"Zip",icon:"Z",patterns:["quadpay","zip.co"]},paypal:{name:"PayPal",icon:"P",patterns:["paypal","paypalobjects"]},stripe:{name:"Stripe",icon:"S",patterns:["stripe.com","js.stripe"]},privy:{name:"Privy",icon:"P",patterns:["privy"]},omnisend:{name:"Omnisend",icon:"O",patterns:["omnisend"]},mailchimp:{name:"Mailchimp",icon:"M",patterns:["mailchimp","chimpstatic"]},drip:{name:"Drip",icon:"D",patterns:["getdrip","drip.com"]},attentive:{name:"Attentive",icon:"A",patterns:["attentive","attn.tv"]},postscript:{name:"Postscript",icon:"P",patterns:["postscript"]},sendlane:{name:"Sendlane",icon:"S",patterns:["sendlane"]},retention:{name:"Retention.com",icon:"R",patterns:["retention.com"]},smile:{name:"Smile.io",icon:"S",patterns:["smile.io","smileio"]},loyaltylion:{name:"LoyaltyLion",icon:"L",patterns:["loyaltylion"]},"yotpo-loyalty":{name:"Yotpo Loyalty",icon:"Y",patterns:["yotpo-loyalty","swell.is"]},"rise-ai":{name:"Rise.ai",icon:"R",patterns:["rise.ai","riseai"]},gorgias:{name:"Gorgias",icon:"G",patterns:["gorgias"]},zendesk:{name:"Zendesk",icon:"Z",patterns:["zendesk","zopim"]},tidio:{name:"Tidio",icon:"T",patterns:["tidio"]},intercom:{name:"Intercom",icon:"I",patterns:["intercom"]},freshdesk:{name:"Freshdesk",icon:"F",patterns:["freshdesk","freshchat"]},livechat:{name:"LiveChat",icon:"L",patterns:["livechat","livechatinc"]},crisp:{name:"Crisp",icon:"C",patterns:["crisp.chat"]},drift:{name:"Drift",icon:"D",patterns:["drift.com","driftt"]},reamaze:{name:"Reamaze",icon:"R",patterns:["reamaze"]},hotjar:{name:"Hotjar",icon:"H",patterns:["hotjar"]},facebook:{name:"Meta Pixel",icon:"M",patterns:["facebook","fbevents","connect.facebook"]},google:{name:"Google",icon:"G",patterns:["googletagmanager","google-analytics","gtag","gtm.js"]},tiktok:{name:"TikTok",icon:"T",patterns:["tiktok","analytics.tiktok"]},pinterest:{name:"Pinterest",icon:"P",patterns:["pintrk","pinterest"]},snapchat:{name:"Snapchat",icon:"S",patterns:["snapchat","sc-static"]},shopify:{name:"Shopify",icon:"S",patterns:["shopify","cdn.shopify","monorail-edge"]},segment:{name:"Segment",icon:"S",patterns:["segment.com","segment.io"]},heap:{name:"Heap",icon:"H",patterns:["heap-analytics","heapanalytics"]},mixpanel:{name:"Mixpanel",icon:"M",patterns:["mixpanel"]},fullstory:{name:"FullStory",icon:"F",patterns:["fullstory"]},"lucky-orange":{name:"Lucky Orange",icon:"L",patterns:["luckyorange"]},clarity:{name:"Microsoft Clarity",icon:"C",patterns:["clarity.ms"]},reddit:{name:"Reddit Pixel",icon:"R",patterns:["redditmedia","reddit.com/pixel"]},twitter:{name:"Twitter Pixel",icon:"T",patterns:["static.ads-twitter","analytics.twitter"]},criteo:{name:"Criteo",icon:"C",patterns:["criteo"]},taboola:{name:"Taboola",icon:"T",patterns:["taboola"]},pagefly:{name:"PageFly",icon:"P",patterns:["pagefly"]},shogun:{name:"Shogun",icon:"S",patterns:["getshogun","shogun"]},gempage:{name:"GemPages",icon:"G",patterns:["gempages"]},zipify:{name:"Zipify",icon:"Z",patterns:["zipify"]},rebuy:{name:"Rebuy",icon:"R",patterns:["rebuyengine","rebuy"]},"recom-ai":{name:"Recom.ai",icon:"R",patterns:["recom.ai"]},"frequently-bought":{name:"Frequently Bought",icon:"F",patterns:["frequently-bought","also-bought"]},honeycomb:{name:"Honeycomb",icon:"H",patterns:["honeycomb-upsell"]},"candy-rack":{name:"Candy Rack",icon:"C",patterns:["candy-rack","candyrack"]},reconvert:{name:"ReConvert",icon:"R",patterns:["reconvert"]},shipstation:{name:"ShipStation",icon:"S",patterns:["shipstation"]},shippo:{name:"Shippo",icon:"S",patterns:["goshippo"]},easyship:{name:"Easyship",icon:"E",patterns:["easyship"]},aftership:{name:"AfterShip",icon:"A",patterns:["aftership"]},route:{name:"Route",icon:"R",patterns:["route.com","routeapp"]},justuno:{name:"Justuno",icon:"J",patterns:["justuno"]},optinmonster:{name:"OptinMonster",icon:"O",patterns:["optinmonster"]},wisepops:{name:"Wisepops",icon:"W",patterns:["wisepops"]},wheelio:{name:"Wheelio",icon:"W",patterns:["wheelio"]},"spin-a-sale":{name:"Spin-a-Sale",icon:"S",patterns:["spin-a-sale","spinasale"]},fomo:{name:"Fomo",icon:"F",patterns:["fomo.com","usefomo"]},nudgify:{name:"Nudgify",icon:"N",patterns:["nudgify"]},proof:{name:"Proof",icon:"P",patterns:["useproof"]},fera:{name:"Fera",icon:"F",patterns:["fera.ai"]},searchspring:{name:"Searchspring",icon:"S",patterns:["searchspring"]},algolia:{name:"Algolia",icon:"A",patterns:["algolia"]},"boost-commerce":{name:"Boost Commerce",icon:"B",patterns:["boost-commerce","boostcommerce"]},klevu:{name:"Klevu",icon:"K",patterns:["klevu"]},elfsight:{name:"Elfsight",icon:"E",patterns:["elfsight","static.elfsight"]},instafeed:{name:"Instafeed",icon:"I",patterns:["instafeed"]},beeketing:{name:"Beeketing",icon:"B",patterns:["beeketing"]},vitals:{name:"Vitals",icon:"V",patterns:["vitals.co","vitalsapp"]},hextom:{name:"Hextom",icon:"H",patterns:["hextom"]},"cart-upsell":{name:"Cart Upsell",icon:"C",patterns:["incart-upsell"]}});let qa=za;customElements.define("tdt-apps-panel",qa);const Pa=[/\/cart\.js$/,/\/cart\/(add|update|change|clear)\.js/,/\/products\/[^/]+\.js$/,/\/collections\/[^/]+\.js$/,/\/search/,/\/recommendations\/products/,/\/api\/\d+(-\d+)?\/graphql\.json/,/\/variants\.js/,/\/localization\.json/];function Ia(t){return/\/cart\/(add|update|change|clear)\.js/.test(t)?"cart-mutation":/\/cart\.js/.test(t)?"cart":/\/products\//.test(t)?"product":/\/collections\//.test(t)?"collection":/\/search/.test(t)?"search":/\/recommendations/.test(t)?"recommendation":/graphql/.test(t)?"graphql":/\/localization/.test(t)?"localization":"other"}function Ra(t){try{const e=new URL(t,window.location.origin),i=e.pathname;if(/\/cart\/(add|update|change|clear)\.js/.test(i)){return`cart/${i.match(/\/cart\/(\w+)\.js/)[1]}.js`}if(/\/cart\.js$/.test(i))return"cart.js";if(/\/products\//.test(i)){const t=i.match(/\/products\/([^/]+)\.js/);return t?`products/${t[1]}.js`:i}if(/\/collections\//.test(i)){const t=i.match(/\/collections\/([^/]+)\.js/);return t?`collections/${t[1]}.js`:i}if(/\/search/.test(i)){const t=e.searchParams.get("q");return t?`search?q=${t.substring(0,20)}${t.length>20?"...":""}`:"search"}return/graphql/.test(i)?"graphql":/\/recommendations/.test(i)?"recommendations":/\/localization/.test(i)?"localization.json":i}catch{return t}}function Na(t){try{const e=new URL(t,window.location.origin).pathname;return Pa.some(t=>t.test(e))}catch{return!1}}async function Da(t){try{const e=await t("/cart.js",{headers:{Accept:"application/json"},_tdtInternal:!0});return await e.json()}catch{return null}}function Fa(){return`req_${Date.now()}_${Math.random().toString(36).substr(2,9)}`}const Ma="tdt_network_requests";const Ha=new class{constructor(){this.requests=[],this.listeners=new Set,this._originalFetch=null,this._originalXHROpen=null,this._originalXHRSend=null,this._installed=!1,this._staleTimeout=3e4,this._loadFromStorage()}_loadFromStorage(){try{const t=localStorage.getItem(Ma);if(t){const e=JSON.parse(t);this.requests=e.map(t=>({...t,startTime:new Date(t.startTime),endTime:t.endTime?new Date(t.endTime):null,status:(t.status,"stale")}))}}catch(t){console.error("[TDT Network] Failed to load from storage:",t),this.requests=[]}}_saveToStorage(){try{const t=this.requests.filter(t=>"pending"!==t.status).slice(0,32).map(t=>({...t,startTime:t.startTime instanceof Date?t.startTime.toISOString():t.startTime,endTime:t.endTime instanceof Date?t.endTime.toISOString():t.endTime,cartBefore:null,cartAfter:null}));localStorage.setItem(Ma,JSON.stringify(t))}catch(t){console.error("[TDT Network] Failed to save to storage:",t)}}install(){this._installed||(this._interceptFetch(),this._interceptXHR(),this._installed=!0,this._staleInterval=setInterval(()=>this._checkStale(),5e3))}uninstall(){this._installed&&(this._originalFetch&&(window.fetch=this._originalFetch),this._originalXHROpen&&(XMLHttpRequest.prototype.open=this._originalXHROpen),this._originalXHRSend&&(XMLHttpRequest.prototype.send=this._originalXHRSend),this._staleInterval&&clearInterval(this._staleInterval),this._installed=!1)}_interceptFetch(){this._originalFetch=window.fetch;const t=this;window.fetch=async function(e,i={}){const s="string"==typeof e?e:e.url;if(!Na(s)||function(t){var e;return"true"===(null==(e=null==t?void 0:t.headers)?void 0:e["X-TDT-Internal"])||!0===(null==t?void 0:t._tdtInternal)}(i))return t._originalFetch.apply(this,arguments);const a=Fa(),r=i.method||"GET";let n=null;if(i.body)try{"string"==typeof i.body?n=i.body:(i.body instanceof FormData||i.body instanceof URLSearchParams)&&(n=Object.fromEntries(i.body.entries()))}catch{n="[Unable to parse body]"}const o=function(t){return/\/cart\/(add|update|change|clear)\.js/.test(t)}(s);let l=null;o&&(l=await Da(t._originalFetch));const d={id:a,url:s,fullUrl:new URL(s,window.location.origin).href,displayName:Ra(s),method:r.toUpperCase(),category:Ia(s),startTime:new Date,endTime:null,duration:null,status:"pending",statusCode:null,requestBody:n,requestHeaders:i.headers?Object.fromEntries(new Headers(i.headers).entries()):{},responseBody:null,responseHeaders:{},error:null,cartBefore:l,cartAfter:null,cartDiff:null};t._addRequest(d);try{const e=await t._originalFetch.apply(this,arguments),i=e.clone();d.endTime=new Date,d.duration=d.endTime-d.startTime,d.statusCode=e.status,d.status=e.ok?"success":"error",d.responseHeaders=Object.fromEntries(e.headers.entries());try{(e.headers.get("content-type")||"").includes("application/json")?d.responseBody=await i.json():d.responseBody=await i.text()}catch{d.responseBody="[Unable to parse response]"}if(o&&e.ok){const e=await Da(t._originalFetch);e&&(d.cartAfter=e,d.cartDiff=t._calculateCartDiff(l,e))}return t._updateRequest(d),e}catch(c){throw d.endTime=new Date,d.duration=d.endTime-d.startTime,d.status="error",d.error=c.message,t._updateRequest(d),c}}}_interceptXHR(){this._originalXHROpen=XMLHttpRequest.prototype.open,this._originalXHRSend=XMLHttpRequest.prototype.send;const t=this;XMLHttpRequest.prototype.open=function(e,i){return this._tdtUrl=i,this._tdtMethod=e,t._originalXHROpen.apply(this,arguments)},XMLHttpRequest.prototype.send=function(e){const i=this._tdtUrl;if(!Na(i))return t._originalXHRSend.apply(this,arguments);const s=Fa();let a=null;if(e)try{"string"==typeof e?a=e:e instanceof FormData&&(a=Object.fromEntries(e.entries()))}catch{a="[Unable to parse body]"}const r={id:s,url:i,fullUrl:new URL(i,window.location.origin).href,displayName:Ra(i),method:(this._tdtMethod||"GET").toUpperCase(),category:Ia(i),startTime:new Date,endTime:null,duration:null,status:"pending",statusCode:null,requestBody:a,requestHeaders:{},responseBody:null,responseHeaders:{},error:null};return t._addRequest(r),this.addEventListener("load",function(){r.endTime=new Date,r.duration=r.endTime-r.startTime,r.statusCode=this.status,r.status=this.status>=200&&this.status<300?"success":"error";const e=this.getAllResponseHeaders();e&&e.split("\r\n").forEach(t=>{const e=t.split(": ");2===e.length&&(r.responseHeaders[e[0].toLowerCase()]=e[1])});try{(this.getResponseHeader("content-type")||"").includes("application/json")?r.responseBody=JSON.parse(this.responseText):r.responseBody=this.responseText}catch{r.responseBody=this.responseText||"[Unable to parse response]"}t._updateRequest(r)}),this.addEventListener("error",function(){r.endTime=new Date,r.duration=r.endTime-r.startTime,r.status="error",r.error="Network error",t._updateRequest(r)}),this.addEventListener("abort",function(){r.endTime=new Date,r.duration=r.endTime-r.startTime,r.status="error",r.error="Request aborted",t._updateRequest(r)}),t._originalXHRSend.apply(this,arguments)}}_calculateCartDiff(t,e){var i,s;if(!e)return null;const a={itemsBefore:(null==t?void 0:t.item_count)||0,itemsAfter:e.item_count||0,totalBefore:(null==t?void 0:t.total_price)||0,totalAfter:e.total_price||0,added:[],removed:[],changed:[]};if(e.items_added&&e.items_added.length>0&&e.items_added.forEach(t=>{a.added.push({title:t.title||t.product_title,variant_title:t.variant_title,quantity:t.quantity,price:t.price?Math.round(100*parseFloat(t.price)):t.final_line_price||t.line_price,variant_id:t.variant_id})}),e.items_removed&&e.items_removed.length>0&&e.items_removed.forEach(t=>{a.removed.push({title:t.title||t.product_title,variant_title:t.variant_title,quantity:t.quantity,price:t.price?Math.round(100*parseFloat(t.price)):t.final_line_price||t.line_price,variant_id:t.variant_id})}),(null==(i=e.items_added)?void 0:i.length)>0||(null==(s=e.items_removed)?void 0:s.length)>0){if(t){const i=t=>{const e=t.properties?JSON.stringify(t.properties):"";return`${t.variant_id}:${e}`},s=new Map,r=new Map;(t.items||[]).forEach(t=>{s.set(i(t),t)}),(e.items||[]).forEach(t=>{r.set(i(t),t)}),r.forEach((t,e)=>{const i=s.get(e);i&&i.quantity!==t.quantity&&a.changed.push({title:t.title,variant_title:t.variant_title,quantityBefore:i.quantity,quantityAfter:t.quantity,priceBefore:i.final_line_price||i.line_price,priceAfter:t.final_line_price||t.line_price,variant_id:t.variant_id})})}return 0===a.added.length&&0===a.removed.length&&0===a.changed.length?null:a}if(!t)return null;const r=t=>{const e=t.properties?JSON.stringify(t.properties):"";return`${t.variant_id}:${e}`},n=new Map,o=new Map;return(t.items||[]).forEach(t=>{const e=r(t);n.set(e,t)}),(e.items||[]).forEach(t=>{const e=r(t);o.set(e,t)}),o.forEach((t,e)=>{const i=n.get(e);i?i.quantity!==t.quantity&&a.changed.push({title:t.title,variant_title:t.variant_title,quantityBefore:i.quantity,quantityAfter:t.quantity,priceBefore:i.final_line_price||i.line_price,priceAfter:t.final_line_price||t.line_price,variant_id:t.variant_id}):a.added.push({title:t.title,variant_title:t.variant_title,quantity:t.quantity,price:t.final_line_price||t.line_price,variant_id:t.variant_id})}),n.forEach((t,e)=>{o.has(e)||a.removed.push({title:t.title,variant_title:t.variant_title,quantity:t.quantity,price:t.final_line_price||t.line_price,variant_id:t.variant_id})}),0===a.added.length&&0===a.removed.length&&0===a.changed.length?null:a}_addRequest(t){this.requests.unshift(t),this.requests.length>100&&(this.requests=this.requests.slice(0,100)),this._notify()}_updateRequest(t){const e=this.requests.findIndex(e=>e.id===t.id);-1!==e&&(this.requests[e]=t),this._notify()}_checkStale(){const t=Date.now();let e=!1;this.requests.forEach(i=>{if("success"===i.status&&i.endTime){t-i.endTime.getTime()>this._staleTimeout&&"stale"!==i.status&&(i.status="stale",e=!0)}}),e&&this._notify()}subscribe(t){return this.listeners.add(t),()=>this.listeners.delete(t)}_notify(){this.listeners.forEach(t=>{try{t(this.requests)}catch(e){console.error("[TDT Network] Listener error:",e)}}),this._saveToStorage()}clear(){this.requests=[];try{localStorage.removeItem(Ma)}catch(t){console.error("[TDT Network] Failed to clear storage:",t)}this._notify()}getRequests(){return this.requests}getRequestsByCategory(t){return"all"===t?this.requests:this.requests.filter(e=>e.category===t)}};class Ua extends ot{constructor(){super(),this.requests=[],this.filter="all",this.searchQuery="",this.expandedId=null,this.detailTab="request",this.replayingId=null,this.copyMenuId=null,this.toastMessage=null,this.editingId=null,this.editData=null,this._unsubscribe=null}connectedCallback(){super.connectedCallback(),Ha.install(),this._unsubscribe=Ha.subscribe(t=>{this.requests=[...t]}),this.requests=[...Ha.getRequests()]}disconnectedCallback(){super.disconnectedCallback(),this._unsubscribe&&this._unsubscribe()}_formatTime(t){return t instanceof Date||(t=new Date(t)),isNaN(t.getTime())?"--:--:--":t.toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"})}_formatDuration(t){return null==t?"...":t<1e3?`${t}ms`:`${(t/1e3).toFixed(2)}s`}_getDurationClass(t){return null===t?"":t>3e3?"request-duration--very-slow":t>1e3?"request-duration--slow":""}_getFilteredRequests(){let t=this.requests;if("all"!==this.filter&&(t=t.filter(t=>t.category===this.filter||t.category===`${this.filter}-mutation`)),this.searchQuery.trim()){const e=this.searchQuery.toLowerCase().trim();t=t.filter(t=>this._requestMatchesSearch(t,e))}return t}_requestMatchesSearch(t,e){var i,s,a;if(null==(i=t.fullUrl)?void 0:i.toLowerCase().includes(e))return!0;if(null==(s=t.url)?void 0:s.toLowerCase().includes(e))return!0;if(null==(a=t.displayName)?void 0:a.toLowerCase().includes(e))return!0;if(t.requestBody){if(("object"==typeof t.requestBody?JSON.stringify(t.requestBody):String(t.requestBody)).toLowerCase().includes(e))return!0}if(t.responseBody){if(("object"==typeof t.responseBody?JSON.stringify(t.responseBody):String(t.responseBody)).toLowerCase().includes(e))return!0}return!1}_handleFilterChange(t){this.filter=t.target.value}_handleSearchInput(t){this.searchQuery=t.target.value}_clearSearch(){this.searchQuery=""}_handleClear(){Ha.clear()}_toggleExpand(t){this.expandedId=this.expandedId===t?null:t,this.detailTab="request"}_setDetailTab(t){this.detailTab=t}async _replayRequest(t,e){var i;if(e.stopPropagation(),this.replayingId!==t.id){this.replayingId=t.id;try{const e={method:t.method,headers:{...t.requestHeaders}};if("GET"!==t.method&&t.requestBody)if("object"==typeof t.requestBody){if(((null==(i=t.requestHeaders)?void 0:i["content-type"])||"").includes("application/json"))e.body=JSON.stringify(t.requestBody);else{const i=new URLSearchParams;for(const[e,s]of Object.entries(t.requestBody))i.append(e,s);e.body=i}}else e.body=t.requestBody;await fetch(t.fullUrl,e)}catch(s){console.error("[TDT Network] Replay failed:",s)}finally{this.replayingId=null}}}_toggleCopyMenu(t,e){e.stopPropagation(),this.copyMenuId=this.copyMenuId===t?null:t}_closeCopyMenu(){this.copyMenuId=null}_showToast(t){this.toastMessage=t,setTimeout(()=>{this.toastMessage=null},2e3)}async _copyToClipboard(t,e){try{await navigator.clipboard.writeText(t),this._showToast(`Copied as ${e}`)}catch{console.error("[TDT Network] Copy failed")}this._closeCopyMenu()}_generateCurl(t){const e=["curl"];"GET"!==t.method&&e.push(`-X ${t.method}`),e.push(`'${t.fullUrl}'`);const i=t.requestHeaders||{};for(const[s,a]of Object.entries(i))"content-length"!==s.toLowerCase()&&e.push(`-H '${s}: ${a}'`);if(t.requestBody&&"GET"!==t.method){let s;if("object"==typeof t.requestBody){s=(i["content-type"]||"").includes("application/json")?JSON.stringify(t.requestBody):new URLSearchParams(t.requestBody).toString()}else s=t.requestBody;e.push(`-d '${s.replace(/'/g,"'\\''")}'`)}return e.join(" \\\n ")}_generateFetch(t){const e=t.requestHeaders||{},i=[];if(i.push(` method: '${t.method}'`),Object.keys(e).length>0){const t=JSON.stringify(e,null,4).replace(/\n/g,"\n ");i.push(` headers: ${t}`)}if(t.requestBody&&"GET"!==t.method){let s;s=(e["content-type"]||"").includes("application/json")?"object"==typeof t.requestBody?`JSON.stringify(${JSON.stringify(t.requestBody,null,4).replace(/\n/g,"\n ")})`:`'${t.requestBody.replace(/'/g,"\\'")}'`:"object"==typeof t.requestBody?`new URLSearchParams(${JSON.stringify(t.requestBody)})`:`'${String(t.requestBody).replace(/'/g,"\\'")}'`,i.push(` body: ${s}`)}return`fetch('${t.fullUrl}', {\n${i.join(",\n")}\n})\n .then(response => response.json())\n .then(data => console.log(data))\n .catch(error => console.error('Error:', error));`}_copyAsCurl(t,e){e.stopPropagation();const i=this._generateCurl(t);this._copyToClipboard(i,"cURL")}_copyAsFetch(t,e){e.stopPropagation();const i=this._generateFetch(t);this._copyToClipboard(i,"Fetch")}_openEditor(t,e){e.stopPropagation(),this.editingId=t.id;const i=Object.entries(t.requestHeaders||{}).map(([t,e])=>({key:t,value:e,id:`header_${Date.now()}_${Math.random().toString(36).substr(2,5)}`}));let s="";t.requestBody&&(s="object"==typeof t.requestBody?JSON.stringify(t.requestBody,null,2):String(t.requestBody)),this.editData={method:t.method,url:t.fullUrl,headers:i,body:s,sending:!1}}_closeEditor(){this.editingId=null,this.editData=null}_updateEditMethod(t){this.editData={...this.editData,method:t.target.value}}_updateEditUrl(t){this.editData={...this.editData,url:t.target.value}}_updateEditHeaderKey(t,e){const i=this.editData.headers.map(i=>i.id===t?{...i,key:e.target.value}:i);this.editData={...this.editData,headers:i}}_updateEditHeaderValue(t,e){const i=this.editData.headers.map(i=>i.id===t?{...i,value:e.target.value}:i);this.editData={...this.editData,headers:i}}_removeEditHeader(t){const e=this.editData.headers.filter(e=>e.id!==t);this.editData={...this.editData,headers:e}}_addEditHeader(){const t={key:"",value:"",id:`header_${Date.now()}_${Math.random().toString(36).substr(2,5)}`};this.editData={...this.editData,headers:[...this.editData.headers,t]}}_updateEditBody(t){this.editData={...this.editData,body:t.target.value}}_formatEditBody(){if(this.editData.body)try{const t=JSON.parse(this.editData.body),e=JSON.stringify(t,null,2);this.editData={...this.editData,body:e}}catch{this._showToast("Invalid JSON - cannot format")}}async _sendEditedRequest(){if(this.editData&&!this.editData.sending){this.editData={...this.editData,sending:!0};try{const t={};this.editData.headers.forEach(e=>{e.key.trim()&&(t[e.key.trim()]=e.value)});const e={method:this.editData.method,headers:t};if("GET"!==this.editData.method&&this.editData.body.trim()){if((t["content-type"]||t["Content-Type"]||"").includes("application/json")||this.editData.body.trim().startsWith("{"))try{const i=JSON.parse(this.editData.body);e.body=JSON.stringify(i),t["content-type"]||t["Content-Type"]||(t["content-type"]="application/json",e.headers=t)}catch{e.body=this.editData.body}else e.body=this.editData.body}await fetch(this.editData.url,e),this._showToast("Request sent"),this._closeEditor()}catch(t){console.error("[TDT Network] Send edited request failed:",t),this._showToast("Request failed: "+t.message),this.editData={...this.editData,sending:!1}}}}_handleOverlayClick(t){t.target.classList.contains("editor-overlay")&&this._closeEditor()}_renderEditorModal(){return this.editingId&&this.editData?U`
7849
+ `]),__publicField(La,"KNOWN_APPS",{klaviyo:{name:"Klaviyo",icon:"K",patterns:["klaviyo","klviyo"]},judgeme:{name:"Judge.me",icon:"J",patterns:["judge.me","judgeme"]},yotpo:{name:"Yotpo",icon:"Y",patterns:["yotpo"]},loox:{name:"Loox",icon:"L",patterns:["loox"]},stamped:{name:"Stamped",icon:"S",patterns:["stamped"]},okendo:{name:"Okendo",icon:"O",patterns:["okendo"]},"reviews-io":{name:"Reviews.io",icon:"R",patterns:["reviews.io","reviewsio"]},trustpilot:{name:"Trustpilot",icon:"T",patterns:["trustpilot"]},bazaarvoice:{name:"Bazaarvoice",icon:"B",patterns:["bazaarvoice","bvapi"]},recharge:{name:"ReCharge",icon:"R",patterns:["recharge","rechargepayments"]},bold:{name:"Bold",icon:"B",patterns:["boldapps","boldcommerce"]},afterpay:{name:"Afterpay",icon:"A",patterns:["afterpay","portal.afterpay"]},klarna:{name:"Klarna",icon:"K",patterns:["klarna"]},affirm:{name:"Affirm",icon:"A",patterns:["affirm"]},sezzle:{name:"Sezzle",icon:"S",patterns:["sezzle"]},clearpay:{name:"Clearpay",icon:"C",patterns:["clearpay"]},zip:{name:"Zip",icon:"Z",patterns:["quadpay","zip.co"]},paypal:{name:"PayPal",icon:"P",patterns:["paypal","paypalobjects"]},stripe:{name:"Stripe",icon:"S",patterns:["stripe.com","js.stripe"]},privy:{name:"Privy",icon:"P",patterns:["privy"]},omnisend:{name:"Omnisend",icon:"O",patterns:["omnisend"]},mailchimp:{name:"Mailchimp",icon:"M",patterns:["mailchimp","chimpstatic"]},drip:{name:"Drip",icon:"D",patterns:["getdrip","drip.com"]},attentive:{name:"Attentive",icon:"A",patterns:["attentive","attn.tv"]},postscript:{name:"Postscript",icon:"P",patterns:["postscript"]},sendlane:{name:"Sendlane",icon:"S",patterns:["sendlane"]},retention:{name:"Retention.com",icon:"R",patterns:["retention.com"]},smile:{name:"Smile.io",icon:"S",patterns:["smile.io","smileio"]},loyaltylion:{name:"LoyaltyLion",icon:"L",patterns:["loyaltylion"]},"yotpo-loyalty":{name:"Yotpo Loyalty",icon:"Y",patterns:["yotpo-loyalty","swell.is"]},"rise-ai":{name:"Rise.ai",icon:"R",patterns:["rise.ai","riseai"]},gorgias:{name:"Gorgias",icon:"G",patterns:["gorgias"]},zendesk:{name:"Zendesk",icon:"Z",patterns:["zendesk","zopim"]},tidio:{name:"Tidio",icon:"T",patterns:["tidio"]},intercom:{name:"Intercom",icon:"I",patterns:["intercom"]},freshdesk:{name:"Freshdesk",icon:"F",patterns:["freshdesk","freshchat"]},livechat:{name:"LiveChat",icon:"L",patterns:["livechat","livechatinc"]},crisp:{name:"Crisp",icon:"C",patterns:["crisp.chat"]},drift:{name:"Drift",icon:"D",patterns:["drift.com","driftt"]},reamaze:{name:"Reamaze",icon:"R",patterns:["reamaze"]},hotjar:{name:"Hotjar",icon:"H",patterns:["hotjar"]},facebook:{name:"Meta Pixel",icon:"M",patterns:["facebook","fbevents","connect.facebook"]},google:{name:"Google",icon:"G",patterns:["googletagmanager","google-analytics","gtag","gtm.js"]},tiktok:{name:"TikTok",icon:"T",patterns:["tiktok","analytics.tiktok"]},pinterest:{name:"Pinterest",icon:"P",patterns:["pintrk","pinterest"]},snapchat:{name:"Snapchat",icon:"S",patterns:["snapchat","sc-static"]},shopify:{name:"Shopify",icon:"S",patterns:["shopify","cdn.shopify","monorail-edge"]},segment:{name:"Segment",icon:"S",patterns:["segment.com","segment.io"]},heap:{name:"Heap",icon:"H",patterns:["heap-analytics","heapanalytics"]},mixpanel:{name:"Mixpanel",icon:"M",patterns:["mixpanel"]},fullstory:{name:"FullStory",icon:"F",patterns:["fullstory"]},"lucky-orange":{name:"Lucky Orange",icon:"L",patterns:["luckyorange"]},clarity:{name:"Microsoft Clarity",icon:"C",patterns:["clarity.ms"]},reddit:{name:"Reddit Pixel",icon:"R",patterns:["redditmedia","reddit.com/pixel"]},twitter:{name:"Twitter Pixel",icon:"T",patterns:["static.ads-twitter","analytics.twitter"]},criteo:{name:"Criteo",icon:"C",patterns:["criteo"]},taboola:{name:"Taboola",icon:"T",patterns:["taboola"]},pagefly:{name:"PageFly",icon:"P",patterns:["pagefly"]},shogun:{name:"Shogun",icon:"S",patterns:["getshogun","shogun"]},gempage:{name:"GemPages",icon:"G",patterns:["gempages"]},zipify:{name:"Zipify",icon:"Z",patterns:["zipify"]},rebuy:{name:"Rebuy",icon:"R",patterns:["rebuyengine","rebuy"]},"recom-ai":{name:"Recom.ai",icon:"R",patterns:["recom.ai"]},"frequently-bought":{name:"Frequently Bought",icon:"F",patterns:["frequently-bought","also-bought"]},honeycomb:{name:"Honeycomb",icon:"H",patterns:["honeycomb-upsell"]},"candy-rack":{name:"Candy Rack",icon:"C",patterns:["candy-rack","candyrack"]},reconvert:{name:"ReConvert",icon:"R",patterns:["reconvert"]},shipstation:{name:"ShipStation",icon:"S",patterns:["shipstation"]},shippo:{name:"Shippo",icon:"S",patterns:["goshippo"]},easyship:{name:"Easyship",icon:"E",patterns:["easyship"]},aftership:{name:"AfterShip",icon:"A",patterns:["aftership"]},route:{name:"Route",icon:"R",patterns:["route.com","routeapp"]},justuno:{name:"Justuno",icon:"J",patterns:["justuno"]},optinmonster:{name:"OptinMonster",icon:"O",patterns:["optinmonster"]},wisepops:{name:"Wisepops",icon:"W",patterns:["wisepops"]},wheelio:{name:"Wheelio",icon:"W",patterns:["wheelio"]},"spin-a-sale":{name:"Spin-a-Sale",icon:"S",patterns:["spin-a-sale","spinasale"]},fomo:{name:"Fomo",icon:"F",patterns:["fomo.com","usefomo"]},nudgify:{name:"Nudgify",icon:"N",patterns:["nudgify"]},proof:{name:"Proof",icon:"P",patterns:["useproof"]},fera:{name:"Fera",icon:"F",patterns:["fera.ai"]},searchspring:{name:"Searchspring",icon:"S",patterns:["searchspring"]},algolia:{name:"Algolia",icon:"A",patterns:["algolia"]},"boost-commerce":{name:"Boost Commerce",icon:"B",patterns:["boost-commerce","boostcommerce"]},klevu:{name:"Klevu",icon:"K",patterns:["klevu"]},elfsight:{name:"Elfsight",icon:"E",patterns:["elfsight","static.elfsight"]},instafeed:{name:"Instafeed",icon:"I",patterns:["instafeed"]},beeketing:{name:"Beeketing",icon:"B",patterns:["beeketing"]},vitals:{name:"Vitals",icon:"V",patterns:["vitals.co","vitalsapp"]},hextom:{name:"Hextom",icon:"H",patterns:["hextom"]},"cart-upsell":{name:"Cart Upsell",icon:"C",patterns:["incart-upsell"]}});let Pa=La;customElements.define("tdt-apps-panel",Pa);const Ia=[/\/cart\.js$/,/\/cart\/(add|update|change|clear)\.js/,/\/products\/[^/]+\.js$/,/\/collections\/[^/]+\.js$/,/\/search/,/\/recommendations\/products/,/\/api\/\d+(-\d+)?\/graphql\.json/,/\/variants\.js/,/\/localization\.json/];function Ra(t){return/\/cart\/(add|update|change|clear)\.js/.test(t)?"cart-mutation":/\/cart\.js/.test(t)?"cart":/\/products\//.test(t)?"product":/\/collections\//.test(t)?"collection":/\/search/.test(t)?"search":/\/recommendations/.test(t)?"recommendation":/graphql/.test(t)?"graphql":/\/localization/.test(t)?"localization":"other"}function Na(t){try{const e=new URL(t,window.location.origin),i=e.pathname;if(/\/cart\/(add|update|change|clear)\.js/.test(i)){return`cart/${i.match(/\/cart\/(\w+)\.js/)[1]}.js`}if(/\/cart\.js$/.test(i))return"cart.js";if(/\/products\//.test(i)){const t=i.match(/\/products\/([^/]+)\.js/);return t?`products/${t[1]}.js`:i}if(/\/collections\//.test(i)){const t=i.match(/\/collections\/([^/]+)\.js/);return t?`collections/${t[1]}.js`:i}if(/\/search/.test(i)){const t=e.searchParams.get("q");return t?`search?q=${t.substring(0,20)}${t.length>20?"...":""}`:"search"}return/graphql/.test(i)?"graphql":/\/recommendations/.test(i)?"recommendations":/\/localization/.test(i)?"localization.json":i}catch{return t}}function Fa(t){try{const e=new URL(t,window.location.origin).pathname;return Ia.some(t=>t.test(e))}catch{return!1}}async function Da(t){try{const e=await t("/cart.js",{headers:{Accept:"application/json"},_tdtInternal:!0});return await e.json()}catch{return null}}function Ma(){return`req_${Date.now()}_${Math.random().toString(36).substr(2,9)}`}const Ha="tdt_network_requests";const Ua=new class{constructor(){this.requests=[],this.listeners=new Set,this._originalFetch=null,this._originalXHROpen=null,this._originalXHRSend=null,this._installed=!1,this._staleTimeout=3e4,this._loadFromStorage()}_loadFromStorage(){try{const t=localStorage.getItem(Ha);if(t){const e=JSON.parse(t);this.requests=e.map(t=>({...t,startTime:new Date(t.startTime),endTime:t.endTime?new Date(t.endTime):null,status:(t.status,"stale")}))}}catch(t){console.error("[TDT Network] Failed to load from storage:",t),this.requests=[]}}_saveToStorage(){try{const t=this.requests.filter(t=>"pending"!==t.status).slice(0,32).map(t=>({...t,startTime:t.startTime instanceof Date?t.startTime.toISOString():t.startTime,endTime:t.endTime instanceof Date?t.endTime.toISOString():t.endTime,cartBefore:null,cartAfter:null}));localStorage.setItem(Ha,JSON.stringify(t))}catch(t){console.error("[TDT Network] Failed to save to storage:",t)}}install(){this._installed||(this._interceptFetch(),this._interceptXHR(),this._installed=!0,this._staleInterval=setInterval(()=>this._checkStale(),5e3))}uninstall(){this._installed&&(this._originalFetch&&(window.fetch=this._originalFetch),this._originalXHROpen&&(XMLHttpRequest.prototype.open=this._originalXHROpen),this._originalXHRSend&&(XMLHttpRequest.prototype.send=this._originalXHRSend),this._staleInterval&&clearInterval(this._staleInterval),this._installed=!1)}_interceptFetch(){this._originalFetch=window.fetch;const t=this;window.fetch=async function(e,i={}){const s="string"==typeof e?e:e.url;if(!Fa(s)||function(t){var e;return"true"===(null==(e=null==t?void 0:t.headers)?void 0:e["X-TDT-Internal"])||!0===(null==t?void 0:t._tdtInternal)}(i))return t._originalFetch.apply(this,arguments);const a=Ma(),r=i.method||"GET";let n=null;if(i.body)try{"string"==typeof i.body?n=i.body:(i.body instanceof FormData||i.body instanceof URLSearchParams)&&(n=Object.fromEntries(i.body.entries()))}catch{n="[Unable to parse body]"}const o=function(t){return/\/cart\/(add|update|change|clear)\.js/.test(t)}(s);let l=null;o&&(l=await Da(t._originalFetch));const d={id:a,url:s,fullUrl:new URL(s,window.location.origin).href,displayName:Na(s),method:r.toUpperCase(),category:Ra(s),startTime:new Date,endTime:null,duration:null,status:"pending",statusCode:null,requestBody:n,requestHeaders:i.headers?Object.fromEntries(new Headers(i.headers).entries()):{},responseBody:null,responseHeaders:{},error:null,cartBefore:l,cartAfter:null,cartDiff:null};t._addRequest(d);try{const e=await t._originalFetch.apply(this,arguments),i=e.clone();d.endTime=new Date,d.duration=d.endTime-d.startTime,d.statusCode=e.status,d.status=e.ok?"success":"error",d.responseHeaders=Object.fromEntries(e.headers.entries());try{(e.headers.get("content-type")||"").includes("application/json")?d.responseBody=await i.json():d.responseBody=await i.text()}catch{d.responseBody="[Unable to parse response]"}if(o&&e.ok){const e=await Da(t._originalFetch);e&&(d.cartAfter=e,d.cartDiff=t._calculateCartDiff(l,e))}return t._updateRequest(d),e}catch(c){throw d.endTime=new Date,d.duration=d.endTime-d.startTime,d.status="error",d.error=c.message,t._updateRequest(d),c}}}_interceptXHR(){this._originalXHROpen=XMLHttpRequest.prototype.open,this._originalXHRSend=XMLHttpRequest.prototype.send;const t=this;XMLHttpRequest.prototype.open=function(e,i){return this._tdtUrl=i,this._tdtMethod=e,t._originalXHROpen.apply(this,arguments)},XMLHttpRequest.prototype.send=function(e){const i=this._tdtUrl;if(!Fa(i))return t._originalXHRSend.apply(this,arguments);const s=Ma();let a=null;if(e)try{"string"==typeof e?a=e:e instanceof FormData&&(a=Object.fromEntries(e.entries()))}catch{a="[Unable to parse body]"}const r={id:s,url:i,fullUrl:new URL(i,window.location.origin).href,displayName:Na(i),method:(this._tdtMethod||"GET").toUpperCase(),category:Ra(i),startTime:new Date,endTime:null,duration:null,status:"pending",statusCode:null,requestBody:a,requestHeaders:{},responseBody:null,responseHeaders:{},error:null};return t._addRequest(r),this.addEventListener("load",function(){r.endTime=new Date,r.duration=r.endTime-r.startTime,r.statusCode=this.status,r.status=this.status>=200&&this.status<300?"success":"error";const e=this.getAllResponseHeaders();e&&e.split("\r\n").forEach(t=>{const e=t.split(": ");2===e.length&&(r.responseHeaders[e[0].toLowerCase()]=e[1])});try{(this.getResponseHeader("content-type")||"").includes("application/json")?r.responseBody=JSON.parse(this.responseText):r.responseBody=this.responseText}catch{r.responseBody=this.responseText||"[Unable to parse response]"}t._updateRequest(r)}),this.addEventListener("error",function(){r.endTime=new Date,r.duration=r.endTime-r.startTime,r.status="error",r.error="Network error",t._updateRequest(r)}),this.addEventListener("abort",function(){r.endTime=new Date,r.duration=r.endTime-r.startTime,r.status="error",r.error="Request aborted",t._updateRequest(r)}),t._originalXHRSend.apply(this,arguments)}}_calculateCartDiff(t,e){var i,s;if(!e)return null;const a={itemsBefore:(null==t?void 0:t.item_count)||0,itemsAfter:e.item_count||0,totalBefore:(null==t?void 0:t.total_price)||0,totalAfter:e.total_price||0,added:[],removed:[],changed:[]};if(e.items_added&&e.items_added.length>0&&e.items_added.forEach(t=>{a.added.push({title:t.title||t.product_title,variant_title:t.variant_title,quantity:t.quantity,price:t.price?Math.round(100*parseFloat(t.price)):t.final_line_price||t.line_price,variant_id:t.variant_id})}),e.items_removed&&e.items_removed.length>0&&e.items_removed.forEach(t=>{a.removed.push({title:t.title||t.product_title,variant_title:t.variant_title,quantity:t.quantity,price:t.price?Math.round(100*parseFloat(t.price)):t.final_line_price||t.line_price,variant_id:t.variant_id})}),(null==(i=e.items_added)?void 0:i.length)>0||(null==(s=e.items_removed)?void 0:s.length)>0){if(t){const i=t=>{const e=t.properties?JSON.stringify(t.properties):"";return`${t.variant_id}:${e}`},s=new Map,r=new Map;(t.items||[]).forEach(t=>{s.set(i(t),t)}),(e.items||[]).forEach(t=>{r.set(i(t),t)}),r.forEach((t,e)=>{const i=s.get(e);i&&i.quantity!==t.quantity&&a.changed.push({title:t.title,variant_title:t.variant_title,quantityBefore:i.quantity,quantityAfter:t.quantity,priceBefore:i.final_line_price||i.line_price,priceAfter:t.final_line_price||t.line_price,variant_id:t.variant_id})})}return 0===a.added.length&&0===a.removed.length&&0===a.changed.length?null:a}if(!t)return null;const r=t=>{const e=t.properties?JSON.stringify(t.properties):"";return`${t.variant_id}:${e}`},n=new Map,o=new Map;return(t.items||[]).forEach(t=>{const e=r(t);n.set(e,t)}),(e.items||[]).forEach(t=>{const e=r(t);o.set(e,t)}),o.forEach((t,e)=>{const i=n.get(e);i?i.quantity!==t.quantity&&a.changed.push({title:t.title,variant_title:t.variant_title,quantityBefore:i.quantity,quantityAfter:t.quantity,priceBefore:i.final_line_price||i.line_price,priceAfter:t.final_line_price||t.line_price,variant_id:t.variant_id}):a.added.push({title:t.title,variant_title:t.variant_title,quantity:t.quantity,price:t.final_line_price||t.line_price,variant_id:t.variant_id})}),n.forEach((t,e)=>{o.has(e)||a.removed.push({title:t.title,variant_title:t.variant_title,quantity:t.quantity,price:t.final_line_price||t.line_price,variant_id:t.variant_id})}),0===a.added.length&&0===a.removed.length&&0===a.changed.length?null:a}_addRequest(t){this.requests.unshift(t),this.requests.length>100&&(this.requests=this.requests.slice(0,100)),this._notify()}_updateRequest(t){const e=this.requests.findIndex(e=>e.id===t.id);-1!==e&&(this.requests[e]=t),this._notify()}_checkStale(){const t=Date.now();let e=!1;this.requests.forEach(i=>{if("success"===i.status&&i.endTime){t-i.endTime.getTime()>this._staleTimeout&&"stale"!==i.status&&(i.status="stale",e=!0)}}),e&&this._notify()}subscribe(t){return this.listeners.add(t),()=>this.listeners.delete(t)}_notify(){this.listeners.forEach(t=>{try{t(this.requests)}catch(e){console.error("[TDT Network] Listener error:",e)}}),this._saveToStorage()}clear(){this.requests=[];try{localStorage.removeItem(Ha)}catch(t){console.error("[TDT Network] Failed to clear storage:",t)}this._notify()}getRequests(){return this.requests}getRequestsByCategory(t){return"all"===t?this.requests:this.requests.filter(e=>e.category===t)}};class Ba extends ot{constructor(){super(),this.requests=[],this.filter="all",this.searchQuery="",this.expandedId=null,this.detailTab="request",this.replayingId=null,this.copyMenuId=null,this.toastMessage=null,this.editingId=null,this.editData=null,this._unsubscribe=null}connectedCallback(){super.connectedCallback(),Ua.install(),this._unsubscribe=Ua.subscribe(t=>{this.requests=[...t]}),this.requests=[...Ua.getRequests()]}disconnectedCallback(){super.disconnectedCallback(),this._unsubscribe&&this._unsubscribe()}_formatTime(t){return t instanceof Date||(t=new Date(t)),isNaN(t.getTime())?"--:--:--":t.toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"})}_formatDuration(t){return null==t?"...":t<1e3?`${t}ms`:`${(t/1e3).toFixed(2)}s`}_getDurationClass(t){return null===t?"":t>3e3?"request-duration--very-slow":t>1e3?"request-duration--slow":""}_getFilteredRequests(){let t=this.requests;if("all"!==this.filter&&(t=t.filter(t=>t.category===this.filter||t.category===`${this.filter}-mutation`)),this.searchQuery.trim()){const e=this.searchQuery.toLowerCase().trim();t=t.filter(t=>this._requestMatchesSearch(t,e))}return t}_requestMatchesSearch(t,e){var i,s,a;if(null==(i=t.fullUrl)?void 0:i.toLowerCase().includes(e))return!0;if(null==(s=t.url)?void 0:s.toLowerCase().includes(e))return!0;if(null==(a=t.displayName)?void 0:a.toLowerCase().includes(e))return!0;if(t.requestBody){if(("object"==typeof t.requestBody?JSON.stringify(t.requestBody):String(t.requestBody)).toLowerCase().includes(e))return!0}if(t.responseBody){if(("object"==typeof t.responseBody?JSON.stringify(t.responseBody):String(t.responseBody)).toLowerCase().includes(e))return!0}return!1}_handleFilterChange(t){this.filter=t.target.value}_handleSearchInput(t){this.searchQuery=t.target.value}_clearSearch(){this.searchQuery=""}_handleClear(){Ua.clear()}_toggleExpand(t){this.expandedId=this.expandedId===t?null:t,this.detailTab="request"}_setDetailTab(t){this.detailTab=t}async _replayRequest(t,e){var i;if(e.stopPropagation(),this.replayingId!==t.id){this.replayingId=t.id;try{const e={method:t.method,headers:{...t.requestHeaders}};if("GET"!==t.method&&t.requestBody)if("object"==typeof t.requestBody){if(((null==(i=t.requestHeaders)?void 0:i["content-type"])||"").includes("application/json"))e.body=JSON.stringify(t.requestBody);else{const i=new URLSearchParams;for(const[e,s]of Object.entries(t.requestBody))i.append(e,s);e.body=i}}else e.body=t.requestBody;await fetch(t.fullUrl,e)}catch(s){console.error("[TDT Network] Replay failed:",s)}finally{this.replayingId=null}}}_toggleCopyMenu(t,e){e.stopPropagation(),this.copyMenuId=this.copyMenuId===t?null:t}_closeCopyMenu(){this.copyMenuId=null}_showToast(t){this.toastMessage=t,setTimeout(()=>{this.toastMessage=null},2e3)}async _copyToClipboard(t,e){try{await navigator.clipboard.writeText(t),this._showToast(`Copied as ${e}`)}catch{console.error("[TDT Network] Copy failed")}this._closeCopyMenu()}_generateCurl(t){const e=["curl"];"GET"!==t.method&&e.push(`-X ${t.method}`),e.push(`'${t.fullUrl}'`);const i=t.requestHeaders||{};for(const[s,a]of Object.entries(i))"content-length"!==s.toLowerCase()&&e.push(`-H '${s}: ${a}'`);if(t.requestBody&&"GET"!==t.method){let s;if("object"==typeof t.requestBody){s=(i["content-type"]||"").includes("application/json")?JSON.stringify(t.requestBody):new URLSearchParams(t.requestBody).toString()}else s=t.requestBody;e.push(`-d '${s.replace(/'/g,"'\\''")}'`)}return e.join(" \\\n ")}_generateFetch(t){const e=t.requestHeaders||{},i=[];if(i.push(` method: '${t.method}'`),Object.keys(e).length>0){const t=JSON.stringify(e,null,4).replace(/\n/g,"\n ");i.push(` headers: ${t}`)}if(t.requestBody&&"GET"!==t.method){let s;s=(e["content-type"]||"").includes("application/json")?"object"==typeof t.requestBody?`JSON.stringify(${JSON.stringify(t.requestBody,null,4).replace(/\n/g,"\n ")})`:`'${t.requestBody.replace(/'/g,"\\'")}'`:"object"==typeof t.requestBody?`new URLSearchParams(${JSON.stringify(t.requestBody)})`:`'${String(t.requestBody).replace(/'/g,"\\'")}'`,i.push(` body: ${s}`)}return`fetch('${t.fullUrl}', {\n${i.join(",\n")}\n})\n .then(response => response.json())\n .then(data => console.log(data))\n .catch(error => console.error('Error:', error));`}_copyAsCurl(t,e){e.stopPropagation();const i=this._generateCurl(t);this._copyToClipboard(i,"cURL")}_copyAsFetch(t,e){e.stopPropagation();const i=this._generateFetch(t);this._copyToClipboard(i,"Fetch")}_openEditor(t,e){e.stopPropagation(),this.editingId=t.id;const i=Object.entries(t.requestHeaders||{}).map(([t,e])=>({key:t,value:e,id:`header_${Date.now()}_${Math.random().toString(36).substr(2,5)}`}));let s="";t.requestBody&&(s="object"==typeof t.requestBody?JSON.stringify(t.requestBody,null,2):String(t.requestBody)),this.editData={method:t.method,url:t.fullUrl,headers:i,body:s,sending:!1}}_closeEditor(){this.editingId=null,this.editData=null}_updateEditMethod(t){this.editData={...this.editData,method:t.target.value}}_updateEditUrl(t){this.editData={...this.editData,url:t.target.value}}_updateEditHeaderKey(t,e){const i=this.editData.headers.map(i=>i.id===t?{...i,key:e.target.value}:i);this.editData={...this.editData,headers:i}}_updateEditHeaderValue(t,e){const i=this.editData.headers.map(i=>i.id===t?{...i,value:e.target.value}:i);this.editData={...this.editData,headers:i}}_removeEditHeader(t){const e=this.editData.headers.filter(e=>e.id!==t);this.editData={...this.editData,headers:e}}_addEditHeader(){const t={key:"",value:"",id:`header_${Date.now()}_${Math.random().toString(36).substr(2,5)}`};this.editData={...this.editData,headers:[...this.editData.headers,t]}}_updateEditBody(t){this.editData={...this.editData,body:t.target.value}}_formatEditBody(){if(this.editData.body)try{const t=JSON.parse(this.editData.body),e=JSON.stringify(t,null,2);this.editData={...this.editData,body:e}}catch{this._showToast("Invalid JSON - cannot format")}}async _sendEditedRequest(){if(this.editData&&!this.editData.sending){this.editData={...this.editData,sending:!0};try{const t={};this.editData.headers.forEach(e=>{e.key.trim()&&(t[e.key.trim()]=e.value)});const e={method:this.editData.method,headers:t};if("GET"!==this.editData.method&&this.editData.body.trim()){if((t["content-type"]||t["Content-Type"]||"").includes("application/json")||this.editData.body.trim().startsWith("{"))try{const i=JSON.parse(this.editData.body);e.body=JSON.stringify(i),t["content-type"]||t["Content-Type"]||(t["content-type"]="application/json",e.headers=t)}catch{e.body=this.editData.body}else e.body=this.editData.body}await fetch(this.editData.url,e),this._showToast("Request sent"),this._closeEditor()}catch(t){console.error("[TDT Network] Send edited request failed:",t),this._showToast("Request failed: "+t.message),this.editData={...this.editData,sending:!1}}}}_handleOverlayClick(t){t.target.classList.contains("editor-overlay")&&this._closeEditor()}_renderEditorModal(){return this.editingId&&this.editData?U`
6958
7850
  <div class="editor-overlay" @click=${t=>this._handleOverlayClick(t)}>
6959
7851
  <div class="request-editor">
6960
7852
  <div class="editor-header">
@@ -7303,7 +8195,7 @@ ${Object.entries(t.responseHeaders||{}).map(([t,e])=>`${t}: ${e}`).join("\n")||"
7303
8195
  `:""}
7304
8196
 
7305
8197
  ${this._renderEditorModal()}
7306
- `}}__publicField(Ua,"properties",{requests:{type:Array,state:!0},filter:{type:String,state:!0},searchQuery:{type:String,state:!0},expandedId:{type:String,state:!0},detailTab:{type:String,state:!0},replayingId:{type:String,state:!0},copyMenuId:{type:String,state:!0},toastMessage:{type:String,state:!0},editingId:{type:String,state:!0},editData:{type:Object,state:!0}}),__publicField(Ua,"styles",[pt,n`
8198
+ `}}__publicField(Ba,"properties",{requests:{type:Array,state:!0},filter:{type:String,state:!0},searchQuery:{type:String,state:!0},expandedId:{type:String,state:!0},detailTab:{type:String,state:!0},replayingId:{type:String,state:!0},copyMenuId:{type:String,state:!0},toastMessage:{type:String,state:!0},editingId:{type:String,state:!0},editData:{type:Object,state:!0}}),__publicField(Ba,"styles",[pt,n`
7307
8199
  :host {
7308
8200
  display: block;
7309
8201
  padding: 12px;
@@ -8355,7 +9247,7 @@ ${Object.entries(t.responseHeaders||{}).map(([t,e])=>`${t}: ${e}`).join("\n")||"
8355
9247
  color: var(--tdt-text);
8356
9248
  border-color: var(--tdt-accent);
8357
9249
  }
8358
- `]),customElements.define("network-panel",Ua);const Ba=class t extends ot{constructor(){super(),this.settings=_t.getAll(),this.isRecordingShortcut=!1,this.tempShortcut=null,this._unsubscribe=null}connectedCallback(){super.connectedCallback(),this._unsubscribe=_t.subscribe(()=>{this.settings=_t.getAll()})}disconnectedCallback(){super.disconnectedCallback(),this._unsubscribe&&this._unsubscribe(),this._stopRecordingShortcut()}_handleThemeChange(t){_t.set("theme",t),this._dispatchSettingsChanged()}_handleFontSizeChange(t){_t.set("fontSize",t),this._dispatchSettingsChanged()}_handlePersistenceChange(){const t=!this.settings.persistAcrossSessions;_t.set("persistAcrossSessions",t)}_handleDefaultTabChange(t){_t.set("defaultTab",t),this._dispatchSettingsChanged()}_handlePanelHeightChange(t){_t.set("panelHeight",t),this._dispatchSettingsChanged()}_handlePanelPositionChange(t){_t.set("panelPosition",t),this._dispatchSettingsChanged()}_startRecordingShortcut(){this.isRecordingShortcut=!0,this.tempShortcut=null,this._recordingHandler=t=>{t.preventDefault(),t.stopPropagation(),["Control","Shift","Alt","Meta"].includes(t.key)||(this.tempShortcut={key:t.key.toUpperCase(),ctrl:t.ctrlKey,shift:t.shiftKey,alt:t.altKey,meta:t.metaKey},_t.set("keyboardShortcut",this.tempShortcut),this._stopRecordingShortcut(),this._dispatchSettingsChanged())},document.addEventListener("keydown",this._recordingHandler,{capture:!0})}_stopRecordingShortcut(){this.isRecordingShortcut=!1,this._recordingHandler&&(document.removeEventListener("keydown",this._recordingHandler,{capture:!0}),this._recordingHandler=null)}_cancelRecordingShortcut(){this.tempShortcut=null,this._stopRecordingShortcut()}_resetShortcut(){_t.set("keyboardShortcut",yt.keyboardShortcut),this._dispatchSettingsChanged()}_resetAllSettings(){confirm("Reset all settings to defaults? This cannot be undone.")&&(_t.reset(),this._dispatchSettingsChanged())}_dispatchSettingsChanged(){this.dispatchEvent(new CustomEvent("settings-changed",{bubbles:!0,composed:!0}))}_formatShortcutKey(t){const e=navigator.platform.toUpperCase().indexOf("MAC")>=0,i=[];return t.ctrl&&i.push(e?"⌃":"Ctrl"),t.meta&&i.push(e?"⌘":"Win"),t.alt&&i.push(e?"⌥":"Alt"),t.shift&&i.push(e?"⇧":"Shift"),{modifiers:i,key:t.key}}render(){const{modifiers:e,key:i}=this._formatShortcutKey(this.settings.keyboardShortcut);return U`
9250
+ `]),customElements.define("network-panel",Ba);const Va=class t extends ot{constructor(){super(),this.settings=_t.getAll(),this.isRecordingShortcut=!1,this.tempShortcut=null,this._unsubscribe=null}connectedCallback(){super.connectedCallback(),this._unsubscribe=_t.subscribe(()=>{this.settings=_t.getAll()})}disconnectedCallback(){super.disconnectedCallback(),this._unsubscribe&&this._unsubscribe(),this._stopRecordingShortcut()}_handleThemeChange(t){_t.set("theme",t),this._dispatchSettingsChanged()}_handleFontSizeChange(t){_t.set("fontSize",t),this._dispatchSettingsChanged()}_handlePersistenceChange(){const t=!this.settings.persistAcrossSessions;_t.set("persistAcrossSessions",t)}_handleDefaultTabChange(t){_t.set("defaultTab",t),this._dispatchSettingsChanged()}_handlePanelHeightChange(t){_t.set("panelHeight",t),this._dispatchSettingsChanged()}_handlePanelPositionChange(t){_t.set("panelPosition",t),this._dispatchSettingsChanged()}_startRecordingShortcut(){this.isRecordingShortcut=!0,this.tempShortcut=null,this._recordingHandler=t=>{t.preventDefault(),t.stopPropagation(),["Control","Shift","Alt","Meta"].includes(t.key)||(this.tempShortcut={key:t.key.toUpperCase(),ctrl:t.ctrlKey,shift:t.shiftKey,alt:t.altKey,meta:t.metaKey},_t.set("keyboardShortcut",this.tempShortcut),this._stopRecordingShortcut(),this._dispatchSettingsChanged())},document.addEventListener("keydown",this._recordingHandler,{capture:!0})}_stopRecordingShortcut(){this.isRecordingShortcut=!1,this._recordingHandler&&(document.removeEventListener("keydown",this._recordingHandler,{capture:!0}),this._recordingHandler=null)}_cancelRecordingShortcut(){this.tempShortcut=null,this._stopRecordingShortcut()}_resetShortcut(){_t.set("keyboardShortcut",yt.keyboardShortcut),this._dispatchSettingsChanged()}_resetAllSettings(){confirm("Reset all settings to defaults? This cannot be undone.")&&(_t.reset(),this._dispatchSettingsChanged())}_dispatchSettingsChanged(){this.dispatchEvent(new CustomEvent("settings-changed",{bubbles:!0,composed:!0}))}_formatShortcutKey(t){const e=navigator.platform.toUpperCase().indexOf("MAC")>=0,i=[];return t.ctrl&&i.push(e?"⌃":"Ctrl"),t.meta&&i.push(e?"⌘":"Win"),t.alt&&i.push(e?"⌥":"Alt"),t.shift&&i.push(e?"⇧":"Shift"),{modifiers:i,key:t.key}}render(){const{modifiers:e,key:i}=this._formatShortcutKey(this.settings.keyboardShortcut);return U`
8359
9251
  <div class="settings-container">
8360
9252
  <div class="section">
8361
9253
  <div class="section-title">
@@ -8613,7 +9505,7 @@ ${Object.entries(t.responseHeaders||{}).map(([t,e])=>`${t}: ${e}`).join("\n")||"
8613
9505
  </button>
8614
9506
  </div>
8615
9507
  </div>
8616
- `}};__publicField(Ba,"properties",{settings:{type:Object,state:!0},isRecordingShortcut:{type:Boolean,state:!0},tempShortcut:{type:Object,state:!0}}),__publicField(Ba,"AVAILABLE_TABS",[{id:"objects",label:"Objects"},{id:"metafields",label:"Metafields"},{id:"cart",label:"Cart"},{id:"locale",label:"Locale"},{id:"analytics",label:"Analytics"},{id:"seo",label:"SEO"},{id:"apps",label:"Apps"},{id:"console",label:"Console"},{id:"cookies",label:"Cookies"},{id:"storage",label:"Storage"},{id:"info",label:"Info"}]),__publicField(Ba,"styles",[pt,n`
9508
+ `}};__publicField(Va,"properties",{settings:{type:Object,state:!0},isRecordingShortcut:{type:Boolean,state:!0},tempShortcut:{type:Object,state:!0}}),__publicField(Va,"AVAILABLE_TABS",[{id:"objects",label:"Objects"},{id:"metafields",label:"Metafields"},{id:"cart",label:"Cart"},{id:"locale",label:"Locale"},{id:"analytics",label:"Analytics"},{id:"seo",label:"SEO"},{id:"apps",label:"Apps"},{id:"console",label:"Console"},{id:"cookies",label:"Cookies"},{id:"storage",label:"Storage"},{id:"info",label:"Info"}]),__publicField(Va,"styles",[pt,n`
8617
9509
  :host {
8618
9510
  display: block;
8619
9511
  padding: 16px;
@@ -9024,7 +9916,7 @@ ${Object.entries(t.responseHeaders||{}).map(([t,e])=>`${t}: ${e}`).join("\n")||"
9024
9916
  border-color: var(--tdt-accent);
9025
9917
  color: var(--tdt-accent);
9026
9918
  }
9027
- `]);let Va=Ba;customElements.define("tdt-preferences-panel",Va);const Ja=class t extends ot{constructor(){super(),this.isCollapsed=!1,this.activeTab=_t.get("defaultTab")||"objects",this.context=null,this.cart=null,this.product=null,this._unsubscribeCart=null,this._unsubscribeProduct=null,this._unsubscribeSettings=null,this.tabOrder=null,this.hiddenTabs=[],this.draggedTab=null,this.dragOverTab=null,this.showAdminDropdown=!1,this.showTabContextMenu=!1,this.tabContextMenuPosition={x:0,y:0},this.contextMenuTabId=null,this.panelPosition=_t.get("panelPosition")||"bottom",this.panelHeight=_t.get("panelHeight")||"50",this.isDraggingPanel=!1,this._loadFloatingPosition()}_loadFloatingPosition(){try{const t=localStorage.getItem("tdt-floating-position");if(t){const{x:e,y:i,width:s,height:a}=JSON.parse(t);this.floatingX=e,this.floatingY=i,this.floatingWidth=s||700,this.floatingHeight=a||null}else this.floatingX=window.innerWidth-720,this.floatingY=window.innerHeight-400,this.floatingWidth=700,this.floatingHeight=null}catch{this.floatingX=window.innerWidth-720,this.floatingY=window.innerHeight-400,this.floatingWidth=700,this.floatingHeight=null}}_saveFloatingPosition(){try{localStorage.setItem("tdt-floating-position",JSON.stringify({x:this.floatingX,y:this.floatingY,width:this.floatingWidth,height:this.floatingHeight}))}catch{}}_setupResizeObserver(){this._resizeObserver||(this._resizeObserver=new ResizeObserver(t=>{if("floating"===this.panelPosition&&!this.isCollapsed)for(const e of t){const{width:t,height:i}=e.contentRect;(Math.abs(t-(this.floatingWidth||700))>5||Math.abs(i-(this.floatingHeight||300))>5)&&(this.floatingWidth=t,this.floatingHeight=i,this._saveFloatingPosition())}}))}_observeResize(){var t;if("floating"!==this.panelPosition)return;this._setupResizeObserver();const e=null==(t=this.shadowRoot)?void 0:t.querySelector(".dock");e&&this._resizeObserver&&this._resizeObserver.observe(e)}_disconnectResizeObserver(){this._resizeObserver&&this._resizeObserver.disconnect()}connectedCallback(){super.connectedCallback(),this._init(),this._bindKeyboard(),this._restoreState(),this._applySettings(),this._subscribeToSettings(),this._listenForSystemTheme()}updated(t){super.updated(t),t.has("panelPosition")&&"floating"===this.panelPosition&&this._observeResize(),"floating"!==this.panelPosition||this._resizeObserver||this._observeResize()}disconnectedCallback(){var t;super.disconnectedCallback(),this._unsubscribeCart&&this._unsubscribeCart(),this._unsubscribeProduct&&this._unsubscribeProduct(),this._unsubscribeSettings&&this._unsubscribeSettings(),this._mediaQueryListener&&(null==(t=this._systemThemeQuery)||t.removeEventListener("change",this._mediaQueryListener)),this._disconnectResizeObserver(),mt.stopPolling(),ft.destroy(),document.removeEventListener("keydown",this._handleKeydown)}_init(){var t;this.context=ht.parse(),this.context?(mt.interceptAjax(),mt.startPolling(3e3),mt.fetch().then(t=>{t&&mt.setCart(t)}),this._unsubscribeCart=mt.subscribe(t=>{this.cart=t}),(null==(t=this.context.objects)?void 0:t.product)&&(this._unsubscribeProduct=bt.subscribe(t=>{this.product=t}),bt.initialize(this.context.objects.product)),ft.init()):console.warn("[Theme Devtools] No context available")}_bindKeyboard(){this._handleKeydown=t=>{_t.matchesShortcut(t)&&(t.preventDefault(),this._toggleCollapse())},document.addEventListener("keydown",this._handleKeydown)}_subscribeToSettings(){this._unsubscribeSettings=_t.subscribe((t,e)=>{"theme"!==t&&"fontSize"!==t&&"*"!==t||this._applySettings(),"panelPosition"!==t&&"*"!==t||(this.panelPosition=_t.get("panelPosition")||"bottom"),"panelHeight"!==t&&"*"!==t||(this.panelHeight=_t.get("panelHeight")||"50",this._applyPanelHeight())})}_listenForSystemTheme(){this._systemThemeQuery=window.matchMedia("(prefers-color-scheme: dark)"),this._mediaQueryListener=()=>{"system"===_t.get("theme")&&this._applySettings()},this._systemThemeQuery.addEventListener("change",this._mediaQueryListener)}_applySettings(){const t=_t.getAll();let e=t.theme;"system"===e&&(e=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light");const i=dt[e]||dt.dark,s=ct[t.fontSize]||ct.medium;for(const[a,r]of Object.entries(i))this.style.setProperty(a,r);this.style.setProperty("--tdt-scale",s),this._applyPanelHeight()}_applyPanelHeight(){const t=this.panelHeight||"50";this.style.setProperty("--tdt-panel-height",`${t}vh`)}_restoreState(){"true"===localStorage.getItem("theme-devtools-collapsed")&&(this.isCollapsed=!0);const e=localStorage.getItem("theme-devtools-active-tab"),i=t.DEFAULT_TABS.map(t=>t.id);e&&i.includes(e)&&(this.activeTab=e);const s=localStorage.getItem("theme-devtools-tab-order");if(s)try{const e=JSON.parse(s),i=t.DEFAULT_TABS.map(t=>t.id),a=e.filter(t=>i.includes(t)),r=i.filter(t=>!a.includes(t));this.tabOrder=[...a,...r]}catch{this.tabOrder=t.DEFAULT_TABS.map(t=>t.id)}else this.tabOrder=t.DEFAULT_TABS.map(t=>t.id);const a=localStorage.getItem("theme-devtools-hidden-tabs");if(a)try{const t=JSON.parse(a);this.hiddenTabs=t.filter(t=>i.includes(t))}catch{this.hiddenTabs=[]}else this.hiddenTabs=[];if(this.hiddenTabs.includes(this.activeTab)){const t=this.tabOrder.filter(t=>!this.hiddenTabs.includes(t));this.activeTab=t[0]||"objects"}}_getOrderedTabs(){return this.tabOrder?this.tabOrder.filter(t=>!this.hiddenTabs.includes(t)).map(e=>t.DEFAULT_TABS.find(t=>t.id===e)).filter(Boolean):t.DEFAULT_TABS.filter(t=>!this.hiddenTabs.includes(t.id))}_handleDragStart(t,e){this.draggedTab=t,e.dataTransfer.effectAllowed="move",e.dataTransfer.setData("text/plain",t)}_handleDragOver(t,e){e.preventDefault(),e.dataTransfer.dropEffect="move",t!==this.draggedTab&&(this.dragOverTab=t)}_handleDragLeave(){this.dragOverTab=null}_handleDrop(t,e){if(e.preventDefault(),!this.draggedTab||this.draggedTab===t)return void this._resetDragState();const i=[...this.tabOrder],s=i.indexOf(this.draggedTab),a=i.indexOf(t);i.splice(s,1),i.splice(a,0,this.draggedTab),this.tabOrder=i,localStorage.setItem("theme-devtools-tab-order",JSON.stringify(i)),this._resetDragState()}_handleDragEnd(){this._resetDragState()}_resetDragState(){this.draggedTab=null,this.dragOverTab=null}_resetTabOrder(){this.tabOrder=t.DEFAULT_TABS.map(t=>t.id),localStorage.removeItem("theme-devtools-tab-order")}_handleTabContextMenu(t,e){e.preventDefault(),this.contextMenuTabId=t,this.tabContextMenuPosition={x:e.clientX,y:e.clientY},this.showTabContextMenu=!0;const i=t=>{t.target.closest(".tab-context-menu")||(this.showTabContextMenu=!1,document.removeEventListener("click",i))};setTimeout(()=>document.addEventListener("click",i),0)}_closeTabContextMenu(){this.showTabContextMenu=!1,this.contextMenuTabId=null}_hideTab(t){if(!t||"preferences"===t)return void this._showActionFeedback("Cannot hide Preferences tab");if(this.tabOrder.filter(t=>!this.hiddenTabs.includes(t)).length<=2)this._showActionFeedback("Must keep at least 2 tabs visible");else{if(this.hiddenTabs=[...this.hiddenTabs,t],localStorage.setItem("theme-devtools-hidden-tabs",JSON.stringify(this.hiddenTabs)),this.activeTab===t){const t=this.tabOrder.filter(t=>!this.hiddenTabs.includes(t));this.activeTab=t[0]||"objects",localStorage.setItem("theme-devtools-active-tab",this.activeTab)}this._closeTabContextMenu()}}_showTab(t){this.hiddenTabs=this.hiddenTabs.filter(e=>e!==t),localStorage.setItem("theme-devtools-hidden-tabs",JSON.stringify(this.hiddenTabs)),this._closeTabContextMenu()}_showAllTabs(){this.hiddenTabs=[],localStorage.removeItem("theme-devtools-hidden-tabs"),this._closeTabContextMenu(),this._showActionFeedback("All tabs restored")}_resetTabsToDefaults(){this.tabOrder=t.DEFAULT_TABS.map(t=>t.id),this.hiddenTabs=[],localStorage.removeItem("theme-devtools-tab-order"),localStorage.removeItem("theme-devtools-hidden-tabs"),this._closeTabContextMenu(),this._showActionFeedback("Tabs reset to defaults")}_renderTabContextMenu(){if(!this.showTabContextMenu)return"";const e=t.DEFAULT_TABS.find(t=>t.id===this.contextMenuTabId),i=this.hiddenTabs.map(e=>t.DEFAULT_TABS.find(t=>t.id===e)).filter(Boolean);return U`
9919
+ `]);let Ja=Va;customElements.define("tdt-preferences-panel",Ja);const Ga=class t extends ot{constructor(){super(),this.isCollapsed=!0,this.activeTab=_t.get("defaultTab")||"objects",this.context=null,this.cart=null,this.product=null,this._unsubscribeCart=null,this._unsubscribeProduct=null,this._unsubscribeSettings=null,this.tabOrder=null,this.hiddenTabs=[],this.draggedTab=null,this.dragOverTab=null,this.showAdminDropdown=!1,this.showTabContextMenu=!1,this.tabContextMenuPosition={x:0,y:0},this.contextMenuTabId=null,this.panelPosition=_t.get("panelPosition")||"bottom",this.panelHeight=_t.get("panelHeight")||"50",this.isDraggingPanel=!1,this._loadFloatingPosition()}_loadFloatingPosition(){try{const t=localStorage.getItem("tdt-floating-position");if(t){const{x:e,y:i,width:s,height:a}=JSON.parse(t);this.floatingX=e,this.floatingY=i,this.floatingWidth=s||700,this.floatingHeight=a||null}else this.floatingX=window.innerWidth-720,this.floatingY=window.innerHeight-400,this.floatingWidth=700,this.floatingHeight=null}catch{this.floatingX=window.innerWidth-720,this.floatingY=window.innerHeight-400,this.floatingWidth=700,this.floatingHeight=null}}_saveFloatingPosition(){try{localStorage.setItem("tdt-floating-position",JSON.stringify({x:this.floatingX,y:this.floatingY,width:this.floatingWidth,height:this.floatingHeight}))}catch{}}_setupResizeObserver(){this._resizeObserver||(this._resizeObserver=new ResizeObserver(t=>{if("floating"===this.panelPosition&&!this.isCollapsed)for(const e of t){const{width:t,height:i}=e.contentRect;(Math.abs(t-(this.floatingWidth||700))>5||Math.abs(i-(this.floatingHeight||300))>5)&&(this.floatingWidth=t,this.floatingHeight=i,this._saveFloatingPosition())}}))}_observeResize(){var t;if("floating"!==this.panelPosition)return;this._setupResizeObserver();const e=null==(t=this.shadowRoot)?void 0:t.querySelector(".dock");e&&this._resizeObserver&&this._resizeObserver.observe(e)}_disconnectResizeObserver(){this._resizeObserver&&this._resizeObserver.disconnect()}connectedCallback(){super.connectedCallback(),this._init(),this._bindKeyboard(),this._restoreState(),this._applySettings(),this._subscribeToSettings(),this._listenForSystemTheme()}updated(t){super.updated(t),t.has("panelPosition")&&"floating"===this.panelPosition&&this._observeResize(),"floating"!==this.panelPosition||this._resizeObserver||this._observeResize()}disconnectedCallback(){var t;super.disconnectedCallback(),this._unsubscribeCart&&this._unsubscribeCart(),this._unsubscribeProduct&&this._unsubscribeProduct(),this._unsubscribeSettings&&this._unsubscribeSettings(),this._mediaQueryListener&&(null==(t=this._systemThemeQuery)||t.removeEventListener("change",this._mediaQueryListener)),this._disconnectResizeObserver(),mt.stopPolling(),bt.destroy(),document.removeEventListener("keydown",this._handleKeydown)}_init(){var t;this.context=ht.parse(),this.context?(mt.interceptAjax(),mt.startPolling(3e3),mt.fetch().then(t=>{t&&mt.setCart(t)}),this._unsubscribeCart=mt.subscribe(t=>{this.cart=t}),(null==(t=this.context.objects)?void 0:t.product)&&(this._unsubscribeProduct=ft.subscribe(t=>{this.product=t}),ft.initialize(this.context.objects.product)),bt.init()):console.warn("[Theme Devtools] No context available")}_bindKeyboard(){this._handleKeydown=t=>{_t.matchesShortcut(t)&&(t.preventDefault(),this._toggleCollapse())},document.addEventListener("keydown",this._handleKeydown)}_subscribeToSettings(){this._unsubscribeSettings=_t.subscribe((t,e)=>{"theme"!==t&&"fontSize"!==t&&"*"!==t||this._applySettings(),"panelPosition"!==t&&"*"!==t||(this.panelPosition=_t.get("panelPosition")||"bottom"),"panelHeight"!==t&&"*"!==t||(this.panelHeight=_t.get("panelHeight")||"50",this._applyPanelHeight())})}_listenForSystemTheme(){this._systemThemeQuery=window.matchMedia("(prefers-color-scheme: dark)"),this._mediaQueryListener=()=>{"system"===_t.get("theme")&&this._applySettings()},this._systemThemeQuery.addEventListener("change",this._mediaQueryListener)}_applySettings(){const t=_t.getAll();let e=t.theme;"system"===e&&(e=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light");const i=dt[e]||dt.dark,s=ct[t.fontSize]||ct.medium;for(const[a,r]of Object.entries(i))this.style.setProperty(a,r);this.style.setProperty("--tdt-scale",s),this._applyPanelHeight()}_applyPanelHeight(){const t=this.panelHeight||"50";this.style.setProperty("--tdt-panel-height",`${t}vh`)}_restoreState(){const e=localStorage.getItem("theme-devtools-collapsed");null!==e&&(this.isCollapsed="true"===e);const i=localStorage.getItem("theme-devtools-active-tab"),s=t.DEFAULT_TABS.map(t=>t.id);i&&s.includes(i)&&(this.activeTab=i);const a=localStorage.getItem("theme-devtools-tab-order");if(a)try{const e=JSON.parse(a),i=t.DEFAULT_TABS.map(t=>t.id),s=e.filter(t=>i.includes(t)),r=i.filter(t=>!s.includes(t));this.tabOrder=[...s,...r]}catch{this.tabOrder=t.DEFAULT_TABS.map(t=>t.id)}else this.tabOrder=t.DEFAULT_TABS.map(t=>t.id);const r=localStorage.getItem("theme-devtools-hidden-tabs");if(r)try{const t=JSON.parse(r);this.hiddenTabs=t.filter(t=>s.includes(t))}catch{this.hiddenTabs=["locale","analytics","seo","apps","cookies","storage"]}else this.hiddenTabs=["locale","analytics","seo","apps","cookies","storage"];if(this.hiddenTabs.includes(this.activeTab)){const t=this.tabOrder.filter(t=>!this.hiddenTabs.includes(t));this.activeTab=t[0]||"objects"}}_getOrderedTabs(){return this.tabOrder?this.tabOrder.filter(t=>!this.hiddenTabs.includes(t)).map(e=>t.DEFAULT_TABS.find(t=>t.id===e)).filter(Boolean):t.DEFAULT_TABS.filter(t=>!this.hiddenTabs.includes(t.id))}_handleDragStart(t,e){this.draggedTab=t,e.dataTransfer.effectAllowed="move",e.dataTransfer.setData("text/plain",t)}_handleDragOver(t,e){e.preventDefault(),e.dataTransfer.dropEffect="move",t!==this.draggedTab&&(this.dragOverTab=t)}_handleDragLeave(){this.dragOverTab=null}_handleDrop(t,e){if(e.preventDefault(),!this.draggedTab||this.draggedTab===t)return void this._resetDragState();const i=[...this.tabOrder],s=i.indexOf(this.draggedTab),a=i.indexOf(t);i.splice(s,1),i.splice(a,0,this.draggedTab),this.tabOrder=i,localStorage.setItem("theme-devtools-tab-order",JSON.stringify(i)),this._resetDragState()}_handleDragEnd(){this._resetDragState()}_resetDragState(){this.draggedTab=null,this.dragOverTab=null}_resetTabOrder(){this.tabOrder=t.DEFAULT_TABS.map(t=>t.id),localStorage.removeItem("theme-devtools-tab-order")}_handleTabContextMenu(t,e){e.preventDefault(),this.contextMenuTabId=t,this.tabContextMenuPosition={x:e.clientX,y:e.clientY},this.showTabContextMenu=!0;const i=t=>{t.target.closest(".tab-context-menu")||(this.showTabContextMenu=!1,document.removeEventListener("click",i))};setTimeout(()=>document.addEventListener("click",i),0)}_closeTabContextMenu(){this.showTabContextMenu=!1,this.contextMenuTabId=null}_hideTab(t){if(!t||"preferences"===t)return void this._showActionFeedback("Cannot hide Preferences tab");if(this.tabOrder.filter(t=>!this.hiddenTabs.includes(t)).length<=2)this._showActionFeedback("Must keep at least 2 tabs visible");else{if(this.hiddenTabs=[...this.hiddenTabs,t],localStorage.setItem("theme-devtools-hidden-tabs",JSON.stringify(this.hiddenTabs)),this.activeTab===t){const t=this.tabOrder.filter(t=>!this.hiddenTabs.includes(t));this.activeTab=t[0]||"objects",localStorage.setItem("theme-devtools-active-tab",this.activeTab)}this._closeTabContextMenu()}}_showTab(t){this.hiddenTabs=this.hiddenTabs.filter(e=>e!==t),localStorage.setItem("theme-devtools-hidden-tabs",JSON.stringify(this.hiddenTabs)),this._closeTabContextMenu()}_showAllTabs(){this.hiddenTabs=[],localStorage.removeItem("theme-devtools-hidden-tabs"),this._closeTabContextMenu(),this._showActionFeedback("All tabs restored")}_resetTabsToDefaults(){this.tabOrder=t.DEFAULT_TABS.map(t=>t.id),this.hiddenTabs=[],localStorage.removeItem("theme-devtools-tab-order"),localStorage.removeItem("theme-devtools-hidden-tabs"),this._closeTabContextMenu(),this._showActionFeedback("Tabs reset to defaults")}_renderTabContextMenu(){if(!this.showTabContextMenu)return"";const e=t.DEFAULT_TABS.find(t=>t.id===this.contextMenuTabId),i=this.hiddenTabs.map(e=>t.DEFAULT_TABS.find(t=>t.id===e)).filter(Boolean);return U`
9028
9920
  <div
9029
9921
  class="tab-context-menu"
9030
9922
  style="left: ${this.tabContextMenuPosition.x}px; top: ${this.tabContextMenuPosition.y}px;"
@@ -9283,7 +10175,7 @@ ${Object.entries(t.responseHeaders||{}).map(([t,e])=>`${t}: ${e}`).join("\n")||"
9283
10175
  ></tdt-preferences-panel>
9284
10176
  </div>
9285
10177
  </div>
9286
- `}};__publicField(Ja,"properties",{isCollapsed:{type:Boolean,state:!0},activeTab:{type:String,state:!0},context:{type:Object,state:!0},cart:{type:Object,state:!0},product:{type:Object,state:!0},tabOrder:{type:Array,state:!0},hiddenTabs:{type:Array,state:!0},draggedTab:{type:String,state:!0},dragOverTab:{type:String,state:!0},showAdminDropdown:{type:Boolean,state:!0},showTabContextMenu:{type:Boolean,state:!0},tabContextMenuPosition:{type:Object,state:!0},contextMenuTabId:{type:String,state:!0},panelPosition:{type:String,state:!0},panelHeight:{type:String,state:!0},floatingX:{type:Number,state:!0},floatingY:{type:Number,state:!0},isDraggingPanel:{type:Boolean,state:!0}}),__publicField(Ja,"DEFAULT_TABS",[{id:"objects",label:"Objects"},{id:"metafields",label:"Metafields"},{id:"cart",label:"Cart"},{id:"locale",label:"Locale"},{id:"analytics",label:"Analytics"},{id:"seo",label:"SEO"},{id:"apps",label:"Apps"},{id:"network",label:"Network"},{id:"console",label:"Console"},{id:"cookies",label:"Cookies"},{id:"storage",label:"Storage"},{id:"info",label:"Info"},{id:"preferences",label:"Preferences"}]),__publicField(Ja,"styles",[ut,n`
10178
+ `}};__publicField(Ga,"properties",{isCollapsed:{type:Boolean,state:!0},activeTab:{type:String,state:!0},context:{type:Object,state:!0},cart:{type:Object,state:!0},product:{type:Object,state:!0},tabOrder:{type:Array,state:!0},hiddenTabs:{type:Array,state:!0},draggedTab:{type:String,state:!0},dragOverTab:{type:String,state:!0},showAdminDropdown:{type:Boolean,state:!0},showTabContextMenu:{type:Boolean,state:!0},tabContextMenuPosition:{type:Object,state:!0},contextMenuTabId:{type:String,state:!0},panelPosition:{type:String,state:!0},panelHeight:{type:String,state:!0},floatingX:{type:Number,state:!0},floatingY:{type:Number,state:!0},isDraggingPanel:{type:Boolean,state:!0}}),__publicField(Ga,"DEFAULT_TABS",[{id:"objects",label:"Objects"},{id:"metafields",label:"Metafields"},{id:"cart",label:"Cart"},{id:"locale",label:"Locale"},{id:"analytics",label:"Analytics"},{id:"seo",label:"SEO"},{id:"apps",label:"Apps"},{id:"network",label:"Network"},{id:"console",label:"Console"},{id:"cookies",label:"Cookies"},{id:"storage",label:"Storage"},{id:"info",label:"Info"},{id:"preferences",label:"Preferences"}]),__publicField(Ga,"styles",[ut,n`
9287
10179
  .dock {
9288
10180
  position: fixed;
9289
10181
  background: var(--tdt-bg);
@@ -9649,4 +10541,4 @@ ${Object.entries(t.responseHeaders||{}).map(([t,e])=>`${t}: ${e}`).join("\n")||"
9649
10541
  max-height: 200px;
9650
10542
  overflow-y: auto;
9651
10543
  }
9652
- `]);let Ga=Ja;customElements.define("theme-devtools",Ga);function Ka(){const t=document.getElementById("__THEME_DEVTOOLS_ROOT__");if(!t)return void console.warn("[Theme Devtools] Root element not found");const e=document.createElement("theme-devtools");t.appendChild(e),window.__THEME_DEVTOOLS__=e}"loading"===document.readyState?document.addEventListener("DOMContentLoaded",Ka):Ka()}();
10544
+ `]);let Ka=Ga;customElements.define("theme-devtools",Ka);function Qa(){const t=document.getElementById("__THEME_DEVTOOLS_ROOT__");if(!t)return void console.warn("[Theme Devtools] Root element not found");const e=document.createElement("theme-devtools");t.appendChild(e),window.__THEME_DEVTOOLS__=e}"loading"===document.readyState?document.addEventListener("DOMContentLoaded",Qa):Qa()}();