@tempots/ui 0.16.0 → 0.16.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 CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("@tempots/dom"),Et=t=>{const e=t.split("/").pop();if(e==null||e.startsWith("."))return;const o=e.split(".")||[];return o.length>1?"."+o.pop():void 0},Ot=(t,e)=>{const o=Et(e);return o!=null&&(t.length===0||!t.some(n=>o==n))},Gt=(t,e,o,n)=>{let i=t.target;for(;i!=null&&!(i instanceof HTMLAnchorElement);)i=i.parentElement;if(i==null)return!0;const r=i;if(t.button!==0||t.ctrlKey||t.metaKey||r.target!=="_self"&&r.target!==""||r.getAttribute("download")!=null)return!0;const{pathname:s,search:c,hash:a}=r;if(n){const l=s+c+a,f=r.getAttribute("href");if(!(f!=null&&f.startsWith("#"))&&f!==l)return!0}return e?!1:Ot(o,s)},Rt=(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=>{Gt(n,e.ignoreUrlWithExtension??!0,o,e.ignoreExternalUrl??!0)||t()&&n.preventDefault()}},ct=u.makeProviderMark("LocationProvider"),Lt=()=>{const t=(window==null?void 0:window.location.hash)===""?void 0:(window==null?void 0:window.location.hash.substring(1))??void 0;return{pathname:(window==null?void 0:window.location.pathname)??"",search:Object.fromEntries(new URLSearchParams((window==null?void 0:window.location.search)??"").entries()),hash:t}},St=(t,e)=>t.pathname===e.pathname&&JSON.stringify(t.search)===JSON.stringify(e.search)&&t.hash===e.hash,kt=t=>{const e=new URL(t,(window==null?void 0:window.location.toString())??""),o=Object.fromEntries(e.searchParams.entries());let n=e.hash;return n.startsWith("#")&&(n=n.substring(1)),{pathname:e.pathname,search:o,hash:n===""?void 0:n}},Tt=(t,e)=>{const o=kt(e);return t.set(o),t},Pt=t=>{const o=new URLSearchParams(t.search).toString(),n=t.hash;return`${t.pathname}${o?`?${o}`:""}${n?`#${n}`:""}`},Ct=()=>{const t=u.makeProp(Lt(),St),e=()=>{let o=(window==null?void 0:window.location.hash)??"";o.startsWith("#")&&(o=o.substring(1));const n={pathname:(window==null?void 0:window.location.pathname)??"",search:Object.fromEntries(new URLSearchParams((window==null?void 0:window.location.search)??"").entries()),hash:o===""?void 0:o};t.set(n)};return window==null||window.addEventListener("popstate",e),t.onDispose(()=>{window==null||window.removeEventListener("popstate",e)}),t.on(o=>{window==null||window.history.pushState({},"",Pt(o))}),t},Qt=t=>{const e=Ct();return u.Fragment(u.OnUnmount(e.dispose),u.WithProvider(ct,e,t))},lt=t=>u.UseProvider(ct,e=>o=>{const n=u.makeProp(e.value,e.equals);e.feedProp(n),n.on(e.set);const i=u.renderableOfTNode(t(n))(o);return r=>{n.dispose(),i(r)}}),Zt=(t,...e)=>lt(o=>u.html.a(u.on.click(Rt(()=>(Tt(o,u.Signal.unwrap(t)),!0))),u.attr.href(t),...e)),at=u.makeProviderMark("Appearance"),te=t=>{const e=window.matchMedia!=null&&window.matchMedia("(prefers-color-scheme: dark)").matches,o=u.makeProp(e?"dark":"light"),n=r=>{o.set(r.matches?"dark":"light")},i=window.matchMedia!=null?window.matchMedia("(prefers-color-scheme: dark)"):void 0;return i==null||i.addEventListener("change",n),u.Fragment(u.WithProvider(at,o,t),u.OnUnmount(()=>i==null?void 0:i.removeEventListener("change",n)))},ee=t=>u.UseProvider(at,t),Ft=(t,e)=>{if(typeof e=="function")return Ft(t,{success:e});const o=e.failure??(s=>u.Fragment(u.OnUnmount(s.on(console.error)),s.map(c=>`Error: ${c}`))),n=e.success,i=e.loading??(()=>u.Empty),r=e.notAsked??(()=>u.Empty);return u.OneOfType(u.Signal.wrap(t),{AsyncSuccess:s=>n(s.$.value),AsyncFailure:s=>o(s.$.error),Loading:s=>i(s.$.previousValue??u.makeSignal(void 0)),NotAsked:r})},ne=(t=10)=>e=>{const o=setTimeout(()=>{var n;(n=e.element)==null||n.focus()},t);return n=>clearTimeout(o)},oe=(t=10)=>e=>{const o=setTimeout(()=>{var n;(n=e.element)==null||n.select()},t);return n=>{clearTimeout(o)}},ie=t=>{const e=t.element,o=e.style.getPropertyValue(":empty");return e.style.setProperty(":empty","display:none"),n=>{n&&e.style.setProperty(":empty",o)}},re=t=>u.Portal("head > title",u.attr.innerText(t)),se={partial:{root:null,rootMargin:"0px",threshold:0},full:{root:null,rootMargin:"0px",threshold:1}},K={partial:new Map,full:new Map},I={partial:null,full:null};function ce(t){return I[t]==null&&(I[t]=new IntersectionObserver(e=>{e.forEach(o=>{const n=K[t].get(o.target);n==null||n.set(o.isIntersecting)})},se[t])),I[t]}const Mt=(t,e)=>{const o=u.makeProp(u.isSSR());return u.Fragment(u.OnMount(n=>{const i=typeof IntersectionObserver<"u"?ce(t):null;return K[t].set(n,o),i==null||i.observe(n),()=>{var r;i==null||i.unobserve(n),K[t].delete(n),K[t].size===0&&((r=I[t])==null||r.disconnect(),I[t]=null)}}),u.OnUnmount(o.dispose),u.renderableOfTNode(e(o)))},le=(t,e,o)=>Mt(t,n=>u.When(n,e,o??u.Empty)),J=Math.min,M=Math.max,G=Math.round,Y=Math.floor,P=t=>({x:t,y:t}),ae={left:"right",right:"left",bottom:"top",top:"bottom"},ue={start:"end",end:"start"};function wt(t,e,o){return M(t,J(e,o))}function tt(t,e){return typeof t=="function"?t(e):t}function W(t){return t.split("-")[0]}function et(t){return t.split("-")[1]}function Wt(t){return t==="x"?"y":"x"}function Dt(t){return t==="y"?"height":"width"}function _(t){return["top","bottom"].includes(W(t))?"y":"x"}function Nt(t){return Wt(_(t))}function fe(t,e,o){o===void 0&&(o=!1);const n=et(t),i=Nt(t),r=Dt(i);let s=i==="x"?n===(o?"end":"start")?"right":"left":n==="start"?"bottom":"top";return e.reference[r]>e.floating[r]&&(s=Q(s)),[s,Q(s)]}function de(t){const e=Q(t);return[st(t),e,st(e)]}function st(t){return t.replace(/start|end/g,e=>ue[e])}function he(t,e,o){const n=["left","right"],i=["right","left"],r=["top","bottom"],s=["bottom","top"];switch(t){case"top":case"bottom":return o?e?i:n:e?n:i;case"left":case"right":return e?r:s;default:return[]}}function me(t,e,o,n){const i=et(t);let r=he(W(t),o==="start",n);return i&&(r=r.map(s=>s+"-"+i),e&&(r=r.concat(r.map(st)))),r}function Q(t){return t.replace(/left|right|bottom|top/g,e=>ae[e])}function pe(t){return{top:0,right:0,bottom:0,left:0,...t}}function ge(t){return typeof t!="number"?pe(t):{top:t,right:t,bottom:t,left:t}}function Z(t){const{x:e,y:o,width:n,height:i}=t;return{width:n,height:i,top:o,left:e,right:e+n,bottom:o+i,x:e,y:o}}function yt(t,e,o){let{reference:n,floating:i}=t;const r=_(e),s=Nt(e),c=Dt(s),a=W(e),l=r==="y",f=n.x+n.width/2-i.width/2,d=n.y+n.height/2-i.height/2,p=n[c]/2-i[c]/2;let h;switch(a){case"top":h={x:f,y:n.y-i.height};break;case"bottom":h={x:f,y:n.y+n.height};break;case"right":h={x:n.x+n.width,y:d};break;case"left":h={x:n.x-i.width,y:d};break;default:h={x:n.x,y:n.y}}switch(et(e)){case"start":h[s]-=p*(o&&l?-1:1);break;case"end":h[s]+=p*(o&&l?-1:1);break}return h}const we=async(t,e,o)=>{const{placement:n="bottom",strategy:i="absolute",middleware:r=[],platform:s}=o,c=r.filter(Boolean),a=await(s.isRTL==null?void 0:s.isRTL(e));let l=await s.getElementRects({reference:t,floating:e,strategy:i}),{x:f,y:d}=yt(l,n,a),p=n,h={},g=0;for(let w=0;w<c.length;w++){const{name:y,fn:m}=c[w],{x:v,y:x,data:A,reset:b}=await m({x:f,y:d,initialPlacement:n,placement:p,strategy:i,middlewareData:h,rects:l,platform:s,elements:{reference:t,floating:e}});f=v??f,d=x??d,h={...h,[y]:{...h[y],...A}},b&&g<=50&&(g++,typeof b=="object"&&(b.placement&&(p=b.placement),b.rects&&(l=b.rects===!0?await s.getElementRects({reference:t,floating:e,strategy:i}):b.rects),{x:f,y:d}=yt(l,p,a)),w=-1)}return{x:f,y:d,placement:p,strategy:i,middlewareData:h}};async function Vt(t,e){var o;e===void 0&&(e={});const{x:n,y:i,platform:r,rects:s,elements:c,strategy:a}=t,{boundary:l="clippingAncestors",rootBoundary:f="viewport",elementContext:d="floating",altBoundary:p=!1,padding:h=0}=tt(e,t),g=ge(h),y=c[p?d==="floating"?"reference":"floating":d],m=Z(await r.getClippingRect({element:(o=await(r.isElement==null?void 0:r.isElement(y)))==null||o?y:y.contextElement||await(r.getDocumentElement==null?void 0:r.getDocumentElement(c.floating)),boundary:l,rootBoundary:f,strategy:a})),v=d==="floating"?{x:n,y:i,width:s.floating.width,height:s.floating.height}:s.reference,x=await(r.getOffsetParent==null?void 0:r.getOffsetParent(c.floating)),A=await(r.isElement==null?void 0:r.isElement(x))?await(r.getScale==null?void 0:r.getScale(x))||{x:1,y:1}:{x:1,y:1},b=Z(r.convertOffsetParentRelativeRectToViewportRelativeRect?await r.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:v,offsetParent:x,strategy:a}):v);return{top:(m.top-b.top+g.top)/A.y,bottom:(b.bottom-m.bottom+g.bottom)/A.y,left:(m.left-b.left+g.left)/A.x,right:(b.right-m.right+g.right)/A.x}}const ye=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var o,n;const{placement:i,middlewareData:r,rects:s,initialPlacement:c,platform:a,elements:l}=e,{mainAxis:f=!0,crossAxis:d=!0,fallbackPlacements:p,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:w=!0,...y}=tt(t,e);if((o=r.arrow)!=null&&o.alignmentOffset)return{};const m=W(i),v=_(c),x=W(c)===c,A=await(a.isRTL==null?void 0:a.isRTL(l.floating)),b=p||(x||!w?[Q(c)]:de(c)),N=g!=="none";!p&&N&&b.push(...me(c,w,g,A));const Kt=[c,...b],it=await Vt(e,y),X=[];let H=((n=r.flip)==null?void 0:n.overflows)||[];if(f&&X.push(it[m]),d){const F=fe(i,s,A);X.push(it[F[0]],it[F[1]])}if(H=[...H,{placement:i,overflows:X}],!X.every(F=>F<=0)){var ht,mt;const F=(((ht=r.flip)==null?void 0:ht.index)||0)+1,gt=Kt[F];if(gt)return{data:{index:F,overflows:H},reset:{placement:gt}};let B=(mt=H.filter(V=>V.overflows[0]<=0).sort((V,k)=>V.overflows[1]-k.overflows[1])[0])==null?void 0:mt.placement;if(!B)switch(h){case"bestFit":{var pt;const V=(pt=H.filter(k=>{if(N){const T=_(k.placement);return T===v||T==="y"}return!0}).map(k=>[k.placement,k.overflows.filter(T=>T>0).reduce((T,Jt)=>T+Jt,0)]).sort((k,T)=>k[1]-T[1])[0])==null?void 0:pt[0];V&&(B=V);break}case"initialPlacement":B=c;break}if(i!==B)return{reset:{placement:B}}}return{}}}};async function ve(t,e){const{placement:o,platform:n,elements:i}=t,r=await(n.isRTL==null?void 0:n.isRTL(i.floating)),s=W(o),c=et(o),a=_(o)==="y",l=["left","top"].includes(s)?-1:1,f=r&&a?-1:1,d=tt(e,t);let{mainAxis:p,crossAxis:h,alignmentAxis:g}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...d};return c&&typeof g=="number"&&(h=c==="end"?g*-1:g),a?{x:h*f,y:p*l}:{x:p*l,y:h*f}}const xe=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var o,n;const{x:i,y:r,placement:s,middlewareData:c}=e,a=await ve(e,t);return s===((o=c.offset)==null?void 0:o.placement)&&(n=c.arrow)!=null&&n.alignmentOffset?{}:{x:i+a.x,y:r+a.y,data:{...a,placement:s}}}}},be=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:o,y:n,placement:i}=e,{mainAxis:r=!0,crossAxis:s=!1,limiter:c={fn:y=>{let{x:m,y:v}=y;return{x:m,y:v}}},...a}=tt(t,e),l={x:o,y:n},f=await Vt(e,a),d=_(W(i)),p=Wt(d);let h=l[p],g=l[d];if(r){const y=p==="y"?"top":"left",m=p==="y"?"bottom":"right",v=h+f[y],x=h-f[m];h=wt(v,h,x)}if(s){const y=d==="y"?"top":"left",m=d==="y"?"bottom":"right",v=g+f[y],x=g-f[m];g=wt(v,g,x)}const w=c.fn({...e,[p]:h,[d]:g});return{...w,data:{x:w.x-o,y:w.y-n}}}}};function z(t){return Ut(t)?(t.nodeName||"").toLowerCase():"#document"}function E(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function S(t){var e;return(e=(Ut(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function Ut(t){return t instanceof Node||t instanceof E(t).Node}function R(t){return t instanceof Element||t instanceof E(t).Element}function L(t){return t instanceof HTMLElement||t instanceof E(t).HTMLElement}function vt(t){return typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof E(t).ShadowRoot}function q(t){const{overflow:e,overflowX:o,overflowY:n,display:i}=O(t);return/auto|scroll|overlay|hidden|clip/.test(e+n+o)&&!["inline","contents"].includes(i)}function Ae(t){return["table","td","th"].includes(z(t))}function nt(t){return[":popover-open",":modal"].some(e=>{try{return t.matches(e)}catch{return!1}})}function ut(t){const e=ft(),o=O(t);return o.transform!=="none"||o.perspective!=="none"||(o.containerType?o.containerType!=="normal":!1)||!e&&(o.backdropFilter?o.backdropFilter!=="none":!1)||!e&&(o.filter?o.filter!=="none":!1)||["transform","perspective","filter"].some(n=>(o.willChange||"").includes(n))||["paint","layout","strict","content"].some(n=>(o.contain||"").includes(n))}function Ee(t){let e=C(t);for(;L(e)&&!$(e);){if(nt(e))return null;if(ut(e))return e;e=C(e)}return null}function ft(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function $(t){return["html","body","#document"].includes(z(t))}function O(t){return E(t).getComputedStyle(t)}function ot(t){return R(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function C(t){if(z(t)==="html")return t;const e=t.assignedSlot||t.parentNode||vt(t)&&t.host||S(t);return vt(e)?e.host:e}function _t(t){const e=C(t);return $(e)?t.ownerDocument?t.ownerDocument.body:t.body:L(e)&&q(e)?e:_t(e)}function j(t,e,o){var n;e===void 0&&(e=[]),o===void 0&&(o=!0);const i=_t(t),r=i===((n=t.ownerDocument)==null?void 0:n.body),s=E(i);return r?e.concat(s,s.visualViewport||[],q(i)?i:[],s.frameElement&&o?j(s.frameElement):[]):e.concat(i,j(i,[],o))}function $t(t){const e=O(t);let o=parseFloat(e.width)||0,n=parseFloat(e.height)||0;const i=L(t),r=i?t.offsetWidth:o,s=i?t.offsetHeight:n,c=G(o)!==r||G(n)!==s;return c&&(o=r,n=s),{width:o,height:n,$:c}}function dt(t){return R(t)?t:t.contextElement}function U(t){const e=dt(t);if(!L(e))return P(1);const o=e.getBoundingClientRect(),{width:n,height:i,$:r}=$t(e);let s=(r?G(o.width):o.width)/n,c=(r?G(o.height):o.height)/i;return(!s||!Number.isFinite(s))&&(s=1),(!c||!Number.isFinite(c))&&(c=1),{x:s,y:c}}const Oe=P(0);function zt(t){const e=E(t);return!ft()||!e.visualViewport?Oe:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function Re(t,e,o){return e===void 0&&(e=!1),!o||e&&o!==E(t)?!1:e}function D(t,e,o,n){e===void 0&&(e=!1),o===void 0&&(o=!1);const i=t.getBoundingClientRect(),r=dt(t);let s=P(1);e&&(n?R(n)&&(s=U(n)):s=U(t));const c=Re(r,o,n)?zt(r):P(0);let a=(i.left+c.x)/s.x,l=(i.top+c.y)/s.y,f=i.width/s.x,d=i.height/s.y;if(r){const p=E(r),h=n&&R(n)?E(n):n;let g=p,w=g.frameElement;for(;w&&n&&h!==g;){const y=U(w),m=w.getBoundingClientRect(),v=O(w),x=m.left+(w.clientLeft+parseFloat(v.paddingLeft))*y.x,A=m.top+(w.clientTop+parseFloat(v.paddingTop))*y.y;a*=y.x,l*=y.y,f*=y.x,d*=y.y,a+=x,l+=A,g=E(w),w=g.frameElement}}return Z({width:f,height:d,x:a,y:l})}function Le(t){let{elements:e,rect:o,offsetParent:n,strategy:i}=t;const r=i==="fixed",s=S(n),c=e?nt(e.floating):!1;if(n===s||c&&r)return o;let a={scrollLeft:0,scrollTop:0},l=P(1);const f=P(0),d=L(n);if((d||!d&&!r)&&((z(n)!=="body"||q(s))&&(a=ot(n)),L(n))){const p=D(n);l=U(n),f.x=p.x+n.clientLeft,f.y=p.y+n.clientTop}return{width:o.width*l.x,height:o.height*l.y,x:o.x*l.x-a.scrollLeft*l.x+f.x,y:o.y*l.y-a.scrollTop*l.y+f.y}}function Se(t){return Array.from(t.getClientRects())}function Ht(t){return D(S(t)).left+ot(t).scrollLeft}function ke(t){const e=S(t),o=ot(t),n=t.ownerDocument.body,i=M(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),r=M(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let s=-o.scrollLeft+Ht(t);const c=-o.scrollTop;return O(n).direction==="rtl"&&(s+=M(e.clientWidth,n.clientWidth)-i),{width:i,height:r,x:s,y:c}}function Te(t,e){const o=E(t),n=S(t),i=o.visualViewport;let r=n.clientWidth,s=n.clientHeight,c=0,a=0;if(i){r=i.width,s=i.height;const l=ft();(!l||l&&e==="fixed")&&(c=i.offsetLeft,a=i.offsetTop)}return{width:r,height:s,x:c,y:a}}function Pe(t,e){const o=D(t,!0,e==="fixed"),n=o.top+t.clientTop,i=o.left+t.clientLeft,r=L(t)?U(t):P(1),s=t.clientWidth*r.x,c=t.clientHeight*r.y,a=i*r.x,l=n*r.y;return{width:s,height:c,x:a,y:l}}function xt(t,e,o){let n;if(e==="viewport")n=Te(t,o);else if(e==="document")n=ke(S(t));else if(R(e))n=Pe(e,o);else{const i=zt(t);n={...e,x:e.x-i.x,y:e.y-i.y}}return Z(n)}function Bt(t,e){const o=C(t);return o===e||!R(o)||$(o)?!1:O(o).position==="fixed"||Bt(o,e)}function Ce(t,e){const o=e.get(t);if(o)return o;let n=j(t,[],!1).filter(c=>R(c)&&z(c)!=="body"),i=null;const r=O(t).position==="fixed";let s=r?C(t):t;for(;R(s)&&!$(s);){const c=O(s),a=ut(s);!a&&c.position==="fixed"&&(i=null),(r?!a&&!i:!a&&c.position==="static"&&!!i&&["absolute","fixed"].includes(i.position)||q(s)&&!a&&Bt(t,s))?n=n.filter(f=>f!==s):i=c,s=C(s)}return e.set(t,n),n}function Fe(t){let{element:e,boundary:o,rootBoundary:n,strategy:i}=t;const s=[...o==="clippingAncestors"?nt(e)?[]:Ce(e,this._c):[].concat(o),n],c=s[0],a=s.reduce((l,f)=>{const d=xt(e,f,i);return l.top=M(d.top,l.top),l.right=J(d.right,l.right),l.bottom=J(d.bottom,l.bottom),l.left=M(d.left,l.left),l},xt(e,c,i));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function Me(t){const{width:e,height:o}=$t(t);return{width:e,height:o}}function We(t,e,o){const n=L(e),i=S(e),r=o==="fixed",s=D(t,!0,r,e);let c={scrollLeft:0,scrollTop:0};const a=P(0);if(n||!n&&!r)if((z(e)!=="body"||q(i))&&(c=ot(e)),n){const d=D(e,!0,r,e);a.x=d.x+e.clientLeft,a.y=d.y+e.clientTop}else i&&(a.x=Ht(i));const l=s.left+c.scrollLeft-a.x,f=s.top+c.scrollTop-a.y;return{x:l,y:f,width:s.width,height:s.height}}function rt(t){return O(t).position==="static"}function bt(t,e){return!L(t)||O(t).position==="fixed"?null:e?e(t):t.offsetParent}function It(t,e){const o=E(t);if(nt(t))return o;if(!L(t)){let i=C(t);for(;i&&!$(i);){if(R(i)&&!rt(i))return i;i=C(i)}return o}let n=bt(t,e);for(;n&&Ae(n)&&rt(n);)n=bt(n,e);return n&&$(n)&&rt(n)&&!ut(n)?o:n||Ee(t)||o}const De=async function(t){const e=this.getOffsetParent||It,o=this.getDimensions,n=await o(t.floating);return{reference:We(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function Ne(t){return O(t).direction==="rtl"}const Ve={convertOffsetParentRelativeRectToViewportRelativeRect:Le,getDocumentElement:S,getClippingRect:Fe,getOffsetParent:It,getElementRects:De,getClientRects:Se,getDimensions:Me,getScale:U,isElement:R,isRTL:Ne};function Ue(t,e){let o=null,n;const i=S(t);function r(){var c;clearTimeout(n),(c=o)==null||c.disconnect(),o=null}function s(c,a){c===void 0&&(c=!1),a===void 0&&(a=1),r();const{left:l,top:f,width:d,height:p}=t.getBoundingClientRect();if(c||e(),!d||!p)return;const h=Y(f),g=Y(i.clientWidth-(l+d)),w=Y(i.clientHeight-(f+p)),y=Y(l),v={rootMargin:-h+"px "+-g+"px "+-w+"px "+-y+"px",threshold:M(0,J(1,a))||1};let x=!0;function A(b){const N=b[0].intersectionRatio;if(N!==a){if(!x)return s();N?s(!1,N):n=setTimeout(()=>{s(!1,1e-7)},1e3)}x=!1}try{o=new IntersectionObserver(A,{...v,root:i.ownerDocument})}catch{o=new IntersectionObserver(A,v)}o.observe(t)}return s(!0),r}function _e(t,e,o,n){n===void 0&&(n={});const{ancestorScroll:i=!0,ancestorResize:r=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:a=!1}=n,l=dt(t),f=i||r?[...l?j(l):[],...j(e)]:[];f.forEach(m=>{i&&m.addEventListener("scroll",o,{passive:!0}),r&&m.addEventListener("resize",o)});const d=l&&c?Ue(l,o):null;let p=-1,h=null;s&&(h=new ResizeObserver(m=>{let[v]=m;v&&v.target===l&&h&&(h.unobserve(e),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var x;(x=h)==null||x.observe(e)})),o()}),l&&!a&&h.observe(l),h.observe(e));let g,w=a?D(t):null;a&&y();function y(){const m=D(t);w&&(m.x!==w.x||m.y!==w.y||m.width!==w.width||m.height!==w.height)&&o(),w=m,g=requestAnimationFrame(y)}return o(),()=>{var m;f.forEach(v=>{i&&v.removeEventListener("scroll",o),r&&v.removeEventListener("resize",o)}),d==null||d(),(m=h)==null||m.disconnect(),h=null,a&&cancelAnimationFrame(g)}}const $e=xe,ze=be,At=ye,He=(t,e,o)=>{const n=new Map,i={platform:Ve,...o},r={...i.platform,_c:n};return we(t,e,{...i,platform:r})},Be=({content:t,open:e,placement:o,offset:{mainAxis:n,crossAxis:i}={mainAxis:0,crossAxis:0}})=>r=>{const s=r.element,c=u.Signal.wrap(e);return u.When(c,u.Portal("body",u.html.div(u.OnMount(a=>{const l=a;return l.style.position="absolute",_e(s,l,()=>{He(s,l,{placement:o,strategy:"absolute",middleware:[At(),$e({mainAxis:n,crossAxis:i}),ze(),At()]}).then(({x:f,y:d})=>{l.style.top=`${d}px`,l.style.left=`${f}px`})})}),t())))(r)},jt=(t,e)=>{if(typeof e=="function")return jt(t,{success:e});const o=e.failure??(i=>u.Fragment(u.OnUnmount(i.on(console.error)),i.map(r=>`Error: ${r}`))),n=e.success;return u.OneOfType(u.Signal.wrap(t),{Success:i=>n(i.$.value),Failure:i=>o(i.$.error)})},Ie=()=>u.on.focus(t=>{var e;return(e=t.target)==null?void 0:e.select()}),je=t=>e=>{const o=e.element,n=u.makeProp({width:o.clientWidth,height:o.clientHeight}),i=u.renderableOfTNode(t(n))(e),r=()=>{n.set({width:o.clientWidth,height:o.clientHeight})};let s;return typeof ResizeObserver=="function"&&(s=new ResizeObserver(r),s.observe(o)),c=>{s==null||s.disconnect(),i(c)}},qe=t=>e=>{const o=u.makeProp({width:(window==null?void 0:window.innerWidth)??0,height:(window==null?void 0:window.innerHeight)??0}),n=u.renderableOfTNode(t(o))(e),i=()=>{o.set({width:(window==null?void 0:window.innerWidth)??0,height:(window==null?void 0:window.innerHeight)??0})};return window==null||window.addEventListener("resize",i),r=>{window==null||window.removeEventListener("resize",i),n(r)}},qt=(t,e)=>{const o=e.split("/").filter(i=>i!==""),n={};for(let i=0;i<t.length;i++){const r=t[i],s=o[i];if(!s&&r.type!=="catch-all")return null;if(r.type==="literal"){if(r.value!==s)return null}else if(r.type==="param")n[r.name]=s;else if(r.type==="catch-all")return{params:n,path:e}}return o.length!==t.length?null:{params:n,path:e}},Xt=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!==""),Yt=t=>{const e=t.map(o=>{const n=Xt(o);return{route:o,segments:n}});return function(n){for(const{segments:i,route:r}of e){const s=qt(i,n);if(s)return{...s,route:r}}return null}},Xe=t=>{const e=Yt(Object.keys(t));return lt(o=>{const n=o.map(i=>{const r=e(i.pathname);if(r==null)throw console.error("No route found for",i),new Error("No route found");return{params:r.params,route:r.route,path:r.path,search:i.search,hash:i.hash}});return u.OneOfTuple(n.map(i=>[i.route,i]),t)})};exports.Anchor=Zt;exports.AsyncResultView=Ft;exports.AutoFocus=ne;exports.AutoSelect=oe;exports.ElementSize=je;exports.HTMLTitle=re;exports.HiddenWhenEmpty=ie;exports.InViewport=Mt;exports.LocationProviderMarker=ct;exports.PopOver=Be;exports.ProvideAppearance=te;exports.ProvideLocation=Qt;exports.ResultView=jt;exports.Router=Xe;exports.SelectOnFocus=Ie;exports.UseAppearance=ee;exports.UseLocation=lt;exports.WhenInViewport=le;exports.WindowSize=qe;exports._checkExtensionCondition=Ot;exports._getExtension=Et;exports._makeLocation=Lt;exports._makeLocationProp=Ct;exports._makeRouteMatcher=Yt;exports._parseRouteSegments=Xt;exports.appearanceMarker=at;exports.areLocationsEqual=St;exports.handleAnchorClick=Rt;exports.locationFromURL=kt;exports.matchesRoute=qt;exports.setLocationFromUrl=Tt;exports.urlFromLocation=Pt;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("@tempots/dom"),Et=t=>{const e=t.split("/").pop();if(e==null||e.startsWith("."))return;const o=e.split(".")||[];return o.length>1?"."+o.pop():void 0},Rt=(t,e)=>{const o=Et(e);return o!=null&&(t.length===0||!t.some(n=>o==n))},Qt=(t,e,o,n)=>{let i=t.target;for(;i!=null&&!(i instanceof HTMLAnchorElement);)i=i.parentElement;if(i==null)return!0;const r=i;if(t.button!==0||t.ctrlKey||t.metaKey||r.target!=="_self"&&r.target!==""||r.getAttribute("download")!=null)return!0;const{pathname:s,search:c,hash:a}=r;if(n){const l=s+c+a,f=r.getAttribute("href");if(!(f!=null&&f.startsWith("#"))&&f!==l)return!0}return e?!1:Rt(o,s)},Ot=(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=>{Qt(n,e.ignoreUrlWithExtension??!0,o,e.ignoreExternalUrl??!0)||t()&&n.preventDefault()}},ct=u.makeProviderMark("LocationProvider"),Lt=()=>{const t=(window==null?void 0:window.location.hash)===""?void 0:(window==null?void 0:window.location.hash.substring(1))??void 0;return{pathname:(window==null?void 0:window.location.pathname)??"",search:Object.fromEntries(new URLSearchParams((window==null?void 0:window.location.search)??"").entries()),hash:t}},St=(t,e)=>t.pathname===e.pathname&&JSON.stringify(t.search)===JSON.stringify(e.search)&&t.hash===e.hash,kt=t=>{const e=new URL(t,(window==null?void 0:window.location.toString())??""),o=Object.fromEntries(e.searchParams.entries());let n=e.hash;return n.startsWith("#")&&(n=n.substring(1)),{pathname:e.pathname,search:o,hash:n===""?void 0:n}},Tt=(t,e)=>{const o=kt(e);return t.set(o),t},Pt=t=>{const o=new URLSearchParams(t.search).toString(),n=t.hash;return`${t.pathname}${o?`?${o}`:""}${n?`#${n}`:""}`},Ct=()=>{const t=u.makeProp(Lt(),St),e=()=>{let o=(window==null?void 0:window.location.hash)??"";o.startsWith("#")&&(o=o.substring(1));const n={pathname:(window==null?void 0:window.location.pathname)??"",search:Object.fromEntries(new URLSearchParams((window==null?void 0:window.location.search)??"").entries()),hash:o===""?void 0:o};t.set(n)};return window==null||window.addEventListener("popstate",e),t.onDispose(()=>{window==null||window.removeEventListener("popstate",e)}),t.on(o=>{window==null||window.history.pushState({},"",Pt(o))}),t},Zt=t=>{const e=Ct();return u.Fragment(u.OnUnmount(e.dispose),u.WithProvider(ct,e,t))},lt=t=>u.UseProvider(ct,e=>o=>{const n=u.makeProp(e.value,e.equals);e.feedProp(n),n.on(e.set);const i=u.renderableOfTNode(t(n))(o);return r=>{n.dispose(),i(r)}}),Ft=(t,...e)=>{if(typeof t=="string"||u.Signal.is(t))return Ft({href:t},...e);const{href:o,...n}=t;return lt(i=>u.html.a(u.on.click(Ot(()=>(Tt(i,u.Signal.unwrap(o)),!0),n)),u.attr.href(o),...e))},at=u.makeProviderMark("Appearance"),te=t=>{const e=window.matchMedia!=null&&window.matchMedia("(prefers-color-scheme: dark)").matches,o=u.makeProp(e?"dark":"light"),n=r=>{o.set(r.matches?"dark":"light")},i=window.matchMedia!=null?window.matchMedia("(prefers-color-scheme: dark)"):void 0;return i==null||i.addEventListener("change",n),u.Fragment(u.WithProvider(at,o,t),u.OnUnmount(()=>i==null?void 0:i.removeEventListener("change",n)))},ee=t=>u.UseProvider(at,t),Mt=(t,e)=>{if(typeof e=="function")return Mt(t,{success:e});const o=e.failure??(s=>u.Fragment(u.OnUnmount(s.on(console.error)),s.map(c=>`Error: ${c}`))),n=e.success,i=e.loading??(()=>u.Empty),r=e.notAsked??(()=>u.Empty);return u.OneOfType(u.Signal.wrap(t),{AsyncSuccess:s=>n(s.$.value),AsyncFailure:s=>o(s.$.error),Loading:s=>i(s.$.previousValue??u.makeSignal(void 0)),NotAsked:r})},ne=(t=10)=>e=>{const o=setTimeout(()=>{var n;(n=e.element)==null||n.focus()},t);return n=>clearTimeout(o)},oe=(t=10)=>e=>{const o=setTimeout(()=>{var n;(n=e.element)==null||n.select()},t);return n=>{clearTimeout(o)}},ie=t=>{const e=t.element,o=e.style.getPropertyValue(":empty");return e.style.setProperty(":empty","display:none"),n=>{n&&e.style.setProperty(":empty",o)}},re=t=>u.Portal("head > title",u.attr.innerText(t)),se={partial:{root:null,rootMargin:"0px",threshold:0},full:{root:null,rootMargin:"0px",threshold:1}},K={partial:new Map,full:new Map},I={partial:null,full:null};function ce(t){return I[t]==null&&(I[t]=new IntersectionObserver(e=>{e.forEach(o=>{const n=K[t].get(o.target);n==null||n.set(o.isIntersecting)})},se[t])),I[t]}const Wt=(t,e)=>{const o=u.makeProp(u.isSSR());return u.Fragment(u.OnMount(n=>{const i=typeof IntersectionObserver<"u"?ce(t):null;return K[t].set(n,o),i==null||i.observe(n),()=>{var r;i==null||i.unobserve(n),K[t].delete(n),K[t].size===0&&((r=I[t])==null||r.disconnect(),I[t]=null)}}),u.OnUnmount(o.dispose),u.renderableOfTNode(e(o)))},le=(t,e,o)=>Wt(t,n=>u.When(n,e,o??u.Empty)),J=Math.min,M=Math.max,G=Math.round,Y=Math.floor,P=t=>({x:t,y:t}),ae={left:"right",right:"left",bottom:"top",top:"bottom"},ue={start:"end",end:"start"};function wt(t,e,o){return M(t,J(e,o))}function tt(t,e){return typeof t=="function"?t(e):t}function W(t){return t.split("-")[0]}function et(t){return t.split("-")[1]}function Dt(t){return t==="x"?"y":"x"}function Nt(t){return t==="y"?"height":"width"}function _(t){return["top","bottom"].includes(W(t))?"y":"x"}function Vt(t){return Dt(_(t))}function fe(t,e,o){o===void 0&&(o=!1);const n=et(t),i=Vt(t),r=Nt(i);let s=i==="x"?n===(o?"end":"start")?"right":"left":n==="start"?"bottom":"top";return e.reference[r]>e.floating[r]&&(s=Q(s)),[s,Q(s)]}function de(t){const e=Q(t);return[st(t),e,st(e)]}function st(t){return t.replace(/start|end/g,e=>ue[e])}function he(t,e,o){const n=["left","right"],i=["right","left"],r=["top","bottom"],s=["bottom","top"];switch(t){case"top":case"bottom":return o?e?i:n:e?n:i;case"left":case"right":return e?r:s;default:return[]}}function me(t,e,o,n){const i=et(t);let r=he(W(t),o==="start",n);return i&&(r=r.map(s=>s+"-"+i),e&&(r=r.concat(r.map(st)))),r}function Q(t){return t.replace(/left|right|bottom|top/g,e=>ae[e])}function pe(t){return{top:0,right:0,bottom:0,left:0,...t}}function ge(t){return typeof t!="number"?pe(t):{top:t,right:t,bottom:t,left:t}}function Z(t){const{x:e,y:o,width:n,height:i}=t;return{width:n,height:i,top:o,left:e,right:e+n,bottom:o+i,x:e,y:o}}function yt(t,e,o){let{reference:n,floating:i}=t;const r=_(e),s=Vt(e),c=Nt(s),a=W(e),l=r==="y",f=n.x+n.width/2-i.width/2,d=n.y+n.height/2-i.height/2,p=n[c]/2-i[c]/2;let h;switch(a){case"top":h={x:f,y:n.y-i.height};break;case"bottom":h={x:f,y:n.y+n.height};break;case"right":h={x:n.x+n.width,y:d};break;case"left":h={x:n.x-i.width,y:d};break;default:h={x:n.x,y:n.y}}switch(et(e)){case"start":h[s]-=p*(o&&l?-1:1);break;case"end":h[s]+=p*(o&&l?-1:1);break}return h}const we=async(t,e,o)=>{const{placement:n="bottom",strategy:i="absolute",middleware:r=[],platform:s}=o,c=r.filter(Boolean),a=await(s.isRTL==null?void 0:s.isRTL(e));let l=await s.getElementRects({reference:t,floating:e,strategy:i}),{x:f,y:d}=yt(l,n,a),p=n,h={},g=0;for(let w=0;w<c.length;w++){const{name:y,fn:m}=c[w],{x:v,y:x,data:A,reset:b}=await m({x:f,y:d,initialPlacement:n,placement:p,strategy:i,middlewareData:h,rects:l,platform:s,elements:{reference:t,floating:e}});f=v??f,d=x??d,h={...h,[y]:{...h[y],...A}},b&&g<=50&&(g++,typeof b=="object"&&(b.placement&&(p=b.placement),b.rects&&(l=b.rects===!0?await s.getElementRects({reference:t,floating:e,strategy:i}):b.rects),{x:f,y:d}=yt(l,p,a)),w=-1)}return{x:f,y:d,placement:p,strategy:i,middlewareData:h}};async function Ut(t,e){var o;e===void 0&&(e={});const{x:n,y:i,platform:r,rects:s,elements:c,strategy:a}=t,{boundary:l="clippingAncestors",rootBoundary:f="viewport",elementContext:d="floating",altBoundary:p=!1,padding:h=0}=tt(e,t),g=ge(h),y=c[p?d==="floating"?"reference":"floating":d],m=Z(await r.getClippingRect({element:(o=await(r.isElement==null?void 0:r.isElement(y)))==null||o?y:y.contextElement||await(r.getDocumentElement==null?void 0:r.getDocumentElement(c.floating)),boundary:l,rootBoundary:f,strategy:a})),v=d==="floating"?{x:n,y:i,width:s.floating.width,height:s.floating.height}:s.reference,x=await(r.getOffsetParent==null?void 0:r.getOffsetParent(c.floating)),A=await(r.isElement==null?void 0:r.isElement(x))?await(r.getScale==null?void 0:r.getScale(x))||{x:1,y:1}:{x:1,y:1},b=Z(r.convertOffsetParentRelativeRectToViewportRelativeRect?await r.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:v,offsetParent:x,strategy:a}):v);return{top:(m.top-b.top+g.top)/A.y,bottom:(b.bottom-m.bottom+g.bottom)/A.y,left:(m.left-b.left+g.left)/A.x,right:(b.right-m.right+g.right)/A.x}}const ye=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var o,n;const{placement:i,middlewareData:r,rects:s,initialPlacement:c,platform:a,elements:l}=e,{mainAxis:f=!0,crossAxis:d=!0,fallbackPlacements:p,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:w=!0,...y}=tt(t,e);if((o=r.arrow)!=null&&o.alignmentOffset)return{};const m=W(i),v=_(c),x=W(c)===c,A=await(a.isRTL==null?void 0:a.isRTL(l.floating)),b=p||(x||!w?[Q(c)]:de(c)),N=g!=="none";!p&&N&&b.push(...me(c,w,g,A));const Jt=[c,...b],it=await Ut(e,y),X=[];let H=((n=r.flip)==null?void 0:n.overflows)||[];if(f&&X.push(it[m]),d){const F=fe(i,s,A);X.push(it[F[0]],it[F[1]])}if(H=[...H,{placement:i,overflows:X}],!X.every(F=>F<=0)){var ht,mt;const F=(((ht=r.flip)==null?void 0:ht.index)||0)+1,gt=Jt[F];if(gt)return{data:{index:F,overflows:H},reset:{placement:gt}};let B=(mt=H.filter(V=>V.overflows[0]<=0).sort((V,k)=>V.overflows[1]-k.overflows[1])[0])==null?void 0:mt.placement;if(!B)switch(h){case"bestFit":{var pt;const V=(pt=H.filter(k=>{if(N){const T=_(k.placement);return T===v||T==="y"}return!0}).map(k=>[k.placement,k.overflows.filter(T=>T>0).reduce((T,Gt)=>T+Gt,0)]).sort((k,T)=>k[1]-T[1])[0])==null?void 0:pt[0];V&&(B=V);break}case"initialPlacement":B=c;break}if(i!==B)return{reset:{placement:B}}}return{}}}};async function ve(t,e){const{placement:o,platform:n,elements:i}=t,r=await(n.isRTL==null?void 0:n.isRTL(i.floating)),s=W(o),c=et(o),a=_(o)==="y",l=["left","top"].includes(s)?-1:1,f=r&&a?-1:1,d=tt(e,t);let{mainAxis:p,crossAxis:h,alignmentAxis:g}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...d};return c&&typeof g=="number"&&(h=c==="end"?g*-1:g),a?{x:h*f,y:p*l}:{x:p*l,y:h*f}}const xe=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var o,n;const{x:i,y:r,placement:s,middlewareData:c}=e,a=await ve(e,t);return s===((o=c.offset)==null?void 0:o.placement)&&(n=c.arrow)!=null&&n.alignmentOffset?{}:{x:i+a.x,y:r+a.y,data:{...a,placement:s}}}}},be=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:o,y:n,placement:i}=e,{mainAxis:r=!0,crossAxis:s=!1,limiter:c={fn:y=>{let{x:m,y:v}=y;return{x:m,y:v}}},...a}=tt(t,e),l={x:o,y:n},f=await Ut(e,a),d=_(W(i)),p=Dt(d);let h=l[p],g=l[d];if(r){const y=p==="y"?"top":"left",m=p==="y"?"bottom":"right",v=h+f[y],x=h-f[m];h=wt(v,h,x)}if(s){const y=d==="y"?"top":"left",m=d==="y"?"bottom":"right",v=g+f[y],x=g-f[m];g=wt(v,g,x)}const w=c.fn({...e,[p]:h,[d]:g});return{...w,data:{x:w.x-o,y:w.y-n}}}}};function z(t){return _t(t)?(t.nodeName||"").toLowerCase():"#document"}function E(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function S(t){var e;return(e=(_t(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function _t(t){return t instanceof Node||t instanceof E(t).Node}function O(t){return t instanceof Element||t instanceof E(t).Element}function L(t){return t instanceof HTMLElement||t instanceof E(t).HTMLElement}function vt(t){return typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof E(t).ShadowRoot}function q(t){const{overflow:e,overflowX:o,overflowY:n,display:i}=R(t);return/auto|scroll|overlay|hidden|clip/.test(e+n+o)&&!["inline","contents"].includes(i)}function Ae(t){return["table","td","th"].includes(z(t))}function nt(t){return[":popover-open",":modal"].some(e=>{try{return t.matches(e)}catch{return!1}})}function ut(t){const e=ft(),o=R(t);return o.transform!=="none"||o.perspective!=="none"||(o.containerType?o.containerType!=="normal":!1)||!e&&(o.backdropFilter?o.backdropFilter!=="none":!1)||!e&&(o.filter?o.filter!=="none":!1)||["transform","perspective","filter"].some(n=>(o.willChange||"").includes(n))||["paint","layout","strict","content"].some(n=>(o.contain||"").includes(n))}function Ee(t){let e=C(t);for(;L(e)&&!$(e);){if(nt(e))return null;if(ut(e))return e;e=C(e)}return null}function ft(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function $(t){return["html","body","#document"].includes(z(t))}function R(t){return E(t).getComputedStyle(t)}function ot(t){return O(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function C(t){if(z(t)==="html")return t;const e=t.assignedSlot||t.parentNode||vt(t)&&t.host||S(t);return vt(e)?e.host:e}function $t(t){const e=C(t);return $(e)?t.ownerDocument?t.ownerDocument.body:t.body:L(e)&&q(e)?e:$t(e)}function j(t,e,o){var n;e===void 0&&(e=[]),o===void 0&&(o=!0);const i=$t(t),r=i===((n=t.ownerDocument)==null?void 0:n.body),s=E(i);return r?e.concat(s,s.visualViewport||[],q(i)?i:[],s.frameElement&&o?j(s.frameElement):[]):e.concat(i,j(i,[],o))}function zt(t){const e=R(t);let o=parseFloat(e.width)||0,n=parseFloat(e.height)||0;const i=L(t),r=i?t.offsetWidth:o,s=i?t.offsetHeight:n,c=G(o)!==r||G(n)!==s;return c&&(o=r,n=s),{width:o,height:n,$:c}}function dt(t){return O(t)?t:t.contextElement}function U(t){const e=dt(t);if(!L(e))return P(1);const o=e.getBoundingClientRect(),{width:n,height:i,$:r}=zt(e);let s=(r?G(o.width):o.width)/n,c=(r?G(o.height):o.height)/i;return(!s||!Number.isFinite(s))&&(s=1),(!c||!Number.isFinite(c))&&(c=1),{x:s,y:c}}const Re=P(0);function Ht(t){const e=E(t);return!ft()||!e.visualViewport?Re:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function Oe(t,e,o){return e===void 0&&(e=!1),!o||e&&o!==E(t)?!1:e}function D(t,e,o,n){e===void 0&&(e=!1),o===void 0&&(o=!1);const i=t.getBoundingClientRect(),r=dt(t);let s=P(1);e&&(n?O(n)&&(s=U(n)):s=U(t));const c=Oe(r,o,n)?Ht(r):P(0);let a=(i.left+c.x)/s.x,l=(i.top+c.y)/s.y,f=i.width/s.x,d=i.height/s.y;if(r){const p=E(r),h=n&&O(n)?E(n):n;let g=p,w=g.frameElement;for(;w&&n&&h!==g;){const y=U(w),m=w.getBoundingClientRect(),v=R(w),x=m.left+(w.clientLeft+parseFloat(v.paddingLeft))*y.x,A=m.top+(w.clientTop+parseFloat(v.paddingTop))*y.y;a*=y.x,l*=y.y,f*=y.x,d*=y.y,a+=x,l+=A,g=E(w),w=g.frameElement}}return Z({width:f,height:d,x:a,y:l})}function Le(t){let{elements:e,rect:o,offsetParent:n,strategy:i}=t;const r=i==="fixed",s=S(n),c=e?nt(e.floating):!1;if(n===s||c&&r)return o;let a={scrollLeft:0,scrollTop:0},l=P(1);const f=P(0),d=L(n);if((d||!d&&!r)&&((z(n)!=="body"||q(s))&&(a=ot(n)),L(n))){const p=D(n);l=U(n),f.x=p.x+n.clientLeft,f.y=p.y+n.clientTop}return{width:o.width*l.x,height:o.height*l.y,x:o.x*l.x-a.scrollLeft*l.x+f.x,y:o.y*l.y-a.scrollTop*l.y+f.y}}function Se(t){return Array.from(t.getClientRects())}function Bt(t){return D(S(t)).left+ot(t).scrollLeft}function ke(t){const e=S(t),o=ot(t),n=t.ownerDocument.body,i=M(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),r=M(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let s=-o.scrollLeft+Bt(t);const c=-o.scrollTop;return R(n).direction==="rtl"&&(s+=M(e.clientWidth,n.clientWidth)-i),{width:i,height:r,x:s,y:c}}function Te(t,e){const o=E(t),n=S(t),i=o.visualViewport;let r=n.clientWidth,s=n.clientHeight,c=0,a=0;if(i){r=i.width,s=i.height;const l=ft();(!l||l&&e==="fixed")&&(c=i.offsetLeft,a=i.offsetTop)}return{width:r,height:s,x:c,y:a}}function Pe(t,e){const o=D(t,!0,e==="fixed"),n=o.top+t.clientTop,i=o.left+t.clientLeft,r=L(t)?U(t):P(1),s=t.clientWidth*r.x,c=t.clientHeight*r.y,a=i*r.x,l=n*r.y;return{width:s,height:c,x:a,y:l}}function xt(t,e,o){let n;if(e==="viewport")n=Te(t,o);else if(e==="document")n=ke(S(t));else if(O(e))n=Pe(e,o);else{const i=Ht(t);n={...e,x:e.x-i.x,y:e.y-i.y}}return Z(n)}function It(t,e){const o=C(t);return o===e||!O(o)||$(o)?!1:R(o).position==="fixed"||It(o,e)}function Ce(t,e){const o=e.get(t);if(o)return o;let n=j(t,[],!1).filter(c=>O(c)&&z(c)!=="body"),i=null;const r=R(t).position==="fixed";let s=r?C(t):t;for(;O(s)&&!$(s);){const c=R(s),a=ut(s);!a&&c.position==="fixed"&&(i=null),(r?!a&&!i:!a&&c.position==="static"&&!!i&&["absolute","fixed"].includes(i.position)||q(s)&&!a&&It(t,s))?n=n.filter(f=>f!==s):i=c,s=C(s)}return e.set(t,n),n}function Fe(t){let{element:e,boundary:o,rootBoundary:n,strategy:i}=t;const s=[...o==="clippingAncestors"?nt(e)?[]:Ce(e,this._c):[].concat(o),n],c=s[0],a=s.reduce((l,f)=>{const d=xt(e,f,i);return l.top=M(d.top,l.top),l.right=J(d.right,l.right),l.bottom=J(d.bottom,l.bottom),l.left=M(d.left,l.left),l},xt(e,c,i));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function Me(t){const{width:e,height:o}=zt(t);return{width:e,height:o}}function We(t,e,o){const n=L(e),i=S(e),r=o==="fixed",s=D(t,!0,r,e);let c={scrollLeft:0,scrollTop:0};const a=P(0);if(n||!n&&!r)if((z(e)!=="body"||q(i))&&(c=ot(e)),n){const d=D(e,!0,r,e);a.x=d.x+e.clientLeft,a.y=d.y+e.clientTop}else i&&(a.x=Bt(i));const l=s.left+c.scrollLeft-a.x,f=s.top+c.scrollTop-a.y;return{x:l,y:f,width:s.width,height:s.height}}function rt(t){return R(t).position==="static"}function bt(t,e){return!L(t)||R(t).position==="fixed"?null:e?e(t):t.offsetParent}function jt(t,e){const o=E(t);if(nt(t))return o;if(!L(t)){let i=C(t);for(;i&&!$(i);){if(O(i)&&!rt(i))return i;i=C(i)}return o}let n=bt(t,e);for(;n&&Ae(n)&&rt(n);)n=bt(n,e);return n&&$(n)&&rt(n)&&!ut(n)?o:n||Ee(t)||o}const De=async function(t){const e=this.getOffsetParent||jt,o=this.getDimensions,n=await o(t.floating);return{reference:We(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function Ne(t){return R(t).direction==="rtl"}const Ve={convertOffsetParentRelativeRectToViewportRelativeRect:Le,getDocumentElement:S,getClippingRect:Fe,getOffsetParent:jt,getElementRects:De,getClientRects:Se,getDimensions:Me,getScale:U,isElement:O,isRTL:Ne};function Ue(t,e){let o=null,n;const i=S(t);function r(){var c;clearTimeout(n),(c=o)==null||c.disconnect(),o=null}function s(c,a){c===void 0&&(c=!1),a===void 0&&(a=1),r();const{left:l,top:f,width:d,height:p}=t.getBoundingClientRect();if(c||e(),!d||!p)return;const h=Y(f),g=Y(i.clientWidth-(l+d)),w=Y(i.clientHeight-(f+p)),y=Y(l),v={rootMargin:-h+"px "+-g+"px "+-w+"px "+-y+"px",threshold:M(0,J(1,a))||1};let x=!0;function A(b){const N=b[0].intersectionRatio;if(N!==a){if(!x)return s();N?s(!1,N):n=setTimeout(()=>{s(!1,1e-7)},1e3)}x=!1}try{o=new IntersectionObserver(A,{...v,root:i.ownerDocument})}catch{o=new IntersectionObserver(A,v)}o.observe(t)}return s(!0),r}function _e(t,e,o,n){n===void 0&&(n={});const{ancestorScroll:i=!0,ancestorResize:r=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:a=!1}=n,l=dt(t),f=i||r?[...l?j(l):[],...j(e)]:[];f.forEach(m=>{i&&m.addEventListener("scroll",o,{passive:!0}),r&&m.addEventListener("resize",o)});const d=l&&c?Ue(l,o):null;let p=-1,h=null;s&&(h=new ResizeObserver(m=>{let[v]=m;v&&v.target===l&&h&&(h.unobserve(e),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var x;(x=h)==null||x.observe(e)})),o()}),l&&!a&&h.observe(l),h.observe(e));let g,w=a?D(t):null;a&&y();function y(){const m=D(t);w&&(m.x!==w.x||m.y!==w.y||m.width!==w.width||m.height!==w.height)&&o(),w=m,g=requestAnimationFrame(y)}return o(),()=>{var m;f.forEach(v=>{i&&v.removeEventListener("scroll",o),r&&v.removeEventListener("resize",o)}),d==null||d(),(m=h)==null||m.disconnect(),h=null,a&&cancelAnimationFrame(g)}}const $e=xe,ze=be,At=ye,He=(t,e,o)=>{const n=new Map,i={platform:Ve,...o},r={...i.platform,_c:n};return we(t,e,{...i,platform:r})},Be=({content:t,open:e,placement:o,offset:{mainAxis:n,crossAxis:i}={mainAxis:0,crossAxis:0}})=>r=>{const s=r.element,c=u.Signal.wrap(e);return u.When(c,u.Portal("body",u.html.div(u.OnMount(a=>{const l=a;return l.style.position="absolute",_e(s,l,()=>{He(s,l,{placement:o,strategy:"absolute",middleware:[At(),$e({mainAxis:n,crossAxis:i}),ze(),At()]}).then(({x:f,y:d})=>{l.style.top=`${d}px`,l.style.left=`${f}px`})})}),t())))(r)},qt=(t,e)=>{if(typeof e=="function")return qt(t,{success:e});const o=e.failure??(i=>u.Fragment(u.OnUnmount(i.on(console.error)),i.map(r=>`Error: ${r}`))),n=e.success;return u.OneOfType(u.Signal.wrap(t),{Success:i=>n(i.$.value),Failure:i=>o(i.$.error)})},Ie=()=>u.on.focus(t=>{var e;return(e=t.target)==null?void 0:e.select()}),je=t=>e=>{const o=e.element,n=u.makeProp({width:o.clientWidth,height:o.clientHeight}),i=u.renderableOfTNode(t(n))(e),r=()=>{n.set({width:o.clientWidth,height:o.clientHeight})};let s;return typeof ResizeObserver=="function"&&(s=new ResizeObserver(r),s.observe(o)),c=>{s==null||s.disconnect(),i(c)}},qe=t=>e=>{const o=u.makeProp({width:(window==null?void 0:window.innerWidth)??0,height:(window==null?void 0:window.innerHeight)??0}),n=u.renderableOfTNode(t(o))(e),i=()=>{o.set({width:(window==null?void 0:window.innerWidth)??0,height:(window==null?void 0:window.innerHeight)??0})};return window==null||window.addEventListener("resize",i),r=>{window==null||window.removeEventListener("resize",i),n(r)}},Xt=(t,e)=>{const o=e.split("/").filter(i=>i!==""),n={};for(let i=0;i<t.length;i++){const r=t[i],s=o[i];if(!s&&r.type!=="catch-all")return null;if(r.type==="literal"){if(r.value!==s)return null}else if(r.type==="param")n[r.name]=s;else if(r.type==="catch-all")return{params:n,path:e}}return o.length!==t.length?null:{params:n,path:e}},Yt=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!==""),Kt=t=>{const e=t.map(o=>{const n=Yt(o);return{route:o,segments:n}});return function(n){for(const{segments:i,route:r}of e){const s=Xt(i,n);if(s)return{...s,route:r}}return null}},Xe=t=>{const e=Kt(Object.keys(t));return lt(o=>{const n=o.map(i=>{const r=e(i.pathname);if(r==null)throw console.error("No route found for",i),new Error("No route found");return{params:r.params,route:r.route,path:r.path,search:i.search,hash:i.hash}});return u.OneOfTuple(n.map(i=>[i.route,i]),t)})};exports.Anchor=Ft;exports.AsyncResultView=Mt;exports.AutoFocus=ne;exports.AutoSelect=oe;exports.ElementSize=je;exports.HTMLTitle=re;exports.HiddenWhenEmpty=ie;exports.InViewport=Wt;exports.LocationProviderMarker=ct;exports.PopOver=Be;exports.ProvideAppearance=te;exports.ProvideLocation=Zt;exports.ResultView=qt;exports.Router=Xe;exports.SelectOnFocus=Ie;exports.UseAppearance=ee;exports.UseLocation=lt;exports.WhenInViewport=le;exports.WindowSize=qe;exports._checkExtensionCondition=Rt;exports._getExtension=Et;exports._makeLocation=Lt;exports._makeLocationProp=Ct;exports._makeRouteMatcher=Kt;exports._parseRouteSegments=Yt;exports.appearanceMarker=at;exports.areLocationsEqual=St;exports.handleAnchorClick=Ot;exports.locationFromURL=kt;exports.matchesRoute=Xt;exports.setLocationFromUrl=Tt;exports.urlFromLocation=Pt;
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { makeProviderMark as Ot, makeProp as H, Fragment as X, OnUnmount as q, WithProvider as Lt, UseProvider as St, renderableOfTNode as nt, html as Tt, on as Ct, Signal as ot, attr as kt, Empty as ut, OneOfType as Pt, makeSignal as Gt, Portal as Wt, isSSR as Qt, OnMount as Mt, When as Ft, OneOfTuple as Zt } from "@tempots/dom";
1
+ import { makeProviderMark as Lt, makeProp as H, Fragment as q, OnUnmount as Y, WithProvider as Ot, UseProvider as St, renderableOfTNode as ot, Signal as j, html as Tt, on as Ct, attr as kt, Empty as ut, OneOfType as Pt, makeSignal as Gt, Portal as Wt, isSSR as Qt, OnMount as Mt, When as Ft, OneOfTuple as Zt } from "@tempots/dom";
2
2
  const te = (t) => {
3
3
  const e = t.split("/").pop();
4
4
  if (e == null || e.startsWith(".")) return;
@@ -39,7 +39,7 @@ const te = (t) => {
39
39
  e.ignoreExternalUrl ?? !0
40
40
  ) || t() && n.preventDefault();
41
41
  };
42
- }, Dt = Ot("LocationProvider"), ie = () => {
42
+ }, Dt = Lt("LocationProvider"), ie = () => {
43
43
  const t = (window == null ? void 0 : window.location.hash) === "" ? void 0 : (window == null ? void 0 : window.location.hash.substring(1)) ?? void 0;
44
44
  return {
45
45
  pathname: (window == null ? void 0 : window.location.pathname) ?? "",
@@ -80,41 +80,46 @@ const te = (t) => {
80
80
  }), t.on((o) => {
81
81
  window == null || window.history.pushState({}, "", le(o));
82
82
  }), t;
83
- }, Ze = (t) => {
83
+ }, tn = (t) => {
84
84
  const e = ae();
85
- return X(
86
- q(e.dispose),
87
- Lt(Dt, e, t)
85
+ return q(
86
+ Y(e.dispose),
87
+ Ot(Dt, e, t)
88
88
  );
89
89
  }, Nt = (t) => St(Dt, (e) => (o) => {
90
90
  const n = H(e.value, e.equals);
91
91
  e.feedProp(n), n.on(e.set);
92
- const i = nt(t(n))(o);
92
+ const i = ot(t(n))(o);
93
93
  return (r) => {
94
94
  n.dispose(), i(r);
95
95
  };
96
- }), tn = (t, ...e) => Nt((o) => Tt.a(
97
- Ct.click(
98
- oe(() => (ce(o, ot.unwrap(t)), !0))
99
- ),
100
- kt.href(t),
101
- ...e
102
- )), $t = Ot("Appearance"), en = (t) => {
96
+ }), ue = (t, ...e) => {
97
+ if (typeof t == "string" || j.is(t))
98
+ return ue({ href: t }, ...e);
99
+ const { href: o, ...n } = t;
100
+ return Nt((i) => Tt.a(
101
+ Ct.click(
102
+ oe(() => (ce(i, j.unwrap(o)), !0), n)
103
+ ),
104
+ kt.href(o),
105
+ ...e
106
+ ));
107
+ }, $t = Lt("Appearance"), en = (t) => {
103
108
  const e = window.matchMedia != null && window.matchMedia("(prefers-color-scheme: dark)").matches, o = H(e ? "dark" : "light"), n = (r) => {
104
109
  o.set(r.matches ? "dark" : "light");
105
110
  }, i = window.matchMedia != null ? window.matchMedia("(prefers-color-scheme: dark)") : void 0;
106
- return i == null || i.addEventListener("change", n), X(
107
- Lt($t, o, t),
108
- q(() => i == null ? void 0 : i.removeEventListener("change", n))
111
+ return i == null || i.addEventListener("change", n), q(
112
+ Ot($t, o, t),
113
+ Y(() => i == null ? void 0 : i.removeEventListener("change", n))
109
114
  );
110
- }, nn = (t) => St($t, t), ue = (t, e) => {
115
+ }, nn = (t) => St($t, t), fe = (t, e) => {
111
116
  if (typeof e == "function")
112
- return ue(t, { success: e });
113
- const o = e.failure ?? ((s) => X(
114
- q(s.on(console.error)),
117
+ return fe(t, { success: e });
118
+ const o = e.failure ?? ((s) => q(
119
+ Y(s.on(console.error)),
115
120
  s.map((c) => `Error: ${c}`)
116
121
  )), n = e.success, i = e.loading ?? (() => ut), r = e.notAsked ?? (() => ut);
117
- return Pt(ot.wrap(t), {
122
+ return Pt(j.wrap(t), {
118
123
  AsyncSuccess: (s) => n(s.$.value),
119
124
  AsyncFailure: (s) => o(s.$.error),
120
125
  Loading: (s) => i(s.$.previousValue ?? Gt(void 0)),
@@ -139,7 +144,7 @@ const te = (t) => {
139
144
  return e.style.setProperty(":empty", "display:none"), (n) => {
140
145
  n && e.style.setProperty(":empty", o);
141
146
  };
142
- }, cn = (t) => Wt("head > title", kt.innerText(t)), fe = {
147
+ }, cn = (t) => Wt("head > title", kt.innerText(t)), he = {
143
148
  partial: {
144
149
  root: null,
145
150
  rootMargin: "0px",
@@ -150,48 +155,48 @@ const te = (t) => {
150
155
  rootMargin: "0px",
151
156
  threshold: 1
152
157
  }
153
- }, G = {
158
+ }, Q = {
154
159
  partial: /* @__PURE__ */ new Map(),
155
160
  full: /* @__PURE__ */ new Map()
156
161
  }, I = {
157
162
  partial: null,
158
163
  full: null
159
164
  };
160
- function he(t) {
165
+ function de(t) {
161
166
  return I[t] == null && (I[t] = new IntersectionObserver((e) => {
162
167
  e.forEach((o) => {
163
- const n = G[t].get(o.target);
168
+ const n = Q[t].get(o.target);
164
169
  n == null || n.set(o.isIntersecting);
165
170
  });
166
- }, fe[t])), I[t];
171
+ }, he[t])), I[t];
167
172
  }
168
- const de = (t, e) => {
173
+ const me = (t, e) => {
169
174
  const o = H(Qt());
170
- return X(
175
+ return q(
171
176
  Mt((n) => {
172
- const i = typeof IntersectionObserver < "u" ? he(t) : null;
173
- return G[t].set(n, o), i == null || i.observe(n), () => {
177
+ const i = typeof IntersectionObserver < "u" ? de(t) : null;
178
+ return Q[t].set(n, o), i == null || i.observe(n), () => {
174
179
  var r;
175
- i == null || i.unobserve(n), G[t].delete(n), G[t].size === 0 && ((r = I[t]) == null || r.disconnect(), I[t] = null);
180
+ i == null || i.unobserve(n), Q[t].delete(n), Q[t].size === 0 && ((r = I[t]) == null || r.disconnect(), I[t] = null);
176
181
  };
177
182
  }),
178
- q(o.dispose),
179
- nt(e(o))
183
+ Y(o.dispose),
184
+ ot(e(o))
180
185
  );
181
- }, ln = (t, e, o) => de(t, (n) => Ft(n, e, o ?? ut)), Q = Math.min, W = Math.max, Z = Math.round, J = Math.floor, C = (t) => ({
186
+ }, ln = (t, e, o) => me(t, (n) => Ft(n, e, o ?? ut)), Z = Math.min, W = Math.max, tt = Math.round, G = Math.floor, C = (t) => ({
182
187
  x: t,
183
188
  y: t
184
- }), me = {
189
+ }), pe = {
185
190
  left: "right",
186
191
  right: "left",
187
192
  bottom: "top",
188
193
  top: "bottom"
189
- }, pe = {
194
+ }, ge = {
190
195
  start: "end",
191
196
  end: "start"
192
197
  };
193
198
  function xt(t, e, o) {
194
- return W(t, Q(e, o));
199
+ return W(t, Z(e, o));
195
200
  }
196
201
  function it(t, e) {
197
202
  return typeof t == "function" ? t(e) : t;
@@ -214,20 +219,20 @@ function V(t) {
214
219
  function Ht(t) {
215
220
  return Vt(V(t));
216
221
  }
217
- function ge(t, e, o) {
222
+ function we(t, e, o) {
218
223
  o === void 0 && (o = !1);
219
224
  const n = rt(t), i = Ht(t), r = zt(i);
220
225
  let s = i === "x" ? n === (o ? "end" : "start") ? "right" : "left" : n === "start" ? "bottom" : "top";
221
- return e.reference[r] > e.floating[r] && (s = tt(s)), [s, tt(s)];
226
+ return e.reference[r] > e.floating[r] && (s = et(s)), [s, et(s)];
222
227
  }
223
- function we(t) {
224
- const e = tt(t);
228
+ function ye(t) {
229
+ const e = et(t);
225
230
  return [ft(t), e, ft(e)];
226
231
  }
227
232
  function ft(t) {
228
- return t.replace(/start|end/g, (e) => pe[e]);
233
+ return t.replace(/start|end/g, (e) => ge[e]);
229
234
  }
230
- function ye(t, e, o) {
235
+ function xe(t, e, o) {
231
236
  const n = ["left", "right"], i = ["right", "left"], r = ["top", "bottom"], s = ["bottom", "top"];
232
237
  switch (t) {
233
238
  case "top":
@@ -240,15 +245,15 @@ function ye(t, e, o) {
240
245
  return [];
241
246
  }
242
247
  }
243
- function xe(t, e, o, n) {
248
+ function ve(t, e, o, n) {
244
249
  const i = rt(t);
245
- let r = ye(M(t), o === "start", n);
250
+ let r = xe(M(t), o === "start", n);
246
251
  return i && (r = r.map((s) => s + "-" + i), e && (r = r.concat(r.map(ft)))), r;
247
252
  }
248
- function tt(t) {
249
- return t.replace(/left|right|bottom|top/g, (e) => me[e]);
253
+ function et(t) {
254
+ return t.replace(/left|right|bottom|top/g, (e) => pe[e]);
250
255
  }
251
- function ve(t) {
256
+ function be(t) {
252
257
  return {
253
258
  top: 0,
254
259
  right: 0,
@@ -257,15 +262,15 @@ function ve(t) {
257
262
  ...t
258
263
  };
259
264
  }
260
- function be(t) {
261
- return typeof t != "number" ? ve(t) : {
265
+ function Ae(t) {
266
+ return typeof t != "number" ? be(t) : {
262
267
  top: t,
263
268
  right: t,
264
269
  bottom: t,
265
270
  left: t
266
271
  };
267
272
  }
268
- function et(t) {
273
+ function nt(t) {
269
274
  const {
270
275
  x: e,
271
276
  y: o,
@@ -331,7 +336,7 @@ function vt(t, e, o) {
331
336
  }
332
337
  return h;
333
338
  }
334
- const Ae = async (t, e, o) => {
339
+ const Ee = async (t, e, o) => {
335
340
  const {
336
341
  placement: n = "bottom",
337
342
  strategy: i = "absolute",
@@ -408,7 +413,7 @@ async function _t(t, e) {
408
413
  elementContext: f = "floating",
409
414
  altBoundary: m = !1,
410
415
  padding: h = 0
411
- } = it(e, t), p = be(h), w = c[m ? f === "floating" ? "reference" : "floating" : f], d = et(await r.getClippingRect({
416
+ } = it(e, t), p = Ae(h), w = c[m ? f === "floating" ? "reference" : "floating" : f], d = nt(await r.getClippingRect({
412
417
  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)),
413
418
  boundary: l,
414
419
  rootBoundary: u,
@@ -424,7 +429,7 @@ async function _t(t, e) {
424
429
  } : {
425
430
  x: 1,
426
431
  y: 1
427
- }, v = et(r.convertOffsetParentRelativeRectToViewportRelativeRect ? await r.convertOffsetParentRelativeRectToViewportRelativeRect({
432
+ }, v = nt(r.convertOffsetParentRelativeRectToViewportRelativeRect ? await r.convertOffsetParentRelativeRectToViewportRelativeRect({
428
433
  elements: c,
429
434
  rect: y,
430
435
  offsetParent: x,
@@ -437,7 +442,7 @@ async function _t(t, e) {
437
442
  right: (v.right - d.right + p.right) / b.x
438
443
  };
439
444
  }
440
- const Ee = function(t) {
445
+ const Re = function(t) {
441
446
  return t === void 0 && (t = {}), {
442
447
  name: "flip",
443
448
  options: t,
@@ -461,18 +466,18 @@ const Ee = function(t) {
461
466
  } = it(t, e);
462
467
  if ((o = r.arrow) != null && o.alignmentOffset)
463
468
  return {};
464
- const d = M(i), y = V(c), x = M(c) === c, b = await (a.isRTL == null ? void 0 : a.isRTL(l.floating)), v = m || (x || !g ? [tt(c)] : we(c)), D = p !== "none";
465
- !m && D && v.push(...xe(c, g, p, b));
466
- const Kt = [c, ...v], lt = await _t(e, w), K = [];
469
+ const d = M(i), y = V(c), x = M(c) === c, b = await (a.isRTL == null ? void 0 : a.isRTL(l.floating)), v = m || (x || !g ? [et(c)] : ye(c)), D = p !== "none";
470
+ !m && D && v.push(...ve(c, g, p, b));
471
+ const Kt = [c, ...v], lt = await _t(e, w), J = [];
467
472
  let B = ((n = r.flip) == null ? void 0 : n.overflows) || [];
468
- if (u && K.push(lt[d]), f) {
469
- const P = ge(i, s, b);
470
- K.push(lt[P[0]], lt[P[1]]);
473
+ if (u && J.push(lt[d]), f) {
474
+ const P = we(i, s, b);
475
+ J.push(lt[P[0]], lt[P[1]]);
471
476
  }
472
477
  if (B = [...B, {
473
478
  placement: i,
474
- overflows: K
475
- }], !K.every((P) => P <= 0)) {
479
+ overflows: J
480
+ }], !J.every((P) => P <= 0)) {
476
481
  var pt, gt;
477
482
  const P = (((pt = r.flip) == null ? void 0 : pt.index) || 0) + 1, yt = Kt[P];
478
483
  if (yt)
@@ -517,7 +522,7 @@ const Ee = function(t) {
517
522
  }
518
523
  };
519
524
  };
520
- async function Re(t, e) {
525
+ async function Le(t, e) {
521
526
  const {
522
527
  placement: o,
523
528
  platform: n,
@@ -556,7 +561,7 @@ const Oe = function(t) {
556
561
  y: r,
557
562
  placement: s,
558
563
  middlewareData: c
559
- } = e, a = await Re(e, t);
564
+ } = e, a = await Le(e, t);
560
565
  return s === ((o = c.offset) == null ? void 0 : o.placement) && (n = c.arrow) != null && n.alignmentOffset ? {} : {
561
566
  x: i + a.x,
562
567
  y: r + a.y,
@@ -567,7 +572,7 @@ const Oe = function(t) {
567
572
  };
568
573
  }
569
574
  };
570
- }, Le = function(t) {
575
+ }, Se = function(t) {
571
576
  return t === void 0 && (t = {}), {
572
577
  name: "shift",
573
578
  options: t,
@@ -627,7 +632,7 @@ function A(t) {
627
632
  var e;
628
633
  return (t == null || (e = t.ownerDocument) == null ? void 0 : e.defaultView) || window;
629
634
  }
630
- function L(t) {
635
+ function O(t) {
631
636
  var e;
632
637
  return (e = (Bt(t) ? t.ownerDocument : t.document) || window.document) == null ? void 0 : e.documentElement;
633
638
  }
@@ -637,13 +642,13 @@ function Bt(t) {
637
642
  function R(t) {
638
643
  return t instanceof Element || t instanceof A(t).Element;
639
644
  }
640
- function O(t) {
645
+ function L(t) {
641
646
  return t instanceof HTMLElement || t instanceof A(t).HTMLElement;
642
647
  }
643
648
  function bt(t) {
644
649
  return typeof ShadowRoot > "u" ? !1 : t instanceof ShadowRoot || t instanceof A(t).ShadowRoot;
645
650
  }
646
- function Y(t) {
651
+ function K(t) {
647
652
  const {
648
653
  overflow: e,
649
654
  overflowX: o,
@@ -652,7 +657,7 @@ function Y(t) {
652
657
  } = E(t);
653
658
  return /auto|scroll|overlay|hidden|clip/.test(e + n + o) && !["inline", "contents"].includes(i);
654
659
  }
655
- function Se(t) {
660
+ function Te(t) {
656
661
  return ["table", "td", "th"].includes(_(t));
657
662
  }
658
663
  function st(t) {
@@ -668,9 +673,9 @@ function ht(t) {
668
673
  const e = dt(), o = E(t);
669
674
  return o.transform !== "none" || o.perspective !== "none" || (o.containerType ? o.containerType !== "normal" : !1) || !e && (o.backdropFilter ? o.backdropFilter !== "none" : !1) || !e && (o.filter ? o.filter !== "none" : !1) || ["transform", "perspective", "filter"].some((n) => (o.willChange || "").includes(n)) || ["paint", "layout", "strict", "content"].some((n) => (o.contain || "").includes(n));
670
675
  }
671
- function Te(t) {
676
+ function Ce(t) {
672
677
  let e = k(t);
673
- for (; O(e) && !z(e); ) {
678
+ for (; L(e) && !z(e); ) {
674
679
  if (st(e))
675
680
  return null;
676
681
  if (ht(e))
@@ -705,24 +710,24 @@ function k(t) {
705
710
  t.assignedSlot || // DOM Element detected.
706
711
  t.parentNode || // ShadowRoot detected.
707
712
  bt(t) && t.host || // Fallback.
708
- L(t)
713
+ O(t)
709
714
  );
710
715
  return bt(e) ? e.host : e;
711
716
  }
712
717
  function Ut(t) {
713
718
  const e = k(t);
714
- return z(e) ? t.ownerDocument ? t.ownerDocument.body : t.body : O(e) && Y(e) ? e : Ut(e);
719
+ return z(e) ? t.ownerDocument ? t.ownerDocument.body : t.body : L(e) && K(e) ? e : Ut(e);
715
720
  }
716
- function j(t, e, o) {
721
+ function X(t, e, o) {
717
722
  var n;
718
723
  e === void 0 && (e = []), o === void 0 && (o = !0);
719
724
  const i = Ut(t), r = i === ((n = t.ownerDocument) == null ? void 0 : n.body), s = A(i);
720
- return r ? e.concat(s, s.visualViewport || [], Y(i) ? i : [], s.frameElement && o ? j(s.frameElement) : []) : e.concat(i, j(i, [], o));
725
+ return r ? e.concat(s, s.visualViewport || [], K(i) ? i : [], s.frameElement && o ? X(s.frameElement) : []) : e.concat(i, X(i, [], o));
721
726
  }
722
727
  function It(t) {
723
728
  const e = E(t);
724
729
  let o = parseFloat(e.width) || 0, n = parseFloat(e.height) || 0;
725
- const i = O(t), r = i ? t.offsetWidth : o, s = i ? t.offsetHeight : n, c = Z(o) !== r || Z(n) !== s;
730
+ const i = L(t), r = i ? t.offsetWidth : o, s = i ? t.offsetHeight : n, c = tt(o) !== r || tt(n) !== s;
726
731
  return c && (o = r, n = s), {
727
732
  width: o,
728
733
  height: n,
@@ -734,28 +739,28 @@ function mt(t) {
734
739
  }
735
740
  function $(t) {
736
741
  const e = mt(t);
737
- if (!O(e))
742
+ if (!L(e))
738
743
  return C(1);
739
744
  const o = e.getBoundingClientRect(), {
740
745
  width: n,
741
746
  height: i,
742
747
  $: r
743
748
  } = It(e);
744
- let s = (r ? Z(o.width) : o.width) / n, c = (r ? Z(o.height) : o.height) / i;
749
+ let s = (r ? tt(o.width) : o.width) / n, c = (r ? tt(o.height) : o.height) / i;
745
750
  return (!s || !Number.isFinite(s)) && (s = 1), (!c || !Number.isFinite(c)) && (c = 1), {
746
751
  x: s,
747
752
  y: c
748
753
  };
749
754
  }
750
- const Ce = /* @__PURE__ */ C(0);
755
+ const ke = /* @__PURE__ */ C(0);
751
756
  function jt(t) {
752
757
  const e = A(t);
753
- return !dt() || !e.visualViewport ? Ce : {
758
+ return !dt() || !e.visualViewport ? ke : {
754
759
  x: e.visualViewport.offsetLeft,
755
760
  y: e.visualViewport.offsetTop
756
761
  };
757
762
  }
758
- function ke(t, e, o) {
763
+ function Pe(t, e, o) {
759
764
  return e === void 0 && (e = !1), !o || e && o !== A(t) ? !1 : e;
760
765
  }
761
766
  function F(t, e, o, n) {
@@ -763,7 +768,7 @@ function F(t, e, o, n) {
763
768
  const i = t.getBoundingClientRect(), r = mt(t);
764
769
  let s = C(1);
765
770
  e && (n ? R(n) && (s = $(n)) : s = $(t));
766
- const c = ke(r, o, n) ? jt(r) : C(0);
771
+ const c = Pe(r, o, n) ? jt(r) : C(0);
767
772
  let a = (i.left + c.x) / s.x, l = (i.top + c.y) / s.y, u = i.width / s.x, f = i.height / s.y;
768
773
  if (r) {
769
774
  const m = A(r), h = n && R(n) ? A(n) : n;
@@ -773,29 +778,29 @@ function F(t, e, o, n) {
773
778
  a *= w.x, l *= w.y, u *= w.x, f *= w.y, a += x, l += b, p = A(g), g = p.frameElement;
774
779
  }
775
780
  }
776
- return et({
781
+ return nt({
777
782
  width: u,
778
783
  height: f,
779
784
  x: a,
780
785
  y: l
781
786
  });
782
787
  }
783
- function Pe(t) {
788
+ function We(t) {
784
789
  let {
785
790
  elements: e,
786
791
  rect: o,
787
792
  offsetParent: n,
788
793
  strategy: i
789
794
  } = t;
790
- const r = i === "fixed", s = L(n), c = e ? st(e.floating) : !1;
795
+ const r = i === "fixed", s = O(n), c = e ? st(e.floating) : !1;
791
796
  if (n === s || c && r)
792
797
  return o;
793
798
  let a = {
794
799
  scrollLeft: 0,
795
800
  scrollTop: 0
796
801
  }, l = C(1);
797
- const u = C(0), f = O(n);
798
- if ((f || !f && !r) && ((_(n) !== "body" || Y(s)) && (a = ct(n)), O(n))) {
802
+ const u = C(0), f = L(n);
803
+ if ((f || !f && !r) && ((_(n) !== "body" || K(s)) && (a = ct(n)), L(n))) {
799
804
  const m = F(n);
800
805
  l = $(n), u.x = m.x + n.clientLeft, u.y = m.y + n.clientTop;
801
806
  }
@@ -806,14 +811,14 @@ function Pe(t) {
806
811
  y: o.y * l.y - a.scrollTop * l.y + u.y
807
812
  };
808
813
  }
809
- function We(t) {
814
+ function Me(t) {
810
815
  return Array.from(t.getClientRects());
811
816
  }
812
817
  function Xt(t) {
813
- return F(L(t)).left + ct(t).scrollLeft;
818
+ return F(O(t)).left + ct(t).scrollLeft;
814
819
  }
815
- function Me(t) {
816
- const e = L(t), o = ct(t), n = t.ownerDocument.body, i = W(e.scrollWidth, e.clientWidth, n.scrollWidth, n.clientWidth), r = W(e.scrollHeight, e.clientHeight, n.scrollHeight, n.clientHeight);
820
+ function Fe(t) {
821
+ const e = O(t), o = ct(t), n = t.ownerDocument.body, i = W(e.scrollWidth, e.clientWidth, n.scrollWidth, n.clientWidth), r = W(e.scrollHeight, e.clientHeight, n.scrollHeight, n.clientHeight);
817
822
  let s = -o.scrollLeft + Xt(t);
818
823
  const c = -o.scrollTop;
819
824
  return E(n).direction === "rtl" && (s += W(e.clientWidth, n.clientWidth) - i), {
@@ -823,8 +828,8 @@ function Me(t) {
823
828
  y: c
824
829
  };
825
830
  }
826
- function Fe(t, e) {
827
- const o = A(t), n = L(t), i = o.visualViewport;
831
+ function De(t, e) {
832
+ const o = A(t), n = O(t), i = o.visualViewport;
828
833
  let r = n.clientWidth, s = n.clientHeight, c = 0, a = 0;
829
834
  if (i) {
830
835
  r = i.width, s = i.height;
@@ -838,8 +843,8 @@ function Fe(t, e) {
838
843
  y: a
839
844
  };
840
845
  }
841
- function De(t, e) {
842
- const o = F(t, !0, e === "fixed"), n = o.top + t.clientTop, i = o.left + t.clientLeft, r = O(t) ? $(t) : C(1), s = t.clientWidth * r.x, c = t.clientHeight * r.y, a = i * r.x, l = n * r.y;
846
+ function Ne(t, e) {
847
+ const o = F(t, !0, e === "fixed"), n = o.top + t.clientTop, i = o.left + t.clientLeft, r = L(t) ? $(t) : C(1), s = t.clientWidth * r.x, c = t.clientHeight * r.y, a = i * r.x, l = n * r.y;
843
848
  return {
844
849
  width: s,
845
850
  height: c,
@@ -850,11 +855,11 @@ function De(t, e) {
850
855
  function At(t, e, o) {
851
856
  let n;
852
857
  if (e === "viewport")
853
- n = Fe(t, o);
858
+ n = De(t, o);
854
859
  else if (e === "document")
855
- n = Me(L(t));
860
+ n = Fe(O(t));
856
861
  else if (R(e))
857
- n = De(e, o);
862
+ n = Ne(e, o);
858
863
  else {
859
864
  const i = jt(t);
860
865
  n = {
@@ -863,35 +868,35 @@ function At(t, e, o) {
863
868
  y: e.y - i.y
864
869
  };
865
870
  }
866
- return et(n);
871
+ return nt(n);
867
872
  }
868
873
  function qt(t, e) {
869
874
  const o = k(t);
870
875
  return o === e || !R(o) || z(o) ? !1 : E(o).position === "fixed" || qt(o, e);
871
876
  }
872
- function Ne(t, e) {
877
+ function $e(t, e) {
873
878
  const o = e.get(t);
874
879
  if (o)
875
880
  return o;
876
- let n = j(t, [], !1).filter((c) => R(c) && _(c) !== "body"), i = null;
881
+ let n = X(t, [], !1).filter((c) => R(c) && _(c) !== "body"), i = null;
877
882
  const r = E(t).position === "fixed";
878
883
  let s = r ? k(t) : t;
879
884
  for (; R(s) && !z(s); ) {
880
885
  const c = E(s), a = ht(s);
881
- !a && c.position === "fixed" && (i = null), (r ? !a && !i : !a && c.position === "static" && !!i && ["absolute", "fixed"].includes(i.position) || Y(s) && !a && qt(t, s)) ? n = n.filter((u) => u !== s) : i = c, s = k(s);
886
+ !a && c.position === "fixed" && (i = null), (r ? !a && !i : !a && c.position === "static" && !!i && ["absolute", "fixed"].includes(i.position) || K(s) && !a && qt(t, s)) ? n = n.filter((u) => u !== s) : i = c, s = k(s);
882
887
  }
883
888
  return e.set(t, n), n;
884
889
  }
885
- function $e(t) {
890
+ function Ve(t) {
886
891
  let {
887
892
  element: e,
888
893
  boundary: o,
889
894
  rootBoundary: n,
890
895
  strategy: i
891
896
  } = t;
892
- const s = [...o === "clippingAncestors" ? st(e) ? [] : Ne(e, this._c) : [].concat(o), n], c = s[0], a = s.reduce((l, u) => {
897
+ const s = [...o === "clippingAncestors" ? st(e) ? [] : $e(e, this._c) : [].concat(o), n], c = s[0], a = s.reduce((l, u) => {
893
898
  const f = At(e, u, i);
894
- return l.top = W(f.top, l.top), l.right = Q(f.right, l.right), l.bottom = Q(f.bottom, l.bottom), l.left = W(f.left, l.left), l;
899
+ return l.top = W(f.top, l.top), l.right = Z(f.right, l.right), l.bottom = Z(f.bottom, l.bottom), l.left = W(f.left, l.left), l;
895
900
  }, At(e, c, i));
896
901
  return {
897
902
  width: a.right - a.left,
@@ -900,7 +905,7 @@ function $e(t) {
900
905
  y: a.top
901
906
  };
902
907
  }
903
- function Ve(t) {
908
+ function ze(t) {
904
909
  const {
905
910
  width: e,
906
911
  height: o
@@ -910,15 +915,15 @@ function Ve(t) {
910
915
  height: o
911
916
  };
912
917
  }
913
- function ze(t, e, o) {
914
- const n = O(e), i = L(e), r = o === "fixed", s = F(t, !0, r, e);
918
+ function He(t, e, o) {
919
+ const n = L(e), i = O(e), r = o === "fixed", s = F(t, !0, r, e);
915
920
  let c = {
916
921
  scrollLeft: 0,
917
922
  scrollTop: 0
918
923
  };
919
924
  const a = C(0);
920
925
  if (n || !n && !r)
921
- if ((_(e) !== "body" || Y(i)) && (c = ct(e)), n) {
926
+ if ((_(e) !== "body" || K(i)) && (c = ct(e)), n) {
922
927
  const f = F(e, !0, r, e);
923
928
  a.x = f.x + e.clientLeft, a.y = f.y + e.clientTop;
924
929
  } else i && (a.x = Xt(i));
@@ -934,13 +939,13 @@ function at(t) {
934
939
  return E(t).position === "static";
935
940
  }
936
941
  function Et(t, e) {
937
- return !O(t) || E(t).position === "fixed" ? null : e ? e(t) : t.offsetParent;
942
+ return !L(t) || E(t).position === "fixed" ? null : e ? e(t) : t.offsetParent;
938
943
  }
939
944
  function Yt(t, e) {
940
945
  const o = A(t);
941
946
  if (st(t))
942
947
  return o;
943
- if (!O(t)) {
948
+ if (!L(t)) {
944
949
  let i = k(t);
945
950
  for (; i && !z(i); ) {
946
951
  if (R(i) && !at(i))
@@ -950,14 +955,14 @@ function Yt(t, e) {
950
955
  return o;
951
956
  }
952
957
  let n = Et(t, e);
953
- for (; n && Se(n) && at(n); )
958
+ for (; n && Te(n) && at(n); )
954
959
  n = Et(n, e);
955
- return n && z(n) && at(n) && !ht(n) ? o : n || Te(t) || o;
960
+ return n && z(n) && at(n) && !ht(n) ? o : n || Ce(t) || o;
956
961
  }
957
- const He = async function(t) {
962
+ const _e = async function(t) {
958
963
  const e = this.getOffsetParent || Yt, o = this.getDimensions, n = await o(t.floating);
959
964
  return {
960
- reference: ze(t.reference, await e(t.floating), t.strategy),
965
+ reference: He(t.reference, await e(t.floating), t.strategy),
961
966
  floating: {
962
967
  x: 0,
963
968
  y: 0,
@@ -966,24 +971,24 @@ const He = async function(t) {
966
971
  }
967
972
  };
968
973
  };
969
- function _e(t) {
974
+ function Be(t) {
970
975
  return E(t).direction === "rtl";
971
976
  }
972
- const Be = {
973
- convertOffsetParentRelativeRectToViewportRelativeRect: Pe,
974
- getDocumentElement: L,
975
- getClippingRect: $e,
977
+ const Ue = {
978
+ convertOffsetParentRelativeRectToViewportRelativeRect: We,
979
+ getDocumentElement: O,
980
+ getClippingRect: Ve,
976
981
  getOffsetParent: Yt,
977
- getElementRects: He,
978
- getClientRects: We,
979
- getDimensions: Ve,
982
+ getElementRects: _e,
983
+ getClientRects: Me,
984
+ getDimensions: ze,
980
985
  getScale: $,
981
986
  isElement: R,
982
- isRTL: _e
987
+ isRTL: Be
983
988
  };
984
- function Ue(t, e) {
989
+ function Ie(t, e) {
985
990
  let o = null, n;
986
- const i = L(t);
991
+ const i = O(t);
987
992
  function r() {
988
993
  var c;
989
994
  clearTimeout(n), (c = o) == null || c.disconnect(), o = null;
@@ -998,9 +1003,9 @@ function Ue(t, e) {
998
1003
  } = t.getBoundingClientRect();
999
1004
  if (c || e(), !f || !m)
1000
1005
  return;
1001
- const h = J(u), p = J(i.clientWidth - (l + f)), g = J(i.clientHeight - (u + m)), w = J(l), y = {
1006
+ const h = G(u), p = G(i.clientWidth - (l + f)), g = G(i.clientHeight - (u + m)), w = G(l), y = {
1002
1007
  rootMargin: -h + "px " + -p + "px " + -g + "px " + -w + "px",
1003
- threshold: W(0, Q(1, a)) || 1
1008
+ threshold: W(0, Z(1, a)) || 1
1004
1009
  };
1005
1010
  let x = !0;
1006
1011
  function b(v) {
@@ -1027,7 +1032,7 @@ function Ue(t, e) {
1027
1032
  }
1028
1033
  return s(!0), r;
1029
1034
  }
1030
- function Ie(t, e, o, n) {
1035
+ function je(t, e, o, n) {
1031
1036
  n === void 0 && (n = {});
1032
1037
  const {
1033
1038
  ancestorScroll: i = !0,
@@ -1035,13 +1040,13 @@ function Ie(t, e, o, n) {
1035
1040
  elementResize: s = typeof ResizeObserver == "function",
1036
1041
  layoutShift: c = typeof IntersectionObserver == "function",
1037
1042
  animationFrame: a = !1
1038
- } = n, l = mt(t), u = i || r ? [...l ? j(l) : [], ...j(e)] : [];
1043
+ } = n, l = mt(t), u = i || r ? [...l ? X(l) : [], ...X(e)] : [];
1039
1044
  u.forEach((d) => {
1040
1045
  i && d.addEventListener("scroll", o, {
1041
1046
  passive: !0
1042
1047
  }), r && d.addEventListener("resize", o);
1043
1048
  });
1044
- const f = l && c ? Ue(l, o) : null;
1049
+ const f = l && c ? Ie(l, o) : null;
1045
1050
  let m = -1, h = null;
1046
1051
  s && (h = new ResizeObserver((d) => {
1047
1052
  let [y] = d;
@@ -1063,15 +1068,15 @@ function Ie(t, e, o, n) {
1063
1068
  }), f == null || f(), (d = h) == null || d.disconnect(), h = null, a && cancelAnimationFrame(p);
1064
1069
  };
1065
1070
  }
1066
- const je = Oe, Xe = Le, Rt = Ee, qe = (t, e, o) => {
1071
+ const Xe = Oe, qe = Se, Rt = Re, Ye = (t, e, o) => {
1067
1072
  const n = /* @__PURE__ */ new Map(), i = {
1068
- platform: Be,
1073
+ platform: Ue,
1069
1074
  ...o
1070
1075
  }, r = {
1071
1076
  ...i.platform,
1072
1077
  _c: n
1073
1078
  };
1074
- return Ae(t, e, {
1079
+ return Ee(t, e, {
1075
1080
  ...i,
1076
1081
  platform: r
1077
1082
  });
@@ -1081,7 +1086,7 @@ const je = Oe, Xe = Le, Rt = Ee, qe = (t, e, o) => {
1081
1086
  placement: o,
1082
1087
  offset: { mainAxis: n, crossAxis: i } = { mainAxis: 0, crossAxis: 0 }
1083
1088
  }) => (r) => {
1084
- const s = r.element, c = ot.wrap(e);
1089
+ const s = r.element, c = j.wrap(e);
1085
1090
  return Ft(
1086
1091
  c,
1087
1092
  Wt(
@@ -1089,14 +1094,14 @@ const je = Oe, Xe = Le, Rt = Ee, qe = (t, e, o) => {
1089
1094
  Tt.div(
1090
1095
  Mt((a) => {
1091
1096
  const l = a;
1092
- return l.style.position = "absolute", Ie(s, l, () => {
1093
- qe(s, l, {
1097
+ return l.style.position = "absolute", je(s, l, () => {
1098
+ Ye(s, l, {
1094
1099
  placement: o,
1095
1100
  strategy: "absolute",
1096
1101
  middleware: [
1097
1102
  Rt(),
1098
- je({ mainAxis: n, crossAxis: i }),
1099
- Xe(),
1103
+ Xe({ mainAxis: n, crossAxis: i }),
1104
+ qe(),
1100
1105
  Rt()
1101
1106
  ]
1102
1107
  }).then(({ x: u, y: f }) => {
@@ -1108,14 +1113,14 @@ const je = Oe, Xe = Le, Rt = Ee, qe = (t, e, o) => {
1108
1113
  )
1109
1114
  )
1110
1115
  )(r);
1111
- }, Ye = (t, e) => {
1116
+ }, Ke = (t, e) => {
1112
1117
  if (typeof e == "function")
1113
- return Ye(t, { success: e });
1114
- const o = e.failure ?? ((i) => X(
1115
- q(i.on(console.error)),
1118
+ return Ke(t, { success: e });
1119
+ const o = e.failure ?? ((i) => q(
1120
+ Y(i.on(console.error)),
1116
1121
  i.map((r) => `Error: ${r}`)
1117
1122
  )), n = e.success;
1118
- return Pt(ot.wrap(t), {
1123
+ return Pt(j.wrap(t), {
1119
1124
  Success: (i) => n(i.$.value),
1120
1125
  Failure: (i) => o(i.$.error)
1121
1126
  });
@@ -1123,7 +1128,7 @@ const je = Oe, Xe = Le, Rt = Ee, qe = (t, e, o) => {
1123
1128
  var e;
1124
1129
  return (e = t.target) == null ? void 0 : e.select();
1125
1130
  }), fn = (t) => (e) => {
1126
- const o = e.element, n = H({ width: o.clientWidth, height: o.clientHeight }), i = nt(t(n))(e), r = () => {
1131
+ const o = e.element, n = H({ width: o.clientWidth, height: o.clientHeight }), i = ot(t(n))(e), r = () => {
1127
1132
  n.set({ width: o.clientWidth, height: o.clientHeight });
1128
1133
  };
1129
1134
  let s;
@@ -1134,7 +1139,7 @@ const je = Oe, Xe = Le, Rt = Ee, qe = (t, e, o) => {
1134
1139
  const o = H({
1135
1140
  width: (window == null ? void 0 : window.innerWidth) ?? 0,
1136
1141
  height: (window == null ? void 0 : window.innerHeight) ?? 0
1137
- }), n = nt(t(o))(e), i = () => {
1142
+ }), n = ot(t(o))(e), i = () => {
1138
1143
  o.set({
1139
1144
  width: (window == null ? void 0 : window.innerWidth) ?? 0,
1140
1145
  height: (window == null ? void 0 : window.innerHeight) ?? 0
@@ -1143,7 +1148,7 @@ const je = Oe, Xe = Le, Rt = Ee, qe = (t, e, o) => {
1143
1148
  return window == null || window.addEventListener("resize", i), (r) => {
1144
1149
  window == null || window.removeEventListener("resize", i), n(r);
1145
1150
  };
1146
- }, Ke = (t, e) => {
1151
+ }, Je = (t, e) => {
1147
1152
  const o = e.split("/").filter((i) => i !== ""), n = {};
1148
1153
  for (let i = 0; i < t.length; i++) {
1149
1154
  const r = t[i], s = o[i];
@@ -1158,21 +1163,21 @@ const je = Oe, Xe = Le, Rt = Ee, qe = (t, e, o) => {
1158
1163
  return { params: n, path: e };
1159
1164
  }
1160
1165
  return o.length !== t.length ? null : { params: n, path: e };
1161
- }, Je = (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 !== ""), Ge = (t) => {
1166
+ }, Ge = (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 !== ""), Qe = (t) => {
1162
1167
  const e = t.map((o) => {
1163
- const n = Je(o);
1168
+ const n = Ge(o);
1164
1169
  return { route: o, segments: n };
1165
1170
  });
1166
1171
  return function(n) {
1167
1172
  for (const { segments: i, route: r } of e) {
1168
- const s = Ke(i, n);
1173
+ const s = Je(i, n);
1169
1174
  if (s)
1170
1175
  return { ...s, route: r };
1171
1176
  }
1172
1177
  return null;
1173
1178
  };
1174
1179
  }, dn = (t) => {
1175
- const e = Ge(Object.keys(t));
1180
+ const e = Qe(Object.keys(t));
1176
1181
  return Nt((o) => {
1177
1182
  const n = o.map((i) => {
1178
1183
  const r = e(i.pathname);
@@ -1194,19 +1199,19 @@ const je = Oe, Xe = Le, Rt = Ee, qe = (t, e, o) => {
1194
1199
  });
1195
1200
  };
1196
1201
  export {
1197
- tn as Anchor,
1198
- ue as AsyncResultView,
1202
+ ue as Anchor,
1203
+ fe as AsyncResultView,
1199
1204
  on as AutoFocus,
1200
1205
  rn as AutoSelect,
1201
1206
  fn as ElementSize,
1202
1207
  cn as HTMLTitle,
1203
1208
  sn as HiddenWhenEmpty,
1204
- de as InViewport,
1209
+ me as InViewport,
1205
1210
  Dt as LocationProviderMarker,
1206
1211
  an as PopOver,
1207
1212
  en as ProvideAppearance,
1208
- Ze as ProvideLocation,
1209
- Ye as ResultView,
1213
+ tn as ProvideLocation,
1214
+ Ke as ResultView,
1210
1215
  dn as Router,
1211
1216
  un as SelectOnFocus,
1212
1217
  nn as UseAppearance,
@@ -1217,13 +1222,13 @@ export {
1217
1222
  te as _getExtension,
1218
1223
  ie as _makeLocation,
1219
1224
  ae as _makeLocationProp,
1220
- Ge as _makeRouteMatcher,
1221
- Je as _parseRouteSegments,
1225
+ Qe as _makeRouteMatcher,
1226
+ Ge as _parseRouteSegments,
1222
1227
  $t as appearanceMarker,
1223
1228
  re as areLocationsEqual,
1224
1229
  oe as handleAnchorClick,
1225
1230
  se as locationFromURL,
1226
- Ke as matchesRoute,
1231
+ Je as matchesRoute,
1227
1232
  ce as setLocationFromUrl,
1228
1233
  le as urlFromLocation
1229
1234
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tempots/ui",
3
- "version": "0.16.0",
3
+ "version": "0.16.1",
4
4
  "type": "module",
5
5
  "main": "./index.cjs",
6
6
  "module": "./index.js",
@@ -1,11 +1,34 @@
1
- import { TNode, Value } from '@tempots/dom';
1
+ import { TNode, Value, Renderable } from '@tempots/dom';
2
+ import { HandleAnchorClickOptions } from '../dom/handle-anchor-click';
3
+ import { Merge } from '@tempots/std';
4
+ /**
5
+ * Options for configuring an anchor element.
6
+ * @public
7
+ */
8
+ export type AnchorOptions = Merge<{
9
+ /**
10
+ * The href attribute of the anchor element.
11
+ * Can be a string or a Signal containing a string.
12
+ */
13
+ href: Value<string>;
14
+ }, HandleAnchorClickOptions>;
15
+ /**
16
+ * Represents either a string value (or Signal of string) for the href,
17
+ * or a full AnchorOptions object.
18
+ *
19
+ * This type is used as the first parameter of the Anchor function,
20
+ * allowing for flexible configuration of anchor elements.
21
+ *
22
+ * @public
23
+ */
24
+ export type HrefOrAnchorOptions = Value<string> | AnchorOptions;
2
25
  /**
3
26
  * Creates an anchor element with the specified href and children.
4
27
  * When the anchor element is clicked, the location is updated to the specified href.
5
28
  *
6
- * @param href - The href attribute of the anchor element.
29
+ * @param hrefOrOptions - The href attribute of the anchor element.
7
30
  * @param children - The child elements of the anchor element.
8
31
  * @returns The anchor element.
9
32
  * @public
10
33
  */
11
- export declare const Anchor: (href: Value<string>, ...children: TNode[]) => import('@tempots/dom').Renderable;
34
+ export declare const Anchor: (hrefOrOptions: HrefOrAnchorOptions, ...children: TNode[]) => Renderable;