"use strict";(self.webpackChunkui=self.webpackChunkui||[]).push([[11],{232:(e,n,t)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.bundle_configuration=void 0;const r=t(2),i=t(233);n.bundle_configuration=r.content.object({name:"Bundle Configuration",type:"bundle_configuration",key:"key",fields:{display_name:r.content.singleLineTextField({name:"Display Name",required:!0}),percent_discount:r.content.integerField({name:"Percent Discount",required:!0}),bundle_quantity:r.content.integerField({name:"Bundle Quantity",required:!0}),bundle_parent_variant:r.content.listField({name:"Bundle Parent Variant",required:!0,fieldType:"mixedReferenceField",references:[i.bundle_parent_variant]}),default_bundle_image:r.content.fileField({name:"Default Bundle Image",required:!1}),key:r.content.singleLineTextField({name:"Key",required:!0}),disable_bundle:r.content.booleanField({name:"Disable Bundle",required:!1}),max_pre_order_discount:r.content.integerField({name:"Max Pre-Order Discount",required:!1})}})},233:(e,n,t)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.bundle_parent_variant=void 0;const r=t(2);n.bundle_parent_variant=r.content.object({name:"Bundle Parent Variant",type:"bundle_parent_variant",fields:{display_name:r.content.singleLineTextField({name:"Display Name",required:!0}),variant_id:r.content.singleLineTextField({name:"variantId",required:!0}),variant:r.content.variantField({name:"Variant",required:!0})}})},32:function(e,n,t){var r=this&&this.__awaiter||function(e,n,t,r){return new(t||(t=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function u(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var n;e.done?i(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(a,u)}l((r=r.apply(e,n||[])).next())}))};Object.defineProperty(n,"__esModule",{value:!0}),n.DISCOUNT_PREORDER=void 0,n.getBundleConfig=function(e){return r(this,void 0,void 0,(function*(){const n=yield e.getContent(o.bundle_configuration,"default");if(!n||(null==n?void 0:n.disable_bundle))return{bundleConfig:void 0};const t=function(e,n){var t,r,i;if(n.bundle_parent_variant.length<=1)return n.bundle_parent_variant[0];const o=null!==(t=e.getAssignment("bundle_parent_variant"))&&void 0!==t?t:"default";return null!==(i=null!==(r=n.bundle_parent_variant.find((e=>e.variant_id===o)))&&void 0!==r?r:n.bundle_parent_variant.find((e=>"default"===e.variant_id)))&&void 0!==i?i:n.bundle_parent_variant[0]}(e,n),r=function(e){if(e)return e.split("gid://shopify/ProductVariant/")[1]}(null==t?void 0:t.variant.id);return{bundleConfig:Object.assign(Object.assign({},n),{default_bundle_image:(0,l.convertImageMedia)(n.default_bundle_image)}),bundleParent:r,bundleTagMessage:null==t?void 0:t.display_name,isDynamicDiscount:d(n)}}))},n.getBundleDiscount=c,n.getMaxBundleDiscount=function(e,n){const t=e[n];if(t)return t<7?0:t<28?5:t<30?8:t<35?10:t<50?15:t<75?20:void 0},n.getBundlePrices=function(e,n){const t=n.map((({selectedVariant:e})=>e)),r=f(e,t);return Object.assign(Object.assign({},r),{getPriceDifferences(i,o){if(!i||!o)return{priceDiff:0,preOrderPriceDiff:0};const a=n.findIndex((({selectedVariant:e})=>e.variantId===i.variantId)),u=t.map(((e,n)=>n===a?o:e)),l=f(e,u),d=r.availableForSale?r.bundlePrice:r.preOrderPrice,c=l.preOrderShipDate.displayValue;return{priceDiff:l.availableForSale?s(l.bundlePrice-d):void 0,preOrderPriceDiff:s(l.preOrderPrice-d),preOrderLabel:c}}})},n.roundToCents=s,n.maybeFilterColorsFromSibling=function({product:e,siblingProduct:n,context:t}){return(0,a.filterExtraColors)({isFilterVariation:()=>"filter"===t.getAssignment("bundleSiblingColorOptions"),heroProduct:e,product:n})};const i=t(8),o=t(232),a=t(178),u=t(5),l=t(9);function d(e){return e.handle.startsWith("dynamic-bundle-discount")}function c(e,t){if(!e.isDynamicDiscount)return e.maxBundleDiscount;const r=t.map((e=>"variantId"in e?(0,i.isPreOrderVariant)(e)?n.DISCOUNT_PREORDER:e.maxBundleDiscount:e.discount)).map((t=>t===n.DISCOUNT_PREORDER?e.maxPreOrderDiscount:t)).filter(u.isDefined);return Math.min(e.maxBundleDiscount,...r)}function s(e){return Math.round(100*e)/100}function f(e,n){var t;const r=n.reduce(((e,n)=>{var t,r;return e+parseFloat(null!==(r=null===(t=n.preorderVariant)||void 0===t?void 0:t.price)&&void 0!==r?r:"NaN")}),0),o=n.reduce(((e,n)=>e+parseFloat(n.price)),0),a=n.reduce(((e,n)=>{var t,r;return e+parseFloat(null!==(r=null!==(t=n.compareAtPrice)&&void 0!==t?t:n.price)&&void 0!==r?r:"0")}),0),u=c(e,n)/100,l=(null!==(t=e.maxPreOrderDiscount)&&void 0!==t?t:e.maxBundleDiscount)/100;return{compareAtBundlePrice:o,compareAtRetailBundlePrice:a,bundlePrice:s(o*(1-u)),bundleDiscount:u,preOrderPrice:s(r*(1-l)),preOrderShipDate:(0,i.formatPreorderBundleDate)(n,!0),availableForSale:n.every((e=>e.availableForSale))}}n.DISCOUNT_PREORDER="PREORDER"},178:(e,n,t)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.completeTheLookVariation=function({getAssignment:e,heroProduct:n,selectedVariant:t,completeTheLook:r}){var i;const u="filterProducts",l="sortProducts",d=["filterColors",u,l];if(!n)return{};const c=r.filter(((e,n)=>n<2)),s=c.some((e=>o({heroProduct:n,product:e})));if(!c.some((e=>a({product:e,selectedVariant:t})))&&!s)return{};const f=null!==(i=e("completeTheLookOptions"))&&void 0!==i?i:"default",p=f===u;return{filterColors:d.includes(f),filterProducts:p,sortProducts:p||f===l}},n.mapAndFilterCompleteLookProducts=function({variation:e,heroProduct:n,selectedVariant:t,completeTheLook:r,skipFilter:o}){return(r=function({variation:e,selectedVariant:n,completeTheLook:t,skipFilter:r}){if(!n)return t;if(!r&&e.filterProducts)return t.filter((e=>!a({product:e,selectedVariant:n})));if(e.sortProducts){const e=[...t];return e.sort(((e,t)=>{const r=a({product:e,selectedVariant:n}),i=a({product:t,selectedVariant:n});return r===i?0:i?-1:1})),e}return t}({variation:e,selectedVariant:t,completeTheLook:r,skipFilter:o})).map((t=>i({isFilterVariation:e.filterColors,heroProduct:n,product:t})))},n.filterExtraColors=i;const r=t(13);function i({isFilterVariation:e,heroProduct:n,product:t}){if(!e)return t;const r=o({heroProduct:n,product:t});if(!r)return t;if("function"==typeof e&&!e())return t;const i=t.options.map((e=>"Color"!==e.name?e:Object.assign(Object.assign({},e),{values:r}))),a=t.variants.filter((e=>e.selectedOptions.some((e=>"Color"===e.name&&r.includes(e.value)))));return Object.assign(Object.assign({},t),{options:i,variants:a})}function o({heroProduct:e,product:n}){var t,i;const o=null===(t=(0,r.getColorOption)(e.options))||void 0===t?void 0:t.values,a=null===(i=(0,r.getColorOption)(n.options))||void 0===i?void 0:i.values;if(!o||!a)return;const u=a.filter((e=>o.includes(e)));return u.length!==a.length&&0!==u.length?u:void 0}function a({product:e,selectedVariant:n}){if(!n)return!1;const t=(0,r.getSelectedColor)(n),i=(0,r.getColorOption)(e.options);return t&&!(null==i?void 0:i.values.includes(t))}}}]);