Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@appmate/wishlist

Package Overview
Dependencies
Maintainers
1
Versions
212
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@appmate/wishlist - npm Package Compare versions

Comparing version 5.12.1 to 5.13.0

2

package.json
{
"name": "@appmate/wishlist",
"version": "5.12.1",
"version": "5.13.0",
"description": "Wishlist King SDK",

@@ -5,0 +5,0 @@ "main": "wishlist-app.js",

@@ -1,2 +0,2 @@

var Ot=(o,t,e)=>{if(!t.has(o))throw TypeError("Cannot "+e)};var c=(o,t,e)=>(Ot(o,t,"read from private field"),e?e.call(o):t.get(o)),u=(o,t,e)=>{if(t.has(o))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(o):t.set(o,e)},m=(o,t,e,i)=>(Ot(o,t,"write to private field"),i?i.call(o,e):t.set(o,e),e);var w=(o,t,e)=>(Ot(o,t,"access private method"),e);var Jt=(o=21)=>crypto.getRandomValues(new Uint8Array(o)).reduce((t,e)=>(e&=63,e<36?t+=e.toString(36):e<62?t+=(e-26).toString(36).toUpperCase():e>62?t+="-":t+="_",t),"");var F=class o{constructor(t){this.element=t}replace(t){var e;return(e=this.element)==null||e.replaceWith(t),t}append(t){var e;return(e=this.element)==null||e.append(t),t}prepend(t){var e;return(e=this.element)==null||e.prepend(t),t}insertBefore(t){var e;return(e=this.element)==null||e.before(t),t}insertAfter(t){var e;return(e=this.element)==null||e.after(t),t}closest(t,e=5){if(!this.element)return new o;if(typeof t=="object")return this.searchByStyle(t,this.element,s=>s.parentElement,e);let i=this.element.closest(t);return i?new o(i):new o}find(t){var i;let e=(i=this.element)==null?void 0:i.querySelector(t);return e?new o(e):new o}searchByStyle(t,e,i,s=5){if(s<0||!e)return null;let r=getComputedStyle(e);if(Object.entries(t).every(([l,h])=>r.getPropertyValue(l)===h))return new o(e);let a=i(e);return a?this.searchByStyle(t,a,i,s-1):null}};var Ft,y=o=>(!!localStorage.getItem("debug")&&(Ft=import("https://cdn.jsdelivr.net/npm/debug@4.3.4/+esm")),(e,...i)=>{Ft&&Ft.then(({default:s})=>{s(o)(e,...i)})});var X=y("wk:theme"),z,V,L,ut=class{constructor({routeUtil:t}){u(this,z,void 0);u(this,V,void 0);u(this,L,void 0);m(this,V,[]),m(this,L,t),m(this,z,new MutationObserver(e=>{e.reduce((i,s)=>i.concat(Array.from(s.addedNodes)),[]).filter(i=>i instanceof Element&&!i.hasAttribute("wk-skip")).forEach(i=>{i instanceof Element&&this.scan(i)})})),c(this,z).observe(document,{subtree:!0,childList:!0,attributes:!1})}isNearViewport(t){let e=t.getBoundingClientRect(),i=window.innerHeight||document.documentElement.clientHeight,s=window.innerWidth||document.documentElement.clientWidth,r=-i,n=2*i,a=-s,l=2*s;return(e.top>r&&e.top<i||e.bottom>n&&e.bottom<i)&&(e.left>a&&e.left<s||e.right>l&&e.right<s)}watch(t,e){X("Watch theme for target",{target:t});let i={target:t,callback:e};c(this,V).push(i),Gt(i,c(this,L).parse(window.location.pathname))&&this.scan(document)}scan(t){t&&c(this,V).filter(e=>Gt(e,c(this,L).parse(window.location.pathname))).forEach(e=>{t instanceof Element&&t.matches(e.target.selector)&&this.notify(e,t);let s=t.querySelectorAll(e.target.selector);for(let r of s)this.notify(e,r)})}notify(t,e){e.hasAttribute("wk-skip")||(e.setAttribute("wk-skip",""),X("Found watched element",{target:t.target,element:e,lazy:t.target.lazy,isNearViewport:this.isNearViewport(e)}),t.target.lazy&&!this.isNearViewport(e)?(X("Lazy target not in viewport",{target:t.target,element:e}),new IntersectionObserver(function([i]){i.isIntersecting&&(X("Lazy target entered viewport, notify subscriber",{target:t.target,element:e}),this.disconnect(),t.callback(new F(e)))},{root:null,rootMargin:"100% 100% 100% 100%"}).observe(e)):(X("Notify subscriber about watched element",{target:t.target,element:e}),t.callback(new F(e))))}};z=new WeakMap,V=new WeakMap,L=new WeakMap;function Gt({target:o},t){if(!o.pageType)return!0;if(!t.pageType)return!1;let e=Array.isArray(o.pageType)?o.pageType:[o.pageType];return e.includes("all")?!0:e.includes(t.pageType)}var ae=[{pageType:"product",match:o=>o.includes("/products/")},{pageType:"collection",match:o=>o.includes("/collections/")&&!o.includes("/products/")},{pageType:"account",match:o=>o.includes("/account/")||o.endsWith("/account")},{pageType:"challenge",match:o=>o.endsWith("/account")},{pageType:"blog",match:o=>o.includes("/blog/")},{pageType:"cart",match:o=>o.includes("/cart/")||o.endsWith("/cart")},{pageType:"wishlist",match:(o,{wishlistUrl:t})=>o.includes(t)},{pageType:"page",match:o=>o.includes("/pages/")},{pageType:"search",match:o=>o.includes("/search")},{pageType:"home",match:o=>o.length<4}],mt=class{constructor({wishlistUrl:t}){this.wishlistUrl=t}parse(t){for(let e of ae)if(e.match(t,{wishlistUrl:this.wishlistUrl}))return{pageType:e.pageType};return{pageType:"unknown"}}};var gt=class{constructor(t){this.locale={};var e;this.setLocale((e=t==null?void 0:t.locale)!=null?e:{})}setLocale(t){this.locale=this.decodeLocale(t)}decodeHtmlEntities(t){return t.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&#39;/g,"'")}decodeLocale(t){let e={};for(let i in t){e[i]={};for(let s in t[i])e[i][s]=this.decodeHtmlEntities(t[i][s])}return e}translate(t,e){var n;let[i,s]=t.split("."),r=(n=this.locale[i])==null?void 0:n[s];return r?e?Object.entries(e).reduce((a,[l,h])=>a.replace(new RegExp(`{{\\s*${l}\\s*}}`,"g"),h),r):r:`translation missing: ${t}`}};var ft=class{constructor({rootUrl:t,wishlistUrl:e}){this._rootUrl=t,this.route=new mt({wishlistUrl:e}),this.observer=new ut({routeUtil:this.route}),this.locale=new gt,this.watch=this.observer.watch.bind(this.observer)}getPageType(t=window.location.pathname){return this.route.parse(t).pageType}getWishlistId(t){if(!t)return null;t instanceof URL&&(t=t.pathname),t.endsWith("/")&&(t=t.substring(0,t.length-1));let e=t.replace(this._rootUrl,"/").split("/");return e.length===4?e.pop():"mine"}getProductHandle(t){var e,i;return t?(t instanceof URL&&(t=t.pathname),t.endsWith("/")&&(t=t.slice(0,-1)),(i=(e=window.decodeURI(t).split("/").pop())==null?void 0:e.split("?")[0])==null?void 0:i.split("#")[0]):null}getVariantId(t,e){var s;let i=null;if(t&&(t instanceof URL&&(t=t.pathname),i=new URLSearchParams(t.split("?")[1]).get("variant")),!i&&e)try{i=new FormData((s=e.element)!=null?s:e).get("id")}catch(r){console.warn("Failed to parse variant from product form.",r)}return i}translate(t,e){return this.locale.translate(t,e)}createComponent(t,e){var s;let i=document.createElement(t);if(e!=null&&e.dataset&&Object.entries(e==null?void 0:e.dataset).forEach(([r,n])=>{n&&(typeof n=="boolean"?i.dataset[r]="":typeof n=="object"?i.dataset[r]=JSON.stringify(n):i.dataset[r]=n)}),e!=null&&e.props&&Object.entries(e==null?void 0:e.props).forEach(([r,n])=>{if(r==="floating"&&n){let a=n,l=(a==null?void 0:a.reference)instanceof F?a.reference.element:a.reference;if(typeof l=="object"&&"id"in l){l.setAttribute("wk-id",Jt()),i[r]={...a,reference:`[wk-id="${l.getAttribute("wk-id")}"]`};return}}i[r]=n}),(s=e==null?void 0:e.wrap)!=null&&s.name){let r=this.createElement(e.wrap.name,e.wrap.props,i);return r.setAttribute("wk-skip",""),r}return i}createHeadlessComponent(t,e){var r;let i=e.host.element?e.host.element:e.host;if(!i)throw new Error("Headless host is undefined");e.dataset&&Object.entries(e.dataset).forEach(([n,a])=>{a&&(typeof a=="boolean"?i.dataset[n]="":typeof a=="object"?i.dataset[n]=JSON.stringify(a):i.dataset[n]=a)});let s=(r=window.headlessElements)==null?void 0:r.get(t);if(!s)throw new Error(`Headless element not found: ${t}`);return new s(i)}createElement(t,e={},...i){let s=Object.assign(document.createElement(t),e);return i&&s.append(...i),s}};var Qt=y("wk:events"),yt=class{constructor(){this.dispatcher=document}publish(t){let e=new CustomEvent(`wk:${t.name}`,{detail:t,bubbles:!1,cancelable:!1});Qt(`Publish: ${t.name}`,{message:t,event:e}),this.dispatcher.dispatchEvent(e)}once(t,e){this.subscribe(t,e,{once:!0})}subscribe(t,e,i){t.startsWith("wk:")&&(t=t.replace("wk:","")),Qt(`Subscribe: ${t}`,{handler:e,options:i}),this.dispatcher.addEventListener(`wk:${t}`,s=>{let r=s;e({name:r.type.replace("wk:",""),data:r.detail.data})},{once:!!(i!=null&&i.once)})}subscribeMany(t){return Object.entries(t).map(([e,i])=>this.subscribe(e,i))}};function Yt(o,t){let e=o.items.map(i=>{let s=t.find(r=>r==null?void 0:r.id.endsWith(i.productId.toString()));return s?{id:i.id,variantId:i.variantId,product:{...Nt(s),hidden:!1},metafields:void 0}:null}).filter(i=>!!i);return{id:o.isMine?"mine":o.id,publicId:o.publicId,isMine:o.isMine,numItems:e.length,items:e}}function Zt({wishlistItem:o,productHandle:t,variantId:e}){return o?{productHandle:t,wishlistItemId:o.id,productId:o.product.id,variantId:o.variantId,inWishlist:!0}:{productHandle:t,wishlistItemId:void 0,productId:0,variantId:e,inWishlist:!1}}var Nt=o=>{var t,e,i,s;return{id:parseInt(o.id.split("/").pop()),available:o.availableForSale,compare_at_price_max:parseFloat(o.compareAtPriceRange.maxVariantPrice.amount)*100,compare_at_price_min:parseFloat(o.compareAtPriceRange.minVariantPrice.amount)*100,compare_at_price_varies:o.compareAtPriceRange.maxVariantPrice.amount!==o.compareAtPriceRange.minVariantPrice.amount,featured_image:(e=(t=o.featuredImage)==null?void 0:t.url)!=null?e:null,handle:o.handle,images:o.images.nodes.map(r=>r.url),options:o.options,price_max:parseFloat(o.priceRange.maxVariantPrice.amount)*100,price_min:parseFloat(o.priceRange.minVariantPrice.amount)*100,price_varies:o.priceRange.maxVariantPrice.amount!==o.priceRange.minVariantPrice.amount,tags:o.tags,title:o.title,type:o.productType,url:`${window.Shopify.routes.root}products/${o.handle}`,variants:o.variants.nodes.map(r=>{var n,a,l,h,p,d;return{available:r.availableForSale,compare_at_price:r.compareAtPrice?parseFloat(r.compareAtPrice.amount)*100:null,featured_image:r.image?{alt:r.image.altText,src:r.image.url}:null,id:parseInt(r.id.split("/").pop()),option1:r.selectedOptions[0].value,option2:(a=(n=r.selectedOptions[1])==null?void 0:n.value)!=null?a:null,option3:(h=(l=r.selectedOptions[2])==null?void 0:l.value)!=null?h:null,price:parseFloat(r.price.amount)*100,sku:r.sku,title:r.title,metafields:(d=(p=r.metafields)==null?void 0:p.reduce((g,f)=>{var I;return f!=null&&f.value?{...g,[f.namespace]:{...(I=g[f.namespace])!=null?I:{},[f.key]:f.value}}:g},{}))!=null?d:{}}}),vendor:o.vendor,metafields:(s=(i=o.metafields)==null?void 0:i.reduce((r,n)=>{var a;return n!=null&&n.value?{...r,[n.namespace]:{...(a=r[n.namespace])!=null?a:{},[n.key]:n.value}}:r},{}))!=null?s:{}}};function Xt({wishlist:o,productHandle:t,productId:e,variantId:i,mulitVariantMode:s}){return o.items.find(r=>{let n=e&&r.product.id===e,a=t&&r.product.handle===t;return(n||a)&&(!i||!s||r.variantId===i)})}var Mt=1,zt={shopify:`wk-shopify-v${Mt}`,storefront:`wk-storefront-v${Mt}`,wishlist:`wk-wishlist-v${Mt}`};var ce=()=>{let o=y("wk:cache"),t=Object.values(zt);caches.keys().then(e=>Promise.all(e.map(i=>{if(!t.includes(i))return o("Delete old cache",{cacheName:i}),caches.delete(i)})))};ce();var v,P,k,A,R,D=class{constructor(t){u(this,v,void 0);u(this,P,void 0);u(this,k,new Map);u(this,A,void 0);u(this,R,void 0);m(this,R,zt[t.name]),m(this,A,y(`wk:cache:${t.name}`)),this.initCache({name:c(this,R)})}async initCache({name:t}){if(!c(this,v)){if(c(this,P))return c(this,P);try{m(this,P,caches.open(t)),m(this,v,await c(this,P)),m(this,P,void 0),c(this,A).call(this,"Cache initialised")}catch(e){console.warn("Failed to open cache.",e)}}}async withCache(t,e,i){c(this,P)&&await c(this,P);let s=this.hashKey(t),r=p=>i(p).then(async d=>(c(this,A).call(this,"Fetched from remote",{cacheKey:s,strategy:e,value:d}),c(this,k).delete(s),await this.setItemInCache(s,e,d),d)),n=p=>this.getItemInCache(s).then(async d=>{if(d){let g=this.getCacheInfo(d.headers);if(g.stale&&g.revalidate)return c(this,A).call(this,"Revalidate while stale",{cacheKey:s,strategy:e,cacheInfo:g}),c(this,k).delete(s),r(p),d.json().then(({value:f})=>f);if(!g.stale)return c(this,A).call(this,"Serve cached value",{cacheKey:s,strategy:e,cacheInfo:g}),c(this,k).delete(s),d.json().then(({value:f})=>f)}return c(this,A).call(this,"Missed cache",{cacheKey:s,strategy:e}),r(p)}),a=c(this,k).get(s);if(a)return a.promise;let l=new AbortController,h=n(l.signal);return c(this,k).set(s,{promise:h,controller:l}),h}async setItemInCache(t,e,i){if(!c(this,v)||e==="no-store")return i;let s=`https://wishlistking.dev/${t}`,r=new Request(s),n=new Response(JSON.stringify({value:i}));return n.headers.set("cache-control",e),n.headers.set("cache-put-date",new Date().toUTCString()),await c(this,v).put(r,n),i}async getItemInCache(t){if(!c(this,v))return;let e=`https://wishlistking.dev/${t}`,i=new Request(e);return c(this,v).match(i)}getCacheInfo(t){var r;let e={stale:!0,revalidate:!1},i=t.get("cache-control"),s=t.get("cache-put-date");return!i||!s?e:(r=i.toLocaleLowerCase().split(",").map(n=>n.trim()).reduce((n,a)=>{var l,h;if(a.startsWith("max-age=")){let p=parseInt((l=a.split("=").pop())!=null?l:"0")*1e3;return{...n,stale:Date.now()-new Date(s).getTime()>p}}if(a.startsWith("stale-while-revalidate=")){let p=parseInt((h=a.split("=").pop())!=null?h:"0")*1e3;return{...n,revalidate:Date.now()-new Date(s).getTime()<p}}return n},e))!=null?r:e}hashKey(t){let e=Array.isArray(t)?t:[t],i="";for(let s of e)s!=null&&(typeof s=="object"?i+=JSON.stringify(s):i+=s.toString());return encodeURIComponent(i)}async clear(t=!1){if(c(this,P)&&await c(this,P),!c(this,v))return;c(this,A).call(this,"Clear cache",{name:c(this,R),force:t}),t&&(c(this,k).forEach(i=>{c(this,A).call(this,"Abort pending request",{name:c(this,R)}),i.controller.abort("Forced cache clear")}),c(this,k).clear());let e=await c(this,v).keys();for(let i of e)await c(this,v).delete(i),c(this,A).call(this,"Deleted from cache",{name:c(this,R),key:i})}};v=new WeakMap,P=new WeakMap,k=new WeakMap,A=new WeakMap,R=new WeakMap;var tt,H=class{constructor(t){u(this,tt,void 0);m(this,tt,t)}subscribe(t){let e=c(this,tt).call(this,new Vt(t));return new Lt(()=>{e==null||e()})}};tt=new WeakMap;var et,Vt=class{constructor(t){u(this,et,void 0);m(this,et,t)}next(t){c(this,et).call(this,t)}};et=new WeakMap;var it,Lt=class{constructor(t){u(this,it,void 0);m(this,it,t)}unsubscribe(){var t;(t=c(this,it))==null||t.call(this)}};it=new WeakMap;var b=y("wk:state"),S,C,j,W,N,rt,T,M,st,bt,te,St,ee,x,O,wt=class{constructor({wishlistApi:t,shopifyApi:e,storefrontApi:i,settings:s,events:r,utils:n}){u(this,M);u(this,bt);u(this,St);u(this,x);u(this,S,void 0);u(this,C,void 0);u(this,j,void 0);u(this,W,void 0);u(this,N,void 0);u(this,rt,void 0);u(this,T,void 0);m(this,S,t),m(this,C,e),m(this,j,i),m(this,N,s),m(this,W,r),m(this,rt,n)}async revalidate(t=!1){b("Revalidate wishlist state"),await this.clearCache(t),c(this,W).publish({name:"state:refetch"})}observeWishlist({wishlistId:t}){return new H(e=>{let i={id:t,isMine:t==="mine",items:[],numItems:0},s=()=>{c(this,S).loadWishlist({wishlistId:t}).then(({wishlist:n})=>{JSON.stringify(n)!==JSON.stringify(i)&&(i=n,b("Update wishlist state",{wishlistId:t,nextState:n}),e.next(n)),m(this,T,void 0)})},r=n=>{var l;if(!i||!((l=n.data)!=null&&l.stateAction))return;let a=w(this,bt,te).call(this,i,n.data.stateAction);b("Update wishlist state (optimistic)",{wishlistId:t,optimisticState:a}),e.next(a)};c(this,W).subscribe("state:refetch",s),c(this,W).subscribe("state:action",r),s()})}observeProductInfo({productHandle:t,variantId:e}){return new H(i=>{let s;this.observeWishlist({wishlistId:"mine"}).subscribe(r=>{let n=Xt({wishlist:r,productHandle:t,variantId:e,mulitVariantMode:c(this,N).general.wishlistMode==="VARIANT"}),a=Zt({wishlistItem:n,productHandle:t,variantId:e});JSON.stringify(a)!==JSON.stringify(s)&&(s=a,i.next(a))})})}observeShopifyCart({cacheStrategy:t}){let e={token:"",total_price:0,total_weight:0,item_count:0,items:[],requires_shipping:!0,currency:"USD",items_subtotal_price:0};return new H(i=>{let s=()=>{b("Refetch cart"),c(this,C).loadCart({cacheStrategy:t}).then(r=>{JSON.stringify(r)!==JSON.stringify(e)&&(e=r,b("Update cart state (remote)",{nextState:r}),i.next(r))})};c(this,W).subscribe("state:refetch",s),s()})}async addWishlistItem(t){if(c(this,T))return;b("Add wishlist item",{params:t});let e=typeof t.variantId=="string"?parseInt(t.variantId):t.variantId,i=t.productHandle;if(w(this,x,O).call(this,"wishlist:add",{productHandle:i,variantId:e}),!i)throw new Error("Product handle is required");w(this,M,st).call(this,{name:"wishlist:add",state:"submitting",body:{productHandle:i,variantId:e}});let s=await c(this,j).loadProductIdByHandle({productHandle:i}),{wishlistItem:r,sessionId:n}=await c(this,S).addItem({productId:s,variantId:e}).catch(a=>{throw console.error(a),this.revalidate(),a});return n&&c(this,W).publish({name:"app:init-sid",data:{sessionId:n}}),b("Added wishlist item",{params:t,wishlistItem:r}),this.revalidate(),this.publishEvent({eventName:"wishlist:add:success",wishlistId:"mine",productId:s,variantId:e}),{wishlistItem:r}}async updateWishlistItem({wishlistItemId:t,changes:e}){if(c(this,T))return;b("Update wishlist item",{wishlistItemId:t,changes:e});let i=typeof e.variantId=="string"?parseInt(e.variantId):e.variantId;w(this,x,O).call(this,"wishlist:change-variant",{wishlistItemId:t,variantId:i}),w(this,M,st).call(this,{name:"wishlist:change-variant",state:"submitting",body:{wishlistItemId:t,variantId:i}});let{wishlistItem:s}=await c(this,S).updateItem({wishlistItemId:t,changes:{variantId:i}}).catch(r=>{throw console.error(r),this.revalidate(),r});return b("Updated wishlist item",{wishlistItemId:t,changes:e,wishlistItem:s}),this.revalidate(),this.publishEvent({eventName:"wishlist:change-variant:success",wishlistId:"mine",productId:s.product.id,variantId:i}),{wishlistItem:s}}async removeWishlistItem({wishlistItemId:t}){if(c(this,T))return;b("Remove wishlist item",{wishlistItemId:t}),w(this,x,O).call(this,"wishlist:remove",{wishlistItemId:t}),w(this,M,st).call(this,{name:"wishlist:remove",state:"submitting",body:{wishlistItemId:t}});let{wishlistItem:e}=await c(this,S).removeItem({wishlistId:"mine",wishlistItemId:t}).catch(i=>{throw console.error(i),this.revalidate(),i});return b("Removed wishlist item",{wishlistItemId:t,wishlistItem:e}),this.revalidate(),this.publishEvent({eventName:"wishlist:remove:success",wishlistId:"mine",productId:e.product.id,variantId:e.selectedVariantId}),{wishlistItem:e}}async clearWishlist(){c(this,T)||(b("Clear wishlist"),w(this,x,O).call(this,"wishlist:clear"),w(this,M,st).call(this,{name:"wishlist:clear",state:"submitting"}),await c(this,S).clearWishlist().catch(t=>{throw console.error(t),this.revalidate(),t}),b("Cleared wishlist"),this.revalidate(),this.publishEvent({eventName:"wishlist:clear:success",wishlistId:"mine"}))}async clearCache(t=!1){b("Clear cache"),await c(this,C).clearCache(t),await c(this,S).clearCache(t)}async addToCart({wishlistId:t,wishlistItemId:e,variantId:i,quantity:s=1,properties:r,sectionsToRender:n,sectionsUrl:a}){t==="mine"&&w(this,x,O).call(this,"wishlist:add-to-cart");let l=await c(this,C).addToCart({id:i,quantity:s,properties:r,sections:n,sections_url:a?encodeURI(a):void 0}),[{wishlist:h},p]=await Promise.all([c(this,S).loadWishlist({wishlistId:t,cacheStrategy:"no-store"}),c(this,C).loadCart({cacheStrategy:"no-store"})]),d=h.items.find(g=>g.id===e);return this.revalidate(),this.publishEvent({eventName:"wishlist:add-to-cart:success",wishlistId:t,productId:d.product.id,variantId:i}),{wishlist:h,wishlistItem:d,cart:p,cartResponse:l}}async addAllToCart({wishlistId:t,sectionsToRender:e,sectionsUrl:i}){var l;if(c(this,T))return;t==="mine"&&w(this,x,O).call(this,"wishlist:add-to-cart");let{wishlist:r}=await c(this,S).loadWishlist({wishlistId:t,cacheStrategy:"no-store"}),n=r.items.filter(h=>!!h.variantId).filter(h=>{let p=h.product.variants.find(d=>d.id===h.variantId);return!!(p!=null&&p.available)});if(!n.length)return{cartResponse:null,wishlistItems:[]};let a=await c(this,C).addToCart({items:(l=n.map(h=>({id:h.variantId,quantity:1})))!=null?l:[],sections:e,sections_url:i?encodeURI(i):void 0});return this.revalidate(),this.publishEvent({eventName:"wishlist:add-all-to-cart:success",wishlistId:"mine"}),{cartResponse:a,wishlistItems:n}}async shareWishlist({wishlistId:t,title:e,text:i}){if(c(this,T))return;t==="mine"&&w(this,x,O).call(this,"wishlist:share");let s={url:c(this,rt).url.getPublicWishlistUrl(t),title:e,text:i},r={webShare:!1,clipboard:!1};try{await navigator.share(s),r.webShare=!0}catch(n){r.webShare=!1}if(!r.webShare)try{await navigator.clipboard.writeText(s.url),r.clipboard=!0}catch(n){r.clipboard=!1}return this.publishEvent({eventName:"wishlist:share:success",wishlistId:t}),r}async publishEvent({eventName:t,wishlistId:e,productId:i,variantId:s}){let[r,n]=await Promise.all([e?c(this,S).loadWishlist({wishlistId:e}).then(({wishlist:l})=>l):Promise.resolve(void 0),i?c(this,j).loadProduct({productId:i}).then(l=>l?Nt(l):null):Promise.resolve(void 0)]),a=s?n==null?void 0:n.variants.find(l=>l.id===s):void 0;c(this,W).publish({name:t,data:{wishlist:r,product:n,variant:a}})}};S=new WeakMap,C=new WeakMap,j=new WeakMap,W=new WeakMap,N=new WeakMap,rt=new WeakMap,T=new WeakMap,M=new WeakSet,st=function(t){m(this,T,t),c(this,W).publish({name:"state:action",data:{stateAction:t}})},bt=new WeakSet,te=function(t,e){var i,s,r,n;switch(e.name){case"wishlist:add":return{...t,items:[{id:`temp-${Date.now()}`,product:{id:(s=(i=e.body)==null?void 0:i.productId)!=null?s:0,handle:(n=(r=e.body)==null?void 0:r.productHandle)!=null?n:"",variants:[]}},...t.items],numItems:t.items.length+1};case"wishlist:remove":return{...t,items:t.items.filter(a=>{var l;return a.id!==((l=e.body)==null?void 0:l.wishlistItemId)}),numItems:t.items.length-1};default:return t}},St=new WeakSet,ee=function(t,e){var s;if(c(this,N).general.wishlistAccessMode==="UNRESTRICTED"||c(this,S).hasCustomer)return!1;if((s=le[c(this,N).general.wishlistAccessMode])==null?void 0:s.includes(t))return["wishlist:load"].includes(t)||c(this,W).publish({name:"wishlist:login-required",data:{action:t,...e}}),!0},x=new WeakSet,O=function(t,e){if(w(this,St,ee).call(this,t,e))throw new Error("Wishlist requires login")};var le={REQUIRE_LOGIN_BEFORE_USE:["wishlist:load","wishlist:add","wishlist:remove","wishlist:change-variant","wishlist:clear","wishlist:add-to-cart","wishlist:share","wishlist:view"],REQUIRE_LOGIN_TO_VIEW_LIST:["wishlist:view"]};var It=class{constructor(t){this.rootUrl=t.rootUrl,this.shopDomain=t.shopDomain,this.wishlistUrl=t.wishlistUrl,this.placeholderImageUrl=t.placeholderImageUrl,this.fileUrl=t.fileUrl}getPublicWishlistUrl(t){return`https://${this.shopDomain}${this.wishlistUrl}/${t}`}getFileUrl(t=""){return`https:${this.fileUrl.split("?")[0]}${t}`}getImageUrl(t,e){var s,r;if(!t)return(s=this.placeholderImageUrl)!=null?s:"";let i=this.getImage(t);return i!=null&&i.src?this.appendSize(i.src,e):(r=this.placeholderImageUrl)!=null?r:""}getImage(t){var e,i,s;if(t.hasOwnProperty("sku"))return{src:(i=(e=t.featured_image)==null?void 0:e.src)!=null?i:""};if(t.variants){let r=t;return{src:(s=r.featured_image)!=null?s:r.images[0]}}else if(t.hasOwnProperty("src"))return{src:t.src};return null}appendSize(t,e){let i=new URL(t.startsWith("//")?`https://${t}`:t);return e!=null&&e.width&&i.searchParams.set("width",e==null?void 0:e.width.toString()),e!=null&&e.height&&i.searchParams.set("height",e==null?void 0:e.height.toString()),i.href}getVariantUrl(t,e){if(t)return e?t+`?variant=${e}`:t}handlelize(t){return t.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/([^\w]+|\s+)/g,"-").replace(/\-\-+/g,"-").replace(/(^-+|-+$)/g,"").toLowerCase()}};var vt=class{constructor(t){this.placeholderRegex=/\{\{\s*(\w+)\s*\}\}/;var e,i;this.moneyFormat=(e=t.moneyFormat)!=null?e:"${{amount}}",this.moneyFormatWithCurrency=(i=t.moneyFormatWithCurrency)!=null?i:"${{amount}} USD"}formatMoney(t,e){var s,r;let i=(s=e==null?void 0:e.withCurrency)!=null?s:!1;return typeof t=="string"&&(t=parseInt(t.replace(".",""))),(i?this.moneyFormatWithCurrency:this.moneyFormat).replace(this.placeholderRegex,this.formatCents(t,(r=this.moneyFormat.match(this.placeholderRegex))==null?void 0:r[1]))}formatCents(t,e){switch(e){case"amount_no_decimals":return this.formatWithDelimiters(t,0);case"amount_with_comma_separator":return this.formatWithDelimiters(t,2,".",",");case"amount_no_decimals_with_comma_separator":return this.formatWithDelimiters(t,0,".",",");case"amount":default:return this.formatWithDelimiters(t,2)}}formatWithDelimiters(t,e=2,i=",",s="."){if(isNaN(t)||t==null)return"0";let n=(t/100).toFixed(e).split("."),a=n[0].replace(/(\d)(?=(\d\d\d)+(?!\d))/g,`$1${i}`),l=n[1]?s+n[1]:"";return a+l}};var Pt=class{getFormState({product:t,options:e,autoSelect:i=!1,change:s}){let r=this.getSelectedOptions({product:t,options:e,change:s,autoSelect:i}),n=r&&Object.values(r).every(h=>!!h),a=this.getOptionsWithValues({product:t,selectedOptions:r});return{selectedVariant:this.getVariantByOptions({product:t,options:r,optionsWithValues:a}),selectedOptions:r,hasSelection:n,optionsWithValues:a,hasOnlyDefaultVariant:t.options.length===1&&t.options[0].name==="Title"&&t.options[0].values.length==1}}getSelectedOptions({product:t,options:e,autoSelect:i,change:s={}}){let r=Object.fromEntries(Object.entries({...e,...s}).map(([p,d],g)=>{var f;return!d&&((f=t.options[g])==null?void 0:f.values.length)===1?[p,t.options[g].values[0]]:[p,d]}));if(!i)return r;let n=Object.keys(s).pop(),a=Object.fromEntries(n?Object.entries(r).filter(([p])=>n>p):Object.entries(e).filter(([,p])=>!!p)),l=Object.fromEntries(Object.entries(r).filter(([p])=>!(p in a)));return Object.keys(l).reduce((p,d)=>{var f;let g=this.getAllVariantsByOptions({product:t,options:p});return g.length?{...p,[d]:((f=g.find(I=>I.available))!=null?f:g[0])[d]}:{...p,[d]:null}},a)}getVariantOptions({variant:t}){var e,i,s;return{option1:(e=t==null?void 0:t.option1)!=null?e:null,option2:(i=t==null?void 0:t.option2)!=null?i:null,option3:(s=t==null?void 0:t.option3)!=null?s:null}}getOptionsWithValues({product:t,selectedOptions:e={}}){return t.options.map((i,s)=>{var h;let r=`option${s+1}`,n=this.getUnavailableOptionValues({product:t,optionKey:r,selectedOptions:e,values:i.values}),a=this.getSoldoutOptionValues({product:t,optionKey:r,selectedOptions:e,values:i.values}),l=(h=e==null?void 0:e[r])!=null?h:null;return{...i,selectedValue:l,soldoutValues:a,unavailableValues:n}})}getSoldoutOptionValues({product:t,optionKey:e,values:i,selectedOptions:s={}}){let r=Object.fromEntries(Object.entries(s).filter(([n])=>n<e));return i.filter(n=>{let a=t.variants.filter(l=>this.matchesVariant({variant:l,options:{...r,[e]:n}}));return a.length?a.every(l=>!l.available):!1})}getUnavailableOptionValues({product:t,optionKey:e,values:i,selectedOptions:s={}}){let r=Object.fromEntries(Object.entries(s).filter(([n])=>n<e));return i.filter(n=>t.variants.every(a=>!this.matchesVariant({variant:a,options:{...r,[e]:n}})))}getFirstAvailableVariant({product:t}){var e;return(e=t.variants.find(i=>i.available))!=null?e:null}getSelectedVariant({product:t,variantId:e}){var i;return(i=t.variants.find(s=>s.id===e))!=null?i:null}matchesVariant({variant:t,options:e}){return(!(e!=null&&e.option1)||e.option1===t.option1)&&(!(e!=null&&e.option2)||e.option2===t.option2)&&(!(e!=null&&e.option3)||e.option3===t.option3)}getFormData({form:t,product:e}){let i=new FormData(t);return{quantity:this.getFormQuantity({form:t}),options:this.getFormOptions({formData:i,product:e})}}getFormQuantity({form:t}){var s;let i=(s=new FormData(t).get("quantity"))==null?void 0:s.toString();return i?parseInt(i):1}getFormProperties({form:t}){let e=new FormData(t);return Array.from(e.entries()).reduce((i,s)=>{if(!s[0].startsWith("properties["))return i;let r=s[0].replace("properties[","").replace("]","");return{...i,[r]:`${s[1]}`}},{})}getVariantByOptions({product:t,options:e,optionsWithValues:i}){var r;let s=Object.entries(e).reduce((n,[,a],l)=>(n[l]=a,n),new Array(3).fill(null));return(r=t.variants.find(n=>s.every((a,l)=>i[l]?n[`option${l+1}`]===a:!0)))!=null?r:null}getAllVariantsByOptions({product:t,options:e}){var s;let i=Object.entries(e).reduce((r,[,n],a)=>(r[a]=n,r),new Array(3).fill(null));return(s=t.variants.filter(r=>i.every((n,a)=>!n||r[`option${a+1}`]===n)))!=null?s:[]}getFormOptions({formData:t,product:e}){return Array.from(t.entries()).reduce((i,[s,r])=>{var l;let n=(l=s.match(/\[(.*?)\]/))==null?void 0:l[1];if(!n)return i;let a=e.options.findIndex(h=>h.name===n)+1;if(a>0){let h=`option${a}`;i[h]=r.toString()||null}return i},{})}getInputOption({input:t,product:e}){var r;let i=(r=t.name.match(/\[(.*?)\]/))==null?void 0:r[1];if(!i)return null;let s=e.options.findIndex(n=>n.name===i)+1;return s>0?{[`option${s}`]:t.value.toString()}:null}};var $,nt,q,K,ot,at,ct,At=class{constructor(t){u(this,$,void 0);u(this,nt,void 0);u(this,q,void 0);u(this,K,void 0);u(this,ot,void 0);u(this,at,[]);u(this,ct,[]);m(this,K,t.country),m(this,q,t.language),m(this,$,`https://${t.storeName}.myshopify.com/api/${t.version}/graphql.json`),m(this,nt,{accept:"application/json","content-type":"application/json","x-shopify-storefront-access-token":t.accessToken}),m(this,ot,new D({name:"storefront"}))}setFields({productMetafields:t,variantMetafields:e}){t&&m(this,at,t),e&&m(this,ct,e)}loadProduct({productId:t,cacheStrategy:e="public, max-age=1, stale-while-revalidate=10"}){let i=`
var Ot=(o,t,e)=>{if(!t.has(o))throw TypeError("Cannot "+e)};var c=(o,t,e)=>(Ot(o,t,"read from private field"),e?e.call(o):t.get(o)),u=(o,t,e)=>{if(t.has(o))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(o):t.set(o,e)},m=(o,t,e,i)=>(Ot(o,t,"write to private field"),i?i.call(o,e):t.set(o,e),e);var w=(o,t,e)=>(Ot(o,t,"access private method"),e);var Jt=(o=21)=>crypto.getRandomValues(new Uint8Array(o)).reduce((t,e)=>(e&=63,e<36?t+=e.toString(36):e<62?t+=(e-26).toString(36).toUpperCase():e>62?t+="-":t+="_",t),"");var F=class o{constructor(t){this.element=t}replace(t){var e;return(e=this.element)==null||e.replaceWith(t),t}append(t){var e;return(e=this.element)==null||e.append(t),t}prepend(t){var e;return(e=this.element)==null||e.prepend(t),t}insertBefore(t){var e;return(e=this.element)==null||e.before(t),t}insertAfter(t){var e;return(e=this.element)==null||e.after(t),t}closest(t,e=5){if(!this.element)return new o;if(typeof t=="object")return this.searchByStyle(t,this.element,s=>s.parentElement,e);let i=this.element.closest(t);return i?new o(i):new o}find(t){var i;let e=(i=this.element)==null?void 0:i.querySelector(t);return e?new o(e):new o}searchByStyle(t,e,i,s=5){if(s<0||!e)return null;let r=getComputedStyle(e);if(Object.entries(t).every(([l,h])=>r.getPropertyValue(l)===h))return new o(e);let a=i(e);return a?this.searchByStyle(t,a,i,s-1):null}};var Ft,y=o=>(!!localStorage.getItem("debug")&&(Ft=import("https://cdn.jsdelivr.net/npm/debug@4.3.4/+esm")),(e,...i)=>{Ft&&Ft.then(({default:s})=>{s(o)(e,...i)})});var X=y("wk:theme"),z,V,L,ut=class{constructor({routeUtil:t}){u(this,z,void 0);u(this,V,void 0);u(this,L,void 0);m(this,V,[]),m(this,L,t),m(this,z,new MutationObserver(e=>{e.reduce((i,s)=>i.concat(Array.from(s.addedNodes)),[]).filter(i=>i instanceof Element&&!i.hasAttribute("wk-skip")).forEach(i=>{i instanceof Element&&this.scan(i)})})),c(this,z).observe(document,{subtree:!0,childList:!0,attributes:!1})}isNearViewport(t){let e=t.getBoundingClientRect(),i=window.innerHeight||document.documentElement.clientHeight,s=window.innerWidth||document.documentElement.clientWidth,r=-i,n=2*i,a=-s,l=2*s;return(e.top>r&&e.top<i||e.bottom>n&&e.bottom<i)&&(e.left>a&&e.left<s||e.right>l&&e.right<s)}watch(t,e){X("Watch theme for target",{target:t});let i={target:t,callback:e};c(this,V).push(i),Gt(i,c(this,L).parse(window.location.pathname))&&this.scan(document)}scan(t){t&&c(this,V).filter(e=>Gt(e,c(this,L).parse(window.location.pathname))).forEach(e=>{t instanceof Element&&t.matches(e.target.selector)&&this.notify(e,t);let s=t.querySelectorAll(e.target.selector);for(let r of s)this.notify(e,r)})}notify(t,e){e.hasAttribute("wk-skip")||(e.setAttribute("wk-skip",""),X("Found watched element",{target:t.target,element:e,lazy:t.target.lazy,isNearViewport:this.isNearViewport(e)}),t.target.lazy&&!this.isNearViewport(e)?(X("Lazy target not in viewport",{target:t.target,element:e}),new IntersectionObserver(function([i]){i.isIntersecting&&(X("Lazy target entered viewport, notify subscriber",{target:t.target,element:e}),this.disconnect(),t.callback(new F(e)))},{root:null,rootMargin:"100% 100% 100% 100%"}).observe(e)):(X("Notify subscriber about watched element",{target:t.target,element:e}),t.callback(new F(e))))}};z=new WeakMap,V=new WeakMap,L=new WeakMap;function Gt({target:o},t){if(!o.pageType)return!0;if(!t.pageType)return!1;let e=Array.isArray(o.pageType)?o.pageType:[o.pageType];return e.includes("all")?!0:e.includes(t.pageType)}var ae=[{pageType:"product",match:o=>o.includes("/products/")},{pageType:"collection",match:o=>o.includes("/collections/")&&!o.includes("/products/")},{pageType:"account",match:o=>o.includes("/account/")||o.endsWith("/account")},{pageType:"challenge",match:o=>o.endsWith("/account")},{pageType:"blog",match:o=>o.includes("/blog/")},{pageType:"cart",match:o=>o.includes("/cart/")||o.endsWith("/cart")},{pageType:"wishlist",match:(o,{wishlistUrl:t})=>o.includes(t)},{pageType:"page",match:o=>o.includes("/pages/")},{pageType:"search",match:o=>o.includes("/search")},{pageType:"home",match:o=>o.length<4}],mt=class{constructor({wishlistUrl:t}){this.wishlistUrl=t}parse(t){for(let e of ae)if(e.match(t,{wishlistUrl:this.wishlistUrl}))return{pageType:e.pageType};return{pageType:"unknown"}}};var gt=class{constructor(t){this.locale={};var e;this.setLocale((e=t==null?void 0:t.locale)!=null?e:{})}setLocale(t){this.locale=this.decodeLocale(t)}decodeHtmlEntities(t){return t.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&#39;/g,"'")}decodeLocale(t){let e={};for(let i in t){e[i]={};for(let s in t[i])e[i][s]=this.decodeHtmlEntities(t[i][s])}return e}translate(t,e){var n;let[i,s]=t.split("."),r=(n=this.locale[i])==null?void 0:n[s];return r?e?Object.entries(e).reduce((a,[l,h])=>a.replace(new RegExp(`{{\\s*${l}\\s*}}`,"g"),h),r):r:`translation missing: ${t}`}};var ft=class{constructor({rootUrl:t,wishlistUrl:e}){this._rootUrl=t,this.route=new mt({wishlistUrl:e}),this.observer=new ut({routeUtil:this.route}),this.locale=new gt,this.watch=this.observer.watch.bind(this.observer)}getPageType(t=window.location.pathname){return this.route.parse(t).pageType}getWishlistId(t){if(!t)return null;t instanceof URL&&(t=t.pathname),t.endsWith("/")&&(t=t.substring(0,t.length-1));let e=t.replace(this._rootUrl,"/").split("/");return e.length===4?e.pop():"mine"}getProductHandle(t){var e,i;return t?(t instanceof URL&&(t=t.pathname),t.endsWith("/")&&(t=t.slice(0,-1)),(i=(e=window.decodeURI(t).split("/").pop())==null?void 0:e.split("?")[0])==null?void 0:i.split("#")[0]):null}getVariantId(t,e){var s;let i=null;if(t&&(t instanceof URL&&(t=t.pathname),i=new URLSearchParams(t.split("?")[1]).get("variant")),!i&&e)try{i=new FormData((s=e.element)!=null?s:e).get("id")}catch(r){console.warn("Failed to parse variant from product form.",r)}return i}translate(t,e){return this.locale.translate(t,e)}createComponent(t,e){var s;let i=document.createElement(t);if(e!=null&&e.dataset&&Object.entries(e==null?void 0:e.dataset).forEach(([r,n])=>{n&&(typeof n=="boolean"?i.dataset[r]="":typeof n=="object"?i.dataset[r]=JSON.stringify(n):i.dataset[r]=n)}),e!=null&&e.props&&Object.entries(e==null?void 0:e.props).forEach(([r,n])=>{if(r==="floating"&&n){let a=n,l=(a==null?void 0:a.reference)instanceof F?a.reference.element:a.reference;if(typeof l=="object"&&"id"in l){l.setAttribute("wk-id",Jt()),i[r]={...a,reference:`[wk-id="${l.getAttribute("wk-id")}"]`};return}}i[r]=n}),(s=e==null?void 0:e.wrap)!=null&&s.name){let r=this.createElement(e.wrap.name,e.wrap.props,i);return r.setAttribute("wk-skip",""),r}return i}createHeadlessComponent(t,e){var r;let i=e.host.element?e.host.element:e.host;if(!i)throw new Error("Headless host is undefined");e.dataset&&Object.entries(e.dataset).forEach(([n,a])=>{a&&(typeof a=="boolean"?i.dataset[n]="":typeof a=="object"?i.dataset[n]=JSON.stringify(a):i.dataset[n]=a)});let s=(r=window.headlessElements)==null?void 0:r.get(t);if(!s)throw new Error(`Headless element not found: ${t}`);return new s(i)}createElement(t,e={},...i){let s=Object.assign(document.createElement(t),e);return i&&s.append(...i),s}};var Qt=y("wk:events"),yt=class{constructor(){this.dispatcher=document}publish(t){let e=new CustomEvent(`wk:${t.name}`,{detail:t,bubbles:!1,cancelable:!1});Qt(`Publish: ${t.name}`,{message:t,event:e}),this.dispatcher.dispatchEvent(e)}once(t,e){this.subscribe(t,e,{once:!0})}subscribe(t,e,i){t.startsWith("wk:")&&(t=t.replace("wk:","")),Qt(`Subscribe: ${t}`,{handler:e,options:i}),this.dispatcher.addEventListener(`wk:${t}`,s=>{let r=s;e({name:r.type.replace("wk:",""),data:r.detail.data})},{once:!!(i!=null&&i.once)})}subscribeMany(t){return Object.entries(t).map(([e,i])=>this.subscribe(e,i))}};function Zt(o,t){let e=o.items.map(i=>{let s=t.find(r=>r==null?void 0:r.id.endsWith(i.productId.toString()));return s?{id:i.id,variantId:i.variantId,product:{...Nt(s),hidden:!1},metafields:void 0}:null}).filter(i=>!!i);return{id:o.isMine?"mine":o.id,publicId:o.publicId,isMine:o.isMine,numItems:e.length,items:e}}function Yt({wishlistItem:o,productHandle:t,variantId:e}){return o?{productHandle:t,wishlistItemId:o.id,productId:o.product.id,variantId:o.variantId,inWishlist:!0}:{productHandle:t,wishlistItemId:void 0,productId:0,variantId:e,inWishlist:!1}}var Nt=o=>{var t,e,i,s;return{id:parseInt(o.id.split("/").pop()),available:o.availableForSale,compare_at_price_max:parseFloat(o.compareAtPriceRange.maxVariantPrice.amount)*100,compare_at_price_min:parseFloat(o.compareAtPriceRange.minVariantPrice.amount)*100,compare_at_price_varies:o.compareAtPriceRange.maxVariantPrice.amount!==o.compareAtPriceRange.minVariantPrice.amount,featured_image:(e=(t=o.featuredImage)==null?void 0:t.url)!=null?e:null,handle:o.handle,images:o.images.nodes.map(r=>r.url),options:o.options,price_max:parseFloat(o.priceRange.maxVariantPrice.amount)*100,price_min:parseFloat(o.priceRange.minVariantPrice.amount)*100,price_varies:o.priceRange.maxVariantPrice.amount!==o.priceRange.minVariantPrice.amount,tags:o.tags,title:o.title,type:o.productType,url:`${window.Shopify.routes.root}products/${o.handle}`,variants:o.variants.nodes.map(r=>{var n,a,l,h,p,d;return{available:r.availableForSale,compare_at_price:r.compareAtPrice?parseFloat(r.compareAtPrice.amount)*100:null,featured_image:r.image?{alt:r.image.altText,src:r.image.url}:null,id:parseInt(r.id.split("/").pop()),option1:r.selectedOptions[0].value,option2:(a=(n=r.selectedOptions[1])==null?void 0:n.value)!=null?a:null,option3:(h=(l=r.selectedOptions[2])==null?void 0:l.value)!=null?h:null,price:parseFloat(r.price.amount)*100,sku:r.sku,title:r.title,metafields:(d=(p=r.metafields)==null?void 0:p.reduce((g,f)=>{var I;return f!=null&&f.value?{...g,[f.namespace]:{...(I=g[f.namespace])!=null?I:{},[f.key]:f.value}}:g},{}))!=null?d:{}}}),vendor:o.vendor,metafields:(s=(i=o.metafields)==null?void 0:i.reduce((r,n)=>{var a;return n!=null&&n.value?{...r,[n.namespace]:{...(a=r[n.namespace])!=null?a:{},[n.key]:n.value}}:r},{}))!=null?s:{}}};function Xt({wishlist:o,productHandle:t,productId:e,variantId:i,mulitVariantMode:s}){return o.items.find(r=>{let n=e&&r.product.id===e,a=t&&r.product.handle===t;return(n||a)&&(!i||!s||r.variantId===i)})}var Mt=1,zt={shopify:`wk-shopify-v${Mt}`,storefront:`wk-storefront-v${Mt}`,wishlist:`wk-wishlist-v${Mt}`};var ce=()=>{let o=y("wk:cache"),t=Object.values(zt);caches.keys().then(e=>Promise.all(e.map(i=>{if(!t.includes(i))return o("Delete old cache",{cacheName:i}),caches.delete(i)})))};ce();var v,P,k,A,R,D=class{constructor(t){u(this,v,void 0);u(this,P,void 0);u(this,k,new Map);u(this,A,void 0);u(this,R,void 0);m(this,R,zt[t.name]),m(this,A,y(`wk:cache:${t.name}`)),this.initCache({name:c(this,R)})}async initCache({name:t}){if(!c(this,v)){if(c(this,P))return c(this,P);try{m(this,P,caches.open(t)),m(this,v,await c(this,P)),m(this,P,void 0),c(this,A).call(this,"Cache initialised")}catch(e){console.warn("Failed to open cache.",e)}}}async withCache(t,e,i){c(this,P)&&await c(this,P);let s=this.hashKey(t),r=p=>i(p).then(async d=>(c(this,A).call(this,"Fetched from remote",{cacheKey:s,strategy:e,value:d}),c(this,k).delete(s),await this.setItemInCache(s,e,d),d)),n=p=>this.getItemInCache(s).then(async d=>{if(d){let g=this.getCacheInfo(d.headers);if(g.stale&&g.revalidate)return c(this,A).call(this,"Revalidate while stale",{cacheKey:s,strategy:e,cacheInfo:g}),c(this,k).delete(s),r(p),d.json().then(({value:f})=>f);if(!g.stale)return c(this,A).call(this,"Serve cached value",{cacheKey:s,strategy:e,cacheInfo:g}),c(this,k).delete(s),d.json().then(({value:f})=>f)}return c(this,A).call(this,"Missed cache",{cacheKey:s,strategy:e}),r(p)}),a=c(this,k).get(s);if(a)return a.promise;let l=new AbortController,h=n(l.signal);return c(this,k).set(s,{promise:h,controller:l}),h}async setItemInCache(t,e,i){if(!c(this,v)||e==="no-store")return i;let s=`https://wishlistking.dev/${t}`,r=new Request(s),n=new Response(JSON.stringify({value:i}));return n.headers.set("cache-control",e),n.headers.set("cache-put-date",new Date().toUTCString()),await c(this,v).put(r,n),i}async getItemInCache(t){if(!c(this,v))return;let e=`https://wishlistking.dev/${t}`,i=new Request(e);return c(this,v).match(i)}getCacheInfo(t){var r;let e={stale:!0,revalidate:!1},i=t.get("cache-control"),s=t.get("cache-put-date");return!i||!s?e:(r=i.toLocaleLowerCase().split(",").map(n=>n.trim()).reduce((n,a)=>{var l,h;if(a.startsWith("max-age=")){let p=parseInt((l=a.split("=").pop())!=null?l:"0")*1e3;return{...n,stale:Date.now()-new Date(s).getTime()>p}}if(a.startsWith("stale-while-revalidate=")){let p=parseInt((h=a.split("=").pop())!=null?h:"0")*1e3;return{...n,revalidate:Date.now()-new Date(s).getTime()<p}}return n},e))!=null?r:e}hashKey(t){let e=Array.isArray(t)?t:[t],i="";for(let s of e)s!=null&&(typeof s=="object"?i+=JSON.stringify(s):i+=s.toString());return encodeURIComponent(i)}async clear(t=!1){if(c(this,P)&&await c(this,P),!c(this,v))return;c(this,A).call(this,"Clear cache",{name:c(this,R),force:t}),t&&(c(this,k).forEach(i=>{c(this,A).call(this,"Abort pending request",{name:c(this,R)}),i.controller.abort("Forced cache clear")}),c(this,k).clear());let e=await c(this,v).keys();for(let i of e)await c(this,v).delete(i),c(this,A).call(this,"Deleted from cache",{name:c(this,R),key:i})}};v=new WeakMap,P=new WeakMap,k=new WeakMap,A=new WeakMap,R=new WeakMap;var tt,H=class{constructor(t){u(this,tt,void 0);m(this,tt,t)}subscribe(t){let e=c(this,tt).call(this,new Vt(t));return new Lt(()=>{e==null||e()})}};tt=new WeakMap;var et,Vt=class{constructor(t){u(this,et,void 0);m(this,et,t)}next(t){c(this,et).call(this,t)}};et=new WeakMap;var it,Lt=class{constructor(t){u(this,it,void 0);m(this,it,t)}unsubscribe(){var t;(t=c(this,it))==null||t.call(this)}};it=new WeakMap;var b=y("wk:state"),S,C,j,W,N,rt,T,M,st,bt,te,St,ee,x,O,wt=class{constructor({wishlistApi:t,shopifyApi:e,storefrontApi:i,settings:s,events:r,utils:n}){u(this,M);u(this,bt);u(this,St);u(this,x);u(this,S,void 0);u(this,C,void 0);u(this,j,void 0);u(this,W,void 0);u(this,N,void 0);u(this,rt,void 0);u(this,T,void 0);m(this,S,t),m(this,C,e),m(this,j,i),m(this,N,s),m(this,W,r),m(this,rt,n)}async revalidate(t=!1){b("Revalidate wishlist state"),await this.clearCache(t),c(this,W).publish({name:"state:refetch"})}observeWishlist({wishlistId:t}){return new H(e=>{let i={id:t,isMine:t==="mine",items:[],numItems:0},s=()=>{c(this,S).loadWishlist({wishlistId:t}).then(({wishlist:n})=>{JSON.stringify(n)!==JSON.stringify(i)&&(i=n,b("Update wishlist state",{wishlistId:t,nextState:n}),e.next(n)),m(this,T,void 0)})},r=n=>{var l;if(!i||!((l=n.data)!=null&&l.stateAction))return;let a=w(this,bt,te).call(this,i,n.data.stateAction);b("Update wishlist state (optimistic)",{wishlistId:t,optimisticState:a}),e.next(a)};c(this,W).subscribe("state:refetch",s),c(this,W).subscribe("state:action",r),s()})}observeProductInfo({productHandle:t,variantId:e}){return new H(i=>{let s;this.observeWishlist({wishlistId:"mine"}).subscribe(r=>{let n=Xt({wishlist:r,productHandle:t,variantId:e,mulitVariantMode:c(this,N).general.wishlistMode==="VARIANT"}),a=Yt({wishlistItem:n,productHandle:t,variantId:e});JSON.stringify(a)!==JSON.stringify(s)&&(s=a,i.next(a))})})}observeShopifyCart({cacheStrategy:t}){let e={token:"",total_price:0,total_weight:0,item_count:0,items:[],requires_shipping:!0,currency:"USD",items_subtotal_price:0};return new H(i=>{let s=()=>{b("Refetch cart"),c(this,C).loadCart({cacheStrategy:t}).then(r=>{JSON.stringify(r)!==JSON.stringify(e)&&(e=r,b("Update cart state (remote)",{nextState:r}),i.next(r))})};c(this,W).subscribe("state:refetch",s),s()})}async addWishlistItem(t){if(c(this,T))return;b("Add wishlist item",{params:t});let e=typeof t.variantId=="string"?parseInt(t.variantId):t.variantId,i=t.productHandle;if(w(this,x,O).call(this,"wishlist:add",{productHandle:i,variantId:e}),!i)throw new Error("Product handle is required");w(this,M,st).call(this,{name:"wishlist:add",state:"submitting",body:{productHandle:i,variantId:e}});let s=await c(this,j).loadProductIdByHandle({productHandle:i}),{wishlistItem:r,sessionId:n}=await c(this,S).addItem({productId:s,variantId:e}).catch(a=>{throw console.error(a),this.revalidate(),a});return n&&c(this,W).publish({name:"app:init-sid",data:{sessionId:n}}),b("Added wishlist item",{params:t,wishlistItem:r}),this.revalidate(),this.publishEvent({eventName:"wishlist:add:success",wishlistId:"mine",productId:s,variantId:e}),{wishlistItem:r}}async updateWishlistItem({wishlistItemId:t,changes:e}){if(c(this,T))return;b("Update wishlist item",{wishlistItemId:t,changes:e});let i=typeof e.variantId=="string"?parseInt(e.variantId):e.variantId;w(this,x,O).call(this,"wishlist:change-variant",{wishlistItemId:t,variantId:i}),w(this,M,st).call(this,{name:"wishlist:change-variant",state:"submitting",body:{wishlistItemId:t,variantId:i}});let{wishlistItem:s}=await c(this,S).updateItem({wishlistItemId:t,changes:{variantId:i}}).catch(r=>{throw console.error(r),this.revalidate(),r});return b("Updated wishlist item",{wishlistItemId:t,changes:e,wishlistItem:s}),this.revalidate(),this.publishEvent({eventName:"wishlist:change-variant:success",wishlistId:"mine",productId:s.product.id,variantId:i}),{wishlistItem:s}}async removeWishlistItem({wishlistItemId:t}){if(c(this,T))return;b("Remove wishlist item",{wishlistItemId:t}),w(this,x,O).call(this,"wishlist:remove",{wishlistItemId:t}),w(this,M,st).call(this,{name:"wishlist:remove",state:"submitting",body:{wishlistItemId:t}});let{wishlistItem:e}=await c(this,S).removeItem({wishlistId:"mine",wishlistItemId:t}).catch(i=>{throw console.error(i),this.revalidate(),i});return b("Removed wishlist item",{wishlistItemId:t,wishlistItem:e}),this.revalidate(),this.publishEvent({eventName:"wishlist:remove:success",wishlistId:"mine",productId:e.product.id,variantId:e.selectedVariantId}),{wishlistItem:e}}async clearWishlist(){c(this,T)||(b("Clear wishlist"),w(this,x,O).call(this,"wishlist:clear"),w(this,M,st).call(this,{name:"wishlist:clear",state:"submitting"}),await c(this,S).clearWishlist().catch(t=>{throw console.error(t),this.revalidate(),t}),b("Cleared wishlist"),this.revalidate(),this.publishEvent({eventName:"wishlist:clear:success",wishlistId:"mine"}))}async clearCache(t=!1){b("Clear cache"),await c(this,C).clearCache(t),await c(this,S).clearCache(t)}async addToCart({wishlistId:t,wishlistItemId:e,variantId:i,quantity:s=1,properties:r,sectionsToRender:n,sectionsUrl:a}){t==="mine"&&w(this,x,O).call(this,"wishlist:add-to-cart");let l=await c(this,C).addToCart({id:i,quantity:s,properties:r,sections:n,sections_url:a?encodeURI(a):void 0}),[{wishlist:h},p]=await Promise.all([c(this,S).loadWishlist({wishlistId:t,cacheStrategy:"no-store"}),c(this,C).loadCart({cacheStrategy:"no-store"})]),d=h.items.find(g=>g.id===e);return this.revalidate(),this.publishEvent({eventName:"wishlist:add-to-cart:success",wishlistId:t,productId:d.product.id,variantId:i}),{wishlist:h,wishlistItem:d,cart:p,cartResponse:l}}async addAllToCart({wishlistId:t,sectionsToRender:e,sectionsUrl:i}){var l;if(c(this,T))return;t==="mine"&&w(this,x,O).call(this,"wishlist:add-to-cart");let{wishlist:r}=await c(this,S).loadWishlist({wishlistId:t,cacheStrategy:"no-store"}),n=r.items.filter(h=>!!h.variantId).filter(h=>{let p=h.product.variants.find(d=>d.id===h.variantId);return!!(p!=null&&p.available)});if(!n.length)return{cartResponse:null,wishlistItems:[]};let a=await c(this,C).addToCart({items:(l=n.map(h=>({id:h.variantId,quantity:1})))!=null?l:[],sections:e,sections_url:i?encodeURI(i):void 0});return this.revalidate(),this.publishEvent({eventName:"wishlist:add-all-to-cart:success",wishlistId:"mine"}),{cartResponse:a,wishlistItems:n}}async shareWishlist({wishlistId:t,title:e,text:i}){if(c(this,T))return;t==="mine"&&w(this,x,O).call(this,"wishlist:share");let s={url:c(this,rt).url.getPublicWishlistUrl(t),title:e,text:i},r={webShare:!1,clipboard:!1};try{await navigator.share(s),r.webShare=!0}catch(n){r.webShare=!1}if(!r.webShare)try{await navigator.clipboard.writeText(s.url),r.clipboard=!0}catch(n){r.clipboard=!1}return this.publishEvent({eventName:"wishlist:share:success",wishlistId:t}),r}async publishEvent({eventName:t,wishlistId:e,productId:i,variantId:s}){let[r,n]=await Promise.all([e?c(this,S).loadWishlist({wishlistId:e}).then(({wishlist:l})=>l):Promise.resolve(void 0),i?c(this,j).loadProduct({productId:i}).then(l=>l?Nt(l):null):Promise.resolve(void 0)]),a=s?n==null?void 0:n.variants.find(l=>l.id===s):void 0;c(this,W).publish({name:t,data:{wishlist:r,product:n,variant:a}})}};S=new WeakMap,C=new WeakMap,j=new WeakMap,W=new WeakMap,N=new WeakMap,rt=new WeakMap,T=new WeakMap,M=new WeakSet,st=function(t){m(this,T,t),c(this,W).publish({name:"state:action",data:{stateAction:t}})},bt=new WeakSet,te=function(t,e){var i,s,r,n;switch(e.name){case"wishlist:add":return{...t,items:[{id:`temp-${Date.now()}`,product:{id:(s=(i=e.body)==null?void 0:i.productId)!=null?s:0,handle:(n=(r=e.body)==null?void 0:r.productHandle)!=null?n:"",variants:[]}},...t.items],numItems:t.items.length+1};case"wishlist:remove":return{...t,items:t.items.filter(a=>{var l;return a.id!==((l=e.body)==null?void 0:l.wishlistItemId)}),numItems:t.items.length-1};default:return t}},St=new WeakSet,ee=function(t,e){var s;if(c(this,N).general.wishlistAccessMode==="UNRESTRICTED"||c(this,S).hasCustomer)return!1;if((s=le[c(this,N).general.wishlistAccessMode])==null?void 0:s.includes(t))return["wishlist:load"].includes(t)||c(this,W).publish({name:"wishlist:login-required",data:{action:t,...e}}),!0},x=new WeakSet,O=function(t,e){if(w(this,St,ee).call(this,t,e))throw new Error("Wishlist requires login")};var le={REQUIRE_LOGIN_BEFORE_USE:["wishlist:load","wishlist:add","wishlist:remove","wishlist:change-variant","wishlist:clear","wishlist:add-to-cart","wishlist:share","wishlist:view"],REQUIRE_LOGIN_TO_VIEW_LIST:["wishlist:view"]};var It=class{constructor(t){this.rootUrl=t.rootUrl,this.shopDomain=t.shopDomain,this.wishlistUrl=t.wishlistUrl,this.placeholderImageUrl=t.placeholderImageUrl,this.fileUrl=t.fileUrl}getPublicWishlistUrl(t){return`https://${this.shopDomain}${this.wishlistUrl}/${t}`}getFileUrl(t=""){return`https:${this.fileUrl.split("?")[0]}${t}`}getImageUrl(t,e){var s,r;if(!t)return(s=this.placeholderImageUrl)!=null?s:"";let i=this.getImage(t);return i!=null&&i.src?this.appendSize(i.src,e):(r=this.placeholderImageUrl)!=null?r:""}getImage(t){var e,i,s;if(t.hasOwnProperty("sku"))return{src:(i=(e=t.featured_image)==null?void 0:e.src)!=null?i:""};if(t.variants){let r=t;return{src:(s=r.featured_image)!=null?s:r.images[0]}}else if(t.hasOwnProperty("src"))return{src:t.src};return null}appendSize(t,e){let i=new URL(t.startsWith("//")?`https://${t}`:t);return e!=null&&e.width&&i.searchParams.set("width",e==null?void 0:e.width.toString()),e!=null&&e.height&&i.searchParams.set("height",e==null?void 0:e.height.toString()),i.href}getVariantUrl(t,e){if(t)return e?t+`?variant=${e}`:t}handlelize(t){return t.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/([^\w]+|\s+)/g,"-").replace(/\-\-+/g,"-").replace(/(^-+|-+$)/g,"").toLowerCase()}};var vt=class{constructor(t){this.placeholderRegex=/\{\{\s*(\w+)\s*\}\}/;var e,i;this.moneyFormat=(e=t.moneyFormat)!=null?e:"${{amount}}",this.moneyFormatWithCurrency=(i=t.moneyFormatWithCurrency)!=null?i:"${{amount}} USD"}formatMoney(t,e){var r,n;let i=(r=e==null?void 0:e.withCurrency)!=null?r:!1;typeof t=="string"&&(t=parseInt(t.replace(".","")));let s=this.formatCents(t,(n=this.moneyFormat.match(this.placeholderRegex))==null?void 0:n[1],e==null?void 0:e.withoutTrailingZeros);return(i?this.moneyFormatWithCurrency:this.moneyFormat).replace(this.placeholderRegex,s)}formatCents(t,e,i){switch(e){case"amount_no_decimals":return this.formatWithDelimiters(t,0);case"amount_with_comma_separator":return i?this.formatWithDelimiters(t,2,".",",").replace(",00",""):this.formatWithDelimiters(t,2,".",",");case"amount_no_decimals_with_comma_separator":return this.formatWithDelimiters(t,0,".",",");case"amount":default:return i?this.formatWithDelimiters(t,2).replace(".00",""):this.formatWithDelimiters(t,2)}}formatWithDelimiters(t,e=2,i=",",s="."){if(isNaN(t)||t==null)return"0";let n=(t/100).toFixed(e).split("."),a=n[0].replace(/(\d)(?=(\d\d\d)+(?!\d))/g,`$1${i}`),l=n[1]?s+n[1]:"";return a+l}};var Pt=class{getFormState({product:t,options:e,autoSelect:i=!1,change:s}){let r=this.getSelectedOptions({product:t,options:e,change:s,autoSelect:i}),n=r&&Object.values(r).every(h=>!!h),a=this.getOptionsWithValues({product:t,selectedOptions:r});return{selectedVariant:this.getVariantByOptions({product:t,options:r,optionsWithValues:a}),selectedOptions:r,hasSelection:n,optionsWithValues:a,hasOnlyDefaultVariant:t.options.length===1&&t.options[0].name==="Title"&&t.options[0].values.length==1}}getSelectedOptions({product:t,options:e,autoSelect:i,change:s={}}){let r=Object.fromEntries(Object.entries({...e,...s}).map(([p,d],g)=>{var f;return!d&&((f=t.options[g])==null?void 0:f.values.length)===1?[p,t.options[g].values[0]]:[p,d]}));if(!i)return r;let n=Object.keys(s).pop(),a=Object.fromEntries(n?Object.entries(r).filter(([p])=>n>p):Object.entries(e).filter(([,p])=>!!p)),l=Object.fromEntries(Object.entries(r).filter(([p])=>!(p in a)));return Object.keys(l).reduce((p,d)=>{var f;let g=this.getAllVariantsByOptions({product:t,options:p});return g.length?{...p,[d]:((f=g.find(I=>I.available))!=null?f:g[0])[d]}:{...p,[d]:null}},a)}getVariantOptions({variant:t}){var e,i,s;return{option1:(e=t==null?void 0:t.option1)!=null?e:null,option2:(i=t==null?void 0:t.option2)!=null?i:null,option3:(s=t==null?void 0:t.option3)!=null?s:null}}getOptionsWithValues({product:t,selectedOptions:e={}}){return t.options.map((i,s)=>{var h;let r=`option${s+1}`,n=this.getUnavailableOptionValues({product:t,optionKey:r,selectedOptions:e,values:i.values}),a=this.getSoldoutOptionValues({product:t,optionKey:r,selectedOptions:e,values:i.values}),l=(h=e==null?void 0:e[r])!=null?h:null;return{...i,selectedValue:l,soldoutValues:a,unavailableValues:n}})}getSoldoutOptionValues({product:t,optionKey:e,values:i,selectedOptions:s={}}){let r=Object.fromEntries(Object.entries(s).filter(([n])=>n<e));return i.filter(n=>{let a=t.variants.filter(l=>this.matchesVariant({variant:l,options:{...r,[e]:n}}));return a.length?a.every(l=>!l.available):!1})}getUnavailableOptionValues({product:t,optionKey:e,values:i,selectedOptions:s={}}){let r=Object.fromEntries(Object.entries(s).filter(([n])=>n<e));return i.filter(n=>t.variants.every(a=>!this.matchesVariant({variant:a,options:{...r,[e]:n}})))}getFirstAvailableVariant({product:t}){var e;return(e=t.variants.find(i=>i.available))!=null?e:null}getSelectedVariant({product:t,variantId:e}){var i;return(i=t.variants.find(s=>s.id===e))!=null?i:null}matchesVariant({variant:t,options:e}){return(!(e!=null&&e.option1)||e.option1===t.option1)&&(!(e!=null&&e.option2)||e.option2===t.option2)&&(!(e!=null&&e.option3)||e.option3===t.option3)}getFormData({form:t,product:e}){let i=new FormData(t);return{quantity:this.getFormQuantity({form:t}),options:this.getFormOptions({formData:i,product:e})}}getFormQuantity({form:t}){var s;let i=(s=new FormData(t).get("quantity"))==null?void 0:s.toString();return i?parseInt(i):1}getFormProperties({form:t}){let e=new FormData(t);return Array.from(e.entries()).reduce((i,s)=>{if(!s[0].startsWith("properties["))return i;let r=s[0].replace("properties[","").replace("]","");return{...i,[r]:`${s[1]}`}},{})}getVariantByOptions({product:t,options:e,optionsWithValues:i}){var r;let s=Object.entries(e).reduce((n,[,a],l)=>(n[l]=a,n),new Array(3).fill(null));return(r=t.variants.find(n=>s.every((a,l)=>i[l]?n[`option${l+1}`]===a:!0)))!=null?r:null}getAllVariantsByOptions({product:t,options:e}){var s;let i=Object.entries(e).reduce((r,[,n],a)=>(r[a]=n,r),new Array(3).fill(null));return(s=t.variants.filter(r=>i.every((n,a)=>!n||r[`option${a+1}`]===n)))!=null?s:[]}getFormOptions({formData:t,product:e}){return Array.from(t.entries()).reduce((i,[s,r])=>{var l;let n=(l=s.match(/\[(.*?)\]/))==null?void 0:l[1];if(!n)return i;let a=e.options.findIndex(h=>h.name===n)+1;if(a>0){let h=`option${a}`;i[h]=r.toString()||null}return i},{})}getInputOption({input:t,product:e}){var r;let i=(r=t.name.match(/\[(.*?)\]/))==null?void 0:r[1];if(!i)return null;let s=e.options.findIndex(n=>n.name===i)+1;return s>0?{[`option${s}`]:t.value.toString()}:null}};var $,nt,q,K,ot,at,ct,At=class{constructor(t){u(this,$,void 0);u(this,nt,void 0);u(this,q,void 0);u(this,K,void 0);u(this,ot,void 0);u(this,at,[]);u(this,ct,[]);m(this,K,t.country),m(this,q,t.language),m(this,$,`https://${t.storeName}.myshopify.com/api/${t.version}/graphql.json`),m(this,nt,{accept:"application/json","content-type":"application/json","x-shopify-storefront-access-token":t.accessToken}),m(this,ot,new D({name:"storefront"}))}setFields({productMetafields:t,variantMetafields:e}){t&&m(this,at,t),e&&m(this,ct,e)}loadProduct({productId:t,cacheStrategy:e="public, max-age=1, stale-while-revalidate=10"}){let i=`
fragment productMetafields on Product {

@@ -106,2 +106,2 @@ metafields(identifiers: [${c(this,at).map(r=>`{namespace: "${r.namespace}", key: "${r.key}"}`).join(",")}]) {

}
`;var lt,B,J=class{constructor(t){u(this,lt,void 0);u(this,B,void 0);this.host=t.host,this.headers={"content-type":"application/json"},m(this,B,new D({name:t.name})),m(this,lt,y(`wk:api:${t.name}`))}fetch(t){var p;let{method:e="GET",path:i,query:s,body:r}=t,n=this.host+i+this.getQuerystring(s),a={...this.headers,...t.headers},l=[e,n,r,a],h=(p=t.cacheStrategy)!=null?p:"no-store";return c(this,B).withCache(l,h,async d=>{c(this,lt).call(this,"Fetch from remote",{method:e,url:n,headers:a});let g=await window.fetch(n,{method:e,headers:a,body:r,signal:d});if(g.ok)return g.json();throw Error(`Error ${g.status}`)})}getQuerystring(t){if(!t)return"";let e=new URLSearchParams;return Object.entries(t).forEach(([i,s])=>{Array.isArray(s)?s.forEach(r=>e.append(i,r)):s&&e.append(i,s)}),"?"+e.toString()}get({path:t,query:e,headers:i,cacheStrategy:s}){return this.fetch({method:"GET",path:t,query:e,headers:i,cacheStrategy:s})}post({path:t,query:e,body:i,headers:s}){return this.fetch({method:"POST",path:t,query:e,body:i?JSON.stringify(i):void 0,headers:s})}put({path:t,query:e,body:i,headers:s}){return this.fetch({method:"PUT",path:t,query:e,body:i?JSON.stringify(i):void 0,headers:s})}delete({path:t,query:e,body:i,headers:s}){return this.fetch({method:"DELETE",path:t,query:e,body:i?JSON.stringify(i):void 0,headers:s})}clearCache(t=!1){return c(this,B).clear(t)}};lt=new WeakMap,B=new WeakMap;var de=new Promise((o,t)=>{window.Shopify.loadFeatures([{name:"consent-tracking-api",version:"0.1"}],e=>{e||!window.Shopify.customerPrivacy?t(e||new Error("Shopify.customerPrivacy not available")):o(window.Shopify.customerPrivacy)})}),Wt=o=>{de.then(t=>{o({marketingAllowed:t.marketingAllowed(),saleOfDataAllowed:t.saleOfDataAllowed(),analyticsAllowed:t.analyticsProcessingAllowed(),preferencesAllowed:t.preferencesProcessingAllowed()})}).catch(t=>{console.warn("Failed to load Customer Privacy API",t)}),document.addEventListener("visitorConsentCollected",t=>{"detail"in t&&o(t.detail)})};var ht,kt,Tt=class extends J{constructor(e){super({...e,name:"wishlist"});u(this,ht,void 0);u(this,kt,void 0);m(this,ht,e.storefrontApi),this.headers={"content-type":"application/json"},e.shop&&(this.headers["x-appmate-shp"]=e.shop),e.sessionId&&(this.headers["x-appmate-sid"]=e.sessionId),e.customerId&&(this.headers["x-appmate-cid"]=e.customerId.toString()),e.trackingSource&&(this.headers["x-appmate-src"]=e.trackingSource),Wt(i=>{m(this,kt,i),this.headers["x-appmate-vca"]=i.analyticsAllowed.toString(),this.headers["x-appmate-vcm"]=i.marketingAllowed.toString()})}get hasSession(){return!!this.headers["x-appmate-sid"]||!!this.headers["x-appmate-cid"]}get hasCustomer(){return!!this.headers["x-appmate-cid"]}setSessionId(e){this.headers["x-appmate-sid"]=e}clearSessionId(){delete this.headers["x-appmate-sid"]}async loadWishlist({wishlistId:e,cacheStrategy:i="public, max-age=60, stale-while-revalidate=86400"}){return e==="mine"&&!this.hasSession?{wishlist:{id:e,isMine:!0,numItems:0,items:[]}}:this.get({path:`/wishlists/${e}`,cacheStrategy:i}).then(({wishlist:r})=>Promise.all(r.items.map(n=>c(this,ht).loadProduct({productId:n.productId,cacheStrategy:i}))).then(n=>({wishlist:Yt(r,n.filter(a=>!!a))})))}addItem({productId:e,variantId:i}){if(typeof e=="string"&&(e=parseInt(e)),typeof i=="string"&&(i=parseInt(i)),!this.hasSession&&this._pendingSessionId)return this._pendingSessionId.then(()=>this.addItem({productId:e,variantId:i}));let s=this.post({path:"/wishlists/mine/items",body:{productId:e,variantId:i}}).then(r=>(r.sessionId&&(this.setSessionId(r.sessionId),this._pendingSessionId=void 0),r));return this.hasSession||(this._pendingSessionId=s),s}updateItem({wishlistItemId:e,changes:i}){return this.put({path:"/wishlists/mine/items",body:{changes:{...i,wishlistItemId:e}}})}removeItem({wishlistId:e,wishlistItemId:i}){return this.delete({path:`/wishlists/${e}/items`,body:{wishlistItemId:i}})}clearWishlist(){return this.delete({path:"/wishlists/mine"})}};ht=new WeakMap,kt=new WeakMap;var xt=class extends J{constructor(t){super({...t,name:"shopify"})}loadCart(t){if(this.pendingCart)return this.pendingCart;let e=this.get({path:"/cart.js",cacheStrategy:t==null?void 0:t.cacheStrategy}).then(i=>(this.pendingCart=void 0,i));return this.pendingCart=e,e}addToCart(t){return this.post({path:"/cart/add.js",body:t})}};var Ct,G=class{constructor({host:t,shop:e,sessionId:i,customerId:s}){u(this,Ct,void 0);this.host=t,this.shop=e,this.customerId=s,this.sessionId=i,this.eventNames=new Map([["viewWishlist","wishlist_viewed"],["addToCart","product_added_to_cart"],["shareWishlist","wishlist_shared"]]),Wt(r=>{m(this,Ct,r)})}setSession(t){this.sessionId=t}clearSession(){this.sessionId=void 0}async track({eventName:t,wishlist:e,product:i,variant:s,quantity:r,source:n}){var l,h;if(!this.sessionId)return!1;let a=this.eventNames.get(t);return!a||!e?!1:window.fetch(this.host+"/notify",{method:"POST",headers:{"content-type":"application/json","x-appmate-shp":this.shop,"x-appmate-sid":(l=this.sessionId)!=null?l:"","x-appmate-cid":(h=this.customerId)!=null?h:""},body:JSON.stringify({event:a,wid:e.publicId,pid:i==null?void 0:i.id,vid:s==null?void 0:s.id,qty:r,src:n})}).then(()=>!0).catch(p=>!1)}getQuerystring(t){if(!t)return"";let e=new URLSearchParams;return Object.entries(t).forEach(([i,s])=>{Array.isArray(s)?s.forEach(r=>e.append(i,r)):s&&e.append(i,s)}),"?"+e.toString()}};Ct=new WeakMap;var{gtag:ie,dataLayer:se}=window,Et=class{constructor({currency:t}){this.currency=t,this.eventNames=new Map([["addToWishlist","add_to_wishlist"]])}async track({eventName:t,product:e,variant:i,quantity:s=1}){var a,l,h;let r=this.eventNames.get(t);if(!r||!e)return!1;let n=((a=i==null?void 0:i.price)!=null?a:e.variants[0].price)/100;return ie?(ie("event",r,{currency:this.currency,value:n,items:[{item_id:(l=(i==null?void 0:i.sku)||(i==null?void 0:i.id))!=null?l:e.id,item_name:e.title,affiliation:"Wishlist King",item_category:e.type,item_brand:e.vendor,item_variant:i==null?void 0:i.title,item_quantity:s,item_price:n}]}),!0):se?(se.push({event:r,ecommerce:{currency:this.currency,value:n,items:[{item_id:(h=(i==null?void 0:i.sku)||(i==null?void 0:i.id))!=null?h:e.id,item_name:e.title,affiliation:"Wishlist King",item_category:e.type,item_brand:e.vendor,item_variant:i==null?void 0:i.title,item_quantity:s,item_price:n}]}}),!0):!1}};var re=y("wk:tracking:klaviyo"),Ut=class{constructor({customerEmail:t,urlUtil:e,moneyUtil:i}){this.customerEmail=t,this.urlUtil=e,this.moneyUtil=i,this.eventNames=new Map([["addToWishlist","Added To Wishlist"],["removeFromWishlist","Removed From Wishlist"],["clearWishlist","Cleared Wishlist"]])}async track({eventName:t,wishlist:e,product:i,variant:s,quantity:r=1}){var d,g,f,I,E,U,_,Y,Z;let n=this.eventNames.get(t);if(!n||!e||!i)return!1;let a=e.items.slice().reverse().map(dt=>dt.product.id),l={$email:this.customerEmail,WishlistUrl:this.urlUtil.getPublicWishlistUrl(e.id),WishlistProductIDs:a};re("Identify",l),(d=window.klaviyo)==null||d.push(["identify",l]);let h=((g=s==null?void 0:s.price)!=null?g:!i.price_varies)?i.price_min:void 0,p={URL:this.urlUtil.getVariantUrl(i.url,s==null?void 0:s.id),Name:i.title,ProductID:i.id,VariantID:(f=s==null?void 0:s.id)!=null?f:null,SKU:(I=s==null?void 0:s.sku)!=null?I:null,Tags:i.tags,Brand:i.vendor,ImageURL:this.urlUtil.getImageUrl((E=s==null?void 0:s.featured_image)!=null&&E.src?s:i,{width:1e3}),Price:h?h/100:null,PriceFormatted:h?this.moneyUtil.formatMoney(h):null,CurrencyCode:(Y=(_=(U=window.Shopify)==null?void 0:U.currency)==null?void 0:_.active)!=null?Y:null,Quantity:r,WishlistUrl:this.urlUtil.getPublicWishlistUrl(e.id),WishlistProductIDs:a};return re("Track",n,p),(Z=window.klaviyo)==null||Z.push(["track",n,p]),!0}};var{fbq:ne}=window,_t=class{constructor({currency:t}){this.currency=t,this.eventNames=new Map([["addToWishlist","AddToWishlist"]])}async track({eventName:t,product:e,variant:i}){let s=this.eventNames.get(t);return!s||typeof ne!="function"||!e?!1:(ne("track",s,{value:i==null?void 0:i.price,currency:this.currency,content_ids:[e.id],content_name:[e.title,i==null?void 0:i.title].filter(r=>!!r).join(" - "),content_category:e.type,content_type:"product_group",num_items:1}),!0)}};var pt=y("wk:tracking"),Rt=class{constructor({settings:t,events:e,notifyHost:i,utils:s,theme:r,shop:n,sessionId:a,customerId:l,customerEmail:h}){this.utils=s,this.theme=r,this.services=[],pt("Init tracking"),t.integrations.wishlistAnalytics.enabled&&this.services.push(new G({host:i,shop:n,customerId:l,sessionId:a})),t.integrations.klaviyo.enabled&&h&&(pt("Add Klaviyo integration"),this.services.push(new Ut({urlUtil:this.utils.url,moneyUtil:this.utils.money,customerEmail:h}))),t.integrations.metaPixel.enabled&&(pt("Add Meta Pixel integration"),this.services.push(new _t({currency:window.Shopify.currency.active}))),t.integrations.googleAnalytics.enabled&&(pt("Add Google Analytics integration"),this.services.push(new Et({currency:window.Shopify.currency.active})));let p=this.theme.getPageType(),d=g=>f=>{var I,E,U,_;return this.track({eventName:g,source:p,wishlist:(I=f.data)==null?void 0:I.wishlist,product:(E=f.data)==null?void 0:E.product,variant:(U=f.data)==null?void 0:U.variant,quantity:(_=f.data)==null?void 0:_.quantity})};e.subscribeMany({"wishlist:add-to-cart:success":d("addToCart"),"wishlist:add:success":d("addToWishlist"),"wishlist:change-variant:success":d("changeVariant"),"wishlist:clear:success":d("clearWishlist"),"wishlist:remove:success":d("removeFromWishlist"),"wishlist:share:success":d("shareWishlist"),"wishlist:page-view":d("viewWishlist")})}async track(t){return pt("Track",t),this.services.length?Promise.all(this.services.map(e=>e.track(t))):[]}setSessionId(t){let e=this.services.find(i=>i instanceof G);e&&e.setSession(t)}clearSessionId(){let t=this.services.find(e=>e instanceof G);t&&t.clearSession()}};var Q=y("wk:app"),oe=class{constructor(t){this.addToCart=t=>this.state.addToCart(t);this.addAllToCart=t=>this.state.addAllToCart(t);this.addWishlistItem=t=>this.state.addWishlistItem(t);this.clearWishlist=()=>this.state.clearWishlist();this.removeWishlistItem=t=>this.state.removeWishlistItem(t);this.shareWishlist=t=>this.state.shareWishlist(t);this.updateWishlistItem=t=>this.state.updateWishlistItem(t);var i,s,r;this.config=this.parseConfig(t),this.settings=this.parseSettings(t),this.routes=this.parseRoutes(),this.customer=this.config.customer.id?{id:this.config.customer.id,email:this.config.customer.email,tags:this.config.customer.tags}:null,Q("Create app",{config:this.config,settings:this.settings,customer:this.customer}),this.events=new yt,this.theme=new ft({rootUrl:this.routes.rootUrl,wishlistUrl:this.routes.wishlistUrl}),this._utils={url:new It({rootUrl:this.routes.rootUrl,wishlistUrl:this.routes.wishlistUrl,shopDomain:this.config.shop.domain,placeholderImageUrl:this.config.products.fallbackImage,fileUrl:this.routes.fileUrl}),money:new vt({moneyFormat:this.config.shop.moneyFormat,moneyFormatWithCurrency:this.config.shop.moneyFormatWithCurrency}),product:new Pt};let e=new At({accessToken:this.config.storefront.accessToken,version:this.config.storefront.version,country:window.Shopify.country.toUpperCase(),language:window.Shopify.locale.split("-")[0].toUpperCase(),storeName:this.config.shop.permanentDomain.replace(".myshopify.com","")});this._apis={wishlist:new Tt({host:this.config.routes.apiHost,shop:this.config.shop.permanentDomain,customerId:(i=this.config.customer.id)!=null?i:void 0,sessionId:this.getSessionId(),trackingSource:this.theme.getPageType(),storefrontApi:e}),shopify:new xt({host:window.Shopify.routes.root.substring(0,window.Shopify.routes.root.length-1)}),storefront:e,tracking:new Rt({notifyHost:this.config.routes.apiHost,events:this.events,shop:this.config.shop.permanentDomain,customerId:(s=this.config.customer.id)!=null?s:void 0,customerEmail:(r=this.config.customer.email)!=null?r:void 0,sessionId:this.getSessionId(),utils:this.utils,theme:this.theme,settings:this.settings})},this._state=new wt({wishlistApi:this.apis.wishlist,shopifyApi:this.apis.shopify,storefrontApi:this.apis.storefront,settings:this.settings,events:this.events,utils:this.utils}),this.initCustomerSession(),this.initUrlChangeEvents(),this.trackCurrentPage(),this.initLoginRedirect(),window.WishlistKing=this,Q("App ready"),this.events.publish({name:"app:ready",data:{}})}get state(){return this._state}get apis(){return this._apis}get utils(){return this._utils}get hasSession(){return!!this.getSessionId()||!!this.customer}get isLoggedIn(){var t;return!!((t=this.customer)!=null&&t.id)}getSessionId(){let t=window.localStorage.getItem("wk_session_id");if(t)return t;let e=window.localStorage.getItem("appmate-session");if(e)try{let i=JSON.parse(e).state.sid;return this.setSessionId(i)}catch(i){console.error(i)}}setSessionId(t){var e;return window.localStorage.setItem("wk_session_id",t),(e=this._apis)==null||e.tracking.setSessionId(t),t}clearSessionId(){var t,e;window.localStorage.removeItem("wk_session_id"),(t=this._apis)==null||t.tracking.clearSessionId(),(e=this._apis)==null||e.wishlist.clearSessionId()}initLoginRedirect(){var e,i;if(this.theme.getPageType()==="account"){let s=this.getPendingWishlistAction();if(s){Q("Inject redirect for pending action",{pending:s});let r=document.getElementById("customer_login"),n=document.getElementById("create_customer");(i=r!=null?r:n)==null||i.insertAdjacentHTML("beforeend",`<input type="hidden" name="return_to" value="${(e=s.origin)!=null?e:this.routes.wishlistUrl}">`)}}}trackCurrentPage(){if(this.theme.getPageType()==="wishlist"){let e=this.theme.getWishlistId(window.location.pathname);e&&this.state.publishEvent({eventName:"wishlist:page-view",wishlistId:e}).catch(i=>{console.warn("Failed to track wishlist page view",i)})}}async initLoginActionQueue(){Q("Init customer events");let t=!!window.localStorage.getItem("wk_logged_in");if(this.events.subscribe("wishlist:login-required",e=>{var s;let i=["wishlist:add","wishlist:view"];(s=e.data)!=null&&s.action&&i.includes(e.data.action)&&window.localStorage.setItem("wk_pending",JSON.stringify({...e.data,origin:window.location.href}))}),!t&&this.isLoggedIn){Q("Customer logged in"),window.localStorage.setItem("wk_logged_in","1");let e=this.getPendingWishlistAction();this.events.publish({name:"customer:login",data:{pending:e}})}else t&&!this.isLoggedIn&&(Q("Customer logged out"),window.localStorage.removeItem("wk_logged_in"),this.events.publish({name:"customer:logout",data:{}}));["challenge","account"].includes(this.theme.getPageType())||window.localStorage.removeItem("wk_pending")}initCustomerSession(){this.hasSession||this.events.once("app:init-sid",t=>{var e,i;(e=t.data)!=null&&e.sessionId&&this.setSessionId((i=t.data)==null?void 0:i.sessionId)})}async clearCustomerSession(){window.localStorage.removeItem("wk_pending"),this.clearSessionId(),this.initCustomerSession(),await this.state.revalidate(!0)}getPendingWishlistAction(){try{let t=window.localStorage.getItem("wk_pending");if(t)return JSON.parse(t)}catch(t){console.warn("Could not parse pending wishlist action",t)}}initUrlChangeEvents(){let t=({productHandle:i,variantId:s})=>{this.events.publish({name:"product:change-variant:success",data:{productHandle:i,variantId:s}})},e=i=>(...s)=>{var d;let r=i.apply(history,s),n=typeof s[2]=="string"?s[2]:(d=s[2])==null?void 0:d.toString();if(!n)return r;n.startsWith("?")&&(n=window.location.pathname+n);let a=`${window.location.protocol}//${window.location.host}`,l=new URL(n,a),h=this.theme.getProductHandle(l),p=l.searchParams.get("variant");if(!h)return r;t({productHandle:h,variantId:p?parseInt(p):void 0})};history.replaceState=e(history.replaceState),history.pushState=e(history.pushState)}parseConfig({config:t}){var e,i,s,r,n,a,l,h;return{storefront:{accessToken:t.storefrontAccessToken,version:t.storefrontVersion},customer:{id:t.customerId?t.customerId:null,email:(e=t.customerEmail)!=null?e:"",tags:(i=t.customerTags)!=null?i:[]},shop:{name:(s=t.shopName)!=null?s:"",domain:(r=t.shopDomain)!=null?r:"",permanentDomain:(n=t.shopPermanentDomain)!=null?n:"",moneyFormat:(a=t.shopMoneyFormat)!=null?a:"",moneyFormatWithCurrency:(l=t.shopMoneyFormatWithCurrency)!=null?l:"",customerAccountsEnabled:t.shopCustomerAccountsEnabled},routes:{apiHost:t.apiHost,sdkHost:t.sdkHost,templateHost:t.templateHost,rootUrl:window.Shopify.routes.root,fileUrl:t.fileUrl},products:{fallbackImage:(h=t.productFallbackImage)!=null?h:"//cdn.shopify.com/s/files/1/0533/2089/files/placeholder-images-image_large.png?format=webp&v=1530129081"}}}parseSettings({settings:t}){var e,i,s,r,n,a,l,h,p,d,g,f,I,E,U,_,Y,Z,dt,Ht,jt,$t,qt,Kt,Bt;return{general:{appLoading:(i=(e=t==null?void 0:t.general)==null?void 0:e.appLoading)!=null?i:"LAZY",wishlistAccessMode:(r=(s=t==null?void 0:t.general)==null?void 0:s.wishlistAccessMode)!=null?r:"UNRESTRICTED",wishlistMode:(a=(n=t==null?void 0:t.general)==null?void 0:n.wishlistMode)!=null?a:"PRODUCT",wishlistPath:(h=(l=t==null?void 0:t.general)==null?void 0:l.wishlistPath)!=null?h:"/apps/wishlist"},money:{withCurrency:(d=(p=t==null?void 0:t.money)==null?void 0:p.withCurrency)!=null?d:!1},integrations:{googleAnalytics:{enabled:(I=(f=(g=t.integrations)==null?void 0:g.googleAnalytics)==null?void 0:f.enabled)!=null?I:!1,tracker:(_=(U=(E=t.integrations)==null?void 0:E.googleAnalytics)==null?void 0:U.tracker)!=null?_:""},klaviyo:{enabled:(dt=(Z=(Y=t.integrations)==null?void 0:Y.klaviyo)==null?void 0:Z.enabled)!=null?dt:!1},metaPixel:{enabled:($t=(jt=(Ht=t.integrations)==null?void 0:Ht.metaPixel)==null?void 0:jt.enabled)!=null?$t:!1},wishlistAnalytics:{enabled:(Bt=(Kt=(qt=t.integrations)==null?void 0:qt.metaPixel)==null?void 0:Kt.enabled)!=null?Bt:!0}},icons:{}}}parseRoutes(){let t=this.config.routes.rootUrl;return{rootUrl:t,fileUrl:this.config.routes.fileUrl,wishlistUrl:t+this.settings.general.wishlistPath.split("/").filter(e=>!!e).join("/"),accountUrl:t+"account",accountLoginUrl:t+"account/login",accountLogoutUrl:t+"account/logout",accountRegisterUrl:t+"account/register",accountAddressesUrl:t+"account/addresses",collectionsUrl:t+"collections",allProductsCollectionUrl:t+"collections/all",searchUrl:t+"search",predictiveSearchUrl:t+"search/suggest",cartUrl:t+"cart",cartAddUrl:t+"cart/add",cartChangeUrl:t+"cart/change",cartClearUrl:t+"cart/clear",cartUpdateUrl:t+"cart/update",productRecommendationsUrl:t+"recommendations/products"}}};export{oe as WishlistApp};
`;var lt,B,J=class{constructor(t){u(this,lt,void 0);u(this,B,void 0);this.host=t.host,this.headers={"content-type":"application/json"},m(this,B,new D({name:t.name})),m(this,lt,y(`wk:api:${t.name}`))}fetch(t){var p;let{method:e="GET",path:i,query:s,body:r}=t,n=this.host+i+this.getQuerystring(s),a={...this.headers,...t.headers},l=[e,n,r,a],h=(p=t.cacheStrategy)!=null?p:"no-store";return c(this,B).withCache(l,h,async d=>{c(this,lt).call(this,"Fetch from remote",{method:e,url:n,headers:a});let g=await window.fetch(n,{method:e,headers:a,body:r,signal:d});if(g.ok)return g.json();throw Error(`Error ${g.status}`)})}getQuerystring(t){if(!t)return"";let e=new URLSearchParams;return Object.entries(t).forEach(([i,s])=>{Array.isArray(s)?s.forEach(r=>e.append(i,r)):s&&e.append(i,s)}),"?"+e.toString()}get({path:t,query:e,headers:i,cacheStrategy:s}){return this.fetch({method:"GET",path:t,query:e,headers:i,cacheStrategy:s})}post({path:t,query:e,body:i,headers:s}){return this.fetch({method:"POST",path:t,query:e,body:i?JSON.stringify(i):void 0,headers:s})}put({path:t,query:e,body:i,headers:s}){return this.fetch({method:"PUT",path:t,query:e,body:i?JSON.stringify(i):void 0,headers:s})}delete({path:t,query:e,body:i,headers:s}){return this.fetch({method:"DELETE",path:t,query:e,body:i?JSON.stringify(i):void 0,headers:s})}clearCache(t=!1){return c(this,B).clear(t)}};lt=new WeakMap,B=new WeakMap;var de=new Promise((o,t)=>{window.Shopify.loadFeatures([{name:"consent-tracking-api",version:"0.1"}],e=>{e||!window.Shopify.customerPrivacy?t(e||new Error("Shopify.customerPrivacy not available")):o(window.Shopify.customerPrivacy)})}),Wt=o=>{de.then(t=>{o({marketingAllowed:t.marketingAllowed(),saleOfDataAllowed:t.saleOfDataAllowed(),analyticsAllowed:t.analyticsProcessingAllowed(),preferencesAllowed:t.preferencesProcessingAllowed()})}).catch(t=>{console.warn("Failed to load Customer Privacy API",t)}),document.addEventListener("visitorConsentCollected",t=>{"detail"in t&&o(t.detail)})};var ht,kt,Tt=class extends J{constructor(e){super({...e,name:"wishlist"});u(this,ht,void 0);u(this,kt,void 0);m(this,ht,e.storefrontApi),this.headers={"content-type":"application/json"},e.shop&&(this.headers["x-appmate-shp"]=e.shop),e.sessionId&&(this.headers["x-appmate-sid"]=e.sessionId),e.customerId&&(this.headers["x-appmate-cid"]=e.customerId.toString()),e.trackingSource&&(this.headers["x-appmate-src"]=e.trackingSource),Wt(i=>{m(this,kt,i),this.headers["x-appmate-vca"]=i.analyticsAllowed.toString(),this.headers["x-appmate-vcm"]=i.marketingAllowed.toString()})}get hasSession(){return!!this.headers["x-appmate-sid"]||!!this.headers["x-appmate-cid"]}get hasCustomer(){return!!this.headers["x-appmate-cid"]}setSessionId(e){this.headers["x-appmate-sid"]=e}clearSessionId(){delete this.headers["x-appmate-sid"]}async loadWishlist({wishlistId:e,cacheStrategy:i="public, max-age=60, stale-while-revalidate=86400"}){return e==="mine"&&!this.hasSession?{wishlist:{id:e,isMine:!0,numItems:0,items:[]}}:this.get({path:`/wishlists/${e}`,cacheStrategy:i}).then(({wishlist:r})=>Promise.all(r.items.map(n=>c(this,ht).loadProduct({productId:n.productId,cacheStrategy:i}))).then(n=>({wishlist:Zt(r,n.filter(a=>!!a))})))}addItem({productId:e,variantId:i}){if(typeof e=="string"&&(e=parseInt(e)),typeof i=="string"&&(i=parseInt(i)),!this.hasSession&&this._pendingSessionId)return this._pendingSessionId.then(()=>this.addItem({productId:e,variantId:i}));let s=this.post({path:"/wishlists/mine/items",body:{productId:e,variantId:i}}).then(r=>(r.sessionId&&(this.setSessionId(r.sessionId),this._pendingSessionId=void 0),r));return this.hasSession||(this._pendingSessionId=s),s}updateItem({wishlistItemId:e,changes:i}){return this.put({path:"/wishlists/mine/items",body:{changes:{...i,wishlistItemId:e}}})}removeItem({wishlistId:e,wishlistItemId:i}){return this.delete({path:`/wishlists/${e}/items`,body:{wishlistItemId:i}})}clearWishlist(){return this.delete({path:"/wishlists/mine"})}};ht=new WeakMap,kt=new WeakMap;var xt=class extends J{constructor(t){super({...t,name:"shopify"})}loadCart(t){if(this.pendingCart)return this.pendingCart;let e=this.get({path:"/cart.js",cacheStrategy:t==null?void 0:t.cacheStrategy}).then(i=>(this.pendingCart=void 0,i));return this.pendingCart=e,e}addToCart(t){return this.post({path:"/cart/add.js",body:t})}};var Ct,G=class{constructor({host:t,shop:e,sessionId:i,customerId:s}){u(this,Ct,void 0);this.host=t,this.shop=e,this.customerId=s,this.sessionId=i,this.eventNames=new Map([["viewWishlist","wishlist_viewed"],["addToCart","product_added_to_cart"],["shareWishlist","wishlist_shared"]]),Wt(r=>{m(this,Ct,r)})}setSession(t){this.sessionId=t}clearSession(){this.sessionId=void 0}async track({eventName:t,wishlist:e,product:i,variant:s,quantity:r,source:n}){var l,h;if(!this.sessionId)return!1;let a=this.eventNames.get(t);return!a||!e?!1:window.fetch(this.host+"/notify",{method:"POST",headers:{"content-type":"application/json","x-appmate-shp":this.shop,"x-appmate-sid":(l=this.sessionId)!=null?l:"","x-appmate-cid":(h=this.customerId)!=null?h:""},body:JSON.stringify({event:a,wid:e.publicId,pid:i==null?void 0:i.id,vid:s==null?void 0:s.id,qty:r,src:n})}).then(()=>!0).catch(p=>!1)}getQuerystring(t){if(!t)return"";let e=new URLSearchParams;return Object.entries(t).forEach(([i,s])=>{Array.isArray(s)?s.forEach(r=>e.append(i,r)):s&&e.append(i,s)}),"?"+e.toString()}};Ct=new WeakMap;var{gtag:ie,dataLayer:se}=window,Et=class{constructor({currency:t}){this.currency=t,this.eventNames=new Map([["addToWishlist","add_to_wishlist"]])}async track({eventName:t,product:e,variant:i,quantity:s=1}){var a,l,h;let r=this.eventNames.get(t);if(!r||!e)return!1;let n=((a=i==null?void 0:i.price)!=null?a:e.variants[0].price)/100;return ie?(ie("event",r,{currency:this.currency,value:n,items:[{item_id:(l=(i==null?void 0:i.sku)||(i==null?void 0:i.id))!=null?l:e.id,item_name:e.title,affiliation:"Wishlist King",item_category:e.type,item_brand:e.vendor,item_variant:i==null?void 0:i.title,item_quantity:s,item_price:n}]}),!0):se?(se.push({event:r,ecommerce:{currency:this.currency,value:n,items:[{item_id:(h=(i==null?void 0:i.sku)||(i==null?void 0:i.id))!=null?h:e.id,item_name:e.title,affiliation:"Wishlist King",item_category:e.type,item_brand:e.vendor,item_variant:i==null?void 0:i.title,item_quantity:s,item_price:n}]}}),!0):!1}};var re=y("wk:tracking:klaviyo"),Ut=class{constructor({customerEmail:t,urlUtil:e,moneyUtil:i}){this.customerEmail=t,this.urlUtil=e,this.moneyUtil=i,this.eventNames=new Map([["addToWishlist","Added To Wishlist"],["removeFromWishlist","Removed From Wishlist"],["clearWishlist","Cleared Wishlist"]])}async track({eventName:t,wishlist:e,product:i,variant:s,quantity:r=1}){var d,g,f,I,E,U,_,Z,Y;let n=this.eventNames.get(t);if(!n||!e||!i)return!1;let a=e.items.slice().reverse().map(dt=>dt.product.id),l={$email:this.customerEmail,WishlistUrl:this.urlUtil.getPublicWishlistUrl(e.id),WishlistProductIDs:a};re("Identify",l),(d=window.klaviyo)==null||d.push(["identify",l]);let h=((g=s==null?void 0:s.price)!=null?g:!i.price_varies)?i.price_min:void 0,p={URL:this.urlUtil.getVariantUrl(i.url,s==null?void 0:s.id),Name:i.title,ProductID:i.id,VariantID:(f=s==null?void 0:s.id)!=null?f:null,SKU:(I=s==null?void 0:s.sku)!=null?I:null,Tags:i.tags,Brand:i.vendor,ImageURL:this.urlUtil.getImageUrl((E=s==null?void 0:s.featured_image)!=null&&E.src?s:i,{width:1e3}),Price:h?h/100:null,PriceFormatted:h?this.moneyUtil.formatMoney(h):null,CurrencyCode:(Z=(_=(U=window.Shopify)==null?void 0:U.currency)==null?void 0:_.active)!=null?Z:null,Quantity:r,WishlistUrl:this.urlUtil.getPublicWishlistUrl(e.id),WishlistProductIDs:a};return re("Track",n,p),(Y=window.klaviyo)==null||Y.push(["track",n,p]),!0}};var{fbq:ne}=window,_t=class{constructor({currency:t}){this.currency=t,this.eventNames=new Map([["addToWishlist","AddToWishlist"]])}async track({eventName:t,product:e,variant:i}){let s=this.eventNames.get(t);return!s||typeof ne!="function"||!e?!1:(ne("track",s,{value:i==null?void 0:i.price,currency:this.currency,content_ids:[e.id],content_name:[e.title,i==null?void 0:i.title].filter(r=>!!r).join(" - "),content_category:e.type,content_type:"product_group",num_items:1}),!0)}};var pt=y("wk:tracking"),Rt=class{constructor({settings:t,events:e,notifyHost:i,utils:s,theme:r,shop:n,sessionId:a,customerId:l,customerEmail:h}){this.utils=s,this.theme=r,this.services=[],pt("Init tracking"),t.integrations.wishlistAnalytics.enabled&&this.services.push(new G({host:i,shop:n,customerId:l,sessionId:a})),t.integrations.klaviyo.enabled&&h&&(pt("Add Klaviyo integration"),this.services.push(new Ut({urlUtil:this.utils.url,moneyUtil:this.utils.money,customerEmail:h}))),t.integrations.metaPixel.enabled&&(pt("Add Meta Pixel integration"),this.services.push(new _t({currency:window.Shopify.currency.active}))),t.integrations.googleAnalytics.enabled&&(pt("Add Google Analytics integration"),this.services.push(new Et({currency:window.Shopify.currency.active})));let p=this.theme.getPageType(),d=g=>f=>{var I,E,U,_;return this.track({eventName:g,source:p,wishlist:(I=f.data)==null?void 0:I.wishlist,product:(E=f.data)==null?void 0:E.product,variant:(U=f.data)==null?void 0:U.variant,quantity:(_=f.data)==null?void 0:_.quantity})};e.subscribeMany({"wishlist:add-to-cart:success":d("addToCart"),"wishlist:add:success":d("addToWishlist"),"wishlist:change-variant:success":d("changeVariant"),"wishlist:clear:success":d("clearWishlist"),"wishlist:remove:success":d("removeFromWishlist"),"wishlist:share:success":d("shareWishlist"),"wishlist:page-view":d("viewWishlist")})}async track(t){return pt("Track",t),this.services.length?Promise.all(this.services.map(e=>e.track(t))):[]}setSessionId(t){let e=this.services.find(i=>i instanceof G);e&&e.setSession(t)}clearSessionId(){let t=this.services.find(e=>e instanceof G);t&&t.clearSession()}};var Q=y("wk:app"),oe=class{constructor(t){this.addToCart=t=>this.state.addToCart(t);this.addAllToCart=t=>this.state.addAllToCart(t);this.addWishlistItem=t=>this.state.addWishlistItem(t);this.clearWishlist=()=>this.state.clearWishlist();this.removeWishlistItem=t=>this.state.removeWishlistItem(t);this.shareWishlist=t=>this.state.shareWishlist(t);this.updateWishlistItem=t=>this.state.updateWishlistItem(t);var i,s,r;this.config=this.parseConfig(t),this.settings=this.parseSettings(t),this.routes=this.parseRoutes(),this.customer=this.config.customer.id?{id:this.config.customer.id,email:this.config.customer.email,tags:this.config.customer.tags}:null,Q("Create app",{config:this.config,settings:this.settings,customer:this.customer}),this.events=new yt,this.theme=new ft({rootUrl:this.routes.rootUrl,wishlistUrl:this.routes.wishlistUrl}),this._utils={url:new It({rootUrl:this.routes.rootUrl,wishlistUrl:this.routes.wishlistUrl,shopDomain:this.config.shop.domain,placeholderImageUrl:this.config.products.fallbackImage,fileUrl:this.routes.fileUrl}),money:new vt({moneyFormat:this.config.shop.moneyFormat,moneyFormatWithCurrency:this.config.shop.moneyFormatWithCurrency}),product:new Pt};let e=new At({accessToken:this.config.storefront.accessToken,version:this.config.storefront.version,country:window.Shopify.country.toUpperCase(),language:window.Shopify.locale.split("-")[0].toUpperCase(),storeName:this.config.shop.permanentDomain.replace(".myshopify.com","")});this._apis={wishlist:new Tt({host:this.config.routes.apiHost,shop:this.config.shop.permanentDomain,customerId:(i=this.config.customer.id)!=null?i:void 0,sessionId:this.getSessionId(),trackingSource:this.theme.getPageType(),storefrontApi:e}),shopify:new xt({host:window.Shopify.routes.root.substring(0,window.Shopify.routes.root.length-1)}),storefront:e,tracking:new Rt({notifyHost:this.config.routes.apiHost,events:this.events,shop:this.config.shop.permanentDomain,customerId:(s=this.config.customer.id)!=null?s:void 0,customerEmail:(r=this.config.customer.email)!=null?r:void 0,sessionId:this.getSessionId(),utils:this.utils,theme:this.theme,settings:this.settings})},this._state=new wt({wishlistApi:this.apis.wishlist,shopifyApi:this.apis.shopify,storefrontApi:this.apis.storefront,settings:this.settings,events:this.events,utils:this.utils}),this.initCustomerSession(),this.initUrlChangeEvents(),this.trackCurrentPage(),this.initLoginRedirect(),window.WishlistKing=this,Q("App ready"),this.events.publish({name:"app:ready",data:{}})}get state(){return this._state}get apis(){return this._apis}get utils(){return this._utils}get hasSession(){return!!this.getSessionId()||!!this.customer}get isLoggedIn(){var t;return!!((t=this.customer)!=null&&t.id)}getSessionId(){let t=window.localStorage.getItem("wk_session_id");if(t)return t;let e=window.localStorage.getItem("appmate-session");if(e)try{let i=JSON.parse(e).state.sid;return this.setSessionId(i)}catch(i){console.error(i)}}setSessionId(t){var e;return window.localStorage.setItem("wk_session_id",t),(e=this._apis)==null||e.tracking.setSessionId(t),t}clearSessionId(){var t,e;window.localStorage.removeItem("wk_session_id"),(t=this._apis)==null||t.tracking.clearSessionId(),(e=this._apis)==null||e.wishlist.clearSessionId()}initLoginRedirect(){var e,i;if(this.theme.getPageType()==="account"){let s=this.getPendingWishlistAction();if(s){Q("Inject redirect for pending action",{pending:s});let r=document.getElementById("customer_login"),n=document.getElementById("create_customer");(i=r!=null?r:n)==null||i.insertAdjacentHTML("beforeend",`<input type="hidden" name="return_to" value="${(e=s.origin)!=null?e:this.routes.wishlistUrl}">`)}}}trackCurrentPage(){if(this.theme.getPageType()==="wishlist"){let e=this.theme.getWishlistId(window.location.pathname);e&&this.state.publishEvent({eventName:"wishlist:page-view",wishlistId:e}).catch(i=>{console.warn("Failed to track wishlist page view",i)})}}async initLoginActionQueue(){Q("Init customer events");let t=!!window.localStorage.getItem("wk_logged_in");if(this.events.subscribe("wishlist:login-required",e=>{var s;let i=["wishlist:add","wishlist:view"];(s=e.data)!=null&&s.action&&i.includes(e.data.action)&&window.localStorage.setItem("wk_pending",JSON.stringify({...e.data,origin:window.location.href}))}),!t&&this.isLoggedIn){Q("Customer logged in"),window.localStorage.setItem("wk_logged_in","1");let e=this.getPendingWishlistAction();this.events.publish({name:"customer:login",data:{pending:e}})}else t&&!this.isLoggedIn&&(Q("Customer logged out"),window.localStorage.removeItem("wk_logged_in"),this.events.publish({name:"customer:logout",data:{}}));["challenge","account"].includes(this.theme.getPageType())||window.localStorage.removeItem("wk_pending")}initCustomerSession(){this.hasSession||this.events.once("app:init-sid",t=>{var e,i;(e=t.data)!=null&&e.sessionId&&this.setSessionId((i=t.data)==null?void 0:i.sessionId)})}async clearCustomerSession(){window.localStorage.removeItem("wk_pending"),this.clearSessionId(),this.initCustomerSession(),await this.state.revalidate(!0)}getPendingWishlistAction(){try{let t=window.localStorage.getItem("wk_pending");if(t)return JSON.parse(t)}catch(t){console.warn("Could not parse pending wishlist action",t)}}initUrlChangeEvents(){let t=({productHandle:i,variantId:s})=>{this.events.publish({name:"product:change-variant:success",data:{productHandle:i,variantId:s}})},e=i=>(...s)=>{var d;let r=i.apply(history,s),n=typeof s[2]=="string"?s[2]:(d=s[2])==null?void 0:d.toString();if(!n)return r;n.startsWith("?")&&(n=window.location.pathname+n);let a=`${window.location.protocol}//${window.location.host}`,l=new URL(n,a),h=this.theme.getProductHandle(l),p=l.searchParams.get("variant");if(!h)return r;t({productHandle:h,variantId:p?parseInt(p):void 0})};history.replaceState=e(history.replaceState),history.pushState=e(history.pushState)}parseConfig({config:t}){var e,i,s,r,n,a,l,h;return{storefront:{accessToken:t.storefrontAccessToken,version:t.storefrontVersion},customer:{id:t.customerId?t.customerId:null,email:(e=t.customerEmail)!=null?e:"",tags:(i=t.customerTags)!=null?i:[]},shop:{name:(s=t.shopName)!=null?s:"",domain:(r=t.shopDomain)!=null?r:"",permanentDomain:(n=t.shopPermanentDomain)!=null?n:"",moneyFormat:(a=t.shopMoneyFormat)!=null?a:"",moneyFormatWithCurrency:(l=t.shopMoneyFormatWithCurrency)!=null?l:"",customerAccountsEnabled:t.shopCustomerAccountsEnabled},routes:{apiHost:t.apiHost,sdkHost:t.sdkHost,templateHost:t.templateHost,rootUrl:window.Shopify.routes.root,fileUrl:t.fileUrl},products:{fallbackImage:(h=t.productFallbackImage)!=null?h:"//cdn.shopify.com/s/files/1/0533/2089/files/placeholder-images-image_large.png?format=webp&v=1530129081"}}}parseSettings({settings:t}){var e,i,s,r,n,a,l,h,p,d,g,f,I,E,U,_,Z,Y,dt,Ht,jt,$t,qt,Kt,Bt;return{general:{appLoading:(i=(e=t==null?void 0:t.general)==null?void 0:e.appLoading)!=null?i:"LAZY",wishlistAccessMode:(r=(s=t==null?void 0:t.general)==null?void 0:s.wishlistAccessMode)!=null?r:"UNRESTRICTED",wishlistMode:(a=(n=t==null?void 0:t.general)==null?void 0:n.wishlistMode)!=null?a:"PRODUCT",wishlistPath:(h=(l=t==null?void 0:t.general)==null?void 0:l.wishlistPath)!=null?h:"/apps/wishlist"},money:{withCurrency:(d=(p=t==null?void 0:t.money)==null?void 0:p.withCurrency)!=null?d:!1},integrations:{googleAnalytics:{enabled:(I=(f=(g=t.integrations)==null?void 0:g.googleAnalytics)==null?void 0:f.enabled)!=null?I:!1,tracker:(_=(U=(E=t.integrations)==null?void 0:E.googleAnalytics)==null?void 0:U.tracker)!=null?_:""},klaviyo:{enabled:(dt=(Y=(Z=t.integrations)==null?void 0:Z.klaviyo)==null?void 0:Y.enabled)!=null?dt:!1},metaPixel:{enabled:($t=(jt=(Ht=t.integrations)==null?void 0:Ht.metaPixel)==null?void 0:jt.enabled)!=null?$t:!1},wishlistAnalytics:{enabled:(Bt=(Kt=(qt=t.integrations)==null?void 0:qt.metaPixel)==null?void 0:Kt.enabled)!=null?Bt:!0}},icons:{}}}parseRoutes(){let t=this.config.routes.rootUrl;return{rootUrl:t,fileUrl:this.config.routes.fileUrl,wishlistUrl:t+this.settings.general.wishlistPath.split("/").filter(e=>!!e).join("/"),accountUrl:t+"account",accountLoginUrl:t+"account/login",accountLogoutUrl:t+"account/logout",accountRegisterUrl:t+"account/register",accountAddressesUrl:t+"account/addresses",collectionsUrl:t+"collections",allProductsCollectionUrl:t+"collections/all",searchUrl:t+"search",predictiveSearchUrl:t+"search/suggest",cartUrl:t+"cart",cartAddUrl:t+"cart/add",cartChangeUrl:t+"cart/change",cartClearUrl:t+"cart/clear",cartUpdateUrl:t+"cart/update",productRecommendationsUrl:t+"recommendations/products"}}};export{oe as WishlistApp};

@@ -1,4 +0,4 @@

var ki=Object.defineProperty;var Oi=(s,t)=>{for(var e in t)ki(s,e,{get:t[e],enumerable:!0})};var Le=(s,t,e)=>{if(!t.has(s))throw TypeError("Cannot "+e)};var gt=(s,t,e)=>(Le(s,t,"read from private field"),e?e.call(s):t.get(s)),wt=(s,t,e)=>{if(t.has(s))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(s):t.set(s,e)},yt=(s,t,e,i)=>(Le(s,t,"write to private field"),i?i.call(s,e):t.set(s,e),e);var _t={};Oi(_t,{CSSResult:()=>st,LitElement:()=>U,ReactiveElement:()=>M,_$LE:()=>Bi,_$LH:()=>be,adoptStyles:()=>Ut,css:()=>He,defaultConverter:()=>Wt,getCompatibleStyle:()=>vt,html:()=>Ni,isServer:()=>Cs,noChange:()=>P,notEqual:()=>pe,nothing:()=>v,render:()=>ve,supportsAdoptingStyleSheets:()=>bt,svg:()=>Vi,unsafeCSS:()=>de});var Dt=globalThis,bt=Dt.ShadowRoot&&(Dt.ShadyCSS===void 0||Dt.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,ue=Symbol(),Fe=new WeakMap,st=class{constructor(t,e,i){if(this._$cssResult$=!0,i!==ue)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o,e=this.t;if(bt&&t===void 0){let i=e!==void 0&&e.length===1;i&&(t=Fe.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&Fe.set(e,t))}return t}toString(){return this.cssText}},de=s=>new st(typeof s=="string"?s:s+"",void 0,ue),He=(s,...t)=>{let e=s.length===1?s[0]:t.reduce((i,n,r)=>i+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(n)+s[r+1],s[0]);return new st(e,s,ue)},Ut=(s,t)=>{if(bt)s.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of t){let i=document.createElement("style"),n=Dt.litNonce;n!==void 0&&i.setAttribute("nonce",n),i.textContent=e.cssText,s.appendChild(i)}},vt=bt?s=>s:s=>s instanceof CSSStyleSheet?(t=>{let e="";for(let i of t.cssRules)e+=i.cssText;return de(e)})(s):s;var{is:Ii,defineProperty:Mi,getOwnPropertyDescriptor:Li,getOwnPropertyNames:Fi,getOwnPropertySymbols:Hi,getPrototypeOf:Di}=Object,B=globalThis,De=B.trustedTypes,Ui=De?De.emptyScript:"",fe=B.reactiveElementPolyfillSupport,xt=(s,t)=>s,Wt={toAttribute(s,t){switch(t){case Boolean:s=s?Ui:null;break;case Object:case Array:s=s==null?s:JSON.stringify(s)}return s},fromAttribute(s,t){let e=s;switch(t){case Boolean:e=s!==null;break;case Number:e=s===null?null:Number(s);break;case Object:case Array:try{e=JSON.parse(s)}catch(i){e=null}}return e}},pe=(s,t)=>!Ii(s,t),Ue={attribute:!0,type:String,converter:Wt,reflect:!1,hasChanged:pe},We,Ne;(We=Symbol.metadata)!=null||(Symbol.metadata=Symbol("metadata")),(Ne=B.litPropertyMetadata)!=null||(B.litPropertyMetadata=new WeakMap);var M=class extends HTMLElement{static addInitializer(t){var e;this._$Ei(),((e=this.l)!=null?e:this.l=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=Ue){if(e.state&&(e.attribute=!1),this._$Ei(),this.elementProperties.set(t,e),!e.noAccessor){let i=Symbol(),n=this.getPropertyDescriptor(t,i,e);n!==void 0&&Mi(this.prototype,t,n)}}static getPropertyDescriptor(t,e,i){var o;let{get:n,set:r}=(o=Li(this.prototype,t))!=null?o:{get(){return this[e]},set(a){this[e]=a}};return{get(){return n==null?void 0:n.call(this)},set(a){let l=n==null?void 0:n.call(this);r.call(this,a),this.requestUpdate(t,l,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){var e;return(e=this.elementProperties.get(t))!=null?e:Ue}static _$Ei(){if(this.hasOwnProperty(xt("elementProperties")))return;let t=Di(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(xt("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(xt("properties"))){let e=this.properties,i=[...Fi(e),...Hi(e)];for(let n of i)this.createProperty(n,e[n])}let t=this[Symbol.metadata];if(t!==null){let e=litPropertyMetadata.get(t);if(e!==void 0)for(let[i,n]of e)this.elementProperties.set(i,n)}this._$Eh=new Map;for(let[e,i]of this.elementProperties){let n=this._$Eu(e,i);n!==void 0&&this._$Eh.set(n,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){let e=[];if(Array.isArray(t)){let i=new Set(t.flat(1/0).reverse());for(let n of i)e.unshift(vt(n))}else t!==void 0&&e.push(vt(t));return e}static _$Eu(t,e){let i=e.attribute;return i===!1?void 0:typeof i=="string"?i:typeof t=="string"?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._$Eg=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$ES(),this.requestUpdate(),(t=this.constructor.l)==null||t.forEach(e=>e(this))}addController(t){var e,i;((e=this._$E_)!=null?e:this._$E_=new Set).add(t),this.renderRoot!==void 0&&this.isConnected&&((i=t.hostConnected)==null||i.call(t))}removeController(t){var e;(e=this._$E_)==null||e.delete(t)}_$ES(){let t=new Map,e=this.constructor.elementProperties;for(let i of e.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t)}createRenderRoot(){var e;let t=(e=this.shadowRoot)!=null?e:this.attachShadow(this.constructor.shadowRootOptions);return Ut(t,this.constructor.elementStyles),t}connectedCallback(){var t,e;(t=this.renderRoot)!=null||(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(e=this._$E_)==null||e.forEach(i=>{var n;return(n=i.hostConnected)==null?void 0:n.call(i)})}enableUpdating(t){}disconnectedCallback(){var t;(t=this._$E_)==null||t.forEach(e=>{var i;return(i=e.hostDisconnected)==null?void 0:i.call(e)})}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$EO(t,e){var r;let i=this.constructor.elementProperties.get(t),n=this.constructor._$Eu(t,i);if(n!==void 0&&i.reflect===!0){let o=(((r=i.converter)==null?void 0:r.toAttribute)!==void 0?i.converter:Wt).toAttribute(e,i.type);this._$Em=t,o==null?this.removeAttribute(n):this.setAttribute(n,o),this._$Em=null}}_$AK(t,e){var r;let i=this.constructor,n=i._$Eh.get(t);if(n!==void 0&&this._$Em!==n){let o=i.getPropertyOptions(n),a=typeof o.converter=="function"?{fromAttribute:o.converter}:((r=o.converter)==null?void 0:r.fromAttribute)!==void 0?o.converter:Wt;this._$Em=n,this[n]=a.fromAttribute(e,o.type),this._$Em=null}}requestUpdate(t,e,i,n=!1,r){var o;if(t!==void 0){if(i!=null||(i=this.constructor.getPropertyOptions(t)),!((o=i.hasChanged)!=null?o:pe)(n?r:this[t],e))return;this.C(t,e,i)}this.isUpdatePending===!1&&(this._$Eg=this._$EP())}C(t,e,i){var n;this._$AL.has(t)||this._$AL.set(t,e),i.reflect===!0&&this._$Em!==t&&((n=this._$Ej)!=null?n:this._$Ej=new Set).add(t)}async _$EP(){this.isUpdatePending=!0;try{await this._$Eg}catch(e){Promise.reject(e)}let t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var i,n;if(!this.isUpdatePending)return;if(!this.hasUpdated){if((i=this.renderRoot)!=null||(this.renderRoot=this.createRenderRoot()),this._$Ep){for(let[o,a]of this._$Ep)this[o]=a;this._$Ep=void 0}let r=this.constructor.elementProperties;if(r.size>0)for(let[o,a]of r)a.wrapped!==!0||this._$AL.has(o)||this[o]===void 0||this.C(o,this[o],a)}let t=!1,e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),(n=this._$E_)==null||n.forEach(r=>{var o;return(o=r.hostUpdate)==null?void 0:o.call(r)}),this.update(e)):this._$ET()}catch(r){throw t=!1,this._$ET(),r}t&&this._$AE(e)}willUpdate(t){}_$AE(t){var e;(e=this._$E_)==null||e.forEach(i=>{var n;return(n=i.hostUpdated)==null?void 0:n.call(i)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$ET(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$Eg}shouldUpdate(t){return!0}update(t){this._$Ej&&(this._$Ej=this._$Ej.forEach(e=>this._$EO(e,this[e]))),this._$ET()}updated(t){}firstUpdated(t){}},Ve;M.elementStyles=[],M.shadowRootOptions={mode:"open"},M[xt("elementProperties")]=new Map,M[xt("finalized")]=new Map,fe==null||fe({ReactiveElement:M}),((Ve=B.reactiveElementVersions)!=null?Ve:B.reactiveElementVersions=[]).push("2.0.2");var At=globalThis,Nt=At.trustedTypes,Be=Nt?Nt.createPolicy("lit-html",{createHTML:s=>s}):void 0,we="$lit$",D=`lit$${(Math.random()+"").slice(9)}$`,ye="?"+D,Wi=`<${ye}>`,J=document,St=()=>J.createComment(""),Ct=s=>s===null||typeof s!="object"&&typeof s!="function",Je=Array.isArray,Ze=s=>Je(s)||typeof(s==null?void 0:s[Symbol.iterator])=="function",me=`[
var ki=Object.defineProperty;var Oi=(s,t)=>{for(var e in t)ki(s,e,{get:t[e],enumerable:!0})};var Le=(s,t,e)=>{if(!t.has(s))throw TypeError("Cannot "+e)};var gt=(s,t,e)=>(Le(s,t,"read from private field"),e?e.call(s):t.get(s)),wt=(s,t,e)=>{if(t.has(s))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(s):t.set(s,e)},yt=(s,t,e,i)=>(Le(s,t,"write to private field"),i?i.call(s,e):t.set(s,e),e);var _t={};Oi(_t,{CSSResult:()=>st,LitElement:()=>U,ReactiveElement:()=>M,_$LE:()=>Bi,_$LH:()=>be,adoptStyles:()=>Ut,css:()=>He,defaultConverter:()=>Wt,getCompatibleStyle:()=>vt,html:()=>Ni,isServer:()=>Cs,noChange:()=>P,notEqual:()=>pe,nothing:()=>v,render:()=>ve,supportsAdoptingStyleSheets:()=>bt,svg:()=>Vi,unsafeCSS:()=>de});var Dt=globalThis,bt=Dt.ShadowRoot&&(Dt.ShadyCSS===void 0||Dt.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,ue=Symbol(),Fe=new WeakMap,st=class{constructor(t,e,i){if(this._$cssResult$=!0,i!==ue)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o,e=this.t;if(bt&&t===void 0){let i=e!==void 0&&e.length===1;i&&(t=Fe.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&Fe.set(e,t))}return t}toString(){return this.cssText}},de=s=>new st(typeof s=="string"?s:s+"",void 0,ue),He=(s,...t)=>{let e=s.length===1?s[0]:t.reduce((i,n,r)=>i+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(n)+s[r+1],s[0]);return new st(e,s,ue)},Ut=(s,t)=>{if(bt)s.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of t){let i=document.createElement("style"),n=Dt.litNonce;n!==void 0&&i.setAttribute("nonce",n),i.textContent=e.cssText,s.appendChild(i)}},vt=bt?s=>s:s=>s instanceof CSSStyleSheet?(t=>{let e="";for(let i of t.cssRules)e+=i.cssText;return de(e)})(s):s;var{is:Ii,defineProperty:Mi,getOwnPropertyDescriptor:Li,getOwnPropertyNames:Fi,getOwnPropertySymbols:Hi,getPrototypeOf:Di}=Object,B=globalThis,De=B.trustedTypes,Ui=De?De.emptyScript:"",fe=B.reactiveElementPolyfillSupport,xt=(s,t)=>s,Wt={toAttribute(s,t){switch(t){case Boolean:s=s?Ui:null;break;case Object:case Array:s=s==null?s:JSON.stringify(s)}return s},fromAttribute(s,t){let e=s;switch(t){case Boolean:e=s!==null;break;case Number:e=s===null?null:Number(s);break;case Object:case Array:try{e=JSON.parse(s)}catch(i){e=null}}return e}},pe=(s,t)=>!Ii(s,t),Ue={attribute:!0,type:String,converter:Wt,reflect:!1,hasChanged:pe},We,Ne;(We=Symbol.metadata)!=null||(Symbol.metadata=Symbol("metadata")),(Ne=B.litPropertyMetadata)!=null||(B.litPropertyMetadata=new WeakMap);var M=class extends HTMLElement{static addInitializer(t){var e;this._$Ei(),((e=this.l)!=null?e:this.l=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=Ue){if(e.state&&(e.attribute=!1),this._$Ei(),this.elementProperties.set(t,e),!e.noAccessor){let i=Symbol(),n=this.getPropertyDescriptor(t,i,e);n!==void 0&&Mi(this.prototype,t,n)}}static getPropertyDescriptor(t,e,i){var o;let{get:n,set:r}=(o=Li(this.prototype,t))!=null?o:{get(){return this[e]},set(a){this[e]=a}};return{get(){return n==null?void 0:n.call(this)},set(a){let l=n==null?void 0:n.call(this);r.call(this,a),this.requestUpdate(t,l,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){var e;return(e=this.elementProperties.get(t))!=null?e:Ue}static _$Ei(){if(this.hasOwnProperty(xt("elementProperties")))return;let t=Di(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(xt("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(xt("properties"))){let e=this.properties,i=[...Fi(e),...Hi(e)];for(let n of i)this.createProperty(n,e[n])}let t=this[Symbol.metadata];if(t!==null){let e=litPropertyMetadata.get(t);if(e!==void 0)for(let[i,n]of e)this.elementProperties.set(i,n)}this._$Eh=new Map;for(let[e,i]of this.elementProperties){let n=this._$Eu(e,i);n!==void 0&&this._$Eh.set(n,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){let e=[];if(Array.isArray(t)){let i=new Set(t.flat(1/0).reverse());for(let n of i)e.unshift(vt(n))}else t!==void 0&&e.push(vt(t));return e}static _$Eu(t,e){let i=e.attribute;return i===!1?void 0:typeof i=="string"?i:typeof t=="string"?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._$Eg=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$ES(),this.requestUpdate(),(t=this.constructor.l)==null||t.forEach(e=>e(this))}addController(t){var e,i;((e=this._$E_)!=null?e:this._$E_=new Set).add(t),this.renderRoot!==void 0&&this.isConnected&&((i=t.hostConnected)==null||i.call(t))}removeController(t){var e;(e=this._$E_)==null||e.delete(t)}_$ES(){let t=new Map,e=this.constructor.elementProperties;for(let i of e.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t)}createRenderRoot(){var e;let t=(e=this.shadowRoot)!=null?e:this.attachShadow(this.constructor.shadowRootOptions);return Ut(t,this.constructor.elementStyles),t}connectedCallback(){var t,e;(t=this.renderRoot)!=null||(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(e=this._$E_)==null||e.forEach(i=>{var n;return(n=i.hostConnected)==null?void 0:n.call(i)})}enableUpdating(t){}disconnectedCallback(){var t;(t=this._$E_)==null||t.forEach(e=>{var i;return(i=e.hostDisconnected)==null?void 0:i.call(e)})}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$EO(t,e){var r;let i=this.constructor.elementProperties.get(t),n=this.constructor._$Eu(t,i);if(n!==void 0&&i.reflect===!0){let o=(((r=i.converter)==null?void 0:r.toAttribute)!==void 0?i.converter:Wt).toAttribute(e,i.type);this._$Em=t,o==null?this.removeAttribute(n):this.setAttribute(n,o),this._$Em=null}}_$AK(t,e){var r;let i=this.constructor,n=i._$Eh.get(t);if(n!==void 0&&this._$Em!==n){let o=i.getPropertyOptions(n),a=typeof o.converter=="function"?{fromAttribute:o.converter}:((r=o.converter)==null?void 0:r.fromAttribute)!==void 0?o.converter:Wt;this._$Em=n,this[n]=a.fromAttribute(e,o.type),this._$Em=null}}requestUpdate(t,e,i,n=!1,r){var o;if(t!==void 0){if(i!=null||(i=this.constructor.getPropertyOptions(t)),!((o=i.hasChanged)!=null?o:pe)(n?r:this[t],e))return;this.C(t,e,i)}this.isUpdatePending===!1&&(this._$Eg=this._$EP())}C(t,e,i){var n;this._$AL.has(t)||this._$AL.set(t,e),i.reflect===!0&&this._$Em!==t&&((n=this._$Ej)!=null?n:this._$Ej=new Set).add(t)}async _$EP(){this.isUpdatePending=!0;try{await this._$Eg}catch(e){Promise.reject(e)}let t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var i,n;if(!this.isUpdatePending)return;if(!this.hasUpdated){if((i=this.renderRoot)!=null||(this.renderRoot=this.createRenderRoot()),this._$Ep){for(let[o,a]of this._$Ep)this[o]=a;this._$Ep=void 0}let r=this.constructor.elementProperties;if(r.size>0)for(let[o,a]of r)a.wrapped!==!0||this._$AL.has(o)||this[o]===void 0||this.C(o,this[o],a)}let t=!1,e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),(n=this._$E_)==null||n.forEach(r=>{var o;return(o=r.hostUpdate)==null?void 0:o.call(r)}),this.update(e)):this._$ET()}catch(r){throw t=!1,this._$ET(),r}t&&this._$AE(e)}willUpdate(t){}_$AE(t){var e;(e=this._$E_)==null||e.forEach(i=>{var n;return(n=i.hostUpdated)==null?void 0:n.call(i)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$ET(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$Eg}shouldUpdate(t){return!0}update(t){this._$Ej&&(this._$Ej=this._$Ej.forEach(e=>this._$EO(e,this[e]))),this._$ET()}updated(t){}firstUpdated(t){}},Ve;M.elementStyles=[],M.shadowRootOptions={mode:"open"},M[xt("elementProperties")]=new Map,M[xt("finalized")]=new Map,fe==null||fe({ReactiveElement:M}),((Ve=B.reactiveElementVersions)!=null?Ve:B.reactiveElementVersions=[]).push("2.0.2");var At=globalThis,Nt=At.trustedTypes,Be=Nt?Nt.createPolicy("lit-html",{createHTML:s=>s}):void 0,we="$lit$",D=`lit$${(Math.random()+"").slice(9)}$`,ye="?"+D,Wi=`<${ye}>`,Z=document,St=()=>Z.createComment(""),Ct=s=>s===null||typeof s!="object"&&typeof s!="function",Ze=Array.isArray,Je=s=>Ze(s)||typeof(s==null?void 0:s[Symbol.iterator])=="function",me=`[
\f\r]`,$t=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,ze=/-->/g,je=/>/g,Y=RegExp(`>|${me}(?:([^\\s"'>=/]+)(${me}*=${me}*(?:[^
\f\r"'\`<>=]|("|')|))|$)`,"g"),Ke=/'/g,qe=/"/g,Qe=/^(?:script|style|textarea|title)$/i,Ge=s=>(t,...e)=>({_$litType$:s,strings:t,values:e}),Ni=Ge(1),Vi=Ge(2),P=Symbol.for("lit-noChange"),v=Symbol.for("lit-nothing"),Ye=new WeakMap,X=J.createTreeWalker(J,129);function ti(s,t){if(!Array.isArray(s)||!s.hasOwnProperty("raw"))throw Error("invalid template strings array");return Be!==void 0?Be.createHTML(t):t}var ei=(s,t)=>{let e=s.length-1,i=[],n,r=t===2?"<svg>":"",o=$t;for(let a=0;a<e;a++){let l=s[a],c,d,h=-1,p=0;for(;p<l.length&&(o.lastIndex=p,d=o.exec(l),d!==null);)p=o.lastIndex,o===$t?d[1]==="!--"?o=ze:d[1]!==void 0?o=je:d[2]!==void 0?(Qe.test(d[2])&&(n=RegExp("</"+d[2],"g")),o=Y):d[3]!==void 0&&(o=Y):o===Y?d[0]===">"?(o=n!=null?n:$t,h=-1):d[1]===void 0?h=-2:(h=o.lastIndex-d[2].length,c=d[1],o=d[3]===void 0?Y:d[3]==='"'?qe:Ke):o===qe||o===Ke?o=Y:o===ze||o===je?o=$t:(o=Y,n=void 0);let u=o===Y&&s[a+1].startsWith("/>")?" ":"";r+=o===$t?l+Wi:h>=0?(i.push(c),l.slice(0,h)+we+l.slice(h)+D+u):l+D+(h===-2?a:u)}return[ti(s,r+(s[e]||"<?>")+(t===2?"</svg>":"")),i]},Et=class s{constructor({strings:t,_$litType$:e},i){let n;this.parts=[];let r=0,o=0,a=t.length-1,l=this.parts,[c,d]=ei(t,e);if(this.el=s.createElement(c,i),X.currentNode=this.el.content,e===2){let h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(n=X.nextNode())!==null&&l.length<a;){if(n.nodeType===1){if(n.hasAttributes())for(let h of n.getAttributeNames())if(h.endsWith(we)){let p=d[o++],u=n.getAttribute(h).split(D),f=/([.?@])?(.*)/.exec(p);l.push({type:1,index:r,name:f[2],strings:u,ctor:f[1]==="."?Bt:f[1]==="?"?zt:f[1]==="@"?jt:Q}),n.removeAttribute(h)}else h.startsWith(D)&&(l.push({type:6,index:r}),n.removeAttribute(h));if(Qe.test(n.tagName)){let h=n.textContent.split(D),p=h.length-1;if(p>0){n.textContent=Nt?Nt.emptyScript:"";for(let u=0;u<p;u++)n.append(h[u],St()),X.nextNode(),l.push({type:2,index:++r});n.append(h[p],St())}}}else if(n.nodeType===8)if(n.data===ye)l.push({type:2,index:r});else{let h=-1;for(;(h=n.data.indexOf(D,h+1))!==-1;)l.push({type:7,index:r}),h+=D.length-1}r++}}static createElement(t,e){let i=J.createElement("template");return i.innerHTML=t,i}};function Z(s,t,e=s,i){var o,a,l;if(t===P)return t;let n=i!==void 0?(o=e._$Co)==null?void 0:o[i]:e._$Cl,r=Ct(t)?void 0:t._$litDirective$;return(n==null?void 0:n.constructor)!==r&&((a=n==null?void 0:n._$AO)==null||a.call(n,!1),r===void 0?n=void 0:(n=new r(s),n._$AT(s,e,i)),i!==void 0?((l=e._$Co)!=null?l:e._$Co=[])[i]=n:e._$Cl=n),n!==void 0&&(t=Z(s,n._$AS(s,t.values),n,i)),t}var Vt=class{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){var c;let{el:{content:e},parts:i}=this._$AD,n=((c=t==null?void 0:t.creationScope)!=null?c:J).importNode(e,!0);X.currentNode=n;let r=X.nextNode(),o=0,a=0,l=i[0];for(;l!==void 0;){if(o===l.index){let d;l.type===2?d=new nt(r,r.nextSibling,this,t):l.type===1?d=new l.ctor(r,l.name,l.strings,this,t):l.type===6&&(d=new Kt(r,this,t)),this._$AV.push(d),l=i[++a]}o!==(l==null?void 0:l.index)&&(r=X.nextNode(),o++)}return X.currentNode=J,n}p(t){let e=0;for(let i of this._$AV)i!==void 0&&(i.strings!==void 0?(i._$AI(t,i,e),e+=i.strings.length-2):i._$AI(t[e])),e++}},nt=class s{get _$AU(){var t,e;return(e=(t=this._$AM)==null?void 0:t._$AU)!=null?e:this._$Cv}constructor(t,e,i,n){var r;this.type=2,this._$AH=v,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,this.options=n,this._$Cv=(r=n==null?void 0:n.isConnected)!=null?r:!0}get parentNode(){let t=this._$AA.parentNode,e=this._$AM;return e!==void 0&&(t==null?void 0:t.nodeType)===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=Z(this,t,e),Ct(t)?t===v||t==null||t===""?(this._$AH!==v&&this._$AR(),this._$AH=v):t!==this._$AH&&t!==P&&this._(t):t._$litType$!==void 0?this.g(t):t.nodeType!==void 0?this.$(t):Ze(t)?this.T(t):this._(t)}k(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}$(t){this._$AH!==t&&(this._$AR(),this._$AH=this.k(t))}_(t){this._$AH!==v&&Ct(this._$AH)?this._$AA.nextSibling.data=t:this.$(J.createTextNode(t)),this._$AH=t}g(t){var r;let{values:e,_$litType$:i}=t,n=typeof i=="number"?this._$AC(t):(i.el===void 0&&(i.el=Et.createElement(ti(i.h,i.h[0]),this.options)),i);if(((r=this._$AH)==null?void 0:r._$AD)===n)this._$AH.p(e);else{let o=new Vt(n,this),a=o.u(this.options);o.p(e),this.$(a),this._$AH=o}}_$AC(t){let e=Ye.get(t.strings);return e===void 0&&Ye.set(t.strings,e=new Et(t)),e}T(t){Je(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,i,n=0;for(let r of t)n===e.length?e.push(i=new s(this.k(St()),this.k(St()),this,this.options)):i=e[n],i._$AI(r),n++;n<e.length&&(this._$AR(i&&i._$AB.nextSibling,n),e.length=n)}_$AR(t=this._$AA.nextSibling,e){var i;for((i=this._$AP)==null?void 0:i.call(this,!1,!0,e);t&&t!==this._$AB;){let n=t.nextSibling;t.remove(),t=n}}setConnected(t){var e;this._$AM===void 0&&(this._$Cv=t,(e=this._$AP)==null||e.call(this,t))}},Q=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,i,n,r){this.type=1,this._$AH=v,this._$AN=void 0,this.element=t,this.name=e,this._$AM=n,this.options=r,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,n){let r=this.strings,o=!1;if(r===void 0)t=Z(this,t,e,0),o=!Ct(t)||t!==this._$AH&&t!==P,o&&(this._$AH=t);else{let a=t,l,c;for(t=r[0],l=0;l<r.length-1;l++)c=Z(this,a[i+l],e,l),c===P&&(c=this._$AH[l]),o||(o=!Ct(c)||c!==this._$AH[l]),c===v?t=v:t!==v&&(t+=(c!=null?c:"")+r[l+1]),this._$AH[l]=c}o&&!n&&this.O(t)}O(t){t===v?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t!=null?t:"")}},Bt=class extends Q{constructor(){super(...arguments),this.type=3}O(t){this.element[this.name]=t===v?void 0:t}},zt=class extends Q{constructor(){super(...arguments),this.type=4}O(t){this.element.toggleAttribute(this.name,!!t&&t!==v)}},jt=class extends Q{constructor(t,e,i,n,r){super(t,e,i,n,r),this.type=5}_$AI(t,e=this){var o;if((t=(o=Z(this,t,e,0))!=null?o:v)===P)return;let i=this._$AH,n=t===v&&i!==v||t.capture!==i.capture||t.once!==i.once||t.passive!==i.passive,r=t!==v&&(i===v||n);n&&this.element.removeEventListener(this.name,this,i),r&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e,i;typeof this._$AH=="function"?this._$AH.call((i=(e=this.options)==null?void 0:e.host)!=null?i:this.element,t):this._$AH.handleEvent(t)}},Kt=class{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){Z(this,t)}},be={j:we,P:D,A:ye,C:1,M:ei,L:Vt,R:Ze,V:Z,D:nt,I:Q,H:zt,N:jt,U:Bt,B:Kt},ge=At.litHtmlPolyfillSupport,Xe;ge==null||ge(Et,nt),((Xe=At.litHtmlVersions)!=null?Xe:At.litHtmlVersions=[]).push("3.1.0");var ve=(s,t,e)=>{var r,o;let i=(r=e==null?void 0:e.renderBefore)!=null?r:t,n=i._$litPart$;if(n===void 0){let a=(o=e==null?void 0:e.renderBefore)!=null?o:null;i._$litPart$=n=new nt(t.insertBefore(St(),a),a,void 0,e!=null?e:{})}return n._$AI(s),n};var U=class extends M{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e,i;let t=super.createRenderRoot();return(i=(e=this.renderOptions).renderBefore)!=null||(e.renderBefore=t.firstChild),t}update(t){let e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=ve(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),(t=this._$Do)==null||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this._$Do)==null||t.setConnected(!1)}render(){return P}},ii;U._$litElement$=!0,U.finalized=!0,(ii=globalThis.litElementHydrateSupport)==null||ii.call(globalThis,{LitElement:U});var xe=globalThis.litElementPolyfillSupport;xe==null||xe({LitElement:U});var Bi={_$AK:(s,t,e)=>{s._$AK(t,e)},_$AL:s=>s._$AL},si;((si=globalThis.litElementVersions)!=null?si:globalThis.litElementVersions=[]).push("4.0.2");var Cs=!1;var qt={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},Yt=s=>(...t)=>({_$litDirective$:s,values:t}),ot=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,i){this._$Ct=t,this._$AM=e,this._$Ci=i}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}};var{D:zi}=be;var ni=()=>document.createComment(""),rt=(s,t,e)=>{var r;let i=s._$AA.parentNode,n=t===void 0?s._$AB:t._$AA;if(e===void 0){let o=i.insertBefore(ni(),n),a=i.insertBefore(ni(),n);e=new zi(o,a,s,s.options)}else{let o=e._$AB.nextSibling,a=e._$AM,l=a!==s;if(l){let c;(r=e._$AQ)==null||r.call(e,s),e._$AM=s,e._$AP!==void 0&&(c=s._$AU)!==a._$AU&&e._$AP(c)}if(o!==n||l){let c=e._$AA;for(;c!==o;){let d=c.nextSibling;i.insertBefore(c,n),c=d}}}return e},z=(s,t,e=s)=>(s._$AI(t,e),s),ji={},oi=(s,t=ji)=>s._$AH=t,ri=s=>s._$AH,Xt=s=>{var i;(i=s._$AP)==null||i.call(s,!1,!0);let t=s._$AA,e=s._$AB.nextSibling;for(;t!==e;){let n=t.nextSibling;t.remove(),t=n}};var ai=(s,t,e)=>{let i=new Map;for(let n=t;n<=e;n++)i.set(s[n],n);return i},Jt=Yt(class extends ot{constructor(s){if(super(s),s.type!==qt.CHILD)throw Error("repeat() can only be used in text expressions")}ht(s,t,e){let i;e===void 0?e=t:t!==void 0&&(i=t);let n=[],r=[],o=0;for(let a of s)n[o]=i?i(a,o):o,r[o]=e(a,o),o++;return{values:r,keys:n}}render(s,t,e){return this.ht(s,t,e).values}update(s,[t,e,i]){var m;let n=ri(s),{values:r,keys:o}=this.ht(t,e,i);if(!Array.isArray(n))return this.dt=o,r;let a=(m=this.dt)!=null?m:this.dt=[],l=[],c,d,h=0,p=n.length-1,u=0,f=r.length-1;for(;h<=p&&u<=f;)if(n[h]===null)h++;else if(n[p]===null)p--;else if(a[h]===o[u])l[u]=z(n[h],r[u]),h++,u++;else if(a[p]===o[f])l[f]=z(n[p],r[f]),p--,f--;else if(a[h]===o[f])l[f]=z(n[h],r[f]),rt(s,l[f+1],n[h]),h++,f--;else if(a[p]===o[u])l[u]=z(n[p],r[u]),rt(s,n[h],n[p]),p--,u++;else if(c===void 0&&(c=ai(o,u,f),d=ai(a,h,p)),c.has(a[h]))if(c.has(a[p])){let g=d.get(o[u]),w=g!==void 0?n[g]:null;if(w===null){let y=rt(s,n[h]);z(y,r[u]),l[u]=y}else l[u]=z(w,r[u]),rt(s,n[h],w),n[g]=null;u++}else Xt(n[p]),p--;else Xt(n[h]),h++;for(;u<=f;){let g=rt(s,l[f+1]);z(g,r[u]),l[u++]=g}for(;h<=p;){let g=n[h++];g!==null&&Xt(g)}return this.dt=o,oi(s,l),P}});var j=Math.min,W=Math.max,Tt=Math.round,Rt=Math.floor,N=s=>({x:s,y:s}),Ki={left:"right",right:"left",bottom:"top",top:"bottom"},qi={start:"end",end:"start"};function Qt(s,t,e){return W(s,j(t,e))}function at(s,t){return typeof s=="function"?s(t):s}function K(s){return s.split("-")[0]}function lt(s){return s.split("-")[1]}function $e(s){return s==="x"?"y":"x"}function Gt(s){return s==="y"?"height":"width"}function kt(s){return["top","bottom"].includes(K(s))?"y":"x"}function te(s){return $e(kt(s))}function li(s,t,e){e===void 0&&(e=!1);let i=lt(s),n=te(s),r=Gt(n),o=n==="x"?i===(e?"end":"start")?"right":"left":i==="start"?"bottom":"top";return t.reference[r]>t.floating[r]&&(o=Pt(o)),[o,Pt(o)]}function ci(s){let t=Pt(s);return[Zt(s),t,Zt(t)]}function Zt(s){return s.replace(/start|end/g,t=>qi[t])}function Yi(s,t,e){let i=["left","right"],n=["right","left"],r=["top","bottom"],o=["bottom","top"];switch(s){case"top":case"bottom":return e?t?n:i:t?i:n;case"left":case"right":return t?r:o;default:return[]}}function hi(s,t,e,i){let n=lt(s),r=Yi(K(s),e==="start",i);return n&&(r=r.map(o=>o+"-"+n),t&&(r=r.concat(r.map(Zt)))),r}function Pt(s){return s.replace(/left|right|bottom|top/g,t=>Ki[t])}function Xi(s){return{top:0,right:0,bottom:0,left:0,...s}}function Ae(s){return typeof s!="number"?Xi(s):{top:s,right:s,bottom:s,left:s}}function G(s){return{...s,top:s.y,left:s.x,right:s.x+s.width,bottom:s.y+s.height}}function ui(s,t,e){let{reference:i,floating:n}=s,r=kt(t),o=te(t),a=Gt(o),l=K(t),c=r==="y",d=i.x+i.width/2-n.width/2,h=i.y+i.height/2-n.height/2,p=i[a]/2-n[a]/2,u;switch(l){case"top":u={x:d,y:i.y-n.height};break;case"bottom":u={x:d,y:i.y+i.height};break;case"right":u={x:i.x+i.width,y:h};break;case"left":u={x:i.x-n.width,y:h};break;default:u={x:i.x,y:i.y}}switch(lt(t)){case"start":u[o]-=p*(e&&c?-1:1);break;case"end":u[o]+=p*(e&&c?-1:1);break}return u}var di=async(s,t,e)=>{let{placement:i="bottom",strategy:n="absolute",middleware:r=[],platform:o}=e,a=r.filter(Boolean),l=await(o.isRTL==null?void 0:o.isRTL(t)),c=await o.getElementRects({reference:s,floating:t,strategy:n}),{x:d,y:h}=ui(c,i,l),p=i,u={},f=0;for(let m=0;m<a.length;m++){let{name:g,fn:w}=a[m],{x:y,y:b,data:$,reset:x}=await w({x:d,y:h,initialPlacement:i,placement:p,strategy:n,middlewareData:u,rects:c,platform:o,elements:{reference:s,floating:t}});if(d=y!=null?y:d,h=b!=null?b:h,u={...u,[g]:{...u[g],...$}},x&&f<=50){f++,typeof x=="object"&&(x.placement&&(p=x.placement),x.rects&&(c=x.rects===!0?await o.getElementRects({reference:s,floating:t,strategy:n}):x.rects),{x:d,y:h}=ui(c,p,l)),m=-1;continue}}return{x:d,y:h,placement:p,strategy:n,middlewareData:u}};async function Se(s,t){var e;t===void 0&&(t={});let{x:i,y:n,platform:r,rects:o,elements:a,strategy:l}=s,{boundary:c="clippingAncestors",rootBoundary:d="viewport",elementContext:h="floating",altBoundary:p=!1,padding:u=0}=at(t,s),f=Ae(u),g=a[p?h==="floating"?"reference":"floating":h],w=G(await r.getClippingRect({element:(e=await(r.isElement==null?void 0:r.isElement(g)))==null||e?g:g.contextElement||await(r.getDocumentElement==null?void 0:r.getDocumentElement(a.floating)),boundary:c,rootBoundary:d,strategy:l})),y=h==="floating"?{...o.floating,x:i,y:n}:o.reference,b=await(r.getOffsetParent==null?void 0:r.getOffsetParent(a.floating)),$=await(r.isElement==null?void 0:r.isElement(b))?await(r.getScale==null?void 0:r.getScale(b))||{x:1,y:1}:{x:1,y:1},x=G(r.convertOffsetParentRelativeRectToViewportRelativeRect?await r.convertOffsetParentRelativeRectToViewportRelativeRect({rect:y,offsetParent:b,strategy:l}):y);return{top:(w.top-x.top+f.top)/$.y,bottom:(x.bottom-w.bottom+f.bottom)/$.y,left:(w.left-x.left+f.left)/$.x,right:(x.right-w.right+f.right)/$.x}}var Ce=s=>({name:"arrow",options:s,async fn(t){let{x:e,y:i,placement:n,rects:r,platform:o,elements:a,middlewareData:l}=t,{element:c,padding:d=0}=at(s,t)||{};if(c==null)return{};let h=Ae(d),p={x:e,y:i},u=te(n),f=Gt(u),m=await o.getDimensions(c),g=u==="y",w=g?"top":"left",y=g?"bottom":"right",b=g?"clientHeight":"clientWidth",$=r.reference[f]+r.reference[u]-p[u]-r.floating[f],x=p[u]-r.reference[u],T=await(o.getOffsetParent==null?void 0:o.getOffsetParent(c)),k=T?T[b]:0;(!k||!await(o.isElement==null?void 0:o.isElement(T)))&&(k=a.floating[b]||r.floating[f]);let q=$/2-x/2,dt=k/2-m[f]/2-1,ft=j(h[w],dt),pt=j(h[y],dt),_=ft,mt=k-m[f]-pt,C=k/2-m[f]/2+q,O=Qt(_,C,mt),I=!l.arrow&&lt(n)!=null&&C!=O&&r.reference[f]/2-(C<_?ft:pt)-m[f]/2<0,H=I?C<_?C-_:C-mt:0;return{[u]:p[u]+H,data:{[u]:O,centerOffset:C-O-H,...I&&{alignmentOffset:H}},reset:I}}});var Ee=function(s){return s===void 0&&(s={}),{name:"flip",options:s,async fn(t){var e,i;let{placement:n,middlewareData:r,rects:o,initialPlacement:a,platform:l,elements:c}=t,{mainAxis:d=!0,crossAxis:h=!0,fallbackPlacements:p,fallbackStrategy:u="bestFit",fallbackAxisSideDirection:f="none",flipAlignment:m=!0,...g}=at(s,t);if((e=r.arrow)!=null&&e.alignmentOffset)return{};let w=K(n),y=K(a)===a,b=await(l.isRTL==null?void 0:l.isRTL(c.floating)),$=p||(y||!m?[Pt(a)]:ci(a));!p&&f!=="none"&&$.push(...hi(a,m,f,b));let x=[a,...$],T=await Se(t,g),k=[],q=((i=r.flip)==null?void 0:i.overflows)||[];if(d&&k.push(T[w]),h){let _=li(n,o,b);k.push(T[_[0]],T[_[1]])}if(q=[...q,{placement:n,overflows:k}],!k.every(_=>_<=0)){var dt,ft;let _=(((dt=r.flip)==null?void 0:dt.index)||0)+1,mt=x[_];if(mt)return{data:{index:_,overflows:q},reset:{placement:mt}};let C=(ft=q.filter(O=>O.overflows[0]<=0).sort((O,I)=>O.overflows[1]-I.overflows[1])[0])==null?void 0:ft.placement;if(!C)switch(u){case"bestFit":{var pt;let O=(pt=q.map(I=>[I.placement,I.overflows.filter(H=>H>0).reduce((H,Ri)=>H+Ri,0)]).sort((I,H)=>I[1]-H[1])[0])==null?void 0:pt[0];O&&(C=O);break}case"initialPlacement":C=a;break}if(n!==C)return{reset:{placement:C}}}return{}}}};async function Ji(s,t){let{placement:e,platform:i,elements:n}=s,r=await(i.isRTL==null?void 0:i.isRTL(n.floating)),o=K(e),a=lt(e),l=kt(e)==="y",c=["left","top"].includes(o)?-1:1,d=r&&l?-1:1,h=at(t,s),{mainAxis:p,crossAxis:u,alignmentAxis:f}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...h};return a&&typeof f=="number"&&(u=a==="end"?f*-1:f),l?{x:u*d,y:p*c}:{x:p*c,y:u*d}}var ee=function(s){return s===void 0&&(s=0),{name:"offset",options:s,async fn(t){var e,i;let{x:n,y:r,placement:o,middlewareData:a}=t,l=await Ji(t,s);return o===((e=a.offset)==null?void 0:e.placement)&&(i=a.arrow)!=null&&i.alignmentOffset?{}:{x:n+l.x,y:r+l.y,data:{...l,placement:o}}}}},_e=function(s){return s===void 0&&(s={}),{name:"shift",options:s,async fn(t){let{x:e,y:i,placement:n}=t,{mainAxis:r=!0,crossAxis:o=!1,limiter:a={fn:g=>{let{x:w,y}=g;return{x:w,y}}},...l}=at(s,t),c={x:e,y:i},d=await Se(t,l),h=kt(K(n)),p=$e(h),u=c[p],f=c[h];if(r){let g=p==="y"?"top":"left",w=p==="y"?"bottom":"right",y=u+d[g],b=u-d[w];u=Qt(y,u,b)}if(o){let g=h==="y"?"top":"left",w=h==="y"?"bottom":"right",y=f+d[g],b=f-d[w];f=Qt(y,f,b)}let m=a.fn({...t,[p]:u,[h]:f});return{...m,data:{x:m.x-e,y:m.y-i}}}}};function V(s){return pi(s)?(s.nodeName||"").toLowerCase():"#document"}function A(s){var t;return(s==null||(t=s.ownerDocument)==null?void 0:t.defaultView)||window}function L(s){var t;return(t=(pi(s)?s.ownerDocument:s.document)||window.document)==null?void 0:t.documentElement}function pi(s){return s instanceof Node||s instanceof A(s).Node}function F(s){return s instanceof Element||s instanceof A(s).Element}function R(s){return s instanceof HTMLElement||s instanceof A(s).HTMLElement}function fi(s){return typeof ShadowRoot=="undefined"?!1:s instanceof ShadowRoot||s instanceof A(s).ShadowRoot}function ht(s){let{overflow:t,overflowX:e,overflowY:i,display:n}=E(s);return/auto|scroll|overlay|hidden|clip/.test(t+i+e)&&!["inline","contents"].includes(n)}function mi(s){return["table","td","th"].includes(V(s))}function ie(s){let t=se(),e=E(s);return e.transform!=="none"||e.perspective!=="none"||(e.containerType?e.containerType!=="normal":!1)||!t&&(e.backdropFilter?e.backdropFilter!=="none":!1)||!t&&(e.filter?e.filter!=="none":!1)||["transform","perspective","filter"].some(i=>(e.willChange||"").includes(i))||["paint","layout","strict","content"].some(i=>(e.contain||"").includes(i))}function gi(s){let t=tt(s);for(;R(t)&&!Ot(t);){if(ie(t))return t;t=tt(t)}return null}function se(){return typeof CSS=="undefined"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Ot(s){return["html","body","#document"].includes(V(s))}function E(s){return A(s).getComputedStyle(s)}function It(s){return F(s)?{scrollLeft:s.scrollLeft,scrollTop:s.scrollTop}:{scrollLeft:s.pageXOffset,scrollTop:s.pageYOffset}}function tt(s){if(V(s)==="html")return s;let t=s.assignedSlot||s.parentNode||fi(s)&&s.host||L(s);return fi(t)?t.host:t}function wi(s){let t=tt(s);return Ot(t)?s.ownerDocument?s.ownerDocument.body:s.body:R(t)&&ht(t)?t:wi(t)}function ct(s,t,e){var i;t===void 0&&(t=[]),e===void 0&&(e=!0);let n=wi(s),r=n===((i=s.ownerDocument)==null?void 0:i.body),o=A(n);return r?t.concat(o,o.visualViewport||[],ht(n)?n:[],o.frameElement&&e?ct(o.frameElement):[]):t.concat(n,ct(n,[],e))}function vi(s){let t=E(s),e=parseFloat(t.width)||0,i=parseFloat(t.height)||0,n=R(s),r=n?s.offsetWidth:e,o=n?s.offsetHeight:i,a=Tt(e)!==r||Tt(i)!==o;return a&&(e=r,i=o),{width:e,height:i,$:a}}function Pe(s){return F(s)?s:s.contextElement}function ut(s){let t=Pe(s);if(!R(t))return N(1);let e=t.getBoundingClientRect(),{width:i,height:n,$:r}=vi(t),o=(r?Tt(e.width):e.width)/i,a=(r?Tt(e.height):e.height)/n;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}var Zi=N(0);function xi(s){let t=A(s);return!se()||!t.visualViewport?Zi:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Qi(s,t,e){return t===void 0&&(t=!1),!e||t&&e!==A(s)?!1:t}function et(s,t,e,i){t===void 0&&(t=!1),e===void 0&&(e=!1);let n=s.getBoundingClientRect(),r=Pe(s),o=N(1);t&&(i?F(i)&&(o=ut(i)):o=ut(s));let a=Qi(r,e,i)?xi(r):N(0),l=(n.left+a.x)/o.x,c=(n.top+a.y)/o.y,d=n.width/o.x,h=n.height/o.y;if(r){let p=A(r),u=i&&F(i)?A(i):i,f=p.frameElement;for(;f&&i&&u!==p;){let m=ut(f),g=f.getBoundingClientRect(),w=E(f),y=g.left+(f.clientLeft+parseFloat(w.paddingLeft))*m.x,b=g.top+(f.clientTop+parseFloat(w.paddingTop))*m.y;l*=m.x,c*=m.y,d*=m.x,h*=m.y,l+=y,c+=b,f=A(f).frameElement}}return G({width:d,height:h,x:l,y:c})}function Gi(s){let{rect:t,offsetParent:e,strategy:i}=s,n=R(e),r=L(e);if(e===r)return t;let o={scrollLeft:0,scrollTop:0},a=N(1),l=N(0);if((n||!n&&i!=="fixed")&&((V(e)!=="body"||ht(r))&&(o=It(e)),R(e))){let c=et(e);a=ut(e),l.x=c.x+e.clientLeft,l.y=c.y+e.clientTop}return{width:t.width*a.x,height:t.height*a.y,x:t.x*a.x-o.scrollLeft*a.x+l.x,y:t.y*a.y-o.scrollTop*a.y+l.y}}function ts(s){return Array.from(s.getClientRects())}function $i(s){return et(L(s)).left+It(s).scrollLeft}function es(s){let t=L(s),e=It(s),i=s.ownerDocument.body,n=W(t.scrollWidth,t.clientWidth,i.scrollWidth,i.clientWidth),r=W(t.scrollHeight,t.clientHeight,i.scrollHeight,i.clientHeight),o=-e.scrollLeft+$i(s),a=-e.scrollTop;return E(i).direction==="rtl"&&(o+=W(t.clientWidth,i.clientWidth)-n),{width:n,height:r,x:o,y:a}}function is(s,t){let e=A(s),i=L(s),n=e.visualViewport,r=i.clientWidth,o=i.clientHeight,a=0,l=0;if(n){r=n.width,o=n.height;let c=se();(!c||c&&t==="fixed")&&(a=n.offsetLeft,l=n.offsetTop)}return{width:r,height:o,x:a,y:l}}function ss(s,t){let e=et(s,!0,t==="fixed"),i=e.top+s.clientTop,n=e.left+s.clientLeft,r=R(s)?ut(s):N(1),o=s.clientWidth*r.x,a=s.clientHeight*r.y,l=n*r.x,c=i*r.y;return{width:o,height:a,x:l,y:c}}function yi(s,t,e){let i;if(t==="viewport")i=is(s,e);else if(t==="document")i=es(L(s));else if(F(t))i=ss(t,e);else{let n=xi(s);i={...t,x:t.x-n.x,y:t.y-n.y}}return G(i)}function Ai(s,t){let e=tt(s);return e===t||!F(e)||Ot(e)?!1:E(e).position==="fixed"||Ai(e,t)}function ns(s,t){let e=t.get(s);if(e)return e;let i=ct(s,[],!1).filter(a=>F(a)&&V(a)!=="body"),n=null,r=E(s).position==="fixed",o=r?tt(s):s;for(;F(o)&&!Ot(o);){let a=E(o),l=ie(o);!l&&a.position==="fixed"&&(n=null),(r?!l&&!n:!l&&a.position==="static"&&!!n&&["absolute","fixed"].includes(n.position)||ht(o)&&!l&&Ai(s,o))?i=i.filter(d=>d!==o):n=a,o=tt(o)}return t.set(s,i),i}function os(s){let{element:t,boundary:e,rootBoundary:i,strategy:n}=s,o=[...e==="clippingAncestors"?ns(t,this._c):[].concat(e),i],a=o[0],l=o.reduce((c,d)=>{let h=yi(t,d,n);return c.top=W(h.top,c.top),c.right=j(h.right,c.right),c.bottom=j(h.bottom,c.bottom),c.left=W(h.left,c.left),c},yi(t,a,n));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function rs(s){return vi(s)}function as(s,t,e){let i=R(t),n=L(t),r=e==="fixed",o=et(s,!0,r,t),a={scrollLeft:0,scrollTop:0},l=N(0);if(i||!i&&!r)if((V(t)!=="body"||ht(n))&&(a=It(t)),i){let c=et(t,!0,r,t);l.x=c.x+t.clientLeft,l.y=c.y+t.clientTop}else n&&(l.x=$i(n));return{x:o.left+a.scrollLeft-l.x,y:o.top+a.scrollTop-l.y,width:o.width,height:o.height}}function bi(s,t){return!R(s)||E(s).position==="fixed"?null:t?t(s):s.offsetParent}function Si(s,t){let e=A(s);if(!R(s))return e;let i=bi(s,t);for(;i&&mi(i)&&E(i).position==="static";)i=bi(i,t);return i&&(V(i)==="html"||V(i)==="body"&&E(i).position==="static"&&!ie(i))?e:i||gi(s)||e}var ls=async function(s){let{reference:t,floating:e,strategy:i}=s,n=this.getOffsetParent||Si,r=this.getDimensions;return{reference:as(t,await n(e),i),floating:{x:0,y:0,...await r(e)}}};function cs(s){return E(s).direction==="rtl"}var hs={convertOffsetParentRelativeRectToViewportRelativeRect:Gi,getDocumentElement:L,getClippingRect:os,getOffsetParent:Si,getElementRects:ls,getClientRects:ts,getDimensions:rs,getScale:ut,isElement:F,isRTL:cs};function us(s,t){let e=null,i,n=L(s);function r(){clearTimeout(i),e&&e.disconnect(),e=null}function o(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),r();let{left:c,top:d,width:h,height:p}=s.getBoundingClientRect();if(a||t(),!h||!p)return;let u=Rt(d),f=Rt(n.clientWidth-(c+h)),m=Rt(n.clientHeight-(d+p)),g=Rt(c),y={rootMargin:-u+"px "+-f+"px "+-m+"px "+-g+"px",threshold:W(0,j(1,l))||1},b=!0;function $(x){let T=x[0].intersectionRatio;if(T!==l){if(!b)return o();T?o(!1,T):i=setTimeout(()=>{o(!1,1e-7)},100)}b=!1}try{e=new IntersectionObserver($,{...y,root:n.ownerDocument})}catch(x){e=new IntersectionObserver($,y)}e.observe(s)}return o(!0),r}function Ci(s,t,e,i){i===void 0&&(i={});let{ancestorScroll:n=!0,ancestorResize:r=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=i,c=Pe(s),d=n||r?[...c?ct(c):[],...ct(t)]:[];d.forEach(w=>{n&&w.addEventListener("scroll",e,{passive:!0}),r&&w.addEventListener("resize",e)});let h=c&&a?us(c,e):null,p=-1,u=null;o&&(u=new ResizeObserver(w=>{let[y]=w;y&&y.target===c&&u&&(u.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{u&&u.observe(t)})),e()}),c&&!l&&u.observe(c),u.observe(t));let f,m=l?et(s):null;l&&g();function g(){let w=et(s);m&&(w.x!==m.x||w.y!==m.y||w.width!==m.width||w.height!==m.height)&&e(),m=w,f=requestAnimationFrame(g)}return e(),()=>{d.forEach(w=>{n&&w.removeEventListener("scroll",e),r&&w.removeEventListener("resize",e)}),h&&h(),u&&u.disconnect(),u=null,l&&cancelAnimationFrame(f)}}var Ei=(s,t,e)=>{let i=new Map,n={platform:hs,...e},r={...n.platform,_c:i};return di(s,t,{...n,platform:r})};var it=class{constructor(t){this._middleware=[];this._floating=!1;(this.host=t).addController(this)}hostConnected(){this.host.floating&&this.float(this.host.floating)}hostDisconnected(){this.destroy()}hostUpdated(){this.host.floating&&!this._floating&&this.float(this.host.floating),this._floating&&this.updatePosition()}hostResized(){this._floating&&this.updatePosition()}float(t){var l;if(this._floating)return;if(this._floating=!0,this._settings=t,this._reference=this.getReference(),this._resizeObserver=new ResizeObserver(()=>this.hostResized()),!this._settings)throw new Error("Floating settings are required");if(!this._reference)throw new Error("Floating reference is required");this.host.classList.add("wk-floating");let{position:e,arrow:i=!1,flip:n=!1,shift:r=!1,animationFrame:o=!1}=this._settings,a=this.getOffsetSetting();Object.assign(this.host.style,{position:(l=e.strategy)!=null?l:"absolute",top:"0",left:"0",transition:"none",transform:"translate3d(0,0,0)"}),e.inset&&!i?this._middleware.push(ee(({rects:c,placement:d})=>{var h,p,u,f,m,g;return d.includes("top")||d.includes("bottom")?{mainAxis:-c.floating.height-((h=a==null?void 0:a.mainAxis)!=null?h:0),crossAxis:(p=a==null?void 0:a.crossAxis)!=null?p:0,alignmentAxis:(u=a==null?void 0:a.alignmentAxis)!=null?u:0}:{mainAxis:-c.floating.width-((f=a==null?void 0:a.mainAxis)!=null?f:0),crossAxis:(m=a==null?void 0:a.crossAxis)!=null?m:0,alignmentAxis:(g=a==null?void 0:a.alignmentAxis)!=null?g:0}})):a&&this._middleware.push(ee(a)),n&&this._middleware.push(Ee()),r&&this._middleware.push(_e()),i&&(this.arrowEl=document.createElement("div"),this.arrowEl.classList.add("wk-arrow"),this._middleware.push(Ce({element:this.arrowEl}))),this.cleanupAutoUpdate=Ci(this._reference,this.host,()=>{this.updatePosition()},{animationFrame:o}),this._resizeObserver.observe(this.host)}getOffsetSetting(){var e,i;let t=(e=this._settings)==null?void 0:e.offset;if(!(!t||typeof t=="boolean"))return typeof t=="number"?{mainAxis:t,alignmentAxis:(i=this._settings)!=null&&i.position.inset?t:null}:t}destroy(){var t,e,i,n;this._floating&&(Object.assign(this.host.style,{position:"",top:"",left:"",transition:"",transform:""}),(e=(t=this.arrowEl)==null?void 0:t.parentElement)==null||e.removeChild(this.arrowEl),this.arrowEl=void 0,this._middleware=[],this.host.classList.remove("wk-floating"),(i=this.cleanupAutoUpdate)==null||i.call(this),(n=this._resizeObserver)==null||n.disconnect(),this._floating=!1)}updatePosition(){var i;if(!this._reference||!this._settings)return;let{strategy:t="absolute",placement:e="top"}=(i=this._settings.position)!=null?i:{};Ei(this._reference,this.host,{middleware:this._middleware,strategy:t,placement:e}).then(({x:n,y:r,placement:o,middlewareData:a})=>{if(a.arrow&&this.arrowEl){let{x:l,y:c}=a.arrow,d={top:"bottom",right:"left",bottom:"top",left:"right"}[o.split("-")[0]],h={bottom:"0deg",left:"90deg",top:"180deg",right:"270deg"}[o.split("-")[0]];Object.assign(this.arrowEl.style,{left:l!=null?`${l}px`:"",top:c!=null?`${c}px`:"",right:"",bottom:"",[d]:"-5px",transform:`rotate(${h})`})}Object.assign(this.host.style,{transform:`translate3d(${Math.round(n)}px,${Math.round(r)}px,0)`})})}getReference(){if(!this._settings)return;let t=this._settings.reference;if(typeof t=="string"){if(t==="viewport")return this.createViewportReference();let e=document.querySelector(t);if(!e)throw new Error(`Floating reference element (${t}) not found`);return e}return t.hasOwnProperty("element")?t.element:t}createViewportReference(){return{getBoundingClientRect(){var t,e,i,n;return{x:0,y:0,top:0,left:0,bottom:0,right:0,width:(e=(t=window.visualViewport)==null?void 0:t.width)!=null?e:0,height:(n=(i=window.visualViewport)==null?void 0:i.height)!=null?n:0}}}}};var Te=class{constructor(t){this.product=null;this.selectedVariant=null;this.selectedOptions={};this.hasSelection=!1;this.optionsWithValues=[];this.hasOnlyDefaultVariant=!1;(this.host=t).addController(this)}set submitting(t){var e;(e=this.host.querySelector("form"))==null||e.classList.toggle("wk-submitting",t)}get submitting(){var t,e;return(e=(t=this.host.querySelector("form"))==null?void 0:t.classList.contains("wk-submitting"))!=null?e:!1}setProduct({product:t,selectedVariantId:e,autoSelect:i=!1}){t!=null&&t.variants.length&&(this.product=t,this.initFormState({selectedVariantId:e,autoSelect:i}))}initFormState({selectedVariantId:t,autoSelect:e}){if(!this.product)throw new Error("Product not set");let i=this.initializedVariantId!==t?this.product.variants.find(r=>r.id===t):this.selectedVariant;this.initializedVariantId=t;let n=this.host.app.utils.product.getVariantOptions({variant:i});this.updateFormState({options:n,autoSelect:e})}updateFormState({options:t,change:e,autoSelect:i=!1}){if(!this.product)throw new Error("Product not set");let{hasSelection:n,optionsWithValues:r,selectedOptions:o,selectedVariant:a,hasOnlyDefaultVariant:l}=this.host.app.utils.product.getFormState({product:this.product,options:t,change:e,autoSelect:i});this.hasSelection=n,this.optionsWithValues=r,this.selectedOptions=o,this.selectedVariant=a,this.hasOnlyDefaultVariant=l,this.host.requestUpdate()}changeOption({input:t,autoSelect:e=!1}){if(!this.product)throw new Error("Product not set");let i=this.getInputOption(t);if(!i)throw new Error("Cannot parse options from input");this.updateFormState({options:this.selectedOptions,change:i,autoSelect:e})}addToCart({wishlistId:t,wishlistItemId:e,quantity:i,sectionsToRender:n,sectionsUrl:r="/"}){if(!this.selectedVariant)throw new Error("No variant selected");let o=this.host.querySelector("form");if(!o)throw new Error("Form not found");return this.submitting=!0,this.host.app.addToCart({wishlistId:t,wishlistItemId:e,variantId:this.selectedVariant.id,quantity:i!=null?i:this.host.app.utils.product.getFormQuantity({form:o}),properties:this.host.app.utils.product.getFormProperties({form:o}),sectionsToRender:n,sectionsUrl:r}).finally(()=>{this.submitting=!1})}getInputOption(t){if(!this.product)throw new Error("Product not set");return this.host.app.utils.product.getInputOption({input:t,product:this.product})}hostConnected(){}hostDisconnected(){}hostUpdate(){}hostUpdated(){}};var Re,_i=s=>(!!localStorage.getItem("debug")&&(Re=import("https://cdn.jsdelivr.net/npm/debug@4.3.4/+esm")),(e,...i)=>{Re&&Re.then(({default:n})=>{n(s)(e,...i)})});var ke=1,ds={shopify:`wk-shopify-v${ke}`,storefront:`wk-storefront-v${ke}`,wishlist:`wk-wishlist-v${ke}`};var fs=()=>{let s=_i("wk:cache"),t=Object.values(ds);caches.keys().then(e=>Promise.all(e.map(i=>{if(!t.includes(i))return s("Delete old cache",{cacheName:i}),caches.delete(i)})))};fs();var Mt,ne=class{constructor(t){wt(this,Mt,void 0);yt(this,Mt,t)}subscribe(t){let e=gt(this,Mt).call(this,new Oe(t));return new Ie(()=>{e==null||e()})}};Mt=new WeakMap;var Lt,Oe=class{constructor(t){wt(this,Lt,void 0);yt(this,Lt,t)}next(t){gt(this,Lt).call(this,t)}};Lt=new WeakMap;var Ft,Ie=class{constructor(t){wt(this,Ft,void 0);yt(this,Ft,t)}unsubscribe(){var t;(t=gt(this,Ft))==null||t.call(this)}};Ft=new WeakMap;var oe=class{constructor(t){this.stateConfig={loading:"eager"};this.state={};(this.host=t).addController(this)}get app(){if(!window.WishlistKing)throw new Error("Wishlist King SDK not initialized");return window.WishlistKing}get hostDataset(){return this.host.dataset?this.host.dataset:this.host.host?this.host.host.dataset:{}}hostConnected(){}hostDisconnected(){}parseStateConfig(t){var e;return{loading:(e=t.loading)!=null?e:"eager",wishlist:this.parseWishlistStateConfig(t),wishlistItem:this.parseWishlistItemStateConfig(t),productInfo:this.parseProductInfoStateConfig(t),cart:t.cart}}parseWishlistStateConfig({wishlist:t}){var i;let e=(i=this.hostDataset.wishlistId)!=null?i:"mine";if(t)return{params:{wishlistId:e}}}parseWishlistItemStateConfig({wishlistItem:t}){let{wishlistId:e="mine",wishlistItemId:i}=this.hostDataset;if(!(!t||!i))return{params:{wishlistId:e,wishlistItemId:i}}}parseProductInfoStateConfig({productInfo:t}){if(!t)return;let{wishlistId:e="mine",productHandle:i="",productId:n,variantId:r}=this.hostDataset;return{params:{wishlistId:e,productHandle:i,variantId:r?parseInt(r):void 0}}}observe(){return this.stateConfig=this.parseStateConfig(this.host.getStateConfig()),new ne(t=>{let e=i=>{this.state={...this.state,...i},t.next(this.state)};if(this.stateConfig.wishlist){let{wishlistId:i="mine"}=this.stateConfig.wishlist.params;this.app.state.observeWishlist({wishlistId:i}).subscribe(n=>e({wishlist:n}))}if(this.stateConfig.productInfo){let{productHandle:i,variantId:n}=this.stateConfig.productInfo.params;if(!i)throw new Error("Product handle is required");this.app.state.observeProductInfo({productHandle:i,variantId:n}).subscribe(r=>e({productInfo:r}))}if(this.stateConfig.wishlistItem){let{wishlistId:i,wishlistItemId:n}=this.stateConfig.wishlistItem.params;if(!i)throw new Error("Wishlist id is required");if(!n)throw new Error("Wishlist item id is required");this.app.state.observeWishlist({wishlistId:i}).subscribe(r=>e({wishlistItem:r.items.find(o=>o.id===n)}))}this.stateConfig.cart&&this.app.state.observeShopifyCart({cacheStrategy:"public, max-age=1, stale-while-revalidate=10"}).subscribe(i=>e({cart:i}))})}getFallback(){this.stateConfig=this.parseStateConfig(this.host.getStateConfig());let t={};if(this.stateConfig.wishlist){let{wishlistId:e="mine"}=this.stateConfig.wishlist.params;t.wishlist={id:e,isMine:e==="mine",numItems:0,items:[]}}if(this.stateConfig.productInfo){let{variantId:e=0,productHandle:i}=this.stateConfig.productInfo.params;t.productInfo={productId:0,variantId:e,productHandle:i,inWishlist:!1}}if(this.stateConfig.wishlistItem){let{wishlistId:e,wishlistItemId:i}=this.stateConfig.wishlistItem.params;if(!e)throw new Error("Wishlist id is required");if(!i)throw new Error("Wishlist item id is required");t.wishlistItem={id:i,product:{id:0,handle:"",variants:[]}}}return t}};var Ht=class extends ot{constructor(t){if(super(t),this.et=v,t.type!==qt.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===v||t==null)return this.vt=void 0,this.et=t;if(t===P)return t;if(typeof t!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.et)return this.vt;this.et=t;let e=[t];return e.raw=e,this.vt={_$litType$:this.constructor.resultType,strings:e,values:[]}}};Ht.directiveName="unsafeHTML",Ht.resultType=1;var Pi=Yt(Ht);var S=class extends U{constructor(){super(...arguments);this.lit=_t;this.unsafeHTML=Pi;this.repeat=Jt}};var re=class extends S{constructor(){super(...arguments);this.text="";this.hint="";this.selected=!1;this.disabled=!1;this.showIcon=!1;this.showText=!1;this.iconUnstyled=!1;this.fullWidth=!1;this.alignSelf="center";this.alignContent="center";this.floatingUi=new it(this);this.getCounterFloating=()=>{var i,n,r,o;if(!((i=this.counter)!=null&&i.floating))return;let e=((r=(n=this.counter)==null?void 0:n.floating)==null?void 0:r.reference)==="icon"?(o=this.iconElement)!=null?o:this:this;return{...this.counter.floating,reference:e}}}get iconElement(){return this.querySelector(".wk-icon")}render(){var r,o,a,l;let e=(r=this.alignSelf)!=null?r:"center",i=(o=this.alignContent)!=null?o:"center",n=["wk-button",`wk-align-${e}`,`wk-align-content-${i}`,this.selected&&"wk-selected",this.fullWidth&&"wk-full-width"].filter(c=>!!c).join(" ");return this.href?this.lit.html`
\f\r"'\`<>=]|("|')|))|$)`,"g"),Ke=/'/g,qe=/"/g,Qe=/^(?:script|style|textarea|title)$/i,Ge=s=>(t,...e)=>({_$litType$:s,strings:t,values:e}),Ni=Ge(1),Vi=Ge(2),P=Symbol.for("lit-noChange"),v=Symbol.for("lit-nothing"),Ye=new WeakMap,X=Z.createTreeWalker(Z,129);function ti(s,t){if(!Array.isArray(s)||!s.hasOwnProperty("raw"))throw Error("invalid template strings array");return Be!==void 0?Be.createHTML(t):t}var ei=(s,t)=>{let e=s.length-1,i=[],n,r=t===2?"<svg>":"",o=$t;for(let a=0;a<e;a++){let l=s[a],c,d,h=-1,p=0;for(;p<l.length&&(o.lastIndex=p,d=o.exec(l),d!==null);)p=o.lastIndex,o===$t?d[1]==="!--"?o=ze:d[1]!==void 0?o=je:d[2]!==void 0?(Qe.test(d[2])&&(n=RegExp("</"+d[2],"g")),o=Y):d[3]!==void 0&&(o=Y):o===Y?d[0]===">"?(o=n!=null?n:$t,h=-1):d[1]===void 0?h=-2:(h=o.lastIndex-d[2].length,c=d[1],o=d[3]===void 0?Y:d[3]==='"'?qe:Ke):o===qe||o===Ke?o=Y:o===ze||o===je?o=$t:(o=Y,n=void 0);let u=o===Y&&s[a+1].startsWith("/>")?" ":"";r+=o===$t?l+Wi:h>=0?(i.push(c),l.slice(0,h)+we+l.slice(h)+D+u):l+D+(h===-2?a:u)}return[ti(s,r+(s[e]||"<?>")+(t===2?"</svg>":"")),i]},Et=class s{constructor({strings:t,_$litType$:e},i){let n;this.parts=[];let r=0,o=0,a=t.length-1,l=this.parts,[c,d]=ei(t,e);if(this.el=s.createElement(c,i),X.currentNode=this.el.content,e===2){let h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(n=X.nextNode())!==null&&l.length<a;){if(n.nodeType===1){if(n.hasAttributes())for(let h of n.getAttributeNames())if(h.endsWith(we)){let p=d[o++],u=n.getAttribute(h).split(D),f=/([.?@])?(.*)/.exec(p);l.push({type:1,index:r,name:f[2],strings:u,ctor:f[1]==="."?Bt:f[1]==="?"?zt:f[1]==="@"?jt:Q}),n.removeAttribute(h)}else h.startsWith(D)&&(l.push({type:6,index:r}),n.removeAttribute(h));if(Qe.test(n.tagName)){let h=n.textContent.split(D),p=h.length-1;if(p>0){n.textContent=Nt?Nt.emptyScript:"";for(let u=0;u<p;u++)n.append(h[u],St()),X.nextNode(),l.push({type:2,index:++r});n.append(h[p],St())}}}else if(n.nodeType===8)if(n.data===ye)l.push({type:2,index:r});else{let h=-1;for(;(h=n.data.indexOf(D,h+1))!==-1;)l.push({type:7,index:r}),h+=D.length-1}r++}}static createElement(t,e){let i=Z.createElement("template");return i.innerHTML=t,i}};function J(s,t,e=s,i){var o,a,l;if(t===P)return t;let n=i!==void 0?(o=e._$Co)==null?void 0:o[i]:e._$Cl,r=Ct(t)?void 0:t._$litDirective$;return(n==null?void 0:n.constructor)!==r&&((a=n==null?void 0:n._$AO)==null||a.call(n,!1),r===void 0?n=void 0:(n=new r(s),n._$AT(s,e,i)),i!==void 0?((l=e._$Co)!=null?l:e._$Co=[])[i]=n:e._$Cl=n),n!==void 0&&(t=J(s,n._$AS(s,t.values),n,i)),t}var Vt=class{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){var c;let{el:{content:e},parts:i}=this._$AD,n=((c=t==null?void 0:t.creationScope)!=null?c:Z).importNode(e,!0);X.currentNode=n;let r=X.nextNode(),o=0,a=0,l=i[0];for(;l!==void 0;){if(o===l.index){let d;l.type===2?d=new nt(r,r.nextSibling,this,t):l.type===1?d=new l.ctor(r,l.name,l.strings,this,t):l.type===6&&(d=new Kt(r,this,t)),this._$AV.push(d),l=i[++a]}o!==(l==null?void 0:l.index)&&(r=X.nextNode(),o++)}return X.currentNode=Z,n}p(t){let e=0;for(let i of this._$AV)i!==void 0&&(i.strings!==void 0?(i._$AI(t,i,e),e+=i.strings.length-2):i._$AI(t[e])),e++}},nt=class s{get _$AU(){var t,e;return(e=(t=this._$AM)==null?void 0:t._$AU)!=null?e:this._$Cv}constructor(t,e,i,n){var r;this.type=2,this._$AH=v,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,this.options=n,this._$Cv=(r=n==null?void 0:n.isConnected)!=null?r:!0}get parentNode(){let t=this._$AA.parentNode,e=this._$AM;return e!==void 0&&(t==null?void 0:t.nodeType)===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=J(this,t,e),Ct(t)?t===v||t==null||t===""?(this._$AH!==v&&this._$AR(),this._$AH=v):t!==this._$AH&&t!==P&&this._(t):t._$litType$!==void 0?this.g(t):t.nodeType!==void 0?this.$(t):Je(t)?this.T(t):this._(t)}k(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}$(t){this._$AH!==t&&(this._$AR(),this._$AH=this.k(t))}_(t){this._$AH!==v&&Ct(this._$AH)?this._$AA.nextSibling.data=t:this.$(Z.createTextNode(t)),this._$AH=t}g(t){var r;let{values:e,_$litType$:i}=t,n=typeof i=="number"?this._$AC(t):(i.el===void 0&&(i.el=Et.createElement(ti(i.h,i.h[0]),this.options)),i);if(((r=this._$AH)==null?void 0:r._$AD)===n)this._$AH.p(e);else{let o=new Vt(n,this),a=o.u(this.options);o.p(e),this.$(a),this._$AH=o}}_$AC(t){let e=Ye.get(t.strings);return e===void 0&&Ye.set(t.strings,e=new Et(t)),e}T(t){Ze(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,i,n=0;for(let r of t)n===e.length?e.push(i=new s(this.k(St()),this.k(St()),this,this.options)):i=e[n],i._$AI(r),n++;n<e.length&&(this._$AR(i&&i._$AB.nextSibling,n),e.length=n)}_$AR(t=this._$AA.nextSibling,e){var i;for((i=this._$AP)==null?void 0:i.call(this,!1,!0,e);t&&t!==this._$AB;){let n=t.nextSibling;t.remove(),t=n}}setConnected(t){var e;this._$AM===void 0&&(this._$Cv=t,(e=this._$AP)==null||e.call(this,t))}},Q=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,i,n,r){this.type=1,this._$AH=v,this._$AN=void 0,this.element=t,this.name=e,this._$AM=n,this.options=r,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,n){let r=this.strings,o=!1;if(r===void 0)t=J(this,t,e,0),o=!Ct(t)||t!==this._$AH&&t!==P,o&&(this._$AH=t);else{let a=t,l,c;for(t=r[0],l=0;l<r.length-1;l++)c=J(this,a[i+l],e,l),c===P&&(c=this._$AH[l]),o||(o=!Ct(c)||c!==this._$AH[l]),c===v?t=v:t!==v&&(t+=(c!=null?c:"")+r[l+1]),this._$AH[l]=c}o&&!n&&this.O(t)}O(t){t===v?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t!=null?t:"")}},Bt=class extends Q{constructor(){super(...arguments),this.type=3}O(t){this.element[this.name]=t===v?void 0:t}},zt=class extends Q{constructor(){super(...arguments),this.type=4}O(t){this.element.toggleAttribute(this.name,!!t&&t!==v)}},jt=class extends Q{constructor(t,e,i,n,r){super(t,e,i,n,r),this.type=5}_$AI(t,e=this){var o;if((t=(o=J(this,t,e,0))!=null?o:v)===P)return;let i=this._$AH,n=t===v&&i!==v||t.capture!==i.capture||t.once!==i.once||t.passive!==i.passive,r=t!==v&&(i===v||n);n&&this.element.removeEventListener(this.name,this,i),r&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e,i;typeof this._$AH=="function"?this._$AH.call((i=(e=this.options)==null?void 0:e.host)!=null?i:this.element,t):this._$AH.handleEvent(t)}},Kt=class{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){J(this,t)}},be={j:we,P:D,A:ye,C:1,M:ei,L:Vt,R:Je,V:J,D:nt,I:Q,H:zt,N:jt,U:Bt,B:Kt},ge=At.litHtmlPolyfillSupport,Xe;ge==null||ge(Et,nt),((Xe=At.litHtmlVersions)!=null?Xe:At.litHtmlVersions=[]).push("3.1.0");var ve=(s,t,e)=>{var r,o;let i=(r=e==null?void 0:e.renderBefore)!=null?r:t,n=i._$litPart$;if(n===void 0){let a=(o=e==null?void 0:e.renderBefore)!=null?o:null;i._$litPart$=n=new nt(t.insertBefore(St(),a),a,void 0,e!=null?e:{})}return n._$AI(s),n};var U=class extends M{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e,i;let t=super.createRenderRoot();return(i=(e=this.renderOptions).renderBefore)!=null||(e.renderBefore=t.firstChild),t}update(t){let e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=ve(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),(t=this._$Do)==null||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this._$Do)==null||t.setConnected(!1)}render(){return P}},ii;U._$litElement$=!0,U.finalized=!0,(ii=globalThis.litElementHydrateSupport)==null||ii.call(globalThis,{LitElement:U});var xe=globalThis.litElementPolyfillSupport;xe==null||xe({LitElement:U});var Bi={_$AK:(s,t,e)=>{s._$AK(t,e)},_$AL:s=>s._$AL},si;((si=globalThis.litElementVersions)!=null?si:globalThis.litElementVersions=[]).push("4.0.2");var Cs=!1;var qt={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},Yt=s=>(...t)=>({_$litDirective$:s,values:t}),ot=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,i){this._$Ct=t,this._$AM=e,this._$Ci=i}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}};var{D:zi}=be;var ni=()=>document.createComment(""),rt=(s,t,e)=>{var r;let i=s._$AA.parentNode,n=t===void 0?s._$AB:t._$AA;if(e===void 0){let o=i.insertBefore(ni(),n),a=i.insertBefore(ni(),n);e=new zi(o,a,s,s.options)}else{let o=e._$AB.nextSibling,a=e._$AM,l=a!==s;if(l){let c;(r=e._$AQ)==null||r.call(e,s),e._$AM=s,e._$AP!==void 0&&(c=s._$AU)!==a._$AU&&e._$AP(c)}if(o!==n||l){let c=e._$AA;for(;c!==o;){let d=c.nextSibling;i.insertBefore(c,n),c=d}}}return e},z=(s,t,e=s)=>(s._$AI(t,e),s),ji={},oi=(s,t=ji)=>s._$AH=t,ri=s=>s._$AH,Xt=s=>{var i;(i=s._$AP)==null||i.call(s,!1,!0);let t=s._$AA,e=s._$AB.nextSibling;for(;t!==e;){let n=t.nextSibling;t.remove(),t=n}};var ai=(s,t,e)=>{let i=new Map;for(let n=t;n<=e;n++)i.set(s[n],n);return i},Zt=Yt(class extends ot{constructor(s){if(super(s),s.type!==qt.CHILD)throw Error("repeat() can only be used in text expressions")}ht(s,t,e){let i;e===void 0?e=t:t!==void 0&&(i=t);let n=[],r=[],o=0;for(let a of s)n[o]=i?i(a,o):o,r[o]=e(a,o),o++;return{values:r,keys:n}}render(s,t,e){return this.ht(s,t,e).values}update(s,[t,e,i]){var m;let n=ri(s),{values:r,keys:o}=this.ht(t,e,i);if(!Array.isArray(n))return this.dt=o,r;let a=(m=this.dt)!=null?m:this.dt=[],l=[],c,d,h=0,p=n.length-1,u=0,f=r.length-1;for(;h<=p&&u<=f;)if(n[h]===null)h++;else if(n[p]===null)p--;else if(a[h]===o[u])l[u]=z(n[h],r[u]),h++,u++;else if(a[p]===o[f])l[f]=z(n[p],r[f]),p--,f--;else if(a[h]===o[f])l[f]=z(n[h],r[f]),rt(s,l[f+1],n[h]),h++,f--;else if(a[p]===o[u])l[u]=z(n[p],r[u]),rt(s,n[h],n[p]),p--,u++;else if(c===void 0&&(c=ai(o,u,f),d=ai(a,h,p)),c.has(a[h]))if(c.has(a[p])){let g=d.get(o[u]),w=g!==void 0?n[g]:null;if(w===null){let y=rt(s,n[h]);z(y,r[u]),l[u]=y}else l[u]=z(w,r[u]),rt(s,n[h],w),n[g]=null;u++}else Xt(n[p]),p--;else Xt(n[h]),h++;for(;u<=f;){let g=rt(s,l[f+1]);z(g,r[u]),l[u++]=g}for(;h<=p;){let g=n[h++];g!==null&&Xt(g)}return this.dt=o,oi(s,l),P}});var j=Math.min,W=Math.max,Tt=Math.round,Rt=Math.floor,N=s=>({x:s,y:s}),Ki={left:"right",right:"left",bottom:"top",top:"bottom"},qi={start:"end",end:"start"};function Qt(s,t,e){return W(s,j(t,e))}function at(s,t){return typeof s=="function"?s(t):s}function K(s){return s.split("-")[0]}function lt(s){return s.split("-")[1]}function $e(s){return s==="x"?"y":"x"}function Gt(s){return s==="y"?"height":"width"}function kt(s){return["top","bottom"].includes(K(s))?"y":"x"}function te(s){return $e(kt(s))}function li(s,t,e){e===void 0&&(e=!1);let i=lt(s),n=te(s),r=Gt(n),o=n==="x"?i===(e?"end":"start")?"right":"left":i==="start"?"bottom":"top";return t.reference[r]>t.floating[r]&&(o=Pt(o)),[o,Pt(o)]}function ci(s){let t=Pt(s);return[Jt(s),t,Jt(t)]}function Jt(s){return s.replace(/start|end/g,t=>qi[t])}function Yi(s,t,e){let i=["left","right"],n=["right","left"],r=["top","bottom"],o=["bottom","top"];switch(s){case"top":case"bottom":return e?t?n:i:t?i:n;case"left":case"right":return t?r:o;default:return[]}}function hi(s,t,e,i){let n=lt(s),r=Yi(K(s),e==="start",i);return n&&(r=r.map(o=>o+"-"+n),t&&(r=r.concat(r.map(Jt)))),r}function Pt(s){return s.replace(/left|right|bottom|top/g,t=>Ki[t])}function Xi(s){return{top:0,right:0,bottom:0,left:0,...s}}function Ae(s){return typeof s!="number"?Xi(s):{top:s,right:s,bottom:s,left:s}}function G(s){return{...s,top:s.y,left:s.x,right:s.x+s.width,bottom:s.y+s.height}}function ui(s,t,e){let{reference:i,floating:n}=s,r=kt(t),o=te(t),a=Gt(o),l=K(t),c=r==="y",d=i.x+i.width/2-n.width/2,h=i.y+i.height/2-n.height/2,p=i[a]/2-n[a]/2,u;switch(l){case"top":u={x:d,y:i.y-n.height};break;case"bottom":u={x:d,y:i.y+i.height};break;case"right":u={x:i.x+i.width,y:h};break;case"left":u={x:i.x-n.width,y:h};break;default:u={x:i.x,y:i.y}}switch(lt(t)){case"start":u[o]-=p*(e&&c?-1:1);break;case"end":u[o]+=p*(e&&c?-1:1);break}return u}var di=async(s,t,e)=>{let{placement:i="bottom",strategy:n="absolute",middleware:r=[],platform:o}=e,a=r.filter(Boolean),l=await(o.isRTL==null?void 0:o.isRTL(t)),c=await o.getElementRects({reference:s,floating:t,strategy:n}),{x:d,y:h}=ui(c,i,l),p=i,u={},f=0;for(let m=0;m<a.length;m++){let{name:g,fn:w}=a[m],{x:y,y:b,data:$,reset:x}=await w({x:d,y:h,initialPlacement:i,placement:p,strategy:n,middlewareData:u,rects:c,platform:o,elements:{reference:s,floating:t}});if(d=y!=null?y:d,h=b!=null?b:h,u={...u,[g]:{...u[g],...$}},x&&f<=50){f++,typeof x=="object"&&(x.placement&&(p=x.placement),x.rects&&(c=x.rects===!0?await o.getElementRects({reference:s,floating:t,strategy:n}):x.rects),{x:d,y:h}=ui(c,p,l)),m=-1;continue}}return{x:d,y:h,placement:p,strategy:n,middlewareData:u}};async function Se(s,t){var e;t===void 0&&(t={});let{x:i,y:n,platform:r,rects:o,elements:a,strategy:l}=s,{boundary:c="clippingAncestors",rootBoundary:d="viewport",elementContext:h="floating",altBoundary:p=!1,padding:u=0}=at(t,s),f=Ae(u),g=a[p?h==="floating"?"reference":"floating":h],w=G(await r.getClippingRect({element:(e=await(r.isElement==null?void 0:r.isElement(g)))==null||e?g:g.contextElement||await(r.getDocumentElement==null?void 0:r.getDocumentElement(a.floating)),boundary:c,rootBoundary:d,strategy:l})),y=h==="floating"?{...o.floating,x:i,y:n}:o.reference,b=await(r.getOffsetParent==null?void 0:r.getOffsetParent(a.floating)),$=await(r.isElement==null?void 0:r.isElement(b))?await(r.getScale==null?void 0:r.getScale(b))||{x:1,y:1}:{x:1,y:1},x=G(r.convertOffsetParentRelativeRectToViewportRelativeRect?await r.convertOffsetParentRelativeRectToViewportRelativeRect({rect:y,offsetParent:b,strategy:l}):y);return{top:(w.top-x.top+f.top)/$.y,bottom:(x.bottom-w.bottom+f.bottom)/$.y,left:(w.left-x.left+f.left)/$.x,right:(x.right-w.right+f.right)/$.x}}var Ce=s=>({name:"arrow",options:s,async fn(t){let{x:e,y:i,placement:n,rects:r,platform:o,elements:a,middlewareData:l}=t,{element:c,padding:d=0}=at(s,t)||{};if(c==null)return{};let h=Ae(d),p={x:e,y:i},u=te(n),f=Gt(u),m=await o.getDimensions(c),g=u==="y",w=g?"top":"left",y=g?"bottom":"right",b=g?"clientHeight":"clientWidth",$=r.reference[f]+r.reference[u]-p[u]-r.floating[f],x=p[u]-r.reference[u],T=await(o.getOffsetParent==null?void 0:o.getOffsetParent(c)),k=T?T[b]:0;(!k||!await(o.isElement==null?void 0:o.isElement(T)))&&(k=a.floating[b]||r.floating[f]);let q=$/2-x/2,dt=k/2-m[f]/2-1,ft=j(h[w],dt),pt=j(h[y],dt),_=ft,mt=k-m[f]-pt,C=k/2-m[f]/2+q,O=Qt(_,C,mt),I=!l.arrow&&lt(n)!=null&&C!=O&&r.reference[f]/2-(C<_?ft:pt)-m[f]/2<0,H=I?C<_?C-_:C-mt:0;return{[u]:p[u]+H,data:{[u]:O,centerOffset:C-O-H,...I&&{alignmentOffset:H}},reset:I}}});var Ee=function(s){return s===void 0&&(s={}),{name:"flip",options:s,async fn(t){var e,i;let{placement:n,middlewareData:r,rects:o,initialPlacement:a,platform:l,elements:c}=t,{mainAxis:d=!0,crossAxis:h=!0,fallbackPlacements:p,fallbackStrategy:u="bestFit",fallbackAxisSideDirection:f="none",flipAlignment:m=!0,...g}=at(s,t);if((e=r.arrow)!=null&&e.alignmentOffset)return{};let w=K(n),y=K(a)===a,b=await(l.isRTL==null?void 0:l.isRTL(c.floating)),$=p||(y||!m?[Pt(a)]:ci(a));!p&&f!=="none"&&$.push(...hi(a,m,f,b));let x=[a,...$],T=await Se(t,g),k=[],q=((i=r.flip)==null?void 0:i.overflows)||[];if(d&&k.push(T[w]),h){let _=li(n,o,b);k.push(T[_[0]],T[_[1]])}if(q=[...q,{placement:n,overflows:k}],!k.every(_=>_<=0)){var dt,ft;let _=(((dt=r.flip)==null?void 0:dt.index)||0)+1,mt=x[_];if(mt)return{data:{index:_,overflows:q},reset:{placement:mt}};let C=(ft=q.filter(O=>O.overflows[0]<=0).sort((O,I)=>O.overflows[1]-I.overflows[1])[0])==null?void 0:ft.placement;if(!C)switch(u){case"bestFit":{var pt;let O=(pt=q.map(I=>[I.placement,I.overflows.filter(H=>H>0).reduce((H,Ri)=>H+Ri,0)]).sort((I,H)=>I[1]-H[1])[0])==null?void 0:pt[0];O&&(C=O);break}case"initialPlacement":C=a;break}if(n!==C)return{reset:{placement:C}}}return{}}}};async function Zi(s,t){let{placement:e,platform:i,elements:n}=s,r=await(i.isRTL==null?void 0:i.isRTL(n.floating)),o=K(e),a=lt(e),l=kt(e)==="y",c=["left","top"].includes(o)?-1:1,d=r&&l?-1:1,h=at(t,s),{mainAxis:p,crossAxis:u,alignmentAxis:f}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...h};return a&&typeof f=="number"&&(u=a==="end"?f*-1:f),l?{x:u*d,y:p*c}:{x:p*c,y:u*d}}var ee=function(s){return s===void 0&&(s=0),{name:"offset",options:s,async fn(t){var e,i;let{x:n,y:r,placement:o,middlewareData:a}=t,l=await Zi(t,s);return o===((e=a.offset)==null?void 0:e.placement)&&(i=a.arrow)!=null&&i.alignmentOffset?{}:{x:n+l.x,y:r+l.y,data:{...l,placement:o}}}}},_e=function(s){return s===void 0&&(s={}),{name:"shift",options:s,async fn(t){let{x:e,y:i,placement:n}=t,{mainAxis:r=!0,crossAxis:o=!1,limiter:a={fn:g=>{let{x:w,y}=g;return{x:w,y}}},...l}=at(s,t),c={x:e,y:i},d=await Se(t,l),h=kt(K(n)),p=$e(h),u=c[p],f=c[h];if(r){let g=p==="y"?"top":"left",w=p==="y"?"bottom":"right",y=u+d[g],b=u-d[w];u=Qt(y,u,b)}if(o){let g=h==="y"?"top":"left",w=h==="y"?"bottom":"right",y=f+d[g],b=f-d[w];f=Qt(y,f,b)}let m=a.fn({...t,[p]:u,[h]:f});return{...m,data:{x:m.x-e,y:m.y-i}}}}};function V(s){return pi(s)?(s.nodeName||"").toLowerCase():"#document"}function A(s){var t;return(s==null||(t=s.ownerDocument)==null?void 0:t.defaultView)||window}function L(s){var t;return(t=(pi(s)?s.ownerDocument:s.document)||window.document)==null?void 0:t.documentElement}function pi(s){return s instanceof Node||s instanceof A(s).Node}function F(s){return s instanceof Element||s instanceof A(s).Element}function R(s){return s instanceof HTMLElement||s instanceof A(s).HTMLElement}function fi(s){return typeof ShadowRoot=="undefined"?!1:s instanceof ShadowRoot||s instanceof A(s).ShadowRoot}function ht(s){let{overflow:t,overflowX:e,overflowY:i,display:n}=E(s);return/auto|scroll|overlay|hidden|clip/.test(t+i+e)&&!["inline","contents"].includes(n)}function mi(s){return["table","td","th"].includes(V(s))}function ie(s){let t=se(),e=E(s);return e.transform!=="none"||e.perspective!=="none"||(e.containerType?e.containerType!=="normal":!1)||!t&&(e.backdropFilter?e.backdropFilter!=="none":!1)||!t&&(e.filter?e.filter!=="none":!1)||["transform","perspective","filter"].some(i=>(e.willChange||"").includes(i))||["paint","layout","strict","content"].some(i=>(e.contain||"").includes(i))}function gi(s){let t=tt(s);for(;R(t)&&!Ot(t);){if(ie(t))return t;t=tt(t)}return null}function se(){return typeof CSS=="undefined"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Ot(s){return["html","body","#document"].includes(V(s))}function E(s){return A(s).getComputedStyle(s)}function It(s){return F(s)?{scrollLeft:s.scrollLeft,scrollTop:s.scrollTop}:{scrollLeft:s.pageXOffset,scrollTop:s.pageYOffset}}function tt(s){if(V(s)==="html")return s;let t=s.assignedSlot||s.parentNode||fi(s)&&s.host||L(s);return fi(t)?t.host:t}function wi(s){let t=tt(s);return Ot(t)?s.ownerDocument?s.ownerDocument.body:s.body:R(t)&&ht(t)?t:wi(t)}function ct(s,t,e){var i;t===void 0&&(t=[]),e===void 0&&(e=!0);let n=wi(s),r=n===((i=s.ownerDocument)==null?void 0:i.body),o=A(n);return r?t.concat(o,o.visualViewport||[],ht(n)?n:[],o.frameElement&&e?ct(o.frameElement):[]):t.concat(n,ct(n,[],e))}function vi(s){let t=E(s),e=parseFloat(t.width)||0,i=parseFloat(t.height)||0,n=R(s),r=n?s.offsetWidth:e,o=n?s.offsetHeight:i,a=Tt(e)!==r||Tt(i)!==o;return a&&(e=r,i=o),{width:e,height:i,$:a}}function Pe(s){return F(s)?s:s.contextElement}function ut(s){let t=Pe(s);if(!R(t))return N(1);let e=t.getBoundingClientRect(),{width:i,height:n,$:r}=vi(t),o=(r?Tt(e.width):e.width)/i,a=(r?Tt(e.height):e.height)/n;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}var Ji=N(0);function xi(s){let t=A(s);return!se()||!t.visualViewport?Ji:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Qi(s,t,e){return t===void 0&&(t=!1),!e||t&&e!==A(s)?!1:t}function et(s,t,e,i){t===void 0&&(t=!1),e===void 0&&(e=!1);let n=s.getBoundingClientRect(),r=Pe(s),o=N(1);t&&(i?F(i)&&(o=ut(i)):o=ut(s));let a=Qi(r,e,i)?xi(r):N(0),l=(n.left+a.x)/o.x,c=(n.top+a.y)/o.y,d=n.width/o.x,h=n.height/o.y;if(r){let p=A(r),u=i&&F(i)?A(i):i,f=p.frameElement;for(;f&&i&&u!==p;){let m=ut(f),g=f.getBoundingClientRect(),w=E(f),y=g.left+(f.clientLeft+parseFloat(w.paddingLeft))*m.x,b=g.top+(f.clientTop+parseFloat(w.paddingTop))*m.y;l*=m.x,c*=m.y,d*=m.x,h*=m.y,l+=y,c+=b,f=A(f).frameElement}}return G({width:d,height:h,x:l,y:c})}function Gi(s){let{rect:t,offsetParent:e,strategy:i}=s,n=R(e),r=L(e);if(e===r)return t;let o={scrollLeft:0,scrollTop:0},a=N(1),l=N(0);if((n||!n&&i!=="fixed")&&((V(e)!=="body"||ht(r))&&(o=It(e)),R(e))){let c=et(e);a=ut(e),l.x=c.x+e.clientLeft,l.y=c.y+e.clientTop}return{width:t.width*a.x,height:t.height*a.y,x:t.x*a.x-o.scrollLeft*a.x+l.x,y:t.y*a.y-o.scrollTop*a.y+l.y}}function ts(s){return Array.from(s.getClientRects())}function $i(s){return et(L(s)).left+It(s).scrollLeft}function es(s){let t=L(s),e=It(s),i=s.ownerDocument.body,n=W(t.scrollWidth,t.clientWidth,i.scrollWidth,i.clientWidth),r=W(t.scrollHeight,t.clientHeight,i.scrollHeight,i.clientHeight),o=-e.scrollLeft+$i(s),a=-e.scrollTop;return E(i).direction==="rtl"&&(o+=W(t.clientWidth,i.clientWidth)-n),{width:n,height:r,x:o,y:a}}function is(s,t){let e=A(s),i=L(s),n=e.visualViewport,r=i.clientWidth,o=i.clientHeight,a=0,l=0;if(n){r=n.width,o=n.height;let c=se();(!c||c&&t==="fixed")&&(a=n.offsetLeft,l=n.offsetTop)}return{width:r,height:o,x:a,y:l}}function ss(s,t){let e=et(s,!0,t==="fixed"),i=e.top+s.clientTop,n=e.left+s.clientLeft,r=R(s)?ut(s):N(1),o=s.clientWidth*r.x,a=s.clientHeight*r.y,l=n*r.x,c=i*r.y;return{width:o,height:a,x:l,y:c}}function yi(s,t,e){let i;if(t==="viewport")i=is(s,e);else if(t==="document")i=es(L(s));else if(F(t))i=ss(t,e);else{let n=xi(s);i={...t,x:t.x-n.x,y:t.y-n.y}}return G(i)}function Ai(s,t){let e=tt(s);return e===t||!F(e)||Ot(e)?!1:E(e).position==="fixed"||Ai(e,t)}function ns(s,t){let e=t.get(s);if(e)return e;let i=ct(s,[],!1).filter(a=>F(a)&&V(a)!=="body"),n=null,r=E(s).position==="fixed",o=r?tt(s):s;for(;F(o)&&!Ot(o);){let a=E(o),l=ie(o);!l&&a.position==="fixed"&&(n=null),(r?!l&&!n:!l&&a.position==="static"&&!!n&&["absolute","fixed"].includes(n.position)||ht(o)&&!l&&Ai(s,o))?i=i.filter(d=>d!==o):n=a,o=tt(o)}return t.set(s,i),i}function os(s){let{element:t,boundary:e,rootBoundary:i,strategy:n}=s,o=[...e==="clippingAncestors"?ns(t,this._c):[].concat(e),i],a=o[0],l=o.reduce((c,d)=>{let h=yi(t,d,n);return c.top=W(h.top,c.top),c.right=j(h.right,c.right),c.bottom=j(h.bottom,c.bottom),c.left=W(h.left,c.left),c},yi(t,a,n));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function rs(s){return vi(s)}function as(s,t,e){let i=R(t),n=L(t),r=e==="fixed",o=et(s,!0,r,t),a={scrollLeft:0,scrollTop:0},l=N(0);if(i||!i&&!r)if((V(t)!=="body"||ht(n))&&(a=It(t)),i){let c=et(t,!0,r,t);l.x=c.x+t.clientLeft,l.y=c.y+t.clientTop}else n&&(l.x=$i(n));return{x:o.left+a.scrollLeft-l.x,y:o.top+a.scrollTop-l.y,width:o.width,height:o.height}}function bi(s,t){return!R(s)||E(s).position==="fixed"?null:t?t(s):s.offsetParent}function Si(s,t){let e=A(s);if(!R(s))return e;let i=bi(s,t);for(;i&&mi(i)&&E(i).position==="static";)i=bi(i,t);return i&&(V(i)==="html"||V(i)==="body"&&E(i).position==="static"&&!ie(i))?e:i||gi(s)||e}var ls=async function(s){let{reference:t,floating:e,strategy:i}=s,n=this.getOffsetParent||Si,r=this.getDimensions;return{reference:as(t,await n(e),i),floating:{x:0,y:0,...await r(e)}}};function cs(s){return E(s).direction==="rtl"}var hs={convertOffsetParentRelativeRectToViewportRelativeRect:Gi,getDocumentElement:L,getClippingRect:os,getOffsetParent:Si,getElementRects:ls,getClientRects:ts,getDimensions:rs,getScale:ut,isElement:F,isRTL:cs};function us(s,t){let e=null,i,n=L(s);function r(){clearTimeout(i),e&&e.disconnect(),e=null}function o(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),r();let{left:c,top:d,width:h,height:p}=s.getBoundingClientRect();if(a||t(),!h||!p)return;let u=Rt(d),f=Rt(n.clientWidth-(c+h)),m=Rt(n.clientHeight-(d+p)),g=Rt(c),y={rootMargin:-u+"px "+-f+"px "+-m+"px "+-g+"px",threshold:W(0,j(1,l))||1},b=!0;function $(x){let T=x[0].intersectionRatio;if(T!==l){if(!b)return o();T?o(!1,T):i=setTimeout(()=>{o(!1,1e-7)},100)}b=!1}try{e=new IntersectionObserver($,{...y,root:n.ownerDocument})}catch(x){e=new IntersectionObserver($,y)}e.observe(s)}return o(!0),r}function Ci(s,t,e,i){i===void 0&&(i={});let{ancestorScroll:n=!0,ancestorResize:r=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=i,c=Pe(s),d=n||r?[...c?ct(c):[],...ct(t)]:[];d.forEach(w=>{n&&w.addEventListener("scroll",e,{passive:!0}),r&&w.addEventListener("resize",e)});let h=c&&a?us(c,e):null,p=-1,u=null;o&&(u=new ResizeObserver(w=>{let[y]=w;y&&y.target===c&&u&&(u.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{u&&u.observe(t)})),e()}),c&&!l&&u.observe(c),u.observe(t));let f,m=l?et(s):null;l&&g();function g(){let w=et(s);m&&(w.x!==m.x||w.y!==m.y||w.width!==m.width||w.height!==m.height)&&e(),m=w,f=requestAnimationFrame(g)}return e(),()=>{d.forEach(w=>{n&&w.removeEventListener("scroll",e),r&&w.removeEventListener("resize",e)}),h&&h(),u&&u.disconnect(),u=null,l&&cancelAnimationFrame(f)}}var Ei=(s,t,e)=>{let i=new Map,n={platform:hs,...e},r={...n.platform,_c:i};return di(s,t,{...n,platform:r})};var it=class{constructor(t){this._middleware=[];this._floating=!1;(this.host=t).addController(this)}hostConnected(){this.host.floating&&this.float(this.host.floating)}hostDisconnected(){this.destroy()}hostUpdated(){this.host.floating&&!this._floating&&this.float(this.host.floating),this._floating&&this.updatePosition()}hostResized(){this._floating&&this.updatePosition()}float(t){var l;if(this._floating)return;if(this._floating=!0,this._settings=t,this._reference=this.getReference(),this._resizeObserver=new ResizeObserver(()=>this.hostResized()),!this._settings)throw new Error("Floating settings are required");if(!this._reference)throw new Error("Floating reference is required");this.host.classList.add("wk-floating");let{position:e,arrow:i=!1,flip:n=!1,shift:r=!1,animationFrame:o=!1}=this._settings,a=this.getOffsetSetting();Object.assign(this.host.style,{position:(l=e.strategy)!=null?l:"absolute",top:"0",left:"0",transition:"none",transform:"translate3d(0,0,0)"}),e.inset&&!i?this._middleware.push(ee(({rects:c,placement:d})=>{var h,p,u,f,m,g;return d.includes("top")||d.includes("bottom")?{mainAxis:-c.floating.height-((h=a==null?void 0:a.mainAxis)!=null?h:0),crossAxis:(p=a==null?void 0:a.crossAxis)!=null?p:0,alignmentAxis:(u=a==null?void 0:a.alignmentAxis)!=null?u:0}:{mainAxis:-c.floating.width-((f=a==null?void 0:a.mainAxis)!=null?f:0),crossAxis:(m=a==null?void 0:a.crossAxis)!=null?m:0,alignmentAxis:(g=a==null?void 0:a.alignmentAxis)!=null?g:0}})):a&&this._middleware.push(ee(a)),n&&this._middleware.push(Ee()),r&&this._middleware.push(_e()),i&&(this.arrowEl=document.createElement("div"),this.arrowEl.classList.add("wk-arrow"),this._middleware.push(Ce({element:this.arrowEl}))),this.cleanupAutoUpdate=Ci(this._reference,this.host,()=>{this.updatePosition()},{animationFrame:o}),this._resizeObserver.observe(this.host)}getOffsetSetting(){var e,i;let t=(e=this._settings)==null?void 0:e.offset;if(!(!t||typeof t=="boolean"))return typeof t=="number"?{mainAxis:t,alignmentAxis:(i=this._settings)!=null&&i.position.inset?t:null}:t}destroy(){var t,e,i,n;this._floating&&(Object.assign(this.host.style,{position:"",top:"",left:"",transition:"",transform:""}),(e=(t=this.arrowEl)==null?void 0:t.parentElement)==null||e.removeChild(this.arrowEl),this.arrowEl=void 0,this._middleware=[],this.host.classList.remove("wk-floating"),(i=this.cleanupAutoUpdate)==null||i.call(this),(n=this._resizeObserver)==null||n.disconnect(),this._floating=!1)}updatePosition(){var i;if(!this._reference||!this._settings)return;let{strategy:t="absolute",placement:e="top"}=(i=this._settings.position)!=null?i:{};Ei(this._reference,this.host,{middleware:this._middleware,strategy:t,placement:e}).then(({x:n,y:r,placement:o,middlewareData:a})=>{if(a.arrow&&this.arrowEl){let{x:l,y:c}=a.arrow,d={top:"bottom",right:"left",bottom:"top",left:"right"}[o.split("-")[0]],h={bottom:"0deg",left:"90deg",top:"180deg",right:"270deg"}[o.split("-")[0]];Object.assign(this.arrowEl.style,{left:l!=null?`${l}px`:"",top:c!=null?`${c}px`:"",right:"",bottom:"",[d]:"-5px",transform:`rotate(${h})`})}Object.assign(this.host.style,{transform:`translate3d(${Math.round(n)}px,${Math.round(r)}px,0)`})})}getReference(){if(!this._settings)return;let t=this._settings.reference;if(typeof t=="string"){if(t==="viewport")return this.createViewportReference();let e=document.querySelector(t);if(!e)throw new Error(`Floating reference element (${t}) not found`);return e}return t.hasOwnProperty("element")?t.element:t}createViewportReference(){return{getBoundingClientRect(){var t,e,i,n;return{x:0,y:0,top:0,left:0,bottom:0,right:0,width:(e=(t=window.visualViewport)==null?void 0:t.width)!=null?e:0,height:(n=(i=window.visualViewport)==null?void 0:i.height)!=null?n:0}}}}};var Te=class{constructor(t){this.product=null;this.selectedVariant=null;this.selectedOptions={};this.hasSelection=!1;this.optionsWithValues=[];this.hasOnlyDefaultVariant=!1;(this.host=t).addController(this)}set submitting(t){var e;(e=this.host.querySelector("form"))==null||e.classList.toggle("wk-submitting",t)}get submitting(){var t,e;return(e=(t=this.host.querySelector("form"))==null?void 0:t.classList.contains("wk-submitting"))!=null?e:!1}setProduct({product:t,selectedVariantId:e,autoSelect:i=!1}){t!=null&&t.variants.length&&(this.product=t,this.initFormState({selectedVariantId:e,autoSelect:i}))}initFormState({selectedVariantId:t,autoSelect:e}){if(!this.product)throw new Error("Product not set");let i=this.initializedVariantId!==t?this.product.variants.find(r=>r.id===t):this.selectedVariant;this.initializedVariantId=t;let n=this.host.app.utils.product.getVariantOptions({variant:i});this.updateFormState({options:n,autoSelect:e})}updateFormState({options:t,change:e,autoSelect:i=!1}){if(!this.product)throw new Error("Product not set");let{hasSelection:n,optionsWithValues:r,selectedOptions:o,selectedVariant:a,hasOnlyDefaultVariant:l}=this.host.app.utils.product.getFormState({product:this.product,options:t,change:e,autoSelect:i});this.hasSelection=n,this.optionsWithValues=r,this.selectedOptions=o,this.selectedVariant=a,this.hasOnlyDefaultVariant=l,this.host.requestUpdate()}changeOption({input:t,autoSelect:e=!1}){if(!this.product)throw new Error("Product not set");let i=this.getInputOption(t);if(!i)throw new Error("Cannot parse options from input");this.updateFormState({options:this.selectedOptions,change:i,autoSelect:e})}addToCart({wishlistId:t,wishlistItemId:e,quantity:i,sectionsToRender:n,sectionsUrl:r="/"}){if(!this.selectedVariant)throw new Error("No variant selected");let o=this.host.querySelector("form");if(!o)throw new Error("Form not found");return this.submitting=!0,this.host.app.addToCart({wishlistId:t,wishlistItemId:e,variantId:this.selectedVariant.id,quantity:i!=null?i:this.host.app.utils.product.getFormQuantity({form:o}),properties:this.host.app.utils.product.getFormProperties({form:o}),sectionsToRender:n,sectionsUrl:r}).finally(()=>{this.submitting=!1})}getInputOption(t){if(!this.product)throw new Error("Product not set");return this.host.app.utils.product.getInputOption({input:t,product:this.product})}hostConnected(){}hostDisconnected(){}hostUpdate(){}hostUpdated(){}};var Re,_i=s=>(!!localStorage.getItem("debug")&&(Re=import("https://cdn.jsdelivr.net/npm/debug@4.3.4/+esm")),(e,...i)=>{Re&&Re.then(({default:n})=>{n(s)(e,...i)})});var ke=1,ds={shopify:`wk-shopify-v${ke}`,storefront:`wk-storefront-v${ke}`,wishlist:`wk-wishlist-v${ke}`};var fs=()=>{let s=_i("wk:cache"),t=Object.values(ds);caches.keys().then(e=>Promise.all(e.map(i=>{if(!t.includes(i))return s("Delete old cache",{cacheName:i}),caches.delete(i)})))};fs();var Mt,ne=class{constructor(t){wt(this,Mt,void 0);yt(this,Mt,t)}subscribe(t){let e=gt(this,Mt).call(this,new Oe(t));return new Ie(()=>{e==null||e()})}};Mt=new WeakMap;var Lt,Oe=class{constructor(t){wt(this,Lt,void 0);yt(this,Lt,t)}next(t){gt(this,Lt).call(this,t)}};Lt=new WeakMap;var Ft,Ie=class{constructor(t){wt(this,Ft,void 0);yt(this,Ft,t)}unsubscribe(){var t;(t=gt(this,Ft))==null||t.call(this)}};Ft=new WeakMap;var oe=class{constructor(t){this.stateConfig={loading:"eager"};this.state={};(this.host=t).addController(this)}get app(){if(!window.WishlistKing)throw new Error("Wishlist King SDK not initialized");return window.WishlistKing}get hostDataset(){return this.host.dataset?this.host.dataset:this.host.host?this.host.host.dataset:{}}hostConnected(){}hostDisconnected(){}parseStateConfig(t){var e;return{loading:(e=t.loading)!=null?e:"eager",wishlist:this.parseWishlistStateConfig(t),wishlistItem:this.parseWishlistItemStateConfig(t),productInfo:this.parseProductInfoStateConfig(t),cart:t.cart}}parseWishlistStateConfig({wishlist:t}){var i;let e=(i=this.hostDataset.wishlistId)!=null?i:"mine";if(t)return{params:{wishlistId:e}}}parseWishlistItemStateConfig({wishlistItem:t}){let{wishlistId:e="mine",wishlistItemId:i}=this.hostDataset;if(!(!t||!i))return{params:{wishlistId:e,wishlistItemId:i}}}parseProductInfoStateConfig({productInfo:t}){if(!t)return;let{wishlistId:e="mine",productHandle:i="",productId:n,variantId:r}=this.hostDataset;return{params:{wishlistId:e,productHandle:i,variantId:r?parseInt(r):void 0}}}observe(){return this.stateConfig=this.parseStateConfig(this.host.getStateConfig()),new ne(t=>{let e=i=>{this.state={...this.state,...i},t.next(this.state)};if(this.stateConfig.wishlist){let{wishlistId:i="mine"}=this.stateConfig.wishlist.params;this.app.state.observeWishlist({wishlistId:i}).subscribe(n=>e({wishlist:n}))}if(this.stateConfig.productInfo){let{productHandle:i,variantId:n}=this.stateConfig.productInfo.params;if(!i)throw new Error("Product handle is required");this.app.state.observeProductInfo({productHandle:i,variantId:n}).subscribe(r=>e({productInfo:r}))}if(this.stateConfig.wishlistItem){let{wishlistId:i,wishlistItemId:n}=this.stateConfig.wishlistItem.params;if(!i)throw new Error("Wishlist id is required");if(!n)throw new Error("Wishlist item id is required");this.app.state.observeWishlist({wishlistId:i}).subscribe(r=>e({wishlistItem:r.items.find(o=>o.id===n)}))}this.stateConfig.cart&&this.app.state.observeShopifyCart({cacheStrategy:"public, max-age=1, stale-while-revalidate=10"}).subscribe(i=>e({cart:i}))})}getFallback(){this.stateConfig=this.parseStateConfig(this.host.getStateConfig());let t={};if(this.stateConfig.wishlist){let{wishlistId:e="mine"}=this.stateConfig.wishlist.params;t.wishlist={id:e,isMine:e==="mine",numItems:0,items:[]}}if(this.stateConfig.productInfo){let{variantId:e=0,productHandle:i}=this.stateConfig.productInfo.params;t.productInfo={productId:0,variantId:e,productHandle:i,inWishlist:!1}}if(this.stateConfig.wishlistItem){let{wishlistId:e,wishlistItemId:i}=this.stateConfig.wishlistItem.params;if(!e)throw new Error("Wishlist id is required");if(!i)throw new Error("Wishlist item id is required");t.wishlistItem={id:i,product:{id:0,handle:"",variants:[]}}}return t}};var Ht=class extends ot{constructor(t){if(super(t),this.et=v,t.type!==qt.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===v||t==null)return this.vt=void 0,this.et=t;if(t===P)return t;if(typeof t!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.et)return this.vt;this.et=t;let e=[t];return e.raw=e,this.vt={_$litType$:this.constructor.resultType,strings:e,values:[]}}};Ht.directiveName="unsafeHTML",Ht.resultType=1;var Pi=Yt(Ht);var S=class extends U{constructor(){super(...arguments);this.lit=_t;this.unsafeHTML=Pi;this.repeat=Zt}};var re=class extends S{constructor(){super(...arguments);this.text="";this.hint="";this.selected=!1;this.disabled=!1;this.showIcon=!1;this.showText=!1;this.iconUnstyled=!1;this.fullWidth=!1;this.alignSelf="center";this.alignContent="center";this.floatingUi=new it(this);this.getCounterFloating=()=>{var i,n,r,o;if(!((i=this.counter)!=null&&i.floating))return;let e=((r=(n=this.counter)==null?void 0:n.floating)==null?void 0:r.reference)==="icon"?(o=this.iconElement)!=null?o:this:this;return{...this.counter.floating,reference:e}}}get iconElement(){return this.querySelector(".wk-icon")}render(){var r,o,a,l;let e=(r=this.alignSelf)!=null?r:"center",i=(o=this.alignContent)!=null?o:"center",n=["wk-button",`wk-align-${e}`,`wk-align-content-${i}`,this.selected&&"wk-selected",this.fullWidth&&"wk-full-width"].filter(c=>!!c).join(" ");return this.href?this.lit.html`
<a

@@ -79,2 +79,2 @@ href=${this.href}

</div>
`}getColorSettings(t){var e;return(e=this.colorMap)!=null&&e[t]?this.colorMap[t]:{color:void 0,image:void 0}}updated(t){var e;super.updated(t),t.has("option")&&this.classList.toggle("wk-single-option",((e=this.option)==null?void 0:e.values.length)===1)}createRenderRoot(){return this}};he.properties={option:{type:Object},colorMap:{type:Object},formatValue:{type:Function}};customElements.get("wk-option-swatches")||customElements.define("wk-option-swatches",he);var to={..._t,repeat:Jt},Me=class extends S{constructor(){super();this.connected=!1;this.cleanupMethods=[];this.eventPending=!1;this.firstConnect=!0;this.loadWithoutSession=!1;this.hasState=!1;this.stateCtrl=new oe(this)}get app(){return this.stateCtrl.app}static get observedAttributes(){return[...super.observedAttributes,"data-wishlist-id","data-wishlist-item-id","data-product-handle","data-product-id","data-variant-id"]}attributeChangedCallback(e,i,n){super.attributeChangedCallback(e,i,n),this.connected&&this.initState()}appReadyCallback(){this.dataset.productHandle&&this.app.events.subscribe("product:change-variant:success",e=>{var i,n;this.dataset.productHandle===((i=e.data)==null?void 0:i.productHandle)&&((n=e.data)!=null&&n.variantId)&&(this.dataset.variantId=e.data.variantId.toString())})}async connect(){this.connected||(this.connected=!0,this.init())}getStateConfig(){return{}}getTranslation(e,i){if(!this.app.theme)return e;let n=this.app.theme.translate(e,i);return e.endsWith("_html")?this.unsafeHTML(n):n}formatMoney(e,i){var n;return this.app.utils.money.formatMoney(e,{withCurrency:(n=i==null?void 0:i.withCurrency)!=null?n:this.app.settings.money.withCurrency})}renderMoney(e,i){return this.unsafeHTML(this.formatMoney(e,i))}getProductUrl(e,i){return this.app.utils.url.getVariantUrl(e.url,i==null?void 0:i.id)}getImageUrl(e,i,n){var r;return this.app.utils.url.getImageUrl((r=i==null?void 0:i.featured_image)!=null&&r.src?i:e,n)}init(){let{loading:e}=this.getStateConfig();e==="lazy"?(this.initFallbackState(),this.initObserver()):(this.initState(),this.appReadyCallback())}setState(e){this.hasState||(this.setAttribute("wk-loaded",""),this.hasState=!0),e.wishlist&&(this.wishlist=e.wishlist),e.wishlistItem&&(this.wishlistItem=e.wishlistItem),e.productInfo&&(this.productInfo=e.productInfo),e.cart&&(this.cart=e.cart)}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this.innerHTML&&this.firstConnect&&(this.innerHTML=""),this.initEvents(),this.connect(),this.firstConnect=!1}disconnectedCallback(){var e,i;super.disconnectedCallback(),this.cleanupMethods.forEach(n=>n()),this.connected=!1,(e=this.subscription)==null||e.unsubscribe(),(i=this.observer)==null||i.disconnect()}shouldUpdate(e){return this.connected?super.shouldUpdate(e):!1}initState(){this.subscription&&this.subscription.unsubscribe(),this.subscription=this.stateCtrl.observe().subscribe(e=>{this.setState(e)})}initFallbackState(){let e=this.stateCtrl.getFallback();e&&this.setState(e)}initObserver(){var e,i;(e=this.observer)==null||e.disconnect(),this.observer=new IntersectionObserver(n=>this.handleIntersect(n),{root:null,rootMargin:"0px"}),this.setAttribute("wk-lazy",""),this.observer.observe((i=this.firstElementChild)!=null?i:this)}handleIntersect([e]){var i;e.isIntersecting&&(this.removeAttribute("wk-lazy"),(i=this.observer)==null||i.disconnect(),this.initState(),this.appReadyCallback())}getEventConfig(){return{}}initEvents(){let e=this.getEventConfig();if(!e)return;let i=Object.entries(e).map(([n,r])=>{let[o,a]=n.split(/ (.*)/s);return this.subscribeToEvent({eventName:o,selector:a,handler:r})})}subscribeToEvent({eventName:e,handler:i,selector:n}){this.addEventListener(e,async r=>{if(this.eventPending){r.preventDefault();return}this.eventPending=!0;let a=r.target instanceof HTMLElement?n?r.target.closest(n):r.currentTarget:null;await(async()=>i.bind(this)(r,a))().catch(c=>{console.warn("Event handler failed:",c.message)}),this.eventPending=!1})}};Me.properties={wishlist:{state:!0},productInfo:{state:!0},wishlistItem:{state:!0},cart:{state:!0},loadWithoutSession:{type:Boolean,attribute:"load-without-session"}};export{it as FloatingUiController,Te as ProductFormController,Me as WishlistElement,oe as WishlistStateController,to as lit};
`}getColorSettings(t){var e;return(e=this.colorMap)!=null&&e[t]?this.colorMap[t]:{color:void 0,image:void 0}}updated(t){var e;super.updated(t),t.has("option")&&this.classList.toggle("wk-single-option",((e=this.option)==null?void 0:e.values.length)===1)}createRenderRoot(){return this}};he.properties={option:{type:Object},colorMap:{type:Object},formatValue:{type:Function}};customElements.get("wk-option-swatches")||customElements.define("wk-option-swatches",he);var to={..._t,repeat:Zt},Me=class extends S{constructor(){super();this.connected=!1;this.cleanupMethods=[];this.eventPending=!1;this.firstConnect=!0;this.loadWithoutSession=!1;this.hasState=!1;this.stateCtrl=new oe(this)}get app(){return this.stateCtrl.app}static get observedAttributes(){return[...super.observedAttributes,"data-wishlist-id","data-wishlist-item-id","data-product-handle","data-product-id","data-variant-id"]}attributeChangedCallback(e,i,n){super.attributeChangedCallback(e,i,n),this.connected&&this.initState()}appReadyCallback(){this.dataset.productHandle&&this.app.events.subscribe("product:change-variant:success",e=>{var i,n;this.dataset.productHandle===((i=e.data)==null?void 0:i.productHandle)&&((n=e.data)!=null&&n.variantId)&&(this.dataset.variantId=e.data.variantId.toString())})}async connect(){this.connected||(this.connected=!0,this.init())}getStateConfig(){return{}}getTranslation(e,i){if(!this.app.theme)return e;let n=this.app.theme.translate(e,i);return e.endsWith("_html")?this.unsafeHTML(n):n}formatMoney(e,i){var n;return this.app.utils.money.formatMoney(e,{withCurrency:(n=i==null?void 0:i.withCurrency)!=null?n:this.app.settings.money.withCurrency,withoutTrailingZeros:i==null?void 0:i.withoutTrailingZeros})}renderMoney(e,i){return this.unsafeHTML(this.formatMoney(e,i))}getProductUrl(e,i){return this.app.utils.url.getVariantUrl(e.url,i==null?void 0:i.id)}getImageUrl(e,i,n){var r;return this.app.utils.url.getImageUrl((r=i==null?void 0:i.featured_image)!=null&&r.src?i:e,n)}init(){let{loading:e}=this.getStateConfig();e==="lazy"?(this.initFallbackState(),this.initObserver()):(this.initState(),this.appReadyCallback())}setState(e){this.hasState||(this.setAttribute("wk-loaded",""),this.hasState=!0),e.wishlist&&(this.wishlist=e.wishlist),e.wishlistItem&&(this.wishlistItem=e.wishlistItem),e.productInfo&&(this.productInfo=e.productInfo),e.cart&&(this.cart=e.cart)}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this.innerHTML&&this.firstConnect&&(this.innerHTML=""),this.initEvents(),this.connect(),this.firstConnect=!1}disconnectedCallback(){var e,i;super.disconnectedCallback(),this.cleanupMethods.forEach(n=>n()),this.connected=!1,(e=this.subscription)==null||e.unsubscribe(),(i=this.observer)==null||i.disconnect()}shouldUpdate(e){return this.connected?super.shouldUpdate(e):!1}initState(){this.subscription&&this.subscription.unsubscribe(),this.subscription=this.stateCtrl.observe().subscribe(e=>{this.setState(e)})}initFallbackState(){let e=this.stateCtrl.getFallback();e&&this.setState(e)}initObserver(){var e,i;(e=this.observer)==null||e.disconnect(),this.observer=new IntersectionObserver(n=>this.handleIntersect(n),{root:null,rootMargin:"0px"}),this.setAttribute("wk-lazy",""),this.observer.observe((i=this.firstElementChild)!=null?i:this)}handleIntersect([e]){var i;e.isIntersecting&&(this.removeAttribute("wk-lazy"),(i=this.observer)==null||i.disconnect(),this.initState(),this.appReadyCallback())}getEventConfig(){return{}}initEvents(){let e=this.getEventConfig();if(!e)return;let i=Object.entries(e).map(([n,r])=>{let[o,a]=n.split(/ (.*)/s);return this.subscribeToEvent({eventName:o,selector:a,handler:r})})}subscribeToEvent({eventName:e,handler:i,selector:n}){this.addEventListener(e,async r=>{if(this.eventPending){r.preventDefault();return}this.eventPending=!0;let a=r.target instanceof HTMLElement?n?r.target.closest(n):r.currentTarget:null;await(async()=>i.bind(this)(r,a))().catch(c=>{console.warn("Event handler failed:",c.message)}),this.eventPending=!1})}};Me.properties={wishlist:{state:!0},productInfo:{state:!0},wishlistItem:{state:!0},cart:{state:!0},loadWithoutSession:{type:Boolean,attribute:"load-without-session"}};export{it as FloatingUiController,Te as ProductFormController,Me as WishlistElement,oe as WishlistStateController,to as lit};

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc