"use strict";const o=require("react/jsx-runtime"),u=require("react"),D=require("./Dialog-CSr6lHSd.cjs.js"),h=require("@chakra-ui/react/styled-system"),q=require("@chakra-ui/react"),w=require("./Button-DLCecw8f.cjs.js"),y=require("./extract-style-props-B4hqila-.cjs.js"),p=require("./Modal-u97jKK9t.cjs.js"),N=require("./heading-DWweWKGQ.cjs.js"),O=require("@commercetools/nimbus-icons"),n=require("./normalize-messages-CaDzkuUm.cjs.js"),B=require("./icon-button-CeB8_Yyr.cjs.js"),{withProvider:z,withContext:a}=q.createSlotRecipeContext({key:"dialog"}),F=z("div","root"),H=a("button","trigger"),_=a("div","modalOverlay"),I=a("div","modal"),k=a("div","content"),E=a("header","header"),L=a("div","body"),V=a("footer","footer"),A=a("h2","title"),K=a("div","closeTrigger"),m=u.createContext(void 0),C=()=>{const e=u.useContext(m);if(!e)throw new Error("useDialogContext must be used within Dialog.Root");return e},G=({children:e,value:r})=>o.jsx(m,{value:r,children:e}),b=e=>{const r=h.useSlotRecipe({key:"dialog"}),[s]=r.splitVariantProps(e),{children:t,isOpen:i,onOpenChange:l,defaultOpen:f=!1}=e,d=o.jsx(F,{...s,children:t}),x=u.Children.toArray(t).some(c=>{if(u.isValidElement(c)&&typeof c.type=="function"){const g=c.type?.displayName;return g==="DialogTrigger"||g==="Dialog.Trigger"}return!1});return o.jsx(G,{value:e,children:x?o.jsx(D.$de32f1b87079253c$export$2e1e1122cf0cba88,{isOpen:i,onOpenChange:l,defaultOpen:f,children:d}):d})};b.displayName="Dialog.Root";const j=({ref:e,children:r,asChild:s,...t})=>{if(s)return o.jsx(h.chakra.button,{ref:e,asChild:!0,...t,children:r});const[i,l]=y.extractStyleProps(t);return o.jsx(H,{...i,asChild:!0,children:o.jsx(w.$d2b4bc8c273e7be6$export$353f5b6fc5456de1,{ref:e,...l,children:r})})};j.displayName="Dialog.Trigger";const T=e=>{const{ref:r,children:s,...t}=e,{defaultOpen:i,isDismissable:l,isKeyboardDismissDisabled:f,shouldCloseOnInteractOutside:d,isOpen:x,onOpenChange:c}=C(),g={defaultOpen:i,isDismissable:l,isKeyboardDismissDisabled:f,shouldCloseOnInteractOutside:d,isOpen:x,onOpenChange:c},[M]=y.extractStyleProps(t);return o.jsx(_,{asChild:!0,children:o.jsx(p.$f3f84453ead64de5$export$8948f78d83984c69,{...g,children:o.jsx(I,{asChild:!0,children:o.jsx(p.$f3f84453ead64de5$export$2b77a92f1a5ad772,{children:o.jsx(k,{asChild:!0,...M,children:o.jsx(D.$de32f1b87079253c$export$3ddf2d174ce01153,{ref:r,children:s})})})})})})};T.displayName="Dialog.Content";const S=e=>{const{ref:r,children:s,...t}=e;return o.jsx(E,{ref:r,...t,children:s})};S.displayName="Dialog.Header";const P=e=>{const{ref:r,children:s,...t}=e,{scrollBehavior:i}=C(),l={tabIndex:i==="inside"?0:void 0};return o.jsx(L,{ref:r,...l,...t,children:s})};P.displayName="Dialog.Body";const $=e=>{const{ref:r,children:s,...t}=e;return o.jsx(V,{ref:r,...t,children:s})};$.displayName="Dialog.Footer";const R=e=>{const{ref:r,children:s,...t}=e;return o.jsx(A,{asChild:!0,...t,children:o.jsx(N.Heading,{ref:r,slot:"title",as:"h2",textStyle:"lg",children:s})})};R.displayName="Dialog.Title";const J={closeTrigger:"Close dialog"},Q={closeTrigger:"Dialog schließen"},U={closeTrigger:"Cerrar diálogo"},W={closeTrigger:"Fermer la boîte de dialogue"},X={closeTrigger:"Fechar caixa de diálogo"},Y={en:n.normalizeMessages(J),de:n.normalizeMessages(Q),es:n.normalizeMessages(U),"fr-FR":n.normalizeMessages(W),"pt-BR":n.normalizeMessages(X)},v=e=>{const r=n.useLocalizedStringFormatter(Y),{ref:s,"aria-label":t,...i}=e;return o.jsx(K,{children:o.jsx(B.IconButton,{ref:s,slot:"close",size:"xs",variant:"ghost","aria-label":t||r.format("closeTrigger"),...i,children:o.jsx(O.Close,{})})})};v.displayName="Dialog.CloseTrigger";const Z={Root:b,Trigger:j,Content:T,Header:S,Body:P,Footer:$,Title:R,CloseTrigger:v};exports.Dialog=Z;
//# sourceMappingURL=dialog-gyrFT8w0.cjs.js.map
