@tempots/ui 6.6.3 → 7.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs +1 -1
- package/index.js +169 -97
- package/package.json +2 -2
- package/renderables/size.d.ts +69 -2
package/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var Ae=Object.defineProperty;var Ee=(t,e,o)=>e in t?Ae(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o;var vt=(t,e,o)=>Ee(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))},Pe=(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=>{Pe(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}`:""}`},Se=t=>t.startsWith("http://")||t.startsWith("https://")||t.startsWith("//"),Le=t=>{const e=t.container.currentURL,o=e.iso(n=>St(n),n=>{if(Se(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}},Te=()=>{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}},ke=()=>{const t=l.prop(Te(),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 ke();if(e.isHeadless())return Le(e);throw new Error("Unknown context")}},De=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?De(()=>{Rt(s,l.Value.get(o))}):Rt(s,l.Value.get(o)),!0),r)),l.attr.href(o),...e))},Ce={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))),Fe=(t=10)=>l.WithElement(e=>{const o=E.delayed(()=>e.select(),t);return l.OnDispose(o)});function Ve(t){const e=Object.entries(t);return l.Fragment(...e.map(([o,n])=>l.attr.class(l.Value.map(n,r=>r?o:void 0))))}const Me=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)})}),Ne=t=>l.Portal("head > title",l.attr.innerText(t)),Ue={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 He(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)})},Ue[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"?He(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)))},$e=(t,e,o)=>Zt(t,n=>l.When(n,e,o??(()=>l.Empty)));function te(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 ee(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(ee(s,r)){e(r);break}}};return document.addEventListener("keydown",n),l.OnDispose(()=>{document.removeEventListener("keydown",n)})})}function Ke(t){return Tt({allowedKeys:["Enter"],handler:t})}function Be(t){return Tt({allowedKeys:["Escape"],handler:t})}const J=Math.min,j=Math.max,ut=Math.round,ct=Math.floor,W=t=>({x:t,y:t}),ze={left:"right",right:"left",bottom:"top",top:"bottom"},_e={start:"end",end:"start"};function Ot(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 ne(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 ne(H(t))}function je(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 Ie(t){const e=ft(t);return[bt(t),e,bt(e)]}function bt(t){return t.replace(/start|end/g,e=>_e[e])}function qe(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 Ye(t,e,o,n){const r=rt(t);let s=qe(I(t),o==="start",n);return r&&(s=s.map(i=>i+"-"+r),e&&(s=s.concat(s.map(bt)))),s}function ft(t){return t.replace(/left|right|bottom|top/g,e=>ze[e])}function Xe(t){return{top:0,right:0,bottom:0,left:0,...t}}function oe(t){return typeof t!="number"?Xe(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 Je=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:O,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],...O}},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 re(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=oe(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)),O=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)/O.y,bottom:(R.bottom-p.bottom+m.bottom)/O.y,left:(p.left-R.left+m.left)/O.x,right:(R.right-p.right+m.right)/O.x}}const Ge=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=oe(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",O=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 b=S?S[v]:0;(!b||!await(i.isElement==null?void 0:i.isElement(S)))&&(b=c.floating[v]||s.floating[m]);const K=O/2-R/2,M=b/2-y[m]/2-1,L=J(h[p],M),B=J(h[x],M),z=L,Z=b-y[m]-B,A=b/2-y[m]/2+K,_=Ot(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}}}),Qe=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,O=await(a.isRTL==null?void 0:a.isRTL(u.floating)),R=g||(v||!y?[ft(c)]:Ie(c)),S=m!=="none";!g&&S&&R.push(...Ye(c,y,m,O));const b=[c,...R],K=await re(e,w),M=[];let L=((n=s.flip)==null?void 0:n.overflows)||[];if(d&&M.push(K[p]),h){const A=je(r,i,O);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,_=b[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 Ze(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 tn=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 Ze(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}}}}},en=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 re(e,a),h=H(I(r)),g=ne(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=Ot(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=Ot(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 se(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=(se(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function se(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}=C(t);return/auto|scroll|overlay|hidden|clip/.test(e+n+o)&&!["inline","contents"].includes(r)}function nn(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 Ct(t){const e=Wt(),o=D(t)?C(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 on(t){let e=$(t);for(;F(e)&&!G(e);){if(Ct(e))return e;if(yt(e))return null;e=$(e)}return null}function Wt(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function G(t){return["html","body","#document"].includes(Q(t))}function C(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 ie(t){const e=$(t);return G(e)?t.ownerDocument?t.ownerDocument.body:t.body:F(e)&&st(e)?e:ie(e)}function et(t,e,o){var n;e===void 0&&(e=[]),o===void 0&&(o=!0);const r=ie(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 ce(t){const e=C(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 W(1);const o=e.getBoundingClientRect(),{width:n,height:r,$:s}=ce(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 rn=W(0);function ae(t){const e=P(t);return!Wt()||!e.visualViewport?rn:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function sn(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=W(1);e&&(n?D(n)&&(i=X(n)):i=X(t));const c=sn(s,o,n)?ae(s):W(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=C(y),v=p.left+(y.clientLeft+parseFloat(x.paddingLeft))*w.x,O=p.top+(y.clientTop+parseFloat(x.paddingTop))*w.y;a*=w.x,u*=w.y,d*=w.x,h*=w.y,a+=v,u+=O,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 le(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 cn(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=W(1);const d=W(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?le(i,a,!0):W(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 an(t){return Array.from(t.getClientRects())}function ln(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 C(n).direction==="rtl"&&(i+=j(e.clientWidth,n.clientWidth)-r),{width:r,height:s,x:i,y:c}}function un(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=Wt();(!u||u&&e==="fixed")&&(c=r.offsetLeft,a=r.offsetTop)}return{width:s,height:i,x:c,y:a}}function fn(t,e){const o=q(t,!0,e==="fixed"),n=o.top+t.clientTop,r=o.left+t.clientLeft,s=F(t)?X(t):W(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=un(t,o);else if(e==="document")n=ln(V(t));else if(D(e))n=fn(e,o);else{const r=ae(t);n={x:e.x-r.x,y:e.y-r.y,width:e.width,height:e.height}}return ht(n)}function ue(t,e){const o=$(t);return o===e||!D(o)||G(o)?!1:C(o).position==="fixed"||ue(o,e)}function hn(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=C(t).position==="fixed";let i=s?$(t):t;for(;D(i)&&!G(i);){const c=C(i),a=Ct(i);!a&&c.position==="fixed"&&(r=null),(s?!a&&!r:!a&&c.position==="static"&&!!r&&["absolute","fixed"].includes(r.position)||st(i)&&!a&&ue(t,i))?n=n.filter(d=>d!==i):r=c,i=$(i)}return e.set(t,n),n}function dn(t){let{element:e,boundary:o,rootBoundary:n,strategy:r}=t;const i=[...o==="clippingAncestors"?yt(e)?[]:hn(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 mn(t){const{width:e,height:o}=ce(t);return{width:e,height:o}}function gn(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=W(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?le(r,c):W(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 C(t).position==="static"}function Kt(t,e){if(!F(t)||C(t).position==="fixed")return null;if(e)return e(t);let o=t.offsetParent;return V(t)===o&&(o=o.ownerDocument.body),o}function fe(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&&nn(n)&&xt(n);)n=Kt(n,e);return n&&G(n)&&xt(n)&&!Ct(n)?o:n||on(t)||o}const pn=async function(t){const e=this.getOffsetParent||fe,o=this.getDimensions,n=await o(t.floating);return{reference:gn(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function yn(t){return C(t).direction==="rtl"}const wn={convertOffsetParentRelativeRectToViewportRelativeRect:cn,getDocumentElement:V,getClippingRect:dn,getOffsetParent:fe,getElementRects:pn,getClientRects:an,getDimensions:mn,getScale:X,isElement:D,isRTL:yn};function he(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function vn(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 O=!0;function R(S){const b=S[0].intersectionRatio;if(b!==a){if(!O)return i();b?i(!1,b):n=setTimeout(()=>{i(!1,1e-7)},1e3)}b===1&&!he(u,t.getBoundingClientRect())&&i(),O=!1}try{o=new IntersectionObserver(R,{...v,root:r.ownerDocument})}catch{o=new IntersectionObserver(R,v)}o.observe(t)}return i(!0),s}function xn(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?vn(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&&!he(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 Rn=tn,On=en,Bt=Qe,bn=Ge,An=(t,e,o)=>{const n=new Map,r={platform:wn,...o},s={...r.platform,_c:n};return Je(t,e,{...r,platform:s})},En=["top","top-start","top-end","right","right-start","right-end","bottom","bottom-start","bottom-end","left","left-start","left-end"],Pn=(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.Fragment((n==null?void 0:n.onClickOutside)!=null?te(n.onClickOutside):null,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(),Rn({mainAxis:h.get(),crossAxis:g.get()}),On(),Bt()];y!=null&&d!=null&&v.push(bn({element:d,padding:m.get()}));const O=await An(u,a,{placement:f.get(),strategy:"absolute",middleware:v}),{x:R,y:S,middlewareData:b}=O;if(a.style.top=`${S}px`,a.style.left=`${R}px`,d!=null&&b.arrow!=null){const{x:K,y:M,centerOffset:L,alignmentOffset:B}=b.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,O)=>({...v,placement:O}))),l.WithElement(v=>{d=v,p()})):null,l.OnDispose(w.dispose,xn(u,a,p),x))})))))))},de=(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}},me=(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)}))},Sn=({request:t,load:e,mapError:o=n=>n})=>{const n=de(t,e,o);return r=>me(n,r)},ge=(t,e)=>{if(typeof e=="function")return ge(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)})},Ln=()=>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 Tn=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 kn=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)}},pe=(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!==""),Dn=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=pe(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()}}},Cn=(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},ye=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=Cn(r,s,n);if(i)return i}return null}},Wn=t=>{const e=ye(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)})))},Fn=t=>{const e=ye(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,Vn=365*nt,Mn=[{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:Vn,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 we=(t=1e3)=>{const e=l.prop(new Date),o=E.interval(()=>e.set(new Date),t);return e.onDispose(o),e},ve=t=>{const e=Math.abs(t);if(e<mt)return t<0?"just now":"in a moment";for(const o of Mn)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")},xe=(t,{now:e,frequency:o=1e4}={})=>{const n=e!=null?l.Signal.is(e)?e.derive():l.prop(e):we(o),r=l.computedOf(t,n)((s,i)=>s.getTime()-i.getTime());return r.onDispose(()=>l.Value.dispose(n)),r},Re=(t,e={})=>{const o=xe(t,e),n=o.map(ve);return n.onDispose(o.dispose),n},Nn=(t,e={})=>Re(t,e);class Oe extends l.Prop{constructor(){super(...arguments);vt(this,"tick",()=>this.update(o=>o+1))}}const Un=(t=0)=>new Oe(t,(e,o)=>e===o);exports.Anchor=Gt;exports.Appearance=Ce;exports.AsyncResultView=Lt;exports.AutoFocus=We;exports.AutoSelect=Fe;exports.ChildRouter=Fn;exports.ElementRect=Tn;exports.HTMLTitle=Ne;exports.HiddenWhenEmpty=Me;exports.InViewport=Zt;exports.Location=gt;exports.OnClickOutside=te;exports.OnEnterKey=Ke;exports.OnEscapeKey=Be;exports.OnKeyPressed=Tt;exports.PopOver=Pn;exports.Rect=it;exports.Resource=Sn;exports.ResourceDisplay=me;exports.ResultView=ge;exports.RootRouter=Wn;exports.RouterContextProvider=dt;exports.SelectOnFocus=Ln;exports.Ticker=Oe;exports.WhenInViewport=$e;exports.WindowSize=kn;exports._checkExtensionCondition=Yt;exports._getExtension=qt;exports._makeRouteMatcher=Dn;exports._parseRouteSegments=Mt;exports.allPlacements=En;exports.areLocationsEqual=Jt;exports.classes=Ve;exports.getAbsoluteRect=Et;exports.handleAnchorClick=Xt;exports.locationFromURL=St;exports.makeResource=de;exports.matchesKeyCombo=ee;exports.matchesRoute=pe;exports.nowSignal=we;exports.relativeTime=Nn;exports.relativeTimeMillisSignal=xe;exports.relativeTimeSignal=Re;exports.setLocationFromUrl=Rt;exports.ticker=Un;exports.timeDiffToString=ve;exports.urlFromLocation=lt;exports.useAppearance=Qt;
|
|
1
|
+
"use strict";var Ae=Object.defineProperty;var Ee=(t,e,o)=>e in t?Ae(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o;var vt=(t,e,o)=>Ee(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))},Le=(t,e,o,n)=>{let s=t.target;for(;s!=null&&!(s instanceof HTMLAnchorElement);)s=s.parentElement;if(s==null)return!0;const r=s;if(t.button!==0||t.ctrlKey||t.metaKey||r.target!=="_self"&&r.target!==""||r.getAttribute("download")!=null)return!0;const{pathname:i,search:c,hash:a}=r;if(n){const u=i+c+a,d=r.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=>{Le(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,Pt=(t,e)=>{var r,i;const o=new URL(t,e??((r=l.getWindow())==null?void 0:r.location.toString())),n=Object.fromEntries(((i=o.searchParams)==null?void 0:i.entries())??[]);let s=o.hash;return s.startsWith("#")&&(s=s.substring(1)),{pathname:o.pathname,search:n,hash:s===""?void 0:s}},Rt=(t,e)=>{const o=Pt(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=>Pt(n),n=>{if(Pe(n.pathname))return lt(n);const s=new URL(n.pathname,e.value),r=s.origin+s.pathname;return lt({...n,pathname:r})});return{value:o,dispose:o.dispose}},Te=()=>{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}},ke=()=>{const t=l.prop(Te(),Jt),e=l.getWindow(),o=()=>{let n=(e==null?void 0:e.location.hash)??"";n.startsWith("#")&&(n=n.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:n===""?void 0:n};t.set(s)};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 ke();if(e.isHeadless())return Se(e);throw new Error("Unknown context")}},De=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,...s}=t;return l.Use(gt,r=>l.html.a(l.on.click(Xt(()=>(n===!0?De(()=>{Rt(r,l.Value.get(o))}):Rt(r,l.Value.get(o)),!0),s)),l.attr.href(o),...e))},Ce={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"),s=r=>n.set(r.matches?"dark":"light");return e==null||e.addEventListener("change",s),n.onDispose(()=>e==null?void 0:e.removeEventListener("change",s)),n}const St=(t,e)=>{if(typeof e=="function")return St(t,{success:e});const o=e.failure??(i=>i.map(c=>`Error: ${c}`)),n=e.success,s=e.loading??(()=>l.Empty),r=e.notAsked??(()=>l.Empty);return l.OneOfType(l.Value.toSignal(t),{AsyncSuccess:i=>n(i.$.value),AsyncFailure:i=>o(i.$.error),Loading:i=>s(i.map(c=>c.previousValue)),NotAsked:r})},We=(t=10)=>l.WithElement(e=>l.OnDispose(E.delayed(()=>e==null?void 0:e.focus(),t))),Fe=(t=10)=>l.WithElement(e=>{const o=E.delayed(()=>e.select(),t);return l.OnDispose(o)});function Ve(t){const e=Object.entries(t);return l.Fragment(...e.map(([o,n])=>l.attr.class(l.Value.map(n,s=>s?o:void 0))))}const Me=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)})}),Ne=t=>l.Portal("head > title",l.attr.innerText(t)),Ue={partial:{root:null,rootMargin:"0px",threshold:0},full:{root:null,rootMargin:"0px",threshold:1}},at={partial:new Map,full:new Map},et={partial:null,full:null};function He(t){return et[t]==null&&(et[t]=new IntersectionObserver(e=>{e.forEach(o=>{const n=at[t].get(o.target);n==null||n.set(o.isIntersecting)})},Ue[t])),et[t]}const Zt=({mode:t="partial",once:e=!1},o)=>{const n=l.prop(!1);return l.Fragment(l.WithElement(s=>{const r=typeof IntersectionObserver<"u"?He(t):null;at[t].set(s,n),r==null||r.observe(s);function i(){var a;r==null||r.unobserve(s),at[t].delete(s),at[t].size===0&&((a=et[t])==null||a.disconnect(),et[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)))},$e=(t,e,o)=>Zt(t,n=>l.When(n,e,o??(()=>l.Empty)));function te(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 ee(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=s=>{if(o.contains(s.target)){for(const r of t)if(ee(r,s)){e(s);break}}};return document.addEventListener("keydown",n),l.OnDispose(()=>{document.removeEventListener("keydown",n)})})}function Ke(t){return Tt({allowedKeys:["Enter"],handler:t})}function Be(t){return Tt({allowedKeys:["Escape"],handler:t})}const J=Math.min,j=Math.max,ut=Math.round,ct=Math.floor,W=t=>({x:t,y:t}),ze={left:"right",right:"left",bottom:"top",top:"bottom"},_e={start:"end",end:"start"};function Ot(t,e,o){return j(t,J(e,o))}function st(t,e){return typeof t=="function"?t(e):t}function I(t){return t.split("-")[0]}function rt(t){return t.split("-")[1]}function ne(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 ne(H(t))}function je(t,e,o){o===void 0&&(o=!1);const n=rt(t),s=Dt(t),r=kt(s);let i=s==="x"?n===(o?"end":"start")?"right":"left":n==="start"?"bottom":"top";return e.reference[r]>e.floating[r]&&(i=ft(i)),[i,ft(i)]}function Ie(t){const e=ft(t);return[bt(t),e,bt(e)]}function bt(t){return t.replace(/start|end/g,e=>_e[e])}function qe(t,e,o){const n=["left","right"],s=["right","left"],r=["top","bottom"],i=["bottom","top"];switch(t){case"top":case"bottom":return o?e?s:n:e?n:s;case"left":case"right":return e?r:i;default:return[]}}function Ye(t,e,o,n){const s=rt(t);let r=qe(I(t),o==="start",n);return s&&(r=r.map(i=>i+"-"+s),e&&(r=r.concat(r.map(bt)))),r}function ft(t){return t.replace(/left|right|bottom|top/g,e=>ze[e])}function Xe(t){return{top:0,right:0,bottom:0,left:0,...t}}function oe(t){return typeof t!="number"?Xe(t):{top:t,right:t,bottom:t,left:t}}function ht(t){const{x:e,y:o,width:n,height:s}=t;return{width:n,height:s,top:o,left:e,right:e+n,bottom:o+s,x:e,y:o}}function Ut(t,e,o){let{reference:n,floating:s}=t;const r=H(e),i=Dt(e),c=kt(i),a=I(e),u=r==="y",d=n.x+n.width/2-s.width/2,h=n.y+n.height/2-s.height/2,g=n[c]/2-s[c]/2;let f;switch(a){case"top":f={x:d,y:n.y-s.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-s.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 Je=async(t,e,o)=>{const{placement:n="bottom",strategy:s="absolute",middleware:r=[],platform:i}=o,c=r.filter(Boolean),a=await(i.isRTL==null?void 0:i.isRTL(e));let u=await i.getElementRects({reference:t,floating:e,strategy:s}),{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:O,reset:R}=await p({x:d,y:h,initialPlacement:n,placement:g,strategy:s,middlewareData:f,rects:u,platform:i,elements:{reference:t,floating:e}});d=x??d,h=v??h,f={...f,[w]:{...f[w],...O}},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:s}):R.rects),{x:d,y:h}=Ut(u,g,a)),y=-1)}return{x:d,y:h,placement:g,strategy:s,middlewareData:f}};async function se(t,e){var o;e===void 0&&(e={});const{x:n,y:s,platform:r,rects:i,elements:c,strategy:a}=t,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:h="floating",altBoundary:g=!1,padding:f=0}=st(e,t),m=oe(f),w=c[g?h==="floating"?"reference":"floating":h],p=ht(await r.getClippingRect({element:(o=await(r.isElement==null?void 0:r.isElement(w)))==null||o?w:w.contextElement||await(r.getDocumentElement==null?void 0:r.getDocumentElement(c.floating)),boundary:u,rootBoundary:d,strategy:a})),x=h==="floating"?{x:n,y:s,width:i.floating.width,height:i.floating.height}:i.reference,v=await(r.getOffsetParent==null?void 0:r.getOffsetParent(c.floating)),O=await(r.isElement==null?void 0:r.isElement(v))?await(r.getScale==null?void 0:r.getScale(v))||{x:1,y:1}:{x:1,y:1},R=ht(r.convertOffsetParentRelativeRectToViewportRelativeRect?await r.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:x,offsetParent:v,strategy:a}):x);return{top:(p.top-R.top+m.top)/O.y,bottom:(R.bottom-p.bottom+m.bottom)/O.y,left:(p.left-R.left+m.left)/O.x,right:(R.right-p.right+m.right)/O.x}}const Ge=t=>({name:"arrow",options:t,async fn(e){const{x:o,y:n,placement:s,rects:r,platform:i,elements:c,middlewareData:a}=e,{element:u,padding:d=0}=st(t,e)||{};if(u==null)return{};const h=oe(d),g={x:o,y:n},f=Dt(s),m=kt(f),y=await i.getDimensions(u),w=f==="y",p=w?"top":"left",x=w?"bottom":"right",v=w?"clientHeight":"clientWidth",O=r.reference[m]+r.reference[f]-g[f]-r.floating[m],R=g[f]-r.reference[f],P=await(i.getOffsetParent==null?void 0:i.getOffsetParent(u));let b=P?P[v]:0;(!b||!await(i.isElement==null?void 0:i.isElement(P)))&&(b=c.floating[v]||r.floating[m]);const K=O/2-R/2,M=b/2-y[m]/2-1,S=J(h[p],M),B=J(h[x],M),z=S,tt=b-y[m]-B,A=b/2-y[m]/2+K,_=Ot(z,A,tt),N=!a.arrow&&rt(s)!=null&&A!==_&&r.reference[m]/2-(A<z?S:B)-y[m]/2<0,T=N?A<z?A-z:A-tt:0;return{[f]:g[f]+T,data:{[f]:_,centerOffset:A-_-T,...N&&{alignmentOffset:T}},reset:N}}}),Qe=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var o,n;const{placement:s,middlewareData:r,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}=st(t,e);if((o=r.arrow)!=null&&o.alignmentOffset)return{};const p=I(s),x=H(c),v=I(c)===c,O=await(a.isRTL==null?void 0:a.isRTL(u.floating)),R=g||(v||!y?[ft(c)]:Ie(c)),P=m!=="none";!g&&P&&R.push(...Ye(c,y,m,O));const b=[c,...R],K=await se(e,w),M=[];let S=((n=r.flip)==null?void 0:n.overflows)||[];if(d&&M.push(K[p]),h){const A=je(s,i,O);M.push(K[A[0]],K[A[1]])}if(S=[...S,{placement:s,overflows:M}],!M.every(A=>A<=0)){var B,z;const A=(((B=r.flip)==null?void 0:B.index)||0)+1,_=b[A];if(_&&(!(h==="alignment"?x!==H(_):!1)||S.every(k=>k.overflows[0]>0&&H(k.placement)===x)))return{data:{index:A,overflows:S},reset:{placement:_}};let N=(z=S.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 tt;const T=(tt=S.filter(k=>{if(P){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:tt[0];T&&(N=T);break}case"initialPlacement":N=c;break}if(s!==N)return{reset:{placement:N}}}return{}}}};async function Ze(t,e){const{placement:o,platform:n,elements:s}=t,r=await(n.isRTL==null?void 0:n.isRTL(s.floating)),i=I(o),c=rt(o),a=H(o)==="y",u=["left","top"].includes(i)?-1:1,d=r&&a?-1:1,h=st(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 tn=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var o,n;const{x:s,y:r,placement:i,middlewareData:c}=e,a=await Ze(e,t);return i===((o=c.offset)==null?void 0:o.placement)&&(n=c.arrow)!=null&&n.alignmentOffset?{}:{x:s+a.x,y:r+a.y,data:{...a,placement:i}}}}},en=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:o,y:n,placement:s}=e,{mainAxis:r=!0,crossAxis:i=!1,limiter:c={fn:w=>{let{x:p,y:x}=w;return{x:p,y:x}}},...a}=st(t,e),u={x:o,y:n},d=await se(e,a),h=H(I(s)),g=ne(h);let f=u[g],m=u[h];if(r){const w=g==="y"?"top":"left",p=g==="y"?"bottom":"right",x=f+d[w],v=f-d[p];f=Ot(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=Ot(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]:r,[h]:i}}}}}};function pt(){return typeof window<"u"}function Z(t){return re(t)?(t.nodeName||"").toLowerCase():"#document"}function L(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 L(t).Node:!1}function D(t){return pt()?t instanceof Element||t instanceof L(t).Element:!1}function F(t){return pt()?t instanceof HTMLElement||t instanceof L(t).HTMLElement:!1}function Ht(t){return!pt()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof L(t).ShadowRoot}function it(t){const{overflow:e,overflowX:o,overflowY:n,display:s}=C(t);return/auto|scroll|overlay|hidden|clip/.test(e+n+o)&&!["inline","contents"].includes(s)}function nn(t){return["table","td","th"].includes(Z(t))}function yt(t){return[":popover-open",":modal"].some(e=>{try{return t.matches(e)}catch{return!1}})}function Ct(t){const e=Wt(),o=D(t)?C(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 on(t){let e=$(t);for(;F(e)&&!G(e);){if(Ct(e))return e;if(yt(e))return null;e=$(e)}return null}function Wt(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function G(t){return["html","body","#document"].includes(Z(t))}function C(t){return L(t).getComputedStyle(t)}function wt(t){return D(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function $(t){if(Z(t)==="html")return t;const e=t.assignedSlot||t.parentNode||Ht(t)&&t.host||V(t);return Ht(e)?e.host:e}function ie(t){const e=$(t);return G(e)?t.ownerDocument?t.ownerDocument.body:t.body:F(e)&&it(e)?e:ie(e)}function nt(t,e,o){var n;e===void 0&&(e=[]),o===void 0&&(o=!0);const s=ie(t),r=s===((n=t.ownerDocument)==null?void 0:n.body),i=L(s);if(r){const c=At(i);return e.concat(i,i.visualViewport||[],it(s)?s:[],c&&o?nt(c):[])}return e.concat(s,nt(s,[],o))}function At(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function ce(t){const e=C(t);let o=parseFloat(e.width)||0,n=parseFloat(e.height)||0;const s=F(t),r=s?t.offsetWidth:o,i=s?t.offsetHeight:n,c=ut(o)!==r||ut(n)!==i;return c&&(o=r,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 W(1);const o=e.getBoundingClientRect(),{width:n,height:s,$:r}=ce(e);let i=(r?ut(o.width):o.width)/n,c=(r?ut(o.height):o.height)/s;return(!i||!Number.isFinite(i))&&(i=1),(!c||!Number.isFinite(c))&&(c=1),{x:i,y:c}}const sn=W(0);function ae(t){const e=L(t);return!Wt()||!e.visualViewport?sn:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function rn(t,e,o){return e===void 0&&(e=!1),!o||e&&o!==L(t)?!1:e}function q(t,e,o,n){e===void 0&&(e=!1),o===void 0&&(o=!1);const s=t.getBoundingClientRect(),r=Ft(t);let i=W(1);e&&(n?D(n)&&(i=X(n)):i=X(t));const c=rn(r,o,n)?ae(r):W(0);let a=(s.left+c.x)/i.x,u=(s.top+c.y)/i.y,d=s.width/i.x,h=s.height/i.y;if(r){const g=L(r),f=n&&D(n)?L(n):n;let m=g,y=At(m);for(;y&&n&&f!==m;){const w=X(y),p=y.getBoundingClientRect(),x=C(y),v=p.left+(y.clientLeft+parseFloat(x.paddingLeft))*w.x,O=p.top+(y.clientTop+parseFloat(x.paddingTop))*w.y;a*=w.x,u*=w.y,d*=w.x,h*=w.y,a+=v,u+=O,m=L(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 le(t,e,o){o===void 0&&(o=!1);const n=t.getBoundingClientRect(),s=n.left+e.scrollLeft-(o?0:Vt(t,n)),r=n.top+e.scrollTop;return{x:s,y:r}}function cn(t){let{elements:e,rect:o,offsetParent:n,strategy:s}=t;const r=s==="fixed",i=V(n),c=e?yt(e.floating):!1;if(n===i||c&&r)return o;let a={scrollLeft:0,scrollTop:0},u=W(1);const d=W(0),h=F(n);if((h||!h&&!r)&&((Z(n)!=="body"||it(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&&!r?le(i,a,!0):W(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 an(t){return Array.from(t.getClientRects())}function ln(t){const e=V(t),o=wt(t),n=t.ownerDocument.body,s=j(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),r=j(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let i=-o.scrollLeft+Vt(t);const c=-o.scrollTop;return C(n).direction==="rtl"&&(i+=j(e.clientWidth,n.clientWidth)-s),{width:s,height:r,x:i,y:c}}function un(t,e){const o=L(t),n=V(t),s=o.visualViewport;let r=n.clientWidth,i=n.clientHeight,c=0,a=0;if(s){r=s.width,i=s.height;const u=Wt();(!u||u&&e==="fixed")&&(c=s.offsetLeft,a=s.offsetTop)}return{width:r,height:i,x:c,y:a}}function fn(t,e){const o=q(t,!0,e==="fixed"),n=o.top+t.clientTop,s=o.left+t.clientLeft,r=F(t)?X(t):W(1),i=t.clientWidth*r.x,c=t.clientHeight*r.y,a=s*r.x,u=n*r.y;return{width:i,height:c,x:a,y:u}}function $t(t,e,o){let n;if(e==="viewport")n=un(t,o);else if(e==="document")n=ln(V(t));else if(D(e))n=fn(e,o);else{const s=ae(t);n={x:e.x-s.x,y:e.y-s.y,width:e.width,height:e.height}}return ht(n)}function ue(t,e){const o=$(t);return o===e||!D(o)||G(o)?!1:C(o).position==="fixed"||ue(o,e)}function hn(t,e){const o=e.get(t);if(o)return o;let n=nt(t,[],!1).filter(c=>D(c)&&Z(c)!=="body"),s=null;const r=C(t).position==="fixed";let i=r?$(t):t;for(;D(i)&&!G(i);){const c=C(i),a=Ct(i);!a&&c.position==="fixed"&&(s=null),(r?!a&&!s:!a&&c.position==="static"&&!!s&&["absolute","fixed"].includes(s.position)||it(i)&&!a&&ue(t,i))?n=n.filter(d=>d!==i):s=c,i=$(i)}return e.set(t,n),n}function dn(t){let{element:e,boundary:o,rootBoundary:n,strategy:s}=t;const i=[...o==="clippingAncestors"?yt(e)?[]:hn(e,this._c):[].concat(o),n],c=i[0],a=i.reduce((u,d)=>{const h=$t(e,d,s);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,s));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function mn(t){const{width:e,height:o}=ce(t);return{width:e,height:o}}function gn(t,e,o){const n=F(e),s=V(e),r=o==="fixed",i=q(t,!0,r,e);let c={scrollLeft:0,scrollTop:0};const a=W(0);function u(){a.x=Vt(s)}if(n||!n&&!r)if((Z(e)!=="body"||it(s))&&(c=wt(e)),n){const f=q(e,!0,r,e);a.x=f.x+e.clientLeft,a.y=f.y+e.clientTop}else s&&u();r&&!n&&s&&u();const d=s&&!n&&!r?le(s,c):W(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 C(t).position==="static"}function Kt(t,e){if(!F(t)||C(t).position==="fixed")return null;if(e)return e(t);let o=t.offsetParent;return V(t)===o&&(o=o.ownerDocument.body),o}function fe(t,e){const o=L(t);if(yt(t))return o;if(!F(t)){let s=$(t);for(;s&&!G(s);){if(D(s)&&!xt(s))return s;s=$(s)}return o}let n=Kt(t,e);for(;n&&nn(n)&&xt(n);)n=Kt(n,e);return n&&G(n)&&xt(n)&&!Ct(n)?o:n||on(t)||o}const pn=async function(t){const e=this.getOffsetParent||fe,o=this.getDimensions,n=await o(t.floating);return{reference:gn(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function yn(t){return C(t).direction==="rtl"}const wn={convertOffsetParentRelativeRectToViewportRelativeRect:cn,getDocumentElement:V,getClippingRect:dn,getOffsetParent:fe,getElementRects:pn,getClientRects:an,getDimensions:mn,getScale:X,isElement:D,isRTL:yn};function he(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function vn(t,e){let o=null,n;const s=V(t);function r(){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),r();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(s.clientWidth-(d+g)),w=ct(s.clientHeight-(h+f)),p=ct(d),v={rootMargin:-m+"px "+-y+"px "+-w+"px "+-p+"px",threshold:j(0,J(1,a))||1};let O=!0;function R(P){const b=P[0].intersectionRatio;if(b!==a){if(!O)return i();b?i(!1,b):n=setTimeout(()=>{i(!1,1e-7)},1e3)}b===1&&!he(u,t.getBoundingClientRect())&&i(),O=!1}try{o=new IntersectionObserver(R,{...v,root:s.ownerDocument})}catch{o=new IntersectionObserver(R,v)}o.observe(t)}return i(!0),r}function xn(t,e,o,n){n===void 0&&(n={});const{ancestorScroll:s=!0,ancestorResize:r=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:a=!1}=n,u=Ft(t),d=s||r?[...u?nt(u):[],...nt(e)]:[];d.forEach(p=>{s&&p.addEventListener("scroll",o,{passive:!0}),r&&p.addEventListener("resize",o)});const h=u&&c?vn(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&&!he(y,p)&&o(),y=p,m=requestAnimationFrame(w)}return o(),()=>{var p;d.forEach(x=>{s&&x.removeEventListener("scroll",o),r&&x.removeEventListener("resize",o)}),h==null||h(),(p=f)==null||p.disconnect(),f=null,a&&cancelAnimationFrame(m)}}const Rn=tn,On=en,Bt=Qe,bn=Ge,An=(t,e,o)=>{const n=new Map,s={platform:wn,...o},r={...s.platform,_c:n};return Je(t,e,{...s,platform:r})},En=["top","top-start","top-end","right","right-start","right-end","bottom","bottom-start","bottom-end","left","left-start","left-end"],Ln=(t,e={isOpen:!1})=>{const o=[];let n=null;const s=l.Value.deriveProp(e.isOpen);function r(c){n=c,s.set(!0)}function i(){s.set(!1),o.forEach(c=>c()),o.length=0}return l.Fragment(t(r,i),l.When(s,()=>l.Fragment((n==null?void 0:n.onClickOutside)!=null?te(n.onClickOutside):null,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(),Rn({mainAxis:h.get(),crossAxis:g.get()}),On(),Bt()];y!=null&&d!=null&&v.push(bn({element:d,padding:m.get()}));const O=await An(u,a,{placement:f.get(),strategy:"absolute",middleware:v}),{x:R,y:P,middlewareData:b}=O;if(a.style.top=`${P}px`,a.style.left=`${R}px`,d!=null&&b.arrow!=null){const{x:K,y:M,centerOffset:S,alignmentOffset:B}=b.arrow;w.set({x:K,y:M,centerOffset:S,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,O)=>({...v,placement:O}))),l.WithElement(v=>{d=v,p()})):null,l.OnDispose(w.dispose,xn(u,a,p),x))})))))))},de=(t,e,o)=>{const n=l.prop(E.AsyncResult.notAsked),s=n.map(h=>E.AsyncResult.isSuccess(h)?h.value:void 0),r=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:s,error:r,loading:i,reload:u,dispose:d}},me=(t,e)=>{const{status:o,dispose:n,reload:s}=t,{loading:r,failure:i,success:c}=e;return l.Fragment(l.OnDispose(n),St(o,{loading:r!=null?a=>r(a,s):void 0,failure:i!=null?a=>i(a,s):void 0,success:a=>c(a,s)}))},Pn=({request:t,load:e,mapError:o=n=>n})=>{const n=de(t,e,o);return s=>me(n,s)},ge=(t,e)=>{if(typeof e=="function")return ge(t,{success:e});const o=e.failure??(s=>l.Fragment(l.OnDispose(s.on(console.error)),s.map(r=>`Error: ${r}`))),n=e.success;return l.OneOfType(l.Value.toSignal(t),{Success:s=>n(s.$.value),Failure:s=>o(s.$.error)})},Sn=()=>l.on.focus(t=>{var e;return(e=t.target)==null?void 0:e.select()});class Q{constructor(e,o,n,s,r,i){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=s,this.localLeft=r,this.localTop=i}static of({left:e=0,top:o=0,width:n=0,height:s=0,localLeft:r=0,localTop:i=0}){return new Q(e,o,n,s,r,i)}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 localRect(){return Q.of({left:this.localLeft,top:this.localTop,width:this.width,height:this.height})}get localCenter(){return{x:this.localLeft+this.width/2,y:this.localTop+this.height/2}}get localBottom(){return this.localTop+this.height}get localRight(){return this.localLeft+this.width}get size(){return{width:this.width,height:this.height}}}function Et(t){const e=t.getBoundingClientRect();return Q.of({top:e.top+window.scrollY,left:e.left+window.scrollX,width:e.width,height:e.height})}const Tn=t=>l.WithBrowserCtx(e=>{const{element:o}=e,n=l.prop(Et(o),(c,a)=>c.equals(a)),s=l.renderableOfTNode(t(n))(e),r=()=>n.set(Q.of(Et(o)));let i=null;return typeof ResizeObserver<"u"&&(i=new ResizeObserver(r)),i==null||i.observe(o),l.OnDispose(c=>{i==null||i.disconnect(),s(c)})});function zt(t){return{width:(t==null?void 0:t.innerWidth)??0,height:(t==null?void 0:t.innerHeight)??0}}const kn=t=>e=>{const o=l.getWindow(),n=l.prop(zt(o),(i,c)=>i.width===c.width&&i.height===c.height),s=l.renderableOfTNode(t(n))(e),r=()=>n.set(zt(o));return o==null||o.addEventListener("resize",r),i=>{o==null||o.removeEventListener("resize",r),s(i)}},pe=(t,e)=>{const o=e.split("/").filter(s=>s!==""),n={};for(let s=0;s<t.length;s++){const r=t[s],i=o[s];if(!i&&r.type!=="catch-all")return null;if(r.type==="literal"){if(r.value!==i)return null}else if(r.type==="param")n[r.name]=i;else if(r.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!==""),Dn=t=>{const e=t.map(o=>{const n=Mt(o);return{route:o,segments:n}});return function(n){for(const{segments:s,route:r}of e){const i=pe(s,n);if(i)return{...i,route:r}}return null}},dt={mark:l.makeProviderMark("RouterContext"),create:()=>{const t=l.prop([]);return{value:t,dispose:()=>t.dispose()}}},Cn=(t,e,o)=>{const n=o.split("/").filter(i=>i!==""),s={};let r=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;r++}else if(c.type==="param")s[c.name]=a,r++;else if(c.type==="catch-all"){const u="/"+n.slice(0,r).join("/"),d="/"+n.slice(r).join("/");return{params:s,matchedPath:u==="/"?"":u,remainingPath:d==="/"?"":d,route:e}}}if(n.length===t.length){const i="/"+n.join("/");return{params:s,matchedPath:i==="/"?"":i,remainingPath:"",route:e}}return null},ye=t=>{const e=t.map(o=>{const n=Mt(o);return{route:o,segments:n}});return function(n){for(const{segments:s,route:r}of e){const i=Cn(s,r,n);if(i)return i}return null}},Wn=t=>{const e=ye(Object.keys(t));return l.Provide(dt,{},()=>l.Use(gt,o=>l.Use(dt,n=>{const s=o.map(r=>{const i=e(r.pathname);if(i==null)throw console.error("No route found for",r),new Error("No route found");const c={matchedPath:i.matchedPath,remainingPath:i.remainingPath,fullPath:r.pathname,params:i.params};return n.value=[...n.value,c],{params:i.params,route:i.route,path:i.matchedPath||r.pathname,search:r.search,hash:r.hash}});return l.OneOfTuple(s.map(r=>[r.route,r]),t)})))},Fn=t=>{const e=ye(Object.keys(t));return l.Use(dt,o=>l.Use(gt,n=>{const s=o.map(r=>{const i=r[r.length-1],c=(i==null?void 0:i.remainingPath)||"";if(c==="")throw console.error("No remaining path for SubRouter",r),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(s.map(r=>[r.route,r]),t)}))},mt=60*1e3,Lt=60*mt,ot=24*Lt,_t=7*ot,jt=30*ot,Vn=365*ot,Mn=[{max:mt*90,value:mt,name:"minute",past:{singular:"a minute ago",plural:"{} minutes ago"},future:{singular:"in a minute",plural:"in {} minutes"}},{max:Lt*36,value:Lt,name:"hour",past:{singular:"an hour ago",plural:"{} hours ago"},future:{singular:"in an hour",plural:"in {} hours"}},{max:ot*10,value:ot,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:Vn,name:"year",past:{singular:"last year",plural:"{} years ago"},future:{singular:"in a year",plural:"in {} years"}}];function It(t,e,o,n){const s=Math.round(t/e);return s<=1?o:n.replace("{}",s.toLocaleString(void 0,{maximumFractionDigits:0,minimumFractionDigits:0}))}const we=(t=1e3)=>{const e=l.prop(new Date),o=E.interval(()=>e.set(new Date),t);return e.onDispose(o),e},ve=t=>{const e=Math.abs(t);if(e<mt)return t<0?"just now":"in a moment";for(const o of Mn)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")},xe=(t,{now:e,frequency:o=1e4}={})=>{const n=e!=null?l.Signal.is(e)?e.derive():l.prop(e):we(o),s=l.computedOf(t,n)((r,i)=>r.getTime()-i.getTime());return s.onDispose(()=>l.Value.dispose(n)),s},Re=(t,e={})=>{const o=xe(t,e),n=o.map(ve);return n.onDispose(o.dispose),n},Nn=(t,e={})=>Re(t,e);class Oe extends l.Prop{constructor(){super(...arguments);vt(this,"tick",()=>this.update(o=>o+1))}}const Un=(t=0)=>new Oe(t,(e,o)=>e===o);exports.Anchor=Gt;exports.Appearance=Ce;exports.AsyncResultView=St;exports.AutoFocus=We;exports.AutoSelect=Fe;exports.ChildRouter=Fn;exports.ElementRect=Tn;exports.HTMLTitle=Ne;exports.HiddenWhenEmpty=Me;exports.InViewport=Zt;exports.Location=gt;exports.OnClickOutside=te;exports.OnEnterKey=Ke;exports.OnEscapeKey=Be;exports.OnKeyPressed=Tt;exports.PopOver=Ln;exports.Rect=Q;exports.Resource=Pn;exports.ResourceDisplay=me;exports.ResultView=ge;exports.RootRouter=Wn;exports.RouterContextProvider=dt;exports.SelectOnFocus=Sn;exports.Ticker=Oe;exports.WhenInViewport=$e;exports.WindowSize=kn;exports._checkExtensionCondition=Yt;exports._getExtension=qt;exports._makeRouteMatcher=Dn;exports._parseRouteSegments=Mt;exports.allPlacements=En;exports.areLocationsEqual=Jt;exports.classes=Ve;exports.getAbsoluteRect=Et;exports.handleAnchorClick=Xt;exports.locationFromURL=Pt;exports.makeResource=de;exports.matchesKeyCombo=ee;exports.matchesRoute=pe;exports.nowSignal=we;exports.relativeTime=Nn;exports.relativeTimeMillisSignal=xe;exports.relativeTimeSignal=Re;exports.setLocationFromUrl=Rt;exports.ticker=Un;exports.timeDiffToString=ve;exports.urlFromLocation=lt;exports.useAppearance=Qt;
|
package/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var Le = Object.defineProperty;
|
|
2
2
|
var Pe = (t, e, o) => e in t ? Le(t, e, { enumerable: !0, configurable: !0, writable: !0, value: o }) : t[e] = o;
|
|
3
3
|
var Ot = (t, e, o) => Pe(t, typeof e != "symbol" ? e + "" : e, o);
|
|
4
|
-
import { getWindow as
|
|
5
|
-
import { delayed as ae, AsyncResult as U, nearEqual as
|
|
4
|
+
import { getWindow as lt, prop as F, makeProviderMark as Wt, Signal as ee, Use as st, html as Et, on as ne, Value as A, attr as Ft, Empty as Lt, OneOfType as oe, WithElement as B, OnDispose as M, Fragment as q, Portal as re, renderableOfTNode as Mt, 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
|
+
import { delayed as ae, AsyncResult as U, nearEqual as dt, interval as De } from "@tempots/std";
|
|
6
6
|
const We = (t) => {
|
|
7
7
|
const e = t.split("/").pop();
|
|
8
8
|
if (e == null || e.startsWith(".")) return;
|
|
@@ -45,7 +45,7 @@ const We = (t) => {
|
|
|
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
47
|
var s, i;
|
|
48
|
-
const o = new URL(t, e ?? ((s =
|
|
48
|
+
const o = new URL(t, e ?? ((s = lt()) == 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,
|
|
@@ -58,7 +58,7 @@ const We = (t) => {
|
|
|
58
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
|
-
}, $e = (t) => t.startsWith("http://") || t.startsWith("https://") || t.startsWith("//"),
|
|
61
|
+
}, $e = (t) => t.startsWith("http://") || t.startsWith("https://") || t.startsWith("//"), Be = (t) => {
|
|
62
62
|
const e = t.container.currentURL, o = e.iso(
|
|
63
63
|
(n) => le(n),
|
|
64
64
|
(n) => {
|
|
@@ -69,8 +69,8 @@ const We = (t) => {
|
|
|
69
69
|
}
|
|
70
70
|
);
|
|
71
71
|
return { value: o, dispose: o.dispose };
|
|
72
|
-
},
|
|
73
|
-
const t =
|
|
72
|
+
}, He = () => {
|
|
73
|
+
const t = lt(), e = (t == null ? void 0 : t.location.hash) === "" ? void 0 : (t == null ? void 0 : t.location.hash.substring(1)) ?? void 0;
|
|
74
74
|
return {
|
|
75
75
|
pathname: (t == null ? void 0 : t.location.pathname) ?? "",
|
|
76
76
|
search: Object.fromEntries(
|
|
@@ -79,7 +79,7 @@ const We = (t) => {
|
|
|
79
79
|
hash: e
|
|
80
80
|
};
|
|
81
81
|
}, Ue = () => {
|
|
82
|
-
const t = F(
|
|
82
|
+
const t = F(He(), Ve), e = lt(), o = () => {
|
|
83
83
|
let n = (e == null ? void 0 : e.location.hash) ?? "";
|
|
84
84
|
n.startsWith("#") && (n = n.substring(1));
|
|
85
85
|
const r = {
|
|
@@ -105,7 +105,7 @@ const We = (t) => {
|
|
|
105
105
|
if (e.isBrowser())
|
|
106
106
|
return Ue();
|
|
107
107
|
if (e.isHeadless())
|
|
108
|
-
return
|
|
108
|
+
return Be(e);
|
|
109
109
|
throw new Error("Unknown context");
|
|
110
110
|
}
|
|
111
111
|
}, ze = (t) => {
|
|
@@ -139,7 +139,7 @@ const We = (t) => {
|
|
|
139
139
|
}
|
|
140
140
|
};
|
|
141
141
|
function je() {
|
|
142
|
-
const t =
|
|
142
|
+
const t = lt(), e = t != null && t.matchMedia != null ? t.matchMedia("(prefers-color-scheme: dark)") : void 0, o = (e == null ? void 0 : e.matches) ?? !1, n = F(o ? "dark" : "light"), r = (s) => n.set(s.matches ? "dark" : "light");
|
|
143
143
|
return e == null || e.addEventListener("change", r), n.onDispose(() => e == null ? void 0 : e.removeEventListener("change", r)), n;
|
|
144
144
|
}
|
|
145
145
|
const ue = (t, e) => {
|
|
@@ -152,7 +152,7 @@ const ue = (t, e) => {
|
|
|
152
152
|
Loading: (i) => r(i.map((c) => c.previousValue)),
|
|
153
153
|
NotAsked: s
|
|
154
154
|
});
|
|
155
|
-
}, qn = (t = 10) =>
|
|
155
|
+
}, qn = (t = 10) => B((e) => M(ae(() => e == null ? void 0 : e.focus(), t))), Xn = (t = 10) => B((e) => {
|
|
156
156
|
const o = ae(() => e.select(), t);
|
|
157
157
|
return M(o);
|
|
158
158
|
});
|
|
@@ -164,7 +164,7 @@ function Jn(t) {
|
|
|
164
164
|
)
|
|
165
165
|
);
|
|
166
166
|
}
|
|
167
|
-
const Gn =
|
|
167
|
+
const Gn = B((t) => {
|
|
168
168
|
const e = t.style.getPropertyValue(":empty");
|
|
169
169
|
return t.style.setProperty(":empty", "display:none"), M((o) => {
|
|
170
170
|
o && t.style.setProperty(":empty", e);
|
|
@@ -180,7 +180,7 @@ const Gn = H((t) => {
|
|
|
180
180
|
rootMargin: "0px",
|
|
181
181
|
threshold: 1
|
|
182
182
|
}
|
|
183
|
-
},
|
|
183
|
+
}, gt = {
|
|
184
184
|
partial: /* @__PURE__ */ new Map(),
|
|
185
185
|
full: /* @__PURE__ */ new Map()
|
|
186
186
|
}, rt = {
|
|
@@ -190,7 +190,7 @@ const Gn = H((t) => {
|
|
|
190
190
|
function Ie(t) {
|
|
191
191
|
return rt[t] == null && (rt[t] = new IntersectionObserver((e) => {
|
|
192
192
|
e.forEach((o) => {
|
|
193
|
-
const n =
|
|
193
|
+
const n = gt[t].get(o.target);
|
|
194
194
|
n == null || n.set(o.isIntersecting);
|
|
195
195
|
});
|
|
196
196
|
}, _e[t])), rt[t];
|
|
@@ -198,12 +198,12 @@ function Ie(t) {
|
|
|
198
198
|
const Ye = ({ mode: t = "partial", once: e = !1 }, o) => {
|
|
199
199
|
const n = F(!1);
|
|
200
200
|
return q(
|
|
201
|
-
|
|
201
|
+
B((r) => {
|
|
202
202
|
const s = typeof IntersectionObserver < "u" ? Ie(t) : null;
|
|
203
|
-
|
|
203
|
+
gt[t].set(r, n), s == null || s.observe(r);
|
|
204
204
|
function i() {
|
|
205
205
|
var a;
|
|
206
|
-
s == null || s.unobserve(r),
|
|
206
|
+
s == null || s.unobserve(r), gt[t].delete(r), gt[t].size === 0 && ((a = rt[t]) == null || a.disconnect(), rt[t] = null);
|
|
207
207
|
}
|
|
208
208
|
let c = null;
|
|
209
209
|
return e && (c = n.on((a) => {
|
|
@@ -216,7 +216,7 @@ const Ye = ({ mode: t = "partial", once: e = !1 }, o) => {
|
|
|
216
216
|
);
|
|
217
217
|
}, Zn = (t, e, o) => Ye(t, (n) => se(n, e, o ?? (() => Lt)));
|
|
218
218
|
function qe(t) {
|
|
219
|
-
return
|
|
219
|
+
return B((e) => {
|
|
220
220
|
const o = (n) => {
|
|
221
221
|
e.contains(n.target) || t(n);
|
|
222
222
|
};
|
|
@@ -236,7 +236,7 @@ function fe({
|
|
|
236
236
|
allowedKeys: t,
|
|
237
237
|
handler: e
|
|
238
238
|
}) {
|
|
239
|
-
return
|
|
239
|
+
return B((o) => {
|
|
240
240
|
const n = (r) => {
|
|
241
241
|
if (o.contains(r.target)) {
|
|
242
242
|
for (const s of t)
|
|
@@ -257,7 +257,7 @@ function to(t) {
|
|
|
257
257
|
function eo(t) {
|
|
258
258
|
return fe({ allowedKeys: ["Escape"], handler: t });
|
|
259
259
|
}
|
|
260
|
-
const tt = Math.min, X = Math.max,
|
|
260
|
+
const tt = Math.min, X = Math.max, pt = Math.round, mt = Math.floor, D = (t) => ({
|
|
261
261
|
x: t,
|
|
262
262
|
y: t
|
|
263
263
|
}), Je = {
|
|
@@ -272,13 +272,13 @@ const tt = Math.min, X = Math.max, gt = Math.round, dt = Math.floor, D = (t) =>
|
|
|
272
272
|
function St(t, e, o) {
|
|
273
273
|
return X(t, tt(e, o));
|
|
274
274
|
}
|
|
275
|
-
function
|
|
275
|
+
function ut(t, e) {
|
|
276
276
|
return typeof t == "function" ? t(e) : t;
|
|
277
277
|
}
|
|
278
278
|
function J(t) {
|
|
279
279
|
return t.split("-")[0];
|
|
280
280
|
}
|
|
281
|
-
function
|
|
281
|
+
function ft(t) {
|
|
282
282
|
return t.split("-")[1];
|
|
283
283
|
}
|
|
284
284
|
function he(t) {
|
|
@@ -295,12 +295,12 @@ function $t(t) {
|
|
|
295
295
|
}
|
|
296
296
|
function Qe(t, e, o) {
|
|
297
297
|
o === void 0 && (o = !1);
|
|
298
|
-
const n =
|
|
298
|
+
const n = ft(t), r = $t(t), s = Vt(r);
|
|
299
299
|
let i = r === "x" ? n === (o ? "end" : "start") ? "right" : "left" : n === "start" ? "bottom" : "top";
|
|
300
|
-
return e.reference[s] > e.floating[s] && (i =
|
|
300
|
+
return e.reference[s] > e.floating[s] && (i = wt(i)), [i, wt(i)];
|
|
301
301
|
}
|
|
302
302
|
function Ze(t) {
|
|
303
|
-
const e =
|
|
303
|
+
const e = wt(t);
|
|
304
304
|
return [Tt(t), e, Tt(e)];
|
|
305
305
|
}
|
|
306
306
|
function Tt(t) {
|
|
@@ -320,11 +320,11 @@ function tn(t, e, o) {
|
|
|
320
320
|
}
|
|
321
321
|
}
|
|
322
322
|
function en(t, e, o, n) {
|
|
323
|
-
const r =
|
|
323
|
+
const r = ft(t);
|
|
324
324
|
let s = tn(J(t), o === "start", n);
|
|
325
325
|
return r && (s = s.map((i) => i + "-" + r), e && (s = s.concat(s.map(Tt)))), s;
|
|
326
326
|
}
|
|
327
|
-
function
|
|
327
|
+
function wt(t) {
|
|
328
328
|
return t.replace(/left|right|bottom|top/g, (e) => Je[e]);
|
|
329
329
|
}
|
|
330
330
|
function nn(t) {
|
|
@@ -344,7 +344,7 @@ function de(t) {
|
|
|
344
344
|
left: t
|
|
345
345
|
};
|
|
346
346
|
}
|
|
347
|
-
function
|
|
347
|
+
function yt(t) {
|
|
348
348
|
const {
|
|
349
349
|
x: e,
|
|
350
350
|
y: o,
|
|
@@ -400,7 +400,7 @@ function _t(t, e, o) {
|
|
|
400
400
|
y: n.y
|
|
401
401
|
};
|
|
402
402
|
}
|
|
403
|
-
switch (
|
|
403
|
+
switch (ft(e)) {
|
|
404
404
|
case "start":
|
|
405
405
|
u[i] -= m * (o && l ? -1 : 1);
|
|
406
406
|
break;
|
|
@@ -487,7 +487,7 @@ async function me(t, e) {
|
|
|
487
487
|
elementContext: f = "floating",
|
|
488
488
|
altBoundary: m = !1,
|
|
489
489
|
padding: u = 0
|
|
490
|
-
} =
|
|
490
|
+
} = ut(e, t), d = de(u), w = c[m ? f === "floating" ? "reference" : "floating" : f], g = yt(await s.getClippingRect({
|
|
491
491
|
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)),
|
|
492
492
|
boundary: l,
|
|
493
493
|
rootBoundary: h,
|
|
@@ -503,7 +503,7 @@ async function me(t, e) {
|
|
|
503
503
|
} : {
|
|
504
504
|
x: 1,
|
|
505
505
|
y: 1
|
|
506
|
-
}, v =
|
|
506
|
+
}, v = yt(s.convertOffsetParentRelativeRectToViewportRelativeRect ? await s.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
507
507
|
elements: c,
|
|
508
508
|
rect: x,
|
|
509
509
|
offsetParent: y,
|
|
@@ -531,7 +531,7 @@ const rn = (t) => ({
|
|
|
531
531
|
} = e, {
|
|
532
532
|
element: l,
|
|
533
533
|
padding: h = 0
|
|
534
|
-
} =
|
|
534
|
+
} = ut(t, e) || {};
|
|
535
535
|
if (l == null)
|
|
536
536
|
return {};
|
|
537
537
|
const f = de(h), m = {
|
|
@@ -540,7 +540,7 @@ const rn = (t) => ({
|
|
|
540
540
|
}, u = $t(r), d = Vt(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));
|
|
541
541
|
let R = L ? L[y] : 0;
|
|
542
542
|
(!R || !await (i.isElement == null ? void 0 : i.isElement(L))) && (R = c.floating[y] || s.floating[d]);
|
|
543
|
-
const j = b / 2 - v / 2, V = R / 2 - p[d] / 2 - 1, P = tt(f[g], V), _ = tt(f[x], V), I = P, ot = R - p[d] - _, O = R / 2 - p[d] / 2 + j, Y = St(I, O, ot), $ = !a.arrow &&
|
|
543
|
+
const j = b / 2 - v / 2, V = R / 2 - p[d] / 2 - 1, P = tt(f[g], V), _ = tt(f[x], V), I = P, ot = R - p[d] - _, O = R / 2 - p[d] / 2 + j, Y = St(I, O, ot), $ = !a.arrow && ft(r) != null && O !== Y && s.reference[d] / 2 - (O < I ? P : _) - p[d] / 2 < 0, S = $ ? O < I ? O - I : O - ot : 0;
|
|
544
544
|
return {
|
|
545
545
|
[u]: m[u] + S,
|
|
546
546
|
data: {
|
|
@@ -574,10 +574,10 @@ const rn = (t) => ({
|
|
|
574
574
|
fallbackAxisSideDirection: d = "none",
|
|
575
575
|
flipAlignment: p = !0,
|
|
576
576
|
...w
|
|
577
|
-
} =
|
|
577
|
+
} = ut(t, e);
|
|
578
578
|
if ((o = s.arrow) != null && o.alignmentOffset)
|
|
579
579
|
return {};
|
|
580
|
-
const g = J(r), x = z(c), y = J(c) === c, b = await (a.isRTL == null ? void 0 : a.isRTL(l.floating)), v = m || (y || !p ? [
|
|
580
|
+
const g = J(r), x = z(c), y = J(c) === c, b = await (a.isRTL == null ? void 0 : a.isRTL(l.floating)), v = m || (y || !p ? [wt(c)] : Ze(c)), L = d !== "none";
|
|
581
581
|
!m && L && v.push(...en(c, p, d, b));
|
|
582
582
|
const R = [c, ...v], j = await me(e, w), V = [];
|
|
583
583
|
let P = ((n = s.flip) == null ? void 0 : n.overflows) || [];
|
|
@@ -610,13 +610,13 @@ const rn = (t) => ({
|
|
|
610
610
|
var ot;
|
|
611
611
|
const S = (ot = P.filter((T) => {
|
|
612
612
|
if (L) {
|
|
613
|
-
const
|
|
614
|
-
return
|
|
613
|
+
const H = z(T.placement);
|
|
614
|
+
return H === x || // Create a bias to the `y` side axis due to horizontal
|
|
615
615
|
// reading directions favoring greater width.
|
|
616
|
-
|
|
616
|
+
H === "y";
|
|
617
617
|
}
|
|
618
618
|
return !0;
|
|
619
|
-
}).map((T) => [T.placement, T.overflows.filter((
|
|
619
|
+
}).map((T) => [T.placement, T.overflows.filter((H) => H > 0).reduce((H, Ee) => H + Ee, 0)]).sort((T, H) => T[1] - H[1])[0]) == null ? void 0 : ot[0];
|
|
620
620
|
S && ($ = S);
|
|
621
621
|
break;
|
|
622
622
|
}
|
|
@@ -640,7 +640,7 @@ async function cn(t, e) {
|
|
|
640
640
|
placement: o,
|
|
641
641
|
platform: n,
|
|
642
642
|
elements: r
|
|
643
|
-
} = t, s = await (n.isRTL == null ? void 0 : n.isRTL(r.floating)), i = J(o), c =
|
|
643
|
+
} = t, s = await (n.isRTL == null ? void 0 : n.isRTL(r.floating)), i = J(o), c = ft(o), a = z(o) === "y", l = ["left", "top"].includes(i) ? -1 : 1, h = s && a ? -1 : 1, f = ut(e, t);
|
|
644
644
|
let {
|
|
645
645
|
mainAxis: m,
|
|
646
646
|
crossAxis: u,
|
|
@@ -709,7 +709,7 @@ const an = function(t) {
|
|
|
709
709
|
}
|
|
710
710
|
},
|
|
711
711
|
...a
|
|
712
|
-
} =
|
|
712
|
+
} = ut(t, e), l = {
|
|
713
713
|
x: o,
|
|
714
714
|
y: n
|
|
715
715
|
}, h = await me(e, a), f = z(J(r)), m = he(f);
|
|
@@ -741,7 +741,7 @@ const an = function(t) {
|
|
|
741
741
|
}
|
|
742
742
|
};
|
|
743
743
|
};
|
|
744
|
-
function
|
|
744
|
+
function vt() {
|
|
745
745
|
return typeof window < "u";
|
|
746
746
|
}
|
|
747
747
|
function nt(t) {
|
|
@@ -756,18 +756,18 @@ function N(t) {
|
|
|
756
756
|
return (e = (ge(t) ? t.ownerDocument : t.document) || window.document) == null ? void 0 : e.documentElement;
|
|
757
757
|
}
|
|
758
758
|
function ge(t) {
|
|
759
|
-
return
|
|
759
|
+
return vt() ? t instanceof Node || t instanceof E(t).Node : !1;
|
|
760
760
|
}
|
|
761
761
|
function k(t) {
|
|
762
|
-
return
|
|
762
|
+
return vt() ? t instanceof Element || t instanceof E(t).Element : !1;
|
|
763
763
|
}
|
|
764
764
|
function W(t) {
|
|
765
|
-
return
|
|
765
|
+
return vt() ? t instanceof HTMLElement || t instanceof E(t).HTMLElement : !1;
|
|
766
766
|
}
|
|
767
767
|
function It(t) {
|
|
768
|
-
return !
|
|
768
|
+
return !vt() || typeof ShadowRoot > "u" ? !1 : t instanceof ShadowRoot || t instanceof E(t).ShadowRoot;
|
|
769
769
|
}
|
|
770
|
-
function
|
|
770
|
+
function ht(t) {
|
|
771
771
|
const {
|
|
772
772
|
overflow: e,
|
|
773
773
|
overflowX: o,
|
|
@@ -779,7 +779,7 @@ function ft(t) {
|
|
|
779
779
|
function un(t) {
|
|
780
780
|
return ["table", "td", "th"].includes(nt(t));
|
|
781
781
|
}
|
|
782
|
-
function
|
|
782
|
+
function bt(t) {
|
|
783
783
|
return [":popover-open", ":modal"].some((e) => {
|
|
784
784
|
try {
|
|
785
785
|
return t.matches(e);
|
|
@@ -788,22 +788,22 @@ function vt(t) {
|
|
|
788
788
|
}
|
|
789
789
|
});
|
|
790
790
|
}
|
|
791
|
-
function
|
|
792
|
-
const e =
|
|
791
|
+
function Bt(t) {
|
|
792
|
+
const e = Ht(), o = k(t) ? C(t) : t;
|
|
793
793
|
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));
|
|
794
794
|
}
|
|
795
795
|
function fn(t) {
|
|
796
796
|
let e = K(t);
|
|
797
797
|
for (; W(e) && !et(e); ) {
|
|
798
|
-
if (
|
|
798
|
+
if (Bt(e))
|
|
799
799
|
return e;
|
|
800
|
-
if (
|
|
800
|
+
if (bt(e))
|
|
801
801
|
return null;
|
|
802
802
|
e = K(e);
|
|
803
803
|
}
|
|
804
804
|
return null;
|
|
805
805
|
}
|
|
806
|
-
function
|
|
806
|
+
function Ht() {
|
|
807
807
|
return typeof CSS > "u" || !CSS.supports ? !1 : CSS.supports("-webkit-backdrop-filter", "none");
|
|
808
808
|
}
|
|
809
809
|
function et(t) {
|
|
@@ -812,7 +812,7 @@ function et(t) {
|
|
|
812
812
|
function C(t) {
|
|
813
813
|
return E(t).getComputedStyle(t);
|
|
814
814
|
}
|
|
815
|
-
function
|
|
815
|
+
function Rt(t) {
|
|
816
816
|
return k(t) ? {
|
|
817
817
|
scrollLeft: t.scrollLeft,
|
|
818
818
|
scrollTop: t.scrollTop
|
|
@@ -835,7 +835,7 @@ function K(t) {
|
|
|
835
835
|
}
|
|
836
836
|
function pe(t) {
|
|
837
837
|
const e = K(t);
|
|
838
|
-
return et(e) ? t.ownerDocument ? t.ownerDocument.body : t.body : W(e) &&
|
|
838
|
+
return et(e) ? t.ownerDocument ? t.ownerDocument.body : t.body : W(e) && ht(e) ? e : pe(e);
|
|
839
839
|
}
|
|
840
840
|
function it(t, e, o) {
|
|
841
841
|
var n;
|
|
@@ -843,7 +843,7 @@ function it(t, e, o) {
|
|
|
843
843
|
const r = pe(t), s = r === ((n = t.ownerDocument) == null ? void 0 : n.body), i = E(r);
|
|
844
844
|
if (s) {
|
|
845
845
|
const c = kt(i);
|
|
846
|
-
return e.concat(i, i.visualViewport || [],
|
|
846
|
+
return e.concat(i, i.visualViewport || [], ht(r) ? r : [], c && o ? it(c) : []);
|
|
847
847
|
}
|
|
848
848
|
return e.concat(r, it(r, [], o));
|
|
849
849
|
}
|
|
@@ -853,7 +853,7 @@ function kt(t) {
|
|
|
853
853
|
function we(t) {
|
|
854
854
|
const e = C(t);
|
|
855
855
|
let o = parseFloat(e.width) || 0, n = parseFloat(e.height) || 0;
|
|
856
|
-
const r = W(t), s = r ? t.offsetWidth : o, i = r ? t.offsetHeight : n, c =
|
|
856
|
+
const r = W(t), s = r ? t.offsetWidth : o, i = r ? t.offsetHeight : n, c = pt(o) !== s || pt(n) !== i;
|
|
857
857
|
return c && (o = s, n = i), {
|
|
858
858
|
width: o,
|
|
859
859
|
height: n,
|
|
@@ -872,7 +872,7 @@ function Z(t) {
|
|
|
872
872
|
height: r,
|
|
873
873
|
$: s
|
|
874
874
|
} = we(e);
|
|
875
|
-
let i = (s ?
|
|
875
|
+
let i = (s ? pt(o.width) : o.width) / n, c = (s ? pt(o.height) : o.height) / r;
|
|
876
876
|
return (!i || !Number.isFinite(i)) && (i = 1), (!c || !Number.isFinite(c)) && (c = 1), {
|
|
877
877
|
x: i,
|
|
878
878
|
y: c
|
|
@@ -881,7 +881,7 @@ function Z(t) {
|
|
|
881
881
|
const hn = /* @__PURE__ */ D(0);
|
|
882
882
|
function ye(t) {
|
|
883
883
|
const e = E(t);
|
|
884
|
-
return !
|
|
884
|
+
return !Ht() || !e.visualViewport ? hn : {
|
|
885
885
|
x: e.visualViewport.offsetLeft,
|
|
886
886
|
y: e.visualViewport.offsetTop
|
|
887
887
|
};
|
|
@@ -904,7 +904,7 @@ function G(t, e, o, n) {
|
|
|
904
904
|
a *= w.x, l *= w.y, h *= w.x, f *= w.y, a += y, l += b, d = E(p), p = kt(d);
|
|
905
905
|
}
|
|
906
906
|
}
|
|
907
|
-
return
|
|
907
|
+
return yt({
|
|
908
908
|
width: h,
|
|
909
909
|
height: f,
|
|
910
910
|
x: a,
|
|
@@ -912,7 +912,7 @@ function G(t, e, o, n) {
|
|
|
912
912
|
});
|
|
913
913
|
}
|
|
914
914
|
function zt(t, e) {
|
|
915
|
-
const o =
|
|
915
|
+
const o = Rt(t).scrollLeft;
|
|
916
916
|
return e ? e.left + o : G(N(t)).left + o;
|
|
917
917
|
}
|
|
918
918
|
function xe(t, e, o) {
|
|
@@ -933,7 +933,7 @@ function mn(t) {
|
|
|
933
933
|
offsetParent: n,
|
|
934
934
|
strategy: r
|
|
935
935
|
} = t;
|
|
936
|
-
const s = r === "fixed", i = N(n), c = e ?
|
|
936
|
+
const s = r === "fixed", i = N(n), c = e ? bt(e.floating) : !1;
|
|
937
937
|
if (n === i || c && s)
|
|
938
938
|
return o;
|
|
939
939
|
let a = {
|
|
@@ -941,7 +941,7 @@ function mn(t) {
|
|
|
941
941
|
scrollTop: 0
|
|
942
942
|
}, l = D(1);
|
|
943
943
|
const h = D(0), f = W(n);
|
|
944
|
-
if ((f || !f && !s) && ((nt(n) !== "body" ||
|
|
944
|
+
if ((f || !f && !s) && ((nt(n) !== "body" || ht(i)) && (a = Rt(n)), W(n))) {
|
|
945
945
|
const u = G(n);
|
|
946
946
|
l = Z(n), h.x = u.x + n.clientLeft, h.y = u.y + n.clientTop;
|
|
947
947
|
}
|
|
@@ -957,7 +957,7 @@ function gn(t) {
|
|
|
957
957
|
return Array.from(t.getClientRects());
|
|
958
958
|
}
|
|
959
959
|
function pn(t) {
|
|
960
|
-
const e = N(t), o =
|
|
960
|
+
const e = N(t), o = Rt(t), n = t.ownerDocument.body, r = X(e.scrollWidth, e.clientWidth, n.scrollWidth, n.clientWidth), s = X(e.scrollHeight, e.clientHeight, n.scrollHeight, n.clientHeight);
|
|
961
961
|
let i = -o.scrollLeft + zt(t);
|
|
962
962
|
const c = -o.scrollTop;
|
|
963
963
|
return C(n).direction === "rtl" && (i += X(e.clientWidth, n.clientWidth) - r), {
|
|
@@ -972,7 +972,7 @@ function wn(t, e) {
|
|
|
972
972
|
let s = n.clientWidth, i = n.clientHeight, c = 0, a = 0;
|
|
973
973
|
if (r) {
|
|
974
974
|
s = r.width, i = r.height;
|
|
975
|
-
const l =
|
|
975
|
+
const l = Ht();
|
|
976
976
|
(!l || l && e === "fixed") && (c = r.offsetLeft, a = r.offsetTop);
|
|
977
977
|
}
|
|
978
978
|
return {
|
|
@@ -1008,7 +1008,7 @@ function Yt(t, e, o) {
|
|
|
1008
1008
|
height: e.height
|
|
1009
1009
|
};
|
|
1010
1010
|
}
|
|
1011
|
-
return
|
|
1011
|
+
return yt(n);
|
|
1012
1012
|
}
|
|
1013
1013
|
function ve(t, e) {
|
|
1014
1014
|
const o = K(t);
|
|
@@ -1022,8 +1022,8 @@ function xn(t, e) {
|
|
|
1022
1022
|
const s = C(t).position === "fixed";
|
|
1023
1023
|
let i = s ? K(t) : t;
|
|
1024
1024
|
for (; k(i) && !et(i); ) {
|
|
1025
|
-
const c = C(i), a =
|
|
1026
|
-
!a && c.position === "fixed" && (r = null), (s ? !a && !r : !a && c.position === "static" && !!r && ["absolute", "fixed"].includes(r.position) ||
|
|
1025
|
+
const c = C(i), a = Bt(i);
|
|
1026
|
+
!a && c.position === "fixed" && (r = null), (s ? !a && !r : !a && c.position === "static" && !!r && ["absolute", "fixed"].includes(r.position) || ht(i) && !a && ve(t, i)) ? n = n.filter((h) => h !== i) : r = c, i = K(i);
|
|
1027
1027
|
}
|
|
1028
1028
|
return e.set(t, n), n;
|
|
1029
1029
|
}
|
|
@@ -1034,7 +1034,7 @@ function vn(t) {
|
|
|
1034
1034
|
rootBoundary: n,
|
|
1035
1035
|
strategy: r
|
|
1036
1036
|
} = t;
|
|
1037
|
-
const i = [...o === "clippingAncestors" ?
|
|
1037
|
+
const i = [...o === "clippingAncestors" ? bt(e) ? [] : xn(e, this._c) : [].concat(o), n], c = i[0], a = i.reduce((l, h) => {
|
|
1038
1038
|
const f = Yt(e, h, r);
|
|
1039
1039
|
return l.top = X(f.top, l.top), l.right = tt(f.right, l.right), l.bottom = tt(f.bottom, l.bottom), l.left = X(f.left, l.left), l;
|
|
1040
1040
|
}, Yt(e, c, r));
|
|
@@ -1066,7 +1066,7 @@ function Rn(t, e, o) {
|
|
|
1066
1066
|
a.x = zt(r);
|
|
1067
1067
|
}
|
|
1068
1068
|
if (n || !n && !s)
|
|
1069
|
-
if ((nt(e) !== "body" ||
|
|
1069
|
+
if ((nt(e) !== "body" || ht(r)) && (c = Rt(e)), n) {
|
|
1070
1070
|
const u = G(e, !0, s, e);
|
|
1071
1071
|
a.x = u.x + e.clientLeft, a.y = u.y + e.clientTop;
|
|
1072
1072
|
} else r && l();
|
|
@@ -1092,7 +1092,7 @@ function qt(t, e) {
|
|
|
1092
1092
|
}
|
|
1093
1093
|
function be(t, e) {
|
|
1094
1094
|
const o = E(t);
|
|
1095
|
-
if (
|
|
1095
|
+
if (bt(t))
|
|
1096
1096
|
return o;
|
|
1097
1097
|
if (!W(t)) {
|
|
1098
1098
|
let r = K(t);
|
|
@@ -1106,7 +1106,7 @@ function be(t, e) {
|
|
|
1106
1106
|
let n = qt(t, e);
|
|
1107
1107
|
for (; n && un(n) && At(n); )
|
|
1108
1108
|
n = qt(n, e);
|
|
1109
|
-
return n && et(n) && At(n) && !
|
|
1109
|
+
return n && et(n) && At(n) && !Bt(n) ? o : n || fn(t) || o;
|
|
1110
1110
|
}
|
|
1111
1111
|
const On = async function(t) {
|
|
1112
1112
|
const e = this.getOffsetParent || be, o = this.getDimensions, n = await o(t.floating);
|
|
@@ -1155,7 +1155,7 @@ function Ln(t, e) {
|
|
|
1155
1155
|
} = l;
|
|
1156
1156
|
if (c || e(), !m || !u)
|
|
1157
1157
|
return;
|
|
1158
|
-
const d =
|
|
1158
|
+
const d = mt(f), p = mt(r.clientWidth - (h + m)), w = mt(r.clientHeight - (f + u)), g = mt(h), y = {
|
|
1159
1159
|
rootMargin: -d + "px " + -p + "px " + -w + "px " + -g + "px",
|
|
1160
1160
|
threshold: X(0, tt(1, a)) || 1
|
|
1161
1161
|
};
|
|
@@ -1261,11 +1261,11 @@ const Sn = an, Tn = ln, Xt = sn, kn = rn, Cn = (t, e, o) => {
|
|
|
1261
1261
|
r,
|
|
1262
1262
|
() => q(
|
|
1263
1263
|
(n == null ? void 0 : n.onClickOutside) != null ? qe(n.onClickOutside) : null,
|
|
1264
|
-
|
|
1264
|
+
B(
|
|
1265
1265
|
(c) => re(
|
|
1266
1266
|
"body",
|
|
1267
1267
|
Et.div(
|
|
1268
|
-
|
|
1268
|
+
B((a) => {
|
|
1269
1269
|
a.style.position = "absolute";
|
|
1270
1270
|
const l = typeof (n == null ? void 0 : n.target) == "string" ? c.querySelector(
|
|
1271
1271
|
n.target
|
|
@@ -1343,7 +1343,7 @@ const Sn = an, Tn = ln, Xt = sn, kn = rn, Cn = (t, e, o) => {
|
|
|
1343
1343
|
placement: b
|
|
1344
1344
|
}))
|
|
1345
1345
|
),
|
|
1346
|
-
|
|
1346
|
+
B((y) => {
|
|
1347
1347
|
h = y, g();
|
|
1348
1348
|
})
|
|
1349
1349
|
) : null,
|
|
@@ -1420,7 +1420,7 @@ const Sn = an, Tn = ln, Xt = sn, kn = rn, Cn = (t, e, o) => {
|
|
|
1420
1420
|
var e;
|
|
1421
1421
|
return (e = t.target) == null ? void 0 : e.select();
|
|
1422
1422
|
});
|
|
1423
|
-
class
|
|
1423
|
+
class ct {
|
|
1424
1424
|
/**
|
|
1425
1425
|
* Creates a new Rect instance.
|
|
1426
1426
|
*
|
|
@@ -1438,7 +1438,7 @@ class Rt {
|
|
|
1438
1438
|
* console.log(rect.height); // 50
|
|
1439
1439
|
* ```
|
|
1440
1440
|
*/
|
|
1441
|
-
constructor(e, o, n, r) {
|
|
1441
|
+
constructor(e, o, n, r, s, i) {
|
|
1442
1442
|
/**
|
|
1443
1443
|
* Compares this rectangle with another rectangle for equality.
|
|
1444
1444
|
*
|
|
@@ -1459,8 +1459,8 @@ class Rt {
|
|
|
1459
1459
|
* console.log(rect1.equals(rect3)); // true (within tolerance)
|
|
1460
1460
|
* ```
|
|
1461
1461
|
*/
|
|
1462
|
-
Ot(this, "equals", (e) =>
|
|
1463
|
-
this.left = e, this.top = o, this.width = n, this.height = r;
|
|
1462
|
+
Ot(this, "equals", (e) => dt(this.left, e.left) && dt(this.top, e.top) && dt(this.width, e.width) && dt(this.height, e.height));
|
|
1463
|
+
this.left = e, this.top = o, this.width = n, this.height = r, this.localLeft = s, this.localTop = i;
|
|
1464
1464
|
}
|
|
1465
1465
|
/**
|
|
1466
1466
|
* Creates a new Rect instance using an object with optional properties.
|
|
@@ -1491,9 +1491,11 @@ class Rt {
|
|
|
1491
1491
|
left: e = 0,
|
|
1492
1492
|
top: o = 0,
|
|
1493
1493
|
width: n = 0,
|
|
1494
|
-
height: r = 0
|
|
1494
|
+
height: r = 0,
|
|
1495
|
+
localLeft: s = 0,
|
|
1496
|
+
localTop: i = 0
|
|
1495
1497
|
}) {
|
|
1496
|
-
return new
|
|
1498
|
+
return new ct(e, o, n, r, s, i);
|
|
1497
1499
|
}
|
|
1498
1500
|
/**
|
|
1499
1501
|
* Gets the x-coordinate of the right edge of the rectangle.
|
|
@@ -1542,6 +1544,76 @@ class Rt {
|
|
|
1542
1544
|
y: this.top + this.height / 2
|
|
1543
1545
|
};
|
|
1544
1546
|
}
|
|
1547
|
+
/**
|
|
1548
|
+
* Gets the rectangle relative to the parent.
|
|
1549
|
+
*
|
|
1550
|
+
* @returns A new Rect instance representing the local rectangle
|
|
1551
|
+
*
|
|
1552
|
+
* @example
|
|
1553
|
+
* ```typescript
|
|
1554
|
+
* const rect = new Rect(10, 20, 100, 50, 5, 10);
|
|
1555
|
+
* const localRect = rect.localRect;
|
|
1556
|
+
* console.log(localRect.left); // 5
|
|
1557
|
+
* console.log(localRect.top); // 10
|
|
1558
|
+
* console.log(localRect.width); // 100
|
|
1559
|
+
* console.log(localRect.height); // 50
|
|
1560
|
+
* ```
|
|
1561
|
+
*/
|
|
1562
|
+
get localRect() {
|
|
1563
|
+
return ct.of({
|
|
1564
|
+
left: this.localLeft,
|
|
1565
|
+
top: this.localTop,
|
|
1566
|
+
width: this.width,
|
|
1567
|
+
height: this.height
|
|
1568
|
+
});
|
|
1569
|
+
}
|
|
1570
|
+
/**
|
|
1571
|
+
* Gets the center point of the rectangle relative to the parent.
|
|
1572
|
+
*
|
|
1573
|
+
* @returns An object with x and y coordinates of the center point
|
|
1574
|
+
*
|
|
1575
|
+
* @example
|
|
1576
|
+
* ```typescript
|
|
1577
|
+
* const rect = new Rect(10, 20, 100, 50, 5, 10);
|
|
1578
|
+
* const localCenter = rect.localCenter;
|
|
1579
|
+
* console.log(localCenter.x); // 55 (localLeft + width/2)
|
|
1580
|
+
* console.log(localCenter.y); // 65 (localTop + height/2)
|
|
1581
|
+
* ```
|
|
1582
|
+
*/
|
|
1583
|
+
get localCenter() {
|
|
1584
|
+
return {
|
|
1585
|
+
x: this.localLeft + this.width / 2,
|
|
1586
|
+
y: this.localTop + this.height / 2
|
|
1587
|
+
};
|
|
1588
|
+
}
|
|
1589
|
+
/**
|
|
1590
|
+
* Gets the bottom edge of the rectangle relative to the parent.
|
|
1591
|
+
*
|
|
1592
|
+
* @returns The bottom edge position (localTop + height)
|
|
1593
|
+
*
|
|
1594
|
+
* @example
|
|
1595
|
+
* ```typescript
|
|
1596
|
+
* const rect = new Rect(10, 20, 100, 50, 5, 10);
|
|
1597
|
+
* console.log(rect.localBottom); // 60 (localTop + height)
|
|
1598
|
+
* ```
|
|
1599
|
+
*/
|
|
1600
|
+
get localBottom() {
|
|
1601
|
+
return this.localTop + this.height;
|
|
1602
|
+
}
|
|
1603
|
+
/**
|
|
1604
|
+
* Gets the right edge of the rectangle relative to the parent.
|
|
1605
|
+
*
|
|
1606
|
+
* @returns The right edge position (localLeft + width)
|
|
1607
|
+
*
|
|
1608
|
+
* @example
|
|
1609
|
+
* ```typescript
|
|
1610
|
+
* const rect = new Rect(10, 20, 100, 50, 5, 10);
|
|
1611
|
+
* console.log(rect.localRight); // 105 (localLeft + width)
|
|
1612
|
+
* ```
|
|
1613
|
+
*/
|
|
1614
|
+
get localRight() {
|
|
1615
|
+
return this.localLeft + this.width;
|
|
1616
|
+
}
|
|
1545
1617
|
/**
|
|
1546
1618
|
* Gets the size dimensions of the rectangle.
|
|
1547
1619
|
*
|
|
@@ -1561,7 +1633,7 @@ class Rt {
|
|
|
1561
1633
|
}
|
|
1562
1634
|
function Jt(t) {
|
|
1563
1635
|
const e = t.getBoundingClientRect();
|
|
1564
|
-
return
|
|
1636
|
+
return ct.of({
|
|
1565
1637
|
top: e.top + window.scrollY,
|
|
1566
1638
|
left: e.left + window.scrollX,
|
|
1567
1639
|
width: e.width,
|
|
@@ -1569,7 +1641,7 @@ function Jt(t) {
|
|
|
1569
1641
|
});
|
|
1570
1642
|
}
|
|
1571
1643
|
const io = (t) => Te((e) => {
|
|
1572
|
-
const { element: o } = e, n = F(Jt(o), (c, a) => c.equals(a)), r = Mt(t(n))(e), s = () => n.set(
|
|
1644
|
+
const { element: o } = e, n = F(Jt(o), (c, a) => c.equals(a)), r = Mt(t(n))(e), s = () => n.set(ct.of(Jt(o)));
|
|
1573
1645
|
let i = null;
|
|
1574
1646
|
return typeof ResizeObserver < "u" && (i = new ResizeObserver(s)), i == null || i.observe(o), M((c) => {
|
|
1575
1647
|
i == null || i.disconnect(), r(c);
|
|
@@ -1583,7 +1655,7 @@ function Gt(t) {
|
|
|
1583
1655
|
};
|
|
1584
1656
|
}
|
|
1585
1657
|
const co = (t) => (e) => {
|
|
1586
|
-
const o =
|
|
1658
|
+
const o = lt(), n = F(
|
|
1587
1659
|
Gt(o),
|
|
1588
1660
|
(i, c) => i.width === c.width && i.height === c.height
|
|
1589
1661
|
), r = Mt(t(n))(e), s = () => n.set(Gt(o));
|
|
@@ -1729,10 +1801,10 @@ const co = (t) => (e) => {
|
|
|
1729
1801
|
t
|
|
1730
1802
|
);
|
|
1731
1803
|
}));
|
|
1732
|
-
},
|
|
1804
|
+
}, xt = 60 * 1e3, Dt = 60 * xt, at = 24 * Dt, Qt = 7 * at, Zt = 30 * at, Vn = 365 * at, $n = [
|
|
1733
1805
|
{
|
|
1734
|
-
max:
|
|
1735
|
-
value:
|
|
1806
|
+
max: xt * 90,
|
|
1807
|
+
value: xt,
|
|
1736
1808
|
name: "minute",
|
|
1737
1809
|
past: { singular: "a minute ago", plural: "{} minutes ago" },
|
|
1738
1810
|
future: { singular: "in a minute", plural: "in {} minutes" }
|
|
@@ -1745,8 +1817,8 @@ const co = (t) => (e) => {
|
|
|
1745
1817
|
future: { singular: "in an hour", plural: "in {} hours" }
|
|
1746
1818
|
},
|
|
1747
1819
|
{
|
|
1748
|
-
max:
|
|
1749
|
-
value:
|
|
1820
|
+
max: at * 10,
|
|
1821
|
+
value: at,
|
|
1750
1822
|
name: "day",
|
|
1751
1823
|
past: { singular: "yesterday", plural: "{} days ago" },
|
|
1752
1824
|
future: { singular: "tomorrow", plural: "in {} days" }
|
|
@@ -1783,25 +1855,25 @@ function te(t, e, o, n) {
|
|
|
1783
1855
|
})
|
|
1784
1856
|
);
|
|
1785
1857
|
}
|
|
1786
|
-
const
|
|
1858
|
+
const Bn = (t = 1e3) => {
|
|
1787
1859
|
const e = F(/* @__PURE__ */ new Date()), o = De(() => e.set(/* @__PURE__ */ new Date()), t);
|
|
1788
1860
|
return e.onDispose(o), e;
|
|
1789
|
-
},
|
|
1861
|
+
}, Hn = (t) => {
|
|
1790
1862
|
const e = Math.abs(t);
|
|
1791
|
-
if (e <
|
|
1863
|
+
if (e < xt)
|
|
1792
1864
|
return t < 0 ? "just now" : "in a moment";
|
|
1793
1865
|
for (const o of $n)
|
|
1794
1866
|
if (e < o.max)
|
|
1795
1867
|
return t < 0 ? te(e, o.value, o.past.singular, o.past.plural) : te(e, o.value, o.future.singular, o.future.plural);
|
|
1796
1868
|
throw new Error("unreachable");
|
|
1797
1869
|
}, Un = (t, { now: e, frequency: o = 1e4 } = {}) => {
|
|
1798
|
-
const n = e != null ? ee.is(e) ? e.derive() : F(e) :
|
|
1870
|
+
const n = e != null ? ee.is(e) ? e.derive() : F(e) : Bn(o), r = ie(
|
|
1799
1871
|
t,
|
|
1800
1872
|
n
|
|
1801
1873
|
)((s, i) => s.getTime() - i.getTime());
|
|
1802
1874
|
return r.onDispose(() => A.dispose(n)), r;
|
|
1803
1875
|
}, zn = (t, e = {}) => {
|
|
1804
|
-
const o = Un(t, e), n = o.map(
|
|
1876
|
+
const o = Un(t, e), n = o.map(Hn);
|
|
1805
1877
|
return n.onDispose(o.dispose), n;
|
|
1806
1878
|
}, fo = (t, e = {}) => zn(t, e);
|
|
1807
1879
|
class Kn extends Ce {
|
|
@@ -1832,7 +1904,7 @@ export {
|
|
|
1832
1904
|
eo as OnEscapeKey,
|
|
1833
1905
|
fe as OnKeyPressed,
|
|
1834
1906
|
oo as PopOver,
|
|
1835
|
-
|
|
1907
|
+
ct as Rect,
|
|
1836
1908
|
ro as Resource,
|
|
1837
1909
|
Wn as ResourceDisplay,
|
|
1838
1910
|
Fn as ResultView,
|
|
@@ -1855,13 +1927,13 @@ export {
|
|
|
1855
1927
|
Dn as makeResource,
|
|
1856
1928
|
Xe as matchesKeyCombo,
|
|
1857
1929
|
Mn as matchesRoute,
|
|
1858
|
-
|
|
1930
|
+
Bn as nowSignal,
|
|
1859
1931
|
fo as relativeTime,
|
|
1860
1932
|
Un as relativeTimeMillisSignal,
|
|
1861
1933
|
zn as relativeTimeSignal,
|
|
1862
1934
|
Kt as setLocationFromUrl,
|
|
1863
1935
|
ho as ticker,
|
|
1864
|
-
|
|
1936
|
+
Hn as timeDiffToString,
|
|
1865
1937
|
Pt as urlFromLocation,
|
|
1866
1938
|
je as useAppearance
|
|
1867
1939
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tempots/ui",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./index.cjs",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -41,6 +41,6 @@
|
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
43
|
"@tempots/std": "0.22.1",
|
|
44
|
-
"@tempots/dom": "
|
|
44
|
+
"@tempots/dom": "29.0.1"
|
|
45
45
|
}
|
|
46
46
|
}
|
package/renderables/size.d.ts
CHANGED
|
@@ -34,6 +34,10 @@ export declare class Rect {
|
|
|
34
34
|
readonly width: number;
|
|
35
35
|
/** The height of the rectangle */
|
|
36
36
|
readonly height: number;
|
|
37
|
+
/** The x-coordinate of the left edge of the rectangle relative to the parent */
|
|
38
|
+
readonly localLeft: number;
|
|
39
|
+
/** The y-coordinate of the top edge of the rectangle relative to the parent */
|
|
40
|
+
readonly localTop: number;
|
|
37
41
|
/**
|
|
38
42
|
* Creates a new Rect instance using an object with optional properties.
|
|
39
43
|
*
|
|
@@ -59,11 +63,13 @@ export declare class Rect {
|
|
|
59
63
|
* const fullRect = Rect.of({ left: 10, top: 20, width: 100, height: 50 });
|
|
60
64
|
* ```
|
|
61
65
|
*/
|
|
62
|
-
static of({ left, top, width, height, }: {
|
|
66
|
+
static of({ left, top, width, height, localLeft, localTop, }: {
|
|
63
67
|
left?: number;
|
|
64
68
|
top?: number;
|
|
65
69
|
width?: number;
|
|
66
70
|
height?: number;
|
|
71
|
+
localLeft?: number;
|
|
72
|
+
localTop?: number;
|
|
67
73
|
}): Rect;
|
|
68
74
|
/**
|
|
69
75
|
* Creates a new Rect instance.
|
|
@@ -90,7 +96,11 @@ export declare class Rect {
|
|
|
90
96
|
/** The width of the rectangle */
|
|
91
97
|
width: number,
|
|
92
98
|
/** The height of the rectangle */
|
|
93
|
-
height: number
|
|
99
|
+
height: number,
|
|
100
|
+
/** The x-coordinate of the left edge of the rectangle relative to the parent */
|
|
101
|
+
localLeft: number,
|
|
102
|
+
/** The y-coordinate of the top edge of the rectangle relative to the parent */
|
|
103
|
+
localTop: number);
|
|
94
104
|
/**
|
|
95
105
|
* Gets the x-coordinate of the right edge of the rectangle.
|
|
96
106
|
*
|
|
@@ -132,6 +142,63 @@ export declare class Rect {
|
|
|
132
142
|
x: number;
|
|
133
143
|
y: number;
|
|
134
144
|
};
|
|
145
|
+
/**
|
|
146
|
+
* Gets the rectangle relative to the parent.
|
|
147
|
+
*
|
|
148
|
+
* @returns A new Rect instance representing the local rectangle
|
|
149
|
+
*
|
|
150
|
+
* @example
|
|
151
|
+
* ```typescript
|
|
152
|
+
* const rect = new Rect(10, 20, 100, 50, 5, 10);
|
|
153
|
+
* const localRect = rect.localRect;
|
|
154
|
+
* console.log(localRect.left); // 5
|
|
155
|
+
* console.log(localRect.top); // 10
|
|
156
|
+
* console.log(localRect.width); // 100
|
|
157
|
+
* console.log(localRect.height); // 50
|
|
158
|
+
* ```
|
|
159
|
+
*/
|
|
160
|
+
get localRect(): Rect;
|
|
161
|
+
/**
|
|
162
|
+
* Gets the center point of the rectangle relative to the parent.
|
|
163
|
+
*
|
|
164
|
+
* @returns An object with x and y coordinates of the center point
|
|
165
|
+
*
|
|
166
|
+
* @example
|
|
167
|
+
* ```typescript
|
|
168
|
+
* const rect = new Rect(10, 20, 100, 50, 5, 10);
|
|
169
|
+
* const localCenter = rect.localCenter;
|
|
170
|
+
* console.log(localCenter.x); // 55 (localLeft + width/2)
|
|
171
|
+
* console.log(localCenter.y); // 65 (localTop + height/2)
|
|
172
|
+
* ```
|
|
173
|
+
*/
|
|
174
|
+
get localCenter(): {
|
|
175
|
+
x: number;
|
|
176
|
+
y: number;
|
|
177
|
+
};
|
|
178
|
+
/**
|
|
179
|
+
* Gets the bottom edge of the rectangle relative to the parent.
|
|
180
|
+
*
|
|
181
|
+
* @returns The bottom edge position (localTop + height)
|
|
182
|
+
*
|
|
183
|
+
* @example
|
|
184
|
+
* ```typescript
|
|
185
|
+
* const rect = new Rect(10, 20, 100, 50, 5, 10);
|
|
186
|
+
* console.log(rect.localBottom); // 60 (localTop + height)
|
|
187
|
+
* ```
|
|
188
|
+
*/
|
|
189
|
+
get localBottom(): number;
|
|
190
|
+
/**
|
|
191
|
+
* Gets the right edge of the rectangle relative to the parent.
|
|
192
|
+
*
|
|
193
|
+
* @returns The right edge position (localLeft + width)
|
|
194
|
+
*
|
|
195
|
+
* @example
|
|
196
|
+
* ```typescript
|
|
197
|
+
* const rect = new Rect(10, 20, 100, 50, 5, 10);
|
|
198
|
+
* console.log(rect.localRight); // 105 (localLeft + width)
|
|
199
|
+
* ```
|
|
200
|
+
*/
|
|
201
|
+
get localRight(): number;
|
|
135
202
|
/**
|
|
136
203
|
* Gets the size dimensions of the rectangle.
|
|
137
204
|
*
|