@tempots/ui 6.0.0 → 6.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.
Files changed (3) hide show
  1. package/index.cjs +1 -1
  2. package/index.js +99 -107
  3. package/package.json +1 -1
package/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var Oe=Object.defineProperty;var Ae=(t,e,o)=>e in t?Oe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o;var vt=(t,e,o)=>Ae(t,typeof e!="symbol"?e+"":e,o);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("@tempots/dom"),E=require("@tempots/std"),qt=t=>{const e=t.split("/").pop();if(e==null||e.startsWith("."))return;const o=e.split(".")||[];return o.length>1?"."+o.pop():void 0},Yt=(t,e)=>{const o=qt(e);return o!=null&&(t.length===0||!t.some(n=>o==n))},Ee=(t,e,o,n)=>{let r=t.target;for(;r!=null&&!(r instanceof HTMLAnchorElement);)r=r.parentElement;if(r==null)return!0;const s=r;if(t.button!==0||t.ctrlKey||t.metaKey||s.target!=="_self"&&s.target!==""||s.getAttribute("download")!=null)return!0;const{pathname:i,search:c,hash:a}=s;if(n){const u=i+c+a,d=s.getAttribute("href");if(!(d!=null&&d.startsWith("#"))&&d!==u)return!0}return e?!1:Yt(o,i)},Xt=(t,e={ignoreUrlWithExtension:!0,allowedExtensions:[],ignoreExternalUrl:!0})=>{const o=e.ignoreUrlWithExtension===!0&&Array.isArray(e.allowedExtensions)?e.allowedExtensions.map(n=>n.startsWith(".")?n:"."+n):[];return n=>{Ee(n,e.ignoreUrlWithExtension??!0,o,e.ignoreExternalUrl??!0)||t()&&n.preventDefault()}},Jt=(t,e)=>t.pathname===e.pathname&&JSON.stringify(t.search)===JSON.stringify(e.search)&&t.hash===e.hash,St=(t,e)=>{var s;const o=new URL(t,e??((s=l.getWindow())==null?void 0:s.location.toString())),n=Object.fromEntries(o.searchParams.entries());let r=o.hash;return r.startsWith("#")&&(r=r.substring(1)),{pathname:o.pathname,search:n,hash:r===""?void 0:r}},Rt=(t,e)=>{const o=St(e);return t.set(o),t},lt=t=>{const o=new URLSearchParams(t.search).toString(),n=t.hash;return`${t.pathname}${o?`?${o}`:""}${n?`#${n}`:""}`},Pe=t=>t.startsWith("http://")||t.startsWith("https://")||t.startsWith("//"),Se=t=>{const e=t.container.currentURL,o=e.iso(n=>St(n),n=>{if(Pe(n.pathname))return lt(n);const r=new URL(n.pathname,e.value),s=r.origin+r.pathname;return lt({...n,pathname:s})});return{value:o,dispose:o.dispose}},Le=()=>{const t=l.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}},Te=()=>{const t=l.prop(Le(),Jt),e=l.getWindow(),o=()=>{let n=(e==null?void 0:e.location.hash)??"";n.startsWith("#")&&(n=n.substring(1));const r={pathname:(e==null?void 0:e.location.pathname)??"",search:Object.fromEntries(new URLSearchParams((e==null?void 0:e.location.search)??"").entries()),hash:n===""?void 0:n};t.set(r)};return e==null||e.addEventListener("popstate",o),t.onDispose(()=>{e==null||e.removeEventListener("popstate",o)}),t.on(n=>{e==null||e.history.pushState({},"",lt(n))}),{value:t,dispose:t.dispose}},gt={mark:l.makeProviderMark("LocationProvider"),create:(t,e)=>{if(e.isBrowser())return Te();if(e.isHeadless())return Se(e);throw new Error("Unknown context")}},ke=t=>{document.startViewTransition?document.startViewTransition(t):t()},Gt=(t,...e)=>{if(typeof t=="string"||l.Signal.is(t))return Gt({href:t},...e);const{href:o,withViewTransition:n,...r}=t;return l.Use(gt,s=>l.html.a(l.on.click(Xt(()=>(n===!0?ke(()=>{Rt(s,l.Value.get(o))}):Rt(s,l.Value.get(o)),!0),r)),l.attr.href(o),...e))},De={mark:l.makeProviderMark("Appearance"),create:()=>{const t=Qt();return{value:t,dispose:t.dispose}}};function Qt(){const t=l.getWindow(),e=t!=null&&t.matchMedia!=null?t.matchMedia("(prefers-color-scheme: dark)"):void 0,o=(e==null?void 0:e.matches)??!1,n=l.prop(o?"dark":"light"),r=s=>n.set(s.matches?"dark":"light");return e==null||e.addEventListener("change",r),n.onDispose(()=>e==null?void 0:e.removeEventListener("change",r)),n}const Lt=(t,e)=>{if(typeof e=="function")return Lt(t,{success:e});const o=e.failure??(i=>i.map(c=>`Error: ${c}`)),n=e.success,r=e.loading??(()=>l.Empty),s=e.notAsked??(()=>l.Empty);return l.OneOfType(l.Value.toSignal(t),{AsyncSuccess:i=>n(i.$.value),AsyncFailure:i=>o(i.$.error),Loading:i=>r(i.map(c=>c.previousValue)),NotAsked:s})},We=(t=10)=>l.WithElement(e=>l.OnDispose(E.delayed(()=>e==null?void 0:e.focus(),t))),Ce=(t=10)=>l.WithElement(e=>{const o=E.delayed(()=>e.select(),t);return l.OnDispose(o)}),Fe=l.WithElement(t=>{const e=t.style.getPropertyValue(":empty");return t.style.setProperty(":empty","display:none"),l.OnDispose(o=>{o&&t.style.setProperty(":empty",e)})}),Ve=t=>l.Portal("head > title",l.attr.innerText(t)),Me={partial:{root:null,rootMargin:"0px",threshold:0},full:{root:null,rootMargin:"0px",threshold:1}},at={partial:new Map,full:new Map},tt={partial:null,full:null};function Ne(t){return tt[t]==null&&(tt[t]=new IntersectionObserver(e=>{e.forEach(o=>{const n=at[t].get(o.target);n==null||n.set(o.isIntersecting)})},Me[t])),tt[t]}const Zt=({mode:t="partial",once:e=!1},o)=>{const n=l.prop(!1);return l.Fragment(l.WithElement(r=>{const s=typeof IntersectionObserver<"u"?Ne(t):null;at[t].set(r,n),s==null||s.observe(r);function i(){var a;s==null||s.unobserve(r),at[t].delete(r),at[t].size===0&&((a=tt[t])==null||a.disconnect(),tt[t]=null)}let c=null;return e&&(c=n.on(a=>{a&&i()})),l.OnDispose(()=>{n.dispose(),i(),c==null||c()})}),l.renderableOfTNode(o(n)))},Ue=(t,e,o)=>Zt(t,n=>l.When(n,e,o??(()=>l.Empty)));function He(t){return l.WithElement(e=>{const o=n=>{e.contains(n.target)||t(n)};return document.addEventListener("click",o),l.OnDispose(()=>{document.removeEventListener("click",o)})})}const Y=(t,e)=>t===void 0||t===e,Nt=(t,e)=>t===void 0||t===e;function te(t,e){return typeof t=="string"?e.key===t:Nt(t.key,e.key)&&Nt(t.code,e.code)&&Y(t.ctrlKey,e.ctrlKey)&&Y(t.altKey,e.altKey)&&Y(t.shiftKey,e.shiftKey)&&Y(t.metaKey,e.metaKey)&&Y(t.repeat,e.repeat)&&Y(t.commandOrControlKey,e.metaKey||e.ctrlKey)}function Tt({allowedKeys:t,handler:e}){return l.WithElement(o=>{const n=r=>{if(o.contains(r.target)){for(const s of t)if(te(s,r)){e(r);break}}};return document.addEventListener("keydown",n),l.OnDispose(()=>{document.removeEventListener("keydown",n)})})}function $e(t){return Tt({allowedKeys:["Enter"],handler:t})}function Ke(t){return Tt({allowedKeys:["Escape"],handler:t})}const J=Math.min,j=Math.max,ut=Math.round,ct=Math.floor,C=t=>({x:t,y:t}),Be={left:"right",right:"left",bottom:"top",top:"bottom"},ze={start:"end",end:"start"};function bt(t,e,o){return j(t,J(e,o))}function ot(t,e){return typeof t=="function"?t(e):t}function I(t){return t.split("-")[0]}function rt(t){return t.split("-")[1]}function ee(t){return t==="x"?"y":"x"}function kt(t){return t==="y"?"height":"width"}function H(t){return["top","bottom"].includes(I(t))?"y":"x"}function Dt(t){return ee(H(t))}function _e(t,e,o){o===void 0&&(o=!1);const n=rt(t),r=Dt(t),s=kt(r);let i=r==="x"?n===(o?"end":"start")?"right":"left":n==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(i=ft(i)),[i,ft(i)]}function je(t){const e=ft(t);return[Ot(t),e,Ot(e)]}function Ot(t){return t.replace(/start|end/g,e=>ze[e])}function Ie(t,e,o){const n=["left","right"],r=["right","left"],s=["top","bottom"],i=["bottom","top"];switch(t){case"top":case"bottom":return o?e?r:n:e?n:r;case"left":case"right":return e?s:i;default:return[]}}function qe(t,e,o,n){const r=rt(t);let s=Ie(I(t),o==="start",n);return r&&(s=s.map(i=>i+"-"+r),e&&(s=s.concat(s.map(Ot)))),s}function ft(t){return t.replace(/left|right|bottom|top/g,e=>Be[e])}function Ye(t){return{top:0,right:0,bottom:0,left:0,...t}}function ne(t){return typeof t!="number"?Ye(t):{top:t,right:t,bottom:t,left:t}}function ht(t){const{x:e,y:o,width:n,height:r}=t;return{width:n,height:r,top:o,left:e,right:e+n,bottom:o+r,x:e,y:o}}function Ut(t,e,o){let{reference:n,floating:r}=t;const s=H(e),i=Dt(e),c=kt(i),a=I(e),u=s==="y",d=n.x+n.width/2-r.width/2,h=n.y+n.height/2-r.height/2,m=n[c]/2-r[c]/2;let f;switch(a){case"top":f={x:d,y:n.y-r.height};break;case"bottom":f={x:d,y:n.y+n.height};break;case"right":f={x:n.x+n.width,y:h};break;case"left":f={x:n.x-r.width,y:h};break;default:f={x:n.x,y:n.y}}switch(rt(e)){case"start":f[i]-=m*(o&&u?-1:1);break;case"end":f[i]+=m*(o&&u?-1:1);break}return f}const Xe=async(t,e,o)=>{const{placement:n="bottom",strategy:r="absolute",middleware:s=[],platform:i}=o,c=s.filter(Boolean),a=await(i.isRTL==null?void 0:i.isRTL(e));let u=await i.getElementRects({reference:t,floating:e,strategy:r}),{x:d,y:h}=Ut(u,n,a),m=n,f={},g=0;for(let y=0;y<c.length;y++){const{name:w,fn:p}=c[y],{x,y:v,data:b,reset:R}=await p({x:d,y:h,initialPlacement:n,placement:m,strategy:r,middlewareData:f,rects:u,platform:i,elements:{reference:t,floating:e}});d=x??d,h=v??h,f={...f,[w]:{...f[w],...b}},R&&g<=50&&(g++,typeof R=="object"&&(R.placement&&(m=R.placement),R.rects&&(u=R.rects===!0?await i.getElementRects({reference:t,floating:e,strategy:r}):R.rects),{x:d,y:h}=Ut(u,m,a)),y=-1)}return{x:d,y:h,placement:m,strategy:r,middlewareData:f}};async function oe(t,e){var o;e===void 0&&(e={});const{x:n,y:r,platform:s,rects:i,elements:c,strategy:a}=t,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:h="floating",altBoundary:m=!1,padding:f=0}=ot(e,t),g=ne(f),w=c[m?h==="floating"?"reference":"floating":h],p=ht(await s.getClippingRect({element:(o=await(s.isElement==null?void 0:s.isElement(w)))==null||o?w:w.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(c.floating)),boundary:u,rootBoundary:d,strategy:a})),x=h==="floating"?{x:n,y:r,width:i.floating.width,height:i.floating.height}:i.reference,v=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c.floating)),b=await(s.isElement==null?void 0:s.isElement(v))?await(s.getScale==null?void 0:s.getScale(v))||{x:1,y:1}:{x:1,y:1},R=ht(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:x,offsetParent:v,strategy:a}):x);return{top:(p.top-R.top+g.top)/b.y,bottom:(R.bottom-p.bottom+g.bottom)/b.y,left:(p.left-R.left+g.left)/b.x,right:(R.right-p.right+g.right)/b.x}}const Je=t=>({name:"arrow",options:t,async fn(e){const{x:o,y:n,placement:r,rects:s,platform:i,elements:c,middlewareData:a}=e,{element:u,padding:d=0}=ot(t,e)||{};if(u==null)return{};const h=ne(d),m={x:o,y:n},f=Dt(r),g=kt(f),y=await i.getDimensions(u),w=f==="y",p=w?"top":"left",x=w?"bottom":"right",v=w?"clientHeight":"clientWidth",b=s.reference[g]+s.reference[f]-m[f]-s.floating[g],R=m[f]-s.reference[f],S=await(i.getOffsetParent==null?void 0:i.getOffsetParent(u));let O=S?S[v]:0;(!O||!await(i.isElement==null?void 0:i.isElement(S)))&&(O=c.floating[v]||s.floating[g]);const K=b/2-R/2,M=O/2-y[g]/2-1,L=J(h[p],M),B=J(h[x],M),z=L,Z=O-y[g]-B,A=O/2-y[g]/2+K,_=bt(z,A,Z),N=!a.arrow&&rt(r)!=null&&A!==_&&s.reference[g]/2-(A<z?L:B)-y[g]/2<0,T=N?A<z?A-z:A-Z:0;return{[f]:m[f]+T,data:{[f]:_,centerOffset:A-_-T,...N&&{alignmentOffset:T}},reset:N}}}),Ge=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var o,n;const{placement:r,middlewareData:s,rects:i,initialPlacement:c,platform:a,elements:u}=e,{mainAxis:d=!0,crossAxis:h=!0,fallbackPlacements:m,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:y=!0,...w}=ot(t,e);if((o=s.arrow)!=null&&o.alignmentOffset)return{};const p=I(r),x=H(c),v=I(c)===c,b=await(a.isRTL==null?void 0:a.isRTL(u.floating)),R=m||(v||!y?[ft(c)]:je(c)),S=g!=="none";!m&&S&&R.push(...qe(c,y,g,b));const O=[c,...R],K=await oe(e,w),M=[];let L=((n=s.flip)==null?void 0:n.overflows)||[];if(d&&M.push(K[p]),h){const A=_e(r,i,b);M.push(K[A[0]],K[A[1]])}if(L=[...L,{placement:r,overflows:M}],!M.every(A=>A<=0)){var B,z;const A=(((B=s.flip)==null?void 0:B.index)||0)+1,_=O[A];if(_&&(!(h==="alignment"?x!==H(_):!1)||L.every(k=>k.overflows[0]>0&&H(k.placement)===x)))return{data:{index:A,overflows:L},reset:{placement:_}};let N=(z=L.filter(T=>T.overflows[0]<=0).sort((T,k)=>T.overflows[1]-k.overflows[1])[0])==null?void 0:z.placement;if(!N)switch(f){case"bestFit":{var Z;const T=(Z=L.filter(k=>{if(S){const U=H(k.placement);return U===x||U==="y"}return!0}).map(k=>[k.placement,k.overflows.filter(U=>U>0).reduce((U,be)=>U+be,0)]).sort((k,U)=>k[1]-U[1])[0])==null?void 0:Z[0];T&&(N=T);break}case"initialPlacement":N=c;break}if(r!==N)return{reset:{placement:N}}}return{}}}};async function Qe(t,e){const{placement:o,platform:n,elements:r}=t,s=await(n.isRTL==null?void 0:n.isRTL(r.floating)),i=I(o),c=rt(o),a=H(o)==="y",u=["left","top"].includes(i)?-1:1,d=s&&a?-1:1,h=ot(e,t);let{mainAxis:m,crossAxis:f,alignmentAxis:g}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return c&&typeof g=="number"&&(f=c==="end"?g*-1:g),a?{x:f*d,y:m*u}:{x:m*u,y:f*d}}const Ze=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var o,n;const{x:r,y:s,placement:i,middlewareData:c}=e,a=await Qe(e,t);return i===((o=c.offset)==null?void 0:o.placement)&&(n=c.arrow)!=null&&n.alignmentOffset?{}:{x:r+a.x,y:s+a.y,data:{...a,placement:i}}}}},tn=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:o,y:n,placement:r}=e,{mainAxis:s=!0,crossAxis:i=!1,limiter:c={fn:w=>{let{x:p,y:x}=w;return{x:p,y:x}}},...a}=ot(t,e),u={x:o,y:n},d=await oe(e,a),h=H(I(r)),m=ee(h);let f=u[m],g=u[h];if(s){const w=m==="y"?"top":"left",p=m==="y"?"bottom":"right",x=f+d[w],v=f-d[p];f=bt(x,f,v)}if(i){const w=h==="y"?"top":"left",p=h==="y"?"bottom":"right",x=g+d[w],v=g-d[p];g=bt(x,g,v)}const y=c.fn({...e,[m]:f,[h]:g});return{...y,data:{x:y.x-o,y:y.y-n,enabled:{[m]:s,[h]:i}}}}}};function pt(){return typeof window<"u"}function Q(t){return re(t)?(t.nodeName||"").toLowerCase():"#document"}function P(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function V(t){var e;return(e=(re(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function re(t){return pt()?t instanceof Node||t instanceof P(t).Node:!1}function D(t){return pt()?t instanceof Element||t instanceof P(t).Element:!1}function F(t){return pt()?t instanceof HTMLElement||t instanceof P(t).HTMLElement:!1}function Ht(t){return!pt()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof P(t).ShadowRoot}function st(t){const{overflow:e,overflowX:o,overflowY:n,display:r}=W(t);return/auto|scroll|overlay|hidden|clip/.test(e+n+o)&&!["inline","contents"].includes(r)}function en(t){return["table","td","th"].includes(Q(t))}function yt(t){return[":popover-open",":modal"].some(e=>{try{return t.matches(e)}catch{return!1}})}function Wt(t){const e=Ct(),o=D(t)?W(t):t;return["transform","translate","scale","rotate","perspective"].some(n=>o[n]?o[n]!=="none":!1)||(o.containerType?o.containerType!=="normal":!1)||!e&&(o.backdropFilter?o.backdropFilter!=="none":!1)||!e&&(o.filter?o.filter!=="none":!1)||["transform","translate","scale","rotate","perspective","filter"].some(n=>(o.willChange||"").includes(n))||["paint","layout","strict","content"].some(n=>(o.contain||"").includes(n))}function nn(t){let e=$(t);for(;F(e)&&!G(e);){if(Wt(e))return e;if(yt(e))return null;e=$(e)}return null}function Ct(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function G(t){return["html","body","#document"].includes(Q(t))}function W(t){return P(t).getComputedStyle(t)}function wt(t){return D(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function $(t){if(Q(t)==="html")return t;const e=t.assignedSlot||t.parentNode||Ht(t)&&t.host||V(t);return Ht(e)?e.host:e}function se(t){const e=$(t);return G(e)?t.ownerDocument?t.ownerDocument.body:t.body:F(e)&&st(e)?e:se(e)}function et(t,e,o){var n;e===void 0&&(e=[]),o===void 0&&(o=!0);const r=se(t),s=r===((n=t.ownerDocument)==null?void 0:n.body),i=P(r);if(s){const c=At(i);return e.concat(i,i.visualViewport||[],st(r)?r:[],c&&o?et(c):[])}return e.concat(r,et(r,[],o))}function At(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function ie(t){const e=W(t);let o=parseFloat(e.width)||0,n=parseFloat(e.height)||0;const r=F(t),s=r?t.offsetWidth:o,i=r?t.offsetHeight:n,c=ut(o)!==s||ut(n)!==i;return c&&(o=s,n=i),{width:o,height:n,$:c}}function Ft(t){return D(t)?t:t.contextElement}function X(t){const e=Ft(t);if(!F(e))return C(1);const o=e.getBoundingClientRect(),{width:n,height:r,$:s}=ie(e);let i=(s?ut(o.width):o.width)/n,c=(s?ut(o.height):o.height)/r;return(!i||!Number.isFinite(i))&&(i=1),(!c||!Number.isFinite(c))&&(c=1),{x:i,y:c}}const on=C(0);function ce(t){const e=P(t);return!Ct()||!e.visualViewport?on:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function rn(t,e,o){return e===void 0&&(e=!1),!o||e&&o!==P(t)?!1:e}function q(t,e,o,n){e===void 0&&(e=!1),o===void 0&&(o=!1);const r=t.getBoundingClientRect(),s=Ft(t);let i=C(1);e&&(n?D(n)&&(i=X(n)):i=X(t));const c=rn(s,o,n)?ce(s):C(0);let a=(r.left+c.x)/i.x,u=(r.top+c.y)/i.y,d=r.width/i.x,h=r.height/i.y;if(s){const m=P(s),f=n&&D(n)?P(n):n;let g=m,y=At(g);for(;y&&n&&f!==g;){const w=X(y),p=y.getBoundingClientRect(),x=W(y),v=p.left+(y.clientLeft+parseFloat(x.paddingLeft))*w.x,b=p.top+(y.clientTop+parseFloat(x.paddingTop))*w.y;a*=w.x,u*=w.y,d*=w.x,h*=w.y,a+=v,u+=b,g=P(y),y=At(g)}}return ht({width:d,height:h,x:a,y:u})}function Vt(t,e){const o=wt(t).scrollLeft;return e?e.left+o:q(V(t)).left+o}function ae(t,e,o){o===void 0&&(o=!1);const n=t.getBoundingClientRect(),r=n.left+e.scrollLeft-(o?0:Vt(t,n)),s=n.top+e.scrollTop;return{x:r,y:s}}function sn(t){let{elements:e,rect:o,offsetParent:n,strategy:r}=t;const s=r==="fixed",i=V(n),c=e?yt(e.floating):!1;if(n===i||c&&s)return o;let a={scrollLeft:0,scrollTop:0},u=C(1);const d=C(0),h=F(n);if((h||!h&&!s)&&((Q(n)!=="body"||st(i))&&(a=wt(n)),F(n))){const f=q(n);u=X(n),d.x=f.x+n.clientLeft,d.y=f.y+n.clientTop}const m=i&&!h&&!s?ae(i,a,!0):C(0);return{width:o.width*u.x,height:o.height*u.y,x:o.x*u.x-a.scrollLeft*u.x+d.x+m.x,y:o.y*u.y-a.scrollTop*u.y+d.y+m.y}}function cn(t){return Array.from(t.getClientRects())}function an(t){const e=V(t),o=wt(t),n=t.ownerDocument.body,r=j(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),s=j(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let i=-o.scrollLeft+Vt(t);const c=-o.scrollTop;return W(n).direction==="rtl"&&(i+=j(e.clientWidth,n.clientWidth)-r),{width:r,height:s,x:i,y:c}}function ln(t,e){const o=P(t),n=V(t),r=o.visualViewport;let s=n.clientWidth,i=n.clientHeight,c=0,a=0;if(r){s=r.width,i=r.height;const u=Ct();(!u||u&&e==="fixed")&&(c=r.offsetLeft,a=r.offsetTop)}return{width:s,height:i,x:c,y:a}}function un(t,e){const o=q(t,!0,e==="fixed"),n=o.top+t.clientTop,r=o.left+t.clientLeft,s=F(t)?X(t):C(1),i=t.clientWidth*s.x,c=t.clientHeight*s.y,a=r*s.x,u=n*s.y;return{width:i,height:c,x:a,y:u}}function $t(t,e,o){let n;if(e==="viewport")n=ln(t,o);else if(e==="document")n=an(V(t));else if(D(e))n=un(e,o);else{const r=ce(t);n={x:e.x-r.x,y:e.y-r.y,width:e.width,height:e.height}}return ht(n)}function le(t,e){const o=$(t);return o===e||!D(o)||G(o)?!1:W(o).position==="fixed"||le(o,e)}function fn(t,e){const o=e.get(t);if(o)return o;let n=et(t,[],!1).filter(c=>D(c)&&Q(c)!=="body"),r=null;const s=W(t).position==="fixed";let i=s?$(t):t;for(;D(i)&&!G(i);){const c=W(i),a=Wt(i);!a&&c.position==="fixed"&&(r=null),(s?!a&&!r:!a&&c.position==="static"&&!!r&&["absolute","fixed"].includes(r.position)||st(i)&&!a&&le(t,i))?n=n.filter(d=>d!==i):r=c,i=$(i)}return e.set(t,n),n}function hn(t){let{element:e,boundary:o,rootBoundary:n,strategy:r}=t;const i=[...o==="clippingAncestors"?yt(e)?[]:fn(e,this._c):[].concat(o),n],c=i[0],a=i.reduce((u,d)=>{const h=$t(e,d,r);return u.top=j(h.top,u.top),u.right=J(h.right,u.right),u.bottom=J(h.bottom,u.bottom),u.left=j(h.left,u.left),u},$t(e,c,r));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function dn(t){const{width:e,height:o}=ie(t);return{width:e,height:o}}function mn(t,e,o){const n=F(e),r=V(e),s=o==="fixed",i=q(t,!0,s,e);let c={scrollLeft:0,scrollTop:0};const a=C(0);function u(){a.x=Vt(r)}if(n||!n&&!s)if((Q(e)!=="body"||st(r))&&(c=wt(e)),n){const f=q(e,!0,s,e);a.x=f.x+e.clientLeft,a.y=f.y+e.clientTop}else r&&u();s&&!n&&r&&u();const d=r&&!n&&!s?ae(r,c):C(0),h=i.left+c.scrollLeft-a.x-d.x,m=i.top+c.scrollTop-a.y-d.y;return{x:h,y:m,width:i.width,height:i.height}}function xt(t){return W(t).position==="static"}function Kt(t,e){if(!F(t)||W(t).position==="fixed")return null;if(e)return e(t);let o=t.offsetParent;return V(t)===o&&(o=o.ownerDocument.body),o}function ue(t,e){const o=P(t);if(yt(t))return o;if(!F(t)){let r=$(t);for(;r&&!G(r);){if(D(r)&&!xt(r))return r;r=$(r)}return o}let n=Kt(t,e);for(;n&&en(n)&&xt(n);)n=Kt(n,e);return n&&G(n)&&xt(n)&&!Wt(n)?o:n||nn(t)||o}const gn=async function(t){const e=this.getOffsetParent||ue,o=this.getDimensions,n=await o(t.floating);return{reference:mn(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function pn(t){return W(t).direction==="rtl"}const yn={convertOffsetParentRelativeRectToViewportRelativeRect:sn,getDocumentElement:V,getClippingRect:hn,getOffsetParent:ue,getElementRects:gn,getClientRects:cn,getDimensions:dn,getScale:X,isElement:D,isRTL:pn};function fe(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function wn(t,e){let o=null,n;const r=V(t);function s(){var c;clearTimeout(n),(c=o)==null||c.disconnect(),o=null}function i(c,a){c===void 0&&(c=!1),a===void 0&&(a=1),s();const u=t.getBoundingClientRect(),{left:d,top:h,width:m,height:f}=u;if(c||e(),!m||!f)return;const g=ct(h),y=ct(r.clientWidth-(d+m)),w=ct(r.clientHeight-(h+f)),p=ct(d),v={rootMargin:-g+"px "+-y+"px "+-w+"px "+-p+"px",threshold:j(0,J(1,a))||1};let b=!0;function R(S){const O=S[0].intersectionRatio;if(O!==a){if(!b)return i();O?i(!1,O):n=setTimeout(()=>{i(!1,1e-7)},1e3)}O===1&&!fe(u,t.getBoundingClientRect())&&i(),b=!1}try{o=new IntersectionObserver(R,{...v,root:r.ownerDocument})}catch{o=new IntersectionObserver(R,v)}o.observe(t)}return i(!0),s}function vn(t,e,o,n){n===void 0&&(n={});const{ancestorScroll:r=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:a=!1}=n,u=Ft(t),d=r||s?[...u?et(u):[],...et(e)]:[];d.forEach(p=>{r&&p.addEventListener("scroll",o,{passive:!0}),s&&p.addEventListener("resize",o)});const h=u&&c?wn(u,o):null;let m=-1,f=null;i&&(f=new ResizeObserver(p=>{let[x]=p;x&&x.target===u&&f&&(f.unobserve(e),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var v;(v=f)==null||v.observe(e)})),o()}),u&&!a&&f.observe(u),f.observe(e));let g,y=a?q(t):null;a&&w();function w(){const p=q(t);y&&!fe(y,p)&&o(),y=p,g=requestAnimationFrame(w)}return o(),()=>{var p;d.forEach(x=>{r&&x.removeEventListener("scroll",o),s&&x.removeEventListener("resize",o)}),h==null||h(),(p=f)==null||p.disconnect(),f=null,a&&cancelAnimationFrame(g)}}const xn=Ze,Rn=tn,Bt=Ge,bn=Je,On=(t,e,o)=>{const n=new Map,r={platform:yn,...o},s={...r.platform,_c:n};return Xe(t,e,{...r,platform:s})},An=["top","top-start","top-end","right","right-start","right-end","bottom","bottom-start","bottom-end","left","left-start","left-end"],En=(t,e={isOpen:!1})=>{const o=[];let n=null;const r=l.Value.deriveProp(e.isOpen);function s(c){n=c,r.set(!0)}function i(){r.set(!1),o.forEach(c=>c()),o.length=0}return l.Fragment(t(s,i),l.When(r,()=>l.WithElement(c=>l.Portal("body",l.html.div(l.WithElement(a=>{a.style.position="absolute";const u=typeof(n==null?void 0:n.target)=="string"?c.querySelector(n.target):(n==null?void 0:n.target)??c;if(u==null)throw new Error(`Target not found: ${n==null?void 0:n.target}`);let d=null;const h=l.Value.toSignal((n==null?void 0:n.mainAxisOffset)??0),m=l.Value.toSignal((n==null?void 0:n.crossAxisOffset)??0),f=l.Value.toSignal((n==null?void 0:n.placement)??"top"),g=l.Value.toSignal((n==null?void 0:n.arrowPadding)??0),y=n==null?void 0:n.arrow,w=l.prop({centerOffset:0,alignmentOffset:0,containerWidth:0,containerHeight:0,x:void 0,y:void 0});async function p(){const v=[Bt(),xn({mainAxis:h.get(),crossAxis:m.get()}),Rn(),Bt()];y!=null&&d!=null&&v.push(bn({element:d,padding:g.get()}));const b=await On(u,a,{placement:f.get(),strategy:"absolute",middleware:v}),{x:R,y:S,middlewareData:O}=b;if(a.style.top=`${S}px`,a.style.left=`${R}px`,d!=null&&O.arrow!=null){const{x:K,y:M,centerOffset:L,alignmentOffset:B}=O.arrow;w.set({x:K,y:M,centerOffset:L,alignmentOffset:B,containerWidth:a.offsetWidth,containerHeight:a.offsetHeight})}}const x=l.effectOf(h,m,f)(p);return l.Fragment(n==null?void 0:n.content,(n==null?void 0:n.arrow)!=null?l.html.div(n==null?void 0:n.arrow(l.computedOf(w,f)((v,b)=>({...v,placement:b}))),l.WithElement(v=>{d=v,p()})):null,l.OnDispose(w.dispose,vn(u,a,p),x))}))))))},he=(t,e,o)=>{const n=l.prop(E.AsyncResult.notAsked),r=n.map(h=>E.AsyncResult.isSuccess(h)?h.value:void 0),s=n.map(h=>E.AsyncResult.isFailure(h)?h.error:void 0),i=n.map(h=>E.AsyncResult.isLoading(h));let c;const a=async h=>{c==null||c.abort(),c=new AbortController;const m=c.signal,f=n.get();n.set(E.AsyncResult.loading(E.AsyncResult.getOrUndefined(f)));try{const g=await e({request:h,abortSignal:m,previous:f});await Promise.resolve(),c=void 0,n.set(E.AsyncResult.success(g))}catch(g){c=void 0,n.set(E.AsyncResult.failure(o(g)))}},u=()=>a(l.Value.get(t)),d=()=>{c==null||c.abort(),c=void 0,n.dispose()};return n.onDispose(l.Value.on(t,a)),{status:n,value:r,error:s,loading:i,reload:u,dispose:d}},de=(t,e)=>{const{status:o,dispose:n,reload:r}=t,{loading:s,failure:i,success:c}=e;return l.Fragment(l.OnDispose(n),Lt(o,{loading:s!=null?a=>s(a,r):void 0,failure:i!=null?a=>i(a,r):void 0,success:a=>c(a,r)}))},Pn=({request:t,load:e,mapError:o=n=>n})=>{const n=he(t,e,o);return r=>de(n,r)},me=(t,e)=>{if(typeof e=="function")return me(t,{success:e});const o=e.failure??(r=>l.Fragment(l.OnDispose(r.on(console.error)),r.map(s=>`Error: ${s}`))),n=e.success;return l.OneOfType(l.Value.toSignal(t),{Success:r=>n(r.$.value),Failure:r=>o(r.$.error)})},Sn=()=>l.on.focus(t=>{var e;return(e=t.target)==null?void 0:e.select()});class it{constructor(e,o,n,r){vt(this,"equals",e=>E.nearEqual(this.left,e.left)&&E.nearEqual(this.top,e.top)&&E.nearEqual(this.width,e.width)&&E.nearEqual(this.height,e.height));this.left=e,this.top=o,this.width=n,this.height=r}static of({left:e=0,top:o=0,width:n=0,height:r=0}){return new it(e,o,n,r)}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 Et(t){const e=t.getBoundingClientRect();return it.of({top:e.top+window.scrollY,left:e.left+window.scrollX,width:e.width,height:e.height})}const Ln=t=>l.WithBrowserCtx(e=>{const{element:o}=e,n=l.prop(Et(o),(c,a)=>c.equals(a)),r=l.renderableOfTNode(t(n))(e),s=()=>n.set(it.of(Et(o)));let i=null;return typeof ResizeObserver<"u"&&(i=new ResizeObserver(s)),i==null||i.observe(o),l.OnDispose(c=>{i==null||i.disconnect(),r(c)})});function zt(t){return{width:(t==null?void 0:t.innerWidth)??0,height:(t==null?void 0:t.innerHeight)??0}}const Tn=t=>e=>{const o=l.getWindow(),n=l.prop(zt(o),(i,c)=>i.width===c.width&&i.height===c.height),r=l.renderableOfTNode(t(n))(e),s=()=>n.set(zt(o));return o==null||o.addEventListener("resize",s),i=>{o==null||o.removeEventListener("resize",s),r(i)}},ge=(t,e)=>{const o=e.split("/").filter(r=>r!==""),n={};for(let r=0;r<t.length;r++){const s=t[r],i=o[r];if(!i&&s.type!=="catch-all")return null;if(s.type==="literal"){if(s.value!==i)return null}else if(s.type==="param")n[s.name]=i;else if(s.type==="catch-all")return{params:n,path:e}}return o.length!==t.length?null:{params:n,path:e}},Mt=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!==""),kn=t=>{const e=t.map(o=>{const n=Mt(o);return{route:o,segments:n}});return function(n){for(const{segments:r,route:s}of e){const i=ge(r,n);if(i)return{...i,route:s}}return null}},dt={mark:l.makeProviderMark("RouterContext"),create:()=>{const t=l.prop([]);return{value:t,dispose:()=>t.dispose()}}},Dn=(t,e,o)=>{const n=o.split("/").filter(i=>i!==""),r={};let s=0;for(let i=0;i<t.length;i++){const c=t[i],a=n[i];if(!a&&c.type!=="catch-all")return null;if(c.type==="literal"){if(c.value!==a)return null;s++}else if(c.type==="param")r[c.name]=a,s++;else if(c.type==="catch-all"){const u="/"+n.slice(0,s).join("/"),d="/"+n.slice(s).join("/");return{params:r,matchedPath:u==="/"?"":u,remainingPath:d==="/"?"":d,route:e}}}if(n.length===t.length){const i="/"+n.join("/");return{params:r,matchedPath:i==="/"?"":i,remainingPath:"",route:e}}return null},pe=t=>{const e=t.map(o=>{const n=Mt(o);return{route:o,segments:n}});return function(n){for(const{segments:r,route:s}of e){const i=Dn(r,s,n);if(i)return i}return null}},Wn=t=>{const e=pe(Object.keys(t));return l.Provide(dt,{},()=>l.Use(gt,o=>l.Use(dt,n=>{const r=o.map(s=>{const i=e(s.pathname);if(i==null)throw console.error("No route found for",s),new Error("No route found");const c={matchedPath:i.matchedPath,remainingPath:i.remainingPath,fullPath:s.pathname,params:i.params};return n.value=[...n.value,c],{params:i.params,route:i.route,path:i.matchedPath||s.pathname,search:s.search,hash:s.hash}});return l.OneOfTuple(r.map(s=>[s.route,s]),t)})))},Cn=t=>{const e=pe(Object.keys(t));return l.Use(dt,o=>l.Use(gt,n=>{const r=o.map(s=>{const i=s[s.length-1],c=(i==null?void 0:i.remainingPath)||"";if(c==="")throw console.error("No remaining path for SubRouter",s),new Error("No remaining path for SubRouter");const a=e(c);if(a==null)throw console.error("No route found for remaining path",c),new Error("No route found");const d={...s.reduce((m,f)=>({...m,...f.params}),{}),...a.params},h={matchedPath:a.matchedPath,remainingPath:a.remainingPath,fullPath:(i==null?void 0:i.fullPath)||c,params:d};return o.value=[...s,h],{params:d,route:a.route,path:a.matchedPath,search:n.value.search,hash:n.value.hash}});return l.OneOfTuple(r.map(s=>[s.route,s]),t)}))},mt=60*1e3,Pt=60*mt,nt=24*Pt,_t=7*nt,jt=30*nt,Fn=365*nt,Vn=[{max:mt*90,value:mt,name:"minute",past:{singular:"a minute ago",plural:"{} minutes ago"},future:{singular:"in a minute",plural:"in {} minutes"}},{max:Pt*36,value:Pt,name:"hour",past:{singular:"an hour ago",plural:"{} hours ago"},future:{singular:"in an hour",plural:"in {} hours"}},{max:nt*10,value:nt,name:"day",past:{singular:"yesterday",plural:"{} days ago"},future:{singular:"tomorrow",plural:"in {} days"}},{max:_t*6,value:_t,name:"week",past:{singular:"last week",plural:"{} weeks ago"},future:{singular:"in a week",plural:"in {} weeks"}},{max:jt*18,value:jt,name:"month",past:{singular:"last month",plural:"{} months ago"},future:{singular:"in a month",plural:"in {} months"}},{max:1/0,value:Fn,name:"year",past:{singular:"last year",plural:"{} years ago"},future:{singular:"in a year",plural:"in {} years"}}];function It(t,e,o,n){const r=Math.round(t/e);return r<=1?o:n.replace("{}",r.toLocaleString(void 0,{maximumFractionDigits:0,minimumFractionDigits:0}))}const ye=(t=1e3)=>{const e=l.prop(new Date),o=E.interval(()=>e.set(new Date),t);return e.onDispose(o),e},we=t=>{const e=Math.abs(t);if(e<mt)return t<0?"just now":"in a moment";for(const o of Vn)if(e<o.max)return t<0?It(e,o.value,o.past.singular,o.past.plural):It(e,o.value,o.future.singular,o.future.plural);throw new Error("unreachable")},ve=(t,{now:e,frequency:o=1e4}={})=>{const n=e!=null?l.Signal.is(e)?e.derive():l.prop(e):ye(o),r=l.computedOf(t,n)((s,i)=>s.getTime()-i.getTime());return r.onDispose(()=>l.Value.dispose(n)),r},xe=(t,e={})=>{const o=ve(t,e),n=o.map(we);return n.onDispose(o.dispose),n},Mn=(t,e={})=>xe(t,e);class Re extends l.Prop{constructor(){super(...arguments);vt(this,"tick",()=>this.update(o=>o+1))}}const Nn=(t=0)=>new Re(t,(e,o)=>e===o);exports.Anchor=Gt;exports.Appearance=De;exports.AsyncResultView=Lt;exports.AutoFocus=We;exports.AutoSelect=Ce;exports.ChildRouter=Cn;exports.ElementRect=Ln;exports.HTMLTitle=Ve;exports.HiddenWhenEmpty=Fe;exports.InViewport=Zt;exports.Location=gt;exports.OnClickOutside=He;exports.OnEnterKey=$e;exports.OnEscapeKey=Ke;exports.OnKeyPressed=Tt;exports.PopOver=En;exports.Rect=it;exports.Resource=Pn;exports.ResourceDisplay=de;exports.ResultView=me;exports.RootRouter=Wn;exports.RouterContextProvider=dt;exports.SelectOnFocus=Sn;exports.Ticker=Re;exports.WhenInViewport=Ue;exports.WindowSize=Tn;exports._checkExtensionCondition=Yt;exports._getExtension=qt;exports._makeRouteMatcher=kn;exports._parseRouteSegments=Mt;exports.allPlacements=An;exports.areLocationsEqual=Jt;exports.getAbsoluteRect=Et;exports.handleAnchorClick=Xt;exports.locationFromURL=St;exports.makeResource=he;exports.matchesKeyCombo=te;exports.matchesRoute=ge;exports.nowSignal=ye;exports.relativeTime=Mn;exports.relativeTimeMillisSignal=ve;exports.relativeTimeSignal=xe;exports.setLocationFromUrl=Rt;exports.ticker=Nn;exports.timeDiffToString=we;exports.urlFromLocation=lt;exports.useAppearance=Qt;
1
+ "use strict";var Oe=Object.defineProperty;var Ae=(t,e,o)=>e in t?Oe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o;var vt=(t,e,o)=>Ae(t,typeof e!="symbol"?e+"":e,o);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("@tempots/dom"),E=require("@tempots/std"),qt=t=>{const e=t.split("/").pop();if(e==null||e.startsWith("."))return;const o=e.split(".")||[];return o.length>1?"."+o.pop():void 0},Yt=(t,e)=>{const o=qt(e);return o!=null&&(t.length===0||!t.some(n=>o==n))},Ee=(t,e,o,n)=>{let r=t.target;for(;r!=null&&!(r instanceof HTMLAnchorElement);)r=r.parentElement;if(r==null)return!0;const s=r;if(t.button!==0||t.ctrlKey||t.metaKey||s.target!=="_self"&&s.target!==""||s.getAttribute("download")!=null)return!0;const{pathname:i,search:c,hash:a}=s;if(n){const u=i+c+a,d=s.getAttribute("href");if(!(d!=null&&d.startsWith("#"))&&d!==u)return!0}return e?!1:Yt(o,i)},Xt=(t,e={ignoreUrlWithExtension:!0,allowedExtensions:[],ignoreExternalUrl:!0})=>{const o=e.ignoreUrlWithExtension===!0&&Array.isArray(e.allowedExtensions)?e.allowedExtensions.map(n=>n.startsWith(".")?n:"."+n):[];return n=>{Ee(n,e.ignoreUrlWithExtension??!0,o,e.ignoreExternalUrl??!0)||t()&&n.preventDefault()}},Jt=(t,e)=>t.pathname===e.pathname&&JSON.stringify(t.search)===JSON.stringify(e.search)&&t.hash===e.hash,St=(t,e)=>{var s,i;const o=new URL(t,e??((s=l.getWindow())==null?void 0:s.location.toString())),n=Object.fromEntries(((i=o.searchParams)==null?void 0:i.entries())??[]);let r=o.hash;return r.startsWith("#")&&(r=r.substring(1)),{pathname:o.pathname,search:n,hash:r===""?void 0:r}},Rt=(t,e)=>{const o=St(e);return t.set(o),t},lt=t=>{const o=new URLSearchParams(t.search).toString(),n=t.hash;return`${t.pathname}${o?`?${o}`:""}${n?`#${n}`:""}`},Pe=t=>t.startsWith("http://")||t.startsWith("https://")||t.startsWith("//"),Se=t=>{const e=t.container.currentURL,o=e.iso(n=>St(n),n=>{if(Pe(n.pathname))return lt(n);const r=new URL(n.pathname,e.value),s=r.origin+r.pathname;return lt({...n,pathname:s})});return{value:o,dispose:o.dispose}},Le=()=>{const t=l.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}},Te=()=>{const t=l.prop(Le(),Jt),e=l.getWindow(),o=()=>{let n=(e==null?void 0:e.location.hash)??"";n.startsWith("#")&&(n=n.substring(1));const r={pathname:(e==null?void 0:e.location.pathname)??"",search:Object.fromEntries(new URLSearchParams((e==null?void 0:e.location.search)??"").entries()),hash:n===""?void 0:n};t.set(r)};return e==null||e.addEventListener("popstate",o),t.onDispose(()=>{e==null||e.removeEventListener("popstate",o)}),t.on(n=>{e==null||e.history.pushState({},"",lt(n))}),{value:t,dispose:t.dispose}},gt={mark:l.makeProviderMark("Location"),create:(t,e)=>{if(e.isBrowser())return Te();if(e.isHeadless())return Se(e);throw new Error("Unknown context")}},ke=t=>{document.startViewTransition?document.startViewTransition(t):t()},Gt=(t,...e)=>{if(typeof t=="string"||l.Signal.is(t))return Gt({href:t},...e);const{href:o,withViewTransition:n,...r}=t;return l.Use(gt,s=>l.html.a(l.on.click(Xt(()=>(n===!0?ke(()=>{Rt(s,l.Value.get(o))}):Rt(s,l.Value.get(o)),!0),r)),l.attr.href(o),...e))},De={mark:l.makeProviderMark("Appearance"),create:()=>{const t=Qt();return{value:t,dispose:t.dispose}}};function Qt(){const t=l.getWindow(),e=t!=null&&t.matchMedia!=null?t.matchMedia("(prefers-color-scheme: dark)"):void 0,o=(e==null?void 0:e.matches)??!1,n=l.prop(o?"dark":"light"),r=s=>n.set(s.matches?"dark":"light");return e==null||e.addEventListener("change",r),n.onDispose(()=>e==null?void 0:e.removeEventListener("change",r)),n}const Lt=(t,e)=>{if(typeof e=="function")return Lt(t,{success:e});const o=e.failure??(i=>i.map(c=>`Error: ${c}`)),n=e.success,r=e.loading??(()=>l.Empty),s=e.notAsked??(()=>l.Empty);return l.OneOfType(l.Value.toSignal(t),{AsyncSuccess:i=>n(i.$.value),AsyncFailure:i=>o(i.$.error),Loading:i=>r(i.map(c=>c.previousValue)),NotAsked:s})},We=(t=10)=>l.WithElement(e=>l.OnDispose(E.delayed(()=>e==null?void 0:e.focus(),t))),Ce=(t=10)=>l.WithElement(e=>{const o=E.delayed(()=>e.select(),t);return l.OnDispose(o)}),Fe=l.WithElement(t=>{const e=t.style.getPropertyValue(":empty");return t.style.setProperty(":empty","display:none"),l.OnDispose(o=>{o&&t.style.setProperty(":empty",e)})}),Ve=t=>l.Portal("head > title",l.attr.innerText(t)),Me={partial:{root:null,rootMargin:"0px",threshold:0},full:{root:null,rootMargin:"0px",threshold:1}},at={partial:new Map,full:new Map},tt={partial:null,full:null};function Ne(t){return tt[t]==null&&(tt[t]=new IntersectionObserver(e=>{e.forEach(o=>{const n=at[t].get(o.target);n==null||n.set(o.isIntersecting)})},Me[t])),tt[t]}const Zt=({mode:t="partial",once:e=!1},o)=>{const n=l.prop(!1);return l.Fragment(l.WithElement(r=>{const s=typeof IntersectionObserver<"u"?Ne(t):null;at[t].set(r,n),s==null||s.observe(r);function i(){var a;s==null||s.unobserve(r),at[t].delete(r),at[t].size===0&&((a=tt[t])==null||a.disconnect(),tt[t]=null)}let c=null;return e&&(c=n.on(a=>{a&&i()})),l.OnDispose(()=>{n.dispose(),i(),c==null||c()})}),l.renderableOfTNode(o(n)))},Ue=(t,e,o)=>Zt(t,n=>l.When(n,e,o??(()=>l.Empty)));function He(t){return l.WithElement(e=>{const o=n=>{e.contains(n.target)||t(n)};return document.addEventListener("click",o),l.OnDispose(()=>{document.removeEventListener("click",o)})})}const Y=(t,e)=>t===void 0||t===e,Nt=(t,e)=>t===void 0||t===e;function te(t,e){return typeof t=="string"?e.key===t:Nt(t.key,e.key)&&Nt(t.code,e.code)&&Y(t.ctrlKey,e.ctrlKey)&&Y(t.altKey,e.altKey)&&Y(t.shiftKey,e.shiftKey)&&Y(t.metaKey,e.metaKey)&&Y(t.repeat,e.repeat)&&Y(t.commandOrControlKey,e.metaKey||e.ctrlKey)}function Tt({allowedKeys:t,handler:e}){return l.WithElement(o=>{const n=r=>{if(o.contains(r.target)){for(const s of t)if(te(s,r)){e(r);break}}};return document.addEventListener("keydown",n),l.OnDispose(()=>{document.removeEventListener("keydown",n)})})}function $e(t){return Tt({allowedKeys:["Enter"],handler:t})}function Ke(t){return Tt({allowedKeys:["Escape"],handler:t})}const J=Math.min,j=Math.max,ut=Math.round,ct=Math.floor,C=t=>({x:t,y:t}),Be={left:"right",right:"left",bottom:"top",top:"bottom"},ze={start:"end",end:"start"};function bt(t,e,o){return j(t,J(e,o))}function ot(t,e){return typeof t=="function"?t(e):t}function I(t){return t.split("-")[0]}function rt(t){return t.split("-")[1]}function ee(t){return t==="x"?"y":"x"}function kt(t){return t==="y"?"height":"width"}function H(t){return["top","bottom"].includes(I(t))?"y":"x"}function Dt(t){return ee(H(t))}function _e(t,e,o){o===void 0&&(o=!1);const n=rt(t),r=Dt(t),s=kt(r);let i=r==="x"?n===(o?"end":"start")?"right":"left":n==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(i=ft(i)),[i,ft(i)]}function je(t){const e=ft(t);return[Ot(t),e,Ot(e)]}function Ot(t){return t.replace(/start|end/g,e=>ze[e])}function Ie(t,e,o){const n=["left","right"],r=["right","left"],s=["top","bottom"],i=["bottom","top"];switch(t){case"top":case"bottom":return o?e?r:n:e?n:r;case"left":case"right":return e?s:i;default:return[]}}function qe(t,e,o,n){const r=rt(t);let s=Ie(I(t),o==="start",n);return r&&(s=s.map(i=>i+"-"+r),e&&(s=s.concat(s.map(Ot)))),s}function ft(t){return t.replace(/left|right|bottom|top/g,e=>Be[e])}function Ye(t){return{top:0,right:0,bottom:0,left:0,...t}}function ne(t){return typeof t!="number"?Ye(t):{top:t,right:t,bottom:t,left:t}}function ht(t){const{x:e,y:o,width:n,height:r}=t;return{width:n,height:r,top:o,left:e,right:e+n,bottom:o+r,x:e,y:o}}function Ut(t,e,o){let{reference:n,floating:r}=t;const s=H(e),i=Dt(e),c=kt(i),a=I(e),u=s==="y",d=n.x+n.width/2-r.width/2,h=n.y+n.height/2-r.height/2,g=n[c]/2-r[c]/2;let f;switch(a){case"top":f={x:d,y:n.y-r.height};break;case"bottom":f={x:d,y:n.y+n.height};break;case"right":f={x:n.x+n.width,y:h};break;case"left":f={x:n.x-r.width,y:h};break;default:f={x:n.x,y:n.y}}switch(rt(e)){case"start":f[i]-=g*(o&&u?-1:1);break;case"end":f[i]+=g*(o&&u?-1:1);break}return f}const Xe=async(t,e,o)=>{const{placement:n="bottom",strategy:r="absolute",middleware:s=[],platform:i}=o,c=s.filter(Boolean),a=await(i.isRTL==null?void 0:i.isRTL(e));let u=await i.getElementRects({reference:t,floating:e,strategy:r}),{x:d,y:h}=Ut(u,n,a),g=n,f={},m=0;for(let y=0;y<c.length;y++){const{name:w,fn:p}=c[y],{x,y:v,data:b,reset:R}=await p({x:d,y:h,initialPlacement:n,placement:g,strategy:r,middlewareData:f,rects:u,platform:i,elements:{reference:t,floating:e}});d=x??d,h=v??h,f={...f,[w]:{...f[w],...b}},R&&m<=50&&(m++,typeof R=="object"&&(R.placement&&(g=R.placement),R.rects&&(u=R.rects===!0?await i.getElementRects({reference:t,floating:e,strategy:r}):R.rects),{x:d,y:h}=Ut(u,g,a)),y=-1)}return{x:d,y:h,placement:g,strategy:r,middlewareData:f}};async function oe(t,e){var o;e===void 0&&(e={});const{x:n,y:r,platform:s,rects:i,elements:c,strategy:a}=t,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:h="floating",altBoundary:g=!1,padding:f=0}=ot(e,t),m=ne(f),w=c[g?h==="floating"?"reference":"floating":h],p=ht(await s.getClippingRect({element:(o=await(s.isElement==null?void 0:s.isElement(w)))==null||o?w:w.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(c.floating)),boundary:u,rootBoundary:d,strategy:a})),x=h==="floating"?{x:n,y:r,width:i.floating.width,height:i.floating.height}:i.reference,v=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c.floating)),b=await(s.isElement==null?void 0:s.isElement(v))?await(s.getScale==null?void 0:s.getScale(v))||{x:1,y:1}:{x:1,y:1},R=ht(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:x,offsetParent:v,strategy:a}):x);return{top:(p.top-R.top+m.top)/b.y,bottom:(R.bottom-p.bottom+m.bottom)/b.y,left:(p.left-R.left+m.left)/b.x,right:(R.right-p.right+m.right)/b.x}}const Je=t=>({name:"arrow",options:t,async fn(e){const{x:o,y:n,placement:r,rects:s,platform:i,elements:c,middlewareData:a}=e,{element:u,padding:d=0}=ot(t,e)||{};if(u==null)return{};const h=ne(d),g={x:o,y:n},f=Dt(r),m=kt(f),y=await i.getDimensions(u),w=f==="y",p=w?"top":"left",x=w?"bottom":"right",v=w?"clientHeight":"clientWidth",b=s.reference[m]+s.reference[f]-g[f]-s.floating[m],R=g[f]-s.reference[f],S=await(i.getOffsetParent==null?void 0:i.getOffsetParent(u));let O=S?S[v]:0;(!O||!await(i.isElement==null?void 0:i.isElement(S)))&&(O=c.floating[v]||s.floating[m]);const K=b/2-R/2,M=O/2-y[m]/2-1,L=J(h[p],M),B=J(h[x],M),z=L,Z=O-y[m]-B,A=O/2-y[m]/2+K,_=bt(z,A,Z),N=!a.arrow&&rt(r)!=null&&A!==_&&s.reference[m]/2-(A<z?L:B)-y[m]/2<0,T=N?A<z?A-z:A-Z:0;return{[f]:g[f]+T,data:{[f]:_,centerOffset:A-_-T,...N&&{alignmentOffset:T}},reset:N}}}),Ge=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var o,n;const{placement:r,middlewareData:s,rects:i,initialPlacement:c,platform:a,elements:u}=e,{mainAxis:d=!0,crossAxis:h=!0,fallbackPlacements:g,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:y=!0,...w}=ot(t,e);if((o=s.arrow)!=null&&o.alignmentOffset)return{};const p=I(r),x=H(c),v=I(c)===c,b=await(a.isRTL==null?void 0:a.isRTL(u.floating)),R=g||(v||!y?[ft(c)]:je(c)),S=m!=="none";!g&&S&&R.push(...qe(c,y,m,b));const O=[c,...R],K=await oe(e,w),M=[];let L=((n=s.flip)==null?void 0:n.overflows)||[];if(d&&M.push(K[p]),h){const A=_e(r,i,b);M.push(K[A[0]],K[A[1]])}if(L=[...L,{placement:r,overflows:M}],!M.every(A=>A<=0)){var B,z;const A=(((B=s.flip)==null?void 0:B.index)||0)+1,_=O[A];if(_&&(!(h==="alignment"?x!==H(_):!1)||L.every(k=>k.overflows[0]>0&&H(k.placement)===x)))return{data:{index:A,overflows:L},reset:{placement:_}};let N=(z=L.filter(T=>T.overflows[0]<=0).sort((T,k)=>T.overflows[1]-k.overflows[1])[0])==null?void 0:z.placement;if(!N)switch(f){case"bestFit":{var Z;const T=(Z=L.filter(k=>{if(S){const U=H(k.placement);return U===x||U==="y"}return!0}).map(k=>[k.placement,k.overflows.filter(U=>U>0).reduce((U,be)=>U+be,0)]).sort((k,U)=>k[1]-U[1])[0])==null?void 0:Z[0];T&&(N=T);break}case"initialPlacement":N=c;break}if(r!==N)return{reset:{placement:N}}}return{}}}};async function Qe(t,e){const{placement:o,platform:n,elements:r}=t,s=await(n.isRTL==null?void 0:n.isRTL(r.floating)),i=I(o),c=rt(o),a=H(o)==="y",u=["left","top"].includes(i)?-1:1,d=s&&a?-1:1,h=ot(e,t);let{mainAxis:g,crossAxis:f,alignmentAxis:m}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return c&&typeof m=="number"&&(f=c==="end"?m*-1:m),a?{x:f*d,y:g*u}:{x:g*u,y:f*d}}const Ze=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var o,n;const{x:r,y:s,placement:i,middlewareData:c}=e,a=await Qe(e,t);return i===((o=c.offset)==null?void 0:o.placement)&&(n=c.arrow)!=null&&n.alignmentOffset?{}:{x:r+a.x,y:s+a.y,data:{...a,placement:i}}}}},tn=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:o,y:n,placement:r}=e,{mainAxis:s=!0,crossAxis:i=!1,limiter:c={fn:w=>{let{x:p,y:x}=w;return{x:p,y:x}}},...a}=ot(t,e),u={x:o,y:n},d=await oe(e,a),h=H(I(r)),g=ee(h);let f=u[g],m=u[h];if(s){const w=g==="y"?"top":"left",p=g==="y"?"bottom":"right",x=f+d[w],v=f-d[p];f=bt(x,f,v)}if(i){const w=h==="y"?"top":"left",p=h==="y"?"bottom":"right",x=m+d[w],v=m-d[p];m=bt(x,m,v)}const y=c.fn({...e,[g]:f,[h]:m});return{...y,data:{x:y.x-o,y:y.y-n,enabled:{[g]:s,[h]:i}}}}}};function pt(){return typeof window<"u"}function Q(t){return re(t)?(t.nodeName||"").toLowerCase():"#document"}function P(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function V(t){var e;return(e=(re(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function re(t){return pt()?t instanceof Node||t instanceof P(t).Node:!1}function D(t){return pt()?t instanceof Element||t instanceof P(t).Element:!1}function F(t){return pt()?t instanceof HTMLElement||t instanceof P(t).HTMLElement:!1}function Ht(t){return!pt()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof P(t).ShadowRoot}function st(t){const{overflow:e,overflowX:o,overflowY:n,display:r}=W(t);return/auto|scroll|overlay|hidden|clip/.test(e+n+o)&&!["inline","contents"].includes(r)}function en(t){return["table","td","th"].includes(Q(t))}function yt(t){return[":popover-open",":modal"].some(e=>{try{return t.matches(e)}catch{return!1}})}function Wt(t){const e=Ct(),o=D(t)?W(t):t;return["transform","translate","scale","rotate","perspective"].some(n=>o[n]?o[n]!=="none":!1)||(o.containerType?o.containerType!=="normal":!1)||!e&&(o.backdropFilter?o.backdropFilter!=="none":!1)||!e&&(o.filter?o.filter!=="none":!1)||["transform","translate","scale","rotate","perspective","filter"].some(n=>(o.willChange||"").includes(n))||["paint","layout","strict","content"].some(n=>(o.contain||"").includes(n))}function nn(t){let e=$(t);for(;F(e)&&!G(e);){if(Wt(e))return e;if(yt(e))return null;e=$(e)}return null}function Ct(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function G(t){return["html","body","#document"].includes(Q(t))}function W(t){return P(t).getComputedStyle(t)}function wt(t){return D(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function $(t){if(Q(t)==="html")return t;const e=t.assignedSlot||t.parentNode||Ht(t)&&t.host||V(t);return Ht(e)?e.host:e}function se(t){const e=$(t);return G(e)?t.ownerDocument?t.ownerDocument.body:t.body:F(e)&&st(e)?e:se(e)}function et(t,e,o){var n;e===void 0&&(e=[]),o===void 0&&(o=!0);const r=se(t),s=r===((n=t.ownerDocument)==null?void 0:n.body),i=P(r);if(s){const c=At(i);return e.concat(i,i.visualViewport||[],st(r)?r:[],c&&o?et(c):[])}return e.concat(r,et(r,[],o))}function At(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function ie(t){const e=W(t);let o=parseFloat(e.width)||0,n=parseFloat(e.height)||0;const r=F(t),s=r?t.offsetWidth:o,i=r?t.offsetHeight:n,c=ut(o)!==s||ut(n)!==i;return c&&(o=s,n=i),{width:o,height:n,$:c}}function Ft(t){return D(t)?t:t.contextElement}function X(t){const e=Ft(t);if(!F(e))return C(1);const o=e.getBoundingClientRect(),{width:n,height:r,$:s}=ie(e);let i=(s?ut(o.width):o.width)/n,c=(s?ut(o.height):o.height)/r;return(!i||!Number.isFinite(i))&&(i=1),(!c||!Number.isFinite(c))&&(c=1),{x:i,y:c}}const on=C(0);function ce(t){const e=P(t);return!Ct()||!e.visualViewport?on:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function rn(t,e,o){return e===void 0&&(e=!1),!o||e&&o!==P(t)?!1:e}function q(t,e,o,n){e===void 0&&(e=!1),o===void 0&&(o=!1);const r=t.getBoundingClientRect(),s=Ft(t);let i=C(1);e&&(n?D(n)&&(i=X(n)):i=X(t));const c=rn(s,o,n)?ce(s):C(0);let a=(r.left+c.x)/i.x,u=(r.top+c.y)/i.y,d=r.width/i.x,h=r.height/i.y;if(s){const g=P(s),f=n&&D(n)?P(n):n;let m=g,y=At(m);for(;y&&n&&f!==m;){const w=X(y),p=y.getBoundingClientRect(),x=W(y),v=p.left+(y.clientLeft+parseFloat(x.paddingLeft))*w.x,b=p.top+(y.clientTop+parseFloat(x.paddingTop))*w.y;a*=w.x,u*=w.y,d*=w.x,h*=w.y,a+=v,u+=b,m=P(y),y=At(m)}}return ht({width:d,height:h,x:a,y:u})}function Vt(t,e){const o=wt(t).scrollLeft;return e?e.left+o:q(V(t)).left+o}function ae(t,e,o){o===void 0&&(o=!1);const n=t.getBoundingClientRect(),r=n.left+e.scrollLeft-(o?0:Vt(t,n)),s=n.top+e.scrollTop;return{x:r,y:s}}function sn(t){let{elements:e,rect:o,offsetParent:n,strategy:r}=t;const s=r==="fixed",i=V(n),c=e?yt(e.floating):!1;if(n===i||c&&s)return o;let a={scrollLeft:0,scrollTop:0},u=C(1);const d=C(0),h=F(n);if((h||!h&&!s)&&((Q(n)!=="body"||st(i))&&(a=wt(n)),F(n))){const f=q(n);u=X(n),d.x=f.x+n.clientLeft,d.y=f.y+n.clientTop}const g=i&&!h&&!s?ae(i,a,!0):C(0);return{width:o.width*u.x,height:o.height*u.y,x:o.x*u.x-a.scrollLeft*u.x+d.x+g.x,y:o.y*u.y-a.scrollTop*u.y+d.y+g.y}}function cn(t){return Array.from(t.getClientRects())}function an(t){const e=V(t),o=wt(t),n=t.ownerDocument.body,r=j(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),s=j(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let i=-o.scrollLeft+Vt(t);const c=-o.scrollTop;return W(n).direction==="rtl"&&(i+=j(e.clientWidth,n.clientWidth)-r),{width:r,height:s,x:i,y:c}}function ln(t,e){const o=P(t),n=V(t),r=o.visualViewport;let s=n.clientWidth,i=n.clientHeight,c=0,a=0;if(r){s=r.width,i=r.height;const u=Ct();(!u||u&&e==="fixed")&&(c=r.offsetLeft,a=r.offsetTop)}return{width:s,height:i,x:c,y:a}}function un(t,e){const o=q(t,!0,e==="fixed"),n=o.top+t.clientTop,r=o.left+t.clientLeft,s=F(t)?X(t):C(1),i=t.clientWidth*s.x,c=t.clientHeight*s.y,a=r*s.x,u=n*s.y;return{width:i,height:c,x:a,y:u}}function $t(t,e,o){let n;if(e==="viewport")n=ln(t,o);else if(e==="document")n=an(V(t));else if(D(e))n=un(e,o);else{const r=ce(t);n={x:e.x-r.x,y:e.y-r.y,width:e.width,height:e.height}}return ht(n)}function le(t,e){const o=$(t);return o===e||!D(o)||G(o)?!1:W(o).position==="fixed"||le(o,e)}function fn(t,e){const o=e.get(t);if(o)return o;let n=et(t,[],!1).filter(c=>D(c)&&Q(c)!=="body"),r=null;const s=W(t).position==="fixed";let i=s?$(t):t;for(;D(i)&&!G(i);){const c=W(i),a=Wt(i);!a&&c.position==="fixed"&&(r=null),(s?!a&&!r:!a&&c.position==="static"&&!!r&&["absolute","fixed"].includes(r.position)||st(i)&&!a&&le(t,i))?n=n.filter(d=>d!==i):r=c,i=$(i)}return e.set(t,n),n}function hn(t){let{element:e,boundary:o,rootBoundary:n,strategy:r}=t;const i=[...o==="clippingAncestors"?yt(e)?[]:fn(e,this._c):[].concat(o),n],c=i[0],a=i.reduce((u,d)=>{const h=$t(e,d,r);return u.top=j(h.top,u.top),u.right=J(h.right,u.right),u.bottom=J(h.bottom,u.bottom),u.left=j(h.left,u.left),u},$t(e,c,r));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function dn(t){const{width:e,height:o}=ie(t);return{width:e,height:o}}function mn(t,e,o){const n=F(e),r=V(e),s=o==="fixed",i=q(t,!0,s,e);let c={scrollLeft:0,scrollTop:0};const a=C(0);function u(){a.x=Vt(r)}if(n||!n&&!s)if((Q(e)!=="body"||st(r))&&(c=wt(e)),n){const f=q(e,!0,s,e);a.x=f.x+e.clientLeft,a.y=f.y+e.clientTop}else r&&u();s&&!n&&r&&u();const d=r&&!n&&!s?ae(r,c):C(0),h=i.left+c.scrollLeft-a.x-d.x,g=i.top+c.scrollTop-a.y-d.y;return{x:h,y:g,width:i.width,height:i.height}}function xt(t){return W(t).position==="static"}function Kt(t,e){if(!F(t)||W(t).position==="fixed")return null;if(e)return e(t);let o=t.offsetParent;return V(t)===o&&(o=o.ownerDocument.body),o}function ue(t,e){const o=P(t);if(yt(t))return o;if(!F(t)){let r=$(t);for(;r&&!G(r);){if(D(r)&&!xt(r))return r;r=$(r)}return o}let n=Kt(t,e);for(;n&&en(n)&&xt(n);)n=Kt(n,e);return n&&G(n)&&xt(n)&&!Wt(n)?o:n||nn(t)||o}const gn=async function(t){const e=this.getOffsetParent||ue,o=this.getDimensions,n=await o(t.floating);return{reference:mn(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function pn(t){return W(t).direction==="rtl"}const yn={convertOffsetParentRelativeRectToViewportRelativeRect:sn,getDocumentElement:V,getClippingRect:hn,getOffsetParent:ue,getElementRects:gn,getClientRects:cn,getDimensions:dn,getScale:X,isElement:D,isRTL:pn};function fe(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function wn(t,e){let o=null,n;const r=V(t);function s(){var c;clearTimeout(n),(c=o)==null||c.disconnect(),o=null}function i(c,a){c===void 0&&(c=!1),a===void 0&&(a=1),s();const u=t.getBoundingClientRect(),{left:d,top:h,width:g,height:f}=u;if(c||e(),!g||!f)return;const m=ct(h),y=ct(r.clientWidth-(d+g)),w=ct(r.clientHeight-(h+f)),p=ct(d),v={rootMargin:-m+"px "+-y+"px "+-w+"px "+-p+"px",threshold:j(0,J(1,a))||1};let b=!0;function R(S){const O=S[0].intersectionRatio;if(O!==a){if(!b)return i();O?i(!1,O):n=setTimeout(()=>{i(!1,1e-7)},1e3)}O===1&&!fe(u,t.getBoundingClientRect())&&i(),b=!1}try{o=new IntersectionObserver(R,{...v,root:r.ownerDocument})}catch{o=new IntersectionObserver(R,v)}o.observe(t)}return i(!0),s}function vn(t,e,o,n){n===void 0&&(n={});const{ancestorScroll:r=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:a=!1}=n,u=Ft(t),d=r||s?[...u?et(u):[],...et(e)]:[];d.forEach(p=>{r&&p.addEventListener("scroll",o,{passive:!0}),s&&p.addEventListener("resize",o)});const h=u&&c?wn(u,o):null;let g=-1,f=null;i&&(f=new ResizeObserver(p=>{let[x]=p;x&&x.target===u&&f&&(f.unobserve(e),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var v;(v=f)==null||v.observe(e)})),o()}),u&&!a&&f.observe(u),f.observe(e));let m,y=a?q(t):null;a&&w();function w(){const p=q(t);y&&!fe(y,p)&&o(),y=p,m=requestAnimationFrame(w)}return o(),()=>{var p;d.forEach(x=>{r&&x.removeEventListener("scroll",o),s&&x.removeEventListener("resize",o)}),h==null||h(),(p=f)==null||p.disconnect(),f=null,a&&cancelAnimationFrame(m)}}const xn=Ze,Rn=tn,Bt=Ge,bn=Je,On=(t,e,o)=>{const n=new Map,r={platform:yn,...o},s={...r.platform,_c:n};return Xe(t,e,{...r,platform:s})},An=["top","top-start","top-end","right","right-start","right-end","bottom","bottom-start","bottom-end","left","left-start","left-end"],En=(t,e={isOpen:!1})=>{const o=[];let n=null;const r=l.Value.deriveProp(e.isOpen);function s(c){n=c,r.set(!0)}function i(){r.set(!1),o.forEach(c=>c()),o.length=0}return l.Fragment(t(s,i),l.When(r,()=>l.WithElement(c=>l.Portal("body",l.html.div(l.WithElement(a=>{a.style.position="absolute";const u=typeof(n==null?void 0:n.target)=="string"?c.querySelector(n.target):(n==null?void 0:n.target)??c;if(u==null)throw new Error(`Target not found: ${n==null?void 0:n.target}`);let d=null;const h=l.Value.toSignal((n==null?void 0:n.mainAxisOffset)??0),g=l.Value.toSignal((n==null?void 0:n.crossAxisOffset)??0),f=l.Value.toSignal((n==null?void 0:n.placement)??"top"),m=l.Value.toSignal((n==null?void 0:n.arrowPadding)??0),y=n==null?void 0:n.arrow,w=l.prop({centerOffset:0,alignmentOffset:0,containerWidth:0,containerHeight:0,x:void 0,y:void 0});async function p(){const v=[Bt(),xn({mainAxis:h.get(),crossAxis:g.get()}),Rn(),Bt()];y!=null&&d!=null&&v.push(bn({element:d,padding:m.get()}));const b=await On(u,a,{placement:f.get(),strategy:"absolute",middleware:v}),{x:R,y:S,middlewareData:O}=b;if(a.style.top=`${S}px`,a.style.left=`${R}px`,d!=null&&O.arrow!=null){const{x:K,y:M,centerOffset:L,alignmentOffset:B}=O.arrow;w.set({x:K,y:M,centerOffset:L,alignmentOffset:B,containerWidth:a.offsetWidth,containerHeight:a.offsetHeight})}}const x=l.effectOf(h,g,f)(p);return l.Fragment(n==null?void 0:n.content,(n==null?void 0:n.arrow)!=null?l.html.div(n==null?void 0:n.arrow(l.computedOf(w,f)((v,b)=>({...v,placement:b}))),l.WithElement(v=>{d=v,p()})):null,l.OnDispose(w.dispose,vn(u,a,p),x))}))))))},he=(t,e,o)=>{const n=l.prop(E.AsyncResult.notAsked),r=n.map(h=>E.AsyncResult.isSuccess(h)?h.value:void 0),s=n.map(h=>E.AsyncResult.isFailure(h)?h.error:void 0),i=n.map(h=>E.AsyncResult.isLoading(h));let c;const a=async h=>{c==null||c.abort(),c=new AbortController;const g=c.signal,f=n.get();n.set(E.AsyncResult.loading(E.AsyncResult.getOrUndefined(f)));try{const m=await e({request:h,abortSignal:g,previous:f});await Promise.resolve(),c=void 0,n.set(E.AsyncResult.success(m))}catch(m){c=void 0,n.set(E.AsyncResult.failure(o(m)))}},u=()=>a(l.Value.get(t)),d=()=>{c==null||c.abort(),c=void 0,n.dispose()};return n.onDispose(l.Value.on(t,a)),{status:n,value:r,error:s,loading:i,reload:u,dispose:d}},de=(t,e)=>{const{status:o,dispose:n,reload:r}=t,{loading:s,failure:i,success:c}=e;return l.Fragment(l.OnDispose(n),Lt(o,{loading:s!=null?a=>s(a,r):void 0,failure:i!=null?a=>i(a,r):void 0,success:a=>c(a,r)}))},Pn=({request:t,load:e,mapError:o=n=>n})=>{const n=he(t,e,o);return r=>de(n,r)},me=(t,e)=>{if(typeof e=="function")return me(t,{success:e});const o=e.failure??(r=>l.Fragment(l.OnDispose(r.on(console.error)),r.map(s=>`Error: ${s}`))),n=e.success;return l.OneOfType(l.Value.toSignal(t),{Success:r=>n(r.$.value),Failure:r=>o(r.$.error)})},Sn=()=>l.on.focus(t=>{var e;return(e=t.target)==null?void 0:e.select()});class it{constructor(e,o,n,r){vt(this,"equals",e=>E.nearEqual(this.left,e.left)&&E.nearEqual(this.top,e.top)&&E.nearEqual(this.width,e.width)&&E.nearEqual(this.height,e.height));this.left=e,this.top=o,this.width=n,this.height=r}static of({left:e=0,top:o=0,width:n=0,height:r=0}){return new it(e,o,n,r)}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 Et(t){const e=t.getBoundingClientRect();return it.of({top:e.top+window.scrollY,left:e.left+window.scrollX,width:e.width,height:e.height})}const Ln=t=>l.WithBrowserCtx(e=>{const{element:o}=e,n=l.prop(Et(o),(c,a)=>c.equals(a)),r=l.renderableOfTNode(t(n))(e),s=()=>n.set(it.of(Et(o)));let i=null;return typeof ResizeObserver<"u"&&(i=new ResizeObserver(s)),i==null||i.observe(o),l.OnDispose(c=>{i==null||i.disconnect(),r(c)})});function zt(t){return{width:(t==null?void 0:t.innerWidth)??0,height:(t==null?void 0:t.innerHeight)??0}}const Tn=t=>e=>{const o=l.getWindow(),n=l.prop(zt(o),(i,c)=>i.width===c.width&&i.height===c.height),r=l.renderableOfTNode(t(n))(e),s=()=>n.set(zt(o));return o==null||o.addEventListener("resize",s),i=>{o==null||o.removeEventListener("resize",s),r(i)}},ge=(t,e)=>{const o=e.split("/").filter(r=>r!==""),n={};for(let r=0;r<t.length;r++){const s=t[r],i=o[r];if(!i&&s.type!=="catch-all")return null;if(s.type==="literal"){if(s.value!==i)return null}else if(s.type==="param")n[s.name]=i;else if(s.type==="catch-all")return{params:n,path:e}}return o.length!==t.length?null:{params:n,path:e}},Mt=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!==""),kn=t=>{const e=t.map(o=>{const n=Mt(o);return{route:o,segments:n}});return function(n){for(const{segments:r,route:s}of e){const i=ge(r,n);if(i)return{...i,route:s}}return null}},dt={mark:l.makeProviderMark("RouterContext"),create:()=>{const t=l.prop([]);return{value:t,dispose:()=>t.dispose()}}},Dn=(t,e,o)=>{const n=o.split("/").filter(i=>i!==""),r={};let s=0;for(let i=0;i<t.length;i++){const c=t[i],a=n[i];if(!a&&c.type!=="catch-all")return null;if(c.type==="literal"){if(c.value!==a)return null;s++}else if(c.type==="param")r[c.name]=a,s++;else if(c.type==="catch-all"){const u="/"+n.slice(0,s).join("/"),d="/"+n.slice(s).join("/");return{params:r,matchedPath:u==="/"?"":u,remainingPath:d==="/"?"":d,route:e}}}if(n.length===t.length){const i="/"+n.join("/");return{params:r,matchedPath:i==="/"?"":i,remainingPath:"",route:e}}return null},pe=t=>{const e=t.map(o=>{const n=Mt(o);return{route:o,segments:n}});return function(n){for(const{segments:r,route:s}of e){const i=Dn(r,s,n);if(i)return i}return null}},Wn=t=>{const e=pe(Object.keys(t));return l.Provide(dt,{},()=>l.Use(gt,o=>l.Use(dt,n=>{const r=o.map(s=>{const i=e(s.pathname);if(i==null)throw console.error("No route found for",s),new Error("No route found");const c={matchedPath:i.matchedPath,remainingPath:i.remainingPath,fullPath:s.pathname,params:i.params};return n.value=[...n.value,c],{params:i.params,route:i.route,path:i.matchedPath||s.pathname,search:s.search,hash:s.hash}});return l.OneOfTuple(r.map(s=>[s.route,s]),t)})))},Cn=t=>{const e=pe(Object.keys(t));return l.Use(dt,o=>l.Use(gt,n=>{const r=o.map(s=>{const i=s[s.length-1],c=(i==null?void 0:i.remainingPath)||"";if(c==="")throw console.error("No remaining path for SubRouter",s),new Error("No remaining path for SubRouter");const a=e(c);if(a==null)throw console.error("No route found for remaining path",c),new Error("No route found");return{params:a.params,route:a.route,path:a.matchedPath,search:n.value.search,hash:n.value.hash}});return l.OneOfTuple(r.map(s=>[s.route,s]),t)}))},mt=60*1e3,Pt=60*mt,nt=24*Pt,_t=7*nt,jt=30*nt,Fn=365*nt,Vn=[{max:mt*90,value:mt,name:"minute",past:{singular:"a minute ago",plural:"{} minutes ago"},future:{singular:"in a minute",plural:"in {} minutes"}},{max:Pt*36,value:Pt,name:"hour",past:{singular:"an hour ago",plural:"{} hours ago"},future:{singular:"in an hour",plural:"in {} hours"}},{max:nt*10,value:nt,name:"day",past:{singular:"yesterday",plural:"{} days ago"},future:{singular:"tomorrow",plural:"in {} days"}},{max:_t*6,value:_t,name:"week",past:{singular:"last week",plural:"{} weeks ago"},future:{singular:"in a week",plural:"in {} weeks"}},{max:jt*18,value:jt,name:"month",past:{singular:"last month",plural:"{} months ago"},future:{singular:"in a month",plural:"in {} months"}},{max:1/0,value:Fn,name:"year",past:{singular:"last year",plural:"{} years ago"},future:{singular:"in a year",plural:"in {} years"}}];function It(t,e,o,n){const r=Math.round(t/e);return r<=1?o:n.replace("{}",r.toLocaleString(void 0,{maximumFractionDigits:0,minimumFractionDigits:0}))}const ye=(t=1e3)=>{const e=l.prop(new Date),o=E.interval(()=>e.set(new Date),t);return e.onDispose(o),e},we=t=>{const e=Math.abs(t);if(e<mt)return t<0?"just now":"in a moment";for(const o of Vn)if(e<o.max)return t<0?It(e,o.value,o.past.singular,o.past.plural):It(e,o.value,o.future.singular,o.future.plural);throw new Error("unreachable")},ve=(t,{now:e,frequency:o=1e4}={})=>{const n=e!=null?l.Signal.is(e)?e.derive():l.prop(e):ye(o),r=l.computedOf(t,n)((s,i)=>s.getTime()-i.getTime());return r.onDispose(()=>l.Value.dispose(n)),r},xe=(t,e={})=>{const o=ve(t,e),n=o.map(we);return n.onDispose(o.dispose),n},Mn=(t,e={})=>xe(t,e);class Re extends l.Prop{constructor(){super(...arguments);vt(this,"tick",()=>this.update(o=>o+1))}}const Nn=(t=0)=>new Re(t,(e,o)=>e===o);exports.Anchor=Gt;exports.Appearance=De;exports.AsyncResultView=Lt;exports.AutoFocus=We;exports.AutoSelect=Ce;exports.ChildRouter=Cn;exports.ElementRect=Ln;exports.HTMLTitle=Ve;exports.HiddenWhenEmpty=Fe;exports.InViewport=Zt;exports.Location=gt;exports.OnClickOutside=He;exports.OnEnterKey=$e;exports.OnEscapeKey=Ke;exports.OnKeyPressed=Tt;exports.PopOver=En;exports.Rect=it;exports.Resource=Pn;exports.ResourceDisplay=de;exports.ResultView=me;exports.RootRouter=Wn;exports.RouterContextProvider=dt;exports.SelectOnFocus=Sn;exports.Ticker=Re;exports.WhenInViewport=Ue;exports.WindowSize=Tn;exports._checkExtensionCondition=Yt;exports._getExtension=qt;exports._makeRouteMatcher=kn;exports._parseRouteSegments=Mt;exports.allPlacements=An;exports.areLocationsEqual=Jt;exports.getAbsoluteRect=Et;exports.handleAnchorClick=Xt;exports.locationFromURL=St;exports.makeResource=he;exports.matchesKeyCombo=te;exports.matchesRoute=ge;exports.nowSignal=ye;exports.relativeTime=Mn;exports.relativeTimeMillisSignal=ve;exports.relativeTimeSignal=xe;exports.setLocationFromUrl=Rt;exports.ticker=Nn;exports.timeDiffToString=we;exports.urlFromLocation=lt;exports.useAppearance=Qt;
package/index.js CHANGED
@@ -1,7 +1,7 @@
1
- var Pe = Object.defineProperty;
2
- var Le = (t, e, o) => e in t ? Pe(t, e, { enumerable: !0, configurable: !0, writable: !0, value: o }) : t[e] = o;
3
- var At = (t, e, o) => Le(t, typeof e != "symbol" ? e + "" : e, o);
4
- import { getWindow as at, prop as F, makeProviderMark as Wt, Signal as te, Use as rt, html as Et, on as ee, Value as E, attr as ne, Empty as Pt, OneOfType as oe, WithElement as H, OnDispose as M, Portal as re, Fragment as st, renderableOfTNode as Ft, When as se, effectOf as Se, computedOf as ie, WithBrowserCtx as Te, Provide as ke, OneOfTuple as ce, Prop as Ce } from "@tempots/dom";
1
+ var Le = Object.defineProperty;
2
+ var Pe = (t, e, o) => e in t ? Le(t, e, { enumerable: !0, configurable: !0, writable: !0, value: o }) : t[e] = o;
3
+ var At = (t, e, o) => Pe(t, typeof e != "symbol" ? e + "" : e, o);
4
+ import { getWindow as at, prop as F, makeProviderMark as Wt, Signal as te, Use as rt, html as Et, on as ee, Value as E, attr as ne, Empty as Lt, OneOfType as oe, WithElement as H, OnDispose as M, Portal as re, Fragment as st, renderableOfTNode as Ft, When as se, effectOf as Se, computedOf as ie, WithBrowserCtx as Te, Provide as ke, OneOfTuple as ce, Prop as Ce } from "@tempots/dom";
5
5
  import { delayed as ae, AsyncResult as U, nearEqual as ht, interval as De } from "@tempots/std";
6
6
  const We = (t) => {
7
7
  const e = t.split("/").pop();
@@ -44,8 +44,8 @@ const We = (t) => {
44
44
  ) || t() && n.preventDefault();
45
45
  };
46
46
  }, Ve = (t, e) => t.pathname === e.pathname && JSON.stringify(t.search) === JSON.stringify(e.search) && t.hash === e.hash, le = (t, e) => {
47
- var s;
48
- const o = new URL(t, e ?? ((s = at()) == null ? void 0 : s.location.toString())), n = Object.fromEntries(o.searchParams.entries());
47
+ var s, i;
48
+ const o = new URL(t, e ?? ((s = at()) == null ? void 0 : s.location.toString())), n = Object.fromEntries(((i = o.searchParams) == null ? void 0 : i.entries()) ?? []);
49
49
  let r = o.hash;
50
50
  return r.startsWith("#") && (r = r.substring(1)), {
51
51
  pathname: o.pathname,
@@ -55,7 +55,7 @@ const We = (t) => {
55
55
  }, zt = (t, e) => {
56
56
  const o = le(e);
57
57
  return t.set(o), t;
58
- }, Lt = (t) => {
58
+ }, Pt = (t) => {
59
59
  const o = new URLSearchParams(t.search).toString(), n = t.hash;
60
60
  return `${t.pathname}${o ? `?${o}` : ""}${n ? `#${n}` : ""}`;
61
61
  }, $e = (t) => t.startsWith("http://") || t.startsWith("https://") || t.startsWith("//"), He = (t) => {
@@ -63,9 +63,9 @@ const We = (t) => {
63
63
  (n) => le(n),
64
64
  (n) => {
65
65
  if ($e(n.pathname))
66
- return Lt(n);
66
+ return Pt(n);
67
67
  const r = new URL(n.pathname, e.value), s = r.origin + r.pathname;
68
- return Lt({ ...n, pathname: s });
68
+ return Pt({ ...n, pathname: s });
69
69
  }
70
70
  );
71
71
  return { value: o, dispose: o.dispose };
@@ -94,13 +94,13 @@ const We = (t) => {
94
94
  return e == null || e.addEventListener("popstate", o), t.onDispose(() => {
95
95
  e == null || e.removeEventListener("popstate", o);
96
96
  }), t.on((n) => {
97
- e == null || e.history.pushState({}, "", Lt(n));
97
+ e == null || e.history.pushState({}, "", Pt(n));
98
98
  }), {
99
99
  value: t,
100
100
  dispose: t.dispose
101
101
  };
102
102
  }, Mt = {
103
- mark: Wt("LocationProvider"),
103
+ mark: Wt("Location"),
104
104
  create: (t, e) => {
105
105
  if (e.isBrowser())
106
106
  return Ue();
@@ -145,7 +145,7 @@ function _e() {
145
145
  const ue = (t, e) => {
146
146
  if (typeof e == "function")
147
147
  return ue(t, { success: e });
148
- const o = e.failure ?? ((i) => i.map((c) => `Error: ${c}`)), n = e.success, r = e.loading ?? (() => Pt), s = e.notAsked ?? (() => Pt);
148
+ const o = e.failure ?? ((i) => i.map((c) => `Error: ${c}`)), n = e.success, r = e.loading ?? (() => Lt), s = e.notAsked ?? (() => Lt);
149
149
  return oe(E.toSignal(t), {
150
150
  AsyncSuccess: (i) => n(i.$.value),
151
151
  AsyncFailure: (i) => o(i.$.error),
@@ -205,7 +205,7 @@ const Ye = ({ mode: t = "partial", once: e = !1 }, o) => {
205
205
  }),
206
206
  Ft(o(n))
207
207
  );
208
- }, Gn = (t, e, o) => Ye(t, (n) => se(n, e, o ?? (() => Pt)));
208
+ }, Gn = (t, e, o) => Ye(t, (n) => se(n, e, o ?? (() => Lt)));
209
209
  function Qn(t) {
210
210
  return H((e) => {
211
211
  const o = (n) => {
@@ -358,7 +358,7 @@ function _t(t, e, o) {
358
358
  reference: n,
359
359
  floating: r
360
360
  } = t;
361
- const s = z(e), i = Vt(e), c = Nt(i), a = X(e), l = s === "y", h = n.x + n.width / 2 - r.width / 2, f = n.y + n.height / 2 - r.height / 2, d = n[c] / 2 - r[c] / 2;
361
+ const s = z(e), i = Vt(e), c = Nt(i), a = X(e), l = s === "y", h = n.x + n.width / 2 - r.width / 2, f = n.y + n.height / 2 - r.height / 2, m = n[c] / 2 - r[c] / 2;
362
362
  let u;
363
363
  switch (a) {
364
364
  case "top":
@@ -393,10 +393,10 @@ function _t(t, e, o) {
393
393
  }
394
394
  switch (ut(e)) {
395
395
  case "start":
396
- u[i] -= d * (o && l ? -1 : 1);
396
+ u[i] -= m * (o && l ? -1 : 1);
397
397
  break;
398
398
  case "end":
399
- u[i] += d * (o && l ? -1 : 1);
399
+ u[i] += m * (o && l ? -1 : 1);
400
400
  break;
401
401
  }
402
402
  return u;
@@ -415,7 +415,7 @@ const nn = async (t, e, o) => {
415
415
  }), {
416
416
  x: h,
417
417
  y: f
418
- } = _t(l, n, a), d = n, u = {}, m = 0;
418
+ } = _t(l, n, a), m = n, u = {}, d = 0;
419
419
  for (let p = 0; p < c.length; p++) {
420
420
  const {
421
421
  name: w,
@@ -429,7 +429,7 @@ const nn = async (t, e, o) => {
429
429
  x: h,
430
430
  y: f,
431
431
  initialPlacement: n,
432
- placement: d,
432
+ placement: m,
433
433
  strategy: r,
434
434
  middlewareData: u,
435
435
  rects: l,
@@ -445,19 +445,19 @@ const nn = async (t, e, o) => {
445
445
  ...u[w],
446
446
  ...b
447
447
  }
448
- }, v && m <= 50 && (m++, typeof v == "object" && (v.placement && (d = v.placement), v.rects && (l = v.rects === !0 ? await i.getElementRects({
448
+ }, v && d <= 50 && (d++, typeof v == "object" && (v.placement && (m = v.placement), v.rects && (l = v.rects === !0 ? await i.getElementRects({
449
449
  reference: t,
450
450
  floating: e,
451
451
  strategy: r
452
452
  }) : v.rects), {
453
453
  x: h,
454
454
  y: f
455
- } = _t(l, d, a)), p = -1);
455
+ } = _t(l, m, a)), p = -1);
456
456
  }
457
457
  return {
458
458
  x: h,
459
459
  y: f,
460
- placement: d,
460
+ placement: m,
461
461
  strategy: r,
462
462
  middlewareData: u
463
463
  };
@@ -476,9 +476,9 @@ async function me(t, e) {
476
476
  boundary: l = "clippingAncestors",
477
477
  rootBoundary: h = "viewport",
478
478
  elementContext: f = "floating",
479
- altBoundary: d = !1,
479
+ altBoundary: m = !1,
480
480
  padding: u = 0
481
- } = lt(e, t), m = de(u), w = c[d ? f === "floating" ? "reference" : "floating" : f], g = wt(await s.getClippingRect({
481
+ } = lt(e, t), d = de(u), w = c[m ? f === "floating" ? "reference" : "floating" : f], g = wt(await s.getClippingRect({
482
482
  element: (o = await (s.isElement == null ? void 0 : s.isElement(w))) == null || o ? w : w.contextElement || await (s.getDocumentElement == null ? void 0 : s.getDocumentElement(c.floating)),
483
483
  boundary: l,
484
484
  rootBoundary: h,
@@ -501,10 +501,10 @@ async function me(t, e) {
501
501
  strategy: a
502
502
  }) : x);
503
503
  return {
504
- top: (g.top - v.top + m.top) / b.y,
505
- bottom: (v.bottom - g.bottom + m.bottom) / b.y,
506
- left: (g.left - v.left + m.left) / b.x,
507
- right: (v.right - g.right + m.right) / b.x
504
+ top: (g.top - v.top + d.top) / b.y,
505
+ bottom: (v.bottom - g.bottom + d.bottom) / b.y,
506
+ left: (g.left - v.left + d.left) / b.x,
507
+ right: (v.right - g.right + d.right) / b.x
508
508
  };
509
509
  }
510
510
  const on = (t) => ({
@@ -525,15 +525,15 @@ const on = (t) => ({
525
525
  } = lt(t, e) || {};
526
526
  if (l == null)
527
527
  return {};
528
- const f = de(h), d = {
528
+ const f = de(h), m = {
529
529
  x: o,
530
530
  y: n
531
- }, u = Vt(r), m = Nt(u), p = await i.getDimensions(l), w = u === "y", g = w ? "top" : "left", x = w ? "bottom" : "right", y = w ? "clientHeight" : "clientWidth", b = s.reference[m] + s.reference[u] - d[u] - s.floating[m], v = d[u] - s.reference[u], P = await (i.getOffsetParent == null ? void 0 : i.getOffsetParent(l));
532
- let R = P ? P[y] : 0;
533
- (!R || !await (i.isElement == null ? void 0 : i.isElement(P))) && (R = c.floating[y] || s.floating[m]);
534
- const _ = b / 2 - v / 2, V = R / 2 - p[m] / 2 - 1, L = Z(f[g], V), j = Z(f[x], V), I = L, nt = R - p[m] - j, A = R / 2 - p[m] / 2 + _, Y = St(I, A, nt), $ = !a.arrow && ut(r) != null && A !== Y && s.reference[m] / 2 - (A < I ? L : j) - p[m] / 2 < 0, S = $ ? A < I ? A - I : A - nt : 0;
531
+ }, u = Vt(r), d = Nt(u), p = await i.getDimensions(l), w = u === "y", g = w ? "top" : "left", x = w ? "bottom" : "right", y = w ? "clientHeight" : "clientWidth", b = s.reference[d] + s.reference[u] - m[u] - s.floating[d], v = m[u] - s.reference[u], L = await (i.getOffsetParent == null ? void 0 : i.getOffsetParent(l));
532
+ let R = L ? L[y] : 0;
533
+ (!R || !await (i.isElement == null ? void 0 : i.isElement(L))) && (R = c.floating[y] || s.floating[d]);
534
+ const _ = b / 2 - v / 2, V = R / 2 - p[d] / 2 - 1, P = Z(f[g], V), j = Z(f[x], V), I = P, nt = R - p[d] - j, A = R / 2 - p[d] / 2 + _, Y = St(I, A, nt), $ = !a.arrow && ut(r) != null && A !== Y && s.reference[d] / 2 - (A < I ? P : j) - p[d] / 2 < 0, S = $ ? A < I ? A - I : A - nt : 0;
535
535
  return {
536
- [u]: d[u] + S,
536
+ [u]: m[u] + S,
537
537
  data: {
538
538
  [u]: Y,
539
539
  centerOffset: A - Y - S,
@@ -560,23 +560,23 @@ const on = (t) => ({
560
560
  } = e, {
561
561
  mainAxis: h = !0,
562
562
  crossAxis: f = !0,
563
- fallbackPlacements: d,
563
+ fallbackPlacements: m,
564
564
  fallbackStrategy: u = "bestFit",
565
- fallbackAxisSideDirection: m = "none",
565
+ fallbackAxisSideDirection: d = "none",
566
566
  flipAlignment: p = !0,
567
567
  ...w
568
568
  } = lt(t, e);
569
569
  if ((o = s.arrow) != null && o.alignmentOffset)
570
570
  return {};
571
- const g = X(r), x = z(c), y = X(c) === c, b = await (a.isRTL == null ? void 0 : a.isRTL(l.floating)), v = d || (y || !p ? [pt(c)] : Qe(c)), P = m !== "none";
572
- !d && P && v.push(...tn(c, p, m, b));
571
+ const g = X(r), x = z(c), y = X(c) === c, b = await (a.isRTL == null ? void 0 : a.isRTL(l.floating)), v = m || (y || !p ? [pt(c)] : Qe(c)), L = d !== "none";
572
+ !m && L && v.push(...tn(c, p, d, b));
573
573
  const R = [c, ...v], _ = await me(e, w), V = [];
574
- let L = ((n = s.flip) == null ? void 0 : n.overflows) || [];
574
+ let P = ((n = s.flip) == null ? void 0 : n.overflows) || [];
575
575
  if (h && V.push(_[g]), f) {
576
576
  const A = Ge(r, i, b);
577
577
  V.push(_[A[0]], _[A[1]]);
578
578
  }
579
- if (L = [...L, {
579
+ if (P = [...P, {
580
580
  placement: r,
581
581
  overflows: V
582
582
  }], !V.every((A) => A <= 0)) {
@@ -584,23 +584,23 @@ const on = (t) => ({
584
584
  const A = (((j = s.flip) == null ? void 0 : j.index) || 0) + 1, Y = R[A];
585
585
  if (Y && (!(f === "alignment" ? x !== z(Y) : !1) || // We leave the current main axis only if every placement on that axis
586
586
  // overflows the main axis.
587
- L.every((T) => T.overflows[0] > 0 && z(T.placement) === x)))
587
+ P.every((T) => T.overflows[0] > 0 && z(T.placement) === x)))
588
588
  return {
589
589
  data: {
590
590
  index: A,
591
- overflows: L
591
+ overflows: P
592
592
  },
593
593
  reset: {
594
594
  placement: Y
595
595
  }
596
596
  };
597
- let $ = (I = L.filter((S) => S.overflows[0] <= 0).sort((S, T) => S.overflows[1] - T.overflows[1])[0]) == null ? void 0 : I.placement;
597
+ let $ = (I = P.filter((S) => S.overflows[0] <= 0).sort((S, T) => S.overflows[1] - T.overflows[1])[0]) == null ? void 0 : I.placement;
598
598
  if (!$)
599
599
  switch (u) {
600
600
  case "bestFit": {
601
601
  var nt;
602
- const S = (nt = L.filter((T) => {
603
- if (P) {
602
+ const S = (nt = P.filter((T) => {
603
+ if (L) {
604
604
  const B = z(T.placement);
605
605
  return B === x || // Create a bias to the `y` side axis due to horizontal
606
606
  // reading directions favoring greater width.
@@ -633,9 +633,9 @@ async function sn(t, e) {
633
633
  elements: r
634
634
  } = t, s = await (n.isRTL == null ? void 0 : n.isRTL(r.floating)), i = X(o), c = ut(o), a = z(o) === "y", l = ["left", "top"].includes(i) ? -1 : 1, h = s && a ? -1 : 1, f = lt(e, t);
635
635
  let {
636
- mainAxis: d,
636
+ mainAxis: m,
637
637
  crossAxis: u,
638
- alignmentAxis: m
638
+ alignmentAxis: d
639
639
  } = typeof f == "number" ? {
640
640
  mainAxis: f,
641
641
  crossAxis: 0,
@@ -645,11 +645,11 @@ async function sn(t, e) {
645
645
  crossAxis: f.crossAxis || 0,
646
646
  alignmentAxis: f.alignmentAxis
647
647
  };
648
- return c && typeof m == "number" && (u = c === "end" ? m * -1 : m), a ? {
648
+ return c && typeof d == "number" && (u = c === "end" ? d * -1 : d), a ? {
649
649
  x: u * h,
650
- y: d * l
650
+ y: m * l
651
651
  } : {
652
- x: d * l,
652
+ x: m * l,
653
653
  y: u * h
654
654
  };
655
655
  }
@@ -703,20 +703,20 @@ const cn = function(t) {
703
703
  } = lt(t, e), l = {
704
704
  x: o,
705
705
  y: n
706
- }, h = await me(e, a), f = z(X(r)), d = he(f);
707
- let u = l[d], m = l[f];
706
+ }, h = await me(e, a), f = z(X(r)), m = he(f);
707
+ let u = l[m], d = l[f];
708
708
  if (s) {
709
- const w = d === "y" ? "top" : "left", g = d === "y" ? "bottom" : "right", x = u + h[w], y = u - h[g];
709
+ const w = m === "y" ? "top" : "left", g = m === "y" ? "bottom" : "right", x = u + h[w], y = u - h[g];
710
710
  u = St(x, u, y);
711
711
  }
712
712
  if (i) {
713
- const w = f === "y" ? "top" : "left", g = f === "y" ? "bottom" : "right", x = m + h[w], y = m - h[g];
714
- m = St(x, m, y);
713
+ const w = f === "y" ? "top" : "left", g = f === "y" ? "bottom" : "right", x = d + h[w], y = d - h[g];
714
+ d = St(x, d, y);
715
715
  }
716
716
  const p = c.fn({
717
717
  ...e,
718
- [d]: u,
719
- [f]: m
718
+ [m]: u,
719
+ [f]: d
720
720
  });
721
721
  return {
722
722
  ...p,
@@ -724,7 +724,7 @@ const cn = function(t) {
724
724
  x: p.x - o,
725
725
  y: p.y - n,
726
726
  enabled: {
727
- [d]: s,
727
+ [m]: s,
728
728
  [f]: i
729
729
  }
730
730
  }
@@ -888,11 +888,11 @@ function J(t, e, o, n) {
888
888
  const c = hn(s, o, n) ? ye(s) : D(0);
889
889
  let a = (r.left + c.x) / i.x, l = (r.top + c.y) / i.y, h = r.width / i.x, f = r.height / i.y;
890
890
  if (s) {
891
- const d = O(s), u = n && k(n) ? O(n) : n;
892
- let m = d, p = kt(m);
893
- for (; p && n && u !== m; ) {
891
+ const m = O(s), u = n && k(n) ? O(n) : n;
892
+ let d = m, p = kt(d);
893
+ for (; p && n && u !== d; ) {
894
894
  const w = Q(p), g = p.getBoundingClientRect(), x = C(p), y = g.left + (p.clientLeft + parseFloat(x.paddingLeft)) * w.x, b = g.top + (p.clientTop + parseFloat(x.paddingTop)) * w.y;
895
- a *= w.x, l *= w.y, h *= w.x, f *= w.y, a += y, l += b, m = O(p), p = kt(m);
895
+ a *= w.x, l *= w.y, h *= w.x, f *= w.y, a += y, l += b, d = O(p), p = kt(d);
896
896
  }
897
897
  }
898
898
  return wt({
@@ -936,12 +936,12 @@ function dn(t) {
936
936
  const u = J(n);
937
937
  l = Q(n), h.x = u.x + n.clientLeft, h.y = u.y + n.clientTop;
938
938
  }
939
- const d = i && !f && !s ? xe(i, a, !0) : D(0);
939
+ const m = i && !f && !s ? xe(i, a, !0) : D(0);
940
940
  return {
941
941
  width: o.width * l.x,
942
942
  height: o.height * l.y,
943
- x: o.x * l.x - a.scrollLeft * l.x + h.x + d.x,
944
- y: o.y * l.y - a.scrollTop * l.y + h.y + d.y
943
+ x: o.x * l.x - a.scrollLeft * l.x + h.x + m.x,
944
+ y: o.y * l.y - a.scrollTop * l.y + h.y + m.y
945
945
  };
946
946
  }
947
947
  function mn(t) {
@@ -1062,10 +1062,10 @@ function bn(t, e, o) {
1062
1062
  a.x = u.x + e.clientLeft, a.y = u.y + e.clientTop;
1063
1063
  } else r && l();
1064
1064
  s && !n && r && l();
1065
- const h = r && !n && !s ? xe(r, c) : D(0), f = i.left + c.scrollLeft - a.x - h.x, d = i.top + c.scrollTop - a.y - h.y;
1065
+ const h = r && !n && !s ? xe(r, c) : D(0), f = i.left + c.scrollLeft - a.x - h.x, m = i.top + c.scrollTop - a.y - h.y;
1066
1066
  return {
1067
1067
  x: f,
1068
- y: d,
1068
+ y: m,
1069
1069
  width: i.width,
1070
1070
  height: i.height
1071
1071
  };
@@ -1141,18 +1141,18 @@ function En(t, e) {
1141
1141
  const l = t.getBoundingClientRect(), {
1142
1142
  left: h,
1143
1143
  top: f,
1144
- width: d,
1144
+ width: m,
1145
1145
  height: u
1146
1146
  } = l;
1147
- if (c || e(), !d || !u)
1147
+ if (c || e(), !m || !u)
1148
1148
  return;
1149
- const m = dt(f), p = dt(r.clientWidth - (h + d)), w = dt(r.clientHeight - (f + u)), g = dt(h), y = {
1150
- rootMargin: -m + "px " + -p + "px " + -w + "px " + -g + "px",
1149
+ const d = dt(f), p = dt(r.clientWidth - (h + m)), w = dt(r.clientHeight - (f + u)), g = dt(h), y = {
1150
+ rootMargin: -d + "px " + -p + "px " + -w + "px " + -g + "px",
1151
1151
  threshold: q(0, Z(1, a)) || 1
1152
1152
  };
1153
1153
  let b = !0;
1154
- function v(P) {
1155
- const R = P[0].intersectionRatio;
1154
+ function v(L) {
1155
+ const R = L[0].intersectionRatio;
1156
1156
  if (R !== a) {
1157
1157
  if (!b)
1158
1158
  return i();
@@ -1175,7 +1175,7 @@ function En(t, e) {
1175
1175
  }
1176
1176
  return i(!0), s;
1177
1177
  }
1178
- function Pn(t, e, o, n) {
1178
+ function Ln(t, e, o, n) {
1179
1179
  n === void 0 && (n = {});
1180
1180
  const {
1181
1181
  ancestorScroll: r = !0,
@@ -1190,28 +1190,28 @@ function Pn(t, e, o, n) {
1190
1190
  }), s && g.addEventListener("resize", o);
1191
1191
  });
1192
1192
  const f = l && c ? En(l, o) : null;
1193
- let d = -1, u = null;
1193
+ let m = -1, u = null;
1194
1194
  i && (u = new ResizeObserver((g) => {
1195
1195
  let [x] = g;
1196
- x && x.target === l && u && (u.unobserve(e), cancelAnimationFrame(d), d = requestAnimationFrame(() => {
1196
+ x && x.target === l && u && (u.unobserve(e), cancelAnimationFrame(m), m = requestAnimationFrame(() => {
1197
1197
  var y;
1198
1198
  (y = u) == null || y.observe(e);
1199
1199
  })), o();
1200
1200
  }), l && !a && u.observe(l), u.observe(e));
1201
- let m, p = a ? J(t) : null;
1201
+ let d, p = a ? J(t) : null;
1202
1202
  a && w();
1203
1203
  function w() {
1204
1204
  const g = J(t);
1205
- p && !Re(p, g) && o(), p = g, m = requestAnimationFrame(w);
1205
+ p && !Re(p, g) && o(), p = g, d = requestAnimationFrame(w);
1206
1206
  }
1207
1207
  return o(), () => {
1208
1208
  var g;
1209
1209
  h.forEach((x) => {
1210
1210
  r && x.removeEventListener("scroll", o), s && x.removeEventListener("resize", o);
1211
- }), f == null || f(), (g = u) == null || g.disconnect(), u = null, a && cancelAnimationFrame(m);
1211
+ }), f == null || f(), (g = u) == null || g.disconnect(), u = null, a && cancelAnimationFrame(d);
1212
1212
  };
1213
1213
  }
1214
- const Ln = cn, Sn = an, qt = rn, Tn = on, kn = (t, e, o) => {
1214
+ const Pn = cn, Sn = an, qt = rn, Tn = on, kn = (t, e, o) => {
1215
1215
  const n = /* @__PURE__ */ new Map(), r = {
1216
1216
  platform: On,
1217
1217
  ...o
@@ -1262,10 +1262,10 @@ const Ln = cn, Sn = an, qt = rn, Tn = on, kn = (t, e, o) => {
1262
1262
  if (l == null)
1263
1263
  throw new Error(`Target not found: ${n == null ? void 0 : n.target}`);
1264
1264
  let h = null;
1265
- const f = E.toSignal((n == null ? void 0 : n.mainAxisOffset) ?? 0), d = E.toSignal((n == null ? void 0 : n.crossAxisOffset) ?? 0), u = E.toSignal(
1265
+ const f = E.toSignal((n == null ? void 0 : n.mainAxisOffset) ?? 0), m = E.toSignal((n == null ? void 0 : n.crossAxisOffset) ?? 0), u = E.toSignal(
1266
1266
  /* c8 ignore next 3 */
1267
1267
  (n == null ? void 0 : n.placement) ?? "top"
1268
- ), m = E.toSignal((n == null ? void 0 : n.arrowPadding) ?? 0), p = n == null ? void 0 : n.arrow, w = F({
1268
+ ), d = E.toSignal((n == null ? void 0 : n.arrowPadding) ?? 0), p = n == null ? void 0 : n.arrow, w = F({
1269
1269
  centerOffset: 0,
1270
1270
  alignmentOffset: 0,
1271
1271
  containerWidth: 0,
@@ -1276,9 +1276,9 @@ const Ln = cn, Sn = an, qt = rn, Tn = on, kn = (t, e, o) => {
1276
1276
  async function g() {
1277
1277
  const y = [
1278
1278
  qt(),
1279
- Ln({
1279
+ Pn({
1280
1280
  mainAxis: f.get(),
1281
- crossAxis: d.get()
1281
+ crossAxis: m.get()
1282
1282
  }),
1283
1283
  Sn(),
1284
1284
  qt()
@@ -1286,25 +1286,25 @@ const Ln = cn, Sn = an, qt = rn, Tn = on, kn = (t, e, o) => {
1286
1286
  p != null && h != null && y.push(
1287
1287
  Tn({
1288
1288
  element: h,
1289
- padding: m.get()
1289
+ padding: d.get()
1290
1290
  })
1291
1291
  );
1292
1292
  const b = await kn(l, a, {
1293
1293
  placement: u.get(),
1294
1294
  strategy: "absolute",
1295
1295
  middleware: y
1296
- }), { x: v, y: P, middlewareData: R } = b;
1297
- if (a.style.top = `${P}px`, a.style.left = `${v}px`, h != null && R.arrow != null) {
1296
+ }), { x: v, y: L, middlewareData: R } = b;
1297
+ if (a.style.top = `${L}px`, a.style.left = `${v}px`, h != null && R.arrow != null) {
1298
1298
  const {
1299
1299
  x: _,
1300
1300
  y: V,
1301
- centerOffset: L,
1301
+ centerOffset: P,
1302
1302
  alignmentOffset: j
1303
1303
  } = R.arrow;
1304
1304
  w.set({
1305
1305
  x: _,
1306
1306
  y: V,
1307
- centerOffset: L,
1307
+ centerOffset: P,
1308
1308
  alignmentOffset: j,
1309
1309
  containerWidth: a.offsetWidth,
1310
1310
  containerHeight: a.offsetHeight
@@ -1313,7 +1313,7 @@ const Ln = cn, Sn = an, qt = rn, Tn = on, kn = (t, e, o) => {
1313
1313
  }
1314
1314
  const x = Se(
1315
1315
  f,
1316
- d,
1316
+ m,
1317
1317
  u
1318
1318
  )(g);
1319
1319
  return st(
@@ -1334,7 +1334,7 @@ const Ln = cn, Sn = an, qt = rn, Tn = on, kn = (t, e, o) => {
1334
1334
  ) : null,
1335
1335
  M(
1336
1336
  w.dispose,
1337
- Pn(l, a, g),
1337
+ Ln(l, a, g),
1338
1338
  x
1339
1339
  )
1340
1340
  );
@@ -1353,13 +1353,13 @@ const Ln = cn, Sn = an, qt = rn, Tn = on, kn = (t, e, o) => {
1353
1353
  let c;
1354
1354
  const a = async (f) => {
1355
1355
  c == null || c.abort(), c = new AbortController();
1356
- const d = c.signal, u = n.get();
1356
+ const m = c.signal, u = n.get();
1357
1357
  n.set(U.loading(U.getOrUndefined(u)));
1358
1358
  try {
1359
- const m = await e({ request: f, abortSignal: d, previous: u });
1360
- await Promise.resolve(), c = void 0, n.set(U.success(m));
1361
- } catch (m) {
1362
- c = void 0, n.set(U.failure(o(m)));
1359
+ const d = await e({ request: f, abortSignal: m, previous: u });
1360
+ await Promise.resolve(), c = void 0, n.set(U.success(d));
1361
+ } catch (d) {
1362
+ c = void 0, n.set(U.failure(o(d)));
1363
1363
  }
1364
1364
  }, l = () => a(E.get(t)), h = () => {
1365
1365
  c == null || c.abort(), c = void 0, n.dispose();
@@ -1698,17 +1698,9 @@ const io = (t) => (e) => {
1698
1698
  const a = e(c);
1699
1699
  if (a == null)
1700
1700
  throw console.error("No route found for remaining path", c), new Error("No route found");
1701
- const h = { ...s.reduce(
1702
- (d, u) => ({ ...d, ...u.params }),
1703
- {}
1704
- ), ...a.params }, f = {
1705
- matchedPath: a.matchedPath,
1706
- remainingPath: a.remainingPath,
1707
- fullPath: (i == null ? void 0 : i.fullPath) || c,
1708
- params: h
1709
- };
1710
- return o.value = [...s, f], {
1711
- params: h,
1701
+ return {
1702
+ params: a.params,
1703
+ // Only this router's parameters
1712
1704
  route: a.route,
1713
1705
  path: a.matchedPath,
1714
1706
  search: n.value.search,
@@ -1853,6 +1845,6 @@ export {
1853
1845
  zt as setLocationFromUrl,
1854
1846
  fo as ticker,
1855
1847
  Hn as timeDiffToString,
1856
- Lt as urlFromLocation,
1848
+ Pt as urlFromLocation,
1857
1849
  _e as useAppearance
1858
1850
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tempots/ui",
3
- "version": "6.0.0",
3
+ "version": "6.1.0",
4
4
  "type": "module",
5
5
  "main": "./index.cjs",
6
6
  "module": "./index.js",