!function(){"use strict";const e=(e,t)=>{const a=window.vskData.app_setting_config,n=a&&a.product_template,r=!!n&&(n.group_swatches||n.variant_swatches);return!(!a.enable_swatch||!a.enable_swatch[e][t])&&r};var t=()=>{const t=window.vskData.block_collection_settings,a=e("home","enable_on_home_featured_product")&&"index"===t.current_template,n=e("collections","enable_on_collection_quick_view")&&("collection"===t.current_template||"search"===t.current_template),r=e("list_collections","enable_on_list_collection_quick_view")&&"list-collections"===t.current_template,o=e("products","enable_on_main_product")&&"product"===t.current_template,i=e("cart","enable_on_cart_featured_product")&&"cart"===t.current_template,s=e("article","enable_on_article_featured_product")&&("article"===t.current_template||"blog"===t.current_template),l=e("pages","enable_on_custom_featured_product")&&t.current_template.includes("page");return a||n||r||o||i||s||l};class a{constructor(){a.instance||(this.data={},a.instance=this)}set(e,t){this.data[e]=t}get(e){return this.data[e]}}var n,r,o=new a;const i="themeSettings",s=['a[href*="/products/"]:not([href*="shopify.com"])','[data-href*="/products/"]','meta[itemprop="url"][content*="/products/"]',"[data-product-handle]",'[data-url*="/products/"]','[data-product-url*="/products/"]','[product-url*="/products/"]'],l=["data-product-handle","data-url","data-product-url","product-url","content","href","data-href"],c=[{theme_type:"common",option_selector:'select[class*="single-option-selector"]',hide_elements:'select.single-option-selector, select[id*="SingleOptionSelector"]'},{theme_type:"common",option_selector:'select[id*="SingleOptionSelector"]',hide_elements:'select.single-option-selector, select[id*="SingleOptionSelector"]'},{theme_type:"common",option_selector:".option-selectors select",hide_elements:".option-selectors"},{theme_type:"common",option_selector:".option-values select",hide_elements:".option-values.option-values-select .form-element-wrapper"},{theme_type:"dawn",option_selector:'select[class*="single-option-selector"]',hide_elements:'select.single-option-selector, select[id*="SingleOptionSelector"]'},{theme_type:"dawn",option_selector:'select[id*="SingleOptionSelector"]',hide_elements:'select.single-option-selector, select[id*="SingleOptionSelector"]'},{theme_type:"dawn",option_selector:".option-selectors select",hide_elements:".option-selectors"},{theme_type:"dawn",option_selector:".option-values select",hide_elements:".option-values.option-values-select .form-element-wrapper"},{theme_type:"dawn",option_selector:".single-option-radio input.single-option-selector__radio",hide_elements:".radio-wrapper.js, form .radio-wrapper"},{theme_type:"dawn",option_selector:".single-option-radio input.single-option-selector-product-template",hide_elements:".radio-wrapper.js, form .radio-wrapper"},{theme_type:"dawn",option_selector:'form input[class*="variant__input"]',hide_elements:"form .variant-wrapper.variant-wrapper--button.js, form .variant-wrapper .variant-input-wrap, form .variant-wrapper .variant__label"},{theme_type:"prestige",option_selector:'input[data-option-position][type="radio"], button[data-option-position][type="button"], div[data-option-position][data-option-value]',hide_elements:'form[action*="/cart/add"] .ProductForm__Option, form[action*="/cart/add"] .product-form__option'},{theme_type:"dawn",option_selector:'form[action*="/cart/add"] .form-options .form-field-select[data-product-option]',hide_elements:'form[action*="/cart/add"] .form-field.form-options'},{theme_type:"dawn",option_selector:"variant-radios input",hide_elements:"variant-radios"},{theme_type:"dawn",option_selector:"fieldset.variants-ui__radios input.option-value-input",hide_elements:"fieldset.variants-ui__radios"},{theme_type:"motion",option_selector:"select.product-single__variants",hide_elements:"noelement"}],d="storefront",u="SELECT",p="INPUT",h="BUTTON",_=[{char:"!",replacer:"~21"},{char:"*",replacer:"~2A"},{char:"'",replacer:"~92"},{char:"(",replacer:"~28"},{char:")",replacer:"~29"},{char:";",replacer:"~3B"},{char:":",replacer:"~3A"},{char:"@",replacer:"~40"},{char:"&",replacer:"~26"},{char:"=",replacer:"~3D"},{char:"+",replacer:"~2B"},{char:"$",replacer:"~24"},{char:",",replacer:"~2C"},{char:"/",replacer:"~2F"},{char:"\\",replacer:"~5C"},{char:"?",replacer:"~3F"},{char:"%",replacer:"~25"},{char:"#",replacer:"~23"},{char:"[",replacer:"~5B"},{char:"]",replacer:"~5D"},{char:"{",replacer:"~7B"},{char:"}",replacer:"~7D"},{char:'"',replacer:"~22"},{char:"<",replacer:"~3C"},{char:">",replacer:"~3E"},{char:"|",replacer:"~7C"},{char:"`",replacer:"~60"},{char:"^",replacer:"~5E"},{char:".",replacer:"~2E"}],g="change",m="lite",v="detailed",w="metafield",f=null===(n=window.vskData.data_url_source)||void 0===n?void 0:n.includes("lambda"),b=null===(r=window.vskData.data_url_source)||void 0===r?void 0:r.includes(w),y=(new Date).getTime(),S="(max-width: 768px)";var $=(()=>{const e={};function t(t,a){e[t]&&(e[t]=e[t].filter((e=>e!==a)),0===e[t].length&&delete e[t])}return{subscribe:function(a,n){return e[a]||(e[a]=[]),e[a].push(n),()=>{t(a,n)}},unsubscribe:t,publish:function(t,a){e[t]&&e[t].forEach((e=>e(a)))}}})();const O=e=>{let t=e.message,a=e.error;if(window.vskData&&window.vskData.app_setting.display_logs){const e=(new Date).toString();console.log("<-------------- START ----------------\x3e"),a?console.error("Swatch King ERROR:",t):console.log("Swatch King:",t),console.log("Swatch King:","Timestamp",e),console.log("<--------------- END -----------------\x3e")}},k={printLog:O,isPageLoaded:()=>"complete"===document.readyState||"loaded"===document.readyState,isProductPage:()=>window.location.pathname.includes("/products"),extractProductHandle:e=>{let t=e.split("/");return t=t[t.length-1],t=t.split(RegExp("\\?|\\#|\\.js","gi")),t[0]},pathName:()=>window.decodeURI(window.location.pathname.replace(/\/$/,"")),convertLanguageCode:e=>{const t=e.toUpperCase();return"PT-BR"===t||"PT-PT"===t||"ZH-CN"===t||"ZH-TW"===t?t.replace("-","_"):t.match(/^[a-zA-Z]{2}-[a-zA-Z]{2}$/)?t.substring(0,2):t},getHandleFromURL:e=>{let t=e.split("/");return t=t[t.length-1],t=t.split(RegExp("\\?|\\#|\\.js","gi")),t[0]},morphValues:e=>{if(!o.get(i).settings.products.handleize)return e;let t=e;return t=t.toLowerCase(),t=t.replace(RegExp("['\"\\(\\)\\{\\}\\[\\]]","gi"),""),t=t.replace(RegExp("[^a-z0-9_]+","gi"),"-"),t=t.replace(RegExp("-+","gi"),"-"),t=t.replace(RegExp("^-|-$","gi"),""),t},isASwatch:e=>"swatch"===e||"swatch_drop_down"===e,findCurrentVariantID:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;const t={};if(document.location.search.substr(1).split("&").forEach((e=>{const a=e.split("=");if(e)try{t[a[0].toString()]=a[1].toString()}catch(e){console.error(e)}})),t.variant)return t.variant;const a=(null==e?void 0:e.querySelector('[name="id"]'))||document.querySelector('[name="id"]');return null!=a&&a.value?a.value:null},dispatchCustomEvent:(e,t,a)=>{if(window.CustomEvent){const n=document.createEvent("CustomEvent");n.initCustomEvent(`vsk:${t}`,!0,!1,a),e.dispatchEvent(n)}},dispatchEvent:(e,t)=>{const a=document.createEvent("HTMLEvents");a.initEvent(e,!0,!1),O(["Event Dispatched!!!",e,t]),t.dispatchEvent(a)},sortObjectByKeys:e=>{const t={};let a=1,n=`option${a}`;for(;void 0!==e[n];)t[n]=e[n],a+=1,n=`option${a}`;return t},hideSingleValueOption:e=>o.get(i).settings[e].hide_single_value_option,isEventTrusted:e=>{let t=e.event,a=e._default;return void 0!==t.isTrusted&&void 0!==t.screenX&&void 0!==t.screenY&&!1===t.isTrusted&&0!==t.screenX&&0!==t.screenY||(void 0!==t.isTrusted?t.isTrusted:void 0!==t.screenX&&void 0!==t.screenY?0!==t.screenX&&0!==t.screenY:a)},isStorefront:()=>window.vskData.product_data_source===d,getSwatchUrlHost:()=>"cdn"===window.vskData.app_setting.swatch_url_source?"cdn.starapps.studio/v2":"media-cdn.starapps.studio",getStoreSlug:()=>window.Shopify.shop.split(".myshopify.com")[0],getRoutesRoot:()=>{let e=window.Shopify&&window.Shopify.routes&&(window.Shopify.routes.root||window.Shopify.routes.root_url)||"/";return e.endsWith("/")||(e+="/"),e},isPresetAnalyticsEnabled:()=>!(!window.vskData||!window.vskData.app_setting_config)&&t()&&window.vskData.app_setting_config.enable_event_tracking,dispatchThemeEvent:(e,t,a)=>{if(window.CustomEvent){const n=document.createEvent("CustomEvent");n.initCustomEvent(e,!0,!1,a),t.dispatchEvent(n)}}};var D=k;const x=function(e,t){let a=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return`\nquery productDetails($variantsCursor: String) @inContext(country: ${window.Shopify.country.toUpperCase()}, language: ${D.convertLanguageCode(a?window.vskData.primary_locale:window.Shopify.locale)}) {\n product(${e}: "${t}") {\n id\n handle\n title\n vendor\n availableForSale\n onlineStoreUrl\n tags\n publishedAt\n priceRange {\n maxVariantPrice { amount }\n minVariantPrice { amount }\n }\n featuredImage { id url }\n options {\n id\n name\n values\n optionValues { id name }\n }\n images(first: 250) {\n nodes { id url altText }\n }\n variants(first: 250, after: $variantsCursor) {\n nodes{\n id\n availableForSale\n quantityAvailable\n compareAtPrice{\n currencyCode\n amount\n }\n selectedOptions{\n name\n value\n }\n currentlyNotInStock\n featured_image: image{\n id\n src: url\n altText\n }\n price{\n currencyCode\n amount\n }\n title\n sku\n }\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n compareAtPriceRange {\n maxVariantPrice { amount }\n minVariantPrice { amount }\n }\n }\n}\n`},A={byHandle:function(e){return x("handle",e,arguments.length>1&&void 0!==arguments[1]&&arguments[1])},byId:function(e){return x("id",`gid://shopify/Product/${e}`,arguments.length>1&&void 0!==arguments[1]&&arguments[1])}};var E=A;const P=()=>{let e=D.getRoutesRoot();e&&""!==e&&(e=e.replace(/\/$/,""));const t={default_language:window.vskData.primary_locale,money_format:window.vskData.money_format,current_url:e};return window.Shopify&&window.Shopify.locale&&(t.current_language=window.Shopify.locale),t.not_default_language=t.current_language!==t.default_language,D.printLog({message:["Found language information in DOM",t],error:!1}),t},j=e=>{const t=P();if(t.not_default_language){let a=window.vskData.localized_string[e];if(a&&(a=a[t.current_language],a&&a.trim().length>0))return a}return e};function I(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function L(e){for(var t=1;t{let t=e.query,a=e.variables,n=void 0===a?null:a,r=e.isOptions,o=void 0!==r&&r;try{const e={method:"POST",headers:{"Content-Type":"application/json","X-Shopify-Storefront-Access-Token":window.vskData.storefront_key},body:JSON.stringify({query:t,variables:n})},a=`${D.getRoutesRoot()}api/2025-01/graphql.json`,r=await fetch(a,e);let i=await r.json();return o&&(i=await(async e=>{var t;let a=e.json,n=e.graphqlApiUrl,r=e.fetchOptions,o=e.variables,i=e.query;if(null===(t=a.data)||void 0===t||!t.product)return null;let s=a.data.product.variants.pageInfo,l=s.hasNextPage,c=s.endCursor;for(;l;)try{var d;const e=await fetch(n,L(L({},r),{},{body:JSON.stringify({query:i,variables:L(L({},o),{},{variantsCursor:c})})}));if(!e.ok){D.printLog({message:`Pagination request failed: ${e.status} – ${e.statusText}`,error:!0});break}const t=await e.json();if(null!==(d=t.errors)&&void 0!==d&&d.length){D.printLog({message:t.errors,error:!0});break}a.data.product.variants.nodes.push(...t.data.product.variants.nodes),l=t.data.product.variants.pageInfo.hasNextPage,c=t.data.product.variants.pageInfo.endCursor}catch(e){D.printLog({message:"Error during pagination request",error:!0});break}return a})({json:i,graphqlApiUrl:a,fetchOptions:e,variables:n,query:t})),i}catch(e){D.printLog({message:`Error fetching product data from storefront: ${e.message}`,error:!0})}return null};const N={getData:e=>{if(window.sessionStorage&&"string"==typeof e){const t=sessionStorage.getItem(e);if(t)return JSON.parse(t)}return null},getKey:e=>{let t=e.handleOrId,a=e.defaultLanguage,n=e.url,r=e.country,o=void 0===r?null:r,i=e.language,s=void 0===i?null:i,l=e.forceStorefront,c=void 0!==l&&l,d=e.detail,u=void 0===d?m:d;if(!window.sessionStorage)return null;const p=t||D.getHandleFromURL(n),h=P();let _;var g;let v;return _=o||((null===(g=window.Shopify)||void 0===g?void 0:g.country)||"NULL"),v=s||(a?D.convertLanguageCode(h.default_language):D.convertLanguageCode(h.current_language)),v=v.toUpperCase(),"storefront"===window.vskData.product_data_source||c?`starapps_storefront_${u}_${p}_${v}_${_}`:`starapps_${p}_${v}_${_}`},setData:function(e,t){let a=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=t;if(window.sessionStorage&&"string"==typeof e&&"object"==typeof n){const t=(new Date).getTime();null!=n?n.created_at=t:n={id:null,created_at:t};const r=JSON.stringify(n);if(a)try{sessionStorage.setItem(e,r)}catch(e){}else setTimeout((()=>{try{sessionStorage.setItem(e,r)}catch(e){}}),0);return!0}return!1}};var q=N,V=e=>{let t=e.keyIdentifier,a=e.countryCode,n=void 0===a?null:a,r=e.languageCode,o=void 0===r?null:r,i=e.product;q.setData(q.getKey({handleOrId:t,defaultLanguage:!1,country:n,language:o,detail:v}),i,!0)};function R(e,t){(null==t||t>e.length)&&(t=e.length);for(var a=0,n=Array(t);a{var t,a;const n=D.extractProductHandle(e),r=q.getData(q.getKey({handleOrId:n,defaultLanguage:!1,detail:v}));if(r)return r;let o,i;if(D.isStorefront()){var s;if(i=await T({query:E.byHandle(n),isOptions:!0}),null===(s=i)||void 0===s||null===(s=s.data)||void 0===s||!s.product)return D.printLog({message:`Storefront query failed for handle: ${n}`,error:!0}),null;o=i.data.product}else o=await(async e=>{try{const t=window.decodeURI(window.location.pathname.replace(/\/$/,""));let a;a=e?`${P().current_url}/products/${e}.js`:`${t}.js`;const n=await fetch(a);return{product:await n.json(),source:"js"}}catch(e){D.printLog({message:`Error fetching product data from js. Error: ${e}`,error:!0})}return{}})(n);if(!o)return D.printLog({message:`No product data found for handle: ${n}`,error:!0}),null;if((null===(t=o.variants)||void 0===t?void 0:t.length)>0||(null===(a=o)||void 0===a||null===(a=a.variants)||void 0===a||null===(a=a.nodes)||void 0===a?void 0:a.length)>0){var l,c;let e=o.id;if("string"==typeof o.id){const t=o.id.match(/\d+/);null!=t&&t[0]&&(e=(d=t,u=1,function(e){if(Array.isArray(e))return e}(d)||function(e,t){var a=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var n,r,o,i,s=[],l=!0,c=!1;try{if(o=(a=a.call(e)).next,0===t){if(Object(a)!==a)return;l=!1}else for(;!(l=(n=o.call(a)).done)&&(s.push(n.value),s.length!==t);l=!0);}catch(e){c=!0,r=e}finally{try{if(!l&&null!=a.return&&(i=a.return(),Object(i)!==i))return}finally{if(c)throw r}}return s}}(d,u)||function(e,t){if(e){if("string"==typeof e)return R(e,t);var a={}.toString.call(e).slice(8,-1);return"Object"===a&&e.constructor&&(a=e.constructor.name),"Map"===a||"Set"===a?Array.from(e):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?R(e,t):void 0}}(d,u)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())[0])}const t=null===(l=i)||void 0===l||null===(l=l.extensions)||void 0===l||null===(l=l.context)||void 0===l?void 0:l.country,a=null===(c=i)||void 0===c||null===(c=c.extensions)||void 0===c||null===(c=c.context)||void 0===c?void 0:c.language;V({keyIdentifier:o.handle,countryCode:t,languageCode:a,product:o}),D.isStorefront()&&V({keyIdentifier:e,countryCode:t,languageCode:a,product:o})}var d,u;return o};function F(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function H(e){for(var t=1;t{let t=e.productDataStore;const a=t.isProductGridInstance,n=t.instance,r=window.vskData.presets;let o=a?void 0:r[window.vskData.app_setting.default_preset];return a?o={assoc_view_type:"hidden"}:void 0===o&&Object.values(r).forEach((e=>{"button"===e.assoc_view_type&&e.apply_to===n&&(o=e)})),o};var B=e=>{let t=e.productDataStore;const a=t.isProductGridInstance,n=window.vskData,r=n.presets,o=n.product_options,i={},s=z({productDataStore:t}),l=window.matchMedia?window.matchMedia(S):window.screen.width<=768;for(let e=0;e({assoc_view_type:"hidden"});function J(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var a=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var n,r,o,i,s=[],l=!0,c=!1;try{if(o=(a=a.call(e)).next,0===t){if(Object(a)!==a)return;l=!1}else for(;!(l=(n=o.call(a)).done)&&(s.push(n.value),s.length!==t);l=!0);}catch(e){c=!0,r=e}finally{try{if(!l&&null!=a.return&&(i=a.return(),Object(i)!==i))return}finally{if(c)throw r}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return K(e,t);var a={}.toString.call(e).slice(8,-1);return"Object"===a&&e.constructor&&(a=e.constructor.name),"Map"===a||"Set"===a?Array.from(e):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?K(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function K(e,t){(null==t||t>e.length)&&(t=e.length);for(var a=0,n=Array(t);a{if(!e.featured_image)return e;const a=e;if(a.featured_image.secondary_src=e.featured_image.src,a.featured_image.last_src=e.featured_image.src,void 0!==t&&t.length>1){const e=t[1];a.featured_image.secondary_src=e,a.featured_image.last_src=t[t.length-1]}return a},X=(e,t)=>{const a=e.find((e=>e.name===t));return a?a.id.split("ProductOptionValue/")[1]:null},Y=async e=>{let t=e.product,a=e.untranslatedData,n=void 0===a?null:a,r=e.productDataStore;const o=r.beautifyVariantPicker;let i,s=t.options,l=t.variants,c=t.images;i=D.isStorefront()?J(t.id.match(/\d+/),2)[1]:t.id;const d={handle:t.handle,id:i,vendor:t.vendor,publishedAt:t.publishedAt};if(D.isStorefront()){if(l=t.variants?t.variants.nodes:null,c=t.images?t.images.nodes.map((e=>e.url)):null,l&&c){const e={};t.images.nodes.forEach(((t,a)=>{e[t.id]=a+1}));for(let t=0;t{if(!e)return null;const t=q.getData(q.getKey({handleOrId:e,defaultLanguage:!0,forceStorefront:!0,detail:v}));return t&&null!==t.id?Promise.resolve({data:{product:t}}):T({query:E.byId(e,!0),isOptions:!0})})(i),a=e.data.product;return q.setData(q.getKey({handleOrId:i,defaultLanguage:!0,forceStorefront:!0,detail:v}),a),Y({product:t,untranslatedData:a,productDataStore:r})}d.untranslatedHandle=null==n?void 0:n.handle;let u=!1,p=!1;if(!o)return{hasDefaultVariant:!0,infoTree:d};if(1===l.length&&(u=!0,l[0].title.toLowerCase().includes("default")))return p=!0,{infoTree:d,hasSingleVariant:u,hasDefaultVariant:p};const h=B({productDataStore:r});r.optionPresetMap=h;const _=W({productDataStore:r});for(let e=0;e{let t=e.images,a=e.originalVariants,n=e.options,r=e.untranslatedData;const o=((e,t)=>{const a={};let n=null,r=null;for(let o=0;o=0;t-=1){const a=i[l][t];if(void 0!==a&&(v=a.name===c&&a.value===p[e][l],v)){w=f-t;break}}if(v)null!=g&&(a&&(g.available=a),m>=0&&(g.min_price=g.min_price&&m>g.min_price?g.min_price:m,g.max_price=g.max_price&&m1){const t=e[1];v.featured_image.secondary_src=t;const a=e[e.length-1];v.featured_image.last_src=a}}null!=g&&a&&(g.available=a),null!=g&&m>=0&&(g.min_price=g.min_price&&m>g.min_price?g.min_price:m,g.max_price=g.max_price&&m0&&(b=t.images.nodes[0].url)):(b=t.featured_image,!b&&t.images&&t.images.length>0&&(b=J(t.images,1)[0]),b&&"object"==typeof b&&(b=b.src)),{tree:f,options:s,variants:m,priceInfoTree:w,defaultFeaturedImage:b,infoTree:d,hasSingleVariant:u,hasDefaultVariant:p}};var Q,ee,te=Y;function ae(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function ne(e){for(var t=1;te.length)&&(t=e.length);for(var a=0,n=Array(t);a{let a=oe(t,1)[0];return e.querySelector(`.${a}`)}));return t?t[1]:null}function de(e){const t=e.getAttribute("data-event-data");return t?JSON.parse(t):null}function ue(e,t){e.setAttribute("data-event-data",JSON.stringify(t))}function pe(e){return Date.now()-e}function he(){return{width:window.innerWidth||document.documentElement.clientWidth,height:window.innerHeight||document.documentElement.clientHeight}}function _e(e){const t=Array.from(e.querySelectorAll("ul.swatch-view > li")),a=e.getBoundingClientRect().left,n=t.find((e=>{const t=e.getBoundingClientRect();return t.right>a&&t.left<=a}))||t.find((e=>e.getBoundingClientRect().left>a))||t[0];if(!n)return 1;const r=n.getAttribute("key"),o=parseInt(r,10);return Number.isNaN(o)?1:o+1}function ge(e){return Object.entries(e).map((e=>{let t=oe(e,2),a=t[0],n=t[1];return{key:a,value:Object.entries(n).filter((e=>{let t=oe(e,1)[0];return se.selected_options.includes(t)})).map((e=>{let t=oe(e,2);return{key:t[0],value:t[1]}}))}}))}function me(e,t){var a,n;const r=e[t]||{};return{variant_id:r.variant_id,variant_title:r.variant_title,variant_price:JSON.stringify({currency_code:(null===(a=r.variant_price)||void 0===a?void 0:a.currencyCode)??"",amount:(null===(n=r.variant_price)||void 0===n?void 0:n.amount)??0})}}function ve(e,t,a,n){return ne({event_name:e,selected_options:JSON.stringify(ge(a)),event_params:JSON.stringify(n.map((e=>({key:"page_load_time"===e?"time_from_page_load":e,value:"page_load_time"===e?pe(t[e]):t[e]}))))},me(a,`option${t.option_index}`))}const we={getOptionLinkedData:function(e,t,a){var n,r,o,i,s,l,c;const d=a.split("option")[1],u=e.params,p="swatch"===e.assoc_view_type,h="slide"===u.swatch_style;return{option_name:t.name,option_index:d,preset_id:e.id,preset_name:e.name,is_swatch:p,swatch_height:p?u.height||u.swatch_size:null,swatch_width:p?u.width||u.swatch_size:null,swatch_image_source:null==t||null===(n=t.view_type_preset)||void 0===n?void 0:n.products_swatch,is_slider_active:h,is_badge_active:Boolean((null===(r=u.new_badge)||void 0===r?void 0:r.enable)||(null===(o=u.sale_badge)||void 0===o?void 0:o.enable)||(null===(i=u.sold_out_badge)||void 0===i?void 0:i.enable)),is_price_active:Boolean(null===(s=u.price_badge)||void 0===s?void 0:s.price_enabled),option_selection:e.trigger_action,hover_effect:(null===(l=u.hover)||void 0===l?void 0:l.effect)||(null===(c=u.hover)||void 0===c?void 0:c.animation)||null,page_load_time:y}},updateOptionValueBadgeNames:function(e){e&&e.querySelectorAll("li").forEach((e=>{const t=de(e);t&&(t.option_value_badge_name=ce(e),ue(e,t))}))},updateSelectedValueInEventData:function(e,t,a){const n=e.getAttribute("orig-value"),r=e.getAttribute("key"),o=parseInt(r,10),i=Number.isNaN(o)?1:o+1,s=ce(e),l=Array.from((null==t?void 0:t.querySelectorAll("li"))||[]);l.forEach((e=>{const t=de(e);var r,o,c;if(t&&(Object.assign(t,{selected_value:n,selected_value_badge_name:s,selected_value_index:i}),ue(e,t),"true"===e.getAttribute("aria-checked"))){var d;const n=e.closest("[sa-options-position]");if(!n)return;const i=JSON.parse(n.getAttribute("data-selected-event-data")||"{}");i[`option${t.option_index}`]=(r=t,o=l.length,c=(null===(d=a.variants)||void 0===d?void 0:d[a.currentVariantID])||null,ne(ne({},r),{},{option_value_count:o,selected_value:r.selected_value,selected_value_badge_name:r.selected_value_badge_name,selected_value_index:r.selected_value_index,swatch_in_a_row:r.swatch_in_a_row,variant_id:(null==c?void 0:c.id)||null,variant_title:(null==c?void 0:c.title)||null,variant_price:(null==c?void 0:c.price)||null})),n.setAttribute("data-selected-event-data",JSON.stringify(i))}}))},updateSwatchViewLiEventData:function(e,t){const a=Array.from(e.querySelectorAll("li")),n=a.length;a.forEach(((a,r)=>{const o=de(a);if(!o)return;const i=parseInt(a.getAttribute("key"),10),s=Math.floor(i/t)*t+1;if(Object.assign(o,{row_start_index:s,option_value_count:n}),ue(a,o),0===r){const a=`option${o.option_index}`,n=e.closest("[sa-options-position]"),r=JSON.parse(n.getAttribute("data-selected-event-data")||"{}"),i=r[a]||{};i.swatch_in_a_row=t,r[a]=i,n.setAttribute("data-selected-event-data",JSON.stringify(r))}}))},getRowStartIndexForSlider:_e,getOptionLinkedSliderData:function(e,t){const a=le.matches&&"mode_0"===t.params.arrow_mode;return ne(ne({},e),{},{slide_type:a?"swipe":"click_arrow",page_load_time:y})},updateSelectionData:function(e){const t=JSON.parse(e.getAttribute("data-selected-event-data")||"{}");return e.querySelectorAll("[option-target]").forEach((e=>{const a=e.getAttribute("option-target"),n=e.querySelector(".swatch-navigable"),r=n||e.querySelector("ul.swatch-view, ul.swatch-drop-down-list"),o=r?function(e){return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?function(e){const t=he(),a=t.width,n=t.height,r=e.getBoundingClientRect(),o={left:Math.max(r.left,0),right:Math.min(r.right,a),top:Math.max(r.top,0),bottom:Math.min(r.bottom,n)};return Array.from(e.querySelectorAll("ul.swatch-view > li")).filter((e=>{const t=e.getBoundingClientRect(),a=Math.max(0,Math.min(t.right,o.right)-Math.max(t.left,o.left)),n=Math.max(0,Math.min(t.bottom,o.bottom)-Math.max(t.top,o.top));return t.width*t.height>0&&a*n/(t.width*t.height)>.5})).length}(e):function(e){const t=he(),a=t.width,n=t.height;return e.filter((e=>{const t=e.getBoundingClientRect(),r=Math.max(0,Math.min(t.right,a)-Math.max(t.left,0)),o=Math.max(0,Math.min(t.bottom,n)-Math.max(t.top,0));return t.width*t.height>0&&r*o/(t.width*t.height)>.5})).length}(Array.from(e.querySelectorAll("ul.swatch-view > li")))}(r,Boolean(n)):0,i=t[a]||{};i.visible_value_count=o,n&&(i.row_start_index=_e(n)),t[a]=i})),e.setAttribute("data-selected-event-data",JSON.stringify(t)),t},getOptionHoverPayload:(e,t)=>ve("option_hover",e,t,se.hover),getOptionClickPayload:(e,t)=>ve("option_click",e,t,se.click),getSliderPayload:(e,t)=>ve("slider_swipe",e,t,se.slider),getAddToCartPayload:e=>function(e){return ne({event_name:"add_to_cart",selected_options:JSON.stringify(ge(e)),event_params:JSON.stringify([{key:"time_from_page_load",value:pe(y)}])},me(e,"option1"))}(e)};var fe=we;function be(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function ye(e){for(var t=1;t{let e=sessionStorage.getItem("vsk_metrics_session_id");return e||(e=crypto.randomUUID(),sessionStorage.setItem("vsk_metrics_session_id",e)),e},Oe=()=>{var e,t,a,n,r,o;return{shopify_domain:window.Shopify?window.Shopify.shop:"",product_id:(null===(e=window.ShopifyAnalytics)||void 0===e||null===(e=e.meta)||void 0===e||null===(e=e.product)||void 0===e?void 0:e.id)||0,page_type:null===(t=window.ShopifyAnalytics)||void 0===t||null===(t=t.meta)||void 0===t||null===(t=t.page)||void 0===t?void 0:t.pageType,page_url:window.location.href,screen_resolution:`${window.screen.width}x${window.screen.height}`,language:null===(a=window.Shopify)||void 0===a?void 0:a.locale,theme_id:null===(n=window.Shopify)||void 0===n||null===(n=n.theme)||void 0===n?void 0:n.id,theme_type:null===(r=window.Shopify)||void 0===r||null===(r=r.theme)||void 0===r?void 0:r.schema_name,session_id:$e(),useragent:(null===(o=navigator.userAgentData)||void 0===o?void 0:o.platform)||navigator.userAgent||"unknown"}},ke=(e,t)=>{var a;null===(a=window.Shopify)||void 0===a||null===(a=a.analytics)||void 0===a||a.publish(e,t)},De="new",xe="sold_out",Ae="sale",Ee=e=>{const t=document.implementation.createHTMLDocument("");return t.body.innerHTML=e,t.body.children},Pe=e=>{let t=e.optionTag,a=e.html,n=e.swatchRootElement,r=e.productDataStore;const o=n.querySelector(`[option-target="${t}"]`),i=o.querySelector(".swatch-single"),s=o.querySelector(".swatch-size-chart");i&&(s&&o.insertBefore(s,i),o.removeChild(i));const l=Ee(a)[0];o.appendChild(l),o.classList.remove("swatch-hide");const c=o.querySelector("label.swatch-label"),d=o.querySelector(".visually-hidden-label"),u=o.querySelector("legend");if(!r.isProductGridInstance){const e=window.vskData.app_setting_config.size_chart,t=[{type:"size_chart",append_to:"span.swatch-size-chart"}];Object.values(t).forEach((t=>{const a=r.productCardElement.querySelector(t.append_to);if(a){const t=a.parentElement.querySelector("span.swatch-label-container");if(t){const n=`size-chart-${e.position}`;t.classList.add(n),u.appendChild(d),t.appendChild(c),t.appendChild(a)}}}))}const p=o.querySelectorAll(".swatch-selector");return D.isPresetAnalyticsEnabled()&&(e=>{var t,a;ke("vsk:event:metadata",Oe());const n=(e,t)=>{const a=ye(ye(ye({},t),Oe()),{},{timestamp:Date.now(),created_at:(new Date).toISOString()});ke("vsk:preset:analytics",a)},r=e.querySelector("ul.swatch-view, ul.swatch-drop-down-list");if(!r)return;const o=(e,t)=>{"hover"===t&&e.classList.add("hovered");const a=e.closest("[sa-options-position]"),r=fe.updateSelectionData(a),o=e.closest("[option-target]").getAttribute("option-target"),i=function(e,t){const a=JSON.parse(e.dataset.eventData||"{}");return void 0!==t.row_start_index&&(a.row_start_index=t.row_start_index),a.visible_value_count=t.visible_value_count,a}(e,r[o]),s="click"===t?fe.getOptionClickPayload(i,r):fe.getOptionHoverPayload(i,r);n(0,s)};r.addEventListener("click",(e=>{const t=e.target.closest("li.swatch-view-item, li.swatch-drop-down-list-item");t&&r.contains(t)&&o(t,"click")})),r.querySelectorAll("li.swatch-view-item").forEach((e=>{e.addEventListener("mouseenter",(()=>o(e,"hover")))}));const i=r.closest(".swatch-navigable");if(!i)return;let s,l;try{s=JSON.parse(i.dataset.optionSliderEvent||"{}"),l=JSON.parse(i.dataset.sliderData||"{}")}catch(e){console.warn("Invalid slider data:",e),s={},l={}}let c=fe.getRowStartIndexForSlider(i);const d=e=>{const t=r.closest("[sa-options-position]"),a=fe.updateSelectionData(t),o=r.closest("[option-target]").getAttribute("option-target"),d=a[o].visible_value_count;setTimeout((()=>{const t=fe.getRowStartIndexForSlider(i),r=t-c;if(0===r)return;c=t,s.slide_direction=e,s.sliding_shift=Math.abs(r),s.swatch_in_a_row=l.totalSwatches,s.row_start_index=t;const o=i.querySelectorAll("li.swatch-view-item").length;s.is_end_of_slide="right"===e?t+d-1>=o:1===t;const u=fe.getSliderPayload(s,a);n(0,u)}),300)};null===(t=i.querySelector(".swatch-navigation-left"))||void 0===t||t.addEventListener("click",(()=>d("left"))),null===(a=i.querySelector(".swatch-navigation-right"))||void 0===a||a.addEventListener("click",(()=>d("right"))),r.addEventListener("touchend",(()=>{const e=fe.getRowStartIndexForSlider(i);d(e-c>0?"right":"left")}))})(o),p},je=e=>{let t=e.selectors,a=e.withParent,n=e.productCardElement;a&&n.querySelectorAll(t).forEach((e=>{e.parentNode.style.display="none"})),(e=>{const t=document.querySelector('style[app="vsk"][role="hide_elements"]');let a="";if("object"==typeof e)for(let t=0;t${a}{display: none!important;}`,document.querySelector("head").appendChild(Ee(a)[0])))})(t)},Ie=e=>e.replace(/&/g,"&").replace(/>/g,">").replace(/{const e=o.get(i),t=window.vskData.app_setting_config.size_chart.size_chart_app_selector.split(",").filter(Boolean),a=e.settings.products.size_chart_selector.split(",").filter(Boolean);return[...new Set([...t,...a])].join(",")},Ce=e=>{let t=e.productDataStore,a=e.isProductGroup,n=void 0!==a&&a;const r=t.options,s=t.isProductGridInstance,l=t.productCardElement,c=t.instance,d=Le(),u=!s&&d,p=window.vskData.app_setting_config,h=p.size_chart;let _="";if(_+=`
{const t=e.querySelector("variant-swatch-king").parentNode.getBoundingClientRect().width;return`style="width: ${t?`${t}px`:"100%"}; z-index: ${o.get(i).settings.collections.layer_index};"`})(l)}>\n
`,!n)for(let e=0;e'),"all"===D.hideSingleValueOption(c)&&r[e].values.length<=1&&(a+=" option-single-value"),_+=`
\n ${o}\n
`}return _+='
',_},Te=e=>{let t=e._content,a=e.productDataStore,n=e.swatchRootElement;const r=a.isProductGridInstance,o=a.productCardElement,i=a.instance,s=n||a.swatchRootElement,l=s.querySelector(`.swatches.swatches-type-${i}`);l&&l.querySelector("[option-target]")&&l.parentNode.removeChild(l),s.innerHTML=t,r||[{type:"size_chart",append_to:"span.swatch-size-chart",element_selector:Le()}].forEach((e=>{const t=e.append_to,a=e.element_selector;if(a){const e=o.querySelector(t);if(e){const t=new MutationObserver(((t,n)=>{const r=document.querySelector(a);if(r){e.appendChild(r);const t=e.parentElement;if(t){const a=t.querySelector("span.swatch-label-container");if(a){const t=`size-chart-${window.vskData.app_setting_config.size_chart.position}`;a.classList.add(t),a.appendChild(e)}}n.disconnect()}}));t.observe(document.body,{childList:!0,subtree:!0}),setTimeout((()=>t.disconnect()),5e3)}}}))},Ne=e=>e===u,qe=e=>{let t=e.productDataStore;return window.vskData.app_setting_styles[`${t.instance}_swatch_presentation`]},Ve=e=>{let t=e.direction,a=e.productDataStore;return`
`},Re=e=>{let t=e.type,a=void 0===t?"swatch-view-stack":t;return e.productDataStore.isProductGridInstance?"swatch-view-stack"===a?`swatch-align-${window.vskData.block_collection_settings.alignment}`:`swatch-slider-align-${window.vskData.block_collection_settings.alignment}`:""},Me=e=>{let t=e.preset,a=void 0===t?null:t,n=e.isProductGridInstance;const r=o.get(i);return n?r.settings.collections.display_label:!a||!a.params||void 0===a.params.display_label||a.params.display_label},Fe=e=>{let t=e.width,a=e.height;const n=t.split("px")[0],r=a.split("px")[0],o=2*Math.max(n,r);return o<=50?50:o>=300?300:100*Math.ceil(o/100)},He=e=>{const t=new Date(e);return new Date!!o.get(i).settings.products.handleize,ze=(e,t)=>{let a=e,n=t;for(let e=0;e<_.length;e+=1){const t=_[e];a=a.replace(RegExp(`\\${t.char}`,"gi"),t.replacer),n=n.replace(RegExp(`\\${t.char}`,"gi"),t.replacer)}return a=encodeURIComponent(a),n=encodeURIComponent(n),"cdn"===window.vskData.app_setting.swatch_url_source&&(a=encodeURIComponent(a),n=encodeURIComponent(n)),`https://${D.getSwatchUrlHost()}/apps/${window.vskData.swatch_dir}/${window.Shopify.shop.split(".myshopify.com")[0]}/swatches/${a}/${n}.media`},Be=e=>{let t=e.src,a=e.boxDimensions,n=e.backgroundSize,r=e.position,o=!0,i=n;"cover"!==i&&"contain"!==i||("contain"===i&&(o=!1),i="100%"),i=parseInt(i.replace("%",""),10),i*=2;let s="center";r&&(s=r);let l=`width=${parseInt(a[0].replace("px",""),10)*(i/100)}&height=${parseInt(a[1].replace("px",""),10)*(i/100)}${o?`&crop=${s}`:""}`;return l=t.includes("?")?`&${l}`:`?${l}`,t.match(/(\.jpg)(?=$|\?)/gm)&&(l+=""),t+l},We=e=>window.vskData.app_setting_config.preset_badge.order.find((t=>t.name===e)).order,Ue=()=>window.vskData.app_setting_config.preset_badge.order.sort(((e,t)=>e.order-t.order)).map((e=>e.name)),Je=(e,t)=>{const a={"{{currency_symbol}}":window.vskData.currency_symbol,"{{currency_code}}":window.vskData.currency,"{{amount_save}}":e.toFixed(2),"{{percentage_save}}":`${t.toFixed(2)}%`};return j(window.vskData.app_setting_config.preset_badge.sale_badge_text).replace(/{{(?:currency_symbol|currency_code|amount_save|percentage_save)}}/g,(e=>a[e]))},Ke=(e,t)=>{const a=parseFloat(e-t,10),n=e>0?a/e*100:0;return e>t&&n>=window.vskData.app_setting_config.preset_badge.min_price_diff_for_sale_badge?Je(a,n):""},Ze=(e,t)=>{if(window.vskData.product_data_source!==d||void 0===e)return"";const a=window.vskData.app_setting_config.preset_badge;switch(e){case De:return`\n ${j(a.new_badge_text)}\n `;case xe:return`\n ${j(a.sold_out_badge_text)}\n `;case Ae:{const e=parseFloat(t.min_compare_at_price-t.min_price),n=t.min_compare_at_price>0?e/t.min_compare_at_price*100:0,r=Je(e,n);return`\n${r} `}default:return""}},Xe=e=>{let t=!0;const a=Ue(),n=a.indexOf(De),r=-1!==n?a.slice(0,n):[],o=r.includes(xe),i=r.includes(Ae);for(let a=0;a{let n=null,r=Number.MAX_SAFE_INTEGER;if(window.vskData.product_data_source===d){const o=!!e.params.new_badge&&e.params.new_badge.enable,i=!!e.params.sale_badge&&e.params.sale_badge.enable,s=!!e.params.sold_out_badge&&e.params.sold_out_badge.enable,l=Ke(t.min_compare_at_price,t.min_price);o&&r>We(De)&&He(t.published_at)&&!a&&(n="New",r=We(De)),s&&r>We(xe)&&!t.available&&(n="Sold Out",r=We(xe)),i&&l&&r>We(Ae)&&(n="Sale",r=We(Ae))}return n},Qe=(e,t)=>{let a=[];const n=e.params,r=!!n.new_badge&&n.new_badge.enable,o=!!n.sale_badge&&n.sale_badge.enable,i=!!n.sold_out_badge&&n.sold_out_badge.enable,s=window.vskData.app_setting_config,l=s.preset_badge.new_show_when_all_same,c=s.preset_badge.sale_show_when_all_same,d=s.preset_badge.sold_out_show_when_all_same,u=Ue();for(let e=0;e{let a;return a=["second_product_image","second_variant_image"].includes(t)?e.secondary_src:["last_product_image","last_variant_image"].includes(t)?e.last_src:e.src,a||(a=e.src),a},tt=e=>{let t=e.featuredImageObject,a=e.productSwatch,n=e.collectionSwatch,r=null;return r=e.productDataStore.isProductGridInstance?et(t,n):et(t,a),r},at=e=>{let t=e.preset,a=e.productDataStore,n=e.optionTag,r=e.option;if(!t||!t.assoc_view_type)return null;const o={preset:t,optionTag:n,option:r,productDataStore:a};switch(t.assoc_view_type){case"swatch":return"custom_swatch"===t[`${a.instance}_swatch`]?(e=>{let t=e.preset,a=e.optionTag,n=e.option,r=e.productDataStore;const o=r.isProductGridInstance,i=`swatch-view-${t.params.swatch_style}`,s=void 0!==n.product_group_index,l=s?`data-group-index="${n.product_group_index}"`:"";let c={},d={};!s&&D.isPresetAnalyticsEnabled()&&(c=fe.getOptionLinkedData(t,n,a),"swatch-view-slide"===i&&(d=fe.getOptionLinkedSliderData(c,t)));let u=`
`;u+=``,u+=``,"swatch-view-slide"===i&&(u+='
',u+=`
`,u+=Ve({direction:"left",productDataStore:r}));const p="tooltip"===t.params.option_value_display,h=o?"32px":"80px",_=o?"32px":"80px";u+=`
    `;const g=t.params.width||t.params.swatch_size||h,m=t.params.height||t.params.swatch_size||_,v=Fe({width:g,height:m}),w=Xe(n.data),f=Qe(t,n.data);for(let e=0;e0&&(c.option_value_badge_name=Ye(t,n.data[e],w),c.option_value_index=e+1,c.option_value=o);const _=s&&n.data[e].selected;if("invisible"===t.params.stock_out_type&&0!==n.available_count&&!d&&!_)continue;u+=`"}return u+="
","swatch-view-slide"===i&&(u+=Ve({direction:"right",productDataStore:r}),u+="
"),u+="
",u})(o):(e=>{let t=e.preset,a=e.optionTag,n=e.option,r=e.productDataStore;const o=r.isProductGridInstance,i=r.defaultFeaturedImage,s=`swatch-view-${t.params.swatch_style}`,l=void 0!==n.product_group_index,c=l?`data-group-index="${n.product_group_index}"`:"";let d=`
`;d+=``,d+=``;let u={},p={};!l&&D.isPresetAnalyticsEnabled()&&(u=fe.getOptionLinkedData(t,n,a),"swatch-view-slide"===s&&(p=fe.getOptionLinkedSliderData(u,t))),"swatch-view-slide"===s&&(d+='
',d+=`
`,d+=Ve({direction:"left",productDataStore:r}));const h="tooltip"===t.params.option_value_display,_=o?"32px":"80px",g=o?"32px":"80px";d+=`
    `;const m=t.params.width||t.params.swatch_size||_,v=t.params.height||t.params.swatch_size||g,w=Qe(t,n.data),f=Xe(n.data);for(let e=0;e0&&(u.option_value_badge_name=Ye(t,n.data[e],f),u.option_value_index=e+1,u.option_value=o);const g=l&&n.data[e].selected;if("invisible"===t.params.stock_out_type&&0!==n.available_count&&!p&&!g)continue;d+=`"}return d+="
","swatch-view-slide"===s&&(d+=Ve({direction:"right",productDataStore:r}),d+="
"),d+="
",d})(o);case"drop_down":return(e=>{let t=e.preset,a=e.optionTag,n=e.option,r=e.productDataStore;const o=void 0!==n.product_group_index,i=o?` data-group-index="${n.product_group_index}"`:"";let s={};!o&&D.isPresetAnalyticsEnabled()&&(s=fe.getOptionLinkedData(t,n,a));let l,c=`
`,d="",u="";"default"===t.params.dropdown_type&&(c+=``,c+=``),c+=`
`,c+=`
`,"label_inside"===t.params.dropdown_type&&(c+=`
`),c+=``,c+='
    ';for(let e=0;ed.length&&(d=l,u=` ${d} ${t.params.display_price?`${p} `:""} `),c+=`
  • `,c+=` ${l} ${t.params.display_price?`${p} `:""} `,c+="
  • ")}return c+="
",l="double_triangle"===t.params.icon_style?'':"inverted_triangle"===t.params.icon_style?'':'',c+=l,c+="
",c+="
",c+="
",c=c.replace("{{ option_value_text }}",d),c=c.replace("{{ option_value }}",u),c})(o);case"swatch_drop_down":return(e=>{let t=e.preset,a=e.optionTag,n=e.option,r=e.productDataStore;const o=r.isProductGridInstance,i=r.instance,s=r.defaultFeaturedImage,l=void 0!==n.product_group_index,c=l?` data-group-index="${n.product_group_index}"`:"";let d={};!l&&D.isPresetAnalyticsEnabled()&&(d=fe.getOptionLinkedData(t,n,a));let u=`
`,p="",h="";u+=``,u+=``;const _=t[`${i}_swatch`],g=o?"24px":"48px",m=o?"24px":"48px",v=t.params.swatch_size||g,w=t.params.swatch_size||m,f=Fe({width:v,height:w});u+=`
`,u+='
',u+=``,u+='
    ';for(let e=0;e
`;m.length>p.length&&(p=m,h=`${$} ${p}`),u+=`
  • `,u+=$,u+=` ${m} ${t.params.display_price?`${g} `:""} `,u+="
  • "}let b;return u+="",b="double_triangle"===t.params.icon_style?'':"inverted_triangle"===t.params.icon_style?'':'',u+=b,u+="
    ",u+="
    ",u+="
    ",u=u.replace("{{ option_value_text }}",p),u=u.replace("{{ option_value }}",h),u})(o);case"button":return(e=>{let t=e.preset,a=e.optionTag,n=e.option,r=e.productDataStore;const o=r.isProductGridInstance,i=void 0!==n.product_group_index,s=i?` data-group-index="${n.product_group_index}"`:"";let l={},c={};const d=`swatch-view-${t.params.button_style}`;!i&&D.isPresetAnalyticsEnabled()&&(l=fe.getOptionLinkedData(t,n,a),"swatch-view-slide"===d&&(c=fe.getOptionLinkedSliderData(l,t)));let u=`
    `;const p=``,h=``;"inline"!==t.params.label_display_position&&(u+=p),"inline"===t.params.label_display_position&&(u+="
    ",u+=p),u+=h,"swatch-view-slide"===d&&(u+='
    ',u+=`
    `,u+=Ve({direction:"left",productDataStore:r})),u+=`
      `;for(let e=0;e`,u+=`
      `,u+=" "+(t.params.radio_button?"
      ":""),u+="
      ",u+=`
      ${s}
      `,t.params.price_badge){const a=!!t.params.price_badge.price_enabled;(!i||i&&!0===n.show_price&&!window.vskData.is_b2b)&&(u+=`
      ${n.data[e].price}
      `)}u+="
      ",u+="
      ",u+=""}}return u+="
    ","swatch-view-slide"===d&&(u+=Ve({direction:"right",productDataStore:r}),u+="
    "),"inline"===t.params.label_display_position&&(u+="
    "),u+="
    ",u})(o);case"hidden":return((e,t)=>{let a="";for(let n=0;n\n \n `,s))break}return a})(o);default:return null}},nt=(e,t,a)=>{if("swatch-pill"!==t.swatch_type&&"button"!==a&&t.adjust_margin_right&&t.adjust_margin_right){const a=e.querySelector("ul.swatch-view");if(a){const n="li.swatch-view-item",r=e.getBoundingClientRect().width,o=parseFloat(t.width.match(/[\d\.]+/g)),i=parseFloat(t.border_width.match(/[\d\.]+/g)),s=t.border_space||t.margin_swatch_horizontal,l=parseFloat(s.match(/[\d\.]+/g)),c=parseFloat(t.margin_right.match(/[\d\.]+/g)),d=parseInt((r+c)/(o+2*i+2*l+c),10);a.querySelectorAll(n).forEach(((e,t)=>{(t+1)%d==0&&(e.style.marginRight=0)}))}}},rt=e=>{let t=e.optionTag,a=e.element,n=e.selectedValue,r=e.productDataStore;const o="swatch-selected";if(void 0!==r.selectedSwatches[t]){const e=r.selectedSwatches[t];if(e.classList.remove(o),e.removeAttribute("current-product"),e.tagName!==u){const t="LI"===e.tagName?e:e.closest("li.swatch-view-item");t&&("option"===t.getAttribute("role")?t.setAttribute("aria-selected",!1):t.setAttribute("aria-checked",!1))}}if(Ne(a.tagName)&&(a.value=n),a.classList.add(o),a.tagName!==u){const e="LI"===a.tagName?a:a.closest("li.swatch-view-item");e&&("option"===e.getAttribute("role")?e.setAttribute("aria-selected",!0):e.setAttribute("aria-checked",!0)),D.isPresetAnalyticsEnabled()&&fe.updateSelectedValueInEventData(e,e.closest("ul.swatch-view, ul.swatch-drop-down-list"),r)}r.selectedSwatches[t]=a};function ot(e,t){(null==t||t>e.length)&&(t=e.length);for(var a=0,n=Array(t);a{let t=e.keyName,a=e.compareValue,n=e.strategy,r=e.options;const o=RegExp("(?:(?:optio.*?\\D)([0-3])(?:\\D|$))|(?:^([0-3])$)|(?:\\D([0-3])$)|(?:^([0-3])\\D)|(?:\\D([0-3])\\D)","gi");let i=null,s=5,l=o.exec(t),c=n;for(;null!==l;){l.index===o.lastIndex&&(o.lastIndex+=1);for(let e=1;e<=5;e+=1)l[e]&&e<=s&&(i=l[e],s=e);l=o.exec(t)}let d=null;for(let e=0;e{for(let a=0;a{let t=e.optionId,a=e.options;for(let e=0;ee.id===`gid://shopify/ProductOptionValue/${t}`));if(n)return n.name}return t},ct=(e,t)=>void 0===e?t:e,dt=e=>{let t=e.number,a=e.trailingZeroes,n=e.precision,r=e.thousands,s=e.decimal;const l=o.get(i),c=ct(n,2),u=ct(r,","),p=ct(s,".");let h=ct(a,!!l.settings.collections.price_trailing_zeroes);if(h=a?`${s}00`:"",Number.isNaN(t)||null==t)return 0;const _=(t*(window.vskData.product_data_source===d?1:.01)).toFixed(c).split(".");return _[0].replace(/(\d)(?=(\d\d\d)+(?!\d))/g,`$1${u}`)+(_[1]&&"00"!==_[1]?p+_[1]:h)},ut=(e,t)=>{const a=RegExp("{{[^{]*amount[^}]*}}","gi");let n=RegExp("{+([^}]*)}+","i").exec(e),r="";if(n&&(n=n[1].trim()),"amount"===n){const n=dt({number:t,trailingZeroes:!0,precision:2,thousands:",",decimal:"."});r=e.replace(a,n)}else if("amount_no_decimals"===n){const n=dt({number:t,trailingZeroes:!1,precision:0,thousands:",",decimal:"."});r=e.replace(a,n)}else if("amount_with_comma_separator"===n){const n=dt({number:t,trailingZeroes:!0,precision:2,thousands:".",decimal:","});r=e.replace(a,n)}else if("amount_no_decimals_with_comma_separator"===n){const n=dt({number:t,trailingZeroes:!1,precision:0,thousands:".",decimal:","});r=e.replace(a,n)}else if("amount_with_apostrophe_separator"===n){const n=dt({number:t,trailingZeroes:!0,precision:2,thousands:"'",decimal:"."});r=e.replace(a,n)}else if("amount_with_space_separator"===n){const n=dt({number:t,trailingZeroes:!0,precision:2,thousands:" ",decimal:","});r=e.replace(a,n)}else if("amount_no_decimals_with_space_separator"===n){const n=dt({number:t,trailingZeroes:!1,precision:0,thousands:" ",decimal:","});r=e.replace(a,n)}else{const n=dt({number:t,trailingZeroes:!0,precision:2,thousands:",",decimal:"."});r=e.replace(a,n)}return r};function pt(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var a=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var n,r,o,i,s=[],l=!0,c=!1;try{if(o=(a=a.call(e)).next,0===t){if(Object(a)!==a)return;l=!1}else for(;!(l=(n=o.call(a)).done)&&(s.push(n.value),s.length!==t);l=!0);}catch(e){c=!0,r=e}finally{try{if(!l&&null!=a.return&&(i=a.return(),Object(i)!==i))return}finally{if(c)throw r}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return ht(e,t);var a={}.toString.call(e).slice(8,-1);return"Object"===a&&e.constructor&&(a=e.constructor.name),"Map"===a||"Set"===a?Array.from(e):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?ht(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ht(e,t){(null==t||t>e.length)&&(t=e.length);for(var a=0,n=Array(t);a{const a=t.toLowerCase();for(let r=0;r{if(!e)return null;const a=e.optionValues[0].id.match(/\d+/)[0],n=e.optionValues.find((e=>e.name.toLowerCase()===t.toLowerCase()));return n?n.id.match(/\d+/)[0]:a},mt=(e,t)=>{if(!e)return null;const a=e.optionValues[0].name,n=e.optionValues.find((e=>e.name.toLowerCase()===t.toLowerCase()));return n?n.name:a},vt=e=>{let t=e.selectedOptionTag,a=e.selectedValue,n=e.selectedValueId,r=void 0===n?null:n,s=e.productDataStore;const l=s.keyMapping,c=s.themeSupportConfig,d=s.productCardElement,h=s.options,_=s.doNotSelectAnOption,g=s.allOptionsData,m=d.querySelectorAll(c.option_selector);if(1===m.length&&m[0].tagName===u&&"id"===m[0].name)return void(e=>{let t=e.defaultOptionSelection,a=e.selectedOptionTag,n=e.selectedValue,r=e.productDataStore;const s=r.themeSupportConfig,l=r.productCardElement,c=r.doNotSelectAnOption,d=r.allOptionsData,u=r.variants,p=t||l.querySelector(s.option_selector),h=Object.keys(u);let _=p.value;const g=[];""===_&&(s.last_variant_id||(s.last_variant_id=D.findCurrentVariantID()),_=s.last_variant_id);let m=u[_];void 0===m&&(_=h[0],p.value=_,m=u[_],D.dispatchEvent("change",p));for(let e=0;e0&&e===h.length-1&&(r=!0,t=g[0]);let v=r&&p.value!==t.id;if(r&&c.status&&c.trusted_event_detected&&(v=!0),v){s.last_variant_id=t.id,p.value=t.id,D.dispatchEvent("change",p);const e=p.closest("[data-section-type]");if(e){const a={variant:u[t.id]};D.dispatchThemeEvent("variantChange",e,a)}const a=o.get(i).configurations.products,n=l.querySelector(a.add_to_cart_selector);n&&(""===p.value?n.setAttribute("disabled",!0):n.removeAttribute("disabled"));const r=D.findCurrentVariantID();d.variantId!==r&&(d.variantId=r,D.dispatchCustomEvent(p,"product:variant:changed",d));break}if(!v&&r)break}})({defaultOptionSelection:m[0],productDataStore:s,selectedOptionTag:t,selectedValue:a});const v=o.get(i).configurations.products.custom_button_params,w=window.vskData.is_b2b;for(let e=0;e0)for(let a=0;a{let t=e.defaultOptionSelection,a=void 0===t?null:t,n=e.productDataStore;const r={},o=n.productCardElement,i=n.themeSupportConfig,s=n.variants,l=a||o.querySelector(i.option_selector);let c=0,d=l.value;const u=Object.keys(s);""===d&&(i.last_variant_id||(i.last_variant_id=D.findCurrentVariantID()),d=i.last_variant_id);let p=s[d];for(void 0===p&&(d=u[0],l.value=d,p=s[d],D.dispatchEvent("change",l));l;){const e=`option${c+1}`;if(!p[e])break;r[e]=p[e],c+=1}return r},ft=e=>(e=>{let t=e.productDataStore;const a=t.keyMapping??{},n={},r=t.productCardElement,s=t.themeSupportConfig,l=t.options,c=r.querySelectorAll(s.option_selector);if(1===c.length&&c[0].tagName===u&&"id"===c[0].name)return{currentOptions:wt({defaultOptionSelection:c[0],productDataStore:t})};const d=o.get(i).configurations.products.custom_button_params,h=window.vskData.is_b2b;for(let e=0;e0)for(let a=0;a({min_price:e[t].min_price,max_price:e[t].max_price,is_equal:e[t].min_price===e[t].max_price}),yt=(e,t,a)=>({min_price:e[t][a].min_price,max_price:e[t][a].max_price,is_equal:e[t][a].min_price===e[t][a].max_price}),St=function(e,t){let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,r=!1;return r=null==a?void 0!==e[t]:null==n?void 0!==e[t][a]:void 0!==e[t][a]&&void 0!==e[t][a][n],r},$t=e=>{let t=e.makeASelectionText;const a=e.productDataStore.productCardElement,n=o.get(i).configurations.products,r=n.add_to_cart_disabled_classes,s=a.querySelectorAll(n.add_to_cart_selector);Object.entries(s).forEach((e=>{let a=pt(e,2),o=a[0],i=a[1];if("length"!==o)if(i.setAttribute("disabled","disabled"),""!==r.trim()&&(i.className=r),i.tagName===p)i.hasAttribute("original-text")||i.setAttribute("original-text",i.value),i.value=t;else if(i.tagName===h){let e=i;i.children.length>0&&(e=i.querySelector(n.add_to_cart_text_selector)),e&&(i.hasAttribute("original-text")||i.setAttribute("original-text",e.innerHTML),e.innerHTML=t)}}))},Ot=(e,t)=>{const a=e.closest(".swatch-drop-down-label");if(a){const n=a.querySelector(".swatch-label-inside");if(n){const a=parseFloat(t.match(/[\d\.]+/g)),r=n.getBoundingClientRect().width;e.style.paddingLeft=`${a+r}px`}}},kt=(e,t,a,n)=>{"mode_1"===n.arrowMode?setTimeout((()=>{e.querySelector(t).classList.remove("star-show")}),500):e.querySelector(t).classList.add("star-disabled")},Dt=(e,t,a,n,r,o,i)=>{let s=t+e;const l=-i.totalScrollWidth+i.sliderWidth;return s>0?(s=0,kt(n,r,"left",i)):sl&&(n.querySelector(o).classList.remove("star-disabled"),"mode_0"!==i.arrowMode&&n.querySelector(o).classList.add("star-show")),a.style.transform=`translateX(${s}px)`,s},xt=e=>{let t=e.visibleSwatches>0?e.visibleSwatches:1;return"mode_1"===e.arrowMode&&(t=e.visibleSwatches>2?e.visibleSwatches-2:1),t};function At(e,t,a,n){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;const o=`${t} [navigation="left"]`,i=`${t} [navigation="right"]`,s=JSON.parse(a.dataset.sliderData);(window.matchMedia?window.matchMedia("screen and (max-width: 768px)"):window.screen.width<=768).matches||"mode_0"!==s.arrowMode||(s.arrowMode="mode_1");const l=a.querySelector(`${t}.swatch-navigable ul`);a.sliderInitialized||(((e,t)=>{const a=t.querySelector(`${e}.swatch-navigable ul`);let n,r,o,i,s=0,l=!1,c=!1,d=0;a.addEventListener("touchstart",(e=>{(e=>{n=e,r=e,o=Date.now(),l=!0,a.style.transition="none";const t=a.style.transform;if(t){const e=t.match(/translateX\(([-\d.]+)px\)/);e&&(s=parseFloat(e[1]))}})(e.touches[0].clientX)})),a.addEventListener("touchmove",(e=>{var t;e.preventDefault(),t=e.touches[0].clientX,l&&(c=!0,i=Date.now(),i-o>0&&(d=(t-r)/(i-o)),r=t,o=i,a.style.transform=`translateX(${s+(t-n)}px)`)}),{passive:!1}),a.addEventListener("touchend",(()=>{c&&(l=!1,c=!1,At(null,e,t,!0,1e3*(d||.01)))}))})(t,a),a.sliderInitialized=!0),l.style.transition=0!==r?"0.6s cubic-bezier(0.215, 0.610, 0.355, 1.000)":n?"0.3s ease-out":"none";const c=l.style.transform.match(/-?[\d\.]+/g)||[0];let d=parseFloat(c[0])||0;if(0!==r)return Dt(.25*r,d,l,a,o,i,s);if(0===e)a.querySelector(i).classList.remove("star-disabled"),"mode_0"!==s.arrowMode&&a.querySelector(i).classList.add("star-show"),"swatch-pill"===s.swatchType||"button"===s.assocViewType?(d+=.8*s.sliderWidth,d>=-s.firstSwatchWidth/2&&(d=0,kt(a,o,"left",s))):(d+=xt(s)*(s.swatchSliderItemWidth+s.marginRight),"half"===s.lastSwatchPreview&&(d+=s.swatchSliderItemWidth-s.lastSwatchWidth),d>=-s.swatchSliderItemWidth/3&&(d=0,kt(a,o,"left",s)));else if(1===e)if(a.querySelector(o).classList.remove("star-disabled"),"mode_0"!==s.arrowMode&&a.querySelector(o).classList.add("star-show"),"swatch-pill"===s.swatchType||"button"===s.assocViewType){const e=d;d-=.8*s.sliderWidth,s.totalScrollWidth<=-(d-s.sliderWidth)&&(d=e+(-s.totalScrollWidth-(e-s.sliderWidth))-1,kt(a,i,"right",s))}else{const e=d;d-=xt(s)*(s.swatchSliderItemWidth+s.marginRight),"half"===s.lastSwatchPreview&&(d-=s.swatchSliderItemWidth-s.lastSwatchWidth),Number(s.totalScrollWidth.toFixed(3))<=Number((-(d-s.sliderWidth)).toFixed(3))&&(d=Number((e+(-s.totalScrollWidth-(e-s.sliderWidth))).toFixed(3)),kt(a,i,"right",s))}return l.style.transform=`translateX(${d}px)`,d}const Et=function(e,t){At(e,'[swatch-slider="true"]',t,!(arguments.length>2&&void 0!==arguments[2])||arguments[2])},Pt=(e,t,a)=>{const n=window.matchMedia?window.matchMedia("screen and (max-width: 768px)"):window.screen.width<=768,r=e.closest(".swatch-navigable-wrapper"),o="li.swatch-view-item",i=e.querySelector("ul.swatch-view"),s=i.querySelectorAll(o).length,l=e.querySelector('[navigation="left"]'),c=e.querySelector('[navigation="right"]');let d=e.getBoundingClientRect().width;const u=r?r.getBoundingClientRect().width:null;let p,h,_,g,m,v,w,f,b,y,S=t.arrow_mode;n.matches||"mode_0"!==S||(S="mode_1");const $=t.adjust_margin_right,O=parseFloat(t.margin_right.match(/[\d\.]+/g));let k=O,x=0;if("swatch-pill"===t.swatch_type||"button"===a)m=0,i.querySelectorAll(o).forEach(((e,t)=>{e.style.width=`${e.getBoundingClientRect().width}px`,m=m+e.getBoundingClientRect().width+k,e.firstChild instanceof Element&&null!==e.querySelector(".swatch-selected")&&(f=(m-e.getBoundingClientRect().width)/(.8*d),b=t,"mode_4"===S&&(r.querySelector(".swatch-navigable").setAttribute("data-current-scroll",t),e.scrollIntoView({behavior:"auto",block:"nearest",inline:"start"}))),0===t&&(v=e.getBoundingClientRect().width),t===s-1&&(w=e.getBoundingClientRect().width,m-=k)}));else{p=parseFloat(t.width.match(/[\d\.]+/g)),h=parseFloat(t.border_width.match(/[\d\.]+/g)),_=p+2*h;const e=t.last_swatch_preview;let a=(d+k)/(_+k);"mode_1"===S&&(a=(u+k)/(_+k));let n=0;if(a>=s&&!$)n=parseInt(a,10);else{if("full"===e){if(a=(d+k)/(_+k),n=parseInt(a,10),y=d-n*_,k=Math.max(y/(n>1?n-1:1),O),k>y/(n>1?n-1:1)){const e=d-(n-1)*k;n=Math.floor(e/_)}x=n}else if("half"===e){const e=(d-(Math.floor(a)*_+Math.floor(a)*k))/_*100;let t;if((e<20||e>80)&&a>1)if(e<20)t=80,n=Math.floor(a)-1,k=parseFloat(((d-(n*_+t/100*_))/n).toFixed(3)),x=n+parseFloat(a.toFixed(2));else{t=80;const e=t/100*_,r=Math.floor(a)+e/_;n=Math.floor(r),k=parseFloat(((d-(n*_+e))/n).toFixed(3)),x=n+.8}else n=Math.floor(a),x=parseFloat(a.toFixed(2))}const t=i.querySelector(`${o}:last-child`);t&&(t.style.width=`${_}px`)}g=n,m=(_+k)*(s-1)+_,i.querySelectorAll(o).forEach(((t,a)=>{t.firstChild instanceof Element&&null!==t.querySelector(".swatch-selected")&&(f=g>0?(_+k)*a/(g*(_+k)):0,"half"===e?"mode_1"===S&&(f=g>2?(_+k)*a/((g-2)*(_+k)):a-g>=0?a-g+1:0):f=g>2?(_+k)*a/((g-2)*(_+k)):0,b=a),a!==s-1&&(t.style.width=`${_}px`,t.style.marginRight=`${k}px`)}))}i.parentElement.setAttribute("swatch-slider","true");const A={swatchSliderItemWidth:_||0,totalScrollWidth:m,sliderWidth:d,visibleSwatches:g||0,marginRight:k,swatchType:t.swatch_type,firstSwatchWidth:v,lastSwatchWidth:w,assocViewType:a,arrowMode:S,totalSwatches:x};D.isPresetAnalyticsEnabled()&&e.closest("[sa-options-position]")&&fe.updateSwatchViewLiEventData(i,x),i.style.transform="translateX(0px)",i.style.display="flex";const E=i.closest("[option-name]");if("mode_1"===S&&(d=u),g>=s||d>=m){if(l.classList.remove("star-show"),c.classList.remove("star-show"),"mode_2"===S||"mode_3"===S)e.classList.add("star-remove-margin"),A.sliderWidth=e.getBoundingClientRect().width;else if("mode_4"===S)return e.closest(".swatch-navigable").style.margin="0px",void(e.closest(".swatch-navigable").style.width="100%");i.parentElement.setAttribute("data-slider-data",JSON.stringify(A))}else{if(c.classList.add("star-show"),c.classList.remove("star-disabled"),i.style.setProperty("justify-content","unset"),i.style.setProperty("width",`${m}px`,"important"),"mode_2"===S||"mode_3"===S)l.classList.add("star-show","star-disabled"),e.classList.remove("star-remove-margin"),A.sliderWidth=e.getBoundingClientRect().width;else if("mode_0"===S)l.classList.remove("star-show"),c.classList.remove("star-show");else if("mode_4"===S){e.style.margin="auto",c.classList.add("star-show"),l.classList.add("star-show"),c.classList.remove("star-disabled"),l.classList.remove("star-disabled");const t=l.getBoundingClientRect().width+c.getBoundingClientRect().width;return void(e.closest(".swatch-navigable").style.width=`calc(100% - ${t}px)`)}f=parseInt(f,10),setTimeout((()=>{for(let t=0;t{t=e.touches[0].clientX,a=1}),{capture:!0}),i.addEventListener("touchmove",(n=>{1===a&&(a+=1,t>=n.touches[0].clientX?Et(1,e.closest(".swatch-navigable")):Et(0,e.closest(".swatch-navigable")))}),{capture:!0}),i.addEventListener("touchend",(()=>{a=0}),{capture:!0})}}),200),i.parentElement.setAttribute("data-slider-data",JSON.stringify(A))}},jt=e=>{let t=250;e.style.minWidth&&(t=parseInt(e.style.minWidth.split("px")[0],10),t||(t=250)),e.offsetWidth>t&&(t=e.offsetWidth),e.style.minWidth=`${t}px`};var It=class{constructor(e){this.themeSupportConfig=null,this.swatchRootElement=null,this.options=[],this.variants=null,this.priceInfoTree=null,this.tree=null,this.defaultFeaturedImage=null,this.productCardElement=null,this.doNotSelectAnOption=null,this.allOptionsData={variantId:null},this.keyMapping=null,this.isProductGridInstance="collections"===e,this.instance=e,this.currentVariantID=null,this.optionPresetMap=null,this.selectedSwatches={},this.infoTree={untranslatedHandle:null,id:null,handle:null,vendor:null,publishedAt:null},this.pgInfo={product_switched:!1,selected_product_group:null,featured_image_src:null,secondary_image_src:null,image_replaced_by_hover:!1,first_or_available_variant:null,preselect_variant:null},this.hasSingleVariant=!1,this.hasDefaultVariant=!1,this.appBlockSwatchRootElement=null,this.swatchRootEventAdded=!1,this.appBlockSwatchRootEventAdded=!1,this.beautifyVariantPicker=!0}};function Lt(e,t){(null==t||t>e.length)&&(t=e.length);for(var a=0,n=Array(t);a"click"===e,Tt=e=>{let t,a=e.event;const n="keyup"===a.type&&13!==a.keyCode;if(!a||n)return null;var r,o;for(t=a.target,"LI"===t.tagName&&t.hasAttribute("orig-value")&&t.children&&(t=(r=t.children,o=1,function(e){if(Array.isArray(e))return e}(r)||function(e,t){var a=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var n,r,o,i,s=[],l=!0,c=!1;try{if(o=(a=a.call(e)).next,0===t){if(Object(a)!==a)return;l=!1}else for(;!(l=(n=o.call(a)).done)&&(s.push(n.value),s.length!==t);l=!0);}catch(e){c=!0,r=e}finally{try{if(!l&&null!=a.return&&(i=a.return(),Object(i)!==i))return}finally{if(c)throw r}}return s}}(r,o)||function(e,t){if(e){if("string"==typeof e)return Lt(e,t);var a={}.toString.call(e).slice(8,-1);return"Object"===a&&e.constructor&&(a=e.constructor.name),"Map"===a||"Set"===a?Array.from(e):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?Lt(e,t):void 0}}(r,o)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())[0]);t.hasAttribute("swatch-inside")||"FONT"===t.tagName||"SVG"===t.tagName||"I"===t.tagName;)t=t.parentNode;return t.classList.contains("swatch-image-wrapper")&&(t=t.querySelector("[swatch-option]")),Ct(a.type)&&t.hasAttribute("data-navigation")?((e=>{const t=e.closest(".swatch-navigable"),a=e.getAttribute("data-navigation");if(t&&t.hasAttribute("data-current-scroll")){const e=Number(t.getAttribute("data-current-scroll")),n=t.querySelectorAll(".swatch-view-item");let r=e;if("right"===a)for(let a=e;ao.left){n[a].scrollIntoView({behavior:"smooth",block:"nearest",inline:"start"}),r=a;break}}else"left"===a&&(r=Math.max(0,e-1));const o=r===n.length-1?"end":"start";return n[r].scrollIntoView({behavior:"smooth",block:"nearest",inline:o}),void t.setAttribute("data-current-scroll",r)}Et("left"===a?0:1,t)})(t),null):t.hasAttribute("swatch-option")?t.tagName===u&&a.type!==g?null:t:null},Nt=e=>{let t=e.isProductGridInstance;const a=o.get(i);return t?a.settings.collections.label_split_symbol:a.settings.products.label_split_symbol};const qt=e=>{let t=e.element,a=e.value,n=e.similarElementFound,r=e.elements,o=!1;const i=t.closest(".swatch-navigable, variant-swatch-king"),s=t.closest(".swatch-view-stack, variant-swatch-king");if(i&&"VARIANT-SWATCH-KING"!==i.tagName){const e=t.closest(".swatch-navigable");Pt(e,a.view_type_preset.params,a.view_type_preset.assoc_view_type)}else if(s&&"VARIANT-SWATCH-KING"!==s.tagName){const e=t.closest(".swatch-view-stack");nt(e,a.view_type_preset.params,a.view_type_preset.assoc_view_type)}return n||(Ne(r[0].tagName)?D.dispatchEvent("change",r[0]):D.dispatchEvent("virtual_click",r[0]),o=!0),o};var Vt=e=>{let t=e.element,a=e.value,n=e.defaultValue,r=e.optionValueType,o=null,i=null;if(setTimeout((()=>{t.classList.add("swatch-allow-animation")}),128),Ne(t.tagName))Ot(t,a.view_type_preset.params.padding_left),o=t.value,Array.from(t.querySelectorAll("option")).find((e=>e.getAttribute("value")===n.data))&&(o=n.data,t.value=n.data);else if("true"===t.getAttribute("custom-select")){Ot(t,a.view_type_preset.params.padding_left),o=t.getAttribute("aria-label");const e=t.closest(".swatch-drop-down-inner");if(e){const t=Array.from(e.querySelectorAll(".swatch-drop-down-list li"));if(t.length>0){let e=!1;t.find((e=>e.getAttribute("value")===n.data||e.getAttribute("option-value-id")===n.data))&&(o=n.data,i=n.data,e=!0),e||(n.data=t[0].getAttribute("orig-value"),"optionValueName"===r&&(n.data=t[0].getAttribute("option-value-id")))}else D.printLog({message:"This is custom select, option values are not found!",error:!1})}}else o=t.getAttribute("orig-value"),i=t.getAttribute("option-value-id");const s=o===n.data||i===n.data;return s&&(Ne(t.tagName)?D.dispatchEvent("change",t):D.dispatchEvent("virtual_click",t)),s};function Rt(e,t){(null==t||t>e.length)&&(t=e.length);for(var a=0,n=Array(t);ae===t?a:n[t]||r[t]?r[t]:null,Ft=e=>{var t;let a=e.key,n=e.value,r=e.doNotSelectAnOption,o=e.currentOptions,i=e.swatchRootElement,s=e.productDataStore;const l=((null===(t=n.view_type_preset)||void 0===t?void 0:t.params)||{}).priceBadge;l&&l.price_enabled&&i.querySelectorAll(`[option-target="${a}"] .swatch-view-item .swatch-selector`).forEach((e=>{const t=e.dataset.value,n=(e=>{var t;let a=e.optionOne,n=e.optionTwo,r=void 0===n?null:n,o=e.optionThree,i=void 0===o?null:o,s=e.productDataStore;const l=s.options,c=s.priceInfoTree,d=lt({optionId:a,options:l}),u=lt({optionId:r,options:l}),p=lt({optionId:i,options:l}),h=null===(t=window.vskData.money_format)||void 0===t?void 0:t.trim();let _=null;if(null==u){const e=bt(c,d);_=e.is_equal?ut(h,e.min_price):`${ut(h,e.min_price)}+`}else if(null==p)if(St(c,d,u)){const e=yt(c,d,u);_=e.is_equal?ut(h,e.min_price):`${ut(h,e.min_price)}+`}else{const e=bt(c,d);_=e.is_equal?ut(h,e.min_price):`${ut(h,e.min_price)}+`}else if(St(c,d,u,p)){const e=((e,t,a,n)=>({min_price:e[t][a][n].min_price,max_price:e[t][a][n].max_price,is_equal:e[t][a][n].min_price===e[t][a][n].max_price}))(c,d,u,p);_=e.is_equal?ut(h,e.min_price):`${ut(h,e.min_price)}+`}else if(St(c,d,u)){const e=yt(c,d,u);_=e.is_equal?ut(h,e.min_price):`${ut(h,e.min_price)}+`}else{const e=bt(c,d);_=e.is_equal?ut(h,e.min_price):`${ut(h,e.min_price)}+`}return _})({optionOne:Mt(a,"option1",t,r,o),optionTwo:Mt(a,"option2",t,r,o),optionThree:Mt(a,"option3",t,r,o),productDataStore:s}),i=e.querySelector(".swatch-price-adjacent span");i&&(i.innerHTML=n)}))},Ht=e=>{let t=e.key,a=e.value,n=e.currentOptions,r=e.doNotSelectAnOption,o=e.productDataStore;const i=n[t];for(let e=0;e{let t=e.event,a=e.productDataStore;const n=a.swatchRootElement,r=a.doNotSelectAnOption,s=a.productCardElement,l=a.options,c=a.allOptionsData,d=a.hasDefaultVariant,_=a.beautifyVariantPicker,m=(e=>{let t=e.event,a=e.productDataStore;if(!t)return{skipGeneration:!1};const n=a.doNotSelectAnOption,r=a.options,s=a.allOptionsData,l=a.hasDefaultVariant,c=a.hasSingleVariant,d=D.findCurrentVariantID(a.productCardElement);a.currentVariantID=d;let _=null,m=null,v=null,w=!1;const f=Tt({event:t});if(!f)return{skipGeneration:!0,onlyTrigger:w};const b=f.hasAttribute("swatch-url"),y=Ct(t.type)&&f.tagName!==u,S=t.type===g&&f.tagName===u,$=o.get(i),O=D.isEventTrusted({event:t,_default:!0});if(b&&O&&(y||S)){if(f.hasAttribute("current-product"))return{skipGeneration:!0,onlyTrigger:w};let e="";const t=c||l;$.settings.products.persist_group_variant&&!t&&(e=(e=>{let t=e.productDataStore;const a=t.options,n=t.variants;let r="";const o=ft({productDataStore:t}).currentOptions,i=Object.keys(o),s=n[t.currentVariantID];let l="optionValueName";D.isStorefront()&&o.option1&&a.length>0&&(l=_t(a[0].optionValues,o.option1));for(let e=0;e0&&(a=s.selectedOptions[e].value),r+=`&${t}=${encodeURIComponent(a)}`}return""!==r&&(r=r.replace(RegExp("^&","gi"),"?")),r})({productDataStore:a}));let n=f.getAttribute("swatch-url");f.tagName===u&&(n=f.value);const r=n+e;return window.vskData.app_setting_config.history_free_group_navigation?window.location.replace(r):window.location.assign?window.location.assign(r):window.location.href=r,{skipGeneration:!0,onlyTrigger:w}}if("select"===f.getAttribute("type"))return(e=>{let t=e.currentEventTarget;const a=t,n=t.parentNode.querySelector("ul.swatch-drop-down-list"),r="true"===a.getAttribute("aria-expanded");a.setAttribute("aria-expanded",!r),n.classList.toggle("swatch-hide")})({currentEventTarget:f}),{skipGeneration:!0,onlyTrigger:w};if("select_value"===f.getAttribute("type")&&(e=>{let t=e.currentEventTarget;const a=t.closest("div.swatch-drop-down-inner").querySelector('div[type="select"]');a.style.minWidth&&"0px"!==a.style.minWidth||jt(a),a.innerHTML=t.innerHTML,a.setAttribute("aria-label",t.innerText),a.setAttribute("aria-expanded",!1),t.parentNode.classList.add("swatch-hide")})({currentEventTarget:f}),n.status){const e="virtual_click"===t.type||"change"===t.type&&!O,l=f.getAttribute("swatch-option"),c=r[parseInt(l[6],10)-1],d=(e=>{let t=e.name;const a=e.productDataStore.optionPresetMap;if(void 0!==a[t])return a[t].trigger_action;const n=window.vskData.product_options;for(let e=0;e1){if(D.dispatchCustomEvent(a.productCardElement,"manual:selection:hold",s),window.starapps_stock_data||(window.starapps_stock_data={}),window.starapps_stock_data.show_stock_alert=!1,!n[l]&&e){let e=j(n.text);e=e.replace(/{{\s*option_name\s*}}/gm,c.name);const t=f.closest("div.swatch-single").querySelector("label.swatch-label");if(Ne(f.tagName)){const t=document.createElement("option");t.value="",t.innerHTML=e,f.insertBefore(t,f.options[0]),f.selectedIndex=0}else if("select_value"===f.getAttribute("type")){let t=f.closest(".swatch-drop-down-inner");t&&(t=t.querySelector('[type="select"]'),t.querySelector("span").innerHTML=e,jt(t))}else t.hasAttribute("original-text")||t.setAttribute("original-text",t.innerHTML),t.innerHTML=`${e}`;if(!n.allow_virtual_trigger){if(n.control_add_to_cart){let e=j(n.make_a_selection_text);e=e.replace(/{{\s*option_name\s*}}/gm,n.option_name),$t({makeASelectionText:e,productDataStore:a})}return{skipGeneration:!0,onlyTrigger:w}}w=!0}else if(!e){n.trusted_event_detected=!0,(e=>{let t=e.productDataStore;const a=o.get(i).configurations.products;t.productCardElement.querySelectorAll(a.add_to_cart_selector).forEach((e=>{if(e.removeAttribute("disabled"),a.add_to_cart_enabled_classes&&""!==a.add_to_cart_enabled_classes.trim()&&(e.className=a.add_to_cart_enabled_classes),e.tagName===p&&e.hasAttribute("original-text")){const t=e.getAttribute("original-text");e.removeAttribute("original-text"),e.value=t}else if(e.tagName===h){let t=e;if(e.children.length>0&&(t=e.querySelector(a.add_to_cart_text_selector)),t&&e.hasAttribute("original-text")){const a=e.getAttribute("original-text");e.removeAttribute("original-text"),t.innerHTML=a}}}))})({productDataStore:a});const e=f.closest("div.swatch-single").querySelector("label.swatch-label"),t=e.getAttribute("original-text");t&&(e.removeAttribute("original-text"),e.innerHTML=t),Ne(f.tagName)&&!n[l]&&f.remove(0),n[l]||(n.count+=1,n[l]=!0)}}else n[l]||(n.count+=1,n[l]=!0)}if(Ne(f.tagName)&&f.options&&f.options.length>1&&Ct(t.type))return{skipGeneration:!0,onlyTrigger:w};if(f.hasAttribute("swatch-option")){v=f.getAttribute("swatch-option"),_=v;let e=null;if(Ne(f.tagName))e=f.value;else{e=f.getAttribute("orig-value"),m=f.getAttribute("option-value-id");const t=f.closest("[option-target]").querySelector("span.swatch-variant-name"),n=f.getAttribute("data-value");t&&"null"!==e&&"none"!==n&&(t.innerHTML=` ${Nt({isProductGridInstance:a.isProductGridInstance})} ${n}`)}if(w||rt({optionTag:v,element:f,selectedValue:e,productDataStore:a}),vt({selectedOptionTag:v,selectedValue:e,selectedValueId:m,productDataStore:a}),w&&n.control_add_to_cart){let e=j(n.make_a_selection_text);e=e.replace(/{{\s*option_name\s*}}/gm,n.option_name),$t({makeASelectionText:e,productDataStore:a})}}return{skipGeneration:!1,optionToSkip:_,onlyTrigger:w}})({event:t,productDataStore:a}),v=m.skipGeneration,w=m.optionToSkip,f=m.onlyTrigger;if(d)return;const b=w;if(v)return;(e=>{let t=e.doNotSelectAnOption,a=e.options,n=e.allOptionsData,r=e.productCardElement;t.status&&t.count>=a.length&&(t.status=!1,window.starapps_stock_data||(window.starapps_stock_data={}),window.starapps_stock_data.show_stock_alert=!0,D.dispatchCustomEvent(r,"selection:release",n))})({doNotSelectAnOption:r,allOptionsData:c,productCardElement:s,options:l});const y=ft({productDataStore:a}).currentOptions;if(D.printLog({message:y,error:!1}),void 0===y.option1){D.printLog({message:"currentOption was not properly formed!",error:!1});for(let e=0;e{let t=e.event,a=e.productDataStore,n=e.currentOptions;const r=a.options,s=o.get(i);let l="optionValueName";if(!t&&s.settings.products.persist_group_variant&&window.decodeURIComponent&&window.location.href.includes("option1=")&&!window.location.href.includes("variant=")){const e=/option\d=[^\&]*/gm,t=window.location.href;let o=e.exec(t),i=0;for(;null!==o;){o.index===e.lastIndex&&(e.lastIndex+=1);const s=o[0].split("="),c=s[0];let d,u=decodeURIComponent(s[1]);0===i&&D.isStorefront()&&(l=_t(r[0].optionValues,u)),"optionValueName"===l&&D.isStorefront()?(u=mt(r[i],u),d=gt(r[i],u),n[c]=u):"optionValueId"===l&&(d=gt(r[i],u),n[c]=d),n[c]=d||u,vt({selectedOptionTag:c,selectedValue:u,selectedValueId:d,productDataStore:a}),i+=1,o=e.exec(t)}}return l})({event:t,currentOptions:y,productDataStore:a});if(!_)return;let $;window.vskData.money_format&&($=window.vskData.money_format.trim());const O=(e=>{let t=e.moneyFormat,a=e.options,n=e.productDataStore.tree,r=null;const o={},i=Object.keys(a);for(let e=0;e{let t=e.optionNode,a=e.optionToSkip,n=e.onlyTrigger,r=e.currentOptions,o=e.doNotSelectAnOption,i=e.swatchRootElement,s=e.productDataStore,l=e.optionValueType;const c=Object.entries(t);let d=a;for(let e=0;e0&&g[0].closest&&(g[0].closest("div.swatch-single").style.display="none"),D.printLog({message:`Generated UI for - ${a}`,error:!1});const m={data:r[a]};let v=!1,w=!1;for(let e=0;e{let t=e.productDataStore;const a=t.swatchRootElement,n=t.appBlockSwatchRootElement,r=[];return["click","change","virtual_click","keyup"].forEach((e=>{const o=e=>{Gt({event:e,productDataStore:t})};r.push({eventName:e,handler:o}),a&&!t.swatchRootEventAdded&&a.addEventListener(e,o),n&&!t.appBlockSwatchRootEventAdded&&n.addEventListener(e,o)})),a&&(t.swatchRootEventAdded=!0),n&&(t.appBlockSwatchRootEventAdded=!0),()=>{a&&r.forEach((e=>{let t=e.eventName,n=e.handler;a.removeEventListener(t,n)})),n&&r.forEach((e=>{let t=e.eventName,a=e.handler;n.removeEventListener(t,a)}))}},Bt=e=>{let t=e.untranslatedProductIds;return`query productDetails @inContext(country: ${window.Shopify.country.toUpperCase()}, language: ${D.convertLanguageCode(window.Shopify.locale)}) {\n nodes(ids: [${t.map((e=>`"${e}"`)).join(", ")}]) {\n ... on Product {\n id\n handle\n title\n vendor\n availableForSale\n onlineStoreUrl\n tags\n publishedAt\n priceRange{\n maxVariantPrice{\n amount\n }\n minVariantPrice{\n amount\n }\n }\n featuredImage{\n id\n url\n }\n options{\n id\n name\n values\n optionValues{\n id\n name\n }\n }\n images(first: 250){\n nodes{\n id\n url\n altText\n }\n }\n compareAtPriceRange {\n maxVariantPrice {\n amount\n }\n minVariantPrice {\n amount\n }\n }\n }\n }\n}`};var Wt={getGroupsAndGroupChart:async e=>{let t=e.handle;const a=await(async e=>{let t=e.handle;try{const e=window.Shopify.shop.split(".myshopify.com")[0],a=window.vskData.product_data_source,n=window.vskData.lambda_cloudfront_url,r=await fetch(`${n}/store/${e}/${a}/groups/${t}.json`);if(!r.ok)throw new Error(`Failed to fetch product groups: ${r.status} ${r.statusText}`);return r.json()}catch(e){return console.error("Error fetching product groups from Lambda:",e),[]}})({handle:t}),n={};for(let e=0;ee.handle===t))&&(n[t]?n[t].some((t=>t===e))||n[t].push(e):n[t]=[e]);return{productGroupsChart:n,productGroups:a}}};function Ut(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function Jt(e){for(var t=1;t{let t=e.groupData,a=e.productDataStore,n=null,r=null,o=null;const i=window.matchMedia?window.matchMedia(S):window.screen.width<=768;if(a.isProductGridInstance){let e=t.collections_preset_id;!t.same_collections_preset_for_mobile&&i.matches&&(e=t.mobile_collections_preset_id),n=null==e||"0"===e.toString()?U():window.vskData.presets[e]}else n=window.vskData.presets[t.products_preset_id],!t.same_products_preset_for_mobile&&i.matches&&(n=window.vskData.presets[t.mobile_products_preset_id]);return r=t.products_swatch,o=t.collections_swatch,i.matches&&(t.same_products_preset_for_mobile||(r=t.mobile_products_swatch),t.same_collections_preset_for_mobile||(o=t.mobile_collections_swatch)),void 0!==n?Jt({products_swatch:r,collections_swatch:o},n):Jt({products_swatch:r||t.products_swatch,collections_swatch:o||t.collections_swatch},W({productDataStore:a}))};function Xt(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function Yt(e){for(var t=1;t{var t,a,n,r,o;let i=e.optionValue,s=e.translatedHandles,l=e.key;const c=`gid://shopify/Product/${i.id}`,d=window.vskData.app_setting_config.default_swatch_image;if(null!=s&&s[c]){var u;const e=s[c],i=(null===(u=e.images)||void 0===u||null===(u=u.nodes)||void 0===u?void 0:u.length)||0;switch(l){case"title":default:return e.title;case"handle":return e.handle;case"minPrice":return parseFloat((null===(t=e.priceRange)||void 0===t||null===(t=t.minVariantPrice)||void 0===t?void 0:t.amount)||0);case"maxPrice":return parseFloat((null===(a=e.priceRange)||void 0===a||null===(a=a.maxVariantPrice)||void 0===a?void 0:a.amount)||0);case"available":return e.availableForSale;case"featured_img":return(null===(n=e.featuredImage)||void 0===n?void 0:n.url)||d;case"secondary_img":return i>1&&(null===(r=e.images.nodes[1])||void 0===r?void 0:r.url)||d;case"last_img":return i&&(null===(o=e.images.nodes[i-1])||void 0===o?void 0:o.url)||d}}return i[l]},ta=e=>{let t=e.groupData;const a={},n=t.option_values.filter((e=>{const n=q.getKey({handleOrId:e.id,defaultLanguage:!1,detail:v}),r=q.getKey({handleOrId:e.id,defaultLanguage:!1,detail:m}),o=q.getData(n)||q.getData(r);if(null!=o&&o.id){a[`gid://shopify/Product/${e.id}`]=o;const n=t.option_values.findIndex((t=>t.id===e.id));return-1!==n&&(t.option_values[n]=Yt(Yt({},t.option_values[n]),{},{available:o.available,published:!0,published_at:o.publishedAt,compare_at_price:o.compareAtPriceRange})),!1}return!0})).map((e=>`gid://shopify/Product/${e.id}`));return{sessionStorageTranslatedHandles:a,untranslatedProductIds:n}};const aa=e=>{let t=e.optionTag,a=e.handle,n=encodeURIComponent(a);return"cdn"===window.vskData.app_setting.swatch_url_source&&(n=encodeURIComponent(n)),`https://${D.getSwatchUrlHost()}/apps/${window.vskData.swatch_dir}/${D.getStoreSlug()}/groups/${t.split("group")[1]}/${n}.media`};var na=e=>{let t=e.productGroupIndex,a=e.swatchesContainer,n=e.optionTag,r=e.groupData,s=e.productHandle,l=e.translatedHandles,c=void 0===l?null:l,d=e.productDataStore,u=!1;const p=r.option_name?r.option_name:"",h={available_count:0,name:j(p),untranslated_name:p,view_type_preset:Zt({groupData:r,productDataStore:d}),product_group_index:t,data:[],show_price:!1};let _=0,g=(d.isProductGridInstance,null);if(0===g&&(_+=1),"hidden"!==h.view_type_preset.assoc_view_type){let e=null;const t=P();e=`${t.current_url}/products`;let a=!1;h.view_type_preset&&"invisible"===h.view_type_preset.params.stock_out_type&&(a=!0);const o=r.option_values.every((e=>!ea({optionValue:e,translatedHandles:c,key:"available"})));for(let i=0;i',a.querySelector(`[option-target="${n}"]`).appendChild(Ee(v)[0]),"smart_hide"===o.get(i).settings[d.instance].hide_single_value_option){let e=!1,t=null;const n=a.querySelectorAll("ul.swatch-view-image, ul.swatch-view-custom-image");Array.from(n).forEach(((a,r)=>{const o=1===a.children.length?a.closest("div[option-target]"):null;o?(o.classList.add("option-single-value"),null==t&&(t=o)):e=!0,!e&&t&&r===n.length-1&&t.classList.remove("option-single-value")}))}u&&("drop_down"===h.view_type_preset.assoc_view_type&&"label_inside"===h.view_type_preset.params.dropdown_type&&a.querySelectorAll("div.swatch-drop-down-inner [type='select']").forEach((e=>{Ot(e,h.view_type_preset.params.padding_left)})),"button"===h.view_type_preset.assoc_view_type&&(h.view_type_preset.params.full_width||h.view_type_preset.params.radio_button)&&a.querySelectorAll(".enable-price-alignment").forEach((e=>{(e=>{const t=e.querySelectorAll(".swatch-button-price");let a=0;t.forEach((e=>{const t=e.offsetWidth;t>a&&(a=t)})),t.forEach((e=>{e.style.width=`${a}px`}))})(e)})),(e=>{let t=e.viewTypePreset,a=e.optionTag,n=e.swatchesContainer,r=e.remainingProductsCount,o=e.productDataStore;const i=n.querySelector(`[option-target="${a}"] .swatch-group-selector[current-product]`);if(i){if(0!==r){const e=(e=>{let t=e.value,a=e.count,n=e.productDataStore;const r=Ie(t);let o=qe("collections").minified_template;o=o.replace(RegExp("{count}","gi"),a),o=o.replace(RegExp("{option_name}","gi"),r),o=o.replace(RegExp("{product_id}","gi"),n.infoTree.id),o=o.replace(RegExp("{product_handle}","gi"),n.infoTree.handle);let i=D.getRoutesRoot();return i&&""!==i&&(i=i.replace(/\/$/,"")),o=o.replace(RegExp("{routes_root}","gi"),i),Ee(`
  • ${o}
  • `)[0]})({value:i.closest("[option-name]").getAttribute("option-name"),count:r,productDataStore:o});i.closest("ul.swatch-view").appendChild(e)}if(rt({optionTag:a,element:i,selectedValue:i.getAttribute("orig-value"),productDataStore:o}),"select_value"===i.getAttribute("type")){const e=i.closest("div.swatch-drop-down-inner").querySelector('div[type="select"]');e.style.minWidth&&"0px"!==e.style.minWidth||jt(e),e.innerHTML=i.innerHTML,e.setAttribute("aria-label",i.innerText),e.setAttribute("aria-expanded",!1),i.parentNode.classList.add("swatch-hide")}const e=i.closest("[option-target]"),n=e.querySelector("span.swatch-variant-name");if(n){const t=i.getAttribute("data-value"),a=e.getAttribute("option-name");n&&a&&"empty"!==a.trim()&&"none"!==t&&(n.innerHTML=` ${Nt({isProductGridInstance:o.isProductGridInstance})} ${t}`)}const s=i.closest(".swatch-navigable, variant-swatch-king"),l=i.closest(".swatch-view-stack, variant-swatch-king");if(s&&"VARIANT-SWATCH-KING"!==s.tagName){const e=i.closest("ul.swatch-view"),a=i.closest("li.swatch-view-item"),n=!!e&&a.offsetLeft>e.clientWidth;if(s){const e=i.closest(".swatch-navigable");Pt(e,t.params,t.assoc_view_type)}n&&(e.style.scrollBehavior="auto",e.scrollLeft=a.offsetLeft-a.offsetWidth,e.style.scrollBehavior="")}else if(l&&"VARIANT-SWATCH-KING"!==l.tagName){const e=i.closest(".swatch-view-stack");nt(e,t.params,t.assoc_view_type)}}})({viewTypePreset:h.view_type_preset,optionTag:n,swatchesContainer:a,remainingProductsCount:_,productDataStore:d}))},ra=e=>`\n query productGroupsData {\n product(id: "gid://shopify/Product/${e}") {\n id\n handle\n metafield(namespace: "vsk", key: "group_data") {\n value\n }\n }\n }\n `;function oa(e,t){(null==t||t>e.length)&&(t=e.length);for(var a=0,n=Array(t);aObject.entries(e).reduce(((r,o)=>{let i=(d=2,function(e){if(Array.isArray(e))return e}(c=o)||function(e,t){var a=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var n,r,o,i,s=[],l=!0,c=!1;try{if(o=(a=a.call(e)).next,0===t){if(Object(a)!==a)return;l=!1}else for(;!(l=(n=o.call(a)).done)&&(s.push(n.value),s.length!==t);l=!0);}catch(e){c=!0,r=e}finally{try{if(!l&&null!=a.return&&(i=a.return(),Object(i)!==i))return}finally{if(c)throw r}}return s}}(c,d)||function(e,t){if(e){if("string"==typeof e)return oa(e,t);var a={}.toString.call(e).slice(8,-1);return"Object"===a&&e.constructor&&(a=e.constructor.name),"Map"===a||"Set"===a?Array.from(e):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?oa(e,t):void 0}}(c,d)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),s=i[0],l=i[1];var c,d;const u=e.hasOwnProperty("products"),p=t[s]||(u?a[s]:s);return Array.isArray(l)?r[p]=l.map((e=>ia(e,a,a,n))):r[p]="object"==typeof l&&null!==l?"group_display_name"===s||"product_display_name"===s?l[n]||null:ia(l,t,a,n):l,r}),{});var sa=async e=>{let t=e.handle,a=e.productId;const n=await(async e=>{var t,a;let n=e.handle,r=e.productId;const o=q.getData(q.getKey({handleOrId:n,defaultLanguage:!0,detail:w}));if(null!=o&&null!==(t=o.data)&&void 0!==t&&t.length)return o;const i=await T({query:ra(r)}),s=null==i||null===(a=i.data)||void 0===a||null===(a=a.product)||void 0===a||null===(a=a.metafield)||void 0===a?void 0:a.value;if(!s)return[];const l=JSON.parse(s);return q.setData(q.getKey({handleOrId:n,defaultLanguage:!0,detail:w}),l),l})({handle:t,productId:a}),r={group_id:"id",group_name:"group_name",group_display_name:"option_name",product_page_style_id:"products_preset_id",product_page_swatch_source:"products_swatch",collection_page_style_id:"collections_preset_id",collection_page_swatch_source:"collections_swatch",group_display_position:"display_position",primary_locale:"primary_locale",products:"option_values"},o={id:"id",product_display_name:"option_value",handle:"handle",published:"published"},i=[],s={};n.forEach((e=>{i.push(ia(e,r,o,e.primary_locale))}));for(let e=0;ee.handle===t))&&(s[t]?s[t].some((t=>t===e))||s[t].push(e):s[t]=[e]);return{productGroupsChart:s,productGroups:i}};function la(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function ca(e){for(var t=1;t{let t=e.productsJson,a=e.untranslatedProductIds,n=e.translatedHandles,r=e.groupData;const o=t.data.nodes,i=t.extensions.context,s=i.country,l=i.language;a.forEach(((e,t)=>{const a=o[t],i=e.match(/\d+/)[0];if(n[e]=a,q.setData(q.getKey({handleOrId:i,defaultLanguage:!1,country:s,language:l,detail:m}),a),a){q.setData(q.getKey({handleOrId:a.handle,defaultLanguage:!1,detail:m}),a);const e=r.option_values.findIndex((e=>e.id===parseInt(i,10)));-1!==e&&(r.option_values[e]=ca(ca({},r.option_values[e]),{},{available:a.availableForSale,published:!0,published_at:a.publishedAt,compare_at_price:a.compareAtPriceRange}))}else r.option_values=r.option_values.filter((e=>e.id!==parseInt(i,10)))}))},pa=async e=>{var a;let n=e.productDataStore;const r=n.infoTree,s=n.isProductGridInstance,l=n.pgInfo;if(void 0===window.starapps_data&&!f&&!b)return void setTimeout((()=>pa({productDataStore:n})),250);if(!s&&t()&&(null===(a=window.vskData)||void 0===a||null===(a=a.app_setting_config)||void 0===a||null===(a=a.product_template)||void 0===a||!a.group_swatches))return;const c=P().not_default_language?r.untranslatedHandle:r.handle,d=await(e=>{let t=e.handle,a=e.productId;return f?Wt.getGroupsAndGroupChart({handle:t}):b?sa({handle:t,productId:a}):{productGroupsChart:window.starapps_data.product_groups_chart,productGroups:window.starapps_data.product_groups}})({handle:c,productId:r.id}),u=d.productGroupsChart,p=d.productGroups,h=u[c],_=(e=>{let t=e.indexes,a=e.productGroups;const n=[];if(!a||!t)return n;for(let e=0;e{var t;let a=e.productHandle,n=e.productDataStore;const r=document.querySelector("div[data-vsk-groups-priority]"),s=null==r||null===(t=r.dataset)||void 0===t?void 0:t.vskProductHandle,l=n.appBlockSwatchRootElement,c=n.swatchRootElement,d=n.instance;if(s===a){if(l)return l.querySelector(`.swatches.swatches-type-${d}`);let e=r;const t=document.createElement("variant-swatch-king"),a=o.get(i).configurations.products.swatch_position;return t.style.maxWidth="100%","before"===a?e.parentNode.insertBefore(t,e):"after"===a?e.parentNode.insertBefore(t,e.nextSibling):"top"===a?e.insertBefore(t,e.firstChild):e.appendChild(t),e=t,Te({_content:Ce({productDataStore:n,isProductGroup:!0}),productDataStore:n,swatchRootElement:e}),n.appBlockSwatchRootElement=e,zt({productDataStore:n}),e.querySelector(`.swatches.swatches-type-${d}`)}return c.querySelector(`.swatches.swatches-type-${d}`)})({productHandle:c,productDataStore:n}),m={top:0,bottom:0},v={top:[],bottom:[]};_.forEach((async(e,t)=>{const a=`group${e.id}`;for(let t=0;t`;if("top"===e.display_position){const e=g.querySelector('[sa-group-position="top"]');e.querySelector(`[option-target="${a}"]`)||e.insertBefore(Ee(o)[0],e.children[m.top])}else{const e=g.querySelector('[sa-group-position="bottom"]');if(!e.querySelector(`[option-target="${a}"]`)){const t=e.children.length-1-m.bottom;-1!==m.bottom?e.insertBefore(Ee(o)[0],e.children[t]):e.append(Ee(o)[0])}}let i={};const d=h[t];if(!l.selected_product_group||l.selected_product_group!==a){const t=ta({groupData:e}),a=t.sessionStorageTranslatedHandles,n=t.untranslatedProductIds;if(i=ca({},a),n.length>0){const t=250;for(let a=0;a{const t=document.querySelectorAll(e);t.forEach((e=>{void 0===e.vsk_initialized&&e.setAttribute("swatch-generated",!0)})),$.publish("productFullElements",t)},wa=(()=>{let e=!1;return t=>{let a=t.productDataStore;zt({productDataStore:a}),e||(window.document.addEventListener("click",(e=>{let t=e.target;for(;t.hasAttribute("swatch-inside");)t=t.parentNode;const a=document.querySelectorAll("ul.swatch-drop-down-list:not(.swatch-hide)");for(let e=0;e{let t=e.productDataStore,a=e.swatchDisplayLocationFound;if(!t.themeSupportConfig.deferred||D.isPageLoaded()){((e,t)=>{t&&Te({_content:Ce({productDataStore:e}),productDataStore:e}),wa({productDataStore:e}),D.printLog({message:"Generating swatch UI...",error:!1})})(t,a);try{Gt({productDataStore:t})}catch(e){console.error(e)}try{ha({productDataStore:t})}catch(e){console.error(e)}}else setTimeout((()=>{fa({productDataStore:t,swatchDisplayLocationFound:a})}),250)},ba=async e=>{var a,n,r;let d=e.element,u=e.isPrimarySection;d.vsk_initialized=!0;const p=((e,t)=>{const a=D.pathName();return t?a:(e=>{let t=null;if(t=e.matches&&e.matches(s)?e:e.querySelector(s),t){let e=null;return l.some((a=>!(!t.hasAttribute(a)||!t.getAttribute(a)||(e=t.getAttribute(a),0)))),D.extractProductHandle(e)}return null})(e)})(d,u);if(!p)return void D.printLog({message:"Could not find Product Full handle",error:!0});d.setAttribute("swatch-generated",p);const h=M(p),_=new It("products");_.productCardElement=d,_.doNotSelectAnOption=ga(ga({},window.vskData.app_setting_config.do_not_select_an_option),{},{count:0});const g=o.get(i),m=(e=>{let t=e.productConfigurations,a=e.productCardElement;const n=t.swatch_root.position??"bottom",r=t.swatch_root.selector;let o=a.querySelector(r);if(!o&&a.matches&&a.matches(r)&&(o=a),o){const e=document.createElement("variant-swatch-king");e.style.maxWidth="100%","before"===n?o.parentNode.insertBefore(e,o):"after"===n?o.parentNode.insertBefore(e,o.nextSibling):"top"===n?o.insertBefore(e,o.firstChild):o.appendChild(e),o=e}return o})({productConfigurations:null==g||null===(a=g.configurations)||void 0===a?void 0:a.products,type:"options",handle:p,productCardElement:d});let v=!1;m?v=!0:D.printLog({message:"We cannot find any swatch display location, please get in touch with us at support@starapps.studio",error:!0});const w=!_.isProductGridInstance&&t()&&(null===(n=window.vskData)||void 0===n||null===(n=n.app_setting_config)||void 0===n||null===(n=n.product_template)||void 0===n?void 0:n.variant_swatches);_.beautifyVariantPicker=w,_.swatchRootElement=m;const f=await h,b=null===(r=window.vskData)||void 0===r||null===(r=r.app_setting_config)||void 0===r?void 0:r.app_execution_strategy;if("all"!==b){var y,S;if("enabled_except"===b&&null!=f&&null!==(y=f.tags)&&void 0!==y&&y.includes("vsk_disable"))return void D.printLog("App won't run as vsk_disable is present in product tags with strategy enabled_except");if("disabled_except"===b&&(null==f||null===(S=f.tags)||void 0===S||!S.includes("vsk_enable")))return void D.printLog("App won't run as vsk_enable is not present in product tags with strategy disabled_except")}const $=await te({product:f,productDataStore:_});Object.assign(_,$);let O=0;const k=setInterval((()=>{try{(e=>{var t,a,n;let r=e.productDataStore,s=e.swatchDisplayLocationFound,l=e.withException,d=void 0===l?null:l;const u=r.productCardElement,p=r.hasDefaultVariant,h=r.hasSingleVariant,_=o.get(i),g=null==_||null===(t=_.configurations)||void 0===t?void 0:t.products,m=null==g?void 0:g.theme_type;let v=null==g||null===(a=g.option_selectors)||void 0===a?void 0:a.trim();var w;if(p)return r.themeSupportConfig={option_selector:v,hide_elements:`${g.hide_elements}, ${v}`,key_mapping:{},index_strategy:null,deferred:null==_||null===(w=_.settings)||void 0===w||null===(w=w.products)||void 0===w?void 0:w.init_deferred},void fa({productDataStore:r,swatchDisplayLocationFound:s});h&&D.isPageLoaded()&&d&&(v='[name="id"]');let f=null;const b=!!m;if(v){if(!u.querySelector(v))throw D.printLog({message:"Option selector was not found!",error:!1}),new Error("VSK:OptionSelectorNotFoundException");f={theme_type:b?m:"common",option_selector:v,hide_elements:"noelement"}}else for(let e=0;e0}),clearInterval(k)}catch(e){D.isPageLoaded()&&O>=3?clearInterval(k):D.isPageLoaded()&&"VSK:OptionSelectorNotFoundException"===e.message&&(O+=1)}}),250)};var ya=()=>({initializeAllElements:e=>{const t=1===e.length&&D.isProductPage();e.forEach((e=>{void 0===e.vsk_initialized&&ba({element:e,isPrimarySection:t})}))},dissect:va});const Sa=(e,t)=>{setInterval((()=>{const t=document.querySelectorAll(e);t.forEach((e=>{void 0===e.vsk_initialized&&(e.vsk_initialized=!0,e.setAttribute("swatch-generated","none"))})),$.publish("productGridElements",t)}),t)};function $a(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function Oa(e){for(var t=1;t{},dissect:Sa};var Aa=()=>({dissect:e=>{let t=e.forProductFull,a=e.forProductGrid;const n=(()=>{const e=window.vskData.theme_settings,t=window.vskData.theme_settings_map;if(!e||!t)return null;const a=((e,t)=>{var a,n,r;const o=window.vskData.published_theme_setting,i=(null===(a=window.Shopify)||void 0===a||null===(a=a.theme)||void 0===a?void 0:a.id)??null;if(t[i])return t[i];console.warn("Swatch King App: Theme ID was not located in the app metafields for this theme, please contact support.");const s=(null===(n=window.Shopify)||void 0===n||null===(n=n.theme)||void 0===n?void 0:n.schema_name)??null;let l=Object.values(e).find((e=>e.schema_theme_names.includes(s)));if(l)return l.id;const c=(null===(r=window.Shopify)||void 0===r||null===(r=r.theme)||void 0===r?void 0:r.theme_store_id)??null;return l=Object.values(e).find((e=>e.theme_store_ids.includes(c))),l?l.id:(console.warn("Swatch King App: Theme configuration not found for this theme. Currently using the published theme configuration."),o)})(e,t);a||D.printLog({message:"Theme configuration not found for this theme, please contact support.",error:!0});const n=Oa({},e[a]);if(n){const e=window.vskData.block_collection_settings;e&&(n.settings.collections=Oa(Oa({},n.settings.collections),e))}return n})();if(o.set(i,n),!n)return;(e=>{let t=e.themeSettings;if(document.querySelector('style[app="vsk"][role="custom-css"]'))return;const a=t.custom_css,n=window.vskData.app_setting_config.size_chart.size_chart_app_css;if(!a&&!n)return;const r=document.createElement("style");r.innerHTML=`${a} ${n}`,r.setAttribute("role","custom-css"),r.setAttribute("app","vsk"),r.setAttribute("type","text/css"),document.head.appendChild(r)})({themeSettings:n}),(e=>{let t=e.themeSettings;if(document.querySelector('script[app="vsk"][role="custom-script"]'))return;const a=t.custom_scripts||[];if(0===a.length)return;let n="";for(let e=0;e{(()=>{if(!(()=>{const e="VariantSwatchKingNew",t=RegExp("\\/collections\\/[^\\/]*(?=\\/products)|\\/$","gi"),a=window.location.pathname.replace(t,"");return(void 0===window[e]||window[e]!==a)&&(window[e]=a,!0)})())return;const e=ya(),a=t();a&&$.subscribe("productFullElements",(t=>e.initializeAllElements(t)));const n=Aa();n.dissect({forProductFull:a,forProductGrid:!1}),setInterval((()=>{n.dissect({forProductFull:a,forProductGrid:!1})}),1e3),Ea||document.addEventListener("vsk:product:refresh",(()=>{setTimeout((()=>{e.dissect(),D.printLog({message:"Refreshing product swatch lookup complete.",error:!1})}),0)})),Ea=!0})()}),500)}();