@dimina-kit/devtools 0.3.1-dev.20260515105504 → 0.3.1-dev.20260518054451

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 (34) hide show
  1. package/README.md +84 -64
  2. package/dist/main/index.bundle.js +106 -27
  3. package/dist/main/ipc/session.js +9 -1
  4. package/dist/main/menu/index.js +11 -0
  5. package/dist/main/services/projects/thumbnail.d.ts +4 -0
  6. package/dist/main/services/projects/thumbnail.js +32 -0
  7. package/dist/main/services/workspace/workspace-service.d.ts +2 -0
  8. package/dist/main/services/workspace/workspace-service.js +20 -0
  9. package/dist/main/utils/sender-policy.d.ts +7 -5
  10. package/dist/main/utils/sender-policy.js +8 -6
  11. package/dist/preload/index.d.ts +2 -0
  12. package/dist/preload/index.js +1 -0
  13. package/dist/preload/runtime/custom-apis.js +32 -3
  14. package/dist/preload/windows/simulator.js +26 -5
  15. package/dist/renderer/assets/index-BFdItKBK.js +46 -0
  16. package/dist/renderer/assets/{input-C5M5Wxn6.js → input-AH9UDYmj.js} +2 -2
  17. package/dist/renderer/assets/{ipc-transport-CUsl-fS2.js → ipc-transport-DNgBM6Qz.js} +2 -2
  18. package/dist/renderer/assets/ipc-transport-Dvmd5JZj.css +1 -0
  19. package/dist/renderer/assets/{popover-BSBPVO0o.js → popover-D1hoVYiY.js} +2 -2
  20. package/dist/renderer/assets/{select-B1tF3UAc.js → select-BgDHRj6r.js} +2 -2
  21. package/dist/renderer/assets/{settings-api-BjJalghB.js → settings-api-DBKlNKV3.js} +2 -2
  22. package/dist/renderer/assets/{settings-7w54H6p-.js → settings-m-tcmZy_.js} +2 -2
  23. package/dist/renderer/assets/{workbenchSettings-q2_-nc8t.js → workbenchSettings-CGacu-pI.js} +2 -2
  24. package/dist/renderer/entries/main/index.html +5 -5
  25. package/dist/renderer/entries/popover/index.html +5 -5
  26. package/dist/renderer/entries/settings/index.html +5 -5
  27. package/dist/renderer/entries/workbench-settings/index.html +4 -4
  28. package/dist/shared/ipc-channels.d.ts +6 -0
  29. package/dist/shared/ipc-channels.js +19 -0
  30. package/dist/shared/ipc-schemas.d.ts +4 -0
  31. package/dist/shared/ipc-schemas.js +4 -0
  32. package/package.json +4 -4
  33. package/dist/renderer/assets/index-DW_0thr-.js +0 -46
  34. package/dist/renderer/assets/ipc-transport-CltRuvhi.css +0 -1
@@ -0,0 +1,32 @@
1
+ import { createHash } from 'crypto';
2
+ import fs from 'fs';
3
+ import path from 'path';
4
+ import { app } from 'electron';
5
+ function getThumbnailDir() {
6
+ return path.join(app.getPath('userData'), 'thumbnails');
7
+ }
8
+ function hashProjectPath(projectPath) {
9
+ return createHash('sha256').update(projectPath).digest('hex').slice(0, 16);
10
+ }
11
+ function getThumbnailPath(projectPath) {
12
+ return path.join(getThumbnailDir(), `${hashProjectPath(projectPath)}.png`);
13
+ }
14
+ export function saveThumbnail(projectPath, image) {
15
+ const png = image.toPNG();
16
+ const dir = getThumbnailDir();
17
+ fs.mkdirSync(dir, { recursive: true });
18
+ const filePath = getThumbnailPath(projectPath);
19
+ fs.writeFileSync(filePath, png);
20
+ return `data:image/png;base64,${png.toString('base64')}`;
21
+ }
22
+ export function loadThumbnail(projectPath) {
23
+ const filePath = getThumbnailPath(projectPath);
24
+ try {
25
+ const buf = fs.readFileSync(filePath);
26
+ return `data:image/png;base64,${buf.toString('base64')}`;
27
+ }
28
+ catch {
29
+ return null;
30
+ }
31
+ }
32
+ //# sourceMappingURL=thumbnail.js.map
@@ -39,6 +39,8 @@ export interface WorkspaceService {
39
39
  } | null;
40
40
  getProjectPath(): string;
41
41
  hasActiveSession(): boolean;
42
+ captureThumbnail(projectPath: string): Promise<string | null>;
43
+ getThumbnail(projectPath: string): string | null;
42
44
  getProjectPages(projectPath: string): ProjectPages;
43
45
  getCompileConfig(projectPath: string): CompileConfig;
44
46
  saveCompileConfig(projectPath: string, config: CompileConfig): void;
@@ -1,6 +1,8 @@
1
+ import { webContents } from 'electron';
1
2
  import * as repo from '../projects/project-repository.js';
2
3
  import { clearSimulatorServicewechatReferer, setSimulatorServicewechatReferer, } from '../simulator/referer.js';
3
4
  import { loadWorkbenchSettings } from '../settings/index.js';
5
+ import { saveThumbnail, loadThumbnail } from '../projects/thumbnail.js';
4
6
  /** Build a workspace service bound to the given workbench context. */
5
7
  export function createWorkspaceService(ctx) {
6
8
  let currentSession = null;
@@ -96,6 +98,24 @@ export function createWorkspaceService(ctx) {
96
98
  getSession: () => currentSession,
97
99
  getProjectPath: () => currentProjectPath,
98
100
  hasActiveSession: () => currentSession !== null,
101
+ async captureThumbnail(projectPath) {
102
+ const simWcId = ctx.views.getSimulatorWebContentsId();
103
+ if (!simWcId)
104
+ return null;
105
+ const wc = webContents.fromId(simWcId);
106
+ if (!wc || wc.isDestroyed())
107
+ return null;
108
+ try {
109
+ const image = await wc.capturePage();
110
+ return saveThumbnail(projectPath, image);
111
+ }
112
+ catch {
113
+ return null;
114
+ }
115
+ },
116
+ getThumbnail(projectPath) {
117
+ return loadThumbnail(projectPath);
118
+ },
99
119
  getProjectPages: (projectPath) => repo.getProjectPages(projectPath),
100
120
  getCompileConfig: (projectPath) => repo.getCompileConfig(projectPath),
101
121
  saveCompileConfig: (projectPath, config) => repo.saveCompileConfig(projectPath, config),
@@ -10,11 +10,13 @@ import type { SenderPolicy } from './ipc-registry.js';
10
10
  * - the settings overlay view (when open)
11
11
  * - the popover overlay view (when open)
12
12
  *
13
- * The simulator webview is intentionally NOT on this list: its preload
14
- * (`src/preload/windows/simulator.ts`) uses `ipcRenderer.sendToHost`
15
- * exclusively, never `invoke`/`send`, so it can't legitimately reach an
16
- * ipcMain handler. Including it would only widen the attack surface if
17
- * the guest were ever compromised.
13
+ * The simulator webview is intentionally NOT on this list. Anything it
14
+ * needs from main (currently just the custom-apis bridge — see
15
+ * `installCustomApisBridge` in `src/preload/runtime/custom-apis.ts` and the
16
+ * matching `useCustomApiProxy` host hook) proxies through the trusted
17
+ * main-window renderer via `ipcRenderer.sendToHost` + `<webview>.send`.
18
+ * Keeping the guest off this list contains the blast radius if the
19
+ * simulator content is ever compromised.
18
20
  *
19
21
  * Any other sender — including a stale/destroyed sender or an unknown
20
22
  * iframe — is rejected.
@@ -8,11 +8,13 @@
8
8
  * - the settings overlay view (when open)
9
9
  * - the popover overlay view (when open)
10
10
  *
11
- * The simulator webview is intentionally NOT on this list: its preload
12
- * (`src/preload/windows/simulator.ts`) uses `ipcRenderer.sendToHost`
13
- * exclusively, never `invoke`/`send`, so it can't legitimately reach an
14
- * ipcMain handler. Including it would only widen the attack surface if
15
- * the guest were ever compromised.
11
+ * The simulator webview is intentionally NOT on this list. Anything it
12
+ * needs from main (currently just the custom-apis bridge — see
13
+ * `installCustomApisBridge` in `src/preload/runtime/custom-apis.ts` and the
14
+ * matching `useCustomApiProxy` host hook) proxies through the trusted
15
+ * main-window renderer via `ipcRenderer.sendToHost` + `<webview>.send`.
16
+ * Keeping the guest off this list contains the blast radius if the
17
+ * simulator content is ever compromised.
16
18
  *
17
19
  * Any other sender — including a stale/destroyed sender or an unknown
18
20
  * iframe — is rejected.
@@ -35,7 +37,7 @@ export function createWorkbenchSenderPolicy(ctx) {
35
37
  const popoverViewId = ctx.views.getPopoverWebContentsId();
36
38
  if (popoverViewId != null && sender.id === popoverViewId)
37
39
  return true;
38
- // simulator preload uses sendToHost only; never reaches ipcMain handlers.
40
+ // simulator <webview> proxies through main-window renderer (see file header).
39
41
  return false;
40
42
  };
41
43
  }
@@ -13,5 +13,7 @@ export { installConsoleInstrumentation } from './instrumentation/console.js';
13
13
  export { installAppDataInstrumentation, sendAllAppData } from './instrumentation/app-data.js';
14
14
  export { installWxmlInstrumentation, sendWxmlTree, setupWxmlObserver } from './instrumentation/wxml.js';
15
15
  export { installSimulatorBridge } from './runtime/bridge.js';
16
+ export { installCustomApisBridge } from './runtime/custom-apis.js';
17
+ export type { DiminaCustomApisBridge } from './runtime/custom-apis.js';
16
18
  export { setupApiCompatHook } from './shared/api-compat.js';
17
19
  //# sourceMappingURL=index.d.ts.map
@@ -13,5 +13,6 @@ export { installConsoleInstrumentation } from './instrumentation/console.js';
13
13
  export { installAppDataInstrumentation, sendAllAppData } from './instrumentation/app-data.js';
14
14
  export { installWxmlInstrumentation, sendWxmlTree, setupWxmlObserver } from './instrumentation/wxml.js';
15
15
  export { installSimulatorBridge } from './runtime/bridge.js';
16
+ export { installCustomApisBridge } from './runtime/custom-apis.js';
16
17
  export { setupApiCompatHook } from './shared/api-compat.js';
17
18
  //# sourceMappingURL=index.js.map
@@ -1,9 +1,38 @@
1
1
  import { contextBridge, ipcRenderer } from 'electron';
2
- import { SimulatorCustomApiChannel } from '../../shared/ipc-channels.js';
2
+ import { SimulatorCustomApiBridgeChannel } from '../../shared/ipc-channels.js';
3
+ // The simulator <webview> is intentionally kept off the workbench sender-policy
4
+ // white-list, so it cannot reach `ipcMain.handle` directly. Instead the bridge
5
+ // asks the trusted main-window renderer to proxy the call: webview sends via
6
+ // `ipcRenderer.sendToHost`, host does the `ipcInvoke`, and posts the result
7
+ // back through `<webview>.send`. Requests and responses are correlated by id
8
+ // so concurrent invokes do not tangle.
3
9
  function buildBridge() {
10
+ let nextId = 1;
11
+ const pending = new Map();
12
+ ipcRenderer.on(SimulatorCustomApiBridgeChannel.Response, (_event, payload) => {
13
+ const entry = pending.get(payload.id);
14
+ if (!entry)
15
+ return;
16
+ pending.delete(payload.id);
17
+ if ('error' in payload) {
18
+ entry.reject(new Error(payload.error));
19
+ }
20
+ else {
21
+ entry.resolve(payload.result);
22
+ }
23
+ });
24
+ const send = (req) => {
25
+ return new Promise((resolve, reject) => {
26
+ pending.set(req.id, {
27
+ resolve: (value) => resolve(value),
28
+ reject,
29
+ });
30
+ ipcRenderer.sendToHost(SimulatorCustomApiBridgeChannel.Request, req);
31
+ });
32
+ };
4
33
  return {
5
- list: () => ipcRenderer.invoke(SimulatorCustomApiChannel.List),
6
- invoke: (name, params) => ipcRenderer.invoke(SimulatorCustomApiChannel.Invoke, name, params),
34
+ list: () => send({ id: nextId++, op: 'list' }),
35
+ invoke: (name, params) => send({ id: nextId++, op: 'invoke', name, params }),
7
36
  };
8
37
  }
9
38
  export function installCustomApisBridge() {
@@ -187,9 +187,9 @@ var SimulatorChannel = {
187
187
  AppData: "simulator:appdata",
188
188
  AppDataAll: "simulator:appdata-all"
189
189
  };
190
- var SimulatorCustomApiChannel = {
191
- List: "simulator:custom-apis:list",
192
- Invoke: "simulator:custom-apis:invoke"
190
+ var SimulatorCustomApiBridgeChannel = {
191
+ Request: "simulator:custom-apis:bridge-request",
192
+ Response: "simulator:custom-apis:bridge-response"
193
193
  };
194
194
  var BridgeChannel = {
195
195
  WxmlRefreshRequest: "wxml:refresh:request",
@@ -199,9 +199,30 @@ var BridgeChannel = {
199
199
 
200
200
  // src/preload/runtime/custom-apis.ts
201
201
  function buildBridge() {
202
+ let nextId = 1;
203
+ const pending = /* @__PURE__ */ new Map();
204
+ import_electron2.ipcRenderer.on(SimulatorCustomApiBridgeChannel.Response, (_event, payload) => {
205
+ const entry = pending.get(payload.id);
206
+ if (!entry) return;
207
+ pending.delete(payload.id);
208
+ if ("error" in payload) {
209
+ entry.reject(new Error(payload.error));
210
+ } else {
211
+ entry.resolve(payload.result);
212
+ }
213
+ });
214
+ const send = (req) => {
215
+ return new Promise((resolve, reject) => {
216
+ pending.set(req.id, {
217
+ resolve: (value) => resolve(value),
218
+ reject
219
+ });
220
+ import_electron2.ipcRenderer.sendToHost(SimulatorCustomApiBridgeChannel.Request, req);
221
+ });
222
+ };
202
223
  return {
203
- list: () => import_electron2.ipcRenderer.invoke(SimulatorCustomApiChannel.List),
204
- invoke: (name, params) => import_electron2.ipcRenderer.invoke(SimulatorCustomApiChannel.Invoke, name, params)
224
+ list: () => send({ id: nextId++, op: "list" }),
225
+ invoke: (name, params) => send({ id: nextId++, op: "invoke", name, params })
205
226
  };
206
227
  }
207
228
  function installCustomApisBridge() {
@@ -0,0 +1,46 @@
1
+ import{C as e,D as t,E as n,T as r,_ as i,a,d as o,g as s,h as c,m as l,n as u,o as d,p as f,r as p,s as m,t as h,u as g,w as _,y as v}from"./ipc-transport-DNgBM6Qz.js";import{n as y,r as b,t as x}from"./input-AH9UDYmj.js";import{_ as S,a as C,b as w,c as T,d as ee,f as te,g as ne,h as re,i as ie,m as ae,n as oe,o as se,p as ce,r as le,s as ue,t as de,u as fe,v as pe,x as E,y as me}from"./select-BgDHRj6r.js";var he=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),ge=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),_e=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),ve=e=>{let t=_e(e);return t.charAt(0).toUpperCase()+t.slice(1)},ye={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`},be=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},D=t(n()),xe=(0,D.createContext)({}),Se=()=>(0,D.useContext)(xe),Ce=(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=``}=Se()??{},m=r??d?Number(n??u)*24/Number(t??l):n??u;return(0,D.createElement)(`svg`,{ref:c,...ye,width:t??l??ye.width,height:t??l??ye.height,stroke:e??f,strokeWidth:m,className:he(`lucide`,p,i),...!a&&!be(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,D.createElement)(e,t)),...Array.isArray(a)?a:[a]])}),we=(e,t)=>{let n=(0,D.forwardRef)(({className:n,...r},i)=>(0,D.createElement)(Ce,{ref:i,iconNode:t,className:he(`lucide-${ge(ve(e))}`,`lucide-${e}`,n),...r}));return n.displayName=ve(e),n},Te=we(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),Ee=we(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),De=t(_(),1),O=e();function Oe({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:b(e.lastOpened)})]}),i&&(0,O.jsx)(E,{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 ke({projects:e,onAdd:t,onOpen:n,onRemove:r,thumbnails:i}){let[a,o]=(0,D.useState)(``),s=(0,D.useMemo)(()=>{if(!a.trim())return e;let t=a.trim().toLowerCase();return e.filter(e=>(e.name||``).toLowerCase().includes(t)||(e.path||``).toLowerCase().includes(t))},[e,a]);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)(Te,{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)(x,{placeholder:`搜索`,value:a,onChange:e=>o(e.target.value),className:`w-full h-8 pl-8 pr-3 rounded-md text-sm`})]})}),(0,O.jsx)(E,{variant:`ghost`,size:`sm`,onClick:t,className:`shrink-0 text-accent hover:text-accent-hover hover:bg-transparent`,children:`导入`})]}),e.length>0?s.length>0?(0,O.jsx)(`div`,{className:`grid gap-4`,style:{gridTemplateColumns:`repeat(auto-fill, minmax(220px, 1fr))`},children:s.map(e=>(0,O.jsx)(Oe,{project:e,onOpen:n,onRemove:r,thumbnail:i?.[e.path]},e.path))}):(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:`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:`暂无项目,点击「导入」添加`})]})]})})}function Ae(){return h(a.GetBranding)}function je(){return u(a.GetPreloadPath)}function Me(){return u(o.List)}function Ne(){return h(m.OpenDirectory)}function Pe(e){return u(o.Add,e)}function Fe(e){return h(o.Remove,e)}function Ie(e){return u(g.Open,e)}function Le(e){return u(g.GetPages,e)}function Re(e){return u(g.GetCompileConfig,e)}function ze(e,t){return u(g.SaveCompileConfig,e,t)}function Be(e){return p(g.Status,t=>e(t))}function Ve(e){return h(g.CaptureThumbnail,e)}function He(e){return h(g.GetThumbnail,e)}var Ue={selected:`simulator`,simulatorVisible:!0};function We(e){return e+48}function Ge(e,t){return Math.max(200,Math.min(t-200,e))}function k(e){return e.current}function Ke(e){let{initialDevice:t,simulatorRef:n}=e,[r,i]=(0,D.useState)(t),[a,o]=(0,D.useState)(100),[s,c]=(0,D.useState)(()=>We(t.width)),l=(0,D.useRef)(null),u=(0,D.useRef)(s),d=(0,D.useRef)(s),f=(0,D.useRef)(r);(0,D.useEffect)(()=>{u.current=s,d.current=s},[s]),(0,D.useEffect)(()=>{f.current=r},[r]),(0,D.useEffect)(()=>()=>{l.current!==null&&window.cancelAnimationFrame(l.current)},[]);let p=(0,D.useCallback)(e=>{u.current=e,l.current===null&&(l.current=window.requestAnimationFrame(()=>{l.current=null,ae(u.current)}))},[]),m=(0,D.useCallback)(e=>{let t=k(n);try{t?.send?.(`device:change`,{brand:`Apple`,model:e.name,pixelRatio:e.pixelRatio,screenWidth:e.width,screenHeight:e.height,statusBarHeight:e.statusBarHeight,system:e.system,platform:`ios`,safeAreaBottom:e.safeAreaBottom})}catch{}},[n]);return{device:r,zoom:a,simPanelWidth:s,setSimPanelWidth:c,handleDeviceChange:(0,D.useCallback)(e=>{let t=me.find(t=>t.name===e.target.value)??me[1];i(t),m(t);let n=We(t.width);c(n),p(n)},[p,m]),handleZoomChange:(0,D.useCallback)(e=>{o(Number(e.target.value))},[]),handleSplitterDrag:(0,D.useCallback)(e=>{e.preventDefault();let t=e.clientX,n=d.current,r=e=>{let r=Ge(n+e.clientX-t,window.innerWidth);c(r),p(r)},i=()=>{window.removeEventListener(`mousemove`,r),window.removeEventListener(`mouseup`,i)};window.addEventListener(`mousemove`,r),window.addEventListener(`mouseup`,i)},[p]),sendDeviceInfo:m,simPanelWidthRef:d,deviceRef:f,scheduleResize:p}}function qe(e,t,n,r){let i=t.startPage||`pages/index/index`,a=(t.queryParams||[]).filter(e=>e.key).map(e=>`${encodeURIComponent(e.key)}=${encodeURIComponent(e.value)}`);return a.push(`scene=${t.scene||1001}`),`http://localhost:${n}/simulator.html${r?.length?`?apiNamespaces=${r.join(`,`)}`:``}#${e}|${i}?${a.join(`&`)}`}function Je(e){let t=e.split(`#`)[1];if(!t)return``;let n=t.indexOf(`|`);return n===-1?t.split(`?`)[0].split(`/`).slice(1).join(`/`):t.slice(n+1).split(`?`)[0]}function Ye(e){let[t,n]=e.split(`#`);if(!n)return e;let[r,i]=n.split(`?`),a=r.split(`|`);return a.length<=2?e:`${t}#${`${a[0]}|${a[a.length-1]}`}${i?`?${i}`:``}`}function Xe(e){let{projectPath:t,simulatorRef:n}=e,[r,i]=(0,D.useState)({status:`compiling`,message:`正在编译...`}),[a,o]=(0,D.useState)(null),[s,c]=(0,D.useState)([]),[l,u]=(0,D.useState)(0),[d,f]=(0,D.useState)({startPage:``,scene:oe,queryParams:[]}),[p,m]=(0,D.useState)(``);(0,D.useEffect)(()=>{let e=!1;async function n(){try{let n=await Ie(t);if(e)return;if(!n.success){i({status:`error`,message:n.error});return}let[r,a]=await Promise.all([Le(t),Re(t)]);if(e)return;o(n.appInfo),u(n.port),c(r.pages),f({startPage:a.startPage||r.entryPagePath||r.pages[0]||``,scene:a.scene??1001,queryParams:a.queryParams||[]}),i({status:`ready`,message:`编译完成`})}catch(t){if(e)return;i({status:`error`,message:t instanceof Error?t.message:String(t)})}}return n(),()=>{e=!0}},[t]),(0,D.useEffect)(()=>{je().then(m)},[]),(0,D.useEffect)(()=>Be(e=>{if(i(e),e.hotReload){let e=k(n);if(!e)return;let t=e.getURL?.()??``,r=Ye(t);r===t?e.reload?.():(e.loadURL?.(r),setTimeout(()=>e.reload?.(),100))}}),[n]);let h=(0,D.useRef)(!1),g=(0,D.useRef)(null);return(0,D.useEffect)(()=>()=>{g.current?.()},[]),{compileStatus:r,appInfo:a,port:l,pages:s,compileConfig:d,preloadPath:p,relaunch:(0,D.useCallback)(async(e=d)=>{try{if(!a?.appId||h.current)return;let r=k(n);if(!r)return;g.current?.(),g.current=null,h.current=!0,await ze(t,e),i({status:`ready`,message:`正在刷新...`});let o=qe(a.appId,e,l),s=r.getURL?.(),c=!1,u=null,d=(t,n)=>{c||(c=!0,h.current=!1,g.current=null,u&&clearTimeout(u),r.removeEventListener?.(`did-finish-load`,p),r.removeEventListener?.(`did-stop-loading`,p),r.removeEventListener?.(`did-fail-load`,m),f(e),i({status:t,message:n}))},p=()=>{let e=r.getURL?.()??``,t=o.split(`#`)[1]??``,n=e.split(`#`)[1]??``;t&&n!==t||d(`ready`,`刷新完成`)},m=e=>{e.errorCode!==-3&&d(`error`,`刷新失败`)};r.addEventListener?.(`did-finish-load`,p),r.addEventListener?.(`did-stop-loading`,p),r.addEventListener?.(`did-fail-load`,m),g.current=()=>d(`error`,`已取消`),u=setTimeout(()=>{d(`error`,`刷新超时`)},3e4),s===o?r.reload?.():(r.loadURL?.(o),setTimeout(()=>r.reload?.(),100))}catch(e){h.current=!1,i({status:`error`,message:e instanceof Error?e.message:`刷新失败`})}},[a,d,l,t,n])}}function Ze(e){let{compileStatus:t,sendDeviceInfo:n,simulatorRef:r,simPanelWidthRef:i,deviceRef:a,appInfo:o,compileConfig:s,port:c,projectPath:l}=e,u=(0,D.useMemo)(()=>!o||!c?``:qe(o.appId,s,c),[o,s,c]),[d,f]=(0,D.useState)(()=>Je(u));return(0,D.useEffect)(()=>{f(Je(u))},[u]),(0,D.useEffect)(()=>{if(t.status!==`ready`)return;let e=k(r);if(!e){n(a.current);return}let o=!1,s=!1,c=null,d=0,p=t=>{let n=t;if(!n)try{n=e.getURL?.()}catch{}f(Je(n??u))},m=()=>{if(o||s)return;if(d++,d>50){console.warn(`[simulator] Max attach retries exceeded, giving up`),c!==null&&(window.clearInterval(c),c=null);return}let t;try{t=e.getWebContentsId?.()}catch{return}t&&(s=!0,c!==null&&(window.clearInterval(c),c=null),le(t,i.current),n(a.current),p())},h=e=>{p(e.url)},g=()=>{o||(p(),n(a.current),m())},_=null,v=()=>{o||(_!==null&&window.clearTimeout(_),_=window.setTimeout(()=>{o||Ve(l).catch(()=>{})},3e3))};return e.addEventListener?.(`did-navigate`,h),e.addEventListener?.(`did-navigate-in-page`,h),e.addEventListener?.(`dom-ready`,g),e.addEventListener?.(`did-finish-load`,g),e.addEventListener?.(`did-finish-load`,v),c=window.setInterval(m,200),m(),()=>{o=!0,c!==null&&window.clearInterval(c),_!==null&&window.clearTimeout(_),e.removeEventListener?.(`did-navigate`,h),e.removeEventListener?.(`did-navigate-in-page`,h),e.removeEventListener?.(`dom-ready`,g),e.removeEventListener?.(`did-finish-load`,g),e.removeEventListener?.(`did-finish-load`,v)}},[t.status,n,u,r,i,a,l]),{simulatorUrl:u,currentPage:d}}var Qe={bridges:[],activeBridgeId:null,entries:{}};function $e(e){let{compileStatus:t,simulatorRef:n}=e,[r,a]=(0,D.useState)(!0),[o,c]=(0,D.useState)(null),[l,u]=(0,D.useState)(Qe),[m,g]=(0,D.useState)([]),_=(0,D.useCallback)(e=>{u(t=>t.bridges.some(t=>t.id===e)&&t.activeBridgeId!==e?{...t,activeBridgeId:e}:t)},[]);(0,D.useEffect)(()=>{if(t.status!==`ready`)return;let e=e=>{let{channel:t,args:n}=e;if(t===f.Wxml)c(n[0]);else if(t===f.AppData){let e=n[0];if(!e.bridgeId||!e.moduleId)return;let{bridgeId:t,moduleId:r,componentPath:i,data:a}=e,o=i||r;u(e=>{let n=e.bridges.find(e=>e.id===t),s=r.startsWith(`page_`)&&!!i,c=s?i??null:n?.pagePath??null,l=n?e.bridges.map(e=>e.id===t?{...e,pagePath:c}:e):[...e.bridges,{id:t,pagePath:c}],u={...e.entries[t]??{},[o]:a},d={...e.entries,[t]:u};return{bridges:l,activeBridgeId:s||e.activeBridgeId===null?t:e.activeBridgeId,entries:d}})}else if(t===f.AppDataAll){let e=n[0],t=e?.bridges??[],r=e?.entries??{};u(e=>({bridges:t,activeBridgeId:e.activeBridgeId&&t.some(t=>t.id===e.activeBridgeId)?e.activeBridgeId:t.at(-1)?.id??null,entries:r}))}},r=()=>a(!1),i=()=>a(!0),o=null,s=null,l=0,d=()=>{if(o)return;let t=k(n);if(!t){l+=1,l>=50&&s!==null&&(window.clearInterval(s),s=null);return}o=t,s!==null&&(window.clearInterval(s),s=null),a(!0),t.addEventListener(`ipc-message`,e),t.addEventListener(`crashed`,r),t.addEventListener(`did-start-loading`,i)};return d(),o||(s=window.setInterval(d,200)),()=>{s!==null&&(window.clearInterval(s),s=null),o&&(o.removeEventListener(`ipc-message`,e),o.removeEventListener(`crashed`,r),o.removeEventListener(`did-start-loading`,i))}},[t.status,n]),(0,D.useEffect)(()=>ce(()=>{a(!0),c(null),u(Qe),g([])}),[]);let v=(0,D.useCallback)(()=>{k(n)?.send?.(d.WxmlRefreshRequest)},[n]),y=(0,D.useCallback)(()=>{k(n)?.send?.(d.AppDataGetAllRequest)},[n]),b=(0,D.useCallback)(async()=>{let e=await h(i.GetSnapshot);e&&g(e)},[]),x=(0,D.useCallback)(async(e,t)=>await h(i.Set,{key:e,value:t})??{ok:!1,error:`ipc transport failed`},[]),S=(0,D.useCallback)(async e=>await h(i.Remove,{key:e})??{ok:!1,error:`ipc transport failed`},[]),C=(0,D.useCallback)(async()=>await h(i.Clear)??{ok:!1,error:`ipc transport failed`},[]),w=(0,D.useCallback)(async()=>await h(i.ClearAll)??{ok:!1,error:`ipc transport failed`},[]),T=(0,D.useCallback)(async()=>await h(i.GetActivePrefix)??``,[]),ee=(0,D.useCallback)(async e=>await h(s.Inspect,e),[]),te=(0,D.useCallback)(async()=>{await h(s.Clear)},[]);return(0,D.useEffect)(()=>p(i.Event,e=>{e.type===`cleared`?g([]):e.type===`added`||e.type===`updated`?g(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`&&g(t=>t.filter(t=>t.key!==e.key))}),[]),{connected:r,wxmlTree:o,appData:l,storageItems:m,refreshWxml:v,refreshAppData:y,setActiveAppDataBridge:_,refreshStorage:b,setStorageItem:x,removeStorageItem:S,clearStorage:C,clearAllStorage:w,getStoragePrefix:T,inspectWxmlElement:ee,clearWxmlElementInspection:te}}function et({compileStatus:e,simulatorRef:t}){(0,D.useEffect)(()=>{if(e.status!==`ready`)return;let n=async(e,t)=>{let n;try{let e=t.op===`list`?await u(c.List):await u(c.Invoke,t.name,t.params);n={id:t.id,result:e}}catch(e){n={id:t.id,error:e instanceof Error?e.message:String(e)}}try{e.send?.(l.Response,n)}catch{}},r=e=>{let{channel:r,args:i}=e;if(r!==l.Request)return;let a=i[0];if(!a||typeof a.id!=`number`)return;let o=k(t);o&&n(o,a)},i=null,a=null,o=0,s=()=>{if(i)return;let e=k(t);if(!e){o+=1,o>=50&&a!==null&&(window.clearInterval(a),a=null);return}i=e,a!==null&&(window.clearInterval(a),a=null),e.addEventListener(`ipc-message`,r)};return s(),i||(a=window.setInterval(s,200)),()=>{a!==null&&(window.clearInterval(a),a=null),i&&i.removeEventListener(`ipc-message`,r)}},[e.status,t])}function tt(e){let{initialRightPane:t,simPanelWidthRef:n}=e,[r,i]=(0,D.useState)(t),a=(0,D.useCallback)((e,t)=>{if(e.selected===`simulator`){if(e.simulatorVisible){re();return}ne(!1,t);return}ne(!1,t)},[]);return{rightPane:r,selectRightPane:(0,D.useCallback)(e=>{let t={selected:e,simulatorVisible:!0};i(t),a(t,n.current)},[a,n]),toggleRightPaneVisible:(0,D.useCallback)(()=>{i(e=>{let t={...e,simulatorVisible:!e.simulatorVisible};return a(t,n.current),t})},[a,n])}}function nt(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=T(()=>o(!1)),t=fe(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 C(),!1;let t=i.current;if(!t)return e;let n=t.getBoundingClientRect();return S({top:Math.round(n.bottom-40+6),left:Math.round(n.left),config:c.current,pages:l.current}),!0})},[i])}}function rt(e){let{projectPath:t,initialDevice:n=me[1],initialRightPane:r=Ue}=e,i=(0,D.useRef)(null),a=(0,D.useRef)(null),o=Ke({initialDevice:n,simulatorRef:i}),s=Xe({projectPath:t,simulatorRef:i});(0,D.useEffect)(()=>{s.compileStatus.status===`ready`&&o.setSimPanelWidth(o.device.width+48)},[o.device.width,s.compileStatus.status,o.setSimPanelWidth]);let c=Ze({compileStatus:s.compileStatus,sendDeviceInfo:o.sendDeviceInfo,simulatorRef:i,simPanelWidthRef:o.simPanelWidthRef,deviceRef:o.deviceRef,appInfo:s.appInfo,compileConfig:s.compileConfig,port:s.port,projectPath:t}),l=$e({compileStatus:s.compileStatus,simulatorRef:i});et({compileStatus:s.compileStatus,simulatorRef:i});let u=tt({initialRightPane:r,simPanelWidthRef:o.simPanelWidthRef}),d=nt({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,preloadPath:s.preloadPath,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:{connected:l.connected,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}}}typeof window<`u`&&window.document&&window.document.createElement;function A(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r.defaultPrevented)return t?.(r)}}function it(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 at(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,ot(i,...t)]}function ot(...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}function st(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function ct(...e){return t=>{let n=!1,r=e.map(e=>{let r=st(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():st(e[t],null)}}}}function j(...e){return D.useCallback(ct(...e),e)}function lt(e){let t=ut(e),n=D.forwardRef((e,n)=>{let{children:r,...i}=e,a=D.Children.toArray(r),o=a.find(ft);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 ut(e){let t=D.forwardRef((e,t)=>{let{children:n,...r}=e;if(D.isValidElement(n)){let e=mt(n),i=pt(r,n.props);return n.type!==D.Fragment&&(i.ref=t?ct(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 dt=Symbol(`radix.slottable`);function ft(e){return D.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===dt}function pt(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 mt(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)}function ht(e){let t=e+`CollectionProvider`,[n,r]=at(t),[i,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=e=>{let{scope:t,children:n}=e,r=D.useRef(null),a=D.useRef(new Map).current;return(0,O.jsx)(i,{scope:t,itemMap:a,collectionRef:r,children:n})};o.displayName=t;let s=e+`CollectionSlot`,c=lt(s),l=D.forwardRef((e,t)=>{let{scope:n,children:r}=e;return(0,O.jsx)(c,{ref:j(t,a(s,n).collectionRef),children:r})});l.displayName=s;let u=e+`CollectionItemSlot`,d=`data-radix-collection-item`,f=lt(u),p=D.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=D.useRef(null),s=j(t,o),c=a(u,n);return D.useEffect(()=>(c.itemMap.set(o,{ref:o,...i}),()=>void c.itemMap.delete(o))),(0,O.jsx)(f,{[d]:``,ref:s,children:r})});p.displayName=u;function m(t){let n=a(e+`CollectionConsumer`,t);return D.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${d}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return[{Provider:o,Slot:l,ItemSlot:p},m,r]}var M=globalThis?.document?D.useLayoutEffect:()=>{},gt=D.useId||(()=>void 0),_t=0;function vt(e){let[t,n]=D.useState(gt());return M(()=>{e||n(e=>e??String(_t++))},[e]),e||(t?`radix-${t}`:``)}var yt=t(r(),1),N=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=lt(`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 bt(e,t){e&&yt.flushSync(()=>e.dispatchEvent(t))}function P(e){let t=D.useRef(e);return D.useEffect(()=>{t.current=e}),D.useMemo(()=>(...e)=>t.current?.(...e),[])}var xt=D.useInsertionEffect||M;function St({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){let[i,a,o]=Ct({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=wt(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}function Ct({defaultProp:e,onChange:t}){let[n,r]=D.useState(e),i=D.useRef(n),a=D.useRef(t);return xt(()=>{a.current=t},[t]),D.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}function wt(e){return typeof e==`function`}var Tt=D.createContext(void 0);function Et(e){let t=D.useContext(Tt);return e||t||`ltr`}var Dt=`rovingFocusGroup.onEntryFocus`,Ot={bubbles:!1,cancelable:!0},F=`RovingFocusGroup`,[kt,At,jt]=ht(F),[Mt,Nt]=at(F,[jt]),[Pt,Ft]=Mt(F),It=D.forwardRef((e,t)=>(0,O.jsx)(kt.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,O.jsx)(kt.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,O.jsx)(Lt,{...e,ref:t})})}));It.displayName=F;var Lt=D.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:u=!1,...d}=e,f=D.useRef(null),p=j(t,f),m=Et(a),[h,g]=St({prop:o,defaultProp:s??null,onChange:c,caller:F}),[_,v]=D.useState(!1),y=P(l),b=At(n),x=D.useRef(!1),[S,C]=D.useState(0);return D.useEffect(()=>{let e=f.current;if(e)return e.addEventListener(Dt,y),()=>e.removeEventListener(Dt,y)},[y]),(0,O.jsx)(Pt,{scope:n,orientation:r,dir:m,loop:i,currentTabStopId:h,onItemFocus:D.useCallback(e=>g(e),[g]),onItemShiftTab:D.useCallback(()=>v(!0),[]),onFocusableItemAdd:D.useCallback(()=>C(e=>e+1),[]),onFocusableItemRemove:D.useCallback(()=>C(e=>e-1),[]),children:(0,O.jsx)(N.div,{tabIndex:_||S===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:`none`,...e.style},onMouseDown:A(e.onMouseDown,()=>{x.current=!0}),onFocus:A(e.onFocus,e=>{let t=!x.current;if(e.target===e.currentTarget&&t&&!_){let t=new CustomEvent(Dt,Ot);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=b().filter(e=>e.focusable);Ut([e.find(e=>e.active),e.find(e=>e.id===h),...e].filter(Boolean).map(e=>e.ref.current),u)}}x.current=!1}),onBlur:A(e.onBlur,()=>v(!1))})})}),Rt=`RovingFocusGroupItem`,zt=D.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=vt(),l=a||c,u=Ft(Rt,n),d=u.currentTabStopId===l,f=At(n),{onFocusableItemAdd:p,onFocusableItemRemove:m,currentTabStopId:h}=u;return D.useEffect(()=>{if(r)return p(),()=>m()},[r,p,m]),(0,O.jsx)(kt.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,O.jsx)(N.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:A(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:A(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:A(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=Ht(e,u.orientation,u.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=f().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=u.loop?Wt(n,r+1):n.slice(r+1)}setTimeout(()=>Ut(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:h!=null}):o})})});zt.displayName=Rt;var Bt={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function Vt(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}function Ht(e,t,n){let r=Vt(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return Bt[r]}function Ut(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function Wt(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Gt=It,Kt=zt;function qt(e,t){return D.useReducer((e,n)=>t[e][n]??e,e)}var Jt=e=>{let{present:t,children:n}=e,r=Yt(t),i=typeof n==`function`?n({present:r.isPresent}):D.Children.only(n),a=j(r.ref,Zt(i));return typeof n==`function`||r.isPresent?D.cloneElement(i,{ref:a}):null};Jt.displayName=`Presence`;function Yt(e){let[t,n]=D.useState(),r=D.useRef(null),i=D.useRef(e),a=D.useRef(`none`),[o,s]=qt(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return D.useEffect(()=>{let e=Xt(r.current);a.current=o===`mounted`?e:`none`},[o]),M(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,o=Xt(t);e?s(`MOUNT`):o===`none`||t?.display===`none`?s(`UNMOUNT`):s(n&&r!==o?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,s]),M(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=a=>{let o=Xt(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=Xt(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 Xt(e){return e?.animationName||`none`}function Zt(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 Qt=`Tabs`,[$t,en]=at(Qt,[Nt]),tn=Nt(),[nn,rn]=$t(Qt),an=D.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,onValueChange:i,defaultValue:a,orientation:o=`horizontal`,dir:s,activationMode:c=`automatic`,...l}=e,u=Et(s),[d,f]=St({prop:r,onChange:i,defaultProp:a??``,caller:Qt});return(0,O.jsx)(nn,{scope:n,baseId:vt(),value:d,onValueChange:f,orientation:o,dir:u,activationMode:c,children:(0,O.jsx)(N.div,{dir:u,"data-orientation":o,...l,ref:t})})});an.displayName=Qt;var on=`TabsList`,sn=D.forwardRef((e,t)=>{let{__scopeTabs:n,loop:r=!0,...i}=e,a=rn(on,n),o=tn(n);return(0,O.jsx)(Gt,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:(0,O.jsx)(N.div,{role:`tablist`,"aria-orientation":a.orientation,...i,ref:t})})});sn.displayName=on;var cn=`TabsTrigger`,ln=D.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,disabled:i=!1,...a}=e,o=rn(cn,n),s=tn(n),c=fn(o.baseId,r),l=pn(o.baseId,r),u=r===o.value;return(0,O.jsx)(Kt,{asChild:!0,...s,focusable:!i,active:u,children:(0,O.jsx)(N.button,{type:`button`,role:`tab`,"aria-selected":u,"aria-controls":l,"data-state":u?`active`:`inactive`,"data-disabled":i?``:void 0,disabled:i,id:c,...a,ref:t,onMouseDown:A(e.onMouseDown,e=>{!i&&e.button===0&&e.ctrlKey===!1?o.onValueChange(r):e.preventDefault()}),onKeyDown:A(e.onKeyDown,e=>{[` `,`Enter`].includes(e.key)&&o.onValueChange(r)}),onFocus:A(e.onFocus,()=>{let e=o.activationMode!==`manual`;!u&&!i&&e&&o.onValueChange(r)})})})});ln.displayName=cn;var un=`TabsContent`,dn=D.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,forceMount:i,children:a,...o}=e,s=rn(un,n),c=fn(s.baseId,r),l=pn(s.baseId,r),u=r===s.value,d=D.useRef(u);return D.useEffect(()=>{let e=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,O.jsx)(Jt,{present:i||u,children:({present:n})=>(0,O.jsx)(N.div,{"data-state":u?`active`:`inactive`,"data-orientation":s.orientation,role:`tabpanel`,"aria-labelledby":c,hidden:!n,id:l,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:d.current?`0s`:void 0},children:n&&a})})});dn.displayName=un;function fn(e,t){return`${e}-trigger-${t}`}function pn(e,t){return`${e}-content-${t}`}var mn=an,hn=sn,gn=ln,_n=dn,vn=mn,yn=D.forwardRef(({className:e,...t},n)=>(0,O.jsx)(hn,{ref:n,className:y(`inline-flex h-7 items-center justify-center rounded-md bg-surface-2 p-1 text-text-muted`,e),...t}));yn.displayName=hn.displayName;var bn=D.forwardRef(({className:e,...t},n)=>(0,O.jsx)(gn,{ref:n,className:y(`inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-bg transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-surface-selected data-[state=active]:text-text data-[state=active]:shadow-sm`,e),...t}));bn.displayName=gn.displayName;var xn=D.forwardRef(({className:e,...t},n)=>(0,O.jsx)(_n,{ref:n,className:y(`mt-2 ring-offset-bg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2`,e),...t}));xn.displayName=_n.displayName;var Sn={compiling:`bg-status-warn animate-[pulse_1s_infinite]`,ready:`bg-accent`,error:`bg-status-error`};function Cn({status:e}){return(0,O.jsx)(`span`,{className:y(`w-1.5 h-1.5 rounded-full shrink-0`,Sn[e]??`bg-border`)})}function wn({compileDropdownRef:e,showCompilePanel:t,onToggleCompilePanel:n,onRelaunch:r,compileStatus:i,rightPane:a,onToggleRightPaneVisible:o,onSelectRightPane:s}){let[c,l]=(0,D.useState)([]),[u,d]=(0,D.useState)([]),f=()=>{ie().then(e=>{l(Array.isArray(e)?e:[])}).catch(e=>{console.debug(`[toolbar] getActions not available`,e)})};return(0,D.useEffect)(()=>(f(),ue().then(e=>{e?.length&&d(e)}).catch(e=>{console.warn(`[toolbar] panel:list failed`,e)}),ee(()=>f())),[]),(0,O.jsxs)(`div`,{className:`flex flex-col shrink-0`,children:[c.length>0&&(0,O.jsx)(`div`,{className:`flex items-center gap-1.5 px-2.5 py-1 bg-surface-2 border-b border-border`,children:c.map(e=>(0,O.jsx)(E,{variant:`outline`,size:`sm`,onClick:()=>se(e.id),disabled:i.status===`compiling`,children:e.label},e.id))}),(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)(E,{variant:`outline`,size:`sm`,onClick:n,className:y(t&&`border-accent`),children:[`普通编译 `,(0,O.jsx)(`span`,{className:`text-[10px] text-text-secondary`,children:`▾`})]})}),(0,O.jsx)(E,{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)(Cn,{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`}),u.length>0&&(0,O.jsx)(vn,{value:a.selected,onValueChange:e=>s(e),children:(0,O.jsxs)(yn,{className:`h-auto gap-px bg-bg border border-border p-0`,children:[(0,O.jsx)(bn,{value:`simulator`,className:`px-2 py-0.5 text-[11px] rounded-none data-[state=active]:shadow-none`,children:`DevTools`}),u.map(e=>(0,O.jsx)(bn,{value:e.id,className:`px-2 py-0.5 text-[11px] rounded-none data-[state=active]:shadow-none`,children:e.label},e.id))]})}),(0,O.jsx)(E,{variant:`icon`,size:`icon`,onClick:o,title:a.simulatorVisible?`隐藏面板`:`显示面板`,className:`text-base`,children:a.simulatorVisible?`⊟`:`⊞`})]})]})}function Tn({simPanelWidth:e,device:t,zoom:n,onDeviceChange:r,onZoomChange:i,compileStatus:a,preloadPath:o,simulatorUrl:s,simulatorRef:c,currentPage:l,copied:u,onCopyPagePath:d}){let f=n/100;return(0,O.jsxs)(`div`,{className:`bg-sim-bg flex flex-col overflow-hidden shrink-0`,style:{width:e,minWidth:e},children:[(0,O.jsxs)(`div`,{className:`flex-1 overflow-auto flex items-start justify-center p-5`,children:[a.status===`compiling`&&!o&&(0,O.jsx)(`div`,{className:`flex items-center justify-center min-h-48 w-full text-text-dim text-[13px]`,children:`正在编译中...`}),a.status===`error`&&!s&&(0,O.jsxs)(`div`,{className:`flex flex-col items-center justify-center min-h-48 w-full text-status-error text-[13px] gap-2 p-4`,children:[(0,O.jsx)(`span`,{children:`编译失败`}),(0,O.jsx)(`small`,{className:`text-status-error text-[11px]`,children:a.message})]}),(a.status===`ready`||s)&&(0,O.jsxs)(`div`,{className:`flex flex-col items-center gap-6`,children:[(0,O.jsx)(`div`,{className:`shrink-0 overflow-visible`,style:{borderRadius:44,boxShadow:`0 0 0 8px var(--color-phone-shell), 0 0 0 10px var(--color-phone-border), 0 24px 60px var(--color-overlay-heavy)`,background:`var(--color-phone-shell)`,width:Math.round(t.width*f),height:Math.round(t.height*f)},children:(0,O.jsx)(`div`,{className:`bg-black relative overflow-hidden shrink-0`,style:{borderRadius:36,width:t.width,height:t.height,transform:`scale(${f})`,transformOrigin:`top left`},children:o&&s&&(0,O.jsx)(`webview`,{ref:c,src:s,partition:`persist:simulator`,allowpopups:``,style:{display:`flex`,flexDirection:`column`,width:t.width,height:t.height}})})}),a.status===`compiling`&&s&&(0,O.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center bg-black/50 rounded-[36px] z-10`,children:(0,O.jsx)(`div`,{className:`text-text-dim text-[13px]`,children:`正在编译中...`})}),a.status===`error`&&s&&(0,O.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center bg-black/70 rounded-[36px] 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:a.message})]})}),(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(de,{value:t.name,onChange:r,children:me.map(e=>(0,O.jsx)(`option`,{value:e.name,children:e.name},e.name))}),(0,O.jsx)(de,{value:n,onChange:i,className:`max-w-16`,children:w.map(e=>(0,O.jsxs)(`option`,{value:e,children:[e,`%`]},e))})]})]})]}),(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:l||`—`}),l&&(0,O.jsx)(`button`,{className:y(`shrink-0 flex items-center justify-center w-4 h-4 rounded transition-colors`,u?`text-accent`:`text-text-dim hover:text-text`),onClick:d,title:`复制路径`,children:u?(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 En(e){return!!(e.tagName===`#shadow-root`||e.tagName.includes(`/`))}function Dn({node:e,depth:t,inspectedSid:n,onInspect:r}){let[i,a]=(0,D.useState)(()=>En(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)(Dn,{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)(Dn,{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)(Dn,{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 On({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 kn({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)(E,{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)(Dn,{node:e,depth:0,inspectedSid:i?.sid??null,onInspect:c})}),(0,O.jsx)(On,{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)(E,{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 I(){return I=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},I.apply(null,arguments)}function L(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 An={},jn=(0,D.createContext)(An),Mn=(e,t)=>I({},e,t),Nn=()=>(0,D.useContext)(jn),Pn=(0,D.createContext)(()=>{});Pn.displayName=`JVR.DispatchShowTools`;function Fn(){return(0,D.useReducer)(Mn,An)}function In(){return(0,D.useContext)(Pn)}var Ln=e=>{var{initial:t,dispatch:n,children:r}=e;return(0,O.jsx)(jn.Provider,{value:t,children:(0,O.jsx)(Pn.Provider,{value:n,children:r})})};Ln.displayName=`JVR.ShowTools`;var Rn={},zn=(0,D.createContext)(Rn),Bn=(e,t)=>I({},e,t),Vn=()=>(0,D.useContext)(zn),Hn=(0,D.createContext)(()=>{});Hn.displayName=`JVR.DispatchExpands`;function Un(){return(0,D.useReducer)(Bn,Rn)}function Wn(){return(0,D.useContext)(Hn)}var Gn=e=>{var{initial:t,dispatch:n,children:r}=e;return(0,O.jsx)(zn.Provider,{value:t,children:(0,O.jsx)(Hn.Provider,{value:n,children:r})})};Gn.displayName=`JVR.Expands`;var Kn={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`}},qn=(0,D.createContext)(Kn),Jn=(e,t)=>I({},e,t),R=()=>(0,D.useContext)(qn),Yn=(0,D.createContext)(()=>{});Yn.displayName=`JVR.DispatchTypes`;function Xn(){return(0,D.useReducer)(Jn,Kn)}function Zn(){return(0,D.useContext)(Yn)}function Qn(e){var{initial:t,dispatch:n,children:r}=e;return(0,O.jsx)(qn.Provider,{value:t,children:(0,O.jsx)(Yn.Provider,{value:n,children:r})})}Qn.displayName=`JVR.Types`;var $n=[`style`];function er(e){var{style:t}=e,n=L(e,$n);return(0,O.jsx)(`svg`,I({viewBox:`0 0 24 24`,fill:`var(--w-rjv-arrow-color, currentColor)`,style:I({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`})}))}er.displayName=`JVR.TriangleArrow`;var tr={Arrow:{as:`span`,className:`w-rjv-arrow`,style:{transform:`rotate(0deg)`,transition:`all 0.3s`},children:(0,O.jsx)(er,{})},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:`}`}},nr=(0,D.createContext)(tr),rr=(e,t)=>I({},e,t),z=()=>(0,D.useContext)(nr),ir=(0,D.createContext)(()=>{});ir.displayName=`JVR.DispatchSymbols`;function ar(){return(0,D.useReducer)(rr,tr)}function or(){return(0,D.useContext)(ir)}var sr=e=>{var{initial:t,dispatch:n,children:r}=e;return(0,O.jsx)(nr.Provider,{value:t,children:(0,O.jsx)(ir.Provider,{value:n,children:r})})};sr.displayName=`JVR.Symbols`;var cr={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`}},lr=(0,D.createContext)(cr),ur=(e,t)=>I({},e,t),B=()=>(0,D.useContext)(lr),dr=(0,D.createContext)(()=>{});dr.displayName=`JVR.DispatchSection`;function fr(){return(0,D.useReducer)(ur,cr)}function pr(){return(0,D.useContext)(dr)}var mr=e=>{var{initial:t,dispatch:n,children:r}=e;return(0,O.jsx)(lr.Provider,{value:t,children:(0,O.jsx)(dr.Provider,{value:n,children:r})})};mr.displayName=`JVR.Section`;var hr={objectSortKeys:!1,indentWidth:15},gr=(0,D.createContext)(hr);gr.displayName=`JVR.Context`;var _r=(0,D.createContext)(()=>{});_r.displayName=`JVR.DispatchContext`;function vr(e,t){return I({},e,t)}var V=()=>(0,D.useContext)(gr),yr=e=>{var{children:t,initialState:n,initialTypes:r}=e,[i,a]=(0,D.useReducer)(vr,Object.assign({},hr,n)),[o,s]=Fn(),[c,l]=Un(),[u,d]=Xn(),[f,p]=ar(),[m,h]=fr();return(0,D.useEffect)(()=>a(I({},n)),[n]),(0,O.jsx)(gr.Provider,{value:i,children:(0,O.jsx)(_r.Provider,{value:a,children:(0,O.jsx)(Ln,{initial:o,dispatch:s,children:(0,O.jsx)(Gn,{initial:c,dispatch:l,children:(0,O.jsx)(Qn,{initial:I({},u,r),dispatch:d,children:(0,O.jsx)(sr,{initial:f,dispatch:p,children:(0,O.jsx)(mr,{initial:m,dispatch:h,children:t})})})})})})})};yr.displayName=`JVR.Provider`;function br(e){if(e==null)throw TypeError(`Cannot destructure `+e)}var xr=[`isNumber`,`value`,`parentValue`,`keyName`,`keys`],Sr=[`as`,`render`],Cr=[`as`,`render`],wr=[`as`,`render`],Tr=[`as`,`style`,`render`],Er=[`as`,`render`],Dr=[`as`,`render`],Or=[`as`,`render`],kr=[`as`,`render`],Ar=e=>{var{Quote:t={}}=z(),{isNumber:n,value:r,parentValue:i,keyName:a,keys:o}=e,s=L(e,xr);if(n)return null;var{as:c,render:l}=t,u=L(t,Sr),d=c||`span`,f=I({},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,I({},f))};Ar.displayName=`JVR.Quote`;var jr=e=>{var{ValueQuote:t={}}=z(),n=I({},(br(e),e)),{as:r,render:i}=t,a=L(t,Cr),o=r||`span`,s=I({},n,a);return i&&typeof i==`function`&&i(s,{})||(0,O.jsx)(o,I({},s))};jr.displayName=`JVR.ValueQuote`;var Mr=e=>{var{value:t,parentValue:n,keyName:r,keys:i}=e,{Colon:a={}}=z(),{as:o,render:s}=a,c=L(a,wr),l=o||`span`;return s&&typeof s==`function`&&s(c,{value:t,parentValue:n,keyName:r,keys:i||(r?[r]:[])})||(0,O.jsx)(l,I({},c))};Mr.displayName=`JVR.Colon`;var Nr=e=>{var{Arrow:t={}}=z(),n=Vn(),{expandKey:r,style:i,value:a,parentValue:o,keyName:s,keys:c}=e,l=!!n[r],{as:u,style:d,render:f}=t,p=L(t,Tr),m=u||`span`,h=f&&typeof f==`function`,g=I({},p,{"data-expanded":l,style:I({},d,i)});return h&&f(g,{value:a,parentValue:o,keyName:s,keys:c||(s?[s]:[])})||(0,O.jsx)(m,I({},p,{style:I({},d,i)}))};Nr.displayName=`JVR.Arrow`;var Pr=e=>{var{isBrackets:t,value:n,parentValue:r,keyName:i,keys:a}=e,{BracketsLeft:o={},BraceLeft:s={}}=z(),c={value:n,parentValue:r,keyName:i,keys:a||(i?[i]:[])};if(t){var{as:l,render:u}=o,d=L(o,Er),f=l||`span`;return u&&typeof u==`function`&&u(d,c)||(0,O.jsx)(f,I({},d))}var{as:p,render:m}=s,h=L(s,Dr),g=p||`span`;return m&&typeof m==`function`&&m(h,c)||(0,O.jsx)(g,I({},h))};Pr.displayName=`JVR.BracketsOpen`;var Fr=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={}}=z();if(t){var{as:u,render:d}=c,f=L(c,Or),p=u||`span`;return d&&typeof d==`function`&&d(f,s)||(0,O.jsx)(p,I({},f))}var{as:m,render:h}=l,g=L(l,kr),_=m||`span`;return h&&typeof h==`function`&&h(g,s)||(0,O.jsx)(_,I({},g))};Fr.displayName=`JVR.BracketsClose`;var Ir=e=>{var{keyName:t,value:n,expandKey:r,parentValue:i,level:a,keys:o=[]}=e,s=Vn(),{collapsed:c,shouldExpandNodeInitially:l}=V(),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)(Fr,I({isBrackets:g||_},h,{isVisiable:!0}))})};Ir.displayName=`JVR.NestedClose`;var Lr=[`as`,`render`],Rr=[`as`,`render`],zr=[`as`,`render`],Br=[`as`,`render`],Vr=[`as`,`render`],Hr=[`as`,`render`],Ur=[`as`,`render`],Wr=[`as`,`render`],Gr=[`as`,`render`],Kr=[`as`,`render`],qr=[`as`,`render`],Jr=[`as`,`render`],Yr=[`as`,`render`],Xr=e=>{if(e===void 0)return`0n`;if(typeof e==`string`)try{e=BigInt(e)}catch{return`0n`}return e?e.toString()+`n`:`0n`},Zr=e=>{var{value:t,keyName:n}=e,{Set:r={},displayDataTypes:i}=R();if(!(t instanceof Set)||!i)return null;var{as:a,render:o}=r,s=L(r,Lr);return o&&typeof o==`function`&&o(s,{type:`type`,value:t,keyName:n})||(0,O.jsx)(a||`span`,I({},s))};Zr.displayName=`JVR.SetComp`;var Qr=e=>{var{value:t,keyName:n}=e,{Map:r={},displayDataTypes:i}=R();if(!(t instanceof Map)||!i)return null;var{as:a,render:o}=r,s=L(r,Rr);return o&&typeof o==`function`&&o(s,{type:`type`,value:t,keyName:n})||(0,O.jsx)(a||`span`,I({},s))};Qr.displayName=`JVR.MapComp`;var H={opacity:.75,paddingRight:4},$r=e=>{var{children:t=``,keyName:n,keys:r}=e,{Str:i={},displayDataTypes:a}=R(),{shortenTextAfterLength:o=30,stringEllipsis:s=`...`}=V(),{as:c,render:l}=i,u=L(i,zr),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=I({},H,i.style||{});o>0&&(u.style=I({},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(I({},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(I({},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,I({},u,{style:h}))),b||(0,O.jsxs)(D.Fragment,{children:[(0,O.jsx)(jr,{}),(0,O.jsx)(m,I({},u,{className:y,children:g})),(0,O.jsx)(jr,{})]})]})};$r.displayName=`JVR.TypeString`;var ei=e=>{var{children:t,keyName:n,keys:r}=e,{True:i={},displayDataTypes:a}=R(),{as:o,render:s}=i,c=L(i,Br),l=o||`span`,u=I({},H,i.style||{}),d=s&&typeof s==`function`,f=d&&s(I({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),p=d&&s(I({},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,I({},c,{style:u}))),p||(0,O.jsx)(l,I({},c,{className:`w-rjv-value`,children:t?.toString()}))]})};ei.displayName=`JVR.TypeTrue`;var ti=e=>{var{children:t,keyName:n,keys:r}=e,{False:i={},displayDataTypes:a}=R(),{as:o,render:s}=i,c=L(i,Vr),l=o||`span`,u=I({},H,i.style||{}),d=s&&typeof s==`function`,f=d&&s(I({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),p=d&&s(I({},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,I({},c,{style:u}))),p||(0,O.jsx)(l,I({},c,{className:`w-rjv-value`,children:t?.toString()}))]})};ti.displayName=`JVR.TypeFalse`;var ni=e=>{var{children:t,keyName:n,keys:r}=e,{Float:i={},displayDataTypes:a}=R(),{as:o,render:s}=i,c=L(i,Hr),l=o||`span`,u=I({},H,i.style||{}),d=s&&typeof s==`function`,f=d&&s(I({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),p=d&&s(I({},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,I({},c,{style:u}))),p||(0,O.jsx)(l,I({},c,{className:`w-rjv-value`,children:t?.toString()}))]})};ni.displayName=`JVR.TypeFloat`;var ri=e=>{var{children:t,keyName:n,keys:r}=e,{Int:i={},displayDataTypes:a}=R(),{as:o,render:s}=i,c=L(i,Ur),l=o||`span`,u=I({},H,i.style||{}),d=s&&typeof s==`function`,f=d&&s(I({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),p=d&&s(I({},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,I({},c,{style:u}))),p||(0,O.jsx)(l,I({},c,{className:`w-rjv-value`,children:t?.toString()}))]})};ri.displayName=`JVR.TypeInt`;var ii=e=>{var{children:t,keyName:n,keys:r}=e,{Bigint:i={},displayDataTypes:a}=R(),{as:o,render:s}=i,c=L(i,Wr),l=o||`span`,u=I({},H,i.style||{}),d=s&&typeof s==`function`,f=d&&s(I({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),p=d&&s(I({},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,I({},c,{style:u}))),p||(0,O.jsx)(l,I({},c,{className:`w-rjv-value`,children:Xr(t?.toString())}))]})};ii.displayName=`JVR.TypeFloat`;var ai=e=>{var{children:t,keyName:n,keys:r}=e,{Url:i={},displayDataTypes:a}=R(),{as:o,render:s}=i,c=L(i,Gr),l=o||`span`,u=I({},H,i.style),d=s&&typeof s==`function`,f=d&&s(I({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),p=d&&s(I({},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,I({},c,{style:u}))),p||(0,O.jsxs)(`a`,I({href:t?.href,target:`_blank`},c,{className:`w-rjv-value`,children:[(0,O.jsx)(jr,{}),t?.href,(0,O.jsx)(jr,{})]}))]})};ai.displayName=`JVR.TypeUrl`;var oi=e=>{var{children:t,keyName:n,keys:r}=e,{Date:i={},displayDataTypes:a}=R(),{as:o,render:s}=i,c=L(i,Kr),l=o||`span`,u=I({},H,i.style||{}),d=s&&typeof s==`function`,f=d&&s(I({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),p=t instanceof Date?t.toLocaleString():t,m=d&&s(I({},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,I({},c,{style:u}))),m||(0,O.jsx)(l,I({},c,{className:`w-rjv-value`,children:p}))]})};oi.displayName=`JVR.TypeDate`;var si=e=>{var{children:t,keyName:n,keys:r}=e,{Undefined:i={},displayDataTypes:a}=R(),{as:o,render:s}=i,c=L(i,qr),l=o||`span`,u=I({},H,i.style||{}),d=s&&typeof s==`function`,f=d&&s(I({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),p=d&&s(I({},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,I({},c,{style:u}))),p]})};si.displayName=`JVR.TypeUndefined`;var ci=e=>{var{children:t,keyName:n,keys:r}=e,{Null:i={},displayDataTypes:a}=R(),{as:o,render:s}=i,c=L(i,Jr),l=o||`span`,u=I({},H,i.style||{}),d=s&&typeof s==`function`,f=d&&s(I({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),p=d&&s(I({},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,I({},c,{style:u}))),p]})};ci.displayName=`JVR.TypeNull`;var li=e=>{var{children:t,keyName:n,keys:r}=e,{Nan:i={},displayDataTypes:a}=R(),{as:o,render:s}=i,c=L(i,Yr),l=o||`span`,u=I({},H,i.style||{}),d=s&&typeof s==`function`,f=d&&s(I({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),p=d&&s(I({},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,I({},c,{style:u}))),p]})};li.displayName=`JVR.TypeNan`;var ui=e=>Number(e)===e&&e%1!=0||isNaN(e),di=e=>{var{value:t,keyName:n,keys:r}=e,i={keyName:n,keys:r};return t instanceof URL?(0,O.jsx)(ai,I({},i,{children:t})):typeof t==`string`?(0,O.jsx)($r,I({},i,{children:t})):t===!0?(0,O.jsx)(ei,I({},i,{children:t})):t===!1?(0,O.jsx)(ti,I({},i,{children:t})):t===null?(0,O.jsx)(ci,I({},i,{children:t})):t===void 0?(0,O.jsx)(si,I({},i,{children:t})):t instanceof Date?(0,O.jsx)(oi,I({},i,{children:t})):typeof t==`number`&&isNaN(t)?(0,O.jsx)(li,I({},i,{children:t})):typeof t==`number`&&ui(t)?(0,O.jsx)(ni,I({},i,{children:t})):typeof t==`bigint`?(0,O.jsx)(ii,I({},i,{children:t})):typeof t==`number`?(0,O.jsx)(ri,I({},i,{children:t})):null};di.displayName=`JVR.Value`;function U(e,t,n){var r=or(),i=I({},e,t,{className:[e.className,t.className].filter(Boolean).join(` `),style:I({},e.style,t.style),children:t.children||e.children});(0,D.useEffect)(()=>r({[n]:i}),[t])}function W(e,t,n){var r=Zn(),i=I({},e,t,{className:[e.className,t.className].filter(Boolean).join(` `),style:I({},e.style,t.style),children:t.children||e.children});(0,D.useEffect)(()=>r({[n]:i}),[t])}function G(e,t,n){var r=pr(),i=I({},e,t,{className:[e.className,t.className].filter(Boolean).join(` `),style:I({},e.style,t.style),children:t.children||e.children});(0,D.useEffect)(()=>r({[n]:i}),[t])}var fi=[`as`,`render`],pi=e=>{var{KeyName:t={}}=B();return G(t,e,`KeyName`),null};pi.displayName=`JVR.KeyName`;var mi=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={}}=B(),{as:c,render:l}=s,u=L(s,fi);u.style=I({},u.style,o);var d=c||`span`;return l&&typeof l==`function`&&l(I({},u,{children:t}),{value:n,parentValue:r,keyName:i,keys:a||(i?[i]:[])})||(0,O.jsx)(d,I({},u,{children:t}))};mi.displayName=`JVR.KeyNameComp`;var hi=[`children`,`value`,`parentValue`,`keyName`,`keys`],gi=[`as`,`render`,`children`],_i=e=>{var{Row:t={}}=B();return G(t,e,`Row`),null};_i.displayName=`JVR.Row`;var vi=e=>{var{children:t,value:n,parentValue:r,keyName:i,keys:a}=e,o=L(e,hi),{Row:s={}}=B(),{as:c,render:l}=s,u=L(s,gi),d=c||`div`;return l&&typeof l==`function`&&l(I({},o,u,{children:t}),{value:n,keyName:i,parentValue:r,keys:a})||(0,O.jsx)(d,I({},o,u,{children:t}))};vi.displayName=`JVR.RowComp`;function yi(e){var t=(0,D.useRef)();return(0,D.useEffect)(()=>{t.current=e}),t.current}function bi(e){var{value:t,highlightUpdates:n,highlightContainer:r}=e,i=yi(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 xi=[`keyName`,`value`,`parentValue`,`expandKey`,`keys`,`beforeCopy`],Si=[`as`,`render`],Ci=e=>{var{keyName:t,value:n,parentValue:r,expandKey:i,keys:a,beforeCopy:o}=e,s=L(e,xi),{onCopied:c,enableClipboard:l,beforeCopy:u}=V(),d=Nn()[i],[f,p]=(0,D.useState)(!1),{Copied:m={}}=B(),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`?Xr(n):n instanceof Date?n.toLocaleString():JSON.stringify(n,(e,t)=>typeof t==`bigint`?Xr(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=L(m,Si),y=I({},v,s,g,{style:I({},v.style,s.style,g.style)});return _&&typeof _==`function`&&_(I({},y,{"data-copied":f}),{value:n,keyName:t,keys:a,parentValue:r})||(f?(0,O.jsx)(`svg`,I({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`,I({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`})})))};Ci.displayName=`JVR.Copied`;function wi(){var e=(0,D.useRef)(null);return e.current===null&&(e.current=`custom-id-`+Math.random().toString(36).substr(2,9)),e.current}var Ti=e=>{var{keyName:t,value:n,expandKey:r=``,level:i,keys:a=[],parentValue:o}=e,s=Vn(),{objectSortKeys:c,indentWidth:l,collapsed:u,shouldExpandNodeInitially:d}=V(),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)(Di,{parentValue:n,keyName:r,keys:[...a,r],value:o,level:i},t)})})};Ti.displayName=`JVR.KeyValues`;var Ei=e=>{var{keyName:t,parentValue:n,keys:r,value:i}=e,{highlightUpdates:a}=V(),o=typeof t==`number`,s=(0,D.useRef)(null);bi({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)(Ar,I({isNumber:o,"data-placement":`left`},c)),(0,O.jsx)(mi,I({},c,{children:t})),(0,O.jsx)(Ar,I({isNumber:o,"data-placement":`right`},c))]}),(0,O.jsx)(Mr,I({},c))]})};Ei.displayName=`JVR.KayName`;var Di=e=>{var{keyName:t,value:n,parentValue:r,level:i=0,keys:a=[]}=e,o=In(),s=wi(),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)(Vi,{keyName:t,value:l?Array.from(n):u?Object.fromEntries(n):n,parentValue:r,initialValue:n,keys:a,level:i+1}):(0,O.jsxs)(vi,I({className:`w-rjv-line`,value:n,keyName:t,keys:a,parentValue:r},{onMouseEnter:()=>o({[s]:!0}),onMouseLeave:()=>o({[s]:!1})},{children:[(0,O.jsx)(Ei,{keyName:t,value:n,keys:a,parentValue:r}),(0,O.jsx)(di,{keyName:t,value:n,keys:a}),(0,O.jsx)(Ci,{keyName:t,value:n,keys:a,parentValue:r,expandKey:s})]}))};Di.displayName=`JVR.KeyValuesItem`;var Oi=[`value`,`keyName`],ki=[`as`,`render`],Ai=e=>{var{CountInfoExtra:t={}}=B();return G(t,e,`CountInfoExtra`),null};Ai.displayName=`JVR.CountInfoExtra`;var ji=e=>{var{value:t={},keyName:n}=e,r=L(e,Oi),{CountInfoExtra:i={}}=B(),{as:a,render:o}=i,s=L(i,ki);if(!o&&!s.children)return null;var c=a||`span`,l=o&&typeof o==`function`,u=I({},s,r);return l&&o(u,{value:t,keyName:n})||(0,O.jsx)(c,I({},u))};ji.displayName=`JVR.CountInfoExtraComps`;var Mi=[`value`,`keyName`],Ni=[`as`,`render`],Pi=e=>{var{CountInfo:t={}}=B();return G(t,e,`CountInfo`),null};Pi.displayName=`JVR.CountInfo`;var Fi=e=>{var{value:t={},keyName:n}=e,r=L(e,Mi),{displayObjectSize:i}=V(),{CountInfo:a={}}=B();if(!i)return null;var{as:o,render:s}=a,c=L(a,Ni),l=o||`span`;c.style=I({},c.style,e.style);var u=Object.keys(t).length;c.children||=u+` item`+(u===1?``:`s`);var d=I({},c,r);return s&&typeof s==`function`&&s(I({},d,{"data-length":u}),{value:t,keyName:n})||(0,O.jsx)(l,I({},d))};Fi.displayName=`JVR.CountInfoComp`;var Ii=[`as`,`render`],Li=e=>{var{Ellipsis:t={}}=B();return G(t,e,`Ellipsis`),null};Li.displayName=`JVR.Ellipsis`;var Ri=e=>{var{isExpanded:t,value:n,keyName:r}=e,{Ellipsis:i={}}=B(),{as:a,render:o}=i,s=L(i,Ii),c=a||`span`;return o&&typeof o==`function`&&o(I({},s,{"data-expanded":t}),{value:n,keyName:r})||(!t||typeof n==`object`&&Object.keys(n).length==0?null:(0,O.jsx)(c,I({},s)))};Ri.displayName=`JVR.EllipsisComp`;var zi=e=>{var{keyName:t,expandKey:n,keys:r=[],initialValue:i,value:a,parentValue:o,level:s}=e,c=Vn(),l=Wn(),{onExpand:u,collapsed:d,shouldExpandNodeInitially:f}=V(),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`,I({},w,{children:[C&&(0,O.jsx)(Nr,I({style:v,expandKey:n},T)),(t||typeof t==`number`)&&(0,O.jsx)(Ei,I({},T)),(0,O.jsx)(Zr,{value:i,keyName:t}),(0,O.jsx)(Qr,{value:i,keyName:t}),(0,O.jsx)(Pr,I({isBrackets:x||S},T)),(0,O.jsx)(Ri,{keyName:t,value:a,isExpanded:m}),(0,O.jsx)(Fr,I({isVisiable:m||!C,isBrackets:x||S},T)),(0,O.jsx)(Fi,{value:a,keyName:t}),(0,O.jsx)(ji,{value:a,keyName:t}),(0,O.jsx)(Ci,{keyName:t,value:a,expandKey:n,parentValue:o,keys:r})]}))};zi.displayName=`JVR.NestedOpen`;var Bi=[`className`,`children`,`parentValue`,`keyid`,`level`,`value`,`initialValue`,`keys`,`keyName`],Vi=(0,D.forwardRef)((e,t)=>{var{className:n=``,parentValue:r,level:i=1,value:a,initialValue:o,keys:s,keyName:c}=e,l=L(e,Bi),u=In(),d=wi();return(0,O.jsxs)(`div`,I({className:[n,`w-rjv-inner`].filter(Boolean).join(` `),ref:t},l,{onMouseEnter:()=>u({[d]:!0}),onMouseLeave:()=>u({[d]:!1})},{children:[(0,O.jsx)(zi,{expandKey:d,value:a,level:i,keys:s,parentValue:r,keyName:c,initialValue:o}),(0,O.jsx)(Ti,{expandKey:d,value:a,level:i,keys:s,parentValue:r,keyName:c}),(0,O.jsx)(Ir,{expandKey:d,value:a,level:i,keys:s,parentValue:r,keyName:c})]}))});Vi.displayName=`JVR.Container`;var Hi=e=>{var{BraceLeft:t={}}=z();return U(t,e,`BraceLeft`),null};Hi.displayName=`JVR.BraceLeft`;var Ui=e=>{var{BraceRight:t={}}=z();return U(t,e,`BraceRight`),null};Ui.displayName=`JVR.BraceRight`;var Wi=e=>{var{BracketsLeft:t={}}=z();return U(t,e,`BracketsLeft`),null};Wi.displayName=`JVR.BracketsLeft`;var Gi=e=>{var{BracketsRight:t={}}=z();return U(t,e,`BracketsRight`),null};Gi.displayName=`JVR.BracketsRight`;var Ki=e=>{var{Arrow:t={}}=z();return U(t,e,`Arrow`),null};Ki.displayName=`JVR.Arrow`;var qi=e=>{var{Colon:t={}}=z();return U(t,e,`Colon`),null};qi.displayName=`JVR.Colon`;var Ji=e=>{var{Quote:t={}}=z();return U(t,e,`Quote`),null};Ji.displayName=`JVR.Quote`;var Yi=e=>{var{ValueQuote:t={}}=z();return U(t,e,`ValueQuote`),null};Yi.displayName=`JVR.ValueQuote`;var Xi=e=>{var{Bigint:t={}}=R();return W(t,e,`Bigint`),null};Xi.displayName=`JVR.Bigint`;var Zi=e=>{var{Date:t={}}=R();return W(t,e,`Date`),null};Zi.displayName=`JVR.Date`;var Qi=e=>{var{False:t={}}=R();return W(t,e,`False`),null};Qi.displayName=`JVR.False`;var $i=e=>{var{Float:t={}}=R();return W(t,e,`Float`),null};$i.displayName=`JVR.Float`;var ea=e=>{var{Int:t={}}=R();return W(t,e,`Int`),null};ea.displayName=`JVR.Int`;var ta=e=>{var{Map:t={}}=R();return W(t,e,`Map`),null};ta.displayName=`JVR.Map`;var na=e=>{var{Nan:t={}}=R();return W(t,e,`Nan`),null};na.displayName=`JVR.Nan`;var ra=e=>{var{Null:t={}}=R();return W(t,e,`Null`),null};ra.displayName=`JVR.Null`;var ia=e=>{var{Set:t={}}=R();return W(t,e,`Set`),null};ia.displayName=`JVR.Set`;var aa=e=>{var{Str:t={}}=R();return W(t,e,`Str`),null};aa.displayName=`JVR.StringText`;var oa=e=>{var{True:t={}}=R();return W(t,e,`True`),null};oa.displayName=`JVR.True`;var sa=e=>{var{Undefined:t={}}=R();return W(t,e,`Undefined`),null};sa.displayName=`JVR.Undefined`;var ca=e=>{var{Url:t={}}=R();return W(t,e,`Url`),null};ca.displayName=`JVR.Url`;var la=e=>{var{Copied:t={}}=B();return G(t,e,`Copied`),null};la.displayName=`JVR.Copied`;var ua=[`className`,`style`,`value`,`children`,`collapsed`,`shouldExpandNodeInitially`,`indentWidth`,`displayObjectSize`,`shortenTextAfterLength`,`stringEllipsis`,`highlightUpdates`,`enableClipboard`,`displayDataTypes`,`objectSortKeys`,`onExpand`,`onCopied`,`beforeCopy`],K=(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=L(e,ua),b=I({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)(yr,{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)(Vi,I({value:i},y,{ref:t,className:x,style:b})),a]})});K.Bigint=Xi,K.Date=Zi,K.False=Qi,K.Float=$i,K.Int=ea,K.Map=ta,K.Nan=na,K.Null=ra,K.Set=ia,K.String=aa,K.True=oa,K.Undefined=sa,K.Url=ca,K.ValueQuote=Yi,K.Arrow=Ki,K.Colon=qi,K.Quote=Ji,K.Ellipsis=Li,K.BraceLeft=Hi,K.BraceRight=Ui,K.BracketsLeft=Wi,K.BracketsRight=Gi,K.Copied=la,K.CountInfo=Pi,K.CountInfoExtra=Ai,K.KeyName=pi,K.Row=_i,K.displayName=`JVR.JsonView`;function da(e){return e.pagePath??e.id}var fa={"--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 pa({state:e,onRefresh:t,onSelectBridge:n}){let{bridges:r,activeBridgeId:i,entries:a}=e,o=i&&r.some(e=>e.id===i)?i:r.at(-1)?.id??null,s=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)(E,{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===o;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:da(e)},e.id)})}),r.length===0||!s?(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===o,n=a[e.id]??{},r=Object.keys(n);return(0,O.jsx)(`div`,{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)(K,{value:n[t]??{},collapsed:1,displayDataTypes:!1,displayObjectSize:!1,enableClipboard:!1,indentWidth:12,style:fa})]},`${e.id}::${t}`))},e.id)})})]})}function ma(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 ha({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;return o().then(t=>{e||m(t)}),()=>{e=!0}},[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:ma(e.value)})}async function x(){if(!s)return;let{key:e,draft:t}=s;c(null),await y(()=>n(e,t))}async function S(e){await y(()=>r(e))}async function C(){e.length!==0&&await y(()=>i())}async function w(){typeof window<`u`&&!window.confirm(`清空 simulator 中所有 appId 的 Storage 数据?该操作不可撤销。`)||await y(()=>a())}async function T(){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)(E,{variant:`outline`,size:`xs`,onClick:t,disabled:d,className:`hover:border-accent hover:text-accent`,children:`↻ 刷新`}),(0,O.jsx)(E,{variant:`outline`,size:`xs`,onClick:C,disabled:d||e.length===0,className:`hover:border-destructive hover:text-destructive`,title:`仅清空当前 appId 的 Storage`,children:`清空`}),(0,O.jsx)(E,{variant:`outline`,size:`xs`,onClick:w,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 z-10`,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 z-10`,children:`Value`}),(0,O.jsx)(`th`,{className:`w-px sticky top-0 bg-bg 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;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 font-mono text-code-blue whitespace-nowrap w-px pr-5 align-top`,children:e.key}),(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`}):ma(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:()=>S(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:[p&&(0,O.jsx)(`span`,{className:`font-mono text-[11px] text-text-dim shrink-0`,title:`active appId prefix`,children:p}),(0,O.jsx)(`input`,{type:`text`,placeholder:`key`,value:h,onChange:e=>g(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),T())},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(),T())},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)(E,{variant:`outline`,size:`xs`,onClick:()=>void T(),disabled:d||!h.trim(),className:`hover:border-accent hover:text-accent`,children:`+ 新增`})]})]})}function ga({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}=rt({projectPath:e.path});(0,D.useEffect)(()=>{let t=`Dimina DevTools`;return document.title=`${e.name} - ${t}`,Ae().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 u(){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),pe)}catch{r(!1)}}return(0,O.jsxs)(`div`,{className:`flex flex-col h-screen`,children:[(0,O.jsx)(wn,{compileDropdownRef:l.compileDropdownRef,showCompilePanel:l.showCompilePanel,onToggleCompilePanel:l.toggleCompilePanel,onRelaunch:()=>i.relaunch(),compileStatus:i.compileStatus,rightPane:c.rightPane,onToggleRightPaneVisible:c.toggleRightPaneVisible,onSelectRightPane:c.selectRightPane}),(0,O.jsxs)(`div`,{className:`flex flex-1 overflow-hidden`,children:[(0,O.jsx)(Tn,{simPanelWidth:a.simPanelWidth,device:a.device,zoom:a.zoom,onDeviceChange:a.handleDeviceChange,onZoomChange:a.handleZoomChange,compileStatus:i.compileStatus,preloadPath:i.preloadPath,simulatorUrl:o.simulatorUrl,simulatorRef:o.simulatorRef,currentPage:o.currentPage,copied:n,onCopyPagePath:u}),(0,O.jsx)(`div`,{className:`w-1 bg-surface-splitter border-l border-r border-border-subtle cursor-col-resize shrink-0 transition-colors hover:bg-accent active:bg-accent`,onMouseDown:a.handleSplitterDrag}),(0,O.jsxs)(`div`,{className:`flex flex-1 overflow-hidden`,children:[c.rightPane.selected===`wxml`&&(0,O.jsx)(kn,{tree:s.wxmlTree,onRefresh:s.refreshWxml,onInspectElement:s.inspectWxmlElement,onClearInspection:s.clearWxmlElementInspection}),(0,O.jsx)(`div`,{className:`flex flex-1 overflow-hidden`,style:{display:c.rightPane.selected===`appdata`?`flex`:`none`},children:(0,O.jsx)(pa,{state:s.appData,onRefresh:s.refreshAppData,onSelectBridge:s.setActiveAppDataBridge})}),c.rightPane.selected===`storage`&&(0,O.jsx)(ha,{items:s.storageItems,onRefresh:s.refreshStorage,onSet:s.setStorageItem,onRemove:s.removeStorageItem,onClear:s.clearStorage,onClearAll:s.clearAllStorage,getPrefix:s.getStoragePrefix}),c.rightPane.selected===`simulator`&&(0,O.jsx)(`div`,{className:`flex-1`})]})]})]})}function _a(e,t=globalThis?.document){let n=P(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 va=`DismissableLayer`,ya=`dismissableLayer.update`,ba=`dismissableLayer.pointerDownOutside`,xa=`dismissableLayer.focusOutside`,Sa,Ca=D.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),wa=D.forwardRef((e,t)=>{let{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:a,onInteractOutside:o,onDismiss:s,...c}=e,l=D.useContext(Ca),[u,d]=D.useState(null),f=u?.ownerDocument??globalThis?.document,[,p]=D.useState({}),m=j(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=Da(e=>{let t=e.target,n=[...l.branches].some(e=>e.contains(t));!b||n||(i?.(e),o?.(e),e.defaultPrevented||s?.())},f),S=Oa(e=>{let t=e.target;[...l.branches].some(e=>e.contains(t))||(a?.(e),o?.(e),e.defaultPrevented||s?.())},f);return _a(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&&(Sa=f.body.style.pointerEvents,f.body.style.pointerEvents=`none`),l.layersWithOutsidePointerEventsDisabled.add(u)),l.layers.add(u),ka(),()=>{n&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=Sa)}},[u,f,n,l]),D.useEffect(()=>()=>{u&&(l.layers.delete(u),l.layersWithOutsidePointerEventsDisabled.delete(u),ka())},[u,l]),D.useEffect(()=>{let e=()=>p({});return document.addEventListener(ya,e),()=>document.removeEventListener(ya,e)},[]),(0,O.jsx)(N.div,{...c,ref:m,style:{pointerEvents:y?b?`auto`:`none`:void 0,...e.style},onFocusCapture:A(e.onFocusCapture,S.onFocusCapture),onBlurCapture:A(e.onBlurCapture,S.onBlurCapture),onPointerDownCapture:A(e.onPointerDownCapture,x.onPointerDownCapture)})});wa.displayName=va;var Ta=`DismissableLayerBranch`,Ea=D.forwardRef((e,t)=>{let n=D.useContext(Ca),r=D.useRef(null),i=j(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)(N.div,{...e,ref:i})});Ea.displayName=Ta;function Da(e,t=globalThis?.document){let n=P(e),r=D.useRef(!1),i=D.useRef(()=>{});return D.useEffect(()=>{let e=e=>{if(e.target&&!r.current){let r=function(){Aa(ba,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 Oa(e,t=globalThis?.document){let n=P(e),r=D.useRef(!1);return D.useEffect(()=>{let e=e=>{e.target&&!r.current&&Aa(xa,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 ka(){let e=new CustomEvent(ya);document.dispatchEvent(e)}function Aa(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?bt(i,a):i.dispatchEvent(a)}var ja=`focusScope.autoFocusOnMount`,Ma=`focusScope.autoFocusOnUnmount`,Na={bubbles:!1,cancelable:!0},Pa=`FocusScope`,Fa=D.forwardRef((e,t)=>{let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=D.useState(null),l=P(i),u=P(a),d=D.useRef(null),f=j(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:q(d.current,{select:!0})},t=function(e){if(p.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||q(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&q(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){Ha.add(p);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(ja,Na);s.addEventListener(ja,l),s.dispatchEvent(t),t.defaultPrevented||(Ia(Ga(Ra(s)),{select:!0}),document.activeElement===e&&q(s))}return()=>{s.removeEventListener(ja,l),setTimeout(()=>{let t=new CustomEvent(Ma,Na);s.addEventListener(Ma,u),s.dispatchEvent(t),t.defaultPrevented||q(e??document.body,{select:!0}),s.removeEventListener(Ma,u),Ha.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]=La(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&q(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&q(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,p.paused]);return(0,O.jsx)(N.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})});Fa.displayName=Pa;function Ia(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(q(r,{select:t}),document.activeElement!==n)return}function La(e){let t=Ra(e);return[za(t,e),za(t.reverse(),e)]}function Ra(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 za(e,t){for(let n of e)if(!Ba(n,{upTo:t}))return n}function Ba(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 Va(e){return e instanceof HTMLInputElement&&`select`in e}function q(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&Va(e)&&t&&e.select()}}var Ha=Ua();function Ua(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=Wa(e,t),e.unshift(t)},remove(t){e=Wa(e,t),e[0]?.resume()}}}function Wa(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function Ga(e){return e.filter(e=>e.tagName!==`A`)}var Ka=`Portal`,qa=D.forwardRef((e,t)=>{let{container:n,...r}=e,[i,a]=D.useState(!1);M(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?yt.createPortal((0,O.jsx)(N.div,{...r,ref:t}),o):null});qa.displayName=Ka;var Ja=0;function Ya(){D.useEffect(()=>{let e=document.querySelectorAll(`[data-radix-focus-guard]`);return document.body.insertAdjacentElement(`afterbegin`,e[0]??Xa()),document.body.insertAdjacentElement(`beforeend`,e[1]??Xa()),Ja++,()=>{Ja===1&&document.querySelectorAll(`[data-radix-focus-guard]`).forEach(e=>e.remove()),Ja--}},[])}function Xa(){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 J=function(){return J=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},J.apply(this,arguments)};function Za(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 Qa(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 $a=`right-scroll-bar-position`,eo=`width-before-scroll-bar`,to=`with-scroll-bars-hidden`,no=`--removed-body-scroll-bar-size`;function ro(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function io(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 ao=typeof window<`u`?D.useLayoutEffect:D.useEffect,oo=new WeakMap;function so(e,t){var n=io(t||null,function(t){return e.forEach(function(e){return ro(e,t)})});return ao(function(){var t=oo.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||ro(e,null)}),i.forEach(function(e){r.has(e)||ro(e,a)})}oo.set(n,e)},[e]),n}function co(e){return e}function lo(e,t){t===void 0&&(t=co);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 uo(e){e===void 0&&(e={});var t=lo(null);return t.options=J({async:!0,ssr:!1},e),t}var fo=function(e){var t=e.sideCar,n=Za(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,J({},n))};fo.isSideCarExport=!0;function po(e,t){return e.useMedium(t),fo}var mo=uo(),ho=function(){},go=D.forwardRef(function(e,t){var n=D.useRef(null),r=D.useState({onScrollCapture:ho,onWheelCapture:ho,onTouchMoveCapture:ho}),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=Za(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),x=f,S=so([n,t]),C=J(J({},b),i);return D.createElement(D.Fragment,null,u&&D.createElement(x,{sideCar:mo,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),J(J({},C),{ref:S})):D.createElement(v,J({},C,{className:c,ref:S}),s))});go.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},go.classNames={fullWidth:eo,zeroRight:$a};var _o,vo=function(){if(_o)return _o;if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function yo(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=vo();return t&&e.setAttribute(`nonce`,t),e}function bo(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function xo(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var So=function(){var e=0,t=null;return{add:function(n){e==0&&(t=yo())&&(bo(t,n),xo(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Co=function(){var e=So();return function(t,n){D.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},wo=function(){var e=Co();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},To={left:0,top:0,right:0,gap:0},Eo=function(e){return parseInt(e||``,10)||0},Do=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[Eo(n),Eo(r),Eo(i)]},Oo=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return To;var t=Do(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])}},ko=wo(),Ao=`data-scroll-locked`,jo=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
+ .${to} {
3
+ overflow: hidden ${r};
4
+ padding-right: ${s}px ${r};
5
+ }
6
+ body[${Ao}] {
7
+ overflow: hidden ${r};
8
+ overscroll-behavior: contain;
9
+ ${[t&&`position: relative ${r};`,n===`margin`&&`
10
+ padding-left: ${i}px;
11
+ padding-top: ${a}px;
12
+ padding-right: ${o}px;
13
+ margin-left:0;
14
+ margin-top:0;
15
+ margin-right: ${s}px ${r};
16
+ `,n===`padding`&&`padding-right: ${s}px ${r};`].filter(Boolean).join(``)}
17
+ }
18
+
19
+ .${$a} {
20
+ right: ${s}px ${r};
21
+ }
22
+
23
+ .${eo} {
24
+ margin-right: ${s}px ${r};
25
+ }
26
+
27
+ .${$a} .${$a} {
28
+ right: 0 ${r};
29
+ }
30
+
31
+ .${eo} .${eo} {
32
+ margin-right: 0 ${r};
33
+ }
34
+
35
+ body[${Ao}] {
36
+ ${no}: ${s}px;
37
+ }
38
+ `},Mo=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},No=function(){D.useEffect(function(){return document.body.setAttribute(Ao,(Mo()+1).toString()),function(){var e=Mo()-1;e<=0?document.body.removeAttribute(Ao):document.body.setAttribute(Ao,e.toString())}},[])},Po=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;No();var a=D.useMemo(function(){return Oo(i)},[i]);return D.createElement(ko,{styles:jo(a,!t,i,n?``:`!important`)})},Fo=!1;if(typeof window<`u`)try{var Io=Object.defineProperty({},`passive`,{get:function(){return Fo=!0,!0}});window.addEventListener(`test`,Io,Io),window.removeEventListener(`test`,Io,Io)}catch{Fo=!1}var Y=Fo?{passive:!1}:!1,Lo=function(e){return e.tagName===`TEXTAREA`},Ro=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!Lo(e)&&n[t]===`visible`)},zo=function(e){return Ro(e,`overflowY`)},Bo=function(e){return Ro(e,`overflowX`)},Vo=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),Wo(e,r)){var i=Go(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Ho=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},Uo=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},Wo=function(e,t){return e===`v`?zo(t):Bo(t)},Go=function(e,t){return e===`v`?Ho(t):Uo(t)},Ko=function(e,t){return e===`h`&&t===`rtl`?-1:1},qo=function(e,t,n,r,i){var a=Ko(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=Go(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&Wo(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},Jo=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Yo=function(e){return[e.deltaX,e.deltaY]},Xo=function(e){return e&&`current`in e?e.current:e},Zo=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Qo=function(e){return`
39
+ .block-interactivity-${e} {pointer-events: none;}
40
+ .allow-interactivity-${e} {pointer-events: all;}
41
+ `},$o=0,X=[];function es(e){var t=D.useRef([]),n=D.useRef([0,0]),r=D.useRef(),i=D.useState($o++)[0],a=D.useState(wo)[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=Qa([e.lockRef.current],(e.shards||[]).map(Xo),!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=Jo(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=Vo(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=Vo(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 qo(h,t,e,h===`h`?s:c,!0)},[]),c=D.useCallback(function(e){var n=e;if(!(!X.length||X[X.length-1]!==a)){var r=`deltaY`in n?Yo(n):Jo(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&Zo(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(Xo).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:ts(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=Jo(e),r.current=void 0},[]),d=D.useCallback(function(t){l(t.type,Yo(t),t.target,s(t,e.lockRef.current))},[]),f=D.useCallback(function(t){l(t.type,Jo(t),t.target,s(t,e.lockRef.current))},[]);D.useEffect(function(){return X.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,Y),document.addEventListener(`touchmove`,c,Y),document.addEventListener(`touchstart`,u,Y),function(){X=X.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,Y),document.removeEventListener(`touchmove`,c,Y),document.removeEventListener(`touchstart`,u,Y)}},[]);var p=e.removeScrollBar,m=e.inert;return D.createElement(D.Fragment,null,m?D.createElement(a,{styles:Qo(i)}):null,p?D.createElement(Po,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function ts(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var ns=po(mo,es),rs=D.forwardRef(function(e,t){return D.createElement(go,J({},e,{ref:t,sideCar:ns}))});rs.classNames=go.classNames;var is=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},Z=new WeakMap,as=new WeakMap,os={},ss=0,cs=function(e){return e&&(e.host||cs(e.parentNode))},ls=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=cs(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})},us=function(e,t,n,r){var i=ls(t,Array.isArray(e)?e:[e]);os[n]||(os[n]=new WeakMap);var a=os[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=(Z.get(e)||0)+1,l=(a.get(e)||0)+1;Z.set(e,c),a.set(e,l),o.push(e),c===1&&i&&as.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(),ss++,function(){o.forEach(function(e){var t=Z.get(e)-1,i=a.get(e)-1;Z.set(e,t),a.set(e,i),t||(as.has(e)||e.removeAttribute(r),as.delete(e)),i||e.removeAttribute(n)}),ss--,ss||(Z=new WeakMap,Z=new WeakMap,as=new WeakMap,os={})}},ds=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||is(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),us(r,i,n,`aria-hidden`)):function(){return null}},fs=`Dialog`,[ps,ms]=at(fs),[hs,Q]=ps(fs),gs=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]=St({prop:r,defaultProp:i??!1,onChange:a,caller:fs});return(0,O.jsx)(hs,{scope:t,triggerRef:s,contentRef:c,contentId:vt(),titleId:vt(),descriptionId:vt(),open:l,onOpenChange:u,onOpenToggle:D.useCallback(()=>u(e=>!e),[u]),modal:o,children:n})};gs.displayName=fs;var _s=`DialogTrigger`,vs=D.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=Q(_s,n),a=j(t,i.triggerRef);return(0,O.jsx)(N.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.contentId,"data-state":Ls(i.open),...r,ref:a,onClick:A(e.onClick,i.onOpenToggle)})});vs.displayName=_s;var ys=`DialogPortal`,[bs,xs]=ps(ys,{forceMount:void 0}),Ss=e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=Q(ys,t);return(0,O.jsx)(bs,{scope:t,forceMount:n,children:D.Children.map(r,e=>(0,O.jsx)(Jt,{present:n||a.open,children:(0,O.jsx)(qa,{asChild:!0,container:i,children:e})}))})};Ss.displayName=ys;var Cs=`DialogOverlay`,ws=D.forwardRef((e,t)=>{let n=xs(Cs,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Q(Cs,e.__scopeDialog);return a.modal?(0,O.jsx)(Jt,{present:r||a.open,children:(0,O.jsx)(Es,{...i,ref:t})}):null});ws.displayName=Cs;var Ts=lt(`DialogOverlay.RemoveScroll`),Es=D.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=Q(Cs,n);return(0,O.jsx)(rs,{as:Ts,allowPinchZoom:!0,shards:[i.contentRef],children:(0,O.jsx)(N.div,{"data-state":Ls(i.open),...r,ref:t,style:{pointerEvents:`auto`,...r.style}})})}),$=`DialogContent`,Ds=D.forwardRef((e,t)=>{let n=xs($,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Q($,e.__scopeDialog);return(0,O.jsx)(Jt,{present:r||a.open,children:a.modal?(0,O.jsx)(Os,{...i,ref:t}):(0,O.jsx)(ks,{...i,ref:t})})});Ds.displayName=$;var Os=D.forwardRef((e,t)=>{let n=Q($,e.__scopeDialog),r=D.useRef(null),i=j(t,n.contentRef,r);return D.useEffect(()=>{let e=r.current;if(e)return ds(e)},[]),(0,O.jsx)(As,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:A(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:A(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:A(e.onFocusOutside,e=>e.preventDefault())})}),ks=D.forwardRef((e,t)=>{let n=Q($,e.__scopeDialog),r=D.useRef(!1),i=D.useRef(!1);return(0,O.jsx)(As,{...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()}})}),As=D.forwardRef((e,t)=>{let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=Q($,n),c=D.useRef(null),l=j(t,c);return Ya(),(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(Fa,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,O.jsx)(wa,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":Ls(s.open),...o,ref:l,onDismiss:()=>s.onOpenChange(!1)})}),(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(Vs,{titleId:s.titleId}),(0,O.jsx)(Us,{contentRef:c,descriptionId:s.descriptionId})]})]})}),js=`DialogTitle`,Ms=D.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=Q(js,n);return(0,O.jsx)(N.h2,{id:i.titleId,...r,ref:t})});Ms.displayName=js;var Ns=`DialogDescription`,Ps=D.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=Q(Ns,n);return(0,O.jsx)(N.p,{id:i.descriptionId,...r,ref:t})});Ps.displayName=Ns;var Fs=`DialogClose`,Is=D.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=Q(Fs,n);return(0,O.jsx)(N.button,{type:`button`,...r,ref:t,onClick:A(e.onClick,()=>i.onOpenChange(!1))})});Is.displayName=Fs;function Ls(e){return e?`open`:`closed`}var Rs=`DialogTitleWarning`,[zs,Bs]=it(Rs,{contentName:$,titleName:js,docsSlug:`dialog`}),Vs=({titleId:e})=>{let t=Bs(Rs),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
42
+
43
+ If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
44
+
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},Hs=`DialogDescriptionWarning`,Us=({contentRef:e,descriptionId:t})=>{let n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Bs(Hs).contentName}}.`;return D.useEffect(()=>{let r=e.current?.getAttribute(`aria-describedby`);t&&r&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},Ws=gs,Gs=Ss,Ks=ws,qs=Ds,Js=Ms,Ys=Ps,Xs=Is,Zs=Ws,Qs=Gs,$s=D.forwardRef(({className:e,...t},n)=>(0,O.jsx)(Ks,{ref:n,className:y(`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}));$s.displayName=Ks.displayName;var ec=D.forwardRef(({className:e,children:t,...n},r)=>(0,O.jsxs)(Qs,{children:[(0,O.jsx)($s,{}),(0,O.jsxs)(qs,{ref:r,className:y(`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)(Xs,{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)(Ee,{className:`h-4 w-4`}),(0,O.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]}));ec.displayName=qs.displayName;var tc=({className:e,...t})=>(0,O.jsx)(`div`,{className:y(`flex flex-col space-y-1.5 text-center sm:text-left`,e),...t});tc.displayName=`DialogHeader`;var nc=({className:e,...t})=>(0,O.jsx)(`div`,{className:y(`flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2`,e),...t});nc.displayName=`DialogFooter`;var rc=D.forwardRef(({className:e,...t},n)=>(0,O.jsx)(Js,{ref:n,className:y(`text-lg font-semibold leading-none tracking-tight`,e),...t}));rc.displayName=Js.displayName;var ic=D.forwardRef(({className:e,...t},n)=>(0,O.jsx)(Ys,{ref:n,className:y(`text-sm text-text-muted`,e),...t}));ic.displayName=Ys.displayName;function ac(){let[e,t]=(0,D.useState)(!1),[n,r]=(0,D.useState)(null),[i,a]=(0,D.useState)(`prompt`),[o,s]=(0,D.useState)(0),[c,l]=(0,D.useState)(``);(0,D.useEffect)(()=>p(v.Available,e=>{r(e),a(`prompt`),s(0),l(``),t(!0)}),[]),(0,D.useEffect)(()=>p(v.DownloadProgress,e=>{s(Math.round(e.percent))}),[]);let d=(0,D.useCallback)(async()=>{a(`downloading`),s(0);try{let e=await u(v.Download);e.success?a(`ready`):(l(e.error||`Download failed`),a(`error`))}catch(e){l(e instanceof Error?e.message:String(e)),a(`error`)}},[]),f=(0,D.useCallback)(()=>{u(v.Install).catch(e=>{console.warn(`[update] install failed:`,e)})},[]),m=(0,D.useCallback)(()=>{n?.mandatory&&i!==`ready`||t(!1)},[n,i]);return n?(0,O.jsx)(Zs,{open:e,onOpenChange:e=>{!e&&n?.mandatory&&i!==`ready`||t(e)},children:(0,O.jsxs)(ec,{className:`max-w-md`,children:[(0,O.jsxs)(tc,{children:[(0,O.jsx)(rc,{children:i===`ready`?`Ready to Install`:`Update Available`}),(0,O.jsxs)(ic,{children:[i===`prompt`&&`New version ${n.version} is available.`,i===`downloading`&&`Downloading... ${o}%`,i===`ready`&&`Download complete. Click install to restart and apply the update.`,i===`error`&&`Download failed: ${c}`]})]}),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:`${o}%`}})}),(0,O.jsxs)(nc,{children:[i===`prompt`&&(0,O.jsxs)(O.Fragment,{children:[!n.mandatory&&(0,O.jsx)(E,{variant:`outline`,onClick:m,children:`Later`}),(0,O.jsx)(E,{onClick:d,children:`Download`})]}),i===`ready`&&(0,O.jsx)(E,{onClick:f,children:`Install & Restart`}),i===`error`&&(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(E,{variant:`outline`,onClick:m,children:`Close`}),(0,O.jsx)(E,{onClick:d,children:`Retry`})]})]})]})}):null}var oc=`Dimina DevTools`;function sc(){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)(oc);async function u(){a(await Me())}(0,D.useEffect)(()=>{u(),Ae().then(e=>{e?.appName&&(l(e.appName),document.title=e.appName)}).catch(()=>{})},[]),(0,D.useEffect)(()=>{i.length!==0&&Promise.all(i.map(e=>He(e.path).then(t=>[e.path,t]))).then(e=>s(Object.fromEntries(e)))},[i]),(0,D.useEffect)(()=>te(()=>{document.title=c,t(`list`),r(null),Me().then(a)}),[c]);async function d(){let e=await Ne();if(!e)return;let t;try{t=await Pe(e)}catch{return}await u(),p(t)}async function f(e){await Fe(e.path),await u()}function p(e){r(e),t(`project`)}return e===`list`?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(ac,{}),(0,O.jsx)(ke,{projects:i,onAdd:d,onOpen:p,onRemove:f,thumbnails:o})]}):(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(ac,{}),(0,O.jsx)(ga,{project:n},n?.path)]})}De.createRoot(document.getElementById(`root`)).render((0,O.jsx)(sc,{}));
46
+ //# sourceMappingURL=index-BFdItKBK.js.map