@dimina-kit/devtools 0.4.0-dev.20260630094624 → 0.4.0-dev.20260701083540

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/dist/main/app/app.js +6 -0
  2. package/dist/main/index.bundle.js +114 -1
  3. package/dist/main/ipc/app-lifecycle.d.ts +32 -0
  4. package/dist/main/ipc/app-lifecycle.js +54 -0
  5. package/dist/main/ipc/bridge-router.js +95 -1
  6. package/dist/main/ipc/page-scroll.d.ts +14 -0
  7. package/dist/main/ipc/page-scroll.js +17 -0
  8. package/dist/preload/windows/main.cjs +200 -0
  9. package/dist/preload/windows/main.cjs.map +3 -3
  10. package/dist/renderer/assets/{index-BMwmmaSp.js → index-HE9Xr9bQ.js} +16 -13
  11. package/dist/renderer/assets/{input-BbWPVJlM.js → input-DR7bfyQE.js} +2 -2
  12. package/dist/renderer/assets/{ipc-transport-DTT-j7AD.js → ipc-transport-3Arg8jPC.js} +1 -1
  13. package/dist/renderer/assets/ipc-transport-Dt0jR7Ir.css +1 -0
  14. package/dist/renderer/assets/{popover-CjAdKdAo.js → popover-CPZX3MrT.js} +2 -2
  15. package/dist/renderer/assets/{select-RyHeTVsc.js → select-BxyPlVyJ.js} +2 -2
  16. package/dist/renderer/assets/{settings-DaR5vif_.js → settings-CG_OR03F.js} +2 -2
  17. package/dist/renderer/assets/{settings-api-DXYCjMQY.js → settings-api-CtPPJF-F.js} +2 -2
  18. package/dist/renderer/assets/{workbenchSettings-CwW0JEe6.js → workbenchSettings-ClqCBGOa.js} +2 -2
  19. package/dist/renderer/entries/main/index.html +6 -6
  20. package/dist/renderer/entries/popover/index.html +5 -5
  21. package/dist/renderer/entries/settings/index.html +5 -5
  22. package/dist/renderer/entries/workbench-settings/index.html +4 -4
  23. package/dist/simulator/assets/{device-shell-BiFE9Otv.css → device-shell-CS1rqAQz.css} +1 -1
  24. package/dist/simulator/assets/device-shell-CT3LRnTB.js +2 -0
  25. package/dist/simulator/assets/{jsx-runtime-P6ZegaOf.js → jsx-runtime-CDK-o-S0.js} +2 -2
  26. package/dist/simulator/assets/simulator-BizhGGE3.js +10 -0
  27. package/dist/simulator/simulator.html +2 -2
  28. package/package.json +5 -5
  29. package/dist/renderer/assets/ipc-transport-BZ4gxQ4_.css +0 -1
  30. package/dist/simulator/assets/device-shell-CPCnCp1L.js +0 -2
  31. package/dist/simulator/assets/simulator-gMBWKDeO.js +0 -10
@@ -1,9 +1,12 @@
1
- import{C as e,S as t,a as n,b as r,c as i,d as a,g as o,h as s,l as c,m as l,n as u,o as d,p as f,r as p,t as m,w as h,x as g}from"./ipc-transport-DTT-j7AD.js";import{n as _,r as v,t as y}from"./input-BbWPVJlM.js";import{_ as b,a as x,b as S,c as C,d as w,f as T,g as E,h as ee,i as te,l as ne,m as re,n as ie,o as ae,p as oe,r as se,t as ce,u as le,v as ue,y as de}from"./select-RyHeTVsc.js";import{n as fe}from"./constants-EAMiwL9_.js";import{l as pe}from"./settings-api-DXYCjMQY.js";var me=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),he=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),ge=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),_e=e=>{let t=ge(e);return t.charAt(0).toUpperCase()+t.slice(1)},ve={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},ye=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},D=h(e()),be=(0,D.createContext)({}),xe=()=>(0,D.useContext)(be),Se=(0,D.forwardRef)(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>{let{size:l=24,strokeWidth:u=2,absoluteStrokeWidth:d=!1,color:f=`currentColor`,className:p=``}=xe()??{},m=r??d?Number(n??u)*24/Number(t??l):n??u;return(0,D.createElement)(`svg`,{ref:c,...ve,width:t??l??ve.width,height:t??l??ve.height,stroke:e??f,strokeWidth:m,className:me(`lucide`,p,i),...!a&&!ye(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,D.createElement)(e,t)),...Array.isArray(a)?a:[a]])}),Ce=(e,t)=>{let n=(0,D.forwardRef)(({className:n,...r},i)=>(0,D.createElement)(Se,{ref:i,iconNode:t,className:me(`lucide-${he(_e(e))}`,`lucide-${e}`,n),...r}));return n.displayName=_e(e),n},we=Ce(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),Te=Ce(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),Ee=h(g(),1),O=r();function De({project:e,onOpen:t,onRemove:n,thumbnail:r}){let[i,a]=(0,D.useState)(!1);return(0,O.jsxs)(`div`,{className:`relative bg-surface border border-border rounded-lg overflow-hidden cursor-pointer transition-all duration-150 hover:border-accent hover:-translate-y-0.5`,onClick:()=>t(e),onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),children:[r?(0,O.jsx)(`img`,{src:r,className:`h-28 w-full object-cover`,alt:``}):(0,O.jsx)(`div`,{className:`h-28 bg-surface-thumb`}),(0,O.jsxs)(`div`,{className:`p-3`,children:[(0,O.jsx)(`div`,{className:`text-sm font-medium text-text-white mb-1 truncate`,title:e.name,children:e.name}),(0,O.jsx)(`div`,{className:`text-[11px] text-text-secondary truncate`,title:e.path,children:e.path}),(0,O.jsx)(`div`,{className:`text-[11px] text-text-dim mt-1.5`,children:v(e.lastOpened)})]}),i&&(0,O.jsx)(S,{variant:`danger`,size:`icon-sm`,className:`absolute top-1.5 right-1.5 w-5 h-5 rounded-full bg-overlay text-text-secondary leading-none hover:text-status-error hover:bg-danger-bg`,onClick:t=>{t.stopPropagation(),n(e)},title:`移除`,children:`×`})]})}function Oe(e){return(0,O.jsxs)(`button`,{type:`button`,onClick:e.onClick,"aria-label":`新建项目`,className:`relative bg-transparent border-2 border-dashed border-border rounded-lg overflow-hidden cursor-pointer transition-all duration-150 hover:border-accent hover:-translate-y-0.5 h-full min-h-[188px] flex flex-col items-center justify-center gap-2 text-text-secondary hover:text-accent focus:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,O.jsx)(`span`,{className:`text-3xl leading-none`,"aria-hidden":`true`,children:`+`}),(0,O.jsx)(`span`,{className:`text-sm font-medium`,children:`新建项目`})]})}function ke({projects:e,onAdd:t,onCreate:n,onOpen:r,onRemove:i,thumbnails:a}){let[o,s]=(0,D.useState)(``),c=(0,D.useMemo)(()=>{if(!o.trim())return e;let t=o.trim().toLowerCase();return e.filter(e=>(e.name||``).toLowerCase().includes(t)||(e.path||``).toLowerCase().includes(t))},[e,o]),l=n??(()=>{}),u=e.length>0&&c.length===0;return(0,O.jsx)(`div`,{className:`flex flex-col h-screen bg-bg`,children:(0,O.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-6`,children:[(0,O.jsxs)(`div`,{className:`flex items-center justify-between mb-6 gap-4`,children:[(0,O.jsx)(`div`,{className:`flex items-center flex-1 max-w-xs min-w-0`,children:(0,O.jsxs)(`div`,{className:`relative w-full`,children:[(0,O.jsx)(we,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-text-secondary pointer-events-none`}),(0,O.jsx)(y,{placeholder:`搜索`,value:o,onChange:e=>s(e.target.value),className:`w-full h-8 pl-8 pr-3 rounded-md text-sm`})]})}),(0,O.jsx)(S,{variant:`ghost`,size:`sm`,onClick:t,className:`shrink-0 text-accent hover:text-accent-hover hover:bg-transparent`,children:`导入`})]}),u?(0,O.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-72 text-text-dim gap-3`,children:[(0,O.jsx)(`span`,{className:`text-5xl opacity-40`,children:`🔍`}),(0,O.jsx)(`span`,{className:`text-sm`,children:`未找到匹配的项目`})]}):(0,O.jsxs)(`div`,{className:`grid gap-4`,style:{gridTemplateColumns:`repeat(auto-fill, minmax(220px, 1fr))`},children:[(0,O.jsx)(Oe,{onClick:l}),c.map(e=>(0,O.jsx)(De,{project:e,onOpen:r,onRemove:i,thumbnail:a?.[e.path]},e.path))]})]})})}function Ae(e){return e.trim().replace(/[\\/:*?"<>|]+/g,`-`).replace(/\s+/g,`-`).replace(/-{2,}/g,`-`).replace(/^[-.]+|[-.]+$/g,``)}function je(e,t){return t?e?e.endsWith(`/`)?`${e}${t}`:`${e}/${t}`:t:``}function Me(e){let{open:t,templates:n,defaultBaseDir:r,onSubmit:i,onCancel:a,onBrowse:o}=e,[s,c]=(0,D.useState)(``),[l,u]=(0,D.useState)(``),[d,f]=(0,D.useState)(n[0]?.id??`blank`),p=(0,D.useRef)(!1);if((0,D.useEffect)(()=>{n.find(e=>e.id===d)||f(n[0]?.id??`blank`)},[n,d]),(0,D.useEffect)(()=>{t&&(c(``),u(``),p.current=!1)},[t]),!t)return null;let m=s.trim().length>0&&l.trim().length>0;function h(e){if(c(e),!p.current){let t=Ae(e);u(t?je(r??``,t):``)}}function g(e){p.current=!0,u(e)}async function _(){let e=await o();e&&(p.current=!0,u(e))}function v(){m&&i({name:s.trim(),path:l.trim(),templateId:d})}return(0,O.jsx)(`div`,{role:`dialog`,"aria-label":`新建项目`,className:`fixed inset-0 z-50 flex items-center justify-center bg-black/40`,children:(0,O.jsxs)(`div`,{className:`bg-surface rounded-lg shadow-lg w-[560px] max-w-[90vw] p-6`,children:[(0,O.jsx)(`h2`,{className:`text-base font-semibold text-text-white mb-4`,children:`新建项目`}),(0,O.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,O.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[(0,O.jsx)(`span`,{className:`text-text-secondary`,children:`项目名`}),(0,O.jsx)(`input`,{"aria-label":`项目名`,type:`text`,value:s,onChange:e=>h(e.target.value),placeholder:`My App`,className:`h-8 px-2 rounded-md border border-border bg-bg text-sm text-text-white`})]}),(0,O.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[(0,O.jsx)(`span`,{className:`text-text-secondary`,children:`目录`}),(0,O.jsxs)(`div`,{className:`flex gap-2`,children:[(0,O.jsx)(`input`,{"aria-label":`目录`,type:`text`,value:l,onChange:e=>g(e.target.value),placeholder:`/absolute/path/to/dir`,className:`flex-1 h-8 px-2 rounded-md border border-border bg-bg text-sm text-text-white`}),(0,O.jsx)(`button`,{type:`button`,onClick:_,className:`px-3 h-8 rounded-md border border-border text-sm text-text-secondary hover:text-text-white`,children:`浏览`})]})]}),(0,O.jsxs)(`div`,{className:`flex flex-col gap-1 text-sm`,children:[(0,O.jsx)(`span`,{className:`text-text-secondary`,children:`模板`}),(0,O.jsx)(`div`,{className:`grid gap-2`,style:{gridTemplateColumns:`repeat(auto-fill, minmax(160px, 1fr))`},children:n.map(e=>{let t=e.id===d;return(0,O.jsxs)(`button`,{type:`button`,onClick:()=>f(e.id),className:[`text-left p-3 rounded-md border`,t?`border-accent text-text-white bg-accent/10`:`border-border text-text-secondary hover:border-accent`].join(` `),"aria-pressed":t,children:[(0,O.jsx)(`div`,{className:`text-sm font-medium`,children:e.name}),e.description?(0,O.jsx)(`div`,{className:`text-[11px] mt-1 text-text-dim`,children:e.description}):null]},e.id)})})]})]}),(0,O.jsxs)(`div`,{className:`flex justify-end gap-2 mt-6`,children:[(0,O.jsx)(`button`,{type:`button`,onClick:a,className:`px-3 h-8 rounded-md border border-border text-sm text-text-secondary hover:text-text-white`,children:`取消`}),(0,O.jsx)(`button`,{type:`button`,onClick:v,disabled:!m,className:`px-3 h-8 rounded-md text-sm bg-accent text-white disabled:opacity-40 disabled:cursor-not-allowed`,children:`创建`})]})]})})}function Ne(){return m(n.GetBranding)}function Pe(){return u(c.List)}function Fe(){return m(d.OpenDirectory)}function Ie(e){return u(c.Add,e)}function Le(e){return m(c.Remove,e)}function Re(e){return u(i.Open,e)}function ze(e){return u(i.GetPages,e)}function Be(e){return u(i.GetCompileConfig,e)}function Ve(e,t){return u(i.SaveCompileConfig,e,t)}function He(e){return p(i.Status,t=>e(t))}function Ue(e){return p(i.CompileLog,t=>e(t))}function We(e){return m(i.CaptureThumbnail,e)}function Ge(e){return m(i.GetThumbnail,e)}function Ke(){return u(c.ListTemplates)}function qe(){return m(c.OpenCreateDialog)}function Je(e){return u(c.Create,e)}function Ye(){return u(c.GetCreateDefaults)}var Xe={selected:`simulator`,simulatorVisible:!0};function Ze(e){return e+48}function Qe(e,t){return Math.max(200,Math.min(t-200,e))}function $e(e){let{initialDevice:t}=e,[n,r]=(0,D.useState)(t),[i,a]=(0,D.useState)(85),[o,s]=(0,D.useState)(()=>Ze(t.width)),c=(0,D.useRef)(o),l=(0,D.useRef)(n);(0,D.useEffect)(()=>{c.current=o},[o]),(0,D.useEffect)(()=>{l.current=n},[n]);let u=(0,D.useCallback)(e=>{re({brand:`Apple`,model:e.name,system:e.system,platform:`ios`,pixelRatio:e.pixelRatio,screenWidth:e.width,screenHeight:e.height,statusBarHeight:e.statusBarHeight,notchType:e.notchType,safeAreaInsets:{...e.safeAreaInsets}})},[]);return{device:n,zoom:i,simPanelWidth:o,setSimPanelWidth:s,handleDeviceChange:(0,D.useCallback)(e=>{let t=ue.find(t=>t.name===e.target.value)??ue[1];r(t),u(t),s(Ze(t.width))},[u]),handleZoomChange:(0,D.useCallback)(e=>{a(Number(e.target.value))},[]),handleSplitterDrag:(0,D.useCallback)((e,t=`trailing`)=>{e.preventDefault();let n=e.clientX,r=c.current,i=e=>{let i=e.clientX-n;s(Qe(r+(t===`trailing`?i:-i),window.innerWidth))},a=()=>{window.removeEventListener(`mousemove`,i),window.removeEventListener(`mouseup`,a)};window.addEventListener(`mousemove`,i),window.addEventListener(`mouseup`,a)},[]),sendDeviceInfo:u,simPanelWidthRef:c,deviceRef:l}}var et=200,tt=300;function nt(e){let{projectPath:t}=e,[n,r]=(0,D.useState)({status:`compiling`,message:`正在编译...`}),[i,a]=(0,D.useState)(null),[o,s]=(0,D.useState)([]),[c,l]=(0,D.useState)(0),[u,d]=(0,D.useState)({startPage:``,scene:fe,queryParams:[]});(0,D.useEffect)(()=>{let e=!1;async function n(){try{let n=await Re(t);if(e)return;if(!n.success){r({status:`error`,message:n.error});return}let[i,o]=await Promise.all([ze(t),Be(t)]);if(e)return;a(n.appInfo),l(n.port),s(i.pages),d({startPage:o.startPage||i.entryPagePath||i.pages[0]||``,scene:o.scene??1001,queryParams:o.queryParams||[]}),r({status:`ready`,message:`编译完成`})}catch(t){if(e)return;r({status:`error`,message:t instanceof Error?t.message:String(t)})}}return n(),()=>{e=!0}},[t]);let[f,p]=(0,D.useState)(0),[m,h]=(0,D.useState)([]),[g,_]=(0,D.useState)([]),v=(0,D.useRef)(0);(0,D.useEffect)(()=>{h([]),_([])},[t]),(0,D.useEffect)(()=>He(e=>{r(e);let t=++v.current;h(n=>{let r=e.hotReload===!0?{at:Date.now(),status:e.status,message:e.message,hotReload:!0,seq:t}:{at:Date.now(),status:e.status,message:e.message,seq:t},i=[...n,r];return i.length>et?i.slice(i.length-et):i}),e.hotReload===!0&&p(e=>e+1)}),[]),(0,D.useEffect)(()=>Ue(e=>{let t=++v.current;_(n=>{let r=[...n,{...e,seq:t}];return r.length>tt?r.slice(r.length-tt):r})}),[]);let y=(0,D.useCallback)(()=>{h([]),_([])},[]),b=(0,D.useRef)(!1);return{compileStatus:n,appInfo:i,port:c,pages:o,compileConfig:u,hotReloadToken:f,compileEvents:m,compileLogs:g,clearCompileEvents:y,relaunch:(0,D.useCallback)(async(e=u)=>{try{if(!i?.appId||b.current)return;b.current=!0,r({status:`ready`,message:`正在刷新...`});try{await Ve(t,e),d(e),r({status:`ready`,message:`刷新完成`})}finally{b.current=!1}}catch(e){b.current=!1,r({status:`error`,message:e instanceof Error?e.message:`刷新失败`})}},[i,u,t])}}var rt=[`appId`,`entry`,`page`];function it(e){return encodeURIComponent(e).replace(/%2F/g,`/`).replace(/%2C/g,`,`)}function at(e){let t=Object.keys(e.query);if(t.length===0)return e.pagePath;let n=t.map(t=>`${encodeURIComponent(t)}=${encodeURIComponent(e.query[t]??``)}`).join(`&`);return`${e.pagePath}?${n}`}function ot(e){let t=e.indexOf(`?`);if(t<0)return{pagePath:e,query:{}};let n=e.slice(0,t),r={};for(let n of e.slice(t+1).split(`&`)){if(!n)continue;let e=n.indexOf(`=`),t=e>=0?n.slice(0,e):n,i=e>=0?n.slice(e+1):``;t&&(r[decodeURIComponent(t)]=decodeURIComponent(i))}return{pagePath:n,query:r}}function st(e,t,n={}){let r=at(t),i=[`appId=${it(e)}`,`entry=${it(r)}`,`page=${it(r)}`];for(let[e,t]of Object.entries(n))rt.includes(e)||i.push(`${encodeURIComponent(e)}=${it(t)}`);return i.join(`&`)}function ct(e){let t=e.host??`localhost`,n=e.pathname??`/simulator.html`,r=st(e.appId,e.page,e.extras??{});return`http://${t}:${e.port}${n}?${r}`}function lt(e,t,n,r){let i=t.startPage||`pages/index/index`,a={};for(let e of t.queryParams??[])e.key&&(a[e.key]=e.value);a.scene=String(t.scene??1001);let o={};return r?.length&&(o.apiNamespaces=r.join(`,`)),ct({appId:e,page:{pagePath:i,query:a},port:n,extras:o})}function ut(e){let t=new URLSearchParams(e.startsWith(`?`)?e.slice(1):e),n=t.get(`appId`),r=t.get(`entry`);if(!n||!r)return null;let i=ot(r),a=t.get(`page`);return{appId:n,entry:i,current:a&&a!==r?ot(a):i}}function dt(e){if(!e)return null;try{return ut(new URL(e).search)}catch{return null}}function ft(e){return dt(e)?.current.pagePath??``}function pt(e){let{compileStatus:t,sendDeviceInfo:n,simPanelWidthRef:r,deviceRef:i,appInfo:a,compileConfig:o,port:s,projectPath:c,hotReloadToken:l}=e,u=(0,D.useMemo)(()=>!a||!s?``:lt(a.appId,o,s),[a,o,s]),[d,f]=(0,D.useState)(()=>ft(u));(0,D.useEffect)(()=>{f(ft(u))},[u]),(0,D.useEffect)(()=>ne(e=>{e&&f(e)}),[]);let p=(0,D.useRef)({currentPage:d,compileConfig:o,appInfo:a,port:s});(0,D.useEffect)(()=>{p.current={currentPage:d,compileConfig:o,appInfo:a,port:s}});let m=(0,D.useRef)(l);return(0,D.useEffect)(()=>{if(t.status!==`ready`||!u)return;let e=l!==m.current;m.current=l;let a=u;if(e){let e=p.current;if(e.appInfo&&e.port){let t=e.currentPage||e.compileConfig.startPage;a=lt(e.appInfo.appId,t===e.compileConfig.startPage?e.compileConfig:{...e.compileConfig,startPage:t,queryParams:[]},e.port)}}n(i.current);let o=!1,s=null;return ie(a,r.current).then(()=>{o||(s=window.setTimeout(()=>{o||We(c).catch(()=>{})},3e3))}).catch(()=>{}),()=>{o=!0,s!==null&&window.clearTimeout(s)}},[t.status,u,l,r,i,n,c]),{simulatorUrl:u,currentPage:d}}function mt(e){return(e??``).replace(/^\/+/,``)}function ht(e,t=``){let n=e.map(e=>e.id),r=n.join(`\0`),[i,a]=(0,D.useState)(null),[o,s]=(0,D.useState)(``),[c,l]=(0,D.useState)(t);if(r!==o){let e=o?o.split(`\0`):[];n.some(t=>!e.includes(t))&&a(null),s(r)}t!==c&&(a(null),l(t));let u=t?e.find(e=>mt(e.pagePath)===mt(t))?.id??null:null;return{activeBridgeId:i&&n.includes(i)?i:u??n.at(-1)??null,setActiveBridge:e=>{n.includes(e)&&a(e)}}}function gt(e){let{getChannel:t,eventChannel:n,initial:r,enabled:i}=e,[a,o]=(0,D.useState)(r),s=(0,D.useCallback)(()=>{i&&m(t).then(e=>{e!==void 0&&o(e)})},[i,t]);return(0,D.useEffect)(()=>{i&&s()},[i,s]),(0,D.useEffect)(()=>{if(i)return p(n,e=>o(e))},[i,n]),{data:a,refresh:s}}var _t={bridges:[],entries:{}};function vt(e){let{compileStatus:t,activePagePath:n=``}=e,[r,i]=(0,D.useState)([]),o=t.status===`ready`,c=gt({getChannel:s.GetSnapshot,eventChannel:s.Event,initial:null,enabled:o}),u=gt({getChannel:a.GetSnapshot,eventChannel:a.Event,initial:_t,enabled:o}),d=u.data,{activeBridgeId:h,setActiveBridge:g}=ht(d.bridges,n),_={bridges:d.bridges,activeBridgeId:h,entries:d.entries},v=g,y=u.refresh,b=(0,D.useCallback)(async()=>{let e=await m(l.GetSnapshot);e&&i(e)},[]),x=(0,D.useCallback)(async(e,t)=>await m(l.Set,{key:e,value:t})??{ok:!1,error:`ipc transport failed`},[]),S=(0,D.useCallback)(async e=>await m(l.Remove,{key:e})??{ok:!1,error:`ipc transport failed`},[]),C=(0,D.useCallback)(async()=>await m(l.Clear)??{ok:!1,error:`ipc transport failed`},[]),w=(0,D.useCallback)(async()=>await m(l.ClearAll)??{ok:!1,error:`ipc transport failed`},[]),T=(0,D.useCallback)(async()=>await m(l.GetActivePrefix)??``,[]),E=(0,D.useCallback)(async e=>await m(f.Inspect,e),[]),ee=(0,D.useCallback)(async()=>{await m(f.Clear)},[]);return(0,D.useEffect)(()=>p(l.Event,e=>{e.type===`cleared`?i([]):e.type===`added`||e.type===`updated`?i(t=>{let n=t.findIndex(t=>t.key===e.key),r=n>=0?[...t]:[...t,{key:e.key,value:e.newValue}];return n>=0&&(r[n]={key:e.key,value:e.newValue}),r}):e.type===`removed`&&i(t=>t.filter(t=>t.key!==e.key))}),[]),{wxmlTree:c.data,appData:_,storageItems:r,refreshWxml:c.refresh,refreshAppData:y,setActiveAppDataBridge:v,refreshStorage:b,setStorageItem:x,removeStorageItem:S,clearStorage:C,clearAllStorage:w,getStoragePrefix:T,inspectWxmlElement:E,clearWxmlElementInspection:ee}}function yt(e){let{initialRightPane:t}=e,[n,r]=(0,D.useState)(t);return{rightPane:n,selectRightPane:(0,D.useCallback)(e=>{r({selected:e,simulatorVisible:!0})},[]),toggleRightPaneVisible:(0,D.useCallback)(()=>{r(e=>({...e,simulatorVisible:!e.simulatorVisible}))},[])}}function bt(e){let{relaunch:t,compileConfig:n,pages:r,compileDropdownRef:i}=e,[a,o]=(0,D.useState)(!1),s=(0,D.useRef)(t);(0,D.useEffect)(()=>{s.current=t},[t]),(0,D.useEffect)(()=>{let e=ae(()=>o(!1)),t=C(e=>{o(!1),s.current(e)});return()=>{e(),t()}},[]);let c=(0,D.useRef)(n),l=(0,D.useRef)(r);return(0,D.useEffect)(()=>{c.current=n},[n]),(0,D.useEffect)(()=>{l.current=r},[r]),{showCompilePanel:a,toggleCompilePanel:(0,D.useCallback)(()=>{o(e=>{if(e)return te(),!1;let t=i.current;if(!t)return e;let n=t.getBoundingClientRect();return E({top:Math.round(n.bottom-40+6),left:Math.round(n.left),config:c.current,pages:l.current}),!0})},[i])}}function xt(e){let{projectPath:t,initialDevice:n=ue[1],initialRightPane:r=Xe}=e,i=(0,D.useRef)(null),a=(0,D.useRef)(null),o=$e({initialDevice:n}),s=nt({projectPath:t});(0,D.useEffect)(()=>{s.compileStatus.status===`ready`&&o.setSimPanelWidth(o.device.width+48)},[o.device.width,s.compileStatus.status,o.setSimPanelWidth]);let c=pt({compileStatus:s.compileStatus,sendDeviceInfo:o.sendDeviceInfo,simPanelWidthRef:o.simPanelWidthRef,deviceRef:o.deviceRef,appInfo:s.appInfo,compileConfig:s.compileConfig,port:s.port,projectPath:t,hotReloadToken:s.hotReloadToken}),l=vt({compileStatus:s.compileStatus,activePagePath:c.currentPage}),u=yt({initialRightPane:r}),d=bt({relaunch:s.relaunch,compileConfig:s.compileConfig,pages:s.pages,compileDropdownRef:a});return{session:{compileStatus:s.compileStatus,appInfo:s.appInfo,port:s.port,pages:s.pages,compileConfig:s.compileConfig,compileEvents:s.compileEvents,compileLogs:s.compileLogs,clearCompileEvents:s.clearCompileEvents,relaunch:s.relaunch},device:{device:o.device,zoom:o.zoom,simPanelWidth:o.simPanelWidth,setSimPanelWidth:o.setSimPanelWidth,handleDeviceChange:o.handleDeviceChange,handleZoomChange:o.handleZoomChange,handleSplitterDrag:o.handleSplitterDrag,sendDeviceInfo:o.sendDeviceInfo},simulator:{simulatorRef:i,simulatorUrl:c.simulatorUrl,currentPage:c.currentPage},panelData:{wxmlTree:l.wxmlTree,appData:l.appData,storageItems:l.storageItems,refreshWxml:l.refreshWxml,refreshAppData:l.refreshAppData,setActiveAppDataBridge:l.setActiveAppDataBridge,refreshStorage:l.refreshStorage,setStorageItem:l.setStorageItem,removeStorageItem:l.removeStorageItem,clearStorage:l.clearStorage,clearAllStorage:l.clearAllStorage,getStoragePrefix:l.getStoragePrefix,inspectWxmlElement:l.inspectWxmlElement,clearWxmlElementInspection:l.clearWxmlElementInspection},rightPane:{rightPane:u.rightPane,selectRightPane:u.selectRightPane,toggleRightPaneVisible:u.toggleRightPaneVisible},popover:{compileDropdownRef:a,showCompilePanel:d.showCompilePanel,toggleCompilePanel:d.toggleCompilePanel}}}var St={dockTree:null,simulatorAlignment:`left`,devtoolsPosition:`inEditor`},Ct=`dimina-devtools.layout.v1`;function wt(){try{let e=window.localStorage.getItem(Ct);if(!e)return St;let t=JSON.parse(e);return{dockTree:typeof t.dockTree==`string`?t.dockTree:null,simulatorAlignment:t.simulatorAlignment===`right`?`right`:`left`,devtoolsPosition:t.devtoolsPosition===`belowSimulator`||t.devtoolsPosition===`rightOfSimulator`?t.devtoolsPosition:`inEditor`}}catch{return St}}function Tt(e){try{window.localStorage.setItem(Ct,JSON.stringify(e))}catch{}}function Et(){let[e,t]=(0,D.useState)(wt);return(0,D.useEffect)(()=>{Tt(e)},[e]),{state:e,setDockTree:(0,D.useCallback)(e=>{t(t=>t.dockTree===e?t:{...t,dockTree:e})},[]),setSimulatorAlignment:(0,D.useCallback)(e=>{t(t=>t.simulatorAlignment===e?t:{...t,simulatorAlignment:e})},[]),setDevtoolsPosition:(0,D.useCallback)(e=>{t(t=>t.devtoolsPosition===e?t:{...t,devtoolsPosition:e})},[])}}var Dt={compiling:`bg-status-warn animate-[pulse_1s_infinite]`,ready:`bg-accent`,error:`bg-status-error`};function Ot({status:e}){return(0,O.jsx)(`span`,{className:_(`w-1.5 h-1.5 rounded-full shrink-0`,Dt[e]??`bg-border`)})}function kt(){let e=new Map;return{register(t){return e.set(t.id,t),{dispose(){e.get(t.id)===t&&e.delete(t.id)}}},get(t){return e.get(t)},list(){return[...e.values()]}}}var At=64;function jt(e){return JSON.stringify(e)}function Mt(e,t,n,r){e===void 0?r.push(`node missing string id (kind=${String(t)})`):n.seenIds.has(e)?r.push(`duplicate node id: ${e}`):n.seenIds.add(e)}function Nt(e,t,n,r){if(typeof e!=`string`){r.push(`tabs ${t??`?`}: non-string panel id`);return}n.panelOwners.get(e)===void 0?n.panelOwners.set(e,t??`?`):r.push(`duplicate panel id across groups: ${e}`),n.knownPanelIds&&!n.knownPanelIds.has(e)&&r.push(`orphan panel not in known panel ids: ${e}`)}function Pt(e,t,n,r){let i=e,a=Array.isArray(i.panels)?i.panels:null;if(!a){r.push(`tabs ${t??`?`}: panels is not an array`);return}a.length===0&&r.push(`tabs ${t??`?`}: empty tabgroup`);for(let e of a)Nt(e,t,n,r);let o=i.active;(typeof o!=`string`||!a.includes(o))&&r.push(`tabs ${t??`?`}: active ${String(o)} not in panels`)}function Ft(e,t,n){if(e===null)return!1;if(typeof e!=`object`)return n.push(`split ${t??`?`}: constraint is not null nor an object: ${String(e)}`),!1;let r=Object.keys(e),i=r.includes(`fixedPx`),a=r.includes(`minPx`);(r.length!==1||!(i||a))&&n.push(`split ${t??`?`}: constraint must have exactly one of 'fixedPx' or 'minPx', got [${r.join(`, `)}]`);let o=i?`fixedPx`:`minPx`,s=i?e.fixedPx:e.minPx;return(typeof s!=`number`||!Number.isFinite(s)||s<=0)&&n.push(`split ${t??`?`}: constraint ${o} must be a finite number > 0, got ${String(s)}`),!0}function It(e,t,n){let r=Array.isArray(e)?e:null;if(!r){n.push(`split ${t??`?`}: constraints is not an array`);return}let i=r.length>0;for(let e of r)Ft(e,t,n)||(i=!1);i&&n.push(`split ${t??`?`}: all children are px-sized constraints; at least one must be weight-sized`)}function Lt(e,t,n,r){if(!e||e.length!==t.length){r.push(`split ${n??`?`}: sizes ${e?e.length:`missing`} != children ${t.length}`);return}for(let t of e)(typeof t!=`number`||!Number.isFinite(t))&&r.push(`split ${n??`?`}: non-finite size ${String(t)}`)}function Rt(e,t){let n=[],r={seenIds:new Set,seenObjects:new Set,panelOwners:new Map,knownPanelIds:t},i=(e,t,a)=>{if(t>At){n.push(`depth exceeds ${At}`);return}if(typeof e!=`object`||!e){n.push(`node is not an object: ${String(e)}`);return}let o=e;if(a.has(o)){n.push(`cycle detected: node reachable from itself`);return}if(r.seenObjects.has(o)){n.push(`shared node reference: same object appears twice`);return}r.seenObjects.add(o);let s=e,c=s.kind,l=typeof s.id==`string`?s.id:void 0;Mt(l,c,r,n),c===`tabs`?Pt(e,l,r,n):c===`split`?zt(e,l,t,a,o,r,n,i):n.push(`unknown node kind: ${String(c)}`)};return i(e,0,new Set),n}function zt(e,t,n,r,i,a,o,s){let c=e,l=Array.isArray(c.children)?c.children:null,u=Array.isArray(c.sizes)?c.sizes:null,d=c.orientation;if(d!==`row`&&d!==`column`&&o.push(`split ${t??`?`}: invalid orientation ${String(d)}`),c.constraints!==void 0&&It(c.constraints,t,o),!l){o.push(`split ${t??`?`}: children is not an array`);return}if(l.length<2&&o.push(`split ${t??`?`}: must have >= 2 children, has ${l.length}`),Lt(u,l,t,o),c.constraints!==void 0&&Array.isArray(c.constraints)){let e=c.constraints;e.length!==l.length&&o.push(`split ${t??`?`}: constraints ${e.length} != children ${l.length}`)}let f=new Set(r);f.add(i);for(let e of l)s(e,n+1,f)}function Bt(e,t){return typeof e!=`object`||!e?[`tree is not an object`]:e.version===1?Rt(e.root,t):[`unsupported version: ${String(e.version)}`]}function Vt(e){let t;try{t=JSON.parse(e)}catch{throw Error(`parseLayout: input is not valid JSON`)}if(typeof t!=`object`||!t)throw Error(`parseLayout: top-level value is not an object`);let n=t;if(n.version!==1)throw Error(`parseLayout: unsupported version ${String(n.version)}`);if(n.root===void 0||n.root===null)throw Error(`parseLayout: missing root`);let r=Rt(n.root,null);if(r.length>0)throw Error(`parseLayout: illegal layout — ${r.join(`; `)}`);return{version:1,root:n.root}}var Ht=1;function Ut(e,t){return(e.constraints?.[t]??null)===null}function Wt(e){if(e.kind===`tabs`)return e;let t=e.children.map(Wt),n=t.some((t,n)=>t!==e.children[n]),r=e.sizes.map((t,r)=>!Ut(e,r)||typeof t==`number`&&Number.isFinite(t)&&t>0?t:(n=!0,Ht));if(!n)return e;let i={kind:`split`,id:e.id,orientation:e.orientation,children:t,sizes:r};return e.constraints===void 0?i:{...i,constraints:e.constraints}}function Gt(e){let t=Wt(e.root);return t===e.root?e:{version:1,root:t}}function k(e,t,n){return{kind:`tabs`,id:e,panels:t,active:n}}function Kt(e,t,n){if(e.length===0)return``;if(e.includes(t))return t;let r=Math.min(n,e.length-1);return e[Math.max(0,r)]}function qt(e){if(e.kind===`tabs`)return e.panels.length===0?null:e;let t=[],n=[],r=[],i=e.constraints!==void 0;if(e.children.forEach((a,o)=>{let s=qt(a);s!==null&&(t.push(s),n.push(e.sizes[o]??1),i&&r.push(e.constraints[o]??null))}),t.length===0)return null;if(t.length===1)return t[0];let a={kind:`split`,id:e.id,orientation:e.orientation,children:t,sizes:n};return i?(r.length>0&&!r.some(e=>e===null)&&(r[r.length-1]=null),{...a,constraints:r}):a}function Jt(e){let t=qt(e);if(t===null)throw Error(`mutation would empty the entire layout`);return t}function Yt(e,t){let n=null,r=e=>{n||(e.kind===`tabs`?e.panels.includes(t)&&(n=e):e.children.forEach(r))};return r(e),n?{group:n}:null}function Xt(e,t){let n=null,r=e=>{n||(e.kind===`tabs`?e.id===t&&(n=e):e.children.forEach(r))};return r(e),n}function Zt(e){let t=new Set,n=e=>{if(e.kind===`tabs`)for(let n of e.panels)t.add(n);else e.children.forEach(n)};return n(e),t}function Qt(e,t){return Zt(e).has(t)}function $t(e){let t=new Set,n=e=>{t.add(e.id),e.kind===`split`&&e.children.forEach(n)};return n(e),t}function en(e,t){let n=t,r=2;for(;e.has(n);)n=`${t}#${r}`,r+=1;return e.add(n),n}function tn(e,t){let n=null,r=e=>{n||e.kind===`split`&&(e.id===t&&(n=e),e.children.forEach(r))};return r(e),n}function A(e,t,n){if(e.id===t)return n;if(e.kind===`tabs`)return k(e.id,[...e.panels],e.active);let r={kind:`split`,id:e.id,orientation:e.orientation,children:e.children.map(e=>A(e,t,n)),sizes:[...e.sizes]};return e.constraints===void 0?r:{...r,constraints:[...e.constraints]}}function nn(e){if(e.kind===`tabs`)return k(e.id,[...e.panels],e.active);let t={kind:`split`,id:e.id,orientation:e.orientation,children:e.children.map(nn),sizes:[...e.sizes]};return e.constraints===void 0?t:{...t,constraints:[...e.constraints]}}function j(e){return{version:1,root:e}}function rn(e,t,n){let r=tn(e.root,t);if(!r)throw Error(`setSizes: split not found: ${t}`);if(n.length!==r.children.length)throw Error(`setSizes: sizes length ${n.length} != children length ${r.children.length}`);if(!n.every(e=>Number.isFinite(e)))throw Error(`setSizes: every size must be a finite number, got [${n.join(`, `)}]`);let i={kind:`split`,id:r.id,orientation:r.orientation,children:r.children.map(nn),sizes:[...n]},a=r.constraints===void 0?i:{...i,constraints:[...r.constraints]};return j(A(e.root,t,a))}function an(e,t,n,r){let i=tn(e.root,t);if(!i)throw Error(`setConstraint: split not found: ${t}`);if(!Number.isInteger(n))throw Error(`setConstraint: childIndex must be an integer, got ${n}`);if(n<0||n>=i.children.length)throw Error(`setConstraint: childIndex ${n} out of range [0, ${i.children.length})`);let a=i.constraints===void 0?i.children.map(()=>null):[...i.constraints];if(a[n]=r,a.length>0&&a.every(e=>e!==null))return e;let o={kind:`split`,id:i.id,orientation:i.orientation,children:i.children.map(nn),sizes:[...i.sizes],constraints:a};return j(A(e.root,t,o))}function on(e,t,n){let r=Xt(e.root,t);if(!r)throw Error(`setActive: group not found: ${t}`);if(!r.panels.includes(n))throw Error(`setActive: panel ${n} not in group ${t}`);let i=k(r.id,[...r.panels],n);return j(A(e.root,t,i))}function sn(e,t){let n=Yt(e,t);if(!n)throw Error(`panel not found: ${t}`);let{group:r}=n,i=r.panels.indexOf(t),a=r.panels.filter(e=>e!==t),o=k(r.id,a,Kt(a,r.active,i));return Jt(A(e,r.id,o))}function cn(e,t){let n=Zt(e.root);return n.size===1&&n.has(t)?e:j(sn(e.root,t))}function ln(e,t){if(!Yt(e.root,t))throw Error(`extractPanel: panel not found: ${t}`);return{tree:j(sn(e.root,t)),extracted:t}}function un(e,t,n){if(Qt(e.root,t))throw Error(`insertPanel: panel already exists in the tree: ${t}`);let r=Xt(e.root,n.groupId);if(!r)throw Error(`insertPanel: dest group not found: ${n.groupId}`);let i=[...r.panels],a=dn(n.index,i.length);i.splice(a,0,t);let o=k(r.id,i,r.active);return j(Jt(A(e.root,r.id,o)))}function dn(e,t){return e===void 0?t:e<0?0:e>t?t:e}function fn(e,t,n){let r=Yt(e.root,t);if(!r)throw Error(`movePanel: panel not found: ${t}`);let i=Xt(e.root,n.groupId);if(!i)throw Error(`movePanel: dest group not found: ${n.groupId}`);if(r.group.id===i.id){let i=r.group.panels.filter(e=>e!==t),a=dn(n.index,i.length),o=[...i];o.splice(a,0,t);let s=k(r.group.id,o,r.group.active);return j(Jt(A(e.root,r.group.id,s)))}let a=r.group.panels.indexOf(t),o=r.group.panels.filter(e=>e!==t),s=k(r.group.id,o,Kt(o,r.group.active,a)),c=[...i.panels],l=dn(n.index,c.length);c.splice(l,0,t);let u=k(i.id,c,i.active),d=A(e.root,r.group.id,s);return d=A(d,i.id,u),j(Jt(d))}function M(e,t,n,r,i){if(Qt(e.root,r))throw Error(`splitPanel: new panel already exists in the tree: ${r}`);let a=Yt(e.root,t);if(!a)throw Error(`splitPanel: panel not found: ${t}`);let{group:o}=a,s=$t(e.root),c=o.id,l=k(en(s,`${c}__split`),[t],t),u=k(en(s,`${c}__new`),[r],r),d=i===`after`?[l,u]:[u,l],f={kind:`split`,id:en(s,`${c}__sp`),orientation:n,children:d,sizes:[1,1]};if(o.panels.length===1)return j(Jt(A(e.root,c,f)));let p=o.panels.indexOf(t),m=o.panels.filter(e=>e!==t),h=k(c,m,Kt(m,o.active,p)),g=i===`after`?[h,f]:[f,h],_={kind:`split`,id:en(s,`${c}__outer`),orientation:n,children:g,sizes:[1,1]};return j(Jt(A(e.root,c,_)))}function pn(e){let t=structuredClone(e),n=0,r=new Set,i=!1,a=[],o=e=>{t=e(t),n+=1;let i={tree:t,revision:n};for(let e of[...r])try{e(i)}catch{}};return{get(){return t},apply(e){if(i){a.push(e);return}i=!0;try{for(o(e);a.length>0;){let e=a.shift();try{o(e)}catch{}}}finally{i=!1}},subscribe(e){return r.add(e),()=>{r.delete(e)}}}}function mn(e,t,n){return n.get(t)?.closable===!1?e:cn(e,t)}function hn(){let e=kt();return e.register({kind:`dom`,id:`simulator`,title:`Simulator`,draggable:!1,hideTab:!0}),e.register({kind:`dom`,id:`editor`,title:`Editor`,draggable:!1,hideTab:!0}),e.register({kind:`dom`,id:`wxml`,title:`WXML`,dropPolicy:`reorder-only`,closable:!1}),e.register({kind:`dom`,id:`appdata`,title:`AppData`,dropPolicy:`reorder-only`,closable:!1}),e.register({kind:`dom`,id:`storage`,title:`Storage`,dropPolicy:`reorder-only`,closable:!1}),e.register({kind:`native`,id:`console`,title:`Console`,nativeRef:{id:`console`},dropPolicy:`reorder-only`,closable:!1}),e.register({kind:`dom`,id:`compile`,title:`编译`,dropPolicy:`reorder-only`,closable:!1}),e}function gn(e){return{version:1,root:{kind:`split`,id:`root`,orientation:`row`,sizes:[1,6],constraints:[{minPx:e},null],children:[{kind:`tabs`,id:`g-sim`,panels:[`simulator`],active:`simulator`},{kind:`split`,id:`col-main`,orientation:`column`,sizes:[70,30],children:[{kind:`tabs`,id:`g-editor`,panels:[`editor`],active:`editor`},{kind:`tabs`,id:`g-debug`,panels:[`wxml`,`appdata`,`storage`,`console`,`compile`],active:`wxml`}]}]}}}var _n={kind:`tabs`,id:`g-debug`,panels:[`wxml`,`appdata`,`storage`,`console`,`compile`],active:`wxml`},vn=()=>({kind:`tabs`,id:`g-sim`,panels:[`simulator`],active:`simulator`}),yn=()=>({kind:`tabs`,id:`g-editor`,panels:[`editor`],active:`editor`}),bn=()=>({..._n,panels:[..._n.panels]});function xn(e,t,n,r){return{version:1,root:{kind:`split`,id:`root`,orientation:`row`,sizes:e.map((e,t)=>r[t]??1),constraints:e.map((e,r)=>r===t?{minPx:n}:null),children:e}}}function Sn(e,t,n){let r=t===`left`;if(n===`belowSimulator`){let t={kind:`split`,id:`col-sim`,orientation:`column`,sizes:[60,40],children:[vn(),bn()]};return r?xn([t,yn()],0,e,[1,6]):xn([yn(),t],1,e,[6,1])}if(n===`rightOfSimulator`)return r?xn([vn(),bn(),yn()],0,e,[1,4,5]):xn([yn(),bn(),vn()],2,e,[5,4,1]);let i={kind:`split`,id:`col-main`,orientation:`column`,sizes:[70,30],children:[yn(),bn()]};return r?xn([vn(),i],0,e,[1,6]):xn([i,vn()],1,e,[6,1])}function Cn(e,t,n){return pn(wn(e,t,n))}function wn(e,t,n){if(e===null)return gn(t);try{let t=Vt(e);if(Bt(t,n).length===0)return Gt(t)}catch{}return gn(t)}var Tn=[`wxml`,`appdata`,`storage`,`console`,`compile`];function En(e,t){if(e.kind===`tabs`){for(let n of e.panels)t.add(n);return}for(let n of e.children)En(n,t)}function Dn(e){let t=new Set;return En(e.root,t),t}function On(e,t){if(e.kind===`tabs`)return e.panels.includes(t)?e.id:void 0;for(let n of e.children){let e=On(n,t);if(e!==void 0)return e}}function kn(e,t){return t.find(t=>e.has(t))}function An(e,t){if(e.kind===`tabs`)return null;for(let n=0;n<e.children.length;n++){if(e.children[n].id===t)return{splitId:e.id,childIndex:n};let r=An(e.children[n],t);if(r)return r}return null}function jn(e,t){let n=On(e.root,`simulator`);if(!n)return e;let r=An(e.root,n);return r?an(e,r.splitId,r.childIndex,{minPx:t}):e}function Mn(e,t,n){let r=Dn(e);if(r.has(t))return e;if(Tn.includes(t)){let n=Tn.find(e=>e!==t&&r.has(e));return n?un(e,t,{groupId:On(e.root,n)}):r.has(`editor`)?M(e,`editor`,`column`,t,`after`):r.has(`simulator`)?M(e,`simulator`,`row`,t,`after`):M(e,[...r][0],`column`,t,`after`)}if(t===`editor`){let t=kn(r,Tn);return t?M(e,t,`column`,`editor`,`before`):r.has(`simulator`)?M(e,`simulator`,`row`,`editor`,`after`):M(e,[...r][0],`column`,`editor`,`before`)}return t===`simulator`?jn(M(e,kn(r,[`editor`,...Tn])??[...r][0],`row`,`simulator`,`before`),n):M(e,[...r][0],`column`,t,`after`)}function Nn(e,t){let n=Dn(e);return t.list().map(e=>({id:e.id,title:e.title??e.id,open:n.has(e.id)}))}var Pn=[`wxml`,`appdata`,`storage`,`console`,`compile`];function Fn({model:e,registry:t,simPanelWidth:n}){let[,r]=(0,D.useState)(0);(0,D.useEffect)(()=>e.subscribe(()=>r(e=>e+1)),[e]);let i=new Set(Nn(e.get(),t).filter(e=>e.open).map(e=>e.id)),a=i.has(`simulator`),o=i.has(`editor`),s=Pn.some(e=>i.has(e)),c=[a,o,s].filter(Boolean).length;function l(r,i){e.apply(e=>i?mn(e,r,t):Mn(e,r,n))}function u(){if(s){let t=Pn.filter(e=>i.has(e));e.apply(e=>t.reduce((e,t)=>cn(e,t),e))}else{let t=Pn.filter(e=>!i.has(e));e.apply(e=>t.reduce((e,t)=>Mn(e,t,n),e))}}return(0,O.jsxs)(`div`,{className:`flex items-center gap-0.5`,role:`group`,"aria-label":`面板可见性`,children:[(0,O.jsx)(Rn,{active:a,disabled:a&&c===1,onClick:()=>l(`simulator`,a),title:a?`隐藏模拟器`:`显示模拟器`,testId:`layout-toolbar-toggle-simulator`,icon:(0,O.jsx)(zn,{filled:a})}),(0,O.jsx)(Rn,{active:o,disabled:o&&c===1,onClick:()=>l(`editor`,o),title:o?`隐藏编辑器`:`显示编辑器`,testId:`layout-toolbar-toggle-editor`,icon:(0,O.jsx)(Bn,{filled:o})}),(0,O.jsx)(Rn,{active:s,disabled:s&&c===1,onClick:u,title:s?`隐藏调试器`:`显示调试器`,testId:`layout-toolbar-toggle-debug`,icon:(0,O.jsx)(Vn,{filled:s})})]})}function In({model:e,layout:t,simPanelWidth:n}){let{simulatorAlignment:r,devtoolsPosition:i}=t.state,a=r===`left`;function o(){let r=a?`right`:`left`;t.setSimulatorAlignment(r),e.apply(()=>Sn(n,r,i))}return(0,O.jsx)(S,{variant:`icon`,size:`icon`,onClick:o,title:a?`模拟器位置:左侧(点击切换到右侧)`:`模拟器位置:右侧(点击切换到左侧)`,"data-testid":`layout-toolbar-alignment-toggle`,"data-alignment":r,className:`text-text-muted hover:text-text hover:bg-surface-3`,children:(0,O.jsx)(Hn,{side:r})})}function Ln({model:e,layout:t,simPanelWidth:n}){let{simulatorAlignment:r,devtoolsPosition:i}=t.state;function a(i){t.setDevtoolsPosition(i),e.apply(()=>Sn(n,r,i))}return(0,O.jsx)(`div`,{className:`flex items-center gap-0.5`,role:`group`,"aria-label":`调试器位置`,children:[{id:`inEditor`,title:`调试器位置:在编辑器面板中`},{id:`belowSimulator`,title:`调试器位置:在模拟器下方`},{id:`rightOfSimulator`,title:`调试器位置:在模拟器右侧`}].map(e=>(0,O.jsx)(Rn,{active:i===e.id,onClick:()=>a(e.id),title:e.title,testId:`layout-toolbar-devtools-${e.id}`,icon:(0,O.jsx)(Un,{variant:e.id})},e.id))})}function Rn({active:e,disabled:t,onClick:n,title:r,testId:i,icon:a}){return(0,O.jsx)(S,{variant:`icon`,size:`icon`,onClick:n,disabled:t,title:r,"aria-pressed":e,"data-testid":i,"data-active":e?`true`:`false`,className:_(`text-text-muted/45 hover:text-text-muted hover:bg-surface-3`,e&&`bg-surface-active text-text ring-1 ring-accent/50 hover:bg-surface-active hover:text-text`),children:a})}function zn({filled:e}){return(0,O.jsx)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.4`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:e?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`rect`,{x:`4`,y:`1.5`,width:`8`,height:`13`,rx:`1.5`,fill:`currentColor`,stroke:`currentColor`}),(0,O.jsx)(`line`,{x1:`6.5`,y1:`12.5`,x2:`9.5`,y2:`12.5`,stroke:`var(--color-surface-2)`,strokeWidth:`1.2`})]}):(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`rect`,{x:`4`,y:`1.5`,width:`8`,height:`13`,rx:`1.5`}),(0,O.jsx)(`line`,{x1:`6.5`,y1:`12.5`,x2:`9.5`,y2:`12.5`})]})})}function Bn({filled:e}){return(0,O.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:e?2:1.6,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,O.jsx)(`polyline`,{points:`5,4 1.5,8 5,12`}),(0,O.jsx)(`polyline`,{points:`11,4 14.5,8 11,12`}),(0,O.jsx)(`line`,{x1:`9.5`,y1:`3`,x2:`6.5`,y2:`13`})]})}function Vn({filled:e}){return(0,O.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.4`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[e?(0,O.jsx)(`ellipse`,{cx:`8`,cy:`9`,rx:`3.5`,ry:`4.5`,fill:`currentColor`,stroke:`currentColor`}):(0,O.jsx)(`ellipse`,{cx:`8`,cy:`9`,rx:`3.5`,ry:`4.5`}),(0,O.jsx)(`line`,{x1:`6`,y1:`3.5`,x2:`5`,y2:`2`}),(0,O.jsx)(`line`,{x1:`10`,y1:`3.5`,x2:`11`,y2:`2`}),(0,O.jsx)(`line`,{x1:`4.5`,y1:`7.5`,x2:`2`,y2:`6.5`}),(0,O.jsx)(`line`,{x1:`4.5`,y1:`9.5`,x2:`2`,y2:`9.5`}),(0,O.jsx)(`line`,{x1:`4.5`,y1:`11.5`,x2:`2`,y2:`12.5`}),(0,O.jsx)(`line`,{x1:`11.5`,y1:`7.5`,x2:`14`,y2:`6.5`}),(0,O.jsx)(`line`,{x1:`11.5`,y1:`9.5`,x2:`14`,y2:`9.5`}),(0,O.jsx)(`line`,{x1:`11.5`,y1:`11.5`,x2:`14`,y2:`12.5`})]})}function Hn({side:e}){return(0,O.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.4`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,O.jsx)(`rect`,{x:`2`,y:`3`,width:`12`,height:`10`,rx:`1.5`}),e===`left`?(0,O.jsx)(`rect`,{x:`2.6`,y:`3.6`,width:`4.8`,height:`8.8`,rx:`0.8`,fill:`currentColor`,stroke:`none`}):(0,O.jsx)(`rect`,{x:`8.6`,y:`3.6`,width:`4.8`,height:`8.8`,rx:`0.8`,fill:`currentColor`,stroke:`none`})]})}function Un({variant:e}){return e===`inEditor`?(0,O.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.2`,"aria-hidden":`true`,children:[(0,O.jsx)(`rect`,{x:`2`,y:`3`,width:`12`,height:`10`,rx:`1.5`}),(0,O.jsx)(`line`,{x1:`6.5`,y1:`3`,x2:`6.5`,y2:`13`}),(0,O.jsx)(`rect`,{x:`7.1`,y:`8.5`,width:`6.3`,height:`4`,rx:`0.6`,fill:`currentColor`,stroke:`none`})]}):e===`belowSimulator`?(0,O.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.2`,"aria-hidden":`true`,children:[(0,O.jsx)(`rect`,{x:`2`,y:`3`,width:`12`,height:`10`,rx:`1.5`}),(0,O.jsx)(`line`,{x1:`8`,y1:`3`,x2:`8`,y2:`13`}),(0,O.jsx)(`rect`,{x:`2.6`,y:`8.5`,width:`4.8`,height:`4`,rx:`0.6`,fill:`currentColor`,stroke:`none`})]}):(0,O.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.2`,"aria-hidden":`true`,children:[(0,O.jsx)(`rect`,{x:`2`,y:`3`,width:`12`,height:`10`,rx:`1.5`}),(0,O.jsx)(`line`,{x1:`6`,y1:`3`,x2:`6`,y2:`13`}),(0,O.jsx)(`line`,{x1:`9.5`,y1:`3`,x2:`9.5`,y2:`13`}),(0,O.jsx)(`rect`,{x:`6.3`,y:`3.6`,width:`3`,height:`8.8`,rx:`0.6`,fill:`currentColor`,stroke:`none`})]})}function Wn(){return(0,O.jsx)(`div`,{className:`w-px h-4 bg-border mx-1`,"aria-hidden":`true`})}function Gn({compileDropdownRef:e,showCompilePanel:t,onToggleCompilePanel:n,onRelaunch:r,compileStatus:i,dockModel:a,dockRegistry:o,layout:s,simPanelWidth:c}){return(0,O.jsx)(`div`,{className:`flex flex-col shrink-0`,children:(0,O.jsxs)(`div`,{className:`flex items-center gap-1.5 px-2.5 bg-surface-2 border-b border-border shrink-0`,style:{height:40},children:[(0,O.jsx)(`div`,{ref:e,children:(0,O.jsxs)(S,{variant:`outline`,size:`sm`,onClick:n,className:_(t&&`border-accent`),title:`编译模式`,children:[`普通编译 `,(0,O.jsx)(`span`,{className:`text-[10px] text-text-secondary`,children:`▾`})]})}),(0,O.jsx)(Wn,{}),(0,O.jsx)(S,{variant:`icon`,size:`icon`,onClick:()=>{r()},disabled:i.status===`compiling`,title:`重新编译`,children:`↺`}),(0,O.jsxs)(`div`,{className:`flex items-center gap-1.5 px-1.5 shrink-0`,children:[(0,O.jsx)(Ot,{status:i.status}),(0,O.jsx)(`span`,{className:`text-[11px] text-text-muted max-w-28 truncate`,children:i.message})]}),(0,O.jsx)(`div`,{className:`flex-1 min-w-2`}),(0,O.jsx)(Fn,{model:a,registry:o,simPanelWidth:c}),(0,O.jsx)(Wn,{}),(0,O.jsx)(In,{model:a,layout:s,simPanelWidth:c}),(0,O.jsx)(Wn,{}),(0,O.jsx)(Ln,{model:a,layout:s,simPanelWidth:c}),(0,O.jsx)(Wn,{}),(0,O.jsx)(S,{variant:`icon`,size:`icon`,onClick:()=>{pe(!0)},title:`设置`,children:`⚙`})]})})}var Kn={x:0,y:0,width:0,height:0},qn=e=>({x:Math.round(e.x),y:Math.round(e.y),width:Math.max(0,Math.round(e.width)),height:Math.max(0,Math.round(e.height))});function Jn(e,t){let n=t.present,r=t.publish,i=null,a=null,o=!1,s=()=>{let t=e.getBoundingClientRect();return qn({x:t.left,y:t.top,width:t.width,height:t.height})},c=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,l=()=>{if(o||!n)return;let e=s();a&&c(a,e)||(a=e,r(e))},u=()=>{i||(i=new ResizeObserver(l),i.observe(e),window.addEventListener(`resize`,l))},d=()=>{i&&=(i.disconnect(),null),window.removeEventListener(`resize`,l)},f=()=>{a=null,n?(u(),a=s(),r(a)):(d(),r(Kn))};return f(),{update(e){o||(r=e.publish,n=e.present,f())},dispose(){o||(o=!0,d())}}}function Yn(e){let t=e.getBoundingClientRect();return{visible:!0,bounds:qn({x:t.left,y:t.top,width:t.width,height:t.height})}}var Xn=(e,t)=>e.visible===t.visible?e.visible&&t.visible?e.bounds.x===t.bounds.x&&e.bounds.y===t.bounds.y&&e.bounds.width===t.bounds.width&&e.bounds.height===t.bounds.height:!0:!1;function Zn(e,t){let n=t.visible,r=t.publish,i=t.guardDisplayNone??!1,a=t.followScroll??!1,o=t.followGeometry??!1,s=null,c=null,l=null,u=!1,d=null,f=0,p=!1,m=null,h=()=>{let t=Yn(e);return i&&t.visible&&(t.bounds.width===0||t.bounds.height===0)?{visible:!1}:t},g=()=>{if(u||!n)return;let e=h();l&&Xn(l,e)||(l=e,r(e))},_=()=>{if(d=null,u||!n){m=null;return}if(m!==null&&performance.now()>=m){m=null;return}let e=h();if(l&&Xn(l,e)){if(f++,f>=2&&!p){m=null;return}}else l=e,r(e),f=0;!u&&n?d=requestAnimationFrame(_):m=null},v=()=>{!o||u||(f=0,d===null&&(d=requestAnimationFrame(_)))},y=()=>{d!==null&&(cancelAnimationFrame(d),d=null),f=0,m=null,p=!1},b=()=>{o?v():g()},x=e=>{let t=e.target;t&&t.closest&&t.closest(`[role="separator"]`)&&(p=!0,v())},S=()=>{p&&(p=!1,v())},C=()=>{s||(s=new ResizeObserver(g),s.observe(e),window.addEventListener(`resize`,g),i&&typeof IntersectionObserver<`u`&&(c=new IntersectionObserver(g),c.observe(e)),a&&window.addEventListener(`scroll`,b,{capture:!0,passive:!0}),o&&(window.addEventListener(`pointerdown`,x,{capture:!0}),window.addEventListener(`pointerup`,S,{capture:!0})))},w=()=>{s&&=(s.disconnect(),null),c&&=(c.disconnect(),null),window.removeEventListener(`resize`,g),window.removeEventListener(`scroll`,b,{capture:!0}),window.removeEventListener(`pointerdown`,x,{capture:!0}),window.removeEventListener(`pointerup`,S,{capture:!0}),y()},T=()=>{if(l=null,n)C(),l=h(),r(l);else{w();let e={visible:!1};l=e,r(e)}};return T(),{update(e){u||(r=e.publish,n=e.visible,T())},dispose(){u||(u=!0,w())},pulse(e){if(!(u||!o)){if(e!==void 0&&e>0){let t=performance.now()+e;m=m===null?t:Math.max(m,t)}v()}}}}function Qn(e){let t=(0,D.useRef)(null),n=(0,D.useRef)(null),r=(0,D.useRef)(e);r.current=e;let i=(0,D.useRef)([e.present,e.publish,...e.deps??[]]),a=(0,D.useRef)(()=>{let e=t.current;e&&(e.update({present:!1,publish:r.current.publish}),e.dispose(),t.current=null)}),o=(0,D.useCallback)(e=>{e!==n.current&&(n.current=e,t.current&&(e?(t.current.dispose(),t.current=null):a.current()),e&&(t.current=Jn(e,{present:r.current.present,publish:r.current.publish}),i.current=[r.current.present,r.current.publish,...r.current.deps??[]]))},[]);return(0,D.useEffect)(()=>{let n=[e.present,e.publish,...e.deps??[]],r=i.current;(n.length!==r.length||n.some((e,t)=>!Object.is(e,r[t])))&&(i.current=n,t.current?.update({present:e.present,publish:e.publish}))},[e.present,e.publish,...e.deps??[]]),(0,D.useEffect)(()=>{let e=a.current;return n.current&&!t.current&&(t.current=Jn(n.current,{present:r.current.present,publish:r.current.publish})),()=>{n.current===null&&e()}},[]),o}function $n(e,t){let n=getComputedStyle(e);return t*parseFloat(n.fontSize)}function er(e,t){let n=getComputedStyle(e.ownerDocument.body);return t*parseFloat(n.fontSize)}function tr(e){return e/100*window.innerHeight}function nr(e){return e/100*window.innerWidth}function rr(e){switch(typeof e){case`number`:return[e,`px`];case`string`:{let t=parseFloat(e);return e.endsWith(`%`)?[t,`%`]:e.endsWith(`px`)?[t,`px`]:e.endsWith(`rem`)?[t,`rem`]:e.endsWith(`em`)?[t,`em`]:e.endsWith(`vh`)?[t,`vh`]:e.endsWith(`vw`)?[t,`vw`]:[t,`%`]}}}function ir({groupSize:e,panelElement:t,styleProp:n}){let r,[i,a]=rr(n);switch(a){case`%`:r=i/100*e;break;case`px`:r=i;break;case`rem`:r=er(t,i);break;case`em`:r=$n(t,i);break;case`vh`:r=tr(i);break;case`vw`:r=nr(i);break}return r}function N(e){return parseFloat(e.toFixed(3))}function ar({group:e}){let{orientation:t,panels:n}=e;return n.reduce((e,n)=>(e+=t===`horizontal`?n.element.offsetWidth:n.element.offsetHeight,e),0)}function or(e){let{panels:t}=e,n=ar({group:e});return n===0?t.map(e=>({groupResizeBehavior:e.panelConstraints.groupResizeBehavior,collapsedSize:0,collapsible:e.panelConstraints.collapsible===!0,defaultSize:void 0,disabled:e.panelConstraints.disabled,minSize:0,maxSize:100,panelId:e.id})):t.map(e=>{let{element:t,panelConstraints:r}=e,i=0;r.collapsedSize!==void 0&&(i=N(ir({groupSize:n,panelElement:t,styleProp:r.collapsedSize})/n*100));let a;r.defaultSize!==void 0&&(a=N(ir({groupSize:n,panelElement:t,styleProp:r.defaultSize})/n*100));let o=0;r.minSize!==void 0&&(o=N(ir({groupSize:n,panelElement:t,styleProp:r.minSize})/n*100));let s=100;return r.maxSize!==void 0&&(s=N(ir({groupSize:n,panelElement:t,styleProp:r.maxSize})/n*100)),{groupResizeBehavior:r.groupResizeBehavior,collapsedSize:i,collapsible:r.collapsible===!0,defaultSize:a,disabled:r.disabled,minSize:o,maxSize:s,panelId:e.id}})}function P(e,t=`Assertion error`){if(!e)throw Error(t)}function sr(e,t){return Array.from(t).sort(e===`horizontal`?cr:lr)}function cr(e,t){let n=e.element.offsetLeft-t.element.offsetLeft;return n===0?e.element.offsetWidth-t.element.offsetWidth:n}function lr(e,t){let n=e.element.offsetTop-t.element.offsetTop;return n===0?e.element.offsetHeight-t.element.offsetHeight:n}function ur(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.ELEMENT_NODE}function dr(e,t){return{x:e.x>=t.left&&e.x<=t.right?0:Math.min(Math.abs(e.x-t.left),Math.abs(e.x-t.right)),y:e.y>=t.top&&e.y<=t.bottom?0:Math.min(Math.abs(e.y-t.top),Math.abs(e.y-t.bottom))}}function fr({orientation:e,rects:t,targetRect:n}){let r={x:n.x+n.width/2,y:n.y+n.height/2},i,a=Number.MAX_VALUE;for(let n of t){let{x:t,y:o}=dr(r,n),s=e===`horizontal`?t:o;s<a&&(a=s,i=n)}return P(i,`No rect found`),i}var pr;function mr(){return pr===void 0&&(pr=typeof matchMedia==`function`?!!matchMedia(`(pointer:coarse)`).matches:!1),pr}function hr(e){let{element:t,orientation:n,panels:r,separators:i}=e,a=sr(n,Array.from(t.children).filter(ur).map(e=>({element:e}))).map(({element:e})=>e),o=[],s=!1,c=!1,l=-1,u=-1,d=0,f,p=[];{let e=-1;for(let t of a)t.hasAttribute(`data-panel`)&&(e++,t.hasAttribute(`data-disabled`)||(d++,l===-1&&(l=e),u=e))}if(d>1){let t=-1;for(let d of a)if(d.hasAttribute(`data-panel`)){t++;let i=r.find(e=>e.element===d);if(i){if(f){let r=f.element.getBoundingClientRect(),a=d.getBoundingClientRect(),m;if(c){let e=n===`horizontal`?new DOMRect(r.right,r.top,0,r.height):new DOMRect(r.left,r.bottom,r.width,0),t=n===`horizontal`?new DOMRect(a.left,a.top,0,a.height):new DOMRect(a.left,a.top,a.width,0);switch(p.length){case 0:m=[e,t];break;case 1:{let i=p[0];m=[i,fr({orientation:n,rects:[r,a],targetRect:i.element.getBoundingClientRect()})===r?t:e];break}default:m=p;break}}else m=p.length?p:[n===`horizontal`?new DOMRect(r.right,a.top,a.left-r.right,a.height):new DOMRect(a.left,r.bottom,a.width,a.top-r.bottom)];for(let n of m){let r=`width`in n?n:n.element.getBoundingClientRect(),a=mr()?e.resizeTargetMinimumSize.coarse:e.resizeTargetMinimumSize.fine;if(r.width<a){let e=a-r.width;r=new DOMRect(r.x-e/2,r.y,r.width+e,r.height)}if(r.height<a){let e=a-r.height;r=new DOMRect(r.x,r.y-e/2,r.width,r.height+e)}!s&&!(t<=l||t>u)&&o.push({group:e,groupSize:ar({group:e}),panels:[f,i],separator:`width`in n?void 0:n,rect:r}),s=!1}}c=!1,f=i,p=[]}}else if(d.hasAttribute(`data-separator`)){d.ariaDisabled!==null&&(s=!0);let e=i.find(e=>e.element===d);e?p.push(e):(f=void 0,p=[])}else c=!0}return o}var gr=class{#e={};addListener(e,t){let n=this.#e[e];return n===void 0?this.#e[e]=[t]:n.includes(t)||n.push(t),()=>{this.removeListener(e,t)}}emit(e,t){let n=this.#e[e];if(n!==void 0)if(n.length===1)n[0].call(null,t);else{let e=!1,r=null,i=Array.from(n);for(let n=0;n<i.length;n++){let a=i[n];try{a.call(null,t)}catch(t){r===null&&(e=!0,r=t)}}if(e)throw r}}removeAllListeners(){this.#e={}}removeListener(e,t){let n=this.#e[e];if(n!==void 0){let e=n.indexOf(t);e>=0&&n.splice(e,1)}}},F=new Map,_r=new gr;function vr(e){F=new Map(F),F.delete(e)}function yr(e,t){for(let[t]of F)if(t.id===e)return t}function I(e,t){for(let[t,n]of F)if(t.id===e)return n;if(t)throw Error(`Could not find data for Group with id ${e}`)}function br(){return F}function xr(e,t){return _r.addListener(`groupChange`,n=>{n.group.id===e&&t(n)})}function L(e,t){let n=F.get(e);F=new Map(F),F.set(e,t),_r.emit(`groupChange`,{group:e,prev:n,next:t})}function Sr(e,t,n){let r,i={x:1/0,y:1/0};for(let a of t){let t=dr(n,a.rect);switch(e){case`horizontal`:t.x<=i.x&&(r=a,i=t);break;case`vertical`:t.y<=i.y&&(r=a,i=t);break}}return r?{distance:i,hitRegion:r}:void 0}function Cr(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function wr(e,t){if(e===t)throw Error(`Cannot compare node with itself`);let n={a:Ar(e),b:Ar(t)},r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();P(r,`Stacking order can only be calculated for elements with a common ancestor`);let i={a:kr(Or(n.a)),b:kr(Or(n.b))};if(i.a===i.b){let e=r.childNodes,t={a:n.a.at(-1),b:n.b.at(-1)},i=e.length;for(;i--;){let n=e[i];if(n===t.a)return 1;if(n===t.b)return-1}}return Math.sign(i.a-i.b)}var Tr=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function Er(e){let t=getComputedStyle(jr(e)??e).display;return t===`flex`||t===`inline-flex`}function Dr(e){let t=getComputedStyle(e);return!!(t.position===`fixed`||t.zIndex!==`auto`&&(t.position!==`static`||Er(e))||+t.opacity<1||`transform`in t&&t.transform!==`none`||`webkitTransform`in t&&t.webkitTransform!==`none`||`mixBlendMode`in t&&t.mixBlendMode!==`normal`||`filter`in t&&t.filter!==`none`||`webkitFilter`in t&&t.webkitFilter!==`none`||`isolation`in t&&t.isolation===`isolate`||Tr.test(t.willChange)||t.webkitOverflowScrolling===`touch`)}function Or(e){let t=e.length;for(;t--;){let n=e[t];if(P(n,`Missing node`),Dr(n))return n}return null}function kr(e){return e&&Number(getComputedStyle(e).zIndex)||0}function Ar(e){let t=[];for(;e;)t.push(e),e=jr(e);return t}function jr(e){let{parentNode:t}=e;return Cr(t)?t.host:t}function Mr(e,t){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function Nr({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!ur(n)||n.contains(e)||e.contains(n))return!0;if(wr(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(Mr(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function Pr(e,t){let n=[];return t.forEach((t,r)=>{if(r.disabled)return;let i=hr(r),a=Sr(r.orientation,i,{x:e.clientX,y:e.clientY});a&&a.distance.x<=0&&a.distance.y<=0&&Nr({groupElement:r.element,hitRegion:a.hitRegion.rect,pointerEventTarget:e.target})&&n.push(a.hitRegion)}),n}function Fr(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function R(e,t,n=0){return Math.abs(N(e)-N(t))<=n}function z(e,t){return R(e,t)?0:e>t?1:-1}function Ir({overrideDisabledPanels:e,panelConstraints:t,prevSize:n,size:r}){let{collapsedSize:i=0,collapsible:a,disabled:o,maxSize:s=100,minSize:c=0}=t;if(o&&!e)return n;if(z(r,c)<0)if(a){let e=(i+c)/2;r=z(r,e)<0?i:c}else r=c;return r=Math.min(s,r),r=N(r),r}function Lr({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:a}){if(R(e,0))return t;let o=a===`imperative-api`,s=Object.values(t),c=Object.values(i),l=[...s],[u,d]=r;P(u!=null,`Invalid first pivot index`),P(d!=null,`Invalid second pivot index`);let f=0;switch(a){case`keyboard`:{let t=e<0?d:u,r=n[t];P(r,`Panel constraints not found for index ${t}`);let{collapsedSize:i=0,collapsible:a,minSize:o=0}=r;if(a){let n=s[t];if(P(n!=null,`Previous layout not found for panel index ${t}`),R(n,i)){let t=o-n;z(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let t=e<0?u:d,r=n[t];P(r,`No panel constraints found for index ${t}`);let{collapsedSize:i=0,collapsible:a,minSize:o=0}=r;if(a){let n=s[t];if(P(n!=null,`Previous layout not found for panel index ${t}`),R(n,o)){let t=n-i;z(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}break;default:{let t=e<0?d:u,r=n[t];P(r,`Panel constraints not found for index ${t}`);let i=s[t],{collapsible:a,collapsedSize:o,minSize:c}=r;if(a&&z(i,c)<0)if(e>0){let t=c-o,n=t/2;z(i+e,c)<0&&(e=z(e,n)<=0?0:t)}else{let t=c-o,n=100-t/2;z(i-e,c)<0&&(e=z(100+e,n)>0?0:-t)}break}}{let t=e<0?1:-1,r=e<0?d:u,i=0;for(;;){let e=s[r];P(e!=null,`Previous layout not found for panel index ${r}`);let a=Ir({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:e,size:100})-e;if(i+=a,r+=t,r<0||r>=n.length)break}let a=Math.min(Math.abs(e),Math.abs(i));e=e<0?0-a:a}{let t=e<0?u:d;for(;t>=0&&t<n.length;){let r=Math.abs(e)-Math.abs(f),i=s[t];P(i!=null,`Previous layout not found for panel index ${t}`);let a=i-r,c=Ir({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:i,size:a});if(!R(i,c)&&(f+=i-c,l[t]=c,f.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?t--:t++}}if(Fr(c,l))return i;{let t=e<0?d:u,r=s[t];P(r!=null,`Previous layout not found for panel index ${t}`);let i=r+f,a=Ir({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:r,size:i});if(l[t]=a,!R(a,i)){let t=i-a,r=e<0?d:u;for(;r>=0&&r<n.length;){let i=l[r];P(i!=null,`Previous layout not found for panel index ${r}`);let a=i+t,s=Ir({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:i,size:a});if(R(i,s)||(t-=s-i,l[r]=s),R(t,0))break;e>0?r--:r++}}}if(!R(Object.values(l).reduce((e,t)=>t+e,0),100,.1))return i;let p=Object.keys(i);return l.reduce((e,t,n)=>(e[p[n]]=t,e),{})}function Rr(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(t[n]===void 0||z(e[n],t[n])!==0)return!1;return!0}function zr({layout:e,panelConstraints:t}){let n=Object.values(e),r=[...n],i=r.reduce((e,t)=>e+t,0);if(r.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${r.map(e=>`${e}%`).join(`, `)}`);if(!R(i,100)&&r.length>0)for(let e=0;e<t.length;e++){let t=r[e];P(t!=null,`No layout data found for index ${e}`),r[e]=100/i*t}let a=0;for(let e=0;e<t.length;e++){let i=n[e];P(i!=null,`No layout data found for index ${e}`);let o=r[e];P(o!=null,`No layout data found for index ${e}`);let s=Ir({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:i,size:o});o!=s&&(a+=o-s,r[e]=s)}if(!R(a,0))for(let e=0;e<t.length;e++){let n=r[e];P(n!=null,`No layout data found for index ${e}`);let i=n+a,o=Ir({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:n,size:i});if(n!==o&&(a-=o-n,r[e]=o,R(a,0)))break}let o=Object.keys(e);return r.reduce((e,t,n)=>(e[o[n]]=t,e),{})}function Br({groupId:e,panelId:t}){let n=()=>{let t=br();for(let[n,{defaultLayoutDeferred:r,derivedPanelConstraints:i,layout:a,groupSize:o,separatorToPanels:s}]of t)if(n.id===e)return{defaultLayoutDeferred:r,derivedPanelConstraints:i,group:n,groupSize:o,layout:a,separatorToPanels:s};throw Error(`Group ${e} not found`)},r=()=>{let e=n().derivedPanelConstraints.find(e=>e.panelId===t);if(e!==void 0)return e;throw Error(`Panel constraints not found for Panel ${t}`)},i=()=>{let e=n().group.panels.find(e=>e.id===t);if(e!==void 0)return e;throw Error(`Layout not found for Panel ${t}`)},a=()=>{let e=n().layout[t];if(e!==void 0)return e;throw Error(`Layout not found for Panel ${t}`)},o=e=>{let r=a();if(e===r)return;let{defaultLayoutDeferred:i,derivedPanelConstraints:o,group:s,groupSize:c,layout:l,separatorToPanels:u}=n(),d=s.panels.findIndex(e=>e.id===t),f=d===s.panels.length-1,p=zr({layout:Lr({delta:f?r-e:e-r,initialLayout:l,panelConstraints:o,pivotIndices:f?[d-1,d]:[d,d+1],prevLayout:l,trigger:`imperative-api`}),panelConstraints:o});Rr(l,p)||L(s,{defaultLayoutDeferred:i,derivedPanelConstraints:o,groupSize:c,layout:p,separatorToPanels:u})};return{collapse:()=>{let{collapsible:e,collapsedSize:t}=r(),{mutableValues:n}=i(),s=a();e&&s!==t&&(n.expandToSize=s,o(t))},expand:()=>{let{collapsible:e,collapsedSize:t,minSize:n}=r(),{mutableValues:s}=i(),c=a();if(e&&c===t){let e=s.expandToSize??n;e===0&&(e=1),o(e)}},getSize:()=>{let{group:e}=n(),t=a(),{element:r}=i();return{asPercentage:t,inPixels:e.orientation===`horizontal`?r.offsetWidth:r.offsetHeight}},isCollapsed:()=>{let{collapsible:e,collapsedSize:t}=r(),n=a();return e&&R(t,n)},resize:e=>{let{group:t}=n(),{element:r}=i(),a=ar({group:t});o(N(ir({groupSize:a,panelElement:r,styleProp:e})/a*100))}}}function Vr(e){e.defaultPrevented||Pr(e,br()).forEach(t=>{if(t.separator&&!t.separator.disableDoubleClick){let n=t.panels.find(e=>e.panelConstraints.defaultSize!==void 0);if(n){let r=n.panelConstraints.defaultSize,i=Br({groupId:t.group.id,panelId:n.id});i&&r!==void 0&&(i.resize(r),e.preventDefault())}}})}function Hr(e){let t=br();for(let[n]of t)if(n.separators.some(t=>t.element===e))return n;throw Error(`Could not find parent Group for separator element`)}function Ur({groupId:e}){let t=()=>{let t=br();for(let[n,r]of t)if(n.id===e)return{group:n,...r};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){let{defaultLayoutDeferred:e,layout:n}=t();return e?{}:n},setLayout(e){let{defaultLayoutDeferred:n,derivedPanelConstraints:r,group:i,groupSize:a,layout:o,separatorToPanels:s}=t(),c=zr({layout:e,panelConstraints:r});return n?o:(Rr(o,c)||L(i,{defaultLayoutDeferred:n,derivedPanelConstraints:r,groupSize:a,layout:c,separatorToPanels:s}),c)}}}function Wr(e,t){let n=Hr(e),r=I(n.id,!0),i=n.separators.find(t=>t.element===e);P(i,`Matching separator not found`);let a=r.separatorToPanels.get(i);P(a,`Matching panels not found`);let o=a.map(e=>n.panels.indexOf(e)),s=Ur({groupId:n.id}).getLayout(),c=zr({layout:Lr({delta:t,initialLayout:s,panelConstraints:r.derivedPanelConstraints,pivotIndices:o,prevLayout:s,trigger:`keyboard`}),panelConstraints:r.derivedPanelConstraints});Rr(s,c)||L(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:c,separatorToPanels:r.separatorToPanels})}function Gr(e){if(e.defaultPrevented)return;let t=e.currentTarget,n=Hr(t);if(!n.disabled)switch(e.key){case`ArrowDown`:e.preventDefault(),n.orientation===`vertical`&&Wr(t,5);break;case`ArrowLeft`:e.preventDefault(),n.orientation===`horizontal`&&Wr(t,-5);break;case`ArrowRight`:e.preventDefault(),n.orientation===`horizontal`&&Wr(t,5);break;case`ArrowUp`:e.preventDefault(),n.orientation===`vertical`&&Wr(t,-5);break;case`End`:e.preventDefault(),Wr(t,100);break;case`Enter`:{e.preventDefault();let n=Hr(t),{derivedPanelConstraints:r,layout:i,separatorToPanels:a}=I(n.id,!0),o=n.separators.find(e=>e.element===t);P(o,`Matching separator not found`);let s=a.get(o);P(s,`Matching panels not found`);let c=s[0],l=r.find(e=>e.panelId===c.id);if(P(l,`Panel metadata not found`),l.collapsible){let e=i[c.id];Wr(t,(l.collapsedSize===e?n.mutableState.expandedPanelSizes[c.id]??l.minSize:l.collapsedSize)-e)}break}case`F6`:{e.preventDefault();let n=Hr(t).separators.map(e=>e.element),r=Array.from(n).findIndex(t=>t===e.currentTarget);P(r!==null,`Index not found`),n[e.shiftKey?r>0?r-1:n.length-1:r+1<n.length?r+1:0].focus({preventScroll:!0});break}case`Home`:e.preventDefault(),Wr(t,-100);break}}var Kr={cursorFlags:0,state:`inactive`},qr=new gr;function Jr(){return Kr}function Yr(e){return qr.addListener(`change`,e)}function Xr(e){let t=Kr,n={...Kr};n.cursorFlags=e,Kr=n,qr.emit(`change`,{prev:t,next:n})}function Zr(e){let t=Kr;Kr=e,qr.emit(`change`,{prev:t,next:e})}function Qr(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=br(),n=Pr(e,t),r=new Map,i=!1;n.forEach(e=>{e.separator&&(i||(i=!0,e.separator.element.focus({preventScroll:!0})));let n=t.get(e.group);n&&r.set(e.group,n.layout)}),Zr({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:`active`}),n.length&&e.preventDefault()}var $r=e=>e,ei=()=>{},ti=1,ni=2,ri=4,ii=8,ai=3,oi=12,si;function ci(){return si===void 0&&(si=!1,typeof window<`u`&&(window.navigator.userAgent.includes(`Chrome`)||window.navigator.userAgent.includes(`Firefox`))&&(si=!0)),si}function li({cursorFlags:e,groups:t,state:n}){let r=0,i=0;switch(n){case`active`:case`hover`:t.forEach(e=>{if(!e.mutableState.disableCursor)switch(e.orientation){case`horizontal`:r++;break;case`vertical`:i++;break}})}if(!(r===0&&i===0)){switch(n){case`active`:if(e&&ci()){let t=(e&ti)!==0,n=(e&ni)!==0,r=(e&ri)!==0,i=(e&ii)!==0;if(t)return r?`se-resize`:i?`ne-resize`:`e-resize`;if(n)return r?`sw-resize`:i?`nw-resize`:`w-resize`;if(r)return`s-resize`;if(i)return`n-resize`}break}return ci()?r>0&&i>0?`move`:r>0?`ew-resize`:`ns-resize`:r>0&&i>0?`grab`:r>0?`col-resize`:`row-resize`}}var ui=new WeakMap;function di(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=ui.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&e.adoptedStyleSheets.push(n));let r=Jr();switch(r.state){case`active`:case`hover`:{let e=li({cursorFlags:r.cursorFlags,groups:r.hitRegions.map(e=>e.group),state:r.state}),i=`*, *:hover {cursor: ${e} !important; }`;if(t===i)return;t=i,e?n.cssRules.length===0?n.insertRule(i):n.replaceSync(i):n.cssRules.length===1&&n.deleteRule(0);break}case`inactive`:t=void 0,n.cssRules.length===1&&n.deleteRule(0);break}ui.set(e,{prevStyle:t,styleSheet:n})}function fi({document:e,event:t,hitRegions:n,initialLayoutMap:r,mountedGroups:i,pointerDownAtPoint:a,prevCursorFlags:o}){let s=0;n.forEach(e=>{let{group:n,groupSize:o}=e,{orientation:c,panels:l}=n,{disableCursor:u}=n.mutableState,d=0;d=a?c===`horizontal`?(t.clientX-a.x)/o*100:(t.clientY-a.y)/o*100:c===`horizontal`?t.clientX<0?-100:100:t.clientY<0?-100:100;let f=r.get(n),p=i.get(n);if(!f||!p)return;let{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:_,separatorToPanels:v}=p;if(h&&_&&v){let t=Lr({delta:d,initialLayout:f,panelConstraints:h,pivotIndices:e.panels.map(e=>l.indexOf(e)),prevLayout:_,trigger:`mouse-or-touch`});if(Rr(t,_)){if(d!==0&&!u)switch(c){case`horizontal`:s|=d<0?ti:ni;break;case`vertical`:s|=d<0?ri:ii;break}}else L(e.group,{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:t,separatorToPanels:v})}});let c=0;t.movementX===0?c|=o&ai:c|=s&ai,t.movementY===0?c|=o&oi:c|=s&oi,Xr(c),di(e)}function pi(e){let t=br(),n=Jr();switch(n.state){case`active`:fi({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}}function mi(e){if(e.defaultPrevented)return;let t=Jr(),n=br();switch(t.state){case`active`:if(e.buttons===0){Zr({cursorFlags:0,state:`inactive`}),t.hitRegions.forEach(e=>{let t=I(e.group.id,!0);L(e.group,t)});return}for(let n of t.hitRegions)if(n.separator){let{element:t}=n.separator;t.hasPointerCapture?.(e.pointerId)||t.setPointerCapture?.(e.pointerId)}fi({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break;default:{let r=Pr(e,n);r.length===0?t.state!==`inactive`&&Zr({cursorFlags:0,state:`inactive`}):Zr({cursorFlags:0,hitRegions:r,state:`hover`}),di(e.currentTarget);break}}}function hi(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(Jr().state){case`hover`:Zr({cursorFlags:0,state:`inactive`})}}function gi(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=Jr();switch(t.state){case`active`:Zr({cursorFlags:0,state:`inactive`}),t.hitRegions.length>0&&(di(e.currentTarget),t.hitRegions.forEach(e=>{let t=I(e.group.id,!0);L(e.group,t)}),e.preventDefault())}}function _i(e){let t=0,n=0,r={};for(let i of e)if(i.defaultSize!==void 0){t++;let e=N(i.defaultSize);n+=e,r[i.panelId]=e}else r[i.panelId]=void 0;let i=e.length-t;if(i!==0){let t=N((100-n)/i);for(let n of e)n.defaultSize===void 0&&(r[n.panelId]=t)}return r}function vi(e,t,n){if(!n[0])return;let r=e.panels.find(e=>e.element===t);if(!r||!r.onResize)return;let i=ar({group:e}),a=e.orientation===`horizontal`?r.element.offsetWidth:r.element.offsetHeight,o=r.mutableValues.prevSize,s={asPercentage:N(a/i*100),inPixels:a};r.mutableValues.prevSize=s,r.onResize(s,r.id,o)}function yi(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function bi({group:e,nextGroupSize:t,prevGroupSize:n,prevLayout:r}){if(n<=0||t<=0||n===t)return r;let i=0,a=0,o=!1,s=new Map,c=[];for(let l of e.panels){let e=r[l.id]??0;switch(l.panelConstraints.groupResizeBehavior){case`preserve-pixel-size`:{o=!0;let r=N(e/100*n/t*100);s.set(l.id,r),i+=r;break}default:c.push(l.id),a+=e;break}}if(!o||c.length===0)return r;let l=100-i,u={...r};if(s.forEach((e,t)=>{u[t]=e}),a>0)for(let e of c)u[e]=N((r[e]??0)/a*l);else{let e=N(l/c.length);for(let t of c)u[t]=e}return u}function xi(e,t){let n=e.map(e=>e.id),r=Object.keys(t);if(n.length!==r.length)return!1;for(let e of n)if(!r.includes(e))return!1;return!0}var Si=new Map;function Ci(e){let t=!0;P(e.element.ownerDocument.defaultView,`Cannot register an unmounted Group`);let n=e.element.ownerDocument.defaultView.ResizeObserver,r=new Set,i=new Set,a=new n(n=>{for(let r of n){let{borderBoxSize:n,target:i}=r;if(i===e.element){if(t){let t=ar({group:e});if(t===0)return;let n=I(e.id);if(!n)return;let r=or(e),i=n.defaultLayoutDeferred?_i(r):n.layout,a=zr({layout:bi({group:e,nextGroupSize:t,prevGroupSize:n.groupSize,prevLayout:i}),panelConstraints:r});if(!n.defaultLayoutDeferred&&Rr(n.layout,a)&&yi(n.derivedPanelConstraints,r)&&n.groupSize===t)return;L(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:r,groupSize:t,layout:a,separatorToPanels:n.separatorToPanels})}}else vi(e,i,n)}});a.observe(e.element),e.panels.forEach(e=>{P(!r.has(e.id),`Panel ids must be unique; id "${e.id}" was used more than once`),r.add(e.id),e.onResize&&a.observe(e.element)});let o=ar({group:e}),s=or(e),c=e.panels.map(({id:e})=>e).join(`,`),l=e.mutableState.defaultLayout;l&&(xi(e.panels,l)||(l=void 0));let u=zr({layout:e.mutableState.layouts[c]??l??_i(s),panelConstraints:s}),d=e.element.ownerDocument;Si.set(d,(Si.get(d)??0)+1);let f=new Map;return hr(e).forEach(e=>{e.separator&&f.set(e.separator,e.panels)}),L(e,{defaultLayoutDeferred:o===0,derivedPanelConstraints:s,groupSize:o,layout:u,separatorToPanels:f}),e.separators.forEach(e=>{P(!i.has(e.id),`Separator ids must be unique; id "${e.id}" was used more than once`),i.add(e.id),e.element.addEventListener(`keydown`,Gr)}),Si.get(d)===1&&(d.addEventListener(`dblclick`,Vr,!0),d.addEventListener(`pointerdown`,Qr,!0),d.addEventListener(`pointerleave`,pi),d.addEventListener(`pointermove`,mi),d.addEventListener(`pointerout`,hi),d.addEventListener(`pointerup`,gi,!0)),function(){t=!1,Si.set(d,Math.max(0,(Si.get(d)??0)-1)),vr(e),e.separators.forEach(e=>{e.element.removeEventListener(`keydown`,Gr)}),Si.get(d)||(d.removeEventListener(`dblclick`,Vr,!0),d.removeEventListener(`pointerdown`,Qr,!0),d.removeEventListener(`pointerleave`,pi),d.removeEventListener(`pointermove`,mi),d.removeEventListener(`pointerout`,hi),d.removeEventListener(`pointerup`,gi,!0)),a.disconnect()}}function wi(){let[e,t]=(0,D.useState)({});return[e,(0,D.useCallback)(()=>t({}),[])]}function Ti(e){let t=(0,D.useId)();return`${e??t}`}var Ei=typeof window<`u`?D.useLayoutEffect:D.useEffect;function Di(e){let t=(0,D.useRef)(e);return Ei(()=>{t.current=e},[e]),(0,D.useCallback)((...e)=>t.current?.(...e),[t])}function Oi(...e){return Di(t=>{e.forEach(e=>{if(e)switch(typeof e){case`function`:e(t);break;case`object`:e.current=t;break}})})}function ki(e){let t=(0,D.useRef)({...e});return Ei(()=>{for(let n in e)t.current[n]=e[n]},[e]),t.current}var Ai=(0,D.createContext)(null);function ji(e,t){let n=(0,D.useRef)({getLayout:()=>({}),setLayout:$r});(0,D.useImperativeHandle)(t,()=>n.current,[]),Ei(()=>{Object.assign(n.current,Ur({groupId:e}))})}function Mi({children:e,className:t,defaultLayout:n,disableCursor:r,disabled:i,elementRef:a,groupRef:o,id:s,onLayoutChange:c,onLayoutChanged:l,orientation:u=`horizontal`,resizeTargetMinimumSize:d={coarse:20,fine:10},style:f,...p}){let m=(0,D.useRef)({onLayoutChange:{},onLayoutChanged:{}}),h=Di(e=>{Rr(m.current.onLayoutChange,e)||(m.current.onLayoutChange=e,c?.(e))}),g=Di(e=>{Rr(m.current.onLayoutChanged,e)||(m.current.onLayoutChanged=e,l?.(e))}),_=Ti(s),v=(0,D.useRef)(null),[y,b]=wi(),x=(0,D.useRef)({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:d,separators:[]}),S=Oi(v,a);ji(_,o);let C=Di((e,t)=>{let r=Jr(),i=yr(e),a=I(e);if(a){let e=!1;switch(r.state){case`active`:e=r.hitRegions.some(e=>e.group===i);break}return{flexGrow:a.layout[t]??1,pointerEvents:e?`none`:void 0}}if(n?.[t])return{flexGrow:n?.[t]}}),w=ki({defaultLayout:n,disableCursor:r}),T=(0,D.useMemo)(()=>({get disableCursor(){return!!w.disableCursor},getPanelStyles:C,id:_,orientation:u,registerPanel:e=>{let t=x.current;return t.panels=sr(u,[...t.panels,e]),b(),()=>{t.panels=t.panels.filter(t=>t!==e),b()}},registerSeparator:e=>{let t=x.current;return t.separators=sr(u,[...t.separators,e]),b(),()=>{t.separators=t.separators.filter(t=>t!==e),b()}},updatePanelProps:(e,{disabled:t})=>{let n=x.current.panels.find(t=>t.id===e);n&&(n.panelConstraints.disabled=t);let r=yr(_),i=I(_);r&&i&&L(r,{...i,derivedPanelConstraints:or(r)})},updateSeparatorProps:(e,{disabled:t,disableDoubleClick:n})=>{let r=x.current.separators.find(t=>t.id===e);r&&(r.disabled=t,r.disableDoubleClick=n)}}),[C,_,b,u,w]),E=(0,D.useRef)(null);return Ei(()=>{let e=v.current;if(e===null)return;let t=x.current,n;if(w.defaultLayout!==void 0&&Object.keys(w.defaultLayout).length===t.panels.length){n={};for(let e of t.panels){let t=w.defaultLayout[e.id];t!==void 0&&(n[e.id]=t)}}let r={disabled:!!i,element:e,id:_,mutableState:{defaultLayout:n,disableCursor:!!w.disableCursor,expandedPanelSizes:x.current.lastExpandedPanelSizes,layouts:x.current.layouts},orientation:u,panels:t.panels,resizeTargetMinimumSize:t.resizeTargetMinimumSize,separators:t.separators};E.current=r;let a=Ci(r),{defaultLayoutDeferred:o,derivedPanelConstraints:s,layout:c}=I(r.id,!0);!o&&s.length>0&&(h(c),g(c));let l=xr(_,e=>{let{defaultLayoutDeferred:t,derivedPanelConstraints:n,layout:i}=e.next;if(t||n.length===0)return;let a=r.panels.map(({id:e})=>e).join(`,`);r.mutableState.layouts[a]=i,n.forEach(t=>{if(t.collapsible){let{layout:n}=e.prev??{};if(n){let e=R(t.collapsedSize,i[t.panelId]),a=R(t.collapsedSize,n[t.panelId]);e&&!a&&(r.mutableState.expandedPanelSizes[t.panelId]=n[t.panelId])}}});let o=Jr().state!==`active`;h(i),o&&g(i)});return()=>{E.current=null,a(),l()}},[i,_,g,h,u,y,w]),(0,D.useEffect)(()=>{let e=E.current;e&&(e.mutableState.defaultLayout=n,e.mutableState.disableCursor=!!r)}),(0,O.jsx)(Ai.Provider,{value:T,children:(0,O.jsx)(`div`,{...p,className:t,"data-group":!0,"data-testid":_,id:_,ref:S,style:{height:`100%`,width:`100%`,overflow:`hidden`,...f,display:`flex`,flexDirection:u===`horizontal`?`row`:`column`,flexWrap:`nowrap`,touchAction:u===`horizontal`?`pan-y`:`pan-x`},children:e})})}Mi.displayName=`Group`;function Ni(){let e=(0,D.useContext)(Ai);return P(e,`Group Context not found; did you render a Panel or Separator outside of a Group?`),e}function Pi(e,t){let{id:n}=Ni(),r=(0,D.useRef)({collapse:ei,expand:ei,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:ei});(0,D.useImperativeHandle)(t,()=>r.current,[]),Ei(()=>{Object.assign(r.current,Br({groupId:n,panelId:e}))})}function Fi({children:e,className:t,collapsedSize:n=`0%`,collapsible:r=!1,defaultSize:i,disabled:a,elementRef:o,groupResizeBehavior:s=`preserve-relative-size`,id:c,maxSize:l=`100%`,minSize:u=`0%`,onResize:d,panelRef:f,style:p,...m}){let h=!!c,g=Ti(c),_=ki({disabled:a}),v=(0,D.useRef)(null),y=Oi(v,o),{getPanelStyles:b,id:x,orientation:S,registerPanel:C,updatePanelProps:w}=Ni(),T=d!==null,E=Di((e,t,n)=>{d?.(e,c,n)});Ei(()=>{let e=v.current;if(e!==null)return C({element:e,id:g,idIsStable:h,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:T?E:void 0,panelConstraints:{groupResizeBehavior:s,collapsedSize:n,collapsible:r,defaultSize:i,disabled:_.disabled,maxSize:l,minSize:u}})},[s,n,r,i,T,g,h,l,u,E,C,_]),(0,D.useEffect)(()=>{w(g,{disabled:a})},[a,g,w]),Pi(g,f);let ee=()=>{let e=b(x,g);if(e)return JSON.stringify(e)},te=(0,D.useSyncExternalStore)(e=>xr(x,e),ee,ee),ne;return ne=te?JSON.parse(te):i?{flexGrow:void 0,flexShrink:void 0,flexBasis:i}:{flexGrow:1},(0,O.jsx)(`div`,{...m,"data-disabled":a||void 0,"data-panel":!0,"data-testid":g,id:g,ref:y,style:{...Ii,display:`flex`,flexBasis:0,flexShrink:1,overflow:`visible`,...ne},children:(0,O.jsx)(`div`,{className:t,style:{maxHeight:`100%`,maxWidth:`100%`,flexGrow:1,overflow:`auto`,...p,touchAction:S===`horizontal`?`pan-y`:`pan-x`},children:e})})}Fi.displayName=`Panel`;var Ii={minHeight:0,maxHeight:`100%`,height:`auto`,minWidth:0,maxWidth:`100%`,width:`auto`,border:`none`,borderWidth:0,padding:0,margin:0};function Li({layout:e,panelConstraints:t,panelId:n,panelIndex:r}){let i,a,o=e[n],s=t.find(e=>e.panelId===n);if(s){let c=s.maxSize,l=s.collapsible?s.collapsedSize:s.minSize,u=[r,r+1];a=zr({layout:Lr({delta:l-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n],i=zr({layout:Lr({delta:c-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:a,valueNow:o}}function Ri({children:e,className:t,disabled:n,disableDoubleClick:r,elementRef:i,id:a,style:o,...s}){let c=Ti(a),l=ki({disabled:n,disableDoubleClick:r}),[u,d]=(0,D.useState)({}),[f,p]=(0,D.useState)(`inactive`),[m,h]=(0,D.useState)(!1),g=(0,D.useRef)(null),_=Oi(g,i),{disableCursor:v,id:y,orientation:b,registerSeparator:x,updateSeparatorProps:S}=Ni(),C=b===`horizontal`?`vertical`:`horizontal`;Ei(()=>{let e=g.current;if(e!==null){let t={disabled:l.disabled,disableDoubleClick:l.disableDoubleClick,element:e,id:c},n=x(t),r=Yr(e=>{p(e.next.state!==`inactive`&&e.next.hitRegions.some(e=>e.separator===t)?e.next.state:`inactive`)}),i=xr(y,e=>{let{derivedPanelConstraints:n,layout:r,separatorToPanels:i}=e.next,a=i.get(t);if(a){let e=a[0],t=a.indexOf(e);d(Li({layout:r,panelConstraints:n,panelId:e.id,panelIndex:t}))}});return()=>{r(),i(),n()}}},[y,c,x,l]),(0,D.useEffect)(()=>{S(c,{disabled:n,disableDoubleClick:r})},[n,r,c,S]);let w;n&&!v&&(w=`not-allowed`);let T;if(n)T=`disabled`;else switch(f){case`active`:T=`active`;break;default:T=m?`focus`:f}return(0,O.jsx)(`div`,{...s,"aria-controls":u.valueControls,"aria-disabled":n||void 0,"aria-orientation":C,"aria-valuemax":u.valueMax,"aria-valuemin":u.valueMin,"aria-valuenow":u.valueNow,children:e,className:t,"data-separator":T,"data-testid":c,id:c,onBlur:()=>h(!1),onFocus:()=>h(!0),ref:_,role:`separator`,style:{flexBasis:`auto`,cursor:w,...o,flexGrow:0,flexShrink:0,touchAction:`none`},tabIndex:n?void 0:0})}Ri.displayName=`Separator`;function zi(e,t,n=.25){let{width:r,height:i}=e,{x:a,y:o}=t;if(!(r>0)||!(i>0)||!Number.isFinite(r)||!Number.isFinite(i)||!Number.isFinite(a)||!Number.isFinite(o))return`center`;let s=Number.isFinite(n)?Math.max(0,Math.min(.5,n)):.25,c=a<0?a:a>r?a-r:0,l=o<0?o:o>i?o-i:0;if(c!==0||l!==0){let e=Math.abs(c);return e>=Math.abs(l)&&e>0?c<0?`left`:`right`:l<0?`top`:`bottom`}let u=s*Math.min(r,i),d=a<u,f=a>r-u,p=o<u,m=o>i-u,h=d||f,g=p||m;return!h&&!g?`center`:h&&!g?d?`left`:`right`:g&&!h?p?`top`:`bottom`:(d?a/r:(r-a)/r)<=(p?o/i:(i-o)/i)?d?`left`:`right`:p?`top`:`bottom`}function Bi(e,t,n){if(e===`center`)return{kind:`move`,panelId:t,destGroupId:n.groupId};let r=e===`left`||e===`right`?`row`:`column`,i=e===`left`||e===`top`?`before`:`after`;return{kind:`split`,atPanelId:n.panelId,dir:r,side:i,newPanelId:t}}function Vi(e,t,n,r){return e===n.panelId||r===`center`&&t!==void 0&&t===n.groupId}function Hi(e,t){if(!Number.isFinite(t))return 0;let n=0;for(let r of e)if(t>=r.left+r.width/2)n+=1;else break;return n}var Ui=`application/x-deck-panel`,Wi=null,Gi=(0,D.createContext)(0);function Ki(){return(0,D.useContext)(Gi)}function qi(e){let t=e.reduce((e,t)=>e+(t>0?t:0),0);if(t<=0){let t=e.length>0?100/e.length:100;return e.map(()=>t)}return e.map(e=>(e>0?e:0)/t*100)}function Ji(e,t){let n=e.map((e,t)=>t).filter(e=>(t?.[e]??null)===null),r=qi(n.map(t=>e[t]??0)),i=new Map;return n.forEach((e,t)=>{i.set(e,r[t])}),i}function Yi(e){let{model:t,registry:n,renderDomPanel:r,bindNativeSlot:i,suppressReorderOnlyDropIndicator:a}=e,[o,s]=(0,D.useState)(()=>t.get()),[c,l]=(0,D.useState)(0);(0,D.useEffect)(()=>(s(t.get()),t.subscribe(e=>{s(e.tree),l(e.revision)})),[t]);let u=(0,D.useCallback)((e,n)=>{t.apply(t=>on(t,e,n))},[t]),d=(0,D.useCallback)(e=>{t.apply(t=>mn(t,e,n))},[t,n]),f=Qi(o.root)>1,p=(0,D.useCallback)(e=>Xi(o.root,e)!==void 0,[o]),m=(0,D.useCallback)((e,n)=>{t.apply(t=>rn(t,e,n))},[t]),h=(0,D.useCallback)((e,r,i,a,o)=>{let s={groupId:e,panelId:r},c=Xi(t.get().root,i);if(n.get(i)?.draggable===!1||n.get(r)?.draggable===!1)return;if(n.get(i)?.dropPolicy===`reorder-only`){if(c===void 0||c!==e||a!==`center`)return;let n=Zi(t.get().root,e),s=o??(n?n.panels.indexOf(r):void 0);t.apply(t=>fn(t,i,{groupId:e,index:s}));return}if(Vi(i,c,s,a))return;let l=Bi(a,i,s);if(l.kind===`move`){t.apply(e=>fn(e,l.panelId,{groupId:l.destGroupId}));return}t.apply(e=>{let{tree:t}=ln(e,l.newPanelId);return Xi(t.root,l.atPanelId)===void 0?e:M(t,l.atPanelId,l.dir,l.newPanelId,l.side)})},[t,n]);return(0,O.jsx)(Gi.Provider,{value:c,children:$i(o.root,{registry:n,renderDomPanel:r,bindNativeSlot:i,onActivate:u,onApplyLayout:m,onRedock:h,onClose:d,canClose:f,isPanelInTree:p,suppressReorderOnlyDropIndicator:a??!1})})}function Xi(e,t){if(e.kind===`tabs`)return e.panels.includes(t)?e.id:void 0;for(let n of e.children){let e=Xi(n,t);if(e!==void 0)return e}}function Zi(e,t){if(e.kind===`tabs`)return e.id===t?e:void 0;for(let n of e.children){let e=Zi(n,t);if(e!==void 0)return e}}function Qi(e){return e.kind===`tabs`?e.panels.length:e.children.reduce((e,t)=>e+Qi(t),0)}function $i(e,t){return e.kind===`split`?ea(e,t):ua(e,t)}function ea(e,t){return(0,O.jsx)(ca,{node:e,ctx:t},e.id)}var ta=.5,na=.1;function ra(e){return Math.min(1,Math.max(.5,Math.floor(90/Math.max(1,e))))}function ia(e,t){let n=e.filter((e,n)=>(t?.[n]??null)===null).length,r=ra(n);return e.map((e,n)=>(t?.[n]??null)===null?Number.isFinite(e)&&e>=r?e:r:e)}function aa(e,t,n,r=ta){let i=new Set(n);for(let t of Object.keys(e))if(!i.has(t))return!1;for(let e of Object.keys(t))if(!i.has(e))return!1;for(let i of n){let n=e[i],a=t[i];if(!Number.isFinite(n)||!Number.isFinite(a)||Math.abs(n-a)>r)return!1}return!0}function oa(e,t,n,r){let i=e=>(n?.[e]??null)!==null,a=0;for(let t=0;t<e.length;t++){if(!i(t))continue;let n=r[e[t]];if(typeof n!=`number`)return null;a+=n}let o=Math.max(0,100-a),s=0;for(let n=0;n<e.length;n++){if(i(n))continue;let e=t[n]??0;s+=e>0?e:0}let c=e.length-e.filter((e,t)=>i(t)).length,l={};for(let n=0;n<e.length;n++){let a=e[n];if(i(n)){l[a]=r[a];continue}if(s<=0){l[a]=c>0?o/c:o;continue}let u=t[n]??0;l[a]=o*(u>0?u:0)/s}return l}function sa(e,t,n){let r=[],i=[];for(let a=0;a<e.length;a++){if((t?.[a]??null)!==null)continue;let o=n[e[a]];if(typeof o!=`number`||!Number.isFinite(o))return null;r.push(a),i.push(o>0?o:0)}return r.length===0?null:{indices:r,ratios:qi(i)}}function ca(e){let{node:t,ctx:n}=e,r=t.orientation===`row`?`horizontal`:`vertical`,i=Ji(t.sizes,t.constraints),a=t.children.filter((e,n)=>(t.constraints?.[n]??null)===null).length,o=String(ra(a)),s=(0,D.useRef)(null),c=(0,D.useRef)(t);c.current=t;let l=[];t.children.forEach((e,r)=>{r>0&&l.push((0,O.jsx)(Ri,{"data-deck-resize-handle":``},`handle-${r}`));let a=t.constraints?.[r]??null;if(a?.fixedPx!=null){let t=`${a.fixedPx}px`;l.push((0,O.jsx)(Fi,{id:e.id,defaultSize:t,minSize:t,maxSize:t,groupResizeBehavior:`preserve-pixel-size`,children:$i(e,n)},la(e)))}else if(a?.minPx!=null){let t=`${a.minPx}px`;l.push((0,O.jsx)(Fi,{id:e.id,defaultSize:t,minSize:t,groupResizeBehavior:`preserve-pixel-size`,children:$i(e,n)},la(e)))}else{let t=i.get(r);l.push((0,O.jsx)(Fi,{id:e.id,defaultSize:t==null?void 0:String(t),minSize:o,children:$i(e,n)},la(e)))}});let u=e=>{let t=c.current,r=t.children.map(e=>e.id),i=e=>(t.constraints?.[e]??null)!==null,a=sa(r,t.constraints,e);if(!a)return;let o=Ji(t.sizes,t.constraints),s=a.indices.map(e=>o.get(e)??0);if(!a.ratios.some((e,t)=>Math.abs(e-s[t])>na))return;let l=r.map((n,r)=>i(r)?t.sizes[r]??1:e[n]);n.onApplyLayout(t.id,ia(l,t.constraints))},d=e=>{e&&(e.__deckApplyLayout=e=>{let t=c.current,r=e=>(t.constraints?.[e]??null)!==null,i=e.map((e,n)=>r(n)?t.sizes[n]??1:e);n.onApplyLayout(t.id,ia(i,t.constraints))},Object.defineProperty(e,`__deckGroupApi`,{configurable:!0,get:()=>s.current??void 0}))},f=(0,D.useCallback)(()=>{let e=s.current;if(!e)return!1;let t=c.current,n=t.children.map(e=>e.id),r=e.getLayout(),i=oa(n,t.sizes,t.constraints,r);return!i||aa(r,i,n)?!1:(e.setLayout(i),!0)},[]),p=t.sizes.join(`,`),m=t.children.length;return(0,D.useEffect)(()=>{f()},[p,m,f]),(0,O.jsx)(`div`,{ref:d,"data-deck-split":t.id,"data-orientation":t.orientation,"data-deck-sizes":t.sizes.join(`,`),style:{width:`100%`,height:`100%`},children:(0,O.jsx)(Mi,{groupRef:s,orientation:r,onLayoutChanged:u,style:{width:`100%`,height:`100%`},children:l},t.children.length)})}function la(e){return e.id}function ua(e,t){return(0,O.jsx)(da,{node:e,ctx:t},e.id)}function da(e){let{node:t,ctx:n}=e,[r,i]=(0,D.useState)(null),a=(0,D.useRef)(t);a.current=t;let o=(0,D.useRef)(n.onRedock);o.current=n.onRedock;let s=e=>{e&&(e.__deckHandleDrop=(e,t)=>{let n=a.current;o.current(n.id,n.active,e,t)})},c=e=>{if(e.preventDefault(),n.suppressReorderOnlyDropIndicator&&Wi!==null&&n.registry.get(Wi)?.dropPolicy===`reorder-only`){i(null);return}let t=e.currentTarget.getBoundingClientRect();i(zi({width:t.width,height:t.height},{x:e.clientX-t.left,y:e.clientY-t.top}))},l=()=>{i(null)},u=e=>{e.preventDefault();let r=e.currentTarget.getBoundingClientRect(),a=zi({width:r.width,height:r.height},{x:e.clientX-r.left,y:e.clientY-r.top});i(null);let o=e.dataTransfer.getData(Ui)||e.dataTransfer.getData(`text/plain`);if(!o||n.registry.get(o)===void 0||!n.isPanelInTree(o))return;let s=Hi(Array.from(e.currentTarget.querySelectorAll(`[data-deck-tab]`)).map(e=>{let t=e.getBoundingClientRect();return{left:t.left,width:t.width}}),e.clientX);n.onRedock(t.id,t.active,o,a,s)},d=e=>{e.dataTransfer.types.includes(Ui)&&(e.preventDefault(),e.stopPropagation(),i(null))},f=e=>{e.preventDefault(),e.stopPropagation(),i(null);let r=e.dataTransfer.getData(Ui)||e.dataTransfer.getData(`text/plain`);if(!r||n.registry.get(r)===void 0||!n.isPanelInTree(r))return;let a=Hi(Array.from(e.currentTarget.querySelectorAll(`[data-deck-tab]`)).map(e=>{let t=e.getBoundingClientRect();return{left:t.left,width:t.width}}),e.clientX);n.onRedock(t.id,t.active,r,`center`,a)},p=t.panels.filter(e=>!n.registry.get(e)?.hideTab);return(0,O.jsxs)(`div`,{ref:s,"data-deck-group":t.id,onDragOver:c,onDragLeave:l,onDrop:u,style:{position:`relative`,display:`flex`,flexDirection:`column`,width:`100%`,height:`100%`,minWidth:0,minHeight:0},children:[p.length>0?(0,O.jsx)(`div`,{role:`tablist`,style:{flexShrink:0},onDragOver:d,onDrop:f,children:p.map(e=>{let r=e===t.active,i=n.registry.get(e),a=i?.title??e;return(0,O.jsxs)(`button`,{type:`button`,role:`tab`,draggable:i?.draggable===!1?void 0:`true`,"data-deck-tab":e,"data-active":r?`true`:`false`,onDragStart:t=>{if(t.target instanceof Element&&t.target.closest(`[data-deck-tab-close]`)!==null){t.preventDefault();return}t.dataTransfer.setData(Ui,e),t.dataTransfer.setData(`text/plain`,e),t.dataTransfer.effectAllowed=`move`,Wi=e},onDragEnd:()=>{Wi=null},onClick:()=>{r||n.onActivate(t.id,e)},children:[a,n.canClose&&i?.closable!==!1?(0,O.jsx)(`span`,{role:`button`,tabIndex:0,"data-deck-tab-close":e,"aria-label":`Close ${a}`,onPointerDown:e=>e.stopPropagation(),onClick:t=>{t.stopPropagation(),t.preventDefault(),n.onClose(e)},onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.stopPropagation(),t.preventDefault(),n.onClose(e))},children:`×`}):null]},e)})}):null,ma(t,n),r?(0,O.jsx)(pa,{zone:r}):null]})}function fa(e){let t={position:`absolute`,pointerEvents:`none`,background:`rgba(64, 128, 255, 0.25)`,outline:`2px solid rgba(64, 128, 255, 0.6)`};switch(e){case`left`:return{...t,left:`0`,top:`0`,width:`50%`,height:`100%`};case`right`:return{...t,right:`0`,top:`0`,width:`50%`,height:`100%`};case`top`:return{...t,left:`0`,top:`0`,width:`100%`,height:`50%`};case`bottom`:return{...t,left:`0`,bottom:`0`,width:`100%`,height:`50%`};default:return{...t,left:`0`,top:`0`,width:`100%`,height:`100%`}}}function pa(e){return(0,O.jsx)(`div`,{"data-deck-drop-zone":e.zone,style:fa(e.zone)})}function ma(e,t){let n=e.active;return n?(0,O.jsxs)(D.Fragment,{children:[t.registry.get(n)?.kind===`native`?(0,O.jsx)(ha,{panelId:n,bindNativeSlot:t.bindNativeSlot},n):null,e.panels.filter(e=>t.registry.get(e)?.kind!==`native`).map(e=>{let r=e===n;return(0,O.jsx)(`div`,{"data-deck-panel-body":e,style:{display:r?`flex`:`none`,flexDirection:`column`,flex:1,minWidth:0,minHeight:0},children:t.renderDomPanel(e,{active:r})},`dom-${e}`)})]}):null}function ha(e){let{panelId:t,bindNativeSlot:n}=e,r=(0,D.useRef)(n);return r.current=n,(0,O.jsx)(`div`,{ref:(0,D.useCallback)(e=>{r.current(t,e)},[t]),"data-deck-native-slot":t,style:{flex:1,minWidth:0,minHeight:0,height:`100%`}})}function ga({device:e,zoom:t,onDeviceChange:n,onZoomChange:r,compileStatus:i,currentPage:a,copied:o,onCopyPagePath:s}){let c=(0,D.useRef)(t),l=(0,D.useRef)(null),u=(0,D.useCallback)(e=>{e.visible?ee({x:e.bounds.x,y:e.bounds.y,width:e.bounds.width,height:e.bounds.height,zoom:c.current}):ee({x:0,y:0,width:0,height:0,zoom:c.current})},[]),d=(0,D.useCallback)(e=>{let t=l.current;if(t){e?(t.dispose(),l.current=Zn(e,{visible:!0,followGeometry:!0,guardDisplayNone:!0,publish:u})):(t.update({visible:!1,publish:u}),t.dispose(),l.current=null);return}e&&(l.current=Zn(e,{visible:!0,followGeometry:!0,guardDisplayNone:!0,publish:u}))},[u]);return(0,D.useLayoutEffect)(()=>{c.current=t}),(0,D.useLayoutEffect)(()=>{l.current?.update({visible:!0,publish:u})},[t,u]),(0,D.useEffect)(()=>{l.current?.pulse(300)},[Ki()]),(0,D.useEffect)(()=>()=>{l.current?.dispose(),l.current=null},[]),(0,O.jsxs)(`div`,{className:`bg-sim-bg flex flex-col overflow-hidden h-full w-full`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-2 px-5 py-2 shrink-0 border-b border-border-subtle`,children:[(0,O.jsx)(ce,{value:e.name,onChange:n,children:ue.map(e=>(0,O.jsx)(`option`,{value:e.name,children:e.name},e.name))}),(0,O.jsx)(ce,{value:t,onChange:r,className:`max-w-16`,children:de.map(e=>(0,O.jsxs)(`option`,{value:e,children:[e,`%`]},e))})]}),(0,O.jsxs)(`div`,{ref:d,className:`flex-1 min-h-0 bg-sim-bg relative`,"data-area":`native-simulator`,children:[i.status===`compiling`&&(0,O.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center bg-black/50 z-10`,children:(0,O.jsx)(`div`,{className:`text-text-dim text-[13px]`,children:`正在编译中...`})}),i.status===`error`&&(0,O.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center bg-black/70 z-10`,children:(0,O.jsxs)(`div`,{className:`text-center p-4`,children:[(0,O.jsx)(`div`,{className:`text-status-error text-[14px] font-medium mb-2`,children:`编译失败`}),(0,O.jsx)(`div`,{className:`text-status-error text-[11px] max-w-[280px] break-words`,children:i.message})]})})]}),(0,O.jsx)(`div`,{className:`flex items-center px-2.5 bg-sim-bottom border-t border-border-subtle shrink-0 h-[30px] min-w-0`,children:(0,O.jsxs)(`div`,{className:`flex items-center gap-1 min-w-0`,children:[(0,O.jsx)(`span`,{className:`text-[11px] text-text-dim truncate min-w-0`,children:a||`—`}),a&&(0,O.jsx)(`button`,{className:_(`shrink-0 flex items-center justify-center w-4 h-4 rounded transition-colors`,o?`text-accent`:`text-text-dim hover:text-text`),onClick:s,title:`复制路径`,children:o?(0,O.jsx)(`svg`,{width:`10`,height:`10`,viewBox:`0 0 10 10`,fill:`none`,children:(0,O.jsx)(`polyline`,{points:`1.5,5 4,7.5 8.5,2.5`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`})}):(0,O.jsxs)(`svg`,{width:`10`,height:`10`,viewBox:`0 0 10 10`,fill:`none`,children:[(0,O.jsx)(`rect`,{x:`1`,y:`3`,width:`6`,height:`6.5`,rx:`1`,stroke:`currentColor`,strokeWidth:`1`}),(0,O.jsx)(`path`,{d:`M3 3V2a1 1 0 011-1h4a1 1 0 011 1v5a1 1 0 01-1 1H7`,stroke:`currentColor`,strokeWidth:`1`})]})})]})})]})}function _a(){let e=(0,D.useRef)(null),t=(0,D.useCallback)(e=>{e.visible?oe({x:e.bounds.x,y:e.bounds.y,width:e.bounds.width,height:e.bounds.height}):oe({x:0,y:0,width:0,height:0})},[]),n=(0,D.useCallback)(n=>{let r=e.current;if(r){n?(r.dispose(),e.current=Zn(n,{visible:!0,guardDisplayNone:!0,followScroll:!0,followGeometry:!0,publish:t})):(r.update({visible:!1,publish:t}),r.dispose(),e.current=null);return}n&&(e.current=Zn(n,{visible:!0,guardDisplayNone:!0,followScroll:!0,followGeometry:!0,publish:t}))},[t]);return(0,D.useEffect)(()=>{e.current?.pulse(300)},[Ki()]),(0,D.useEffect)(()=>()=>{e.current?.dispose(),e.current=null},[]),(0,O.jsx)(`div`,{ref:n,className:`h-full w-full`,"data-area":`editor`})}function va(e){return!!(e.tagName===`#shadow-root`||e.tagName.includes(`/`))}function ya({node:e,depth:t,inspectedSid:n,onInspect:r}){let[i,a]=(0,D.useState)(()=>va(e)),o=t*16,s=!!(e.sid&&e.sid===n),c=`py-px leading-[18px] hover:bg-surface-2${s?` bg-surface-2`:``}`,l=()=>{e.sid&&r?.(e)};if(e.tagName===`#text`)return(0,O.jsxs)(`div`,{className:`py-px leading-[18px] hover:bg-surface-2`,style:{paddingLeft:o},children:[(0,O.jsx)(`span`,{className:`w-3 inline-block`}),(0,O.jsx)(`span`,{className:`text-text`,children:e.text})]});if(e.tagName===`#fragment`)return(0,O.jsx)(O.Fragment,{children:(e.children??[]).map((e,i)=>(0,O.jsx)(ya,{node:e,depth:t,inspectedSid:n,onInspect:r},i))});if(e.tagName===`#shadow-root`){let s=(e.children??[]).length>0;return(0,O.jsxs)(`div`,{children:[(0,O.jsxs)(`div`,{className:`py-px leading-[18px] hover:bg-surface-2 cursor-pointer`,style:{paddingLeft:o},onClick:()=>s&&a(!i),children:[(0,O.jsx)(`span`,{className:`text-text-dim w-3 shrink-0 inline-block text-center select-none`,children:s?i?`▾`:`▸`:` `}),(0,O.jsx)(`span`,{className:`text-text-dim italic`,children:`#shadow-root`})]}),i&&e.children.map((e,i)=>(0,O.jsx)(ya,{node:e,depth:t+1,inspectedSid:n,onInspect:r},i))]})}let u=(e.children??[]).length>0,d=Object.entries(e.attrs),f=u&&e.children.length===1&&e.children[0].tagName===`#text`?e.children[0].text:null;return f?(0,O.jsxs)(`div`,{className:c,style:{paddingLeft:o},onMouseEnter:l,"data-wxml-sid":e.sid,children:[(0,O.jsx)(`span`,{className:`w-3 inline-block`}),(0,O.jsxs)(`span`,{className:`text-code-keyword`,children:[`<`,e.tagName]}),d.map(([e,t])=>(0,O.jsxs)(`span`,{children:[` `,(0,O.jsx)(`span`,{className:`text-code-blue`,children:e}),(0,O.jsx)(`span`,{className:`text-text-dim`,children:`=`}),(0,O.jsxs)(`span`,{className:`text-code-orange`,children:[`"`,t,`"`]})]},e)),(0,O.jsx)(`span`,{className:`text-code-keyword`,children:`>`}),(0,O.jsx)(`span`,{className:`text-text`,children:f}),(0,O.jsxs)(`span`,{className:`text-code-keyword`,children:[`</`,e.tagName,`>`]})]}):(0,O.jsxs)(`div`,{children:[(0,O.jsxs)(`div`,{className:`flex items-start hover:bg-surface-2 py-px leading-[18px]${u?` cursor-pointer`:``}${s?` bg-surface-2`:``}`,style:{paddingLeft:o},onMouseEnter:l,onClick:()=>{u&&a(!i)},"data-wxml-sid":e.sid,children:[(0,O.jsx)(`span`,{className:`text-text-dim w-3 shrink-0 text-center select-none`,children:u?i?`▾`:`▸`:` `}),(0,O.jsxs)(`span`,{children:[(0,O.jsxs)(`span`,{className:`text-code-keyword`,children:[`<`,e.tagName]}),d.map(([e,t])=>(0,O.jsxs)(`span`,{children:[` `,(0,O.jsx)(`span`,{className:`text-code-blue`,children:e}),(0,O.jsx)(`span`,{className:`text-text-dim`,children:`=`}),(0,O.jsxs)(`span`,{className:`text-code-orange`,children:[`"`,t,`"`]})]},e)),(0,O.jsx)(`span`,{className:`text-code-keyword`,children:u?`>`:` />`})]})]}),i&&u&&(0,O.jsxs)(O.Fragment,{children:[e.children.map((e,i)=>(0,O.jsx)(ya,{node:e,depth:t+1,inspectedSid:n,onInspect:r},i)),(0,O.jsxs)(`div`,{style:{paddingLeft:o},className:`py-px leading-[18px]`,children:[(0,O.jsx)(`span`,{className:`w-3 inline-block`}),(0,O.jsxs)(`span`,{className:`text-code-keyword`,children:[`</`,e.tagName,`>`]})]})]})]})}function ba({inspection:e}){if(!e)return null;let{rect:t,style:n}=e,r=[n.display,n.position===`static`?null:n.position,n.boxSizing].filter(Boolean);return(0,O.jsxs)(`div`,{className:`border-t border-border-subtle bg-bg-panel px-2.5 py-1.5 font-mono text-[11px] text-text-dim shrink-0`,children:[(0,O.jsx)(`span`,{className:`text-text`,children:`box`}),` `,Math.round(t.width),` x `,Math.round(t.height),` @ `,Math.round(t.x),`, `,Math.round(t.y),(0,O.jsx)(`span`,{className:`mx-2 text-border-subtle`,children:`|`}),r.join(` / `),(0,O.jsx)(`span`,{className:`mx-2 text-border-subtle`,children:`|`}),`font `,n.fontSize]})}function xa({tree:e,onRefresh:t,onInspectElement:n,onClearInspection:r}){let[i,a]=(0,D.useState)(null),o=(0,D.useRef)(0),s=(0,D.useRef)(null);(0,D.useEffect)(()=>()=>{s.current!==null&&cancelAnimationFrame(s.current)},[]);let c=(0,D.useCallback)(e=>{if(!e.sid||!n)return;let t=e.sid;s.current!==null&&cancelAnimationFrame(s.current),s.current=requestAnimationFrame(()=>{s.current=null;let e=++o.current;n(t).then(t=>{e===o.current&&a(t)}).catch(()=>{e===o.current&&a(null)})})},[n]),l=(0,D.useCallback)(()=>{s.current!==null&&(cancelAnimationFrame(s.current),s.current=null),o.current++,a(null),r?.()},[r]);return e?(0,O.jsxs)(`div`,{className:`flex flex-col flex-1 overflow-hidden`,onMouseLeave:l,"data-testid":`wxml-panel`,children:[(0,O.jsx)(`div`,{className:`flex items-center px-2.5 py-1.5 border-b border-border-subtle shrink-0 bg-bg-panel`,children:(0,O.jsx)(S,{variant:`outline`,size:`xs`,onClick:t,className:`hover:border-accent hover:text-accent`,children:`↻ 刷新`})}),(0,O.jsx)(`div`,{className:`flex-1 overflow-y-auto p-2 font-mono text-[12px]`,children:(0,O.jsx)(ya,{node:e,depth:0,inspectedSid:i?.sid??null,onInspect:c})}),(0,O.jsx)(ba,{inspection:i})]}):(0,O.jsxs)(`div`,{className:`flex flex-col flex-1 overflow-hidden`,"data-testid":`wxml-panel`,children:[(0,O.jsx)(`div`,{className:`flex items-center px-2.5 py-1.5 border-b border-border-subtle shrink-0 bg-bg-panel`,children:(0,O.jsx)(S,{variant:`outline`,size:`xs`,onClick:t,className:`hover:border-accent hover:text-accent`,children:`↻ 刷新`})}),(0,O.jsx)(`div`,{className:`text-[12px] text-text-dim text-center px-4 py-6`,children:`等待小程序加载...`})]})}function B(){return B=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},B.apply(null,arguments)}function V(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var Sa={},Ca=(0,D.createContext)(Sa),wa=(e,t)=>B({},e,t),Ta=()=>(0,D.useContext)(Ca),Ea=(0,D.createContext)(()=>{});Ea.displayName=`JVR.DispatchShowTools`;function Da(){return(0,D.useReducer)(wa,Sa)}function Oa(){return(0,D.useContext)(Ea)}var ka=e=>{var{initial:t,dispatch:n,children:r}=e;return(0,O.jsx)(Ca.Provider,{value:t,children:(0,O.jsx)(Ea.Provider,{value:n,children:r})})};ka.displayName=`JVR.ShowTools`;var Aa={},ja=(0,D.createContext)(Aa),Ma=(e,t)=>B({},e,t),Na=()=>(0,D.useContext)(ja),Pa=(0,D.createContext)(()=>{});Pa.displayName=`JVR.DispatchExpands`;function Fa(){return(0,D.useReducer)(Ma,Aa)}function Ia(){return(0,D.useContext)(Pa)}var La=e=>{var{initial:t,dispatch:n,children:r}=e;return(0,O.jsx)(ja.Provider,{value:t,children:(0,O.jsx)(Pa.Provider,{value:n,children:r})})};La.displayName=`JVR.Expands`;var Ra={Str:{as:`span`,"data-type":`string`,style:{color:`var(--w-rjv-type-string-color, #cb4b16)`},className:`w-rjv-type`,children:`string`},Url:{as:`a`,style:{color:`var(--w-rjv-type-url-color, #0969da)`},"data-type":`url`,className:`w-rjv-type`,children:`url`},Undefined:{style:{color:`var(--w-rjv-type-undefined-color, #586e75)`},as:`span`,"data-type":`undefined`,className:`w-rjv-type`,children:`undefined`},Null:{style:{color:`var(--w-rjv-type-null-color, #d33682)`},as:`span`,"data-type":`null`,className:`w-rjv-type`,children:`null`},Map:{style:{color:`var(--w-rjv-type-map-color, #268bd2)`,marginRight:3},as:`span`,"data-type":`map`,className:`w-rjv-type`,children:`Map`},Nan:{style:{color:`var(--w-rjv-type-nan-color, #859900)`},as:`span`,"data-type":`nan`,className:`w-rjv-type`,children:`NaN`},Bigint:{style:{color:`var(--w-rjv-type-bigint-color, #268bd2)`},as:`span`,"data-type":`bigint`,className:`w-rjv-type`,children:`bigint`},Int:{style:{color:`var(--w-rjv-type-int-color, #268bd2)`},as:`span`,"data-type":`int`,className:`w-rjv-type`,children:`int`},Set:{style:{color:`var(--w-rjv-type-set-color, #268bd2)`,marginRight:3},as:`span`,"data-type":`set`,className:`w-rjv-type`,children:`Set`},Float:{style:{color:`var(--w-rjv-type-float-color, #859900)`},as:`span`,"data-type":`float`,className:`w-rjv-type`,children:`float`},True:{style:{color:`var(--w-rjv-type-boolean-color, #2aa198)`},as:`span`,"data-type":`bool`,className:`w-rjv-type`,children:`bool`},False:{style:{color:`var(--w-rjv-type-boolean-color, #2aa198)`},as:`span`,"data-type":`bool`,className:`w-rjv-type`,children:`bool`},Date:{style:{color:`var(--w-rjv-type-date-color, #268bd2)`},as:`span`,"data-type":`date`,className:`w-rjv-type`,children:`date`}},za=(0,D.createContext)(Ra),Ba=(e,t)=>B({},e,t),H=()=>(0,D.useContext)(za),Va=(0,D.createContext)(()=>{});Va.displayName=`JVR.DispatchTypes`;function Ha(){return(0,D.useReducer)(Ba,Ra)}function Ua(){return(0,D.useContext)(Va)}function Wa(e){var{initial:t,dispatch:n,children:r}=e;return(0,O.jsx)(za.Provider,{value:t,children:(0,O.jsx)(Va.Provider,{value:n,children:r})})}Wa.displayName=`JVR.Types`;var Ga=[`style`];function Ka(e){var{style:t}=e,n=V(e,Ga);return(0,O.jsx)(`svg`,B({viewBox:`0 0 24 24`,fill:`var(--w-rjv-arrow-color, currentColor)`,style:B({cursor:`pointer`,height:`1em`,width:`1em`,userSelect:`none`,display:`inline-flex`},t)},n,{children:(0,O.jsx)(`path`,{d:`M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z`})}))}Ka.displayName=`JVR.TriangleArrow`;var qa={Arrow:{as:`span`,className:`w-rjv-arrow`,style:{transform:`rotate(0deg)`,transition:`all 0.3s`},children:(0,O.jsx)(Ka,{})},Colon:{as:`span`,style:{color:`var(--w-rjv-colon-color, var(--w-rjv-color))`,marginLeft:0,marginRight:2},className:`w-rjv-colon`,children:`:`},Quote:{as:`span`,style:{color:`var(--w-rjv-quotes-color, #236a7c)`},className:`w-rjv-quotes`,children:`"`},ValueQuote:{as:`span`,style:{color:`var(--w-rjv-quotes-string-color, #cb4b16)`},className:`w-rjv-quotes`,children:`"`},BracketsLeft:{as:`span`,style:{color:`var(--w-rjv-brackets-color, #236a7c)`},className:`w-rjv-brackets-start`,children:`[`},BracketsRight:{as:`span`,style:{color:`var(--w-rjv-brackets-color, #236a7c)`},className:`w-rjv-brackets-end`,children:`]`},BraceLeft:{as:`span`,style:{color:`var(--w-rjv-curlybraces-color, #236a7c)`},className:`w-rjv-curlybraces-start`,children:`{`},BraceRight:{as:`span`,style:{color:`var(--w-rjv-curlybraces-color, #236a7c)`},className:`w-rjv-curlybraces-end`,children:`}`}},Ja=(0,D.createContext)(qa),Ya=(e,t)=>B({},e,t),U=()=>(0,D.useContext)(Ja),Xa=(0,D.createContext)(()=>{});Xa.displayName=`JVR.DispatchSymbols`;function Za(){return(0,D.useReducer)(Ya,qa)}function Qa(){return(0,D.useContext)(Xa)}var $a=e=>{var{initial:t,dispatch:n,children:r}=e;return(0,O.jsx)(Ja.Provider,{value:t,children:(0,O.jsx)(Xa.Provider,{value:n,children:r})})};$a.displayName=`JVR.Symbols`;var eo={Copied:{className:`w-rjv-copied`,style:{height:`1em`,width:`1em`,cursor:`pointer`,verticalAlign:`middle`,marginLeft:5}},CountInfo:{as:`span`,className:`w-rjv-object-size`,style:{color:`var(--w-rjv-info-color, #0000004d)`,paddingLeft:8,fontStyle:`italic`}},CountInfoExtra:{as:`span`,className:`w-rjv-object-extra`,style:{paddingLeft:8}},Ellipsis:{as:`span`,style:{cursor:`pointer`,color:`var(--w-rjv-ellipsis-color, #cb4b16)`,userSelect:`none`},className:`w-rjv-ellipsis`,children:`...`},Row:{as:`div`,className:`w-rjv-line`},KeyName:{as:`span`,className:`w-rjv-object-key`}},to=(0,D.createContext)(eo),no=(e,t)=>B({},e,t),W=()=>(0,D.useContext)(to),ro=(0,D.createContext)(()=>{});ro.displayName=`JVR.DispatchSection`;function io(){return(0,D.useReducer)(no,eo)}function ao(){return(0,D.useContext)(ro)}var oo=e=>{var{initial:t,dispatch:n,children:r}=e;return(0,O.jsx)(to.Provider,{value:t,children:(0,O.jsx)(ro.Provider,{value:n,children:r})})};oo.displayName=`JVR.Section`;var so={objectSortKeys:!1,indentWidth:15},co=(0,D.createContext)(so);co.displayName=`JVR.Context`;var lo=(0,D.createContext)(()=>{});lo.displayName=`JVR.DispatchContext`;function uo(e,t){return B({},e,t)}var fo=()=>(0,D.useContext)(co),po=e=>{var{children:t,initialState:n,initialTypes:r}=e,[i,a]=(0,D.useReducer)(uo,Object.assign({},so,n)),[o,s]=Da(),[c,l]=Fa(),[u,d]=Ha(),[f,p]=Za(),[m,h]=io();return(0,D.useEffect)(()=>a(B({},n)),[n]),(0,O.jsx)(co.Provider,{value:i,children:(0,O.jsx)(lo.Provider,{value:a,children:(0,O.jsx)(ka,{initial:o,dispatch:s,children:(0,O.jsx)(La,{initial:c,dispatch:l,children:(0,O.jsx)(Wa,{initial:B({},u,r),dispatch:d,children:(0,O.jsx)($a,{initial:f,dispatch:p,children:(0,O.jsx)(oo,{initial:m,dispatch:h,children:t})})})})})})})};po.displayName=`JVR.Provider`;function mo(e){if(e==null)throw TypeError(`Cannot destructure `+e)}var ho=[`isNumber`,`value`,`parentValue`,`keyName`,`keys`],go=[`as`,`render`],_o=[`as`,`render`],vo=[`as`,`render`],yo=[`as`,`style`,`render`],bo=[`as`,`render`],xo=[`as`,`render`],So=[`as`,`render`],Co=[`as`,`render`],wo=e=>{var{Quote:t={}}=U(),{isNumber:n,value:r,parentValue:i,keyName:a,keys:o}=e,s=V(e,ho);if(n)return null;var{as:c,render:l}=t,u=V(t,go),d=c||`span`,f=B({},s,u);return typeof f.children==`string`&&(f.children=f.children.trim()||void 0),l&&typeof l==`function`&&l(f,{value:r,parentValue:i,keyName:a,keys:o||(a?[a]:[])})||(0,O.jsx)(d,B({},f))};wo.displayName=`JVR.Quote`;var To=e=>{var{ValueQuote:t={}}=U(),n=B({},(mo(e),e)),{as:r,render:i}=t,a=V(t,_o),o=r||`span`,s=B({},n,a);return i&&typeof i==`function`&&i(s,{})||(0,O.jsx)(o,B({},s))};To.displayName=`JVR.ValueQuote`;var Eo=e=>{var{value:t,parentValue:n,keyName:r,keys:i}=e,{Colon:a={}}=U(),{as:o,render:s}=a,c=V(a,vo),l=o||`span`;return s&&typeof s==`function`&&s(c,{value:t,parentValue:n,keyName:r,keys:i||(r?[r]:[])})||(0,O.jsx)(l,B({},c))};Eo.displayName=`JVR.Colon`;var Do=e=>{var{Arrow:t={}}=U(),n=Na(),{expandKey:r,style:i,value:a,parentValue:o,keyName:s,keys:c}=e,l=!!n[r],{as:u,style:d,render:f}=t,p=V(t,yo),m=u||`span`,h=f&&typeof f==`function`,g=B({},p,{"data-expanded":l,style:B({},d,i)});return h&&f(g,{value:a,parentValue:o,keyName:s,keys:c||(s?[s]:[])})||(0,O.jsx)(m,B({},p,{style:B({},d,i)}))};Do.displayName=`JVR.Arrow`;var Oo=e=>{var{isBrackets:t,value:n,parentValue:r,keyName:i,keys:a}=e,{BracketsLeft:o={},BraceLeft:s={}}=U(),c={value:n,parentValue:r,keyName:i,keys:a||(i?[i]:[])};if(t){var{as:l,render:u}=o,d=V(o,bo),f=l||`span`;return u&&typeof u==`function`&&u(d,c)||(0,O.jsx)(f,B({},d))}var{as:p,render:m}=s,h=V(s,xo),g=p||`span`;return m&&typeof m==`function`&&m(h,c)||(0,O.jsx)(g,B({},h))};Oo.displayName=`JVR.BracketsOpen`;var ko=e=>{var{isBrackets:t,isVisiable:n,value:r,parentValue:i,keyName:a,keys:o}=e,s={value:r,parentValue:i,keyName:a,keys:o||(a?[a]:[])};if(!n)return null;var{BracketsRight:c={},BraceRight:l={}}=U();if(t){var{as:u,render:d}=c,f=V(c,So),p=u||`span`;return d&&typeof d==`function`&&d(f,s)||(0,O.jsx)(p,B({},f))}var{as:m,render:h}=l,g=V(l,Co),_=m||`span`;return h&&typeof h==`function`&&h(g,s)||(0,O.jsx)(_,B({},g))};ko.displayName=`JVR.BracketsClose`;var Ao=e=>{var{keyName:t,value:n,expandKey:r,parentValue:i,level:a,keys:o=[]}=e,s=Na(),{collapsed:c,shouldExpandNodeInitially:l}=fo(),u=typeof c==`boolean`?c:typeof c==`number`?a>c:!1,d=s[r]??(l?!1:u),f=l&&l(!d,{value:n,keys:o,level:a,keyName:t,parentValue:i});if(l&&c===!1){if(s[r]===void 0&&!f)return null}else if(s[r]===void 0&&f)return null;var p=Object.keys(n).length;if(d||p===0)return null;var m={paddingLeft:4},h={keyName:t,value:n,keys:o,parentValue:i},g=Array.isArray(n),_=n instanceof Set;return(0,O.jsx)(`div`,{style:m,children:(0,O.jsx)(ko,B({isBrackets:g||_},h,{isVisiable:!0}))})};Ao.displayName=`JVR.NestedClose`;var jo=[`as`,`render`],Mo=[`as`,`render`],No=[`as`,`render`],Po=[`as`,`render`],Fo=[`as`,`render`],Io=[`as`,`render`],Lo=[`as`,`render`],Ro=[`as`,`render`],zo=[`as`,`render`],Bo=[`as`,`render`],Vo=[`as`,`render`],Ho=[`as`,`render`],Uo=[`as`,`render`],Wo=e=>{if(e===void 0)return`0n`;if(typeof e==`string`)try{e=BigInt(e)}catch{return`0n`}return e?e.toString()+`n`:`0n`},Go=e=>{var{value:t,keyName:n}=e,{Set:r={},displayDataTypes:i}=H();if(!(t instanceof Set)||!i)return null;var{as:a,render:o}=r,s=V(r,jo);return o&&typeof o==`function`&&o(s,{type:`type`,value:t,keyName:n})||(0,O.jsx)(a||`span`,B({},s))};Go.displayName=`JVR.SetComp`;var Ko=e=>{var{value:t,keyName:n}=e,{Map:r={},displayDataTypes:i}=H();if(!(t instanceof Map)||!i)return null;var{as:a,render:o}=r,s=V(r,Mo);return o&&typeof o==`function`&&o(s,{type:`type`,value:t,keyName:n})||(0,O.jsx)(a||`span`,B({},s))};Ko.displayName=`JVR.MapComp`;var G={opacity:.75,paddingRight:4},qo=e=>{var{children:t=``,keyName:n,keys:r}=e,{Str:i={},displayDataTypes:a}=H(),{shortenTextAfterLength:o=30,stringEllipsis:s=`...`}=fo(),{as:c,render:l}=i,u=V(i,No),d=t,[f,p]=(0,D.useState)(o&&d.length>o);(0,D.useEffect)(()=>p(o&&d.length>o),[o]);var m=c||`span`,h=B({},G,i.style||{});o>0&&(u.style=B({},u.style,{cursor:d.length<=o?`initial`:`pointer`}),d.length>o&&(u.onClick=()=>{p(!f)}));var g=f?``+d.slice(0,o)+s:d,_=l&&typeof l==`function`,v=_&&l(B({},u,{style:h}),{type:`type`,value:t,keyName:n,keys:r}),y=f?`w-rjv-value w-rjv-value-short`:`w-rjv-value`,b=_&&l(B({},u,{children:g,className:y}),{type:`value`,value:t,keyName:n,keys:r});return(0,O.jsxs)(D.Fragment,{children:[a&&(v||(0,O.jsx)(m,B({},u,{style:h}))),b||(0,O.jsxs)(D.Fragment,{children:[(0,O.jsx)(To,{}),(0,O.jsx)(m,B({},u,{className:y,children:g})),(0,O.jsx)(To,{})]})]})};qo.displayName=`JVR.TypeString`;var Jo=e=>{var{children:t,keyName:n,keys:r}=e,{True:i={},displayDataTypes:a}=H(),{as:o,render:s}=i,c=V(i,Po),l=o||`span`,u=B({},G,i.style||{}),d=s&&typeof s==`function`,f=d&&s(B({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),p=d&&s(B({},c,{children:t,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,O.jsxs)(D.Fragment,{children:[a&&(f||(0,O.jsx)(l,B({},c,{style:u}))),p||(0,O.jsx)(l,B({},c,{className:`w-rjv-value`,children:t?.toString()}))]})};Jo.displayName=`JVR.TypeTrue`;var Yo=e=>{var{children:t,keyName:n,keys:r}=e,{False:i={},displayDataTypes:a}=H(),{as:o,render:s}=i,c=V(i,Fo),l=o||`span`,u=B({},G,i.style||{}),d=s&&typeof s==`function`,f=d&&s(B({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),p=d&&s(B({},c,{children:t,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,O.jsxs)(D.Fragment,{children:[a&&(f||(0,O.jsx)(l,B({},c,{style:u}))),p||(0,O.jsx)(l,B({},c,{className:`w-rjv-value`,children:t?.toString()}))]})};Yo.displayName=`JVR.TypeFalse`;var Xo=e=>{var{children:t,keyName:n,keys:r}=e,{Float:i={},displayDataTypes:a}=H(),{as:o,render:s}=i,c=V(i,Io),l=o||`span`,u=B({},G,i.style||{}),d=s&&typeof s==`function`,f=d&&s(B({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),p=d&&s(B({},c,{children:t,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,O.jsxs)(D.Fragment,{children:[a&&(f||(0,O.jsx)(l,B({},c,{style:u}))),p||(0,O.jsx)(l,B({},c,{className:`w-rjv-value`,children:t?.toString()}))]})};Xo.displayName=`JVR.TypeFloat`;var Zo=e=>{var{children:t,keyName:n,keys:r}=e,{Int:i={},displayDataTypes:a}=H(),{as:o,render:s}=i,c=V(i,Lo),l=o||`span`,u=B({},G,i.style||{}),d=s&&typeof s==`function`,f=d&&s(B({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),p=d&&s(B({},c,{children:t,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,O.jsxs)(D.Fragment,{children:[a&&(f||(0,O.jsx)(l,B({},c,{style:u}))),p||(0,O.jsx)(l,B({},c,{className:`w-rjv-value`,children:t?.toString()}))]})};Zo.displayName=`JVR.TypeInt`;var Qo=e=>{var{children:t,keyName:n,keys:r}=e,{Bigint:i={},displayDataTypes:a}=H(),{as:o,render:s}=i,c=V(i,Ro),l=o||`span`,u=B({},G,i.style||{}),d=s&&typeof s==`function`,f=d&&s(B({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),p=d&&s(B({},c,{children:t,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,O.jsxs)(D.Fragment,{children:[a&&(f||(0,O.jsx)(l,B({},c,{style:u}))),p||(0,O.jsx)(l,B({},c,{className:`w-rjv-value`,children:Wo(t?.toString())}))]})};Qo.displayName=`JVR.TypeFloat`;var $o=e=>{var{children:t,keyName:n,keys:r}=e,{Url:i={},displayDataTypes:a}=H(),{as:o,render:s}=i,c=V(i,zo),l=o||`span`,u=B({},G,i.style),d=s&&typeof s==`function`,f=d&&s(B({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),p=d&&s(B({},c,{children:t?.href,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,O.jsxs)(D.Fragment,{children:[a&&(f||(0,O.jsx)(l,B({},c,{style:u}))),p||(0,O.jsxs)(`a`,B({href:t?.href,target:`_blank`},c,{className:`w-rjv-value`,children:[(0,O.jsx)(To,{}),t?.href,(0,O.jsx)(To,{})]}))]})};$o.displayName=`JVR.TypeUrl`;var es=e=>{var{children:t,keyName:n,keys:r}=e,{Date:i={},displayDataTypes:a}=H(),{as:o,render:s}=i,c=V(i,Bo),l=o||`span`,u=B({},G,i.style||{}),d=s&&typeof s==`function`,f=d&&s(B({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),p=t instanceof Date?t.toLocaleString():t,m=d&&s(B({},c,{children:p,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,O.jsxs)(D.Fragment,{children:[a&&(f||(0,O.jsx)(l,B({},c,{style:u}))),m||(0,O.jsx)(l,B({},c,{className:`w-rjv-value`,children:p}))]})};es.displayName=`JVR.TypeDate`;var ts=e=>{var{children:t,keyName:n,keys:r}=e,{Undefined:i={},displayDataTypes:a}=H(),{as:o,render:s}=i,c=V(i,Vo),l=o||`span`,u=B({},G,i.style||{}),d=s&&typeof s==`function`,f=d&&s(B({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),p=d&&s(B({},c,{children:t,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,O.jsxs)(D.Fragment,{children:[a&&(f||(0,O.jsx)(l,B({},c,{style:u}))),p]})};ts.displayName=`JVR.TypeUndefined`;var ns=e=>{var{children:t,keyName:n,keys:r}=e,{Null:i={},displayDataTypes:a}=H(),{as:o,render:s}=i,c=V(i,Ho),l=o||`span`,u=B({},G,i.style||{}),d=s&&typeof s==`function`,f=d&&s(B({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),p=d&&s(B({},c,{children:t,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,O.jsxs)(D.Fragment,{children:[a&&(f||(0,O.jsx)(l,B({},c,{style:u}))),p]})};ns.displayName=`JVR.TypeNull`;var rs=e=>{var{children:t,keyName:n,keys:r}=e,{Nan:i={},displayDataTypes:a}=H(),{as:o,render:s}=i,c=V(i,Uo),l=o||`span`,u=B({},G,i.style||{}),d=s&&typeof s==`function`,f=d&&s(B({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),p=d&&s(B({},c,{children:t?.toString(),className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,O.jsxs)(D.Fragment,{children:[a&&(f||(0,O.jsx)(l,B({},c,{style:u}))),p]})};rs.displayName=`JVR.TypeNan`;var is=e=>Number(e)===e&&e%1!=0||isNaN(e),as=e=>{var{value:t,keyName:n,keys:r}=e,i={keyName:n,keys:r};return t instanceof URL?(0,O.jsx)($o,B({},i,{children:t})):typeof t==`string`?(0,O.jsx)(qo,B({},i,{children:t})):t===!0?(0,O.jsx)(Jo,B({},i,{children:t})):t===!1?(0,O.jsx)(Yo,B({},i,{children:t})):t===null?(0,O.jsx)(ns,B({},i,{children:t})):t===void 0?(0,O.jsx)(ts,B({},i,{children:t})):t instanceof Date?(0,O.jsx)(es,B({},i,{children:t})):typeof t==`number`&&isNaN(t)?(0,O.jsx)(rs,B({},i,{children:t})):typeof t==`number`&&is(t)?(0,O.jsx)(Xo,B({},i,{children:t})):typeof t==`bigint`?(0,O.jsx)(Qo,B({},i,{children:t})):typeof t==`number`?(0,O.jsx)(Zo,B({},i,{children:t})):null};as.displayName=`JVR.Value`;function K(e,t,n){var r=Qa(),i=B({},e,t,{className:[e.className,t.className].filter(Boolean).join(` `),style:B({},e.style,t.style),children:t.children||e.children});(0,D.useEffect)(()=>r({[n]:i}),[t])}function q(e,t,n){var r=Ua(),i=B({},e,t,{className:[e.className,t.className].filter(Boolean).join(` `),style:B({},e.style,t.style),children:t.children||e.children});(0,D.useEffect)(()=>r({[n]:i}),[t])}function os(e,t,n){var r=ao(),i=B({},e,t,{className:[e.className,t.className].filter(Boolean).join(` `),style:B({},e.style,t.style),children:t.children||e.children});(0,D.useEffect)(()=>r({[n]:i}),[t])}var ss=[`as`,`render`],cs=e=>{var{KeyName:t={}}=W();return os(t,e,`KeyName`),null};cs.displayName=`JVR.KeyName`;var ls=e=>{var{children:t,value:n,parentValue:r,keyName:i,keys:a}=e,o={color:typeof t==`number`?`var(--w-rjv-key-number, #268bd2)`:`var(--w-rjv-key-string, #002b36)`},{KeyName:s={}}=W(),{as:c,render:l}=s,u=V(s,ss);u.style=B({},u.style,o);var d=c||`span`;return l&&typeof l==`function`&&l(B({},u,{children:t}),{value:n,parentValue:r,keyName:i,keys:a||(i?[i]:[])})||(0,O.jsx)(d,B({},u,{children:t}))};ls.displayName=`JVR.KeyNameComp`;var us=[`children`,`value`,`parentValue`,`keyName`,`keys`],ds=[`as`,`render`,`children`],fs=e=>{var{Row:t={}}=W();return os(t,e,`Row`),null};fs.displayName=`JVR.Row`;var ps=e=>{var{children:t,value:n,parentValue:r,keyName:i,keys:a}=e,o=V(e,us),{Row:s={}}=W(),{as:c,render:l}=s,u=V(s,ds),d=c||`div`;return l&&typeof l==`function`&&l(B({},o,u,{children:t}),{value:n,keyName:i,parentValue:r,keys:a})||(0,O.jsx)(d,B({},o,u,{children:t}))};ps.displayName=`JVR.RowComp`;function ms(e){var t=(0,D.useRef)();return(0,D.useEffect)(()=>{t.current=e}),t.current}function hs(e){var{value:t,highlightUpdates:n,highlightContainer:r}=e,i=ms(t),a=(0,D.useMemo)(()=>{if(!n||i===void 0)return!1;if(typeof t!=typeof i)return!0;if(typeof t==`number`)return isNaN(t)&&isNaN(i)?!1:t!==i;if(Array.isArray(t)!==Array.isArray(i))return!0;if(typeof t==`object`||typeof t==`function`)return!1;if(t!==i)return!0},[n,t]);(0,D.useEffect)(()=>{r&&r.current&&a&&`animate`in r.current&&r.current.animate([{backgroundColor:`var(--w-rjv-update-color, #ebcb8b)`},{backgroundColor:``}],{duration:1e3,easing:`ease-in`})},[a,t,r])}var gs=[`keyName`,`value`,`parentValue`,`expandKey`,`keys`,`beforeCopy`],_s=[`as`,`render`],vs=e=>{var{keyName:t,value:n,parentValue:r,expandKey:i,keys:a,beforeCopy:o}=e,s=V(e,gs),{onCopied:c,enableClipboard:l,beforeCopy:u}=fo(),d=Ta()[i],[f,p]=(0,D.useState)(!1),{Copied:m={}}=W(),h=m?.beforeCopy;if(l===!1||!d)return null;var g={style:{display:`inline-flex`},fill:f?`var(--w-rjv-copied-success-color, #28a745)`:`var(--w-rjv-copied-color, currentColor)`,onClick:e=>{e.stopPropagation();var s=``;s=typeof n==`number`&&n===1/0?`Infinity`:typeof n==`number`&&isNaN(n)?`NaN`:typeof n==`bigint`?Wo(n):n instanceof Date?n.toLocaleString():JSON.stringify(n,(e,t)=>typeof t==`bigint`?Wo(t):t,2);var l=o||h||u;l&&typeof l==`function`&&(s=l(s,t,n,r,i,a)),c&&c(s,n),p(!0),(navigator.clipboard||{writeText(e){return new Promise((t,n)=>{var r=document.createElement(`textarea`);r.style.position=`absolute`,r.style.opacity=`0`,r.style.left=`-99999999px`,r.value=e,document.body.appendChild(r),r.select(),document.execCommand(`copy`)?t():n(),r.remove()})}}).writeText(s).then(()=>{var e=setTimeout(()=>{p(!1),clearTimeout(e)},3e3)}).catch(e=>{})}},{render:_}=m,v=V(m,_s),y=B({},v,s,g,{style:B({},v.style,s.style,g.style)});return _&&typeof _==`function`&&_(B({},y,{"data-copied":f}),{value:n,keyName:t,keys:a,parentValue:r})||(f?(0,O.jsx)(`svg`,B({viewBox:`0 0 32 36`},y,{children:(0,O.jsx)(`path`,{d:`M27.5,33 L2.5,33 L2.5,12.5 L27.5,12.5 L27.5,15.2249049 C29.1403264,13.8627542 29.9736597,13.1778155 30,13.1700887 C30,11.9705278 30,10.0804982 30,7.5 C30,6.1 28.9,5 27.5,5 L20,5 C20,2.2 17.8,0 15,0 C12.2,0 10,2.2 10,5 L2.5,5 C1.1,5 0,6.1 0,7.5 L0,33 C0,34.4 1.1,36 2.5,36 L27.5,36 C28.9,36 30,34.4 30,33 L30,26.1114493 L27.5,28.4926435 L27.5,33 Z M7.5,7.5 L10,7.5 C10,7.5 12.5,6.4 12.5,5 C12.5,3.6 13.6,2.5 15,2.5 C16.4,2.5 17.5,3.6 17.5,5 C17.5,6.4 18.8,7.5 20,7.5 L22.5,7.5 C22.5,7.5 25,8.6 25,10 L5,10 C5,8.5 6.1,7.5 7.5,7.5 Z M5,27.5 L10,27.5 L10,25 L5,25 L5,27.5 Z M28.5589286,16 L32,19.6 L21.0160714,30.5382252 L13.5303571,24.2571429 L17.1303571,20.6571429 L21.0160714,24.5428571 L28.5589286,16 Z M17.5,15 L5,15 L5,17.5 L17.5,17.5 L17.5,15 Z M10,20 L5,20 L5,22.5 L10,22.5 L10,20 Z`})})):(0,O.jsx)(`svg`,B({viewBox:`0 0 32 36`},y,{children:(0,O.jsx)(`path`,{d:`M27.5,33 L2.5,33 L2.5,12.5 L27.5,12.5 L27.5,20 L30,20 L30,7.5 C30,6.1 28.9,5 27.5,5 L20,5 C20,2.2 17.8,0 15,0 C12.2,0 10,2.2 10,5 L2.5,5 C1.1,5 0,6.1 0,7.5 L0,33 C0,34.4 1.1,36 2.5,36 L27.5,36 C28.9,36 30,34.4 30,33 L30,29 L27.5,29 L27.5,33 Z M7.5,7.5 L10,7.5 C10,7.5 12.5,6.4 12.5,5 C12.5,3.6 13.6,2.5 15,2.5 C16.4,2.5 17.5,3.6 17.5,5 C17.5,6.4 18.8,7.5 20,7.5 L22.5,7.5 C22.5,7.5 25,8.6 25,10 L5,10 C5,8.5 6.1,7.5 7.5,7.5 Z M5,27.5 L10,27.5 L10,25 L5,25 L5,27.5 Z M22.5,21.5 L22.5,16.5 L12.5,24 L22.5,31.5 L22.5,26.5 L32,26.5 L32,21.5 L22.5,21.5 Z M17.5,15 L5,15 L5,17.5 L17.5,17.5 L17.5,15 Z M10,20 L5,20 L5,22.5 L10,22.5 L10,20 Z`})})))};vs.displayName=`JVR.Copied`;function ys(){var e=(0,D.useRef)(null);return e.current===null&&(e.current=`custom-id-`+Math.random().toString(36).substr(2,9)),e.current}var bs=e=>{var{keyName:t,value:n,expandKey:r=``,level:i,keys:a=[],parentValue:o}=e,s=Na(),{objectSortKeys:c,indentWidth:l,collapsed:u,shouldExpandNodeInitially:d}=fo(),f=typeof u==`boolean`?u:typeof u==`number`?i>u:!1,p=s[r]??(d?!1:f),m=d&&d(!p,{value:n,keys:a,level:i,keyName:t,parentValue:o});if(d&&u===!1){if(s[r]===void 0&&!m)return null}else if(s[r]===void 0&&m)return null;if(p)return null;var h=Array.isArray(n)?Object.entries(n).map(e=>[Number(e[0]),e[1]]):Object.entries(n);return c&&(h=c===!0?h.sort((e,t)=>{var[n]=e,[r]=t;return typeof n==`string`&&typeof r==`string`?n.localeCompare(r):0}):h.sort((e,t)=>{var[n,r]=e,[i,a]=t;return typeof n==`string`&&typeof i==`string`?c(n,i,r,a):0})),(0,O.jsx)(`div`,{className:`w-rjv-wrap`,style:{borderLeft:`var(--w-rjv-border-left-width, 1px) var(--w-rjv-line-style, solid) var(--w-rjv-line-color, #ebebeb)`,paddingLeft:l,marginLeft:6},children:h.map((e,t)=>{var[r,o]=e;return(0,O.jsx)(Ss,{parentValue:n,keyName:r,keys:[...a,r],value:o,level:i},t)})})};bs.displayName=`JVR.KeyValues`;var xs=e=>{var{keyName:t,parentValue:n,keys:r,value:i}=e,{highlightUpdates:a}=fo(),o=typeof t==`number`,s=(0,D.useRef)(null);hs({value:i,highlightUpdates:a,highlightContainer:s});var c={keyName:t,value:i,keys:r,parentValue:n};return(0,O.jsxs)(D.Fragment,{children:[(0,O.jsxs)(`span`,{ref:s,children:[(0,O.jsx)(wo,B({isNumber:o,"data-placement":`left`},c)),(0,O.jsx)(ls,B({},c,{children:t})),(0,O.jsx)(wo,B({isNumber:o,"data-placement":`right`},c))]}),(0,O.jsx)(Eo,B({},c))]})};xs.displayName=`JVR.KayName`;var Ss=e=>{var{keyName:t,value:n,parentValue:r,level:i=0,keys:a=[]}=e,o=Oa(),s=ys(),c=Array.isArray(n),l=n instanceof Set,u=n instanceof Map,d=n instanceof Date,f=n instanceof URL;return n&&typeof n==`object`&&!c&&!l&&!u&&!d&&!f||c||l||u?(0,O.jsx)(Is,{keyName:t,value:l?Array.from(n):u?Object.fromEntries(n):n,parentValue:r,initialValue:n,keys:a,level:i+1}):(0,O.jsxs)(ps,B({className:`w-rjv-line`,value:n,keyName:t,keys:a,parentValue:r},{onMouseEnter:()=>o({[s]:!0}),onMouseLeave:()=>o({[s]:!1})},{children:[(0,O.jsx)(xs,{keyName:t,value:n,keys:a,parentValue:r}),(0,O.jsx)(as,{keyName:t,value:n,keys:a}),(0,O.jsx)(vs,{keyName:t,value:n,keys:a,parentValue:r,expandKey:s})]}))};Ss.displayName=`JVR.KeyValuesItem`;var Cs=[`value`,`keyName`],ws=[`as`,`render`],Ts=e=>{var{CountInfoExtra:t={}}=W();return os(t,e,`CountInfoExtra`),null};Ts.displayName=`JVR.CountInfoExtra`;var Es=e=>{var{value:t={},keyName:n}=e,r=V(e,Cs),{CountInfoExtra:i={}}=W(),{as:a,render:o}=i,s=V(i,ws);if(!o&&!s.children)return null;var c=a||`span`,l=o&&typeof o==`function`,u=B({},s,r);return l&&o(u,{value:t,keyName:n})||(0,O.jsx)(c,B({},u))};Es.displayName=`JVR.CountInfoExtraComps`;var Ds=[`value`,`keyName`],Os=[`as`,`render`],ks=e=>{var{CountInfo:t={}}=W();return os(t,e,`CountInfo`),null};ks.displayName=`JVR.CountInfo`;var As=e=>{var{value:t={},keyName:n}=e,r=V(e,Ds),{displayObjectSize:i}=fo(),{CountInfo:a={}}=W();if(!i)return null;var{as:o,render:s}=a,c=V(a,Os),l=o||`span`;c.style=B({},c.style,e.style);var u=Object.keys(t).length;c.children||=u+` item`+(u===1?``:`s`);var d=B({},c,r);return s&&typeof s==`function`&&s(B({},d,{"data-length":u}),{value:t,keyName:n})||(0,O.jsx)(l,B({},d))};As.displayName=`JVR.CountInfoComp`;var js=[`as`,`render`],Ms=e=>{var{Ellipsis:t={}}=W();return os(t,e,`Ellipsis`),null};Ms.displayName=`JVR.Ellipsis`;var Ns=e=>{var{isExpanded:t,value:n,keyName:r}=e,{Ellipsis:i={}}=W(),{as:a,render:o}=i,s=V(i,js),c=a||`span`;return o&&typeof o==`function`&&o(B({},s,{"data-expanded":t}),{value:n,keyName:r})||(!t||typeof n==`object`&&Object.keys(n).length==0?null:(0,O.jsx)(c,B({},s)))};Ns.displayName=`JVR.EllipsisComp`;var Ps=e=>{var{keyName:t,expandKey:n,keys:r=[],initialValue:i,value:a,parentValue:o,level:s}=e,c=Na(),l=Ia(),{onExpand:u,collapsed:d,shouldExpandNodeInitially:f}=fo(),p=typeof d==`boolean`?d:typeof d==`number`?s>d:!1,m=c[n]??(f?!1:p),h=f&&f(!m,{value:a,keys:r,level:s,keyName:t,parentValue:o});c[n]===void 0&&f&&(m=!h);var g=()=>{var e={expand:!m,value:a,keyid:n,keyName:t};u&&u(e),l({[n]:e.expand})},_={display:`inline-flex`,alignItems:`center`},v={transform:`rotate(`+(m?`-90`:`0`)+`deg)`,transition:`all 0.3s`},y=Object.keys(a).length,b=typeof a==`object`,x=Array.isArray(a),S=a instanceof Set,C=y!==0&&(x||S||b),w={style:_};C&&(w.onClick=g);var T={keyName:t,value:a,keys:r,parentValue:o};return(0,O.jsxs)(`span`,B({},w,{children:[C&&(0,O.jsx)(Do,B({style:v,expandKey:n},T)),(t||typeof t==`number`)&&(0,O.jsx)(xs,B({},T)),(0,O.jsx)(Go,{value:i,keyName:t}),(0,O.jsx)(Ko,{value:i,keyName:t}),(0,O.jsx)(Oo,B({isBrackets:x||S},T)),(0,O.jsx)(Ns,{keyName:t,value:a,isExpanded:m}),(0,O.jsx)(ko,B({isVisiable:m||!C,isBrackets:x||S},T)),(0,O.jsx)(As,{value:a,keyName:t}),(0,O.jsx)(Es,{value:a,keyName:t}),(0,O.jsx)(vs,{keyName:t,value:a,expandKey:n,parentValue:o,keys:r})]}))};Ps.displayName=`JVR.NestedOpen`;var Fs=[`className`,`children`,`parentValue`,`keyid`,`level`,`value`,`initialValue`,`keys`,`keyName`],Is=(0,D.forwardRef)((e,t)=>{var{className:n=``,parentValue:r,level:i=1,value:a,initialValue:o,keys:s,keyName:c}=e,l=V(e,Fs),u=Oa(),d=ys();return(0,O.jsxs)(`div`,B({className:[n,`w-rjv-inner`].filter(Boolean).join(` `),ref:t},l,{onMouseEnter:()=>u({[d]:!0}),onMouseLeave:()=>u({[d]:!1})},{children:[(0,O.jsx)(Ps,{expandKey:d,value:a,level:i,keys:s,parentValue:r,keyName:c,initialValue:o}),(0,O.jsx)(bs,{expandKey:d,value:a,level:i,keys:s,parentValue:r,keyName:c}),(0,O.jsx)(Ao,{expandKey:d,value:a,level:i,keys:s,parentValue:r,keyName:c})]}))});Is.displayName=`JVR.Container`;var Ls=e=>{var{BraceLeft:t={}}=U();return K(t,e,`BraceLeft`),null};Ls.displayName=`JVR.BraceLeft`;var Rs=e=>{var{BraceRight:t={}}=U();return K(t,e,`BraceRight`),null};Rs.displayName=`JVR.BraceRight`;var zs=e=>{var{BracketsLeft:t={}}=U();return K(t,e,`BracketsLeft`),null};zs.displayName=`JVR.BracketsLeft`;var Bs=e=>{var{BracketsRight:t={}}=U();return K(t,e,`BracketsRight`),null};Bs.displayName=`JVR.BracketsRight`;var Vs=e=>{var{Arrow:t={}}=U();return K(t,e,`Arrow`),null};Vs.displayName=`JVR.Arrow`;var Hs=e=>{var{Colon:t={}}=U();return K(t,e,`Colon`),null};Hs.displayName=`JVR.Colon`;var Us=e=>{var{Quote:t={}}=U();return K(t,e,`Quote`),null};Us.displayName=`JVR.Quote`;var Ws=e=>{var{ValueQuote:t={}}=U();return K(t,e,`ValueQuote`),null};Ws.displayName=`JVR.ValueQuote`;var Gs=e=>{var{Bigint:t={}}=H();return q(t,e,`Bigint`),null};Gs.displayName=`JVR.Bigint`;var Ks=e=>{var{Date:t={}}=H();return q(t,e,`Date`),null};Ks.displayName=`JVR.Date`;var qs=e=>{var{False:t={}}=H();return q(t,e,`False`),null};qs.displayName=`JVR.False`;var Js=e=>{var{Float:t={}}=H();return q(t,e,`Float`),null};Js.displayName=`JVR.Float`;var Ys=e=>{var{Int:t={}}=H();return q(t,e,`Int`),null};Ys.displayName=`JVR.Int`;var Xs=e=>{var{Map:t={}}=H();return q(t,e,`Map`),null};Xs.displayName=`JVR.Map`;var Zs=e=>{var{Nan:t={}}=H();return q(t,e,`Nan`),null};Zs.displayName=`JVR.Nan`;var Qs=e=>{var{Null:t={}}=H();return q(t,e,`Null`),null};Qs.displayName=`JVR.Null`;var $s=e=>{var{Set:t={}}=H();return q(t,e,`Set`),null};$s.displayName=`JVR.Set`;var ec=e=>{var{Str:t={}}=H();return q(t,e,`Str`),null};ec.displayName=`JVR.StringText`;var tc=e=>{var{True:t={}}=H();return q(t,e,`True`),null};tc.displayName=`JVR.True`;var nc=e=>{var{Undefined:t={}}=H();return q(t,e,`Undefined`),null};nc.displayName=`JVR.Undefined`;var rc=e=>{var{Url:t={}}=H();return q(t,e,`Url`),null};rc.displayName=`JVR.Url`;var ic=e=>{var{Copied:t={}}=W();return os(t,e,`Copied`),null};ic.displayName=`JVR.Copied`;var ac=[`className`,`style`,`value`,`children`,`collapsed`,`shouldExpandNodeInitially`,`indentWidth`,`displayObjectSize`,`shortenTextAfterLength`,`stringEllipsis`,`highlightUpdates`,`enableClipboard`,`displayDataTypes`,`objectSortKeys`,`onExpand`,`onCopied`,`beforeCopy`],J=(0,D.forwardRef)((e,t)=>{var{className:n=``,style:r,value:i,children:a,collapsed:o=!1,shouldExpandNodeInitially:s,indentWidth:c=15,displayObjectSize:l=!0,shortenTextAfterLength:u=30,stringEllipsis:d,highlightUpdates:f=!0,enableClipboard:p=!0,displayDataTypes:m=!0,objectSortKeys:h=!1,onExpand:g,onCopied:_,beforeCopy:v}=e,y=V(e,ac),b=B({lineHeight:1.4,fontFamily:`var(--w-rjv-font-family, Menlo, monospace)`,color:`var(--w-rjv-color, #002b36)`,backgroundColor:`var(--w-rjv-background-color, #00000000)`,fontSize:13},r),x=[`w-json-view-container`,`w-rjv`,n].filter(Boolean).join(` `);return(0,O.jsxs)(po,{initialState:{value:i,objectSortKeys:h,indentWidth:c,shouldExpandNodeInitially:o===!1?s:void 0,displayObjectSize:l,collapsed:o,enableClipboard:p,shortenTextAfterLength:u,stringEllipsis:d,highlightUpdates:f,onCopied:_,onExpand:g,beforeCopy:v},initialTypes:{displayDataTypes:m},children:[(0,O.jsx)(Is,B({value:i},y,{ref:t,className:x,style:b})),a]})});J.Bigint=Gs,J.Date=Ks,J.False=qs,J.Float=Js,J.Int=Ys,J.Map=Xs,J.Nan=Zs,J.Null=Qs,J.Set=$s,J.String=ec,J.True=tc,J.Undefined=nc,J.Url=rc,J.ValueQuote=Ws,J.Arrow=Vs,J.Colon=Hs,J.Quote=Us,J.Ellipsis=Ms,J.BraceLeft=Ls,J.BraceRight=Rs,J.BracketsLeft=zs,J.BracketsRight=Bs,J.Copied=ic,J.CountInfo=ks,J.CountInfoExtra=Ts,J.KeyName=cs,J.Row=fs,J.displayName=`JVR.JsonView`;function oc(e){return e.pagePath??e.id}var sc={"--w-rjv-font-family":`var(--font-family-mono)`,"--w-rjv-background-color":`transparent`,"--w-rjv-color":`var(--color-code-blue)`,"--w-rjv-key-string":`var(--color-code-blue)`,"--w-rjv-line-color":`var(--color-border-subtle)`,"--w-rjv-arrow-color":`var(--color-text-secondary)`,"--w-rjv-info-color":`var(--color-code-label)`,"--w-rjv-curlybraces-color":`var(--color-text-secondary)`,"--w-rjv-brackets-color":`var(--color-text-secondary)`,"--w-rjv-quotes-color":`var(--color-code-orange)`,"--w-rjv-quotes-string-color":`var(--color-code-orange)`,"--w-rjv-type-string-color":`var(--color-code-orange)`,"--w-rjv-type-int-color":`var(--color-code-number)`,"--w-rjv-type-float-color":`var(--color-code-number)`,"--w-rjv-type-bigint-color":`var(--color-code-number)`,"--w-rjv-type-boolean-color":`var(--color-code-keyword)`,"--w-rjv-type-null-color":`var(--color-code-keyword)`,"--w-rjv-type-nan-color":`var(--color-code-keyword)`,"--w-rjv-type-undefined-color":`var(--color-code-keyword)`,"--w-rjv-type-date-color":`var(--color-code-label)`,"--w-rjv-type-url-color":`var(--color-code-blue)`,fontSize:12,padding:`6px 8px`,wordBreak:`break-all`,whiteSpace:`pre-wrap`};function cc({state:e,onRefresh:t,onSelectBridge:n}){let{bridges:r,activeBridgeId:i,entries:a}=e,o=r.some(e=>Object.keys(a[e.id]??{}).length>0);return(0,O.jsxs)(`div`,{className:`flex flex-col overflow-hidden flex-1`,children:[(0,O.jsx)(`div`,{className:`flex items-center px-2.5 py-1.5 border-b border-border-subtle shrink-0 bg-bg-panel`,children:(0,O.jsx)(S,{variant:`outline`,size:`xs`,onClick:t,className:`hover:border-accent hover:text-accent`,children:`↻ 刷新`})}),r.length>1&&(0,O.jsx)(`div`,{className:`flex gap-1 px-2 py-1 border-b border-border-subtle shrink-0 overflow-x-auto bg-bg-panel`,children:r.map(e=>{let t=e.id===i;return(0,O.jsx)(`button`,{onClick:()=>n(e.id),title:e.id,className:`shrink-0 px-2 py-0.5 text-[11px] rounded border transition-colors `+(t?`border-accent text-accent bg-surface-3`:`border-border-subtle text-text-dim hover:border-accent hover:text-accent`),children:oc(e)},e.id)})}),r.length===0||!o?(0,O.jsx)(`div`,{className:`text-[12px] text-text-dim text-center px-4 py-6`,children:`暂无页面数据(仅显示 Page 级 data)`}):(0,O.jsx)(`div`,{className:`flex-1 overflow-hidden relative`,children:r.map(e=>{let t=e.id===i,n=a[e.id]??{},r=Object.keys(n);return(0,O.jsx)(`div`,{"data-bridge-id":e.id,className:`absolute inset-0 flex flex-col gap-2 p-2 overflow-y-auto`,style:{display:t?`flex`:`none`},children:r.length===0?(0,O.jsx)(`div`,{className:`text-[12px] text-text-dim text-center px-4 py-6`,children:`暂无页面数据(仅显示 Page 级 data)`}):r.map(t=>(0,O.jsxs)(`div`,{className:`border border-border-subtle rounded overflow-hidden shrink-0`,children:[(0,O.jsx)(`div`,{className:`bg-surface-3 px-2 py-0.5 text-[11px] text-code-label truncate`,children:t}),(0,O.jsx)(J,{value:n[t]??{},collapsed:1,displayDataTypes:!1,displayObjectSize:!1,enableClipboard:!1,indentWidth:12,style:sc})]},`${e.id}::${t}`))},e.id)})})]})}function lc(e){if(e==null)return``;if(typeof e==`string`)return e;if(typeof e==`object`)try{return JSON.stringify(e)}catch{return String(e)}return String(e)}function uc({items:e,onRefresh:t,onSet:n,onRemove:r,onClear:i,onClearAll:a,getPrefix:o}){let[s,c]=(0,D.useState)(null),[l,u]=(0,D.useState)(null),[d,f]=(0,D.useState)(!1),[p,m]=(0,D.useState)(``),[h,g]=(0,D.useState)(``),[_,v]=(0,D.useState)(``);(0,D.useEffect)(()=>{let e=!1,t,n=()=>{o().then(r=>{if(!e){if(r){m(r);return}t=setTimeout(n,300)}})};return n(),()=>{e=!0,t&&clearTimeout(t)}},[o]);async function y(e){f(!0),u(null);try{let t=await e();return t.ok?t:(u(t.error),null)}finally{f(!1)}}function b(e){c({key:e.key,draft:lc(e.value)})}async function x(){if(!s)return;let{key:e,draft:t}=s;c(null),await y(()=>n(e,t))}async function C(e){await y(()=>r(e))}async function w(){e.length!==0&&await y(()=>i())}async function T(){typeof window<`u`&&!window.confirm(`清空 simulator 中所有 appId 的 Storage 数据?该操作不可撤销。`)||await y(()=>a())}async function E(){let e=h.trim();if(!e){u(`key 不能为空`);return}let t=p+e;await y(()=>n(t,_))&&(g(``),v(``))}return(0,O.jsxs)(`div`,{className:`flex flex-col overflow-hidden flex-1`,"data-testid":`storage-panel`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-1.5 px-2.5 py-1.5 border-b border-border-subtle shrink-0 bg-bg-panel`,children:[(0,O.jsx)(S,{variant:`outline`,size:`xs`,onClick:t,disabled:d,className:`hover:border-accent hover:text-accent`,children:`↻ 刷新`}),(0,O.jsx)(S,{variant:`outline`,size:`xs`,onClick:w,disabled:d||e.length===0,className:`hover:border-destructive hover:text-destructive`,title:`仅清空当前 appId 的 Storage`,children:`清空`}),(0,O.jsx)(S,{variant:`outline`,size:`xs`,onClick:T,disabled:d,className:`hover:border-destructive hover:text-destructive`,title:`清空 simulator 中所有 appId 的 Storage`,children:`清空所有`}),l&&(0,O.jsx)(`span`,{className:`ml-2 text-[11px] text-destructive truncate`,title:l,children:l})]}),(0,O.jsx)(`div`,{className:`flex-1 overflow-y-auto`,children:(0,O.jsxs)(`table`,{className:`w-full border-collapse text-[12px]`,children:[(0,O.jsx)(`thead`,{children:(0,O.jsxs)(`tr`,{children:[(0,O.jsx)(`th`,{className:`text-left text-code-label font-normal px-2.5 py-1 border-b border-border-subtle text-[11px] sticky top-0 bg-bg-panel z-10 w-px pr-5`,children:`Key`}),(0,O.jsx)(`th`,{className:`text-left text-code-label font-normal px-2.5 py-1 border-b border-border-subtle text-[11px] sticky top-0 bg-bg-panel z-10`,children:`Value`}),(0,O.jsx)(`th`,{className:`w-px sticky top-0 bg-bg-panel z-10 border-b border-border-subtle`})]})}),(0,O.jsx)(`tbody`,{children:e.length===0?(0,O.jsx)(`tr`,{children:(0,O.jsx)(`td`,{colSpan:3,className:`text-[12px] text-text-dim text-center px-4 py-6`,children:`暂无 Storage 数据`})}):e.map(e=>{let t=s?.key===e.key,n=p&&e.key.startsWith(p)?e.key.slice(p.length):e.key;return(0,O.jsxs)(`tr`,{className:`hover:[&>td]:bg-surface`,children:[(0,O.jsx)(`td`,{className:`px-2.5 py-0.5 border-b border-border-subtle w-px pr-5 align-top`,children:(0,O.jsx)(`div`,{className:`font-mono text-code-blue max-w-[240px] truncate`,title:e.key,children:n})}),(0,O.jsx)(`td`,{className:`px-2.5 py-0.5 border-b border-border-subtle font-mono text-code-orange break-all align-top cursor-text`,onClick:()=>{t||b(e)},children:t?(0,O.jsx)(`input`,{autoFocus:!0,type:`text`,value:s.draft,onChange:t=>c({key:e.key,draft:t.target.value}),onBlur:x,onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),x()):e.key===`Escape`&&(e.preventDefault(),c(null))},className:`w-full bg-transparent outline-none border border-accent/60 rounded px-1 py-0 font-mono text-code-orange`}):lc(e.value)}),(0,O.jsx)(`td`,{className:`px-1 py-0.5 border-b border-border-subtle align-top`,children:(0,O.jsx)(`button`,{type:`button`,onClick:()=>C(e.key),disabled:d,title:`删除`,className:`text-text-dim hover:text-destructive px-1 leading-none`,children:`×`})})]},e.key)})})]})}),(0,O.jsxs)(`div`,{className:`flex items-center gap-1.5 px-2.5 py-1.5 border-t border-border-subtle shrink-0 bg-bg-panel`,children:[(0,O.jsx)(`input`,{type:`text`,placeholder:`key`,value:h,onChange:e=>g(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),E())},className:`w-32 bg-transparent border border-border-subtle rounded px-1.5 py-0.5 text-[12px] font-mono outline-none focus:border-accent`}),(0,O.jsx)(`input`,{type:`text`,placeholder:`value`,value:_,onChange:e=>v(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),E())},className:`flex-1 bg-transparent border border-border-subtle rounded px-1.5 py-0.5 text-[12px] font-mono outline-none focus:border-accent`}),(0,O.jsx)(S,{variant:`outline`,size:`xs`,onClick:()=>void E(),disabled:d||!h.trim(),className:`hover:border-accent hover:text-accent`,children:`+ 新增`})]})]})}function dc(e){let t=new Date(e);return[t.getHours(),t.getMinutes(),t.getSeconds()].map(e=>String(e).padStart(2,`0`)).join(`:`)}function fc(e){return e===`error`?`text-red-500`:e===`compiling`?`text-amber-500`:e===`ready`?`text-emerald-600`:`text-text-muted`}function pc({events:e,logs:t=[],onClear:n}){let r=e.length>0?e[e.length-1]:null,i=(0,D.useMemo)(()=>{let n=[];e.forEach((t,r)=>{let i=r>0?e[r-1]:null,a=t.status===`ready`&&i?.status===`compiling`?t.at-i.at:null;n.push({kind:`event`,at:t.at,seq:t.seq,event:t,durationMs:a})});for(let e of t)n.push({kind:`log`,at:e.at,seq:e.seq,log:e});return n.sort((e,t)=>t.at===e.at?e.seq!==void 0&&t.seq!==void 0?e.seq-t.seq:0:t.at-e.at)},[e,t]),a=e.length===0&&t.length===0;return(0,O.jsxs)(`div`,{className:`flex flex-col h-full w-full min-h-0 text-[12px]`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-2 px-2 h-8 shrink-0 border-b border-border-subtle`,children:[r?(0,O.jsx)(`span`,{"data-compile-current":!0,"data-status":r.status,className:_(`truncate font-medium`,fc(r.status)),children:r.message}):(0,O.jsx)(`span`,{className:`text-text-muted`,children:`编译信息`}),(0,O.jsx)(`div`,{className:`flex-1`}),(0,O.jsx)(`button`,{type:`button`,onClick:n,className:`px-2 h-6 rounded-sm text-text-muted hover:text-text hover:bg-surface-2 transition-colors`,children:`清空`})]}),(0,O.jsx)(`div`,{className:`flex-1 min-h-0 overflow-auto`,children:a?(0,O.jsx)(`div`,{className:`flex items-center justify-center h-full text-text-muted`,children:`暂无编译信息`}):(0,O.jsx)(`ul`,{className:`px-2 py-1 space-y-0.5`,children:i.map((e,t)=>e.kind===`event`?(0,O.jsxs)(`li`,{"data-compile-row":!0,"data-status":e.event.status,className:`flex items-baseline gap-2 leading-5`,children:[(0,O.jsx)(`span`,{className:`text-text-muted tabular-nums shrink-0`,children:dc(e.at)}),(0,O.jsx)(`span`,{className:_(`break-all`,fc(e.event.status)),children:e.event.message}),e.event.hotReload===!0&&(0,O.jsx)(`span`,{className:`shrink-0 px-1 rounded-sm bg-surface-2 text-text-muted`,children:`热更新`}),e.durationMs!==null&&(0,O.jsxs)(`span`,{"data-compile-duration":!0,className:`shrink-0 text-text-muted tabular-nums`,children:[(e.durationMs/1e3).toFixed(1),`s`]})]},`e-${e.at}-${t}`):(0,O.jsxs)(`li`,{"data-compile-log":!0,"data-stream":e.log.stream,className:`flex items-baseline gap-2 leading-5`,children:[(0,O.jsx)(`span`,{className:`text-text-muted tabular-nums shrink-0`,children:dc(e.at)}),(0,O.jsx)(`span`,{className:_(`break-all font-mono`,e.log.stream===`stderr`?`text-red-500`:`text-text`),children:e.log.text})]},`l-${e.at}-${t}`))})})]})}function mc(e){let{tabId:t,wxmlTree:n,onRefreshWxml:r,onInspectWxml:i,onClearWxmlInspection:a,appData:o,onRefreshAppData:s,onSelectAppDataBridge:c,storageItems:l,onRefreshStorage:u,onSetStorage:d,onRemoveStorage:f,onClearStorage:p,onClearAllStorage:m,getStoragePrefix:h,compileEvents:g=[],compileLogs:_=[],onClearCompileEvents:v}=e;switch(t){case`wxml`:return(0,O.jsx)(xa,{tree:n,onRefresh:r,onInspectElement:i,onClearInspection:a});case`appdata`:return(0,O.jsx)(cc,{state:o,onRefresh:s,onSelectBridge:c});case`storage`:return(0,O.jsx)(uc,{items:l,onRefresh:u,onSet:d,onRemove:f,onClear:p,onClearAll:m,getPrefix:h});case`compile`:return(0,O.jsx)(pc,{events:g,logs:_,onClear:v??(()=>{})})}}var hc=new Set([`simulator`,`editor`,`wxml`,`appdata`,`storage`,`console`,`compile`]);function gc({project:e}){let t=(0,D.useRef)(null),[n,r]=(0,D.useState)(!1),{session:i,device:a,simulator:o,panelData:s,rightPane:c,popover:l}=xt({projectPath:e.path}),u=Et(),{state:d}=u,[f]=(0,D.useState)(()=>Cn(d.dockTree??null,a.simPanelWidth,hc)),p=(0,D.useMemo)(()=>hn(),[]),[m,h]=(0,D.useState)(0);(0,D.useEffect)(()=>{let e=!1,t=x(t=>{e=!0,h(t)});return se().then(t=>{e||typeof t==`number`&&h(t)}),t},[]);let g=Qn({present:m>0,publish:w,deps:[m]});(0,D.useEffect)(()=>{let t=`Dimina DevTools`;return document.title=`${e.name} - ${t}`,Ne().then(n=>{n?.appName&&(t=n.appName,document.title=`${e.name} - ${t}`)}).catch(()=>{}),()=>{document.title=t}},[e.name]),(0,D.useEffect)(()=>()=>{t.current!==null&&window.clearTimeout(t.current)},[]);async function _(){if(o.currentPage)try{await navigator.clipboard.writeText(o.currentPage),r(!0),t.current!==null&&window.clearTimeout(t.current),t.current=window.setTimeout(()=>r(!1),b)}catch{r(!1)}}let v={rightPane:c.rightPane,onSelectTab:c.selectRightPane,wxmlTree:s.wxmlTree,onRefreshWxml:s.refreshWxml,onInspectWxml:s.inspectWxmlElement,onClearWxmlInspection:s.clearWxmlElementInspection,appData:s.appData,onRefreshAppData:s.refreshAppData,onSelectAppDataBridge:s.setActiveAppDataBridge,storageItems:s.storageItems,onRefreshStorage:s.refreshStorage,onSetStorage:s.setStorageItem,onRemoveStorage:s.removeStorageItem,onClearStorage:s.clearStorage,onClearAllStorage:s.clearAllStorage,getStoragePrefix:s.getStoragePrefix,compileEvents:i.compileEvents,compileLogs:i.compileLogs,onClearCompileEvents:i.clearCompileEvents};return(0,O.jsxs)(`div`,{className:`flex flex-col h-screen`,children:[(0,O.jsx)(`div`,{ref:g,style:{height:m},className:`shrink-0 w-full`,"data-area":`host-toolbar`}),(0,O.jsx)(Gn,{compileDropdownRef:l.compileDropdownRef,showCompilePanel:l.showCompilePanel,onToggleCompilePanel:l.toggleCompilePanel,onRelaunch:()=>i.relaunch(),compileStatus:i.compileStatus,dockModel:f,dockRegistry:p,layout:u,simPanelWidth:a.simPanelWidth}),(0,O.jsx)(`div`,{className:`flex-1 min-h-0 overflow-hidden`,children:(0,O.jsx)(xc,{dockModel:f,dockRegistry:p,simPanelWidth:a.simPanelWidth,renderDomPanel:(e,t)=>e===`simulator`?(0,O.jsx)(ga,{device:a.device,zoom:a.zoom,onDeviceChange:a.handleDeviceChange,onZoomChange:a.handleZoomChange,compileStatus:i.compileStatus,currentPage:o.currentPage,copied:n,onCopyPagePath:_}):e===`editor`?(0,O.jsx)(_a,{}):e===`wxml`||e===`appdata`||e===`storage`||e===`compile`?(0,O.jsx)(bc,{tabId:e,active:t.active,panelProps:v}):null,onPersistTree:u.setDockTree,persistedTree:d.dockTree??null})})]})}function _c(e){return e.kind===`tabs`?e.panels.includes(`simulator`):e.children.some(_c)}function vc(e,t){function n(e){if(e.kind===`tabs`)return null;if(e.id===t.splitId)return(e.constraints?.[t.childIndex]??null)?.minPx??null;for(let t of e.children){let e=n(t);if(e!==null)return e}return null}return n(e)}function yc(e){if(e.kind===`tabs`)return null;for(let t=0;t<e.children.length;t++){let n=e.children[t];if((e.constraints?.[t]??null)!==null&&_c(n))return{splitId:e.id,childIndex:t};let r=yc(n);if(r)return r}return null}function bc({tabId:e,active:t,panelProps:n}){let r=(0,D.useRef)(n);(0,D.useEffect)(()=>{r.current=n});let i=(0,D.useRef)(!1);return(0,D.useEffect)(()=>{let n=t&&!i.current;if(i.current=t,!n)return;let a=r.current;e===`wxml`?a.onRefreshWxml():e===`appdata`?a.onRefreshAppData():e===`storage`&&a.onRefreshStorage()},[e,t]),(0,O.jsx)(mc,{tabId:e,...n})}function xc(e){let{dockModel:t,dockRegistry:n,simPanelWidth:r,renderDomPanel:i,onPersistTree:a,persistedTree:o}=e,s=(0,D.useRef)(null),c=(0,D.useCallback)(e=>{e.visible?T({x:e.bounds.x,y:e.bounds.y,width:e.bounds.width,height:e.bounds.height}):T({x:0,y:0,width:0,height:0})},[]),l=(0,D.useCallback)((e,t,n)=>{if(e.current){t?(e.current.dispose(),e.current=Zn(t,{visible:!0,guardDisplayNone:!0,followScroll:!0,followGeometry:!0,publish:n})):(e.current.update({visible:!1,publish:n}),e.current.dispose(),e.current=null);return}t&&(e.current=Zn(t,{visible:!0,guardDisplayNone:!0,followScroll:!0,followGeometry:!0,publish:n}))},[]),u=(0,D.useCallback)((e,t)=>{e===`console`&&l(s,t,c)},[l,c]);return(0,D.useEffect)(()=>{let e=t.get().root,n=yc(e);n&&vc(e,n)!==r&&t.apply(e=>{let t=yc(e.root);return!t||vc(e.root,t)===r?e:an(e,t.splitId,t.childIndex,{minPx:r})})},[t,r]),(0,D.useEffect)(()=>()=>{s.current?.dispose(),s.current=null},[]),(0,D.useEffect)(()=>t.subscribe(e=>{a(jt(e.tree))}),[t,a]),(0,D.useEffect)(()=>{let e=jt(t.get());e!==o&&a(e)},[]),(0,O.jsx)(Yi,{model:t,registry:n,renderDomPanel:i,bindNativeSlot:u})}typeof window<`u`&&window.document&&window.document.createElement;function Y(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r.defaultPrevented)return t?.(r)}}function Sc(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function Cc(...e){return t=>{let n=!1,r=e.map(e=>{let r=Sc(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():Sc(e[t],null)}}}}function wc(...e){return D.useCallback(Cc(...e),e)}function Tc(e,t){let n=D.createContext(t),r=e=>{let{children:t,...r}=e,i=D.useMemo(()=>r,Object.values(r));return(0,O.jsx)(n.Provider,{value:i,children:t})};r.displayName=e+`Provider`;function i(r){let i=D.useContext(n);if(i)return i;if(t!==void 0)return t;throw Error(`\`${r}\` must be used within \`${e}\``)}return[r,i]}function Ec(e,t=[]){let n=[];function r(t,r){let i=D.createContext(r),a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=D.useMemo(()=>o,Object.values(o));return(0,O.jsx)(s.Provider,{value:c,children:r})};o.displayName=t+`Provider`;function s(n,o){let s=o?.[e]?.[a]||i,c=D.useContext(s);if(c)return c;if(r!==void 0)return r;throw Error(`\`${n}\` must be used within \`${t}\``)}return[o,s]}let i=()=>{let t=n.map(e=>D.createContext(e));return function(n){let r=n?.[e]||t;return D.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,Dc(i,...t)]}function Dc(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return D.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}var Oc=globalThis?.document?D.useLayoutEffect:()=>{},kc=D.useId||(()=>void 0),Ac=0;function jc(e){let[t,n]=D.useState(kc());return Oc(()=>{e||n(e=>e??String(Ac++))},[e]),e||(t?`radix-${t}`:``)}var Mc=D.useInsertionEffect||Oc;function Nc({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){let[i,a,o]=Pc({defaultProp:t,onChange:n}),s=e!==void 0,c=s?e:i;{let t=D.useRef(e!==void 0);D.useEffect(()=>{let e=t.current;e!==s&&console.warn(`${r} is changing from ${e?`controlled`:`uncontrolled`} to ${s?`controlled`:`uncontrolled`}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),t.current=s},[s,r])}return[c,D.useCallback(t=>{if(s){let n=Fc(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}function Pc({defaultProp:e,onChange:t}){let[n,r]=D.useState(e),i=D.useRef(n),a=D.useRef(t);return Mc(()=>{a.current=t},[t]),D.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}function Fc(e){return typeof e==`function`}var Ic=h(t(),1);function Lc(e){let t=Rc(e),n=D.forwardRef((e,n)=>{let{children:r,...i}=e,a=D.Children.toArray(r),o=a.find(Bc);if(o){let e=o.props.children,r=a.map(t=>t===o?D.Children.count(e)>1?D.Children.only(null):D.isValidElement(e)?e.props.children:null:t);return(0,O.jsx)(t,{...i,ref:n,children:D.isValidElement(e)?D.cloneElement(e,void 0,r):null})}return(0,O.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function Rc(e){let t=D.forwardRef((e,t)=>{let{children:n,...r}=e;if(D.isValidElement(n)){let e=Hc(n),i=Vc(r,n.props);return n.type!==D.Fragment&&(i.ref=t?Cc(t,e):e),D.cloneElement(n,i)}return D.Children.count(n)>1?D.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var zc=Symbol(`radix.slottable`);function Bc(e){return D.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===zc}function Vc(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function Hc(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var X=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=Lc(`Primitive.${t}`),r=D.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,O.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Uc(e,t){e&&Ic.flushSync(()=>e.dispatchEvent(t))}function Wc(e){let t=D.useRef(e);return D.useEffect(()=>{t.current=e}),D.useMemo(()=>(...e)=>t.current?.(...e),[])}function Gc(e,t=globalThis?.document){let n=Wc(e);D.useEffect(()=>{let e=e=>{e.key===`Escape`&&n(e)};return t.addEventListener(`keydown`,e,{capture:!0}),()=>t.removeEventListener(`keydown`,e,{capture:!0})},[n,t])}var Kc=`DismissableLayer`,qc=`dismissableLayer.update`,Jc=`dismissableLayer.pointerDownOutside`,Yc=`dismissableLayer.focusOutside`,Xc,Zc=D.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Qc=D.forwardRef((e,t)=>{let{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:a,onInteractOutside:o,onDismiss:s,...c}=e,l=D.useContext(Zc),[u,d]=D.useState(null),f=u?.ownerDocument??globalThis?.document,[,p]=D.useState({}),m=wc(t,e=>d(e)),h=Array.from(l.layers),[g]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),_=h.indexOf(g),v=u?h.indexOf(u):-1,y=l.layersWithOutsidePointerEventsDisabled.size>0,b=v>=_,x=tl(e=>{let t=e.target,n=[...l.branches].some(e=>e.contains(t));!b||n||(i?.(e),o?.(e),e.defaultPrevented||s?.())},f),S=nl(e=>{let t=e.target;[...l.branches].some(e=>e.contains(t))||(a?.(e),o?.(e),e.defaultPrevented||s?.())},f);return Gc(e=>{v===l.layers.size-1&&(r?.(e),!e.defaultPrevented&&s&&(e.preventDefault(),s()))},f),D.useEffect(()=>{if(u)return n&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(Xc=f.body.style.pointerEvents,f.body.style.pointerEvents=`none`),l.layersWithOutsidePointerEventsDisabled.add(u)),l.layers.add(u),rl(),()=>{n&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=Xc)}},[u,f,n,l]),D.useEffect(()=>()=>{u&&(l.layers.delete(u),l.layersWithOutsidePointerEventsDisabled.delete(u),rl())},[u,l]),D.useEffect(()=>{let e=()=>p({});return document.addEventListener(qc,e),()=>document.removeEventListener(qc,e)},[]),(0,O.jsx)(X.div,{...c,ref:m,style:{pointerEvents:y?b?`auto`:`none`:void 0,...e.style},onFocusCapture:Y(e.onFocusCapture,S.onFocusCapture),onBlurCapture:Y(e.onBlurCapture,S.onBlurCapture),onPointerDownCapture:Y(e.onPointerDownCapture,x.onPointerDownCapture)})});Qc.displayName=Kc;var $c=`DismissableLayerBranch`,el=D.forwardRef((e,t)=>{let n=D.useContext(Zc),r=D.useRef(null),i=wc(t,r);return D.useEffect(()=>{let e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),(0,O.jsx)(X.div,{...e,ref:i})});el.displayName=$c;function tl(e,t=globalThis?.document){let n=Wc(e),r=D.useRef(!1),i=D.useRef(()=>{});return D.useEffect(()=>{let e=e=>{if(e.target&&!r.current){let r=function(){il(Jc,n,a,{discrete:!0})},a={originalEvent:e};e.pointerType===`touch`?(t.removeEventListener(`click`,i.current),i.current=r,t.addEventListener(`click`,i.current,{once:!0})):r()}else t.removeEventListener(`click`,i.current);r.current=!1},a=window.setTimeout(()=>{t.addEventListener(`pointerdown`,e)},0);return()=>{window.clearTimeout(a),t.removeEventListener(`pointerdown`,e),t.removeEventListener(`click`,i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function nl(e,t=globalThis?.document){let n=Wc(e),r=D.useRef(!1);return D.useEffect(()=>{let e=e=>{e.target&&!r.current&&il(Yc,n,{originalEvent:e},{discrete:!1})};return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function rl(){let e=new CustomEvent(qc);document.dispatchEvent(e)}function il(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?Uc(i,a):i.dispatchEvent(a)}var al=`focusScope.autoFocusOnMount`,ol=`focusScope.autoFocusOnUnmount`,sl={bubbles:!1,cancelable:!0},cl=`FocusScope`,ll=D.forwardRef((e,t)=>{let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=D.useState(null),l=Wc(i),u=Wc(a),d=D.useRef(null),f=wc(t,e=>c(e)),p=D.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;D.useEffect(()=>{if(r){let e=function(e){if(p.paused||!s)return;let t=e.target;s.contains(t)?d.current=t:Z(d.current,{select:!0})},t=function(e){if(p.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||Z(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&Z(s)};document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,s,p.paused]),D.useEffect(()=>{if(s){gl.add(p);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(al,sl);s.addEventListener(al,l),s.dispatchEvent(t),t.defaultPrevented||(ul(yl(fl(s)),{select:!0}),document.activeElement===e&&Z(s))}return()=>{s.removeEventListener(al,l),setTimeout(()=>{let t=new CustomEvent(ol,sl);s.addEventListener(ol,u),s.dispatchEvent(t),t.defaultPrevented||Z(e??document.body,{select:!0}),s.removeEventListener(ol,u),gl.remove(p)},0)}}},[s,l,u,p]);let m=D.useCallback(e=>{if(!n&&!r||p.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=dl(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&Z(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&Z(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,p.paused]);return(0,O.jsx)(X.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})});ll.displayName=cl;function ul(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(Z(r,{select:t}),document.activeElement!==n)return}function dl(e){let t=fl(e);return[pl(t,e),pl(t.reverse(),e)]}function fl(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function pl(e,t){for(let n of e)if(!ml(n,{upTo:t}))return n}function ml(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}function hl(e){return e instanceof HTMLInputElement&&`select`in e}function Z(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&hl(e)&&t&&e.select()}}var gl=_l();function _l(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=vl(e,t),e.unshift(t)},remove(t){e=vl(e,t),e[0]?.resume()}}}function vl(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function yl(e){return e.filter(e=>e.tagName!==`A`)}var bl=`Portal`,xl=D.forwardRef((e,t)=>{let{container:n,...r}=e,[i,a]=D.useState(!1);Oc(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?Ic.createPortal((0,O.jsx)(X.div,{...r,ref:t}),o):null});xl.displayName=bl;function Sl(e,t){return D.useReducer((e,n)=>t[e][n]??e,e)}var Cl=e=>{let{present:t,children:n}=e,r=wl(t),i=typeof n==`function`?n({present:r.isPresent}):D.Children.only(n),a=wc(r.ref,El(i));return typeof n==`function`||r.isPresent?D.cloneElement(i,{ref:a}):null};Cl.displayName=`Presence`;function wl(e){let[t,n]=D.useState(),r=D.useRef(null),i=D.useRef(e),a=D.useRef(`none`),[o,s]=Sl(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return D.useEffect(()=>{let e=Tl(r.current);a.current=o===`mounted`?e:`none`},[o]),Oc(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,o=Tl(t);e?s(`MOUNT`):o===`none`||t?.display===`none`?s(`UNMOUNT`):s(n&&r!==o?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,s]),Oc(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=a=>{let o=Tl(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(s(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},c=e=>{e.target===t&&(a.current=Tl(r.current))};return t.addEventListener(`animationstart`,c),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,c),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}else s(`ANIMATION_END`)},[t,s]),{isPresent:[`mounted`,`unmountSuspended`].includes(o),ref:D.useCallback(e=>{r.current=e?getComputedStyle(e):null,n(e)},[])}}function Tl(e){return e?.animationName||`none`}function El(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Dl=0;function Ol(){D.useEffect(()=>{let e=document.querySelectorAll(`[data-radix-focus-guard]`);return document.body.insertAdjacentElement(`afterbegin`,e[0]??kl()),document.body.insertAdjacentElement(`beforeend`,e[1]??kl()),Dl++,()=>{Dl===1&&document.querySelectorAll(`[data-radix-focus-guard]`).forEach(e=>e.remove()),Dl--}},[])}function kl(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}var Q=function(){return Q=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Q.apply(this,arguments)};function Al(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function jl(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var Ml=`right-scroll-bar-position`,Nl=`width-before-scroll-bar`,Pl=`with-scroll-bars-hidden`,Fl=`--removed-body-scroll-bar-size`;function Il(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function Ll(e,t){var n=(0,D.useState)(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(e){var t=n.value;t!==e&&(n.value=e,n.callback(e,t))}}}})[0];return n.callback=t,n.facade}var Rl=typeof window<`u`?D.useLayoutEffect:D.useEffect,zl=new WeakMap;function Bl(e,t){var n=Ll(t||null,function(t){return e.forEach(function(e){return Il(e,t)})});return Rl(function(){var t=zl.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||Il(e,null)}),i.forEach(function(e){r.has(e)||Il(e,a)})}zl.set(n,e)},[e]),n}function Vl(e){return e}function Hl(e,t){t===void 0&&(t=Vl);var n=[],r=!1;return{read:function(){if(r)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var i=t(e,r);return n.push(i),function(){n=n.filter(function(e){return e!==i})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var i=n;n=[],i.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},o=function(){return Promise.resolve().then(a)};o(),n={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),n}}}}}function Ul(e){e===void 0&&(e={});var t=Hl(null);return t.options=Q({async:!0,ssr:!1},e),t}var Wl=function(e){var t=e.sideCar,n=Al(e,[`sideCar`]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error(`Sidecar medium not found`);return D.createElement(r,Q({},n))};Wl.isSideCarExport=!0;function Gl(e,t){return e.useMedium(t),Wl}var Kl=Ul(),ql=function(){},Jl=D.forwardRef(function(e,t){var n=D.useRef(null),r=D.useState({onScrollCapture:ql,onWheelCapture:ql,onTouchMoveCapture:ql}),i=r[0],a=r[1],o=e.forwardProps,s=e.children,c=e.className,l=e.removeScrollBar,u=e.enabled,d=e.shards,f=e.sideCar,p=e.noRelative,m=e.noIsolation,h=e.inert,g=e.allowPinchZoom,_=e.as,v=_===void 0?`div`:_,y=e.gapMode,b=Al(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),x=f,S=Bl([n,t]),C=Q(Q({},b),i);return D.createElement(D.Fragment,null,u&&D.createElement(x,{sideCar:Kl,removeScrollBar:l,shards:d,noRelative:p,noIsolation:m,inert:h,setCallbacks:a,allowPinchZoom:!!g,lockRef:n,gapMode:y}),o?D.cloneElement(D.Children.only(s),Q(Q({},C),{ref:S})):D.createElement(v,Q({},C,{className:c,ref:S}),s))});Jl.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},Jl.classNames={fullWidth:Nl,zeroRight:Ml};var Yl,Xl=function(){if(Yl)return Yl;if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function Zl(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=Xl();return t&&e.setAttribute(`nonce`,t),e}function Ql(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function $l(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var eu=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Zl())&&(Ql(t,n),$l(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},tu=function(){var e=eu();return function(t,n){D.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},nu=function(){var e=tu();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},ru={left:0,top:0,right:0,gap:0},iu=function(e){return parseInt(e||``,10)||0},au=function(e){var t=window.getComputedStyle(document.body),n=t[e===`padding`?`paddingLeft`:`marginLeft`],r=t[e===`padding`?`paddingTop`:`marginTop`],i=t[e===`padding`?`paddingRight`:`marginRight`];return[iu(n),iu(r),iu(i)]},ou=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return ru;var t=au(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},su=nu(),cu=`data-scroll-locked`,lu=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
2
- .${Pl} {
1
+ import{C as e,S as t,a as n,b as r,c as i,d as a,g as o,h as s,l as c,m as l,n as u,o as d,p as f,r as p,t as m,w as h,x as g}from"./ipc-transport-3Arg8jPC.js";import{n as _,r as v,t as y}from"./input-DR7bfyQE.js";import{_ as b,a as x,b as S,c as C,d as w,f as T,g as E,h as ee,i as te,l as ne,m as re,n as ie,o as ae,p as oe,r as se,t as ce,u as le,v as ue,y as de}from"./select-BxyPlVyJ.js";import{n as fe}from"./constants-EAMiwL9_.js";import{l as pe}from"./settings-api-CtPPJF-F.js";var me=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),he=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),ge=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),_e=e=>{let t=ge(e);return t.charAt(0).toUpperCase()+t.slice(1)},ve={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},ye=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},D=h(e()),be=(0,D.createContext)({}),xe=()=>(0,D.useContext)(be),Se=(0,D.forwardRef)(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>{let{size:l=24,strokeWidth:u=2,absoluteStrokeWidth:d=!1,color:f=`currentColor`,className:p=``}=xe()??{},m=r??d?Number(n??u)*24/Number(t??l):n??u;return(0,D.createElement)(`svg`,{ref:c,...ve,width:t??l??ve.width,height:t??l??ve.height,stroke:e??f,strokeWidth:m,className:me(`lucide`,p,i),...!a&&!ye(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,D.createElement)(e,t)),...Array.isArray(a)?a:[a]])}),Ce=(e,t)=>{let n=(0,D.forwardRef)(({className:n,...r},i)=>(0,D.createElement)(Se,{ref:i,iconNode:t,className:me(`lucide-${he(_e(e))}`,`lucide-${e}`,n),...r}));return n.displayName=_e(e),n},we=Ce(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),Te=Ce(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),Ee=h(g(),1),O=r();function De({project:e,onOpen:t,onRemove:n,thumbnail:r}){let[i,a]=(0,D.useState)(!1);return(0,O.jsxs)(`div`,{className:`relative bg-surface border border-border rounded-lg overflow-hidden cursor-pointer transition-all duration-150 hover:border-accent hover:-translate-y-0.5`,onClick:()=>t(e),onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),children:[r?(0,O.jsx)(`img`,{src:r,className:`h-28 w-full object-cover`,alt:``}):(0,O.jsx)(`div`,{className:`h-28 bg-surface-thumb`}),(0,O.jsxs)(`div`,{className:`p-3`,children:[(0,O.jsx)(`div`,{className:`text-sm font-medium text-text-white mb-1 truncate`,title:e.name,children:e.name}),(0,O.jsx)(`div`,{className:`text-[11px] text-text-secondary truncate`,title:e.path,children:e.path}),(0,O.jsx)(`div`,{className:`text-[11px] text-text-dim mt-1.5`,children:v(e.lastOpened)})]}),i&&(0,O.jsx)(S,{variant:`danger`,size:`icon-sm`,className:`absolute top-1.5 right-1.5 w-5 h-5 rounded-full bg-overlay text-text-secondary leading-none hover:text-status-error hover:bg-danger-bg`,onClick:t=>{t.stopPropagation(),n(e)},title:`移除`,children:`×`})]})}function Oe(e){return(0,O.jsxs)(`button`,{type:`button`,onClick:e.onClick,"aria-label":`新建项目`,className:`relative bg-transparent border-2 border-dashed border-border rounded-lg overflow-hidden cursor-pointer transition-all duration-150 hover:border-accent hover:-translate-y-0.5 h-full min-h-[188px] flex flex-col items-center justify-center gap-2 text-text-secondary hover:text-accent focus:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,O.jsx)(`span`,{className:`text-3xl leading-none`,"aria-hidden":`true`,children:`+`}),(0,O.jsx)(`span`,{className:`text-sm font-medium`,children:`新建项目`})]})}function ke({projects:e,onAdd:t,onCreate:n,onOpen:r,onRemove:i,thumbnails:a}){let[o,s]=(0,D.useState)(``),c=(0,D.useMemo)(()=>{if(!o.trim())return e;let t=o.trim().toLowerCase();return e.filter(e=>(e.name||``).toLowerCase().includes(t)||(e.path||``).toLowerCase().includes(t))},[e,o]),l=n??(()=>{}),u=e.length>0&&c.length===0;return(0,O.jsx)(`div`,{className:`flex flex-col h-screen bg-bg`,children:(0,O.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-6`,children:[(0,O.jsxs)(`div`,{className:`flex items-center justify-between mb-6 gap-4`,children:[(0,O.jsx)(`div`,{className:`flex items-center flex-1 max-w-xs min-w-0`,children:(0,O.jsxs)(`div`,{className:`relative w-full`,children:[(0,O.jsx)(we,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-text-secondary pointer-events-none`}),(0,O.jsx)(y,{placeholder:`搜索`,value:o,onChange:e=>s(e.target.value),className:`w-full h-8 pl-8 pr-3 rounded-md text-sm`})]})}),(0,O.jsx)(S,{variant:`ghost`,size:`sm`,onClick:t,className:`shrink-0 text-accent hover:text-accent-hover hover:bg-transparent`,children:`导入`})]}),u?(0,O.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-72 text-text-dim gap-3`,children:[(0,O.jsx)(`span`,{className:`text-5xl opacity-40`,children:`🔍`}),(0,O.jsx)(`span`,{className:`text-sm`,children:`未找到匹配的项目`})]}):(0,O.jsxs)(`div`,{className:`grid gap-4`,style:{gridTemplateColumns:`repeat(auto-fill, minmax(220px, 1fr))`},children:[(0,O.jsx)(Oe,{onClick:l}),c.map(e=>(0,O.jsx)(De,{project:e,onOpen:r,onRemove:i,thumbnail:a?.[e.path]},e.path))]})]})})}function Ae(e){return e.trim().replace(/[\\/:*?"<>|]+/g,`-`).replace(/\s+/g,`-`).replace(/-{2,}/g,`-`).replace(/^[-.]+|[-.]+$/g,``)}function je(e,t){return t?e?e.endsWith(`/`)?`${e}${t}`:`${e}/${t}`:t:``}function Me(e){let{open:t,templates:n,defaultBaseDir:r,onSubmit:i,onCancel:a,onBrowse:o}=e,[s,c]=(0,D.useState)(``),[l,u]=(0,D.useState)(``),[d,f]=(0,D.useState)(n[0]?.id??`blank`),p=(0,D.useRef)(!1);if((0,D.useEffect)(()=>{n.find(e=>e.id===d)||f(n[0]?.id??`blank`)},[n,d]),(0,D.useEffect)(()=>{t&&(c(``),u(``),p.current=!1)},[t]),!t)return null;let m=s.trim().length>0&&l.trim().length>0;function h(e){if(c(e),!p.current){let t=Ae(e);u(t?je(r??``,t):``)}}function g(e){p.current=!0,u(e)}async function _(){let e=await o();e&&(p.current=!0,u(e))}function v(){m&&i({name:s.trim(),path:l.trim(),templateId:d})}return(0,O.jsx)(`div`,{role:`dialog`,"aria-label":`新建项目`,className:`fixed inset-0 z-50 flex items-center justify-center bg-black/40`,children:(0,O.jsxs)(`div`,{className:`bg-surface rounded-lg shadow-lg w-[560px] max-w-[90vw] p-6`,children:[(0,O.jsx)(`h2`,{className:`text-base font-semibold text-text-white mb-4`,children:`新建项目`}),(0,O.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,O.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[(0,O.jsx)(`span`,{className:`text-text-secondary`,children:`项目名`}),(0,O.jsx)(`input`,{"aria-label":`项目名`,type:`text`,value:s,onChange:e=>h(e.target.value),placeholder:`My App`,className:`h-8 px-2 rounded-md border border-border bg-bg text-sm text-text-white`})]}),(0,O.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[(0,O.jsx)(`span`,{className:`text-text-secondary`,children:`目录`}),(0,O.jsxs)(`div`,{className:`flex gap-2`,children:[(0,O.jsx)(`input`,{"aria-label":`目录`,type:`text`,value:l,onChange:e=>g(e.target.value),placeholder:`/absolute/path/to/dir`,className:`flex-1 h-8 px-2 rounded-md border border-border bg-bg text-sm text-text-white`}),(0,O.jsx)(`button`,{type:`button`,onClick:_,className:`px-3 h-8 rounded-md border border-border text-sm text-text-secondary hover:text-text-white`,children:`浏览`})]})]}),(0,O.jsxs)(`div`,{className:`flex flex-col gap-1 text-sm`,children:[(0,O.jsx)(`span`,{className:`text-text-secondary`,children:`模板`}),(0,O.jsx)(`div`,{className:`grid gap-2`,style:{gridTemplateColumns:`repeat(auto-fill, minmax(160px, 1fr))`},children:n.map(e=>{let t=e.id===d;return(0,O.jsxs)(`button`,{type:`button`,onClick:()=>f(e.id),className:[`text-left p-3 rounded-md border`,t?`border-accent text-text-white bg-accent/10`:`border-border text-text-secondary hover:border-accent`].join(` `),"aria-pressed":t,children:[(0,O.jsx)(`div`,{className:`text-sm font-medium`,children:e.name}),e.description?(0,O.jsx)(`div`,{className:`text-[11px] mt-1 text-text-dim`,children:e.description}):null]},e.id)})})]})]}),(0,O.jsxs)(`div`,{className:`flex justify-end gap-2 mt-6`,children:[(0,O.jsx)(`button`,{type:`button`,onClick:a,className:`px-3 h-8 rounded-md border border-border text-sm text-text-secondary hover:text-text-white`,children:`取消`}),(0,O.jsx)(`button`,{type:`button`,onClick:v,disabled:!m,className:`px-3 h-8 rounded-md text-sm bg-accent text-white disabled:opacity-40 disabled:cursor-not-allowed`,children:`创建`})]})]})})}function Ne(){return m(n.GetBranding)}function Pe(){return u(c.List)}function Fe(){return m(d.OpenDirectory)}function Ie(e){return u(c.Add,e)}function Le(e){return m(c.Remove,e)}function Re(e){return u(i.Open,e)}function ze(e){return u(i.GetPages,e)}function Be(e){return u(i.GetCompileConfig,e)}function Ve(e,t){return u(i.SaveCompileConfig,e,t)}function He(e){return p(i.Status,t=>e(t))}function Ue(e){return p(i.CompileLog,t=>e(t))}function We(e){return m(i.CaptureThumbnail,e)}function Ge(e){return m(i.GetThumbnail,e)}function Ke(){return u(c.ListTemplates)}function qe(){return m(c.OpenCreateDialog)}function Je(e){return u(c.Create,e)}function Ye(){return u(c.GetCreateDefaults)}var Xe={selected:`simulator`,simulatorVisible:!0};function Ze(e){return e+48}function Qe(e,t){return Math.max(200,Math.min(t-200,e))}function $e(e){let{initialDevice:t}=e,[n,r]=(0,D.useState)(t),[i,a]=(0,D.useState)(85),[o,s]=(0,D.useState)(()=>Ze(t.width)),c=(0,D.useRef)(o),l=(0,D.useRef)(n);(0,D.useEffect)(()=>{c.current=o},[o]),(0,D.useEffect)(()=>{l.current=n},[n]);let u=(0,D.useCallback)(e=>{re({brand:`Apple`,model:e.name,system:e.system,platform:`ios`,pixelRatio:e.pixelRatio,screenWidth:e.width,screenHeight:e.height,statusBarHeight:e.statusBarHeight,notchType:e.notchType,safeAreaInsets:{...e.safeAreaInsets}})},[]);return{device:n,zoom:i,simPanelWidth:o,setSimPanelWidth:s,handleDeviceChange:(0,D.useCallback)(e=>{let t=ue.find(t=>t.name===e.target.value)??ue[1];r(t),u(t),s(Ze(t.width))},[u]),handleZoomChange:(0,D.useCallback)(e=>{a(Number(e.target.value))},[]),handleSplitterDrag:(0,D.useCallback)((e,t=`trailing`)=>{e.preventDefault();let n=e.clientX,r=c.current,i=e=>{let i=e.clientX-n;s(Qe(r+(t===`trailing`?i:-i),window.innerWidth))},a=()=>{window.removeEventListener(`mousemove`,i),window.removeEventListener(`mouseup`,a)};window.addEventListener(`mousemove`,i),window.addEventListener(`mouseup`,a)},[]),sendDeviceInfo:u,simPanelWidthRef:c,deviceRef:l}}var et=200,tt=300;function nt(e){let{projectPath:t}=e,[n,r]=(0,D.useState)({status:`compiling`,message:`正在编译...`}),[i,a]=(0,D.useState)(null),[o,s]=(0,D.useState)([]),[c,l]=(0,D.useState)(0),[u,d]=(0,D.useState)({startPage:``,scene:fe,queryParams:[]});(0,D.useEffect)(()=>{let e=!1;async function n(){try{let n=await Re(t);if(e)return;if(!n.success){r({status:`error`,message:n.error});return}let[i,o]=await Promise.all([ze(t),Be(t)]);if(e)return;a(n.appInfo),l(n.port),s(i.pages),d({startPage:o.startPage||i.entryPagePath||i.pages[0]||``,scene:o.scene??1001,queryParams:o.queryParams||[]}),r({status:`ready`,message:`编译完成`})}catch(t){if(e)return;r({status:`error`,message:t instanceof Error?t.message:String(t)})}}return n(),()=>{e=!0}},[t]);let[f,p]=(0,D.useState)(0),[m,h]=(0,D.useState)([]),[g,_]=(0,D.useState)([]),v=(0,D.useRef)(0);(0,D.useEffect)(()=>{h([]),_([])},[t]),(0,D.useEffect)(()=>He(e=>{r(e);let t=++v.current;h(n=>{let r=e.hotReload===!0?{at:Date.now(),status:e.status,message:e.message,hotReload:!0,seq:t}:{at:Date.now(),status:e.status,message:e.message,seq:t},i=[...n,r];return i.length>et?i.slice(i.length-et):i}),e.hotReload===!0&&p(e=>e+1)}),[]),(0,D.useEffect)(()=>Ue(e=>{let t=++v.current;_(n=>{let r=[...n,{...e,seq:t}];return r.length>tt?r.slice(r.length-tt):r})}),[]);let y=(0,D.useCallback)(()=>{h([]),_([])},[]),b=(0,D.useRef)(!1);return{compileStatus:n,appInfo:i,port:c,pages:o,compileConfig:u,hotReloadToken:f,compileEvents:m,compileLogs:g,clearCompileEvents:y,relaunch:(0,D.useCallback)(async(e=u)=>{try{if(!i?.appId||b.current)return;b.current=!0,r({status:`ready`,message:`正在刷新...`});try{await Ve(t,e),d(e),r({status:`ready`,message:`刷新完成`})}finally{b.current=!1}}catch(e){b.current=!1,r({status:`error`,message:e instanceof Error?e.message:`刷新失败`})}},[i,u,t])}}var rt=[`appId`,`entry`,`page`];function it(e){return encodeURIComponent(e).replace(/%2F/g,`/`).replace(/%2C/g,`,`)}function at(e){let t=Object.keys(e.query);if(t.length===0)return e.pagePath;let n=t.map(t=>`${encodeURIComponent(t)}=${encodeURIComponent(e.query[t]??``)}`).join(`&`);return`${e.pagePath}?${n}`}function ot(e){let t=e.indexOf(`?`);if(t<0)return{pagePath:e,query:{}};let n=e.slice(0,t),r={};for(let n of e.slice(t+1).split(`&`)){if(!n)continue;let e=n.indexOf(`=`),t=e>=0?n.slice(0,e):n,i=e>=0?n.slice(e+1):``;t&&(r[decodeURIComponent(t)]=decodeURIComponent(i))}return{pagePath:n,query:r}}function st(e,t,n={}){let r=at(t),i=[`appId=${it(e)}`,`entry=${it(r)}`,`page=${it(r)}`];for(let[e,t]of Object.entries(n))rt.includes(e)||i.push(`${encodeURIComponent(e)}=${it(t)}`);return i.join(`&`)}function ct(e){let t=e.host??`localhost`,n=e.pathname??`/simulator.html`,r=st(e.appId,e.page,e.extras??{});return`http://${t}:${e.port}${n}?${r}`}function lt(e,t,n,r){let i=t.startPage||`pages/index/index`,a={};for(let e of t.queryParams??[])e.key&&(a[e.key]=e.value);a.scene=String(t.scene??1001);let o={};return r?.length&&(o.apiNamespaces=r.join(`,`)),ct({appId:e,page:{pagePath:i,query:a},port:n,extras:o})}function ut(e){let t=new URLSearchParams(e.startsWith(`?`)?e.slice(1):e),n=t.get(`appId`),r=t.get(`entry`);if(!n||!r)return null;let i=ot(r),a=t.get(`page`);return{appId:n,entry:i,current:a&&a!==r?ot(a):i}}function dt(e){if(!e)return null;try{return ut(new URL(e).search)}catch{return null}}function ft(e){return dt(e)?.current.pagePath??``}function pt(e){let{compileStatus:t,sendDeviceInfo:n,simPanelWidthRef:r,deviceRef:i,appInfo:a,compileConfig:o,port:s,projectPath:c,hotReloadToken:l}=e,u=(0,D.useMemo)(()=>!a||!s?``:lt(a.appId,o,s),[a,o,s]),[d,f]=(0,D.useState)(()=>ft(u));(0,D.useEffect)(()=>{f(ft(u))},[u]),(0,D.useEffect)(()=>ne(e=>{e&&f(e)}),[]);let p=(0,D.useRef)({currentPage:d,compileConfig:o,appInfo:a,port:s});(0,D.useEffect)(()=>{p.current={currentPage:d,compileConfig:o,appInfo:a,port:s}});let m=(0,D.useRef)(l);return(0,D.useEffect)(()=>{if(t.status!==`ready`||!u)return;let e=l!==m.current;m.current=l;let a=u;if(e){let e=p.current;if(e.appInfo&&e.port){let t=e.currentPage||e.compileConfig.startPage;a=lt(e.appInfo.appId,t===e.compileConfig.startPage?e.compileConfig:{...e.compileConfig,startPage:t,queryParams:[]},e.port)}}n(i.current);let o=!1,s=null;return ie(a,r.current).then(()=>{o||(s=window.setTimeout(()=>{o||We(c).catch(()=>{})},3e3))}).catch(()=>{}),()=>{o=!0,s!==null&&window.clearTimeout(s)}},[t.status,u,l,r,i,n,c]),{simulatorUrl:u,currentPage:d}}function mt(e){return(e??``).replace(/^\/+/,``)}function ht(e,t=``){let n=e.map(e=>e.id),r=n.join(`\0`),[i,a]=(0,D.useState)(null),[o,s]=(0,D.useState)(``),[c,l]=(0,D.useState)(t);if(r!==o){let e=o?o.split(`\0`):[];n.some(t=>!e.includes(t))&&a(null),s(r)}t!==c&&(a(null),l(t));let u=t?e.find(e=>mt(e.pagePath)===mt(t))?.id??null:null;return{activeBridgeId:i&&n.includes(i)?i:u??n.at(-1)??null,setActiveBridge:e=>{n.includes(e)&&a(e)}}}function gt(e){let{getChannel:t,eventChannel:n,initial:r,enabled:i}=e,[a,o]=(0,D.useState)(r),s=(0,D.useCallback)(()=>{i&&m(t).then(e=>{e!==void 0&&o(e)})},[i,t]);return(0,D.useEffect)(()=>{i&&s()},[i,s]),(0,D.useEffect)(()=>{if(i)return p(n,e=>o(e))},[i,n]),{data:a,refresh:s}}var _t={bridges:[],entries:{}};function vt(e){let{compileStatus:t,activePagePath:n=``}=e,[r,i]=(0,D.useState)([]),o=t.status===`ready`,c=gt({getChannel:s.GetSnapshot,eventChannel:s.Event,initial:null,enabled:o}),u=gt({getChannel:a.GetSnapshot,eventChannel:a.Event,initial:_t,enabled:o}),d=u.data,{activeBridgeId:h,setActiveBridge:g}=ht(d.bridges,n),_={bridges:d.bridges,activeBridgeId:h,entries:d.entries},v=g,y=u.refresh,b=(0,D.useCallback)(async()=>{let e=await m(l.GetSnapshot);e&&i(e)},[]),x=(0,D.useCallback)(async(e,t)=>await m(l.Set,{key:e,value:t})??{ok:!1,error:`ipc transport failed`},[]),S=(0,D.useCallback)(async e=>await m(l.Remove,{key:e})??{ok:!1,error:`ipc transport failed`},[]),C=(0,D.useCallback)(async()=>await m(l.Clear)??{ok:!1,error:`ipc transport failed`},[]),w=(0,D.useCallback)(async()=>await m(l.ClearAll)??{ok:!1,error:`ipc transport failed`},[]),T=(0,D.useCallback)(async()=>await m(l.GetActivePrefix)??``,[]),E=(0,D.useCallback)(async e=>await m(f.Inspect,e),[]),ee=(0,D.useCallback)(async()=>{await m(f.Clear)},[]);return(0,D.useEffect)(()=>p(l.Event,e=>{e.type===`cleared`?i([]):e.type===`added`||e.type===`updated`?i(t=>{let n=t.findIndex(t=>t.key===e.key),r=n>=0?[...t]:[...t,{key:e.key,value:e.newValue}];return n>=0&&(r[n]={key:e.key,value:e.newValue}),r}):e.type===`removed`&&i(t=>t.filter(t=>t.key!==e.key))}),[]),{wxmlTree:c.data,appData:_,storageItems:r,refreshWxml:c.refresh,refreshAppData:y,setActiveAppDataBridge:v,refreshStorage:b,setStorageItem:x,removeStorageItem:S,clearStorage:C,clearAllStorage:w,getStoragePrefix:T,inspectWxmlElement:E,clearWxmlElementInspection:ee}}function yt(e){let{initialRightPane:t}=e,[n,r]=(0,D.useState)(t);return{rightPane:n,selectRightPane:(0,D.useCallback)(e=>{r({selected:e,simulatorVisible:!0})},[]),toggleRightPaneVisible:(0,D.useCallback)(()=>{r(e=>({...e,simulatorVisible:!e.simulatorVisible}))},[])}}function bt(e){let{relaunch:t,compileConfig:n,pages:r,compileDropdownRef:i}=e,[a,o]=(0,D.useState)(!1),s=(0,D.useRef)(t);(0,D.useEffect)(()=>{s.current=t},[t]),(0,D.useEffect)(()=>{let e=ae(()=>o(!1)),t=C(e=>{o(!1),s.current(e)});return()=>{e(),t()}},[]);let c=(0,D.useRef)(n),l=(0,D.useRef)(r);return(0,D.useEffect)(()=>{c.current=n},[n]),(0,D.useEffect)(()=>{l.current=r},[r]),{showCompilePanel:a,toggleCompilePanel:(0,D.useCallback)(()=>{o(e=>{if(e)return te(),!1;let t=i.current;if(!t)return e;let n=t.getBoundingClientRect();return E({top:Math.round(n.bottom-40+6),left:Math.round(n.left),config:c.current,pages:l.current}),!0})},[i])}}function xt(e){let{projectPath:t,initialDevice:n=ue[1],initialRightPane:r=Xe}=e,i=(0,D.useRef)(null),a=(0,D.useRef)(null),o=$e({initialDevice:n}),s=nt({projectPath:t});(0,D.useEffect)(()=>{s.compileStatus.status===`ready`&&o.setSimPanelWidth(o.device.width+48)},[o.device.width,s.compileStatus.status,o.setSimPanelWidth]);let c=pt({compileStatus:s.compileStatus,sendDeviceInfo:o.sendDeviceInfo,simPanelWidthRef:o.simPanelWidthRef,deviceRef:o.deviceRef,appInfo:s.appInfo,compileConfig:s.compileConfig,port:s.port,projectPath:t,hotReloadToken:s.hotReloadToken}),l=vt({compileStatus:s.compileStatus,activePagePath:c.currentPage}),u=yt({initialRightPane:r}),d=bt({relaunch:s.relaunch,compileConfig:s.compileConfig,pages:s.pages,compileDropdownRef:a});return{session:{compileStatus:s.compileStatus,appInfo:s.appInfo,port:s.port,pages:s.pages,compileConfig:s.compileConfig,compileEvents:s.compileEvents,compileLogs:s.compileLogs,clearCompileEvents:s.clearCompileEvents,relaunch:s.relaunch},device:{device:o.device,zoom:o.zoom,simPanelWidth:o.simPanelWidth,setSimPanelWidth:o.setSimPanelWidth,handleDeviceChange:o.handleDeviceChange,handleZoomChange:o.handleZoomChange,handleSplitterDrag:o.handleSplitterDrag,sendDeviceInfo:o.sendDeviceInfo},simulator:{simulatorRef:i,simulatorUrl:c.simulatorUrl,currentPage:c.currentPage},panelData:{wxmlTree:l.wxmlTree,appData:l.appData,storageItems:l.storageItems,refreshWxml:l.refreshWxml,refreshAppData:l.refreshAppData,setActiveAppDataBridge:l.setActiveAppDataBridge,refreshStorage:l.refreshStorage,setStorageItem:l.setStorageItem,removeStorageItem:l.removeStorageItem,clearStorage:l.clearStorage,clearAllStorage:l.clearAllStorage,getStoragePrefix:l.getStoragePrefix,inspectWxmlElement:l.inspectWxmlElement,clearWxmlElementInspection:l.clearWxmlElementInspection},rightPane:{rightPane:u.rightPane,selectRightPane:u.selectRightPane,toggleRightPaneVisible:u.toggleRightPaneVisible},popover:{compileDropdownRef:a,showCompilePanel:d.showCompilePanel,toggleCompilePanel:d.toggleCompilePanel}}}var St={dockTree:null,simulatorAlignment:`left`,devtoolsPosition:`inEditor`},Ct=`dimina-devtools.layout.v1`;function wt(){try{let e=window.localStorage.getItem(Ct);if(!e)return St;let t=JSON.parse(e);return{dockTree:typeof t.dockTree==`string`?t.dockTree:null,simulatorAlignment:t.simulatorAlignment===`right`?`right`:`left`,devtoolsPosition:t.devtoolsPosition===`belowSimulator`||t.devtoolsPosition===`rightOfSimulator`?t.devtoolsPosition:`inEditor`}}catch{return St}}function Tt(e){try{window.localStorage.setItem(Ct,JSON.stringify(e))}catch{}}function Et(){let[e,t]=(0,D.useState)(wt);return(0,D.useEffect)(()=>{Tt(e)},[e]),{state:e,setDockTree:(0,D.useCallback)(e=>{t(t=>t.dockTree===e?t:{...t,dockTree:e})},[]),setSimulatorAlignment:(0,D.useCallback)(e=>{t(t=>t.simulatorAlignment===e?t:{...t,simulatorAlignment:e})},[]),setDevtoolsPosition:(0,D.useCallback)(e=>{t(t=>t.devtoolsPosition===e?t:{...t,devtoolsPosition:e})},[])}}var Dt={compiling:`bg-status-warn animate-[pulse_1s_infinite]`,ready:`bg-accent`,error:`bg-status-error`};function Ot({status:e}){return(0,O.jsx)(`span`,{className:_(`w-1.5 h-1.5 rounded-full shrink-0`,Dt[e]??`bg-border`)})}function kt(){let e=new Map;return{register(t){return e.set(t.id,t),{dispose(){e.get(t.id)===t&&e.delete(t.id)}}},get(t){return e.get(t)},list(){return[...e.values()]}}}var At=64;function jt(e){return JSON.stringify(e)}function Mt(e,t,n,r){e===void 0?r.push(`node missing string id (kind=${String(t)})`):n.seenIds.has(e)?r.push(`duplicate node id: ${e}`):n.seenIds.add(e)}function Nt(e,t,n,r){if(typeof e!=`string`){r.push(`tabs ${t??`?`}: non-string panel id`);return}n.panelOwners.get(e)===void 0?n.panelOwners.set(e,t??`?`):r.push(`duplicate panel id across groups: ${e}`),n.knownPanelIds&&!n.knownPanelIds.has(e)&&r.push(`orphan panel not in known panel ids: ${e}`)}function Pt(e,t,n,r){let i=e,a=Array.isArray(i.panels)?i.panels:null;if(!a){r.push(`tabs ${t??`?`}: panels is not an array`);return}a.length===0&&r.push(`tabs ${t??`?`}: empty tabgroup`);for(let e of a)Nt(e,t,n,r);let o=i.active;(typeof o!=`string`||!a.includes(o))&&r.push(`tabs ${t??`?`}: active ${String(o)} not in panels`)}function Ft(e,t,n){if(e===null)return!1;if(typeof e!=`object`)return n.push(`split ${t??`?`}: constraint is not null nor an object: ${String(e)}`),!1;let r=Object.keys(e),i=r.includes(`fixedPx`),a=r.includes(`minPx`);(r.length!==1||!(i||a))&&n.push(`split ${t??`?`}: constraint must have exactly one of 'fixedPx' or 'minPx', got [${r.join(`, `)}]`);let o=i?`fixedPx`:`minPx`,s=i?e.fixedPx:e.minPx;return(typeof s!=`number`||!Number.isFinite(s)||s<=0)&&n.push(`split ${t??`?`}: constraint ${o} must be a finite number > 0, got ${String(s)}`),!0}function It(e,t,n){let r=Array.isArray(e)?e:null;if(!r){n.push(`split ${t??`?`}: constraints is not an array`);return}let i=r.length>0;for(let e of r)Ft(e,t,n)||(i=!1);i&&n.push(`split ${t??`?`}: all children are px-sized constraints; at least one must be weight-sized`)}function Lt(e,t,n,r){if(!e||e.length!==t.length){r.push(`split ${n??`?`}: sizes ${e?e.length:`missing`} != children ${t.length}`);return}for(let t of e)(typeof t!=`number`||!Number.isFinite(t))&&r.push(`split ${n??`?`}: non-finite size ${String(t)}`)}function Rt(e,t){let n=[],r={seenIds:new Set,seenObjects:new Set,panelOwners:new Map,knownPanelIds:t},i=(e,t,a)=>{if(t>At){n.push(`depth exceeds ${At}`);return}if(typeof e!=`object`||!e){n.push(`node is not an object: ${String(e)}`);return}let o=e;if(a.has(o)){n.push(`cycle detected: node reachable from itself`);return}if(r.seenObjects.has(o)){n.push(`shared node reference: same object appears twice`);return}r.seenObjects.add(o);let s=e,c=s.kind,l=typeof s.id==`string`?s.id:void 0;Mt(l,c,r,n),c===`tabs`?Pt(e,l,r,n):c===`split`?zt(e,l,t,a,o,r,n,i):n.push(`unknown node kind: ${String(c)}`)};return i(e,0,new Set),n}function zt(e,t,n,r,i,a,o,s){let c=e,l=Array.isArray(c.children)?c.children:null,u=Array.isArray(c.sizes)?c.sizes:null,d=c.orientation;if(d!==`row`&&d!==`column`&&o.push(`split ${t??`?`}: invalid orientation ${String(d)}`),c.constraints!==void 0&&It(c.constraints,t,o),!l){o.push(`split ${t??`?`}: children is not an array`);return}if(l.length<2&&o.push(`split ${t??`?`}: must have >= 2 children, has ${l.length}`),Lt(u,l,t,o),c.constraints!==void 0&&Array.isArray(c.constraints)){let e=c.constraints;e.length!==l.length&&o.push(`split ${t??`?`}: constraints ${e.length} != children ${l.length}`)}let f=new Set(r);f.add(i);for(let e of l)s(e,n+1,f)}function Bt(e,t){return typeof e!=`object`||!e?[`tree is not an object`]:e.version===1?Rt(e.root,t):[`unsupported version: ${String(e.version)}`]}function Vt(e){let t;try{t=JSON.parse(e)}catch{throw Error(`parseLayout: input is not valid JSON`)}if(typeof t!=`object`||!t)throw Error(`parseLayout: top-level value is not an object`);let n=t;if(n.version!==1)throw Error(`parseLayout: unsupported version ${String(n.version)}`);if(n.root===void 0||n.root===null)throw Error(`parseLayout: missing root`);let r=Rt(n.root,null);if(r.length>0)throw Error(`parseLayout: illegal layout — ${r.join(`; `)}`);return{version:1,root:n.root}}var Ht=1;function Ut(e,t){return(e.constraints?.[t]??null)===null}function Wt(e){if(e.kind===`tabs`)return e;let t=e.children.map(Wt),n=t.some((t,n)=>t!==e.children[n]),r=e.sizes.map((t,r)=>!Ut(e,r)||typeof t==`number`&&Number.isFinite(t)&&t>0?t:(n=!0,Ht));if(!n)return e;let i={kind:`split`,id:e.id,orientation:e.orientation,children:t,sizes:r};return e.constraints===void 0?i:{...i,constraints:e.constraints}}function Gt(e){let t=Wt(e.root);return t===e.root?e:{version:1,root:t}}function k(e,t,n){return{kind:`tabs`,id:e,panels:t,active:n}}function Kt(e,t,n){if(e.length===0)return``;if(e.includes(t))return t;let r=Math.min(n,e.length-1);return e[Math.max(0,r)]}function qt(e){if(e.kind===`tabs`)return e.panels.length===0?null:e;let t=[],n=[],r=[],i=e.constraints!==void 0;if(e.children.forEach((a,o)=>{let s=qt(a);s!==null&&(t.push(s),n.push(e.sizes[o]??1),i&&r.push(e.constraints[o]??null))}),t.length===0)return null;if(t.length===1)return t[0];let a={kind:`split`,id:e.id,orientation:e.orientation,children:t,sizes:n};return i?(r.length>0&&!r.some(e=>e===null)&&(r[r.length-1]=null),{...a,constraints:r}):a}function Jt(e){let t=qt(e);if(t===null)throw Error(`mutation would empty the entire layout`);return t}function Yt(e,t){let n=null,r=e=>{n||(e.kind===`tabs`?e.panels.includes(t)&&(n=e):e.children.forEach(r))};return r(e),n?{group:n}:null}function Xt(e,t){let n=null,r=e=>{n||(e.kind===`tabs`?e.id===t&&(n=e):e.children.forEach(r))};return r(e),n}function Zt(e){let t=new Set,n=e=>{if(e.kind===`tabs`)for(let n of e.panels)t.add(n);else e.children.forEach(n)};return n(e),t}function Qt(e,t){return Zt(e).has(t)}function $t(e){let t=new Set,n=e=>{t.add(e.id),e.kind===`split`&&e.children.forEach(n)};return n(e),t}function en(e,t){let n=t,r=2;for(;e.has(n);)n=`${t}#${r}`,r+=1;return e.add(n),n}function tn(e,t){let n=null,r=e=>{n||e.kind===`split`&&(e.id===t&&(n=e),e.children.forEach(r))};return r(e),n}function A(e,t,n){if(e.id===t)return n;if(e.kind===`tabs`)return k(e.id,[...e.panels],e.active);let r={kind:`split`,id:e.id,orientation:e.orientation,children:e.children.map(e=>A(e,t,n)),sizes:[...e.sizes]};return e.constraints===void 0?r:{...r,constraints:[...e.constraints]}}function nn(e){if(e.kind===`tabs`)return k(e.id,[...e.panels],e.active);let t={kind:`split`,id:e.id,orientation:e.orientation,children:e.children.map(nn),sizes:[...e.sizes]};return e.constraints===void 0?t:{...t,constraints:[...e.constraints]}}function j(e){return{version:1,root:e}}function rn(e,t,n){let r=tn(e.root,t);if(!r)throw Error(`setSizes: split not found: ${t}`);if(n.length!==r.children.length)throw Error(`setSizes: sizes length ${n.length} != children length ${r.children.length}`);if(!n.every(e=>Number.isFinite(e)))throw Error(`setSizes: every size must be a finite number, got [${n.join(`, `)}]`);let i={kind:`split`,id:r.id,orientation:r.orientation,children:r.children.map(nn),sizes:[...n]},a=r.constraints===void 0?i:{...i,constraints:[...r.constraints]};return j(A(e.root,t,a))}function an(e,t,n,r){let i=tn(e.root,t);if(!i)throw Error(`setConstraint: split not found: ${t}`);if(!Number.isInteger(n))throw Error(`setConstraint: childIndex must be an integer, got ${n}`);if(n<0||n>=i.children.length)throw Error(`setConstraint: childIndex ${n} out of range [0, ${i.children.length})`);let a=i.constraints===void 0?i.children.map(()=>null):[...i.constraints];if(a[n]=r,a.length>0&&a.every(e=>e!==null))return e;let o={kind:`split`,id:i.id,orientation:i.orientation,children:i.children.map(nn),sizes:[...i.sizes],constraints:a};return j(A(e.root,t,o))}function on(e,t,n){let r=Xt(e.root,t);if(!r)throw Error(`setActive: group not found: ${t}`);if(!r.panels.includes(n))throw Error(`setActive: panel ${n} not in group ${t}`);let i=k(r.id,[...r.panels],n);return j(A(e.root,t,i))}function sn(e,t){let n=Yt(e,t);if(!n)throw Error(`panel not found: ${t}`);let{group:r}=n,i=r.panels.indexOf(t),a=r.panels.filter(e=>e!==t),o=k(r.id,a,Kt(a,r.active,i));return Jt(A(e,r.id,o))}function cn(e,t){let n=Zt(e.root);return n.size===1&&n.has(t)?e:j(sn(e.root,t))}function ln(e,t){if(!Yt(e.root,t))throw Error(`extractPanel: panel not found: ${t}`);return{tree:j(sn(e.root,t)),extracted:t}}function un(e,t,n){if(Qt(e.root,t))throw Error(`insertPanel: panel already exists in the tree: ${t}`);let r=Xt(e.root,n.groupId);if(!r)throw Error(`insertPanel: dest group not found: ${n.groupId}`);let i=[...r.panels],a=dn(n.index,i.length);i.splice(a,0,t);let o=k(r.id,i,r.active);return j(Jt(A(e.root,r.id,o)))}function dn(e,t){return e===void 0?t:e<0?0:e>t?t:e}function fn(e,t,n){let r=Yt(e.root,t);if(!r)throw Error(`movePanel: panel not found: ${t}`);let i=Xt(e.root,n.groupId);if(!i)throw Error(`movePanel: dest group not found: ${n.groupId}`);if(r.group.id===i.id){let i=r.group.panels.filter(e=>e!==t),a=dn(n.index,i.length),o=[...i];o.splice(a,0,t);let s=k(r.group.id,o,r.group.active);return j(Jt(A(e.root,r.group.id,s)))}let a=r.group.panels.indexOf(t),o=r.group.panels.filter(e=>e!==t),s=k(r.group.id,o,Kt(o,r.group.active,a)),c=[...i.panels],l=dn(n.index,c.length);c.splice(l,0,t);let u=k(i.id,c,i.active),d=A(e.root,r.group.id,s);return d=A(d,i.id,u),j(Jt(d))}function M(e,t,n,r,i){if(Qt(e.root,r))throw Error(`splitPanel: new panel already exists in the tree: ${r}`);let a=Yt(e.root,t);if(!a)throw Error(`splitPanel: panel not found: ${t}`);let{group:o}=a,s=$t(e.root),c=o.id,l=k(en(s,`${c}__split`),[t],t),u=k(en(s,`${c}__new`),[r],r),d=i===`after`?[l,u]:[u,l],f={kind:`split`,id:en(s,`${c}__sp`),orientation:n,children:d,sizes:[1,1]};if(o.panels.length===1)return j(Jt(A(e.root,c,f)));let p=o.panels.indexOf(t),m=o.panels.filter(e=>e!==t),h=k(c,m,Kt(m,o.active,p)),g=i===`after`?[h,f]:[f,h],_={kind:`split`,id:en(s,`${c}__outer`),orientation:n,children:g,sizes:[1,1]};return j(Jt(A(e.root,c,_)))}function pn(e){let t=structuredClone(e),n=0,r=new Set,i=!1,a=[],o=e=>{t=e(t),n+=1;let i={tree:t,revision:n};for(let e of[...r])try{e(i)}catch{}};return{get(){return t},apply(e){if(i){a.push(e);return}i=!0;try{for(o(e);a.length>0;){let e=a.shift();try{o(e)}catch{}}}finally{i=!1}},subscribe(e){return r.add(e),()=>{r.delete(e)}}}}function mn(e,t,n){return n.get(t)?.closable===!1?e:cn(e,t)}function hn(){let e=kt();return e.register({kind:`dom`,id:`simulator`,title:`Simulator`,draggable:!1,hideTab:!0}),e.register({kind:`dom`,id:`editor`,title:`Editor`,draggable:!1,hideTab:!0}),e.register({kind:`dom`,id:`wxml`,title:`WXML`,dropPolicy:`reorder-only`,closable:!1}),e.register({kind:`dom`,id:`appdata`,title:`AppData`,dropPolicy:`reorder-only`,closable:!1}),e.register({kind:`dom`,id:`storage`,title:`Storage`,dropPolicy:`reorder-only`,closable:!1}),e.register({kind:`native`,id:`console`,title:`Console`,nativeRef:{id:`console`},dropPolicy:`reorder-only`,closable:!1}),e.register({kind:`dom`,id:`compile`,title:`编译`,dropPolicy:`reorder-only`,closable:!1}),e}function gn(e){return{version:1,root:{kind:`split`,id:`root`,orientation:`row`,sizes:[1,6],constraints:[{minPx:e},null],children:[{kind:`tabs`,id:`g-sim`,panels:[`simulator`],active:`simulator`},{kind:`split`,id:`col-main`,orientation:`column`,sizes:[70,30],children:[{kind:`tabs`,id:`g-editor`,panels:[`editor`],active:`editor`},{kind:`tabs`,id:`g-debug`,panels:[`wxml`,`appdata`,`storage`,`console`,`compile`],active:`wxml`}]}]}}}var _n={kind:`tabs`,id:`g-debug`,panels:[`wxml`,`appdata`,`storage`,`console`,`compile`],active:`wxml`},vn=()=>({kind:`tabs`,id:`g-sim`,panels:[`simulator`],active:`simulator`}),yn=()=>({kind:`tabs`,id:`g-editor`,panels:[`editor`],active:`editor`}),bn=()=>({..._n,panels:[..._n.panels]});function xn(e,t,n,r){return{version:1,root:{kind:`split`,id:`root`,orientation:`row`,sizes:e.map((e,t)=>r[t]??1),constraints:e.map((e,r)=>r===t?{minPx:n}:null),children:e}}}function Sn(e,t,n){let r=t===`left`;if(n===`belowSimulator`){let t={kind:`split`,id:`col-sim`,orientation:`column`,sizes:[60,40],children:[vn(),bn()]};return r?xn([t,yn()],0,e,[1,6]):xn([yn(),t],1,e,[6,1])}if(n===`rightOfSimulator`)return r?xn([vn(),bn(),yn()],0,e,[1,4,5]):xn([yn(),bn(),vn()],2,e,[5,4,1]);let i={kind:`split`,id:`col-main`,orientation:`column`,sizes:[70,30],children:[yn(),bn()]};return r?xn([vn(),i],0,e,[1,6]):xn([i,vn()],1,e,[6,1])}function Cn(e,t,n){return pn(wn(e,t,n))}function wn(e,t,n){if(e===null)return gn(t);try{let t=Vt(e);if(Bt(t,n).length===0)return Gt(t)}catch{}return gn(t)}var Tn=[`wxml`,`appdata`,`storage`,`console`,`compile`];function En(e,t){if(e.kind===`tabs`){for(let n of e.panels)t.add(n);return}for(let n of e.children)En(n,t)}function Dn(e){let t=new Set;return En(e.root,t),t}function On(e,t){if(e.kind===`tabs`)return e.panels.includes(t)?e.id:void 0;for(let n of e.children){let e=On(n,t);if(e!==void 0)return e}}function kn(e,t){return t.find(t=>e.has(t))}function An(e,t){if(e.kind===`tabs`)return null;for(let n=0;n<e.children.length;n++){if(e.children[n].id===t)return{splitId:e.id,childIndex:n};let r=An(e.children[n],t);if(r)return r}return null}function jn(e,t){let n=On(e.root,`simulator`);if(!n)return e;let r=An(e.root,n);return r?an(e,r.splitId,r.childIndex,{minPx:t}):e}function Mn(e,t,n){let r=Dn(e);if(r.has(t))return e;if(Tn.includes(t)){let n=Tn.find(e=>e!==t&&r.has(e));return n?un(e,t,{groupId:On(e.root,n)}):r.has(`editor`)?M(e,`editor`,`column`,t,`after`):r.has(`simulator`)?M(e,`simulator`,`row`,t,`after`):M(e,[...r][0],`column`,t,`after`)}if(t===`editor`){let t=kn(r,Tn);return t?M(e,t,`column`,`editor`,`before`):r.has(`simulator`)?M(e,`simulator`,`row`,`editor`,`after`):M(e,[...r][0],`column`,`editor`,`before`)}return t===`simulator`?jn(M(e,kn(r,[`editor`,...Tn])??[...r][0],`row`,`simulator`,`before`),n):M(e,[...r][0],`column`,t,`after`)}function Nn(e,t){let n=Dn(e);return t.list().map(e=>({id:e.id,title:e.title??e.id,open:n.has(e.id)}))}var Pn=[`wxml`,`appdata`,`storage`,`console`,`compile`];function Fn({model:e,registry:t,simPanelWidth:n}){let[,r]=(0,D.useState)(0);(0,D.useEffect)(()=>e.subscribe(()=>r(e=>e+1)),[e]);let i=new Set(Nn(e.get(),t).filter(e=>e.open).map(e=>e.id)),a=i.has(`simulator`),o=i.has(`editor`),s=Pn.some(e=>i.has(e)),c=[a,o,s].filter(Boolean).length;function l(r,i){e.apply(e=>i?mn(e,r,t):Mn(e,r,n))}function u(){if(s){let t=Pn.filter(e=>i.has(e));e.apply(e=>t.reduce((e,t)=>cn(e,t),e))}else{let t=Pn.filter(e=>!i.has(e));e.apply(e=>t.reduce((e,t)=>Mn(e,t,n),e))}}return(0,O.jsxs)(`div`,{className:`flex items-center gap-0.5`,role:`group`,"aria-label":`面板可见性`,children:[(0,O.jsx)(Rn,{active:a,disabled:a&&c===1,onClick:()=>l(`simulator`,a),title:a?`隐藏模拟器`:`显示模拟器`,testId:`layout-toolbar-toggle-simulator`,icon:(0,O.jsx)(zn,{filled:a})}),(0,O.jsx)(Rn,{active:o,disabled:o&&c===1,onClick:()=>l(`editor`,o),title:o?`隐藏编辑器`:`显示编辑器`,testId:`layout-toolbar-toggle-editor`,icon:(0,O.jsx)(Bn,{filled:o})}),(0,O.jsx)(Rn,{active:s,disabled:s&&c===1,onClick:u,title:s?`隐藏调试器`:`显示调试器`,testId:`layout-toolbar-toggle-debug`,icon:(0,O.jsx)(Vn,{filled:s})})]})}function In({model:e,layout:t,simPanelWidth:n}){let{simulatorAlignment:r,devtoolsPosition:i}=t.state,a=r===`left`;function o(){let r=a?`right`:`left`;t.setSimulatorAlignment(r),e.apply(()=>Sn(n,r,i))}return(0,O.jsx)(S,{variant:`icon`,size:`icon`,onClick:o,title:a?`模拟器位置:左侧(点击切换到右侧)`:`模拟器位置:右侧(点击切换到左侧)`,"data-testid":`layout-toolbar-alignment-toggle`,"data-alignment":r,className:`text-text-muted hover:text-text hover:bg-surface-3`,children:(0,O.jsx)(Hn,{side:r})})}function Ln({model:e,layout:t,simPanelWidth:n}){let{simulatorAlignment:r,devtoolsPosition:i}=t.state;function a(i){t.setDevtoolsPosition(i),e.apply(()=>Sn(n,r,i))}return(0,O.jsx)(`div`,{className:`flex items-center gap-0.5`,role:`group`,"aria-label":`调试器位置`,children:[{id:`inEditor`,title:`调试器位置:在编辑器面板中`},{id:`belowSimulator`,title:`调试器位置:在模拟器下方`},{id:`rightOfSimulator`,title:`调试器位置:在模拟器右侧`}].map(e=>(0,O.jsx)(Rn,{active:i===e.id,onClick:()=>a(e.id),title:e.title,testId:`layout-toolbar-devtools-${e.id}`,icon:(0,O.jsx)(Un,{variant:e.id})},e.id))})}function Rn({active:e,disabled:t,onClick:n,title:r,testId:i,icon:a}){return(0,O.jsx)(S,{variant:`icon`,size:`icon`,onClick:n,disabled:t,title:r,"aria-pressed":e,"data-testid":i,"data-active":e?`true`:`false`,className:_(`text-text-muted/45 hover:text-text-muted hover:bg-surface-3`,e&&`bg-surface-active text-text ring-1 ring-accent/50 hover:bg-surface-active hover:text-text`),children:a})}function zn({filled:e}){return(0,O.jsx)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.4`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:e?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`rect`,{x:`4`,y:`1.5`,width:`8`,height:`13`,rx:`1.5`,fill:`currentColor`,stroke:`currentColor`}),(0,O.jsx)(`line`,{x1:`6.5`,y1:`12.5`,x2:`9.5`,y2:`12.5`,stroke:`var(--color-surface-2)`,strokeWidth:`1.2`})]}):(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`rect`,{x:`4`,y:`1.5`,width:`8`,height:`13`,rx:`1.5`}),(0,O.jsx)(`line`,{x1:`6.5`,y1:`12.5`,x2:`9.5`,y2:`12.5`})]})})}function Bn({filled:e}){return(0,O.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:e?2:1.6,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,O.jsx)(`polyline`,{points:`5,4 1.5,8 5,12`}),(0,O.jsx)(`polyline`,{points:`11,4 14.5,8 11,12`}),(0,O.jsx)(`line`,{x1:`9.5`,y1:`3`,x2:`6.5`,y2:`13`})]})}function Vn({filled:e}){return(0,O.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.4`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[e?(0,O.jsx)(`ellipse`,{cx:`8`,cy:`9`,rx:`3.5`,ry:`4.5`,fill:`currentColor`,stroke:`currentColor`}):(0,O.jsx)(`ellipse`,{cx:`8`,cy:`9`,rx:`3.5`,ry:`4.5`}),(0,O.jsx)(`line`,{x1:`6`,y1:`3.5`,x2:`5`,y2:`2`}),(0,O.jsx)(`line`,{x1:`10`,y1:`3.5`,x2:`11`,y2:`2`}),(0,O.jsx)(`line`,{x1:`4.5`,y1:`7.5`,x2:`2`,y2:`6.5`}),(0,O.jsx)(`line`,{x1:`4.5`,y1:`9.5`,x2:`2`,y2:`9.5`}),(0,O.jsx)(`line`,{x1:`4.5`,y1:`11.5`,x2:`2`,y2:`12.5`}),(0,O.jsx)(`line`,{x1:`11.5`,y1:`7.5`,x2:`14`,y2:`6.5`}),(0,O.jsx)(`line`,{x1:`11.5`,y1:`9.5`,x2:`14`,y2:`9.5`}),(0,O.jsx)(`line`,{x1:`11.5`,y1:`11.5`,x2:`14`,y2:`12.5`})]})}function Hn({side:e}){return(0,O.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.4`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,O.jsx)(`rect`,{x:`2`,y:`3`,width:`12`,height:`10`,rx:`1.5`}),e===`left`?(0,O.jsx)(`rect`,{x:`2.6`,y:`3.6`,width:`4.8`,height:`8.8`,rx:`0.8`,fill:`currentColor`,stroke:`none`}):(0,O.jsx)(`rect`,{x:`8.6`,y:`3.6`,width:`4.8`,height:`8.8`,rx:`0.8`,fill:`currentColor`,stroke:`none`})]})}function Un({variant:e}){return e===`inEditor`?(0,O.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.2`,"aria-hidden":`true`,children:[(0,O.jsx)(`rect`,{x:`2`,y:`3`,width:`12`,height:`10`,rx:`1.5`}),(0,O.jsx)(`line`,{x1:`6.5`,y1:`3`,x2:`6.5`,y2:`13`}),(0,O.jsx)(`rect`,{x:`7.1`,y:`8.5`,width:`6.3`,height:`4`,rx:`0.6`,fill:`currentColor`,stroke:`none`})]}):e===`belowSimulator`?(0,O.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.2`,"aria-hidden":`true`,children:[(0,O.jsx)(`rect`,{x:`2`,y:`3`,width:`12`,height:`10`,rx:`1.5`}),(0,O.jsx)(`line`,{x1:`8`,y1:`3`,x2:`8`,y2:`13`}),(0,O.jsx)(`rect`,{x:`2.6`,y:`8.5`,width:`4.8`,height:`4`,rx:`0.6`,fill:`currentColor`,stroke:`none`})]}):(0,O.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.2`,"aria-hidden":`true`,children:[(0,O.jsx)(`rect`,{x:`2`,y:`3`,width:`12`,height:`10`,rx:`1.5`}),(0,O.jsx)(`line`,{x1:`6`,y1:`3`,x2:`6`,y2:`13`}),(0,O.jsx)(`line`,{x1:`9.5`,y1:`3`,x2:`9.5`,y2:`13`}),(0,O.jsx)(`rect`,{x:`6.3`,y:`3.6`,width:`3`,height:`8.8`,rx:`0.6`,fill:`currentColor`,stroke:`none`})]})}function Wn(){return(0,O.jsx)(`div`,{className:`w-px h-4 bg-border mx-1`,"aria-hidden":`true`})}function Gn({compileDropdownRef:e,showCompilePanel:t,onToggleCompilePanel:n,onRelaunch:r,compileStatus:i,dockModel:a,dockRegistry:o,layout:s,simPanelWidth:c}){return(0,O.jsx)(`div`,{className:`flex flex-col shrink-0`,children:(0,O.jsxs)(`div`,{className:`flex items-center gap-1.5 px-2.5 bg-surface-2 border-b border-border shrink-0`,style:{height:40},children:[(0,O.jsx)(`div`,{ref:e,children:(0,O.jsxs)(S,{variant:`outline`,size:`sm`,onClick:n,className:_(t&&`border-accent`),title:`编译模式`,children:[`普通编译 `,(0,O.jsx)(`span`,{className:`text-[10px] text-text-secondary`,children:`▾`})]})}),(0,O.jsx)(Wn,{}),(0,O.jsx)(S,{variant:`icon`,size:`icon`,onClick:()=>{r()},disabled:i.status===`compiling`,title:`重新编译`,children:`↺`}),(0,O.jsxs)(`div`,{className:`flex items-center gap-1.5 px-1.5 shrink-0`,children:[(0,O.jsx)(Ot,{status:i.status}),(0,O.jsx)(`span`,{className:`text-[11px] text-text-muted max-w-28 truncate`,children:i.message})]}),(0,O.jsx)(`div`,{className:`flex-1 min-w-2`}),(0,O.jsx)(Fn,{model:a,registry:o,simPanelWidth:c}),(0,O.jsx)(Wn,{}),(0,O.jsx)(In,{model:a,layout:s,simPanelWidth:c}),(0,O.jsx)(Wn,{}),(0,O.jsx)(Ln,{model:a,layout:s,simPanelWidth:c}),(0,O.jsx)(Wn,{}),(0,O.jsx)(S,{variant:`icon`,size:`icon`,onClick:()=>{pe(!0)},title:`设置`,children:`⚙`})]})})}var Kn={x:0,y:0,width:0,height:0},qn=e=>({x:Math.round(e.x),y:Math.round(e.y),width:Math.max(0,Math.round(e.width)),height:Math.max(0,Math.round(e.height))});function Jn(e,t){let n=t.present,r=t.publish,i=null,a=null,o=!1,s=()=>{let t=e.getBoundingClientRect();return qn({x:t.left,y:t.top,width:t.width,height:t.height})},c=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,l=()=>{if(o||!n)return;let e=s();a&&c(a,e)||(a=e,r(e))},u=()=>{i||(i=new ResizeObserver(l),i.observe(e),window.addEventListener(`resize`,l))},d=()=>{i&&=(i.disconnect(),null),window.removeEventListener(`resize`,l)},f=()=>{a=null,n?(u(),a=s(),r(a)):(d(),r(Kn))};return f(),{update(e){o||(r=e.publish,n=e.present,f())},dispose(){o||(o=!0,d())}}}function Yn(e){let t=e.getBoundingClientRect();return{visible:!0,bounds:qn({x:t.left,y:t.top,width:t.width,height:t.height})}}var Xn=(e,t)=>e.visible===t.visible?e.visible&&t.visible?e.bounds.x===t.bounds.x&&e.bounds.y===t.bounds.y&&e.bounds.width===t.bounds.width&&e.bounds.height===t.bounds.height:!0:!1;function Zn(e,t){let n=t.visible,r=t.publish,i=t.guardDisplayNone??!1,a=t.followScroll??!1,o=t.followGeometry??!1,s=null,c=null,l=null,u=!1,d=null,f=0,p=!1,m=null,h=()=>{let t=Yn(e);return i&&t.visible&&(t.bounds.width===0||t.bounds.height===0)?{visible:!1}:t},g=()=>{if(u||!n)return;let e=h();l&&Xn(l,e)||(l=e,r(e))},_=()=>{if(d=null,u||!n){m=null;return}if(m!==null&&performance.now()>=m){m=null;return}let e=h();if(l&&Xn(l,e)){if(f++,f>=2&&!p){m=null;return}}else l=e,r(e),f=0;!u&&n?d=requestAnimationFrame(_):m=null},v=()=>{!o||u||(f=0,d===null&&(d=requestAnimationFrame(_)))},y=()=>{d!==null&&(cancelAnimationFrame(d),d=null),f=0,m=null,p=!1},b=()=>{o?v():g()},x=e=>{let t=e.target;t&&t.closest&&t.closest(`[role="separator"]`)&&(p=!0,v())},S=()=>{p&&(p=!1,v())},C=()=>{s||(s=new ResizeObserver(g),s.observe(e),window.addEventListener(`resize`,g),i&&typeof IntersectionObserver<`u`&&(c=new IntersectionObserver(g),c.observe(e)),a&&window.addEventListener(`scroll`,b,{capture:!0,passive:!0}),o&&(window.addEventListener(`pointerdown`,x,{capture:!0}),window.addEventListener(`pointerup`,S,{capture:!0})))},w=()=>{s&&=(s.disconnect(),null),c&&=(c.disconnect(),null),window.removeEventListener(`resize`,g),window.removeEventListener(`scroll`,b,{capture:!0}),window.removeEventListener(`pointerdown`,x,{capture:!0}),window.removeEventListener(`pointerup`,S,{capture:!0}),y()},T=()=>{if(l=null,n)C(),l=h(),r(l);else{w();let e={visible:!1};l=e,r(e)}};return T(),{update(e){u||(r=e.publish,n=e.visible,T())},dispose(){u||(u=!0,w())},pulse(e){if(!(u||!o)){if(e!==void 0&&e>0){let t=performance.now()+e;m=m===null?t:Math.max(m,t)}v()}}}}function Qn(e){let t=(0,D.useRef)(null),n=(0,D.useRef)(null),r=(0,D.useRef)(e);r.current=e;let i=(0,D.useRef)([e.present,e.publish,...e.deps??[]]),a=(0,D.useRef)(()=>{let e=t.current;e&&(e.update({present:!1,publish:r.current.publish}),e.dispose(),t.current=null)}),o=(0,D.useCallback)(e=>{e!==n.current&&(n.current=e,t.current&&(e?(t.current.dispose(),t.current=null):a.current()),e&&(t.current=Jn(e,{present:r.current.present,publish:r.current.publish}),i.current=[r.current.present,r.current.publish,...r.current.deps??[]]))},[]);return(0,D.useEffect)(()=>{let n=[e.present,e.publish,...e.deps??[]],r=i.current;(n.length!==r.length||n.some((e,t)=>!Object.is(e,r[t])))&&(i.current=n,t.current?.update({present:e.present,publish:e.publish}))},[e.present,e.publish,...e.deps??[]]),(0,D.useEffect)(()=>{let e=a.current;return n.current&&!t.current&&(t.current=Jn(n.current,{present:r.current.present,publish:r.current.publish})),()=>{n.current===null&&e()}},[]),o}function $n(e,t){let n=getComputedStyle(e);return t*parseFloat(n.fontSize)}function er(e,t){let n=getComputedStyle(e.ownerDocument.body);return t*parseFloat(n.fontSize)}function tr(e){return e/100*window.innerHeight}function nr(e){return e/100*window.innerWidth}function rr(e){switch(typeof e){case`number`:return[e,`px`];case`string`:{let t=parseFloat(e);return e.endsWith(`%`)?[t,`%`]:e.endsWith(`px`)?[t,`px`]:e.endsWith(`rem`)?[t,`rem`]:e.endsWith(`em`)?[t,`em`]:e.endsWith(`vh`)?[t,`vh`]:e.endsWith(`vw`)?[t,`vw`]:[t,`%`]}}}function ir({groupSize:e,panelElement:t,styleProp:n}){let r,[i,a]=rr(n);switch(a){case`%`:r=i/100*e;break;case`px`:r=i;break;case`rem`:r=er(t,i);break;case`em`:r=$n(t,i);break;case`vh`:r=tr(i);break;case`vw`:r=nr(i);break}return r}function N(e){return parseFloat(e.toFixed(3))}function ar({group:e}){let{orientation:t,panels:n}=e;return n.reduce((e,n)=>(e+=t===`horizontal`?n.element.offsetWidth:n.element.offsetHeight,e),0)}function or(e){let{panels:t}=e,n=ar({group:e});return n===0?t.map(e=>({groupResizeBehavior:e.panelConstraints.groupResizeBehavior,collapsedSize:0,collapsible:e.panelConstraints.collapsible===!0,defaultSize:void 0,disabled:e.panelConstraints.disabled,minSize:0,maxSize:100,panelId:e.id})):t.map(e=>{let{element:t,panelConstraints:r}=e,i=0;r.collapsedSize!==void 0&&(i=N(ir({groupSize:n,panelElement:t,styleProp:r.collapsedSize})/n*100));let a;r.defaultSize!==void 0&&(a=N(ir({groupSize:n,panelElement:t,styleProp:r.defaultSize})/n*100));let o=0;r.minSize!==void 0&&(o=N(ir({groupSize:n,panelElement:t,styleProp:r.minSize})/n*100));let s=100;return r.maxSize!==void 0&&(s=N(ir({groupSize:n,panelElement:t,styleProp:r.maxSize})/n*100)),{groupResizeBehavior:r.groupResizeBehavior,collapsedSize:i,collapsible:r.collapsible===!0,defaultSize:a,disabled:r.disabled,minSize:o,maxSize:s,panelId:e.id}})}function P(e,t=`Assertion error`){if(!e)throw Error(t)}function sr(e,t){return Array.from(t).sort(e===`horizontal`?cr:lr)}function cr(e,t){let n=e.element.offsetLeft-t.element.offsetLeft;return n===0?e.element.offsetWidth-t.element.offsetWidth:n}function lr(e,t){let n=e.element.offsetTop-t.element.offsetTop;return n===0?e.element.offsetHeight-t.element.offsetHeight:n}function ur(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.ELEMENT_NODE}function dr(e,t){return{x:e.x>=t.left&&e.x<=t.right?0:Math.min(Math.abs(e.x-t.left),Math.abs(e.x-t.right)),y:e.y>=t.top&&e.y<=t.bottom?0:Math.min(Math.abs(e.y-t.top),Math.abs(e.y-t.bottom))}}function fr({orientation:e,rects:t,targetRect:n}){let r={x:n.x+n.width/2,y:n.y+n.height/2},i,a=Number.MAX_VALUE;for(let n of t){let{x:t,y:o}=dr(r,n),s=e===`horizontal`?t:o;s<a&&(a=s,i=n)}return P(i,`No rect found`),i}var pr;function mr(){return pr===void 0&&(pr=typeof matchMedia==`function`?!!matchMedia(`(pointer:coarse)`).matches:!1),pr}function hr(e){let{element:t,orientation:n,panels:r,separators:i}=e,a=sr(n,Array.from(t.children).filter(ur).map(e=>({element:e}))).map(({element:e})=>e),o=[],s=!1,c=!1,l=-1,u=-1,d=0,f,p=[];{let e=-1;for(let t of a)t.hasAttribute(`data-panel`)&&(e++,t.hasAttribute(`data-disabled`)||(d++,l===-1&&(l=e),u=e))}if(d>1){let t=-1;for(let d of a)if(d.hasAttribute(`data-panel`)){t++;let i=r.find(e=>e.element===d);if(i){if(f){let r=f.element.getBoundingClientRect(),a=d.getBoundingClientRect(),m;if(c){let e=n===`horizontal`?new DOMRect(r.right,r.top,0,r.height):new DOMRect(r.left,r.bottom,r.width,0),t=n===`horizontal`?new DOMRect(a.left,a.top,0,a.height):new DOMRect(a.left,a.top,a.width,0);switch(p.length){case 0:m=[e,t];break;case 1:{let i=p[0];m=[i,fr({orientation:n,rects:[r,a],targetRect:i.element.getBoundingClientRect()})===r?t:e];break}default:m=p;break}}else m=p.length?p:[n===`horizontal`?new DOMRect(r.right,a.top,a.left-r.right,a.height):new DOMRect(a.left,r.bottom,a.width,a.top-r.bottom)];for(let n of m){let r=`width`in n?n:n.element.getBoundingClientRect(),a=mr()?e.resizeTargetMinimumSize.coarse:e.resizeTargetMinimumSize.fine;if(r.width<a){let e=a-r.width;r=new DOMRect(r.x-e/2,r.y,r.width+e,r.height)}if(r.height<a){let e=a-r.height;r=new DOMRect(r.x,r.y-e/2,r.width,r.height+e)}!s&&!(t<=l||t>u)&&o.push({group:e,groupSize:ar({group:e}),panels:[f,i],separator:`width`in n?void 0:n,rect:r}),s=!1}}c=!1,f=i,p=[]}}else if(d.hasAttribute(`data-separator`)){d.ariaDisabled!==null&&(s=!0);let e=i.find(e=>e.element===d);e?p.push(e):(f=void 0,p=[])}else c=!0}return o}var gr=class{#e={};addListener(e,t){let n=this.#e[e];return n===void 0?this.#e[e]=[t]:n.includes(t)||n.push(t),()=>{this.removeListener(e,t)}}emit(e,t){let n=this.#e[e];if(n!==void 0)if(n.length===1)n[0].call(null,t);else{let e=!1,r=null,i=Array.from(n);for(let n=0;n<i.length;n++){let a=i[n];try{a.call(null,t)}catch(t){r===null&&(e=!0,r=t)}}if(e)throw r}}removeAllListeners(){this.#e={}}removeListener(e,t){let n=this.#e[e];if(n!==void 0){let e=n.indexOf(t);e>=0&&n.splice(e,1)}}},F=new Map,_r=new gr;function vr(e){F=new Map(F),F.delete(e)}function yr(e,t){for(let[t]of F)if(t.id===e)return t}function I(e,t){for(let[t,n]of F)if(t.id===e)return n;if(t)throw Error(`Could not find data for Group with id ${e}`)}function br(){return F}function xr(e,t){return _r.addListener(`groupChange`,n=>{n.group.id===e&&t(n)})}function L(e,t){let n=F.get(e);F=new Map(F),F.set(e,t),_r.emit(`groupChange`,{group:e,prev:n,next:t})}function Sr(e,t,n){let r,i={x:1/0,y:1/0};for(let a of t){let t=dr(n,a.rect);switch(e){case`horizontal`:t.x<=i.x&&(r=a,i=t);break;case`vertical`:t.y<=i.y&&(r=a,i=t);break}}return r?{distance:i,hitRegion:r}:void 0}function Cr(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function wr(e,t){if(e===t)throw Error(`Cannot compare node with itself`);let n={a:Ar(e),b:Ar(t)},r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();P(r,`Stacking order can only be calculated for elements with a common ancestor`);let i={a:kr(Or(n.a)),b:kr(Or(n.b))};if(i.a===i.b){let e=r.childNodes,t={a:n.a.at(-1),b:n.b.at(-1)},i=e.length;for(;i--;){let n=e[i];if(n===t.a)return 1;if(n===t.b)return-1}}return Math.sign(i.a-i.b)}var Tr=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function Er(e){let t=getComputedStyle(jr(e)??e).display;return t===`flex`||t===`inline-flex`}function Dr(e){let t=getComputedStyle(e);return!!(t.position===`fixed`||t.zIndex!==`auto`&&(t.position!==`static`||Er(e))||+t.opacity<1||`transform`in t&&t.transform!==`none`||`webkitTransform`in t&&t.webkitTransform!==`none`||`mixBlendMode`in t&&t.mixBlendMode!==`normal`||`filter`in t&&t.filter!==`none`||`webkitFilter`in t&&t.webkitFilter!==`none`||`isolation`in t&&t.isolation===`isolate`||Tr.test(t.willChange)||t.webkitOverflowScrolling===`touch`)}function Or(e){let t=e.length;for(;t--;){let n=e[t];if(P(n,`Missing node`),Dr(n))return n}return null}function kr(e){return e&&Number(getComputedStyle(e).zIndex)||0}function Ar(e){let t=[];for(;e;)t.push(e),e=jr(e);return t}function jr(e){let{parentNode:t}=e;return Cr(t)?t.host:t}function Mr(e,t){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function Nr({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!ur(n)||n.contains(e)||e.contains(n))return!0;if(wr(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(Mr(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function Pr(e,t){let n=[];return t.forEach((t,r)=>{if(r.disabled)return;let i=hr(r),a=Sr(r.orientation,i,{x:e.clientX,y:e.clientY});a&&a.distance.x<=0&&a.distance.y<=0&&Nr({groupElement:r.element,hitRegion:a.hitRegion.rect,pointerEventTarget:e.target})&&n.push(a.hitRegion)}),n}function Fr(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function R(e,t,n=0){return Math.abs(N(e)-N(t))<=n}function z(e,t){return R(e,t)?0:e>t?1:-1}function Ir({overrideDisabledPanels:e,panelConstraints:t,prevSize:n,size:r}){let{collapsedSize:i=0,collapsible:a,disabled:o,maxSize:s=100,minSize:c=0}=t;if(o&&!e)return n;if(z(r,c)<0)if(a){let e=(i+c)/2;r=z(r,e)<0?i:c}else r=c;return r=Math.min(s,r),r=N(r),r}function Lr({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:a}){if(R(e,0))return t;let o=a===`imperative-api`,s=Object.values(t),c=Object.values(i),l=[...s],[u,d]=r;P(u!=null,`Invalid first pivot index`),P(d!=null,`Invalid second pivot index`);let f=0;switch(a){case`keyboard`:{let t=e<0?d:u,r=n[t];P(r,`Panel constraints not found for index ${t}`);let{collapsedSize:i=0,collapsible:a,minSize:o=0}=r;if(a){let n=s[t];if(P(n!=null,`Previous layout not found for panel index ${t}`),R(n,i)){let t=o-n;z(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let t=e<0?u:d,r=n[t];P(r,`No panel constraints found for index ${t}`);let{collapsedSize:i=0,collapsible:a,minSize:o=0}=r;if(a){let n=s[t];if(P(n!=null,`Previous layout not found for panel index ${t}`),R(n,o)){let t=n-i;z(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}break;default:{let t=e<0?d:u,r=n[t];P(r,`Panel constraints not found for index ${t}`);let i=s[t],{collapsible:a,collapsedSize:o,minSize:c}=r;if(a&&z(i,c)<0)if(e>0){let t=c-o,n=t/2;z(i+e,c)<0&&(e=z(e,n)<=0?0:t)}else{let t=c-o,n=100-t/2;z(i-e,c)<0&&(e=z(100+e,n)>0?0:-t)}break}}{let t=e<0?1:-1,r=e<0?d:u,i=0;for(;;){let e=s[r];P(e!=null,`Previous layout not found for panel index ${r}`);let a=Ir({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:e,size:100})-e;if(i+=a,r+=t,r<0||r>=n.length)break}let a=Math.min(Math.abs(e),Math.abs(i));e=e<0?0-a:a}{let t=e<0?u:d;for(;t>=0&&t<n.length;){let r=Math.abs(e)-Math.abs(f),i=s[t];P(i!=null,`Previous layout not found for panel index ${t}`);let a=i-r,c=Ir({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:i,size:a});if(!R(i,c)&&(f+=i-c,l[t]=c,f.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?t--:t++}}if(Fr(c,l))return i;{let t=e<0?d:u,r=s[t];P(r!=null,`Previous layout not found for panel index ${t}`);let i=r+f,a=Ir({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:r,size:i});if(l[t]=a,!R(a,i)){let t=i-a,r=e<0?d:u;for(;r>=0&&r<n.length;){let i=l[r];P(i!=null,`Previous layout not found for panel index ${r}`);let a=i+t,s=Ir({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:i,size:a});if(R(i,s)||(t-=s-i,l[r]=s),R(t,0))break;e>0?r--:r++}}}if(!R(Object.values(l).reduce((e,t)=>t+e,0),100,.1))return i;let p=Object.keys(i);return l.reduce((e,t,n)=>(e[p[n]]=t,e),{})}function Rr(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(t[n]===void 0||z(e[n],t[n])!==0)return!1;return!0}function zr({layout:e,panelConstraints:t}){let n=Object.values(e),r=[...n],i=r.reduce((e,t)=>e+t,0);if(r.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${r.map(e=>`${e}%`).join(`, `)}`);if(!R(i,100)&&r.length>0)for(let e=0;e<t.length;e++){let t=r[e];P(t!=null,`No layout data found for index ${e}`),r[e]=100/i*t}let a=0;for(let e=0;e<t.length;e++){let i=n[e];P(i!=null,`No layout data found for index ${e}`);let o=r[e];P(o!=null,`No layout data found for index ${e}`);let s=Ir({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:i,size:o});o!=s&&(a+=o-s,r[e]=s)}if(!R(a,0))for(let e=0;e<t.length;e++){let n=r[e];P(n!=null,`No layout data found for index ${e}`);let i=n+a,o=Ir({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:n,size:i});if(n!==o&&(a-=o-n,r[e]=o,R(a,0)))break}let o=Object.keys(e);return r.reduce((e,t,n)=>(e[o[n]]=t,e),{})}function Br({groupId:e,panelId:t}){let n=()=>{let t=br();for(let[n,{defaultLayoutDeferred:r,derivedPanelConstraints:i,layout:a,groupSize:o,separatorToPanels:s}]of t)if(n.id===e)return{defaultLayoutDeferred:r,derivedPanelConstraints:i,group:n,groupSize:o,layout:a,separatorToPanels:s};throw Error(`Group ${e} not found`)},r=()=>{let e=n().derivedPanelConstraints.find(e=>e.panelId===t);if(e!==void 0)return e;throw Error(`Panel constraints not found for Panel ${t}`)},i=()=>{let e=n().group.panels.find(e=>e.id===t);if(e!==void 0)return e;throw Error(`Layout not found for Panel ${t}`)},a=()=>{let e=n().layout[t];if(e!==void 0)return e;throw Error(`Layout not found for Panel ${t}`)},o=e=>{let r=a();if(e===r)return;let{defaultLayoutDeferred:i,derivedPanelConstraints:o,group:s,groupSize:c,layout:l,separatorToPanels:u}=n(),d=s.panels.findIndex(e=>e.id===t),f=d===s.panels.length-1,p=zr({layout:Lr({delta:f?r-e:e-r,initialLayout:l,panelConstraints:o,pivotIndices:f?[d-1,d]:[d,d+1],prevLayout:l,trigger:`imperative-api`}),panelConstraints:o});Rr(l,p)||L(s,{defaultLayoutDeferred:i,derivedPanelConstraints:o,groupSize:c,layout:p,separatorToPanels:u})};return{collapse:()=>{let{collapsible:e,collapsedSize:t}=r(),{mutableValues:n}=i(),s=a();e&&s!==t&&(n.expandToSize=s,o(t))},expand:()=>{let{collapsible:e,collapsedSize:t,minSize:n}=r(),{mutableValues:s}=i(),c=a();if(e&&c===t){let e=s.expandToSize??n;e===0&&(e=1),o(e)}},getSize:()=>{let{group:e}=n(),t=a(),{element:r}=i();return{asPercentage:t,inPixels:e.orientation===`horizontal`?r.offsetWidth:r.offsetHeight}},isCollapsed:()=>{let{collapsible:e,collapsedSize:t}=r(),n=a();return e&&R(t,n)},resize:e=>{let{group:t}=n(),{element:r}=i(),a=ar({group:t});o(N(ir({groupSize:a,panelElement:r,styleProp:e})/a*100))}}}function Vr(e){e.defaultPrevented||Pr(e,br()).forEach(t=>{if(t.separator&&!t.separator.disableDoubleClick){let n=t.panels.find(e=>e.panelConstraints.defaultSize!==void 0);if(n){let r=n.panelConstraints.defaultSize,i=Br({groupId:t.group.id,panelId:n.id});i&&r!==void 0&&(i.resize(r),e.preventDefault())}}})}function Hr(e){let t=br();for(let[n]of t)if(n.separators.some(t=>t.element===e))return n;throw Error(`Could not find parent Group for separator element`)}function Ur({groupId:e}){let t=()=>{let t=br();for(let[n,r]of t)if(n.id===e)return{group:n,...r};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){let{defaultLayoutDeferred:e,layout:n}=t();return e?{}:n},setLayout(e){let{defaultLayoutDeferred:n,derivedPanelConstraints:r,group:i,groupSize:a,layout:o,separatorToPanels:s}=t(),c=zr({layout:e,panelConstraints:r});return n?o:(Rr(o,c)||L(i,{defaultLayoutDeferred:n,derivedPanelConstraints:r,groupSize:a,layout:c,separatorToPanels:s}),c)}}}function Wr(e,t){let n=Hr(e),r=I(n.id,!0),i=n.separators.find(t=>t.element===e);P(i,`Matching separator not found`);let a=r.separatorToPanels.get(i);P(a,`Matching panels not found`);let o=a.map(e=>n.panels.indexOf(e)),s=Ur({groupId:n.id}).getLayout(),c=zr({layout:Lr({delta:t,initialLayout:s,panelConstraints:r.derivedPanelConstraints,pivotIndices:o,prevLayout:s,trigger:`keyboard`}),panelConstraints:r.derivedPanelConstraints});Rr(s,c)||L(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:c,separatorToPanels:r.separatorToPanels})}function Gr(e){if(e.defaultPrevented)return;let t=e.currentTarget,n=Hr(t);if(!n.disabled)switch(e.key){case`ArrowDown`:e.preventDefault(),n.orientation===`vertical`&&Wr(t,5);break;case`ArrowLeft`:e.preventDefault(),n.orientation===`horizontal`&&Wr(t,-5);break;case`ArrowRight`:e.preventDefault(),n.orientation===`horizontal`&&Wr(t,5);break;case`ArrowUp`:e.preventDefault(),n.orientation===`vertical`&&Wr(t,-5);break;case`End`:e.preventDefault(),Wr(t,100);break;case`Enter`:{e.preventDefault();let n=Hr(t),{derivedPanelConstraints:r,layout:i,separatorToPanels:a}=I(n.id,!0),o=n.separators.find(e=>e.element===t);P(o,`Matching separator not found`);let s=a.get(o);P(s,`Matching panels not found`);let c=s[0],l=r.find(e=>e.panelId===c.id);if(P(l,`Panel metadata not found`),l.collapsible){let e=i[c.id];Wr(t,(l.collapsedSize===e?n.mutableState.expandedPanelSizes[c.id]??l.minSize:l.collapsedSize)-e)}break}case`F6`:{e.preventDefault();let n=Hr(t).separators.map(e=>e.element),r=Array.from(n).findIndex(t=>t===e.currentTarget);P(r!==null,`Index not found`),n[e.shiftKey?r>0?r-1:n.length-1:r+1<n.length?r+1:0].focus({preventScroll:!0});break}case`Home`:e.preventDefault(),Wr(t,-100);break}}var Kr={cursorFlags:0,state:`inactive`},qr=new gr;function Jr(){return Kr}function Yr(e){return qr.addListener(`change`,e)}function Xr(e){let t=Kr,n={...Kr};n.cursorFlags=e,Kr=n,qr.emit(`change`,{prev:t,next:n})}function Zr(e){let t=Kr;Kr=e,qr.emit(`change`,{prev:t,next:e})}function Qr(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=br(),n=Pr(e,t),r=new Map,i=!1;n.forEach(e=>{e.separator&&(i||(i=!0,e.separator.element.focus({preventScroll:!0})));let n=t.get(e.group);n&&r.set(e.group,n.layout)}),Zr({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:`active`}),n.length&&e.preventDefault()}var $r=e=>e,ei=()=>{},ti=1,ni=2,ri=4,ii=8,ai=3,oi=12,si;function ci(){return si===void 0&&(si=!1,typeof window<`u`&&(window.navigator.userAgent.includes(`Chrome`)||window.navigator.userAgent.includes(`Firefox`))&&(si=!0)),si}function li({cursorFlags:e,groups:t,state:n}){let r=0,i=0;switch(n){case`active`:case`hover`:t.forEach(e=>{if(!e.mutableState.disableCursor)switch(e.orientation){case`horizontal`:r++;break;case`vertical`:i++;break}})}if(!(r===0&&i===0)){switch(n){case`active`:if(e&&ci()){let t=(e&ti)!==0,n=(e&ni)!==0,r=(e&ri)!==0,i=(e&ii)!==0;if(t)return r?`se-resize`:i?`ne-resize`:`e-resize`;if(n)return r?`sw-resize`:i?`nw-resize`:`w-resize`;if(r)return`s-resize`;if(i)return`n-resize`}break}return ci()?r>0&&i>0?`move`:r>0?`ew-resize`:`ns-resize`:r>0&&i>0?`grab`:r>0?`col-resize`:`row-resize`}}var ui=new WeakMap;function di(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=ui.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&e.adoptedStyleSheets.push(n));let r=Jr();switch(r.state){case`active`:case`hover`:{let e=li({cursorFlags:r.cursorFlags,groups:r.hitRegions.map(e=>e.group),state:r.state}),i=`*, *:hover {cursor: ${e} !important; }`;if(t===i)return;t=i,e?n.cssRules.length===0?n.insertRule(i):n.replaceSync(i):n.cssRules.length===1&&n.deleteRule(0);break}case`inactive`:t=void 0,n.cssRules.length===1&&n.deleteRule(0);break}ui.set(e,{prevStyle:t,styleSheet:n})}function fi({document:e,event:t,hitRegions:n,initialLayoutMap:r,mountedGroups:i,pointerDownAtPoint:a,prevCursorFlags:o}){let s=0;n.forEach(e=>{let{group:n,groupSize:o}=e,{orientation:c,panels:l}=n,{disableCursor:u}=n.mutableState,d=0;d=a?c===`horizontal`?(t.clientX-a.x)/o*100:(t.clientY-a.y)/o*100:c===`horizontal`?t.clientX<0?-100:100:t.clientY<0?-100:100;let f=r.get(n),p=i.get(n);if(!f||!p)return;let{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:_,separatorToPanels:v}=p;if(h&&_&&v){let t=Lr({delta:d,initialLayout:f,panelConstraints:h,pivotIndices:e.panels.map(e=>l.indexOf(e)),prevLayout:_,trigger:`mouse-or-touch`});if(Rr(t,_)){if(d!==0&&!u)switch(c){case`horizontal`:s|=d<0?ti:ni;break;case`vertical`:s|=d<0?ri:ii;break}}else L(e.group,{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:t,separatorToPanels:v})}});let c=0;t.movementX===0?c|=o&ai:c|=s&ai,t.movementY===0?c|=o&oi:c|=s&oi,Xr(c),di(e)}function pi(e){let t=br(),n=Jr();switch(n.state){case`active`:fi({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}}function mi(e){if(e.defaultPrevented)return;let t=Jr(),n=br();switch(t.state){case`active`:if(e.buttons===0){Zr({cursorFlags:0,state:`inactive`}),t.hitRegions.forEach(e=>{let t=I(e.group.id,!0);L(e.group,t)});return}for(let n of t.hitRegions)if(n.separator){let{element:t}=n.separator;t.hasPointerCapture?.(e.pointerId)||t.setPointerCapture?.(e.pointerId)}fi({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break;default:{let r=Pr(e,n);r.length===0?t.state!==`inactive`&&Zr({cursorFlags:0,state:`inactive`}):Zr({cursorFlags:0,hitRegions:r,state:`hover`}),di(e.currentTarget);break}}}function hi(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(Jr().state){case`hover`:Zr({cursorFlags:0,state:`inactive`})}}function gi(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=Jr();switch(t.state){case`active`:Zr({cursorFlags:0,state:`inactive`}),t.hitRegions.length>0&&(di(e.currentTarget),t.hitRegions.forEach(e=>{let t=I(e.group.id,!0);L(e.group,t)}),e.preventDefault())}}function _i(e){let t=0,n=0,r={};for(let i of e)if(i.defaultSize!==void 0){t++;let e=N(i.defaultSize);n+=e,r[i.panelId]=e}else r[i.panelId]=void 0;let i=e.length-t;if(i!==0){let t=N((100-n)/i);for(let n of e)n.defaultSize===void 0&&(r[n.panelId]=t)}return r}function vi(e,t,n){if(!n[0])return;let r=e.panels.find(e=>e.element===t);if(!r||!r.onResize)return;let i=ar({group:e}),a=e.orientation===`horizontal`?r.element.offsetWidth:r.element.offsetHeight,o=r.mutableValues.prevSize,s={asPercentage:N(a/i*100),inPixels:a};r.mutableValues.prevSize=s,r.onResize(s,r.id,o)}function yi(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function bi({group:e,nextGroupSize:t,prevGroupSize:n,prevLayout:r}){if(n<=0||t<=0||n===t)return r;let i=0,a=0,o=!1,s=new Map,c=[];for(let l of e.panels){let e=r[l.id]??0;switch(l.panelConstraints.groupResizeBehavior){case`preserve-pixel-size`:{o=!0;let r=N(e/100*n/t*100);s.set(l.id,r),i+=r;break}default:c.push(l.id),a+=e;break}}if(!o||c.length===0)return r;let l=100-i,u={...r};if(s.forEach((e,t)=>{u[t]=e}),a>0)for(let e of c)u[e]=N((r[e]??0)/a*l);else{let e=N(l/c.length);for(let t of c)u[t]=e}return u}function xi(e,t){let n=e.map(e=>e.id),r=Object.keys(t);if(n.length!==r.length)return!1;for(let e of n)if(!r.includes(e))return!1;return!0}var Si=new Map;function Ci(e){let t=!0;P(e.element.ownerDocument.defaultView,`Cannot register an unmounted Group`);let n=e.element.ownerDocument.defaultView.ResizeObserver,r=new Set,i=new Set,a=new n(n=>{for(let r of n){let{borderBoxSize:n,target:i}=r;if(i===e.element){if(t){let t=ar({group:e});if(t===0)return;let n=I(e.id);if(!n)return;let r=or(e),i=n.defaultLayoutDeferred?_i(r):n.layout,a=zr({layout:bi({group:e,nextGroupSize:t,prevGroupSize:n.groupSize,prevLayout:i}),panelConstraints:r});if(!n.defaultLayoutDeferred&&Rr(n.layout,a)&&yi(n.derivedPanelConstraints,r)&&n.groupSize===t)return;L(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:r,groupSize:t,layout:a,separatorToPanels:n.separatorToPanels})}}else vi(e,i,n)}});a.observe(e.element),e.panels.forEach(e=>{P(!r.has(e.id),`Panel ids must be unique; id "${e.id}" was used more than once`),r.add(e.id),e.onResize&&a.observe(e.element)});let o=ar({group:e}),s=or(e),c=e.panels.map(({id:e})=>e).join(`,`),l=e.mutableState.defaultLayout;l&&(xi(e.panels,l)||(l=void 0));let u=zr({layout:e.mutableState.layouts[c]??l??_i(s),panelConstraints:s}),d=e.element.ownerDocument;Si.set(d,(Si.get(d)??0)+1);let f=new Map;return hr(e).forEach(e=>{e.separator&&f.set(e.separator,e.panels)}),L(e,{defaultLayoutDeferred:o===0,derivedPanelConstraints:s,groupSize:o,layout:u,separatorToPanels:f}),e.separators.forEach(e=>{P(!i.has(e.id),`Separator ids must be unique; id "${e.id}" was used more than once`),i.add(e.id),e.element.addEventListener(`keydown`,Gr)}),Si.get(d)===1&&(d.addEventListener(`dblclick`,Vr,!0),d.addEventListener(`pointerdown`,Qr,!0),d.addEventListener(`pointerleave`,pi),d.addEventListener(`pointermove`,mi),d.addEventListener(`pointerout`,hi),d.addEventListener(`pointerup`,gi,!0)),function(){t=!1,Si.set(d,Math.max(0,(Si.get(d)??0)-1)),vr(e),e.separators.forEach(e=>{e.element.removeEventListener(`keydown`,Gr)}),Si.get(d)||(d.removeEventListener(`dblclick`,Vr,!0),d.removeEventListener(`pointerdown`,Qr,!0),d.removeEventListener(`pointerleave`,pi),d.removeEventListener(`pointermove`,mi),d.removeEventListener(`pointerout`,hi),d.removeEventListener(`pointerup`,gi,!0)),a.disconnect()}}function wi(){let[e,t]=(0,D.useState)({});return[e,(0,D.useCallback)(()=>t({}),[])]}function Ti(e){let t=(0,D.useId)();return`${e??t}`}var Ei=typeof window<`u`?D.useLayoutEffect:D.useEffect;function Di(e){let t=(0,D.useRef)(e);return Ei(()=>{t.current=e},[e]),(0,D.useCallback)((...e)=>t.current?.(...e),[t])}function Oi(...e){return Di(t=>{e.forEach(e=>{if(e)switch(typeof e){case`function`:e(t);break;case`object`:e.current=t;break}})})}function ki(e){let t=(0,D.useRef)({...e});return Ei(()=>{for(let n in e)t.current[n]=e[n]},[e]),t.current}var Ai=(0,D.createContext)(null);function ji(e,t){let n=(0,D.useRef)({getLayout:()=>({}),setLayout:$r});(0,D.useImperativeHandle)(t,()=>n.current,[]),Ei(()=>{Object.assign(n.current,Ur({groupId:e}))})}function Mi({children:e,className:t,defaultLayout:n,disableCursor:r,disabled:i,elementRef:a,groupRef:o,id:s,onLayoutChange:c,onLayoutChanged:l,orientation:u=`horizontal`,resizeTargetMinimumSize:d={coarse:20,fine:10},style:f,...p}){let m=(0,D.useRef)({onLayoutChange:{},onLayoutChanged:{}}),h=Di(e=>{Rr(m.current.onLayoutChange,e)||(m.current.onLayoutChange=e,c?.(e))}),g=Di(e=>{Rr(m.current.onLayoutChanged,e)||(m.current.onLayoutChanged=e,l?.(e))}),_=Ti(s),v=(0,D.useRef)(null),[y,b]=wi(),x=(0,D.useRef)({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:d,separators:[]}),S=Oi(v,a);ji(_,o);let C=Di((e,t)=>{let r=Jr(),i=yr(e),a=I(e);if(a){let e=!1;switch(r.state){case`active`:e=r.hitRegions.some(e=>e.group===i);break}return{flexGrow:a.layout[t]??1,pointerEvents:e?`none`:void 0}}if(n?.[t])return{flexGrow:n?.[t]}}),w=ki({defaultLayout:n,disableCursor:r}),T=(0,D.useMemo)(()=>({get disableCursor(){return!!w.disableCursor},getPanelStyles:C,id:_,orientation:u,registerPanel:e=>{let t=x.current;return t.panels=sr(u,[...t.panels,e]),b(),()=>{t.panels=t.panels.filter(t=>t!==e),b()}},registerSeparator:e=>{let t=x.current;return t.separators=sr(u,[...t.separators,e]),b(),()=>{t.separators=t.separators.filter(t=>t!==e),b()}},updatePanelProps:(e,{disabled:t})=>{let n=x.current.panels.find(t=>t.id===e);n&&(n.panelConstraints.disabled=t);let r=yr(_),i=I(_);r&&i&&L(r,{...i,derivedPanelConstraints:or(r)})},updateSeparatorProps:(e,{disabled:t,disableDoubleClick:n})=>{let r=x.current.separators.find(t=>t.id===e);r&&(r.disabled=t,r.disableDoubleClick=n)}}),[C,_,b,u,w]),E=(0,D.useRef)(null);return Ei(()=>{let e=v.current;if(e===null)return;let t=x.current,n;if(w.defaultLayout!==void 0&&Object.keys(w.defaultLayout).length===t.panels.length){n={};for(let e of t.panels){let t=w.defaultLayout[e.id];t!==void 0&&(n[e.id]=t)}}let r={disabled:!!i,element:e,id:_,mutableState:{defaultLayout:n,disableCursor:!!w.disableCursor,expandedPanelSizes:x.current.lastExpandedPanelSizes,layouts:x.current.layouts},orientation:u,panels:t.panels,resizeTargetMinimumSize:t.resizeTargetMinimumSize,separators:t.separators};E.current=r;let a=Ci(r),{defaultLayoutDeferred:o,derivedPanelConstraints:s,layout:c}=I(r.id,!0);!o&&s.length>0&&(h(c),g(c));let l=xr(_,e=>{let{defaultLayoutDeferred:t,derivedPanelConstraints:n,layout:i}=e.next;if(t||n.length===0)return;let a=r.panels.map(({id:e})=>e).join(`,`);r.mutableState.layouts[a]=i,n.forEach(t=>{if(t.collapsible){let{layout:n}=e.prev??{};if(n){let e=R(t.collapsedSize,i[t.panelId]),a=R(t.collapsedSize,n[t.panelId]);e&&!a&&(r.mutableState.expandedPanelSizes[t.panelId]=n[t.panelId])}}});let o=Jr().state!==`active`;h(i),o&&g(i)});return()=>{E.current=null,a(),l()}},[i,_,g,h,u,y,w]),(0,D.useEffect)(()=>{let e=E.current;e&&(e.mutableState.defaultLayout=n,e.mutableState.disableCursor=!!r)}),(0,O.jsx)(Ai.Provider,{value:T,children:(0,O.jsx)(`div`,{...p,className:t,"data-group":!0,"data-testid":_,id:_,ref:S,style:{height:`100%`,width:`100%`,overflow:`hidden`,...f,display:`flex`,flexDirection:u===`horizontal`?`row`:`column`,flexWrap:`nowrap`,touchAction:u===`horizontal`?`pan-y`:`pan-x`},children:e})})}Mi.displayName=`Group`;function Ni(){let e=(0,D.useContext)(Ai);return P(e,`Group Context not found; did you render a Panel or Separator outside of a Group?`),e}function Pi(e,t){let{id:n}=Ni(),r=(0,D.useRef)({collapse:ei,expand:ei,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:ei});(0,D.useImperativeHandle)(t,()=>r.current,[]),Ei(()=>{Object.assign(r.current,Br({groupId:n,panelId:e}))})}function Fi({children:e,className:t,collapsedSize:n=`0%`,collapsible:r=!1,defaultSize:i,disabled:a,elementRef:o,groupResizeBehavior:s=`preserve-relative-size`,id:c,maxSize:l=`100%`,minSize:u=`0%`,onResize:d,panelRef:f,style:p,...m}){let h=!!c,g=Ti(c),_=ki({disabled:a}),v=(0,D.useRef)(null),y=Oi(v,o),{getPanelStyles:b,id:x,orientation:S,registerPanel:C,updatePanelProps:w}=Ni(),T=d!==null,E=Di((e,t,n)=>{d?.(e,c,n)});Ei(()=>{let e=v.current;if(e!==null)return C({element:e,id:g,idIsStable:h,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:T?E:void 0,panelConstraints:{groupResizeBehavior:s,collapsedSize:n,collapsible:r,defaultSize:i,disabled:_.disabled,maxSize:l,minSize:u}})},[s,n,r,i,T,g,h,l,u,E,C,_]),(0,D.useEffect)(()=>{w(g,{disabled:a})},[a,g,w]),Pi(g,f);let ee=()=>{let e=b(x,g);if(e)return JSON.stringify(e)},te=(0,D.useSyncExternalStore)(e=>xr(x,e),ee,ee),ne;return ne=te?JSON.parse(te):i?{flexGrow:void 0,flexShrink:void 0,flexBasis:i}:{flexGrow:1},(0,O.jsx)(`div`,{...m,"data-disabled":a||void 0,"data-panel":!0,"data-testid":g,id:g,ref:y,style:{...Ii,display:`flex`,flexBasis:0,flexShrink:1,overflow:`visible`,...ne},children:(0,O.jsx)(`div`,{className:t,style:{maxHeight:`100%`,maxWidth:`100%`,flexGrow:1,overflow:`auto`,...p,touchAction:S===`horizontal`?`pan-y`:`pan-x`},children:e})})}Fi.displayName=`Panel`;var Ii={minHeight:0,maxHeight:`100%`,height:`auto`,minWidth:0,maxWidth:`100%`,width:`auto`,border:`none`,borderWidth:0,padding:0,margin:0};function Li({layout:e,panelConstraints:t,panelId:n,panelIndex:r}){let i,a,o=e[n],s=t.find(e=>e.panelId===n);if(s){let c=s.maxSize,l=s.collapsible?s.collapsedSize:s.minSize,u=[r,r+1];a=zr({layout:Lr({delta:l-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n],i=zr({layout:Lr({delta:c-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:a,valueNow:o}}function Ri({children:e,className:t,disabled:n,disableDoubleClick:r,elementRef:i,id:a,style:o,...s}){let c=Ti(a),l=ki({disabled:n,disableDoubleClick:r}),[u,d]=(0,D.useState)({}),[f,p]=(0,D.useState)(`inactive`),[m,h]=(0,D.useState)(!1),g=(0,D.useRef)(null),_=Oi(g,i),{disableCursor:v,id:y,orientation:b,registerSeparator:x,updateSeparatorProps:S}=Ni(),C=b===`horizontal`?`vertical`:`horizontal`;Ei(()=>{let e=g.current;if(e!==null){let t={disabled:l.disabled,disableDoubleClick:l.disableDoubleClick,element:e,id:c},n=x(t),r=Yr(e=>{p(e.next.state!==`inactive`&&e.next.hitRegions.some(e=>e.separator===t)?e.next.state:`inactive`)}),i=xr(y,e=>{let{derivedPanelConstraints:n,layout:r,separatorToPanels:i}=e.next,a=i.get(t);if(a){let e=a[0],t=a.indexOf(e);d(Li({layout:r,panelConstraints:n,panelId:e.id,panelIndex:t}))}});return()=>{r(),i(),n()}}},[y,c,x,l]),(0,D.useEffect)(()=>{S(c,{disabled:n,disableDoubleClick:r})},[n,r,c,S]);let w;n&&!v&&(w=`not-allowed`);let T;if(n)T=`disabled`;else switch(f){case`active`:T=`active`;break;default:T=m?`focus`:f}return(0,O.jsx)(`div`,{...s,"aria-controls":u.valueControls,"aria-disabled":n||void 0,"aria-orientation":C,"aria-valuemax":u.valueMax,"aria-valuemin":u.valueMin,"aria-valuenow":u.valueNow,children:e,className:t,"data-separator":T,"data-testid":c,id:c,onBlur:()=>h(!1),onFocus:()=>h(!0),ref:_,role:`separator`,style:{flexBasis:`auto`,cursor:w,...o,flexGrow:0,flexShrink:0,touchAction:`none`},tabIndex:n?void 0:0})}Ri.displayName=`Separator`;function zi(e,t,n=.25){let{width:r,height:i}=e,{x:a,y:o}=t;if(!(r>0)||!(i>0)||!Number.isFinite(r)||!Number.isFinite(i)||!Number.isFinite(a)||!Number.isFinite(o))return`center`;let s=Number.isFinite(n)?Math.max(0,Math.min(.5,n)):.25,c=a<0?a:a>r?a-r:0,l=o<0?o:o>i?o-i:0;if(c!==0||l!==0){let e=Math.abs(c);return e>=Math.abs(l)&&e>0?c<0?`left`:`right`:l<0?`top`:`bottom`}let u=s*Math.min(r,i),d=a<u,f=a>r-u,p=o<u,m=o>i-u,h=d||f,g=p||m;return!h&&!g?`center`:h&&!g?d?`left`:`right`:g&&!h?p?`top`:`bottom`:(d?a/r:(r-a)/r)<=(p?o/i:(i-o)/i)?d?`left`:`right`:p?`top`:`bottom`}function Bi(e,t,n){if(e===`center`)return{kind:`move`,panelId:t,destGroupId:n.groupId};let r=e===`left`||e===`right`?`row`:`column`,i=e===`left`||e===`top`?`before`:`after`;return{kind:`split`,atPanelId:n.panelId,dir:r,side:i,newPanelId:t}}function Vi(e,t,n,r){return e===n.panelId||r===`center`&&t!==void 0&&t===n.groupId}function Hi(e,t){if(!Number.isFinite(t))return 0;let n=0;for(let r of e)if(t>=r.left+r.width/2)n+=1;else break;return n}var Ui=`application/x-deck-panel`,Wi=null,Gi=(0,D.createContext)(0);function Ki(){return(0,D.useContext)(Gi)}function qi(e){let t=e.reduce((e,t)=>e+(t>0?t:0),0);if(t<=0){let t=e.length>0?100/e.length:100;return e.map(()=>t)}return e.map(e=>(e>0?e:0)/t*100)}function Ji(e,t){let n=e.map((e,t)=>t).filter(e=>(t?.[e]??null)===null),r=qi(n.map(t=>e[t]??0)),i=new Map;return n.forEach((e,t)=>{i.set(e,r[t])}),i}function Yi(e){let{model:t,registry:n,renderDomPanel:r,bindNativeSlot:i,suppressReorderOnlyDropIndicator:a,onActiveTabClick:o}=e,[s,c]=(0,D.useState)(()=>t.get()),[l,u]=(0,D.useState)(0);(0,D.useEffect)(()=>(c(t.get()),t.subscribe(e=>{c(e.tree),u(e.revision)})),[t]);let d=(0,D.useCallback)((e,n)=>{t.apply(t=>on(t,e,n))},[t]),f=(0,D.useCallback)(e=>{t.apply(t=>mn(t,e,n))},[t,n]),p=Qi(s.root)>1,m=(0,D.useCallback)(e=>Xi(s.root,e)!==void 0,[s]),h=(0,D.useCallback)((e,n)=>{t.apply(t=>rn(t,e,n))},[t]),g=(0,D.useCallback)((e,r,i,a,o)=>{let s={groupId:e,panelId:r},c=Xi(t.get().root,i);if(n.get(i)?.draggable===!1||n.get(r)?.draggable===!1)return;if(n.get(i)?.dropPolicy===`reorder-only`){if(c===void 0||c!==e||a!==`center`)return;let n=Zi(t.get().root,e),s=o??(n?n.panels.indexOf(r):void 0);t.apply(t=>fn(t,i,{groupId:e,index:s}));return}if(Vi(i,c,s,a))return;let l=Bi(a,i,s);if(l.kind===`move`){t.apply(e=>fn(e,l.panelId,{groupId:l.destGroupId}));return}t.apply(e=>{let{tree:t}=ln(e,l.newPanelId);return Xi(t.root,l.atPanelId)===void 0?e:M(t,l.atPanelId,l.dir,l.newPanelId,l.side)})},[t,n]);return(0,O.jsx)(Gi.Provider,{value:l,children:$i(s.root,{registry:n,renderDomPanel:r,bindNativeSlot:i,onActivate:d,onActiveTabClick:o,onApplyLayout:h,onRedock:g,onClose:f,canClose:p,isPanelInTree:m,suppressReorderOnlyDropIndicator:a??!1})})}function Xi(e,t){if(e.kind===`tabs`)return e.panels.includes(t)?e.id:void 0;for(let n of e.children){let e=Xi(n,t);if(e!==void 0)return e}}function Zi(e,t){if(e.kind===`tabs`)return e.id===t?e:void 0;for(let n of e.children){let e=Zi(n,t);if(e!==void 0)return e}}function Qi(e){return e.kind===`tabs`?e.panels.length:e.children.reduce((e,t)=>e+Qi(t),0)}function $i(e,t){return e.kind===`split`?ea(e,t):ua(e,t)}function ea(e,t){return(0,O.jsx)(ca,{node:e,ctx:t},e.id)}var ta=.5,na=.1;function ra(e){return Math.min(1,Math.max(.5,Math.floor(90/Math.max(1,e))))}function ia(e,t){let n=e.filter((e,n)=>(t?.[n]??null)===null).length,r=ra(n);return e.map((e,n)=>(t?.[n]??null)===null?Number.isFinite(e)&&e>=r?e:r:e)}function aa(e,t,n,r=ta){let i=new Set(n);for(let t of Object.keys(e))if(!i.has(t))return!1;for(let e of Object.keys(t))if(!i.has(e))return!1;for(let i of n){let n=e[i],a=t[i];if(!Number.isFinite(n)||!Number.isFinite(a)||Math.abs(n-a)>r)return!1}return!0}function oa(e,t,n,r){let i=e=>(n?.[e]??null)!==null,a=0;for(let t=0;t<e.length;t++){if(!i(t))continue;let n=r[e[t]];if(typeof n!=`number`)return null;a+=n}let o=Math.max(0,100-a),s=0;for(let n=0;n<e.length;n++){if(i(n))continue;let e=t[n]??0;s+=e>0?e:0}let c=e.length-e.filter((e,t)=>i(t)).length,l={};for(let n=0;n<e.length;n++){let a=e[n];if(i(n)){l[a]=r[a];continue}if(s<=0){l[a]=c>0?o/c:o;continue}let u=t[n]??0;l[a]=o*(u>0?u:0)/s}return l}function sa(e,t,n){let r=[],i=[];for(let a=0;a<e.length;a++){if((t?.[a]??null)!==null)continue;let o=n[e[a]];if(typeof o!=`number`||!Number.isFinite(o))return null;r.push(a),i.push(o>0?o:0)}return r.length===0?null:{indices:r,ratios:qi(i)}}function ca(e){let{node:t,ctx:n}=e,r=t.orientation===`row`?`horizontal`:`vertical`,i=Ji(t.sizes,t.constraints),a=t.children.filter((e,n)=>(t.constraints?.[n]??null)===null).length,o=String(ra(a)),s=(0,D.useRef)(null),c=(0,D.useRef)(t);c.current=t;let l=[];t.children.forEach((e,r)=>{r>0&&l.push((0,O.jsx)(Ri,{"data-deck-resize-handle":``},`handle-${r}`));let a=t.constraints?.[r]??null;if(a?.fixedPx!=null){let t=`${a.fixedPx}px`;l.push((0,O.jsx)(Fi,{id:e.id,defaultSize:t,minSize:t,maxSize:t,groupResizeBehavior:`preserve-pixel-size`,children:$i(e,n)},la(e)))}else if(a?.minPx!=null){let t=`${a.minPx}px`;l.push((0,O.jsx)(Fi,{id:e.id,defaultSize:t,minSize:t,groupResizeBehavior:`preserve-pixel-size`,children:$i(e,n)},la(e)))}else{let t=i.get(r);l.push((0,O.jsx)(Fi,{id:e.id,defaultSize:t==null?void 0:String(t),minSize:o,children:$i(e,n)},la(e)))}});let u=e=>{let t=c.current,r=t.children.map(e=>e.id),i=e=>(t.constraints?.[e]??null)!==null,a=sa(r,t.constraints,e);if(!a)return;let o=Ji(t.sizes,t.constraints),s=a.indices.map(e=>o.get(e)??0);if(!a.ratios.some((e,t)=>Math.abs(e-s[t])>na))return;let l=r.map((n,r)=>i(r)?t.sizes[r]??1:e[n]);n.onApplyLayout(t.id,ia(l,t.constraints))},d=e=>{e&&(e.__deckApplyLayout=e=>{let t=c.current,r=e=>(t.constraints?.[e]??null)!==null,i=e.map((e,n)=>r(n)?t.sizes[n]??1:e);n.onApplyLayout(t.id,ia(i,t.constraints))},Object.defineProperty(e,`__deckGroupApi`,{configurable:!0,get:()=>s.current??void 0}))},f=(0,D.useCallback)(()=>{let e=s.current;if(!e)return!1;let t=c.current,n=t.children.map(e=>e.id),r=e.getLayout(),i=oa(n,t.sizes,t.constraints,r);return!i||aa(r,i,n)?!1:(e.setLayout(i),!0)},[]),p=t.sizes.join(`,`),m=t.children.length;return(0,D.useEffect)(()=>{f()},[p,m,f]),(0,O.jsx)(`div`,{ref:d,"data-deck-split":t.id,"data-orientation":t.orientation,"data-deck-sizes":t.sizes.join(`,`),style:{width:`100%`,height:`100%`},children:(0,O.jsx)(Mi,{groupRef:s,orientation:r,onLayoutChanged:u,style:{width:`100%`,height:`100%`},children:l},t.children.length)})}function la(e){return e.id}function ua(e,t){return(0,O.jsx)(da,{node:e,ctx:t},e.id)}function da(e){let{node:t,ctx:n}=e,[r,i]=(0,D.useState)(null),a=(0,D.useRef)(t);a.current=t;let o=(0,D.useRef)(n.onRedock);o.current=n.onRedock;let s=e=>{e&&(e.__deckHandleDrop=(e,t)=>{let n=a.current;o.current(n.id,n.active,e,t)})},c=e=>{if(e.preventDefault(),n.suppressReorderOnlyDropIndicator&&Wi!==null&&n.registry.get(Wi)?.dropPolicy===`reorder-only`){i(null);return}let t=e.currentTarget.getBoundingClientRect();i(zi({width:t.width,height:t.height},{x:e.clientX-t.left,y:e.clientY-t.top}))},l=()=>{i(null)},u=e=>{e.preventDefault();let r=e.currentTarget.getBoundingClientRect(),a=zi({width:r.width,height:r.height},{x:e.clientX-r.left,y:e.clientY-r.top});i(null);let o=e.dataTransfer.getData(Ui)||e.dataTransfer.getData(`text/plain`);if(!o||n.registry.get(o)===void 0||!n.isPanelInTree(o))return;let s=Hi(Array.from(e.currentTarget.querySelectorAll(`[data-deck-tab]`)).map(e=>{let t=e.getBoundingClientRect();return{left:t.left,width:t.width}}),e.clientX);n.onRedock(t.id,t.active,o,a,s)},d=e=>{e.dataTransfer.types.includes(Ui)&&(e.preventDefault(),e.stopPropagation(),i(null))},f=e=>{e.preventDefault(),e.stopPropagation(),i(null);let r=e.dataTransfer.getData(Ui)||e.dataTransfer.getData(`text/plain`);if(!r||n.registry.get(r)===void 0||!n.isPanelInTree(r))return;let a=Hi(Array.from(e.currentTarget.querySelectorAll(`[data-deck-tab]`)).map(e=>{let t=e.getBoundingClientRect();return{left:t.left,width:t.width}}),e.clientX);n.onRedock(t.id,t.active,r,`center`,a)},p=t.panels.filter(e=>!n.registry.get(e)?.hideTab);return(0,O.jsxs)(`div`,{ref:s,"data-deck-group":t.id,onDragOver:c,onDragLeave:l,onDrop:u,style:{position:`relative`,display:`flex`,flexDirection:`column`,width:`100%`,height:`100%`,minWidth:0,minHeight:0},children:[p.length>0?(0,O.jsx)(`div`,{role:`tablist`,style:{flexShrink:0},onDragOver:d,onDrop:f,children:p.map(e=>{let r=e===t.active,i=n.registry.get(e),a=i?.title??e;return(0,O.jsxs)(`button`,{type:`button`,role:`tab`,draggable:i?.draggable===!1?void 0:`true`,"data-deck-tab":e,"data-active":r?`true`:`false`,onDragStart:t=>{if(t.target instanceof Element&&t.target.closest(`[data-deck-tab-close]`)!==null){t.preventDefault();return}t.dataTransfer.setData(Ui,e),t.dataTransfer.setData(`text/plain`,e),t.dataTransfer.effectAllowed=`move`,Wi=e},onDragEnd:()=>{Wi=null},onClick:()=>{r?n.onActiveTabClick?.(e):n.onActivate(t.id,e)},children:[a,n.canClose&&i?.closable!==!1?(0,O.jsx)(`span`,{role:`button`,tabIndex:0,"data-deck-tab-close":e,"aria-label":`Close ${a}`,onPointerDown:e=>e.stopPropagation(),onClick:t=>{t.stopPropagation(),t.preventDefault(),n.onClose(e)},onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.stopPropagation(),t.preventDefault(),n.onClose(e))},children:`×`}):null]},e)})}):null,ma(t,n),r?(0,O.jsx)(pa,{zone:r}):null]})}function fa(e){let t={position:`absolute`,pointerEvents:`none`,background:`rgba(64, 128, 255, 0.25)`,outline:`2px solid rgba(64, 128, 255, 0.6)`};switch(e){case`left`:return{...t,left:`0`,top:`0`,width:`50%`,height:`100%`};case`right`:return{...t,right:`0`,top:`0`,width:`50%`,height:`100%`};case`top`:return{...t,left:`0`,top:`0`,width:`100%`,height:`50%`};case`bottom`:return{...t,left:`0`,bottom:`0`,width:`100%`,height:`50%`};default:return{...t,left:`0`,top:`0`,width:`100%`,height:`100%`}}}function pa(e){return(0,O.jsx)(`div`,{"data-deck-drop-zone":e.zone,style:fa(e.zone)})}function ma(e,t){let n=e.active;return n?(0,O.jsxs)(D.Fragment,{children:[t.registry.get(n)?.kind===`native`?(0,O.jsx)(ha,{panelId:n,bindNativeSlot:t.bindNativeSlot},n):null,e.panels.filter(e=>t.registry.get(e)?.kind!==`native`).map(e=>{let r=e===n;return(0,O.jsx)(`div`,{"data-deck-panel-body":e,style:{display:r?`flex`:`none`,flexDirection:`column`,flex:1,minWidth:0,minHeight:0},children:t.renderDomPanel(e,{active:r})},`dom-${e}`)})]}):null}function ha(e){let{panelId:t,bindNativeSlot:n}=e,r=(0,D.useRef)(n);return r.current=n,(0,O.jsx)(`div`,{ref:(0,D.useCallback)(e=>{r.current(t,e)},[t]),"data-deck-native-slot":t,style:{flex:1,minWidth:0,minHeight:0,height:`100%`}})}function ga({device:e,zoom:t,onDeviceChange:n,onZoomChange:r,compileStatus:i,currentPage:a,copied:o,onCopyPagePath:s}){let c=(0,D.useRef)(t),l=(0,D.useRef)(null),u=(0,D.useCallback)(e=>{e.visible?ee({x:e.bounds.x,y:e.bounds.y,width:e.bounds.width,height:e.bounds.height,zoom:c.current}):ee({x:0,y:0,width:0,height:0,zoom:c.current})},[]),d=(0,D.useCallback)(e=>{let t=l.current;if(t){e?(t.dispose(),l.current=Zn(e,{visible:!0,followGeometry:!0,guardDisplayNone:!0,publish:u})):(t.update({visible:!1,publish:u}),t.dispose(),l.current=null);return}e&&(l.current=Zn(e,{visible:!0,followGeometry:!0,guardDisplayNone:!0,publish:u}))},[u]);return(0,D.useLayoutEffect)(()=>{c.current=t}),(0,D.useLayoutEffect)(()=>{l.current?.update({visible:!0,publish:u})},[t,u]),(0,D.useEffect)(()=>{l.current?.pulse(300)},[Ki()]),(0,D.useEffect)(()=>()=>{l.current?.dispose(),l.current=null},[]),(0,O.jsxs)(`div`,{className:`bg-sim-bg flex flex-col overflow-hidden h-full w-full`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-2 px-5 py-2 shrink-0 border-b border-border-subtle`,children:[(0,O.jsx)(ce,{value:e.name,onChange:n,children:ue.map(e=>(0,O.jsx)(`option`,{value:e.name,children:e.name},e.name))}),(0,O.jsx)(ce,{value:t,onChange:r,className:`max-w-16`,children:de.map(e=>(0,O.jsxs)(`option`,{value:e,children:[e,`%`]},e))})]}),(0,O.jsxs)(`div`,{ref:d,className:`flex-1 min-h-0 bg-sim-bg relative`,"data-area":`native-simulator`,children:[i.status===`compiling`&&(0,O.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center bg-black/50 z-10`,children:(0,O.jsx)(`div`,{className:`text-text-dim text-[13px]`,children:`正在编译中...`})}),i.status===`error`&&(0,O.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center bg-black/70 z-10`,children:(0,O.jsxs)(`div`,{className:`text-center p-4`,children:[(0,O.jsx)(`div`,{className:`text-status-error text-[14px] font-medium mb-2`,children:`编译失败`}),(0,O.jsx)(`div`,{className:`text-status-error text-[11px] max-w-[280px] break-words`,children:i.message})]})})]}),(0,O.jsx)(`div`,{className:`flex items-center px-2.5 bg-sim-bottom border-t border-border-subtle shrink-0 h-[30px] min-w-0`,children:(0,O.jsxs)(`div`,{className:`flex items-center gap-1 min-w-0`,children:[(0,O.jsx)(`span`,{className:`text-[11px] text-text-dim truncate min-w-0`,children:a||`—`}),a&&(0,O.jsx)(`button`,{className:_(`shrink-0 flex items-center justify-center w-4 h-4 rounded transition-colors`,o?`text-accent`:`text-text-dim hover:text-text`),onClick:s,title:`复制路径`,children:o?(0,O.jsx)(`svg`,{width:`10`,height:`10`,viewBox:`0 0 10 10`,fill:`none`,children:(0,O.jsx)(`polyline`,{points:`1.5,5 4,7.5 8.5,2.5`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`})}):(0,O.jsxs)(`svg`,{width:`10`,height:`10`,viewBox:`0 0 10 10`,fill:`none`,children:[(0,O.jsx)(`rect`,{x:`1`,y:`3`,width:`6`,height:`6.5`,rx:`1`,stroke:`currentColor`,strokeWidth:`1`}),(0,O.jsx)(`path`,{d:`M3 3V2a1 1 0 011-1h4a1 1 0 011 1v5a1 1 0 01-1 1H7`,stroke:`currentColor`,strokeWidth:`1`})]})})]})})]})}function _a(){let e=(0,D.useRef)(null),t=(0,D.useCallback)(e=>{e.visible?oe({x:e.bounds.x,y:e.bounds.y,width:e.bounds.width,height:e.bounds.height}):oe({x:0,y:0,width:0,height:0})},[]),n=(0,D.useCallback)(n=>{let r=e.current;if(r){n?(r.dispose(),e.current=Zn(n,{visible:!0,guardDisplayNone:!0,followScroll:!0,followGeometry:!0,publish:t})):(r.update({visible:!1,publish:t}),r.dispose(),e.current=null);return}n&&(e.current=Zn(n,{visible:!0,guardDisplayNone:!0,followScroll:!0,followGeometry:!0,publish:t}))},[t]);return(0,D.useEffect)(()=>{e.current?.pulse(300)},[Ki()]),(0,D.useEffect)(()=>()=>{e.current?.dispose(),e.current=null},[]),(0,O.jsx)(`div`,{ref:n,className:`h-full w-full`,"data-area":`editor`})}function va(e){return!!(e.tagName===`#shadow-root`||e.tagName.includes(`/`))}function ya({node:e,depth:t,inspectedSid:n,onInspect:r}){let[i,a]=(0,D.useState)(()=>va(e)),o=t*16,s=!!(e.sid&&e.sid===n),c=`py-px leading-[18px] hover:bg-surface-2${s?` bg-surface-2`:``}`,l=()=>{e.sid&&r?.(e)};if(e.tagName===`#text`)return(0,O.jsxs)(`div`,{className:`py-px leading-[18px] hover:bg-surface-2`,style:{paddingLeft:o},children:[(0,O.jsx)(`span`,{className:`w-3 inline-block`}),(0,O.jsx)(`span`,{className:`text-text`,children:e.text})]});if(e.tagName===`#fragment`)return(0,O.jsx)(O.Fragment,{children:(e.children??[]).map((e,i)=>(0,O.jsx)(ya,{node:e,depth:t,inspectedSid:n,onInspect:r},i))});if(e.tagName===`#shadow-root`){let s=(e.children??[]).length>0;return(0,O.jsxs)(`div`,{children:[(0,O.jsxs)(`div`,{className:`py-px leading-[18px] hover:bg-surface-2 cursor-pointer`,style:{paddingLeft:o},onClick:()=>s&&a(!i),children:[(0,O.jsx)(`span`,{className:`text-text-dim w-3 shrink-0 inline-block text-center select-none`,children:s?i?`▾`:`▸`:` `}),(0,O.jsx)(`span`,{className:`text-text-dim italic`,children:`#shadow-root`})]}),i&&e.children.map((e,i)=>(0,O.jsx)(ya,{node:e,depth:t+1,inspectedSid:n,onInspect:r},i))]})}let u=(e.children??[]).length>0,d=Object.entries(e.attrs),f=u&&e.children.length===1&&e.children[0].tagName===`#text`?e.children[0].text:null;return f?(0,O.jsxs)(`div`,{className:c,style:{paddingLeft:o},onMouseEnter:l,"data-wxml-sid":e.sid,children:[(0,O.jsx)(`span`,{className:`w-3 inline-block`}),(0,O.jsxs)(`span`,{className:`text-code-keyword`,children:[`<`,e.tagName]}),d.map(([e,t])=>(0,O.jsxs)(`span`,{children:[` `,(0,O.jsx)(`span`,{className:`text-code-blue`,children:e}),(0,O.jsx)(`span`,{className:`text-text-dim`,children:`=`}),(0,O.jsxs)(`span`,{className:`text-code-orange`,children:[`"`,t,`"`]})]},e)),(0,O.jsx)(`span`,{className:`text-code-keyword`,children:`>`}),(0,O.jsx)(`span`,{className:`text-text`,children:f}),(0,O.jsxs)(`span`,{className:`text-code-keyword`,children:[`</`,e.tagName,`>`]})]}):(0,O.jsxs)(`div`,{children:[(0,O.jsxs)(`div`,{className:`flex items-start hover:bg-surface-2 py-px leading-[18px]${u?` cursor-pointer`:``}${s?` bg-surface-2`:``}`,style:{paddingLeft:o},onMouseEnter:l,onClick:()=>{u&&a(!i)},"data-wxml-sid":e.sid,children:[(0,O.jsx)(`span`,{className:`text-text-dim w-3 shrink-0 text-center select-none`,children:u?i?`▾`:`▸`:` `}),(0,O.jsxs)(`span`,{children:[(0,O.jsxs)(`span`,{className:`text-code-keyword`,children:[`<`,e.tagName]}),d.map(([e,t])=>(0,O.jsxs)(`span`,{children:[` `,(0,O.jsx)(`span`,{className:`text-code-blue`,children:e}),(0,O.jsx)(`span`,{className:`text-text-dim`,children:`=`}),(0,O.jsxs)(`span`,{className:`text-code-orange`,children:[`"`,t,`"`]})]},e)),(0,O.jsx)(`span`,{className:`text-code-keyword`,children:u?`>`:` />`})]})]}),i&&u&&(0,O.jsxs)(O.Fragment,{children:[e.children.map((e,i)=>(0,O.jsx)(ya,{node:e,depth:t+1,inspectedSid:n,onInspect:r},i)),(0,O.jsxs)(`div`,{style:{paddingLeft:o},className:`py-px leading-[18px]`,children:[(0,O.jsx)(`span`,{className:`w-3 inline-block`}),(0,O.jsxs)(`span`,{className:`text-code-keyword`,children:[`</`,e.tagName,`>`]})]})]})]})}function ba({inspection:e}){if(!e)return null;let{rect:t,style:n}=e,r=[n.display,n.position===`static`?null:n.position,n.boxSizing].filter(Boolean);return(0,O.jsxs)(`div`,{className:`border-t border-border-subtle bg-bg-panel px-2.5 py-1.5 font-mono text-[11px] text-text-dim shrink-0`,children:[(0,O.jsx)(`span`,{className:`text-text`,children:`box`}),` `,Math.round(t.width),` x `,Math.round(t.height),` @ `,Math.round(t.x),`, `,Math.round(t.y),(0,O.jsx)(`span`,{className:`mx-2 text-border-subtle`,children:`|`}),r.join(` / `),(0,O.jsx)(`span`,{className:`mx-2 text-border-subtle`,children:`|`}),`font `,n.fontSize]})}function xa({tree:e,onRefresh:t,onInspectElement:n,onClearInspection:r}){let[i,a]=(0,D.useState)(null),o=(0,D.useRef)(0),s=(0,D.useRef)(null);(0,D.useEffect)(()=>()=>{s.current!==null&&cancelAnimationFrame(s.current)},[]);let c=(0,D.useCallback)(e=>{if(!e.sid||!n)return;let t=e.sid;s.current!==null&&cancelAnimationFrame(s.current),s.current=requestAnimationFrame(()=>{s.current=null;let e=++o.current;n(t).then(t=>{e===o.current&&a(t)}).catch(()=>{e===o.current&&a(null)})})},[n]),l=(0,D.useCallback)(()=>{s.current!==null&&(cancelAnimationFrame(s.current),s.current=null),o.current++,a(null),r?.()},[r]);return e?(0,O.jsxs)(`div`,{className:`flex flex-col flex-1 overflow-hidden`,onMouseLeave:l,"data-testid":`wxml-panel`,children:[(0,O.jsx)(`div`,{className:`flex items-center px-2.5 py-1.5 border-b border-border-subtle shrink-0 bg-bg-panel`,children:(0,O.jsx)(S,{variant:`outline`,size:`xs`,onClick:t,className:`hover:border-accent hover:text-accent`,children:`↻ 刷新`})}),(0,O.jsx)(`div`,{className:`flex-1 overflow-y-auto p-2 font-mono text-[12px]`,children:(0,O.jsx)(ya,{node:e,depth:0,inspectedSid:i?.sid??null,onInspect:c})}),(0,O.jsx)(ba,{inspection:i})]}):(0,O.jsxs)(`div`,{className:`flex flex-col flex-1 overflow-hidden`,"data-testid":`wxml-panel`,children:[(0,O.jsx)(`div`,{className:`flex items-center px-2.5 py-1.5 border-b border-border-subtle shrink-0 bg-bg-panel`,children:(0,O.jsx)(S,{variant:`outline`,size:`xs`,onClick:t,className:`hover:border-accent hover:text-accent`,children:`↻ 刷新`})}),(0,O.jsx)(`div`,{className:`text-[12px] text-text-dim text-center px-4 py-6`,children:`等待小程序加载...`})]})}function B(){return B=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},B.apply(null,arguments)}function V(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var Sa={},Ca=(0,D.createContext)(Sa),wa=(e,t)=>B({},e,t),Ta=()=>(0,D.useContext)(Ca),Ea=(0,D.createContext)(()=>{});Ea.displayName=`JVR.DispatchShowTools`;function Da(){return(0,D.useReducer)(wa,Sa)}function Oa(){return(0,D.useContext)(Ea)}var ka=e=>{var{initial:t,dispatch:n,children:r}=e;return(0,O.jsx)(Ca.Provider,{value:t,children:(0,O.jsx)(Ea.Provider,{value:n,children:r})})};ka.displayName=`JVR.ShowTools`;var Aa={},ja=(0,D.createContext)(Aa),Ma=(e,t)=>B({},e,t),Na=()=>(0,D.useContext)(ja),Pa=(0,D.createContext)(()=>{});Pa.displayName=`JVR.DispatchExpands`;function Fa(){return(0,D.useReducer)(Ma,Aa)}function Ia(){return(0,D.useContext)(Pa)}var La=e=>{var{initial:t,dispatch:n,children:r}=e;return(0,O.jsx)(ja.Provider,{value:t,children:(0,O.jsx)(Pa.Provider,{value:n,children:r})})};La.displayName=`JVR.Expands`;var Ra={Str:{as:`span`,"data-type":`string`,style:{color:`var(--w-rjv-type-string-color, #cb4b16)`},className:`w-rjv-type`,children:`string`},Url:{as:`a`,style:{color:`var(--w-rjv-type-url-color, #0969da)`},"data-type":`url`,className:`w-rjv-type`,children:`url`},Undefined:{style:{color:`var(--w-rjv-type-undefined-color, #586e75)`},as:`span`,"data-type":`undefined`,className:`w-rjv-type`,children:`undefined`},Null:{style:{color:`var(--w-rjv-type-null-color, #d33682)`},as:`span`,"data-type":`null`,className:`w-rjv-type`,children:`null`},Map:{style:{color:`var(--w-rjv-type-map-color, #268bd2)`,marginRight:3},as:`span`,"data-type":`map`,className:`w-rjv-type`,children:`Map`},Nan:{style:{color:`var(--w-rjv-type-nan-color, #859900)`},as:`span`,"data-type":`nan`,className:`w-rjv-type`,children:`NaN`},Bigint:{style:{color:`var(--w-rjv-type-bigint-color, #268bd2)`},as:`span`,"data-type":`bigint`,className:`w-rjv-type`,children:`bigint`},Int:{style:{color:`var(--w-rjv-type-int-color, #268bd2)`},as:`span`,"data-type":`int`,className:`w-rjv-type`,children:`int`},Set:{style:{color:`var(--w-rjv-type-set-color, #268bd2)`,marginRight:3},as:`span`,"data-type":`set`,className:`w-rjv-type`,children:`Set`},Float:{style:{color:`var(--w-rjv-type-float-color, #859900)`},as:`span`,"data-type":`float`,className:`w-rjv-type`,children:`float`},True:{style:{color:`var(--w-rjv-type-boolean-color, #2aa198)`},as:`span`,"data-type":`bool`,className:`w-rjv-type`,children:`bool`},False:{style:{color:`var(--w-rjv-type-boolean-color, #2aa198)`},as:`span`,"data-type":`bool`,className:`w-rjv-type`,children:`bool`},Date:{style:{color:`var(--w-rjv-type-date-color, #268bd2)`},as:`span`,"data-type":`date`,className:`w-rjv-type`,children:`date`}},za=(0,D.createContext)(Ra),Ba=(e,t)=>B({},e,t),H=()=>(0,D.useContext)(za),Va=(0,D.createContext)(()=>{});Va.displayName=`JVR.DispatchTypes`;function Ha(){return(0,D.useReducer)(Ba,Ra)}function Ua(){return(0,D.useContext)(Va)}function Wa(e){var{initial:t,dispatch:n,children:r}=e;return(0,O.jsx)(za.Provider,{value:t,children:(0,O.jsx)(Va.Provider,{value:n,children:r})})}Wa.displayName=`JVR.Types`;var Ga=[`style`];function Ka(e){var{style:t}=e,n=V(e,Ga);return(0,O.jsx)(`svg`,B({viewBox:`0 0 24 24`,fill:`var(--w-rjv-arrow-color, currentColor)`,style:B({cursor:`pointer`,height:`1em`,width:`1em`,userSelect:`none`,display:`inline-flex`},t)},n,{children:(0,O.jsx)(`path`,{d:`M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z`})}))}Ka.displayName=`JVR.TriangleArrow`;var qa={Arrow:{as:`span`,className:`w-rjv-arrow`,style:{transform:`rotate(0deg)`,transition:`all 0.3s`},children:(0,O.jsx)(Ka,{})},Colon:{as:`span`,style:{color:`var(--w-rjv-colon-color, var(--w-rjv-color))`,marginLeft:0,marginRight:2},className:`w-rjv-colon`,children:`:`},Quote:{as:`span`,style:{color:`var(--w-rjv-quotes-color, #236a7c)`},className:`w-rjv-quotes`,children:`"`},ValueQuote:{as:`span`,style:{color:`var(--w-rjv-quotes-string-color, #cb4b16)`},className:`w-rjv-quotes`,children:`"`},BracketsLeft:{as:`span`,style:{color:`var(--w-rjv-brackets-color, #236a7c)`},className:`w-rjv-brackets-start`,children:`[`},BracketsRight:{as:`span`,style:{color:`var(--w-rjv-brackets-color, #236a7c)`},className:`w-rjv-brackets-end`,children:`]`},BraceLeft:{as:`span`,style:{color:`var(--w-rjv-curlybraces-color, #236a7c)`},className:`w-rjv-curlybraces-start`,children:`{`},BraceRight:{as:`span`,style:{color:`var(--w-rjv-curlybraces-color, #236a7c)`},className:`w-rjv-curlybraces-end`,children:`}`}},Ja=(0,D.createContext)(qa),Ya=(e,t)=>B({},e,t),U=()=>(0,D.useContext)(Ja),Xa=(0,D.createContext)(()=>{});Xa.displayName=`JVR.DispatchSymbols`;function Za(){return(0,D.useReducer)(Ya,qa)}function Qa(){return(0,D.useContext)(Xa)}var $a=e=>{var{initial:t,dispatch:n,children:r}=e;return(0,O.jsx)(Ja.Provider,{value:t,children:(0,O.jsx)(Xa.Provider,{value:n,children:r})})};$a.displayName=`JVR.Symbols`;var eo={Copied:{className:`w-rjv-copied`,style:{height:`1em`,width:`1em`,cursor:`pointer`,verticalAlign:`middle`,marginLeft:5}},CountInfo:{as:`span`,className:`w-rjv-object-size`,style:{color:`var(--w-rjv-info-color, #0000004d)`,paddingLeft:8,fontStyle:`italic`}},CountInfoExtra:{as:`span`,className:`w-rjv-object-extra`,style:{paddingLeft:8}},Ellipsis:{as:`span`,style:{cursor:`pointer`,color:`var(--w-rjv-ellipsis-color, #cb4b16)`,userSelect:`none`},className:`w-rjv-ellipsis`,children:`...`},Row:{as:`div`,className:`w-rjv-line`},KeyName:{as:`span`,className:`w-rjv-object-key`}},to=(0,D.createContext)(eo),no=(e,t)=>B({},e,t),W=()=>(0,D.useContext)(to),ro=(0,D.createContext)(()=>{});ro.displayName=`JVR.DispatchSection`;function io(){return(0,D.useReducer)(no,eo)}function ao(){return(0,D.useContext)(ro)}var oo=e=>{var{initial:t,dispatch:n,children:r}=e;return(0,O.jsx)(to.Provider,{value:t,children:(0,O.jsx)(ro.Provider,{value:n,children:r})})};oo.displayName=`JVR.Section`;var so={objectSortKeys:!1,indentWidth:15},co=(0,D.createContext)(so);co.displayName=`JVR.Context`;var lo=(0,D.createContext)(()=>{});lo.displayName=`JVR.DispatchContext`;function uo(e,t){return B({},e,t)}var fo=()=>(0,D.useContext)(co),po=e=>{var{children:t,initialState:n,initialTypes:r}=e,[i,a]=(0,D.useReducer)(uo,Object.assign({},so,n)),[o,s]=Da(),[c,l]=Fa(),[u,d]=Ha(),[f,p]=Za(),[m,h]=io();return(0,D.useEffect)(()=>a(B({},n)),[n]),(0,O.jsx)(co.Provider,{value:i,children:(0,O.jsx)(lo.Provider,{value:a,children:(0,O.jsx)(ka,{initial:o,dispatch:s,children:(0,O.jsx)(La,{initial:c,dispatch:l,children:(0,O.jsx)(Wa,{initial:B({},u,r),dispatch:d,children:(0,O.jsx)($a,{initial:f,dispatch:p,children:(0,O.jsx)(oo,{initial:m,dispatch:h,children:t})})})})})})})};po.displayName=`JVR.Provider`;function mo(e){if(e==null)throw TypeError(`Cannot destructure `+e)}var ho=[`isNumber`,`value`,`parentValue`,`keyName`,`keys`],go=[`as`,`render`],_o=[`as`,`render`],vo=[`as`,`render`],yo=[`as`,`style`,`render`],bo=[`as`,`render`],xo=[`as`,`render`],So=[`as`,`render`],Co=[`as`,`render`],wo=e=>{var{Quote:t={}}=U(),{isNumber:n,value:r,parentValue:i,keyName:a,keys:o}=e,s=V(e,ho);if(n)return null;var{as:c,render:l}=t,u=V(t,go),d=c||`span`,f=B({},s,u);return typeof f.children==`string`&&(f.children=f.children.trim()||void 0),l&&typeof l==`function`&&l(f,{value:r,parentValue:i,keyName:a,keys:o||(a?[a]:[])})||(0,O.jsx)(d,B({},f))};wo.displayName=`JVR.Quote`;var To=e=>{var{ValueQuote:t={}}=U(),n=B({},(mo(e),e)),{as:r,render:i}=t,a=V(t,_o),o=r||`span`,s=B({},n,a);return i&&typeof i==`function`&&i(s,{})||(0,O.jsx)(o,B({},s))};To.displayName=`JVR.ValueQuote`;var Eo=e=>{var{value:t,parentValue:n,keyName:r,keys:i}=e,{Colon:a={}}=U(),{as:o,render:s}=a,c=V(a,vo),l=o||`span`;return s&&typeof s==`function`&&s(c,{value:t,parentValue:n,keyName:r,keys:i||(r?[r]:[])})||(0,O.jsx)(l,B({},c))};Eo.displayName=`JVR.Colon`;var Do=e=>{var{Arrow:t={}}=U(),n=Na(),{expandKey:r,style:i,value:a,parentValue:o,keyName:s,keys:c}=e,l=!!n[r],{as:u,style:d,render:f}=t,p=V(t,yo),m=u||`span`,h=f&&typeof f==`function`,g=B({},p,{"data-expanded":l,style:B({},d,i)});return h&&f(g,{value:a,parentValue:o,keyName:s,keys:c||(s?[s]:[])})||(0,O.jsx)(m,B({},p,{style:B({},d,i)}))};Do.displayName=`JVR.Arrow`;var Oo=e=>{var{isBrackets:t,value:n,parentValue:r,keyName:i,keys:a}=e,{BracketsLeft:o={},BraceLeft:s={}}=U(),c={value:n,parentValue:r,keyName:i,keys:a||(i?[i]:[])};if(t){var{as:l,render:u}=o,d=V(o,bo),f=l||`span`;return u&&typeof u==`function`&&u(d,c)||(0,O.jsx)(f,B({},d))}var{as:p,render:m}=s,h=V(s,xo),g=p||`span`;return m&&typeof m==`function`&&m(h,c)||(0,O.jsx)(g,B({},h))};Oo.displayName=`JVR.BracketsOpen`;var ko=e=>{var{isBrackets:t,isVisiable:n,value:r,parentValue:i,keyName:a,keys:o}=e,s={value:r,parentValue:i,keyName:a,keys:o||(a?[a]:[])};if(!n)return null;var{BracketsRight:c={},BraceRight:l={}}=U();if(t){var{as:u,render:d}=c,f=V(c,So),p=u||`span`;return d&&typeof d==`function`&&d(f,s)||(0,O.jsx)(p,B({},f))}var{as:m,render:h}=l,g=V(l,Co),_=m||`span`;return h&&typeof h==`function`&&h(g,s)||(0,O.jsx)(_,B({},g))};ko.displayName=`JVR.BracketsClose`;var Ao=e=>{var{keyName:t,value:n,expandKey:r,parentValue:i,level:a,keys:o=[]}=e,s=Na(),{collapsed:c,shouldExpandNodeInitially:l}=fo(),u=typeof c==`boolean`?c:typeof c==`number`?a>c:!1,d=s[r]??(l?!1:u),f=l&&l(!d,{value:n,keys:o,level:a,keyName:t,parentValue:i});if(l&&c===!1){if(s[r]===void 0&&!f)return null}else if(s[r]===void 0&&f)return null;var p=Object.keys(n).length;if(d||p===0)return null;var m={paddingLeft:4},h={keyName:t,value:n,keys:o,parentValue:i},g=Array.isArray(n),_=n instanceof Set;return(0,O.jsx)(`div`,{style:m,children:(0,O.jsx)(ko,B({isBrackets:g||_},h,{isVisiable:!0}))})};Ao.displayName=`JVR.NestedClose`;var jo=[`as`,`render`],Mo=[`as`,`render`],No=[`as`,`render`],Po=[`as`,`render`],Fo=[`as`,`render`],Io=[`as`,`render`],Lo=[`as`,`render`],Ro=[`as`,`render`],zo=[`as`,`render`],Bo=[`as`,`render`],Vo=[`as`,`render`],Ho=[`as`,`render`],Uo=[`as`,`render`],Wo=e=>{if(e===void 0)return`0n`;if(typeof e==`string`)try{e=BigInt(e)}catch{return`0n`}return e?e.toString()+`n`:`0n`},Go=e=>{var{value:t,keyName:n}=e,{Set:r={},displayDataTypes:i}=H();if(!(t instanceof Set)||!i)return null;var{as:a,render:o}=r,s=V(r,jo);return o&&typeof o==`function`&&o(s,{type:`type`,value:t,keyName:n})||(0,O.jsx)(a||`span`,B({},s))};Go.displayName=`JVR.SetComp`;var Ko=e=>{var{value:t,keyName:n}=e,{Map:r={},displayDataTypes:i}=H();if(!(t instanceof Map)||!i)return null;var{as:a,render:o}=r,s=V(r,Mo);return o&&typeof o==`function`&&o(s,{type:`type`,value:t,keyName:n})||(0,O.jsx)(a||`span`,B({},s))};Ko.displayName=`JVR.MapComp`;var G={opacity:.75,paddingRight:4},qo=e=>{var{children:t=``,keyName:n,keys:r}=e,{Str:i={},displayDataTypes:a}=H(),{shortenTextAfterLength:o=30,stringEllipsis:s=`...`}=fo(),{as:c,render:l}=i,u=V(i,No),d=t,[f,p]=(0,D.useState)(o&&d.length>o);(0,D.useEffect)(()=>p(o&&d.length>o),[o]);var m=c||`span`,h=B({},G,i.style||{});o>0&&(u.style=B({},u.style,{cursor:d.length<=o?`initial`:`pointer`}),d.length>o&&(u.onClick=()=>{p(!f)}));var g=f?``+d.slice(0,o)+s:d,_=l&&typeof l==`function`,v=_&&l(B({},u,{style:h}),{type:`type`,value:t,keyName:n,keys:r}),y=f?`w-rjv-value w-rjv-value-short`:`w-rjv-value`,b=_&&l(B({},u,{children:g,className:y}),{type:`value`,value:t,keyName:n,keys:r});return(0,O.jsxs)(D.Fragment,{children:[a&&(v||(0,O.jsx)(m,B({},u,{style:h}))),b||(0,O.jsxs)(D.Fragment,{children:[(0,O.jsx)(To,{}),(0,O.jsx)(m,B({},u,{className:y,children:g})),(0,O.jsx)(To,{})]})]})};qo.displayName=`JVR.TypeString`;var Jo=e=>{var{children:t,keyName:n,keys:r}=e,{True:i={},displayDataTypes:a}=H(),{as:o,render:s}=i,c=V(i,Po),l=o||`span`,u=B({},G,i.style||{}),d=s&&typeof s==`function`,f=d&&s(B({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),p=d&&s(B({},c,{children:t,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,O.jsxs)(D.Fragment,{children:[a&&(f||(0,O.jsx)(l,B({},c,{style:u}))),p||(0,O.jsx)(l,B({},c,{className:`w-rjv-value`,children:t?.toString()}))]})};Jo.displayName=`JVR.TypeTrue`;var Yo=e=>{var{children:t,keyName:n,keys:r}=e,{False:i={},displayDataTypes:a}=H(),{as:o,render:s}=i,c=V(i,Fo),l=o||`span`,u=B({},G,i.style||{}),d=s&&typeof s==`function`,f=d&&s(B({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),p=d&&s(B({},c,{children:t,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,O.jsxs)(D.Fragment,{children:[a&&(f||(0,O.jsx)(l,B({},c,{style:u}))),p||(0,O.jsx)(l,B({},c,{className:`w-rjv-value`,children:t?.toString()}))]})};Yo.displayName=`JVR.TypeFalse`;var Xo=e=>{var{children:t,keyName:n,keys:r}=e,{Float:i={},displayDataTypes:a}=H(),{as:o,render:s}=i,c=V(i,Io),l=o||`span`,u=B({},G,i.style||{}),d=s&&typeof s==`function`,f=d&&s(B({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),p=d&&s(B({},c,{children:t,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,O.jsxs)(D.Fragment,{children:[a&&(f||(0,O.jsx)(l,B({},c,{style:u}))),p||(0,O.jsx)(l,B({},c,{className:`w-rjv-value`,children:t?.toString()}))]})};Xo.displayName=`JVR.TypeFloat`;var Zo=e=>{var{children:t,keyName:n,keys:r}=e,{Int:i={},displayDataTypes:a}=H(),{as:o,render:s}=i,c=V(i,Lo),l=o||`span`,u=B({},G,i.style||{}),d=s&&typeof s==`function`,f=d&&s(B({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),p=d&&s(B({},c,{children:t,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,O.jsxs)(D.Fragment,{children:[a&&(f||(0,O.jsx)(l,B({},c,{style:u}))),p||(0,O.jsx)(l,B({},c,{className:`w-rjv-value`,children:t?.toString()}))]})};Zo.displayName=`JVR.TypeInt`;var Qo=e=>{var{children:t,keyName:n,keys:r}=e,{Bigint:i={},displayDataTypes:a}=H(),{as:o,render:s}=i,c=V(i,Ro),l=o||`span`,u=B({},G,i.style||{}),d=s&&typeof s==`function`,f=d&&s(B({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),p=d&&s(B({},c,{children:t,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,O.jsxs)(D.Fragment,{children:[a&&(f||(0,O.jsx)(l,B({},c,{style:u}))),p||(0,O.jsx)(l,B({},c,{className:`w-rjv-value`,children:Wo(t?.toString())}))]})};Qo.displayName=`JVR.TypeFloat`;var $o=e=>{var{children:t,keyName:n,keys:r}=e,{Url:i={},displayDataTypes:a}=H(),{as:o,render:s}=i,c=V(i,zo),l=o||`span`,u=B({},G,i.style),d=s&&typeof s==`function`,f=d&&s(B({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),p=d&&s(B({},c,{children:t?.href,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,O.jsxs)(D.Fragment,{children:[a&&(f||(0,O.jsx)(l,B({},c,{style:u}))),p||(0,O.jsxs)(`a`,B({href:t?.href,target:`_blank`},c,{className:`w-rjv-value`,children:[(0,O.jsx)(To,{}),t?.href,(0,O.jsx)(To,{})]}))]})};$o.displayName=`JVR.TypeUrl`;var es=e=>{var{children:t,keyName:n,keys:r}=e,{Date:i={},displayDataTypes:a}=H(),{as:o,render:s}=i,c=V(i,Bo),l=o||`span`,u=B({},G,i.style||{}),d=s&&typeof s==`function`,f=d&&s(B({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),p=t instanceof Date?t.toLocaleString():t,m=d&&s(B({},c,{children:p,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,O.jsxs)(D.Fragment,{children:[a&&(f||(0,O.jsx)(l,B({},c,{style:u}))),m||(0,O.jsx)(l,B({},c,{className:`w-rjv-value`,children:p}))]})};es.displayName=`JVR.TypeDate`;var ts=e=>{var{children:t,keyName:n,keys:r}=e,{Undefined:i={},displayDataTypes:a}=H(),{as:o,render:s}=i,c=V(i,Vo),l=o||`span`,u=B({},G,i.style||{}),d=s&&typeof s==`function`,f=d&&s(B({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),p=d&&s(B({},c,{children:t,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,O.jsxs)(D.Fragment,{children:[a&&(f||(0,O.jsx)(l,B({},c,{style:u}))),p]})};ts.displayName=`JVR.TypeUndefined`;var ns=e=>{var{children:t,keyName:n,keys:r}=e,{Null:i={},displayDataTypes:a}=H(),{as:o,render:s}=i,c=V(i,Ho),l=o||`span`,u=B({},G,i.style||{}),d=s&&typeof s==`function`,f=d&&s(B({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),p=d&&s(B({},c,{children:t,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,O.jsxs)(D.Fragment,{children:[a&&(f||(0,O.jsx)(l,B({},c,{style:u}))),p]})};ns.displayName=`JVR.TypeNull`;var rs=e=>{var{children:t,keyName:n,keys:r}=e,{Nan:i={},displayDataTypes:a}=H(),{as:o,render:s}=i,c=V(i,Uo),l=o||`span`,u=B({},G,i.style||{}),d=s&&typeof s==`function`,f=d&&s(B({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),p=d&&s(B({},c,{children:t?.toString(),className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,O.jsxs)(D.Fragment,{children:[a&&(f||(0,O.jsx)(l,B({},c,{style:u}))),p]})};rs.displayName=`JVR.TypeNan`;var is=e=>Number(e)===e&&e%1!=0||isNaN(e),as=e=>{var{value:t,keyName:n,keys:r}=e,i={keyName:n,keys:r};return t instanceof URL?(0,O.jsx)($o,B({},i,{children:t})):typeof t==`string`?(0,O.jsx)(qo,B({},i,{children:t})):t===!0?(0,O.jsx)(Jo,B({},i,{children:t})):t===!1?(0,O.jsx)(Yo,B({},i,{children:t})):t===null?(0,O.jsx)(ns,B({},i,{children:t})):t===void 0?(0,O.jsx)(ts,B({},i,{children:t})):t instanceof Date?(0,O.jsx)(es,B({},i,{children:t})):typeof t==`number`&&isNaN(t)?(0,O.jsx)(rs,B({},i,{children:t})):typeof t==`number`&&is(t)?(0,O.jsx)(Xo,B({},i,{children:t})):typeof t==`bigint`?(0,O.jsx)(Qo,B({},i,{children:t})):typeof t==`number`?(0,O.jsx)(Zo,B({},i,{children:t})):null};as.displayName=`JVR.Value`;function K(e,t,n){var r=Qa(),i=B({},e,t,{className:[e.className,t.className].filter(Boolean).join(` `),style:B({},e.style,t.style),children:t.children||e.children});(0,D.useEffect)(()=>r({[n]:i}),[t])}function q(e,t,n){var r=Ua(),i=B({},e,t,{className:[e.className,t.className].filter(Boolean).join(` `),style:B({},e.style,t.style),children:t.children||e.children});(0,D.useEffect)(()=>r({[n]:i}),[t])}function os(e,t,n){var r=ao(),i=B({},e,t,{className:[e.className,t.className].filter(Boolean).join(` `),style:B({},e.style,t.style),children:t.children||e.children});(0,D.useEffect)(()=>r({[n]:i}),[t])}var ss=[`as`,`render`],cs=e=>{var{KeyName:t={}}=W();return os(t,e,`KeyName`),null};cs.displayName=`JVR.KeyName`;var ls=e=>{var{children:t,value:n,parentValue:r,keyName:i,keys:a}=e,o={color:typeof t==`number`?`var(--w-rjv-key-number, #268bd2)`:`var(--w-rjv-key-string, #002b36)`},{KeyName:s={}}=W(),{as:c,render:l}=s,u=V(s,ss);u.style=B({},u.style,o);var d=c||`span`;return l&&typeof l==`function`&&l(B({},u,{children:t}),{value:n,parentValue:r,keyName:i,keys:a||(i?[i]:[])})||(0,O.jsx)(d,B({},u,{children:t}))};ls.displayName=`JVR.KeyNameComp`;var us=[`children`,`value`,`parentValue`,`keyName`,`keys`],ds=[`as`,`render`,`children`],fs=e=>{var{Row:t={}}=W();return os(t,e,`Row`),null};fs.displayName=`JVR.Row`;var ps=e=>{var{children:t,value:n,parentValue:r,keyName:i,keys:a}=e,o=V(e,us),{Row:s={}}=W(),{as:c,render:l}=s,u=V(s,ds),d=c||`div`;return l&&typeof l==`function`&&l(B({},o,u,{children:t}),{value:n,keyName:i,parentValue:r,keys:a})||(0,O.jsx)(d,B({},o,u,{children:t}))};ps.displayName=`JVR.RowComp`;function ms(e){var t=(0,D.useRef)();return(0,D.useEffect)(()=>{t.current=e}),t.current}function hs(e){var{value:t,highlightUpdates:n,highlightContainer:r}=e,i=ms(t),a=(0,D.useMemo)(()=>{if(!n||i===void 0)return!1;if(typeof t!=typeof i)return!0;if(typeof t==`number`)return isNaN(t)&&isNaN(i)?!1:t!==i;if(Array.isArray(t)!==Array.isArray(i))return!0;if(typeof t==`object`||typeof t==`function`)return!1;if(t!==i)return!0},[n,t]);(0,D.useEffect)(()=>{r&&r.current&&a&&`animate`in r.current&&r.current.animate([{backgroundColor:`var(--w-rjv-update-color, #ebcb8b)`},{backgroundColor:``}],{duration:1e3,easing:`ease-in`})},[a,t,r])}var gs=[`keyName`,`value`,`parentValue`,`expandKey`,`keys`,`beforeCopy`],_s=[`as`,`render`],vs=e=>{var{keyName:t,value:n,parentValue:r,expandKey:i,keys:a,beforeCopy:o}=e,s=V(e,gs),{onCopied:c,enableClipboard:l,beforeCopy:u}=fo(),d=Ta()[i],[f,p]=(0,D.useState)(!1),{Copied:m={}}=W(),h=m?.beforeCopy;if(l===!1||!d)return null;var g={style:{display:`inline-flex`},fill:f?`var(--w-rjv-copied-success-color, #28a745)`:`var(--w-rjv-copied-color, currentColor)`,onClick:e=>{e.stopPropagation();var s=``;s=typeof n==`number`&&n===1/0?`Infinity`:typeof n==`number`&&isNaN(n)?`NaN`:typeof n==`bigint`?Wo(n):n instanceof Date?n.toLocaleString():JSON.stringify(n,(e,t)=>typeof t==`bigint`?Wo(t):t,2);var l=o||h||u;l&&typeof l==`function`&&(s=l(s,t,n,r,i,a)),c&&c(s,n),p(!0),(navigator.clipboard||{writeText(e){return new Promise((t,n)=>{var r=document.createElement(`textarea`);r.style.position=`absolute`,r.style.opacity=`0`,r.style.left=`-99999999px`,r.value=e,document.body.appendChild(r),r.select(),document.execCommand(`copy`)?t():n(),r.remove()})}}).writeText(s).then(()=>{var e=setTimeout(()=>{p(!1),clearTimeout(e)},3e3)}).catch(e=>{})}},{render:_}=m,v=V(m,_s),y=B({},v,s,g,{style:B({},v.style,s.style,g.style)});return _&&typeof _==`function`&&_(B({},y,{"data-copied":f}),{value:n,keyName:t,keys:a,parentValue:r})||(f?(0,O.jsx)(`svg`,B({viewBox:`0 0 32 36`},y,{children:(0,O.jsx)(`path`,{d:`M27.5,33 L2.5,33 L2.5,12.5 L27.5,12.5 L27.5,15.2249049 C29.1403264,13.8627542 29.9736597,13.1778155 30,13.1700887 C30,11.9705278 30,10.0804982 30,7.5 C30,6.1 28.9,5 27.5,5 L20,5 C20,2.2 17.8,0 15,0 C12.2,0 10,2.2 10,5 L2.5,5 C1.1,5 0,6.1 0,7.5 L0,33 C0,34.4 1.1,36 2.5,36 L27.5,36 C28.9,36 30,34.4 30,33 L30,26.1114493 L27.5,28.4926435 L27.5,33 Z M7.5,7.5 L10,7.5 C10,7.5 12.5,6.4 12.5,5 C12.5,3.6 13.6,2.5 15,2.5 C16.4,2.5 17.5,3.6 17.5,5 C17.5,6.4 18.8,7.5 20,7.5 L22.5,7.5 C22.5,7.5 25,8.6 25,10 L5,10 C5,8.5 6.1,7.5 7.5,7.5 Z M5,27.5 L10,27.5 L10,25 L5,25 L5,27.5 Z M28.5589286,16 L32,19.6 L21.0160714,30.5382252 L13.5303571,24.2571429 L17.1303571,20.6571429 L21.0160714,24.5428571 L28.5589286,16 Z M17.5,15 L5,15 L5,17.5 L17.5,17.5 L17.5,15 Z M10,20 L5,20 L5,22.5 L10,22.5 L10,20 Z`})})):(0,O.jsx)(`svg`,B({viewBox:`0 0 32 36`},y,{children:(0,O.jsx)(`path`,{d:`M27.5,33 L2.5,33 L2.5,12.5 L27.5,12.5 L27.5,20 L30,20 L30,7.5 C30,6.1 28.9,5 27.5,5 L20,5 C20,2.2 17.8,0 15,0 C12.2,0 10,2.2 10,5 L2.5,5 C1.1,5 0,6.1 0,7.5 L0,33 C0,34.4 1.1,36 2.5,36 L27.5,36 C28.9,36 30,34.4 30,33 L30,29 L27.5,29 L27.5,33 Z M7.5,7.5 L10,7.5 C10,7.5 12.5,6.4 12.5,5 C12.5,3.6 13.6,2.5 15,2.5 C16.4,2.5 17.5,3.6 17.5,5 C17.5,6.4 18.8,7.5 20,7.5 L22.5,7.5 C22.5,7.5 25,8.6 25,10 L5,10 C5,8.5 6.1,7.5 7.5,7.5 Z M5,27.5 L10,27.5 L10,25 L5,25 L5,27.5 Z M22.5,21.5 L22.5,16.5 L12.5,24 L22.5,31.5 L22.5,26.5 L32,26.5 L32,21.5 L22.5,21.5 Z M17.5,15 L5,15 L5,17.5 L17.5,17.5 L17.5,15 Z M10,20 L5,20 L5,22.5 L10,22.5 L10,20 Z`})})))};vs.displayName=`JVR.Copied`;function ys(){var e=(0,D.useRef)(null);return e.current===null&&(e.current=`custom-id-`+Math.random().toString(36).substr(2,9)),e.current}var bs=e=>{var{keyName:t,value:n,expandKey:r=``,level:i,keys:a=[],parentValue:o}=e,s=Na(),{objectSortKeys:c,indentWidth:l,collapsed:u,shouldExpandNodeInitially:d}=fo(),f=typeof u==`boolean`?u:typeof u==`number`?i>u:!1,p=s[r]??(d?!1:f),m=d&&d(!p,{value:n,keys:a,level:i,keyName:t,parentValue:o});if(d&&u===!1){if(s[r]===void 0&&!m)return null}else if(s[r]===void 0&&m)return null;if(p)return null;var h=Array.isArray(n)?Object.entries(n).map(e=>[Number(e[0]),e[1]]):Object.entries(n);return c&&(h=c===!0?h.sort((e,t)=>{var[n]=e,[r]=t;return typeof n==`string`&&typeof r==`string`?n.localeCompare(r):0}):h.sort((e,t)=>{var[n,r]=e,[i,a]=t;return typeof n==`string`&&typeof i==`string`?c(n,i,r,a):0})),(0,O.jsx)(`div`,{className:`w-rjv-wrap`,style:{borderLeft:`var(--w-rjv-border-left-width, 1px) var(--w-rjv-line-style, solid) var(--w-rjv-line-color, #ebebeb)`,paddingLeft:l,marginLeft:6},children:h.map((e,t)=>{var[r,o]=e;return(0,O.jsx)(Ss,{parentValue:n,keyName:r,keys:[...a,r],value:o,level:i},t)})})};bs.displayName=`JVR.KeyValues`;var xs=e=>{var{keyName:t,parentValue:n,keys:r,value:i}=e,{highlightUpdates:a}=fo(),o=typeof t==`number`,s=(0,D.useRef)(null);hs({value:i,highlightUpdates:a,highlightContainer:s});var c={keyName:t,value:i,keys:r,parentValue:n};return(0,O.jsxs)(D.Fragment,{children:[(0,O.jsxs)(`span`,{ref:s,children:[(0,O.jsx)(wo,B({isNumber:o,"data-placement":`left`},c)),(0,O.jsx)(ls,B({},c,{children:t})),(0,O.jsx)(wo,B({isNumber:o,"data-placement":`right`},c))]}),(0,O.jsx)(Eo,B({},c))]})};xs.displayName=`JVR.KayName`;var Ss=e=>{var{keyName:t,value:n,parentValue:r,level:i=0,keys:a=[]}=e,o=Oa(),s=ys(),c=Array.isArray(n),l=n instanceof Set,u=n instanceof Map,d=n instanceof Date,f=n instanceof URL;return n&&typeof n==`object`&&!c&&!l&&!u&&!d&&!f||c||l||u?(0,O.jsx)(Is,{keyName:t,value:l?Array.from(n):u?Object.fromEntries(n):n,parentValue:r,initialValue:n,keys:a,level:i+1}):(0,O.jsxs)(ps,B({className:`w-rjv-line`,value:n,keyName:t,keys:a,parentValue:r},{onMouseEnter:()=>o({[s]:!0}),onMouseLeave:()=>o({[s]:!1})},{children:[(0,O.jsx)(xs,{keyName:t,value:n,keys:a,parentValue:r}),(0,O.jsx)(as,{keyName:t,value:n,keys:a}),(0,O.jsx)(vs,{keyName:t,value:n,keys:a,parentValue:r,expandKey:s})]}))};Ss.displayName=`JVR.KeyValuesItem`;var Cs=[`value`,`keyName`],ws=[`as`,`render`],Ts=e=>{var{CountInfoExtra:t={}}=W();return os(t,e,`CountInfoExtra`),null};Ts.displayName=`JVR.CountInfoExtra`;var Es=e=>{var{value:t={},keyName:n}=e,r=V(e,Cs),{CountInfoExtra:i={}}=W(),{as:a,render:o}=i,s=V(i,ws);if(!o&&!s.children)return null;var c=a||`span`,l=o&&typeof o==`function`,u=B({},s,r);return l&&o(u,{value:t,keyName:n})||(0,O.jsx)(c,B({},u))};Es.displayName=`JVR.CountInfoExtraComps`;var Ds=[`value`,`keyName`],Os=[`as`,`render`],ks=e=>{var{CountInfo:t={}}=W();return os(t,e,`CountInfo`),null};ks.displayName=`JVR.CountInfo`;var As=e=>{var{value:t={},keyName:n}=e,r=V(e,Ds),{displayObjectSize:i}=fo(),{CountInfo:a={}}=W();if(!i)return null;var{as:o,render:s}=a,c=V(a,Os),l=o||`span`;c.style=B({},c.style,e.style);var u=Object.keys(t).length;c.children||=u+` item`+(u===1?``:`s`);var d=B({},c,r);return s&&typeof s==`function`&&s(B({},d,{"data-length":u}),{value:t,keyName:n})||(0,O.jsx)(l,B({},d))};As.displayName=`JVR.CountInfoComp`;var js=[`as`,`render`],Ms=e=>{var{Ellipsis:t={}}=W();return os(t,e,`Ellipsis`),null};Ms.displayName=`JVR.Ellipsis`;var Ns=e=>{var{isExpanded:t,value:n,keyName:r}=e,{Ellipsis:i={}}=W(),{as:a,render:o}=i,s=V(i,js),c=a||`span`;return o&&typeof o==`function`&&o(B({},s,{"data-expanded":t}),{value:n,keyName:r})||(!t||typeof n==`object`&&Object.keys(n).length==0?null:(0,O.jsx)(c,B({},s)))};Ns.displayName=`JVR.EllipsisComp`;var Ps=e=>{var{keyName:t,expandKey:n,keys:r=[],initialValue:i,value:a,parentValue:o,level:s}=e,c=Na(),l=Ia(),{onExpand:u,collapsed:d,shouldExpandNodeInitially:f}=fo(),p=typeof d==`boolean`?d:typeof d==`number`?s>d:!1,m=c[n]??(f?!1:p),h=f&&f(!m,{value:a,keys:r,level:s,keyName:t,parentValue:o});c[n]===void 0&&f&&(m=!h);var g=()=>{var e={expand:!m,value:a,keyid:n,keyName:t};u&&u(e),l({[n]:e.expand})},_={display:`inline-flex`,alignItems:`center`},v={transform:`rotate(`+(m?`-90`:`0`)+`deg)`,transition:`all 0.3s`},y=Object.keys(a).length,b=typeof a==`object`,x=Array.isArray(a),S=a instanceof Set,C=y!==0&&(x||S||b),w={style:_};C&&(w.onClick=g);var T={keyName:t,value:a,keys:r,parentValue:o};return(0,O.jsxs)(`span`,B({},w,{children:[C&&(0,O.jsx)(Do,B({style:v,expandKey:n},T)),(t||typeof t==`number`)&&(0,O.jsx)(xs,B({},T)),(0,O.jsx)(Go,{value:i,keyName:t}),(0,O.jsx)(Ko,{value:i,keyName:t}),(0,O.jsx)(Oo,B({isBrackets:x||S},T)),(0,O.jsx)(Ns,{keyName:t,value:a,isExpanded:m}),(0,O.jsx)(ko,B({isVisiable:m||!C,isBrackets:x||S},T)),(0,O.jsx)(As,{value:a,keyName:t}),(0,O.jsx)(Es,{value:a,keyName:t}),(0,O.jsx)(vs,{keyName:t,value:a,expandKey:n,parentValue:o,keys:r})]}))};Ps.displayName=`JVR.NestedOpen`;var Fs=[`className`,`children`,`parentValue`,`keyid`,`level`,`value`,`initialValue`,`keys`,`keyName`],Is=(0,D.forwardRef)((e,t)=>{var{className:n=``,parentValue:r,level:i=1,value:a,initialValue:o,keys:s,keyName:c}=e,l=V(e,Fs),u=Oa(),d=ys();return(0,O.jsxs)(`div`,B({className:[n,`w-rjv-inner`].filter(Boolean).join(` `),ref:t},l,{onMouseEnter:()=>u({[d]:!0}),onMouseLeave:()=>u({[d]:!1})},{children:[(0,O.jsx)(Ps,{expandKey:d,value:a,level:i,keys:s,parentValue:r,keyName:c,initialValue:o}),(0,O.jsx)(bs,{expandKey:d,value:a,level:i,keys:s,parentValue:r,keyName:c}),(0,O.jsx)(Ao,{expandKey:d,value:a,level:i,keys:s,parentValue:r,keyName:c})]}))});Is.displayName=`JVR.Container`;var Ls=e=>{var{BraceLeft:t={}}=U();return K(t,e,`BraceLeft`),null};Ls.displayName=`JVR.BraceLeft`;var Rs=e=>{var{BraceRight:t={}}=U();return K(t,e,`BraceRight`),null};Rs.displayName=`JVR.BraceRight`;var zs=e=>{var{BracketsLeft:t={}}=U();return K(t,e,`BracketsLeft`),null};zs.displayName=`JVR.BracketsLeft`;var Bs=e=>{var{BracketsRight:t={}}=U();return K(t,e,`BracketsRight`),null};Bs.displayName=`JVR.BracketsRight`;var Vs=e=>{var{Arrow:t={}}=U();return K(t,e,`Arrow`),null};Vs.displayName=`JVR.Arrow`;var Hs=e=>{var{Colon:t={}}=U();return K(t,e,`Colon`),null};Hs.displayName=`JVR.Colon`;var Us=e=>{var{Quote:t={}}=U();return K(t,e,`Quote`),null};Us.displayName=`JVR.Quote`;var Ws=e=>{var{ValueQuote:t={}}=U();return K(t,e,`ValueQuote`),null};Ws.displayName=`JVR.ValueQuote`;var Gs=e=>{var{Bigint:t={}}=H();return q(t,e,`Bigint`),null};Gs.displayName=`JVR.Bigint`;var Ks=e=>{var{Date:t={}}=H();return q(t,e,`Date`),null};Ks.displayName=`JVR.Date`;var qs=e=>{var{False:t={}}=H();return q(t,e,`False`),null};qs.displayName=`JVR.False`;var Js=e=>{var{Float:t={}}=H();return q(t,e,`Float`),null};Js.displayName=`JVR.Float`;var Ys=e=>{var{Int:t={}}=H();return q(t,e,`Int`),null};Ys.displayName=`JVR.Int`;var Xs=e=>{var{Map:t={}}=H();return q(t,e,`Map`),null};Xs.displayName=`JVR.Map`;var Zs=e=>{var{Nan:t={}}=H();return q(t,e,`Nan`),null};Zs.displayName=`JVR.Nan`;var Qs=e=>{var{Null:t={}}=H();return q(t,e,`Null`),null};Qs.displayName=`JVR.Null`;var $s=e=>{var{Set:t={}}=H();return q(t,e,`Set`),null};$s.displayName=`JVR.Set`;var ec=e=>{var{Str:t={}}=H();return q(t,e,`Str`),null};ec.displayName=`JVR.StringText`;var tc=e=>{var{True:t={}}=H();return q(t,e,`True`),null};tc.displayName=`JVR.True`;var nc=e=>{var{Undefined:t={}}=H();return q(t,e,`Undefined`),null};nc.displayName=`JVR.Undefined`;var rc=e=>{var{Url:t={}}=H();return q(t,e,`Url`),null};rc.displayName=`JVR.Url`;var ic=e=>{var{Copied:t={}}=W();return os(t,e,`Copied`),null};ic.displayName=`JVR.Copied`;var ac=[`className`,`style`,`value`,`children`,`collapsed`,`shouldExpandNodeInitially`,`indentWidth`,`displayObjectSize`,`shortenTextAfterLength`,`stringEllipsis`,`highlightUpdates`,`enableClipboard`,`displayDataTypes`,`objectSortKeys`,`onExpand`,`onCopied`,`beforeCopy`],J=(0,D.forwardRef)((e,t)=>{var{className:n=``,style:r,value:i,children:a,collapsed:o=!1,shouldExpandNodeInitially:s,indentWidth:c=15,displayObjectSize:l=!0,shortenTextAfterLength:u=30,stringEllipsis:d,highlightUpdates:f=!0,enableClipboard:p=!0,displayDataTypes:m=!0,objectSortKeys:h=!1,onExpand:g,onCopied:_,beforeCopy:v}=e,y=V(e,ac),b=B({lineHeight:1.4,fontFamily:`var(--w-rjv-font-family, Menlo, monospace)`,color:`var(--w-rjv-color, #002b36)`,backgroundColor:`var(--w-rjv-background-color, #00000000)`,fontSize:13},r),x=[`w-json-view-container`,`w-rjv`,n].filter(Boolean).join(` `);return(0,O.jsxs)(po,{initialState:{value:i,objectSortKeys:h,indentWidth:c,shouldExpandNodeInitially:o===!1?s:void 0,displayObjectSize:l,collapsed:o,enableClipboard:p,shortenTextAfterLength:u,stringEllipsis:d,highlightUpdates:f,onCopied:_,onExpand:g,beforeCopy:v},initialTypes:{displayDataTypes:m},children:[(0,O.jsx)(Is,B({value:i},y,{ref:t,className:x,style:b})),a]})});J.Bigint=Gs,J.Date=Ks,J.False=qs,J.Float=Js,J.Int=Ys,J.Map=Xs,J.Nan=Zs,J.Null=Qs,J.Set=$s,J.String=ec,J.True=tc,J.Undefined=nc,J.Url=rc,J.ValueQuote=Ws,J.Arrow=Vs,J.Colon=Hs,J.Quote=Us,J.Ellipsis=Ms,J.BraceLeft=Ls,J.BraceRight=Rs,J.BracketsLeft=zs,J.BracketsRight=Bs,J.Copied=ic,J.CountInfo=ks,J.CountInfoExtra=Ts,J.KeyName=cs,J.Row=fs,J.displayName=`JVR.JsonView`;function oc(e){return e.pagePath??e.id}var sc={"--w-rjv-font-family":`var(--font-family-mono)`,"--w-rjv-background-color":`transparent`,"--w-rjv-color":`var(--color-code-blue)`,"--w-rjv-key-string":`var(--color-code-blue)`,"--w-rjv-line-color":`var(--color-border-subtle)`,"--w-rjv-arrow-color":`var(--color-text-secondary)`,"--w-rjv-info-color":`var(--color-code-label)`,"--w-rjv-curlybraces-color":`var(--color-text-secondary)`,"--w-rjv-brackets-color":`var(--color-text-secondary)`,"--w-rjv-quotes-color":`var(--color-code-orange)`,"--w-rjv-quotes-string-color":`var(--color-code-orange)`,"--w-rjv-type-string-color":`var(--color-code-orange)`,"--w-rjv-type-int-color":`var(--color-code-number)`,"--w-rjv-type-float-color":`var(--color-code-number)`,"--w-rjv-type-bigint-color":`var(--color-code-number)`,"--w-rjv-type-boolean-color":`var(--color-code-keyword)`,"--w-rjv-type-null-color":`var(--color-code-keyword)`,"--w-rjv-type-nan-color":`var(--color-code-keyword)`,"--w-rjv-type-undefined-color":`var(--color-code-keyword)`,"--w-rjv-type-date-color":`var(--color-code-label)`,"--w-rjv-type-url-color":`var(--color-code-blue)`,fontSize:12,padding:`6px 8px`,wordBreak:`break-all`,whiteSpace:`pre-wrap`};function cc({state:e,onRefresh:t,onSelectBridge:n}){let{bridges:r,activeBridgeId:i,entries:a}=e,o=r.some(e=>Object.keys(a[e.id]??{}).length>0);return(0,O.jsxs)(`div`,{className:`flex flex-col overflow-hidden flex-1`,children:[(0,O.jsx)(`div`,{className:`flex items-center px-2.5 py-1.5 border-b border-border-subtle shrink-0 bg-bg-panel`,children:(0,O.jsx)(S,{variant:`outline`,size:`xs`,onClick:t,className:`hover:border-accent hover:text-accent`,children:`↻ 刷新`})}),r.length>1&&(0,O.jsx)(`div`,{className:`flex gap-1 px-2 py-1 border-b border-border-subtle shrink-0 overflow-x-auto bg-bg-panel`,children:r.map(e=>{let t=e.id===i;return(0,O.jsx)(`button`,{onClick:()=>n(e.id),title:e.id,className:`shrink-0 px-2 py-0.5 text-[11px] rounded border transition-colors `+(t?`border-accent text-accent bg-surface-3`:`border-border-subtle text-text-dim hover:border-accent hover:text-accent`),children:oc(e)},e.id)})}),r.length===0||!o?(0,O.jsx)(`div`,{className:`text-[12px] text-text-dim text-center px-4 py-6`,children:`暂无页面数据(仅显示 Page 级 data)`}):(0,O.jsx)(`div`,{className:`flex-1 overflow-hidden relative`,children:r.map(e=>{let t=e.id===i,n=a[e.id]??{},r=Object.keys(n);return(0,O.jsx)(`div`,{"data-bridge-id":e.id,className:`absolute inset-0 flex flex-col gap-2 p-2 overflow-y-auto`,style:{display:t?`flex`:`none`},children:r.length===0?(0,O.jsx)(`div`,{className:`text-[12px] text-text-dim text-center px-4 py-6`,children:`暂无页面数据(仅显示 Page 级 data)`}):r.map(t=>(0,O.jsxs)(`div`,{className:`border border-border-subtle rounded overflow-hidden shrink-0`,children:[(0,O.jsx)(`div`,{className:`bg-surface-3 px-2 py-0.5 text-[11px] text-code-label truncate`,children:t}),(0,O.jsx)(J,{value:n[t]??{},collapsed:1,displayDataTypes:!1,displayObjectSize:!1,enableClipboard:!1,indentWidth:12,style:sc})]},`${e.id}::${t}`))},e.id)})})]})}function lc(e){if(e==null)return``;if(typeof e==`string`)return e;if(typeof e==`object`)try{return JSON.stringify(e)}catch{return String(e)}return String(e)}function uc({items:e,onRefresh:t,onSet:n,onRemove:r,onClear:i,onClearAll:a,getPrefix:o}){let[s,c]=(0,D.useState)(null),[l,u]=(0,D.useState)(null),[d,f]=(0,D.useState)(!1),[p,m]=(0,D.useState)(``),[h,g]=(0,D.useState)(``),[_,v]=(0,D.useState)(``);(0,D.useEffect)(()=>{let e=!1,t,n=()=>{o().then(r=>{if(!e){if(r){m(r);return}t=setTimeout(n,300)}})};return n(),()=>{e=!0,t&&clearTimeout(t)}},[o]);async function y(e){f(!0),u(null);try{let t=await e();return t.ok?t:(u(t.error),null)}finally{f(!1)}}function b(e){c({key:e.key,draft:lc(e.value)})}async function x(){if(!s)return;let{key:e,draft:t}=s;c(null),await y(()=>n(e,t))}async function C(e){await y(()=>r(e))}async function w(){e.length!==0&&await y(()=>i())}async function T(){typeof window<`u`&&!window.confirm(`清空 simulator 中所有 appId 的 Storage 数据?该操作不可撤销。`)||await y(()=>a())}async function E(){let e=h.trim();if(!e){u(`key 不能为空`);return}let t=p+e;await y(()=>n(t,_))&&(g(``),v(``))}return(0,O.jsxs)(`div`,{className:`flex flex-col overflow-hidden flex-1`,"data-testid":`storage-panel`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-1.5 px-2.5 py-1.5 border-b border-border-subtle shrink-0 bg-bg-panel`,children:[(0,O.jsx)(S,{variant:`outline`,size:`xs`,onClick:t,disabled:d,className:`hover:border-accent hover:text-accent`,children:`↻ 刷新`}),(0,O.jsx)(S,{variant:`outline`,size:`xs`,onClick:w,disabled:d||e.length===0,className:`hover:border-destructive hover:text-destructive`,title:`仅清空当前 appId 的 Storage`,children:`清空`}),(0,O.jsx)(S,{variant:`outline`,size:`xs`,onClick:T,disabled:d,className:`hover:border-destructive hover:text-destructive`,title:`清空 simulator 中所有 appId 的 Storage`,children:`清空所有`}),l&&(0,O.jsx)(`span`,{className:`ml-2 text-[11px] text-destructive truncate`,title:l,children:l})]}),(0,O.jsx)(`div`,{className:`flex-1 overflow-y-auto`,children:(0,O.jsxs)(`table`,{className:`w-full border-collapse text-[12px]`,children:[(0,O.jsx)(`thead`,{children:(0,O.jsxs)(`tr`,{children:[(0,O.jsx)(`th`,{className:`text-left text-code-label font-normal px-2.5 py-1 border-b border-border-subtle text-[11px] sticky top-0 bg-bg-panel z-10 w-px pr-5`,children:`Key`}),(0,O.jsx)(`th`,{className:`text-left text-code-label font-normal px-2.5 py-1 border-b border-border-subtle text-[11px] sticky top-0 bg-bg-panel z-10`,children:`Value`}),(0,O.jsx)(`th`,{className:`w-px sticky top-0 bg-bg-panel z-10 border-b border-border-subtle`})]})}),(0,O.jsx)(`tbody`,{children:e.length===0?(0,O.jsx)(`tr`,{children:(0,O.jsx)(`td`,{colSpan:3,className:`text-[12px] text-text-dim text-center px-4 py-6`,children:`暂无 Storage 数据`})}):e.map(e=>{let t=s?.key===e.key,n=p&&e.key.startsWith(p)?e.key.slice(p.length):e.key;return(0,O.jsxs)(`tr`,{className:`hover:[&>td]:bg-surface`,children:[(0,O.jsx)(`td`,{className:`px-2.5 py-0.5 border-b border-border-subtle w-px pr-5 align-top`,children:(0,O.jsx)(`div`,{className:`font-mono text-code-blue max-w-[240px] truncate`,title:e.key,children:n})}),(0,O.jsx)(`td`,{className:`px-2.5 py-0.5 border-b border-border-subtle font-mono text-code-orange break-all align-top cursor-text`,onClick:()=>{t||b(e)},children:t?(0,O.jsx)(`input`,{autoFocus:!0,type:`text`,value:s.draft,onChange:t=>c({key:e.key,draft:t.target.value}),onBlur:x,onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),x()):e.key===`Escape`&&(e.preventDefault(),c(null))},className:`w-full bg-transparent outline-none border border-accent/60 rounded px-1 py-0 font-mono text-code-orange`}):lc(e.value)}),(0,O.jsx)(`td`,{className:`px-1 py-0.5 border-b border-border-subtle align-top`,children:(0,O.jsx)(`button`,{type:`button`,onClick:()=>C(e.key),disabled:d,title:`删除`,className:`text-text-dim hover:text-destructive px-1 leading-none`,children:`×`})})]},e.key)})})]})}),(0,O.jsxs)(`div`,{className:`flex items-center gap-1.5 px-2.5 py-1.5 border-t border-border-subtle shrink-0 bg-bg-panel`,children:[(0,O.jsx)(`input`,{type:`text`,placeholder:`key`,value:h,onChange:e=>g(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),E())},className:`w-32 bg-transparent border border-border-subtle rounded px-1.5 py-0.5 text-[12px] font-mono outline-none focus:border-accent`}),(0,O.jsx)(`input`,{type:`text`,placeholder:`value`,value:_,onChange:e=>v(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),E())},className:`flex-1 bg-transparent border border-border-subtle rounded px-1.5 py-0.5 text-[12px] font-mono outline-none focus:border-accent`}),(0,O.jsx)(S,{variant:`outline`,size:`xs`,onClick:()=>void E(),disabled:d||!h.trim(),className:`hover:border-accent hover:text-accent`,children:`+ 新增`})]})]})}function dc(e){let t=new Date(e);return[t.getHours(),t.getMinutes(),t.getSeconds()].map(e=>String(e).padStart(2,`0`)).join(`:`)}function fc(e){return e===`error`?`text-red-500`:e===`compiling`?`text-amber-500`:e===`ready`?`text-emerald-600`:`text-text-muted`}function pc(e){return e.kind===`event`?e.event.message:e.log.text}function mc({events:e,logs:t=[],onClear:n}){let r=e.length>0?e[e.length-1]:null,[i,a]=(0,D.useState)(``),o=(0,D.useRef)(null),s=(0,D.useRef)(null),c=(0,D.useRef)(!0);(0,D.useEffect)(()=>{let e=o.current;if(!e)return;let t=()=>{let{scrollTop:t,scrollHeight:n,clientHeight:r}=e;c.current=n-t-r<30};return e.addEventListener(`scroll`,t),()=>e.removeEventListener(`scroll`,t)},[]),(0,D.useEffect)(()=>{c.current&&s.current?.scrollIntoView({behavior:`auto`})},[e.length+t.length]);let l=(0,D.useMemo)(()=>{let n=[];e.forEach((t,r)=>{let i=r>0?e[r-1]:null,a=t.status===`ready`&&i?.status===`compiling`?t.at-i.at:null;n.push({kind:`event`,at:t.at,seq:t.seq,event:t,durationMs:a})});for(let e of t)n.push({kind:`log`,at:e.at,seq:e.seq,log:e});return n.sort((e,t)=>e.at===t.at?e.seq!==void 0&&t.seq!==void 0?e.seq-t.seq:0:e.at-t.at)},[e,t]),u=(0,D.useMemo)(()=>{if(!i)return l;let e=i.toLowerCase();return l.filter(t=>pc(t).toLowerCase().includes(e))},[l,i]),d=e.length===0&&t.length===0;return(0,O.jsxs)(`div`,{className:`flex flex-col h-full w-full min-h-0 text-[12px]`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-2 px-2 h-8 shrink-0 border-b border-border-subtle`,children:[r?(0,O.jsx)(`span`,{"data-compile-current":!0,"data-status":r.status,className:_(`truncate font-medium shrink-0`,fc(r.status)),children:r.message}):(0,O.jsx)(`span`,{className:`text-text-muted shrink-0`,children:`编译信息`}),(0,O.jsx)(`div`,{className:`flex-1 min-w-0`}),(0,O.jsx)(`input`,{type:`text`,value:i,onChange:e=>a(e.target.value),placeholder:`过滤...`,className:`h-6 px-2 text-[12px] rounded-sm border border-border-subtle bg-surface
2
+ text-text placeholder:text-text-dim
3
+ focus:outline-none focus:border-text-muted
4
+ w-40 shrink-0`}),i&&(0,O.jsxs)(`span`,{className:`text-[11px] text-text-muted tabular-nums shrink-0`,children:[u.length,`/`,l.length]}),(0,O.jsx)(`button`,{type:`button`,onClick:n,className:`px-2 h-6 rounded-sm text-text-muted hover:text-text hover:bg-surface-2 transition-colors shrink-0`,children:`清空`})]}),(0,O.jsx)(`div`,{ref:o,className:`flex-1 min-h-0 overflow-auto`,children:d?(0,O.jsx)(`div`,{className:`flex items-center justify-center h-full text-text-muted`,children:`暂无编译信息`}):u.length===0?(0,O.jsx)(`div`,{className:`flex items-center justify-center h-full text-text-muted`,children:`无匹配日志`}):(0,O.jsxs)(`ul`,{className:`px-2 py-1 space-y-0.5`,children:[u.map((e,t)=>e.kind===`event`?(0,O.jsxs)(`li`,{"data-compile-row":!0,"data-status":e.event.status,className:`flex items-baseline gap-2 leading-5`,children:[(0,O.jsx)(`span`,{className:`text-text-muted tabular-nums shrink-0`,children:dc(e.at)}),(0,O.jsx)(`span`,{className:_(`break-all`,fc(e.event.status)),children:e.event.message}),e.event.hotReload===!0&&(0,O.jsx)(`span`,{className:`shrink-0 px-1 rounded-sm bg-surface-2 text-text-muted`,children:`热更新`}),e.durationMs!==null&&(0,O.jsxs)(`span`,{"data-compile-duration":!0,className:`shrink-0 text-text-muted tabular-nums`,children:[(e.durationMs/1e3).toFixed(1),`s`]})]},`e-${e.at}-${t}`):(0,O.jsxs)(`li`,{"data-compile-log":!0,"data-stream":e.log.stream,className:`flex items-baseline gap-2 leading-5`,children:[(0,O.jsx)(`span`,{className:`text-text-muted tabular-nums shrink-0`,children:dc(e.at)}),(0,O.jsx)(`span`,{className:_(`break-all font-mono`,e.log.stream===`stderr`?`text-red-500`:`text-text`),children:e.log.text})]},`l-${e.at}-${t}`)),(0,O.jsx)(`div`,{ref:s})]})})]})}function hc(e){let{tabId:t,wxmlTree:n,onRefreshWxml:r,onInspectWxml:i,onClearWxmlInspection:a,appData:o,onRefreshAppData:s,onSelectAppDataBridge:c,storageItems:l,onRefreshStorage:u,onSetStorage:d,onRemoveStorage:f,onClearStorage:p,onClearAllStorage:m,getStoragePrefix:h,compileEvents:g=[],compileLogs:_=[],onClearCompileEvents:v}=e;switch(t){case`wxml`:return(0,O.jsx)(xa,{tree:n,onRefresh:r,onInspectElement:i,onClearInspection:a});case`appdata`:return(0,O.jsx)(cc,{state:o,onRefresh:s,onSelectBridge:c});case`storage`:return(0,O.jsx)(uc,{items:l,onRefresh:u,onSet:d,onRemove:f,onClear:p,onClearAll:m,getPrefix:h});case`compile`:return(0,O.jsx)(mc,{events:g,logs:_,onClear:v??(()=>{})})}}var gc=new Set([`simulator`,`editor`,`wxml`,`appdata`,`storage`,`console`,`compile`]);function _c({project:e}){let t=(0,D.useRef)(null),[n,r]=(0,D.useState)(!1),{session:i,device:a,simulator:o,panelData:s,rightPane:c,popover:l}=xt({projectPath:e.path}),u=Et(),{state:d}=u,[f]=(0,D.useState)(()=>Cn(d.dockTree??null,a.simPanelWidth,gc)),p=(0,D.useMemo)(()=>hn(),[]),[m,h]=(0,D.useState)(0);(0,D.useEffect)(()=>{let e=!1,t=x(t=>{e=!0,h(t)});return se().then(t=>{e||typeof t==`number`&&h(t)}),t},[]);let g=Qn({present:m>0,publish:w,deps:[m]});(0,D.useEffect)(()=>{let t=`Dimina DevTools`;return document.title=`${e.name} - ${t}`,Ne().then(n=>{n?.appName&&(t=n.appName,document.title=`${e.name} - ${t}`)}).catch(()=>{}),()=>{document.title=t}},[e.name]),(0,D.useEffect)(()=>()=>{t.current!==null&&window.clearTimeout(t.current)},[]);async function _(){if(o.currentPage)try{await navigator.clipboard.writeText(o.currentPage),r(!0),t.current!==null&&window.clearTimeout(t.current),t.current=window.setTimeout(()=>r(!1),b)}catch{r(!1)}}let v={rightPane:c.rightPane,onSelectTab:c.selectRightPane,wxmlTree:s.wxmlTree,onRefreshWxml:s.refreshWxml,onInspectWxml:s.inspectWxmlElement,onClearWxmlInspection:s.clearWxmlElementInspection,appData:s.appData,onRefreshAppData:s.refreshAppData,onSelectAppDataBridge:s.setActiveAppDataBridge,storageItems:s.storageItems,onRefreshStorage:s.refreshStorage,onSetStorage:s.setStorageItem,onRemoveStorage:s.removeStorageItem,onClearStorage:s.clearStorage,onClearAllStorage:s.clearAllStorage,getStoragePrefix:s.getStoragePrefix,compileEvents:i.compileEvents,compileLogs:i.compileLogs,onClearCompileEvents:i.clearCompileEvents};return(0,O.jsxs)(`div`,{className:`flex flex-col h-screen`,children:[(0,O.jsx)(`div`,{ref:g,style:{height:m},className:`shrink-0 w-full`,"data-area":`host-toolbar`}),(0,O.jsx)(Gn,{compileDropdownRef:l.compileDropdownRef,showCompilePanel:l.showCompilePanel,onToggleCompilePanel:l.toggleCompilePanel,onRelaunch:()=>i.relaunch(),compileStatus:i.compileStatus,dockModel:f,dockRegistry:p,layout:u,simPanelWidth:a.simPanelWidth}),(0,O.jsx)(`div`,{className:`flex-1 min-h-0 overflow-hidden`,children:(0,O.jsx)(Sc,{dockModel:f,dockRegistry:p,simPanelWidth:a.simPanelWidth,renderDomPanel:(e,t)=>e===`simulator`?(0,O.jsx)(ga,{device:a.device,zoom:a.zoom,onDeviceChange:a.handleDeviceChange,onZoomChange:a.handleZoomChange,compileStatus:i.compileStatus,currentPage:o.currentPage,copied:n,onCopyPagePath:_}):e===`editor`?(0,O.jsx)(_a,{}):e===`wxml`||e===`appdata`||e===`storage`||e===`compile`?(0,O.jsx)(xc,{tabId:e,active:t.active,panelProps:v}):null,onPersistTree:u.setDockTree,persistedTree:d.dockTree??null})})]})}function vc(e){return e.kind===`tabs`?e.panels.includes(`simulator`):e.children.some(vc)}function yc(e,t){function n(e){if(e.kind===`tabs`)return null;if(e.id===t.splitId)return(e.constraints?.[t.childIndex]??null)?.minPx??null;for(let t of e.children){let e=n(t);if(e!==null)return e}return null}return n(e)}function bc(e){if(e.kind===`tabs`)return null;for(let t=0;t<e.children.length;t++){let n=e.children[t];if((e.constraints?.[t]??null)!==null&&vc(n))return{splitId:e.id,childIndex:t};let r=bc(n);if(r)return r}return null}function xc({tabId:e,active:t,panelProps:n}){let r=(0,D.useRef)(n);(0,D.useEffect)(()=>{r.current=n});let i=(0,D.useRef)(!1);return(0,D.useEffect)(()=>{let n=t&&!i.current;if(i.current=t,!n)return;let a=r.current;e===`wxml`?a.onRefreshWxml():e===`appdata`?a.onRefreshAppData():e===`storage`&&a.onRefreshStorage()},[e,t]),(0,O.jsx)(hc,{tabId:e,...n})}function Sc(e){let{dockModel:t,dockRegistry:n,simPanelWidth:r,renderDomPanel:i,onPersistTree:a,persistedTree:o}=e,s=(0,D.useRef)(null),c=(0,D.useCallback)(e=>{e.visible?T({x:e.bounds.x,y:e.bounds.y,width:e.bounds.width,height:e.bounds.height}):T({x:0,y:0,width:0,height:0})},[]),l=(0,D.useCallback)((e,t,n)=>{if(e.current){t?(e.current.dispose(),e.current=Zn(t,{visible:!0,guardDisplayNone:!0,followScroll:!0,followGeometry:!0,publish:n})):(e.current.update({visible:!1,publish:n}),e.current.dispose(),e.current=null);return}t&&(e.current=Zn(t,{visible:!0,guardDisplayNone:!0,followScroll:!0,followGeometry:!0,publish:n}))},[]),u=(0,D.useCallback)((e,t)=>{e===`console`&&l(s,t,c)},[l,c]);return(0,D.useEffect)(()=>{let e=t.get().root,n=bc(e);n&&yc(e,n)!==r&&t.apply(e=>{let t=bc(e.root);return!t||yc(e.root,t)===r?e:an(e,t.splitId,t.childIndex,{minPx:r})})},[t,r]),(0,D.useEffect)(()=>()=>{s.current?.dispose(),s.current=null},[]),(0,D.useEffect)(()=>t.subscribe(e=>{a(jt(e.tree))}),[t,a]),(0,D.useEffect)(()=>{let e=jt(t.get());e!==o&&a(e)},[]),(0,O.jsx)(Yi,{model:t,registry:n,renderDomPanel:i,bindNativeSlot:u,onActiveTabClick:(0,D.useCallback)(e=>{e===`simulator`||e===`editor`||t.apply(t=>cn(t,e))},[t])})}typeof window<`u`&&window.document&&window.document.createElement;function Y(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r.defaultPrevented)return t?.(r)}}function Cc(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function wc(...e){return t=>{let n=!1,r=e.map(e=>{let r=Cc(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():Cc(e[t],null)}}}}function Tc(...e){return D.useCallback(wc(...e),e)}function Ec(e,t){let n=D.createContext(t),r=e=>{let{children:t,...r}=e,i=D.useMemo(()=>r,Object.values(r));return(0,O.jsx)(n.Provider,{value:i,children:t})};r.displayName=e+`Provider`;function i(r){let i=D.useContext(n);if(i)return i;if(t!==void 0)return t;throw Error(`\`${r}\` must be used within \`${e}\``)}return[r,i]}function Dc(e,t=[]){let n=[];function r(t,r){let i=D.createContext(r),a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=D.useMemo(()=>o,Object.values(o));return(0,O.jsx)(s.Provider,{value:c,children:r})};o.displayName=t+`Provider`;function s(n,o){let s=o?.[e]?.[a]||i,c=D.useContext(s);if(c)return c;if(r!==void 0)return r;throw Error(`\`${n}\` must be used within \`${t}\``)}return[o,s]}let i=()=>{let t=n.map(e=>D.createContext(e));return function(n){let r=n?.[e]||t;return D.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,Oc(i,...t)]}function Oc(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return D.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}var kc=globalThis?.document?D.useLayoutEffect:()=>{},Ac=D.useId||(()=>void 0),jc=0;function Mc(e){let[t,n]=D.useState(Ac());return kc(()=>{e||n(e=>e??String(jc++))},[e]),e||(t?`radix-${t}`:``)}var Nc=D.useInsertionEffect||kc;function Pc({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){let[i,a,o]=Fc({defaultProp:t,onChange:n}),s=e!==void 0,c=s?e:i;{let t=D.useRef(e!==void 0);D.useEffect(()=>{let e=t.current;e!==s&&console.warn(`${r} is changing from ${e?`controlled`:`uncontrolled`} to ${s?`controlled`:`uncontrolled`}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),t.current=s},[s,r])}return[c,D.useCallback(t=>{if(s){let n=Ic(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}function Fc({defaultProp:e,onChange:t}){let[n,r]=D.useState(e),i=D.useRef(n),a=D.useRef(t);return Nc(()=>{a.current=t},[t]),D.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}function Ic(e){return typeof e==`function`}var Lc=h(t(),1);function Rc(e){let t=zc(e),n=D.forwardRef((e,n)=>{let{children:r,...i}=e,a=D.Children.toArray(r),o=a.find(Vc);if(o){let e=o.props.children,r=a.map(t=>t===o?D.Children.count(e)>1?D.Children.only(null):D.isValidElement(e)?e.props.children:null:t);return(0,O.jsx)(t,{...i,ref:n,children:D.isValidElement(e)?D.cloneElement(e,void 0,r):null})}return(0,O.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function zc(e){let t=D.forwardRef((e,t)=>{let{children:n,...r}=e;if(D.isValidElement(n)){let e=Uc(n),i=Hc(r,n.props);return n.type!==D.Fragment&&(i.ref=t?wc(t,e):e),D.cloneElement(n,i)}return D.Children.count(n)>1?D.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Bc=Symbol(`radix.slottable`);function Vc(e){return D.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===Bc}function Hc(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function Uc(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var X=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=Rc(`Primitive.${t}`),r=D.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,O.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Wc(e,t){e&&Lc.flushSync(()=>e.dispatchEvent(t))}function Gc(e){let t=D.useRef(e);return D.useEffect(()=>{t.current=e}),D.useMemo(()=>(...e)=>t.current?.(...e),[])}function Kc(e,t=globalThis?.document){let n=Gc(e);D.useEffect(()=>{let e=e=>{e.key===`Escape`&&n(e)};return t.addEventListener(`keydown`,e,{capture:!0}),()=>t.removeEventListener(`keydown`,e,{capture:!0})},[n,t])}var qc=`DismissableLayer`,Jc=`dismissableLayer.update`,Yc=`dismissableLayer.pointerDownOutside`,Xc=`dismissableLayer.focusOutside`,Zc,Qc=D.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),$c=D.forwardRef((e,t)=>{let{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:a,onInteractOutside:o,onDismiss:s,...c}=e,l=D.useContext(Qc),[u,d]=D.useState(null),f=u?.ownerDocument??globalThis?.document,[,p]=D.useState({}),m=Tc(t,e=>d(e)),h=Array.from(l.layers),[g]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),_=h.indexOf(g),v=u?h.indexOf(u):-1,y=l.layersWithOutsidePointerEventsDisabled.size>0,b=v>=_,x=nl(e=>{let t=e.target,n=[...l.branches].some(e=>e.contains(t));!b||n||(i?.(e),o?.(e),e.defaultPrevented||s?.())},f),S=rl(e=>{let t=e.target;[...l.branches].some(e=>e.contains(t))||(a?.(e),o?.(e),e.defaultPrevented||s?.())},f);return Kc(e=>{v===l.layers.size-1&&(r?.(e),!e.defaultPrevented&&s&&(e.preventDefault(),s()))},f),D.useEffect(()=>{if(u)return n&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(Zc=f.body.style.pointerEvents,f.body.style.pointerEvents=`none`),l.layersWithOutsidePointerEventsDisabled.add(u)),l.layers.add(u),il(),()=>{n&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=Zc)}},[u,f,n,l]),D.useEffect(()=>()=>{u&&(l.layers.delete(u),l.layersWithOutsidePointerEventsDisabled.delete(u),il())},[u,l]),D.useEffect(()=>{let e=()=>p({});return document.addEventListener(Jc,e),()=>document.removeEventListener(Jc,e)},[]),(0,O.jsx)(X.div,{...c,ref:m,style:{pointerEvents:y?b?`auto`:`none`:void 0,...e.style},onFocusCapture:Y(e.onFocusCapture,S.onFocusCapture),onBlurCapture:Y(e.onBlurCapture,S.onBlurCapture),onPointerDownCapture:Y(e.onPointerDownCapture,x.onPointerDownCapture)})});$c.displayName=qc;var el=`DismissableLayerBranch`,tl=D.forwardRef((e,t)=>{let n=D.useContext(Qc),r=D.useRef(null),i=Tc(t,r);return D.useEffect(()=>{let e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),(0,O.jsx)(X.div,{...e,ref:i})});tl.displayName=el;function nl(e,t=globalThis?.document){let n=Gc(e),r=D.useRef(!1),i=D.useRef(()=>{});return D.useEffect(()=>{let e=e=>{if(e.target&&!r.current){let r=function(){al(Yc,n,a,{discrete:!0})},a={originalEvent:e};e.pointerType===`touch`?(t.removeEventListener(`click`,i.current),i.current=r,t.addEventListener(`click`,i.current,{once:!0})):r()}else t.removeEventListener(`click`,i.current);r.current=!1},a=window.setTimeout(()=>{t.addEventListener(`pointerdown`,e)},0);return()=>{window.clearTimeout(a),t.removeEventListener(`pointerdown`,e),t.removeEventListener(`click`,i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function rl(e,t=globalThis?.document){let n=Gc(e),r=D.useRef(!1);return D.useEffect(()=>{let e=e=>{e.target&&!r.current&&al(Xc,n,{originalEvent:e},{discrete:!1})};return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function il(){let e=new CustomEvent(Jc);document.dispatchEvent(e)}function al(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?Wc(i,a):i.dispatchEvent(a)}var ol=`focusScope.autoFocusOnMount`,sl=`focusScope.autoFocusOnUnmount`,cl={bubbles:!1,cancelable:!0},ll=`FocusScope`,ul=D.forwardRef((e,t)=>{let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=D.useState(null),l=Gc(i),u=Gc(a),d=D.useRef(null),f=Tc(t,e=>c(e)),p=D.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;D.useEffect(()=>{if(r){let e=function(e){if(p.paused||!s)return;let t=e.target;s.contains(t)?d.current=t:Z(d.current,{select:!0})},t=function(e){if(p.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||Z(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&Z(s)};document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,s,p.paused]),D.useEffect(()=>{if(s){_l.add(p);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(ol,cl);s.addEventListener(ol,l),s.dispatchEvent(t),t.defaultPrevented||(dl(bl(pl(s)),{select:!0}),document.activeElement===e&&Z(s))}return()=>{s.removeEventListener(ol,l),setTimeout(()=>{let t=new CustomEvent(sl,cl);s.addEventListener(sl,u),s.dispatchEvent(t),t.defaultPrevented||Z(e??document.body,{select:!0}),s.removeEventListener(sl,u),_l.remove(p)},0)}}},[s,l,u,p]);let m=D.useCallback(e=>{if(!n&&!r||p.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=fl(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&Z(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&Z(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,p.paused]);return(0,O.jsx)(X.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})});ul.displayName=ll;function dl(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(Z(r,{select:t}),document.activeElement!==n)return}function fl(e){let t=pl(e);return[ml(t,e),ml(t.reverse(),e)]}function pl(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function ml(e,t){for(let n of e)if(!hl(n,{upTo:t}))return n}function hl(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}function gl(e){return e instanceof HTMLInputElement&&`select`in e}function Z(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&gl(e)&&t&&e.select()}}var _l=vl();function vl(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=yl(e,t),e.unshift(t)},remove(t){e=yl(e,t),e[0]?.resume()}}}function yl(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function bl(e){return e.filter(e=>e.tagName!==`A`)}var xl=`Portal`,Sl=D.forwardRef((e,t)=>{let{container:n,...r}=e,[i,a]=D.useState(!1);kc(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?Lc.createPortal((0,O.jsx)(X.div,{...r,ref:t}),o):null});Sl.displayName=xl;function Cl(e,t){return D.useReducer((e,n)=>t[e][n]??e,e)}var wl=e=>{let{present:t,children:n}=e,r=Tl(t),i=typeof n==`function`?n({present:r.isPresent}):D.Children.only(n),a=Tc(r.ref,Dl(i));return typeof n==`function`||r.isPresent?D.cloneElement(i,{ref:a}):null};wl.displayName=`Presence`;function Tl(e){let[t,n]=D.useState(),r=D.useRef(null),i=D.useRef(e),a=D.useRef(`none`),[o,s]=Cl(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return D.useEffect(()=>{let e=El(r.current);a.current=o===`mounted`?e:`none`},[o]),kc(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,o=El(t);e?s(`MOUNT`):o===`none`||t?.display===`none`?s(`UNMOUNT`):s(n&&r!==o?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,s]),kc(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=a=>{let o=El(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(s(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},c=e=>{e.target===t&&(a.current=El(r.current))};return t.addEventListener(`animationstart`,c),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,c),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}else s(`ANIMATION_END`)},[t,s]),{isPresent:[`mounted`,`unmountSuspended`].includes(o),ref:D.useCallback(e=>{r.current=e?getComputedStyle(e):null,n(e)},[])}}function El(e){return e?.animationName||`none`}function Dl(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Ol=0;function kl(){D.useEffect(()=>{let e=document.querySelectorAll(`[data-radix-focus-guard]`);return document.body.insertAdjacentElement(`afterbegin`,e[0]??Al()),document.body.insertAdjacentElement(`beforeend`,e[1]??Al()),Ol++,()=>{Ol===1&&document.querySelectorAll(`[data-radix-focus-guard]`).forEach(e=>e.remove()),Ol--}},[])}function Al(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}var Q=function(){return Q=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Q.apply(this,arguments)};function jl(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function Ml(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var Nl=`right-scroll-bar-position`,Pl=`width-before-scroll-bar`,Fl=`with-scroll-bars-hidden`,Il=`--removed-body-scroll-bar-size`;function Ll(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function Rl(e,t){var n=(0,D.useState)(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(e){var t=n.value;t!==e&&(n.value=e,n.callback(e,t))}}}})[0];return n.callback=t,n.facade}var zl=typeof window<`u`?D.useLayoutEffect:D.useEffect,Bl=new WeakMap;function Vl(e,t){var n=Rl(t||null,function(t){return e.forEach(function(e){return Ll(e,t)})});return zl(function(){var t=Bl.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||Ll(e,null)}),i.forEach(function(e){r.has(e)||Ll(e,a)})}Bl.set(n,e)},[e]),n}function Hl(e){return e}function Ul(e,t){t===void 0&&(t=Hl);var n=[],r=!1;return{read:function(){if(r)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var i=t(e,r);return n.push(i),function(){n=n.filter(function(e){return e!==i})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var i=n;n=[],i.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},o=function(){return Promise.resolve().then(a)};o(),n={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),n}}}}}function Wl(e){e===void 0&&(e={});var t=Ul(null);return t.options=Q({async:!0,ssr:!1},e),t}var Gl=function(e){var t=e.sideCar,n=jl(e,[`sideCar`]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error(`Sidecar medium not found`);return D.createElement(r,Q({},n))};Gl.isSideCarExport=!0;function Kl(e,t){return e.useMedium(t),Gl}var ql=Wl(),Jl=function(){},Yl=D.forwardRef(function(e,t){var n=D.useRef(null),r=D.useState({onScrollCapture:Jl,onWheelCapture:Jl,onTouchMoveCapture:Jl}),i=r[0],a=r[1],o=e.forwardProps,s=e.children,c=e.className,l=e.removeScrollBar,u=e.enabled,d=e.shards,f=e.sideCar,p=e.noRelative,m=e.noIsolation,h=e.inert,g=e.allowPinchZoom,_=e.as,v=_===void 0?`div`:_,y=e.gapMode,b=jl(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),x=f,S=Vl([n,t]),C=Q(Q({},b),i);return D.createElement(D.Fragment,null,u&&D.createElement(x,{sideCar:ql,removeScrollBar:l,shards:d,noRelative:p,noIsolation:m,inert:h,setCallbacks:a,allowPinchZoom:!!g,lockRef:n,gapMode:y}),o?D.cloneElement(D.Children.only(s),Q(Q({},C),{ref:S})):D.createElement(v,Q({},C,{className:c,ref:S}),s))});Yl.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},Yl.classNames={fullWidth:Pl,zeroRight:Nl};var Xl,Zl=function(){if(Xl)return Xl;if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function Ql(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=Zl();return t&&e.setAttribute(`nonce`,t),e}function $l(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function eu(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var tu=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Ql())&&($l(t,n),eu(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},nu=function(){var e=tu();return function(t,n){D.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},ru=function(){var e=nu();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},iu={left:0,top:0,right:0,gap:0},au=function(e){return parseInt(e||``,10)||0},ou=function(e){var t=window.getComputedStyle(document.body),n=t[e===`padding`?`paddingLeft`:`marginLeft`],r=t[e===`padding`?`paddingTop`:`marginTop`],i=t[e===`padding`?`paddingRight`:`marginRight`];return[au(n),au(r),au(i)]},su=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return iu;var t=ou(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},cu=ru(),lu=`data-scroll-locked`,uu=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
5
+ .${Fl} {
3
6
  overflow: hidden ${r};
4
7
  padding-right: ${s}px ${r};
5
8
  }
6
- body[${cu}] {
9
+ body[${lu}] {
7
10
  overflow: hidden ${r};
8
11
  overscroll-behavior: contain;
9
12
  ${[t&&`position: relative ${r};`,n===`margin`&&`
@@ -16,31 +19,31 @@ import{C as e,S as t,a as n,b as r,c as i,d as a,g as o,h as s,l as c,m as l,n a
16
19
  `,n===`padding`&&`padding-right: ${s}px ${r};`].filter(Boolean).join(``)}
17
20
  }
18
21
 
19
- .${Ml} {
22
+ .${Nl} {
20
23
  right: ${s}px ${r};
21
24
  }
22
25
 
23
- .${Nl} {
26
+ .${Pl} {
24
27
  margin-right: ${s}px ${r};
25
28
  }
26
29
 
27
- .${Ml} .${Ml} {
30
+ .${Nl} .${Nl} {
28
31
  right: 0 ${r};
29
32
  }
30
33
 
31
- .${Nl} .${Nl} {
34
+ .${Pl} .${Pl} {
32
35
  margin-right: 0 ${r};
33
36
  }
34
37
 
35
- body[${cu}] {
36
- ${Fl}: ${s}px;
38
+ body[${lu}] {
39
+ ${Il}: ${s}px;
37
40
  }
38
- `},uu=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},du=function(){D.useEffect(function(){return document.body.setAttribute(cu,(uu()+1).toString()),function(){var e=uu()-1;e<=0?document.body.removeAttribute(cu):document.body.setAttribute(cu,e.toString())}},[])},fu=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;du();var a=D.useMemo(function(){return ou(i)},[i]);return D.createElement(su,{styles:lu(a,!t,i,n?``:`!important`)})},pu=!1;if(typeof window<`u`)try{var mu=Object.defineProperty({},`passive`,{get:function(){return pu=!0,!0}});window.addEventListener(`test`,mu,mu),window.removeEventListener(`test`,mu,mu)}catch{pu=!1}var hu=pu?{passive:!1}:!1,gu=function(e){return e.tagName===`TEXTAREA`},_u=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!gu(e)&&n[t]===`visible`)},vu=function(e){return _u(e,`overflowY`)},yu=function(e){return _u(e,`overflowX`)},bu=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),Cu(e,r)){var i=wu(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},xu=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},Su=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},Cu=function(e,t){return e===`v`?vu(t):yu(t)},wu=function(e,t){return e===`v`?xu(t):Su(t)},Tu=function(e,t){return e===`h`&&t===`rtl`?-1:1},Eu=function(e,t,n,r,i){var a=Tu(e,window.getComputedStyle(t).direction),o=a*r,s=n.target,c=t.contains(s),l=!1,u=o>0,d=0,f=0;do{if(!s)break;var p=wu(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&Cu(e,s)&&(d+=h,f+=m);var g=s.parentNode;s=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(u&&(i&&Math.abs(d)<1||!i&&o>d)||!u&&(i&&Math.abs(f)<1||!i&&-o>f))&&(l=!0),l},Du=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Ou=function(e){return[e.deltaX,e.deltaY]},ku=function(e){return e&&`current`in e?e.current:e},Au=function(e,t){return e[0]===t[0]&&e[1]===t[1]},ju=function(e){return`
41
+ `},du=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},fu=function(){D.useEffect(function(){return document.body.setAttribute(lu,(du()+1).toString()),function(){var e=du()-1;e<=0?document.body.removeAttribute(lu):document.body.setAttribute(lu,e.toString())}},[])},pu=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;fu();var a=D.useMemo(function(){return su(i)},[i]);return D.createElement(cu,{styles:uu(a,!t,i,n?``:`!important`)})},mu=!1;if(typeof window<`u`)try{var hu=Object.defineProperty({},`passive`,{get:function(){return mu=!0,!0}});window.addEventListener(`test`,hu,hu),window.removeEventListener(`test`,hu,hu)}catch{mu=!1}var gu=mu?{passive:!1}:!1,_u=function(e){return e.tagName===`TEXTAREA`},vu=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!_u(e)&&n[t]===`visible`)},yu=function(e){return vu(e,`overflowY`)},bu=function(e){return vu(e,`overflowX`)},xu=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),wu(e,r)){var i=Tu(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Su=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},Cu=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},wu=function(e,t){return e===`v`?yu(t):bu(t)},Tu=function(e,t){return e===`v`?Su(t):Cu(t)},Eu=function(e,t){return e===`h`&&t===`rtl`?-1:1},Du=function(e,t,n,r,i){var a=Eu(e,window.getComputedStyle(t).direction),o=a*r,s=n.target,c=t.contains(s),l=!1,u=o>0,d=0,f=0;do{if(!s)break;var p=Tu(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&wu(e,s)&&(d+=h,f+=m);var g=s.parentNode;s=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(u&&(i&&Math.abs(d)<1||!i&&o>d)||!u&&(i&&Math.abs(f)<1||!i&&-o>f))&&(l=!0),l},Ou=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},ku=function(e){return[e.deltaX,e.deltaY]},Au=function(e){return e&&`current`in e?e.current:e},ju=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Mu=function(e){return`
39
42
  .block-interactivity-${e} {pointer-events: none;}
40
43
  .allow-interactivity-${e} {pointer-events: all;}
41
- `},Mu=0,Nu=[];function Pu(e){var t=D.useRef([]),n=D.useRef([0,0]),r=D.useRef(),i=D.useState(Mu++)[0],a=D.useState(nu)[0],o=D.useRef(e);D.useEffect(function(){o.current=e},[e]),D.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=jl([e.lockRef.current],(e.shards||[]).map(ku),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=D.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=Du(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=bu(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=bu(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return Eu(h,t,e,h===`h`?s:c,!0)},[]),c=D.useCallback(function(e){var n=e;if(!(!Nu.length||Nu[Nu.length-1]!==a)){var r=`deltaY`in n?Ou(n):Du(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&Au(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(ku).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=D.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:Fu(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=D.useCallback(function(e){n.current=Du(e),r.current=void 0},[]),d=D.useCallback(function(t){l(t.type,Ou(t),t.target,s(t,e.lockRef.current))},[]),f=D.useCallback(function(t){l(t.type,Du(t),t.target,s(t,e.lockRef.current))},[]);D.useEffect(function(){return Nu.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,hu),document.addEventListener(`touchmove`,c,hu),document.addEventListener(`touchstart`,u,hu),function(){Nu=Nu.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,hu),document.removeEventListener(`touchmove`,c,hu),document.removeEventListener(`touchstart`,u,hu)}},[]);var p=e.removeScrollBar,m=e.inert;return D.createElement(D.Fragment,null,m?D.createElement(a,{styles:ju(i)}):null,p?D.createElement(fu,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Fu(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var Iu=Gl(Kl,Pu),Lu=D.forwardRef(function(e,t){return D.createElement(Jl,Q({},e,{ref:t,sideCar:Iu}))});Lu.classNames=Jl.classNames;var Ru=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},zu=new WeakMap,Bu=new WeakMap,Vu={},Hu=0,Uu=function(e){return e&&(e.host||Uu(e.parentNode))},Wu=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=Uu(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},Gu=function(e,t,n,r){var i=Wu(t,Array.isArray(e)?e:[e]);Vu[n]||(Vu[n]=new WeakMap);var a=Vu[n],o=[],s=new Set,c=new Set(i),l=function(e){!e||s.has(e)||(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){!e||c.has(e)||Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(zu.get(e)||0)+1,l=(a.get(e)||0)+1;zu.set(e,c),a.set(e,l),o.push(e),c===1&&i&&Bu.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),Hu++,function(){o.forEach(function(e){var t=zu.get(e)-1,i=a.get(e)-1;zu.set(e,t),a.set(e,i),t||(Bu.has(e)||e.removeAttribute(r),Bu.delete(e)),i||e.removeAttribute(n)}),Hu--,Hu||(zu=new WeakMap,zu=new WeakMap,Bu=new WeakMap,Vu={})}},Ku=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||Ru(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),Gu(r,i,n,`aria-hidden`)):function(){return null}},qu=`Dialog`,[Ju,Yu]=Ec(qu),[Xu,$]=Ju(qu),Zu=e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=D.useRef(null),c=D.useRef(null),[l,u]=Nc({prop:r,defaultProp:i??!1,onChange:a,caller:qu});return(0,O.jsx)(Xu,{scope:t,triggerRef:s,contentRef:c,contentId:jc(),titleId:jc(),descriptionId:jc(),open:l,onOpenChange:u,onOpenToggle:D.useCallback(()=>u(e=>!e),[u]),modal:o,children:n})};Zu.displayName=qu;var Qu=`DialogTrigger`,$u=D.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=$(Qu,n),a=wc(t,i.triggerRef);return(0,O.jsx)(X.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.contentId,"data-state":yd(i.open),...r,ref:a,onClick:Y(e.onClick,i.onOpenToggle)})});$u.displayName=Qu;var ed=`DialogPortal`,[td,nd]=Ju(ed,{forceMount:void 0}),rd=e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=$(ed,t);return(0,O.jsx)(td,{scope:t,forceMount:n,children:D.Children.map(r,e=>(0,O.jsx)(Cl,{present:n||a.open,children:(0,O.jsx)(xl,{asChild:!0,container:i,children:e})}))})};rd.displayName=ed;var id=`DialogOverlay`,ad=D.forwardRef((e,t)=>{let n=nd(id,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=$(id,e.__scopeDialog);return a.modal?(0,O.jsx)(Cl,{present:r||a.open,children:(0,O.jsx)(sd,{...i,ref:t})}):null});ad.displayName=id;var od=Lc(`DialogOverlay.RemoveScroll`),sd=D.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=$(id,n);return(0,O.jsx)(Lu,{as:od,allowPinchZoom:!0,shards:[i.contentRef],children:(0,O.jsx)(X.div,{"data-state":yd(i.open),...r,ref:t,style:{pointerEvents:`auto`,...r.style}})})}),cd=`DialogContent`,ld=D.forwardRef((e,t)=>{let n=nd(cd,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=$(cd,e.__scopeDialog);return(0,O.jsx)(Cl,{present:r||a.open,children:a.modal?(0,O.jsx)(ud,{...i,ref:t}):(0,O.jsx)(dd,{...i,ref:t})})});ld.displayName=cd;var ud=D.forwardRef((e,t)=>{let n=$(cd,e.__scopeDialog),r=D.useRef(null),i=wc(t,n.contentRef,r);return D.useEffect(()=>{let e=r.current;if(e)return Ku(e)},[]),(0,O.jsx)(fd,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Y(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:Y(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:Y(e.onFocusOutside,e=>e.preventDefault())})}),dd=D.forwardRef((e,t)=>{let n=$(cd,e.__scopeDialog),r=D.useRef(!1),i=D.useRef(!1);return(0,O.jsx)(fd,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),fd=D.forwardRef((e,t)=>{let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=$(cd,n),c=D.useRef(null),l=wc(t,c);return Ol(),(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(ll,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,O.jsx)(Qc,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":yd(s.open),...o,ref:l,onDismiss:()=>s.onOpenChange(!1)})}),(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(Cd,{titleId:s.titleId}),(0,O.jsx)(Td,{contentRef:c,descriptionId:s.descriptionId})]})]})}),pd=`DialogTitle`,md=D.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=$(pd,n);return(0,O.jsx)(X.h2,{id:i.titleId,...r,ref:t})});md.displayName=pd;var hd=`DialogDescription`,gd=D.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=$(hd,n);return(0,O.jsx)(X.p,{id:i.descriptionId,...r,ref:t})});gd.displayName=hd;var _d=`DialogClose`,vd=D.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=$(_d,n);return(0,O.jsx)(X.button,{type:`button`,...r,ref:t,onClick:Y(e.onClick,()=>i.onOpenChange(!1))})});vd.displayName=_d;function yd(e){return e?`open`:`closed`}var bd=`DialogTitleWarning`,[xd,Sd]=Tc(bd,{contentName:cd,titleName:pd,docsSlug:`dialog`}),Cd=({titleId:e})=>{let t=Sd(bd),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
44
+ `},Nu=0,Pu=[];function Fu(e){var t=D.useRef([]),n=D.useRef([0,0]),r=D.useRef(),i=D.useState(Nu++)[0],a=D.useState(ru)[0],o=D.useRef(e);D.useEffect(function(){o.current=e},[e]),D.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=Ml([e.lockRef.current],(e.shards||[]).map(Au),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=D.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=Ou(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=xu(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=xu(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return Du(h,t,e,h===`h`?s:c,!0)},[]),c=D.useCallback(function(e){var n=e;if(!(!Pu.length||Pu[Pu.length-1]!==a)){var r=`deltaY`in n?ku(n):Ou(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&ju(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(Au).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=D.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:Iu(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=D.useCallback(function(e){n.current=Ou(e),r.current=void 0},[]),d=D.useCallback(function(t){l(t.type,ku(t),t.target,s(t,e.lockRef.current))},[]),f=D.useCallback(function(t){l(t.type,Ou(t),t.target,s(t,e.lockRef.current))},[]);D.useEffect(function(){return Pu.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,gu),document.addEventListener(`touchmove`,c,gu),document.addEventListener(`touchstart`,u,gu),function(){Pu=Pu.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,gu),document.removeEventListener(`touchmove`,c,gu),document.removeEventListener(`touchstart`,u,gu)}},[]);var p=e.removeScrollBar,m=e.inert;return D.createElement(D.Fragment,null,m?D.createElement(a,{styles:Mu(i)}):null,p?D.createElement(pu,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Iu(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var Lu=Kl(ql,Fu),Ru=D.forwardRef(function(e,t){return D.createElement(Yl,Q({},e,{ref:t,sideCar:Lu}))});Ru.classNames=Yl.classNames;var zu=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},Bu=new WeakMap,Vu=new WeakMap,Hu={},Uu=0,Wu=function(e){return e&&(e.host||Wu(e.parentNode))},Gu=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=Wu(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},Ku=function(e,t,n,r){var i=Gu(t,Array.isArray(e)?e:[e]);Hu[n]||(Hu[n]=new WeakMap);var a=Hu[n],o=[],s=new Set,c=new Set(i),l=function(e){!e||s.has(e)||(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){!e||c.has(e)||Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(Bu.get(e)||0)+1,l=(a.get(e)||0)+1;Bu.set(e,c),a.set(e,l),o.push(e),c===1&&i&&Vu.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),Uu++,function(){o.forEach(function(e){var t=Bu.get(e)-1,i=a.get(e)-1;Bu.set(e,t),a.set(e,i),t||(Vu.has(e)||e.removeAttribute(r),Vu.delete(e)),i||e.removeAttribute(n)}),Uu--,Uu||(Bu=new WeakMap,Bu=new WeakMap,Vu=new WeakMap,Hu={})}},qu=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||zu(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),Ku(r,i,n,`aria-hidden`)):function(){return null}},Ju=`Dialog`,[Yu,Xu]=Dc(Ju),[Zu,$]=Yu(Ju),Qu=e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=D.useRef(null),c=D.useRef(null),[l,u]=Pc({prop:r,defaultProp:i??!1,onChange:a,caller:Ju});return(0,O.jsx)(Zu,{scope:t,triggerRef:s,contentRef:c,contentId:Mc(),titleId:Mc(),descriptionId:Mc(),open:l,onOpenChange:u,onOpenToggle:D.useCallback(()=>u(e=>!e),[u]),modal:o,children:n})};Qu.displayName=Ju;var $u=`DialogTrigger`,ed=D.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=$($u,n),a=Tc(t,i.triggerRef);return(0,O.jsx)(X.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.contentId,"data-state":bd(i.open),...r,ref:a,onClick:Y(e.onClick,i.onOpenToggle)})});ed.displayName=$u;var td=`DialogPortal`,[nd,rd]=Yu(td,{forceMount:void 0}),id=e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=$(td,t);return(0,O.jsx)(nd,{scope:t,forceMount:n,children:D.Children.map(r,e=>(0,O.jsx)(wl,{present:n||a.open,children:(0,O.jsx)(Sl,{asChild:!0,container:i,children:e})}))})};id.displayName=td;var ad=`DialogOverlay`,od=D.forwardRef((e,t)=>{let n=rd(ad,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=$(ad,e.__scopeDialog);return a.modal?(0,O.jsx)(wl,{present:r||a.open,children:(0,O.jsx)(cd,{...i,ref:t})}):null});od.displayName=ad;var sd=Rc(`DialogOverlay.RemoveScroll`),cd=D.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=$(ad,n);return(0,O.jsx)(Ru,{as:sd,allowPinchZoom:!0,shards:[i.contentRef],children:(0,O.jsx)(X.div,{"data-state":bd(i.open),...r,ref:t,style:{pointerEvents:`auto`,...r.style}})})}),ld=`DialogContent`,ud=D.forwardRef((e,t)=>{let n=rd(ld,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=$(ld,e.__scopeDialog);return(0,O.jsx)(wl,{present:r||a.open,children:a.modal?(0,O.jsx)(dd,{...i,ref:t}):(0,O.jsx)(fd,{...i,ref:t})})});ud.displayName=ld;var dd=D.forwardRef((e,t)=>{let n=$(ld,e.__scopeDialog),r=D.useRef(null),i=Tc(t,n.contentRef,r);return D.useEffect(()=>{let e=r.current;if(e)return qu(e)},[]),(0,O.jsx)(pd,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Y(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:Y(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:Y(e.onFocusOutside,e=>e.preventDefault())})}),fd=D.forwardRef((e,t)=>{let n=$(ld,e.__scopeDialog),r=D.useRef(!1),i=D.useRef(!1);return(0,O.jsx)(pd,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),pd=D.forwardRef((e,t)=>{let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=$(ld,n),c=D.useRef(null),l=Tc(t,c);return kl(),(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(ul,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,O.jsx)($c,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":bd(s.open),...o,ref:l,onDismiss:()=>s.onOpenChange(!1)})}),(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(wd,{titleId:s.titleId}),(0,O.jsx)(Ed,{contentRef:c,descriptionId:s.descriptionId})]})]})}),md=`DialogTitle`,hd=D.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=$(md,n);return(0,O.jsx)(X.h2,{id:i.titleId,...r,ref:t})});hd.displayName=md;var gd=`DialogDescription`,_d=D.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=$(gd,n);return(0,O.jsx)(X.p,{id:i.descriptionId,...r,ref:t})});_d.displayName=gd;var vd=`DialogClose`,yd=D.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=$(vd,n);return(0,O.jsx)(X.button,{type:`button`,...r,ref:t,onClick:Y(e.onClick,()=>i.onOpenChange(!1))})});yd.displayName=vd;function bd(e){return e?`open`:`closed`}var xd=`DialogTitleWarning`,[Sd,Cd]=Ec(xd,{contentName:ld,titleName:md,docsSlug:`dialog`}),wd=({titleId:e})=>{let t=Cd(xd),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
42
45
 
43
46
  If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
44
47
 
45
- For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return D.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},wd=`DialogDescriptionWarning`,Td=({contentRef:e,descriptionId:t})=>{let n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Sd(wd).contentName}}.`;return D.useEffect(()=>{let r=e.current?.getAttribute(`aria-describedby`);t&&r&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},Ed=Zu,Dd=rd,Od=ad,kd=ld,Ad=md,jd=gd,Md=vd,Nd=Ed,Pd=Dd,Fd=D.forwardRef(({className:e,...t},n)=>(0,O.jsx)(Od,{ref:n,className:_(`fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`,e),...t}));Fd.displayName=Od.displayName;var Id=D.forwardRef(({className:e,children:t,...n},r)=>(0,O.jsxs)(Pd,{children:[(0,O.jsx)(Fd,{}),(0,O.jsxs)(kd,{ref:r,className:_(`fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border border-border bg-surface text-text p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg`,e),...n,children:[t,(0,O.jsxs)(Md,{className:`absolute right-4 top-4 rounded-sm opacity-70 ring-offset-bg transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-accent focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-surface-active data-[state=open]:text-text-muted`,children:[(0,O.jsx)(Te,{className:`h-4 w-4`}),(0,O.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]}));Id.displayName=kd.displayName;var Ld=({className:e,...t})=>(0,O.jsx)(`div`,{className:_(`flex flex-col space-y-1.5 text-center sm:text-left`,e),...t});Ld.displayName=`DialogHeader`;var Rd=({className:e,...t})=>(0,O.jsx)(`div`,{className:_(`flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2`,e),...t});Rd.displayName=`DialogFooter`;var zd=D.forwardRef(({className:e,...t},n)=>(0,O.jsx)(Ad,{ref:n,className:_(`text-lg font-semibold leading-none tracking-tight`,e),...t}));zd.displayName=Ad.displayName;var Bd=D.forwardRef(({className:e,...t},n)=>(0,O.jsx)(jd,{ref:n,className:_(`text-sm text-text-muted`,e),...t}));Bd.displayName=jd.displayName;function Vd(){let[e,t]=(0,D.useState)(!1),[n,r]=(0,D.useState)(null),[i,a]=(0,D.useState)(`prompt`),[s,c]=(0,D.useState)(0),[l,d]=(0,D.useState)(``);(0,D.useEffect)(()=>p(o.Available,e=>{r(e),a(`prompt`),c(0),d(``),t(!0)}),[]),(0,D.useEffect)(()=>p(o.DownloadProgress,e=>{c(Math.round(e.percent))}),[]);let f=(0,D.useCallback)(async()=>{a(`downloading`),c(0);try{let e=await u(o.Download);e.success?a(`ready`):(d(e.error||`Download failed`),a(`error`))}catch(e){d(e instanceof Error?e.message:String(e)),a(`error`)}},[]),m=(0,D.useCallback)(()=>{u(o.Install).catch(e=>{console.warn(`[update] install failed:`,e)})},[]),h=(0,D.useCallback)(()=>{n?.mandatory&&i!==`ready`||t(!1)},[n,i]);return n?(0,O.jsx)(Nd,{open:e,onOpenChange:e=>{!e&&n?.mandatory&&i!==`ready`||t(e)},children:(0,O.jsxs)(Id,{className:`max-w-md`,children:[(0,O.jsxs)(Ld,{children:[(0,O.jsx)(zd,{children:i===`ready`?`Ready to Install`:`Update Available`}),(0,O.jsxs)(Bd,{children:[i===`prompt`&&`New version ${n.version} is available.`,i===`downloading`&&`Downloading... ${s}%`,i===`ready`&&`Download complete. Click install to restart and apply the update.`,i===`error`&&`Download failed: ${l}`]})]}),n.releaseNotes&&i===`prompt`&&(0,O.jsx)(`div`,{className:`max-h-40 overflow-y-auto rounded border border-border bg-surface-2 p-3 text-xs text-text-secondary whitespace-pre-wrap`,children:n.releaseNotes}),i===`downloading`&&(0,O.jsx)(`div`,{className:`h-2 w-full overflow-hidden rounded-full bg-surface-3`,children:(0,O.jsx)(`div`,{className:`h-full bg-accent transition-all duration-300`,style:{width:`${s}%`}})}),(0,O.jsxs)(Rd,{children:[i===`prompt`&&(0,O.jsxs)(O.Fragment,{children:[!n.mandatory&&(0,O.jsx)(S,{variant:`outline`,onClick:h,children:`Later`}),(0,O.jsx)(S,{onClick:f,children:`Download`})]}),i===`ready`&&(0,O.jsx)(S,{onClick:m,children:`Install & Restart`}),i===`error`&&(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(S,{variant:`outline`,onClick:h,children:`Close`}),(0,O.jsx)(S,{onClick:f,children:`Retry`})]})]})]})}):null}var Hd=`Dimina DevTools`;function Ud(){let[e,t]=(0,D.useState)(`list`),[n,r]=(0,D.useState)(null),[i,a]=(0,D.useState)([]),[o,s]=(0,D.useState)({}),[c,l]=(0,D.useState)(Hd),[u,d]=(0,D.useState)(!1),[f,p]=(0,D.useState)([]),[m,h]=(0,D.useState)(``);async function g(){a(await Pe())}(0,D.useEffect)(()=>{g(),Ne().then(e=>{e?.appName&&(l(e.appName),document.title=e.appName)}).catch(()=>{})},[]),(0,D.useEffect)(()=>{i.length!==0&&Promise.all(i.map(e=>Ge(e.path).then(t=>[e.path,t]))).then(e=>s(Object.fromEntries(e)))},[i]),(0,D.useEffect)(()=>le(()=>{document.title=c,t(`list`),r(null),Pe().then(a)}),[c]);async function _(){let e=await Fe();if(!e)return;let t;try{t=await Ie(e)}catch{return}await g(),x(t)}async function v(){let e;try{e=await qe()}catch{e=null}if(e&&`ready`in e){await g(),x(e.ready);return}if(e){let t;try{t=await Je(e)}catch{return}await g(),x(t);return}let[t,n]=await Promise.allSettled([Ke(),Ye()]);p(t.status===`fulfilled`?t.value:[]),h(n.status===`fulfilled`?n.value.baseDir:``),d(!0)}async function y(e){d(!1);let t;try{t=await Je(e)}catch{return}await g(),x(t)}async function b(e){await Le(e.path),await g()}function x(e){r(e),t(`project`)}return e===`list`?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(Vd,{}),(0,O.jsx)(ke,{projects:i,onAdd:_,onCreate:v,onOpen:x,onRemove:b,thumbnails:o}),(0,O.jsx)(Me,{open:u,templates:f,defaultBaseDir:m,onSubmit:y,onCancel:()=>d(!1),onBrowse:Fe})]}):(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(Vd,{}),(0,O.jsx)(gc,{project:n},n?.path)]})}Ee.createRoot(document.getElementById(`root`)).render((0,O.jsx)(Ud,{}));
46
- //# sourceMappingURL=index-BMwmmaSp.js.map
48
+ For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return D.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},Td=`DialogDescriptionWarning`,Ed=({contentRef:e,descriptionId:t})=>{let n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Cd(Td).contentName}}.`;return D.useEffect(()=>{let r=e.current?.getAttribute(`aria-describedby`);t&&r&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},Dd=Qu,Od=id,kd=od,Ad=ud,jd=hd,Md=_d,Nd=yd,Pd=Dd,Fd=Od,Id=D.forwardRef(({className:e,...t},n)=>(0,O.jsx)(kd,{ref:n,className:_(`fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`,e),...t}));Id.displayName=kd.displayName;var Ld=D.forwardRef(({className:e,children:t,...n},r)=>(0,O.jsxs)(Fd,{children:[(0,O.jsx)(Id,{}),(0,O.jsxs)(Ad,{ref:r,className:_(`fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border border-border bg-surface text-text p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg`,e),...n,children:[t,(0,O.jsxs)(Nd,{className:`absolute right-4 top-4 rounded-sm opacity-70 ring-offset-bg transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-accent focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-surface-active data-[state=open]:text-text-muted`,children:[(0,O.jsx)(Te,{className:`h-4 w-4`}),(0,O.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]}));Ld.displayName=Ad.displayName;var Rd=({className:e,...t})=>(0,O.jsx)(`div`,{className:_(`flex flex-col space-y-1.5 text-center sm:text-left`,e),...t});Rd.displayName=`DialogHeader`;var zd=({className:e,...t})=>(0,O.jsx)(`div`,{className:_(`flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2`,e),...t});zd.displayName=`DialogFooter`;var Bd=D.forwardRef(({className:e,...t},n)=>(0,O.jsx)(jd,{ref:n,className:_(`text-lg font-semibold leading-none tracking-tight`,e),...t}));Bd.displayName=jd.displayName;var Vd=D.forwardRef(({className:e,...t},n)=>(0,O.jsx)(Md,{ref:n,className:_(`text-sm text-text-muted`,e),...t}));Vd.displayName=Md.displayName;function Hd(){let[e,t]=(0,D.useState)(!1),[n,r]=(0,D.useState)(null),[i,a]=(0,D.useState)(`prompt`),[s,c]=(0,D.useState)(0),[l,d]=(0,D.useState)(``);(0,D.useEffect)(()=>p(o.Available,e=>{r(e),a(`prompt`),c(0),d(``),t(!0)}),[]),(0,D.useEffect)(()=>p(o.DownloadProgress,e=>{c(Math.round(e.percent))}),[]);let f=(0,D.useCallback)(async()=>{a(`downloading`),c(0);try{let e=await u(o.Download);e.success?a(`ready`):(d(e.error||`Download failed`),a(`error`))}catch(e){d(e instanceof Error?e.message:String(e)),a(`error`)}},[]),m=(0,D.useCallback)(()=>{u(o.Install).catch(e=>{console.warn(`[update] install failed:`,e)})},[]),h=(0,D.useCallback)(()=>{n?.mandatory&&i!==`ready`||t(!1)},[n,i]);return n?(0,O.jsx)(Pd,{open:e,onOpenChange:e=>{!e&&n?.mandatory&&i!==`ready`||t(e)},children:(0,O.jsxs)(Ld,{className:`max-w-md`,children:[(0,O.jsxs)(Rd,{children:[(0,O.jsx)(Bd,{children:i===`ready`?`Ready to Install`:`Update Available`}),(0,O.jsxs)(Vd,{children:[i===`prompt`&&`New version ${n.version} is available.`,i===`downloading`&&`Downloading... ${s}%`,i===`ready`&&`Download complete. Click install to restart and apply the update.`,i===`error`&&`Download failed: ${l}`]})]}),n.releaseNotes&&i===`prompt`&&(0,O.jsx)(`div`,{className:`max-h-40 overflow-y-auto rounded border border-border bg-surface-2 p-3 text-xs text-text-secondary whitespace-pre-wrap`,children:n.releaseNotes}),i===`downloading`&&(0,O.jsx)(`div`,{className:`h-2 w-full overflow-hidden rounded-full bg-surface-3`,children:(0,O.jsx)(`div`,{className:`h-full bg-accent transition-all duration-300`,style:{width:`${s}%`}})}),(0,O.jsxs)(zd,{children:[i===`prompt`&&(0,O.jsxs)(O.Fragment,{children:[!n.mandatory&&(0,O.jsx)(S,{variant:`outline`,onClick:h,children:`Later`}),(0,O.jsx)(S,{onClick:f,children:`Download`})]}),i===`ready`&&(0,O.jsx)(S,{onClick:m,children:`Install & Restart`}),i===`error`&&(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(S,{variant:`outline`,onClick:h,children:`Close`}),(0,O.jsx)(S,{onClick:f,children:`Retry`})]})]})]})}):null}var Ud=`Dimina DevTools`;function Wd(){let[e,t]=(0,D.useState)(`list`),[n,r]=(0,D.useState)(null),[i,a]=(0,D.useState)([]),[o,s]=(0,D.useState)({}),[c,l]=(0,D.useState)(Ud),[u,d]=(0,D.useState)(!1),[f,p]=(0,D.useState)([]),[m,h]=(0,D.useState)(``);async function g(){a(await Pe())}(0,D.useEffect)(()=>{g(),Ne().then(e=>{e?.appName&&(l(e.appName),document.title=e.appName)}).catch(()=>{})},[]),(0,D.useEffect)(()=>{i.length!==0&&Promise.all(i.map(e=>Ge(e.path).then(t=>[e.path,t]))).then(e=>s(Object.fromEntries(e)))},[i]),(0,D.useEffect)(()=>le(()=>{document.title=c,t(`list`),r(null),Pe().then(a)}),[c]);async function _(){let e=await Fe();if(!e)return;let t;try{t=await Ie(e)}catch{return}await g(),x(t)}async function v(){let e;try{e=await qe()}catch{e=null}if(e&&`ready`in e){await g(),x(e.ready);return}if(e){let t;try{t=await Je(e)}catch{return}await g(),x(t);return}let[t,n]=await Promise.allSettled([Ke(),Ye()]);p(t.status===`fulfilled`?t.value:[]),h(n.status===`fulfilled`?n.value.baseDir:``),d(!0)}async function y(e){d(!1);let t;try{t=await Je(e)}catch{return}await g(),x(t)}async function b(e){await Le(e.path),await g()}function x(e){r(e),t(`project`)}return e===`list`?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(Hd,{}),(0,O.jsx)(ke,{projects:i,onAdd:_,onCreate:v,onOpen:x,onRemove:b,thumbnails:o}),(0,O.jsx)(Me,{open:u,templates:f,defaultBaseDir:m,onSubmit:y,onCancel:()=>d(!1),onBrowse:Fe})]}):(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(Hd,{}),(0,O.jsx)(_c,{project:n},n?.path)]})}Ee.createRoot(document.getElementById(`root`)).render((0,O.jsx)(Wd,{}));
49
+ //# sourceMappingURL=index-HE9Xr9bQ.js.map