@vite-hub/comments 0.6.1 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/README.md +6 -4
  2. package/dist/{client-diagnostics-D987sEK7.js → client-diagnostics-DoXqdnBd.js} +8 -0
  3. package/dist/client.d.ts +48 -3
  4. package/dist/client.js +231 -150
  5. package/dist/{database-Cguz3hZL.js → database-BuSNVwTx.js} +1 -1
  6. package/dist/database.js +1 -1
  7. package/dist/{define-C2tnAtBU.js → define-BqPcuDhf.js} +1 -1
  8. package/dist/{errors-ByCRdInk.js → errors-CBvIpwbo.js} +1 -1
  9. package/dist/hosted/hosted-comments/frame.js +1 -1
  10. package/dist/hosted/hosted-comments/tools.js +371 -0
  11. package/dist/hosted/hosted-comments.js +1 -19
  12. package/dist/index.js +4 -4
  13. package/dist/{install-D6hXZaSN.js → install-CqBWFmU7.js} +21 -15
  14. package/dist/{installed-bPUnazFf.js → installed-wUYjqk_k.js} +1 -1
  15. package/dist/{operations-8hqTi0DH.d.ts → operations-DFLer1fR.d.ts} +1 -0
  16. package/dist/{operations-BkkrI8a3.d.ts → operations-Qt8ASQqW.d.ts} +1 -1
  17. package/dist/{operations-B1ALn4VS.js → operations-kMPw-Cyb.js} +6 -7
  18. package/dist/operations.d.ts +1 -1
  19. package/dist/operations.js +2 -2
  20. package/dist/overlay/client-CrnKCZXc.js +4 -0
  21. package/dist/overlay/overlay.js +62 -35
  22. package/dist/page/loader.js +25 -23
  23. package/dist/{page-tools-shared-fvmJQCrP.js → page-tools-shared-BNw-aWEH.js} +2 -5
  24. package/dist/{plugin-l4sPt5-n.js → plugin-ChOHe7vq.js} +7 -7
  25. package/dist/realtime.d.ts +4 -1
  26. package/dist/realtime.js +1 -1
  27. package/dist/{request-origin-YPzfE2eh.js → request-origin-B-CPVAVk.js} +6 -1
  28. package/dist/{rpc-BYmbVkr8.js → rpc-kkxzQ3Qy.js} +1 -1
  29. package/dist/rpc.js +1 -1
  30. package/dist/runtime/auth.js +1 -1
  31. package/dist/runtime/console.js +1 -1
  32. package/dist/runtime/index.d.ts +1 -0
  33. package/dist/runtime/index.js +13 -13
  34. package/dist/{server-DvSehkPP.js → server-8o9u8leM.js} +1 -1
  35. package/dist/server.d.ts +1 -1
  36. package/dist/server.js +6 -6
  37. package/dist/{service-BIGe1Hpo.js → service-XT2A8YEF.js} +2 -2
  38. package/dist/{session-CCRLR9bf.js → session-DGdFKWDB.js} +7 -6
  39. package/dist/testing.js +1 -1
  40. package/dist/vite.d.ts +1 -1
  41. package/dist/vite.js +8 -4
  42. package/package.json +9 -8
  43. package/dist/hosted/hosted-comments/client-Czl2zu9P.js +0 -4
  44. package/dist/hosted/hosted-comments/dist-DyVmH21U.js +0 -14
  45. package/dist/hosted/hosted-comments/overlay-DpS0P-nd.js +0 -186
  46. package/dist/hosted/hosted-comments/protocol-DuB0Zhs-.js +0 -1
  47. package/dist/hosted/hosted-comments/rest-transport-CKZG_jZ4.js +0 -1
  48. package/dist/hosted/hosted-comments/tools-D8xg-kDW.js +0 -126
  49. package/dist/overlay/client-C7ftI-CB.js +0 -4
@@ -1,35 +1,37 @@
1
- const e=/* @__PURE__ */ new Set;let t,n=!1;function r(){return t?.matches??!1}function i(){let t=r();if(t!==n){n=t;for(let n of e)n(t)}}function a(){t||typeof matchMedia!=`function`||(t=matchMedia(`(prefers-reduced-motion: reduce)`),t.addEventListener?.(`change`,i),n=r())}function o(){return a(),r()}function s(t){return a(),e.add(t),()=>e.delete(t)}const c={snappy:{stiffness:520,damping:34},soft:{stiffness:380,damping:20}},l=/* @__PURE__ */ new Map,u=/* @__PURE__ */ new Set;let d=0,f=!1,p=0,m=0;function h(){return 1}function g(e){let t=Math.min(.032,m?(e-m)/1e3:.016)/1;m=e;let n=Array.from(l),r=Array.from(u);for(let[e,r]of n)if(l.get(e)===r){if(e.tween){let n=e.tween;n.elapsed+=t;let r=Math.min(1,n.elapsed/n.duration),i=1-(1-r)**3,a=n.from+(e.target-n.from)*i;e.velocity=(a-e.value)/(t||1),e.value=a,r>=1&&_(e)}else{let{stiffness:n,damping:r}=e.preset,i=t/6;for(let t=0;t<6;t++){let t=-n*(e.value-e.target)-r*e.velocity;e.velocity+=t*i,e.value+=e.velocity*i}Math.abs(e.velocity)<.002&&Math.abs(e.value-e.target)<5e-4&&_(e)}e.frame(e.value,e.velocity)}for(let e of r)u.has(e)&&e(t)===!1&&u.delete(e);l.size||u.size?p=requestAnimationFrame(g):(p=0,m=0)}function _(e){e.value=e.target,e.velocity=0,e.tween=void 0,l.delete(e)}function v(e){l.set(e,++d),p||=requestAnimationFrame(g)}function y(e){let t=t=>e(t);return u.add(t),p||=requestAnimationFrame(g),()=>{u.delete(t)}}function b(e){if(!e)return;let t=Array.from(l);for(let[e,n]of t)l.get(e)!==n||e.tween||(_(e),e.frame(e.value,0))}function x(e,t,n=c.snappy){let r={value:e,velocity:0,target:e,preset:n,tween:void 0,frame:t},i={get value(){return r.value},get velocity(){return r.velocity},get target(){return r.target},get active(){return l.has(r)},to(e,t={}){if(t.preset&&(r.preset=t.preset),t.tween===void 0&&o())return i.set(e);t.tween===void 0&&!f&&(f=!0,s(b)),r.target=e,t.velocity!==void 0&&(r.velocity+=t.velocity),r.tween=t.tween===void 0?void 0:{from:r.value,elapsed:0,duration:t.tween},v(r)},set(e){r.value=r.target=e,r.velocity=0,r.tween=void 0,l.delete(r),t(e,0)},stop(){r.velocity=0,r.tween=void 0,l.delete(r)}};return i}function S(e){let t=e;for(;t;){if(t.closest(`[data-motion="none"]`))return!0;let e=t.getRootNode();t=e instanceof ShadowRoot?e.host:null}return!1}const C=[`aria-checked`,`aria-selected`,`aria-pressed`,`aria-expanded`,`aria-valuenow`,`aria-valuetext`,`data-state`,`data-checked`,`data-open`,`open`,`data-leaving`],w=/* @__PURE__ */ new Map,T=/* @__PURE__ */ new Set,E=Symbol.for(`vite-hub.motion.layer`);let D;function ee(){let e=Reflect.get(globalThis,E);if(e&&e!==D&&typeof e==`object`&&`define`in e&&`install`in e)return e}function te(e){D=e,Reflect.get(globalThis,E)||Reflect.set(globalThis,E,e)}function ne(e){let t=[...w.values()];w.clear();for(let n of t)n.removeFromShared=e.define(n.effect,n.isReduced)}function re(e,t=o){let n={effect:e,isReduced:t};w.set(e.name,n);for(let e of T)e();return()=>{if(n.removeFromShared)return n.removeFromShared();if(w.get(e.name)===n){w.delete(e.name);for(let e of T)e()}}}function O(){return[...w.values()].map(e=>e.effect)}function ie(){return[...w.values()]}function ae(e){return T.add(e),()=>T.delete(e)}function k(e,t){for(let[n,r]of Object.entries(t))r?e.style.setProperty(n,r):e.style.removeProperty(n)}const A=/* @__PURE__ */ new Map;let j;const M=/* @__PURE__ */ new Map;let N,P=[];const oe=Symbol.for(`vite-hub.motion.effect-presses`),se=e=>{let t=Reflect.get(e,oe);if(t)return t;let n=/* @__PURE__ */ new Map;return Reflect.set(e,oe,n),n},ce=/* @__PURE__ */ new Set;function le(e,t){if(ce.has(t))return!1;try{return e.matches(t)}catch{return ce.add(t),!1}}function ue(e){let t=e;for(;;){for(let e of A.keys())if(e instanceof Element&&e.contains(t))return!0;let e=t.getRootNode();if((e instanceof Document||e instanceof ShadowRoot)&&A.has(e))return!0;if(!(e instanceof ShadowRoot))return!1;t=e.host}}function de(e,t){let n=-1;e.forEach((e,t)=>{e instanceof Element&&e.matches(`[data-motion="none"]`)&&(n=t)});let r=e.findIndex(e=>e instanceof HTMLElement&&le(e,t));return r===-1||r<=n||!ue(e[r])?void 0:e[r]}function fe(e,t,n){F(e,!0);let r=se(t),i=[];for(let{effect:a,isReduced:o}of ie()){if(!a.press||o())continue;let s=de(n,a.selector);if(!s||e===`key`&&s!==n[0])continue;let c=r.get(s);if(c?.has(a.name))continue;let l=a.press(s,t);if(!l)continue;c?c.add(a.name):r.set(s,/* @__PURE__ */ new Set([a.name]));let u={element:s,press:l};e!==`key`&&!l.move&&(u.leave=()=>pe(e,u,!0),s.addEventListener(`pointerleave`,u.leave,{once:!0})),i.push(u)}i.length&&(M.set(e,i),i.some(e=>e.press.move)&&document.addEventListener(`pointermove`,_e,{capture:!0,passive:!0}))}function F(e,t=!1){let n=M.get(e);if(n){M.delete(e);for(let{element:e,press:r,leave:i}of n)i&&e.removeEventListener(`pointerleave`,i),t&&r.cancel?r.cancel():r.release();me()}}function pe(e,t,n=!1){let r=M.get(e),i=r?.indexOf(t)??-1;r&&i!==-1&&(t.leave&&t.element.removeEventListener(`pointerleave`,t.leave),r.splice(i,1),r.length||M.delete(e),n&&t.press.cancel?t.press.cancel():t.press.release(),me())}function me(){[...M.values()].some(e=>e.some(e=>e.press.move))||document.removeEventListener(`pointermove`,_e,{capture:!0})}function he(e){if(e.button!==0)return;let t=e.composedPath();e.isPrimary&&(N={event:e,path:t}),fe(e.pointerId,e,t)}function ge(e){N?.event.pointerId===e.pointerId&&(N=void 0),F(e.pointerId,e.type===`pointercancel`)}function _e(e){for(let{press:t}of M.get(e.pointerId)??[])t.move?.(e)}function ve(e){if(e.repeat||e.key!==` `&&e.key!==`Enter`)return;let t=e.composedPath();e.key===` `&&t[0]instanceof Element&&t[0].matches(`a[href], [role=link]`)||fe(`key`,e,t)}function ye(e){(e.key===` `||e.key===`Enter`)&&F(`key`)}function be(e,t){let n=t.filter(e=>e.content);if(!n.length)return;let r=/* @__PURE__ */ new Map;for(let t of e){if(t.type===`attributes`)continue;let e=t.type===`characterData`?t.target.parentElement:t.target;if(!(e instanceof HTMLElement||e instanceof SVGElement))continue;let n=r.get(e);n||(n={added:[],removed:[],oldText:void 0,texts:/* @__PURE__ */ new Map},r.set(e,n)),t.type===`characterData`?n.texts.has(t.target)||n.texts.set(t.target,t.oldValue):(n.added.push(...t.addedNodes),n.removed.push(...t.removedNodes))}for(let[e,t]of r){if(!e.isConnected)continue;let r=t.added.filter(e=>!t.removed.includes(e)),i=t.removed.filter(e=>!t.added.includes(e)),a=t.texts,o,s=[...e.childNodes];i.length&&s.every(e=>r.includes(e))?o=i.map(e=>e.textContent??``).join(``):a.size===1&&s.length===1&&a.has(s[0])&&(o=a.get(s[0])??``);for(let t of n)le(e,t.selector)&&!S(e)&&t.content(e,{added:r,removed:i,oldText:o})}}function xe(e){if(!N||!e.matches(`[role=separator][data-panel-resize-handle-id]`))return;let t=ie().find(({effect:e})=>e.name===`divider`);if(!t||t.isReduced())return;let{event:n,path:r}=N,i=M.get(n.pointerId)??[],a=i.find(t=>t.splitter&&t.element===e);if(e.getAttribute(`data-resize-handle-active`)!==`pointer`){a&&pe(n.pointerId,a);return}if(a||!r.includes(e.getRootNode())||!ue(e)||S(e))return;let o=t.effect.press?.(e,n);o&&(i.push({element:e,press:o,splitter:!0}),M.set(n.pointerId,i),document.addEventListener(`pointermove`,_e,{capture:!0,passive:!0}))}function Se(e){let t=[...new Set(e)],n=O(),r=/* @__PURE__ */ new Map;be(t,n);for(let e of t)if(e.type!==`characterData`){if(e.type===`attributes`){let t=e.target;if(!(t instanceof HTMLElement))continue;if(e.attributeName===`data-resize-handle-active`){xe(t);continue}let i=e.attributeName,a=t.getAttribute(i);if(a===e.oldValue)continue;let o=r.get(t);o||r.set(t,o=/* @__PURE__ */ new Map);let s=o.get(i);if(s||o.set(i,s=/* @__PURE__ */ new Set),s.has(e.oldValue))continue;s.add(e.oldValue);for(let r of n)r.state&&le(t,r.selector)&&!S(t)&&r.state(t,{attribute:i,oldValue:e.oldValue,value:a})}else for(let t of e.addedNodes)if(t instanceof HTMLElement&&t.isConnected)for(let e of n){if(!e.enter)continue;let n=le(t,e.selector);if(ce.has(e.selector))continue;let r=[...n?[t]:[],...t.querySelectorAll(e.selector)];for(let t of r)S(t)||e.enter(t)}}}function Ce(e,t){let n=O().some(e=>e.content);t.observe(e,{attributes:!0,attributeFilter:[...C,...O().some(e=>e.name===`divider`)?[`data-resize-handle-active`]:[]],attributeOldValue:!0,childList:n||O().some(e=>e.enter),characterData:n,characterDataOldValue:n,subtree:!0})}function we(e,t){let n=O();for(let[e,r]of t)n.includes(e)||(r(),t.delete(e));for(let r of n)r.watch&&!t.has(r)&&t.set(r,r.watch(e))}function Te(){let e={capture:!0,passive:!0};document.addEventListener(`pointerdown`,he,e),document.addEventListener(`pointerup`,ge,e),document.addEventListener(`pointercancel`,ge,e),document.addEventListener(`keydown`,ve,e),document.addEventListener(`keyup`,ye,e),P=[()=>{document.removeEventListener(`pointerdown`,he,e),document.removeEventListener(`pointerup`,ge,e),document.removeEventListener(`pointercancel`,ge,e),document.removeEventListener(`keydown`,ve,e),document.removeEventListener(`keyup`,ye,e),N=void 0;for(let e of M.keys())F(e,!0)},s(e=>{if(e){N=void 0;for(let e of M.keys())F(e,!0)}})]}function I(e,t){if(typeof document>`u`)return()=>{};let n=ee();return n?(ne(n),n.install(e,t.effects,o)):(te(Ee),De(e,t.effects))}const Ee={define:re,install:De};function De(e,t,n=o){let r=new Set(O().map(e=>e.name));for(let e of t)r.has(e.name)||re(e,n);if(!j){Te();let e=new MutationObserver((e,t)=>Se(e.concat(t.takeRecords())));j=e,P.push(ae(()=>{for(let[t,{watchers:n}]of A)Ce(t,e),we(t,n)}))}let i=A.get(e);if(i)i.installs++;else{let t=/* @__PURE__ */ new Map;Ce(e,j),A.set(e,{installs:1,watchers:t}),we(e,t)}let a=!1;return()=>{if(a)return;a=!0;let t=A.get(e);if(!t||--t.installs>0)return;A.delete(e);let n=j,r=n.takeRecords();n.disconnect();for(let e of t.watchers.values())e();if(A.size){for(let e of A.keys())Ce(e,n);r.length&&queueMicrotask(()=>{if(j!==n)return;let e=[...A.keys()];Se(r.filter(t=>e.some(e=>e.contains(t.target))))})}else{j=void 0;for(let e of P)e();P=[]}}}function Oe(e,t,n){let r=e.cloneNode(!0);for(let e of[r,...r.querySelectorAll(`*`)])for(let t of[`id`,`role`,`tabindex`,`hidden`,`inert`,`popover`,`data-ending-style`,`data-starting-style`,`aria-live`])e.removeAttribute(t);return r.setAttribute(`aria-hidden`,`true`),r.setAttribute(`data-motion`,`none`),r instanceof HTMLElement&&(r.inert=!0),r.style.pointerEvents=`none`,t.insertBefore(r,n?.parentNode===t?n:null),r}function ke(e,t){Object.assign(e.style,{position:`fixed`,inset:`auto`,left:`${t.left}px`,top:`${t.top}px`,width:`${t.width}px`,height:`${t.height}px`,margin:`0`,boxSizing:`border-box`,transform:`none`,translate:`none`,zIndex:`2147483647`});let n=e.getBoundingClientRect();Math.abs(n.left-t.left)>.5&&(e.style.left=`${2*t.left-n.left}px`),Math.abs(n.top-t.top)>.5&&(e.style.top=`${2*t.top-n.top}px`)}function Ae(e,t){return window.setTimeout(t,e*h())}function je(e,t,n,r){let i=(e,t,n)=>3*t*e*(1-e)**2+3*n*e**2*(1-e)+e**3;return a=>{if(a<=0||a>=1)return a<=0?0:1;let o=0,s=1,c=a;for(let t=0;t<24;t++)i(c,e,n)<a?o=c:s=c,c=(o+s)/2;return i(c,t,r)}}const Me=e=>e;function Ne(e,t,n,r,i){let a=(n.delay??0)/1e3,s=n.duration/1e3,c=n.ease??Me,l=o(),u=0;return{stop:y(n=>{u+=n;let d=!l&&o()||u>=a+s?1:s>0?Math.max(0,(u-a)/s):0;return r(e+(t-e)*c(d)),d<1||(i?.(),!1)})}}function Pe(e,t,n=Me,r=0){let i=()=>{},a=new Promise(e=>i=e),o=Ne(0,1,{duration:e*1e3,delay:r*1e3,ease:n},t,()=>i(!0));return{done:a,stop:()=>{o.stop(),i(!1)}}}const Fe={stiffness:900,damping:40},Ie={stiffness:380,damping:14},Le=`:is(button, a[href], summary, input:is([type=button], [type=submit], [type=reset], [type=checkbox], [type=radio]), ${[`button`,`link`,`tab`,`radio`,`menuitem`,`menuitemradio`,`menuitemcheckbox`,`option`,`checkbox`].map(e=>`[role=${e}]`).join(`, `)}):not(:disabled, [aria-disabled="true"], [role=switch])`,Re=/* @__PURE__ */ new WeakMap,ze=e=>e>=40?.03:e>=32?.04:.05;function Be(e){let t=e.dataset.motionPressTarget?e.closest(e.dataset.motionPressTarget):null;if(t instanceof HTMLElement)return{target:t,amount:ze(t.offsetHeight)};let n=e.firstElementChild;return e.childElementCount===1&&!e.textContent?.trim()&&(n instanceof HTMLElement||n instanceof SVGElement)&&n.matches(`svg, img, .iconify, [data-slot=icon], [data-slot$=Icon], [data-slot=swap-icon]`)?{target:n,amount:.15}:{target:e,amount:ze(e.offsetHeight)}}function Ve(e){let t=e.transitionDuration.split(`,`);return e.transitionProperty.split(`,`).some((e,n)=>/^\s*(?:scale|all)\s*$/.test(e)&&Number.parseFloat(t[n%t.length])>0)}function He(e,t,n){let{left:r,right:i,top:a,bottom:o,width:s,height:c}=e;return Math.min(t.clientX-r,i-t.clientX)<=s*n||Math.min(t.clientY-a,o-t.clientY)<=c*n}const Ue={name:`press`,selector:Le,press(e,t){let{target:n,amount:r}=Be(e),i=getComputedStyle(n);if(Ve(i)||i.display===`contents`||i.display===`inline`&&n===e&&!(e instanceof HTMLInputElement))return;let a;if(n===e&&`pointerId`in t&&(a=e.getBoundingClientRect(),He(a,t,r)))return;let o=Re.get(n);if(!o){let e={amount:r,spring:x(0,t=>{k(n,{scale:t?String(1-e.amount*t):null})},Fe)};o=e,Re.set(n,o)}o.amount=r;let{spring:s}=o;s.to(1,{preset:Fe});let c=!1,l=()=>{c||(c=!0,s.set(0))};return{move:a?e=>{He(a,e,r)&&l()}:void 0,release:()=>{c||s.to(0,{preset:Ie})},cancel:l}}},L={stiffness:480,damping:36},We={stiffness:380,damping:26},R={stiffness:440,damping:32},Ge=.24,Ke=.14,qe=.15,z=/* @__PURE__ */ new WeakMap,B=/* @__PURE__ */ new Set,Je=/* @__PURE__ */ new Set;let V;function H(e){let t=getComputedStyle(e);return t.clipPath===`inset(50%)`||t.clip===`rect(0px, 0px, 0px, 0px)`}function Ye(e){return e.matches(`[role=tooltip]`)?e:e.querySelector(`:scope > [role=tooltip]`)}const Xe=`[data-motion-appear]`;function Ze(e){if(e.matches(Xe))return e;if(e.matches(`[role=tooltip]`))return H(e)?e.parentElement:e;let t=e.querySelector(`:scope > [role=tooltip]`);return t&&H(t)?e:null}function Qe(e){let t=e.getAttribute(`data-state`);return t===null?!e.hidden&&!e.hasAttribute(`data-closed`):t!==`closed`}function $e(e){let t=e.getAttribute(`data-motion-appear`);if(t!==null){let n=e.parentElement;return!t||!n?null:n.closest(t)??[...n.children].find(n=>n!==e&&n.matches(t))??null}let n=Ye(e)?.id;return n?e.getRootNode().querySelector(`[aria-describedby~="${CSS.escape(n)}"]`)??document.querySelector(`[aria-describedby~="${CSS.escape(n)}"]`):null}function et(e){let t=[`translate`,`scale`,`clip-path`,`opacity`].map(t=>[t,e.style.getPropertyValue(t)]);k(e,{translate:null,scale:null,"clip-path":null});let n=e.getBoundingClientRect();for(let[n,r]of t)r&&e.style.setProperty(n,r);return n}function tt(e,t,n){let r=e.getAttribute(`data-side`);if(r===`top`||r===`bottom`||r===`left`||r===`right`)return r;if(!n)return`top`;let[i,a]=[[`top`,n.top-t.bottom],[`bottom`,t.top-n.bottom],[`left`,n.left-t.right],[`right`,t.left-n.right]].reduce((e,t)=>t[1]>e[1]?t:e);if(a>=0)return i;let o=n.left+n.width/2-(t.left+t.width/2),s=n.top+n.height/2-(t.top+t.height/2);return Math.abs(s)>=Math.abs(o)?s>0?`top`:`bottom`:o>0?`left`:`right`}function nt(e,t,n){return e===`top`?n?.top??t.bottom+8:e===`bottom`?n?.bottom??t.top-8:e===`left`?n?.left??t.right+8:n?.right??t.left-8}const rt=e=>e===`top`||e===`bottom`;function it(e){let{rest:t,side:n,edge:r}=e;return n===`top`?r+t.height/2:n===`bottom`?r-t.height/2:n===`left`?r+t.width/2:r-t.width/2}function at(e){return[...e.element.children].filter(t=>t instanceof HTMLElement&&t!==e.old?.element&&!t.matches(`[role=tooltip]`)&&!H(t))}function ot(e){return[...e.element.childNodes].filter(t=>t.nodeType===Node.TEXT_NODE||t instanceof Element&&t!==e.old?.element&&!t.matches(`[role=tooltip]`)&&!H(t)).map(e=>e.textContent??``).join(``)}function st(e){return[...e.childNodes].some(e=>e.nodeType===Node.TEXT_NODE&&e.textContent?.trim())}const U=e=>`${Math.round(e*100)/100}px`;function W(e){let{element:t,rest:n,side:r,edge:i,origin:a}=e,o=Math.max(1,e.width.value),s=e.mode===`clip`&&o<n.width,c=s?1:o/n.width,l=e.x.value-o/2,u=s?e.x.value-(n.left+n.width/2):l-n.left-a*(1-c),d=e.y.value-(n.top+n.height/2),f=[-40,-40,-40,-40];r===`top`&&(f[2]=e.y.value+n.height/2-i),r===`bottom`&&(f[0]=i-(e.y.value-n.height/2)),r===`left`&&(f[1]=(e.x.value+o/2-i)/c),r===`right`&&(f[3]=(i-(e.x.value-o/2))/c);let p=f.some(e=>e>0),m=null;if(s){let t=(n.width-o)/2;m=`inset(${[Math.max(0,f[0]),t+Math.max(0,f[1]),Math.max(0,f[2]),t+Math.max(0,f[3])].map(U).join(` `)} round ${e.radius})`}else p&&(m=`inset(${f.map(U).join(` `)})`);k(t,{translate:Math.abs(u)>.01||Math.abs(d)>.01||e.old?`${U(u)} ${U(d)}`:null,scale:Math.abs(c-1)>.001?`${c} 1`:null,"clip-path":m,opacity:e.fade.active||e.fade.value<1?String(e.fade.value):null});let h=Math.abs(c-1)>.001?`${1/c} 1`:null,g=e.label.value;for(let t of at(e))k(t,{scale:h,opacity:g<1?String(g):null,filter:g<1?`blur(${U((1-g)*6)})`:null});if(e.old){let t=e.old.spring.value;k(e.old.element,{scale:h,opacity:String(t),filter:`blur(${U((1-t)*5)})`})}}function ct(e){if(!(e.holding||e.timers.size||[e.x,e.y,e.width,e.label,e.fade,e.old?.spring].some(e=>e?.active))){e.old?.element.remove(),e.old=void 0,k(e.element,{translate:null,scale:null,"clip-path":null,opacity:null});for(let t of at(e))k(t,{scale:null,opacity:null,filter:null});e.done?.()}}function lt(e,t,n){let r=getComputedStyle(e),i=tt(e,t,n),a={element:e,rest:t,origin:Number.parseFloat(r.transformOrigin)||t.width/2,side:i,edge:nt(i,t,n),trigger:n,mode:st(e)||e.matches(Xe)?`clip`:`scale`,handoff:!e.matches(Xe),radius:r.borderRadius||`0px`,timers:/* @__PURE__ */ new Set,holding:!0},o=()=>{W(a),ct(a)};return a.x=x(t.left+t.width/2,o,L),a.y=x(t.top+t.height/2,o,L),a.width=x(t.width,o,R),a.label=x(1,o),a.fade=x(1,o),a}function G(e,t,n){let r=Ae(t,()=>{e.timers.delete(r),n(),ct(e)});e.timers.add(r)}function ut(e){for(let t of e.timers)clearTimeout(t);e.timers.clear();for(let t of[e.x,e.y,e.width,e.label,e.fade,e.old?.spring])t?.stop()}function K(e){ut(e),Je.delete(e),V===e&&(V=void 0),e.element.closest(`[data-motion=none]`)?.remove()}function dt(e){if(e){for(let e of Je)K(e);for(let e of B){let t=z.get(e)?.box;t&&(ut(t),t.holding=!0,t.x.set(t.rest.left+t.rest.width/2),t.y.set(t.rest.top+t.rest.height/2),t.width.set(t.rest.width),t.label.set(1),t.fade.set(1),t.holding=!1,ct(t))}}}function ft(e,t){let n=e.trigger,r=t.trigger;return!n||!r||e.side!==t.side?!1:rt(t.side)?n.top<r.bottom&&r.top<n.bottom:n.left<r.right&&r.left<n.right}function pt(e){return rt(e.side)?e.y:e.x}function mt(e,t,n){if(!t.length)return;let r=document.createElement(`span`);r.setAttribute(`aria-hidden`,`true`),Object.assign(r.style,{position:`absolute`,inset:`0`,display:`flex`,alignItems:`center`,justifyContent:`center`,gap:`inherit`,pointerEvents:`none`,whiteSpace:`nowrap`}),r.append(...t),e.element.append(r);let i=x(n,()=>{W(e),ct(e)});e.old={element:r,spring:i},i.to(0,{tween:.15})}function ht(e){return e.mode===`clip`?[...e.element.childNodes].filter(e=>e.nodeType===Node.TEXT_NODE).map(e=>e.cloneNode()):at(e).map(e=>{let t=e.cloneNode(!0);return t.style.removeProperty(`scale`),t.style.removeProperty(`opacity`),t.style.removeProperty(`filter`),t})}function gt(e,t){let n=t.trigger?.getBoundingClientRect(),r=et(e),i=lt(e,r,n);t.box=i,t.text=ot(i),t.label=ht(i),k(e,{opacity:null});let a=i.handoff&&V&&ft(V,i)?V:void 0;if(a&&(V=void 0),o())a&&_t(a,!0),i.fade.set(0),i.holding=!1,i.fade.to(1,{tween:qe});else if(a){let e=ht(a),t={x:[a.x.value,a.x.velocity],y:[a.y.value,a.y.velocity],width:[a.width.value,a.width.velocity]},n=a.old?0:a.label.value;K(a),i.x.set(t.x[0]),i.y.set(t.y[0]),i.width.set(t.width[0]),i.label.set(0),mt(i,e,n),i.x.to(r.left+r.width/2,{preset:L,velocity:t.x[1]}),i.y.to(r.top+r.height/2,{preset:L,velocity:t.y[1]}),i.width.to(r.width,{preset:R,velocity:t.width[1]}),G(i,40,()=>i.label.to(1,{tween:Ge})),i.holding=!1,W(i)}else pt(i).set(it(i)),i.width.set(Math.min(30,r.width)),i.label.set(0),W(i),pt(i).to(rt(i.side)?r.top+r.height/2:r.left+r.width/2,{preset:We}),G(i,120,()=>{i.width.to(r.width,{preset:R}),G(i,70,()=>i.label.to(1,{tween:Ge}))}),i.holding=!1}function _t(e,t){Je.add(e),e.holding=!1,t?(e.done=()=>K(e),e.fade.to(0,{tween:qe})):(e.handoff&&(V=e),e.old&&e.old.spring.to(0,{tween:Ke}),e.label.to(0,{tween:Ke}),e.width.to(Math.min(30,e.rest.width),{preset:R}),G(e,90,()=>{V===e&&(V=void 0),pt(e).to(it(e),{preset:We})}),G(e,520,()=>K(e)))}function vt(e,t){if(!t.open)return;t.open=!1,B.delete(e),t.stopWatch?.(),t.stopWatch=void 0,B.size||kt();let n=t.box;if(t.box=void 0,k(e,{opacity:null}),!n)return;let r=t.root.parentNode??t.parent,i=r?.isConnected?Oe(t.root,r,t.root.isConnected?t.root.nextSibling:t.next):void 0,a={x:n.x,y:n.y,width:n.width,label:n.label,fade:n.fade},s=Object.fromEntries(Object.entries(a).map(([e,t])=>[e,[t.value,t.velocity]])),c=n.old?.spring.value;ut(n),n.old?.element.remove(),k(e,{translate:null,scale:null,"clip-path":null,opacity:null});for(let e of at(n))k(e,{scale:null,opacity:null,filter:null});if(!i)return;let l=yt(t.root,e).reduce((e,t)=>e?.children[t],i);if(!(l instanceof HTMLElement)){i.remove();return}e.hasAttribute(`popover`)&&(k(l,{scale:null}),ke(l,n.rest));let u=lt(l,n.rest,void 0);Object.assign(u,{side:n.side,edge:n.edge,trigger:n.trigger,mode:n.mode,origin:n.origin,radius:n.radius,handoff:n.handoff});let d=l.querySelector(`:scope > [aria-hidden=true][style*=absolute]`);c!==void 0&&d&&(u.old={element:d,spring:x(c,()=>W(u))});for(let e of[`x`,`y`,`width`,`label`,`fade`])u[e].set(s[e][0]);W(u);for(let e of[`x`,`y`,`width`])s[e][1]&&u[e].to(s[e][0],{velocity:s[e][1]});_t(u,o())}function yt(e,t){let n=[];for(let r=t;r!==e&&r.parentElement;r=r.parentElement)n.unshift([...r.parentElement.children].indexOf(r));return n}function bt(e,t,n,r=20){requestAnimationFrame(()=>{if(!t.open||!e.isConnected)return;let i=e.closest(`[data-reka-popper-content-wrapper]`);if(r>0&&i?.style.transform.includes(`-200%`))return bt(e,t,n,r-1);n()})}function xt(e,t){let n=()=>{r.disconnect();let t=e;for(;t;){let e=t.parentNode;e&&r.observe(e,{childList:!0}),t=e??(t instanceof ShadowRoot?t.host:null)}},r=new MutationObserver(()=>{e.isConnected?(t.parent=t.root.parentNode,t.next=t.root.nextSibling,n()):vt(e,t)});return n(),()=>r.disconnect()}function St(e){let t=z.get(e);if(t?.open)return;let n=$e(e);if(n&&S(n))return;let r=e.closest(`[data-reka-popper-content-wrapper]`)??e;t={open:!0,root:r,parent:r.parentNode,next:r.nextSibling,text:``,label:[],trigger:n},z.set(e,t),B.add(e),Ot(),k(e,{opacity:`0`}),t.stopWatch=xt(e,t);let i=t;bt(e,t,()=>gt(e,i))}let Ct=0;function wt(){Ct=0;for(let e of B){let t=z.get(e),n=t?.box;if(!t||!n)continue;let r=et(e),i=ot(n);if(!(Math.abs(r.left-n.rest.left)>1||Math.abs(r.top-n.rest.top)>1||Math.abs(r.width-n.rest.width)>1)&&i===t.text)continue;let a=i===t.text?[]:t.label;t.trigger=$e(e)??t.trigger;let s=t.trigger?.getBoundingClientRect();t.text=i,t.label=ht(n),n.rest=r,n.side=tt(e,r,s),n.edge=nt(n.side,r,s),o()?(n.x.set(r.left+r.width/2),n.y.set(r.top+r.height/2),n.width.set(r.width)):(n.x.to(r.left+r.width/2,{preset:L}),n.y.to(r.top+r.height/2,{preset:L}),n.width.to(r.width,{preset:R}),a.length&&(n.old?.spring.stop(),n.old?.element.remove(),mt(n,a,n.label.value),n.label.set(0),G(n,40,()=>n.label.to(1,{tween:Ge}))))}}function Tt(){Ct||=requestAnimationFrame(wt)}let Et=!1,Dt;function Ot(){Dt??=s(dt),Et||(Et=!0,document.addEventListener(`pointerover`,Tt,{capture:!0,passive:!0}),document.addEventListener(`focusin`,Tt,{capture:!0,passive:!0}))}function kt(){Et=!1,cancelAnimationFrame(Ct),Ct=0,document.removeEventListener(`pointerover`,Tt,{capture:!0}),document.removeEventListener(`focusin`,Tt,{capture:!0})}const At={enter(e){Ze(e)===e&&Qe(e)&&St(e)},state(e){if(Ze(e)!==e)return;let t=z.get(e);Qe(e)?St(e):t&&vt(e,t)}};({...At});const jt={name:`appear`,selector:Xe,...At};function Mt(e){let t=e.cloneNode(!0);t.inert=!0,t.setAttribute(`aria-hidden`,`true`);for(let e of[t,...t.querySelectorAll(`[id], [name], [form], input, button, select, textarea, fieldset`)])e.removeAttribute(`id`),e.removeAttribute(`name`),e.removeAttribute(`form`),e.matches(`input, button, select, textarea, fieldset`)&&e.setAttribute(`disabled`,``);return t}const Nt={stiffness:380,damping:26},Pt={stiffness:260,damping:28},Ft=.9,It=je(.5,0,.75,0),Lt=`data-motion-ghost`,q=e=>({x:e.left+e.width/2,y:e.top+e.height/2});function Rt(e){return e.bottom>0&&e.right>0&&e.top<innerHeight&&e.left<innerWidth&&e.width+e.height>0}function zt(e){return[...e.children].filter(e=>e instanceof HTMLElement&&!e.hasAttribute(Lt))}function Bt(e,t={}){let n=t.items??zt,r=/* @__PURE__ */ new Map,i=/* @__PURE__ */ new Set,a=/* @__PURE__ */ new Map,s=!1;function l(e){if(!e)return{x:0,y:0};let t=1-e.grow.value;return{x:e.x.value+e.from.x*t,y:e.y.value+e.from.y*t}}function u(e,t){let{x:n,y:i,grow:a,from:o}=t;if(!n.active&&!i.active&&!a.active&&n.value===0&&i.value===0&&a.value===1){k(e,{translate:null,scale:null,opacity:null}),s||r.delete(e);return}let{x:c,y:u}=l(t),d=o.scale+(1-o.scale)*a.value;k(e,{translate:c||u?`${c.toFixed(2)}px ${u.toFixed(2)}px`:null,scale:d===1?null:d.toFixed(4),opacity:a.value>=1?null:Math.max(0,Math.min(1,a.value)).toFixed(3)})}function d(e){let t=r.get(e);if(t)return t;let n=()=>t&&u(e,t);return t={x:x(0,n,c.snappy),y:x(0,n,c.snappy),grow:x(1,n,Nt),from:{x:0,y:0,scale:1}},r.set(e,t),t}function f(e){let t=r.get(e);t&&(r.delete(e),t.x.stop(),t.y.stop(),t.grow.stop(),k(e,{translate:null,scale:null,opacity:null}))}function p(e,t){let n=e.velocity;e.set(t),e.to(0,{preset:c.snappy,velocity:n})}function m(t,n,r){if(!Rt(n))return;let a=e.getBoundingClientRect();getComputedStyle(e).position===`static`&&(e.style.position=`relative`);let s=Mt(t);s.setAttribute(Lt,``),Object.assign(s.style,{boxSizing:`border-box`,height:`${n.height}px`,left:`${n.left-a.left-e.clientLeft+e.scrollLeft}px`,margin:`0`,pointerEvents:`none`,position:`absolute`,top:`${n.top-a.top-e.clientTop+e.scrollTop}px`,width:`${n.width}px`}),k(s,{translate:null,scale:null,opacity:null,filter:null}),e.append(s);let c={element:s,stop:()=>{}},l=()=>{c.stop(),s.remove(),i.delete(c)};if(i.add(c),o()){let e=Pe(.15,e=>k(s,{opacity:(1-e).toFixed(3)}));c.stop=e.stop,e.done.then(l);return}if(r){let e=q(r.getBoundingClientRect()),t=q(n),i=Pe(.32,n=>{k(s,{translate:`${((e.x-t.x)*n).toFixed(2)}px ${((e.y-t.y)*n).toFixed(2)}px`,scale:(1-.8*n).toFixed(4),opacity:(1-n).toFixed(3),filter:n>0?`blur(${(3*n).toFixed(2)}px)`:null})},It);c.stop=i.stop,i.done.then(l);return}let u=x(1,e=>{k(s,{scale:(Ft+.09999999999999998*e).toFixed(4),opacity:Math.max(0,e).toFixed(3)}),e<.02&&l()},Pt);c.stop=()=>u.stop(),u.to(0)}return{measure(){a=/* @__PURE__ */ new Map;for(let t of n(e)){let e=t.getBoundingClientRect();if(!e.width&&!e.height)continue;let n=q(e),i=l(r.get(t));a.set(t,{x:n.x-i.x,y:n.y-i.y,rect:e})}},play(i={}){let c=a;a=/* @__PURE__ */ new Map;let u=S(e),h=n(e),g=new Set(h),_=h.map(e=>{let t=e.getBoundingClientRect(),n=l(r.get(e)),i=q(t);return{element:e,rect:t,layout:{x:i.x-n.x,y:i.y-n.y}}}),v=_.map(({element:e})=>{if(!c.has(e)&&i.origin)return(typeof i.origin==`function`?i.origin(e):i.origin)?.getBoundingClientRect()});for(let[e,{rect:n}]of c)g.has(e)||(f(e),u||t.movesOnly||e.hasAttribute(`data-motion-leaving`)||m(e,n,i.target));s=!0,_.forEach(({element:e,rect:n,layout:r},i)=>{if(u)return f(e);let a=c.get(e);if(a){let t=a.x-r.x,i=a.y-r.y;if(Math.abs(t)<.5&&Math.abs(i)<.5)return;if(!Rt(a.rect)&&!Rt(n))return f(e);let o=d(e);p(o.x,o.x.value+t),p(o.y,o.y.value+i);return}if(!Rt(n)||t.movesOnly)return;let s=d(e),l=v[i];if(o())s.from={x:0,y:0,scale:1};else if(l){let e=q(l),t=Math.min(1,Math.max(.2,Math.min(l.width/(n.width||1),l.height/(n.height||1))));s.from={x:e.x-r.x,y:e.y-r.y,scale:t}}else s.from={x:0,y:0,scale:Ft};s.grow.set(0),s.grow.to(1,o()?{tween:.15}:{preset:Nt})}),s=!1},destroy(){for(let e of r.keys())f(e);for(let e of i)e.stop(),e.element.remove();i.clear(),a=/* @__PURE__ */ new Map}}}const Vt=`vitehub`,Ht=[`comment`];function Ut(e,t){let n=new URLSearchParams(e);if(n.has(`vitehub`)||Ht.some(e=>n.has(e)))return!0;let r=t.split(`;`).map(e=>e.trim());return r.includes(`vitehub-tools=1`)?!0:r.includes(`vitehub_session=1`)&&!r.some(e=>e.startsWith(`vitehub-tools=`))}const Wt=`/_vitehub/page/tools`,Gt=`button{all:unset;box-sizing:border-box;display:inline-flex;align-items:center;justify-content:var(--vitehub-pill-justify,center);gap:4px;min-width:28px;height:28px;padding:0 8px;border-radius:8px;font:inherit;white-space:nowrap;color:var(--vitehub-pill-text);cursor:pointer;touch-action:manipulation;-webkit-tap-highlight-color:transparent;transition-property:background-color,color;transition-duration:150ms;transition-timing-function:cubic-bezier(.23,1,.32,1)}
1
+ const e=/* @__PURE__ */ new Set;let t,n=!1;function r(){return t?.matches??!1}function i(){let t=r();if(t!==n){n=t;for(let n of e)n(t)}}function a(){t||typeof matchMedia!=`function`||(t=matchMedia(`(prefers-reduced-motion: reduce)`),t.addEventListener?.(`change`,i),n=r())}function o(){return a(),r()}function s(t){return a(),e.add(t),()=>e.delete(t)}const c={snappy:{stiffness:520,damping:34},soft:{stiffness:380,damping:20}},l=/* @__PURE__ */ new Map,u=/* @__PURE__ */ new Set;let d=0,f=!1,p=0,m=0;function h(){return 1}function g(e){let t=Math.min(.032,m?(e-m)/1e3:.016)/1;m=e;let n=Array.from(l),r=Array.from(u);for(let[e,r]of n)if(l.get(e)===r){if(e.tween){let n=e.tween;n.elapsed+=t;let r=Math.min(1,n.elapsed/n.duration),i=1-(1-r)**3,a=n.from+(e.target-n.from)*i;e.velocity=(a-e.value)/(t||1),e.value=a,r>=1&&_(e)}else{let{stiffness:n,damping:r}=e.preset,i=t/6;for(let t=0;t<6;t++){let t=-n*(e.value-e.target)-r*e.velocity;e.velocity+=t*i,e.value+=e.velocity*i}Math.abs(e.velocity)<.002&&Math.abs(e.value-e.target)<5e-4&&_(e)}e.frame(e.value,e.velocity)}for(let e of r)u.has(e)&&e(t)===!1&&u.delete(e);l.size||u.size?p=requestAnimationFrame(g):(p=0,m=0)}function _(e){e.value=e.target,e.velocity=0,e.tween=void 0,l.delete(e)}function v(e){l.set(e,++d),p||=requestAnimationFrame(g)}function y(e){let t=t=>e(t);return u.add(t),p||=requestAnimationFrame(g),()=>{u.delete(t)}}function b(e){if(!e)return;let t=Array.from(l);for(let[e,n]of t)l.get(e)!==n||e.tween||(_(e),e.frame(e.value,0))}function x(e,t,n=c.snappy){let r={value:e,velocity:0,target:e,preset:n,tween:void 0,frame:t},i={get value(){return r.value},get velocity(){return r.velocity},get target(){return r.target},get active(){return l.has(r)},to(e,t={}){if(t.preset&&(r.preset=t.preset),t.tween===void 0&&o())return i.set(e);t.tween===void 0&&!f&&(f=!0,s(b)),r.target=e,t.velocity!==void 0&&(r.velocity+=t.velocity),r.tween=t.tween===void 0?void 0:{from:r.value,elapsed:0,duration:t.tween},v(r)},set(e){r.value=r.target=e,r.velocity=0,r.tween=void 0,l.delete(r),t(e,0)},stop(){r.velocity=0,r.tween=void 0,l.delete(r)}};return i}function S(e){let t=e;for(;t;){if(t.closest(`[data-motion="none"]`))return!0;let e=t.getRootNode();t=e instanceof ShadowRoot?e.host:null}return!1}const C=[`aria-checked`,`aria-selected`,`aria-pressed`,`aria-expanded`,`aria-valuenow`,`aria-valuetext`,`data-state`,`data-checked`,`data-open`,`open`,`data-leaving`],w=/* @__PURE__ */ new Map,T=/* @__PURE__ */ new Set,E=Symbol.for(`vite-hub.motion.layer`);let D;function ee(){let e=Reflect.get(globalThis,E);if(e&&e!==D&&typeof e==`object`&&`define`in e&&`install`in e)return e}function O(e){D=e,Reflect.get(globalThis,E)||Reflect.set(globalThis,E,e)}function k(e){let t=[...w.values()];w.clear();for(let n of t)n.removeFromShared=e.define(n.effect,n.isReduced)}function te(e,t=o){let n={effect:e,isReduced:t};w.set(e.name,n);for(let e of T)e();return()=>{if(n.removeFromShared)return n.removeFromShared();if(w.get(e.name)===n){w.delete(e.name);for(let e of T)e()}}}function A(){return[...w.values()].map(e=>e.effect)}function j(){return[...w.values()]}function M(e){return T.add(e),()=>T.delete(e)}function N(e,t){for(let[n,r]of Object.entries(t))r?e.style.setProperty(n,r):e.style.removeProperty(n)}const P=/* @__PURE__ */ new Map;let F;const I=/* @__PURE__ */ new Map;let L,ne=[];const re=Symbol.for(`vite-hub.motion.effect-presses`),ie=e=>{let t=Reflect.get(e,re);if(t)return t;let n=/* @__PURE__ */ new Map;return Reflect.set(e,re,n),n},ae=/* @__PURE__ */ new Set;function oe(e,t){if(ae.has(t))return!1;try{return e.matches(t)}catch{return ae.add(t),!1}}function se(e){let t=e;for(;;){for(let e of P.keys())if(e instanceof Element&&e.contains(t))return!0;let e=t.getRootNode();if((e instanceof Document||e instanceof ShadowRoot)&&P.has(e))return!0;if(!(e instanceof ShadowRoot))return!1;t=e.host}}function ce(e,t){let n=-1;e.forEach((e,t)=>{e instanceof Element&&e.matches(`[data-motion="none"]`)&&(n=t)});let r=e.findIndex(e=>e instanceof HTMLElement&&oe(e,t));return r===-1||r<=n||!se(e[r])?void 0:e[r]}function le(e,t,n){R(e,!0);let r=ie(t),i=[];for(let{effect:a,isReduced:o}of j()){if(!a.press||o())continue;let s=ce(n,a.selector);if(!s||e===`key`&&s!==n[0])continue;let c=r.get(s);if(c?.has(a.name))continue;let l=a.press(s,t);if(!l)continue;c?c.add(a.name):r.set(s,/* @__PURE__ */ new Set([a.name]));let u={element:s,press:l};e!==`key`&&!l.move&&(u.leave=()=>ue(e,u,!0),s.addEventListener(`pointerleave`,u.leave,{once:!0})),i.push(u)}i.length&&(I.set(e,i),i.some(e=>e.press.move)&&document.addEventListener(`pointermove`,me,{capture:!0,passive:!0}))}function R(e,t=!1){let n=I.get(e);if(n){I.delete(e);for(let{element:e,press:r,leave:i}of n)i&&e.removeEventListener(`pointerleave`,i),t&&r.cancel?r.cancel():r.release();de()}}function ue(e,t,n=!1){let r=I.get(e),i=r?.indexOf(t)??-1;r&&i!==-1&&(t.leave&&t.element.removeEventListener(`pointerleave`,t.leave),r.splice(i,1),r.length||I.delete(e),n&&t.press.cancel?t.press.cancel():t.press.release(),de())}function de(){[...I.values()].some(e=>e.some(e=>e.press.move))||document.removeEventListener(`pointermove`,me,{capture:!0})}function fe(e){if(e.button!==0)return;let t=e.composedPath();e.isPrimary&&(L={event:e,path:t}),le(e.pointerId,e,t)}function pe(e){L?.event.pointerId===e.pointerId&&(L=void 0),R(e.pointerId,e.type===`pointercancel`)}function me(e){for(let{press:t}of I.get(e.pointerId)??[])t.move?.(e)}function he(e){if(e.repeat||e.key!==` `&&e.key!==`Enter`)return;let t=e.composedPath();e.key===` `&&t[0]instanceof Element&&t[0].matches(`a[href], [role=link]`)||le(`key`,e,t)}function ge(e){(e.key===` `||e.key===`Enter`)&&R(`key`)}function _e(e,t){let n=t.filter(e=>e.content);if(!n.length)return;let r=/* @__PURE__ */ new Map;for(let t of e){if(t.type===`attributes`)continue;let e=t.type===`characterData`?t.target.parentElement:t.target;if(!(e instanceof HTMLElement||e instanceof SVGElement))continue;let n=r.get(e);n||(n={added:[],removed:[],oldText:void 0,texts:/* @__PURE__ */ new Map},r.set(e,n)),t.type===`characterData`?n.texts.has(t.target)||n.texts.set(t.target,t.oldValue):(n.added.push(...t.addedNodes),n.removed.push(...t.removedNodes))}for(let[e,t]of r){if(!e.isConnected)continue;let r=t.added.filter(e=>!t.removed.includes(e)),i=t.removed.filter(e=>!t.added.includes(e)),a=t.texts,o,s=[...e.childNodes];i.length&&s.every(e=>r.includes(e))?o=i.map(e=>e.textContent??``).join(``):a.size===1&&s.length===1&&a.has(s[0])&&(o=a.get(s[0])??``);for(let t of n)oe(e,t.selector)&&!S(e)&&t.content(e,{added:r,removed:i,oldText:o})}}function ve(e){if(!L||!e.matches(`[role=separator][data-panel-resize-handle-id]`))return;let t=j().find(({effect:e})=>e.name===`divider`);if(!t||t.isReduced())return;let{event:n,path:r}=L,i=I.get(n.pointerId)??[],a=i.find(t=>t.splitter&&t.element===e);if(e.getAttribute(`data-resize-handle-active`)!==`pointer`){a&&ue(n.pointerId,a);return}if(a||!r.includes(e.getRootNode())||!se(e)||S(e))return;let o=t.effect.press?.(e,n);o&&(i.push({element:e,press:o,splitter:!0}),I.set(n.pointerId,i),document.addEventListener(`pointermove`,me,{capture:!0,passive:!0}))}function ye(e){let t=[...new Set(e)],n=A(),r=/* @__PURE__ */ new Map;_e(t,n);for(let e of t)if(e.type!==`characterData`){if(e.type===`attributes`){let t=e.target;if(!(t instanceof HTMLElement))continue;if(e.attributeName===`data-resize-handle-active`){ve(t);continue}let i=e.attributeName,a=t.getAttribute(i);if(a===e.oldValue)continue;let o=r.get(t);o||r.set(t,o=/* @__PURE__ */ new Map);let s=o.get(i);if(s||o.set(i,s=/* @__PURE__ */ new Set),s.has(e.oldValue))continue;s.add(e.oldValue);for(let r of n)r.state&&oe(t,r.selector)&&!S(t)&&r.state(t,{attribute:i,oldValue:e.oldValue,value:a})}else for(let t of e.addedNodes)if(t instanceof HTMLElement&&t.isConnected)for(let e of n){if(!e.enter)continue;let n=oe(t,e.selector);if(ae.has(e.selector))continue;let r=[...n?[t]:[],...t.querySelectorAll(e.selector)];for(let t of r)S(t)||e.enter(t)}}}function be(e,t){let n=A().some(e=>e.content);t.observe(e,{attributes:!0,attributeFilter:[...C,...A().some(e=>e.name===`divider`)?[`data-resize-handle-active`]:[]],attributeOldValue:!0,childList:n||A().some(e=>e.enter),characterData:n,characterDataOldValue:n,subtree:!0})}function xe(e,t){let n=A();for(let[e,r]of t)n.includes(e)||(r(),t.delete(e));for(let r of n)r.watch&&!t.has(r)&&t.set(r,r.watch(e))}function Se(){let e={capture:!0,passive:!0};document.addEventListener(`pointerdown`,fe,e),document.addEventListener(`pointerup`,pe,e),document.addEventListener(`pointercancel`,pe,e),document.addEventListener(`keydown`,he,e),document.addEventListener(`keyup`,ge,e),ne=[()=>{document.removeEventListener(`pointerdown`,fe,e),document.removeEventListener(`pointerup`,pe,e),document.removeEventListener(`pointercancel`,pe,e),document.removeEventListener(`keydown`,he,e),document.removeEventListener(`keyup`,ge,e),L=void 0;for(let e of I.keys())R(e,!0)},s(e=>{if(e){L=void 0;for(let e of I.keys())R(e,!0)}})]}function z(e,t){if(typeof document>`u`)return()=>{};let n=ee();return n?(k(n),n.install(e,t.effects,o)):(O(Ce),we(e,t.effects))}const Ce={define:te,install:we};function we(e,t,n=o){let r=new Set(A().map(e=>e.name));for(let e of t)r.has(e.name)||te(e,n);if(!F){Se();let e=new MutationObserver((e,t)=>ye(e.concat(t.takeRecords())));F=e,ne.push(M(()=>{for(let[t,{watchers:n}]of P)be(t,e),xe(t,n)}))}let i=P.get(e);if(i)i.installs++;else{let t=/* @__PURE__ */ new Map;be(e,F),P.set(e,{installs:1,watchers:t}),xe(e,t)}let a=!1;return()=>{if(a)return;a=!0;let t=P.get(e);if(!t||--t.installs>0)return;P.delete(e);let n=F,r=n.takeRecords();n.disconnect();for(let e of t.watchers.values())e();if(P.size){for(let e of P.keys())be(e,n);r.length&&queueMicrotask(()=>{if(F!==n)return;let e=[...P.keys()];ye(r.filter(t=>e.some(e=>e.contains(t.target))))})}else{F=void 0;for(let e of ne)e();ne=[]}}}function Te(e,t,n){let r=e.cloneNode(!0);for(let e of[r,...r.querySelectorAll(`*`)])for(let t of[`id`,`role`,`tabindex`,`hidden`,`inert`,`popover`,`data-ending-style`,`data-starting-style`,`aria-live`])e.removeAttribute(t);return r.setAttribute(`aria-hidden`,`true`),r.setAttribute(`data-motion`,`none`),r instanceof HTMLElement&&(r.inert=!0),r.style.pointerEvents=`none`,t.insertBefore(r,n?.parentNode===t?n:null),r}function Ee(e,t){Object.assign(e.style,{position:`fixed`,inset:`auto`,left:`${t.left}px`,top:`${t.top}px`,width:`${t.width}px`,height:`${t.height}px`,margin:`0`,boxSizing:`border-box`,transform:`none`,translate:`none`,zIndex:`2147483647`});let n=e.getBoundingClientRect();Math.abs(n.left-t.left)>.5&&(e.style.left=`${2*t.left-n.left}px`),Math.abs(n.top-t.top)>.5&&(e.style.top=`${2*t.top-n.top}px`)}function De(e,t){return window.setTimeout(t,e*h())}function Oe(e,t,n,r){let i=(e,t,n)=>3*t*e*(1-e)**2+3*n*e**2*(1-e)+e**3;return a=>{if(a<=0||a>=1)return a<=0?0:1;let o=0,s=1,c=a;for(let t=0;t<24;t++)i(c,e,n)<a?o=c:s=c,c=(o+s)/2;return i(c,t,r)}}const ke=e=>e;function Ae(e,t,n,r,i){let a=(n.delay??0)/1e3,s=n.duration/1e3,c=n.ease??ke,l=o(),u=0;return{stop:y(n=>{u+=n;let d=!l&&o()||u>=a+s?1:s>0?Math.max(0,(u-a)/s):0;return r(e+(t-e)*c(d)),d<1||(i?.(),!1)})}}function je(e,t,n=ke,r=0){let i=()=>{},a=new Promise(e=>i=e),o=Ae(0,1,{duration:e*1e3,delay:r*1e3,ease:n},t,()=>i(!0));return{done:a,stop:()=>{o.stop(),i(!1)}}}const Me={stiffness:900,damping:40},Ne={stiffness:380,damping:14},Pe=`:is(button, a[href], summary, input:is([type=button], [type=submit], [type=reset], [type=checkbox], [type=radio]), ${[`button`,`link`,`tab`,`radio`,`menuitem`,`menuitemradio`,`menuitemcheckbox`,`option`,`checkbox`].map(e=>`[role=${e}]`).join(`, `)}, [data-motion-press]:not([data-motion-press=none])):not(:disabled, [aria-disabled="true"], [role=switch])`,Fe=`svg, img, .iconify, [data-slot=icon], [data-slot$=Icon], [data-slot=swap-icon]`,Ie=Symbol.for(`vite-hub.motion.press-mode`);function Le(){let e=Reflect.get(globalThis,Ie);return e===`opt-in`||e===`all`?e:`buttons`}const Re=/* @__PURE__ */ new WeakMap,ze=e=>e>=40?.03:e>=32?.04:.05,Be=e=>Math.min(ze(e.offsetHeight),6/Math.max(e.offsetWidth,e.offsetHeight));function Ve(e,t){for(let n of t.composedPath()){if(!(n instanceof Element))continue;let t=n.getAttribute(`data-motion-press`);if(t===`none`||n===e&&t!==null)return t}}function He(e){let t=Le();return t===`buttons`?e.matches(`:is(button, input:is([type=button], [type=submit], [type=reset])):is(:not([role]), [role=button])`)&&e.offsetHeight<48&&e.offsetWidth<=4*e.offsetHeight:t===`all`}function Ue(e,t){if(t===`none`)return;if(t===`icon`){let t=e.querySelector(Fe);return t instanceof HTMLElement||t instanceof SVGElement?{target:t,amount:.15}:void 0}if(t===void 0&&!He(e))return;let n=e.dataset.motionPressTarget?e.closest(e.dataset.motionPressTarget):null;if(n instanceof HTMLElement)return{target:n,amount:Be(n)};let r=e.firstElementChild;return e.childElementCount===1&&!e.textContent?.trim()&&(r instanceof HTMLElement||r instanceof SVGElement)&&r.matches(Fe)?{target:r,amount:.15}:{target:e,amount:Be(e)}}function We(e){let t=e.transitionDuration.split(`,`);return e.transitionProperty.split(`,`).some((e,n)=>/^\s*(?:scale|all)\s*$/.test(e)&&Number.parseFloat(t[n%t.length])>0)}function Ge(e,t,n){let{left:r,right:i,top:a,bottom:o,width:s,height:c}=e;return Math.min(t.clientX-r,i-t.clientX)<=s*n||Math.min(t.clientY-a,o-t.clientY)<=c*n}const Ke={name:`press`,selector:Pe,press(e,t){if(!(`pointerId`in t))return;let n=Ue(e,Ve(e,t));if(!n)return;let{target:r,amount:i}=n,a=getComputedStyle(r);if(We(a)||a.display===`contents`||a.display===`inline`&&r===e&&!(e instanceof HTMLInputElement))return;let o;if(r===e&&(o=e.getBoundingClientRect(),Ge(o,t,i)))return;let s=Re.get(r);if(!s){let e={amount:i,spring:x(0,t=>{N(r,{scale:t?String(1-e.amount*t):null})},Me)};s=e,Re.set(r,s)}s.amount=i;let{spring:c}=s;c.to(1,{preset:Me});let l=!1,u=()=>{l||(l=!0,c.set(0))};return{move:o?e=>{Ge(o,e,i)&&u()}:void 0,release:()=>{l||c.to(0,{preset:Ne})},cancel:u}}},B={stiffness:480,damping:36},qe={stiffness:380,damping:26},V={stiffness:440,damping:32},Je=.24,Ye=.14,Xe=.15,Ze=/* @__PURE__ */ new WeakMap,Qe=/* @__PURE__ */ new Set,$e=/* @__PURE__ */ new Set;let H;function et(e){let t=getComputedStyle(e);return t.clipPath===`inset(50%)`||t.clip===`rect(0px, 0px, 0px, 0px)`}function tt(e){return e.matches(`[role=tooltip]`)?e:e.querySelector(`:scope > [role=tooltip]`)}const nt=`[data-motion-appear]`;function rt(e){if(e.matches(nt))return e;if(e.matches(`[role=tooltip]`))return et(e)?e.parentElement:e;let t=e.querySelector(`:scope > [role=tooltip]`);return t&&et(t)?e:null}function it(e){let t=e.getAttribute(`data-state`);return t===null?!e.hidden&&!e.hasAttribute(`data-closed`):t!==`closed`}function at(e){let t=e.getAttribute(`data-motion-appear`);if(t!==null){let n=e.parentElement;return!t||!n?null:n.closest(t)??[...n.children].find(n=>n!==e&&n.matches(t))??null}let n=tt(e)?.id;return n?e.getRootNode().querySelector(`[aria-describedby~="${CSS.escape(n)}"]`)??document.querySelector(`[aria-describedby~="${CSS.escape(n)}"]`):null}function ot(e){let t=[`translate`,`scale`,`clip-path`,`opacity`].map(t=>[t,e.style.getPropertyValue(t)]);N(e,{translate:null,scale:null,"clip-path":null});let n=e.getBoundingClientRect();for(let[n,r]of t)r&&e.style.setProperty(n,r);return n}function st(e,t,n){let r=e.getAttribute(`data-side`);if(r===`top`||r===`bottom`||r===`left`||r===`right`)return r;if(!n)return`top`;let[i,a]=[[`top`,n.top-t.bottom],[`bottom`,t.top-n.bottom],[`left`,n.left-t.right],[`right`,t.left-n.right]].reduce((e,t)=>t[1]>e[1]?t:e);if(a>=0)return i;let o=n.left+n.width/2-(t.left+t.width/2),s=n.top+n.height/2-(t.top+t.height/2);return Math.abs(s)>=Math.abs(o)?s>0?`top`:`bottom`:o>0?`left`:`right`}function ct(e,t,n){return e===`top`?n?.top??t.bottom+8:e===`bottom`?n?.bottom??t.top-8:e===`left`?n?.left??t.right+8:n?.right??t.left-8}const lt=e=>e===`top`||e===`bottom`;function ut(e){let{rest:t,side:n,edge:r}=e;return n===`top`?r+t.height/2:n===`bottom`?r-t.height/2:n===`left`?r+t.width/2:r-t.width/2}function dt(e){return[...e.element.children].filter(t=>t instanceof HTMLElement&&t!==e.old?.element&&!t.matches(`[role=tooltip]`)&&!et(t))}function ft(e){return[...e.element.childNodes].filter(t=>t.nodeType===Node.TEXT_NODE||t instanceof Element&&t!==e.old?.element&&!t.matches(`[role=tooltip]`)&&!et(t)).map(e=>e.textContent??``).join(``)}function pt(e){return[...e.childNodes].some(e=>e.nodeType===Node.TEXT_NODE&&e.textContent?.trim())}const U=e=>`${Math.round(e*100)/100}px`;function W(e){let{element:t,rest:n,side:r,edge:i,origin:a}=e,o=Math.max(1,e.width.value),s=e.mode===`clip`&&o<n.width,c=s?1:o/n.width,l=e.x.value-o/2,u=s?e.x.value-(n.left+n.width/2):l-n.left-a*(1-c),d=e.y.value-(n.top+n.height/2),f=[-40,-40,-40,-40];r===`top`&&(f[2]=e.y.value+n.height/2-i),r===`bottom`&&(f[0]=i-(e.y.value-n.height/2)),r===`left`&&(f[1]=(e.x.value+o/2-i)/c),r===`right`&&(f[3]=(i-(e.x.value-o/2))/c);let p=f.some(e=>e>0),m=null;if(s){let t=(n.width-o)/2;m=`inset(${[Math.max(0,f[0]),t+Math.max(0,f[1]),Math.max(0,f[2]),t+Math.max(0,f[3])].map(U).join(` `)} round ${e.radius})`}else p&&(m=`inset(${f.map(U).join(` `)})`);N(t,{translate:Math.abs(u)>.01||Math.abs(d)>.01||e.old?`${U(u)} ${U(d)}`:null,scale:Math.abs(c-1)>.001?`${c} 1`:null,"clip-path":m,opacity:e.fade.active||e.fade.value<1?String(e.fade.value):null});let h=Math.abs(c-1)>.001?`${1/c} 1`:null,g=e.label.value;for(let t of dt(e))N(t,{scale:h,opacity:g<1?String(g):null,filter:g<1?`blur(${U((1-g)*6)})`:null});if(e.old){let t=e.old.spring.value;N(e.old.element,{scale:h,opacity:String(t),filter:`blur(${U((1-t)*5)})`})}}function mt(e){return e.holding||e.timers.size>0||[e.x,e.y,e.width,e.label,e.fade,e.old?.spring].some(e=>e?.active)}function ht(e){if(!mt(e)){e.old?.element.remove(),e.old=void 0,N(e.element,{translate:null,scale:null,"clip-path":null,opacity:null});for(let t of dt(e))N(t,{scale:null,opacity:null,filter:null});e.done?.()}}function gt(e,t,n){let r=getComputedStyle(e),i=st(e,t,n),a={element:e,rest:t,origin:Number.parseFloat(r.transformOrigin)||t.width/2,side:i,edge:ct(i,t,n),trigger:n,mode:pt(e)||e.matches(nt)?`clip`:`scale`,handoff:!e.matches(nt),radius:r.borderRadius||`0px`,timers:/* @__PURE__ */ new Set,holding:!0},o=()=>{W(a),ht(a)};return a.x=x(t.left+t.width/2,o,B),a.y=x(t.top+t.height/2,o,B),a.width=x(t.width,o,V),a.label=x(1,o),a.fade=x(1,o),a}function G(e,t,n){let r=De(t,()=>{e.timers.delete(r),n(),ht(e)});e.timers.add(r)}function _t(e){for(let t of e.timers)clearTimeout(t);e.timers.clear();for(let t of[e.x,e.y,e.width,e.label,e.fade,e.old?.spring])t?.stop()}function vt(e){_t(e),$e.delete(e),H===e&&(H=void 0),e.element.closest(`[data-motion=none]`)?.remove()}function yt(e){if(e){for(let e of $e)vt(e);for(let e of Qe){let t=Ze.get(e)?.box;t&&(_t(t),t.holding=!0,t.x.set(t.rest.left+t.rest.width/2),t.y.set(t.rest.top+t.rest.height/2),t.width.set(t.rest.width),t.label.set(1),t.fade.set(1),t.holding=!1,ht(t))}}}function bt(e,t){let n=e.trigger,r=t.trigger;return!n||!r||e.side!==t.side?!1:lt(t.side)?n.top<r.bottom&&r.top<n.bottom:n.left<r.right&&r.left<n.right}function xt(e){return lt(e.side)?e.y:e.x}function St(e,t,n){if(!t.length)return;let r=document.createElement(`span`);r.setAttribute(`aria-hidden`,`true`),Object.assign(r.style,{position:`absolute`,inset:`0`,display:`flex`,alignItems:`center`,justifyContent:`center`,gap:`inherit`,pointerEvents:`none`,whiteSpace:`nowrap`}),r.append(...t),e.element.append(r);let i=x(n,()=>{W(e),ht(e)});e.old={element:r,spring:i},i.to(0,{tween:.15})}function Ct(e){return e.mode===`clip`?[...e.element.childNodes].filter(e=>e.nodeType===Node.TEXT_NODE).map(e=>e.cloneNode()):dt(e).map(e=>{let t=e.cloneNode(!0);return t.style.removeProperty(`scale`),t.style.removeProperty(`opacity`),t.style.removeProperty(`filter`),t})}function wt(e,t){let n=t.trigger?.getBoundingClientRect(),r=ot(e),i=gt(e,r,n);t.box=i,t.text=ft(i),t.label=Ct(i),N(e,{opacity:null});let a=i.handoff&&H&&bt(H,i)?H:void 0;if(a&&(H=void 0),o())a&&Tt(a,!0),i.fade.set(0),i.holding=!1,i.fade.to(1,{tween:Xe});else if(a){let e=Ct(a),t={x:[a.x.value,a.x.velocity],y:[a.y.value,a.y.velocity],width:[a.width.value,a.width.velocity]},n=a.old?0:a.label.value;vt(a),i.x.set(t.x[0]),i.y.set(t.y[0]),i.width.set(t.width[0]),i.label.set(0),St(i,e,n),i.x.to(r.left+r.width/2,{preset:B,velocity:t.x[1]}),i.y.to(r.top+r.height/2,{preset:B,velocity:t.y[1]}),i.width.to(r.width,{preset:V,velocity:t.width[1]}),G(i,40,()=>i.label.to(1,{tween:Je})),i.holding=!1,W(i)}else xt(i).set(ut(i)),i.width.set(Math.min(30,r.width)),i.label.set(0),W(i),xt(i).to(lt(i.side)?r.top+r.height/2:r.left+r.width/2,{preset:qe}),G(i,120,()=>{i.width.to(r.width,{preset:V}),G(i,70,()=>i.label.to(1,{tween:Je}))}),i.holding=!1}function Tt(e,t){$e.add(e),e.holding=!1,t?(e.done=()=>vt(e),e.fade.to(0,{tween:Xe})):(e.handoff&&(H=e),e.old&&e.old.spring.to(0,{tween:Ye}),e.label.to(0,{tween:Ye}),e.width.to(Math.min(30,e.rest.width),{preset:V}),G(e,90,()=>{H===e&&(H=void 0),xt(e).to(ut(e),{preset:qe})}),G(e,520,()=>vt(e)))}function Et(e,t){if(!t.open)return;t.open=!1,Qe.delete(e),t.stopWatch?.(),t.stopWatch=void 0,Qe.size||Lt();let n=t.box;if(t.box=void 0,N(e,{opacity:null}),!n)return;let r=t.root.parentNode??t.parent,i=r?.isConnected?Te(t.root,r,t.root.isConnected?t.root.nextSibling:t.next):void 0,a={x:n.x,y:n.y,width:n.width,label:n.label,fade:n.fade},s=Object.fromEntries(Object.entries(a).map(([e,t])=>[e,[t.value,t.velocity]])),c=n.old?.spring.value;_t(n),n.old?.element.remove(),N(e,{translate:null,scale:null,"clip-path":null,opacity:null});for(let e of dt(n))N(e,{scale:null,opacity:null,filter:null});if(!i)return;let l=Dt(t.root,e).reduce((e,t)=>e?.children[t],i);if(!(l instanceof HTMLElement)){i.remove();return}e.hasAttribute(`popover`)&&(N(l,{scale:null}),Ee(l,n.rest));let u=gt(l,n.rest,void 0);Object.assign(u,{side:n.side,edge:n.edge,trigger:n.trigger,mode:n.mode,origin:n.origin,radius:n.radius,handoff:n.handoff});let d=l.querySelector(`:scope > [aria-hidden=true][style*=absolute]`);c!==void 0&&d&&(u.old={element:d,spring:x(c,()=>W(u))});for(let e of[`x`,`y`,`width`,`label`,`fade`])u[e].set(s[e][0]);W(u);for(let e of[`x`,`y`,`width`])s[e][1]&&u[e].to(s[e][0],{velocity:s[e][1]});Tt(u,o())}function Dt(e,t){let n=[];for(let r=t;r!==e&&r.parentElement;r=r.parentElement)n.unshift([...r.parentElement.children].indexOf(r));return n}function Ot(e,t,n,r=20){requestAnimationFrame(()=>{if(!t.open||!e.isConnected)return;let i=e.closest(`[data-reka-popper-content-wrapper]`);if(r>0&&i?.style.transform.includes(`-200%`))return Ot(e,t,n,r-1);n()})}function kt(e,t){let n=()=>{r.disconnect();let t=e;for(;t;){let e=t.parentNode;e&&r.observe(e,{childList:!0}),t=e??(t instanceof ShadowRoot?t.host:null)}},r=new MutationObserver(()=>{e.isConnected?(t.parent=t.root.parentNode,t.next=t.root.nextSibling,n()):Et(e,t)});return n(),()=>r.disconnect()}function At(e){let t=Ze.get(e);if(t?.open)return;let n=at(e);if(n&&S(n))return;let r=e.closest(`[data-reka-popper-content-wrapper]`)??e;t={open:!0,root:r,parent:r.parentNode,next:r.nextSibling,text:``,label:[],trigger:n},Ze.set(e,t),Qe.add(e),It(),N(e,{opacity:`0`}),t.stopWatch=kt(e,t);let i=t;Ot(e,t,()=>wt(e,i))}let jt=0;function Mt(){jt=0;for(let e of Qe){let t=Ze.get(e),n=t?.box;if(!t||!n)continue;let r=ot(e),i=ft(n),a=Math.abs(r.left-n.rest.left)>1||Math.abs(r.top-n.rest.top)>1||Math.abs(r.width-n.rest.width)>1,s=(a||Math.abs(r.height-n.rest.height)>1)&&!n.handoff&&!mt(n)&&Math.abs(r.left+r.width/2-(n.rest.left+n.rest.width/2))<=1&&Math.abs(r.top-n.rest.top)<=1;if(!a&&!s&&i===t.text)continue;let c=i===t.text?[]:t.label;t.trigger=at(e)??t.trigger;let l=t.trigger?.getBoundingClientRect();t.text=i,t.label=Ct(n),n.rest=r,n.side=st(e,r,l),n.edge=ct(n.side,r,l),o()||s?(n.x.set(r.left+r.width/2),n.y.set(r.top+r.height/2),n.width.set(r.width)):(n.x.to(r.left+r.width/2,{preset:B}),n.y.to(r.top+r.height/2,{preset:B}),n.width.to(r.width,{preset:V}),c.length&&(n.old?.spring.stop(),n.old?.element.remove(),St(n,c,n.label.value),n.label.set(0),G(n,40,()=>n.label.to(1,{tween:Je}))))}}function Nt(){jt||=requestAnimationFrame(Mt)}let Pt=!1,Ft;function It(){Ft??=s(yt),Pt||(Pt=!0,document.addEventListener(`pointerover`,Nt,{capture:!0,passive:!0}),document.addEventListener(`focusin`,Nt,{capture:!0,passive:!0}))}function Lt(){Pt=!1,cancelAnimationFrame(jt),jt=0,document.removeEventListener(`pointerover`,Nt,{capture:!0}),document.removeEventListener(`focusin`,Nt,{capture:!0})}const Rt={enter(e){rt(e)===e&&it(e)&&At(e)},state(e){if(rt(e)!==e)return;let t=Ze.get(e);it(e)?At(e):t&&Et(e,t)}};({...Rt});const zt={name:`appear`,selector:nt,...Rt};function Bt(e){let t=e.cloneNode(!0);t.inert=!0,t.setAttribute(`aria-hidden`,`true`);for(let e of[t,...t.querySelectorAll(`[id], [name], [form], input, button, select, textarea, fieldset`)])e.removeAttribute(`id`),e.removeAttribute(`name`),e.removeAttribute(`form`),e.matches(`input, button, select, textarea, fieldset`)&&e.setAttribute(`disabled`,``);return t}const Vt={stiffness:380,damping:26},Ht={stiffness:260,damping:28},Ut=.9,Wt=Oe(.5,0,.75,0),Gt=`data-motion-ghost`,K=e=>({x:e.left+e.width/2,y:e.top+e.height/2});function Kt(e){return e.bottom>0&&e.right>0&&e.top<innerHeight&&e.left<innerWidth&&e.width+e.height>0}function qt(e){return[...e.children].filter(e=>e instanceof HTMLElement&&!e.hasAttribute(Gt))}function Jt(e,t={}){let n=t.items??qt,r=/* @__PURE__ */ new Map,i=/* @__PURE__ */ new Set,a=/* @__PURE__ */ new Map,s=!1;function l(e){if(!e)return{x:0,y:0};let t=1-e.grow.value;return{x:e.x.value+e.from.x*t,y:e.y.value+e.from.y*t}}function u(e,t){let{x:n,y:i,grow:a,from:o}=t;if(!n.active&&!i.active&&!a.active&&n.value===0&&i.value===0&&a.value===1){N(e,{translate:null,scale:null,opacity:null}),s||r.delete(e);return}let{x:c,y:u}=l(t),d=o.scale+(1-o.scale)*a.value;N(e,{translate:c||u?`${c.toFixed(2)}px ${u.toFixed(2)}px`:null,scale:d===1?null:d.toFixed(4),opacity:a.value>=1?null:Math.max(0,Math.min(1,a.value)).toFixed(3)})}function d(e){let t=r.get(e);if(t)return t;let n=()=>t&&u(e,t);return t={x:x(0,n,c.snappy),y:x(0,n,c.snappy),grow:x(1,n,Vt),from:{x:0,y:0,scale:1}},r.set(e,t),t}function f(e){let t=r.get(e);t&&(r.delete(e),t.x.stop(),t.y.stop(),t.grow.stop(),N(e,{translate:null,scale:null,opacity:null}))}function p(e,t){let n=e.velocity;e.set(t),e.to(0,{preset:c.snappy,velocity:n})}function m(t,n,r){if(!Kt(n))return;let a=e.getBoundingClientRect();getComputedStyle(e).position===`static`&&(e.style.position=`relative`);let s=Bt(t);s.setAttribute(Gt,``),Object.assign(s.style,{boxSizing:`border-box`,height:`${n.height}px`,left:`${n.left-a.left-e.clientLeft+e.scrollLeft}px`,margin:`0`,pointerEvents:`none`,position:`absolute`,top:`${n.top-a.top-e.clientTop+e.scrollTop}px`,width:`${n.width}px`}),N(s,{translate:null,scale:null,opacity:null,filter:null}),e.append(s);let c={element:s,stop:()=>{}},l=()=>{c.stop(),s.remove(),i.delete(c)};if(i.add(c),o()){let e=je(.15,e=>N(s,{opacity:(1-e).toFixed(3)}));c.stop=e.stop,e.done.then(l);return}if(r){let e=K(r.getBoundingClientRect()),t=K(n),i=je(.32,n=>{N(s,{translate:`${((e.x-t.x)*n).toFixed(2)}px ${((e.y-t.y)*n).toFixed(2)}px`,scale:(1-.8*n).toFixed(4),opacity:(1-n).toFixed(3),filter:n>0?`blur(${(3*n).toFixed(2)}px)`:null})},Wt);c.stop=i.stop,i.done.then(l);return}let u=x(1,e=>{N(s,{scale:(Ut+.09999999999999998*e).toFixed(4),opacity:Math.max(0,e).toFixed(3)}),e<.02&&l()},Ht);c.stop=()=>u.stop(),u.to(0)}return{measure(){a=/* @__PURE__ */ new Map;for(let t of n(e)){let e=t.getBoundingClientRect();if(!e.width&&!e.height)continue;let n=K(e),i=l(r.get(t));a.set(t,{x:n.x-i.x,y:n.y-i.y,rect:e})}},play(i={}){let c=a;a=/* @__PURE__ */ new Map;let u=S(e),h=n(e),g=new Set(h),_=h.map(e=>{let t=e.getBoundingClientRect(),n=l(r.get(e)),i=K(t);return{element:e,rect:t,layout:{x:i.x-n.x,y:i.y-n.y}}}),v=_.map(({element:e})=>{if(!c.has(e)&&i.origin)return(typeof i.origin==`function`?i.origin(e):i.origin)?.getBoundingClientRect()});for(let[e,{rect:n}]of c)g.has(e)||(f(e),u||t.movesOnly||e.hasAttribute(`data-motion-leaving`)||m(e,n,i.target));s=!0,_.forEach(({element:e,rect:n,layout:r},i)=>{if(u)return f(e);let a=c.get(e);if(a){let t=a.x-r.x,i=a.y-r.y;if(Math.abs(t)<.5&&Math.abs(i)<.5)return;if(!Kt(a.rect)&&!Kt(n))return f(e);let o=d(e);p(o.x,o.x.value+t),p(o.y,o.y.value+i);return}if(!Kt(n)||t.movesOnly)return;let s=d(e),l=v[i];if(o())s.from={x:0,y:0,scale:1};else if(l){let e=K(l),t=Math.min(1,Math.max(.2,Math.min(l.width/(n.width||1),l.height/(n.height||1))));s.from={x:e.x-r.x,y:e.y-r.y,scale:t}}else s.from={x:0,y:0,scale:Ut};s.grow.set(0),s.grow.to(1,o()?{tween:.15}:{preset:Vt})}),s=!1},destroy(){for(let e of r.keys())f(e);for(let e of i)e.stop(),e.element.remove();i.clear(),a=/* @__PURE__ */ new Map}}}const q=`vitehub`,Yt=[`comment`];function Xt(e,t){let n=new URLSearchParams(e);if(n.has(`vitehub`)||Yt.some(e=>n.has(e)))return!0;let r=t.split(`;`).map(e=>e.trim());return r.includes(`vitehub-tools=1`)?!0:r.includes(`vitehub_session=1`)&&!r.some(e=>e.startsWith(`vitehub-tools=`))}const Zt=`/_vitehub/page/tools`,Qt=`button{all:unset;box-sizing:border-box;display:inline-flex;align-items:center;justify-content:var(--vitehub-pill-justify,center);gap:4px;min-width:28px;height:28px;padding:0 8px;border-radius:8px;font:inherit;white-space:nowrap;color:var(--vitehub-pill-text);cursor:pointer;touch-action:manipulation;-webkit-tap-highlight-color:transparent;transition-property:background-color,color;transition-duration:150ms;transition-timing-function:cubic-bezier(.23,1,.32,1)}
2
2
  @media(hover:hover){button:where(:not(:disabled):hover){background:var(--vitehub-pill-hover);color:var(--vitehub-pill-strong)}}
3
3
  button[aria-pressed=true],button[aria-expanded=true]{background:var(--vitehub-pill-on);color:var(--vitehub-pill-on-text)}
4
4
  :host([aria-busy=true]) button,button[aria-busy=true]{background:var(--vitehub-pill-on);color:var(--vitehub-pill-on-text);cursor:progress}
5
5
  button:focus-visible{outline:2px solid var(--vitehub-pill-on);outline-offset:1px}
6
6
  button svg{width:14px;height:14px;flex:none}
7
7
  @media(any-pointer:coarse){button{min-width:44px;height:44px}}
8
- @media(prefers-reduced-motion:reduce){button{transition:none}}`;function Kt(e){let t=new URL(e,`http://localhost`).pathname,n=t.lastIndexOf(`/_vitehub/page/assets/`);return n===-1?Wt:`${t.slice(0,n)}${Wt}`}function J(e){return typeof e==`string`&&e?e:void 0}function qt(e){if(typeof e!=`object`||!e)return;let t=J(Reflect.get(e,`id`)),n=J(Reflect.get(e,`script`));if(!t||!n)return;let r={id:t,label:J(Reflect.get(e,`label`))??t,icon:J(Reflect.get(e,`icon`))??``,script:n};Reflect.get(e,`lazy`)===!0&&(r.lazy=!0);let i=J(Reflect.get(e,`hotkey`));i&&(r.hotkey=i);let a=J(Reflect.get(e,`param`));return a&&(r.param=a),r}function Jt(e){if(typeof e!=`object`||!e)return;let t=J(Reflect.get(e,`name`)),n=J(Reflect.get(e,`signOut`));if(!t||!n?.startsWith(`/`)||n.startsWith(`//`)||n.includes(`\\`))return;let r={name:t,signOut:n},i=J(Reflect.get(e,`email`));i&&(r.email=i);let a=J(Reflect.get(e,`image`));return a&&/^https?:\/\//i.test(a)&&(r.image=a),Reflect.get(e,`via`)===`console`&&(r.via=`console`),Reflect.get(e,`guest`)===!0&&(r.guest=!0),r}function Yt(e){let t=typeof e==`object`&&e?Reflect.get(e,`tools`):void 0,n={tools:Array.isArray(t)?t.map(qt).filter(e=>!!e):[]},r=typeof e==`object`&&e?Jt(Reflect.get(e,`account`)):void 0;return r&&(n.account=r),n}const Y={effects:[Ue]},Xt=[[`0px`,`6px`],[`6px`,`0px`],[`calc(100% - 6px)`,`0px`],[`100%`,`6px`],[`100%`,`50%`],[`100%`,`50%`],[`100%`,`calc(100% - 6px)`],[`calc(100% - 6px)`,`100%`],[`6px`,`100%`],[`0px`,`calc(100% - 6px)`],[`0px`,`50%`],[`0px`,`50%`]],Zt=e=>e.map(([e,t])=>[`calc(50% + var(--vitehub-hex-w) * ${e})`,`calc(50% + var(--vitehub-hex-h) * ${t})`]),Qt=Zt([[-.28,-.453],[-.208,-.5],[.208,-.5],[.28,-.453],[.488,-.047],[.488,.047],[.28,.453],[.208,.5],[-.208,.5],[-.28,.453],[-.488,.047],[-.488,-.047]]),$t=Zt([[-.5,-.5],[-.5,-.5],[.5,-.5],[.5,-.5],[.5,0],[.5,0],[.5,.5],[.5,.5],[-.5,.5],[-.5,.5],[-.5,0],[-.5,0]]),en=e=>`polygon(${e.map(([e,t])=>`${e} ${t}`).join(`,`)})`;function tn(e,t,n){let r=(1-n).toFixed(4),i=n.toFixed(4);return en(e.map(([e,n],a)=>[`calc(${e} * ${r} + ${t[a][0]} * ${i})`,`calc(${n} * ${r} + ${t[a][1]} * ${i})`]))}const nn=en(Xt),rn=en(Qt),an=en($t),on=e=>`calc(var(--start) + ${e} / 2 + (100% - var(--start) - var(--end) - ${e}) * var(--at) / 100)`,sn=`:host{all:initial;position:fixed;z-index:2147483001;pointer-events:none;filter:drop-shadow(0 8px 24px rgb(0 0 0/25%));color-scheme:dark;font:500 12px/1 ui-sans-serif,system-ui,sans-serif;color:#d4d4d4;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;--vitehub-pill-text:#d4d4d4;--vitehub-pill-strong:#fafafa;--vitehub-pill-muted:#a3a3a3;--vitehub-pill-hover:rgb(255 255 255/8%);--vitehub-pill-on:#fafafa;--vitehub-pill-on-text:#0a0a0a;--vitehub-pill-line:rgb(255 255 255/12%);--vitehub-pill-surface:#111;--vitehub-pill-flow:row;--vitehub-hex-h:24px;--vitehub-hex-w:calc(var(--vitehub-hex-h) * 10 / 9);--vitehub-pill-fade:opacity 160ms ease-out 80ms,visibility 0s;--vitehub-pill-fade-end:opacity 160ms ease-out 120ms,visibility 0s;--at:50;--margin:16px;--safe-top:env(safe-area-inset-top,0px);--safe-right:env(safe-area-inset-right,0px);--safe-bottom:env(safe-area-inset-bottom,0px);--safe-left:env(safe-area-inset-left,0px)}
8
+ @media(prefers-reduced-motion:reduce){button{transition:none}}`;`${JSON.stringify([q,...Yt])}`;function $t(e){let t=new URL(e,`http://localhost`).pathname,n=t.lastIndexOf(`/_vitehub/page/assets/`);return n===-1?Zt:`${t.slice(0,n)}${Zt}`}function J(e){return typeof e==`string`&&e?e:void 0}function en(e){if(typeof e!=`object`||!e)return;let t=J(Reflect.get(e,`id`)),n=J(Reflect.get(e,`script`));if(!t||!n)return;let r={id:t,label:J(Reflect.get(e,`label`))??t,icon:J(Reflect.get(e,`icon`))??``,script:n};Reflect.get(e,`lazy`)===!0&&(r.lazy=!0);let i=J(Reflect.get(e,`hotkey`));i&&(r.hotkey=i);let a=J(Reflect.get(e,`param`));return a&&(r.param=a),r}function tn(e){if(typeof e!=`object`||!e)return;let t=J(Reflect.get(e,`name`)),n=J(Reflect.get(e,`signOut`));if(!t||!n?.startsWith(`/`)||n.startsWith(`//`)||n.includes(`\\`))return;let r={name:t,signOut:n},i=J(Reflect.get(e,`email`));i&&(r.email=i);let a=J(Reflect.get(e,`image`));return a&&/^https?:\/\//i.test(a)&&(r.image=a),Reflect.get(e,`via`)===`console`&&(r.via=`console`),Reflect.get(e,`guest`)===!0&&(r.guest=!0),r}function nn(e){let t=typeof e==`object`&&e?Reflect.get(e,`tools`):void 0,n={tools:Array.isArray(t)?t.map(en).filter(e=>!!e):[]},r=typeof e==`object`&&e?tn(Reflect.get(e,`account`)):void 0;return r&&(n.account=r),n}const Y=/* @__PURE__ */ new Map;let rn;function an(e,t){let n=e.parentElement;n&&!t.aborted&&(Y.set(e,n),t.addEventListener(`abort`,()=>{Y.delete(e),ln(e),Y.size||(rn?.stop(),rn=void 0)},{once:!0}),rn??=on(),rn.refresh())}function on(){let e=new AbortController,t=/* @__PURE__ */ new Set([document]),n=/* @__PURE__ */ new Set,r=document.createElement(`div`);r.popover=`manual`,r.style.cssText=`all:initial!important;display:block!important;position:fixed!important;inset:0 auto auto 0!important;width:2px!important;height:2px!important;opacity:0!important`;let i=(e=!1)=>{let t=sn(n,r)??cn();for(let[n,r]of Y){if(!n.parentElement)continue;let i=t??r;i.isConnected&&(n.parentElement!==i&&(ln(n),i.append(n)),t?typeof n.showPopover==`function`&&(e||!n.matches(`:popover-open`))&&(ln(n),n.popover=`manual`,n.showPopover()):ln(n))}},a=new MutationObserver(e=>{let c=!1,l=!1;for(let t of e){t.target instanceof HTMLDialogElement&&t.type===`attributes`&&(c=!0,t.target.matches(`:modal`)&&(l=!0));for(let e of t.addedNodes)e instanceof Element&&e.isConnected&&e!==r&&!(e instanceof HTMLElement&&Y.has(e))&&s(e)&&(c=!0)}for(let e of n)e.isConnected||(n.delete(e),c=!0);let u=!1;for(let e of t)e instanceof ShadowRoot&&!e.host.isConnected&&(t.delete(e),u=!0);if(u){a.disconnect();for(let e of t)o(e)}(c||[...Y.keys()].some(e=>!e.isConnected&&e.parentElement))&&i(l)});function o(e){a.observe(e,{attributes:!0,attributeFilter:[`open`],childList:!0,subtree:!0})}function s(e){let t=!1,r=e=>{e instanceof HTMLDialogElement&&!n.has(e)&&(n.add(e),t=!0),e.shadowRoot&&c(e.shadowRoot)&&(t=!0)};e instanceof Element&&r(e);for(let t of e.querySelectorAll(`*`))r(t);return t}function c(e){return!t.has(e)&&(t.add(e),o(e),s(e))}return o(document),document.addEventListener(`focusin`,t=>{let n=!1;for(let e of t.composedPath())e instanceof ShadowRoot&&e.mode===`open`&&c(e)&&(n=!0);n&&queueMicrotask(()=>{e.signal.aborted||i()})},{signal:e.signal}),document.addEventListener(`fullscreenchange`,()=>i(!0),{signal:e.signal}),{refresh(){s(document.documentElement),i()},stop(){a.disconnect(),e.abort()}}}function sn(e,t){let n=[...e].filter(e=>e.isConnected&&e.matches(`:modal`));return n.length<2||typeof t.showPopover!=`function`?n[0]:n.find(e=>{let n=e.getRootNode();e.append(t),t.showPopover();let r=(n instanceof ShadowRoot?n:document).elementFromPoint(1,1);return t.hidePopover(),t.remove(),r===t})}function cn(){let e=document.fullscreenElement;for(;e?.shadowRoot?.fullscreenElement&&e.shadowRoot.fullscreenElement!==e;)e=e.shadowRoot.fullscreenElement;return e}function ln(e){e.hasAttribute(`popover`)&&(e.matches(`:popover-open`)&&e.hidePopover(),e.removeAttribute(`popover`))}const X={effects:[Ke]},un=[[`0px`,`6px`],[`6px`,`0px`],[`calc(100% - 6px)`,`0px`],[`100%`,`6px`],[`100%`,`50%`],[`100%`,`50%`],[`100%`,`calc(100% - 6px)`],[`calc(100% - 6px)`,`100%`],[`6px`,`100%`],[`0px`,`calc(100% - 6px)`],[`0px`,`50%`],[`0px`,`50%`]],dn=e=>e.map(([e,t])=>[`calc(50% + var(--vitehub-hex-w) * ${e})`,`calc(50% + var(--vitehub-hex-h) * ${t})`]),fn=dn([[-.28,-.453],[-.208,-.5],[.208,-.5],[.28,-.453],[.488,-.047],[.488,.047],[.28,.453],[.208,.5],[-.208,.5],[-.28,.453],[-.488,.047],[-.488,-.047]]),pn=dn([[-.5,-.5],[-.5,-.5],[.5,-.5],[.5,-.5],[.5,0],[.5,0],[.5,.5],[.5,.5],[-.5,.5],[-.5,.5],[-.5,0],[-.5,0]]),mn=e=>`polygon(${e.map(([e,t])=>`${e} ${t}`).join(`,`)})`;function hn(e,t,n){let r=(1-n).toFixed(4),i=n.toFixed(4);return mn(e.map(([e,n],a)=>[`calc(${e} * ${r} + ${t[a][0]} * ${i})`,`calc(${n} * ${r} + ${t[a][1]} * ${i})`]))}const gn=mn(un),_n=mn(fn),vn=mn(pn),yn=e=>`calc(var(--start) + ${e} / 2 + (100% - var(--start) - var(--end) - ${e}) * var(--at) / 100)`,bn=`:host{all:initial;position:fixed;z-index:2147483001;pointer-events:none;filter:drop-shadow(0 8px 24px rgb(0 0 0/25%));color-scheme:dark;font:500 12px/1 ui-sans-serif,system-ui,sans-serif;color:#d4d4d4;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;--vitehub-pill-text:#d4d4d4;--vitehub-pill-strong:#fafafa;--vitehub-pill-muted:#a3a3a3;--vitehub-pill-hover:rgb(255 255 255/8%);--vitehub-pill-on:#fafafa;--vitehub-pill-on-text:#0a0a0a;--vitehub-pill-line:rgb(255 255 255/12%);--vitehub-pill-surface:#111;--vitehub-pill-flow:row;--vitehub-hex-h:24px;--vitehub-hex-w:calc(var(--vitehub-hex-h) * 10 / 9);--vitehub-pill-fade:opacity 160ms ease-out 80ms,visibility 0s;--vitehub-pill-fade-end:opacity 160ms ease-out 120ms,visibility 0s;--at:50;--margin:16px;--safe-top:env(safe-area-inset-top,0px);--safe-right:env(safe-area-inset-right,0px);--safe-bottom:env(safe-area-inset-bottom,0px);--safe-left:env(safe-area-inset-left,0px)}
9
9
  :host([collapsed]){--margin:2px;--vitehub-pill-fade:opacity 80ms ease-out,visibility 0s 80ms;--vitehub-pill-fade-end:opacity 40ms ease-out,visibility 0s 40ms}
10
- :host(:is([edge=top],[edge=bottom])){left:${on(`0px`)};--start:max(var(--margin),var(--safe-left));--end:max(var(--margin),var(--safe-right));--x:calc(var(--at) * -1%)}
11
- :host(:is([edge=left],[edge=right])){top:${on(`0px`)};--start:max(var(--margin),var(--safe-top));--end:max(var(--margin),var(--safe-bottom));--y:calc(var(--at) * -1%);--vitehub-pill-flow:column;--vitehub-pill-justify:flex-start}
10
+ :host(:is([edge=top],[edge=bottom])){left:${yn(`0px`)};width:max-content;--start:max(var(--margin),var(--safe-left));--end:max(var(--margin),var(--safe-right));--x:calc(var(--at) * -1%)}
11
+ :host(:is([edge=left],[edge=right])){top:${yn(`0px`)};--start:max(var(--margin),var(--safe-top));--end:max(var(--margin),var(--safe-bottom));--y:calc(var(--at) * -1%);--vitehub-pill-flow:column;--vitehub-pill-justify:flex-start}
12
12
  :host([edge=bottom]){bottom:max(16px,var(--safe-bottom))}
13
13
  :host([edge=top]){top:max(16px,var(--safe-top))}
14
14
  :host([edge=right]){right:max(16px,var(--safe-right))}
15
15
  :host([edge=left]){left:max(16px,var(--safe-left))}
16
- :host([collapsed]:is([edge=top],[edge=bottom])){left:${on(`var(--vitehub-hex-w)`)};--x:-50%}
17
- :host([collapsed]:is([edge=left],[edge=right])){top:${on(`var(--vitehub-hex-h)`)};--y:-50%}
16
+ :host([collapsed]:is([edge=top],[edge=bottom])){left:${yn(`var(--vitehub-hex-w)`)};--x:-50%}
17
+ :host([collapsed]:is([edge=left],[edge=right])){top:${yn(`var(--vitehub-hex-h)`)};--y:-50%}
18
18
  :host([collapsed][edge=bottom]){bottom:calc(max(2px,var(--safe-bottom)) + var(--vitehub-hex-h) / 2);--y:50%}
19
19
  :host([collapsed][edge=top]){top:calc(max(2px,var(--safe-top)) + var(--vitehub-hex-h) / 2);--y:-50%}
20
20
  :host([collapsed][edge=right]){right:calc(max(2px,var(--safe-right)) + var(--vitehub-hex-w) / 2);--x:50%}
21
21
  :host([collapsed][edge=left]){left:calc(max(2px,var(--safe-left)) + var(--vitehub-hex-w) / 2);--x:-50%}
22
22
  :host{transform:translate(var(--x,0),var(--y,0))}
23
23
  :host([dragging]){transition:none;cursor:grabbing;user-select:none;-webkit-user-select:none}
24
- div{position:relative;box-sizing:border-box;max-width:calc(100vw - 32px);max-height:calc(100dvh - 32px);overflow:auto;scrollbar-width:none;display:flex;flex-direction:var(--vitehub-pill-flow);align-items:center;gap:8px;padding:4px;border:1px solid var(--vitehub-pill-line);border-radius:12px;background:rgb(17 17 17/92%);pointer-events:auto;clip-path:${nn};transition:background-color 150ms ease-out}
24
+ div{position:relative;box-sizing:border-box;max-width:calc(100vw - 32px);max-height:calc(100dvh - 32px);overflow:auto;scrollbar-width:none;display:flex;flex-direction:var(--vitehub-pill-flow);align-items:center;gap:8px;padding:4px;border:1px solid var(--vitehub-pill-line);border-radius:12px;background:rgb(17 17 17/92%);pointer-events:auto;clip-path:${gn};transition:background-color 150ms ease-out}
25
25
  :host(:is([edge=left],[edge=right])) div{display:grid;grid-template-columns:auto 1fr;align-items:stretch;gap:8px 2px}
26
- :host([collapsed]) div{clip-path:${rn}}
27
- @media(hover:hover){:host([collapsed]) div:hover{background:rgb(38 38 38/94%)}}
26
+ :host([collapsed]){filter:drop-shadow(0 0 .5px rgb(255 255 255/70%)) drop-shadow(0 0 .5px rgb(255 255 255/70%)) drop-shadow(0 8px 24px rgb(0 0 0/25%))}
27
+ :host([collapsed]) div{clip-path:${_n};background:rgb(32 32 32/94%)}
28
+ @media(hover:hover){:host([collapsed]) div:hover{background:rgb(52 52 52/94%)}}
28
29
  :host([dragging]) div{transition:none}
29
30
  ::slotted(*){flex-shrink:0;display:flex;flex-direction:var(--vitehub-pill-flow);align-items:center;gap:2px;transition:var(--vitehub-pill-fade)}
30
31
  :host(:is([edge=left],[edge=right])) ::slotted(*){grid-column:1/-1;align-items:stretch}
31
32
  ::slotted([hidden]){display:none!important}
32
33
  :host([collapsed]) ::slotted(*),:host([collapsed]) .exit{opacity:0;visibility:hidden}
34
+ .page-bar{position:absolute;bottom:0;width:0;height:var(--vitehub-page-bar,0px);visibility:hidden;pointer-events:none}
33
35
  .tabs{position:absolute;display:flex;width:max-content;height:max-content;max-width:calc(100vw - max(16px,var(--safe-left)) - max(16px,var(--safe-right)));max-height:calc(100dvh - max(16px,var(--safe-top)) - max(16px,var(--safe-bottom)));gap:4px;overflow:auto;pointer-events:auto}
34
36
  :host([collapsed]) .tabs{visibility:hidden}
35
37
  :host(:is([edge=top],[edge=bottom])) .tabs{left:calc(var(--at) * 1%);translate:calc(var(--at) * -1%) 0;max-height:calc(100dvh - max(16px,var(--safe-top)) - max(16px,var(--safe-bottom)) - 100%)}
@@ -43,7 +45,7 @@ div{position:relative;box-sizing:border-box;max-width:calc(100vw - 32px);max-hei
43
45
  :host([edge=top]) ::slotted([slot=tab]){border-top:0;border-radius:0 0 10px 10px}
44
46
  :host([edge=left]) ::slotted([slot=tab]){border-left:0;border-radius:0 10px 10px 0}
45
47
  :host([edge=right]) ::slotted([slot=tab]){border-right:0;border-radius:10px 0 0 10px}
46
- ${Gt}
48
+ ${Qt}
47
49
  button{flex-shrink:0;padding:0;justify-content:center}
48
50
  .exit{position:sticky;right:0;bottom:0;transition:background-color 150ms,color 150ms,var(--vitehub-pill-fade-end)}
49
51
  :host(:is([edge=left],[edge=right])) .mark{justify-self:start}
@@ -60,18 +62,18 @@ button{flex-shrink:0;padding:0;justify-content:center}
60
62
  :host([fold=mark]){transition:filter 240ms ease-out}
61
63
  :host([fold=mark][collapsed]){filter:drop-shadow(0 1px 2px rgb(0 0 0/25%))}
62
64
  :host([fold=mark]:not([dragging])) div{transition:background-color 120ms ease-out,border-color 120ms ease-out}
63
- :host([fold=mark][collapsed]) div,:host([fold=mark][collapsed]) div:hover{clip-path:${an};background-color:transparent;border-color:transparent}
65
+ :host([fold=mark][collapsed]) div,:host([fold=mark][collapsed]) div:hover{clip-path:${vn};background-color:transparent;border-color:transparent}
64
66
  :host([fold=mark]) .mark{transition:background-color 150ms ease-out,color 150ms ease-out}
65
67
  :host([fold=mark]) .mark svg{transition:none}
66
68
  :host([fold=mark][collapsed]) .mark svg{opacity:1;transform:scale(1.5)}
67
69
  @media(any-pointer:coarse){:host{--vitehub-hex-h:40px}:host([fold=mark][collapsed]) .mark svg{transform:scale(2.5)}}
68
- @media(prefers-reduced-motion:reduce){:host,div,::slotted(*),.exit,.mark svg,:host([fold=mark]) :is(div,.mark){transition:none}}`;function cn(e,t,n){let r=document.createElementNS(`http://www.w3.org/2000/svg`,`svg`);for(let[t,i]of Object.entries({viewBox:e,"aria-hidden":`true`,...n}))r.setAttribute(t,i);let i=document.createElementNS(`http://www.w3.org/2000/svg`,`path`);return i.setAttribute(`d`,t),r.append(i),r}const ln=[`top`,`right`,`bottom`,`left`];function un(e){return ln.some(t=>t===e)}function dn(e){let t=typeof e==`object`&&e?Reflect.get(e,`edge`):void 0,n=typeof e==`object`&&e?Reflect.get(e,`at`):void 0;return un(t)&&typeof n==`number`&&n>=0&&n<=100?{edge:t,at:n}:void 0}function fn(e){try{return dn(JSON.parse(localStorage.getItem(e)??`null`))}catch{return}}function pn(e,t,n,r){let i=Math.min(70,r/4),a=Math.atan2(t-r/2,e-n/2),o=Math.atan2(i-r/2,-n/2),s=Math.atan2(i-r/2,n/2),c=Math.atan2(r/2-i,n/2),l=Math.atan2(r/2-i,-n/2);return a>=o&&a<=s?`top`:a>s&&a<c?`right`:a>=c&&a<=l?`bottom`:`left`}function mn(e,t,n,r,i){let a=i-n-r-t,o=a>0?Math.min(100,Math.max(0,(e-n-t/2)/a*100)):50;return o<2?0:o>98?100:Math.abs(o-50)<3?50:Math.round(o*10)/10}const hn=/* @__PURE__ */ new WeakMap;function gn(e){let t=e?getComputedStyle(e).transform:`none`,n=/^matrix\(([^,]+)/.exec(t)?.[1];return n&&Number.parseFloat(n)||1}function _n(e,t,n,r,i){let a=()=>e.getAttribute(`fold`)===`mark`?$t:Qt,s=()=>n.querySelector(`svg`),l={x:0,y:0},u=1,d=!1,f,p=[],m=()=>{if(!d&&!g.active&&!_.active&&!v.active){k(t,{"clip-path":null}),k(e,{translate:null}),k(n,{translate:null});let r=s();r&&k(r,{scale:null});for(let e of p)e();p=[],i();return}let r=e.hasAttribute(`collapsed`),o=g.value;k(t,{"clip-path":tn(Xt,a(),o)}),k(e,{translate:`${_.value.toFixed(2)}px ${v.value.toFixed(2)}px`});let c=r?l:{x:0,y:0};k(n,{translate:`${(l.x*o-c.x).toFixed(2)}px ${(l.y*o-c.y).toFixed(2)}px`});let f=s();f&&k(f,{scale:((1+(u-1)*o)/(r?u:1)).toFixed(4)})},g=x(0,m,c.snappy),_=x(0,m,c.snappy),v=x(0,m,c.snappy),y=()=>{let e=t.getBoundingClientRect();return{x:e.left+e.width/2-_.value,y:e.top+e.height/2-v.value}},b=()=>{l={x:Number.parseFloat(n.style.getPropertyValue(`--vitehub-mark-x`))||0,y:Number.parseFloat(n.style.getPropertyValue(`--vitehub-mark-y`))||0},e.hasAttribute(`collapsed`)&&(u=gn(s()))};return{get moving(){return d||g.active||_.active||v.active},move(t,n=0){r();let i=new Promise(e=>p.push(e)),a=y(),s=e.hasAttribute(`collapsed`);b(),t(),b();let l=y(),u=e.hasAttribute(`collapsed`);clearTimeout(f),d=!0;for(let[e,t]of[[_,a.x-l.x+_.value],[v,a.y-l.y+v.value]]){let n=e.velocity;e.set(t),n&&e.to(t,{velocity:n})}g.active||g.set(+!!s);let m=()=>{d=!1,_.to(0,{preset:c.snappy}),v.to(0,{preset:c.snappy}),g.to(+!!u,{preset:c.snappy})};return n>0&&!o()?f=setTimeout(m,n*h()):m(),i}}}function vn(e){let{signal:t}=e,n=document.createElement(e.name);n.style.viewTransitionName=e.name,e.fold===`mark`&&n.setAttribute(`fold`,`mark`);let r=n.attachShadow({mode:`open`}),i=document.createElement(`style`);i.textContent=sn;let a=document.createElement(`div`);a.setAttribute(`role`,`toolbar`),a.setAttribute(`aria-label`,e.label);let o=document.createElement(`button`);o.className=`mark`,o.append(e.mark);let s=e.initial?.collapsed===!0,l=t=>{t&&a.scrollTo(0,0),n.toggleAttribute(`collapsed`,t),t&&e.fold!==`mark`?o.dataset.motionPressTarget=`[role=toolbar]`:delete o.dataset.motionPressTarget,o.setAttribute(`aria-expanded`,String(!t)),o.setAttribute(`aria-label`,`${t?`Show`:`Hide`} ${e.label}`),o.title=`${o.getAttribute(`aria-label`)}. Drag to move.`},u=()=>e.markOnly?.active()===!0,d=e.markOnly?.opened===!0,f=()=>u()?!d:xn(e.storage.collapsed)??s;l(f()),o.addEventListener(`click`,()=>{if(b())return;let t=!n.hasAttribute(`collapsed`);if(E.move(()=>{l(t),y(g)},t?40:0),u())d=!t;else try{t===s?localStorage.removeItem(e.storage.collapsed):localStorage.setItem(e.storage.collapsed,t?`1`:`0`)}catch{}});let p=e.exit,m;p&&(m=document.createElement(`button`),m.className=`exit`,m.setAttribute(`aria-label`,p.label),m.title=p.label,m.append(cn(`0 0 24 24`,`M18 6 6 18M6 6l12 12`,{width:`15`,height:`15`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`})),p.menu||m.addEventListener(`click`,e=>p.press(e.detail===0))),a.append(o,...m?[m]:[]);let h=document.createElement(`slot`);h.name=`tab`,h.className=`tabs`,r.append(i,h,a),m&&p?.menu&&r.append(...p.menu(m));for(let t of e.slots){let e=document.createElement(`slot`);e.name=t,a.insertBefore(e,m??null)}let g=fn(e.storage.dock)??e.initial?.dock??{edge:`bottom`,at:50},_=g,v=()=>g.edge===`left`||g.edge===`right`,y=t=>{g=t,_=u()&&!n.hasAttribute(`dragging`)&&t.edge===`bottom`?{edge:`bottom`,at:t.at<50?0:100}:t,n.setAttribute(`edge`,_.edge),n.style.setProperty(`--at`,String(_.at));let r=n.hasAttribute(`collapsed`),i=r?v()?X(n).width:X(n).height:v()?a.offsetWidth:a.offsetHeight;e.onPlace?.({..._,collapsed:r,thickness:i}),o.style.setProperty(`--vitehub-mark-x`,`${a.clientWidth/2-o.offsetLeft-o.offsetWidth/2}px`),o.style.setProperty(`--vitehub-mark-y`,`${a.clientHeight/2-o.offsetTop-o.offsetHeight/2}px`)},b=bn({host:n,handle:o,dock:()=>g,shape:e=>{let t=n.hasAttribute(`collapsed`),r=t?e?n.offsetHeight:n.offsetWidth:e?a.offsetHeight:a.offsetWidth;return{size:r,lead:t?r/2:e?o.offsetTop+o.offsetHeight/2:o.offsetLeft+o.offsetWidth/2,part:t?e?X(n).height:X(n).width:r,margin:t?2:16}},place:y,drop:()=>{E.move(()=>y(g));try{localStorage.setItem(e.storage.dock,JSON.stringify({edge:g.edge,at:g.at}))}catch{}},signal:t}),S=Bt(a,{items:()=>[o,...[...n.children].filter(e=>e instanceof HTMLElement&&e.slot!==`tab`),...m?[m]:[]],movesOnly:!0}),C={width:0,height:0},w={top:0,right:0,bottom:0,left:0},T=x(0,(e,t)=>{k(a,{"clip-path":t===0&&e===0?null:`inset(${[w.top,w.right,w.bottom,w.left].map(t=>`${(t*e).toFixed(2)}px`).join(` `)} round 12px)`})},c.snappy),E=_n(n,a,o,()=>T.stop(),()=>S.measure());hn.set(n,E);let D=[I(n,Y),I(r,Y)];if(t.aborted){for(let e of D)e();return n}let ee=new ResizeObserver(()=>{let e=C;if(C={width:a.offsetWidth,height:a.offsetHeight},y(g),n.hasAttribute(`collapsed`)||n.hasAttribute(`dragging`)||E.moving)return;if(!e.width)return S.measure();S.play(),S.measure();let t={x:C.width-e.width,y:C.height-e.height},r={x:v()?_.edge===`right`?t.x:0:t.x*_.at/100,y:v()?t.y*_.at/100:_.edge===`bottom`?t.y:0};w={top:Math.max(0,r.y),right:Math.max(0,t.x-r.x),bottom:Math.max(0,t.y-r.y),left:Math.max(0,r.x)},(w.top||w.right||w.bottom||w.left)&&(T.set(1),T.to(0,{preset:c.snappy}))});return t.addEventListener(`abort`,()=>{n.remove(),ee.disconnect(),T.stop(),S.destroy();for(let e of D)e()},{once:!0}),(e.parent??document.documentElement).append(n),y(g),t.aborted||(ee.observe(a),e.markOnly?.watch(()=>{d=!1;let e=n.contains(document.activeElement),t=f();E.move(()=>{l(t),y(g)},t&&!n.hasAttribute(`collapsed`)?40:0),e&&n.hasAttribute(`collapsed`)&&o.focus({preventScroll:!0})},t)),n}async function yn(e){if(e.inert=!0,e.hasAttribute(`collapsed`)||matchMedia(`(prefers-reduced-motion: reduce)`).matches)return;let t=e.shadowRoot?.querySelector(`div`),n=hn.get(e);if(!t?.offsetWidth||!n){e.setAttribute(`collapsed`,``);return}Object.assign(t.style,{width:`${t.offsetWidth}px`,height:`${t.offsetHeight}px`});let r=n.move(()=>e.setAttribute(`collapsed`,``),40);await Promise.race([r,new Promise(e=>setTimeout(e,600*h()))])}function bn(e){let{host:t,handle:n}=e,r,i=!1;return n.style.touchAction=`none`,n.addEventListener(`pointerdown`,a=>{if(a.button!==0||r!==void 0)return;r=a.pointerId,i=!1;let o=n.getBoundingClientRect(),s={x:a.clientX-o.left-o.width/2,y:a.clientY-o.top-o.height/2};n.setPointerCapture(a.pointerId);let c=n=>{if(n.pointerId!==a.pointerId||!i&&Math.hypot(n.clientX-a.clientX,n.clientY-a.clientY)<4)return;i=!0,t.setAttribute(`dragging`,``);let r=document.documentElement.clientWidth,o=document.documentElement.clientHeight,c=n.clientX-s.x,l=n.clientY-s.y,u=pn(c,l,r,o);u!==e.dock().edge&&e.place({edge:u,at:e.dock().at});let d=u===`left`||u===`right`,{size:f,lead:p,part:m,margin:h}=e.shape(d),g=(d?l:c)-p+f/2,_=getComputedStyle(t),v=Math.max(h,Number.parseFloat(_.getPropertyValue(d?`--safe-top`:`--safe-left`))||0),y=Math.max(h,Number.parseFloat(_.getPropertyValue(d?`--safe-bottom`:`--safe-right`))||0);e.place({edge:u,at:mn(g,m,v,y,d?o:r)})};n.addEventListener(`pointermove`,c);let l=o=>{o.pointerId===a.pointerId&&(n.removeEventListener(`pointermove`,c),n.removeEventListener(`lostpointercapture`,l),r=void 0,i&&(t.removeAttribute(`dragging`),e.drop(),setTimeout(()=>{i=!1})))};n.addEventListener(`lostpointercapture`,l)},{signal:e.signal}),()=>i}function X(e){let t=Number.parseFloat(getComputedStyle(e).getPropertyValue(`--vitehub-hex-h`))||24;return{width:t*10/9,height:t}}function xn(e){try{let t=localStorage.getItem(e);return t===`1`||t!==`0`&&void 0}catch{return}}const Sn=`[role=menu]{position:fixed;inset:auto;box-sizing:border-box;width:max-content;min-width:220px;max-width:min(300px,calc(100vw - 16px));margin:0;padding:6px;overflow:visible;border:1px solid var(--vitehub-pill-line);border-radius:12px;background:#171717;color:var(--vitehub-pill-text);font:500 13px/1.3 ui-sans-serif,system-ui,sans-serif;box-shadow:0 16px 40px rgb(0 0 0/30%);color-scheme:dark;pointer-events:auto}
70
+ @media(prefers-reduced-motion:reduce){:host,div,::slotted(*),.exit,.mark svg,:host([fold=mark]) :is(div,.mark){transition:none}}`;function xn(e,t,n){let r=document.createElementNS(`http://www.w3.org/2000/svg`,`svg`);for(let[t,i]of Object.entries({viewBox:e,"aria-hidden":`true`,...n}))r.setAttribute(t,i);let i=document.createElementNS(`http://www.w3.org/2000/svg`,`path`);return i.setAttribute(`d`,t),r.append(i),r}const Sn=[`top`,`right`,`bottom`,`left`];function Cn(e){return Sn.some(t=>t===e)}function wn(e){let t=typeof e==`object`&&e?Reflect.get(e,`edge`):void 0,n=typeof e==`object`&&e?Reflect.get(e,`at`):void 0;return Cn(t)&&typeof n==`number`&&n>=0&&n<=100?{edge:t,at:n}:void 0}function Tn(e){try{return wn(JSON.parse(localStorage.getItem(e)??`null`))}catch{return}}function En(e,t,n,r){let i=Math.min(70,r/4),a=Math.atan2(t-r/2,e-n/2),o=Math.atan2(i-r/2,-n/2),s=Math.atan2(i-r/2,n/2),c=Math.atan2(r/2-i,n/2),l=Math.atan2(r/2-i,-n/2);return a>=o&&a<=s?`top`:a>s&&a<c?`right`:a>=c&&a<=l?`bottom`:`left`}function Dn(e,t,n,r,i){let a=i-n-r-t,o=a>0?Math.min(100,Math.max(0,(e-n-t/2)/a*100)):50;return o<2?0:o>98?100:Math.abs(o-50)<3?50:Math.round(o*10)/10}function On(e,t,n,r={top:0,right:0,bottom:0,left:0},i=0){let a=e.width-Math.max(16,r.left)-Math.max(16,r.right),o=e.width>640?Math.max(12,r.top)+40:r.top,s=t=>e.height-o-Math.max(Math.max(16,r.bottom)+t,i)-8;return a-t.width-8>=300?{fit:`beside`,width:a-t.width-8,height:s(n?54:38)}:s(t.height)>=240?{fit:`above`,width:a,height:s(t.height)}:{fit:`fold`,width:a,height:s(n?54:38)}}const kn=/* @__PURE__ */ new WeakMap;function An(e){let t=e?getComputedStyle(e).transform:`none`,n=/^matrix\(([^,]+)/.exec(t)?.[1];return n&&Number.parseFloat(n)||1}function jn(e,t,n,r,i){let a=()=>e.getAttribute(`fold`)===`mark`?pn:fn,s=()=>n.querySelector(`svg`),l={x:0,y:0},u=1,d=!1,f,p=[],m=()=>{if(!d&&!g.active&&!_.active&&!v.active){N(t,{"clip-path":null}),N(e,{translate:null}),N(n,{translate:null});let r=s();r&&N(r,{scale:null});for(let e of p)e();p=[],i();return}let r=e.hasAttribute(`collapsed`),o=g.value;N(t,{"clip-path":hn(un,a(),o)}),N(e,{translate:`${_.value.toFixed(2)}px ${v.value.toFixed(2)}px`});let c=r?l:{x:0,y:0};N(n,{translate:`${(l.x*o-c.x).toFixed(2)}px ${(l.y*o-c.y).toFixed(2)}px`});let f=s();f&&N(f,{scale:((1+(u-1)*o)/(r?u:1)).toFixed(4)})},g=x(0,m,c.snappy),_=x(0,m,c.snappy),v=x(0,m,c.snappy),y=()=>{let e=t.getBoundingClientRect();return{x:e.left+e.width/2-_.value,y:e.top+e.height/2-v.value}},b=()=>{l={x:Number.parseFloat(n.style.getPropertyValue(`--vitehub-mark-x`))||0,y:Number.parseFloat(n.style.getPropertyValue(`--vitehub-mark-y`))||0},e.hasAttribute(`collapsed`)&&(u=An(s()))};return{get moving(){return d||g.active||_.active||v.active},move(t,n=0){r();let i=new Promise(e=>p.push(e)),a=y(),s=e.hasAttribute(`collapsed`);b(),t(),b();let l=y(),u=e.hasAttribute(`collapsed`);clearTimeout(f),d=!0;for(let[e,t]of[[_,a.x-l.x+_.value],[v,a.y-l.y+v.value]]){let n=e.velocity;e.set(t),n&&e.to(t,{velocity:n})}g.active||g.set(+!!s);let m=()=>{d=!1,_.to(0,{preset:c.snappy}),v.to(0,{preset:c.snappy}),g.to(+!!u,{preset:c.snappy})};return n>0&&!o()?f=setTimeout(m,n*h()):m(),i}}}function Mn(e){let{signal:t}=e,n=document.createElement(e.name);n.style.viewTransitionName=e.name,e.fold===`mark`&&n.setAttribute(`fold`,`mark`);let r=n.attachShadow({mode:`open`}),i=document.createElement(`style`);i.textContent=bn;let a=document.createElement(`div`);a.setAttribute(`role`,`toolbar`),a.setAttribute(`aria-label`,e.label);let o=document.createElement(`button`);o.className=`mark`,o.dataset.motionPress=``,o.append(e.mark);let s=e.initial?.collapsed===!0,l=t=>{t&&a.scrollTo(0,0),n.toggleAttribute(`collapsed`,t),t&&e.fold!==`mark`?o.dataset.motionPressTarget=`[role=toolbar]`:delete o.dataset.motionPressTarget,o.setAttribute(`aria-expanded`,String(!t)),o.setAttribute(`aria-label`,`${t?`Show`:`Hide`} ${e.label}`),o.title=`${o.getAttribute(`aria-label`)}. Drag to move.`},u=()=>e.markOnly?.active()===!0,d=e.markOnly?.opened===!0,f=()=>u()?!d:Fn(e.storage.collapsed)??s;l(f());let p=e=>{let t=y,r=e&&n.contains(document.activeElement);b=void 0,e&&t.edge!==`bottom`&&S(v)&&(b=t),F.move(()=>{l(e),k(v)},e&&!n.hasAttribute(`collapsed`)?40:0).then(()=>{b&&(b=void 0,n.hasAttribute(`collapsed`)&&k(v))}),r&&o.focus({preventScroll:!0})};o.addEventListener(`click`,()=>{if(te())return;let t=!n.hasAttribute(`collapsed`);if(E=!1,p(t),!t&&ee()&&e.windows?.hide(),u())d=!t;else try{t===s?localStorage.removeItem(e.storage.collapsed):localStorage.setItem(e.storage.collapsed,t?`1`:`0`)}catch{}});let m=e.exit,h;m&&(h=document.createElement(`button`),h.className=`exit`,h.dataset.motionPress=``,h.setAttribute(`aria-label`,m.label),h.title=m.label,h.append(xn(`0 0 24 24`,`M18 6 6 18M6 6l12 12`,{width:`15`,height:`15`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`})),m.menu||h.addEventListener(`click`,e=>m.press(e.detail===0))),a.append(o,...h?[h]:[]);let g=document.createElement(`slot`);g.name=`tab`,g.className=`tabs`;let _=document.createElement(`span`);_.className=`page-bar`,r.append(i,g,a,_),h&&m?.menu&&r.append(...m.menu(h));for(let t of e.slots){let e=document.createElement(`slot`);e.name=t,a.insertBefore(e,h??null)}let v=Tn(e.storage.dock)??e.initial?.dock??{edge:`bottom`,at:50},y=v,b,S=e=>u()&&!n.hasAttribute(`dragging`)&&e.edge===`bottom`?{edge:`bottom`,at:e.at<50?0:100}:void 0,C=()=>y.edge===`left`||y.edge===`right`,w=matchMedia(`(any-pointer: coarse)`),T={width:0,height:0},E=!1,D=()=>{let e=getComputedStyle(n),t=t=>Number.parseFloat(e.getPropertyValue(`--safe-${t}`))||0,r=Number.parseFloat(getComputedStyle(_).height)||0;return On({width:innerWidth,height:innerHeight},T,w.matches,{top:t(`top`),right:t(`right`),bottom:t(`bottom`),left:t(`left`)},r)},ee=()=>e.windows?.shown()===!0&&S(v)!==void 0&&D().fit===`fold`,O=()=>{let e=!f()&&ee();e===E||n.hasAttribute(`dragging`)||(E=e,p(f()||E))},k=t=>{v=t;let r=n.hasAttribute(`collapsed`),i=S(t);y=i?r?b??i:{edge:i.at===0?`left`:`right`,at:100}:t,n.setAttribute(`edge`,y.edge),a.setAttribute(`aria-orientation`,y.edge===`left`||y.edge===`right`?`vertical`:`horizontal`),n.style.setProperty(`--at`,String(y.at));let s=Z(n),c=r?C()?s.width:s.height:C()?a.offsetWidth:a.offsetHeight;i&&!r&&(T={width:a.offsetWidth,height:a.offsetHeight});let l=i&&!r&&D().fit===`beside`?{beside:T.width+8}:{thickness:a.offsetHeight};e.onPlace?.(i?{...i,collapsed:!1,...l}:{...y,collapsed:r,thickness:c}),o.style.setProperty(`--vitehub-mark-x`,`${a.clientWidth/2-o.offsetLeft-o.offsetWidth/2}px`),o.style.setProperty(`--vitehub-mark-y`,`${a.clientHeight/2-o.offsetTop-o.offsetHeight/2}px`)},te=Pn({host:n,handle:o,dock:()=>v,shape:e=>{let t=n.hasAttribute(`collapsed`),r=t?e?n.offsetHeight:n.offsetWidth:e?a.offsetHeight:a.offsetWidth;return{size:r,lead:t?r/2:e?o.offsetTop+o.offsetHeight/2:o.offsetLeft+o.offsetWidth/2,part:t?e?Z(n).height:Z(n).width:r,margin:t?2:16}},place:k,drop:()=>{F.move(()=>k(v)).then(O);try{localStorage.setItem(e.storage.dock,JSON.stringify({edge:v.edge,at:v.at}))}catch{}},signal:t}),A=Jt(a,{items:()=>[o,...[...n.children].filter(e=>e instanceof HTMLElement&&e.slot!==`tab`),...h?[h]:[]],movesOnly:!0}),j={width:0,height:0},M={top:0,right:0,bottom:0,left:0},P=x(0,(e,t)=>{N(a,{"clip-path":t===0&&e===0?null:`inset(${[M.top,M.right,M.bottom,M.left].map(t=>`${(t*e).toFixed(2)}px`).join(` `)} round 12px)`})},c.snappy),F=jn(n,a,o,()=>P.stop(),()=>A.measure());kn.set(n,F);let I=[z(n,X),z(r,X)];if(t.aborted){for(let e of I)e();return n}let L=new ResizeObserver(e=>{if(k(v),O(),!e.some(e=>e.target===a))return;let t=j;if(j={width:a.offsetWidth,height:a.offsetHeight},n.hasAttribute(`collapsed`)||n.hasAttribute(`dragging`)||F.moving)return;if(!t.width)return A.measure();A.play(),A.measure();let r={x:j.width-t.width,y:j.height-t.height},i={x:C()?y.edge===`right`?r.x:0:r.x*y.at/100,y:C()?r.y*y.at/100:y.edge===`bottom`?r.y:0};M={top:Math.max(0,i.y),right:Math.max(0,r.x-i.x),bottom:Math.max(0,r.y-i.y),left:Math.max(0,i.x)},(M.top||M.right||M.bottom||M.left)&&(P.set(1),P.to(0,{preset:c.snappy}))});return t.addEventListener(`abort`,()=>{n.remove(),L.disconnect(),P.stop(),A.destroy();for(let e of I)e()},{once:!0}),(e.parent??document.documentElement).append(n),an(n,t),k(v),t.aborted||(L.observe(a),L.observe(_),addEventListener(`resize`,()=>{k(v),O()},{signal:t}),e.windows?.watch(O,t),e.markOnly?.watch(()=>{d=!1,E=!1,p(f())},t)),n}async function Nn(e){if(e.inert=!0,e.hasAttribute(`collapsed`)||matchMedia(`(prefers-reduced-motion: reduce)`).matches)return;let t=e.shadowRoot?.querySelector(`div`),n=kn.get(e);if(!t?.offsetWidth||!n){e.setAttribute(`collapsed`,``);return}Object.assign(t.style,{width:`${t.offsetWidth}px`,height:`${t.offsetHeight}px`});let r=n.move(()=>e.setAttribute(`collapsed`,``),40);await Promise.race([r,new Promise(e=>setTimeout(e,600*h()))])}function Pn(e){let{host:t,handle:n}=e,r,i=!1;return n.style.touchAction=`none`,n.addEventListener(`pointerdown`,a=>{if(a.button!==0||r!==void 0)return;r=a.pointerId,i=!1;let o=n.getBoundingClientRect(),s={x:a.clientX-o.left-o.width/2,y:a.clientY-o.top-o.height/2};n.setPointerCapture(a.pointerId);let c=n=>{if(n.pointerId!==a.pointerId||!i&&Math.hypot(n.clientX-a.clientX,n.clientY-a.clientY)<4)return;i=!0,t.setAttribute(`dragging`,``);let r=document.documentElement.clientWidth,o=document.documentElement.clientHeight,c=n.clientX-s.x,l=n.clientY-s.y,u=En(c,l,r,o);u!==t.getAttribute(`edge`)&&e.place({edge:u,at:e.dock().at});let d=u===`left`||u===`right`,{size:f,lead:p,part:m,margin:h}=e.shape(d),g=(d?l:c)-p+f/2,_=getComputedStyle(t),v=Math.max(h,Number.parseFloat(_.getPropertyValue(d?`--safe-top`:`--safe-left`))||0),y=Math.max(h,Number.parseFloat(_.getPropertyValue(d?`--safe-bottom`:`--safe-right`))||0);e.place({edge:u,at:Dn(g,m,v,y,d?o:r)})};n.addEventListener(`pointermove`,c);let l=o=>{o.pointerId===a.pointerId&&(n.removeEventListener(`pointermove`,c),n.removeEventListener(`lostpointercapture`,l),r=void 0,i&&(t.removeAttribute(`dragging`),e.drop(),setTimeout(()=>{i=!1})))};n.addEventListener(`lostpointercapture`,l)},{signal:e.signal}),()=>i}function Z(e){let t=Number.parseFloat(getComputedStyle(e).getPropertyValue(`--vitehub-hex-h`))||24;return{width:t*10/9,height:t}}function Fn(e){try{let t=localStorage.getItem(e);return t===`1`||t!==`0`&&void 0}catch{return}}const In=`[role=menu]{position:fixed;inset:auto;box-sizing:border-box;width:max-content;min-width:220px;max-width:min(300px,calc(100vw - 16px));margin:0;padding:6px;overflow:visible;border:1px solid var(--vitehub-pill-line);border-radius:12px;background:#171717;color:var(--vitehub-pill-text);font:500 13px/1.3 ui-sans-serif,system-ui,sans-serif;box-shadow:0 16px 40px rgb(0 0 0/30%);color-scheme:dark;pointer-events:auto}
69
71
  [role=menuitem]{display:flex;width:100%;height:32px;justify-content:flex-start;gap:8px;font-size:13px}
70
72
  [role=menuitem] svg{width:15px;height:15px;color:var(--vitehub-pill-muted)}
71
73
  [role=menuitem][hidden]{display:none}
72
74
  [role=menuitem][aria-disabled=true]{cursor:progress}
73
- @media(any-pointer:coarse){[role=menuitem]{height:44px}}`,Cn=`${Gt}
74
- ${Sn}
75
+ @media(any-pointer:coarse){[role=menuitem]{height:44px}}`,Ln=`${Qt}
76
+ ${In}
75
77
  .who{align-self:flex-start;padding:0 3px}
76
78
  .avatar{box-sizing:border-box;display:grid;place-items:center;width:22px;height:22px;flex:none;overflow:hidden;border-radius:50%;background:#404040;color:var(--vitehub-pill-strong);font-size:10px;font-weight:600;line-height:1}
77
79
  .avatar img{display:block;width:100%;height:100%;object-fit:cover}
@@ -83,12 +85,12 @@ ${Sn}
83
85
  .me small{margin-top:2px;color:var(--vitehub-pill-muted);font-size:12px}
84
86
  .via{display:flex;align-items:center;gap:6px;padding:6px 8px;color:var(--vitehub-pill-muted);font-size:12px}
85
87
  .via svg{width:11px;height:10px;flex:none;fill:var(--vitehub-pill-text)}
86
- `,wn=`<svg viewBox="0 0 24 24" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m16 17 5-5-5-5M21 12H9M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"/></svg>`;function Tn(e){return e.trim().split(/\s+/).slice(0,2).map(e=>[...e][0]??``).join(``).toLocaleUpperCase()}function En(e){let t=document.createElement(`span`);if(t.className=`avatar`,t.setAttribute(`aria-hidden`,`true`),t.textContent=Tn(e.name),e.image){let n=document.createElement(`img`);n.alt=``,n.referrerPolicy=`no-referrer`,n.src=e.image,n.addEventListener(`load`,()=>t.replaceChildren(n),{once:!0})}return t}function Dn(e,t){let n=document.createElement(`button`);n.type=`button`,n.setAttribute(`role`,`menuitem`),n.tabIndex=-1,n.insertAdjacentHTML(`beforeend`,e);let r=document.createElement(`span`);return r.textContent=t,n.append(r),{item:n,label:r}}function On(){let e=new URL(location.href);for(let t of[Vt,...Ht])e.searchParams.delete(t);return e}function kn(e){let{account:t,bar:n,signal:r}=e,i=n.parentElement,a=n.attachShadow({mode:`open`});r.addEventListener(`abort`,I(a,Y),{once:!0});let o=document.createElement(`style`);o.textContent=Cn;let s=document.createElement(`div`);s.id=`account-menu`,s.setAttribute(`popover`,`auto`),s.setAttribute(`role`,`menu`),s.setAttribute(`aria-label`,t.name);let c=document.createElement(`button`);c.type=`button`,c.className=`who`,c.title=t.email?`${t.name} (${t.email})`:t.name,c.setAttribute(`aria-label`,`Account: ${t.name}`),c.setAttribute(`aria-haspopup`,`menu`),c.setAttribute(`aria-expanded`,`false`),c.setAttribute(`aria-controls`,s.id),c.setAttribute(`popovertarget`,s.id),c.append(En(t));let l=document.createElement(`div`);l.className=`me`,l.setAttribute(`role`,`none`);let u=document.createElement(`div`),d=document.createElement(`b`);if(d.textContent=t.name,u.append(d),t.email){let e=document.createElement(`small`);e.textContent=t.email,u.append(e)}if(l.append(En(t),u),s.append(l),t.via===`console`){let t=document.createElement(`div`);t.className=`via`,t.setAttribute(`role`,`none`),t.append(cn(`0 0 20 18`,e.mark,{}),`Signed in with ViteHub Console`),s.append(t)}let f=Dn(`<svg viewBox="0 0 24 24" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M7 7h10v10M7 17 17 7"/></svg>`,`Open in the Console`),p=Dn(wn,`Sign out of ${location.host}`);s.append(f.item,p.item),a.append(o,c,s);let m;jn({menu:s,button:c,pill:i,beforeOpen:()=>{m=e.openConsole?.(),f.item.hidden=!m},signal:r}),f.item.addEventListener(`click`,()=>{s.hidePopover(),m?.()},{signal:r}),Mn(t,p,r)}function An(e){let{account:t,button:n,turnOff:r,canExit:i,signal:a}=e,o=document.createElement(`style`);o.textContent=Sn;let s=document.createElement(`vitehub-menu`);s.id=`exit-menu`,s.setAttribute(`popover`,`auto`),s.setAttribute(`role`,`menu`),s.setAttribute(`aria-label`,`Turn off tools or sign out`);let c=Dn(`<svg viewBox="0 0 24 24" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49M14.084 14.158a3 3 0 0 1-4.242-4.242M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143M2 2l20 20"/></svg>`,r.label),l=Dn(wn,`Sign out of ${location.host}`);s.append(c.item,l.item);let u=`Turn off tools or sign out`;n.setAttribute(`aria-label`,u),n.title=u,n.setAttribute(`aria-haspopup`,`menu`),n.setAttribute(`aria-expanded`,`false`),n.setAttribute(`aria-controls`,s.id),n.setAttribute(`popovertarget`,s.id);let d=n.getRootNode();return jn({menu:s,button:n,pill:d instanceof ShadowRoot&&d.host instanceof HTMLElement?d.host:null,signal:a}),c.item.addEventListener(`click`,e=>{s.hidePopover(),r.press(e.detail===0)},{signal:a}),Mn(t,l,a,i),[o,s]}function jn(e){let{menu:t,button:n,pill:r,signal:i}=e,a=()=>{let e=t.getRootNode();return e instanceof ShadowRoot||e instanceof Document?e.activeElement:null},o=()=>[...t.querySelectorAll(`[role=menuitem]`)].filter(e=>!e.hidden),s=e=>{let i=document.documentElement.clientWidth,a=document.documentElement.clientHeight,o=(r??n).getBoundingClientRect(),s=n.getBoundingClientRect(),c={top:`auto`,right:`auto`,bottom:`auto`,left:`auto`};e===`bottom`||e===`top`?(c.right=`${Math.max(8,i-s.right)}px`,e===`bottom`?c.bottom=`${a-o.top+8}px`:c.top=`${o.bottom+8}px`):(s.top<a/2?c.top=`${Math.max(8,s.top)}px`:c.bottom=`${Math.max(8,a-s.bottom)}px`,e===`left`?c.left=`${o.right+8}px`:c.right=`${i-o.left+8}px`),Object.assign(t.style,c)},c=e=>{if(e!==`bottom`&&e!==`top`)return;let r=document.documentElement.clientWidth,i=n.getBoundingClientRect(),a=t.getBoundingClientRect().width;t.style.right=`auto`,t.style.left=`${Math.max(8,Math.min(i.right-a,r-a-8))}px`};if(t.addEventListener(`beforetoggle`,i=>{if(i.newState===`closed`){t.contains(a())&&n.focus({preventScroll:!0});return}e.beforeOpen?.();let o=r?.getAttribute(`edge`)??`bottom`;s(o),requestAnimationFrame(()=>c(o))},{signal:i}),t.addEventListener(`toggle`,e=>{let t=e.newState===`open`;n.setAttribute(`aria-expanded`,String(t)),t&&o()[0]?.focus({preventScroll:!0})},{signal:i}),t.addEventListener(`keydown`,e=>{let n=o(),r=n.findIndex(e=>e===a()),i=e.key===`ArrowDown`?r+1:e.key===`ArrowUp`?r-1:e.key===`Home`?0:e.key===`End`?n.length-1:void 0;i===void 0?e.key===`Escape`?e.stopPropagation():e.key===`Tab`&&t.hidePopover():(e.preventDefault(),n[(i+n.length)%n.length]?.focus())},{signal:i}),r){let e=new MutationObserver(e=>{e.some(e=>e.oldValue!==r.getAttribute(e.attributeName??``))&&t.hidePopover()});e.observe(r,{attributes:!0,attributeOldValue:!0,attributeFilter:[`collapsed`,`dragging`,`edge`]}),i.addEventListener(`abort`,()=>e.disconnect(),{once:!0})}i.addEventListener(`abort`,()=>t.hidePopover(),{once:!0})}function Mn(e,t,n,r){t.item.addEventListener(`click`,async()=>{if(t.item.getAttribute(`aria-disabled`)===`true`||r?.()===!1)return;t.item.setAttribute(`aria-disabled`,`true`),t.label.textContent=`Signing out…`;let n=await fetch(e.signOut,{method:`POST`,credentials:`same-origin`,headers:{"content-type":`application/json`},body:`{}`}).catch(e=>e);if(!(n instanceof Response)||!n.ok){console.error(`[vitehub] The sign-out failed. The session stays.`,n instanceof Response?`The sign-out answered ${n.status}.`:n),t.item.removeAttribute(`aria-disabled`),t.label.textContent=`Could not sign out. Try again`;return}let i=On();i.href===location.href?location.reload():location.replace(i)},{signal:n})}function Nn(e,...t){return typeof e==`function`?e(...t):e}const Pn=Error.captureStackTrace;var Fn=class e extends Error{get why(){return this.message}constructor(t,n=e){super(t.why,{cause:t.cause}),this.code=this.name=t.code,this.docs=t.docs,this.fix=t.fix,this.sources=t.sources,this.data=t.data,Pn?.(this,n)}toJSON(){return{name:this.name,why:this.why,fix:this.fix,docs:this.docs,sources:this.sources,cause:this.cause,data:this.data,stack:this.stack}}};function In(e,t){return typeof e==`string`?`${e}/${t.toLowerCase()}`:e?.(t)}const Ln=e=>t=>t instanceof Fn&&e in t;/* @__NO_SIDE_EFFECTS__ */
87
- function Rn(e){let t=e.reporters??[],n=Symbol(),r=Object.defineProperty({},"is",{value:Ln(n)}),{docsBase:i}=e;for(let a of Object.keys(e.codes)){let o=e.codes[a],s=o.docs===!1?void 0:o.docs||In(i,a),c=(e={},r={})=>{let i=new Fn({code:a,why:Nn(o.why,e),fix:Nn(o.fix,e),docs:s,cause:e.cause,sources:e.sources,data:Nn(o.data,e)},c);i[n]=1;for(let e of t)e(i,r);return i};c.is=e=>r.is(e)&&e.code===a,r[a]=c}return r}const zn=/*#__PURE__*/ Rn({docsBase:`https://vitehub.dev/docs/development/diagnostics`,codes:{INTERNAL_INVARIANT_FAILED:{why:({what:e})=>`ViteHub reached a state that it does not expect: ${e}`,fix:`This is a ViteHub bug. Open an issue at https://github.com/vite-hub/vitehub/issues with this error message and its stack trace.`}}});function Bn(e){return zn.INTERNAL_INVARIANT_FAILED({what:e})}function Vn(e,t){if(!e)throw Bn(t)}let Z={edge:`bottom`,at:50};const Hn=/* @__PURE__ */ new Set;let Un=0;function Wn(e){e.setAttribute(`edge`,Z.edge),e.toggleAttribute(`collapsed`,!!Z.collapsed),e.style.setProperty(`--at`,String(Z.at)),Z.thickness?e.style.setProperty(`--thickness`,`${Z.thickness}px`):e.style.removeProperty(`--thickness`);for(let t of[`top`,`right`,`bottom`,`left`])e.shadowRoot.querySelector(`.grip.${t}`).hidden=Gn(t)===0}function Gn(e){return(e===`top`||e===`bottom`)==(Z.edge===`top`||Z.edge===`bottom`)?1:e===`top`||e===`left`?Z.at/100:1-Z.at/100}function Kn(e){Z=e;for(let e of Hn)Wn(e)}function qn(e){let t=document.createElementNS(`http://www.w3.org/2000/svg`,`svg`);for(let[e,n]of Object.entries({width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.75`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`}))t.setAttribute(e,n);let n=document.createElementNS(`http://www.w3.org/2000/svg`,`path`);return n.setAttribute(`d`,e),t.append(n),t}function Jn(e){let t=document.createElement(`vitehub-window`);t.hidden=!0;let n=t.attachShadow({mode:`open`}),r=document.createElement(`style`);r.textContent=`
88
- :host{all:initial;--surface:light-dark(#fff,#0a0a0a);--text:light-dark(#18181b,#fafafa);--muted:light-dark(#71717a,#a1a1aa);--line:light-dark(rgb(0 0 0/8%),rgb(255 255 255/9%));--hover:light-dark(rgb(0 0 0/5%),rgb(255 255 255/7%));--focus:light-dark(#18181b,#fafafa);--safe-top:env(safe-area-inset-top,0px);--safe-right:env(safe-area-inset-right,0px);--safe-bottom:env(safe-area-inset-bottom,0px);--safe-left:env(safe-area-inset-left,0px);--at:50;--margin:16px;--start:max(var(--margin),var(--safe-left));--end:max(var(--margin),var(--safe-right));--far:max(16px,var(--safe-top));--along:calc(var(--start) + (100% - var(--start) - var(--end)) * var(--at) / 100);--shift:calc(var(--at) * -1%);--dock:calc(max(var(--margin),var(--safe-bottom)) + var(--thickness,38px) + 8px);--width:calc(100vw - var(--start) - var(--end));--height:calc(100dvh - var(--dock) - var(--far));position:fixed;inset:0;z-index:2147483000;pointer-events:none;color:var(--text);font:400 .875rem/1.5 system-ui,sans-serif;color-scheme:light dark}
88
+ `,Rn=`<svg viewBox="0 0 24 24" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m16 17 5-5-5-5M21 12H9M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"/></svg>`;function zn(e){return e.trim().split(/\s+/).slice(0,2).map(e=>[...e][0]??``).join(``).toLocaleUpperCase()}function Bn(e){let t=document.createElement(`span`);if(t.className=`avatar`,t.setAttribute(`aria-hidden`,`true`),t.textContent=zn(e.name),e.image){let n=document.createElement(`img`);n.alt=``,n.referrerPolicy=`no-referrer`,n.src=e.image,n.addEventListener(`load`,()=>t.replaceChildren(n),{once:!0})}return t}function Vn(e,t){let n=document.createElement(`button`);n.type=`button`,n.setAttribute(`role`,`menuitem`),n.tabIndex=-1,n.insertAdjacentHTML(`beforeend`,e);let r=document.createElement(`span`);return r.textContent=t,n.append(r),{item:n,label:r}}function Hn(){let e=new URL(location.href);for(let t of[q,...Yt])e.searchParams.delete(t);return e}function Un(e){let{account:t,bar:n,signal:r}=e,i=n.parentElement,a=n.attachShadow({mode:`open`});r.addEventListener(`abort`,z(a,X),{once:!0});let o=document.createElement(`style`);o.textContent=Ln;let s=document.createElement(`div`);s.id=`account-menu`,s.setAttribute(`popover`,`auto`),s.setAttribute(`role`,`menu`),s.setAttribute(`aria-label`,t.name);let c=document.createElement(`button`);c.type=`button`,c.className=`who`,c.dataset.motionPress=``,c.title=t.email?`${t.name} (${t.email})`:t.name,c.setAttribute(`aria-label`,`Account: ${t.name}`),c.setAttribute(`aria-haspopup`,`menu`),c.setAttribute(`aria-expanded`,`false`),c.setAttribute(`aria-controls`,s.id),c.setAttribute(`popovertarget`,s.id),c.append(Bn(t));let l=document.createElement(`div`);l.className=`me`,l.setAttribute(`role`,`none`);let u=document.createElement(`div`),d=document.createElement(`b`);if(d.textContent=t.name,u.append(d),t.email){let e=document.createElement(`small`);e.textContent=t.email,u.append(e)}if(l.append(Bn(t),u),s.append(l),t.via===`console`){let t=document.createElement(`div`);t.className=`via`,t.setAttribute(`role`,`none`),t.append(xn(`0 0 20 18`,e.mark,{}),`Signed in with ViteHub Console`),s.append(t)}let f=Vn(`<svg viewBox="0 0 24 24" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M7 7h10v10M7 17 17 7"/></svg>`,`Open in the Console`),p=Vn(Rn,`Sign out of ${location.host}`);s.append(f.item,p.item),a.append(o,c,s);let m;Gn({menu:s,button:c,pill:i,beforeOpen:()=>{m=e.openConsole?.(),f.item.hidden=!m},signal:r}),f.item.addEventListener(`click`,()=>{s.hidePopover(),m?.()},{signal:r}),Kn(t,p,r)}function Wn(e){let{account:t,button:n,turnOff:r,canExit:i,signal:a}=e,o=document.createElement(`style`);o.textContent=In;let s=document.createElement(`vitehub-menu`);s.id=`exit-menu`,s.setAttribute(`popover`,`auto`),s.setAttribute(`role`,`menu`),s.setAttribute(`aria-label`,`Turn off tools or sign out`);let c=Vn(`<svg viewBox="0 0 24 24" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49M14.084 14.158a3 3 0 0 1-4.242-4.242M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143M2 2l20 20"/></svg>`,r.label),l=Vn(Rn,`Sign out of ${location.host}`);s.append(c.item,l.item);let u=`Turn off tools or sign out`;n.setAttribute(`aria-label`,u),n.title=u,n.setAttribute(`aria-haspopup`,`menu`),n.setAttribute(`aria-expanded`,`false`),n.setAttribute(`aria-controls`,s.id),n.setAttribute(`popovertarget`,s.id);let d=n.getRootNode();return Gn({menu:s,button:n,pill:d instanceof ShadowRoot&&d.host instanceof HTMLElement?d.host:null,signal:a}),c.item.addEventListener(`click`,e=>{s.hidePopover(),r.press(e.detail===0)},{signal:a}),Kn(t,l,a,i),[o,s]}function Gn(e){let{menu:t,button:n,pill:r,signal:i}=e,a=()=>{let e=t.getRootNode();return e instanceof ShadowRoot||e instanceof Document?e.activeElement:null},o=()=>[...t.querySelectorAll(`[role=menuitem]`)].filter(e=>!e.hidden),s=e=>{let i=document.documentElement.clientWidth,a=document.documentElement.clientHeight,o=(r??n).getBoundingClientRect(),s=n.getBoundingClientRect(),c={top:`auto`,right:`auto`,bottom:`auto`,left:`auto`};e===`bottom`||e===`top`?(c.right=`${Math.max(8,i-s.right)}px`,e===`bottom`?c.bottom=`${a-o.top+8}px`:c.top=`${o.bottom+8}px`):(s.top<a/2?c.top=`${Math.max(8,s.top)}px`:c.bottom=`${Math.max(8,a-s.bottom)}px`,e===`left`?c.left=`${o.right+8}px`:c.right=`${i-o.left+8}px`),Object.assign(t.style,c)},c=e=>{if(e!==`bottom`&&e!==`top`)return;let r=document.documentElement.clientWidth,i=n.getBoundingClientRect(),a=t.getBoundingClientRect().width;t.style.right=`auto`,t.style.left=`${Math.max(8,Math.min(i.right-a,r-a-8))}px`};if(t.addEventListener(`beforetoggle`,i=>{if(i.newState===`closed`){t.contains(a())&&n.focus({preventScroll:!0});return}e.beforeOpen?.();let o=r?.getAttribute(`edge`)??`bottom`;s(o),requestAnimationFrame(()=>c(o))},{signal:i}),t.addEventListener(`toggle`,e=>{let t=e.newState===`open`;n.setAttribute(`aria-expanded`,String(t)),t&&o()[0]?.focus({preventScroll:!0})},{signal:i}),t.addEventListener(`keydown`,e=>{let n=o(),r=n.findIndex(e=>e===a()),i=e.key===`ArrowDown`?r+1:e.key===`ArrowUp`?r-1:e.key===`Home`?0:e.key===`End`?n.length-1:void 0;i===void 0?e.key===`Escape`?e.stopPropagation():e.key===`Tab`&&t.hidePopover():(e.preventDefault(),n[(i+n.length)%n.length]?.focus())},{signal:i}),r){let e=new MutationObserver(e=>{e.some(e=>e.oldValue!==r.getAttribute(e.attributeName??``))&&t.hidePopover()});e.observe(r,{attributes:!0,attributeOldValue:!0,attributeFilter:[`collapsed`,`dragging`,`edge`]}),i.addEventListener(`abort`,()=>e.disconnect(),{once:!0})}i.addEventListener(`abort`,()=>t.hidePopover(),{once:!0})}function Kn(e,t,n,r){t.item.addEventListener(`click`,async()=>{if(t.item.getAttribute(`aria-disabled`)===`true`||r?.()===!1)return;t.item.setAttribute(`aria-disabled`,`true`),t.label.textContent=`Signing out…`;let n=await fetch(e.signOut,{method:`POST`,credentials:`same-origin`,headers:{"content-type":`application/json`},body:`{}`}).catch(e=>e);if(!(n instanceof Response)||!n.ok){console.error(`[vitehub] The sign-out failed. The session stays.`,n instanceof Response?`The sign-out answered ${n.status}.`:n),t.item.removeAttribute(`aria-disabled`),t.label.textContent=`Could not sign out. Try again`;return}let i=Hn();i.href===location.href?location.reload():location.replace(i)},{signal:n})}function qn(e,...t){return typeof e==`function`?e(...t):e}const Jn=Error.captureStackTrace;var Yn=class e extends Error{get why(){return this.message}constructor(t,n=e){super(t.why,{cause:t.cause}),this.code=this.name=t.code,this.docs=t.docs,this.fix=t.fix,this.sources=t.sources,this.data=t.data,Jn?.(this,n)}toJSON(){return{name:this.name,why:this.why,fix:this.fix,docs:this.docs,sources:this.sources,cause:this.cause,data:this.data,stack:this.stack}}};function Xn(e,t){return typeof e==`string`?`${e}/${t.toLowerCase()}`:e?.(t)}const Zn=e=>t=>t instanceof Yn&&e in t;/* @__NO_SIDE_EFFECTS__ */
89
+ function Qn(e){let t=e.reporters??[],n=Symbol(),r=Object.defineProperty({},"is",{value:Zn(n)}),{docsBase:i}=e;for(let a of Object.keys(e.codes)){let o=e.codes[a],s=o.docs===!1?void 0:o.docs||Xn(i,a),c=(e={},r={})=>{let i=new Yn({code:a,why:qn(o.why,e),fix:qn(o.fix,e),docs:s,cause:e.cause,sources:e.sources,data:qn(o.data,e)},c);i[n]=1;for(let e of t)e(i,r);return i};c.is=e=>r.is(e)&&e.code===a,r[a]=c}return r}const $n=/*#__PURE__*/ Qn({docsBase:`https://vitehub.dev/docs/development/diagnostics`,codes:{INTERNAL_INVARIANT_FAILED:{why:({what:e})=>`ViteHub reached a state that it does not expect: ${e}`,fix:`This is a ViteHub bug. Open an issue at https://github.com/vite-hub/vitehub/issues with this error message and its stack trace.`}}});function er(e){return $n.INTERNAL_INVARIANT_FAILED({what:e})}function tr(e,t){if(!e)throw er(t)}let Q={edge:`bottom`,at:50};const nr=/* @__PURE__ */ new Map,rr=/* @__PURE__ */ new Set;let ir=!1,ar=0;function or(){ir||(ir=!0,queueMicrotask(()=>{ir=!1;for(let e of rr)e()}))}function sr(){return[...nr.keys()].some(e=>!e.hidden)}function cr(){for(let[e,t]of nr)e.hidden||t()}function lr(e,t){rr.add(e),t.addEventListener(`abort`,()=>rr.delete(e),{once:!0})}function ur(e){e.setAttribute(`edge`,Q.edge),e.toggleAttribute(`collapsed`,!!Q.collapsed),e.style.setProperty(`--at`,String(Q.at)),Q.thickness?e.style.setProperty(`--thickness`,`${Q.thickness}px`):e.style.removeProperty(`--thickness`);for(let[t,n]of[[`start`,0],[`end`,100]])Q.beside&&Q.at===n?e.style.setProperty(`--beside-${t}`,`${Q.beside}px`):e.style.removeProperty(`--beside-${t}`);for(let t of[`top`,`right`,`bottom`,`left`])e.shadowRoot.querySelector(`.grip.${t}`).hidden=dr(t)===0}function dr(e){return(e===`top`||e===`bottom`)==(Q.edge===`top`||Q.edge===`bottom`)?1:e===`top`||e===`left`?Q.at/100:1-Q.at/100}function fr(e){Q=e;for(let e of nr.keys())ur(e)}function pr(e){let t=document.createElementNS(`http://www.w3.org/2000/svg`,`svg`);for(let[e,n]of Object.entries({width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.75`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`}))t.setAttribute(e,n);let n=document.createElementNS(`http://www.w3.org/2000/svg`,`path`);return n.setAttribute(`d`,e),t.append(n),t}function mr(e){let t=document.createElement(`vitehub-window`);t.hidden=!0;let n=t.attachShadow({mode:`open`}),r=document.createElement(`style`);r.textContent=`
90
+ :host{all:initial;--surface:light-dark(#fff,#0a0a0a);--text:light-dark(#18181b,#fafafa);--muted:light-dark(#71717a,#a1a1aa);--line:light-dark(rgb(0 0 0/8%),rgb(255 255 255/9%));--hover:light-dark(rgb(0 0 0/5%),rgb(255 255 255/7%));--focus:light-dark(#18181b,#fafafa);--safe-top:env(safe-area-inset-top,0px);--safe-right:env(safe-area-inset-right,0px);--safe-bottom:env(safe-area-inset-bottom,0px);--safe-left:env(safe-area-inset-left,0px);--at:50;--margin:16px;--start:calc(max(var(--margin),var(--safe-left)) + var(--beside-start,0px));--end:calc(max(var(--margin),var(--safe-right)) + var(--beside-end,0px));--far:calc(max(12px,var(--safe-top)) + 40px);--along:calc(var(--start) + (100% - var(--start) - var(--end)) * var(--at) / 100);--shift:calc(var(--at) * -1%);--dock:calc(max(max(var(--margin),var(--safe-bottom)) + var(--thickness,38px),var(--vitehub-page-bar,0px)) + 8px);--width:calc(100vw - var(--start) - var(--end));--height:calc(100dvh - var(--dock) - var(--far));position:fixed;inset:0;z-index:2147483000;pointer-events:none;color:var(--text);font:400 .875rem/1.5 system-ui,sans-serif;color-scheme:light dark}
89
91
  :host([collapsed]){--margin:2px}
90
92
  :host([edge=top]){--dock:calc(max(var(--margin),var(--safe-top)) + var(--thickness,38px) + 8px);--far:max(16px,var(--safe-bottom))}
91
- :host(:is([edge=left],[edge=right])){--start:max(var(--margin),var(--safe-top));--end:max(var(--margin),var(--safe-bottom));--width:calc(100vw - var(--dock) - var(--far));--height:calc(100dvh - var(--start) - var(--end))}
93
+ :host(:is([edge=left],[edge=right])){--start:calc(max(12px,var(--safe-top)) + 40px);--end:max(var(--margin),var(--safe-bottom));--width:calc(100vw - var(--dock) - var(--far));--height:calc(100dvh - var(--start) - var(--end))}
92
94
  :host([edge=right]){--dock:calc(max(var(--margin),var(--safe-right)) + var(--thickness,38px) + 8px);--far:max(16px,var(--safe-left))}
93
95
  :host([edge=left]){--dock:calc(max(var(--margin),var(--safe-left)) + var(--thickness,38px) + 8px);--far:max(16px,var(--safe-right))}
94
96
  :host([hidden]){display:none}
@@ -97,7 +99,7 @@ function Rn(e){let t=e.reporters??[],n=Symbol(),r=Object.defineProperty({},"is",
97
99
  :host([edge=top]) .window{top:var(--dock);left:var(--along);translate:var(--shift) 0}
98
100
  :host([edge=right]) .window{right:var(--dock);top:var(--along);translate:0 var(--shift)}
99
101
  :host([edge=left]) .window{left:var(--dock);top:var(--along);translate:0 var(--shift)}
100
- :host([edge]) .window.expanded{inset:max(12px,var(--safe-top)) max(12px,var(--safe-right)) max(12px,var(--safe-bottom)) max(12px,var(--safe-left));translate:none;width:auto!important;height:auto!important;max-width:none;max-height:none}
102
+ :host([edge]) .window.expanded{inset:max(12px,var(--safe-top)) calc(max(12px,var(--safe-right)) + var(--beside-end,0px)) max(12px,var(--safe-bottom)) calc(max(12px,var(--safe-left)) + var(--beside-start,0px));translate:none;width:auto!important;height:auto!important;max-width:none;max-height:none}
101
103
  :host([edge=bottom]) .window.expanded{bottom:var(--dock)}:host([edge=top]) .window.expanded{top:var(--dock)}:host([edge=right]) .window.expanded{right:var(--dock)}:host([edge=left]) .window.expanded{left:var(--dock)}
102
104
  .frame{flex:1;min-height:0;display:flex;flex-direction:column;overflow:hidden;border-radius:inherit}
103
105
  .grip{position:absolute;z-index:1;touch-action:none}
@@ -114,9 +116,9 @@ header a[hidden]{display:none}
114
116
  header :is(button,a):focus-visible{outline:2px solid var(--focus);outline-offset:-2px}
115
117
  @media(any-pointer:coarse){:host{--thickness:54px}.grip{display:none}header :is(button,a){width:44px;height:44px}}
116
118
  .body{flex:1;min-height:0;overflow:auto;position:relative}iframe{display:block;border:0;width:100%;height:100%;background:var(--surface)}
117
- @media(max-width:640px){:host([edge]) .window,:host([edge]) .window.expanded{inset:var(--safe-top) var(--safe-right) var(--safe-bottom) var(--safe-left);translate:none;width:auto!important;height:auto!important;max-width:none;max-height:none;min-width:0;min-height:0;border-radius:0}:host([edge=bottom]) :is(.window,.window.expanded){bottom:var(--dock)}:host([edge=top]) :is(.window,.window.expanded){top:var(--dock)}:host([edge=right]) :is(.window,.window.expanded){right:var(--dock)}:host([edge=left]) :is(.window,.window.expanded){left:var(--dock)}:host(:is([edge=top],[edge=bottom])) .window:not(.expanded){left:var(--start);right:var(--end)}:host(:is([edge=left],[edge=right])) .window:not(.expanded){top:var(--start);bottom:var(--end)}.grip{display:none}header :is(button,a){width:44px;height:44px}.expand{display:none}}
119
+ @media(max-width:640px){:host(:is([edge=left],[edge=right])){--start:max(var(--margin),var(--safe-top))}:host([edge]) .window,:host([edge]) .window.expanded{inset:var(--safe-top) var(--safe-right) var(--safe-bottom) var(--safe-left);translate:none;width:auto!important;height:auto!important;max-width:none;max-height:none;min-width:0;min-height:0;border-radius:0}:host([edge=bottom]) :is(.window,.window.expanded){bottom:var(--dock)}:host([edge=top]) :is(.window,.window.expanded){top:var(--dock)}:host([edge=right]) :is(.window,.window.expanded){right:var(--dock)}:host([edge=left]) :is(.window,.window.expanded){left:var(--dock)}:host(:is([edge=top],[edge=bottom])) :is(.window,.window.expanded){left:var(--start);right:var(--end)}:host(:is([edge=left],[edge=right])) :is(.window,.window.expanded){top:var(--start);bottom:var(--end)}.grip{display:none}header :is(button,a){width:44px;height:44px}.expand{display:none}}
118
120
  @media(forced-colors:active){.window{border:1px solid CanvasText}header :is(button,a):focus-visible{outline-color:Highlight}}
119
- `;let i=document.createElement(`section`);i.className=`window`,i.setAttribute(`role`,`dialog`),i.setAttribute(`aria-labelledby`,`title`),i.tabIndex=-1;let a=document.createElement(`header`),o=document.createElement(`h2`);o.id=`title`,o.textContent=e.title;let s=document.createElement(`div`);s.className=`body`;let c=(e,t,n)=>{let r=document.createElement(`button`);return r.className=e,r.type=`button`,r.setAttribute(`aria-label`,t),r.title=t,r.append(qn(n)),r},l=c(`expand`,`Expand window`,`M8 3H3v5m13-5h5v5M3 16v5h5m13-5v5h-5`),u=c(`hide`,`Minimize window`,`M5 12h14`),d=document.createElement(`a`);d.className=`tab`,d.target=`_blank`,d.rel=`noopener`,d.setAttribute(`aria-label`,`Open in new tab`),d.title=`Open in new tab`,d.append(qn(`M15 3h6v6M10 14 21 3M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`));let f=()=>{let t=e.href?.();d.hidden=!t,t?d.href=t:d.removeAttribute(`href`)};for(let e of[`pointerenter`,`pointerdown`,`focus`,`click`,`contextmenu`])d.addEventListener(e,f);f(),a.append(o,...e.href?[d]:[],l,u);let p=document.createElement(`div`);p.className=`frame`,p.append(a,s);let m=[`top`,`right`,`bottom`,`left`].map(e=>{let t=document.createElement(`div`);return t.className=`grip ${e}`,t.addEventListener(`pointerdown`,n=>{if(n.button!==0)return;let r=Gn(e);if(r===0)return;n.preventDefault(),t.setPointerCapture(n.pointerId);let a=e===`top`||e===`bottom`,o=a?i.offsetHeight:i.offsetWidth,s=t=>{let s=a?t.clientY-n.clientY:t.clientX-n.clientX,c=o+(e===`top`||e===`left`?-s:s)/r;a?i.style.height=`${Math.max(240,c)}px`:i.style.width=`${Math.max(300,c)}px`};t.addEventListener(`pointermove`,s),t.addEventListener(`lostpointercapture`,()=>t.removeEventListener(`pointermove`,s),{once:!0})}),t});i.append(p,...m),n.append(r,i);let h=`vitehub-window:${e.id}`;try{let e=JSON.parse(localStorage.getItem(h)??`null`);e&&typeof e==`object`&&`width`in e&&`height`in e&&typeof e.width==`number`&&typeof e.height==`number`&&(Number.isFinite(e.width)&&(i.style.width=`${Math.max(300,e.width)}px`),Number.isFinite(e.height)&&(i.style.height=`${Math.max(240,e.height)}px`))}catch{}let g=new ResizeObserver(()=>{if(t.hidden||i.classList.contains(`expanded`)||innerWidth<=640)return;let e=i.offsetWidth,n=i.offsetHeight;try{localStorage.setItem(h,JSON.stringify({width:e,height:n}))}catch{}});g.observe(i);let _=()=>{t.hidden=!0,e.trigger.setAttribute(`aria-expanded`,`false`),e.trigger.focus({preventScroll:!0}),e.onHide?.()};l.addEventListener(`click`,()=>{let e=i.classList.toggle(`expanded`);l.setAttribute(`aria-label`,e?`Restore window size`:`Expand window`),l.title=e?`Restore window size`:`Expand window`,l.setAttribute(`aria-pressed`,String(e))}),u.addEventListener(`click`,_),e.colorScheme&&addEventListener(`storage`,()=>{t.style.colorScheme=e.colorScheme?.()??``},{signal:e.signal}),n.addEventListener(`keydown`,e=>{e instanceof KeyboardEvent&&e.key===`Escape`&&!e.defaultPrevented&&(e.preventDefault(),e.stopPropagation(),_())}),t.style.viewTransitionName=`vitehub-window-${++Un}`,Wn(t);let v=I(n,Y),y=()=>{Hn.delete(t),g.disconnect(),t.remove(),v()};return e.signal.aborted?y():(e.signal.addEventListener(`abort`,y,{once:!0}),Hn.add(t),document.documentElement.append(t)),{body:s,show(){e.signal.aborted||(t.style.colorScheme=e.colorScheme?.()??``,f(),t.hidden=!1,e.trigger.setAttribute(`aria-expanded`,`true`),i.focus({preventScroll:!0}))},hide:_,destroy:y}}function Yn(e){let t=typeof e==`object`&&e?Reflect.get(e,`default`):void 0;return t instanceof Function?t:void 0}const Xn=`vitehub-tools-collapsed`,Zn=`vitehub-tools-dock`,Qn=`vitehub-account`,$n=`M19.734 8.156 15.576.844A1.66 1.66 0 0 0 14.135 0H5.819C5.226 0 4.677.32 4.38.844L.222 8.156a1.71 1.71 0 0 0 0 1.688l4.158 7.312c.297.523.846.844 1.439.844h8.316c.593 0 1.142-.32 1.438-.844l4.158-7.312c.3-.523.3-1.165.003-1.688Z`;function er(e){try{return localStorage.getItem(e)===`1`}catch{return!1}}function tr(e,t){try{t?localStorage.setItem(e,`1`):localStorage.removeItem(e)}catch{}}function nr(){return document.documentElement.getAttribute(`data-vitehub-pill`)===`mark`||Q}let Q=!1,rr=!1;function ir(){try{return localStorage.getItem(Zn)}catch{return null}}function ar(){if(rr||typeof document.elementsFromPoint!=`function`)return!1;let e=e=>{let t=e.getBoundingClientRect();return t.width*t.height<innerWidth*innerHeight/2},t=Array.from({length:36},(e,t)=>[Math.min(innerWidth-1,Math.max(0,innerWidth/2-140+t%18*16+8)),innerHeight-(t<18?24:44)]),n=/* @__PURE__ */ new Set;for(let[r,i]of t)for(let t of document.elementsFromPoint(r,i))if(!n.has(t)){n.add(t);for(let n=t;n&&n!==document.body&&n!==document.documentElement&&!n.localName.startsWith(`vitehub-`);n=n.parentElement){let r=getComputedStyle(n);if(r.position===`fixed`||r.position===`sticky`&&r.bottom!==`auto`){if(e(n)||n!==t&&e(t))return!0;break}if(/auto|scroll/.test(r.overflowY)&&n.scrollHeight>n.clientHeight)break}}return!1}function or(e){return e.edge===`bottom`?{edge:`bottom`,at:e.at<50?0:100}:e}function sr(e,t){let n=nr(),r=ir(),i=()=>{rr||=ir()!==r;let t=Q;if(Q=ar(),t&&!Q&&rr&&document.querySelector(`vitehub-pill`)?.hasAttribute(`collapsed`))try{localStorage.setItem(Xn,`1`)}catch{}nr()!==n&&(n=!n,e())},a=new MutationObserver(i);a.observe(document.documentElement,{attributes:!0,attributeFilter:[`data-vitehub-pill`]});let o,s=()=>{o??=setTimeout(()=>{o=void 0,i()},200)},c=new MutationObserver(e=>{e.some(e=>!(e.target instanceof Element&&e.target.localName.startsWith(`vitehub-`)))&&s()});c.observe(document.documentElement,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`hidden`,`class`,`style`]}),addEventListener(`scroll`,s,{capture:!0,passive:!0,signal:t}),addEventListener(`resize`,s,{signal:t}),addEventListener(`storage`,e=>{(e.key===null||e.key===Zn)&&(r=ir()),s()},{signal:t}),document.addEventListener(`pointerup`,s,{signal:t}),t.addEventListener(`abort`,()=>{a.disconnect(),c.disconnect(),clearTimeout(o)},{once:!0})}const $={name:`vitehub-pill`,label:`ViteHub tools`,off:`vitehub-tools-off`,collapsed:Xn,dock:Zn};function cr(e,t,n,r,i){if(t.aborted)return;let a=document.createElement(e.off);a.setAttribute(`off`,``),a.setAttribute(`collapsed`,``),i&&a.setAttribute(`closing`,``),a.style.viewTransitionName=e.name;let o=fn(e.dock)??e.initialDock??{edge:`bottom`,at:50},s=()=>{let t=e===$&&nr()&&!a.hasAttribute(`dragging`)?or(o):o;a.setAttribute(`edge`,t.edge),a.style.setProperty(`--at`,String(t.at))};s();let l=new AbortController;t.addEventListener(`abort`,()=>{l.abort(),a.remove()},{once:!0,signal:l.signal}),e===$&&sr(s,l.signal);let u=a.attachShadow({mode:`open`}),d=I(u,Y);l.signal.addEventListener(`abort`,d,{once:!0});let f=document.createElement(`style`);f.textContent=`${sn}\n:host([off]){--vitehub-hex-h:14px;filter:drop-shadow(0 1px 2px rgb(0 0 0/25%))}
121
+ `;let i=document.createElement(`section`);i.className=`window`,i.setAttribute(`role`,`dialog`),i.setAttribute(`aria-labelledby`,`title`),i.tabIndex=-1;let a=document.createElement(`header`),o=document.createElement(`h2`);o.id=`title`,o.textContent=e.title;let s=document.createElement(`div`);s.className=`body`;let c=(e,t,n)=>{let r=document.createElement(`button`);return r.className=e,r.type=`button`,r.setAttribute(`aria-label`,t),r.title=t,r.append(pr(n)),r},l=c(`expand`,`Expand window`,`M8 3H3v5m13-5h5v5M3 16v5h5m13-5v5h-5`),u=c(`hide`,`Minimize window`,`M5 12h14`),d=document.createElement(`a`);d.className=`tab`,d.target=`_blank`,d.rel=`noopener`,d.setAttribute(`aria-label`,`Open in new tab`),d.title=`Open in new tab`,d.append(pr(`M15 3h6v6M10 14 21 3M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`));let f=()=>{let t=e.href?.();d.hidden=!t,t?d.href=t:d.removeAttribute(`href`)};for(let e of[`pointerenter`,`pointerdown`,`focus`,`click`,`contextmenu`])d.addEventListener(e,f);f(),a.append(o,...e.href?[d]:[],...e.expand===!1?[]:[l],u);let p=document.createElement(`div`);p.className=`frame`,p.append(a,s);let m=[`top`,`right`,`bottom`,`left`].map(e=>{let t=document.createElement(`div`);return t.className=`grip ${e}`,t.addEventListener(`pointerdown`,n=>{if(n.button!==0)return;let r=dr(e);if(r===0)return;n.preventDefault(),t.setPointerCapture(n.pointerId);let a=e===`top`||e===`bottom`,o=a?i.offsetHeight:i.offsetWidth,s=t=>{let s=a?t.clientY-n.clientY:t.clientX-n.clientX,c=o+(e===`top`||e===`left`?-s:s)/r;a?i.style.height=`${Math.max(240,c)}px`:i.style.width=`${Math.max(300,c)}px`};t.addEventListener(`pointermove`,s),t.addEventListener(`lostpointercapture`,()=>t.removeEventListener(`pointermove`,s),{once:!0})}),t});i.append(p,...m),n.append(r,i);let h=`vitehub-window:${e.id}`;try{let e=JSON.parse(localStorage.getItem(h)??`null`);e&&typeof e==`object`&&`width`in e&&`height`in e&&typeof e.width==`number`&&typeof e.height==`number`&&(Number.isFinite(e.width)&&(i.style.width=`${Math.max(300,e.width)}px`),Number.isFinite(e.height)&&(i.style.height=`${Math.max(240,e.height)}px`))}catch{}let g=new ResizeObserver(()=>{if(t.hidden||i.classList.contains(`expanded`)||innerWidth<=640)return;let e=i.offsetWidth,n=i.offsetHeight;try{localStorage.setItem(h,JSON.stringify({width:e,height:n}))}catch{}});g.observe(i);let _=()=>{t.hidden=!0,e.trigger.setAttribute(`aria-expanded`,`false`),e.trigger.focus({preventScroll:!0}),e.onHide?.(),or()};l.addEventListener(`click`,()=>{let e=i.classList.toggle(`expanded`);l.setAttribute(`aria-label`,e?`Restore window size`:`Expand window`),l.title=e?`Restore window size`:`Expand window`,l.setAttribute(`aria-pressed`,String(e))}),u.addEventListener(`click`,_);let v=()=>{t.style.colorScheme=e.colorScheme?.()??``};e.colorScheme&&addEventListener(`storage`,v,{signal:e.signal}),n.addEventListener(`keydown`,e=>{e instanceof KeyboardEvent&&e.key===`Escape`&&!e.defaultPrevented&&(e.preventDefault(),e.stopPropagation(),_())}),t.style.viewTransitionName=`vitehub-window-${++ar}`,ur(t);let y=z(n,X),b=()=>{nr.delete(t)&&!t.hidden&&or(),g.disconnect(),t.remove(),y()};return e.signal.aborted?b():(e.signal.addEventListener(`abort`,b,{once:!0}),nr.set(t,_),document.documentElement.append(t)),{body:s,show(){e.signal.aborted||(v(),f(),t.hidden=!1,or(),e.trigger.setAttribute(`aria-expanded`,`true`),i.focus({preventScroll:!0}))},hide:_,destroy:b,syncColorScheme:v}}function hr(e){let t=typeof e==`object`&&e?Reflect.get(e,`default`):void 0;return t instanceof Function?t:void 0}const gr=`vitehub-tools-collapsed`,_r=`vitehub-tools-dock`,vr=`vitehub-account`,yr=`M19.734 8.156 15.576.844A1.66 1.66 0 0 0 14.135 0H5.819C5.226 0 4.677.32 4.38.844L.222 8.156a1.71 1.71 0 0 0 0 1.688l4.158 7.312c.297.523.846.844 1.439.844h8.316c.593 0 1.142-.32 1.438-.844l4.158-7.312c.3-.523.3-1.165.003-1.688Z`;function br(e){try{return localStorage.getItem(e)===`1`}catch{return!1}}function xr(e,t){try{t?localStorage.setItem(e,`1`):localStorage.removeItem(e)}catch{}}function Sr(){return document.documentElement.getAttribute(`data-vitehub-pill`)===`mark`||Cr}let Cr=!1,wr=!1;function Tr(){try{return localStorage.getItem(_r)}catch{return null}}function Er(){if(wr||typeof document.elementsFromPoint!=`function`)return!1;let e=e=>{let t=e.getBoundingClientRect();return t.width*t.height<innerWidth*innerHeight/2},t=Array.from({length:36},(e,t)=>[Math.min(innerWidth-1,Math.max(0,innerWidth/2-140+t%18*16+8)),innerHeight-(t<18?24:44)]),n=/* @__PURE__ */ new Set;for(let[r,i]of t)for(let t of document.elementsFromPoint(r,i))if(!n.has(t)){n.add(t);for(let n=t;n&&n!==document.body&&n!==document.documentElement&&!n.localName.startsWith(`vitehub-`);n=n.parentElement){let r=getComputedStyle(n);if(r.position===`fixed`||r.position===`sticky`&&r.bottom!==`auto`){if(e(n)||n!==t&&e(t))return!0;break}if(/auto|scroll/.test(r.overflowY)&&n.scrollHeight>n.clientHeight)break}}return!1}function Dr(e){return e.edge===`bottom`?{edge:`bottom`,at:e.at<50?0:100}:e}function Or(e,t){let n=Sr(),r=Tr(),i=()=>{wr||=Tr()!==r;let t=Cr;if(Cr=Er(),t&&!Cr&&wr&&document.querySelector(`vitehub-pill`)?.hasAttribute(`collapsed`))try{localStorage.setItem(gr,`1`)}catch{}Sr()!==n&&(n=!n,e())},a=new MutationObserver(i);a.observe(document.documentElement,{attributes:!0,attributeFilter:[`data-vitehub-pill`]});let o,s=()=>{o??=setTimeout(()=>{o=void 0,i()},200)},c=new MutationObserver(e=>{e.some(e=>!(e.target instanceof Element&&e.target.localName.startsWith(`vitehub-`)))&&s()});c.observe(document.documentElement,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`hidden`,`class`,`style`]}),addEventListener(`scroll`,s,{capture:!0,passive:!0,signal:t}),addEventListener(`resize`,s,{signal:t}),addEventListener(`storage`,e=>{(e.key===null||e.key===_r)&&(r=Tr()),s()},{signal:t}),document.addEventListener(`pointerup`,s,{signal:t}),t.addEventListener(`abort`,()=>{a.disconnect(),c.disconnect(),clearTimeout(o)},{once:!0})}const $={name:`vitehub-pill`,label:`ViteHub tools`,off:`vitehub-tools-off`,collapsed:gr,dock:_r};function kr(e,t,n,r,i){if(t.aborted)return;let a=document.createElement(e.off);a.setAttribute(`off`,``),a.setAttribute(`collapsed`,``),i&&a.setAttribute(`closing`,``),a.style.viewTransitionName=e.name;let o=Tn(e.dock)??e.initialDock??{edge:`bottom`,at:50},s=()=>{let t=e===$&&Sr()&&!a.hasAttribute(`dragging`)?Dr(o):o;a.setAttribute(`edge`,t.edge),a.style.setProperty(`--at`,String(t.at))};s();let l=new AbortController;t.addEventListener(`abort`,()=>{l.abort(),a.remove()},{once:!0,signal:l.signal}),e===$&&Or(s,l.signal);let u=a.attachShadow({mode:`open`}),d=z(u,X);l.signal.addEventListener(`abort`,d,{once:!0});let f=document.createElement(`style`);f.textContent=`${bn}\n:host([off]){--vitehub-hex-h:14px;filter:drop-shadow(0 1px 2px rgb(0 0 0/25%))}
120
122
  :host([off]) button{position:relative;display:block;width:var(--vitehub-hex-w);min-width:0;height:var(--vitehub-hex-h);padding:0;border-radius:4px;pointer-events:auto;cursor:grab;opacity:.55;transition:opacity 150ms ease-out}
121
123
  :host([off][edge=bottom]) button{transform-origin:calc(var(--at) * 1%) 100%}
122
124
  :host([off][edge=top]) button{transform-origin:calc(var(--at) * 1%) 0}
@@ -130,6 +132,6 @@ svg{display:block;width:100%;height:100%;overflow:visible;fill:rgb(17 17 17/92%)
130
132
  :host([off][dragging]) svg{scale:none}
131
133
  @media(hover:hover){:host([off]) button:hover{opacity:1;background:none}button:hover svg{fill:rgb(38 38 38/94%)}}
132
134
  @media(any-pointer:coarse){:host([off]){--vitehub-hex-h:20px}:host([off]) button{min-width:0;height:var(--vitehub-hex-h)}:host([off]) button::before{inset:-10px}}
133
- @media(prefers-reduced-motion:reduce){:host([off]) button,svg{transition:none}}`;let p=document.createElement(`button`);if(p.type=`button`,p.title=`Turn on ${e.label}`,p.setAttribute(`aria-label`,p.title),p.append(cn(`0 0 20 18`,$n,{})),u.append(f,p),document.documentElement.append(a),i){let e=i/X(a).height,t=x(e,(e,t)=>{let n=t===0&&e===1;k(p,{scale:n?null:e.toFixed(4)}),n&&a.removeAttribute(`closing`)},c.snappy);t.set(e),t.to(1,{preset:c.snappy})}let m=bn({host:a,handle:p,dock:()=>o,shape:e=>{let t=e?a.offsetHeight:a.offsetWidth,n=X(a);return{size:t,lead:t/2,part:e?n.height:n.width,margin:2}},place:e=>{o=e,s()},drop:()=>{s();try{localStorage.setItem(e.dock,JSON.stringify(o))}catch{}},signal:l.signal});p.addEventListener(`click`,()=>{m()||(l.abort(),a.remove(),n())}),r&&p.focus({preventScroll:!0})}async function lr(e={}){return await dr(e,!1)}let ur=new AbortController;async function dr(e,t){let n=new URLSearchParams(location.search),r=typeof e.session==`function`?e.session:void 0,i=typeof e.session==`string`?e.session:Kt(import.meta.url);if(!r&&!Ut(location.search,document.cookie))return[];let{signal:a}=ur,o=e.pill??$;o===$&&(rr=fn(Zn)!==void 0,Q=ar());let s=e.load??(e=>import(
135
+ @media(prefers-reduced-motion:reduce){:host([off]) button,svg{transition:none}}`;let p=document.createElement(`button`);if(p.type=`button`,p.title=`Turn on ${e.label}`,p.dataset.motionPress=``,p.setAttribute(`aria-label`,p.title),p.append(xn(`0 0 20 18`,yr,{})),u.append(f,p),document.documentElement.append(a),an(a,l.signal),i){let e=i/Z(a).height,t=x(e,(e,t)=>{let n=t===0&&e===1;N(p,{scale:n?null:e.toFixed(4)}),n&&a.removeAttribute(`closing`)},c.snappy);t.set(e),t.to(1,{preset:c.snappy})}let m=Pn({host:a,handle:p,dock:()=>o,shape:e=>{let t=e?a.offsetHeight:a.offsetWidth,n=Z(a);return{size:t,lead:t/2,part:e?n.height:n.width,margin:2}},place:e=>{o=e,s()},drop:()=>{s();try{localStorage.setItem(e.dock,JSON.stringify(o))}catch{}},signal:l.signal});p.addEventListener(`click`,()=>{m()||(l.abort(),a.remove(),n())}),r&&p.focus({preventScroll:!0})}async function Ar(e={}){return await Mr(e,!1)}let jr=new AbortController;async function Mr(e,t){let n=new URL(location.href),r=n.searchParams,i=r.get(q),a=typeof e.session==`function`?e.session:void 0,o=typeof e.session==`string`?e.session:$t(import.meta.url);if(!a&&!Xt(location.search,document.cookie))return[];let{signal:s}=jr;try{CSS.registerProperty({name:`--vitehub-page-bar`,syntax:`<length>`,inherits:!0,initialValue:`0px`})}catch{}let c=e.pill??$;c===$&&(wr=Tn(_r)!==void 0,Cr=Er());let l=e.load??(e=>import(
134
136
  /* @vite-ignore */
135
- e)),c;try{if(r)c=await r();else{let e=new URL(i,location.href);e.searchParams.set(`page`,location.pathname);let t=await fetch(e.origin===location.origin?`${e.pathname}${e.search}`:e.href,{credentials:`same-origin`,headers:{accept:`application/json`}});if(!t.ok)return[];c=Yt(await t.json())}}catch{return[]}if(a.aborted||c.tools.length===0||document.querySelector(`${o.name}, ${o.off}`))return[];let l=c.tools.find(e=>e.param&&n.has(e.param));if(n.has(`vitehub`)||l||e.open)tr(o.off,!1);else if(er(o.off))return cr(o,a,()=>{tr(o.off,!1),dr(e,!0)},!1),[];let u=e.open||n.get(`vitehub`)||l?.id,d=c.tools.some(e=>e.id===u),f=new AbortController,p=c.tools.map(()=>new AbortController);a.addEventListener(`abort`,()=>{for(let e of p)e.abort();f.abort()},{once:!0,signal:f.signal});let m=/* @__PURE__ */ new Set,h=!1,g=()=>!h&&[...m].every(e=>e()),_=(t=!1)=>{if(!g())return;h=!0;let n=c.tools.filter(e=>C(e.id));for(let e of c.tools)S(e.id,!1);tr(o.off,!0);let r=new URL(location.href);(o===$||c.tools.some(e=>e.id===r.searchParams.get(`vitehub`)))&&r.searchParams.delete(Vt);for(let e of c.tools)e.param&&r.searchParams.delete(e.param);r.href!==location.href&&history.replaceState(history.state,``,r);let i=X(y).height,s=yn(y);for(let e of p)e.abort();s.then(()=>{f.abort(),cr(o,a,()=>{tr(o.off,!1);for(let e of n)S(e.id,!0);dr(e,!0)},t,i&&!matchMedia(`(prefers-reduced-motion: reduce)`).matches?i:void 0)})},v=c.account,y=vn({name:o.name,label:o.label,mark:cn(`0 0 20 18`,$n,{fill:`currentColor`}),slots:[...c.tools.map(e=>e.id),...c.account?[Qn]:[]],storage:{collapsed:o.collapsed,dock:o.dock},...o.initialDock?{initial:{dock:o.initialDock}}:{},exit:{label:`Turn off ${o.label}`,press:_,...v&&!v.guest?{menu:e=>An({account:v,button:e,turnOff:{label:`Turn off ${o.label}`,press:_},canExit:g,signal:f.signal})}:{}},onPlace:Kn,...o===$?{markOnly:{active:nr,watch:sr,opened:t}}:{},signal:f.signal});if(f.signal.addEventListener(`abort`,I(y,{effects:[Ue,jt]}),{once:!0}),c.account){let e=document.createElement(`vitehub-account`);e.slot=Qn,y.append(e),kn({account:c.account,bar:e,mark:$n,openConsole:()=>{let e=y.querySelector(`vitehub-tool[slot="console"]`);return e&&!e.hidden?()=>void T(`console`):void 0},signal:f.signal})}let b=/* @__PURE__ */ new Map,x=t=>`vitehub-open:${e.pill?.name??i}:${t}`,S=(e,t)=>{try{sessionStorage.setItem(x(e),String(t))}catch{}},C=e=>{try{return sessionStorage.getItem(x(e))===`true`}catch{return!1}},w=/* @__PURE__ */ new Map,T=async(e,t)=>await w.get(e)?.(t)??!1,E=(await Promise.all(c.tools.map(async(e,t)=>{let{signal:n}=p[t],r=document.createElement(`vitehub-tool`);r.slot=e.id,y.append(r);let i,a,o,c=()=>(o||(o=s(e.script),o.catch(()=>{o=void 0})),o),l=!1,f=()=>{let t=document.createElement(`vitehub-tool`);t.slot=e.id,r.replaceWith(t),r=t},h=()=>{let e=r.attachShadow({mode:`open`}),t=I(e,Y);n.addEventListener(`abort`,t,{once:!0});let i=document.createElement(`style`);i.textContent=Gt,e.append(i,v)},g=(t,o=!0)=>n.aborted?Promise.resolve(!1):l?(i?.(t),Promise.resolve(!0)):a?a.then(e=>(e&&i?.(t),e)):(a=(async()=>{let s=new AbortController,d=()=>s.abort();n.addEventListener(`abort`,d,{once:!0});try{r.setAttribute(`aria-busy`,`true`);let a=Yn(await c());if(Vn(a,`the script of a page tool default-exports a function (${e.script})`),n.aborted)return!1;v.remove(),r.shadowRoot?f():r.replaceChildren();let d=a({beforeExit:e=>{let t=()=>e();m.add(t),s.signal.addEventListener(`abort`,()=>m.delete(t),{once:!0})},tool:e,bar:r,signal:s.signal,open:o&&(e.lazy===!0||e.id===u||C(e.id)),exit:()=>_(),createWindow:t=>{let n=Jn({...t,signal:s.signal,onHide:()=>{S(e.id,!1),y.hasAttribute(`collapsed`)&&y.shadowRoot.querySelector(`button.mark`).focus({preventScroll:!0}),t.onHide?.()}}),r={...n,show(){if(!s.signal.aborted){for(let[t,n]of b)t!==e.id&&n.hide();S(e.id,!0),n.show()}},destroy(){b.get(e.id)===r&&(b.delete(e.id),S(e.id,!1)),n.destroy()}};return b.set(e.id,r),r},openTool:T,createTab:()=>{let e=document.createElement(`vitehub-tab`);return e.slot=`tab`,e.setAttribute(`data-motion-appear`,`vitehub-pill`),y.append(e),s.signal.addEventListener(`abort`,()=>e.remove(),{once:!0}),e},onOpen:e=>{i=e}});return l=!0,t&&i?.(t),!r.shadowRoot&&!r.hasChildNodes()&&(r.hidden=!0),d instanceof Function&&(n.aborted?d():s.signal.addEventListener(`abort`,()=>d(),{once:!0})),!n.aborted}catch(t){return s.abort(),n.removeEventListener(`abort`,d),b.delete(e.id)&&S(e.id,!1),i=void 0,l=!1,console.error(`[vitehub] The page tool "${e.id}" did not start.`,t),f(),v.textContent=`Retry ${e.label}`,v.title=`The tool could not load. Try again.`,r.hidden=!1,h(),!1}finally{r.removeAttribute(`aria-busy`),a=void 0}})(),a),v=document.createElement(`button`);v.type=`button`,v.textContent=e.label,v.addEventListener(`click`,()=>void g());for(let e of[`pointerenter`,`pointerdown`,`focus`])v.addEventListener(e,()=>void c());return w.set(e.id,g),e.lazy&&e.id!==u&&!C(e.id)?(h(),e):(await g(void 0,!d||e.id===u),n.aborted?void 0:e)}))).filter(e=>!!e);return E.length===0&&f.abort(),E}lr({session:new URL(`../tools`,import.meta.url).pathname});
137
+ e)),u;try{if(a)u=await a();else{let e=new URL(o,location.href);e.searchParams.set(`page`,location.pathname);let t=await fetch(e.origin===location.origin?`${e.pathname}${e.search}`:e.href,{credentials:`same-origin`,headers:{accept:`application/json`}});if(!t.ok)return[];u=nn(await t.json())}}catch{return[]}if(s.aborted||u.tools.length===0||document.querySelector(`${c.name}, ${c.off}`))return[];let d=i||u.tools.find(e=>e.param&&r.has(e.param))?.id;if(r.has(`vitehub`)||d||e.open)xr(c.off,!1);else if(br(c.off))return kr(c,s,()=>{xr(c.off,!1),Mr(e,!0)},!1),[];let f=e.open||d,p=u.tools.some(e=>e.id===f),m=new AbortController,h=u.tools.map(()=>new AbortController);s.addEventListener(`abort`,()=>{for(let e of h)e.abort();m.abort()},{once:!0,signal:m.signal});let g=/* @__PURE__ */ new Set,_=!1,v=()=>!_&&[...g].every(e=>e()),y=(t=!1)=>{if(!v())return;_=!0;let n=u.tools.filter(e=>T(e.id));for(let e of u.tools)w(e.id,!1);xr(c.off,!0);let r=new URL(location.href);(c===$||u.tools.some(e=>e.id===r.searchParams.get(`vitehub`)))&&r.searchParams.delete(q);for(let e of u.tools)e.param&&r.searchParams.delete(e.param);r.href!==location.href&&history.replaceState(history.state,``,r);let i=Z(x).height,a=Nn(x);for(let e of h)e.abort();a.then(()=>{m.abort(),kr(c,s,()=>{xr(c.off,!1);for(let e of n)w(e.id,!0);Mr(e,!0)},t,i&&!matchMedia(`(prefers-reduced-motion: reduce)`).matches?i:void 0)})},b=u.account,x=Mn({name:c.name,label:c.label,mark:xn(`0 0 20 18`,yr,{fill:`currentColor`}),slots:[...u.tools.map(e=>e.id),...u.account?[vr]:[]],storage:{collapsed:c.collapsed,dock:c.dock},...c.initialDock?{initial:{dock:c.initialDock}}:{},exit:{label:`Turn off ${c.label}`,press:y,...b&&!b.guest?{menu:e=>Wn({account:b,button:e,turnOff:{label:`Turn off ${c.label}`,press:y},canExit:v,signal:m.signal})}:{}},onPlace:fr,windows:{shown:sr,hide:cr,watch:lr},...c===$?{markOnly:{active:Sr,watch:Or,opened:t}}:{},signal:m.signal});if(m.signal.addEventListener(`abort`,z(x,{effects:[Ke,zt]}),{once:!0}),u.account){let e=document.createElement(`vitehub-account`);e.slot=vr,x.append(e),Un({account:u.account,bar:e,mark:yr,openConsole:()=>{let e=x.querySelector(`vitehub-tool[slot="console"]`);return e&&!e.hidden?()=>void D(`console`):void 0},signal:m.signal})}let S=/* @__PURE__ */ new Map,C=t=>`vitehub-open:${e.pill?.name??o}:${t}`,w=(e,t)=>{try{sessionStorage.setItem(C(e),String(t))}catch{}},T=e=>{try{return sessionStorage.getItem(C(e))===`true`}catch{return!1}},E=/* @__PURE__ */ new Map,D=async(e,t)=>await E.get(e)?.(t)??!1,ee=(await Promise.all(u.tools.map(async(e,t)=>{let{signal:n}=h[t],r=document.createElement(`vitehub-tool`);r.slot=e.id,x.append(r);let i,a,o,s=()=>(o||(o=l(e.script),o.catch(()=>{o=void 0})),o),c=!1,u=()=>{let t=document.createElement(`vitehub-tool`);t.slot=e.id,r.replaceWith(t),r=t},m=()=>{let e=r.attachShadow({mode:`open`}),t=z(e,X);n.addEventListener(`abort`,t,{once:!0});let i=document.createElement(`style`);i.textContent=Qt,e.append(i,v)},_=(t,o=!0)=>n.aborted?Promise.resolve(!1):c?(i?.(t),Promise.resolve(!0)):a?a.then(e=>(e&&i?.(t),e)):(a=(async()=>{let l=new AbortController,p=()=>l.abort();n.addEventListener(`abort`,p,{once:!0});try{r.setAttribute(`aria-busy`,`true`);let a=hr(await s());if(tr(a,`the script of a page tool default-exports a function (${e.script})`),n.aborted)return!1;v.remove(),r.shadowRoot?u():r.replaceChildren();let p=a({beforeExit:e=>{let t=()=>e();g.add(t),l.signal.addEventListener(`abort`,()=>g.delete(t),{once:!0})},tool:e,bar:r,signal:l.signal,open:o&&(e.lazy===!0||e.id===f||T(e.id)),linked:o&&e.id===d,exit:()=>y(),createWindow:t=>{let n=mr({...t,signal:l.signal,onHide:()=>{w(e.id,!1),x.hasAttribute(`collapsed`)&&x.shadowRoot.querySelector(`button.mark`).focus({preventScroll:!0}),t.onHide?.()}}),r={...n,show(){if(!l.signal.aborted){for(let[t,n]of S)t!==e.id&&n.hide();w(e.id,!0),n.show()}},destroy(){S.get(e.id)===r&&(S.delete(e.id),w(e.id,!1)),n.destroy()}};return S.set(e.id,r),r},openTool:D,createTab:()=>{let e=document.createElement(`vitehub-tab`);return e.slot=`tab`,e.setAttribute(`data-motion-appear`,`vitehub-pill`),x.append(e),l.signal.addEventListener(`abort`,()=>e.remove(),{once:!0}),e},onOpen:e=>{i=e}});return c=!0,t&&i?.(t),!r.shadowRoot&&!r.hasChildNodes()&&(r.hidden=!0),p instanceof Function&&(n.aborted?p():l.signal.addEventListener(`abort`,()=>p(),{once:!0})),!n.aborted}catch(t){return l.abort(),n.removeEventListener(`abort`,p),S.delete(e.id)&&w(e.id,!1),i=void 0,c=!1,console.error(`[vitehub] The page tool "${e.id}" did not start.`,t),u(),v.textContent=`Retry ${e.label}`,v.title=`The tool could not load. Try again.`,r.hidden=!1,m(),!1}finally{r.removeAttribute(`aria-busy`),a=void 0}})(),a),v=document.createElement(`button`);v.type=`button`,v.textContent=e.label,v.dataset.motionPress=``,v.addEventListener(`click`,()=>void _());for(let e of[`pointerenter`,`pointerdown`,`focus`])v.addEventListener(e,()=>void s());return E.set(e.id,_),e.lazy&&e.id!==f&&!T(e.id)?(m(),e):(await _(void 0,!p||e.id===f),n.aborted?void 0:e)}))).filter(e=>!!e);if(ee.length===0)m.abort();else if(i!==null){let e=new URL(location.href);e.pathname===n.pathname&&e.searchParams.get(`vitehub`)===i&&(c===$||u.tools.some(e=>e.id===i))&&(e.searchParams.delete(q),history.replaceState(history.state,``,e))}return ee}Ar({session:new URL(`../tools`,import.meta.url).pathname});
@@ -1,8 +1,4 @@
1
1
  // ../internal/src/runtime/page-tools-shared.ts
2
- /**
3
- * The names and the session answer that the page tools server and the browser loader share. It has no DOM and no Node
4
- * code, so both sides import it.
5
- */
6
2
  /** The query that turns the page tools on for a page. `?vitehub=<tool id>` also opens that tool. */
7
3
  const viteHubPageToolsQuery = "vitehub";
8
4
  /**
@@ -56,11 +52,12 @@ const viteHubPageSessionPath = "/_vitehub/page/tools";
56
52
  * The URL of the loader script, below the app base. Its version query changes when the loader changes, so caches keep
57
53
  * it 5 minutes.
58
54
  */
59
- const viteHubPageToolsLoader = "/_vitehub/page/assets/loader.js?v=22";
55
+ const viteHubPageToolsLoader = "/_vitehub/page/assets/loader.js?v=25";
60
56
  /** The attribute of the script that loads the page tools. A page that has it does not get a second one. */
61
57
  const viteHubPageToolsMarker = "data-vitehub-page-tools";
62
58
  /** The bootstrap's opening tag, so the server can recognize the generated bootstrap when it replaces it. */
63
59
  const viteHubPageToolsInlineStart = `<script type="module" ${viteHubPageToolsMarker}>`;
60
+ `${JSON.stringify([viteHubPageToolsQuery, ...viteHubPageToolsLinkParams])}`;
64
61
  /**
65
62
  * The exact page tools bootstrap: an inline module script that imports `<base>/_vitehub/page/assets/loader.js` only
66
63
  * when `viteHubPageToolsWanted()` is true in the browser. Without the hint it makes no request. Vite adds it to a
@@ -1,8 +1,8 @@
1
- import { a as registerViteHubPageTool, i as installViteHubSiteVisitor, n as resolveCommentsPage, r as installViteHubPageTools, t as resolveCommentsIdentity } from "./session-CCRLR9bf.js";
2
- import { r as commentsRoleGrants } from "./define-C2tnAtBU.js";
3
- import { t as commentsErrorDiagnostics } from "./errors-ByCRdInk.js";
4
- import { i as installCommentsRuntime } from "./server-DvSehkPP.js";
5
- import { i as runtimeBuilds } from "./installed-bPUnazFf.js";
1
+ import { a as registerViteHubPageTool, i as installViteHubSiteVisitor, n as resolveCommentsPage, r as installViteHubPageTools, t as resolveCommentsIdentity } from "./session-DGdFKWDB.js";
2
+ import { r as commentsRoleGrants } from "./define-BqPcuDhf.js";
3
+ import { t as commentsErrorDiagnostics } from "./errors-CBvIpwbo.js";
4
+ import { i as installCommentsRuntime } from "./server-8o9u8leM.js";
5
+ import { i as runtimeBuilds } from "./installed-wUYjqk_k.js";
6
6
  import { n as commentsTableNames } from "./table-names-BIHjuEFK.js";
7
7
  import { installRequestStandardContext } from "@vite-hub/runtime/internal/h3";
8
8
  import { configuredPublicOrigins } from "@vite-hub/runtime/internal/public-url";
@@ -38,7 +38,7 @@ function defineCommentsPlugin(options) {
38
38
  warned = true;
39
39
  throw Object.assign(commentsErrorDiagnostics.COMMENTS_R0010(), { status: 503 });
40
40
  }
41
- const { installComments } = await import("./install-D6hXZaSN.js").then((n) => n.n);
41
+ const { installComments } = await import("./install-CqBWFmU7.js").then((n) => n.n);
42
42
  return installComments(options.comments, {
43
43
  database,
44
44
  development: options.development === true,
@@ -97,7 +97,7 @@ function defineCommentsPlugin(options) {
97
97
  });
98
98
  installViteHubPageTools(nitroApp, {
99
99
  base: options.base,
100
- origins: options.development === true ? [] : configuredPublicOrigins()
100
+ origins: options.development === true ? [] : configuredPublicOrigins
101
101
  });
102
102
  };
103
103
  }
@@ -9,7 +9,10 @@ import { RealtimeDefinition } from "@vite-hub/realtime";
9
9
  * Guests name themselves in the browser. ViteHub adds it as the `comments` definition when the host has a room
10
10
  * authority.
11
11
  */
12
- export declare function commentsRealtime(comments: Comments, options?: CommentsSessionOptions, purpose?: "presence" | "notices"): RealtimeDefinition;
12
+ export declare function commentsRealtime(comments: Comments, options?: CommentsSessionOptions, purpose?: "presence" | "notices"): Extract<RealtimeDefinition, {
13
+ document: false;
14
+ identify: NonNullable<RealtimeDefinition["identify"]>;
15
+ }>;
13
16
  /** The notice that tells the open pages of a thread to load their threads again. */
14
17
  export declare const commentsChangeNotice: {
15
18
  readonly type: "comments";
package/dist/realtime.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { i as text } from "./identity-CT7-UGmS.js";
2
2
  import { c as normalizeCommentPage, n as commentRoom, r as commentsNoticeDefinition, t as commentNoticeRoom } from "./page-2NzFladc.js";
3
- import { n as resolveCommentsPage, t as resolveCommentsIdentity } from "./session-CCRLR9bf.js";
3
+ import { n as resolveCommentsPage, t as resolveCommentsIdentity } from "./session-DGdFKWDB.js";
4
4
  // src/realtime.ts
5
5
  function toRealtimeUser(user) {
6
6
  const result = { id: user.id };
@@ -2,6 +2,11 @@
2
2
  function firstHeaderValue(headers, name) {
3
3
  return headers.get(name)?.split(",", 1)[0]?.trim() || void 0;
4
4
  }
5
+ const applicationOriginKey = Symbol.for("vitehub.request.application-origin");
6
+ const requestGlobals = globalThis;
7
+ function applicationRequestOrigin(request) {
8
+ return requestGlobals[applicationOriginKey]?.get(request) ?? forwardedRequestOrigin(request);
9
+ }
5
10
  /**
6
11
  * The origin that the client used for `request`. A TLS-terminating proxy sends the client scheme in
7
12
  * `X-Forwarded-Proto` and the client host in `X-Forwarded-Host`. Each proxy appends its value, so the first value wins.
@@ -45,4 +50,4 @@ function isSecureOrigin(origin) {
45
50
  if (protocol !== "http:") return false;
46
51
  return isLoopbackHostname(hostname) || hostname.endsWith(".localhost");
47
52
  }
48
- export { isSecureOrigin as n, matchesPublicOrigin as r, forwardedRequestOrigin as t };
53
+ export { isSecureOrigin as n, matchesPublicOrigin as r, applicationRequestOrigin as t };
@@ -1,5 +1,5 @@
1
1
  import { n as isRecordOrFunction, t as isRecord } from "./object-CAK6UYR5.js";
2
- import { i as commentsUnansweredError, t as commentsAnswerError } from "./client-diagnostics-D987sEK7.js";
2
+ import { i as commentsUnansweredError, t as commentsAnswerError } from "./client-diagnostics-DoXqdnBd.js";
3
3
  import { i as withCommentFiles, n as outboxAccountHeader, r as retryAfterOf } from "./client-files-lC6X7XyS.js";
4
4
  import { createBirpc } from "birpc";
5
5
  // ../internal/src/operation-rpc.ts
package/dist/rpc.js CHANGED
@@ -1 +1 @@
1
- export { t as createRpcTransport } from "./rpc-BYmbVkr8.js";
1
+ export { t as createRpcTransport } from "./rpc-kkxzQ3Qy.js";
@@ -1,4 +1,4 @@
1
- import { n as createAuthUsers } from "../server-DvSehkPP.js";
1
+ import { n as createAuthUsers } from "../server-8o9u8leM.js";
2
2
  import { getStandardContext } from "@vite-hub/runtime/internal/h3";
3
3
  // src/runtime/auth.ts
4
4
  const authServer = () => import("@vite-hub/auth/internal/server");