@vite-hub/comments 0.5.1 → 0.6.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 +3 -1
- package/dist/client.d.ts +29 -3
- package/dist/client.js +50 -22
- package/dist/{console-CK2F53QP.d.ts → console-CCLX_eIk.d.ts} +1 -1
- package/dist/{define-9uMM3Ewc.js → define-BCxNaSZv.js} +1 -1
- package/dist/hosted/hosted-comments/overlay-CFuq5QAH.js +182 -0
- package/dist/hosted/hosted-comments/{tools-CdwnUCOr.js → tools-Bz--joZw.js} +3 -3
- package/dist/hosted/hosted-comments.js +2 -2
- package/dist/{index-BEnHTj2Z.d.ts → index-D1T7RJ4R.d.ts} +5 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/{install-B-FQpi47.d.ts → install-NehuMNhG.d.ts} +1 -1
- package/dist/{install-BUXxryut.js → install-w6CCgGFV.js} +39 -15
- package/dist/{operations-CKC_lMG_.js → operations-B8IMhRmY.js} +1 -1
- package/dist/operations.js +2 -2
- package/dist/overlay/overlay.js +27 -15
- package/dist/page/loader.js +1 -1
- package/dist/{plugin-B2hETRii.js → plugin-DbCYT7Ac.js} +8 -3
- package/dist/realtime.d.ts +2 -2
- package/dist/realtime.js +1 -1
- package/dist/runtime/console.d.ts +1 -1
- package/dist/runtime/console.js +1 -1
- package/dist/runtime/index.d.ts +40 -10
- package/dist/runtime/index.js +11 -5
- package/dist/server.d.ts +1 -1
- package/dist/server.js +4 -4
- package/dist/{service-DDD4Ubxd.js → service-DUh2uGd2.js} +1 -1
- package/dist/{session-CTh9nisq.d.ts → session-CN4irEqf.d.ts} +1 -1
- package/dist/{session-BGN6Vlm6.js → session-_1GY5gaG.js} +23 -8
- package/dist/vite.d.ts +18 -2
- package/dist/vite.js +16 -3
- package/package.json +7 -7
- package/dist/hosted/hosted-comments/overlay-4-mWX4Uz.js +0 -170
package/dist/page/loader.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const e=/* @__PURE__ */ new Set;let t,n=!1;function r(){return t?.matches??!1}function i(){let t=r();if(t!==n){n=t;for(let n of e)n(t)}}function a(){t||typeof matchMedia!=`function`||(t=matchMedia(`(prefers-reduced-motion: reduce)`),t.addEventListener?.(`change`,i),n=r())}function o(){return a(),r()}function s(t){return a(),e.add(t),()=>e.delete(t)}const c={snappy:{stiffness:520,damping:34},soft:{stiffness:380,damping:20}},l=/* @__PURE__ */ new Map,u=/* @__PURE__ */ new Set;let d=0,f=!1,p=0,m=0;function h(){return 1}function g(e){let t=Math.min(.032,m?(e-m)/1e3:.016)/1;m=e;let n=Array.from(l),r=Array.from(u);for(let[e,r]of n)if(l.get(e)===r){if(e.tween){let n=e.tween;n.elapsed+=t;let r=Math.min(1,n.elapsed/n.duration),i=1-(1-r)**3,a=n.from+(e.target-n.from)*i;e.velocity=(a-e.value)/(t||1),e.value=a,r>=1&&_(e)}else{let{stiffness:n,damping:r}=e.preset,i=t/6;for(let t=0;t<6;t++){let t=-n*(e.value-e.target)-r*e.velocity;e.velocity+=t*i,e.value+=e.velocity*i}Math.abs(e.velocity)<.002&&Math.abs(e.value-e.target)<5e-4&&_(e)}e.frame(e.value,e.velocity)}for(let e of r)u.has(e)&&e(t)===!1&&u.delete(e);l.size||u.size?p=requestAnimationFrame(g):(p=0,m=0)}function _(e){e.value=e.target,e.velocity=0,e.tween=void 0,l.delete(e)}function v(e){l.set(e,++d),p||=requestAnimationFrame(g)}function y(e){let t=t=>e(t);return u.add(t),p||=requestAnimationFrame(g),()=>{u.delete(t)}}function b(e){if(!e)return;let t=Array.from(l);for(let[e,n]of t)l.get(e)!==n||e.tween||(_(e),e.frame(e.value,0))}function x(e,t,n=c.snappy){let r={value:e,velocity:0,target:e,preset:n,tween:void 0,frame:t},i={get value(){return r.value},get velocity(){return r.velocity},get target(){return r.target},get active(){return l.has(r)},to(e,t={}){if(t.preset&&(r.preset=t.preset),t.tween===void 0&&o())return i.set(e);t.tween===void 0&&!f&&(f=!0,s(b)),r.target=e,t.velocity!==void 0&&(r.velocity+=t.velocity),r.tween=t.tween===void 0?void 0:{from:r.value,elapsed:0,duration:t.tween},v(r)},set(e){r.value=r.target=e,r.velocity=0,r.tween=void 0,l.delete(r),t(e,0)},stop(){r.velocity=0,r.tween=void 0,l.delete(r)}};return i}function S(e){let t=e;for(;t;){if(t.closest(`[data-motion="none"]`))return!0;let e=t.getRootNode();t=e instanceof ShadowRoot?e.host:null}return!1}const C=[`aria-checked`,`aria-selected`,`aria-pressed`,`aria-expanded`,`aria-valuenow`,`aria-valuetext`,`data-state`,`data-checked`,`data-open`,`open`,`data-leaving`],w=/* @__PURE__ */ new Map,T=/* @__PURE__ */ new Set,E=Symbol.for(`vite-hub.motion.layer`);let D;function ee(){let e=Reflect.get(globalThis,E);if(e&&e!==D&&typeof e==`object`&&`define`in e&&`install`in e)return e}function te(e){D=e,Reflect.get(globalThis,E)||Reflect.set(globalThis,E,e)}function ne(e){let t=[...w.values()];w.clear();for(let n of t)n.removeFromShared=e.define(n.effect,n.isReduced)}function re(e,t=o){let n={effect:e,isReduced:t};w.set(e.name,n);for(let e of T)e();return()=>{if(n.removeFromShared)return n.removeFromShared();if(w.get(e.name)===n){w.delete(e.name);for(let e of T)e()}}}function O(){return[...w.values()].map(e=>e.effect)}function ie(){return[...w.values()]}function ae(e){return T.add(e),()=>T.delete(e)}function k(e,t){for(let[n,r]of Object.entries(t))r?e.style.setProperty(n,r):e.style.removeProperty(n)}const A=/* @__PURE__ */ new Map;let j;const M=/* @__PURE__ */ new Map;let N,P=[];const oe=Symbol.for(`vite-hub.motion.effect-presses`),se=e=>{let t=Reflect.get(e,oe);if(t)return t;let n=/* @__PURE__ */ new Map;return Reflect.set(e,oe,n),n},ce=/* @__PURE__ */ new Set;function le(e,t){if(ce.has(t))return!1;try{return e.matches(t)}catch{return ce.add(t),!1}}function ue(e){let t=e;for(;;){for(let e of A.keys())if(e instanceof Element&&e.contains(t))return!0;let e=t.getRootNode();if((e instanceof Document||e instanceof ShadowRoot)&&A.has(e))return!0;if(!(e instanceof ShadowRoot))return!1;t=e.host}}function de(e,t){let n=-1;e.forEach((e,t)=>{e instanceof Element&&e.matches(`[data-motion="none"]`)&&(n=t)});let r=e.findIndex(e=>e instanceof HTMLElement&&le(e,t));return r===-1||r<=n||!ue(e[r])?void 0:e[r]}function fe(e,t,n){F(e,!0);let r=se(t),i=[];for(let{effect:a,isReduced:o}of ie()){if(!a.press||o())continue;let s=de(n,a.selector);if(!s||e===`key`&&s!==n[0])continue;let c=r.get(s);if(c?.has(a.name))continue;let l=a.press(s,t);if(!l)continue;c?c.add(a.name):r.set(s,/* @__PURE__ */ new Set([a.name]));let u={element:s,press:l};e!==`key`&&!l.move&&(u.leave=()=>pe(e,u,!0),s.addEventListener(`pointerleave`,u.leave,{once:!0})),i.push(u)}i.length&&(M.set(e,i),i.some(e=>e.press.move)&&document.addEventListener(`pointermove`,_e,{capture:!0,passive:!0}))}function F(e,t=!1){let n=M.get(e);if(n){M.delete(e);for(let{element:e,press:r,leave:i}of n)i&&e.removeEventListener(`pointerleave`,i),t&&r.cancel?r.cancel():r.release();me()}}function pe(e,t,n=!1){let r=M.get(e),i=r?.indexOf(t)??-1;r&&i!==-1&&(t.leave&&t.element.removeEventListener(`pointerleave`,t.leave),r.splice(i,1),r.length||M.delete(e),n&&t.press.cancel?t.press.cancel():t.press.release(),me())}function me(){[...M.values()].some(e=>e.some(e=>e.press.move))||document.removeEventListener(`pointermove`,_e,{capture:!0})}function he(e){if(e.button!==0)return;let t=e.composedPath();e.isPrimary&&(N={event:e,path:t}),fe(e.pointerId,e,t)}function ge(e){N?.event.pointerId===e.pointerId&&(N=void 0),F(e.pointerId,e.type===`pointercancel`)}function _e(e){for(let{press:t}of M.get(e.pointerId)??[])t.move?.(e)}function ve(e){if(e.repeat||e.key!==` `&&e.key!==`Enter`)return;let t=e.composedPath();e.key===` `&&t[0]instanceof Element&&t[0].matches(`a[href], [role=link]`)||fe(`key`,e,t)}function ye(e){(e.key===` `||e.key===`Enter`)&&F(`key`)}function be(e,t){let n=t.filter(e=>e.content);if(!n.length)return;let r=/* @__PURE__ */ new Map;for(let t of e){if(t.type===`attributes`)continue;let e=t.type===`characterData`?t.target.parentElement:t.target;if(!(e instanceof HTMLElement||e instanceof SVGElement))continue;let n=r.get(e);n||(n={added:[],removed:[],oldText:void 0,texts:/* @__PURE__ */ new Map},r.set(e,n)),t.type===`characterData`?n.texts.has(t.target)||n.texts.set(t.target,t.oldValue):(n.added.push(...t.addedNodes),n.removed.push(...t.removedNodes))}for(let[e,t]of r){if(!e.isConnected)continue;let r=t.added.filter(e=>!t.removed.includes(e)),i=t.removed.filter(e=>!t.added.includes(e)),a=t.texts,o,s=[...e.childNodes];i.length&&s.every(e=>r.includes(e))?o=i.map(e=>e.textContent??``).join(``):a.size===1&&s.length===1&&a.has(s[0])&&(o=a.get(s[0])??``);for(let t of n)le(e,t.selector)&&!S(e)&&t.content(e,{added:r,removed:i,oldText:o})}}function xe(e){if(!N||!e.matches(`[role=separator][data-panel-resize-handle-id]`))return;let t=ie().find(({effect:e})=>e.name===`divider`);if(!t||t.isReduced())return;let{event:n,path:r}=N,i=M.get(n.pointerId)??[],a=i.find(t=>t.splitter&&t.element===e);if(e.getAttribute(`data-resize-handle-active`)!==`pointer`){a&&pe(n.pointerId,a);return}if(a||!r.includes(e.getRootNode())||!ue(e)||S(e))return;let o=t.effect.press?.(e,n);o&&(i.push({element:e,press:o,splitter:!0}),M.set(n.pointerId,i),document.addEventListener(`pointermove`,_e,{capture:!0,passive:!0}))}function Se(e){let t=[...new Set(e)],n=O(),r=/* @__PURE__ */ new Map;be(t,n);for(let e of t)if(e.type!==`characterData`){if(e.type===`attributes`){let t=e.target;if(!(t instanceof HTMLElement))continue;if(e.attributeName===`data-resize-handle-active`){xe(t);continue}let i=e.attributeName,a=t.getAttribute(i);if(a===e.oldValue)continue;let o=r.get(t);o||r.set(t,o=/* @__PURE__ */ new Map);let s=o.get(i);if(s||o.set(i,s=/* @__PURE__ */ new Set),s.has(e.oldValue))continue;s.add(e.oldValue);for(let r of n)r.state&&le(t,r.selector)&&!S(t)&&r.state(t,{attribute:i,oldValue:e.oldValue,value:a})}else for(let t of e.addedNodes)if(t instanceof HTMLElement&&t.isConnected)for(let e of n){if(!e.enter)continue;let n=le(t,e.selector);if(ce.has(e.selector))continue;let r=[...n?[t]:[],...t.querySelectorAll(e.selector)];for(let t of r)S(t)||e.enter(t)}}}function Ce(e,t){let n=O().some(e=>e.content);t.observe(e,{attributes:!0,attributeFilter:[...C,...O().some(e=>e.name===`divider`)?[`data-resize-handle-active`]:[]],attributeOldValue:!0,childList:n||O().some(e=>e.enter),characterData:n,characterDataOldValue:n,subtree:!0})}function we(e,t){let n=O();for(let[e,r]of t)n.includes(e)||(r(),t.delete(e));for(let r of n)r.watch&&!t.has(r)&&t.set(r,r.watch(e))}function Te(){let e={capture:!0,passive:!0};document.addEventListener(`pointerdown`,he,e),document.addEventListener(`pointerup`,ge,e),document.addEventListener(`pointercancel`,ge,e),document.addEventListener(`keydown`,ve,e),document.addEventListener(`keyup`,ye,e),P=[()=>{document.removeEventListener(`pointerdown`,he,e),document.removeEventListener(`pointerup`,ge,e),document.removeEventListener(`pointercancel`,ge,e),document.removeEventListener(`keydown`,ve,e),document.removeEventListener(`keyup`,ye,e),N=void 0;for(let e of M.keys())F(e,!0)},s(e=>{if(e){N=void 0;for(let e of M.keys())F(e,!0)}})]}function I(e,t){if(typeof document>`u`)return()=>{};let n=ee();return n?(ne(n),n.install(e,t.effects,o)):(te(Ee),De(e,t.effects))}const Ee={define:re,install:De};function De(e,t,n=o){let r=new Set(O().map(e=>e.name));for(let e of t)r.has(e.name)||re(e,n);if(!j){Te();let e=new MutationObserver((e,t)=>Se(e.concat(t.takeRecords())));j=e,P.push(ae(()=>{for(let[t,{watchers:n}]of A)Ce(t,e),we(t,n)}))}let i=A.get(e);if(i)i.installs++;else{let t=/* @__PURE__ */ new Map;Ce(e,j),A.set(e,{installs:1,watchers:t}),we(e,t)}let a=!1;return()=>{if(a)return;a=!0;let t=A.get(e);if(!t||--t.installs>0)return;A.delete(e);let n=j,r=n.takeRecords();n.disconnect();for(let e of t.watchers.values())e();if(A.size){for(let e of A.keys())Ce(e,n);r.length&&queueMicrotask(()=>{if(j!==n)return;let e=[...A.keys()];Se(r.filter(t=>e.some(e=>e.contains(t.target))))})}else{j=void 0;for(let e of P)e();P=[]}}}function Oe(e,t,n){let r=e.cloneNode(!0);for(let e of[r,...r.querySelectorAll(`*`)])for(let t of[`id`,`role`,`tabindex`,`hidden`,`inert`,`popover`,`data-ending-style`,`data-starting-style`,`aria-live`])e.removeAttribute(t);return r.setAttribute(`aria-hidden`,`true`),r.setAttribute(`data-motion`,`none`),r instanceof HTMLElement&&(r.inert=!0),r.style.pointerEvents=`none`,t.insertBefore(r,n?.parentNode===t?n:null),r}function ke(e,t){Object.assign(e.style,{position:`fixed`,inset:`auto`,left:`${t.left}px`,top:`${t.top}px`,width:`${t.width}px`,height:`${t.height}px`,margin:`0`,boxSizing:`border-box`,transform:`none`,translate:`none`,zIndex:`2147483647`});let n=e.getBoundingClientRect();Math.abs(n.left-t.left)>.5&&(e.style.left=`${2*t.left-n.left}px`),Math.abs(n.top-t.top)>.5&&(e.style.top=`${2*t.top-n.top}px`)}function Ae(e,t){return window.setTimeout(t,e*h())}function je(e,t,n,r){let i=(e,t,n)=>3*t*e*(1-e)**2+3*n*e**2*(1-e)+e**3;return a=>{if(a<=0||a>=1)return a<=0?0:1;let o=0,s=1,c=a;for(let t=0;t<24;t++)i(c,e,n)<a?o=c:s=c,c=(o+s)/2;return i(c,t,r)}}const Me=e=>e;function Ne(e,t,n,r,i){let a=(n.delay??0)/1e3,s=n.duration/1e3,c=n.ease??Me,l=o(),u=0;return{stop:y(n=>{u+=n;let d=!l&&o()||u>=a+s?1:s>0?Math.max(0,(u-a)/s):0;return r(e+(t-e)*c(d)),d<1||(i?.(),!1)})}}function Pe(e,t,n=Me,r=0){let i=()=>{},a=new Promise(e=>i=e),o=Ne(0,1,{duration:e*1e3,delay:r*1e3,ease:n},t,()=>i(!0));return{done:a,stop:()=>{o.stop(),i(!1)}}}const Fe={stiffness:900,damping:40},Ie={stiffness:380,damping:14},Le=`:is(button, a[href], summary, input:is([type=button], [type=submit], [type=reset], [type=checkbox], [type=radio]), ${[`button`,`link`,`tab`,`radio`,`menuitem`,`menuitemradio`,`menuitemcheckbox`,`option`,`checkbox`].map(e=>`[role=${e}]`).join(`, `)}):not(:disabled, [aria-disabled="true"], [role=switch])`,Re=/* @__PURE__ */ new WeakMap,ze=e=>e>=40?.03:e>=32?.04:.05;function Be(e){let t=e.dataset.motionPressTarget?e.closest(e.dataset.motionPressTarget):null;if(t instanceof HTMLElement)return{target:t,amount:ze(t.offsetHeight)};let n=e.firstElementChild;return e.childElementCount===1&&!e.textContent?.trim()&&(n instanceof HTMLElement||n instanceof SVGElement)&&n.matches(`svg, img, .iconify, [data-slot=icon], [data-slot$=Icon], [data-slot=swap-icon]`)?{target:n,amount:.15}:{target:e,amount:ze(e.offsetHeight)}}function Ve(e){let t=e.transitionDuration.split(`,`);return e.transitionProperty.split(`,`).some((e,n)=>/^\s*(?:scale|all)\s*$/.test(e)&&Number.parseFloat(t[n%t.length])>0)}function He(e,t,n){let{left:r,right:i,top:a,bottom:o,width:s,height:c}=e;return Math.min(t.clientX-r,i-t.clientX)<=s*n||Math.min(t.clientY-a,o-t.clientY)<=c*n}const Ue={name:`press`,selector:Le,press(e,t){let{target:n,amount:r}=Be(e),i=getComputedStyle(n);if(Ve(i)||i.display===`contents`||i.display===`inline`&&n===e&&!(e instanceof HTMLInputElement))return;let a;if(n===e&&`pointerId`in t&&(a=e.getBoundingClientRect(),He(a,t,r)))return;let o=Re.get(n);if(!o){let e={amount:r,spring:x(0,t=>{k(n,{scale:t?String(1-e.amount*t):null})},Fe)};o=e,Re.set(n,o)}o.amount=r;let{spring:s}=o;s.to(1,{preset:Fe});let c=!1,l=()=>{c||(c=!0,s.set(0))};return{move:a?e=>{He(a,e,r)&&l()}:void 0,release:()=>{c||s.to(0,{preset:Ie})},cancel:l}}},L={stiffness:480,damping:36},We={stiffness:380,damping:26},R={stiffness:440,damping:32},Ge=.24,Ke=.14,qe=.15,z=/* @__PURE__ */ new WeakMap,B=/* @__PURE__ */ new Set,Je=/* @__PURE__ */ new Set;let V;function H(e){let t=getComputedStyle(e);return t.clipPath===`inset(50%)`||t.clip===`rect(0px, 0px, 0px, 0px)`}function Ye(e){return e.matches(`[role=tooltip]`)?e:e.querySelector(`:scope > [role=tooltip]`)}const Xe=`[data-motion-appear]`;function Ze(e){if(e.matches(Xe))return e;if(e.matches(`[role=tooltip]`))return H(e)?e.parentElement:e;let t=e.querySelector(`:scope > [role=tooltip]`);return t&&H(t)?e:null}function Qe(e){let t=e.getAttribute(`data-state`);return t===null?!e.hidden&&!e.hasAttribute(`data-closed`):t!==`closed`}function $e(e){let t=e.getAttribute(`data-motion-appear`);if(t!==null){let n=e.parentElement;return!t||!n?null:n.closest(t)??[...n.children].find(n=>n!==e&&n.matches(t))??null}let n=Ye(e)?.id;return n?e.getRootNode().querySelector(`[aria-describedby~="${CSS.escape(n)}"]`)??document.querySelector(`[aria-describedby~="${CSS.escape(n)}"]`):null}function et(e){let t=[`translate`,`scale`,`clip-path`,`opacity`].map(t=>[t,e.style.getPropertyValue(t)]);k(e,{translate:null,scale:null,"clip-path":null});let n=e.getBoundingClientRect();for(let[n,r]of t)r&&e.style.setProperty(n,r);return n}function tt(e,t,n){let r=e.getAttribute(`data-side`);if(r===`top`||r===`bottom`||r===`left`||r===`right`)return r;if(!n)return`top`;let i=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 nt(e,t,n){return e===`top`?n?.top??t.bottom+8:e===`bottom`?n?.bottom??t.top-8:e===`left`?n?.left??t.right+8:n?.right??t.left-8}const rt=e=>e===`top`||e===`bottom`;function it(e){let{rest:t,side:n,edge:r}=e;return n===`top`?r+t.height/2:n===`bottom`?r-t.height/2:n===`left`?r+t.width/2:r-t.width/2}function at(e){return[...e.element.children].filter(t=>t instanceof HTMLElement&&t!==e.old?.element&&!t.matches(`[role=tooltip]`)&&!H(t))}function ot(e){return[...e.element.childNodes].filter(t=>t.nodeType===Node.TEXT_NODE||t instanceof Element&&t!==e.old?.element&&!t.matches(`[role=tooltip]`)&&!H(t)).map(e=>e.textContent??``).join(``)}function st(e){return[...e.childNodes].some(e=>e.nodeType===Node.TEXT_NODE&&e.textContent?.trim())}const U=e=>`${Math.round(e*100)/100}px`;function W(e){let{element:t,rest:n,side:r,edge:i,origin:a}=e,o=Math.max(1,e.width.value),s=e.mode===`clip`&&o<n.width,c=s?1:o/n.width,l=e.x.value-o/2,u=s?e.x.value-(n.left+n.width/2):l-n.left-a*(1-c),d=e.y.value-(n.top+n.height/2),f=[-40,-40,-40,-40];r===`top`&&(f[2]=e.y.value+n.height/2-i),r===`bottom`&&(f[0]=i-(e.y.value-n.height/2)),r===`left`&&(f[1]=(e.x.value+o/2-i)/c),r===`right`&&(f[3]=(i-(e.x.value-o/2))/c);let p=f.some(e=>e>0),m=null;if(s){let t=(n.width-o)/2;m=`inset(${[Math.max(0,f[0]),t+Math.max(0,f[1]),Math.max(0,f[2]),t+Math.max(0,f[3])].map(U).join(` `)} round ${e.radius})`}else p&&(m=`inset(${f.map(U).join(` `)})`);k(t,{translate:Math.abs(u)>.01||Math.abs(d)>.01||e.old?`${U(u)} ${U(d)}`:null,scale:Math.abs(c-1)>.001?`${c} 1`:null,"clip-path":m,opacity:e.fade.active||e.fade.value<1?String(e.fade.value):null});let h=Math.abs(c-1)>.001?`${1/c} 1`:null,g=e.label.value;for(let t of at(e))k(t,{scale:h,opacity:g<1?String(g):null,filter:g<1?`blur(${U((1-g)*6)})`:null});if(e.old){let t=e.old.spring.value;k(e.old.element,{scale:h,opacity:String(t),filter:`blur(${U((1-t)*5)})`})}}function ct(e){if(!(e.holding||e.timers.size||[e.x,e.y,e.width,e.label,e.fade,e.old?.spring].some(e=>e?.active))){e.old?.element.remove(),e.old=void 0,k(e.element,{translate:null,scale:null,"clip-path":null,opacity:null});for(let t of at(e))k(t,{scale:null,opacity:null,filter:null});e.done?.()}}function lt(e,t,n){let r=getComputedStyle(e),i=tt(e,t,n),a={element:e,rest:t,origin:Number.parseFloat(r.transformOrigin)||t.width/2,side:i,edge:nt(i,t,n),trigger:n,mode:st(e)||e.matches(Xe)?`clip`:`scale`,handoff:!e.matches(Xe),radius:r.borderRadius||`0px`,timers:/* @__PURE__ */ new Set,holding:!0},o=()=>{W(a),ct(a)};return a.x=x(t.left+t.width/2,o,L),a.y=x(t.top+t.height/2,o,L),a.width=x(t.width,o,R),a.label=x(1,o),a.fade=x(1,o),a}function G(e,t,n){let r=Ae(t,()=>{e.timers.delete(r),n(),ct(e)});e.timers.add(r)}function ut(e){for(let t of e.timers)clearTimeout(t);e.timers.clear();for(let t of[e.x,e.y,e.width,e.label,e.fade,e.old?.spring])t?.stop()}function K(e){ut(e),Je.delete(e),V===e&&(V=void 0),e.element.closest(`[data-motion=none]`)?.remove()}function dt(e){if(e){for(let e of Je)K(e);for(let e of B){let t=z.get(e)?.box;t&&(ut(t),t.holding=!0,t.x.set(t.rest.left+t.rest.width/2),t.y.set(t.rest.top+t.rest.height/2),t.width.set(t.rest.width),t.label.set(1),t.fade.set(1),t.holding=!1,ct(t))}}}function ft(e,t){let n=e.trigger,r=t.trigger;return!n||!r||e.side!==t.side?!1:rt(t.side)?n.top<r.bottom&&r.top<n.bottom:n.left<r.right&&r.left<n.right}function pt(e){return rt(e.side)?e.y:e.x}function mt(e,t,n){if(!t.length)return;let r=document.createElement(`span`);r.setAttribute(`aria-hidden`,`true`),Object.assign(r.style,{position:`absolute`,inset:`0`,display:`flex`,alignItems:`center`,justifyContent:`center`,gap:`inherit`,pointerEvents:`none`,whiteSpace:`nowrap`}),r.append(...t),e.element.append(r);let i=x(n,()=>{W(e),ct(e)});e.old={element:r,spring:i},i.to(0,{tween:.15})}function ht(e){return e.mode===`clip`?[...e.element.childNodes].filter(e=>e.nodeType===Node.TEXT_NODE).map(e=>e.cloneNode()):at(e).map(e=>{let t=e.cloneNode(!0);return t.style.removeProperty(`scale`),t.style.removeProperty(`opacity`),t.style.removeProperty(`filter`),t})}function gt(e,t){let n=t.trigger?.getBoundingClientRect(),r=et(e),i=lt(e,r,n);t.box=i,t.text=ot(i),t.label=ht(i),k(e,{opacity:null});let a=i.handoff&&V&&ft(V,i)?V:void 0;if(a&&(V=void 0),o())a&&_t(a,!0),i.fade.set(0),i.holding=!1,i.fade.to(1,{tween:qe});else if(a){let e=ht(a),t={x:[a.x.value,a.x.velocity],y:[a.y.value,a.y.velocity],width:[a.width.value,a.width.velocity]},n=a.old?0:a.label.value;K(a),i.x.set(t.x[0]),i.y.set(t.y[0]),i.width.set(t.width[0]),i.label.set(0),mt(i,e,n),i.x.to(r.left+r.width/2,{preset:L,velocity:t.x[1]}),i.y.to(r.top+r.height/2,{preset:L,velocity:t.y[1]}),i.width.to(r.width,{preset:R,velocity:t.width[1]}),G(i,40,()=>i.label.to(1,{tween:Ge})),i.holding=!1,W(i)}else pt(i).set(it(i)),i.width.set(Math.min(30,r.width)),i.label.set(0),W(i),pt(i).to(rt(i.side)?r.top+r.height/2:r.left+r.width/2,{preset:We}),G(i,120,()=>{i.width.to(r.width,{preset:R}),G(i,70,()=>i.label.to(1,{tween:Ge}))}),i.holding=!1}function _t(e,t){Je.add(e),e.holding=!1,t?(e.done=()=>K(e),e.fade.to(0,{tween:qe})):(e.handoff&&(V=e),e.old&&e.old.spring.to(0,{tween:Ke}),e.label.to(0,{tween:Ke}),e.width.to(Math.min(30,e.rest.width),{preset:R}),G(e,90,()=>{V===e&&(V=void 0),pt(e).to(it(e),{preset:We})}),G(e,520,()=>K(e)))}function vt(e,t){if(!t.open)return;t.open=!1,B.delete(e),t.stopWatch?.(),t.stopWatch=void 0,B.size||kt();let n=t.box;if(t.box=void 0,k(e,{opacity:null}),!n)return;let r=t.root.parentNode??t.parent,i=r?.isConnected?Oe(t.root,r,t.root.isConnected?t.root.nextSibling:t.next):void 0,a={x:n.x,y:n.y,width:n.width,label:n.label,fade:n.fade},s=Object.fromEntries(Object.entries(a).map(([e,t])=>[e,[t.value,t.velocity]])),c=n.old?.spring.value;ut(n),n.old?.element.remove(),k(e,{translate:null,scale:null,"clip-path":null,opacity:null});for(let e of at(n))k(e,{scale:null,opacity:null,filter:null});if(!i)return;let l=yt(t.root,e).reduce((e,t)=>e?.children[t],i);if(!(l instanceof HTMLElement)){i.remove();return}e.hasAttribute(`popover`)&&(k(l,{scale:null}),ke(l,n.rest));let u=lt(l,n.rest,void 0);Object.assign(u,{side:n.side,edge:n.edge,trigger:n.trigger,mode:n.mode,origin:n.origin,radius:n.radius,handoff:n.handoff});let d=l.querySelector(`:scope > [aria-hidden=true][style*=absolute]`);c!==void 0&&d&&(u.old={element:d,spring:x(c,()=>W(u))});for(let e of[`x`,`y`,`width`,`label`,`fade`])u[e].set(s[e][0]);W(u);for(let e of[`x`,`y`,`width`])s[e][1]&&u[e].to(s[e][0],{velocity:s[e][1]});_t(u,o())}function yt(e,t){let n=[];for(let r=t;r!==e&&r.parentElement;r=r.parentElement)n.unshift([...r.parentElement.children].indexOf(r));return n}function bt(e,t,n,r=20){requestAnimationFrame(()=>{if(!t.open||!e.isConnected)return;let i=e.closest(`[data-reka-popper-content-wrapper]`);if(r>0&&i?.style.transform.includes(`-200%`))return bt(e,t,n,r-1);n()})}function xt(e,t){let n=()=>{r.disconnect();let t=e;for(;t;){let e=t.parentNode;e&&r.observe(e,{childList:!0}),t=e??(t instanceof ShadowRoot?t.host:null)}},r=new MutationObserver(()=>{e.isConnected?(t.parent=t.root.parentNode,t.next=t.root.nextSibling,n()):vt(e,t)});return n(),()=>r.disconnect()}function St(e){let t=z.get(e);if(t?.open)return;let n=$e(e);if(n&&S(n))return;let r=e.closest(`[data-reka-popper-content-wrapper]`)??e;t={open:!0,root:r,parent:r.parentNode,next:r.nextSibling,text:``,label:[],trigger:n},z.set(e,t),B.add(e),Ot(),k(e,{opacity:`0`}),t.stopWatch=xt(e,t);let i=t;bt(e,t,()=>gt(e,i))}let Ct=0;function wt(){Ct=0;for(let e of B){let t=z.get(e),n=t?.box;if(!t||!n)continue;let r=et(e),i=ot(n);if(!(Math.abs(r.left-n.rest.left)>1||Math.abs(r.top-n.rest.top)>1||Math.abs(r.width-n.rest.width)>1)&&i===t.text)continue;let a=i===t.text?[]:t.label;t.trigger=$e(e)??t.trigger;let s=t.trigger?.getBoundingClientRect();t.text=i,t.label=ht(n),n.rest=r,n.side=tt(e,r,s),n.edge=nt(n.side,r,s),o()?(n.x.set(r.left+r.width/2),n.y.set(r.top+r.height/2),n.width.set(r.width)):(n.x.to(r.left+r.width/2,{preset:L}),n.y.to(r.top+r.height/2,{preset:L}),n.width.to(r.width,{preset:R}),a.length&&(n.old?.spring.stop(),n.old?.element.remove(),mt(n,a,n.label.value),n.label.set(0),G(n,40,()=>n.label.to(1,{tween:Ge}))))}}function Tt(){Ct||=requestAnimationFrame(wt)}let Et=!1,Dt;function Ot(){Dt??=s(dt),Et||(Et=!0,document.addEventListener(`pointerover`,Tt,{capture:!0,passive:!0}),document.addEventListener(`focusin`,Tt,{capture:!0,passive:!0}))}function kt(){Et=!1,cancelAnimationFrame(Ct),Ct=0,document.removeEventListener(`pointerover`,Tt,{capture:!0}),document.removeEventListener(`focusin`,Tt,{capture:!0})}const At={enter(e){Ze(e)===e&&Qe(e)&&St(e)},state(e){if(Ze(e)!==e)return;let t=z.get(e);Qe(e)?St(e):t&&vt(e,t)}};({...At});const jt={name:`appear`,selector:Xe,...At};function Mt(e){let t=e.cloneNode(!0);t.inert=!0,t.setAttribute(`aria-hidden`,`true`);for(let e of[t,...t.querySelectorAll(`[id], [name], [form], input, button, select, textarea, fieldset`)])e.removeAttribute(`id`),e.removeAttribute(`name`),e.removeAttribute(`form`),e.matches(`input, button, select, textarea, fieldset`)&&e.setAttribute(`disabled`,``);return t}const Nt={stiffness:380,damping:26},Pt={stiffness:260,damping:28},Ft=.9,It=je(.5,0,.75,0),Lt=`data-motion-ghost`,q=e=>({x:e.left+e.width/2,y:e.top+e.height/2});function Rt(e){return e.bottom>0&&e.right>0&&e.top<innerHeight&&e.left<innerWidth&&e.width+e.height>0}function zt(e){return[...e.children].filter(e=>e instanceof HTMLElement&&!e.hasAttribute(Lt))}function Bt(e,t={}){let n=t.items??zt,r=/* @__PURE__ */ new Map,i=/* @__PURE__ */ new Set,a=/* @__PURE__ */ new Map,s=!1;function l(e){if(!e)return{x:0,y:0};let t=1-e.grow.value;return{x:e.x.value+e.from.x*t,y:e.y.value+e.from.y*t}}function u(e,t){let{x:n,y:i,grow:a,from:o}=t;if(!n.active&&!i.active&&!a.active&&n.value===0&&i.value===0&&a.value===1){k(e,{translate:null,scale:null,opacity:null}),s||r.delete(e);return}let{x:c,y:u}=l(t),d=o.scale+(1-o.scale)*a.value;k(e,{translate:c||u?`${c.toFixed(2)}px ${u.toFixed(2)}px`:null,scale:d===1?null:d.toFixed(4),opacity:a.value>=1?null:Math.max(0,Math.min(1,a.value)).toFixed(3)})}function d(e){let t=r.get(e);if(t)return t;let n=()=>t&&u(e,t);return t={x:x(0,n,c.snappy),y:x(0,n,c.snappy),grow:x(1,n,Nt),from:{x:0,y:0,scale:1}},r.set(e,t),t}function f(e){let t=r.get(e);t&&(r.delete(e),t.x.stop(),t.y.stop(),t.grow.stop(),k(e,{translate:null,scale:null,opacity:null}))}function p(e,t){let n=e.velocity;e.set(t),e.to(0,{preset:c.snappy,velocity:n})}function m(t,n,r){if(!Rt(n))return;let a=e.getBoundingClientRect();getComputedStyle(e).position===`static`&&(e.style.position=`relative`);let s=Mt(t);s.setAttribute(Lt,``),Object.assign(s.style,{boxSizing:`border-box`,height:`${n.height}px`,left:`${n.left-a.left-e.clientLeft+e.scrollLeft}px`,margin:`0`,pointerEvents:`none`,position:`absolute`,top:`${n.top-a.top-e.clientTop+e.scrollTop}px`,width:`${n.width}px`}),k(s,{translate:null,scale:null,opacity:null,filter:null}),e.append(s);let c={element:s,stop:()=>{}},l=()=>{c.stop(),s.remove(),i.delete(c)};if(i.add(c),o()){let e=Pe(.15,e=>k(s,{opacity:(1-e).toFixed(3)}));c.stop=e.stop,e.done.then(l);return}if(r){let e=q(r.getBoundingClientRect()),t=q(n),i=Pe(.32,n=>{k(s,{translate:`${((e.x-t.x)*n).toFixed(2)}px ${((e.y-t.y)*n).toFixed(2)}px`,scale:(1-.8*n).toFixed(4),opacity:(1-n).toFixed(3),filter:n>0?`blur(${(3*n).toFixed(2)}px)`:null})},It);c.stop=i.stop,i.done.then(l);return}let u=x(1,e=>{k(s,{scale:(Ft+.09999999999999998*e).toFixed(4),opacity:Math.max(0,e).toFixed(3)}),e<.02&&l()},Pt);c.stop=()=>u.stop(),u.to(0)}return{measure(){a=/* @__PURE__ */ new Map;for(let t of n(e)){let e=t.getBoundingClientRect();if(!e.width&&!e.height)continue;let n=q(e),i=l(r.get(t));a.set(t,{x:n.x-i.x,y:n.y-i.y,rect:e})}},play(i={}){let c=a;a=/* @__PURE__ */ new Map;let u=S(e),h=n(e),g=new Set(h),_=h.map(e=>{let t=e.getBoundingClientRect(),n=l(r.get(e)),i=q(t);return{element:e,rect:t,layout:{x:i.x-n.x,y:i.y-n.y}}}),v=_.map(({element:e})=>{if(!c.has(e)&&i.origin)return(typeof i.origin==`function`?i.origin(e):i.origin)?.getBoundingClientRect()});for(let[e,{rect:n}]of c)g.has(e)||(f(e),u||t.movesOnly||e.hasAttribute(`data-motion-leaving`)||m(e,n,i.target));s=!0,_.forEach(({element:e,rect:n,layout:r},i)=>{if(u)return f(e);let a=c.get(e);if(a){let t=a.x-r.x,i=a.y-r.y;if(Math.abs(t)<.5&&Math.abs(i)<.5)return;if(!Rt(a.rect)&&!Rt(n))return f(e);let o=d(e);p(o.x,o.x.value+t),p(o.y,o.y.value+i);return}if(!Rt(n)||t.movesOnly)return;let s=d(e),l=v[i];if(o())s.from={x:0,y:0,scale:1};else if(l){let e=q(l),t=Math.min(1,Math.max(.2,Math.min(l.width/(n.width||1),l.height/(n.height||1))));s.from={x:e.x-r.x,y:e.y-r.y,scale:t}}else s.from={x:0,y:0,scale:Ft};s.grow.set(0),s.grow.to(1,o()?{tween:.15}:{preset:Nt})}),s=!1},destroy(){for(let e of r.keys())f(e);for(let e of i)e.stop(),e.element.remove();i.clear(),a=/* @__PURE__ */ new Map}}}const Vt=`vitehub`,Ht=[`comment`];function Ut(e,t){let n=new URLSearchParams(e);if(n.has(`vitehub`)||Ht.some(e=>n.has(e)))return!0;let r=t.split(`;`).map(e=>e.trim());return r.includes(`vitehub-tools=1`)?!0:r.includes(`vitehub_session=1`)&&!r.some(e=>e.startsWith(`vitehub-tools=`))}const Wt=`/_vitehub/page/tools`,Gt=`button{all:unset;box-sizing:border-box;display:inline-flex;align-items:center;justify-content:var(--vitehub-pill-justify,center);gap:4px;min-width:28px;height:28px;padding:0 8px;border-radius:8px;font:inherit;white-space:nowrap;color:var(--vitehub-pill-text);cursor:pointer;touch-action:manipulation;-webkit-tap-highlight-color:transparent;transition-property:background-color,color;transition-duration:150ms;transition-timing-function:cubic-bezier(.23,1,.32,1)}
|
|
1
|
+
const e=/* @__PURE__ */ new Set;let t,n=!1;function r(){return t?.matches??!1}function i(){let t=r();if(t!==n){n=t;for(let n of e)n(t)}}function a(){t||typeof matchMedia!=`function`||(t=matchMedia(`(prefers-reduced-motion: reduce)`),t.addEventListener?.(`change`,i),n=r())}function o(){return a(),r()}function s(t){return a(),e.add(t),()=>e.delete(t)}const c={snappy:{stiffness:520,damping:34},soft:{stiffness:380,damping:20}},l=/* @__PURE__ */ new Map,u=/* @__PURE__ */ new Set;let d=0,f=!1,p=0,m=0;function h(){return 1}function g(e){let t=Math.min(.032,m?(e-m)/1e3:.016)/1;m=e;let n=Array.from(l),r=Array.from(u);for(let[e,r]of n)if(l.get(e)===r){if(e.tween){let n=e.tween;n.elapsed+=t;let r=Math.min(1,n.elapsed/n.duration),i=1-(1-r)**3,a=n.from+(e.target-n.from)*i;e.velocity=(a-e.value)/(t||1),e.value=a,r>=1&&_(e)}else{let{stiffness:n,damping:r}=e.preset,i=t/6;for(let t=0;t<6;t++){let t=-n*(e.value-e.target)-r*e.velocity;e.velocity+=t*i,e.value+=e.velocity*i}Math.abs(e.velocity)<.002&&Math.abs(e.value-e.target)<5e-4&&_(e)}e.frame(e.value,e.velocity)}for(let e of r)u.has(e)&&e(t)===!1&&u.delete(e);l.size||u.size?p=requestAnimationFrame(g):(p=0,m=0)}function _(e){e.value=e.target,e.velocity=0,e.tween=void 0,l.delete(e)}function v(e){l.set(e,++d),p||=requestAnimationFrame(g)}function y(e){let t=t=>e(t);return u.add(t),p||=requestAnimationFrame(g),()=>{u.delete(t)}}function b(e){if(!e)return;let t=Array.from(l);for(let[e,n]of t)l.get(e)!==n||e.tween||(_(e),e.frame(e.value,0))}function x(e,t,n=c.snappy){let r={value:e,velocity:0,target:e,preset:n,tween:void 0,frame:t},i={get value(){return r.value},get velocity(){return r.velocity},get target(){return r.target},get active(){return l.has(r)},to(e,t={}){if(t.preset&&(r.preset=t.preset),t.tween===void 0&&o())return i.set(e);t.tween===void 0&&!f&&(f=!0,s(b)),r.target=e,t.velocity!==void 0&&(r.velocity+=t.velocity),r.tween=t.tween===void 0?void 0:{from:r.value,elapsed:0,duration:t.tween},v(r)},set(e){r.value=r.target=e,r.velocity=0,r.tween=void 0,l.delete(r),t(e,0)},stop(){r.velocity=0,r.tween=void 0,l.delete(r)}};return i}function S(e){let t=e;for(;t;){if(t.closest(`[data-motion="none"]`))return!0;let e=t.getRootNode();t=e instanceof ShadowRoot?e.host:null}return!1}const C=[`aria-checked`,`aria-selected`,`aria-pressed`,`aria-expanded`,`aria-valuenow`,`aria-valuetext`,`data-state`,`data-checked`,`data-open`,`open`,`data-leaving`],w=/* @__PURE__ */ new Map,T=/* @__PURE__ */ new Set,E=Symbol.for(`vite-hub.motion.layer`);let D;function ee(){let e=Reflect.get(globalThis,E);if(e&&e!==D&&typeof e==`object`&&`define`in e&&`install`in e)return e}function te(e){D=e,Reflect.get(globalThis,E)||Reflect.set(globalThis,E,e)}function ne(e){let t=[...w.values()];w.clear();for(let n of t)n.removeFromShared=e.define(n.effect,n.isReduced)}function re(e,t=o){let n={effect:e,isReduced:t};w.set(e.name,n);for(let e of T)e();return()=>{if(n.removeFromShared)return n.removeFromShared();if(w.get(e.name)===n){w.delete(e.name);for(let e of T)e()}}}function O(){return[...w.values()].map(e=>e.effect)}function ie(){return[...w.values()]}function ae(e){return T.add(e),()=>T.delete(e)}function k(e,t){for(let[n,r]of Object.entries(t))r?e.style.setProperty(n,r):e.style.removeProperty(n)}const A=/* @__PURE__ */ new Map;let j;const M=/* @__PURE__ */ new Map;let N,P=[];const oe=Symbol.for(`vite-hub.motion.effect-presses`),se=e=>{let t=Reflect.get(e,oe);if(t)return t;let n=/* @__PURE__ */ new Map;return Reflect.set(e,oe,n),n},ce=/* @__PURE__ */ new Set;function le(e,t){if(ce.has(t))return!1;try{return e.matches(t)}catch{return ce.add(t),!1}}function ue(e){let t=e;for(;;){for(let e of A.keys())if(e instanceof Element&&e.contains(t))return!0;let e=t.getRootNode();if((e instanceof Document||e instanceof ShadowRoot)&&A.has(e))return!0;if(!(e instanceof ShadowRoot))return!1;t=e.host}}function de(e,t){let n=-1;e.forEach((e,t)=>{e instanceof Element&&e.matches(`[data-motion="none"]`)&&(n=t)});let r=e.findIndex(e=>e instanceof HTMLElement&&le(e,t));return r===-1||r<=n||!ue(e[r])?void 0:e[r]}function fe(e,t,n){F(e,!0);let r=se(t),i=[];for(let{effect:a,isReduced:o}of ie()){if(!a.press||o())continue;let s=de(n,a.selector);if(!s||e===`key`&&s!==n[0])continue;let c=r.get(s);if(c?.has(a.name))continue;let l=a.press(s,t);if(!l)continue;c?c.add(a.name):r.set(s,/* @__PURE__ */ new Set([a.name]));let u={element:s,press:l};e!==`key`&&!l.move&&(u.leave=()=>pe(e,u,!0),s.addEventListener(`pointerleave`,u.leave,{once:!0})),i.push(u)}i.length&&(M.set(e,i),i.some(e=>e.press.move)&&document.addEventListener(`pointermove`,_e,{capture:!0,passive:!0}))}function F(e,t=!1){let n=M.get(e);if(n){M.delete(e);for(let{element:e,press:r,leave:i}of n)i&&e.removeEventListener(`pointerleave`,i),t&&r.cancel?r.cancel():r.release();me()}}function pe(e,t,n=!1){let r=M.get(e),i=r?.indexOf(t)??-1;r&&i!==-1&&(t.leave&&t.element.removeEventListener(`pointerleave`,t.leave),r.splice(i,1),r.length||M.delete(e),n&&t.press.cancel?t.press.cancel():t.press.release(),me())}function me(){[...M.values()].some(e=>e.some(e=>e.press.move))||document.removeEventListener(`pointermove`,_e,{capture:!0})}function he(e){if(e.button!==0)return;let t=e.composedPath();e.isPrimary&&(N={event:e,path:t}),fe(e.pointerId,e,t)}function ge(e){N?.event.pointerId===e.pointerId&&(N=void 0),F(e.pointerId,e.type===`pointercancel`)}function _e(e){for(let{press:t}of M.get(e.pointerId)??[])t.move?.(e)}function ve(e){if(e.repeat||e.key!==` `&&e.key!==`Enter`)return;let t=e.composedPath();e.key===` `&&t[0]instanceof Element&&t[0].matches(`a[href], [role=link]`)||fe(`key`,e,t)}function ye(e){(e.key===` `||e.key===`Enter`)&&F(`key`)}function be(e,t){let n=t.filter(e=>e.content);if(!n.length)return;let r=/* @__PURE__ */ new Map;for(let t of e){if(t.type===`attributes`)continue;let e=t.type===`characterData`?t.target.parentElement:t.target;if(!(e instanceof HTMLElement||e instanceof SVGElement))continue;let n=r.get(e);n||(n={added:[],removed:[],oldText:void 0,texts:/* @__PURE__ */ new Map},r.set(e,n)),t.type===`characterData`?n.texts.has(t.target)||n.texts.set(t.target,t.oldValue):(n.added.push(...t.addedNodes),n.removed.push(...t.removedNodes))}for(let[e,t]of r){if(!e.isConnected)continue;let r=t.added.filter(e=>!t.removed.includes(e)),i=t.removed.filter(e=>!t.added.includes(e)),a=t.texts,o,s=[...e.childNodes];i.length&&s.every(e=>r.includes(e))?o=i.map(e=>e.textContent??``).join(``):a.size===1&&s.length===1&&a.has(s[0])&&(o=a.get(s[0])??``);for(let t of n)le(e,t.selector)&&!S(e)&&t.content(e,{added:r,removed:i,oldText:o})}}function xe(e){if(!N||!e.matches(`[role=separator][data-panel-resize-handle-id]`))return;let t=ie().find(({effect:e})=>e.name===`divider`);if(!t||t.isReduced())return;let{event:n,path:r}=N,i=M.get(n.pointerId)??[],a=i.find(t=>t.splitter&&t.element===e);if(e.getAttribute(`data-resize-handle-active`)!==`pointer`){a&&pe(n.pointerId,a);return}if(a||!r.includes(e.getRootNode())||!ue(e)||S(e))return;let o=t.effect.press?.(e,n);o&&(i.push({element:e,press:o,splitter:!0}),M.set(n.pointerId,i),document.addEventListener(`pointermove`,_e,{capture:!0,passive:!0}))}function Se(e){let t=[...new Set(e)],n=O(),r=/* @__PURE__ */ new Map;be(t,n);for(let e of t)if(e.type!==`characterData`){if(e.type===`attributes`){let t=e.target;if(!(t instanceof HTMLElement))continue;if(e.attributeName===`data-resize-handle-active`){xe(t);continue}let i=e.attributeName,a=t.getAttribute(i);if(a===e.oldValue)continue;let o=r.get(t);o||r.set(t,o=/* @__PURE__ */ new Map);let s=o.get(i);if(s||o.set(i,s=/* @__PURE__ */ new Set),s.has(e.oldValue))continue;s.add(e.oldValue);for(let r of n)r.state&&le(t,r.selector)&&!S(t)&&r.state(t,{attribute:i,oldValue:e.oldValue,value:a})}else for(let t of e.addedNodes)if(t instanceof HTMLElement&&t.isConnected)for(let e of n){if(!e.enter)continue;let n=le(t,e.selector);if(ce.has(e.selector))continue;let r=[...n?[t]:[],...t.querySelectorAll(e.selector)];for(let t of r)S(t)||e.enter(t)}}}function Ce(e,t){let n=O().some(e=>e.content);t.observe(e,{attributes:!0,attributeFilter:[...C,...O().some(e=>e.name===`divider`)?[`data-resize-handle-active`]:[]],attributeOldValue:!0,childList:n||O().some(e=>e.enter),characterData:n,characterDataOldValue:n,subtree:!0})}function we(e,t){let n=O();for(let[e,r]of t)n.includes(e)||(r(),t.delete(e));for(let r of n)r.watch&&!t.has(r)&&t.set(r,r.watch(e))}function Te(){let e={capture:!0,passive:!0};document.addEventListener(`pointerdown`,he,e),document.addEventListener(`pointerup`,ge,e),document.addEventListener(`pointercancel`,ge,e),document.addEventListener(`keydown`,ve,e),document.addEventListener(`keyup`,ye,e),P=[()=>{document.removeEventListener(`pointerdown`,he,e),document.removeEventListener(`pointerup`,ge,e),document.removeEventListener(`pointercancel`,ge,e),document.removeEventListener(`keydown`,ve,e),document.removeEventListener(`keyup`,ye,e),N=void 0;for(let e of M.keys())F(e,!0)},s(e=>{if(e){N=void 0;for(let e of M.keys())F(e,!0)}})]}function I(e,t){if(typeof document>`u`)return()=>{};let n=ee();return n?(ne(n),n.install(e,t.effects,o)):(te(Ee),De(e,t.effects))}const Ee={define:re,install:De};function De(e,t,n=o){let r=new Set(O().map(e=>e.name));for(let e of t)r.has(e.name)||re(e,n);if(!j){Te();let e=new MutationObserver((e,t)=>Se(e.concat(t.takeRecords())));j=e,P.push(ae(()=>{for(let[t,{watchers:n}]of A)Ce(t,e),we(t,n)}))}let i=A.get(e);if(i)i.installs++;else{let t=/* @__PURE__ */ new Map;Ce(e,j),A.set(e,{installs:1,watchers:t}),we(e,t)}let a=!1;return()=>{if(a)return;a=!0;let t=A.get(e);if(!t||--t.installs>0)return;A.delete(e);let n=j,r=n.takeRecords();n.disconnect();for(let e of t.watchers.values())e();if(A.size){for(let e of A.keys())Ce(e,n);r.length&&queueMicrotask(()=>{if(j!==n)return;let e=[...A.keys()];Se(r.filter(t=>e.some(e=>e.contains(t.target))))})}else{j=void 0;for(let e of P)e();P=[]}}}function Oe(e,t,n){let r=e.cloneNode(!0);for(let e of[r,...r.querySelectorAll(`*`)])for(let t of[`id`,`role`,`tabindex`,`hidden`,`inert`,`popover`,`data-ending-style`,`data-starting-style`,`aria-live`])e.removeAttribute(t);return r.setAttribute(`aria-hidden`,`true`),r.setAttribute(`data-motion`,`none`),r instanceof HTMLElement&&(r.inert=!0),r.style.pointerEvents=`none`,t.insertBefore(r,n?.parentNode===t?n:null),r}function ke(e,t){Object.assign(e.style,{position:`fixed`,inset:`auto`,left:`${t.left}px`,top:`${t.top}px`,width:`${t.width}px`,height:`${t.height}px`,margin:`0`,boxSizing:`border-box`,transform:`none`,translate:`none`,zIndex:`2147483647`});let n=e.getBoundingClientRect();Math.abs(n.left-t.left)>.5&&(e.style.left=`${2*t.left-n.left}px`),Math.abs(n.top-t.top)>.5&&(e.style.top=`${2*t.top-n.top}px`)}function Ae(e,t){return window.setTimeout(t,e*h())}function je(e,t,n,r){let i=(e,t,n)=>3*t*e*(1-e)**2+3*n*e**2*(1-e)+e**3;return a=>{if(a<=0||a>=1)return a<=0?0:1;let o=0,s=1,c=a;for(let t=0;t<24;t++)i(c,e,n)<a?o=c:s=c,c=(o+s)/2;return i(c,t,r)}}const Me=e=>e;function Ne(e,t,n,r,i){let a=(n.delay??0)/1e3,s=n.duration/1e3,c=n.ease??Me,l=o(),u=0;return{stop:y(n=>{u+=n;let d=!l&&o()||u>=a+s?1:s>0?Math.max(0,(u-a)/s):0;return r(e+(t-e)*c(d)),d<1||(i?.(),!1)})}}function Pe(e,t,n=Me,r=0){let i=()=>{},a=new Promise(e=>i=e),o=Ne(0,1,{duration:e*1e3,delay:r*1e3,ease:n},t,()=>i(!0));return{done:a,stop:()=>{o.stop(),i(!1)}}}const Fe={stiffness:900,damping:40},Ie={stiffness:380,damping:14},Le=`:is(button, a[href], summary, input:is([type=button], [type=submit], [type=reset], [type=checkbox], [type=radio]), ${[`button`,`link`,`tab`,`radio`,`menuitem`,`menuitemradio`,`menuitemcheckbox`,`option`,`checkbox`].map(e=>`[role=${e}]`).join(`, `)}):not(:disabled, [aria-disabled="true"], [role=switch])`,Re=/* @__PURE__ */ new WeakMap,ze=e=>e>=40?.03:e>=32?.04:.05;function Be(e){let t=e.dataset.motionPressTarget?e.closest(e.dataset.motionPressTarget):null;if(t instanceof HTMLElement)return{target:t,amount:ze(t.offsetHeight)};let n=e.firstElementChild;return e.childElementCount===1&&!e.textContent?.trim()&&(n instanceof HTMLElement||n instanceof SVGElement)&&n.matches(`svg, img, .iconify, [data-slot=icon], [data-slot$=Icon], [data-slot=swap-icon]`)?{target:n,amount:.15}:{target:e,amount:ze(e.offsetHeight)}}function Ve(e){let t=e.transitionDuration.split(`,`);return e.transitionProperty.split(`,`).some((e,n)=>/^\s*(?:scale|all)\s*$/.test(e)&&Number.parseFloat(t[n%t.length])>0)}function He(e,t,n){let{left:r,right:i,top:a,bottom:o,width:s,height:c}=e;return Math.min(t.clientX-r,i-t.clientX)<=s*n||Math.min(t.clientY-a,o-t.clientY)<=c*n}const Ue={name:`press`,selector:Le,press(e,t){let{target:n,amount:r}=Be(e),i=getComputedStyle(n);if(Ve(i)||i.display===`contents`||i.display===`inline`&&n===e&&!(e instanceof HTMLInputElement))return;let a;if(n===e&&`pointerId`in t&&(a=e.getBoundingClientRect(),He(a,t,r)))return;let o=Re.get(n);if(!o){let e={amount:r,spring:x(0,t=>{k(n,{scale:t?String(1-e.amount*t):null})},Fe)};o=e,Re.set(n,o)}o.amount=r;let{spring:s}=o;s.to(1,{preset:Fe});let c=!1,l=()=>{c||(c=!0,s.set(0))};return{move:a?e=>{He(a,e,r)&&l()}:void 0,release:()=>{c||s.to(0,{preset:Ie})},cancel:l}}},L={stiffness:480,damping:36},We={stiffness:380,damping:26},R={stiffness:440,damping:32},Ge=.24,Ke=.14,qe=.15,z=/* @__PURE__ */ new WeakMap,B=/* @__PURE__ */ new Set,Je=/* @__PURE__ */ new Set;let V;function H(e){let t=getComputedStyle(e);return t.clipPath===`inset(50%)`||t.clip===`rect(0px, 0px, 0px, 0px)`}function Ye(e){return e.matches(`[role=tooltip]`)?e:e.querySelector(`:scope > [role=tooltip]`)}const Xe=`[data-motion-appear]`;function Ze(e){if(e.matches(Xe))return e;if(e.matches(`[role=tooltip]`))return H(e)?e.parentElement:e;let t=e.querySelector(`:scope > [role=tooltip]`);return t&&H(t)?e:null}function Qe(e){let t=e.getAttribute(`data-state`);return t===null?!e.hidden&&!e.hasAttribute(`data-closed`):t!==`closed`}function $e(e){let t=e.getAttribute(`data-motion-appear`);if(t!==null){let n=e.parentElement;return!t||!n?null:n.closest(t)??[...n.children].find(n=>n!==e&&n.matches(t))??null}let n=Ye(e)?.id;return n?e.getRootNode().querySelector(`[aria-describedby~="${CSS.escape(n)}"]`)??document.querySelector(`[aria-describedby~="${CSS.escape(n)}"]`):null}function et(e){let t=[`translate`,`scale`,`clip-path`,`opacity`].map(t=>[t,e.style.getPropertyValue(t)]);k(e,{translate:null,scale:null,"clip-path":null});let n=e.getBoundingClientRect();for(let[n,r]of t)r&&e.style.setProperty(n,r);return n}function tt(e,t,n){let r=e.getAttribute(`data-side`);if(r===`top`||r===`bottom`||r===`left`||r===`right`)return r;if(!n)return`top`;let[i,a]=[[`top`,n.top-t.bottom],[`bottom`,t.top-n.bottom],[`left`,n.left-t.right],[`right`,t.left-n.right]].reduce((e,t)=>t[1]>e[1]?t:e);if(a>=0)return i;let o=n.left+n.width/2-(t.left+t.width/2),s=n.top+n.height/2-(t.top+t.height/2);return Math.abs(s)>=Math.abs(o)?s>0?`top`:`bottom`:o>0?`left`:`right`}function nt(e,t,n){return e===`top`?n?.top??t.bottom+8:e===`bottom`?n?.bottom??t.top-8:e===`left`?n?.left??t.right+8:n?.right??t.left-8}const rt=e=>e===`top`||e===`bottom`;function it(e){let{rest:t,side:n,edge:r}=e;return n===`top`?r+t.height/2:n===`bottom`?r-t.height/2:n===`left`?r+t.width/2:r-t.width/2}function at(e){return[...e.element.children].filter(t=>t instanceof HTMLElement&&t!==e.old?.element&&!t.matches(`[role=tooltip]`)&&!H(t))}function ot(e){return[...e.element.childNodes].filter(t=>t.nodeType===Node.TEXT_NODE||t instanceof Element&&t!==e.old?.element&&!t.matches(`[role=tooltip]`)&&!H(t)).map(e=>e.textContent??``).join(``)}function st(e){return[...e.childNodes].some(e=>e.nodeType===Node.TEXT_NODE&&e.textContent?.trim())}const U=e=>`${Math.round(e*100)/100}px`;function W(e){let{element:t,rest:n,side:r,edge:i,origin:a}=e,o=Math.max(1,e.width.value),s=e.mode===`clip`&&o<n.width,c=s?1:o/n.width,l=e.x.value-o/2,u=s?e.x.value-(n.left+n.width/2):l-n.left-a*(1-c),d=e.y.value-(n.top+n.height/2),f=[-40,-40,-40,-40];r===`top`&&(f[2]=e.y.value+n.height/2-i),r===`bottom`&&(f[0]=i-(e.y.value-n.height/2)),r===`left`&&(f[1]=(e.x.value+o/2-i)/c),r===`right`&&(f[3]=(i-(e.x.value-o/2))/c);let p=f.some(e=>e>0),m=null;if(s){let t=(n.width-o)/2;m=`inset(${[Math.max(0,f[0]),t+Math.max(0,f[1]),Math.max(0,f[2]),t+Math.max(0,f[3])].map(U).join(` `)} round ${e.radius})`}else p&&(m=`inset(${f.map(U).join(` `)})`);k(t,{translate:Math.abs(u)>.01||Math.abs(d)>.01||e.old?`${U(u)} ${U(d)}`:null,scale:Math.abs(c-1)>.001?`${c} 1`:null,"clip-path":m,opacity:e.fade.active||e.fade.value<1?String(e.fade.value):null});let h=Math.abs(c-1)>.001?`${1/c} 1`:null,g=e.label.value;for(let t of at(e))k(t,{scale:h,opacity:g<1?String(g):null,filter:g<1?`blur(${U((1-g)*6)})`:null});if(e.old){let t=e.old.spring.value;k(e.old.element,{scale:h,opacity:String(t),filter:`blur(${U((1-t)*5)})`})}}function ct(e){if(!(e.holding||e.timers.size||[e.x,e.y,e.width,e.label,e.fade,e.old?.spring].some(e=>e?.active))){e.old?.element.remove(),e.old=void 0,k(e.element,{translate:null,scale:null,"clip-path":null,opacity:null});for(let t of at(e))k(t,{scale:null,opacity:null,filter:null});e.done?.()}}function lt(e,t,n){let r=getComputedStyle(e),i=tt(e,t,n),a={element:e,rest:t,origin:Number.parseFloat(r.transformOrigin)||t.width/2,side:i,edge:nt(i,t,n),trigger:n,mode:st(e)||e.matches(Xe)?`clip`:`scale`,handoff:!e.matches(Xe),radius:r.borderRadius||`0px`,timers:/* @__PURE__ */ new Set,holding:!0},o=()=>{W(a),ct(a)};return a.x=x(t.left+t.width/2,o,L),a.y=x(t.top+t.height/2,o,L),a.width=x(t.width,o,R),a.label=x(1,o),a.fade=x(1,o),a}function G(e,t,n){let r=Ae(t,()=>{e.timers.delete(r),n(),ct(e)});e.timers.add(r)}function ut(e){for(let t of e.timers)clearTimeout(t);e.timers.clear();for(let t of[e.x,e.y,e.width,e.label,e.fade,e.old?.spring])t?.stop()}function K(e){ut(e),Je.delete(e),V===e&&(V=void 0),e.element.closest(`[data-motion=none]`)?.remove()}function dt(e){if(e){for(let e of Je)K(e);for(let e of B){let t=z.get(e)?.box;t&&(ut(t),t.holding=!0,t.x.set(t.rest.left+t.rest.width/2),t.y.set(t.rest.top+t.rest.height/2),t.width.set(t.rest.width),t.label.set(1),t.fade.set(1),t.holding=!1,ct(t))}}}function ft(e,t){let n=e.trigger,r=t.trigger;return!n||!r||e.side!==t.side?!1:rt(t.side)?n.top<r.bottom&&r.top<n.bottom:n.left<r.right&&r.left<n.right}function pt(e){return rt(e.side)?e.y:e.x}function mt(e,t,n){if(!t.length)return;let r=document.createElement(`span`);r.setAttribute(`aria-hidden`,`true`),Object.assign(r.style,{position:`absolute`,inset:`0`,display:`flex`,alignItems:`center`,justifyContent:`center`,gap:`inherit`,pointerEvents:`none`,whiteSpace:`nowrap`}),r.append(...t),e.element.append(r);let i=x(n,()=>{W(e),ct(e)});e.old={element:r,spring:i},i.to(0,{tween:.15})}function ht(e){return e.mode===`clip`?[...e.element.childNodes].filter(e=>e.nodeType===Node.TEXT_NODE).map(e=>e.cloneNode()):at(e).map(e=>{let t=e.cloneNode(!0);return t.style.removeProperty(`scale`),t.style.removeProperty(`opacity`),t.style.removeProperty(`filter`),t})}function gt(e,t){let n=t.trigger?.getBoundingClientRect(),r=et(e),i=lt(e,r,n);t.box=i,t.text=ot(i),t.label=ht(i),k(e,{opacity:null});let a=i.handoff&&V&&ft(V,i)?V:void 0;if(a&&(V=void 0),o())a&&_t(a,!0),i.fade.set(0),i.holding=!1,i.fade.to(1,{tween:qe});else if(a){let e=ht(a),t={x:[a.x.value,a.x.velocity],y:[a.y.value,a.y.velocity],width:[a.width.value,a.width.velocity]},n=a.old?0:a.label.value;K(a),i.x.set(t.x[0]),i.y.set(t.y[0]),i.width.set(t.width[0]),i.label.set(0),mt(i,e,n),i.x.to(r.left+r.width/2,{preset:L,velocity:t.x[1]}),i.y.to(r.top+r.height/2,{preset:L,velocity:t.y[1]}),i.width.to(r.width,{preset:R,velocity:t.width[1]}),G(i,40,()=>i.label.to(1,{tween:Ge})),i.holding=!1,W(i)}else pt(i).set(it(i)),i.width.set(Math.min(30,r.width)),i.label.set(0),W(i),pt(i).to(rt(i.side)?r.top+r.height/2:r.left+r.width/2,{preset:We}),G(i,120,()=>{i.width.to(r.width,{preset:R}),G(i,70,()=>i.label.to(1,{tween:Ge}))}),i.holding=!1}function _t(e,t){Je.add(e),e.holding=!1,t?(e.done=()=>K(e),e.fade.to(0,{tween:qe})):(e.handoff&&(V=e),e.old&&e.old.spring.to(0,{tween:Ke}),e.label.to(0,{tween:Ke}),e.width.to(Math.min(30,e.rest.width),{preset:R}),G(e,90,()=>{V===e&&(V=void 0),pt(e).to(it(e),{preset:We})}),G(e,520,()=>K(e)))}function vt(e,t){if(!t.open)return;t.open=!1,B.delete(e),t.stopWatch?.(),t.stopWatch=void 0,B.size||kt();let n=t.box;if(t.box=void 0,k(e,{opacity:null}),!n)return;let r=t.root.parentNode??t.parent,i=r?.isConnected?Oe(t.root,r,t.root.isConnected?t.root.nextSibling:t.next):void 0,a={x:n.x,y:n.y,width:n.width,label:n.label,fade:n.fade},s=Object.fromEntries(Object.entries(a).map(([e,t])=>[e,[t.value,t.velocity]])),c=n.old?.spring.value;ut(n),n.old?.element.remove(),k(e,{translate:null,scale:null,"clip-path":null,opacity:null});for(let e of at(n))k(e,{scale:null,opacity:null,filter:null});if(!i)return;let l=yt(t.root,e).reduce((e,t)=>e?.children[t],i);if(!(l instanceof HTMLElement)){i.remove();return}e.hasAttribute(`popover`)&&(k(l,{scale:null}),ke(l,n.rest));let u=lt(l,n.rest,void 0);Object.assign(u,{side:n.side,edge:n.edge,trigger:n.trigger,mode:n.mode,origin:n.origin,radius:n.radius,handoff:n.handoff});let d=l.querySelector(`:scope > [aria-hidden=true][style*=absolute]`);c!==void 0&&d&&(u.old={element:d,spring:x(c,()=>W(u))});for(let e of[`x`,`y`,`width`,`label`,`fade`])u[e].set(s[e][0]);W(u);for(let e of[`x`,`y`,`width`])s[e][1]&&u[e].to(s[e][0],{velocity:s[e][1]});_t(u,o())}function yt(e,t){let n=[];for(let r=t;r!==e&&r.parentElement;r=r.parentElement)n.unshift([...r.parentElement.children].indexOf(r));return n}function bt(e,t,n,r=20){requestAnimationFrame(()=>{if(!t.open||!e.isConnected)return;let i=e.closest(`[data-reka-popper-content-wrapper]`);if(r>0&&i?.style.transform.includes(`-200%`))return bt(e,t,n,r-1);n()})}function xt(e,t){let n=()=>{r.disconnect();let t=e;for(;t;){let e=t.parentNode;e&&r.observe(e,{childList:!0}),t=e??(t instanceof ShadowRoot?t.host:null)}},r=new MutationObserver(()=>{e.isConnected?(t.parent=t.root.parentNode,t.next=t.root.nextSibling,n()):vt(e,t)});return n(),()=>r.disconnect()}function St(e){let t=z.get(e);if(t?.open)return;let n=$e(e);if(n&&S(n))return;let r=e.closest(`[data-reka-popper-content-wrapper]`)??e;t={open:!0,root:r,parent:r.parentNode,next:r.nextSibling,text:``,label:[],trigger:n},z.set(e,t),B.add(e),Ot(),k(e,{opacity:`0`}),t.stopWatch=xt(e,t);let i=t;bt(e,t,()=>gt(e,i))}let Ct=0;function wt(){Ct=0;for(let e of B){let t=z.get(e),n=t?.box;if(!t||!n)continue;let r=et(e),i=ot(n);if(!(Math.abs(r.left-n.rest.left)>1||Math.abs(r.top-n.rest.top)>1||Math.abs(r.width-n.rest.width)>1)&&i===t.text)continue;let a=i===t.text?[]:t.label;t.trigger=$e(e)??t.trigger;let s=t.trigger?.getBoundingClientRect();t.text=i,t.label=ht(n),n.rest=r,n.side=tt(e,r,s),n.edge=nt(n.side,r,s),o()?(n.x.set(r.left+r.width/2),n.y.set(r.top+r.height/2),n.width.set(r.width)):(n.x.to(r.left+r.width/2,{preset:L}),n.y.to(r.top+r.height/2,{preset:L}),n.width.to(r.width,{preset:R}),a.length&&(n.old?.spring.stop(),n.old?.element.remove(),mt(n,a,n.label.value),n.label.set(0),G(n,40,()=>n.label.to(1,{tween:Ge}))))}}function Tt(){Ct||=requestAnimationFrame(wt)}let Et=!1,Dt;function Ot(){Dt??=s(dt),Et||(Et=!0,document.addEventListener(`pointerover`,Tt,{capture:!0,passive:!0}),document.addEventListener(`focusin`,Tt,{capture:!0,passive:!0}))}function kt(){Et=!1,cancelAnimationFrame(Ct),Ct=0,document.removeEventListener(`pointerover`,Tt,{capture:!0}),document.removeEventListener(`focusin`,Tt,{capture:!0})}const At={enter(e){Ze(e)===e&&Qe(e)&&St(e)},state(e){if(Ze(e)!==e)return;let t=z.get(e);Qe(e)?St(e):t&&vt(e,t)}};({...At});const jt={name:`appear`,selector:Xe,...At};function Mt(e){let t=e.cloneNode(!0);t.inert=!0,t.setAttribute(`aria-hidden`,`true`);for(let e of[t,...t.querySelectorAll(`[id], [name], [form], input, button, select, textarea, fieldset`)])e.removeAttribute(`id`),e.removeAttribute(`name`),e.removeAttribute(`form`),e.matches(`input, button, select, textarea, fieldset`)&&e.setAttribute(`disabled`,``);return t}const Nt={stiffness:380,damping:26},Pt={stiffness:260,damping:28},Ft=.9,It=je(.5,0,.75,0),Lt=`data-motion-ghost`,q=e=>({x:e.left+e.width/2,y:e.top+e.height/2});function Rt(e){return e.bottom>0&&e.right>0&&e.top<innerHeight&&e.left<innerWidth&&e.width+e.height>0}function zt(e){return[...e.children].filter(e=>e instanceof HTMLElement&&!e.hasAttribute(Lt))}function Bt(e,t={}){let n=t.items??zt,r=/* @__PURE__ */ new Map,i=/* @__PURE__ */ new Set,a=/* @__PURE__ */ new Map,s=!1;function l(e){if(!e)return{x:0,y:0};let t=1-e.grow.value;return{x:e.x.value+e.from.x*t,y:e.y.value+e.from.y*t}}function u(e,t){let{x:n,y:i,grow:a,from:o}=t;if(!n.active&&!i.active&&!a.active&&n.value===0&&i.value===0&&a.value===1){k(e,{translate:null,scale:null,opacity:null}),s||r.delete(e);return}let{x:c,y:u}=l(t),d=o.scale+(1-o.scale)*a.value;k(e,{translate:c||u?`${c.toFixed(2)}px ${u.toFixed(2)}px`:null,scale:d===1?null:d.toFixed(4),opacity:a.value>=1?null:Math.max(0,Math.min(1,a.value)).toFixed(3)})}function d(e){let t=r.get(e);if(t)return t;let n=()=>t&&u(e,t);return t={x:x(0,n,c.snappy),y:x(0,n,c.snappy),grow:x(1,n,Nt),from:{x:0,y:0,scale:1}},r.set(e,t),t}function f(e){let t=r.get(e);t&&(r.delete(e),t.x.stop(),t.y.stop(),t.grow.stop(),k(e,{translate:null,scale:null,opacity:null}))}function p(e,t){let n=e.velocity;e.set(t),e.to(0,{preset:c.snappy,velocity:n})}function m(t,n,r){if(!Rt(n))return;let a=e.getBoundingClientRect();getComputedStyle(e).position===`static`&&(e.style.position=`relative`);let s=Mt(t);s.setAttribute(Lt,``),Object.assign(s.style,{boxSizing:`border-box`,height:`${n.height}px`,left:`${n.left-a.left-e.clientLeft+e.scrollLeft}px`,margin:`0`,pointerEvents:`none`,position:`absolute`,top:`${n.top-a.top-e.clientTop+e.scrollTop}px`,width:`${n.width}px`}),k(s,{translate:null,scale:null,opacity:null,filter:null}),e.append(s);let c={element:s,stop:()=>{}},l=()=>{c.stop(),s.remove(),i.delete(c)};if(i.add(c),o()){let e=Pe(.15,e=>k(s,{opacity:(1-e).toFixed(3)}));c.stop=e.stop,e.done.then(l);return}if(r){let e=q(r.getBoundingClientRect()),t=q(n),i=Pe(.32,n=>{k(s,{translate:`${((e.x-t.x)*n).toFixed(2)}px ${((e.y-t.y)*n).toFixed(2)}px`,scale:(1-.8*n).toFixed(4),opacity:(1-n).toFixed(3),filter:n>0?`blur(${(3*n).toFixed(2)}px)`:null})},It);c.stop=i.stop,i.done.then(l);return}let u=x(1,e=>{k(s,{scale:(Ft+.09999999999999998*e).toFixed(4),opacity:Math.max(0,e).toFixed(3)}),e<.02&&l()},Pt);c.stop=()=>u.stop(),u.to(0)}return{measure(){a=/* @__PURE__ */ new Map;for(let t of n(e)){let e=t.getBoundingClientRect();if(!e.width&&!e.height)continue;let n=q(e),i=l(r.get(t));a.set(t,{x:n.x-i.x,y:n.y-i.y,rect:e})}},play(i={}){let c=a;a=/* @__PURE__ */ new Map;let u=S(e),h=n(e),g=new Set(h),_=h.map(e=>{let t=e.getBoundingClientRect(),n=l(r.get(e)),i=q(t);return{element:e,rect:t,layout:{x:i.x-n.x,y:i.y-n.y}}}),v=_.map(({element:e})=>{if(!c.has(e)&&i.origin)return(typeof i.origin==`function`?i.origin(e):i.origin)?.getBoundingClientRect()});for(let[e,{rect:n}]of c)g.has(e)||(f(e),u||t.movesOnly||e.hasAttribute(`data-motion-leaving`)||m(e,n,i.target));s=!0,_.forEach(({element:e,rect:n,layout:r},i)=>{if(u)return f(e);let a=c.get(e);if(a){let t=a.x-r.x,i=a.y-r.y;if(Math.abs(t)<.5&&Math.abs(i)<.5)return;if(!Rt(a.rect)&&!Rt(n))return f(e);let o=d(e);p(o.x,o.x.value+t),p(o.y,o.y.value+i);return}if(!Rt(n)||t.movesOnly)return;let s=d(e),l=v[i];if(o())s.from={x:0,y:0,scale:1};else if(l){let e=q(l),t=Math.min(1,Math.max(.2,Math.min(l.width/(n.width||1),l.height/(n.height||1))));s.from={x:e.x-r.x,y:e.y-r.y,scale:t}}else s.from={x:0,y:0,scale:Ft};s.grow.set(0),s.grow.to(1,o()?{tween:.15}:{preset:Nt})}),s=!1},destroy(){for(let e of r.keys())f(e);for(let e of i)e.stop(),e.element.remove();i.clear(),a=/* @__PURE__ */ new Map}}}const Vt=`vitehub`,Ht=[`comment`];function Ut(e,t){let n=new URLSearchParams(e);if(n.has(`vitehub`)||Ht.some(e=>n.has(e)))return!0;let r=t.split(`;`).map(e=>e.trim());return r.includes(`vitehub-tools=1`)?!0:r.includes(`vitehub_session=1`)&&!r.some(e=>e.startsWith(`vitehub-tools=`))}const Wt=`/_vitehub/page/tools`,Gt=`button{all:unset;box-sizing:border-box;display:inline-flex;align-items:center;justify-content:var(--vitehub-pill-justify,center);gap:4px;min-width:28px;height:28px;padding:0 8px;border-radius:8px;font:inherit;white-space:nowrap;color:var(--vitehub-pill-text);cursor:pointer;touch-action:manipulation;-webkit-tap-highlight-color:transparent;transition-property:background-color,color;transition-duration:150ms;transition-timing-function:cubic-bezier(.23,1,.32,1)}
|
|
2
2
|
@media(hover:hover){button:where(:not(:disabled):hover){background:var(--vitehub-pill-hover);color:var(--vitehub-pill-strong)}}
|
|
3
3
|
button[aria-pressed=true],button[aria-expanded=true]{background:var(--vitehub-pill-on);color:var(--vitehub-pill-on-text)}
|
|
4
4
|
:host([aria-busy=true]) button,button[aria-busy=true]{background:var(--vitehub-pill-on);color:var(--vitehub-pill-on-text);cursor:progress}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { r as commentsRoleGrants } from "./define-
|
|
1
|
+
import { a as registerViteHubPageTool, i as installViteHubSiteVisitor, n as resolveCommentsPage, r as installViteHubPageTools, t as resolveCommentsIdentity } from "./session-_1GY5gaG.js";
|
|
2
|
+
import { r as commentsRoleGrants } from "./define-BCxNaSZv.js";
|
|
3
3
|
import { t as commentsErrorDiagnostics } from "./errors-DFNiJg67.js";
|
|
4
4
|
import { i as installCommentsRuntime } from "./server-BGbD7H5s.js";
|
|
5
5
|
import { i as runtimeBuilds } from "./installed-C9SkldMi.js";
|
|
@@ -38,7 +38,7 @@ function defineCommentsPlugin(options) {
|
|
|
38
38
|
warned = true;
|
|
39
39
|
throw Object.assign(commentsErrorDiagnostics.COMMENTS_R0010(), { status: 503 });
|
|
40
40
|
}
|
|
41
|
-
const { installComments } = await import("./install-
|
|
41
|
+
const { installComments } = await import("./install-w6CCgGFV.js").then((n) => n.n);
|
|
42
42
|
return installComments(options.comments, {
|
|
43
43
|
database,
|
|
44
44
|
development: options.development === true,
|
|
@@ -66,6 +66,7 @@ function defineCommentsPlugin(options) {
|
|
|
66
66
|
for (const threadId of await runtime.store.deleteUser(userId)) runtime.forge?.changed(threadId);
|
|
67
67
|
}
|
|
68
68
|
});
|
|
69
|
+
if (options.siteVisitor) installViteHubSiteVisitor(options.siteVisitor);
|
|
69
70
|
if (options.overlay === false) return;
|
|
70
71
|
const script = options.overlay;
|
|
71
72
|
registerViteHubPageTool(nitroApp, {
|
|
@@ -89,6 +90,10 @@ function defineCommentsPlugin(options) {
|
|
|
89
90
|
return !options.comments.options.identify && options.githubLogin?.configured() && (!user || user.github) ? "lazy" : false;
|
|
90
91
|
}
|
|
91
92
|
});
|
|
93
|
+
for (const install of options.pillSegments ?? []) install(nitroApp, {
|
|
94
|
+
base: options.base,
|
|
95
|
+
development: options.development === true
|
|
96
|
+
});
|
|
92
97
|
installViteHubPageTools(nitroApp, {
|
|
93
98
|
base: options.base,
|
|
94
99
|
origins: options.development === true ? [] : configuredPublicOrigins()
|
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-D1T7RJ4R.js";
|
|
2
|
+
import { t as CommentsSessionOptions } from "./session-CN4irEqf.js";
|
|
3
3
|
import { RealtimeDefinition } from "@vite-hub/realtime";
|
|
4
4
|
/**
|
|
5
5
|
* The Realtime Definition of the page presence rooms: who is on a page and where their cursor is. Rooms hold no
|
package/dist/realtime.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { i as text } from "./identity-CT7-UGmS.js";
|
|
2
2
|
import { o as normalizeCommentPage, t as commentRoom } from "./page-xzgZ6DGm.js";
|
|
3
|
-
import { n as resolveCommentsPage, t as resolveCommentsIdentity } from "./session-
|
|
3
|
+
import { n as resolveCommentsPage, t as resolveCommentsIdentity } from "./session-_1GY5gaG.js";
|
|
4
4
|
// src/realtime.ts
|
|
5
5
|
function toRealtimeUser(user) {
|
|
6
6
|
const result = { id: user.id };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { n as ViteHubConsoleRecord } from "../console-
|
|
1
|
+
import { n as ViteHubConsoleRecord } from "../console-CCLX_eIk.js";
|
|
2
2
|
/** The threads of the app as Console records: open threads first, each group newest activity first. It runs on each Console request. */
|
|
3
3
|
export declare function readCommentsConsoleRecords(): Promise<ViteHubConsoleRecord[]>;
|
package/dist/runtime/console.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as describeCommentContext } from "../context-DbkBjITZ.js";
|
|
2
2
|
import { n as commentsPageScope } from "../page-xzgZ6DGm.js";
|
|
3
|
-
import { n as installedComments } from "../plugin-
|
|
3
|
+
import { n as installedComments } from "../plugin-DbCYT7Ac.js";
|
|
4
4
|
// src/runtime/console.ts
|
|
5
5
|
function excerpt(text) {
|
|
6
6
|
const line = text.replace(/\s+/g, " ").trim();
|
package/dist/runtime/index.d.ts
CHANGED
|
@@ -1,10 +1,41 @@
|
|
|
1
1
|
import { s as CommentContext } from "../types-BX3vH18p.js";
|
|
2
2
|
import { g as CommentsUser } from "../define-B1jLSPe9.js";
|
|
3
|
-
import { t as Comments } from "../index-
|
|
3
|
+
import { t as Comments } from "../index-D1T7RJ4R.js";
|
|
4
4
|
import { f as CommentsRequestEvent } from "../types-l6GOb_yc.js";
|
|
5
|
-
import { t as CommentsSessionOptions } from "../session-
|
|
6
|
-
import { t as InstallCommentsOptions } from "../install-
|
|
5
|
+
import { t as CommentsSessionOptions } from "../session-CN4irEqf.js";
|
|
6
|
+
import { t as InstallCommentsOptions } from "../install-NehuMNhG.js";
|
|
7
7
|
import { t as CommentsDatabase } from "../store-DvNTDNgn.js";
|
|
8
|
+
/**
|
|
9
|
+
* A person that Site access in the ViteHub Console signed in to the app: a Console member, or a guest, with their roles,
|
|
10
|
+
* such as `console` and `comments-write`. The Console signs them in a Site access token, which the app keeps in its
|
|
11
|
+
* site cookie.
|
|
12
|
+
*/
|
|
13
|
+
interface ViteHubSiteVisitor {
|
|
14
|
+
id: string;
|
|
15
|
+
name: string;
|
|
16
|
+
email?: string;
|
|
17
|
+
image?: string;
|
|
18
|
+
roles: string[];
|
|
19
|
+
/** `member` for a member of the Console team, who has the `console` role. `guest` for an invited guest. */
|
|
20
|
+
kind: "member" | "guest";
|
|
21
|
+
commentsAgent?: {
|
|
22
|
+
project: {
|
|
23
|
+
id: string;
|
|
24
|
+
teamId: string;
|
|
25
|
+
url: string;
|
|
26
|
+
};
|
|
27
|
+
resolve: boolean;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
/** Reads the Site access person of a request. It returns undefined without a valid cookie of this app. */
|
|
31
|
+
type ViteHubSiteVisitorReader = (request: Request) => Promise<ViteHubSiteVisitor | undefined>;
|
|
32
|
+
/**
|
|
33
|
+
* The route of `GET /_vitehub/page/tools`: a Fetchable (https://fetchable.org). `installViteHubPageTools()` binds
|
|
34
|
+
* each Request to its app in Nitro's `request` hook, so the route finds the tools of that app.
|
|
35
|
+
*/
|
|
36
|
+
export declare const viteHubPageSessionHandler: {
|
|
37
|
+
fetch(request: Request): Promise<Response>;
|
|
38
|
+
};
|
|
8
39
|
/** The Server Env names of the OAuth client that people sign in to Comments with: a GitHub App's, or an OAuth App's. */
|
|
9
40
|
export declare const githubLoginEnv: {
|
|
10
41
|
readonly clientId: "VITEHUB_GITHUB_CLIENT_ID";
|
|
@@ -102,6 +133,7 @@ export declare function createCommentsHandler(options: CommentsHandlerOptions):
|
|
|
102
133
|
fetch(request: Request): Promise<Response>;
|
|
103
134
|
};
|
|
104
135
|
interface CommentsPluginOptions extends CommentsSessionOptions {
|
|
136
|
+
siteVisitor?: ViteHubSiteVisitorReader;
|
|
105
137
|
comments: Comments;
|
|
106
138
|
/** Offers GitHub sign-in or account switching through the overlay, even before read access is granted. */
|
|
107
139
|
githubLogin?: CommentsGitHubLogin;
|
|
@@ -131,6 +163,11 @@ interface CommentsPluginOptions extends CommentsSessionOptions {
|
|
|
131
163
|
dialect?: InstallCommentsOptions["dialect"];
|
|
132
164
|
/** Loads `@vite-hub/webhooks`, when `defineComments({ send })` is on. */
|
|
133
165
|
webhooks?: InstallCommentsOptions["webhooks"];
|
|
166
|
+
/** Install more segments of the pill, such as the **Console** segment of `vite-hub`. Only with the overlay on. */
|
|
167
|
+
pillSegments?: ReadonlyArray<(nitroApp: unknown, context: {
|
|
168
|
+
base?: string;
|
|
169
|
+
development: boolean;
|
|
170
|
+
}) => void>;
|
|
134
171
|
}
|
|
135
172
|
/** The Comments definition that the Nitro plugin installed, for the Console reader. */
|
|
136
173
|
export declare function installedComments(): Comments | undefined;
|
|
@@ -272,11 +309,4 @@ export declare function mcpToolResult(result: ViteHubMcpToolResult): {
|
|
|
272
309
|
structuredContent?: Record<string, unknown>;
|
|
273
310
|
isError: boolean;
|
|
274
311
|
};
|
|
275
|
-
/**
|
|
276
|
-
* The route of `GET /_vitehub/page/tools`: a Fetchable (https://fetchable.org). `installViteHubPageTools()` binds
|
|
277
|
-
* each Request to its app in Nitro's `request` hook, so the route finds the tools of that app.
|
|
278
|
-
*/
|
|
279
|
-
export declare const viteHubPageSessionHandler: {
|
|
280
|
-
fetch(request: Request): Promise<Response>;
|
|
281
|
-
};
|
|
282
312
|
export type { CommentsContent, CommentsContentField, CommentsDatabaseRegistry, CommentsGitHubLogin, CommentsHandlerOptions, CommentsMcpToolsOptions, CommentsPluginOptions };
|
package/dist/runtime/index.js
CHANGED
|
@@ -4,16 +4,17 @@ import "../client-files-lC6X7XyS.js";
|
|
|
4
4
|
import { t as commentsErrors } from "../errors-C0VwRHiy.js";
|
|
5
5
|
import { i as text, n as guestFromHeaders, t as authorOf } from "../identity-CT7-UGmS.js";
|
|
6
6
|
import { a as runtimeOf, r as resolveCommentsRuntime, t as commentSendOf } from "../installed-C9SkldMi.js";
|
|
7
|
-
import { a as commentThreadSummary, c as hiddenThreadsNote, n as commentAnchorSchema, o as commentThreadsText, r as commentInputSchemas, s as describeCommentThread, t as commentActions } from "../operations-
|
|
8
|
-
import { c as validateCommentsDefinition, o as deniedForMissingPolicy } from "../define-
|
|
9
|
-
import { h as readAttachment, i as contextSchema, n as base64, o as deniedError, p as mentionedPeople, r as can } from "../service-
|
|
7
|
+
import { a as commentThreadSummary, c as hiddenThreadsNote, n as commentAnchorSchema, o as commentThreadsText, r as commentInputSchemas, s as describeCommentThread, t as commentActions } from "../operations-B8IMhRmY.js";
|
|
8
|
+
import { c as validateCommentsDefinition, o as deniedForMissingPolicy } from "../define-BCxNaSZv.js";
|
|
9
|
+
import { h as readAttachment, i as contextSchema, n as base64, o as deniedError, p as mentionedPeople, r as can } from "../service-DUh2uGd2.js";
|
|
10
10
|
import { i as commentsRoute, n as commentsPageScope, o as normalizeCommentPage } from "../page-xzgZ6DGm.js";
|
|
11
|
-
import {
|
|
12
|
-
import { n as installedComments, t as defineCommentsPlugin } from "../plugin-
|
|
11
|
+
import { n as resolveCommentsPage, o as viteHubPageSessionHandler, t as resolveCommentsIdentity } from "../session-_1GY5gaG.js";
|
|
12
|
+
import { n as installedComments, t as defineCommentsPlugin } from "../plugin-DbCYT7Ac.js";
|
|
13
13
|
import { t as invariant } from "../invariant-CmdvZ3vp.js";
|
|
14
14
|
import { t as commentsErrorDiagnostics } from "../errors-DFNiJg67.js";
|
|
15
15
|
import { getStandardContext, installRequestStandardContext } from "@vite-hub/runtime/internal/h3";
|
|
16
16
|
import * as v from "valibot";
|
|
17
|
+
import { configuredConsoleOrigin } from "@vite-hub/runtime/internal/console";
|
|
17
18
|
import { defineGrant } from "@vite-hub/runtime/internal/grant";
|
|
18
19
|
import { hkdfSync } from "node:crypto";
|
|
19
20
|
import { defineAuth } from "@vite-hub/auth";
|
|
@@ -282,6 +283,10 @@ function createCommentsHandler(options) {
|
|
|
282
283
|
} : void 0;
|
|
283
284
|
const signOut = user && user.github && github ? `${route}/auth/sign-out` : void 0;
|
|
284
285
|
const send = Boolean(comments.options.send && user && !user.guest && comment && await commentSendOf(comments));
|
|
286
|
+
const agent = identity.commentsAgent && read ? {
|
|
287
|
+
...identity.commentsAgent,
|
|
288
|
+
mcp: `${configuredConsoleOrigin()}/mcp/account`
|
|
289
|
+
} : void 0;
|
|
285
290
|
return json({ data: {
|
|
286
291
|
user: user ? authorOf(user) : null,
|
|
287
292
|
...user && user.github ? { github: user.github } : {},
|
|
@@ -298,6 +303,7 @@ function createCommentsHandler(options) {
|
|
|
298
303
|
...options.presence === false ? { presence: false } : {},
|
|
299
304
|
content: Boolean(options.content),
|
|
300
305
|
...send ? { send: true } : {},
|
|
306
|
+
...agent ? { agent } : {},
|
|
301
307
|
...subject ? { subject } : {},
|
|
302
308
|
...revision === void 0 ? {} : { revision }
|
|
303
309
|
} });
|
package/dist/server.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { a as maximumCommentBodyLength, i as CommentsRuntime, n as CommentsAttac
|
|
|
3
3
|
import { i as createCommentsStore, n as CommentsStore, r as CommentsTables, t as CommentsDatabase } from "./store-DvNTDNgn.js";
|
|
4
4
|
import { a as commentsOperations, i as commentInputSchemas, n as commentActions, r as commentAnchorSchema, t as CommentsCaller } from "./operations-Cic9A9e_.js";
|
|
5
5
|
import { n as createRpcTransport, t as RpcTransportOptions } from "./rpc-D-eqtyfh.js";
|
|
6
|
-
import { n as installComments, t as InstallCommentsOptions } from "./install-
|
|
6
|
+
import { n as installComments, t as InstallCommentsOptions } from "./install-NehuMNhG.js";
|
|
7
7
|
/** Where mentions find people. The same shape as `defineComments({ people })`. */
|
|
8
8
|
export type CommentsUsers = CommentsPeople;
|
|
9
9
|
/**
|
package/dist/server.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { i as installCommentsRuntime, n as createAuthUsers, r as hasCommentsRuntime, t as commentsRuntime } from "./server-BGbD7H5s.js";
|
|
2
|
-
import { i as commentsOperations, n as commentAnchorSchema, r as commentInputSchemas, t as commentActions } from "./operations-
|
|
2
|
+
import { i as commentsOperations, n as commentAnchorSchema, r as commentInputSchemas, t as commentActions } from "./operations-B8IMhRmY.js";
|
|
3
3
|
import { t as createRpcTransport } from "./rpc-BKY7XRlR.js";
|
|
4
|
-
import { f as maximumCommentBodyLength } from "./service-
|
|
5
|
-
import { r as createCommentsStore, t as installComments } from "./install-
|
|
6
|
-
import { c as validateCommentsDefinition } from "./define-
|
|
4
|
+
import { f as maximumCommentBodyLength } from "./service-DUh2uGd2.js";
|
|
5
|
+
import { r as createCommentsStore, t as installComments } from "./install-w6CCgGFV.js";
|
|
6
|
+
import { c as validateCommentsDefinition } from "./define-BCxNaSZv.js";
|
|
7
7
|
export { commentActions, commentAnchorSchema, commentInputSchemas, commentsOperations, commentsRuntime, createAuthUsers, createCommentsStore, createRpcTransport, hasCommentsRuntime, installComments, installCommentsRuntime, maximumCommentBodyLength, validateCommentsDefinition };
|
|
@@ -3,7 +3,7 @@ import { t as commentsErrorDiagnostics } from "./errors-DFNiJg67.js";
|
|
|
3
3
|
import { t as isPagePath } from "./path-8yqMd8zR.js";
|
|
4
4
|
import { t as foldName } from "./fold-name-g-xg0mQk.js";
|
|
5
5
|
import { r as guestIdPrefix } from "./identity-CT7-UGmS.js";
|
|
6
|
-
import { i as defaultPolicy, o as deniedForMissingPolicy, t as builtinCommentSubjects } from "./define-
|
|
6
|
+
import { i as defaultPolicy, o as deniedForMissingPolicy, t as builtinCommentSubjects } from "./define-BCxNaSZv.js";
|
|
7
7
|
import { t as logFailure } from "./request-log-DllKQXj7.js";
|
|
8
8
|
import * as v from "valibot";
|
|
9
9
|
// ../internal/src/runtime/client-rate-limit.ts
|
|
@@ -198,6 +198,13 @@ async function readAccount(nitroApp, request) {
|
|
|
198
198
|
return;
|
|
199
199
|
}
|
|
200
200
|
}
|
|
201
|
+
/**
|
|
202
|
+
* Installs the reader of the Site access cookie. The Console installs it when the server starts, so page tools, such as
|
|
203
|
+
* Comments, know the person without depending on the Console.
|
|
204
|
+
*/
|
|
205
|
+
function installViteHubSiteVisitor(reader) {
|
|
206
|
+
state().siteVisitor = reader;
|
|
207
|
+
}
|
|
201
208
|
/** The reader of the Site access cookie, or undefined in an app where the Console did not install one. */
|
|
202
209
|
function viteHubSiteVisitorReader() {
|
|
203
210
|
return state().siteVisitor;
|
|
@@ -434,7 +441,7 @@ function installViteHubPageTools(nitroApp, options = {}) {
|
|
|
434
441
|
}
|
|
435
442
|
// src/runtime/session.ts
|
|
436
443
|
/**
|
|
437
|
-
* The person that Site access in the Console signed in to
|
|
444
|
+
* The person that Site access in the ViteHub Console signed in to the app, with their roles in `role`, as
|
|
438
445
|
* `commentsRoleAllows()` reads them. A Console member has `comments-*` roles, a guest the roles of the invite.
|
|
439
446
|
*/
|
|
440
447
|
async function siteUser(event) {
|
|
@@ -442,17 +449,23 @@ async function siteUser(event) {
|
|
|
442
449
|
if (!read) return null;
|
|
443
450
|
const visitor = await read(getStandardContext(event).req).catch(() => void 0);
|
|
444
451
|
if (!visitor) return null;
|
|
445
|
-
const { roles, ...person } = visitor;
|
|
446
452
|
return {
|
|
447
|
-
|
|
448
|
-
|
|
453
|
+
user: {
|
|
454
|
+
id: visitor.id,
|
|
455
|
+
name: visitor.name,
|
|
456
|
+
...visitor.email ? { email: visitor.email } : {},
|
|
457
|
+
...visitor.image ? { image: visitor.image } : {},
|
|
458
|
+
role: visitor.roles.join(",")
|
|
459
|
+
},
|
|
460
|
+
gate: {},
|
|
461
|
+
...visitor.kind === "member" && visitor.commentsAgent ? { commentsAgent: visitor.commentsAgent } : {}
|
|
449
462
|
};
|
|
450
463
|
}
|
|
451
464
|
/**
|
|
452
465
|
* The user of a request, shared by the overlay API, Realtime presence, the MCP tools, and the comment operations.
|
|
453
466
|
* With `identify`, the app decides: `identify` names the user, `null` is anonymous, and `authorize` decides what they may do. Without
|
|
454
|
-
* `identify`, it is the
|
|
455
|
-
*
|
|
467
|
+
* `identify`, it is the person of the Site access cookie. Then, when there is none, the user of `session`, the ViteHub
|
|
468
|
+
* Auth user, and last the person signed in with GitHub.
|
|
456
469
|
*/
|
|
457
470
|
async function resolveCommentsIdentity(comments, event, options = {}) {
|
|
458
471
|
if (comments.options.identify) {
|
|
@@ -462,8 +475,10 @@ async function resolveCommentsIdentity(comments, event, options = {}) {
|
|
|
462
475
|
gate: {}
|
|
463
476
|
};
|
|
464
477
|
}
|
|
478
|
+
const site = await siteUser(event);
|
|
479
|
+
if (site) return site;
|
|
465
480
|
return {
|
|
466
|
-
user: await options.session?.(event).catch(() => null) ?? await
|
|
481
|
+
user: await options.session?.(event).catch(() => null) ?? await options.githubLogin?.user(event).catch(() => null) ?? null,
|
|
467
482
|
gate: {}
|
|
468
483
|
};
|
|
469
484
|
}
|
|
@@ -494,4 +509,4 @@ async function resolveCommentsPage(comments, event, request, path) {
|
|
|
494
509
|
...mapped.revision === void 0 ? {} : { revision: mapped.revision }
|
|
495
510
|
};
|
|
496
511
|
}
|
|
497
|
-
export {
|
|
512
|
+
export { registerViteHubPageTool as a, installViteHubSiteVisitor as i, resolveCommentsPage as n, viteHubPageSessionHandler as o, installViteHubPageTools as r, resolveCommentsIdentity as t };
|
package/dist/vite.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { a as CommentBuild } from "./types-BX3vH18p.js";
|
|
2
2
|
import { n as OperationContributions } from "./operations-8hqTi0DH.js";
|
|
3
|
-
import { i as ViteHubInspectionPluginMetadata, r as ViteHubConsoleRuntimeRecordTableSection, t as ViteHubConsoleOperationSection } from "./console-
|
|
3
|
+
import { i as ViteHubInspectionPluginMetadata, r as ViteHubConsoleRuntimeRecordTableSection, t as ViteHubConsoleOperationSection } from "./console-CCLX_eIk.js";
|
|
4
4
|
import "./types-l6GOb_yc.js";
|
|
5
5
|
import { n as mountedCommentsRoute } from "./page-DE71P_gQ.js";
|
|
6
6
|
import { Plugin, PluginOption } from "vite";
|
|
@@ -51,6 +51,7 @@ type DeploymentEnvContribution = (context: DeploymentEnvContext) => readonly Dep
|
|
|
51
51
|
interface CommentsImports {
|
|
52
52
|
/** Exports `defineCommentsPlugin`, `createCommentsHandler`, and `viteHubPageSessionHandler`. */
|
|
53
53
|
runtime: string;
|
|
54
|
+
siteVisitor?: string;
|
|
54
55
|
/** Exports `commentsRealtime`. */
|
|
55
56
|
realtime: string;
|
|
56
57
|
/** Exports `commentsAuthSession`. */
|
|
@@ -124,6 +125,21 @@ interface CommentsVitePluginOptions {
|
|
|
124
125
|
* `defineComments({ rateLimit })` there too. Default `false`: each process counts in its memory.
|
|
125
126
|
*/
|
|
126
127
|
rateLimit?: boolean;
|
|
128
|
+
/**
|
|
129
|
+
* More segments of the Comments pill, such as the **Console** segment of `vite-hub`. The generated Nitro plugin
|
|
130
|
+
* imports `export` from `module` and calls it with the Nitro app and `{ base, development, ...options }`, before it
|
|
131
|
+
* installs the pill. With `overlay: false`, the app has no pill and calls none of them.
|
|
132
|
+
*/
|
|
133
|
+
pillSegments?: readonly CommentsPillSegment[];
|
|
134
|
+
}
|
|
135
|
+
/** A segment of the Comments pill that another package adds. See `CommentsVitePluginOptions.pillSegments`. */
|
|
136
|
+
interface CommentsPillSegment {
|
|
137
|
+
/** The file or package path of the module that exports the install function. */
|
|
138
|
+
module: string;
|
|
139
|
+
/** The name of the install function. */
|
|
140
|
+
export: string;
|
|
141
|
+
/** JSON options that the install function gets with `base` and `development`. */
|
|
142
|
+
options?: Readonly<Record<string, string | number | boolean>>;
|
|
127
143
|
}
|
|
128
144
|
interface CommentsRealtimeContributionContext {
|
|
129
145
|
driver: "cloudflare" | "memory";
|
|
@@ -306,4 +322,4 @@ export declare function findCommentsEntry(options: {
|
|
|
306
322
|
* or as its default export; both run every surface on the same tables.
|
|
307
323
|
*/
|
|
308
324
|
export declare function hubComments(options?: HubCommentsOptions): CommentsVitePlugin;
|
|
309
|
-
export { type CommentsComponent, type CommentsImports, type CommentsOptions, type CommentsOverlayAssets, type CommentsOverlayOptions, type CommentsRealtimeContributionContext, type CommentsVitePluginOptions, type StandaloneDatabase, comments as default, commentsConsoleSection$1 as commentsOperationsConsoleSection, githubRepository, mountedCommentsRoute };
|
|
325
|
+
export { type CommentsComponent, type CommentsImports, type CommentsOptions, type CommentsOverlayAssets, type CommentsOverlayOptions, type CommentsPillSegment, type CommentsRealtimeContributionContext, type CommentsVitePluginOptions, type StandaloneDatabase, comments as default, commentsConsoleSection$1 as commentsOperationsConsoleSection, githubRepository, mountedCommentsRoute };
|
package/dist/vite.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as invariant } from "./invariant-CmdvZ3vp.js";
|
|
2
|
-
import { c as validateCommentsDefinition } from "./define-
|
|
2
|
+
import { c as validateCommentsDefinition } from "./define-BCxNaSZv.js";
|
|
3
3
|
import { t as commentsErrorDiagnostics } from "./errors-DFNiJg67.js";
|
|
4
4
|
import { a as viteHubPageToolsCookie, d as viteHubPageToolsQuery, i as viteHubPageToolsAssets, n as viteHubBasePath, r as viteHubPageSessionPath, s as viteHubPageToolsInlineScript } from "./page-tools-shared-fvmJQCrP.js";
|
|
5
5
|
import { n as isRecordOrFunction } from "./object-CAK6UYR5.js";
|
|
@@ -956,6 +956,8 @@ function renderCommentsPlugin(input) {
|
|
|
956
956
|
const session = sessionWithGitHubLines(input.session ?? {}, input.imports, input.build?.repository, input.base);
|
|
957
957
|
const postgres = input.session?.dialect === "postgresql";
|
|
958
958
|
const overlay = input.session?.overlay === false ? "false" : JSON.stringify(`${commentsRoute}/assets/overlay.js?v=${version}`);
|
|
959
|
+
const segments = pillSegmentLines(input.session?.overlay === false ? [] : input.session?.pillSegments ?? []);
|
|
960
|
+
const siteVisitor = input.session?.overlay === false && input.imports.siteVisitor ? `siteVisitor: async (request) => (await import(${JSON.stringify(input.imports.siteVisitor)})).readConsoleSiteVisitor(request, ${JSON.stringify(input.base ?? "")}, ${input.development === true})` : void 0;
|
|
959
961
|
if (input.standalone) {
|
|
960
962
|
const { where, fallback, node } = input.standalone;
|
|
961
963
|
const options = [`name: "comments"`, ...fallback ? [`fallback: ${JSON.stringify(fallback)}`] : []];
|
|
@@ -964,10 +966,11 @@ function renderCommentsPlugin(input) {
|
|
|
964
966
|
`import { connectDatabase } from ${JSON.stringify(node ? `${input.imports.connect}/node` : input.imports.connect)}`,
|
|
965
967
|
...definitionLines(input.definition, input.imports.runtime),
|
|
966
968
|
...session.imports,
|
|
969
|
+
...segments.imports,
|
|
967
970
|
"",
|
|
968
971
|
`const database = () => connectDatabase(${where === void 0 ? "undefined" : JSON.stringify(where)}, { ${options.join(", ")} })`,
|
|
969
972
|
"",
|
|
970
|
-
`export default defineCommentsPlugin({ comments, database, schema: "comments", session: ${session.value}, ${session.githubLogin ? "githubLogin, " : ""}development: ${input.development === true}, overlay: ${overlay}, base: ${JSON.stringify(input.base ?? "")} })`,
|
|
973
|
+
`export default defineCommentsPlugin({ comments, database, schema: "comments", session: ${session.value}, ${session.githubLogin ? "githubLogin, " : ""}development: ${input.development === true}, overlay: ${overlay}, base: ${JSON.stringify(input.base ?? "")}${segments.value ? `, pillSegments: ${segments.value}` : ""} })`,
|
|
971
974
|
""
|
|
972
975
|
].join("\n");
|
|
973
976
|
}
|
|
@@ -975,6 +978,7 @@ function renderCommentsPlugin(input) {
|
|
|
975
978
|
`import { defineCommentsPlugin, selectCommentsDatabase } from ${JSON.stringify(input.imports.runtime)}`,
|
|
976
979
|
...definitionLines(input.definition, input.imports.runtime),
|
|
977
980
|
...session.imports,
|
|
981
|
+
...segments.imports,
|
|
978
982
|
"",
|
|
979
983
|
`const database = async () => selectCommentsDatabase((await import(${JSON.stringify(input.imports.databases)})).databases${input.database ? `, ${JSON.stringify(input.database)}` : ""})`,
|
|
980
984
|
"",
|
|
@@ -994,11 +998,20 @@ function renderCommentsPlugin(input) {
|
|
|
994
998
|
...input.send ? [`webhooks: () => import(${JSON.stringify(input.imports.webhooks)})`] : [],
|
|
995
999
|
`development: ${input.development === true}`,
|
|
996
1000
|
`overlay: ${overlay}`,
|
|
997
|
-
`base: ${JSON.stringify(input.base ?? "")}
|
|
1001
|
+
`base: ${JSON.stringify(input.base ?? "")}`,
|
|
1002
|
+
...siteVisitor ? [siteVisitor] : [],
|
|
1003
|
+
...segments.value ? [`pillSegments: ${segments.value}`] : []
|
|
998
1004
|
].join(", ")} })`,
|
|
999
1005
|
""
|
|
1000
1006
|
].join("\n");
|
|
1001
1007
|
}
|
|
1008
|
+
function pillSegmentLines(segments) {
|
|
1009
|
+
if (!segments.length) return { imports: [] };
|
|
1010
|
+
return {
|
|
1011
|
+
imports: segments.map((segment, index) => `import { ${segment.export} as pillSegment${index} } from ${JSON.stringify(segment.module)}`),
|
|
1012
|
+
value: `[${segments.map((segment, index) => `(nitroApp, context) => pillSegment${index}(nitroApp, { ...context, ...${JSON.stringify(segment.options ?? {})} })`).join(", ")}]`
|
|
1013
|
+
};
|
|
1014
|
+
}
|
|
1002
1015
|
/** The generated directory of Comments in a project. */
|
|
1003
1016
|
function generatedDirectory(projectRoot) {
|
|
1004
1017
|
return resolve(projectRoot, ".vitehub/nitro/comments");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vite-hub/comments",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Comments and in-place edits on live ViteHub sites, with presence and Content drafts.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"annotations",
|
|
@@ -106,10 +106,10 @@
|
|
|
106
106
|
"@valibot/to-json-schema": "^1.8.0",
|
|
107
107
|
"nostics": "1.4.0",
|
|
108
108
|
"valibot": "^1.5.0",
|
|
109
|
-
"@vite-hub/auth": "0.
|
|
110
|
-
"@vite-hub/forge": "0.
|
|
111
|
-
"@vite-hub/realtime": "0.
|
|
112
|
-
"@vite-hub/runtime": "0.
|
|
109
|
+
"@vite-hub/auth": "0.6.0",
|
|
110
|
+
"@vite-hub/forge": "0.6.0",
|
|
111
|
+
"@vite-hub/realtime": "0.6.0",
|
|
112
|
+
"@vite-hub/runtime": "0.6.0",
|
|
113
113
|
"birpc": "^4.2.0",
|
|
114
114
|
"confbox": "^0.3.2",
|
|
115
115
|
"h3": "^2.0.8"
|
|
@@ -128,12 +128,12 @@
|
|
|
128
128
|
"vitest": "5.1.0",
|
|
129
129
|
"vue": "3.5.46",
|
|
130
130
|
"@libsql/client": "^0.18.0",
|
|
131
|
-
"@vite-hub/database": "0.
|
|
131
|
+
"@vite-hub/database": "0.6.0",
|
|
132
132
|
"vite": "^8.3.8",
|
|
133
133
|
"drizzle-orm": "1.0.0-rc.6"
|
|
134
134
|
},
|
|
135
135
|
"peerDependencies": {
|
|
136
|
-
"@vite-hub/database": "0.
|
|
136
|
+
"@vite-hub/database": "0.6.0",
|
|
137
137
|
"nitro": "3.0.261102-rc || ^3.0.261103-rc",
|
|
138
138
|
"vite": ">=8.0.0",
|
|
139
139
|
"drizzle-orm": "1.0.0-rc.5 || 1.0.0-rc.6 || ^1.0.0"
|