@vite-hub/comments 0.5.1 → 0.6.1
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 +21 -4
- package/dist/{client-diagnostics-CvfTW5d4.js → client-diagnostics-D987sEK7.js} +4 -0
- package/dist/client.d.ts +96 -19
- package/dist/client.js +525 -79
- package/dist/{console-CK2F53QP.d.ts → console-CCLX_eIk.d.ts} +1 -1
- package/dist/{database-BkPoOdZr.js → database-Cguz3hZL.js} +1 -1
- package/dist/database.js +1 -1
- package/dist/{define-9uMM3Ewc.js → define-C2tnAtBU.js} +2 -2
- package/dist/{errors-DFNiJg67.js → errors-ByCRdInk.js} +1 -1
- package/dist/hosted/hosted-comments/{client-B3dlmmQd.js → client-Czl2zu9P.js} +3 -3
- package/dist/hosted/hosted-comments/frame.js +1 -1
- package/dist/hosted/hosted-comments/overlay-DpS0P-nd.js +186 -0
- package/dist/hosted/hosted-comments/protocol-DuB0Zhs-.js +1 -0
- package/dist/hosted/hosted-comments/rest-transport-CKZG_jZ4.js +1 -0
- package/dist/hosted/hosted-comments/tools-D8xg-kDW.js +126 -0
- package/dist/hosted/hosted-comments.js +13 -3
- package/dist/{index-BEnHTj2Z.d.ts → index-D1T7RJ4R.d.ts} +5 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +11 -10
- package/dist/{install-B-FQpi47.d.ts → install-9L4ASzUC.d.ts} +11 -2
- package/dist/{install-BUXxryut.js → install-D6hXZaSN.js} +45 -19
- package/dist/{installed-C9SkldMi.js → installed-bPUnazFf.js} +1 -1
- package/dist/{operations-CKC_lMG_.js → operations-B1ALn4VS.js} +7 -7
- package/dist/{operations-Cic9A9e_.d.ts → operations-BkkrI8a3.d.ts} +1 -1
- package/dist/operations.d.ts +2 -2
- package/dist/operations.js +2 -2
- package/dist/overlay/{client-CerbVjTz.js → client-C7ftI-CB.js} +3 -3
- package/dist/overlay/overlay.js +42 -16
- package/dist/page/loader.js +1 -1
- package/dist/{page-xzgZ6DGm.js → page-2NzFladc.js} +5 -1
- package/dist/{plugin-B2hETRii.js → plugin-l4sPt5-n.js} +13 -7
- package/dist/realtime.d.ts +11 -3
- package/dist/realtime.js +14 -6
- package/dist/{rpc-BKY7XRlR.js → rpc-BYmbVkr8.js} +1 -1
- package/dist/rpc.js +1 -1
- package/dist/runtime/auth.js +1 -1
- package/dist/runtime/console.d.ts +1 -1
- package/dist/runtime/console.js +2 -2
- package/dist/runtime/index.d.ts +42 -10
- package/dist/runtime/index.js +16 -8
- package/dist/{server-BGbD7H5s.js → server-DvSehkPP.js} +1 -1
- package/dist/server.d.ts +3 -3
- package/dist/server.js +6 -6
- package/dist/{service-DDD4Ubxd.js → service-BIGe1Hpo.js} +11 -6
- package/dist/{service-CPiWPoiY.d.ts → service-IvgrI4XM.d.ts} +2 -0
- package/dist/{session-BGN6Vlm6.js → session-CCRLR9bf.js} +24 -9
- package/dist/{session-CTh9nisq.d.ts → session-CN4irEqf.d.ts} +1 -1
- package/dist/testing.js +1 -1
- package/dist/vite.d.ts +19 -2
- package/dist/vite.js +39 -10
- package/package.json +7 -7
- package/dist/hosted/hosted-comments/overlay-4-mWX4Uz.js +0 -170
- package/dist/hosted/hosted-comments/protocol-BHvtQKte.js +0 -1
- package/dist/hosted/hosted-comments/rest-transport-D-9_pNqZ.js +0 -1
- package/dist/hosted/hosted-comments/tools-CdwnUCOr.js +0 -126
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}
|
|
@@ -7,6 +7,7 @@ import { n as pagePathOf } from "./path-8yqMd8zR.js";
|
|
|
7
7
|
const commentsPageScope = "site";
|
|
8
8
|
/** Name of the Realtime Definition that holds one presence room per page. */
|
|
9
9
|
const commentsRealtimeDefinition = "comments";
|
|
10
|
+
const commentsNoticeDefinition = "comments-notices";
|
|
10
11
|
/** The route prefix of the Comments API, below the app base. */
|
|
11
12
|
const commentsRoute = "/_vitehub/comments";
|
|
12
13
|
/** Mount Comments under the application path, ignoring Vite asset URLs such as a CDN origin. */
|
|
@@ -36,4 +37,7 @@ function commentRoom(page) {
|
|
|
36
37
|
}
|
|
37
38
|
return `pages/${a.toString(16).padStart(8, "0")}${b.toString(16).padStart(8, "0")}`;
|
|
38
39
|
}
|
|
39
|
-
|
|
40
|
+
function commentNoticeRoom(subject) {
|
|
41
|
+
return `subjects/${encodeURIComponent(JSON.stringify([subject.kind, subject.id]))}`;
|
|
42
|
+
}
|
|
43
|
+
export { commentsRealtimeDefinition as a, normalizeCommentPage as c, commentsPageScope as i, commentRoom as n, commentsRoute as o, commentsNoticeDefinition as r, mountedCommentsRoute as s, commentNoticeRoom as t };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { r as commentsRoleGrants } from "./define-
|
|
3
|
-
import { t as commentsErrorDiagnostics } from "./errors-
|
|
4
|
-
import { i as installCommentsRuntime } from "./server-
|
|
5
|
-
import { i as runtimeBuilds } from "./installed-
|
|
1
|
+
import { a as registerViteHubPageTool, i as installViteHubSiteVisitor, n as resolveCommentsPage, r as installViteHubPageTools, t as resolveCommentsIdentity } from "./session-CCRLR9bf.js";
|
|
2
|
+
import { r as commentsRoleGrants } from "./define-C2tnAtBU.js";
|
|
3
|
+
import { t as commentsErrorDiagnostics } from "./errors-ByCRdInk.js";
|
|
4
|
+
import { i as installCommentsRuntime } from "./server-DvSehkPP.js";
|
|
5
|
+
import { i as runtimeBuilds } from "./installed-bPUnazFf.js";
|
|
6
6
|
import { n as commentsTableNames } from "./table-names-BIHjuEFK.js";
|
|
7
7
|
import { installRequestStandardContext } from "@vite-hub/runtime/internal/h3";
|
|
8
8
|
import { configuredPublicOrigins } from "@vite-hub/runtime/internal/public-url";
|
|
@@ -38,7 +38,7 @@ function defineCommentsPlugin(options) {
|
|
|
38
38
|
warned = true;
|
|
39
39
|
throw Object.assign(commentsErrorDiagnostics.COMMENTS_R0010(), { status: 503 });
|
|
40
40
|
}
|
|
41
|
-
const { installComments } = await import("./install-
|
|
41
|
+
const { installComments } = await import("./install-D6hXZaSN.js").then((n) => n.n);
|
|
42
42
|
return installComments(options.comments, {
|
|
43
43
|
database,
|
|
44
44
|
development: options.development === true,
|
|
@@ -48,7 +48,8 @@ function defineCommentsPlugin(options) {
|
|
|
48
48
|
...options.users ? { users: options.users } : {},
|
|
49
49
|
...options.attachments ? { attachments: options.attachments } : {},
|
|
50
50
|
...options.rateLimit ? { rateLimit: options.rateLimit } : {},
|
|
51
|
-
...options.webhooks ? { webhooks: options.webhooks } : {}
|
|
51
|
+
...options.webhooks ? { webhooks: options.webhooks } : {},
|
|
52
|
+
...options.realtime ? { realtime: options.realtime } : {}
|
|
52
53
|
});
|
|
53
54
|
})().catch((error) => {
|
|
54
55
|
building = void 0;
|
|
@@ -66,6 +67,7 @@ function defineCommentsPlugin(options) {
|
|
|
66
67
|
for (const threadId of await runtime.store.deleteUser(userId)) runtime.forge?.changed(threadId);
|
|
67
68
|
}
|
|
68
69
|
});
|
|
70
|
+
if (options.siteVisitor) installViteHubSiteVisitor(options.siteVisitor);
|
|
69
71
|
if (options.overlay === false) return;
|
|
70
72
|
const script = options.overlay;
|
|
71
73
|
registerViteHubPageTool(nitroApp, {
|
|
@@ -89,6 +91,10 @@ function defineCommentsPlugin(options) {
|
|
|
89
91
|
return !options.comments.options.identify && options.githubLogin?.configured() && (!user || user.github) ? "lazy" : false;
|
|
90
92
|
}
|
|
91
93
|
});
|
|
94
|
+
for (const install of options.pillSegments ?? []) install(nitroApp, {
|
|
95
|
+
base: options.base,
|
|
96
|
+
development: options.development === true
|
|
97
|
+
});
|
|
92
98
|
installViteHubPageTools(nitroApp, {
|
|
93
99
|
base: options.base,
|
|
94
100
|
origins: options.development === true ? [] : configuredPublicOrigins()
|
package/dist/realtime.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as
|
|
1
|
+
import { T as CommentThread } from "./types-BX3vH18p.js";
|
|
2
|
+
import { t as Comments } from "./index-D1T7RJ4R.js";
|
|
3
|
+
import { t as CommentsSessionOptions } from "./session-CN4irEqf.js";
|
|
4
|
+
import "./types-l6GOb_yc.js";
|
|
3
5
|
import { RealtimeDefinition } from "@vite-hub/realtime";
|
|
4
6
|
/**
|
|
5
7
|
* The Realtime Definition of the page presence rooms: who is on a page and where their cursor is. Rooms hold no
|
|
@@ -7,4 +9,10 @@ import { RealtimeDefinition } from "@vite-hub/realtime";
|
|
|
7
9
|
* Guests name themselves in the browser. ViteHub adds it as the `comments` definition when the host has a room
|
|
8
10
|
* authority.
|
|
9
11
|
*/
|
|
10
|
-
export declare function commentsRealtime(comments: Comments, options?: CommentsSessionOptions): RealtimeDefinition;
|
|
12
|
+
export declare function commentsRealtime(comments: Comments, options?: CommentsSessionOptions, purpose?: "presence" | "notices"): RealtimeDefinition;
|
|
13
|
+
/** The notice that tells the open pages of a thread to load their threads again. */
|
|
14
|
+
export declare const commentsChangeNotice: {
|
|
15
|
+
readonly type: "comments";
|
|
16
|
+
};
|
|
17
|
+
/** Tells the browsers on the page of a thread that it changed, so they load their threads again. It never throws. */
|
|
18
|
+
export declare function notifyCommentsChange(thread: Pick<CommentThread, "subject">): Promise<void>;
|
package/dist/realtime.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { i as text } from "./identity-CT7-UGmS.js";
|
|
2
|
-
import {
|
|
3
|
-
import { n as resolveCommentsPage, t as resolveCommentsIdentity } from "./session-
|
|
2
|
+
import { c as normalizeCommentPage, n as commentRoom, r as commentsNoticeDefinition, t as commentNoticeRoom } from "./page-2NzFladc.js";
|
|
3
|
+
import { n as resolveCommentsPage, t as resolveCommentsIdentity } from "./session-CCRLR9bf.js";
|
|
4
4
|
// src/realtime.ts
|
|
5
5
|
function toRealtimeUser(user) {
|
|
6
6
|
const result = { id: user.id };
|
|
@@ -18,7 +18,7 @@ function toRealtimeUser(user) {
|
|
|
18
18
|
* Guests name themselves in the browser. ViteHub adds it as the `comments` definition when the host has a room
|
|
19
19
|
* authority.
|
|
20
20
|
*/
|
|
21
|
-
function commentsRealtime(comments, options = {}) {
|
|
21
|
+
function commentsRealtime(comments, options = {}, purpose = "presence") {
|
|
22
22
|
const readers = /* @__PURE__ */ new WeakMap();
|
|
23
23
|
return {
|
|
24
24
|
async identify({ event }) {
|
|
@@ -32,15 +32,23 @@ function commentsRealtime(comments, options = {}) {
|
|
|
32
32
|
if (mode !== "read" || identity === void 0) return false;
|
|
33
33
|
const page = new URL(request.url).searchParams.get("page");
|
|
34
34
|
if (!page) return false;
|
|
35
|
-
if (documentId !== commentRoom(normalizeCommentPage(page))) return false;
|
|
35
|
+
if (purpose === "presence" && documentId !== commentRoom(normalizeCommentPage(page))) return false;
|
|
36
36
|
const { subject } = await resolveCommentsPage(comments, event, request, page);
|
|
37
|
+
if (purpose === "notices" && documentId !== commentNoticeRoom(subject)) return false;
|
|
37
38
|
return await comments.can({
|
|
38
39
|
user: identity.user,
|
|
39
40
|
action: "read",
|
|
40
41
|
subject
|
|
41
42
|
}, identity.gate);
|
|
42
43
|
},
|
|
43
|
-
document: false
|
|
44
|
+
document: false,
|
|
45
|
+
...purpose === "notices" ? { awareness: false } : {}
|
|
44
46
|
};
|
|
45
47
|
}
|
|
46
|
-
|
|
48
|
+
/** The notice that tells the open pages of a thread to load their threads again. */
|
|
49
|
+
const commentsChangeNotice = { type: "comments" };
|
|
50
|
+
/** Tells the browsers on the page of a thread that it changed, so they load their threads again. It never throws. */
|
|
51
|
+
async function notifyCommentsChange(thread) {
|
|
52
|
+
await (await import("@vite-hub/realtime/server").catch(() => void 0))?.notifyRealtimeRoom(commentsNoticeDefinition, commentNoticeRoom(thread.subject), commentsChangeNotice);
|
|
53
|
+
}
|
|
54
|
+
export { commentsChangeNotice, commentsRealtime, notifyCommentsChange };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as isRecordOrFunction, t as isRecord } from "./object-CAK6UYR5.js";
|
|
2
|
-
import { i as commentsUnansweredError, t as commentsAnswerError } from "./client-diagnostics-
|
|
2
|
+
import { i as commentsUnansweredError, t as commentsAnswerError } from "./client-diagnostics-D987sEK7.js";
|
|
3
3
|
import { i as withCommentFiles, n as outboxAccountHeader, r as retryAfterOf } from "./client-files-lC6X7XyS.js";
|
|
4
4
|
import { createBirpc } from "birpc";
|
|
5
5
|
// ../internal/src/operation-rpc.ts
|
package/dist/rpc.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as createRpcTransport } from "./rpc-
|
|
1
|
+
export { t as createRpcTransport } from "./rpc-BYmbVkr8.js";
|
package/dist/runtime/auth.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as createAuthUsers } from "../server-
|
|
1
|
+
import { n as createAuthUsers } from "../server-DvSehkPP.js";
|
|
2
2
|
import { getStandardContext } from "@vite-hub/runtime/internal/h3";
|
|
3
3
|
// src/runtime/auth.ts
|
|
4
4
|
const authServer = () => import("@vite-hub/auth/internal/server");
|
|
@@ -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
|
-
import {
|
|
3
|
-
import { n as installedComments } from "../plugin-
|
|
2
|
+
import { i as commentsPageScope } from "../page-2NzFladc.js";
|
|
3
|
+
import { n as installedComments } from "../plugin-l4sPt5-n.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-9L4ASzUC.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,13 @@ 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
|
+
/** Loads `@vite-hub/comments/realtime`, when the app has the page presence rooms. */
|
|
167
|
+
realtime?: InstallCommentsOptions["realtime"];
|
|
168
|
+
/** Install more segments of the pill, such as the **Console** segment of `vite-hub`. Only with the overlay on. */
|
|
169
|
+
pillSegments?: ReadonlyArray<(nitroApp: unknown, context: {
|
|
170
|
+
base?: string;
|
|
171
|
+
development: boolean;
|
|
172
|
+
}) => void>;
|
|
134
173
|
}
|
|
135
174
|
/** The Comments definition that the Nitro plugin installed, for the Console reader. */
|
|
136
175
|
export declare function installedComments(): Comments | undefined;
|
|
@@ -272,11 +311,4 @@ export declare function mcpToolResult(result: ViteHubMcpToolResult): {
|
|
|
272
311
|
structuredContent?: Record<string, unknown>;
|
|
273
312
|
isError: boolean;
|
|
274
313
|
};
|
|
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
314
|
export type { CommentsContent, CommentsContentField, CommentsDatabaseRegistry, CommentsGitHubLogin, CommentsHandlerOptions, CommentsMcpToolsOptions, CommentsPluginOptions };
|
package/dist/runtime/index.js
CHANGED
|
@@ -3,17 +3,18 @@ import { t as forwardedRequestOrigin } from "../request-origin-YPzfE2eh.js";
|
|
|
3
3
|
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
|
-
import { a as runtimeOf, r as resolveCommentsRuntime, t as commentSendOf } from "../installed-
|
|
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-
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import { n as installedComments, t as defineCommentsPlugin } from "../plugin-
|
|
6
|
+
import { a as runtimeOf, r as resolveCommentsRuntime, t as commentSendOf } from "../installed-bPUnazFf.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-B1ALn4VS.js";
|
|
8
|
+
import { c as validateCommentsDefinition, o as deniedForMissingPolicy } from "../define-C2tnAtBU.js";
|
|
9
|
+
import { h as readAttachment, i as contextSchema, n as base64, o as deniedError, p as mentionedPeople, r as can } from "../service-BIGe1Hpo.js";
|
|
10
|
+
import { c as normalizeCommentPage, i as commentsPageScope, o as commentsRoute } from "../page-2NzFladc.js";
|
|
11
|
+
import { n as resolveCommentsPage, o as viteHubPageSessionHandler, t as resolveCommentsIdentity } from "../session-CCRLR9bf.js";
|
|
12
|
+
import { n as installedComments, t as defineCommentsPlugin } from "../plugin-l4sPt5-n.js";
|
|
13
13
|
import { t as invariant } from "../invariant-CmdvZ3vp.js";
|
|
14
|
-
import { t as commentsErrorDiagnostics } from "../errors-
|
|
14
|
+
import { t as commentsErrorDiagnostics } from "../errors-ByCRdInk.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,11 @@ 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;
|
|
290
|
+
const repository = read ? comments.options.forge?.repository ?? options.build?.repository : void 0;
|
|
285
291
|
return json({ data: {
|
|
286
292
|
user: user ? authorOf(user) : null,
|
|
287
293
|
...user && user.github ? { github: user.github } : {},
|
|
@@ -298,6 +304,8 @@ function createCommentsHandler(options) {
|
|
|
298
304
|
...options.presence === false ? { presence: false } : {},
|
|
299
305
|
content: Boolean(options.content),
|
|
300
306
|
...send ? { send: true } : {},
|
|
307
|
+
...agent ? { agent } : {},
|
|
308
|
+
...repository ? { repository } : {},
|
|
301
309
|
...subject ? { subject } : {},
|
|
302
310
|
...revision === void 0 ? {} : { revision }
|
|
303
311
|
} });
|
package/dist/server.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { b as validateCommentsDefinition, d as CommentsPeople } from "./define-B1jLSPe9.js";
|
|
2
|
-
import { a as maximumCommentBodyLength, i as CommentsRuntime, n as CommentsAttachmentStore, r as CommentsForgeHooks } from "./service-
|
|
2
|
+
import { a as maximumCommentBodyLength, i as CommentsRuntime, n as CommentsAttachmentStore, r as CommentsForgeHooks } from "./service-IvgrI4XM.js";
|
|
3
3
|
import { i as createCommentsStore, n as CommentsStore, r as CommentsTables, t as CommentsDatabase } from "./store-DvNTDNgn.js";
|
|
4
|
-
import { a as commentsOperations, i as commentInputSchemas, n as commentActions, r as commentAnchorSchema, t as CommentsCaller } from "./operations-
|
|
4
|
+
import { a as commentsOperations, i as commentInputSchemas, n as commentActions, r as commentAnchorSchema, t as CommentsCaller } from "./operations-BkkrI8a3.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-9L4ASzUC.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
|
-
import { i as installCommentsRuntime, n as createAuthUsers, r as hasCommentsRuntime, t as commentsRuntime } from "./server-
|
|
2
|
-
import { i as commentsOperations, n as commentAnchorSchema, r as commentInputSchemas, t as commentActions } from "./operations-
|
|
3
|
-
import { t as createRpcTransport } from "./rpc-
|
|
4
|
-
import { f as maximumCommentBodyLength } from "./service-
|
|
5
|
-
import { r as createCommentsStore, t as installComments } from "./install-
|
|
6
|
-
import { c as validateCommentsDefinition } from "./define-
|
|
1
|
+
import { i as installCommentsRuntime, n as createAuthUsers, r as hasCommentsRuntime, t as commentsRuntime } from "./server-DvSehkPP.js";
|
|
2
|
+
import { i as commentsOperations, n as commentAnchorSchema, r as commentInputSchemas, t as commentActions } from "./operations-B1ALn4VS.js";
|
|
3
|
+
import { t as createRpcTransport } from "./rpc-BYmbVkr8.js";
|
|
4
|
+
import { f as maximumCommentBodyLength } from "./service-BIGe1Hpo.js";
|
|
5
|
+
import { r as createCommentsStore, t as installComments } from "./install-D6hXZaSN.js";
|
|
6
|
+
import { c as validateCommentsDefinition } from "./define-C2tnAtBU.js";
|
|
7
7
|
export { commentActions, commentAnchorSchema, commentInputSchemas, commentsOperations, commentsRuntime, createAuthUsers, createCommentsStore, createRpcTransport, hasCommentsRuntime, installComments, installCommentsRuntime, maximumCommentBodyLength, validateCommentsDefinition };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { t as replyMessageId } from "./reply-id-Cm9FGOBs.js";
|
|
2
|
-
import { t as commentsErrorDiagnostics } from "./errors-
|
|
2
|
+
import { t as commentsErrorDiagnostics } from "./errors-ByCRdInk.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-C2tnAtBU.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
|
|
@@ -113,6 +113,11 @@ const inlineTypes = [
|
|
|
113
113
|
"image/webp",
|
|
114
114
|
"image/avif"
|
|
115
115
|
];
|
|
116
|
+
/** Runs the hooks that follow a change of a thread: the pull request sync and the notice to its open pages. */
|
|
117
|
+
async function threadChanged(runtime, thread) {
|
|
118
|
+
runtime.forge?.changed(thread.id);
|
|
119
|
+
await runtime.changed?.(thread).catch(() => void 0);
|
|
120
|
+
}
|
|
116
121
|
/** An error with the HTTP status that the operation RPC answers. */
|
|
117
122
|
function fail(error, status) {
|
|
118
123
|
return Object.assign(error, { status });
|
|
@@ -447,7 +452,7 @@ async function createThread(runtime, input, options = {}) {
|
|
|
447
452
|
...options.request ? { request: options.request } : {},
|
|
448
453
|
...options.waitUntil ? { waitUntil: options.waitUntil } : {}
|
|
449
454
|
});
|
|
450
|
-
runtime
|
|
455
|
+
await threadChanged(runtime, created);
|
|
451
456
|
return created;
|
|
452
457
|
}
|
|
453
458
|
/** The message that an earlier reply with this `requestId` stored in the thread. A retry gets it back before the reply checks. */
|
|
@@ -514,7 +519,7 @@ async function replyToThread(runtime, thread, input, options = {}) {
|
|
|
514
519
|
...options.request ? { request: options.request } : {},
|
|
515
520
|
...options.waitUntil ? { waitUntil: options.waitUntil } : {}
|
|
516
521
|
});
|
|
517
|
-
runtime
|
|
522
|
+
await threadChanged(runtime, next);
|
|
518
523
|
return {
|
|
519
524
|
message,
|
|
520
525
|
thread: next
|
|
@@ -548,7 +553,7 @@ async function editMessage(runtime, thread, messageId, input, options) {
|
|
|
548
553
|
comment: false,
|
|
549
554
|
...options.waitUntil ? { waitUntil: options.waitUntil } : {}
|
|
550
555
|
});
|
|
551
|
-
runtime
|
|
556
|
+
await threadChanged(runtime, next);
|
|
552
557
|
return next;
|
|
553
558
|
}
|
|
554
559
|
function safeName(name) {
|
|
@@ -661,4 +666,4 @@ async function readAttachment(runtime, key, context) {
|
|
|
661
666
|
type
|
|
662
667
|
};
|
|
663
668
|
}
|
|
664
|
-
export {
|
|
669
|
+
export { threadChanged as C, createClientRateLimit as E, suggest as S, clientRateLimitIssue as T, requestIdSchema as _, createThread as a, scopeOf as b, earlierThread as c, maximumAttachmentBytes as d, maximumCommentBodyLength as f, replyToThread as g, readAttachment as h, contextSchema as i, editMessage as l, personOf as m, base64 as n, deniedError as o, mentionedPeople as p, can as r, earlierReply as s, attachmentThread as t, fail as u, retried as v, clientAddressKey as w, storeAttachment as x, retriedReply as y };
|
|
@@ -65,5 +65,7 @@ interface CommentsRuntime {
|
|
|
65
65
|
background?: (task: Promise<unknown>) => void;
|
|
66
66
|
/** Runs after someone opens a thread again. With Send, it puts back the sends that carried the thread. */
|
|
67
67
|
reopened?: (thread: CommentThread) => Promise<unknown>;
|
|
68
|
+
/** Tells the open pages of a thread that it changed, such as through a Realtime notice to its page room. */
|
|
69
|
+
changed?: (thread: CommentThread) => Promise<void>;
|
|
68
70
|
}
|
|
69
71
|
export { maximumCommentBodyLength as a, CommentsRuntime as i, CommentsAttachmentStore as n, SharedRateLimit as o, CommentsForgeHooks as r, CommentsAttachmentBody as t };
|