1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./CbIQhG_g.js","./DpTcgtsH.js","./4kPvPqdg.js","./BDEhiIZ3.js","./BoJDSQwD.js","./DlAUqK2U.js","./DocRenderer.B5XuGKNV.css"])))=>i.map(i=>d[i]); 2import{e as Ne,H as K,D as Be,L as Te,f as De,c as i,a as r,i as t,F as Q,r as J,k as c,n as I,j as X,w as Oe,l as _,p as je,t as g,b as fe,z as $,O as Fe,C as h,s as a,o as s,d as He,au as Ve,ar as qe,M as Ue}from"./BoJDSQwD.js";import{b as We}from"./BhMusIfU.js";import{i as ge}from"./DRa8SDh9.js";import{u as Ge}from"./NG5HtCz0.js";import{p as Ke}from"./BM6-fApq.js";import{u as Qe}from"./SbNNIrjg.js";import{u as Je}from"./DMM3xSho.js";import{u as Xe}from"./BtimqBbG.js";import{_ as Ye}from"./DlAUqK2U.js";import"./CoA-EFWh.js";import"./CQI6tN8C.js";const Ze=Ve(()=>qe(()=>import("./CbIQhG_g.js"),__vite__mapDeps([0,1,2,3,4,5,6]),import.meta.url).then(S=>S.default||S)),et={key:0,class:"pr-thumbs"},tt=["onClick"],ot=["src","srcset","alt"],nt={class:"pr-mosaic"},st=["onClick"],at=["src","srcset","sizes","alt","decoding","loading","data-gek-field"],it={key:0,class:"pr-chips"},rt={key:1,class:"pr-chip pr-chip--brand","data-gek-field":"brand"},lt={class:"pr-title","data-gek-field":"title"},ct={key:1,class:"pr-prices"},ut={key:0,class:"pr-price","data-gek-field":"price"},dt={key:1,class:"pr-old","data-gek-field":"oldPrice"},pt={key:3,class:"pr-soldout"},ft={key:4,class:"pr-buy"},gt={class:"pr-stepper"},vt=["disabled"],mt={class:"pr-qty"},yt=["disabled"],ht=["href"],bt={key:5,class:"pr-acc"},kt={key:0,class:"pr-acc-item"},_t={key:1,class:"pr-acc-item"},wt={class:"pr-lb-stage"},Ct=["src","alt"],xt=["onClick"],Lt=["src","alt"],$t=Ne({__name:"BlockProducto",props:{config:{},data:{}},setup(S){const ve=Ge(),n=S,me=a(()=>We(n.config)),N=e=>typeof e=="string"&&/^\s*\{\{.*\}\}\s*$/.test(e),m=e=>e==null||N(e)?"":e;function w(e){return!e||N(e)?!1:typeof e=="string"?e.trim().length>0:typeof e=="object"?Array.isArray(e.content)&&e.content.some(o=>o?.content?.length||o?.text):!1}function B(e){return e?Array.isArray(e)?e.length?B(e[0]):"":typeof e=="object"?String(e.url??e.src??e.image??""):N(e)?"":String(e):""}const ye=a(()=>{const e=n.config?.gallery;return Array.isArray(e)?e:e&&typeof e=="object"&&Array.isArray(e.images)?e.images:[]}),u=a(()=>{const e=[],o=B(n.config?.image);o&&e.push(o);for(const v of ye.value){const p=B(v);p&&!e.includes(p)&&e.push(p)}return e}),d=h(0),Y=a(()=>u.value[d.value]??u.value[0]??""),A=a(()=>m(n.config?.category)),T=a(()=>m(n.config?.brand)),D=a(()=>m(n.config?.categoryColor));function he(e){let o=String(e).replace("#","");if(o.length===3&&(o=o.split("").map(y=>y+y).join("")),!/^[0-9a-fA-F]{6}$/.test(o))return 1;const v=parseInt(o.slice(0,2),16),p=parseInt(o.slice(2,4),16),l=parseInt(o.slice(4,6),16);return(.299*v+.587*p+.114*l)/255}const be=a(()=>D.value?{background:D.value,color:he(D.value)>.6?"#1a1a1a":"#fff"}:{}),O=e=>String(e??"").toLowerCase().trim(),z=a(()=>n.config?._catCollection?.trim()||"categorias"),{data:ke}=Qe(()=>`prod-cats-${z.value}`,()=>$fetch(`/api/collections/${z.value}/records`).catch(()=>[]),{default:()=>[],watch:[z]}),_e=a(()=>{const e={};for(const o of ke.value??[]){if(!o?.slug)continue;const v=O(o.data?.name??o.data?.nombre??o.data?.title);v&&(e[v]=o.slug),e[O(o.slug)]=o.slug}return e}),j=a(()=>{const e=_e.value[O(A.value)];return e?`/${z.value}/${e}`:""}),b=a(()=>m(n.config?.title)),k=a(()=>m(n.config?.price)),F=a(()=>m(n.config?.oldPrice)),Z=a(()=>{const e=m(n.config?.inventory);if(e!==""&&e!=null)return e;const o=n.data??{};return o.inventory??o.data?.inventory??o.stock??o.data?.stock??o.existencias??o.data?.existencias}),ee=a(()=>{const e=Z.value;if(e==null||e==="")return!1;const o=Number(String(e).replace(/[^\d.-]/g,""));return Number.isFinite(o)&&o<=0}),we=a(()=>n.config?.soldOutLabel?.trim()||"Agotado"),Ce=a(()=>n.config?.addLabel||"Agregar"),xe=a(()=>n.config?.benefitsLabel||"Beneficios"),Le=a(()=>n.config?.applicationLabel||"Aplicación"),E=a(()=>n.config?.galleryLayout||"Mosaico"),H=a(()=>E.value==="Foto única"),V=a(()=>(n.config?.galleryRatio||"1:1").replace(":"," / ")),te=a(()=>H.value?u.value.slice(d.value,d.value+1):u.value);function oe(e){if(E.value==="Grilla")return!1;if(E.value!=="Mosaico")return!0;const o=te.value.length;return e===0||(o-1)%2===1&&e===o-1}const q=e=>H.value?d.value:e,ne=h([]),$e=(e,o)=>{e&&(ne.value[o]=e)};function Se(e){d.value=e,H.value||ne.value[e]?.scrollIntoView({behavior:"smooth",block:"center"})}const M=h(null),P=h(null),se=h("media");let C=null;function x(){const e=M.value?.offsetHeight??0,o=P.value?.offsetHeight??0;se.value=e>o?"info":"media"}const L=h(!1),ae=e=>{d.value=e,L.value=!0},U=()=>{L.value=!1},ie=()=>{u.value.length&&(d.value=(d.value+1)%u.value.length)},re=()=>{u.value.length&&(d.value=(d.value-1+u.value.length)%u.value.length)};function le(e){L.value&&(e.key==="Escape"?U():e.key==="ArrowRight"?ie():e.key==="ArrowLeft"&&re())}K(L,e=>{typeof document>"u"||(document.body.style.overflow=e?"hidden":"")}),Be(()=>{window.addEventListener("keydown",le),window.addEventListener("resize",x),typeof ResizeObserver<"u"&&(C=new ResizeObserver(x),M.value&&C.observe(M.value),P.value&&C.observe(P.value)),x()}),Te(()=>{window.removeEventListener("keydown",le),window.removeEventListener("resize",x),C?.disconnect(),C=null,document.body.style.overflow=""}),K([u,E,V],()=>{Ue(x)});const{canCart:ce,isWhatsappOnly:Ae,config:ze}=Je(),W=a(()=>{const e=Z.value;if(e==null||e==="")return 1/0;const o=Number(String(e).replace(/[^\d.-]/g,""));return Number.isFinite(o)&&o>0?Math.floor(o):1/0}),f=h(1),Ee=()=>{f.value>1&&f.value--},Me=()=>{f.value<W.value&&f.value++};K(W,e=>{f.value>e&&(f.value=Math.max(1,e))});const R=h(!1);let ue;function Pe(){if(typeof window>"u")return;const e=n.data??{};window.dispatchEvent(new CustomEvent("gek:add-to-cart",{detail:{id:e.id??e.recordId??void 0,slug:e.slug??void 0,sku:m(n.config?.sku)||void 0,title:b.value,price:Ke(k.value),image:Y.value,qty:f.value}})),R.value=!0,clearTimeout(ue),ue=setTimeout(()=>{R.value=!1},1500),f.value=1}const Re=a(()=>n.config?.waLabel?.trim()||"Solicitar por WhatsApp"),de=a(()=>String(m(n.config?.waNumber)||ze.value.checkout.whatsappNumber||"").replace(/\D/g,"")),Ie=Xe().origin,G=De(),pe=a(()=>
2{if(!de.value)return"";const e=[`Hola, me interesa ${f.value} de este producto:`,""];return e.push(`*${b.value.trim()||"Producto"}*`),k.value&&e.push(String(k.value)),e.push(`${Ie}${G.fullPath.startsWith("/")?G.fullPath:`/${G.fullPath}`}`),`https://wa.me/${de.value}?text=${encodeURIComponent(e.join(` 3`))}`});return(e,o)=>{const v=Ze;return s(),i("section",{class:"gek-producto",style:I(t(me))},[r("div",{class:_(["pr-inner",`pr-inner--sticky-${t(se)}`])},[r("div",{class:"pr-media",ref_key:"mediaEl",ref:M},[t(u).length>1?(s(),i("div",et,[(s(!0),i(Q,null,J(t(u),(p,l)=>(s(),i("button",{key:l,class:_(["pr-thumb",{active:l===t(d)}]),onClick:y=>Se(l),type:"button"},[r("img",{src:p,srcset:t(ge)(p),sizes:"76px",alt:`${t(b)} ${l+1}`,loading:"lazy"},null,8,ot)],10,tt))),128))])):c("",!0),r("div",nt,[t(u).length?c("",!0):(s(),i("div",{key:0,class:"pr-shot pr-shot--wide",style:I({aspectRatio:t(V)})},[...o[3]||(o[3]=[r("div",{class:"pr-main-ph","data-gek-field":"image"},null,-1)])],4)),(s(!0),i(Q,null,J(t(te),(p,l)=>(s(),i("div",{key:l,ref_for:!0,ref:y=>$e(y,l),class:_(["pr-shot",{"pr-shot--wide":oe(l),active:q(l)===t(d)}]),style:I({aspectRatio:t(V)}),onClick:y=>ae(q(l))},[r("img",{src:p,srcset:t(ge)(p),sizes:oe(l)?"(max-width: 900px) 100vw, 48vw":"(max-width: 900px) 50vw, 24vw",alt:`${t(b)} ${l+1}`,decoding:l===0?"sync":"async",loading:l===0?"eager":"lazy","data-gek-field":l===0?"image":void 0},null,8,at),l===0?(s(),i("button",{key:0,class:"pr-zoom-btn",type:"button","aria-label":"Ampliar",onClick:o[0]||(o[0]=$(y=>ae(q(0)),["stop"]))},[...o[4]||(o[4]=[r("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[r("circle",{cx:"11",cy:"11",r:"7"}),r("path",{d:"m21 21-4.3-4.3"}),r("path",{d:"M11 8v6M8 11h6"})],-1)])])):c("",!0)],14,st))),128))])],512),r("div",{class:"pr-info",ref_key:"infoEl",ref:P},[t(A)||t(T)?(s(),i("div",it,[t(A)?(s(),X(je(t(j)?"a":"span"),{key:0,href:t(ve)(t(j))||void 0,class:_(["pr-chip pr-chip--cat",{"pr-chip--link":t(j)}]),style:I(t(be)),"data-gek-field":"category"},{default:Oe(()=>[He(g(t(A)),1)]),_:1},8,["href","class","style"])):c("",!0),t(T)?(s(),i("span",rt,g(t(T)),1)):c("",!0)])):c("",!0),r("h1",lt,g(t(b)||"Producto"),1),(t(k)||t(F))&&!t(ee)?(s(),i("div",ct,[t(k)?(s(),i("span",ut,g(t(k)),1)):c("",!0),t(F)?(s(),i("span",dt,g(t(F)),1)):c("",!0)])):c("",!0),w(n.config?.description)?(s(),X(v,{key:2,content:n.config?.description,class:"pr-desc","data-gek-field":"description"},null,8,["content"])):c("",!0),t(ee)?(s(),i("div",pt,g(t(we)),1)):t(ce)||t(Ae)&&t(pe)?(s(),i("div",ft,[r("div",gt,[r("button",{type:"button",onClick:Ee,disabled:t(f)<=1,"aria-label":"Menos"},"â",8,vt),r("span",mt,g(t(f)),1),r("button",{type:"button",onClick:Me,disabled:t(f)>=t(W),"aria-label":"Más"},"+",8,yt)]),t(ce)?(s(),i("button",{key:0,class:_(["pr-add",{"pr-add--done":t(R)}]),type:"button",onClick:Pe},g(t(R)?"Agregado â":t(Ce)),3)):(s(),i("a",{key:1,class:"pr-wa",href:t(pe),target:"_blank",rel:"noopener"},[o[5]||(o[5]=r("svg",{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true"},[r("path",{d:"M17.47 14.38c-.3-.15-1.76-.87-2.03-.97-.27-.1-.47-.15-.67.15-.2.3-.77.96-.94 1.16-.17.2-.35.22-.65.07-.3-.15-1.26-.46-2.4-1.48-.89-.79-1.49-1.76-1.66-2.06-.17-.3-.02-.46.13-.61.13-.13.3-.35.45-.52.15-.17.2-.3.3-.5.1-.2.05-.37-.02-.52-.08-.15-.67-1.61-.92-2.2-.24-.58-.49-.5-.67-.51h-.57c-.2 0-.52.07-.79.37-.27.3-1.04 1.01-1.04 2.48s1.06 2.88 1.21 3.08c.15.2 2.1 3.2 5.08 4.49.71.3 1.26.49 1.69.63.71.22 1.36.19 1.87.12.57-.09 1.76-.72 2.01-1.41.25-.7.25-1.29.17-1.42-.07-.13-.27-.2-.57-.35z"}),r("path",{d:"M12.04 2C6.58 2 2.13 6.45 2.13 11.91c0 1.75.46 3.45 1.32 4.95L2 22l5.28-1.38a9.87 9.87 0 0 0 4.76 1.21h.01c5.46 0 9.91-4.45 9.91-9.91C21.96 6.45 17.5 2 12.04 2zm0 18.02h-.01a8.2 8.2 0 0 1-4.18-1.15l-.3-.18-3.13.82.84-3.05-.2-.31a8.19 8.19 0 0 1-1.26-4.38c0-4.54 3.7-8.23 8.24-8.23 2.2 0 4.27.86 5.83 2.41a8.18 8.18 0 0 1 2.41 5.83c0 4.54-3.7 8.24-8.24 8.24z"})],-1)),r("span",null,g(t(Re)),1)],8,ht))])):c("",!0),w(n.config?.benefits)||w(n.config?.application)?(s(),i("div",bt,[w(n.config?.benefits)?(s(),i("details",kt,[r("summary",null,g(t(xe)),1),fe(v,{content:n.config?.benefits,class:"pr-acc-body","data-gek-field":"benefits"},null,8,["content"])])):c("",!0),w(n.config?.application)?(s(),i("details",_t,[r("summary",null,g(t(Le)),1),fe(v,{content:n.config?.application,class:"pr-acc-body","data-gek-field":"application"},null,8,["content"])])):c("",!0)])):c("",!0)],512)],2),(s(),X(Fe,{to:"body"},[t(L)?(s(),i("div",{key:0,class:"pr-lightbox",onClick:U},[r("button",{class:"pr-lb-close",type:"button","aria-label":"Cerrar",onClick:U},"Ã"),r("div",wt,[t(u).length>1?(s(),i("button",{key:0,class:"pr-lb-nav pr-lb-prev",type:"button","aria-label":"Anterior",onClick:$(re,["stop"])},"â¹")):c("",!0),r("img",{src:t(Y),alt:t(b),class:"pr-lb-img",onClick:o[1]||(o[1]=$(()=>{},["stop"]))},null,8,Ct),t(u).length>1?(s(),i("button",{key:1,class:"pr-lb-nav pr-lb-next",type:"button","aria-label":"Siguiente",onClick:$(ie,["stop"])},"âº")):c("",!0)]),t(u).length>1?(s(),i("div",{key:0,class:"pr-lb-reel",onClick:o[2]||(o[2]=$(()=>{},["stop"]))},[(s(!0),i(Q,null,J(t(u),(p,l)=>(s(),i("button",{key:l,class:_(["pr-lb-thumb",{active:l===t(d)}]),type:"button",onClick:y=>d.value=l},[r("img",{src:p,alt:`${t(b)} ${l+1}`,loading:"lazy"},null,8,Lt)],10,xt))),128))])):c("",!0)])):c("",!0)]))],4)}}}),Dt=Ye($t,[["__scopeId","data-v-fce63fe5"]]);export{Dt 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.