import{Link as S}from"./ebc50768.js";import{j as t,a as c,F as N}from"./index.1ec44e23.js";import"./ef11f8a9.js";import"./2d3554bc.js";import"./616890f5.js";import{u as b}from"./c0ec5803.js";import"./3c10424c.js";import{ProductPrice as w}from"./b3acf7c8.js";import"./a8ae7088.js";import"./c268d3e4.js";import{c as p}from"./2e4f433f.js";import{h as T}from"./f6c0f361.js";import C from"./36935f46.js";import I from"./9019cbf8.js";import{M as O}from"./9e6fb8a6.js";import"./6cbd8241.js";import"./8bce3399.js";import"./b9494af1.js";import"./d6282b27.js";import"./8abb1004.js";import"./f8e98c27.js";import"./a66d801c.js";import"./4e597aa6.js";import"./3ee3f568.js";import"./ff692d55.js";import"./70628a73.js";import"./75d11d91.js";function $({checked:e,label:a,availableForSale:m}){const i=()=>{window&&window.innerWidth<1024&&window.scrollTo({top:0,behavior:"smooth"})};return t("div",{className:p(["relative w-fit border px-10 py-2 cursor-pointer overflow-hidden",e?"text-main after:bg-main":"text-gray after:bg-gray",m&&"text-black",e&&m&&"!text-main",!m&&'after:absolute after:-left-[3px] after:content-[""] after:w-[calc(100%+6px)] after:h-[1px] after:top-10 after:-rotate-[10deg]']),onClick:i,children:a})}function A({name:e,values:a}){const{setSelectedOption:m,selectedOptions:i}=b(),r=(l,n)=>{m&&m(l,n)};return c("div",{className:"[&:not(:first-child)]:mt-20",children:[t("h2",{className:"capitalize truncate mb-20",style:{gridArea:"1/1/2/2"},children:e}),t("div",{className:p("flex flex-wrap gap-5"),children:a.map(l=>{const n=(i==null?void 0:i[e])===l.name,o=`option-${e}-${l.name}`;return c("label",{htmlFor:o,children:[t("input",{className:"sr-only",type:"radio",id:o,name:`option[${e}]`,value:l.name,checked:n,onChange:()=>r(e,l.name)}),t($,{checked:n,label:l.name,availableForSale:l.availableForSale})]},o)})})]},e)}function j(){const{options:e,variants:a}=b(),i=((r,l)=>r.map(o=>{const s=o.values.map((h,f)=>({name:h,availableForSale:l[f].availableForSale}));return{...o,values:s}}))(e,a);return t("div",{className:"text-small pr-10 mt-beforeFooter sm:mt-0",children:i==null?void 0:i.map(({name:r,values:l})=>t(A,{name:r,values:l},r))})}function F({storefrontProduct:e}){var m;const{selectedVariant:a}=b();return!e||!a?null:c("div",{className:"flex",children:[t("span",{className:p("mr-fontSpace",a.compareAtPriceV2&&"text-main"),children:(m=a.priceV2)==null?void 0:m.currencyCode}),t(w,{data:e,variantId:a.id,className:p(a.compareAtPriceV2&&"mr-fontSpace text-main"),withoutCurrency:!0,withoutTrailingZeros:!0}),t(w,{data:e,priceType:"compareAt",variantId:a.id,className:p(a.compareAtPriceV2&&"line-through decoration-main"),withoutCurrency:!0,withoutTrailingZeros:!0})]})}function re({sanityProduct:e,storefrontProduct:a,emailInquire:m}){var f,d,u,x,v,g;const{selectedVariant:i,selectedOptions:r}=b(),l=T(a.options),n=i==null?void 0:i.availableForSale,o=i==null?void 0:i.quantityAvailable,s=((f=i==null?void 0:i.priceV2)==null?void 0:f.amount)==="99999.0",h=(d=i==null?void 0:i.priceV2)==null?void 0:d.amount;return i?c("div",{className:p("WIDGET grid gap-5","sm:grid-cols-2"),children:[c("div",{className:"flex flex-col pr-20 text-small",children:[c("div",{className:p(),children:[(e==null?void 0:e.artist)&&t(S,{to:e.artist.slug,className:"w-fit hover:text-main",children:e.artist.name}),(a==null?void 0:a.title)&&t("h1",{className:p("text-gray"),children:a.title}),s?t("p",{className:"text-main",children:"Price on request"}):n?c(N,{children:[t(F,{storefrontProduct:a}),n&&(i==null?void 0:i.compareAtPriceV2)&&t("div",{className:"text-main",children:"Sale"}),e.hideLastCopies!==!0&&o&&o<10&&t("p",{className:"text-main",children:o===1?"1 copy available":`${o} copies available`})]}):t("p",{className:"text-main",children:"Sold out"})]}),t("div",{className:"mt-20 flex gap-5 pt-edit",children:n&&!s?c(N,{children:[t(I,{}),h&&parseInt(h)>=O&&t(C,{})]}):t("a",{href:r&&(r==null?void 0:r.Title)!=="Default Title"?`mailto:${m}?Subject=${"Inquire: "+a.title+" ("+Object.values(r)[0]+") by "+((u=e==null?void 0:e.artist)==null?void 0:u.name)}&body=${"Hello, I would like to have more informations about "+a.title+" ("+Object.values(r)[0]+") by "+((x=e==null?void 0:e.artist)==null?void 0:x.name)+"."}`:`mailto:${m}?Subject=${"Inquire: "+a.title+" by "+((v=e==null?void 0:e.artist)==null?void 0:v.name)}&body=${"Hello, I would like to have more informations about "+a.title+" by "+((g=e==null?void 0:e.artist)==null?void 0:g.name)+"."}`,className:p("w-fit text-gray border-gray","border px-10 py-2 hover:bg-gray hover:text-white"),children:r&&(r==null?void 0:r.Title)!=="Default Title"?`Inquire (${Object.values(r)[0]})`:"Inquire"})})]}),l&&t(j,{})]}):null}export{re as default}; //# sourceMappingURL=febb07cf.js.map