@tempots/ui 3.0.0 → 3.1.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/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var me=Object.defineProperty;var ge=(t,e,n)=>e in t?me(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var ft=(t,e,n)=>ge(t,typeof e!="symbol"?e+"":e,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("@tempots/dom"),R=require("@tempots/std"),Ut=t=>{const e=t.split("/").pop();if(e==null||e.startsWith("."))return;const n=e.split(".")||[];return n.length>1?"."+n.pop():void 0},Bt=(t,e)=>{const n=Ut(e);return n!=null&&(t.length===0||!t.some(o=>n==o))},ye=(t,e,n,o)=>{let s=t.target;for(;s!=null&&!(s instanceof HTMLAnchorElement);)s=s.parentElement;if(s==null)return!0;const i=s;if(t.button!==0||t.ctrlKey||t.metaKey||i.target!=="_self"&&i.target!==""||i.getAttribute("download")!=null)return!0;const{pathname:r,search:c,hash:l}=i;if(o){const a=r+c+l,d=i.getAttribute("href");if(!(d!=null&&d.startsWith("#"))&&d!==a)return!0}return e?!1:Bt(n,r)},Ht=(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=>{ye(o,e.ignoreUrlWithExtension??!0,n,e.ignoreExternalUrl??!0)||t()&&o.preventDefault()}},$t=(t,e)=>t.pathname===e.pathname&&JSON.stringify(t.search)===JSON.stringify(e.search)&&t.hash===e.hash,wt=(t,e)=>{var i;const n=new URL(t,e??((i=u.getWindow())==null?void 0:i.location.toString())),o=Object.fromEntries(n.searchParams.entries());let s=n.hash;return s.startsWith("#")&&(s=s.substring(1)),{pathname:n.pathname,search:o,hash:s===""?void 0:s}},ht=(t,e)=>{const n=wt(e);return t.set(n),t},Z=t=>{const n=new URLSearchParams(t.search).toString(),o=t.hash;return`${t.pathname}${n?`?${n}`:""}${o?`#${o}`:""}`},we=t=>t.startsWith("http://")||t.startsWith("https://")||t.startsWith("//"),xe=t=>{const e=t.container.currentURL,n=e.iso(o=>wt(o),o=>{if(we(o.pathname))return Z(o);const s=new URL(o.pathname,e.value),i=s.origin+s.pathname;return Z({...o,pathname:i})});return{value:n,dispose:n.dispose}},ve=()=>{const t=u.getWindow(),e=(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:e}},be=()=>{const t=u.prop(ve(),$t),e=u.getWindow(),n=()=>{let o=(e==null?void 0:e.location.hash)??"";o.startsWith("#")&&(o=o.substring(1));const s={pathname:(e==null?void 0:e.location.pathname)??"",search:Object.fromEntries(new URLSearchParams((e==null?void 0:e.location.search)??"").entries()),hash:o===""?void 0:o};t.set(s)};return e==null||e.addEventListener("popstate",n),t.onDispose(()=>{e==null||e.removeEventListener("popstate",n)}),t.on(o=>{e==null||e.history.pushState({},"",Z(o))}),{value:t,dispose:t.dispose}},xt={mark:u.makeProviderMark("LocationProvider"),create:(t,e)=>{if(e.isBrowser())return be();if(e.isHeadless())return xe(e);throw new Error("Unknown context")}},Re=t=>{document.startViewTransition?document.startViewTransition(t):t()},zt=(t,...e)=>{if(typeof t=="string"||u.Signal.is(t))return zt({href:t},...e);const{href:n,withViewTransition:o,...s}=t;return u.Use(xt,i=>u.html.a(u.on.click(Ht(()=>(o==!0?Re(()=>{ht(i,u.Value.get(n))}):ht(i,u.Value.get(n)),!0),s)),u.attr.href(n),...e))},Ae={mark:u.makeProviderMark("Appearance"),create:()=>{const t=u.getWindow(),e=t!=null&&t.matchMedia!=null?t.matchMedia("(prefers-color-scheme: dark)"):void 0,n=(e==null?void 0:e.matches)??!1,o=u.prop(n?"dark":"light"),s=i=>o.set(i.matches?"dark":"light");return e==null||e.addEventListener("change",s),{value:o,dispose:()=>e==null?void 0:e.removeEventListener("change",s)}}},vt=(t,e)=>{if(typeof e=="function")return vt(t,{success:e});const n=e.failure??(r=>r.map(c=>`Error: ${c}`)),o=e.success,s=e.loading??(()=>u.Empty),i=e.notAsked??(()=>u.Empty);return u.OneOfType(u.Value.toSignal(t),{AsyncSuccess:r=>o(r.$.value),AsyncFailure:r=>n(r.$.error),Loading:r=>s(r.map(c=>c.previousValue)),NotAsked:i})},Ee=(t=10)=>u.WithElement(e=>u.OnDispose(R.delayed(()=>e==null?void 0:e.focus(),t))),Oe=(t=10)=>u.WithElement(e=>{const n=R.delayed(()=>e.select(),t);return u.OnDispose(n)}),Le=u.WithElement(t=>{const e=t.style.getPropertyValue(":empty");return t.style.setProperty(":empty","display:none"),u.OnDispose(n=>{n&&t.style.setProperty(":empty",e)})}),Se=t=>u.Portal("head > title",u.attr.innerText(t)),Te={partial:{root:null,rootMargin:"0px",threshold:0},full:{root:null,rootMargin:"0px",threshold:1}},Q={partial:new Map,full:new Map},j={partial:null,full:null};function ke(t){return j[t]==null&&(j[t]=new IntersectionObserver(e=>{e.forEach(n=>{const o=Q[t].get(n.target);o==null||o.set(n.isIntersecting)})},Te[t])),j[t]}const _t=({mode:t="partial",once:e=!1},n)=>{const o=u.prop(!1);return u.Fragment(u.WithElement(s=>{const i=typeof IntersectionObserver<"u"?ke(t):null;Q[t].set(s,o),i==null||i.observe(s);function r(){var l;i==null||i.unobserve(s),Q[t].delete(s),Q[t].size===0&&((l=j[t])==null||l.disconnect(),j[t]=null)}let c=null;return e&&(c=o.on(l=>{l&&r()})),u.OnDispose(()=>{o.dispose(),r(),c==null||c()})}),u.renderableOfTNode(n(o)))},Ce=(t,e,n)=>_t(t,o=>u.When(o,e,n??(()=>u.Empty))),tt=Math.min,F=Math.max,et=Math.round,G=Math.floor,S=t=>({x:t,y:t}),We={left:"right",right:"left",bottom:"top",top:"bottom"},De={start:"end",end:"start"};function kt(t,e,n){return F(t,tt(e,n))}function it(t,e){return typeof t=="function"?t(e):t}function V(t){return t.split("-")[0]}function rt(t){return t.split("-")[1]}function It(t){return t==="x"?"y":"x"}function jt(t){return t==="y"?"height":"width"}function H(t){return["top","bottom"].includes(V(t))?"y":"x"}function qt(t){return It(H(t))}function Pe(t,e,n){n===void 0&&(n=!1);const o=rt(t),s=qt(t),i=jt(s);let r=s==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(r=nt(r)),[r,nt(r)]}function Fe(t){const e=nt(t);return[pt(t),e,pt(e)]}function pt(t){return t.replace(/start|end/g,e=>De[e])}function Ve(t,e,n){const o=["left","right"],s=["right","left"],i=["top","bottom"],r=["bottom","top"];switch(t){case"top":case"bottom":return n?e?s:o:e?o:s;case"left":case"right":return e?i:r;default:return[]}}function Me(t,e,n,o){const s=rt(t);let i=Ve(V(t),n==="start",o);return s&&(i=i.map(r=>r+"-"+s),e&&(i=i.concat(i.map(pt)))),i}function nt(t){return t.replace(/left|right|bottom|top/g,e=>We[e])}function Ne(t){return{top:0,right:0,bottom:0,left:0,...t}}function Ue(t){return typeof t!="number"?Ne(t):{top:t,right:t,bottom:t,left:t}}function ot(t){const{x:e,y:n,width:o,height:s}=t;return{width:o,height:s,top:n,left:e,right:e+o,bottom:n+s,x:e,y:n}}function Ct(t,e,n){let{reference:o,floating:s}=t;const i=H(e),r=qt(e),c=jt(r),l=V(e),a=i==="y",d=o.x+o.width/2-s.width/2,f=o.y+o.height/2-s.height/2,p=o[c]/2-s[c]/2;let h;switch(l){case"top":h={x:d,y:o.y-s.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-s.width,y:f};break;default:h={x:o.x,y:o.y}}switch(rt(e)){case"start":h[r]-=p*(n&&a?-1:1);break;case"end":h[r]+=p*(n&&a?-1:1);break}return h}const Be=async(t,e,n)=>{const{placement:o="bottom",strategy:s="absolute",middleware:i=[],platform:r}=n,c=i.filter(Boolean),l=await(r.isRTL==null?void 0:r.isRTL(e));let a=await r.getElementRects({reference:t,floating:e,strategy:s}),{x:d,y:f}=Ct(a,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:s,middlewareData:h,rects:a,platform:r,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&&(a=b.rects===!0?await r.getElementRects({reference:t,floating:e,strategy:s}):b.rects),{x:d,y:f}=Ct(a,p,l)),y=-1)}return{x:d,y:f,placement:p,strategy:s,middlewareData:h}};async function Yt(t,e){var n;e===void 0&&(e={});const{x:o,y:s,platform:i,rects:r,elements:c,strategy:l}=t,{boundary:a="clippingAncestors",rootBoundary:d="viewport",elementContext:f="floating",altBoundary:p=!1,padding:h=0}=it(e,t),m=Ue(h),w=c[p?f==="floating"?"reference":"floating":f],g=ot(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:a,rootBoundary:d,strategy:l})),x=f==="floating"?{x:o,y:s,width:r.floating.width,height:r.floating.height}:r.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=ot(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 He=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,o;const{placement:s,middlewareData:i,rects:r,initialPlacement:c,platform:l,elements:a}=e,{mainAxis:d=!0,crossAxis:f=!0,fallbackPlacements:p,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:y=!0,...w}=it(t,e);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const g=V(s),x=H(c),v=V(c)===c,A=await(l.isRTL==null?void 0:l.isRTL(a.floating)),b=p||(v||!y?[nt(c)]:Fe(c)),N=m!=="none";!p&&N&&b.push(...Me(c,y,m,A));const he=[c,...b],ut=await Yt(e,w),J=[];let _=((o=i.flip)==null?void 0:o.overflows)||[];if(d&&J.push(ut[g]),f){const P=Pe(s,r,A);J.push(ut[P[0]],ut[P[1]])}if(_=[..._,{placement:s,overflows:J}],!J.every(P=>P<=0)){var Ot,Lt;const P=(((Ot=i.flip)==null?void 0:Ot.index)||0)+1,Tt=he[P];if(Tt)return{data:{index:P,overflows:_},reset:{placement:Tt}};let I=(Lt=_.filter(U=>U.overflows[0]<=0).sort((U,C)=>U.overflows[1]-C.overflows[1])[0])==null?void 0:Lt.placement;if(!I)switch(h){case"bestFit":{var St;const U=(St=_.filter(C=>{if(N){const W=H(C.placement);return W===x||W==="y"}return!0}).map(C=>[C.placement,C.overflows.filter(W=>W>0).reduce((W,pe)=>W+pe,0)]).sort((C,W)=>C[1]-W[1])[0])==null?void 0:St[0];U&&(I=U);break}case"initialPlacement":I=c;break}if(s!==I)return{reset:{placement:I}}}return{}}}};async function $e(t,e){const{placement:n,platform:o,elements:s}=t,i=await(o.isRTL==null?void 0:o.isRTL(s.floating)),r=V(n),c=rt(n),l=H(n)==="y",a=["left","top"].includes(r)?-1:1,d=i&&l?-1:1,f=it(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*a}:{x:p*a,y:h*d}}const ze=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,o;const{x:s,y:i,placement:r,middlewareData:c}=e,l=await $e(e,t);return r===((n=c.offset)==null?void 0:n.placement)&&(o=c.arrow)!=null&&o.alignmentOffset?{}:{x:s+l.x,y:i+l.y,data:{...l,placement:r}}}}},_e=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:o,placement:s}=e,{mainAxis:i=!0,crossAxis:r=!1,limiter:c={fn:w=>{let{x:g,y:x}=w;return{x:g,y:x}}},...l}=it(t,e),a={x:n,y:o},d=await Yt(e,l),f=H(V(s)),p=It(f);let h=a[p],m=a[f];if(i){const w=p==="y"?"top":"left",g=p==="y"?"bottom":"right",x=h+d[w],v=h-d[g];h=kt(x,h,v)}if(r){const w=f==="y"?"top":"left",g=f==="y"?"bottom":"right",x=m+d[w],v=m-d[g];m=kt(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]:r}}}}}};function ct(){return typeof window<"u"}function z(t){return Kt(t)?(t.nodeName||"").toLowerCase():"#document"}function E(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function k(t){var e;return(e=(Kt(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function Kt(t){return ct()?t instanceof Node||t instanceof E(t).Node:!1}function O(t){return ct()?t instanceof Element||t instanceof E(t).Element:!1}function T(t){return ct()?t instanceof HTMLElement||t instanceof E(t).HTMLElement:!1}function Wt(t){return!ct()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof E(t).ShadowRoot}function K(t){const{overflow:e,overflowX:n,overflowY:o,display:s}=L(t);return/auto|scroll|overlay|hidden|clip/.test(e+o+n)&&!["inline","contents"].includes(s)}function Ie(t){return["table","td","th"].includes(z(t))}function lt(t){return[":popover-open",":modal"].some(e=>{try{return t.matches(e)}catch{return!1}})}function bt(t){const e=Rt(),n=O(t)?L(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 je(t){let e=D(t);for(;T(e)&&!$(e);){if(bt(e))return e;if(lt(e))return null;e=D(e)}return null}function Rt(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function $(t){return["html","body","#document"].includes(z(t))}function L(t){return E(t).getComputedStyle(t)}function at(t){return O(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function D(t){if(z(t)==="html")return t;const e=t.assignedSlot||t.parentNode||Wt(t)&&t.host||k(t);return Wt(e)?e.host:e}function Xt(t){const e=D(t);return $(e)?t.ownerDocument?t.ownerDocument.body:t.body:T(e)&&K(e)?e:Xt(e)}function q(t,e,n){var o;e===void 0&&(e=[]),n===void 0&&(n=!0);const s=Xt(t),i=s===((o=t.ownerDocument)==null?void 0:o.body),r=E(s);if(i){const c=mt(r);return e.concat(r,r.visualViewport||[],K(s)?s:[],c&&n?q(c):[])}return e.concat(s,q(s,[],n))}function mt(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function Jt(t){const e=L(t);let n=parseFloat(e.width)||0,o=parseFloat(e.height)||0;const s=T(t),i=s?t.offsetWidth:n,r=s?t.offsetHeight:o,c=et(n)!==i||et(o)!==r;return c&&(n=i,o=r),{width:n,height:o,$:c}}function At(t){return O(t)?t:t.contextElement}function B(t){const e=At(t);if(!T(e))return S(1);const n=e.getBoundingClientRect(),{width:o,height:s,$:i}=Jt(e);let r=(i?et(n.width):n.width)/o,c=(i?et(n.height):n.height)/s;return(!r||!Number.isFinite(r))&&(r=1),(!c||!Number.isFinite(c))&&(c=1),{x:r,y:c}}const qe=S(0);function Gt(t){const e=E(t);return!Rt()||!e.visualViewport?qe:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function Ye(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==E(t)?!1:e}function M(t,e,n,o){e===void 0&&(e=!1),n===void 0&&(n=!1);const s=t.getBoundingClientRect(),i=At(t);let r=S(1);e&&(o?O(o)&&(r=B(o)):r=B(t));const c=Ye(i,n,o)?Gt(i):S(0);let l=(s.left+c.x)/r.x,a=(s.top+c.y)/r.y,d=s.width/r.x,f=s.height/r.y;if(i){const p=E(i),h=o&&O(o)?E(o):o;let m=p,y=mt(m);for(;y&&o&&h!==m;){const w=B(y),g=y.getBoundingClientRect(),x=L(y),v=g.left+(y.clientLeft+parseFloat(x.paddingLeft))*w.x,A=g.top+(y.clientTop+parseFloat(x.paddingTop))*w.y;l*=w.x,a*=w.y,d*=w.x,f*=w.y,l+=v,a+=A,m=E(y),y=mt(m)}}return ot({width:d,height:f,x:l,y:a})}function Et(t,e){const n=at(t).scrollLeft;return e?e.left+n:M(k(t)).left+n}function Qt(t,e,n){n===void 0&&(n=!1);const o=t.getBoundingClientRect(),s=o.left+e.scrollLeft-(n?0:Et(t,o)),i=o.top+e.scrollTop;return{x:s,y:i}}function Ke(t){let{elements:e,rect:n,offsetParent:o,strategy:s}=t;const i=s==="fixed",r=k(o),c=e?lt(e.floating):!1;if(o===r||c&&i)return n;let l={scrollLeft:0,scrollTop:0},a=S(1);const d=S(0),f=T(o);if((f||!f&&!i)&&((z(o)!=="body"||K(r))&&(l=at(o)),T(o))){const h=M(o);a=B(o),d.x=h.x+o.clientLeft,d.y=h.y+o.clientTop}const p=r&&!f&&!i?Qt(r,l,!0):S(0);return{width:n.width*a.x,height:n.height*a.y,x:n.x*a.x-l.scrollLeft*a.x+d.x+p.x,y:n.y*a.y-l.scrollTop*a.y+d.y+p.y}}function Xe(t){return Array.from(t.getClientRects())}function Je(t){const e=k(t),n=at(t),o=t.ownerDocument.body,s=F(e.scrollWidth,e.clientWidth,o.scrollWidth,o.clientWidth),i=F(e.scrollHeight,e.clientHeight,o.scrollHeight,o.clientHeight);let r=-n.scrollLeft+Et(t);const c=-n.scrollTop;return L(o).direction==="rtl"&&(r+=F(e.clientWidth,o.clientWidth)-s),{width:s,height:i,x:r,y:c}}function Ge(t,e){const n=E(t),o=k(t),s=n.visualViewport;let i=o.clientWidth,r=o.clientHeight,c=0,l=0;if(s){i=s.width,r=s.height;const a=Rt();(!a||a&&e==="fixed")&&(c=s.offsetLeft,l=s.offsetTop)}return{width:i,height:r,x:c,y:l}}function Qe(t,e){const n=M(t,!0,e==="fixed"),o=n.top+t.clientTop,s=n.left+t.clientLeft,i=T(t)?B(t):S(1),r=t.clientWidth*i.x,c=t.clientHeight*i.y,l=s*i.x,a=o*i.y;return{width:r,height:c,x:l,y:a}}function Dt(t,e,n){let o;if(e==="viewport")o=Ge(t,n);else if(e==="document")o=Je(k(t));else if(O(e))o=Qe(e,n);else{const s=Gt(t);o={x:e.x-s.x,y:e.y-s.y,width:e.width,height:e.height}}return ot(o)}function Zt(t,e){const n=D(t);return n===e||!O(n)||$(n)?!1:L(n).position==="fixed"||Zt(n,e)}function Ze(t,e){const n=e.get(t);if(n)return n;let o=q(t,[],!1).filter(c=>O(c)&&z(c)!=="body"),s=null;const i=L(t).position==="fixed";let r=i?D(t):t;for(;O(r)&&!$(r);){const c=L(r),l=bt(r);!l&&c.position==="fixed"&&(s=null),(i?!l&&!s:!l&&c.position==="static"&&!!s&&["absolute","fixed"].includes(s.position)||K(r)&&!l&&Zt(t,r))?o=o.filter(d=>d!==r):s=c,r=D(r)}return e.set(t,o),o}function tn(t){let{element:e,boundary:n,rootBoundary:o,strategy:s}=t;const r=[...n==="clippingAncestors"?lt(e)?[]:Ze(e,this._c):[].concat(n),o],c=r[0],l=r.reduce((a,d)=>{const f=Dt(e,d,s);return a.top=F(f.top,a.top),a.right=tt(f.right,a.right),a.bottom=tt(f.bottom,a.bottom),a.left=F(f.left,a.left),a},Dt(e,c,s));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function en(t){const{width:e,height:n}=Jt(t);return{width:e,height:n}}function nn(t,e,n){const o=T(e),s=k(e),i=n==="fixed",r=M(t,!0,i,e);let c={scrollLeft:0,scrollTop:0};const l=S(0);if(o||!o&&!i)if((z(e)!=="body"||K(s))&&(c=at(e)),o){const p=M(e,!0,i,e);l.x=p.x+e.clientLeft,l.y=p.y+e.clientTop}else s&&(l.x=Et(s));const a=s&&!o&&!i?Qt(s,c):S(0),d=r.left+c.scrollLeft-l.x-a.x,f=r.top+c.scrollTop-l.y-a.y;return{x:d,y:f,width:r.width,height:r.height}}function dt(t){return L(t).position==="static"}function Pt(t,e){if(!T(t)||L(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return k(t)===n&&(n=n.ownerDocument.body),n}function te(t,e){const n=E(t);if(lt(t))return n;if(!T(t)){let s=D(t);for(;s&&!$(s);){if(O(s)&&!dt(s))return s;s=D(s)}return n}let o=Pt(t,e);for(;o&&Ie(o)&&dt(o);)o=Pt(o,e);return o&&$(o)&&dt(o)&&!bt(o)?n:o||je(t)||n}const on=async function(t){const e=this.getOffsetParent||te,n=this.getDimensions,o=await n(t.floating);return{reference:nn(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function sn(t){return L(t).direction==="rtl"}const rn={convertOffsetParentRelativeRectToViewportRelativeRect:Ke,getDocumentElement:k,getClippingRect:tn,getOffsetParent:te,getElementRects:on,getClientRects:Xe,getDimensions:en,getScale:B,isElement:O,isRTL:sn};function cn(t,e){let n=null,o;const s=k(t);function i(){var c;clearTimeout(o),(c=n)==null||c.disconnect(),n=null}function r(c,l){c===void 0&&(c=!1),l===void 0&&(l=1),i();const{left:a,top:d,width:f,height:p}=t.getBoundingClientRect();if(c||e(),!f||!p)return;const h=G(d),m=G(s.clientWidth-(a+f)),y=G(s.clientHeight-(d+p)),w=G(a),x={rootMargin:-h+"px "+-m+"px "+-y+"px "+-w+"px",threshold:F(0,tt(1,l))||1};let v=!0;function A(b){const N=b[0].intersectionRatio;if(N!==l){if(!v)return r();N?r(!1,N):o=setTimeout(()=>{r(!1,1e-7)},1e3)}v=!1}try{n=new IntersectionObserver(A,{...x,root:s.ownerDocument})}catch{n=new IntersectionObserver(A,x)}n.observe(t)}return r(!0),i}function ln(t,e,n,o){o===void 0&&(o={});const{ancestorScroll:s=!0,ancestorResize:i=!0,elementResize:r=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:l=!1}=o,a=At(t),d=s||i?[...a?q(a):[],...q(e)]:[];d.forEach(g=>{s&&g.addEventListener("scroll",n,{passive:!0}),i&&g.addEventListener("resize",n)});const f=a&&c?cn(a,n):null;let p=-1,h=null;r&&(h=new ResizeObserver(g=>{let[x]=g;x&&x.target===a&&h&&(h.unobserve(e),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var v;(v=h)==null||v.observe(e)})),n()}),a&&!l&&h.observe(a),h.observe(e));let m,y=l?M(t):null;l&&w();function w(){const g=M(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=>{s&&x.removeEventListener("scroll",n),i&&x.removeEventListener("resize",n)}),f==null||f(),(g=h)==null||g.disconnect(),h=null,l&&cancelAnimationFrame(m)}}const an=ze,un=_e,Ft=He,fn=(t,e,n)=>{const o=new Map,s={platform:rn,...n},i={...s.platform,_c:o};return Be(t,e,{...s,platform:i})},dn=({content:t,open:e,placement:n,offset:{mainAxis:o,crossAxis:s}={mainAxis:0,crossAxis:0}})=>u.WithBrowserCtx(i=>{const r=u.Value.toSignal(e),c=i.element;return u.When(r,()=>u.Portal("body",u.html.div(u.WithElement(l=>{const a=l;return a.style.position="absolute",u.OnDispose(ln(c,a,async()=>{const{x:d,y:f}=await fn(c,a,{placement:n,strategy:"absolute",middleware:[Ft(),an({mainAxis:o,crossAxis:s}),un(),Ft()]});a.style.top=`${f}px`,a.style.left=`${d}px`}))}),t())))}),ee=(t,e,n)=>{const o=u.prop(R.AsyncResult.notAsked),s=o.map(f=>R.AsyncResult.isSuccess(f)?f.value:void 0),i=o.map(f=>R.AsyncResult.isFailure(f)?f.error:void 0),r=o.map(f=>R.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(R.AsyncResult.loading(R.AsyncResult.getOrUndefined(h)));try{const m=await e({request:f,abortSignal:p,previous:h});await Promise.resolve(),c=void 0,o.set(R.AsyncResult.success(m))}catch(m){c=void 0,o.set(R.AsyncResult.failure(n(m)))}},a=()=>l(u.Value.get(t)),d=()=>{c==null||c.abort(),c=void 0,o.dispose()};return o.onDispose(u.Value.on(t,l)),{status:o,value:s,error:i,loading:r,reload:a,dispose:d}},ne=(t,e)=>{const{status:n,dispose:o,reload:s}=t,{loading:i,failure:r,success:c}=e;return u.Fragment(u.OnDispose(o),vt(n,{loading:i!=null?l=>i(l,s):void 0,failure:r!=null?l=>r(l,s):void 0,success:l=>c(l,s)}))},hn=({request:t,load:e,mapError:n=o=>o})=>{const o=ee(t,e,n);return s=>ne(o,s)},oe=(t,e)=>{if(typeof e=="function")return oe(t,{success:e});const n=e.failure??(s=>u.Fragment(u.OnDispose(s.on(console.error)),s.map(i=>`Error: ${i}`))),o=e.success;return u.OneOfType(u.Value.toSignal(t),{Success:s=>o(s.$.value),Failure:s=>n(s.$.error)})},pn=()=>u.on.focus(t=>{var e;return(e=t.target)==null?void 0:e.select()});class X{constructor(e,n,o,s){ft(this,"equals",e=>R.nearEquals(this.left,e.left)&&R.nearEquals(this.top,e.top)&&R.nearEquals(this.width,e.width)&&R.nearEquals(this.height,e.height));this.left=e,this.top=n,this.width=o,this.height=s}static of({left:e=0,top:n=0,width:o=0,height:s=0}){return new X(e,n,o,s)}get right(){return this.left+this.width}get bottom(){return this.top+this.height}get center(){return{x:this.left+this.width/2,y:this.top+this.height/2}}get size(){return{width:this.width,height:this.height}}}function gt(t){const e=t.getBoundingClientRect();return X.of({top:e.top+window.scrollY,left:e.left+window.scrollX,width:e.width,height:e.height})}const se=t=>u.WithBrowserCtx(e=>{const{element:n}=e,o=u.prop(gt(n)),s=u.renderableOfTNode(t(o))(e),i=()=>{o.set(X.of(gt(n)))};let r;return typeof ResizeObserver=="function"&&(r=new ResizeObserver(i),r.observe(n)),u.OnDispose(c=>{r==null||r.disconnect(),s(c)})}),mn=t=>se(t),gn=t=>e=>{const n=u.getWindow(),o=u.prop({width:(n==null?void 0:n.innerWidth)??0,height:(n==null?void 0:n.innerHeight)??0}),s=u.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),r=>{n==null||n.removeEventListener("resize",i),s(r)}},ie=(t,e)=>{const n=e.split("/").filter(s=>s!==""),o={};for(let s=0;s<t.length;s++){const i=t[s],r=n[s];if(!r&&i.type!=="catch-all")return null;if(i.type==="literal"){if(i.value!==r)return null}else if(i.type==="param")o[i.name]=r;else if(i.type==="catch-all")return{params:o,path:e}}return n.length!==t.length?null:{params:o,path:e}},re=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!==""),ce=t=>{const e=t.map(n=>{const o=re(n);return{route:n,segments:o}});return function(o){for(const{segments:s,route:i}of e){const r=ie(s,o);if(r)return{...r,route:i}}return null}},yn=t=>{const e=ce(Object.keys(t));return u.Use(xt,n=>{const o=n.map(s=>{const i=e(s.pathname);if(i==null)throw console.error("No route found for",s),new Error("No route found");return{params:i.params,route:i.route,path:i.path,search:s.search,hash:s.hash}});return u.OneOfTuple(o.map(s=>[s.route,s]),t)})},st=60*1e3,yt=60*st,Y=24*yt,Vt=7*Y,Mt=30*Y,wn=365*Y,xn=[{max:st*90,value:st,name:"minute",past:{singular:"a minute ago",plural:"{} minutes ago"},future:{singular:"in a minute",plural:"in {} minutes"}},{max:yt*36,value:yt,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:Vt*6,value:Vt,name:"week",past:{singular:"last week",plural:"{} weeks ago"},future:{singular:"in a week",plural:"in {} weeks"}},{max:Mt*18,value:Mt,name:"month",past:{singular:"last month",plural:"{} months ago"},future:{singular:"in a month",plural:"in {} months"}},{max:1/0,value:wn,name:"year",past:{singular:"last year",plural:"{} years ago"},future:{singular:"in a year",plural:"in {} years"}}];function Nt(t,e,n,o){const s=Math.round(t/e);return s<=1?n:o.replace("{}",s.toLocaleString(void 0,{maximumFractionDigits:0,minimumFractionDigits:0}))}const le=(t=1e3)=>{const e=u.prop(new Date),n=R.interval(()=>e.set(new Date),t);return e.onDispose(n),e},ae=t=>{const e=Math.abs(t);if(e<st)return t<0?"just now":"in a moment";for(const n of xn)if(e<n.max)return t<0?Nt(e,n.value,n.past.singular,n.past.plural):Nt(e,n.value,n.future.singular,n.future.plural);throw new Error("unreachable")},ue=(t,{now:e,frequency:n=1e4}={})=>{const o=e!=null?u.Signal.is(e)?e.derive():u.prop(e):le(n),s=u.computedOf(t,o)((i,r)=>i.getTime()-r.getTime());return s.onDispose(()=>u.Value.dispose(o)),s},fe=(t,e={})=>{const n=ue(t,e),o=n.map(ae);return o.onDispose(n.dispose),o},vn=(t,e={})=>fe(t,e);class de extends u.Prop{constructor(){super(...arguments);ft(this,"tick",()=>this.update(n=>n+1))}}const bn=(t=0)=>new de(t,(e,n)=>e===n);exports.Anchor=zt;exports.Appearance=Ae;exports.AsyncResultView=vt;exports.AutoFocus=Ee;exports.AutoSelect=Oe;exports.ElementRect=se;exports.ElementSize=mn;exports.HTMLTitle=Se;exports.HiddenWhenEmpty=Le;exports.InViewport=_t;exports.Location=xt;exports.PopOver=dn;exports.Rect=X;exports.Resource=hn;exports.ResourceDisplay=ne;exports.ResultView=oe;exports.Router=yn;exports.SelectOnFocus=pn;exports.Ticker=de;exports.WhenInViewport=Ce;exports.WindowSize=gn;exports._checkExtensionCondition=Bt;exports._getExtension=Ut;exports._makeRouteMatcher=ce;exports._parseRouteSegments=re;exports.areLocationsEqual=$t;exports.getAbsoluteRect=gt;exports.handleAnchorClick=Ht;exports.locationFromURL=wt;exports.makeResource=ee;exports.matchesRoute=ie;exports.nowSignal=le;exports.relativeTime=vn;exports.relativeTimeMillisSignal=ue;exports.relativeTimeSignal=fe;exports.setLocationFromUrl=ht;exports.ticker=bn;exports.timeDiffToString=ae;exports.urlFromLocation=Z;
1
+ "use strict";var ge=Object.defineProperty;var ye=(t,e,n)=>e in t?ge(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var ft=(t,e,n)=>ye(t,typeof e!="symbol"?e+"":e,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("@tempots/dom"),R=require("@tempots/std"),Ut=t=>{const e=t.split("/").pop();if(e==null||e.startsWith("."))return;const n=e.split(".")||[];return n.length>1?"."+n.pop():void 0},Bt=(t,e)=>{const n=Ut(e);return n!=null&&(t.length===0||!t.some(o=>n==o))},we=(t,e,n,o)=>{let s=t.target;for(;s!=null&&!(s instanceof HTMLAnchorElement);)s=s.parentElement;if(s==null)return!0;const i=s;if(t.button!==0||t.ctrlKey||t.metaKey||i.target!=="_self"&&i.target!==""||i.getAttribute("download")!=null)return!0;const{pathname:r,search:c,hash:l}=i;if(o){const a=r+c+l,d=i.getAttribute("href");if(!(d!=null&&d.startsWith("#"))&&d!==a)return!0}return e?!1:Bt(n,r)},Ht=(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=>{we(o,e.ignoreUrlWithExtension??!0,n,e.ignoreExternalUrl??!0)||t()&&o.preventDefault()}},$t=(t,e)=>t.pathname===e.pathname&&JSON.stringify(t.search)===JSON.stringify(e.search)&&t.hash===e.hash,wt=(t,e)=>{var i;const n=new URL(t,e??((i=u.getWindow())==null?void 0:i.location.toString())),o=Object.fromEntries(n.searchParams.entries());let s=n.hash;return s.startsWith("#")&&(s=s.substring(1)),{pathname:n.pathname,search:o,hash:s===""?void 0:s}},ht=(t,e)=>{const n=wt(e);return t.set(n),t},Z=t=>{const n=new URLSearchParams(t.search).toString(),o=t.hash;return`${t.pathname}${n?`?${n}`:""}${o?`#${o}`:""}`},xe=t=>t.startsWith("http://")||t.startsWith("https://")||t.startsWith("//"),ve=t=>{const e=t.container.currentURL,n=e.iso(o=>wt(o),o=>{if(xe(o.pathname))return Z(o);const s=new URL(o.pathname,e.value),i=s.origin+s.pathname;return Z({...o,pathname:i})});return{value:n,dispose:n.dispose}},be=()=>{const t=u.getWindow(),e=(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:e}},Re=()=>{const t=u.prop(be(),$t),e=u.getWindow(),n=()=>{let o=(e==null?void 0:e.location.hash)??"";o.startsWith("#")&&(o=o.substring(1));const s={pathname:(e==null?void 0:e.location.pathname)??"",search:Object.fromEntries(new URLSearchParams((e==null?void 0:e.location.search)??"").entries()),hash:o===""?void 0:o};t.set(s)};return e==null||e.addEventListener("popstate",n),t.onDispose(()=>{e==null||e.removeEventListener("popstate",n)}),t.on(o=>{e==null||e.history.pushState({},"",Z(o))}),{value:t,dispose:t.dispose}},xt={mark:u.makeProviderMark("LocationProvider"),create:(t,e)=>{if(e.isBrowser())return Re();if(e.isHeadless())return ve(e);throw new Error("Unknown context")}},Ae=t=>{document.startViewTransition?document.startViewTransition(t):t()},zt=(t,...e)=>{if(typeof t=="string"||u.Signal.is(t))return zt({href:t},...e);const{href:n,withViewTransition:o,...s}=t;return u.Use(xt,i=>u.html.a(u.on.click(Ht(()=>(o==!0?Ae(()=>{ht(i,u.Value.get(n))}):ht(i,u.Value.get(n)),!0),s)),u.attr.href(n),...e))},Ee={mark:u.makeProviderMark("Appearance"),create:()=>{const t=_t();return{value:t,dispose:t.dispose}}};function _t(){const t=u.getWindow(),e=t!=null&&t.matchMedia!=null?t.matchMedia("(prefers-color-scheme: dark)"):void 0,n=(e==null?void 0:e.matches)??!1,o=u.prop(n?"dark":"light"),s=i=>o.set(i.matches?"dark":"light");return e==null||e.addEventListener("change",s),o.onDispose(()=>e==null?void 0:e.removeEventListener("change",s)),o}const vt=(t,e)=>{if(typeof e=="function")return vt(t,{success:e});const n=e.failure??(r=>r.map(c=>`Error: ${c}`)),o=e.success,s=e.loading??(()=>u.Empty),i=e.notAsked??(()=>u.Empty);return u.OneOfType(u.Value.toSignal(t),{AsyncSuccess:r=>o(r.$.value),AsyncFailure:r=>n(r.$.error),Loading:r=>s(r.map(c=>c.previousValue)),NotAsked:i})},Oe=(t=10)=>u.WithElement(e=>u.OnDispose(R.delayed(()=>e==null?void 0:e.focus(),t))),Le=(t=10)=>u.WithElement(e=>{const n=R.delayed(()=>e.select(),t);return u.OnDispose(n)}),Se=u.WithElement(t=>{const e=t.style.getPropertyValue(":empty");return t.style.setProperty(":empty","display:none"),u.OnDispose(n=>{n&&t.style.setProperty(":empty",e)})}),Te=t=>u.Portal("head > title",u.attr.innerText(t)),ke={partial:{root:null,rootMargin:"0px",threshold:0},full:{root:null,rootMargin:"0px",threshold:1}},Q={partial:new Map,full:new Map},j={partial:null,full:null};function Ce(t){return j[t]==null&&(j[t]=new IntersectionObserver(e=>{e.forEach(n=>{const o=Q[t].get(n.target);o==null||o.set(n.isIntersecting)})},ke[t])),j[t]}const It=({mode:t="partial",once:e=!1},n)=>{const o=u.prop(!1);return u.Fragment(u.WithElement(s=>{const i=typeof IntersectionObserver<"u"?Ce(t):null;Q[t].set(s,o),i==null||i.observe(s);function r(){var l;i==null||i.unobserve(s),Q[t].delete(s),Q[t].size===0&&((l=j[t])==null||l.disconnect(),j[t]=null)}let c=null;return e&&(c=o.on(l=>{l&&r()})),u.OnDispose(()=>{o.dispose(),r(),c==null||c()})}),u.renderableOfTNode(n(o)))},De=(t,e,n)=>It(t,o=>u.When(o,e,n??(()=>u.Empty))),tt=Math.min,F=Math.max,et=Math.round,G=Math.floor,S=t=>({x:t,y:t}),We={left:"right",right:"left",bottom:"top",top:"bottom"},Pe={start:"end",end:"start"};function kt(t,e,n){return F(t,tt(e,n))}function it(t,e){return typeof t=="function"?t(e):t}function V(t){return t.split("-")[0]}function rt(t){return t.split("-")[1]}function jt(t){return t==="x"?"y":"x"}function qt(t){return t==="y"?"height":"width"}function H(t){return["top","bottom"].includes(V(t))?"y":"x"}function Yt(t){return jt(H(t))}function Fe(t,e,n){n===void 0&&(n=!1);const o=rt(t),s=Yt(t),i=qt(s);let r=s==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(r=nt(r)),[r,nt(r)]}function Ve(t){const e=nt(t);return[pt(t),e,pt(e)]}function pt(t){return t.replace(/start|end/g,e=>Pe[e])}function Me(t,e,n){const o=["left","right"],s=["right","left"],i=["top","bottom"],r=["bottom","top"];switch(t){case"top":case"bottom":return n?e?s:o:e?o:s;case"left":case"right":return e?i:r;default:return[]}}function Ne(t,e,n,o){const s=rt(t);let i=Me(V(t),n==="start",o);return s&&(i=i.map(r=>r+"-"+s),e&&(i=i.concat(i.map(pt)))),i}function nt(t){return t.replace(/left|right|bottom|top/g,e=>We[e])}function Ue(t){return{top:0,right:0,bottom:0,left:0,...t}}function Be(t){return typeof t!="number"?Ue(t):{top:t,right:t,bottom:t,left:t}}function ot(t){const{x:e,y:n,width:o,height:s}=t;return{width:o,height:s,top:n,left:e,right:e+o,bottom:n+s,x:e,y:n}}function Ct(t,e,n){let{reference:o,floating:s}=t;const i=H(e),r=Yt(e),c=qt(r),l=V(e),a=i==="y",d=o.x+o.width/2-s.width/2,f=o.y+o.height/2-s.height/2,p=o[c]/2-s[c]/2;let h;switch(l){case"top":h={x:d,y:o.y-s.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-s.width,y:f};break;default:h={x:o.x,y:o.y}}switch(rt(e)){case"start":h[r]-=p*(n&&a?-1:1);break;case"end":h[r]+=p*(n&&a?-1:1);break}return h}const He=async(t,e,n)=>{const{placement:o="bottom",strategy:s="absolute",middleware:i=[],platform:r}=n,c=i.filter(Boolean),l=await(r.isRTL==null?void 0:r.isRTL(e));let a=await r.getElementRects({reference:t,floating:e,strategy:s}),{x:d,y:f}=Ct(a,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:s,middlewareData:h,rects:a,platform:r,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&&(a=b.rects===!0?await r.getElementRects({reference:t,floating:e,strategy:s}):b.rects),{x:d,y:f}=Ct(a,p,l)),y=-1)}return{x:d,y:f,placement:p,strategy:s,middlewareData:h}};async function Kt(t,e){var n;e===void 0&&(e={});const{x:o,y:s,platform:i,rects:r,elements:c,strategy:l}=t,{boundary:a="clippingAncestors",rootBoundary:d="viewport",elementContext:f="floating",altBoundary:p=!1,padding:h=0}=it(e,t),m=Be(h),w=c[p?f==="floating"?"reference":"floating":f],g=ot(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:a,rootBoundary:d,strategy:l})),x=f==="floating"?{x:o,y:s,width:r.floating.width,height:r.floating.height}:r.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=ot(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 $e=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,o;const{placement:s,middlewareData:i,rects:r,initialPlacement:c,platform:l,elements:a}=e,{mainAxis:d=!0,crossAxis:f=!0,fallbackPlacements:p,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:y=!0,...w}=it(t,e);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const g=V(s),x=H(c),v=V(c)===c,A=await(l.isRTL==null?void 0:l.isRTL(a.floating)),b=p||(v||!y?[nt(c)]:Ve(c)),N=m!=="none";!p&&N&&b.push(...Ne(c,y,m,A));const pe=[c,...b],ut=await Kt(e,w),J=[];let _=((o=i.flip)==null?void 0:o.overflows)||[];if(d&&J.push(ut[g]),f){const P=Fe(s,r,A);J.push(ut[P[0]],ut[P[1]])}if(_=[..._,{placement:s,overflows:J}],!J.every(P=>P<=0)){var Ot,Lt;const P=(((Ot=i.flip)==null?void 0:Ot.index)||0)+1,Tt=pe[P];if(Tt)return{data:{index:P,overflows:_},reset:{placement:Tt}};let I=(Lt=_.filter(U=>U.overflows[0]<=0).sort((U,C)=>U.overflows[1]-C.overflows[1])[0])==null?void 0:Lt.placement;if(!I)switch(h){case"bestFit":{var St;const U=(St=_.filter(C=>{if(N){const D=H(C.placement);return D===x||D==="y"}return!0}).map(C=>[C.placement,C.overflows.filter(D=>D>0).reduce((D,me)=>D+me,0)]).sort((C,D)=>C[1]-D[1])[0])==null?void 0:St[0];U&&(I=U);break}case"initialPlacement":I=c;break}if(s!==I)return{reset:{placement:I}}}return{}}}};async function ze(t,e){const{placement:n,platform:o,elements:s}=t,i=await(o.isRTL==null?void 0:o.isRTL(s.floating)),r=V(n),c=rt(n),l=H(n)==="y",a=["left","top"].includes(r)?-1:1,d=i&&l?-1:1,f=it(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*a}:{x:p*a,y:h*d}}const _e=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,o;const{x:s,y:i,placement:r,middlewareData:c}=e,l=await ze(e,t);return r===((n=c.offset)==null?void 0:n.placement)&&(o=c.arrow)!=null&&o.alignmentOffset?{}:{x:s+l.x,y:i+l.y,data:{...l,placement:r}}}}},Ie=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:o,placement:s}=e,{mainAxis:i=!0,crossAxis:r=!1,limiter:c={fn:w=>{let{x:g,y:x}=w;return{x:g,y:x}}},...l}=it(t,e),a={x:n,y:o},d=await Kt(e,l),f=H(V(s)),p=jt(f);let h=a[p],m=a[f];if(i){const w=p==="y"?"top":"left",g=p==="y"?"bottom":"right",x=h+d[w],v=h-d[g];h=kt(x,h,v)}if(r){const w=f==="y"?"top":"left",g=f==="y"?"bottom":"right",x=m+d[w],v=m-d[g];m=kt(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]:r}}}}}};function ct(){return typeof window<"u"}function z(t){return Xt(t)?(t.nodeName||"").toLowerCase():"#document"}function E(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function k(t){var e;return(e=(Xt(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function Xt(t){return ct()?t instanceof Node||t instanceof E(t).Node:!1}function O(t){return ct()?t instanceof Element||t instanceof E(t).Element:!1}function T(t){return ct()?t instanceof HTMLElement||t instanceof E(t).HTMLElement:!1}function Dt(t){return!ct()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof E(t).ShadowRoot}function K(t){const{overflow:e,overflowX:n,overflowY:o,display:s}=L(t);return/auto|scroll|overlay|hidden|clip/.test(e+o+n)&&!["inline","contents"].includes(s)}function je(t){return["table","td","th"].includes(z(t))}function lt(t){return[":popover-open",":modal"].some(e=>{try{return t.matches(e)}catch{return!1}})}function bt(t){const e=Rt(),n=O(t)?L(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 qe(t){let e=W(t);for(;T(e)&&!$(e);){if(bt(e))return e;if(lt(e))return null;e=W(e)}return null}function Rt(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function $(t){return["html","body","#document"].includes(z(t))}function L(t){return E(t).getComputedStyle(t)}function at(t){return O(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function W(t){if(z(t)==="html")return t;const e=t.assignedSlot||t.parentNode||Dt(t)&&t.host||k(t);return Dt(e)?e.host:e}function Jt(t){const e=W(t);return $(e)?t.ownerDocument?t.ownerDocument.body:t.body:T(e)&&K(e)?e:Jt(e)}function q(t,e,n){var o;e===void 0&&(e=[]),n===void 0&&(n=!0);const s=Jt(t),i=s===((o=t.ownerDocument)==null?void 0:o.body),r=E(s);if(i){const c=mt(r);return e.concat(r,r.visualViewport||[],K(s)?s:[],c&&n?q(c):[])}return e.concat(s,q(s,[],n))}function mt(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function Gt(t){const e=L(t);let n=parseFloat(e.width)||0,o=parseFloat(e.height)||0;const s=T(t),i=s?t.offsetWidth:n,r=s?t.offsetHeight:o,c=et(n)!==i||et(o)!==r;return c&&(n=i,o=r),{width:n,height:o,$:c}}function At(t){return O(t)?t:t.contextElement}function B(t){const e=At(t);if(!T(e))return S(1);const n=e.getBoundingClientRect(),{width:o,height:s,$:i}=Gt(e);let r=(i?et(n.width):n.width)/o,c=(i?et(n.height):n.height)/s;return(!r||!Number.isFinite(r))&&(r=1),(!c||!Number.isFinite(c))&&(c=1),{x:r,y:c}}const Ye=S(0);function Qt(t){const e=E(t);return!Rt()||!e.visualViewport?Ye:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function Ke(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==E(t)?!1:e}function M(t,e,n,o){e===void 0&&(e=!1),n===void 0&&(n=!1);const s=t.getBoundingClientRect(),i=At(t);let r=S(1);e&&(o?O(o)&&(r=B(o)):r=B(t));const c=Ke(i,n,o)?Qt(i):S(0);let l=(s.left+c.x)/r.x,a=(s.top+c.y)/r.y,d=s.width/r.x,f=s.height/r.y;if(i){const p=E(i),h=o&&O(o)?E(o):o;let m=p,y=mt(m);for(;y&&o&&h!==m;){const w=B(y),g=y.getBoundingClientRect(),x=L(y),v=g.left+(y.clientLeft+parseFloat(x.paddingLeft))*w.x,A=g.top+(y.clientTop+parseFloat(x.paddingTop))*w.y;l*=w.x,a*=w.y,d*=w.x,f*=w.y,l+=v,a+=A,m=E(y),y=mt(m)}}return ot({width:d,height:f,x:l,y:a})}function Et(t,e){const n=at(t).scrollLeft;return e?e.left+n:M(k(t)).left+n}function Zt(t,e,n){n===void 0&&(n=!1);const o=t.getBoundingClientRect(),s=o.left+e.scrollLeft-(n?0:Et(t,o)),i=o.top+e.scrollTop;return{x:s,y:i}}function Xe(t){let{elements:e,rect:n,offsetParent:o,strategy:s}=t;const i=s==="fixed",r=k(o),c=e?lt(e.floating):!1;if(o===r||c&&i)return n;let l={scrollLeft:0,scrollTop:0},a=S(1);const d=S(0),f=T(o);if((f||!f&&!i)&&((z(o)!=="body"||K(r))&&(l=at(o)),T(o))){const h=M(o);a=B(o),d.x=h.x+o.clientLeft,d.y=h.y+o.clientTop}const p=r&&!f&&!i?Zt(r,l,!0):S(0);return{width:n.width*a.x,height:n.height*a.y,x:n.x*a.x-l.scrollLeft*a.x+d.x+p.x,y:n.y*a.y-l.scrollTop*a.y+d.y+p.y}}function Je(t){return Array.from(t.getClientRects())}function Ge(t){const e=k(t),n=at(t),o=t.ownerDocument.body,s=F(e.scrollWidth,e.clientWidth,o.scrollWidth,o.clientWidth),i=F(e.scrollHeight,e.clientHeight,o.scrollHeight,o.clientHeight);let r=-n.scrollLeft+Et(t);const c=-n.scrollTop;return L(o).direction==="rtl"&&(r+=F(e.clientWidth,o.clientWidth)-s),{width:s,height:i,x:r,y:c}}function Qe(t,e){const n=E(t),o=k(t),s=n.visualViewport;let i=o.clientWidth,r=o.clientHeight,c=0,l=0;if(s){i=s.width,r=s.height;const a=Rt();(!a||a&&e==="fixed")&&(c=s.offsetLeft,l=s.offsetTop)}return{width:i,height:r,x:c,y:l}}function Ze(t,e){const n=M(t,!0,e==="fixed"),o=n.top+t.clientTop,s=n.left+t.clientLeft,i=T(t)?B(t):S(1),r=t.clientWidth*i.x,c=t.clientHeight*i.y,l=s*i.x,a=o*i.y;return{width:r,height:c,x:l,y:a}}function Wt(t,e,n){let o;if(e==="viewport")o=Qe(t,n);else if(e==="document")o=Ge(k(t));else if(O(e))o=Ze(e,n);else{const s=Qt(t);o={x:e.x-s.x,y:e.y-s.y,width:e.width,height:e.height}}return ot(o)}function te(t,e){const n=W(t);return n===e||!O(n)||$(n)?!1:L(n).position==="fixed"||te(n,e)}function tn(t,e){const n=e.get(t);if(n)return n;let o=q(t,[],!1).filter(c=>O(c)&&z(c)!=="body"),s=null;const i=L(t).position==="fixed";let r=i?W(t):t;for(;O(r)&&!$(r);){const c=L(r),l=bt(r);!l&&c.position==="fixed"&&(s=null),(i?!l&&!s:!l&&c.position==="static"&&!!s&&["absolute","fixed"].includes(s.position)||K(r)&&!l&&te(t,r))?o=o.filter(d=>d!==r):s=c,r=W(r)}return e.set(t,o),o}function en(t){let{element:e,boundary:n,rootBoundary:o,strategy:s}=t;const r=[...n==="clippingAncestors"?lt(e)?[]:tn(e,this._c):[].concat(n),o],c=r[0],l=r.reduce((a,d)=>{const f=Wt(e,d,s);return a.top=F(f.top,a.top),a.right=tt(f.right,a.right),a.bottom=tt(f.bottom,a.bottom),a.left=F(f.left,a.left),a},Wt(e,c,s));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function nn(t){const{width:e,height:n}=Gt(t);return{width:e,height:n}}function on(t,e,n){const o=T(e),s=k(e),i=n==="fixed",r=M(t,!0,i,e);let c={scrollLeft:0,scrollTop:0};const l=S(0);if(o||!o&&!i)if((z(e)!=="body"||K(s))&&(c=at(e)),o){const p=M(e,!0,i,e);l.x=p.x+e.clientLeft,l.y=p.y+e.clientTop}else s&&(l.x=Et(s));const a=s&&!o&&!i?Zt(s,c):S(0),d=r.left+c.scrollLeft-l.x-a.x,f=r.top+c.scrollTop-l.y-a.y;return{x:d,y:f,width:r.width,height:r.height}}function dt(t){return L(t).position==="static"}function Pt(t,e){if(!T(t)||L(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return k(t)===n&&(n=n.ownerDocument.body),n}function ee(t,e){const n=E(t);if(lt(t))return n;if(!T(t)){let s=W(t);for(;s&&!$(s);){if(O(s)&&!dt(s))return s;s=W(s)}return n}let o=Pt(t,e);for(;o&&je(o)&&dt(o);)o=Pt(o,e);return o&&$(o)&&dt(o)&&!bt(o)?n:o||qe(t)||n}const sn=async function(t){const e=this.getOffsetParent||ee,n=this.getDimensions,o=await n(t.floating);return{reference:on(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function rn(t){return L(t).direction==="rtl"}const cn={convertOffsetParentRelativeRectToViewportRelativeRect:Xe,getDocumentElement:k,getClippingRect:en,getOffsetParent:ee,getElementRects:sn,getClientRects:Je,getDimensions:nn,getScale:B,isElement:O,isRTL:rn};function ln(t,e){let n=null,o;const s=k(t);function i(){var c;clearTimeout(o),(c=n)==null||c.disconnect(),n=null}function r(c,l){c===void 0&&(c=!1),l===void 0&&(l=1),i();const{left:a,top:d,width:f,height:p}=t.getBoundingClientRect();if(c||e(),!f||!p)return;const h=G(d),m=G(s.clientWidth-(a+f)),y=G(s.clientHeight-(d+p)),w=G(a),x={rootMargin:-h+"px "+-m+"px "+-y+"px "+-w+"px",threshold:F(0,tt(1,l))||1};let v=!0;function A(b){const N=b[0].intersectionRatio;if(N!==l){if(!v)return r();N?r(!1,N):o=setTimeout(()=>{r(!1,1e-7)},1e3)}v=!1}try{n=new IntersectionObserver(A,{...x,root:s.ownerDocument})}catch{n=new IntersectionObserver(A,x)}n.observe(t)}return r(!0),i}function an(t,e,n,o){o===void 0&&(o={});const{ancestorScroll:s=!0,ancestorResize:i=!0,elementResize:r=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:l=!1}=o,a=At(t),d=s||i?[...a?q(a):[],...q(e)]:[];d.forEach(g=>{s&&g.addEventListener("scroll",n,{passive:!0}),i&&g.addEventListener("resize",n)});const f=a&&c?ln(a,n):null;let p=-1,h=null;r&&(h=new ResizeObserver(g=>{let[x]=g;x&&x.target===a&&h&&(h.unobserve(e),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var v;(v=h)==null||v.observe(e)})),n()}),a&&!l&&h.observe(a),h.observe(e));let m,y=l?M(t):null;l&&w();function w(){const g=M(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=>{s&&x.removeEventListener("scroll",n),i&&x.removeEventListener("resize",n)}),f==null||f(),(g=h)==null||g.disconnect(),h=null,l&&cancelAnimationFrame(m)}}const un=_e,fn=Ie,Ft=$e,dn=(t,e,n)=>{const o=new Map,s={platform:cn,...n},i={...s.platform,_c:o};return He(t,e,{...s,platform:i})},hn=({content:t,open:e,placement:n,offset:{mainAxis:o,crossAxis:s}={mainAxis:0,crossAxis:0}})=>u.WithBrowserCtx(i=>{const r=u.Value.toSignal(e),c=i.element;return u.When(r,()=>u.Portal("body",u.html.div(u.WithElement(l=>{const a=l;return a.style.position="absolute",u.OnDispose(an(c,a,async()=>{const{x:d,y:f}=await dn(c,a,{placement:n,strategy:"absolute",middleware:[Ft(),un({mainAxis:o,crossAxis:s}),fn(),Ft()]});a.style.top=`${f}px`,a.style.left=`${d}px`}))}),t())))}),ne=(t,e,n)=>{const o=u.prop(R.AsyncResult.notAsked),s=o.map(f=>R.AsyncResult.isSuccess(f)?f.value:void 0),i=o.map(f=>R.AsyncResult.isFailure(f)?f.error:void 0),r=o.map(f=>R.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(R.AsyncResult.loading(R.AsyncResult.getOrUndefined(h)));try{const m=await e({request:f,abortSignal:p,previous:h});await Promise.resolve(),c=void 0,o.set(R.AsyncResult.success(m))}catch(m){c=void 0,o.set(R.AsyncResult.failure(n(m)))}},a=()=>l(u.Value.get(t)),d=()=>{c==null||c.abort(),c=void 0,o.dispose()};return o.onDispose(u.Value.on(t,l)),{status:o,value:s,error:i,loading:r,reload:a,dispose:d}},oe=(t,e)=>{const{status:n,dispose:o,reload:s}=t,{loading:i,failure:r,success:c}=e;return u.Fragment(u.OnDispose(o),vt(n,{loading:i!=null?l=>i(l,s):void 0,failure:r!=null?l=>r(l,s):void 0,success:l=>c(l,s)}))},pn=({request:t,load:e,mapError:n=o=>o})=>{const o=ne(t,e,n);return s=>oe(o,s)},se=(t,e)=>{if(typeof e=="function")return se(t,{success:e});const n=e.failure??(s=>u.Fragment(u.OnDispose(s.on(console.error)),s.map(i=>`Error: ${i}`))),o=e.success;return u.OneOfType(u.Value.toSignal(t),{Success:s=>o(s.$.value),Failure:s=>n(s.$.error)})},mn=()=>u.on.focus(t=>{var e;return(e=t.target)==null?void 0:e.select()});class X{constructor(e,n,o,s){ft(this,"equals",e=>R.nearEquals(this.left,e.left)&&R.nearEquals(this.top,e.top)&&R.nearEquals(this.width,e.width)&&R.nearEquals(this.height,e.height));this.left=e,this.top=n,this.width=o,this.height=s}static of({left:e=0,top:n=0,width:o=0,height:s=0}){return new X(e,n,o,s)}get right(){return this.left+this.width}get bottom(){return this.top+this.height}get center(){return{x:this.left+this.width/2,y:this.top+this.height/2}}get size(){return{width:this.width,height:this.height}}}function gt(t){const e=t.getBoundingClientRect();return X.of({top:e.top+window.scrollY,left:e.left+window.scrollX,width:e.width,height:e.height})}const ie=t=>u.WithBrowserCtx(e=>{const{element:n}=e,o=u.prop(gt(n)),s=u.renderableOfTNode(t(o))(e),i=()=>{o.set(X.of(gt(n)))};let r;return typeof ResizeObserver=="function"&&(r=new ResizeObserver(i),r.observe(n)),u.OnDispose(c=>{r==null||r.disconnect(),s(c)})}),gn=t=>ie(t),yn=t=>e=>{const n=u.getWindow(),o=u.prop({width:(n==null?void 0:n.innerWidth)??0,height:(n==null?void 0:n.innerHeight)??0}),s=u.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),r=>{n==null||n.removeEventListener("resize",i),s(r)}},re=(t,e)=>{const n=e.split("/").filter(s=>s!==""),o={};for(let s=0;s<t.length;s++){const i=t[s],r=n[s];if(!r&&i.type!=="catch-all")return null;if(i.type==="literal"){if(i.value!==r)return null}else if(i.type==="param")o[i.name]=r;else if(i.type==="catch-all")return{params:o,path:e}}return n.length!==t.length?null:{params:o,path:e}},ce=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!==""),le=t=>{const e=t.map(n=>{const o=ce(n);return{route:n,segments:o}});return function(o){for(const{segments:s,route:i}of e){const r=re(s,o);if(r)return{...r,route:i}}return null}},wn=t=>{const e=le(Object.keys(t));return u.Use(xt,n=>{const o=n.map(s=>{const i=e(s.pathname);if(i==null)throw console.error("No route found for",s),new Error("No route found");return{params:i.params,route:i.route,path:i.path,search:s.search,hash:s.hash}});return u.OneOfTuple(o.map(s=>[s.route,s]),t)})},st=60*1e3,yt=60*st,Y=24*yt,Vt=7*Y,Mt=30*Y,xn=365*Y,vn=[{max:st*90,value:st,name:"minute",past:{singular:"a minute ago",plural:"{} minutes ago"},future:{singular:"in a minute",plural:"in {} minutes"}},{max:yt*36,value:yt,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:Vt*6,value:Vt,name:"week",past:{singular:"last week",plural:"{} weeks ago"},future:{singular:"in a week",plural:"in {} weeks"}},{max:Mt*18,value:Mt,name:"month",past:{singular:"last month",plural:"{} months ago"},future:{singular:"in a month",plural:"in {} months"}},{max:1/0,value:xn,name:"year",past:{singular:"last year",plural:"{} years ago"},future:{singular:"in a year",plural:"in {} years"}}];function Nt(t,e,n,o){const s=Math.round(t/e);return s<=1?n:o.replace("{}",s.toLocaleString(void 0,{maximumFractionDigits:0,minimumFractionDigits:0}))}const ae=(t=1e3)=>{const e=u.prop(new Date),n=R.interval(()=>e.set(new Date),t);return e.onDispose(n),e},ue=t=>{const e=Math.abs(t);if(e<st)return t<0?"just now":"in a moment";for(const n of vn)if(e<n.max)return t<0?Nt(e,n.value,n.past.singular,n.past.plural):Nt(e,n.value,n.future.singular,n.future.plural);throw new Error("unreachable")},fe=(t,{now:e,frequency:n=1e4}={})=>{const o=e!=null?u.Signal.is(e)?e.derive():u.prop(e):ae(n),s=u.computedOf(t,o)((i,r)=>i.getTime()-r.getTime());return s.onDispose(()=>u.Value.dispose(o)),s},de=(t,e={})=>{const n=fe(t,e),o=n.map(ue);return o.onDispose(n.dispose),o},bn=(t,e={})=>de(t,e);class he extends u.Prop{constructor(){super(...arguments);ft(this,"tick",()=>this.update(n=>n+1))}}const Rn=(t=0)=>new he(t,(e,n)=>e===n);exports.Anchor=zt;exports.Appearance=Ee;exports.AsyncResultView=vt;exports.AutoFocus=Oe;exports.AutoSelect=Le;exports.ElementRect=ie;exports.ElementSize=gn;exports.HTMLTitle=Te;exports.HiddenWhenEmpty=Se;exports.InViewport=It;exports.Location=xt;exports.PopOver=hn;exports.Rect=X;exports.Resource=pn;exports.ResourceDisplay=oe;exports.ResultView=se;exports.Router=wn;exports.SelectOnFocus=mn;exports.Ticker=he;exports.WhenInViewport=De;exports.WindowSize=yn;exports._checkExtensionCondition=Bt;exports._getExtension=Ut;exports._makeRouteMatcher=le;exports._parseRouteSegments=ce;exports.areLocationsEqual=$t;exports.getAbsoluteRect=gt;exports.handleAnchorClick=Ht;exports.locationFromURL=wt;exports.makeResource=ne;exports.matchesRoute=re;exports.nowSignal=ae;exports.relativeTime=bn;exports.relativeTimeMillisSignal=fe;exports.relativeTimeSignal=de;exports.setLocationFromUrl=ht;exports.ticker=Rn;exports.timeDiffToString=ue;exports.urlFromLocation=Z;exports.useAppearence=_t;
package/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  var ge = Object.defineProperty;
2
2
  var ye = (t, e, n) => e in t ? ge(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
- var pt = (t, e, n) => ye(t, typeof e != "symbol" ? e + "" : e, n);
3
+ var mt = (t, e, n) => ye(t, typeof e != "symbol" ? e + "" : e, n);
4
4
  import { getWindow as J, prop as W, makeProviderMark as _t, Signal as It, Use as jt, html as Yt, on as qt, Value as D, attr as Kt, Empty as yt, OneOfType as Xt, WithElement as G, OnDispose as F, Portal as Jt, Fragment as At, renderableOfTNode as Rt, When as Gt, WithBrowserCtx as Qt, OneOfTuple as we, computedOf as xe, Prop as ve } from "@tempots/dom";
5
5
  import { delayed as Zt, AsyncResult as C, nearEquals as tt, interval as be } from "@tempots/std";
6
6
  const Ae = (t) => {
@@ -127,16 +127,21 @@ const Ae = (t) => {
127
127
  Kt.href(n),
128
128
  ...e
129
129
  ));
130
- }, Fn = {
130
+ }, Mn = {
131
131
  mark: _t("Appearance"),
132
132
  create: () => {
133
- const t = J(), e = t != null && t.matchMedia != null ? t.matchMedia("(prefers-color-scheme: dark)") : void 0, n = (e == null ? void 0 : e.matches) ?? !1, o = W(n ? "dark" : "light"), s = (i) => o.set(i.matches ? "dark" : "light");
134
- return e == null || e.addEventListener("change", s), {
135
- value: o,
136
- dispose: () => e == null ? void 0 : e.removeEventListener("change", s)
133
+ const t = We();
134
+ return {
135
+ value: t,
136
+ dispose: t.dispose
137
137
  };
138
138
  }
139
- }, ne = (t, e) => {
139
+ };
140
+ function We() {
141
+ const t = J(), e = t != null && t.matchMedia != null ? t.matchMedia("(prefers-color-scheme: dark)") : void 0, n = (e == null ? void 0 : e.matches) ?? !1, o = W(n ? "dark" : "light"), s = (i) => o.set(i.matches ? "dark" : "light");
142
+ return e == null || e.addEventListener("change", s), o.onDispose(() => e == null ? void 0 : e.removeEventListener("change", s)), o;
143
+ }
144
+ const ne = (t, e) => {
140
145
  if (typeof e == "function")
141
146
  return ne(t, { success: e });
142
147
  const n = e.failure ?? ((r) => r.map((c) => `Error: ${c}`)), o = e.success, s = e.loading ?? (() => yt), i = e.notAsked ?? (() => yt);
@@ -146,15 +151,15 @@ const Ae = (t) => {
146
151
  Loading: (r) => s(r.map((c) => c.previousValue)),
147
152
  NotAsked: i
148
153
  });
149
- }, Mn = (t = 10) => G((e) => F(Zt(() => e == null ? void 0 : e.focus(), t))), Vn = (t = 10) => G((e) => {
154
+ }, Vn = (t = 10) => G((e) => F(Zt(() => e == null ? void 0 : e.focus(), t))), Nn = (t = 10) => G((e) => {
150
155
  const n = Zt(() => e.select(), t);
151
156
  return F(n);
152
- }), Nn = G((t) => {
157
+ }), $n = G((t) => {
153
158
  const e = t.style.getPropertyValue(":empty");
154
159
  return t.style.setProperty(":empty", "display:none"), F((n) => {
155
160
  n && t.style.setProperty(":empty", e);
156
161
  });
157
- }), $n = (t) => Jt("head > title", Kt.innerText(t)), We = {
162
+ }), Bn = (t) => Jt("head > title", Kt.innerText(t)), Fe = {
158
163
  partial: {
159
164
  root: null,
160
165
  rootMargin: "0px",
@@ -172,19 +177,19 @@ const Ae = (t) => {
172
177
  partial: null,
173
178
  full: null
174
179
  };
175
- function Fe(t) {
180
+ function Me(t) {
176
181
  return q[t] == null && (q[t] = new IntersectionObserver((e) => {
177
182
  e.forEach((n) => {
178
183
  const o = nt[t].get(n.target);
179
184
  o == null || o.set(n.isIntersecting);
180
185
  });
181
- }, We[t])), q[t];
186
+ }, Fe[t])), q[t];
182
187
  }
183
- const Me = ({ mode: t = "partial", once: e = !1 }, n) => {
188
+ const Ve = ({ mode: t = "partial", once: e = !1 }, n) => {
184
189
  const o = W(!1);
185
190
  return At(
186
191
  G((s) => {
187
- const i = typeof IntersectionObserver < "u" ? Fe(t) : null;
192
+ const i = typeof IntersectionObserver < "u" ? Me(t) : null;
188
193
  nt[t].set(s, o), i == null || i.observe(s);
189
194
  function r() {
190
195
  var l;
@@ -199,15 +204,15 @@ const Me = ({ mode: t = "partial", once: e = !1 }, n) => {
199
204
  }),
200
205
  Rt(n(o))
201
206
  );
202
- }, Bn = (t, e, n) => Me(t, (o) => Gt(o, e, n ?? (() => yt))), ot = Math.min, V = Math.max, st = Math.round, et = Math.floor, L = (t) => ({
207
+ }, Un = (t, e, n) => Ve(t, (o) => Gt(o, e, n ?? (() => yt))), ot = Math.min, V = Math.max, st = Math.round, et = Math.floor, L = (t) => ({
203
208
  x: t,
204
209
  y: t
205
- }), Ve = {
210
+ }), Ne = {
206
211
  left: "right",
207
212
  right: "left",
208
213
  bottom: "top",
209
214
  top: "bottom"
210
- }, Ne = {
215
+ }, $e = {
211
216
  start: "end",
212
217
  end: "start"
213
218
  };
@@ -235,20 +240,20 @@ function z(t) {
235
240
  function ie(t) {
236
241
  return oe(z(t));
237
242
  }
238
- function $e(t, e, n) {
243
+ function Be(t, e, n) {
239
244
  n === void 0 && (n = !1);
240
245
  const o = at(t), s = ie(t), i = se(s);
241
246
  let r = s === "x" ? o === (n ? "end" : "start") ? "right" : "left" : o === "start" ? "bottom" : "top";
242
247
  return e.reference[i] > e.floating[i] && (r = it(r)), [r, it(r)];
243
248
  }
244
- function Be(t) {
249
+ function Ue(t) {
245
250
  const e = it(t);
246
251
  return [xt(t), e, xt(e)];
247
252
  }
248
253
  function xt(t) {
249
- return t.replace(/start|end/g, (e) => Ne[e]);
254
+ return t.replace(/start|end/g, (e) => $e[e]);
250
255
  }
251
- function Ue(t, e, n) {
256
+ function He(t, e, n) {
252
257
  const o = ["left", "right"], s = ["right", "left"], i = ["top", "bottom"], r = ["bottom", "top"];
253
258
  switch (t) {
254
259
  case "top":
@@ -261,15 +266,15 @@ function Ue(t, e, n) {
261
266
  return [];
262
267
  }
263
268
  }
264
- function He(t, e, n, o) {
269
+ function ze(t, e, n, o) {
265
270
  const s = at(t);
266
- let i = Ue(N(t), n === "start", o);
271
+ let i = He(N(t), n === "start", o);
267
272
  return s && (i = i.map((r) => r + "-" + s), e && (i = i.concat(i.map(xt)))), i;
268
273
  }
269
274
  function it(t) {
270
- return t.replace(/left|right|bottom|top/g, (e) => Ve[e]);
275
+ return t.replace(/left|right|bottom|top/g, (e) => Ne[e]);
271
276
  }
272
- function ze(t) {
277
+ function _e(t) {
273
278
  return {
274
279
  top: 0,
275
280
  right: 0,
@@ -278,8 +283,8 @@ function ze(t) {
278
283
  ...t
279
284
  };
280
285
  }
281
- function _e(t) {
282
- return typeof t != "number" ? ze(t) : {
286
+ function Ie(t) {
287
+ return typeof t != "number" ? _e(t) : {
283
288
  top: t,
284
289
  right: t,
285
290
  bottom: t,
@@ -352,7 +357,7 @@ function Ft(t, e, n) {
352
357
  }
353
358
  return h;
354
359
  }
355
- const Ie = async (t, e, n) => {
360
+ const je = async (t, e, n) => {
356
361
  const {
357
362
  placement: o = "bottom",
358
363
  strategy: s = "absolute",
@@ -366,17 +371,17 @@ const Ie = async (t, e, n) => {
366
371
  }), {
367
372
  x: f,
368
373
  y: u
369
- } = Ft(a, o, l), d = o, h = {}, m = 0;
374
+ } = Ft(a, o, l), d = o, h = {}, p = 0;
370
375
  for (let g = 0; g < c.length; g++) {
371
376
  const {
372
377
  name: y,
373
- fn: p
378
+ fn: m
374
379
  } = c[g], {
375
380
  x: w,
376
381
  y: x,
377
382
  data: b,
378
383
  reset: v
379
- } = await p({
384
+ } = await m({
380
385
  x: f,
381
386
  y: u,
382
387
  initialPlacement: o,
@@ -396,7 +401,7 @@ const Ie = async (t, e, n) => {
396
401
  ...h[y],
397
402
  ...b
398
403
  }
399
- }, v && m <= 50 && (m++, typeof v == "object" && (v.placement && (d = v.placement), v.rects && (a = v.rects === !0 ? await r.getElementRects({
404
+ }, v && p <= 50 && (p++, typeof v == "object" && (v.placement && (d = v.placement), v.rects && (a = v.rects === !0 ? await r.getElementRects({
400
405
  reference: t,
401
406
  floating: e,
402
407
  strategy: s
@@ -429,7 +434,7 @@ async function re(t, e) {
429
434
  elementContext: u = "floating",
430
435
  altBoundary: d = !1,
431
436
  padding: h = 0
432
- } = lt(e, t), m = _e(h), y = c[d ? u === "floating" ? "reference" : "floating" : u], p = rt(await i.getClippingRect({
437
+ } = lt(e, t), p = Ie(h), y = c[d ? u === "floating" ? "reference" : "floating" : u], m = rt(await i.getClippingRect({
433
438
  element: (n = await (i.isElement == null ? void 0 : i.isElement(y))) == null || n ? y : y.contextElement || await (i.getDocumentElement == null ? void 0 : i.getDocumentElement(c.floating)),
434
439
  boundary: a,
435
440
  rootBoundary: f,
@@ -452,13 +457,13 @@ async function re(t, e) {
452
457
  strategy: l
453
458
  }) : w);
454
459
  return {
455
- top: (p.top - v.top + m.top) / b.y,
456
- bottom: (v.bottom - p.bottom + m.bottom) / b.y,
457
- left: (p.left - v.left + m.left) / b.x,
458
- right: (v.right - p.right + m.right) / b.x
460
+ top: (m.top - v.top + p.top) / b.y,
461
+ bottom: (v.bottom - m.bottom + p.bottom) / b.y,
462
+ left: (m.left - v.left + p.left) / b.x,
463
+ right: (v.right - m.right + p.right) / b.x
459
464
  };
460
465
  }
461
- const je = function(t) {
466
+ const Ye = function(t) {
462
467
  return t === void 0 && (t = {}), {
463
468
  name: "flip",
464
469
  options: t,
@@ -476,26 +481,26 @@ const je = function(t) {
476
481
  crossAxis: u = !0,
477
482
  fallbackPlacements: d,
478
483
  fallbackStrategy: h = "bestFit",
479
- fallbackAxisSideDirection: m = "none",
484
+ fallbackAxisSideDirection: p = "none",
480
485
  flipAlignment: g = !0,
481
486
  ...y
482
487
  } = lt(t, e);
483
488
  if ((n = i.arrow) != null && n.alignmentOffset)
484
489
  return {};
485
- const p = N(s), w = z(c), x = N(c) === c, b = await (l.isRTL == null ? void 0 : l.isRTL(a.floating)), v = d || (x || !g ? [it(c)] : Be(c)), B = m !== "none";
486
- !d && B && v.push(...He(c, g, m, b));
487
- const me = [c, ...v], mt = await re(e, y), Z = [];
490
+ const m = N(s), w = z(c), x = N(c) === c, b = await (l.isRTL == null ? void 0 : l.isRTL(a.floating)), v = d || (x || !g ? [it(c)] : Ue(c)), B = p !== "none";
491
+ !d && B && v.push(...ze(c, g, p, b));
492
+ const pe = [c, ...v], pt = await re(e, y), Z = [];
488
493
  let j = ((o = i.flip) == null ? void 0 : o.overflows) || [];
489
- if (f && Z.push(mt[p]), u) {
490
- const M = $e(s, r, b);
491
- Z.push(mt[M[0]], mt[M[1]]);
494
+ if (f && Z.push(pt[m]), u) {
495
+ const M = Be(s, r, b);
496
+ Z.push(pt[M[0]], pt[M[1]]);
492
497
  }
493
498
  if (j = [...j, {
494
499
  placement: s,
495
500
  overflows: Z
496
501
  }], !Z.every((M) => M <= 0)) {
497
502
  var St, kt;
498
- const M = (((St = i.flip) == null ? void 0 : St.index) || 0) + 1, Dt = me[M];
503
+ const M = (((St = i.flip) == null ? void 0 : St.index) || 0) + 1, Dt = pe[M];
499
504
  if (Dt)
500
505
  return {
501
506
  data: {
@@ -519,7 +524,7 @@ const je = function(t) {
519
524
  k === "y";
520
525
  }
521
526
  return !0;
522
- }).map((S) => [S.placement, S.overflows.filter((k) => k > 0).reduce((k, pe) => k + pe, 0)]).sort((S, k) => S[1] - k[1])[0]) == null ? void 0 : Ct[0];
527
+ }).map((S) => [S.placement, S.overflows.filter((k) => k > 0).reduce((k, me) => k + me, 0)]).sort((S, k) => S[1] - k[1])[0]) == null ? void 0 : Ct[0];
523
528
  U && (Y = U);
524
529
  break;
525
530
  }
@@ -538,7 +543,7 @@ const je = function(t) {
538
543
  }
539
544
  };
540
545
  };
541
- async function Ye(t, e) {
546
+ async function qe(t, e) {
542
547
  const {
543
548
  placement: n,
544
549
  platform: o,
@@ -547,7 +552,7 @@ async function Ye(t, e) {
547
552
  let {
548
553
  mainAxis: d,
549
554
  crossAxis: h,
550
- alignmentAxis: m
555
+ alignmentAxis: p
551
556
  } = typeof u == "number" ? {
552
557
  mainAxis: u,
553
558
  crossAxis: 0,
@@ -557,7 +562,7 @@ async function Ye(t, e) {
557
562
  crossAxis: u.crossAxis || 0,
558
563
  alignmentAxis: u.alignmentAxis
559
564
  };
560
- return c && typeof m == "number" && (h = c === "end" ? m * -1 : m), l ? {
565
+ return c && typeof p == "number" && (h = c === "end" ? p * -1 : p), l ? {
561
566
  x: h * f,
562
567
  y: d * a
563
568
  } : {
@@ -565,7 +570,7 @@ async function Ye(t, e) {
565
570
  y: h * f
566
571
  };
567
572
  }
568
- const qe = function(t) {
573
+ const Ke = function(t) {
569
574
  return t === void 0 && (t = 0), {
570
575
  name: "offset",
571
576
  options: t,
@@ -576,7 +581,7 @@ const qe = function(t) {
576
581
  y: i,
577
582
  placement: r,
578
583
  middlewareData: c
579
- } = e, l = await Ye(e, t);
584
+ } = e, l = await qe(e, t);
580
585
  return r === ((n = c.offset) == null ? void 0 : n.placement) && (o = c.arrow) != null && o.alignmentOffset ? {} : {
581
586
  x: s + l.x,
582
587
  y: i + l.y,
@@ -587,7 +592,7 @@ const qe = function(t) {
587
592
  };
588
593
  }
589
594
  };
590
- }, Ke = function(t) {
595
+ }, Xe = function(t) {
591
596
  return t === void 0 && (t = {}), {
592
597
  name: "shift",
593
598
  options: t,
@@ -602,11 +607,11 @@ const qe = function(t) {
602
607
  limiter: c = {
603
608
  fn: (y) => {
604
609
  let {
605
- x: p,
610
+ x: m,
606
611
  y: w
607
612
  } = y;
608
613
  return {
609
- x: p,
614
+ x: m,
610
615
  y: w
611
616
  };
612
617
  }
@@ -616,19 +621,19 @@ const qe = function(t) {
616
621
  x: n,
617
622
  y: o
618
623
  }, f = await re(e, l), u = z(N(s)), d = oe(u);
619
- let h = a[d], m = a[u];
624
+ let h = a[d], p = a[u];
620
625
  if (i) {
621
- const y = d === "y" ? "top" : "left", p = d === "y" ? "bottom" : "right", w = h + f[y], x = h - f[p];
626
+ const y = d === "y" ? "top" : "left", m = d === "y" ? "bottom" : "right", w = h + f[y], x = h - f[m];
622
627
  h = Wt(w, h, x);
623
628
  }
624
629
  if (r) {
625
- const y = u === "y" ? "top" : "left", p = u === "y" ? "bottom" : "right", w = m + f[y], x = m - f[p];
626
- m = Wt(w, m, x);
630
+ const y = u === "y" ? "top" : "left", m = u === "y" ? "bottom" : "right", w = p + f[y], x = p - f[m];
631
+ p = Wt(w, p, x);
627
632
  }
628
633
  const g = c.fn({
629
634
  ...e,
630
635
  [d]: h,
631
- [u]: m
636
+ [u]: p
632
637
  });
633
638
  return {
634
639
  ...g,
@@ -679,7 +684,7 @@ function Q(t) {
679
684
  } = E(t);
680
685
  return /auto|scroll|overlay|hidden|clip/.test(e + o + n) && !["inline", "contents"].includes(s);
681
686
  }
682
- function Xe(t) {
687
+ function Je(t) {
683
688
  return ["table", "td", "th"].includes(I(t));
684
689
  }
685
690
  function ft(t) {
@@ -695,7 +700,7 @@ function Et(t) {
695
700
  const e = Lt(), n = R(t) ? E(t) : t;
696
701
  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));
697
702
  }
698
- function Je(t) {
703
+ function Ge(t) {
699
704
  let e = P(t);
700
705
  for (; O(e) && !_(e); ) {
701
706
  if (Et(e))
@@ -781,15 +786,15 @@ function H(t) {
781
786
  y: c
782
787
  };
783
788
  }
784
- const Ge = /* @__PURE__ */ L(0);
789
+ const Qe = /* @__PURE__ */ L(0);
785
790
  function ue(t) {
786
791
  const e = A(t);
787
- return !Lt() || !e.visualViewport ? Ge : {
792
+ return !Lt() || !e.visualViewport ? Qe : {
788
793
  x: e.visualViewport.offsetLeft,
789
794
  y: e.visualViewport.offsetTop
790
795
  };
791
796
  }
792
- function Qe(t, e, n) {
797
+ function Ze(t, e, n) {
793
798
  return e === void 0 && (e = !1), !n || e && n !== A(t) ? !1 : e;
794
799
  }
795
800
  function $(t, e, n, o) {
@@ -797,14 +802,14 @@ function $(t, e, n, o) {
797
802
  const s = t.getBoundingClientRect(), i = Ot(t);
798
803
  let r = L(1);
799
804
  e && (o ? R(o) && (r = H(o)) : r = H(t));
800
- const c = Qe(i, n, o) ? ue(i) : L(0);
805
+ const c = Ze(i, n, o) ? ue(i) : L(0);
801
806
  let l = (s.left + c.x) / r.x, a = (s.top + c.y) / r.y, f = s.width / r.x, u = s.height / r.y;
802
807
  if (i) {
803
808
  const d = A(i), h = o && R(o) ? A(o) : o;
804
- let m = d, g = vt(m);
805
- for (; g && o && h !== m; ) {
806
- const y = H(g), p = g.getBoundingClientRect(), w = E(g), x = p.left + (g.clientLeft + parseFloat(w.paddingLeft)) * y.x, b = p.top + (g.clientTop + parseFloat(w.paddingTop)) * y.y;
807
- l *= y.x, a *= y.y, f *= y.x, u *= y.y, l += x, a += b, m = A(g), g = vt(m);
809
+ let p = d, g = vt(p);
810
+ for (; g && o && h !== p; ) {
811
+ const y = H(g), m = g.getBoundingClientRect(), w = E(g), x = m.left + (g.clientLeft + parseFloat(w.paddingLeft)) * y.x, b = m.top + (g.clientTop + parseFloat(w.paddingTop)) * y.y;
812
+ l *= y.x, a *= y.y, f *= y.x, u *= y.y, l += x, a += b, p = A(g), g = vt(p);
808
813
  }
809
814
  }
810
815
  return rt({
@@ -829,7 +834,7 @@ function fe(t, e, n) {
829
834
  y: i
830
835
  };
831
836
  }
832
- function Ze(t) {
837
+ function tn(t) {
833
838
  let {
834
839
  elements: e,
835
840
  rect: n,
@@ -856,10 +861,10 @@ function Ze(t) {
856
861
  y: n.y * a.y - l.scrollTop * a.y + f.y + d.y
857
862
  };
858
863
  }
859
- function tn(t) {
864
+ function en(t) {
860
865
  return Array.from(t.getClientRects());
861
866
  }
862
- function en(t) {
867
+ function nn(t) {
863
868
  const e = T(t), n = ht(t), o = t.ownerDocument.body, s = V(e.scrollWidth, e.clientWidth, o.scrollWidth, o.clientWidth), i = V(e.scrollHeight, e.clientHeight, o.scrollHeight, o.clientHeight);
864
869
  let r = -n.scrollLeft + Tt(t);
865
870
  const c = -n.scrollTop;
@@ -870,7 +875,7 @@ function en(t) {
870
875
  y: c
871
876
  };
872
877
  }
873
- function nn(t, e) {
878
+ function on(t, e) {
874
879
  const n = A(t), o = T(t), s = n.visualViewport;
875
880
  let i = o.clientWidth, r = o.clientHeight, c = 0, l = 0;
876
881
  if (s) {
@@ -885,7 +890,7 @@ function nn(t, e) {
885
890
  y: l
886
891
  };
887
892
  }
888
- function on(t, e) {
893
+ function sn(t, e) {
889
894
  const n = $(t, !0, e === "fixed"), o = n.top + t.clientTop, s = n.left + t.clientLeft, i = O(t) ? H(t) : L(1), r = t.clientWidth * i.x, c = t.clientHeight * i.y, l = s * i.x, a = o * i.y;
890
895
  return {
891
896
  width: r,
@@ -897,11 +902,11 @@ function on(t, e) {
897
902
  function Vt(t, e, n) {
898
903
  let o;
899
904
  if (e === "viewport")
900
- o = nn(t, n);
905
+ o = on(t, n);
901
906
  else if (e === "document")
902
- o = en(T(t));
907
+ o = nn(T(t));
903
908
  else if (R(e))
904
- o = on(e, n);
909
+ o = sn(e, n);
905
910
  else {
906
911
  const s = ue(t);
907
912
  o = {
@@ -917,7 +922,7 @@ function he(t, e) {
917
922
  const n = P(t);
918
923
  return n === e || !R(n) || _(n) ? !1 : E(n).position === "fixed" || he(n, e);
919
924
  }
920
- function sn(t, e) {
925
+ function rn(t, e) {
921
926
  const n = e.get(t);
922
927
  if (n)
923
928
  return n;
@@ -930,14 +935,14 @@ function sn(t, e) {
930
935
  }
931
936
  return e.set(t, o), o;
932
937
  }
933
- function rn(t) {
938
+ function cn(t) {
934
939
  let {
935
940
  element: e,
936
941
  boundary: n,
937
942
  rootBoundary: o,
938
943
  strategy: s
939
944
  } = t;
940
- const r = [...n === "clippingAncestors" ? ft(e) ? [] : sn(e, this._c) : [].concat(n), o], c = r[0], l = r.reduce((a, f) => {
945
+ const r = [...n === "clippingAncestors" ? ft(e) ? [] : rn(e, this._c) : [].concat(n), o], c = r[0], l = r.reduce((a, f) => {
941
946
  const u = Vt(e, f, s);
942
947
  return a.top = V(u.top, a.top), a.right = ot(u.right, a.right), a.bottom = ot(u.bottom, a.bottom), a.left = V(u.left, a.left), a;
943
948
  }, Vt(e, c, s));
@@ -948,7 +953,7 @@ function rn(t) {
948
953
  y: l.top
949
954
  };
950
955
  }
951
- function cn(t) {
956
+ function ln(t) {
952
957
  const {
953
958
  width: e,
954
959
  height: n
@@ -958,7 +963,7 @@ function cn(t) {
958
963
  height: n
959
964
  };
960
965
  }
961
- function ln(t, e, n) {
966
+ function an(t, e, n) {
962
967
  const o = O(e), s = T(e), i = n === "fixed", r = $(t, !0, i, e);
963
968
  let c = {
964
969
  scrollLeft: 0,
@@ -1003,14 +1008,14 @@ function de(t, e) {
1003
1008
  return n;
1004
1009
  }
1005
1010
  let o = Nt(t, e);
1006
- for (; o && Xe(o) && gt(o); )
1011
+ for (; o && Je(o) && gt(o); )
1007
1012
  o = Nt(o, e);
1008
- return o && _(o) && gt(o) && !Et(o) ? n : o || Je(t) || n;
1013
+ return o && _(o) && gt(o) && !Et(o) ? n : o || Ge(t) || n;
1009
1014
  }
1010
- const an = async function(t) {
1015
+ const un = async function(t) {
1011
1016
  const e = this.getOffsetParent || de, n = this.getDimensions, o = await n(t.floating);
1012
1017
  return {
1013
- reference: ln(t.reference, await e(t.floating), t.strategy),
1018
+ reference: an(t.reference, await e(t.floating), t.strategy),
1014
1019
  floating: {
1015
1020
  x: 0,
1016
1021
  y: 0,
@@ -1019,22 +1024,22 @@ const an = async function(t) {
1019
1024
  }
1020
1025
  };
1021
1026
  };
1022
- function un(t) {
1027
+ function fn(t) {
1023
1028
  return E(t).direction === "rtl";
1024
1029
  }
1025
- const fn = {
1026
- convertOffsetParentRelativeRectToViewportRelativeRect: Ze,
1030
+ const hn = {
1031
+ convertOffsetParentRelativeRectToViewportRelativeRect: tn,
1027
1032
  getDocumentElement: T,
1028
- getClippingRect: rn,
1033
+ getClippingRect: cn,
1029
1034
  getOffsetParent: de,
1030
- getElementRects: an,
1031
- getClientRects: tn,
1032
- getDimensions: cn,
1035
+ getElementRects: un,
1036
+ getClientRects: en,
1037
+ getDimensions: ln,
1033
1038
  getScale: H,
1034
1039
  isElement: R,
1035
- isRTL: un
1040
+ isRTL: fn
1036
1041
  };
1037
- function hn(t, e) {
1042
+ function dn(t, e) {
1038
1043
  let n = null, o;
1039
1044
  const s = T(t);
1040
1045
  function i() {
@@ -1051,8 +1056,8 @@ function hn(t, e) {
1051
1056
  } = t.getBoundingClientRect();
1052
1057
  if (c || e(), !u || !d)
1053
1058
  return;
1054
- const h = et(f), m = et(s.clientWidth - (a + u)), g = et(s.clientHeight - (f + d)), y = et(a), w = {
1055
- rootMargin: -h + "px " + -m + "px " + -g + "px " + -y + "px",
1059
+ const h = et(f), p = et(s.clientWidth - (a + u)), g = et(s.clientHeight - (f + d)), y = et(a), w = {
1060
+ rootMargin: -h + "px " + -p + "px " + -g + "px " + -y + "px",
1056
1061
  threshold: V(0, ot(1, l)) || 1
1057
1062
  };
1058
1063
  let x = !0;
@@ -1080,7 +1085,7 @@ function hn(t, e) {
1080
1085
  }
1081
1086
  return r(!0), i;
1082
1087
  }
1083
- function dn(t, e, n, o) {
1088
+ function pn(t, e, n, o) {
1084
1089
  o === void 0 && (o = {});
1085
1090
  const {
1086
1091
  ancestorScroll: s = !0,
@@ -1089,46 +1094,46 @@ function dn(t, e, n, o) {
1089
1094
  layoutShift: c = typeof IntersectionObserver == "function",
1090
1095
  animationFrame: l = !1
1091
1096
  } = o, a = Ot(t), f = s || i ? [...a ? K(a) : [], ...K(e)] : [];
1092
- f.forEach((p) => {
1093
- s && p.addEventListener("scroll", n, {
1097
+ f.forEach((m) => {
1098
+ s && m.addEventListener("scroll", n, {
1094
1099
  passive: !0
1095
- }), i && p.addEventListener("resize", n);
1100
+ }), i && m.addEventListener("resize", n);
1096
1101
  });
1097
- const u = a && c ? hn(a, n) : null;
1102
+ const u = a && c ? dn(a, n) : null;
1098
1103
  let d = -1, h = null;
1099
- r && (h = new ResizeObserver((p) => {
1100
- let [w] = p;
1104
+ r && (h = new ResizeObserver((m) => {
1105
+ let [w] = m;
1101
1106
  w && w.target === a && h && (h.unobserve(e), cancelAnimationFrame(d), d = requestAnimationFrame(() => {
1102
1107
  var x;
1103
1108
  (x = h) == null || x.observe(e);
1104
1109
  })), n();
1105
1110
  }), a && !l && h.observe(a), h.observe(e));
1106
- let m, g = l ? $(t) : null;
1111
+ let p, g = l ? $(t) : null;
1107
1112
  l && y();
1108
1113
  function y() {
1109
- const p = $(t);
1110
- g && (p.x !== g.x || p.y !== g.y || p.width !== g.width || p.height !== g.height) && n(), g = p, m = requestAnimationFrame(y);
1114
+ const m = $(t);
1115
+ g && (m.x !== g.x || m.y !== g.y || m.width !== g.width || m.height !== g.height) && n(), g = m, p = requestAnimationFrame(y);
1111
1116
  }
1112
1117
  return n(), () => {
1113
- var p;
1118
+ var m;
1114
1119
  f.forEach((w) => {
1115
1120
  s && w.removeEventListener("scroll", n), i && w.removeEventListener("resize", n);
1116
- }), u == null || u(), (p = h) == null || p.disconnect(), h = null, l && cancelAnimationFrame(m);
1121
+ }), u == null || u(), (m = h) == null || m.disconnect(), h = null, l && cancelAnimationFrame(p);
1117
1122
  };
1118
1123
  }
1119
- const mn = qe, pn = Ke, $t = je, gn = (t, e, n) => {
1124
+ const mn = Ke, gn = Xe, $t = Ye, yn = (t, e, n) => {
1120
1125
  const o = /* @__PURE__ */ new Map(), s = {
1121
- platform: fn,
1126
+ platform: hn,
1122
1127
  ...n
1123
1128
  }, i = {
1124
1129
  ...s.platform,
1125
1130
  _c: o
1126
1131
  };
1127
- return Ie(t, e, {
1132
+ return je(t, e, {
1128
1133
  ...s,
1129
1134
  platform: i
1130
1135
  });
1131
- }, Un = ({
1136
+ }, Hn = ({
1132
1137
  content: t,
1133
1138
  open: e,
1134
1139
  placement: n,
@@ -1143,14 +1148,14 @@ const mn = qe, pn = Ke, $t = je, gn = (t, e, n) => {
1143
1148
  G((l) => {
1144
1149
  const a = l;
1145
1150
  return a.style.position = "absolute", F(
1146
- dn(c, a, async () => {
1147
- const { x: f, y: u } = await gn(c, a, {
1151
+ pn(c, a, async () => {
1152
+ const { x: f, y: u } = await yn(c, a, {
1148
1153
  placement: n,
1149
1154
  strategy: "absolute",
1150
1155
  middleware: [
1151
1156
  $t(),
1152
1157
  mn({ mainAxis: o, crossAxis: s }),
1153
- pn(),
1158
+ gn(),
1154
1159
  $t()
1155
1160
  ]
1156
1161
  });
@@ -1162,7 +1167,7 @@ const mn = qe, pn = Ke, $t = je, gn = (t, e, n) => {
1162
1167
  )
1163
1168
  )
1164
1169
  );
1165
- }), yn = (t, e, n) => {
1170
+ }), wn = (t, e, n) => {
1166
1171
  const o = W(C.notAsked), s = o.map(
1167
1172
  (u) => C.isSuccess(u) ? u.value : void 0
1168
1173
  ), i = o.map(
@@ -1174,10 +1179,10 @@ const mn = qe, pn = Ke, $t = je, gn = (t, e, n) => {
1174
1179
  const d = c.signal, h = o.get();
1175
1180
  o.set(C.loading(C.getOrUndefined(h)));
1176
1181
  try {
1177
- const m = await e({ request: u, abortSignal: d, previous: h });
1178
- await Promise.resolve(), c = void 0, o.set(C.success(m));
1179
- } catch (m) {
1180
- c = void 0, o.set(C.failure(n(m)));
1182
+ const p = await e({ request: u, abortSignal: d, previous: h });
1183
+ await Promise.resolve(), c = void 0, o.set(C.success(p));
1184
+ } catch (p) {
1185
+ c = void 0, o.set(C.failure(n(p)));
1181
1186
  }
1182
1187
  }, a = () => l(D.get(t)), f = () => {
1183
1188
  c == null || c.abort(), c = void 0, o.dispose();
@@ -1190,7 +1195,7 @@ const mn = qe, pn = Ke, $t = je, gn = (t, e, n) => {
1190
1195
  reload: a,
1191
1196
  dispose: f
1192
1197
  };
1193
- }, wn = (t, e) => {
1198
+ }, xn = (t, e) => {
1194
1199
  const { status: n, dispose: o, reload: s } = t, { loading: i, failure: r, success: c } = e;
1195
1200
  return At(
1196
1201
  F(o),
@@ -1200,16 +1205,16 @@ const mn = qe, pn = Ke, $t = je, gn = (t, e, n) => {
1200
1205
  success: (l) => c(l, s)
1201
1206
  })
1202
1207
  );
1203
- }, Hn = ({
1208
+ }, zn = ({
1204
1209
  request: t,
1205
1210
  load: e,
1206
1211
  mapError: n = (o) => o
1207
1212
  }) => {
1208
- const o = yn(t, e, n);
1209
- return (s) => wn(o, s);
1210
- }, xn = (t, e) => {
1213
+ const o = wn(t, e, n);
1214
+ return (s) => xn(o, s);
1215
+ }, vn = (t, e) => {
1211
1216
  if (typeof e == "function")
1212
- return xn(t, { success: e });
1217
+ return vn(t, { success: e });
1213
1218
  const n = e.failure ?? ((s) => At(
1214
1219
  F(s.on(console.error)),
1215
1220
  s.map((i) => `Error: ${i}`)
@@ -1218,7 +1223,7 @@ const mn = qe, pn = Ke, $t = je, gn = (t, e, n) => {
1218
1223
  Success: (s) => o(s.$.value),
1219
1224
  Failure: (s) => n(s.$.error)
1220
1225
  });
1221
- }, zn = () => qt.focus((t) => {
1226
+ }, _n = () => qt.focus((t) => {
1222
1227
  var e;
1223
1228
  return (e = t.target) == null ? void 0 : e.select();
1224
1229
  });
@@ -1261,7 +1266,7 @@ class dt {
1261
1266
  * console.log(rect1.equals(rect3)); // true (within tolerance)
1262
1267
  * ```
1263
1268
  */
1264
- pt(this, "equals", (e) => tt(this.left, e.left) && tt(this.top, e.top) && tt(this.width, e.width) && tt(this.height, e.height));
1269
+ mt(this, "equals", (e) => tt(this.left, e.left) && tt(this.top, e.top) && tt(this.width, e.width) && tt(this.height, e.height));
1265
1270
  this.left = e, this.top = n, this.width = o, this.height = s;
1266
1271
  }
1267
1272
  /**
@@ -1370,7 +1375,7 @@ function Bt(t) {
1370
1375
  height: e.height
1371
1376
  });
1372
1377
  }
1373
- const vn = (t) => Qt((e) => {
1378
+ const bn = (t) => Qt((e) => {
1374
1379
  const { element: n } = e, o = W(Bt(n)), s = Rt(t(o))(e), i = () => {
1375
1380
  o.set(dt.of(Bt(n)));
1376
1381
  };
@@ -1378,7 +1383,7 @@ const vn = (t) => Qt((e) => {
1378
1383
  return typeof ResizeObserver == "function" && (r = new ResizeObserver(i), r.observe(n)), F((c) => {
1379
1384
  r == null || r.disconnect(), s(c);
1380
1385
  });
1381
- }), _n = (t) => vn(t), In = (t) => (e) => {
1386
+ }), In = (t) => bn(t), jn = (t) => (e) => {
1382
1387
  const n = J(), o = W({
1383
1388
  width: (n == null ? void 0 : n.innerWidth) ?? 0,
1384
1389
  height: (n == null ? void 0 : n.innerHeight) ?? 0
@@ -1391,7 +1396,7 @@ const vn = (t) => Qt((e) => {
1391
1396
  return n == null || n.addEventListener("resize", i), (r) => {
1392
1397
  n == null || n.removeEventListener("resize", i), s(r);
1393
1398
  };
1394
- }, bn = (t, e) => {
1399
+ }, An = (t, e) => {
1395
1400
  const n = e.split("/").filter((s) => s !== ""), o = {};
1396
1401
  for (let s = 0; s < t.length; s++) {
1397
1402
  const i = t[s], r = n[s];
@@ -1406,21 +1411,21 @@ const vn = (t) => Qt((e) => {
1406
1411
  return { params: o, path: e };
1407
1412
  }
1408
1413
  return n.length !== t.length ? null : { params: o, path: e };
1409
- }, An = (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 !== ""), Rn = (t) => {
1414
+ }, Rn = (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 !== ""), En = (t) => {
1410
1415
  const e = t.map((n) => {
1411
- const o = An(n);
1416
+ const o = Rn(n);
1412
1417
  return { route: n, segments: o };
1413
1418
  });
1414
1419
  return function(o) {
1415
1420
  for (const { segments: s, route: i } of e) {
1416
- const r = bn(s, o);
1421
+ const r = An(s, o);
1417
1422
  if (r)
1418
1423
  return { ...r, route: i };
1419
1424
  }
1420
1425
  return null;
1421
1426
  };
1422
- }, jn = (t) => {
1423
- const e = Rn(Object.keys(t));
1427
+ }, Yn = (t) => {
1428
+ const e = En(Object.keys(t));
1424
1429
  return jt(ee, (n) => {
1425
1430
  const o = n.map((s) => {
1426
1431
  const i = e(s.pathname);
@@ -1440,7 +1445,7 @@ const vn = (t) => Qt((e) => {
1440
1445
  t
1441
1446
  );
1442
1447
  });
1443
- }, ct = 60 * 1e3, bt = 60 * ct, X = 24 * bt, Ut = 7 * X, Ht = 30 * X, En = 365 * X, Ln = [
1448
+ }, ct = 60 * 1e3, bt = 60 * ct, X = 24 * bt, Ut = 7 * X, Ht = 30 * X, Ln = 365 * X, On = [
1444
1449
  {
1445
1450
  max: ct * 90,
1446
1451
  value: ct,
@@ -1478,7 +1483,7 @@ const vn = (t) => Qt((e) => {
1478
1483
  },
1479
1484
  {
1480
1485
  max: 1 / 0,
1481
- value: En,
1486
+ value: Ln,
1482
1487
  name: "year",
1483
1488
  past: { singular: "last year", plural: "{} years ago" },
1484
1489
  future: { singular: "in a year", plural: "in {} years" }
@@ -1494,76 +1499,77 @@ function zt(t, e, n, o) {
1494
1499
  })
1495
1500
  );
1496
1501
  }
1497
- const On = (t = 1e3) => {
1502
+ const Tn = (t = 1e3) => {
1498
1503
  const e = W(/* @__PURE__ */ new Date()), n = be(() => e.set(/* @__PURE__ */ new Date()), t);
1499
1504
  return e.onDispose(n), e;
1500
- }, Tn = (t) => {
1505
+ }, Sn = (t) => {
1501
1506
  const e = Math.abs(t);
1502
1507
  if (e < ct)
1503
1508
  return t < 0 ? "just now" : "in a moment";
1504
- for (const n of Ln)
1509
+ for (const n of On)
1505
1510
  if (e < n.max)
1506
1511
  return t < 0 ? zt(e, n.value, n.past.singular, n.past.plural) : zt(e, n.value, n.future.singular, n.future.plural);
1507
1512
  throw new Error("unreachable");
1508
- }, Sn = (t, { now: e, frequency: n = 1e4 } = {}) => {
1509
- const o = e != null ? It.is(e) ? e.derive() : W(e) : On(n), s = xe(
1513
+ }, kn = (t, { now: e, frequency: n = 1e4 } = {}) => {
1514
+ const o = e != null ? It.is(e) ? e.derive() : W(e) : Tn(n), s = xe(
1510
1515
  t,
1511
1516
  o
1512
1517
  )((i, r) => i.getTime() - r.getTime());
1513
1518
  return s.onDispose(() => D.dispose(o)), s;
1514
- }, kn = (t, e = {}) => {
1515
- const n = Sn(t, e), o = n.map(Tn);
1519
+ }, Cn = (t, e = {}) => {
1520
+ const n = kn(t, e), o = n.map(Sn);
1516
1521
  return o.onDispose(n.dispose), o;
1517
- }, Yn = (t, e = {}) => kn(t, e);
1518
- class Cn extends ve {
1522
+ }, qn = (t, e = {}) => Cn(t, e);
1523
+ class Dn extends ve {
1519
1524
  constructor() {
1520
1525
  super(...arguments);
1521
1526
  /**
1522
1527
  * Triggers an update of the Ticker by incrementing its internal value.
1523
1528
  * @returns void
1524
1529
  */
1525
- pt(this, "tick", () => this.update((n) => n + 1));
1530
+ mt(this, "tick", () => this.update((n) => n + 1));
1526
1531
  }
1527
1532
  }
1528
- const qn = (t = 0) => new Cn(t, (e, n) => e === n);
1533
+ const Kn = (t = 0) => new Dn(t, (e, n) => e === n);
1529
1534
  export {
1530
1535
  Pe as Anchor,
1531
- Fn as Appearance,
1536
+ Mn as Appearance,
1532
1537
  ne as AsyncResultView,
1533
- Mn as AutoFocus,
1534
- Vn as AutoSelect,
1535
- vn as ElementRect,
1536
- _n as ElementSize,
1537
- $n as HTMLTitle,
1538
- Nn as HiddenWhenEmpty,
1539
- Me as InViewport,
1538
+ Vn as AutoFocus,
1539
+ Nn as AutoSelect,
1540
+ bn as ElementRect,
1541
+ In as ElementSize,
1542
+ Bn as HTMLTitle,
1543
+ $n as HiddenWhenEmpty,
1544
+ Ve as InViewport,
1540
1545
  ee as Location,
1541
- Un as PopOver,
1546
+ Hn as PopOver,
1542
1547
  dt as Rect,
1543
- Hn as Resource,
1544
- wn as ResourceDisplay,
1545
- xn as ResultView,
1546
- jn as Router,
1547
- zn as SelectOnFocus,
1548
- Cn as Ticker,
1549
- Bn as WhenInViewport,
1550
- In as WindowSize,
1548
+ zn as Resource,
1549
+ xn as ResourceDisplay,
1550
+ vn as ResultView,
1551
+ Yn as Router,
1552
+ _n as SelectOnFocus,
1553
+ Dn as Ticker,
1554
+ Un as WhenInViewport,
1555
+ jn as WindowSize,
1551
1556
  Re as _checkExtensionCondition,
1552
1557
  Ae as _getExtension,
1553
- Rn as _makeRouteMatcher,
1554
- An as _parseRouteSegments,
1558
+ En as _makeRouteMatcher,
1559
+ Rn as _parseRouteSegments,
1555
1560
  Oe as areLocationsEqual,
1556
1561
  Bt as getAbsoluteRect,
1557
1562
  Le as handleAnchorClick,
1558
1563
  te as locationFromURL,
1559
- yn as makeResource,
1560
- bn as matchesRoute,
1561
- On as nowSignal,
1562
- Yn as relativeTime,
1563
- Sn as relativeTimeMillisSignal,
1564
- kn as relativeTimeSignal,
1564
+ wn as makeResource,
1565
+ An as matchesRoute,
1566
+ Tn as nowSignal,
1567
+ qn as relativeTime,
1568
+ kn as relativeTimeMillisSignal,
1569
+ Cn as relativeTimeSignal,
1565
1570
  Pt as setLocationFromUrl,
1566
- qn as ticker,
1567
- Tn as timeDiffToString,
1568
- wt as urlFromLocation
1571
+ Kn as ticker,
1572
+ Sn as timeDiffToString,
1573
+ wt as urlFromLocation,
1574
+ We as useAppearence
1569
1575
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tempots/ui",
3
- "version": "3.0.0",
3
+ "version": "3.1.0",
4
4
  "type": "module",
5
5
  "main": "./index.cjs",
6
6
  "module": "./index.js",
@@ -18,3 +18,14 @@ export type AppearanceType = 'light' | 'dark';
18
18
  * @public
19
19
  */
20
20
  export declare const Appearance: Provider<Signal<AppearanceType>>;
21
+ /**
22
+ * Creates a signal that represents the current appearance (light or dark) based on the user's system
23
+ * preferences.
24
+ *
25
+ * The appearance is updated whenever the user's system preferences change, and the signal is cleaned
26
+ * up when it is no longer needed.
27
+ *
28
+ * @returns A signal representing the current appearance.
29
+ * @public
30
+ */
31
+ export declare function useAppearence(): Signal<AppearanceType>;