@visulima/dev-toolbar 1.0.0-alpha.31 → 1.0.0-alpha.33

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 (81) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/README.md +64 -17
  3. package/dist/apps/a11y/index.js +3 -3
  4. package/dist/apps/annotations/index.js +2 -2
  5. package/dist/apps/assets/index.js +2 -2
  6. package/dist/apps/inspector/index.js +11 -11
  7. package/dist/apps/module-graph/index.js +2 -2
  8. package/dist/apps/performance/index.js +2 -2
  9. package/dist/apps/seo/index.js +2 -2
  10. package/dist/apps/settings/index.js +2 -2
  11. package/dist/apps/tailwind/index.js +5 -5
  12. package/dist/apps/timeline/index.js +2 -2
  13. package/dist/apps/vite-config/index.js +2 -2
  14. package/dist/client/overlay.js +1 -1
  15. package/dist/index.d.ts +6 -16
  16. package/dist/index.js +1 -1
  17. package/dist/mcp/server.js +1 -1
  18. package/dist/packem_chunks/inject-source.js +9 -9
  19. package/dist/packem_shared/Alert-CZq7C43v.js +1 -0
  20. package/dist/packem_shared/Badge-PpblpNWg.js +1 -0
  21. package/dist/packem_shared/Button-CAKvtfij.js +1 -0
  22. package/dist/packem_shared/Card-BSy2oRiS.js +1 -0
  23. package/dist/packem_shared/Icon-0XYV-4AL.js +1 -0
  24. package/dist/packem_shared/{Input-Cs6aduTi.js → Input-Dc1WiT01.js} +1 -1
  25. package/dist/packem_shared/Label-BZh8XxUb.js +1 -0
  26. package/dist/packem_shared/Popover-DuiU8EPg.js +1 -0
  27. package/dist/packem_shared/Progress-C90LC--2.js +1 -0
  28. package/dist/packem_shared/Select-CwD-d0pi.js +1 -0
  29. package/dist/packem_shared/Separator-PSjfhX_W.js +1 -0
  30. package/dist/packem_shared/Skeleton-BAFrGUR1.js +1 -0
  31. package/dist/packem_shared/Switch-Wpsp5M3p.js +1 -0
  32. package/dist/packem_shared/Tabs-BdNFQd3c.js +1 -0
  33. package/dist/packem_shared/{Textarea-Yfg3dLZi.js → Textarea-DP9gpte-.js} +1 -1
  34. package/dist/packem_shared/Tooltip-DVeuszoY.js +1 -0
  35. package/dist/packem_shared/annotation-settings-DlLZO5Zp.js +1 -0
  36. package/dist/packem_shared/annotation-store-CXMIg0dM.js +1 -0
  37. package/dist/packem_shared/clsx-CtZWcPHt.js +1 -0
  38. package/dist/packem_shared/createClientRPCContext-80V9c3Qu.js +1 -0
  39. package/dist/packem_shared/createDevToolbarHook-CzejbqD2.js +1 -0
  40. package/dist/packem_shared/createServerRPCContext-C30tqEfQ.js +1 -0
  41. package/dist/packem_shared/getGlobalHook-GRSqUNJ3.js +1 -0
  42. package/dist/packem_shared/getTimelineStore-BT5sImVb.js +1 -0
  43. package/dist/packem_shared/{global-api.d-DG2WYakl.d.ts → global-api.d-DeaCvII9.d.ts} +3 -4
  44. package/dist/packem_shared/loadSettings-C0pUyx9j.js +1 -0
  45. package/dist/packem_shared/server.d-ZkcY0pge.d.ts +39 -0
  46. package/dist/packem_shared/sharedToolbarStylesheet-DNABzHAf.js +2 -0
  47. package/dist/packem_shared/store-Dqy0FbGw.js +1 -0
  48. package/dist/packem_shared/use-theme-DIqZkPAe.js +1 -0
  49. package/dist/toolbar/index.d.ts +1 -1
  50. package/dist/toolbar/index.js +3 -3
  51. package/dist/ui/index.js +1 -1
  52. package/dist/vite-plugin.d.ts +29 -1
  53. package/dist/vite-plugin.js +4 -4
  54. package/package.json +6 -6
  55. package/dist/packem_shared/Alert-D2CvX4fw.js +0 -1
  56. package/dist/packem_shared/Badge-BEgU04nl.js +0 -1
  57. package/dist/packem_shared/Button-Bkx66Co7.js +0 -1
  58. package/dist/packem_shared/Card-CJa4vHVc.js +0 -1
  59. package/dist/packem_shared/Icon-B6UHkC0o.js +0 -1
  60. package/dist/packem_shared/Label-DyCng4Cp.js +0 -1
  61. package/dist/packem_shared/Popover-BtFVaZYg.js +0 -1
  62. package/dist/packem_shared/Progress-DN6zn-0l.js +0 -1
  63. package/dist/packem_shared/Select-DgQ4ss-s.js +0 -1
  64. package/dist/packem_shared/Separator-D38mKeZv.js +0 -1
  65. package/dist/packem_shared/Skeleton-Dv-tcA1P.js +0 -1
  66. package/dist/packem_shared/Switch-C3NTpeoR.js +0 -1
  67. package/dist/packem_shared/Tabs-DKWMiawt.js +0 -1
  68. package/dist/packem_shared/Tooltip-CioncSXj.js +0 -1
  69. package/dist/packem_shared/annotation-settings-Bv0TH4WI.js +0 -1
  70. package/dist/packem_shared/annotation-store-bLQRYMaI.js +0 -1
  71. package/dist/packem_shared/clsx-wGlvpUfw.js +0 -1
  72. package/dist/packem_shared/createClientRPCContext-DgRxrllw.js +0 -1
  73. package/dist/packem_shared/createDevToolbarHook-4bZZiHPI.js +0 -1
  74. package/dist/packem_shared/createServerRPCContext-D-yZrEjs.js +0 -1
  75. package/dist/packem_shared/getTimelineStore-B1cfjWV8.js +0 -1
  76. package/dist/packem_shared/loadSettings-hvjR4fcS.js +0 -1
  77. package/dist/packem_shared/setupGlobalHook-CCf9Logv.js +0 -1
  78. package/dist/packem_shared/sharedToolbarStylesheet-pA-B0Jt2.js +0 -2
  79. package/dist/packem_shared/store-DaUtLjf3.js +0 -1
  80. package/dist/packem_shared/use-frame-state-CxrlPUM5.js +0 -1
  81. package/dist/packem_shared/use-theme-zpm4zmqP.js +0 -1
@@ -1,5 +1,5 @@
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-pA-B0Jt2.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?.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=`
1
+ import{createContext as je,render as me}from"preact";import{createClientRPCContext as De}from"../packem_shared/createClientRPCContext-80V9c3Qu.js";import{updateSettings as Se,loadSettings as Ie}from"../packem_shared/loadSettings-C0pUyx9j.js";import{getGlobalHook as Pe,setupGlobalHook as _e}from"../packem_shared/getGlobalHook-GRSqUNJ3.js";import ae from"../packem_shared/sharedToolbarStylesheet-DNABzHAf.js";import{jsx as i,jsxs as g,Fragment as ve}from"preact/jsx-runtime";import{addHookName as l}from"preact/devtools";import{clsx as h}from"../packem_shared/clsx-CtZWcPHt.js";import{useContext as Ne,useEffect as _,useMemo as q,useState as N,useRef as f,useCallback as oe,useLayoutEffect as Ve}from"preact/hooks";import K from"../packem_shared/Icon-0XYV-4AL.js";import{p as fe,u as Ae}from"../packem_shared/use-theme-DIqZkPAe.js";import{u as He}from"../packem_shared/store-Dqy0FbGw.js";const le=()=>{const e=De();return{rpc:new Proxy({},{get(t,r){return(...o)=>e.callServer(r,...o)}})}};class Le{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=le(),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?.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)}}const Me=je(void 0),be=()=>{const e=Ne(Me);if(!e)throw new Error("useToolbarContext must be used within ToolbarContext provider");return e},ke=()=>{const e=be();return{activeAppId:e.activeAppId,apps:e.apps,clearNotification:e.clearNotification,registerApp:e.registerApp,setNotification:e.setNotification,toggleApp:e.toggleApp,unregisterApp:e.unregisterApp}},We=(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},Be=()=>{const{state:e,updateState:t}=fe(),r=(n,c)=>{const p=c??!e.open;t({open:p,...p?{}:{viewMode:"default"}})},o=()=>{e.open&&t({open:!1,viewMode:"default"})};_(()=>{const n=e.keybindings?.toggle??"Alt+Shift+D",c=p=>{We(p,n)&&r()};return globalThis.window?.addEventListener("keydown",c),()=>{globalThis.window?.removeEventListener("keydown",c)}},[e.open,e.keybindings?.toggle]);const a=l(q(()=>e.open,[e.open]),"panelVisibleValue: boolean");return{closePanel:o,panelVisible:a,togglePanelVisible:r}},de=(e,t,r)=>Math.min(Math.max(e,t),r),pe=e=>typeof e=="string"?e.endsWith("px")?Number(e.slice(0,-2)):Number(e):e,we=e=>e<5?0:e>95?100:Math.abs(e-50)<2?50:e,Ze=()=>{if(globalThis.window===void 0)return{bottom:0,left:0,right:0,top:0};const e=getComputedStyle(document.documentElement);return{bottom:pe(e.getPropertyValue("env(safe-area-inset-bottom)")||"0"),left:pe(e.getPropertyValue("env(safe-area-inset-left)")||"0"),right:pe(e.getPropertyValue("env(safe-area-inset-right)")||"0"),top:pe(e.getPropertyValue("env(safe-area-inset-top)")||"0")}},Ge=()=>{const[e,t]=l(N(()=>({height:globalThis.window?.innerHeight??1080,width:globalThis.window?.innerWidth??1920})),"size");return _(()=>{const r=()=>{t({height:globalThis.window?.innerHeight??1080,width:globalThis.window?.innerWidth??1920})};return r(),globalThis.window?.addEventListener("resize",r),()=>{globalThis.window?.removeEventListener("resize",r)}},[]),e},Ye=e=>{const{state:t,updateState:r}=fe(),{height:o,width:a}=Ge(),[n,c]=l(N(!1),"isHovering"),[p,u]=l(N(!1),"isDragging"),[E,z]=l(N(!1),"isViteOverlayOpen"),A=l(f({x:0,y:0}),"draggingOffsetRef"),F=l(f({x:0,y:0}),"mousePositionRef"),V=l(f(void 0),"timerRef"),M=l(f(void 0),"capturedPointerIdRef"),Z=l(f(!1),"isDraggingRef"),R=l(f(a),"windowWidthRef"),P=l(f(o),"windowHeightRef"),H=l(f(r),"updateStateRef");_(()=>{R.current=a,P.current=o},[a,o]),_(()=>{H.current=r},[r]);const[w,$]=l(N(()=>({bottom:10,left:10,right:10,top:10})),"panelMargins");_(()=>{const v=Ze();$({bottom:v.bottom+10,left:v.left+10,right:v.right+10,top:v.top+10})},[]),_(()=>{const v=()=>{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)},C=setInterval(v,300);return v(),()=>{clearInterval(C)}},[]);const U=oe(v=>{v.preventDefault(),v.stopPropagation(),u(!0),Z.current=!0;const C=e.current;if(C){const{height:S,left:s,top:d,width:m}=C.getBoundingClientRect();A.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),M.current=v.pointerId):C.setPointerCapture&&(C.setPointerCapture(v.pointerId),M.current=v.pointerId)}catch(j){console.warn("Failed to capture pointer:",j)}document.body.style.cursor="grabbing",document.body.style.userSelect="none"}},[e]),G=oe(()=>{c(!0),!(t.minimizePanelInactive<0)&&(V.current&&clearTimeout(V.current),V.current=setTimeout(()=>{c(!1)},t.minimizePanelInactive||5e3))},[t.minimizePanelInactive]);_(()=>{G()},[G]),_(()=>{const v=()=>{if(M.current!==void 0){try{const b=e.current;b&&M.current!==void 0&&b.releasePointerCapture(M.current)}catch{}M.current=void 0}},C=()=>{Z.current&&(u(!1),Z.current=!1,document.body.style.cursor="",document.body.style.userSelect="",v())},S=b=>{C()},s=b=>{C()},d=()=>{Z.current&&(u(!1),Z.current=!1,M.current=void 0,document.body.style.cursor="",document.body.style.userSelect="")},m=b=>{if(!Z.current)return;b.preventDefault();const j=R.current,J=P.current,B=j/2,y=J/2,ie=b.clientX,O=b.clientY,ee=ie-A.current.x,te=O-A.current.y;F.current={x:ee,y:te};const ne=Math.max(0,Math.min(ie,j)),x=Math.max(0,Math.min(O,J)),T=Math.atan2(x-y,ne-B),I=70,Y=Math.atan2(0-y+I,0-B),re=Math.atan2(0-y+I,j-B),ce=Math.atan2(J-I-y,0-B),xe=Math.atan2(J-I-y,j-B);let se;T>=Y&&T<=re?se="top":T>=re&&T<=xe?se="right":T>=xe&&T<=ce?se="bottom":se="left";const Ee=Math.max(0,Math.min(100,ee/j*100)),Re=Math.max(0,Math.min(100,te/J*100));H.current({left:we(Ee),position:se,top:we(Re)})};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 k=l(q(()=>t.position==="left"||t.position==="right",[t.position]),"isVertical"),D=l(q(()=>{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&&!E},[p,t.open,t.minimizePanelInactive,n,E]),"isHidden"),L=l(q(()=>{const v=e.current,C=(v?.clientWidth??0)/2,S=(v?.clientHeight??0)/2,s=k?S:C,d=k?C: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:de(b,d+w.top,o-d-w.bottom)};case"right":return{left:a-w.right-s+(D?15:0)-(D?0:10),top:de(b,d+w.top,o-d-w.bottom)};case"top":return{left:de(m,s+w.left,a-s-w.right),top:w.top+d-(D?30:0)};default:return{left:de(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,k]),"anchorPos"),Q=l(q(()=>({left:`${L.left}px`,top:`${L.top}px`,transition:p?"none":"left 0.3s ease, top 0.3s ease"}),[L,p]),"anchorStyle"),X=l(q(()=>{const v=e.current,C=(v?.clientWidth??0)/2,S=(v?.clientHeight??0)/2,s=k?S:C,d=k?C:S,m={bottom:w.bottom+d,left:w.left+s,right:w.right+s,top:w.top+d},b=m.left+m.right,j=m.top+m.bottom,J=a-b,B=o-j,y={height:`min(${t.height}vh, calc(100vh - ${j}px))`,pointerEvents:p?"none":"auto",width:`min(${t.width}vw, calc(100vw - ${b}px))`,zIndex:"-1"},ie=L,O=Math.min(J,t.width*a/100),ee=Math.min(B,t.height*o/100),te=ie?.left??0,ne=ie?.top??0;switch(t.position){case"bottom":case"top":{y.left="0",y.transform="translate(-50%, 0)",te-m.left<O/2?y.left=`${O/2-te+m.left}px`:a-te-m.right<O/2&&(y.left=`${a-te-O/2-m.right}px`);break}default:{y.top="0",y.transform="translate(0, -50%)",ne-m.top<ee/2?y.top=`${ee/2-ne+m.top}px`:o-ne-m.bottom<ee/2&&(y.top=`${o-ne-ee/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},[L,p,w,t.height,t.position,t.width,o,a,e,k]),"iframeStyle"),W=l(q(()=>{const v={transform:k?"translate(-50%, -50%) rotate(90deg)":"translate(-50%, -50%)"};return p&&(v.transition="none !important"),v},[p,k]),"panelStyle");return{anchorStyle:Q,bringUp:G,iframeStyle:X,isDragging:p,isHidden:D,isVertical:k,onPointerDown:U,panelStyle:W}},Xe=({app:e})=>{const{toggleApp:t}=ke(),{isVisible:r,setHoveredApp:o}=be(),a=l(f(null),"buttonRef"),n=()=>{o(void 0),t(e.id).catch(u=>{console.error(`[dev-toolbar] Failed to toggle app ${e.id}:`,u)})},c=()=>{!e.tooltip||r||o(e,a.current?.getBoundingClientRect())},p=()=>{e.tooltip&&o(void 0)};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"})]})})},Ce="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",$e="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",Je="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",Oe="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",Ue="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",Qe="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",qe="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",Te="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",ze=({app:e})=>{const t=l(f(null),"contentRef"),r=l(f(!1),"initializedRef"),o=l(f(le()),"helpersRef");return _(()=>{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"});ae&&(c.adoptedStyleSheets=[ae]);const p=le(),u=e.init(c,e.eventTarget,p);return u&&typeof u.then=="function"?u.then(()=>{r.current=!0}).catch(E=>{console.error(`[dev-toolbar] Failed to init app ${e.id}:`,E)}):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})},Fe=e=>e==="error"?"bg-destructive":e==="warning"?"bg-warning":"bg-info",Ke=({apps:e,initialActiveAppId:t,onClose:r})=>{const[o,a]=l(N(t),"activeAppId"),[n,c]=l(N(!1),"sidebarCollapsed"),p=l(q(()=>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:()=>{a(u.id)},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",Fe(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:()=>{c(u=>!u)},type:"button",children:i(K,{class:h("size-3.5 transition-transform duration-300",!n&&"rotate-180"),size:14,src:Ce})}),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(K,{size:12,src:Te})})]}),i("div",{class:"devtools-content-scroll scrollbar-thin-border flex-1 overflow-auto min-h-0 bg-background",children:p?i(ze,{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"})})})]})]})},ue=20,he=95,ge=(e,t,r)=>Math.min(Math.max(e,t),r),et=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"}},tt=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]"}},rt=(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"),it=({activeAppId:e,apps:t,onClose:r,onToggleApp:o,panelVisible:a,position:n})=>{const[c,p]=l(N(!1),"isRendered"),[u,E]=l(N(!1),"isVisible"),[z,A]=l(N(!1),"sidebarCollapsed"),[,F]=l(N(0),"rerender"),{state:V,updateState:M}=fe(),{resolvedTheme:Z}=Ae(),R=l(f(null),"panelDivRef"),P=l(f(!1),"isResizingRef"),H=l(f({height:V.height,width:V.width}),"dimensionsRef"),w=l(f(void 0),"enteringFromRectRef"),$=l(f(void 0),"lastDockedRectRef"),U=l(f(!1),"previousIsFullscreenRef"),G=l(f(!1),"isExitAnimatingRef"),k=l(f(void 0),"fsTimerRef"),D=V.viewMode==="fullscreen",L=V.viewMode==="wide",Q=globalThis.window?.documentPictureInPicture!==void 0,X=l(f(void 0),"pipWindowRef"),W=l(q(()=>{if(D)return{};const s=globalThis.window?.innerWidth??1920,d=globalThis.window?.innerHeight??1080,m=`${H.current.height/100*d}px`;return n==="left"||n==="right"?{width:`${H.current.width/100*s}px`}:{height:m,left:"50%",transform:"translateX(-50%)",width:L?"calc(100vw - 2rem)":"min(calc(100vw - 2rem), 1280px)"}},[D,L,n,F]),"panelSizeStyle");_(()=>{const s=m=>{if(!P.current||!R.current)return;const b=R.current.getBoundingClientRect(),j=window.innerWidth,J=window.innerHeight,B={...H.current};if(P.current.top){const y=Math.abs(b.bottom-m.clientY);B.height=ge(y/J*100,ue,he)}else if(P.current.bottom){const y=Math.abs(m.clientY-b.top);B.height=ge(y/J*100,ue,he)}else if(P.current.right){const y=Math.abs(m.clientX-b.left);B.width=ge(y/j*100,ue,he)}else if(P.current.left){const y=Math.abs(b.right-m.clientX);B.width=ge(y/j*100,ue,he)}H.current=B,F(y=>y+1)},d=()=>{P.current&&(M({height:H.current.height,width:H.current.width}),P.current=!1)};return globalThis.addEventListener("mousemove",s),globalThis.addEventListener("mouseup",d),()=>{globalThis.removeEventListener("mousemove",s),globalThis.removeEventListener("mouseup",d)}},[M]),Ve(()=>{const s=U.current;U.current=D,k.current!==void 0&&(clearTimeout(k.current),k.current=void 0);const d=R.current;if(d)if(D&&!s&&w.current){const m=w.current;w.current=void 0;const b=globalThis.window?.innerWidth??0,j=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 ${j-m.bottom}px ${m.left}px)`,requestAnimationFrame(()=>{d.style.clipPath="inset(0px 0px 0px 0px)",k.current=setTimeout(()=>{d.style.clipPath="",d.style.transition="",k.current=void 0},380)})}else!D&&s&&!G.current&&(d.style.transition="none",d.style.clipPath="",requestAnimationFrame(()=>{d.style.transition=""}))},[D]),_(()=>{if(a){p(!0);const d=setTimeout(E,16,!0);return()=>{clearTimeout(d)}}E(!1);const s=setTimeout(p,220,!1);return()=>{clearTimeout(s)}},[a]);const v=async()=>{const s=globalThis.window?.documentPictureInPicture;if(s)try{const d=await s.requestWindow({height:600,width:900});if(X.current=d,ae){const b=d.document.createElement("style");b.textContent=Array.from(ae.cssRules,j=>j.cssText).join(`
2
+ `),d.document.head.append(b)}const m=d.document.createElement("div");m.style.cssText="width:100%;height:100%;display:flex;",Z==="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),me(i(Ke,{apps:t,initialActiveAppId:e,onClose:()=>{d.close()}}),m),M({isPip:!0}),d.addEventListener("pagehide",()=>{M({isPip:!1}),X.current=void 0})}catch(d){console.error("[dev-toolbar] PiP activation failed:",d)}};_(()=>{if(!a)return;const s=d=>{d.key==="Escape"&&r()};return document.addEventListener("keydown",s),()=>{document.removeEventListener("keydown",s)}},[a,r]);const C=l(q(()=>t.find(s=>s.id===e),[t,e]),"activeApp");if(!c)return;const S=s=>d=>{d.preventDefault(),P.current=s};return g(ve,{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:V.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":et(n),"bg-background overflow-hidden",D?"rounded-none border-0":"rounded-none border border-border","shadow-2xl","transition-panel",!D&&tt(n),rt(n,u),"flex flex-row"),ref:R,role:"dialog",style:W,children:[!D&&g(ve,{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:()=>{s.id!==e&&o(s.id).catch(console.error)},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",Fe(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:[V.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:()=>{A(s=>!s)},type:"button",children:i(K,{class:h("size-3.5 transition-transform duration-300",!z&&"rotate-180"),size:14,src:Ce})}),C?.icon&&i("span",{class:"size-5 flex items-center justify-center [&_svg]:size-5 shrink-0 text-foreground opacity-80",dangerouslySetInnerHTML:{__html:C.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:"["}),C?.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":L?"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:L?"default":"wide"})},title:L?"Container width":"Full width",type:"button",children:i(K,{size:13,src:L?Qe:Oe})}),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:()=>{if(D){const s=R.current,d=$.current;if(s&&d){const m=globalThis.window?.innerWidth??0,b=globalThis.window?.innerHeight??0,j=`inset(${d.top}px ${m-d.right}px ${b-d.bottom}px ${d.left}px)`;k.current!==void 0&&(clearTimeout(k.current),k.current=void 0),G.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=j,k.current=setTimeout(()=>{s.style.clipPath="",s.style.transition="",G.current=!1,k.current=void 0,M({viewMode:"default"})},380)})}else M({viewMode:"default"})}else{if(R.current){const s=R.current.getBoundingClientRect();w.current=s,$.current=s}M({viewMode:"fullscreen"})}},title:D?"Exit fullscreen":"Fullscreen",type:"button",children:i(K,{size:13,src:D?Ue:Je})}),Q&&!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",V.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:()=>{v().then(()=>{r()}).catch(console.error)},title:"Open in floating window (PiP)",type:"button",children:i(K,{size:13,src:qe})}),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(K,{size:12,src:Te})})]})]}),i("div",{class:"devtools-content-scroll scrollbar-thin-border flex-1 overflow-auto min-h-0 bg-background",children:C?i(ze,{app:C},C.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(K,{class:"text-primary/45",size:26,src:$e})}),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:()=>o(s.id).catch(console.error),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))})]})]})})]})]})]})},nt="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",ot=()=>{const[e,t]=l(N(0),"errorCount"),[r,o]=l(N(!1),"isOverlayOpen");if(_(()=>{const c=()=>{const u=globalThis.__v_o_error_history,E=Array.isArray(u)?u.length:0;t(E);const z=globalThis.__v_o__current;if(z?.parentNode){const A=z.shadowRoot?.querySelector("#__v_o__root");o(!!A&&!A.classList.contains("hidden"))}else o(!1)},p=setInterval(c,300);return c(),()=>{clearInterval(p)}},[]),e===0)return;const a=()=>{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))},n=`${e} error${e===1?"":"s"} – click to ${r?"hide":"show"} overlay`;return g(ve,{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(K,{size:16,src:nt}),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})]})})]})},at=()=>{const{apps:e}=ke();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(Xe,{app:t},t.id)),i(ot,{})]})})},st="data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMjQ4IDI5MSIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4gPGRlZnM+IDxsaW5lYXJHcmFkaWVudCBpZD0iYSIgZ3JhZGllbnRVbml0cz0ib2JqZWN0Qm91bmRpbmdCb3giIHgxPSIwIiB5MT0iMCIgeDI9IjEiIHkyPSIxIj4gPHN0b3Agb2Zmc2V0PSIwIiBzdG9wLWNvbG9yPSJyZWQiPiA8YW5pbWF0ZSBhdHRyaWJ1dGVOYW1lPSJzdG9wLWNvbG9yIiB2YWx1ZXM9InJlZDtwdXJwbGU7Ymx1ZTtyZWQ7IiBkdXI9IjIwcyIgcmVwZWF0Q291bnQ9ImluZGVmaW5pdGUiIC8+IDwvc3RvcD4gPHN0b3Agb2Zmc2V0PSIwLjUiIHN0b3AtY29sb3I9InB1cnBsZSI+IDxhbmltYXRlIGF0dHJpYnV0ZU5hbWU9InN0b3AtY29sb3IiIHZhbHVlcz0icHVycGxlO2JsdWU7cmVkO3B1cnBsZTsiIGR1cj0iMjBzIiByZXBlYXRDb3VudD0iaW5kZWZpbml0ZSIgLz4gPC9zdG9wPiA8c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9ImJsdWUiPiA8YW5pbWF0ZSBhdHRyaWJ1dGVOYW1lPSJzdG9wLWNvbG9yIiB2YWx1ZXM9ImJsdWU7cmVkO3B1cnBsZTtibHVlOyIgZHVyPSIyMHMiIHJlcGVhdENvdW50PSJpbmRlZmluaXRlIiAvPiA8L3N0b3A+IDxhbmltYXRlVHJhbnNmb3JtIGF0dHJpYnV0ZU5hbWU9ImdyYWRpZW50VHJhbnNmb3JtIiB0eXBlPSJyb3RhdGUiIGZyb209IjAgLjUgLjUiIHRvPSIzNjAgLjUgLjUiIGR1cj0iMTBzIiByZXBlYXRDb3VudD0iaW5kZWZpbml0ZSIgLz4gPC9saW5lYXJHcmFkaWVudD4gPGxpbmVhckdyYWRpZW50IGlkPSJvdmVybGF5R3JhZGllbnRBIiB4MT0iNjIiIHkxPSI0Mi4yMjUzIiB4Mj0iNjIiIHkyPSIyOTAuMjI1IiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSI+IDxzdG9wIG9mZnNldD0iMC4zNCIgc3RvcC1vcGFjaXR5PSIwLjUiIC8+IDxzdG9wIG9mZnNldD0iMSIgc3RvcC1jb2xvcj0id2hpdGUiIHN0b3Atb3BhY2l0eT0iMCIgLz4gPC9saW5lYXJHcmFkaWVudD4gPGxpbmVhckdyYWRpZW50IGlkPSJvdmVybGF5R3JhZGllbnRCIiB4MT0iMTg2IiB5MT0iMCIgeDI9IjE4NiIgeTI9IjI0OCIgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiPiA8c3RvcCBzdG9wLWNvbG9yPSJ3aGl0ZSIgc3RvcC1vcGFjaXR5PSIwIiAvPiA8c3RvcCBvZmZzZXQ9IjAuNjk1IiBzdG9wLW9wYWNpdHk9IjAuNSIgLz4gPC9saW5lYXJHcmFkaWVudD4gPC9kZWZzPiA8cGF0aCBkPSJNMCAxNjYuMjI1QzAgMjM0LjcwOSA1NS41MTY3IDI5MC4yMjUgMTI0IDI5MC4yMjVWNDIuMjI1M0M1NS41MTY3IDQyLjIyNTMgMCA5Ny43NDIgMCAxNjYuMjI1WiBNMjQ4IDEyNEMyNDggMTkyLjQ4MyAxOTIuNDgzIDI0OCAxMjQgMjQ4VjBDMTkyLjQ4MyAwIDI0OCA1NS41MTY3IDI0OCAxMjRaIiBmaWxsPSJ1cmwoI2EpIiAvPiA8cGF0aCBkPSJNMCAxNjYuMjI1QzAgMjM0LjcwOSA1NS41MTY3IDI5MC4yMjUgMTI0IDI5MC4yMjVWNDIuMjI1M0M1NS41MTY3IDQyLjIyNTMgMCA5Ny43NDIgMCAxNjYuMjI1WiIgZmlsbD0idXJsKCNvdmVybGF5R3JhZGllbnRBKSIgLz4gPHBhdGggZD0iTTI0OCAxMjRDMjQ4IDE5Mi40ODMgMTkyLjQ4MyAyNDggMTI0IDI0OFYwQzE5Mi40ODMgMCAyNDggNTUuNTE2NyAyNDggMTI0WiIgZmlsbD0idXJsKCNvdmVybGF5R3JhZGllbnRCKSIgLz4gPGNpcmNsZSBjeD0iMTI0IiBjeT0iMTQ3IiByPSI1MCIgZmlsbD0id2hpdGUiIC8+IDwvc3ZnPg==",lt="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",ct=(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%)"}}},dt=({position:e})=>{const{hoveredApp:t,hoveredAppRect:r,pinTooltip:o,setHoveredApp:a}=be(),n=l(f(null),"overlayRef"),c=l(f(le()),"helpersRef"),[p,u]=l(N(!1),"isRendered"),[E,z]=l(N(!1),"isVisible"),A=!!(t?.tooltip&&r);if(_(()=>{if(A){u(!0);const P=setTimeout(z,16,!0);return()=>{clearTimeout(P)}}z(!1);const R=setTimeout(u,200,!1);return()=>{clearTimeout(R)}},[A]),!p||!t?.tooltip||!r)return;const F=t.tooltip,V=ct(r,e),M=e==="left"||e==="right",Z=()=>{const R=n.current?.getBoundingClientRect();R&&o(t,R.left,R.top),a(void 0)};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)]",E?"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:()=>{a(t,r)},onMouseLeave:()=>{a(void 0)},ref:n,role:"tooltip",style:V,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:Z,title:"Pin (keep visible)",type:"button",children:i(K,{size:11,src:lt})})]}),i("div",{class:"p-3",children:i(F,{helpers:c.current})})]})},pt=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))"}}},ut=({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")})}},ht=[{icon:"⊙",text:"Click logo to open panel"},{icon:"⠿",text:"Drag pill to reposition"},{icon:"⌨",text:"Alt+Shift+D to toggle"}],gt=({onDismiss:e,position:t})=>{const[r,o]=l(N(!1),"visible"),a=l(f(void 0),"dismissTimeoutRef");_(()=>{const c=setTimeout(o,600,!0);return()=>{clearTimeout(c)}},[]),_(()=>()=>{a.current!==void 0&&(clearTimeout(a.current),a.current=void 0)},[]);const n=()=>{o(!1),a.current=setTimeout(e,180)};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:pt(t),children:[i(ut,{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:ht.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"})]})},ft="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",mt=({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(le()),"helpersRef"),u=l(f(e),"onMoveRef"),E=l(f(r.id),"pinnedIdRef");u.current=e,E.current=r.id,_(()=>{const F="transform 110ms cubic-bezier(0.25,0.46,0.45,0.94)",V=Z=>{if(!c.current||!o.current)return;const R=globalThis.window?.innerWidth??9999,P=globalThis.window?.innerHeight??9999,{cardH:H,cardW:w}=c.current,$=Math.min(80,w),U=Math.min(36,H);let G=c.current.origX+(Z.clientX-c.current.startX),k=c.current.origY+(Z.clientY-c.current.startY);G=Math.max($-w,Math.min(R-$,G)),k=Math.max(U-H,Math.min(P-U,k));const D=[0,R-w,$-w,R-$],L=[0,P-H,U-H,P-U];let Q=G,X=k;for(const W of D)if(Math.abs(G-W)<28){Q=W;break}for(const W of L)if(Math.abs(k-W)<28){X=W;break}o.current.style.transition=Q!==G||X!==k?F:"",o.current.style.transform=`translate(${Q}px, ${X}px)`,n.current={x:Q,y:X}},M=()=>{c.current&&(c.current=void 0,o.current&&(o.current.style.transition=""),a.current&&(a.current.style.cursor=""),u.current(E.current,n.current.x,n.current.y))};return document.addEventListener("mousemove",V),document.addEventListener("mouseup",M),()=>{document.removeEventListener("mousemove",V),document.removeEventListener("mouseup",M)}},[]);const z=r.app.tooltip;if(!z)return;const A=F=>{F.button===0&&(c.current={cardH:o.current?.offsetHeight??200,cardW:o.current?.offsetWidth??300,origX:n.current.x,origY:n.current.y,startX:F.clientX,startY:F.clientY},a.current&&(a.current.style.cursor="grabbing"),F.preventDefault())};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:A,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:()=>{t(r.id)},onMouseDown:F=>{F.stopPropagation()},title:"Unpin",type:"button",children:i(K,{size:11,src:ft})})]}),i("div",{class:"p-3",children:i(z,{helpers:p.current})})]})},ye="__v_dt__pinned_tooltips",vt=(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"}},bt=({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"),E=l(f(void 0),"leaveTimerRef"),{resolvedTheme:z}=Ae(),{state:A,updateState:F}=fe(),{closePanel:V,panelVisible:M,togglePanelVisible:Z}=Be(),{anchorStyle:R,bringUp:P,isDragging:H,isHidden:w,isVertical:$,onPointerDown:U,panelStyle:G}=Ye(u),[k,D]=l(N(void 0),"hoveredApp"),[L,Q]=l(N(void 0),"hoveredAppRect"),X=l(f(new Map),"pinPositionsRef"),W=oe(x=>{try{const T=x.map(I=>{const Y=X.current.get(I.id);return{appId:I.app.id,x:Y?.x??I.initialX,y:Y?.y??I.initialY}});localStorage.setItem(ye,JSON.stringify(T))}catch{}},[]),[v,C]=l(N([]),"pinnedTooltips"),S=l(f([]),"pinnedTooltipsRef");S.current=v;const s=oe((x,T,I)=>{const Y=`${x.id}-${Date.now()}`;C(re=>{const ce=[...re,{app:x,id:Y,initialX:T,initialY:I}];return W(ce),ce})},[W]),d=oe(x=>{C(T=>{const I=T.filter(Y=>Y.id!==x);return X.current.delete(x),W(I),I})},[W]),m=oe((x,T,I)=>{X.current.set(x,{x:T,y:I}),W(S.current)},[W]),b=l(f(void 0),"storedPinsRef"),j=l(f(new Set),"restoredAppIdsRef");_(()=>{if(t.length===0)return;if(b.current===void 0)try{const I=localStorage.getItem(ye);b.current=I?JSON.parse(I):[]}catch{b.current=[]}const x=b.current;if(x.length===0)return;const T=[];for(const I of x){if(j.current.has(I.appId))continue;const Y=t.find(re=>re.id===I.appId&&re.tooltip);Y&&(j.current.add(I.appId),T.push({app:Y,id:`${Y.id}-restored-${Date.now()}-${Math.random().toString(36).slice(2)}`,initialX:I.x,initialY:I.y}))}T.length>0&&C(I=>[...I,...T])},[t]),_(()=>()=>{E.current!==void 0&&clearTimeout(E.current)},[]);const J=oe((x,T)=>{E.current!==void 0&&(clearTimeout(E.current),E.current=void 0),x?(D(x),Q(T)):E.current=setTimeout(()=>{D(void 0),Q(void 0),E.current=void 0},180)},[]),B=l(f(t),"appsRef");B.current=t;const y=l(f(M),"panelVisibleRef");y.current=M;const ie=l(f(e),"activeAppIdRef");ie.current=e;const O=l(f(n),"onToggleAppRef");O.current=n;const ee=l(q(()=>{const x=globalThis.window?.innerWidth??1920,T=globalThis.window?.innerHeight??1080;return vt(A.position,A.left,A.top,x,T)},[A.left,A.position,A.top]),"placement"),te=oe(async x=>{const T=y.current,I=ie.current,Y=B.current.find(re=>re.id===x);if(Y?.onClick??Y?.onDeactivate){await O.current(x);return}if(x===I&&T){await O.current(x),F({open:!1,viewMode:"default"});return}x!==I&&await O.current(x),T||F({open:!0})},[F]),ne={activeAppId:e,apps:t,clearNotification:r,hoveredApp:k,hoveredAppRect:L,isDragging:H,isVisible:M,pinnedTooltips:v,pinTooltip:s,placement:ee,registerApp:o,setDragging:()=>{},setHoveredApp:J,setNotification:a,setPlacement:()=>{},setVisible:x=>{F({open:x})},toggleApp:te,unpinTooltip:d,unregisterApp:c};if(!(!A.preferShowFloatingPanel&&!M))return i(Me.Provider,{value:ne,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",A.reduceMotion&&"transition-none! animate-none! [&_*]:transition-none! [&_*]:animate-none!"),"data-dragging":H?"":void 0,"data-placement":ee,id:"__v_dt__root",onMouseMove:P,ref:p,style:R,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",H?"cursor-grabbing":"cursor-grab","bg-background border-0",$?"shadow-pill-vertical!":"shadow-pill",w?"max-w-12!":"","transition-pill"),"data-vertical":$||void 0,onPointerDown:x=>{A.isFirstVisit&&F({isFirstVisit:!1}),U(x)},ref:u,style:G,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]",M?"opacity-100":"opacity-60"),onClick:x=>{x.stopPropagation(),A.isFirstVisit&&F({isFirstVisit:!1}),Z()},title:"Toggle devtools panel",type:"button",children:i("img",{alt:"Visulima",class:"size-6",src:st})}),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(at,{})})]}),A.isFirstVisit&&i(gt,{onDismiss:()=>{F({isFirstVisit:!1})},position:A.position})]}),i(it,{activeAppId:e,apps:t,onClose:V,onToggleApp:n,panelVisible:M,position:A.position}),i(dt,{position:A.position}),v.map(x=>i(mt,{onMove:m,onUnpin:d,pinned:x},x.id))]})})},xt=(e,t)=>{const r=De(),o=Pe();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 Ie()},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){Se(a)},version:"0.0.0"}},wt=e=>{globalThis.window!==void 0&&(globalThis.__VISULIMA_DEVTOOLS__=e)};class yt extends HTMLElement{appManager;hasBeenInitialized=!1;renderRoot=void 0;constructor(){super(),this.attachShadow({mode:"open"}),this.appManager=new Le}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&&(me(null,this.renderRoot),this.renderRoot=void 0)}init(){if(this.hasBeenInitialized)return;this.hasBeenInitialized=!0;const t=_e(n=>{this.appManager.registerApp(n),this.render()},(n,c)=>{He().addEvent(n,c)}),r=xt({clearNotification:n=>{this.appManager.clearNotification(n),this.render()},getActiveApp:()=>this.appManager.getActiveApp(),getApps:()=>this.appManager.getAllApps(),registerApp:n=>{this.appManager.registerApp(n),this.render()},setAppActive:(n,c)=>{this.appManager.setAppActive(n,c),this.render()},setNotification:(n,c,p)=>{this.appManager.setNotification(n,c,p),this.render()},toggleApp:n=>this.appManager.toggleApp(n),unregisterApp:n=>{this.appManager.unregisterApp(n),this.render()}},{hide:()=>{this.setToolbarVisible(!1)},show:()=>{this.setToolbarVisible(!0)},toggle:()=>{const n=this.isHidden();this.setToolbarVisible(!n)}});wt(r),t.emit("devtools:init");const o=Ie(),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;ae&&(r.adoptedStyleSheets=[ae]);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 Ye=Object.defineProperty;var _=(e,t)=>Ye(e,"name",{value:t,configurable:!0})
18
18
  display: none;
19
19
  }
20
20
  }
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};
21
+ `,r.append(o)),this.renderRoot||(this.renderRoot=document.createElement("div"),r.append(this.renderRoot));const a=this.appManager.getActiveApp()?.id;me(i(bt,{activeAppId:a,apps:t,onClearNotification:n=>{this.appManager.clearNotification(n),this.render()},onRegisterApp:n=>{this.render()},onSetNotification:(n,c,p)=>{this.appManager.setNotification(n,c,p),this.render()},onToggleApp:async n=>{await this.appManager.toggleApp(n),this.render()},onUnregisterApp:n=>{this.appManager.unregisterApp(n),this.render()}}),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",yt),!customElements.get("dev-toolbar-app-canvas"))){class e extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"})}}customElements.define("dev-toolbar-app-canvas",e)}export{yt as DevToolbar,ae as sharedToolbarStylesheet};
package/dist/ui/index.js CHANGED
@@ -1 +1 @@
1
- import{Alert as o,AlertDescription as r,AlertTitle as a}from"../packem_shared/Alert-D2CvX4fw.js";import{default as p}from"../packem_shared/Badge-BEgU04nl.js";import{default as s}from"../packem_shared/Button-Bkx66Co7.js";import{Card as d,CardContent as m,CardDescription as n,CardFooter as i,CardHeader as u,CardTitle as T}from"../packem_shared/Card-CJa4vHVc.js";import{default as c}from"../packem_shared/Icon-B6UHkC0o.js";import{default as S}from"../packem_shared/Input-Cs6aduTi.js";import{default as P}from"../packem_shared/Label-DyCng4Cp.js";import{Popover as A,PopoverClose as I,PopoverContent as B,PopoverTrigger as D}from"../packem_shared/Popover-BtFVaZYg.js";import{default as h}from"../packem_shared/Progress-DN6zn-0l.js";import{Select as w,SelectContent as F,SelectItem as H,SelectTrigger as V,SelectValue as j,useSelectContext as q}from"../packem_shared/Select-DgQ4ss-s.js";import{default as z}from"../packem_shared/Separator-D38mKeZv.js";import{default as G}from"../packem_shared/Skeleton-Dv-tcA1P.js";import{default as K}from"../packem_shared/Switch-C3NTpeoR.js";import{Tabs as N,TabsContent as O,TabsList as Q,TabsTrigger as R}from"../packem_shared/Tabs-DKWMiawt.js";import{default as W}from"../packem_shared/Textarea-Yfg3dLZi.js";import{Tooltip as Y,TooltipContent as Z,TooltipTrigger as _}from"../packem_shared/Tooltip-CioncSXj.js";import{clsx as ee}from"../packem_shared/clsx-wGlvpUfw.js";export{o as Alert,r as AlertDescription,a as AlertTitle,p as Badge,s as Button,d as Card,m as CardContent,n as CardDescription,i as CardFooter,u as CardHeader,T as CardTitle,c as Icon,S as Input,P as Label,A as Popover,I as PopoverClose,B as PopoverContent,D as PopoverTrigger,h as Progress,w as Select,F as SelectContent,H as SelectItem,V as SelectTrigger,j as SelectValue,z as Separator,G as Skeleton,K as Switch,N as Tabs,O as TabsContent,Q as TabsList,R as TabsTrigger,W as Textarea,Y as Tooltip,Z as TooltipContent,_ as TooltipTrigger,ee as clsx,q as useSelectContext};
1
+ import{Alert as o,AlertDescription as r,AlertTitle as a}from"../packem_shared/Alert-CZq7C43v.js";import{default as p}from"../packem_shared/Badge-PpblpNWg.js";import{default as s}from"../packem_shared/Button-CAKvtfij.js";import{Card as d,CardContent as m,CardDescription as n,CardFooter as i,CardHeader as u,CardTitle as T}from"../packem_shared/Card-BSy2oRiS.js";import{default as c}from"../packem_shared/Icon-0XYV-4AL.js";import{default as S}from"../packem_shared/Input-Dc1WiT01.js";import{default as P}from"../packem_shared/Label-BZh8XxUb.js";import{Popover as A,PopoverClose as I,PopoverContent as B,PopoverTrigger as D}from"../packem_shared/Popover-DuiU8EPg.js";import{default as h}from"../packem_shared/Progress-C90LC--2.js";import{Select as w,SelectContent as F,SelectItem as H,SelectTrigger as V,SelectValue as j,useSelectContext as q}from"../packem_shared/Select-CwD-d0pi.js";import{default as z}from"../packem_shared/Separator-PSjfhX_W.js";import{default as G}from"../packem_shared/Skeleton-BAFrGUR1.js";import{default as K}from"../packem_shared/Switch-Wpsp5M3p.js";import{Tabs as N,TabsContent as O,TabsList as Q,TabsTrigger as R}from"../packem_shared/Tabs-BdNFQd3c.js";import{default as W}from"../packem_shared/Textarea-DP9gpte-.js";import{Tooltip as Y,TooltipContent as Z,TooltipTrigger as _}from"../packem_shared/Tooltip-DVeuszoY.js";import{clsx as ee}from"../packem_shared/clsx-CtZWcPHt.js";export{o as Alert,r as AlertDescription,a as AlertTitle,p as Badge,s as Button,d as Card,m as CardContent,n as CardDescription,i as CardFooter,u as CardHeader,T as CardTitle,c as Icon,S as Input,P as Label,A as Popover,I as PopoverClose,B as PopoverContent,D as PopoverTrigger,h as Progress,w as Select,F as SelectContent,H as SelectItem,V as SelectTrigger,j as SelectValue,z as Separator,G as Skeleton,K as Switch,N as Tabs,O as TabsContent,Q as TabsList,R as TabsTrigger,W as Textarea,Y as Tooltip,Z as TooltipContent,_ as TooltipTrigger,ee as clsx,q as useSelectContext};
@@ -1,6 +1,7 @@
1
1
  import { Plugin } from 'vite';
2
+ import { R as ReadFileOptions } from "./packem_shared/server.d-ZkcY0pge.js";
2
3
  import { D as DevToolbarApp, S as ServerFunctions } from "./packem_shared/app.d-SmKEDxsI.js";
3
- import "./packem_shared/global-api.d-DG2WYakl.js";
4
+ import "./packem_shared/global-api.d-DeaCvII9.js";
4
5
  import '@babel/generator';
5
6
  import 'preact';
6
7
  interface InjectSourceIgnore {
@@ -68,6 +69,17 @@ interface DevToolbarOptions {
68
69
  */
69
70
  editor?: string;
70
71
  /**
72
+ * Master switch for the whole plugin. When `false`, `devToolbar()` returns an
73
+ * empty plugin array, so no virtual modules, RPC server, or client overlay are
74
+ * registered — the equivalent of removing the plugin from `vite.config.ts`
75
+ * without editing the config.
76
+ *
77
+ * Handy for CI/preview environments:
78
+ * `devToolbar({ enabled: !process.env.CI })`.
79
+ * @default true
80
+ */
81
+ enabled?: boolean;
82
+ /**
71
83
  * Initial panel height as a percentage of the viewport height (20–95).
72
84
  * @default 60
73
85
  */
@@ -116,6 +128,19 @@ interface DevToolbarOptions {
116
128
  */
117
129
  position?: "bottom" | "left" | "right" | "top";
118
130
  /**
131
+ * Policy for the built-in `readFile` RPC endpoint, which lets toolbar apps read
132
+ * text files under the project root.
133
+ *
134
+ * Set to `false` to remove the endpoint entirely — recommended when the dev
135
+ * server is exposed on the network (`vite --host`), since any device on the LAN
136
+ * can then call RPC methods. Pass an object to override the allowed extensions.
137
+ *
138
+ * By default the endpoint is restricted to a curated allowlist of source/markup/
139
+ * text extensions, so `.env`, lockfiles, and key material are never served.
140
+ * @default { extensions: curated source/text list }
141
+ */
142
+ readFile?: ReadFileOptions | false;
143
+ /**
119
144
  * Reduce motion for accessibility (disables all CSS animations).
120
145
  * @default false
121
146
  */
@@ -153,6 +178,9 @@ interface DevToolbarOptions {
153
178
  }
154
179
  /**
155
180
  * Returns the Vite plugin array for the dev toolbar.
181
+ *
182
+ * Returns an empty array when `options.enabled === false`, so the plugin can be
183
+ * gated for CI/preview builds without removing it from `vite.config.ts`.
156
184
  */
157
185
  declare const devToolbar: (options?: DevToolbarOptions) => Plugin[];
158
186
  export { DevToolbarOptions, devToolbar };
@@ -1,5 +1,5 @@
1
- var O=Object.defineProperty;var g=(e,r)=>O(e,"name",{value:r,configurable:!0});import{createRequire as x}from"node:module";import{normalizePath as I}from"vite";import{createServerRPCContext as k}from"./packem_shared/createServerRPCContext-D-yZrEjs.js";const F=x(import.meta.url),d=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,b=g(e=>{if(typeof d<"u"&&d.versions&&d.versions.node){const[r,f]=d.versions.node.split(".").map(Number);if(r>22||r===22&&f>=3||r===20&&f>=16)return d.getBuiltinModule(e)}return F(e)},"__cjs_getBuiltinModule"),P=b("node:fs"),T=b("node:path"),{fileURLToPath:S}=b("node:url");var R=Object.defineProperty,m=g((e,r)=>R(e,"name",{value:r,configurable:!0}),"u");const q=m(()=>I(T.dirname(S(import.meta.url))),"getDevToolbarPath"),D=/\?.+$/,M=/\/dist\/|\/build\//,N=/\.[jt]sx$/,W=m(e=>e.replace(D,""),"removeUrlQuery"),w="?__visulima-dev-toolbar-resource",h="virtual:visulima-dev-toolbar-options",_=`\0${h}`,u="virtual:visulima-dev-toolbar-path:",j="\0__visulima-dev-toolbar-empty",E=m((e={})=>{const r=q(),f=e.removeDevtoolsOnBuild??!0,$=e.injectSource?.enabled??!0;let v;return[{apply:"serve",config(){return{server:{watch:{ignored:["**/.devtoolbar/**"]}}}},configResolved(t){if(v=t,!e.appendTo){const o=new Set(t.plugins.map(n=>n.name));(o.has("tanstack-start-core:config")||o.has("tanstack-react-start:config"))&&(e.appendTo=/router\.tsx$/)}const a=/dev-toolbar[\\/]dist[\\/]|__visulima-dev-toolbar-resource/;for(const o of t.plugins){if(!o.name.includes("babel"))continue;const n=o.transform;if(!n)continue;const i=typeof n=="function"?n:typeof n=="object"&&"handler"in n?n.handler:void 0;if(typeof i!="function")continue;const s=m(function(l,c,...p){if(!a.test(c))return i.call(this,l,c,...p)},"wrapper");typeof n=="function"?o.transform=s:n.handler=s}},configureServer(t){k(t,e.serverFunctions,{editor:e.editor}),t.ws.on("connection",()=>{t.ws.send({event:"dev-toolbar:init",type:"custom"})}),t.middlewares.use("/__devtoolbar/events",async(a,o)=>{o.writeHead(200,{"Cache-Control":"no-cache",Connection:"keep-alive","Content-Type":"text/event-stream","X-Accel-Buffering":"no"});const n=m((c,p)=>{o.write(`event: ${c}
2
- data: ${JSON.stringify(p)}
1
+ import{createRequire as O}from"node:module";import{normalizePath as R}from"vite";import{createServerRPCContext as N}from"./packem_shared/createServerRPCContext-C30tqEfQ.js";const M=O(import.meta.url),u=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,y=e=>{if(typeof u<"u"&&u.versions&&u.versions.node){const[p,f]=u.versions.node.split(".").map(Number);if(p>22||p===22&&f>=3||p===20&&f>=16)return u.getBuiltinModule(e)}return M(e)},S=y("node:fs"),x=y("node:path"),{fileURLToPath:I}=y("node:url"),P=()=>R(x.dirname(I(import.meta.url))),q=/\?.+$/,D=/\/dist\/|\/build\//,W=/\.[jt]sx$/,B=e=>e.replace(q,""),_="?__visulima-dev-toolbar-resource",b="virtual:visulima-dev-toolbar-options",j=`\0${b}`,m="virtual:visulima-dev-toolbar-path:",$="\0__visulima-dev-toolbar-empty",T=(e,p)=>typeof e!="number"||!Number.isFinite(e)?p:Math.min(95,Math.max(20,e)),U=(e={})=>{if(e.enabled===!1)return[];const p=P(),f=e.removeDevtoolsOnBuild??!0,C=e.injectSource?.enabled??!0;let v;const F={apply:"serve",config(){return{server:{watch:{ignored:["**/.devtoolbar/**"]}}}},configResolved(t){if(v=t,!e.appendTo){const o=new Set(t.plugins.map(i=>i.name));(o.has("tanstack-start-core:config")||o.has("tanstack-react-start:config"))&&(e.appendTo=/router\.tsx$/)}const n=/dev-toolbar[\\/]dist[\\/]|__visulima-dev-toolbar-resource/;for(const o of t.plugins){if(!o.name.includes("babel"))continue;const i=o.transform;if(!i)continue;const a=typeof i=="function"?i:typeof i=="object"&&"handler"in i?i.handler:void 0;if(typeof a!="function")continue;const s=function(c,r,...l){if(!n.test(r))return a.call(this,c,r,...l)};typeof i=="function"?o.transform=s:i.handler=s}},configureServer(t){N(t,e.serverFunctions,{editor:e.editor,readFile:e.readFile}),t.ws.on("connection",()=>{t.ws.send({event:"dev-toolbar:init",type:"custom"})}),t.middlewares.use("/__devtoolbar/events",async(n,o)=>{o.writeHead(200,{"Cache-Control":"no-cache",Connection:"keep-alive","Content-Type":"text/event-stream","X-Accel-Buffering":"no"});const i=(r,l)=>{o.write(`event: ${r}
2
+ data: ${JSON.stringify(l)}
3
3
 
4
- `)},"sendEvent");n("connected",{timestamp:Date.now()});const{watch:i}=await import("node:fs"),s=T.join(t.config.root,".devtoolbar","annotations.json");let l;try{l=i(s,{persistent:!1},c=>{c==="change"&&n("annotations.changed",{timestamp:Date.now()})}),l.on("error",()=>{})}catch{const{stat:c}=await import("node:fs/promises");let p=0;const C=setInterval(async()=>{try{const y=(await c(s)).mtimeMs;y!==p&&(p=y,n("annotations.changed",{timestamp:Date.now()}))}catch{}},2e3);a.on("close",()=>{clearInterval(C)});return}a.on("close",()=>{l?.close()})})},enforce:"pre",async load(t){if(t===_){const a=(e.customApps??[]).filter(o=>!o.component&&!o.init&&o.view?.type==="iframe").map(o=>({defaultOpen:o.defaultOpen,icon:o.icon,id:o.id,name:o.name,view:o.view}));return`export default ${JSON.stringify({apps:{a11y:e.apps?.a11y??!1,annotations:e.apps?.annotations??e.apps?.inspector??!1,assets:e.apps?.assets??!1,inspector:e.apps?.inspector??!1,moduleGraph:e.apps?.moduleGraph??!1,performance:e.apps?.performance??!1,seo:e.apps?.seo??!1,settings:e.apps?.settings??!0,tailwind:e.apps?.tailwind??!1,timeline:e.apps?.timeline??!1,viteConfig:e.apps?.viteConfig??!0},base:v.base,closeOnOutsideClick:e.closeOnOutsideClick??!0,customApps:a,defaultVisible:e.defaultVisible??!0,editor:e.editor??"",height:e.height??60,keybindings:e.keybindings??{},minimizePanelInactive:e.minimizePanelInactive??5e3,placement:e.placement??"bottom-center",position:e.position??"bottom",reduceMotion:e.reduceMotion??!1,requireUrlFlag:e.requireUrlFlag??!1,urlFlagName:e.urlFlagName??"devtools",width:e.width??80})};`}if(t.endsWith(w)){const a=W(t);return this.addWatchFile(a),await P.promises.readFile(a,"utf8")}},name:"@visulima/dev-toolbar",resolveId(t){if(t===h)return _;if(t.startsWith(u))return`${t.replace(u,`${r}/`)}${w}`},transform(t,a,o){if(o?.ssr)return;const{appendTo:n}=e,i=a.split("?",2)[0];if(n&&i&&(typeof n=="string"&&i.endsWith(n)||n instanceof RegExp&&n.test(i)))return`import '${u}client/overlay.js';
5
- ${t}`},transformIndexHtml(){return e.appendTo?void 0:{html:"",tags:[{attrs:{src:`${v.base||"/"}@id/${u}client/overlay.js`,type:"module"},injectTo:"head-prepend",tag:"script"}]}}},{enforce:"pre",name:"@visulima/dev-toolbar:inject-source",async transform(t,a){if(!$||v.mode!=="development"||a.includes("node_modules")||a.includes("?raw")||M.test(a)||!N.test(a.split("?")[0]??""))return;const{readFile:o}=await import("node:fs/promises");let n;try{const l=await o(a.split("?")[0]??a,"utf8");l!==t&&(n=l)}catch{}const{addSourceToJsx:i}=await import("./packem_chunks/inject-source.js"),s=i(t,a,e.injectSource?.ignore,n);if(s)return{code:s.code??t,map:s.map??void 0}}},{apply(t,{command:a,mode:o}){return f&&(a!=="serve"||o==="production")},load(t){if(t===j)return"export default {};"},name:"@visulima/dev-toolbar:remove-on-build",resolveId(t){if(t===h||t.startsWith(u))return j}}]},"devToolbar");export{E as devToolbar};
4
+ `)};i("connected",{timestamp:Date.now()});const{watch:a}=await import("node:fs"),s=x.join(t.config.root,".devtoolbar","annotations.json");let c;try{c=a(s,{persistent:!1},r=>{r==="change"&&i("annotations.changed",{timestamp:Date.now()})}),c.on("error",()=>{})}catch{const{stat:r}=await import("node:fs/promises");let l=0;const h=setInterval(async()=>{try{const d=(await r(s)).mtimeMs;d!==l&&(l=d,i("annotations.changed",{timestamp:Date.now()}))}catch{}},2e3);n.on("close",()=>{clearInterval(h)});return}n.on("close",()=>{c?.close()})})},enforce:"pre",async load(t){if(t===j){const n=(e.customApps??[]).filter(o=>!o.component&&!o.init&&o.view?.type==="iframe").map(o=>({defaultOpen:o.defaultOpen,icon:o.icon,id:o.id,name:o.name,view:o.view}));return`export default ${JSON.stringify({apps:{a11y:e.apps?.a11y??!1,annotations:e.apps?.annotations??e.apps?.inspector??!1,assets:e.apps?.assets??!1,inspector:e.apps?.inspector??!1,moduleGraph:e.apps?.moduleGraph??!1,performance:e.apps?.performance??!1,seo:e.apps?.seo??!1,settings:e.apps?.settings??!0,tailwind:e.apps?.tailwind??!1,timeline:e.apps?.timeline??!1,viteConfig:e.apps?.viteConfig??!0},base:v.base,closeOnOutsideClick:e.closeOnOutsideClick??!0,customApps:n,defaultVisible:e.defaultVisible??!0,editor:e.editor??"",height:T(e.height,60),keybindings:e.keybindings??{},minimizePanelInactive:e.minimizePanelInactive??5e3,placement:e.placement??"bottom-center",position:e.position??"bottom",reduceMotion:e.reduceMotion??!1,requireUrlFlag:e.requireUrlFlag??!1,urlFlagName:e.urlFlagName??"devtools",width:T(e.width,80)})};`}if(t.endsWith(_)){const n=B(t);return this.addWatchFile(n),await S.promises.readFile(n,"utf8")}},name:"@visulima/dev-toolbar",resolveId(t){if(t===b)return j;if(t.startsWith(m))return`${t.replace(m,`${p}/`)}${_}`},transform(t,n,o){if(o?.ssr)return;const{appendTo:i}=e,a=n.split("?",2)[0];if(i&&a&&(typeof i=="string"&&a.endsWith(i)||i instanceof RegExp&&i.test(a)))return`import '${m}client/overlay.js';
5
+ ${t}`},transformIndexHtml(){return e.appendTo?void 0:{html:"",tags:[{attrs:{src:`${v.base||"/"}@id/${m}client/overlay.js`,type:"module"},injectTo:"head-prepend",tag:"script"}]}}},k={apply(t,{command:n,mode:o}){return f&&(n!=="serve"||o==="production")},load(t){if(t===$)return"export default {};"},name:"@visulima/dev-toolbar:remove-on-build",resolveId(t){if(t===b||t.startsWith(m))return $}},w=new Map;return[F,{enforce:"pre",name:"@visulima/dev-toolbar:inject-source",async transform(t,n){if(!C||v.mode!=="development"||n.includes("node_modules")||n.includes("?raw")||D.test(n)||!W.test(n.split("?")[0]??""))return;const o=n.split("?")[0]??n,{readFile:i,stat:a}=await import("node:fs/promises");let s;try{const{mtimeMs:d}=await a(o);s=`${t.length}:${d}`;const g=w.get(n);if(g&&g.key===s)return g.result}catch{}let c;try{const d=await i(o,"utf8");d!==t&&(c=d)}catch{}const{addSourceToJsx:r}=await import("./packem_chunks/inject-source.js"),l=r(t,n,e.injectSource?.ignore,c),h=l?{code:l.code??t,map:l.map??void 0}:void 0;return s!==void 0&&w.set(n,{key:s,result:h}),h}},k]};export{U as devToolbar};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visulima/dev-toolbar",
3
- "version": "1.0.0-alpha.31",
3
+ "version": "1.0.0-alpha.33",
4
4
  "description": "Devtools is a set of tools for building advanced devtools for your application",
5
5
  "keywords": [
6
6
  "dev-toolbar",
@@ -111,16 +111,16 @@
111
111
  "CHANGELOG.md"
112
112
  ],
113
113
  "dependencies": {
114
- "@babel/generator": "^7.29.1",
115
- "@babel/parser": "7.29.3",
116
- "@babel/traverse": "^7.29.0",
114
+ "@babel/generator": "^7.29.7",
115
+ "@babel/parser": "7.29.7",
116
+ "@babel/traverse": "^7.29.7",
117
117
  "@floating-ui/dom": "^1.7.6",
118
- "launch-editor": "2.13.2",
118
+ "launch-editor": "2.14.1",
119
119
  "preact": "^10.29.2"
120
120
  },
121
121
  "peerDependencies": {
122
122
  "@modelcontextprotocol/sdk": "^1.29.0",
123
- "axe-core": "4.11.4",
123
+ "axe-core": "4.12.1",
124
124
  "vite": "^8.0.11",
125
125
  "zod": "^3.25.0 || ^4.0.0"
126
126
  },
@@ -1 +0,0 @@
1
- var c=Object.defineProperty;var n=(e,r)=>c(e,"name",{value:r,configurable:!0});import{clsx as s}from"./clsx-wGlvpUfw.js";import{jsx as l}from"preact/jsx-runtime";var d=Object.defineProperty,i=n((e,r)=>d(e,"name",{value:r,configurable:!0}),"s");const o={default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive",info:"border-info/50 text-info",success:"border-success/50 text-success",warning:"border-warning/50 text-warning"},f=i(({children:e,class:r,variant:t="default",...a})=>l("div",{class:s("relative w-full rounded-none border p-4 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg~*]:pl-7",o[t],r),role:"alert",...a,children:e}),"Alert"),p=i(({children:e,class:r,...t})=>l("h5",{class:s("mb-1 font-medium leading-none tracking-tight",r),...t,children:e}),"AlertTitle"),b=i(({children:e,class:r,...t})=>l("div",{class:s("text-sm [&_p]:leading-relaxed",r),...t,children:e}),"AlertDescription");export{f as Alert,b as AlertDescription,p as AlertTitle};
@@ -1 +0,0 @@
1
- var a=Object.defineProperty;var t=(r,e)=>a(r,"name",{value:e,configurable:!0});import{clsx as s}from"./clsx-wGlvpUfw.js";import{jsx as d}from"preact/jsx-runtime";var i=Object.defineProperty,c=t((r,e)=>i(r,"name",{value:e,configurable:!0}),"t");const u={default:"border-transparent bg-primary text-primary-foreground",destructive:"border-transparent bg-destructive text-destructive-foreground",info:"border-transparent bg-info text-info-foreground",outline:"text-foreground",secondary:"border-transparent bg-secondary text-secondary-foreground",success:"border-transparent bg-success text-success-foreground",warning:"border-transparent bg-warning text-warning-foreground"},l=c(({children:r,class:e,variant:n="default",...o})=>d("div",{class:s("inline-flex items-center rounded-none border px-2.5 py-0.5 text-xs font-semibold transition-colors",u[n],e),...o,children:r}),"Badge");export{l as default};
@@ -1 +0,0 @@
1
- var d=Object.defineProperty;var t=(e,r)=>d(e,"name",{value:r,configurable:!0});import{clsx as s}from"./clsx-wGlvpUfw.js";import{jsx as a}from"preact/jsx-runtime";var c=Object.defineProperty,l=t((e,r)=>c(e,"name",{value:r,configurable:!0}),"r");const g={default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",ghost:"text-muted-foreground hover:bg-foreground/8 hover:text-foreground",link:"text-primary underline-offset-4 hover:underline",outline:"border border-input bg-background text-foreground hover:bg-foreground/8",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80"},f={default:"h-9 px-4 py-2",icon:"h-9 w-9",lg:"h-10 px-8",sm:"h-8 px-3 text-xs"},x=l(({children:e,class:r,size:o="default",type:n="button",variant:i="default",...u})=>a("button",{class:s("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-none text-sm font-medium cursor-pointer transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",g[i],f[o],r),type:n,...u,children:e}),"Button");export{x as default};
@@ -1 +0,0 @@
1
- var i=Object.defineProperty;var l=(e,r)=>i(e,"name",{value:r,configurable:!0});import{clsx as d}from"./clsx-wGlvpUfw.js";import{jsx as s}from"preact/jsx-runtime";var n=Object.defineProperty,c=l((e,r)=>n(e,"name",{value:r,configurable:!0}),"t");const C=c(({children:e,class:r,...a})=>s("div",{class:d("bg-card text-card-foreground rounded-none border shadow",r),...a,children:e}),"Card"),p=c(({children:e,class:r,...a})=>s("div",{class:d("flex flex-col space-y-1.5 p-6",r),...a,children:e}),"CardHeader"),f=c(({children:e,class:r,...a})=>s("h3",{class:d("font-semibold leading-none tracking-tight",r),...a,children:e}),"CardTitle"),m=c(({children:e,class:r,...a})=>s("div",{class:d("text-sm text-muted-foreground",r),...a,children:e}),"CardDescription"),x=c(({children:e,class:r,...a})=>s("div",{class:d("p-6 pt-0",r),...a,children:e}),"CardContent"),v=c(({children:e,class:r,...a})=>s("div",{class:d("flex items-center p-6 pt-0",r),...a,children:e}),"CardFooter");export{C as Card,x as CardContent,m as CardDescription,v as CardFooter,p as CardHeader,f as CardTitle};
@@ -1 +0,0 @@
1
- var o=Object.defineProperty;var t=(a,e)=>o(a,"name",{value:e,configurable:!0});import{clsx as s}from"./clsx-wGlvpUfw.js";import{jsx as i}from"preact/jsx-runtime";var n=Object.defineProperty,c=t((a,e)=>n(a,"name",{value:e,configurable:!0}),"r");const p=c(({class:a,size:e=13,src:r})=>i("span",{class:s("inline-block shrink-0",a),style:{backgroundColor:"currentColor",height:e,maskImage:`url(${r})`,maskRepeat:"no-repeat",maskSize:"contain",WebkitMaskImage:`url(${r})`,WebkitMaskRepeat:"no-repeat",WebkitMaskSize:"contain",width:e}}),"Icon");export{p as default};
@@ -1 +0,0 @@
1
- var o=Object.defineProperty;var l=(e,a)=>o(e,"name",{value:a,configurable:!0});import{clsx as t}from"./clsx-wGlvpUfw.js";import{jsx as s}from"preact/jsx-runtime";var d=Object.defineProperty,i=l((e,a)=>d(e,"name",{value:a,configurable:!0}),"l");const p=i(({children:e,class:a,...r})=>s("label",{class:t("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",a),...r,children:e}),"Label");export{p as default};
@@ -1 +0,0 @@
1
- var R=Object.defineProperty;var P=(e,o)=>R(e,"name",{value:o,configurable:!0});import{addHookName as v}from"preact/devtools";import{computePosition as k,offset as E,flip as $,shift as j}from"@floating-ui/dom";import{clsx as g}from"./clsx-wGlvpUfw.js";import{createContext as z}from"preact";import{useState as b,useRef as y,useEffect as C,useContext as H}from"preact/hooks";import{jsx as f}from"preact/jsx-runtime";var L=Object.defineProperty,r=P((e,o)=>L(e,"name",{value:o,configurable:!0}),"o");const O=z(void 0),h=r(()=>{const e=H(O);if(!e)throw new Error("Popover subcomponent must be used within <Popover>");return e},"usePopoverContext"),q=r(({children:e,defaultOpen:o,onOpenChange:i,open:n})=>{const s=n!==void 0,[u,t]=v(b(o??!1),"internalOpen"),a=s?n:u,c=v(y(null),"triggerRef"),p=r(d=>{s||t(d),i?.(d)},"setOpen");return f(O.Provider,{value:{open:a,setOpen:p,triggerRef:c},children:f("span",{style:{display:"contents"},children:e})})},"Popover"),A=r(({children:e,class:o,...i})=>{const{open:n,setOpen:s,triggerRef:u}=h(),t=r(a=>{u.current=a},"handleRef");return f("button",{"aria-expanded":n,class:g("",o),onClick:r(()=>{i.disabled||s(!n)},"onClick"),ref:t,type:"button",...i,children:e})},"PopoverTrigger"),B=r(({align:e="center",children:o,class:i,side:n="bottom",sideOffset:s=4,...u})=>{const{open:t,setOpen:a,triggerRef:c}=h(),p=v(y(null),"contentRef"),[d,w]=v(b({x:0,y:0}),"position");if(C(()=>{if(!t||!c.current||!p.current)return;const m=e==="center"?n:`${n}-${e}`;k(c.current,p.current,{middleware:[E(s),$(),j({padding:4})],placement:m}).then(l=>(w({x:l.x,y:l.y}),l)).catch(()=>{})},[t,n,s,e,c]),C(()=>{if(!t)return;const m=r(l=>{if(p.current&&!p.current.contains(l.target)){const x=c.current;if(x&&x.contains(l.target))return;a(!1)}},"handleMouseDown");return document.addEventListener("mousedown",m),()=>{document.removeEventListener("mousedown",m)}},[t,a,c]),!!t)return f("div",{class:g("z-50 w-72 rounded-none border bg-popover p-4 text-popover-foreground shadow-md outline-none animate-in fade-in-0 zoom-in-95",i),ref:p,role:"dialog",style:{left:`${d.x}px`,position:"fixed",top:`${d.y}px`},...u,children:o})},"PopoverContent"),F=r(({children:e,class:o,...i})=>{const{setOpen:n}=h();return f("button",{class:g("",o),onClick:r(()=>{n(!1)},"onClick"),type:"button",...i,children:e})},"PopoverClose");export{q as Popover,F as PopoverClose,B as PopoverContent,A as PopoverTrigger};
@@ -1 +0,0 @@
1
- var i=Object.defineProperty;var e=(a,r)=>i(a,"name",{value:r,configurable:!0});import{clsx as o}from"./clsx-wGlvpUfw.js";import{jsx as l}from"preact/jsx-runtime";var t=Object.defineProperty,n=e((a,r)=>t(a,"name",{value:r,configurable:!0}),"s");const m=n(({class:a,value:r,...s})=>l("div",{"aria-valuemax":100,"aria-valuemin":0,"aria-valuenow":r??0,class:o("relative h-2 w-full overflow-hidden rounded-none bg-primary/20",a),role:"progressbar",...s,children:l("div",{class:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(r??0)}%)`}})}),"Progress");export{m as default};
@@ -1 +0,0 @@
1
- var X=Object.defineProperty;var q=(e,l)=>X(e,"name",{value:l,configurable:!0});import{addHookName as u}from"preact/devtools";import{computePosition as F,offset as G,flip as Q,shift as Y}from"@floating-ui/dom";import{clsx as k}from"./clsx-wGlvpUfw.js";import{createContext as Z}from"preact";import{useState as w,useRef as S,useCallback as _,useEffect as C,useMemo as ee,useContext as te}from"preact/hooks";import{jsx as f,jsxs as T}from"preact/jsx-runtime";var re=Object.defineProperty,n=q((e,l)=>re(e,"name",{value:l,configurable:!0}),"r");const U=Z(void 0),D=n(()=>{const e=te(U);if(!e)throw new Error("Select subcomponent must be used within <Select>");return e},"useSelectContext");let K=0;const de=n(({children:e,onValueChange:l,value:o=""})=>{const[t,a]=u(w(!1),"open"),[d,c]=u(w(""),"search"),[g,r]=u(w(null),"highlightedValue"),x=u(S(null),"triggerRef"),[m]=u(w(()=>(K+=1,`select-${K}`)),"instanceId"),v=_(i=>{l?.(i),a(!1),c("")},[l]);C(()=>{t||(c(""),r(null))},[t]);const R=u(ee(()=>({highlightedValue:g,instanceId:m,onSelect:v,open:t,search:d,setHighlightedValue:r,setOpen:a,setSearch:c,triggerRef:x,value:o}),[g,m,v,t,d,o]),"contextValue");return f(U.Provider,{value:R,children:f("span",{style:{display:"contents"},children:e})})},"Select"),fe=n(({children:e,class:l,...o})=>{const{open:t,setOpen:a,triggerRef:d}=D();return T("button",{"aria-expanded":t,"aria-haspopup":"listbox",class:k("inline-flex items-center justify-between gap-2","bg-foreground/6 border border-border","text-[0.775rem] font-medium text-foreground","px-2.5 py-1.5 cursor-pointer","focus:outline-none focus:ring-1 focus:ring-ring","transition-colors duration-150",l),onClick:n(()=>{a(!t)},"onClick"),ref:n(c=>{d.current=c},"ref"),type:"button",...o,children:[e,f("svg",{"aria-hidden":"true",class:k("h-3 w-3 shrink-0 opacity-60 transition-transform duration-150",t&&"rotate-180"),fill:"none",stroke:"currentColor","stroke-width":"2",viewBox:"0 0 24 24",children:f("path",{d:"m6 9 6 6 6-6"})})]})},"SelectTrigger"),pe=n(({class:e,options:l,placeholder:o="Select…"})=>{const{value:t}=D(),a=l.find(d=>d.value===t);return f("span",{class:k("truncate",!a&&"text-muted-foreground",e),children:a?a.label:o})},"SelectValue"),ne=n(e=>[...e.querySelectorAll("[role='option']:not([aria-disabled='true'])")],"getOptionElements"),N=n(e=>e.dataset.value??null,"getOptionValue"),he=n(({align:e="start",children:l,class:o,searchable:t=!1,side:a="bottom",sideOffset:d=4})=>{const{highlightedValue:c,instanceId:g,open:r,search:x,setHighlightedValue:m,setOpen:v,setSearch:R,triggerRef:i}=D(),y=u(S(null),"contentRef"),O=u(S(null),"searchInputRef"),I=u(S(null),"listRef"),[j,J]=u(w({x:0,y:0}),"position"),[W,L]=u(w(!1),"ready"),A=u(S(c),"highlightedRef");if(A.current=c,C(()=>{if(!r||!i.current||!y.current){L(!1);return}let p=!1;const s=e==="center"?a:`${a}-${e}`;return F(i.current,y.current,{middleware:[G(d),Q(),Y({padding:4})],placement:s}).then(h=>(p||(J({x:h.x,y:h.y}),L(!0)),h)).catch(()=>{}),()=>{p=!0}},[r,a,d,e,i]),C(()=>{r&&(t&&O.current?O.current.focus():I.current&&I.current.focus())},[r,t]),C(()=>{if(!r)return;const p=n(s=>{if(y.current&&!y.current.contains(s.target)){const h=i.current;if(h&&h.contains(s.target))return;v(!1)}},"handleMouseDown");return document.addEventListener("mousedown",p),()=>{document.removeEventListener("mousedown",p)}},[r,v,i]),C(()=>{if(!r)return;const p=n(s=>{const h=I.current;if(!h)return;const E=ne(h),V=E.length;if(V===0){s.key==="Escape"&&(s.preventDefault(),v(!1),i.current?.focus());return}const z=A.current,b=z===null?-1:E.findIndex(M=>N(M)===z),$=n(M=>{const H=E[M];if(H){const P=N(H);P!==null&&m(P),H.scrollIntoView?.({block:"nearest"})}},"highlightByIndex");switch(s.key){case"ArrowDown":{s.preventDefault(),$(b<V-1?b+1:0);break}case"ArrowUp":{s.preventDefault(),$(b>0?b-1:V-1);break}case"End":{s.preventDefault(),$(V-1);break}case"Enter":{s.preventDefault(),b>=0&&E[b]?.click();break}case"Escape":case"Tab":{s.preventDefault(),v(!1),i.current?.focus();break}case"Home":{s.preventDefault(),$(0);break}}},"handleKeyDown");return document.addEventListener("keydown",p),()=>{document.removeEventListener("keydown",p)}},[r,m,v,i]),!r)return;const B=c===null?void 0:`${g}-option-${c}`;return T("div",{class:k("z-50 min-w-[8rem] overflow-hidden border border-border bg-popover text-popover-foreground shadow-md","animate-in fade-in-0 zoom-in-95",!W&&"invisible",o),ref:y,style:{left:`${j.x}px`,position:"fixed",top:`${j.y}px`,width:i.current?`${Math.max(i.current.offsetWidth,128)}px`:void 0},children:[t&&f("div",{class:"border-b border-border p-1.5",children:f("input",{"aria-activedescendant":B,"aria-controls":`${g}-listbox`,"aria-label":"Search options",class:k("w-full bg-transparent text-[0.75rem] text-foreground placeholder:text-muted-foreground","px-1.5 py-1 border-0 outline-none"),onInput:n(p=>{R(p.currentTarget.value),m(null)},"onInput"),placeholder:"Search…",ref:O,role:"combobox",type:"text",value:x})}),f("div",{...!t&&{"aria-activedescendant":B,tabIndex:0},class:"max-h-[min(300px,var(--available-height,300px))] overflow-y-auto scrollbar-thin-border p-1",id:`${g}-listbox`,ref:I,role:"listbox",children:l})]})},"SelectContent"),ge=n(({children:e,class:l,value:o})=>{const{highlightedValue:t,instanceId:a,onSelect:d,setHighlightedValue:c,value:g}=D(),r=g===o,x=t===o,m=`${a}-option-${o}`;return T("div",{"aria-selected":r,class:k("relative flex cursor-pointer select-none items-center gap-2","text-[0.775rem] py-1.5 px-2","transition-colors duration-75",x&&"bg-accent text-accent-foreground",r&&"font-medium",!x&&!r&&"text-foreground",!x&&"hover:bg-accent/50",l),"data-value":o,id:m,onClick:n(()=>{d(o)},"onClick"),onMouseEnter:n(()=>{c(o)},"onMouseEnter"),role:"option",children:[f("span",{class:"flex-1 truncate",children:e}),r&&f("svg",{"aria-hidden":"true",class:"h-3.5 w-3.5 shrink-0",fill:"none",stroke:"currentColor","stroke-width":"2.5",viewBox:"0 0 24 24",children:f("path",{d:"M20 6 9 17l-5-5"})})]})},"SelectItem");export{de as Select,he as SelectContent,ge as SelectItem,fe as SelectTrigger,pe as SelectValue,D as useSelectContext};
@@ -1 +0,0 @@
1
- var i=Object.defineProperty;var a=(r,o)=>i(r,"name",{value:o,configurable:!0});import{clsx as l}from"./clsx-wGlvpUfw.js";import{jsx as s}from"preact/jsx-runtime";var p=Object.defineProperty,c=a((r,o)=>p(r,"name",{value:o,configurable:!0}),"a");const h=c(({class:r,decorative:o=!0,orientation:e="horizontal",...t})=>{const n=o?{role:"none"}:{"aria-orientation":e,role:"separator"};return s("div",{class:l("shrink-0 bg-border",e==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",r),...n,...t})},"Separator");export{h as default};
@@ -1 +0,0 @@
1
- var o=Object.defineProperty;var a=(e,r)=>o(e,"name",{value:r,configurable:!0});import{clsx as s}from"./clsx-wGlvpUfw.js";import{jsx as t}from"preact/jsx-runtime";var l=Object.defineProperty,n=a((e,r)=>l(e,"name",{value:r,configurable:!0}),"s");const p=n(({class:e,...r})=>t("div",{class:s("animate-pulse rounded-none bg-primary/10",e),...r}),"Skeleton");export{p as default};
@@ -1 +0,0 @@
1
- var m=Object.defineProperty;var a=(e,r)=>m(e,"name",{value:r,configurable:!0});import{addHookName as g}from"preact/devtools";import{clsx as s}from"./clsx-wGlvpUfw.js";import{useState as v}from"preact/hooks";import{jsx as c}from"preact/jsx-runtime";var C=Object.defineProperty,d=a((e,r)=>C(e,"name",{value:r,configurable:!0}),"o");const H=d(({checked:e,class:r,defaultChecked:l,disabled:o,id:u,onCheckedChange:b,...f})=>{const t=e!==void 0,[h,k]=g(v(l??!1),"internalChecked"),n=t?e:h,p=d(()=>{if(o)return;const i=!n;t||k(i),b?.(i)},"handleClick");return c("button",{"aria-checked":n,class:s("inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-none border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",n?"bg-primary":"bg-input",r),"data-state":n?"checked":"unchecked",disabled:o,id:u,onClick:p,role:"switch",type:"button",...f,children:c("span",{class:s("pointer-events-none block h-4 w-4 rounded-none bg-background shadow-lg ring-0 transition-transform",n?"translate-x-4":"translate-x-0"),"data-state":n?"checked":"unchecked"})})},"Switch");export{H as default};
@@ -1 +0,0 @@
1
- var p=Object.defineProperty;var b=(e,n)=>p(e,"name",{value:n,configurable:!0});import{addHookName as T}from"preact/devtools";import{clsx as u}from"./clsx-wGlvpUfw.js";import{createContext as x}from"preact";import{useState as C,useContext as k}from"preact/hooks";import{jsx as a}from"preact/jsx-runtime";var V=Object.defineProperty,s=b((e,n)=>V(e,"name",{value:n,configurable:!0}),"s");const f=x(void 0),g=s(()=>{const e=k(f);if(!e)throw new Error("Tabs subcomponent must be used within <Tabs>");return e},"useTabsContext"),E=s(({children:e,class:n,defaultValue:i,onValueChange:t,value:r,...c})=>{const l=r!==void 0,[o,v]=T(C(i??""),"internalValue"),m=l?r:o,h=s(d=>{l||v(d),t?.(d)},"handleValueChange");return a(f.Provider,{value:{onValueChange:h,value:m},children:a("div",{class:u("",n),...c,children:e})})},"Tabs"),H=s(({children:e,class:n,...i})=>a("div",{class:u("inline-flex h-9 items-center justify-center rounded-none bg-muted p-1 text-muted-foreground",n),role:"tablist",...i,children:e}),"TabsList"),J=s(({children:e,class:n,disabled:i,value:t,...r})=>{const{onValueChange:c,value:l}=g(),o=l===t;return a("button",{"aria-selected":o,class:u("inline-flex items-center justify-center whitespace-nowrap rounded-none px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",o?"bg-background text-foreground shadow":"hover:bg-background/50",n),"data-state":o?"active":"inactive",disabled:i,onClick:s(()=>!i&&c(t),"onClick"),role:"tab",type:"button",...r,children:e})},"TabsTrigger"),N=s(({children:e,class:n,value:i,...t})=>{const{value:r}=g();if(r===i)return a("div",{class:u("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",n),role:"tabpanel",...t,children:e})},"TabsContent");export{E as Tabs,N as TabsContent,H as TabsList,J as TabsTrigger};
@@ -1 +0,0 @@
1
- var T=Object.defineProperty;var d=(e,t)=>T(e,"name",{value:t,configurable:!0});import{addHookName as l}from"preact/devtools";import{computePosition as v,offset as R,flip as b,shift as C}from"@floating-ui/dom";import{clsx as w}from"./clsx-wGlvpUfw.js";import{createContext as E}from"preact";import{useState as m,useRef as x,useEffect as M,useContext as O}from"preact/hooks";import{jsx as p}from"preact/jsx-runtime";var L=Object.defineProperty,r=d((e,t)=>L(e,"name",{value:t,configurable:!0}),"t");const g=E(void 0),h=r(()=>{const e=O(g);if(!e)throw new Error("Tooltip subcomponent must be used within <Tooltip>");return e},"useTooltipContext"),D=r(({children:e,delayDuration:t=0})=>{const[n,o]=l(m(!1),"open"),i=l(x(null),"triggerRef");return p(g.Provider,{value:{open:n,setOpen:o,triggerRef:i},children:p("span",{style:{display:"contents"},children:e})})},"Tooltip"),N=r(({children:e,class:t,...n})=>{const{setOpen:o,triggerRef:i}=h();return p("span",{class:t,onMouseEnter:r(()=>{o(!0)},"onMouseEnter"),onMouseLeave:r(()=>{o(!1)},"onMouseLeave"),ref:r(s=>{i.current=s},"handleRef"),...n,children:e})},"TooltipTrigger"),q=r(({children:e,class:t,side:n="top",sideOffset:o=4,...i})=>{const{open:s,triggerRef:a}=h(),c=l(x(null),"contentRef"),[u,y]=l(m({x:0,y:0}),"position");if(M(()=>{!s||!a.current||!c.current||v(a.current,c.current,{middleware:[R(o),b(),C({padding:4})],placement:n}).then(f=>(y({x:f.x,y:f.y}),f)).catch(()=>{})},[s,n,o,a]),!!s)return p("div",{class:w("z-50 rounded-none bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95",t),ref:c,role:"tooltip",style:{left:`${u.x}px`,position:"fixed",top:`${u.y}px`},...i,children:e})},"TooltipContent");export{D as Tooltip,q as TooltipContent,N as TooltipTrigger};