import{o as e}from"./rolldown-runtime-C_s2cVnS.js";import{o as t}from"./i18n-CsN8OUP9.js";import{h as n,m as r}from"./vendor-react-nmZsNlRz.js";import{t as i}from"./button-C_jHykqW.js";import{t as a}from"./utils-BRwGVQJx.js";import{n as o}from"./haptics-MK-CNWlU.js";import{t as s}from"./titlebar-icon-DQFgOo9W.js";var c=e(n(),1),l={narrowOverlay:10,layoutEdit:20,zoneEditor:30,overlay:40,drag:50},u=new Map;function d(e){let t=Symbol(`escape-layer`);return u.set(t,e),()=>{u.delete(t)}}function f(e){for(let t of u.values())if(t>e)return!1;return!0}var p=e(r(),1),m=`pt-[calc(var(--titlebar-height)/2-0.4375rem)]`;function h({children:e,onClose:n,closeLabel:r=t(`common.close`),contentClassName:u,edgeBadge:m,headerContent:h,rootClassName:g,titlebarActions:_}){let v=()=>{o(`close`),n()};return(0,c.useEffect)(()=>{let e=d(l.overlay),t=e=>{e.key!==`Escape`||e.defaultPrevented||!f(l.overlay)||(e.preventDefault(),o(`close`),n())};return window.addEventListener(`keydown`,t),()=>{window.removeEventListener(`keydown`,t),e()}},[n]),(0,p.jsx)(`div`,{className:a(`fixed inset-0 z-50 bg-black/22 backdrop-blur-[0.125rem]`,`p-[calc(var(--titlebar-height)+0.625rem)]`,`sm:p-[calc(var(--titlebar-height)+0.875rem)]`),"data-overlay-surface":``,onClick:e=>{e.target===e.currentTarget&&v()},role:`presentation`,style:{"--titlebar-height":`34px`},children:(0,p.jsxs)(`div`,{className:`relative h-full min-h-0`,children:[(0,p.jsxs)(`div`,{className:a(`relative flex h-full min-h-0 flex-col overflow-hidden rounded-xl border border-(--ui-stroke-secondary) bg-(--ui-chat-surface-background) shadow-md`,g),"data-glass-raised":``,children:[(0,p.jsxs)(`div`,{className:`pointer-events-none absolute inset-x-0 top-0 z-10 h-[calc(var(--titlebar-height)+0.1875rem)] [-webkit-app-region:drag]`,children:[h&&(0,p.jsx)(`div`,{className:`pointer-events-auto absolute left-1/2 top-[calc(0.5rem+var(--titlebar-height)/2)] -translate-x-1/2 -translate-y-1/2 [-webkit-app-region:no-drag]`,children:h}),(0,p.jsxs)(`div`,{className:`pointer-events-auto absolute right-3 top-[calc(0.1875rem+var(--titlebar-height)/2)] flex -translate-y-1/2 items-center gap-1.5 [-webkit-app-region:no-drag]`,children:[_,(0,p.jsx)(i,{"aria-label":r,className:`text-(--ui-text-tertiary) hover:bg-(--chrome-action-hover) hover:text-foreground`,onClick:v,size:`icon-titlebar`,variant:`ghost`,children:(0,p.jsx)(s,{name:`close`})})]})]}),(0,p.jsx)(`div`,{className:a(`min-h-0 flex flex-1 flex-col`,u),children:e})]}),m&&(0,p.jsx)(`div`,{className:`absolute left-1/2 top-0 z-20 -translate-x-1/2 -translate-y-1/2`,children:m})]})})}export{d as a,f as i,h as n,l as r,m as t};