From 43d5fc29dc047370cc953c6c03cc375a15fffda5 Mon Sep 17 00:00:00 2001 From: Abdo Date: Wed, 4 Mar 2026 19:56:34 +0300 Subject: [PATCH 1/2] Fix dark mode support I was under the impression that it was already working, but that was apparently due to an Anki quirk when you switch theme without a restart https://github.com/ankitects/anki/issues/4482 --- ankihub/gui/web/lib/tutorial.css | 2 +- ankihub/gui/web/lib/tutorial.js | 8 ++++---- scripts/build.py | 4 ++++ tutorial/lib/tutorial.css | 4 ---- tutorial/lib/tutorial.ts | 10 ++++++---- 5 files changed, 15 insertions(+), 13 deletions(-) diff --git a/ankihub/gui/web/lib/tutorial.css b/ankihub/gui/web/lib/tutorial.css index bb8d59df0..9531abaa0 100644 --- a/ankihub/gui/web/lib/tutorial.css +++ b/ankihub/gui/web/lib/tutorial.css @@ -1 +1 @@ -.ah-spotlight-active{position:relative;transition:background-color .3s ease}.night_mode .ah-spotlight-active{background-color:#1f2937}.ah-spotlight-active.ah-with-backdrop{-webkit-backdrop-filter:brightness(2);backdrop-filter:brightness(2);z-index:10001!important;border-radius:4px} +.ah-spotlight-active{position:relative;transition:background-color .3s ease}.ah-spotlight-active.ah-with-backdrop{-webkit-backdrop-filter:brightness(2);backdrop-filter:brightness(2);z-index:10001!important;border-radius:4px} diff --git a/ankihub/gui/web/lib/tutorial.js b/ankihub/gui/web/lib/tutorial.js index 437f20574..14ac4592d 100644 --- a/ankihub/gui/web/lib/tutorial.js +++ b/ankihub/gui/web/lib/tutorial.js @@ -1,7 +1,7 @@ -(function(T,_e){typeof exports=="object"&&typeof module<"u"?_e(exports):typeof define=="function"&&define.amd?define(["exports"],_e):(T=typeof globalThis<"u"?globalThis:T||self,_e(T.AnkiHub={}))})(this,(function(T){"use strict";const _e=["top","right","bottom","left"],dr=["start","end"],fr=_e.reduce((e,t)=>e.concat(t,t+"-"+dr[0],t+"-"+dr[1]),[]),se=Math.min,J=Math.max,je=Math.round,Fe=Math.floor,I=e=>({x:e,y:e}),ln={left:"right",right:"left",bottom:"top",top:"bottom"},cn={start:"end",end:"start"};function sn(e,t,r){return J(e,se(t,r))}function Ne(e,t){return typeof e=="function"?e(t):e}function Ee(e){return e.split("-")[0]}function D(e){return e.split("-")[1]}function un(e){return e==="x"?"y":"x"}function dt(e){return e==="y"?"height":"width"}const dn=new Set(["top","bottom"]);function ft(e){return dn.has(Ee(e))?"y":"x"}function vt(e){return un(ft(e))}function fn(e,t,r){r===void 0&&(r=!1);const o=D(e),n=vt(e),i=dt(n);let a=n==="x"?o===(r?"end":"start")?"right":"left":o==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(a=vr(a)),[a,vr(a)]}function vn(e){return e.replace(/start|end/g,t=>cn[t])}function vr(e){return e.replace(/left|right|bottom|top/g,t=>ln[t])}function pn(e){return{top:0,right:0,bottom:0,left:0,...e}}function pr(e){return typeof e!="number"?pn(e):{top:e,right:e,bottom:e,left:e}}function De(e){const{x:t,y:r,width:o,height:n}=e;return{width:o,height:n,top:r,left:t,right:t+o,bottom:r+n,x:t,y:r}}function br(e,t,r){let{reference:o,floating:n}=e;const i=ft(t),a=vt(t),l=dt(a),c=Ee(t),s=i==="y",u=o.x+o.width/2-n.width/2,d=o.y+o.height/2-n.height/2,v=o[l]/2-n[l]/2;let f;switch(c){case"top":f={x:u,y:o.y-n.height};break;case"bottom":f={x:u,y:o.y+o.height};break;case"right":f={x:o.x+o.width,y:d};break;case"left":f={x:o.x-n.width,y:d};break;default:f={x:o.x,y:o.y}}switch(D(t)){case"start":f[a]-=v*(r&&s?-1:1);break;case"end":f[a]+=v*(r&&s?-1:1);break}return f}const bn=async(e,t,r)=>{const{placement:o="bottom",strategy:n="absolute",middleware:i=[],platform:a}=r,l=i.filter(Boolean),c=await(a.isRTL==null?void 0:a.isRTL(t));let s=await a.getElementRects({reference:e,floating:t,strategy:n}),{x:u,y:d}=br(s,o,c),v=o,f={},g=0;for(let x=0;x({name:"arrow",options:e,async fn(t){const{x:r,y:o,placement:n,rects:i,platform:a,elements:l,middlewareData:c}=t,{element:s,padding:u=0}=Ne(e,t)||{};if(s==null)return{};const d=pr(u),v={x:r,y:o},f=vt(n),g=dt(f),x=await a.getDimensions(s),p=f==="y",b=p?"top":"left",m=p?"bottom":"right",h=p?"clientHeight":"clientWidth",w=i.reference[g]+i.reference[f]-v[f]-i.floating[g],y=v[f]-i.reference[f],C=await(a.getOffsetParent==null?void 0:a.getOffsetParent(s));let S=C?C[h]:0;(!S||!await(a.isElement==null?void 0:a.isElement(C)))&&(S=l.floating[h]||i.floating[g]);const st=w/2-y/2,le=S/2-x[g]/2-1,O=se(d[b],le),U=se(d[m],le),ke=O,ut=S-x[g]-U,ce=S/2-x[g]/2+st,cr=sn(ke,ce,ut),sr=!c.arrow&&D(n)!=null&&ce!==cr&&i.reference[g]/2-(ceD(n)===e),...r.filter(n=>D(n)!==e)]:r.filter(n=>Ee(n)===n)).filter(n=>e?D(n)===e||(t?vn(n)!==n:!1):!0)}const xn=function(e){return e===void 0&&(e={}),{name:"autoPlacement",options:e,async fn(t){var r,o,n;const{rects:i,middlewareData:a,placement:l,platform:c,elements:s}=t,{crossAxis:u=!1,alignment:d,allowedPlacements:v=fr,autoAlignment:f=!0,...g}=Ne(e,t),x=d!==void 0||v===fr?hn(d||null,f,v):v,p=await mn(t,g),b=((r=a.autoPlacement)==null?void 0:r.index)||0,m=x[b];if(m==null)return{};const h=fn(m,i,await(c.isRTL==null?void 0:c.isRTL(s.floating)));if(l!==m)return{reset:{placement:x[0]}};const w=[p[Ee(m)],p[h[0]],p[h[1]]],y=[...((o=a.autoPlacement)==null?void 0:o.overflows)||[],{placement:m,overflows:w}],C=x[b+1];if(C)return{data:{index:b+1,overflows:y},reset:{placement:C}};const S=y.map(O=>{const U=D(O.placement);return[O.placement,U&&u?O.overflows.slice(0,2).reduce((ke,ut)=>ke+ut,0):O.overflows[0],O.overflows]}).sort((O,U)=>O[1]-U[1]),le=((n=S.filter(O=>O[2].slice(0,D(O[0])?2:3).every(U=>U<=0))[0])==null?void 0:n[0])||S[0][0];return le!==l?{data:{index:b+1,overflows:y},reset:{placement:le}}:{}}}},wn=new Set(["left","top"]);async function yn(e,t){const{placement:r,platform:o,elements:n}=e,i=await(o.isRTL==null?void 0:o.isRTL(n.floating)),a=Ee(r),l=D(r),c=ft(r)==="y",s=wn.has(a)?-1:1,u=i&&c?-1:1,d=Ne(t,e);let{mainAxis:v,crossAxis:f,alignmentAxis:g}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return l&&typeof g=="number"&&(f=l==="end"?g*-1:g),c?{x:f*u,y:v*s}:{x:v*s,y:f*u}}const kn=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var r,o;const{x:n,y:i,placement:a,middlewareData:l}=t,c=await yn(t,e);return a===((r=l.offset)==null?void 0:r.placement)&&(o=l.arrow)!=null&&o.alignmentOffset?{}:{x:n+c.x,y:i+c.y,data:{...c,placement:a}}}}};function Be(){return typeof window<"u"}function ue(e){return mr(e)?(e.nodeName||"").toLowerCase():"#document"}function R(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function j(e){var t;return(t=(mr(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function mr(e){return Be()?e instanceof Node||e instanceof R(e).Node:!1}function P(e){return Be()?e instanceof Element||e instanceof R(e).Element:!1}function F(e){return Be()?e instanceof HTMLElement||e instanceof R(e).HTMLElement:!1}function gr(e){return!Be()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof R(e).ShadowRoot}const _n=new Set(["inline","contents"]);function Se(e){const{overflow:t,overflowX:r,overflowY:o,display:n}=L(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+r)&&!_n.has(n)}const En=new Set(["table","td","th"]);function Sn(e){return En.has(ue(e))}const An=[":popover-open",":modal"];function He(e){return An.some(t=>{try{return e.matches(t)}catch{return!1}})}const Cn=["transform","translate","scale","rotate","perspective"],On=["transform","translate","scale","rotate","perspective","filter"],Tn=["paint","layout","strict","content"];function pt(e){const t=bt(),r=P(e)?L(e):e;return Cn.some(o=>r[o]?r[o]!=="none":!1)||(r.containerType?r.containerType!=="normal":!1)||!t&&(r.backdropFilter?r.backdropFilter!=="none":!1)||!t&&(r.filter?r.filter!=="none":!1)||On.some(o=>(r.willChange||"").includes(o))||Tn.some(o=>(r.contain||"").includes(o))}function Rn(e){let t=H(e);for(;F(t)&&!de(t);){if(pt(t))return t;if(He(t))return null;t=H(t)}return null}function bt(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const Mn=new Set(["html","body","#document"]);function de(e){return Mn.has(ue(e))}function L(e){return R(e).getComputedStyle(e)}function We(e){return P(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function H(e){if(ue(e)==="html")return e;const t=e.assignedSlot||e.parentNode||gr(e)&&e.host||j(e);return gr(t)?t.host:t}function hr(e){const t=H(e);return de(t)?e.ownerDocument?e.ownerDocument.body:e.body:F(t)&&Se(t)?t:hr(t)}function Ae(e,t,r){var o;t===void 0&&(t=[]),r===void 0&&(r=!0);const n=hr(e),i=n===((o=e.ownerDocument)==null?void 0:o.body),a=R(n);if(i){const l=mt(a);return t.concat(a,a.visualViewport||[],Se(n)?n:[],l&&r?Ae(l):[])}return t.concat(n,Ae(n,[],r))}function mt(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function xr(e){const t=L(e);let r=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const n=F(e),i=n?e.offsetWidth:r,a=n?e.offsetHeight:o,l=je(r)!==i||je(o)!==a;return l&&(r=i,o=a),{width:r,height:o,$:l}}function gt(e){return P(e)?e:e.contextElement}function fe(e){const t=gt(e);if(!F(t))return I(1);const r=t.getBoundingClientRect(),{width:o,height:n,$:i}=xr(t);let a=(i?je(r.width):r.width)/o,l=(i?je(r.height):r.height)/n;return(!a||!Number.isFinite(a))&&(a=1),(!l||!Number.isFinite(l))&&(l=1),{x:a,y:l}}const Pn=I(0);function wr(e){const t=R(e);return!bt()||!t.visualViewport?Pn:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Ln(e,t,r){return t===void 0&&(t=!1),!r||t&&r!==R(e)?!1:t}function X(e,t,r,o){t===void 0&&(t=!1),r===void 0&&(r=!1);const n=e.getBoundingClientRect(),i=gt(e);let a=I(1);t&&(o?P(o)&&(a=fe(o)):a=fe(e));const l=Ln(i,r,o)?wr(i):I(0);let c=(n.left+l.x)/a.x,s=(n.top+l.y)/a.y,u=n.width/a.x,d=n.height/a.y;if(i){const v=R(i),f=o&&P(o)?R(o):o;let g=v,x=mt(g);for(;x&&o&&f!==g;){const p=fe(x),b=x.getBoundingClientRect(),m=L(x),h=b.left+(x.clientLeft+parseFloat(m.paddingLeft))*p.x,w=b.top+(x.clientTop+parseFloat(m.paddingTop))*p.y;c*=p.x,s*=p.y,u*=p.x,d*=p.y,c+=h,s+=w,g=R(x),x=mt(g)}}return De({width:u,height:d,x:c,y:s})}function Ke(e,t){const r=We(e).scrollLeft;return t?t.left+r:X(j(e)).left+r}function yr(e,t){const r=e.getBoundingClientRect(),o=r.left+t.scrollLeft-Ke(e,r),n=r.top+t.scrollTop;return{x:o,y:n}}function $n(e){let{elements:t,rect:r,offsetParent:o,strategy:n}=e;const i=n==="fixed",a=j(o),l=t?He(t.floating):!1;if(o===a||l&&i)return r;let c={scrollLeft:0,scrollTop:0},s=I(1);const u=I(0),d=F(o);if((d||!d&&!i)&&((ue(o)!=="body"||Se(a))&&(c=We(o)),F(o))){const f=X(o);s=fe(o),u.x=f.x+o.clientLeft,u.y=f.y+o.clientTop}const v=a&&!d&&!i?yr(a,c):I(0);return{width:r.width*s.x,height:r.height*s.y,x:r.x*s.x-c.scrollLeft*s.x+u.x+v.x,y:r.y*s.y-c.scrollTop*s.y+u.y+v.y}}function zn(e){return Array.from(e.getClientRects())}function In(e){const t=j(e),r=We(e),o=e.ownerDocument.body,n=J(t.scrollWidth,t.clientWidth,o.scrollWidth,o.clientWidth),i=J(t.scrollHeight,t.clientHeight,o.scrollHeight,o.clientHeight);let a=-r.scrollLeft+Ke(e);const l=-r.scrollTop;return L(o).direction==="rtl"&&(a+=J(t.clientWidth,o.clientWidth)-n),{width:n,height:i,x:a,y:l}}const kr=25;function jn(e,t){const r=R(e),o=j(e),n=r.visualViewport;let i=o.clientWidth,a=o.clientHeight,l=0,c=0;if(n){i=n.width,a=n.height;const u=bt();(!u||u&&t==="fixed")&&(l=n.offsetLeft,c=n.offsetTop)}const s=Ke(o);if(s<=0){const u=o.ownerDocument,d=u.body,v=getComputedStyle(d),f=u.compatMode==="CSS1Compat"&&parseFloat(v.marginLeft)+parseFloat(v.marginRight)||0,g=Math.abs(o.clientWidth-d.clientWidth-f);g<=kr&&(i-=g)}else s<=kr&&(i+=s);return{width:i,height:a,x:l,y:c}}const Fn=new Set(["absolute","fixed"]);function Nn(e,t){const r=X(e,!0,t==="fixed"),o=r.top+e.clientTop,n=r.left+e.clientLeft,i=F(e)?fe(e):I(1),a=e.clientWidth*i.x,l=e.clientHeight*i.y,c=n*i.x,s=o*i.y;return{width:a,height:l,x:c,y:s}}function _r(e,t,r){let o;if(t==="viewport")o=jn(e,r);else if(t==="document")o=In(j(e));else if(P(t))o=Nn(t,r);else{const n=wr(e);o={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return De(o)}function Er(e,t){const r=H(e);return r===t||!P(r)||de(r)?!1:L(r).position==="fixed"||Er(r,t)}function Dn(e,t){const r=t.get(e);if(r)return r;let o=Ae(e,[],!1).filter(l=>P(l)&&ue(l)!=="body"),n=null;const i=L(e).position==="fixed";let a=i?H(e):e;for(;P(a)&&!de(a);){const l=L(a),c=pt(a);!c&&l.position==="fixed"&&(n=null),(i?!c&&!n:!c&&l.position==="static"&&!!n&&Fn.has(n.position)||Se(a)&&!c&&Er(e,a))?o=o.filter(u=>u!==a):n=l,a=H(a)}return t.set(e,o),o}function Bn(e){let{element:t,boundary:r,rootBoundary:o,strategy:n}=e;const a=[...r==="clippingAncestors"?He(t)?[]:Dn(t,this._c):[].concat(r),o],l=a[0],c=a.reduce((s,u)=>{const d=_r(t,u,n);return s.top=J(d.top,s.top),s.right=se(d.right,s.right),s.bottom=se(d.bottom,s.bottom),s.left=J(d.left,s.left),s},_r(t,l,n));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function Hn(e){const{width:t,height:r}=xr(e);return{width:t,height:r}}function Wn(e,t,r){const o=F(t),n=j(t),i=r==="fixed",a=X(e,!0,i,t);let l={scrollLeft:0,scrollTop:0};const c=I(0);function s(){c.x=Ke(n)}if(o||!o&&!i)if((ue(t)!=="body"||Se(n))&&(l=We(t)),o){const f=X(t,!0,i,t);c.x=f.x+t.clientLeft,c.y=f.y+t.clientTop}else n&&s();i&&!o&&n&&s();const u=n&&!o&&!i?yr(n,l):I(0),d=a.left+l.scrollLeft-c.x-u.x,v=a.top+l.scrollTop-c.y-u.y;return{x:d,y:v,width:a.width,height:a.height}}function ht(e){return L(e).position==="static"}function Sr(e,t){if(!F(e)||L(e).position==="fixed")return null;if(t)return t(e);let r=e.offsetParent;return j(e)===r&&(r=r.ownerDocument.body),r}function Ar(e,t){const r=R(e);if(He(e))return r;if(!F(e)){let n=H(e);for(;n&&!de(n);){if(P(n)&&!ht(n))return n;n=H(n)}return r}let o=Sr(e,t);for(;o&&Sn(o)&&ht(o);)o=Sr(o,t);return o&&de(o)&&ht(o)&&!pt(o)?r:o||Rn(e)||r}const Kn=async function(e){const t=this.getOffsetParent||Ar,r=this.getDimensions,o=await r(e.floating);return{reference:Wn(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function Vn(e){return L(e).direction==="rtl"}const qn={convertOffsetParentRelativeRectToViewportRelativeRect:$n,getDocumentElement:j,getClippingRect:Bn,getOffsetParent:Ar,getElementRects:Kn,getClientRects:zn,getDimensions:Hn,getScale:fe,isElement:P,isRTL:Vn};function Cr(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Un(e,t){let r=null,o;const n=j(e);function i(){var l;clearTimeout(o),(l=r)==null||l.disconnect(),r=null}function a(l,c){l===void 0&&(l=!1),c===void 0&&(c=1),i();const s=e.getBoundingClientRect(),{left:u,top:d,width:v,height:f}=s;if(l||t(),!v||!f)return;const g=Fe(d),x=Fe(n.clientWidth-(u+v)),p=Fe(n.clientHeight-(d+f)),b=Fe(u),h={rootMargin:-g+"px "+-x+"px "+-p+"px "+-b+"px",threshold:J(0,se(1,c))||1};let w=!0;function y(C){const S=C[0].intersectionRatio;if(S!==c){if(!w)return a();S?a(!1,S):o=setTimeout(()=>{a(!1,1e-7)},1e3)}S===1&&!Cr(s,e.getBoundingClientRect())&&a(),w=!1}try{r=new IntersectionObserver(y,{...h,root:n.ownerDocument})}catch{r=new IntersectionObserver(y,h)}r.observe(e)}return a(!0),i}function Jn(e,t,r,o){o===void 0&&(o={});const{ancestorScroll:n=!0,ancestorResize:i=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=o,s=gt(e),u=n||i?[...s?Ae(s):[],...Ae(t)]:[];u.forEach(b=>{n&&b.addEventListener("scroll",r,{passive:!0}),i&&b.addEventListener("resize",r)});const d=s&&l?Un(s,r):null;let v=-1,f=null;a&&(f=new ResizeObserver(b=>{let[m]=b;m&&m.target===s&&f&&(f.unobserve(t),cancelAnimationFrame(v),v=requestAnimationFrame(()=>{var h;(h=f)==null||h.observe(t)})),r()}),s&&!c&&f.observe(s),f.observe(t));let g,x=c?X(e):null;c&&p();function p(){const b=X(e);x&&!Cr(x,b)&&r(),x=b,g=requestAnimationFrame(p)}return r(),()=>{var b;u.forEach(m=>{n&&m.removeEventListener("scroll",r),i&&m.removeEventListener("resize",r)}),d?.(),(b=f)==null||b.disconnect(),f=null,c&&cancelAnimationFrame(g)}}const Xn=kn,Yn=xn,Gn=gn,Zn=(e,t,r)=>{const o=new Map,n={platform:qn,...r},i={...n.platform,_c:o};return bn(e,t,{...n,platform:i})};var xt=!1,wt=!1,Y=[],yt=-1;function Qn(e){ei(e)}function ei(e){Y.includes(e)||Y.push(e),ri()}function ti(e){let t=Y.indexOf(e);t!==-1&&t>yt&&Y.splice(t,1)}function ri(){!wt&&!xt&&(xt=!0,queueMicrotask(oi))}function oi(){xt=!1,wt=!0;for(let e=0;ee.effect(t,{scheduler:r=>{kt?Qn(r):r()}}),Or=e.raw}function Tr(e){G=e}function ai(e){let t=()=>{};return[o=>{let n=G(o);return e._x_effects||(e._x_effects=new Set,e._x_runEffects=()=>{e._x_effects.forEach(i=>i())}),e._x_effects.add(n),t=()=>{n!==void 0&&(e._x_effects.delete(n),pe(n))},n},()=>{t()}]}function Rr(e,t){let r=!0,o,n=G(()=>{let i=e();JSON.stringify(i),r?o=i:queueMicrotask(()=>{t(i,o),o=i}),r=!1});return()=>pe(n)}var Mr=[],Pr=[],Lr=[];function li(e){Lr.push(e)}function _t(e,t){typeof t=="function"?(e._x_cleanups||(e._x_cleanups=[]),e._x_cleanups.push(t)):(t=e,Pr.push(t))}function $r(e){Mr.push(e)}function zr(e,t,r){e._x_attributeCleanups||(e._x_attributeCleanups={}),e._x_attributeCleanups[t]||(e._x_attributeCleanups[t]=[]),e._x_attributeCleanups[t].push(r)}function Ir(e,t){e._x_attributeCleanups&&Object.entries(e._x_attributeCleanups).forEach(([r,o])=>{(t===void 0||t.includes(r))&&(o.forEach(n=>n()),delete e._x_attributeCleanups[r])})}function ci(e){for(e._x_effects?.forEach(ti);e._x_cleanups?.length;)e._x_cleanups.pop()()}var Et=new MutationObserver(Ot),St=!1;function At(){Et.observe(document,{subtree:!0,childList:!0,attributes:!0,attributeOldValue:!0}),St=!0}function jr(){si(),Et.disconnect(),St=!1}var Ce=[];function si(){let e=Et.takeRecords();Ce.push(()=>e.length>0&&Ot(e));let t=Ce.length;queueMicrotask(()=>{if(Ce.length===t)for(;Ce.length>0;)Ce.shift()()})}function _(e){if(!St)return e();jr();let t=e();return At(),t}var Ct=!1,Ve=[];function ui(){Ct=!0}function di(){Ct=!1,Ot(Ve),Ve=[]}function Ot(e){if(Ct){Ve=Ve.concat(e);return}let t=[],r=new Set,o=new Map,n=new Map;for(let i=0;i{a.nodeType===1&&a._x_marker&&r.add(a)}),e[i].addedNodes.forEach(a=>{if(a.nodeType===1){if(r.has(a)){r.delete(a);return}a._x_marker||t.push(a)}})),e[i].type==="attributes")){let a=e[i].target,l=e[i].attributeName,c=e[i].oldValue,s=()=>{o.has(a)||o.set(a,[]),o.get(a).push({name:l,value:a.getAttribute(l)})},u=()=>{n.has(a)||n.set(a,[]),n.get(a).push(l)};a.hasAttribute(l)&&c===null?s():a.hasAttribute(l)?(u(),s()):u()}n.forEach((i,a)=>{Ir(a,i)}),o.forEach((i,a)=>{Mr.forEach(l=>l(a,i))});for(let i of r)t.some(a=>a.contains(i))||Pr.forEach(a=>a(i));for(let i of t)i.isConnected&&Lr.forEach(a=>a(i));t=null,r=null,o=null,n=null}function Fr(e){return Q(Z(e))}function Oe(e,t,r){return e._x_dataStack=[t,...Z(r||e)],()=>{e._x_dataStack=e._x_dataStack.filter(o=>o!==t)}}function Z(e){return e._x_dataStack?e._x_dataStack:typeof ShadowRoot=="function"&&e instanceof ShadowRoot?Z(e.host):e.parentNode?Z(e.parentNode):[]}function Q(e){return new Proxy({objects:e},fi)}var fi={ownKeys({objects:e}){return Array.from(new Set(e.flatMap(t=>Object.keys(t))))},has({objects:e},t){return t==Symbol.unscopables?!1:e.some(r=>Object.prototype.hasOwnProperty.call(r,t)||Reflect.has(r,t))},get({objects:e},t,r){return t=="toJSON"?vi:Reflect.get(e.find(o=>Reflect.has(o,t))||{},t,r)},set({objects:e},t,r,o){const n=e.find(a=>Object.prototype.hasOwnProperty.call(a,t))||e[e.length-1],i=Object.getOwnPropertyDescriptor(n,t);return i?.set&&i?.get?i.set.call(o,r)||!0:Reflect.set(n,t,r)}};function vi(){return Reflect.ownKeys(this).reduce((t,r)=>(t[r]=Reflect.get(this,r),t),{})}function Tt(e){let t=o=>typeof o=="object"&&!Array.isArray(o)&&o!==null,r=(o,n="")=>{Object.entries(Object.getOwnPropertyDescriptors(o)).forEach(([i,{value:a,enumerable:l}])=>{if(l===!1||a===void 0||typeof a=="object"&&a!==null&&a.__v_skip)return;let c=n===""?i:`${n}.${i}`;typeof a=="object"&&a!==null&&a._x_interceptor?o[i]=a.initialize(e,c,i):t(a)&&a!==o&&!(a instanceof Element)&&r(a,c)})};return r(e)}function Nr(e,t=()=>{}){let r={initialValue:void 0,_x_interceptor:!0,initialize(o,n,i){return e(this.initialValue,()=>pi(o,n),a=>Rt(o,n,a),n,i)}};return t(r),o=>{if(typeof o=="object"&&o!==null&&o._x_interceptor){let n=r.initialize.bind(r);r.initialize=(i,a,l)=>{let c=o.initialize(i,a,l);return r.initialValue=c,n(i,a,l)}}else r.initialValue=o;return r}}function pi(e,t){return t.split(".").reduce((r,o)=>r[o],e)}function Rt(e,t,r){if(typeof t=="string"&&(t=t.split(".")),t.length===1)e[t[0]]=r;else{if(t.length===0)throw error;return e[t[0]]||(e[t[0]]={}),Rt(e[t[0]],t.slice(1),r)}}var Dr={};function $(e,t){Dr[e]=t}function Te(e,t){let r=bi(t);return Object.entries(Dr).forEach(([o,n])=>{Object.defineProperty(e,`$${o}`,{get(){return n(t,r)},enumerable:!1})}),e}function bi(e){let[t,r]=Jr(e),o={interceptor:Nr,...t};return _t(e,r),o}function mi(e,t,r,...o){try{return r(...o)}catch(n){Re(n,e,t)}}function Re(...e){return Br(...e)}var Br=hi;function gi(e){Br=e}function hi(e,t,r=void 0){e=Object.assign(e??{message:"No error message given."},{el:t,expression:r}),console.warn(`Alpine Expression Error: ${e.message} +(function(T,_e){typeof exports=="object"&&typeof module<"u"?_e(exports):typeof define=="function"&&define.amd?define(["exports"],_e):(T=typeof globalThis<"u"?globalThis:T||self,_e(T.AnkiHub={}))})(this,(function(T){"use strict";const _e=["top","right","bottom","left"],fr=["start","end"],vr=_e.reduce((e,t)=>e.concat(t,t+"-"+fr[0],t+"-"+fr[1]),[]),se=Math.min,J=Math.max,je=Math.round,Fe=Math.floor,I=e=>({x:e,y:e}),cn={left:"right",right:"left",bottom:"top",top:"bottom"},sn={start:"end",end:"start"};function un(e,t,r){return J(e,se(t,r))}function Ne(e,t){return typeof e=="function"?e(t):e}function Ee(e){return e.split("-")[0]}function D(e){return e.split("-")[1]}function dn(e){return e==="x"?"y":"x"}function dt(e){return e==="y"?"height":"width"}const fn=new Set(["top","bottom"]);function ft(e){return fn.has(Ee(e))?"y":"x"}function vt(e){return dn(ft(e))}function vn(e,t,r){r===void 0&&(r=!1);const o=D(e),n=vt(e),i=dt(n);let a=n==="x"?o===(r?"end":"start")?"right":"left":o==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(a=pr(a)),[a,pr(a)]}function pn(e){return e.replace(/start|end/g,t=>sn[t])}function pr(e){return e.replace(/left|right|bottom|top/g,t=>cn[t])}function bn(e){return{top:0,right:0,bottom:0,left:0,...e}}function br(e){return typeof e!="number"?bn(e):{top:e,right:e,bottom:e,left:e}}function De(e){const{x:t,y:r,width:o,height:n}=e;return{width:o,height:n,top:r,left:t,right:t+o,bottom:r+n,x:t,y:r}}function mr(e,t,r){let{reference:o,floating:n}=e;const i=ft(t),a=vt(t),l=dt(a),c=Ee(t),s=i==="y",u=o.x+o.width/2-n.width/2,d=o.y+o.height/2-n.height/2,v=o[l]/2-n[l]/2;let f;switch(c){case"top":f={x:u,y:o.y-n.height};break;case"bottom":f={x:u,y:o.y+o.height};break;case"right":f={x:o.x+o.width,y:d};break;case"left":f={x:o.x-n.width,y:d};break;default:f={x:o.x,y:o.y}}switch(D(t)){case"start":f[a]-=v*(r&&s?-1:1);break;case"end":f[a]+=v*(r&&s?-1:1);break}return f}const mn=async(e,t,r)=>{const{placement:o="bottom",strategy:n="absolute",middleware:i=[],platform:a}=r,l=i.filter(Boolean),c=await(a.isRTL==null?void 0:a.isRTL(t));let s=await a.getElementRects({reference:e,floating:t,strategy:n}),{x:u,y:d}=mr(s,o,c),v=o,f={},g=0;for(let x=0;x({name:"arrow",options:e,async fn(t){const{x:r,y:o,placement:n,rects:i,platform:a,elements:l,middlewareData:c}=t,{element:s,padding:u=0}=Ne(e,t)||{};if(s==null)return{};const d=br(u),v={x:r,y:o},f=vt(n),g=dt(f),x=await a.getDimensions(s),p=f==="y",b=p?"top":"left",m=p?"bottom":"right",h=p?"clientHeight":"clientWidth",w=i.reference[g]+i.reference[f]-v[f]-i.floating[g],y=v[f]-i.reference[f],C=await(a.getOffsetParent==null?void 0:a.getOffsetParent(s));let S=C?C[h]:0;(!S||!await(a.isElement==null?void 0:a.isElement(C)))&&(S=l.floating[h]||i.floating[g]);const st=w/2-y/2,le=S/2-x[g]/2-1,O=se(d[b],le),U=se(d[m],le),ke=O,ut=S-x[g]-U,ce=S/2-x[g]/2+st,sr=un(ke,ce,ut),ur=!c.arrow&&D(n)!=null&&ce!==sr&&i.reference[g]/2-(ceD(n)===e),...r.filter(n=>D(n)!==e)]:r.filter(n=>Ee(n)===n)).filter(n=>e?D(n)===e||(t?pn(n)!==n:!1):!0)}const wn=function(e){return e===void 0&&(e={}),{name:"autoPlacement",options:e,async fn(t){var r,o,n;const{rects:i,middlewareData:a,placement:l,platform:c,elements:s}=t,{crossAxis:u=!1,alignment:d,allowedPlacements:v=vr,autoAlignment:f=!0,...g}=Ne(e,t),x=d!==void 0||v===vr?xn(d||null,f,v):v,p=await gn(t,g),b=((r=a.autoPlacement)==null?void 0:r.index)||0,m=x[b];if(m==null)return{};const h=vn(m,i,await(c.isRTL==null?void 0:c.isRTL(s.floating)));if(l!==m)return{reset:{placement:x[0]}};const w=[p[Ee(m)],p[h[0]],p[h[1]]],y=[...((o=a.autoPlacement)==null?void 0:o.overflows)||[],{placement:m,overflows:w}],C=x[b+1];if(C)return{data:{index:b+1,overflows:y},reset:{placement:C}};const S=y.map(O=>{const U=D(O.placement);return[O.placement,U&&u?O.overflows.slice(0,2).reduce((ke,ut)=>ke+ut,0):O.overflows[0],O.overflows]}).sort((O,U)=>O[1]-U[1]),le=((n=S.filter(O=>O[2].slice(0,D(O[0])?2:3).every(U=>U<=0))[0])==null?void 0:n[0])||S[0][0];return le!==l?{data:{index:b+1,overflows:y},reset:{placement:le}}:{}}}},yn=new Set(["left","top"]);async function kn(e,t){const{placement:r,platform:o,elements:n}=e,i=await(o.isRTL==null?void 0:o.isRTL(n.floating)),a=Ee(r),l=D(r),c=ft(r)==="y",s=yn.has(a)?-1:1,u=i&&c?-1:1,d=Ne(t,e);let{mainAxis:v,crossAxis:f,alignmentAxis:g}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return l&&typeof g=="number"&&(f=l==="end"?g*-1:g),c?{x:f*u,y:v*s}:{x:v*s,y:f*u}}const _n=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var r,o;const{x:n,y:i,placement:a,middlewareData:l}=t,c=await kn(t,e);return a===((r=l.offset)==null?void 0:r.placement)&&(o=l.arrow)!=null&&o.alignmentOffset?{}:{x:n+c.x,y:i+c.y,data:{...c,placement:a}}}}};function Be(){return typeof window<"u"}function ue(e){return gr(e)?(e.nodeName||"").toLowerCase():"#document"}function R(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function j(e){var t;return(t=(gr(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function gr(e){return Be()?e instanceof Node||e instanceof R(e).Node:!1}function P(e){return Be()?e instanceof Element||e instanceof R(e).Element:!1}function F(e){return Be()?e instanceof HTMLElement||e instanceof R(e).HTMLElement:!1}function hr(e){return!Be()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof R(e).ShadowRoot}const En=new Set(["inline","contents"]);function Se(e){const{overflow:t,overflowX:r,overflowY:o,display:n}=L(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+r)&&!En.has(n)}const Sn=new Set(["table","td","th"]);function An(e){return Sn.has(ue(e))}const Cn=[":popover-open",":modal"];function He(e){return Cn.some(t=>{try{return e.matches(t)}catch{return!1}})}const On=["transform","translate","scale","rotate","perspective"],Tn=["transform","translate","scale","rotate","perspective","filter"],Rn=["paint","layout","strict","content"];function pt(e){const t=bt(),r=P(e)?L(e):e;return On.some(o=>r[o]?r[o]!=="none":!1)||(r.containerType?r.containerType!=="normal":!1)||!t&&(r.backdropFilter?r.backdropFilter!=="none":!1)||!t&&(r.filter?r.filter!=="none":!1)||Tn.some(o=>(r.willChange||"").includes(o))||Rn.some(o=>(r.contain||"").includes(o))}function Mn(e){let t=H(e);for(;F(t)&&!de(t);){if(pt(t))return t;if(He(t))return null;t=H(t)}return null}function bt(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const Pn=new Set(["html","body","#document"]);function de(e){return Pn.has(ue(e))}function L(e){return R(e).getComputedStyle(e)}function We(e){return P(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function H(e){if(ue(e)==="html")return e;const t=e.assignedSlot||e.parentNode||hr(e)&&e.host||j(e);return hr(t)?t.host:t}function xr(e){const t=H(e);return de(t)?e.ownerDocument?e.ownerDocument.body:e.body:F(t)&&Se(t)?t:xr(t)}function Ae(e,t,r){var o;t===void 0&&(t=[]),r===void 0&&(r=!0);const n=xr(e),i=n===((o=e.ownerDocument)==null?void 0:o.body),a=R(n);if(i){const l=mt(a);return t.concat(a,a.visualViewport||[],Se(n)?n:[],l&&r?Ae(l):[])}return t.concat(n,Ae(n,[],r))}function mt(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function wr(e){const t=L(e);let r=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const n=F(e),i=n?e.offsetWidth:r,a=n?e.offsetHeight:o,l=je(r)!==i||je(o)!==a;return l&&(r=i,o=a),{width:r,height:o,$:l}}function gt(e){return P(e)?e:e.contextElement}function fe(e){const t=gt(e);if(!F(t))return I(1);const r=t.getBoundingClientRect(),{width:o,height:n,$:i}=wr(t);let a=(i?je(r.width):r.width)/o,l=(i?je(r.height):r.height)/n;return(!a||!Number.isFinite(a))&&(a=1),(!l||!Number.isFinite(l))&&(l=1),{x:a,y:l}}const Ln=I(0);function yr(e){const t=R(e);return!bt()||!t.visualViewport?Ln:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function $n(e,t,r){return t===void 0&&(t=!1),!r||t&&r!==R(e)?!1:t}function X(e,t,r,o){t===void 0&&(t=!1),r===void 0&&(r=!1);const n=e.getBoundingClientRect(),i=gt(e);let a=I(1);t&&(o?P(o)&&(a=fe(o)):a=fe(e));const l=$n(i,r,o)?yr(i):I(0);let c=(n.left+l.x)/a.x,s=(n.top+l.y)/a.y,u=n.width/a.x,d=n.height/a.y;if(i){const v=R(i),f=o&&P(o)?R(o):o;let g=v,x=mt(g);for(;x&&o&&f!==g;){const p=fe(x),b=x.getBoundingClientRect(),m=L(x),h=b.left+(x.clientLeft+parseFloat(m.paddingLeft))*p.x,w=b.top+(x.clientTop+parseFloat(m.paddingTop))*p.y;c*=p.x,s*=p.y,u*=p.x,d*=p.y,c+=h,s+=w,g=R(x),x=mt(g)}}return De({width:u,height:d,x:c,y:s})}function Ke(e,t){const r=We(e).scrollLeft;return t?t.left+r:X(j(e)).left+r}function kr(e,t){const r=e.getBoundingClientRect(),o=r.left+t.scrollLeft-Ke(e,r),n=r.top+t.scrollTop;return{x:o,y:n}}function zn(e){let{elements:t,rect:r,offsetParent:o,strategy:n}=e;const i=n==="fixed",a=j(o),l=t?He(t.floating):!1;if(o===a||l&&i)return r;let c={scrollLeft:0,scrollTop:0},s=I(1);const u=I(0),d=F(o);if((d||!d&&!i)&&((ue(o)!=="body"||Se(a))&&(c=We(o)),F(o))){const f=X(o);s=fe(o),u.x=f.x+o.clientLeft,u.y=f.y+o.clientTop}const v=a&&!d&&!i?kr(a,c):I(0);return{width:r.width*s.x,height:r.height*s.y,x:r.x*s.x-c.scrollLeft*s.x+u.x+v.x,y:r.y*s.y-c.scrollTop*s.y+u.y+v.y}}function In(e){return Array.from(e.getClientRects())}function jn(e){const t=j(e),r=We(e),o=e.ownerDocument.body,n=J(t.scrollWidth,t.clientWidth,o.scrollWidth,o.clientWidth),i=J(t.scrollHeight,t.clientHeight,o.scrollHeight,o.clientHeight);let a=-r.scrollLeft+Ke(e);const l=-r.scrollTop;return L(o).direction==="rtl"&&(a+=J(t.clientWidth,o.clientWidth)-n),{width:n,height:i,x:a,y:l}}const _r=25;function Fn(e,t){const r=R(e),o=j(e),n=r.visualViewport;let i=o.clientWidth,a=o.clientHeight,l=0,c=0;if(n){i=n.width,a=n.height;const u=bt();(!u||u&&t==="fixed")&&(l=n.offsetLeft,c=n.offsetTop)}const s=Ke(o);if(s<=0){const u=o.ownerDocument,d=u.body,v=getComputedStyle(d),f=u.compatMode==="CSS1Compat"&&parseFloat(v.marginLeft)+parseFloat(v.marginRight)||0,g=Math.abs(o.clientWidth-d.clientWidth-f);g<=_r&&(i-=g)}else s<=_r&&(i+=s);return{width:i,height:a,x:l,y:c}}const Nn=new Set(["absolute","fixed"]);function Dn(e,t){const r=X(e,!0,t==="fixed"),o=r.top+e.clientTop,n=r.left+e.clientLeft,i=F(e)?fe(e):I(1),a=e.clientWidth*i.x,l=e.clientHeight*i.y,c=n*i.x,s=o*i.y;return{width:a,height:l,x:c,y:s}}function Er(e,t,r){let o;if(t==="viewport")o=Fn(e,r);else if(t==="document")o=jn(j(e));else if(P(t))o=Dn(t,r);else{const n=yr(e);o={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return De(o)}function Sr(e,t){const r=H(e);return r===t||!P(r)||de(r)?!1:L(r).position==="fixed"||Sr(r,t)}function Bn(e,t){const r=t.get(e);if(r)return r;let o=Ae(e,[],!1).filter(l=>P(l)&&ue(l)!=="body"),n=null;const i=L(e).position==="fixed";let a=i?H(e):e;for(;P(a)&&!de(a);){const l=L(a),c=pt(a);!c&&l.position==="fixed"&&(n=null),(i?!c&&!n:!c&&l.position==="static"&&!!n&&Nn.has(n.position)||Se(a)&&!c&&Sr(e,a))?o=o.filter(u=>u!==a):n=l,a=H(a)}return t.set(e,o),o}function Hn(e){let{element:t,boundary:r,rootBoundary:o,strategy:n}=e;const a=[...r==="clippingAncestors"?He(t)?[]:Bn(t,this._c):[].concat(r),o],l=a[0],c=a.reduce((s,u)=>{const d=Er(t,u,n);return s.top=J(d.top,s.top),s.right=se(d.right,s.right),s.bottom=se(d.bottom,s.bottom),s.left=J(d.left,s.left),s},Er(t,l,n));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function Wn(e){const{width:t,height:r}=wr(e);return{width:t,height:r}}function Kn(e,t,r){const o=F(t),n=j(t),i=r==="fixed",a=X(e,!0,i,t);let l={scrollLeft:0,scrollTop:0};const c=I(0);function s(){c.x=Ke(n)}if(o||!o&&!i)if((ue(t)!=="body"||Se(n))&&(l=We(t)),o){const f=X(t,!0,i,t);c.x=f.x+t.clientLeft,c.y=f.y+t.clientTop}else n&&s();i&&!o&&n&&s();const u=n&&!o&&!i?kr(n,l):I(0),d=a.left+l.scrollLeft-c.x-u.x,v=a.top+l.scrollTop-c.y-u.y;return{x:d,y:v,width:a.width,height:a.height}}function ht(e){return L(e).position==="static"}function Ar(e,t){if(!F(e)||L(e).position==="fixed")return null;if(t)return t(e);let r=e.offsetParent;return j(e)===r&&(r=r.ownerDocument.body),r}function Cr(e,t){const r=R(e);if(He(e))return r;if(!F(e)){let n=H(e);for(;n&&!de(n);){if(P(n)&&!ht(n))return n;n=H(n)}return r}let o=Ar(e,t);for(;o&&An(o)&&ht(o);)o=Ar(o,t);return o&&de(o)&&ht(o)&&!pt(o)?r:o||Mn(e)||r}const Vn=async function(e){const t=this.getOffsetParent||Cr,r=this.getDimensions,o=await r(e.floating);return{reference:Kn(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function qn(e){return L(e).direction==="rtl"}const Un={convertOffsetParentRelativeRectToViewportRelativeRect:zn,getDocumentElement:j,getClippingRect:Hn,getOffsetParent:Cr,getElementRects:Vn,getClientRects:In,getDimensions:Wn,getScale:fe,isElement:P,isRTL:qn};function Or(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Jn(e,t){let r=null,o;const n=j(e);function i(){var l;clearTimeout(o),(l=r)==null||l.disconnect(),r=null}function a(l,c){l===void 0&&(l=!1),c===void 0&&(c=1),i();const s=e.getBoundingClientRect(),{left:u,top:d,width:v,height:f}=s;if(l||t(),!v||!f)return;const g=Fe(d),x=Fe(n.clientWidth-(u+v)),p=Fe(n.clientHeight-(d+f)),b=Fe(u),h={rootMargin:-g+"px "+-x+"px "+-p+"px "+-b+"px",threshold:J(0,se(1,c))||1};let w=!0;function y(C){const S=C[0].intersectionRatio;if(S!==c){if(!w)return a();S?a(!1,S):o=setTimeout(()=>{a(!1,1e-7)},1e3)}S===1&&!Or(s,e.getBoundingClientRect())&&a(),w=!1}try{r=new IntersectionObserver(y,{...h,root:n.ownerDocument})}catch{r=new IntersectionObserver(y,h)}r.observe(e)}return a(!0),i}function Xn(e,t,r,o){o===void 0&&(o={});const{ancestorScroll:n=!0,ancestorResize:i=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=o,s=gt(e),u=n||i?[...s?Ae(s):[],...Ae(t)]:[];u.forEach(b=>{n&&b.addEventListener("scroll",r,{passive:!0}),i&&b.addEventListener("resize",r)});const d=s&&l?Jn(s,r):null;let v=-1,f=null;a&&(f=new ResizeObserver(b=>{let[m]=b;m&&m.target===s&&f&&(f.unobserve(t),cancelAnimationFrame(v),v=requestAnimationFrame(()=>{var h;(h=f)==null||h.observe(t)})),r()}),s&&!c&&f.observe(s),f.observe(t));let g,x=c?X(e):null;c&&p();function p(){const b=X(e);x&&!Or(x,b)&&r(),x=b,g=requestAnimationFrame(p)}return r(),()=>{var b;u.forEach(m=>{n&&m.removeEventListener("scroll",r),i&&m.removeEventListener("resize",r)}),d?.(),(b=f)==null||b.disconnect(),f=null,c&&cancelAnimationFrame(g)}}const Yn=_n,Gn=wn,Zn=hn,Qn=(e,t,r)=>{const o=new Map,n={platform:Un,...r},i={...n.platform,_c:o};return mn(e,t,{...n,platform:i})};var xt=!1,wt=!1,Y=[],yt=-1;function ei(e){ti(e)}function ti(e){Y.includes(e)||Y.push(e),oi()}function ri(e){let t=Y.indexOf(e);t!==-1&&t>yt&&Y.splice(t,1)}function oi(){!wt&&!xt&&(xt=!0,queueMicrotask(ni))}function ni(){xt=!1,wt=!0;for(let e=0;ee.effect(t,{scheduler:r=>{kt?ei(r):r()}}),Tr=e.raw}function Rr(e){G=e}function li(e){let t=()=>{};return[o=>{let n=G(o);return e._x_effects||(e._x_effects=new Set,e._x_runEffects=()=>{e._x_effects.forEach(i=>i())}),e._x_effects.add(n),t=()=>{n!==void 0&&(e._x_effects.delete(n),pe(n))},n},()=>{t()}]}function Mr(e,t){let r=!0,o,n=G(()=>{let i=e();JSON.stringify(i),r?o=i:queueMicrotask(()=>{t(i,o),o=i}),r=!1});return()=>pe(n)}var Pr=[],Lr=[],$r=[];function ci(e){$r.push(e)}function _t(e,t){typeof t=="function"?(e._x_cleanups||(e._x_cleanups=[]),e._x_cleanups.push(t)):(t=e,Lr.push(t))}function zr(e){Pr.push(e)}function Ir(e,t,r){e._x_attributeCleanups||(e._x_attributeCleanups={}),e._x_attributeCleanups[t]||(e._x_attributeCleanups[t]=[]),e._x_attributeCleanups[t].push(r)}function jr(e,t){e._x_attributeCleanups&&Object.entries(e._x_attributeCleanups).forEach(([r,o])=>{(t===void 0||t.includes(r))&&(o.forEach(n=>n()),delete e._x_attributeCleanups[r])})}function si(e){for(e._x_effects?.forEach(ri);e._x_cleanups?.length;)e._x_cleanups.pop()()}var Et=new MutationObserver(Ot),St=!1;function At(){Et.observe(document,{subtree:!0,childList:!0,attributes:!0,attributeOldValue:!0}),St=!0}function Fr(){ui(),Et.disconnect(),St=!1}var Ce=[];function ui(){let e=Et.takeRecords();Ce.push(()=>e.length>0&&Ot(e));let t=Ce.length;queueMicrotask(()=>{if(Ce.length===t)for(;Ce.length>0;)Ce.shift()()})}function _(e){if(!St)return e();Fr();let t=e();return At(),t}var Ct=!1,Ve=[];function di(){Ct=!0}function fi(){Ct=!1,Ot(Ve),Ve=[]}function Ot(e){if(Ct){Ve=Ve.concat(e);return}let t=[],r=new Set,o=new Map,n=new Map;for(let i=0;i{a.nodeType===1&&a._x_marker&&r.add(a)}),e[i].addedNodes.forEach(a=>{if(a.nodeType===1){if(r.has(a)){r.delete(a);return}a._x_marker||t.push(a)}})),e[i].type==="attributes")){let a=e[i].target,l=e[i].attributeName,c=e[i].oldValue,s=()=>{o.has(a)||o.set(a,[]),o.get(a).push({name:l,value:a.getAttribute(l)})},u=()=>{n.has(a)||n.set(a,[]),n.get(a).push(l)};a.hasAttribute(l)&&c===null?s():a.hasAttribute(l)?(u(),s()):u()}n.forEach((i,a)=>{jr(a,i)}),o.forEach((i,a)=>{Pr.forEach(l=>l(a,i))});for(let i of r)t.some(a=>a.contains(i))||Lr.forEach(a=>a(i));for(let i of t)i.isConnected&&$r.forEach(a=>a(i));t=null,r=null,o=null,n=null}function Nr(e){return Q(Z(e))}function Oe(e,t,r){return e._x_dataStack=[t,...Z(r||e)],()=>{e._x_dataStack=e._x_dataStack.filter(o=>o!==t)}}function Z(e){return e._x_dataStack?e._x_dataStack:typeof ShadowRoot=="function"&&e instanceof ShadowRoot?Z(e.host):e.parentNode?Z(e.parentNode):[]}function Q(e){return new Proxy({objects:e},vi)}var vi={ownKeys({objects:e}){return Array.from(new Set(e.flatMap(t=>Object.keys(t))))},has({objects:e},t){return t==Symbol.unscopables?!1:e.some(r=>Object.prototype.hasOwnProperty.call(r,t)||Reflect.has(r,t))},get({objects:e},t,r){return t=="toJSON"?pi:Reflect.get(e.find(o=>Reflect.has(o,t))||{},t,r)},set({objects:e},t,r,o){const n=e.find(a=>Object.prototype.hasOwnProperty.call(a,t))||e[e.length-1],i=Object.getOwnPropertyDescriptor(n,t);return i?.set&&i?.get?i.set.call(o,r)||!0:Reflect.set(n,t,r)}};function pi(){return Reflect.ownKeys(this).reduce((t,r)=>(t[r]=Reflect.get(this,r),t),{})}function Tt(e){let t=o=>typeof o=="object"&&!Array.isArray(o)&&o!==null,r=(o,n="")=>{Object.entries(Object.getOwnPropertyDescriptors(o)).forEach(([i,{value:a,enumerable:l}])=>{if(l===!1||a===void 0||typeof a=="object"&&a!==null&&a.__v_skip)return;let c=n===""?i:`${n}.${i}`;typeof a=="object"&&a!==null&&a._x_interceptor?o[i]=a.initialize(e,c,i):t(a)&&a!==o&&!(a instanceof Element)&&r(a,c)})};return r(e)}function Dr(e,t=()=>{}){let r={initialValue:void 0,_x_interceptor:!0,initialize(o,n,i){return e(this.initialValue,()=>bi(o,n),a=>Rt(o,n,a),n,i)}};return t(r),o=>{if(typeof o=="object"&&o!==null&&o._x_interceptor){let n=r.initialize.bind(r);r.initialize=(i,a,l)=>{let c=o.initialize(i,a,l);return r.initialValue=c,n(i,a,l)}}else r.initialValue=o;return r}}function bi(e,t){return t.split(".").reduce((r,o)=>r[o],e)}function Rt(e,t,r){if(typeof t=="string"&&(t=t.split(".")),t.length===1)e[t[0]]=r;else{if(t.length===0)throw error;return e[t[0]]||(e[t[0]]={}),Rt(e[t[0]],t.slice(1),r)}}var Br={};function $(e,t){Br[e]=t}function Te(e,t){let r=mi(t);return Object.entries(Br).forEach(([o,n])=>{Object.defineProperty(e,`$${o}`,{get(){return n(t,r)},enumerable:!1})}),e}function mi(e){let[t,r]=Xr(e),o={interceptor:Dr,...t};return _t(e,r),o}function gi(e,t,r,...o){try{return r(...o)}catch(n){Re(n,e,t)}}function Re(...e){return Hr(...e)}var Hr=xi;function hi(e){Hr=e}function xi(e,t,r=void 0){e=Object.assign(e??{message:"No error message given."},{el:t,expression:r}),console.warn(`Alpine Expression Error: ${e.message} ${r?'Expression: "'+r+`" -`:""}`,t),setTimeout(()=>{throw e},0)}var be=!0;function Hr(e){let t=be;be=!1;let r=e();return be=t,r}function ee(e,t,r={}){let o;return A(e,t)(n=>o=n,r),o}function A(...e){return Wr(...e)}var Wr=Vr;function xi(e){Wr=e}var Kr;function wi(e){Kr=e}function Vr(e,t){let r={};Te(r,e);let o=[r,...Z(e)],n=typeof t=="function"?yi(o,t):_i(o,t,e);return mi.bind(null,e,t,n)}function yi(e,t){return(r=()=>{},{scope:o={},params:n=[],context:i}={})=>{if(!be){Me(r,t,Q([o,...e]),n);return}let a=t.apply(Q([o,...e]),n);Me(r,a)}}var Mt={};function ki(e,t){if(Mt[e])return Mt[e];let r=Object.getPrototypeOf(async function(){}).constructor,o=/^[\n\s]*if.*\(.*\)/.test(e.trim())||/^(let|const)\s/.test(e.trim())?`(async()=>{ ${e} })()`:e,i=(()=>{try{let a=new r(["__self","scope"],`with (scope) { __self.result = ${o} }; __self.finished = true; return __self.result;`);return Object.defineProperty(a,"name",{value:`[Alpine] ${e}`}),a}catch(a){return Re(a,t,e),Promise.resolve()}})();return Mt[e]=i,i}function _i(e,t,r){let o=ki(t,r);return(n=()=>{},{scope:i={},params:a=[],context:l}={})=>{o.result=void 0,o.finished=!1;let c=Q([i,...e]);if(typeof o=="function"){let s=o.call(l,o,c).catch(u=>Re(u,r,t));o.finished?(Me(n,o.result,c,a,r),o.result=void 0):s.then(u=>{Me(n,u,c,a,r)}).catch(u=>Re(u,r,t)).finally(()=>o.result=void 0)}}}function Me(e,t,r,o,n){if(be&&typeof t=="function"){let i=t.apply(r,o);i instanceof Promise?i.then(a=>Me(e,a,r,o)).catch(a=>Re(a,n,t)):e(i)}else typeof t=="object"&&t instanceof Promise?t.then(i=>e(i)):e(t)}function Ei(...e){return Kr(...e)}function Si(e,t,r={}){let o={};Te(o,e);let n=[o,...Z(e)],i=Q([r.scope??{},...n]),a=r.params??[];if(t.includes("await")){let l=Object.getPrototypeOf(async function(){}).constructor,c=/^[\n\s]*if.*\(.*\)/.test(t.trim())||/^(let|const)\s/.test(t.trim())?`(async()=>{ ${t} })()`:t;return new l(["scope"],`with (scope) { let __result = ${c}; return __result }`).call(r.context,i)}else{let l=/^[\n\s]*if.*\(.*\)/.test(t.trim())||/^(let|const)\s/.test(t.trim())?`(()=>{ ${t} })()`:t,s=new Function(["scope"],`with (scope) { let __result = ${l}; return __result }`).call(r.context,i);return typeof s=="function"&&be?s.apply(i,a):s}}var Pt="x-";function me(e=""){return Pt+e}function Ai(e){Pt=e}var qe={};function E(e,t){return qe[e]=t,{before(r){if(!qe[r]){console.warn(String.raw`Cannot find directive \`${r}\`. \`${e}\` will use the default order of execution`);return}const o=te.indexOf(r);te.splice(o>=0?o:te.indexOf("DEFAULT"),0,e)}}}function Ci(e){return Object.keys(qe).includes(e)}function Lt(e,t,r){if(t=Array.from(t),e._x_virtualDirectives){let i=Object.entries(e._x_virtualDirectives).map(([l,c])=>({name:l,value:c})),a=qr(i);i=i.map(l=>a.find(c=>c.name===l.name)?{name:`x-bind:${l.name}`,value:`"${l.value}"`}:l),t=t.concat(i)}let o={};return t.map(Gr((i,a)=>o[i]=a)).filter(Qr).map(Ri(o,r)).sort(Mi).map(i=>Ti(e,i))}function qr(e){return Array.from(e).map(Gr()).filter(t=>!Qr(t))}var $t=!1,Pe=new Map,Ur=Symbol();function Oi(e){$t=!0;let t=Symbol();Ur=t,Pe.set(t,[]);let r=()=>{for(;Pe.get(t).length;)Pe.get(t).shift()();Pe.delete(t)},o=()=>{$t=!1,r()};e(r),o()}function Jr(e){let t=[],r=l=>t.push(l),[o,n]=ai(e);return t.push(n),[{Alpine:he,effect:o,cleanup:r,evaluateLater:A.bind(A,e),evaluate:ee.bind(ee,e)},()=>t.forEach(l=>l())]}function Ti(e,t){let r=()=>{},o=qe[t.type]||r,[n,i]=Jr(e);zr(e,t.original,i);let a=()=>{e._x_ignore||e._x_ignoreSelf||(o.inline&&o.inline(e,t,n),o=o.bind(o,e,t,n),$t?Pe.get(Ur).push(o):o())};return a.runCleanups=i,a}var Xr=(e,t)=>({name:r,value:o})=>(r.startsWith(e)&&(r=r.replace(e,t)),{name:r,value:o}),Yr=e=>e;function Gr(e=()=>{}){return({name:t,value:r})=>{let{name:o,value:n}=Zr.reduce((i,a)=>a(i),{name:t,value:r});return o!==t&&e(o,t),{name:o,value:n}}}var Zr=[];function zt(e){Zr.push(e)}function Qr({name:e}){return eo().test(e)}var eo=()=>new RegExp(`^${Pt}([^:^.]+)\\b`);function Ri(e,t){return({name:r,value:o})=>{let n=r.match(eo()),i=r.match(/:([a-zA-Z0-9\-_:]+)/),a=r.match(/\.[^.\]]+(?=[^\]]*$)/g)||[],l=t||e[r]||r;return{type:n?n[1]:null,value:i?i[1]:null,modifiers:a.map(c=>c.replace(".","")),expression:o,original:l}}}var It="DEFAULT",te=["ignore","ref","data","id","anchor","bind","init","for","model","modelable","transition","show","if",It,"teleport"];function Mi(e,t){let r=te.indexOf(e.type)===-1?It:e.type,o=te.indexOf(t.type)===-1?It:t.type;return te.indexOf(r)-te.indexOf(o)}function Le(e,t,r={}){e.dispatchEvent(new CustomEvent(t,{detail:r,bubbles:!0,composed:!0,cancelable:!0}))}function re(e,t){if(typeof ShadowRoot=="function"&&e instanceof ShadowRoot){Array.from(e.children).forEach(n=>re(n,t));return}let r=!1;if(t(e,()=>r=!0),r)return;let o=e.firstElementChild;for(;o;)re(o,t),o=o.nextElementSibling}function M(e,...t){console.warn(`Alpine Warning: ${e}`,...t)}var to=!1;function Pi(){to&&M("Alpine has already been initialized on this page. Calling Alpine.start() more than once can cause problems."),to=!0,document.body||M("Unable to initialize. Trying to load Alpine before `` is available. Did you forget to add `defer` in Alpine's `