import{j as e,r as m}from"./emotion-element-f0de968e.browser.esm-DwXm1ovW.js";import{e as R,f as $,g as B,h as ne,i as ie,j as oe}from"./index-BkKoGAIQ.js";import{a as F,b as le}from"./useShop-DVidzmVk.js";import{b as P,e as Q}from"./constants-BmZqpmZ9.js";import{D as ce}from"./browser-D_aI20dA.js";import{g as M,I as de}from"./Image-Ci6OP-R8.js";import{S as l}from"./stack-BWTSDeoE.js";import{L as k}from"./link-DZHeh2KU.js";import{I as me}from"./icon-BqqKAe4T.js";import{B as N}from"./box-iF0_MWoT.js";import{C as L}from"./container-L9s2qena.js";import{F as A}from"./flex-CdsZFeFK.js";import{T as p}from"./text-CNl6N9p4.js";import{I as q}from"./img-BeN1eEkS.js";import{S as he}from"./SearchBar-9U3uBqY0.js";import{H as T}from"./heading-Bf5Nvikr.js";import{L as _}from"./Link-LgIBY-Nj.js";import{O as xe,P as O,Q as fe,D as ue,G as W,R as pe}from"./index-DtiRXUlt.js";import{u as je}from"./AuthUserProvider-DPieHBUA.js";import{u as ge}from"./IsMobileProvider-CxWmvmNH.js";import{P as H}from"./ProtectedLinkButton-3s3pQG6J.js";import{S as be}from"./simple-grid-Cp3s3bFA.js";import{u as ve,H as Y}from"./useScroll-9nCKKM3H.js";import{L as u}from"./components-DmpoYRsr.js";import{I as z}from"./icon-button-BVoBBuA8.js";import{d as Se,B as G}from"./button-CfJEt6Mn.js";import{u as we,M as ye,a as Ce,b as ke,c as C}from"./menu-list-sJ1fcpor.js";import{c as Le}from"./context-BB0fYCak.js";import{c as I}from"./factory-D1qruDJA.js";import{u as Ae}from"./image-BHce6sVM.js";import{f as Ie,u as ze,o as Ne,c as U}from"./use-style-config-BG4e6iJV.js";import{c as Pe}from"./call-all-DDzecCnU.js";import{d as Me}from"./spinner-CL3kXaWq.js";import{V as _e}from"./v-stack-Djy-hKnE.js";import{u as Ee}from"./use-disclosure-CS4OSCJj.js";const[Fe,Te]=Le({name:"AvatarStylesContext",hookName:"useAvatarStyles",providerName:"<Avatar/>"});function De(r){const a=r.trim().split(" "),t=a[0]??"",s=a.length>1?a[a.length-1]:"";return t&&s?`${t.charAt(0)}${s.charAt(0)}`:t.charAt(0)}function V(r){const{name:a,getInitials:t,...s}=r,n=Te();return e.jsx(I.div,{role:"img","aria-label":a,...s,__css:n.label,children:a?t==null?void 0:t(a):null})}V.displayName="AvatarName";const X=r=>e.jsxs(I.svg,{viewBox:"0 0 128 128",color:"#fff",width:"100%",height:"100%",className:"chakra-avatar__svg",...r,children:[e.jsx("path",{fill:"currentColor",d:"M103,102.1388 C93.094,111.92 79.3504,118 64.1638,118 C48.8056,118 34.9294,111.768 25,101.7892 L25,95.2 C25,86.8096 31.981,80 40.6,80 L87.4,80 C96.019,80 103,86.8096 103,95.2 L103,102.1388 Z"}),e.jsx("path",{fill:"currentColor",d:"M63.9961647,24 C51.2938136,24 41,34.2938136 41,46.9961647 C41,59.7061864 51.2938136,70 63.9961647,70 C76.6985159,70 87,59.7061864 87,46.9961647 C87,34.2938136 76.6985159,24 63.9961647,24"})]});function J(r){const{src:a,srcSet:t,onError:s,onLoad:n,getInitials:c,name:d,borderRadius:h,loading:o,iconLabel:x,icon:b=e.jsx(X,{}),ignoreFallback:v,referrerPolicy:S,crossOrigin:j}=r,w=Ae({src:a,onError:s,crossOrigin:j,ignoreFallback:v})==="loaded";return!a||!w?d?e.jsx(V,{className:"chakra-avatar__initials",getInitials:c,name:d}):m.cloneElement(b,{role:"img","aria-label":x}):e.jsx(I.img,{src:a,srcSet:t,alt:d??x,onLoad:n,referrerPolicy:S,crossOrigin:j??void 0,className:"chakra-avatar__img",loading:o,__css:{width:"100%",height:"100%",objectFit:"cover",borderRadius:h}})}J.displayName="AvatarImage";const Re=Me({display:"inline-flex",alignItems:"center",justifyContent:"center",textAlign:"center",textTransform:"uppercase",fontWeight:"medium",position:"relative",flexShrink:0}),Z=Ie((r,a)=>{const t=ze("Avatar",r),[s,n]=m.useState(!1),{src:c,srcSet:d,name:h,showBorder:o,borderRadius:x="full",onError:b,onLoad:v,getInitials:S=De,icon:j=e.jsx(X,{}),iconLabel:g=" avatar",loading:w,children:y,borderColor:f,ignoreFallback:re,crossOrigin:se,referrerPolicy:ae,...te}=Ne(r),D={borderRadius:x,borderWidth:o?"2px":void 0,...Re,...t.container};return f&&(D.borderColor=f),e.jsx(I.span,{ref:a,...te,className:U("chakra-avatar",r.className),"data-loaded":Se(s),__css:D,children:e.jsxs(Fe,{value:t,children:[e.jsx(J,{src:c,srcSet:d,loading:w,onLoad:Pe(v,()=>{n(!0)}),onError:b,getInitials:S,name:h,borderRadius:x,icon:j,iconLabel:g,ignoreFallback:re,crossOrigin:se,referrerPolicy:ae}),y]})})});Z.displayName="Avatar";const E=r=>{const{className:a,...t}=r,s=we();return e.jsx(I.hr,{"aria-orientation":"horizontal",className:U("chakra-menu__divider",a),...t,__css:s.divider})};E.displayName="MenuDivider";const K=({name:r,logoUrl:a,...t})=>a?e.jsx(q,{objectFit:"contain",alt:`${r} logo`,src:a,...t}):e.jsx(T,{bgGradient:"linear(to-l, #fc56dd, #6959ff)",bgClip:"text",size:{base:"sm",md:"md"},...t,children:r}),$e=r=>{const a=["a","img"],t=["href","src","alt","target"];return ce.sanitize(r,{ALLOWED_TAGS:a,ALLOWED_ATTR:t})},i=({href:r,children:a})=>e.jsx(k,{href:r,color:"inherit",_hover:{color:"onPrimaryHover"},fontSize:"sm",children:a}),Cr=()=>{var s;const r=F(),a=n=>{switch(n){case"instagram":return oe;case"facebook":return $;case"twitter":return B;case"linkedin":return R;case"youtube":return ie;case"tiktok":return ne}},t=r?((s=r.socialNetworks)==null?void 0:s.length)>0?e.jsx(l,{gap:4,flexDir:"row",children:r==null?void 0:r.socialNetworks.map(({id:n,name:c,url:d})=>e.jsx(k,{"aria-label":c,href:d,color:"inherit",children:e.jsx(me,{as:a(c),fontSize:"1.25rem"})},n))}):null:e.jsxs(l,{gap:4,flexDir:"row",children:[e.jsx(k,{"aria-label":"LinkedIn",href:"https://www.linkedin.com/company/acanomas",color:"inherit",children:e.jsx(R,{fontSize:"1.25rem"})}),e.jsx(k,{"aria-label":"Facebook",href:"https://www.facebook.com/acanomasapp",color:"inherit",children:e.jsx($,{fontSize:"1.25rem"})}),e.jsx(k,{"aria-label":"Twitter",href:"https://twitter.com/acanomasapp",color:"inherit",children:e.jsx(B,{fontSize:"1.25rem"})})]});return e.jsxs(N,{mt:{base:4,md:24},pos:"relative",as:"footer",role:"contentinfo",bg:"primary",color:"onPrimary",children:[e.jsx(L,{children:e.jsx(l,{py:{base:4,md:8},children:e.jsxs(A,{justifyContent:"space-between",flexDir:{base:"column",md:"row"},gap:8,children:[!r&&e.jsxs(l,{spacing:5,children:[e.jsx(p,{fontWeight:"bold",children:"TIENDA"}),e.jsx(i,{href:"#",children:"Tendencias"}),e.jsx(i,{href:"#",children:"Marcas"}),e.jsx(i,{href:"#",children:"Categorías"}),e.jsx(i,{href:"#",children:"Ofertas"}),e.jsx(i,{href:"#",children:"Cómo funciona"}),e.jsx(i,{href:"#",children:"Crear una cuenta"})]}),!r&&e.jsxs(l,{spacing:5,children:[e.jsx(p,{fontWeight:"bold",children:"VENDER"}),e.jsx(i,{href:"/como-vender",children:"Cómo vender"}),e.jsx(i,{href:"#",children:"Empaquetado"}),e.jsx(i,{href:"#",children:"Envíos"}),e.jsx(i,{href:"#",children:"Recibir pagos"}),e.jsx(i,{href:"#",children:"Autenticación"})]}),!r&&e.jsxs(l,{spacing:5,children:[e.jsx(p,{fontWeight:"bold",children:"SOPORTE"}),e.jsx(i,{href:"#",children:"Contáctenos"}),e.jsx(i,{href:"/ayuda",children:"Centro de ayuda"}),e.jsx(i,{href:"/status",children:"Estado del servicio"}),e.jsx(i,{href:"/normas",children:"Normas del mercado"}),e.jsx(i,{href:"/normas-de-seguridad",children:"Normas de seguridad"}),e.jsx(i,{href:"/proteccion-al-comprador",children:"Protección al comprador"}),e.jsx(i,{href:"/proteccion-al-vendedor",children:"Protección al vendedor"})]}),!r&&e.jsxs(l,{spacing:5,children:[e.jsx(p,{fontWeight:"bold",children:"EMPRESA Y POLÍTICAS"}),e.jsx(i,{href:"/about",children:"Acerca de nosotros"}),e.jsx(i,{href:"#",children:"Blog"}),e.jsx(i,{href:"#",children:"Carreras"}),e.jsx(i,{href:"#",children:"Centro de políticas"})]}),e.jsxs(l,{spacing:5,align:"flex-start",gap:8,children:[t&&e.jsxs(l,{spacing:5,children:[e.jsx(p,{fontWeight:"bold",children:"ENCONTRÁNOS EN"}),e.jsx(A,{children:t})]}),e.jsx(K,{name:(r==null?void 0:r.name)||P,logoUrl:r!=null&&r.logo?M(r.logo):Q,maxW:{base:16,md:24},maxH:{base:12,md:16}}),e.jsxs(l,{justify:"space-between",align:"center",flexDir:{base:"column",md:"row"},children:[(r==null?void 0:r.afipQr)&&e.jsx("div",{dangerouslySetInnerHTML:{__html:$e(r.afipQr)}}),!r&&e.jsx("a",{href:"http://qr.afip.gob.ar/?qr=dWPaUDTj8xuquXdJar2SsQ,,",target:"_F960AFIPInfo",children:e.jsx(q,{src:"https://www.afip.gob.ar/images/f960/DATAWEB.jpg",w:"40px",alt:"Data fiscal",loading:"lazy"})})]})]})]})})}),e.jsx(l,{bg:"primary.300",children:e.jsx(L,{flex:1,py:{base:4,md:8},justifyContent:"space-between",alignItems:"center",flexDir:"row",children:e.jsxs(p,{fontSize:"sm",children:["© ",new Date().getFullYear()," ",(r==null?void 0:r.name)||P]})})})]})},ee=m.createContext([]),kr=({children:r,cart:a})=>e.jsx(ee.Provider,{value:a,children:r}),Be=()=>{const r=m.useContext(ee);if(r===void 0)throw new Error("useCart must be used within a CartProvider");return r};function Oe({categories:r}){var h;const a=F(),[t,s]=m.useState(null),n=m.useRef(null),c=m.useCallback(o=>{t===null?n.current=setTimeout(()=>{s(o)},250):s(o)},[t]),d=m.useCallback(()=>{n.current&&clearTimeout(n.current),s(null)},[]);return m.useEffect(()=>()=>{n.current&&clearTimeout(n.current)},[]),e.jsxs(l,{bg:"primary",onMouseLeave:d,position:"relative",children:[e.jsx(L,{alignItems:"center",py:3,gap:4,justifyContent:"space-between",flexDir:"row",flexWrap:"wrap",children:r.map(o=>e.jsx(_,{color:(t==null?void 0:t.id)===o.id?"onPrimaryHover":"onPrimary",onMouseEnter:()=>c(o),onClick:()=>s(null),to:`${a?"/"+a.slug:""}/${o.slug}/c/${o.id}`,fontSize:"sm",noOfLines:1,children:o.name},o.id))}),t&&e.jsx(l,{bg:"primary",color:"onPrimary",py:6,position:"absolute",left:0,right:0,top:"100%",zIndex:"docked",children:e.jsxs(L,{children:[e.jsx(T,{as:"h3",size:"md",mb:4,children:t.name}),e.jsx(be,{as:"ul",spacing:1,listStyleType:"none",fontSize:"sm",columns:4,children:(h=t.children)==null?void 0:h.map(o=>e.jsx("li",{children:e.jsx(_,{color:"inherit",_hover:{opacity:.8},transition:"opacity 0.3s",to:`${a?"/"+a.slug:""}/${o.slug}/c/${o.id}`,onClick:()=>s(null),children:o.name})},o.id))})]})})]})}function Lr({categories:r}){var y;const a=m.useRef(null),t=ge(),s=F(),n=je(),c=Be(),{isOpen:d,onOpen:h,onClose:o}=Ee(),x=m.useRef(null),b=((y=x.current)==null?void 0:y.offsetHeight)||0,v=le(),{direction:S,scrollY:j}=ve(),g=j>0,w=S==="down"&&j>b?-b:0;return e.jsxs(e.Fragment,{children:[e.jsx(N,{ref:a,position:"absolute",top:"88px",width:"100%",height:"1px"}),e.jsx(l,{top:0,ref:x,bg:"primary",as:"header",pos:"sticky",zIndex:"docked",transition:"all 0.3s ease",transform:`translateY(${w}px)`,children:e.jsxs(L,{gap:{base:2,lg:4},display:"flex",alignItems:"center",py:{base:.5,md:g?1.5:2,xl:g?2:3},px:{base:1,md:4,xl:0},transition:"all 0.2s ease",flexDirection:"row",children:[e.jsx(u,{to:s?`/${s.slug}`:"/",prefetch:"viewport",children:e.jsx(K,{height:g?{base:"40px",md:"42px"}:{base:"40px",md:"48px"},width:g?{base:"48px",md:"64px"}:{base:"48px",md:"72px"},transition:"all 0.25s ease-in-out",name:(s==null?void 0:s.name)||P,logoUrl:s!=null&&s.logo?M(s==null?void 0:s.logo):Q})}),e.jsx(z,{display:{base:"flex",md:"none"},"aria-label":"Abrir menú",icon:e.jsx(xe,{size:"1.25rem"}),onClick:h,variant:"ghost",color:"onPrimary"}),e.jsx(N,{flex:1,children:e.jsx(he,{})}),e.jsx(Y,{spacing:{md:6},children:e.jsxs(A,{align:"center",gap:{base:1,md:4},children:[e.jsx(z,{"aria-label":"Cart",icon:e.jsx(O,{fontSize:"1.25rem"}),color:"onPrimary",variant:"ghost"}),c.length>0&&e.jsxs(G,{pos:"relative",variant:"ghost","aria-label":"View Cart",children:[e.jsx(O,{fontSize:"1.25rem"}),e.jsx(p,{pos:"absolute",top:"0",right:"0",minW:"16px",minH:"16px",fontSize:"0.65rem",textAlign:"center",borderRadius:"full",bg:"red.500",color:"white",children:c.length})]}),v&&e.jsx(G,{as:u,target:"_blank",to:`/${s==null?void 0:s.slug}/`,variant:"outline",color:"onPrimary",leftIcon:e.jsx(fe,{size:"1.15rem"}),children:"Ir a mi tienda"}),(!n||!n.shops.length)&&!s&&e.jsx(H,{display:{base:"none",md:"flex"},to:"/onboarding/welcome",leftIcon:e.jsx(ue,{size:"1.25rem"}),children:"Crear mi tienda"}),n?e.jsxs(ye,{children:[e.jsx(Ce,{color:"onPrimary",_focus:{boxShadow:"none"},transition:"all 0.2s ease",children:e.jsxs(Y,{children:[e.jsx(Z,{size:"sm",src:n!=null&&n.avatar?M(n.avatar):"",name:n.displayName}),e.jsx(_e,{alignItems:"flex-start",display:{base:"none",md:"flex"},ml:"2",spacing:"1px",children:e.jsx(p,{fontSize:"sm",children:n.displayName})})]})}),e.jsxs(ke,{children:[e.jsx(C,{fontSize:"sm",as:u,prefetch:"viewport",to:"/dashboard/profile",children:"Mi perfil"}),e.jsx(C,{fontSize:"sm",as:u,prefetch:"viewport",to:"/dashboard/orders",children:"Compras"}),e.jsx(E,{}),n.shops.map(f=>e.jsxs(C,{fontSize:"sm",as:u,prefetch:"viewport",to:`/dashboard/${f.slug}`,gap:2,children:[f.name,f.logo&&e.jsx(de,{image:f.logo,w:6,h:6})]},f.id)),e.jsx(C,{fontSize:"sm",as:u,prefetch:"viewport",to:"/dashboard/shop/create",children:"Crear tienda"}),e.jsx(E,{}),e.jsx(C,{fontSize:"sm",as:u,to:"/logout",children:"Salir"})]})]}):e.jsxs(e.Fragment,{children:[e.jsx(H,{size:"sm",display:{base:"none",md:"flex"},to:"/signin",leftIcon:e.jsx(W,{size:"1.25rem"}),color:"onPrimary",children:"Mi cuenta"}),e.jsx(z,{display:{base:"flex",md:"none"},as:u,"aria-label":"Mi cuenta",icon:e.jsx(W,{size:"1.25rem"}),variant:"ghost",to:"/signin",color:"onPrimary"})]})]})})]})}),t?e.jsx(We,{categories:r,isOpen:d,onClose:o}):e.jsx(Oe,{categories:r})]})}const We=({categories:r,isOpen:a,onClose:t})=>e.jsx(N,{pos:"fixed",top:0,bottom:0,left:0,right:0,bg:"surface",zIndex:"docked",transition:"transform 0.2s ease-in-out",transform:a?"translateX(0)":"translateX(-100%)",children:e.jsxs(A,{direction:"column",flex:1,children:[e.jsx(A,{justify:"flex-end",p:2,children:e.jsx(z,{"aria-label":"Cerrar menú",icon:e.jsx(pe,{size:"1.5rem"}),onClick:t,variant:"ghost"})}),e.jsx(T,{size:"lg",p:4,children:"Categorías"}),e.jsx(l,{children:r.map(s=>e.jsx(_,{to:`/${s.slug}/c/${s.id}`,p:4,onClick:t,children:s.name},s.id))})]})});export{kr as C,Cr as F,Lr as N};