@visulima/dev-toolbar 1.0.12 → 1.0.13
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.
- package/CHANGELOG.md +2 -0
- package/dist/apps/a11y/index.js +3 -3
- package/dist/apps/annotations/index.js +2 -2
- package/dist/apps/assets/index.js +2 -2
- package/dist/apps/inspector/index.js +8 -8
- package/dist/apps/module-graph/index.js +2 -2
- package/dist/apps/performance/index.js +2 -2
- package/dist/apps/seo/index.js +2 -2
- package/dist/apps/settings/index.js +2 -2
- package/dist/apps/tailwind/index.js +4 -4
- package/dist/apps/timeline/index.js +2 -2
- package/dist/apps/vite-config/index.js +3 -3
- package/dist/client/overlay.js +1 -1
- package/dist/index.d.ts +238 -6
- package/dist/index.js +1 -1
- package/dist/mcp/server.js +1 -1
- package/dist/packem_chunks/inject-source.js +7 -7
- package/dist/packem_shared/Alert-zKrO89oT.js +1 -0
- package/dist/packem_shared/{Badge-PpblpNWg.js → Badge-DdZ-eO1L.js} +1 -1
- package/dist/packem_shared/{Button-CAKvtfij.js → Button-C47WESqv.js} +1 -1
- package/dist/packem_shared/Card-CODzgyhz.js +1 -0
- package/dist/packem_shared/Icon-CpjIHGY8.js +1 -0
- package/dist/packem_shared/{Input-Dc1WiT01.js → Input-ChP0V9d9.js} +1 -1
- package/dist/packem_shared/Label-Dln89zeh.js +1 -0
- package/dist/packem_shared/Popover-BwqId7Zj.js +1 -0
- package/dist/packem_shared/Progress-B1MCRlIm.js +1 -0
- package/dist/packem_shared/Select-BHuWHvtj.js +1 -0
- package/dist/packem_shared/Separator-DaOoH4S4.js +1 -0
- package/dist/packem_shared/Skeleton-whkeV8my.js +1 -0
- package/dist/packem_shared/Switch-BShIjzxX.js +1 -0
- package/dist/packem_shared/Tabs-k8RYlor_.js +1 -0
- package/dist/packem_shared/{Textarea-DP9gpte-.js → Textarea-XCaIrn4D.js} +1 -1
- package/dist/packem_shared/Tooltip-DmnO5Vmb.js +1 -0
- package/dist/packem_shared/annotation-store-sGzAusBs.js +1 -0
- package/dist/packem_shared/clsx-BGQISBxA.js +1 -0
- package/dist/packem_shared/createClientRPCContext-DmkXq4kr.js +1 -0
- package/dist/packem_shared/createDevToolbarHook-CClREDPv.js +1 -0
- package/dist/packem_shared/createServerRPCContext-D0Yh-CF2.js +1 -0
- package/dist/packem_shared/{getGlobalHook-D6jRtv7N.js → getGlobalHook-4YRjG5eP.js} +1 -1
- package/dist/packem_shared/getTimelineStore-D6HA9wQA.js +1 -0
- package/dist/packem_shared/loadSettings-eayRSk_E.js +1 -0
- package/dist/packem_shared/{global-api.d-PUBE6Od9.d.ts → server.d-C41Pohjw.d.ts} +28 -226
- package/dist/packem_shared/sharedToolbarStylesheet-DN0y3B5k.js +2 -0
- package/dist/packem_shared/{store-Dqy0FbGw.js → store-BDDc96at.js} +1 -1
- package/dist/packem_shared/use-theme-zFyXbqmc.js +1 -0
- package/dist/toolbar/index.d.ts +0 -2
- package/dist/toolbar/index.js +3 -3
- package/dist/ui/index.js +1 -1
- package/dist/vite-plugin.d.ts +1 -3
- package/dist/vite-plugin.js +4 -4
- package/package.json +6 -6
- package/dist/packem_shared/Alert-CZq7C43v.js +0 -1
- package/dist/packem_shared/Card-BSy2oRiS.js +0 -1
- package/dist/packem_shared/Icon-0XYV-4AL.js +0 -1
- package/dist/packem_shared/Label-BZh8XxUb.js +0 -1
- package/dist/packem_shared/Popover-DuiU8EPg.js +0 -1
- package/dist/packem_shared/Progress-C90LC--2.js +0 -1
- package/dist/packem_shared/Select-CwD-d0pi.js +0 -1
- package/dist/packem_shared/Separator-PSjfhX_W.js +0 -1
- package/dist/packem_shared/Skeleton-BAFrGUR1.js +0 -1
- package/dist/packem_shared/Switch-Wpsp5M3p.js +0 -1
- package/dist/packem_shared/Tabs-BdNFQd3c.js +0 -1
- package/dist/packem_shared/Tooltip-DVeuszoY.js +0 -1
- package/dist/packem_shared/annotation-store-DkqJ7H3F.js +0 -1
- package/dist/packem_shared/clsx-CtZWcPHt.js +0 -1
- package/dist/packem_shared/createClientRPCContext-5Bh0Q7ai.js +0 -1
- package/dist/packem_shared/createDevToolbarHook-C_TF-RyL.js +0 -1
- package/dist/packem_shared/createServerRPCContext-Mi6xw5Iz.js +0 -1
- package/dist/packem_shared/getTimelineStore-BT5sImVb.js +0 -1
- package/dist/packem_shared/loadSettings-C0pUyx9j.js +0 -1
- package/dist/packem_shared/server.d-CF1fcO17.d.ts +0 -39
- package/dist/packem_shared/sharedToolbarStylesheet-BRJrLf-_.js +0 -2
- package/dist/packem_shared/use-theme-DIqZkPAe.js +0 -1
package/dist/toolbar/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{createContext as je,render as me}from"preact";import{createClientRPCContext as De}from"../packem_shared/createClientRPCContext-5Bh0Q7ai.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-D6jRtv7N.js";import{sharedToolbarStylesheet as ae}from"../packem_shared/sharedToolbarStylesheet-BRJrLf-_.js";import{jsxs as g,Fragment as ve,jsx as i}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 We="data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMjQ4IDI5MSIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4gPGRlZnM+IDxsaW5lYXJHcmFkaWVudCBpZD0iYSIgZ3JhZGllbnRVbml0cz0ib2JqZWN0Qm91bmRpbmdCb3giIHgxPSIwIiB5MT0iMCIgeDI9IjEiIHkyPSIxIj4gPHN0b3Agb2Zmc2V0PSIwIiBzdG9wLWNvbG9yPSJyZWQiPiA8YW5pbWF0ZSBhdHRyaWJ1dGVOYW1lPSJzdG9wLWNvbG9yIiB2YWx1ZXM9InJlZDtwdXJwbGU7Ymx1ZTtyZWQ7IiBkdXI9IjIwcyIgcmVwZWF0Q291bnQ9ImluZGVmaW5pdGUiIC8+IDwvc3RvcD4gPHN0b3Agb2Zmc2V0PSIwLjUiIHN0b3AtY29sb3I9InB1cnBsZSI+IDxhbmltYXRlIGF0dHJpYnV0ZU5hbWU9InN0b3AtY29sb3IiIHZhbHVlcz0icHVycGxlO2JsdWU7cmVkO3B1cnBsZTsiIGR1cj0iMjBzIiByZXBlYXRDb3VudD0iaW5kZWZpbml0ZSIgLz4gPC9zdG9wPiA8c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9ImJsdWUiPiA8YW5pbWF0ZSBhdHRyaWJ1dGVOYW1lPSJzdG9wLWNvbG9yIiB2YWx1ZXM9ImJsdWU7cmVkO3B1cnBsZTtibHVlOyIgZHVyPSIyMHMiIHJlcGVhdENvdW50PSJpbmRlZmluaXRlIiAvPiA8L3N0b3A+IDxhbmltYXRlVHJhbnNmb3JtIGF0dHJpYnV0ZU5hbWU9ImdyYWRpZW50VHJhbnNmb3JtIiB0eXBlPSJyb3RhdGUiIGZyb209IjAgLjUgLjUiIHRvPSIzNjAgLjUgLjUiIGR1cj0iMTBzIiByZXBlYXRDb3VudD0iaW5kZWZpbml0ZSIgLz4gPC9saW5lYXJHcmFkaWVudD4gPGxpbmVhckdyYWRpZW50IGlkPSJvdmVybGF5R3JhZGllbnRBIiB4MT0iNjIiIHkxPSI0Mi4yMjUzIiB4Mj0iNjIiIHkyPSIyOTAuMjI1IiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSI+IDxzdG9wIG9mZnNldD0iMC4zNCIgc3RvcC1vcGFjaXR5PSIwLjUiIC8+IDxzdG9wIG9mZnNldD0iMSIgc3RvcC1jb2xvcj0id2hpdGUiIHN0b3Atb3BhY2l0eT0iMCIgLz4gPC9saW5lYXJHcmFkaWVudD4gPGxpbmVhckdyYWRpZW50IGlkPSJvdmVybGF5R3JhZGllbnRCIiB4MT0iMTg2IiB5MT0iMCIgeDI9IjE4NiIgeTI9IjI0OCIgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiPiA8c3RvcCBzdG9wLWNvbG9yPSJ3aGl0ZSIgc3RvcC1vcGFjaXR5PSIwIiAvPiA8c3RvcCBvZmZzZXQ9IjAuNjk1IiBzdG9wLW9wYWNpdHk9IjAuNSIgLz4gPC9saW5lYXJHcmFkaWVudD4gPC9kZWZzPiA8cGF0aCBkPSJNMCAxNjYuMjI1QzAgMjM0LjcwOSA1NS41MTY3IDI5MC4yMjUgMTI0IDI5MC4yMjVWNDIuMjI1M0M1NS41MTY3IDQyLjIyNTMgMCA5Ny43NDIgMCAxNjYuMjI1WiBNMjQ4IDEyNEMyNDggMTkyLjQ4MyAxOTIuNDgzIDI0OCAxMjQgMjQ4VjBDMTkyLjQ4MyAwIDI0OCA1NS41MTY3IDI0OCAxMjRaIiBmaWxsPSJ1cmwoI2EpIiAvPiA8cGF0aCBkPSJNMCAxNjYuMjI1QzAgMjM0LjcwOSA1NS41MTY3IDI5MC4yMjUgMTI0IDI5MC4yMjVWNDIuMjI1M0M1NS41MTY3IDQyLjIyNTMgMCA5Ny43NDIgMCAxNjYuMjI1WiIgZmlsbD0idXJsKCNvdmVybGF5R3JhZGllbnRBKSIgLz4gPHBhdGggZD0iTTI0OCAxMjRDMjQ4IDE5Mi40ODMgMTkyLjQ4MyAyNDggMTI0IDI0OFYwQzE5Mi40ODMgMCAyNDggNTUuNTE2NyAyNDggMTI0WiIgZmlsbD0idXJsKCNvdmVybGF5R3JhZGllbnRCKSIgLz4gPGNpcmNsZSBjeD0iMTI0IiBjeT0iMTQ3IiByPSI1MCIgZmlsbD0id2hpdGUiIC8+IDwvc3ZnPg==",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}},Be=(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},Ze=()=>{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=>{Be(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,Ge=()=>{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")}},Ye=()=>{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},Xe=e=>{const{state:t,updateState:r}=fe(),{height:o,width:a}=Ye(),[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,J]=l(N(()=>({bottom:10,left:10,right:10,top:10})),"panelMargins");_(()=>{const v=Ge();J({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 $=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,O=P.current,B=j/2,y=O/2,ie=b.clientX,U=b.clientY,ee=ie-A.current.x,te=U-A.current.y;F.current={x:ee,y:te};const ne=Math.max(0,Math.min(ie,j)),x=Math.max(0,Math.min(U,O)),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(O-I-y,0-B),xe=Math.atan2(O-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/O*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,O=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,U=Math.min(O,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<U/2?y.left=`${U/2-te+m.left}px`:a-te-m.right<U/2&&(y.left=`${a-te-U/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:$,panelStyle:W}},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",Je="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",Oe="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",Ue="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",$e="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"),J=l(f(void 0),"lastDockedRectRef"),$=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,O=window.innerHeight,B={...H.current};if(P.current.top){const y=Math.abs(b.bottom-m.clientY);B.height=ge(y/O*100,ue,he)}else if(P.current.bottom){const y=Math.abs(m.clientY-b.top);B.height=ge(y/O*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=$.current;$.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:Ue})}),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=J.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,J.current=s}M({viewMode:"fullscreen"})}},title:D?"Exit fullscreen":"Fullscreen",type:"button",children:i(K,{size:13,src:D?$e:Oe})}),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:Je})}),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-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",ot=(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%)"}}},at=({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=ot(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:nt})})]}),i("div",{class:"p-3",children:i(F,{helpers:c.current})})]})},st=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))"}}},lt=({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")})}},ct=[{icon:"⊙",text:"Click logo to open panel"},{icon:"⠿",text:"Drag pill to reposition"},{icon:"⌨",text:"Alt+Shift+D to toggle"}],dt=({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:st(t),children:[i(lt,{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:ct.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"})]})},pt="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",ut=({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,J=Math.min(80,w),$=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(J-w,Math.min(R-J,G)),k=Math.max($-H,Math.min(P-$,k));const D=[0,R-w,J-w,R-J],L=[0,P-H,$-H,P-$];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:pt})})]}),i("div",{class:"p-3",children:i(z,{helpers:p.current})})]})},ht=({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"})]})})},gt="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",ft=()=>{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:gt}),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})]})})]})},mt=()=>{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(ht,{app:t},t.id)),i(ft,{})]})})},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}=Ze(),{anchorStyle:R,bringUp:P,isDragging:H,isHidden:w,isVertical:J,onPointerDown:$,panelStyle:G}=Xe(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 O=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 U=l(f(n),"onToggleAppRef");U.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 U.current(x);return}if(x===I&&T){await U.current(x),F({open:!1,viewMode:"default"});return}x!==I&&await U.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:O,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",J?"shadow-pill-vertical!":"shadow-pill",w?"max-w-12!":"","transition-pill"),"data-vertical":J||void 0,onPointerDown:x=>{A.isFirstVisit&&F({isFirstVisit:!1}),$(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:We})}),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(mt,{})})]}),A.isFirstVisit&&i(dt,{onDismiss:()=>{F({isFirstVisit:!1})},position:A.position})]}),i(it,{activeAppId:e,apps:t,onClose:V,onToggleApp:n,panelVisible:M,position:A.position}),i(at,{position:A.position}),v.map(x=>i(ut,{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=`
|
|
1
|
+
import{createContext as Fe,render as me}from"preact";import{createClientRPCContext as De}from"../packem_shared/createClientRPCContext-DmkXq4kr.js";import{updateSettings as _e,loadSettings as Ae}from"../packem_shared/loadSettings-eayRSk_E.js";import{getGlobalHook as je,setupGlobalHook as Ne}from"../packem_shared/getGlobalHook-4YRjG5eP.js";import{sharedToolbarStylesheet as se}from"../packem_shared/sharedToolbarStylesheet-DN0y3B5k.js";import{jsxs as f,Fragment as ve,jsx as n}from"preact/jsx-runtime";import{addHookName as l}from"preact/devtools";import{clsx as h}from"../packem_shared/clsx-BGQISBxA.js";import{useContext as Ve,useEffect as j,useMemo as Q,useState as N,useRef as g,useCallback as oe,useLayoutEffect as He}from"preact/hooks";import q from"../packem_shared/Icon-CpjIHGY8.js";import{u as ge,a as Ie}from"../packem_shared/use-theme-zFyXbqmc.js";import{g as Le}from"../packem_shared/store-BDDc96at.js";const ce=()=>{const e=De();return{rpc:new Proxy({},{get(t,r){return(...i)=>e.callServer(r,...i)}})}};class We{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 i=new EventTarget,o={...t,active:!1,builtIn:r,eventTarget:i,notification:{state:!1},status:"ready"};this.apps.set(t.id,o)}async unregisterApp(t){const r=this.apps.get(t);if(r?.destroy&&this.initializedApps.has(t)){const i=this.appCanvases.get(t);if(i)try{await r.destroy(i.shadowRoot)}catch(o){console.error(`[dev-toolbar] destroy() failed for app ${t}:`,o)}}this.apps.delete(t),this.initializedApps.delete(t),this.appCanvases.delete(t),this.activeAppId===t&&(this.activeAppId=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 i=r.active;return r.active=!i,!i&&r.onClick?await r.onClick():i&&r.onDeactivate&&await r.onDeactivate(),!0}return r.active?await this.closeApp(t):this.activeAppId&&!await this.closeApp(this.activeAppId)?!1:await this.openApp(t)}setAppActive(t,r){const i=this.apps.get(t);i&&(i.active=r)}isAppInitialized(t){return this.initializedApps.has(t)}markAppInitialized(t){this.initializedApps.add(t)}async openApp(t){const r=this.apps.get(t);if(!r)return!1;if(r.active=!0,r.status="loading",this.activeAppId=t,r.init&&!this.isAppInitialized(t))try{const i=this.getAppCanvas(t);if(i){const o=ce(),s=r.init(i.shadowRoot,r.eventTarget,o);s&&typeof s.then=="function"&&await s,this.markAppInitialized(t),r.status="ready"}else r.status="pending"}catch(i){return console.error(`[dev-toolbar] Failed to init app ${t}:`,i),r.status="error",r.active=!1,this.activeAppId=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 i=this.getAppCanvas(t);if(i)try{const o=r.beforeTogglingOff(i.shadowRoot);if(!(o&&typeof o.then=="function"?await o:o))return!1}catch(o){console.error(`[dev-toolbar] beforeTogglingOff() threw for app ${t}:`,o)}}return r.active=!1,this.activeAppId===t&&(this.activeAppId=void 0),!0}setNotification(t,r,i){const o=this.apps.get(t);o&&(o.notification={level:i,state:r})}clearNotification(t){const r=this.apps.get(t);r&&(r.notification={state:!1})}getAppCanvas(t){return this.appCanvases.get(t)}setAppCanvas(t,r){this.appCanvases.set(t,r)}}const Be="data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMjQ4IDI5MSIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4gPGRlZnM+IDxsaW5lYXJHcmFkaWVudCBpZD0iYSIgZ3JhZGllbnRVbml0cz0ib2JqZWN0Qm91bmRpbmdCb3giIHgxPSIwIiB5MT0iMCIgeDI9IjEiIHkyPSIxIj4gPHN0b3Agb2Zmc2V0PSIwIiBzdG9wLWNvbG9yPSJyZWQiPiA8YW5pbWF0ZSBhdHRyaWJ1dGVOYW1lPSJzdG9wLWNvbG9yIiB2YWx1ZXM9InJlZDtwdXJwbGU7Ymx1ZTtyZWQ7IiBkdXI9IjIwcyIgcmVwZWF0Q291bnQ9ImluZGVmaW5pdGUiIC8+IDwvc3RvcD4gPHN0b3Agb2Zmc2V0PSIwLjUiIHN0b3AtY29sb3I9InB1cnBsZSI+IDxhbmltYXRlIGF0dHJpYnV0ZU5hbWU9InN0b3AtY29sb3IiIHZhbHVlcz0icHVycGxlO2JsdWU7cmVkO3B1cnBsZTsiIGR1cj0iMjBzIiByZXBlYXRDb3VudD0iaW5kZWZpbml0ZSIgLz4gPC9zdG9wPiA8c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9ImJsdWUiPiA8YW5pbWF0ZSBhdHRyaWJ1dGVOYW1lPSJzdG9wLWNvbG9yIiB2YWx1ZXM9ImJsdWU7cmVkO3B1cnBsZTtibHVlOyIgZHVyPSIyMHMiIHJlcGVhdENvdW50PSJpbmRlZmluaXRlIiAvPiA8L3N0b3A+IDxhbmltYXRlVHJhbnNmb3JtIGF0dHJpYnV0ZU5hbWU9ImdyYWRpZW50VHJhbnNmb3JtIiB0eXBlPSJyb3RhdGUiIGZyb209IjAgLjUgLjUiIHRvPSIzNjAgLjUgLjUiIGR1cj0iMTBzIiByZXBlYXRDb3VudD0iaW5kZWZpbml0ZSIgLz4gPC9saW5lYXJHcmFkaWVudD4gPGxpbmVhckdyYWRpZW50IGlkPSJvdmVybGF5R3JhZGllbnRBIiB4MT0iNjIiIHkxPSI0Mi4yMjUzIiB4Mj0iNjIiIHkyPSIyOTAuMjI1IiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSI+IDxzdG9wIG9mZnNldD0iMC4zNCIgc3RvcC1vcGFjaXR5PSIwLjUiIC8+IDxzdG9wIG9mZnNldD0iMSIgc3RvcC1jb2xvcj0id2hpdGUiIHN0b3Atb3BhY2l0eT0iMCIgLz4gPC9saW5lYXJHcmFkaWVudD4gPGxpbmVhckdyYWRpZW50IGlkPSJvdmVybGF5R3JhZGllbnRCIiB4MT0iMTg2IiB5MT0iMCIgeDI9IjE4NiIgeTI9IjI0OCIgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiPiA8c3RvcCBzdG9wLWNvbG9yPSJ3aGl0ZSIgc3RvcC1vcGFjaXR5PSIwIiAvPiA8c3RvcCBvZmZzZXQ9IjAuNjk1IiBzdG9wLW9wYWNpdHk9IjAuNSIgLz4gPC9saW5lYXJHcmFkaWVudD4gPC9kZWZzPiA8cGF0aCBkPSJNMCAxNjYuMjI1QzAgMjM0LjcwOSA1NS41MTY3IDI5MC4yMjUgMTI0IDI5MC4yMjVWNDIuMjI1M0M1NS41MTY3IDQyLjIyNTMgMCA5Ny43NDIgMCAxNjYuMjI1WiBNMjQ4IDEyNEMyNDggMTkyLjQ4MyAxOTIuNDgzIDI0OCAxMjQgMjQ4VjBDMTkyLjQ4MyAwIDI0OCA1NS41MTY3IDI0OCAxMjRaIiBmaWxsPSJ1cmwoI2EpIiAvPiA8cGF0aCBkPSJNMCAxNjYuMjI1QzAgMjM0LjcwOSA1NS41MTY3IDI5MC4yMjUgMTI0IDI5MC4yMjVWNDIuMjI1M0M1NS41MTY3IDQyLjIyNTMgMCA5Ny43NDIgMCAxNjYuMjI1WiIgZmlsbD0idXJsKCNvdmVybGF5R3JhZGllbnRBKSIgLz4gPHBhdGggZD0iTTI0OCAxMjRDMjQ4IDE5Mi40ODMgMTkyLjQ4MyAyNDggMTI0IDI0OFYwQzE5Mi40ODMgMCAyNDggNTUuNTE2NyAyNDggMTI0WiIgZmlsbD0idXJsKCNvdmVybGF5R3JhZGllbnRCKSIgLz4gPGNpcmNsZSBjeD0iMTI0IiBjeT0iMTQ3IiByPSI1MCIgZmlsbD0id2hpdGUiIC8+IDwvc3ZnPg==",Me=Fe(void 0),be=()=>{const e=Ve(Me);if(!e)throw new Error("useToolbarContext must be used within ToolbarContext provider");return e},Ce=()=>{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}},Ye=(e,t)=>{const r=t.split("+"),i=r.at(-1)??"",o=r.includes("Alt"),s=r.includes("Shift"),c=r.includes("Control")||r.includes("Ctrl"),u=r.includes("Meta")||r.includes("Cmd");return(e.key===i||e.code===`Key${i.toUpperCase()}`)&&e.altKey===o&&e.shiftKey===s&&e.ctrlKey===c&&e.metaKey===u},Ze=()=>{const{state:e,updateState:t}=ge(),r=(c,u)=>{const p=u??!e.open;t({open:p,...p?{}:{viewMode:"default"}})},i=()=>{e.open&&t({open:!1,viewMode:"default"})};j(()=>{const c=e.keybindings?.toggle??"Alt+Shift+D",u=p=>{Ye(p,c)&&r()};return globalThis.window?.addEventListener("keydown",u),()=>{globalThis.window?.removeEventListener("keydown",u)}},[e.open,e.keybindings?.toggle]);const o=l(Q(()=>e.open,[e.open]),"panelVisibleValue: boolean");return{closePanel:i,panelVisible:o,togglePanelVisible:r}},de=(e,t,r)=>Math.min(Math.max(e,t),r),ue=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,Ge=()=>{if(globalThis.window===void 0)return{bottom:0,left:0,right:0,top:0};const e=getComputedStyle(document.documentElement);return{bottom:ue(e.getPropertyValue("env(safe-area-inset-bottom)")||"0"),left:ue(e.getPropertyValue("env(safe-area-inset-left)")||"0"),right:ue(e.getPropertyValue("env(safe-area-inset-right)")||"0"),top:ue(e.getPropertyValue("env(safe-area-inset-top)")||"0")}},Oe=()=>{const[e,t]=l(N(()=>({height:globalThis.window?.innerHeight??1080,width:globalThis.window?.innerWidth??1920})),"size");return j(()=>{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},Xe=e=>{const{state:t,updateState:r}=ge(),{height:i,width:o}=Oe(),[s,c]=l(N(!1),"isHovering"),[u,p]=l(N(!1),"isDragging"),[P,k]=l(N(!1),"isViteOverlayOpen"),I=l(g({x:0,y:0}),"draggingOffsetRef"),R=l(g({x:0,y:0}),"mousePositionRef"),H=l(g(void 0),"timerRef"),M=l(g(void 0),"capturedPointerIdRef"),Y=l(g(!1),"isDraggingRef"),S=l(g(o),"windowWidthRef"),_=l(g(i),"windowHeightRef"),L=l(g(r),"updateStateRef");j(()=>{S.current=o,_.current=i},[o,i]),j(()=>{L.current=r},[r]);const[y,$]=l(N(()=>({bottom:10,left:10,right:10,top:10})),"panelMargins");j(()=>{const m=Ge();$({bottom:m.bottom+10,left:m.left+10,right:m.right+10,top:m.top+10})},[]),j(()=>{const m=()=>{const a=globalThis.__v_o__current;if(a?.parentNode){const d=a.shadowRoot?.querySelector("#__v_o__root");k(!!d&&!d.classList.contains("hidden"))}else k(!1)},T=setInterval(m,300);return m(),()=>{clearInterval(T)}},[]);const U=oe(m=>{m.preventDefault(),m.stopPropagation(),p(!0),Y.current=!0;const T=e.current;if(T){const{height:a,left:d,top:x,width:b}=T.getBoundingClientRect();I.current={x:m.clientX-d-b/2,y:m.clientY-x-a/2};const A=m.target;try{A&&A.setPointerCapture?(A.setPointerCapture(m.pointerId),M.current=m.pointerId):T.setPointerCapture&&(T.setPointerCapture(m.pointerId),M.current=m.pointerId)}catch(G){console.warn("Failed to capture pointer:",G)}document.body.style.cursor="grabbing",document.body.style.userSelect="none"}},[e]),O=oe(()=>{c(!0),!(t.minimizePanelInactive<0)&&(H.current&&clearTimeout(H.current),H.current=setTimeout(()=>{c(!1)},t.minimizePanelInactive||5e3))},[t.minimizePanelInactive]);j(()=>{O()},[O]),j(()=>{const m=()=>{if(M.current!==void 0){try{const A=e.current;A&&M.current!==void 0&&A.releasePointerCapture(M.current)}catch{}M.current=void 0}},T=()=>{Y.current&&(p(!1),Y.current=!1,document.body.style.cursor="",document.body.style.userSelect="",m())},a=A=>{T()},d=A=>{T()},x=()=>{Y.current&&(p(!1),Y.current=!1,M.current=void 0,document.body.style.cursor="",document.body.style.userSelect="")},b=A=>{if(!Y.current)return;A.preventDefault();const G=S.current,B=_.current,E=G/2,z=B/2,K=A.clientX,ee=A.clientY,te=K-I.current.x,re=ee-I.current.y;R.current={x:te,y:re};const v=Math.max(0,Math.min(K,G)),F=Math.max(0,Math.min(ee,B)),D=Math.atan2(F-z,v-E),V=70,ie=Math.atan2(0-z+V,0-E),ae=Math.atan2(0-z+V,G-E),ze=Math.atan2(B-V-z,0-E),xe=Math.atan2(B-V-z,G-E);let le;D>=ie&&D<=ae?le="top":D>=ae&&D<=xe?le="right":D>=xe&&D<=ze?le="bottom":le="left";const Se=Math.max(0,Math.min(100,te/G*100)),Ee=Math.max(0,Math.min(100,re/B*100));L.current({left:we(Se),position:le,top:we(Ee)})};return document.addEventListener("pointermove",b,{capture:!0,passive:!1}),document.addEventListener("pointerup",a,{capture:!0}),document.addEventListener("pointercancel",d,{capture:!0}),document.addEventListener("lostpointercapture",x,{capture:!0}),()=>{document.removeEventListener("pointermove",b,{capture:!0}),document.removeEventListener("pointerup",a,{capture:!0}),document.removeEventListener("pointercancel",d,{capture:!0}),document.removeEventListener("lostpointercapture",x,{capture:!0})}},[]);const C=l(Q(()=>t.position==="left"||t.position==="right",[t.position]),"isVertical"),w=l(Q(()=>{if(t.minimizePanelInactive<0)return!1;if(t.minimizePanelInactive===0)return!0;const m=globalThis.window!==void 0&&("ontouchstart"in globalThis.window||(globalThis.navigator?.maxTouchPoints??0)>0);return!u&&!t.open&&!s&&!m&&t.minimizePanelInactive>0&&!P},[u,t.open,t.minimizePanelInactive,s,P]),"isHidden"),W=l(Q(()=>{const m=e.current,T=(m?.clientWidth??0)/2,a=(m?.clientHeight??0)/2,d=C?a:T,x=C?T:a,b=t.left*o/100,A=t.top*i/100;switch(t.position){case"left":return{left:y.left+d-(w?30:0),top:de(A,x+y.top,i-x-y.bottom)};case"right":return{left:o-y.right-d+(w?15:0)-(w?0:10),top:de(A,x+y.top,i-x-y.bottom)};case"top":return{left:de(b,d+y.left,o-d-y.right),top:y.top+x-(w?30:0)};default:return{left:de(b,d+y.left,o-d-y.right),top:i-y.bottom-x+(w?30:0)}}},[t.left,t.open,t.position,t.top,i,o,y,e,w,C]),"anchorPos"),ne=l(Q(()=>({left:`${W.left}px`,top:`${W.top}px`,transition:u?"none":"left 0.3s ease, top 0.3s ease"}),[W,u]),"anchorStyle"),X=l(Q(()=>{R.current.x,R.current.y;const m=e.current,T=(m?.clientWidth??0)/2,a=(m?.clientHeight??0)/2,d=C?a:T,x=C?T:a,b={bottom:y.bottom+x,left:y.left+d,right:y.right+d,top:y.top+x},A=b.left+b.right,G=b.top+b.bottom,B=o-A,E=i-G,z={height:`min(${t.height}vh, calc(100vh - ${G}px))`,pointerEvents:u?"none":"auto",width:`min(${t.width}vw, calc(100vw - ${A}px))`,zIndex:"-1"},K=W,ee=Math.min(B,t.width*o/100),te=Math.min(E,t.height*i/100),re=K?.left??0,v=K?.top??0;switch(t.position){case"bottom":case"top":{z.left="0",z.transform="translate(-50%, 0)",re-b.left<ee/2?z.left=`${ee/2-re+b.left}px`:o-re-b.right<ee/2&&(z.left=`${o-re-ee/2-b.right}px`);break}default:{z.top="0",z.transform="translate(0, -50%)",v-b.top<te/2?z.top=`${te/2-v+b.top}px`:i-v-b.bottom<te/2&&(z.top=`${i-v-te/2-b.bottom}px`);break}}switch(t.position){case"left":{z.left="0";break}case"right":{z.right="0";break}case"top":{z.top="0";break}default:{z.bottom="0";break}}return z},[W,u,y,t.height,t.position,t.width,i,o,e,C]),"iframeStyle"),Z=l(Q(()=>{const m={transform:C?"translate(-50%, -50%) rotate(90deg)":"translate(-50%, -50%)"};return u&&(m.transition="none !important"),m},[u,C]),"panelStyle");return{anchorStyle:ne,bringUp:O,iframeStyle:X,isDragging:u,isHidden:w,isVertical:C,onPointerDown:U,panelStyle:Z}},ke="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",Ue="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",Qe="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",Ke="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",Re="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",Te=({app:e})=>{const t=l(g(null),"contentRef"),r=l(g(!1),"initializedRef"),i=l(g(ce()),"helpersRef");return j(()=>{if(!t.current||r.current||e.component||e.view?.type==="iframe")return;const o=t.current;if(e.init){const s=document.createElement("div");s.style.cssText="width:100%;height:100%;",o.append(s);const c=s.attachShadow({mode:"open"});se&&(c.adoptedStyleSheets=[se]);const u=ce(),p=e.init(c,e.eventTarget,u);return p&&typeof p.then=="function"?p.then(()=>{r.current=!0}).catch(P=>{console.error(`[dev-toolbar] Failed to init app ${e.id}:`,P)}):r.current=!0,()=>{for(;o.firstChild;)o.firstChild.remove();r.current=!1}}},[e]),e.view?.type==="iframe"?n("iframe",{class:"w-full h-full block border-0",src:e.view.src,title:e.name}):e.component?n(e.component,{eventTarget:e.eventTarget,helpers:i.current}):n("div",{class:"w-full h-full",ref:t})},Pe=e=>e==="error"?"bg-destructive":e==="warning"?"bg-warning":"bg-info",et=({apps:e,initialActiveAppId:t,onClose:r})=>{const[i,o]=l(N(t),"activeAppId"),[s,c]=l(N(!1),"sidebarCollapsed"),u=l(Q(()=>e.find(p=>p.id===i),[e,i]),"activeApp");return f("div",{class:"flex flex-row w-full h-full bg-background font-mono antialiased text-foreground",children:[f("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)]",s?"w-12.5":"w-62.5"),children:[n("div",{class:h("flex items-center shrink-0 border-b border-border/50 h-12",s?"justify-center px-2":"px-3"),children:s?n("span",{"aria-hidden":"true",class:"text-primary font-black text-[0.8rem] select-none",children:"V"}):f("span",{class:"text-[0.6rem] font-bold uppercase tracking-[0.14em] text-muted-foreground select-none",children:[n("span",{"aria-hidden":"true",class:"text-primary/60 mr-1",children:"//"}),"DevTools"]})}),n("div",{class:"flex flex-col flex-1 overflow-y-auto p-2 gap-1 scrollbar-thin-border",children:e.filter(p=>p.component||p.init||p.view?.type==="iframe").map(p=>f("div",{class:"relative group/nav-item",children:[f("button",{"aria-label":p.name,"aria-pressed":i===p.id,class:h("relative flex items-center w-full h-10","border-0 border-l-2 cursor-pointer","transition-all duration-150",s?"justify-center px-0":"gap-2.5 px-3",i===p.id?"border-primary bg-primary/8 text-foreground":"border-transparent bg-transparent text-muted-foreground hover:bg-foreground/6 hover:text-foreground"),onClick:()=>{o(p.id)},type:"button",children:[p.icon?n("span",{class:h("size-4 shrink-0 flex items-center justify-center [&_svg]:size-4",i===p.id?"opacity-100":"opacity-65 group-hover/nav-item:opacity-100"),dangerouslySetInnerHTML:{__html:p.icon}}):n("span",{class:"size-4.5 shrink-0 flex items-center justify-center text-[0.65rem] font-bold uppercase select-none",children:p.name.slice(0,2)}),!s&&n("span",{class:"text-[0.8125rem] font-medium truncate leading-none tracking-[-0.01em]",children:p.name})]}),p.notification.state&&n("span",{"aria-hidden":"true",class:h("pointer-events-none absolute top-1.5 rounded-full",s?"right-1.5":"right-2.5","size-1.5",Pe(p.notification.level))}),s&&n("div",{class:h("absolute left-[calc(100%+0.5rem)] top-1/2 -translate-y-1/2","pointer-events-none z-50 whitespace-nowrap","opacity-0 -translate-x-1 group-hover/nav-item:opacity-100 group-hover/nav-item:translate-x-0","transition-all duration-200 ease-[cubic-bezier(0.23,1,0.32,1)]"),children:n("div",{class:"text-[0.7rem] font-medium bg-card/95 backdrop-blur-[0.625rem] text-foreground/80 px-2.5 py-1 border border-border shadow-md",children:p.name})})]},p.id))})]}),f("div",{class:"flex-1 flex flex-col min-w-0 overflow-hidden bg-accent",children:[f("div",{class:"flex items-center justify-between gap-2 pr-2 min-h-12 shrink-0",children:[f("div",{class:"flex items-center gap-3 min-w-0",children:[n("button",{"aria-label":s?"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(p=>!p)},type:"button",children:n(q,{class:h("size-3.5 transition-transform duration-300",!s&&"rotate-180"),size:14,src:ke})}),u?.icon&&n("span",{class:"size-5 flex items-center justify-center [&_svg]:size-5 shrink-0 text-foreground opacity-80",dangerouslySetInnerHTML:{__html:u.icon}}),f("span",{class:"flex items-center gap-1 text-[0.7rem] font-bold uppercase tracking-[0.06em] text-foreground truncate",children:[n("span",{"aria-hidden":"true",class:"text-primary/50 shrink-0",children:"["}),u?.name??"DevTools",n("span",{"aria-hidden":"true",class:"text-primary/50 shrink-0",children:"]"})]})]}),n("button",{"aria-label":"Close floating window",class:h("flex items-center justify-center size-8","cursor-pointer border-0 bg-transparent","text-muted-foreground hover:text-foreground hover:bg-foreground/7","transition-all duration-200 active:scale-90"),onClick:r,title:"Close floating window",type:"button",children:n(q,{size:12,src:Re})})]}),n("div",{class:"devtools-content-scroll scrollbar-thin-border flex-1 overflow-auto min-h-0 bg-background",children:u?n(Te,{app:u},u.id):n("div",{class:"flex flex-col items-center justify-center h-full gap-3 p-8 select-none text-muted-foreground",children:n("p",{class:"text-[0.8rem]",children:"Select a tool from the sidebar"})})})]})]})},pe=20,he=95,fe=(e,t,r)=>Math.min(Math.max(e,t),r),tt=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"}},rt=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]"}},nt=(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:i,panelVisible:o,position:s})=>{const[c,u]=l(N(!1),"isRendered"),[p,P]=l(N(!1),"isVisible"),[k,I]=l(N(!1),"sidebarCollapsed"),[,R]=l(N(0),"rerender"),{state:H,updateState:M}=ge(),{resolvedTheme:Y}=Ie(),S=l(g(null),"panelDivRef"),_=l(g(!1),"isResizingRef"),L=l(g({height:H.height,width:H.width}),"dimensionsRef"),y=l(g(void 0),"enteringFromRectRef"),$=l(g(void 0),"lastDockedRectRef"),U=l(g(!1),"previousIsFullscreenRef"),O=l(g(!1),"isExitAnimatingRef"),C=l(g(void 0),"fsTimerRef"),w=H.viewMode==="fullscreen",W=H.viewMode==="wide",ne=globalThis.window?.documentPictureInPicture!==void 0,X=l(g(void 0),"pipWindowRef"),Z=l(Q(()=>{if(w)return{};const a=globalThis.window?.innerWidth??1920,d=globalThis.window?.innerHeight??1080,x=`${L.current.height/100*d}px`;return s==="left"||s==="right"?{width:`${L.current.width/100*a}px`}:{height:x,left:"50%",transform:"translateX(-50%)",width:W?"calc(100vw - 2rem)":"min(calc(100vw - 2rem), 1280px)"}},[w,W,s,R]),"panelSizeStyle");j(()=>{const a=x=>{if(!_.current||!S.current)return;const b=S.current.getBoundingClientRect(),A=window.innerWidth,G=window.innerHeight,B={...L.current};if(_.current.top){const E=Math.abs(b.bottom-x.clientY);B.height=fe(E/G*100,pe,he)}else if(_.current.bottom){const E=Math.abs(x.clientY-b.top);B.height=fe(E/G*100,pe,he)}else if(_.current.right){const E=Math.abs(x.clientX-b.left);B.width=fe(E/A*100,pe,he)}else if(_.current.left){const E=Math.abs(b.right-x.clientX);B.width=fe(E/A*100,pe,he)}L.current=B,R(E=>E+1)},d=()=>{_.current&&(M({height:L.current.height,width:L.current.width}),_.current=!1)};return globalThis.addEventListener("mousemove",a),globalThis.addEventListener("mouseup",d),()=>{globalThis.removeEventListener("mousemove",a),globalThis.removeEventListener("mouseup",d)}},[M]),He(()=>{const a=U.current;U.current=w,C.current!==void 0&&(clearTimeout(C.current),C.current=void 0);const d=S.current;if(d)if(w&&!a&&y.current){const x=y.current;y.current=void 0;const b=globalThis.window?.innerWidth??0,A=globalThis.window?.innerHeight??0;d.style.transition="clip-path 0.35s cubic-bezier(0.4, 0, 0.2, 1)",d.style.clipPath=`inset(${x.top}px ${b-x.right}px ${A-x.bottom}px ${x.left}px)`,requestAnimationFrame(()=>{d.style.clipPath="inset(0px 0px 0px 0px)",C.current=setTimeout(()=>{d.style.clipPath="",d.style.transition="",C.current=void 0},380)})}else!w&&a&&!O.current&&(d.style.transition="none",d.style.clipPath="",requestAnimationFrame(()=>{d.style.transition=""}))},[w]),j(()=>{if(o){u(!0);const d=setTimeout(P,16,!0);return()=>{clearTimeout(d)}}P(!1);const a=setTimeout(u,220,!1);return()=>{clearTimeout(a)}},[o]);const J=async()=>{const a=globalThis.window?.documentPictureInPicture;if(a)try{const d=await a.requestWindow({height:600,width:900});if(X.current=d,se){const b=d.document.createElement("style");b.textContent=Array.from(se.cssRules,A=>A.cssText).join(`
|
|
2
|
+
`),d.document.head.append(b)}const x=d.document.createElement("div");x.style.cssText="width:100%;height:100%;display:flex;",Y==="dark"&&(d.document.documentElement.classList.add("dark"),x.classList.add("dark")),d.document.body.style.cssText="margin:0;padding:0;height:100vh;",d.document.body.append(x),me(n(et,{apps:t,initialActiveAppId:e,onClose:()=>{d.close()}}),x),M({isPip:!0}),d.addEventListener("pagehide",()=>{M({isPip:!1}),X.current=void 0})}catch(d){console.error("[dev-toolbar] PiP activation failed:",d)}};j(()=>{if(!o)return;const a=d=>{d.key==="Escape"&&r()};return document.addEventListener("keydown",a),()=>{document.removeEventListener("keydown",a)}},[o,r]);const m=l(Q(()=>t.find(a=>a.id===e),[t,e]),"activeApp");if(!c)return;const T=a=>d=>{d.preventDefault(),_.current=a};return f(ve,{children:[n("div",{"aria-hidden":"true",class:h("fixed inset-0 z-[2147483646]","transition-opacity duration-200",p&&!w?"opacity-100 pointer-events-auto":"opacity-0 pointer-events-none"),onClick:H.closeOnOutsideClick?r:void 0,role:"presentation"}),f("div",{"aria-label":"DevTools panel","aria-modal":"true",class:h("fixed z-[2147483647] pointer-events-auto antialiased font-mono",w?"inset-0":tt(s),"bg-background overflow-hidden",w?"rounded-none border-0":"rounded-none border border-border","shadow-2xl","transition-panel",!w&&rt(s),nt(s,p),"flex flex-row"),ref:S,role:"dialog",style:Z,children:[!w&&f(ve,{children:[s!=="top"&&n("div",{"aria-hidden":"true",class:"absolute left-1.5 right-1.5 top-0 h-2.5 -mt-1 cursor-ns-resize z-10 hover:bg-foreground/10 transition-colors",onMouseDown:T({top:!0})}),s==="top"&&n("div",{"aria-hidden":"true",class:"absolute left-1.5 right-1.5 bottom-0 h-2.5 -mb-1 cursor-ns-resize z-10 hover:bg-foreground/10 transition-colors",onMouseDown:T({bottom:!0})}),s==="left"&&n("div",{"aria-hidden":"true",class:"absolute top-1.5 bottom-1.5 right-0 w-2.5 -mr-1 cursor-ew-resize z-10 hover:bg-foreground/10 transition-colors",onMouseDown:T({right:!0})}),s==="right"&&n("div",{"aria-hidden":"true",class:"absolute top-1.5 bottom-1.5 left-0 w-2.5 -ml-1 cursor-ew-resize z-10 hover:bg-foreground/10 transition-colors",onMouseDown:T({left:!0})})]}),f("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",k?"w-12.5":"w-62.5"),children:[n("div",{class:h("flex items-center shrink-0 border-b border-border/50 h-12",k?"justify-center px-2":"px-3"),children:k?n("span",{"aria-hidden":"true",class:"text-primary font-black text-[0.8rem] select-none",children:"V"}):f("span",{class:"text-[0.6rem] font-bold uppercase tracking-[0.14em] text-muted-foreground select-none",children:[n("span",{"aria-hidden":"true",class:"text-primary/60 mr-1",children:"//"}),"DevTools"]})}),n("div",{class:"flex flex-col flex-1 overflow-y-auto p-2 gap-1 scrollbar-thin-border",children:t.filter(a=>a.component||a.init||a.view?.type==="iframe").map(a=>f("div",{class:"relative group/nav-item",children:[f("button",{"aria-label":a.name,"aria-pressed":e===a.id,class:h("relative flex items-center w-full h-10","border-0 border-l-2 cursor-pointer","transition-all duration-150",k?"justify-center px-0":"gap-2.5 px-3",e===a.id?"border-primary bg-primary/8 text-foreground":"border-transparent bg-transparent text-muted-foreground hover:bg-foreground/6 hover:text-foreground"),onClick:()=>{a.id!==e&&i(a.id).catch(console.error)},type:"button",children:[a.icon?n("span",{class:h("size-4 shrink-0 flex items-center justify-center [&_svg]:size-4",e===a.id?"opacity-100":"opacity-65 group-hover/nav-item:opacity-100"),dangerouslySetInnerHTML:{__html:a.icon}}):n("span",{class:"size-4.5 shrink-0 flex items-center justify-center text-[0.65rem] font-bold uppercase select-none",children:a.name.slice(0,2)}),!k&&n("span",{class:"text-[0.8125rem] font-medium truncate leading-none tracking-[-0.01em]",children:a.name})]}),a.notification.state&&n("span",{"aria-hidden":"true",class:h("pointer-events-none absolute top-1.5 rounded-full",k?"right-1.5":"right-2.5","size-1.5",Pe(a.notification.level))}),k&&n("div",{class:h("absolute left-[calc(100%+0.5rem)] top-1/2 -translate-y-1/2","pointer-events-none z-50 whitespace-nowrap","opacity-0 -translate-x-1 group-hover/nav-item:opacity-100 group-hover/nav-item:translate-x-0","transition-all duration-200 ease-[cubic-bezier(0.23,1,0.32,1)]"),children:n("div",{class:"text-[0.7rem] font-medium bg-card/95 backdrop-blur-[0.625rem] text-foreground/80 px-2.5 py-1 border border-border shadow-md",children:a.name})})]},a.id))}),!k&&n("div",{class:"px-3 py-2.5 border-t border-border/40 shrink-0",children:f("span",{class:"text-[0.58rem] text-muted-foreground/50 leading-none select-none",children:[H.keybindings?.toggle??"Alt+Shift+D"," to toggle"]})})]}),f("div",{class:"flex-1 flex flex-col min-w-0 overflow-hidden bg-accent",children:[f("div",{class:"flex items-center justify-between gap-2 pr-2 min-h-12 shrink-0",children:[f("div",{class:"flex items-center gap-3 min-w-0",children:[n("button",{"aria-label":k?"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:()=>{I(a=>!a)},type:"button",children:n(q,{class:h("size-3.5 transition-transform duration-300",!k&&"rotate-180"),size:14,src:ke})}),m?.icon&&n("span",{class:"size-5 flex items-center justify-center [&_svg]:size-5 shrink-0 text-foreground opacity-80",dangerouslySetInnerHTML:{__html:m.icon}}),f("span",{class:"flex items-center gap-1 text-[0.7rem] font-bold uppercase tracking-[0.06em] text-foreground truncate",children:[n("span",{"aria-hidden":"true",class:"text-primary/50 shrink-0",children:"["}),m?.name??"DevTools",n("span",{"aria-hidden":"true",class:"text-primary/50 shrink-0",children:"]"})]})]}),f("div",{class:"flex items-center gap-1 shrink-0",children:[(s==="bottom"||s==="top")&&!w&&n("button",{"aria-label":W?"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:W?"default":"wide"})},title:W?"Container width":"Full width",type:"button",children:n(q,{size:13,src:W?qe:Ue})}),n("button",{"aria-label":w?"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(w){const a=S.current,d=$.current;if(a&&d){const x=globalThis.window?.innerWidth??0,b=globalThis.window?.innerHeight??0,A=`inset(${d.top}px ${x-d.right}px ${b-d.bottom}px ${d.left}px)`;C.current!==void 0&&(clearTimeout(C.current),C.current=void 0),O.current=!0,a.style.transition="clip-path 0.35s cubic-bezier(0.4, 0, 0.2, 1)",a.style.clipPath="inset(0px 0px 0px 0px)",requestAnimationFrame(()=>{a.style.clipPath=A,C.current=setTimeout(()=>{a.style.clipPath="",a.style.transition="",O.current=!1,C.current=void 0,M({viewMode:"default"})},380)})}else M({viewMode:"default"})}else{if(S.current){const a=S.current.getBoundingClientRect();y.current=a,$.current=a}M({viewMode:"fullscreen"})}},title:w?"Exit fullscreen":"Fullscreen",type:"button",children:n(q,{size:13,src:w?Qe:Je})}),ne&&!w&&n("button",{"aria-label":"Open in Picture-in-Picture window",class:h("flex items-center justify-center size-8","cursor-pointer border-0 bg-transparent",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:()=>{J().then(()=>{r()}).catch(console.error)},title:"Open in floating window (PiP)",type:"button",children:n(q,{size:13,src:Ke})}),n("button",{"aria-label":"Close DevTools panel",class:h("flex items-center justify-center size-8","cursor-pointer border-0 bg-transparent","text-muted-foreground hover:text-foreground hover:bg-foreground/7","transition-all duration-200 active:scale-90"),onClick:r,title:"Close (Esc)",type:"button",children:n(q,{size:12,src:Re})})]})]}),n("div",{class:"devtools-content-scroll scrollbar-thin-border flex-1 overflow-auto min-h-0 bg-background",children:m?n(Te,{app:m},m.id):f("div",{class:"flex flex-col items-center justify-center h-full gap-7 p-8 select-none",children:[f("div",{class:"flex flex-col items-center gap-3",children:[n("div",{class:"size-14 border border-primary/25 bg-primary/5 flex items-center justify-center",children:n(q,{class:"text-primary/45",size:26,src:$e})}),f("div",{class:"text-center space-y-1",children:[n("p",{class:"text-[0.8rem] font-medium text-foreground/65",children:"No tool selected"}),n("p",{class:"text-[0.7rem] text-muted-foreground",children:"Choose a tool from the sidebar to get started"})]})]}),t.length>0&&f("div",{class:"w-full max-w-[220px]",children:[f("p",{class:"text-[0.58rem] font-bold uppercase tracking-[0.12em] text-muted-foreground/60 mb-1.5",children:[n("span",{class:"text-primary/50",children:"// "}),"available"]}),n("div",{class:"flex flex-col gap-0.5",children:t.map(a=>f("button",{class:h("flex items-center gap-2.5 px-3 py-2","border border-border/40 bg-card/50","hover:border-primary/30 hover:bg-primary/4","cursor-pointer transition-all duration-150 text-left"),onClick:()=>i(a.id).catch(console.error),type:"button",children:[a.icon?n("span",{class:"size-3.5 shrink-0 flex items-center justify-center [&_svg]:size-3.5 text-muted-foreground",dangerouslySetInnerHTML:{__html:a.icon}}):n("span",{class:"size-3.5 text-[0.5rem] font-bold text-muted-foreground shrink-0 text-center",children:a.name.slice(0,2).toUpperCase()}),n("span",{class:"text-[0.75rem] font-medium text-muted-foreground",children:a.name})]},a.id))})]})]})})]})]})]})},ot="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",st=(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%)"}}},at=({position:e})=>{const{hoveredApp:t,hoveredAppRect:r,pinTooltip:i,setHoveredApp:o}=be(),s=l(g(null),"overlayRef"),c=l(g(ce()),"helpersRef"),[u,p]=l(N(!1),"isRendered"),[P,k]=l(N(!1),"isVisible"),I=!!(t?.tooltip&&r);if(j(()=>{if(I){p(!0);const _=setTimeout(k,16,!0);return()=>{clearTimeout(_)}}k(!1);const S=setTimeout(p,200,!1);return()=>{clearTimeout(S)}},[I]),!u||!t?.tooltip||!r)return;const R=t.tooltip,H=st(r,e),M=e==="left"||e==="right",Y=()=>{const S=s.current?.getBoundingClientRect();S&&i(t,S.left,S.top),o(void 0)};return f("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)]",P?"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:()=>{o(t,r)},onMouseLeave:()=>{o(void 0)},ref:s,role:"tooltip",style:H,children:[f("div",{class:"flex items-center justify-between gap-2 px-3 py-2 border-b border-border/60 bg-foreground/3",children:[f("div",{class:"flex items-center gap-2 min-w-0",children:[n("span",{"aria-hidden":"true",class:"size-1.5 rounded-full bg-primary shrink-0"}),n("span",{class:"text-[0.6rem] font-bold uppercase tracking-[0.1em] text-muted-foreground truncate",children:t.name})]}),n("button",{"aria-label":`Pin ${t.name} tooltip`,class:h("size-5 flex items-center justify-center shrink-0","border-0 bg-transparent cursor-pointer p-0","text-muted-foreground/60 hover:text-primary","transition-colors duration-150"),onClick:Y,title:"Pin (keep visible)",type:"button",children:n(q,{size:11,src:ot})})]}),n("div",{class:"p-3",children:n(R,{helpers:c.current})})]})},lt=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))"}}},ct=({position:e})=>{const t="absolute w-2.5 h-2.5 bg-card border-border";switch(e){case"left":return n("div",{"aria-hidden":"true",class:h(t,"left-[-5px] top-1/2 -translate-y-1/2 rotate-45 border-b border-l")});case"right":return n("div",{"aria-hidden":"true",class:h(t,"right-[-5px] top-1/2 -translate-y-1/2 rotate-45 border-t border-r")});case"top":return n("div",{"aria-hidden":"true",class:h(t,"top-[-5px] left-1/2 -translate-x-1/2 rotate-45 border-t border-l")});default:return n("div",{"aria-hidden":"true",class:h(t,"bottom-[-5px] left-1/2 -translate-x-1/2 rotate-45 border-b border-r")})}},dt=[{icon:"⊙",text:"Click logo to open panel"},{icon:"⠿",text:"Drag pill to reposition"},{icon:"⌨",text:"Alt+Shift+D to toggle"}],ut=({onDismiss:e,position:t})=>{const[r,i]=l(N(!1),"visible"),o=l(g(void 0),"dismissTimeoutRef");j(()=>{const c=setTimeout(i,600,!0);return()=>{clearTimeout(c)}},[]),j(()=>()=>{o.current!==void 0&&(clearTimeout(o.current),o.current=void 0)},[]);const s=()=>{i(!1),o.current=setTimeout(e,180)};return f("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:lt(t),children:[n(ct,{position:t}),f("p",{class:"flex items-center gap-1.5 mb-2.5",children:[n("span",{"aria-hidden":"true",class:"text-primary text-[0.6rem]",children:"▶"}),n("span",{class:"text-[0.6rem] font-bold uppercase tracking-[0.12em] text-foreground",children:"Quick start"})]}),n("ul",{class:"space-y-1.5 mb-3 list-none p-0 m-0",children:dt.map(({icon:c,text:u})=>f("li",{class:"flex items-center gap-2 text-[0.7rem] text-muted-foreground",children:[n("span",{"aria-hidden":"true",class:"text-primary shrink-0 w-3 text-center leading-none",children:c}),u]},u))}),n("button",{class:h("w-full h-6 text-[0.6rem] font-bold uppercase tracking-[0.1em]","border border-primary/30 bg-primary/6","text-primary cursor-pointer","hover:bg-primary/12 hover:border-primary/50","transition-all duration-150 active:scale-[0.98]"),onClick:s,tabIndex:r?void 0:-1,type:"button",children:"Got it"})]})},pt="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",ht=({onMove:e,onUnpin:t,pinned:r})=>{const i=l(g(null),"cardRef"),o=l(g(null),"headerRef"),s=l(g({x:r.initialX,y:r.initialY}),"posRef"),c=l(g(void 0),"dragRef"),u=l(g(ce()),"helpersRef"),p=l(g(e),"onMoveRef"),P=l(g(r.id),"pinnedIdRef");p.current=e,P.current=r.id,j(()=>{const H="transform 110ms cubic-bezier(0.25,0.46,0.45,0.94)",M=S=>{if(!c.current||!i.current)return;const _=globalThis.window?.innerWidth??9999,L=globalThis.window?.innerHeight??9999,{cardH:y,cardW:$}=c.current,U=Math.min(80,$),O=Math.min(36,y);let C=c.current.origX+(S.clientX-c.current.startX),w=c.current.origY+(S.clientY-c.current.startY);C=Math.max(U-$,Math.min(_-U,C)),w=Math.max(O-y,Math.min(L-O,w));const W=[0,_-$,U-$,_-U],ne=[0,L-y,O-y,L-O];let X=C,Z=w;for(const J of W)if(Math.abs(C-J)<28){X=J;break}for(const J of ne)if(Math.abs(w-J)<28){Z=J;break}i.current.style.transition=X!==C||Z!==w?H:"",i.current.style.transform=`translate(${X}px, ${Z}px)`,s.current={x:X,y:Z}},Y=()=>{c.current&&(c.current=void 0,i.current&&(i.current.style.transition=""),o.current&&(o.current.style.cursor=""),p.current(P.current,s.current.x,s.current.y))};return document.addEventListener("mousemove",M),document.addEventListener("mouseup",Y),()=>{document.removeEventListener("mousemove",M),document.removeEventListener("mouseup",Y)}},[]);const k=r.app.tooltip;if(!k)return;const I=R=>{R.button===0&&(c.current={cardH:i.current?.offsetHeight??200,cardW:i.current?.offsetWidth??300,origX:s.current.x,origY:s.current.y,startX:R.clientX,startY:R.clientY},o.current&&(o.current.style.cursor="grabbing"),R.preventDefault())};return f("div",{"aria-label":`${r.app.name} pinned tooltip`,class:h("fixed z-[2147483647] pointer-events-auto antialiased toolbar-font","w-auto max-w-[300px]","bg-background border border-primary/40 shadow-2xl"),ref:i,style:{left:0,top:0,transform:`translate(${s.current.x}px, ${s.current.y}px)`},children:[f("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:o,children:[f("div",{class:"flex items-center gap-2 min-w-0",children:[n("span",{"aria-hidden":"true",class:"size-1.5 rounded-full bg-primary shrink-0"}),n("span",{class:"text-[0.6rem] font-bold uppercase tracking-[0.1em] text-primary/70 truncate",children:r.app.name})]}),n("button",{"aria-label":`Unpin ${r.app.name}`,class:h("size-5 flex items-center justify-center shrink-0","border-0 bg-transparent cursor-pointer p-0","text-muted-foreground/50 hover:text-destructive","transition-colors duration-150"),onClick:()=>{t(r.id)},onMouseDown:R=>{R.stopPropagation()},title:"Unpin",type:"button",children:n(q,{size:11,src:pt})})]}),n("div",{class:"p-3",children:n(k,{helpers:u.current})})]})},ft=({app:e})=>{const{toggleApp:t}=Ce(),{isVisible:r,setHoveredApp:i}=be(),o=l(g(null),"buttonRef"),s=()=>{i(void 0),t(e.id).catch(p=>{console.error(`[dev-toolbar] Failed to toggle app ${e.id}:`,p)})},c=()=>{!e.tooltip||r||i(e,o.current?.getBoundingClientRect())},u=()=>{e.tooltip&&i(void 0)};return n("button",{"aria-label":e.name,class:h("relative flex justify-center items-center","border-0","whitespace-nowrap no-underline p-0 m-0","cursor-pointer","bg-transparent text-muted-foreground","transition-all duration-150","hover:bg-primary/8 hover:text-primary","active:scale-[0.94]",e.active&&"bg-primary/12 text-primary","group-data-[vertical]/panel:rotate-[-90deg]"),"data-app-id":e.id,onClick:s,onMouseEnter:c,onMouseLeave:u,ref:o,title:e.tooltip?void 0:e.name,type:"button",children:f("div",{class:"relative size-6 select-none flex items-center justify-center",children:[n("div",{class:"size-6 flex items-center justify-center [&_svg]:size-4.5",dangerouslySetInnerHTML:{__html:e.icon}}),e.notification.state&&n("span",{class:h("absolute -top-1 -right-1 size-1.5 rounded-full border border-background",e.notification.level==="error"&&"bg-destructive",e.notification.level==="warning"&&"bg-warning",(!e.notification.level||e.notification.level==="info")&&"bg-info"),"data-level":e.notification.level||"info"})]})})},gt="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",mt=()=>{const[e,t]=l(N(0),"errorCount"),[r,i]=l(N(!1),"isOverlayOpen");if(j(()=>{const c=()=>{const p=globalThis.__v_o_error_history,P=Array.isArray(p)?p.length:0;t(P);const k=globalThis.__v_o__current;if(k?.parentNode){const I=k.shadowRoot?.querySelector("#__v_o__root");i(!!I&&!I.classList.contains("hidden"))}else i(!1)},u=setInterval(c,300);return c(),()=>{clearInterval(u)}},[]),e===0)return;const o=()=>{const c=globalThis.__v_o__current;if(!c?.parentNode)return;const u=c.shadowRoot?.querySelector("#__v_o__root");u?.classList.contains("hidden")?(u.classList.remove("hidden"),i(!0)):typeof c.close=="function"&&(c.close(),i(!1))},s=`${e} error${e===1?"":"s"} – click to ${r?"hide":"show"} overlay`;return f(ve,{children:[n("div",{"aria-hidden":"true",class:"w-px h-5 bg-primary/20 shrink-0 mx-0.5"}),n("button",{"aria-label":s,class:h("relative flex justify-center items-center size-6","border-0","whitespace-nowrap no-underline p-0 m-0","cursor-pointer","bg-transparent text-destructive","transition-all duration-150","hover:bg-destructive/8","active:scale-[0.94]","group-data-[vertical]/panel:rotate-[-90deg]"),onClick:o,title:s,type:"button",children:f("div",{class:"relative size-6 select-none flex items-center justify-center",children:[n(q,{size:16,src:gt}),n("span",{class:"absolute -top-0.5 -right-1 min-w-3.5 h-3.5 px-0.5 rounded-full bg-destructive text-white text-[9px] font-bold leading-none flex items-center justify-center border border-background",children:e>9?"9+":e})]})})]})},vt=()=>{const{apps:e}=Ce();return n("div",{class:"flex items-center pointer-events-auto",id:"__v_dt__bar",children:f("div",{class:"flex flex-row items-center justify-start gap-1",id:"__v_dt__bar_container",children:[e.map(t=>n(ft,{app:t},t.id)),n(mt,{})]})})},ye="__v_dt__pinned_tooltips",bt=(e,t,r,i,o)=>{const s=t*i/100,c=r*o/100,u=i/4;switch(e){case"bottom":return s<u?"bottom-left":s>i-u?"bottom-right":"bottom-center";case"left":return c<o/2?"top-left":"bottom-left";case"right":return c<o/2?"top-right":"bottom-right";case"top":return s<u?"top-left":s>i-u?"top-right":"top-center";default:return"bottom-center"}},xt=({activeAppId:e,apps:t,onClearNotification:r,onRegisterApp:i,onSetNotification:o,onToggleApp:s,onUnregisterApp:c})=>{const u=l(g(null),"anchorRef"),p=l(g(null),"panelRef"),P=l(g(void 0),"leaveTimerRef"),{resolvedTheme:k}=Ie(),{state:I,updateState:R}=ge(),{closePanel:H,panelVisible:M,togglePanelVisible:Y}=Ze(),{anchorStyle:S,bringUp:_,isDragging:L,isHidden:y,isVertical:$,onPointerDown:U,panelStyle:O}=Xe(p),[C,w]=l(N(void 0),"hoveredApp"),[W,ne]=l(N(void 0),"hoveredAppRect"),X=l(g(new Map),"pinPositionsRef"),Z=oe(v=>{try{const F=v.map(D=>{const V=X.current.get(D.id);return{appId:D.app.id,x:V?.x??D.initialX,y:V?.y??D.initialY}});localStorage.setItem(ye,JSON.stringify(F))}catch{}},[]),[J,m]=l(N([]),"pinnedTooltips"),T=l(g([]),"pinnedTooltipsRef");T.current=J;const a=oe((v,F,D)=>{const V=`${v.id}-${Date.now()}`;m(ie=>{const ae=[...ie,{app:v,id:V,initialX:F,initialY:D}];return Z(ae),ae})},[Z]),d=oe(v=>{m(F=>{const D=F.filter(V=>V.id!==v);return X.current.delete(v),Z(D),D})},[Z]),x=oe((v,F,D)=>{X.current.set(v,{x:F,y:D}),Z(T.current)},[Z]),b=l(g(void 0),"storedPinsRef"),A=l(g(new Set),"restoredAppIdsRef");j(()=>{if(t.length===0)return;if(b.current===void 0)try{const D=localStorage.getItem(ye);b.current=D?JSON.parse(D):[]}catch{b.current=[]}const v=b.current;if(v.length===0)return;const F=[];for(const D of v){if(A.current.has(D.appId))continue;const V=t.find(ie=>ie.id===D.appId&&ie.tooltip);V&&(A.current.add(D.appId),F.push({app:V,id:`${V.id}-restored-${Date.now()}-${Math.random().toString(36).slice(2)}`,initialX:D.x,initialY:D.y}))}F.length>0&&m(D=>[...D,...F])},[t]),j(()=>()=>{P.current!==void 0&&clearTimeout(P.current)},[]);const G=oe((v,F)=>{P.current!==void 0&&(clearTimeout(P.current),P.current=void 0),v?(w(v),ne(F)):P.current=setTimeout(()=>{w(void 0),ne(void 0),P.current=void 0},180)},[]),B=l(g(t),"appsRef");B.current=t;const E=l(g(M),"panelVisibleRef");E.current=M;const z=l(g(e),"activeAppIdRef");z.current=e;const K=l(g(s),"onToggleAppRef");K.current=s;const ee=l(Q(()=>{const v=globalThis.window?.innerWidth??1920,F=globalThis.window?.innerHeight??1080;return bt(I.position,I.left,I.top,v,F)},[I.left,I.position,I.top]),"placement"),te=oe(async v=>{const F=E.current,D=z.current,V=B.current.find(ie=>ie.id===v);if(V?.onClick??V?.onDeactivate){await K.current(v);return}if(v===D&&F){await K.current(v),R({open:!1,viewMode:"default"});return}v!==D&&await K.current(v),F||R({open:!0})},[R]),re={activeAppId:e,apps:t,clearNotification:r,hoveredApp:C,hoveredAppRect:W,isDragging:L,isVisible:M,pinnedTooltips:J,pinTooltip:a,placement:ee,registerApp:i,setDragging:()=>{},setHoveredApp:G,setNotification:o,setPlacement:()=>{},setVisible:v=>{R({open:v})},toggleApp:te,unpinTooltip:d,unregisterApp:c};if(!(!I.preferShowFloatingPanel&&!M))return n(Me.Provider,{value:re,children:f("div",{class:h(k==="dark"&&"dark"),style:{display:"contents"},children:[f("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":ee,id:"__v_dt__root",onMouseMove:_,ref:u,style:S,children:[f("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",$?"shadow-pill-vertical!":"shadow-pill",y?"max-w-12!":"","transition-pill"),"data-vertical":$||void 0,onPointerDown:v=>{I.isFirstVisit&&R({isFirstVisit:!1}),U(v)},ref:p,style:O,children:[n("button",{"aria-label":"Toggle devtools panel",class:h("size-8 flex justify-center items-center shrink-0","cursor-pointer p-0 m-0 border-0","bg-transparent","transition-all duration-150","hover:bg-primary/8 active:scale-[0.95]","group-data-[vertical]/panel:rotate-[-90deg]",M?"opacity-100":"opacity-60"),onClick:v=>{v.stopPropagation(),I.isFirstVisit&&R({isFirstVisit:!1}),Y()},title:"Toggle devtools panel",type:"button",children:n("img",{alt:"Visulima",class:"size-6",src:Be})}),n("div",{"aria-hidden":"true",class:h("w-px h-5 bg-primary/20 shrink-0",y&&"hidden")}),n("div",{class:h("px-0.5",y&&"hidden"),children:n(vt,{})})]}),I.isFirstVisit&&n(ut,{onDismiss:()=>{R({isFirstVisit:!1})},position:I.position})]}),n(it,{activeAppId:e,apps:t,onClose:H,onToggleApp:s,panelVisible:M,position:I.position}),n(at,{position:I.position}),J.map(v=>n(ht,{onMove:x,onUnpin:d,pinned:v},v.id))]})})},wt=(e,t)=>{const r=De(),i=je();if(!i)throw new Error("Global hook not initialized");return{clearNotification(o){e.clearNotification(o)},async closeApp(){const o=e.getActiveApp();o&&await e.toggleApp(o.id)},getActiveApp(){return e.getActiveApp()?.id},getApps(){return e.getApps()},getSettings(){return Ae()},hide(){t.hide()},hook:i,notify(o,s){e.setNotification(o,!0,s)},async openApp(o){await e.toggleApp(o)},registerApp(o){e.registerApp(o)},rpc:new Proxy({},{get(o,s){return(...c)=>r.callServer(s,...c)}}),setAppActive(o,s){e.setAppActive(o,s)},show(){t.show()},toggle(){t.toggle()},unregisterApp(o){e.unregisterApp(o)},updateSettings(o){_e(o)},version:"0.0.0"}},yt=e=>{globalThis.window!==void 0&&(globalThis.__VISULIMA_DEVTOOLS__=e)};class Dt extends HTMLElement{appManager;hasBeenInitialized=!1;renderRoot=void 0;constructor(){super(),this.attachShadow({mode:"open"}),this.appManager=new We}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=Ne(s=>{this.appManager.registerApp(s),this.render()},(s,c)=>{Le().addEvent(s,c)}),r=wt({clearNotification:s=>{this.appManager.clearNotification(s),this.render()},getActiveApp:()=>this.appManager.getActiveApp(),getApps:()=>this.appManager.getAllApps(),registerApp:s=>{this.appManager.registerApp(s),this.render()},setAppActive:(s,c)=>{this.appManager.setAppActive(s,c),this.render()},setNotification:(s,c,u)=>{this.appManager.setNotification(s,c,u),this.render()},toggleApp:s=>this.appManager.toggleApp(s),unregisterApp:s=>{this.appManager.unregisterApp(s),this.render()}},{hide:()=>{this.setToolbarVisible(!1)},show:()=>{this.setToolbarVisible(!0)},toggle:()=>{const s=this.isHidden();this.setToolbarVisible(!s)}});yt(r),t.emit("devtools:init");const i=Ae(),o=this.appManager.getAllApps().find(s=>s.defaultOpen);o&&!this.appManager.getActiveApp()&&this.appManager.openApp(o.id).catch(s=>{console.error(`[dev-toolbar] Failed to auto-open defaultOpen app ${o.id}:`,s)}),this.render(),this.setupEventListeners(),i.defaultVisible&&this.setToolbarVisible(!0)}isHidden(){return this.shadowRoot.querySelector("#__v_dt__root")?.hasAttribute("data-hidden")??!0}setToolbarVisible(t){const r=this.shadowRoot.querySelector("#__v_dt__root");r&&(t?delete r.dataset.hidden:r.dataset.hidden=""),this.render()}registerApp(t,r=!1){this.appManager.registerApp(t,r),this.render()}getAppManager(){return this.appManager}render(){const t=this.appManager.getAllApps(),r=this.shadowRoot;se&&(r.adoptedStyleSheets=[se]);let i=r.querySelector("style");i||(i=document.createElement("style"),i.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 @@ import{createContext as je,render as me}from"preact";import{createClientRPCConte
|
|
|
18
18
|
display: none;
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
|
-
`,r.append(
|
|
21
|
+
`,r.append(i)),this.renderRoot||(this.renderRoot=document.createElement("div"),r.append(this.renderRoot));const s=this.appManager.getActiveApp()?.id;me(n(xt,{activeAppId:s,apps:t,onClearNotification:c=>{this.appManager.clearNotification(c),this.render()},onRegisterApp:c=>{this.render()},onSetNotification:(c,u,p)=>{this.appManager.setNotification(c,u,p),this.render()},onToggleApp:async c=>{await this.appManager.toggleApp(c),this.render()},onUnregisterApp:c=>{this.appManager.unregisterApp(c),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(i=>{console.error("[dev-toolbar] Error toggling app:",i)}):this.setToolbarVisible(!1)})}}if(globalThis.window!==void 0&&(customElements.get("dev-toolbar")||customElements.define("dev-toolbar",Dt),!customElements.get("dev-toolbar-app-canvas"))){class e extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"})}}customElements.define("dev-toolbar-app-canvas",e)}export{Dt as DevToolbar,se 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-
|
|
1
|
+
import{Alert as o,AlertDescription as r,AlertTitle as a}from"../packem_shared/Alert-zKrO89oT.js";import{default as p}from"../packem_shared/Badge-DdZ-eO1L.js";import{default as s}from"../packem_shared/Button-C47WESqv.js";import{Card as d,CardContent as m,CardDescription as n,CardFooter as i,CardHeader as u,CardTitle as T}from"../packem_shared/Card-CODzgyhz.js";import{default as c}from"../packem_shared/Icon-CpjIHGY8.js";import{default as S}from"../packem_shared/Input-ChP0V9d9.js";import{default as P}from"../packem_shared/Label-Dln89zeh.js";import{Popover as A,PopoverClose as I,PopoverContent as B,PopoverTrigger as D}from"../packem_shared/Popover-BwqId7Zj.js";import{default as h}from"../packem_shared/Progress-B1MCRlIm.js";import{Select as w,SelectContent as F,SelectItem as H,SelectTrigger as V,SelectValue as j,useSelectContext as q}from"../packem_shared/Select-BHuWHvtj.js";import{default as z}from"../packem_shared/Separator-DaOoH4S4.js";import{default as G}from"../packem_shared/Skeleton-whkeV8my.js";import{default as K}from"../packem_shared/Switch-BShIjzxX.js";import{Tabs as N,TabsContent as O,TabsList as Q,TabsTrigger as R}from"../packem_shared/Tabs-k8RYlor_.js";import{default as W}from"../packem_shared/Textarea-XCaIrn4D.js";import{Tooltip as Y,TooltipContent as Z,TooltipTrigger as _}from"../packem_shared/Tooltip-DmnO5Vmb.js";import{clsx as ee}from"../packem_shared/clsx-BGQISBxA.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};
|
package/dist/vite-plugin.d.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { Plugin } from 'vite';
|
|
2
|
-
import { R as ReadFileOptions } from "./packem_shared/server.d-
|
|
2
|
+
import { R as ReadFileOptions } from "./packem_shared/server.d-C41Pohjw.js";
|
|
3
3
|
import { D as DevToolbarApp, S as ServerFunctions } from "./packem_shared/app.d-BV5WIojP.js";
|
|
4
|
-
import "./packem_shared/global-api.d-PUBE6Od9.js";
|
|
5
|
-
import '@babel/generator';
|
|
6
4
|
import 'preact';
|
|
7
5
|
interface InjectSourceIgnore {
|
|
8
6
|
/** Component names or patterns to skip. */
|
package/dist/vite-plugin.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{createRequire as
|
|
2
|
-
data: ${JSON.stringify(
|
|
1
|
+
import{createRequire as E}from"node:module";import{normalizePath as x}from"vite";import{createServerRPCContext as M}from"./packem_shared/createServerRPCContext-D0Yh-CF2.js";let I;const C=e=>(I??=E(import.meta.url))(e),f=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,y=e=>{if(typeof f<"u"&&f.versions&&f.versions.node){const[u,v]=f.versions.node.split(".").map(Number);if(u>22||u===22&&v>=3||u===20&&v>=16)return f.getBuiltinModule(e)}return C(e)},k=y("node:fs"),R=y("node:path"),{fileURLToPath:F}=y("node:url"),D=()=>x(R.dirname(F(import.meta.url))),N=/\?.+$/,U=/\/dist\/|\/build\//,A=/\.[jt]sx$/,B=e=>e.replace(N,""),w="?__visulima-dev-toolbar-resource",b="virtual:visulima-dev-toolbar-options",T=`\0${b}`,p="virtual:visulima-dev-toolbar-path:",P="\0__visulima-dev-toolbar-empty",j=(e,u)=>typeof e!="number"||!Number.isFinite(e)?u:Math.min(95,Math.max(20,e)),z=(e={})=>{if(e.enabled===!1)return[];const u=D(),v=e.removeDevtoolsOnBuild??!0,S=e.injectSource?.enabled??!0;let h;const O={apply:"serve",config(){return{server:{watch:{ignored:["**/.devtoolbar/**"]}}}},configResolved(t){if(h=t,!e.appendTo){const n=new Set(t.plugins.map(a=>a.name));(n.has("tanstack-start-core:config")||n.has("tanstack-react-start:config"))&&(e.appendTo=/router\.tsx$/)}const r=/dev-toolbar[\\/]dist[\\/]|__visulima-dev-toolbar-resource/;for(const n of t.plugins){if(!n.name.includes("babel"))continue;const a=n.transform;if(!a)continue;const o=typeof a=="function"?a:typeof a=="object"&&"handler"in a?a.handler:void 0;if(typeof o!="function")continue;const i=function(l,s,...c){if(!r.test(s))return o.call(this,l,s,...c)};typeof a=="function"?n.transform=i:a.handler=i}},configureServer(t){M(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(r,n)=>{n.writeHead(200,{"Cache-Control":"no-cache",Connection:"keep-alive","Content-Type":"text/event-stream","X-Accel-Buffering":"no"});const a=(s,c)=>{n.write(`event: ${s}
|
|
2
|
+
data: ${JSON.stringify(c)}
|
|
3
3
|
|
|
4
|
-
`)};
|
|
5
|
-
${t}`},transformIndexHtml(){return e.appendTo?void 0:{html:"",tags:[{attrs:{src:`${
|
|
4
|
+
`)};a("connected",{timestamp:Date.now()});const{watch:o}=await import("node:fs"),i=R.join(t.config.root,".devtoolbar","annotations.json");let l;try{l=o(i,{persistent:!1},s=>{s==="change"&&a("annotations.changed",{timestamp:Date.now()})}),l.on("error",()=>{})}catch{const{stat:s}=await import("node:fs/promises");let c=0;const g=setInterval(async()=>{try{const d=(await s(i)).mtimeMs;d!==c&&(c=d,a("annotations.changed",{timestamp:Date.now()}))}catch{}},2e3);r.on("close",()=>{clearInterval(g)});return}r.on("close",()=>{l?.close()})})},enforce:"pre",async load(t){if(t===T){const r=(e.customApps??[]).filter(n=>!n.component&&!n.init&&n.view?.type==="iframe").map(n=>({defaultOpen:n.defaultOpen,icon:n.icon,id:n.id,name:n.name,view:n.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:h.base,closeOnOutsideClick:e.closeOnOutsideClick??!0,customApps:r,defaultVisible:e.defaultVisible??!0,editor:e.editor??"",height:j(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:j(e.width,80)})};`}if(t.endsWith(w)){const r=B(t);return this.addWatchFile(r),await k.promises.readFile(r,"utf8")}},name:"@visulima/dev-toolbar",resolveId(t){if(t===b)return T;if(t.startsWith(p))return`${t.replace(p,`${u}/`)}${w}`},transform(t,r,n){if(n?.ssr)return;const{appendTo:a}=e,o=r.split("?",2)[0];if(a&&o&&(typeof a=="string"&&o.endsWith(a)||a instanceof RegExp&&a.test(o)))return`import '${p}client/overlay.js';
|
|
5
|
+
${t}`},transformIndexHtml(){return e.appendTo?void 0:{html:"",tags:[{attrs:{src:`${h.base||"/"}@id/${p}client/overlay.js`,type:"module"},injectTo:"head-prepend",tag:"script"}]}}},$={apply(t,{command:r,mode:n}){return v&&(r!=="serve"||n==="production")},load(t){if(t===P)return"export default {};"},name:"@visulima/dev-toolbar:remove-on-build",resolveId(t){if(t===b||t.startsWith(p))return P}},_=new Map;return[O,{enforce:"pre",name:"@visulima/dev-toolbar:inject-source",async transform(t,r){if(!S||h.mode!=="development"||r.includes("node_modules")||r.includes("?raw")||U.test(r)||!A.test(r.split("?")[0]??""))return;const n=r.split("?")[0]??r,{readFile:a,stat:o}=await import("node:fs/promises");let i;try{const{mtimeMs:m}=await o(n);i=`${t.length}:${m}`;const d=_.get(r);if(d&&d.key===i)return d.result}catch{}let l;try{const m=await a(n,"utf8");m!==t&&(l=m)}catch{}const{addSourceToJsx:s}=await import("./packem_chunks/inject-source.js"),c=s(t,r,e.injectSource?.ignore,l),g=c?{code:c.code??t,map:c.map??void 0}:void 0;return i!==void 0&&_.set(r,{key:i,result:g}),g}},$]};export{z as devToolbar};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@visulima/dev-toolbar",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.13",
|
|
4
4
|
"description": "Devtools is a set of tools for building advanced devtools for your application",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"dev-toolbar",
|
|
@@ -116,15 +116,15 @@
|
|
|
116
116
|
},
|
|
117
117
|
"dependencies": {
|
|
118
118
|
"@babel/generator": "^8.0.0",
|
|
119
|
-
"@babel/parser": "^8.0.
|
|
120
|
-
"@babel/traverse": "^8.0.
|
|
121
|
-
"@floating-ui/dom": "^1.
|
|
119
|
+
"@babel/parser": "^8.0.4",
|
|
120
|
+
"@babel/traverse": "^8.0.4",
|
|
121
|
+
"@floating-ui/dom": "^1.8.0",
|
|
122
122
|
"launch-editor": "2.14.1",
|
|
123
|
-
"preact": "^10.29.
|
|
123
|
+
"preact": "^10.29.8"
|
|
124
124
|
},
|
|
125
125
|
"peerDependencies": {
|
|
126
126
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
127
|
-
"axe-core": ">=4.
|
|
127
|
+
"axe-core": ">=4.13.0",
|
|
128
128
|
"vite": "^8.0.11",
|
|
129
129
|
"zod": "^3.25.0 || ^4.0.0"
|
|
130
130
|
},
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{clsx as s}from"./clsx-CtZWcPHt.js";import{jsx as l}from"preact/jsx-runtime";const n={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"},d=({children:e,class:r,variant:t="default",...i})=>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",n[t],r),role:"alert",...i,children:e}),o=({children:e,class:r,...t})=>l("h5",{class:s("mb-1 font-medium leading-none tracking-tight",r),...t,children:e}),g=({children:e,class:r,...t})=>l("div",{class:s("text-sm [&_p]:leading-relaxed",r),...t,children:e});export{d as Alert,g as AlertDescription,o as AlertTitle};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{clsx as d}from"./clsx-CtZWcPHt.js";import{jsx as c}from"preact/jsx-runtime";const i=({children:s,class:e,...r})=>c("div",{class:d("bg-card text-card-foreground rounded-none border shadow",e),...r,children:s}),n=({children:s,class:e,...r})=>c("div",{class:d("flex flex-col space-y-1.5 p-6",e),...r,children:s}),t=({children:s,class:e,...r})=>c("h3",{class:d("font-semibold leading-none tracking-tight",e),...r,children:s}),o=({children:s,class:e,...r})=>c("div",{class:d("text-sm text-muted-foreground",e),...r,children:s}),h=({children:s,class:e,...r})=>c("div",{class:d("p-6 pt-0",e),...r,children:s}),p=({children:s,class:e,...r})=>c("div",{class:d("flex items-center p-6 pt-0",e),...r,children:s});export{i as Card,h as CardContent,o as CardDescription,p as CardFooter,n as CardHeader,t as CardTitle};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{clsx as t}from"./clsx-CtZWcPHt.js";import{jsx as r}from"preact/jsx-runtime";const n=({class:s,size:e=13,src:a})=>r("span",{class:t("inline-block shrink-0",s),style:{backgroundColor:"currentColor",height:e,maskImage:`url(${a})`,maskRepeat:"no-repeat",maskSize:"contain",WebkitMaskImage:`url(${a})`,WebkitMaskRepeat:"no-repeat",WebkitMaskSize:"contain",width:e}});export{n as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{clsx as o}from"./clsx-CtZWcPHt.js";import{jsx as r}from"preact/jsx-runtime";const t=({children:e,class:l,...s})=>r("label",{class:o("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",l),...s,children:e});export{t as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{addHookName as m}from"preact/devtools";import{computePosition as O,offset as C,flip as R,shift as E}from"@floating-ui/dom";import{clsx as g}from"./clsx-CtZWcPHt.js";import{createContext as $}from"preact";import{useState as b,useRef as y,useEffect as x,useContext as k}from"preact/hooks";import{jsx as u}from"preact/jsx-runtime";const P=$(void 0),h=()=>{const e=k(P);if(!e)throw new Error("Popover subcomponent must be used within <Popover>");return e},N=({children:e,defaultOpen:r,onOpenChange:o,open:t})=>{const i=t!==void 0,[l,n]=m(b(r??!1),"internalOpen"),p=i?t:l,s=m(y(null),"triggerRef"),c=a=>{i||n(a),o?.(a)};return u(P.Provider,{value:{open:p,setOpen:c,triggerRef:s},children:u("span",{style:{display:"contents"},children:e})})},T=({children:e,class:r,...o})=>{const{open:t,setOpen:i,triggerRef:l}=h(),n=p=>{l.current=p};return u("button",{"aria-expanded":t,class:g("",r),onClick:()=>{o.disabled||i(!t)},ref:n,type:"button",...o,children:e})},q=({align:e="center",children:r,class:o,side:t="bottom",sideOffset:i=4,...l})=>{const{open:n,setOpen:p,triggerRef:s}=h(),c=m(y(null),"contentRef"),[a,w]=m(b({x:0,y:0}),"position");if(x(()=>{if(!n||!s.current||!c.current)return;const f=e==="center"?t:`${t}-${e}`;O(s.current,c.current,{middleware:[C(i),R(),E({padding:4})],placement:f}).then(d=>(w({x:d.x,y:d.y}),d)).catch(()=>{})},[n,t,i,e,s]),x(()=>{if(!n)return;const f=d=>{if(c.current&&!c.current.contains(d.target)){const v=s.current;if(v&&v.contains(d.target))return;p(!1)}};return document.addEventListener("mousedown",f),()=>{document.removeEventListener("mousedown",f)}},[n,p,s]),!!n)return u("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",o),ref:c,role:"dialog",style:{left:`${a.x}px`,position:"fixed",top:`${a.y}px`},...l,children:r})},A=({children:e,class:r,...o})=>{const{setOpen:t}=h();return u("button",{class:g("",r),onClick:()=>{t(!1)},type:"button",...o,children:e})};export{N as Popover,A as PopoverClose,q as PopoverContent,T as PopoverTrigger};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{clsx as s}from"./clsx-CtZWcPHt.js";import{jsx as l}from"preact/jsx-runtime";const t=({class:r,value:a,...e})=>l("div",{"aria-valuemax":100,"aria-valuemin":0,"aria-valuenow":a??0,class:s("relative h-2 w-full overflow-hidden rounded-none bg-primary/20",r),role:"progressbar",...e,children:l("div",{class:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(a??0)}%)`}})});export{t as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{addHookName as s}from"preact/devtools";import{computePosition as U,offset as W,flip as X,shift as _}from"@floating-ui/dom";import{clsx as w}from"./clsx-CtZWcPHt.js";import{createContext as F}from"preact";import{useState as b,useRef as y,useCallback as G,useEffect as S,useMemo as Q,useContext as Y}from"preact/hooks";import{jsx as u,jsxs as O}from"preact/jsx-runtime";const q=F(void 0),I=()=>{const e=Y(q);if(!e)throw new Error("Select subcomponent must be used within <Select>");return e};let P=0;const le=({children:e,onValueChange:d,value:n=""})=>{const[t,o]=s(b(!1),"open"),[c,l]=s(b(""),"search"),[p,r]=s(b(null),"highlightedValue"),x=s(y(null),"triggerRef"),[g]=s(b(()=>(P+=1,`select-${P}`)),"instanceId"),m=G(i=>{d?.(i),o(!1),l("")},[d]);S(()=>{t||(l(""),r(null))},[t]);const R=s(Q(()=>({highlightedValue:p,instanceId:g,onSelect:m,open:t,search:c,setHighlightedValue:r,setOpen:o,setSearch:l,triggerRef:x,value:n}),[p,g,m,t,c,n]),"contextValue");return u(q.Provider,{value:R,children:u("span",{style:{display:"contents"},children:e})})},ie=({children:e,class:d,...n})=>{const{open:t,setOpen:o,triggerRef:c}=I();return O("button",{"aria-expanded":t,"aria-haspopup":"listbox",class:w("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",d),onClick:()=>{o(!t)},ref:l=>{c.current=l},type:"button",...n,children:[e,u("svg",{"aria-hidden":"true",class:w("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:u("path",{d:"m6 9 6 6 6-6"})})]})},se=({class:e,options:d,placeholder:n="Select…"})=>{const{value:t}=I(),o=d.find(c=>c.value===t);return u("span",{class:w("truncate",!o&&"text-muted-foreground",e),children:o?o.label:n})},Z=e=>[...e.querySelectorAll("[role='option']:not([aria-disabled='true'])")],N=e=>e.dataset.value??null,ce=({align:e="start",children:d,class:n,searchable:t=!1,side:o="bottom",sideOffset:c=4})=>{const{highlightedValue:l,instanceId:p,open:r,search:x,setHighlightedValue:g,setOpen:m,setSearch:R,triggerRef:i}=I(),k=s(y(null),"contentRef"),D=s(y(null),"searchInputRef"),$=s(y(null),"listRef"),[j,J]=s(b({x:0,y:0}),"position"),[K,A]=s(b(!1),"ready"),L=s(y(l),"highlightedRef");if(L.current=l,S(()=>{if(!r||!i.current||!k.current){A(!1);return}let f=!1;const a=e==="center"?o:`${o}-${e}`;return U(i.current,k.current,{middleware:[W(c),X(),_({padding:4})],placement:a}).then(h=>(f||(J({x:h.x,y:h.y}),A(!0)),h)).catch(()=>{}),()=>{f=!0}},[r,o,c,e,i]),S(()=>{r&&(t&&D.current?D.current.focus():$.current&&$.current.focus())},[r,t]),S(()=>{if(!r)return;const f=a=>{if(k.current&&!k.current.contains(a.target)){const h=i.current;if(h&&h.contains(a.target))return;m(!1)}};return document.addEventListener("mousedown",f),()=>{document.removeEventListener("mousedown",f)}},[r,m,i]),S(()=>{if(!r)return;const f=a=>{const h=$.current;if(!h)return;const V=Z(h),C=V.length;if(C===0){a.key==="Escape"&&(a.preventDefault(),m(!1),i.current?.focus());return}const z=L.current,v=z===null?-1:V.findIndex(H=>N(H)===z),E=H=>{const M=V[H];if(M){const B=N(M);B!==null&&g(B),M.scrollIntoView?.({block:"nearest"})}};switch(a.key){case"ArrowDown":{a.preventDefault(),E(v<C-1?v+1:0);break}case"ArrowUp":{a.preventDefault(),E(v>0?v-1:C-1);break}case"End":{a.preventDefault(),E(C-1);break}case"Enter":{a.preventDefault(),v>=0&&V[v]?.click();break}case"Escape":case"Tab":{a.preventDefault(),m(!1),i.current?.focus();break}case"Home":{a.preventDefault(),E(0);break}}};return document.addEventListener("keydown",f),()=>{document.removeEventListener("keydown",f)}},[r,g,m,i]),!r)return;const T=l===null?void 0:`${p}-option-${l}`;return O("div",{class:w("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",!K&&"invisible",n),ref:k,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&&u("div",{class:"border-b border-border p-1.5",children:u("input",{"aria-activedescendant":T,"aria-controls":`${p}-listbox`,"aria-label":"Search options",class:w("w-full bg-transparent text-[0.75rem] text-foreground placeholder:text-muted-foreground","px-1.5 py-1 border-0 outline-none"),onInput:f=>{R(f.currentTarget.value),g(null)},placeholder:"Search…",ref:D,role:"combobox",type:"text",value:x})}),u("div",{...!t&&{"aria-activedescendant":T,tabIndex:0},class:"max-h-[min(300px,var(--available-height,300px))] overflow-y-auto scrollbar-thin-border p-1",id:`${p}-listbox`,ref:$,role:"listbox",children:d})]})},ue=({children:e,class:d,value:n})=>{const{highlightedValue:t,instanceId:o,onSelect:c,setHighlightedValue:l,value:p}=I(),r=p===n,x=t===n,g=`${o}-option-${n}`;return O("div",{"aria-selected":r,class:w("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",d),"data-value":n,id:g,onClick:()=>{c(n)},onMouseEnter:()=>{l(n)},role:"option",children:[u("span",{class:"flex-1 truncate",children:e}),r&&u("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:u("path",{d:"M20 6 9 17l-5-5"})})]})};export{le as Select,ce as SelectContent,ue as SelectItem,ie as SelectTrigger,se as SelectValue,I as useSelectContext};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{clsx as i}from"./clsx-CtZWcPHt.js";import{jsx as l}from"preact/jsx-runtime";const c=({class:r,decorative:t=!0,orientation:o="horizontal",...e})=>{const a=t?{role:"none"}:{"aria-orientation":o,role:"separator"};return l("div",{class:i("shrink-0 bg-border",o==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",r),...a,...e})};export{c as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{clsx as r}from"./clsx-CtZWcPHt.js";import{jsx as a}from"preact/jsx-runtime";const t=({class:o,...s})=>a("div",{class:r("animate-pulse rounded-none bg-primary/10",o),...s});export{t as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{addHookName as k}from"preact/devtools";import{clsx as i}from"./clsx-CtZWcPHt.js";import{useState as m}from"preact/hooks";import{jsx as s}from"preact/jsx-runtime";const w=({checked:n,class:a,defaultChecked:c,disabled:o,id:d,onCheckedChange:l,...u})=>{const r=n!==void 0,[b,f]=k(m(c??!1),"internalChecked"),e=r?n:b,h=()=>{if(o)return;const t=!e;r||f(t),l?.(t)};return s("button",{"aria-checked":e,class:i("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",e?"bg-primary":"bg-input",a),"data-state":e?"checked":"unchecked",disabled:o,id:d,onClick:h,role:"switch",type:"button",...u,children:s("span",{class:i("pointer-events-none block h-4 w-4 rounded-none bg-background shadow-lg ring-0 transition-transform",e?"translate-x-4":"translate-x-0"),"data-state":e?"checked":"unchecked"})})};export{w as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{addHookName as m}from"preact/devtools";import{clsx as l}from"./clsx-CtZWcPHt.js";import{createContext as h}from"preact";import{useState as p,useContext as x}from"preact/hooks";import{jsx as r}from"preact/jsx-runtime";const d=h(void 0),b=()=>{const e=x(d);if(!e)throw new Error("Tabs subcomponent must be used within <Tabs>");return e},y=({children:e,class:i,defaultValue:n,onValueChange:t,value:o,...c})=>{const a=o!==void 0,[s,f]=m(p(n??""),"internalValue"),g=a?o:s,v=u=>{a||f(u),t?.(u)};return r(d.Provider,{value:{onValueChange:v,value:g},children:r("div",{class:l("",i),...c,children:e})})},j=({children:e,class:i,...n})=>r("div",{class:l("inline-flex h-9 items-center justify-center rounded-none bg-muted p-1 text-muted-foreground",i),role:"tablist",...n,children:e}),L=({children:e,class:i,disabled:n,value:t,...o})=>{const{onValueChange:c,value:a}=b(),s=a===t;return r("button",{"aria-selected":s,class:l("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",s?"bg-background text-foreground shadow":"hover:bg-background/50",i),"data-state":s?"active":"inactive",disabled:n,onClick:()=>!n&&c(t),role:"tab",type:"button",...o,children:e})},E=({children:e,class:i,value:n,...t})=>{const{value:o}=b();if(o===n)return r("div",{class:l("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",i),role:"tabpanel",...t,children:e})};export{y as Tabs,E as TabsContent,j as TabsList,L as TabsTrigger};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{addHookName as s}from"preact/devtools";import{computePosition as h,offset as y,flip as T,shift as R}from"@floating-ui/dom";import{clsx as v}from"./clsx-CtZWcPHt.js";import{createContext as w}from"preact";import{useState as u,useRef as d,useEffect as b,useContext as C}from"preact/hooks";import{jsx as p}from"preact/jsx-runtime";const m=w(void 0),x=()=>{const e=C(m);if(!e)throw new Error("Tooltip subcomponent must be used within <Tooltip>");return e},$=({children:e,delayDuration:i=0})=>{const[o,t]=s(u(!1),"open"),r=s(d(null),"triggerRef");return p(m.Provider,{value:{open:o,setOpen:t,triggerRef:r},children:p("span",{style:{display:"contents"},children:e})})},j=({children:e,class:i,...o})=>{const{setOpen:t,triggerRef:r}=x();return p("span",{class:i,onMouseEnter:()=>{t(!0)},onMouseLeave:()=>{t(!1)},ref:n=>{r.current=n},...o,children:e})},k=({children:e,class:i,side:o="top",sideOffset:t=4,...r})=>{const{open:n,triggerRef:l}=x(),c=s(d(null),"contentRef"),[a,g]=s(u({x:0,y:0}),"position");if(b(()=>{!n||!l.current||!c.current||h(l.current,c.current,{middleware:[y(t),T(),R({padding:4})],placement:o}).then(f=>(g({x:f.x,y:f.y}),f)).catch(()=>{})},[n,o,t,l]),!!n)return p("div",{class:v("z-50 rounded-none bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95",i),ref:c,role:"tooltip",style:{left:`${a.x}px`,position:"fixed",top:`${a.y}px`},...r,children:e})};export{$ as Tooltip,k as TooltipContent,j as TooltipTrigger};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{createRequire as _}from"node:module";let y;const S=e=>(y??=_(import.meta.url))(e),c=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,m=e=>{if(typeof c<"u"&&c.versions&&c.versions.node){const[t,r]=c.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return c.getBuiltinModule(e)}return S(e)},n=m("node:fs/promises"),o=m("node:path"),T=".devtoolbar",w="annotations.json",f="screenshots",A=1e3,u=500,d=1e5,R=10*1024*1024;function g(e){return typeof e=="string"&&e.length>d?e.slice(0,d):e}const F=(e,t)=>{if(e.thread||(e.thread=[]),e.thread.length>=u)throw new Error(`Thread message limit reached (${u}) for this annotation.`);const r={...t,content:g(t.content),id:crypto.randomUUID(),timestamp:new Date().toISOString()};return e.thread.push(r),r},l=e=>{const t=o.join(e,T);return{annotationsFile:o.join(t,w),base:t,screenshotsDir:o.join(t,f)}},E=(e,t)=>{const r=o.resolve(e),s=o.resolve(t);return r.startsWith(s+o.sep)||r===s},k=e=>e.replaceAll(/[^a-z0-9-]/gi,""),v=async e=>{const{screenshotsDir:t}=l(e);await n.mkdir(t,{recursive:!0})},D="annotations.lock",j=1e4,I=50,b=5e3,N=async e=>new Promise(t=>{setTimeout(t,e)}),O=async e=>{const{base:t}=l(e),r=o.join(t,D);await n.mkdir(t,{recursive:!0});const s=Date.now()+b;let a=!1;for(;;)try{await n.mkdir(r),a=!0;break}catch(i){if(i.code!=="EEXIST")throw i;try{const p=await n.stat(r);if(Date.now()-p.mtimeMs>j){await n.rm(r,{force:!0,recursive:!0});continue}}catch{continue}if(Date.now()>s)break;await N(I)}return async()=>{a&&await n.rm(r,{force:!0,recursive:!0})}};let h=Promise.resolve();const P=async(e,t)=>{const r=h;let s;h=new Promise(i=>{s=i}),await r;let a;try{return t!==void 0&&(a=await O(t)),await e()}finally{a&&await a(),s()}},X=async e=>{const{annotationsFile:t}=l(e);try{const r=await n.readFile(t,"utf8"),s=JSON.parse(r);return Array.isArray(s)?s.slice(0,A).map(a=>Array.isArray(a?.thread)&&a.thread.length>u?{...a,thread:a.thread.slice(0,u)}:a):[]}catch{return[]}},L=async(e,t)=>{await v(e);const{annotationsFile:r,base:s}=l(e),a=o.join(s,`${w}.${crypto.randomUUID()}.tmp`);try{await n.writeFile(a,JSON.stringify(t,void 0,2),"utf8"),await n.rename(a,r)}catch(i){throw await n.rm(a,{force:!0}),i}},q=async(e,t)=>{if(!t.startsWith(`${f}/`))return;const{base:r}=l(e),s=o.join(r,t);if(E(s,r))try{await n.unlink(s)}catch{}};export{R as M,f as S,l as a,L as b,F as c,q as d,g as e,v as f,A as g,E as i,X as r,k as s,P as w};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function o(e){var f,t,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(f=0;f<a;f++)e[f]&&(t=o(e[f]))&&(n&&(n+=" "),n+=t)}else for(t in e)e[t]&&(n&&(n+=" "),n+=t);return n}function r(){for(var e,f,t=0,n="",a=arguments.length;t<a;t++)(e=arguments[t])&&(f=o(e))&&(n&&(n+=" "),n+=f);return n}export{r as clsx,r as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const s=l=>{const a={onConfigChange:()=>{},onHMRUpdate:()=>{},onModuleUpdate:()=>{},...l},t=new Map;return globalThis.window!==void 0&&import.meta.hot&&(import.meta.hot.on("dev-toolbar:rpc:response",o=>{const e=t.get(o.id);e&&(t.delete(o.id),e.resolve(o.result))}),import.meta.hot.on("dev-toolbar:rpc:error",o=>{const e=t.get(o.id);e&&(t.delete(o.id),e.reject(new Error(o.error)))}),import.meta.hot.on("dev-toolbar:client",o=>{const{args:e,method:r}=o,n=a[r];if(n)try{n(...e)}catch(i){console.error(`[dev-toolbar] Error calling client function ${r}:`,i)}})),{async callServer(o,...e){if(globalThis.window===void 0||!import.meta.hot)throw new Error("RPC calls can only be made in browser environment with HMR");const r=`${Date.now()}-${Math.random().toString(36).slice(7)}`;return new Promise((n,i)=>{t.set(r,{reject:i,resolve:n}),setTimeout(()=>{t.has(r)&&(t.delete(r),i(new Error(`RPC call timeout: ${o}`)))},3e4),import.meta.hot.send("dev-toolbar:rpc",{args:e,id:r,method:o})})},registerFunction(o,e){a[o]=e}}};export{s as createClientRPCContext};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const d=(s,i)=>{const n=new Map;return{addTimelineEvent(e,t){i&&i(e,t),this.emit("timeline:event",t)},emit(e,...t){const o=n.get(e);if(o)for(const r of o)try{r(...t)}catch(c){console.error(`[dev-toolbar] Error in hook handler for ${String(e)}:`,c)}},off(e,t){const o=n.get(e);o&&(t?(o.delete(t),o.size===0&&n.delete(e)):n.delete(e))},on(e,t){return n.has(e)||n.set(e,new Set),n.get(e).add(t),()=>{const o=n.get(e);o&&(o.delete(t),o.size===0&&n.delete(e))}},once(e,t){const o=((...r)=>{t(...r),this.off(e,o)});this.on(e,o)},registerApp(e){s&&s(e)}}};export{d as createDevToolbarHook};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{createRequire as _}from"node:module";import{w as b,r as g,e as f,d as P,c as R,b as x,f as z,a as F,s as B,M as S,i as v,S as T,g as j}from"./annotation-store-DkqJ7H3F.js";import{normalizePath as A}from"vite";let k;const O=r=>(k??=_(import.meta.url))(r),p=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,w=r=>{if(typeof p<"u"&&p.versions&&p.versions.node){const[e,t]=p.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return p.getBuiltinModule(r)}return O(r)},m=w("node:fs/promises"),u=w("node:path"),{createRequire:L}=w("node:module"),W=async r=>g(r.config.root),q=async(r,e)=>b(async()=>{const{root:t}=r.config,s=new Date().toISOString(),o=await g(t);if(o.length>=j)throw new Error(`Annotation limit reached (${j}). Resolve or delete existing annotations before creating new ones.`);const n={accessibility:e.accessibility,boundingBox:e.boundingBox,comment:f(e.comment),computedStyles:f(e.computedStyles),createdAt:s,cssClasses:f(e.cssClasses),elementBoundingBoxes:e.elementBoundingBoxes,elementLabel:f(e.elementLabel),elementPath:f(e.elementPath),elementTag:e.elementTag,frameworkContext:e.frameworkContext,fullPath:f(e.fullPath),id:crypto.randomUUID(),intent:e.intent,isFixed:e.isFixed,isMultiSelect:e.isMultiSelect,nearbyElements:f(e.nearbyElements),nearbyText:f(e.nearbyText),screenshot:e.screenshot,selectedText:f(e.selectedText),severity:e.severity,source:e.source,status:"pending",updatedAt:s,url:e.url,x:e.x,y:e.y};return o.push(n),await x(t,o),n},r.config.root),N=async(r,e,t)=>b(async()=>{const{root:s}=r.config,o=await g(s),n=o.findIndex(c=>c.id===e);if(n===-1)return null;const i=o[n],a=new Date().toISOString();return t.comment!==void 0&&(i.comment=f(t.comment)),t.intent!==void 0&&(i.intent=t.intent),t.severity!==void 0&&(i.severity=t.severity),t.status!==void 0&&(i.status=t.status,(t.status==="resolved"||t.status==="dismissed")&&(i.resolvedBy=t.resolvedBy??"human",i.resolvedAt=a,i.screenshot&&(await P(s,i.screenshot),i.screenshot=void 0))),t.threadMessage&&R(i,t.threadMessage),i.updatedAt=a,o[n]=i,await x(s,o),i},r.config.root),U=async(r,e)=>b(async()=>{const{root:t}=r.config,s=await g(t),o=s.findIndex(i=>i.id===e);if(o===-1)return!1;const n=s[o];return n.screenshot&&await P(t,n.screenshot),s.splice(o,1),await x(t,s),!0},r.config.root),G=async(r,e,t)=>{const{root:s}=r.config;await z(s);const{base:o,screenshotsDir:n}=F(s),i=B(e);if(!i)throw new Error("Invalid annotation ID");let a,c;if(t.startsWith("data:image/png;base64,"))a="png",c=Buffer.from(t.slice(22),"base64");else if(t.startsWith("data:image/jpeg;base64,"))a="jpg",c=Buffer.from(t.slice(23),"base64");else if(t.startsWith("data:image/webp;base64,"))a="webp",c=Buffer.from(t.slice(23),"base64");else throw new Error("Unsupported screenshot format. Expected PNG, JPEG, or WebP data URL.");if(c.length>S)throw new Error(`Screenshot exceeds maximum size (${S} bytes).`);const l=`${i}.${a}`,d=u.join(n,l);if(!v(d,o))throw new Error("Invalid screenshot path");return await m.writeFile(d,c),`${T}/${l}`},H=async(r,e)=>{const{root:t}=r.config,s=(await g(t)).find(i=>i.id===e);if(!s?.screenshot||!s.screenshot.startsWith(`${T}/`))return null;const{base:o}=F(t),n=u.join(o,s.screenshot);if(!v(n,o))return null;try{const i=await m.readFile(n),a=u.extname(n).slice(1);return a==="svg"?`data:image/svg+xml,${encodeURIComponent(i.toString("utf8"))}`:`data:${a==="jpg"?"image/jpeg":`image/${a}`};base64,${i.toString("base64")}`}catch{return null}},X=new Set(["apng","avif","bmp","gif","ico","jpeg","jpg","png","svg","tiff","webp"]),J=new Set(["avi","mkv","mov","mp4","ogv","webm"]),V=new Set(["aac","flac","m4a","mp3","ogg","opus","wav"]),Y=new Set(["eot","otf","ttf","woff","woff2"]),K=new Set(["css","csv","html","js","json","md","txt","xml"]),h=5e3,E=r=>{const e=r.toLowerCase();return X.has(e)?"image":J.has(e)?"video":V.has(e)?"audio":Y.has(e)?"font":K.has(e)?"text":"other"},Q=r=>{let e=0;const t=[];return{acquire:()=>new Promise(s=>{e<r?(e+=1,s()):t.push(()=>{e+=1,s()})}),release:()=>{e-=1,t.shift()?.()}}},$=async(r,e,t,s)=>{if(s.length>=h)return;let o;await t.acquire();try{o=await m.readdir(r,{withFileTypes:!0})}catch{return}finally{t.release()}await Promise.all(o.map(async n=>{if(s.length>=h)return;const i=u.join(r,n.name);if(n.isDirectory())await $(i,e,t,s);else if(n.isFile()||n.isSymbolicLink()){await t.acquire();try{const a=await m.lstat(i);if(a.isSymbolicLink()){let c;try{c=await m.realpath(i)}catch{return}if(!c.startsWith(e+u.sep)&&c!==e)return;const l=await m.stat(i),d=u.relative(e,i),I=`/${A(d)}`,M=u.extname(n.name).slice(1);s.length<h&&s.push({mtime:l.mtimeMs,publicPath:I,size:l.size,type:E(M)})}else if(a.isFile()){const c=u.relative(e,i),l=`/${A(c)}`,d=u.extname(n.name).slice(1);s.length<h&&s.push({mtime:a.mtimeMs,publicPath:l,size:a.size,type:E(d)})}}catch{}finally{t.release()}}}))},Z=async r=>{const{publicDir:e}=r.config;if(!e)return[];let t;try{t=await m.realpath(e)}catch{return[]}const s=[],o=Q(20);return await $(t,t,o,s),s.sort((n,i)=>n.publicPath.localeCompare(i.publicPath)),s},ee=async r=>{const{moduleGraph:e}=r,t=[];for(const s of e.idToModuleMap.values()){if(t.length>=5e3)break;const o=s.id??s.url,n=s.url??s.id;if(!o||!n||o.startsWith("/@"))continue;const i=[];s.importers.forEach(a=>{const c=a.url??a.id;c&&i.push(c)}),t.push({id:o,importerCount:s.importers.size,importerUrls:i,url:n})}return t},te=async(r,e,t,s,o)=>{const n=u.resolve(r.config.root,e);if(!v(n,r.config.root))throw new Error(`Refusing to open file outside project root: ${e}`);const i=s===void 0?"":`:${s}`,a=t===void 0?"":`:${t}${i}`,c=`${n}${a}`,{default:l}=await import("launch-editor");l(c,o)},se=/\/\*[\s\S]*?\*\//g,re=/\s+/g,D=/@theme\s+default[^{]*\{[\s\S]*?\}/g,y=/(--[\w-]+)\s*:\s*([\s\S]*?);/g,C=r=>{const e={},t=r.replaceAll(se,"");let s=0;for(;s<t.length;){const o=t.indexOf("@theme",s);if(o===-1)break;const n=t.indexOf("{",o);if(n===-1)break;let i=1,a=n+1;for(;a<t.length&&i>0;)t[a]==="{"?i+=1:t[a]==="}"&&(i-=1),a+=1;const c=t.slice(n+1,a-1);y.lastIndex=0;let l=y.exec(c);for(;l!==null;){const d=l[2].replaceAll(re," ").trim();d&&!e[l[1]]&&(e[l[1]]=d),l=y.exec(c)}s=a}return e},ne=async r=>{const e=[],t=async(s,o)=>{if(o>4)return;let n;try{n=await m.readdir(s,{encoding:"utf8",withFileTypes:!0})}catch{return}for(const i of n){const a=u.join(s,i.name);if(i.isDirectory()){if(i.name==="node_modules"||i.name===".git"||i.name==="dist")continue;await t(a,o+1)}else if(i.name.endsWith(".css"))try{const c=await m.readFile(a,"utf8");c.includes("@import")&&(c.includes('"tailwindcss"')||c.includes("'tailwindcss'"))&&e.push(a)}catch{}}};return await t(r,0),e},oe=async r=>{const e={};for(const t of r)try{const s=await m.readFile(t,"utf8");D.lastIndex=0;const o=s.replaceAll(D,""),n=C(o);Object.assign(e,n)}catch{}return e},ie=async r=>{const{root:e}=r.config;let t="unknown",s={};const o=["tailwind.config.js","tailwind.config.ts","tailwind.config.mjs","tailwind.config.cjs"];for(const a of o)try{await m.access(u.join(e,a)),t="v3";break}catch{}try{const a=L(import.meta.url).resolve("tailwindcss/theme.css"),c=await m.readFile(a,"utf8");s=C(c),Object.keys(s).length>0&&t!=="v3"&&(t="v4")}catch{}const n=await ne(e),i=await oe(n);return{cssFiles:n.map(a=>u.relative(e,a)),customTheme:i,defaultTheme:s,version:t}},ae=r=>{if(Array.isArray(r))return r.filter(e=>e!=null&&(e.find!==void 0||e.replacement!==void 0)).map(e=>({find:e.find instanceof RegExp?e.find.toString():String(e.find??""),replacement:String(e.replacement??"")}));if(r!=null&&typeof r=="object")return Object.fromEntries(Object.entries(r).map(([e,t])=>[e,String(t)]))},ce=r=>{if(typeof r=="boolean"||Array.isArray(r))return r},le=async r=>{const{config:e}=r,t=[];for(const l of e.plugins.filter(d=>!!d?.name))t.push({enforce:l?.enforce,name:l.name});const s=ae(e.resolve?.alias),o=e.server?.proxy?Object.keys(e.server.proxy):void 0,n=e.server?.hmr,i=n!==!1,a=typeof n=="object"&&n!==null?n.port:void 0,c=ce(e.ssr?.noExternal);return{base:e.base,build:{assetsDir:e.build?.assetsDir,assetsInlineLimit:typeof e.build?.assetsInlineLimit=="number"?e.build.assetsInlineLimit:void 0,chunkSizeWarningLimit:e.build?.chunkSizeWarningLimit,cssCodeSplit:e.build?.cssCodeSplit,emptyOutDir:e.build?.emptyOutDir,minify:e.build?.minify,outDir:e.build?.outDir,reportCompressedSize:e.build?.reportCompressedSize,sourcemap:e.build?.sourcemap,target:e.build?.target},cacheDir:e.cacheDir,css:{devSourcemap:e.css?.devSourcemap,preprocessors:e.css?.preprocessorOptions?Object.keys(e.css.preprocessorOptions):[]},define:e.define,env:e.env,envDir:typeof e.envDir=="string"?e.envDir:void 0,envPrefix:e.envPrefix,esbuild:e.esbuild?{jsx:e.esbuild.jsx,jsxFactory:e.esbuild.jsxFactory,jsxFragment:e.esbuild.jsxFragment,jsxImportSource:e.esbuild.jsxImportSource,target:e.esbuild.target}:void 0,mode:e.mode,optimizeDeps:{exclude:e.optimizeDeps?.exclude,include:e.optimizeDeps?.include},plugins:t,publicDir:e.publicDir,resolve:{alias:s,conditions:e.resolve?.conditions,dedupe:e.resolve?.dedupe,extensions:e.resolve?.extensions,mainFields:e.resolve?.mainFields,preserveSymlinks:e.resolve?.preserveSymlinks},root:e.root,server:{cors:e.server?.cors===void 0?void 0:!!e.server.cors,hmrEnabled:i,hmrPort:a,host:e.server?.host,https:e.server?.https!==void 0,middlewareMode:(()=>{if(e.server?.middlewareMode!==void 0)return typeof e.server.middlewareMode=="object"?!0:!!e.server.middlewareMode})(),open:e.server?.open,origin:e.server?.origin,port:e.server?.port,proxy:o,strictPort:e.server?.strictPort},ssr:e.ssr===void 0?void 0:{external:Array.isArray(e.ssr?.external)?e.ssr.external:void 0,noExternal:c,target:e.ssr?.target}}},de=["astro","cjs","css","cts","html","js","json","jsx","less","md","mdx","mjs","mts","sass","scss","svelte","ts","tsx","txt","vue"],ue=(r,e={})=>{const t={createAnnotation:async s=>q(r,s),deleteAnnotation:async s=>U(r,s),getAnnotations:async()=>W(r),getModuleGraph:async()=>ee(r),getScreenshot:async s=>H(r,s),getStaticAssets:async()=>Z(r),getTailwindConfig:async()=>ie(r),getViteConfig:async()=>le(r),openInEditor:async(s,o,n)=>te(r,s,o,n,e.editor),saveScreenshot:async(s,o)=>G(r,s,o),updateAnnotation:async(s,o)=>N(r,s,o)};if(e.readFile!==!1){const s=new Set((e.readFile?.extensions??de).map(o=>o.toLowerCase().replace(/^\./,"")));t.readFile=async o=>{const{readFile:n}=await import("node:fs/promises"),{extname:i,resolve:a}=await import("node:path"),{root:c}=r.config,l=a(c,o);if(!v(l,c))throw new Error(`Refusing to read file outside project root: ${o}`);const d=i(l).slice(1).toLowerCase();if(!s.has(d))throw new Error(`Refusing to read file with disallowed extension ".${d}": ${o}`);return n(l,"utf8")}}return t},ge=(r,e,t={})=>{const s={...ue(r,t),...e};return r.ws.on("dev-toolbar:rpc",async(o,n)=>{const{args:i,id:a,method:c}=o,l=s[c];if(!l){n.send("dev-toolbar:rpc:error",{error:`Unknown RPC method: ${c}`,id:a});return}try{const d=await l(...i);n.send("dev-toolbar:rpc:response",{id:a,result:d})}catch(d){n.send("dev-toolbar:rpc:error",{error:d instanceof Error?d.message:String(d),id:a})}}),{callClient(o,...n){r.ws.send({data:{args:n,method:o},event:"dev-toolbar:client",type:"custom"})},registerFunction(o,n){s[o]=n},server:r}};export{ge as createServerRPCContext};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as i,u as o}from"./store-Dqy0FbGw.js";export{i as TimelineStore,o as getTimelineStore};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e={defaultVisible:!0,placement:"bottom-center",showNotifications:!0},n="__v_dt__settings",s=()=>{if(globalThis.window===void 0)return{...e};try{const t=localStorage.getItem(n);if(t){const o=JSON.parse(t);return{...e,...o}}}catch(t){console.warn("[dev-toolbar] Failed to load settings:",t)}return{...e}},i=t=>{if(globalThis.window!==void 0)try{localStorage.setItem(n,JSON.stringify(t))}catch(o){console.warn("[dev-toolbar] Failed to save settings:",o)}},a=t=>{const o={...s(),...t};return i(o),o};export{s as loadSettings,i as saveSettings,a as updateSettings};
|