@vite-hub/comments 0.3.1 → 0.5.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.
- package/README.md +37 -15
- package/dist/anchor.d.ts +2 -2
- package/dist/{client-diagnostics-CcFpkbAk.js → client-diagnostics-Bubm7Shd.js} +20 -5
- package/dist/client-files-CJZl5Kc4.js +53 -0
- package/dist/client.d.ts +567 -13
- package/dist/client.js +1209 -34
- package/dist/{console-h4KlhIik.d.ts → console-D1lwNMZn.d.ts} +2 -0
- package/dist/{migrate-BDQ8xqUs.js → database-6hXRnqDE.js} +47 -2
- package/dist/database-CTo7mx6t.d.ts +575 -0
- package/dist/database.d.ts +2 -1
- package/dist/database.js +2 -2
- package/dist/{define-43mMR39K.js → define-BMBSVbD9.js} +1 -1
- package/dist/{define-B3TF9zzn.d.ts → define-CmIFU96x.d.ts} +8 -4
- package/dist/{errors-4gelGVmK.js → errors-BJTZ9iyv.js} +24 -0
- package/dist/{errors-C6qptPoG.js → errors-Dq4AHjza.js} +23 -3
- package/dist/index-RiHzmV16.d.ts +194 -0
- package/dist/index.d.ts +6 -7
- package/dist/index.js +57 -9
- package/dist/{install-W9ghhGoh.d.ts → install-BGGQKbQ4.d.ts} +9 -3
- package/dist/{install-BcMPgPk_.js → install-DrAse1Fa.js} +912 -60
- package/dist/{installed-B-PfERBU.js → installed-C3EoqJEY.js} +7 -6
- package/dist/{operations-GLeOqgMt.d.ts → operations-BKhUWYkb.d.ts} +10 -5
- package/dist/{operations-D4A1Fcgf.d.ts → operations-VyyNZusz.d.ts} +13 -2
- package/dist/{operations-DMMIfYPW.js → operations-lsVKE0GH.js} +312 -219
- package/dist/operations.d.ts +2 -2
- package/dist/operations.js +2 -2
- package/dist/overlay/client-DBmJ4C1M.js +4 -0
- package/dist/overlay/overlay.js +41 -65
- package/dist/page/loader.js +39 -47
- package/dist/{page-DtbMOEMd.d.ts → page-Bzj0CszG.d.ts} +1 -10
- package/dist/{page-B41ozN63.js → page-DRz_sDY4.js} +1 -1
- package/dist/{page-tools-shared-NHUjKI8E.js → page-tools-shared-BNnuPK93.js} +6 -3
- package/dist/{plugin-PS8PMYus.js → plugin-DRsNaJaK.js} +34 -8
- package/dist/realtime.d.ts +2 -2
- package/dist/realtime.js +2 -2
- package/dist/reply-id-P_bSuEng.js +12 -0
- package/dist/request-log-Dj9Vw7qG.js +105 -0
- package/dist/request-origin-CFU0TQ7E.js +49 -0
- package/dist/{rpc-RKPAusHp.js → rpc-BQqYx8kb.js} +23 -7
- package/dist/{rpc-HBcWtg0T.d.ts → rpc-CuJ5GLIz.d.ts} +1 -1
- package/dist/rpc.d.ts +1 -1
- package/dist/rpc.js +1 -1
- package/dist/runtime/auth.d.ts +2 -2
- package/dist/runtime/auth.js +2 -2
- package/dist/runtime/console.d.ts +1 -1
- package/dist/runtime/console.js +3 -3
- package/dist/runtime/index.d.ts +42 -13
- package/dist/runtime/index.js +224 -22
- package/dist/{server-D8k-0GXe.js → server-Yk610niJ.js} +1 -1
- package/dist/server.d.ts +6 -5
- package/dist/server.js +6 -6
- package/dist/service-Bj-Mg63c.d.ts +73 -0
- package/dist/{service-GHhhyQj4.js → service-DA5BwfPQ.js} +71 -14
- package/dist/{session-DVx-1Tym.d.ts → session-DUcEor2W.d.ts} +3 -3
- package/dist/{session-EkudzUmm.js → session-X_g9dnU5.js} +27 -30
- package/dist/{service-CFVm23k7.d.ts → store-CsUNfC1w.d.ts} +11 -72
- package/dist/table-names-B9LlRC0B.js +16 -0
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +38 -5
- package/dist/{types-CZujrMFd.d.ts → types-BLaYh0_f.d.ts} +48 -4
- package/dist/{types-BIS0hCEl.d.ts → types-C35INXIs.d.ts} +88 -4
- package/dist/vite.d.ts +24 -7
- package/dist/vite.js +322 -173
- package/package.json +9 -9
- package/dist/errors-CyQyKAvy.d.ts +0 -185
- package/dist/index-DNhy69Wt.d.ts +0 -83
- package/dist/overlay/client-DmsSMOzi.js +0 -4
package/dist/page/loader.js
CHANGED
|
@@ -1,33 +1,31 @@
|
|
|
1
|
-
const e=`vitehub`,t=[`comment`];function n(e,n){let r=new URLSearchParams(e);if(r.has(`vitehub`)||t.some(e=>r.has(e)))return!0;let i=n.split(`;`).map(e=>e.trim());return i.includes(`vitehub-tools=1`)?!0:i.includes(`vitehub_session=1`)&&!i.some(e=>e.startsWith(`vitehub-tools=`))}const r=`/_vitehub/page/session`,i=`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,scale;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 ee;function te(){let e=Reflect.get(globalThis,E);if(e&&e!==ee&&typeof e==`object`&&`define`in e&&`install`in e)return e}function ne(e){ee=e,Reflect.get(globalThis,E)||Reflect.set(globalThis,E,e)}function re(e){let t=[...w.values()];w.clear();for(let n of t)n.removeFromShared=e.define(n.effect,n.isReduced)}function ie(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 D(){return[...w.values()].map(e=>e.effect)}function ae(){return[...w.values()]}function oe(e){return T.add(e),()=>T.delete(e)}function O(e,t){for(let[n,r]of Object.entries(t))r?e.style.setProperty(n,r):e.style.removeProperty(n)}const k=/* @__PURE__ */ new Map;let A;const j=/* @__PURE__ */ new Map;let M,se=[];const ce=Symbol.for(`vite-hub.motion.effect-presses`),le=e=>{let t=Reflect.get(e,ce);if(t)return t;let n=/* @__PURE__ */ new Map;return Reflect.set(e,ce,n),n},ue=/* @__PURE__ */ new Set;function de(e,t){if(ue.has(t))return!1;try{return e.matches(t)}catch{return ue.add(t),!1}}function fe(e){let t=e;for(;;){for(let e of k.keys())if(e instanceof Element&&e.contains(t))return!0;let e=t.getRootNode();if((e instanceof Document||e instanceof ShadowRoot)&&k.has(e))return!0;if(!(e instanceof ShadowRoot))return!1;t=e.host}}function pe(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&&de(e,t));return r===-1||r<=n||!fe(e[r])?void 0:e[r]}function me(e,t,n){N(e,!0);let r=le(t),i=[];for(let{effect:a,isReduced:o}of ae()){if(!a.press||o())continue;let s=pe(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=()=>he(e,u,!0),s.addEventListener(`pointerleave`,u.leave,{once:!0})),i.push(u)}i.length&&(j.set(e,i),i.some(e=>e.press.move)&&document.addEventListener(`pointermove`,ye,{capture:!0,passive:!0}))}function N(e,t=!1){let n=j.get(e);if(n){j.delete(e);for(let{element:e,press:r,leave:i}of n)i&&e.removeEventListener(`pointerleave`,i),t&&r.cancel?r.cancel():r.release();ge()}}function he(e,t,n=!1){let r=j.get(e),i=r?.indexOf(t)??-1;r&&i!==-1&&(t.leave&&t.element.removeEventListener(`pointerleave`,t.leave),r.splice(i,1),r.length||j.delete(e),n&&t.press.cancel?t.press.cancel():t.press.release(),ge())}function ge(){[...j.values()].some(e=>e.some(e=>e.press.move))||document.removeEventListener(`pointermove`,ye,{capture:!0})}function _e(e){if(e.button!==0)return;let t=e.composedPath();e.isPrimary&&(M={event:e,path:t}),me(e.pointerId,e,t)}function ve(e){M?.event.pointerId===e.pointerId&&(M=void 0),N(e.pointerId,e.type===`pointercancel`)}function ye(e){for(let{press:t}of j.get(e.pointerId)??[])t.move?.(e)}function be(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]`)||me(`key`,e,t)}function xe(e){(e.key===` `||e.key===`Enter`)&&N(`key`)}function Se(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);if(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);continue}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)de(e,t.selector)&&!S(e)&&t.content(e,{added:r,removed:i,oldText:o})}}function Ce(e){if(!M||!e.matches(`[role=separator][data-panel-resize-handle-id]`))return;let t=ae().find(({effect:e})=>e.name===`divider`);if(!t||t.isReduced())return;let{event:n,path:r}=M,i=j.get(n.pointerId)??[],a=i.find(t=>t.splitter&&t.element===e);if(e.getAttribute(`data-resize-handle-active`)!==`pointer`){a&&he(n.pointerId,a);return}if(a||!r.includes(e.getRootNode())||!fe(e)||S(e))return;let o=t.effect.press?.(e,n);o&&(i.push({element:e,press:o,splitter:!0}),j.set(n.pointerId,i),document.addEventListener(`pointermove`,ye,{capture:!0,passive:!0}))}function we(e){let t=[...new Set(e)],n=D(),r=/* @__PURE__ */ new Map;Se(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`){Ce(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&&de(t,r.selector)&&!S(t)&&r.state(t,{attribute:i,oldValue:e.oldValue,value:a});continue}for(let t of e.addedNodes)if(t instanceof HTMLElement&&t.isConnected)for(let e of n){if(!e.enter)continue;let n=de(t,e.selector);if(ue.has(e.selector))continue;let r=[...n?[t]:[],...t.querySelectorAll(e.selector)];for(let t of r)S(t)||e.enter(t)}}}function Te(e,t){let n=D().some(e=>e.content);t.observe(e,{attributes:!0,attributeFilter:[...C,...D().some(e=>e.name===`divider`)?[`data-resize-handle-active`]:[]],attributeOldValue:!0,childList:n||D().some(e=>e.enter),characterData:n,characterDataOldValue:n,subtree:!0})}function Ee(e,t){let n=D();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 De(){let e={capture:!0,passive:!0};document.addEventListener(`pointerdown`,_e,e),document.addEventListener(`pointerup`,ve,e),document.addEventListener(`pointercancel`,ve,e),document.addEventListener(`keydown`,be,e),document.addEventListener(`keyup`,xe,e),se=[()=>{document.removeEventListener(`pointerdown`,_e,e),document.removeEventListener(`pointerup`,ve,e),document.removeEventListener(`pointercancel`,ve,e),document.removeEventListener(`keydown`,be,e),document.removeEventListener(`keyup`,xe,e),M=void 0;for(let e of j.keys())N(e,!0)},s(e=>{if(e){M=void 0;for(let e of j.keys())N(e,!0)}})]}function P(e,t){if(typeof document>`u`)return()=>{};let n=te();return n?(re(n),n.install(e,t.effects,o)):(ne(Oe),ke(e,t.effects))}const Oe={define:ie,install:ke};function ke(e,t,n=o){let r=new Set(D().map(e=>e.name));for(let e of t)r.has(e.name)||ie(e,n);if(!A){De();let e=new MutationObserver((e,t)=>we(e.concat(t.takeRecords())));A=e,se.push(oe(()=>{for(let[t,{watchers:n}]of k)Te(t,e),Ee(t,n)}))}let i=k.get(e);if(i)i.installs++;else{let t=/* @__PURE__ */ new Map;Te(e,A),k.set(e,{installs:1,watchers:t}),Ee(e,t)}let a=!1;return()=>{if(a)return;a=!0;let t=k.get(e);if(!t||--t.installs>0)return;k.delete(e);let n=A,r=n.takeRecords();n.disconnect();for(let e of t.watchers.values())e();if(k.size){for(let e of k.keys())Te(e,n);r.length&&queueMicrotask(()=>{if(A!==n)return;let e=[...k.keys()];we(r.filter(t=>e.some(e=>e.contains(t.target))))});return}A=void 0;for(let e of se)e();se=[]}}function Ae(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 je(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 Me(e,t){return window.setTimeout(t,e*h())}function Ne(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 Pe=e=>e;function Fe(e,t,n,r,i){let a=(n.delay??0)/1e3,s=n.duration/1e3,c=n.ease??Pe,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 Ie(e,t,n=Pe,r=0){let i=()=>{},a=new Promise(e=>i=e),o=Fe(0,1,{duration:e*1e3,delay:r*1e3,ease:n},t,()=>i(!0));return{done:a,stop:()=>{o.stop(),i(!1)}}}const Le={stiffness:900,damping:40},Re={stiffness:380,damping:14},ze=`: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])`,Be=/* @__PURE__ */ new WeakMap,Ve=e=>e>=40?.03:e>=32?.04:.05;function He(e){let t=e.dataset.motionPressTarget?e.closest(e.dataset.motionPressTarget):null;if(t instanceof HTMLElement)return{target:t,amount:Ve(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:Ve(e.offsetHeight)}}function Ue(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 We(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 Ge={name:`press`,selector:ze,press(e,t){let{target:n,amount:r}=He(e),i=getComputedStyle(n);if(Ue(i)||i.display===`contents`||i.display===`inline`&&n===e&&!(e instanceof HTMLInputElement))return;let a;if(n===e&&`pointerId`in t&&(a=e.getBoundingClientRect(),We(a,t,r)))return;let o=Be.get(n);if(!o){let e={amount:r,spring:x(0,t=>{O(n,{scale:t?String(1-e.amount*t):null})},Le)};o=e,Be.set(n,o)}o.amount=r;let{spring:s}=o;s.to(1,{preset:Le});let c=!1,l=()=>{c||(c=!0,s.set(0))};return{move:a?e=>{We(a,e,r)&&l()}:void 0,release:()=>{c||s.to(0,{preset:Re})},cancel:l}}},F={stiffness:480,damping:36},Ke={stiffness:380,damping:26},I={stiffness:440,damping:32},qe=.24,Je=.14,Ye=.15,L=/* @__PURE__ */ new WeakMap,R=/* @__PURE__ */ new Set,Xe=/* @__PURE__ */ new Set;let z;function Ze(e){let t=getComputedStyle(e);return t.clipPath===`inset(50%)`||t.clip===`rect(0px, 0px, 0px, 0px)`}function Qe(e){return e.matches(`[role=tooltip]`)?e:e.querySelector(`:scope > [role=tooltip]`)}const $e=`[data-motion-appear]`;function et(e){if(e.matches($e))return e;if(e.matches(`[role=tooltip]`))return Ze(e)?e.parentElement:e;let t=e.querySelector(`:scope > [role=tooltip]`);return t&&Ze(t)?e:null}function tt(e){let t=e.getAttribute(`data-state`);return t===null?!e.hidden&&!e.hasAttribute(`data-closed`):t!==`closed`}function nt(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=Qe(e)?.id;return n?e.getRootNode().querySelector(`[aria-describedby~="${CSS.escape(n)}"]`)??document.querySelector(`[aria-describedby~="${CSS.escape(n)}"]`):null}function rt(e){let t=[`translate`,`scale`,`clip-path`,`opacity`].map(t=>[t,e.style.getPropertyValue(t)]);O(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 it(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=n.left+n.width/2-(t.left+t.width/2),a=n.top+n.height/2-(t.top+t.height/2);return Math.abs(a)>=Math.abs(i)?a>0?`top`:`bottom`:i>0?`left`:`right`}function at(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 ot=e=>e===`top`||e===`bottom`;function st(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 B(e){return[...e.element.children].filter(t=>t instanceof HTMLElement&&t!==e.old?.element&&!t.matches(`[role=tooltip]`)&&!Ze(t))}function ct(e){return[...e.element.childNodes].filter(t=>t.nodeType===Node.TEXT_NODE||t instanceof Element&&t!==e.old?.element&&!t.matches(`[role=tooltip]`)&&!Ze(t)).map(e=>e.textContent??``).join(``)}function lt(e){return[...e.childNodes].some(e=>e.nodeType===Node.TEXT_NODE&&e.textContent?.trim())}const V=e=>`${Math.round(e*100)/100}px`;function H(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(V).join(` `)} round ${e.radius})`}else p&&(m=`inset(${f.map(V).join(` `)})`);O(t,{translate:Math.abs(u)>.01||Math.abs(d)>.01||e.old?`${V(u)} ${V(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 B(e))O(t,{scale:h,opacity:g<1?String(g):null,filter:g<1?`blur(${V((1-g)*6)})`:null});if(e.old){let t=e.old.spring.value;O(e.old.element,{scale:h,opacity:String(t),filter:`blur(${V((1-t)*5)})`})}}function U(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,O(e.element,{translate:null,scale:null,"clip-path":null,opacity:null});for(let t of B(e))O(t,{scale:null,opacity:null,filter:null});e.done?.()}}function ut(e,t,n){let r=getComputedStyle(e),i=it(e,t,n),a={element:e,rest:t,origin:Number.parseFloat(r.transformOrigin)||t.width/2,side:i,edge:at(i,t,n),trigger:n,mode:lt(e)||e.matches($e)?`clip`:`scale`,handoff:!e.matches($e),radius:r.borderRadius||`0px`,timers:/* @__PURE__ */ new Set,holding:!0},o=()=>{H(a),U(a)};return a.x=x(t.left+t.width/2,o,F),a.y=x(t.top+t.height/2,o,F),a.width=x(t.width,o,I),a.label=x(1,o),a.fade=x(1,o),a}function W(e,t,n){let r=Me(t,()=>{e.timers.delete(r),n(),U(e)});e.timers.add(r)}function dt(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 G(e){dt(e),Xe.delete(e),z===e&&(z=void 0),e.element.closest(`[data-motion=none]`)?.remove()}function ft(e){if(e){for(let e of Xe)G(e);for(let e of R){let t=L.get(e)?.box;t&&(dt(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,U(t))}}}function pt(e,t){let n=e.trigger,r=t.trigger;return!n||!r||e.side!==t.side?!1:ot(t.side)?n.top<r.bottom&&r.top<n.bottom:n.left<r.right&&r.left<n.right}function mt(e){return ot(e.side)?e.y:e.x}function ht(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,()=>{H(e),U(e)});e.old={element:r,spring:i},i.to(0,{tween:.15})}function gt(e){return e.mode===`clip`?[...e.element.childNodes].filter(e=>e.nodeType===Node.TEXT_NODE).map(e=>e.cloneNode()):B(e).map(e=>{let t=e.cloneNode(!0);return t.style.removeProperty(`scale`),t.style.removeProperty(`opacity`),t.style.removeProperty(`filter`),t})}function _t(e,t){let n=t.trigger?.getBoundingClientRect(),r=rt(e),i=ut(e,r,n);t.box=i,t.text=ct(i),t.label=gt(i),O(e,{opacity:null});let a=i.handoff&&z&&pt(z,i)?z:void 0;if(a&&(z=void 0),o()){a&&vt(a,!0),i.fade.set(0),i.holding=!1,i.fade.to(1,{tween:Ye});return}if(a){let e=gt(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;G(a),i.x.set(t.x[0]),i.y.set(t.y[0]),i.width.set(t.width[0]),i.label.set(0),ht(i,e,n),i.x.to(r.left+r.width/2,{preset:F,velocity:t.x[1]}),i.y.to(r.top+r.height/2,{preset:F,velocity:t.y[1]}),i.width.to(r.width,{preset:I,velocity:t.width[1]}),W(i,40,()=>i.label.to(1,{tween:qe})),i.holding=!1,H(i);return}mt(i).set(st(i)),i.width.set(Math.min(30,r.width)),i.label.set(0),H(i),mt(i).to(ot(i.side)?r.top+r.height/2:r.left+r.width/2,{preset:Ke}),W(i,120,()=>{i.width.to(r.width,{preset:I}),W(i,70,()=>i.label.to(1,{tween:qe}))}),i.holding=!1}function vt(e,t){if(Xe.add(e),e.holding=!1,t){e.done=()=>G(e),e.fade.to(0,{tween:Ye});return}e.handoff&&(z=e),e.old&&e.old.spring.to(0,{tween:Je}),e.label.to(0,{tween:Je}),e.width.to(Math.min(30,e.rest.width),{preset:I}),W(e,90,()=>{z===e&&(z=void 0),mt(e).to(st(e),{preset:Ke})}),W(e,520,()=>G(e))}function yt(e,t){if(!t.open)return;t.open=!1,R.delete(e),t.stopWatch?.(),t.stopWatch=void 0,R.size||At();let n=t.box;if(t.box=void 0,O(e,{opacity:null}),!n)return;let r=t.root.parentNode??t.parent,i=r?.isConnected?Ae(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;dt(n),n.old?.element.remove(),O(e,{translate:null,scale:null,"clip-path":null,opacity:null});for(let e of B(n))O(e,{scale:null,opacity:null,filter:null});if(!i)return;let l=bt(t.root,e).reduce((e,t)=>e?.children[t],i);if(!(l instanceof HTMLElement)){i.remove();return}e.hasAttribute(`popover`)&&(O(l,{scale:null}),je(l,n.rest));let u=ut(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,()=>H(u))});for(let e of[`x`,`y`,`width`,`label`,`fade`])u[e].set(s[e][0]);H(u);for(let e of[`x`,`y`,`width`])s[e][1]&&u[e].to(s[e][0],{velocity:s[e][1]});vt(u,o())}function bt(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 xt(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 xt(e,t,n,r-1);n()})}function St(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()):yt(e,t)});return n(),()=>r.disconnect()}function Ct(e){let t=L.get(e);if(t?.open)return;let n=nt(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},L.set(e,t),R.add(e),kt(),O(e,{opacity:`0`}),t.stopWatch=St(e,t);let i=t;xt(e,t,()=>_t(e,i))}let wt=0;function Tt(){wt=0;for(let e of R){let t=L.get(e),n=t?.box;if(!t||!n)continue;let r=rt(e),i=ct(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=nt(e)??t.trigger;let s=t.trigger?.getBoundingClientRect();if(t.text=i,t.label=gt(n),n.rest=r,n.side=it(e,r,s),n.edge=at(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);continue}n.x.to(r.left+r.width/2,{preset:F}),n.y.to(r.top+r.height/2,{preset:F}),n.width.to(r.width,{preset:I}),a.length&&(n.old?.spring.stop(),n.old?.element.remove(),ht(n,a,n.label.value),n.label.set(0),W(n,40,()=>n.label.to(1,{tween:qe})))}}function Et(){wt||=requestAnimationFrame(Tt)}let Dt=!1,Ot;function kt(){Ot??=s(ft),!Dt&&(Dt=!0,document.addEventListener(`pointerover`,Et,{capture:!0,passive:!0}),document.addEventListener(`focusin`,Et,{capture:!0,passive:!0}))}function At(){Dt=!1,cancelAnimationFrame(wt),wt=0,document.removeEventListener(`pointerover`,Et,{capture:!0}),document.removeEventListener(`focusin`,Et,{capture:!0})}const jt={enter(e){et(e)===e&&tt(e)&&Ct(e)},state(e){if(et(e)!==e)return;let t=L.get(e);tt(e)?Ct(e):t&&yt(e,t)}};({...jt});const Mt={name:`appear`,selector:$e,...jt};function Nt(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 Pt={stiffness:380,damping:26},Ft={stiffness:260,damping:28},It=.9,Lt=Ne(.5,0,.75,0),Rt=`data-motion-ghost`,K=e=>({x:e.left+e.width/2,y:e.top+e.height/2});function zt(e){return e.bottom>0&&e.right>0&&e.top<innerHeight&&e.left<innerWidth&&e.width+e.height>0}function Bt(e){return[...e.children].filter(e=>e instanceof HTMLElement&&!e.hasAttribute(Rt))}function Vt(e,t={}){let n=t.items??Bt,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){O(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;O(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,Pt),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(),O(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(!zt(n))return;let a=e.getBoundingClientRect();getComputedStyle(e).position===`static`&&(e.style.position=`relative`);let s=Nt(t);s.setAttribute(Rt,``),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`}),O(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=Ie(.15,e=>O(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=Ie(.32,n=>{O(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})},Lt);c.stop=i.stop,i.done.then(l);return}let u=x(1,e=>{O(s,{scale:(It+.09999999999999998*e).toFixed(4),opacity:Math.max(0,e).toFixed(3)}),e<.02&&l()},Ft);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(!zt(a.rect)&&!zt(n))return f(e);let o=d(e);p(o.x,o.x.value+t),p(o.y,o.y.value+i);return}if(!zt(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:It};s.grow.set(0),s.grow.to(1,o()?{tween:.15}:{preset:Pt})}),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 Ht=`vitehub`,Ut=[`comment`];function Wt(e,t){let n=new URLSearchParams(e);if(n.has(`vitehub`)||Ut.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 Gt=`/_vitehub/page/tools`,Kt=`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
|
-
button:where(:not(:disabled):active){scale:.96}
|
|
4
3
|
button[aria-pressed=true],button[aria-expanded=true]{background:var(--vitehub-pill-on);color:var(--vitehub-pill-on-text)}
|
|
5
4
|
:host([aria-busy=true]) button,button[aria-busy=true]{background:var(--vitehub-pill-on);color:var(--vitehub-pill-on-text);cursor:progress}
|
|
6
5
|
button:focus-visible{outline:2px solid var(--vitehub-pill-on);outline-offset:1px}
|
|
7
6
|
button svg{width:14px;height:14px;flex:none}
|
|
8
7
|
@media(any-pointer:coarse){button{min-width:44px;height:44px}}
|
|
9
|
-
@media(prefers-reduced-motion:reduce){button{transition:none}}`;function
|
|
10
|
-
:host([collapsed]){--margin:2px;--vitehub-pill-
|
|
11
|
-
:host(:is([edge=top],[edge=bottom])){left:${
|
|
12
|
-
:host(:is([edge=left],[edge=right])){top:${
|
|
8
|
+
@media(prefers-reduced-motion:reduce){button{transition:none}}`;function qt(e){let t=new URL(e,`http://localhost`).pathname,n=t.lastIndexOf(`/_vitehub/page/assets/`);return n===-1?Gt:`${t.slice(0,n)}${Gt}`}function q(e){return typeof e==`string`&&e?e:void 0}function Jt(e){if(typeof e!=`object`||!e)return;let t=q(Reflect.get(e,`id`)),n=q(Reflect.get(e,`script`));if(!t||!n)return;let r={id:t,label:q(Reflect.get(e,`label`))??t,icon:q(Reflect.get(e,`icon`))??``,script:n};Reflect.get(e,`lazy`)===!0&&(r.lazy=!0);let i=q(Reflect.get(e,`hotkey`));i&&(r.hotkey=i);let a=q(Reflect.get(e,`param`));return a&&(r.param=a),r}function Yt(e){if(typeof e!=`object`||!e)return;let t=q(Reflect.get(e,`name`)),n=q(Reflect.get(e,`signOut`));if(!t||!n?.startsWith(`/`)||n.startsWith(`//`)||n.includes(`\\`))return;let r={name:t,signOut:n},i=q(Reflect.get(e,`email`));i&&(r.email=i);let a=q(Reflect.get(e,`image`));return a&&/^https?:\/\//i.test(a)&&(r.image=a),Reflect.get(e,`via`)===`console`&&(r.via=`console`),r}function Xt(e){let t=typeof e==`object`&&e?Reflect.get(e,`tools`):void 0,n={tools:Array.isArray(t)?t.map(Jt).filter(e=>!!e):[]},r=typeof e==`object`&&e?Yt(Reflect.get(e,`account`)):void 0;return r&&(n.account=r),n}const J={effects:[Ge]},Zt=[[`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%`]],Qt=e=>e.map(([e,t])=>[`calc(50% + var(--vitehub-hex-w) * ${e})`,`calc(50% + var(--vitehub-hex-h) * ${t})`]),$t=Qt([[-.28,-.453],[-.208,-.5],[.208,-.5],[.28,-.453],[.488,-.047],[.488,.047],[.28,.453],[.208,.5],[-.208,.5],[-.28,.453],[-.488,.047],[-.488,-.047]]),en=Qt([[-.5,-.5],[-.5,-.5],[.5,-.5],[.5,-.5],[.5,0],[.5,0],[.5,.5],[.5,.5],[-.5,.5],[-.5,.5],[-.5,0],[-.5,0]]),tn=e=>`polygon(${e.map(([e,t])=>`${e} ${t}`).join(`,`)})`;function nn(e,t,n){let r=(1-n).toFixed(4),i=n.toFixed(4);return tn(e.map(([e,n],a)=>[`calc(${e} * ${r} + ${t[a][0]} * ${i})`,`calc(${n} * ${r} + ${t[a][1]} * ${i})`]))}const rn=tn(Zt),an=tn($t),on=tn(en),Y=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)}
|
|
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:${Y(`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:${Y(`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}
|
|
13
12
|
:host([edge=bottom]){bottom:max(16px,var(--safe-bottom))}
|
|
14
13
|
:host([edge=top]){top:max(16px,var(--safe-top))}
|
|
15
14
|
:host([edge=right]){right:max(16px,var(--safe-right))}
|
|
16
15
|
:host([edge=left]){left:max(16px,var(--safe-left))}
|
|
17
|
-
:host([collapsed]:is([edge=top],[edge=bottom])){left:${
|
|
18
|
-
:host([collapsed]:is([edge=left],[edge=right])){top:${
|
|
16
|
+
:host([collapsed]:is([edge=top],[edge=bottom])){left:${Y(`var(--vitehub-hex-w)`)};--x:-50%}
|
|
17
|
+
:host([collapsed]:is([edge=left],[edge=right])){top:${Y(`var(--vitehub-hex-h)`)};--y:-50%}
|
|
19
18
|
:host([collapsed][edge=bottom]){bottom:calc(max(2px,var(--safe-bottom)) + var(--vitehub-hex-h) / 2);--y:50%}
|
|
20
19
|
:host([collapsed][edge=top]){top:calc(max(2px,var(--safe-top)) + var(--vitehub-hex-h) / 2);--y:-50%}
|
|
21
20
|
:host([collapsed][edge=right]){right:calc(max(2px,var(--safe-right)) + var(--vitehub-hex-w) / 2);--x:50%}
|
|
22
21
|
:host([collapsed][edge=left]){left:calc(max(2px,var(--safe-left)) + var(--vitehub-hex-w) / 2);--x:-50%}
|
|
23
|
-
:host{translate
|
|
22
|
+
:host{transform:translate(var(--x,0),var(--y,0))}
|
|
24
23
|
:host([dragging]){transition:none;cursor:grabbing;user-select:none;-webkit-user-select:none}
|
|
25
|
-
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
|
|
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:${rn};transition:background-color 150ms ease-out}
|
|
26
25
|
:host(:is([edge=left],[edge=right])) div{display:grid;grid-template-columns:auto 1fr;align-items:stretch;gap:8px 2px}
|
|
27
|
-
:host([collapsed]) div{clip-path:${
|
|
26
|
+
:host([collapsed]) div{clip-path:${an}}
|
|
28
27
|
@media(hover:hover){:host([collapsed]) div:hover{background:rgb(38 38 38/94%)}}
|
|
29
|
-
:host([
|
|
30
|
-
:host([dragging]) div{transition:none;scale:none}
|
|
28
|
+
:host([dragging]) div{transition:none}
|
|
31
29
|
::slotted(*){flex-shrink:0;display:flex;flex-direction:var(--vitehub-pill-flow);align-items:center;gap:2px;transition:var(--vitehub-pill-fade)}
|
|
32
30
|
:host(:is([edge=left],[edge=right])) ::slotted(*){grid-column:1/-1;align-items:stretch}
|
|
33
31
|
::slotted([hidden]){display:none!important}
|
|
@@ -45,29 +43,29 @@ div{position:relative;box-sizing:border-box;max-width:calc(100vw - 32px);max-hei
|
|
|
45
43
|
:host([edge=top]) ::slotted([slot=tab]){border-top:0;border-radius:0 0 10px 10px}
|
|
46
44
|
:host([edge=left]) ::slotted([slot=tab]){border-left:0;border-radius:0 10px 10px 0}
|
|
47
45
|
:host([edge=right]) ::slotted([slot=tab]){border-right:0;border-radius:10px 0 0 10px}
|
|
48
|
-
${
|
|
46
|
+
${Kt}
|
|
49
47
|
button{flex-shrink:0;padding:0;justify-content:center}
|
|
50
|
-
.exit{position:sticky;right:0;bottom:0;transition:background-color 150ms,color 150ms,
|
|
48
|
+
.exit{position:sticky;right:0;bottom:0;transition:background-color 150ms,color 150ms,var(--vitehub-pill-fade-end)}
|
|
51
49
|
:host(:is([edge=left],[edge=right])) .mark{justify-self:start}
|
|
52
50
|
:host(:is([edge=left],[edge=right])) .exit{grid-area:1/2;justify-self:end;top:0;bottom:auto}
|
|
53
51
|
.mark{position:sticky;left:0;top:0;z-index:1;cursor:grab}
|
|
54
52
|
:host([dragging]) .mark{cursor:grabbing}
|
|
55
53
|
.mark,.mark[aria-expanded=true]{background:none;color:var(--vitehub-pill-strong)}
|
|
56
54
|
@media(hover:hover){.mark:hover{background:var(--vitehub-pill-hover)}}
|
|
57
|
-
.mark svg{width:16px;height:16px;transition:opacity 160ms ease-out 120ms
|
|
58
|
-
:host([collapsed]) .mark svg{opacity:0;scale
|
|
59
|
-
:host([collapsed]) .mark:is(:hover,:active){background:none
|
|
60
|
-
:host([collapsed]) .mark{translate
|
|
55
|
+
.mark svg{width:16px;height:16px;transition:opacity 160ms ease-out 120ms}
|
|
56
|
+
:host([collapsed]) .mark svg{opacity:0;transform:scale(.6);transition-duration:40ms;transition-delay:0s}
|
|
57
|
+
:host([collapsed]) .mark:is(:hover,:active){background:none}
|
|
58
|
+
:host([collapsed]) .mark{transform:translate(var(--vitehub-mark-x,0),var(--vitehub-mark-y,0))}
|
|
61
59
|
:host([collapsed]) .mark::before{content:"";position:absolute;inset:-8px}
|
|
62
|
-
:host([fold=mark]){transition
|
|
60
|
+
:host([fold=mark]){transition:filter 240ms ease-out}
|
|
63
61
|
:host([fold=mark][collapsed]){filter:drop-shadow(0 1px 2px rgb(0 0 0/25%))}
|
|
64
|
-
:host([fold=mark]:not([dragging])) div{transition:
|
|
65
|
-
:host([fold=mark][collapsed]) div,:host([fold=mark][collapsed]) div:hover{clip-path:${
|
|
66
|
-
:host([fold=mark]) .mark{transition
|
|
67
|
-
:host([fold=mark]) .mark svg{transition:
|
|
68
|
-
:host([fold=mark][collapsed]) .mark svg{opacity:1;scale
|
|
69
|
-
@media(any-pointer:coarse){:host{--vitehub-hex-h:40px}:host([fold=mark][collapsed]) .mark svg{scale
|
|
70
|
-
@media(prefers-reduced-motion:reduce){:host,div,::slotted(*),.exit,.mark svg,:host([
|
|
62
|
+
: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:${on};background-color:transparent;border-color:transparent}
|
|
64
|
+
:host([fold=mark]) .mark{transition:background-color 150ms ease-out,color 150ms ease-out}
|
|
65
|
+
:host([fold=mark]) .mark svg{transition:none}
|
|
66
|
+
:host([fold=mark][collapsed]) .mark svg{opacity:1;transform:scale(1.5)}
|
|
67
|
+
@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`?en:$t,s=()=>n.querySelector(`svg`),l={x:0,y:0},u=1,d=!1,f,p=[],m=()=>{if(!d&&!g.active&&!_.active&&!v.active){O(t,{"clip-path":null}),O(e,{translate:null}),O(n,{translate:null});let r=s();r&&O(r,{scale:null});for(let e of p)e();p=[],i();return}let r=e.hasAttribute(`collapsed`),o=g.value;O(t,{"clip-path":nn(Zt,a(),o)}),O(e,{translate:`${_.value.toFixed(2)}px ${v.value.toFixed(2)}px`});let c=r?l:{x:0,y:0};O(n,{translate:`${(l.x*o-c.x).toFixed(2)}px ${(l.y*o-c.y).toFixed(2)}px`});let f=s();f&&O(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;return}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`})),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);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=Vt(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)=>{O(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 ee=[P(n,J),P(r,J)];if(t.aborted){for(let e of ee)e();return n}let te=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(),te.disconnect(),T.stop(),S.destroy();for(let e of ee)e()},{once:!0}),(e.parent??document.documentElement).append(n),y(g),t.aborted||(te.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=`${Kt}
|
|
71
69
|
.who{align-self:flex-start;padding:0 3px}
|
|
72
70
|
.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}
|
|
73
71
|
.avatar img{display:block;width:100%;height:100%;object-fit:cover}
|
|
@@ -84,22 +82,20 @@ button{flex-shrink:0;padding:0;justify-content:center}
|
|
|
84
82
|
[role=menuitem] svg{width:15px;height:15px;color:var(--vitehub-pill-muted)}
|
|
85
83
|
[role=menuitem][hidden]{display:none}
|
|
86
84
|
[role=menuitem][aria-disabled=true]{cursor:progress}
|
|
87
|
-
@media(any-pointer:coarse){[role=menuitem]{height:44px}}`;function
|
|
88
|
-
function
|
|
89
|
-
: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
|
|
85
|
+
@media(any-pointer:coarse){[role=menuitem]{height:44px}}`;function Cn(e){return e.trim().split(/\s+/).slice(0,2).map(e=>[...e][0]??``).join(``).toLocaleUpperCase()}function wn(e){let t=document.createElement(`span`);if(t.className=`avatar`,t.setAttribute(`aria-hidden`,`true`),t.textContent=Cn(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 Tn(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 En(){let e=new URL(location.href);for(let t of[Ht,...Ut])e.searchParams.delete(t);return e}function Dn(e){let{account:t,bar:n,signal:r}=e,i=n.parentElement,a=n.attachShadow({mode:`open`});r.addEventListener(`abort`,P(a,J),{once:!0});let o=document.createElement(`style`);o.textContent=Sn;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(wn(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(wn(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=Tn(`<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=Tn(`<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>`,`Sign out of ${location.host}`);s.append(f.item,p.item),a.append(o,c,s);let m=()=>[...s.querySelectorAll(`[role=menuitem]`)].filter(e=>!e.hidden),h,g=e=>{let t=document.documentElement.clientWidth,r=document.documentElement.clientHeight,a=(i??n).getBoundingClientRect(),o=c.getBoundingClientRect(),l={top:`auto`,right:`auto`,bottom:`auto`,left:`auto`};e===`bottom`||e===`top`?(l.right=`${Math.max(8,t-o.right)}px`,e===`bottom`?l.bottom=`${r-a.top+8}px`:l.top=`${a.bottom+8}px`):(o.top<r/2?l.top=`${Math.max(8,o.top)}px`:l.bottom=`${Math.max(8,r-o.bottom)}px`,e===`left`?l.left=`${a.right+8}px`:l.right=`${t-a.left+8}px`),Object.assign(s.style,l)},_=e=>{if(e!==`bottom`&&e!==`top`)return;let t=document.documentElement.clientWidth,n=c.getBoundingClientRect(),r=s.getBoundingClientRect().width;s.style.right=`auto`,s.style.left=`${Math.max(8,Math.min(n.right-r,t-r-8))}px`};if(s.addEventListener(`beforetoggle`,t=>{if(t.newState===`closed`){s.contains(a.activeElement)&&c.focus({preventScroll:!0});return}h=e.openConsole?.(),f.item.hidden=!h;let n=i?.getAttribute(`edge`)??`bottom`;g(n),requestAnimationFrame(()=>_(n))},{signal:r}),s.addEventListener(`toggle`,e=>{let t=e.newState===`open`;c.setAttribute(`aria-expanded`,String(t)),t&&m()[0]?.focus({preventScroll:!0})},{signal:r}),s.addEventListener(`keydown`,e=>{let t=m(),n=t.findIndex(e=>e===a.activeElement),r=e.key===`ArrowDown`?n+1:e.key===`ArrowUp`?n-1:e.key===`Home`?0:e.key===`End`?t.length-1:void 0;r===void 0?e.key===`Escape`?e.stopPropagation():e.key===`Tab`&&s.hidePopover():(e.preventDefault(),t[(r+t.length)%t.length]?.focus())},{signal:r}),f.item.addEventListener(`click`,()=>{s.hidePopover(),h?.()},{signal:r}),p.item.addEventListener(`click`,async()=>{if(p.item.getAttribute(`aria-disabled`)===`true`)return;p.item.setAttribute(`aria-disabled`,`true`),p.label.textContent=`Signing out…`;let e=await fetch(t.signOut,{method:`POST`,credentials:`same-origin`,headers:{"content-type":`application/json`},body:`{}`}).catch(e=>e);if(!(e instanceof Response)||!e.ok){console.error(`[vitehub] The sign-out failed. The session stays.`,e instanceof Response?`The sign-out answered ${e.status}.`:e),p.item.removeAttribute(`aria-disabled`),p.label.textContent=`Could not sign out. Try again`;return}let n=En();n.href===location.href?location.reload():location.replace(n)},{signal:r}),i){let e=new MutationObserver(e=>{e.some(e=>e.oldValue!==i.getAttribute(e.attributeName??``))&&s.hidePopover()});e.observe(i,{attributes:!0,attributeOldValue:!0,attributeFilter:[`collapsed`,`dragging`,`edge`]}),r.addEventListener(`abort`,()=>e.disconnect(),{once:!0})}r.addEventListener(`abort`,()=>s.hidePopover(),{once:!0})}function On(e,...t){return typeof e==`function`?e(...t):e}const kn=Error.captureStackTrace;var An=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,kn?.(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 jn(e,t){return typeof e==`string`?`${e}/${t.toLowerCase()}`:e?.(t)}const Mn=e=>t=>t instanceof An&&e in t;/* @__NO_SIDE_EFFECTS__ */
|
|
86
|
+
function Nn(e){let t=e.reporters??[],n=Symbol(),r=Object.defineProperty({},"is",{value:Mn(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||jn(i,a),c=(e={},r={})=>{let i=new An({code:a,why:On(o.why,e),fix:On(o.fix,e),docs:s,cause:e.cause,sources:e.sources,data:On(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 Pn=/*#__PURE__*/ Nn({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 Fn(e){return Pn.INTERNAL_INVARIANT_FAILED({what:e})}function In(e,t){if(!e)throw Fn(t)}let Z={edge:`bottom`,at:50};const Ln=/* @__PURE__ */ new Set;let Rn=0;function zn(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=Bn(t)===0}function Bn(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 Vn(e){Z=e;for(let e of Ln)zn(e)}function Hn(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 Un(e){let t=document.createElement(`vitehub-window`);t.hidden=!0;let n=t.attachShadow({mode:`open`}),r=document.createElement(`style`);r.textContent=`
|
|
87
|
+
: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}
|
|
90
88
|
:host([collapsed]){--margin:2px}
|
|
91
89
|
:host([edge=top]){--dock:calc(max(var(--margin),var(--safe-top)) + var(--thickness,38px) + 8px);--far:max(16px,var(--safe-bottom))}
|
|
92
90
|
: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
91
|
:host([edge=right]){--dock:calc(max(var(--margin),var(--safe-right)) + var(--thickness,38px) + 8px);--far:max(16px,var(--safe-left))}
|
|
94
92
|
:host([edge=left]){--dock:calc(max(var(--margin),var(--safe-left)) + var(--thickness,38px) + 8px);--far:max(16px,var(--safe-right))}
|
|
95
93
|
:host([hidden]){display:none}
|
|
96
|
-
.window{position:absolute;width:min(600px,var(--width));height:min(640px,var(--height));min-width:min(300px,var(--width));min-height:min(240px,var(--height));max-width:var(--width);max-height:var(--height);display:flex;flex-direction:column;pointer-events:auto;background:var(--surface);border-radius:12px;box-shadow:0 0 0 1px light-dark(rgb(0 0 0/8%),rgb(255 255 255/10%)),0 2px 4px light-dark(rgb(0 0 0/4%),rgb(0 0 0/24%)),0 16px 40px -8px light-dark(rgb(0 0 0/18%),rgb(0 0 0/56%));outline:none
|
|
97
|
-
:host([edge=bottom]) .window{bottom:var(--dock);left:var(--along);translate:var(--shift) 0
|
|
98
|
-
:host([edge=top]) .window{top:var(--dock);left:var(--along);translate:var(--shift) 0
|
|
99
|
-
:host([edge=right]) .window{right:var(--dock);top:var(--along);translate:0 var(--shift)
|
|
100
|
-
:host([edge=left]) .window{left:var(--dock);top:var(--along);translate:0 var(--shift)
|
|
101
|
-
@starting-style{.window{opacity:0;scale:.96}}
|
|
102
|
-
:host([hidden]) .window{opacity:0;scale:.96;transition-duration:150ms;transition-timing-function:ease-in}
|
|
94
|
+
.window{position:absolute;width:min(600px,var(--width));height:min(640px,var(--height));min-width:min(300px,var(--width));min-height:min(240px,var(--height));max-width:var(--width);max-height:var(--height);display:flex;flex-direction:column;pointer-events:auto;background:var(--surface);border-radius:12px;box-shadow:0 0 0 1px light-dark(rgb(0 0 0/8%),rgb(255 255 255/10%)),0 2px 4px light-dark(rgb(0 0 0/4%),rgb(0 0 0/24%)),0 16px 40px -8px light-dark(rgb(0 0 0/18%),rgb(0 0 0/56%));outline:none}
|
|
95
|
+
:host([edge=bottom]) .window{bottom:var(--dock);left:var(--along);translate:var(--shift) 0}
|
|
96
|
+
:host([edge=top]) .window{top:var(--dock);left:var(--along);translate:var(--shift) 0}
|
|
97
|
+
:host([edge=right]) .window{right:var(--dock);top:var(--along);translate:0 var(--shift)}
|
|
98
|
+
:host([edge=left]) .window{left:var(--dock);top:var(--along);translate:0 var(--shift)}
|
|
103
99
|
: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}
|
|
104
100
|
: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)}
|
|
105
101
|
.frame{flex:1;min-height:0;display:flex;flex-direction:column;overflow:hidden;border-radius:inherit}
|
|
@@ -118,25 +114,21 @@ header :is(button,a):focus-visible{outline:2px solid var(--focus);outline-offset
|
|
|
118
114
|
@media(any-pointer:coarse){:host{--thickness:54px}.grip{display:none}header :is(button,a){width:44px;height:44px}}
|
|
119
115
|
.body{flex:1;min-height:0;overflow:auto;position:relative}iframe{display:block;border:0;width:100%;height:100%;background:var(--surface)}
|
|
120
116
|
@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}}
|
|
121
|
-
@media(prefers-reduced-motion:reduce){:host,.window{transition:none}}
|
|
122
117
|
@media(forced-colors:active){.window{border:1px solid CanvasText}header :is(button,a):focus-visible{outline-color:Highlight}}
|
|
123
|
-
`;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(
|
|
124
|
-
: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
|
|
118
|
+
`;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(Hn(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(Hn(`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=Bn(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-${++Rn}`,zn(t);let v=P(n,J),y=()=>{Ln.delete(t),g.disconnect(),t.remove(),v()};return e.signal.aborted?y():(e.signal.addEventListener(`abort`,y,{once:!0}),Ln.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 Wn(e){let t=typeof e==`object`&&e?Reflect.get(e,`default`):void 0;return t instanceof Function?t:void 0}const Gn=`vitehub-tools-off`,Kn=`vitehub-tools-collapsed`,Q=`vitehub-tools-dock`,qn=`vitehub-account`,Jn=`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 Yn(){try{return localStorage.getItem(Gn)===`1`}catch{return!1}}function Xn(e){try{e?localStorage.setItem(Gn,`1`):localStorage.removeItem(Gn)}catch{}}function Zn(){return document.documentElement.getAttribute(`data-vitehub-pill`)===`mark`||$}let $=!1,Qn=!1;function $n(){try{return localStorage.getItem(Q)}catch{return null}}function er(){if(Qn||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 tr(e){return e.edge===`bottom`?{edge:`bottom`,at:e.at<50?0:100}:e}function nr(e,t){let n=Zn(),r=$n(),i=()=>{Qn||=$n()!==r;let t=$;if($=er(),t&&!$&&Qn&&document.querySelector(`vitehub-pill`)?.hasAttribute(`collapsed`))try{localStorage.setItem(Kn,`1`)}catch{}Zn()!==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===Q)&&(r=$n()),s()},{signal:t}),document.addEventListener(`pointerup`,s,{signal:t}),t.addEventListener(`abort`,()=>{a.disconnect(),c.disconnect(),clearTimeout(o)},{once:!0})}function rr(e,t,n,r){if(e.aborted)return;let i=document.createElement(`vitehub-tools-off`);i.setAttribute(`off`,``),i.setAttribute(`collapsed`,``),r&&i.setAttribute(`closing`,``),i.style.viewTransitionName=`vitehub-pill`;let a=fn(Q)??{edge:`bottom`,at:50},o=()=>{let e=Zn()&&!i.hasAttribute(`dragging`)?tr(a):a;i.setAttribute(`edge`,e.edge),i.style.setProperty(`--at`,String(e.at))};o();let s=new AbortController;e.addEventListener(`abort`,()=>{s.abort(),i.remove()},{once:!0,signal:s.signal}),nr(o,s.signal);let l=i.attachShadow({mode:`open`}),u=P(l,J);s.signal.addEventListener(`abort`,u,{once:!0});let d=document.createElement(`style`);d.textContent=`${sn}\n:host([off]){--vitehub-hex-h:14px;filter:drop-shadow(0 1px 2px rgb(0 0 0/25%))}
|
|
119
|
+
: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}
|
|
125
120
|
:host([off][edge=bottom]) button{transform-origin:calc(var(--at) * 1%) 100%}
|
|
126
121
|
:host([off][edge=top]) button{transform-origin:calc(var(--at) * 1%) 0}
|
|
127
122
|
:host([off][edge=left]) button{transform-origin:0 calc(var(--at) * 1%)}
|
|
128
123
|
:host([off][edge=right]) button{transform-origin:100% calc(var(--at) * 1%)}
|
|
129
|
-
:host([off][closing]) button{
|
|
124
|
+
:host([off][closing]) button{opacity:1}
|
|
130
125
|
:host([off][dragging]) button{opacity:1;cursor:grabbing}
|
|
131
126
|
:host([off]) button::before{content:"";position:absolute;inset:-6px}
|
|
132
|
-
svg{display:block;width:100%;height:100%;overflow:visible;fill:rgb(17 17 17/92%);stroke:rgb(255 255 255/18%);stroke-width:1px;vector-effect:non-scaling-stroke;transition:fill 150ms ease-out
|
|
127
|
+
svg{display:block;width:100%;height:100%;overflow:visible;fill:rgb(17 17 17/92%);stroke:rgb(255 255 255/18%);stroke-width:1px;vector-effect:non-scaling-stroke;transition:fill 150ms ease-out}
|
|
133
128
|
:host([off]) button:focus-visible{opacity:1}
|
|
134
129
|
:host([off][dragging]) svg{scale:none}
|
|
135
130
|
@media(hover:hover){:host([off]) button:hover{opacity:1;background:none}button:hover svg{fill:rgb(38 38 38/94%)}}
|
|
136
|
-
button:active svg{scale:.96}
|
|
137
131
|
@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}}
|
|
138
|
-
@
|
|
139
|
-
@keyframes vitehub-off-from-pill{from{opacity:1;scale:var(--vitehub-off-from)}}
|
|
140
|
-
@media(prefers-reduced-motion:reduce){:host([off]) button,svg{animation:none;transition:none}}`;let u=document.createElement(`button`);u.type=`button`,u.setAttribute(`aria-label`,`Turn on ViteHub tools`),u.title=`Turn on ViteHub tools`,u.append(g(`0 0 20 18`,W,{})),c.append(l,u),document.documentElement.append(i),r&&(i.style.setProperty(`--vitehub-off-from`,String(r/E(i).height)),u.addEventListener(`animationend`,()=>i.removeAttribute(`closing`),{once:!0}));let d=T({host:i,handle:u,dock:()=>a,shape:e=>{let t=e?i.offsetHeight:i.offsetWidth,n=E(i);return{size:t,lead:t/2,part:e?n.height:n.width,margin:2}},place:e=>{a=e,o()},drop:()=>{o();try{localStorage.setItem(H,JSON.stringify(a))}catch{}},signal:s.signal});u.addEventListener(`click`,()=>{d()||(s.abort(),i.remove(),t())}),n&&u.focus({preventScroll:!0})}async function me(e={}){return await $(e,!1)}let he=new AbortController;async function $(t,r){let o=new URLSearchParams(location.search);if(!n(location.search,document.cookie))return[];let{signal:s}=he;J=b(H)!==void 0,q=X();let c=t.load??(e=>import(
|
|
132
|
+
@media(prefers-reduced-motion:reduce){:host([off]) button,svg{transition:none}}`;let f=document.createElement(`button`);if(f.type=`button`,f.setAttribute(`aria-label`,`Turn on ViteHub tools`),f.title=`Turn on ViteHub tools`,f.append(cn(`0 0 20 18`,Jn,{})),l.append(d,f),document.documentElement.append(i),r){let e=r/X(i).height,t=x(e,(e,t)=>{let n=t===0&&e===1;O(f,{scale:n?null:e.toFixed(4)}),n&&i.removeAttribute(`closing`)},c.snappy);t.set(e),t.to(1,{preset:c.snappy})}let p=bn({host:i,handle:f,dock:()=>a,shape:e=>{let t=e?i.offsetHeight:i.offsetWidth,n=X(i);return{size:t,lead:t/2,part:e?n.height:n.width,margin:2}},place:e=>{a=e,o()},drop:()=>{o();try{localStorage.setItem(Q,JSON.stringify(a))}catch{}},signal:s.signal});f.addEventListener(`click`,()=>{p()||(s.abort(),i.remove(),t())}),n&&f.focus({preventScroll:!0})}async function ir(e={}){return await or(e,!1)}let ar=new AbortController;async function or(e,t){let n=new URLSearchParams(location.search);if(!Wt(location.search,document.cookie))return[];let{signal:r}=ar;Qn=fn(Q)!==void 0,$=er();let i=e.load??(e=>import(
|
|
141
133
|
/* @vite-ignore */
|
|
142
|
-
e)),
|
|
134
|
+
e)),a;try{let t=new URL(e.session??qt(import.meta.url),location.href);t.searchParams.set(`page`,location.pathname);let n=await fetch(t.origin===location.origin?`${t.pathname}${t.search}`:t.href,{credentials:`same-origin`,headers:{accept:`application/json`}});if(!n.ok)return[];a=Xt(await n.json())}catch{return[]}if(r.aborted||a.tools.length===0||document.querySelector(`vitehub-pill, vitehub-tools-off`))return[];let o=a.tools.find(e=>e.param&&n.has(e.param));if(n.has(`vitehub`)||o)Xn(!1);else if(Yn())return rr(r,()=>{Xn(!1),or(e,!0)},!1),[];let s=n.get(`vitehub`)||o?.id,c=a.tools.some(e=>e.id===s),l=new AbortController,u=a.tools.map(()=>new AbortController);r.addEventListener(`abort`,()=>{for(let e of u)e.abort();l.abort()},{once:!0,signal:l.signal});let d=/* @__PURE__ */ new Set,f=!1,p=(t=!1)=>{if(f||[...d].some(e=>!e()))return;f=!0;let n=a.tools.filter(e=>v(e.id));for(let e of a.tools)_(e.id,!1);Xn(!0);let i=new URL(location.href);i.searchParams.delete(Ht);for(let e of a.tools)e.param&&i.searchParams.delete(e.param);i.href!==location.href&&history.replaceState(history.state,``,i);let o=X(m).height,s=yn(m);for(let e of u)e.abort();s.then(()=>{l.abort(),rr(r,()=>{Xn(!1);for(let e of n)_(e.id,!0);or(e,!0)},t,o&&!matchMedia(`(prefers-reduced-motion: reduce)`).matches?o:void 0)})},m=vn({name:`vitehub-pill`,label:`ViteHub tools`,mark:cn(`0 0 20 18`,Jn,{fill:`currentColor`}),slots:[...a.tools.map(e=>e.id),...a.account?[qn]:[]],storage:{collapsed:Kn,dock:Q},exit:{label:`Turn off ViteHub tools`,press:p},onPlace:Vn,markOnly:{active:Zn,watch:nr,opened:t},signal:l.signal});if(l.signal.addEventListener(`abort`,P(m,{effects:[Ge,Mt]}),{once:!0}),a.account){let e=document.createElement(`vitehub-account`);e.slot=qn,m.append(e),Dn({account:a.account,bar:e,mark:Jn,openConsole:()=>{let e=m.querySelector(`vitehub-tool[slot="console"]`);return e&&!e.hidden?()=>void b(`console`):void 0},signal:l.signal})}let h=/* @__PURE__ */ new Map,g=t=>`vitehub-open:${e.session??qt(import.meta.url)}:${t}`,_=(e,t)=>{try{sessionStorage.setItem(g(e),String(t))}catch{}},v=e=>{try{return sessionStorage.getItem(g(e))===`true`}catch{return!1}},y=/* @__PURE__ */ new Map,b=async(e,t)=>await y.get(e)?.(t)??!1,x=(await Promise.all(a.tools.map(async(e,t)=>{let{signal:n}=u[t],r=document.createElement(`vitehub-tool`);r.slot=e.id,m.append(r);let a,o,l,f=()=>(l||(l=i(e.script),l.catch(()=>{l=void 0})),l),g=!1,x=()=>{let t=document.createElement(`vitehub-tool`);t.slot=e.id,r.replaceWith(t),r=t},S=()=>{let e=r.attachShadow({mode:`open`}),t=P(e,J);n.addEventListener(`abort`,t,{once:!0});let i=document.createElement(`style`);i.textContent=Kt,e.append(i,w)},C=(t,i=!0)=>n.aborted?Promise.resolve(!1):g?(a?.(t),Promise.resolve(!0)):o?o.then(e=>(e&&a?.(t),e)):(o=(async()=>{let c=new AbortController,l=()=>c.abort();n.addEventListener(`abort`,l,{once:!0});try{r.setAttribute(`aria-busy`,`true`);let o=Wn(await f());if(In(o,`the script of a page tool default-exports a function (${e.script})`),n.aborted)return!1;w.remove(),r.shadowRoot?x():r.replaceChildren();let l=o({beforeExit:e=>{let t=()=>e();d.add(t),c.signal.addEventListener(`abort`,()=>d.delete(t),{once:!0})},tool:e,bar:r,signal:c.signal,open:i&&(e.lazy===!0||e.id===s||v(e.id)),exit:()=>p(),createWindow:t=>{let n=Un({...t,signal:c.signal,onHide:()=>{_(e.id,!1),m.hasAttribute(`collapsed`)&&m.shadowRoot.querySelector(`button.mark`).focus({preventScroll:!0}),t.onHide?.()}}),r={...n,show(){if(!c.signal.aborted){for(let[t,n]of h)t!==e.id&&n.hide();_(e.id,!0),n.show()}},destroy(){h.get(e.id)===r&&(h.delete(e.id),_(e.id,!1)),n.destroy()}};return h.set(e.id,r),r},openTool:b,createTab:()=>{let e=document.createElement(`vitehub-tab`);return e.slot=`tab`,e.setAttribute(`data-motion-appear`,`vitehub-pill`),m.append(e),c.signal.addEventListener(`abort`,()=>e.remove(),{once:!0}),e},onOpen:e=>{a=e}});return g=!0,t&&a?.(t),!r.shadowRoot&&!r.hasChildNodes()&&(r.hidden=!0),l instanceof Function&&(n.aborted?l():c.signal.addEventListener(`abort`,()=>l(),{once:!0})),!n.aborted}catch(t){return c.abort(),n.removeEventListener(`abort`,l),h.delete(e.id)&&_(e.id,!1),a=void 0,g=!1,console.error(`[vitehub] The page tool "${e.id}" did not start.`,t),x(),w.textContent=`Retry ${e.label}`,w.title=`The tool could not load. Try again.`,r.hidden=!1,S(),!1}finally{r.removeAttribute(`aria-busy`),o=void 0}})(),o),w=document.createElement(`button`);w.type=`button`,w.textContent=e.label,w.addEventListener(`click`,()=>void C());for(let e of[`pointerenter`,`pointerdown`,`focus`])w.addEventListener(e,()=>void f());return y.set(e.id,C),e.lazy&&e.id!==s&&!v(e.id)?(S(),e):(await C(void 0,!c||e.id===s),n.aborted?void 0:e)}))).filter(e=>!!e);return x.length===0&&l.abort(),x}ir({session:new URL(`../tools`,import.meta.url).pathname});
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
//#region src/page.d.ts
|
|
2
|
-
/**
|
|
3
|
-
* The numbering scope of page threads: subjects of kind `page`, which the overlay pins on the app's pages. Threads on
|
|
4
|
-
* subjects of your own, such as `drop`, take the scope that their subject definition gives.
|
|
5
|
-
*/
|
|
6
|
-
declare const commentsPageScope = "site";
|
|
7
|
-
/** Name of the Realtime Definition that holds one presence room per page. */
|
|
8
|
-
declare const commentsRealtimeDefinition = "comments";
|
|
9
|
-
/** The route prefix of the Comments API, below the app base. */
|
|
10
|
-
declare const commentsRoute = "/api/_vitehub/comments";
|
|
11
2
|
/** Mount Comments under the application path, ignoring Vite asset URLs such as a CDN origin. */
|
|
12
3
|
declare function mountedCommentsRoute(base?: string): string;
|
|
13
4
|
/**
|
|
@@ -19,4 +10,4 @@ declare function normalizeCommentPage(path: string): string;
|
|
|
19
10
|
/** The Realtime document id of the presence room of a page: `pages/<hash>`, a safe Workspace path for any page. */
|
|
20
11
|
declare function commentRoom(page: string): string;
|
|
21
12
|
//#endregion
|
|
22
|
-
export { mountedCommentsRoute as
|
|
13
|
+
export { mountedCommentsRoute as n, normalizeCommentPage as r, commentRoom as t };
|
|
@@ -8,7 +8,7 @@ const commentsPageScope = "site";
|
|
|
8
8
|
/** Name of the Realtime Definition that holds one presence room per page. */
|
|
9
9
|
const commentsRealtimeDefinition = "comments";
|
|
10
10
|
/** The route prefix of the Comments API, below the app base. */
|
|
11
|
-
const commentsRoute = "/
|
|
11
|
+
const commentsRoute = "/_vitehub/comments";
|
|
12
12
|
/** Mount Comments under the application path, ignoring Vite asset URLs such as a CDN origin. */
|
|
13
13
|
function mountedCommentsRoute(base = "/") {
|
|
14
14
|
return base.startsWith("/") && !base.startsWith("//") ? `${base.replace(/\/+$/, "")}${commentsRoute}` : commentsRoute;
|
|
@@ -47,13 +47,16 @@ function viteHubPageToolsWanted(search, cookie) {
|
|
|
47
47
|
* any path under a public asset prefix that has no file, and gives the whole prefix the asset cache headers.
|
|
48
48
|
*/
|
|
49
49
|
const viteHubPageToolsAssets = "/_vitehub/page/assets";
|
|
50
|
-
/**
|
|
51
|
-
|
|
50
|
+
/**
|
|
51
|
+
* The route of the visitor check. It is public, and each tool checks the visitor itself. Its path has no auth word,
|
|
52
|
+
* such as `session`, because Vite Doctor takes a handler on such a path for an auth route without a guard.
|
|
53
|
+
*/
|
|
54
|
+
const viteHubPageSessionPath = "/_vitehub/page/tools";
|
|
52
55
|
/**
|
|
53
56
|
* The URL of the loader script, below the app base. Its version query changes when the loader changes, so caches keep
|
|
54
57
|
* it 5 minutes.
|
|
55
58
|
*/
|
|
56
|
-
const viteHubPageToolsLoader = "/_vitehub/page/assets/loader.js?v=
|
|
59
|
+
const viteHubPageToolsLoader = "/_vitehub/page/assets/loader.js?v=22";
|
|
57
60
|
/** The attribute of the script that loads the page tools. A page that has it does not get a second one. */
|
|
58
61
|
const viteHubPageToolsMarker = "data-vitehub-page-tools";
|
|
59
62
|
/** The bootstrap's opening tag, so the server can recognize the generated bootstrap when it replaces it. */
|
|
@@ -1,9 +1,22 @@
|
|
|
1
|
-
import { t as commentsErrorDiagnostics } from "./errors-
|
|
2
|
-
import { r as commentsRoleGrants } from "./define-
|
|
3
|
-
import { i as installCommentsRuntime } from "./server-
|
|
4
|
-
import { i as runtimeBuilds } from "./installed-
|
|
5
|
-
import { i as registerViteHubPageTool, n as resolveCommentsPage, r as installViteHubPageTools, t as resolveCommentsIdentity } from "./session-
|
|
1
|
+
import { t as commentsErrorDiagnostics } from "./errors-Dq4AHjza.js";
|
|
2
|
+
import { r as commentsRoleGrants } from "./define-BMBSVbD9.js";
|
|
3
|
+
import { i as installCommentsRuntime } from "./server-Yk610niJ.js";
|
|
4
|
+
import { i as runtimeBuilds } from "./installed-C3EoqJEY.js";
|
|
5
|
+
import { i as registerViteHubPageTool, n as resolveCommentsPage, r as installViteHubPageTools, t as resolveCommentsIdentity } from "./session-X_g9dnU5.js";
|
|
6
|
+
import { n as commentsTableNames } from "./table-names-B9LlRC0B.js";
|
|
6
7
|
import { installRequestStandardContext } from "@vite-hub/runtime/internal/h3";
|
|
8
|
+
import { configuredPublicOrigins } from "@vite-hub/runtime/internal/public-url";
|
|
9
|
+
//#region ../internal/src/runtime/user-data.ts
|
|
10
|
+
const stateKey = Symbol.for("vitehub.user-data");
|
|
11
|
+
const scope = globalThis;
|
|
12
|
+
function registerViteHubUserData(app, data) {
|
|
13
|
+
if (!app || typeof app !== "object") return;
|
|
14
|
+
const apps = scope[stateKey] ??= /* @__PURE__ */ new WeakMap();
|
|
15
|
+
let owners = apps.get(app);
|
|
16
|
+
if (!owners) apps.set(app, owners = /* @__PURE__ */ new Map());
|
|
17
|
+
owners.set(data.owner, data);
|
|
18
|
+
}
|
|
19
|
+
//#endregion
|
|
7
20
|
//#region src/runtime/plugin.ts
|
|
8
21
|
const runtimeKey = Symbol.for("vitehub.comments.installed");
|
|
9
22
|
/** The Comments definition that the Nitro plugin installed, for the Console reader. */
|
|
@@ -26,7 +39,7 @@ function defineCommentsPlugin(options) {
|
|
|
26
39
|
warned = true;
|
|
27
40
|
throw Object.assign(commentsErrorDiagnostics.COMMENTS_R0010(), { status: 503 });
|
|
28
41
|
}
|
|
29
|
-
const { installComments } = await import("./install-
|
|
42
|
+
const { installComments } = await import("./install-DrAse1Fa.js").then((n) => n.n);
|
|
30
43
|
return installComments(options.comments, {
|
|
31
44
|
database,
|
|
32
45
|
development: options.development === true,
|
|
@@ -35,7 +48,8 @@ function defineCommentsPlugin(options) {
|
|
|
35
48
|
...options.dialect ? { dialect: options.dialect } : {},
|
|
36
49
|
...options.users ? { users: options.users } : {},
|
|
37
50
|
...options.attachments ? { attachments: options.attachments } : {},
|
|
38
|
-
...options.rateLimit ? { rateLimit: options.rateLimit } : {}
|
|
51
|
+
...options.rateLimit ? { rateLimit: options.rateLimit } : {},
|
|
52
|
+
...options.webhooks ? { webhooks: options.webhooks } : {}
|
|
39
53
|
});
|
|
40
54
|
})().catch((error) => {
|
|
41
55
|
building = void 0;
|
|
@@ -44,6 +58,15 @@ function defineCommentsPlugin(options) {
|
|
|
44
58
|
runtimeBuilds.set(options.comments, build);
|
|
45
59
|
installCommentsRuntime(build);
|
|
46
60
|
Reflect.set(globalThis, runtimeKey, options.comments);
|
|
61
|
+
registerViteHubUserData(nitroApp, {
|
|
62
|
+
owner: "comments",
|
|
63
|
+
tables: [commentsTableNames.vitehubCommentThreads, commentsTableNames.vitehubCommentMessages],
|
|
64
|
+
async delete(userId) {
|
|
65
|
+
if (!await options.database()) return;
|
|
66
|
+
const runtime = await build();
|
|
67
|
+
for (const threadId of await runtime.store.deleteUser(userId)) runtime.forge?.changed(threadId);
|
|
68
|
+
}
|
|
69
|
+
});
|
|
47
70
|
if (options.overlay === false) return;
|
|
48
71
|
const script = options.overlay;
|
|
49
72
|
registerViteHubPageTool(nitroApp, {
|
|
@@ -67,7 +90,10 @@ function defineCommentsPlugin(options) {
|
|
|
67
90
|
return !options.comments.options.identify && options.githubLogin?.configured() && (!user || user.github) ? "lazy" : false;
|
|
68
91
|
}
|
|
69
92
|
});
|
|
70
|
-
installViteHubPageTools(nitroApp, {
|
|
93
|
+
installViteHubPageTools(nitroApp, {
|
|
94
|
+
base: options.base,
|
|
95
|
+
origins: options.development === true ? [] : configuredPublicOrigins()
|
|
96
|
+
});
|
|
71
97
|
};
|
|
72
98
|
}
|
|
73
99
|
//#endregion
|
package/dist/realtime.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as Comments } from "./index-
|
|
2
|
-
import { t as CommentsSessionOptions } from "./session-
|
|
1
|
+
import { t as Comments } from "./index-RiHzmV16.js";
|
|
2
|
+
import { t as CommentsSessionOptions } from "./session-DUcEor2W.js";
|
|
3
3
|
import { RealtimeDefinition } from "@vite-hub/realtime";
|
|
4
4
|
//#region src/realtime.d.ts
|
|
5
5
|
/**
|
package/dist/realtime.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { o as normalizeCommentPage, t as commentRoom } from "./page-
|
|
1
|
+
import { o as normalizeCommentPage, t as commentRoom } from "./page-DRz_sDY4.js";
|
|
2
2
|
import { i as text } from "./identity-CBOzgxSf.js";
|
|
3
|
-
import { n as resolveCommentsPage, t as resolveCommentsIdentity } from "./session-
|
|
3
|
+
import { n as resolveCommentsPage, t as resolveCommentsIdentity } from "./session-X_g9dnU5.js";
|
|
4
4
|
//#region src/realtime.ts
|
|
5
5
|
function toRealtimeUser(user) {
|
|
6
6
|
const result = { id: user.id };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//#region src/reply-id.ts
|
|
2
|
+
/**
|
|
3
|
+
* The id of the message that a reply with `requestId` stores in a thread. Every retry gets the same id, so the primary
|
|
4
|
+
* key of the messages refuses a second message, and the client's outbox finds the server copy of its waiting reply.
|
|
5
|
+
* The server and the browser client both import it, so it has no other import.
|
|
6
|
+
*/
|
|
7
|
+
async function replyMessageId(threadId, requestId) {
|
|
8
|
+
const digest = new Uint8Array(await crypto.subtle.digest("SHA-256", new TextEncoder().encode(JSON.stringify([threadId, requestId]))));
|
|
9
|
+
return `message_${Array.from(digest.subarray(0, 16), (byte) => byte.toString(16).padStart(2, "0")).join("")}`;
|
|
10
|
+
}
|
|
11
|
+
//#endregion
|
|
12
|
+
export { replyMessageId as t };
|