"use strict";const r=require("react/jsx-runtime"),f=require("react"),S=require("./Dialog-B64GoQlm.cjs.js"),D=require("@chakra-ui/react/styled-system"),q=require("./index-Dzrt5_tw.cjs.js"),N=require("./Button-C92vyQPT.cjs.js"),P=require("./extract-style-props-DVhOcGEi.cjs.js"),j=require("./Modal-vGTvonTS.cjs.js"),O=require("./heading-BvgQ2YkR.cjs.js"),B=require("@commercetools/nimbus-icons"),c=require("./normalize-messages-DtVffO09.cjs.js"),F=require("./icon-button-CVdz2C9L.cjs.js"),{withProvider:z,withContext:n}=D.createSlotRecipeContext({key:"nimbusDrawer"}),H=z("div","root"),_=n("button","trigger"),I=n("div","modalOverlay"),k=n("div","modal"),E=n("div","content"),L=n("header","header"),V=n("div","body"),A=n("footer","footer"),K=n("h2","title"),G=n("div","closeTrigger"),R=f.createContext(void 0),J=()=>{const e=f.useContext(R);if(!e)throw new Error("useDrawerContext must be used within Drawer.Root");return e},Q=({children:e,value:t})=>r.jsx(R,{value:t,children:e}),p=e=>{const t=D.useSlotRecipe({recipe:q.drawerSlotRecipe}),[o]=t.splitVariantProps(e),{children:s,isOpen:a,onOpenChange:i,defaultOpen:g=!1}=e,l=r.jsx(H,{...o,children:s}),w=f.Children.toArray(s).some(d=>{if(f.isValidElement(d)&&typeof d.type=="function"){const u=d.type?.displayName;return u==="DrawerTrigger"||u==="Drawer.Trigger"}return!1});return r.jsx(Q,{value:{...e,hasDrawerTrigger:w},children:w?r.jsx(S.$de32f1b87079253c$export$2e1e1122cf0cba88,{isOpen:a,onOpenChange:i,defaultOpen:g,children:l}):l})};p.displayName="Drawer.Root";const x=({ref:e,children:t,asChild:o,...s})=>{if(o)return r.jsx(D.chakra.button,{ref:e,asChild:!0,...s,children:t});const[a,i]=P.extractStyleProps(s);return r.jsx(_,{...a,asChild:!0,children:r.jsx(N.$d2b4bc8c273e7be6$export$353f5b6fc5456de1,{ref:e,...i,children:t})})};x.displayName="Drawer.Trigger";const h=e=>{const{ref:t,children:o,...s}=e,{hasDrawerTrigger:a,isDismissable:i=!0,isKeyboardDismissDisabled:g,shouldCloseOnInteractOutside:l,isOpen:w,onOpenChange:d,defaultOpen:u}=J(),$=a?{isDismissable:i,isKeyboardDismissDisabled:g,shouldCloseOnInteractOutside:l}:{isDismissable:i,isKeyboardDismissDisabled:g,shouldCloseOnInteractOutside:l,isOpen:w,onOpenChange:d,defaultOpen:u},[v,M]=P.extractStyleProps(s);return r.jsx(I,{asChild:!0,children:r.jsx(j.$f3f84453ead64de5$export$8948f78d83984c69,{...$,children:r.jsx(k,{asChild:!0,children:r.jsx(j.$f3f84453ead64de5$export$2b77a92f1a5ad772,{children:r.jsx(E,{asChild:!0,...v,children:r.jsx(S.$de32f1b87079253c$export$3ddf2d174ce01153,{ref:t,...M,children:o})})})})})})};h.displayName="Drawer.Content";const m=e=>{const{ref:t,children:o,...s}=e;return r.jsx(L,{ref:t,...s,children:o})};m.displayName="Drawer.Header";const y=e=>{const{ref:t,children:o,...s}=e,a={tabIndex:0};return r.jsx(V,{ref:t,...a,...s,children:o})};y.displayName="Drawer.Body";const C=e=>{const{ref:t,children:o,...s}=e;return r.jsx(A,{ref:t,...s,children:o})};C.displayName="Drawer.Footer";const T=e=>{const{ref:t,children:o,...s}=e;return r.jsx(K,{asChild:!0,...s,children:r.jsx(O.Heading,{ref:t,slot:"title",as:"h2",textStyle:"lg",children:o})})};T.displayName="Drawer.Title";const U={closeTrigger:"Close drawer"},W={closeTrigger:"Schublade schließen"},X={closeTrigger:"Cerrar bandeja"},Y={closeTrigger:"Fermer le volet"},Z={closeTrigger:"Fechar gaveta"},ee={en:c.normalizeMessages(U),de:c.normalizeMessages(W),es:c.normalizeMessages(X),"fr-FR":c.normalizeMessages(Y),"pt-BR":c.normalizeMessages(Z)},b=e=>{const t=c.useLocalizedStringFormatter(ee),{ref:o,"aria-label":s,...a}=e;return r.jsx(G,{children:r.jsx(F.IconButton,{ref:o,slot:"close",size:"xs",variant:"ghost","aria-label":s||t.format("closeTrigger"),...a,children:r.jsx(B.Close,{})})})};b.displayName="Drawer.CloseTrigger";const re={Root:p,Trigger:x,Content:h,Header:m,Body:y,Footer:C,Title:T,CloseTrigger:b};exports.Drawer=re;exports.DrawerBody=y;exports.DrawerCloseTrigger=b;exports.DrawerContent=h;exports.DrawerFooter=C;exports.DrawerHeader=m;exports.DrawerRoot=p;exports.DrawerTitle=T;exports.DrawerTrigger=x;
//# sourceMappingURL=drawer-0RwFqzio.cjs.js.map
