"use strict";var e=require("react/jsx-runtime"),j=require("../icons/ico-menu.js"),d=require("../primitives/button.js");require("../primitives/checkbox.js"),require("../primitives/dropdown-selector.js"),require("../primitives/popover.js"),require("../primitives/radio.js"),require("../primitives/segmented-control.js"),require("../primitives/switch.js"),require("../primitives/text.js");var f=require("../../lib/cn.js"),l=require("create-slots"),t=require("react");const x=l.createSlot("div"),m=l.createSlot("div"),v=l.createSlot("div"),q=({children:b,placement:g="right",isOpen:n=!1})=>{const[a,s]=t.useState(n),[h,c]=t.useState(a),u=t.useRef(null),o=g==="left";return t.useEffect(()=>{s(n)},[n]),t.useEffect(()=>{let r;return a?r=setTimeout(()=>c(!0),10):c(!1),()=>clearTimeout(r)},[a]),t.useEffect(()=>{const r=i=>{u.current&&!u.current.contains(i.target)&&s(!1)};return document.addEventListener("mousedown",r),()=>{document.removeEventListener("mousedown",r)}},[s]),l.createHost(b,r=>e.jsxs(e.Fragment,{children:[e.jsx(d.default,{onPress:()=>s(i=>!i),textStyle:"neutral",variant:"text",children:e.jsx(d.default.TrailingIcon,{children:e.jsx(j.default,{})})}),e.jsx("div",{className:f.cn("absolute bottom-0 left-0 right-0 h-full bg-[color-mix(in_srgb,var(--color-text-primary)_20%,transparent)] dark:bg-[rgba(0,0,0,0.7)]",a?"block":"hidden")}),e.jsxs("div",{ref:u,className:f.cn("absolute top-0 bottom-0 flex flex-col justify-between bg-surface-primary dark:bg-surface-secondary z-10 p-4 pb-6 w-80 transition-transform duration-300",o?"left-0 rounded-r-2xl":"right-0 rounded-l-2xl",h?"translate-x-0":o?"-translate-x-full":"translate-x-full"),children:[e.jsxs("div",{className:"flex flex-col gap-6",children:[e.jsx("div",{className:"flex flex-col h-full justify-between",children:r.get(x)}),e.jsx("hr",{className:"border-surface-quaternary"}),e.jsx("div",{className:"flex flex-col",children:r.get(m)})]}),r.get(v)]})]}))},p=Object.assign(q,{Header:x,Content:m,Footer:v});exports.Menu=p;
//# sourceMappingURL=menu.js.map
