diff --git a/assets/FileSaver.min-3396b7ab.js b/assets/FileSaver.min-9aa86d5c.js similarity index 97% rename from assets/FileSaver.min-3396b7ab.js rename to assets/FileSaver.min-9aa86d5c.js index 8e0217174b..1ac76c5222 100644 --- a/assets/FileSaver.min-3396b7ab.js +++ b/assets/FileSaver.min-9aa86d5c.js @@ -1 +1 @@ -import{aA as A,c as d}from"./index-56893647.js";function O(u,v){for(var l=0;lr[c]})}}}return Object.freeze(Object.defineProperty(u,Symbol.toStringTag,{value:"Module"}))}var E={exports:{}};(function(u,v){(function(l,r){r()})(d,function(){function l(e,t){return typeof t>"u"?t={autoBom:!1}:typeof t!="object"&&(t={autoBom:!t}),t.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob(["\uFEFF",e],{type:e.type}):e}function r(e,t,i){var o=new XMLHttpRequest;o.open("GET",e),o.responseType="blob",o.onload=function(){p(o.response,t,i)},o.onerror=function(){},o.send()}function c(e){var t=new XMLHttpRequest;t.open("HEAD",e,!1);try{t.send()}catch{}return 200<=t.status&&299>=t.status}function s(e){try{e.dispatchEvent(new MouseEvent("click"))}catch{var t=document.createEvent("MouseEvents");t.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),e.dispatchEvent(t)}}var a=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof d=="object"&&d.global===d?d:void 0,y=a.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),p=a.saveAs||(typeof window!="object"||window!==a?function(){}:"download"in HTMLAnchorElement.prototype&&!y?function(e,t,i){var o=a.URL||a.webkitURL,n=document.createElement("a");t=t||e.name||"download",n.download=t,n.rel="noopener",typeof e=="string"?(n.href=e,n.origin===location.origin?s(n):c(n.href)?r(e,t,i):s(n,n.target="_blank")):(n.href=o.createObjectURL(e),setTimeout(function(){o.revokeObjectURL(n.href)},4e4),setTimeout(function(){s(n)},0))}:"msSaveOrOpenBlob"in navigator?function(e,t,i){if(t=t||e.name||"download",typeof e!="string")navigator.msSaveOrOpenBlob(l(e,i),t);else if(c(e))r(e,t,i);else{var o=document.createElement("a");o.href=e,o.target="_blank",setTimeout(function(){s(o)})}}:function(e,t,i,o){if(o=o||open("","_blank"),o&&(o.document.title=o.document.body.innerText="downloading..."),typeof e=="string")return r(e,t,i);var n=e.type==="application/octet-stream",g=/constructor/i.test(a.HTMLElement)||a.safari,b=/CriOS\/[\d]+/.test(navigator.userAgent);if((b||n&&g||y)&&typeof FileReader<"u"){var m=new FileReader;m.onloadend=function(){var f=m.result;f=b?f:f.replace(/^data:[^;]*;/,"data:attachment/file;"),o?o.location.href=f:location=f,o=null},m.readAsDataURL(e)}else{var j=a.URL||a.webkitURL,w=j.createObjectURL(e);o?o.location=w:location.href=w,o=null,setTimeout(function(){j.revokeObjectURL(w)},4e4)}});a.saveAs=p.saveAs=p,u.exports=p})})(E);var h=E.exports;const L=A(h),S=O({__proto__:null,default:L},[h]);export{S as F}; +import{aA as A,c as d}from"./index-e212e0e2.js";function O(u,v){for(var l=0;lr[c]})}}}return Object.freeze(Object.defineProperty(u,Symbol.toStringTag,{value:"Module"}))}var E={exports:{}};(function(u,v){(function(l,r){r()})(d,function(){function l(e,t){return typeof t>"u"?t={autoBom:!1}:typeof t!="object"&&(t={autoBom:!t}),t.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob(["\uFEFF",e],{type:e.type}):e}function r(e,t,i){var o=new XMLHttpRequest;o.open("GET",e),o.responseType="blob",o.onload=function(){p(o.response,t,i)},o.onerror=function(){},o.send()}function c(e){var t=new XMLHttpRequest;t.open("HEAD",e,!1);try{t.send()}catch{}return 200<=t.status&&299>=t.status}function s(e){try{e.dispatchEvent(new MouseEvent("click"))}catch{var t=document.createEvent("MouseEvents");t.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),e.dispatchEvent(t)}}var a=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof d=="object"&&d.global===d?d:void 0,y=a.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),p=a.saveAs||(typeof window!="object"||window!==a?function(){}:"download"in HTMLAnchorElement.prototype&&!y?function(e,t,i){var o=a.URL||a.webkitURL,n=document.createElement("a");t=t||e.name||"download",n.download=t,n.rel="noopener",typeof e=="string"?(n.href=e,n.origin===location.origin?s(n):c(n.href)?r(e,t,i):s(n,n.target="_blank")):(n.href=o.createObjectURL(e),setTimeout(function(){o.revokeObjectURL(n.href)},4e4),setTimeout(function(){s(n)},0))}:"msSaveOrOpenBlob"in navigator?function(e,t,i){if(t=t||e.name||"download",typeof e!="string")navigator.msSaveOrOpenBlob(l(e,i),t);else if(c(e))r(e,t,i);else{var o=document.createElement("a");o.href=e,o.target="_blank",setTimeout(function(){s(o)})}}:function(e,t,i,o){if(o=o||open("","_blank"),o&&(o.document.title=o.document.body.innerText="downloading..."),typeof e=="string")return r(e,t,i);var n=e.type==="application/octet-stream",g=/constructor/i.test(a.HTMLElement)||a.safari,b=/CriOS\/[\d]+/.test(navigator.userAgent);if((b||n&&g||y)&&typeof FileReader<"u"){var m=new FileReader;m.onloadend=function(){var f=m.result;f=b?f:f.replace(/^data:[^;]*;/,"data:attachment/file;"),o?o.location.href=f:location=f,o=null},m.readAsDataURL(e)}else{var j=a.URL||a.webkitURL,w=j.createObjectURL(e);o?o.location=w:location.href=w,o=null,setTimeout(function(){j.revokeObjectURL(w)},4e4)}});a.saveAs=p.saveAs=p,u.exports=p})})(E);var h=E.exports;const L=A(h),S=O({__proto__:null,default:L},[h]);export{S as F}; diff --git a/assets/dexie-export-import-411ac6c5.js b/assets/dexie-export-import-55a94771.js similarity index 99% rename from assets/dexie-export-import-411ac6c5.js rename to assets/dexie-export-import-55a94771.js index 8ebf6fc380..2836b89c95 100644 --- a/assets/dexie-export-import-411ac6c5.js +++ b/assets/dexie-export-import-55a94771.js @@ -1,4 +1,4 @@ -import{aB as Ce}from"./index-56893647.js";/*! ***************************************************************************** +import{aB as Ce}from"./index-e212e0e2.js";/*! ***************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any diff --git a/assets/index-5b84a5fb.js b/assets/index-c06d32d3.js similarity index 99% rename from assets/index-5b84a5fb.js rename to assets/index-c06d32d3.js index 3e47245101..44326c0a57 100644 --- a/assets/index-5b84a5fb.js +++ b/assets/index-c06d32d3.js @@ -1,4 +1,4 @@ -import{r as c,m as Ht,n as Bt,D as zt,M as vo,o as Ao,I as Wt,p as K,H as Zt,s as Ut,y as Yt,T as bo,v as Co,$ as y,w as wo,x as So,z as Ro,R as $o,X as qt,A as yo,B as xo,C as Io,E as Q,O as wt,G as fe,N as St,J as Eo,K as Rt,P as Po,Q as Fo,S as G,_ as I,a as h,d as it,U as $t,j as R,V as M,W as Jt,Y as Ie,Z as Mo,a0 as To,a1 as we,e as lt,F as st,a2 as Kt,a3 as Xt,a4 as Go,a5 as Qt,a6 as ut,a7 as en,a8 as Vo,a9 as ko,aa as Do,h as ct,k as tn,ab as No,ac as nn,ad as _o,ae as de,af as X,ag as dt,ah as oe,ai as qe,aj as k,ak as se,al as Fe,u as yt,am as Oo,an as Lo,ao as gt,ap as jo,aq as Ho,ar as Bo,as as zo,at as Wo,au as Zo,av as on,aw as Uo,ax as Yo,ay as qo,f as Jo,L as Ko,t as Xo,az as Qo,l as er}from"./index-56893647.js";function tr({container:e,accept:t,walk:n,enabled:o=!0}){let r=c.useRef(t),a=c.useRef(n);c.useEffect(()=>{r.current=t,a.current=n},[t,n]),Ht(()=>{if(!e||!o)return;let i=Bt(e);if(!i)return;let l=r.current,s=a.current,d=Object.assign(f=>l(f),{acceptNode:l}),u=i.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,d,!1);for(;u.nextNode();)s(u.currentNode)},[e,o,r,a])}var nr=(e=>(e[e.RegisterOption=0]="RegisterOption",e[e.UnregisterOption=1]="UnregisterOption",e))(nr||{});let or={[0](e,t){let n=[...e.options,{id:t.id,element:t.element,propsRef:t.propsRef}];return{...e,options:Po(n,o=>o.element.current)}},[1](e,t){let n=e.options.slice(),o=e.options.findIndex(r=>r.id===t.id);return o===-1?e:(n.splice(o,1),{...e,options:n})}},ft=c.createContext(null);ft.displayName="RadioGroupDataContext";function rn(e){let t=c.useContext(ft);if(t===null){let n=new Error(`<${e} /> is missing a parent component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,rn),n}return t}let pt=c.createContext(null);pt.displayName="RadioGroupActionsContext";function an(e){let t=c.useContext(pt);if(t===null){let n=new Error(`<${e} /> is missing a parent component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,an),n}return t}function rr(e,t){return Io(t.type,or,e,t)}let ar="div";function ir(e,t){let n=Wt(),{id:o=`headlessui-radiogroup-${n}`,value:r,defaultValue:a,form:i,name:l,onChange:s,by:d=(E,O)=>E===O,disabled:u=!1,...f}=e,m=K(typeof d=="string"?(E,O)=>{let D=d;return(E==null?void 0:E[D])===(O==null?void 0:O[D])}:d),[p,v]=c.useReducer(rr,{options:[]}),g=p.options,[A,b]=Zt(),[C,S]=Ut(),w=c.useRef(null),x=Yt(w,t),[F,P]=bo(r,s,a),T=c.useMemo(()=>g.find(E=>!E.propsRef.current.disabled),[g]),N=c.useMemo(()=>g.some(E=>m(E.propsRef.current.value,F)),[g,F]),_=K(E=>{var O;if(u||m(E,F))return!1;let D=(O=g.find(J=>m(J.propsRef.current.value,E)))==null?void 0:O.propsRef.current;return D!=null&&D.disabled?!1:(P==null||P(E),!0)});tr({container:w.current,accept(E){return E.getAttribute("role")==="radio"?NodeFilter.FILTER_REJECT:E.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT},walk(E){E.setAttribute("role","none")}});let re=K(E=>{let O=w.current;if(!O)return;let D=Bt(O),J=g.filter(V=>V.propsRef.current.disabled===!1).map(V=>V.element.current);switch(E.key){case Q.Enter:Eo(E.currentTarget);break;case Q.ArrowLeft:case Q.ArrowUp:if(E.preventDefault(),E.stopPropagation(),wt(J,fe.Previous|fe.WrapAround)===St.Success){let V=g.find(ie=>ie.element.current===(D==null?void 0:D.activeElement));V&&_(V.propsRef.current.value)}break;case Q.ArrowRight:case Q.ArrowDown:if(E.preventDefault(),E.stopPropagation(),wt(J,fe.Next|fe.WrapAround)===St.Success){let V=g.find(ie=>ie.element.current===(D==null?void 0:D.activeElement));V&&_(V.propsRef.current.value)}break;case Q.Space:{E.preventDefault(),E.stopPropagation();let V=g.find(ie=>ie.element.current===(D==null?void 0:D.activeElement));V&&_(V.propsRef.current.value)}break}}),B=K(E=>(v({type:0,...E}),()=>v({type:1,id:E.id}))),ae=c.useMemo(()=>({value:F,firstOption:T,containsCheckedOption:N,disabled:u,compare:m,...p}),[F,T,N,u,m,p]),Ve=c.useMemo(()=>({registerOption:B,change:_}),[B,_]),W={ref:x,id:o,role:"radiogroup","aria-labelledby":A,"aria-describedby":C,onKeyDown:re},ho=c.useMemo(()=>({value:F}),[F]),ge=c.useRef(null),mo=Co();return c.useEffect(()=>{ge.current&&a!==void 0&&mo.addEventListener(ge.current,"reset",()=>{_(a)})},[ge,_]),y.createElement(S,{name:"RadioGroup.Description"},y.createElement(b,{name:"RadioGroup.Label"},y.createElement(pt.Provider,{value:Ve},y.createElement(ft.Provider,{value:ae},l!=null&&F!=null&&wo({[l]:F}).map(([E,O],D)=>y.createElement(So,{features:Ro.Hidden,ref:D===0?J=>{var V;ge.current=(V=J==null?void 0:J.closest("form"))!=null?V:null}:void 0,...$o({key:E,as:"input",type:"radio",checked:O!=null,hidden:!0,readOnly:!0,form:i,name:E,value:O})})),qt({ourProps:W,theirProps:f,slot:ho,defaultTag:ar,name:"RadioGroup"})))))}var lr=(e=>(e[e.Empty=1]="Empty",e[e.Active=2]="Active",e))(lr||{});let sr="div";function ur(e,t){var n;let o=Wt(),{id:r=`headlessui-radiogroup-option-${o}`,value:a,disabled:i=!1,...l}=e,s=c.useRef(null),d=Yt(s,t),[u,f]=Zt(),[m,p]=Ut(),{addFlag:v,removeFlag:g,hasFlag:A}=yo(1),b=xo({value:a,disabled:i}),C=rn("RadioGroup.Option"),S=an("RadioGroup.Option");Ht(()=>S.registerOption({id:r,element:s,propsRef:b}),[r,S,s,e]);let w=K(B=>{var ae;if(Rt(B.currentTarget))return B.preventDefault();S.change(a)&&(v(2),(ae=s.current)==null||ae.focus())}),x=K(B=>{if(Rt(B.currentTarget))return B.preventDefault();v(2)}),F=K(()=>g(2)),P=((n=C.firstOption)==null?void 0:n.id)===r,T=C.disabled||i,N=C.compare(C.value,a),_={ref:d,id:r,role:"radio","aria-checked":N?"true":"false","aria-labelledby":u,"aria-describedby":m,"aria-disabled":T?!0:void 0,tabIndex:(()=>T?-1:N||!C.containsCheckedOption&&P?0:-1)(),onClick:T?void 0:w,onFocus:T?void 0:x,onBlur:T?void 0:F},re=c.useMemo(()=>({checked:N,disabled:T,active:A(2)}),[N,T,A]);return y.createElement(p,{name:"RadioGroup.Description"},y.createElement(f,{name:"RadioGroup.Label"},qt({ourProps:_,theirProps:l,slot:re,defaultTag:sr,name:"RadioGroup.Option"})))}let cr=zt(ir),dr=zt(ur),Ee=Object.assign(cr,{Option:dr,Label:vo,Description:Ao});const gr=c.forwardRef((e,t)=>{var n;const{container:o=globalThis==null||(n=globalThis.document)===null||n===void 0?void 0:n.body,...r}=e;return o?Fo.createPortal(c.createElement(G.div,I({},r,{ref:t})),o):null});var fr=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},ee=new WeakMap,pe=new WeakMap,he={},ke=0,ln=function(e){return e&&(e.host||ln(e.parentNode))},pr=function(e,t){return t.map(function(n){if(e.contains(n))return n;var o=ln(n);return o&&e.contains(o)?o:null}).filter(function(n){return!!n})},hr=function(e,t,n,o){var r=pr(t,Array.isArray(e)?e:[e]);he[n]||(he[n]=new WeakMap);var a=he[n],i=[],l=new Set,s=new Set(r),d=function(f){!f||l.has(f)||(l.add(f),d(f.parentNode))};r.forEach(d);var u=function(f){!f||s.has(f)||Array.prototype.forEach.call(f.children,function(m){if(l.has(m))u(m);else{var p=m.getAttribute(o),v=p!==null&&p!=="false",g=(ee.get(m)||0)+1,A=(a.get(m)||0)+1;ee.set(m,g),a.set(m,A),i.push(m),g===1&&v&&pe.set(m,!0),A===1&&m.setAttribute(n,"true"),v||m.setAttribute(o,"true")}})};return u(t),l.clear(),ke++,function(){i.forEach(function(f){var m=ee.get(f)-1,p=a.get(f)-1;ee.set(f,m),a.set(f,p),m||(pe.has(f)||f.removeAttribute(o),pe.delete(f)),p||f.removeAttribute(n)}),ke--,ke||(ee=new WeakMap,ee=new WeakMap,pe=new WeakMap,he={})}},mr=function(e,t,n){n===void 0&&(n="data-aria-hidden");var o=Array.from(Array.isArray(e)?e:[e]),r=t||fr(e);return r?(o.push.apply(o,Array.from(r.querySelectorAll("[aria-live]"))),hr(o,r,n,"aria-hidden")):function(){return null}};globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};function vr({tagList:e,currentTag:t,onChangeCurrentTag:n}){const o=c.useCallback(r=>{n(r)},[n]);return h(Ee,{value:t,onChange:o,children:h("div",{className:"flex items-center space-x-4",children:e.map(r=>h(Ee.Option,{value:r,className:({checked:a})=>`cursor-pointer whitespace-nowrap rounded-[3rem] px-4 py-2 ${a?"bg-indigo-400 text-white":"bg-white text-gray-600 dark:bg-gray-800 dark:text-gray-200"} ${!a&&"hover:bg-indigo-100 dark:hover:bg-gray-600"}`,children:h("p",{className:"font-normal ",children:r})},r))})})}globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};function Ar(e,t,n){const[o,r]=c.useState(null);return c.useEffect(()=>{n&&!o&&(async()=>{const i=await br(t,e);r(i)})()},[t,e,n]),o}async function br(e,t){const n=await it.chapterRecords.where({dict:e,chapter:t}).toArray(),o=n.length,r=n.reduce((s,{wordNumber:d,correctWordIndexes:u})=>s+(d-u.length),0),a=o>0?$t(r/o,2):0,i=n.reduce((s,{wrongCount:d})=>s+(d??0),0),l=o>0?$t(i/o,2):0;return{exerciseCount:o,avgWrongWordCount:a,avgWrongInputCount:l}}globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};function sn(e,{threshold:t=0,root:n=null,rootMargin:o="0%",freezeOnceVisible:r=!1}){const[a,i]=c.useState(),l=(a==null?void 0:a.isIntersecting)&&r,s=([d])=>{i(d)};return c.useEffect(()=>{const d=e==null?void 0:e.current;if(!!!window.IntersectionObserver||l||!d)return;const f={threshold:t,root:n,rootMargin:o},m=new IntersectionObserver(s,f);return m.observe(d),()=>m.disconnect()},[e==null?void 0:e.current,JSON.stringify(t),n,o,l]),a}const Cr=e=>h("svg",{viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...e,children:h("path",{fill:"currentColor",fillRule:"evenodd",d:"M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75s-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12Zm13.36-1.814a.75.75 0 1 0-1.22-.872l-3.236 4.53L9.53 12.22a.75.75 0 0 0-1.06 1.06l2.25 2.25a.75.75 0 0 0 1.14-.094l3.75-5.25Z",clipRule:"evenodd"})}),wr=Cr;globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};function Sr({index:e,checked:t,dictID:n,onChange:o}){const r=c.useRef(null),a=sn(r,{}),i=!!(a!=null&&a.isIntersecting),l=Ar(e,n,i);return c.useEffect(()=>{var s,d;if(t&&r.current!==null){const u=r.current,f=(d=(s=u.parentElement)==null?void 0:s.parentElement)==null?void 0:d.parentElement;f==null||f.scroll({top:u.offsetTop-f.offsetTop-300,behavior:"smooth"})}},[t]),R("div",{ref:r,className:"relative flex h-16 w-40 cursor-pointer flex-col items-start justify-center overflow-hidden rounded-xl bg-slate-100 px-3 py-2 dark:bg-slate-800",onClick:()=>o(e),children:[R("h1",{children:["第 ",e+1," 章"]}),h("p",{className:"pt-[2px] text-xs text-slate-600",children:l?l.exerciseCount>0?`练习 ${l.exerciseCount} 次`:"未练习":"加载中..."}),t&&h(wr,{className:"absolute -bottom-4 -right-4 h-18 w-18 text-6xl text-green-500 opacity-40 dark:text-green-300"})]})}globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};const Rr=Jt("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-white transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-slate-950 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 dark:ring-offset-slate-950 dark:focus-visible:ring-slate-300",{variants:{variant:{default:"bg-indigo-500 shadow text-white hover:opacity-90 dark:text-opacity-80 focus:outline-none rounded-lg",destructive:"bg-red-500 text-slate-50 hover:bg-red-500/90 dark:bg-red-900 dark:text-slate-50 dark:hover:bg-red-900/90",outline:"border border-slate-200 bg-white hover:bg-slate-100 hover:text-slate-900 dark:border-slate-800 dark:bg-slate-950 dark:hover:bg-slate-800 dark:hover:text-slate-50",secondary:"bg-slate-100 text-slate-900 hover:bg-slate-100/80 dark:bg-slate-800 dark:text-slate-50 dark:hover:bg-slate-800/80",ghost:"hover:bg-slate-100 hover:text-slate-900 dark:hover:bg-slate-800 dark:hover:text-slate-50",link:"text-slate-900 underline-offset-4 hover:underline dark:text-slate-50"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),ue=c.forwardRef(({className:e,variant:t,size:n,asChild:o=!1,...r},a)=>h(o?Ie:"button",{className:M(Rr({variant:t,size:n,className:e})),ref:a,...r}));ue.displayName="Button";const xt=e=>h("svg",{viewBox:"0 0 256 256",width:"1.2em",height:"1.2em",...e,children:h("path",{fill:"currentColor",d:"M119.39 172.94a8 8 0 0 1-1.73 8.72l-32 32a8 8 0 0 1-11.32 0l-32-32A8 8 0 0 1 48 168h24V48a8 8 0 0 1 16 0v120h24a8 8 0 0 1 7.39 4.94Zm94.27-98.6l-32-32a8 8 0 0 0-11.32 0l-32 32A8 8 0 0 0 144 88h24v120a8 8 0 0 0 16 0V88h24a8 8 0 0 0 5.66-13.66Z"})});globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};const It=[{accessorKey:"word",size:100,header:({column:e})=>R(ue,{variant:"ghost",className:"p-0",onClick:()=>e.toggleSorting(e.getIsSorted()==="asc"),children:["单词",h(xt,{className:"ml-1.5 h-4 w-4"})]})},{accessorKey:"trans",size:500,header:"释义"},{accessorKey:"errorCount",size:40,header:({column:e})=>R(ue,{variant:"ghost",className:"p-0",onClick:()=>e.toggleSorting(e.getIsSorted()==="asc"),children:["错误次数",h(xt,{className:"ml-1.5 h-4 w-4"})]})},{accessorKey:"errorChar",header:"易错字母",size:80,cell:({row:e})=>h("p",{children:e.getValue("errorChar").map((t,n)=>h("kbd",{children:t+" "},`${t}-${n}`))})}];function $r(e){return e.map(t=>({word:t.word,trans:t.originData.trans.join(",")??"",errorCount:t.errorCount,errorChar:t.errorChar}))}globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};const un=c.forwardRef(({className:e,...t},n)=>h("div",{className:"relative h-full w-full overflow-auto",children:h("table",{ref:n,className:M("w-full caption-bottom text-sm",e),...t})}));un.displayName="Table";const cn=c.forwardRef(({className:e,...t},n)=>h("thead",{ref:n,className:M("[&_tr]:border-b",e),...t}));cn.displayName="TableHeader";const dn=c.forwardRef(({className:e,...t},n)=>h("tbody",{ref:n,className:M("[&_tr:last-child]:border-0",e),...t}));dn.displayName="TableBody";const yr=c.forwardRef(({className:e,...t},n)=>h("tfoot",{ref:n,className:M("border-t bg-slate-100/50 font-medium dark:bg-slate-800/50 [&>tr]:last:border-b-0",e),...t}));yr.displayName="TableFooter";const Se=c.forwardRef(({className:e,...t},n)=>h("tr",{ref:n,className:M("border-b transition-colors hover:bg-slate-100/50 data-[state=selected]:bg-slate-100 dark:hover:bg-slate-800/50 dark:data-[state=selected]:bg-slate-800",e),...t}));Se.displayName="TableRow";const gn=c.forwardRef(({className:e,...t},n)=>h("th",{ref:n,className:M("h-12 px-4 text-left align-middle font-medium text-slate-500 dark:text-slate-400 [&:has([role=checkbox])]:pr-0",e),...t}));gn.displayName="TableHead";const Je=c.forwardRef(({className:e,...t},n)=>h("td",{ref:n,className:M("p-4 align-middle [&:has([role=checkbox])]:pr-0",e),...t}));Je.displayName="TableCell";const xr=c.forwardRef(({className:e,...t},n)=>h("caption",{ref:n,className:M("mt-4 text-sm text-slate-500 dark:text-slate-400",e),...t}));xr.displayName="TableCaption";/** +import{r as c,m as Ht,n as Bt,D as zt,M as vo,o as Ao,I as Wt,p as K,H as Zt,s as Ut,y as Yt,T as bo,v as Co,$ as y,w as wo,x as So,z as Ro,R as $o,X as qt,A as yo,B as xo,C as Io,E as Q,O as wt,G as fe,N as St,J as Eo,K as Rt,P as Po,Q as Fo,S as G,_ as I,a as h,d as it,U as $t,j as R,V as M,W as Jt,Y as Ie,Z as Mo,a0 as To,a1 as we,e as lt,F as st,a2 as Kt,a3 as Xt,a4 as Go,a5 as Qt,a6 as ut,a7 as en,a8 as Vo,a9 as ko,aa as Do,h as ct,k as tn,ab as No,ac as nn,ad as _o,ae as de,af as X,ag as dt,ah as oe,ai as qe,aj as k,ak as se,al as Fe,u as yt,am as Oo,an as Lo,ao as gt,ap as jo,aq as Ho,ar as Bo,as as zo,at as Wo,au as Zo,av as on,aw as Uo,ax as Yo,ay as qo,f as Jo,L as Ko,t as Xo,az as Qo,l as er}from"./index-e212e0e2.js";function tr({container:e,accept:t,walk:n,enabled:o=!0}){let r=c.useRef(t),a=c.useRef(n);c.useEffect(()=>{r.current=t,a.current=n},[t,n]),Ht(()=>{if(!e||!o)return;let i=Bt(e);if(!i)return;let l=r.current,s=a.current,d=Object.assign(f=>l(f),{acceptNode:l}),u=i.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,d,!1);for(;u.nextNode();)s(u.currentNode)},[e,o,r,a])}var nr=(e=>(e[e.RegisterOption=0]="RegisterOption",e[e.UnregisterOption=1]="UnregisterOption",e))(nr||{});let or={[0](e,t){let n=[...e.options,{id:t.id,element:t.element,propsRef:t.propsRef}];return{...e,options:Po(n,o=>o.element.current)}},[1](e,t){let n=e.options.slice(),o=e.options.findIndex(r=>r.id===t.id);return o===-1?e:(n.splice(o,1),{...e,options:n})}},ft=c.createContext(null);ft.displayName="RadioGroupDataContext";function rn(e){let t=c.useContext(ft);if(t===null){let n=new Error(`<${e} /> is missing a parent component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,rn),n}return t}let pt=c.createContext(null);pt.displayName="RadioGroupActionsContext";function an(e){let t=c.useContext(pt);if(t===null){let n=new Error(`<${e} /> is missing a parent component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,an),n}return t}function rr(e,t){return Io(t.type,or,e,t)}let ar="div";function ir(e,t){let n=Wt(),{id:o=`headlessui-radiogroup-${n}`,value:r,defaultValue:a,form:i,name:l,onChange:s,by:d=(E,O)=>E===O,disabled:u=!1,...f}=e,m=K(typeof d=="string"?(E,O)=>{let D=d;return(E==null?void 0:E[D])===(O==null?void 0:O[D])}:d),[p,v]=c.useReducer(rr,{options:[]}),g=p.options,[A,b]=Zt(),[C,S]=Ut(),w=c.useRef(null),x=Yt(w,t),[F,P]=bo(r,s,a),T=c.useMemo(()=>g.find(E=>!E.propsRef.current.disabled),[g]),N=c.useMemo(()=>g.some(E=>m(E.propsRef.current.value,F)),[g,F]),_=K(E=>{var O;if(u||m(E,F))return!1;let D=(O=g.find(J=>m(J.propsRef.current.value,E)))==null?void 0:O.propsRef.current;return D!=null&&D.disabled?!1:(P==null||P(E),!0)});tr({container:w.current,accept(E){return E.getAttribute("role")==="radio"?NodeFilter.FILTER_REJECT:E.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT},walk(E){E.setAttribute("role","none")}});let re=K(E=>{let O=w.current;if(!O)return;let D=Bt(O),J=g.filter(V=>V.propsRef.current.disabled===!1).map(V=>V.element.current);switch(E.key){case Q.Enter:Eo(E.currentTarget);break;case Q.ArrowLeft:case Q.ArrowUp:if(E.preventDefault(),E.stopPropagation(),wt(J,fe.Previous|fe.WrapAround)===St.Success){let V=g.find(ie=>ie.element.current===(D==null?void 0:D.activeElement));V&&_(V.propsRef.current.value)}break;case Q.ArrowRight:case Q.ArrowDown:if(E.preventDefault(),E.stopPropagation(),wt(J,fe.Next|fe.WrapAround)===St.Success){let V=g.find(ie=>ie.element.current===(D==null?void 0:D.activeElement));V&&_(V.propsRef.current.value)}break;case Q.Space:{E.preventDefault(),E.stopPropagation();let V=g.find(ie=>ie.element.current===(D==null?void 0:D.activeElement));V&&_(V.propsRef.current.value)}break}}),B=K(E=>(v({type:0,...E}),()=>v({type:1,id:E.id}))),ae=c.useMemo(()=>({value:F,firstOption:T,containsCheckedOption:N,disabled:u,compare:m,...p}),[F,T,N,u,m,p]),Ve=c.useMemo(()=>({registerOption:B,change:_}),[B,_]),W={ref:x,id:o,role:"radiogroup","aria-labelledby":A,"aria-describedby":C,onKeyDown:re},ho=c.useMemo(()=>({value:F}),[F]),ge=c.useRef(null),mo=Co();return c.useEffect(()=>{ge.current&&a!==void 0&&mo.addEventListener(ge.current,"reset",()=>{_(a)})},[ge,_]),y.createElement(S,{name:"RadioGroup.Description"},y.createElement(b,{name:"RadioGroup.Label"},y.createElement(pt.Provider,{value:Ve},y.createElement(ft.Provider,{value:ae},l!=null&&F!=null&&wo({[l]:F}).map(([E,O],D)=>y.createElement(So,{features:Ro.Hidden,ref:D===0?J=>{var V;ge.current=(V=J==null?void 0:J.closest("form"))!=null?V:null}:void 0,...$o({key:E,as:"input",type:"radio",checked:O!=null,hidden:!0,readOnly:!0,form:i,name:E,value:O})})),qt({ourProps:W,theirProps:f,slot:ho,defaultTag:ar,name:"RadioGroup"})))))}var lr=(e=>(e[e.Empty=1]="Empty",e[e.Active=2]="Active",e))(lr||{});let sr="div";function ur(e,t){var n;let o=Wt(),{id:r=`headlessui-radiogroup-option-${o}`,value:a,disabled:i=!1,...l}=e,s=c.useRef(null),d=Yt(s,t),[u,f]=Zt(),[m,p]=Ut(),{addFlag:v,removeFlag:g,hasFlag:A}=yo(1),b=xo({value:a,disabled:i}),C=rn("RadioGroup.Option"),S=an("RadioGroup.Option");Ht(()=>S.registerOption({id:r,element:s,propsRef:b}),[r,S,s,e]);let w=K(B=>{var ae;if(Rt(B.currentTarget))return B.preventDefault();S.change(a)&&(v(2),(ae=s.current)==null||ae.focus())}),x=K(B=>{if(Rt(B.currentTarget))return B.preventDefault();v(2)}),F=K(()=>g(2)),P=((n=C.firstOption)==null?void 0:n.id)===r,T=C.disabled||i,N=C.compare(C.value,a),_={ref:d,id:r,role:"radio","aria-checked":N?"true":"false","aria-labelledby":u,"aria-describedby":m,"aria-disabled":T?!0:void 0,tabIndex:(()=>T?-1:N||!C.containsCheckedOption&&P?0:-1)(),onClick:T?void 0:w,onFocus:T?void 0:x,onBlur:T?void 0:F},re=c.useMemo(()=>({checked:N,disabled:T,active:A(2)}),[N,T,A]);return y.createElement(p,{name:"RadioGroup.Description"},y.createElement(f,{name:"RadioGroup.Label"},qt({ourProps:_,theirProps:l,slot:re,defaultTag:sr,name:"RadioGroup.Option"})))}let cr=zt(ir),dr=zt(ur),Ee=Object.assign(cr,{Option:dr,Label:vo,Description:Ao});const gr=c.forwardRef((e,t)=>{var n;const{container:o=globalThis==null||(n=globalThis.document)===null||n===void 0?void 0:n.body,...r}=e;return o?Fo.createPortal(c.createElement(G.div,I({},r,{ref:t})),o):null});var fr=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},ee=new WeakMap,pe=new WeakMap,he={},ke=0,ln=function(e){return e&&(e.host||ln(e.parentNode))},pr=function(e,t){return t.map(function(n){if(e.contains(n))return n;var o=ln(n);return o&&e.contains(o)?o:null}).filter(function(n){return!!n})},hr=function(e,t,n,o){var r=pr(t,Array.isArray(e)?e:[e]);he[n]||(he[n]=new WeakMap);var a=he[n],i=[],l=new Set,s=new Set(r),d=function(f){!f||l.has(f)||(l.add(f),d(f.parentNode))};r.forEach(d);var u=function(f){!f||s.has(f)||Array.prototype.forEach.call(f.children,function(m){if(l.has(m))u(m);else{var p=m.getAttribute(o),v=p!==null&&p!=="false",g=(ee.get(m)||0)+1,A=(a.get(m)||0)+1;ee.set(m,g),a.set(m,A),i.push(m),g===1&&v&&pe.set(m,!0),A===1&&m.setAttribute(n,"true"),v||m.setAttribute(o,"true")}})};return u(t),l.clear(),ke++,function(){i.forEach(function(f){var m=ee.get(f)-1,p=a.get(f)-1;ee.set(f,m),a.set(f,p),m||(pe.has(f)||f.removeAttribute(o),pe.delete(f)),p||f.removeAttribute(n)}),ke--,ke||(ee=new WeakMap,ee=new WeakMap,pe=new WeakMap,he={})}},mr=function(e,t,n){n===void 0&&(n="data-aria-hidden");var o=Array.from(Array.isArray(e)?e:[e]),r=t||fr(e);return r?(o.push.apply(o,Array.from(r.querySelectorAll("[aria-live]"))),hr(o,r,n,"aria-hidden")):function(){return null}};globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};function vr({tagList:e,currentTag:t,onChangeCurrentTag:n}){const o=c.useCallback(r=>{n(r)},[n]);return h(Ee,{value:t,onChange:o,children:h("div",{className:"flex items-center space-x-4",children:e.map(r=>h(Ee.Option,{value:r,className:({checked:a})=>`cursor-pointer whitespace-nowrap rounded-[3rem] px-4 py-2 ${a?"bg-indigo-400 text-white":"bg-white text-gray-600 dark:bg-gray-800 dark:text-gray-200"} ${!a&&"hover:bg-indigo-100 dark:hover:bg-gray-600"}`,children:h("p",{className:"font-normal ",children:r})},r))})})}globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};function Ar(e,t,n){const[o,r]=c.useState(null);return c.useEffect(()=>{n&&!o&&(async()=>{const i=await br(t,e);r(i)})()},[t,e,n]),o}async function br(e,t){const n=await it.chapterRecords.where({dict:e,chapter:t}).toArray(),o=n.length,r=n.reduce((s,{wordNumber:d,correctWordIndexes:u})=>s+(d-u.length),0),a=o>0?$t(r/o,2):0,i=n.reduce((s,{wrongCount:d})=>s+(d??0),0),l=o>0?$t(i/o,2):0;return{exerciseCount:o,avgWrongWordCount:a,avgWrongInputCount:l}}globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};function sn(e,{threshold:t=0,root:n=null,rootMargin:o="0%",freezeOnceVisible:r=!1}){const[a,i]=c.useState(),l=(a==null?void 0:a.isIntersecting)&&r,s=([d])=>{i(d)};return c.useEffect(()=>{const d=e==null?void 0:e.current;if(!!!window.IntersectionObserver||l||!d)return;const f={threshold:t,root:n,rootMargin:o},m=new IntersectionObserver(s,f);return m.observe(d),()=>m.disconnect()},[e==null?void 0:e.current,JSON.stringify(t),n,o,l]),a}const Cr=e=>h("svg",{viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...e,children:h("path",{fill:"currentColor",fillRule:"evenodd",d:"M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75s-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12Zm13.36-1.814a.75.75 0 1 0-1.22-.872l-3.236 4.53L9.53 12.22a.75.75 0 0 0-1.06 1.06l2.25 2.25a.75.75 0 0 0 1.14-.094l3.75-5.25Z",clipRule:"evenodd"})}),wr=Cr;globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};function Sr({index:e,checked:t,dictID:n,onChange:o}){const r=c.useRef(null),a=sn(r,{}),i=!!(a!=null&&a.isIntersecting),l=Ar(e,n,i);return c.useEffect(()=>{var s,d;if(t&&r.current!==null){const u=r.current,f=(d=(s=u.parentElement)==null?void 0:s.parentElement)==null?void 0:d.parentElement;f==null||f.scroll({top:u.offsetTop-f.offsetTop-300,behavior:"smooth"})}},[t]),R("div",{ref:r,className:"relative flex h-16 w-40 cursor-pointer flex-col items-start justify-center overflow-hidden rounded-xl bg-slate-100 px-3 py-2 dark:bg-slate-800",onClick:()=>o(e),children:[R("h1",{children:["第 ",e+1," 章"]}),h("p",{className:"pt-[2px] text-xs text-slate-600",children:l?l.exerciseCount>0?`练习 ${l.exerciseCount} 次`:"未练习":"加载中..."}),t&&h(wr,{className:"absolute -bottom-4 -right-4 h-18 w-18 text-6xl text-green-500 opacity-40 dark:text-green-300"})]})}globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};const Rr=Jt("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-white transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-slate-950 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 dark:ring-offset-slate-950 dark:focus-visible:ring-slate-300",{variants:{variant:{default:"bg-indigo-500 shadow text-white hover:opacity-90 dark:text-opacity-80 focus:outline-none rounded-lg",destructive:"bg-red-500 text-slate-50 hover:bg-red-500/90 dark:bg-red-900 dark:text-slate-50 dark:hover:bg-red-900/90",outline:"border border-slate-200 bg-white hover:bg-slate-100 hover:text-slate-900 dark:border-slate-800 dark:bg-slate-950 dark:hover:bg-slate-800 dark:hover:text-slate-50",secondary:"bg-slate-100 text-slate-900 hover:bg-slate-100/80 dark:bg-slate-800 dark:text-slate-50 dark:hover:bg-slate-800/80",ghost:"hover:bg-slate-100 hover:text-slate-900 dark:hover:bg-slate-800 dark:hover:text-slate-50",link:"text-slate-900 underline-offset-4 hover:underline dark:text-slate-50"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),ue=c.forwardRef(({className:e,variant:t,size:n,asChild:o=!1,...r},a)=>h(o?Ie:"button",{className:M(Rr({variant:t,size:n,className:e})),ref:a,...r}));ue.displayName="Button";const xt=e=>h("svg",{viewBox:"0 0 256 256",width:"1.2em",height:"1.2em",...e,children:h("path",{fill:"currentColor",d:"M119.39 172.94a8 8 0 0 1-1.73 8.72l-32 32a8 8 0 0 1-11.32 0l-32-32A8 8 0 0 1 48 168h24V48a8 8 0 0 1 16 0v120h24a8 8 0 0 1 7.39 4.94Zm94.27-98.6l-32-32a8 8 0 0 0-11.32 0l-32 32A8 8 0 0 0 144 88h24v120a8 8 0 0 0 16 0V88h24a8 8 0 0 0 5.66-13.66Z"})});globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};const It=[{accessorKey:"word",size:100,header:({column:e})=>R(ue,{variant:"ghost",className:"p-0",onClick:()=>e.toggleSorting(e.getIsSorted()==="asc"),children:["单词",h(xt,{className:"ml-1.5 h-4 w-4"})]})},{accessorKey:"trans",size:500,header:"释义"},{accessorKey:"errorCount",size:40,header:({column:e})=>R(ue,{variant:"ghost",className:"p-0",onClick:()=>e.toggleSorting(e.getIsSorted()==="asc"),children:["错误次数",h(xt,{className:"ml-1.5 h-4 w-4"})]})},{accessorKey:"errorChar",header:"易错字母",size:80,cell:({row:e})=>h("p",{children:e.getValue("errorChar").map((t,n)=>h("kbd",{children:t+" "},`${t}-${n}`))})}];function $r(e){return e.map(t=>({word:t.word,trans:t.originData.trans.join(",")??"",errorCount:t.errorCount,errorChar:t.errorChar}))}globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};const un=c.forwardRef(({className:e,...t},n)=>h("div",{className:"relative h-full w-full overflow-auto",children:h("table",{ref:n,className:M("w-full caption-bottom text-sm",e),...t})}));un.displayName="Table";const cn=c.forwardRef(({className:e,...t},n)=>h("thead",{ref:n,className:M("[&_tr]:border-b",e),...t}));cn.displayName="TableHeader";const dn=c.forwardRef(({className:e,...t},n)=>h("tbody",{ref:n,className:M("[&_tr:last-child]:border-0",e),...t}));dn.displayName="TableBody";const yr=c.forwardRef(({className:e,...t},n)=>h("tfoot",{ref:n,className:M("border-t bg-slate-100/50 font-medium dark:bg-slate-800/50 [&>tr]:last:border-b-0",e),...t}));yr.displayName="TableFooter";const Se=c.forwardRef(({className:e,...t},n)=>h("tr",{ref:n,className:M("border-b transition-colors hover:bg-slate-100/50 data-[state=selected]:bg-slate-100 dark:hover:bg-slate-800/50 dark:data-[state=selected]:bg-slate-800",e),...t}));Se.displayName="TableRow";const gn=c.forwardRef(({className:e,...t},n)=>h("th",{ref:n,className:M("h-12 px-4 text-left align-middle font-medium text-slate-500 dark:text-slate-400 [&:has([role=checkbox])]:pr-0",e),...t}));gn.displayName="TableHead";const Je=c.forwardRef(({className:e,...t},n)=>h("td",{ref:n,className:M("p-4 align-middle [&:has([role=checkbox])]:pr-0",e),...t}));Je.displayName="TableCell";const xr=c.forwardRef(({className:e,...t},n)=>h("caption",{ref:n,className:M("mt-4 text-sm text-slate-500 dark:text-slate-400",e),...t}));xr.displayName="TableCaption";/** * table-core * * Copyright (c) TanStack diff --git a/assets/index-704dc8af.js b/assets/index-c176232e.js similarity index 99% rename from assets/index-704dc8af.js rename to assets/index-c176232e.js index fb79af879d..362d7e9ef6 100644 --- a/assets/index-704dc8af.js +++ b/assets/index-c176232e.js @@ -1,4 +1,4 @@ -import{c as $P,g as HP,r as yr,u as mf,i as yf,j as to,a as st,$ as VP,q as GP,d as WP,b as Ms,e as YP,f as rm,L as UP,t as XP,h as ZP,k as qP,F as QP,l as KP}from"./index-56893647.js";var $d={},Sb={exports:{}};/** +import{c as $P,g as HP,r as yr,u as mf,i as yf,j as to,a as st,$ as VP,q as GP,d as WP,b as Ms,e as YP,f as rm,L as UP,t as XP,h as ZP,k as qP,F as QP,l as KP}from"./index-e212e0e2.js";var $d={},Sb={exports:{}};/** * chroma.js - JavaScript library for color conversions * * Copyright (c) 2011-2019, Gregor Aisch diff --git a/assets/index-56893647.js b/assets/index-e212e0e2.js similarity index 99% rename from assets/index-56893647.js rename to assets/index-e212e0e2.js index b3128a65eb..55b1cb674b 100644 --- a/assets/index-56893647.js +++ b/assets/index-e212e0e2.js @@ -38,7 +38,7 @@ From previous: `);return this._state!==null&&(this._stack=e),e}finally{L_=!1}}}, Copyright (c) 2018 Jed Watson. Licensed under the MIT License (MIT), see http://jedwatson.github.io/classnames -*/(function(e){(function(){var t={}.hasOwnProperty;function r(){for(var n=[],a=0;ay("svg",{viewBox:"0 0 1024 1344",width:"1.2em",height:"1.2em",...e,children:y("g",{transform:"translate(0 1344) scale(1 -1)",children:y("path",{fill:"currentColor",d:"M1024 512q0 26-19 45t-45 19H64q-26 0-45-19T0 512t19-45L467 19q19-19 45-19t45 19l448 448q19 19 19 45z"})})}),CK=e=>y("svg",{viewBox:"0 0 1024 1344",width:"1.2em",height:"1.2em",...e,children:y("path",{fill:"currentColor",d:"M1024 512q0 26-19 45t-45 19H64q-26 0-45-19T0 512t19-45L467 19q19-19 45-19t45 19l448 448q19 19 19 45z"})});globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};const TK=({className:e,sortType:t,setSortType:r})=>{const n=p.useCallback(()=>{r({asc:"desc",desc:"none",none:"asc"}[t])},[r,t]);return L("span",{className:`relative cursor-pointer ${e}`,onClick:n,children:["错误次数",L("div",{className:"absolute -right-2 bottom-0 top-0 flex flex-col items-center justify-center text-[12px]",children:[y(CK,{className:Kr("-mb-2 ",{"text-indigo-500":t==="asc","text-gray-400":t!=="asc"})}),y(EK,{className:Kr({"text-indigo-500":t==="desc","text-gray-400":t!=="desc"})})]})]})},iN=e=>y("svg",{viewBox:"0 0 20 20",width:"1.2em",height:"1.2em",...e,children:y("path",{fill:"currentColor",d:"M7 1L5.6 2.5L13 10l-7.4 7.5L7 19l9-9z"})}),sN=e=>y("svg",{viewBox:"0 0 20 20",width:"1.2em",height:"1.2em",...e,children:y("path",{fill:"currentColor",d:"m4 10l9 9l1.4-1.5L7 10l7.4-7.5L13 1z"})});globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};const x1=20,AK=({className:e,page:t,setPage:r,totalPages:n})=>{const a=p.useCallback(()=>{r(t+1)},[t,r]),o=p.useCallback(()=>{r(t-1)},[t,r]);return L("div",{className:`flex items-center gap-2 ${e}`,children:[y("button",{className:"cursor-pointer rounded-full bg-white p-2 text-indigo-500 shadow-md dark:bg-gray-800 dark:text-indigo-300",onClick:o,children:y(sN,{})}),y("span",{className:"text-black dark:text-white",children:`${t} / ${n}`}),y("button",{className:"cursor-pointer rounded-full bg-white p-2 text-indigo-500 shadow-md dark:bg-gray-800 dark:text-indigo-300",onClick:a,children:y(iN,{})})]})};globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};const Op=({icon:e,name:t,data:r})=>L("div",{className:"g flex h-10 w-40 flex-1 select-none items-center justify-between rounded-md border-gray-400 bg-gray-100 px-3 py-5 shadow dark:border-gray-600 dark:bg-gray-800",children:[L("div",{className:"flex items-center space-x-1 ",children:[y(e,{className:"h-4 w-4 text-gray-700 dark:text-gray-300"}),y("span",{className:"break-keep text-base font-normal text-gray-500 dark:text-gray-300",children:t})]}),y("div",{className:"flex items-center space-x-2",children:y("span",{className:"text-base font-normal text-gray-800 dark:text-gray-200",children:r})})]});function a$(){return a$=Object.assign?Object.assign.bind():function(e){for(var t=1;t{const[r,n]=wt(dh),a=p.useMemo(()=>r?t.findIndex(s=>s.word===r.word&&s.dict===r.dict):-1,[r,t]),o=p.useCallback(()=>{if(!r)return;const s=a;if(s===-1)return;const l=s+1;l>=t.length||n(t[l])},[r,a,t,n]),i=p.useCallback(()=>{if(!r)return;const s=a;if(s===-1)return;const l=s-1;l<0||n(t[l])},[r,a,n,t]);return Yt("left",s=>{i(),s.stopPropagation()},{preventDefault:!0}),Yt("right",s=>{o(),s.stopPropagation()},{preventDefault:!0}),L("div",{className:`-gap-1 flex select-none items-center ${e}`,children:[y("button",{className:"d cursor-pointer rounded-full p-1 text-indigo-500 focus:outline-none dark:text-indigo-300",onClick:i,children:y(sN,{})}),y("span",{className:"text-sm text-black dark:text-white",children:`${a+1} / ${t.length}`}),y("button",{className:"cursor-pointer rounded-full p-1 text-indigo-500 focus:outline-none dark:text-indigo-300",onClick:o,children:y(iN,{})})]})};globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};const WK=({className:e})=>L("svg",{className:`prefix__icon ${e}`,viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",children:[y("path",{d:"M699.034 761.907a25.6 25.6 0 01-16.18-45.414C736.973 672.512 768 607.283 768 537.65s-31.027-134.81-85.094-178.841a25.549 25.549 0 1132.307-39.68C781.312 372.89 819.2 452.557 819.2 537.702s-37.888 164.762-103.987 218.573a25.6 25.6 0 01-16.128 5.735z"}),y("path",{d:"M795.904 881.1a25.6 25.6 0 01-16.18-45.414C869.889 762.368 921.6 653.722 921.6 537.651s-51.712-224.717-141.875-298.035a25.549 25.549 0 1132.307-39.68C914.176 283.034 972.8 406.17 972.8 537.702s-58.573 254.67-160.768 337.767a25.6 25.6 0 01-16.128 5.734zm-193.69-238.438a25.6 25.6 0 01-16.179-45.414c18.023-14.694 28.365-36.403 28.365-59.597s-10.342-44.953-28.365-59.597a25.549 25.549 0 1132.307-39.68c30.055 24.423 47.258 60.621 47.258 99.328s-17.254 74.906-47.258 99.328a25.6 25.6 0 01-16.128 5.735zM417.28 164.198c-12.646 0-25.293 5.325-37.683 15.821L169.779 358.35H76.8c-42.342 0-76.8 34.457-76.8 76.8v204.8c0 42.342 34.458 76.8 76.8 76.8h92.98l209.817 178.33c12.339 10.495 25.037 15.82 37.683 15.82a40.755 40.755 0 0034.304-18.534c6.093-9.165 9.216-20.89 9.216-34.816v-640c0-36.864-21.862-53.402-43.52-53.402zM51.2 640V435.2a25.6 25.6 0 0125.6-25.6h76.8v256H76.8A25.6 25.6 0 0151.2 640zm358.4 213.453l-204.8-174.08V395.827l204.8-174.08v631.706z"})]}),HK=({className:e})=>y("svg",{className:`prefix__icon ${e}`,viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",children:y("path",{d:"M417.28 164.198c-12.646 0-25.293 5.325-37.683 15.821L169.779 358.35H76.8c-42.342 0-76.8 34.457-76.8 76.8v204.8c0 42.342 34.458 76.8 76.8 76.8h92.98l209.817 178.33c12.339 10.495 25.037 15.82 37.683 15.82a40.755 40.755 0 0034.304-18.534c6.093-9.165 9.216-20.89 9.216-34.816v-640c0-36.864-21.862-53.402-43.52-53.402zM51.2 640V435.2a25.6 25.6 0 0125.6-25.6h76.8v256H76.8A25.6 25.6 0 0151.2 640zm358.4 213.453l-204.8-174.08V395.827l204.8-174.08v631.706z"})}),GK=({className:e})=>y("svg",{className:`prefix__icon ${e}`,viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",children:y("path",{d:"M602.214 642.662a25.6 25.6 0 01-16.179-45.414c18.023-14.694 28.365-36.403 28.365-59.597s-10.342-44.953-28.365-59.597a25.549 25.549 0 1132.307-39.68c30.055 24.423 47.258 60.621 47.258 99.328s-17.254 74.906-47.258 99.328a25.6 25.6 0 01-16.128 5.735zM417.28 164.198c-12.646 0-25.293 5.325-37.683 15.821L169.779 358.35H76.8c-42.342 0-76.8 34.457-76.8 76.8v204.8c0 42.342 34.458 76.8 76.8 76.8h92.98l209.817 178.33c12.339 10.495 25.037 15.82 37.683 15.82a40.755 40.755 0 0034.304-18.534c6.093-9.165 9.216-20.89 9.216-34.816v-640c0-36.864-21.862-53.402-43.52-53.402zM51.2 640V435.2a25.6 25.6 0 0125.6-25.6h76.8v256H76.8A25.6 25.6 0 0151.2 640zm358.4 213.453l-204.8-174.08V395.827l204.8-174.08v631.706z"})}),KK=({className:e})=>y("svg",{className:`prefix__icon ${e}`,viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",children:y("path",{d:"M699.034 761.907a25.6 25.6 0 01-16.18-45.414C736.973 672.512 768 607.283 768 537.65s-31.027-134.81-85.094-178.841a25.549 25.549 0 1132.307-39.68C781.312 372.89 819.2 452.557 819.2 537.702s-37.888 164.762-103.987 218.573a25.6 25.6 0 01-16.128 5.735zm-96.82-119.245a25.6 25.6 0 01-16.179-45.414c18.023-14.694 28.365-36.403 28.365-59.597s-10.342-44.953-28.365-59.597a25.549 25.549 0 1132.307-39.68c30.055 24.423 47.258 60.621 47.258 99.328s-17.254 74.906-47.258 99.328a25.6 25.6 0 01-16.128 5.735zM417.28 164.198c-12.646 0-25.293 5.325-37.683 15.821L169.779 358.35H76.8c-42.342 0-76.8 34.457-76.8 76.8v204.8c0 42.342 34.458 76.8 76.8 76.8h92.98l209.817 178.33c12.339 10.495 25.037 15.82 37.683 15.82a40.755 40.755 0 0034.304-18.534c6.093-9.165 9.216-20.89 9.216-34.816v-640c0-36.864-21.862-53.402-43.52-53.402zM51.2 640V435.2a25.6 25.6 0 0125.6-25.6h76.8v256H76.8A25.6 25.6 0 0151.2 640zm358.4 213.453l-204.8-174.08V395.827l204.8-174.08v631.706z"})});globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};const d4=[HK,GK,KK,WK],hN=({duration:e=500,animated:t=!1,onClick:r,iconClassName:n,className:a})=>{const[o,i]=p.useState(0);p.useEffect(()=>{const l=window.setTimeout(()=>{const u=t&&o{clearTimeout(l)}},[t,o]);const s=d4[o];return y("button",{type:"button",className:`focus:outline-none dark:fill-gray-400 dark:opacity-80 ${a}`,onClick:r,children:y(s,{className:n})})};globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};function qK(e){return e=e[0],e>="一"&&e<="鿏"||e>="豈"&&e<="﫿"||e>="㐀"&&e<="䶿"}function YK(e){const t=e.toLowerCase(),r=t.split("");for(let o=0;o0;i--){const s=r.slice(a,a+i),l=QK[s.join("")];if(l!=null){n+=l,a+=s.length;break}if(i==1){n+=s,a+=1;break}}}return n}function ZK(e){return e>="a"&&e<="z"&&!XK(e)}function XK(e){return e=="a"||e=="i"||e=="u"||e=="e"||e=="o"}const QK={a:"あ",i:"い",u:"う",e:"え",o:"お","-":"ー",xa:"ぁ",xi:"ぃ",xu:"ぅ",xe:"ぇ",xo:"ぉ",ka:"か",ki:"き",ku:"く",ke:"け",ko:"こ",ca:"か",cu:"く",co:"こ",ga:"が",gi:"ぎ",gu:"ぐ",ge:"げ",go:"ご",sa:"さ",si:"し",su:"す",se:"せ",so:"そ",za:"ざ",zi:"じ",zu:"ず",ze:"ぜ",zo:"ぞ",ja:"じゃ",ji:"じ",ju:"じゅ",je:"じぇ",jo:"じょ",ta:"た",ti:"ち",tu:"つ",te:"て",to:"と",da:"だ",di:"ぢ",du:"づ",de:"で",do:"ど",na:"な",ni:"に",nu:"ぬ",ne:"ね",no:"の",ha:"は",hi:"ひ",hu:"ふ",he:"へ",ho:"ほ",ba:"ば",bi:"び",bu:"ぶ",be:"べ",bo:"ぼ",pa:"ぱ",pi:"ぴ",pu:"ぷ",pe:"ぺ",po:"ぽ",va:"ヴぁ",vi:"ヴぃ",vu:"ヴ",ve:"ヴぇ",vo:"ヴぉ",fa:"ふぁ",fi:"ふぃ",fu:"ふ",fe:"ふぇ",fo:"ふぉ",ma:"ま",mi:"み",mu:"む",me:"め",mo:"も",ya:"や",yi:"い",yu:"ゆ",ye:"いぇ",yo:"よ",ra:"ら",ri:"り",ru:"る",re:"れ",ro:"ろ",la:"ら",li:"り",lu:"る",le:"れ",lo:"ろ",wa:"わ",wi:"ゐ",wu:"う",we:"ゑ",wo:"を",tsu:"つ",xka:"ヵ",xke:"ヶ",xwa:"ゎ",xtsu:"っ",xya:"ゃ",xyu:"ゅ",xyo:"ょ",kya:"きゃ",kyi:"きぃ",kyu:"きゅ",kye:"きぇ",kyo:"きょ",gya:"ぎゃ",gyi:"ぎぃ",gyu:"ぎゅ",gye:"ぎぇ",gyo:"ぎょ",sya:"しゃ",syi:"しぃ",syu:"しゅ",sye:"しぇ",syo:"しょ",sha:"しゃ",shi:"し",shu:"しゅ",she:"しぇ",sho:"しょ",zya:"じゃ",zyi:"じぃ",zyu:"じゅ",zye:"じぇ",zyo:"じょ",jya:"じゃ",jyi:"じぃ",jyu:"じゅ",jye:"じぇ",jyo:"じょ",tya:"ちゃ",tyi:"ちぃ",tyu:"ちゅ",tye:"ちぇ",tyo:"ちょ",cya:"ちゃ",cyi:"ちぃ",cyu:"ちゅ",cye:"ちぇ",cyo:"ちょ",cha:"ちゃ",chi:"ち",chu:"ちゅ",che:"ちぇ",cho:"ちょ",tha:"てゃ",thi:"てぃ",thu:"てゅ",the:"てぇ",tho:"てょ",dya:"ぢゃ",dyi:"ぢぃ",dyu:"ぢゅ",dye:"ぢぇ",dyo:"ぢょ",dha:"でゃ",dhi:"でぃ",dhu:"でゅ",dhe:"でぇ",dho:"でょ",nya:"にゃ",nyi:"にぃ",nyu:"にゅ",nye:"にぇ",nyo:"にょ",hya:"ひゃ",hyi:"ひぃ",hyu:"ひゅ",hye:"ひぇ",hyo:"ひょ",bya:"びゃ",byi:"びぃ",byu:"びゅ",bye:"びぇ",byo:"びょ",pya:"ぴゃ",pyi:"ぴぃ",pyu:"ぴゅ",pye:"ぴぇ",pyo:"ぴょ",mya:"みゃ",myi:"みぃ",myu:"みゅ",mye:"みぇ",myo:"みょ",rya:"りゃ",ryi:"りぃ",ryu:"りゅ",rye:"りぇ",ryo:"りょ",lya:"りゃ",lyi:"りぃ",lyu:"りゅ",lye:"りぇ",lyo:"りょ",n:"ん",m:"ん","n'":"ん",dzu:"づ"};globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};function Qg(){}function zv(){return zv=Object.assign||function(e){for(var t=1;t=0)&&(r[a]=e[a]);return r}function eq(e){p.useEffect(e,[])}function Jg(e,t){t===void 0&&(t={});var r=t,n=r.volume,a=n===void 0?1:n,o=r.playbackRate,i=o===void 0?1:o,s=r.soundEnabled,l=s===void 0?!0:s,u=r.interrupt,f=u===void 0?!1:u,c=r.onload,d=JK(r,["id","volume","playbackRate","soundEnabled","interrupt","onload"]),h=Y.useRef(null),g=Y.useRef(!1),m=Y.useState(null),w=m[0],v=m[1],b=Y.useState(null),_=b[0],$=b[1],C=function(){typeof c=="function"&&c.call(this),g.current&&v(this.duration()*1e3),$(this)};eq(function(){return Je(()=>Promise.resolve().then(()=>mse),void 0,import.meta.url).then(function(k){if(!g.current){var N;h.current=(N=k.Howl)!==null&&N!==void 0?N:k.default.Howl,g.current=!0,new h.current(zv({src:Array.isArray(e)?e:[e],volume:a,rate:i,onload:C},d))}}),function(){g.current=!1}}),Y.useEffect(function(){h.current&&_&&$(new h.current(zv({src:Array.isArray(e)?e:[e],volume:a,onload:C},d)))},[JSON.stringify(e)]),Y.useEffect(function(){_&&(_.volume(a),_.rate(i))},[a,i]);var O=Y.useCallback(function(k){typeof k>"u"&&(k={}),!(!_||!l&&!k.forceSoundEnabled)&&(f&&_.stop(),k.playbackRate&&_.rate(k.playbackRate),_.play(k.id))},[_,l,f]),x=Y.useCallback(function(k){_&&_.stop(k)},[_]),S=Y.useCallback(function(k){_&&_.pause(k)},[_]),A=[O,{sound:_,stop:x,pause:S,duration:w}];return A}globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};const El="https://dict.youdao.com/dictvoice?audio=";function pN(e,t){switch(t){case"uk":return`${El}${e}&type=1`;case"us":return`${El}${e}&type=2`;case"romaji":return`${El}${YK(e)}&le=jap`;case"zh":return`${El}${e}&le=zh`;case"ja":return`${El}${e}&le=jap`;case"de":return`${El}${e}&le=de`}}function gN(e,t){const r=oe(To),n=p.useMemo(()=>typeof t=="boolean"?t:r.isLoop,[t,r.isLoop]),[a,o]=p.useState(!1),[i,{stop:s,sound:l}]=Jg(pN(e,r.type),{html5:!0,format:["mp3"],loop:n,volume:r.volume,rate:r.rate});return p.useEffect(()=>{if(l)return l.loop(n),Qg},[n,l]),p.useEffect(()=>{if(!l)return;const u=[];return u.push(Rp(l,"play",()=>o(!0))),u.push(Rp(l,"end",()=>o(!1))),u.push(Rp(l,"pause",()=>o(!1))),u.push(Rp(l,"playerror",()=>o(!1))),()=>{o(!1),u.forEach(f=>f()),l.unload()}},[l]),{play:i,stop:s,isPlaying:a}}function tq(e){const t=oe(To);p.useEffect(()=>{if(!e)return;const r=pN(e,t.type),n=document.head;if(!Array.from(n.querySelectorAll("link[href]")).some(o=>o.href===r)){const o=document.createElement("link");return o.rel="prefetch",o.href=r,n.appendChild(o),()=>{n.removeChild(o)}}},[t.type,e])}globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};const m0=Y.forwardRef(({word:e,className:t,iconClassName:r},n)=>{const{play:a,stop:o,isPlaying:i}=gN(e),s=p.useCallback(()=>{o(),a()},[a,o]);return p.useEffect(()=>o,[e,o]),p.useImperativeHandle(n,()=>({play:s}),[s]),y(hN,{animated:i,onClick:s,className:`cursor-pointer text-gray-600 ${t}`,iconClassName:r})});m0.displayName="WordPronunciationIcon";globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};function vN({word:e}){const t=oe(yh),r=oe(vh);return L("div",{className:`space-x-5 text-center text-sm font-normal text-gray-600 transition-colors duration-300 dark:text-gray-400 ${r&&"select-text"}`,children:[t.type==="us"&&e.usphone&&e.usphone.length>1&&y("span",{children:`AmE: [${e.usphone}]`}),t.type==="uk"&&e.ukphone&&e.ukphone.length>1&&y("span",{children:`BrE: [${e.ukphone}]`})]})}globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};const rq={true:{normal:"text-gray-400",correct:"text-green-400 dark:text-green-700",wrong:"text-red-400 dark:text-red-600"},false:{normal:"text-gray-600 dark:text-gray-50",correct:"text-green-600 dark:text-green-400",wrong:"text-red-600 dark:text-red-400"}},nq=({letter:e,state:t="normal",visible:r=!0})=>{const n=oe(wS);return y("span",{className:`m-0 p-0 font-mono font-normal ${rq[e===T_][t]} pr-0.8 duration-0 dark:text-opacity-80`,style:{fontSize:n.foreignFont.toString()+"px"},children:r?e:"_"})},mN=Y.memo(nq),aq=e=>y("svg",{viewBox:"0 0 20 20",width:"1.2em",height:"1.2em",...e,children:L("g",{fill:"currentColor",children:[y("path",{d:"M12 9a1 1 0 0 1-1-1V3c0-.553.45-1.008.997-.93a7.004 7.004 0 0 1 5.933 5.933c.078.547-.378.997-.93.997h-5Z"}),y("path",{d:"M8.003 4.07C8.55 3.992 9 4.447 9 5v5a1 1 0 0 0 1 1h5c.552 0 1.008.45.93.997A7.001 7.001 0 0 1 2 11a7.002 7.002 0 0 1 6.003-6.93Z"})]})}),oq=e=>y("svg",{viewBox:"0 0 20 20",width:"1.2em",height:"1.2em",...e,children:y("path",{fill:"currentColor",fillRule:"evenodd",d:"M10 18a8 8 0 1 0 0-16a8 8 0 0 0 0 16Zm3.857-9.809a.75.75 0 0 0-1.214-.882l-3.483 4.79l-1.88-1.88a.75.75 0 1 0-1.06 1.061l2.5 2.5a.75.75 0 0 0 1.137-.089l4-5.5Z",clipRule:"evenodd"})}),iq=e=>y("svg",{viewBox:"0 0 20 20",width:"1.2em",height:"1.2em",...e,children:y("path",{fill:"currentColor",fillRule:"evenodd",d:"M10 18a8 8 0 1 0 0-16a8 8 0 0 0 0 16Zm.75-13a.75.75 0 0 0-1.5 0v5c0 .414.336.75.75.75h4a.75.75 0 0 0 0-1.5h-3.25V5Z",clipRule:"evenodd"})}),sq=e=>y("svg",{viewBox:"0 0 20 20",width:"1.2em",height:"1.2em",...e,children:y("path",{fill:"currentColor",fillRule:"evenodd",d:"M10 18a8 8 0 1 0 0-16a8 8 0 0 0 0 16ZM8.28 7.22a.75.75 0 0 0-1.06 1.06L8.94 10l-1.72 1.72a.75.75 0 1 0 1.06 1.06L10 11.06l1.72 1.72a.75.75 0 1 0 1.06-1.06L11.06 10l1.72-1.72a.75.75 0 0 0-1.06-1.06L10 8.94L8.28 7.22Z",clipRule:"evenodd"})}),gu=e=>y("svg",{viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...e,children:y("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M18 6L6 18M6 6l12 12"})});globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};const lq=({currentRowDetail:e,allRecords:t})=>{const r=wa(dh),n=Ef[e.dict],{word:a,isLoading:o,hasError:i}=n8(e.word,n),s=p.useRef(null),l=p.useMemo(()=>{const c=((e.records.length>0?e.records.reduce((m,w)=>m+w.totalTime,0)/e.records.length:0)/1e3).toFixed(2),d=e.records.length,h=e.wrongCount,g=d+h;return{time:c,sumCount:g,correctCount:d,wrongCount:h}},[e.records,e.wrongCount]),u=p.useCallback(()=>{r(null)},[r]);return Yt("esc",f=>{u(),f.stopPropagation()},{preventDefault:!0}),Yt("ctrl+j",()=>{var f;(f=s.current)==null||f.play()},[],{enableOnFormTags:!0,preventDefault:!0}),L("div",{className:"absolute inset-0 flex flex-col items-center justify-center ",children:[L("div",{className:"my-card relative z-10 flex h-[32rem] min-w-[26rem] select-text flex-col items-center justify-around rounded-2xl bg-white px-3 py-10 dark:bg-gray-900",children:[y(gu,{className:"absolute right-3 top-3 h-6 w-6 cursor-pointer text-gray-400",onClick:u}),L("div",{className:"flex flex-col items-center justify-start",children:[y("div",{children:e.word.split("").map((f,c)=>y(mN,{letter:f,visible:!0,state:"normal"},`${c}-${f}`))}),L("div",{className:"relative flex h-8 items-center",children:[a?y(vN,{word:a}):y(__,{isLoading:o,hasError:i}),a&&y(m0,{word:a.name,className:"absolute -right-7 top-1/2 h-5 w-5 -translate-y-1/2 transform ",ref:s})]}),y("div",{className:"flex max-w-[24rem] items-center",children:y("span",{className:"max-w-4xl text-center font-sans transition-colors duration-300 dark:text-white dark:text-opacity-80",children:a?a.trans.join(";"):y(__,{isLoading:o,hasError:i})})})]}),L("div",{className:"item flex flex-col gap-4",children:[L("div",{className:"flex gap-6",children:[y(Op,{icon:iq,name:"平均用时",data:l.time}),y(Op,{icon:aq,name:"练习次数",data:l.sumCount})]}),L("div",{className:"flex gap-6",children:[y(Op,{icon:oq,name:"正确次数",data:l.correctCount}),y(Op,{icon:sq,name:"错误次数",data:l.wrongCount})]})]}),y(VK,{className:"absolute bottom-6 mt-10",allRecords:t})]}),y("div",{className:"absolute inset-0 z-0 cursor-pointer bg-transparent",onClick:u})]})};function te(){return te=Object.assign?Object.assign.bind():function(e){for(var t=1;ty("svg",{viewBox:"0 0 1024 1344",width:"1.2em",height:"1.2em",...e,children:y("g",{transform:"translate(0 1344) scale(1 -1)",children:y("path",{fill:"currentColor",d:"M1024 512q0 26-19 45t-45 19H64q-26 0-45-19T0 512t19-45L467 19q19-19 45-19t45 19l448 448q19 19 19 45z"})})}),CK=e=>y("svg",{viewBox:"0 0 1024 1344",width:"1.2em",height:"1.2em",...e,children:y("path",{fill:"currentColor",d:"M1024 512q0 26-19 45t-45 19H64q-26 0-45-19T0 512t19-45L467 19q19-19 45-19t45 19l448 448q19 19 19 45z"})});globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};const TK=({className:e,sortType:t,setSortType:r})=>{const n=p.useCallback(()=>{r({asc:"desc",desc:"none",none:"asc"}[t])},[r,t]);return L("span",{className:`relative cursor-pointer ${e}`,onClick:n,children:["错误次数",L("div",{className:"absolute -right-2 bottom-0 top-0 flex flex-col items-center justify-center text-[12px]",children:[y(CK,{className:Kr("-mb-2 ",{"text-indigo-500":t==="asc","text-gray-400":t!=="asc"})}),y(EK,{className:Kr({"text-indigo-500":t==="desc","text-gray-400":t!=="desc"})})]})]})},iN=e=>y("svg",{viewBox:"0 0 20 20",width:"1.2em",height:"1.2em",...e,children:y("path",{fill:"currentColor",d:"M7 1L5.6 2.5L13 10l-7.4 7.5L7 19l9-9z"})}),sN=e=>y("svg",{viewBox:"0 0 20 20",width:"1.2em",height:"1.2em",...e,children:y("path",{fill:"currentColor",d:"m4 10l9 9l1.4-1.5L7 10l7.4-7.5L13 1z"})});globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};const x1=20,AK=({className:e,page:t,setPage:r,totalPages:n})=>{const a=p.useCallback(()=>{r(t+1)},[t,r]),o=p.useCallback(()=>{r(t-1)},[t,r]);return L("div",{className:`flex items-center gap-2 ${e}`,children:[y("button",{className:"cursor-pointer rounded-full bg-white p-2 text-indigo-500 shadow-md dark:bg-gray-800 dark:text-indigo-300",onClick:o,children:y(sN,{})}),y("span",{className:"text-black dark:text-white",children:`${t} / ${n}`}),y("button",{className:"cursor-pointer rounded-full bg-white p-2 text-indigo-500 shadow-md dark:bg-gray-800 dark:text-indigo-300",onClick:a,children:y(iN,{})})]})};globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};const Op=({icon:e,name:t,data:r})=>L("div",{className:"g flex h-10 w-40 flex-1 select-none items-center justify-between rounded-md border-gray-400 bg-gray-100 px-3 py-5 shadow dark:border-gray-600 dark:bg-gray-800",children:[L("div",{className:"flex items-center space-x-1 ",children:[y(e,{className:"h-4 w-4 text-gray-700 dark:text-gray-300"}),y("span",{className:"break-keep text-base font-normal text-gray-500 dark:text-gray-300",children:t})]}),y("div",{className:"flex items-center space-x-2",children:y("span",{className:"text-base font-normal text-gray-800 dark:text-gray-200",children:r})})]});function a$(){return a$=Object.assign?Object.assign.bind():function(e){for(var t=1;t{const[r,n]=wt(dh),a=p.useMemo(()=>r?t.findIndex(s=>s.word===r.word&&s.dict===r.dict):-1,[r,t]),o=p.useCallback(()=>{if(!r)return;const s=a;if(s===-1)return;const l=s+1;l>=t.length||n(t[l])},[r,a,t,n]),i=p.useCallback(()=>{if(!r)return;const s=a;if(s===-1)return;const l=s-1;l<0||n(t[l])},[r,a,n,t]);return Yt("left",s=>{i(),s.stopPropagation()},{preventDefault:!0}),Yt("right",s=>{o(),s.stopPropagation()},{preventDefault:!0}),L("div",{className:`-gap-1 flex select-none items-center ${e}`,children:[y("button",{className:"d cursor-pointer rounded-full p-1 text-indigo-500 focus:outline-none dark:text-indigo-300",onClick:i,children:y(sN,{})}),y("span",{className:"text-sm text-black dark:text-white",children:`${a+1} / ${t.length}`}),y("button",{className:"cursor-pointer rounded-full p-1 text-indigo-500 focus:outline-none dark:text-indigo-300",onClick:o,children:y(iN,{})})]})};globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};const WK=({className:e})=>L("svg",{className:`prefix__icon ${e}`,viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",children:[y("path",{d:"M699.034 761.907a25.6 25.6 0 01-16.18-45.414C736.973 672.512 768 607.283 768 537.65s-31.027-134.81-85.094-178.841a25.549 25.549 0 1132.307-39.68C781.312 372.89 819.2 452.557 819.2 537.702s-37.888 164.762-103.987 218.573a25.6 25.6 0 01-16.128 5.735z"}),y("path",{d:"M795.904 881.1a25.6 25.6 0 01-16.18-45.414C869.889 762.368 921.6 653.722 921.6 537.651s-51.712-224.717-141.875-298.035a25.549 25.549 0 1132.307-39.68C914.176 283.034 972.8 406.17 972.8 537.702s-58.573 254.67-160.768 337.767a25.6 25.6 0 01-16.128 5.734zm-193.69-238.438a25.6 25.6 0 01-16.179-45.414c18.023-14.694 28.365-36.403 28.365-59.597s-10.342-44.953-28.365-59.597a25.549 25.549 0 1132.307-39.68c30.055 24.423 47.258 60.621 47.258 99.328s-17.254 74.906-47.258 99.328a25.6 25.6 0 01-16.128 5.735zM417.28 164.198c-12.646 0-25.293 5.325-37.683 15.821L169.779 358.35H76.8c-42.342 0-76.8 34.457-76.8 76.8v204.8c0 42.342 34.458 76.8 76.8 76.8h92.98l209.817 178.33c12.339 10.495 25.037 15.82 37.683 15.82a40.755 40.755 0 0034.304-18.534c6.093-9.165 9.216-20.89 9.216-34.816v-640c0-36.864-21.862-53.402-43.52-53.402zM51.2 640V435.2a25.6 25.6 0 0125.6-25.6h76.8v256H76.8A25.6 25.6 0 0151.2 640zm358.4 213.453l-204.8-174.08V395.827l204.8-174.08v631.706z"})]}),HK=({className:e})=>y("svg",{className:`prefix__icon ${e}`,viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",children:y("path",{d:"M417.28 164.198c-12.646 0-25.293 5.325-37.683 15.821L169.779 358.35H76.8c-42.342 0-76.8 34.457-76.8 76.8v204.8c0 42.342 34.458 76.8 76.8 76.8h92.98l209.817 178.33c12.339 10.495 25.037 15.82 37.683 15.82a40.755 40.755 0 0034.304-18.534c6.093-9.165 9.216-20.89 9.216-34.816v-640c0-36.864-21.862-53.402-43.52-53.402zM51.2 640V435.2a25.6 25.6 0 0125.6-25.6h76.8v256H76.8A25.6 25.6 0 0151.2 640zm358.4 213.453l-204.8-174.08V395.827l204.8-174.08v631.706z"})}),GK=({className:e})=>y("svg",{className:`prefix__icon ${e}`,viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",children:y("path",{d:"M602.214 642.662a25.6 25.6 0 01-16.179-45.414c18.023-14.694 28.365-36.403 28.365-59.597s-10.342-44.953-28.365-59.597a25.549 25.549 0 1132.307-39.68c30.055 24.423 47.258 60.621 47.258 99.328s-17.254 74.906-47.258 99.328a25.6 25.6 0 01-16.128 5.735zM417.28 164.198c-12.646 0-25.293 5.325-37.683 15.821L169.779 358.35H76.8c-42.342 0-76.8 34.457-76.8 76.8v204.8c0 42.342 34.458 76.8 76.8 76.8h92.98l209.817 178.33c12.339 10.495 25.037 15.82 37.683 15.82a40.755 40.755 0 0034.304-18.534c6.093-9.165 9.216-20.89 9.216-34.816v-640c0-36.864-21.862-53.402-43.52-53.402zM51.2 640V435.2a25.6 25.6 0 0125.6-25.6h76.8v256H76.8A25.6 25.6 0 0151.2 640zm358.4 213.453l-204.8-174.08V395.827l204.8-174.08v631.706z"})}),KK=({className:e})=>y("svg",{className:`prefix__icon ${e}`,viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",children:y("path",{d:"M699.034 761.907a25.6 25.6 0 01-16.18-45.414C736.973 672.512 768 607.283 768 537.65s-31.027-134.81-85.094-178.841a25.549 25.549 0 1132.307-39.68C781.312 372.89 819.2 452.557 819.2 537.702s-37.888 164.762-103.987 218.573a25.6 25.6 0 01-16.128 5.735zm-96.82-119.245a25.6 25.6 0 01-16.179-45.414c18.023-14.694 28.365-36.403 28.365-59.597s-10.342-44.953-28.365-59.597a25.549 25.549 0 1132.307-39.68c30.055 24.423 47.258 60.621 47.258 99.328s-17.254 74.906-47.258 99.328a25.6 25.6 0 01-16.128 5.735zM417.28 164.198c-12.646 0-25.293 5.325-37.683 15.821L169.779 358.35H76.8c-42.342 0-76.8 34.457-76.8 76.8v204.8c0 42.342 34.458 76.8 76.8 76.8h92.98l209.817 178.33c12.339 10.495 25.037 15.82 37.683 15.82a40.755 40.755 0 0034.304-18.534c6.093-9.165 9.216-20.89 9.216-34.816v-640c0-36.864-21.862-53.402-43.52-53.402zM51.2 640V435.2a25.6 25.6 0 0125.6-25.6h76.8v256H76.8A25.6 25.6 0 0151.2 640zm358.4 213.453l-204.8-174.08V395.827l204.8-174.08v631.706z"})});globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};const d4=[HK,GK,KK,WK],hN=({duration:e=500,animated:t=!1,onClick:r,iconClassName:n,className:a})=>{const[o,i]=p.useState(0);p.useEffect(()=>{const l=window.setTimeout(()=>{const u=t&&o{clearTimeout(l)}},[t,o]);const s=d4[o];return y("button",{type:"button",className:`focus:outline-none dark:fill-gray-400 dark:opacity-80 ${a}`,onClick:r,children:y(s,{className:n})})};globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};function qK(e){return e=e[0],e>="一"&&e<="鿏"||e>="豈"&&e<="﫿"||e>="㐀"&&e<="䶿"}function YK(e){const t=e.toLowerCase(),r=t.split("");for(let o=0;o0;i--){const s=r.slice(a,a+i),l=QK[s.join("")];if(l!=null){n+=l,a+=s.length;break}if(i==1){n+=s,a+=1;break}}}return n}function ZK(e){return e>="a"&&e<="z"&&!XK(e)}function XK(e){return e=="a"||e=="i"||e=="u"||e=="e"||e=="o"}const QK={a:"あ",i:"い",u:"う",e:"え",o:"お","-":"ー",xa:"ぁ",xi:"ぃ",xu:"ぅ",xe:"ぇ",xo:"ぉ",ka:"か",ki:"き",ku:"く",ke:"け",ko:"こ",ca:"か",cu:"く",co:"こ",ga:"が",gi:"ぎ",gu:"ぐ",ge:"げ",go:"ご",sa:"さ",si:"し",su:"す",se:"せ",so:"そ",za:"ざ",zi:"じ",zu:"ず",ze:"ぜ",zo:"ぞ",ja:"じゃ",ji:"じ",ju:"じゅ",je:"じぇ",jo:"じょ",ta:"た",ti:"ち",tu:"つ",te:"て",to:"と",da:"だ",di:"ぢ",du:"づ",de:"で",do:"ど",na:"な",ni:"に",nu:"ぬ",ne:"ね",no:"の",ha:"は",hi:"ひ",hu:"ふ",he:"へ",ho:"ほ",ba:"ば",bi:"び",bu:"ぶ",be:"べ",bo:"ぼ",pa:"ぱ",pi:"ぴ",pu:"ぷ",pe:"ぺ",po:"ぽ",va:"ヴぁ",vi:"ヴぃ",vu:"ヴ",ve:"ヴぇ",vo:"ヴぉ",fa:"ふぁ",fi:"ふぃ",fu:"ふ",fe:"ふぇ",fo:"ふぉ",ma:"ま",mi:"み",mu:"む",me:"め",mo:"も",ya:"や",yi:"い",yu:"ゆ",ye:"いぇ",yo:"よ",ra:"ら",ri:"り",ru:"る",re:"れ",ro:"ろ",la:"ら",li:"り",lu:"る",le:"れ",lo:"ろ",wa:"わ",wi:"ゐ",wu:"う",we:"ゑ",wo:"を",tsu:"つ",xka:"ヵ",xke:"ヶ",xwa:"ゎ",xtsu:"っ",xya:"ゃ",xyu:"ゅ",xyo:"ょ",kya:"きゃ",kyi:"きぃ",kyu:"きゅ",kye:"きぇ",kyo:"きょ",gya:"ぎゃ",gyi:"ぎぃ",gyu:"ぎゅ",gye:"ぎぇ",gyo:"ぎょ",sya:"しゃ",syi:"しぃ",syu:"しゅ",sye:"しぇ",syo:"しょ",sha:"しゃ",shi:"し",shu:"しゅ",she:"しぇ",sho:"しょ",zya:"じゃ",zyi:"じぃ",zyu:"じゅ",zye:"じぇ",zyo:"じょ",jya:"じゃ",jyi:"じぃ",jyu:"じゅ",jye:"じぇ",jyo:"じょ",tya:"ちゃ",tyi:"ちぃ",tyu:"ちゅ",tye:"ちぇ",tyo:"ちょ",cya:"ちゃ",cyi:"ちぃ",cyu:"ちゅ",cye:"ちぇ",cyo:"ちょ",cha:"ちゃ",chi:"ち",chu:"ちゅ",che:"ちぇ",cho:"ちょ",tha:"てゃ",thi:"てぃ",thu:"てゅ",the:"てぇ",tho:"てょ",dya:"ぢゃ",dyi:"ぢぃ",dyu:"ぢゅ",dye:"ぢぇ",dyo:"ぢょ",dha:"でゃ",dhi:"でぃ",dhu:"でゅ",dhe:"でぇ",dho:"でょ",nya:"にゃ",nyi:"にぃ",nyu:"にゅ",nye:"にぇ",nyo:"にょ",hya:"ひゃ",hyi:"ひぃ",hyu:"ひゅ",hye:"ひぇ",hyo:"ひょ",bya:"びゃ",byi:"びぃ",byu:"びゅ",bye:"びぇ",byo:"びょ",pya:"ぴゃ",pyi:"ぴぃ",pyu:"ぴゅ",pye:"ぴぇ",pyo:"ぴょ",mya:"みゃ",myi:"みぃ",myu:"みゅ",mye:"みぇ",myo:"みょ",rya:"りゃ",ryi:"りぃ",ryu:"りゅ",rye:"りぇ",ryo:"りょ",lya:"りゃ",lyi:"りぃ",lyu:"りゅ",lye:"りぇ",lyo:"りょ",n:"ん",m:"ん","n'":"ん",dzu:"づ"};globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};function Qg(){}function zv(){return zv=Object.assign||function(e){for(var t=1;t=0)&&(r[a]=e[a]);return r}function eq(e){p.useEffect(e,[])}function Jg(e,t){t===void 0&&(t={});var r=t,n=r.volume,a=n===void 0?1:n,o=r.playbackRate,i=o===void 0?1:o,s=r.soundEnabled,l=s===void 0?!0:s,u=r.interrupt,f=u===void 0?!1:u,c=r.onload,d=JK(r,["id","volume","playbackRate","soundEnabled","interrupt","onload"]),h=Y.useRef(null),g=Y.useRef(!1),m=Y.useState(null),w=m[0],v=m[1],b=Y.useState(null),_=b[0],$=b[1],C=function(){typeof c=="function"&&c.call(this),g.current&&v(this.duration()*1e3),$(this)};eq(function(){return Je(()=>Promise.resolve().then(()=>mse),void 0,import.meta.url).then(function(k){if(!g.current){var N;h.current=(N=k.Howl)!==null&&N!==void 0?N:k.default.Howl,g.current=!0,new h.current(zv({src:Array.isArray(e)?e:[e],volume:a,rate:i,onload:C},d))}}),function(){g.current=!1}}),Y.useEffect(function(){h.current&&_&&$(new h.current(zv({src:Array.isArray(e)?e:[e],volume:a,onload:C},d)))},[JSON.stringify(e)]),Y.useEffect(function(){_&&(_.volume(a),_.rate(i))},[a,i]);var O=Y.useCallback(function(k){typeof k>"u"&&(k={}),!(!_||!l&&!k.forceSoundEnabled)&&(f&&_.stop(),k.playbackRate&&_.rate(k.playbackRate),_.play(k.id))},[_,l,f]),x=Y.useCallback(function(k){_&&_.stop(k)},[_]),S=Y.useCallback(function(k){_&&_.pause(k)},[_]),A=[O,{sound:_,stop:x,pause:S,duration:w}];return A}globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};const El="https://dict.youdao.com/dictvoice?audio=";function pN(e,t){switch(t){case"uk":return`${El}${e}&type=1`;case"us":return`${El}${e}&type=2`;case"romaji":return`${El}${YK(e)}&le=jap`;case"zh":return`${El}${e}&le=zh`;case"ja":return`${El}${e}&le=jap`;case"de":return`${El}${e}&le=de`}}function gN(e,t){const r=oe(To),n=p.useMemo(()=>typeof t=="boolean"?t:r.isLoop,[t,r.isLoop]),[a,o]=p.useState(!1),[i,{stop:s,sound:l}]=Jg(pN(e,r.type),{html5:!0,format:["mp3"],loop:n,volume:r.volume,rate:r.rate});return p.useEffect(()=>{if(l)return l.loop(n),Qg},[n,l]),p.useEffect(()=>{if(!l)return;const u=[];return u.push(Rp(l,"play",()=>o(!0))),u.push(Rp(l,"end",()=>o(!1))),u.push(Rp(l,"pause",()=>o(!1))),u.push(Rp(l,"playerror",()=>o(!1))),()=>{o(!1),u.forEach(f=>f()),l.unload()}},[l]),{play:i,stop:s,isPlaying:a}}function tq(e){const t=oe(To);p.useEffect(()=>{if(!e)return;const r=pN(e,t.type),n=document.head;if(!Array.from(n.querySelectorAll("link[href]")).some(o=>o.href===r)){const o=new Audio;return o.src=r,o.preload="auto",o.crossOrigin="anonymous",o.style.display="none",n.appendChild(o),()=>{n.removeChild(o)}}},[t.type,e])}globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};const m0=Y.forwardRef(({word:e,className:t,iconClassName:r},n)=>{const{play:a,stop:o,isPlaying:i}=gN(e),s=p.useCallback(()=>{o(),a()},[a,o]);return p.useEffect(()=>o,[e,o]),p.useImperativeHandle(n,()=>({play:s}),[s]),y(hN,{animated:i,onClick:s,className:`cursor-pointer text-gray-600 ${t}`,iconClassName:r})});m0.displayName="WordPronunciationIcon";globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};function vN({word:e}){const t=oe(yh),r=oe(vh);return L("div",{className:`space-x-5 text-center text-sm font-normal text-gray-600 transition-colors duration-300 dark:text-gray-400 ${r&&"select-text"}`,children:[t.type==="us"&&e.usphone&&e.usphone.length>1&&y("span",{children:`AmE: [${e.usphone}]`}),t.type==="uk"&&e.ukphone&&e.ukphone.length>1&&y("span",{children:`BrE: [${e.ukphone}]`})]})}globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};const rq={true:{normal:"text-gray-400",correct:"text-green-400 dark:text-green-700",wrong:"text-red-400 dark:text-red-600"},false:{normal:"text-gray-600 dark:text-gray-50",correct:"text-green-600 dark:text-green-400",wrong:"text-red-600 dark:text-red-400"}},nq=({letter:e,state:t="normal",visible:r=!0})=>{const n=oe(wS);return y("span",{className:`m-0 p-0 font-mono font-normal ${rq[e===T_][t]} pr-0.8 duration-0 dark:text-opacity-80`,style:{fontSize:n.foreignFont.toString()+"px"},children:r?e:"_"})},mN=Y.memo(nq),aq=e=>y("svg",{viewBox:"0 0 20 20",width:"1.2em",height:"1.2em",...e,children:L("g",{fill:"currentColor",children:[y("path",{d:"M12 9a1 1 0 0 1-1-1V3c0-.553.45-1.008.997-.93a7.004 7.004 0 0 1 5.933 5.933c.078.547-.378.997-.93.997h-5Z"}),y("path",{d:"M8.003 4.07C8.55 3.992 9 4.447 9 5v5a1 1 0 0 0 1 1h5c.552 0 1.008.45.93.997A7.001 7.001 0 0 1 2 11a7.002 7.002 0 0 1 6.003-6.93Z"})]})}),oq=e=>y("svg",{viewBox:"0 0 20 20",width:"1.2em",height:"1.2em",...e,children:y("path",{fill:"currentColor",fillRule:"evenodd",d:"M10 18a8 8 0 1 0 0-16a8 8 0 0 0 0 16Zm3.857-9.809a.75.75 0 0 0-1.214-.882l-3.483 4.79l-1.88-1.88a.75.75 0 1 0-1.06 1.061l2.5 2.5a.75.75 0 0 0 1.137-.089l4-5.5Z",clipRule:"evenodd"})}),iq=e=>y("svg",{viewBox:"0 0 20 20",width:"1.2em",height:"1.2em",...e,children:y("path",{fill:"currentColor",fillRule:"evenodd",d:"M10 18a8 8 0 1 0 0-16a8 8 0 0 0 0 16Zm.75-13a.75.75 0 0 0-1.5 0v5c0 .414.336.75.75.75h4a.75.75 0 0 0 0-1.5h-3.25V5Z",clipRule:"evenodd"})}),sq=e=>y("svg",{viewBox:"0 0 20 20",width:"1.2em",height:"1.2em",...e,children:y("path",{fill:"currentColor",fillRule:"evenodd",d:"M10 18a8 8 0 1 0 0-16a8 8 0 0 0 0 16ZM8.28 7.22a.75.75 0 0 0-1.06 1.06L8.94 10l-1.72 1.72a.75.75 0 1 0 1.06 1.06L10 11.06l1.72 1.72a.75.75 0 1 0 1.06-1.06L11.06 10l1.72-1.72a.75.75 0 0 0-1.06-1.06L10 8.94L8.28 7.22Z",clipRule:"evenodd"})}),gu=e=>y("svg",{viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...e,children:y("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M18 6L6 18M6 6l12 12"})});globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};const lq=({currentRowDetail:e,allRecords:t})=>{const r=wa(dh),n=Ef[e.dict],{word:a,isLoading:o,hasError:i}=n8(e.word,n),s=p.useRef(null),l=p.useMemo(()=>{const c=((e.records.length>0?e.records.reduce((m,w)=>m+w.totalTime,0)/e.records.length:0)/1e3).toFixed(2),d=e.records.length,h=e.wrongCount,g=d+h;return{time:c,sumCount:g,correctCount:d,wrongCount:h}},[e.records,e.wrongCount]),u=p.useCallback(()=>{r(null)},[r]);return Yt("esc",f=>{u(),f.stopPropagation()},{preventDefault:!0}),Yt("ctrl+j",()=>{var f;(f=s.current)==null||f.play()},[],{enableOnFormTags:!0,preventDefault:!0}),L("div",{className:"absolute inset-0 flex flex-col items-center justify-center ",children:[L("div",{className:"my-card relative z-10 flex h-[32rem] min-w-[26rem] select-text flex-col items-center justify-around rounded-2xl bg-white px-3 py-10 dark:bg-gray-900",children:[y(gu,{className:"absolute right-3 top-3 h-6 w-6 cursor-pointer text-gray-400",onClick:u}),L("div",{className:"flex flex-col items-center justify-start",children:[y("div",{children:e.word.split("").map((f,c)=>y(mN,{letter:f,visible:!0,state:"normal"},`${c}-${f}`))}),L("div",{className:"relative flex h-8 items-center",children:[a?y(vN,{word:a}):y(__,{isLoading:o,hasError:i}),a&&y(m0,{word:a.name,className:"absolute -right-7 top-1/2 h-5 w-5 -translate-y-1/2 transform ",ref:s})]}),y("div",{className:"flex max-w-[24rem] items-center",children:y("span",{className:"max-w-4xl text-center font-sans transition-colors duration-300 dark:text-white dark:text-opacity-80",children:a?a.trans.join(";"):y(__,{isLoading:o,hasError:i})})})]}),L("div",{className:"item flex flex-col gap-4",children:[L("div",{className:"flex gap-6",children:[y(Op,{icon:iq,name:"平均用时",data:l.time}),y(Op,{icon:aq,name:"练习次数",data:l.sumCount})]}),L("div",{className:"flex gap-6",children:[y(Op,{icon:oq,name:"正确次数",data:l.correctCount}),y(Op,{icon:sq,name:"错误次数",data:l.wrongCount})]})]}),y(VK,{className:"absolute bottom-6 mt-10",allRecords:t})]}),y("div",{className:"absolute inset-0 z-0 cursor-pointer bg-transparent",onClick:u})]})};function te(){return te=Object.assign?Object.assign.bind():function(e){for(var t=1;tt in e?IQ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,eb=(e,t,r)=>(NQ(e,typeof t!="symbol"?t+"":t,r),r);let LQ=class{constructor(){eb(this,"current",this.detect()),eb(this,"handoffState","pending"),eb(this,"currentId",0)}set(t){this.current!==t&&(this.handoffState="pending",this.currentId=0,this.current=t)}reset(){this.set(this.detect())}nextId(){return++this.currentId}get isServer(){return this.current==="server"}get isClient(){return this.current==="client"}detect(){return typeof window>"u"||typeof document>"u"?"server":"client"}handoff(){this.handoffState==="pending"&&(this.handoffState="complete")}get isHandoffComplete(){return this.handoffState==="complete"}},lo=new LQ,gt=(e,t)=>{lo.isServer?p.useEffect(e,t):p.useLayoutEffect(e,t)};function dr(e){let t=p.useRef(e);return gt(()=>{t.current=e},[e]),t}function tD(e,t){let[r,n]=p.useState(e),a=dr(e);return gt(()=>n(a.current),[a,n,...t]),r}function Cu(e){typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e).catch(t=>setTimeout(()=>{throw t}))}function yo(){let e=[],t={addEventListener(r,n,a,o){return r.addEventListener(n,a,o),t.add(()=>r.removeEventListener(n,a,o))},requestAnimationFrame(...r){let n=requestAnimationFrame(...r);return t.add(()=>cancelAnimationFrame(n))},nextFrame(...r){return t.requestAnimationFrame(()=>t.requestAnimationFrame(...r))},setTimeout(...r){let n=setTimeout(...r);return t.add(()=>clearTimeout(n))},microTask(...r){let n={current:!0};return Cu(()=>{n.current&&r[0]()}),t.add(()=>{n.current=!1})},style(r,n,a){let o=r.style.getPropertyValue(n);return Object.assign(r.style,{[n]:a}),this.add(()=>{Object.assign(r.style,{[n]:o})})},group(r){let n=yo();return r(n),this.add(()=>n.dispose())},add(r){return e.push(r),()=>{let n=e.indexOf(r);if(n>=0)for(let a of e.splice(n,1))a()}},dispose(){for(let r of e.splice(0))r()}};return t}function ji(){let[e]=p.useState(yo);return p.useEffect(()=>()=>e.dispose(),[e]),e}let re=function(e){let t=dr(e);return Y.useCallback((...r)=>t.current(...r),[t])};function Tu(){let[e,t]=p.useState(lo.isHandoffComplete);return e&&lo.isHandoffComplete===!1&&t(!1),p.useEffect(()=>{e!==!0&&t(!0)},[e]),p.useEffect(()=>lo.handoff(),[]),e}var D3;let kt=(D3=Y.useId)!=null?D3:function(){let e=Tu(),[t,r]=Y.useState(e?()=>lo.nextId():null);return gt(()=>{t===null&&r(lo.nextId())},[t]),t!=null?""+t:void 0};function Re(e,t,...r){if(e in t){let a=t[e];return typeof a=="function"?a(...r):a}let n=new Error(`Tried to handle "${e}" but there is no handler defined. Only defined handlers are: ${Object.keys(t).map(a=>`"${a}"`).join(", ")}.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Re),n}function Ah(e){return lo.isServer?null:e instanceof Node?e.ownerDocument:e!=null&&e.hasOwnProperty("current")&&e.current instanceof Node?e.current.ownerDocument:document}let o2=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].map(e=>`${e}:not([tabindex='-1'])`).join(",");var et=(e=>(e[e.First=1]="First",e[e.Previous=2]="Previous",e[e.Next=4]="Next",e[e.Last=8]="Last",e[e.WrapAround=16]="WrapAround",e[e.NoScroll=32]="NoScroll",e))(et||{}),to=(e=>(e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e))(to||{}),MQ=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))(MQ||{});function F0(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(o2)).sort((t,r)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(r.tabIndex||Number.MAX_SAFE_INTEGER)))}var B0=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(B0||{});function BE(e,t=0){var r;return e===((r=Ah(e))==null?void 0:r.body)?!1:Re(t,{[0](){return e.matches(o2)},[1](){let n=e;for(;n!==null;){if(n.matches(o2))return!0;n=n.parentElement}return!1}})}var DQ=(e=>(e[e.Keyboard=0]="Keyboard",e[e.Mouse=1]="Mouse",e))(DQ||{});typeof window<"u"&&typeof document<"u"&&(document.addEventListener("keydown",e=>{e.metaKey||e.altKey||e.ctrlKey||(document.documentElement.dataset.headlessuiFocusVisible="")},!0),document.addEventListener("click",e=>{e.detail===1?delete document.documentElement.dataset.headlessuiFocusVisible:e.detail===0&&(document.documentElement.dataset.headlessuiFocusVisible="")},!0));function zs(e){e==null||e.focus({preventScroll:!0})}let jQ=["textarea","input"].join(",");function FQ(e){var t,r;return(r=(t=e==null?void 0:e.matches)==null?void 0:t.call(e,jQ))!=null?r:!1}function ks(e,t=r=>r){return e.slice().sort((r,n)=>{let a=t(r),o=t(n);if(a===null||o===null)return 0;let i=a.compareDocumentPosition(o);return i&Node.DOCUMENT_POSITION_FOLLOWING?-1:i&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function qt(e,t,{sorted:r=!0,relativeTo:n=null,skipElements:a=[]}={}){let o=Array.isArray(e)?e.length>0?e[0].ownerDocument:document:e.ownerDocument,i=Array.isArray(e)?r?ks(e):e:F0(e);a.length>0&&i.length>1&&(i=i.filter(h=>!a.includes(h))),n=n??o.activeElement;let s=(()=>{if(t&5)return 1;if(t&10)return-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),l=(()=>{if(t&1)return 0;if(t&2)return Math.max(0,i.indexOf(n))-1;if(t&4)return Math.max(0,i.indexOf(n))+1;if(t&8)return i.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),u=t&32?{preventScroll:!0}:{},f=0,c=i.length,d;do{if(f>=c||f+c<=0)return 0;let h=l+f;if(t&16)h=(h+c)%c;else{if(h<0)return 3;if(h>=c)return 1}d=i[h],d==null||d.focus(u),f+=s}while(d!==o.activeElement);return t&6&&FQ(d)&&d.select(),2}function tb(e,t,r){let n=dr(t);p.useEffect(()=>{function a(o){n.current(o)}return document.addEventListener(e,a,r),()=>document.removeEventListener(e,a,r)},[e,r])}function UE(e,t,r=!0){let n=p.useRef(!1);p.useEffect(()=>{requestAnimationFrame(()=>{n.current=r})},[r]);function a(i,s){if(!n.current||i.defaultPrevented)return;let l=function f(c){return typeof c=="function"?f(c()):Array.isArray(c)||c instanceof Set?c:[c]}(e),u=s(i);if(u!==null&&u.getRootNode().contains(u)){for(let f of l){if(f===null)continue;let c=f instanceof HTMLElement?f:f.current;if(c!=null&&c.contains(u)||i.composed&&i.composedPath().includes(c))return}return!BE(u,B0.Loose)&&u.tabIndex!==-1&&i.preventDefault(),t(i,u)}}let o=p.useRef(null);tb("mousedown",i=>{var s,l;n.current&&(o.current=((l=(s=i.composedPath)==null?void 0:s.call(i))==null?void 0:l[0])||i.target)},!0),tb("click",i=>{o.current&&(a(i,()=>o.current),o.current=null)},!0),tb("blur",i=>a(i,()=>window.document.activeElement instanceof HTMLIFrameElement?window.document.activeElement:null),!0)}function j3(e){var t;if(e.type)return e.type;let r=(t=e.as)!=null?t:"button";if(typeof r=="string"&&r.toLowerCase()==="button")return"button"}function U0(e,t){let[r,n]=p.useState(()=>j3(e));return gt(()=>{n(j3(e))},[e.type,e.as]),gt(()=>{r||t.current&&t.current instanceof HTMLButtonElement&&!t.current.hasAttribute("type")&&n("button")},[r,t]),r}let rD=Symbol();function nD(e,t=!0){return Object.assign(e,{[rD]:t})}function We(...e){let t=p.useRef(e);p.useEffect(()=>{t.current=e},[e]);let r=re(n=>{for(let a of t.current)a!=null&&(typeof a=="function"?a(n):a.current=n)});return e.every(n=>n==null||(n==null?void 0:n[rD]))?void 0:r}function BQ(e){throw new Error("Unexpected object: "+e)}var Pr=(e=>(e[e.First=0]="First",e[e.Previous=1]="Previous",e[e.Next=2]="Next",e[e.Last=3]="Last",e[e.Specific=4]="Specific",e[e.Nothing=5]="Nothing",e))(Pr||{});function UQ(e,t){let r=t.resolveItems();if(r.length<=0)return null;let n=t.resolveActiveIndex(),a=n??-1,o=(()=>{switch(e.focus){case 0:return r.findIndex(i=>!t.resolveDisabled(i));case 1:{let i=r.slice().reverse().findIndex((s,l,u)=>a!==-1&&u.length-l-1>=a?!1:!t.resolveDisabled(s));return i===-1?i:r.length-1-i}case 2:return r.findIndex((i,s)=>s<=a?!1:!t.resolveDisabled(i));case 3:{let i=r.slice().reverse().findIndex(s=>!t.resolveDisabled(s));return i===-1?i:r.length-1-i}case 4:return r.findIndex(i=>t.resolveId(i)===e.id);case 5:return null;default:BQ(e)}})();return o===-1?n:o}function i2(...e){return e.filter(Boolean).join(" ")}var kn=(e=>(e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e))(kn||{}),ro=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(ro||{});function Fe({ourProps:e,theirProps:t,slot:r,defaultTag:n,features:a,visible:o=!0,name:i}){let s=aD(t,e);if(o)return qp(s,r,n,i);let l=a??0;if(l&2){let{static:u=!1,...f}=s;if(u)return qp(f,r,n,i)}if(l&1){let{unmount:u=!0,...f}=s;return Re(u?0:1,{[0](){return null},[1](){return qp({...f,hidden:!0,style:{display:"none"}},r,n,i)}})}return qp(s,r,n,i)}function qp(e,t={},r,n){let{as:a=r,children:o,refName:i="ref",...s}=rb(e,["unmount","static"]),l=e.ref!==void 0?{[i]:e.ref}:{},u=typeof o=="function"?o(t):o;"className"in s&&s.className&&typeof s.className=="function"&&(s.className=s.className(t));let f={};if(t){let c=!1,d=[];for(let[h,g]of Object.entries(t))typeof g=="boolean"&&(c=!0),g===!0&&d.push(h);c&&(f["data-headlessui-state"]=d.join(" "))}if(a===p.Fragment&&Object.keys(wm(s)).length>0){if(!p.isValidElement(u)||Array.isArray(u)&&u.length>1)throw new Error(['Passing props on "Fragment"!',"",`The current component <${n} /> is rendering a "Fragment".`,"However we need to passthrough the following props:",Object.keys(s).map(g=>` - ${g}`).join(` `),"","You can apply a few solutions:",['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".',"Render a single element as the child so that we can forward the props onto that element."].map(g=>` - ${g}`).join(` `)].join(` -`));let c=u.props,d=typeof(c==null?void 0:c.className)=="function"?(...g)=>i2(c==null?void 0:c.className(...g),s.className):i2(c==null?void 0:c.className,s.className),h=d?{className:d}:{};return p.cloneElement(u,Object.assign({},aD(u.props,wm(rb(s,["ref"]))),f,l,zQ(u.ref,l.ref),h))}return p.createElement(a,Object.assign({},rb(s,["ref"]),a!==p.Fragment&&l,a!==p.Fragment&&f),u)}function zQ(...e){return{ref:e.every(t=>t==null)?void 0:t=>{for(let r of e)r!=null&&(typeof r=="function"?r(t):r.current=t)}}}function aD(...e){if(e.length===0)return{};if(e.length===1)return e[0];let t={},r={};for(let n of e)for(let a in n)a.startsWith("on")&&typeof n[a]=="function"?(r[a]!=null||(r[a]=[]),r[a].push(n[a])):t[a]=n[a];if(t.disabled||t["aria-disabled"])return Object.assign(t,Object.fromEntries(Object.keys(r).map(n=>[n,void 0])));for(let n in r)Object.assign(t,{[n](a,...o){let i=r[n];for(let s of i){if((a instanceof Event||(a==null?void 0:a.nativeEvent)instanceof Event)&&a.defaultPrevented)return;s(a,...o)}}});return t}function Be(e){var t;return Object.assign(p.forwardRef(e),{displayName:(t=e.displayName)!=null?t:e.name})}function wm(e){let t=Object.assign({},e);for(let r in t)t[r]===void 0&&delete t[r];return t}function rb(e,t=[]){let r=Object.assign({},e);for(let n of t)n in r&&delete r[n];return r}function Rh(e){let t=e.parentElement,r=null;for(;t&&!(t instanceof HTMLFieldSetElement);)t instanceof HTMLLegendElement&&(r=t),t=t.parentElement;let n=(t==null?void 0:t.getAttribute("disabled"))==="";return n&&VQ(r)?!1:n}function VQ(e){if(!e)return!1;let t=e.previousElementSibling;for(;t!==null;){if(t instanceof HTMLLegendElement)return!1;t=t.previousElementSibling}return!0}function oD(e={},t=null,r=[]){for(let[n,a]of Object.entries(e))sD(r,iD(t,n),a);return r}function iD(e,t){return e?e+"["+t+"]":t}function sD(e,t,r){if(Array.isArray(r))for(let[n,a]of r.entries())sD(e,iD(t,n.toString()),a);else r instanceof Date?e.push([t,r.toISOString()]):typeof r=="boolean"?e.push([t,r?"1":"0"]):typeof r=="string"?e.push([t,r]):typeof r=="number"?e.push([t,`${r}`]):r==null?e.push([t,""]):oD(r,t,e)}function WQ(e){var t;let r=(t=e==null?void 0:e.form)!=null?t:e.closest("form");if(r){for(let n of r.elements)if(n.tagName==="INPUT"&&n.type==="submit"||n.tagName==="BUTTON"&&n.type==="submit"||n.nodeName==="INPUT"&&n.type==="image"){n.click();return}}}let HQ="div";var Ea=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(Ea||{});function GQ(e,t){let{features:r=1,...n}=e,a={ref:t,"aria-hidden":(r&2)===2?!0:void 0,style:{position:"fixed",top:1,left:1,width:1,height:0,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0",...(r&4)===4&&(r&2)!==2&&{display:"none"}}};return Fe({ourProps:a,theirProps:n,slot:{},defaultTag:HQ,name:"Hidden"})}let Ca=Be(GQ),zE=p.createContext(null);zE.displayName="OpenClosedContext";var ut=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))(ut||{});function Au(){return p.useContext(zE)}function VE({value:e,children:t}){return Y.createElement(zE.Provider,{value:e},t)}var ye=(e=>(e.Space=" ",e.Enter="Enter",e.Escape="Escape",e.Backspace="Backspace",e.Delete="Delete",e.ArrowLeft="ArrowLeft",e.ArrowUp="ArrowUp",e.ArrowRight="ArrowRight",e.ArrowDown="ArrowDown",e.Home="Home",e.End="End",e.PageUp="PageUp",e.PageDown="PageDown",e.Tab="Tab",e))(ye||{});function lD(e,t,r){let[n,a]=p.useState(r),o=e!==void 0,i=p.useRef(o),s=p.useRef(!1),l=p.useRef(!1);return o&&!i.current&&!s.current?(s.current=!0,i.current=o):!o&&i.current&&!l.current&&(l.current=!0,i.current=o),[o?e:n,re(u=>(o||a(u),t==null?void 0:t(u)))]}function WE(e,t){let r=p.useRef([]),n=re(e);p.useEffect(()=>{let a=[...r.current];for(let[o,i]of t.entries())if(r.current[o]!==i){let s=n(t,a);return r.current=t,s}},[n,...t])}function F3(e){return[e.screenX,e.screenY]}function KQ(){let e=p.useRef([-1,-1]);return{wasMoved(t){let r=F3(t);return e.current[0]===r[0]&&e.current[1]===r[1]?!1:(e.current=r,!0)},update(t){e.current=F3(t)}}}function qQ(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function YQ(e,t,r){let n=dr(t);p.useEffect(()=>{function a(o){n.current(o)}return window.addEventListener(e,a,r),()=>window.removeEventListener(e,a,r)},[e,r])}var Zr=(e=>(e[e.Forwards=0]="Forwards",e[e.Backwards=1]="Backwards",e))(Zr||{});function HE(){let e=p.useRef(0);return YQ("keydown",t=>{t.key==="Tab"&&(e.current=t.shiftKey?1:0)},!0),e}function Oh(){let e=p.useRef(!1);return gt(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function hl(...e){return p.useMemo(()=>Ah(...e),[...e])}function GE(e,t,r,n){let a=dr(r);p.useEffect(()=>{e=e??window;function o(i){a.current(i)}return e.addEventListener(t,o,n),()=>e.removeEventListener(t,o,n)},[e,t,n])}function ZQ(e){function t(){document.readyState!=="loading"&&(e(),document.removeEventListener("DOMContentLoaded",t))}typeof window<"u"&&typeof document<"u"&&(document.addEventListener("DOMContentLoaded",t),t())}function cD(e){if(!e)return new Set;if(typeof e=="function")return new Set(e());let t=new Set;for(let r of e.current)r.current instanceof HTMLElement&&t.add(r.current);return t}let XQ="div";var uD=(e=>(e[e.None=1]="None",e[e.InitialFocus=2]="InitialFocus",e[e.TabLock=4]="TabLock",e[e.FocusLock=8]="FocusLock",e[e.RestoreFocus=16]="RestoreFocus",e[e.All=30]="All",e))(uD||{});function QQ(e,t){let r=p.useRef(null),n=We(r,t),{initialFocus:a,containers:o,features:i=30,...s}=e;Tu()||(i=1);let l=hl(r);tJ({ownerDocument:l},!!(i&16));let u=rJ({ownerDocument:l,container:r,initialFocus:a},!!(i&2));nJ({ownerDocument:l,container:r,containers:o,previousActiveElement:u},!!(i&8));let f=HE(),c=re(m=>{let w=r.current;w&&(v=>v())(()=>{Re(f.current,{[Zr.Forwards]:()=>{qt(w,et.First,{skipElements:[m.relatedTarget]})},[Zr.Backwards]:()=>{qt(w,et.Last,{skipElements:[m.relatedTarget]})}})})}),d=ji(),h=p.useRef(!1),g={ref:n,onKeyDown(m){m.key=="Tab"&&(h.current=!0,d.requestAnimationFrame(()=>{h.current=!1}))},onBlur(m){let w=cD(o);r.current instanceof HTMLElement&&w.add(r.current);let v=m.relatedTarget;v instanceof HTMLElement&&v.dataset.headlessuiFocusGuard!=="true"&&(dD(w,v)||(h.current?qt(r.current,Re(f.current,{[Zr.Forwards]:()=>et.Next,[Zr.Backwards]:()=>et.Previous})|et.WrapAround,{relativeTo:m.target}):m.target instanceof HTMLElement&&zs(m.target)))}};return Y.createElement(Y.Fragment,null,!!(i&4)&&Y.createElement(Ca,{as:"button",type:"button","data-headlessui-focus-guard":!0,onFocus:c,features:Ea.Focusable}),Fe({ourProps:g,theirProps:s,defaultTag:XQ,name:"FocusTrap"}),!!(i&4)&&Y.createElement(Ca,{as:"button",type:"button","data-headlessui-focus-guard":!0,onFocus:c,features:Ea.Focusable}))}let JQ=Be(QQ),sd=Object.assign(JQ,{features:uD}),ni=[];ZQ(()=>{function e(t){t.target instanceof HTMLElement&&t.target!==document.body&&ni[0]!==t.target&&(ni.unshift(t.target),ni=ni.filter(r=>r!=null&&r.isConnected),ni.splice(10))}window.addEventListener("click",e,{capture:!0}),window.addEventListener("mousedown",e,{capture:!0}),window.addEventListener("focus",e,{capture:!0}),document.body.addEventListener("click",e,{capture:!0}),document.body.addEventListener("mousedown",e,{capture:!0}),document.body.addEventListener("focus",e,{capture:!0})});function eJ(e=!0){let t=p.useRef(ni.slice());return WE(([r],[n])=>{n===!0&&r===!1&&Cu(()=>{t.current.splice(0)}),n===!1&&r===!0&&(t.current=ni.slice())},[e,ni,t]),re(()=>{var r;return(r=t.current.find(n=>n!=null&&n.isConnected))!=null?r:null})}function tJ({ownerDocument:e},t){let r=eJ(t);WE(()=>{t||(e==null?void 0:e.activeElement)===(e==null?void 0:e.body)&&zs(r())},[t]);let n=p.useRef(!1);p.useEffect(()=>(n.current=!1,()=>{n.current=!0,Cu(()=>{n.current&&zs(r())})}),[])}function rJ({ownerDocument:e,container:t,initialFocus:r},n){let a=p.useRef(null),o=Oh();return WE(()=>{if(!n)return;let i=t.current;i&&Cu(()=>{if(!o.current)return;let s=e==null?void 0:e.activeElement;if(r!=null&&r.current){if((r==null?void 0:r.current)===s){a.current=s;return}}else if(i.contains(s)){a.current=s;return}r!=null&&r.current?zs(r.current):(qt(i,et.First),to.Error),a.current=e==null?void 0:e.activeElement})},[n]),a}function nJ({ownerDocument:e,container:t,containers:r,previousActiveElement:n},a){let o=Oh();GE(e==null?void 0:e.defaultView,"focus",i=>{if(!a||!o.current)return;let s=cD(r);t.current instanceof HTMLElement&&s.add(t.current);let l=n.current;if(!l)return;let u=i.target;u&&u instanceof HTMLElement?dD(s,u)?(n.current=u,zs(u)):(i.preventDefault(),i.stopPropagation(),zs(l)):zs(n.current)},!0)}function dD(e,t){for(let r of e)if(r.contains(t))return!0;return!1}let fD=p.createContext(!1);function aJ(){return p.useContext(fD)}function s2(e){return Y.createElement(fD.Provider,{value:e.force},e.children)}function oJ(e){let t=aJ(),r=p.useContext(hD),n=hl(e),[a,o]=p.useState(()=>{if(!t&&r!==null||lo.isServer)return null;let i=n==null?void 0:n.getElementById("headlessui-portal-root");if(i)return i;if(n===null)return null;let s=n.createElement("div");return s.setAttribute("id","headlessui-portal-root"),n.body.appendChild(s)});return p.useEffect(()=>{a!==null&&(n!=null&&n.body.contains(a)||n==null||n.body.appendChild(a))},[a,n]),p.useEffect(()=>{t||r!==null&&o(r.current)},[r,o,t]),a}let iJ=p.Fragment;function sJ(e,t){let r=e,n=p.useRef(null),a=We(nD(f=>{n.current=f}),t),o=hl(n),i=oJ(n),[s]=p.useState(()=>{var f;return lo.isServer?null:(f=o==null?void 0:o.createElement("div"))!=null?f:null}),l=Tu(),u=p.useRef(!1);return gt(()=>{if(u.current=!1,!(!i||!s))return i.contains(s)||(s.setAttribute("data-headlessui-portal",""),i.appendChild(s)),()=>{u.current=!0,Cu(()=>{var f;u.current&&(!i||!s||(s instanceof Node&&i.contains(s)&&i.removeChild(s),i.childNodes.length<=0&&((f=i.parentElement)==null||f.removeChild(i))))})}},[i,s]),l?!i||!s?null:Qi.createPortal(Fe({ourProps:{ref:a},theirProps:r,defaultTag:iJ,name:"Portal"}),s):null}let lJ=p.Fragment,hD=p.createContext(null);function cJ(e,t){let{target:r,...n}=e,a={ref:We(t)};return Y.createElement(hD.Provider,{value:r},Fe({ourProps:a,theirProps:n,defaultTag:lJ,name:"Popover.Group"}))}let uJ=Be(sJ),dJ=Be(cJ),l2=Object.assign(uJ,{Group:dJ}),pD=p.createContext(null);function gD(){let e=p.useContext(pD);if(e===null){let t=new Error("You used a component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(t,gD),t}return e}function vD(){let[e,t]=p.useState([]);return[e.length>0?e.join(" "):void 0,p.useMemo(()=>function(r){let n=re(o=>(t(i=>[...i,o]),()=>t(i=>{let s=i.slice(),l=s.indexOf(o);return l!==-1&&s.splice(l,1),s}))),a=p.useMemo(()=>({register:n,slot:r.slot,name:r.name,props:r.props}),[n,r.slot,r.name,r.props]);return Y.createElement(pD.Provider,{value:a},r.children)},[t])]}let fJ="p";function hJ(e,t){let r=kt(),{id:n=`headlessui-description-${r}`,...a}=e,o=gD(),i=We(t);gt(()=>o.register(n),[n,o.register]);let s={ref:i,...o.props,id:n};return Fe({ourProps:s,theirProps:a,slot:o.slot||{},defaultTag:fJ,name:o.name||"Description"})}let pJ=Be(hJ),mD=Object.assign(pJ,{}),KE=p.createContext(()=>{});KE.displayName="StackContext";var c2=(e=>(e[e.Add=0]="Add",e[e.Remove=1]="Remove",e))(c2||{});function gJ(){return p.useContext(KE)}function vJ({children:e,onUpdate:t,type:r,element:n,enabled:a}){let o=gJ(),i=re((...s)=>{t==null||t(...s),o(...s)});return gt(()=>{let s=a===void 0||a===!0;return s&&i(0,r,n),()=>{s&&i(1,r,n)}},[i,r,n,a]),Y.createElement(KE.Provider,{value:i},e)}function mJ(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}const yJ=typeof Object.is=="function"?Object.is:mJ,{useState:bJ,useEffect:wJ,useLayoutEffect:_J,useDebugValue:$J}=Gs;function xJ(e,t,r){const n=t(),[{inst:a},o]=bJ({inst:{value:n,getSnapshot:t}});return _J(()=>{a.value=n,a.getSnapshot=t,nb(a)&&o({inst:a})},[e,n,t]),wJ(()=>(nb(a)&&o({inst:a}),e(()=>{nb(a)&&o({inst:a})})),[e]),$J(n),n}function nb(e){const t=e.getSnapshot,r=e.value;try{const n=t();return!yJ(r,n)}catch{return!0}}function SJ(e,t,r){return t()}const EJ=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",CJ=!EJ,TJ=CJ?SJ:xJ,AJ="useSyncExternalStore"in Gs?(e=>e.useSyncExternalStore)(Gs):TJ;function RJ(e){return AJ(e.subscribe,e.getSnapshot,e.getSnapshot)}function OJ(e,t){let r=e(),n=new Set;return{getSnapshot(){return r},subscribe(a){return n.add(a),()=>n.delete(a)},dispatch(a,...o){let i=t[a].call(r,...o);i&&(r=i,n.forEach(s=>s()))}}}function kJ(){let e;return{before({doc:t}){var r;let n=t.documentElement;e=((r=t.defaultView)!=null?r:window).innerWidth-n.clientWidth},after({doc:t,d:r}){let n=t.documentElement,a=n.clientWidth-n.offsetWidth,o=e-a;r.style(n,"paddingRight",`${o}px`)}}}function PJ(){if(!qQ())return{};let e;return{before(){e=window.pageYOffset},after({doc:t,d:r,meta:n}){function a(i){return n.containers.flatMap(s=>s()).some(s=>s.contains(i))}r.style(t.body,"marginTop",`-${e}px`),window.scrollTo(0,0);let o=null;r.addEventListener(t,"click",i=>{if(i.target instanceof HTMLElement)try{let s=i.target.closest("a");if(!s)return;let{hash:l}=new URL(s.href),u=t.querySelector(l);u&&!a(u)&&(o=u)}catch{}},!0),r.addEventListener(t,"touchmove",i=>{i.target instanceof HTMLElement&&!a(i.target)&&i.preventDefault()},{passive:!1}),r.add(()=>{window.scrollTo(0,window.pageYOffset+e),o&&o.isConnected&&(o.scrollIntoView({block:"nearest"}),o=null)})}}}function IJ(){return{before({doc:e,d:t}){t.style(e.documentElement,"overflow","hidden")}}}function NJ(e){let t={};for(let r of e)Object.assign(t,r(t));return t}let Ps=OJ(()=>new Map,{PUSH(e,t){var r;let n=(r=this.get(e))!=null?r:{doc:e,count:0,d:yo(),meta:new Set};return n.count++,n.meta.add(t),this.set(e,n),this},POP(e,t){let r=this.get(e);return r&&(r.count--,r.meta.delete(t)),this},SCROLL_PREVENT({doc:e,d:t,meta:r}){let n={doc:e,d:t,meta:NJ(r)},a=[PJ(),kJ(),IJ()];a.forEach(({before:o})=>o==null?void 0:o(n)),a.forEach(({after:o})=>o==null?void 0:o(n))},SCROLL_ALLOW({d:e}){e.dispose()},TEARDOWN({doc:e}){this.delete(e)}});Ps.subscribe(()=>{let e=Ps.getSnapshot(),t=new Map;for(let[r]of e)t.set(r,r.documentElement.style.overflow);for(let r of e.values()){let n=t.get(r.doc)==="hidden",a=r.count!==0;(a&&!n||!a&&n)&&Ps.dispatch(r.count>0?"SCROLL_PREVENT":"SCROLL_ALLOW",r),r.count===0&&Ps.dispatch("TEARDOWN",r)}});function LJ(e,t,r){let n=RJ(Ps),a=e?n.get(e):void 0,o=a?a.count>0:!1;return gt(()=>{if(!(!e||!t))return Ps.dispatch("PUSH",e,r),()=>Ps.dispatch("POP",e,r)},[t,e]),o}let ab=new Map,ld=new Map;function B3(e,t=!0){gt(()=>{var r;if(!t)return;let n=typeof e=="function"?e():e.current;if(!n)return;function a(){var i;if(!n)return;let s=(i=ld.get(n))!=null?i:1;if(s===1?ld.delete(n):ld.set(n,s-1),s!==1)return;let l=ab.get(n);l&&(l["aria-hidden"]===null?n.removeAttribute("aria-hidden"):n.setAttribute("aria-hidden",l["aria-hidden"]),n.inert=l.inert,ab.delete(n))}let o=(r=ld.get(n))!=null?r:0;return ld.set(n,o+1),o!==0||(ab.set(n,{"aria-hidden":n.getAttribute("aria-hidden"),inert:n.inert}),n.setAttribute("aria-hidden","true"),n.inert=!0),a},[e,t])}var MJ=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(MJ||{}),DJ=(e=>(e[e.SetTitleId=0]="SetTitleId",e))(DJ||{});let jJ={[0](e,t){return e.titleId===t.id?e:{...e,titleId:t.id}}},_m=p.createContext(null);_m.displayName="DialogContext";function kh(e){let t=p.useContext(_m);if(t===null){let r=new Error(`<${e} /> is missing a parent component.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,kh),r}return t}function FJ(e,t,r=()=>[document.body]){LJ(e,t,n=>{var a;return{containers:[...(a=n.containers)!=null?a:[],r]}})}function BJ(e,t){return Re(t.type,jJ,e,t)}let UJ="div",zJ=kn.RenderStrategy|kn.Static;function VJ(e,t){let r=kt(),{id:n=`headlessui-dialog-${r}`,open:a,onClose:o,initialFocus:i,__demoMode:s=!1,...l}=e,[u,f]=p.useState(0),c=Au();a===void 0&&c!==null&&(a=(c&ut.Open)===ut.Open);let d=p.useRef(null),h=We(d,t),g=p.useRef(null),m=hl(d),w=e.hasOwnProperty("open")||c!==null,v=e.hasOwnProperty("onClose");if(!w&&!v)throw new Error("You have to provide an `open` and an `onClose` prop to the `Dialog` component.");if(!w)throw new Error("You provided an `onClose` prop to the `Dialog`, but forgot an `open` prop.");if(!v)throw new Error("You provided an `open` prop to the `Dialog`, but forgot an `onClose` prop.");if(typeof a!="boolean")throw new Error(`You provided an \`open\` prop to the \`Dialog\`, but the value is not a boolean. Received: ${a}`);if(typeof o!="function")throw new Error(`You provided an \`onClose\` prop to the \`Dialog\`, but the value is not a function. Received: ${o}`);let b=a?0:1,[_,$]=p.useReducer(BJ,{titleId:null,descriptionId:null,panelRef:p.createRef()}),C=re(()=>o(!1)),O=re(K=>$({type:0,id:K})),x=Tu()?s?!1:b===0:!1,S=u>1,A=p.useContext(_m)!==null,k=S?"parent":"leaf",N=c!==null?(c&ut.Closing)===ut.Closing:!1,P=(()=>A||N?!1:x)(),I=p.useCallback(()=>{var K,Q;return(Q=Array.from((K=m==null?void 0:m.querySelectorAll("body > *"))!=null?K:[]).find(J=>J.id==="headlessui-portal-root"?!1:J.contains(g.current)&&J instanceof HTMLElement))!=null?Q:null},[g]);B3(I,P);let E=(()=>S?!0:x)(),R=p.useCallback(()=>{var K,Q;return(Q=Array.from((K=m==null?void 0:m.querySelectorAll("[data-headlessui-portal]"))!=null?K:[]).find(J=>J.contains(g.current)&&J instanceof HTMLElement))!=null?Q:null},[g]);B3(R,E);let F=re(()=>{var K,Q;return[...Array.from((K=m==null?void 0:m.querySelectorAll("html > *, body > *, [data-headlessui-portal]"))!=null?K:[]).filter(J=>!(J===document.body||J===document.head||!(J instanceof HTMLElement)||J.contains(g.current)||_.panelRef.current&&J.contains(_.panelRef.current))),(Q=_.panelRef.current)!=null?Q:d.current]}),B=(()=>!(!x||S))();UE(()=>F(),C,B);let j=(()=>!(S||b!==0))();GE(m==null?void 0:m.defaultView,"keydown",K=>{j&&(K.defaultPrevented||K.key===ye.Escape&&(K.preventDefault(),K.stopPropagation(),C()))});let M=(()=>!(N||b!==0||A))();FJ(m,M,F),p.useEffect(()=>{if(b!==0||!d.current)return;let K=new ResizeObserver(Q=>{for(let J of Q){let de=J.target.getBoundingClientRect();de.x===0&&de.y===0&&de.width===0&&de.height===0&&C()}});return K.observe(d.current),()=>K.disconnect()},[b,d,C]);let[D,U]=vD(),V=p.useMemo(()=>[{dialogState:b,close:C,setTitleId:O},_],[b,_,C,O]),G=p.useMemo(()=>({open:b===0}),[b]),H={ref:h,id:n,role:"dialog","aria-modal":b===0?!0:void 0,"aria-labelledby":_.titleId,"aria-describedby":D};return Y.createElement(vJ,{type:"Dialog",enabled:b===0,element:d,onUpdate:re((K,Q)=>{Q==="Dialog"&&Re(K,{[c2.Add]:()=>f(J=>J+1),[c2.Remove]:()=>f(J=>J-1)})})},Y.createElement(s2,{force:!0},Y.createElement(l2,null,Y.createElement(_m.Provider,{value:V},Y.createElement(l2.Group,{target:d},Y.createElement(s2,{force:!1},Y.createElement(U,{slot:G,name:"Dialog.Description"},Y.createElement(sd,{initialFocus:i,containers:F,features:x?Re(k,{parent:sd.features.RestoreFocus,leaf:sd.features.All&~sd.features.FocusLock}):sd.features.None},Fe({ourProps:H,theirProps:l,slot:G,defaultTag:UJ,features:zJ,visible:b===0,name:"Dialog"})))))))),Y.createElement(Ca,{features:Ea.Hidden,ref:g}))}let WJ="div";function HJ(e,t){let r=kt(),{id:n=`headlessui-dialog-overlay-${r}`,...a}=e,[{dialogState:o,close:i}]=kh("Dialog.Overlay"),s=We(t),l=re(f=>{if(f.target===f.currentTarget){if(Rh(f.currentTarget))return f.preventDefault();f.preventDefault(),f.stopPropagation(),i()}}),u=p.useMemo(()=>({open:o===0}),[o]);return Fe({ourProps:{ref:s,id:n,"aria-hidden":!0,onClick:l},theirProps:a,slot:u,defaultTag:WJ,name:"Dialog.Overlay"})}let GJ="div";function KJ(e,t){let r=kt(),{id:n=`headlessui-dialog-backdrop-${r}`,...a}=e,[{dialogState:o},i]=kh("Dialog.Backdrop"),s=We(t);p.useEffect(()=>{if(i.panelRef.current===null)throw new Error("A component is being used, but a component is missing.")},[i.panelRef]);let l=p.useMemo(()=>({open:o===0}),[o]);return Y.createElement(s2,{force:!0},Y.createElement(l2,null,Fe({ourProps:{ref:s,id:n,"aria-hidden":!0},theirProps:a,slot:l,defaultTag:GJ,name:"Dialog.Backdrop"})))}let qJ="div";function YJ(e,t){let r=kt(),{id:n=`headlessui-dialog-panel-${r}`,...a}=e,[{dialogState:o},i]=kh("Dialog.Panel"),s=We(t,i.panelRef),l=p.useMemo(()=>({open:o===0}),[o]),u=re(f=>{f.stopPropagation()});return Fe({ourProps:{ref:s,id:n,onClick:u},theirProps:a,slot:l,defaultTag:qJ,name:"Dialog.Panel"})}let ZJ="h2";function XJ(e,t){let r=kt(),{id:n=`headlessui-dialog-title-${r}`,...a}=e,[{dialogState:o,setTitleId:i}]=kh("Dialog.Title"),s=We(t);p.useEffect(()=>(i(n),()=>i(null)),[n,i]);let l=p.useMemo(()=>({open:o===0}),[o]);return Fe({ourProps:{ref:s,id:n},theirProps:a,slot:l,defaultTag:ZJ,name:"Dialog.Title"})}let QJ=Be(VJ),JJ=Be(KJ),eee=Be(YJ),tee=Be(HJ),ree=Be(XJ),yr=Object.assign(QJ,{Backdrop:JJ,Panel:eee,Overlay:tee,Title:ree,Description:mD});var nee=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(nee||{}),aee=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(aee||{}),oee=(e=>(e[e.Pointer=0]="Pointer",e[e.Other=1]="Other",e))(oee||{}),iee=(e=>(e[e.OpenListbox=0]="OpenListbox",e[e.CloseListbox=1]="CloseListbox",e[e.GoToOption=2]="GoToOption",e[e.Search=3]="Search",e[e.ClearSearch=4]="ClearSearch",e[e.RegisterOption=5]="RegisterOption",e[e.UnregisterOption=6]="UnregisterOption",e[e.RegisterLabel=7]="RegisterLabel",e))(iee||{});function ob(e,t=r=>r){let r=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,n=ks(t(e.options.slice()),o=>o.dataRef.current.domRef.current),a=r?n.indexOf(r):null;return a===-1&&(a=null),{options:n,activeOptionIndex:a}}let see={[1](e){return e.dataRef.current.disabled||e.listboxState===1?e:{...e,activeOptionIndex:null,listboxState:1}},[0](e){if(e.dataRef.current.disabled||e.listboxState===0)return e;let t=e.activeOptionIndex,{isSelected:r}=e.dataRef.current,n=e.options.findIndex(a=>r(a.dataRef.current.value));return n!==-1&&(t=n),{...e,listboxState:0,activeOptionIndex:t}},[2](e,t){var r;if(e.dataRef.current.disabled||e.listboxState===1)return e;let n=ob(e),a=UQ(t,{resolveItems:()=>n.options,resolveActiveIndex:()=>n.activeOptionIndex,resolveId:o=>o.id,resolveDisabled:o=>o.dataRef.current.disabled});return{...e,...n,searchQuery:"",activeOptionIndex:a,activationTrigger:(r=t.trigger)!=null?r:1}},[3]:(e,t)=>{if(e.dataRef.current.disabled||e.listboxState===1)return e;let r=e.searchQuery!==""?0:1,n=e.searchQuery+t.value.toLowerCase(),a=(e.activeOptionIndex!==null?e.options.slice(e.activeOptionIndex+r).concat(e.options.slice(0,e.activeOptionIndex+r)):e.options).find(i=>{var s;return!i.dataRef.current.disabled&&((s=i.dataRef.current.textValue)==null?void 0:s.startsWith(n))}),o=a?e.options.indexOf(a):-1;return o===-1||o===e.activeOptionIndex?{...e,searchQuery:n}:{...e,searchQuery:n,activeOptionIndex:o,activationTrigger:1}},[4](e){return e.dataRef.current.disabled||e.listboxState===1||e.searchQuery===""?e:{...e,searchQuery:""}},[5]:(e,t)=>{let r={id:t.id,dataRef:t.dataRef},n=ob(e,a=>[...a,r]);return e.activeOptionIndex===null&&e.dataRef.current.isSelected(t.dataRef.current.value)&&(n.activeOptionIndex=n.options.indexOf(r)),{...e,...n}},[6]:(e,t)=>{let r=ob(e,n=>{let a=n.findIndex(o=>o.id===t.id);return a!==-1&&n.splice(a,1),n});return{...e,...r,activationTrigger:1}},[7]:(e,t)=>({...e,labelId:t.id})},qE=p.createContext(null);qE.displayName="ListboxActionsContext";function Ph(e){let t=p.useContext(qE);if(t===null){let r=new Error(`<${e} /> is missing a parent component.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,Ph),r}return t}let YE=p.createContext(null);YE.displayName="ListboxDataContext";function Ih(e){let t=p.useContext(YE);if(t===null){let r=new Error(`<${e} /> is missing a parent component.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,Ih),r}return t}function lee(e,t){return Re(t.type,see,e,t)}let cee=p.Fragment;function uee(e,t){let{value:r,defaultValue:n,form:a,name:o,onChange:i,by:s=(H,K)=>H===K,disabled:l=!1,horizontal:u=!1,multiple:f=!1,...c}=e;const d=u?"horizontal":"vertical";let h=We(t),[g=f?[]:void 0,m]=lD(r,i,n),[w,v]=p.useReducer(lee,{dataRef:p.createRef(),listboxState:1,options:[],searchQuery:"",labelId:null,activeOptionIndex:null,activationTrigger:1}),b=p.useRef({static:!1,hold:!1}),_=p.useRef(null),$=p.useRef(null),C=p.useRef(null),O=re(typeof s=="string"?(H,K)=>{let Q=s;return(H==null?void 0:H[Q])===(K==null?void 0:K[Q])}:s),x=p.useCallback(H=>Re(S.mode,{[1]:()=>g.some(K=>O(K,H)),[0]:()=>O(g,H)}),[g]),S=p.useMemo(()=>({...w,value:g,disabled:l,mode:f?1:0,orientation:d,compare:O,isSelected:x,optionsPropsRef:b,labelRef:_,buttonRef:$,optionsRef:C}),[g,l,f,w]);gt(()=>{w.dataRef.current=S},[S]),UE([S.buttonRef,S.optionsRef],(H,K)=>{var Q;v({type:1}),BE(K,B0.Loose)||(H.preventDefault(),(Q=S.buttonRef.current)==null||Q.focus())},S.listboxState===0);let A=p.useMemo(()=>({open:S.listboxState===0,disabled:l,value:g}),[S,l,g]),k=re(H=>{let K=S.options.find(Q=>Q.id===H);K&&B(K.dataRef.current.value)}),N=re(()=>{if(S.activeOptionIndex!==null){let{dataRef:H,id:K}=S.options[S.activeOptionIndex];B(H.current.value),v({type:2,focus:Pr.Specific,id:K})}}),P=re(()=>v({type:0})),I=re(()=>v({type:1})),E=re((H,K,Q)=>H===Pr.Specific?v({type:2,focus:Pr.Specific,id:K,trigger:Q}):v({type:2,focus:H,trigger:Q})),R=re((H,K)=>(v({type:5,id:H,dataRef:K}),()=>v({type:6,id:H}))),F=re(H=>(v({type:7,id:H}),()=>v({type:7,id:null}))),B=re(H=>Re(S.mode,{[0](){return m==null?void 0:m(H)},[1](){let K=S.value.slice(),Q=K.findIndex(J=>O(J,H));return Q===-1?K.push(H):K.splice(Q,1),m==null?void 0:m(K)}})),j=re(H=>v({type:3,value:H})),M=re(()=>v({type:4})),D=p.useMemo(()=>({onChange:B,registerOption:R,registerLabel:F,goToOption:E,closeListbox:I,openListbox:P,selectActiveOption:N,selectOption:k,search:j,clearSearch:M}),[]),U={ref:h},V=p.useRef(null),G=ji();return p.useEffect(()=>{V.current&&n!==void 0&&G.addEventListener(V.current,"reset",()=>{B(n)})},[V,B]),Y.createElement(qE.Provider,{value:D},Y.createElement(YE.Provider,{value:S},Y.createElement(VE,{value:Re(S.listboxState,{[0]:ut.Open,[1]:ut.Closed})},o!=null&&g!=null&&oD({[o]:g}).map(([H,K],Q)=>Y.createElement(Ca,{features:Ea.Hidden,ref:Q===0?J=>{var de;V.current=(de=J==null?void 0:J.closest("form"))!=null?de:null}:void 0,...wm({key:H,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:a,name:H,value:K})})),Fe({ourProps:U,theirProps:c,slot:A,defaultTag:cee,name:"Listbox"}))))}let dee="button";function fee(e,t){var r;let n=kt(),{id:a=`headlessui-listbox-button-${n}`,...o}=e,i=Ih("Listbox.Button"),s=Ph("Listbox.Button"),l=We(i.buttonRef,t),u=ji(),f=re(w=>{switch(w.key){case ye.Space:case ye.Enter:case ye.ArrowDown:w.preventDefault(),s.openListbox(),u.nextFrame(()=>{i.value||s.goToOption(Pr.First)});break;case ye.ArrowUp:w.preventDefault(),s.openListbox(),u.nextFrame(()=>{i.value||s.goToOption(Pr.Last)});break}}),c=re(w=>{switch(w.key){case ye.Space:w.preventDefault();break}}),d=re(w=>{if(Rh(w.currentTarget))return w.preventDefault();i.listboxState===0?(s.closeListbox(),u.nextFrame(()=>{var v;return(v=i.buttonRef.current)==null?void 0:v.focus({preventScroll:!0})})):(w.preventDefault(),s.openListbox())}),h=tD(()=>{if(i.labelId)return[i.labelId,a].join(" ")},[i.labelId,a]),g=p.useMemo(()=>({open:i.listboxState===0,disabled:i.disabled,value:i.value}),[i]),m={ref:l,id:a,type:U0(e,i.buttonRef),"aria-haspopup":"listbox","aria-controls":(r=i.optionsRef.current)==null?void 0:r.id,"aria-expanded":i.disabled?void 0:i.listboxState===0,"aria-labelledby":h,disabled:i.disabled,onKeyDown:f,onKeyUp:c,onClick:d};return Fe({ourProps:m,theirProps:o,slot:g,defaultTag:dee,name:"Listbox.Button"})}let hee="label";function pee(e,t){let r=kt(),{id:n=`headlessui-listbox-label-${r}`,...a}=e,o=Ih("Listbox.Label"),i=Ph("Listbox.Label"),s=We(o.labelRef,t);gt(()=>i.registerLabel(n),[n]);let l=re(()=>{var f;return(f=o.buttonRef.current)==null?void 0:f.focus({preventScroll:!0})}),u=p.useMemo(()=>({open:o.listboxState===0,disabled:o.disabled}),[o]);return Fe({ourProps:{ref:s,id:n,onClick:l},theirProps:a,slot:u,defaultTag:hee,name:"Listbox.Label"})}let gee="ul",vee=kn.RenderStrategy|kn.Static;function mee(e,t){var r;let n=kt(),{id:a=`headlessui-listbox-options-${n}`,...o}=e,i=Ih("Listbox.Options"),s=Ph("Listbox.Options"),l=We(i.optionsRef,t),u=ji(),f=ji(),c=Au(),d=(()=>c!==null?(c&ut.Open)===ut.Open:i.listboxState===0)();p.useEffect(()=>{var v;let b=i.optionsRef.current;b&&i.listboxState===0&&b!==((v=Ah(b))==null?void 0:v.activeElement)&&b.focus({preventScroll:!0})},[i.listboxState,i.optionsRef]);let h=re(v=>{switch(f.dispose(),v.key){case ye.Space:if(i.searchQuery!=="")return v.preventDefault(),v.stopPropagation(),s.search(v.key);case ye.Enter:if(v.preventDefault(),v.stopPropagation(),i.activeOptionIndex!==null){let{dataRef:b}=i.options[i.activeOptionIndex];s.onChange(b.current.value)}i.mode===0&&(s.closeListbox(),yo().nextFrame(()=>{var b;return(b=i.buttonRef.current)==null?void 0:b.focus({preventScroll:!0})}));break;case Re(i.orientation,{vertical:ye.ArrowDown,horizontal:ye.ArrowRight}):return v.preventDefault(),v.stopPropagation(),s.goToOption(Pr.Next);case Re(i.orientation,{vertical:ye.ArrowUp,horizontal:ye.ArrowLeft}):return v.preventDefault(),v.stopPropagation(),s.goToOption(Pr.Previous);case ye.Home:case ye.PageUp:return v.preventDefault(),v.stopPropagation(),s.goToOption(Pr.First);case ye.End:case ye.PageDown:return v.preventDefault(),v.stopPropagation(),s.goToOption(Pr.Last);case ye.Escape:return v.preventDefault(),v.stopPropagation(),s.closeListbox(),u.nextFrame(()=>{var b;return(b=i.buttonRef.current)==null?void 0:b.focus({preventScroll:!0})});case ye.Tab:v.preventDefault(),v.stopPropagation();break;default:v.key.length===1&&(s.search(v.key),f.setTimeout(()=>s.clearSearch(),350));break}}),g=tD(()=>{var v,b,_;return(_=(v=i.labelRef.current)==null?void 0:v.id)!=null?_:(b=i.buttonRef.current)==null?void 0:b.id},[i.labelRef.current,i.buttonRef.current]),m=p.useMemo(()=>({open:i.listboxState===0}),[i]),w={"aria-activedescendant":i.activeOptionIndex===null||(r=i.options[i.activeOptionIndex])==null?void 0:r.id,"aria-multiselectable":i.mode===1?!0:void 0,"aria-labelledby":g,"aria-orientation":i.orientation,id:a,onKeyDown:h,role:"listbox",tabIndex:0,ref:l};return Fe({ourProps:w,theirProps:o,slot:m,defaultTag:gee,features:vee,visible:d,name:"Listbox.Options"})}let yee="li";function bee(e,t){let r=kt(),{id:n=`headlessui-listbox-option-${r}`,disabled:a=!1,value:o,...i}=e,s=Ih("Listbox.Option"),l=Ph("Listbox.Option"),u=s.activeOptionIndex!==null?s.options[s.activeOptionIndex].id===n:!1,f=s.isSelected(o),c=p.useRef(null),d=dr({disabled:a,value:o,domRef:c,get textValue(){var C,O;return(O=(C=c.current)==null?void 0:C.textContent)==null?void 0:O.toLowerCase()}}),h=We(t,c);gt(()=>{if(s.listboxState!==0||!u||s.activationTrigger===0)return;let C=yo();return C.requestAnimationFrame(()=>{var O,x;(x=(O=c.current)==null?void 0:O.scrollIntoView)==null||x.call(O,{block:"nearest"})}),C.dispose},[c,u,s.listboxState,s.activationTrigger,s.activeOptionIndex]),gt(()=>l.registerOption(n,d),[d,n]);let g=re(C=>{if(a)return C.preventDefault();l.onChange(o),s.mode===0&&(l.closeListbox(),yo().nextFrame(()=>{var O;return(O=s.buttonRef.current)==null?void 0:O.focus({preventScroll:!0})}))}),m=re(()=>{if(a)return l.goToOption(Pr.Nothing);l.goToOption(Pr.Specific,n)}),w=KQ(),v=re(C=>w.update(C)),b=re(C=>{w.wasMoved(C)&&(a||u||l.goToOption(Pr.Specific,n,0))}),_=re(C=>{w.wasMoved(C)&&(a||u&&l.goToOption(Pr.Nothing))}),$=p.useMemo(()=>({active:u,selected:f,disabled:a}),[u,f,a]);return Fe({ourProps:{id:n,ref:h,role:"option",tabIndex:a===!0?void 0:-1,"aria-disabled":a===!0?!0:void 0,"aria-selected":f,disabled:void 0,onClick:g,onFocus:m,onPointerEnter:v,onMouseEnter:v,onPointerMove:b,onMouseMove:b,onPointerLeave:_,onMouseLeave:_},theirProps:i,slot:$,defaultTag:yee,name:"Listbox.Option"})}let wee=Be(uee),_ee=Be(fee),$ee=Be(pee),xee=Be(mee),See=Be(bee),ur=Object.assign(wee,{Button:_ee,Label:$ee,Options:xee,Option:See});var Eee=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(Eee||{}),Cee=(e=>(e[e.TogglePopover=0]="TogglePopover",e[e.ClosePopover=1]="ClosePopover",e[e.SetButton=2]="SetButton",e[e.SetButtonId=3]="SetButtonId",e[e.SetPanel=4]="SetPanel",e[e.SetPanelId=5]="SetPanelId",e))(Cee||{});let Tee={[0]:e=>({...e,popoverState:Re(e.popoverState,{[0]:1,[1]:0})}),[1](e){return e.popoverState===1?e:{...e,popoverState:1}},[2](e,t){return e.button===t.button?e:{...e,button:t.button}},[3](e,t){return e.buttonId===t.buttonId?e:{...e,buttonId:t.buttonId}},[4](e,t){return e.panel===t.panel?e:{...e,panel:t.panel}},[5](e,t){return e.panelId===t.panelId?e:{...e,panelId:t.panelId}}},ZE=p.createContext(null);ZE.displayName="PopoverContext";function z0(e){let t=p.useContext(ZE);if(t===null){let r=new Error(`<${e} /> is missing a parent component.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,z0),r}return t}let XE=p.createContext(null);XE.displayName="PopoverAPIContext";function QE(e){let t=p.useContext(XE);if(t===null){let r=new Error(`<${e} /> is missing a parent component.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,QE),r}return t}let JE=p.createContext(null);JE.displayName="PopoverGroupContext";function yD(){return p.useContext(JE)}let V0=p.createContext(null);V0.displayName="PopoverPanelContext";function Aee(){return p.useContext(V0)}function Ree(e,t){return Re(t.type,Tee,e,t)}let Oee="div";function kee(e,t){var r;let n=p.useRef(null),a=We(t,nD(P=>{n.current=P})),o=p.useRef([]),i=p.useReducer(Ree,{popoverState:1,buttons:o,button:null,buttonId:null,panel:null,panelId:null,beforePanelSentinel:p.createRef(),afterPanelSentinel:p.createRef()}),[{popoverState:s,button:l,buttonId:u,panel:f,panelId:c,beforePanelSentinel:d,afterPanelSentinel:h},g]=i,m=hl((r=n.current)!=null?r:l),w=p.useMemo(()=>{if(!l||!f)return!1;for(let j of document.querySelectorAll("body > *"))if(Number(j==null?void 0:j.contains(l))^Number(j==null?void 0:j.contains(f)))return!0;let P=F0(),I=P.indexOf(l),E=(I+P.length-1)%P.length,R=(I+1)%P.length,F=P[E],B=P[R];return!f.contains(F)&&!f.contains(B)},[l,f]),v=dr(u),b=dr(c),_=p.useMemo(()=>({buttonId:v,panelId:b,close:()=>g({type:1})}),[v,b,g]),$=yD(),C=$==null?void 0:$.registerPopover,O=re(()=>{var P;return(P=$==null?void 0:$.isFocusWithinPopoverGroup())!=null?P:(m==null?void 0:m.activeElement)&&((l==null?void 0:l.contains(m.activeElement))||(f==null?void 0:f.contains(m.activeElement)))});p.useEffect(()=>C==null?void 0:C(_),[C,_]),GE(m==null?void 0:m.defaultView,"focus",P=>{var I,E,R,F;s===0&&(O()||l&&f&&P.target!==window&&((E=(I=d.current)==null?void 0:I.contains)!=null&&E.call(I,P.target)||(F=(R=h.current)==null?void 0:R.contains)!=null&&F.call(R,P.target)||g({type:1})))},!0),UE([l,f],(P,I)=>{g({type:1}),BE(I,B0.Loose)||(P.preventDefault(),l==null||l.focus())},s===0);let x=re(P=>{g({type:1});let I=(()=>P?P instanceof HTMLElement?P:"current"in P&&P.current instanceof HTMLElement?P.current:l:l)();I==null||I.focus()}),S=p.useMemo(()=>({close:x,isPortalled:w}),[x,w]),A=p.useMemo(()=>({open:s===0,close:x}),[s,x]),k=e,N={ref:a};return Y.createElement(V0.Provider,{value:null},Y.createElement(ZE.Provider,{value:i},Y.createElement(XE.Provider,{value:S},Y.createElement(VE,{value:Re(s,{[0]:ut.Open,[1]:ut.Closed})},Fe({ourProps:N,theirProps:k,slot:A,defaultTag:Oee,name:"Popover"})))))}let Pee="button";function Iee(e,t){let r=kt(),{id:n=`headlessui-popover-button-${r}`,...a}=e,[o,i]=z0("Popover.Button"),{isPortalled:s}=QE("Popover.Button"),l=p.useRef(null),u=`headlessui-focus-sentinel-${kt()}`,f=yD(),c=f==null?void 0:f.closeOthers,d=Aee()!==null;p.useEffect(()=>{if(!d)return i({type:3,buttonId:n}),()=>{i({type:3,buttonId:null})}},[d,n,i]);let[h]=p.useState(()=>Symbol()),g=We(l,t,d?null:N=>{if(N)o.buttons.current.push(h);else{let P=o.buttons.current.indexOf(h);P!==-1&&o.buttons.current.splice(P,1)}o.buttons.current.length>1,N&&i({type:2,button:N})}),m=We(l,t),w=hl(l),v=re(N=>{var P,I,E;if(d){if(o.popoverState===1)return;switch(N.key){case ye.Space:case ye.Enter:N.preventDefault(),(I=(P=N.target).click)==null||I.call(P),i({type:1}),(E=o.button)==null||E.focus();break}}else switch(N.key){case ye.Space:case ye.Enter:N.preventDefault(),N.stopPropagation(),o.popoverState===1&&(c==null||c(o.buttonId)),i({type:0});break;case ye.Escape:if(o.popoverState!==0)return c==null?void 0:c(o.buttonId);if(!l.current||w!=null&&w.activeElement&&!l.current.contains(w.activeElement))return;N.preventDefault(),N.stopPropagation(),i({type:1});break}}),b=re(N=>{d||N.key===ye.Space&&N.preventDefault()}),_=re(N=>{var P,I;Rh(N.currentTarget)||e.disabled||(d?(i({type:1}),(P=o.button)==null||P.focus()):(N.preventDefault(),N.stopPropagation(),o.popoverState===1&&(c==null||c(o.buttonId)),i({type:0}),(I=o.button)==null||I.focus()))}),$=re(N=>{N.preventDefault(),N.stopPropagation()}),C=o.popoverState===0,O=p.useMemo(()=>({open:C}),[C]),x=U0(e,l),S=d?{ref:m,type:x,onKeyDown:v,onClick:_}:{ref:g,id:o.buttonId,type:x,"aria-expanded":e.disabled?void 0:o.popoverState===0,"aria-controls":o.panel?o.panelId:void 0,onKeyDown:v,onKeyUp:b,onClick:_,onMouseDown:$},A=HE(),k=re(()=>{let N=o.panel;if(!N)return;function P(){Re(A.current,{[Zr.Forwards]:()=>qt(N,et.First),[Zr.Backwards]:()=>qt(N,et.Last)})===to.Error&&qt(F0().filter(I=>I.dataset.headlessuiFocusGuard!=="true"),Re(A.current,{[Zr.Forwards]:et.Next,[Zr.Backwards]:et.Previous}),{relativeTo:o.button})}P()});return Y.createElement(Y.Fragment,null,Fe({ourProps:S,theirProps:a,slot:O,defaultTag:Pee,name:"Popover.Button"}),C&&!d&&s&&Y.createElement(Ca,{id:u,features:Ea.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:k}))}let Nee="div",Lee=kn.RenderStrategy|kn.Static;function Mee(e,t){let r=kt(),{id:n=`headlessui-popover-overlay-${r}`,...a}=e,[{popoverState:o},i]=z0("Popover.Overlay"),s=We(t),l=Au(),u=(()=>l!==null?(l&ut.Open)===ut.Open:o===0)(),f=re(d=>{if(Rh(d.currentTarget))return d.preventDefault();i({type:1})}),c=p.useMemo(()=>({open:o===0}),[o]);return Fe({ourProps:{ref:s,id:n,"aria-hidden":!0,onClick:f},theirProps:a,slot:c,defaultTag:Nee,features:Lee,visible:u,name:"Popover.Overlay"})}let Dee="div",jee=kn.RenderStrategy|kn.Static;function Fee(e,t){let r=kt(),{id:n=`headlessui-popover-panel-${r}`,focus:a=!1,...o}=e,[i,s]=z0("Popover.Panel"),{close:l,isPortalled:u}=QE("Popover.Panel"),f=`headlessui-focus-sentinel-before-${kt()}`,c=`headlessui-focus-sentinel-after-${kt()}`,d=p.useRef(null),h=We(d,t,x=>{s({type:4,panel:x})}),g=hl(d);gt(()=>(s({type:5,panelId:n}),()=>{s({type:5,panelId:null})}),[n,s]);let m=Au(),w=(()=>m!==null?(m&ut.Open)===ut.Open:i.popoverState===0)(),v=re(x=>{var S;switch(x.key){case ye.Escape:if(i.popoverState!==0||!d.current||g!=null&&g.activeElement&&!d.current.contains(g.activeElement))return;x.preventDefault(),x.stopPropagation(),s({type:1}),(S=i.button)==null||S.focus();break}});p.useEffect(()=>{var x;e.static||i.popoverState===1&&((x=e.unmount)==null||x)&&s({type:4,panel:null})},[i.popoverState,e.unmount,e.static,s]),p.useEffect(()=>{if(!a||i.popoverState!==0||!d.current)return;let x=g==null?void 0:g.activeElement;d.current.contains(x)||qt(d.current,et.First)},[a,d,i.popoverState]);let b=p.useMemo(()=>({open:i.popoverState===0,close:l}),[i,l]),_={ref:h,id:n,onKeyDown:v,onBlur:a&&i.popoverState===0?x=>{var S,A,k,N,P;let I=x.relatedTarget;I&&d.current&&((S=d.current)!=null&&S.contains(I)||(s({type:1}),((k=(A=i.beforePanelSentinel.current)==null?void 0:A.contains)!=null&&k.call(A,I)||(P=(N=i.afterPanelSentinel.current)==null?void 0:N.contains)!=null&&P.call(N,I))&&I.focus({preventScroll:!0})))}:void 0,tabIndex:-1},$=HE(),C=re(()=>{let x=d.current;if(!x)return;function S(){Re($.current,{[Zr.Forwards]:()=>{var A;qt(x,et.First)===to.Error&&((A=i.afterPanelSentinel.current)==null||A.focus())},[Zr.Backwards]:()=>{var A;(A=i.button)==null||A.focus({preventScroll:!0})}})}S()}),O=re(()=>{let x=d.current;if(!x)return;function S(){Re($.current,{[Zr.Forwards]:()=>{var A;if(!i.button)return;let k=F0(),N=k.indexOf(i.button),P=k.slice(0,N+1),I=[...k.slice(N+1),...P];for(let E of I.slice())if(E.dataset.headlessuiFocusGuard==="true"||(A=i.panel)!=null&&A.contains(E)){let R=I.indexOf(E);R!==-1&&I.splice(R,1)}qt(I,et.First,{sorted:!1})},[Zr.Backwards]:()=>{var A;qt(x,et.Previous)===to.Error&&((A=i.button)==null||A.focus())}})}S()});return Y.createElement(V0.Provider,{value:n},w&&u&&Y.createElement(Ca,{id:f,ref:i.beforePanelSentinel,features:Ea.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:C}),Fe({ourProps:_,theirProps:o,slot:b,defaultTag:Dee,features:jee,visible:w,name:"Popover.Panel"}),w&&u&&Y.createElement(Ca,{id:c,ref:i.afterPanelSentinel,features:Ea.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:O}))}let Bee="div";function Uee(e,t){let r=p.useRef(null),n=We(r,t),[a,o]=p.useState([]),i=re(g=>{o(m=>{let w=m.indexOf(g);if(w!==-1){let v=m.slice();return v.splice(w,1),v}return m})}),s=re(g=>(o(m=>[...m,g]),()=>i(g))),l=re(()=>{var g;let m=Ah(r);if(!m)return!1;let w=m.activeElement;return(g=r.current)!=null&&g.contains(w)?!0:a.some(v=>{var b,_;return((b=m.getElementById(v.buttonId.current))==null?void 0:b.contains(w))||((_=m.getElementById(v.panelId.current))==null?void 0:_.contains(w))})}),u=re(g=>{for(let m of a)m.buttonId.current!==g&&m.close()}),f=p.useMemo(()=>({registerPopover:s,unregisterPopover:i,isFocusWithinPopoverGroup:l,closeOthers:u}),[s,i,l,u]),c=p.useMemo(()=>({}),[]),d=e,h={ref:n};return Y.createElement(JE.Provider,{value:f},Fe({ourProps:h,theirProps:d,slot:c,defaultTag:Bee,name:"Popover.Group"}))}let zee=Be(kee),Vee=Be(Iee),Wee=Be(Mee),Hee=Be(Fee),Gee=Be(Uee),An=Object.assign(zee,{Button:Vee,Overlay:Wee,Panel:Hee,Group:Gee});function Kee(e=0){let[t,r]=p.useState(e),n=Oh(),a=p.useCallback(l=>{n.current&&r(u=>u|l)},[t,n]),o=p.useCallback(l=>!!(t&l),[t]),i=p.useCallback(l=>{n.current&&r(u=>u&~l)},[r,n]),s=p.useCallback(l=>{n.current&&r(u=>u^l)},[r]);return{flags:t,addFlag:a,hasFlag:o,removeFlag:i,toggleFlag:s}}let bD=p.createContext(null);function wD(){let e=p.useContext(bD);if(e===null){let t=new Error("You used a