@tempots/ui 1.2.1-next.7 → 2.0.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/browser-location-Td-R3jYM.cjs +1 -0
- package/{browser-location-NHbWKVZU.js → browser-location-Wn6jT0ta.js} +11 -13
- package/index.cjs +1 -1
- package/index.js +33 -33
- package/package.json +2 -2
- package/renderables/router/browser-location.d.ts +0 -14
- package/utils/make-relative-time.d.ts +5 -5
- package/utils/ticker.d.ts +1 -1
- package/browser-location-8M6odBVW.cjs +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("@tempots/dom"),r=require("./index.cjs"),c=()=>{const o=a.getWindow(),e=(o==null?void 0:o.location.hash)===""?void 0:(o==null?void 0:o.location.hash.substring(1))??void 0;return{pathname:(o==null?void 0:o.location.pathname)??"",search:Object.fromEntries(new URLSearchParams((o==null?void 0:o.location.search)??"").entries()),hash:e}},i=()=>{const o=a.prop(c(),r.areLocationsEqual),e=a.getWindow(),s=()=>{let t=(e==null?void 0:e.location.hash)??"";t.startsWith("#")&&(t=t.substring(1));const n={pathname:(e==null?void 0:e.location.pathname)??"",search:Object.fromEntries(new URLSearchParams((e==null?void 0:e.location.search)??"").entries()),hash:t===""?void 0:t};o.set(n)};return e==null||e.addEventListener("popstate",s),o.onDispose(()=>{e==null||e.removeEventListener("popstate",s)}),o.on(t=>{e==null||e.history.pushState({},"",r.urlFromLocation(t))}),o},h=o=>{const e=i();return a.Fragment(a.OnDispose(e.dispose),a.SetProvider(r.LocationProviderMarker,e,o))};exports.ProvideBrowserLocation=h;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
const
|
|
1
|
+
import { Fragment as n, OnDispose as c, SetProvider as h, prop as i, getWindow as r } from "@tempots/dom";
|
|
2
|
+
import { LocationProviderMarker as p, areLocationsEqual as m, urlFromLocation as d } from "./index.js";
|
|
3
|
+
const l = () => {
|
|
4
4
|
const t = r(), o = (t == null ? void 0 : t.location.hash) === "" ? void 0 : (t == null ? void 0 : t.location.hash.substring(1)) ?? void 0;
|
|
5
5
|
return {
|
|
6
6
|
pathname: (t == null ? void 0 : t.location.pathname) ?? "",
|
|
@@ -9,8 +9,8 @@ const d = () => {
|
|
|
9
9
|
),
|
|
10
10
|
hash: o
|
|
11
11
|
};
|
|
12
|
-
},
|
|
13
|
-
const t =
|
|
12
|
+
}, u = () => {
|
|
13
|
+
const t = i(l(), m), o = r(), a = () => {
|
|
14
14
|
let e = (o == null ? void 0 : o.location.hash) ?? "";
|
|
15
15
|
e.startsWith("#") && (e = e.substring(1));
|
|
16
16
|
const s = {
|
|
@@ -25,17 +25,15 @@ const d = () => {
|
|
|
25
25
|
return o == null || o.addEventListener("popstate", a), t.onDispose(() => {
|
|
26
26
|
o == null || o.removeEventListener("popstate", a);
|
|
27
27
|
}), t.on((e) => {
|
|
28
|
-
o == null || o.history.pushState({}, "",
|
|
28
|
+
o == null || o.history.pushState({}, "", d(e));
|
|
29
29
|
}), t;
|
|
30
|
-
},
|
|
31
|
-
const o =
|
|
30
|
+
}, v = (t) => {
|
|
31
|
+
const o = u();
|
|
32
32
|
return n(
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
c(o.dispose),
|
|
34
|
+
h(p, o, t)
|
|
35
35
|
);
|
|
36
36
|
};
|
|
37
37
|
export {
|
|
38
|
-
|
|
39
|
-
d as _makeLocation,
|
|
40
|
-
L as _makeLocationProp
|
|
38
|
+
v as ProvideBrowserLocation
|
|
41
39
|
};
|
package/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var de=Object.defineProperty;var me=(t,e,n)=>e in t?de(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var Et=(t,e,n)=>me(t,typeof e!="symbol"?e+"":e,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("@tempots/dom"),E=require("@tempots/std"),Ft=t=>{const e=t.split("/").pop();if(e==null||e.startsWith("."))return;const n=e.split(".")||[];return n.length>1?"."+n.pop():void 0},Mt=(t,e)=>{const n=Ft(e);return n!=null&&(t.length===0||!t.some(o=>n==o))},he=(t,e,n,o)=>{let r=t.target;for(;r!=null&&!(r instanceof HTMLAnchorElement);)r=r.parentElement;if(r==null)return!0;const i=r;if(t.button!==0||t.ctrlKey||t.metaKey||i.target!=="_self"&&i.target!==""||i.getAttribute("download")!=null)return!0;const{pathname:s,search:c,hash:l}=i;if(o){const u=s+c+l,d=i.getAttribute("href");if(!(d!=null&&d.startsWith("#"))&&d!==u)return!0}return e?!1:Mt(n,s)},Nt=(t,e={ignoreUrlWithExtension:!0,allowedExtensions:[],ignoreExternalUrl:!0})=>{const n=e.ignoreUrlWithExtension===!0&&Array.isArray(e.allowedExtensions)?e.allowedExtensions.map(o=>o.startsWith(".")?o:"."+o):[];return o=>{he(o,e.ignoreUrlWithExtension??!0,n,e.ignoreExternalUrl??!0)||t()&&o.preventDefault()}},Vt=a.makeProviderMark("LocationProvider"),pe=t=>a.Fragment(a.WithBrowserCtx(()=>a.Async(Promise.resolve().then(()=>require("./browser-location-8M6odBVW.cjs")).then(e=>e.ProvideBrowserLocation),e=>e(t))),a.WithHeadlessCtx(e=>a.Async(Promise.resolve().then(()=>require("./headless-location-24MkNdBT.cjs")).then(n=>n.ProvideHeadlessLocation),n=>n(e.container.currentURL,t)))),mt=t=>a.UseProvider(Vt,e=>n=>{const o=a.makeProp(e.value,e.equals);e.feedProp(o),o.on(e.set);const r=a.renderableOfTNode(t(o))(n);return i=>{o.dispose(),r(i)}}),ge=(t,e)=>t.pathname===e.pathname&&JSON.stringify(t.search)===JSON.stringify(e.search)&&t.hash===e.hash,Ht=(t,e)=>{var i;const n=new URL(t,e??((i=a.getWindow())==null?void 0:i.location.toString())),o=Object.fromEntries(n.searchParams.entries());let r=n.hash;return r.startsWith("#")&&(r=r.substring(1)),{pathname:n.pathname,search:o,hash:r===""?void 0:r}},Ut=(t,e)=>{const n=Ht(e);return t.set(n),t},ye=t=>{const n=new URLSearchParams(t.search).toString(),o=t.hash;return`${t.pathname}${n?`?${n}`:""}${o?`#${o}`:""}`},$t=(t,...e)=>{if(typeof t=="string"||a.Signal.is(t))return $t({href:t},...e);const{href:n,...o}=t;return mt(r=>a.html.a(a.on.click(Nt(()=>(Ut(r,a.Value.get(n)),!0),o)),a.attr.href(n),...e))},ht=a.makeProviderMark("Appearance"),we=t=>{const e=a.getWindow(),n=e!=null&&e.matchMedia!=null?e.matchMedia("(prefers-color-scheme: dark)"):void 0,o=(n==null?void 0:n.matches)??!1,r=a.makeProp(o?"dark":"light"),i=s=>{r.set(s.matches?"dark":"light")};return n==null||n.addEventListener("change",i),a.Fragment(a.SetProvider(ht,r,t),a.OnDispose(()=>n==null?void 0:n.removeEventListener("change",i)))},ve=t=>a.UseProvider(ht,t),pt=(t,e)=>{if(typeof e=="function")return pt(t,{success:e});const n=e.failure??(s=>s.map(c=>`Error: ${c}`)),o=e.success,r=e.loading??(()=>a.Empty),i=e.notAsked??(()=>a.Empty);return a.OneOfType(a.Value.toSignal(t),{AsyncSuccess:s=>o(s.$.value),AsyncFailure:s=>n(s.$.error),Loading:s=>r(s.map(c=>c.previousValue)),NotAsked:i})},xe=(t=10)=>a.WithElement(e=>a.OnDispose(E.delayed(()=>e==null?void 0:e.focus(),t))),be=(t=10)=>a.WithElement(e=>{const n=E.delayed(()=>e.select(),t);return a.OnDispose(n)}),Ae=a.WithElement(t=>{const e=t.style.getPropertyValue(":empty");return t.style.setProperty(":empty","display:none"),a.OnDispose(n=>{n&&t.style.setProperty(":empty",e)})}),Re=t=>a.Portal("head > title",a.attr.innerText(t)),Ee={partial:{root:null,rootMargin:"0px",threshold:0},full:{root:null,rootMargin:"0px",threshold:1}},G={partial:new Map,full:new Map},j={partial:null,full:null};function Oe(t){return j[t]==null&&(j[t]=new IntersectionObserver(e=>{e.forEach(n=>{const o=G[t].get(n.target);o==null||o.set(n.isIntersecting)})},Ee[t])),j[t]}const zt=(t,e)=>{const n=a.makeProp(!1);return a.Fragment(a.WithElement(o=>{const r=typeof IntersectionObserver<"u"?Oe(t):null;return G[t].set(o,n),r==null||r.observe(o),a.OnDispose(()=>{var i;n.dispose(),r==null||r.unobserve(o),G[t].delete(o),G[t].size===0&&((i=j[t])==null||i.disconnect(),j[t]=null)})}),a.renderableOfTNode(e(n)))},ke=(t,e,n)=>zt(t,o=>a.When(o,e,n??(()=>a.Empty))),Q=Math.min,F=Math.max,Z=Math.round,J=Math.floor,S=t=>({x:t,y:t}),Se={left:"right",right:"left",bottom:"top",top:"bottom"},Le={start:"end",end:"start"};function Ot(t,e,n){return F(t,Q(e,n))}function ot(t,e){return typeof t=="function"?t(e):t}function M(t){return t.split("-")[0]}function rt(t){return t.split("-")[1]}function Bt(t){return t==="x"?"y":"x"}function _t(t){return t==="y"?"height":"width"}function $(t){return["top","bottom"].includes(M(t))?"y":"x"}function It(t){return Bt($(t))}function Te(t,e,n){n===void 0&&(n=!1);const o=rt(t),r=It(t),i=_t(r);let s=r==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(s=tt(s)),[s,tt(s)]}function Pe(t){const e=tt(t);return[ut(t),e,ut(e)]}function ut(t){return t.replace(/start|end/g,e=>Le[e])}function Ce(t,e,n){const o=["left","right"],r=["right","left"],i=["top","bottom"],s=["bottom","top"];switch(t){case"top":case"bottom":return n?e?r:o:e?o:r;case"left":case"right":return e?i:s;default:return[]}}function De(t,e,n,o){const r=rt(t);let i=Ce(M(t),n==="start",o);return r&&(i=i.map(s=>s+"-"+r),e&&(i=i.concat(i.map(ut)))),i}function tt(t){return t.replace(/left|right|bottom|top/g,e=>Se[e])}function We(t){return{top:0,right:0,bottom:0,left:0,...t}}function Fe(t){return typeof t!="number"?We(t):{top:t,right:t,bottom:t,left:t}}function et(t){const{x:e,y:n,width:o,height:r}=t;return{width:o,height:r,top:n,left:e,right:e+o,bottom:n+r,x:e,y:n}}function kt(t,e,n){let{reference:o,floating:r}=t;const i=$(e),s=It(e),c=_t(s),l=M(e),u=i==="y",d=o.x+o.width/2-r.width/2,f=o.y+o.height/2-r.height/2,h=o[c]/2-r[c]/2;let m;switch(l){case"top":m={x:d,y:o.y-r.height};break;case"bottom":m={x:d,y:o.y+o.height};break;case"right":m={x:o.x+o.width,y:f};break;case"left":m={x:o.x-r.width,y:f};break;default:m={x:o.x,y:o.y}}switch(rt(e)){case"start":m[s]-=h*(n&&u?-1:1);break;case"end":m[s]+=h*(n&&u?-1:1);break}return m}const Me=async(t,e,n)=>{const{placement:o="bottom",strategy:r="absolute",middleware:i=[],platform:s}=n,c=i.filter(Boolean),l=await(s.isRTL==null?void 0:s.isRTL(e));let u=await s.getElementRects({reference:t,floating:e,strategy:r}),{x:d,y:f}=kt(u,o,l),h=o,m={},p=0;for(let y=0;y<c.length;y++){const{name:w,fn:g}=c[y],{x:v,y:x,data:A,reset:b}=await g({x:d,y:f,initialPlacement:o,placement:h,strategy:r,middlewareData:m,rects:u,platform:s,elements:{reference:t,floating:e}});d=v??d,f=x??f,m={...m,[w]:{...m[w],...A}},b&&p<=50&&(p++,typeof b=="object"&&(b.placement&&(h=b.placement),b.rects&&(u=b.rects===!0?await s.getElementRects({reference:t,floating:e,strategy:r}):b.rects),{x:d,y:f}=kt(u,h,l)),y=-1)}return{x:d,y:f,placement:h,strategy:r,middlewareData:m}};async function jt(t,e){var n;e===void 0&&(e={});const{x:o,y:r,platform:i,rects:s,elements:c,strategy:l}=t,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:f="floating",altBoundary:h=!1,padding:m=0}=ot(e,t),p=Fe(m),w=c[h?f==="floating"?"reference":"floating":f],g=et(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(w)))==null||n?w:w.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(c.floating)),boundary:u,rootBoundary:d,strategy:l})),v=f==="floating"?{x:o,y:r,width:s.floating.width,height:s.floating.height}:s.reference,x=await(i.getOffsetParent==null?void 0:i.getOffsetParent(c.floating)),A=await(i.isElement==null?void 0:i.isElement(x))?await(i.getScale==null?void 0:i.getScale(x))||{x:1,y:1}:{x:1,y:1},b=et(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:v,offsetParent:x,strategy:l}):v);return{top:(g.top-b.top+p.top)/A.y,bottom:(b.bottom-g.bottom+p.bottom)/A.y,left:(g.left-b.left+p.left)/A.x,right:(b.right-g.right+p.right)/A.x}}const Ne=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,o;const{placement:r,middlewareData:i,rects:s,initialPlacement:c,platform:l,elements:u}=e,{mainAxis:d=!0,crossAxis:f=!0,fallbackPlacements:h,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:y=!0,...w}=ot(t,e);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const g=M(r),v=$(c),x=M(c)===c,A=await(l.isRTL==null?void 0:l.isRTL(u.floating)),b=h||(x||!y?[tt(c)]:Pe(c)),V=p!=="none";!h&&V&&b.push(...De(c,y,p,A));const ue=[c,...b],lt=await jt(e,w),X=[];let _=((o=i.flip)==null?void 0:o.overflows)||[];if(d&&X.push(lt[g]),f){const W=Te(r,s,A);X.push(lt[W[0]],lt[W[1]])}if(_=[..._,{placement:r,overflows:X}],!X.every(W=>W<=0)){var xt,bt;const W=(((xt=i.flip)==null?void 0:xt.index)||0)+1,Rt=ue[W];if(Rt)return{data:{index:W,overflows:_},reset:{placement:Rt}};let I=(bt=_.filter(H=>H.overflows[0]<=0).sort((H,P)=>H.overflows[1]-P.overflows[1])[0])==null?void 0:bt.placement;if(!I)switch(m){case"bestFit":{var At;const H=(At=_.filter(P=>{if(V){const C=$(P.placement);return C===v||C==="y"}return!0}).map(P=>[P.placement,P.overflows.filter(C=>C>0).reduce((C,fe)=>C+fe,0)]).sort((P,C)=>P[1]-C[1])[0])==null?void 0:At[0];H&&(I=H);break}case"initialPlacement":I=c;break}if(r!==I)return{reset:{placement:I}}}return{}}}};async function Ve(t,e){const{placement:n,platform:o,elements:r}=t,i=await(o.isRTL==null?void 0:o.isRTL(r.floating)),s=M(n),c=rt(n),l=$(n)==="y",u=["left","top"].includes(s)?-1:1,d=i&&l?-1:1,f=ot(e,t);let{mainAxis:h,crossAxis:m,alignmentAxis:p}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return c&&typeof p=="number"&&(m=c==="end"?p*-1:p),l?{x:m*d,y:h*u}:{x:h*u,y:m*d}}const He=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,o;const{x:r,y:i,placement:s,middlewareData:c}=e,l=await Ve(e,t);return s===((n=c.offset)==null?void 0:n.placement)&&(o=c.arrow)!=null&&o.alignmentOffset?{}:{x:r+l.x,y:i+l.y,data:{...l,placement:s}}}}},Ue=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:o,placement:r}=e,{mainAxis:i=!0,crossAxis:s=!1,limiter:c={fn:w=>{let{x:g,y:v}=w;return{x:g,y:v}}},...l}=ot(t,e),u={x:n,y:o},d=await jt(e,l),f=$(M(r)),h=Bt(f);let m=u[h],p=u[f];if(i){const w=h==="y"?"top":"left",g=h==="y"?"bottom":"right",v=m+d[w],x=m-d[g];m=Ot(v,m,x)}if(s){const w=f==="y"?"top":"left",g=f==="y"?"bottom":"right",v=p+d[w],x=p-d[g];p=Ot(v,p,x)}const y=c.fn({...e,[h]:m,[f]:p});return{...y,data:{x:y.x-n,y:y.y-o,enabled:{[h]:i,[f]:s}}}}}};function it(){return typeof window<"u"}function B(t){return qt(t)?(t.nodeName||"").toLowerCase():"#document"}function R(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function T(t){var e;return(e=(qt(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function qt(t){return it()?t instanceof Node||t instanceof R(t).Node:!1}function O(t){return it()?t instanceof Element||t instanceof R(t).Element:!1}function L(t){return it()?t instanceof HTMLElement||t instanceof R(t).HTMLElement:!1}function St(t){return!it()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof R(t).ShadowRoot}function K(t){const{overflow:e,overflowX:n,overflowY:o,display:r}=k(t);return/auto|scroll|overlay|hidden|clip/.test(e+o+n)&&!["inline","contents"].includes(r)}function $e(t){return["table","td","th"].includes(B(t))}function st(t){return[":popover-open",":modal"].some(e=>{try{return t.matches(e)}catch{return!1}})}function gt(t){const e=yt(),n=O(t)?k(t):t;return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||["transform","perspective","filter"].some(o=>(n.willChange||"").includes(o))||["paint","layout","strict","content"].some(o=>(n.contain||"").includes(o))}function ze(t){let e=D(t);for(;L(e)&&!z(e);){if(gt(e))return e;if(st(e))return null;e=D(e)}return null}function yt(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function z(t){return["html","body","#document"].includes(B(t))}function k(t){return R(t).getComputedStyle(t)}function ct(t){return O(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function D(t){if(B(t)==="html")return t;const e=t.assignedSlot||t.parentNode||St(t)&&t.host||T(t);return St(e)?e.host:e}function Yt(t){const e=D(t);return z(e)?t.ownerDocument?t.ownerDocument.body:t.body:L(e)&&K(e)?e:Yt(e)}function q(t,e,n){var o;e===void 0&&(e=[]),n===void 0&&(n=!0);const r=Yt(t),i=r===((o=t.ownerDocument)==null?void 0:o.body),s=R(r);if(i){const c=ft(s);return e.concat(s,s.visualViewport||[],K(r)?r:[],c&&n?q(c):[])}return e.concat(r,q(r,[],n))}function ft(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function Kt(t){const e=k(t);let n=parseFloat(e.width)||0,o=parseFloat(e.height)||0;const r=L(t),i=r?t.offsetWidth:n,s=r?t.offsetHeight:o,c=Z(n)!==i||Z(o)!==s;return c&&(n=i,o=s),{width:n,height:o,$:c}}function wt(t){return O(t)?t:t.contextElement}function U(t){const e=wt(t);if(!L(e))return S(1);const n=e.getBoundingClientRect(),{width:o,height:r,$:i}=Kt(e);let s=(i?Z(n.width):n.width)/o,c=(i?Z(n.height):n.height)/r;return(!s||!Number.isFinite(s))&&(s=1),(!c||!Number.isFinite(c))&&(c=1),{x:s,y:c}}const Be=S(0);function Xt(t){const e=R(t);return!yt()||!e.visualViewport?Be:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function _e(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==R(t)?!1:e}function N(t,e,n,o){e===void 0&&(e=!1),n===void 0&&(n=!1);const r=t.getBoundingClientRect(),i=wt(t);let s=S(1);e&&(o?O(o)&&(s=U(o)):s=U(t));const c=_e(i,n,o)?Xt(i):S(0);let l=(r.left+c.x)/s.x,u=(r.top+c.y)/s.y,d=r.width/s.x,f=r.height/s.y;if(i){const h=R(i),m=o&&O(o)?R(o):o;let p=h,y=ft(p);for(;y&&o&&m!==p;){const w=U(y),g=y.getBoundingClientRect(),v=k(y),x=g.left+(y.clientLeft+parseFloat(v.paddingLeft))*w.x,A=g.top+(y.clientTop+parseFloat(v.paddingTop))*w.y;l*=w.x,u*=w.y,d*=w.x,f*=w.y,l+=x,u+=A,p=R(y),y=ft(p)}}return et({width:d,height:f,x:l,y:u})}function vt(t,e){const n=ct(t).scrollLeft;return e?e.left+n:N(T(t)).left+n}function Jt(t,e,n){n===void 0&&(n=!1);const o=t.getBoundingClientRect(),r=o.left+e.scrollLeft-(n?0:vt(t,o)),i=o.top+e.scrollTop;return{x:r,y:i}}function Ie(t){let{elements:e,rect:n,offsetParent:o,strategy:r}=t;const i=r==="fixed",s=T(o),c=e?st(e.floating):!1;if(o===s||c&&i)return n;let l={scrollLeft:0,scrollTop:0},u=S(1);const d=S(0),f=L(o);if((f||!f&&!i)&&((B(o)!=="body"||K(s))&&(l=ct(o)),L(o))){const m=N(o);u=U(o),d.x=m.x+o.clientLeft,d.y=m.y+o.clientTop}const h=s&&!f&&!i?Jt(s,l,!0):S(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-l.scrollLeft*u.x+d.x+h.x,y:n.y*u.y-l.scrollTop*u.y+d.y+h.y}}function je(t){return Array.from(t.getClientRects())}function qe(t){const e=T(t),n=ct(t),o=t.ownerDocument.body,r=F(e.scrollWidth,e.clientWidth,o.scrollWidth,o.clientWidth),i=F(e.scrollHeight,e.clientHeight,o.scrollHeight,o.clientHeight);let s=-n.scrollLeft+vt(t);const c=-n.scrollTop;return k(o).direction==="rtl"&&(s+=F(e.clientWidth,o.clientWidth)-r),{width:r,height:i,x:s,y:c}}function Ye(t,e){const n=R(t),o=T(t),r=n.visualViewport;let i=o.clientWidth,s=o.clientHeight,c=0,l=0;if(r){i=r.width,s=r.height;const u=yt();(!u||u&&e==="fixed")&&(c=r.offsetLeft,l=r.offsetTop)}return{width:i,height:s,x:c,y:l}}function Ke(t,e){const n=N(t,!0,e==="fixed"),o=n.top+t.clientTop,r=n.left+t.clientLeft,i=L(t)?U(t):S(1),s=t.clientWidth*i.x,c=t.clientHeight*i.y,l=r*i.x,u=o*i.y;return{width:s,height:c,x:l,y:u}}function Lt(t,e,n){let o;if(e==="viewport")o=Ye(t,n);else if(e==="document")o=qe(T(t));else if(O(e))o=Ke(e,n);else{const r=Xt(t);o={x:e.x-r.x,y:e.y-r.y,width:e.width,height:e.height}}return et(o)}function Gt(t,e){const n=D(t);return n===e||!O(n)||z(n)?!1:k(n).position==="fixed"||Gt(n,e)}function Xe(t,e){const n=e.get(t);if(n)return n;let o=q(t,[],!1).filter(c=>O(c)&&B(c)!=="body"),r=null;const i=k(t).position==="fixed";let s=i?D(t):t;for(;O(s)&&!z(s);){const c=k(s),l=gt(s);!l&&c.position==="fixed"&&(r=null),(i?!l&&!r:!l&&c.position==="static"&&!!r&&["absolute","fixed"].includes(r.position)||K(s)&&!l&&Gt(t,s))?o=o.filter(d=>d!==s):r=c,s=D(s)}return e.set(t,o),o}function Je(t){let{element:e,boundary:n,rootBoundary:o,strategy:r}=t;const s=[...n==="clippingAncestors"?st(e)?[]:Xe(e,this._c):[].concat(n),o],c=s[0],l=s.reduce((u,d)=>{const f=Lt(e,d,r);return u.top=F(f.top,u.top),u.right=Q(f.right,u.right),u.bottom=Q(f.bottom,u.bottom),u.left=F(f.left,u.left),u},Lt(e,c,r));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function Ge(t){const{width:e,height:n}=Kt(t);return{width:e,height:n}}function Qe(t,e,n){const o=L(e),r=T(e),i=n==="fixed",s=N(t,!0,i,e);let c={scrollLeft:0,scrollTop:0};const l=S(0);if(o||!o&&!i)if((B(e)!=="body"||K(r))&&(c=ct(e)),o){const h=N(e,!0,i,e);l.x=h.x+e.clientLeft,l.y=h.y+e.clientTop}else r&&(l.x=vt(r));const u=r&&!o&&!i?Jt(r,c):S(0),d=s.left+c.scrollLeft-l.x-u.x,f=s.top+c.scrollTop-l.y-u.y;return{x:d,y:f,width:s.width,height:s.height}}function at(t){return k(t).position==="static"}function Tt(t,e){if(!L(t)||k(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return T(t)===n&&(n=n.ownerDocument.body),n}function Qt(t,e){const n=R(t);if(st(t))return n;if(!L(t)){let r=D(t);for(;r&&!z(r);){if(O(r)&&!at(r))return r;r=D(r)}return n}let o=Tt(t,e);for(;o&&$e(o)&&at(o);)o=Tt(o,e);return o&&z(o)&&at(o)&&!gt(o)?n:o||ze(t)||n}const Ze=async function(t){const e=this.getOffsetParent||Qt,n=this.getDimensions,o=await n(t.floating);return{reference:Qe(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function tn(t){return k(t).direction==="rtl"}const en={convertOffsetParentRelativeRectToViewportRelativeRect:Ie,getDocumentElement:T,getClippingRect:Je,getOffsetParent:Qt,getElementRects:Ze,getClientRects:je,getDimensions:Ge,getScale:U,isElement:O,isRTL:tn};function nn(t,e){let n=null,o;const r=T(t);function i(){var c;clearTimeout(o),(c=n)==null||c.disconnect(),n=null}function s(c,l){c===void 0&&(c=!1),l===void 0&&(l=1),i();const{left:u,top:d,width:f,height:h}=t.getBoundingClientRect();if(c||e(),!f||!h)return;const m=J(d),p=J(r.clientWidth-(u+f)),y=J(r.clientHeight-(d+h)),w=J(u),v={rootMargin:-m+"px "+-p+"px "+-y+"px "+-w+"px",threshold:F(0,Q(1,l))||1};let x=!0;function A(b){const V=b[0].intersectionRatio;if(V!==l){if(!x)return s();V?s(!1,V):o=setTimeout(()=>{s(!1,1e-7)},1e3)}x=!1}try{n=new IntersectionObserver(A,{...v,root:r.ownerDocument})}catch{n=new IntersectionObserver(A,v)}n.observe(t)}return s(!0),i}function on(t,e,n,o){o===void 0&&(o={});const{ancestorScroll:r=!0,ancestorResize:i=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:l=!1}=o,u=wt(t),d=r||i?[...u?q(u):[],...q(e)]:[];d.forEach(g=>{r&&g.addEventListener("scroll",n,{passive:!0}),i&&g.addEventListener("resize",n)});const f=u&&c?nn(u,n):null;let h=-1,m=null;s&&(m=new ResizeObserver(g=>{let[v]=g;v&&v.target===u&&m&&(m.unobserve(e),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var x;(x=m)==null||x.observe(e)})),n()}),u&&!l&&m.observe(u),m.observe(e));let p,y=l?N(t):null;l&&w();function w(){const g=N(t);y&&(g.x!==y.x||g.y!==y.y||g.width!==y.width||g.height!==y.height)&&n(),y=g,p=requestAnimationFrame(w)}return n(),()=>{var g;d.forEach(v=>{r&&v.removeEventListener("scroll",n),i&&v.removeEventListener("resize",n)}),f==null||f(),(g=m)==null||g.disconnect(),m=null,l&&cancelAnimationFrame(p)}}const rn=He,sn=Ue,Pt=Ne,cn=(t,e,n)=>{const o=new Map,r={platform:en,...n},i={...r.platform,_c:o};return Me(t,e,{...r,platform:i})},ln=({content:t,open:e,placement:n,offset:{mainAxis:o,crossAxis:r}={mainAxis:0,crossAxis:0}})=>a.WithBrowserCtx(i=>{const s=a.Value.toSignal(e),c=i.element;return a.When(s,()=>a.Portal("body",a.html.div(a.WithElement(l=>{const u=l;return u.style.position="absolute",a.OnDispose(on(c,u,async()=>{const{x:d,y:f}=await cn(c,u,{placement:n,strategy:"absolute",middleware:[Pt(),rn({mainAxis:o,crossAxis:r}),sn(),Pt()]});u.style.top=`${f}px`,u.style.left=`${d}px`}))}),t())))}),Zt=(t,e,n)=>{const o=a.makeProp(E.AsyncResult.notAsked),r=o.map(f=>E.AsyncResult.isSuccess(f)?f.value:void 0),i=o.map(f=>E.AsyncResult.isFailure(f)?f.error:void 0),s=o.map(f=>E.AsyncResult.isLoading(f));let c;const l=async f=>{c==null||c.abort(),c=new AbortController;const h=c.signal,m=o.get();o.set(E.AsyncResult.loading(E.AsyncResult.getOrUndefined(m)));try{const p=await e({request:f,abortSignal:h,previous:m});await Promise.resolve(),c=void 0,o.set(E.AsyncResult.success(p))}catch(p){c=void 0,o.set(E.AsyncResult.failure(n(p)))}},u=()=>l(t.get()),d=()=>{c==null||c.abort(),c=void 0,o.dispose()};return o.onDispose(t.on(l)),{status:o,value:r,error:i,loading:s,reload:u,dispose:d}},te=(t,e)=>{const{status:n,dispose:o,reload:r}=t,{loading:i,failure:s,success:c}=e;return a.Fragment(a.OnDispose(o),pt(n,{loading:i!=null?l=>i(l,r):void 0,failure:s!=null?l=>s(l,r):void 0,success:l=>c(l,r)}))},an=({request:t,load:e,mapError:n=o=>o})=>{const o=Zt(t,e,n);return r=>te(o,r)},ee=(t,e)=>{if(typeof e=="function")return ee(t,{success:e});const n=e.failure??(r=>a.Fragment(a.OnDispose(r.on(console.error)),r.map(i=>`Error: ${i}`))),o=e.success;return a.OneOfType(a.Value.toSignal(t),{Success:r=>o(r.$.value),Failure:r=>n(r.$.error)})},un=()=>a.on.focus(t=>{var e;return(e=t.target)==null?void 0:e.select()}),fn=t=>a.WithBrowserCtx(e=>{const{element:n}=e,o=a.makeProp({width:n.clientWidth,height:n.clientHeight}),r=a.renderableOfTNode(t(o))(e),i=()=>{o.set({width:n.clientWidth,height:n.clientHeight})};let s;return typeof ResizeObserver=="function"&&(s=new ResizeObserver(i),s.observe(n)),a.OnDispose(c=>{s==null||s.disconnect(),r(c)})}),dn=t=>e=>{const n=a.getWindow(),o=a.makeProp({width:(n==null?void 0:n.innerWidth)??0,height:(n==null?void 0:n.innerHeight)??0}),r=a.renderableOfTNode(t(o))(e),i=()=>{o.set({width:(n==null?void 0:n.innerWidth)??0,height:(n==null?void 0:n.innerHeight)??0})};return n==null||n.addEventListener("resize",i),s=>{n==null||n.removeEventListener("resize",i),r(s)}},ne=(t,e)=>{const n=e.split("/").filter(r=>r!==""),o={};for(let r=0;r<t.length;r++){const i=t[r],s=n[r];if(!s&&i.type!=="catch-all")return null;if(i.type==="literal"){if(i.value!==s)return null}else if(i.type==="param")o[i.name]=s;else if(i.type==="catch-all")return{params:o,path:e}}return n.length!==t.length?null:{params:o,path:e}},oe=t=>t.split("/").map(e=>e.startsWith(":")?{type:"param",name:e.slice(1)}:e==="*"?{type:"catch-all"}:{type:"literal",value:e}).filter(e=>e.type!=="literal"||e.value!==""),re=t=>{const e=t.map(n=>{const o=oe(n);return{route:n,segments:o}});return function(o){for(const{segments:r,route:i}of e){const s=ne(r,o);if(s)return{...s,route:i}}return null}},mn=t=>{const e=re(Object.keys(t));return mt(n=>{const o=n.map(r=>{const i=e(r.pathname);if(i==null)throw console.error("No route found for",r),new Error("No route found");return{params:i.params,route:i.route,path:i.path,search:r.search,hash:r.hash}});return a.OneOfTuple(o.map(r=>[r.route,r]),t)})},nt=60*1e3,dt=60*nt,Y=24*dt,Ct=7*Y,Dt=30*Y,hn=365*Y,pn=[{max:nt*90,value:nt,name:"minute",past:{singular:"a minute ago",plural:"{} minutes ago"},future:{singular:"in a minute",plural:"in {} minutes"}},{max:dt*36,value:dt,name:"hour",past:{singular:"an hour ago",plural:"{} hours ago"},future:{singular:"in an hour",plural:"in {} hours"}},{max:Y*10,value:Y,name:"day",past:{singular:"yesterday",plural:"{} days ago"},future:{singular:"tomorrow",plural:"in {} days"}},{max:Ct*6,value:Ct,name:"week",past:{singular:"last week",plural:"{} weeks ago"},future:{singular:"in a week",plural:"in {} weeks"}},{max:Dt*18,value:Dt,name:"month",past:{singular:"last month",plural:"{} months ago"},future:{singular:"in a month",plural:"in {} months"}},{max:1/0,value:hn,name:"year",past:{singular:"last year",plural:"{} years ago"},future:{singular:"in a year",plural:"in {} years"}}];function Wt(t,e,n,o){const r=Math.round(t/e);return r<=1?n:o.replace("{}",r.toLocaleString(void 0,{maximumFractionDigits:0,minimumFractionDigits:0}))}const ie=(t=1e3)=>{const e=a.makeProp(new Date),n=E.interval(()=>e.set(new Date),t);return e.onDispose(n),e},se=t=>{const e=Math.abs(t);if(e<nt)return t<0?"just now":"in a moment";for(const n of pn)if(e<n.max)return t<0?Wt(e,n.value,n.past.singular,n.past.plural):Wt(e,n.value,n.future.singular,n.future.plural);throw new Error("unreachable")},ce=(t,{now:e,frequency:n=1e4}={})=>{const o=e!=null?a.Signal.is(e)?e.derive():a.makeProp(e):ie(n),r=a.makeComputedOf(t,o)((i,s)=>i.getTime()-s.getTime());return r.onDispose(()=>a.Value.dispose(o)),r},le=(t,e={})=>{const n=ce(t,e),o=n.map(se);return o.onDispose(n.dispose),o},gn=(t,e={})=>le(t,e);class ae extends a.Prop{constructor(){super(...arguments);Et(this,"tick",()=>this.update(n=>n+1))}}const yn=(t=0)=>new ae(t,(e,n)=>e===n);exports.Anchor=$t;exports.AsyncResultView=pt;exports.AutoFocus=xe;exports.AutoSelect=be;exports.ElementSize=fn;exports.HTMLTitle=Re;exports.HiddenWhenEmpty=Ae;exports.InViewport=zt;exports.LocationProviderMarker=Vt;exports.PopOver=ln;exports.ProvideAppearance=we;exports.Resource=an;exports.ResourceDisplay=te;exports.ResultView=ee;exports.Router=mn;exports.SelectOnFocus=un;exports.SetLocation=pe;exports.Ticker=ae;exports.UseAppearance=ve;exports.UseLocation=mt;exports.WhenInViewport=ke;exports.WindowSize=dn;exports._checkExtensionCondition=Mt;exports._getExtension=Ft;exports._makeRouteMatcher=re;exports._parseRouteSegments=oe;exports.appearanceMarker=ht;exports.areLocationsEqual=ge;exports.handleAnchorClick=Nt;exports.locationFromURL=Ht;exports.makeNowSignal=ie;exports.makeRelativeTime=gn;exports.makeRelativeTimeMillisSignal=ce;exports.makeRelativeTimeSignal=le;exports.makeResource=Zt;exports.makeTicker=yn;exports.matchesRoute=ne;exports.setLocationFromUrl=Ut;exports.timeDiffToString=se;exports.urlFromLocation=ye;
|
|
1
|
+
"use strict";var de=Object.defineProperty;var he=(t,e,n)=>e in t?de(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var Et=(t,e,n)=>he(t,typeof e!="symbol"?e+"":e,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("@tempots/dom"),E=require("@tempots/std"),Ft=t=>{const e=t.split("/").pop();if(e==null||e.startsWith("."))return;const n=e.split(".")||[];return n.length>1?"."+n.pop():void 0},Mt=(t,e)=>{const n=Ft(e);return n!=null&&(t.length===0||!t.some(o=>n==o))},pe=(t,e,n,o)=>{let r=t.target;for(;r!=null&&!(r instanceof HTMLAnchorElement);)r=r.parentElement;if(r==null)return!0;const i=r;if(t.button!==0||t.ctrlKey||t.metaKey||i.target!=="_self"&&i.target!==""||i.getAttribute("download")!=null)return!0;const{pathname:s,search:c,hash:l}=i;if(o){const u=s+c+l,d=i.getAttribute("href");if(!(d!=null&&d.startsWith("#"))&&d!==u)return!0}return e?!1:Mt(n,s)},Vt=(t,e={ignoreUrlWithExtension:!0,allowedExtensions:[],ignoreExternalUrl:!0})=>{const n=e.ignoreUrlWithExtension===!0&&Array.isArray(e.allowedExtensions)?e.allowedExtensions.map(o=>o.startsWith(".")?o:"."+o):[];return o=>{pe(o,e.ignoreUrlWithExtension??!0,n,e.ignoreExternalUrl??!0)||t()&&o.preventDefault()}},Nt=a.makeProviderMark("LocationProvider"),me=t=>a.Fragment(a.WithBrowserCtx(()=>a.Async(Promise.resolve().then(()=>require("./browser-location-Td-R3jYM.cjs")).then(e=>e.ProvideBrowserLocation),e=>e(t))),a.WithHeadlessCtx(e=>a.Async(Promise.resolve().then(()=>require("./headless-location-24MkNdBT.cjs")).then(n=>n.ProvideHeadlessLocation),n=>n(e.container.currentURL,t)))),ht=t=>a.UseProvider(Nt,e=>n=>{const o=a.prop(e.value,e.equals);e.feedProp(o),o.on(e.set);const r=a.renderableOfTNode(t(o))(n);return i=>{o.dispose(),r(i)}}),ge=(t,e)=>t.pathname===e.pathname&&JSON.stringify(t.search)===JSON.stringify(e.search)&&t.hash===e.hash,Ht=(t,e)=>{var i;const n=new URL(t,e??((i=a.getWindow())==null?void 0:i.location.toString())),o=Object.fromEntries(n.searchParams.entries());let r=n.hash;return r.startsWith("#")&&(r=r.substring(1)),{pathname:n.pathname,search:o,hash:r===""?void 0:r}},Ut=(t,e)=>{const n=Ht(e);return t.set(n),t},ye=t=>{const n=new URLSearchParams(t.search).toString(),o=t.hash;return`${t.pathname}${n?`?${n}`:""}${o?`#${o}`:""}`},$t=(t,...e)=>{if(typeof t=="string"||a.Signal.is(t))return $t({href:t},...e);const{href:n,...o}=t;return ht(r=>a.html.a(a.on.click(Vt(()=>(Ut(r,a.Value.get(n)),!0),o)),a.attr.href(n),...e))},pt=a.makeProviderMark("Appearance"),we=t=>{const e=a.getWindow(),n=e!=null&&e.matchMedia!=null?e.matchMedia("(prefers-color-scheme: dark)"):void 0,o=(n==null?void 0:n.matches)??!1,r=a.prop(o?"dark":"light"),i=s=>{r.set(s.matches?"dark":"light")};return n==null||n.addEventListener("change",i),a.Fragment(a.SetProvider(pt,r,t),a.OnDispose(()=>n==null?void 0:n.removeEventListener("change",i)))},xe=t=>a.UseProvider(pt,t),mt=(t,e)=>{if(typeof e=="function")return mt(t,{success:e});const n=e.failure??(s=>s.map(c=>`Error: ${c}`)),o=e.success,r=e.loading??(()=>a.Empty),i=e.notAsked??(()=>a.Empty);return a.OneOfType(a.Value.toSignal(t),{AsyncSuccess:s=>o(s.$.value),AsyncFailure:s=>n(s.$.error),Loading:s=>r(s.map(c=>c.previousValue)),NotAsked:i})},ve=(t=10)=>a.WithElement(e=>a.OnDispose(E.delayed(()=>e==null?void 0:e.focus(),t))),be=(t=10)=>a.WithElement(e=>{const n=E.delayed(()=>e.select(),t);return a.OnDispose(n)}),Ae=a.WithElement(t=>{const e=t.style.getPropertyValue(":empty");return t.style.setProperty(":empty","display:none"),a.OnDispose(n=>{n&&t.style.setProperty(":empty",e)})}),Re=t=>a.Portal("head > title",a.attr.innerText(t)),Ee={partial:{root:null,rootMargin:"0px",threshold:0},full:{root:null,rootMargin:"0px",threshold:1}},G={partial:new Map,full:new Map},j={partial:null,full:null};function Oe(t){return j[t]==null&&(j[t]=new IntersectionObserver(e=>{e.forEach(n=>{const o=G[t].get(n.target);o==null||o.set(n.isIntersecting)})},Ee[t])),j[t]}const zt=(t,e)=>{const n=a.prop(!1);return a.Fragment(a.WithElement(o=>{const r=typeof IntersectionObserver<"u"?Oe(t):null;return G[t].set(o,n),r==null||r.observe(o),a.OnDispose(()=>{var i;n.dispose(),r==null||r.unobserve(o),G[t].delete(o),G[t].size===0&&((i=j[t])==null||i.disconnect(),j[t]=null)})}),a.renderableOfTNode(e(n)))},Se=(t,e,n)=>zt(t,o=>a.When(o,e,n??(()=>a.Empty))),Q=Math.min,F=Math.max,Z=Math.round,J=Math.floor,L=t=>({x:t,y:t}),Le={left:"right",right:"left",bottom:"top",top:"bottom"},Te={start:"end",end:"start"};function Ot(t,e,n){return F(t,Q(e,n))}function ot(t,e){return typeof t=="function"?t(e):t}function M(t){return t.split("-")[0]}function rt(t){return t.split("-")[1]}function Bt(t){return t==="x"?"y":"x"}function _t(t){return t==="y"?"height":"width"}function $(t){return["top","bottom"].includes(M(t))?"y":"x"}function It(t){return Bt($(t))}function ke(t,e,n){n===void 0&&(n=!1);const o=rt(t),r=It(t),i=_t(r);let s=r==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(s=tt(s)),[s,tt(s)]}function Ce(t){const e=tt(t);return[ut(t),e,ut(e)]}function ut(t){return t.replace(/start|end/g,e=>Te[e])}function Pe(t,e,n){const o=["left","right"],r=["right","left"],i=["top","bottom"],s=["bottom","top"];switch(t){case"top":case"bottom":return n?e?r:o:e?o:r;case"left":case"right":return e?i:s;default:return[]}}function De(t,e,n,o){const r=rt(t);let i=Pe(M(t),n==="start",o);return r&&(i=i.map(s=>s+"-"+r),e&&(i=i.concat(i.map(ut)))),i}function tt(t){return t.replace(/left|right|bottom|top/g,e=>Le[e])}function We(t){return{top:0,right:0,bottom:0,left:0,...t}}function Fe(t){return typeof t!="number"?We(t):{top:t,right:t,bottom:t,left:t}}function et(t){const{x:e,y:n,width:o,height:r}=t;return{width:o,height:r,top:n,left:e,right:e+o,bottom:n+r,x:e,y:n}}function St(t,e,n){let{reference:o,floating:r}=t;const i=$(e),s=It(e),c=_t(s),l=M(e),u=i==="y",d=o.x+o.width/2-r.width/2,f=o.y+o.height/2-r.height/2,p=o[c]/2-r[c]/2;let h;switch(l){case"top":h={x:d,y:o.y-r.height};break;case"bottom":h={x:d,y:o.y+o.height};break;case"right":h={x:o.x+o.width,y:f};break;case"left":h={x:o.x-r.width,y:f};break;default:h={x:o.x,y:o.y}}switch(rt(e)){case"start":h[s]-=p*(n&&u?-1:1);break;case"end":h[s]+=p*(n&&u?-1:1);break}return h}const Me=async(t,e,n)=>{const{placement:o="bottom",strategy:r="absolute",middleware:i=[],platform:s}=n,c=i.filter(Boolean),l=await(s.isRTL==null?void 0:s.isRTL(e));let u=await s.getElementRects({reference:t,floating:e,strategy:r}),{x:d,y:f}=St(u,o,l),p=o,h={},m=0;for(let y=0;y<c.length;y++){const{name:w,fn:g}=c[y],{x,y:v,data:A,reset:b}=await g({x:d,y:f,initialPlacement:o,placement:p,strategy:r,middlewareData:h,rects:u,platform:s,elements:{reference:t,floating:e}});d=x??d,f=v??f,h={...h,[w]:{...h[w],...A}},b&&m<=50&&(m++,typeof b=="object"&&(b.placement&&(p=b.placement),b.rects&&(u=b.rects===!0?await s.getElementRects({reference:t,floating:e,strategy:r}):b.rects),{x:d,y:f}=St(u,p,l)),y=-1)}return{x:d,y:f,placement:p,strategy:r,middlewareData:h}};async function jt(t,e){var n;e===void 0&&(e={});const{x:o,y:r,platform:i,rects:s,elements:c,strategy:l}=t,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:f="floating",altBoundary:p=!1,padding:h=0}=ot(e,t),m=Fe(h),w=c[p?f==="floating"?"reference":"floating":f],g=et(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(w)))==null||n?w:w.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(c.floating)),boundary:u,rootBoundary:d,strategy:l})),x=f==="floating"?{x:o,y:r,width:s.floating.width,height:s.floating.height}:s.reference,v=await(i.getOffsetParent==null?void 0:i.getOffsetParent(c.floating)),A=await(i.isElement==null?void 0:i.isElement(v))?await(i.getScale==null?void 0:i.getScale(v))||{x:1,y:1}:{x:1,y:1},b=et(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:x,offsetParent:v,strategy:l}):x);return{top:(g.top-b.top+m.top)/A.y,bottom:(b.bottom-g.bottom+m.bottom)/A.y,left:(g.left-b.left+m.left)/A.x,right:(b.right-g.right+m.right)/A.x}}const Ve=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,o;const{placement:r,middlewareData:i,rects:s,initialPlacement:c,platform:l,elements:u}=e,{mainAxis:d=!0,crossAxis:f=!0,fallbackPlacements:p,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:y=!0,...w}=ot(t,e);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const g=M(r),x=$(c),v=M(c)===c,A=await(l.isRTL==null?void 0:l.isRTL(u.floating)),b=p||(v||!y?[tt(c)]:Ce(c)),N=m!=="none";!p&&N&&b.push(...De(c,y,m,A));const ue=[c,...b],lt=await jt(e,w),X=[];let _=((o=i.flip)==null?void 0:o.overflows)||[];if(d&&X.push(lt[g]),f){const W=ke(r,s,A);X.push(lt[W[0]],lt[W[1]])}if(_=[..._,{placement:r,overflows:X}],!X.every(W=>W<=0)){var vt,bt;const W=(((vt=i.flip)==null?void 0:vt.index)||0)+1,Rt=ue[W];if(Rt)return{data:{index:W,overflows:_},reset:{placement:Rt}};let I=(bt=_.filter(H=>H.overflows[0]<=0).sort((H,C)=>H.overflows[1]-C.overflows[1])[0])==null?void 0:bt.placement;if(!I)switch(h){case"bestFit":{var At;const H=(At=_.filter(C=>{if(N){const P=$(C.placement);return P===x||P==="y"}return!0}).map(C=>[C.placement,C.overflows.filter(P=>P>0).reduce((P,fe)=>P+fe,0)]).sort((C,P)=>C[1]-P[1])[0])==null?void 0:At[0];H&&(I=H);break}case"initialPlacement":I=c;break}if(r!==I)return{reset:{placement:I}}}return{}}}};async function Ne(t,e){const{placement:n,platform:o,elements:r}=t,i=await(o.isRTL==null?void 0:o.isRTL(r.floating)),s=M(n),c=rt(n),l=$(n)==="y",u=["left","top"].includes(s)?-1:1,d=i&&l?-1:1,f=ot(e,t);let{mainAxis:p,crossAxis:h,alignmentAxis:m}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return c&&typeof m=="number"&&(h=c==="end"?m*-1:m),l?{x:h*d,y:p*u}:{x:p*u,y:h*d}}const He=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,o;const{x:r,y:i,placement:s,middlewareData:c}=e,l=await Ne(e,t);return s===((n=c.offset)==null?void 0:n.placement)&&(o=c.arrow)!=null&&o.alignmentOffset?{}:{x:r+l.x,y:i+l.y,data:{...l,placement:s}}}}},Ue=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:o,placement:r}=e,{mainAxis:i=!0,crossAxis:s=!1,limiter:c={fn:w=>{let{x:g,y:x}=w;return{x:g,y:x}}},...l}=ot(t,e),u={x:n,y:o},d=await jt(e,l),f=$(M(r)),p=Bt(f);let h=u[p],m=u[f];if(i){const w=p==="y"?"top":"left",g=p==="y"?"bottom":"right",x=h+d[w],v=h-d[g];h=Ot(x,h,v)}if(s){const w=f==="y"?"top":"left",g=f==="y"?"bottom":"right",x=m+d[w],v=m-d[g];m=Ot(x,m,v)}const y=c.fn({...e,[p]:h,[f]:m});return{...y,data:{x:y.x-n,y:y.y-o,enabled:{[p]:i,[f]:s}}}}}};function it(){return typeof window<"u"}function B(t){return qt(t)?(t.nodeName||"").toLowerCase():"#document"}function R(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function k(t){var e;return(e=(qt(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function qt(t){return it()?t instanceof Node||t instanceof R(t).Node:!1}function O(t){return it()?t instanceof Element||t instanceof R(t).Element:!1}function T(t){return it()?t instanceof HTMLElement||t instanceof R(t).HTMLElement:!1}function Lt(t){return!it()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof R(t).ShadowRoot}function K(t){const{overflow:e,overflowX:n,overflowY:o,display:r}=S(t);return/auto|scroll|overlay|hidden|clip/.test(e+o+n)&&!["inline","contents"].includes(r)}function $e(t){return["table","td","th"].includes(B(t))}function st(t){return[":popover-open",":modal"].some(e=>{try{return t.matches(e)}catch{return!1}})}function gt(t){const e=yt(),n=O(t)?S(t):t;return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||["transform","perspective","filter"].some(o=>(n.willChange||"").includes(o))||["paint","layout","strict","content"].some(o=>(n.contain||"").includes(o))}function ze(t){let e=D(t);for(;T(e)&&!z(e);){if(gt(e))return e;if(st(e))return null;e=D(e)}return null}function yt(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function z(t){return["html","body","#document"].includes(B(t))}function S(t){return R(t).getComputedStyle(t)}function ct(t){return O(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function D(t){if(B(t)==="html")return t;const e=t.assignedSlot||t.parentNode||Lt(t)&&t.host||k(t);return Lt(e)?e.host:e}function Yt(t){const e=D(t);return z(e)?t.ownerDocument?t.ownerDocument.body:t.body:T(e)&&K(e)?e:Yt(e)}function q(t,e,n){var o;e===void 0&&(e=[]),n===void 0&&(n=!0);const r=Yt(t),i=r===((o=t.ownerDocument)==null?void 0:o.body),s=R(r);if(i){const c=ft(s);return e.concat(s,s.visualViewport||[],K(r)?r:[],c&&n?q(c):[])}return e.concat(r,q(r,[],n))}function ft(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function Kt(t){const e=S(t);let n=parseFloat(e.width)||0,o=parseFloat(e.height)||0;const r=T(t),i=r?t.offsetWidth:n,s=r?t.offsetHeight:o,c=Z(n)!==i||Z(o)!==s;return c&&(n=i,o=s),{width:n,height:o,$:c}}function wt(t){return O(t)?t:t.contextElement}function U(t){const e=wt(t);if(!T(e))return L(1);const n=e.getBoundingClientRect(),{width:o,height:r,$:i}=Kt(e);let s=(i?Z(n.width):n.width)/o,c=(i?Z(n.height):n.height)/r;return(!s||!Number.isFinite(s))&&(s=1),(!c||!Number.isFinite(c))&&(c=1),{x:s,y:c}}const Be=L(0);function Xt(t){const e=R(t);return!yt()||!e.visualViewport?Be:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function _e(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==R(t)?!1:e}function V(t,e,n,o){e===void 0&&(e=!1),n===void 0&&(n=!1);const r=t.getBoundingClientRect(),i=wt(t);let s=L(1);e&&(o?O(o)&&(s=U(o)):s=U(t));const c=_e(i,n,o)?Xt(i):L(0);let l=(r.left+c.x)/s.x,u=(r.top+c.y)/s.y,d=r.width/s.x,f=r.height/s.y;if(i){const p=R(i),h=o&&O(o)?R(o):o;let m=p,y=ft(m);for(;y&&o&&h!==m;){const w=U(y),g=y.getBoundingClientRect(),x=S(y),v=g.left+(y.clientLeft+parseFloat(x.paddingLeft))*w.x,A=g.top+(y.clientTop+parseFloat(x.paddingTop))*w.y;l*=w.x,u*=w.y,d*=w.x,f*=w.y,l+=v,u+=A,m=R(y),y=ft(m)}}return et({width:d,height:f,x:l,y:u})}function xt(t,e){const n=ct(t).scrollLeft;return e?e.left+n:V(k(t)).left+n}function Jt(t,e,n){n===void 0&&(n=!1);const o=t.getBoundingClientRect(),r=o.left+e.scrollLeft-(n?0:xt(t,o)),i=o.top+e.scrollTop;return{x:r,y:i}}function Ie(t){let{elements:e,rect:n,offsetParent:o,strategy:r}=t;const i=r==="fixed",s=k(o),c=e?st(e.floating):!1;if(o===s||c&&i)return n;let l={scrollLeft:0,scrollTop:0},u=L(1);const d=L(0),f=T(o);if((f||!f&&!i)&&((B(o)!=="body"||K(s))&&(l=ct(o)),T(o))){const h=V(o);u=U(o),d.x=h.x+o.clientLeft,d.y=h.y+o.clientTop}const p=s&&!f&&!i?Jt(s,l,!0):L(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-l.scrollLeft*u.x+d.x+p.x,y:n.y*u.y-l.scrollTop*u.y+d.y+p.y}}function je(t){return Array.from(t.getClientRects())}function qe(t){const e=k(t),n=ct(t),o=t.ownerDocument.body,r=F(e.scrollWidth,e.clientWidth,o.scrollWidth,o.clientWidth),i=F(e.scrollHeight,e.clientHeight,o.scrollHeight,o.clientHeight);let s=-n.scrollLeft+xt(t);const c=-n.scrollTop;return S(o).direction==="rtl"&&(s+=F(e.clientWidth,o.clientWidth)-r),{width:r,height:i,x:s,y:c}}function Ye(t,e){const n=R(t),o=k(t),r=n.visualViewport;let i=o.clientWidth,s=o.clientHeight,c=0,l=0;if(r){i=r.width,s=r.height;const u=yt();(!u||u&&e==="fixed")&&(c=r.offsetLeft,l=r.offsetTop)}return{width:i,height:s,x:c,y:l}}function Ke(t,e){const n=V(t,!0,e==="fixed"),o=n.top+t.clientTop,r=n.left+t.clientLeft,i=T(t)?U(t):L(1),s=t.clientWidth*i.x,c=t.clientHeight*i.y,l=r*i.x,u=o*i.y;return{width:s,height:c,x:l,y:u}}function Tt(t,e,n){let o;if(e==="viewport")o=Ye(t,n);else if(e==="document")o=qe(k(t));else if(O(e))o=Ke(e,n);else{const r=Xt(t);o={x:e.x-r.x,y:e.y-r.y,width:e.width,height:e.height}}return et(o)}function Gt(t,e){const n=D(t);return n===e||!O(n)||z(n)?!1:S(n).position==="fixed"||Gt(n,e)}function Xe(t,e){const n=e.get(t);if(n)return n;let o=q(t,[],!1).filter(c=>O(c)&&B(c)!=="body"),r=null;const i=S(t).position==="fixed";let s=i?D(t):t;for(;O(s)&&!z(s);){const c=S(s),l=gt(s);!l&&c.position==="fixed"&&(r=null),(i?!l&&!r:!l&&c.position==="static"&&!!r&&["absolute","fixed"].includes(r.position)||K(s)&&!l&&Gt(t,s))?o=o.filter(d=>d!==s):r=c,s=D(s)}return e.set(t,o),o}function Je(t){let{element:e,boundary:n,rootBoundary:o,strategy:r}=t;const s=[...n==="clippingAncestors"?st(e)?[]:Xe(e,this._c):[].concat(n),o],c=s[0],l=s.reduce((u,d)=>{const f=Tt(e,d,r);return u.top=F(f.top,u.top),u.right=Q(f.right,u.right),u.bottom=Q(f.bottom,u.bottom),u.left=F(f.left,u.left),u},Tt(e,c,r));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function Ge(t){const{width:e,height:n}=Kt(t);return{width:e,height:n}}function Qe(t,e,n){const o=T(e),r=k(e),i=n==="fixed",s=V(t,!0,i,e);let c={scrollLeft:0,scrollTop:0};const l=L(0);if(o||!o&&!i)if((B(e)!=="body"||K(r))&&(c=ct(e)),o){const p=V(e,!0,i,e);l.x=p.x+e.clientLeft,l.y=p.y+e.clientTop}else r&&(l.x=xt(r));const u=r&&!o&&!i?Jt(r,c):L(0),d=s.left+c.scrollLeft-l.x-u.x,f=s.top+c.scrollTop-l.y-u.y;return{x:d,y:f,width:s.width,height:s.height}}function at(t){return S(t).position==="static"}function kt(t,e){if(!T(t)||S(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return k(t)===n&&(n=n.ownerDocument.body),n}function Qt(t,e){const n=R(t);if(st(t))return n;if(!T(t)){let r=D(t);for(;r&&!z(r);){if(O(r)&&!at(r))return r;r=D(r)}return n}let o=kt(t,e);for(;o&&$e(o)&&at(o);)o=kt(o,e);return o&&z(o)&&at(o)&&!gt(o)?n:o||ze(t)||n}const Ze=async function(t){const e=this.getOffsetParent||Qt,n=this.getDimensions,o=await n(t.floating);return{reference:Qe(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function tn(t){return S(t).direction==="rtl"}const en={convertOffsetParentRelativeRectToViewportRelativeRect:Ie,getDocumentElement:k,getClippingRect:Je,getOffsetParent:Qt,getElementRects:Ze,getClientRects:je,getDimensions:Ge,getScale:U,isElement:O,isRTL:tn};function nn(t,e){let n=null,o;const r=k(t);function i(){var c;clearTimeout(o),(c=n)==null||c.disconnect(),n=null}function s(c,l){c===void 0&&(c=!1),l===void 0&&(l=1),i();const{left:u,top:d,width:f,height:p}=t.getBoundingClientRect();if(c||e(),!f||!p)return;const h=J(d),m=J(r.clientWidth-(u+f)),y=J(r.clientHeight-(d+p)),w=J(u),x={rootMargin:-h+"px "+-m+"px "+-y+"px "+-w+"px",threshold:F(0,Q(1,l))||1};let v=!0;function A(b){const N=b[0].intersectionRatio;if(N!==l){if(!v)return s();N?s(!1,N):o=setTimeout(()=>{s(!1,1e-7)},1e3)}v=!1}try{n=new IntersectionObserver(A,{...x,root:r.ownerDocument})}catch{n=new IntersectionObserver(A,x)}n.observe(t)}return s(!0),i}function on(t,e,n,o){o===void 0&&(o={});const{ancestorScroll:r=!0,ancestorResize:i=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:l=!1}=o,u=wt(t),d=r||i?[...u?q(u):[],...q(e)]:[];d.forEach(g=>{r&&g.addEventListener("scroll",n,{passive:!0}),i&&g.addEventListener("resize",n)});const f=u&&c?nn(u,n):null;let p=-1,h=null;s&&(h=new ResizeObserver(g=>{let[x]=g;x&&x.target===u&&h&&(h.unobserve(e),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var v;(v=h)==null||v.observe(e)})),n()}),u&&!l&&h.observe(u),h.observe(e));let m,y=l?V(t):null;l&&w();function w(){const g=V(t);y&&(g.x!==y.x||g.y!==y.y||g.width!==y.width||g.height!==y.height)&&n(),y=g,m=requestAnimationFrame(w)}return n(),()=>{var g;d.forEach(x=>{r&&x.removeEventListener("scroll",n),i&&x.removeEventListener("resize",n)}),f==null||f(),(g=h)==null||g.disconnect(),h=null,l&&cancelAnimationFrame(m)}}const rn=He,sn=Ue,Ct=Ve,cn=(t,e,n)=>{const o=new Map,r={platform:en,...n},i={...r.platform,_c:o};return Me(t,e,{...r,platform:i})},ln=({content:t,open:e,placement:n,offset:{mainAxis:o,crossAxis:r}={mainAxis:0,crossAxis:0}})=>a.WithBrowserCtx(i=>{const s=a.Value.toSignal(e),c=i.element;return a.When(s,()=>a.Portal("body",a.html.div(a.WithElement(l=>{const u=l;return u.style.position="absolute",a.OnDispose(on(c,u,async()=>{const{x:d,y:f}=await cn(c,u,{placement:n,strategy:"absolute",middleware:[Ct(),rn({mainAxis:o,crossAxis:r}),sn(),Ct()]});u.style.top=`${f}px`,u.style.left=`${d}px`}))}),t())))}),Zt=(t,e,n)=>{const o=a.prop(E.AsyncResult.notAsked),r=o.map(f=>E.AsyncResult.isSuccess(f)?f.value:void 0),i=o.map(f=>E.AsyncResult.isFailure(f)?f.error:void 0),s=o.map(f=>E.AsyncResult.isLoading(f));let c;const l=async f=>{c==null||c.abort(),c=new AbortController;const p=c.signal,h=o.get();o.set(E.AsyncResult.loading(E.AsyncResult.getOrUndefined(h)));try{const m=await e({request:f,abortSignal:p,previous:h});await Promise.resolve(),c=void 0,o.set(E.AsyncResult.success(m))}catch(m){c=void 0,o.set(E.AsyncResult.failure(n(m)))}},u=()=>l(t.get()),d=()=>{c==null||c.abort(),c=void 0,o.dispose()};return o.onDispose(t.on(l)),{status:o,value:r,error:i,loading:s,reload:u,dispose:d}},te=(t,e)=>{const{status:n,dispose:o,reload:r}=t,{loading:i,failure:s,success:c}=e;return a.Fragment(a.OnDispose(o),mt(n,{loading:i!=null?l=>i(l,r):void 0,failure:s!=null?l=>s(l,r):void 0,success:l=>c(l,r)}))},an=({request:t,load:e,mapError:n=o=>o})=>{const o=Zt(t,e,n);return r=>te(o,r)},ee=(t,e)=>{if(typeof e=="function")return ee(t,{success:e});const n=e.failure??(r=>a.Fragment(a.OnDispose(r.on(console.error)),r.map(i=>`Error: ${i}`))),o=e.success;return a.OneOfType(a.Value.toSignal(t),{Success:r=>o(r.$.value),Failure:r=>n(r.$.error)})},un=()=>a.on.focus(t=>{var e;return(e=t.target)==null?void 0:e.select()}),fn=t=>a.WithBrowserCtx(e=>{const{element:n}=e,o=a.prop({width:n.clientWidth,height:n.clientHeight}),r=a.renderableOfTNode(t(o))(e),i=()=>{o.set({width:n.clientWidth,height:n.clientHeight})};let s;return typeof ResizeObserver=="function"&&(s=new ResizeObserver(i),s.observe(n)),a.OnDispose(c=>{s==null||s.disconnect(),r(c)})}),dn=t=>e=>{const n=a.getWindow(),o=a.prop({width:(n==null?void 0:n.innerWidth)??0,height:(n==null?void 0:n.innerHeight)??0}),r=a.renderableOfTNode(t(o))(e),i=()=>{o.set({width:(n==null?void 0:n.innerWidth)??0,height:(n==null?void 0:n.innerHeight)??0})};return n==null||n.addEventListener("resize",i),s=>{n==null||n.removeEventListener("resize",i),r(s)}},ne=(t,e)=>{const n=e.split("/").filter(r=>r!==""),o={};for(let r=0;r<t.length;r++){const i=t[r],s=n[r];if(!s&&i.type!=="catch-all")return null;if(i.type==="literal"){if(i.value!==s)return null}else if(i.type==="param")o[i.name]=s;else if(i.type==="catch-all")return{params:o,path:e}}return n.length!==t.length?null:{params:o,path:e}},oe=t=>t.split("/").map(e=>e.startsWith(":")?{type:"param",name:e.slice(1)}:e==="*"?{type:"catch-all"}:{type:"literal",value:e}).filter(e=>e.type!=="literal"||e.value!==""),re=t=>{const e=t.map(n=>{const o=oe(n);return{route:n,segments:o}});return function(o){for(const{segments:r,route:i}of e){const s=ne(r,o);if(s)return{...s,route:i}}return null}},hn=t=>{const e=re(Object.keys(t));return ht(n=>{const o=n.map(r=>{const i=e(r.pathname);if(i==null)throw console.error("No route found for",r),new Error("No route found");return{params:i.params,route:i.route,path:i.path,search:r.search,hash:r.hash}});return a.OneOfTuple(o.map(r=>[r.route,r]),t)})},nt=60*1e3,dt=60*nt,Y=24*dt,Pt=7*Y,Dt=30*Y,pn=365*Y,mn=[{max:nt*90,value:nt,name:"minute",past:{singular:"a minute ago",plural:"{} minutes ago"},future:{singular:"in a minute",plural:"in {} minutes"}},{max:dt*36,value:dt,name:"hour",past:{singular:"an hour ago",plural:"{} hours ago"},future:{singular:"in an hour",plural:"in {} hours"}},{max:Y*10,value:Y,name:"day",past:{singular:"yesterday",plural:"{} days ago"},future:{singular:"tomorrow",plural:"in {} days"}},{max:Pt*6,value:Pt,name:"week",past:{singular:"last week",plural:"{} weeks ago"},future:{singular:"in a week",plural:"in {} weeks"}},{max:Dt*18,value:Dt,name:"month",past:{singular:"last month",plural:"{} months ago"},future:{singular:"in a month",plural:"in {} months"}},{max:1/0,value:pn,name:"year",past:{singular:"last year",plural:"{} years ago"},future:{singular:"in a year",plural:"in {} years"}}];function Wt(t,e,n,o){const r=Math.round(t/e);return r<=1?n:o.replace("{}",r.toLocaleString(void 0,{maximumFractionDigits:0,minimumFractionDigits:0}))}const ie=(t=1e3)=>{const e=a.prop(new Date),n=E.interval(()=>e.set(new Date),t);return e.onDispose(n),e},se=t=>{const e=Math.abs(t);if(e<nt)return t<0?"just now":"in a moment";for(const n of mn)if(e<n.max)return t<0?Wt(e,n.value,n.past.singular,n.past.plural):Wt(e,n.value,n.future.singular,n.future.plural);throw new Error("unreachable")},ce=(t,{now:e,frequency:n=1e4}={})=>{const o=e!=null?a.Signal.is(e)?e.derive():a.prop(e):ie(n),r=a.computedOf(t,o)((i,s)=>i.getTime()-s.getTime());return r.onDispose(()=>a.Value.dispose(o)),r},le=(t,e={})=>{const n=ce(t,e),o=n.map(se);return o.onDispose(n.dispose),o},gn=(t,e={})=>le(t,e);class ae extends a.Prop{constructor(){super(...arguments);Et(this,"tick",()=>this.update(n=>n+1))}}const yn=(t=0)=>new ae(t,(e,n)=>e===n);exports.Anchor=$t;exports.AsyncResultView=mt;exports.AutoFocus=ve;exports.AutoSelect=be;exports.ElementSize=fn;exports.HTMLTitle=Re;exports.HiddenWhenEmpty=Ae;exports.InViewport=zt;exports.LocationProviderMarker=Nt;exports.PopOver=ln;exports.ProvideAppearance=we;exports.Resource=an;exports.ResourceDisplay=te;exports.ResultView=ee;exports.Router=hn;exports.SelectOnFocus=un;exports.SetLocation=me;exports.Ticker=ae;exports.UseAppearance=xe;exports.UseLocation=ht;exports.WhenInViewport=Se;exports.WindowSize=dn;exports._checkExtensionCondition=Mt;exports._getExtension=Ft;exports._makeRouteMatcher=re;exports._parseRouteSegments=oe;exports.appearanceMarker=pt;exports.areLocationsEqual=ge;exports.handleAnchorClick=Vt;exports.locationFromURL=Ht;exports.makeResource=Zt;exports.matchesRoute=ne;exports.nowSignal=ie;exports.relativeTime=gn;exports.relativeTimeMillisSignal=ce;exports.relativeTimeSignal=le;exports.setLocationFromUrl=Ut;exports.ticker=yn;exports.timeDiffToString=se;exports.urlFromLocation=ye;
|
package/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var de = Object.defineProperty;
|
|
2
2
|
var he = (t, e, n) => e in t ? de(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
|
|
3
|
-
var
|
|
4
|
-
import { makeProviderMark as zt, Fragment as X, WithBrowserCtx as xt, Async as Ct, WithHeadlessCtx as me, UseProvider as Bt,
|
|
3
|
+
var kt = (t, e, n) => he(t, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
+
import { makeProviderMark as zt, Fragment as X, WithBrowserCtx as xt, Async as Ct, WithHeadlessCtx as me, UseProvider as Bt, prop as W, renderableOfTNode as ct, getWindow as vt, Signal as Ut, html as _t, on as It, Value as J, attr as jt, SetProvider as pe, OnDispose as T, Empty as pt, OneOfType as Yt, WithElement as G, Portal as qt, When as Kt, OneOfTuple as ge, computedOf as ye, Prop as we } from "@tempots/dom";
|
|
5
5
|
import { delayed as Xt, AsyncResult as P, interval as xe } from "@tempots/std";
|
|
6
6
|
const ve = (t) => {
|
|
7
7
|
const e = t.split("/").pop();
|
|
@@ -43,9 +43,9 @@ const ve = (t) => {
|
|
|
43
43
|
e.ignoreExternalUrl ?? !0
|
|
44
44
|
) || t() && o.preventDefault();
|
|
45
45
|
};
|
|
46
|
-
}, Ee = zt("LocationProvider"),
|
|
46
|
+
}, Ee = zt("LocationProvider"), Tn = (t) => X(
|
|
47
47
|
xt(() => Ct(
|
|
48
|
-
import("./browser-location-
|
|
48
|
+
import("./browser-location-Wn6jT0ta.js").then((e) => e.ProvideBrowserLocation),
|
|
49
49
|
(e) => e(t)
|
|
50
50
|
)),
|
|
51
51
|
me((e) => Ct(
|
|
@@ -59,7 +59,7 @@ const ve = (t) => {
|
|
|
59
59
|
return (i) => {
|
|
60
60
|
o.dispose(), r(i);
|
|
61
61
|
};
|
|
62
|
-
}),
|
|
62
|
+
}), kn = (t, e) => t.pathname === e.pathname && JSON.stringify(t.search) === JSON.stringify(e.search) && t.hash === e.hash, Oe = (t, e) => {
|
|
63
63
|
var i;
|
|
64
64
|
const n = new URL(t, e ?? ((i = vt()) == null ? void 0 : i.location.toString())), o = Object.fromEntries(n.searchParams.entries());
|
|
65
65
|
let r = n.hash;
|
|
@@ -91,7 +91,7 @@ const ve = (t) => {
|
|
|
91
91
|
};
|
|
92
92
|
return n == null || n.addEventListener("change", i), X(
|
|
93
93
|
pe(Gt, r, t),
|
|
94
|
-
|
|
94
|
+
T(() => n == null ? void 0 : n.removeEventListener("change", i))
|
|
95
95
|
);
|
|
96
96
|
}, Dn = (t) => Bt(Gt, t), Qt = (t, e) => {
|
|
97
97
|
if (typeof e == "function")
|
|
@@ -103,15 +103,15 @@ const ve = (t) => {
|
|
|
103
103
|
Loading: (s) => r(s.map((c) => c.previousValue)),
|
|
104
104
|
NotAsked: i
|
|
105
105
|
});
|
|
106
|
-
}, Wn = (t = 10) => G((e) =>
|
|
106
|
+
}, Wn = (t = 10) => G((e) => T(Xt(() => e == null ? void 0 : e.focus(), t))), Fn = (t = 10) => G((e) => {
|
|
107
107
|
const n = Xt(() => e.select(), t);
|
|
108
|
-
return
|
|
108
|
+
return T(n);
|
|
109
109
|
}), Mn = G((t) => {
|
|
110
110
|
const e = t.style.getPropertyValue(":empty");
|
|
111
|
-
return t.style.setProperty(":empty", "display:none"),
|
|
111
|
+
return t.style.setProperty(":empty", "display:none"), T((n) => {
|
|
112
112
|
n && t.style.setProperty(":empty", e);
|
|
113
113
|
});
|
|
114
|
-
}), Nn = (t) => qt("head > title", jt.innerText(t)),
|
|
114
|
+
}), Nn = (t) => qt("head > title", jt.innerText(t)), Te = {
|
|
115
115
|
partial: {
|
|
116
116
|
root: null,
|
|
117
117
|
rootMargin: "0px",
|
|
@@ -129,20 +129,20 @@ const ve = (t) => {
|
|
|
129
129
|
partial: null,
|
|
130
130
|
full: null
|
|
131
131
|
};
|
|
132
|
-
function
|
|
132
|
+
function ke(t) {
|
|
133
133
|
return Y[t] == null && (Y[t] = new IntersectionObserver((e) => {
|
|
134
134
|
e.forEach((n) => {
|
|
135
135
|
const o = et[t].get(n.target);
|
|
136
136
|
o == null || o.set(n.isIntersecting);
|
|
137
137
|
});
|
|
138
|
-
},
|
|
138
|
+
}, Te[t])), Y[t];
|
|
139
139
|
}
|
|
140
140
|
const Ce = (t, e) => {
|
|
141
141
|
const n = W(!1);
|
|
142
142
|
return X(
|
|
143
143
|
G((o) => {
|
|
144
|
-
const r = typeof IntersectionObserver < "u" ?
|
|
145
|
-
return et[t].set(o, n), r == null || r.observe(o),
|
|
144
|
+
const r = typeof IntersectionObserver < "u" ? ke(t) : null;
|
|
145
|
+
return et[t].set(o, n), r == null || r.observe(o), T(() => {
|
|
146
146
|
var i;
|
|
147
147
|
n.dispose(), r == null || r.unobserve(o), et[t].delete(o), et[t].size === 0 && ((i = Y[t]) == null || i.disconnect(), Y[t] = null);
|
|
148
148
|
});
|
|
@@ -445,31 +445,31 @@ const ze = function(t) {
|
|
|
445
445
|
overflows: Z
|
|
446
446
|
}], !Z.every((F) => F <= 0)) {
|
|
447
447
|
var Ot, Lt;
|
|
448
|
-
const F = (((Ot = i.flip) == null ? void 0 : Ot.index) || 0) + 1,
|
|
449
|
-
if (
|
|
448
|
+
const F = (((Ot = i.flip) == null ? void 0 : Ot.index) || 0) + 1, Tt = ue[F];
|
|
449
|
+
if (Tt)
|
|
450
450
|
return {
|
|
451
451
|
data: {
|
|
452
452
|
index: F,
|
|
453
453
|
overflows: I
|
|
454
454
|
},
|
|
455
455
|
reset: {
|
|
456
|
-
placement:
|
|
456
|
+
placement: Tt
|
|
457
457
|
}
|
|
458
458
|
};
|
|
459
|
-
let j = (Lt = I.filter((H) => H.overflows[0] <= 0).sort((H,
|
|
459
|
+
let j = (Lt = I.filter((H) => H.overflows[0] <= 0).sort((H, k) => H.overflows[1] - k.overflows[1])[0]) == null ? void 0 : Lt.placement;
|
|
460
460
|
if (!j)
|
|
461
461
|
switch (d) {
|
|
462
462
|
case "bestFit": {
|
|
463
463
|
var St;
|
|
464
|
-
const H = (St = I.filter((
|
|
464
|
+
const H = (St = I.filter((k) => {
|
|
465
465
|
if ($) {
|
|
466
|
-
const C = B(
|
|
466
|
+
const C = B(k.placement);
|
|
467
467
|
return C === w || // Create a bias to the `y` side axis due to horizontal
|
|
468
468
|
// reading directions favoring greater width.
|
|
469
469
|
C === "y";
|
|
470
470
|
}
|
|
471
471
|
return !0;
|
|
472
|
-
}).map((
|
|
472
|
+
}).map((k) => [k.placement, k.overflows.filter((C) => C > 0).reduce((C, fe) => C + fe, 0)]).sort((k, C) => k[1] - C[1])[0]) == null ? void 0 : St[0];
|
|
473
473
|
H && (j = H);
|
|
474
474
|
break;
|
|
475
475
|
}
|
|
@@ -1092,7 +1092,7 @@ const an = Ue, un = _e, Nt = ze, fn = (t, e, n) => {
|
|
|
1092
1092
|
_t.div(
|
|
1093
1093
|
G((l) => {
|
|
1094
1094
|
const a = l;
|
|
1095
|
-
return a.style.position = "absolute",
|
|
1095
|
+
return a.style.position = "absolute", T(
|
|
1096
1096
|
ln(c, a, async () => {
|
|
1097
1097
|
const { x: f, y: u } = await fn(c, a, {
|
|
1098
1098
|
placement: n,
|
|
@@ -1143,7 +1143,7 @@ const an = Ue, un = _e, Nt = ze, fn = (t, e, n) => {
|
|
|
1143
1143
|
}, hn = (t, e) => {
|
|
1144
1144
|
const { status: n, dispose: o, reload: r } = t, { loading: i, failure: s, success: c } = e;
|
|
1145
1145
|
return X(
|
|
1146
|
-
|
|
1146
|
+
T(o),
|
|
1147
1147
|
Qt(n, {
|
|
1148
1148
|
loading: i != null ? (l) => i(l, r) : void 0,
|
|
1149
1149
|
failure: s != null ? (l) => s(l, r) : void 0,
|
|
@@ -1161,7 +1161,7 @@ const an = Ue, un = _e, Nt = ze, fn = (t, e, n) => {
|
|
|
1161
1161
|
if (typeof e == "function")
|
|
1162
1162
|
return mn(t, { success: e });
|
|
1163
1163
|
const n = e.failure ?? ((r) => X(
|
|
1164
|
-
|
|
1164
|
+
T(r.on(console.error)),
|
|
1165
1165
|
r.map((i) => `Error: ${i}`)
|
|
1166
1166
|
)), o = e.success;
|
|
1167
1167
|
return Yt(J.toSignal(t), {
|
|
@@ -1179,7 +1179,7 @@ const an = Ue, un = _e, Nt = ze, fn = (t, e, n) => {
|
|
|
1179
1179
|
o.set({ width: n.clientWidth, height: n.clientHeight });
|
|
1180
1180
|
};
|
|
1181
1181
|
let s;
|
|
1182
|
-
return typeof ResizeObserver == "function" && (s = new ResizeObserver(i), s.observe(n)),
|
|
1182
|
+
return typeof ResizeObserver == "function" && (s = new ResizeObserver(i), s.observe(n)), T((c) => {
|
|
1183
1183
|
s == null || s.disconnect(), r(c);
|
|
1184
1184
|
});
|
|
1185
1185
|
}), Un = (t) => (e) => {
|
|
@@ -1326,7 +1326,7 @@ class En extends we {
|
|
|
1326
1326
|
* Triggers an update of the Ticker by incrementing its internal value.
|
|
1327
1327
|
* @returns void
|
|
1328
1328
|
*/
|
|
1329
|
-
|
|
1329
|
+
kt(this, "tick", () => this.update((n) => n + 1));
|
|
1330
1330
|
}
|
|
1331
1331
|
}
|
|
1332
1332
|
const jn = (t = 0) => new En(t, (e, n) => e === n);
|
|
@@ -1347,7 +1347,7 @@ export {
|
|
|
1347
1347
|
mn as ResultView,
|
|
1348
1348
|
_n as Router,
|
|
1349
1349
|
zn as SelectOnFocus,
|
|
1350
|
-
|
|
1350
|
+
Tn as SetLocation,
|
|
1351
1351
|
En as Ticker,
|
|
1352
1352
|
Dn as UseAppearance,
|
|
1353
1353
|
Jt as UseLocation,
|
|
@@ -1358,17 +1358,17 @@ export {
|
|
|
1358
1358
|
yn as _makeRouteMatcher,
|
|
1359
1359
|
gn as _parseRouteSegments,
|
|
1360
1360
|
Gt as appearanceMarker,
|
|
1361
|
-
|
|
1361
|
+
kn as areLocationsEqual,
|
|
1362
1362
|
Re as handleAnchorClick,
|
|
1363
1363
|
Oe as locationFromURL,
|
|
1364
|
-
vn as makeNowSignal,
|
|
1365
|
-
In as makeRelativeTime,
|
|
1366
|
-
An as makeRelativeTimeMillisSignal,
|
|
1367
|
-
Rn as makeRelativeTimeSignal,
|
|
1368
1364
|
dn as makeResource,
|
|
1369
|
-
jn as makeTicker,
|
|
1370
1365
|
pn as matchesRoute,
|
|
1366
|
+
vn as nowSignal,
|
|
1367
|
+
In as relativeTime,
|
|
1368
|
+
An as relativeTimeMillisSignal,
|
|
1369
|
+
Rn as relativeTimeSignal,
|
|
1371
1370
|
Le as setLocationFromUrl,
|
|
1371
|
+
jn as ticker,
|
|
1372
1372
|
bn as timeDiffToString,
|
|
1373
1373
|
Cn as urlFromLocation
|
|
1374
1374
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tempots/ui",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./index.cjs",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -40,6 +40,6 @@
|
|
|
40
40
|
"@floating-ui/dom": "^1.6.7"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
|
-
"@tempots/std": "0.
|
|
43
|
+
"@tempots/std": "0.18.0"
|
|
44
44
|
}
|
|
45
45
|
}
|
|
@@ -1,19 +1,5 @@
|
|
|
1
1
|
import { TNode, Prop } from '@tempots/dom';
|
|
2
2
|
import { LocationData } from './location-data';
|
|
3
|
-
/**
|
|
4
|
-
* Creates a location object based on the current browser location.
|
|
5
|
-
* @returns The location object representing the current browser location.
|
|
6
|
-
* @internal
|
|
7
|
-
*/
|
|
8
|
-
export declare const _makeLocation: () => LocationData;
|
|
9
|
-
/**
|
|
10
|
-
* Creates a location prop that represents the current browser location.
|
|
11
|
-
* The location prop is updated whenever the browser location changes.
|
|
12
|
-
*
|
|
13
|
-
* @returns The location prop.
|
|
14
|
-
* @internal
|
|
15
|
-
*/
|
|
16
|
-
export declare const _makeLocationProp: () => Prop<LocationData>;
|
|
17
3
|
/**
|
|
18
4
|
* Provides the location context to the child component.
|
|
19
5
|
* @param child - The child component to be wrapped with the location context.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Value } from '@tempots/dom';
|
|
1
|
+
import { Value, Signal } from '@tempots/dom';
|
|
2
2
|
/**
|
|
3
3
|
* Creates a signal that automatically updates with the current time at a specified frequency.
|
|
4
4
|
* The signal will clean up its interval when disposed.
|
|
@@ -7,7 +7,7 @@ import { Value } from '@tempots/dom';
|
|
|
7
7
|
* @returns A Value<Date> that updates with the current time at the specified frequency
|
|
8
8
|
* @public
|
|
9
9
|
*/
|
|
10
|
-
export declare const
|
|
10
|
+
export declare const nowSignal: (frequency?: number) => Signal<Date>;
|
|
11
11
|
/**
|
|
12
12
|
* Converts a time difference in milliseconds to a human-readable relative time string.
|
|
13
13
|
*
|
|
@@ -31,7 +31,7 @@ export declare const timeDiffToString: (diffInMillis: number) => string;
|
|
|
31
31
|
* positive values indicate future times. The signal will clean up its resources when disposed.
|
|
32
32
|
* @public
|
|
33
33
|
*/
|
|
34
|
-
export declare const
|
|
34
|
+
export declare const relativeTimeMillisSignal: (date: Value<Date>, { now, frequency }?: {
|
|
35
35
|
now?: Value<Date>;
|
|
36
36
|
frequency?: number;
|
|
37
37
|
}) => import('@tempots/dom').Computed<number>;
|
|
@@ -46,7 +46,7 @@ export declare const makeRelativeTimeMillisSignal: (date: Value<Date>, { now, fr
|
|
|
46
46
|
* The signal will clean up its resources when disposed.
|
|
47
47
|
* @public
|
|
48
48
|
*/
|
|
49
|
-
export declare const
|
|
49
|
+
export declare const relativeTimeSignal: (date: Value<Date>, options?: {
|
|
50
50
|
now?: Value<Date>;
|
|
51
51
|
frequency?: number;
|
|
52
52
|
}) => import('@tempots/dom').Computed<string>;
|
|
@@ -62,7 +62,7 @@ export declare const makeRelativeTimeSignal: (date: Value<Date>, options?: {
|
|
|
62
62
|
* @deprecated Use makeRelativeTimeSignal instead
|
|
63
63
|
* @public
|
|
64
64
|
*/
|
|
65
|
-
export declare const
|
|
65
|
+
export declare const relativeTime: (date: Value<Date>, options?: {
|
|
66
66
|
now?: Value<Date>;
|
|
67
67
|
frequency?: number;
|
|
68
68
|
}) => import('@tempots/dom').Computed<string>;
|
package/utils/ticker.d.ts
CHANGED
|
@@ -19,4 +19,4 @@ export declare class Ticker extends Prop<number> {
|
|
|
19
19
|
* @returns A new Ticker instance that only updates when the value changes
|
|
20
20
|
* @public
|
|
21
21
|
*/
|
|
22
|
-
export declare const
|
|
22
|
+
export declare const ticker: (initial?: number) => Ticker;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("@tempots/dom"),r=require("./index.cjs"),n=()=>{const t=a.getWindow(),o=(t==null?void 0:t.location.hash)===""?void 0:(t==null?void 0:t.location.hash.substring(1))??void 0;return{pathname:(t==null?void 0:t.location.pathname)??"",search:Object.fromEntries(new URLSearchParams((t==null?void 0:t.location.search)??"").entries()),hash:o}},c=()=>{const t=a.makeProp(n(),r.areLocationsEqual),o=a.getWindow(),s=()=>{let e=(o==null?void 0:o.location.hash)??"";e.startsWith("#")&&(e=e.substring(1));const i={pathname:(o==null?void 0:o.location.pathname)??"",search:Object.fromEntries(new URLSearchParams((o==null?void 0:o.location.search)??"").entries()),hash:e===""?void 0:e};t.set(i)};return o==null||o.addEventListener("popstate",s),t.onDispose(()=>{o==null||o.removeEventListener("popstate",s)}),t.on(e=>{o==null||o.history.pushState({},"",r.urlFromLocation(e))}),t},h=t=>{const o=c();return a.Fragment(a.OnDispose(o.dispose),a.SetProvider(r.LocationProviderMarker,o,t))};exports.ProvideBrowserLocation=h;exports._makeLocation=n;exports._makeLocationProp=c;
|