(()=>{var t={457:(t,e,n)=>{"use strict";n.d(e,{Z:()=>a});n(422);const a=new class{constructor(){return this.component=this.component.bind(this),this.component}component(t,e,...n){if("function"==typeof t)return t({...e,children:n});n&&(n=n.filter((t=>null!==t))),e&&(e.class&&(e.className=e.class),delete e.children);let a="fragment"!==t?function(t,e){e=e||{};let n=document.createElement(t);try{n=Object.assign(n,e)}catch{const t=Object.keys(e);for(let a=0;at.match(/^data-/)))&&(alert("Do not use data-* in your JSX component! Use dataSet instead!! - Check the console.trace for more info"),window.__aleartedJSXData=!0),e?.ref&&("function"==typeof e.ref?e.ref(a):e.ref=a),e?.on&&Object.entries(e.on).forEach((([t,e])=>{a.addEventListener(t,e)})),e?.style&&Object.entries(e.style).forEach((([t,e])=>{a.style.setProperty(t,e)})),a}}},422:()=>{!function(){function t(){var t=Array.prototype.slice.call(arguments),e=document.createDocumentFragment();t.forEach((function(t){var n=t instanceof Node;e.appendChild(n?t:document.createTextNode(String(t)))})),this.appendChild(e)}[Element.prototype,Document.prototype,DocumentFragment.prototype].forEach((function(e){e.hasOwnProperty("append")||Object.defineProperty(e,"append",{configurable:!0,enumerable:!0,writable:!0,value:t})}))}()}},e={};function n(a){var i=e[a];if(void 0!==i)return i.exports;var o=e[a]={exports:{}};return t[a](o,o.exports,n),o.exports}n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var a in e)n.o(e,a)&&!n.o(t,a)&&Object.defineProperty(t,a,{enumerable:!0,get:e[a]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),(()=>{"use strict";function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}function e(e){var n=function(e,n){if("object"!=t(e)||!e)return e;var a=e[Symbol.toPrimitive];if(void 0!==a){var i=a.call(e,n||"default");if("object"!=t(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(e)}(e,"string");return"symbol"==t(n)?n:n+""}function a(t,n,a){return(n=e(n))in t?Object.defineProperty(t,n,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[n]=a,t}var i=n(457).Z;function o(t){const{src:e,alt:n,style:a={},width:o=300,className:r="",loading:s="lazy",onLoad:u=()=>{},onError:l=()=>{}}=t;let d="";function c(){u&&u(),d.classList.add("foxkit-lazy-img--loaded"),d.removeEventListener("load",c),d.removeEventListener("error",m)}function m(t){l&&l(),d.style.opacity=0,d.removeEventListener("load",c),d.removeEventListener("error",m)}return e&&(d=i("img",{style:a,className:`foxkit-lazy-img ${r}`,src:`${e}&width=${o}`,loading:s,alt:n}),d.addEventListener("load",c),d.addEventListener("error",m),d.complete&&d.naturalWidth&&c()),d}var r=n(457).Z;const s=({className:t="",shortText:e=!1,plugin:n=""})=>{const a=function(t=""){return`https://apps.shopify.com/foxkit?utm_source=merchant_store&utm_medium=${t}&utm_campaign=brandmark`}(n);return r("div",{className:`foxkit-watermark ${t}`},"Powered by ",r("a",{href:a,target:"_blank"},"FoxKit",e?"":": All-in-one Sales Boost"))};var u=n(457).Z;function l({product:t,handleClick:e,hideOnMobile:n,message:a,time:i,handleRemove:r,handleMouseEnter:l,handleMouseLeave:d,position:c}){const{title:m,featured_image:h,handle:p}=t,{showWaterMark:f=!1}=window.FoxKitSettings,g=`${window.location.origin}${Shopify.routes.root}products/${p}`;return u("div",{className:`foxkit-sales-pop foxkit-sales-pop__${c} ${n?"hide-on-mobile":""}`,on:{mouseenter:l,mouseleave:d,click:e}},u("div",{className:"foxkit-sales-pop__inner foxkit-flex"},h?u("a",{href:g,className:"shrink-0",style:{width:"60px"}},u(o,{src:`${h}&width=200`,alt:m})):"",u("div",{className:"foxkit-sales-pop__info foxkit-flex-grow foxkit-flex foxkit-flex-col foxkit-justify-between"},u("div",{className:"foxkit-sales-pop__product"},a&&u("p",{className:"mb-1 text-sm line-clamp-2",style:{"padding-right":"32px"}},a),u("a",{className:"foxkit-sales-pop__title font-medium text-[18px] hover:text-color-primary-darker line-clamp-2",href:g},m)),i&&u("div",{className:"foxkit-items-center foxkit-sales-pop__meta"},u("svg",{className:"shrink-0",style:{width:"12px",height:"12px"},fill:"currentColor",stroke:"currentColor",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512"},u("path",{d:"M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm216 248c0 118.7-96.1 216-216 216-118.7 0-216-96.1-216-216 0-118.7 96.1-216 216-216 118.7 0 216 96.1 216 216zm-148.9 88.3l-81.2-59c-3.1-2.3-4.9-5.9-4.9-9.7V116c0-6.6 5.4-12 12-12h14c6.6 0 12 5.4 12 12v146.3l70.5 51.3c5.4 3.9 6.5 11.4 2.6 16.8l-8.2 11.3c-3.9 5.3-11.4 6.5-16.8 2.6z"})),u("span",null,i))),u("div",{className:"absolute foxkit-sales-pop-remove cursor-pointer bg-white",on:{click:r}},u("svg",{style:{width:"12px",height:"12px"},fill:"currentColor",stroke:"currentColor",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 320 512"},u("path",{d:"M193.94 256L296.5 153.44l21.15-21.15c3.12-3.12 3.12-8.19 0-11.31l-22.63-22.63c-3.12-3.12-8.19-3.12-11.31 0L160 222.06 36.29 98.34c-3.12-3.12-8.19-3.12-11.31 0L2.34 120.97c-3.12 3.12-3.12 8.19 0 11.31L126.06 256 2.34 379.71c-3.12 3.12-3.12 8.19 0 11.31l22.63 22.63c3.12 3.12 8.19 3.12 11.31 0L160 289.94 262.56 392.5l21.15 21.15c3.12 3.12 8.19 3.12 11.31 0l22.63-22.63c3.12-3.12 3.12-8.19 0-11.31L193.94 256z"})))),f&&u(s,{shortText:!0,plugin:"SalesNotifications",className:"foxkit-watermark--right"}))}const d="foxkit_plugin_viewed",c="foxkit_clicks";var m={};function h(){return m}function p(t,e){if(e.length1?"s":"")+" required, but only "+e.length+" present")}function f(e){p(1,arguments);var n=Object.prototype.toString.call(e);return e instanceof Date||"object"===t(e)&&"[object Date]"===n?new Date(e.getTime()):"number"==typeof e||"[object Number]"===n?new Date(e):new Date(NaN)}function g(t,e){p(2,arguments);var n=f(t),a=f(e),i=n.getTime()-a.getTime();return i<0?-1:i>0?1:i}function v(t){p(1,arguments);var e=f(t);return function(t){p(1,arguments);var e=f(t);return e.setHours(23,59,59,999),e}(e).getTime()===function(t){p(1,arguments);var e=f(t),n=e.getMonth();return e.setFullYear(e.getFullYear(),n+1,0),e.setHours(23,59,59,999),e}(e).getTime()}function w(t,e){p(2,arguments);var n,a=f(t),i=f(e),o=g(a,i),r=Math.abs(function(t,e){p(2,arguments);var n=f(t),a=f(e);return 12*(n.getFullYear()-a.getFullYear())+(n.getMonth()-a.getMonth())}(a,i));if(r<1)n=0;else{1===a.getMonth()&&a.getDate()>27&&a.setDate(30),a.setMonth(a.getMonth()-o*r);var s=g(a,i)===-o;v(f(t))&&1===r&&1===g(t,i)&&(s=!1),n=o*(r-Number(s))}return 0===n?0:n}var y={ceil:Math.ceil,round:Math.round,floor:Math.floor,trunc:function(t){return t<0?Math.ceil(t):Math.floor(t)}};function b(t,e,n){p(2,arguments);var a,i=function(t,e){return p(2,arguments),f(t).getTime()-f(e).getTime()}(t,e)/1e3;return((a=null==n?void 0:n.roundingMethod)?y[a]:y.trunc)(i)}var x={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}};const k=function(t,e,n){var a,i=x[t];return a="string"==typeof i?i:1===e?i.one:i.other.replace("{{count}}",e.toString()),null!=n&&n.addSuffix?n.comparison&&n.comparison>0?"in "+a:a+" ago":a};function M(t){return function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.width?String(e.width):t.defaultWidth;return t.formats[n]||t.formats[t.defaultWidth]}}var P={date:M({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:M({formats:{full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},defaultWidth:"full"}),dateTime:M({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})};var S={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function D(t){return function(e,n){var a;if("formatting"===(null!=n&&n.context?String(n.context):"standalone")&&t.formattingValues){var i=t.defaultFormattingWidth||t.defaultWidth,o=null!=n&&n.width?String(n.width):i;a=t.formattingValues[o]||t.formattingValues[i]}else{var r=t.defaultWidth,s=null!=n&&n.width?String(n.width):t.defaultWidth;a=t.values[s]||t.values[r]}return a[t.argumentCallback?t.argumentCallback(e):e]}}function T(t){return function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=n.width,i=a&&t.matchPatterns[a]||t.matchPatterns[t.defaultMatchWidth],o=e.match(i);if(!o)return null;var r,s=o[0],u=a&&t.parsePatterns[a]||t.parsePatterns[t.defaultParseWidth],l=Array.isArray(u)?function(t,e){for(var n=0;n20||a<10)switch(a%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},era:D({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:D({values:{narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},defaultWidth:"wide",argumentCallback:function(t){return t-1}}),month:D({values:{narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},defaultWidth:"wide"}),day:D({values:{narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},defaultWidth:"wide"}),dayPeriod:D({values:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},defaultFormattingWidth:"wide"})},match:{ordinalNumber:(N={matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:function(t){return parseInt(t,10)}},function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.match(N.matchPattern);if(!n)return null;var a=n[0],i=t.match(N.parsePattern);if(!i)return null;var o=N.valueCallback?N.valueCallback(i[0]):i[0];return{value:o=e.valueCallback?e.valueCallback(o):o,rest:t.slice(a.length)}}),era:T({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:"any"}),quarter:T({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:function(t){return t+1}}),month:T({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:"any"}),day:T({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:"any"}),dayPeriod:T({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:"any"})},options:{weekStartsOn:0,firstWeekContainsDate:1}};function I(t,e){if(null==t)throw new TypeError("assign requires that input parameter not be null or undefined");for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t}function j(t){var e=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return e.setUTCFullYear(t.getFullYear()),t.getTime()-e.getTime()}var W=43200;function C(t,e,n){var a,i;p(2,arguments);var o=h(),r=null!==(a=null!==(i=null==n?void 0:n.locale)&&void 0!==i?i:o.locale)&&void 0!==a?a:_;if(!r.formatDistance)throw new RangeError("locale must contain formatDistance property");var s=g(t,e);if(isNaN(s))throw new RangeError("Invalid time value");var u,l,d=I(I({},n),{addSuffix:Boolean(null==n?void 0:n.addSuffix),comparison:s});s>0?(u=f(e),l=f(t)):(u=f(t),l=f(e));var c,m=b(l,u),v=(j(l)-j(u))/1e3,y=Math.round((m-v)/60);if(y<2)return null!=n&&n.includeSeconds?m<5?r.formatDistance("lessThanXSeconds",5,d):m<10?r.formatDistance("lessThanXSeconds",10,d):m<20?r.formatDistance("lessThanXSeconds",20,d):m<40?r.formatDistance("halfAMinute",0,d):m<60?r.formatDistance("lessThanXMinutes",1,d):r.formatDistance("xMinutes",1,d):0===y?r.formatDistance("lessThanXMinutes",1,d):r.formatDistance("xMinutes",y,d);if(y<45)return r.formatDistance("xMinutes",y,d);if(y<90)return r.formatDistance("aboutXHours",1,d);if(y<1440){var x=Math.round(y/60);return r.formatDistance("aboutXHours",x,d)}if(y<2520)return r.formatDistance("xDays",1,d);if(ynew Promise(((n,a)=>{if(F.get(t))return n(F.get(t));fetch(t,e).then((e=>{if(e.ok){const a=e.json();return n(a),F.set(t,a),a}a(e)})).catch(a)}));var L=n(457).Z;new class{constructor(){a(this,"shuffleProducts",[]),a(this,"popupItem",null),a(this,"showTimeoutId",-1),a(this,"removeTimeoutId",-1),a(this,"transitionDuration",300),a(this,"showCount",0),a(this,"init",(async()=>{if("real"!==this.settings?.data_source)return;if(!this.settings?.show_on_mobile&&(()=>{let t=!1;var e;return e=navigator.userAgent||navigator.vendor||window.opera,(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(e)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(e.substr(0,4)))&&(t=!0),t})())return;let t=[],e=[];if("real"===this.settings?.data_source&&(t=[...new Set(this.settings.orders?.map((t=>t.productHandle)))],e=[...new Set(this.settings.orders?.map((t=>t.productId)))]),this.productData=e?.length?await(async({ids:t=[],handles:e=[]})=>{async function n(t){const e=[],n=[];for(const e of t)n.push(E(`${window.FoxKitSettings.baseUrl}products/${e}.js`));const a=await Promise.allSettled(n);for(const t of a)"fulfilled"===t.status&&t?.value&&e.push(t.value);return e}let a=[];if(window.FoxKitSettings?.multipleLanguages){const i=t?.map((t=>`id:${t}`))?.join("%20OR%20");try{a=await E(`${window.FoxKitSettings.baseUrl}search?q=${i}&view=foxkit`)}catch(t){a=await n(e)}}else a=await n(e);return a})({ids:e,handles:t}):await window.FoxKitV2.Helpers.fetchProductsByHandles(t),this.priorityProducts=this.settings.priority_products?.map((t=>t.replace("gid://shopify/Product/","")))??[],this.ordersList=this.settings.orders.map((t=>({...t,priority:this.priorityProducts.includes(t.productId)}))),this.productData&&this.productData.length){const{delay_time:t,showAfter:e}=this.settings,n=t||"10-15",[a,i]=n.split("-");this.settings.delayMin=Number(a),this.settings.delayMax=Number(i||a),this.shuffleProducts=Array.from(this.productData),setTimeout(this.showPopup,1e3*e)}})),a(this,"showPopup",(()=>{if(this.popupItem&&this.removePopup(),this.showCount>=this.settings.maximum)return;const t=this.ordersList.filter((t=>t.priority)).sort(((t,e)=>this.priorityProducts.indexOf(t.productId)-this.priorityProducts.indexOf(e.productId))),e=this.ordersList.filter((t=>!t.priority));setTimeout((()=>{let n=JSON.parse(sessionStorage.getItem("shownOrders"))??[],a=null;if(t.every((t=>n.includes(t.orderName)))){const t=e.filter((t=>!n.includes(t.orderName)));if(t.length>0){const e=Math.floor(Math.random()*t.length);a=t[e]}}else{const e=t.filter((t=>!n.includes(t.orderName)));a=e[0]}a?(n.push(a.orderName),n.length>=this.ordersList.length&&(n=[]),sessionStorage.setItem("shownOrders",JSON.stringify(n))):(n=[],sessionStorage.setItem("shownOrders",JSON.stringify(n)));const i=this.productData.find((t=>t.id===Number(a?.productId)));if(a&&i){const{message:t,time:e}=this.generateData(a);this.popupItem=L(l,{product:i,message:t,time:e,handleClick:()=>this.handleClick(i),hideOnMobile:this.settings.hideOnMobile,handleRemove:this.handleClickRemove,handleMouseEnter:this.handleMouseEnter,handleMouseLeave:this.handleMouseLeave,position:this.settings.position}),document.body.appendChild(this.popupItem),setTimeout((()=>this.popupItem.classList.add("show")),50),this.removeTimeoutId=setTimeout(this.removePopup,1e3*this.settings.duration),this.showCount+=1,this.shuffleProducts.length||(this.shuffleProducts=Array.from(this.productData))}const o=this.getRandomDelayTime();this.showTimeoutId=setTimeout(this.showPopup,o)}),this.transitionDuration)})),a(this,"replaceVariables",((t,e)=>t.replace(/\{\{\s*(\w+)\s*\}\}/g,((t,n)=>e[n]||t)))),a(this,"generateData",(t=>{const e=window.__i18n.transPlugin({configs:this.settings,key:"title"}),n=window.__i18n.transPlugin({configs:this.settings,key:"time"});let a=this.generateTime();t?.created_at&&(a=function(t,e){return p(1,arguments),C(t,Date.now(),e)}(new Date(t?.created_at)));const i={name:t?.name,location:t?.location,time:a,city:t?.city,province:t?.province,country:t?.country,first_name:t?.firstName,last_name:t?.lastName};return{message:this.replaceVariables(e,i),time:this.replaceVariables(n,i)}})),a(this,"generateTime",(()=>{const t=["mins","hours"],e=Math.floor(54*Math.random())+5;let n=t[Math.random()*t.length|0];return e>12&&(n=t[0]),`${e} ${n}`})),a(this,"handleClick",(t=>{!function({plugin:t,pluginId:e,productId:n,variantId:a,selectedItems:i,foxKitEventId:o,...r},s){window.Shopify.analytics?.publish(s,{shop:window.FoxKitV2.shop,plugin:t,pluginId:e,productId:n,variantId:a,selectedItems:i,foxKitEventId:o,...r}),s===d&&["LuckyWheel","PopUp"].includes(t)&&navigator.sendBeacon("https://foxkit.app/track/batch",JSON.stringify({events:[{shop:window.Shopify.shop,plugin:t}],metadata:{eventId:generateId(),appType:"foxkit",appId:"d4b61aaa-4d7c-11ee-be56-0242ac120002"}}))}({plugin:"SaleNotification",pluginId:this.settings?._id,productId:t?.id},c)})),a(this,"handleMouseEnter",(()=>{clearTimeout(this.removeTimeoutId),clearTimeout(this.showTimeoutId)})),a(this,"handleMouseLeave",(()=>{this.removeTimeoutId=setTimeout(this.removePopup,1e3*this.settings.duration);const t=this.getRandomDelayTime();this.showTimeoutId=setTimeout(this.showPopup,t)})),a(this,"handleClickRemove",(()=>{this.removePopup();const t=this.getRandomDelayTime();this.showTimeoutId=setTimeout(this.showPopup,t)})),a(this,"removePopup",(()=>{clearTimeout(this.removeTimeoutId),this.popupItem&&(this.popupItem.classList.remove("show"),setTimeout((()=>{this.popupItem?.remove?.(),this.popupItem=null}),this.transitionDuration))})),a(this,"getRandomDelayTime",(()=>{const{delayMin:t,delayMax:e,duration:n}=this.settings;let a=t;return e!==t&&(a=Math.floor(Math.random()*(e-t+1))+t),1e3*(a+n)})),this.settings={...FoxKitPlugins.SalesPop,duration:parseInt(FoxKitPlugins.SalesPop.display_time)||5,showAfter:FoxKitPlugins.SalesPop.delay_show||5,maximum:parseInt(FoxKitPlugins.SalesPop.max_show),names:FoxKitPlugins.SalesPop?.names?.split(","),locations:FoxKitPlugins.SalesPop?.locations?.split(", ")},this.init()}}})()})();