1import{o as B,a as f,p as z,j as C,c as i,i as n,b as s,z as w,d as O,e as u,q as h,t as c,H as j,n as q,T as I,F as L,x as k}from"./theme.BZYTUq4T.bundle.min.js";import{d as P,I as F,_ as M}from"./useColorUrl.DoHUuu7J.chunk.min.js";import"./_plugin-vue_export-helper.DlAUqK2U.chunk.min.js";import"./Factory.YSv_cKLT.chunk.min.js";import"./onFirstIntersect.CG2sRT4b.chunk.min.js";const N={class:"flex items-center"},R={class:"max-sm:hidden"},D={class:"ml-3 flex max-w-60 flex-col py-1 sm:ml-6"},H={class:"text-body-md"},U={class:"flex flex-wrap items-center justify-between gap-2"},Y={class:"mr-3 shrink-0 grow basis-auto text-right sm:mr-6 max-sm:py-md"},A=["disabled"],Z={__name:"ShopBar",props:{product:{type:Object,required:!0},superProduct:{type:Object,required:!0},selectedVariant:{type:Object,default:null},selectedSwatch:{type:String,default:""},initialInteraction:{type:Boolean,default:!1},scrollTarget:{type:String,default:""}},emits:{"toggle:bis":null},setup(o){const{sizeOptions:T}=P(),t=o,S=f(null),l=f(null),p=f(!1),d=()=>{if(l.value){const e=l.value.getBoundingClientRect();p.value=e.bottom<0}},V=()=>{window.addEventListener("scroll",d),d()},m=async(e=0)=>{if(t.scrollTarget){if(l.value=document.querySelector(t.scrollTarget),!l.value&&e<3)return await k(),m(e+1);d()}return l.value},b=async()=>{await k(),await m()};B(()=>{t.scrollTarget&&(l.value=document.querySelector(t.scrollTarget),V()),document.addEventListener("selectproducttype",b)}),z(()=>{window.removeEventListener("scroll",d),document.removeEventListener("selectproducttype",b)}),C(()=>t.scrollTarget,async()=>{await m()});const v=e=>{if(e){const a=document.querySelector(e);if(a){const r=a.getBoundingClientRect(),$=window.pageYOffset||document.documentElement.scrollTop,E=r.top+$-100;window.scrollTo({top:E,behavior:"smooth"})}}else window.scrollTo({top:0,behavior:"smooth"})},g=u(()=>{var e;if((e=t.selectedVariant)!=null&&e.featured_media)return t.selectedVariant.featured_media;if(t.selectedSwatch!==""){const{featured_media:a=null}=t.product.variants.find(({options:r})=>r.includes(t.selectedSwatch));return a}return null}),_=u(()=>T.value),y=u(()=>t.product.options.some(e=>{var a;return(a=_.value)==null?void 0:a.includes(e.name.toLowerCase())})),x=u(()=>t.selectedVariant?y.value===!1?t.selectedVariant.available:t.selectedVariant.available&&t.initialInteraction:!0);return(e,a)=>(n(),i(L,null,[s("div",{ref_key:"anchorElement",ref:S},null,512),(n(),w(I,{to:"main"},[s("div",{class:q(["sticky bottom-0 z-20 flex items-center justify-between gap-2 border-t border-stroke-primary-subtle bg-background transition-transform duration-500",{"translate-y-full":!p.value}])},[s("div",N,[s("div",R,[g.value?(n(),w(h(F),{key:0,image:g.value,"max-width":76},null,8,["image"])):O("",!0)]),s("div",D,[s("p",H,c(o.superProduct.title),1),s("div",U,[j(h(M),{product:o.product,"display-score":!0,class:"text-body-sm max-sm:my-0"},null,8,["product"])])])]),s("div",Y,[y.value&&o.initialInteraction===!1?(n(),i("button",{key:0,type:"button",class:"button-secondary grow",onClick:a[0]||(a[0]=r=>v(o.scrollTarget))},c(e.$t("product.form.add_to_cart_select_option",{n:"size"})),1)):o.selectedVariant&&!o.selectedVariant.available&&o.selectedVariant.is_back_in_stock_enabled?(n(),i("button",{key:1,type:"button",class:"button-secondary grow",onClick:a[1]||(a[1]=r=>e.$emit("toggle:bis",!0))},c(e.$t("back_in_stock.call_to_action")),1)):o.selectedVariant?(n(),i("button",{key:2,type:"submit",form:"ProductForm",class:"button",disabled:!x.value},c(o.selectedVariant.available?e.$t("product.form.add_to_cart_price",{p:e.$filters.money(o.selectedVariant.price)}):e.$t("product.form.add_to_cart_sold_out")),9,A)):(n(),i("button",{key:3,onClick:a[2]||(a[2]=r=>v(o.scrollTarget))},c(e.$t("product.form.select_details")),1))])],2)]))],64))}};export{Z as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.