@appmate/wishlist
Advanced tools
Comparing version 4.25.27 to 4.25.28
@@ -1,2 +0,2 @@ | ||
var ye=Object.create;var J=Object.defineProperty;var be=Object.getOwnPropertyDescriptor;var we=Object.getOwnPropertyNames;var Ce=Object.getPrototypeOf,ve=Object.prototype.hasOwnProperty;var W=(i,t)=>()=>(t||i((t={exports:{}}).exports,t),t.exports);var _e=(i,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of we(t))!ve.call(i,s)&&s!==e&&J(i,s,{get:()=>t[s],enumerable:!(r=be(t,s))||r.enumerable});return i};var L=(i,t,e)=>(e=i!=null?ye(Ce(i)):{},_e(t||!i||!i.__esModule?J(e,"default",{value:i,enumerable:!0}):e,i));var X=W((st,Z)=>{var k=1e3,I=k*60,T=I*60,C=T*24,ke=C*7,Ie=C*365.25;Z.exports=function(i,t){t=t||{};var e=typeof i;if(e==="string"&&i.length>0)return Te(i);if(e==="number"&&isFinite(i))return t.long?Se(i):Fe(i);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(i))};function Te(i){if(i=String(i),!(i.length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(i);if(t){var e=parseFloat(t[1]),r=(t[2]||"ms").toLowerCase();switch(r){case"years":case"year":case"yrs":case"yr":case"y":return e*Ie;case"weeks":case"week":case"w":return e*ke;case"days":case"day":case"d":return e*C;case"hours":case"hour":case"hrs":case"hr":case"h":return e*T;case"minutes":case"minute":case"mins":case"min":case"m":return e*I;case"seconds":case"second":case"secs":case"sec":case"s":return e*k;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return e;default:return}}}}function Fe(i){var t=Math.abs(i);return t>=C?Math.round(i/C)+"d":t>=T?Math.round(i/T)+"h":t>=I?Math.round(i/I)+"m":t>=k?Math.round(i/k)+"s":i+"ms"}function Se(i){var t=Math.abs(i);return t>=C?M(i,t,C,"day"):t>=T?M(i,t,T,"hour"):t>=I?M(i,t,I,"minute"):t>=k?M(i,t,k,"second"):i+" ms"}function M(i,t,e,r){var s=t>=e*1.5;return Math.round(i/e)+" "+r+(s?"s":"")}});var ee=W((nt,Y)=>{function Pe(i){e.debug=e,e.default=e,e.coerce=d,e.disable=n,e.enable=s,e.enabled=c,e.humanize=X(),e.destroy=m,Object.keys(i).forEach(o=>{e[o]=i[o]}),e.names=[],e.skips=[],e.formatters={};function t(o){let a=0;for(let l=0;l<o.length;l++)a=(a<<5)-a+o.charCodeAt(l),a|=0;return e.colors[Math.abs(a)%e.colors.length]}e.selectColor=t;function e(o){let a,l=null,y,b;function p(...h){if(!p.enabled)return;let f=p,w=Number(new Date),E=w-(a||w);f.diff=E,f.prev=a,f.curr=w,a=w,h[0]=e.coerce(h[0]),typeof h[0]!="string"&&h.unshift("%O");let _=0;h[0]=h[0].replace(/%([a-zA-Z%])/g,(N,fe)=>{if(N==="%%")return"%";_++;let z=e.formatters[fe];if(typeof z=="function"){let ge=h[_];N=z.call(f,ge),h.splice(_,1),_--}return N}),e.formatArgs.call(f,h),(f.log||e.log).apply(f,h)}return p.namespace=o,p.useColors=e.useColors(),p.color=e.selectColor(o),p.extend=r,p.destroy=e.destroy,Object.defineProperty(p,"enabled",{enumerable:!0,configurable:!1,get:()=>l!==null?l:(y!==e.namespaces&&(y=e.namespaces,b=e.enabled(o)),b),set:h=>{l=h}}),typeof e.init=="function"&&e.init(p),p}function r(o,a){let l=e(this.namespace+(typeof a=="undefined"?":":a)+o);return l.log=this.log,l}function s(o){e.save(o),e.namespaces=o,e.names=[],e.skips=[];let a,l=(typeof o=="string"?o:"").split(/[\s,]+/),y=l.length;for(a=0;a<y;a++)l[a]&&(o=l[a].replace(/\*/g,".*?"),o[0]==="-"?e.skips.push(new RegExp("^"+o.slice(1)+"$")):e.names.push(new RegExp("^"+o+"$")))}function n(){let o=[...e.names.map(u),...e.skips.map(u).map(a=>"-"+a)].join(",");return e.enable(""),o}function c(o){if(o[o.length-1]==="*")return!0;let a,l;for(a=0,l=e.skips.length;a<l;a++)if(e.skips[a].test(o))return!1;for(a=0,l=e.names.length;a<l;a++)if(e.names[a].test(o))return!0;return!1}function u(o){return o.toString().substring(2,o.toString().length-2).replace(/\.\*\?$/,"*")}function d(o){return o instanceof Error?o.stack||o.message:o}function m(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return e.enable(e.load()),e}Y.exports=Pe});var O=W((g,U)=>{g.formatArgs=Ae;g.save=Ee;g.load=We;g.useColors=xe;g.storage=Me();g.destroy=(()=>{let i=!1;return()=>{i||(i=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();g.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function xe(){return typeof window!="undefined"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document!="undefined"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window!="undefined"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function Ae(i){if(i[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+i[0]+(this.useColors?"%c ":" ")+"+"+U.exports.humanize(this.diff),!this.useColors)return;let t="color: "+this.color;i.splice(1,0,t,"color: inherit");let e=0,r=0;i[0].replace(/%[a-zA-Z%]/g,s=>{s!=="%%"&&(e++,s==="%c"&&(r=e))}),i.splice(r,0,t)}g.log=console.debug||console.log||(()=>{});function Ee(i){try{i?g.storage.setItem("debug",i):g.storage.removeItem("debug")}catch(t){}}function We(){let i;try{i=g.storage.getItem("debug")}catch(t){}return!i&&typeof process!="undefined"&&"env"in process&&(i=process.env.DEBUG),i}function Me(){try{return localStorage}catch(i){}}U.exports=ee()(g);var{formatters:Ue}=U.exports;Ue.j=function(i){try{return JSON.stringify(i)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}});var he=W((Tt,le)=>{"use strict";var Be=function(){function i(e,r){if(typeof e!="function")throw new TypeError("DataLoader must be constructed with a function which accepts "+("Array<key> and returns Promise<Array<value>>, but got: "+e+"."));this._batchLoadFn=e,this._maxBatchSize=ze(r),this._batchScheduleFn=Je(r),this._cacheKeyFn=Ge(r),this._cacheMap=Qe(r),this._batch=null,this.name=Ze(r)}var t=i.prototype;return t.load=function(r){if(r==null)throw new TypeError("The loader.load() function must be called with a value, "+("but got: "+String(r)+"."));var s=$e(this),n=this._cacheMap,c=this._cacheKeyFn(r);if(n){var u=n.get(c);if(u){var d=s.cacheHits||(s.cacheHits=[]);return new Promise(function(o){d.push(function(){o(u)})})}}s.keys.push(r);var m=new Promise(function(o,a){s.callbacks.push({resolve:o,reject:a})});return n&&n.set(c,m),m},t.loadMany=function(r){if(!ue(r))throw new TypeError("The loader.loadMany() function must be called with Array<key> "+("but got: "+r+"."));for(var s=[],n=0;n<r.length;n++)s.push(this.load(r[n]).catch(function(c){return c}));return Promise.all(s)},t.clear=function(r){var s=this._cacheMap;if(s){var n=this._cacheKeyFn(r);s.delete(n)}return this},t.clearAll=function(){var r=this._cacheMap;return r&&r.clear(),this},t.prime=function(r,s){var n=this._cacheMap;if(n){var c=this._cacheKeyFn(r);if(n.get(c)===void 0){var u;s instanceof Error?(u=Promise.reject(s),u.catch(function(){})):u=Promise.resolve(s),n.set(c,u)}}return this},i}(),Ke=typeof process=="object"&&typeof process.nextTick=="function"?function(i){V||(V=Promise.resolve()),V.then(function(){process.nextTick(i)})}:typeof setImmediate=="function"?function(i){setImmediate(i)}:function(i){setTimeout(i)},V;function $e(i){var t=i._batch;if(t!==null&&!t.hasDispatched&&t.keys.length<i._maxBatchSize)return t;var e={hasDispatched:!1,keys:[],callbacks:[]};return i._batch=e,i._batchScheduleFn(function(){He(i,e)}),e}function He(i,t){if(t.hasDispatched=!0,t.keys.length===0){K(t);return}var e;try{e=i._batchLoadFn(t.keys)}catch(r){return B(i,t,new TypeError("DataLoader must be constructed with a function which accepts Array<key> and returns Promise<Array<value>>, but the function "+("errored synchronously: "+String(r)+".")))}if(!e||typeof e.then!="function")return B(i,t,new TypeError("DataLoader must be constructed with a function which accepts Array<key> and returns Promise<Array<value>>, but the function did "+("not return a Promise: "+String(e)+".")));e.then(function(r){if(!ue(r))throw new TypeError("DataLoader must be constructed with a function which accepts Array<key> and returns Promise<Array<value>>, but the function did "+("not return a Promise of an Array: "+String(r)+"."));if(r.length!==t.keys.length)throw new TypeError("DataLoader must be constructed with a function which accepts Array<key> and returns Promise<Array<value>>, but the function did not return a Promise of an Array of the same length as the Array of keys."+(` | ||
var ye=Object.create;var J=Object.defineProperty;var be=Object.getOwnPropertyDescriptor;var we=Object.getOwnPropertyNames;var Ce=Object.getPrototypeOf,ve=Object.prototype.hasOwnProperty;var W=(i,t)=>()=>(t||i((t={exports:{}}).exports,t),t.exports);var _e=(i,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of we(t))!ve.call(i,s)&&s!==e&&J(i,s,{get:()=>t[s],enumerable:!(r=be(t,s))||r.enumerable});return i};var L=(i,t,e)=>(e=i!=null?ye(Ce(i)):{},_e(t||!i||!i.__esModule?J(e,"default",{value:i,enumerable:!0}):e,i));var X=W((st,Z)=>{var k=1e3,I=k*60,S=I*60,C=S*24,ke=C*7,Ie=C*365.25;Z.exports=function(i,t){t=t||{};var e=typeof i;if(e==="string"&&i.length>0)return Se(i);if(e==="number"&&isFinite(i))return t.long?Fe(i):Te(i);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(i))};function Se(i){if(i=String(i),!(i.length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(i);if(t){var e=parseFloat(t[1]),r=(t[2]||"ms").toLowerCase();switch(r){case"years":case"year":case"yrs":case"yr":case"y":return e*Ie;case"weeks":case"week":case"w":return e*ke;case"days":case"day":case"d":return e*C;case"hours":case"hour":case"hrs":case"hr":case"h":return e*S;case"minutes":case"minute":case"mins":case"min":case"m":return e*I;case"seconds":case"second":case"secs":case"sec":case"s":return e*k;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return e;default:return}}}}function Te(i){var t=Math.abs(i);return t>=C?Math.round(i/C)+"d":t>=S?Math.round(i/S)+"h":t>=I?Math.round(i/I)+"m":t>=k?Math.round(i/k)+"s":i+"ms"}function Fe(i){var t=Math.abs(i);return t>=C?M(i,t,C,"day"):t>=S?M(i,t,S,"hour"):t>=I?M(i,t,I,"minute"):t>=k?M(i,t,k,"second"):i+" ms"}function M(i,t,e,r){var s=t>=e*1.5;return Math.round(i/e)+" "+r+(s?"s":"")}});var ee=W((nt,Y)=>{function Pe(i){e.debug=e,e.default=e,e.coerce=d,e.disable=n,e.enable=s,e.enabled=c,e.humanize=X(),e.destroy=m,Object.keys(i).forEach(o=>{e[o]=i[o]}),e.names=[],e.skips=[],e.formatters={};function t(o){let a=0;for(let l=0;l<o.length;l++)a=(a<<5)-a+o.charCodeAt(l),a|=0;return e.colors[Math.abs(a)%e.colors.length]}e.selectColor=t;function e(o){let a,l=null,y,b;function p(...h){if(!p.enabled)return;let f=p,w=Number(new Date),E=w-(a||w);f.diff=E,f.prev=a,f.curr=w,a=w,h[0]=e.coerce(h[0]),typeof h[0]!="string"&&h.unshift("%O");let _=0;h[0]=h[0].replace(/%([a-zA-Z%])/g,(N,fe)=>{if(N==="%%")return"%";_++;let z=e.formatters[fe];if(typeof z=="function"){let ge=h[_];N=z.call(f,ge),h.splice(_,1),_--}return N}),e.formatArgs.call(f,h),(f.log||e.log).apply(f,h)}return p.namespace=o,p.useColors=e.useColors(),p.color=e.selectColor(o),p.extend=r,p.destroy=e.destroy,Object.defineProperty(p,"enabled",{enumerable:!0,configurable:!1,get:()=>l!==null?l:(y!==e.namespaces&&(y=e.namespaces,b=e.enabled(o)),b),set:h=>{l=h}}),typeof e.init=="function"&&e.init(p),p}function r(o,a){let l=e(this.namespace+(typeof a=="undefined"?":":a)+o);return l.log=this.log,l}function s(o){e.save(o),e.namespaces=o,e.names=[],e.skips=[];let a,l=(typeof o=="string"?o:"").split(/[\s,]+/),y=l.length;for(a=0;a<y;a++)l[a]&&(o=l[a].replace(/\*/g,".*?"),o[0]==="-"?e.skips.push(new RegExp("^"+o.slice(1)+"$")):e.names.push(new RegExp("^"+o+"$")))}function n(){let o=[...e.names.map(u),...e.skips.map(u).map(a=>"-"+a)].join(",");return e.enable(""),o}function c(o){if(o[o.length-1]==="*")return!0;let a,l;for(a=0,l=e.skips.length;a<l;a++)if(e.skips[a].test(o))return!1;for(a=0,l=e.names.length;a<l;a++)if(e.names[a].test(o))return!0;return!1}function u(o){return o.toString().substring(2,o.toString().length-2).replace(/\.\*\?$/,"*")}function d(o){return o instanceof Error?o.stack||o.message:o}function m(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return e.enable(e.load()),e}Y.exports=Pe});var O=W((g,U)=>{g.formatArgs=Ae;g.save=Ee;g.load=We;g.useColors=xe;g.storage=Me();g.destroy=(()=>{let i=!1;return()=>{i||(i=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();g.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function xe(){return typeof window!="undefined"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document!="undefined"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window!="undefined"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function Ae(i){if(i[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+i[0]+(this.useColors?"%c ":" ")+"+"+U.exports.humanize(this.diff),!this.useColors)return;let t="color: "+this.color;i.splice(1,0,t,"color: inherit");let e=0,r=0;i[0].replace(/%[a-zA-Z%]/g,s=>{s!=="%%"&&(e++,s==="%c"&&(r=e))}),i.splice(r,0,t)}g.log=console.debug||console.log||(()=>{});function Ee(i){try{i?g.storage.setItem("debug",i):g.storage.removeItem("debug")}catch(t){}}function We(){let i;try{i=g.storage.getItem("debug")}catch(t){}return!i&&typeof process!="undefined"&&"env"in process&&(i=process.env.DEBUG),i}function Me(){try{return localStorage}catch(i){}}U.exports=ee()(g);var{formatters:Ue}=U.exports;Ue.j=function(i){try{return JSON.stringify(i)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}});var he=W((St,le)=>{"use strict";var Be=function(){function i(e,r){if(typeof e!="function")throw new TypeError("DataLoader must be constructed with a function which accepts "+("Array<key> and returns Promise<Array<value>>, but got: "+e+"."));this._batchLoadFn=e,this._maxBatchSize=ze(r),this._batchScheduleFn=Je(r),this._cacheKeyFn=Ge(r),this._cacheMap=Qe(r),this._batch=null,this.name=Ze(r)}var t=i.prototype;return t.load=function(r){if(r==null)throw new TypeError("The loader.load() function must be called with a value, "+("but got: "+String(r)+"."));var s=$e(this),n=this._cacheMap,c=this._cacheKeyFn(r);if(n){var u=n.get(c);if(u){var d=s.cacheHits||(s.cacheHits=[]);return new Promise(function(o){d.push(function(){o(u)})})}}s.keys.push(r);var m=new Promise(function(o,a){s.callbacks.push({resolve:o,reject:a})});return n&&n.set(c,m),m},t.loadMany=function(r){if(!ue(r))throw new TypeError("The loader.loadMany() function must be called with Array<key> "+("but got: "+r+"."));for(var s=[],n=0;n<r.length;n++)s.push(this.load(r[n]).catch(function(c){return c}));return Promise.all(s)},t.clear=function(r){var s=this._cacheMap;if(s){var n=this._cacheKeyFn(r);s.delete(n)}return this},t.clearAll=function(){var r=this._cacheMap;return r&&r.clear(),this},t.prime=function(r,s){var n=this._cacheMap;if(n){var c=this._cacheKeyFn(r);if(n.get(c)===void 0){var u;s instanceof Error?(u=Promise.reject(s),u.catch(function(){})):u=Promise.resolve(s),n.set(c,u)}}return this},i}(),Ke=typeof process=="object"&&typeof process.nextTick=="function"?function(i){V||(V=Promise.resolve()),V.then(function(){process.nextTick(i)})}:typeof setImmediate=="function"?function(i){setImmediate(i)}:function(i){setTimeout(i)},V;function $e(i){var t=i._batch;if(t!==null&&!t.hasDispatched&&t.keys.length<i._maxBatchSize)return t;var e={hasDispatched:!1,keys:[],callbacks:[]};return i._batch=e,i._batchScheduleFn(function(){He(i,e)}),e}function He(i,t){if(t.hasDispatched=!0,t.keys.length===0){K(t);return}var e;try{e=i._batchLoadFn(t.keys)}catch(r){return B(i,t,new TypeError("DataLoader must be constructed with a function which accepts Array<key> and returns Promise<Array<value>>, but the function "+("errored synchronously: "+String(r)+".")))}if(!e||typeof e.then!="function")return B(i,t,new TypeError("DataLoader must be constructed with a function which accepts Array<key> and returns Promise<Array<value>>, but the function did "+("not return a Promise: "+String(e)+".")));e.then(function(r){if(!ue(r))throw new TypeError("DataLoader must be constructed with a function which accepts Array<key> and returns Promise<Array<value>>, but the function did "+("not return a Promise of an Array: "+String(r)+"."));if(r.length!==t.keys.length)throw new TypeError("DataLoader must be constructed with a function which accepts Array<key> and returns Promise<Array<value>>, but the function did not return a Promise of an Array of the same length as the Array of keys."+(` | ||
@@ -7,2 +7,2 @@ Keys: | ||
Values: | ||
`+String(r)));K(t);for(var s=0;s<t.callbacks.length;s++){var n=r[s];n instanceof Error?t.callbacks[s].reject(n):t.callbacks[s].resolve(n)}}).catch(function(r){B(i,t,r)})}function B(i,t,e){K(t);for(var r=0;r<t.keys.length;r++)i.clear(t.keys[r]),t.callbacks[r].reject(e)}function K(i){if(i.cacheHits)for(var t=0;t<i.cacheHits.length;t++)i.cacheHits[t]()}function ze(i){var t=!i||i.batch!==!1;if(!t)return 1;var e=i&&i.maxBatchSize;if(e===void 0)return 1/0;if(typeof e!="number"||e<1)throw new TypeError("maxBatchSize must be a positive number: "+e);return e}function Je(i){var t=i&&i.batchScheduleFn;if(t===void 0)return Ke;if(typeof t!="function")throw new TypeError("batchScheduleFn must be a function: "+t);return t}function Ge(i){var t=i&&i.cacheKeyFn;if(t===void 0)return function(e){return e};if(typeof t!="function")throw new TypeError("cacheKeyFn must be a function: "+t);return t}function Qe(i){var t=!i||i.cache!==!1;if(!t)return null;var e=i&&i.cacheMap;if(e===void 0)return new Map;if(e!==null){var r=["get","set","delete","clear"],s=r.filter(function(n){return e&&typeof e[n]!="function"});if(s.length!==0)throw new TypeError("Custom cacheMap missing methods: "+s.join(", "))}return e}function Ze(i){return i&&i.name?i.name:null}function ue(i){return typeof i=="object"&&i!==null&&typeof i.length=="number"&&(i.length===0||i.length>0&&Object.prototype.hasOwnProperty.call(i,i.length-1))}le.exports=Be});import{of as G}from"https://cdn.jsdelivr.net/npm/rxjs@7.8.0/+esm";var{gtag:Q}=window,S=class{constructor({tracker:t}){this.tracker=t||"t0",this.eventNames=new Map([["addToWishlist","add_to_wishlist"]])}track({eventName:t,product:e,variant:r,quantity:s=1}){var u,d;let n=this.eventNames.get(t);if(!n||!Q||!e)return G(!1);let c=(u=r==null?void 0:r.price)!=null?u:e.variants[0].price;return Q("event",n,{currency:c,value:r==null?void 0:r.price,items:[{item_id:(d=(r==null?void 0:r.sku)||(r==null?void 0:r.id))!=null?d:e.id,item_name:e.title,affiliation:"Wishlist King",item_category:e.type,item_brand:e.vendor,item_variant:r==null?void 0:r.title,item_quantity:s,item_price:c}]}),G(!0)}};var ie=L(O());import{of as te}from"https://cdn.jsdelivr.net/npm/rxjs@7.8.0/+esm";var re=(0,ie.default)("wk:tracking:klaviyo"),P=class{constructor({customerEmail:t,urlUtil:e,moneyUtil:r}){this.customerEmail=t,this.urlUtil=e,this.moneyUtil=r,this.eventNames=new Map([["addToWishlist","Added To Wishlist"],["removeFromWishlist","Removed From Wishlist"],["clearWishlist","Cleared Wishlist"]])}track({eventName:t,wishlist:e,product:r,variant:s,quantity:n=1}){var a,l,y,b,p,h,f,w,E;let c=this.eventNames.get(t);if(!c||!e||!r)return te(!1);let u=e.items.slice().reverse().map(_=>_.productId),d={$email:this.customerEmail,WishlistUrl:this.urlUtil.getPublicWishlistUrl(e.id),WishlistProductIDs:u};re("Identify",d),(a=window.klaviyo)==null||a.push(["identify",d]);let m=((l=s==null?void 0:s.price)!=null?l:!r.price_varies)?r.price:void 0,o={URL:this.urlUtil.getVariantUrl(r.url,s==null?void 0:s.id),Name:r.title,ProductID:r.id,VariantID:(y=s==null?void 0:s.id)!=null?y:null,SKU:(b=s==null?void 0:s.sku)!=null?b:null,Tags:r.tags,Brand:r.vendor,ImageURL:this.urlUtil.getImageUrl((p=s==null?void 0:s.featured_image)!=null&&p.src?s:r,{width:1e3}),Price:m?m/100:null,PriceFormatted:m?this.moneyUtil.formatMoney(m):null,CurrencyCode:(w=(f=(h=window.Shopify)==null?void 0:h.currency)==null?void 0:f.active)!=null?w:null,Quantity:n,WishlistUrl:this.urlUtil.getPublicWishlistUrl(e.id),WishlistProductIDs:u};return re("Track",c,o),(E=window.klaviyo)==null||E.push(["track",c,o]),te(!0)}};import{of as se}from"https://cdn.jsdelivr.net/npm/rxjs@7.8.0/+esm";var{fbq:ne}=window,x=class{constructor({currency:t}){this.currency=t,this.eventNames=new Map([["addToWishlist","AddToWishlist"]])}track({eventName:t,product:e,variant:r}){let s=this.eventNames.get(t);return!s||typeof ne!="function"||!e?se(!1):(ne("track",s,{value:r==null?void 0:r.price,currency:this.currency,content_ids:[e.id],content_name:[e.title,r==null?void 0:r.title].filter(n=>!!n).join(" - "),content_category:e.type,content_type:"product_group",num_items:1}),se(!0))}};import{catchError as Re,from as Ne,map as Le,of as j}from"https://cdn.jsdelivr.net/npm/rxjs@7.8.0/+esm";var F=class{constructor({host:t,shop:e,sessionId:r,customerId:s}){this.host=t,this.shop=e,this.customerId=s,this.sessionId=r,this.eventNames=new Map([["viewWishlist","wishlist_viewed"],["addToCart","product_added_to_cart"],["shareWishlist","wishlist_shared"]])}setSessionId(t){this.sessionId=t}track({eventName:t,wishlist:e,product:r,variant:s,quantity:n,source:c}){var d,m;if(!this.sessionId)return j(!1);let u=this.eventNames.get(t);return!u||!e?j(!1):Ne(window.fetch(this.host+"/notify",{method:"POST",headers:{"content-type":"application/json","x-appmate-shp":this.shop,"x-appmate-sid":(d=this.sessionId)!=null?d:"","x-appmate-cid":(m=this.customerId)!=null?m:""},body:JSON.stringify({event:u,wid:e.publicId,pid:r==null?void 0:r.id,vid:s==null?void 0:s.id,qty:n,src:c})})).pipe(Le(()=>!0),Re(()=>j(!1)))}getQuerystring(t){if(!t)return"";let e=new URLSearchParams;return Object.entries(t).forEach(([r,s])=>{Array.isArray(s)?s.forEach(n=>e.append(r,n)):s&&e.append(r,s)}),"?"+e.toString()}};import{from as Oe,switchMap as je}from"https://cdn.jsdelivr.net/npm/rxjs@7.8.0/+esm";var v=class{constructor(t){this.host=t.host,this.headers={"content-type":"application/json"}}fetch({path:t,method:e="GET",query:r,body:s,headers:n={}}){return Oe(window.fetch(this.host+t+this.getQuerystring(r),{method:e,headers:{...this.headers,...n},body:s})).pipe(je(c=>{if(c.ok)return c.json();throw Error(`Error ${c.status}`)}))}getQuerystring(t){if(!t)return"";let e=new URLSearchParams;return Object.entries(t).forEach(([r,s])=>{Array.isArray(s)?s.forEach(n=>e.append(r,n)):s&&e.append(r,s)}),"?"+e.toString()}get({path:t,query:e,headers:r}){return this.fetch({method:"GET",path:t,query:e,headers:r})}post({path:t,query:e,body:r,headers:s}){return this.fetch({method:"POST",path:t,query:e,body:r?JSON.stringify(r):void 0,headers:s})}put({path:t,query:e,body:r,headers:s}){return this.fetch({method:"PUT",path:t,query:e,body:r?JSON.stringify(r):void 0,headers:s})}delete({path:t,query:e,body:r,headers:s}){return this.fetch({method:"DELETE",path:t,query:e,body:r?JSON.stringify(r):void 0,headers:s})}};import{shareReplay as oe,tap as ae}from"https://cdn.jsdelivr.net/npm/rxjs@7.8.0/+esm";var D=class extends v{constructor(){super(...arguments);this.pendingProducts=new Map}loadProduct({productHandle:e}){let r=`/products/${e}.js`,s=this.pendingProducts.get(r);if(s)return s;let n=this.get({path:r}).pipe(ae(()=>{this.pendingProducts.delete(r)}),oe());return this.pendingProducts.set(r,n),n}loadCart(){if(this.pendingCart)return this.pendingCart;let e=this.get({path:"/cart.js"}).pipe(ae(()=>{this.pendingCart=void 0}),oe());return this.pendingCart=e,e}addToCart(e){return this.post({path:"/cart/add.js",body:e})}};var ce=L(O());import{forkJoin as De,lastValueFrom as qe,of as Ve}from"https://cdn.jsdelivr.net/npm/rxjs@7.8.0/+esm";var A=(0,ce.default)("wk:tracking"),q=class{constructor({settings:t,events:e,notifyHost:r,utils:s,theme:n,shop:c,sessionId:u,customerId:d,customerEmail:m}){this.utils=s,this.theme=n,this.services=[],A("Init tracking"),t.integrations.wishlistAnalytics.enabled&&this.services.push(new F({host:r,shop:c,customerId:d,sessionId:u})),t.integrations.klaviyo.enabled&&m&&(A("Add Klaviyo integration"),this.services.push(new P({urlUtil:this.utils.url,moneyUtil:this.utils.money,customerEmail:m}))),t.integrations.metaPixel.enabled&&(A("Add Meta Pixel integration"),this.services.push(new x({currency:window.Shopify.currency.active}))),t.integrations.googleAnalytics.enabled&&(A("Add Google Analytics integration"),this.services.push(new S({tracker:t.integrations.googleAnalytics.tracker})));let o=this.theme.getPageType(),a=l=>y=>{var b,p,h,f;return qe(this.track({eventName:l,source:o,wishlist:(b=y.data)==null?void 0:b.wishlist,product:(p=y.data)==null?void 0:p.product,variant:(h=y.data)==null?void 0:h.variant,quantity:(f=y.data)==null?void 0:f.quantity}))};e.subscribeMany({"wk:wishlist:add-to-cart:success":a("addToCart"),"wk:wishlist:add:success":a("addToWishlist"),"wk:wishlist:change-variant:success":a("changeVariant"),"wk:wishlist:clear:success":a("clearWishlist"),"wk:wishlist:remove:success":a("removeFromWishlist"),"wk:wishlist:share:success":a("shareWishlist"),"wk:wishlist:page-view":a("viewWishlist")})}track(t){return A("Track",t),this.services.length?De(this.services.map(e=>e.track(t))):Ve([])}setSessionId(t){let e=this.services.find(r=>r instanceof F);e&&e.setSessionId(t)}};var $=L(he());import{defer as de,from as pe,lastValueFrom as me,shareReplay as R,switchMap as Xe,tap as Ye}from"https://cdn.jsdelivr.net/npm/rxjs@7.8.0/+esm";var H=class extends v{constructor(e){super(e);this.productMetafields=!1;this.headers={"content-type":"application/json","x-appmate-api":"2022-11"},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),this.productMetafields=!!e.productMetafields,this.wishlistLoader=this.createWishlistLoader(),this.wishlistItemLoader=this.createWishlistItemLoader()}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}createWishlistLoader(){return new $.default(async e=>{let r=await Promise.all(e.map(s=>me(this.get({path:`/wishlists/${s}`})))).then(s=>s.map(n=>n.wishlist));return e.map(s=>{var n;return(n=r.find(c=>s==="mine"?c.isMine:c.publicId===s))!=null?n:new Error("Wishlist not found")})},{cache:!0,batchScheduleFn:e=>setTimeout(e,250)})}createWishlistItemLoader(){return new $.default(async e=>{let r=e.map(n=>n.split("-")).reduce((n,[c,u])=>(n[c]||(n[c]=[]),n[c].push(u),n),{}),s=await Promise.all(Object.entries(r).map(([n,c])=>me(this.get({path:`/wishlists/${n}/items`,headers:{"x-appmate-ids":c.join(","),...this.productMetafields?{"x-appmate-pmf":!0}:{}}})))).then(n=>n.flatMap(c=>c.items));return e.map(n=>{var u;let[,c]=n.split("-");return(u=s.find(d=>d.id===c))!=null?u:new Error("Wishlist item not found")})},{cache:!0,batchScheduleFn:e=>setTimeout(e,250)})}loadWishlist({wishlistId:e}){return pe(de(()=>this.wishlistLoader.load(e).then(r=>({wishlist:r}))))}loadWishlistItem({wishlistId:e,wishlistItemId:r}){return pe(de(()=>this.wishlistItemLoader.load([e,r].join("-")).then(({selectedVariantId:s,...n})=>({wishlistItem:n}))))}addItem({productId:e,variantId:r}){if(typeof e=="string"&&(e=parseInt(e)),typeof r=="string"&&(r=parseInt(r)),!this.hasSession&&this._pendingSessionId)return this._pendingSessionId.pipe(Xe(()=>this.addItem({productId:e,variantId:r})));let s=this.post({path:"/wishlists/mine/items",body:{productId:e,variantId:r}}).pipe(Ye(n=>{n.sessionId&&(this.setSessionId(n.sessionId),this._pendingSessionId=void 0)}),R());return this.hasSession||(this._pendingSessionId=s),s}updateItem({wishlistItemId:e,changes:r}){return this.put({path:"/wishlists/mine/items",body:{changes:{...r,wishlistItemId:e}}}).pipe(R())}removeItem({wishlistId:e,wishlistItemId:r}){return this.delete({path:`/wishlists/${e}/items`,body:{wishlistItemId:r}}).pipe(R())}clearWishlist(){return this.delete({path:"/wishlists/mine"}).pipe(R())}};export{S as GoogleAnalytics,P as KlaviyoTracking,x as MetaPixel,F as NotifyApi,v as RestApi,D as ShopifyApi,q as TrackingApi,H as WishlistApi}; | ||
`+String(r)));K(t);for(var s=0;s<t.callbacks.length;s++){var n=r[s];n instanceof Error?t.callbacks[s].reject(n):t.callbacks[s].resolve(n)}}).catch(function(r){B(i,t,r)})}function B(i,t,e){K(t);for(var r=0;r<t.keys.length;r++)i.clear(t.keys[r]),t.callbacks[r].reject(e)}function K(i){if(i.cacheHits)for(var t=0;t<i.cacheHits.length;t++)i.cacheHits[t]()}function ze(i){var t=!i||i.batch!==!1;if(!t)return 1;var e=i&&i.maxBatchSize;if(e===void 0)return 1/0;if(typeof e!="number"||e<1)throw new TypeError("maxBatchSize must be a positive number: "+e);return e}function Je(i){var t=i&&i.batchScheduleFn;if(t===void 0)return Ke;if(typeof t!="function")throw new TypeError("batchScheduleFn must be a function: "+t);return t}function Ge(i){var t=i&&i.cacheKeyFn;if(t===void 0)return function(e){return e};if(typeof t!="function")throw new TypeError("cacheKeyFn must be a function: "+t);return t}function Qe(i){var t=!i||i.cache!==!1;if(!t)return null;var e=i&&i.cacheMap;if(e===void 0)return new Map;if(e!==null){var r=["get","set","delete","clear"],s=r.filter(function(n){return e&&typeof e[n]!="function"});if(s.length!==0)throw new TypeError("Custom cacheMap missing methods: "+s.join(", "))}return e}function Ze(i){return i&&i.name?i.name:null}function ue(i){return typeof i=="object"&&i!==null&&typeof i.length=="number"&&(i.length===0||i.length>0&&Object.prototype.hasOwnProperty.call(i,i.length-1))}le.exports=Be});import{of as G}from"https://cdn.jsdelivr.net/npm/rxjs@7.8.0/+esm";var{gtag:Q}=window,F=class{constructor({currency:t}){this.currency=t,this.eventNames=new Map([["addToWishlist","add_to_wishlist"]])}track({eventName:t,product:e,variant:r,quantity:s=1}){var u,d;let n=this.eventNames.get(t);if(!n||!Q||!e)return G(!1);let c=(u=r==null?void 0:r.price)!=null?u:e.variants[0].price;return Q("event",n,{currency:this.currency,value:c,items:[{item_id:(d=(r==null?void 0:r.sku)||(r==null?void 0:r.id))!=null?d:e.id,item_name:e.title,affiliation:"Wishlist King",item_category:e.type,item_brand:e.vendor,item_variant:r==null?void 0:r.title,item_quantity:s,item_price:c}]}),G(!0)}};var ie=L(O());import{of as te}from"https://cdn.jsdelivr.net/npm/rxjs@7.8.0/+esm";var re=(0,ie.default)("wk:tracking:klaviyo"),P=class{constructor({customerEmail:t,urlUtil:e,moneyUtil:r}){this.customerEmail=t,this.urlUtil=e,this.moneyUtil=r,this.eventNames=new Map([["addToWishlist","Added To Wishlist"],["removeFromWishlist","Removed From Wishlist"],["clearWishlist","Cleared Wishlist"]])}track({eventName:t,wishlist:e,product:r,variant:s,quantity:n=1}){var a,l,y,b,p,h,f,w,E;let c=this.eventNames.get(t);if(!c||!e||!r)return te(!1);let u=e.items.slice().reverse().map(_=>_.productId),d={$email:this.customerEmail,WishlistUrl:this.urlUtil.getPublicWishlistUrl(e.id),WishlistProductIDs:u};re("Identify",d),(a=window.klaviyo)==null||a.push(["identify",d]);let m=((l=s==null?void 0:s.price)!=null?l:!r.price_varies)?r.price:void 0,o={URL:this.urlUtil.getVariantUrl(r.url,s==null?void 0:s.id),Name:r.title,ProductID:r.id,VariantID:(y=s==null?void 0:s.id)!=null?y:null,SKU:(b=s==null?void 0:s.sku)!=null?b:null,Tags:r.tags,Brand:r.vendor,ImageURL:this.urlUtil.getImageUrl((p=s==null?void 0:s.featured_image)!=null&&p.src?s:r,{width:1e3}),Price:m?m/100:null,PriceFormatted:m?this.moneyUtil.formatMoney(m):null,CurrencyCode:(w=(f=(h=window.Shopify)==null?void 0:h.currency)==null?void 0:f.active)!=null?w:null,Quantity:n,WishlistUrl:this.urlUtil.getPublicWishlistUrl(e.id),WishlistProductIDs:u};return re("Track",c,o),(E=window.klaviyo)==null||E.push(["track",c,o]),te(!0)}};import{of as se}from"https://cdn.jsdelivr.net/npm/rxjs@7.8.0/+esm";var{fbq:ne}=window,x=class{constructor({currency:t}){this.currency=t,this.eventNames=new Map([["addToWishlist","AddToWishlist"]])}track({eventName:t,product:e,variant:r}){let s=this.eventNames.get(t);return!s||typeof ne!="function"||!e?se(!1):(ne("track",s,{value:r==null?void 0:r.price,currency:this.currency,content_ids:[e.id],content_name:[e.title,r==null?void 0:r.title].filter(n=>!!n).join(" - "),content_category:e.type,content_type:"product_group",num_items:1}),se(!0))}};import{catchError as Re,from as Ne,map as Le,of as j}from"https://cdn.jsdelivr.net/npm/rxjs@7.8.0/+esm";var T=class{constructor({host:t,shop:e,sessionId:r,customerId:s}){this.host=t,this.shop=e,this.customerId=s,this.sessionId=r,this.eventNames=new Map([["viewWishlist","wishlist_viewed"],["addToCart","product_added_to_cart"],["shareWishlist","wishlist_shared"]])}setSessionId(t){this.sessionId=t}track({eventName:t,wishlist:e,product:r,variant:s,quantity:n,source:c}){var d,m;if(!this.sessionId)return j(!1);let u=this.eventNames.get(t);return!u||!e?j(!1):Ne(window.fetch(this.host+"/notify",{method:"POST",headers:{"content-type":"application/json","x-appmate-shp":this.shop,"x-appmate-sid":(d=this.sessionId)!=null?d:"","x-appmate-cid":(m=this.customerId)!=null?m:""},body:JSON.stringify({event:u,wid:e.publicId,pid:r==null?void 0:r.id,vid:s==null?void 0:s.id,qty:n,src:c})})).pipe(Le(()=>!0),Re(()=>j(!1)))}getQuerystring(t){if(!t)return"";let e=new URLSearchParams;return Object.entries(t).forEach(([r,s])=>{Array.isArray(s)?s.forEach(n=>e.append(r,n)):s&&e.append(r,s)}),"?"+e.toString()}};import{from as Oe,switchMap as je}from"https://cdn.jsdelivr.net/npm/rxjs@7.8.0/+esm";var v=class{constructor(t){this.host=t.host,this.headers={"content-type":"application/json"}}fetch({path:t,method:e="GET",query:r,body:s,headers:n={}}){return Oe(window.fetch(this.host+t+this.getQuerystring(r),{method:e,headers:{...this.headers,...n},body:s})).pipe(je(c=>{if(c.ok)return c.json();throw Error(`Error ${c.status}`)}))}getQuerystring(t){if(!t)return"";let e=new URLSearchParams;return Object.entries(t).forEach(([r,s])=>{Array.isArray(s)?s.forEach(n=>e.append(r,n)):s&&e.append(r,s)}),"?"+e.toString()}get({path:t,query:e,headers:r}){return this.fetch({method:"GET",path:t,query:e,headers:r})}post({path:t,query:e,body:r,headers:s}){return this.fetch({method:"POST",path:t,query:e,body:r?JSON.stringify(r):void 0,headers:s})}put({path:t,query:e,body:r,headers:s}){return this.fetch({method:"PUT",path:t,query:e,body:r?JSON.stringify(r):void 0,headers:s})}delete({path:t,query:e,body:r,headers:s}){return this.fetch({method:"DELETE",path:t,query:e,body:r?JSON.stringify(r):void 0,headers:s})}};import{shareReplay as oe,tap as ae}from"https://cdn.jsdelivr.net/npm/rxjs@7.8.0/+esm";var D=class extends v{constructor(){super(...arguments);this.pendingProducts=new Map}loadProduct({productHandle:e}){let r=`/products/${e}.js`,s=this.pendingProducts.get(r);if(s)return s;let n=this.get({path:r}).pipe(ae(()=>{this.pendingProducts.delete(r)}),oe());return this.pendingProducts.set(r,n),n}loadCart(){if(this.pendingCart)return this.pendingCart;let e=this.get({path:"/cart.js"}).pipe(ae(()=>{this.pendingCart=void 0}),oe());return this.pendingCart=e,e}addToCart(e){return this.post({path:"/cart/add.js",body:e})}};var ce=L(O());import{forkJoin as De,lastValueFrom as qe,of as Ve}from"https://cdn.jsdelivr.net/npm/rxjs@7.8.0/+esm";var A=(0,ce.default)("wk:tracking"),q=class{constructor({settings:t,events:e,notifyHost:r,utils:s,theme:n,shop:c,sessionId:u,customerId:d,customerEmail:m}){this.utils=s,this.theme=n,this.services=[],A("Init tracking"),t.integrations.wishlistAnalytics.enabled&&this.services.push(new T({host:r,shop:c,customerId:d,sessionId:u})),t.integrations.klaviyo.enabled&&m&&(A("Add Klaviyo integration"),this.services.push(new P({urlUtil:this.utils.url,moneyUtil:this.utils.money,customerEmail:m}))),t.integrations.metaPixel.enabled&&(A("Add Meta Pixel integration"),this.services.push(new x({currency:window.Shopify.currency.active}))),t.integrations.googleAnalytics.enabled&&(A("Add Google Analytics integration"),this.services.push(new F({currency:window.Shopify.currency.active})));let o=this.theme.getPageType(),a=l=>y=>{var b,p,h,f;return qe(this.track({eventName:l,source:o,wishlist:(b=y.data)==null?void 0:b.wishlist,product:(p=y.data)==null?void 0:p.product,variant:(h=y.data)==null?void 0:h.variant,quantity:(f=y.data)==null?void 0:f.quantity}))};e.subscribeMany({"wk:wishlist:add-to-cart:success":a("addToCart"),"wk:wishlist:add:success":a("addToWishlist"),"wk:wishlist:change-variant:success":a("changeVariant"),"wk:wishlist:clear:success":a("clearWishlist"),"wk:wishlist:remove:success":a("removeFromWishlist"),"wk:wishlist:share:success":a("shareWishlist"),"wk:wishlist:page-view":a("viewWishlist")})}track(t){return A("Track",t),this.services.length?De(this.services.map(e=>e.track(t))):Ve([])}setSessionId(t){let e=this.services.find(r=>r instanceof T);e&&e.setSessionId(t)}};var $=L(he());import{defer as de,from as pe,lastValueFrom as me,shareReplay as R,switchMap as Xe,tap as Ye}from"https://cdn.jsdelivr.net/npm/rxjs@7.8.0/+esm";var H=class extends v{constructor(e){super(e);this.productMetafields=!1;this.headers={"content-type":"application/json","x-appmate-api":"2022-11"},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),this.productMetafields=!!e.productMetafields,this.wishlistLoader=this.createWishlistLoader(),this.wishlistItemLoader=this.createWishlistItemLoader()}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}createWishlistLoader(){return new $.default(async e=>{let r=await Promise.all(e.map(s=>me(this.get({path:`/wishlists/${s}`})))).then(s=>s.map(n=>n.wishlist));return e.map(s=>{var n;return(n=r.find(c=>s==="mine"?c.isMine:c.publicId===s))!=null?n:new Error("Wishlist not found")})},{cache:!0,batchScheduleFn:e=>setTimeout(e,250)})}createWishlistItemLoader(){return new $.default(async e=>{let r=e.map(n=>n.split("-")).reduce((n,[c,u])=>(n[c]||(n[c]=[]),n[c].push(u),n),{}),s=await Promise.all(Object.entries(r).map(([n,c])=>me(this.get({path:`/wishlists/${n}/items`,headers:{"x-appmate-ids":c.join(","),...this.productMetafields?{"x-appmate-pmf":!0}:{}}})))).then(n=>n.flatMap(c=>c.items));return e.map(n=>{var u;let[,c]=n.split("-");return(u=s.find(d=>d.id===c))!=null?u:new Error("Wishlist item not found")})},{cache:!0,batchScheduleFn:e=>setTimeout(e,250)})}loadWishlist({wishlistId:e}){return pe(de(()=>this.wishlistLoader.load(e).then(r=>({wishlist:r}))))}loadWishlistItem({wishlistId:e,wishlistItemId:r}){return pe(de(()=>this.wishlistItemLoader.load([e,r].join("-")).then(({selectedVariantId:s,...n})=>({wishlistItem:n}))))}addItem({productId:e,variantId:r}){if(typeof e=="string"&&(e=parseInt(e)),typeof r=="string"&&(r=parseInt(r)),!this.hasSession&&this._pendingSessionId)return this._pendingSessionId.pipe(Xe(()=>this.addItem({productId:e,variantId:r})));let s=this.post({path:"/wishlists/mine/items",body:{productId:e,variantId:r}}).pipe(Ye(n=>{n.sessionId&&(this.setSessionId(n.sessionId),this._pendingSessionId=void 0)}),R());return this.hasSession||(this._pendingSessionId=s),s}updateItem({wishlistItemId:e,changes:r}){return this.put({path:"/wishlists/mine/items",body:{changes:{...r,wishlistItemId:e}}}).pipe(R())}removeItem({wishlistId:e,wishlistItemId:r}){return this.delete({path:`/wishlists/${e}/items`,body:{wishlistItemId:r}}).pipe(R())}clearWishlist(){return this.delete({path:"/wishlists/mine"}).pipe(R())}};export{F as GoogleAnalytics,P as KlaviyoTracking,x as MetaPixel,T as NotifyApi,v as RestApi,D as ShopifyApi,q as TrackingApi,H as WishlistApi}; |
@@ -1,2 +0,2 @@ | ||
import{LitElement as h,html as o}from"https://cdn.jsdelivr.net/gh/lit/dist@2.7.4/all/lit-all.min.js";import{FloatingUiController as u}from"https://cdn.jsdelivr.net/npm/@appmate/wishlist@4.25.27/controllers.js";import"https://cdn.jsdelivr.net/npm/@appmate/wishlist@4.25.27/components/counter.js";import"https://cdn.jsdelivr.net/npm/@appmate/wishlist@4.25.27/components/icon.js";var l=class extends h{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 u(this);this.getCounterFloating=()=>{var i,e,n,r;if(!((i=this.counter)!=null&&i.floating))return;let t=((n=(e=this.counter)==null?void 0:e.floating)==null?void 0:n.reference)==="icon"?(r=this.iconElement)!=null?r:this:this;return{...this.counter.floating,reference:t}}}get iconElement(){return this.querySelector(".wk-icon")}render(){var n,r,s,a;let t=(n=this.alignSelf)!=null?n:"center",i=(r=this.alignContent)!=null?r:"center",e=["wk-button",`wk-align-${t}`,`wk-align-content-${i}`,this.selected&&"wk-selected",this.fullWidth&&"wk-full-width"].filter(c=>!!c).join(" ");return this.href?o` | ||
import{LitElement as h,html as o}from"https://cdn.jsdelivr.net/gh/lit/dist@2.7.4/all/lit-all.min.js";import{FloatingUiController as u}from"https://cdn.jsdelivr.net/npm/@appmate/wishlist@4.25.28/controllers.js";import"https://cdn.jsdelivr.net/npm/@appmate/wishlist@4.25.28/components/counter.js";import"https://cdn.jsdelivr.net/npm/@appmate/wishlist@4.25.28/components/icon.js";var l=class extends h{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 u(this);this.getCounterFloating=()=>{var i,e,n,r;if(!((i=this.counter)!=null&&i.floating))return;let t=((n=(e=this.counter)==null?void 0:e.floating)==null?void 0:n.reference)==="icon"?(r=this.iconElement)!=null?r:this:this;return{...this.counter.floating,reference:t}}}get iconElement(){return this.querySelector(".wk-icon")}render(){var n,r,s,a;let t=(n=this.alignSelf)!=null?n:"center",i=(r=this.alignContent)!=null?r:"center",e=["wk-button",`wk-align-${t}`,`wk-align-content-${i}`,this.selected&&"wk-selected",this.fullWidth&&"wk-full-width"].filter(c=>!!c).join(" ");return this.href?o` | ||
<a | ||
@@ -3,0 +3,0 @@ href=${this.href} |
@@ -1,1 +0,1 @@ | ||
import{LitElement as s,html as a}from"https://cdn.jsdelivr.net/gh/lit/dist@2.7.4/all/lit-all.min.js";import{FloatingUiController as l}from"https://cdn.jsdelivr.net/npm/@appmate/wishlist@4.25.27/controllers.js";var t=class extends s{constructor(){super(...arguments);this.value=0;this.showNumber=!1;this.showBrackets=!1;this.floatingUi=new l(this)}render(){let e=this.showNumber?this.value:"",o=["wk-counter",this.showBrackets&&"wk-brackets",this.floating&&"wk-bubble",this.floating&&!this.showNumber&&"wk-dot"].filter(r=>!!r).join(" ");return a`<span class=${o}>${e}</span>`}createRenderRoot(){return this}};t.properties={value:{type:Number},floating:{type:Object},showNumber:{type:Boolean,attribute:"show-number"},showBrackets:{type:Boolean,attribute:"show-brackets"}};customElements.get("wk-counter")||customElements.define("wk-counter",t);export{t as Counter}; | ||
import{LitElement as s,html as a}from"https://cdn.jsdelivr.net/gh/lit/dist@2.7.4/all/lit-all.min.js";import{FloatingUiController as l}from"https://cdn.jsdelivr.net/npm/@appmate/wishlist@4.25.28/controllers.js";var t=class extends s{constructor(){super(...arguments);this.value=0;this.showNumber=!1;this.showBrackets=!1;this.floatingUi=new l(this)}render(){let e=this.showNumber?this.value:"",o=["wk-counter",this.showBrackets&&"wk-brackets",this.floating&&"wk-bubble",this.floating&&!this.showNumber&&"wk-dot"].filter(r=>!!r).join(" ");return a`<span class=${o}>${e}</span>`}createRenderRoot(){return this}};t.properties={value:{type:Number},floating:{type:Object},showNumber:{type:Boolean,attribute:"show-number"},showBrackets:{type:Boolean,attribute:"show-brackets"}};customElements.get("wk-counter")||customElements.define("wk-counter",t);export{t as Counter}; |
@@ -1,2 +0,2 @@ | ||
import{LitElement as l,html as s}from"https://cdn.jsdelivr.net/gh/lit/dist@2.7.4/all/lit-all.min.js";import{Icon as a}from"https://cdn.jsdelivr.net/npm/@appmate/wishlist@4.25.27/components/icon.js";var i=class extends l{constructor(){super();this.icon="caret"}get app(){if(!window.WishlistKing)throw new Error("Wishlist King SDK not initialized");return window.WishlistKing}render(){if(!this.option)return;let t=this.option,e=`options[${this.option.name}]`,n=`${this.app.utils.url.handlelize(this.id)}-select`;return s` | ||
import{LitElement as l,html as s}from"https://cdn.jsdelivr.net/gh/lit/dist@2.7.4/all/lit-all.min.js";import{Icon as a}from"https://cdn.jsdelivr.net/npm/@appmate/wishlist@4.25.28/components/icon.js";var i=class extends l{constructor(){super();this.icon="caret"}get app(){if(!window.WishlistKing)throw new Error("Wishlist King SDK not initialized");return window.WishlistKing}render(){if(!this.option)return;let t=this.option,e=`options[${this.option.name}]`,n=`${this.app.utils.url.handlelize(this.id)}-select`;return s` | ||
<div class="wk-option-select"> | ||
@@ -3,0 +3,0 @@ <label class="wk-label" for=${n}>${t.name}</label> |
@@ -1,2 +0,2 @@ | ||
import{LitElement as s,html as o}from"https://cdn.jsdelivr.net/gh/lit/dist@2.7.4/all/lit-all.min.js";import{FloatingUiController as r}from"https://cdn.jsdelivr.net/npm/@appmate/wishlist@4.25.27/controllers.js";var n=class extends s{constructor(){super(...arguments);this.text="";this.autoShow=!1;this.autoHide=!1;this.floatingUi=new r(this)}get added(){return!!this.parentElement}get showing(){return this.transition==="show"}get hiding(){return this.transition==="hide"}render(){var e;let t=["wk-popover",this.transition?`wk-${this.transition}`:"",this.elementClass].filter(i=>!!i).join(" ");return o` | ||
import{LitElement as s,html as o}from"https://cdn.jsdelivr.net/gh/lit/dist@2.7.4/all/lit-all.min.js";import{FloatingUiController as r}from"https://cdn.jsdelivr.net/npm/@appmate/wishlist@4.25.28/controllers.js";var n=class extends s{constructor(){super(...arguments);this.text="";this.autoShow=!1;this.autoHide=!1;this.floatingUi=new r(this)}get added(){return!!this.parentElement}get showing(){return this.transition==="show"}get hiding(){return this.transition==="hide"}render(){var e;let t=["wk-popover",this.transition?`wk-${this.transition}`:"",this.elementClass].filter(i=>!!i).join(" ");return o` | ||
<div class=${t}> | ||
@@ -3,0 +3,0 @@ <div class="wk-text">${this.getText()}</div> |
{ | ||
"name": "@appmate/wishlist", | ||
"version": "4.25.27", | ||
"version": "4.25.28", | ||
"description": "Wishlist King SDK", | ||
@@ -5,0 +5,0 @@ "main": "wishlist-app.js", |
@@ -1,1 +0,1 @@ | ||
var te=Object.create;var J=Object.defineProperty;var se=Object.getOwnPropertyDescriptor;var ie=Object.getOwnPropertyNames;var re=Object.getPrototypeOf,oe=Object.prototype.hasOwnProperty;var N=(i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports);var ne=(i,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of ie(e))!oe.call(i,r)&&r!==t&&J(i,r,{get:()=>e[r],enumerable:!(s=se(e,r))||s.enumerable});return i};var ae=(i,e,t)=>(t=i!=null?te(re(i)):{},ne(e||!i||!i.__esModule?J(t,"default",{value:i,enumerable:!0}):t,i));var z=N((He,G)=>{var S=1e3,U=S*60,E=U*60,v=E*24,ce=v*7,he=v*365.25;G.exports=function(i,e){e=e||{};var t=typeof i;if(t==="string"&&i.length>0)return pe(i);if(t==="number"&&isFinite(i))return e.long?ue(i):de(i);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(i))};function pe(i){if(i=String(i),!(i.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(i);if(e){var t=parseFloat(e[1]),s=(e[2]||"ms").toLowerCase();switch(s){case"years":case"year":case"yrs":case"yr":case"y":return t*he;case"weeks":case"week":case"w":return t*ce;case"days":case"day":case"d":return t*v;case"hours":case"hour":case"hrs":case"hr":case"h":return t*E;case"minutes":case"minute":case"mins":case"min":case"m":return t*U;case"seconds":case"second":case"secs":case"sec":case"s":return t*S;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return t;default:return}}}}function de(i){var e=Math.abs(i);return e>=v?Math.round(i/v)+"d":e>=E?Math.round(i/E)+"h":e>=U?Math.round(i/U)+"m":e>=S?Math.round(i/S)+"s":i+"ms"}function ue(i){var e=Math.abs(i);return e>=v?H(i,e,v,"day"):e>=E?H(i,e,E,"hour"):e>=U?H(i,e,U,"minute"):e>=S?H(i,e,S,"second"):i+" ms"}function H(i,e,t,s){var r=e>=t*1.5;return Math.round(i/t)+" "+s+(r?"s":"")}});var Z=N((De,Q)=>{function me(i){t.debug=t,t.default=t,t.coerce=h,t.disable=o,t.enable=r,t.enabled=n,t.humanize=z(),t.destroy=u,Object.keys(i).forEach(l=>{t[l]=i[l]}),t.names=[],t.skips=[],t.formatters={};function e(l){let c=0;for(let p=0;p<l.length;p++)c=(c<<5)-c+l.charCodeAt(p),c|=0;return t.colors[Math.abs(c)%t.colors.length]}t.selectColor=e;function t(l){let c,p=null,y,A;function m(...d){if(!m.enabled)return;let w=m,b=Number(new Date),F=b-(c||b);w.diff=F,w.prev=c,w.curr=b,c=b,d[0]=t.coerce(d[0]),typeof d[0]!="string"&&d.unshift("%O");let C=0;d[0]=d[0].replace(/%([a-zA-Z%])/g,(k,T)=>{if(k==="%%")return"%";C++;let P=t.formatters[T];if(typeof P=="function"){let L=d[C];k=P.call(w,L),d.splice(C,1),C--}return k}),t.formatArgs.call(w,d),(w.log||t.log).apply(w,d)}return m.namespace=l,m.useColors=t.useColors(),m.color=t.selectColor(l),m.extend=s,m.destroy=t.destroy,Object.defineProperty(m,"enabled",{enumerable:!0,configurable:!1,get:()=>p!==null?p:(y!==t.namespaces&&(y=t.namespaces,A=t.enabled(l)),A),set:d=>{p=d}}),typeof t.init=="function"&&t.init(m),m}function s(l,c){let p=t(this.namespace+(typeof c=="undefined"?":":c)+l);return p.log=this.log,p}function r(l){t.save(l),t.namespaces=l,t.names=[],t.skips=[];let c,p=(typeof l=="string"?l:"").split(/[\s,]+/),y=p.length;for(c=0;c<y;c++)p[c]&&(l=p[c].replace(/\*/g,".*?"),l[0]==="-"?t.skips.push(new RegExp("^"+l.slice(1)+"$")):t.names.push(new RegExp("^"+l+"$")))}function o(){let l=[...t.names.map(a),...t.skips.map(a).map(c=>"-"+c)].join(",");return t.enable(""),l}function n(l){if(l[l.length-1]==="*")return!0;let c,p;for(c=0,p=t.skips.length;c<p;c++)if(t.skips[c].test(l))return!1;for(c=0,p=t.names.length;c<p;c++)if(t.names[c].test(l))return!0;return!1}function a(l){return l.toString().substring(2,l.toString().length-2).replace(/\.\*\?$/,"*")}function h(l){return l instanceof Error?l.stack||l.message:l}function u(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return t.enable(t.load()),t}Q.exports=me});var Y=N((f,D)=>{f.formatArgs=fe;f.save=we;f.load=ye;f.useColors=ge;f.storage=be();f.destroy=(()=>{let i=!1;return()=>{i||(i=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();f.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function ge(){return typeof window!="undefined"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document!="undefined"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window!="undefined"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function fe(i){if(i[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+i[0]+(this.useColors?"%c ":" ")+"+"+D.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;i.splice(1,0,e,"color: inherit");let t=0,s=0;i[0].replace(/%[a-zA-Z%]/g,r=>{r!=="%%"&&(t++,r==="%c"&&(s=t))}),i.splice(s,0,e)}f.log=console.debug||console.log||(()=>{});function we(i){try{i?f.storage.setItem("debug",i):f.storage.removeItem("debug")}catch(e){}}function ye(){let i;try{i=f.storage.getItem("debug")}catch(e){}return!i&&typeof process!="undefined"&&"env"in process&&(i=process.env.DEBUG),i}function be(){try{return localStorage}catch(i){}}D.exports=Z()(f);var{formatters:Ce}=D.exports;Ce.j=function(i){try{return JSON.stringify(i)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var V=(i=21)=>crypto.getRandomValues(new Uint8Array(i)).reduce((e,t)=>(t&=63,t<36?e+=t.toString(36):t<62?e+=(t-26).toString(36).toUpperCase():t>62?e+="-":e+="_",e),"");var g=class{constructor(e){this.element=e}replace(e){var t;return(t=this.element)==null||t.replaceWith(e),e}append(e){var t;return(t=this.element)==null||t.append(e),e}prepend(e){var t;return(t=this.element)==null||t.prepend(e),e}insertBefore(e){var t;return(t=this.element)==null||t.before(e),e}insertAfter(e){var t;return(t=this.element)==null||t.after(e),e}closest(e,t=5){if(!this.element)return new g;if(typeof e=="object")return this.searchByStyle(e,this.element,r=>r.parentElement,t);let s=this.element.closest(e);return s?new g(s):new g}find(e){var s;let t=(s=this.element)==null?void 0:s.querySelector(e);return t?new g(t):new g}searchByStyle(e,t,s,r=5){if(r<0||!t)return null;let o=getComputedStyle(t);if(Object.entries(e).every(([h,u])=>o.getPropertyValue(h)===u))return new g(t);let a=s(t);return a?this.searchByStyle(e,a,s,r-1):null}};var M=class{constructor({routeUtil:e}){this.subscriber=[],this.routeUtil=e,this.observer=new MutationObserver(t=>{t.reduce((s,r)=>s.concat(Array.from(r.addedNodes)),[]).filter(s=>s instanceof Element&&!s.hasAttribute("wk-skip")).forEach(s=>{s instanceof Element&&this.scan(s)})}),this.observer.observe(document,{subtree:!0,childList:!0,attributes:!1})}watch(e,t){let s={target:e,callback:t};this.subscriber.push(s),K(s,this.routeUtil.parse(window.location.pathname))&&this.scan(document)}shouldSkip(e,{skipHidden:t}){return t&&e instanceof HTMLElement?e.offsetParent===null:!1}scan(e){e&&this.subscriber.filter(t=>K(t,this.routeUtil.parse(window.location.pathname))).forEach(t=>{let s=e instanceof Element&&e.matches(t.target.selector)&&!this.shouldSkip(e,{skipHidden:!!t.target.skipHidden});if(s&&this.notify(t,e),s&&t.target.firstMatch)return;let r=e.querySelectorAll(t.target.selector);for(let o of r)if(!this.shouldSkip(o,{skipHidden:!!t.target.skipHidden})&&(this.notify(t,o),t.target.firstMatch))break})}notify(e,t){if(!t.hasAttribute("wk-skip")){t.setAttribute("wk-skip","");let s=new g(t);e.callback(s)}}};function K({target:i},e){if(!i.pageType)return!0;if(!e.pageType)return!1;let t=Array.isArray(i.pageType)?i.pageType:[i.pageType];return t.includes("all")?!0:t.includes(e.pageType)}var le=[{pageType:"product",match:i=>i.includes("/products/")},{pageType:"collection",match:i=>i.includes("/collections/")&&!i.includes("/products/")},{pageType:"account",match:i=>i.includes("/account/")||i.endsWith("/account")},{pageType:"challenge",match:i=>i.endsWith("/account")},{pageType:"blog",match:i=>i.includes("/blog/")},{pageType:"cart",match:i=>i.includes("/cart/")||i.endsWith("/cart")},{pageType:"wishlist",match:(i,{wishlistUrl:e})=>i.includes(e)},{pageType:"page",match:i=>i.includes("/pages/")},{pageType:"search",match:i=>i.includes("/search")},{pageType:"home",match:i=>i.length<4}],R=class{constructor({wishlistUrl:e}){this.wishlistUrl=e}parse(e){for(let t of le)if(t.match(e,{wishlistUrl:this.wishlistUrl}))return{pageType:t.pageType};return{pageType:"unknown"}}};var _=class{constructor(e){this.locale={};var t;this.initLocale((t=e==null?void 0:e.locale)!=null?t:{})}initLocale(e){this.locale=this.decodeLocale(e)}decodeHtmlEntities(e){return e.replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'")}decodeLocale(e){let t={};for(let s in e){t[s]={};for(let r in e[s])t[s][r]=this.decodeHtmlEntities(e[s][r])}return t}translate(e,t){var n;let[s,r]=e.split("."),o=(n=this.locale[s])==null?void 0:n[r];return o?t?Object.entries(t).reduce((a,[h,u])=>a.replace(new RegExp(`{{\\s*${h}\\s*}}`,"g"),u),o):o:`translation missing: ${e}`}};var I=class{constructor({rootUrl:e,wishlistUrl:t}){this._rootUrl=e,this.route=new R({wishlistUrl:t}),this.observer=new M({routeUtil:this.route}),this.locale=new _,this.watch=this.observer.watch.bind(this.observer)}getPageType(e=window.location.pathname){return this.route.parse(e).pageType}getWishlistId(e){if(!e)return null;e instanceof URL&&(e=e.pathname);let t=e.replace(this._rootUrl,"/").split("/");return t.length===4?t.pop():"mine"}getProductHandle(e){var t,s;return e?(e instanceof URL&&(e=e.pathname),(s=(t=e.split("/").pop())==null?void 0:t.split("?")[0])==null?void 0:s.split("#")[0]):null}getVariantId(e,t){var r;let s=null;if(e&&(e instanceof URL&&(e=e.pathname),s=new URLSearchParams(e.split("?")[1]).get("variant")),!s&&t)try{s=new FormData((r=t.element)!=null?r:t).get("id")}catch(o){console.warn("Failed to parse variant from product form.",o)}return s}translate(e,t){return this.locale.translate(e,t)}createComponent(e,t){var r;let s=document.createElement(e);if(t!=null&&t.dataset&&Object.entries(t==null?void 0:t.dataset).forEach(([o,n])=>{n&&(typeof n=="boolean"?s.dataset[o]="":typeof n=="object"?s.dataset[o]=JSON.stringify(n):s.dataset[o]=n)}),t!=null&&t.props&&Object.entries(t==null?void 0:t.props).forEach(([o,n])=>{if(o==="floating"&&n){let a=n,h=(a==null?void 0:a.reference)instanceof g?a.reference.element:a.reference;if(typeof h=="object"&&"id"in h){h.setAttribute("wk-id",V()),s[o]={...a,reference:`[wk-id="${h.getAttribute("wk-id")}"]`};return}}s[o]=n}),(r=t==null?void 0:t.wrap)!=null&&r.name){let o=this.createElement(t.wrap.name,t.wrap.props,s);return o.setAttribute("wk-skip",""),o}return s}createHeadlessComponent(e,t){var o;let s=t.host.element?t.host.element:t.host;if(!s)throw new Error("Headless host is undefined");t.dataset&&Object.entries(t.dataset).forEach(([n,a])=>{a&&(typeof a=="boolean"?s.dataset[n]="":typeof a=="object"?s.dataset[n]=JSON.stringify(a):s.dataset[n]=a)});let r=(o=window.headlessElements)==null?void 0:o.store.get(e);if(!r)throw new Error(`Headless element not found: ${e}`);return new r(s)}createElement(e,t={},...s){let r=Object.assign(document.createElement(e),t);return s&&r.append(...s),r}};var x=class{constructor(){this.dispatcher=document}publish(e){this.dispatcher.dispatchEvent(new CustomEvent(e.name,{detail:e,bubbles:!1,cancelable:!1}))}once(e,t){let s=r=>{this.dispatcher.removeEventListener(e,s),t(r)};this.subscribe(e,s)}subscribe(e,t){this.dispatcher.addEventListener(e,s=>{let r=s;t({name:r.type,data:r.detail.data})})}subscribeMany(e){return Object.entries(e).map(([t,s])=>this.subscribe(t,s))}};var ee=ae(Y()),W=(0,ee.default)("wk:app");window.headlessElements||(window.headlessElements={store:new Map,define(i,e){var t;(t=window.headlessElements)==null||t.store.set(i,e)}});var X=class{constructor({dependencies:e=[],...t}){this.stylesLoaded=!1;this._loaded=!1;this.addToCart=e=>this.state.promise.addToCart(e);this.addAllToCart=e=>this.state.promise.addAllToCart(e);this.addWishlistItem=e=>this.state.promise.addWishlistItem(e);this.clearWishlist=()=>this.state.promise.clearWishlist();this.loadProductInfo=e=>this.state.promise.loadProductInfo(e);this.loadShopifyProduct=e=>this.state.promise.loadShopifyProduct(e);this.loadWishlist=e=>this.state.promise.loadWishlist(e);this.loadWishlistItem=e=>this.state.promise.loadWishlistItem(e);this.publishWishlistEvent=e=>this.state.promise.publishWishlistEvent(e);this.publishWishlistProductEvent=e=>this.state.promise.publishWishlistProductEvent(e);this.removeWishlistItem=e=>this.state.promise.removeWishlistItem(e);this.shareWishlist=e=>this.state.promise.shareWishlist(e);this.updateWishlistItem=e=>this.state.promise.updateWishlistItem(e);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}:null,W("Create app",{config:this.config,settings:this.settings,customer:this.customer}),this.events=new x,this.theme=new I({rootUrl:this.routes.rootUrl,wishlistUrl:this.routes.wishlistUrl}),this.initDevMode();let{stylesheets:s,scripts:r,iconSetUrl:o,localeUrl:n}=this.parseDependencies(e);W("Init dependecies",{dependencies:e,stylesheets:s,scripts:r,iconSetUrl:o,localeUrl:n}),this.initStyles({stylesheets:s,iconSetUrl:o,localeUrl:n}),this.initScripts(r),this.initLoginActionQueue(),(this.hasSession||this.settings.general.appLoading==="EAGER")&&this.load(),window.WishlistKing=this,this.events.publish({name:"wk:app:created",data:{}})}get loaded(){return this._loaded}get state(){return O(this._state)}get apis(){return O(this._apis)}get utils(){return O(this._utils)}get hasSession(){return!!this.getSessionId()||!!this.customer}get isLoggedIn(){var e;return!!((e=this.customer)!=null&&e.id)}getSessionId(){let e=window.localStorage.getItem("wk_session_id");if(e)return e;let t=window.localStorage.getItem("appmate-session");if(t)try{let s=JSON.parse(t).state.sid;return this.setSessionId(s)}catch(s){console.error(s)}}setSessionId(e){var t;return window.localStorage.setItem("wk_session_id",e),(t=this._apis)==null||t.tracking.setSessionId(e),e}async load(){return this._loadPromise?this._loadPromise:(W("Load remaining app code"),this._loadPromise=(async()=>{let[{WishlistState:e},{ShopifyApi:t,WishlistApi:s,TrackingApi:r},{MoneyUtil:o,UrlUtil:n,ProductUtil:a}]=await Promise.all([import("https://cdn.jsdelivr.net/npm/@appmate/wishlist@4.25.27/state.js"),import("https://cdn.jsdelivr.net/npm/@appmate/wishlist@4.25.27/api.js"),import("https://cdn.jsdelivr.net/npm/@appmate/wishlist@4.25.27/utils.js")]);this.initUtils({MoneyUtil:o,UrlUtil:n,ProductUtil:a}),this.initApis({WishlistApi:s,ShopifyApi:t,TrackingApi:r}),await this.initState({WishlistState:e}),this.initCustomerSession(),this.initUrlChangeEvents(),this.trackCurrentPage(),this._loaded=!0,this.events.publish({name:"wk:app:loaded",data:{}})})())}initUtils({UrlUtil:e,MoneyUtil:t,ProductUtil:s}){this._utils={url:new e({rootUrl:this.routes.rootUrl,wishlistUrl:this.routes.wishlistUrl,shopDomain:this.config.shop.domain,placeholderImageUrl:this.config.products.fallbackImage,fileUrl:this.routes.fileUrl}),money:new t({moneyFormat:this.config.shop.moneyFormat,moneyFormatWithCurrency:this.config.shop.moneyFormatWithCurrency}),product:new s}}initApis({WishlistApi:e,ShopifyApi:t,TrackingApi:s}){var r,o,n;this._apis={wishlist:new e({host:this.config.routes.apiHost,shop:this.config.shop.permanentDomain,customerId:(r=this.config.customer.id)!=null?r:void 0,sessionId:this.getSessionId(),trackingSource:this.theme.getPageType(),productMetafields:this.config.products.metafields}),shopify:new t({host:window.Shopify.routes.root.substring(0,window.Shopify.routes.root.length-1)}),tracking:new s({notifyHost:this.config.routes.apiHost,events:this.events,shop:this.config.shop.permanentDomain,customerId:(o=this.config.customer.id)!=null?o:void 0,customerEmail:(n=this.config.customer.email)!=null?n:void 0,sessionId:this.getSessionId(),utils:this.utils,theme:this.theme,settings:this.settings})}}initState({WishlistState:e}){return this._state=new e({wishlistApi:this.apis.wishlist,shopifyApi:this.apis.shopify,settings:this.settings,events:this.events,utils:this.utils}),this._state.init()}async initStyles({stylesheets:e,iconSetUrl:t,localeUrl:s}){if(!(e!=null&&e.length)&&!t){this.onStylesLoaded();return}try{await Promise.all([...(e!=null?e:[]).map(r=>new Promise((o,n)=>{let a=document.createElement("link");a.rel="stylesheet",a.href=r,a.onload=o,a.onerror=n,document.head.appendChild(a)})),t?Promise.all([import("https://cdn.jsdelivr.net/npm/@appmate/wishlist@4.25.27/components/icon.js"),import(t)]).then(([{Icon:r},{icons:o}])=>{if(typeof o!="object")throw new Error("Icon set must export icons object.");r.addIcons(o)}):Promise.resolve(),s?fetch(s).then(r=>r.json()).then(r=>{this.theme.locale.initLocale(r)}):Promise.resolve()]),this.onStylesLoaded()}catch(r){console.warn(r),this.events.publish({name:"wk:app:load-styles:error",data:{}})}}async initScripts(e){if(!(e!=null&&e.length)){this.initDefaultEventSubscribers(),this.events.publish({name:"wk:app:load-scripts:success",data:{}});return}try{await Promise.all(e.map(t=>import(t).then(({setup:s})=>{typeof s=="function"&&s({app:this})}))),e.some(t=>t.includes("event-subscribers.js"))||this.initDefaultEventSubscribers(),this.events.publish({name:"wk:app:load-scripts:success",data:{}})}catch(t){console.warn(t),this.events.publish({name:"wk:app:load-scripts:error",data:{}})}}initDefaultEventSubscribers(){this.events.subscribe("wk:wishlist:login-required",e=>{window.location.href=this.routes.accountLoginUrl}),this.events.subscribe("wk:customer:login",e=>{if(e.data.pending)switch(e.data.pending.action){case"wishlist:add":this.addWishlistItem(e.data.pending)}}),this.events.subscribe("wk:customer:logout",async e=>{this.clearCustomerSession()})}trackCurrentPage(){if(this.theme.getPageType()==="wishlist"){let t=this.theme.getWishlistId(window.location.pathname);t&&this.publishWishlistEvent({eventName:"wk:wishlist:page-view",wishlistId:t})}}onStylesLoaded(){this.stylesLoaded=!0,this.events.publish({name:"wk:app:load-styles:success",data:{}})}async initLoginActionQueue(){let e=!!window.localStorage.getItem("wk_logged_in");if(this.events.subscribe("wk:wishlist:login-required",t=>{var r;let s=["wishlist:add","wishlist:view"];(r=t.data)!=null&&r.action&&s.includes(t.data.action)&&window.localStorage.setItem("wk_pending",JSON.stringify({...t.data}))}),!e&&this.isLoggedIn){window.localStorage.setItem("wk_logged_in","1"),await this.load(),await this.loadWishlist({wishlistId:"mine",strategy:"cache-or-network"});let t=this.getPendingWishlistAction();this.events.publish({name:"wk:customer:login",data:{pending:t}})}else e&&!this.isLoggedIn&&(await this.load(),window.localStorage.removeItem("wk_logged_in"),this.events.publish({name:"wk:customer:logout",data:{}}));["challenge","account"].includes(this.theme.getPageType())||window.localStorage.removeItem("wk_pending")}async initCustomerSession(){this.hasSession||(await this.clearCustomerSession(),this.events.once("wk:app:init-sid",e=>{var t,s;(t=e.data)!=null&&t.sessionId&&this.setSessionId((s=e.data)==null?void 0:s.sessionId)}))}async clearCustomerSession(){window.localStorage.removeItem("wk_session_id"),window.localStorage.removeItem("wk_pending"),await this.state.promise.clearCache()}getPendingWishlistAction(){try{let e=window.localStorage.getItem("wk_pending");if(e)return JSON.parse(e)}catch(e){console.warn("Could not parse pending wishlist action",e)}}initUrlChangeEvents(){let e=({productHandle:s,variantId:r})=>{this.events.publish({name:"wk:product:change-variant:success",data:{productHandle:s,variantId:r}})},t=s=>(...r)=>{var c;let o=s.apply(history,r),n=typeof r[2]=="string"?r[2]:(c=r[2])==null?void 0:c.toString();if(!n)return o;n.startsWith("?")&&(n=window.location.pathname+n);let a=`${window.location.protocol}//${window.location.host}`,h=new URL(n,a),u=this.theme.getProductHandle(h),l=h.searchParams.get("variant");if(!u)return o;e({productHandle:u,variantId:l?parseInt(l):void 0})};history.replaceState=t(history.replaceState),history.pushState=t(history.pushState)}parseConfig({config:e}){var t,s,r,o,n,a,h,u;return{customer:{id:e.customerId?e.customerId:null,email:(t=e.customerEmail)!=null?t:""},shop:{name:(s=e.shopName)!=null?s:"",domain:(r=e.shopDomain)!=null?r:"",permanentDomain:(o=e.shopPermanentDomain)!=null?o:"",moneyFormat:(n=e.shopMoneyFormat)!=null?n:"",moneyFormatWithCurrency:(a=e.shopMoneyFormatWithCurrency)!=null?a:"",customerAccountsEnabled:e.shopCustomerAccountsEnabled?e.shopCustomerAccountsEnabled==="true":!1},routes:{apiHost:(h=e.apiHost)!=null?h:"https://api.appmate.io/v2",rootUrl:window.Shopify.routes.root,fileUrl:e.fileUrl},products:{fallbackImage:(u=e.productFallbackImage)!=null?u:"//cdn.shopify.com/s/files/1/0533/2089/files/placeholder-images-image_large.png?format=webp&v=1530129081",metafields:!!e.productMetafields}}}parseSettings({settings:e}){var t,s,r,o,n,a,h,u,l,c,p,y,A,m,d,w,b,F,C,j,k,T,P,L,$,q,B;return{general:{appLoading:(s=(t=e==null?void 0:e.general)==null?void 0:t.appLoading)!=null?s:"LAZY",wishlistAccessMode:(o=(r=e==null?void 0:e.general)==null?void 0:r.wishlistAccessMode)!=null?o:"UNRESTRICTED",wishlistMode:(a=(n=e==null?void 0:e.general)==null?void 0:n.wishlistMode)!=null?a:"PRODUCT",wishlistPath:(u=(h=e==null?void 0:e.general)==null?void 0:h.wishlistPath)!=null?u:"/apps/wishlist"},money:{withCurrency:(c=(l=e==null?void 0:e.money)==null?void 0:l.withCurrency)!=null?c:!1},integrations:{googleAnalytics:{enabled:(A=(y=(p=e.integrations)==null?void 0:p.googleAnalytics)==null?void 0:y.enabled)!=null?A:!1,tracker:(w=(d=(m=e.integrations)==null?void 0:m.googleAnalytics)==null?void 0:d.tracker)!=null?w:""},klaviyo:{enabled:(C=(F=(b=e.integrations)==null?void 0:b.klaviyo)==null?void 0:F.enabled)!=null?C:!1},metaPixel:{enabled:(T=(k=(j=e.integrations)==null?void 0:j.metaPixel)==null?void 0:k.enabled)!=null?T:!1},wishlistAnalytics:{enabled:($=(L=(P=e.integrations)==null?void 0:P.metaPixel)==null?void 0:L.enabled)!=null?$:!0}},cache:{wishlist:{ttl:6e4},wishlistItem:{ttl:6e4},productInfo:{ttl:6e4},product:{ttl:3e4},cart:{ttl:1e3}},colorMap:(q=e.colorMap)!=null?q:{},collectionButtons:(B=e.collectionButtons)!=null?B:{}}}parseRoutes(){let e=this.config.routes.rootUrl;return{rootUrl:e,fileUrl:this.config.routes.fileUrl,wishlistUrl:e+this.settings.general.wishlistPath.split("/").filter(t=>!!t).join("/"),accountUrl:e+"account",accountLoginUrl:e+"account/login",accountLogoutUrl:e+"account/logout",accountRegisterUrl:e+"account/register",accountAddressesUrl:e+"account/addresses",collectionsUrl:e+"collections",allProductsCollectionUrl:e+"collections/all",searchUrl:e+"search",predictiveSearchUrl:e+"search/suggest",cartUrl:e+"cart",cartAddUrl:e+"cart/add",cartChangeUrl:e+"cart/change",cartClearUrl:e+"cart/clear",cartUpdateUrl:e+"cart/update",productRecommendationsUrl:e+"recommendations/products"}}parseDependencies(e){let t=this.isDevMode();return e.map(s=>this.parseDependencyUrl({url:s,noCache:t})).reduce(({stylesheets:s,scripts:r,iconSetUrl:o,localeUrl:n},a)=>{let[h]=a.split("?");return h.endsWith(".css")?s.push(a):h.endsWith("icons.js")?o=a:h.endsWith(".js")?r.push(a):h.endsWith(".json")&&(n=a),{stylesheets:s,scripts:r,iconSetUrl:o,localeUrl:n}},{stylesheets:[],scripts:[],iconSetUrl:"",localeUrl:""})}parseDependencyUrl({url:e,noCache:t}){return t&&!e.includes("/_templates/")?e.replace("cdn.appmate.io","storage.googleapis.com/appmate-cdn").replace(/v=\d*/,`v=${Date.now()}`):e}isDevMode(){if(!!!document.getElementById("preview-bar-iframe"))return!1;let t=window.localStorage.getItem("wk_dev_mode");return t?Date.now()-parseInt(t)<8*36e5:!1}initDevMode(){window.location.search.includes("wk_dev_mode=on")?(W("Activate dev mode"),window.localStorage.setItem("wk_dev_mode",Date.now().toString())):window.location.search.includes("wk_dev_mode=off")&&(W("Deactivate dev mode"),window.localStorage.removeItem("wk_dev_mode")),this.isDevMode()&&(W("Dev mode active"),window.addEventListener("message",e=>{switch(e.data){case"WK_THEME_RELOAD":window.localStorage.setItem("wk_dev_mode",Date.now().toString()),window.location.reload();break}},!1))}},O=i=>{if(!i)throw new Error("Wishlist app not loaded.");return i};export{X as WishlistApp}; | ||
var te=Object.create;var J=Object.defineProperty;var se=Object.getOwnPropertyDescriptor;var ie=Object.getOwnPropertyNames;var re=Object.getPrototypeOf,oe=Object.prototype.hasOwnProperty;var N=(i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports);var ne=(i,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of ie(e))!oe.call(i,r)&&r!==t&&J(i,r,{get:()=>e[r],enumerable:!(s=se(e,r))||s.enumerable});return i};var ae=(i,e,t)=>(t=i!=null?te(re(i)):{},ne(e||!i||!i.__esModule?J(t,"default",{value:i,enumerable:!0}):t,i));var z=N((He,G)=>{var S=1e3,U=S*60,E=U*60,v=E*24,ce=v*7,he=v*365.25;G.exports=function(i,e){e=e||{};var t=typeof i;if(t==="string"&&i.length>0)return pe(i);if(t==="number"&&isFinite(i))return e.long?ue(i):de(i);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(i))};function pe(i){if(i=String(i),!(i.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(i);if(e){var t=parseFloat(e[1]),s=(e[2]||"ms").toLowerCase();switch(s){case"years":case"year":case"yrs":case"yr":case"y":return t*he;case"weeks":case"week":case"w":return t*ce;case"days":case"day":case"d":return t*v;case"hours":case"hour":case"hrs":case"hr":case"h":return t*E;case"minutes":case"minute":case"mins":case"min":case"m":return t*U;case"seconds":case"second":case"secs":case"sec":case"s":return t*S;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return t;default:return}}}}function de(i){var e=Math.abs(i);return e>=v?Math.round(i/v)+"d":e>=E?Math.round(i/E)+"h":e>=U?Math.round(i/U)+"m":e>=S?Math.round(i/S)+"s":i+"ms"}function ue(i){var e=Math.abs(i);return e>=v?H(i,e,v,"day"):e>=E?H(i,e,E,"hour"):e>=U?H(i,e,U,"minute"):e>=S?H(i,e,S,"second"):i+" ms"}function H(i,e,t,s){var r=e>=t*1.5;return Math.round(i/t)+" "+s+(r?"s":"")}});var Z=N((De,Q)=>{function me(i){t.debug=t,t.default=t,t.coerce=h,t.disable=o,t.enable=r,t.enabled=n,t.humanize=z(),t.destroy=u,Object.keys(i).forEach(l=>{t[l]=i[l]}),t.names=[],t.skips=[],t.formatters={};function e(l){let c=0;for(let p=0;p<l.length;p++)c=(c<<5)-c+l.charCodeAt(p),c|=0;return t.colors[Math.abs(c)%t.colors.length]}t.selectColor=e;function t(l){let c,p=null,y,A;function m(...d){if(!m.enabled)return;let w=m,b=Number(new Date),F=b-(c||b);w.diff=F,w.prev=c,w.curr=b,c=b,d[0]=t.coerce(d[0]),typeof d[0]!="string"&&d.unshift("%O");let C=0;d[0]=d[0].replace(/%([a-zA-Z%])/g,(k,T)=>{if(k==="%%")return"%";C++;let P=t.formatters[T];if(typeof P=="function"){let L=d[C];k=P.call(w,L),d.splice(C,1),C--}return k}),t.formatArgs.call(w,d),(w.log||t.log).apply(w,d)}return m.namespace=l,m.useColors=t.useColors(),m.color=t.selectColor(l),m.extend=s,m.destroy=t.destroy,Object.defineProperty(m,"enabled",{enumerable:!0,configurable:!1,get:()=>p!==null?p:(y!==t.namespaces&&(y=t.namespaces,A=t.enabled(l)),A),set:d=>{p=d}}),typeof t.init=="function"&&t.init(m),m}function s(l,c){let p=t(this.namespace+(typeof c=="undefined"?":":c)+l);return p.log=this.log,p}function r(l){t.save(l),t.namespaces=l,t.names=[],t.skips=[];let c,p=(typeof l=="string"?l:"").split(/[\s,]+/),y=p.length;for(c=0;c<y;c++)p[c]&&(l=p[c].replace(/\*/g,".*?"),l[0]==="-"?t.skips.push(new RegExp("^"+l.slice(1)+"$")):t.names.push(new RegExp("^"+l+"$")))}function o(){let l=[...t.names.map(a),...t.skips.map(a).map(c=>"-"+c)].join(",");return t.enable(""),l}function n(l){if(l[l.length-1]==="*")return!0;let c,p;for(c=0,p=t.skips.length;c<p;c++)if(t.skips[c].test(l))return!1;for(c=0,p=t.names.length;c<p;c++)if(t.names[c].test(l))return!0;return!1}function a(l){return l.toString().substring(2,l.toString().length-2).replace(/\.\*\?$/,"*")}function h(l){return l instanceof Error?l.stack||l.message:l}function u(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return t.enable(t.load()),t}Q.exports=me});var Y=N((f,D)=>{f.formatArgs=fe;f.save=we;f.load=ye;f.useColors=ge;f.storage=be();f.destroy=(()=>{let i=!1;return()=>{i||(i=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();f.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function ge(){return typeof window!="undefined"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document!="undefined"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window!="undefined"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function fe(i){if(i[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+i[0]+(this.useColors?"%c ":" ")+"+"+D.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;i.splice(1,0,e,"color: inherit");let t=0,s=0;i[0].replace(/%[a-zA-Z%]/g,r=>{r!=="%%"&&(t++,r==="%c"&&(s=t))}),i.splice(s,0,e)}f.log=console.debug||console.log||(()=>{});function we(i){try{i?f.storage.setItem("debug",i):f.storage.removeItem("debug")}catch(e){}}function ye(){let i;try{i=f.storage.getItem("debug")}catch(e){}return!i&&typeof process!="undefined"&&"env"in process&&(i=process.env.DEBUG),i}function be(){try{return localStorage}catch(i){}}D.exports=Z()(f);var{formatters:Ce}=D.exports;Ce.j=function(i){try{return JSON.stringify(i)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var V=(i=21)=>crypto.getRandomValues(new Uint8Array(i)).reduce((e,t)=>(t&=63,t<36?e+=t.toString(36):t<62?e+=(t-26).toString(36).toUpperCase():t>62?e+="-":e+="_",e),"");var g=class{constructor(e){this.element=e}replace(e){var t;return(t=this.element)==null||t.replaceWith(e),e}append(e){var t;return(t=this.element)==null||t.append(e),e}prepend(e){var t;return(t=this.element)==null||t.prepend(e),e}insertBefore(e){var t;return(t=this.element)==null||t.before(e),e}insertAfter(e){var t;return(t=this.element)==null||t.after(e),e}closest(e,t=5){if(!this.element)return new g;if(typeof e=="object")return this.searchByStyle(e,this.element,r=>r.parentElement,t);let s=this.element.closest(e);return s?new g(s):new g}find(e){var s;let t=(s=this.element)==null?void 0:s.querySelector(e);return t?new g(t):new g}searchByStyle(e,t,s,r=5){if(r<0||!t)return null;let o=getComputedStyle(t);if(Object.entries(e).every(([h,u])=>o.getPropertyValue(h)===u))return new g(t);let a=s(t);return a?this.searchByStyle(e,a,s,r-1):null}};var M=class{constructor({routeUtil:e}){this.subscriber=[],this.routeUtil=e,this.observer=new MutationObserver(t=>{t.reduce((s,r)=>s.concat(Array.from(r.addedNodes)),[]).filter(s=>s instanceof Element&&!s.hasAttribute("wk-skip")).forEach(s=>{s instanceof Element&&this.scan(s)})}),this.observer.observe(document,{subtree:!0,childList:!0,attributes:!1})}watch(e,t){let s={target:e,callback:t};this.subscriber.push(s),K(s,this.routeUtil.parse(window.location.pathname))&&this.scan(document)}shouldSkip(e,{skipHidden:t}){return t&&e instanceof HTMLElement?e.offsetParent===null:!1}scan(e){e&&this.subscriber.filter(t=>K(t,this.routeUtil.parse(window.location.pathname))).forEach(t=>{let s=e instanceof Element&&e.matches(t.target.selector)&&!this.shouldSkip(e,{skipHidden:!!t.target.skipHidden});if(s&&this.notify(t,e),s&&t.target.firstMatch)return;let r=e.querySelectorAll(t.target.selector);for(let o of r)if(!this.shouldSkip(o,{skipHidden:!!t.target.skipHidden})&&(this.notify(t,o),t.target.firstMatch))break})}notify(e,t){if(!t.hasAttribute("wk-skip")){t.setAttribute("wk-skip","");let s=new g(t);e.callback(s)}}};function K({target:i},e){if(!i.pageType)return!0;if(!e.pageType)return!1;let t=Array.isArray(i.pageType)?i.pageType:[i.pageType];return t.includes("all")?!0:t.includes(e.pageType)}var le=[{pageType:"product",match:i=>i.includes("/products/")},{pageType:"collection",match:i=>i.includes("/collections/")&&!i.includes("/products/")},{pageType:"account",match:i=>i.includes("/account/")||i.endsWith("/account")},{pageType:"challenge",match:i=>i.endsWith("/account")},{pageType:"blog",match:i=>i.includes("/blog/")},{pageType:"cart",match:i=>i.includes("/cart/")||i.endsWith("/cart")},{pageType:"wishlist",match:(i,{wishlistUrl:e})=>i.includes(e)},{pageType:"page",match:i=>i.includes("/pages/")},{pageType:"search",match:i=>i.includes("/search")},{pageType:"home",match:i=>i.length<4}],R=class{constructor({wishlistUrl:e}){this.wishlistUrl=e}parse(e){for(let t of le)if(t.match(e,{wishlistUrl:this.wishlistUrl}))return{pageType:t.pageType};return{pageType:"unknown"}}};var _=class{constructor(e){this.locale={};var t;this.initLocale((t=e==null?void 0:e.locale)!=null?t:{})}initLocale(e){this.locale=this.decodeLocale(e)}decodeHtmlEntities(e){return e.replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'")}decodeLocale(e){let t={};for(let s in e){t[s]={};for(let r in e[s])t[s][r]=this.decodeHtmlEntities(e[s][r])}return t}translate(e,t){var n;let[s,r]=e.split("."),o=(n=this.locale[s])==null?void 0:n[r];return o?t?Object.entries(t).reduce((a,[h,u])=>a.replace(new RegExp(`{{\\s*${h}\\s*}}`,"g"),u),o):o:`translation missing: ${e}`}};var I=class{constructor({rootUrl:e,wishlistUrl:t}){this._rootUrl=e,this.route=new R({wishlistUrl:t}),this.observer=new M({routeUtil:this.route}),this.locale=new _,this.watch=this.observer.watch.bind(this.observer)}getPageType(e=window.location.pathname){return this.route.parse(e).pageType}getWishlistId(e){if(!e)return null;e instanceof URL&&(e=e.pathname);let t=e.replace(this._rootUrl,"/").split("/");return t.length===4?t.pop():"mine"}getProductHandle(e){var t,s;return e?(e instanceof URL&&(e=e.pathname),(s=(t=e.split("/").pop())==null?void 0:t.split("?")[0])==null?void 0:s.split("#")[0]):null}getVariantId(e,t){var r;let s=null;if(e&&(e instanceof URL&&(e=e.pathname),s=new URLSearchParams(e.split("?")[1]).get("variant")),!s&&t)try{s=new FormData((r=t.element)!=null?r:t).get("id")}catch(o){console.warn("Failed to parse variant from product form.",o)}return s}translate(e,t){return this.locale.translate(e,t)}createComponent(e,t){var r;let s=document.createElement(e);if(t!=null&&t.dataset&&Object.entries(t==null?void 0:t.dataset).forEach(([o,n])=>{n&&(typeof n=="boolean"?s.dataset[o]="":typeof n=="object"?s.dataset[o]=JSON.stringify(n):s.dataset[o]=n)}),t!=null&&t.props&&Object.entries(t==null?void 0:t.props).forEach(([o,n])=>{if(o==="floating"&&n){let a=n,h=(a==null?void 0:a.reference)instanceof g?a.reference.element:a.reference;if(typeof h=="object"&&"id"in h){h.setAttribute("wk-id",V()),s[o]={...a,reference:`[wk-id="${h.getAttribute("wk-id")}"]`};return}}s[o]=n}),(r=t==null?void 0:t.wrap)!=null&&r.name){let o=this.createElement(t.wrap.name,t.wrap.props,s);return o.setAttribute("wk-skip",""),o}return s}createHeadlessComponent(e,t){var o;let s=t.host.element?t.host.element:t.host;if(!s)throw new Error("Headless host is undefined");t.dataset&&Object.entries(t.dataset).forEach(([n,a])=>{a&&(typeof a=="boolean"?s.dataset[n]="":typeof a=="object"?s.dataset[n]=JSON.stringify(a):s.dataset[n]=a)});let r=(o=window.headlessElements)==null?void 0:o.store.get(e);if(!r)throw new Error(`Headless element not found: ${e}`);return new r(s)}createElement(e,t={},...s){let r=Object.assign(document.createElement(e),t);return s&&r.append(...s),r}};var x=class{constructor(){this.dispatcher=document}publish(e){this.dispatcher.dispatchEvent(new CustomEvent(e.name,{detail:e,bubbles:!1,cancelable:!1}))}once(e,t){let s=r=>{this.dispatcher.removeEventListener(e,s),t(r)};this.subscribe(e,s)}subscribe(e,t){this.dispatcher.addEventListener(e,s=>{let r=s;t({name:r.type,data:r.detail.data})})}subscribeMany(e){return Object.entries(e).map(([t,s])=>this.subscribe(t,s))}};var ee=ae(Y()),W=(0,ee.default)("wk:app");window.headlessElements||(window.headlessElements={store:new Map,define(i,e){var t;(t=window.headlessElements)==null||t.store.set(i,e)}});var X=class{constructor({dependencies:e=[],...t}){this.stylesLoaded=!1;this._loaded=!1;this.addToCart=e=>this.state.promise.addToCart(e);this.addAllToCart=e=>this.state.promise.addAllToCart(e);this.addWishlistItem=e=>this.state.promise.addWishlistItem(e);this.clearWishlist=()=>this.state.promise.clearWishlist();this.loadProductInfo=e=>this.state.promise.loadProductInfo(e);this.loadShopifyProduct=e=>this.state.promise.loadShopifyProduct(e);this.loadWishlist=e=>this.state.promise.loadWishlist(e);this.loadWishlistItem=e=>this.state.promise.loadWishlistItem(e);this.publishWishlistEvent=e=>this.state.promise.publishWishlistEvent(e);this.publishWishlistProductEvent=e=>this.state.promise.publishWishlistProductEvent(e);this.removeWishlistItem=e=>this.state.promise.removeWishlistItem(e);this.shareWishlist=e=>this.state.promise.shareWishlist(e);this.updateWishlistItem=e=>this.state.promise.updateWishlistItem(e);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}:null,W("Create app",{config:this.config,settings:this.settings,customer:this.customer}),this.events=new x,this.theme=new I({rootUrl:this.routes.rootUrl,wishlistUrl:this.routes.wishlistUrl}),this.initDevMode();let{stylesheets:s,scripts:r,iconSetUrl:o,localeUrl:n}=this.parseDependencies(e);W("Init dependecies",{dependencies:e,stylesheets:s,scripts:r,iconSetUrl:o,localeUrl:n}),this.initStyles({stylesheets:s,iconSetUrl:o,localeUrl:n}),this.initScripts(r),this.initLoginActionQueue(),(this.hasSession||this.settings.general.appLoading==="EAGER")&&this.load(),window.WishlistKing=this,this.events.publish({name:"wk:app:created",data:{}})}get loaded(){return this._loaded}get state(){return O(this._state)}get apis(){return O(this._apis)}get utils(){return O(this._utils)}get hasSession(){return!!this.getSessionId()||!!this.customer}get isLoggedIn(){var e;return!!((e=this.customer)!=null&&e.id)}getSessionId(){let e=window.localStorage.getItem("wk_session_id");if(e)return e;let t=window.localStorage.getItem("appmate-session");if(t)try{let s=JSON.parse(t).state.sid;return this.setSessionId(s)}catch(s){console.error(s)}}setSessionId(e){var t;return window.localStorage.setItem("wk_session_id",e),(t=this._apis)==null||t.tracking.setSessionId(e),e}async load(){return this._loadPromise?this._loadPromise:(W("Load remaining app code"),this._loadPromise=(async()=>{let[{WishlistState:e},{ShopifyApi:t,WishlistApi:s,TrackingApi:r},{MoneyUtil:o,UrlUtil:n,ProductUtil:a}]=await Promise.all([import("https://cdn.jsdelivr.net/npm/@appmate/wishlist@4.25.28/state.js"),import("https://cdn.jsdelivr.net/npm/@appmate/wishlist@4.25.28/api.js"),import("https://cdn.jsdelivr.net/npm/@appmate/wishlist@4.25.28/utils.js")]);this.initUtils({MoneyUtil:o,UrlUtil:n,ProductUtil:a}),this.initApis({WishlistApi:s,ShopifyApi:t,TrackingApi:r}),await this.initState({WishlistState:e}),this.initCustomerSession(),this.initUrlChangeEvents(),this.trackCurrentPage(),this._loaded=!0,this.events.publish({name:"wk:app:loaded",data:{}})})())}initUtils({UrlUtil:e,MoneyUtil:t,ProductUtil:s}){this._utils={url:new e({rootUrl:this.routes.rootUrl,wishlistUrl:this.routes.wishlistUrl,shopDomain:this.config.shop.domain,placeholderImageUrl:this.config.products.fallbackImage,fileUrl:this.routes.fileUrl}),money:new t({moneyFormat:this.config.shop.moneyFormat,moneyFormatWithCurrency:this.config.shop.moneyFormatWithCurrency}),product:new s}}initApis({WishlistApi:e,ShopifyApi:t,TrackingApi:s}){var r,o,n;this._apis={wishlist:new e({host:this.config.routes.apiHost,shop:this.config.shop.permanentDomain,customerId:(r=this.config.customer.id)!=null?r:void 0,sessionId:this.getSessionId(),trackingSource:this.theme.getPageType(),productMetafields:this.config.products.metafields}),shopify:new t({host:window.Shopify.routes.root.substring(0,window.Shopify.routes.root.length-1)}),tracking:new s({notifyHost:this.config.routes.apiHost,events:this.events,shop:this.config.shop.permanentDomain,customerId:(o=this.config.customer.id)!=null?o:void 0,customerEmail:(n=this.config.customer.email)!=null?n:void 0,sessionId:this.getSessionId(),utils:this.utils,theme:this.theme,settings:this.settings})}}initState({WishlistState:e}){return this._state=new e({wishlistApi:this.apis.wishlist,shopifyApi:this.apis.shopify,settings:this.settings,events:this.events,utils:this.utils}),this._state.init()}async initStyles({stylesheets:e,iconSetUrl:t,localeUrl:s}){if(!(e!=null&&e.length)&&!t){this.onStylesLoaded();return}try{await Promise.all([...(e!=null?e:[]).map(r=>new Promise((o,n)=>{let a=document.createElement("link");a.rel="stylesheet",a.href=r,a.onload=o,a.onerror=n,document.head.appendChild(a)})),t?Promise.all([import("https://cdn.jsdelivr.net/npm/@appmate/wishlist@4.25.28/components/icon.js"),import(t)]).then(([{Icon:r},{icons:o}])=>{if(typeof o!="object")throw new Error("Icon set must export icons object.");r.addIcons(o)}):Promise.resolve(),s?fetch(s).then(r=>r.json()).then(r=>{this.theme.locale.initLocale(r)}):Promise.resolve()]),this.onStylesLoaded()}catch(r){console.warn(r),this.events.publish({name:"wk:app:load-styles:error",data:{}})}}async initScripts(e){if(!(e!=null&&e.length)){this.initDefaultEventSubscribers(),this.events.publish({name:"wk:app:load-scripts:success",data:{}});return}try{await Promise.all(e.map(t=>import(t).then(({setup:s})=>{typeof s=="function"&&s({app:this})}))),e.some(t=>t.includes("event-subscribers.js"))||this.initDefaultEventSubscribers(),this.events.publish({name:"wk:app:load-scripts:success",data:{}})}catch(t){console.warn(t),this.events.publish({name:"wk:app:load-scripts:error",data:{}})}}initDefaultEventSubscribers(){this.events.subscribe("wk:wishlist:login-required",e=>{window.location.href=this.routes.accountLoginUrl}),this.events.subscribe("wk:customer:login",e=>{if(e.data.pending)switch(e.data.pending.action){case"wishlist:add":this.addWishlistItem(e.data.pending)}}),this.events.subscribe("wk:customer:logout",async e=>{this.clearCustomerSession()})}trackCurrentPage(){if(this.theme.getPageType()==="wishlist"){let t=this.theme.getWishlistId(window.location.pathname);t&&this.publishWishlistEvent({eventName:"wk:wishlist:page-view",wishlistId:t})}}onStylesLoaded(){this.stylesLoaded=!0,this.events.publish({name:"wk:app:load-styles:success",data:{}})}async initLoginActionQueue(){let e=!!window.localStorage.getItem("wk_logged_in");if(this.events.subscribe("wk:wishlist:login-required",t=>{var r;let s=["wishlist:add","wishlist:view"];(r=t.data)!=null&&r.action&&s.includes(t.data.action)&&window.localStorage.setItem("wk_pending",JSON.stringify({...t.data}))}),!e&&this.isLoggedIn){window.localStorage.setItem("wk_logged_in","1"),await this.load(),await this.loadWishlist({wishlistId:"mine",strategy:"cache-or-network"});let t=this.getPendingWishlistAction();this.events.publish({name:"wk:customer:login",data:{pending:t}})}else e&&!this.isLoggedIn&&(await this.load(),window.localStorage.removeItem("wk_logged_in"),this.events.publish({name:"wk:customer:logout",data:{}}));["challenge","account"].includes(this.theme.getPageType())||window.localStorage.removeItem("wk_pending")}async initCustomerSession(){this.hasSession||(await this.clearCustomerSession(),this.events.once("wk:app:init-sid",e=>{var t,s;(t=e.data)!=null&&t.sessionId&&this.setSessionId((s=e.data)==null?void 0:s.sessionId)}))}async clearCustomerSession(){window.localStorage.removeItem("wk_session_id"),window.localStorage.removeItem("wk_pending"),await this.state.promise.clearCache()}getPendingWishlistAction(){try{let e=window.localStorage.getItem("wk_pending");if(e)return JSON.parse(e)}catch(e){console.warn("Could not parse pending wishlist action",e)}}initUrlChangeEvents(){let e=({productHandle:s,variantId:r})=>{this.events.publish({name:"wk:product:change-variant:success",data:{productHandle:s,variantId:r}})},t=s=>(...r)=>{var c;let o=s.apply(history,r),n=typeof r[2]=="string"?r[2]:(c=r[2])==null?void 0:c.toString();if(!n)return o;n.startsWith("?")&&(n=window.location.pathname+n);let a=`${window.location.protocol}//${window.location.host}`,h=new URL(n,a),u=this.theme.getProductHandle(h),l=h.searchParams.get("variant");if(!u)return o;e({productHandle:u,variantId:l?parseInt(l):void 0})};history.replaceState=t(history.replaceState),history.pushState=t(history.pushState)}parseConfig({config:e}){var t,s,r,o,n,a,h,u;return{customer:{id:e.customerId?e.customerId:null,email:(t=e.customerEmail)!=null?t:""},shop:{name:(s=e.shopName)!=null?s:"",domain:(r=e.shopDomain)!=null?r:"",permanentDomain:(o=e.shopPermanentDomain)!=null?o:"",moneyFormat:(n=e.shopMoneyFormat)!=null?n:"",moneyFormatWithCurrency:(a=e.shopMoneyFormatWithCurrency)!=null?a:"",customerAccountsEnabled:e.shopCustomerAccountsEnabled?e.shopCustomerAccountsEnabled==="true":!1},routes:{apiHost:(h=e.apiHost)!=null?h:"https://api.appmate.io/v2",rootUrl:window.Shopify.routes.root,fileUrl:e.fileUrl},products:{fallbackImage:(u=e.productFallbackImage)!=null?u:"//cdn.shopify.com/s/files/1/0533/2089/files/placeholder-images-image_large.png?format=webp&v=1530129081",metafields:!!e.productMetafields}}}parseSettings({settings:e}){var t,s,r,o,n,a,h,u,l,c,p,y,A,m,d,w,b,F,C,j,k,T,P,L,$,q,B;return{general:{appLoading:(s=(t=e==null?void 0:e.general)==null?void 0:t.appLoading)!=null?s:"LAZY",wishlistAccessMode:(o=(r=e==null?void 0:e.general)==null?void 0:r.wishlistAccessMode)!=null?o:"UNRESTRICTED",wishlistMode:(a=(n=e==null?void 0:e.general)==null?void 0:n.wishlistMode)!=null?a:"PRODUCT",wishlistPath:(u=(h=e==null?void 0:e.general)==null?void 0:h.wishlistPath)!=null?u:"/apps/wishlist"},money:{withCurrency:(c=(l=e==null?void 0:e.money)==null?void 0:l.withCurrency)!=null?c:!1},integrations:{googleAnalytics:{enabled:(A=(y=(p=e.integrations)==null?void 0:p.googleAnalytics)==null?void 0:y.enabled)!=null?A:!1,tracker:(w=(d=(m=e.integrations)==null?void 0:m.googleAnalytics)==null?void 0:d.tracker)!=null?w:""},klaviyo:{enabled:(C=(F=(b=e.integrations)==null?void 0:b.klaviyo)==null?void 0:F.enabled)!=null?C:!1},metaPixel:{enabled:(T=(k=(j=e.integrations)==null?void 0:j.metaPixel)==null?void 0:k.enabled)!=null?T:!1},wishlistAnalytics:{enabled:($=(L=(P=e.integrations)==null?void 0:P.metaPixel)==null?void 0:L.enabled)!=null?$:!0}},cache:{wishlist:{ttl:6e4},wishlistItem:{ttl:6e4},productInfo:{ttl:6e4},product:{ttl:3e4},cart:{ttl:1e3}},colorMap:(q=e.colorMap)!=null?q:{},collectionButtons:(B=e.collectionButtons)!=null?B:{}}}parseRoutes(){let e=this.config.routes.rootUrl;return{rootUrl:e,fileUrl:this.config.routes.fileUrl,wishlistUrl:e+this.settings.general.wishlistPath.split("/").filter(t=>!!t).join("/"),accountUrl:e+"account",accountLoginUrl:e+"account/login",accountLogoutUrl:e+"account/logout",accountRegisterUrl:e+"account/register",accountAddressesUrl:e+"account/addresses",collectionsUrl:e+"collections",allProductsCollectionUrl:e+"collections/all",searchUrl:e+"search",predictiveSearchUrl:e+"search/suggest",cartUrl:e+"cart",cartAddUrl:e+"cart/add",cartChangeUrl:e+"cart/change",cartClearUrl:e+"cart/clear",cartUpdateUrl:e+"cart/update",productRecommendationsUrl:e+"recommendations/products"}}parseDependencies(e){let t=this.isDevMode();return e.map(s=>this.parseDependencyUrl({url:s,noCache:t})).reduce(({stylesheets:s,scripts:r,iconSetUrl:o,localeUrl:n},a)=>{let[h]=a.split("?");return h.endsWith(".css")?s.push(a):h.endsWith("icons.js")?o=a:h.endsWith(".js")?r.push(a):h.endsWith(".json")&&(n=a),{stylesheets:s,scripts:r,iconSetUrl:o,localeUrl:n}},{stylesheets:[],scripts:[],iconSetUrl:"",localeUrl:""})}parseDependencyUrl({url:e,noCache:t}){return t&&!e.includes("/_templates/")?e.replace("cdn.appmate.io","storage.googleapis.com/appmate-cdn").replace(/v=\d*/,`v=${Date.now()}`):e}isDevMode(){if(!!!document.getElementById("preview-bar-iframe"))return!1;let t=window.localStorage.getItem("wk_dev_mode");return t?Date.now()-parseInt(t)<8*36e5:!1}initDevMode(){window.location.search.includes("wk_dev_mode=on")?(W("Activate dev mode"),window.localStorage.setItem("wk_dev_mode",Date.now().toString())):window.location.search.includes("wk_dev_mode=off")&&(W("Deactivate dev mode"),window.localStorage.removeItem("wk_dev_mode")),this.isDevMode()&&(W("Dev mode active"),window.addEventListener("message",e=>{switch(e.data){case"WK_THEME_RELOAD":window.localStorage.setItem("wk_dev_mode",Date.now().toString()),window.location.reload();break}},!1))}},O=i=>{if(!i)throw new Error("Wishlist app not loaded.");return i};export{X as WishlistApp}; |
@@ -1,1 +0,1 @@ | ||
import{delayWhen as u,from as o,fromEvent as h,isObservable as f,map as b,of as l}from"https://cdn.jsdelivr.net/npm/rxjs@7.8.0/+esm";import{filter as c,first as v,switchMap as g,tap as d}from"https://cdn.jsdelivr.net/npm/rxjs@7.8.0/+esm";import{WishlistStateController as m}from"https://cdn.jsdelivr.net/npm/@appmate/wishlist@4.25.27/controllers.js";var p=class{constructor(t){this.connected=!1;this.cleanupMethods=[];this.eventPending=!1;this.firstConnect=!0;if(this.host=t,this.stateCtrl=new m(this),this.host.hasAttribute("wk-headless"))throw new Error("Headless component already initialised");this.host.setAttribute("wk-headless",""),this.host.setAttribute("wk-skip",""),this.initEvents(),this.connect(),this.firstConnect=!1}get app(){return this.stateCtrl.app}static get observedAttributes(){return["data-wishlist-id","data-wishlist-item-id","data-product-handle","data-product-id","data-variant-id"]}addController(t){}appReadyCallback(){this.host.dataset.productHandle&&this.app.events.subscribe("wk:product:change-variant:success",t=>{var s,r,e;if(this.host.dataset.productHandle===((s=t.data)==null?void 0:s.productHandle)&&((r=t.data)!=null&&r.variantId)){let n=this.productInfo?this.productInfo.wishlistItemId:void 0,i=this.productInfo?this.productInfo.variantId:void 0;n&&!i&&this.app.updateWishlistItem({wishlistItemId:n,changes:{variantId:(e=t.data)==null?void 0:e.variantId}}),this.host.dataset.variantId=t.data.variantId.toString(),this.connected&&this.initState()}})}async connect(){if(!this.connected){if(!this.app.stylesLoaded){h(document,"wk:app:load-styles:success").pipe(v()).subscribe(()=>this.connect());return}this.connected=!0,this.app.loaded?this.init():this.app.hasSession?(await this.app.load(),this.init()):(this.initFallbackState(),this.app.events.once("wk:app:loaded",()=>{this.init()}))}}getStateConfig(){return{}}init(){let{loading:t}=this.getStateConfig();t==="lazy"?(this.initFallbackState(),this.initObserver()):(this.initState(),this.appReadyCallback())}updated(){}setState(t){this.wishlist=t.wishlist,this.wishlistItem=t.wishlistItem,this.productInfo=t.productInfo,this.updated()}createRenderRoot(){return this}initState(){this.subscription&&this.subscription.unsubscribe(),this.subscription=this.stateCtrl.observe().subscribe(t=>{this.setState(t)})}initFallbackState(){let t=this.stateCtrl.getFallback();t&&this.setState(t)}initObserver(){var t;(t=this.observer)==null||t.disconnect(),this.observer=new IntersectionObserver(s=>this.handleIntersect(s),{root:null,rootMargin:"0px"}),this.host.setAttribute("wk-lazy",""),this.observer.observe(this.host)}handleIntersect([t]){var s;t.isIntersecting&&(this.host.removeAttribute("wk-lazy"),(s=this.observer)==null||s.disconnect(),this.initState(),this.appReadyCallback())}getEventConfig(){return{}}initEvents(){let t=this.getEventConfig();if(!t)return;let s=Object.entries(t).map(([r,e])=>{let[n,i]=r.split(/ (.*)/s);return this.subscribeToEvent({eventName:n,selector:i,handler:e})});this.cleanupMethods.push(()=>s.forEach(r=>r.unsubscribe()))}subscribeToEvent({eventName:t,handler:s,selector:r}){return h(this.host,t).pipe(d(e=>{this.eventPending&&e.preventDefault()}),c(()=>!this.eventPending),d(()=>{this.eventPending=!0}),b(e=>e.target instanceof Element?{event:e,target:r?e.target.closest(r):e.currentTarget}:{event:e,target:null}),c(({target:e})=>!!e),u(e=>this.app.hasSession?l(e):o(this.app.load())),g(({event:e,target:n})=>{let i;try{i=s.bind(this)(e,n)}catch(a){console.error(a),i=a}return f(i)?i:typeof(i==null?void 0:i.then)=="function"?o(i):l(i)})).subscribe(()=>{this.eventPending=!1})}};export{p as WishlistElementHeadless}; | ||
import{delayWhen as u,from as o,fromEvent as h,isObservable as f,map as b,of as l}from"https://cdn.jsdelivr.net/npm/rxjs@7.8.0/+esm";import{filter as c,first as v,switchMap as g,tap as d}from"https://cdn.jsdelivr.net/npm/rxjs@7.8.0/+esm";import{WishlistStateController as m}from"https://cdn.jsdelivr.net/npm/@appmate/wishlist@4.25.28/controllers.js";var p=class{constructor(t){this.connected=!1;this.cleanupMethods=[];this.eventPending=!1;this.firstConnect=!0;if(this.host=t,this.stateCtrl=new m(this),this.host.hasAttribute("wk-headless"))throw new Error("Headless component already initialised");this.host.setAttribute("wk-headless",""),this.host.setAttribute("wk-skip",""),this.initEvents(),this.connect(),this.firstConnect=!1}get app(){return this.stateCtrl.app}static get observedAttributes(){return["data-wishlist-id","data-wishlist-item-id","data-product-handle","data-product-id","data-variant-id"]}addController(t){}appReadyCallback(){this.host.dataset.productHandle&&this.app.events.subscribe("wk:product:change-variant:success",t=>{var s,r,e;if(this.host.dataset.productHandle===((s=t.data)==null?void 0:s.productHandle)&&((r=t.data)!=null&&r.variantId)){let n=this.productInfo?this.productInfo.wishlistItemId:void 0,i=this.productInfo?this.productInfo.variantId:void 0;n&&!i&&this.app.updateWishlistItem({wishlistItemId:n,changes:{variantId:(e=t.data)==null?void 0:e.variantId}}),this.host.dataset.variantId=t.data.variantId.toString(),this.connected&&this.initState()}})}async connect(){if(!this.connected){if(!this.app.stylesLoaded){h(document,"wk:app:load-styles:success").pipe(v()).subscribe(()=>this.connect());return}this.connected=!0,this.app.loaded?this.init():this.app.hasSession?(await this.app.load(),this.init()):(this.initFallbackState(),this.app.events.once("wk:app:loaded",()=>{this.init()}))}}getStateConfig(){return{}}init(){let{loading:t}=this.getStateConfig();t==="lazy"?(this.initFallbackState(),this.initObserver()):(this.initState(),this.appReadyCallback())}updated(){}setState(t){this.wishlist=t.wishlist,this.wishlistItem=t.wishlistItem,this.productInfo=t.productInfo,this.updated()}createRenderRoot(){return this}initState(){this.subscription&&this.subscription.unsubscribe(),this.subscription=this.stateCtrl.observe().subscribe(t=>{this.setState(t)})}initFallbackState(){let t=this.stateCtrl.getFallback();t&&this.setState(t)}initObserver(){var t;(t=this.observer)==null||t.disconnect(),this.observer=new IntersectionObserver(s=>this.handleIntersect(s),{root:null,rootMargin:"0px"}),this.host.setAttribute("wk-lazy",""),this.observer.observe(this.host)}handleIntersect([t]){var s;t.isIntersecting&&(this.host.removeAttribute("wk-lazy"),(s=this.observer)==null||s.disconnect(),this.initState(),this.appReadyCallback())}getEventConfig(){return{}}initEvents(){let t=this.getEventConfig();if(!t)return;let s=Object.entries(t).map(([r,e])=>{let[n,i]=r.split(/ (.*)/s);return this.subscribeToEvent({eventName:n,selector:i,handler:e})});this.cleanupMethods.push(()=>s.forEach(r=>r.unsubscribe()))}subscribeToEvent({eventName:t,handler:s,selector:r}){return h(this.host,t).pipe(d(e=>{this.eventPending&&e.preventDefault()}),c(()=>!this.eventPending),d(()=>{this.eventPending=!0}),b(e=>e.target instanceof Element?{event:e,target:r?e.target.closest(r):e.currentTarget}:{event:e,target:null}),c(({target:e})=>!!e),u(e=>this.app.hasSession?l(e):o(this.app.load())),g(({event:e,target:n})=>{let i;try{i=s.bind(this)(e,n)}catch(a){console.error(a),i=a}return f(i)?i:typeof(i==null?void 0:i.then)=="function"?o(i):l(i)})).subscribe(()=>{this.eventPending=!1})}};export{p as WishlistElementHeadless}; |
@@ -1,1 +0,1 @@ | ||
import{delayWhen as f,from as c,fromEvent as l,isObservable as b,map as g,of as h}from"https://cdn.jsdelivr.net/npm/rxjs@7.8.0/+esm";import{filter as u,first as m,switchMap as y,tap as p}from"https://cdn.jsdelivr.net/npm/rxjs@7.8.0/+esm";import{LitElement as v}from"https://cdn.jsdelivr.net/gh/lit/dist@2.7.4/all/lit-all.min.js";import{unsafeHTML as d}from"https://cdn.jsdelivr.net/gh/lit/dist@2.7.4/all/lit-all.min.js";import{WishlistStateController as C}from"https://cdn.jsdelivr.net/npm/@appmate/wishlist@4.25.27/controllers.js";var a=class extends v{constructor(){super();this.connected=!1;this.cleanupMethods=[];this.eventPending=!1;this.firstConnect=!0;this.loadWithoutSession=!1;this.stateCtrl=new C(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(t,e,i){super.attributeChangedCallback(t,e,i),this.connected&&this.app.loaded&&this.initState()}appReadyCallback(){this.dataset.productHandle&&this.app.events.subscribe("wk:product:change-variant:success",t=>{var e,i;this.dataset.productHandle===((e=t.data)==null?void 0:e.productHandle)&&((i=t.data)!=null&&i.variantId)&&(this.dataset.variantId=t.data.variantId.toString())})}async connect(){if(!this.connected){if(!window.WishlistKing){window.document.addEventListener("wk:app:created",()=>{this.connect()},{once:!0});return}if(!this.app.stylesLoaded){l(document,"wk:app:load-styles:success").pipe(m()).subscribe(()=>this.connect());return}this.connected=!0,this.app.loaded?this.init():this.app.hasSession||this.loadWithoutSession?(await this.app.load(),this.init()):(this.initFallbackState(),this.app.events.once("wk:app:loaded",()=>{this.init()}))}}getStateConfig(){return{}}getTranslation(t,e){if(!this.app.theme)return t;let i=this.app.theme.translate(t,e);return t.endsWith("_html")?d(i):i}formatMoney(t,e){var i;return this.app.utils.money.formatMoney(t,{withCurrency:(i=e==null?void 0:e.withCurrency)!=null?i:this.app.settings.money.withCurrency})}renderMoney(t,e){return d(this.formatMoney(t,e))}getProductUrl(t,e){return this.app.utils.url.getVariantUrl(t.url,e==null?void 0:e.id)}getImageUrl(t,e,i){var s;return this.app.utils.url.getImageUrl((s=e==null?void 0:e.featured_image)!=null&&s.src?e:t,i)}init(){let{loading:t}=this.getStateConfig();t==="lazy"?(this.initFallbackState(),this.initObserver()):(this.initState(),this.appReadyCallback())}setState(t){t.wishlist&&(this.wishlist=t.wishlist),t.wishlistItem&&(this.wishlistItem=t.wishlistItem),t.productInfo&&(this.productInfo=t.productInfo),t.cart&&(this.cart=t.cart)}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this.innerHTML&&this.firstConnect&&(this.innerHTML=""),this.initEvents(),this.connect(),this.firstConnect=!1}disconnectedCallback(){var t,e;super.disconnectedCallback(),this.cleanupMethods.forEach(i=>i()),this.connected=!1,(t=this.subscription)==null||t.unsubscribe(),(e=this.observer)==null||e.disconnect()}shouldUpdate(t){return this.connected?super.shouldUpdate(t):!1}initState(){this.subscription&&this.subscription.unsubscribe(),this.subscription=this.stateCtrl.observe().subscribe(t=>{this.setState(t)})}initFallbackState(){let t=this.stateCtrl.getFallback();t&&this.setState(t)}initObserver(){var t,e;(t=this.observer)==null||t.disconnect(),this.observer=new IntersectionObserver(i=>this.handleIntersect(i),{root:null,rootMargin:"0px"}),this.setAttribute("wk-lazy",""),this.observer.observe((e=this.firstElementChild)!=null?e:this)}handleIntersect([t]){var e;t.isIntersecting&&(this.removeAttribute("wk-lazy"),(e=this.observer)==null||e.disconnect(),this.initState(),this.appReadyCallback())}getEventConfig(){return{}}initEvents(){let t=this.getEventConfig();if(!t)return;let e=Object.entries(t).map(([i,s])=>{let[n,r]=i.split(/ (.*)/s);return this.subscribeToEvent({eventName:n,selector:r,handler:s})});this.cleanupMethods.push(()=>e.forEach(i=>i.unsubscribe()))}subscribeToEvent({eventName:t,handler:e,selector:i}){return l(this,t).pipe(p(s=>{this.eventPending&&s.preventDefault()}),u(()=>!this.eventPending),p(()=>{this.eventPending=!0}),g(s=>s.target instanceof HTMLElement?{event:s,target:i?s.target.closest(i):s.currentTarget}:{event:s,target:null}),u(({target:s})=>!!s),f(s=>this.app.hasSession?h(s):c(this.app.load())),y(({event:s,target:n})=>{let r;try{r=e.bind(this)(s,n)}catch(o){console.error(o),r=o}return b(r)?r:typeof(r==null?void 0:r.then)=="function"?c(r):h(r)})).subscribe(()=>{this.eventPending=!1})}};a.properties={wishlist:{state:!0},productInfo:{state:!0},wishlistItem:{state:!0},cart:{state:!0},loadWithoutSession:{type:Boolean,attribute:"load-without-session"}};export{a as WishlistElement}; | ||
import{delayWhen as f,from as c,fromEvent as l,isObservable as b,map as g,of as h}from"https://cdn.jsdelivr.net/npm/rxjs@7.8.0/+esm";import{filter as u,first as m,switchMap as y,tap as p}from"https://cdn.jsdelivr.net/npm/rxjs@7.8.0/+esm";import{LitElement as v}from"https://cdn.jsdelivr.net/gh/lit/dist@2.7.4/all/lit-all.min.js";import{unsafeHTML as d}from"https://cdn.jsdelivr.net/gh/lit/dist@2.7.4/all/lit-all.min.js";import{WishlistStateController as C}from"https://cdn.jsdelivr.net/npm/@appmate/wishlist@4.25.28/controllers.js";var a=class extends v{constructor(){super();this.connected=!1;this.cleanupMethods=[];this.eventPending=!1;this.firstConnect=!0;this.loadWithoutSession=!1;this.stateCtrl=new C(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(t,e,i){super.attributeChangedCallback(t,e,i),this.connected&&this.app.loaded&&this.initState()}appReadyCallback(){this.dataset.productHandle&&this.app.events.subscribe("wk:product:change-variant:success",t=>{var e,i;this.dataset.productHandle===((e=t.data)==null?void 0:e.productHandle)&&((i=t.data)!=null&&i.variantId)&&(this.dataset.variantId=t.data.variantId.toString())})}async connect(){if(!this.connected){if(!window.WishlistKing){window.document.addEventListener("wk:app:created",()=>{this.connect()},{once:!0});return}if(!this.app.stylesLoaded){l(document,"wk:app:load-styles:success").pipe(m()).subscribe(()=>this.connect());return}this.connected=!0,this.app.loaded?this.init():this.app.hasSession||this.loadWithoutSession?(await this.app.load(),this.init()):(this.initFallbackState(),this.app.events.once("wk:app:loaded",()=>{this.init()}))}}getStateConfig(){return{}}getTranslation(t,e){if(!this.app.theme)return t;let i=this.app.theme.translate(t,e);return t.endsWith("_html")?d(i):i}formatMoney(t,e){var i;return this.app.utils.money.formatMoney(t,{withCurrency:(i=e==null?void 0:e.withCurrency)!=null?i:this.app.settings.money.withCurrency})}renderMoney(t,e){return d(this.formatMoney(t,e))}getProductUrl(t,e){return this.app.utils.url.getVariantUrl(t.url,e==null?void 0:e.id)}getImageUrl(t,e,i){var s;return this.app.utils.url.getImageUrl((s=e==null?void 0:e.featured_image)!=null&&s.src?e:t,i)}init(){let{loading:t}=this.getStateConfig();t==="lazy"?(this.initFallbackState(),this.initObserver()):(this.initState(),this.appReadyCallback())}setState(t){t.wishlist&&(this.wishlist=t.wishlist),t.wishlistItem&&(this.wishlistItem=t.wishlistItem),t.productInfo&&(this.productInfo=t.productInfo),t.cart&&(this.cart=t.cart)}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this.innerHTML&&this.firstConnect&&(this.innerHTML=""),this.initEvents(),this.connect(),this.firstConnect=!1}disconnectedCallback(){var t,e;super.disconnectedCallback(),this.cleanupMethods.forEach(i=>i()),this.connected=!1,(t=this.subscription)==null||t.unsubscribe(),(e=this.observer)==null||e.disconnect()}shouldUpdate(t){return this.connected?super.shouldUpdate(t):!1}initState(){this.subscription&&this.subscription.unsubscribe(),this.subscription=this.stateCtrl.observe().subscribe(t=>{this.setState(t)})}initFallbackState(){let t=this.stateCtrl.getFallback();t&&this.setState(t)}initObserver(){var t,e;(t=this.observer)==null||t.disconnect(),this.observer=new IntersectionObserver(i=>this.handleIntersect(i),{root:null,rootMargin:"0px"}),this.setAttribute("wk-lazy",""),this.observer.observe((e=this.firstElementChild)!=null?e:this)}handleIntersect([t]){var e;t.isIntersecting&&(this.removeAttribute("wk-lazy"),(e=this.observer)==null||e.disconnect(),this.initState(),this.appReadyCallback())}getEventConfig(){return{}}initEvents(){let t=this.getEventConfig();if(!t)return;let e=Object.entries(t).map(([i,s])=>{let[n,r]=i.split(/ (.*)/s);return this.subscribeToEvent({eventName:n,selector:r,handler:s})});this.cleanupMethods.push(()=>e.forEach(i=>i.unsubscribe()))}subscribeToEvent({eventName:t,handler:e,selector:i}){return l(this,t).pipe(p(s=>{this.eventPending&&s.preventDefault()}),u(()=>!this.eventPending),p(()=>{this.eventPending=!0}),g(s=>s.target instanceof HTMLElement?{event:s,target:i?s.target.closest(i):s.currentTarget}:{event:s,target:null}),u(({target:s})=>!!s),f(s=>this.app.hasSession?h(s):c(this.app.load())),y(({event:s,target:n})=>{let r;try{r=e.bind(this)(s,n)}catch(o){console.error(o),r=o}return b(r)?r:typeof(r==null?void 0:r.then)=="function"?c(r):h(r)})).subscribe(()=>{this.eventPending=!1})}};a.properties={wishlist:{state:!0},productInfo:{state:!0},wishlistItem:{state:!0},cart:{state:!0},loadWithoutSession:{type:Boolean,attribute:"load-without-session"}};export{a as WishlistElement}; |
Network access
Supply chain riskThis module accesses the network.
Found 3 instances in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 3 instances in 1 package
1038227