@tempots/ui 4.3.5 → 4.3.7
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 +1 -1
- package/index.js +1 -1
- package/package.json +1 -1
package/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var we=Object.defineProperty;var xe=(t,e,n)=>e in t?we(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var gt=(t,e,n)=>xe(t,typeof e!="symbol"?e+"":e,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("@tempots/dom"),O=require("@tempots/std"),Bt=t=>{const e=t.split("/").pop();if(e==null||e.startsWith("."))return;const n=e.split(".")||[];return n.length>1?"."+n.pop():void 0},zt=(t,e)=>{const n=Bt(e);return n!=null&&(t.length===0||!t.some(o=>n==o))},ve=(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 u=r+c+l,d=i.getAttribute("href");if(!(d!=null&&d.startsWith("#"))&&d!==u)return!0}return e?!1:zt(n,r)},_t=(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=>{ve(o,e.ignoreUrlWithExtension??!0,n,e.ignoreExternalUrl??!0)||t()&&o.preventDefault()}},It=(t,e)=>t.pathname===e.pathname&&JSON.stringify(t.search)===JSON.stringify(e.search)&&t.hash===e.hash,Et=(t,e)=>{var i;const n=new URL(t,e??((i=a.getWindow())==null?void 0:i.location.toString())),o=Object.fromEntries(n.searchParams.entries());let s=n.hash;return s.startsWith("#")&&(s=s.substring(1)),{pathname:n.pathname,search:o,hash:s===""?void 0:s}},wt=(t,e)=>{const n=Et(e);return t.set(n),t},lt=t=>{const n=new URLSearchParams(t.search).toString(),o=t.hash;return`${t.pathname}${n?`?${n}`:""}${o?`#${o}`:""}`},be=t=>t.startsWith("http://")||t.startsWith("https://")||t.startsWith("//"),Ae=t=>{const e=t.container.currentURL,n=e.iso(o=>Et(o),o=>{if(be(o.pathname))return lt(o);const s=new URL(o.pathname,e.value),i=s.origin+s.pathname;return lt({...o,pathname:i})});return{value:n,dispose:n.dispose}},Re=()=>{const t=a.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}},Ee=()=>{const t=a.prop(Re(),It),e=a.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({},"",lt(o))}),{value:t,dispose:t.dispose}},Ot={mark:a.makeProviderMark("LocationProvider"),create:(t,e)=>{if(e.isBrowser())return Ee();if(e.isHeadless())return Ae(e);throw new Error("Unknown context")}},Oe=t=>{document.startViewTransition?document.startViewTransition(t):t()},jt=(t,...e)=>{if(typeof t=="string"||a.Signal.is(t))return jt({href:t},...e);const{href:n,withViewTransition:o,...s}=t;return a.Use(Ot,i=>a.html.a(a.on.click(_t(()=>(o==!0?Oe(()=>{wt(i,a.Value.get(n))}):wt(i,a.Value.get(n)),!0),s)),a.attr.href(n),...e))},Se={mark:a.makeProviderMark("Appearance"),create:()=>{const t=qt();return{value:t,dispose:t.dispose}}};function qt(){const t=a.getWindow(),e=t!=null&&t.matchMedia!=null?t.matchMedia("(prefers-color-scheme: dark)"):void 0,n=(e==null?void 0:e.matches)??!1,o=a.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 St=(t,e)=>{if(typeof e=="function")return St(t,{success:e});const n=e.failure??(r=>r.map(c=>`Error: ${c}`)),o=e.success,s=e.loading??(()=>a.Empty),i=e.notAsked??(()=>a.Empty);return a.OneOfType(a.Value.toSignal(t),{AsyncSuccess:r=>o(r.$.value),AsyncFailure:r=>n(r.$.error),Loading:r=>s(r.map(c=>c.previousValue)),NotAsked:i})},Le=(t=10)=>a.WithElement(e=>a.OnDispose(O.delayed(()=>e==null?void 0:e.focus(),t))),Te=(t=10)=>a.WithElement(e=>{const n=O.delayed(()=>e.select(),t);return a.OnDispose(n)}),ke=a.WithElement(t=>{const e=t.style.getPropertyValue(":empty");return t.style.setProperty(":empty","display:none"),a.OnDispose(n=>{n&&t.style.setProperty(":empty",e)})}),De=t=>a.Portal("head > title",a.attr.innerText(t)),We={partial:{root:null,rootMargin:"0px",threshold:0},full:{root:null,rootMargin:"0px",threshold:1}},ct={partial:new Map,full:new Map},Z={partial:null,full:null};function Ce(t){return Z[t]==null&&(Z[t]=new IntersectionObserver(e=>{e.forEach(n=>{const o=ct[t].get(n.target);o==null||o.set(n.isIntersecting)})},We[t])),Z[t]}const Yt=({mode:t="partial",once:e=!1},n)=>{const o=a.prop(!1);return a.Fragment(a.WithElement(s=>{const i=typeof IntersectionObserver<"u"?Ce(t):null;ct[t].set(s,o),i==null||i.observe(s);function r(){var l;i==null||i.unobserve(s),ct[t].delete(s),ct[t].size===0&&((l=Z[t])==null||l.disconnect(),Z[t]=null)}let c=null;return e&&(c=o.on(l=>{l&&r()})),a.OnDispose(()=>{o.dispose(),r(),c==null||c()})}),a.renderableOfTNode(n(o)))},Pe=(t,e,n)=>Yt(t,o=>a.When(o,e,n??(()=>a.Empty))),K=Math.min,j=Math.max,at=Math.round,rt=Math.floor,P=t=>({x:t,y:t}),Fe={left:"right",right:"left",bottom:"top",top:"bottom"},Ve={start:"end",end:"start"};function xt(t,e,n){return j(t,K(e,n))}function nt(t,e){return typeof t=="function"?t(e):t}function q(t){return t.split("-")[0]}function ot(t){return t.split("-")[1]}function Xt(t){return t==="x"?"y":"x"}function Lt(t){return t==="y"?"height":"width"}function $(t){return["top","bottom"].includes(q(t))?"y":"x"}function Tt(t){return Xt($(t))}function Me(t,e,n){n===void 0&&(n=!1);const o=ot(t),s=Tt(t),i=Lt(s);let r=s==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(r=ut(r)),[r,ut(r)]}function Ne(t){const e=ut(t);return[vt(t),e,vt(e)]}function vt(t){return t.replace(/start|end/g,e=>Ve[e])}function He(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 $e(t,e,n,o){const s=ot(t);let i=He(q(t),n==="start",o);return s&&(i=i.map(r=>r+"-"+s),e&&(i=i.concat(i.map(vt)))),i}function ut(t){return t.replace(/left|right|bottom|top/g,e=>Fe[e])}function Ue(t){return{top:0,right:0,bottom:0,left:0,...t}}function Kt(t){return typeof t!="number"?Ue(t):{top:t,right:t,bottom:t,left:t}}function ft(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 Pt(t,e,n){let{reference:o,floating:s}=t;const i=$(e),r=Tt(e),c=Lt(r),l=q(e),u=i==="y",d=o.x+o.width/2-s.width/2,h=o.y+o.height/2-s.height/2,p=o[c]/2-s[c]/2;let f;switch(l){case"top":f={x:d,y:o.y-s.height};break;case"bottom":f={x:d,y:o.y+o.height};break;case"right":f={x:o.x+o.width,y:h};break;case"left":f={x:o.x-s.width,y:h};break;default:f={x:o.x,y:o.y}}switch(ot(e)){case"start":f[r]-=p*(n&&u?-1:1);break;case"end":f[r]+=p*(n&&u?-1:1);break}return f}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 u=await r.getElementRects({reference:t,floating:e,strategy:s}),{x:d,y:h}=Pt(u,o,l),p=o,f={},m=0;for(let g=0;g<c.length;g++){const{name:y,fn:w}=c[g],{x,y:v,data:A,reset:b}=await w({x:d,y:h,initialPlacement:o,placement:p,strategy:s,middlewareData:f,rects:u,platform:r,elements:{reference:t,floating:e}});d=x??d,h=v??h,f={...f,[y]:{...f[y],...A}},b&&m<=50&&(m++,typeof b=="object"&&(b.placement&&(p=b.placement),b.rects&&(u=b.rects===!0?await r.getElementRects({reference:t,floating:e,strategy:s}):b.rects),{x:d,y:h}=Pt(u,p,l)),g=-1)}return{x:d,y:h,placement:p,strategy:s,middlewareData:f}};async function Jt(t,e){var n;e===void 0&&(e={});const{x:o,y:s,platform:i,rects:r,elements:c,strategy:l}=t,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:h="floating",altBoundary:p=!1,padding:f=0}=nt(e,t),m=Kt(f),y=c[p?h==="floating"?"reference":"floating":h],w=ft(await i.getClippingRect({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)),boundary:u,rootBoundary:d,strategy:l})),x=h==="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=ft(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:x,offsetParent:v,strategy:l}):x);return{top:(w.top-b.top+m.top)/A.y,bottom:(b.bottom-w.bottom+m.bottom)/A.y,left:(w.left-b.left+m.left)/A.x,right:(b.right-w.right+m.right)/A.x}}const ze=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:o,placement:s,rects:i,platform:r,elements:c,middlewareData:l}=e,{element:u,padding:d=0}=nt(t,e)||{};if(u==null)return{};const h=Kt(d),p={x:n,y:o},f=Tt(s),m=Lt(f),g=await r.getDimensions(u),y=f==="y",w=y?"top":"left",x=y?"bottom":"right",v=y?"clientHeight":"clientWidth",A=i.reference[m]+i.reference[f]-p[f]-i.floating[m],b=p[f]-i.reference[f],L=await(r.getOffsetParent==null?void 0:r.getOffsetParent(u));let R=L?L[v]:0;(!R||!await(r.isElement==null?void 0:r.isElement(L)))&&(R=c.floating[v]||i.floating[m]);const B=A/2-b/2,M=R/2-g[m]/2-1,T=K(h[w],M),z=K(h[x],M),_=T,Q=R-g[m]-z,E=R/2-g[m]/2+B,I=xt(_,E,Q),N=!l.arrow&&ot(s)!=null&&E!==I&&i.reference[m]/2-(E<_?T:z)-g[m]/2<0,k=N?E<_?E-_:E-Q:0;return{[f]:p[f]+k,data:{[f]:I,centerOffset:E-I-k,...N&&{alignmentOffset:k}},reset:N}}}),_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:u}=e,{mainAxis:d=!0,crossAxis:h=!0,fallbackPlacements:p,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:g=!0,...y}=nt(t,e);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const w=q(s),x=$(c),v=q(c)===c,A=await(l.isRTL==null?void 0:l.isRTL(u.floating)),b=p||(v||!g?[ut(c)]:Ne(c)),L=m!=="none";!p&&L&&b.push(...$e(c,g,m,A));const R=[c,...b],B=await Jt(e,y),M=[];let T=((o=i.flip)==null?void 0:o.overflows)||[];if(d&&M.push(B[w]),h){const E=Me(s,r,A);M.push(B[E[0]],B[E[1]])}if(T=[...T,{placement:s,overflows:M}],!M.every(E=>E<=0)){var z,_;const E=(((z=i.flip)==null?void 0:z.index)||0)+1,I=R[E];if(I&&(!(h==="alignment"?x!==$(I):!1)||T.every(D=>D.overflows[0]>0&&$(D.placement)===x)))return{data:{index:E,overflows:T},reset:{placement:I}};let N=(_=T.filter(k=>k.overflows[0]<=0).sort((k,D)=>k.overflows[1]-D.overflows[1])[0])==null?void 0:_.placement;if(!N)switch(f){case"bestFit":{var Q;const k=(Q=T.filter(D=>{if(L){const H=$(D.placement);return H===x||H==="y"}return!0}).map(D=>[D.placement,D.overflows.filter(H=>H>0).reduce((H,ye)=>H+ye,0)]).sort((D,H)=>D[1]-H[1])[0])==null?void 0:Q[0];k&&(N=k);break}case"initialPlacement":N=c;break}if(s!==N)return{reset:{placement:N}}}return{}}}};async function Ie(t,e){const{placement:n,platform:o,elements:s}=t,i=await(o.isRTL==null?void 0:o.isRTL(s.floating)),r=q(n),c=ot(n),l=$(n)==="y",u=["left","top"].includes(r)?-1:1,d=i&&l?-1:1,h=nt(e,t);let{mainAxis:p,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),l?{x:f*d,y:p*u}:{x:p*u,y:f*d}}const je=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 Ie(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}}}}},qe=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:y=>{let{x:w,y:x}=y;return{x:w,y:x}}},...l}=nt(t,e),u={x:n,y:o},d=await Jt(e,l),h=$(q(s)),p=Xt(h);let f=u[p],m=u[h];if(i){const y=p==="y"?"top":"left",w=p==="y"?"bottom":"right",x=f+d[y],v=f-d[w];f=xt(x,f,v)}if(r){const y=h==="y"?"top":"left",w=h==="y"?"bottom":"right",x=m+d[y],v=m-d[w];m=xt(x,m,v)}const g=c.fn({...e,[p]:f,[h]:m});return{...g,data:{x:g.x-n,y:g.y-o,enabled:{[p]:i,[h]:r}}}}}};function dt(){return typeof window<"u"}function G(t){return Gt(t)?(t.nodeName||"").toLowerCase():"#document"}function S(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function V(t){var e;return(e=(Gt(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function Gt(t){return dt()?t instanceof Node||t instanceof S(t).Node:!1}function W(t){return dt()?t instanceof Element||t instanceof S(t).Element:!1}function F(t){return dt()?t instanceof HTMLElement||t instanceof S(t).HTMLElement:!1}function Ft(t){return!dt()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof S(t).ShadowRoot}function st(t){const{overflow:e,overflowX:n,overflowY:o,display:s}=C(t);return/auto|scroll|overlay|hidden|clip/.test(e+o+n)&&!["inline","contents"].includes(s)}function Ye(t){return["table","td","th"].includes(G(t))}function mt(t){return[":popover-open",":modal"].some(e=>{try{return t.matches(e)}catch{return!1}})}function kt(t){const e=Dt(),n=W(t)?C(t):t;return["transform","translate","scale","rotate","perspective"].some(o=>n[o]?n[o]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||["transform","translate","scale","rotate","perspective","filter"].some(o=>(n.willChange||"").includes(o))||["paint","layout","strict","content"].some(o=>(n.contain||"").includes(o))}function Xe(t){let e=U(t);for(;F(e)&&!J(e);){if(kt(e))return e;if(mt(e))return null;e=U(e)}return null}function Dt(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function J(t){return["html","body","#document"].includes(G(t))}function C(t){return S(t).getComputedStyle(t)}function pt(t){return W(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function U(t){if(G(t)==="html")return t;const e=t.assignedSlot||t.parentNode||Ft(t)&&t.host||V(t);return Ft(e)?e.host:e}function Qt(t){const e=U(t);return J(e)?t.ownerDocument?t.ownerDocument.body:t.body:F(e)&&st(e)?e:Qt(e)}function tt(t,e,n){var o;e===void 0&&(e=[]),n===void 0&&(n=!0);const s=Qt(t),i=s===((o=t.ownerDocument)==null?void 0:o.body),r=S(s);if(i){const c=bt(r);return e.concat(r,r.visualViewport||[],st(s)?s:[],c&&n?tt(c):[])}return e.concat(s,tt(s,[],n))}function bt(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function Zt(t){const e=C(t);let n=parseFloat(e.width)||0,o=parseFloat(e.height)||0;const s=F(t),i=s?t.offsetWidth:n,r=s?t.offsetHeight:o,c=at(n)!==i||at(o)!==r;return c&&(n=i,o=r),{width:n,height:o,$:c}}function Wt(t){return W(t)?t:t.contextElement}function X(t){const e=Wt(t);if(!F(e))return P(1);const n=e.getBoundingClientRect(),{width:o,height:s,$:i}=Zt(e);let r=(i?at(n.width):n.width)/o,c=(i?at(n.height):n.height)/s;return(!r||!Number.isFinite(r))&&(r=1),(!c||!Number.isFinite(c))&&(c=1),{x:r,y:c}}const Ke=P(0);function te(t){const e=S(t);return!Dt()||!e.visualViewport?Ke:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function Je(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==S(t)?!1:e}function Y(t,e,n,o){e===void 0&&(e=!1),n===void 0&&(n=!1);const s=t.getBoundingClientRect(),i=Wt(t);let r=P(1);e&&(o?W(o)&&(r=X(o)):r=X(t));const c=Je(i,n,o)?te(i):P(0);let l=(s.left+c.x)/r.x,u=(s.top+c.y)/r.y,d=s.width/r.x,h=s.height/r.y;if(i){const p=S(i),f=o&&W(o)?S(o):o;let m=p,g=bt(m);for(;g&&o&&f!==m;){const y=X(g),w=g.getBoundingClientRect(),x=C(g),v=w.left+(g.clientLeft+parseFloat(x.paddingLeft))*y.x,A=w.top+(g.clientTop+parseFloat(x.paddingTop))*y.y;l*=y.x,u*=y.y,d*=y.x,h*=y.y,l+=v,u+=A,m=S(g),g=bt(m)}}return ft({width:d,height:h,x:l,y:u})}function Ct(t,e){const n=pt(t).scrollLeft;return e?e.left+n:Y(V(t)).left+n}function ee(t,e,n){n===void 0&&(n=!1);const o=t.getBoundingClientRect(),s=o.left+e.scrollLeft-(n?0:Ct(t,o)),i=o.top+e.scrollTop;return{x:s,y:i}}function Ge(t){let{elements:e,rect:n,offsetParent:o,strategy:s}=t;const i=s==="fixed",r=V(o),c=e?mt(e.floating):!1;if(o===r||c&&i)return n;let l={scrollLeft:0,scrollTop:0},u=P(1);const d=P(0),h=F(o);if((h||!h&&!i)&&((G(o)!=="body"||st(r))&&(l=pt(o)),F(o))){const f=Y(o);u=X(o),d.x=f.x+o.clientLeft,d.y=f.y+o.clientTop}const p=r&&!h&&!i?ee(r,l,!0):P(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-l.scrollLeft*u.x+d.x+p.x,y:n.y*u.y-l.scrollTop*u.y+d.y+p.y}}function Qe(t){return Array.from(t.getClientRects())}function Ze(t){const e=V(t),n=pt(t),o=t.ownerDocument.body,s=j(e.scrollWidth,e.clientWidth,o.scrollWidth,o.clientWidth),i=j(e.scrollHeight,e.clientHeight,o.scrollHeight,o.clientHeight);let r=-n.scrollLeft+Ct(t);const c=-n.scrollTop;return C(o).direction==="rtl"&&(r+=j(e.clientWidth,o.clientWidth)-s),{width:s,height:i,x:r,y:c}}function tn(t,e){const n=S(t),o=V(t),s=n.visualViewport;let i=o.clientWidth,r=o.clientHeight,c=0,l=0;if(s){i=s.width,r=s.height;const u=Dt();(!u||u&&e==="fixed")&&(c=s.offsetLeft,l=s.offsetTop)}return{width:i,height:r,x:c,y:l}}function en(t,e){const n=Y(t,!0,e==="fixed"),o=n.top+t.clientTop,s=n.left+t.clientLeft,i=F(t)?X(t):P(1),r=t.clientWidth*i.x,c=t.clientHeight*i.y,l=s*i.x,u=o*i.y;return{width:r,height:c,x:l,y:u}}function Vt(t,e,n){let o;if(e==="viewport")o=tn(t,n);else if(e==="document")o=Ze(V(t));else if(W(e))o=en(e,n);else{const s=te(t);o={x:e.x-s.x,y:e.y-s.y,width:e.width,height:e.height}}return ft(o)}function ne(t,e){const n=U(t);return n===e||!W(n)||J(n)?!1:C(n).position==="fixed"||ne(n,e)}function nn(t,e){const n=e.get(t);if(n)return n;let o=tt(t,[],!1).filter(c=>W(c)&&G(c)!=="body"),s=null;const i=C(t).position==="fixed";let r=i?U(t):t;for(;W(r)&&!J(r);){const c=C(r),l=kt(r);!l&&c.position==="fixed"&&(s=null),(i?!l&&!s:!l&&c.position==="static"&&!!s&&["absolute","fixed"].includes(s.position)||st(r)&&!l&&ne(t,r))?o=o.filter(d=>d!==r):s=c,r=U(r)}return e.set(t,o),o}function on(t){let{element:e,boundary:n,rootBoundary:o,strategy:s}=t;const r=[...n==="clippingAncestors"?mt(e)?[]:nn(e,this._c):[].concat(n),o],c=r[0],l=r.reduce((u,d)=>{const h=Vt(e,d,s);return u.top=j(h.top,u.top),u.right=K(h.right,u.right),u.bottom=K(h.bottom,u.bottom),u.left=j(h.left,u.left),u},Vt(e,c,s));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function sn(t){const{width:e,height:n}=Zt(t);return{width:e,height:n}}function rn(t,e,n){const o=F(e),s=V(e),i=n==="fixed",r=Y(t,!0,i,e);let c={scrollLeft:0,scrollTop:0};const l=P(0);function u(){l.x=Ct(s)}if(o||!o&&!i)if((G(e)!=="body"||st(s))&&(c=pt(e)),o){const f=Y(e,!0,i,e);l.x=f.x+e.clientLeft,l.y=f.y+e.clientTop}else s&&u();i&&!o&&s&&u();const d=s&&!o&&!i?ee(s,c):P(0),h=r.left+c.scrollLeft-l.x-d.x,p=r.top+c.scrollTop-l.y-d.y;return{x:h,y:p,width:r.width,height:r.height}}function yt(t){return C(t).position==="static"}function Mt(t,e){if(!F(t)||C(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return V(t)===n&&(n=n.ownerDocument.body),n}function oe(t,e){const n=S(t);if(mt(t))return n;if(!F(t)){let s=U(t);for(;s&&!J(s);){if(W(s)&&!yt(s))return s;s=U(s)}return n}let o=Mt(t,e);for(;o&&Ye(o)&&yt(o);)o=Mt(o,e);return o&&J(o)&&yt(o)&&!kt(o)?n:o||Xe(t)||n}const cn=async function(t){const e=this.getOffsetParent||oe,n=this.getDimensions,o=await n(t.floating);return{reference:rn(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function ln(t){return C(t).direction==="rtl"}const an={convertOffsetParentRelativeRectToViewportRelativeRect:Ge,getDocumentElement:V,getClippingRect:on,getOffsetParent:oe,getElementRects:cn,getClientRects:Qe,getDimensions:sn,getScale:X,isElement:W,isRTL:ln};function se(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function un(t,e){let n=null,o;const s=V(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 u=t.getBoundingClientRect(),{left:d,top:h,width:p,height:f}=u;if(c||e(),!p||!f)return;const m=rt(h),g=rt(s.clientWidth-(d+p)),y=rt(s.clientHeight-(h+f)),w=rt(d),v={rootMargin:-m+"px "+-g+"px "+-y+"px "+-w+"px",threshold:j(0,K(1,l))||1};let A=!0;function b(L){const R=L[0].intersectionRatio;if(R!==l){if(!A)return r();R?r(!1,R):o=setTimeout(()=>{r(!1,1e-7)},1e3)}R===1&&!se(u,t.getBoundingClientRect())&&r(),A=!1}try{n=new IntersectionObserver(b,{...v,root:s.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(t)}return r(!0),i}function fn(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,u=Wt(t),d=s||i?[...u?tt(u):[],...tt(e)]:[];d.forEach(w=>{s&&w.addEventListener("scroll",n,{passive:!0}),i&&w.addEventListener("resize",n)});const h=u&&c?un(u,n):null;let p=-1,f=null;r&&(f=new ResizeObserver(w=>{let[x]=w;x&&x.target===u&&f&&(f.unobserve(e),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var v;(v=f)==null||v.observe(e)})),n()}),u&&!l&&f.observe(u),f.observe(e));let m,g=l?Y(t):null;l&&y();function y(){const w=Y(t);g&&!se(g,w)&&n(),g=w,m=requestAnimationFrame(y)}return n(),()=>{var w;d.forEach(x=>{s&&x.removeEventListener("scroll",n),i&&x.removeEventListener("resize",n)}),h==null||h(),(w=f)==null||w.disconnect(),f=null,l&&cancelAnimationFrame(m)}}const hn=je,dn=qe,Nt=_e,mn=ze,pn=(t,e,n)=>{const o=new Map,s={platform:an,...n},i={...s.platform,_c:o};return Be(t,e,{...s,platform:i})},gn=({content:t,open:e,placement:n,offset:o={mainAxis:0,crossAxis:0},arrow:s})=>a.WithBrowserCtx(i=>{const r=a.Value.toSignal(e),c=i.element,l=a.Value.toSignal(o),u=l.$.mainAxis.map(f=>f??0),d=l.$.crossAxis.map(f=>f??0),h=a.Value.toSignal(n??"top"),p=a.prop({centerOffset:0,alignmentOffset:0,containerWidth:0,containerHeight:0,x:void 0,y:void 0});return a.When(r,()=>a.Portal("body",a.html.div(a.WithElement(f=>{var x;const m=f;m.style.position="absolute";let g=null;async function y(){const v=[Nt(),hn({mainAxis:u.get(),crossAxis:d.get()}),dn(),Nt()];s!=null&&g!=null&&v.push(mn({element:g,padding:(s==null?void 0:s.padding)??0}));const A=await pn(c,m,{placement:h.get(),strategy:"absolute",middleware:v}),{x:b,y:L,middlewareData:R}=A;if(m.style.top=`${Math.round(L)}px`,m.style.left=`${Math.round(b)}px`,g!=null&&R.arrow!=null){const{x:B,y:M,centerOffset:T,alignmentOffset:z}=R.arrow;p.set({x:B,y:M,centerOffset:T,alignmentOffset:z,containerWidth:m.offsetWidth,containerHeight:m.offsetHeight})}}const w=a.effectOf(u,d,h)(y);return a.Fragment(s!=null?a.html.div((x=s.content)==null?void 0:x.call(s,a.computedOf(p,h)((v,A)=>({...v,placement:A}))),a.WithElement(v=>{g=v,y()})):null,a.OnDispose(p.dispose,fn(c,m,y),w))}),t())))}),ie=(t,e,n)=>{const o=a.prop(O.AsyncResult.notAsked),s=o.map(h=>O.AsyncResult.isSuccess(h)?h.value:void 0),i=o.map(h=>O.AsyncResult.isFailure(h)?h.error:void 0),r=o.map(h=>O.AsyncResult.isLoading(h));let c;const l=async h=>{c==null||c.abort(),c=new AbortController;const p=c.signal,f=o.get();o.set(O.AsyncResult.loading(O.AsyncResult.getOrUndefined(f)));try{const m=await e({request:h,abortSignal:p,previous:f});await Promise.resolve(),c=void 0,o.set(O.AsyncResult.success(m))}catch(m){c=void 0,o.set(O.AsyncResult.failure(n(m)))}},u=()=>l(a.Value.get(t)),d=()=>{c==null||c.abort(),c=void 0,o.dispose()};return o.onDispose(a.Value.on(t,l)),{status:o,value:s,error:i,loading:r,reload:u,dispose:d}},re=(t,e)=>{const{status:n,dispose:o,reload:s}=t,{loading:i,failure:r,success:c}=e;return a.Fragment(a.OnDispose(o),St(n,{loading:i!=null?l=>i(l,s):void 0,failure:r!=null?l=>r(l,s):void 0,success:l=>c(l,s)}))},yn=({request:t,load:e,mapError:n=o=>o})=>{const o=ie(t,e,n);return s=>re(o,s)},ce=(t,e)=>{if(typeof e=="function")return ce(t,{success:e});const n=e.failure??(s=>a.Fragment(a.OnDispose(s.on(console.error)),s.map(i=>`Error: ${i}`))),o=e.success;return a.OneOfType(a.Value.toSignal(t),{Success:s=>o(s.$.value),Failure:s=>n(s.$.error)})},wn=()=>a.on.focus(t=>{var e;return(e=t.target)==null?void 0:e.select()});class it{constructor(e,n,o,s){gt(this,"equals",e=>O.nearEqual(this.left,e.left)&&O.nearEqual(this.top,e.top)&&O.nearEqual(this.width,e.width)&&O.nearEqual(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 it(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 At(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 le=t=>a.WithBrowserCtx(e=>{const{element:n}=e,o=a.prop(At(n)),s=a.renderableOfTNode(t(o))(e),i=()=>{o.set(it.of(At(n)))};let r;return typeof ResizeObserver=="function"&&(r=new ResizeObserver(i),r.observe(n)),a.OnDispose(c=>{r==null||r.disconnect(),s(c)})}),xn=t=>le(t),vn=t=>e=>{const n=a.getWindow(),o=a.prop({width:(n==null?void 0:n.innerWidth)??0,height:(n==null?void 0:n.innerHeight)??0}),s=a.renderableOfTNode(t(o))(e),i=()=>{o.set({width:(n==null?void 0:n.innerWidth)??0,height:(n==null?void 0:n.innerHeight)??0})};return n==null||n.addEventListener("resize",i),r=>{n==null||n.removeEventListener("resize",i),s(r)}},ae=(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}},ue=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!==""),fe=t=>{const e=t.map(n=>{const o=ue(n);return{route:n,segments:o}});return function(o){for(const{segments:s,route:i}of e){const r=ae(s,o);if(r)return{...r,route:i}}return null}},bn=t=>{const e=fe(Object.keys(t));return a.Use(Ot,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 a.OneOfTuple(o.map(s=>[s.route,s]),t)})},ht=60*1e3,Rt=60*ht,et=24*Rt,Ht=7*et,$t=30*et,An=365*et,Rn=[{max:ht*90,value:ht,name:"minute",past:{singular:"a minute ago",plural:"{} minutes ago"},future:{singular:"in a minute",plural:"in {} minutes"}},{max:Rt*36,value:Rt,name:"hour",past:{singular:"an hour ago",plural:"{} hours ago"},future:{singular:"in an hour",plural:"in {} hours"}},{max:et*10,value:et,name:"day",past:{singular:"yesterday",plural:"{} days ago"},future:{singular:"tomorrow",plural:"in {} days"}},{max:Ht*6,value:Ht,name:"week",past:{singular:"last week",plural:"{} weeks ago"},future:{singular:"in a week",plural:"in {} weeks"}},{max:$t*18,value:$t,name:"month",past:{singular:"last month",plural:"{} months ago"},future:{singular:"in a month",plural:"in {} months"}},{max:1/0,value:An,name:"year",past:{singular:"last year",plural:"{} years ago"},future:{singular:"in a year",plural:"in {} years"}}];function Ut(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 he=(t=1e3)=>{const e=a.prop(new Date),n=O.interval(()=>e.set(new Date),t);return e.onDispose(n),e},de=t=>{const e=Math.abs(t);if(e<ht)return t<0?"just now":"in a moment";for(const n of Rn)if(e<n.max)return t<0?Ut(e,n.value,n.past.singular,n.past.plural):Ut(e,n.value,n.future.singular,n.future.plural);throw new Error("unreachable")},me=(t,{now:e,frequency:n=1e4}={})=>{const o=e!=null?a.Signal.is(e)?e.derive():a.prop(e):he(n),s=a.computedOf(t,o)((i,r)=>i.getTime()-r.getTime());return s.onDispose(()=>a.Value.dispose(o)),s},pe=(t,e={})=>{const n=me(t,e),o=n.map(de);return o.onDispose(n.dispose),o},En=(t,e={})=>pe(t,e);class ge extends a.Prop{constructor(){super(...arguments);gt(this,"tick",()=>this.update(n=>n+1))}}const On=(t=0)=>new ge(t,(e,n)=>e===n);exports.Anchor=jt;exports.Appearance=Se;exports.AsyncResultView=St;exports.AutoFocus=Le;exports.AutoSelect=Te;exports.ElementRect=le;exports.ElementSize=xn;exports.HTMLTitle=De;exports.HiddenWhenEmpty=ke;exports.InViewport=Yt;exports.Location=Ot;exports.PopOver=gn;exports.Rect=it;exports.Resource=yn;exports.ResourceDisplay=re;exports.ResultView=ce;exports.Router=bn;exports.SelectOnFocus=wn;exports.Ticker=ge;exports.WhenInViewport=Pe;exports.WindowSize=vn;exports._checkExtensionCondition=zt;exports._getExtension=Bt;exports._makeRouteMatcher=fe;exports._parseRouteSegments=ue;exports.areLocationsEqual=It;exports.getAbsoluteRect=At;exports.handleAnchorClick=_t;exports.locationFromURL=Et;exports.makeResource=ie;exports.matchesRoute=ae;exports.nowSignal=he;exports.relativeTime=En;exports.relativeTimeMillisSignal=me;exports.relativeTimeSignal=pe;exports.setLocationFromUrl=wt;exports.ticker=On;exports.timeDiffToString=de;exports.urlFromLocation=lt;exports.useAppearance=qt;
|
|
1
|
+
"use strict";var we=Object.defineProperty;var xe=(t,e,n)=>e in t?we(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var gt=(t,e,n)=>xe(t,typeof e!="symbol"?e+"":e,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("@tempots/dom"),O=require("@tempots/std"),Bt=t=>{const e=t.split("/").pop();if(e==null||e.startsWith("."))return;const n=e.split(".")||[];return n.length>1?"."+n.pop():void 0},zt=(t,e)=>{const n=Bt(e);return n!=null&&(t.length===0||!t.some(o=>n==o))},ve=(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 u=r+c+l,d=i.getAttribute("href");if(!(d!=null&&d.startsWith("#"))&&d!==u)return!0}return e?!1:zt(n,r)},_t=(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=>{ve(o,e.ignoreUrlWithExtension??!0,n,e.ignoreExternalUrl??!0)||t()&&o.preventDefault()}},It=(t,e)=>t.pathname===e.pathname&&JSON.stringify(t.search)===JSON.stringify(e.search)&&t.hash===e.hash,Et=(t,e)=>{var i;const n=new URL(t,e??((i=a.getWindow())==null?void 0:i.location.toString())),o=Object.fromEntries(n.searchParams.entries());let s=n.hash;return s.startsWith("#")&&(s=s.substring(1)),{pathname:n.pathname,search:o,hash:s===""?void 0:s}},wt=(t,e)=>{const n=Et(e);return t.set(n),t},lt=t=>{const n=new URLSearchParams(t.search).toString(),o=t.hash;return`${t.pathname}${n?`?${n}`:""}${o?`#${o}`:""}`},be=t=>t.startsWith("http://")||t.startsWith("https://")||t.startsWith("//"),Ae=t=>{const e=t.container.currentURL,n=e.iso(o=>Et(o),o=>{if(be(o.pathname))return lt(o);const s=new URL(o.pathname,e.value),i=s.origin+s.pathname;return lt({...o,pathname:i})});return{value:n,dispose:n.dispose}},Re=()=>{const t=a.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}},Ee=()=>{const t=a.prop(Re(),It),e=a.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({},"",lt(o))}),{value:t,dispose:t.dispose}},Ot={mark:a.makeProviderMark("LocationProvider"),create:(t,e)=>{if(e.isBrowser())return Ee();if(e.isHeadless())return Ae(e);throw new Error("Unknown context")}},Oe=t=>{document.startViewTransition?document.startViewTransition(t):t()},jt=(t,...e)=>{if(typeof t=="string"||a.Signal.is(t))return jt({href:t},...e);const{href:n,withViewTransition:o,...s}=t;return a.Use(Ot,i=>a.html.a(a.on.click(_t(()=>(o==!0?Oe(()=>{wt(i,a.Value.get(n))}):wt(i,a.Value.get(n)),!0),s)),a.attr.href(n),...e))},Se={mark:a.makeProviderMark("Appearance"),create:()=>{const t=qt();return{value:t,dispose:t.dispose}}};function qt(){const t=a.getWindow(),e=t!=null&&t.matchMedia!=null?t.matchMedia("(prefers-color-scheme: dark)"):void 0,n=(e==null?void 0:e.matches)??!1,o=a.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 St=(t,e)=>{if(typeof e=="function")return St(t,{success:e});const n=e.failure??(r=>r.map(c=>`Error: ${c}`)),o=e.success,s=e.loading??(()=>a.Empty),i=e.notAsked??(()=>a.Empty);return a.OneOfType(a.Value.toSignal(t),{AsyncSuccess:r=>o(r.$.value),AsyncFailure:r=>n(r.$.error),Loading:r=>s(r.map(c=>c.previousValue)),NotAsked:i})},Le=(t=10)=>a.WithElement(e=>a.OnDispose(O.delayed(()=>e==null?void 0:e.focus(),t))),Te=(t=10)=>a.WithElement(e=>{const n=O.delayed(()=>e.select(),t);return a.OnDispose(n)}),ke=a.WithElement(t=>{const e=t.style.getPropertyValue(":empty");return t.style.setProperty(":empty","display:none"),a.OnDispose(n=>{n&&t.style.setProperty(":empty",e)})}),De=t=>a.Portal("head > title",a.attr.innerText(t)),We={partial:{root:null,rootMargin:"0px",threshold:0},full:{root:null,rootMargin:"0px",threshold:1}},ct={partial:new Map,full:new Map},Z={partial:null,full:null};function Ce(t){return Z[t]==null&&(Z[t]=new IntersectionObserver(e=>{e.forEach(n=>{const o=ct[t].get(n.target);o==null||o.set(n.isIntersecting)})},We[t])),Z[t]}const Yt=({mode:t="partial",once:e=!1},n)=>{const o=a.prop(!1);return a.Fragment(a.WithElement(s=>{const i=typeof IntersectionObserver<"u"?Ce(t):null;ct[t].set(s,o),i==null||i.observe(s);function r(){var l;i==null||i.unobserve(s),ct[t].delete(s),ct[t].size===0&&((l=Z[t])==null||l.disconnect(),Z[t]=null)}let c=null;return e&&(c=o.on(l=>{l&&r()})),a.OnDispose(()=>{o.dispose(),r(),c==null||c()})}),a.renderableOfTNode(n(o)))},Pe=(t,e,n)=>Yt(t,o=>a.When(o,e,n??(()=>a.Empty))),K=Math.min,j=Math.max,at=Math.round,rt=Math.floor,P=t=>({x:t,y:t}),Fe={left:"right",right:"left",bottom:"top",top:"bottom"},Ve={start:"end",end:"start"};function xt(t,e,n){return j(t,K(e,n))}function nt(t,e){return typeof t=="function"?t(e):t}function q(t){return t.split("-")[0]}function ot(t){return t.split("-")[1]}function Xt(t){return t==="x"?"y":"x"}function Lt(t){return t==="y"?"height":"width"}function $(t){return["top","bottom"].includes(q(t))?"y":"x"}function Tt(t){return Xt($(t))}function Me(t,e,n){n===void 0&&(n=!1);const o=ot(t),s=Tt(t),i=Lt(s);let r=s==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(r=ut(r)),[r,ut(r)]}function Ne(t){const e=ut(t);return[vt(t),e,vt(e)]}function vt(t){return t.replace(/start|end/g,e=>Ve[e])}function He(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 $e(t,e,n,o){const s=ot(t);let i=He(q(t),n==="start",o);return s&&(i=i.map(r=>r+"-"+s),e&&(i=i.concat(i.map(vt)))),i}function ut(t){return t.replace(/left|right|bottom|top/g,e=>Fe[e])}function Ue(t){return{top:0,right:0,bottom:0,left:0,...t}}function Kt(t){return typeof t!="number"?Ue(t):{top:t,right:t,bottom:t,left:t}}function ft(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 Pt(t,e,n){let{reference:o,floating:s}=t;const i=$(e),r=Tt(e),c=Lt(r),l=q(e),u=i==="y",d=o.x+o.width/2-s.width/2,h=o.y+o.height/2-s.height/2,p=o[c]/2-s[c]/2;let f;switch(l){case"top":f={x:d,y:o.y-s.height};break;case"bottom":f={x:d,y:o.y+o.height};break;case"right":f={x:o.x+o.width,y:h};break;case"left":f={x:o.x-s.width,y:h};break;default:f={x:o.x,y:o.y}}switch(ot(e)){case"start":f[r]-=p*(n&&u?-1:1);break;case"end":f[r]+=p*(n&&u?-1:1);break}return f}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 u=await r.getElementRects({reference:t,floating:e,strategy:s}),{x:d,y:h}=Pt(u,o,l),p=o,f={},m=0;for(let g=0;g<c.length;g++){const{name:y,fn:w}=c[g],{x,y:v,data:A,reset:b}=await w({x:d,y:h,initialPlacement:o,placement:p,strategy:s,middlewareData:f,rects:u,platform:r,elements:{reference:t,floating:e}});d=x??d,h=v??h,f={...f,[y]:{...f[y],...A}},b&&m<=50&&(m++,typeof b=="object"&&(b.placement&&(p=b.placement),b.rects&&(u=b.rects===!0?await r.getElementRects({reference:t,floating:e,strategy:s}):b.rects),{x:d,y:h}=Pt(u,p,l)),g=-1)}return{x:d,y:h,placement:p,strategy:s,middlewareData:f}};async function Jt(t,e){var n;e===void 0&&(e={});const{x:o,y:s,platform:i,rects:r,elements:c,strategy:l}=t,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:h="floating",altBoundary:p=!1,padding:f=0}=nt(e,t),m=Kt(f),y=c[p?h==="floating"?"reference":"floating":h],w=ft(await i.getClippingRect({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)),boundary:u,rootBoundary:d,strategy:l})),x=h==="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=ft(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:x,offsetParent:v,strategy:l}):x);return{top:(w.top-b.top+m.top)/A.y,bottom:(b.bottom-w.bottom+m.bottom)/A.y,left:(w.left-b.left+m.left)/A.x,right:(b.right-w.right+m.right)/A.x}}const ze=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:o,placement:s,rects:i,platform:r,elements:c,middlewareData:l}=e,{element:u,padding:d=0}=nt(t,e)||{};if(u==null)return{};const h=Kt(d),p={x:n,y:o},f=Tt(s),m=Lt(f),g=await r.getDimensions(u),y=f==="y",w=y?"top":"left",x=y?"bottom":"right",v=y?"clientHeight":"clientWidth",A=i.reference[m]+i.reference[f]-p[f]-i.floating[m],b=p[f]-i.reference[f],L=await(r.getOffsetParent==null?void 0:r.getOffsetParent(u));let R=L?L[v]:0;(!R||!await(r.isElement==null?void 0:r.isElement(L)))&&(R=c.floating[v]||i.floating[m]);const B=A/2-b/2,M=R/2-g[m]/2-1,T=K(h[w],M),z=K(h[x],M),_=T,Q=R-g[m]-z,E=R/2-g[m]/2+B,I=xt(_,E,Q),N=!l.arrow&&ot(s)!=null&&E!==I&&i.reference[m]/2-(E<_?T:z)-g[m]/2<0,k=N?E<_?E-_:E-Q:0;return{[f]:p[f]+k,data:{[f]:I,centerOffset:E-I-k,...N&&{alignmentOffset:k}},reset:N}}}),_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:u}=e,{mainAxis:d=!0,crossAxis:h=!0,fallbackPlacements:p,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:g=!0,...y}=nt(t,e);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const w=q(s),x=$(c),v=q(c)===c,A=await(l.isRTL==null?void 0:l.isRTL(u.floating)),b=p||(v||!g?[ut(c)]:Ne(c)),L=m!=="none";!p&&L&&b.push(...$e(c,g,m,A));const R=[c,...b],B=await Jt(e,y),M=[];let T=((o=i.flip)==null?void 0:o.overflows)||[];if(d&&M.push(B[w]),h){const E=Me(s,r,A);M.push(B[E[0]],B[E[1]])}if(T=[...T,{placement:s,overflows:M}],!M.every(E=>E<=0)){var z,_;const E=(((z=i.flip)==null?void 0:z.index)||0)+1,I=R[E];if(I&&(!(h==="alignment"?x!==$(I):!1)||T.every(D=>D.overflows[0]>0&&$(D.placement)===x)))return{data:{index:E,overflows:T},reset:{placement:I}};let N=(_=T.filter(k=>k.overflows[0]<=0).sort((k,D)=>k.overflows[1]-D.overflows[1])[0])==null?void 0:_.placement;if(!N)switch(f){case"bestFit":{var Q;const k=(Q=T.filter(D=>{if(L){const H=$(D.placement);return H===x||H==="y"}return!0}).map(D=>[D.placement,D.overflows.filter(H=>H>0).reduce((H,ye)=>H+ye,0)]).sort((D,H)=>D[1]-H[1])[0])==null?void 0:Q[0];k&&(N=k);break}case"initialPlacement":N=c;break}if(s!==N)return{reset:{placement:N}}}return{}}}};async function Ie(t,e){const{placement:n,platform:o,elements:s}=t,i=await(o.isRTL==null?void 0:o.isRTL(s.floating)),r=q(n),c=ot(n),l=$(n)==="y",u=["left","top"].includes(r)?-1:1,d=i&&l?-1:1,h=nt(e,t);let{mainAxis:p,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),l?{x:f*d,y:p*u}:{x:p*u,y:f*d}}const je=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 Ie(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}}}}},qe=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:y=>{let{x:w,y:x}=y;return{x:w,y:x}}},...l}=nt(t,e),u={x:n,y:o},d=await Jt(e,l),h=$(q(s)),p=Xt(h);let f=u[p],m=u[h];if(i){const y=p==="y"?"top":"left",w=p==="y"?"bottom":"right",x=f+d[y],v=f-d[w];f=xt(x,f,v)}if(r){const y=h==="y"?"top":"left",w=h==="y"?"bottom":"right",x=m+d[y],v=m-d[w];m=xt(x,m,v)}const g=c.fn({...e,[p]:f,[h]:m});return{...g,data:{x:g.x-n,y:g.y-o,enabled:{[p]:i,[h]:r}}}}}};function dt(){return typeof window<"u"}function G(t){return Gt(t)?(t.nodeName||"").toLowerCase():"#document"}function S(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function V(t){var e;return(e=(Gt(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function Gt(t){return dt()?t instanceof Node||t instanceof S(t).Node:!1}function W(t){return dt()?t instanceof Element||t instanceof S(t).Element:!1}function F(t){return dt()?t instanceof HTMLElement||t instanceof S(t).HTMLElement:!1}function Ft(t){return!dt()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof S(t).ShadowRoot}function st(t){const{overflow:e,overflowX:n,overflowY:o,display:s}=C(t);return/auto|scroll|overlay|hidden|clip/.test(e+o+n)&&!["inline","contents"].includes(s)}function Ye(t){return["table","td","th"].includes(G(t))}function mt(t){return[":popover-open",":modal"].some(e=>{try{return t.matches(e)}catch{return!1}})}function kt(t){const e=Dt(),n=W(t)?C(t):t;return["transform","translate","scale","rotate","perspective"].some(o=>n[o]?n[o]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||["transform","translate","scale","rotate","perspective","filter"].some(o=>(n.willChange||"").includes(o))||["paint","layout","strict","content"].some(o=>(n.contain||"").includes(o))}function Xe(t){let e=U(t);for(;F(e)&&!J(e);){if(kt(e))return e;if(mt(e))return null;e=U(e)}return null}function Dt(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function J(t){return["html","body","#document"].includes(G(t))}function C(t){return S(t).getComputedStyle(t)}function pt(t){return W(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function U(t){if(G(t)==="html")return t;const e=t.assignedSlot||t.parentNode||Ft(t)&&t.host||V(t);return Ft(e)?e.host:e}function Qt(t){const e=U(t);return J(e)?t.ownerDocument?t.ownerDocument.body:t.body:F(e)&&st(e)?e:Qt(e)}function tt(t,e,n){var o;e===void 0&&(e=[]),n===void 0&&(n=!0);const s=Qt(t),i=s===((o=t.ownerDocument)==null?void 0:o.body),r=S(s);if(i){const c=bt(r);return e.concat(r,r.visualViewport||[],st(s)?s:[],c&&n?tt(c):[])}return e.concat(s,tt(s,[],n))}function bt(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function Zt(t){const e=C(t);let n=parseFloat(e.width)||0,o=parseFloat(e.height)||0;const s=F(t),i=s?t.offsetWidth:n,r=s?t.offsetHeight:o,c=at(n)!==i||at(o)!==r;return c&&(n=i,o=r),{width:n,height:o,$:c}}function Wt(t){return W(t)?t:t.contextElement}function X(t){const e=Wt(t);if(!F(e))return P(1);const n=e.getBoundingClientRect(),{width:o,height:s,$:i}=Zt(e);let r=(i?at(n.width):n.width)/o,c=(i?at(n.height):n.height)/s;return(!r||!Number.isFinite(r))&&(r=1),(!c||!Number.isFinite(c))&&(c=1),{x:r,y:c}}const Ke=P(0);function te(t){const e=S(t);return!Dt()||!e.visualViewport?Ke:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function Je(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==S(t)?!1:e}function Y(t,e,n,o){e===void 0&&(e=!1),n===void 0&&(n=!1);const s=t.getBoundingClientRect(),i=Wt(t);let r=P(1);e&&(o?W(o)&&(r=X(o)):r=X(t));const c=Je(i,n,o)?te(i):P(0);let l=(s.left+c.x)/r.x,u=(s.top+c.y)/r.y,d=s.width/r.x,h=s.height/r.y;if(i){const p=S(i),f=o&&W(o)?S(o):o;let m=p,g=bt(m);for(;g&&o&&f!==m;){const y=X(g),w=g.getBoundingClientRect(),x=C(g),v=w.left+(g.clientLeft+parseFloat(x.paddingLeft))*y.x,A=w.top+(g.clientTop+parseFloat(x.paddingTop))*y.y;l*=y.x,u*=y.y,d*=y.x,h*=y.y,l+=v,u+=A,m=S(g),g=bt(m)}}return ft({width:d,height:h,x:l,y:u})}function Ct(t,e){const n=pt(t).scrollLeft;return e?e.left+n:Y(V(t)).left+n}function ee(t,e,n){n===void 0&&(n=!1);const o=t.getBoundingClientRect(),s=o.left+e.scrollLeft-(n?0:Ct(t,o)),i=o.top+e.scrollTop;return{x:s,y:i}}function Ge(t){let{elements:e,rect:n,offsetParent:o,strategy:s}=t;const i=s==="fixed",r=V(o),c=e?mt(e.floating):!1;if(o===r||c&&i)return n;let l={scrollLeft:0,scrollTop:0},u=P(1);const d=P(0),h=F(o);if((h||!h&&!i)&&((G(o)!=="body"||st(r))&&(l=pt(o)),F(o))){const f=Y(o);u=X(o),d.x=f.x+o.clientLeft,d.y=f.y+o.clientTop}const p=r&&!h&&!i?ee(r,l,!0):P(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-l.scrollLeft*u.x+d.x+p.x,y:n.y*u.y-l.scrollTop*u.y+d.y+p.y}}function Qe(t){return Array.from(t.getClientRects())}function Ze(t){const e=V(t),n=pt(t),o=t.ownerDocument.body,s=j(e.scrollWidth,e.clientWidth,o.scrollWidth,o.clientWidth),i=j(e.scrollHeight,e.clientHeight,o.scrollHeight,o.clientHeight);let r=-n.scrollLeft+Ct(t);const c=-n.scrollTop;return C(o).direction==="rtl"&&(r+=j(e.clientWidth,o.clientWidth)-s),{width:s,height:i,x:r,y:c}}function tn(t,e){const n=S(t),o=V(t),s=n.visualViewport;let i=o.clientWidth,r=o.clientHeight,c=0,l=0;if(s){i=s.width,r=s.height;const u=Dt();(!u||u&&e==="fixed")&&(c=s.offsetLeft,l=s.offsetTop)}return{width:i,height:r,x:c,y:l}}function en(t,e){const n=Y(t,!0,e==="fixed"),o=n.top+t.clientTop,s=n.left+t.clientLeft,i=F(t)?X(t):P(1),r=t.clientWidth*i.x,c=t.clientHeight*i.y,l=s*i.x,u=o*i.y;return{width:r,height:c,x:l,y:u}}function Vt(t,e,n){let o;if(e==="viewport")o=tn(t,n);else if(e==="document")o=Ze(V(t));else if(W(e))o=en(e,n);else{const s=te(t);o={x:e.x-s.x,y:e.y-s.y,width:e.width,height:e.height}}return ft(o)}function ne(t,e){const n=U(t);return n===e||!W(n)||J(n)?!1:C(n).position==="fixed"||ne(n,e)}function nn(t,e){const n=e.get(t);if(n)return n;let o=tt(t,[],!1).filter(c=>W(c)&&G(c)!=="body"),s=null;const i=C(t).position==="fixed";let r=i?U(t):t;for(;W(r)&&!J(r);){const c=C(r),l=kt(r);!l&&c.position==="fixed"&&(s=null),(i?!l&&!s:!l&&c.position==="static"&&!!s&&["absolute","fixed"].includes(s.position)||st(r)&&!l&&ne(t,r))?o=o.filter(d=>d!==r):s=c,r=U(r)}return e.set(t,o),o}function on(t){let{element:e,boundary:n,rootBoundary:o,strategy:s}=t;const r=[...n==="clippingAncestors"?mt(e)?[]:nn(e,this._c):[].concat(n),o],c=r[0],l=r.reduce((u,d)=>{const h=Vt(e,d,s);return u.top=j(h.top,u.top),u.right=K(h.right,u.right),u.bottom=K(h.bottom,u.bottom),u.left=j(h.left,u.left),u},Vt(e,c,s));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function sn(t){const{width:e,height:n}=Zt(t);return{width:e,height:n}}function rn(t,e,n){const o=F(e),s=V(e),i=n==="fixed",r=Y(t,!0,i,e);let c={scrollLeft:0,scrollTop:0};const l=P(0);function u(){l.x=Ct(s)}if(o||!o&&!i)if((G(e)!=="body"||st(s))&&(c=pt(e)),o){const f=Y(e,!0,i,e);l.x=f.x+e.clientLeft,l.y=f.y+e.clientTop}else s&&u();i&&!o&&s&&u();const d=s&&!o&&!i?ee(s,c):P(0),h=r.left+c.scrollLeft-l.x-d.x,p=r.top+c.scrollTop-l.y-d.y;return{x:h,y:p,width:r.width,height:r.height}}function yt(t){return C(t).position==="static"}function Mt(t,e){if(!F(t)||C(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return V(t)===n&&(n=n.ownerDocument.body),n}function oe(t,e){const n=S(t);if(mt(t))return n;if(!F(t)){let s=U(t);for(;s&&!J(s);){if(W(s)&&!yt(s))return s;s=U(s)}return n}let o=Mt(t,e);for(;o&&Ye(o)&&yt(o);)o=Mt(o,e);return o&&J(o)&&yt(o)&&!kt(o)?n:o||Xe(t)||n}const cn=async function(t){const e=this.getOffsetParent||oe,n=this.getDimensions,o=await n(t.floating);return{reference:rn(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function ln(t){return C(t).direction==="rtl"}const an={convertOffsetParentRelativeRectToViewportRelativeRect:Ge,getDocumentElement:V,getClippingRect:on,getOffsetParent:oe,getElementRects:cn,getClientRects:Qe,getDimensions:sn,getScale:X,isElement:W,isRTL:ln};function se(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function un(t,e){let n=null,o;const s=V(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 u=t.getBoundingClientRect(),{left:d,top:h,width:p,height:f}=u;if(c||e(),!p||!f)return;const m=rt(h),g=rt(s.clientWidth-(d+p)),y=rt(s.clientHeight-(h+f)),w=rt(d),v={rootMargin:-m+"px "+-g+"px "+-y+"px "+-w+"px",threshold:j(0,K(1,l))||1};let A=!0;function b(L){const R=L[0].intersectionRatio;if(R!==l){if(!A)return r();R?r(!1,R):o=setTimeout(()=>{r(!1,1e-7)},1e3)}R===1&&!se(u,t.getBoundingClientRect())&&r(),A=!1}try{n=new IntersectionObserver(b,{...v,root:s.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(t)}return r(!0),i}function fn(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,u=Wt(t),d=s||i?[...u?tt(u):[],...tt(e)]:[];d.forEach(w=>{s&&w.addEventListener("scroll",n,{passive:!0}),i&&w.addEventListener("resize",n)});const h=u&&c?un(u,n):null;let p=-1,f=null;r&&(f=new ResizeObserver(w=>{let[x]=w;x&&x.target===u&&f&&(f.unobserve(e),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var v;(v=f)==null||v.observe(e)})),n()}),u&&!l&&f.observe(u),f.observe(e));let m,g=l?Y(t):null;l&&y();function y(){const w=Y(t);g&&!se(g,w)&&n(),g=w,m=requestAnimationFrame(y)}return n(),()=>{var w;d.forEach(x=>{s&&x.removeEventListener("scroll",n),i&&x.removeEventListener("resize",n)}),h==null||h(),(w=f)==null||w.disconnect(),f=null,l&&cancelAnimationFrame(m)}}const hn=je,dn=qe,Nt=_e,mn=ze,pn=(t,e,n)=>{const o=new Map,s={platform:an,...n},i={...s.platform,_c:o};return Be(t,e,{...s,platform:i})},gn=({content:t,open:e,placement:n,offset:o={mainAxis:0,crossAxis:0},arrow:s})=>a.WithBrowserCtx(i=>{const r=a.Value.toSignal(e),c=i.element,l=a.Value.toSignal(o),u=l.$.mainAxis.map(f=>f??0),d=l.$.crossAxis.map(f=>f??0),h=a.Value.toSignal(n??"top"),p=a.prop({centerOffset:0,alignmentOffset:0,containerWidth:0,containerHeight:0,x:void 0,y:void 0});return a.When(r,()=>a.Portal("body",a.html.div(a.WithElement(f=>{var x;const m=f;m.style.position="absolute";let g=null;async function y(){const v=[Nt(),hn({mainAxis:u.get(),crossAxis:d.get()}),dn(),Nt()];s!=null&&g!=null&&v.push(mn({element:g,padding:(s==null?void 0:s.padding)??0}));const A=await pn(c,m,{placement:h.get(),strategy:"absolute",middleware:v}),{x:b,y:L,middlewareData:R}=A;if(m.style.top=`${L}px`,m.style.left=`${b}px`,g!=null&&R.arrow!=null){const{x:B,y:M,centerOffset:T,alignmentOffset:z}=R.arrow;p.set({x:B,y:M,centerOffset:T,alignmentOffset:z,containerWidth:m.offsetWidth,containerHeight:m.offsetHeight})}}const w=a.effectOf(u,d,h)(y);return a.Fragment(s!=null?a.html.div((x=s.content)==null?void 0:x.call(s,a.computedOf(p,h)((v,A)=>({...v,placement:A}))),a.WithElement(v=>{g=v,y()})):null,a.OnDispose(p.dispose,fn(c,m,y),w))}),t())))}),ie=(t,e,n)=>{const o=a.prop(O.AsyncResult.notAsked),s=o.map(h=>O.AsyncResult.isSuccess(h)?h.value:void 0),i=o.map(h=>O.AsyncResult.isFailure(h)?h.error:void 0),r=o.map(h=>O.AsyncResult.isLoading(h));let c;const l=async h=>{c==null||c.abort(),c=new AbortController;const p=c.signal,f=o.get();o.set(O.AsyncResult.loading(O.AsyncResult.getOrUndefined(f)));try{const m=await e({request:h,abortSignal:p,previous:f});await Promise.resolve(),c=void 0,o.set(O.AsyncResult.success(m))}catch(m){c=void 0,o.set(O.AsyncResult.failure(n(m)))}},u=()=>l(a.Value.get(t)),d=()=>{c==null||c.abort(),c=void 0,o.dispose()};return o.onDispose(a.Value.on(t,l)),{status:o,value:s,error:i,loading:r,reload:u,dispose:d}},re=(t,e)=>{const{status:n,dispose:o,reload:s}=t,{loading:i,failure:r,success:c}=e;return a.Fragment(a.OnDispose(o),St(n,{loading:i!=null?l=>i(l,s):void 0,failure:r!=null?l=>r(l,s):void 0,success:l=>c(l,s)}))},yn=({request:t,load:e,mapError:n=o=>o})=>{const o=ie(t,e,n);return s=>re(o,s)},ce=(t,e)=>{if(typeof e=="function")return ce(t,{success:e});const n=e.failure??(s=>a.Fragment(a.OnDispose(s.on(console.error)),s.map(i=>`Error: ${i}`))),o=e.success;return a.OneOfType(a.Value.toSignal(t),{Success:s=>o(s.$.value),Failure:s=>n(s.$.error)})},wn=()=>a.on.focus(t=>{var e;return(e=t.target)==null?void 0:e.select()});class it{constructor(e,n,o,s){gt(this,"equals",e=>O.nearEqual(this.left,e.left)&&O.nearEqual(this.top,e.top)&&O.nearEqual(this.width,e.width)&&O.nearEqual(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 it(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 At(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 le=t=>a.WithBrowserCtx(e=>{const{element:n}=e,o=a.prop(At(n)),s=a.renderableOfTNode(t(o))(e),i=()=>{o.set(it.of(At(n)))};let r;return typeof ResizeObserver=="function"&&(r=new ResizeObserver(i),r.observe(n)),a.OnDispose(c=>{r==null||r.disconnect(),s(c)})}),xn=t=>le(t),vn=t=>e=>{const n=a.getWindow(),o=a.prop({width:(n==null?void 0:n.innerWidth)??0,height:(n==null?void 0:n.innerHeight)??0}),s=a.renderableOfTNode(t(o))(e),i=()=>{o.set({width:(n==null?void 0:n.innerWidth)??0,height:(n==null?void 0:n.innerHeight)??0})};return n==null||n.addEventListener("resize",i),r=>{n==null||n.removeEventListener("resize",i),s(r)}},ae=(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}},ue=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!==""),fe=t=>{const e=t.map(n=>{const o=ue(n);return{route:n,segments:o}});return function(o){for(const{segments:s,route:i}of e){const r=ae(s,o);if(r)return{...r,route:i}}return null}},bn=t=>{const e=fe(Object.keys(t));return a.Use(Ot,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 a.OneOfTuple(o.map(s=>[s.route,s]),t)})},ht=60*1e3,Rt=60*ht,et=24*Rt,Ht=7*et,$t=30*et,An=365*et,Rn=[{max:ht*90,value:ht,name:"minute",past:{singular:"a minute ago",plural:"{} minutes ago"},future:{singular:"in a minute",plural:"in {} minutes"}},{max:Rt*36,value:Rt,name:"hour",past:{singular:"an hour ago",plural:"{} hours ago"},future:{singular:"in an hour",plural:"in {} hours"}},{max:et*10,value:et,name:"day",past:{singular:"yesterday",plural:"{} days ago"},future:{singular:"tomorrow",plural:"in {} days"}},{max:Ht*6,value:Ht,name:"week",past:{singular:"last week",plural:"{} weeks ago"},future:{singular:"in a week",plural:"in {} weeks"}},{max:$t*18,value:$t,name:"month",past:{singular:"last month",plural:"{} months ago"},future:{singular:"in a month",plural:"in {} months"}},{max:1/0,value:An,name:"year",past:{singular:"last year",plural:"{} years ago"},future:{singular:"in a year",plural:"in {} years"}}];function Ut(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 he=(t=1e3)=>{const e=a.prop(new Date),n=O.interval(()=>e.set(new Date),t);return e.onDispose(n),e},de=t=>{const e=Math.abs(t);if(e<ht)return t<0?"just now":"in a moment";for(const n of Rn)if(e<n.max)return t<0?Ut(e,n.value,n.past.singular,n.past.plural):Ut(e,n.value,n.future.singular,n.future.plural);throw new Error("unreachable")},me=(t,{now:e,frequency:n=1e4}={})=>{const o=e!=null?a.Signal.is(e)?e.derive():a.prop(e):he(n),s=a.computedOf(t,o)((i,r)=>i.getTime()-r.getTime());return s.onDispose(()=>a.Value.dispose(o)),s},pe=(t,e={})=>{const n=me(t,e),o=n.map(de);return o.onDispose(n.dispose),o},En=(t,e={})=>pe(t,e);class ge extends a.Prop{constructor(){super(...arguments);gt(this,"tick",()=>this.update(n=>n+1))}}const On=(t=0)=>new ge(t,(e,n)=>e===n);exports.Anchor=jt;exports.Appearance=Se;exports.AsyncResultView=St;exports.AutoFocus=Le;exports.AutoSelect=Te;exports.ElementRect=le;exports.ElementSize=xn;exports.HTMLTitle=De;exports.HiddenWhenEmpty=ke;exports.InViewport=Yt;exports.Location=Ot;exports.PopOver=gn;exports.Rect=it;exports.Resource=yn;exports.ResourceDisplay=re;exports.ResultView=ce;exports.Router=bn;exports.SelectOnFocus=wn;exports.Ticker=ge;exports.WhenInViewport=Pe;exports.WindowSize=vn;exports._checkExtensionCondition=zt;exports._getExtension=Bt;exports._makeRouteMatcher=fe;exports._parseRouteSegments=ue;exports.areLocationsEqual=It;exports.getAbsoluteRect=At;exports.handleAnchorClick=_t;exports.locationFromURL=Et;exports.makeResource=ie;exports.matchesRoute=ae;exports.nowSignal=he;exports.relativeTime=En;exports.relativeTimeMillisSignal=me;exports.relativeTimeSignal=pe;exports.setLocationFromUrl=wt;exports.ticker=On;exports.timeDiffToString=de;exports.urlFromLocation=lt;exports.useAppearance=qt;
|
package/index.js
CHANGED
|
@@ -1225,7 +1225,7 @@ const yn = Ge, xn = Qe, zt = Ke, vn = Xe, bn = (t, e, n) => {
|
|
|
1225
1225
|
strategy: "absolute",
|
|
1226
1226
|
middleware: x
|
|
1227
1227
|
}), { x: v, y: L, middlewareData: A } = b;
|
|
1228
|
-
if (d.style.top = `${
|
|
1228
|
+
if (d.style.top = `${L}px`, d.style.left = `${v}px`, g != null && A.arrow != null) {
|
|
1229
1229
|
const {
|
|
1230
1230
|
x: _,
|
|
1231
1231
|
y: M,
|