@visulima/dev-toolbar 1.0.0-alpha.3 → 1.0.0-alpha.5

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 (143) hide show
  1. package/CHANGELOG.md +60 -0
  2. package/LICENSE.md +109 -2
  3. package/dist/apps/a11y/a11y-app.d.ts +0 -1
  4. package/dist/apps/a11y/a11y-store.d.ts +12 -16
  5. package/dist/apps/a11y/a11y-tooltip.d.ts +0 -1
  6. package/dist/apps/a11y/index.js +3 -3
  7. package/dist/apps/assets/assets-app.d.ts +4 -0
  8. package/dist/apps/assets/index.d.ts +3 -0
  9. package/dist/apps/assets/index.js +16 -0
  10. package/dist/apps/inspector/index.js +2 -2
  11. package/dist/apps/inspector/inspector-app.d.ts +4 -2
  12. package/dist/apps/module-graph/index.js +2 -2
  13. package/dist/apps/module-graph/module-graph-app.d.ts +0 -1
  14. package/dist/apps/performance/index.js +2 -2
  15. package/dist/apps/performance/performance-app.d.ts +0 -1
  16. package/dist/apps/performance/performance-tooltip.d.ts +0 -1
  17. package/dist/apps/seo/index.js +2 -2
  18. package/dist/apps/seo/seo-app.d.ts +0 -1
  19. package/dist/apps/settings/index.js +2 -2
  20. package/dist/apps/tailwind/index.js +6 -6
  21. package/dist/apps/tailwind/tailwind-app.d.ts +0 -1
  22. package/dist/apps/timeline/index.js +2 -2
  23. package/dist/apps/timeline/timeline-app.d.ts +0 -1
  24. package/dist/apps/vite-config/index.js +2 -2
  25. package/dist/apps/vite-config/vite-config-app.d.ts +0 -1
  26. package/dist/client/overlay.js +1 -1
  27. package/dist/hooks/create-hook.d.ts +7 -5
  28. package/dist/hooks/events.d.ts +4 -2
  29. package/dist/hooks/global-hook.d.ts +6 -6
  30. package/dist/index.d.ts +2 -1
  31. package/dist/index.js +1 -1
  32. package/dist/packem_chunks/inject-source.js +9 -1
  33. package/dist/packem_shared/Alert-D2CvX4fw.js +1 -0
  34. package/dist/packem_shared/Badge-BEgU04nl.js +1 -0
  35. package/dist/packem_shared/Button-Bkx66Co7.js +1 -0
  36. package/dist/packem_shared/Card-CJa4vHVc.js +1 -0
  37. package/dist/packem_shared/Icon-B6UHkC0o.js +1 -0
  38. package/dist/packem_shared/Input-Cs6aduTi.js +1 -0
  39. package/dist/packem_shared/Label-CgCFOMDc.js +1 -0
  40. package/dist/packem_shared/Popover-DzH5lAc9.js +1 -0
  41. package/dist/packem_shared/Progress-DN6zn-0l.js +1 -0
  42. package/dist/packem_shared/Separator-D38mKeZv.js +1 -0
  43. package/dist/packem_shared/Skeleton-Dv-tcA1P.js +1 -0
  44. package/dist/packem_shared/Switch-C3NTpeoR.js +1 -0
  45. package/dist/packem_shared/Tabs-SuFWbB6d.js +1 -0
  46. package/dist/packem_shared/Textarea-Yfg3dLZi.js +1 -0
  47. package/dist/packem_shared/Tooltip-BHmzUaxu.js +1 -0
  48. package/dist/packem_shared/clsx-wGlvpUfw.js +1 -0
  49. package/dist/packem_shared/createClientRPCContext-DgRxrllw.js +1 -0
  50. package/dist/packem_shared/createDevToolbarHook-4bZZiHPI.js +1 -0
  51. package/dist/packem_shared/createServerRPCContext-CJXa8ezf.js +1 -0
  52. package/dist/packem_shared/getTimelineStore-B1cfjWV8.js +1 -0
  53. package/dist/packem_shared/{setupGlobalHook-CFuxsCyl.js → setupGlobalHook-CCf9Logv.js} +1 -1
  54. package/dist/packem_shared/sharedToolbarStylesheet-JFwZE8kq.js +2 -0
  55. package/dist/packem_shared/store-DaUtLjf3.js +1 -0
  56. package/dist/packem_shared/use-frame-state-CxrlPUM5.js +1 -0
  57. package/dist/packem_shared/use-theme-zpm4zmqP.js +1 -0
  58. package/dist/performance/monitor.d.ts +27 -26
  59. package/dist/rpc/client.d.ts +6 -4
  60. package/dist/rpc/functions/assets.d.ts +16 -0
  61. package/dist/rpc/functions/open-in-editor.d.ts +7 -5
  62. package/dist/rpc/functions/tailwind-config.d.ts +7 -4
  63. package/dist/rpc/functions/vite-config.d.ts +80 -4
  64. package/dist/rpc/server.d.ts +9 -6
  65. package/dist/timeline/capture.d.ts +3 -1
  66. package/dist/timeline/index.d.ts +2 -1
  67. package/dist/timeline/store.d.ts +12 -22
  68. package/dist/toolbar/app-manager.d.ts +45 -43
  69. package/dist/toolbar/components/app-button.d.ts +0 -1
  70. package/dist/toolbar/components/app-canvas.d.ts +1 -1
  71. package/dist/toolbar/components/first-visit-hint.d.ts +0 -1
  72. package/dist/toolbar/components/toolbar-bar.d.ts +2 -7
  73. package/dist/toolbar/components/toolbar-container.d.ts +2 -8
  74. package/dist/toolbar/components/vite-overlay-button.d.ts +2 -2
  75. package/dist/toolbar/context/toolbar-context.d.ts +20 -19
  76. package/dist/toolbar/global-api.d.ts +3 -3
  77. package/dist/toolbar/helpers.d.ts +5 -3
  78. package/dist/toolbar/hooks/use-apps.d.ts +5 -3
  79. package/dist/toolbar/hooks/use-frame-state.d.ts +26 -10
  80. package/dist/toolbar/hooks/use-panel-visible.d.ts +9 -7
  81. package/dist/toolbar/hooks/use-position.d.ts +7 -5
  82. package/dist/toolbar/hooks/use-theme.d.ts +6 -4
  83. package/dist/toolbar/hooks/use-toolbar.d.ts +4 -2
  84. package/dist/toolbar/index.d.ts +8 -15
  85. package/dist/toolbar/index.js +3 -3
  86. package/dist/toolbar/settings.d.ts +7 -7
  87. package/dist/toolbar/stylesheet.d.ts +3 -1
  88. package/dist/toolbar/utils/index.d.ts +3 -3
  89. package/dist/types/global-api.d.ts +22 -33
  90. package/dist/types/hooks.d.ts +32 -34
  91. package/dist/types/messaging.d.ts +2 -2
  92. package/dist/types/rpc.d.ts +11 -7
  93. package/dist/types/timeline.d.ts +3 -3
  94. package/dist/types/toolbar.d.ts +1 -1
  95. package/dist/ui/components/alert.d.ts +0 -1
  96. package/dist/ui/components/badge.d.ts +0 -1
  97. package/dist/ui/components/button.d.ts +0 -1
  98. package/dist/ui/components/card.d.ts +0 -1
  99. package/dist/ui/components/icon.d.ts +3 -5
  100. package/dist/ui/components/input.d.ts +0 -1
  101. package/dist/ui/components/label.d.ts +0 -1
  102. package/dist/ui/components/popover.d.ts +1 -1
  103. package/dist/ui/components/progress.d.ts +0 -1
  104. package/dist/ui/components/separator.d.ts +0 -1
  105. package/dist/ui/components/skeleton.d.ts +0 -1
  106. package/dist/ui/components/switch.d.ts +0 -1
  107. package/dist/ui/components/tabs.d.ts +1 -2
  108. package/dist/ui/components/textarea.d.ts +0 -1
  109. package/dist/ui/components/tooltip.d.ts +1 -1
  110. package/dist/ui/index.d.ts +0 -1
  111. package/dist/ui/index.js +1 -1
  112. package/dist/vite/inject-source.d.ts +0 -1
  113. package/dist/vite/matcher.d.ts +2 -1
  114. package/dist/vite-plugin.d.ts +10 -6
  115. package/dist/vite-plugin.js +2 -2
  116. package/package.json +14 -12
  117. package/dist/apps/more/index.d.ts +0 -3
  118. package/dist/apps/more/index.js +0 -19
  119. package/dist/apps/more/more-app.d.ts +0 -5
  120. package/dist/packem_shared/Alert-H-x1JuZ0.js +0 -1
  121. package/dist/packem_shared/Badge-C30mDKKG.js +0 -1
  122. package/dist/packem_shared/Button-DODNCTPZ.js +0 -1
  123. package/dist/packem_shared/Card-DdI7Wn3t.js +0 -1
  124. package/dist/packem_shared/Icon-DWFLZkwW.js +0 -1
  125. package/dist/packem_shared/Input-GfbOwAkK.js +0 -1
  126. package/dist/packem_shared/Label-Bzi47aUf.js +0 -1
  127. package/dist/packem_shared/Popover-o3Vkvndp.js +0 -1
  128. package/dist/packem_shared/Progress-vGfFpxRn.js +0 -1
  129. package/dist/packem_shared/Separator-DQGeJPQg.js +0 -1
  130. package/dist/packem_shared/Skeleton-BYXau6jM.js +0 -1
  131. package/dist/packem_shared/Switch-BeC78S_T.js +0 -1
  132. package/dist/packem_shared/Tabs-BBc4S-2T.js +0 -1
  133. package/dist/packem_shared/Textarea-DvbSX13V.js +0 -1
  134. package/dist/packem_shared/TimelineStore-BgBrirKd.js +0 -1
  135. package/dist/packem_shared/Tooltip-BwK-2I9P.js +0 -1
  136. package/dist/packem_shared/cn-DWLJYh3h.js +0 -1
  137. package/dist/packem_shared/createClientRPCContext-DzKQpKTk.js +0 -1
  138. package/dist/packem_shared/createDevToolbarHook-DGNxqk8N.js +0 -1
  139. package/dist/packem_shared/createServerRPCContext-CRd6VAWp.js +0 -1
  140. package/dist/packem_shared/sharedToolbarStylesheet-DHHoFz2-.js +0 -2
  141. package/dist/packem_shared/store-BxE0w51s.js +0 -1
  142. package/dist/packem_shared/use-theme-CX1gG6Sv.js +0 -1
  143. package/dist/utils/cn.d.ts +0 -8
@@ -1,8 +1,8 @@
1
1
  import type { ToolbarPlacement } from "../../types/index.d.ts";
2
2
  /**
3
- * Hook for toolbar visibility and placement - exposes context methods directly
3
+ * Exposes toolbar visibility and placement controls from the toolbar context.
4
4
  */
5
- export declare const useToolbar: () => {
5
+ declare const useToolbar: () => {
6
6
  hide: () => void;
7
7
  isDragging: boolean;
8
8
  isVisible: boolean;
@@ -12,3 +12,5 @@ export declare const useToolbar: () => {
12
12
  show: () => void;
13
13
  toggle: () => void;
14
14
  };
15
+ export { useToolbar };
16
+ export default useToolbar;
@@ -1,22 +1,21 @@
1
1
  import type { DevToolbarApp } from "../types/index.d.ts";
2
2
  import { AppManager } from "./app-manager.d.ts";
3
3
  /**
4
- * Dev Toolbar Web Component
4
+ * Dev Toolbar Web Component.
5
5
  */
6
6
  export declare class DevToolbar extends HTMLElement {
7
7
  private appManager;
8
8
  private hasBeenInitialized;
9
- private customAppsToShow;
10
9
  private renderRoot;
11
10
  constructor();
12
11
  /**
13
- * Called when element is inserted into the DOM
14
- * According to Preact docs, rendering should happen here or after connection
12
+ * Called when element is inserted into the DOM.
13
+ * According to Preact docs, rendering should happen here or after connection.
15
14
  */
16
15
  connectedCallback(): void;
17
16
  /**
18
- * Called when element is removed from the DOM
19
- * Clean up Preact component to prevent memory leaks
17
+ * Called when element is removed from the DOM.
18
+ * Cleans up the Preact component to prevent memory leaks.
20
19
  */
21
20
  disconnectedCallback(): void;
22
21
  /**
@@ -32,7 +31,7 @@ export declare class DevToolbar extends HTMLElement {
32
31
  */
33
32
  setToolbarVisible(visible: boolean): void;
34
33
  /**
35
- * Register an app.
34
+ * Adds an app to the toolbar and triggers a re-render.
36
35
  */
37
36
  registerApp(app: DevToolbarApp, builtIn?: boolean): void;
38
37
  /**
@@ -40,17 +39,11 @@ export declare class DevToolbar extends HTMLElement {
40
39
  */
41
40
  getAppManager(): AppManager;
42
41
  /**
43
- * Inject Geist font into document.head once.
44
- * @font-face declared in the document is part of the global font registry and
45
- * is accessible from within shadow DOM roots — no duplication needed.
46
- */
47
- private static injectFont;
48
- /**
49
- * Render the toolbar UI using Preact
42
+ * Renders the toolbar UI using Preact.
50
43
  */
51
44
  private render;
52
45
  /**
53
- * Setup event listeners.
46
+ * Attaches global keyboard shortcuts and other DOM event listeners.
54
47
  */
55
48
  private setupEventListeners;
56
49
  }
@@ -1,5 +1,5 @@
1
- var Ge=Object.defineProperty;var R=(e,t)=>Ge(e,"name",{value:t,configurable:!0});import{createContext as Ye,render as ke}from"preact";import{createClientRPCContext as _e}from"../packem_shared/createClientRPCContext-DzKQpKTk.js";import{updateSettings as Oe,loadSettings as Ne}from"../packem_shared/loadSettings-hvjR4fcS.js";import{getGlobalHook as Xe,setupGlobalHook as Je}from"../packem_shared/setupGlobalHook-CFuxsCyl.js";import{sharedToolbarStylesheet as he}from"../packem_shared/sharedToolbarStylesheet-DHHoFz2-.js";import{jsx as n,jsxs as m,Fragment as Te}from"preact/jsx-runtime";import{g as Ue}from"../packem_shared/store-BxE0w51s.js";import{addHookName as l}from"preact/devtools";import{useContext as Qe,useEffect as V,useMemo as ee,useState as $,useRef as b,useCallback as ce,useLayoutEffect as qe}from"preact/hooks";import h from"../packem_shared/cn-DWLJYh3h.js";import te from"../packem_shared/Icon-DWFLZkwW.js";import{u as Ce,a as Ve}from"../packem_shared/use-theme-CX1gG6Sv.js";var Ke=Object.defineProperty,et=R((e,t)=>Ke(e,"name",{value:t,configurable:!0}),"t$3");const me=et(()=>{const e=_e();return{rpc:new Proxy({},{get(t,r){return(...i)=>e.callServer(r,...i)}})}},"createServerHelpers");var tt=Object.defineProperty,rt=R((e,t)=>tt(e,"name",{value:t,configurable:!0}),"n$3");class nt{static{R(this,"AppManager")}static{rt(this,"AppManager")}apps=new Map;activeAppId=null;initializedApps=new Set;appCanvases=new Map;registerApp(t,r=!1){this.apps.has(t.id)&&(this.initializedApps.delete(t.id),this.appCanvases.delete(t.id),this.activeAppId===t.id&&(this.activeAppId=null));const i=new EventTarget,o={...t,active:!1,builtIn:r,eventTarget:i,notification:{state:!1},status:"ready"};this.apps.set(t.id,o)}async unregisterApp(t){const r=this.apps.get(t);if(r?.destroy&&this.initializedApps.has(t)){const i=this.appCanvases.get(t);if(i)try{await r.destroy(i.shadowRoot)}catch(o){console.error(`[dev-toolbar] destroy() failed for app ${t}:`,o)}}this.apps.delete(t),this.initializedApps.delete(t),this.appCanvases.delete(t),this.activeAppId===t&&(this.activeAppId=null)}getApp(t){return this.apps.get(t)}getAllApps(){return[...this.apps.values()]}getActiveApp(){if(this.activeAppId)return this.apps.get(this.activeAppId)}async toggleApp(t){const r=this.apps.get(t);if(!r)return!1;if(r.onClick??r.onDeactivate){const i=r.active;return r.active=!i,!i&&r.onClick?await r.onClick():i&&r.onDeactivate&&await r.onDeactivate(),!0}return r.active?await this.closeApp(t):this.activeAppId&&!await this.closeApp(this.activeAppId)?!1:await this.openApp(t)}setAppActive(t,r){const i=this.apps.get(t);i&&(i.active=r)}isAppInitialized(t){return this.initializedApps.has(t)}markAppInitialized(t){this.initializedApps.add(t)}async openApp(t){const r=this.apps.get(t);if(!r)return!1;if(r.active=!0,r.status="loading",this.activeAppId=t,r.init&&!this.isAppInitialized(t))try{const i=this.getAppCanvas(t);if(i){const o=me(),a=r.init(i.shadowRoot,r.eventTarget,o);a&&typeof a.then=="function"&&await a,this.markAppInitialized(t),r.status="ready"}else r.status="pending"}catch(i){return console.error(`[dev-toolbar] Failed to init app ${t}:`,i),r.status="error",r.active=!1,this.activeAppId=null,!1}else r.status="ready";return!0}async closeApp(t){const r=this.apps.get(t);if(!r||!r.active)return!1;if(r.beforeTogglingOff){const i=this.getAppCanvas(t);if(i)try{const o=r.beforeTogglingOff(i.shadowRoot);if(!(o&&typeof o.then=="function"?await o:o))return!1}catch(o){console.error(`[dev-toolbar] beforeTogglingOff() threw for app ${t}:`,o)}}return r.active=!1,this.activeAppId===t&&(this.activeAppId=null),!0}setNotification(t,r,i){const o=this.apps.get(t);o&&(o.notification={level:i,state:r})}clearNotification(t){const r=this.apps.get(t);r&&(r.notification={state:!1})}getAppCanvas(t){return this.appCanvases.get(t)||null}setAppCanvas(t,r){this.appCanvases.set(t,r)}}var it=Object.defineProperty,ot=R((e,t)=>it(e,"name",{value:t,configurable:!0}),"t$2");const $e=Ye(null),Pe=ot(()=>{const e=Qe($e);if(!e)throw new Error("useToolbarContext must be used within ToolbarContext provider");return e},"useToolbarContext");var at=Object.defineProperty,st=R((e,t)=>at(e,"name",{value:t,configurable:!0}),"t$1");const Fe=st(()=>{const e=Pe();return{activeAppId:e.activeAppId,apps:e.apps,clearNotification:e.clearNotification,registerApp:e.registerApp,setNotification:e.setNotification,toggleApp:e.toggleApp,unregisterApp:e.unregisterApp}},"useApps");var lt=Object.defineProperty,ge=R((e,t)=>lt(e,"name",{value:t,configurable:!0}),"s$2");const ct=ge((e,t)=>{const r=t.split("+"),i=r.at(-1)??"",o=r.includes("Alt"),a=r.includes("Shift"),c=r.includes("Control")||r.includes("Ctrl"),p=r.includes("Meta")||r.includes("Cmd");return(e.key===i||e.code===`Key${i.toUpperCase()}`)&&e.altKey===o&&e.shiftKey===a&&e.ctrlKey===c&&e.metaKey===p},"matchesBinding"),dt=ge(()=>{const{state:e,updateState:t}=Ce(),r=ge((a,c)=>{const p=c??!e.open;t({open:p,...p?{}:{viewMode:"default"}})},"togglePanelVisible"),i=ge(()=>{e.open&&t({open:!1,viewMode:"default"})},"closePanel");V(()=>{const a=e.keybindings?.toggle??"Alt+Shift+D",c=ge(p=>{ct(p,a)&&r()},"handleKeyDown");return globalThis.window?.addEventListener("keydown",c),()=>{globalThis.window?.removeEventListener("keydown",c)}},[e.open,e.keybindings?.toggle]);const o=l(ee(()=>e.open,[e.open]),"panelVisibleValue: boolean");return{closePanel:i,panelVisible:o,togglePanelVisible:r}},"usePanelVisible");var pt=Object.defineProperty,Ee=R((e,t)=>pt(e,"name",{value:t,configurable:!0}),"e");const ve=Ee((e,t,r)=>Math.min(Math.max(e,t),r),"clamp");Ee(()=>navigator.userAgent.includes("Safari")&&!navigator.userAgent.includes("Chrome"),"checkIsSafari");const xe=Ee(e=>typeof e=="string"?e.endsWith("px")?Number(e.slice(0,-2)):Number(e):e,"pixelToNumber");var ut=Object.defineProperty,ie=R((e,t)=>ut(e,"name",{value:t,configurable:!0}),"g$2");const Se=ie(e=>e<5?0:e>95?100:Math.abs(e-50)<2?50:e,"snapToPoints"),ht=ie(()=>{if(globalThis.window===void 0)return{bottom:0,left:0,right:0,top:0};const e=getComputedStyle(document.documentElement);return{bottom:xe(e.getPropertyValue("env(safe-area-inset-bottom)")||"0"),left:xe(e.getPropertyValue("env(safe-area-inset-left)")||"0"),right:xe(e.getPropertyValue("env(safe-area-inset-right)")||"0"),top:xe(e.getPropertyValue("env(safe-area-inset-top)")||"0")}},"getSafeAreaInsets"),gt=ie(()=>{const[e,t]=l($(()=>({height:globalThis.window?.innerHeight??1080,width:globalThis.window?.innerWidth??1920})),"size");return V(()=>{const r=ie(()=>{t({height:globalThis.window?.innerHeight??1080,width:globalThis.window?.innerWidth??1920})},"updateSize");return r(),globalThis.window?.addEventListener("resize",r),()=>{globalThis.window?.removeEventListener("resize",r)}},[]),e},"useWindowSize"),ft=ie(e=>{const{state:t,updateState:r}=Ce(),{height:i,width:o}=gt(),[a,c]=l($(!1),"isHovering"),[p,f]=l($(!1),"isDragging"),[L,y]=l($(!1),"isViteOverlayOpen"),B=l(b({x:0,y:0}),"draggingOffsetRef"),P=l(b({x:0,y:0}),"mousePositionRef"),D=l(b(null),"timerRef"),M=l(b(null),"capturedPointerIdRef"),F=l(b(!1),"isDraggingRef"),j=l(b(o),"windowWidthRef"),N=l(b(i),"windowHeightRef"),G=l(b(r),"updateStateRef");V(()=>{j.current=o,N.current=i},[o,i]),V(()=>{G.current=r},[r]);const[w,O]=l($(()=>({bottom:10,left:10,right:10,top:10})),"panelMargins");V(()=>{const g=ht();O({bottom:g.bottom+10,left:g.left+10,right:g.right+10,top:g.top+10})},[]),V(()=>{const g=ie(()=>{const E=globalThis.__v_o__current;if(E?.parentNode){const s=E.shadowRoot?.querySelector("#__v_o__root");y(!!s&&!s.classList.contains("hidden"))}else y(!1)},"check"),T=setInterval(g,300);return g(),()=>clearInterval(T)},[]);const U=ce(g=>{g.preventDefault(),g.stopPropagation(),f(!0),F.current=!0;const T=e.current;if(T){const{height:E,left:s,top:d,width:u}=T.getBoundingClientRect();B.current={x:g.clientX-s-u/2,y:g.clientY-d-E/2};const A=g.target;try{A&&A.setPointerCapture?(A.setPointerCapture(g.pointerId),M.current=g.pointerId):T.setPointerCapture&&(T.setPointerCapture(g.pointerId),M.current=g.pointerId)}catch(z){console.warn("Failed to capture pointer:",z)}document.body.style.cursor="grabbing",document.body.style.userSelect="none"}},[e]),Y=ce(()=>{c(!0),!(t.minimizePanelInactive<0)&&(D.current&&clearTimeout(D.current),D.current=setTimeout(()=>{c(!1)},t.minimizePanelInactive||5e3))},[t.minimizePanelInactive]);V(()=>{Y()},[Y]),V(()=>{const g=ie(d=>{if(F.current&&(f(!1),F.current=!1,document.body.style.cursor="",document.body.style.userSelect="",M.current!==null)){try{const u=e.current;u&&M.current!==null&&u.releasePointerCapture(M.current)}catch{}M.current=null}},"handlePointerUp"),T=ie(d=>{if(F.current&&(f(!1),F.current=!1,document.body.style.cursor="",document.body.style.userSelect="",M.current!==null)){try{const u=e.current;u&&M.current!==null&&u.releasePointerCapture(M.current)}catch{}M.current=null}},"handlePointerCancel"),E=ie(()=>{F.current&&(f(!1),F.current=!1,M.current=null,document.body.style.cursor="",document.body.style.userSelect="")},"handleLostPointerCapture"),s=ie(d=>{if(!F.current)return;d.preventDefault();const u=j.current,A=N.current,z=u/2,X=A/2,K=d.clientX,I=d.clientY,ae=K-B.current.x,ne=I-B.current.y;P.current={x:ae,y:ne};const re=Math.max(0,Math.min(K,u)),oe=Math.max(0,Math.min(I,A)),J=Math.atan2(oe-X,re-z),pe=70,v=Math.atan2(0-X+pe,0-z),S=Math.atan2(0-X+pe,u-z),k=Math.atan2(A-pe-X,0-z),Z=Math.atan2(A-pe-X,u-z),se=J>=v&&J<=S?"top":J>=S&&J<=Z?"right":J>=Z&&J<=k?"bottom":"left",be=Math.max(0,Math.min(100,ae/u*100)),Ze=Math.max(0,Math.min(100,ne/A*100));G.current({left:Se(be),position:se,top:Se(Ze)})},"handlePointerMove");return document.addEventListener("pointermove",s,{capture:!0,passive:!1}),document.addEventListener("pointerup",g,{capture:!0}),document.addEventListener("pointercancel",T,{capture:!0}),document.addEventListener("lostpointercapture",E,{capture:!0}),()=>{document.removeEventListener("pointermove",s,{capture:!0}),document.removeEventListener("pointerup",g,{capture:!0}),document.removeEventListener("pointercancel",T,{capture:!0}),document.removeEventListener("lostpointercapture",E,{capture:!0})}},[]);const C=l(ee(()=>t.position==="left"||t.position==="right",[t.position]),"isVertical"),x=l(ee(()=>{if(t.minimizePanelInactive<0)return!1;if(t.minimizePanelInactive===0)return!0;const g=globalThis.window!==void 0&&("ontouchstart"in globalThis.window||(globalThis.navigator?.maxTouchPoints??0)>0);return!p&&!t.open&&!a&&!g&&t.minimizePanelInactive>0&&!L},[p,t.open,t.minimizePanelInactive,a,L]),"isHidden"),H=l(ee(()=>{const g=e.current,T=(g?.clientWidth??0)/2,E=(g?.clientHeight??0)/2,s=C?E:T,d=C?T:E,u=t.left*o/100,A=t.top*i/100;switch(t.position){case"left":return{left:w.left+s-(x?30:0),top:ve(A,d+w.top,i-d-w.bottom)};case"right":return{left:o-w.right-s+(x?15:0)-(x?0:10),top:ve(A,d+w.top,i-d-w.bottom)};case"top":return{left:ve(u,s+w.left,o-s-w.right),top:w.top+d-(x?30:0)};default:return{left:ve(u,s+w.left,o-s-w.right),top:i-w.bottom-d+(x?30:0)}}},[t.left,t.open,t.position,t.top,i,o,w,e,x,C]),"anchorPos"),de=l(ee(()=>({left:`${H.left}px`,top:`${H.top}px`,transition:p?"none":"left 0.3s ease, top 0.3s ease"}),[H,p]),"anchorStyle"),Q=l(ee(()=>{const g=e.current,T=(g?.clientWidth??0)/2,E=(g?.clientHeight??0)/2,s=C?E:T,d=C?T:E,u={bottom:w.bottom+d,left:w.left+s,right:w.right+s,top:w.top+d},A=u.left+u.right,z=u.top+u.bottom,X=o-A,K=i-z,I={height:`min(${t.height}vh, calc(100vh - ${z}px))`,pointerEvents:p?"none":"auto",width:`min(${t.width}vw, calc(100vw - ${A}px))`,zIndex:"-1"},ae=H,ne=Math.min(X,t.width*o/100),re=Math.min(K,t.height*i/100),oe=ae?.left??0,J=ae?.top??0;switch(t.position){case"bottom":case"top":{I.left="0",I.transform="translate(-50%, 0)",oe-u.left<ne/2?I.left=`${ne/2-oe+u.left}px`:o-oe-u.right<ne/2&&(I.left=`${o-oe-ne/2-u.right}px`);break}case"left":case"right":{I.top="0",I.transform="translate(0, -50%)",J-u.top<re/2?I.top=`${re/2-J+u.top}px`:i-J-u.bottom<re/2&&(I.top=`${i-J-re/2-u.bottom}px`);break}}switch(t.position){case"left":{I.left="0";break}case"right":{I.right="0";break}case"top":{I.top="0";break}default:{I.bottom="0";break}}return I},[H,p,w,t.height,t.position,t.width,i,o,e,C]),"iframeStyle"),q=l(ee(()=>{const g={transform:C?"translate(-50%, -50%) rotate(90deg)":"translate(-50%, -50%)"};return p&&(g.transition="none !important"),g},[p,C]),"panelStyle");return{anchorStyle:de,bringUp:Y,iframeStyle:Q,isDragging:p,isHidden:x,isVertical:C,onPointerDown:U,panelStyle:q}},"usePosition");var mt=Object.defineProperty,we=R((e,t)=>mt(e,"name",{value:t,configurable:!0}),"t");const bt=we(({app:e})=>{const{toggleApp:t}=Fe(),{isVisible:r,setHoveredApp:i}=Pe(),o=l(b(null),"buttonRef"),a=we(()=>{i(null),t(e.id).catch(f=>{console.error(`[dev-toolbar] Failed to toggle app ${e.id}:`,f)})},"handleClick"),c=we(()=>{!e.tooltip||r||i(e,o.current?.getBoundingClientRect()??null)},"handleMouseEnter"),p=we(()=>{e.tooltip&&i(null)},"handleMouseLeave");return n("button",{"aria-label":e.name,class:h("relative flex justify-center items-center","border-0","whitespace-nowrap no-underline p-0 m-0","cursor-pointer","bg-transparent text-muted-foreground","transition-all duration-150","hover:bg-primary/8 hover:text-primary","active:scale-[0.94]",e.active&&"bg-primary/12 text-primary","group-data-[vertical]/panel:rotate-[-90deg]"),"data-app-id":e.id,onClick:a,onMouseEnter:c,onMouseLeave:p,ref:o,title:e.tooltip?void 0:e.name,type:"button",children:m("div",{class:"relative size-6 select-none flex items-center justify-center",children:[n("div",{class:"size-6 flex items-center justify-center [&_svg]:size-4.5",dangerouslySetInnerHTML:{__html:e.icon}}),e.notification.state&&n("span",{class:h("absolute -top-1 -right-1 size-1.5 rounded-full border border-background",e.notification.level==="error"&&"bg-destructive",e.notification.level==="warning"&&"bg-warning",(!e.notification.level||e.notification.level==="info")&&"bg-info"),"data-level":e.notification.level||"info"})]})})},"AppButton"),He="data:image/svg+xml;charset=utf-8,%3Csvg%20class%3D%22lucide%20lucide-chevron-right%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22currentColor%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%20%3E%20%3Cpath%20d%3D%22m9%2018%206-6-6-6%22%20%2F%3E%20%3C%2Fsvg%3E",vt="data:image/svg+xml;charset=utf-8,%3Csvg%20class%3D%22lucide%20lucide-layers%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22currentColor%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%20%3E%20%3Cpath%20d%3D%22M12.83%202.18a2%202%200%200%200-1.66%200L2.6%206.08a1%201%200%200%200%200%201.83l8.58%203.91a2%202%200%200%200%201.66%200l8.58-3.9a1%201%200%200%200%200-1.83z%22%20%2F%3E%20%3Cpath%20d%3D%22M2%2012a1%201%200%200%200%20.58.91l8.6%203.91a2%202%200%200%200%201.65%200l8.58-3.9A1%201%200%200%200%2022%2012%22%20%2F%3E%20%3Cpath%20d%3D%22M2%2017a1%201%200%200%200%20.58.91l8.6%203.91a2%202%200%200%200%201.65%200l8.58-3.9A1%201%200%200%200%2022%2017%22%20%2F%3E%20%3C%2Fsvg%3E",xt="data:image/svg+xml;charset=utf-8,%3Csvg%20class%3D%22lucide%20lucide-maximize%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22currentColor%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%20%3E%20%3Cpath%20d%3D%22M8%203H5a2%202%200%200%200-2%202v3%22%20%2F%3E%20%3Cpath%20d%3D%22M21%208V5a2%202%200%200%200-2-2h-3%22%20%2F%3E%20%3Cpath%20d%3D%22M3%2016v3a2%202%200%200%200%202%202h3%22%20%2F%3E%20%3Cpath%20d%3D%22M16%2021h3a2%202%200%200%200%202-2v-3%22%20%2F%3E%20%3C%2Fsvg%3E",wt="data:image/svg+xml;charset=utf-8,%3Csvg%20class%3D%22lucide%20lucide-maximize-2%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22currentColor%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%20%3E%20%3Cpath%20d%3D%22M15%203h6v6%22%20%2F%3E%20%3Cpath%20d%3D%22m21%203-7%207%22%20%2F%3E%20%3Cpath%20d%3D%22m3%2021%207-7%22%20%2F%3E%20%3Cpath%20d%3D%22M9%2021H3v-6%22%20%2F%3E%20%3C%2Fsvg%3E",yt="data:image/svg+xml;charset=utf-8,%3Csvg%20class%3D%22lucide%20lucide-minimize%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22currentColor%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%20%3E%20%3Cpath%20d%3D%22M8%203v3a2%202%200%200%201-2%202H3%22%20%2F%3E%20%3Cpath%20d%3D%22M21%208h-3a2%202%200%200%201-2-2V3%22%20%2F%3E%20%3Cpath%20d%3D%22M3%2016h3a2%202%200%200%201%202%202v3%22%20%2F%3E%20%3Cpath%20d%3D%22M16%2021v-3a2%202%200%200%201%202-2h3%22%20%2F%3E%20%3C%2Fsvg%3E",Dt="data:image/svg+xml;charset=utf-8,%3Csvg%20class%3D%22lucide%20lucide-minimize-2%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22currentColor%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%20%3E%20%3Cpath%20d%3D%22m14%2010%207-7%22%20%2F%3E%20%3Cpath%20d%3D%22M20%2010h-6V4%22%20%2F%3E%20%3Cpath%20d%3D%22m3%2021%207-7%22%20%2F%3E%20%3Cpath%20d%3D%22M4%2014h6v6%22%20%2F%3E%20%3C%2Fsvg%3E",At="data:image/svg+xml;charset=utf-8,%3Csvg%20class%3D%22lucide%20lucide-picture-in-picture-2%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22currentColor%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%20%3E%20%3Cpath%20d%3D%22M21%209V6a2%202%200%200%200-2-2H4a2%202%200%200%200-2%202v10c0%201.1.9%202%202%202h4%22%20%2F%3E%20%3Crect%20width%3D%2210%22%20height%3D%227%22%20x%3D%2212%22%20y%3D%2213%22%20rx%3D%222%22%20%2F%3E%20%3C%2Fsvg%3E",We="data:image/svg+xml;charset=utf-8,%3Csvg%20class%3D%22lucide%20lucide-x%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22currentColor%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%20%3E%20%3Cpath%20d%3D%22M18%206%206%2018%22%20%2F%3E%20%3Cpath%20d%3D%22m6%206%2012%2012%22%20%2F%3E%20%3C%2Fsvg%3E";var It=Object.defineProperty,_=R((e,t)=>It(e,"name",{value:t,configurable:!0}),"a");const Le=_(({app:e})=>{const t=l(b(null),"contentRef"),r=l(b(!1),"initializedRef"),i=l(b(me()),"helpersRef");return V(()=>{if(!t.current||r.current||e.component)return;const o=t.current;if(e.init){const a=document.createElement("div");a.style.cssText="width:100%;height:100%;",o.append(a);const c=a.attachShadow({mode:"open"});he&&(c.adoptedStyleSheets=[he]);const p=me(),f=e.init(c,e.eventTarget,p);return f&&typeof f.then=="function"?f.then(()=>{r.current=!0}).catch(L=>{console.error(`[dev-toolbar] Failed to init app ${e.id}:`,L)}):r.current=!0,()=>{for(;o.firstChild;)o.firstChild.remove();r.current=!1}}},[e]),e.component?n(e.component,{eventTarget:e.eventTarget,helpers:i.current}):n("div",{class:"w-full h-full",ref:t})},"AppContent"),Ct=_(({apps:e,initialActiveAppId:t,onClose:r})=>{const[i,o]=l($(t),"activeAppId"),[a,c]=l($(!1),"sidebarCollapsed"),p=l(ee(()=>e.find(f=>f.id===i),[e,i]),"activeApp");return m("div",{class:"flex flex-row w-full h-full bg-background font-mono antialiased text-foreground",children:[m("nav",{"aria-label":"DevTools apps",class:h("flex flex-col shrink-0 bg-accent border-r border-border/60","transition-[width] duration-300 ease-[cubic-bezier(0.4,0,0.2,1)]",a?"w-12.5":"w-62.5"),children:[n("div",{class:h("flex items-center shrink-0 border-b border-border/50 h-12",a?"justify-center px-2":"px-3"),children:a?n("span",{"aria-hidden":"true",class:"text-primary font-black text-[0.8rem] select-none",children:"V"}):m("span",{class:"text-[0.6rem] font-bold uppercase tracking-[0.14em] text-muted-foreground select-none",children:[n("span",{"aria-hidden":"true",class:"text-primary/60 mr-1",children:"//"}),"DevTools"]})}),n("div",{class:"flex flex-col flex-1 overflow-y-auto p-2 gap-1 scrollbar-thin-border",children:e.filter(f=>f.component??f.init).map(f=>m("div",{class:"relative group/nav-item",children:[m("button",{"aria-label":f.name,"aria-pressed":i===f.id,class:h("relative flex items-center w-full h-10","border-0 border-l-2 cursor-pointer","transition-all duration-150",a?"justify-center px-0":"gap-2.5 px-3",i===f.id?"border-primary bg-primary/8 text-foreground":"border-transparent bg-transparent text-muted-foreground hover:bg-foreground/6 hover:text-foreground"),onClick:_(()=>o(f.id),"onClick"),type:"button",children:[f.icon?n("span",{class:h("size-4 shrink-0 flex items-center justify-center [&_svg]:size-4",i===f.id?"opacity-100":"opacity-65 group-hover/nav-item:opacity-100"),dangerouslySetInnerHTML:{__html:f.icon}}):n("span",{class:"size-4.5 shrink-0 flex items-center justify-center text-[0.65rem] font-bold uppercase select-none",children:f.name.slice(0,2)}),!a&&n("span",{class:"text-[0.8125rem] font-medium truncate leading-none tracking-[-0.01em]",children:f.name})]}),f.notification.state&&n("span",{"aria-hidden":"true",class:h("pointer-events-none absolute top-1.5 rounded-full",a?"right-1.5":"right-2.5","size-1.5",f.notification.level==="error"?"bg-destructive":f.notification.level==="warning"?"bg-warning":"bg-info")}),a&&n("div",{class:h("absolute left-[calc(100%+0.5rem)] top-1/2 -translate-y-1/2","pointer-events-none z-50 whitespace-nowrap","opacity-0 -translate-x-1 group-hover/nav-item:opacity-100 group-hover/nav-item:translate-x-0","transition-all duration-200 ease-[cubic-bezier(0.23,1,0.32,1)]"),children:n("div",{class:"text-[0.7rem] font-medium bg-card/95 backdrop-blur-[0.625rem] text-foreground/80 px-2.5 py-1 border border-border shadow-md",children:f.name})})]},f.id))})]}),m("div",{class:"flex-1 flex flex-col min-w-0 overflow-hidden bg-accent",children:[m("div",{class:"flex items-center justify-between gap-2 pr-2 min-h-12 shrink-0",children:[m("div",{class:"flex items-center gap-3 min-w-0",children:[n("button",{"aria-label":a?"Expand sidebar":"Collapse sidebar",class:h("flex items-center justify-center size-7 shrink-0","border-0 cursor-pointer bg-transparent","text-muted-foreground hover:text-foreground hover:bg-foreground/7","transition-colors duration-150"),onClick:_(()=>c(f=>!f),"onClick"),type:"button",children:n(te,{class:h("size-3.5 transition-transform duration-300",!a&&"rotate-180"),size:14,src:He})}),p?.icon&&n("span",{class:"size-5 flex items-center justify-center [&_svg]:size-5 shrink-0 text-foreground opacity-80",dangerouslySetInnerHTML:{__html:p.icon}}),m("span",{class:"flex items-center gap-1 text-[0.7rem] font-bold uppercase tracking-[0.06em] text-foreground truncate",children:[n("span",{"aria-hidden":"true",class:"text-primary/50 shrink-0",children:"["}),p?.name??"DevTools",n("span",{"aria-hidden":"true",class:"text-primary/50 shrink-0",children:"]"})]})]}),n("button",{"aria-label":"Close floating window",class:h("flex items-center justify-center size-8","cursor-pointer border-0 bg-transparent","text-muted-foreground hover:text-foreground hover:bg-foreground/7","transition-all duration-200 active:scale-90"),onClick:r,title:"Close floating window",type:"button",children:n(te,{size:12,src:We})})]}),n("div",{class:"devtools-content-scroll scrollbar-thin-border flex-1 overflow-auto min-h-0 bg-background",children:p?n(Le,{app:p},p.id):n("div",{class:"flex flex-col items-center justify-center h-full gap-3 p-8 select-none text-muted-foreground",children:n("p",{class:"text-[0.8rem]",children:"Select a tool from the sidebar"})})})]})]})},"PipPanel"),ye=20,De=95,Ae=_((e,t,r)=>Math.min(Math.max(e,t),r),"clamp"),Mt=_(e=>{switch(e){case"bottom":return"bottom-14";case"left":return"left-14 top-4 bottom-4";case"right":return"right-14 top-4 bottom-4";case"top":return"top-14";default:return"bottom-14"}},"getPanelPositionClasses"),kt=_(e=>{switch(e){case"bottom":return"origin-[bottom_center]";case"left":return"origin-[left_center]";case"right":return"origin-[right_center]";case"top":return"origin-[top_center]";default:return"origin-[bottom_center]"}},"getOriginClass"),Tt=_((e,t)=>t?"opacity-100 scale-100":h("opacity-0 pointer-events-none scale-[0.99]",{bottom:"translate-y-2",left:"-translate-x-2",right:"translate-x-2",top:"-translate-y-2"}[e]??"translate-y-2"),"getVisibilityClasses"),zt=_(({activeAppId:e,apps:t,onClose:r,onToggleApp:i,panelVisible:o,position:a})=>{const[c,p]=l($(!1),"isRendered"),[f,L]=l($(!1),"isVisible"),[y,B]=l($(!1),"sidebarCollapsed"),[,P]=l($(0),"rerender"),{state:D,updateState:M}=Ce(),{resolvedTheme:F}=Ve(),j=l(b(null),"panelDivRef"),N=l(b(!1),"isResizingRef"),G=l(b({height:D.height,width:D.width}),"dimensionsRef"),w=l(b(null),"enteringFromRectRef"),O=l(b(null),"lastDockedRectRef"),U=l(b(!1),"previousIsFullscreenRef"),Y=l(b(!1),"isExitAnimatingRef"),C=l(b(null),"fsTimerRef"),x=D.viewMode==="fullscreen",H=D.viewMode==="wide",de=globalThis.window?.documentPictureInPicture!==void 0,Q=l(b(null),"pipWindowRef"),q=l(ee(()=>{if(x)return{};const s=globalThis.window?.innerWidth??1920,d=globalThis.window?.innerHeight??1080,u=`${G.current.height/100*d}px`;switch(a){case"bottom":case"top":return{height:u,left:"50%",transform:"translateX(-50%)",width:H?"calc(100vw - 2rem)":"min(calc(100vw - 2rem), 1280px)"};case"left":case"right":return{width:`${G.current.width/100*s}px`};default:return{height:u,left:"50%",transform:"translateX(-50%)",width:H?"calc(100vw - 2rem)":"min(calc(100vw - 2rem), 1280px)"}}},[x,H,a,P]),"panelSizeStyle");V(()=>{const s=_(u=>{if(!N.current||!j.current)return;const A=j.current.getBoundingClientRect(),z=window.innerWidth,X=window.innerHeight,K={...G.current};if(N.current.top){const I=Math.abs(A.bottom-u.clientY);K.height=Ae(I/X*100,ye,De)}else if(N.current.bottom){const I=Math.abs(u.clientY-A.top);K.height=Ae(I/X*100,ye,De)}else if(N.current.right){const I=Math.abs(u.clientX-A.left);K.width=Ae(I/z*100,ye,De)}else if(N.current.left){const I=Math.abs(A.right-u.clientX);K.width=Ae(I/z*100,ye,De)}G.current=K,P(I=>I+1)},"handleMouseMove"),d=_(()=>{N.current&&(M({height:G.current.height,width:G.current.width}),N.current=!1)},"handleMouseUp");return globalThis.addEventListener("mousemove",s),globalThis.addEventListener("mouseup",d),()=>{globalThis.removeEventListener("mousemove",s),globalThis.removeEventListener("mouseup",d)}},[M]),qe(()=>{const s=U.current;U.current=x,C.current!==null&&(clearTimeout(C.current),C.current=null);const d=j.current;if(d)if(x&&!s&&w.current){const u=w.current;w.current=null;const A=globalThis.window?.innerWidth??0,z=globalThis.window?.innerHeight??0;d.style.transition="clip-path 0.35s cubic-bezier(0.4, 0, 0.2, 1)",d.style.clipPath=`inset(${u.top}px ${A-u.right}px ${z-u.bottom}px ${u.left}px)`,requestAnimationFrame(()=>{d.style.clipPath="inset(0px 0px 0px 0px)",C.current=setTimeout(()=>{d.style.clipPath="",d.style.transition="",C.current=null},380)})}else!x&&s&&!Y.current&&(d.style.transition="none",d.style.clipPath="",requestAnimationFrame(()=>{d.style.transition=""}))},[x]),V(()=>{if(o){p(!0);const d=setTimeout(L,16,!0);return()=>clearTimeout(d)}L(!1);const s=setTimeout(p,220,!1);return()=>clearTimeout(s)},[o]);const g=_(async()=>{const s=globalThis.window?.documentPictureInPicture;if(s)try{const d=await s.requestWindow({height:600,width:900});if(Q.current=d,he){const A=d.document.createElement("style");A.textContent=Array.from(he.cssRules,z=>z.cssText).join(`
2
- `),d.document.head.append(A)}const u=d.document.createElement("div");u.style.cssText="width:100%;height:100%;display:flex;",F==="dark"&&(d.document.documentElement.classList.add("dark"),u.classList.add("dark")),d.document.body.style.cssText="margin:0;padding:0;height:100vh;",d.document.body.append(u),ke(n(Ct,{apps:t,initialActiveAppId:e,onClose:_(()=>{d.close()},"onClose")}),u),M({isPip:!0}),d.addEventListener("pagehide",()=>{M({isPip:!1}),Q.current=null})}catch(d){console.error("[dev-toolbar] PiP activation failed:",d)}},"activatePip");V(()=>{if(!o)return;const s=_(d=>{d.key==="Escape"&&r()},"handleKeyDown");return document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[o,r]);const T=l(ee(()=>t.find(s=>s.id===e),[t,e]),"activeApp");if(!c)return null;const E=_(s=>d=>{d.preventDefault(),N.current=s},"startResize");return m(Te,{children:[n("div",{"aria-hidden":"true",class:h("fixed inset-0 z-[2147483646]","transition-opacity duration-200",f&&!x?"opacity-100 pointer-events-auto":"opacity-0 pointer-events-none"),onClick:D.closeOnOutsideClick?r:void 0,role:"presentation"}),m("div",{"aria-label":"DevTools panel","aria-modal":"true",class:h("fixed z-[2147483647] pointer-events-auto antialiased font-mono",x?"inset-0":Mt(a),"bg-background overflow-hidden",x?"rounded-none border-0":"rounded-none border border-border","shadow-2xl","transition-panel",!x&&kt(a),Tt(a,f),"flex flex-row"),ref:j,role:"dialog",style:q,children:[!x&&m(Te,{children:[a!=="top"&&n("div",{"aria-hidden":"true",class:"absolute left-1.5 right-1.5 top-0 h-2.5 -mt-1 cursor-ns-resize z-10 hover:bg-foreground/10 transition-colors",onMouseDown:E({top:!0})}),a==="top"&&n("div",{"aria-hidden":"true",class:"absolute left-1.5 right-1.5 bottom-0 h-2.5 -mb-1 cursor-ns-resize z-10 hover:bg-foreground/10 transition-colors",onMouseDown:E({bottom:!0})}),a==="left"&&n("div",{"aria-hidden":"true",class:"absolute top-1.5 bottom-1.5 right-0 w-2.5 -mr-1 cursor-ew-resize z-10 hover:bg-foreground/10 transition-colors",onMouseDown:E({right:!0})}),a==="right"&&n("div",{"aria-hidden":"true",class:"absolute top-1.5 bottom-1.5 left-0 w-2.5 -ml-1 cursor-ew-resize z-10 hover:bg-foreground/10 transition-colors",onMouseDown:E({left:!0})})]}),m("nav",{"aria-label":"DevTools apps",class:h("flex flex-col shrink-0 overflow-hidden","transition-[width] duration-300 ease-[cubic-bezier(0.4,0,0.2,1)]","bg-accent border-r border-border/60",y?"w-12.5":"w-62.5"),children:[n("div",{class:h("flex items-center shrink-0 border-b border-border/50 h-12",y?"justify-center px-2":"px-3"),children:y?n("span",{"aria-hidden":"true",class:"text-primary font-black text-[0.8rem] select-none",children:"V"}):m("span",{class:"text-[0.6rem] font-bold uppercase tracking-[0.14em] text-muted-foreground select-none",children:[n("span",{"aria-hidden":"true",class:"text-primary/60 mr-1",children:"//"}),"DevTools"]})}),n("div",{class:"flex flex-col flex-1 overflow-y-auto p-2 gap-1 scrollbar-thin-border",children:t.filter(s=>s.component??s.init).map(s=>m("div",{class:"relative group/nav-item",children:[m("button",{"aria-label":s.name,"aria-pressed":e===s.id,class:h("relative flex items-center w-full h-10","border-0 border-l-2 cursor-pointer","transition-all duration-150",y?"justify-center px-0":"gap-2.5 px-3",e===s.id?"border-primary bg-primary/8 text-foreground":"border-transparent bg-transparent text-muted-foreground hover:bg-foreground/6 hover:text-foreground"),onClick:_(()=>{s.id!==e&&i(s.id).catch(console.error)},"onClick"),type:"button",children:[s.icon?n("span",{class:h("size-4 shrink-0 flex items-center justify-center [&_svg]:size-4",e===s.id?"opacity-100":"opacity-65 group-hover/nav-item:opacity-100"),dangerouslySetInnerHTML:{__html:s.icon}}):n("span",{class:"size-4.5 shrink-0 flex items-center justify-center text-[0.65rem] font-bold uppercase select-none",children:s.name.slice(0,2)}),!y&&n("span",{class:"text-[0.8125rem] font-medium truncate leading-none tracking-[-0.01em]",children:s.name})]}),s.notification.state&&n("span",{"aria-hidden":"true",class:h("pointer-events-none absolute top-1.5 rounded-full",y?"right-1.5":"right-2.5","size-1.5",s.notification.level==="error"?"bg-destructive":s.notification.level==="warning"?"bg-warning":"bg-info")}),y&&n("div",{class:h("absolute left-[calc(100%+0.5rem)] top-1/2 -translate-y-1/2","pointer-events-none z-50 whitespace-nowrap","opacity-0 -translate-x-1 group-hover/nav-item:opacity-100 group-hover/nav-item:translate-x-0","transition-all duration-200 ease-[cubic-bezier(0.23,1,0.32,1)]"),children:n("div",{class:"text-[0.7rem] font-medium bg-card/95 backdrop-blur-[0.625rem] text-foreground/80 px-2.5 py-1 border border-border shadow-md",children:s.name})})]},s.id))}),!y&&n("div",{class:"px-3 py-2.5 border-t border-border/40 shrink-0",children:m("span",{class:"text-[0.58rem] text-muted-foreground/50 leading-none select-none",children:[D.keybindings?.toggle??"Alt+Shift+D"," to toggle"]})})]}),m("div",{class:"flex-1 flex flex-col min-w-0 overflow-hidden bg-accent",children:[m("div",{class:"flex items-center justify-between gap-2 pr-2 min-h-12 shrink-0",children:[m("div",{class:"flex items-center gap-3 min-w-0",children:[n("button",{"aria-label":y?"Expand sidebar":"Collapse sidebar",class:h("flex items-center justify-center size-7 shrink-0","border-0 cursor-pointer bg-transparent","text-muted-foreground hover:text-foreground hover:bg-foreground/7","transition-colors duration-150"),onClick:_(()=>B(s=>!s),"onClick"),type:"button",children:n(te,{class:h("size-3.5 transition-transform duration-300",!y&&"rotate-180"),size:14,src:He})}),T?.icon&&n("span",{class:"size-5 flex items-center justify-center [&_svg]:size-5 shrink-0 text-foreground opacity-80",dangerouslySetInnerHTML:{__html:T.icon}}),m("span",{class:"flex items-center gap-1 text-[0.7rem] font-bold uppercase tracking-[0.06em] text-foreground truncate",children:[n("span",{"aria-hidden":"true",class:"text-primary/50 shrink-0",children:"["}),T?.name??"DevTools",n("span",{"aria-hidden":"true",class:"text-primary/50 shrink-0",children:"]"})]})]}),m("div",{class:"flex items-center gap-1 shrink-0",children:[(a==="bottom"||a==="top")&&!x&&n("button",{"aria-label":H?"Switch to container width":"Expand to full width",class:h("flex items-center justify-center size-8","cursor-pointer border-0 bg-transparent","text-muted-foreground hover:text-foreground hover:bg-foreground/7","transition-all duration-200 active:scale-90"),onClick:_(()=>M({viewMode:H?"default":"wide"}),"onClick"),title:H?"Container width":"Full width",type:"button",children:n(te,{size:13,src:H?Dt:wt})}),n("button",{"aria-label":x?"Exit fullscreen":"Enter fullscreen",class:h("flex items-center justify-center size-8","cursor-pointer border-0 bg-transparent","text-muted-foreground hover:text-foreground hover:bg-foreground/7","transition-all duration-200 active:scale-90"),onClick:_(()=>{if(x){const s=j.current,d=O.current;if(s&&d){const u=globalThis.window?.innerWidth??0,A=globalThis.window?.innerHeight??0,z=`inset(${d.top}px ${u-d.right}px ${A-d.bottom}px ${d.left}px)`;C.current!==null&&(clearTimeout(C.current),C.current=null),Y.current=!0,s.style.transition="clip-path 0.35s cubic-bezier(0.4, 0, 0.2, 1)",s.style.clipPath="inset(0px 0px 0px 0px)",requestAnimationFrame(()=>{s.style.clipPath=z,C.current=setTimeout(()=>{s.style.clipPath="",s.style.transition="",Y.current=!1,C.current=null,M({viewMode:"default"})},380)})}else M({viewMode:"default"})}else{if(j.current){const s=j.current.getBoundingClientRect();w.current=s,O.current=s}M({viewMode:"fullscreen"})}},"onClick"),title:x?"Exit fullscreen":"Fullscreen",type:"button",children:n(te,{size:13,src:x?yt:xt})}),de&&!x&&n("button",{"aria-label":"Open in Picture-in-Picture window",class:h("flex items-center justify-center size-8","cursor-pointer border-0 bg-transparent",D.isPip?"text-primary hover:bg-primary/7":"text-muted-foreground hover:text-foreground hover:bg-foreground/7","transition-all duration-200 active:scale-90"),onClick:_(()=>{g().then(()=>r()).catch(console.error)},"onClick"),title:"Open in floating window (PiP)",type:"button",children:n(te,{size:13,src:At})}),n("button",{"aria-label":"Close DevTools panel",class:h("flex items-center justify-center size-8","cursor-pointer border-0 bg-transparent","text-muted-foreground hover:text-foreground hover:bg-foreground/7","transition-all duration-200 active:scale-90"),onClick:r,title:"Close (Esc)",type:"button",children:n(te,{size:12,src:We})})]})]}),n("div",{class:"devtools-content-scroll scrollbar-thin-border flex-1 overflow-auto min-h-0 bg-background",children:T?n(Le,{app:T},T.id):m("div",{class:"flex flex-col items-center justify-center h-full gap-7 p-8 select-none",children:[m("div",{class:"flex flex-col items-center gap-3",children:[n("div",{class:"size-14 border border-primary/25 bg-primary/5 flex items-center justify-center",children:n(te,{class:"text-primary/45",size:26,src:vt})}),m("div",{class:"text-center space-y-1",children:[n("p",{class:"text-[0.8rem] font-medium text-foreground/65",children:"No tool selected"}),n("p",{class:"text-[0.7rem] text-muted-foreground",children:"Choose a tool from the sidebar to get started"})]})]}),t.length>0&&m("div",{class:"w-full max-w-[220px]",children:[m("p",{class:"text-[0.58rem] font-bold uppercase tracking-[0.12em] text-muted-foreground/60 mb-1.5",children:[n("span",{class:"text-primary/50",children:"// "}),"available"]}),n("div",{class:"flex flex-col gap-0.5",children:t.map(s=>m("button",{class:h("flex items-center gap-2.5 px-3 py-2","border border-border/40 bg-card/50","hover:border-primary/30 hover:bg-primary/4","cursor-pointer transition-all duration-150 text-left"),onClick:_(()=>i(s.id).catch(console.error),"onClick"),type:"button",children:[s.icon?n("span",{class:"size-3.5 shrink-0 flex items-center justify-center [&_svg]:size-3.5 text-muted-foreground",dangerouslySetInnerHTML:{__html:s.icon}}):n("span",{class:"size-3.5 text-[0.5rem] font-bold text-muted-foreground shrink-0 text-center",children:s.name.slice(0,2).toUpperCase()}),n("span",{class:"text-[0.75rem] font-medium text-muted-foreground",children:s.name})]},s.id))})]})]})})]})]})]})},"DevPanel"),Pt="data:image/svg+xml;charset=utf-8,%3Csvg%20class%3D%22lucide%20lucide-more-horizontal%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22currentColor%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%20%3E%20%3Ccircle%20cx%3D%2212%22%20cy%3D%2212%22%20r%3D%221%22%20%2F%3E%20%3Ccircle%20cx%3D%2219%22%20cy%3D%2212%22%20r%3D%221%22%20%2F%3E%20%3Ccircle%20cx%3D%225%22%20cy%3D%2212%22%20r%3D%221%22%20%2F%3E%20%3C%2Fsvg%3E",Ft="data:image/svg+xml;charset=utf-8,%3Csvg%20class%3D%22lucide%20lucide-alert-triangle%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22currentColor%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%20%3E%20%3Cpath%20d%3D%22m21.73%2018-8-14a2%202%200%200%200-3.48%200l-8%2014A2%202%200%200%200%204%2021h16a2%202%200%200%200%201.73-3%22%20%2F%3E%20%3Cpath%20d%3D%22M12%209v4%22%20%2F%3E%20%3Cpath%20d%3D%22M12%2017h.01%22%20%2F%3E%20%3C%2Fsvg%3E";var Et=Object.defineProperty,Me=R((e,t)=>Et(e,"name",{value:t,configurable:!0}),"n$1");const jt=Me(()=>{const[e,t]=l($(0),"errorCount"),[r,i]=l($(!1),"isOverlayOpen");if(V(()=>{const c=Me(()=>{const f=globalThis.__v_o_error_history,L=Array.isArray(f)?f.length:0;t(L);const y=globalThis.__v_o__current;if(y?.parentNode){const B=y.shadowRoot?.querySelector("#__v_o__root");i(!!B&&!B.classList.contains("hidden"))}else i(!1)},"sync"),p=setInterval(c,300);return c(),()=>clearInterval(p)},[]),e===0)return null;const o=Me(()=>{const c=globalThis.__v_o__current;if(!c?.parentNode)return;const p=c.shadowRoot?.querySelector("#__v_o__root");p?.classList.contains("hidden")?(p.classList.remove("hidden"),i(!0)):typeof c.close=="function"&&(c.close(),i(!1))},"handleClick"),a=`${e} error${e===1?"":"s"} – click to ${r?"hide":"show"} overlay`;return m(Te,{children:[n("div",{"aria-hidden":"true",class:"w-px h-5 bg-primary/20 shrink-0 mx-0.5"}),n("button",{"aria-label":a,class:h("relative flex justify-center items-center size-6","border-0","whitespace-nowrap no-underline p-0 m-0","cursor-pointer","bg-transparent text-destructive","transition-all duration-150","hover:bg-destructive/8","active:scale-[0.94]","group-data-[vertical]/panel:rotate-[-90deg]"),onClick:o,title:a,type:"button",children:m("div",{class:"relative size-6 select-none flex items-center justify-center",children:[n(te,{size:16,src:Ft}),n("span",{class:"absolute -top-0.5 -right-1 min-w-3.5 h-3.5 px-0.5 rounded-full bg-destructive text-white text-[9px] font-bold leading-none flex items-center justify-center border border-background",children:e>9?"9+":e})]})})]})},"ViteOverlayButton");var St=Object.defineProperty,ze=R((e,t)=>St(e,"name",{value:t,configurable:!0}),"n");const Rt=ze(()=>{const{toggleApp:e}=Fe();return n("button",{class:h("relative flex justify-center items-center size-6","border-0","whitespace-nowrap no-underline p-0 m-0","cursor-pointer","bg-transparent text-muted-foreground","transition-all duration-150","hover:bg-foreground/8 hover:text-foreground","active:scale-[0.94]","group-data-[vertical]/panel:rotate-[-90deg]"),"data-app-id":"dev-toolbar:more",onClick:ze(()=>{e("dev-toolbar:more").catch(t=>{console.error("[dev-toolbar] Failed to toggle more app:",t)})},"onClick"),title:"More apps",type:"button",children:n("div",{class:"relative size-6 flex items-center justify-center select-none",children:n(te,{size:16,src:Pt})})})},"MoreButton"),_t=ze(({customAppsToShow:e=3})=>{const{apps:t}=Fe(),r=t.filter(c=>c.builtIn),i=t.filter(c=>!c.builtIn),o=[...r,...i.slice(0,e)],a=i.slice(e);return n("div",{class:"flex items-center pointer-events-auto",id:"__v_dt__bar",children:m("div",{class:"flex flex-row items-center justify-start gap-1",id:"__v_dt__bar_container",children:[o.map(c=>n(bt,{app:c},c.id)),a.length>0&&n(Rt,{}),n(jt,{})]})})},"ToolbarBar"),Nt="data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMjQ4IDI5MSIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4gPGRlZnM+IDxsaW5lYXJHcmFkaWVudCBpZD0iYSIgZ3JhZGllbnRVbml0cz0ib2JqZWN0Qm91bmRpbmdCb3giIHgxPSIwIiB5MT0iMCIgeDI9IjEiIHkyPSIxIj4gPHN0b3Agb2Zmc2V0PSIwIiBzdG9wLWNvbG9yPSJyZWQiPiA8YW5pbWF0ZSBhdHRyaWJ1dGVOYW1lPSJzdG9wLWNvbG9yIiB2YWx1ZXM9InJlZDtwdXJwbGU7Ymx1ZTtyZWQ7IiBkdXI9IjIwcyIgcmVwZWF0Q291bnQ9ImluZGVmaW5pdGUiIC8+IDwvc3RvcD4gPHN0b3Agb2Zmc2V0PSIwLjUiIHN0b3AtY29sb3I9InB1cnBsZSI+IDxhbmltYXRlIGF0dHJpYnV0ZU5hbWU9InN0b3AtY29sb3IiIHZhbHVlcz0icHVycGxlO2JsdWU7cmVkO3B1cnBsZTsiIGR1cj0iMjBzIiByZXBlYXRDb3VudD0iaW5kZWZpbml0ZSIgLz4gPC9zdG9wPiA8c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9ImJsdWUiPiA8YW5pbWF0ZSBhdHRyaWJ1dGVOYW1lPSJzdG9wLWNvbG9yIiB2YWx1ZXM9ImJsdWU7cmVkO3B1cnBsZTtibHVlOyIgZHVyPSIyMHMiIHJlcGVhdENvdW50PSJpbmRlZmluaXRlIiAvPiA8L3N0b3A+IDxhbmltYXRlVHJhbnNmb3JtIGF0dHJpYnV0ZU5hbWU9ImdyYWRpZW50VHJhbnNmb3JtIiB0eXBlPSJyb3RhdGUiIGZyb209IjAgLjUgLjUiIHRvPSIzNjAgLjUgLjUiIGR1cj0iMTBzIiByZXBlYXRDb3VudD0iaW5kZWZpbml0ZSIgLz4gPC9saW5lYXJHcmFkaWVudD4gPGxpbmVhckdyYWRpZW50IGlkPSJvdmVybGF5R3JhZGllbnRBIiB4MT0iNjIiIHkxPSI0Mi4yMjUzIiB4Mj0iNjIiIHkyPSIyOTAuMjI1IiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSI+IDxzdG9wIG9mZnNldD0iMC4zNCIgc3RvcC1vcGFjaXR5PSIwLjUiIC8+IDxzdG9wIG9mZnNldD0iMSIgc3RvcC1jb2xvcj0id2hpdGUiIHN0b3Atb3BhY2l0eT0iMCIgLz4gPC9saW5lYXJHcmFkaWVudD4gPGxpbmVhckdyYWRpZW50IGlkPSJvdmVybGF5R3JhZGllbnRCIiB4MT0iMTg2IiB5MT0iMCIgeDI9IjE4NiIgeTI9IjI0OCIgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiPiA8c3RvcCBzdG9wLWNvbG9yPSJ3aGl0ZSIgc3RvcC1vcGFjaXR5PSIwIiAvPiA8c3RvcCBvZmZzZXQ9IjAuNjk1IiBzdG9wLW9wYWNpdHk9IjAuNSIgLz4gPC9saW5lYXJHcmFkaWVudD4gPC9kZWZzPiA8cGF0aCBkPSJNMCAxNjYuMjI1QzAgMjM0LjcwOSA1NS41MTY3IDI5MC4yMjUgMTI0IDI5MC4yMjVWNDIuMjI1M0M1NS41MTY3IDQyLjIyNTMgMCA5Ny43NDIgMCAxNjYuMjI1WiBNMjQ4IDEyNEMyNDggMTkyLjQ4MyAxOTIuNDgzIDI0OCAxMjQgMjQ4VjBDMTkyLjQ4MyAwIDI0OCA1NS41MTY3IDI0OCAxMjRaIiBmaWxsPSJ1cmwoI2EpIiAvPiA8cGF0aCBkPSJNMCAxNjYuMjI1QzAgMjM0LjcwOSA1NS41MTY3IDI5MC4yMjUgMTI0IDI5MC4yMjVWNDIuMjI1M0M1NS41MTY3IDQyLjIyNTMgMCA5Ny43NDIgMCAxNjYuMjI1WiIgZmlsbD0idXJsKCNvdmVybGF5R3JhZGllbnRBKSIgLz4gPHBhdGggZD0iTTI0OCAxMjRDMjQ4IDE5Mi40ODMgMTkyLjQ4MyAyNDggMTI0IDI0OFYwQzE5Mi40ODMgMCAyNDggNTUuNTE2NyAyNDggMTI0WiIgZmlsbD0idXJsKCNvdmVybGF5R3JhZGllbnRCKSIgLz4gPGNpcmNsZSBjeD0iMTI0IiBjeT0iMTQ3IiByPSI1MCIgZmlsbD0id2hpdGUiIC8+IDwvc3ZnPg==",Vt="data:image/svg+xml;charset=utf-8,%3Csvg%20class%3D%22lucide%20lucide-pin%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22currentColor%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%20%3E%20%3Cpath%20d%3D%22M12%2017v5%22%20%2F%3E%20%3Cpath%20d%3D%22M9%2010.76a2%202%200%200%201-1.11%201.79l-1.78.9A2%202%200%200%200%205%2015.24V16a1%201%200%200%200%201%201h12a1%201%200%200%200%201-1v-.76a2%202%200%200%200-1.11-1.79l-1.78-.9A2%202%200%200%201%2015%2010.76V7a1%201%200%200%201%201-1%202%202%200%200%200%200-4H8a2%202%200%200%200%200%204%201%201%200%200%201%201%201z%22%20%2F%3E%20%3C%2Fsvg%3E";var $t=Object.defineProperty,fe=R((e,t)=>$t(e,"name",{value:t,configurable:!0}),"o");const Ht=fe((e,t)=>{switch(t){case"left":return{left:`${e.right+10}px`,top:`${e.top+e.height/2}px`,transform:"translateY(-50%)"};case"right":return{right:`${globalThis.window?globalThis.window.innerWidth-e.left+10:0}px`,top:`${e.top+e.height/2}px`,transform:"translateY(-50%)"};case"top":return{left:`${e.left+e.width/2}px`,top:`${e.bottom+10}px`,transform:"translateX(-50%)"};default:return{bottom:`${globalThis.window?globalThis.window.innerHeight-e.top+10:0}px`,left:`${e.left+e.width/2}px`,transform:"translateX(-50%)"}}},"getTooltipStyle"),Wt=fe(({position:e})=>{const{hoveredApp:t,hoveredAppRect:r,pinTooltip:i,setHoveredApp:o}=Pe(),a=l(b(null),"overlayRef"),c=l(b(me()),"helpersRef"),[p,f]=l($(!1),"isRendered"),[L,y]=l($(!1),"isVisible"),B=!!(t?.tooltip&&r);if(V(()=>{if(B){f(!0);const N=setTimeout(y,16,!0);return()=>clearTimeout(N)}y(!1);const j=setTimeout(f,200,!1);return()=>clearTimeout(j)},[B]),!p||!t?.tooltip||!r)return null;const P=t.tooltip,D=Ht(r,e),M=e==="left"||e==="right",F=fe(()=>{const j=a.current?.getBoundingClientRect();j&&i(t,j.left,j.top),o(null)},"handlePin");return m("div",{"aria-label":`${t.name} quick preview`,class:h("fixed z-[2147483647] pointer-events-auto","antialiased toolbar-font","w-auto max-w-[300px]","bg-background border border-border shadow-2xl","transition-[opacity,transform] duration-200 ease-[cubic-bezier(0.23,1,0.32,1)]",L?"opacity-100 translate-y-0 scale-100":h("opacity-0 scale-[0.97]",e==="bottom"&&"translate-y-1",e==="top"&&"-translate-y-1",M&&"translate-x-[-2px]")),onMouseEnter:fe(()=>o(t,r),"onMouseEnter"),onMouseLeave:fe(()=>o(null),"onMouseLeave"),ref:a,role:"tooltip",style:D,children:[m("div",{class:"flex items-center justify-between gap-2 px-3 py-2 border-b border-border/60 bg-foreground/3",children:[m("div",{class:"flex items-center gap-2 min-w-0",children:[n("span",{"aria-hidden":"true",class:"size-1.5 rounded-full bg-primary shrink-0"}),n("span",{class:"text-[0.6rem] font-bold uppercase tracking-[0.1em] text-muted-foreground truncate",children:t.name})]}),n("button",{"aria-label":`Pin ${t.name} tooltip`,class:h("size-5 flex items-center justify-center shrink-0","border-0 bg-transparent cursor-pointer p-0","text-muted-foreground/60 hover:text-primary","transition-colors duration-150"),onClick:F,title:"Pin (keep visible)",type:"button",children:n(te,{size:11,src:Vt})})]}),n("div",{class:"p-3",children:n(P,{helpers:c.current})})]})},"AppTooltipOverlay");var Lt=Object.defineProperty,Ie=R((e,t)=>Lt(e,"name",{value:t,configurable:!0}),"s$1");const Bt=Ie(e=>{switch(e){case"left":return{left:"0",top:"50%",transform:"translateX(24px) translateY(-50%)"};case"right":return{left:"0",top:"50%",transform:"translateX(calc(-100% - 24px)) translateY(-50%)"};case"top":return{left:"50%",top:"0",transform:"translateX(-50%) translateY(24px)"};default:return{left:"50%",top:"0",transform:"translateX(-50%) translateY(calc(-100% - 24px))"}}},"getHintStyle"),Zt=Ie(({position:e})=>{const t="absolute w-2.5 h-2.5 bg-card border-border";switch(e){case"left":return n("div",{"aria-hidden":"true",class:h(t,"left-[-5px] top-1/2 -translate-y-1/2 rotate-45 border-b border-l")});case"right":return n("div",{"aria-hidden":"true",class:h(t,"right-[-5px] top-1/2 -translate-y-1/2 rotate-45 border-t border-r")});case"top":return n("div",{"aria-hidden":"true",class:h(t,"top-[-5px] left-1/2 -translate-x-1/2 rotate-45 border-t border-l")});default:return n("div",{"aria-hidden":"true",class:h(t,"bottom-[-5px] left-1/2 -translate-x-1/2 rotate-45 border-b border-r")})}},"Arrow"),Gt=[{icon:"⊙",text:"Click logo to open panel"},{icon:"⠿",text:"Drag pill to reposition"},{icon:"⌨",text:"Alt+Shift+D to toggle"}],Yt=Ie(({onDismiss:e,position:t})=>{const[r,i]=l($(!1),"visible"),o=l(b(null),"dismissTimeoutRef");V(()=>{const c=setTimeout(i,600,!0);return()=>clearTimeout(c)},[]),V(()=>()=>{o.current!==null&&(clearTimeout(o.current),o.current=null)},[]);const a=Ie(()=>{i(!1),o.current=setTimeout(e,180)},"handleDismiss");return m("div",{"aria-hidden":!r,"aria-label":"DevTools quick start",class:h("absolute pointer-events-auto","w-[240px]","bg-card border border-border","shadow-xl","p-3","font-mono","transition-all duration-200",r?"opacity-100 scale-100":"opacity-0 scale-95 pointer-events-none"),style:Bt(t),children:[n(Zt,{position:t}),m("p",{class:"flex items-center gap-1.5 mb-2.5",children:[n("span",{"aria-hidden":"true",class:"text-primary text-[0.6rem]",children:"▶"}),n("span",{class:"text-[0.6rem] font-bold uppercase tracking-[0.12em] text-foreground",children:"Quick start"})]}),n("ul",{class:"space-y-1.5 mb-3 list-none p-0 m-0",children:Gt.map(({icon:c,text:p})=>m("li",{class:"flex items-center gap-2 text-[0.7rem] text-muted-foreground",children:[n("span",{"aria-hidden":"true",class:"text-primary shrink-0 w-3 text-center leading-none",children:c}),p]},p))}),n("button",{class:h("w-full h-6 text-[0.6rem] font-bold uppercase tracking-[0.1em]","border border-primary/30 bg-primary/6","text-primary cursor-pointer","hover:bg-primary/12 hover:border-primary/50","transition-all duration-150 active:scale-[0.98]"),onClick:a,tabIndex:r?void 0:-1,type:"button",children:"Got it"})]})},"FirstVisitHint"),Ot="data:image/svg+xml;charset=utf-8,%3Csvg%20class%3D%22lucide%20lucide-pin-off%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22currentColor%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%20%3E%20%3Cpath%20d%3D%22M12%2017v5%22%20%2F%3E%20%3Cpath%20d%3D%22M15%209.34V7a1%201%200%200%201%201-1%202%202%200%200%200%200-4H7.89%22%20%2F%3E%20%3Cpath%20d%3D%22m2%202%2020%2020%22%20%2F%3E%20%3Cpath%20d%3D%22M9%209v1.76a2%202%200%200%201-1.11%201.79l-1.78.9A2%202%200%200%200%205%2015.24V16a1%201%200%200%200%201%201h11%22%20%2F%3E%20%3C%2Fsvg%3E";var Xt=Object.defineProperty,ue=R((e,t)=>Xt(e,"name",{value:t,configurable:!0}),"s");const Jt=ue(({onMove:e,onUnpin:t,pinned:r})=>{const i=l(b(null),"cardRef"),o=l(b(null),"headerRef"),a=l(b({x:r.initialX,y:r.initialY}),"posRef"),c=l(b(null),"dragRef"),p=l(ee(()=>me(),[]),"helpers"),f=l(b(p),"helpersRef"),L=l(b(e),"onMoveRef"),y=l(b(r.id),"pinnedIdRef");L.current=e,y.current=r.id,V(()=>{const D="transform 110ms cubic-bezier(0.25,0.46,0.45,0.94)",M=ue(j=>{if(!c.current||!i.current)return;const N=globalThis.window?.innerWidth??9999,G=globalThis.window?.innerHeight??9999,{cardH:w,cardW:O}=c.current,U=Math.min(80,O),Y=Math.min(36,w);let C=c.current.origX+(j.clientX-c.current.startX),x=c.current.origY+(j.clientY-c.current.startY);C=Math.max(U-O,Math.min(N-U,C)),x=Math.max(Y-w,Math.min(G-Y,x));const H=[0,N-O,U-O,N-U],de=[0,G-w,Y-w,G-Y];let Q=C,q=x;for(const g of H)if(Math.abs(C-g)<28){Q=g;break}for(const g of de)if(Math.abs(x-g)<28){q=g;break}i.current.style.transition=Q!==C||q!==x?D:"",i.current.style.transform=`translate(${Q}px, ${q}px)`,a.current={x:Q,y:q}},"handleMove"),F=ue(()=>{c.current&&(c.current=null,i.current&&(i.current.style.transition=""),o.current&&(o.current.style.cursor=""),L.current(y.current,a.current.x,a.current.y))},"handleUp");return document.addEventListener("mousemove",M),document.addEventListener("mouseup",F),()=>{document.removeEventListener("mousemove",M),document.removeEventListener("mouseup",F)}},[]);const B=r.app.tooltip;if(!B)return null;const P=ue(D=>{D.button===0&&(c.current={cardH:i.current?.offsetHeight??200,cardW:i.current?.offsetWidth??300,origX:a.current.x,origY:a.current.y,startX:D.clientX,startY:D.clientY},o.current&&(o.current.style.cursor="grabbing"),D.preventDefault())},"handleDragStart");return m("div",{"aria-label":`${r.app.name} pinned tooltip`,class:h("fixed z-[2147483647] pointer-events-auto antialiased toolbar-font","w-auto max-w-[300px]","bg-background border border-primary/40 shadow-2xl"),ref:i,style:{left:0,top:0,transform:`translate(${a.current.x}px, ${a.current.y}px)`},children:[m("div",{class:h("flex items-center justify-between gap-2 px-3 py-2","border-b border-primary/20 bg-primary/4","select-none cursor-grab"),onMouseDown:P,ref:o,children:[m("div",{class:"flex items-center gap-2 min-w-0",children:[n("span",{"aria-hidden":"true",class:"size-1.5 rounded-full bg-primary shrink-0"}),n("span",{class:"text-[0.6rem] font-bold uppercase tracking-[0.1em] text-primary/70 truncate",children:r.app.name})]}),n("button",{"aria-label":`Unpin ${r.app.name}`,class:h("size-5 flex items-center justify-center shrink-0","border-0 bg-transparent cursor-pointer p-0","text-muted-foreground/50 hover:text-destructive","transition-colors duration-150"),onClick:ue(()=>t(r.id),"onClick"),onMouseDown:ue(D=>D.stopPropagation(),"onMouseDown"),title:"Unpin",type:"button",children:n(te,{size:11,src:Ot})})]}),n("div",{class:"p-3",children:n(B,{helpers:f.current})})]})},"PinnedTooltipCard");var Ut=Object.defineProperty,le=R((e,t)=>Ut(e,"name",{value:t,configurable:!0}),"p");const Re="__v_dt__pinned_tooltips",Qt=le((e,t,r,i,o)=>{const a=t*i/100,c=r*o/100,p=i/4;switch(e){case"bottom":return a<p?"bottom-left":a>i-p?"bottom-right":"bottom-center";case"left":return c<o/2?"top-left":"bottom-left";case"right":return c<o/2?"top-right":"bottom-right";case"top":return a<p?"top-left":a>i-p?"top-right":"top-center";default:return"bottom-center"}},"computePlacement"),qt=le(({activeAppId:e,apps:t,customAppsToShow:r=3,onClearNotification:i,onRegisterApp:o,onSetNotification:a,onToggleApp:c,onUnregisterApp:p})=>{const f=l(b(null),"anchorRef"),L=l(b(null),"panelRef"),y=l(b(null),"leaveTimerRef"),{resolvedTheme:B}=Ve(),{state:P,updateState:D}=Ce(),{closePanel:M,panelVisible:F,togglePanelVisible:j}=dt(),{anchorStyle:N,bringUp:G,isDragging:w,isHidden:O,isVertical:U,onPointerDown:Y,panelStyle:C}=ft(L),[x,H]=l($(null),"hoveredApp"),[de,Q]=l($(null),"hoveredAppRect"),q=l(b(new Map),"pinPositionsRef"),g=ce(v=>{try{const S=v.map(k=>{const Z=q.current.get(k.id);return{appId:k.app.id,x:Z?.x??k.initialX,y:Z?.y??k.initialY}});localStorage.setItem(Re,JSON.stringify(S))}catch{}},[]),[T,E]=l($([]),"pinnedTooltips"),s=l(b([]),"pinnedTooltipsRef");s.current=T;const d=ce((v,S,k)=>{const Z=`${v.id}-${Date.now()}`;E(se=>{const be=[...se,{app:v,id:Z,initialX:S,initialY:k}];return g(be),be})},[g]),u=ce(v=>{E(S=>{const k=S.filter(Z=>Z.id!==v);return q.current.delete(v),g(k),k})},[g]),A=ce((v,S,k)=>{q.current.set(v,{x:S,y:k}),g(s.current)},[g]),z=l(b(null),"storedPinsRef"),X=l(b(new Set),"restoredAppIdsRef");V(()=>{if(t.length===0)return;if(z.current===null)try{const k=localStorage.getItem(Re);z.current=k?JSON.parse(k):[]}catch{z.current=[]}const v=z.current;if(v.length===0)return;const S=[];for(const k of v){if(X.current.has(k.appId))continue;const Z=t.find(se=>se.id===k.appId&&se.tooltip);Z&&(X.current.add(k.appId),S.push({app:Z,id:`${Z.id}-restored-${Date.now()}-${Math.random().toString(36).slice(2)}`,initialX:k.x,initialY:k.y}))}S.length>0&&E(k=>[...k,...S])},[t]),V(()=>()=>{y.current!==null&&clearTimeout(y.current)},[]);const K=ce((v,S)=>{y.current!==null&&(clearTimeout(y.current),y.current=null),v?(H(v),Q(S??null)):y.current=setTimeout(()=>{H(null),Q(null),y.current=null},180)},[]),I=l(b(t),"appsRef");I.current=t;const ae=l(b(F),"panelVisibleRef");ae.current=F;const ne=l(b(e),"activeAppIdRef");ne.current=e;const re=l(b(c),"onToggleAppRef");re.current=c;const oe=l(ee(()=>{const v=globalThis.window?.innerWidth??1920,S=globalThis.window?.innerHeight??1080;return Qt(P.position,P.left,P.top,v,S)},[P.left,P.position,P.top]),"placement"),J=ce(async v=>{const S=ae.current,k=ne.current,Z=I.current.find(se=>se.id===v);if(Z?.onClick??Z?.onDeactivate){await re.current(v);return}if(v===k&&S){await re.current(v),D({open:!1,viewMode:"default"});return}v!==k&&await re.current(v),S||D({open:!0})},[D]),pe={activeAppId:e,apps:t,clearNotification:i,hoveredApp:x,hoveredAppRect:de,isDragging:w,isVisible:F,pinnedTooltips:T,pinTooltip:d,placement:oe,registerApp:o,setDragging:le(()=>{},"setDragging"),setHoveredApp:K,setNotification:a,setPlacement:le(()=>{},"setPlacement"),setVisible:le(v=>D({open:v}),"setVisible"),toggleApp:J,unpinTooltip:u,unregisterApp:p};return!P.preferShowFloatingPanel&&!F?null:n($e.Provider,{value:pe,children:m("div",{class:h(B==="dark"&&"dark"),style:{display:"contents"},children:[m("div",{class:h("fixed z-[2147483647]","pointer-events-auto","origin-center","transition-[left_0.3s_cubic-bezier(0.4,0,0.2,1),top_0.3s_cubic-bezier(0.4,0,0.2,1)]","data-[dragging]:transition-none!","group","toolbar-font text-[13px]! leading-[1.6]! antialiased box-border [&_*]:box-border print:hidden",P.reduceMotion&&"transition-none! animate-none! [&_*]:transition-none! [&_*]:animate-none!"),"data-dragging":w?"":void 0,"data-placement":oe,id:"__v_dt__root",onMouseMove:G,ref:f,style:N,children:[m("div",{class:h("group/panel","absolute left-0 top-0","flex flex-row justify-start items-center","gap-1 p-1","box-border","overflow-hidden","rounded-none","text-foreground select-none",w?"cursor-grabbing":"cursor-grab","bg-background border-0",U?"shadow-pill-vertical!":"shadow-pill",O?"max-w-12!":"","transition-pill"),"data-vertical":U||void 0,onPointerDown:le(v=>{P.isFirstVisit&&D({isFirstVisit:!1}),Y(v)},"onPointerDown"),ref:L,style:C,children:[n("button",{"aria-label":"Toggle devtools panel",class:h("size-8 flex justify-center items-center shrink-0","cursor-pointer p-0 m-0 border-0","bg-transparent","transition-all duration-150","hover:bg-primary/8 active:scale-[0.95]","group-data-[vertical]/panel:rotate-[-90deg]",F?"opacity-100":"opacity-60"),onClick:le(v=>{v.stopPropagation(),P.isFirstVisit&&D({isFirstVisit:!1}),j()},"onClick"),title:"Toggle devtools panel",type:"button",children:n("img",{alt:"Visulima",class:"size-6",src:Nt})}),n("div",{"aria-hidden":"true",class:h("w-px h-5 bg-primary/20 shrink-0",O&&"hidden")}),n("div",{class:h("px-0.5",O&&"hidden"),children:n(_t,{customAppsToShow:r})})]}),P.isFirstVisit&&n(Yt,{onDismiss:le(()=>D({isFirstVisit:!1}),"onDismiss"),position:P.position})]}),n(zt,{activeAppId:e,apps:t,onClose:M,onToggleApp:c,panelVisible:F,position:P.position}),n(Wt,{position:P.position}),T.map(v=>n(Jt,{onMove:A,onUnpin:u,pinned:v},v.id))]})})},"ToolbarContainer");var Kt=Object.defineProperty,Be=R((e,t)=>Kt(e,"name",{value:t,configurable:!0}),"r");const er=Be((e,t)=>{const r=_e(),i=Xe();if(!i)throw new Error("Global hook not initialized");return{clearNotification(o){e.clearNotification(o)},async closeApp(){const o=e.getActiveApp();o&&await e.toggleApp(o.id)},getActiveApp(){return e.getActiveApp()?.id||null},getApps(){return e.getApps()},getSettings(){return Ne()},hide(){t.hide()},hook:i,notify(o,a){e.setNotification(o,!0,a)},async openApp(o){await e.toggleApp(o)},registerApp(o){e.registerApp(o)},rpc:new Proxy({},{get(o,a){return(...c)=>r.callServer(a,...c)}}),setAppActive(o,a){e.setAppActive(o,a)},show(){t.show()},toggle(){t.toggle()},unregisterApp(o){e.unregisterApp(o)},updateSettings(o){Oe(o)},version:"0.0.0"}},"createGlobalAPI"),tr=Be(e=>{globalThis.window!==void 0&&(globalThis.__VISULIMA_DEVTOOLS__=e)},"setupGlobalAPI");var rr=Object.defineProperty,W=R((e,t)=>rr(e,"name",{value:t,configurable:!0}),"i");class je extends HTMLElement{static{R(this,"DevToolbar")}static{W(this,"DevToolbar")}appManager;hasBeenInitialized=!1;customAppsToShow=3;renderRoot=null;constructor(){super(),this.attachShadow({mode:"open"}),this.appManager=new nt}connectedCallback(){this.hasBeenInitialized&&this.shadowRoot&&!this.renderRoot&&this.render()}disconnectedCallback(){this.renderRoot&&(ke(null,this.renderRoot),this.renderRoot=null)}init(){if(this.hasBeenInitialized)return;this.hasBeenInitialized=!0,je.injectFont();const t=Je(a=>{this.appManager.registerApp(a),this.render()},(a,c)=>{Ue().addEvent(a,c)}),r=er({clearNotification:W(a=>{this.appManager.clearNotification(a),this.render()},"clearNotification"),getActiveApp:W(()=>this.appManager.getActiveApp(),"getActiveApp"),getApps:W(()=>this.appManager.getAllApps(),"getApps"),registerApp:W(a=>{this.appManager.registerApp(a),this.render()},"registerApp"),setAppActive:W((a,c)=>{this.appManager.setAppActive(a,c),this.render()},"setAppActive"),setNotification:W((a,c,p)=>{this.appManager.setNotification(a,c,p),this.render()},"setNotification"),toggleApp:W(a=>this.appManager.toggleApp(a),"toggleApp"),unregisterApp:W(a=>{this.appManager.unregisterApp(a),this.render()},"unregisterApp")},{hide:W(()=>this.setToolbarVisible(!1),"hide"),show:W(()=>this.setToolbarVisible(!0),"show"),toggle:W(()=>{const a=this.isHidden();this.setToolbarVisible(!a)},"toggle")});tr(r),t.emit("devtools:init");const i=Ne(),o=this.appManager.getAllApps().find(a=>a.defaultOpen);o&&!this.appManager.getActiveApp()&&this.appManager.openApp(o.id).catch(a=>{console.error(`[dev-toolbar] Failed to auto-open defaultOpen app ${o.id}:`,a)}),this.render(),this.setupEventListeners(),i.defaultVisible&&this.setToolbarVisible(!0)}isHidden(){return this.shadowRoot.querySelector("#__v_dt__root")?.hasAttribute("data-hidden")??!0}setToolbarVisible(t){const r=this.shadowRoot.querySelector("#__v_dt__root");r&&(t?delete r.dataset.hidden:r.dataset.hidden=""),this.render()}registerApp(t,r=!1){this.appManager.registerApp(t,r),this.render()}getAppManager(){return this.appManager}static injectFont(){const t="__v_dt__font";if(document.getElementById(t))return;const r=document.createElement("link");r.rel="preconnect",r.href="https://fonts.googleapis.com",document.head.append(r);const i=document.createElement("link");i.rel="preconnect",i.href="https://fonts.gstatic.com",i.crossOrigin="anonymous",document.head.append(i);const o=document.createElement("link");o.id=t,o.rel="stylesheet",o.href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:ital,wght@0,100..800;1,100..800&display=swap",document.head.append(o)}render(){const t=this.appManager.getAllApps(),r=this.shadowRoot;he&&(r.adoptedStyleSheets=[he]);let i=r.querySelector("style");i||(i=document.createElement("style"),i.textContent=`
1
+ var Ye=Object.defineProperty;var _=(e,t)=>Ye(e,"name",{value:t,configurable:!0});import{createContext as Oe,render as ke}from"preact";import{createClientRPCContext as Re}from"../packem_shared/createClientRPCContext-DgRxrllw.js";import{updateSettings as Xe,loadSettings as Se}from"../packem_shared/loadSettings-hvjR4fcS.js";import{getGlobalHook as Je,setupGlobalHook as Ue}from"../packem_shared/setupGlobalHook-CCf9Logv.js";import ue from"../packem_shared/sharedToolbarStylesheet-JFwZE8kq.js";import{jsx as i,jsxs as g,Fragment as Te}from"preact/jsx-runtime";import{m as Qe}from"../packem_shared/store-DaUtLjf3.js";import{addHookName as l}from"preact/devtools";import{clsx as h}from"../packem_shared/clsx-wGlvpUfw.js";import{useContext as qe,useEffect as V,useMemo as re,useState as $,useRef as f,useCallback as de,useLayoutEffect as Ke}from"preact/hooks";import ie from"../packem_shared/Icon-B6UHkC0o.js";import{h as Ce}from"../packem_shared/use-frame-state-CxrlPUM5.js";import{_ as _e}from"../packem_shared/use-theme-zpm4zmqP.js";var et=Object.defineProperty,tt=_((e,t)=>et(e,"name",{value:t,configurable:!0}),"t$4");const me=tt(()=>{const e=Re();return{rpc:new Proxy({},{get(t,r){return(...o)=>e.callServer(r,...o)}})}},"createServerHelpers");var rt=Object.defineProperty,it=_((e,t)=>rt(e,"name",{value:t,configurable:!0}),"n$2");let nt=class{static{_(this,"p")}static{it(this,"AppManager")}apps=new Map;activeAppId=void 0;initializedApps=new Set;appCanvases=new Map;registerApp(t,r=!1){this.apps.has(t.id)&&(this.initializedApps.delete(t.id),this.appCanvases.delete(t.id),this.activeAppId===t.id&&(this.activeAppId=void 0));const o=new EventTarget,a={...t,active:!1,builtIn:r,eventTarget:o,notification:{state:!1},status:"ready"};this.apps.set(t.id,a)}async unregisterApp(t){const r=this.apps.get(t);if(r?.destroy&&this.initializedApps.has(t)){const o=this.appCanvases.get(t);if(o)try{await r.destroy(o.shadowRoot)}catch(a){console.error(`[dev-toolbar] destroy() failed for app ${t}:`,a)}}this.apps.delete(t),this.initializedApps.delete(t),this.appCanvases.delete(t),this.activeAppId===t&&(this.activeAppId=void 0)}getApp(t){return this.apps.get(t)}getAllApps(){return[...this.apps.values()]}getActiveApp(){if(this.activeAppId)return this.apps.get(this.activeAppId)}async toggleApp(t){const r=this.apps.get(t);if(!r)return!1;if(r.onClick??r.onDeactivate){const o=r.active;return r.active=!o,!o&&r.onClick?await r.onClick():o&&r.onDeactivate&&await r.onDeactivate(),!0}return r.active?await this.closeApp(t):this.activeAppId&&!await this.closeApp(this.activeAppId)?!1:await this.openApp(t)}setAppActive(t,r){const o=this.apps.get(t);o&&(o.active=r)}isAppInitialized(t){return this.initializedApps.has(t)}markAppInitialized(t){this.initializedApps.add(t)}async openApp(t){const r=this.apps.get(t);if(!r)return!1;if(r.active=!0,r.status="loading",this.activeAppId=t,r.init&&!this.isAppInitialized(t))try{const o=this.getAppCanvas(t);if(o){const a=me(),n=r.init(o.shadowRoot,r.eventTarget,a);n&&typeof n.then=="function"&&await n,this.markAppInitialized(t),r.status="ready"}else r.status="pending"}catch(o){return console.error(`[dev-toolbar] Failed to init app ${t}:`,o),r.status="error",r.active=!1,this.activeAppId=void 0,!1}else r.status="ready";return!0}async closeApp(t){const r=this.apps.get(t);if(!r||!r.active)return!1;if(r.beforeTogglingOff){const o=this.getAppCanvas(t);if(o)try{const a=r.beforeTogglingOff(o.shadowRoot);if(!(a&&typeof a.then=="function"?await a:a))return!1}catch(a){console.error(`[dev-toolbar] beforeTogglingOff() threw for app ${t}:`,a)}}return r.active=!1,this.activeAppId===t&&(this.activeAppId=void 0),!0}setNotification(t,r,o){const a=this.apps.get(t);a&&(a.notification={level:o,state:r})}clearNotification(t){const r=this.apps.get(t);r&&(r.notification={state:!1})}getAppCanvas(t){return this.appCanvases.get(t)}setAppCanvas(t,r){this.appCanvases.set(t,r)}};var ot=Object.defineProperty,at=_((e,t)=>ot(e,"name",{value:t,configurable:!0}),"t$3");const Ne=Oe(void 0),ze=at(()=>{const e=qe(Ne);if(!e)throw new Error("useToolbarContext must be used within ToolbarContext provider");return e},"useToolbarContext");var st=Object.defineProperty,lt=_((e,t)=>st(e,"name",{value:t,configurable:!0}),"t$2");const Ve=lt(()=>{const e=ze();return{activeAppId:e.activeAppId,apps:e.apps,clearNotification:e.clearNotification,registerApp:e.registerApp,setNotification:e.setNotification,toggleApp:e.toggleApp,unregisterApp:e.unregisterApp}},"useApps");var ct=Object.defineProperty,ge=_((e,t)=>ct(e,"name",{value:t,configurable:!0}),"s$1");const dt=ge((e,t)=>{const r=t.split("+"),o=r.at(-1)??"",a=r.includes("Alt"),n=r.includes("Shift"),c=r.includes("Control")||r.includes("Ctrl"),p=r.includes("Meta")||r.includes("Cmd");return(e.key===o||e.code===`Key${o.toUpperCase()}`)&&e.altKey===a&&e.shiftKey===n&&e.ctrlKey===c&&e.metaKey===p},"matchesBinding"),pt=ge(()=>{const{state:e,updateState:t}=Ce(),r=ge((n,c)=>{const p=c??!e.open;t({open:p,...p?{}:{viewMode:"default"}})},"togglePanelVisible"),o=ge(()=>{e.open&&t({open:!1,viewMode:"default"})},"closePanel");V(()=>{const n=e.keybindings?.toggle??"Alt+Shift+D",c=ge(p=>{dt(p,n)&&r()},"handleKeyDown");return globalThis.window?.addEventListener("keydown",c),()=>{globalThis.window?.removeEventListener("keydown",c)}},[e.open,e.keybindings?.toggle]);const a=l(re(()=>e.open,[e.open]),"panelVisibleValue: boolean");return{closePanel:o,panelVisible:a,togglePanelVisible:r}},"usePanelVisible");var ut=Object.defineProperty,Pe=_((e,t)=>ut(e,"name",{value:t,configurable:!0}),"e");const be=Pe((e,t,r)=>Math.min(Math.max(e,t),r),"clamp");Pe(()=>navigator.userAgent.includes("Safari")&&!navigator.userAgent.includes("Chrome"),"checkIsSafari");const xe=Pe(e=>typeof e=="string"?e.endsWith("px")?Number(e.slice(0,-2)):Number(e):e,"pixelToNumber");var ht=Object.defineProperty,K=_((e,t)=>ht(e,"name",{value:t,configurable:!0}),"h$1");const Ee=K(e=>e<5?0:e>95?100:Math.abs(e-50)<2?50:e,"snapToPoints"),gt=K(()=>{if(globalThis.window===void 0)return{bottom:0,left:0,right:0,top:0};const e=getComputedStyle(document.documentElement);return{bottom:xe(e.getPropertyValue("env(safe-area-inset-bottom)")||"0"),left:xe(e.getPropertyValue("env(safe-area-inset-left)")||"0"),right:xe(e.getPropertyValue("env(safe-area-inset-right)")||"0"),top:xe(e.getPropertyValue("env(safe-area-inset-top)")||"0")}},"getSafeAreaInsets"),ft=K(()=>{const[e,t]=l($(()=>({height:globalThis.window?.innerHeight??1080,width:globalThis.window?.innerWidth??1920})),"size");return V(()=>{const r=K(()=>{t({height:globalThis.window?.innerHeight??1080,width:globalThis.window?.innerWidth??1920})},"updateSize");return r(),globalThis.window?.addEventListener("resize",r),()=>{globalThis.window?.removeEventListener("resize",r)}},[]),e},"useWindowSize"),mt=K(e=>{const{state:t,updateState:r}=Ce(),{height:o,width:a}=ft(),[n,c]=l($(!1),"isHovering"),[p,u]=l($(!1),"isDragging"),[j,z]=l($(!1),"isViteOverlayOpen"),I=l(f({x:0,y:0}),"draggingOffsetRef"),P=l(f({x:0,y:0}),"mousePositionRef"),H=l(f(void 0),"timerRef"),C=l(f(void 0),"capturedPointerIdRef"),Y=l(f(!1),"isDraggingRef"),E=l(f(a),"windowWidthRef"),N=l(f(o),"windowHeightRef"),L=l(f(r),"updateStateRef");V(()=>{E.current=a,N.current=o},[a,o]),V(()=>{L.current=r},[r]);const[w,U]=l($(()=>({bottom:10,left:10,right:10,top:10})),"panelMargins");V(()=>{const v=gt();U({bottom:v.bottom+10,left:v.left+10,right:v.right+10,top:v.top+10})},[]),V(()=>{const v=K(()=>{const S=globalThis.__v_o__current;if(S?.parentNode){const s=S.shadowRoot?.querySelector("#__v_o__root");z(!!s&&!s.classList.contains("hidden"))}else z(!1)},"check"),k=setInterval(v,300);return v(),()=>clearInterval(k)},[]);const ee=de(v=>{v.preventDefault(),v.stopPropagation(),u(!0),Y.current=!0;const k=e.current;if(k){const{height:S,left:s,top:d,width:m}=k.getBoundingClientRect();I.current={x:v.clientX-s-m/2,y:v.clientY-d-S/2};const b=v.target;try{b&&b.setPointerCapture?(b.setPointerCapture(v.pointerId),C.current=v.pointerId):k.setPointerCapture&&(k.setPointerCapture(v.pointerId),C.current=v.pointerId)}catch(F){console.warn("Failed to capture pointer:",F)}document.body.style.cursor="grabbing",document.body.style.userSelect="none"}},[e]),O=de(()=>{c(!0),!(t.minimizePanelInactive<0)&&(H.current&&clearTimeout(H.current),H.current=setTimeout(()=>{c(!1)},t.minimizePanelInactive||5e3))},[t.minimizePanelInactive]);V(()=>{O()},[O]),V(()=>{const v=K(()=>{if(C.current!==void 0){try{const b=e.current;b&&C.current!==void 0&&b.releasePointerCapture(C.current)}catch{}C.current=void 0}},"releaseCapture"),k=K(()=>{Y.current&&(u(!1),Y.current=!1,document.body.style.cursor="",document.body.style.userSelect="",v())},"finishDrag"),S=K(b=>{k()},"handlePointerUp"),s=K(b=>{k()},"handlePointerCancel"),d=K(()=>{Y.current&&(u(!1),Y.current=!1,C.current=void 0,document.body.style.cursor="",document.body.style.userSelect="")},"handleLostPointerCapture"),m=K(b=>{if(!Y.current)return;b.preventDefault();const F=E.current,Q=N.current,G=F/2,y=Q/2,se=b.clientX,q=b.clientY,ne=se-I.current.x,oe=q-I.current.y;P.current={x:ne,y:oe};const le=Math.max(0,Math.min(se,F)),x=Math.max(0,Math.min(q,Q)),T=Math.atan2(x-y,le-G),A=70,X=Math.atan2(0-y+A,0-G),ae=Math.atan2(0-y+A,F-G),ve=Math.atan2(Q-A-y,0-G),je=Math.atan2(Q-A-y,F-G);let he;T>=X&&T<=ae?he="top":T>=ae&&T<=je?he="right":T>=je&&T<=ve?he="bottom":he="left";const Ze=Math.max(0,Math.min(100,ne/F*100)),Ge=Math.max(0,Math.min(100,oe/Q*100));L.current({left:Ee(Ze),position:he,top:Ee(Ge)})},"handlePointerMove");return document.addEventListener("pointermove",m,{capture:!0,passive:!1}),document.addEventListener("pointerup",S,{capture:!0}),document.addEventListener("pointercancel",s,{capture:!0}),document.addEventListener("lostpointercapture",d,{capture:!0}),()=>{document.removeEventListener("pointermove",m,{capture:!0}),document.removeEventListener("pointerup",S,{capture:!0}),document.removeEventListener("pointercancel",s,{capture:!0}),document.removeEventListener("lostpointercapture",d,{capture:!0})}},[]);const M=l(re(()=>t.position==="left"||t.position==="right",[t.position]),"isVertical"),D=l(re(()=>{if(t.minimizePanelInactive<0)return!1;if(t.minimizePanelInactive===0)return!0;const v=globalThis.window!==void 0&&("ontouchstart"in globalThis.window||(globalThis.navigator?.maxTouchPoints??0)>0);return!p&&!t.open&&!n&&!v&&t.minimizePanelInactive>0&&!j},[p,t.open,t.minimizePanelInactive,n,j]),"isHidden"),B=l(re(()=>{const v=e.current,k=(v?.clientWidth??0)/2,S=(v?.clientHeight??0)/2,s=M?S:k,d=M?k:S,m=t.left*a/100,b=t.top*o/100;switch(t.position){case"left":return{left:w.left+s-(D?30:0),top:be(b,d+w.top,o-d-w.bottom)};case"right":return{left:a-w.right-s+(D?15:0)-(D?0:10),top:be(b,d+w.top,o-d-w.bottom)};case"top":return{left:be(m,s+w.left,a-s-w.right),top:w.top+d-(D?30:0)};default:return{left:be(m,s+w.left,a-s-w.right),top:o-w.bottom-d+(D?30:0)}}},[t.left,t.open,t.position,t.top,o,a,w,e,D,M]),"anchorPos"),te=l(re(()=>({left:`${B.left}px`,top:`${B.top}px`,transition:p?"none":"left 0.3s ease, top 0.3s ease"}),[B,p]),"anchorStyle"),J=l(re(()=>{const v=e.current,k=(v?.clientWidth??0)/2,S=(v?.clientHeight??0)/2,s=M?S:k,d=M?k:S,m={bottom:w.bottom+d,left:w.left+s,right:w.right+s,top:w.top+d},b=m.left+m.right,F=m.top+m.bottom,Q=a-b,G=o-F,y={height:`min(${t.height}vh, calc(100vh - ${F}px))`,pointerEvents:p?"none":"auto",width:`min(${t.width}vw, calc(100vw - ${b}px))`,zIndex:"-1"},se=B,q=Math.min(Q,t.width*a/100),ne=Math.min(G,t.height*o/100),oe=se?.left??0,le=se?.top??0;switch(t.position){case"bottom":case"top":{y.left="0",y.transform="translate(-50%, 0)",oe-m.left<q/2?y.left=`${q/2-oe+m.left}px`:a-oe-m.right<q/2&&(y.left=`${a-oe-q/2-m.right}px`);break}default:{y.top="0",y.transform="translate(0, -50%)",le-m.top<ne/2?y.top=`${ne/2-le+m.top}px`:o-le-m.bottom<ne/2&&(y.top=`${o-le-ne/2-m.bottom}px`);break}}switch(t.position){case"left":{y.left="0";break}case"right":{y.right="0";break}case"top":{y.top="0";break}default:{y.bottom="0";break}}return y},[B,p,w,t.height,t.position,t.width,o,a,e,M]),"iframeStyle"),Z=l(re(()=>{const v={transform:M?"translate(-50%, -50%) rotate(90deg)":"translate(-50%, -50%)"};return p&&(v.transition="none !important"),v},[p,M]),"panelStyle");return{anchorStyle:te,bringUp:O,iframeStyle:J,isDragging:p,isHidden:D,isVertical:M,onPointerDown:ee,panelStyle:Z}},"usePosition");var vt=Object.defineProperty,we=_((e,t)=>vt(e,"name",{value:t,configurable:!0}),"t$1");const bt=we(({app:e})=>{const{toggleApp:t}=Ve(),{isVisible:r,setHoveredApp:o}=ze(),a=l(f(null),"buttonRef"),n=we(()=>{o(void 0),t(e.id).catch(u=>{console.error(`[dev-toolbar] Failed to toggle app ${e.id}:`,u)})},"handleClick"),c=we(()=>{!e.tooltip||r||o(e,a.current?.getBoundingClientRect())},"handleMouseEnter"),p=we(()=>{e.tooltip&&o(void 0)},"handleMouseLeave");return i("button",{"aria-label":e.name,class:h("relative flex justify-center items-center","border-0","whitespace-nowrap no-underline p-0 m-0","cursor-pointer","bg-transparent text-muted-foreground","transition-all duration-150","hover:bg-primary/8 hover:text-primary","active:scale-[0.94]",e.active&&"bg-primary/12 text-primary","group-data-[vertical]/panel:rotate-[-90deg]"),"data-app-id":e.id,onClick:n,onMouseEnter:c,onMouseLeave:p,ref:a,title:e.tooltip?void 0:e.name,type:"button",children:g("div",{class:"relative size-6 select-none flex items-center justify-center",children:[i("div",{class:"size-6 flex items-center justify-center [&_svg]:size-4.5",dangerouslySetInnerHTML:{__html:e.icon}}),e.notification.state&&i("span",{class:h("absolute -top-1 -right-1 size-1.5 rounded-full border border-background",e.notification.level==="error"&&"bg-destructive",e.notification.level==="warning"&&"bg-warning",(!e.notification.level||e.notification.level==="info")&&"bg-info"),"data-level":e.notification.level||"info"})]})})},"AppButton"),$e="data:image/svg+xml;charset=utf-8,%3Csvg%20class%3D%22lucide%20lucide-chevron-right%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22currentColor%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%20%3E%20%3Cpath%20d%3D%22m9%2018%206-6-6-6%22%20%2F%3E%20%3C%2Fsvg%3E",xt="data:image/svg+xml;charset=utf-8,%3Csvg%20class%3D%22lucide%20lucide-layers%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22currentColor%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%20%3E%20%3Cpath%20d%3D%22M12.83%202.18a2%202%200%200%200-1.66%200L2.6%206.08a1%201%200%200%200%200%201.83l8.58%203.91a2%202%200%200%200%201.66%200l8.58-3.9a1%201%200%200%200%200-1.83z%22%20%2F%3E%20%3Cpath%20d%3D%22M2%2012a1%201%200%200%200%20.58.91l8.6%203.91a2%202%200%200%200%201.65%200l8.58-3.9A1%201%200%200%200%2022%2012%22%20%2F%3E%20%3Cpath%20d%3D%22M2%2017a1%201%200%200%200%20.58.91l8.6%203.91a2%202%200%200%200%201.65%200l8.58-3.9A1%201%200%200%200%2022%2017%22%20%2F%3E%20%3C%2Fsvg%3E",wt="data:image/svg+xml;charset=utf-8,%3Csvg%20class%3D%22lucide%20lucide-maximize%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22currentColor%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%20%3E%20%3Cpath%20d%3D%22M8%203H5a2%202%200%200%200-2%202v3%22%20%2F%3E%20%3Cpath%20d%3D%22M21%208V5a2%202%200%200%200-2-2h-3%22%20%2F%3E%20%3Cpath%20d%3D%22M3%2016v3a2%202%200%200%200%202%202h3%22%20%2F%3E%20%3Cpath%20d%3D%22M16%2021h3a2%202%200%200%200%202-2v-3%22%20%2F%3E%20%3C%2Fsvg%3E",yt="data:image/svg+xml;charset=utf-8,%3Csvg%20class%3D%22lucide%20lucide-maximize-2%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22currentColor%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%20%3E%20%3Cpath%20d%3D%22M15%203h6v6%22%20%2F%3E%20%3Cpath%20d%3D%22m21%203-7%207%22%20%2F%3E%20%3Cpath%20d%3D%22m3%2021%207-7%22%20%2F%3E%20%3Cpath%20d%3D%22M9%2021H3v-6%22%20%2F%3E%20%3C%2Fsvg%3E",Dt="data:image/svg+xml;charset=utf-8,%3Csvg%20class%3D%22lucide%20lucide-minimize%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22currentColor%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%20%3E%20%3Cpath%20d%3D%22M8%203v3a2%202%200%200%201-2%202H3%22%20%2F%3E%20%3Cpath%20d%3D%22M21%208h-3a2%202%200%200%201-2-2V3%22%20%2F%3E%20%3Cpath%20d%3D%22M3%2016h3a2%202%200%200%201%202%202v3%22%20%2F%3E%20%3Cpath%20d%3D%22M16%2021v-3a2%202%200%200%201%202-2h3%22%20%2F%3E%20%3C%2Fsvg%3E",At="data:image/svg+xml;charset=utf-8,%3Csvg%20class%3D%22lucide%20lucide-minimize-2%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22currentColor%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%20%3E%20%3Cpath%20d%3D%22m14%2010%207-7%22%20%2F%3E%20%3Cpath%20d%3D%22M20%2010h-6V4%22%20%2F%3E%20%3Cpath%20d%3D%22m3%2021%207-7%22%20%2F%3E%20%3Cpath%20d%3D%22M4%2014h6v6%22%20%2F%3E%20%3C%2Fsvg%3E",It="data:image/svg+xml;charset=utf-8,%3Csvg%20class%3D%22lucide%20lucide-picture-in-picture-2%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22currentColor%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%20%3E%20%3Cpath%20d%3D%22M21%209V6a2%202%200%200%200-2-2H4a2%202%200%200%200-2%202v10c0%201.1.9%202%202%202h4%22%20%2F%3E%20%3Crect%20width%3D%2210%22%20height%3D%227%22%20x%3D%2212%22%20y%3D%2213%22%20rx%3D%222%22%20%2F%3E%20%3C%2Fsvg%3E",He="data:image/svg+xml;charset=utf-8,%3Csvg%20class%3D%22lucide%20lucide-x%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22currentColor%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%20%3E%20%3Cpath%20d%3D%22M18%206%206%2018%22%20%2F%3E%20%3Cpath%20d%3D%22m6%206%2012%2012%22%20%2F%3E%20%3C%2Fsvg%3E";var Ct=Object.defineProperty,R=_((e,t)=>Ct(e,"name",{value:t,configurable:!0}),"a");const Le=R(({app:e})=>{const t=l(f(null),"contentRef"),r=l(f(!1),"initializedRef"),o=l(f(me()),"helpersRef");return V(()=>{if(!t.current||r.current||e.component||e.view?.type==="iframe")return;const a=t.current;if(e.init){const n=document.createElement("div");n.style.cssText="width:100%;height:100%;",a.append(n);const c=n.attachShadow({mode:"open"});ue&&(c.adoptedStyleSheets=[ue]);const p=me(),u=e.init(c,e.eventTarget,p);return u&&typeof u.then=="function"?u.then(()=>{r.current=!0}).catch(j=>{console.error(`[dev-toolbar] Failed to init app ${e.id}:`,j)}):r.current=!0,()=>{for(;a.firstChild;)a.firstChild.remove();r.current=!1}}},[e]),e.view?.type==="iframe"?i("iframe",{class:"w-full h-full block border-0",src:e.view.src,title:e.name}):e.component?i(e.component,{eventTarget:e.eventTarget,helpers:o.current}):i("div",{class:"w-full h-full",ref:t})},"AppContent"),We=R(e=>e==="error"?"bg-destructive":e==="warning"?"bg-warning":"bg-info","getNotificationColor"),Mt=R(({apps:e,initialActiveAppId:t,onClose:r})=>{const[o,a]=l($(t),"activeAppId"),[n,c]=l($(!1),"sidebarCollapsed"),p=l(re(()=>e.find(u=>u.id===o),[e,o]),"activeApp");return g("div",{class:"flex flex-row w-full h-full bg-background font-mono antialiased text-foreground",children:[g("nav",{"aria-label":"DevTools apps",class:h("flex flex-col shrink-0 bg-accent border-r border-border/60","transition-[width] duration-300 ease-[cubic-bezier(0.4,0,0.2,1)]",n?"w-12.5":"w-62.5"),children:[i("div",{class:h("flex items-center shrink-0 border-b border-border/50 h-12",n?"justify-center px-2":"px-3"),children:n?i("span",{"aria-hidden":"true",class:"text-primary font-black text-[0.8rem] select-none",children:"V"}):g("span",{class:"text-[0.6rem] font-bold uppercase tracking-[0.14em] text-muted-foreground select-none",children:[i("span",{"aria-hidden":"true",class:"text-primary/60 mr-1",children:"//"}),"DevTools"]})}),i("div",{class:"flex flex-col flex-1 overflow-y-auto p-2 gap-1 scrollbar-thin-border",children:e.filter(u=>u.component||u.init||u.view?.type==="iframe").map(u=>g("div",{class:"relative group/nav-item",children:[g("button",{"aria-label":u.name,"aria-pressed":o===u.id,class:h("relative flex items-center w-full h-10","border-0 border-l-2 cursor-pointer","transition-all duration-150",n?"justify-center px-0":"gap-2.5 px-3",o===u.id?"border-primary bg-primary/8 text-foreground":"border-transparent bg-transparent text-muted-foreground hover:bg-foreground/6 hover:text-foreground"),onClick:R(()=>a(u.id),"onClick"),type:"button",children:[u.icon?i("span",{class:h("size-4 shrink-0 flex items-center justify-center [&_svg]:size-4",o===u.id?"opacity-100":"opacity-65 group-hover/nav-item:opacity-100"),dangerouslySetInnerHTML:{__html:u.icon}}):i("span",{class:"size-4.5 shrink-0 flex items-center justify-center text-[0.65rem] font-bold uppercase select-none",children:u.name.slice(0,2)}),!n&&i("span",{class:"text-[0.8125rem] font-medium truncate leading-none tracking-[-0.01em]",children:u.name})]}),u.notification.state&&i("span",{"aria-hidden":"true",class:h("pointer-events-none absolute top-1.5 rounded-full",n?"right-1.5":"right-2.5","size-1.5",We(u.notification.level))}),n&&i("div",{class:h("absolute left-[calc(100%+0.5rem)] top-1/2 -translate-y-1/2","pointer-events-none z-50 whitespace-nowrap","opacity-0 -translate-x-1 group-hover/nav-item:opacity-100 group-hover/nav-item:translate-x-0","transition-all duration-200 ease-[cubic-bezier(0.23,1,0.32,1)]"),children:i("div",{class:"text-[0.7rem] font-medium bg-card/95 backdrop-blur-[0.625rem] text-foreground/80 px-2.5 py-1 border border-border shadow-md",children:u.name})})]},u.id))})]}),g("div",{class:"flex-1 flex flex-col min-w-0 overflow-hidden bg-accent",children:[g("div",{class:"flex items-center justify-between gap-2 pr-2 min-h-12 shrink-0",children:[g("div",{class:"flex items-center gap-3 min-w-0",children:[i("button",{"aria-label":n?"Expand sidebar":"Collapse sidebar",class:h("flex items-center justify-center size-7 shrink-0","border-0 cursor-pointer bg-transparent","text-muted-foreground hover:text-foreground hover:bg-foreground/7","transition-colors duration-150"),onClick:R(()=>c(u=>!u),"onClick"),type:"button",children:i(ie,{class:h("size-3.5 transition-transform duration-300",!n&&"rotate-180"),size:14,src:$e})}),p?.icon&&i("span",{class:"size-5 flex items-center justify-center [&_svg]:size-5 shrink-0 text-foreground opacity-80",dangerouslySetInnerHTML:{__html:p.icon}}),g("span",{class:"flex items-center gap-1 text-[0.7rem] font-bold uppercase tracking-[0.06em] text-foreground truncate",children:[i("span",{"aria-hidden":"true",class:"text-primary/50 shrink-0",children:"["}),p?.name??"DevTools",i("span",{"aria-hidden":"true",class:"text-primary/50 shrink-0",children:"]"})]})]}),i("button",{"aria-label":"Close floating window",class:h("flex items-center justify-center size-8","cursor-pointer border-0 bg-transparent","text-muted-foreground hover:text-foreground hover:bg-foreground/7","transition-all duration-200 active:scale-90"),onClick:r,title:"Close floating window",type:"button",children:i(ie,{size:12,src:He})})]}),i("div",{class:"devtools-content-scroll scrollbar-thin-border flex-1 overflow-auto min-h-0 bg-background",children:p?i(Le,{app:p},p.id):i("div",{class:"flex flex-col items-center justify-center h-full gap-3 p-8 select-none text-muted-foreground",children:i("p",{class:"text-[0.8rem]",children:"Select a tool from the sidebar"})})})]})]})},"PipPanel"),ye=20,De=95,Ae=R((e,t,r)=>Math.min(Math.max(e,t),r),"clamp"),kt=R(e=>{switch(e){case"bottom":return"bottom-14";case"left":return"left-14 top-4 bottom-4";case"right":return"right-14 top-4 bottom-4";case"top":return"top-14";default:return"bottom-14"}},"getPanelPositionClasses"),Tt=R(e=>{switch(e){case"bottom":return"origin-[bottom_center]";case"left":return"origin-[left_center]";case"right":return"origin-[right_center]";case"top":return"origin-[top_center]";default:return"origin-[bottom_center]"}},"getOriginClass"),zt=R((e,t)=>t?"opacity-100 scale-100":h("opacity-0 pointer-events-none scale-[0.99]",{bottom:"translate-y-2",left:"-translate-x-2",right:"translate-x-2",top:"-translate-y-2"}[e]??"translate-y-2"),"getVisibilityClasses"),Pt=R(({activeAppId:e,apps:t,onClose:r,onToggleApp:o,panelVisible:a,position:n})=>{const[c,p]=l($(!1),"isRendered"),[u,j]=l($(!1),"isVisible"),[z,I]=l($(!1),"sidebarCollapsed"),[,P]=l($(0),"rerender"),{state:H,updateState:C}=Ce(),{resolvedTheme:Y}=_e(),E=l(f(null),"panelDivRef"),N=l(f(!1),"isResizingRef"),L=l(f({height:H.height,width:H.width}),"dimensionsRef"),w=l(f(void 0),"enteringFromRectRef"),U=l(f(void 0),"lastDockedRectRef"),ee=l(f(!1),"previousIsFullscreenRef"),O=l(f(!1),"isExitAnimatingRef"),M=l(f(void 0),"fsTimerRef"),D=H.viewMode==="fullscreen",B=H.viewMode==="wide",te=globalThis.window?.documentPictureInPicture!==void 0,J=l(f(void 0),"pipWindowRef"),Z=l(re(()=>{if(D)return{};const s=globalThis.window?.innerWidth??1920,d=globalThis.window?.innerHeight??1080,m=`${L.current.height/100*d}px`;return n==="left"||n==="right"?{width:`${L.current.width/100*s}px`}:{height:m,left:"50%",transform:"translateX(-50%)",width:B?"calc(100vw - 2rem)":"min(calc(100vw - 2rem), 1280px)"}},[D,B,n,P]),"panelSizeStyle");V(()=>{const s=R(m=>{if(!N.current||!E.current)return;const b=E.current.getBoundingClientRect(),F=window.innerWidth,Q=window.innerHeight,G={...L.current};if(N.current.top){const y=Math.abs(b.bottom-m.clientY);G.height=Ae(y/Q*100,ye,De)}else if(N.current.bottom){const y=Math.abs(m.clientY-b.top);G.height=Ae(y/Q*100,ye,De)}else if(N.current.right){const y=Math.abs(m.clientX-b.left);G.width=Ae(y/F*100,ye,De)}else if(N.current.left){const y=Math.abs(b.right-m.clientX);G.width=Ae(y/F*100,ye,De)}L.current=G,P(y=>y+1)},"handleMouseMove"),d=R(()=>{N.current&&(C({height:L.current.height,width:L.current.width}),N.current=!1)},"handleMouseUp");return globalThis.addEventListener("mousemove",s),globalThis.addEventListener("mouseup",d),()=>{globalThis.removeEventListener("mousemove",s),globalThis.removeEventListener("mouseup",d)}},[C]),Ke(()=>{const s=ee.current;ee.current=D,M.current!==void 0&&(clearTimeout(M.current),M.current=void 0);const d=E.current;if(d)if(D&&!s&&w.current){const m=w.current;w.current=void 0;const b=globalThis.window?.innerWidth??0,F=globalThis.window?.innerHeight??0;d.style.transition="clip-path 0.35s cubic-bezier(0.4, 0, 0.2, 1)",d.style.clipPath=`inset(${m.top}px ${b-m.right}px ${F-m.bottom}px ${m.left}px)`,requestAnimationFrame(()=>{d.style.clipPath="inset(0px 0px 0px 0px)",M.current=setTimeout(()=>{d.style.clipPath="",d.style.transition="",M.current=void 0},380)})}else!D&&s&&!O.current&&(d.style.transition="none",d.style.clipPath="",requestAnimationFrame(()=>{d.style.transition=""}))},[D]),V(()=>{if(a){p(!0);const d=setTimeout(j,16,!0);return()=>clearTimeout(d)}j(!1);const s=setTimeout(p,220,!1);return()=>clearTimeout(s)},[a]);const v=R(async()=>{const s=globalThis.window?.documentPictureInPicture;if(s)try{const d=await s.requestWindow({height:600,width:900});if(J.current=d,ue){const b=d.document.createElement("style");b.textContent=Array.from(ue.cssRules,F=>F.cssText).join(`
2
+ `),d.document.head.append(b)}const m=d.document.createElement("div");m.style.cssText="width:100%;height:100%;display:flex;",Y==="dark"&&(d.document.documentElement.classList.add("dark"),m.classList.add("dark")),d.document.body.style.cssText="margin:0;padding:0;height:100vh;",d.document.body.append(m),ke(i(Mt,{apps:t,initialActiveAppId:e,onClose:R(()=>{d.close()},"onClose")}),m),C({isPip:!0}),d.addEventListener("pagehide",()=>{C({isPip:!1}),J.current=void 0})}catch(d){console.error("[dev-toolbar] PiP activation failed:",d)}},"activatePip");V(()=>{if(!a)return;const s=R(d=>{d.key==="Escape"&&r()},"handleKeyDown");return document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[a,r]);const k=l(re(()=>t.find(s=>s.id===e),[t,e]),"activeApp");if(!c)return;const S=R(s=>d=>{d.preventDefault(),N.current=s},"startResize");return g(Te,{children:[i("div",{"aria-hidden":"true",class:h("fixed inset-0 z-[2147483646]","transition-opacity duration-200",u&&!D?"opacity-100 pointer-events-auto":"opacity-0 pointer-events-none"),onClick:H.closeOnOutsideClick?r:void 0,role:"presentation"}),g("div",{"aria-label":"DevTools panel","aria-modal":"true",class:h("fixed z-[2147483647] pointer-events-auto antialiased font-mono",D?"inset-0":kt(n),"bg-background overflow-hidden",D?"rounded-none border-0":"rounded-none border border-border","shadow-2xl","transition-panel",!D&&Tt(n),zt(n,u),"flex flex-row"),ref:E,role:"dialog",style:Z,children:[!D&&g(Te,{children:[n!=="top"&&i("div",{"aria-hidden":"true",class:"absolute left-1.5 right-1.5 top-0 h-2.5 -mt-1 cursor-ns-resize z-10 hover:bg-foreground/10 transition-colors",onMouseDown:S({top:!0})}),n==="top"&&i("div",{"aria-hidden":"true",class:"absolute left-1.5 right-1.5 bottom-0 h-2.5 -mb-1 cursor-ns-resize z-10 hover:bg-foreground/10 transition-colors",onMouseDown:S({bottom:!0})}),n==="left"&&i("div",{"aria-hidden":"true",class:"absolute top-1.5 bottom-1.5 right-0 w-2.5 -mr-1 cursor-ew-resize z-10 hover:bg-foreground/10 transition-colors",onMouseDown:S({right:!0})}),n==="right"&&i("div",{"aria-hidden":"true",class:"absolute top-1.5 bottom-1.5 left-0 w-2.5 -ml-1 cursor-ew-resize z-10 hover:bg-foreground/10 transition-colors",onMouseDown:S({left:!0})})]}),g("nav",{"aria-label":"DevTools apps",class:h("flex flex-col shrink-0 overflow-hidden","transition-[width] duration-300 ease-[cubic-bezier(0.4,0,0.2,1)]","bg-accent border-r border-border/60",z?"w-12.5":"w-62.5"),children:[i("div",{class:h("flex items-center shrink-0 border-b border-border/50 h-12",z?"justify-center px-2":"px-3"),children:z?i("span",{"aria-hidden":"true",class:"text-primary font-black text-[0.8rem] select-none",children:"V"}):g("span",{class:"text-[0.6rem] font-bold uppercase tracking-[0.14em] text-muted-foreground select-none",children:[i("span",{"aria-hidden":"true",class:"text-primary/60 mr-1",children:"//"}),"DevTools"]})}),i("div",{class:"flex flex-col flex-1 overflow-y-auto p-2 gap-1 scrollbar-thin-border",children:t.filter(s=>s.component||s.init||s.view?.type==="iframe").map(s=>g("div",{class:"relative group/nav-item",children:[g("button",{"aria-label":s.name,"aria-pressed":e===s.id,class:h("relative flex items-center w-full h-10","border-0 border-l-2 cursor-pointer","transition-all duration-150",z?"justify-center px-0":"gap-2.5 px-3",e===s.id?"border-primary bg-primary/8 text-foreground":"border-transparent bg-transparent text-muted-foreground hover:bg-foreground/6 hover:text-foreground"),onClick:R(()=>{s.id!==e&&o(s.id).catch(console.error)},"onClick"),type:"button",children:[s.icon?i("span",{class:h("size-4 shrink-0 flex items-center justify-center [&_svg]:size-4",e===s.id?"opacity-100":"opacity-65 group-hover/nav-item:opacity-100"),dangerouslySetInnerHTML:{__html:s.icon}}):i("span",{class:"size-4.5 shrink-0 flex items-center justify-center text-[0.65rem] font-bold uppercase select-none",children:s.name.slice(0,2)}),!z&&i("span",{class:"text-[0.8125rem] font-medium truncate leading-none tracking-[-0.01em]",children:s.name})]}),s.notification.state&&i("span",{"aria-hidden":"true",class:h("pointer-events-none absolute top-1.5 rounded-full",z?"right-1.5":"right-2.5","size-1.5",We(s.notification.level))}),z&&i("div",{class:h("absolute left-[calc(100%+0.5rem)] top-1/2 -translate-y-1/2","pointer-events-none z-50 whitespace-nowrap","opacity-0 -translate-x-1 group-hover/nav-item:opacity-100 group-hover/nav-item:translate-x-0","transition-all duration-200 ease-[cubic-bezier(0.23,1,0.32,1)]"),children:i("div",{class:"text-[0.7rem] font-medium bg-card/95 backdrop-blur-[0.625rem] text-foreground/80 px-2.5 py-1 border border-border shadow-md",children:s.name})})]},s.id))}),!z&&i("div",{class:"px-3 py-2.5 border-t border-border/40 shrink-0",children:g("span",{class:"text-[0.58rem] text-muted-foreground/50 leading-none select-none",children:[H.keybindings?.toggle??"Alt+Shift+D"," to toggle"]})})]}),g("div",{class:"flex-1 flex flex-col min-w-0 overflow-hidden bg-accent",children:[g("div",{class:"flex items-center justify-between gap-2 pr-2 min-h-12 shrink-0",children:[g("div",{class:"flex items-center gap-3 min-w-0",children:[i("button",{"aria-label":z?"Expand sidebar":"Collapse sidebar",class:h("flex items-center justify-center size-7 shrink-0","border-0 cursor-pointer bg-transparent","text-muted-foreground hover:text-foreground hover:bg-foreground/7","transition-colors duration-150"),onClick:R(()=>I(s=>!s),"onClick"),type:"button",children:i(ie,{class:h("size-3.5 transition-transform duration-300",!z&&"rotate-180"),size:14,src:$e})}),k?.icon&&i("span",{class:"size-5 flex items-center justify-center [&_svg]:size-5 shrink-0 text-foreground opacity-80",dangerouslySetInnerHTML:{__html:k.icon}}),g("span",{class:"flex items-center gap-1 text-[0.7rem] font-bold uppercase tracking-[0.06em] text-foreground truncate",children:[i("span",{"aria-hidden":"true",class:"text-primary/50 shrink-0",children:"["}),k?.name??"DevTools",i("span",{"aria-hidden":"true",class:"text-primary/50 shrink-0",children:"]"})]})]}),g("div",{class:"flex items-center gap-1 shrink-0",children:[(n==="bottom"||n==="top")&&!D&&i("button",{"aria-label":B?"Switch to container width":"Expand to full width",class:h("flex items-center justify-center size-8","cursor-pointer border-0 bg-transparent","text-muted-foreground hover:text-foreground hover:bg-foreground/7","transition-all duration-200 active:scale-90"),onClick:R(()=>C({viewMode:B?"default":"wide"}),"onClick"),title:B?"Container width":"Full width",type:"button",children:i(ie,{size:13,src:B?At:yt})}),i("button",{"aria-label":D?"Exit fullscreen":"Enter fullscreen",class:h("flex items-center justify-center size-8","cursor-pointer border-0 bg-transparent","text-muted-foreground hover:text-foreground hover:bg-foreground/7","transition-all duration-200 active:scale-90"),onClick:R(()=>{if(D){const s=E.current,d=U.current;if(s&&d){const m=globalThis.window?.innerWidth??0,b=globalThis.window?.innerHeight??0,F=`inset(${d.top}px ${m-d.right}px ${b-d.bottom}px ${d.left}px)`;M.current!==void 0&&(clearTimeout(M.current),M.current=void 0),O.current=!0,s.style.transition="clip-path 0.35s cubic-bezier(0.4, 0, 0.2, 1)",s.style.clipPath="inset(0px 0px 0px 0px)",requestAnimationFrame(()=>{s.style.clipPath=F,M.current=setTimeout(()=>{s.style.clipPath="",s.style.transition="",O.current=!1,M.current=void 0,C({viewMode:"default"})},380)})}else C({viewMode:"default"})}else{if(E.current){const s=E.current.getBoundingClientRect();w.current=s,U.current=s}C({viewMode:"fullscreen"})}},"onClick"),title:D?"Exit fullscreen":"Fullscreen",type:"button",children:i(ie,{size:13,src:D?Dt:wt})}),te&&!D&&i("button",{"aria-label":"Open in Picture-in-Picture window",class:h("flex items-center justify-center size-8","cursor-pointer border-0 bg-transparent",H.isPip?"text-primary hover:bg-primary/7":"text-muted-foreground hover:text-foreground hover:bg-foreground/7","transition-all duration-200 active:scale-90"),onClick:R(()=>{v().then(()=>r()).catch(console.error)},"onClick"),title:"Open in floating window (PiP)",type:"button",children:i(ie,{size:13,src:It})}),i("button",{"aria-label":"Close DevTools panel",class:h("flex items-center justify-center size-8","cursor-pointer border-0 bg-transparent","text-muted-foreground hover:text-foreground hover:bg-foreground/7","transition-all duration-200 active:scale-90"),onClick:r,title:"Close (Esc)",type:"button",children:i(ie,{size:12,src:He})})]})]}),i("div",{class:"devtools-content-scroll scrollbar-thin-border flex-1 overflow-auto min-h-0 bg-background",children:k?i(Le,{app:k},k.id):g("div",{class:"flex flex-col items-center justify-center h-full gap-7 p-8 select-none",children:[g("div",{class:"flex flex-col items-center gap-3",children:[i("div",{class:"size-14 border border-primary/25 bg-primary/5 flex items-center justify-center",children:i(ie,{class:"text-primary/45",size:26,src:xt})}),g("div",{class:"text-center space-y-1",children:[i("p",{class:"text-[0.8rem] font-medium text-foreground/65",children:"No tool selected"}),i("p",{class:"text-[0.7rem] text-muted-foreground",children:"Choose a tool from the sidebar to get started"})]})]}),t.length>0&&g("div",{class:"w-full max-w-[220px]",children:[g("p",{class:"text-[0.58rem] font-bold uppercase tracking-[0.12em] text-muted-foreground/60 mb-1.5",children:[i("span",{class:"text-primary/50",children:"// "}),"available"]}),i("div",{class:"flex flex-col gap-0.5",children:t.map(s=>g("button",{class:h("flex items-center gap-2.5 px-3 py-2","border border-border/40 bg-card/50","hover:border-primary/30 hover:bg-primary/4","cursor-pointer transition-all duration-150 text-left"),onClick:R(()=>o(s.id).catch(console.error),"onClick"),type:"button",children:[s.icon?i("span",{class:"size-3.5 shrink-0 flex items-center justify-center [&_svg]:size-3.5 text-muted-foreground",dangerouslySetInnerHTML:{__html:s.icon}}):i("span",{class:"size-3.5 text-[0.5rem] font-bold text-muted-foreground shrink-0 text-center",children:s.name.slice(0,2).toUpperCase()}),i("span",{class:"text-[0.75rem] font-medium text-muted-foreground",children:s.name})]},s.id))})]})]})})]})]})]})},"DevPanel"),jt="data:image/svg+xml;charset=utf-8,%3Csvg%20class%3D%22lucide%20lucide-alert-triangle%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22currentColor%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%20%3E%20%3Cpath%20d%3D%22m21.73%2018-8-14a2%202%200%200%200-3.48%200l-8%2014A2%202%200%200%200%204%2021h16a2%202%200%200%200%201.73-3%22%20%2F%3E%20%3Cpath%20d%3D%22M12%209v4%22%20%2F%3E%20%3Cpath%20d%3D%22M12%2017h.01%22%20%2F%3E%20%3C%2Fsvg%3E";var Et=Object.defineProperty,Me=_((e,t)=>Et(e,"name",{value:t,configurable:!0}),"n");const Ft=Me(()=>{const[e,t]=l($(0),"errorCount"),[r,o]=l($(!1),"isOverlayOpen");if(V(()=>{const c=Me(()=>{const u=globalThis.__v_o_error_history,j=Array.isArray(u)?u.length:0;t(j);const z=globalThis.__v_o__current;if(z?.parentNode){const I=z.shadowRoot?.querySelector("#__v_o__root");o(!!I&&!I.classList.contains("hidden"))}else o(!1)},"sync"),p=setInterval(c,300);return c(),()=>clearInterval(p)},[]),e===0)return;const a=Me(()=>{const c=globalThis.__v_o__current;if(!c?.parentNode)return;const p=c.shadowRoot?.querySelector("#__v_o__root");p?.classList.contains("hidden")?(p.classList.remove("hidden"),o(!0)):typeof c.close=="function"&&(c.close(),o(!1))},"handleClick"),n=`${e} error${e===1?"":"s"} – click to ${r?"hide":"show"} overlay`;return g(Te,{children:[i("div",{"aria-hidden":"true",class:"w-px h-5 bg-primary/20 shrink-0 mx-0.5"}),i("button",{"aria-label":n,class:h("relative flex justify-center items-center size-6","border-0","whitespace-nowrap no-underline p-0 m-0","cursor-pointer","bg-transparent text-destructive","transition-all duration-150","hover:bg-destructive/8","active:scale-[0.94]","group-data-[vertical]/panel:rotate-[-90deg]"),onClick:a,title:n,type:"button",children:g("div",{class:"relative size-6 select-none flex items-center justify-center",children:[i(ie,{size:16,src:jt}),i("span",{class:"absolute -top-0.5 -right-1 min-w-3.5 h-3.5 px-0.5 rounded-full bg-destructive text-white text-[9px] font-bold leading-none flex items-center justify-center border border-background",children:e>9?"9+":e})]})})]})},"ViteOverlayButton");var Rt=Object.defineProperty,St=_((e,t)=>Rt(e,"name",{value:t,configurable:!0}),"o$2");const _t=St(()=>{const{apps:e}=Ve();return i("div",{class:"flex items-center pointer-events-auto",id:"__v_dt__bar",children:g("div",{class:"flex flex-row items-center justify-start gap-1",id:"__v_dt__bar_container",children:[e.map(t=>i(bt,{app:t},t.id)),i(Ft,{})]})})},"ToolbarBar"),Nt="data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMjQ4IDI5MSIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4gPGRlZnM+IDxsaW5lYXJHcmFkaWVudCBpZD0iYSIgZ3JhZGllbnRVbml0cz0ib2JqZWN0Qm91bmRpbmdCb3giIHgxPSIwIiB5MT0iMCIgeDI9IjEiIHkyPSIxIj4gPHN0b3Agb2Zmc2V0PSIwIiBzdG9wLWNvbG9yPSJyZWQiPiA8YW5pbWF0ZSBhdHRyaWJ1dGVOYW1lPSJzdG9wLWNvbG9yIiB2YWx1ZXM9InJlZDtwdXJwbGU7Ymx1ZTtyZWQ7IiBkdXI9IjIwcyIgcmVwZWF0Q291bnQ9ImluZGVmaW5pdGUiIC8+IDwvc3RvcD4gPHN0b3Agb2Zmc2V0PSIwLjUiIHN0b3AtY29sb3I9InB1cnBsZSI+IDxhbmltYXRlIGF0dHJpYnV0ZU5hbWU9InN0b3AtY29sb3IiIHZhbHVlcz0icHVycGxlO2JsdWU7cmVkO3B1cnBsZTsiIGR1cj0iMjBzIiByZXBlYXRDb3VudD0iaW5kZWZpbml0ZSIgLz4gPC9zdG9wPiA8c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9ImJsdWUiPiA8YW5pbWF0ZSBhdHRyaWJ1dGVOYW1lPSJzdG9wLWNvbG9yIiB2YWx1ZXM9ImJsdWU7cmVkO3B1cnBsZTtibHVlOyIgZHVyPSIyMHMiIHJlcGVhdENvdW50PSJpbmRlZmluaXRlIiAvPiA8L3N0b3A+IDxhbmltYXRlVHJhbnNmb3JtIGF0dHJpYnV0ZU5hbWU9ImdyYWRpZW50VHJhbnNmb3JtIiB0eXBlPSJyb3RhdGUiIGZyb209IjAgLjUgLjUiIHRvPSIzNjAgLjUgLjUiIGR1cj0iMTBzIiByZXBlYXRDb3VudD0iaW5kZWZpbml0ZSIgLz4gPC9saW5lYXJHcmFkaWVudD4gPGxpbmVhckdyYWRpZW50IGlkPSJvdmVybGF5R3JhZGllbnRBIiB4MT0iNjIiIHkxPSI0Mi4yMjUzIiB4Mj0iNjIiIHkyPSIyOTAuMjI1IiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSI+IDxzdG9wIG9mZnNldD0iMC4zNCIgc3RvcC1vcGFjaXR5PSIwLjUiIC8+IDxzdG9wIG9mZnNldD0iMSIgc3RvcC1jb2xvcj0id2hpdGUiIHN0b3Atb3BhY2l0eT0iMCIgLz4gPC9saW5lYXJHcmFkaWVudD4gPGxpbmVhckdyYWRpZW50IGlkPSJvdmVybGF5R3JhZGllbnRCIiB4MT0iMTg2IiB5MT0iMCIgeDI9IjE4NiIgeTI9IjI0OCIgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiPiA8c3RvcCBzdG9wLWNvbG9yPSJ3aGl0ZSIgc3RvcC1vcGFjaXR5PSIwIiAvPiA8c3RvcCBvZmZzZXQ9IjAuNjk1IiBzdG9wLW9wYWNpdHk9IjAuNSIgLz4gPC9saW5lYXJHcmFkaWVudD4gPC9kZWZzPiA8cGF0aCBkPSJNMCAxNjYuMjI1QzAgMjM0LjcwOSA1NS41MTY3IDI5MC4yMjUgMTI0IDI5MC4yMjVWNDIuMjI1M0M1NS41MTY3IDQyLjIyNTMgMCA5Ny43NDIgMCAxNjYuMjI1WiBNMjQ4IDEyNEMyNDggMTkyLjQ4MyAxOTIuNDgzIDI0OCAxMjQgMjQ4VjBDMTkyLjQ4MyAwIDI0OCA1NS41MTY3IDI0OCAxMjRaIiBmaWxsPSJ1cmwoI2EpIiAvPiA8cGF0aCBkPSJNMCAxNjYuMjI1QzAgMjM0LjcwOSA1NS41MTY3IDI5MC4yMjUgMTI0IDI5MC4yMjVWNDIuMjI1M0M1NS41MTY3IDQyLjIyNTMgMCA5Ny43NDIgMCAxNjYuMjI1WiIgZmlsbD0idXJsKCNvdmVybGF5R3JhZGllbnRBKSIgLz4gPHBhdGggZD0iTTI0OCAxMjRDMjQ4IDE5Mi40ODMgMTkyLjQ4MyAyNDggMTI0IDI0OFYwQzE5Mi40ODMgMCAyNDggNTUuNTE2NyAyNDggMTI0WiIgZmlsbD0idXJsKCNvdmVybGF5R3JhZGllbnRCKSIgLz4gPGNpcmNsZSBjeD0iMTI0IiBjeT0iMTQ3IiByPSI1MCIgZmlsbD0id2hpdGUiIC8+IDwvc3ZnPg==",Vt="data:image/svg+xml;charset=utf-8,%3Csvg%20class%3D%22lucide%20lucide-pin%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22currentColor%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%20%3E%20%3Cpath%20d%3D%22M12%2017v5%22%20%2F%3E%20%3Cpath%20d%3D%22M9%2010.76a2%202%200%200%201-1.11%201.79l-1.78.9A2%202%200%200%200%205%2015.24V16a1%201%200%200%200%201%201h12a1%201%200%200%200%201-1v-.76a2%202%200%200%200-1.11-1.79l-1.78-.9A2%202%200%200%201%2015%2010.76V7a1%201%200%200%201%201-1%202%202%200%200%200%200-4H8a2%202%200%200%200%200%204%201%201%200%200%201%201%201z%22%20%2F%3E%20%3C%2Fsvg%3E";var $t=Object.defineProperty,fe=_((e,t)=>$t(e,"name",{value:t,configurable:!0}),"o$1");const Ht=fe((e,t)=>{switch(t){case"left":return{left:`${e.right+10}px`,top:`${e.top+e.height/2}px`,transform:"translateY(-50%)"};case"right":return{right:`${globalThis.window?globalThis.window.innerWidth-e.left+10:0}px`,top:`${e.top+e.height/2}px`,transform:"translateY(-50%)"};case"top":return{left:`${e.left+e.width/2}px`,top:`${e.bottom+10}px`,transform:"translateX(-50%)"};default:return{bottom:`${globalThis.window?globalThis.window.innerHeight-e.top+10:0}px`,left:`${e.left+e.width/2}px`,transform:"translateX(-50%)"}}},"getTooltipStyle"),Lt=fe(({position:e})=>{const{hoveredApp:t,hoveredAppRect:r,pinTooltip:o,setHoveredApp:a}=ze(),n=l(f(null),"overlayRef"),c=l(f(me()),"helpersRef"),[p,u]=l($(!1),"isRendered"),[j,z]=l($(!1),"isVisible"),I=!!(t?.tooltip&&r);if(V(()=>{if(I){u(!0);const N=setTimeout(z,16,!0);return()=>clearTimeout(N)}z(!1);const E=setTimeout(u,200,!1);return()=>clearTimeout(E)},[I]),!p||!t?.tooltip||!r)return;const P=t.tooltip,H=Ht(r,e),C=e==="left"||e==="right",Y=fe(()=>{const E=n.current?.getBoundingClientRect();E&&o(t,E.left,E.top),a(void 0)},"handlePin");return g("div",{"aria-label":`${t.name} quick preview`,class:h("fixed z-[2147483647] pointer-events-auto","antialiased toolbar-font","w-auto max-w-[300px]","bg-background border border-border shadow-2xl","transition-[opacity,transform] duration-200 ease-[cubic-bezier(0.23,1,0.32,1)]",j?"opacity-100 translate-y-0 scale-100":h("opacity-0 scale-[0.97]",e==="bottom"&&"translate-y-1",e==="top"&&"-translate-y-1",C&&"translate-x-[-2px]")),onMouseEnter:fe(()=>a(t,r),"onMouseEnter"),onMouseLeave:fe(()=>a(void 0),"onMouseLeave"),ref:n,role:"tooltip",style:H,children:[g("div",{class:"flex items-center justify-between gap-2 px-3 py-2 border-b border-border/60 bg-foreground/3",children:[g("div",{class:"flex items-center gap-2 min-w-0",children:[i("span",{"aria-hidden":"true",class:"size-1.5 rounded-full bg-primary shrink-0"}),i("span",{class:"text-[0.6rem] font-bold uppercase tracking-[0.1em] text-muted-foreground truncate",children:t.name})]}),i("button",{"aria-label":`Pin ${t.name} tooltip`,class:h("size-5 flex items-center justify-center shrink-0","border-0 bg-transparent cursor-pointer p-0","text-muted-foreground/60 hover:text-primary","transition-colors duration-150"),onClick:Y,title:"Pin (keep visible)",type:"button",children:i(ie,{size:11,src:Vt})})]}),i("div",{class:"p-3",children:i(P,{helpers:c.current})})]})},"AppTooltipOverlay");var Wt=Object.defineProperty,Ie=_((e,t)=>Wt(e,"name",{value:t,configurable:!0}),"o");const Bt=Ie(e=>{switch(e){case"left":return{left:"0",top:"50%",transform:"translateX(24px) translateY(-50%)"};case"right":return{left:"0",top:"50%",transform:"translateX(calc(-100% - 24px)) translateY(-50%)"};case"top":return{left:"50%",top:"0",transform:"translateX(-50%) translateY(24px)"};default:return{left:"50%",top:"0",transform:"translateX(-50%) translateY(calc(-100% - 24px))"}}},"getHintStyle"),Zt=Ie(({position:e})=>{const t="absolute w-2.5 h-2.5 bg-card border-border";switch(e){case"left":return i("div",{"aria-hidden":"true",class:h(t,"left-[-5px] top-1/2 -translate-y-1/2 rotate-45 border-b border-l")});case"right":return i("div",{"aria-hidden":"true",class:h(t,"right-[-5px] top-1/2 -translate-y-1/2 rotate-45 border-t border-r")});case"top":return i("div",{"aria-hidden":"true",class:h(t,"top-[-5px] left-1/2 -translate-x-1/2 rotate-45 border-t border-l")});default:return i("div",{"aria-hidden":"true",class:h(t,"bottom-[-5px] left-1/2 -translate-x-1/2 rotate-45 border-b border-r")})}},"Arrow"),Gt=[{icon:"⊙",text:"Click logo to open panel"},{icon:"⠿",text:"Drag pill to reposition"},{icon:"⌨",text:"Alt+Shift+D to toggle"}],Yt=Ie(({onDismiss:e,position:t})=>{const[r,o]=l($(!1),"visible"),a=l(f(void 0),"dismissTimeoutRef");V(()=>{const c=setTimeout(o,600,!0);return()=>clearTimeout(c)},[]),V(()=>()=>{a.current!==void 0&&(clearTimeout(a.current),a.current=void 0)},[]);const n=Ie(()=>{o(!1),a.current=setTimeout(e,180)},"handleDismiss");return g("div",{"aria-hidden":!r,"aria-label":"DevTools quick start",class:h("absolute pointer-events-auto","w-[240px]","bg-card border border-border","shadow-xl","p-3","font-mono","transition-all duration-200",r?"opacity-100 scale-100":"opacity-0 scale-95 pointer-events-none"),style:Bt(t),children:[i(Zt,{position:t}),g("p",{class:"flex items-center gap-1.5 mb-2.5",children:[i("span",{"aria-hidden":"true",class:"text-primary text-[0.6rem]",children:"▶"}),i("span",{class:"text-[0.6rem] font-bold uppercase tracking-[0.12em] text-foreground",children:"Quick start"})]}),i("ul",{class:"space-y-1.5 mb-3 list-none p-0 m-0",children:Gt.map(({icon:c,text:p})=>g("li",{class:"flex items-center gap-2 text-[0.7rem] text-muted-foreground",children:[i("span",{"aria-hidden":"true",class:"text-primary shrink-0 w-3 text-center leading-none",children:c}),p]},p))}),i("button",{class:h("w-full h-6 text-[0.6rem] font-bold uppercase tracking-[0.1em]","border border-primary/30 bg-primary/6","text-primary cursor-pointer","hover:bg-primary/12 hover:border-primary/50","transition-all duration-150 active:scale-[0.98]"),onClick:n,tabIndex:r?void 0:-1,type:"button",children:"Got it"})]})},"FirstVisitHint"),Ot="data:image/svg+xml;charset=utf-8,%3Csvg%20class%3D%22lucide%20lucide-pin-off%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22currentColor%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%20%3E%20%3Cpath%20d%3D%22M12%2017v5%22%20%2F%3E%20%3Cpath%20d%3D%22M15%209.34V7a1%201%200%200%201%201-1%202%202%200%200%200%200-4H7.89%22%20%2F%3E%20%3Cpath%20d%3D%22m2%202%2020%2020%22%20%2F%3E%20%3Cpath%20d%3D%22M9%209v1.76a2%202%200%200%201-1.11%201.79l-1.78.9A2%202%200%200%200%205%2015.24V16a1%201%200%200%200%201%201h11%22%20%2F%3E%20%3C%2Fsvg%3E";var Xt=Object.defineProperty,pe=_((e,t)=>Xt(e,"name",{value:t,configurable:!0}),"i");const Jt=pe(({onMove:e,onUnpin:t,pinned:r})=>{const o=l(f(null),"cardRef"),a=l(f(null),"headerRef"),n=l(f({x:r.initialX,y:r.initialY}),"posRef"),c=l(f(void 0),"dragRef"),p=l(f(me()),"helpersRef"),u=l(f(e),"onMoveRef"),j=l(f(r.id),"pinnedIdRef");u.current=e,j.current=r.id,V(()=>{const P="transform 110ms cubic-bezier(0.25,0.46,0.45,0.94)",H=pe(Y=>{if(!c.current||!o.current)return;const E=globalThis.window?.innerWidth??9999,N=globalThis.window?.innerHeight??9999,{cardH:L,cardW:w}=c.current,U=Math.min(80,w),ee=Math.min(36,L);let O=c.current.origX+(Y.clientX-c.current.startX),M=c.current.origY+(Y.clientY-c.current.startY);O=Math.max(U-w,Math.min(E-U,O)),M=Math.max(ee-L,Math.min(N-ee,M));const D=[0,E-w,U-w,E-U],B=[0,N-L,ee-L,N-ee];let te=O,J=M;for(const Z of D)if(Math.abs(O-Z)<28){te=Z;break}for(const Z of B)if(Math.abs(M-Z)<28){J=Z;break}o.current.style.transition=te!==O||J!==M?P:"",o.current.style.transform=`translate(${te}px, ${J}px)`,n.current={x:te,y:J}},"handleMove"),C=pe(()=>{c.current&&(c.current=void 0,o.current&&(o.current.style.transition=""),a.current&&(a.current.style.cursor=""),u.current(j.current,n.current.x,n.current.y))},"handleUp");return document.addEventListener("mousemove",H),document.addEventListener("mouseup",C),()=>{document.removeEventListener("mousemove",H),document.removeEventListener("mouseup",C)}},[]);const z=r.app.tooltip;if(!z)return;const I=pe(P=>{P.button===0&&(c.current={cardH:o.current?.offsetHeight??200,cardW:o.current?.offsetWidth??300,origX:n.current.x,origY:n.current.y,startX:P.clientX,startY:P.clientY},a.current&&(a.current.style.cursor="grabbing"),P.preventDefault())},"handleDragStart");return g("div",{"aria-label":`${r.app.name} pinned tooltip`,class:h("fixed z-[2147483647] pointer-events-auto antialiased toolbar-font","w-auto max-w-[300px]","bg-background border border-primary/40 shadow-2xl"),ref:o,style:{left:0,top:0,transform:`translate(${n.current.x}px, ${n.current.y}px)`},children:[g("div",{class:h("flex items-center justify-between gap-2 px-3 py-2","border-b border-primary/20 bg-primary/4","select-none cursor-grab"),onMouseDown:I,ref:a,children:[g("div",{class:"flex items-center gap-2 min-w-0",children:[i("span",{"aria-hidden":"true",class:"size-1.5 rounded-full bg-primary shrink-0"}),i("span",{class:"text-[0.6rem] font-bold uppercase tracking-[0.1em] text-primary/70 truncate",children:r.app.name})]}),i("button",{"aria-label":`Unpin ${r.app.name}`,class:h("size-5 flex items-center justify-center shrink-0","border-0 bg-transparent cursor-pointer p-0","text-muted-foreground/50 hover:text-destructive","transition-colors duration-150"),onClick:pe(()=>t(r.id),"onClick"),onMouseDown:pe(P=>P.stopPropagation(),"onMouseDown"),title:"Unpin",type:"button",children:i(ie,{size:11,src:Ot})})]}),i("div",{class:"p-3",children:i(z,{helpers:p.current})})]})},"PinnedTooltipCard");var Ut=Object.defineProperty,ce=_((e,t)=>Ut(e,"name",{value:t,configurable:!0}),"p");const Fe="__v_dt__pinned_tooltips",Qt=ce((e,t,r,o,a)=>{const n=t*o/100,c=r*a/100,p=o/4;switch(e){case"bottom":return n<p?"bottom-left":n>o-p?"bottom-right":"bottom-center";case"left":return c<a/2?"top-left":"bottom-left";case"right":return c<a/2?"top-right":"bottom-right";case"top":return n<p?"top-left":n>o-p?"top-right":"top-center";default:return"bottom-center"}},"computePlacement"),qt=ce(({activeAppId:e,apps:t,onClearNotification:r,onRegisterApp:o,onSetNotification:a,onToggleApp:n,onUnregisterApp:c})=>{const p=l(f(null),"anchorRef"),u=l(f(null),"panelRef"),j=l(f(void 0),"leaveTimerRef"),{resolvedTheme:z}=_e(),{state:I,updateState:P}=Ce(),{closePanel:H,panelVisible:C,togglePanelVisible:Y}=pt(),{anchorStyle:E,bringUp:N,isDragging:L,isHidden:w,isVertical:U,onPointerDown:ee,panelStyle:O}=mt(u),[M,D]=l($(void 0),"hoveredApp"),[B,te]=l($(void 0),"hoveredAppRect"),J=l(f(new Map),"pinPositionsRef"),Z=de(x=>{try{const T=x.map(A=>{const X=J.current.get(A.id);return{appId:A.app.id,x:X?.x??A.initialX,y:X?.y??A.initialY}});localStorage.setItem(Fe,JSON.stringify(T))}catch{}},[]),[v,k]=l($([]),"pinnedTooltips"),S=l(f([]),"pinnedTooltipsRef");S.current=v;const s=de((x,T,A)=>{const X=`${x.id}-${Date.now()}`;k(ae=>{const ve=[...ae,{app:x,id:X,initialX:T,initialY:A}];return Z(ve),ve})},[Z]),d=de(x=>{k(T=>{const A=T.filter(X=>X.id!==x);return J.current.delete(x),Z(A),A})},[Z]),m=de((x,T,A)=>{J.current.set(x,{x:T,y:A}),Z(S.current)},[Z]),b=l(f(void 0),"storedPinsRef"),F=l(f(new Set),"restoredAppIdsRef");V(()=>{if(t.length===0)return;if(b.current===void 0)try{const A=localStorage.getItem(Fe);b.current=A?JSON.parse(A):[]}catch{b.current=[]}const x=b.current;if(x.length===0)return;const T=[];for(const A of x){if(F.current.has(A.appId))continue;const X=t.find(ae=>ae.id===A.appId&&ae.tooltip);X&&(F.current.add(A.appId),T.push({app:X,id:`${X.id}-restored-${Date.now()}-${Math.random().toString(36).slice(2)}`,initialX:A.x,initialY:A.y}))}T.length>0&&k(A=>[...A,...T])},[t]),V(()=>()=>{j.current!==void 0&&clearTimeout(j.current)},[]);const Q=de((x,T)=>{j.current!==void 0&&(clearTimeout(j.current),j.current=void 0),x?(D(x),te(T)):j.current=setTimeout(()=>{D(void 0),te(void 0),j.current=void 0},180)},[]),G=l(f(t),"appsRef");G.current=t;const y=l(f(C),"panelVisibleRef");y.current=C;const se=l(f(e),"activeAppIdRef");se.current=e;const q=l(f(n),"onToggleAppRef");q.current=n;const ne=l(re(()=>{const x=globalThis.window?.innerWidth??1920,T=globalThis.window?.innerHeight??1080;return Qt(I.position,I.left,I.top,x,T)},[I.left,I.position,I.top]),"placement"),oe=de(async x=>{const T=y.current,A=se.current,X=G.current.find(ae=>ae.id===x);if(X?.onClick??X?.onDeactivate){await q.current(x);return}if(x===A&&T){await q.current(x),P({open:!1,viewMode:"default"});return}x!==A&&await q.current(x),T||P({open:!0})},[P]),le={activeAppId:e,apps:t,clearNotification:r,hoveredApp:M,hoveredAppRect:B,isDragging:L,isVisible:C,pinnedTooltips:v,pinTooltip:s,placement:ne,registerApp:o,setDragging:ce(()=>{},"setDragging"),setHoveredApp:Q,setNotification:a,setPlacement:ce(()=>{},"setPlacement"),setVisible:ce(x=>P({open:x}),"setVisible"),toggleApp:oe,unpinTooltip:d,unregisterApp:c};if(!(!I.preferShowFloatingPanel&&!C))return i(Ne.Provider,{value:le,children:g("div",{class:h(z==="dark"&&"dark"),style:{display:"contents"},children:[g("div",{class:h("fixed z-[2147483647]","pointer-events-auto","origin-center","transition-[left_0.3s_cubic-bezier(0.4,0,0.2,1),top_0.3s_cubic-bezier(0.4,0,0.2,1)]","data-[dragging]:transition-none!","group","toolbar-font text-[13px]! leading-[1.6]! antialiased box-border [&_*]:box-border print:hidden",I.reduceMotion&&"transition-none! animate-none! [&_*]:transition-none! [&_*]:animate-none!"),"data-dragging":L?"":void 0,"data-placement":ne,id:"__v_dt__root",onMouseMove:N,ref:p,style:E,children:[g("div",{class:h("group/panel","absolute left-0 top-0","flex flex-row justify-start items-center","gap-1 p-1","box-border","overflow-hidden","rounded-none","text-foreground select-none",L?"cursor-grabbing":"cursor-grab","bg-background border-0",U?"shadow-pill-vertical!":"shadow-pill",w?"max-w-12!":"","transition-pill"),"data-vertical":U||void 0,onPointerDown:ce(x=>{I.isFirstVisit&&P({isFirstVisit:!1}),ee(x)},"onPointerDown"),ref:u,style:O,children:[i("button",{"aria-label":"Toggle devtools panel",class:h("size-8 flex justify-center items-center shrink-0","cursor-pointer p-0 m-0 border-0","bg-transparent","transition-all duration-150","hover:bg-primary/8 active:scale-[0.95]","group-data-[vertical]/panel:rotate-[-90deg]",C?"opacity-100":"opacity-60"),onClick:ce(x=>{x.stopPropagation(),I.isFirstVisit&&P({isFirstVisit:!1}),Y()},"onClick"),title:"Toggle devtools panel",type:"button",children:i("img",{alt:"Visulima",class:"size-6",src:Nt})}),i("div",{"aria-hidden":"true",class:h("w-px h-5 bg-primary/20 shrink-0",w&&"hidden")}),i("div",{class:h("px-0.5",w&&"hidden"),children:i(_t,{})})]}),I.isFirstVisit&&i(Yt,{onDismiss:ce(()=>P({isFirstVisit:!1}),"onDismiss"),position:I.position})]}),i(Pt,{activeAppId:e,apps:t,onClose:H,onToggleApp:n,panelVisible:C,position:I.position}),i(Lt,{position:I.position}),v.map(x=>i(Jt,{onMove:m,onUnpin:d,pinned:x},x.id))]})})},"ToolbarContainer");var Kt=Object.defineProperty,Be=_((e,t)=>Kt(e,"name",{value:t,configurable:!0}),"r");const er=Be((e,t)=>{const r=Re(),o=Je();if(!o)throw new Error("Global hook not initialized");return{clearNotification(a){e.clearNotification(a)},async closeApp(){const a=e.getActiveApp();a&&await e.toggleApp(a.id)},getActiveApp(){return e.getActiveApp()?.id},getApps(){return e.getApps()},getSettings(){return Se()},hide(){t.hide()},hook:o,notify(a,n){e.setNotification(a,!0,n)},async openApp(a){await e.toggleApp(a)},registerApp(a){e.registerApp(a)},rpc:new Proxy({},{get(a,n){return(...c)=>r.callServer(n,...c)}}),setAppActive(a,n){e.setAppActive(a,n)},show(){t.show()},toggle(){t.toggle()},unregisterApp(a){e.unregisterApp(a)},updateSettings(a){Xe(a)},version:"0.0.0"}},"createGlobalAPI"),tr=Be(e=>{globalThis.window!==void 0&&(globalThis.__VISULIMA_DEVTOOLS__=e)},"setupGlobalAPI");var rr=Object.defineProperty,W=_((e,t)=>rr(e,"name",{value:t,configurable:!0}),"t");class ir extends HTMLElement{static{_(this,"DevToolbar")}static{W(this,"DevToolbar")}appManager;hasBeenInitialized=!1;renderRoot=void 0;constructor(){super(),this.attachShadow({mode:"open"}),this.appManager=new nt}connectedCallback(){if(document.querySelectorAll("dev-toolbar").length>1){console.warn("[dev-toolbar] Only one instance is allowed. Removing duplicate."),this.remove();return}this.hasBeenInitialized&&this.shadowRoot&&!this.renderRoot&&this.render()}disconnectedCallback(){this.renderRoot&&(ke(null,this.renderRoot),this.renderRoot=void 0)}init(){if(this.hasBeenInitialized)return;this.hasBeenInitialized=!0;const t=Ue(n=>{this.appManager.registerApp(n),this.render()},(n,c)=>{Qe().addEvent(n,c)}),r=er({clearNotification:W(n=>{this.appManager.clearNotification(n),this.render()},"clearNotification"),getActiveApp:W(()=>this.appManager.getActiveApp(),"getActiveApp"),getApps:W(()=>this.appManager.getAllApps(),"getApps"),registerApp:W(n=>{this.appManager.registerApp(n),this.render()},"registerApp"),setAppActive:W((n,c)=>{this.appManager.setAppActive(n,c),this.render()},"setAppActive"),setNotification:W((n,c,p)=>{this.appManager.setNotification(n,c,p),this.render()},"setNotification"),toggleApp:W(n=>this.appManager.toggleApp(n),"toggleApp"),unregisterApp:W(n=>{this.appManager.unregisterApp(n),this.render()},"unregisterApp")},{hide:W(()=>this.setToolbarVisible(!1),"hide"),show:W(()=>this.setToolbarVisible(!0),"show"),toggle:W(()=>{const n=this.isHidden();this.setToolbarVisible(!n)},"toggle")});tr(r),t.emit("devtools:init");const o=Se(),a=this.appManager.getAllApps().find(n=>n.defaultOpen);a&&!this.appManager.getActiveApp()&&this.appManager.openApp(a.id).catch(n=>{console.error(`[dev-toolbar] Failed to auto-open defaultOpen app ${a.id}:`,n)}),this.render(),this.setupEventListeners(),o.defaultVisible&&this.setToolbarVisible(!0)}isHidden(){return this.shadowRoot.querySelector("#__v_dt__root")?.hasAttribute("data-hidden")??!0}setToolbarVisible(t){const r=this.shadowRoot.querySelector("#__v_dt__root");r&&(t?delete r.dataset.hidden:r.dataset.hidden=""),this.render()}registerApp(t,r=!1){this.appManager.registerApp(t,r),this.render()}getAppManager(){return this.appManager}render(){const t=this.appManager.getAllApps(),r=this.shadowRoot;ue&&(r.adoptedStyleSheets=[ue]);let o=r.querySelector("style");o||(o=document.createElement("style"),o.textContent=`
3
3
  :host {
4
4
  all: initial;
5
5
  /* Cover the full viewport so the host establishes a stacking context
@@ -18,4 +18,4 @@ var Ge=Object.defineProperty;var R=(e,t)=>Ge(e,"name",{value:t,configurable:!0})
18
18
  display: none;
19
19
  }
20
20
  }
21
- `,r.append(i)),this.renderRoot||(this.renderRoot=document.createElement("div"),r.append(this.renderRoot));const o=this.appManager.getActiveApp()?.id||null;ke(n(qt,{activeAppId:o,apps:t,customAppsToShow:this.customAppsToShow,onClearNotification:W(a=>{this.appManager.clearNotification(a),this.render()},"onClearNotification"),onRegisterApp:W(a=>{this.render()},"onRegisterApp"),onSetNotification:W((a,c,p)=>{this.appManager.setNotification(a,c,p),this.render()},"onSetNotification"),onToggleApp:W(async a=>{await this.appManager.toggleApp(a),this.render()},"onToggleApp"),onUnregisterApp:W(a=>{this.appManager.unregisterApp(a),this.render()},"onUnregisterApp")}),this.renderRoot)}setupEventListeners(){document.addEventListener("keyup",t=>{if(t.key!=="Escape"||this.isHidden())return;const r=this.appManager.getActiveApp();r?this.appManager.toggleApp(r.id).then(()=>{this.render()}):this.setToolbarVisible(!1)})}}if(globalThis.window!==void 0&&(customElements.get("dev-toolbar")||customElements.define("dev-toolbar",je),!customElements.get("dev-toolbar-app-canvas"))){class e extends HTMLElement{static{R(this,"p")}static{W(this,"DevToolbarAppCanvas")}constructor(){super(),this.attachShadow({mode:"open"})}}customElements.define("dev-toolbar-app-canvas",e)}export{je as DevToolbar,he as sharedToolbarStylesheet};
21
+ `,r.append(o)),this.renderRoot||(this.renderRoot=document.createElement("div"),r.append(this.renderRoot));const a=this.appManager.getActiveApp()?.id;ke(i(qt,{activeAppId:a,apps:t,onClearNotification:W(n=>{this.appManager.clearNotification(n),this.render()},"onClearNotification"),onRegisterApp:W(n=>{this.render()},"onRegisterApp"),onSetNotification:W((n,c,p)=>{this.appManager.setNotification(n,c,p),this.render()},"onSetNotification"),onToggleApp:W(async n=>{await this.appManager.toggleApp(n),this.render()},"onToggleApp"),onUnregisterApp:W(n=>{this.appManager.unregisterApp(n),this.render()},"onUnregisterApp")}),this.renderRoot)}setupEventListeners(){document.addEventListener("keyup",t=>{if(t.key!=="Escape"||this.isHidden())return;const r=this.appManager.getActiveApp();r?this.appManager.toggleApp(r.id).then(()=>{this.render()}).catch(o=>{console.error("[dev-toolbar] Error toggling app:",o)}):this.setToolbarVisible(!1)})}}if(globalThis.window!==void 0&&(customElements.get("dev-toolbar")||customElements.define("dev-toolbar",ir),!customElements.get("dev-toolbar-app-canvas"))){class e extends HTMLElement{static{_(this,"n")}static{W(this,"DevToolbarAppCanvas")}constructor(){super(),this.attachShadow({mode:"open"})}}customElements.define("dev-toolbar-app-canvas",e)}export{ir as DevToolbar,ue as sharedToolbarStylesheet};
@@ -1,17 +1,17 @@
1
1
  import type { ToolbarSettings } from "../types/toolbar.d.ts";
2
2
  /**
3
- * Load settings from localStorage
4
- * @returns Toolbar settings
3
+ * Loads settings from localStorage, merging with defaults.
4
+ * @returns Toolbar settings.
5
5
  */
6
6
  export declare const loadSettings: () => ToolbarSettings;
7
7
  /**
8
- * Save settings to localStorage
9
- * @param settings Toolbar settings to save
8
+ * Saves settings to localStorage.
9
+ * @param settings Toolbar settings to save.
10
10
  */
11
11
  export declare const saveSettings: (settings: ToolbarSettings) => void;
12
12
  /**
13
- * Update settings (merge with existing)
14
- * @param updates Partial settings to update
15
- * @returns Updated settings
13
+ * Merges partial updates into the current settings and persists them.
14
+ * @param updates Partial settings to update.
15
+ * @returns Updated settings.
16
16
  */
17
17
  export declare const updateSettings: (updates: Partial<ToolbarSettings>) => ToolbarSettings;
@@ -1 +1,3 @@
1
- export declare const sharedToolbarStylesheet: CSSStyleSheet | undefined;
1
+ declare const sharedToolbarStylesheet: CSSStyleSheet | undefined;
2
+ export { sharedToolbarStylesheet };
3
+ export default sharedToolbarStylesheet;
@@ -1,12 +1,12 @@
1
1
  /**
2
- * Clamp a value between min and max
2
+ * Clamps a value between min and max.
3
3
  */
4
4
  export declare const clamp: (value: number, min: number, max: number) => number;
5
5
  /**
6
- * Check if browser is Safari
6
+ * Returns true when the current browser is Safari.
7
7
  */
8
8
  export declare const checkIsSafari: () => boolean;
9
9
  /**
10
- * Convert pixel value to number (handles "10px" -> 10)
10
+ * Converts a pixel string value to a number (e.g. "10px" becomes 10).
11
11
  */
12
12
  export declare const pixelToNumber: (value: string | number) => number;
@@ -3,89 +3,77 @@ import type { DevToolbarHook } from "./hooks.d.ts";
3
3
  import type { ServerFunctions } from "./rpc.d.ts";
4
4
  import type { ToolbarSettings } from "./toolbar.d.ts";
5
5
  /**
6
- * Global DevTools API interface
6
+ * Global DevTools API interface.
7
7
  * Exposed as window.__VISULIMA_DEVTOOLS__
8
8
  */
9
- export interface VisulimaDevTools {
9
+ interface VisulimaDevTools {
10
10
  /**
11
- * Clear notification for an app
12
- * @param appId App ID
11
+ * Clears notification for an app.
13
12
  */
14
13
  clearNotification: (appId: string) => void;
15
14
  /**
16
- * Close the currently active app
15
+ * Closes the currently active app.
17
16
  */
18
17
  closeApp: () => Promise<void>;
19
18
  /**
20
- * Get the currently active app ID
21
- * @returns Active app ID or null
19
+ * Gets the currently active app ID.
22
20
  */
23
- getActiveApp: () => string | null;
21
+ getActiveApp: () => string | undefined;
24
22
  /**
25
- * Get all registered apps
26
- * @returns Array of app definitions
23
+ * Gets all registered apps.
27
24
  */
28
25
  getApps: () => DevToolbarApp[];
29
26
  /**
30
- * Get current toolbar settings
31
- * @returns Toolbar settings
27
+ * Gets current toolbar settings.
32
28
  */
33
29
  getSettings: () => ToolbarSettings;
34
30
  /**
35
- * Hide the toolbar
31
+ * Hides the toolbar.
36
32
  */
37
33
  hide: () => void;
38
34
  /**
39
- * Hook instance for event subscriptions
35
+ * Hook instance for event subscriptions.
40
36
  */
41
37
  hook: DevToolbarHook;
42
38
  /**
43
- * Show a notification for an app
44
- * @param appId App ID
45
- * @param level Notification level
39
+ * Shows a notification for an app.
46
40
  */
47
41
  notify: (appId: string, level: "info" | "warning" | "error") => void;
48
42
  /**
49
- * Open an app
50
- * @param appId App ID to open
43
+ * Opens an app by ID.
51
44
  */
52
45
  openApp: (appId: string) => Promise<void>;
53
46
  /**
54
- * Register a custom app
55
- * @param app App definition
47
+ * Registers a custom app.
56
48
  */
57
49
  registerApp: (app: DevToolbarApp) => void;
58
50
  /**
59
- * RPC client for calling server functions
51
+ * RPC client for calling server functions.
60
52
  */
61
53
  rpc: ServerFunctions;
62
54
  /**
63
- * Directly set the active state of an action button without invoking callbacks.
55
+ * Directly sets the active state of an action button without invoking callbacks.
64
56
  * Useful for deactivating a button from async work running outside the toolbar.
65
- * @param appId App ID
66
- * @param active New active state
67
57
  */
68
58
  setAppActive: (appId: string, active: boolean) => void;
69
59
  /**
70
- * Show the toolbar
60
+ * Shows the toolbar.
71
61
  */
72
62
  show: () => void;
73
63
  /**
74
- * Toggle toolbar visibility
64
+ * Toggles toolbar visibility.
75
65
  */
76
66
  toggle: () => void;
77
67
  /**
78
- * Unregister an app
79
- * @param appId App ID to unregister
68
+ * Unregisters an app by ID.
80
69
  */
81
70
  unregisterApp: (appId: string) => void;
82
71
  /**
83
- * Update toolbar settings
84
- * @param settings Partial settings to update
72
+ * Updates toolbar settings.
85
73
  */
86
74
  updateSettings: (settings: Partial<ToolbarSettings>) => void;
87
75
  /**
88
- * Package version
76
+ * Package version.
89
77
  */
90
78
  version: string;
91
79
  }
@@ -95,8 +83,9 @@ export interface VisulimaDevTools {
95
83
  declare global {
96
84
  interface Window {
97
85
  /**
98
- * Visulima DevTools global API
86
+ * Visulima DevTools global API.
99
87
  */
100
88
  __VISULIMA_DEVTOOLS__?: VisulimaDevTools;
101
89
  }
102
90
  }
91
+ export type { VisulimaDevTools };