import{s as M,C as b}from"./styled-components.browser.esm.js";import{i as o,I as X,U as Y}from"./animate.es.js";import{N as I,g as J}from"./translationUtils.js";import{u as _,j as N,F as Q,a as r,r as a}from"./index.js";const le=M.div` position: absolute; left: ${({x:e})=>e}%; top: ${({y:e})=>e}%; z-index: 2; cursor: default; ${e=>e.$hover&&b` z-index: 4; `} &:hover { z-index: 3; } ${o.lessThan("medium")` &.cevoid-card-tag-wrapper { pointer-events: none; } `} `,se=M.div` .cevoid-tag { width: 32px; height: 32px; border-radius: 50%; background: rgba(0, 0, 0, 0.2); transition: 0.25s all ease-in-out; border: 2px solid rgba(255, 255, 255, 0) !important; z-index: 2; position: relative; display: block; .cevoid-after-tag { content: ''; background-color: #fff; width: 12px; height: 12px; position: absolute; left: 50%; top: 50%; border-radius: 50%; transform: translate3d(-50%, -50%, 0px); box-shadow: 0 1px 4px rgb(0 0 0 / 55%); transition: 0.25s all ease-in-out; } .cevoid-before-tag { width: 32px; height: 32px; content: ''; position: absolute; left: 50%; top: 50%; transform: translate3d(-50%, -50%, 0px); ${o.greaterThan("medium")` width: 50px; height: 50px; `} } ${e=>e.$hover&&b` background: rgba(0, 0, 0, 0.4); border: 2px solid rgba(255, 255, 255, 0.65) !important; .cevoid-after-tag { width: 8px; height: 8px; box-shadow: 0 1px 4px rgb(0 0 0 / 20%); } `} ${e=>e.$pulsing&&b` background: rgba(0, 0, 0, 0.4); border: 2px solid rgba(255, 255, 255, 0.65) !important; animation: cevoid-pulse 1.2s ease-in-out infinite; .cevoid-after-tag { width: 8px; height: 8px; box-shadow: 0 1px 4px rgb(0 0 0 / 20%); } `} a { position: absolute; width: 100%; height: 100%; top: 0px; left: 0px; right: 0px; bottom: 0px; border: none; } } @keyframes cevoid-pulse { 0% { transform: scale(1); } 50% { transform: scale(1.2); } 100% { transform: scale(1); } } `,ce=M.div` background: #fff; position: absolute !important; box-shadow: 0px 3px 15px -2px rgb(0 0 0 / 30%); white-space: initial; color: #000 !important; border-radius: calc(var(--cevoid-corner-roundness) / 2); text-align: left; width: 100vw; max-width: 100px; opacity: 0; pointer-events: none; border: none !important; .cevoid-tooltip-inner { padding: 10px !important; position: relative; } ${o.greaterThan("medium")` max-width: 120px; `} ${o.greaterThan("large")` max-width: 150px; `} ${e=>e.horizontal==="left"&&b` right: 35px; ${o.greaterThan("large")` right: 40px; `} `} ${e=>e.horizontal==="right"&&b` left: 35px; ${o.greaterThan("large")` left: 40px; `} `} ${e=>e.vertical==="top"&&b` top: 0px; `} ${e=>e.vertical==="bottom"&&b` transform: translateY(calc(-100% + 30px)); `} .cevoid-tooltip-title { line-height: 1em; text-align: left; font-size: var(--cevoid-font-xs); color: #000; ${o.greaterThan("medium")` font-size: var(--cevoid-font-text); `} } .cevoid-tooltip-footer { display: flex; align-items: flex-end; justify-content: space-between; margin-top: 10px; line-height: 1em; grid-gap: var(--cevoid-spacing-xs); color: #000; .cevoid-tooltip-price { display: flex; grid-gap: 3px; align-items: baseline; flex-direction: column; .cevoid-original-price { font-weight: 600; text-align: left; font-size: var(--cevoid-font-xs); line-height: 1.1em; ${o.greaterThan("medium")` font-size: var(--cevoid-font-text);; `} &.cevoid-is-discounted { text-decoration: line-through; opacity: 0.6; font-size: var(--cevoid-font-xs) !important; font-weight: normal; } } .cevoid-sale-price { font-weight: 600; line-height: 1.1em; color: #eb3a3a; font-size: var(--cevoid-font-xs); ${o.greaterThan("medium")` font-size: var(--cevoid-font-text);; `} ${o.greaterThan("large")` font-size: 16px; `} } } svg { min-width: 14px; height: 14px; width: 14px; transition: 0.15s transform ease-in-out; ${o.greaterThan("medium")` min-width: 16px; height: 16px; width: 16px; `} } } a { position: absolute; width: 100%; height: 100%; top: 0px; right: 0px; left: 0px; bottom: 0px; } &:hover { .cevoid-tooltip-footer { svg { transform: translateX(2px); } } } `;function de({product:e}){var d,p,S,s,$;const l=_(h=>h.market),i=!!((d=e==null?void 0:e.formattedPrice)!=null&&d.salePrice)&&((p=e==null?void 0:e.formattedPrice)==null?void 0:p.price)!==((S=e==null?void 0:e.formattedPrice)==null?void 0:S.salePrice);if(!e)return null;const f=()=>{var h,v;return N("div",{className:`cevoid-original-price ${i?"cevoid-is-discounted":""}`,children:[((h=e==null?void 0:e.formattedPrice)==null?void 0:h.showFromPrice)&&r(I,{children:J("fromPrice","From:")}),r("div",{className:`notranslate cevoid-original-price ${i?"cevoid-is-discounted":""}`,dangerouslySetInnerHTML:{__html:(v=e.formattedPrice)==null?void 0:v.price}})]})};return(s=l==null?void 0:l.settings)!=null&&s.hidePrices?null:N(Q,{children:[i&&r("div",{className:"cevoid-sale-price",children:r(I,{children:($=e==null?void 0:e.formattedPrice)==null?void 0:$.salePrice})}),f()]})}const V=({children:e,ellipsis:l,lines:i=1,trimWhitespace:f=!1,width:d=0,onTruncate:p,...S})=>{const[s,$]=a.exports.useState(),[h,v]=a.exports.useState(),[T,O]=a.exports.useState(0),[R,q]=a.exports.useState(0),C=a.exports.useRef(null),u=a.exports.useRef(null),W=a.exports.useRef(null);a.exports.useEffect(()=>{var t,n;u&&u.current&&u.current.parentNode&&((n=(t=u==null?void 0:u.current)==null?void 0:t.parentNode)==null||n.removeChild(u.current))},[T]);const P=a.exports.useCallback(()=>{var m;if(!((m=C.current)!=null&&m.parentElement))return;const t=d||Math.floor(C.current.parentElement.getBoundingClientRect().width);if(!t)return window.requestAnimationFrame(()=>P());const n=window.getComputedStyle(C.current),c=[n.fontWeight,n.fontStyle,n.fontSize,n.fontFamily].join(" ");s&&(s.font=c),O(t)},[s,d]);a.exports.useEffect(()=>{const t=document.createElement("canvas");$(t.getContext("2d"))},[]),a.exports.useEffect(()=>(P(),window.addEventListener("resize",P),()=>{window.removeEventListener("resize",P),window.cancelAnimationFrame(R)}),[P,R]);const B=t=>{var x;const n=document.createElement("div"),c="innerText"in window.HTMLElement.prototype?"innerText":"textContent";n.innerHTML=(t==null?void 0:t.innerHTML.replace(/\r\n|\r|\n/g," "))||"";let m=n[c];const U=document.createElement("div");return U.innerHTML="foo
bar",((x=U[c])==null?void 0:x.replace(/\r\n|\r/g,` `))!==`foo bar`&&(n.innerHTML=n.innerHTML.replace(//gi,` `),m=n[c]),m||""},j=a.exports.useCallback(t=>{typeof p=="function"&&q(window.requestAnimationFrame(()=>{p(t)}))},[p]),F=a.exports.useCallback(t=>(s==null?void 0:s.measureText(t).width)||0,[s]),D=t=>t==null?void 0:t.offsetWidth,H=t=>t.replace(/\s+$/,""),A=a.exports.useCallback(()=>{const t=[],c=B(u.current).split(` `).map(x=>x.split(" ")),m=D(W.current)||0;let U=!0;for(let x=1;x<=i;x++){const k=c[0];if(k.length===0){t.push(),c.shift(),x--;continue}let E=k.join(" ")||"";if(F(E)<=T&&c.length===1){U=!1,t.push(E);break}if(x===i){const g=k.join(" ");let w=0,y=g.length-1;for(;w<=y;){const z=Math.floor((w+y)/2),K=g.slice(0,z+1);F(K)+m<=T?w=z+1:y=z-1}let L=g.slice(0,w);if(f)for(L=H(L);!L.length&&t.length;){const z=t.pop();z&&typeof z=="string"&&(L=H(z))}E=N("span",{children:[L,l]})}else{let g=0,w=k.length-1;for(;g<=w;){const y=Math.floor((g+w)/2),L=k.slice(0,y+1).join(" ");F(L)<=T?g=y+1:w=y-1}if(g===0){x=i-1;continue}E=k.slice(0,g).join(" "),c[0].splice(0,g)}t.push(E)}return j(U),t},[l,i,F,j,T,f]),G=(t,n,c)=>{if(n===c.length-1)return r("span",{children:t},n);{const m=r("br",{},`${n}br`);return t?[r("span",{children:t},n),m]:m}};return a.exports.useEffect(()=>{const t=!!(C.current&&T);typeof window!="undefined"&&t&&(i>0?v(A().map(G)):(v(e),j(!1)))},[e,i,T,A,j]),N("span",{...S,ref:C,children:[r("span",{children:h}),r("span",{ref:u,children:e}),r("span",{ref:W,style:{position:"fixed",visibility:"hidden",top:0,left:0},children:l})]})};var he=V;function Z({badge:e,color:l,size:i=20}){return r(ee,{$size:i,$color:l,children:(e==null?void 0:e.type)==="CUSTOM"?r("div",{className:"badge-image",children:r("img",{src:e==null?void 0:e.location,className:"badge-image"})}):(e==null?void 0:e.type)==="DEFAULT"?r("div",{className:"badge-icon",style:{color:l},dangerouslySetInnerHTML:{__html:e==null?void 0:e.icon}}):null})}const ee=M.div` .badge-icon { display: flex; svg { width: ${({$size:e})=>e}px; height: ${({$size:e})=>e}px; min-width: ${({$size:e})=>e}px; color: ${({$color:e})=>e}; } } .badge-image { display: flex; img { width: ${({$size:e})=>e}px; height: ${({$size:e})=>e}px; object-fit: cover; } } `,te=({post:e,clickable:l=!1})=>{var $;const i=_(h=>h.settings),f=e==null?void 0:e.fromInstagram,d=($=e==null?void 0:e.member)==null?void 0:$.badge,p=()=>e!=null&&e.customLink?e==null?void 0:e.customLink:e!=null&&e.instagramUrl?e==null?void 0:e.instagramUrl:`https://instagram.com/${e==null?void 0:e.username}`,S=()=>e!=null&&e.customUsername?e==null?void 0:e.customUsername:f&&(i==null?void 0:i.usernameSymbol)==="AT_SIGN"?`@${e==null?void 0:e.username}`:f?`${e==null?void 0:e.username}`:e!=null&&e.username?e==null?void 0:e.username:"Customer",s=()=>{var h,v;if((i==null?void 0:i.usernameSymbol)!=="ICON")return null;if((i==null?void 0:i.usernameSymbol)==="ICON")return f?r(X,{}):(h=e==null?void 0:e.member)!=null&&h.avatarUrl?r("div",{className:"cevoid-pfp",children:r("img",{src:`${(v=e==null?void 0:e.member)==null?void 0:v.avatarUrl}?class=160`})}):r(Y,{})};return N(ie,{clickable:l&&(f||(e==null?void 0:e.customLink)),children:[s(),r(I,{children:S()}),l&&(f||(e==null?void 0:e.customLink))&&r("a",{href:p(),target:"_blank",rel:"noreferrer"}),d&&r(Z,{badge:d,color:d==null?void 0:d.color,size:16})]})};var fe=te;const ie=M.div` display: flex; align-items: center; grid-gap: 6px; position: relative; ${e=>e.clickable&&b` cursor: pointer; &:hover { opacity: 0.7; } `} ${o.greaterThan("small")` grid-gap: 8px; `} ${o.greaterThan("large")` font-size: 18px; `} svg { height: 20px; width: 20px; min-width: 20px; ${o.greaterThan("large")` height: 24px; width: 24px; min-width: 24px; `} } .cevoid-pfp { height: 20px; width: 20px; min-width: 20px; border-radius: 50%; overflow: hidden; position: relative; ${o.greaterThan("large")` height: 24px; width: 24px; min-width: 24px; `} &:after { box-shadow: inset 0px 0px 0px 1px rgb(0 0 0 / 10%); display: block; position: absolute; top: 0px; left: 0px; bottom: 0px; right: 0px; z-index: 100; border-radius: inherit; content: ''; } img { width: 100%; height: 100%; object-fit: cover; } } a { position: absolute; height: 100%; width: 100%; top: 0px; left: 0px; right: 0px; bottom: 0px; } `;export{de as P,le as T,fe as U,se as a,ce as b,he as c,ie as d};