@openloaf/openspeech-frontend 0.2.36 → 0.2.37

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import{r as m,R as dh,a as R$,g as Ci,b as ye,i as ie,c as sb,k as M$,d as lb,u as I$,e as cb,f as D$,h as cn,B as ub,j as bo,S as cT,l as Ce,m as L$,n as f,X as Sr,o as ri,p as F1,q as Lf,s as db,t as cf,v as $$,w as z$,x as F$,y as B$,z as Pm,A as tn,C as je,D as fb,E as fh,F as wv,M as W$,G as pb,H as hb,I as Er,J as B1,K as uT,L as dT,N as H$,W as U$,O as V$,P as q$}from"./App-CwCuun8F.js";var fT=e=>{throw TypeError(e)},pT=(e,t,n)=>t.has(e)||fT("Cannot "+n),Yr=(e,t,n)=>(pT(e,t,"read from private field"),n?n.call(e):t.get(e)),_c=(e,t,n)=>t.has(e)?fT("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Oi=(e,t,n,r)=>(pT(e,t,"write to private field"),t.set(e,n),n),W1="popstate";function H1(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function K$(e={}){function t(r,i){let a=i.state?.masked,{pathname:o,search:s,hash:l}=a||r.location;return Zc("",{pathname:o,search:s,hash:l},i.state&&i.state.usr||null,i.state&&i.state.key||"default",a?{pathname:r.location.pathname,search:r.location.search,hash:r.location.hash}:void 0)}function n(r,i){return typeof i=="string"?i:Ji(i)}return Y$(t,n,null,e)}function at(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function un(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function G$(){return Math.random().toString(36).substring(2,10)}function U1(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function Zc(e,t,n=null,r,i){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?ca(t):t,state:n,key:t&&t.key||r||G$(),mask:i}}function Ji({pathname:e="/",search:t="",hash:n=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function ca(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function Y$(e,t,n,r={}){let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,s="POP",l=null,c=d();c==null&&(c=0,o.replaceState({...o.state,idx:c},""));function d(){return(o.state||{idx:null}).idx}function u(){s="POP";let x=d(),v=x==null?null:x-c;c=x,l&&l({action:s,location:g.location,delta:v})}function p(x,v){s="PUSH";let b=H1(x)?x:Zc(g.location,x,v);c=d()+1;let w=U1(b,c),_=g.createHref(b.mask||b);try{o.pushState(w,"",_)}catch(k){if(k instanceof DOMException&&k.name==="DataCloneError")throw k;i.location.assign(_)}a&&l&&l({action:s,location:g.location,delta:1})}function h(x,v){s="REPLACE";let b=H1(x)?x:Zc(g.location,x,v);c=d();let w=U1(b,c),_=g.createHref(b.mask||b);o.replaceState(w,"",_),a&&l&&l({action:s,location:g.location,delta:0})}function y(x){return hT(x)}let g={get action(){return s},get location(){return e(i,o)},listen(x){if(l)throw new Error("A history only accepts one active listener");return i.addEventListener(W1,u),l=x,()=>{i.removeEventListener(W1,u),l=null}},createHref(x){return t(i,x)},createURL:y,encodeLocation(x){let v=y(x);return{pathname:v.pathname,search:v.search,hash:v.hash}},push:p,replace:h,go(x){return o.go(x)}};return g}function hT(e,t=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),at(n,"No window.location.(origin|href) available to create URL");let r=typeof e=="string"?e:Ji(e);return r=r.replace(/ $/,"%20"),!t&&r.startsWith("//")&&(r=n+r),new URL(r,n)}var Sc,V1=class{constructor(e){if(_c(this,Sc,new Map),e)for(let[t,n]of e)this.set(t,n)}get(e){if(Yr(this,Sc).has(e))return Yr(this,Sc).get(e);if(e.defaultValue!==void 0)return e.defaultValue;throw new Error("No value found for context")}set(e,t){Yr(this,Sc).set(e,t)}};Sc=new WeakMap;var X$=new Set(["lazy","caseSensitive","path","id","index","children"]);function Z$(e){return X$.has(e)}var Q$=new Set(["lazy","caseSensitive","path","id","index","middleware","children"]);function J$(e){return Q$.has(e)}function e4(e){return e.index===!0}function Qc(e,t,n=[],r={},i=!1){return e.map((a,o)=>{let s=[...n,String(o)],l=typeof a.id=="string"?a.id:s.join("-");if(at(a.index!==!0||!a.children,"Cannot specify children on an index route"),at(i||!r[l],`Found a route id collision on id "${l}". Route id's must be globally unique within Data Router usages`),e4(a)){let c={...a,id:l};return r[l]=q1(c,t(c)),c}else{let c={...a,id:l,children:void 0};return r[l]=q1(c,t(c)),a.children&&(c.children=Qc(a.children,t,s,r,i)),c}})}function q1(e,t){return Object.assign(e,{...t,...typeof t.lazy=="object"&&t.lazy!=null?{lazy:{...e.lazy,...t.lazy}}:{}})}function mT(e,t,n="/"){return mi(e,t,n,!1)}function mi(e,t,n,r,i){let a=typeof t=="string"?ca(t):t,o=ai(a.pathname||"/",n);if(o==null)return null;let s=i??uf(e),l=null,c=p4(o);for(let d=0;l==null&&d<s.length;++d)l=d4(s[d],c,r);return l}function t4(e,t){let{route:n,pathname:r,params:i}=e;return{id:n.id,pathname:r,params:i,data:t[n.id],loaderData:t[n.id],handle:n.handle}}function uf(e){let t=gT(e);return n4(t),t}function gT(e,t=[],n=[],r="",i=!1){let a=(o,s,l=i,c)=>{let d={relativePath:c===void 0?o.path||"":c,caseSensitive:o.caseSensitive===!0,childrenIndex:s,route:o};if(d.relativePath.startsWith("/")){if(!d.relativePath.startsWith(r)&&l)return;at(d.relativePath.startsWith(r),`Absolute route path "${d.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),d.relativePath=d.relativePath.slice(r.length)}let u=ii([r,d.relativePath]),p=n.concat(d);o.children&&o.children.length>0&&(at(o.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${u}".`),gT(o.children,t,p,u,l)),!(o.path==null&&!o.index)&&t.push({path:u,score:c4(u,o.index),routesMeta:p})};return e.forEach((o,s)=>{if(o.path===""||!o.path?.includes("?"))a(o,s);else for(let l of yT(o.path))a(o,s,!0,l)}),t}function yT(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,i=n.endsWith("?"),a=n.replace(/\?$/,"");if(r.length===0)return i?[a,""]:[a];let o=yT(r.join("/")),s=[];return s.push(...o.map(l=>l===""?a:[a,l].join("/"))),i&&s.push(...o),s.map(l=>e.startsWith("/")&&l===""?"/":l)}function n4(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:u4(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var r4=/^:[\w-]+$/,i4=3,a4=2,o4=1,s4=10,l4=-2,K1=e=>e==="*";function c4(e,t){let n=e.split("/"),r=n.length;return n.some(K1)&&(r+=l4),t&&(r+=a4),n.filter(i=>!K1(i)).reduce((i,a)=>i+(r4.test(a)?i4:a===""?o4:s4),r)}function u4(e,t){return e.length===t.length&&e.slice(0,-1).every((r,i)=>r===t[i])?e[e.length-1]-t[t.length-1]:0}function d4(e,t,n=!1){let{routesMeta:r}=e,i={},a="/",o=[];for(let s=0;s<r.length;++s){let l=r[s],c=s===r.length-1,d=a==="/"?t:t.slice(a.length)||"/",u=$f({path:l.relativePath,caseSensitive:l.caseSensitive,end:c},d),p=l.route;if(!u&&c&&n&&!r[r.length-1].route.index&&(u=$f({path:l.relativePath,caseSensitive:l.caseSensitive,end:!1},d)),!u)return null;Object.assign(i,u.params),o.push({params:i,pathname:ii([a,u.pathname]),pathnameBase:g4(ii([a,u.pathnameBase])),route:p}),u.pathnameBase!=="/"&&(a=ii([a,u.pathnameBase]))}return o}function $f(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=f4(e.path,e.caseSensitive,e.end),i=t.match(n);if(!i)return null;let a=i[0],o=a.replace(/(.)\/+$/,"$1"),s=i.slice(1);return{params:r.reduce((c,{paramName:d,isOptional:u},p)=>{if(d==="*"){let y=s[p]||"";o=a.slice(0,a.length-y.length).replace(/(.)\/+$/,"$1")}const h=s[p];return u&&!h?c[d]=void 0:c[d]=(h||"").replace(/%2F/g,"/"),c},{}),pathname:a,pathnameBase:o,pattern:e}}function f4(e,t=!1,n=!0){un(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let r=[],i="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,s,l,c,d)=>{if(r.push({paramName:s,isOptional:l!=null}),l){let u=d.charAt(c+o.length);return u&&u!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(r.push({paramName:"*"}),i+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?i+="\\/*$":e!==""&&e!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,t?void 0:"i"),r]}function p4(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return un(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function ai(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}function h4({basename:e,pathname:t}){return t==="/"?e:ii([e,t])}var vT=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,mb=e=>vT.test(e);function m4(e,t="/"){let{pathname:n,search:r="",hash:i=""}=typeof e=="string"?ca(e):e,a;return n?(n=yb(n),n.startsWith("/")?a=G1(n.substring(1),"/"):a=G1(n,t)):a=t,{pathname:a,search:y4(r),hash:v4(i)}}function G1(e,t){let n=zf(t).split("/");return e.split("/").forEach(i=>{i===".."?n.length>1&&n.pop():i!=="."&&n.push(i)}),n.length>1?n.join("/"):"/"}function Nm(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function xT(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function gb(e){let t=xT(e);return t.map((n,r)=>r===t.length-1?n.pathname:n.pathnameBase)}function ph(e,t,n,r=!1){let i;typeof e=="string"?i=ca(e):(i={...e},at(!i.pathname||!i.pathname.includes("?"),Nm("?","pathname","search",i)),at(!i.pathname||!i.pathname.includes("#"),Nm("#","pathname","hash",i)),at(!i.search||!i.search.includes("#"),Nm("#","search","hash",i)));let a=e===""||i.pathname==="",o=a?"/":i.pathname,s;if(o==null)s=n;else{let u=t.length-1;if(!r&&o.startsWith("..")){let p=o.split("/");for(;p[0]==="..";)p.shift(),u-=1;i.pathname=p.join("/")}s=u>=0?t[u]:"/"}let l=m4(i,s),c=o&&o!=="/"&&o.endsWith("/"),d=(a||o===".")&&n.endsWith("/");return!l.pathname.endsWith("/")&&(c||d)&&(l.pathname+="/"),l}var yb=e=>e.replace(/\/\/+/g,"/"),ii=e=>yb(e.join("/")),zf=e=>e.replace(/\/+$/,""),g4=e=>zf(e).replace(/^\/*/,"/"),y4=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,v4=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,Nu=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||"",this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function Jc(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function Tu(e){let t=e.map(n=>n.route.path).filter(Boolean);return ii(t)||"/"}var bT=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function wT(e,t){let n=e;if(typeof n!="string"||!vT.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(bT)try{let a=new URL(window.location.href),o=n.startsWith("//")?new URL(a.protocol+n):new URL(n),s=ai(o.pathname,t);o.origin===a.origin&&s!=null?n=s+o.search+o.hash:i=!0}catch{un(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:i,to:n}}var lo=Symbol("Uninstrumented");function x4(e,t){let n={lazy:[],"lazy.loader":[],"lazy.action":[],"lazy.middleware":[],middleware:[],loader:[],action:[]};e.forEach(i=>i({id:t.id,index:t.index,path:t.path,instrument(a){let o=Object.keys(n);for(let s of o)a[s]&&n[s].push(a[s])}}));let r={};if(typeof t.lazy=="function"&&n.lazy.length>0){let i=el(n.lazy,t.lazy,()=>{});i&&(r.lazy=i)}if(typeof t.lazy=="object"){let i=t.lazy;["middleware","loader","action"].forEach(a=>{let o=i[a],s=n[`lazy.${a}`];if(typeof o=="function"&&s.length>0){let l=el(s,o,()=>{});l&&(r.lazy=Object.assign(r.lazy||{},{[a]:l}))}})}return["loader","action"].forEach(i=>{let a=t[i];if(typeof a=="function"&&n[i].length>0){let o=a[lo]??a,s=el(n[i],o,(...l)=>Y1(l[0]));s&&(i==="loader"&&o.hydrate===!0&&(s.hydrate=!0),s[lo]=o,r[i]=s)}}),t.middleware&&t.middleware.length>0&&n.middleware.length>0&&(r.middleware=t.middleware.map(i=>{let a=i[lo]??i,o=el(n.middleware,a,(...s)=>Y1(s[0]));return o?(o[lo]=a,o):i})),r}function b4(e,t){let n={navigate:[],fetch:[]};if(t.forEach(r=>r({instrument(i){let a=Object.keys(i);for(let o of a)i[o]&&n[o].push(i[o])}})),n.navigate.length>0){let r=e.navigate[lo]??e.navigate,i=el(n.navigate,r,(...a)=>{let[o,s]=a;return{to:typeof o=="number"||typeof o=="string"?o:o?Ji(o):".",...X1(e,s??{})}});i&&(i[lo]=r,e.navigate=i)}if(n.fetch.length>0){let r=e.fetch[lo]??e.fetch,i=el(n.fetch,r,(...a)=>{let[o,,s,l]=a;return{href:s??".",fetcherKey:o,...X1(e,l??{})}});i&&(i[lo]=r,e.fetch=i)}return e}function el(e,t,n){return e.length===0?null:async(...r)=>{let i=await kT(e,n(...r),()=>t(...r),e.length-1);if(i.type==="error")throw i.value;return i.value}}async function kT(e,t,n,r){let i=e[r],a;if(i){let o,s=async()=>(o?console.error("You cannot call instrumented handlers more than once"):o=kT(e,t,n,r-1),a=await o,at(a,"Expected a result"),a.type==="error"&&a.value instanceof Error?{status:"error",error:a.value}:{status:"success",error:void 0});try{await i(s,t)}catch(l){console.error("An instrumentation function threw an error:",l)}o||await s(),await o}else try{a={type:"success",value:await n()}}catch(o){a={type:"error",value:o}}return a||{type:"error",value:new Error("No result assigned in instrumentation chain.")}}function Y1(e){let{request:t,context:n,params:r,pattern:i}=e;return{request:w4(t),params:{...r},pattern:i,context:k4(n)}}function X1(e,t){return{currentUrl:Ji(e.state.location),..."formMethod"in t?{formMethod:t.formMethod}:{},..."formEncType"in t?{formEncType:t.formEncType}:{},..."formData"in t?{formData:t.formData}:{},..."body"in t?{body:t.body}:{}}}function w4(e){return{method:e.method,url:e.url,headers:{get:(...t)=>e.headers.get(...t)}}}function k4(e){if(S4(e)){let t={...e};return Object.freeze(t),t}else return{get:t=>e.get(t)}}var _4=Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function S4(e){if(e===null||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||t===null||Object.getOwnPropertyNames(t).sort().join("\0")===_4}var _T=["POST","PUT","PATCH","DELETE"],E4=new Set(_T),C4=["GET",..._T],j4=new Set(C4),ST=new Set([301,302,303,307,308]),P4=new Set([307,308]),Tm={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},N4={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},Jl={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},T4=e=>({hasErrorBoundary:!!e.hasErrorBoundary}),ET="remix-router-transitions",CT=Symbol("ResetLoaderData"),Uo,Ys,Za,Xs,O4=class{constructor(e){_c(this,Uo),_c(this,Ys),_c(this,Za),_c(this,Xs),Oi(this,Uo,e),Oi(this,Ys,uf(e))}get stableRoutes(){return Yr(this,Uo)}get activeRoutes(){return Yr(this,Za)??Yr(this,Uo)}get branches(){return Yr(this,Xs)??Yr(this,Ys)}get hasHMRRoutes(){return Yr(this,Za)!=null}setRoutes(e){Oi(this,Uo,e),Oi(this,Ys,uf(e))}setHmrRoutes(e){Oi(this,Za,e),Oi(this,Xs,uf(e))}commitHmrRoutes(){Yr(this,Za)&&(Oi(this,Uo,Yr(this,Za)),Oi(this,Ys,Yr(this,Xs)),Oi(this,Za,void 0),Oi(this,Xs,void 0))}};Uo=new WeakMap;Ys=new WeakMap;Za=new WeakMap;Xs=new WeakMap;function A4(e){const t=e.window?e.window:typeof window<"u"?window:void 0,n=typeof t<"u"&&typeof t.document<"u"&&typeof t.document.createElement<"u";at(e.routes.length>0,"You must provide a non-empty routes array to createRouter");let r=e.hydrationRouteProperties||[],i=e.mapRouteProperties||T4,a=i;if(e.instrumentations){let W=e.instrumentations;a=Y=>({...i(Y),...x4(W.map(ne=>ne.route).filter(Boolean),Y)})}let o={},s=new O4(Qc(e.routes,a,void 0,o)),l=e.basename||"/";l.startsWith("/")||(l=`/${l}`);let c=e.dataStrategy||L4,d={...e.future},u=null,p=new Set,h=null,y=null,g=null,x=e.hydrationData!=null,v=mi(s.activeRoutes,e.history.location,l,!1,s.branches),b=!1,w=null,_,k;if(v==null&&!e.patchRoutesOnNavigation){let W=Xr(404,{pathname:e.history.location.pathname}),{matches:Y,route:ne}=fd(s.activeRoutes);_=!0,k=!_,v=Y,w={[ne.id]:W}}else if(v&&!e.hydrationData&&Vt(v,s.activeRoutes,e.history.location.pathname).active&&(v=null),v)if(v.some(W=>W.route.lazy))_=!1,k=!_;else if(!v.some(W=>vb(W.route)))_=!0,k=!_;else{let W=e.hydrationData?e.hydrationData.loaderData:null,Y=e.hydrationData?e.hydrationData.errors:null,ne=v;if(Y){let ce=v.findIndex(me=>Y[me.route.id]!==void 0);ne=ne.slice(0,ce+1)}k=!1,_=!0,ne.forEach(ce=>{let me=jT(ce.route,W,Y);k=k||me.renderFallback,_=_&&!me.shouldLoad})}else{_=!1,k=!_,v=[];let W=Vt(null,s.activeRoutes,e.history.location.pathname);W.active&&W.matches&&(b=!0,v=W.matches)}let S,E={historyAction:e.history.action,location:e.history.location,matches:v,initialized:_,renderFallback:k,navigation:Tm,restoreScrollPosition:e.hydrationData!=null?!1:null,preventScrollReset:!1,revalidation:"idle",loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||w,fetchers:new Map,blockers:new Map},C="POP",j=null,T=!1,A,R=!1,D=new Map,M=null,O=!1,I=!1,L=new Set,V=new Map,F=0,N=-1,ee=new Map,Q=new Set,P=new Map,z=new Map,$=new Set,H=new Map,oe,q=null;function X(){if(u=e.history.listen(({action:W,location:Y,delta:ne})=>{if(oe){oe(),oe=void 0;return}un(H.size===0||ne!=null,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let ce=hn({currentLocation:E.location,nextLocation:Y,historyAction:W});if(ce&&ne!=null){let me=new Promise(Be=>{oe=Be});e.history.go(ne*-1),pn(ce,{state:"blocked",location:Y,proceed(){pn(ce,{state:"proceeding",proceed:void 0,reset:void 0,location:Y}),me.then(()=>e.history.go(ne))},reset(){let Be=new Map(E.blockers);Be.set(ce,Jl),G({blockers:Be})}}),j?.resolve(),j=null;return}return ge(W,Y)}),n){tz(t,D);let W=()=>nz(t,D);t.addEventListener("pagehide",W),M=()=>t.removeEventListener("pagehide",W)}return E.initialized||ge("POP",E.location,{initialHydration:!0}),S}function te(){u&&u(),M&&M(),p.clear(),A&&A.abort(),E.fetchers.forEach((W,Y)=>Ne(Y)),E.blockers.forEach((W,Y)=>wt(Y))}function ue(W){return p.add(W),()=>p.delete(W)}function G(W,Y={}){W.matches&&(W.matches=W.matches.map(me=>{let Be=o[me.route.id],Fe=me.route;return Fe.element!==Be.element||Fe.errorElement!==Be.errorElement||Fe.hydrateFallbackElement!==Be.hydrateFallbackElement?{...me,route:Be}:me})),E={...E,...W};let ne=[],ce=[];E.fetchers.forEach((me,Be)=>{me.state==="idle"&&($.has(Be)?ne.push(Be):ce.push(Be))}),$.forEach(me=>{!E.fetchers.has(me)&&!V.has(me)&&ne.push(me)}),[...p].forEach(me=>me(E,{deletedFetchers:ne,newErrors:W.errors??null,viewTransitionOpts:Y.viewTransitionOpts,flushSync:Y.flushSync===!0})),ne.forEach(me=>Ne(me)),ce.forEach(me=>E.fetchers.delete(me))}function be(W,Y,{flushSync:ne}={}){let ce=E.actionData!=null&&E.navigation.formMethod!=null&&Gn(E.navigation.formMethod)&&E.navigation.state==="loading"&&W.state?._isRedirect!==!0,me;Y.actionData?Object.keys(Y.actionData).length>0?me=Y.actionData:me=null:ce?me=E.actionData:me=null;let Be=Y.loaderData?sk(E.loaderData,Y.loaderData,Y.matches||[],Y.errors):E.loaderData,Fe=E.blockers;Fe.size>0&&(Fe=new Map(Fe),Fe.forEach((Xe,He)=>Fe.set(He,Jl)));let Ie=O?!1:Lt(W,Y.matches||E.matches),$e=T===!0||E.navigation.formMethod!=null&&Gn(E.navigation.formMethod)&&W.state?._isRedirect!==!0;s.commitHmrRoutes(),O||C==="POP"||(C==="PUSH"?e.history.push(W,W.state):C==="REPLACE"&&e.history.replace(W,W.state));let ze;if(C==="POP"){let Xe=D.get(E.location.pathname);Xe&&Xe.has(W.pathname)?ze={currentLocation:E.location,nextLocation:W}:D.has(W.pathname)&&(ze={currentLocation:W,nextLocation:E.location})}else if(R){let Xe=D.get(E.location.pathname);Xe?Xe.add(W.pathname):(Xe=new Set([W.pathname]),D.set(E.location.pathname,Xe)),ze={currentLocation:E.location,nextLocation:W}}G({...Y,actionData:me,loaderData:Be,historyAction:C,location:W,initialized:!0,renderFallback:!1,navigation:Tm,revalidation:"idle",restoreScrollPosition:Ie,preventScrollReset:$e,blockers:Fe},{viewTransitionOpts:ze,flushSync:ne===!0}),C="POP",T=!1,R=!1,O=!1,I=!1,j?.resolve(),j=null,q?.resolve(),q=null}async function xe(W,Y){if(j?.resolve(),j=null,typeof W=="number"){j||(j=dk());let Bt=j.promise;return e.history.go(W),Bt}let ne=kv(E.location,E.matches,l,W,Y?.fromRouteId,Y?.relative),{path:ce,submission:me,error:Be}=Z1(!1,ne,Y),Fe;Y?.mask&&(Fe={pathname:"",search:"",hash:"",...typeof Y.mask=="string"?ca(Y.mask):{...E.location.mask,...Y.mask}});let Ie=E.location,$e=Zc(Ie,ce,Y&&Y.state,void 0,Fe);$e={...$e,...e.history.encodeLocation($e)};let ze=Y&&Y.replace!=null?Y.replace:void 0,Xe="PUSH";ze===!0?Xe="REPLACE":ze===!1||me!=null&&Gn(me.formMethod)&&me.formAction===E.location.pathname+E.location.search&&(Xe="REPLACE");let He=Y&&"preventScrollReset"in Y?Y.preventScrollReset===!0:void 0,kt=(Y&&Y.flushSync)===!0,ht=hn({currentLocation:Ie,nextLocation:$e,historyAction:Xe});if(ht){pn(ht,{state:"blocked",location:$e,proceed(){pn(ht,{state:"proceeding",proceed:void 0,reset:void 0,location:$e}),xe(W,Y)},reset(){let Bt=new Map(E.blockers);Bt.set(ht,Jl),G({blockers:Bt})}});return}await ge(Xe,$e,{submission:me,pendingError:Be,preventScrollReset:He,replace:Y&&Y.replace,enableViewTransition:Y&&Y.viewTransition,flushSync:kt,callSiteDefaultShouldRevalidate:Y&&Y.defaultShouldRevalidate})}function Ae(){q||(q=dk()),U(),G({revalidation:"loading"});let W=q.promise;return E.navigation.state==="submitting"?W:E.navigation.state==="idle"?(ge(E.historyAction,E.location,{startUninterruptedRevalidation:!0}),W):(ge(C||E.historyAction,E.navigation.location,{overrideNavigation:E.navigation,enableViewTransition:R===!0}),W)}async function ge(W,Y,ne){A&&A.abort(),A=null,C=W,O=(ne&&ne.startUninterruptedRevalidation)===!0,jt(E.location,E.matches),T=(ne&&ne.preventScrollReset)===!0,R=(ne&&ne.enableViewTransition)===!0;let ce=s.activeRoutes,me=ne&&ne.overrideNavigation,Be=ne?.initialHydration&&E.matches&&E.matches.length>0&&!b?E.matches:mi(ce,Y,l,!1,s.branches),Fe=(ne&&ne.flushSync)===!0;if(Be&&E.initialized&&!I&&V4(E.location,Y)&&!(ne&&ne.submission&&Gn(ne.submission.formMethod))){be(Y,{matches:Be},{flushSync:Fe});return}let Ie=Vt(Be,ce,Y.pathname);if(Ie.active&&Ie.matches&&(Be=Ie.matches),!Be){let{error:Zt,notFoundMatches:Rn,route:yt}=Hn(Y.pathname);be(Y,{matches:Rn,loaderData:{},errors:{[yt.id]:Zt}},{flushSync:Fe});return}A=new AbortController;let $e=Zs(e.history,Y,A.signal,ne&&ne.submission),ze=e.getContext?await e.getContext():new V1,Xe;if(ne&&ne.pendingError)Xe=[no(Be).route.id,{type:"error",error:ne.pendingError}];else if(ne&&ne.submission&&Gn(ne.submission.formMethod)){let Zt=await _e($e,Y,ne.submission,Be,ze,Ie.active,ne&&ne.initialHydration===!0,{replace:ne.replace,flushSync:Fe});if(Zt.shortCircuited)return;if(Zt.pendingActionResult){let[Rn,yt]=Zt.pendingActionResult;if(Rr(yt)&&Jc(yt.error)&&yt.error.status===404){A=null,be(Y,{matches:Zt.matches,loaderData:{},errors:{[Rn]:yt.error}});return}}Be=Zt.matches||Be,Xe=Zt.pendingActionResult,me=Om(Y,ne.submission),Fe=!1,Ie.active=!1,$e=Zs(e.history,$e.url,$e.signal)}let{shortCircuited:He,matches:kt,loaderData:ht,errors:Bt}=await De($e,Y,Be,ze,Ie.active,me,ne&&ne.submission,ne&&ne.fetcherSubmission,ne&&ne.replace,ne&&ne.initialHydration===!0,Fe,Xe,ne&&ne.callSiteDefaultShouldRevalidate);He||(A=null,be(Y,{matches:kt||Be,...lk(Xe),loaderData:ht,errors:Bt}))}async function _e(W,Y,ne,ce,me,Be,Fe,Ie={}){U();let $e=J4(Y,ne);if(G({navigation:$e},{flushSync:Ie.flushSync===!0}),Be){let He=await Tr(ce,Y.pathname,W.signal);if(He.type==="aborted")return{shortCircuited:!0};if(He.type==="error"){if(He.partialMatches.length===0){let{matches:ht,route:Bt}=fd(s.activeRoutes);return{matches:ht,pendingActionResult:[Bt.id,{type:"error",error:He.error}]}}let kt=no(He.partialMatches).route.id;return{matches:He.partialMatches,pendingActionResult:[kt,{type:"error",error:He.error}]}}else if(He.matches)ce=He.matches;else{let{notFoundMatches:kt,error:ht,route:Bt}=Hn(Y.pathname);return{matches:kt,pendingActionResult:[Bt.id,{type:"error",error:ht}]}}}let ze,Xe=df(ce,Y);if(!Xe.route.action&&!Xe.route.lazy)ze={type:"error",error:Xr(405,{method:W.method,pathname:Y.pathname,routeId:Xe.route.id})};else{let He=ol(a,o,W,Y,ce,Xe,Fe?[]:r,me),kt=await Se(W,Y,He,me,null);if(ze=kt[Xe.route.id],!ze){for(let ht of ce)if(kt[ht.route.id]){ze=kt[ht.route.id];break}}if(W.signal.aborted)return{shortCircuited:!0}}if(Xo(ze)){let He;return Ie&&Ie.replace!=null?He=Ie.replace:He=ik(ze.response.headers.get("Location"),new URL(W.url),l,e.history)===E.location.pathname+E.location.search,await se(W,ze,!0,{submission:ne,replace:He}),{shortCircuited:!0}}if(Rr(ze)){let He=no(ce,Xe.route.id);return(Ie&&Ie.replace)!==!0&&(C="PUSH"),{matches:ce,pendingActionResult:[He.route.id,ze,Xe.route.id]}}return{matches:ce,pendingActionResult:[Xe.route.id,ze]}}async function De(W,Y,ne,ce,me,Be,Fe,Ie,$e,ze,Xe,He,kt){let ht=Be||Om(Y,Fe),Bt=Fe||Ie||uk(ht),Zt=!O&&!ze;if(me){if(Zt){let qn=ve(He);G({navigation:ht,...qn!==void 0?{actionData:qn}:{}},{flushSync:Xe})}let ft=await Tr(ne,Y.pathname,W.signal);if(ft.type==="aborted")return{shortCircuited:!0};if(ft.type==="error"){if(ft.partialMatches.length===0){let{matches:Is,route:Io}=fd(s.activeRoutes);return{matches:Is,loaderData:{},errors:{[Io.id]:ft.error}}}let qn=no(ft.partialMatches).route.id;return{matches:ft.partialMatches,loaderData:{},errors:{[qn]:ft.error}}}else if(ft.matches)ne=ft.matches;else{let{error:qn,notFoundMatches:Is,route:Io}=Hn(Y.pathname);return{matches:Is,loaderData:{},errors:{[Io.id]:qn}}}}let Rn=s.activeRoutes,{dsMatches:yt,revalidatingFetchers:Or}=Q1(W,ce,a,o,e.history,E,ne,Bt,Y,ze?[]:r,ze===!0,I,L,$,P,Q,Rn,l,e.patchRoutesOnNavigation!=null,s.branches,He,kt);if(N=++F,!e.dataStrategy&&!yt.some(ft=>ft.shouldLoad)&&!yt.some(ft=>ft.route.middleware&&ft.route.middleware.length>0)&&Or.length===0){let ft=Nt();return be(Y,{matches:ne,loaderData:{},errors:He&&Rr(He[1])?{[He[0]]:He[1].error}:null,...lk(He),...ft?{fetchers:new Map(E.fetchers)}:{}},{flushSync:Xe}),{shortCircuited:!0}}if(Zt){let ft={};if(!me){ft.navigation=ht;let qn=ve(He);qn!==void 0&&(ft.actionData=qn)}Or.length>0&&(ft.fetchers=Le(Or)),G(ft,{flushSync:Xe})}Or.forEach(ft=>{xt(ft.key),ft.controller&&V.set(ft.key,ft.controller)});let Ro=()=>Or.forEach(ft=>xt(ft.key));A&&A.signal.addEventListener("abort",Ro);let{loaderResults:Zl,fetcherResults:Ka}=await Z(yt,Or,W,Y,ce);if(W.signal.aborted)return{shortCircuited:!0};A&&A.signal.removeEventListener("abort",Ro),Or.forEach(ft=>V.delete(ft.key));let Ti=pd(Zl);if(Ti)return await se(W,Ti.result,!0,{replace:$e}),{shortCircuited:!0};if(Ti=pd(Ka),Ti)return Q.add(Ti.key),await se(W,Ti.result,!0,{replace:$e}),{shortCircuited:!0};let{loaderData:jm,errors:Ql}=ok(E,ne,Zl,He,Or,Ka);ze&&E.errors&&(Ql={...E.errors,...Ql});let Mo=Nt(),cd=sn(N),ud=Mo||cd||Or.length>0;return{matches:ne,loaderData:jm,errors:Ql,...ud?{fetchers:new Map(E.fetchers)}:{}}}function ve(W){if(W&&!Rr(W[1]))return{[W[0]]:W[1].data};if(E.actionData)return Object.keys(E.actionData).length===0?null:E.actionData}function Le(W){return W.forEach(Y=>{let ne=E.fetchers.get(Y.key),ce=ec(void 0,ne?ne.data:void 0);E.fetchers.set(Y.key,ce)}),new Map(E.fetchers)}async function le(W,Y,ne,ce){xt(W);let me=(ce&&ce.flushSync)===!0,Be=s.activeRoutes,Fe=kv(E.location,E.matches,l,ne,Y,ce?.relative),Ie=mi(Be,Fe,l,!1,s.branches),$e=Vt(Ie,Be,Fe);if($e.active&&$e.matches&&(Ie=$e.matches),!Ie){we(W,Y,Xr(404,{pathname:Fe}),{flushSync:me});return}let{path:ze,submission:Xe,error:He}=Z1(!0,Fe,ce);if(He){we(W,Y,He,{flushSync:me});return}let kt=e.getContext?await e.getContext():new V1,ht=(ce&&ce.preventScrollReset)===!0;if(Xe&&Gn(Xe.formMethod)){await pe(W,Y,ze,Ie,kt,$e.active,me,ht,Xe,ce&&ce.defaultShouldRevalidate);return}P.set(W,{routeId:Y,path:ze}),await K(W,Y,ze,Ie,kt,$e.active,me,ht,Xe)}async function pe(W,Y,ne,ce,me,Be,Fe,Ie,$e,ze){U(),P.delete(W);let Xe=E.fetchers.get(W);fe(W,ez($e,Xe),{flushSync:Fe});let He=new AbortController,kt=Zs(e.history,ne,He.signal,$e);if(Be){let qt=await Tr(ce,new URL(kt.url).pathname,kt.signal,W);if(qt.type==="aborted")return;if(qt.type==="error"){we(W,Y,qt.error,{flushSync:Fe});return}else if(qt.matches)ce=qt.matches;else{we(W,Y,Xr(404,{pathname:ne}),{flushSync:Fe});return}}let ht=df(ce,ne);if(!ht.route.action&&!ht.route.lazy){let qt=Xr(405,{method:$e.formMethod,pathname:ne,routeId:Y});we(W,Y,qt,{flushSync:Fe});return}V.set(W,He);let Bt=F,Zt=ol(a,o,kt,ne,ce,ht,r,me),Rn=await Se(kt,ne,Zt,me,W),yt=Rn[ht.route.id];if(!yt){for(let qt of Zt)if(Rn[qt.route.id]){yt=Rn[qt.route.id];break}}if(kt.signal.aborted){V.get(W)===He&&V.delete(W);return}if($.has(W)){if(Xo(yt)||Rr(yt)){fe(W,ma(void 0));return}}else{if(Xo(yt))if(V.delete(W),N>Bt){fe(W,ma(void 0));return}else return Q.add(W),fe(W,ec($e)),se(kt,yt,!1,{fetcherSubmission:$e,preventScrollReset:Ie});if(Rr(yt)){we(W,Y,yt.error);return}}let Or=E.navigation.location||E.location,Ro=Zs(e.history,Or,He.signal),Zl=s.activeRoutes,Ka=E.navigation.state!=="idle"?mi(Zl,E.navigation.location,l,!1,s.branches):E.matches;at(Ka,"Didn't find any matches after fetcher action");let Ti=++F;ee.set(W,Ti);let jm=ec($e,yt.data);E.fetchers.set(W,jm);let{dsMatches:Ql,revalidatingFetchers:Mo}=Q1(Ro,me,a,o,e.history,E,Ka,$e,Or,r,!1,I,L,$,P,Q,Zl,l,e.patchRoutesOnNavigation!=null,s.branches,[ht.route.id,yt],ze);Mo.filter(qt=>qt.key!==W).forEach(qt=>{let dd=qt.key,z1=E.fetchers.get(dd),A$=ec(void 0,z1?z1.data:void 0);E.fetchers.set(dd,A$),xt(dd),qt.controller&&V.set(dd,qt.controller)}),G({fetchers:new Map(E.fetchers)});let cd=()=>Mo.forEach(qt=>xt(qt.key));He.signal.addEventListener("abort",cd);let{loaderResults:ud,fetcherResults:ft}=await Z(Ql,Mo,Ro,Or,me);if(He.signal.aborted)return;if(He.signal.removeEventListener("abort",cd),ee.delete(W),V.delete(W),Mo.forEach(qt=>V.delete(qt.key)),E.fetchers.has(W)){let qt=ma(yt.data);E.fetchers.set(W,qt)}let qn=pd(ud);if(qn)return se(Ro,qn.result,!1,{preventScrollReset:Ie});if(qn=pd(ft),qn)return Q.add(qn.key),se(Ro,qn.result,!1,{preventScrollReset:Ie});let{loaderData:Is,errors:Io}=ok(E,Ka,ud,void 0,Mo,ft);sn(Ti),E.navigation.state==="loading"&&Ti>N?(at(C,"Expected pending action"),A&&A.abort(),be(E.navigation.location,{matches:Ka,loaderData:Is,errors:Io,fetchers:new Map(E.fetchers)})):(G({errors:Io,loaderData:sk(E.loaderData,Is,Ka,Io),fetchers:new Map(E.fetchers)}),I=!1)}async function K(W,Y,ne,ce,me,Be,Fe,Ie,$e){let ze=E.fetchers.get(W);fe(W,ec($e,ze?ze.data:void 0),{flushSync:Fe});let Xe=new AbortController,He=Zs(e.history,ne,Xe.signal);if(Be){let yt=await Tr(ce,new URL(He.url).pathname,He.signal,W);if(yt.type==="aborted")return;if(yt.type==="error"){we(W,Y,yt.error,{flushSync:Fe});return}else if(yt.matches)ce=yt.matches;else{we(W,Y,Xr(404,{pathname:ne}),{flushSync:Fe});return}}let kt=df(ce,ne);V.set(W,Xe);let ht=F,Bt=ol(a,o,He,ne,ce,kt,r,me),Zt=await Se(He,ne,Bt,me,W),Rn=Zt[kt.route.id];if(!Rn){for(let yt of ce)if(Zt[yt.route.id]){Rn=Zt[yt.route.id];break}}if(V.get(W)===Xe&&V.delete(W),!He.signal.aborted){if($.has(W)){fe(W,ma(void 0));return}if(Xo(Rn))if(N>ht){fe(W,ma(void 0));return}else{Q.add(W),await se(He,Rn,!1,{preventScrollReset:Ie});return}if(Rr(Rn)){we(W,Y,Rn.error);return}fe(W,ma(Rn.data))}}async function se(W,Y,ne,{submission:ce,fetcherSubmission:me,preventScrollReset:Be,replace:Fe}={}){ne||(j?.resolve(),j=null),Y.response.headers.has("X-Remix-Revalidate")&&(I=!0);let Ie=Y.response.headers.get("Location");at(Ie,"Expected a Location header on the redirect Response"),Ie=ik(Ie,new URL(W.url),l,e.history);let $e=Zc(E.location,Ie,{_isRedirect:!0});if(n){let Bt=!1;if(Y.response.headers.has("X-Remix-Reload-Document"))Bt=!0;else if(mb(Ie)){const Zt=hT(Ie,!0);Bt=Zt.origin!==t.location.origin||ai(Zt.pathname,l)==null}if(Bt){Fe?t.location.replace(Ie):t.location.assign(Ie);return}}A=null;let ze=Fe===!0||Y.response.headers.has("X-Remix-Replace")?"REPLACE":"PUSH",{formMethod:Xe,formAction:He,formEncType:kt}=E.navigation;!ce&&!me&&Xe&&He&&kt&&(ce=uk(E.navigation));let ht=ce||me;if(P4.has(Y.response.status)&&ht&&Gn(ht.formMethod))await ge(ze,$e,{submission:{...ht,formAction:Ie},preventScrollReset:Be||T,enableViewTransition:ne?R:void 0});else{let Bt=Om($e,ce);await ge(ze,$e,{overrideNavigation:Bt,fetcherSubmission:me,preventScrollReset:Be||T,enableViewTransition:ne?R:void 0})}}async function Se(W,Y,ne,ce,me){let Be,Fe={};try{Be=await z4(c,W,Y,ne,me,ce,!1)}catch(Ie){return ne.filter($e=>$e.shouldLoad).forEach($e=>{Fe[$e.route.id]={type:"error",error:Ie}}),Fe}if(W.signal.aborted)return Fe;if(!Gn(W.method))for(let Ie of ne){if(Be[Ie.route.id]?.type==="error")break;!Be.hasOwnProperty(Ie.route.id)&&!E.loaderData.hasOwnProperty(Ie.route.id)&&(!E.errors||!E.errors.hasOwnProperty(Ie.route.id))&&Ie.shouldCallHandler()&&(Be[Ie.route.id]={type:"error",result:new Error(`No result returned from dataStrategy for route ${Ie.route.id}`)})}for(let[Ie,$e]of Object.entries(Be))if(Y4($e)){let ze=$e.result;Fe[Ie]={type:"redirect",response:H4(ze,W,Ie,ne,l)}}else Fe[Ie]=await W4($e);return Fe}async function Z(W,Y,ne,ce,me){let Be=Se(ne,ce,W,me,null),Fe=Promise.all(Y.map(async ze=>{if(ze.matches&&ze.match&&ze.request&&ze.controller){let He=(await Se(ze.request,ze.path,ze.matches,me,ze.key))[ze.match.route.id];return{[ze.key]:He}}else return Promise.resolve({[ze.key]:{type:"error",error:Xr(404,{pathname:ze.path})}})})),Ie=await Be,$e=(await Fe).reduce((ze,Xe)=>Object.assign(ze,Xe),{});return{loaderResults:Ie,fetcherResults:$e}}function U(){I=!0,P.forEach((W,Y)=>{V.has(Y)&&L.add(Y),xt(Y)})}function fe(W,Y,ne={}){E.fetchers.set(W,Y),G({fetchers:new Map(E.fetchers)},{flushSync:(ne&&ne.flushSync)===!0})}function we(W,Y,ne,ce={}){let me=no(E.matches,Y);Ne(W),G({errors:{[me.route.id]:ne},fetchers:new Map(E.fetchers)},{flushSync:(ce&&ce.flushSync)===!0})}function Re(W){return z.set(W,(z.get(W)||0)+1),$.has(W)&&$.delete(W),E.fetchers.get(W)||N4}function Ee(W,Y){xt(W,Y?.reason),fe(W,ma(null))}function Ne(W){let Y=E.fetchers.get(W);V.has(W)&&!(Y&&Y.state==="loading"&&ee.has(W))&&xt(W),P.delete(W),ee.delete(W),Q.delete(W),$.delete(W),L.delete(W),E.fetchers.delete(W)}function nt(W){let Y=(z.get(W)||0)-1;Y<=0?(z.delete(W),$.add(W)):z.set(W,Y),G({fetchers:new Map(E.fetchers)})}function xt(W,Y){let ne=V.get(W);ne&&(ne.abort(Y),V.delete(W))}function fn(W){for(let Y of W){let ne=Re(Y),ce=ma(ne.data);E.fetchers.set(Y,ce)}}function Nt(){let W=[],Y=!1;for(let ne of Q){let ce=E.fetchers.get(ne);at(ce,`Expected fetcher: ${ne}`),ce.state==="loading"&&(Q.delete(ne),W.push(ne),Y=!0)}return fn(W),Y}function sn(W){let Y=[];for(let[ne,ce]of ee)if(ce<W){let me=E.fetchers.get(ne);at(me,`Expected fetcher: ${ne}`),me.state==="loading"&&(xt(ne),ee.delete(ne),Y.push(ne))}return fn(Y),Y.length>0}function tt(W,Y){let ne=E.blockers.get(W)||Jl;return H.get(W)!==Y&&H.set(W,Y),ne}function wt(W){E.blockers.delete(W),H.delete(W)}function pn(W,Y){let ne=E.blockers.get(W)||Jl;at(ne.state==="unblocked"&&Y.state==="blocked"||ne.state==="blocked"&&Y.state==="blocked"||ne.state==="blocked"&&Y.state==="proceeding"||ne.state==="blocked"&&Y.state==="unblocked"||ne.state==="proceeding"&&Y.state==="unblocked",`Invalid blocker state transition: ${ne.state} -> ${Y.state}`);let ce=new Map(E.blockers);ce.set(W,Y),G({blockers:ce})}function hn({currentLocation:W,nextLocation:Y,historyAction:ne}){if(H.size===0)return;H.size>1&&un(!1,"A router only supports one blocker at a time");let ce=Array.from(H.entries()),[me,Be]=ce[ce.length-1],Fe=E.blockers.get(me);if(!(Fe&&Fe.state==="proceeding")&&Be({currentLocation:W,nextLocation:Y,historyAction:ne}))return me}function Hn(W){let Y=Xr(404,{pathname:W}),ne=s.activeRoutes,{matches:ce,route:me}=fd(ne);return{notFoundMatches:ce,route:me,error:Y}}function Un(W,Y,ne){if(h=W,g=Y,y=ne||null,!x&&E.navigation===Tm){x=!0;let ce=Lt(E.location,E.matches);ce!=null&&G({restoreScrollPosition:ce})}return()=>{h=null,g=null,y=null}}function Ve(W,Y){return y&&y(W,Y.map(ce=>t4(ce,E.loaderData)))||W.key}function jt(W,Y){if(h&&g){let ne=Ve(W,Y);h[ne]=g()}}function Lt(W,Y){if(h){let ne=Ve(W,Y),ce=h[ne];if(typeof ce=="number")return ce}return null}function Vt(W,Y,ne){if(e.patchRoutesOnNavigation){let ce=s.branches;if(W){if(Object.keys(W[0].params).length>0)return{active:!0,matches:mi(Y,ne,l,!0,ce)}}else return{active:!0,matches:mi(Y,ne,l,!0,ce)||[]}}return{active:!1,matches:null}}async function Tr(W,Y,ne,ce){if(!e.patchRoutesOnNavigation)return{type:"success",matches:W};let me=W;for(;;){let Be=o;try{await e.patchRoutesOnNavigation({signal:ne,path:Y,matches:me,fetcherKey:ce,patch:(ze,Xe)=>{ne.aborted||J1(ze,Xe,s,Be,a,!1)}})}catch(ze){return{type:"error",error:ze,partialMatches:me}}if(ne.aborted)return{type:"aborted"};let Fe=s.branches,Ie=mi(s.activeRoutes,Y,l,!1,Fe),$e=null;if(Ie){if(Object.keys(Ie[0].params).length===0)return{type:"success",matches:Ie};if($e=mi(s.activeRoutes,Y,l,!0,Fe),!($e&&me.length<$e.length&&$t(me,$e.slice(0,me.length))))return{type:"success",matches:Ie}}if($e||($e=mi(s.activeRoutes,Y,l,!0,Fe)),!$e||$t(me,$e))return{type:"success",matches:null};me=$e}}function $t(W,Y){return W.length===Y.length&&W.every((ne,ce)=>ne.route.id===Y[ce].route.id)}function Vn(W){o={},s.setHmrRoutes(Qc(W,a,void 0,o))}function Ni(W,Y,ne=!1){J1(W,Y,s,o,a,ne),s.hasHMRRoutes||G({})}return S={get basename(){return l},get future(){return d},get state(){return E},get routes(){return s.stableRoutes},get branches(){return s.branches},get manifest(){return o},get window(){return t},initialize:X,subscribe:ue,enableScrollRestoration:Un,navigate:xe,fetch:le,revalidate:Ae,createHref:W=>e.history.createHref(W),encodeLocation:W=>e.history.encodeLocation(W),getFetcher:Re,resetFetcher:Ee,deleteFetcher:nt,dispose:te,getBlocker:tt,deleteBlocker:wt,patchRoutes:Ni,_internalFetchControllers:V,_internalSetRoutes:Vn,_internalSetStateDoNotUseOrYouWillBreakYourApp(W){G(W)}},e.instrumentations&&(S=b4(S,e.instrumentations.map(W=>W.router).filter(Boolean))),S}function R4(e){return e!=null&&("formData"in e&&e.formData!=null||"body"in e&&e.body!==void 0)}function kv(e,t,n,r,i,a){let o,s;if(i){o=[];for(let c of t)if(o.push(c),c.route.id===i){s=c;break}}else o=t,s=t[t.length-1];let l=ph(r||".",gb(o),ai(e.pathname,n)||e.pathname,a==="path");if(r==null&&(l.search=e.search,l.hash=e.hash),(r==null||r===""||r===".")&&s){let c=bb(l.search);if(s.route.index&&!c)l.search=l.search?l.search.replace(/^\?/,"?index&"):"?index";else if(!s.route.index&&c){let d=new URLSearchParams(l.search),u=d.getAll("index");d.delete("index"),u.filter(h=>h).forEach(h=>d.append("index",h));let p=d.toString();l.search=p?`?${p}`:""}}return n!=="/"&&(l.pathname=h4({basename:n,pathname:l.pathname})),Ji(l)}function Z1(e,t,n){if(!n||!R4(n))return{path:t};if(n.formMethod&&!Q4(n.formMethod))return{path:t,error:Xr(405,{method:n.formMethod})};let r=()=>({path:t,error:Xr(400,{type:"invalid-body"})}),a=(n.formMethod||"get").toUpperCase(),o=MT(t);if(n.body!==void 0){if(n.formEncType==="text/plain"){if(!Gn(a))return r();let u=typeof n.body=="string"?n.body:n.body instanceof FormData||n.body instanceof URLSearchParams?Array.from(n.body.entries()).reduce((p,[h,y])=>`${p}${h}=${y}
1
+ import{r as m,R as dh,a as R$,g as Ci,b as ye,i as ie,c as sb,k as M$,d as lb,u as I$,e as cb,f as D$,h as cn,B as ub,j as bo,S as cT,l as Ce,m as L$,n as f,X as Sr,o as ri,p as F1,q as Lf,s as db,t as cf,v as $$,w as z$,x as F$,y as B$,z as Pm,A as tn,C as je,D as fb,E as fh,F as wv,M as W$,G as pb,H as hb,I as Er,J as B1,K as uT,L as dT,N as H$,W as U$,O as V$,P as q$}from"./App-nzwmrF9a.js";var fT=e=>{throw TypeError(e)},pT=(e,t,n)=>t.has(e)||fT("Cannot "+n),Yr=(e,t,n)=>(pT(e,t,"read from private field"),n?n.call(e):t.get(e)),_c=(e,t,n)=>t.has(e)?fT("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Oi=(e,t,n,r)=>(pT(e,t,"write to private field"),t.set(e,n),n),W1="popstate";function H1(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function K$(e={}){function t(r,i){let a=i.state?.masked,{pathname:o,search:s,hash:l}=a||r.location;return Zc("",{pathname:o,search:s,hash:l},i.state&&i.state.usr||null,i.state&&i.state.key||"default",a?{pathname:r.location.pathname,search:r.location.search,hash:r.location.hash}:void 0)}function n(r,i){return typeof i=="string"?i:Ji(i)}return Y$(t,n,null,e)}function at(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function un(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function G$(){return Math.random().toString(36).substring(2,10)}function U1(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function Zc(e,t,n=null,r,i){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?ca(t):t,state:n,key:t&&t.key||r||G$(),mask:i}}function Ji({pathname:e="/",search:t="",hash:n=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function ca(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function Y$(e,t,n,r={}){let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,s="POP",l=null,c=d();c==null&&(c=0,o.replaceState({...o.state,idx:c},""));function d(){return(o.state||{idx:null}).idx}function u(){s="POP";let x=d(),v=x==null?null:x-c;c=x,l&&l({action:s,location:g.location,delta:v})}function p(x,v){s="PUSH";let b=H1(x)?x:Zc(g.location,x,v);c=d()+1;let w=U1(b,c),_=g.createHref(b.mask||b);try{o.pushState(w,"",_)}catch(k){if(k instanceof DOMException&&k.name==="DataCloneError")throw k;i.location.assign(_)}a&&l&&l({action:s,location:g.location,delta:1})}function h(x,v){s="REPLACE";let b=H1(x)?x:Zc(g.location,x,v);c=d();let w=U1(b,c),_=g.createHref(b.mask||b);o.replaceState(w,"",_),a&&l&&l({action:s,location:g.location,delta:0})}function y(x){return hT(x)}let g={get action(){return s},get location(){return e(i,o)},listen(x){if(l)throw new Error("A history only accepts one active listener");return i.addEventListener(W1,u),l=x,()=>{i.removeEventListener(W1,u),l=null}},createHref(x){return t(i,x)},createURL:y,encodeLocation(x){let v=y(x);return{pathname:v.pathname,search:v.search,hash:v.hash}},push:p,replace:h,go(x){return o.go(x)}};return g}function hT(e,t=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),at(n,"No window.location.(origin|href) available to create URL");let r=typeof e=="string"?e:Ji(e);return r=r.replace(/ $/,"%20"),!t&&r.startsWith("//")&&(r=n+r),new URL(r,n)}var Sc,V1=class{constructor(e){if(_c(this,Sc,new Map),e)for(let[t,n]of e)this.set(t,n)}get(e){if(Yr(this,Sc).has(e))return Yr(this,Sc).get(e);if(e.defaultValue!==void 0)return e.defaultValue;throw new Error("No value found for context")}set(e,t){Yr(this,Sc).set(e,t)}};Sc=new WeakMap;var X$=new Set(["lazy","caseSensitive","path","id","index","children"]);function Z$(e){return X$.has(e)}var Q$=new Set(["lazy","caseSensitive","path","id","index","middleware","children"]);function J$(e){return Q$.has(e)}function e4(e){return e.index===!0}function Qc(e,t,n=[],r={},i=!1){return e.map((a,o)=>{let s=[...n,String(o)],l=typeof a.id=="string"?a.id:s.join("-");if(at(a.index!==!0||!a.children,"Cannot specify children on an index route"),at(i||!r[l],`Found a route id collision on id "${l}". Route id's must be globally unique within Data Router usages`),e4(a)){let c={...a,id:l};return r[l]=q1(c,t(c)),c}else{let c={...a,id:l,children:void 0};return r[l]=q1(c,t(c)),a.children&&(c.children=Qc(a.children,t,s,r,i)),c}})}function q1(e,t){return Object.assign(e,{...t,...typeof t.lazy=="object"&&t.lazy!=null?{lazy:{...e.lazy,...t.lazy}}:{}})}function mT(e,t,n="/"){return mi(e,t,n,!1)}function mi(e,t,n,r,i){let a=typeof t=="string"?ca(t):t,o=ai(a.pathname||"/",n);if(o==null)return null;let s=i??uf(e),l=null,c=p4(o);for(let d=0;l==null&&d<s.length;++d)l=d4(s[d],c,r);return l}function t4(e,t){let{route:n,pathname:r,params:i}=e;return{id:n.id,pathname:r,params:i,data:t[n.id],loaderData:t[n.id],handle:n.handle}}function uf(e){let t=gT(e);return n4(t),t}function gT(e,t=[],n=[],r="",i=!1){let a=(o,s,l=i,c)=>{let d={relativePath:c===void 0?o.path||"":c,caseSensitive:o.caseSensitive===!0,childrenIndex:s,route:o};if(d.relativePath.startsWith("/")){if(!d.relativePath.startsWith(r)&&l)return;at(d.relativePath.startsWith(r),`Absolute route path "${d.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),d.relativePath=d.relativePath.slice(r.length)}let u=ii([r,d.relativePath]),p=n.concat(d);o.children&&o.children.length>0&&(at(o.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${u}".`),gT(o.children,t,p,u,l)),!(o.path==null&&!o.index)&&t.push({path:u,score:c4(u,o.index),routesMeta:p})};return e.forEach((o,s)=>{if(o.path===""||!o.path?.includes("?"))a(o,s);else for(let l of yT(o.path))a(o,s,!0,l)}),t}function yT(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,i=n.endsWith("?"),a=n.replace(/\?$/,"");if(r.length===0)return i?[a,""]:[a];let o=yT(r.join("/")),s=[];return s.push(...o.map(l=>l===""?a:[a,l].join("/"))),i&&s.push(...o),s.map(l=>e.startsWith("/")&&l===""?"/":l)}function n4(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:u4(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var r4=/^:[\w-]+$/,i4=3,a4=2,o4=1,s4=10,l4=-2,K1=e=>e==="*";function c4(e,t){let n=e.split("/"),r=n.length;return n.some(K1)&&(r+=l4),t&&(r+=a4),n.filter(i=>!K1(i)).reduce((i,a)=>i+(r4.test(a)?i4:a===""?o4:s4),r)}function u4(e,t){return e.length===t.length&&e.slice(0,-1).every((r,i)=>r===t[i])?e[e.length-1]-t[t.length-1]:0}function d4(e,t,n=!1){let{routesMeta:r}=e,i={},a="/",o=[];for(let s=0;s<r.length;++s){let l=r[s],c=s===r.length-1,d=a==="/"?t:t.slice(a.length)||"/",u=$f({path:l.relativePath,caseSensitive:l.caseSensitive,end:c},d),p=l.route;if(!u&&c&&n&&!r[r.length-1].route.index&&(u=$f({path:l.relativePath,caseSensitive:l.caseSensitive,end:!1},d)),!u)return null;Object.assign(i,u.params),o.push({params:i,pathname:ii([a,u.pathname]),pathnameBase:g4(ii([a,u.pathnameBase])),route:p}),u.pathnameBase!=="/"&&(a=ii([a,u.pathnameBase]))}return o}function $f(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=f4(e.path,e.caseSensitive,e.end),i=t.match(n);if(!i)return null;let a=i[0],o=a.replace(/(.)\/+$/,"$1"),s=i.slice(1);return{params:r.reduce((c,{paramName:d,isOptional:u},p)=>{if(d==="*"){let y=s[p]||"";o=a.slice(0,a.length-y.length).replace(/(.)\/+$/,"$1")}const h=s[p];return u&&!h?c[d]=void 0:c[d]=(h||"").replace(/%2F/g,"/"),c},{}),pathname:a,pathnameBase:o,pattern:e}}function f4(e,t=!1,n=!0){un(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let r=[],i="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,s,l,c,d)=>{if(r.push({paramName:s,isOptional:l!=null}),l){let u=d.charAt(c+o.length);return u&&u!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(r.push({paramName:"*"}),i+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?i+="\\/*$":e!==""&&e!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,t?void 0:"i"),r]}function p4(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return un(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function ai(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}function h4({basename:e,pathname:t}){return t==="/"?e:ii([e,t])}var vT=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,mb=e=>vT.test(e);function m4(e,t="/"){let{pathname:n,search:r="",hash:i=""}=typeof e=="string"?ca(e):e,a;return n?(n=yb(n),n.startsWith("/")?a=G1(n.substring(1),"/"):a=G1(n,t)):a=t,{pathname:a,search:y4(r),hash:v4(i)}}function G1(e,t){let n=zf(t).split("/");return e.split("/").forEach(i=>{i===".."?n.length>1&&n.pop():i!=="."&&n.push(i)}),n.length>1?n.join("/"):"/"}function Nm(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function xT(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function gb(e){let t=xT(e);return t.map((n,r)=>r===t.length-1?n.pathname:n.pathnameBase)}function ph(e,t,n,r=!1){let i;typeof e=="string"?i=ca(e):(i={...e},at(!i.pathname||!i.pathname.includes("?"),Nm("?","pathname","search",i)),at(!i.pathname||!i.pathname.includes("#"),Nm("#","pathname","hash",i)),at(!i.search||!i.search.includes("#"),Nm("#","search","hash",i)));let a=e===""||i.pathname==="",o=a?"/":i.pathname,s;if(o==null)s=n;else{let u=t.length-1;if(!r&&o.startsWith("..")){let p=o.split("/");for(;p[0]==="..";)p.shift(),u-=1;i.pathname=p.join("/")}s=u>=0?t[u]:"/"}let l=m4(i,s),c=o&&o!=="/"&&o.endsWith("/"),d=(a||o===".")&&n.endsWith("/");return!l.pathname.endsWith("/")&&(c||d)&&(l.pathname+="/"),l}var yb=e=>e.replace(/\/\/+/g,"/"),ii=e=>yb(e.join("/")),zf=e=>e.replace(/\/+$/,""),g4=e=>zf(e).replace(/^\/*/,"/"),y4=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,v4=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,Nu=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||"",this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function Jc(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function Tu(e){let t=e.map(n=>n.route.path).filter(Boolean);return ii(t)||"/"}var bT=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function wT(e,t){let n=e;if(typeof n!="string"||!vT.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(bT)try{let a=new URL(window.location.href),o=n.startsWith("//")?new URL(a.protocol+n):new URL(n),s=ai(o.pathname,t);o.origin===a.origin&&s!=null?n=s+o.search+o.hash:i=!0}catch{un(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:i,to:n}}var lo=Symbol("Uninstrumented");function x4(e,t){let n={lazy:[],"lazy.loader":[],"lazy.action":[],"lazy.middleware":[],middleware:[],loader:[],action:[]};e.forEach(i=>i({id:t.id,index:t.index,path:t.path,instrument(a){let o=Object.keys(n);for(let s of o)a[s]&&n[s].push(a[s])}}));let r={};if(typeof t.lazy=="function"&&n.lazy.length>0){let i=el(n.lazy,t.lazy,()=>{});i&&(r.lazy=i)}if(typeof t.lazy=="object"){let i=t.lazy;["middleware","loader","action"].forEach(a=>{let o=i[a],s=n[`lazy.${a}`];if(typeof o=="function"&&s.length>0){let l=el(s,o,()=>{});l&&(r.lazy=Object.assign(r.lazy||{},{[a]:l}))}})}return["loader","action"].forEach(i=>{let a=t[i];if(typeof a=="function"&&n[i].length>0){let o=a[lo]??a,s=el(n[i],o,(...l)=>Y1(l[0]));s&&(i==="loader"&&o.hydrate===!0&&(s.hydrate=!0),s[lo]=o,r[i]=s)}}),t.middleware&&t.middleware.length>0&&n.middleware.length>0&&(r.middleware=t.middleware.map(i=>{let a=i[lo]??i,o=el(n.middleware,a,(...s)=>Y1(s[0]));return o?(o[lo]=a,o):i})),r}function b4(e,t){let n={navigate:[],fetch:[]};if(t.forEach(r=>r({instrument(i){let a=Object.keys(i);for(let o of a)i[o]&&n[o].push(i[o])}})),n.navigate.length>0){let r=e.navigate[lo]??e.navigate,i=el(n.navigate,r,(...a)=>{let[o,s]=a;return{to:typeof o=="number"||typeof o=="string"?o:o?Ji(o):".",...X1(e,s??{})}});i&&(i[lo]=r,e.navigate=i)}if(n.fetch.length>0){let r=e.fetch[lo]??e.fetch,i=el(n.fetch,r,(...a)=>{let[o,,s,l]=a;return{href:s??".",fetcherKey:o,...X1(e,l??{})}});i&&(i[lo]=r,e.fetch=i)}return e}function el(e,t,n){return e.length===0?null:async(...r)=>{let i=await kT(e,n(...r),()=>t(...r),e.length-1);if(i.type==="error")throw i.value;return i.value}}async function kT(e,t,n,r){let i=e[r],a;if(i){let o,s=async()=>(o?console.error("You cannot call instrumented handlers more than once"):o=kT(e,t,n,r-1),a=await o,at(a,"Expected a result"),a.type==="error"&&a.value instanceof Error?{status:"error",error:a.value}:{status:"success",error:void 0});try{await i(s,t)}catch(l){console.error("An instrumentation function threw an error:",l)}o||await s(),await o}else try{a={type:"success",value:await n()}}catch(o){a={type:"error",value:o}}return a||{type:"error",value:new Error("No result assigned in instrumentation chain.")}}function Y1(e){let{request:t,context:n,params:r,pattern:i}=e;return{request:w4(t),params:{...r},pattern:i,context:k4(n)}}function X1(e,t){return{currentUrl:Ji(e.state.location),..."formMethod"in t?{formMethod:t.formMethod}:{},..."formEncType"in t?{formEncType:t.formEncType}:{},..."formData"in t?{formData:t.formData}:{},..."body"in t?{body:t.body}:{}}}function w4(e){return{method:e.method,url:e.url,headers:{get:(...t)=>e.headers.get(...t)}}}function k4(e){if(S4(e)){let t={...e};return Object.freeze(t),t}else return{get:t=>e.get(t)}}var _4=Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function S4(e){if(e===null||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||t===null||Object.getOwnPropertyNames(t).sort().join("\0")===_4}var _T=["POST","PUT","PATCH","DELETE"],E4=new Set(_T),C4=["GET",..._T],j4=new Set(C4),ST=new Set([301,302,303,307,308]),P4=new Set([307,308]),Tm={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},N4={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},Jl={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},T4=e=>({hasErrorBoundary:!!e.hasErrorBoundary}),ET="remix-router-transitions",CT=Symbol("ResetLoaderData"),Uo,Ys,Za,Xs,O4=class{constructor(e){_c(this,Uo),_c(this,Ys),_c(this,Za),_c(this,Xs),Oi(this,Uo,e),Oi(this,Ys,uf(e))}get stableRoutes(){return Yr(this,Uo)}get activeRoutes(){return Yr(this,Za)??Yr(this,Uo)}get branches(){return Yr(this,Xs)??Yr(this,Ys)}get hasHMRRoutes(){return Yr(this,Za)!=null}setRoutes(e){Oi(this,Uo,e),Oi(this,Ys,uf(e))}setHmrRoutes(e){Oi(this,Za,e),Oi(this,Xs,uf(e))}commitHmrRoutes(){Yr(this,Za)&&(Oi(this,Uo,Yr(this,Za)),Oi(this,Ys,Yr(this,Xs)),Oi(this,Za,void 0),Oi(this,Xs,void 0))}};Uo=new WeakMap;Ys=new WeakMap;Za=new WeakMap;Xs=new WeakMap;function A4(e){const t=e.window?e.window:typeof window<"u"?window:void 0,n=typeof t<"u"&&typeof t.document<"u"&&typeof t.document.createElement<"u";at(e.routes.length>0,"You must provide a non-empty routes array to createRouter");let r=e.hydrationRouteProperties||[],i=e.mapRouteProperties||T4,a=i;if(e.instrumentations){let W=e.instrumentations;a=Y=>({...i(Y),...x4(W.map(ne=>ne.route).filter(Boolean),Y)})}let o={},s=new O4(Qc(e.routes,a,void 0,o)),l=e.basename||"/";l.startsWith("/")||(l=`/${l}`);let c=e.dataStrategy||L4,d={...e.future},u=null,p=new Set,h=null,y=null,g=null,x=e.hydrationData!=null,v=mi(s.activeRoutes,e.history.location,l,!1,s.branches),b=!1,w=null,_,k;if(v==null&&!e.patchRoutesOnNavigation){let W=Xr(404,{pathname:e.history.location.pathname}),{matches:Y,route:ne}=fd(s.activeRoutes);_=!0,k=!_,v=Y,w={[ne.id]:W}}else if(v&&!e.hydrationData&&Vt(v,s.activeRoutes,e.history.location.pathname).active&&(v=null),v)if(v.some(W=>W.route.lazy))_=!1,k=!_;else if(!v.some(W=>vb(W.route)))_=!0,k=!_;else{let W=e.hydrationData?e.hydrationData.loaderData:null,Y=e.hydrationData?e.hydrationData.errors:null,ne=v;if(Y){let ce=v.findIndex(me=>Y[me.route.id]!==void 0);ne=ne.slice(0,ce+1)}k=!1,_=!0,ne.forEach(ce=>{let me=jT(ce.route,W,Y);k=k||me.renderFallback,_=_&&!me.shouldLoad})}else{_=!1,k=!_,v=[];let W=Vt(null,s.activeRoutes,e.history.location.pathname);W.active&&W.matches&&(b=!0,v=W.matches)}let S,E={historyAction:e.history.action,location:e.history.location,matches:v,initialized:_,renderFallback:k,navigation:Tm,restoreScrollPosition:e.hydrationData!=null?!1:null,preventScrollReset:!1,revalidation:"idle",loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||w,fetchers:new Map,blockers:new Map},C="POP",j=null,T=!1,A,R=!1,D=new Map,M=null,O=!1,I=!1,L=new Set,V=new Map,F=0,N=-1,ee=new Map,Q=new Set,P=new Map,z=new Map,$=new Set,H=new Map,oe,q=null;function X(){if(u=e.history.listen(({action:W,location:Y,delta:ne})=>{if(oe){oe(),oe=void 0;return}un(H.size===0||ne!=null,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let ce=hn({currentLocation:E.location,nextLocation:Y,historyAction:W});if(ce&&ne!=null){let me=new Promise(Be=>{oe=Be});e.history.go(ne*-1),pn(ce,{state:"blocked",location:Y,proceed(){pn(ce,{state:"proceeding",proceed:void 0,reset:void 0,location:Y}),me.then(()=>e.history.go(ne))},reset(){let Be=new Map(E.blockers);Be.set(ce,Jl),G({blockers:Be})}}),j?.resolve(),j=null;return}return ge(W,Y)}),n){tz(t,D);let W=()=>nz(t,D);t.addEventListener("pagehide",W),M=()=>t.removeEventListener("pagehide",W)}return E.initialized||ge("POP",E.location,{initialHydration:!0}),S}function te(){u&&u(),M&&M(),p.clear(),A&&A.abort(),E.fetchers.forEach((W,Y)=>Ne(Y)),E.blockers.forEach((W,Y)=>wt(Y))}function ue(W){return p.add(W),()=>p.delete(W)}function G(W,Y={}){W.matches&&(W.matches=W.matches.map(me=>{let Be=o[me.route.id],Fe=me.route;return Fe.element!==Be.element||Fe.errorElement!==Be.errorElement||Fe.hydrateFallbackElement!==Be.hydrateFallbackElement?{...me,route:Be}:me})),E={...E,...W};let ne=[],ce=[];E.fetchers.forEach((me,Be)=>{me.state==="idle"&&($.has(Be)?ne.push(Be):ce.push(Be))}),$.forEach(me=>{!E.fetchers.has(me)&&!V.has(me)&&ne.push(me)}),[...p].forEach(me=>me(E,{deletedFetchers:ne,newErrors:W.errors??null,viewTransitionOpts:Y.viewTransitionOpts,flushSync:Y.flushSync===!0})),ne.forEach(me=>Ne(me)),ce.forEach(me=>E.fetchers.delete(me))}function be(W,Y,{flushSync:ne}={}){let ce=E.actionData!=null&&E.navigation.formMethod!=null&&Gn(E.navigation.formMethod)&&E.navigation.state==="loading"&&W.state?._isRedirect!==!0,me;Y.actionData?Object.keys(Y.actionData).length>0?me=Y.actionData:me=null:ce?me=E.actionData:me=null;let Be=Y.loaderData?sk(E.loaderData,Y.loaderData,Y.matches||[],Y.errors):E.loaderData,Fe=E.blockers;Fe.size>0&&(Fe=new Map(Fe),Fe.forEach((Xe,He)=>Fe.set(He,Jl)));let Ie=O?!1:Lt(W,Y.matches||E.matches),$e=T===!0||E.navigation.formMethod!=null&&Gn(E.navigation.formMethod)&&W.state?._isRedirect!==!0;s.commitHmrRoutes(),O||C==="POP"||(C==="PUSH"?e.history.push(W,W.state):C==="REPLACE"&&e.history.replace(W,W.state));let ze;if(C==="POP"){let Xe=D.get(E.location.pathname);Xe&&Xe.has(W.pathname)?ze={currentLocation:E.location,nextLocation:W}:D.has(W.pathname)&&(ze={currentLocation:W,nextLocation:E.location})}else if(R){let Xe=D.get(E.location.pathname);Xe?Xe.add(W.pathname):(Xe=new Set([W.pathname]),D.set(E.location.pathname,Xe)),ze={currentLocation:E.location,nextLocation:W}}G({...Y,actionData:me,loaderData:Be,historyAction:C,location:W,initialized:!0,renderFallback:!1,navigation:Tm,revalidation:"idle",restoreScrollPosition:Ie,preventScrollReset:$e,blockers:Fe},{viewTransitionOpts:ze,flushSync:ne===!0}),C="POP",T=!1,R=!1,O=!1,I=!1,j?.resolve(),j=null,q?.resolve(),q=null}async function xe(W,Y){if(j?.resolve(),j=null,typeof W=="number"){j||(j=dk());let Bt=j.promise;return e.history.go(W),Bt}let ne=kv(E.location,E.matches,l,W,Y?.fromRouteId,Y?.relative),{path:ce,submission:me,error:Be}=Z1(!1,ne,Y),Fe;Y?.mask&&(Fe={pathname:"",search:"",hash:"",...typeof Y.mask=="string"?ca(Y.mask):{...E.location.mask,...Y.mask}});let Ie=E.location,$e=Zc(Ie,ce,Y&&Y.state,void 0,Fe);$e={...$e,...e.history.encodeLocation($e)};let ze=Y&&Y.replace!=null?Y.replace:void 0,Xe="PUSH";ze===!0?Xe="REPLACE":ze===!1||me!=null&&Gn(me.formMethod)&&me.formAction===E.location.pathname+E.location.search&&(Xe="REPLACE");let He=Y&&"preventScrollReset"in Y?Y.preventScrollReset===!0:void 0,kt=(Y&&Y.flushSync)===!0,ht=hn({currentLocation:Ie,nextLocation:$e,historyAction:Xe});if(ht){pn(ht,{state:"blocked",location:$e,proceed(){pn(ht,{state:"proceeding",proceed:void 0,reset:void 0,location:$e}),xe(W,Y)},reset(){let Bt=new Map(E.blockers);Bt.set(ht,Jl),G({blockers:Bt})}});return}await ge(Xe,$e,{submission:me,pendingError:Be,preventScrollReset:He,replace:Y&&Y.replace,enableViewTransition:Y&&Y.viewTransition,flushSync:kt,callSiteDefaultShouldRevalidate:Y&&Y.defaultShouldRevalidate})}function Ae(){q||(q=dk()),U(),G({revalidation:"loading"});let W=q.promise;return E.navigation.state==="submitting"?W:E.navigation.state==="idle"?(ge(E.historyAction,E.location,{startUninterruptedRevalidation:!0}),W):(ge(C||E.historyAction,E.navigation.location,{overrideNavigation:E.navigation,enableViewTransition:R===!0}),W)}async function ge(W,Y,ne){A&&A.abort(),A=null,C=W,O=(ne&&ne.startUninterruptedRevalidation)===!0,jt(E.location,E.matches),T=(ne&&ne.preventScrollReset)===!0,R=(ne&&ne.enableViewTransition)===!0;let ce=s.activeRoutes,me=ne&&ne.overrideNavigation,Be=ne?.initialHydration&&E.matches&&E.matches.length>0&&!b?E.matches:mi(ce,Y,l,!1,s.branches),Fe=(ne&&ne.flushSync)===!0;if(Be&&E.initialized&&!I&&V4(E.location,Y)&&!(ne&&ne.submission&&Gn(ne.submission.formMethod))){be(Y,{matches:Be},{flushSync:Fe});return}let Ie=Vt(Be,ce,Y.pathname);if(Ie.active&&Ie.matches&&(Be=Ie.matches),!Be){let{error:Zt,notFoundMatches:Rn,route:yt}=Hn(Y.pathname);be(Y,{matches:Rn,loaderData:{},errors:{[yt.id]:Zt}},{flushSync:Fe});return}A=new AbortController;let $e=Zs(e.history,Y,A.signal,ne&&ne.submission),ze=e.getContext?await e.getContext():new V1,Xe;if(ne&&ne.pendingError)Xe=[no(Be).route.id,{type:"error",error:ne.pendingError}];else if(ne&&ne.submission&&Gn(ne.submission.formMethod)){let Zt=await _e($e,Y,ne.submission,Be,ze,Ie.active,ne&&ne.initialHydration===!0,{replace:ne.replace,flushSync:Fe});if(Zt.shortCircuited)return;if(Zt.pendingActionResult){let[Rn,yt]=Zt.pendingActionResult;if(Rr(yt)&&Jc(yt.error)&&yt.error.status===404){A=null,be(Y,{matches:Zt.matches,loaderData:{},errors:{[Rn]:yt.error}});return}}Be=Zt.matches||Be,Xe=Zt.pendingActionResult,me=Om(Y,ne.submission),Fe=!1,Ie.active=!1,$e=Zs(e.history,$e.url,$e.signal)}let{shortCircuited:He,matches:kt,loaderData:ht,errors:Bt}=await De($e,Y,Be,ze,Ie.active,me,ne&&ne.submission,ne&&ne.fetcherSubmission,ne&&ne.replace,ne&&ne.initialHydration===!0,Fe,Xe,ne&&ne.callSiteDefaultShouldRevalidate);He||(A=null,be(Y,{matches:kt||Be,...lk(Xe),loaderData:ht,errors:Bt}))}async function _e(W,Y,ne,ce,me,Be,Fe,Ie={}){U();let $e=J4(Y,ne);if(G({navigation:$e},{flushSync:Ie.flushSync===!0}),Be){let He=await Tr(ce,Y.pathname,W.signal);if(He.type==="aborted")return{shortCircuited:!0};if(He.type==="error"){if(He.partialMatches.length===0){let{matches:ht,route:Bt}=fd(s.activeRoutes);return{matches:ht,pendingActionResult:[Bt.id,{type:"error",error:He.error}]}}let kt=no(He.partialMatches).route.id;return{matches:He.partialMatches,pendingActionResult:[kt,{type:"error",error:He.error}]}}else if(He.matches)ce=He.matches;else{let{notFoundMatches:kt,error:ht,route:Bt}=Hn(Y.pathname);return{matches:kt,pendingActionResult:[Bt.id,{type:"error",error:ht}]}}}let ze,Xe=df(ce,Y);if(!Xe.route.action&&!Xe.route.lazy)ze={type:"error",error:Xr(405,{method:W.method,pathname:Y.pathname,routeId:Xe.route.id})};else{let He=ol(a,o,W,Y,ce,Xe,Fe?[]:r,me),kt=await Se(W,Y,He,me,null);if(ze=kt[Xe.route.id],!ze){for(let ht of ce)if(kt[ht.route.id]){ze=kt[ht.route.id];break}}if(W.signal.aborted)return{shortCircuited:!0}}if(Xo(ze)){let He;return Ie&&Ie.replace!=null?He=Ie.replace:He=ik(ze.response.headers.get("Location"),new URL(W.url),l,e.history)===E.location.pathname+E.location.search,await se(W,ze,!0,{submission:ne,replace:He}),{shortCircuited:!0}}if(Rr(ze)){let He=no(ce,Xe.route.id);return(Ie&&Ie.replace)!==!0&&(C="PUSH"),{matches:ce,pendingActionResult:[He.route.id,ze,Xe.route.id]}}return{matches:ce,pendingActionResult:[Xe.route.id,ze]}}async function De(W,Y,ne,ce,me,Be,Fe,Ie,$e,ze,Xe,He,kt){let ht=Be||Om(Y,Fe),Bt=Fe||Ie||uk(ht),Zt=!O&&!ze;if(me){if(Zt){let qn=ve(He);G({navigation:ht,...qn!==void 0?{actionData:qn}:{}},{flushSync:Xe})}let ft=await Tr(ne,Y.pathname,W.signal);if(ft.type==="aborted")return{shortCircuited:!0};if(ft.type==="error"){if(ft.partialMatches.length===0){let{matches:Is,route:Io}=fd(s.activeRoutes);return{matches:Is,loaderData:{},errors:{[Io.id]:ft.error}}}let qn=no(ft.partialMatches).route.id;return{matches:ft.partialMatches,loaderData:{},errors:{[qn]:ft.error}}}else if(ft.matches)ne=ft.matches;else{let{error:qn,notFoundMatches:Is,route:Io}=Hn(Y.pathname);return{matches:Is,loaderData:{},errors:{[Io.id]:qn}}}}let Rn=s.activeRoutes,{dsMatches:yt,revalidatingFetchers:Or}=Q1(W,ce,a,o,e.history,E,ne,Bt,Y,ze?[]:r,ze===!0,I,L,$,P,Q,Rn,l,e.patchRoutesOnNavigation!=null,s.branches,He,kt);if(N=++F,!e.dataStrategy&&!yt.some(ft=>ft.shouldLoad)&&!yt.some(ft=>ft.route.middleware&&ft.route.middleware.length>0)&&Or.length===0){let ft=Nt();return be(Y,{matches:ne,loaderData:{},errors:He&&Rr(He[1])?{[He[0]]:He[1].error}:null,...lk(He),...ft?{fetchers:new Map(E.fetchers)}:{}},{flushSync:Xe}),{shortCircuited:!0}}if(Zt){let ft={};if(!me){ft.navigation=ht;let qn=ve(He);qn!==void 0&&(ft.actionData=qn)}Or.length>0&&(ft.fetchers=Le(Or)),G(ft,{flushSync:Xe})}Or.forEach(ft=>{xt(ft.key),ft.controller&&V.set(ft.key,ft.controller)});let Ro=()=>Or.forEach(ft=>xt(ft.key));A&&A.signal.addEventListener("abort",Ro);let{loaderResults:Zl,fetcherResults:Ka}=await Z(yt,Or,W,Y,ce);if(W.signal.aborted)return{shortCircuited:!0};A&&A.signal.removeEventListener("abort",Ro),Or.forEach(ft=>V.delete(ft.key));let Ti=pd(Zl);if(Ti)return await se(W,Ti.result,!0,{replace:$e}),{shortCircuited:!0};if(Ti=pd(Ka),Ti)return Q.add(Ti.key),await se(W,Ti.result,!0,{replace:$e}),{shortCircuited:!0};let{loaderData:jm,errors:Ql}=ok(E,ne,Zl,He,Or,Ka);ze&&E.errors&&(Ql={...E.errors,...Ql});let Mo=Nt(),cd=sn(N),ud=Mo||cd||Or.length>0;return{matches:ne,loaderData:jm,errors:Ql,...ud?{fetchers:new Map(E.fetchers)}:{}}}function ve(W){if(W&&!Rr(W[1]))return{[W[0]]:W[1].data};if(E.actionData)return Object.keys(E.actionData).length===0?null:E.actionData}function Le(W){return W.forEach(Y=>{let ne=E.fetchers.get(Y.key),ce=ec(void 0,ne?ne.data:void 0);E.fetchers.set(Y.key,ce)}),new Map(E.fetchers)}async function le(W,Y,ne,ce){xt(W);let me=(ce&&ce.flushSync)===!0,Be=s.activeRoutes,Fe=kv(E.location,E.matches,l,ne,Y,ce?.relative),Ie=mi(Be,Fe,l,!1,s.branches),$e=Vt(Ie,Be,Fe);if($e.active&&$e.matches&&(Ie=$e.matches),!Ie){we(W,Y,Xr(404,{pathname:Fe}),{flushSync:me});return}let{path:ze,submission:Xe,error:He}=Z1(!0,Fe,ce);if(He){we(W,Y,He,{flushSync:me});return}let kt=e.getContext?await e.getContext():new V1,ht=(ce&&ce.preventScrollReset)===!0;if(Xe&&Gn(Xe.formMethod)){await pe(W,Y,ze,Ie,kt,$e.active,me,ht,Xe,ce&&ce.defaultShouldRevalidate);return}P.set(W,{routeId:Y,path:ze}),await K(W,Y,ze,Ie,kt,$e.active,me,ht,Xe)}async function pe(W,Y,ne,ce,me,Be,Fe,Ie,$e,ze){U(),P.delete(W);let Xe=E.fetchers.get(W);fe(W,ez($e,Xe),{flushSync:Fe});let He=new AbortController,kt=Zs(e.history,ne,He.signal,$e);if(Be){let qt=await Tr(ce,new URL(kt.url).pathname,kt.signal,W);if(qt.type==="aborted")return;if(qt.type==="error"){we(W,Y,qt.error,{flushSync:Fe});return}else if(qt.matches)ce=qt.matches;else{we(W,Y,Xr(404,{pathname:ne}),{flushSync:Fe});return}}let ht=df(ce,ne);if(!ht.route.action&&!ht.route.lazy){let qt=Xr(405,{method:$e.formMethod,pathname:ne,routeId:Y});we(W,Y,qt,{flushSync:Fe});return}V.set(W,He);let Bt=F,Zt=ol(a,o,kt,ne,ce,ht,r,me),Rn=await Se(kt,ne,Zt,me,W),yt=Rn[ht.route.id];if(!yt){for(let qt of Zt)if(Rn[qt.route.id]){yt=Rn[qt.route.id];break}}if(kt.signal.aborted){V.get(W)===He&&V.delete(W);return}if($.has(W)){if(Xo(yt)||Rr(yt)){fe(W,ma(void 0));return}}else{if(Xo(yt))if(V.delete(W),N>Bt){fe(W,ma(void 0));return}else return Q.add(W),fe(W,ec($e)),se(kt,yt,!1,{fetcherSubmission:$e,preventScrollReset:Ie});if(Rr(yt)){we(W,Y,yt.error);return}}let Or=E.navigation.location||E.location,Ro=Zs(e.history,Or,He.signal),Zl=s.activeRoutes,Ka=E.navigation.state!=="idle"?mi(Zl,E.navigation.location,l,!1,s.branches):E.matches;at(Ka,"Didn't find any matches after fetcher action");let Ti=++F;ee.set(W,Ti);let jm=ec($e,yt.data);E.fetchers.set(W,jm);let{dsMatches:Ql,revalidatingFetchers:Mo}=Q1(Ro,me,a,o,e.history,E,Ka,$e,Or,r,!1,I,L,$,P,Q,Zl,l,e.patchRoutesOnNavigation!=null,s.branches,[ht.route.id,yt],ze);Mo.filter(qt=>qt.key!==W).forEach(qt=>{let dd=qt.key,z1=E.fetchers.get(dd),A$=ec(void 0,z1?z1.data:void 0);E.fetchers.set(dd,A$),xt(dd),qt.controller&&V.set(dd,qt.controller)}),G({fetchers:new Map(E.fetchers)});let cd=()=>Mo.forEach(qt=>xt(qt.key));He.signal.addEventListener("abort",cd);let{loaderResults:ud,fetcherResults:ft}=await Z(Ql,Mo,Ro,Or,me);if(He.signal.aborted)return;if(He.signal.removeEventListener("abort",cd),ee.delete(W),V.delete(W),Mo.forEach(qt=>V.delete(qt.key)),E.fetchers.has(W)){let qt=ma(yt.data);E.fetchers.set(W,qt)}let qn=pd(ud);if(qn)return se(Ro,qn.result,!1,{preventScrollReset:Ie});if(qn=pd(ft),qn)return Q.add(qn.key),se(Ro,qn.result,!1,{preventScrollReset:Ie});let{loaderData:Is,errors:Io}=ok(E,Ka,ud,void 0,Mo,ft);sn(Ti),E.navigation.state==="loading"&&Ti>N?(at(C,"Expected pending action"),A&&A.abort(),be(E.navigation.location,{matches:Ka,loaderData:Is,errors:Io,fetchers:new Map(E.fetchers)})):(G({errors:Io,loaderData:sk(E.loaderData,Is,Ka,Io),fetchers:new Map(E.fetchers)}),I=!1)}async function K(W,Y,ne,ce,me,Be,Fe,Ie,$e){let ze=E.fetchers.get(W);fe(W,ec($e,ze?ze.data:void 0),{flushSync:Fe});let Xe=new AbortController,He=Zs(e.history,ne,Xe.signal);if(Be){let yt=await Tr(ce,new URL(He.url).pathname,He.signal,W);if(yt.type==="aborted")return;if(yt.type==="error"){we(W,Y,yt.error,{flushSync:Fe});return}else if(yt.matches)ce=yt.matches;else{we(W,Y,Xr(404,{pathname:ne}),{flushSync:Fe});return}}let kt=df(ce,ne);V.set(W,Xe);let ht=F,Bt=ol(a,o,He,ne,ce,kt,r,me),Zt=await Se(He,ne,Bt,me,W),Rn=Zt[kt.route.id];if(!Rn){for(let yt of ce)if(Zt[yt.route.id]){Rn=Zt[yt.route.id];break}}if(V.get(W)===Xe&&V.delete(W),!He.signal.aborted){if($.has(W)){fe(W,ma(void 0));return}if(Xo(Rn))if(N>ht){fe(W,ma(void 0));return}else{Q.add(W),await se(He,Rn,!1,{preventScrollReset:Ie});return}if(Rr(Rn)){we(W,Y,Rn.error);return}fe(W,ma(Rn.data))}}async function se(W,Y,ne,{submission:ce,fetcherSubmission:me,preventScrollReset:Be,replace:Fe}={}){ne||(j?.resolve(),j=null),Y.response.headers.has("X-Remix-Revalidate")&&(I=!0);let Ie=Y.response.headers.get("Location");at(Ie,"Expected a Location header on the redirect Response"),Ie=ik(Ie,new URL(W.url),l,e.history);let $e=Zc(E.location,Ie,{_isRedirect:!0});if(n){let Bt=!1;if(Y.response.headers.has("X-Remix-Reload-Document"))Bt=!0;else if(mb(Ie)){const Zt=hT(Ie,!0);Bt=Zt.origin!==t.location.origin||ai(Zt.pathname,l)==null}if(Bt){Fe?t.location.replace(Ie):t.location.assign(Ie);return}}A=null;let ze=Fe===!0||Y.response.headers.has("X-Remix-Replace")?"REPLACE":"PUSH",{formMethod:Xe,formAction:He,formEncType:kt}=E.navigation;!ce&&!me&&Xe&&He&&kt&&(ce=uk(E.navigation));let ht=ce||me;if(P4.has(Y.response.status)&&ht&&Gn(ht.formMethod))await ge(ze,$e,{submission:{...ht,formAction:Ie},preventScrollReset:Be||T,enableViewTransition:ne?R:void 0});else{let Bt=Om($e,ce);await ge(ze,$e,{overrideNavigation:Bt,fetcherSubmission:me,preventScrollReset:Be||T,enableViewTransition:ne?R:void 0})}}async function Se(W,Y,ne,ce,me){let Be,Fe={};try{Be=await z4(c,W,Y,ne,me,ce,!1)}catch(Ie){return ne.filter($e=>$e.shouldLoad).forEach($e=>{Fe[$e.route.id]={type:"error",error:Ie}}),Fe}if(W.signal.aborted)return Fe;if(!Gn(W.method))for(let Ie of ne){if(Be[Ie.route.id]?.type==="error")break;!Be.hasOwnProperty(Ie.route.id)&&!E.loaderData.hasOwnProperty(Ie.route.id)&&(!E.errors||!E.errors.hasOwnProperty(Ie.route.id))&&Ie.shouldCallHandler()&&(Be[Ie.route.id]={type:"error",result:new Error(`No result returned from dataStrategy for route ${Ie.route.id}`)})}for(let[Ie,$e]of Object.entries(Be))if(Y4($e)){let ze=$e.result;Fe[Ie]={type:"redirect",response:H4(ze,W,Ie,ne,l)}}else Fe[Ie]=await W4($e);return Fe}async function Z(W,Y,ne,ce,me){let Be=Se(ne,ce,W,me,null),Fe=Promise.all(Y.map(async ze=>{if(ze.matches&&ze.match&&ze.request&&ze.controller){let He=(await Se(ze.request,ze.path,ze.matches,me,ze.key))[ze.match.route.id];return{[ze.key]:He}}else return Promise.resolve({[ze.key]:{type:"error",error:Xr(404,{pathname:ze.path})}})})),Ie=await Be,$e=(await Fe).reduce((ze,Xe)=>Object.assign(ze,Xe),{});return{loaderResults:Ie,fetcherResults:$e}}function U(){I=!0,P.forEach((W,Y)=>{V.has(Y)&&L.add(Y),xt(Y)})}function fe(W,Y,ne={}){E.fetchers.set(W,Y),G({fetchers:new Map(E.fetchers)},{flushSync:(ne&&ne.flushSync)===!0})}function we(W,Y,ne,ce={}){let me=no(E.matches,Y);Ne(W),G({errors:{[me.route.id]:ne},fetchers:new Map(E.fetchers)},{flushSync:(ce&&ce.flushSync)===!0})}function Re(W){return z.set(W,(z.get(W)||0)+1),$.has(W)&&$.delete(W),E.fetchers.get(W)||N4}function Ee(W,Y){xt(W,Y?.reason),fe(W,ma(null))}function Ne(W){let Y=E.fetchers.get(W);V.has(W)&&!(Y&&Y.state==="loading"&&ee.has(W))&&xt(W),P.delete(W),ee.delete(W),Q.delete(W),$.delete(W),L.delete(W),E.fetchers.delete(W)}function nt(W){let Y=(z.get(W)||0)-1;Y<=0?(z.delete(W),$.add(W)):z.set(W,Y),G({fetchers:new Map(E.fetchers)})}function xt(W,Y){let ne=V.get(W);ne&&(ne.abort(Y),V.delete(W))}function fn(W){for(let Y of W){let ne=Re(Y),ce=ma(ne.data);E.fetchers.set(Y,ce)}}function Nt(){let W=[],Y=!1;for(let ne of Q){let ce=E.fetchers.get(ne);at(ce,`Expected fetcher: ${ne}`),ce.state==="loading"&&(Q.delete(ne),W.push(ne),Y=!0)}return fn(W),Y}function sn(W){let Y=[];for(let[ne,ce]of ee)if(ce<W){let me=E.fetchers.get(ne);at(me,`Expected fetcher: ${ne}`),me.state==="loading"&&(xt(ne),ee.delete(ne),Y.push(ne))}return fn(Y),Y.length>0}function tt(W,Y){let ne=E.blockers.get(W)||Jl;return H.get(W)!==Y&&H.set(W,Y),ne}function wt(W){E.blockers.delete(W),H.delete(W)}function pn(W,Y){let ne=E.blockers.get(W)||Jl;at(ne.state==="unblocked"&&Y.state==="blocked"||ne.state==="blocked"&&Y.state==="blocked"||ne.state==="blocked"&&Y.state==="proceeding"||ne.state==="blocked"&&Y.state==="unblocked"||ne.state==="proceeding"&&Y.state==="unblocked",`Invalid blocker state transition: ${ne.state} -> ${Y.state}`);let ce=new Map(E.blockers);ce.set(W,Y),G({blockers:ce})}function hn({currentLocation:W,nextLocation:Y,historyAction:ne}){if(H.size===0)return;H.size>1&&un(!1,"A router only supports one blocker at a time");let ce=Array.from(H.entries()),[me,Be]=ce[ce.length-1],Fe=E.blockers.get(me);if(!(Fe&&Fe.state==="proceeding")&&Be({currentLocation:W,nextLocation:Y,historyAction:ne}))return me}function Hn(W){let Y=Xr(404,{pathname:W}),ne=s.activeRoutes,{matches:ce,route:me}=fd(ne);return{notFoundMatches:ce,route:me,error:Y}}function Un(W,Y,ne){if(h=W,g=Y,y=ne||null,!x&&E.navigation===Tm){x=!0;let ce=Lt(E.location,E.matches);ce!=null&&G({restoreScrollPosition:ce})}return()=>{h=null,g=null,y=null}}function Ve(W,Y){return y&&y(W,Y.map(ce=>t4(ce,E.loaderData)))||W.key}function jt(W,Y){if(h&&g){let ne=Ve(W,Y);h[ne]=g()}}function Lt(W,Y){if(h){let ne=Ve(W,Y),ce=h[ne];if(typeof ce=="number")return ce}return null}function Vt(W,Y,ne){if(e.patchRoutesOnNavigation){let ce=s.branches;if(W){if(Object.keys(W[0].params).length>0)return{active:!0,matches:mi(Y,ne,l,!0,ce)}}else return{active:!0,matches:mi(Y,ne,l,!0,ce)||[]}}return{active:!1,matches:null}}async function Tr(W,Y,ne,ce){if(!e.patchRoutesOnNavigation)return{type:"success",matches:W};let me=W;for(;;){let Be=o;try{await e.patchRoutesOnNavigation({signal:ne,path:Y,matches:me,fetcherKey:ce,patch:(ze,Xe)=>{ne.aborted||J1(ze,Xe,s,Be,a,!1)}})}catch(ze){return{type:"error",error:ze,partialMatches:me}}if(ne.aborted)return{type:"aborted"};let Fe=s.branches,Ie=mi(s.activeRoutes,Y,l,!1,Fe),$e=null;if(Ie){if(Object.keys(Ie[0].params).length===0)return{type:"success",matches:Ie};if($e=mi(s.activeRoutes,Y,l,!0,Fe),!($e&&me.length<$e.length&&$t(me,$e.slice(0,me.length))))return{type:"success",matches:Ie}}if($e||($e=mi(s.activeRoutes,Y,l,!0,Fe)),!$e||$t(me,$e))return{type:"success",matches:null};me=$e}}function $t(W,Y){return W.length===Y.length&&W.every((ne,ce)=>ne.route.id===Y[ce].route.id)}function Vn(W){o={},s.setHmrRoutes(Qc(W,a,void 0,o))}function Ni(W,Y,ne=!1){J1(W,Y,s,o,a,ne),s.hasHMRRoutes||G({})}return S={get basename(){return l},get future(){return d},get state(){return E},get routes(){return s.stableRoutes},get branches(){return s.branches},get manifest(){return o},get window(){return t},initialize:X,subscribe:ue,enableScrollRestoration:Un,navigate:xe,fetch:le,revalidate:Ae,createHref:W=>e.history.createHref(W),encodeLocation:W=>e.history.encodeLocation(W),getFetcher:Re,resetFetcher:Ee,deleteFetcher:nt,dispose:te,getBlocker:tt,deleteBlocker:wt,patchRoutes:Ni,_internalFetchControllers:V,_internalSetRoutes:Vn,_internalSetStateDoNotUseOrYouWillBreakYourApp(W){G(W)}},e.instrumentations&&(S=b4(S,e.instrumentations.map(W=>W.router).filter(Boolean))),S}function R4(e){return e!=null&&("formData"in e&&e.formData!=null||"body"in e&&e.body!==void 0)}function kv(e,t,n,r,i,a){let o,s;if(i){o=[];for(let c of t)if(o.push(c),c.route.id===i){s=c;break}}else o=t,s=t[t.length-1];let l=ph(r||".",gb(o),ai(e.pathname,n)||e.pathname,a==="path");if(r==null&&(l.search=e.search,l.hash=e.hash),(r==null||r===""||r===".")&&s){let c=bb(l.search);if(s.route.index&&!c)l.search=l.search?l.search.replace(/^\?/,"?index&"):"?index";else if(!s.route.index&&c){let d=new URLSearchParams(l.search),u=d.getAll("index");d.delete("index"),u.filter(h=>h).forEach(h=>d.append("index",h));let p=d.toString();l.search=p?`?${p}`:""}}return n!=="/"&&(l.pathname=h4({basename:n,pathname:l.pathname})),Ji(l)}function Z1(e,t,n){if(!n||!R4(n))return{path:t};if(n.formMethod&&!Q4(n.formMethod))return{path:t,error:Xr(405,{method:n.formMethod})};let r=()=>({path:t,error:Xr(400,{type:"invalid-body"})}),a=(n.formMethod||"get").toUpperCase(),o=MT(t);if(n.body!==void 0){if(n.formEncType==="text/plain"){if(!Gn(a))return r();let u=typeof n.body=="string"?n.body:n.body instanceof FormData||n.body instanceof URLSearchParams?Array.from(n.body.entries()).reduce((p,[h,y])=>`${p}${h}=${y}
2
2
  `,""):String(n.body);return{path:t,submission:{formMethod:a,formAction:o,formEncType:n.formEncType,formData:void 0,json:void 0,text:u}}}else if(n.formEncType==="application/json"){if(!Gn(a))return r();try{let u=typeof n.body=="string"?JSON.parse(n.body):n.body;return{path:t,submission:{formMethod:a,formAction:o,formEncType:n.formEncType,formData:void 0,json:u,text:void 0}}}catch{return r()}}}at(typeof FormData=="function","FormData is not available in this environment");let s,l;if(n.formData)s=Sv(n.formData),l=n.formData;else if(n.body instanceof FormData)s=Sv(n.body),l=n.body;else if(n.body instanceof URLSearchParams)s=n.body,l=ak(s);else if(n.body==null)s=new URLSearchParams,l=new FormData;else try{s=new URLSearchParams(n.body),l=ak(s)}catch{return r()}let c={formMethod:a,formAction:o,formEncType:n&&n.formEncType||"application/x-www-form-urlencoded",formData:l,json:void 0,text:void 0};if(Gn(c.formMethod))return{path:t,submission:c};let d=ca(t);return e&&d.search&&bb(d.search)&&s.append("index",""),d.search=`?${s}`,{path:Ji(d),submission:c}}function Q1(e,t,n,r,i,a,o,s,l,c,d,u,p,h,y,g,x,v,b,w,_,k){let S=_?Rr(_[1])?_[1].error:_[1].data:void 0,E=i.createURL(a.location),C=i.createURL(l),j;if(d&&a.errors){let I=Object.keys(a.errors)[0];j=o.findIndex(L=>L.route.id===I)}else if(_&&Rr(_[1])){let I=_[0];j=o.findIndex(L=>L.route.id===I)-1}let T=_?_[1].statusCode:void 0,A=T&&T>=400,R={currentUrl:E,currentParams:a.matches[0]?.params||{},nextUrl:C,nextParams:o[0].params,...s,actionResult:S,actionStatus:T},D=Tu(o),M=o.map((I,L)=>{let{route:V}=I,F=null;if(j!=null&&L>j)F=!1;else if(V.lazy)F=!0;else if(!vb(V))F=!1;else if(d){let{shouldLoad:P}=jT(V,a.loaderData,a.errors);F=P}else M4(a.loaderData,a.matches[L],I)&&(F=!0);if(F!==null)return _v(n,r,e,l,D,I,c,t,F);let N=!1;typeof k=="boolean"?N=k:A?N=!1:(u||E.pathname+E.search===C.pathname+C.search||E.search!==C.search||I4(a.matches[L],I))&&(N=!0);let ee={...R,defaultShouldRevalidate:N},Q=Ac(I,ee);return _v(n,r,e,l,D,I,c,t,Q,ee,k)}),O=[];return y.forEach((I,L)=>{if(d||!o.some($=>$.route.id===I.routeId)||h.has(L))return;let V=a.fetchers.get(L),F=V&&V.state!=="idle"&&V.data===void 0,N=mi(x,I.path,v??"/",!1,w);if(!N){if(b&&F)return;O.push({key:L,routeId:I.routeId,path:I.path,matches:null,match:null,request:null,controller:null});return}if(g.has(L))return;let ee=df(N,I.path),Q=new AbortController,P=Zs(i,I.path,Q.signal),z=null;if(p.has(L))p.delete(L),z=ol(n,r,P,I.path,N,ee,c,t);else if(F)u&&(z=ol(n,r,P,I.path,N,ee,c,t));else{let $;typeof k=="boolean"?$=k:A?$=!1:$=u;let H={...R,defaultShouldRevalidate:$};Ac(ee,H)&&(z=ol(n,r,P,I.path,N,ee,c,t,H))}z&&O.push({key:L,routeId:I.routeId,path:I.path,matches:z,match:ee,request:P,controller:Q})}),{dsMatches:M,revalidatingFetchers:O}}function vb(e){return e.loader!=null||e.middleware!=null&&e.middleware.length>0}function jT(e,t,n){if(e.lazy)return{shouldLoad:!0,renderFallback:!0};if(!vb(e))return{shouldLoad:!1,renderFallback:!1};let r=t!=null&&e.id in t,i=n!=null&&n[e.id]!==void 0;if(!r&&i)return{shouldLoad:!1,renderFallback:!1};if(typeof e.loader=="function"&&e.loader.hydrate===!0)return{shouldLoad:!0,renderFallback:!r};let a=!r&&!i;return{shouldLoad:a,renderFallback:a}}function M4(e,t,n){let r=!t||n.route.id!==t.route.id,i=!e.hasOwnProperty(n.route.id);return r||i}function I4(e,t){let n=e.route.path;return e.pathname!==t.pathname||n!=null&&n.endsWith("*")&&e.params["*"]!==t.params["*"]}function Ac(e,t){if(e.route.shouldRevalidate){let n=e.route.shouldRevalidate(t);if(typeof n=="boolean")return n}return t.defaultShouldRevalidate}function J1(e,t,n,r,i,a){let o;if(e){let c=r[e];at(c,`No route found to patch children into: routeId = ${e}`),c.children||(c.children=[]),o=c.children}else o=n.activeRoutes;let s=[],l=[];if(t.forEach(c=>{let d=o.find(u=>PT(c,u));d?l.push({existingRoute:d,newRoute:c}):s.push(c)}),s.length>0){let c=Qc(s,i,[e||"_","patch",String(o?.length||"0")],r);o.push(...c)}if(a&&l.length>0)for(let c=0;c<l.length;c++){let{existingRoute:d,newRoute:u}=l[c],p=d,[h]=Qc([u],i,[],{},!0);Object.assign(p,{element:h.element?h.element:p.element,errorElement:h.errorElement?h.errorElement:p.errorElement,hydrateFallbackElement:h.hydrateFallbackElement?h.hydrateFallbackElement:p.hydrateFallbackElement})}n.hasHMRRoutes||n.setRoutes([...n.activeRoutes])}function PT(e,t){return"id"in e&&"id"in t&&e.id===t.id?!0:e.index===t.index&&e.path===t.path&&e.caseSensitive===t.caseSensitive?(!e.children||e.children.length===0)&&(!t.children||t.children.length===0)?!0:e.children?.every((n,r)=>t.children?.some(i=>PT(n,i)))??!1:!1}var ek=new WeakMap,NT=({key:e,route:t,manifest:n,mapRouteProperties:r})=>{let i=n[t.id];if(at(i,"No route found in manifest"),!i.lazy||typeof i.lazy!="object")return;let a=i.lazy[e];if(!a)return;let o=ek.get(i);o||(o={},ek.set(i,o));let s=o[e];if(s)return s;let l=(async()=>{let c=Z$(e),u=i[e]!==void 0&&e!=="hasErrorBoundary";if(c)un(!c,"Route property "+e+" is not a supported lazy route property. This property will be ignored."),o[e]=Promise.resolve();else if(u)un(!1,`Route "${i.id}" has a static property "${e}" defined. The lazy property will be ignored.`);else{let p=await a();p!=null&&(Object.assign(i,{[e]:p}),Object.assign(i,r(i)))}typeof i.lazy=="object"&&(i.lazy[e]=void 0,Object.values(i.lazy).every(p=>p===void 0)&&(i.lazy=void 0))})();return o[e]=l,l},tk=new WeakMap;function D4(e,t,n,r,i){let a=n[e.id];if(at(a,"No route found in manifest"),!e.lazy)return{lazyRoutePromise:void 0,lazyHandlerPromise:void 0};if(typeof e.lazy=="function"){let d=tk.get(a);if(d)return{lazyRoutePromise:d,lazyHandlerPromise:d};let u=(async()=>{at(typeof e.lazy=="function","No lazy route function found");let p=await e.lazy(),h={};for(let y in p){let g=p[y];if(g===void 0)continue;let x=J$(y),b=a[y]!==void 0&&y!=="hasErrorBoundary";x?un(!x,"Route property "+y+" is not a supported property to be returned from a lazy route function. This property will be ignored."):b?un(!b,`Route "${a.id}" has a static property "${y}" defined but its lazy function is also returning a value for this property. The lazy route property "${y}" will be ignored.`):h[y]=g}Object.assign(a,h),Object.assign(a,{...r(a),lazy:void 0})})();return tk.set(a,u),u.catch(()=>{}),{lazyRoutePromise:u,lazyHandlerPromise:u}}let o=Object.keys(e.lazy),s=[],l;for(let d of o){if(i&&i.includes(d))continue;let u=NT({key:d,route:e,manifest:n,mapRouteProperties:r});u&&(s.push(u),d===t&&(l=u))}let c=s.length>0?Promise.all(s).then(()=>{}):void 0;return c?.catch(()=>{}),l?.catch(()=>{}),{lazyRoutePromise:c,lazyHandlerPromise:l}}async function nk(e){let t=e.matches.filter(i=>i.shouldLoad),n={};return(await Promise.all(t.map(i=>i.resolve()))).forEach((i,a)=>{n[t[a].route.id]=i}),n}async function L4(e){return e.matches.some(t=>t.route.middleware)?TT(e,()=>nk(e)):nk(e)}function TT(e,t){return $4(e,t,r=>{if(Z4(r))throw r;return r},K4,n);function n(r,i,a){if(a)return Promise.resolve(Object.assign(a.value,{[i]:{type:"error",result:r}}));{let{matches:o}=e,s=Math.min(Math.max(o.findIndex(c=>c.route.id===i),0),Math.max(o.findIndex(c=>c.shouldCallHandler()),0)),l=no(o,o[s].route.id).route.id;return Promise.resolve({[l]:{type:"error",result:r}})}}}async function $4(e,t,n,r,i){let{matches:a,...o}=e,s=a.flatMap(c=>c.route.middleware?c.route.middleware.map(d=>[c.route.id,d]):[]);return await OT(o,s,t,n,r,i)}async function OT(e,t,n,r,i,a,o=0){let{request:s}=e;if(s.signal.aborted)throw s.signal.reason??new Error(`Request aborted: ${s.method} ${s.url}`);let l=t[o];if(!l)return await n();let[c,d]=l,u,p=async()=>{if(u)throw new Error("You may only call `next()` once per middleware");try{return u={value:await OT(e,t,n,r,i,a,o+1)},u.value}catch(h){return u={value:await a(h,c,u)},u.value}};try{let h=await d(e,p),y=h!=null?r(h):void 0;return i(y)?y:u?y??u.value:(u={value:await p()},u.value)}catch(h){return await a(h,c,u)}}function AT(e,t,n,r,i){let a=NT({key:"middleware",route:r.route,manifest:t,mapRouteProperties:e}),o=D4(r.route,Gn(n.method)?"action":"loader",t,e,i);return{middleware:a,route:o.lazyRoutePromise,handler:o.lazyHandlerPromise}}function _v(e,t,n,r,i,a,o,s,l,c=null,d){let u=!1,p=AT(e,t,n,a,o);return{...a,_lazyPromises:p,shouldLoad:l,shouldRevalidateArgs:c,shouldCallHandler(h){return u=!0,c?typeof d=="boolean"?Ac(a,{...c,defaultShouldRevalidate:d}):typeof h=="boolean"?Ac(a,{...c,defaultShouldRevalidate:h}):Ac(a,c):l},resolve(h){let{lazy:y,loader:g,middleware:x}=a.route,v=u||l||h&&!Gn(n.method)&&(y||g),b=x&&x.length>0&&!g&&!y;return v&&(Gn(n.method)||!b)?F4({request:n,path:r,pattern:i,match:a,lazyHandlerPromise:p?.handler,lazyRoutePromise:p?.route,handlerOverride:h,scopedContext:s}):Promise.resolve({type:"data",result:void 0})}}}function ol(e,t,n,r,i,a,o,s,l=null){return i.map(c=>c.route.id!==a.route.id?{...c,shouldLoad:!1,shouldRevalidateArgs:l,shouldCallHandler:()=>!1,_lazyPromises:AT(e,t,n,c,o),resolve:()=>Promise.resolve({type:"data",result:void 0})}:_v(e,t,n,r,Tu(i),c,o,s,!0,l))}async function z4(e,t,n,r,i,a,o){r.some(d=>d._lazyPromises?.middleware)&&await Promise.all(r.map(d=>d._lazyPromises?.middleware));let s={request:t,url:RT(t,n),pattern:Tu(r),params:r[0].params,context:a,matches:r},c=await e({...s,fetcherKey:i,runClientMiddleware:d=>{let u=s;return TT(u,()=>d({...u,fetcherKey:i,runClientMiddleware:()=>{throw new Error("Cannot call `runClientMiddleware()` from within an `runClientMiddleware` handler")}}))}});try{await Promise.all(r.flatMap(d=>[d._lazyPromises?.handler,d._lazyPromises?.route]))}catch{}return c}async function F4({request:e,path:t,pattern:n,match:r,lazyHandlerPromise:i,lazyRoutePromise:a,handlerOverride:o,scopedContext:s}){let l,c,d=Gn(e.method),u=d?"action":"loader",p=h=>{let y,g=new Promise((b,w)=>y=w);c=()=>y(),e.signal.addEventListener("abort",c);let x=b=>typeof h!="function"?Promise.reject(new Error(`You cannot call the handler for a route which defines a boolean "${u}" [routeId: ${r.route.id}]`)):h({request:e,url:RT(e,t),pattern:n,params:r.params,context:s},...b!==void 0?[b]:[]),v=(async()=>{try{return{type:"data",result:await(o?o(w=>x(w)):x())}}catch(b){return{type:"error",result:b}}})();return Promise.race([v,g])};try{let h=d?r.route.action:r.route.loader;if(i||a)if(h){let y,[g]=await Promise.all([p(h).catch(x=>{y=x}),i,a]);if(y!==void 0)throw y;l=g}else{await i;let y=d?r.route.action:r.route.loader;if(y)[l]=await Promise.all([p(y),a]);else if(u==="action"){let g=new URL(e.url),x=g.pathname+g.search;throw Xr(405,{method:e.method,pathname:x,routeId:r.route.id})}else return{type:"data",result:void 0}}else if(h)l=await p(h);else{let y=new URL(e.url),g=y.pathname+y.search;throw Xr(404,{pathname:g})}}catch(h){return{type:"error",result:h}}finally{c&&e.signal.removeEventListener("abort",c)}return l}async function B4(e){let t=e.headers.get("Content-Type");return t&&/\bapplication\/json\b/.test(t)?e.body==null?null:e.json():e.text()}async function W4(e){let{result:t,type:n}=e;if(xb(t)){let r;try{r=await B4(t)}catch(i){return{type:"error",error:i}}return n==="error"?{type:"error",error:new Nu(t.status,t.statusText,r),statusCode:t.status,headers:t.headers}:{type:"data",data:r,statusCode:t.status,headers:t.headers}}return n==="error"?ck(t)?t.data instanceof Error?{type:"error",error:t.data,statusCode:t.init?.status,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:"error",error:q4(t),statusCode:Jc(t)?t.status:void 0,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:"error",error:t,statusCode:Jc(t)?t.status:void 0}:ck(t)?{type:"data",data:t.data,statusCode:t.init?.status,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:"data",data:t}}function H4(e,t,n,r,i){let a=e.headers.get("Location");if(at(a,"Redirects returned/thrown from loaders/actions must have a Location header"),!mb(a)){let o=r.slice(0,r.findIndex(s=>s.route.id===n)+1);a=kv(new URL(t.url),o,i,a),e.headers.set("Location",a)}return e}var rk=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function ik(e,t,n,r){if(mb(e)){let i=e,a=i.startsWith("//")?new URL(t.protocol+i):new URL(i);if(rk.includes(a.protocol))throw new Error("Invalid redirect location");let o=ai(a.pathname,n)!=null;if(a.origin===t.origin&&o)return yb(a.pathname)+a.search+a.hash}try{let i=r.createURL(e);if(rk.includes(i.protocol))throw new Error("Invalid redirect location")}catch{}return e}function Zs(e,t,n,r){let i=e.createURL(MT(t)).toString(),a={signal:n};if(r&&Gn(r.formMethod)){let{formMethod:o,formEncType:s}=r;a.method=o.toUpperCase(),s==="application/json"?(a.headers=new Headers({"Content-Type":s}),a.body=JSON.stringify(r.json)):s==="text/plain"?a.body=r.text:s==="application/x-www-form-urlencoded"&&r.formData?a.body=Sv(r.formData):a.body=r.formData}return new Request(i,a)}function RT(e,t){let n=new URL(e.url),r=typeof t=="string"?ca(t):t;if(n.pathname=r.pathname||"/",r.search){let i=new URLSearchParams(r.search),a=i.getAll("index");i.delete("index");for(let o of a.filter(Boolean))i.append("index",o);n.search=i.size?`?${i.toString()}`:""}else n.search="";return n.hash=r.hash||"",n}function Sv(e){let t=new URLSearchParams;for(let[n,r]of e.entries())t.append(n,typeof r=="string"?r:r.name);return t}function ak(e){let t=new FormData;for(let[n,r]of e.entries())t.append(n,r);return t}function U4(e,t,n,r=!1,i=!1){let a={},o=null,s,l=!1,c={},d=n&&Rr(n[1])?n[1].error:void 0;return e.forEach(u=>{if(!(u.route.id in t))return;let p=u.route.id,h=t[p];if(at(!Xo(h),"Cannot handle redirect results in processLoaderData"),Rr(h)){let y=h.error;if(d!==void 0&&(y=d,d=void 0),o=o||{},i)o[p]=y;else{let g=no(e,p);o[g.route.id]==null&&(o[g.route.id]=y)}r||(a[p]=CT),l||(l=!0,s=Jc(h.error)?h.error.status:500),h.headers&&(c[p]=h.headers)}else a[p]=h.data,h.statusCode&&h.statusCode!==200&&!l&&(s=h.statusCode),h.headers&&(c[p]=h.headers)}),d!==void 0&&n&&(o={[n[0]]:d},n[2]&&(a[n[2]]=void 0)),{loaderData:a,errors:o,statusCode:s||200,loaderHeaders:c}}function ok(e,t,n,r,i,a){let{loaderData:o,errors:s}=U4(t,n,r);return i.filter(l=>!l.matches||l.matches.some(c=>c.shouldLoad)).forEach(l=>{let{key:c,match:d,controller:u}=l;if(u&&u.signal.aborted)return;let p=a[c];if(at(p,"Did not find corresponding fetcher result"),Rr(p)){let h=no(e.matches,d?.route.id);s&&s[h.route.id]||(s={...s,[h.route.id]:p.error}),e.fetchers.delete(c)}else if(Xo(p))at(!1,"Unhandled fetcher revalidation redirect");else{let h=ma(p.data);e.fetchers.set(c,h)}}),{loaderData:o,errors:s}}function sk(e,t,n,r){let i=Object.entries(t).filter(([,a])=>a!==CT).reduce((a,[o,s])=>(a[o]=s,a),{});for(let a of n){let o=a.route.id;if(!t.hasOwnProperty(o)&&e.hasOwnProperty(o)&&a.route.loader&&(i[o]=e[o]),r&&r.hasOwnProperty(o))break}return i}function lk(e){return e?Rr(e[1])?{actionData:{}}:{actionData:{[e[0]]:e[1].data}}:{}}function no(e,t){return(t?e.slice(0,e.findIndex(r=>r.route.id===t)+1):[...e]).reverse().find(r=>r.route.hasErrorBoundary===!0)||e[0]}function fd(e){let t=e.length===1?e[0]:e.find(n=>n.index||!n.path||n.path==="/")||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:t}],route:t}}function Xr(e,{pathname:t,routeId:n,method:r,type:i,message:a}={}){let o="Unknown Server Error",s="Unknown @remix-run/router error";return e===400?(o="Bad Request",r&&t&&n?s=`You made a ${r} request to "${t}" but did not provide a \`loader\` for route "${n}", so there is no way to handle the request.`:i==="invalid-body"&&(s="Unable to encode submission body")):e===403?(o="Forbidden",s=`Route "${n}" does not match URL "${t}"`):e===404?(o="Not Found",s=`No route matches URL "${t}"`):e===405&&(o="Method Not Allowed",r&&t&&n?s=`You made a ${r.toUpperCase()} request to "${t}" but did not provide an \`action\` for route "${n}", so there is no way to handle the request.`:r&&(s=`Invalid request method "${r.toUpperCase()}"`)),new Nu(e||500,o,new Error(s),!0)}function pd(e){let t=Object.entries(e);for(let n=t.length-1;n>=0;n--){let[r,i]=t[n];if(Xo(i))return{key:r,result:i}}}function MT(e){let t=typeof e=="string"?ca(e):e;return Ji({...t,hash:""})}function V4(e,t){return e.pathname!==t.pathname||e.search!==t.search?!1:e.hash===""?t.hash!=="":e.hash===t.hash?!0:t.hash!==""}function q4(e){return new Nu(e.init?.status??500,e.init?.statusText??"Internal Server Error",e.data)}function K4(e){return e!=null&&typeof e=="object"&&Object.entries(e).every(([t,n])=>typeof t=="string"&&G4(n))}function G4(e){return e!=null&&typeof e=="object"&&"type"in e&&"result"in e&&(e.type==="data"||e.type==="error")}function Y4(e){return xb(e.result)&&ST.has(e.result.status)}function Rr(e){return e.type==="error"}function Xo(e){return(e&&e.type)==="redirect"}function ck(e){return typeof e=="object"&&e!=null&&"type"in e&&"data"in e&&"init"in e&&e.type==="DataWithResponseInit"}function xb(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.headers=="object"&&typeof e.body<"u"}function X4(e){return ST.has(e)}function Z4(e){return xb(e)&&X4(e.status)&&e.headers.has("Location")}function Q4(e){return j4.has(e.toUpperCase())}function Gn(e){return E4.has(e.toUpperCase())}function bb(e){return new URLSearchParams(e).getAll("index").some(t=>t==="")}function df(e,t){let n=typeof t=="string"?ca(t).search:t.search;if(e[e.length-1].route.index&&bb(n||""))return e[e.length-1];let r=xT(e);return r[r.length-1]}function uk(e){let{formMethod:t,formAction:n,formEncType:r,text:i,formData:a,json:o}=e;if(!(!t||!n||!r)){if(i!=null)return{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:void 0,text:i};if(a!=null)return{formMethod:t,formAction:n,formEncType:r,formData:a,json:void 0,text:void 0};if(o!==void 0)return{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:o,text:void 0}}}function Om(e,t){return t?{state:"loading",location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}:{state:"loading",location:e,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function J4(e,t){return{state:"submitting",location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}}function ec(e,t){return e?{state:"loading",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t}:{state:"loading",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:t}}function ez(e,t){return{state:"submitting",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t?t.data:void 0}}function ma(e){return{state:"idle",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e}}function tz(e,t){try{let n=e.sessionStorage.getItem(ET);if(n){let r=JSON.parse(n);for(let[i,a]of Object.entries(r||{}))a&&Array.isArray(a)&&t.set(i,new Set(a||[]))}}catch{}}function nz(e,t){if(t.size>0){let n={};for(let[r,i]of t)n[r]=[...i];try{e.sessionStorage.setItem(ET,JSON.stringify(n))}catch(r){un(!1,`Failed to save applied view transitions in sessionStorage (${r}).`)}}}function dk(){let e,t,n=new Promise((r,i)=>{e=async a=>{r(a);try{await n}catch{}},t=async a=>{i(a);try{await n}catch{}}});return{promise:n,resolve:e,reject:t}}var ks=m.createContext(null);ks.displayName="DataRouter";var Ou=m.createContext(null);Ou.displayName="DataRouterState";var IT=m.createContext(!1);function DT(){return m.useContext(IT)}var wb=m.createContext({isTransitioning:!1});wb.displayName="ViewTransition";var LT=m.createContext(new Map);LT.displayName="Fetchers";var rz=m.createContext(null);rz.displayName="Await";var ci=m.createContext(null);ci.displayName="Navigation";var hh=m.createContext(null);hh.displayName="Location";var ua=m.createContext({outlet:null,matches:[],isDataRoute:!1});ua.displayName="Route";var kb=m.createContext(null);kb.displayName="RouteError";var $T="REACT_ROUTER_ERROR",iz="REDIRECT",az="ROUTE_ERROR_RESPONSE";function oz(e){if(e.startsWith(`${$T}:${iz}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.location=="string"&&typeof t.reloadDocument=="boolean"&&typeof t.replace=="boolean")return t}catch{}}function sz(e){if(e.startsWith(`${$T}:${az}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new Nu(t.status,t.statusText,t.data)}catch{}}function lz(e,{relative:t}={}){at(Au(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:r}=m.useContext(ci),{hash:i,pathname:a,search:o}=Ru(e,{relative:t}),s=a;return n!=="/"&&(s=a==="/"?n:ii([n,a])),r.createHref({pathname:s,search:o,hash:i})}function Au(){return m.useContext(hh)!=null}function da(){return at(Au(),"useLocation() may be used only in the context of a <Router> component."),m.useContext(hh).location}var zT="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function FT(e){m.useContext(ci).static||m.useLayoutEffect(e)}function mh(){let{isDataRoute:e}=m.useContext(ua);return e?_z():cz()}function cz(){at(Au(),"useNavigate() may be used only in the context of a <Router> component.");let e=m.useContext(ks),{basename:t,navigator:n}=m.useContext(ci),{matches:r}=m.useContext(ua),{pathname:i}=da(),a=JSON.stringify(gb(r)),o=m.useRef(!1);return FT(()=>{o.current=!0}),m.useCallback((l,c={})=>{if(un(o.current,zT),!o.current)return;if(typeof l=="number"){n.go(l);return}let d=ph(l,JSON.parse(a),i,c.relative==="path");e==null&&t!=="/"&&(d.pathname=d.pathname==="/"?t:ii([t,d.pathname])),(c.replace?n.replace:n.push)(d,c.state,c)},[t,n,a,i,e])}var uz=m.createContext(null);function dz(e){let t=m.useContext(ua).outlet;return m.useMemo(()=>t&&m.createElement(uz.Provider,{value:e},t),[t,e])}function Ru(e,{relative:t}={}){let{matches:n}=m.useContext(ua),{pathname:r}=da(),i=JSON.stringify(gb(n));return m.useMemo(()=>ph(e,JSON.parse(i),r,t==="path"),[e,i,r,t])}function fz(e,t,n){at(Au(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:r}=m.useContext(ci),{matches:i}=m.useContext(ua),a=i[i.length-1],o=a?a.params:{},s=a?a.pathname:"/",l=a?a.pathnameBase:"/",c=a&&a.route;{let x=c&&c.path||"";WT(s,!c||x.endsWith("*")||x.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${s}" (under <Route path="${x}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
3
3
 
4
4
  Please change the parent <Route path="${x}"> to <Route path="${x==="/"?"*":`${x}/*`}">.`)}let d=da(),u;u=d;let p=u.pathname||"/",h=p;if(l!=="/"){let x=l.replace(/^\//,"").split("/");h="/"+p.replace(/^\//,"").split("/").slice(x.length).join("/")}let y=n&&n.state.matches.length?n.state.matches.map(x=>Object.assign(x,{route:n.manifest[x.route.id]||x.route})):mT(e,{pathname:h});return un(c||y!=null,`No routes matched location "${u.pathname}${u.search}${u.hash}" `),un(y==null||y[y.length-1].route.element!==void 0||y[y.length-1].route.Component!==void 0||y[y.length-1].route.lazy!==void 0,`Matched leaf route at location "${u.pathname}${u.search}${u.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`),yz(y&&y.map(x=>Object.assign({},x,{params:Object.assign({},o,x.params),pathname:ii([l,r.encodeLocation?r.encodeLocation(x.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:x.pathname]),pathnameBase:x.pathnameBase==="/"?l:ii([l,r.encodeLocation?r.encodeLocation(x.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:x.pathnameBase])})),i,n)}function pz(){let e=kz(),t=Jc(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r="rgba(200,200,200, 0.5)",i={padding:"0.5rem",backgroundColor:r},a={padding:"2px 4px",backgroundColor:r},o=null;return console.error("Error handled by React Router default ErrorBoundary:",e),o=m.createElement(m.Fragment,null,m.createElement("p",null,"💿 Hey developer 👋"),m.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",m.createElement("code",{style:a},"ErrorBoundary")," or"," ",m.createElement("code",{style:a},"errorElement")," prop on your route.")),m.createElement(m.Fragment,null,m.createElement("h2",null,"Unexpected Application Error!"),m.createElement("h3",{style:{fontStyle:"italic"}},t),n?m.createElement("pre",{style:i},n):null,o)}var hz=m.createElement(pz,null),BT=class extends m.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const n=sz(e.digest);n&&(e=n)}let t=e!==void 0?m.createElement(ua.Provider,{value:this.props.routeContext},m.createElement(kb.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?m.createElement(mz,{error:e},t):t}};BT.contextType=IT;var Am=new WeakMap;function mz({children:e,error:t}){let{basename:n}=m.useContext(ci);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let r=oz(t.digest);if(r){let i=Am.get(t);if(i)throw i;let a=wT(r.location,n);if(bT&&!Am.get(t))if(a.isExternal||r.reloadDocument)window.location.href=a.absoluteURL||a.to;else{const o=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(a.to,{replace:r.replace}));throw Am.set(t,o),o}return m.createElement("meta",{httpEquiv:"refresh",content:`0;url=${a.absoluteURL||a.to}`})}}return e}function gz({routeContext:e,match:t,children:n}){let r=m.useContext(ks);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),m.createElement(ua.Provider,{value:e},n)}function yz(e,t=[],n){let r=n?.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let i=e,a=r?.errors;if(a!=null){let d=i.findIndex(u=>u.route.id&&a?.[u.route.id]!==void 0);at(d>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(a).join(",")}`),i=i.slice(0,Math.min(i.length,d+1))}let o=!1,s=-1;if(n&&r){o=r.renderFallback;for(let d=0;d<i.length;d++){let u=i[d];if((u.route.HydrateFallback||u.route.hydrateFallbackElement)&&(s=d),u.route.id){let{loaderData:p,errors:h}=r,y=u.route.loader&&!p.hasOwnProperty(u.route.id)&&(!h||h[u.route.id]===void 0);if(u.route.lazy||y){n.isStatic&&(o=!0),s>=0?i=i.slice(0,s+1):i=[i[0]];break}}}}let l=n?.onError,c=r&&l?(d,u)=>{l(d,{location:r.location,params:r.matches?.[0]?.params??{},pattern:Tu(r.matches),errorInfo:u})}:void 0;return i.reduceRight((d,u,p)=>{let h,y=!1,g=null,x=null;r&&(h=a&&u.route.id?a[u.route.id]:void 0,g=u.route.errorElement||hz,o&&(s<0&&p===0?(WT("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),y=!0,x=null):s===p&&(y=!0,x=u.route.hydrateFallbackElement||null)));let v=t.concat(i.slice(0,p+1)),b=()=>{let w;return h?w=g:y?w=x:u.route.Component?w=m.createElement(u.route.Component,null):u.route.element?w=u.route.element:w=d,m.createElement(gz,{match:u,routeContext:{outlet:d,matches:v,isDataRoute:r!=null},children:w})};return r&&(u.route.ErrorBoundary||u.route.errorElement||p===0)?m.createElement(BT,{location:r.location,revalidation:r.revalidation,component:g,error:h,children:b(),routeContext:{outlet:null,matches:v,isDataRoute:!0},onError:c}):b()},null)}function _b(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function vz(e){let t=m.useContext(ks);return at(t,_b(e)),t}function xz(e){let t=m.useContext(Ou);return at(t,_b(e)),t}function bz(e){let t=m.useContext(ua);return at(t,_b(e)),t}function Sb(e){let t=bz(e),n=t.matches[t.matches.length-1];return at(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function wz(){return Sb("useRouteId")}function kz(){let e=m.useContext(kb),t=xz("useRouteError"),n=Sb("useRouteError");return e!==void 0?e:t.errors?.[n]}function _z(){let{router:e}=vz("useNavigate"),t=Sb("useNavigate"),n=m.useRef(!1);return FT(()=>{n.current=!0}),m.useCallback(async(i,a={})=>{un(n.current,zT),n.current&&(typeof i=="number"?await e.navigate(i):await e.navigate(i,{fromRouteId:t,...a}))},[e,t])}var fk={};function WT(e,t,n){!t&&!fk[e]&&(fk[e]=!0,un(!1,n))}var pk={};function hk(e,t){!e&&!pk[t]&&(pk[t]=!0,console.warn(t))}var Sz="useOptimistic",mk=dh[Sz],Ez=()=>{};function Cz(e){return mk?mk(e):[e,Ez]}function jz(e){let t={hasErrorBoundary:e.hasErrorBoundary||e.ErrorBoundary!=null||e.errorElement!=null};return e.Component&&(e.element&&un(!1,"You should not include both `Component` and `element` on your route - `Component` will be used."),Object.assign(t,{element:m.createElement(e.Component),Component:void 0})),e.HydrateFallback&&(e.hydrateFallbackElement&&un(!1,"You should not include both `HydrateFallback` and `hydrateFallbackElement` on your route - `HydrateFallback` will be used."),Object.assign(t,{hydrateFallbackElement:m.createElement(e.HydrateFallback),HydrateFallback:void 0})),e.ErrorBoundary&&(e.errorElement&&un(!1,"You should not include both `ErrorBoundary` and `errorElement` on your route - `ErrorBoundary` will be used."),Object.assign(t,{errorElement:m.createElement(e.ErrorBoundary),ErrorBoundary:void 0})),t}var Pz=["HydrateFallback","hydrateFallbackElement"],Nz=class{constructor(){this.status="pending",this.promise=new Promise((e,t)=>{this.resolve=n=>{this.status==="pending"&&(this.status="resolved",e(n))},this.reject=n=>{this.status==="pending"&&(this.status="rejected",t(n))}})}};function Tz({router:e,flushSync:t,onError:n,useTransitions:r}){r=DT()||r;let[a,o]=m.useState(e.state),[s,l]=Cz(a),[c,d]=m.useState(),[u,p]=m.useState({isTransitioning:!1}),[h,y]=m.useState(),[g,x]=m.useState(),[v,b]=m.useState(),w=m.useRef(new Map),_=m.useCallback((j,{deletedFetchers:T,newErrors:A,flushSync:R,viewTransitionOpts:D})=>{A&&n&&Object.values(A).forEach(O=>n(O,{location:j.location,params:j.matches[0]?.params??{},pattern:Tu(j.matches)})),j.fetchers.forEach((O,I)=>{O.data!==void 0&&w.current.set(I,O.data)}),T.forEach(O=>w.current.delete(O)),hk(R===!1||t!=null,'You provided the `flushSync` option to a router update, but you are not using the `<RouterProvider>` from `react-router/dom` so `ReactDOM.flushSync()` is unavailable. Please update your app to `import { RouterProvider } from "react-router/dom"` and ensure you have `react-dom` installed as a dependency to use the `flushSync` option.');let M=e.window!=null&&e.window.document!=null&&typeof e.window.document.startViewTransition=="function";if(hk(D==null||M,"You provided the `viewTransition` option to a router update, but you do not appear to be running in a DOM environment as `window.startViewTransition` is not available."),!D||!M){t&&R?t(()=>o(j)):r===!1?o(j):m.startTransition(()=>{r===!0&&l(O=>gk(O,j)),o(j)});return}if(t&&R){t(()=>{g&&(h?.resolve(),g.skipTransition()),p({isTransitioning:!0,flushSync:!0,currentLocation:D.currentLocation,nextLocation:D.nextLocation})});let O=e.window.document.startViewTransition(()=>{t(()=>o(j))});O.finished.finally(()=>{t(()=>{y(void 0),x(void 0),d(void 0),p({isTransitioning:!1})})}),t(()=>x(O));return}g?(h?.resolve(),g.skipTransition(),b({state:j,currentLocation:D.currentLocation,nextLocation:D.nextLocation})):(d(j),p({isTransitioning:!0,flushSync:!1,currentLocation:D.currentLocation,nextLocation:D.nextLocation}))},[e.window,t,g,h,r,l,n]);m.useLayoutEffect(()=>e.subscribe(_),[e,_]);let k=s.initialized;m.useLayoutEffect(()=>{!k&&e.state.initialized&&_(e.state,{deletedFetchers:[],flushSync:!1,newErrors:null})},[k,_,e.state]),m.useEffect(()=>{u.isTransitioning&&!u.flushSync&&y(new Nz)},[u]),m.useEffect(()=>{if(h&&c&&e.window){let j=c,T=h.promise,A=e.window.document.startViewTransition(async()=>{r===!1?o(j):m.startTransition(()=>{r===!0&&l(R=>gk(R,j)),o(j)}),await T});A.finished.finally(()=>{y(void 0),x(void 0),d(void 0),p({isTransitioning:!1})}),x(A)}},[c,h,e.window,r,l]),m.useEffect(()=>{h&&c&&s.location.key===c.location.key&&h.resolve()},[h,g,s.location,c]),m.useEffect(()=>{!u.isTransitioning&&v&&(d(v.state),p({isTransitioning:!0,flushSync:!1,currentLocation:v.currentLocation,nextLocation:v.nextLocation}),b(void 0))},[u.isTransitioning,v]);let S=m.useMemo(()=>({createHref:e.createHref,encodeLocation:e.encodeLocation,go:j=>e.navigate(j),push:(j,T,A)=>e.navigate(j,{state:T,preventScrollReset:A?.preventScrollReset}),replace:(j,T,A)=>e.navigate(j,{replace:!0,state:T,preventScrollReset:A?.preventScrollReset})}),[e]),E=e.basename||"/",C=m.useMemo(()=>({router:e,navigator:S,static:!1,basename:E,onError:n}),[e,S,E,n]);return m.createElement(m.Fragment,null,m.createElement(ks.Provider,{value:C},m.createElement(Ou.Provider,{value:s},m.createElement(LT.Provider,{value:w.current},m.createElement(wb.Provider,{value:u},m.createElement(Mz,{basename:E,location:s.location,navigationType:s.historyAction,navigator:S,useTransitions:r},m.createElement(Oz,{routes:e.routes,manifest:e.manifest,future:e.future,state:s,isStatic:!1,onError:n})))))),null)}function gk(e,t){return{...e,navigation:t.navigation.state!=="idle"?t.navigation:e.navigation,revalidation:t.revalidation!=="idle"?t.revalidation:e.revalidation,actionData:t.navigation.state!=="submitting"?t.actionData:e.actionData,fetchers:t.fetchers}}var Oz=m.memo(Az);function Az({routes:e,manifest:t,future:n,state:r,isStatic:i,onError:a}){return fz(e,void 0,{manifest:t,state:r,isStatic:i,onError:a})}function Rz(e){return dz(e.context)}function Mz({basename:e="/",children:t=null,location:n,navigationType:r="POP",navigator:i,static:a=!1,useTransitions:o}){at(!Au(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let s=e.replace(/^\/*/,"/"),l=m.useMemo(()=>({basename:s,navigator:i,static:a,useTransitions:o,future:{}}),[s,i,a,o]);typeof n=="string"&&(n=ca(n));let{pathname:c="/",search:d="",hash:u="",state:p=null,key:h="default",mask:y}=n,g=m.useMemo(()=>{let x=ai(c,s);return x==null?null:{location:{pathname:x,search:d,hash:u,state:p,key:h,mask:y},navigationType:r}},[s,c,d,u,p,h,r,y]);return un(g!=null,`<Router basename="${s}"> is not able to match the URL "${c}${d}${u}" because it does not start with the basename, so the <Router> won't render anything.`),g==null?null:m.createElement(ci.Provider,{value:l},m.createElement(hh.Provider,{children:t,value:g}))}var ff="get",pf="application/x-www-form-urlencoded";function gh(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function Iz(e){return gh(e)&&e.tagName.toLowerCase()==="button"}function Dz(e){return gh(e)&&e.tagName.toLowerCase()==="form"}function Lz(e){return gh(e)&&e.tagName.toLowerCase()==="input"}function $z(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function zz(e,t){return e.button===0&&(!t||t==="_self")&&!$z(e)}var hd=null;function Fz(){if(hd===null)try{new FormData(document.createElement("form"),0),hd=!1}catch{hd=!0}return hd}var Bz=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Rm(e){return e!=null&&!Bz.has(e)?(un(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${pf}"`),null):e}function Wz(e,t){let n,r,i,a,o;if(Dz(e)){let s=e.getAttribute("action");r=s?ai(s,t):null,n=e.getAttribute("method")||ff,i=Rm(e.getAttribute("enctype"))||pf,a=new FormData(e)}else if(Iz(e)||Lz(e)&&(e.type==="submit"||e.type==="image")){let s=e.form;if(s==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let l=e.getAttribute("formaction")||s.getAttribute("action");if(r=l?ai(l,t):null,n=e.getAttribute("formmethod")||s.getAttribute("method")||ff,i=Rm(e.getAttribute("formenctype"))||Rm(s.getAttribute("enctype"))||pf,a=new FormData(s,e),!Fz()){let{name:c,type:d,value:u}=e;if(d==="image"){let p=c?`${c}.`:"";a.append(`${p}x`,"0"),a.append(`${p}y`,"0")}else c&&a.append(c,u)}}else{if(gh(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=ff,r=null,i=pf,o=e}return a&&i==="text/plain"&&(o=a,a=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:a,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Eb(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function HT(e,t,n,r){let i=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return n?i.pathname.endsWith("/")?i.pathname=`${i.pathname}_.${r}`:i.pathname=`${i.pathname}.${r}`:i.pathname==="/"?i.pathname=`_root.${r}`:t&&ai(i.pathname,t)==="/"?i.pathname=`${zf(t)}/_root.${r}`:i.pathname=`${zf(i.pathname)}.${r}`,i}async function Hz(e,t){if(e.id in t)return t[e.id];try{let n=await import(e.module);return t[e.id]=n,n}catch(n){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(n),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function Uz(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function Vz(e,t,n){let r=await Promise.all(e.map(async i=>{let a=t.routes[i.route.id];if(a){let o=await Hz(a,n);return o.links?o.links():[]}return[]}));return Yz(r.flat(1).filter(Uz).filter(i=>i.rel==="stylesheet"||i.rel==="preload").map(i=>i.rel==="stylesheet"?{...i,rel:"prefetch",as:"style"}:{...i,rel:"prefetch"}))}function yk(e,t,n,r,i,a){let o=(l,c)=>n[c]?l.route.id!==n[c].route.id:!0,s=(l,c)=>n[c].pathname!==l.pathname||n[c].route.path?.endsWith("*")&&n[c].params["*"]!==l.params["*"];return a==="assets"?t.filter((l,c)=>o(l,c)||s(l,c)):a==="data"?t.filter((l,c)=>{let d=r.routes[l.route.id];if(!d||!d.hasLoader)return!1;if(o(l,c)||s(l,c))return!0;if(l.route.shouldRevalidate){let u=l.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:l.params,defaultShouldRevalidate:!0});if(typeof u=="boolean")return u}return!0}):[]}function qz(e,t,{includeHydrateFallback:n}={}){return Kz(e.map(r=>{let i=t.routes[r.route.id];if(!i)return[];let a=[i.module];return i.clientActionModule&&(a=a.concat(i.clientActionModule)),i.clientLoaderModule&&(a=a.concat(i.clientLoaderModule)),n&&i.hydrateFallbackModule&&(a=a.concat(i.hydrateFallbackModule)),i.imports&&(a=a.concat(i.imports)),a}).flat(1))}function Kz(e){return[...new Set(e)]}function Gz(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function Yz(e,t){let n=new Set;return new Set(t),e.reduce((r,i)=>{let a=JSON.stringify(Gz(i));return n.has(a)||(n.add(a),r.push({key:a,link:i})),r},[])}function Cb(){let e=m.useContext(ks);return Eb(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function Xz(){let e=m.useContext(Ou);return Eb(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var jb=m.createContext(void 0);jb.displayName="FrameworkContext";function Pb(){let e=m.useContext(jb);return Eb(e,"You must render this element inside a <HydratedRouter> element"),e}function Zz(e,t){let n=m.useContext(jb),[r,i]=m.useState(!1),[a,o]=m.useState(!1),{onFocus:s,onBlur:l,onMouseEnter:c,onMouseLeave:d,onTouchStart:u}=t,p=m.useRef(null);m.useEffect(()=>{if(e==="render"&&o(!0),e==="viewport"){let g=v=>{v.forEach(b=>{o(b.isIntersecting)})},x=new IntersectionObserver(g,{threshold:.5});return p.current&&x.observe(p.current),()=>{x.disconnect()}}},[e]),m.useEffect(()=>{if(r){let g=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(g)}}},[r]);let h=()=>{i(!0)},y=()=>{i(!1),o(!1)};return n?e!=="intent"?[a,p,{}]:[a,p,{onFocus:tc(s,h),onBlur:tc(l,y),onMouseEnter:tc(c,h),onMouseLeave:tc(d,y),onTouchStart:tc(u,h)}]:[!1,p,{}]}function tc(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function Qz({page:e,...t}){let n=DT(),{router:r}=Cb(),i=m.useMemo(()=>mT(r.routes,e,r.basename),[r.routes,e,r.basename]);return i?n?m.createElement(e3,{page:e,matches:i,...t}):m.createElement(t3,{page:e,matches:i,...t}):null}function Jz(e){let{manifest:t,routeModules:n}=Pb(),[r,i]=m.useState([]);return m.useEffect(()=>{let a=!1;return Vz(e,t,n).then(o=>{a||i(o)}),()=>{a=!0}},[e,t,n]),r}function e3({page:e,matches:t,...n}){let r=da(),{future:i}=Pb(),{basename:a}=Cb(),o=m.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let s=HT(e,a,i.unstable_trailingSlashAwareDataRequests,"rsc"),l=!1,c=[];for(let d of t)typeof d.route.shouldRevalidate=="function"?l=!0:c.push(d.route.id);return l&&c.length>0&&s.searchParams.set("_routes",c.join(",")),[s.pathname+s.search]},[a,i.unstable_trailingSlashAwareDataRequests,e,r,t]);return m.createElement(m.Fragment,null,o.map(s=>m.createElement("link",{key:s,rel:"prefetch",as:"fetch",href:s,...n})))}function t3({page:e,matches:t,...n}){let r=da(),{future:i,manifest:a,routeModules:o}=Pb(),{basename:s}=Cb(),{loaderData:l,matches:c}=Xz(),d=m.useMemo(()=>yk(e,t,c,a,r,"data"),[e,t,c,a,r]),u=m.useMemo(()=>yk(e,t,c,a,r,"assets"),[e,t,c,a,r]),p=m.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let g=new Set,x=!1;if(t.forEach(b=>{let w=a.routes[b.route.id];!w||!w.hasLoader||(!d.some(_=>_.route.id===b.route.id)&&b.route.id in l&&o[b.route.id]?.shouldRevalidate||w.hasClientLoader?x=!0:g.add(b.route.id))}),g.size===0)return[];let v=HT(e,s,i.unstable_trailingSlashAwareDataRequests,"data");return x&&g.size>0&&v.searchParams.set("_routes",t.filter(b=>g.has(b.route.id)).map(b=>b.route.id).join(",")),[v.pathname+v.search]},[s,i.unstable_trailingSlashAwareDataRequests,l,r,a,d,t,e,o]),h=m.useMemo(()=>qz(u,a),[u,a]),y=Jz(u);return m.createElement(m.Fragment,null,p.map(g=>m.createElement("link",{key:g,rel:"prefetch",as:"fetch",href:g,...n})),h.map(g=>m.createElement("link",{key:g,rel:"modulepreload",href:g,...n})),y.map(({key:g,link:x})=>m.createElement("link",{key:g,nonce:n.nonce,...x,crossOrigin:x.crossOrigin??n.crossOrigin})))}function n3(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var r3=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{r3&&(window.__reactRouterVersion="7.15.0")}catch{}function i3(e,t){return A4({basename:t?.basename,getContext:t?.getContext,future:t?.future,history:K$({window:t?.window}),hydrationData:a3(),routes:e,mapRouteProperties:jz,hydrationRouteProperties:Pz,dataStrategy:t?.dataStrategy,patchRoutesOnNavigation:t?.patchRoutesOnNavigation,window:t?.window,instrumentations:t?.instrumentations}).initialize()}function a3(){let e=window?.__staticRouterHydrationData;return e&&e.errors&&(e={...e,errors:o3(e.errors)}),e}function o3(e){if(!e)return null;let t=Object.entries(e),n={};for(let[r,i]of t)if(i&&i.__type==="RouteErrorResponse")n[r]=new Nu(i.status,i.statusText,i.data,i.internal===!0);else if(i&&i.__type==="Error"){if(i.__subType){let a=window[i.__subType];if(typeof a=="function")try{let o=new a(i.message);o.stack="",n[r]=o}catch{}}if(n[r]==null){let a=new Error(i.message);a.stack="",n[r]=a}}else n[r]=i;return n}var UT=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,VT=m.forwardRef(function({onClick:t,discover:n="render",prefetch:r="none",relative:i,reloadDocument:a,replace:o,mask:s,state:l,target:c,to:d,preventScrollReset:u,viewTransition:p,defaultShouldRevalidate:h,...y},g){let{basename:x,navigator:v,useTransitions:b}=m.useContext(ci),w=typeof d=="string"&&UT.test(d),_=wT(d,x);d=_.to;let k=lz(d,{relative:i}),S=da(),E=null;if(s){let O=ph(s,[],S.mask?S.mask.pathname:"/",!0);x!=="/"&&(O.pathname=O.pathname==="/"?x:ii([x,O.pathname])),E=v.createHref(O)}let[C,j,T]=Zz(r,y),A=c3(d,{replace:o,mask:s,state:l,target:c,preventScrollReset:u,relative:i,viewTransition:p,defaultShouldRevalidate:h,useTransitions:b});function R(O){t&&t(O),O.defaultPrevented||A(O)}let D=!(_.isExternal||a),M=m.createElement("a",{...y,...T,href:(D?E:void 0)||_.absoluteURL||k,onClick:D?R:t,ref:n3(g,j),target:c,"data-discover":!w&&n==="render"?"true":void 0});return C&&!w?m.createElement(m.Fragment,null,M,m.createElement(Qz,{page:k})):M});VT.displayName="Link";var qT=m.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:r="",end:i=!1,style:a,to:o,viewTransition:s,children:l,...c},d){let u=Ru(o,{relative:c.relative}),p=da(),h=m.useContext(Ou),{navigator:y,basename:g}=m.useContext(ci),x=h!=null&&h3(u)&&s===!0,v=y.encodeLocation?y.encodeLocation(u).pathname:u.pathname,b=p.pathname,w=h&&h.navigation&&h.navigation.location?h.navigation.location.pathname:null;n||(b=b.toLowerCase(),w=w?w.toLowerCase():null,v=v.toLowerCase()),w&&g&&(w=ai(w,g)||w);const _=v!=="/"&&v.endsWith("/")?v.length-1:v.length;let k=b===v||!i&&b.startsWith(v)&&b.charAt(_)==="/",S=w!=null&&(w===v||!i&&w.startsWith(v)&&w.charAt(v.length)==="/"),E={isActive:k,isPending:S,isTransitioning:x},C=k?t:void 0,j;typeof r=="function"?j=r(E):j=[r,k?"active":null,S?"pending":null,x?"transitioning":null].filter(Boolean).join(" ");let T=typeof a=="function"?a(E):a;return m.createElement(VT,{...c,"aria-current":C,className:j,ref:d,style:T,to:o,viewTransition:s},typeof l=="function"?l(E):l)});qT.displayName="NavLink";var s3=m.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:r,replace:i,state:a,method:o=ff,action:s,onSubmit:l,relative:c,preventScrollReset:d,viewTransition:u,defaultShouldRevalidate:p,...h},y)=>{let{useTransitions:g}=m.useContext(ci),x=f3(),v=p3(s,{relative:c}),b=o.toLowerCase()==="get"?"get":"post",w=typeof s=="string"&&UT.test(s),_=k=>{if(l&&l(k),k.defaultPrevented)return;k.preventDefault();let S=k.nativeEvent.submitter,E=S?.getAttribute("formmethod")||o,C=()=>x(S||k.currentTarget,{fetcherKey:t,method:E,navigate:n,replace:i,state:a,relative:c,preventScrollReset:d,viewTransition:u,defaultShouldRevalidate:p});g&&n!==!1?m.startTransition(()=>C()):C()};return m.createElement("form",{ref:y,method:b,action:v,onSubmit:r?l:_,...h,"data-discover":!w&&e==="render"?"true":void 0})});s3.displayName="Form";function l3(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function KT(e){let t=m.useContext(ks);return at(t,l3(e)),t}function c3(e,{target:t,replace:n,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:l,useTransitions:c}={}){let d=mh(),u=da(),p=Ru(e,{relative:o});return m.useCallback(h=>{if(zz(h,t)){h.preventDefault();let y=n!==void 0?n:Ji(u)===Ji(p),g=()=>d(e,{replace:y,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:l});c?m.startTransition(()=>g()):g()}},[u,d,p,n,r,i,t,e,a,o,s,l,c])}var u3=0,d3=()=>`__${String(++u3)}__`;function f3(){let{router:e}=KT("useSubmit"),{basename:t}=m.useContext(ci),n=wz(),r=e.fetch,i=e.navigate;return m.useCallback(async(a,o={})=>{let{action:s,method:l,encType:c,formData:d,body:u}=Wz(a,t);if(o.navigate===!1){let p=o.fetcherKey||d3();await r(p,n,o.action||s,{defaultShouldRevalidate:o.defaultShouldRevalidate,preventScrollReset:o.preventScrollReset,formData:d,body:u,formMethod:o.method||l,formEncType:o.encType||c,flushSync:o.flushSync})}else await i(o.action||s,{defaultShouldRevalidate:o.defaultShouldRevalidate,preventScrollReset:o.preventScrollReset,formData:d,body:u,formMethod:o.method||l,formEncType:o.encType||c,replace:o.replace,state:o.state,fromRouteId:n,flushSync:o.flushSync,viewTransition:o.viewTransition})},[r,i,t,n])}function p3(e,{relative:t}={}){let{basename:n}=m.useContext(ci),r=m.useContext(ua);at(r,"useFormAction must be used inside a RouteContext");let[i]=r.matches.slice(-1),a={...Ru(e||".",{relative:t})},o=da();if(e==null){a.search=o.search;let s=new URLSearchParams(a.search),l=s.getAll("index");if(l.some(d=>d==="")){s.delete("index"),l.filter(u=>u).forEach(u=>s.append("index",u));let d=s.toString();a.search=d?`?${d}`:""}}return(!e||e===".")&&i.route.index&&(a.search=a.search?a.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(a.pathname=a.pathname==="/"?n:ii([n,a.pathname])),Ji(a)}function h3(e,{relative:t}={}){let n=m.useContext(wb);at(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=KT("useViewTransitionState"),i=Ru(e,{relative:t});if(!n.isTransitioning)return!1;let a=ai(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=ai(n.nextLocation.pathname,r)||n.nextLocation.pathname;return $f(i.pathname,o)!=null||$f(i.pathname,a)!=null}var oi=R$();const m3=Ci(oi);function g3(e){return m.createElement(Tz,{flushSync:oi.flushSync,...e})}function Mn(e,t,n,r){if(typeof t=="function"?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?r:n==="a"?r.call(e):r?r.value:t.get(e)}function Qs(e,t,n,r,i){if(typeof t=="function"?e!==t||!0:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,n),n}var Do,Vr,Ds,md,hf;const Cr="__TAURI_TO_IPC_KEY__";function GT(e,t=!1){return window.__TAURI_INTERNALS__.transformCallback(e,t)}class vk{constructor(t){Do.set(this,void 0),Vr.set(this,0),Ds.set(this,[]),md.set(this,void 0),Qs(this,Do,t||(()=>{})),this.id=GT(n=>{const r=n.index;if("end"in n){r==Mn(this,Vr,"f")?this.cleanupCallback():Qs(this,md,r);return}const i=n.message;if(r==Mn(this,Vr,"f")){for(Mn(this,Do,"f").call(this,i),Qs(this,Vr,Mn(this,Vr,"f")+1);Mn(this,Vr,"f")in Mn(this,Ds,"f");){const a=Mn(this,Ds,"f")[Mn(this,Vr,"f")];Mn(this,Do,"f").call(this,a),delete Mn(this,Ds,"f")[Mn(this,Vr,"f")],Qs(this,Vr,Mn(this,Vr,"f")+1)}Mn(this,Vr,"f")===Mn(this,md,"f")&&this.cleanupCallback()}else Mn(this,Ds,"f")[r]=i})}cleanupCallback(){window.__TAURI_INTERNALS__.unregisterCallback(this.id)}set onmessage(t){Qs(this,Do,t)}get onmessage(){return Mn(this,Do,"f")}[(Do=new WeakMap,Vr=new WeakMap,Ds=new WeakMap,md=new WeakMap,Cr)](){return`__CHANNEL__:${this.id}`}toJSON(){return this[Cr]()}}async function B(e,t={},n){return window.__TAURI_INTERNALS__.invoke(e,t,n)}class Ff{get rid(){return Mn(this,hf,"f")}constructor(t){hf.set(this,void 0),Qs(this,hf,t)}async close(){return B("plugin:resources|close",{rid:this.rid})}}hf=new WeakMap;var Ln;(function(e){e.WINDOW_RESIZED="tauri://resize",e.WINDOW_MOVED="tauri://move",e.WINDOW_CLOSE_REQUESTED="tauri://close-requested",e.WINDOW_DESTROYED="tauri://destroyed",e.WINDOW_FOCUS="tauri://focus",e.WINDOW_BLUR="tauri://blur",e.WINDOW_SCALE_FACTOR_CHANGED="tauri://scale-change",e.WINDOW_THEME_CHANGED="tauri://theme-changed",e.WINDOW_CREATED="tauri://window-created",e.WINDOW_SUSPENDED="tauri://suspended",e.WINDOW_RESUMED="tauri://resumed",e.WEBVIEW_CREATED="tauri://webview-created",e.DRAG_ENTER="tauri://drag-enter",e.DRAG_OVER="tauri://drag-over",e.DRAG_DROP="tauri://drag-drop",e.DRAG_LEAVE="tauri://drag-leave"})(Ln||(Ln={}));async function YT(e,t){window.__TAURI_EVENT_PLUGIN_INTERNALS__.unregisterListener(e,t),await B("plugin:event|unlisten",{event:e,eventId:t})}async function Ue(e,t,n){var r;const i=typeof n?.target=="string"?{kind:"AnyLabel",label:n.target}:(r=n?.target)!==null&&r!==void 0?r:{kind:"Any"};return B("plugin:event|listen",{event:e,target:i,handler:GT(t)}).then(a=>async()=>YT(e,a))}async function Nb(e,t,n){return Ue(e,r=>{YT(e,r.id),t(r)},n)}async function ja(e,t){await B("plugin:event|emit",{event:e,payload:t})}async function sr(e,t,n){await B("plugin:event|emit_to",{target:typeof e=="string"?{kind:"AnyLabel",label:e}:e,event:t,payload:n})}class XT{constructor(...t){this.type="Logical",t.length===1?"Logical"in t[0]?(this.width=t[0].Logical.width,this.height=t[0].Logical.height):(this.width=t[0].width,this.height=t[0].height):(this.width=t[0],this.height=t[1])}toPhysical(t){return new sl(this.width*t,this.height*t)}[Cr](){return{width:this.width,height:this.height}}toJSON(){return this[Cr]()}}class sl{constructor(...t){this.type="Physical",t.length===1?"Physical"in t[0]?(this.width=t[0].Physical.width,this.height=t[0].Physical.height):(this.width=t[0].width,this.height=t[0].height):(this.width=t[0],this.height=t[1])}toLogical(t){return new XT(this.width/t,this.height/t)}[Cr](){return{width:this.width,height:this.height}}toJSON(){return this[Cr]()}}class Qa{constructor(t){this.size=t}toLogical(t){return this.size instanceof XT?this.size:this.size.toLogical(t)}toPhysical(t){return this.size instanceof sl?this.size:this.size.toPhysical(t)}[Cr](){return{[`${this.size.type}`]:{width:this.size.width,height:this.size.height}}}toJSON(){return this[Cr]()}}class ZT{constructor(...t){this.type="Logical",t.length===1?"Logical"in t[0]?(this.x=t[0].Logical.x,this.y=t[0].Logical.y):(this.x=t[0].x,this.y=t[0].y):(this.x=t[0],this.y=t[1])}toPhysical(t){return new Zr(this.x*t,this.y*t)}[Cr](){return{x:this.x,y:this.y}}toJSON(){return this[Cr]()}}class Zr{constructor(...t){this.type="Physical",t.length===1?"Physical"in t[0]?(this.x=t[0].Physical.x,this.y=t[0].Physical.y):(this.x=t[0].x,this.y=t[0].y):(this.x=t[0],this.y=t[1])}toLogical(t){return new ZT(this.x/t,this.y/t)}[Cr](){return{x:this.x,y:this.y}}toJSON(){return this[Cr]()}}class tl{constructor(t){this.position=t}toLogical(t){return this.position instanceof ZT?this.position:this.position.toLogical(t)}toPhysical(t){return this.position instanceof Zr?this.position:this.position.toPhysical(t)}[Cr](){return{[`${this.position.type}`]:{x:this.position.x,y:this.position.y}}}toJSON(){return this[Cr]()}}class Rc extends Ff{constructor(t){super(t)}static async new(t,n,r){return B("plugin:image|new",{rgba:Bf(t),width:n,height:r}).then(i=>new Rc(i))}static async fromBytes(t){return B("plugin:image|from_bytes",{bytes:Bf(t)}).then(n=>new Rc(n))}static async fromPath(t){return B("plugin:image|from_path",{path:t}).then(n=>new Rc(n))}async rgba(){return B("plugin:image|rgba",{rid:this.rid}).then(t=>new Uint8Array(t))}async size(){return B("plugin:image|size",{rid:this.rid})}}function Bf(e){return e==null?null:typeof e=="string"?e:e instanceof Rc?e.rid:e}var Ev;(function(e){e[e.Critical=1]="Critical",e[e.Informational=2]="Informational"})(Ev||(Ev={}));class y3{constructor(t){this._preventDefault=!1,this.event=t.event,this.id=t.id}preventDefault(){this._preventDefault=!0}isPreventDefault(){return this._preventDefault}}var xk;(function(e){e.None="none",e.Normal="normal",e.Indeterminate="indeterminate",e.Paused="paused",e.Error="error"})(xk||(xk={}));function Tb(){return new yh(window.__TAURI_INTERNALS__.metadata.currentWindow.label,{skip:!0})}async function Mm(){return B("plugin:window|get_all_windows").then(e=>e.map(t=>new yh(t,{skip:!0})))}const Im=["tauri://created","tauri://error"];class yh{constructor(t,n={}){var r;this.label=t,this.listeners=Object.create(null),n?.skip||B("plugin:window|create",{options:{...n,parent:typeof n.parent=="string"?n.parent:(r=n.parent)===null||r===void 0?void 0:r.label,label:t}}).then(async()=>this.emit("tauri://created")).catch(async i=>this.emit("tauri://error",i))}static async getByLabel(t){var n;return(n=(await Mm()).find(r=>r.label===t))!==null&&n!==void 0?n:null}static getCurrent(){return Tb()}static async getAll(){return Mm()}static async getFocusedWindow(){for(const t of await Mm())if(await t.isFocused())return t;return null}async listen(t,n){return this._handleTauriEvent(t,n)?()=>{const r=this.listeners[t];r.splice(r.indexOf(n),1)}:Ue(t,n,{target:{kind:"Window",label:this.label}})}async once(t,n){return this._handleTauriEvent(t,n)?()=>{const r=this.listeners[t];r.splice(r.indexOf(n),1)}:Nb(t,n,{target:{kind:"Window",label:this.label}})}async emit(t,n){if(Im.includes(t)){for(const r of this.listeners[t]||[])r({event:t,id:-1,payload:n});return}return ja(t,n)}async emitTo(t,n,r){if(Im.includes(n)){for(const i of this.listeners[n]||[])i({event:n,id:-1,payload:r});return}return sr(t,n,r)}_handleTauriEvent(t,n){return Im.includes(t)?(t in this.listeners?this.listeners[t].push(n):this.listeners[t]=[n],!0):!1}async scaleFactor(){return B("plugin:window|scale_factor",{label:this.label})}async innerPosition(){return B("plugin:window|inner_position",{label:this.label}).then(t=>new Zr(t))}async outerPosition(){return B("plugin:window|outer_position",{label:this.label}).then(t=>new Zr(t))}async innerSize(){return B("plugin:window|inner_size",{label:this.label}).then(t=>new sl(t))}async outerSize(){return B("plugin:window|outer_size",{label:this.label}).then(t=>new sl(t))}async isFullscreen(){return B("plugin:window|is_fullscreen",{label:this.label})}async isMinimized(){return B("plugin:window|is_minimized",{label:this.label})}async isMaximized(){return B("plugin:window|is_maximized",{label:this.label})}async isFocused(){return B("plugin:window|is_focused",{label:this.label})}async isDecorated(){return B("plugin:window|is_decorated",{label:this.label})}async isResizable(){return B("plugin:window|is_resizable",{label:this.label})}async isMaximizable(){return B("plugin:window|is_maximizable",{label:this.label})}async isMinimizable(){return B("plugin:window|is_minimizable",{label:this.label})}async isClosable(){return B("plugin:window|is_closable",{label:this.label})}async isVisible(){return B("plugin:window|is_visible",{label:this.label})}async title(){return B("plugin:window|title",{label:this.label})}async theme(){return B("plugin:window|theme",{label:this.label})}async isAlwaysOnTop(){return B("plugin:window|is_always_on_top",{label:this.label})}async activityName(){return B("plugin:window|activity_name",{label:this.label})}async sceneIdentifier(){return B("plugin:window|scene_identifier",{label:this.label})}async center(){return B("plugin:window|center",{label:this.label})}async requestUserAttention(t){let n=null;return t&&(t===Ev.Critical?n={type:"Critical"}:n={type:"Informational"}),B("plugin:window|request_user_attention",{label:this.label,value:n})}async setResizable(t){return B("plugin:window|set_resizable",{label:this.label,value:t})}async setEnabled(t){return B("plugin:window|set_enabled",{label:this.label,value:t})}async isEnabled(){return B("plugin:window|is_enabled",{label:this.label})}async setMaximizable(t){return B("plugin:window|set_maximizable",{label:this.label,value:t})}async setMinimizable(t){return B("plugin:window|set_minimizable",{label:this.label,value:t})}async setClosable(t){return B("plugin:window|set_closable",{label:this.label,value:t})}async setTitle(t){return B("plugin:window|set_title",{label:this.label,value:t})}async maximize(){return B("plugin:window|maximize",{label:this.label})}async unmaximize(){return B("plugin:window|unmaximize",{label:this.label})}async toggleMaximize(){return B("plugin:window|toggle_maximize",{label:this.label})}async minimize(){return B("plugin:window|minimize",{label:this.label})}async unminimize(){return B("plugin:window|unminimize",{label:this.label})}async show(){return B("plugin:window|show",{label:this.label})}async hide(){return B("plugin:window|hide",{label:this.label})}async close(){return B("plugin:window|close",{label:this.label})}async destroy(){return B("plugin:window|destroy",{label:this.label})}async setDecorations(t){return B("plugin:window|set_decorations",{label:this.label,value:t})}async setShadow(t){return B("plugin:window|set_shadow",{label:this.label,value:t})}async setEffects(t){return B("plugin:window|set_effects",{label:this.label,value:t})}async clearEffects(){return B("plugin:window|set_effects",{label:this.label,value:null})}async setAlwaysOnTop(t){return B("plugin:window|set_always_on_top",{label:this.label,value:t})}async setAlwaysOnBottom(t){return B("plugin:window|set_always_on_bottom",{label:this.label,value:t})}async setContentProtected(t){return B("plugin:window|set_content_protected",{label:this.label,value:t})}async setSize(t){return B("plugin:window|set_size",{label:this.label,value:t instanceof Qa?t:new Qa(t)})}async setMinSize(t){return B("plugin:window|set_min_size",{label:this.label,value:t instanceof Qa?t:t?new Qa(t):null})}async setMaxSize(t){return B("plugin:window|set_max_size",{label:this.label,value:t instanceof Qa?t:t?new Qa(t):null})}async setSizeConstraints(t){function n(r){return r?{Logical:r}:null}return B("plugin:window|set_size_constraints",{label:this.label,value:{minWidth:n(t?.minWidth),minHeight:n(t?.minHeight),maxWidth:n(t?.maxWidth),maxHeight:n(t?.maxHeight)}})}async setPosition(t){return B("plugin:window|set_position",{label:this.label,value:t instanceof tl?t:new tl(t)})}async setFullscreen(t){return B("plugin:window|set_fullscreen",{label:this.label,value:t})}async setSimpleFullscreen(t){return B("plugin:window|set_simple_fullscreen",{label:this.label,value:t})}async setFocus(){return B("plugin:window|set_focus",{label:this.label})}async setFocusable(t){return B("plugin:window|set_focusable",{label:this.label,value:t})}async setIcon(t){return B("plugin:window|set_icon",{label:this.label,value:Bf(t)})}async setSkipTaskbar(t){return B("plugin:window|set_skip_taskbar",{label:this.label,value:t})}async setCursorGrab(t){return B("plugin:window|set_cursor_grab",{label:this.label,value:t})}async setCursorVisible(t){return B("plugin:window|set_cursor_visible",{label:this.label,value:t})}async setCursorIcon(t){return B("plugin:window|set_cursor_icon",{label:this.label,value:t})}async setBackgroundColor(t){return B("plugin:window|set_background_color",{color:t})}async setCursorPosition(t){return B("plugin:window|set_cursor_position",{label:this.label,value:t instanceof tl?t:new tl(t)})}async setIgnoreCursorEvents(t){return B("plugin:window|set_ignore_cursor_events",{label:this.label,value:t})}async startDragging(){return B("plugin:window|start_dragging",{label:this.label})}async startResizeDragging(t){return B("plugin:window|start_resize_dragging",{label:this.label,value:t})}async setBadgeCount(t){return B("plugin:window|set_badge_count",{label:this.label,value:t})}async setBadgeLabel(t){return B("plugin:window|set_badge_label",{label:this.label,value:t})}async setOverlayIcon(t){return B("plugin:window|set_overlay_icon",{label:this.label,value:t?Bf(t):void 0})}async setProgressBar(t){return B("plugin:window|set_progress_bar",{label:this.label,value:t})}async setVisibleOnAllWorkspaces(t){return B("plugin:window|set_visible_on_all_workspaces",{label:this.label,value:t})}async setTitleBarStyle(t){return B("plugin:window|set_title_bar_style",{label:this.label,value:t})}async setTheme(t){return B("plugin:window|set_theme",{label:this.label,value:t})}async onResized(t){return this.listen(Ln.WINDOW_RESIZED,n=>{n.payload=new sl(n.payload),t(n)})}async onMoved(t){return this.listen(Ln.WINDOW_MOVED,n=>{n.payload=new Zr(n.payload),t(n)})}async onCloseRequested(t){return this.listen(Ln.WINDOW_CLOSE_REQUESTED,async n=>{const r=new y3(n);await t(r),r.isPreventDefault()||await this.destroy()})}async onDragDropEvent(t){const n=await this.listen(Ln.DRAG_ENTER,o=>{t({...o,payload:{type:"enter",paths:o.payload.paths,position:new Zr(o.payload.position)}})}),r=await this.listen(Ln.DRAG_OVER,o=>{t({...o,payload:{type:"over",position:new Zr(o.payload.position)}})}),i=await this.listen(Ln.DRAG_DROP,o=>{t({...o,payload:{type:"drop",paths:o.payload.paths,position:new Zr(o.payload.position)}})}),a=await this.listen(Ln.DRAG_LEAVE,o=>{t({...o,payload:{type:"leave"}})});return()=>{n(),i(),r(),a()}}async onFocusChanged(t){const n=await this.listen(Ln.WINDOW_FOCUS,i=>{t({...i,payload:!0})}),r=await this.listen(Ln.WINDOW_BLUR,i=>{t({...i,payload:!1})});return()=>{n(),r()}}async onScaleChanged(t){return this.listen(Ln.WINDOW_SCALE_FACTOR_CHANGED,t)}async onThemeChanged(t){return this.listen(Ln.WINDOW_THEME_CHANGED,t)}}var bk;(function(e){e.Disabled="disabled",e.Throttle="throttle",e.Suspend="suspend"})(bk||(bk={}));var wk;(function(e){e.Default="default",e.FluentOverlay="fluentOverlay"})(wk||(wk={}));var kk;(function(e){e.AppearanceBased="appearanceBased",e.Light="light",e.Dark="dark",e.MediumLight="mediumLight",e.UltraDark="ultraDark",e.Titlebar="titlebar",e.Selection="selection",e.Menu="menu",e.Popover="popover",e.Sidebar="sidebar",e.HeaderView="headerView",e.Sheet="sheet",e.WindowBackground="windowBackground",e.HudWindow="hudWindow",e.FullScreenUI="fullScreenUI",e.Tooltip="tooltip",e.ContentBackground="contentBackground",e.UnderWindowBackground="underWindowBackground",e.UnderPageBackground="underPageBackground",e.Mica="mica",e.Blur="blur",e.Acrylic="acrylic",e.Tabbed="tabbed",e.TabbedDark="tabbedDark",e.TabbedLight="tabbedLight"})(kk||(kk={}));var _k;(function(e){e.FollowsWindowActiveState="followsWindowActiveState",e.Active="active",e.Inactive="inactive"})(_k||(_k={}));function QT(){return new Ob(Tb(),window.__TAURI_INTERNALS__.metadata.currentWebview.label,{skip:!0})}async function Sk(){return B("plugin:webview|get_all_webviews").then(e=>e.map(t=>new Ob(new yh(t.windowLabel,{skip:!0}),t.label,{skip:!0})))}const Dm=["tauri://created","tauri://error"];class Ob{constructor(t,n,r){this.window=t,this.label=n,this.listeners=Object.create(null),r?.skip||B("plugin:webview|create_webview",{windowLabel:t.label,options:{...r,label:n}}).then(async()=>this.emit("tauri://created")).catch(async i=>this.emit("tauri://error",i))}static async getByLabel(t){var n;return(n=(await Sk()).find(r=>r.label===t))!==null&&n!==void 0?n:null}static getCurrent(){return QT()}static async getAll(){return Sk()}async listen(t,n){return this._handleTauriEvent(t,n)?()=>{const r=this.listeners[t];r.splice(r.indexOf(n),1)}:Ue(t,n,{target:{kind:"Webview",label:this.label}})}async once(t,n){return this._handleTauriEvent(t,n)?()=>{const r=this.listeners[t];r.splice(r.indexOf(n),1)}:Nb(t,n,{target:{kind:"Webview",label:this.label}})}async emit(t,n){if(Dm.includes(t)){for(const r of this.listeners[t]||[])r({event:t,id:-1,payload:n});return}return ja(t,n)}async emitTo(t,n,r){if(Dm.includes(n)){for(const i of this.listeners[n]||[])i({event:n,id:-1,payload:r});return}return sr(t,n,r)}_handleTauriEvent(t,n){return Dm.includes(t)?(t in this.listeners?this.listeners[t].push(n):this.listeners[t]=[n],!0):!1}async position(){return B("plugin:webview|webview_position",{label:this.label}).then(t=>new Zr(t))}async size(){return B("plugin:webview|webview_size",{label:this.label}).then(t=>new sl(t))}async close(){return B("plugin:webview|webview_close",{label:this.label})}async setSize(t){return B("plugin:webview|set_webview_size",{label:this.label,value:t instanceof Qa?t:new Qa(t)})}async setPosition(t){return B("plugin:webview|set_webview_position",{label:this.label,value:t instanceof tl?t:new tl(t)})}async setFocus(){return B("plugin:webview|set_webview_focus",{label:this.label})}async setAutoResize(t){return B("plugin:webview|set_webview_auto_resize",{label:this.label,value:t})}async hide(){return B("plugin:webview|webview_hide",{label:this.label})}async show(){return B("plugin:webview|webview_show",{label:this.label})}async setZoom(t){return B("plugin:webview|set_webview_zoom",{label:this.label,value:t})}async reparent(t){return B("plugin:webview|reparent",{label:this.label,window:typeof t=="string"?t:t.label})}async clearAllBrowsingData(){return B("plugin:webview|clear_all_browsing_data")}async setBackgroundColor(t){return B("plugin:webview|set_webview_background_color",{color:t})}async onDragDropEvent(t){const n=await this.listen(Ln.DRAG_ENTER,o=>{t({...o,payload:{type:"enter",paths:o.payload.paths,position:new Zr(o.payload.position)}})}),r=await this.listen(Ln.DRAG_OVER,o=>{t({...o,payload:{type:"over",position:new Zr(o.payload.position)}})}),i=await this.listen(Ln.DRAG_DROP,o=>{t({...o,payload:{type:"drop",paths:o.payload.paths,position:new Zr(o.payload.position)}})}),a=await this.listen(Ln.DRAG_LEAVE,o=>{t({...o,payload:{type:"leave"}})});return()=>{n(),i(),r(),a()}}}function si(){const e=QT();return new Mu(e.label,{skip:!0})}async function Ek(){return B("plugin:window|get_all_windows").then(e=>e.map(t=>new Mu(t,{skip:!0})))}class Mu{constructor(t,n={}){var r;this.label=t,this.listeners=Object.create(null),n?.skip||B("plugin:webview|create_webview_window",{options:{...n,parent:typeof n.parent=="string"?n.parent:(r=n.parent)===null||r===void 0?void 0:r.label,label:t}}).then(async()=>this.emit("tauri://created")).catch(async i=>this.emit("tauri://error",i))}static async getByLabel(t){var n;const r=(n=(await Ek()).find(i=>i.label===t))!==null&&n!==void 0?n:null;return r?new Mu(r.label,{skip:!0}):null}static getCurrent(){return si()}static async getAll(){return Ek()}async listen(t,n){return this._handleTauriEvent(t,n)?()=>{const r=this.listeners[t];r.splice(r.indexOf(n),1)}:Ue(t,n,{target:{kind:"WebviewWindow",label:this.label}})}async once(t,n){return this._handleTauriEvent(t,n)?()=>{const r=this.listeners[t];r.splice(r.indexOf(n),1)}:Nb(t,n,{target:{kind:"WebviewWindow",label:this.label}})}async setBackgroundColor(t){return B("plugin:window|set_background_color",{color:t}).then(()=>B("plugin:webview|set_webview_background_color",{color:t}))}}v3(Mu,[yh,Ob]);function v3(e,t){(Array.isArray(t)?t:[t]).forEach(n=>{Object.getOwnPropertyNames(n.prototype).forEach(r=>{var i;typeof e.prototype=="object"&&e.prototype&&r in e.prototype||Object.defineProperty(e.prototype,r,(i=Object.getOwnPropertyDescriptor(n.prototype,r))!==null&&i!==void 0?i:Object.create(null))})})}function x3(e){if(typeof document>"u")return;let t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}const b3=e=>{switch(e){case"success":return _3;case"info":return E3;case"warning":return S3;case"error":return C3;default:return null}},w3=Array(12).fill(0),k3=({visible:e,className:t})=>ye.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},ye.createElement("div",{className:"sonner-spinner"},w3.map((n,r)=>ye.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${r}`})))),_3=ye.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ye.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),S3=ye.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},ye.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),E3=ye.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ye.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),C3=ye.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ye.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),j3=ye.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},ye.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),ye.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),P3=()=>{const[e,t]=ye.useState(document.hidden);return ye.useEffect(()=>{const n=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),e};let Cv=1;class N3{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{const n=this.subscribers.indexOf(t);this.subscribers.splice(n,1)}),this.publish=t=>{this.subscribers.forEach(n=>n(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var n;const{message:r,...i}=t,a=typeof t?.id=="number"||((n=t.id)==null?void 0:n.length)>0?t.id:Cv++,o=this.toasts.find(l=>l.id===a),s=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(a)&&this.dismissedToasts.delete(a),o?this.toasts=this.toasts.map(l=>l.id===a?(this.publish({...l,...t,id:a,title:r}),{...l,...t,id:a,dismissible:s,title:r}):l):this.addToast({title:r,...i,dismissible:s,id:a}),a},this.dismiss=t=>(t?(this.dismissedToasts.add(t),requestAnimationFrame(()=>this.subscribers.forEach(n=>n({id:t,dismiss:!0})))):this.toasts.forEach(n=>{this.subscribers.forEach(r=>r({id:n.id,dismiss:!0}))}),t),this.message=(t,n)=>this.create({...n,message:t}),this.error=(t,n)=>this.create({...n,message:t,type:"error"}),this.success=(t,n)=>this.create({...n,type:"success",message:t}),this.info=(t,n)=>this.create({...n,type:"info",message:t}),this.warning=(t,n)=>this.create({...n,type:"warning",message:t}),this.loading=(t,n)=>this.create({...n,type:"loading",message:t}),this.promise=(t,n)=>{if(!n)return;let r;n.loading!==void 0&&(r=this.create({...n,promise:t,type:"loading",message:n.loading,description:typeof n.description!="function"?n.description:void 0}));const i=Promise.resolve(t instanceof Function?t():t);let a=r!==void 0,o;const s=i.then(async c=>{if(o=["resolve",c],ye.isValidElement(c))a=!1,this.create({id:r,type:"default",message:c});else if(O3(c)&&!c.ok){a=!1;const u=typeof n.error=="function"?await n.error(`HTTP error! status: ${c.status}`):n.error,p=typeof n.description=="function"?await n.description(`HTTP error! status: ${c.status}`):n.description,y=typeof u=="object"&&!ye.isValidElement(u)?u:{message:u};this.create({id:r,type:"error",description:p,...y})}else if(c instanceof Error){a=!1;const u=typeof n.error=="function"?await n.error(c):n.error,p=typeof n.description=="function"?await n.description(c):n.description,y=typeof u=="object"&&!ye.isValidElement(u)?u:{message:u};this.create({id:r,type:"error",description:p,...y})}else if(n.success!==void 0){a=!1;const u=typeof n.success=="function"?await n.success(c):n.success,p=typeof n.description=="function"?await n.description(c):n.description,y=typeof u=="object"&&!ye.isValidElement(u)?u:{message:u};this.create({id:r,type:"success",description:p,...y})}}).catch(async c=>{if(o=["reject",c],n.error!==void 0){a=!1;const d=typeof n.error=="function"?await n.error(c):n.error,u=typeof n.description=="function"?await n.description(c):n.description,h=typeof d=="object"&&!ye.isValidElement(d)?d:{message:d};this.create({id:r,type:"error",description:u,...h})}}).finally(()=>{a&&(this.dismiss(r),r=void 0),n.finally==null||n.finally.call(n)}),l=()=>new Promise((c,d)=>s.then(()=>o[0]==="reject"?d(o[1]):c(o[1])).catch(d));return typeof r!="string"&&typeof r!="number"?{unwrap:l}:Object.assign(r,{unwrap:l})},this.custom=(t,n)=>{const r=n?.id||Cv++;return this.create({jsx:t(r),id:r,...n}),r},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const mr=new N3,T3=(e,t)=>{const n=t?.id||Cv++;return mr.addToast({title:e,...t,id:n}),n},O3=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",A3=T3,R3=()=>mr.toasts,M3=()=>mr.getActiveToasts(),ke=Object.assign(A3,{success:mr.success,info:mr.info,warning:mr.warning,error:mr.error,custom:mr.custom,message:mr.message,promise:mr.promise,dismiss:mr.dismiss,loading:mr.loading},{getHistory:R3,getToasts:M3});x3("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");function gd(e){return e.label!==void 0}const I3=3,D3="24px",L3="16px",Ck=4e3,$3=356,z3=14,F3=45,B3=200;function Ai(...e){return e.filter(Boolean).join(" ")}function W3(e){const[t,n]=e.split("-"),r=[];return t&&r.push(t),n&&r.push(n),r}const H3=e=>{var t,n,r,i,a,o,s,l,c;const{invert:d,toast:u,unstyled:p,interacting:h,setHeights:y,visibleToasts:g,heights:x,index:v,toasts:b,expanded:w,removeToast:_,defaultRichColors:k,closeButton:S,style:E,cancelButtonStyle:C,actionButtonStyle:j,className:T="",descriptionClassName:A="",duration:R,position:D,gap:M,expandByDefault:O,classNames:I,icons:L,closeButtonAriaLabel:V="Close toast"}=e,[F,N]=ye.useState(null),[ee,Q]=ye.useState(null),[P,z]=ye.useState(!1),[$,H]=ye.useState(!1),[oe,q]=ye.useState(!1),[X,te]=ye.useState(!1),[ue,G]=ye.useState(!1),[be,xe]=ye.useState(0),[Ae,ge]=ye.useState(0),_e=ye.useRef(u.duration||R||Ck),De=ye.useRef(null),ve=ye.useRef(null),Le=v===0,le=v+1<=g,pe=u.type,K=u.dismissible!==!1,se=u.className||"",Se=u.descriptionClassName||"",Z=ye.useMemo(()=>x.findIndex(Ve=>Ve.toastId===u.id)||0,[x,u.id]),U=ye.useMemo(()=>{var Ve;return(Ve=u.closeButton)!=null?Ve:S},[u.closeButton,S]),fe=ye.useMemo(()=>u.duration||R||Ck,[u.duration,R]),we=ye.useRef(0),Re=ye.useRef(0),Ee=ye.useRef(0),Ne=ye.useRef(null),[nt,xt]=D.split("-"),fn=ye.useMemo(()=>x.reduce((Ve,jt,Lt)=>Lt>=Z?Ve:Ve+jt.height,0),[x,Z]),Nt=P3(),sn=u.invert||d,tt=pe==="loading";Re.current=ye.useMemo(()=>Z*M+fn,[Z,fn]),ye.useEffect(()=>{_e.current=fe},[fe]),ye.useEffect(()=>{z(!0)},[]),ye.useEffect(()=>{const Ve=ve.current;if(Ve){const jt=Ve.getBoundingClientRect().height;return ge(jt),y(Lt=>[{toastId:u.id,height:jt,position:u.position},...Lt]),()=>y(Lt=>Lt.filter(Vt=>Vt.toastId!==u.id))}},[y,u.id]),ye.useLayoutEffect(()=>{if(!P)return;const Ve=ve.current,jt=Ve.style.height;Ve.style.height="auto";const Lt=Ve.getBoundingClientRect().height;Ve.style.height=jt,ge(Lt),y(Vt=>Vt.find($t=>$t.toastId===u.id)?Vt.map($t=>$t.toastId===u.id?{...$t,height:Lt}:$t):[{toastId:u.id,height:Lt,position:u.position},...Vt])},[P,u.title,u.description,y,u.id,u.jsx,u.action,u.cancel]);const wt=ye.useCallback(()=>{H(!0),xe(Re.current),y(Ve=>Ve.filter(jt=>jt.toastId!==u.id)),setTimeout(()=>{_(u)},B3)},[u,_,y,Re]);ye.useEffect(()=>{if(u.promise&&pe==="loading"||u.duration===1/0||u.type==="loading")return;let Ve;return w||h||Nt?(()=>{if(Ee.current<we.current){const Vt=new Date().getTime()-we.current;_e.current=_e.current-Vt}Ee.current=new Date().getTime()})():_e.current!==1/0&&(we.current=new Date().getTime(),Ve=setTimeout(()=>{u.onAutoClose==null||u.onAutoClose.call(u,u),wt()},_e.current)),()=>clearTimeout(Ve)},[w,h,u,pe,Nt,wt]),ye.useEffect(()=>{u.delete&&(wt(),u.onDismiss==null||u.onDismiss.call(u,u))},[wt,u.delete]);function pn(){var Ve;if(L?.loading){var jt;return ye.createElement("div",{className:Ai(I?.loader,u==null||(jt=u.classNames)==null?void 0:jt.loader,"sonner-loader"),"data-visible":pe==="loading"},L.loading)}return ye.createElement(k3,{className:Ai(I?.loader,u==null||(Ve=u.classNames)==null?void 0:Ve.loader),visible:pe==="loading"})}const hn=u.icon||L?.[pe]||b3(pe);var Hn,Un;return ye.createElement("li",{tabIndex:0,ref:ve,className:Ai(T,se,I?.toast,u==null||(t=u.classNames)==null?void 0:t.toast,I?.default,I?.[pe],u==null||(n=u.classNames)==null?void 0:n[pe]),"data-sonner-toast":"","data-rich-colors":(Hn=u.richColors)!=null?Hn:k,"data-styled":!(u.jsx||u.unstyled||p),"data-mounted":P,"data-promise":!!u.promise,"data-swiped":ue,"data-removed":$,"data-visible":le,"data-y-position":nt,"data-x-position":xt,"data-index":v,"data-front":Le,"data-swiping":oe,"data-dismissible":K,"data-type":pe,"data-invert":sn,"data-swipe-out":X,"data-swipe-direction":ee,"data-expanded":!!(w||O&&P),"data-testid":u.testId,style:{"--index":v,"--toasts-before":v,"--z-index":b.length-v,"--offset":`${$?be:Re.current}px`,"--initial-height":O?"auto":`${Ae}px`,...E,...u.style},onDragEnd:()=>{q(!1),N(null),Ne.current=null},onPointerDown:Ve=>{Ve.button!==2&&(tt||!K||(De.current=new Date,xe(Re.current),Ve.target.setPointerCapture(Ve.pointerId),Ve.target.tagName!=="BUTTON"&&(q(!0),Ne.current={x:Ve.clientX,y:Ve.clientY})))},onPointerUp:()=>{var Ve,jt,Lt;if(X||!K)return;Ne.current=null;const Vt=Number(((Ve=ve.current)==null?void 0:Ve.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),Tr=Number(((jt=ve.current)==null?void 0:jt.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),$t=new Date().getTime()-((Lt=De.current)==null?void 0:Lt.getTime()),Vn=F==="x"?Vt:Tr,Ni=Math.abs(Vn)/$t;if(Math.abs(Vn)>=F3||Ni>.11){xe(Re.current),u.onDismiss==null||u.onDismiss.call(u,u),Q(F==="x"?Vt>0?"right":"left":Tr>0?"down":"up"),wt(),te(!0);return}else{var W,Y;(W=ve.current)==null||W.style.setProperty("--swipe-amount-x","0px"),(Y=ve.current)==null||Y.style.setProperty("--swipe-amount-y","0px")}G(!1),q(!1),N(null)},onPointerMove:Ve=>{var jt,Lt,Vt;if(!Ne.current||!K||((jt=window.getSelection())==null?void 0:jt.toString().length)>0)return;const $t=Ve.clientY-Ne.current.y,Vn=Ve.clientX-Ne.current.x;var Ni;const W=(Ni=e.swipeDirections)!=null?Ni:W3(D);!F&&(Math.abs(Vn)>1||Math.abs($t)>1)&&N(Math.abs(Vn)>Math.abs($t)?"x":"y");let Y={x:0,y:0};const ne=ce=>1/(1.5+Math.abs(ce)/20);if(F==="y"){if(W.includes("top")||W.includes("bottom"))if(W.includes("top")&&$t<0||W.includes("bottom")&&$t>0)Y.y=$t;else{const ce=$t*ne($t);Y.y=Math.abs(ce)<Math.abs($t)?ce:$t}}else if(F==="x"&&(W.includes("left")||W.includes("right")))if(W.includes("left")&&Vn<0||W.includes("right")&&Vn>0)Y.x=Vn;else{const ce=Vn*ne(Vn);Y.x=Math.abs(ce)<Math.abs(Vn)?ce:Vn}(Math.abs(Y.x)>0||Math.abs(Y.y)>0)&&G(!0),(Lt=ve.current)==null||Lt.style.setProperty("--swipe-amount-x",`${Y.x}px`),(Vt=ve.current)==null||Vt.style.setProperty("--swipe-amount-y",`${Y.y}px`)}},U&&!u.jsx&&pe!=="loading"?ye.createElement("button",{"aria-label":V,"data-disabled":tt,"data-close-button":!0,onClick:tt||!K?()=>{}:()=>{wt(),u.onDismiss==null||u.onDismiss.call(u,u)},className:Ai(I?.closeButton,u==null||(r=u.classNames)==null?void 0:r.closeButton)},(Un=L?.close)!=null?Un:j3):null,(pe||u.icon||u.promise)&&u.icon!==null&&(L?.[pe]!==null||u.icon)?ye.createElement("div",{"data-icon":"",className:Ai(I?.icon,u==null||(i=u.classNames)==null?void 0:i.icon)},u.promise||u.type==="loading"&&!u.icon?u.icon||pn():null,u.type!=="loading"?hn:null):null,ye.createElement("div",{"data-content":"",className:Ai(I?.content,u==null||(a=u.classNames)==null?void 0:a.content)},ye.createElement("div",{"data-title":"",className:Ai(I?.title,u==null||(o=u.classNames)==null?void 0:o.title)},u.jsx?u.jsx:typeof u.title=="function"?u.title():u.title),u.description?ye.createElement("div",{"data-description":"",className:Ai(A,Se,I?.description,u==null||(s=u.classNames)==null?void 0:s.description)},typeof u.description=="function"?u.description():u.description):null),ye.isValidElement(u.cancel)?u.cancel:u.cancel&&gd(u.cancel)?ye.createElement("button",{"data-button":!0,"data-cancel":!0,style:u.cancelButtonStyle||C,onClick:Ve=>{gd(u.cancel)&&K&&(u.cancel.onClick==null||u.cancel.onClick.call(u.cancel,Ve),wt())},className:Ai(I?.cancelButton,u==null||(l=u.classNames)==null?void 0:l.cancelButton)},u.cancel.label):null,ye.isValidElement(u.action)?u.action:u.action&&gd(u.action)?ye.createElement("button",{"data-button":!0,"data-action":!0,style:u.actionButtonStyle||j,onClick:Ve=>{gd(u.action)&&(u.action.onClick==null||u.action.onClick.call(u.action,Ve),!Ve.defaultPrevented&&wt())},className:Ai(I?.actionButton,u==null||(c=u.classNames)==null?void 0:c.actionButton)},u.action.label):null)};function jk(){if(typeof window>"u"||typeof document>"u")return"ltr";const e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function U3(e,t){const n={};return[e,t].forEach((r,i)=>{const a=i===1,o=a?"--mobile-offset":"--offset",s=a?L3:D3;function l(c){["top","right","bottom","left"].forEach(d=>{n[`${o}-${d}`]=typeof c=="number"?`${c}px`:c})}typeof r=="number"||typeof r=="string"?l(r):typeof r=="object"?["top","right","bottom","left"].forEach(c=>{r[c]===void 0?n[`${o}-${c}`]=s:n[`${o}-${c}`]=typeof r[c]=="number"?`${r[c]}px`:r[c]}):l(s)}),n}const V3=ye.forwardRef(function(t,n){const{id:r,invert:i,position:a="bottom-right",hotkey:o=["altKey","KeyT"],expand:s,closeButton:l,className:c,offset:d,mobileOffset:u,theme:p="light",richColors:h,duration:y,style:g,visibleToasts:x=I3,toastOptions:v,dir:b=jk(),gap:w=z3,icons:_,containerAriaLabel:k="Notifications"}=t,[S,E]=ye.useState([]),C=ye.useMemo(()=>r?S.filter(P=>P.toasterId===r):S.filter(P=>!P.toasterId),[S,r]),j=ye.useMemo(()=>Array.from(new Set([a].concat(C.filter(P=>P.position).map(P=>P.position)))),[C,a]),[T,A]=ye.useState([]),[R,D]=ye.useState(!1),[M,O]=ye.useState(!1),[I,L]=ye.useState(p!=="system"?p:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),V=ye.useRef(null),F=o.join("+").replace(/Key/g,"").replace(/Digit/g,""),N=ye.useRef(null),ee=ye.useRef(!1),Q=ye.useCallback(P=>{E(z=>{var $;return($=z.find(H=>H.id===P.id))!=null&&$.delete||mr.dismiss(P.id),z.filter(({id:H})=>H!==P.id)})},[]);return ye.useEffect(()=>mr.subscribe(P=>{if(P.dismiss){requestAnimationFrame(()=>{E(z=>z.map($=>$.id===P.id?{...$,delete:!0}:$))});return}setTimeout(()=>{m3.flushSync(()=>{E(z=>{const $=z.findIndex(H=>H.id===P.id);return $!==-1?[...z.slice(0,$),{...z[$],...P},...z.slice($+1)]:[P,...z]})})})}),[S]),ye.useEffect(()=>{if(p!=="system"){L(p);return}if(p==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?L("dark"):L("light")),typeof window>"u")return;const P=window.matchMedia("(prefers-color-scheme: dark)");try{P.addEventListener("change",({matches:z})=>{L(z?"dark":"light")})}catch{P.addListener(({matches:$})=>{try{L($?"dark":"light")}catch(H){console.error(H)}})}},[p]),ye.useEffect(()=>{S.length<=1&&D(!1)},[S]),ye.useEffect(()=>{const P=z=>{var $;if(o.every(q=>z[q]||z.code===q)){var oe;D(!0),(oe=V.current)==null||oe.focus()}z.code==="Escape"&&(document.activeElement===V.current||($=V.current)!=null&&$.contains(document.activeElement))&&D(!1)};return document.addEventListener("keydown",P),()=>document.removeEventListener("keydown",P)},[o]),ye.useEffect(()=>{if(V.current)return()=>{N.current&&(N.current.focus({preventScroll:!0}),N.current=null,ee.current=!1)}},[V.current]),ye.createElement("section",{ref:n,"aria-label":`${k} ${F}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},j.map((P,z)=>{var $;const[H,oe]=P.split("-");return C.length?ye.createElement("ol",{key:P,dir:b==="auto"?jk():b,tabIndex:-1,ref:V,className:c,"data-sonner-toaster":!0,"data-sonner-theme":I,"data-y-position":H,"data-x-position":oe,style:{"--front-toast-height":`${(($=T[0])==null?void 0:$.height)||0}px`,"--width":`${$3}px`,"--gap":`${w}px`,...g,...U3(d,u)},onBlur:q=>{ee.current&&!q.currentTarget.contains(q.relatedTarget)&&(ee.current=!1,N.current&&(N.current.focus({preventScroll:!0}),N.current=null))},onFocus:q=>{q.target instanceof HTMLElement&&q.target.dataset.dismissible==="false"||ee.current||(ee.current=!0,N.current=q.relatedTarget)},onMouseEnter:()=>D(!0),onMouseMove:()=>D(!0),onMouseLeave:()=>{M||D(!1)},onDragEnd:()=>D(!1),onPointerDown:q=>{q.target instanceof HTMLElement&&q.target.dataset.dismissible==="false"||O(!0)},onPointerUp:()=>O(!1)},C.filter(q=>!q.position&&z===0||q.position===P).map((q,X)=>{var te,ue;return ye.createElement(H3,{key:q.id,icons:_,index:X,toast:q,defaultRichColors:h,duration:(te=v?.duration)!=null?te:y,className:v?.className,descriptionClassName:v?.descriptionClassName,invert:i,visibleToasts:x,closeButton:(ue=v?.closeButton)!=null?ue:l,interacting:M,position:P,style:v?.style,unstyled:v?.unstyled,classNames:v?.classNames,cancelButtonStyle:v?.cancelButtonStyle,actionButtonStyle:v?.actionButtonStyle,closeButtonAriaLabel:v?.closeButtonAriaLabel,removeToast:Q,toasts:C.filter(G=>G.position==q.position),heights:T.filter(G=>G.position==q.position),setHeights:A,expandByDefault:s,gap:w,expanded:R,swipeDirections:t.swipeDirections})})):null}))});var Hi;(function(e){e[e.Trace=1]="Trace",e[e.Debug=2]="Debug",e[e.Info=3]="Info",e[e.Warn=4]="Warn",e[e.Error=5]="Error"})(Hi||(Hi={}));function q3(e){if(e)if(e.startsWith("Error")){const n=e.split(`
@@ -446,7 +446,7 @@ Target language: ${h}`;let g="";try{const x=await ea({mode:a.mode,systemPrompt:y
446
446
  Target language: ${T}`:null,M=u&&S.translateOutputMode==="bilingual";let O=null;k.mode==="custom"&&(O=k.customProviders.find(L=>L.id===k.activeCustomProviderId)??null),g=k.mode==="custom"&&O?`${O.name} · ${O.model}`:k.mode==="saas"?"OpenLoaf SaaS":null,console.info(`[ai-refine] stream start mode=${k.mode} textLen=${c.length} hotwordsLen=${b.length} provider=${O?.id??"saas"}`);let I=!1;try{if(k.mode==="custom"&&!O)throw new Error("no_active_custom_provider");const L={customBaseUrl:O?.baseUrl,customModel:O?.model,customKeyringId:O?`ai_provider_${O.id}`:void 0},V=$=>{w+=$,Ct&&Ze.getState().state==="transcribing"&&Ze.setState({state:"injecting",pillEarlyHide:!1}),Ze.setState({liveTranscript:w}),Jf(w)},N=u&&!M?$=>{}:V,ee=t0(nr,Na),Q=os({corePrompt:R,items:mt.getState().items,targetApp:nr,focusTitle:_a,audioDurationMs:l?.duration_ms,enrichHotwords:!0,appTypeAddon:n0(ee,C)});console.info(`[ai-refine] phase1 system_prompt: len=${Q.length} chars`);const z=(await ea({mode:k.mode,systemPrompt:Q,userText:c,...L,taskId:dl??void 0},N)).refinedText;if(I=!0,u){if(Ct&&Ze.setState({state:"translating",pillEarlyHide:!1}),M){const X=/\n*$/.exec(w)?.[0].length??0,te=Math.max(0,1-X);te>0&&(w+=`
447
447
  `.repeat(te),Jf(w))}let $=M;const H=X=>{if($){if(X=X.replace(/^\s+/,""),!X)return;$=!1}V(X)},oe=os({corePrompt:D,items:mt.getState().items,targetApp:nr,focusTitle:_a,audioDurationMs:l?.duration_ms,skipHistory:!0,enrichHotwords:!0});console.info(`[ai-refine] phase2 system_prompt: len=${oe.length} chars`);const q=await ea({mode:k.mode,systemPrompt:oe,userText:z,...L,taskId:dl??void 0},H);h=M?w:q.refinedText,y=q.refinedText}else h=z;r=Math.round(performance.now()-_),console.info(`[ai-refine] stream done refinedLen=${h.length} elapsedMs=${r}`),_H(),Ct&&Ze.setState({pillEarlyHide:!0});try{await Sl}catch{}if(Sa()&&re.getState().dictation.clipboardCopy)try{await zn(h)}catch($){console.warn("[clipboard] post-refine writeText failed:",$)}}catch(L){const V=String(L??""),F=u?I?`${ie.t("errors:phase.translate")}: `:`${ie.t("errors:phase.refine")}: `:`${ie.t("errors:phase.refine")}: `;if(k.mode==="custom"){console.warn(`[refine] custom failed after ${Math.round(performance.now()-_)}ms: ${V}`);const N=co(L);await ka(L)||Wt("warning",ie.t("overlay:toast.transcribe_failed.title"),{description:N}),a=`${F}${N}`}else if(Xf(V))console.warn(`[refine] saas auth lost after ${Math.round(performance.now()-_)}ms: ${V}`),Lv(),a=`${F}${ie.t("overlay:error.stt_not_authenticated")}`;else{console.warn(`[refine] stream failed after ${Math.round(performance.now()-_)}ms, falling back to raw transcript:`,L);const N=co(L);Wt("warning",ie.t("overlay:toast.transcribe_failed.title"),{description:N}),a=`${F}${N}`}}Ct&&(Ze.getState().state==="transcribing"||Ze.getState().state==="translating")&&Ze.setState({state:"injecting",pillEarlyHide:!1})}else c&&!p&&console.info(`[refine] skipped, segmentMode=${d} refineEnabled=${p}`);const v=h??c;if(l&&Sa()){const b=Fi?"saas-rest":"saas-realtime",w=ru??(d==="REALTIME"?"saas-realtime":"saas-file"),_=u&&a!==null;let k,S;c?_?(k="failed",S=a):a!==null?(k="success",S=a):(k="success",S=void 0):(k="failed",S=i??"no final transcript");const C=await mt.getState().add({type:u?"translate":"dictation",text:c||a0(),refined_text:u?y:h,status:k,error:S,duration_ms:l.duration_ms,audio_path:l.audio_path,target_app:nr,target_app_id:Na,asr_source:b,ai_model:g,segment_mode:d,provider_kind:w,target_lang:u?re.getState().general.translateTargetLang:null,asr_ms:n,refine_ms:r,debug_payload:null,focus_title:_a});ya.getState().setFromHistory(C),Yf&&k==="failed"&&!c&&C.audio_path&&(console.info(`[recording] saas auth lost during finalize → pending recovery historyId=${C.id}`),qe.getState().setPendingAuthRecoveryHistoryId(C.id)),Yf=!1}if(v&&Sa()){try{await Sl}catch{}if(!Sa())return console.log("[inject] tail skipped: flow no longer active (esc / cancel)"),gi(),{rec:l,text:v};const b=await sH(),w=b===!1,_=await gH();if(Ke(`[inject] tail gate check focusEditable=${b} focusNotEditable=${w} appChanged=${_} recordedApp=${nr??"null"}`),w||_){const k=tr.length>0;Jt(`[inject] tail skipped → ${k?"clipboard only (streamed already typed)":"result panel"} focusEditable=${b} appChanged=${_} typedLen=${tr.length}`);try{await zn(v)}catch(S){console.warn("[clipboard] fallback write failed:",S)}return k||xd(v),gi(),{rec:l,text:v}}if(console.log("[inject] tail enter",{finalLen:v.length,injectedLen:tr.length,prefixMatch:v.startsWith(tr)}),v.startsWith(tr)){const k=v.slice(tr.length);if(k)if(re.getState().dictation.streamingInject)try{console.log("[inject] tail → type",{remaining:k.length}),await B("inject_type",{text:k}),console.log("[inject] tail type ok")}catch(E){console.warn("[inject] tail type failed, fallback to paste:",E);try{await zn(k),await B("inject_paste"),console.log("[inject] tail paste fallback ok")}catch(C){console.error("[inject] tail paste fallback also failed:",C);try{await zn(v)}catch{}xd(v)}}else try{console.log("[inject] tail → paste-all",{remaining:k.length}),await SH(k),console.log("[inject] tail paste-all ok")}catch(E){console.error("[inject] tail paste-all failed:",E);try{await zn(v)}catch{}xd(v)}else console.log("[inject] tail no-op: remaining is empty (stream covered all)")}else{console.warn("[inject] tail prefix mismatch → clipboard-only fallback",{finalLen:v.length,injectedLen:tr.length,finalHead:v.slice(0,24),injectedHead:tr.slice(0,24)});try{await zn(v),console.log("[inject] clipboard-only write ok")}catch(k){console.error("[clipboard] writeText failed:",k)}xd(v)}gi()}else v||console.log("[inject] tail skipped: empty finalText");return{rec:l,text:v}};let tr="",Sl=Promise.resolve();const Sa=()=>{const e=Ze.getState().state;return e==="transcribing"||e==="injecting"||e==="translating"},_H=()=>{},gi=()=>{tr=""},Jf=e=>{if(!Ct||!Sa()||!re.getState().dictation.streamingInject||!e.startsWith(tr))return;const t=e.slice(tr.length);t&&(tr=e,Sl=Sl.then(async()=>{if(Sa())try{await B("inject_type",{text:t})}catch(n){console.warn("[inject] incremental type failed",{deltaLen:t.length,cumulativeLen:tr.length,err:String(n)})}}))},SH=async e=>{if(!e)return;const t=re.getState().dictation.clipboardCopy;let n=null;if(!t)try{n=await Wf()}catch(r){console.warn("[inject] read clipboard for backup failed:",r)}if(await zn(e),await B("inject_paste"),!t){await new Promise(r=>setTimeout(r,80));try{await zn(n??"")}catch(r){console.warn("[inject] restore clipboard failed:",r)}}},$i=()=>{if(!Ct)return;const e=new Error().stack?.split(`
448
448
  `).slice(2,6).join(" | ");console.info(`[recording] discardRecording called, caller=${e}`),qf(),nu(),gi()},EH=async()=>{try{if(await B("permission_check_microphone")!=="granted")return{ok:!1,reason:ie.t("overlay:error.preflight_permission_denied")}}catch(e){console.warn("[recording] preflight: permission check threw, assume granted",e)}try{const e=await B("audio_list_input_devices");if(!e||e.length===0)return{ok:!1,reason:ie.t("overlay:error.preflight_no_device")}}catch(e){return console.warn("[recording] preflight: device list threw",e),{ok:!1,reason:ie.t("overlay:error.preflight_no_device")}}return{ok:!0}},Xm=async()=>{if(!Ct)return;const e=new Error().stack?.split(`
449
- `).slice(2,6).join(" | ");console.info(`[recording] abortAndSaveHistory called, caller=${e}`),console.log("[recording] abort: saving audio without transcription");const t=Ze.getState().activeId==="translate";nu(),gi();let n=null;try{n=await Hb()}catch(i){console.warn("[recording] abort: stopRecordingAndSave failed:",i)}if(n&&!n.voiced)return;if(n&&n.duration_ms<1e3){n.audio_path&&nl(n.audio_path).catch(i=>console.warn("[recording] abort: discard short clip file failed:",i));return}if(n){const i=mo(),a=ru??(i==="REALTIME"?"saas-realtime":"saas-file");try{await mt.getState().add({type:t?"translate":"dictation",text:ie.t("overlay:transcript.aborted_placeholder"),status:"cancelled",duration_ms:n.duration_ms,audio_path:n.audio_path,target_app:nr,target_app_id:Na,segment_mode:i,provider_kind:a,focus_title:_a})}catch(o){console.warn("[recording] abort: history.add failed:",o)}}ke.info(ie.t("overlay:toast.aborted_saved.title"),{description:n?ie.t("overlay:toast.aborted_saved.description"):void 0})},Ze=ui((e,t)=>{let n=Promise.resolve();return{state:"idle",activeId:null,errorMessage:null,recordingStartedAt:0,startedListening:!1,audioLevels:Qt(),recordingId:null,liveTranscript:"",pillEarlyHide:!1,segmentModeOverride:null,setSegmentModeOverride:r=>e({segmentModeOverride:r}),initListeners:async()=>{if(t().startedListening){console.log("[recording] initListeners: already started, skip");return}if(e({startedListening:!0}),console.log("[recording] initListeners: attaching listeners"),!Ct){console.log("[recording] non-main window: skip initListeners");return}let r="",i=t().state,a=null,o=t().state==="error",s=t().errorMessage,l=null;Ze.subscribe(d=>{const u=i!=="idle"&&i!=="error",p=d.state!=="idle"&&d.state!=="error";u!==p&&DF(p),i==="recording"&&d.state==="transcribing"?(Hm("stop"),re.getState().markHintSuccess("recordingControls")):(i==="preparing"||i==="recording")&&d.state==="idle"&&Hm("cancel");const h=i==="preparing"||i==="recording",y=d.state==="preparing"||d.state==="recording";h&&!y&&bd(!1);const g=i==="preparing"||i==="recording"||i==="transcribing",x=d.state==="preparing"||d.state==="recording"||d.state==="transcribing";!g&&x?hH():g&&!x&&mH();const v=i==="preparing"||i==="recording",b=d.state==="preparing"||d.state==="recording";!v&&b?(l!==null&&window.clearTimeout(l),l=window.setTimeout(()=>{l=null;const k=Ze.getState().state;k!=="preparing"&&k!=="recording"||(Jt(`[recording] watchdog tripped: stuck in state=${k} > ${Qk}ms → force abort`),Xm(),In(),Ze.setState({state:"idle",activeId:null,audioLevels:Qt(),recordingId:null,liveTranscript:""}))},Qk)):v&&!b&&l!==null&&(window.clearTimeout(l),l=null),i=d.state;const w=d.state==="error";w&&(!o||d.errorMessage!==s)?(a!==null&&window.clearTimeout(a),a=window.setTimeout(()=>{a=null,Ze.getState().state==="error"&&Ze.getState().dismissError()},fH)):!w&&a!==null&&(window.clearTimeout(a),a=null),o=w,s=d.errorMessage;const _=JSON.stringify({state:d.state,activeId:d.activeId,errorMessage:d.errorMessage,recordingId:d.recordingId,liveTranscript:d.liveTranscript,pillEarlyHide:d.pillEarlyHide});_!==r&&(r=_,ja("openspeech://recording-phase",{state:d.state,activeId:d.activeId,errorMessage:d.errorMessage,recordingId:d.recordingId,liveTranscript:d.liveTranscript,pillEarlyHide:d.pillEarlyHide}))}),await Ue("openspeech://overlay-action",d=>{const u=d.payload;console.log("[recording] overlay-action:",u),u==="cancel"?t().simulateCancel():u==="finalize"&&t().simulateFinalize()}),await Ue("openspeech://overlay-ready",()=>{const d=t();ja("openspeech://recording-phase",{state:d.state,activeId:d.activeId,errorMessage:d.errorMessage,recordingId:d.recordingId,liveTranscript:d.liveTranscript,pillEarlyHide:d.pillEarlyHide}),console.log("[recording] overlay-ready → resent recording-phase snapshot")}),await Ue("openspeech://hotkey",d=>{const u=d.payload.phase==="pressed"?++rc:0;n=n.then(async()=>{Ke(`[recording] event received: id=${d.payload.id} phase=${d.payload.phase} state=${t().state} activeId=${t().activeId??"null"}`);try{const{id:p,phase:h}=d.payload,y=performance.now(),g=t();if(h==="released")return;if(h==="pressed"){if(g.activeId===p&&(g.state==="recording"||g.state==="preparing")){const E=y-g.recordingStartedAt;if(g.state==="preparing"){console.log("[recording] toggle in preparing → silent abort (mic not ready)",{duration:E}),$i(),In(),e({state:"idle",activeId:null,audioLevels:Qt(),recordingId:null,liveTranscript:""});return}const C=100;if(p==="translate"&&E<C){console.log("[recording] toggle (translate): ignored (likely OS/webview-injected duplicate press)",{duration:E,threshold:C});return}if(E<vd){console.log("[recording] toggle: too short → discard (no save / no transcribe)",{duration:E,threshold:vd}),$i(),In(),e({state:"idle",activeId:null,audioLevels:Qt(),recordingId:null,liveTranscript:""});return}console.log("[recording] toggle: stopping → transcribing",{duration:E}),In(),e({state:"transcribing",audioLevels:Qt()}),i_().then(j=>{if(j.silent){e({state:"error",activeId:null,recordingId:null,liveTranscript:"",errorMessage:ie.t("overlay:toast.silent_recording.title")});return}if(!j.text){e({state:"error",activeId:null,recordingId:null,liveTranscript:"",errorMessage:ie.t("overlay:toast.transcribe_failed.title")});return}window.setTimeout(()=>{const T=t().state;T!=="transcribing"&&T!=="injecting"||e({state:"idle",activeId:null,recordingId:null,liveTranscript:""})},800)});return}if(g.activeId!==p&&Jk(g.activeId)&&Jk(p)&&(g.state==="recording"||g.state==="preparing")&&mo()==="UTTERANCE"){console.log("[recording] mode switch:",g.activeId,"→",p),e({activeId:p}),p==="translate"?bd(!0,e_()):bd(!1),yH(p==="translate"?"translate":"dictation",p),Hm("start");return}if(g.state==="error")console.log("[recording] press on error → dismiss & start new",{id:p}),t().dismissError();else if(g.state!=="idle"){console.warn("[recording] press IGNORED: state not idle and activeId mismatch",{pressed_id:p,cur_state:g.state,cur_activeId:g.activeId});return}const v=re.getState().dictation.mode==="custom";let b=pt.getState(),w=b.isAuthenticated;if(!w&&!v){Ke("[recording] gate: try_recover enter");const E=await Promise.race([B("openloaf_try_recover").catch(()=>!1),new Promise(C=>setTimeout(()=>C(!1),1500))]);Ke(`[recording] gate: try_recover exit recovered=${E}`),E&&(b=pt.getState(),w=b.isAuthenticated)}if(!w&&!v){console.log("[recording] gate blocked: no STT backend available");let E=!1;if(Ct){const C=si(),[j,T,A]=await Promise.all([C.isFocused().catch(()=>!1),C.isVisible().catch(()=>!1),C.isMinimized().catch(()=>!1)]);E=j||T&&!A}E?qe.getState().openLogin():Wt("error",ie.t("overlay:toast.not_logged_in.title"),{description:ie.t("overlay:toast.not_logged_in.description"),action:{label:ie.t("overlay:toast.not_logged_in.action"),key:"open_login"},durationMs:0});return}!v&&w&&Ct&&B("openloaf_health_check").then(E=>{E||console.warn("[recording] health check failed (logged for debug only)")}).catch(E=>{console.warn("[recording] health check invoke failed:",E)}),Ke("[recording] preflight enter");const k=await EH();if(Ke(`[recording] preflight exit ok=${k.ok}`),u!==rc){Ke(`[recording] press stale (myEpoch=${u} latest=${rc}) — abort`);return}if(!k.ok){console.warn("[recording] preflight failed:",k.reason),Wt("error",ie.t("overlay:toast.preflight_failed.title"),{description:k.reason});const E=p==="translate";mt.getState().add({type:E?"translate":"dictation",text:a0(),status:"failed",error:k.reason,duration_ms:0,target_lang:E?re.getState().general.translateTargetLang:null}).catch(C=>console.warn("[recording] preflight: history.add failed:",C));return}const S=po();gi(),Fi=!1,_f=!1,e({state:"preparing",activeId:p,errorMessage:null,recordingStartedAt:y,audioLevels:Qt(),recordingId:S,pillEarlyHide:!1,liveTranscript:""}),p==="translate"&&bd(!0,e_()),Ke(`[recording] startMic enter id=${p} recordingId=${S}`),pH().then(E=>{if(Ke(`[recording] startMic exit ok=${E} state=${t().state} activeId=${t().activeId??"null"}`),u!==rc){Ke(`[recording] startMic stale (myEpoch=${u} latest=${rc}) — balance only`),E&&In();return}const C=t();if(C.state!=="preparing"||C.activeId!==p){E&&(console.warn("[recording] startMic resolved after state changed → balancing stopMic",{resolvedFor:p,curState:C.state,curActiveId:C.activeId}),In());return}if(!E){const j=ie.t("overlay:error.stt_mic_not_ready");rl(j),e({state:"idle",activeId:null,audioLevels:Qt(),recordingId:null,liveTranscript:""}),Wt("error",ie.t("overlay:toast.recording_start_failed.title"),{description:j});return}kH(S),e({state:"recording"})});return}}catch(p){Jt(`[recording] hotkey handler threw: ${String(p)}`);try{In()}catch{}try{qf()}catch{}try{nu()}catch{}Ze.setState({state:"idle",activeId:null,audioLevels:Qt(),recordingId:null,liveTranscript:""})}}).catch(()=>{})}),await Ue("openspeech://audio-level",d=>{const u=Math.max(0,Math.min(1,Number(d.payload)||0));e(p=>({audioLevels:[u,...p.audioLevels.slice(0,-1)]}))}),await Ue("openspeech://audio-stream-error",d=>{const u=String(d.payload??"");console.warn("[audio] stream-error:",u);const p=t();if(p.state==="preparing"||p.state==="recording"||p.state==="transcribing"){const h=ie.t("overlay:error.stt_mic_not_ready");rl(h),$i(),In(),e({state:"error",activeId:null,errorMessage:h,audioLevels:Qt(),recordingId:null,liveTranscript:""}),Wt("error",ie.t("overlay:toast.recording_start_failed.title"),{description:h})}else In()}),await Ue("openspeech://asr-partial",d=>{e({liveTranscript:String(d.payload??"")})}),await Ue("openspeech://asr-final",d=>{const u=String(d.payload??"");e({liveTranscript:u});const p=mo(),h=t().activeId==="translate";p==="REALTIME"&&!h&&Jf(u)}),await Ue("openspeech://asr-error",d=>{console.warn("[stt] asr-error:",d.payload);const{code:u,message:p}=d.payload??{code:"",message:""};if(vH(u,p)){mo()==="REALTIME"?Wt("warning",ie.t("overlay:toast.realtime_degraded.title"),{description:ie.t("overlay:toast.realtime_degraded.realtime_mode")}):(Fi=!0,Wt("info",ie.t("overlay:toast.realtime_degraded.title"),{description:ie.t("overlay:toast.realtime_degraded.description")}));return}Wt("error",ie.t("overlay:toast.asr_error.title"),{description:u?`${u}: ${p}`:p||ie.t("overlay:toast.asr_error.unknown")})}),await Ue("openspeech://asr-closed",d=>{const{reason:u}=d.payload??{reason:"unknown"};u==="insufficient_credits"?(rl(ie.t("overlay:toast.insufficient_credits.error_message")),$i(),In(),Wt("error",ie.t("overlay:toast.insufficient_credits.title"),{description:ie.t("overlay:toast.insufficient_credits.description")}),e({state:"error",errorMessage:ie.t("overlay:toast.insufficient_credits.error_message"),audioLevels:Qt(),recordingId:null,liveTranscript:""})):u==="worker_dead"?(console.warn("[stt] worker_dead, aborting recording",d.payload),rl(ie.t("overlay:toast.worker_dead.error_message")),$i(),In(),Wt("error",ie.t("overlay:toast.worker_dead.title"),{description:ie.t("overlay:toast.worker_dead.description")}),e({state:"error",errorMessage:ie.t("overlay:toast.worker_dead.error_message"),audioLevels:Qt(),recordingId:null,liveTranscript:""})):u==="max_duration"?(Wt("warning",ie.t("overlay:toast.session_timeout.title"),{description:ie.t("overlay:toast.session_timeout.description")}),console.warn("[stt] session closed by server:",u)):u==="idle_timeout"&&console.warn("[stt] session closed by server:",u)}),await Ue("openspeech://stt-ready",d=>{const u=d.payload?.sessionId??"";_f=!0,u&&(dl=u,console.info(`[stt] session ready, id=${u}`))}),await Ue("openspeech://stt-provider-resolved",d=>{const u=d.payload;(u==="saas-realtime"||u==="saas-file"||u==="tencent-realtime"||u==="tencent-file"||u==="aliyun-realtime"||u==="aliyun-file")&&(ru=u,console.info(`[stt] provider resolved: ${u}`))}),await Ue("openspeech://dictation-fallback",()=>{Wt("warning",ie.t("overlay:toast.dictation_fallback.title"),{description:ie.t("overlay:toast.dictation_fallback.description")})});const c=d=>{if(console.log("[recording] Esc → cancelling",{state:d}),Go){t_(),e({state:"idle",activeId:null,audioLevels:Qt(),recordingId:null,liveTranscript:""});return}d==="preparing"||d==="recording"?Xm():$i(),In(),e({state:"idle",activeId:null,audioLevels:Qt(),recordingId:null,liveTranscript:""})};await Ue("openspeech://key-preview",d=>{if(d.payload.phase!=="pressed"||d.payload.code!=="Escape"||d.payload.isRepeat)return;const u=t().state;if(u==="error"){console.log("[recording] Esc on error → dismiss"),t().dismissError();return}u!=="idle"&&c(u)}),console.log("[recording] listeners attached (hotkey + audio-level + asr-* + stream-error)"),ja("openspeech://overlay-ready")},syncBindings:async r=>{console.log("[recording] syncBindings → invoking apply_hotkey_config",r);try{await B("apply_hotkey_config",{payload:{bindings:r}}),console.log("[recording] syncBindings OK")}catch(i){console.error("[recording] syncBindings FAILED:",i),e({state:"error",errorMessage:ie.t("overlay:error.sync_hotkey_failed",{error:String(i)})})}},dismissError:()=>{e({state:"idle",activeId:null,errorMessage:null,audioLevels:Qt(),recordingId:null,liveTranscript:""})},simulateCancel:()=>{if(Go){t_(),e({state:"idle",activeId:null,audioLevels:Qt(),recordingId:null,liveTranscript:""});return}const r=t();r.state==="preparing"||r.state==="recording"?Xm():$i(),In(),e({state:"idle",activeId:null,audioLevels:Qt(),recordingId:null,liveTranscript:""})},simulateDictationFromAudio:async(r,i)=>{if(!Ct)return;if(t().state!=="idle"){ke.warning("[DEBUG] 当前正在录音/转写,先结束再试");return}if(i>300*1e3){ke.error("[DEBUG] 录音超过 5 分钟,REST ASR 不支持");return}gi(),Fi=!1,_f=!1,dl=`debug-${po()}`,Go=!0;const o=Date.now()+i;B("overlay_show").catch(s=>console.warn("[debug] overlay_show failed:",s)),kf({active:!0,totalMs:i,endAtUnixMs:o}),xH(),e({state:"recording",liveTranscript:"",pillEarlyHide:!1,audioLevels:Qt(),recordingStartedAt:performance.now()});try{await bH(i)}catch{return}if(Dv(),kf({active:!1}),!!Go){e({state:"transcribing",liveTranscript:"",pillEarlyHide:!1});try{let s="";try{const u=os({corePrompt:e0[lr(re.getState().dictation.lang,re.getState().general.interfaceLang)],items:mt.getState().items,targetApp:nr,focusTitle:_a,audioDurationMs:i,expandDomainKeywords:!0,includeUserCorrections:!0});console.info(`[debug] file transcribe system_prompt: len=${u.length} chars`),s=(await Ub({audioPath:r,durationMs:i,lang:i0(),provider:Du(),systemPrompt:u})).text??""}catch(u){console.warn("[debug] transcribe failed:",u);const p=Zf(u);Wt("error",ie.t("overlay:toast.transcribe_failed.title"),{description:co(u),...p?{action:Qf(),durationMs:0}:{}}),e({state:"idle",liveTranscript:""});return}if(!s){Wt("warning",ie.t("overlay:toast.transcribe_failed.title"),{description:ie.t("overlay:toast.transcribe_failed.no_transcript")}),e({state:"idle",liveTranscript:""});return}const l=KO();l||e({state:"injecting",pillEarlyHide:!1});let c=null;if(l){let u="";const p=re.getState().aiRefine,h=re.getState(),y=lr(h.dictation.lang,h.general.interfaceLang),g=r0(Na,p),x=is({lang:y,customRules:g.customRules,customExamples:g.customExamples});let v=null;p.mode==="custom"&&(v=p.customProviders.find(b=>b.id===p.activeCustomProviderId)??null);try{if(p.mode==="custom"&&!v)throw new Error("no_active_custom_provider");const b=t0(nr,Na),w=os({corePrompt:x,items:mt.getState().items,targetApp:nr,focusTitle:_a,audioDurationMs:i,enrichHotwords:!0,appTypeAddon:n0(b,y)});console.info(`[debug-refine] system_prompt: len=${w.length} chars`),c=(await ea({mode:p.mode,systemPrompt:w,userText:s,customBaseUrl:v?.baseUrl,customModel:v?.model,customKeyringId:v?`ai_provider_${v.id}`:void 0,taskId:dl??void 0},k=>{u+=k,t().state==="transcribing"&&e({state:"injecting",pillEarlyHide:!1}),Jf(u)})).refinedText,e({pillEarlyHide:!0});try{await Sl}catch{}if(Sa())try{await zn(c)}catch(k){console.warn("[debug] clipboard write failed:",k)}}catch(b){const w=String(b??"");p.mode==="custom"?(console.warn("[debug] refine custom failed:",b),await ka(b)||Wt("warning",ie.t("overlay:toast.transcribe_failed.title"),{description:co(b)})):Xf(w)?Lv():(console.warn("[debug] refine failed:",b),Wt("warning",ie.t("overlay:toast.transcribe_failed.title"),{description:co(b)}))}t().state==="transcribing"&&e({state:"injecting",pillEarlyHide:!1})}const d=c??s;if(d&&Sa()){try{await Sl}catch{}if(!Sa()){gi(),e({state:"idle",liveTranscript:""});return}if(d.startsWith(tr)){const u=d.slice(tr.length);if(u)try{await B("inject_type",{text:u})}catch(p){console.warn("[debug] tail type failed:",p);try{await zn(u),await B("inject_paste")}catch(h){console.warn("[debug] tail paste fallback failed:",h)}}}else try{await zn(d)}catch{}gi()}e({state:"idle",liveTranscript:""}),ke.success("[DEBUG] 模拟完成",{description:`text=${d.length} chars`})}finally{Go=!1,Dv(),kf({active:!1})}}},debugRefineOnly:async r=>{if(!Ct)throw new Error("not main window");const i=r.trim();if(!i)throw new Error("empty text");const a=re.getState().aiRefine,o=re.getState(),s=lr(o.dictation.lang,o.general.interfaceLang),l=is({lang:s,customRules:a.customRules,customExamples:a.customExamples}),c=Vb(),d=`${new Date().toISOString()} (UTC)`;let u=null;if(a.mode==="custom"&&(u=a.customProviders.find(y=>y.id===a.activeCustomProviderId)??null,!u))throw new Error("no_active_custom_provider");const p=DW(a.selectedDomains);return(await ea({mode:a.mode,systemPrompt:l,userText:i,hotwords:c.length>0?c:void 0,requestTime:d,domains:p.length>0?p:void 0,customBaseUrl:u?.baseUrl,customModel:u?.model,customKeyringId:u?`ai_provider_${u.id}`:void 0,taskId:`debug-refine-${po()}`},()=>{})).refinedText},debugReinject:async r=>{if(!Ct)throw new Error("not main window");const i=r;if(!i)throw new Error("empty text");try{await B("inject_type",{text:i})}catch(a){console.warn("[debug] inject_type failed, fallback paste:",a),await zn(i),await B("inject_paste")}},simulateFinalize:()=>{const r=t();if(r.state!=="recording"&&r.state!=="preparing")return;const i=performance.now()-r.recordingStartedAt;if(i<vd){console.log("[recording] finalize: too short → discard (no save / no transcribe)",{duration:i,threshold:vd}),$i(),In(),e({state:"idle",activeId:null,audioLevels:Qt(),recordingId:null,liveTranscript:""});return}In(),e({state:"transcribing",audioLevels:Qt()}),i_().then(a=>{if(a.silent){e({state:"idle",activeId:null,recordingId:null,liveTranscript:""});return}if(!a.text){e({state:"error",activeId:null,recordingId:null,liveTranscript:"",errorMessage:ie.t("overlay:toast.transcribe_failed.title")});return}window.setTimeout(()=>{t().state==="transcribing"&&e({state:"idle",activeId:null,recordingId:null,liveTranscript:""})},800)})}}}),a_=300*1e3,CH=3e4,Zm=300,jH=6e4,Ht={policyListenerStarted:!1,homeActivated:!1,checkTimer:null,inFlight:!1,pendingAutoInstall:null,autoIdleTimer:null};function o0(){Ht.checkTimer&&(clearTimeout(Ht.checkTimer),Ht.checkTimer=null)}function Sf(){Ht.autoIdleTimer&&(clearInterval(Ht.autoIdleTimer),Ht.autoIdleTimer=null)}function ic(){o0(),Ht.checkTimer=setTimeout(()=>{s0()},a_),Ke(`[updater] next check scheduled in ${(a_/6e4).toFixed(0)} min`)}async function s0(){if(Ht.inFlight){Ke("[updater] tick skipped: another check still in flight");return}const{updatePolicy:e,skippedUpdateVersion:t}=re.getState().general,n=new Date().toISOString();if(e==="DISABLED"){Ke(`[updater] tick=${n} skipped: policy=DISABLED`);return}const r=qe.getState().pendingUpdate?.version??Ht.pendingAutoInstall?.version??null;Ke(`[updater] tick=${n} START policy=${e} skipped=${t||"none"} queued=${r??"none"}`),Ht.inFlight=!0;const i=Date.now();let a=null;try{a=await Promise.race([Rb(),new Promise((s,l)=>setTimeout(()=>l(new Error("updater check timeout")),CH))])}catch(s){const l=Date.now()-i;Jt(`[updater] tick=${n} FAIL after ${l}ms: ${String(s?.message??s)}`),Ht.inFlight=!1,ic();return}Ht.inFlight=!1;const o=Date.now()-i;if(!a){Ke(`[updater] tick=${n} DONE no-update (${o}ms)`),ic();return}if(Ke(`[updater] tick=${n} HIT version=${a.version} current=${a.currentVersion} (${o}ms)`),t&&t===a.version){Ke(`[updater] tick=${n} suppressed: ${a.version} matches skippedUpdateVersion`),ic();return}if(r&&r===a.version){Ke(`[updater] tick=${n} no-op: ${a.version} already queued`),ic();return}e==="AUTO"?(Ke(`[updater] tick=${n} → AUTO queue ${a.version}, will install on next idle window`),Ht.pendingAutoInstall={version:a.version,update:a},PH()):(Ke(`[updater] tick=${n} → PROMPT toast for ${a.version}`),qe.getState().setPendingUpdate({version:a.version,update:a})),ic()}function PH(){Ht.autoIdleTimer||(o_(),Ht.autoIdleTimer=setInterval(()=>{o_()},jH))}async function o_(){const e=Ht.pendingAutoInstall;if(!e){Sf();return}const t=re.getState().general.updatePolicy;if(t!=="AUTO"){Ke(`[updater] auto-install: policy changed to ${t}, hand off ${e.version}`),t==="PROMPT"&&qe.getState().setPendingUpdate({version:e.version,update:e.update}),Ht.pendingAutoInstall=null,Sf();return}const n=Ze.getState().state;if(n!=="idle"){Ke(`[updater] auto-install: waiting (recording state=${n}, version=${e.version})`);return}let r;try{r=await B("system_idle_seconds")}catch(i){Jt(`[updater] auto-install: idle probe failed (${String(i?.message??i)}), skipping tick`);return}if(r<Zm){Ke(`[updater] auto-install: idle ${r}s < threshold ${Zm}s, waiting (version=${e.version})`);return}Ke(`[updater] auto-install FIRING version=${e.version} idleSec=${r} threshold=${Zm}s`),Ht.pendingAutoInstall=null,Sf();try{await NH(e.update,e.version)}catch(i){ll(`[updater] auto-install failed: ${String(i?.message??i)}`),qe.getState().setPendingUpdate({version:e.version,update:e.update}),ke.error(ie.t("settings:about.install_failed"),{description:String(i?.message??i)})}}async function NH(e,t){Ke(`[updater] silentInstall start → ${t}`),await e.downloadAndInstall(void 0,{timeout:300*1e3}),Ke("[updater] silentInstall returned, requesting relaunch"),await B("relaunch_app")}function TH(){if(Ht.policyListenerStarted)return;Ht.policyListenerStarted=!0,Ke("[updater] policy listener attached, awaiting home activation");let e=re.getState().general.updatePolicy;re.subscribe(t=>{const n=t.general.updatePolicy;if(n!==e){if(Ke(`[updater] policy changed ${e} → ${n}`),e=n,n==="DISABLED"){o0(),Sf(),Ht.pendingAutoInstall=null;return}Ht.homeActivated&&s0()}})}function OH(){Ht.homeActivated=!0,Ke("[updater] home activated → running immediate check"),o0(),s0()}function GO(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=GO(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function bt(){for(var e,t,n=0,r="",i=arguments.length;n<i;n++)(e=arguments[n])&&(t=GO(e))&&(r&&(r+=" "),r+=t);return r}const AH=(e,t)=>{const n=new Array(e.length+t.length);for(let r=0;r<e.length;r++)n[r]=e[r];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},RH=(e,t)=>({classGroupId:e,validator:t}),YO=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),ep="-",s_=[],MH="arbitrary..",IH=e=>{const t=LH(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:o=>{if(o.startsWith("[")&&o.endsWith("]"))return DH(o);const s=o.split(ep),l=s[0]===""&&s.length>1?1:0;return XO(s,l,t)},getConflictingClassGroupIds:(o,s)=>{if(s){const l=r[o],c=n[o];return l?c?AH(c,l):l:c||s_}return n[o]||s_}}},XO=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const i=e[t],a=n.nextPart.get(i);if(a){const c=XO(e,t+1,a);if(c)return c}const o=n.validators;if(o===null)return;const s=t===0?e.join(ep):e.slice(t).join(ep),l=o.length;for(let c=0;c<l;c++){const d=o[c];if(d.validator(s))return d.classGroupId}},DH=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),r=t.slice(0,n);return r?MH+r:void 0})(),LH=e=>{const{theme:t,classGroups:n}=e;return $H(n,t)},$H=(e,t)=>{const n=YO();for(const r in e){const i=e[r];l0(i,n,r,t)}return n},l0=(e,t,n,r)=>{const i=e.length;for(let a=0;a<i;a++){const o=e[a];zH(o,t,n,r)}},zH=(e,t,n,r)=>{if(typeof e=="string"){FH(e,t,n);return}if(typeof e=="function"){BH(e,t,n,r);return}WH(e,t,n,r)},FH=(e,t,n)=>{const r=e===""?t:ZO(t,e);r.classGroupId=n},BH=(e,t,n,r)=>{if(HH(e)){l0(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(RH(n,e))},WH=(e,t,n,r)=>{const i=Object.entries(e),a=i.length;for(let o=0;o<a;o++){const[s,l]=i[o];l0(l,ZO(t,s),n,r)}},ZO=(e,t)=>{let n=e;const r=t.split(ep),i=r.length;for(let a=0;a<i;a++){const o=r[a];let s=n.nextPart.get(o);s||(s=YO(),n.nextPart.set(o,s)),n=s}return n},HH=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,UH=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null);const i=(a,o)=>{n[a]=o,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(a){let o=n[a];if(o!==void 0)return o;if((o=r[a])!==void 0)return i(a,o),o},set(a,o){a in n?n[a]=o:i(a,o)}}},$v="!",l_=":",VH=[],c_=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),qH=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=i=>{const a=[];let o=0,s=0,l=0,c;const d=i.length;for(let g=0;g<d;g++){const x=i[g];if(o===0&&s===0){if(x===l_){a.push(i.slice(l,g)),l=g+1;continue}if(x==="/"){c=g;continue}}x==="["?o++:x==="]"?o--:x==="("?s++:x===")"&&s--}const u=a.length===0?i:i.slice(l);let p=u,h=!1;u.endsWith($v)?(p=u.slice(0,-1),h=!0):u.startsWith($v)&&(p=u.slice(1),h=!0);const y=c&&c>l?c-l:void 0;return c_(a,h,p,y)};if(t){const i=t+l_,a=r;r=o=>o.startsWith(i)?a(o.slice(i.length)):c_(VH,!1,o,void 0,!0)}if(n){const i=r;r=a=>n({className:a,parseClassName:i})}return r},KH=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,r)=>{t.set(n,1e6+r)}),n=>{const r=[];let i=[];for(let a=0;a<n.length;a++){const o=n[a],s=o[0]==="[",l=t.has(o);s||l?(i.length>0&&(i.sort(),r.push(...i),i=[]),r.push(o)):i.push(o)}return i.length>0&&(i.sort(),r.push(...i)),r}},GH=e=>({cache:UH(e.cacheSize),parseClassName:qH(e),sortModifiers:KH(e),postfixLookupClassGroupIds:YH(e),...IH(e)}),YH=e=>{const t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let r=0;r<n.length;r++)t[n[r]]=!0;return t},XH=/\s+/,ZH=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a,postfixLookupClassGroupIds:o}=t,s=[],l=e.trim().split(XH);let c="";for(let d=l.length-1;d>=0;d-=1){const u=l[d],{isExternal:p,modifiers:h,hasImportantModifier:y,baseClassName:g,maybePostfixModifierPosition:x}=n(u);if(p){c=u+(c.length>0?" "+c:c);continue}let v=!!x,b;if(v){const E=g.substring(0,x);b=r(E);const C=b&&o[b]?r(g):void 0;C&&C!==b&&(b=C,v=!1)}else b=r(g);if(!b){if(!v){c=u+(c.length>0?" "+c:c);continue}if(b=r(g),!b){c=u+(c.length>0?" "+c:c);continue}v=!1}const w=h.length===0?"":h.length===1?h[0]:a(h).join(":"),_=y?w+$v:w,k=_+b;if(s.indexOf(k)>-1)continue;s.push(k);const S=i(b,v);for(let E=0;E<S.length;++E){const C=S[E];s.push(_+C)}c=u+(c.length>0?" "+c:c)}return c},QH=(...e)=>{let t=0,n,r,i="";for(;t<e.length;)(n=e[t++])&&(r=QO(n))&&(i&&(i+=" "),i+=r);return i},QO=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=QO(e[r]))&&(n&&(n+=" "),n+=t);return n},JH=(e,...t)=>{let n,r,i,a;const o=l=>{const c=t.reduce((d,u)=>u(d),e());return n=GH(c),r=n.cache.get,i=n.cache.set,a=s,s(l)},s=l=>{const c=r(l);if(c)return c;const d=ZH(l,n);return i(l,d),d};return a=o,(...l)=>a(QH(...l))},e8=[],mn=e=>{const t=n=>n[e]||e8;return t.isThemeGetter=!0,t},JO=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,eA=/^\((?:(\w[\w-]*):)?(.+)\)$/i,t8=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,n8=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,r8=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,i8=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,a8=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,o8=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ga=e=>t8.test(e),it=e=>!!e&&!Number.isNaN(Number(e)),Ri=e=>!!e&&Number.isInteger(Number(e)),Qm=e=>e.endsWith("%")&&it(e.slice(0,-1)),ha=e=>n8.test(e),tA=()=>!0,s8=e=>r8.test(e)&&!i8.test(e),c0=()=>!1,l8=e=>a8.test(e),c8=e=>o8.test(e),u8=e=>!Pe(e)&&!Te(e),d8=e=>e.startsWith("@container")&&(e[10]==="/"&&e[11]!==void 0||e[11]==="s"&&e[16]!==void 0&&e.startsWith("-size/",10)||e[11]==="n"&&e[18]!==void 0&&e.startsWith("-normal/",10)),f8=e=>Eo(e,iA,c0),Pe=e=>JO.test(e),$o=e=>Eo(e,aA,s8),u_=e=>Eo(e,b8,it),p8=e=>Eo(e,sA,tA),h8=e=>Eo(e,oA,c0),d_=e=>Eo(e,nA,c0),m8=e=>Eo(e,rA,c8),wd=e=>Eo(e,lA,l8),Te=e=>eA.test(e),ac=e=>Ss(e,aA),g8=e=>Ss(e,oA),f_=e=>Ss(e,nA),y8=e=>Ss(e,iA),v8=e=>Ss(e,rA),kd=e=>Ss(e,lA,!0),x8=e=>Ss(e,sA,!0),Eo=(e,t,n)=>{const r=JO.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},Ss=(e,t,n=!1)=>{const r=eA.exec(e);return r?r[1]?t(r[1]):n:!1},nA=e=>e==="position"||e==="percentage",rA=e=>e==="image"||e==="url",iA=e=>e==="length"||e==="size"||e==="bg-size",aA=e=>e==="length",b8=e=>e==="number",oA=e=>e==="family-name",sA=e=>e==="number"||e==="weight",lA=e=>e==="shadow",w8=()=>{const e=mn("color"),t=mn("font"),n=mn("text"),r=mn("font-weight"),i=mn("tracking"),a=mn("leading"),o=mn("breakpoint"),s=mn("container"),l=mn("spacing"),c=mn("radius"),d=mn("shadow"),u=mn("inset-shadow"),p=mn("text-shadow"),h=mn("drop-shadow"),y=mn("blur"),g=mn("perspective"),x=mn("aspect"),v=mn("ease"),b=mn("animate"),w=()=>["auto","avoid","all","avoid-page","page","left","right","column"],_=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],k=()=>[..._(),Te,Pe],S=()=>["auto","hidden","clip","visible","scroll"],E=()=>["auto","contain","none"],C=()=>[Te,Pe,l],j=()=>[Ga,"full","auto",...C()],T=()=>[Ri,"none","subgrid",Te,Pe],A=()=>["auto",{span:["full",Ri,Te,Pe]},Ri,Te,Pe],R=()=>[Ri,"auto",Te,Pe],D=()=>["auto","min","max","fr",Te,Pe],M=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],O=()=>["start","end","center","stretch","center-safe","end-safe"],I=()=>["auto",...C()],L=()=>[Ga,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...C()],V=()=>[Ga,"screen","full","dvw","lvw","svw","min","max","fit",...C()],F=()=>[Ga,"screen","full","lh","dvh","lvh","svh","min","max","fit",...C()],N=()=>[e,Te,Pe],ee=()=>[..._(),f_,d_,{position:[Te,Pe]}],Q=()=>["no-repeat",{repeat:["","x","y","space","round"]}],P=()=>["auto","cover","contain",y8,f8,{size:[Te,Pe]}],z=()=>[Qm,ac,$o],$=()=>["","none","full",c,Te,Pe],H=()=>["",it,ac,$o],oe=()=>["solid","dashed","dotted","double"],q=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],X=()=>[it,Qm,f_,d_],te=()=>["","none",y,Te,Pe],ue=()=>["none",it,Te,Pe],G=()=>["none",it,Te,Pe],be=()=>[it,Te,Pe],xe=()=>[Ga,"full",...C()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[ha],breakpoint:[ha],color:[tA],container:[ha],"drop-shadow":[ha],ease:["in","out","in-out"],font:[u8],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[ha],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[ha],shadow:[ha],spacing:["px",it],text:[ha],"text-shadow":[ha],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Ga,Pe,Te,x]}],container:["container"],"container-type":[{"@container":["","normal","size",Te,Pe]}],"container-named":[d8],columns:[{columns:[it,Pe,Te,s]}],"break-after":[{"break-after":w()}],"break-before":[{"break-before":w()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:k()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:E()}],"overscroll-x":[{"overscroll-x":E()}],"overscroll-y":[{"overscroll-y":E()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:j()}],"inset-x":[{"inset-x":j()}],"inset-y":[{"inset-y":j()}],start:[{"inset-s":j(),start:j()}],end:[{"inset-e":j(),end:j()}],"inset-bs":[{"inset-bs":j()}],"inset-be":[{"inset-be":j()}],top:[{top:j()}],right:[{right:j()}],bottom:[{bottom:j()}],left:[{left:j()}],visibility:["visible","invisible","collapse"],z:[{z:[Ri,"auto",Te,Pe]}],basis:[{basis:[Ga,"full","auto",s,...C()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[it,Ga,"auto","initial","none",Pe]}],grow:[{grow:["",it,Te,Pe]}],shrink:[{shrink:["",it,Te,Pe]}],order:[{order:[Ri,"first","last","none",Te,Pe]}],"grid-cols":[{"grid-cols":T()}],"col-start-end":[{col:A()}],"col-start":[{"col-start":R()}],"col-end":[{"col-end":R()}],"grid-rows":[{"grid-rows":T()}],"row-start-end":[{row:A()}],"row-start":[{"row-start":R()}],"row-end":[{"row-end":R()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":D()}],"auto-rows":[{"auto-rows":D()}],gap:[{gap:C()}],"gap-x":[{"gap-x":C()}],"gap-y":[{"gap-y":C()}],"justify-content":[{justify:[...M(),"normal"]}],"justify-items":[{"justify-items":[...O(),"normal"]}],"justify-self":[{"justify-self":["auto",...O()]}],"align-content":[{content:["normal",...M()]}],"align-items":[{items:[...O(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...O(),{baseline:["","last"]}]}],"place-content":[{"place-content":M()}],"place-items":[{"place-items":[...O(),"baseline"]}],"place-self":[{"place-self":["auto",...O()]}],p:[{p:C()}],px:[{px:C()}],py:[{py:C()}],ps:[{ps:C()}],pe:[{pe:C()}],pbs:[{pbs:C()}],pbe:[{pbe:C()}],pt:[{pt:C()}],pr:[{pr:C()}],pb:[{pb:C()}],pl:[{pl:C()}],m:[{m:I()}],mx:[{mx:I()}],my:[{my:I()}],ms:[{ms:I()}],me:[{me:I()}],mbs:[{mbs:I()}],mbe:[{mbe:I()}],mt:[{mt:I()}],mr:[{mr:I()}],mb:[{mb:I()}],ml:[{ml:I()}],"space-x":[{"space-x":C()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":C()}],"space-y-reverse":["space-y-reverse"],size:[{size:L()}],"inline-size":[{inline:["auto",...V()]}],"min-inline-size":[{"min-inline":["auto",...V()]}],"max-inline-size":[{"max-inline":["none",...V()]}],"block-size":[{block:["auto",...F()]}],"min-block-size":[{"min-block":["auto",...F()]}],"max-block-size":[{"max-block":["none",...F()]}],w:[{w:[s,"screen",...L()]}],"min-w":[{"min-w":[s,"screen","none",...L()]}],"max-w":[{"max-w":[s,"screen","none","prose",{screen:[o]},...L()]}],h:[{h:["screen","lh",...L()]}],"min-h":[{"min-h":["screen","lh","none",...L()]}],"max-h":[{"max-h":["screen","lh",...L()]}],"font-size":[{text:["base",n,ac,$o]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,x8,p8]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Qm,Pe]}],"font-family":[{font:[g8,h8,t]}],"font-features":[{"font-features":[Pe]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[i,Te,Pe]}],"line-clamp":[{"line-clamp":[it,"none",Te,u_]}],leading:[{leading:[a,...C()]}],"list-image":[{"list-image":["none",Te,Pe]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Te,Pe]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:N()}],"text-color":[{text:N()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...oe(),"wavy"]}],"text-decoration-thickness":[{decoration:[it,"from-font","auto",Te,$o]}],"text-decoration-color":[{decoration:N()}],"underline-offset":[{"underline-offset":[it,"auto",Te,Pe]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:C()}],"tab-size":[{tab:[Ri,Te,Pe]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Te,Pe]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Te,Pe]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:ee()}],"bg-repeat":[{bg:Q()}],"bg-size":[{bg:P()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Ri,Te,Pe],radial:["",Te,Pe],conic:[Ri,Te,Pe]},v8,m8]}],"bg-color":[{bg:N()}],"gradient-from-pos":[{from:z()}],"gradient-via-pos":[{via:z()}],"gradient-to-pos":[{to:z()}],"gradient-from":[{from:N()}],"gradient-via":[{via:N()}],"gradient-to":[{to:N()}],rounded:[{rounded:$()}],"rounded-s":[{"rounded-s":$()}],"rounded-e":[{"rounded-e":$()}],"rounded-t":[{"rounded-t":$()}],"rounded-r":[{"rounded-r":$()}],"rounded-b":[{"rounded-b":$()}],"rounded-l":[{"rounded-l":$()}],"rounded-ss":[{"rounded-ss":$()}],"rounded-se":[{"rounded-se":$()}],"rounded-ee":[{"rounded-ee":$()}],"rounded-es":[{"rounded-es":$()}],"rounded-tl":[{"rounded-tl":$()}],"rounded-tr":[{"rounded-tr":$()}],"rounded-br":[{"rounded-br":$()}],"rounded-bl":[{"rounded-bl":$()}],"border-w":[{border:H()}],"border-w-x":[{"border-x":H()}],"border-w-y":[{"border-y":H()}],"border-w-s":[{"border-s":H()}],"border-w-e":[{"border-e":H()}],"border-w-bs":[{"border-bs":H()}],"border-w-be":[{"border-be":H()}],"border-w-t":[{"border-t":H()}],"border-w-r":[{"border-r":H()}],"border-w-b":[{"border-b":H()}],"border-w-l":[{"border-l":H()}],"divide-x":[{"divide-x":H()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":H()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...oe(),"hidden","none"]}],"divide-style":[{divide:[...oe(),"hidden","none"]}],"border-color":[{border:N()}],"border-color-x":[{"border-x":N()}],"border-color-y":[{"border-y":N()}],"border-color-s":[{"border-s":N()}],"border-color-e":[{"border-e":N()}],"border-color-bs":[{"border-bs":N()}],"border-color-be":[{"border-be":N()}],"border-color-t":[{"border-t":N()}],"border-color-r":[{"border-r":N()}],"border-color-b":[{"border-b":N()}],"border-color-l":[{"border-l":N()}],"divide-color":[{divide:N()}],"outline-style":[{outline:[...oe(),"none","hidden"]}],"outline-offset":[{"outline-offset":[it,Te,Pe]}],"outline-w":[{outline:["",it,ac,$o]}],"outline-color":[{outline:N()}],shadow:[{shadow:["","none",d,kd,wd]}],"shadow-color":[{shadow:N()}],"inset-shadow":[{"inset-shadow":["none",u,kd,wd]}],"inset-shadow-color":[{"inset-shadow":N()}],"ring-w":[{ring:H()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:N()}],"ring-offset-w":[{"ring-offset":[it,$o]}],"ring-offset-color":[{"ring-offset":N()}],"inset-ring-w":[{"inset-ring":H()}],"inset-ring-color":[{"inset-ring":N()}],"text-shadow":[{"text-shadow":["none",p,kd,wd]}],"text-shadow-color":[{"text-shadow":N()}],opacity:[{opacity:[it,Te,Pe]}],"mix-blend":[{"mix-blend":[...q(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":q()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[it]}],"mask-image-linear-from-pos":[{"mask-linear-from":X()}],"mask-image-linear-to-pos":[{"mask-linear-to":X()}],"mask-image-linear-from-color":[{"mask-linear-from":N()}],"mask-image-linear-to-color":[{"mask-linear-to":N()}],"mask-image-t-from-pos":[{"mask-t-from":X()}],"mask-image-t-to-pos":[{"mask-t-to":X()}],"mask-image-t-from-color":[{"mask-t-from":N()}],"mask-image-t-to-color":[{"mask-t-to":N()}],"mask-image-r-from-pos":[{"mask-r-from":X()}],"mask-image-r-to-pos":[{"mask-r-to":X()}],"mask-image-r-from-color":[{"mask-r-from":N()}],"mask-image-r-to-color":[{"mask-r-to":N()}],"mask-image-b-from-pos":[{"mask-b-from":X()}],"mask-image-b-to-pos":[{"mask-b-to":X()}],"mask-image-b-from-color":[{"mask-b-from":N()}],"mask-image-b-to-color":[{"mask-b-to":N()}],"mask-image-l-from-pos":[{"mask-l-from":X()}],"mask-image-l-to-pos":[{"mask-l-to":X()}],"mask-image-l-from-color":[{"mask-l-from":N()}],"mask-image-l-to-color":[{"mask-l-to":N()}],"mask-image-x-from-pos":[{"mask-x-from":X()}],"mask-image-x-to-pos":[{"mask-x-to":X()}],"mask-image-x-from-color":[{"mask-x-from":N()}],"mask-image-x-to-color":[{"mask-x-to":N()}],"mask-image-y-from-pos":[{"mask-y-from":X()}],"mask-image-y-to-pos":[{"mask-y-to":X()}],"mask-image-y-from-color":[{"mask-y-from":N()}],"mask-image-y-to-color":[{"mask-y-to":N()}],"mask-image-radial":[{"mask-radial":[Te,Pe]}],"mask-image-radial-from-pos":[{"mask-radial-from":X()}],"mask-image-radial-to-pos":[{"mask-radial-to":X()}],"mask-image-radial-from-color":[{"mask-radial-from":N()}],"mask-image-radial-to-color":[{"mask-radial-to":N()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":_()}],"mask-image-conic-pos":[{"mask-conic":[it]}],"mask-image-conic-from-pos":[{"mask-conic-from":X()}],"mask-image-conic-to-pos":[{"mask-conic-to":X()}],"mask-image-conic-from-color":[{"mask-conic-from":N()}],"mask-image-conic-to-color":[{"mask-conic-to":N()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:ee()}],"mask-repeat":[{mask:Q()}],"mask-size":[{mask:P()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Te,Pe]}],filter:[{filter:["","none",Te,Pe]}],blur:[{blur:te()}],brightness:[{brightness:[it,Te,Pe]}],contrast:[{contrast:[it,Te,Pe]}],"drop-shadow":[{"drop-shadow":["","none",h,kd,wd]}],"drop-shadow-color":[{"drop-shadow":N()}],grayscale:[{grayscale:["",it,Te,Pe]}],"hue-rotate":[{"hue-rotate":[it,Te,Pe]}],invert:[{invert:["",it,Te,Pe]}],saturate:[{saturate:[it,Te,Pe]}],sepia:[{sepia:["",it,Te,Pe]}],"backdrop-filter":[{"backdrop-filter":["","none",Te,Pe]}],"backdrop-blur":[{"backdrop-blur":te()}],"backdrop-brightness":[{"backdrop-brightness":[it,Te,Pe]}],"backdrop-contrast":[{"backdrop-contrast":[it,Te,Pe]}],"backdrop-grayscale":[{"backdrop-grayscale":["",it,Te,Pe]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[it,Te,Pe]}],"backdrop-invert":[{"backdrop-invert":["",it,Te,Pe]}],"backdrop-opacity":[{"backdrop-opacity":[it,Te,Pe]}],"backdrop-saturate":[{"backdrop-saturate":[it,Te,Pe]}],"backdrop-sepia":[{"backdrop-sepia":["",it,Te,Pe]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":C()}],"border-spacing-x":[{"border-spacing-x":C()}],"border-spacing-y":[{"border-spacing-y":C()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Te,Pe]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[it,"initial",Te,Pe]}],ease:[{ease:["linear","initial",v,Te,Pe]}],delay:[{delay:[it,Te,Pe]}],animate:[{animate:["none",b,Te,Pe]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[g,Te,Pe]}],"perspective-origin":[{"perspective-origin":k()}],rotate:[{rotate:ue()}],"rotate-x":[{"rotate-x":ue()}],"rotate-y":[{"rotate-y":ue()}],"rotate-z":[{"rotate-z":ue()}],scale:[{scale:G()}],"scale-x":[{"scale-x":G()}],"scale-y":[{"scale-y":G()}],"scale-z":[{"scale-z":G()}],"scale-3d":["scale-3d"],skew:[{skew:be()}],"skew-x":[{"skew-x":be()}],"skew-y":[{"skew-y":be()}],transform:[{transform:[Te,Pe,"","none","gpu","cpu"]}],"transform-origin":[{origin:k()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:xe()}],"translate-x":[{"translate-x":xe()}],"translate-y":[{"translate-y":xe()}],"translate-z":[{"translate-z":xe()}],"translate-none":["translate-none"],zoom:[{zoom:[Ri,Te,Pe]}],accent:[{accent:N()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:N()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Te,Pe]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":N()}],"scrollbar-track-color":[{"scrollbar-track":N()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":C()}],"scroll-mx":[{"scroll-mx":C()}],"scroll-my":[{"scroll-my":C()}],"scroll-ms":[{"scroll-ms":C()}],"scroll-me":[{"scroll-me":C()}],"scroll-mbs":[{"scroll-mbs":C()}],"scroll-mbe":[{"scroll-mbe":C()}],"scroll-mt":[{"scroll-mt":C()}],"scroll-mr":[{"scroll-mr":C()}],"scroll-mb":[{"scroll-mb":C()}],"scroll-ml":[{"scroll-ml":C()}],"scroll-p":[{"scroll-p":C()}],"scroll-px":[{"scroll-px":C()}],"scroll-py":[{"scroll-py":C()}],"scroll-ps":[{"scroll-ps":C()}],"scroll-pe":[{"scroll-pe":C()}],"scroll-pbs":[{"scroll-pbs":C()}],"scroll-pbe":[{"scroll-pbe":C()}],"scroll-pt":[{"scroll-pt":C()}],"scroll-pr":[{"scroll-pr":C()}],"scroll-pb":[{"scroll-pb":C()}],"scroll-pl":[{"scroll-pl":C()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Te,Pe]}],fill:[{fill:["none",...N()]}],"stroke-w":[{stroke:[it,ac,$o,u_]}],stroke:[{stroke:["none",...N()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},k8=JH(w8);function ae(...e){return k8(bt(e))}function p_({version:e,onInstall:t,onSkip:n,duration:r}){const i=ie.t("pages:layout.tray.update_found_title"),a=ie.t("settings:about.install_now"),o=ie.t("settings:about.skip_version");return ke.custom(s=>f.jsxs("div",{className:"flex w-[340px] flex-col gap-3 border border-te-gray bg-te-bg p-4 font-mono text-xs text-te-fg shadow-2xl",children:[f.jsxs("div",{className:"flex flex-col gap-1",children:[f.jsx("span",{className:"text-[11px] font-bold uppercase tracking-[0.15em] text-te-fg",children:i}),f.jsx("span",{className:"text-te-light-gray",children:e})]}),f.jsxs("div",{className:"flex items-stretch justify-end gap-2",children:[n?f.jsx("button",{type:"button",onClick:()=>{ke.dismiss(s),n()},className:ae("border border-te-gray px-3 py-1.5 font-mono text-[11px] uppercase tracking-[0.15em] text-te-light-gray transition-colors","hover:bg-te-surface-hover hover:text-te-fg"),children:o}):null,f.jsx("button",{type:"button",onClick:()=>{ke.dismiss(s),t()},className:ae("border border-te-accent bg-te-accent px-3 py-1.5 font-mono text-[11px] uppercase tracking-[0.15em] text-te-accent-fg transition-colors","hover:bg-te-accent/90"),children:a})]})]}),{duration:r??1/0,unstyled:!0})}function _8(e,t){return function(r,...i){const a=new URL(e);return a.searchParams.set("code",r.toString()),i.forEach(o=>a.searchParams.append("args[]",o)),`${t} error #${r}; visit ${a} for the full message.`}}const fa=_8("https://base-ui.com/production-error","Base UI"),cA=m.createContext(void 0);function Co(e){const t=m.useContext(cA);if(e===!1&&t===void 0)throw new Error(fa(27));return t}const h_={};function cr(e,t){const n=m.useRef(h_);return n.current===h_&&(n.current=e(t)),n}function El(e,t,n,r){const i=cr(uA).current;return E8(i,e,t,n,r)&&dA(i,[e,t,n,r]),i.callback}function S8(e){const t=cr(uA).current;return C8(t,e)&&dA(t,e),t.callback}function uA(){return{callback:null,cleanup:null,refs:[]}}function E8(e,t,n,r,i){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==r||e.refs[3]!==i}function C8(e,t){return e.refs.length!==t.length||e.refs.some((n,r)=>n!==t[r])}function dA(e,t){if(e.refs=t,t.every(n=>n==null)){e.callback=null;return}e.callback=n=>{if(e.cleanup&&(e.cleanup(),e.cleanup=null),n!=null){const r=Array(t.length).fill(null);for(let i=0;i<t.length;i+=1){const a=t[i];if(a!=null)switch(typeof a){case"function":{const o=a(n);typeof o=="function"&&(r[i]=o);break}case"object":{a.current=n;break}}}e.cleanup=()=>{for(let i=0;i<t.length;i+=1){const a=t[i];if(a!=null)switch(typeof a){case"function":{const o=r[i];typeof o=="function"?o():a(null);break}case"object":{a.current=null;break}}}}}}}const j8=parseInt(m.version,10);function u0(e){return j8>=e}function m_(e){if(!m.isValidElement(e))return null;const t=e,n=t.props;return(u0(19)?n?.ref:t.ref)??null}function zv(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}function d0(){}const Fv=Object.freeze([]),Bn=Object.freeze({});function P8(e,t){const n={};for(const r in e){const i=e[r];if(t?.hasOwnProperty(r)){const a=t[r](i);a!=null&&Object.assign(n,a);continue}i===!0?n[`data-${r.toLowerCase()}`]="":i&&(n[`data-${r.toLowerCase()}`]=i.toString())}return n}function N8(e,t){return typeof e=="function"?e(t):e}function T8(e,t){return typeof e=="function"?e(t):e}const f0={};function Cl(e,t,n,r,i){if(!n&&!r&&!e)return tp(t);let a=tp(e);return t&&(a=Ef(a,t)),n&&(a=Ef(a,n)),r&&(a=Ef(a,r)),a}function O8(e){if(e.length===0)return f0;if(e.length===1)return tp(e[0]);let t=tp(e[0]);for(let n=1;n<e.length;n+=1)t=Ef(t,e[n]);return t}function tp(e){return p0(e)?{...pA(e,f0)}:A8(e)}function Ef(e,t){return p0(t)?pA(t,e):R8(e,t)}function A8(e){const t={...e};for(const n in t){const r=t[n];fA(n,r)&&(t[n]=hA(r))}return t}function R8(e,t){if(!t)return e;for(const n in t){const r=t[n];switch(n){case"style":{e[n]=zv(e.style,r);break}case"className":{e[n]=mA(e.className,r);break}default:fA(n,r)?e[n]=M8(e[n],r):e[n]=r}}return e}function fA(e,t){const n=e.charCodeAt(0),r=e.charCodeAt(1),i=e.charCodeAt(2);return n===111&&r===110&&i>=65&&i<=90&&(typeof t=="function"||typeof t>"u")}function p0(e){return typeof e=="function"}function pA(e,t){return p0(e)?e(t):e??f0}function M8(e,t){return t?e?(...n)=>{const r=n[0];if(gA(r)){const a=r;np(a);const o=t(...n);return a.baseUIHandlerPrevented||e?.(...n),o}const i=t(...n);return e?.(...n),i}:hA(t):e}function hA(e){return e&&((...t)=>{const n=t[0];return gA(n)&&np(n),e(...t)})}function np(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function mA(e,t){return t?e?t+" "+e:t:e}function gA(e){return e!=null&&typeof e=="object"&&"nativeEvent"in e}function Ur(e,t,n={}){const r=t.render,i=I8(t,n);if(n.enabled===!1)return null;const a=n.state??Bn;return $8(e,r,i,a)}function I8(e,t={}){const{className:n,style:r,render:i}=e,{state:a=Bn,ref:o,props:s,stateAttributesMapping:l,enabled:c=!0}=t,d=c?N8(n,a):void 0,u=c?T8(r,a):void 0,p=c?P8(a,l):Bn,h=c&&s?D8(s):void 0,y=c?zv(p,h)??{}:Bn;return typeof document<"u"&&(c?Array.isArray(o)?y.ref=S8([y.ref,m_(i),...o]):y.ref=El(y.ref,m_(i),o):El(null,null)),c?(d!==void 0&&(y.className=mA(y.className,d)),u!==void 0&&(y.style=zv(y.style,u)),y):Bn}function D8(e){return Array.isArray(e)?O8(e):Cl(void 0,e)}const L8=Symbol.for("react.lazy");function $8(e,t,n,r){if(t){if(typeof t=="function")return t(n,r);const i=Cl(n,t.props);i.ref=n.ref;let a=t;return a?.$$typeof===L8&&(a=m.Children.toArray(t)[0]),m.cloneElement(a,i)}if(e&&typeof e=="string")return z8(e,n);throw new Error(fa(8))}function z8(e,t){return e==="button"?m.createElement("button",{type:"button",...t,key:t.key}):e==="img"?m.createElement("img",{alt:"",...t,key:t.key}):m.createElement(e,t)}let iu=(function(e){return e.startingStyle="data-starting-style",e.endingStyle="data-ending-style",e})({});const F8={[iu.startingStyle]:""},B8={[iu.endingStyle]:""},bh={transitionStatus(e){return e==="starting"?F8:e==="ending"?B8:null}};let wi=(function(e){return e.open="data-open",e.closed="data-closed",e[e.startingStyle=iu.startingStyle]="startingStyle",e[e.endingStyle=iu.endingStyle]="endingStyle",e.anchorHidden="data-anchor-hidden",e.side="data-side",e.align="data-align",e})({}),g_=(function(e){return e.popupOpen="data-popup-open",e.pressed="data-pressed",e})({});const W8={[g_.popupOpen]:"",[g_.pressed]:""},H8={[wi.open]:""},U8={[wi.closed]:""},V8={[wi.anchorHidden]:""},y_={open(e){return e?W8:null}},Lu={open(e){return e?H8:U8},anchorHidden(e){return e?V8:null}},q8={...Lu,...bh},K8=m.forwardRef(function(t,n){const{render:r,className:i,style:a,forceRender:o=!1,...s}=t,{store:l}=Co(),c=l.useState("open"),d=l.useState("nested"),u=l.useState("mounted"),p=l.useState("transitionStatus");return Ur("div",t,{state:{open:c,transitionStatus:p},ref:[l.context.backdropRef,n],stateAttributesMapping:q8,props:[{role:"presentation",hidden:!u,style:{userSelect:"none",WebkitUserSelect:"none"}},s],enabled:o||!d})});function wh(){return typeof window<"u"}function Xn(e){return h0(e)?(e.nodeName||"").toLowerCase():"#document"}function an(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function pa(e){var t;return(t=(h0(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function h0(e){return wh()?e instanceof Node||e instanceof an(e).Node:!1}function st(e){return wh()?e instanceof Element||e instanceof an(e).Element:!1}function Rt(e){return wh()?e instanceof HTMLElement||e instanceof an(e).HTMLElement:!1}function jl(e){return!wh()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof an(e).ShadowRoot}function jo(e){const{overflow:t,overflowX:n,overflowY:r,display:i}=Pr(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!=="inline"&&i!=="contents"}function G8(e){return/^(table|td|th)$/.test(Xn(e))}function kh(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const Y8=/transform|translate|scale|rotate|perspective|filter/,X8=/paint|layout|strict|content/,zo=e=>!!e&&e!=="none";let Jm;function m0(e){const t=st(e)?Pr(e):e;return zo(t.transform)||zo(t.translate)||zo(t.scale)||zo(t.rotate)||zo(t.perspective)||!_h()&&(zo(t.backdropFilter)||zo(t.filter))||Y8.test(t.willChange||"")||X8.test(t.contain||"")}function Z8(e){let t=ta(e);for(;Rt(t)&&!Ki(t);){if(m0(t))return t;if(kh(t))return null;t=ta(t)}return null}function _h(){return Jm==null&&(Jm=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Jm}function Ki(e){return/^(html|body|#document)$/.test(Xn(e))}function Pr(e){return an(e).getComputedStyle(e)}function Sh(e){return st(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ta(e){if(Xn(e)==="html")return e;const t=e.assignedSlot||e.parentNode||jl(e)&&e.host||pa(e);return jl(t)?t.host:t}function yA(e){const t=ta(e);return Ki(t)?e.ownerDocument?e.ownerDocument.body:e.body:Rt(t)&&jo(t)?t:yA(t)}function au(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=yA(e),a=i===((r=e.ownerDocument)==null?void 0:r.body),o=an(i);if(a){const s=Bv(o);return t.concat(o,o.visualViewport||[],jo(i)?i:[],s&&n?au(s):[])}else return t.concat(i,au(i,[],n))}function Bv(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}const eg=dh[`useInsertionEffect${Math.random().toFixed(1)}`.slice(0,-3)],Q8=eg&&eg!==m.useLayoutEffect?eg:e=>e();function et(e){const t=cr(J8).current;return t.next=e,Q8(t.effect),t.trampoline}function J8(){const e={next:void 0,callback:eU,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function eU(){}const tU={...dh},nU=()=>{},Ge=typeof document<"u"?m.useLayoutEffect:nU,rU=m.createContext(void 0);function g0(e=!1){const t=m.useContext(rU);if(t===void 0&&!e)throw new Error(fa(16));return t}function iU(e){const{focusableWhenDisabled:t,disabled:n,composite:r=!1,tabIndex:i=0,isNativeButton:a}=e,o=r&&t!==!1,s=r&&t===!1;return{props:m.useMemo(()=>{const c={onKeyDown(d){n&&t&&d.key!=="Tab"&&d.preventDefault()}};return r||(c.tabIndex=i,!a&&n&&(c.tabIndex=t?i:-1)),(a&&(t||o)||!a&&n)&&(c["aria-disabled"]=n),a&&(!t||s)&&(c.disabled=n),c},[r,n,t,o,s,a,i])}}function Eh(e={}){const{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:i=!0,composite:a}=e,o=m.useRef(null),s=g0(!0),l=a??s!==void 0,{props:c}=iU({focusableWhenDisabled:n,disabled:t,composite:l,tabIndex:r,isNativeButton:i}),d=m.useCallback(()=>{const h=o.current;tg(h)&&l&&t&&c.disabled===void 0&&h.disabled&&(h.disabled=!1)},[t,c.disabled,l]);Ge(d,[d]);const u=m.useCallback((h={})=>{const{onClick:y,onMouseDown:g,onKeyUp:x,onKeyDown:v,onPointerDown:b,...w}=h;return Cl({type:i?"button":void 0,onClick(k){if(t){k.preventDefault();return}y?.(k)},onMouseDown(k){t||g?.(k)},onKeyDown(k){if(t||(np(k),v?.(k),k.baseUIHandlerPrevented))return;const S=k.target===k.currentTarget,E=k.currentTarget,C=tg(E),j=!i&&aU(E),T=S&&(i?C:!j),A=k.key==="Enter",R=k.key===" ",D=E.getAttribute("role"),M=D?.startsWith("menuitem")||D==="option"||D==="gridcell";if(S&&l&&R){if(k.defaultPrevented&&M)return;k.preventDefault(),j||i&&C?(E.click(),k.preventBaseUIHandler()):T&&(y?.(k),k.preventBaseUIHandler());return}T&&(!i&&(R||A)&&k.preventDefault(),!i&&A&&y?.(k))},onKeyUp(k){if(!t){if(np(k),x?.(k),k.target===k.currentTarget&&i&&l&&tg(k.currentTarget)&&k.key===" "){k.preventDefault();return}k.baseUIHandlerPrevented||k.target===k.currentTarget&&!i&&!l&&k.key===" "&&y?.(k)}},onPointerDown(k){if(t){k.preventDefault();return}b?.(k)}},i?void 0:{role:"button"},c,w)},[t,c,l,i]),p=et(h=>{o.current=h,d()});return{getButtonProps:u,buttonRef:p}}function tg(e){return Rt(e)&&e.tagName==="BUTTON"}function aU(e){return!!(e?.tagName==="A"&&e?.href)}const ou="trigger-press",gr="trigger-hover",Fc="trigger-focus",y0="outside-press",vA="item-press",oU="close-press",Pl="focus-out",v0="escape-key",Cf="list-navigation",sU="cancel-open",jc="sibling-open",xA="imperative-action";function dt(e,t,n,r){let i=!1,a=!1;const o=Bn;return{reason:e,event:t??new Event("base-ui"),cancel(){i=!0},allowPropagation(){a=!0},get isCanceled(){return i},get isPropagationAllowed(){return a},trigger:n,...o}}const bA=m.forwardRef(function(t,n){const{render:r,className:i,disabled:a=!1,nativeButton:o=!0,style:s,...l}=t,{store:c}=Co(),d=c.useState("open");function u(g){d&&c.setOpen(!1,dt(oU,g.nativeEvent))}const{getButtonProps:p,buttonRef:h}=Eh({disabled:a,native:o});return Ur("button",t,{state:{disabled:a},ref:[n,h],props:[{onClick:u},l,p]})});let v_=0;function lU(e,t="mui"){const[n,r]=m.useState(e),i=e||n;return m.useEffect(()=>{n==null&&(v_+=1,r(`${t}-${v_}`))},[n,t]),i}const x_=tU.useId;function Es(e,t){if(x_!==void 0){const n=x_();return e??(t?`${t}-${n}`:n)}return lU(e,t)}function Ch(e){return Es(e,"base-ui")}const cU=m.forwardRef(function(t,n){const{render:r,className:i,style:a,id:o,...s}=t,{store:l}=Co(),c=Ch(o);return l.useSyncedValueWithCleanup("descriptionElementId",c),Ur("p",t,{ref:n,props:[{id:c},s]})}),uU=[];function x0(e){m.useEffect(e,uU)}const oc=0;class na{static create(){return new na}currentId=oc;start(t,n){this.clear(),this.currentId=setTimeout(()=>{this.currentId=oc,n()},t)}isStarted(){return this.currentId!==oc}clear=()=>{this.currentId!==oc&&(clearTimeout(this.currentId),this.currentId=oc)};disposeEffect=()=>this.clear}function Fr(){const e=cr(na.create).current;return x0(e.disposeEffect),e}const Fl=typeof navigator<"u",ng=dU(),wA=pU(),kA=fU(),_A=typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter:none"),SA=ng.platform==="MacIntel"&&ng.maxTouchPoints>1?!0:/iP(hone|ad|od)|iOS/.test(ng.platform),EA=Fl&&/apple/i.test(navigator.vendor),Wv=Fl&&/android/i.test(wA)||/android/i.test(kA),CA=Fl&&wA.toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints,jA=kA.includes("jsdom/");function dU(){if(!Fl)return{platform:"",maxTouchPoints:-1};const e=navigator.userAgentData;return e?.platform?{platform:e.platform,maxTouchPoints:navigator.maxTouchPoints}:{platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??-1}}function fU(){if(!Fl)return"";const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(({brand:t,version:n})=>`${t}/${n}`).join(" "):navigator.userAgent}function pU(){if(!Fl)return"";const e=navigator.userAgentData;return e?.platform?e.platform:navigator.platform??""}function Mr(e){e.preventDefault(),e.stopPropagation()}function hU(e){return"nativeEvent"in e}function PA(e){return e.pointerType===""&&e.isTrusted?!0:Wv&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function NA(e){return jA?!1:!Wv&&e.width===0&&e.height===0||Wv&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType==="mouse"||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType==="touch"}function su(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}function TA(e){const t=e.type;return t==="click"||t==="mousedown"||t==="keydown"||t==="keyup"}function mU(e,t){return t!=null&&!su(t)?0:typeof e=="function"?e():e}function Hv(e,t,n){const r=mU(e,n);return typeof r=="number"?r:r?.[t]}function b_(e){return typeof e=="function"?e():e}function OA(e,t){return t||e==="click"||e==="mousedown"}function ot(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function Gi(...e){return()=>{for(let t=0;t<e.length;t+=1){const n=e[t];n&&n()}}}function Fn(e){const t=cr(gU,e).current;return t.next=e,Ge(t.effect),t}function gU(e){const t={current:e,next:e,effect:()=>{t.current=t.next}};return t}const _d=null;class yU{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=t=>{this.isScheduled=!1;const n=this.callbacks,r=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,r>0)for(let i=0;i<n.length;i+=1)n[i]?.(t)};request(t){const n=this.nextId;return this.nextId+=1,this.callbacks.push(t),this.callbacksCount+=1,!this.isScheduled&&(requestAnimationFrame(this.tick),this.isScheduled=!0),n}cancel(t){const n=t-this.startId;n<0||n>=this.callbacks.length||(this.callbacks[n]=null,this.callbacksCount-=1)}}const Sd=new yU;class Bi{static create(){return new Bi}static request(t){return Sd.request(t)}static cancel(t){return Sd.cancel(t)}currentId=_d;request(t){this.cancel(),this.currentId=Sd.request(()=>{this.currentId=_d,t()})}cancel=()=>{this.currentId!==_d&&(Sd.cancel(this.currentId),this.currentId=_d)};disposeEffect=()=>this.cancel}function b0(){const e=cr(Bi.create).current;return x0(e.disposeEffect),e}function ut(e){return e?.ownerDocument||document}const vU={clipPath:"inset(50%)",overflow:"hidden",whiteSpace:"nowrap",border:0,padding:0,width:1,height:1,margin:-1},xU={...vU,position:"fixed",top:0,left:0},Nl=m.forwardRef(function(t,n){const[r,i]=m.useState();Ge(()=>{EA&&i("button")},[]);const a={tabIndex:0,role:r};return f.jsx("span",{...t,ref:n,style:xU,"aria-hidden":r?void 0:!0,...a,"data-base-ui-focus-guard":""})}),Uv="data-base-ui-focusable",AA="active",RA="selected",MA="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])",go="ArrowLeft",yo="ArrowRight",w0="ArrowUp",$u="ArrowDown";function Qr(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function Qe(e,t){if(!e||!t)return!1;const n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&jl(n)){let r=t;for(;r;){if(e===r)return!0;r=r.parentNode||r.host}}return!1}function wr(e){return"composedPath"in e?e.composedPath()[0]:e.target}function rp(e,t){if(!st(e))return!1;const n=e;if(t.hasElement(n))return!n.hasAttribute("data-trigger-disabled");for(const[,r]of t.entries())if(Qe(r,n))return!r.hasAttribute("data-trigger-disabled");return!1}function hi(e,t){if(t==null)return!1;if("composedPath"in e)return e.composedPath().includes(t);const n=e;return n.target!=null&&t.contains(n.target)}function bU(e){return e.matches("html,body")}function jh(e){return Rt(e)&&e.matches(MA)}function wU(e){return e?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${MA}`)!=null}function Vv(e){return e?e.getAttribute("role")==="combobox"&&jh(e):!1}function kU(e){if(!e||jA)return!0;try{return e.matches(":focus-visible")}catch{return!0}}function ip(e){return e?e.hasAttribute(Uv)?e:e.querySelector(`[${Uv}]`)||e:null}const _U=["top","right","bottom","left"],Tl=Math.min,Ir=Math.max,ap=Math.round,Qo=Math.floor,Yi=e=>({x:e,y:e}),SU={left:"right",right:"left",bottom:"top",top:"bottom"};function qv(e,t,n){return Ir(e,Tl(t,n))}function Ra(e,t){return typeof e=="function"?e(t):e}function kr(e){return e.split("-")[0]}function Po(e){return e.split("-")[1]}function k0(e){return e==="x"?"y":"x"}function _0(e){return e==="y"?"height":"width"}function ei(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function S0(e){return k0(ei(e))}function EU(e,t,n){n===void 0&&(n=!1);const r=Po(e),i=S0(e),a=_0(i);let o=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[a]>t.floating[a]&&(o=op(o)),[o,op(o)]}function CU(e){const t=op(e);return[Kv(e),t,Kv(t)]}function Kv(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const w_=["left","right"],k_=["right","left"],jU=["top","bottom"],PU=["bottom","top"];function NU(e,t,n){switch(e){case"top":case"bottom":return n?t?k_:w_:t?w_:k_;case"left":case"right":return t?jU:PU;default:return[]}}function TU(e,t,n,r){const i=Po(e);let a=NU(kr(e),n==="start",r);return i&&(a=a.map(o=>o+"-"+i),t&&(a=a.concat(a.map(Kv)))),a}function op(e){const t=kr(e);return SU[t]+e.slice(t.length)}function OU(e){return{top:0,right:0,bottom:0,left:0,...e}}function IA(e){return typeof e!="number"?OU(e):{top:e,right:e,bottom:e,left:e}}function sp(e){const{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function Ed(e,t,n){return Math.floor(e/t)!==n}function lp(e,t){return t<0||t>=e.length}function rg(e,t){return er(e.current,{disabledIndices:t})}function __(e,t){return er(e.current,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function er(e,{startingIndex:t=-1,decrement:n=!1,disabledIndices:r,amount:i=1}={}){let a=t;do a+=n?-i:i;while(a>=0&&a<=e.length-1&&fl(e,a,r));return a}function AU(e,{event:t,orientation:n,loopFocus:r,onLoop:i,rtl:a,cols:o,disabledIndices:s,minIndex:l,maxIndex:c,prevIndex:d,stopEvent:u=!1}){let p=d,h;if(t.key===w0?h="up":t.key===$u&&(h="down"),h){const y=[],g=[];let x=!1,v=0;{let j=null,T=-1;e.forEach((A,R)=>{if(A==null)return;v+=1;const D=A.closest('[role="row"]');D&&(x=!0),(D!==j||T===-1)&&(j=D,T+=1,y[T]=[]),y[T].push(R),g[R]=T})}let b=!1,w=0;if(x)for(const j of y){const T=j.length;T>w&&(w=T),T!==o&&(b=!0)}const _=b&&v<e.length,k=w||o,S=j=>{if(!b||d===-1)return;const T=g[d];if(T==null)return;const A=y[T].indexOf(d),R=j==="up"?-1:1;for(let D=T+R,M=0;M<y.length;M+=1,D+=R){if(D<0||D>=y.length){if(!r||_)return;if(D=D<0?y.length-1:0,i){const I=Math.min(A,y[D].length-1),L=y[D][I]??y[D][0],V=i(t,d,L);D=g[V]??D}}const O=y[D];for(let I=Math.min(A,O.length-1);I>=0;I-=1){const L=O[I];if(!fl(e,L,s))return L}}},E=j=>{if(!_||d===-1)return;const T=d%k,A=j==="up"?-k:k,R=c-c%k,D=Qo(c/k)+1;for(let M=d-T+A,O=0;O<D;O+=1,M+=A){if(M<0||M>c){if(!r)return;M=M<0?R:0}const I=Math.min(M+k-1,c);for(let L=Math.min(M+T,I);L>=M;L-=1)if(!fl(e,L,s))return L}};u&&Mr(t);const C=S(h)??E(h);if(C!==void 0)p=C;else if(d===-1)p=h==="up"?c:l;else if(p=er(e,{startingIndex:d,amount:k,decrement:h==="up",disabledIndices:s}),r){if(h==="up"&&(d-k<l||p<0)){const j=d%k,T=c%k,A=c-(T-j);T===j?p=c:p=T>j?A:A-k,i&&(p=i(t,d,p))}h==="down"&&d+k>c&&(p=er(e,{startingIndex:d%k-k,amount:k,disabledIndices:s}),i&&(p=i(t,d,p)))}lp(e,p)&&(p=d)}if(n==="both"){const y=Qo(d/o);t.key===(a?go:yo)&&(u&&Mr(t),d%o!==o-1?(p=er(e,{startingIndex:d,disabledIndices:s}),r&&Ed(p,o,y)&&(p=er(e,{startingIndex:d-d%o-1,disabledIndices:s}),i&&(p=i(t,d,p)))):r&&(p=er(e,{startingIndex:d-d%o-1,disabledIndices:s}),i&&(p=i(t,d,p))),Ed(p,o,y)&&(p=d)),t.key===(a?yo:go)&&(u&&Mr(t),d%o!==0?(p=er(e,{startingIndex:d,decrement:!0,disabledIndices:s}),r&&Ed(p,o,y)&&(p=er(e,{startingIndex:d+(o-d%o),decrement:!0,disabledIndices:s}),i&&(p=i(t,d,p)))):r&&(p=er(e,{startingIndex:d+(o-d%o),decrement:!0,disabledIndices:s}),i&&(p=i(t,d,p))),Ed(p,o,y)&&(p=d));const g=Qo(c/o)===y;lp(e,p)&&(r&&g?(p=t.key===(a?yo:go)?c:er(e,{startingIndex:d-d%o-1,disabledIndices:s}),i&&(p=i(t,d,p))):p=d)}return p}function RU(e,t,n){const r=[];let i=0;return e.forEach(({width:a,height:o},s)=>{let l=!1;for(;!l;){const c=[];for(let d=0;d<a;d+=1)for(let u=0;u<o;u+=1)c.push(i+d+u*t);i%t+a<=t&&c.every(d=>r[d]==null)?(c.forEach(d=>{r[d]=s}),l=!0):i+=1}}),[...r]}function MU(e,t,n,r,i){if(e===-1)return-1;const a=n.indexOf(e),o=t[e];switch(i){case"tl":return a;case"tr":return o?a+o.width-1:a;case"bl":return o?a+(o.height-1)*r:a;case"br":return n.lastIndexOf(e);default:return-1}}function IU(e,t){return t.flatMap((n,r)=>e.includes(n)?[r]:[])}function fl(e,t,n){if(typeof n=="function"?n(t):n?.includes(t)??!1)return!0;const i=e[t];return i?Ph(i)?!n&&(i.hasAttribute("disabled")||i.getAttribute("aria-disabled")==="true"):!0:!1}function DU(e){return e.visibility==="hidden"||e.visibility==="collapse"}function Ph(e,t=e?Pr(e):null){return!e||!e.isConnected||!t||DU(t)?!1:typeof e.checkVisibility=="function"?e.checkVisibility():t.display!=="none"&&t.display!=="contents"}const LU='a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]';function $U(e){const t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;const n=e.getRootNode();return jl(n)?n.host:null}function Gv(e){for(const t of Array.from(e.children))if(Xn(t)==="summary")return t;return null}function zU(e,t){const n=Gv(t);return!!n&&(e===n||Qe(n,e))}function DA(e){const t=e?Xn(e):"";return e!=null&&e.matches(LU)&&(t!=="summary"||e.parentElement!=null&&Xn(e.parentElement)==="details"&&Gv(e.parentElement)===e)&&(t!=="details"||Gv(e)==null)&&(t!=="input"||e.type!=="hidden")}function LA(e){if(!DA(e)||!e.isConnected||e.matches(":disabled"))return!1;for(let t=e;t;t=$U(t)){const n=t!==e,r=Xn(t)==="slot";if(t.hasAttribute("inert")||n&&Xn(t)==="details"&&!t.open&&!zU(e,t)||t.hasAttribute("hidden")||!r&&!FU(t,n))return!1}return!0}function FU(e,t){const n=Pr(e);return t?n.display!=="none":Ph(e,n)}function $A(e){const t=e.tabIndex;if(t<0){const n=Xn(e);if(n==="details"||n==="audio"||n==="video"||Rt(e)&&e.isContentEditable)return 0}return t}function ig(e){if(Xn(e)!=="input")return null;const t=e;return t.type==="radio"&&t.name!==""?t:null}function BU(e,t){const n=ig(e);if(!n)return!0;const r=t.find(i=>{const a=ig(i);return a?.name===n.name&&a.form===n.form&&a.checked});return r?r===n:t.find(i=>{const a=ig(i);return a?.name===n.name&&a.form===n.form})===n}function zA(e){if(Rt(e)&&Xn(e)==="slot"){const t=e.assignedElements({flatten:!0});if(t.length>0)return t}return Rt(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function FA(e,t){zA(e).forEach(n=>{DA(n)&&t.push(n),FA(n,t)})}function BA(e,t,n){zA(e).forEach(r=>{Rt(r)&&r.matches(t)&&n.push(r),BA(r,t,n)})}function E0(e){return LA(e)&&$A(e)>=0}function WA(e){const t=[];return FA(e,t),t.filter(LA)}function zu(e){const t=WA(e);return t.filter(n=>$A(n)>=0&&BU(n,t))}function HA(e,t){const n=zu(e),r=n.length;if(r===0)return;const i=Qr(ut(e)),a=n.indexOf(i),o=a===-1?t===1?0:r-1:a+t;return n[o]}function C0(e){return HA(ut(e).body,1)||e}function UA(e){return HA(ut(e).body,-1)||e}function VA(e,t){if(!e)return null;const n=zu(ut(e).body),r=n.length;if(r===0)return null;const i=n.indexOf(e);if(i===-1)return null;const a=(i+t+r)%r;return n[a]}function WU(e){return VA(e,1)}function HU(e){return VA(e,-1)}function pl(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!Qe(n,r)}function UU(e){zu(e).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function S_(e){const t=[];BA(e,"[data-tabindex]",t),t.forEach(n=>{const r=n.dataset.tabindex;delete n.dataset.tabindex,r?n.setAttribute("tabindex",r):n.removeAttribute("tabindex")})}function Xi(e,t,n=!0){return e.filter(i=>i.parentId===t).flatMap(i=>[...!n||i.context?.open?[i]:[],...Xi(e,i.id,n)])}function E_(e,t){let n=[],r=e.find(i=>i.id===t)?.parentId;for(;r;){const i=e.find(a=>a.id===r);r=i?.parentId,i&&(n=n.concat(i))}return n}function lu(e){return`data-base-ui-${e}`}let Cd=0;function jf(e,t={}){const{preventScroll:n=!1,cancelPrevious:r=!0,sync:i=!1}=t;r&&cancelAnimationFrame(Cd);const a=()=>e?.focus({preventScroll:n});if(i)return a(),d0;const o=requestAnimationFrame(a);return Cd=o,()=>{Cd===o&&(cancelAnimationFrame(o),Cd=0)}}const ag={inert:new WeakMap,"aria-hidden":new WeakMap},C_="data-base-ui-inert",Yv={inert:new WeakSet,"aria-hidden":new WeakSet};let sc=new WeakMap,og=0;function VU(e){return Yv[e]}function qA(e){return e?jl(e)?e.host:qA(e.parentNode):null}const sg=(e,t)=>t.map(n=>{if(e.contains(n))return n;const r=qA(n);return e.contains(r)?r:null}).filter(n=>n!=null),j_=e=>{const t=new Set;return e.forEach(n=>{let r=n;for(;r&&!t.has(r);)t.add(r),r=r.parentNode}),t},P_=(e,t,n)=>{const r=[],i=a=>{!a||n.has(a)||Array.from(a.children).forEach(o=>{Xn(o)!=="script"&&(t.has(o)?i(o):r.push(o))})};return i(e),r};function qU(e,t,n,r,{mark:i=!0,markerIgnoreElements:a=[]}){const o=r?"inert":n?"aria-hidden":null;let s=null,l=null;const c=sg(t,e),d=i?sg(t,a):[],u=new Set(d),p=i?P_(t,j_(c),new Set(c)).filter(g=>!u.has(g)):[],h=[],y=[];if(o){const g=ag[o],x=VU(o);l=x,s=g;const v=sg(t,Array.from(t.querySelectorAll("[aria-live]"))),b=c.concat(v);P_(t,j_(b),new Set(b)).forEach(_=>{const k=_.getAttribute(o),S=k!==null&&k!=="false",E=(g.get(_)||0)+1;g.set(_,E),h.push(_),E===1&&S&&x.add(_),S||_.setAttribute(o,o==="inert"?"":"true")})}return i&&p.forEach(g=>{const x=(sc.get(g)||0)+1;sc.set(g,x),y.push(g),x===1&&g.setAttribute(C_,"")}),og+=1,()=>{s&&h.forEach(g=>{const v=(s.get(g)||0)-1;s.set(g,v),v||(!l?.has(g)&&o&&g.removeAttribute(o),l?.delete(g))}),i&&y.forEach(g=>{const x=(sc.get(g)||0)-1;sc.set(g,x),x||g.removeAttribute(C_)}),og-=1,og||(ag.inert=new WeakMap,ag["aria-hidden"]=new WeakMap,Yv.inert=new WeakSet,Yv["aria-hidden"]=new WeakSet,sc=new WeakMap)}}function N_(e,t={}){const{ariaHidden:n=!1,inert:r=!1,mark:i=!0,markerIgnoreElements:a=[]}=t,o=ut(e[0]).body;return qU(e,o,n,r,{mark:i,markerIgnoreElements:a})}const KU=500,GU=500,YU={style:{transition:"none"}},XU="data-base-ui-click-trigger",ZU={fallbackAxisSide:"none"},QU={fallbackAxisSide:"end"},JU={clipPath:"inset(50%)",position:"fixed",top:0,left:0},KA=m.createContext(null),GA=()=>m.useContext(KA),e9=lu("portal");function t9(e={}){const{ref:t,container:n,componentProps:r=Bn,elementProps:i}=e,a=Es(),s=GA()?.portalNode,[l,c]=m.useState(null),[d,u]=m.useState(null),p=et(x=>{x!==null&&u(x)}),h=m.useRef(null);Ge(()=>{if(n===null){h.current&&(h.current=null,u(null),c(null));return}if(a==null)return;const x=(n&&(h0(n)?n:n.current))??s??document.body;if(x==null){h.current&&(h.current=null,u(null),c(null));return}h.current!==x&&(h.current=x,u(null),c(x))},[n,s,a]);const y=Ur("div",r,{ref:[t,p],props:[{id:a,[e9]:""},i]});return{portalNode:d,portalSubtree:l&&y?oi.createPortal(y,l):null}}const YA=m.forwardRef(function(t,n){const{children:r,container:i,className:a,render:o,renderGuards:s,style:l,...c}=t,{portalNode:d,portalSubtree:u}=t9({container:i,ref:n,componentProps:t,elementProps:c}),p=m.useRef(null),h=m.useRef(null),y=m.useRef(null),g=m.useRef(null),[x,v]=m.useState(null),b=m.useRef(!1),w=x?.modal,_=x?.open,k=typeof s=="boolean"?s:!!x&&!x.modal&&x.open&&!!d;m.useEffect(()=>{if(!d||w)return;function E(C){d&&C.relatedTarget&&pl(C)&&(C.type==="focusin"?b.current&&(S_(d),b.current=!1):(UU(d),b.current=!0))}return Gi(ot(d,"focusin",E,!0),ot(d,"focusout",E,!0))},[d,w]),m.useEffect(()=>{!d||_!==!1||(S_(d),b.current=!1)},[_,d]);const S=m.useMemo(()=>({beforeOutsideRef:p,afterOutsideRef:h,beforeInsideRef:y,afterInsideRef:g,portalNode:d,setFocusManagerState:v}),[d]);return f.jsxs(m.Fragment,{children:[u,f.jsxs(KA.Provider,{value:S,children:[k&&d&&f.jsx(Nl,{"data-type":"outside",ref:p,onFocus:E=>{if(pl(E,d))y.current?.focus();else{const C=x?x.domReference:null;UA(C)?.focus()}}}),k&&d&&f.jsx("span",{"aria-owns":d.id,style:JU}),d&&oi.createPortal(r,d),k&&d&&f.jsx(Nl,{"data-type":"outside",ref:h,onFocus:E=>{if(pl(E,d))g.current?.focus();else{const C=x?x.domReference:null;C0(C)?.focus(),x?.closeOnFocusOut&&x?.onOpenChange(!1,dt(Pl,E.nativeEvent))}}})]})]})});function XA(){const e=new Map;return{emit(t,n){e.get(t)?.forEach(r=>r(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){e.get(t)?.delete(n)}}}class j0{nodesRef={current:[]};events=XA();addNode(t){this.nodesRef.current.push(t)}removeNode(t){const n=this.nodesRef.current.findIndex(r=>r===t);n!==-1&&this.nodesRef.current.splice(n,1)}}const ZA=m.createContext(null),QA=m.createContext(null),$a=()=>m.useContext(ZA)?.id||null,No=e=>{const t=m.useContext(QA);return e??t};function JA(e){const t=Es(),n=No(e),r=$a();return Ge(()=>{if(!t)return;const i={id:t,parentId:r};return n?.addNode(i),()=>{n?.removeNode(i)}},[n,t,r]),t}function n9(e){const{children:t,id:n}=e,r=$a();return f.jsx(ZA.Provider,{value:m.useMemo(()=>({id:n,parentId:r}),[n,r]),children:t})}function r9(e){const{children:t,externalTree:n}=e,r=cr(()=>n??new j0).current;return f.jsx(QA.Provider,{value:r,children:t})}function ga(e){return e==null?e:"current"in e?e.current:e}function i9(e,t){const n=an(wr(e));return e instanceof n.KeyboardEvent?"keyboard":e instanceof n.FocusEvent?t||"keyboard":"pointerType"in e?e.pointerType||"keyboard":"touches"in e?"touch":e instanceof n.MouseEvent?t||(e.detail===0?"keyboard":"mouse"):""}const T_=20;let uo=[];function P0(){uo=uo.filter(e=>e.deref()?.isConnected)}function a9(e){P0(),e&&Xn(e)!=="body"&&(uo.push(new WeakRef(e)),uo.length>T_&&(uo=uo.slice(-T_)))}function lg(){return P0(),uo[uo.length-1]?.deref()}function o9(e){return e?E0(e)?e:zu(e)[0]||e:null}function O_(e,t){if(e.hasAttribute("tabindex")&&!e.hasAttribute("data-tabindex")||!t.current.includes("floating")&&!e.getAttribute("role")?.includes("dialog"))return;const r=WA(e).filter(a=>{const o=a.getAttribute("data-tabindex")||"";return E0(a)||a.hasAttribute("data-tabindex")&&!o.startsWith("-")}),i=e.getAttribute("tabindex");t.current.includes("floating")||r.length===0?i!=="0"&&e.setAttribute("tabindex","0"):(i!=="-1"||e.hasAttribute("data-tabindex")&&e.getAttribute("data-tabindex")!=="-1")&&(e.setAttribute("tabindex","-1"),e.setAttribute("data-tabindex","-1"))}function eR(e){const{context:t,children:n,disabled:r=!1,initialFocus:i=!0,returnFocus:a=!0,restoreFocus:o=!1,modal:s=!0,closeOnFocusOut:l=!0,openInteractionType:c="",nextFocusableElement:d,previousFocusableElement:u,beforeContentFocusGuardRef:p,externalTree:h,getInsideElements:y}=e,g="rootStore"in t?t.rootStore:t,x=g.useState("open"),v=g.useState("domReferenceElement"),b=g.useState("floatingElement"),{events:w,dataRef:_}=g.context,k=et(()=>_.current.floatingContext?.nodeId),S=i===!1,E=Vv(v)&&S,C=m.useRef(["content"]),j=Fn(i),T=Fn(a),A=Fn(c),R=No(h),D=GA(),M=m.useRef(!1),O=m.useRef(!1),I=m.useRef(!1),L=m.useRef(null),V=m.useRef(""),F=m.useRef(""),N=m.useRef(null),ee=m.useRef(null),Q=El(N,p,D?.beforeInsideRef),P=El(ee,D?.afterInsideRef),z=Fr(),$=Fr(),H=b0(),oe=D!=null,q=ip(b),X=et((G=q)=>G?zu(G):[]),te=et(()=>y?.().filter(G=>G!=null)??[]);m.useEffect(()=>{if(r||!s)return;function G(xe){xe.key==="Tab"&&Qe(q,Qr(ut(q)))&&X().length===0&&!E&&Mr(xe)}const be=ut(q);return ot(be,"keydown",G)},[r,v,q,s,C,E,X]),m.useEffect(()=>{if(r||!x)return;const G=ut(q);function be(){I.current=!1}function xe(ge){const _e=wr(ge),De=te(),ve=Qe(b,_e)||Qe(v,_e)||Qe(D?.portalNode,_e)||De.some(Le=>Le===_e||Qe(Le,_e));I.current=!ve,F.current=ge.pointerType||"keyboard",_e?.closest(`[${XU}]`)&&(O.current=!0)}function Ae(){F.current="keyboard"}return Gi(ot(G,"pointerdown",xe,!0),ot(G,"pointerup",be,!0),ot(G,"pointercancel",be,!0),ot(G,"keydown",Ae,!0))},[r,b,v,q,x,D,te]),m.useEffect(()=>{if(r||!l)return;const G=ut(q);function be(){O.current=!0,$.start(0,()=>{O.current=!1})}function xe(De){const ve=wr(De);E0(ve)&&(L.current=ve)}function Ae(De){const ve=De.relatedTarget,Le=De.currentTarget,le=wr(De);queueMicrotask(()=>{const pe=k(),K=g.context.triggerElements,se=te(),Se=ve?.hasAttribute(lu("focus-guard"))&&[N.current,ee.current,D?.beforeInsideRef.current,D?.afterInsideRef.current,D?.beforeOutsideRef.current,D?.afterOutsideRef.current,ga(u),ga(d)].includes(ve),Z=!(Qe(v,ve)||Qe(b,ve)||Qe(ve,b)||Qe(D?.portalNode,ve)||se.some(U=>U===ve||Qe(U,ve))||ve!=null&&K.hasElement(ve)||K.hasMatchingElement(U=>Qe(U,ve))||Se||R&&(Xi(R.nodesRef.current,pe).find(U=>Qe(U.context?.elements.floating,ve)||Qe(U.context?.elements.domReference,ve))||E_(R.nodesRef.current,pe).find(U=>[U.context?.elements.floating,ip(U.context?.elements.floating)].includes(ve)||U.context?.elements.domReference===ve)));if(Le===v&&q&&O_(q,C),o&&Le!==v&&!Ph(le)&&Qr(G)===G.body){if(Rt(q)&&(q.focus(),o==="popup")){H.request(()=>{q.focus()});return}const U=X(),fe=L.current,we=(fe&&U.includes(fe)?fe:null)||U[U.length-1]||q;Rt(we)&&we.focus()}if(_.current.insideReactTree){_.current.insideReactTree=!1;return}(E||!s)&&ve&&Z&&!O.current&&(E||ve!==lg())&&(M.current=!0,g.setOpen(!1,dt(Pl,De)))})}function ge(){I.current||(_.current.insideReactTree=!0,z.start(0,()=>{_.current.insideReactTree=!1}))}const _e=Rt(v)?v:null;if(!(!b&&!_e))return Gi(_e&&ot(_e,"focusout",Ae),_e&&ot(_e,"pointerdown",be),b&&ot(b,"focusin",xe),b&&ot(b,"focusout",Ae),b&&D&&ot(b,"focusout",ge,!0))},[r,v,b,q,s,R,D,g,l,o,X,E,k,C,_,z,$,H,d,u,te]),m.useEffect(()=>{if(r||!b||!x)return;const G=Array.from(D?.portalNode?.querySelectorAll(`[${lu("portal")}]`)||[]),xe=(R?E_(R.nodesRef.current,k()):[]).find(Le=>Vv(Le.context?.elements.domReference||null))?.context?.elements.domReference,ge=[...[b,...G,N.current,ee.current,D?.beforeOutsideRef.current,D?.afterOutsideRef.current,...te()],xe,ga(u),ga(d),E?v:null].filter(Le=>Le!=null),_e=N_(ge,{ariaHidden:s||E,mark:!1}),De=[b,...G].filter(Le=>Le!=null),ve=N_(De);return()=>{ve(),_e()}},[x,r,v,b,s,C,D,E,R,k,d,u,te]),Ge(()=>{if(!x||r||!Rt(q))return;const G=ut(q),be=Qr(G);queueMicrotask(()=>{const xe=j.current,Ae=typeof xe=="function"?xe(A.current||""):xe;if(Ae===void 0||Ae===!1||Qe(q,be))return;let _e=null;const De=()=>(_e==null&&(_e=X(q)),_e[0]||q);let ve;Ae===!0||Ae===null?ve=De():ve=ga(Ae),ve=ve||De(),jf(ve,{preventScroll:ve===q})})},[r,x,q,S,X,j,A]),Ge(()=>{if(r||!q)return;const G=ut(q),be=Qr(G);a9(be);function xe(ge){if(ge.open||(V.current=i9(ge.nativeEvent,F.current)),ge.reason===gr&&ge.nativeEvent.type==="mouseleave"&&(M.current=!0),ge.reason===y0)if(ge.nested)M.current=!1;else if(PA(ge.nativeEvent)||NA(ge.nativeEvent))M.current=!1;else{let _e=!1;ut(q).createElement("div").focus({get preventScroll(){return _e=!0,!1}}),_e?M.current=!1:M.current=!0}}w.on("openchange",xe);function Ae(){const ge=T.current;let _e=typeof ge=="function"?ge(V.current):ge;if(_e===void 0||_e===!1)return null;if(_e===null&&(_e=!0),typeof _e=="boolean"){const ve=v||lg();return ve&&ve.isConnected?ve:null}const De=v||lg();return ga(_e)||De||null}return()=>{w.off("openchange",xe);const ge=Qr(G),_e=te(),De=Qe(b,ge)||_e.some(le=>le===ge||Qe(le,ge))||R&&Xi(R.nodesRef.current,k(),!1).some(le=>Qe(le.context?.elements.floating,ge)),ve=T.current,Le=Ae();queueMicrotask(()=>{const le=o9(Le),pe=typeof ve!="boolean";ve&&!M.current&&Rt(le)&&(!(!pe&&le!==ge&&ge!==G.body)||De)&&le.focus({preventScroll:!0}),M.current=!1})}},[r,b,q,T,_,w,R,v,k,te]),Ge(()=>{if(!_A||x||!b)return;const G=Qr(ut(b));!Rt(G)||!jh(G)||Qe(b,G)&&G.blur()},[x,b]),Ge(()=>{if(!(r||!D))return D.setFocusManagerState({modal:s,closeOnFocusOut:l,open:x,onOpenChange:g.setOpen,domReference:v}),()=>{D.setFocusManagerState(null)}},[r,D,s,x,g,l,v]),Ge(()=>{if(!(r||!q))return O_(q,C),()=>{queueMicrotask(P0)}},[r,q,C]);const ue=!r&&(s?!E:!0)&&(oe||s);return f.jsxs(m.Fragment,{children:[ue&&f.jsx(Nl,{"data-type":"inside",ref:Q,onFocus:G=>{if(s){const be=X();jf(be[be.length-1])}else D?.portalNode&&(M.current=!1,pl(G,D.portalNode)?C0(v)?.focus():ga(u??D.beforeOutsideRef)?.focus())}}),n,ue&&f.jsx(Nl,{"data-type":"inside",ref:P,onFocus:G=>{s?jf(X()[0]):D?.portalNode&&(l&&(M.current=!0),pl(G,D.portalNode)?UA(v)?.focus():ga(d??D.afterOutsideRef)?.focus())}})]})}function s9(e,t={}){const n="rootStore"in e?e.rootStore:e,r=n.context.dataRef,{enabled:i=!0,event:a="click",toggle:o=!0,ignoreMouse:s=!1,stickIfOpen:l=!0,touchOpenDelay:c=0,reason:d=ou}=t,u=m.useRef(void 0),p=b0(),h=Fr(),y=m.useMemo(()=>({onPointerDown(g){u.current=g.pointerType},onMouseDown(g){const x=u.current,v=g.nativeEvent,b=n.select("open");if(g.button!==0||a==="click"||su(x,!0)&&s)return;const w=r.current.openEvent,_=w?.type,k=n.select("domReferenceElement")!==g.currentTarget,S=b&&k||!(b&&o&&(!(w&&l)||_==="click"||_==="mousedown")),E=wr(v);if(jh(E)){const j=dt(d,v,E);S&&x==="touch"&&c>0?h.start(c,()=>{n.setOpen(!0,j)}):n.setOpen(S,j);return}const C=g.currentTarget;p.request(()=>{const j=dt(d,v,C);S&&x==="touch"&&c>0?h.start(c,()=>{n.setOpen(!0,j)}):n.setOpen(S,j)})},onClick(g){if(a==="mousedown-only")return;const x=u.current;if(a==="mousedown"&&x){u.current=void 0;return}if(su(x,!0)&&s)return;const v=n.select("open"),b=r.current.openEvent,w=n.select("domReferenceElement")!==g.currentTarget,_=v&&w||!(v&&o&&(!(b&&l)||TA(b))),k=dt(d,g.nativeEvent,g.currentTarget);_&&x==="touch"&&c>0?h.start(c,()=>{n.setOpen(!0,k)}):n.setOpen(_,k)},onKeyDown(){u.current=void 0}}),[r,a,s,n,l,o,p,h,c,d]);return m.useMemo(()=>i?{reference:y}:Bn,[i,y])}const l9={intentional:"onClick",sloppy:"onPointerDown"};function c9(){return!1}function u9(e){return{escapeKey:typeof e=="boolean"?e:e?.escapeKey??!1,outsidePress:typeof e=="boolean"?e:e?.outsidePress??!0}}function tR(e,t={}){const n="rootStore"in e?e.rootStore:e,r=n.useState("open"),i=n.useState("floatingElement"),{dataRef:a}=n.context,{enabled:o=!0,escapeKey:s=!0,outsidePress:l=!0,outsidePressEvent:c="sloppy",referencePress:d=c9,referencePressEvent:u="sloppy",bubbles:p,externalTree:h}=t,y=No(h),g=et(typeof l=="function"?l:()=>!1),x=typeof l=="function"?g:l,v=x!==!1,b=et(()=>c),w=m.useRef(!1),_=m.useRef(!1),k=m.useRef(!1),{escapeKey:S,outsidePress:E}=u9(p),C=m.useRef(null),j=Fr(),T=Fr(),A=et(()=>{T.clear(),a.current.insideReactTree=!1}),R=m.useRef(!1),D=m.useRef(""),M=et(d),O=et(ee=>{if(!r||!o||!s||ee.key!=="Escape"||R.current)return;const Q=a.current.floatingContext?.nodeId,P=y?Xi(y.nodesRef.current,Q):[];if(!S&&P.length>0){let H=!0;if(P.forEach(oe=>{oe.context?.open&&!oe.context.dataRef.current.__escapeKeyBubbles&&(H=!1)}),!H)return}const z=hU(ee)?ee.nativeEvent:ee,$=dt(v0,z);n.setOpen(!1,$),!S&&!$.isPropagationAllowed&&ee.stopPropagation()}),I=et(()=>{a.current.insideReactTree=!0,T.start(0,A)});m.useEffect(()=>{if(!r||!o)return;a.current.__escapeKeyBubbles=S,a.current.__outsidePressBubbles=E;const ee=new na,Q=new na;function P(){ee.clear(),R.current=!0}function z(){ee.start(_h()?5:0,()=>{R.current=!1})}function $(){k.current=!0,Q.start(0,()=>{k.current=!1})}function H(){w.current=!1,_.current=!1}function oe(){const K=D.current,se=K==="pen"||!K?"mouse":K,Se=b(),Z=typeof Se=="function"?Se():Se;return typeof Z=="string"?Z:Z[se]}function q(K){const se=oe();return se==="intentional"&&K.type!=="click"||se==="sloppy"&&K.type==="click"}function X(K){const se=a.current.floatingContext?.nodeId,Se=y&&Xi(y.nodesRef.current,se).some(Z=>hi(K,Z.context?.elements.floating));return hi(K,n.select("floatingElement"))||hi(K,n.select("domReferenceElement"))||Se}function te(K){if(q(K)){A();return}if(a.current.insideReactTree){A();return}const se=wr(K),Se=`[${lu("inert")}]`,Z=st(se)?se.getRootNode():null,U=Array.from((jl(Z)?Z:ut(n.select("floatingElement"))).querySelectorAll(Se)),fe=n.context.triggerElements;if(se&&(fe.hasElement(se)||fe.hasMatchingElement(Ne=>Qe(Ne,se))))return;let we=st(se)?se:null;for(;we&&!Ki(we);){const Ne=ta(we);if(Ki(Ne)||!st(Ne))break;we=Ne}if(U.length&&st(se)&&!bU(se)&&!Qe(se,n.select("floatingElement"))&&U.every(Ne=>!Qe(we,Ne)))return;if(Rt(se)&&!("touches"in K)){const Ne=Ki(se),nt=Pr(se),xt=/auto|scroll/,fn=Ne||xt.test(nt.overflowX),Nt=Ne||xt.test(nt.overflowY),sn=fn&&se.clientWidth>0&&se.scrollWidth>se.clientWidth,tt=Nt&&se.clientHeight>0&&se.scrollHeight>se.clientHeight,wt=nt.direction==="rtl",pn=tt&&(wt?K.offsetX<=se.offsetWidth-se.clientWidth:K.offsetX>se.clientWidth),hn=sn&&K.offsetY>se.clientHeight;if(pn||hn)return}if(X(K))return;if(oe()==="intentional"&&k.current){Q.clear(),k.current=!1;return}if(typeof x=="function"&&!x(K))return;const Re=a.current.floatingContext?.nodeId,Ee=y?Xi(y.nodesRef.current,Re):[];if(Ee.length>0){let Ne=!0;if(Ee.forEach(nt=>{nt.context?.open&&!nt.context.dataRef.current.__outsidePressBubbles&&(Ne=!1)}),!Ne)return}n.setOpen(!1,dt(y0,K)),A()}function ue(K){oe()!=="sloppy"||K.pointerType==="touch"||!n.select("open")||!o||hi(K,n.select("floatingElement"))||hi(K,n.select("domReferenceElement"))||te(K)}function G(K){if(oe()!=="sloppy"||!n.select("open")||!o||hi(K,n.select("floatingElement"))||hi(K,n.select("domReferenceElement")))return;const se=K.touches[0];se&&(C.current={startTime:Date.now(),startX:se.clientX,startY:se.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},j.start(1e3,()=>{C.current&&(C.current.dismissOnTouchEnd=!1,C.current.dismissOnMouseDown=!1)}))}function be(K,se){const Se=wr(K);if(!Se)return;const Z=ot(Se,K.type,()=>{se(K),Z()})}function xe(K){D.current="touch",be(K,G)}function Ae(K){j.clear(),K.type==="pointerdown"&&(D.current=K.pointerType),!(K.type==="mousedown"&&C.current&&!C.current.dismissOnMouseDown)&&be(K,se=>{se.type==="pointerdown"?ue(se):te(se)})}function ge(K){if(!w.current)return;const se=_.current;if(H(),oe()==="intentional"){if(K.type==="pointercancel"){se&&$();return}if(!X(K)){if(se){$();return}typeof x=="function"&&!x(K)||(Q.clear(),k.current=!0,A())}}}function _e(K){if(oe()!=="sloppy"||!C.current||hi(K,n.select("floatingElement"))||hi(K,n.select("domReferenceElement")))return;const se=K.touches[0];if(!se)return;const Se=Math.abs(se.clientX-C.current.startX),Z=Math.abs(se.clientY-C.current.startY),U=Math.sqrt(Se*Se+Z*Z);U>5&&(C.current.dismissOnTouchEnd=!0),U>10&&(te(K),j.clear(),C.current=null)}function De(K){be(K,_e)}function ve(K){oe()!=="sloppy"||!C.current||hi(K,n.select("floatingElement"))||hi(K,n.select("domReferenceElement"))||(C.current.dismissOnTouchEnd&&te(K),j.clear(),C.current=null)}function Le(K){be(K,ve)}const le=ut(i),pe=Gi(s&&Gi(ot(le,"keydown",O),ot(le,"compositionstart",P),ot(le,"compositionend",z)),v&&Gi(ot(le,"click",Ae,!0),ot(le,"pointerdown",Ae,!0),ot(le,"pointerup",ge,!0),ot(le,"pointercancel",ge,!0),ot(le,"mousedown",Ae,!0),ot(le,"mouseup",ge,!0),ot(le,"touchstart",xe,!0),ot(le,"touchmove",De,!0),ot(le,"touchend",Le,!0)));return()=>{pe(),ee.clear(),Q.clear(),H(),k.current=!1}},[a,i,s,v,x,r,o,S,E,O,A,b,y,n,j]),m.useEffect(A,[x,A]);const L=m.useMemo(()=>({onKeyDown:O,[l9[u]]:ee=>{M()&&n.setOpen(!1,dt(ou,ee.nativeEvent))},...u!=="intentional"&&{onClick(ee){M()&&n.setOpen(!1,dt(ou,ee.nativeEvent))}}}),[O,n,u,M]),V=et(ee=>{if(!r||!o||ee.button!==0)return;const Q=wr(ee.nativeEvent);Qe(n.select("floatingElement"),Q)&&(w.current||(w.current=!0,_.current=!1))}),F=et(ee=>{!r||!o||(ee.defaultPrevented||ee.nativeEvent.defaultPrevented)&&w.current&&(_.current=!0)}),N=m.useMemo(()=>({onKeyDown:O,onPointerDown:F,onMouseDown:F,onClickCapture:I,onMouseDownCapture(ee){I(),V(ee)},onPointerDownCapture(ee){I(),V(ee)},onMouseUpCapture:I,onTouchEndCapture:I,onTouchMoveCapture:I}),[O,I,V,F]);return m.useMemo(()=>o?{reference:L,floating:N,trigger:L}:{},[o,L,N])}function A_(e,t,n){let{reference:r,floating:i}=e;const a=ei(t),o=S0(t),s=_0(o),l=kr(t),c=a==="y",d=r.x+r.width/2-i.width/2,u=r.y+r.height/2-i.height/2,p=r[s]/2-i[s]/2;let h;switch(l){case"top":h={x:d,y:r.y-i.height};break;case"bottom":h={x:d,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:u};break;case"left":h={x:r.x-i.width,y:u};break;default:h={x:r.x,y:r.y}}switch(Po(t)){case"start":h[o]-=p*(n&&c?-1:1);break;case"end":h[o]+=p*(n&&c?-1:1);break}return h}async function d9(e,t){var n;t===void 0&&(t={});const{x:r,y:i,platform:a,rects:o,elements:s,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:d="viewport",elementContext:u="floating",altBoundary:p=!1,padding:h=0}=Ra(t,e),y=IA(h),x=s[p?u==="floating"?"reference":"floating":u],v=sp(await a.getClippingRect({element:(n=await(a.isElement==null?void 0:a.isElement(x)))==null||n?x:x.contextElement||await(a.getDocumentElement==null?void 0:a.getDocumentElement(s.floating)),boundary:c,rootBoundary:d,strategy:l})),b=u==="floating"?{x:r,y:i,width:o.floating.width,height:o.floating.height}:o.reference,w=await(a.getOffsetParent==null?void 0:a.getOffsetParent(s.floating)),_=await(a.isElement==null?void 0:a.isElement(w))?await(a.getScale==null?void 0:a.getScale(w))||{x:1,y:1}:{x:1,y:1},k=sp(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:b,offsetParent:w,strategy:l}):b);return{top:(v.top-k.top+y.top)/_.y,bottom:(k.bottom-v.bottom+y.bottom)/_.y,left:(v.left-k.left+y.left)/_.x,right:(k.right-v.right+y.right)/_.x}}const f9=50,p9=async(e,t,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:d9},l=await(o.isRTL==null?void 0:o.isRTL(t));let c=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:d,y:u}=A_(c,r,l),p=r,h=0;const y={};for(let g=0;g<a.length;g++){const x=a[g];if(!x)continue;const{name:v,fn:b}=x,{x:w,y:_,data:k,reset:S}=await b({x:d,y:u,initialPlacement:r,placement:p,strategy:i,middlewareData:y,rects:c,platform:s,elements:{reference:e,floating:t}});d=w??d,u=_??u,y[v]={...y[v],...k},S&&h<f9&&(h++,typeof S=="object"&&(S.placement&&(p=S.placement),S.rects&&(c=S.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):S.rects),{x:d,y:u}=A_(c,p,l)),g=-1)}return{x:d,y:u,placement:p,strategy:i,middlewareData:y}},h9=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:i,middlewareData:a,rects:o,initialPlacement:s,platform:l,elements:c}=t,{mainAxis:d=!0,crossAxis:u=!0,fallbackPlacements:p,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:y="none",flipAlignment:g=!0,...x}=Ra(e,t);if((n=a.arrow)!=null&&n.alignmentOffset)return{};const v=kr(i),b=ei(s),w=kr(s)===s,_=await(l.isRTL==null?void 0:l.isRTL(c.floating)),k=p||(w||!g?[op(s)]:CU(s)),S=y!=="none";!p&&S&&k.push(...TU(s,g,y,_));const E=[s,...k],C=await l.detectOverflow(t,x),j=[];let T=((r=a.flip)==null?void 0:r.overflows)||[];if(d&&j.push(C[v]),u){const M=EU(i,o,_);j.push(C[M[0]],C[M[1]])}if(T=[...T,{placement:i,overflows:j}],!j.every(M=>M<=0)){var A,R;const M=(((A=a.flip)==null?void 0:A.index)||0)+1,O=E[M];if(O&&(!(u==="alignment"?b!==ei(O):!1)||T.every(V=>ei(V.placement)===b?V.overflows[0]>0:!0)))return{data:{index:M,overflows:T},reset:{placement:O}};let I=(R=T.filter(L=>L.overflows[0]<=0).sort((L,V)=>L.overflows[1]-V.overflows[1])[0])==null?void 0:R.placement;if(!I)switch(h){case"bestFit":{var D;const L=(D=T.filter(V=>{if(S){const F=ei(V.placement);return F===b||F==="y"}return!0}).map(V=>[V.placement,V.overflows.filter(F=>F>0).reduce((F,N)=>F+N,0)]).sort((V,F)=>V[1]-F[1])[0])==null?void 0:D[0];L&&(I=L);break}case"initialPlacement":I=s;break}if(i!==I)return{reset:{placement:I}}}return{}}}};function R_(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function M_(e){return _U.some(t=>e[t]>=0)}const m9=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:i="referenceHidden",...a}=Ra(e,t);switch(i){case"referenceHidden":{const o=await r.detectOverflow(t,{...a,elementContext:"reference"}),s=R_(o,n.reference);return{data:{referenceHiddenOffsets:s,referenceHidden:M_(s)}}}case"escaped":{const o=await r.detectOverflow(t,{...a,altBoundary:!0}),s=R_(o,n.floating);return{data:{escapedOffsets:s,escaped:M_(s)}}}default:return{}}}}},nR=new Set(["left","top"]);async function g9(e,t){const{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=kr(n),s=Po(n),l=ei(n)==="y",c=nR.has(o)?-1:1,d=a&&l?-1:1,u=Ra(t,e);let{mainAxis:p,crossAxis:h,alignmentAxis:y}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return s&&typeof y=="number"&&(h=s==="end"?y*-1:y),l?{x:h*d,y:p*c}:{x:p*c,y:h*d}}const y9=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:i,y:a,placement:o,middlewareData:s}=t,l=await g9(t,e);return o===((n=s.offset)==null?void 0:n.placement)&&(r=s.arrow)!=null&&r.alignmentOffset?{}:{x:i+l.x,y:a+l.y,data:{...l,placement:o}}}}},v9=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:l={fn:v=>{let{x:b,y:w}=v;return{x:b,y:w}}},...c}=Ra(e,t),d={x:n,y:r},u=await a.detectOverflow(t,c),p=ei(kr(i)),h=k0(p);let y=d[h],g=d[p];if(o){const v=h==="y"?"top":"left",b=h==="y"?"bottom":"right",w=y+u[v],_=y-u[b];y=qv(w,y,_)}if(s){const v=p==="y"?"top":"left",b=p==="y"?"bottom":"right",w=g+u[v],_=g-u[b];g=qv(w,g,_)}const x=l.fn({...t,[h]:y,[p]:g});return{...x,data:{x:x.x-n,y:x.y-r,enabled:{[h]:o,[p]:s}}}}}},x9=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:l=!0,crossAxis:c=!0}=Ra(e,t),d={x:n,y:r},u=ei(i),p=k0(u);let h=d[p],y=d[u];const g=Ra(s,t),x=typeof g=="number"?{mainAxis:g,crossAxis:0}:{mainAxis:0,crossAxis:0,...g};if(l){const w=p==="y"?"height":"width",_=a.reference[p]-a.floating[w]+x.mainAxis,k=a.reference[p]+a.reference[w]-x.mainAxis;h<_?h=_:h>k&&(h=k)}if(c){var v,b;const w=p==="y"?"width":"height",_=nR.has(kr(i)),k=a.reference[u]-a.floating[w]+(_&&((v=o.offset)==null?void 0:v[u])||0)+(_?0:x.crossAxis),S=a.reference[u]+a.reference[w]+(_?0:((b=o.offset)==null?void 0:b[u])||0)-(_?x.crossAxis:0);y<k?y=k:y>S&&(y=S)}return{[p]:h,[u]:y}}}},b9=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:i,rects:a,platform:o,elements:s}=t,{apply:l=()=>{},...c}=Ra(e,t),d=await o.detectOverflow(t,c),u=kr(i),p=Po(i),h=ei(i)==="y",{width:y,height:g}=a.floating;let x,v;u==="top"||u==="bottom"?(x=u,v=p===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?"start":"end")?"left":"right"):(v=u,x=p==="end"?"top":"bottom");const b=g-d.top-d.bottom,w=y-d.left-d.right,_=Tl(g-d[x],b),k=Tl(y-d[v],w),S=!t.middlewareData.shift;let E=_,C=k;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(C=w),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(E=b),S&&!p){const T=Ir(d.left,0),A=Ir(d.right,0),R=Ir(d.top,0),D=Ir(d.bottom,0);h?C=y-2*(T!==0||A!==0?T+A:Ir(d.left,d.right)):E=g-2*(R!==0||D!==0?R+D:Ir(d.top,d.bottom))}await l({...t,availableWidth:C,availableHeight:E});const j=await o.getDimensions(s.floating);return y!==j.width||g!==j.height?{reset:{rects:!0}}:{}}}};function rR(e){const t=Pr(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=Rt(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=ap(n)!==a||ap(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function N0(e){return st(e)?e:e.contextElement}function hl(e){const t=N0(e);if(!Rt(t))return Yi(1);const n=t.getBoundingClientRect(),{width:r,height:i,$:a}=rR(t);let o=(a?ap(n.width):n.width)/r,s=(a?ap(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}const w9=Yi(0);function iR(e){const t=an(e);return!_h()||!t.visualViewport?w9:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function k9(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==an(e)?!1:t}function ds(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),a=N0(e);let o=Yi(1);t&&(r?st(r)&&(o=hl(r)):o=hl(e));const s=k9(a,n,r)?iR(a):Yi(0);let l=(i.left+s.x)/o.x,c=(i.top+s.y)/o.y,d=i.width/o.x,u=i.height/o.y;if(a){const p=an(a),h=r&&st(r)?an(r):r;let y=p,g=Bv(y);for(;g&&r&&h!==y;){const x=hl(g),v=g.getBoundingClientRect(),b=Pr(g),w=v.left+(g.clientLeft+parseFloat(b.paddingLeft))*x.x,_=v.top+(g.clientTop+parseFloat(b.paddingTop))*x.y;l*=x.x,c*=x.y,d*=x.x,u*=x.y,l+=w,c+=_,y=an(g),g=Bv(y)}}return sp({width:d,height:u,x:l,y:c})}function Nh(e,t){const n=Sh(e).scrollLeft;return t?t.left+n:ds(pa(e)).left+n}function aR(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Nh(e,n),i=n.top+t.scrollTop;return{x:r,y:i}}function _9(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e;const a=i==="fixed",o=pa(r),s=t?kh(t.floating):!1;if(r===o||s&&a)return n;let l={scrollLeft:0,scrollTop:0},c=Yi(1);const d=Yi(0),u=Rt(r);if((u||!u&&!a)&&((Xn(r)!=="body"||jo(o))&&(l=Sh(r)),u)){const h=ds(r);c=hl(r),d.x=h.x+r.clientLeft,d.y=h.y+r.clientTop}const p=o&&!u&&!a?aR(o,l):Yi(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+d.x+p.x,y:n.y*c.y-l.scrollTop*c.y+d.y+p.y}}function S9(e){return Array.from(e.getClientRects())}function E9(e){const t=pa(e),n=Sh(e),r=e.ownerDocument.body,i=Ir(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=Ir(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+Nh(e);const s=-n.scrollTop;return Pr(r).direction==="rtl"&&(o+=Ir(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}const I_=25;function C9(e,t){const n=an(e),r=pa(e),i=n.visualViewport;let a=r.clientWidth,o=r.clientHeight,s=0,l=0;if(i){a=i.width,o=i.height;const d=_h();(!d||d&&t==="fixed")&&(s=i.offsetLeft,l=i.offsetTop)}const c=Nh(r);if(c<=0){const d=r.ownerDocument,u=d.body,p=getComputedStyle(u),h=d.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,y=Math.abs(r.clientWidth-u.clientWidth-h);y<=I_&&(a-=y)}else c<=I_&&(a+=c);return{width:a,height:o,x:s,y:l}}function j9(e,t){const n=ds(e,!0,t==="fixed"),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=Rt(e)?hl(e):Yi(1),o=e.clientWidth*a.x,s=e.clientHeight*a.y,l=i*a.x,c=r*a.y;return{width:o,height:s,x:l,y:c}}function D_(e,t,n){let r;if(t==="viewport")r=C9(e,n);else if(t==="document")r=E9(pa(e));else if(st(t))r=j9(t,n);else{const i=iR(e);r={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return sp(r)}function oR(e,t){const n=ta(e);return n===t||!st(n)||Ki(n)?!1:Pr(n).position==="fixed"||oR(n,t)}function P9(e,t){const n=t.get(e);if(n)return n;let r=au(e,[],!1).filter(s=>st(s)&&Xn(s)!=="body"),i=null;const a=Pr(e).position==="fixed";let o=a?ta(e):e;for(;st(o)&&!Ki(o);){const s=Pr(o),l=m0(o);!l&&s.position==="fixed"&&(i=null),(a?!l&&!i:!l&&s.position==="static"&&!!i&&(i.position==="absolute"||i.position==="fixed")||jo(o)&&!l&&oR(e,o))?r=r.filter(d=>d!==o):i=s,o=ta(o)}return t.set(e,r),r}function N9(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const o=[...n==="clippingAncestors"?kh(t)?[]:P9(t,this._c):[].concat(n),r],s=D_(t,o[0],i);let l=s.top,c=s.right,d=s.bottom,u=s.left;for(let p=1;p<o.length;p++){const h=D_(t,o[p],i);l=Ir(h.top,l),c=Tl(h.right,c),d=Tl(h.bottom,d),u=Ir(h.left,u)}return{width:c-u,height:d-l,x:u,y:l}}function T9(e){const{width:t,height:n}=rR(e);return{width:t,height:n}}function O9(e,t,n){const r=Rt(t),i=pa(t),a=n==="fixed",o=ds(e,!0,a,t);let s={scrollLeft:0,scrollTop:0};const l=Yi(0);function c(){l.x=Nh(i)}if(r||!r&&!a)if((Xn(t)!=="body"||jo(i))&&(s=Sh(t)),r){const h=ds(t,!0,a,t);l.x=h.x+t.clientLeft,l.y=h.y+t.clientTop}else i&&c();a&&!r&&i&&c();const d=i&&!r&&!a?aR(i,s):Yi(0),u=o.left+s.scrollLeft-l.x-d.x,p=o.top+s.scrollTop-l.y-d.y;return{x:u,y:p,width:o.width,height:o.height}}function cg(e){return Pr(e).position==="static"}function L_(e,t){if(!Rt(e)||Pr(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return pa(e)===n&&(n=n.ownerDocument.body),n}function sR(e,t){const n=an(e);if(kh(e))return n;if(!Rt(e)){let i=ta(e);for(;i&&!Ki(i);){if(st(i)&&!cg(i))return i;i=ta(i)}return n}let r=L_(e,t);for(;r&&G8(r)&&cg(r);)r=L_(r,t);return r&&Ki(r)&&cg(r)&&!m0(r)?n:r||Z8(e)||n}const A9=async function(e){const t=this.getOffsetParent||sR,n=this.getDimensions,r=await n(e.floating);return{reference:O9(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function R9(e){return Pr(e).direction==="rtl"}const M9={convertOffsetParentRelativeRectToViewportRelativeRect:_9,getDocumentElement:pa,getClippingRect:N9,getOffsetParent:sR,getElementRects:A9,getClientRects:S9,getDimensions:T9,getScale:hl,isElement:st,isRTL:R9};function lR(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function I9(e,t){let n=null,r;const i=pa(e);function a(){var s;clearTimeout(r),(s=n)==null||s.disconnect(),n=null}function o(s,l){s===void 0&&(s=!1),l===void 0&&(l=1),a();const c=e.getBoundingClientRect(),{left:d,top:u,width:p,height:h}=c;if(s||t(),!p||!h)return;const y=Qo(u),g=Qo(i.clientWidth-(d+p)),x=Qo(i.clientHeight-(u+h)),v=Qo(d),w={rootMargin:-y+"px "+-g+"px "+-x+"px "+-v+"px",threshold:Ir(0,Tl(1,l))||1};let _=!0;function k(S){const E=S[0].intersectionRatio;if(E!==l){if(!_)return o();E?o(!1,E):r=setTimeout(()=>{o(!1,1e-7)},1e3)}E===1&&!lR(c,e.getBoundingClientRect())&&o(),_=!1}try{n=new IntersectionObserver(k,{...w,root:i.ownerDocument})}catch{n=new IntersectionObserver(k,w)}n.observe(e)}return o(!0),a}function $_(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:s=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,c=N0(e),d=i||a?[...c?au(c):[],...t?au(t):[]]:[];d.forEach(v=>{i&&v.addEventListener("scroll",n,{passive:!0}),a&&v.addEventListener("resize",n)});const u=c&&s?I9(c,n):null;let p=-1,h=null;o&&(h=new ResizeObserver(v=>{let[b]=v;b&&b.target===c&&h&&t&&(h.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var w;(w=h)==null||w.observe(t)})),n()}),c&&!l&&h.observe(c),t&&h.observe(t));let y,g=l?ds(e):null;l&&x();function x(){const v=ds(e);g&&!lR(g,v)&&n(),g=v,y=requestAnimationFrame(x)}return n(),()=>{var v;d.forEach(b=>{i&&b.removeEventListener("scroll",n),a&&b.removeEventListener("resize",n)}),u?.(),(v=h)==null||v.disconnect(),h=null,l&&cancelAnimationFrame(y)}}const D9=y9,L9=v9,$9=h9,z9=b9,F9=m9,B9=x9,W9=(e,t,n)=>{const r=new Map,i={platform:M9,...n},a={...i.platform,_c:r};return p9(e,t,{...i,platform:a})};var H9=typeof document<"u",U9=function(){},Pf=H9?m.useLayoutEffect:U9;function cp(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!cp(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){const a=i[r];if(!(a==="_owner"&&e.$$typeof)&&!cp(e[a],t[a]))return!1}return!0}return e!==e&&t!==t}function cR(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function z_(e,t){const n=cR(e);return Math.round(t*n)/n}function ug(e){const t=m.useRef(e);return Pf(()=>{t.current=e}),t}function V9(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:l,open:c}=e,[d,u]=m.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,h]=m.useState(r);cp(p,r)||h(r);const[y,g]=m.useState(null),[x,v]=m.useState(null),b=m.useCallback(V=>{V!==S.current&&(S.current=V,g(V))},[]),w=m.useCallback(V=>{V!==E.current&&(E.current=V,v(V))},[]),_=a||y,k=o||x,S=m.useRef(null),E=m.useRef(null),C=m.useRef(d),j=l!=null,T=ug(l),A=ug(i),R=ug(c),D=m.useCallback(()=>{if(!S.current||!E.current)return;const V={placement:t,strategy:n,middleware:p};A.current&&(V.platform=A.current),W9(S.current,E.current,V).then(F=>{const N={...F,isPositioned:R.current!==!1};M.current&&!cp(C.current,N)&&(C.current=N,oi.flushSync(()=>{u(N)}))})},[p,t,n,A,R]);Pf(()=>{c===!1&&C.current.isPositioned&&(C.current.isPositioned=!1,u(V=>({...V,isPositioned:!1})))},[c]);const M=m.useRef(!1);Pf(()=>(M.current=!0,()=>{M.current=!1}),[]),Pf(()=>{if(_&&(S.current=_),k&&(E.current=k),_&&k){if(T.current)return T.current(_,k,D);D()}},[_,k,D,T,j]);const O=m.useMemo(()=>({reference:S,floating:E,setReference:b,setFloating:w}),[b,w]),I=m.useMemo(()=>({reference:_,floating:k}),[_,k]),L=m.useMemo(()=>{const V={position:n,left:0,top:0};if(!I.floating)return V;const F=z_(I.floating,d.x),N=z_(I.floating,d.y);return s?{...V,transform:"translate("+F+"px, "+N+"px)",...cR(I.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:F,top:N}},[n,s,I.floating,d.x,d.y]);return m.useMemo(()=>({...d,update:D,refs:O,elements:I,floatingStyles:L}),[d,D,O,I,L])}const q9=(e,t)=>{const n=D9(e);return{name:n.name,fn:n.fn,options:[e,t]}},K9=(e,t)=>{const n=L9(e);return{name:n.name,fn:n.fn,options:[e,t]}},G9=(e,t)=>({fn:B9(e).fn,options:[e,t]}),Y9=(e,t)=>{const n=$9(e);return{name:n.name,fn:n.fn,options:[e,t]}},X9=(e,t)=>{const n=z9(e);return{name:n.name,fn:n.fn,options:[e,t]}},Z9=(e,t)=>{const n=F9(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ye=(e,t,n,r,i,a,...o)=>{if(o.length>0)throw new Error(fa(1));let s;if(e)s=e;else throw new Error("Missing arguments");return s};function Q9(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function J9(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!="object")throw new TypeError(t)}function e7(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(n=>typeof n=="function")){const n=e.map(r=>typeof r=="function"?`function ${r.name||"unnamed"}()`:typeof r).join(", ");throw new TypeError(`${t}[${n}]`)}}var F_=e=>Array.isArray(e)?e:[e];function t7(e){const t=Array.isArray(e[0])?e[0]:e;return e7(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function n7(e,t){const n=[],{length:r}=e;for(let i=0;i<r;i++)n.push(e[i].apply(null,t));return n}var r7=class{constructor(e){this.value=e}deref(){return this.value}},i7=typeof WeakRef<"u"?WeakRef:r7,a7=0,B_=1;function jd(){return{s:a7,v:void 0,o:null,p:null}}function uR(e,t={}){let n=jd();const{resultEqualityCheck:r}=t;let i,a=0;function o(){let s=n;const{length:l}=arguments;for(let u=0,p=l;u<p;u++){const h=arguments[u];if(typeof h=="function"||typeof h=="object"&&h!==null){let y=s.o;y===null&&(s.o=y=new WeakMap);const g=y.get(h);g===void 0?(s=jd(),y.set(h,s)):s=g}else{let y=s.p;y===null&&(s.p=y=new Map);const g=y.get(h);g===void 0?(s=jd(),y.set(h,s)):s=g}}const c=s;let d;if(s.s===B_)d=s.v;else if(d=e.apply(null,arguments),a++,r){const u=i?.deref?.()??i;u!=null&&r(u,d)&&(d=u,a!==0&&a--),i=typeof d=="object"&&d!==null||typeof d=="function"?new i7(d):d}return c.s=B_,c.v=d,d}return o.clearCache=()=>{n=jd(),o.resetResultsCount()},o.resultsCount=()=>a,o.resetResultsCount=()=>{a=0},o}function o7(e,...t){const n=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,r=(...i)=>{let a=0,o=0,s,l={},c=i.pop();typeof c=="object"&&(l=c,c=i.pop()),Q9(c,`createSelector expects an output function after the inputs, but received: [${typeof c}]`);const d={...n,...l},{memoize:u,memoizeOptions:p=[],argsMemoize:h=uR,argsMemoizeOptions:y=[]}=d,g=F_(p),x=F_(y),v=t7(i),b=u(function(){return a++,c.apply(null,arguments)},...g),w=h(function(){o++;const k=n7(v,arguments);return s=b.apply(null,k),s},...x);return Object.assign(w,{resultFunc:c,memoizedResultFunc:b,dependencies:v,dependencyRecomputations:()=>o,resetDependencyRecomputations:()=>{o=0},lastResult:()=>s,recomputations:()=>a,resetRecomputations:()=>{a=0},memoize:u,argsMemoize:h})};return Object.assign(r,{withTypes:()=>r}),r}var J=o7(uR),s7=Object.assign((e,t=J)=>{J9(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);const n=Object.keys(e),r=n.map(a=>e[a]);return t(r,(...a)=>a.reduce((o,s,l)=>(o[n[l]]=s,o),{}))},{withTypes:()=>s7}),dg={exports:{}},fg={};var W_;function l7(){if(W_)return fg;W_=1;var e=cb(),t=iO();function n(c,d){return c===d&&(c!==0||1/c===1/d)||c!==c&&d!==d}var r=typeof Object.is=="function"?Object.is:n,i=t.useSyncExternalStore,a=e.useRef,o=e.useEffect,s=e.useMemo,l=e.useDebugValue;return fg.useSyncExternalStoreWithSelector=function(c,d,u,p,h){var y=a(null);if(y.current===null){var g={hasValue:!1,value:null};y.current=g}else g=y.current;y=s(function(){function v(S){if(!b){if(b=!0,w=S,S=p(S),h!==void 0&&g.hasValue){var E=g.value;if(h(E,S))return _=E}return _=S}if(E=_,r(w,S))return E;var C=p(S);return h!==void 0&&h(E,C)?(w=S,E):(w=S,_=C)}var b=!1,w,_,k=u===void 0?null:u;return[function(){return v(d())},k===null?void 0:function(){return v(k())}]},[d,u,p,h]);var x=i(c,y[0],y[1]);return o(function(){g.hasValue=!0,g.value=x},[x]),l(x),x},fg}var H_;function c7(){return H_||(H_=1,dg.exports=l7()),dg.exports}var dR=c7();const Xv=[];let Zv;function u7(){return Zv}function d7(e){Xv.push(e)}function fR(e){const t=(n,r)=>{const i=cr(p7).current;let a;try{Zv=i;for(const o of Xv)o.before(i);a=e(n,r);for(const o of Xv)o.after(i);i.didInitialize=!0}finally{Zv=void 0}return a};return t.displayName=e.displayName||e.name,t}function f7(e){return m.forwardRef(fR(e))}function p7(){return{didInitialize:!1}}const h7=u0(19),m7=h7?y7:v7;function pR(e,t,n,r,i){return m7(e,t,n,r,i)}function g7(e,t,n,r,i){const a=m.useCallback(()=>t(e.getSnapshot(),n,r,i),[e,t,n,r,i]);return Mb.useSyncExternalStore(e.subscribe,a,a)}d7({before(e){e.syncIndex=0,e.didInitialize||(e.syncTick=1,e.syncHooks=[],e.didChangeStore=!0,e.getSnapshot=()=>{let t=!1;for(let n=0;n<e.syncHooks.length;n+=1){const r=e.syncHooks[n],i=r.selector(r.store.state,r.a1,r.a2,r.a3);(r.didChange||!Object.is(r.value,i))&&(t=!0,r.value=i,r.didChange=!1)}return t&&(e.syncTick+=1),e.syncTick})},after(e){e.syncHooks.length>0&&(e.didChangeStore&&(e.didChangeStore=!1,e.subscribe=t=>{const n=new Set;for(const i of e.syncHooks)n.add(i.store);const r=[];for(const i of n)r.push(i.subscribe(t));return()=>{for(const i of r)i()}}),Mb.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot))}});function y7(e,t,n,r,i){const a=u7();if(!a)return g7(e,t,n,r,i);const o=a.syncIndex;a.syncIndex+=1;let s;return a.didInitialize?(s=a.syncHooks[o],(s.store!==e||s.selector!==t||!Object.is(s.a1,n)||!Object.is(s.a2,r)||!Object.is(s.a3,i))&&(s.store!==e&&(a.didChangeStore=!0),s.store=e,s.selector=t,s.a1=n,s.a2=r,s.a3=i,s.didChange=!0)):(s={store:e,selector:t,a1:n,a2:r,a3:i,value:t(e.getSnapshot(),n,r,i),didChange:!1},a.syncHooks.push(s)),s.value}function v7(e,t,n,r,i){return dR.useSyncExternalStoreWithSelector(e.subscribe,e.getSnapshot,e.getSnapshot,a=>t(a,n,r,i))}class x7{constructor(t){this.state=t,this.listeners=new Set,this.updateTick=0}subscribe=t=>(this.listeners.add(t),()=>{this.listeners.delete(t)});getSnapshot=()=>this.state;setState(t){if(this.state===t)return;this.state=t,this.updateTick+=1;const n=this.updateTick;for(const r of this.listeners){if(n!==this.updateTick)return;r(t)}}update(t){for(const n in t)if(!Object.is(this.state[n],t[n])){this.setState({...this.state,...t});return}}set(t,n){Object.is(this.state[t],n)||this.setState({...this.state,[t]:n})}notifyAll(){const t={...this.state};this.setState(t)}use(t,n,r,i){return pR(this,t,n,r,i)}}class T0 extends x7{constructor(t,n={},r){super(t),this.context=n,this.selectors=r}useSyncedValue(t,n){m.useDebugValue(t),Ge(()=>{this.state[t]!==n&&this.set(t,n)},[t,n])}useSyncedValueWithCleanup(t,n){const r=this;Ge(()=>(r.state[t]!==n&&r.set(t,n),()=>{r.set(t,void 0)}),[r,t,n])}useSyncedValues(t){const n=this,r=Object.values(t);Ge(()=>{n.update(t)},[n,...r])}useControlledProp(t,n){m.useDebugValue(t);const r=n!==void 0;Ge(()=>{r&&!Object.is(this.state[t],n)&&super.setState({...this.state,[t]:n})},[t,n,r])}select(t,n,r,i){const a=this.selectors[t];return a(this.state,n,r,i)}useState(t,n,r,i){return m.useDebugValue(t),pR(this,this.selectors[t],n,r,i)}useContextCallback(t,n){m.useDebugValue(t);const r=et(n??d0);this.context[t]=r}useStateSetter(t){const n=m.useRef(void 0);return n.current===void 0&&(n.current=r=>{this.set(t,r)}),n.current}observe(t,n){let r;typeof t=="function"?r=t:r=this.selectors[t];let i=r(this.state);return n(i,i,this),this.subscribe(a=>{const o=r(a);if(!Object.is(i,o)){const s=i;i=o,n(o,s,this)}})}}const b7={open:Ye(e=>e.open),transitionStatus:Ye(e=>e.transitionStatus),domReferenceElement:Ye(e=>e.domReferenceElement),referenceElement:Ye(e=>e.positionReference??e.referenceElement),floatingElement:Ye(e=>e.floatingElement),floatingId:Ye(e=>e.floatingId)};class O0 extends T0{constructor(t){const{syncOnly:n,nested:r,onOpenChange:i,triggerElements:a,...o}=t;super({...o,positionReference:o.referenceElement,domReferenceElement:o.referenceElement},{onOpenChange:i,dataRef:{current:{}},events:XA(),nested:r,triggerElements:a},b7),this.syncOnly=n}syncOpenEvent=(t,n)=>{(!t||!this.state.open||n!=null&&TA(n))&&(this.context.dataRef.current.openEvent=t?n:void 0)};dispatchOpenChange=(t,n)=>{this.syncOpenEvent(t,n.event);const r={open:t,reason:n.reason,nativeEvent:n.event,nested:this.context.nested,triggerElement:n.trigger};this.context.events.emit("openchange",r)};setOpen=(t,n)=>{if(this.syncOnly){this.context.onOpenChange?.(t,n);return}this.dispatchOpenChange(t,n),this.context.onOpenChange?.(t,n)}}function w7(e,t=!1,n=!1){const[r,i]=m.useState(e&&t?"idle":void 0),[a,o]=m.useState(e);return e&&!a&&(o(!0),i("starting")),!e&&a&&r!=="ending"&&!n&&i("ending"),!e&&!a&&r==="ending"&&i(void 0),Ge(()=>{if(!e&&a&&r!=="ending"&&n){const s=Bi.request(()=>{i("ending")});return()=>{Bi.cancel(s)}}},[e,a,r,n]),Ge(()=>{if(!e||t)return;const s=Bi.request(()=>{i(void 0)});return()=>{Bi.cancel(s)}},[t,e]),Ge(()=>{if(!e||!t)return;e&&a&&r!=="idle"&&i("starting");const s=Bi.request(()=>{i("idle")});return()=>{Bi.cancel(s)}},[t,e,a,r]),{mounted:a,setMounted:o,transitionStatus:r}}function hR(e,t=!1,n=!0){const r=b0();return et((i,a=null)=>{r.cancel();const o=ga(e);if(o==null)return;const s=o,l=()=>{oi.flushSync(i)};if(typeof s.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED){i();return}function c(){Promise.all(s.getAnimations().map(d=>d.finished)).then(()=>{a?.aborted||l()}).catch(()=>{if(n){a?.aborted||l();return}const d=s.getAnimations();!a?.aborted&&d.length>0&&d.some(u=>u.pending||u.playState!=="finished")&&c()})}if(t){const d=iu.startingStyle;if(!s.hasAttribute(d)){r.request(c);return}const u=new MutationObserver(()=>{s.hasAttribute(d)||(u.disconnect(),c())});u.observe(s,{attributes:!0,attributeFilter:[d]}),a?.addEventListener("abort",()=>u.disconnect(),{once:!0});return}r.request(c)})}function A0(e){const{enabled:t=!0,open:n,ref:r,onComplete:i}=e,a=et(i),o=hR(r,n,!1);m.useEffect(()=>{if(!t)return;const s=new AbortController;return o(a,s.signal),()=>{s.abort()}},[t,n,a,o])}function k7(e,t){const n=m.useRef(null),r=m.useRef(null);return m.useCallback(i=>{if(e!==void 0){if(n.current!==null){const a=n.current,o=r.current,s=t.context.triggerElements.getById(a);o&&s===o&&t.context.triggerElements.delete(a),n.current=null,r.current=null}i!==null&&(n.current=e,r.current=i,t.context.triggerElements.add(e,i))}},[t,e])}function _7(e,t,n,r){const i=n.useState("isMountedByTrigger",e),a=k7(e,n),o=et(s=>{if(a(s),!s||!n.select("open"))return;const l=n.select("activeTriggerId");if(l===e){n.update({activeTriggerElement:s,...r});return}l==null&&n.update({activeTriggerId:e,activeTriggerElement:s,...r})});return Ge(()=>{i&&n.update({activeTriggerElement:t.current,...r})},[i,n,t,...Object.values(r)]),{registerTrigger:o,isMountedByThisTrigger:i}}function mR(e){const t=e.useState("open");Ge(()=>{if(t&&!e.select("activeTriggerId")&&e.context.triggerElements.size===1){const n=e.context.triggerElements.entries().next();if(!n.done){const[r,i]=n.value;e.update({activeTriggerId:r,activeTriggerElement:i})}}},[t,e])}function gR(e,t,n){const{mounted:r,setMounted:i,transitionStatus:a}=w7(e);t.useSyncedValues({mounted:r,transitionStatus:a});const o=et(()=>{i(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1}),n?.(),t.context.onOpenChangeComplete?.(!1)}),s=t.useState("preventUnmountingOnClose");return A0({enabled:!s,open:e,ref:t.context.popupRef,onComplete(){e||o()}}),{forceUnmount:o,transitionStatus:a}}class Th{constructor(){this.elementsSet=new Set,this.idMap=new Map}add(t,n){const r=this.idMap.get(t);r!==n&&(r!==void 0&&this.elementsSet.delete(r),this.elementsSet.add(n),this.idMap.set(t,n))}delete(t){const n=this.idMap.get(t);n&&(this.elementsSet.delete(n),this.idMap.delete(t))}hasElement(t){return this.elementsSet.has(t)}hasMatchingElement(t){for(const n of this.elementsSet)if(t(n))return!0;return!1}getById(t){return this.idMap.get(t)}entries(){return this.idMap.entries()}elements(){return this.elementsSet.values()}get size(){return this.idMap.size}}function S7(){return new O0({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:new Th,floatingId:"",syncOnly:!1,nested:!1,onOpenChange:void 0})}function yR(){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:S7(),preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:Bn,inactiveTriggerProps:Bn,popupProps:Bn}}const Pd=Ye(e=>e.triggerIdProp??e.activeTriggerId),vR={open:Ye(e=>e.openProp??e.open),mounted:Ye(e=>e.mounted),transitionStatus:Ye(e=>e.transitionStatus),floatingRootContext:Ye(e=>e.floatingRootContext),preventUnmountingOnClose:Ye(e=>e.preventUnmountingOnClose),payload:Ye(e=>e.payload),activeTriggerId:Pd,activeTriggerElement:Ye(e=>e.mounted?e.activeTriggerElement:null),isTriggerActive:Ye((e,t)=>t!==void 0&&Pd(e)===t),isOpenedByTrigger:Ye((e,t)=>t!==void 0&&Pd(e)===t&&e.open),isMountedByTrigger:Ye((e,t)=>t!==void 0&&Pd(e)===t&&e.mounted),triggerProps:Ye((e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps),popupProps:Ye(e=>e.popupProps),popupElement:Ye(e=>e.popupElement),positionerElement:Ye(e=>e.positionerElement)};function E7(e){const{open:t=!1,onOpenChange:n,elements:r={}}=e,i=Es(),a=$a()!=null,o=cr(()=>new O0({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new Th,floatingId:i,syncOnly:!1,nested:a})).current;return Ge(()=>{const s={open:t,floatingId:i};r.reference!==void 0&&(s.referenceElement=r.reference,s.domReferenceElement=st(r.reference)?r.reference:null),r.floating!==void 0&&(s.floatingElement=r.floating),o.update(s)},[t,i,r.reference,r.floating,o]),o.context.onOpenChange=n,o.context.nested=a,o}function C7(e={}){const{nodeId:t,externalTree:n}=e,r=E7(e),i=e.rootContext||r,a={reference:i.useState("referenceElement"),floating:i.useState("floatingElement"),domReference:i.useState("domReferenceElement")},[o,s]=m.useState(null),l=m.useRef(null),c=No(n);Ge(()=>{a.domReference&&(l.current=a.domReference)},[a.domReference]);const d=V9({...e,elements:{...a,...o&&{reference:o}}}),u=m.useCallback(C=>{const j=st(C)?{getBoundingClientRect:()=>C.getBoundingClientRect(),getClientRects:()=>C.getClientRects(),contextElement:C}:C;s(j),d.refs.setReference(j)},[d.refs]),[p,h]=m.useState(void 0),[y,g]=m.useState(null);i.useSyncedValue("referenceElement",p??null);const x=st(p)?p:null;i.useSyncedValue("domReferenceElement",p===void 0?a.domReference:x),i.useSyncedValue("floatingElement",y);const v=m.useCallback(C=>{(st(C)||C===null)&&(l.current=C,h(C)),(st(d.refs.reference.current)||d.refs.reference.current===null||C!==null&&!st(C))&&d.refs.setReference(C)},[d.refs,h]),b=m.useCallback(C=>{g(C),d.refs.setFloating(C)},[d.refs]),w=m.useMemo(()=>({...d.refs,setReference:v,setFloating:b,setPositionReference:u,domReference:l}),[d.refs,v,b,u]),_=m.useMemo(()=>({...d.elements,domReference:a.domReference}),[d.elements,a.domReference]),k=i.useState("open"),S=i.useState("floatingId"),E=m.useMemo(()=>({...d,dataRef:i.context.dataRef,open:k,onOpenChange:i.setOpen,events:i.context.events,floatingId:S,refs:w,elements:_,nodeId:t,rootStore:i}),[d,w,_,t,i,k,S]);return Ge(()=>{i.context.dataRef.current.floatingContext=E;const C=c?.nodesRef.current.find(j=>j.id===t);C&&(C.context=E)}),m.useMemo(()=>({...d,context:E,refs:w,elements:_,rootStore:i}),[d,w,_,E,i])}function xR(e){const{popupStore:t,treatPopupAsFloatingElement:n=!1,onOpenChange:r}=e,i=Es(),a=$a()!=null,o=t.useState("open"),s=t.useState("activeTriggerElement"),l=t.useState(n?"popupElement":"positionerElement"),c=t.context.triggerElements,d=cr(()=>new O0({open:o,transitionStatus:void 0,referenceElement:s,floatingElement:l,triggerElements:c,onOpenChange:r,floatingId:i,syncOnly:!0,nested:a})).current;return Ge(()=>{const u={open:o,floatingId:i,referenceElement:s,floatingElement:l};st(s)&&(u.domReferenceElement=s),d.state.positionReference===d.state.referenceElement&&(u.positionReference=s),d.update(u)},[o,i,s,l,d]),d.context.onOpenChange=r,d.context.nested=a,d}const pg=CA&&EA;function j7(e,t={}){const n="rootStore"in e?e.rootStore:e,{events:r,dataRef:i}=n.context,{enabled:a=!0,delay:o}=t,s=m.useRef(!1),l=m.useRef(null),c=Fr(),d=m.useRef(!0);m.useEffect(()=>{const p=n.select("domReferenceElement");if(!a)return;const h=an(p);function y(){const v=n.select("domReferenceElement");!n.select("open")&&Rt(v)&&v===Qr(ut(v))&&(s.current=!0)}function g(){d.current=!0}function x(){d.current=!1}return Gi(ot(h,"blur",y),pg&&ot(h,"keydown",g,!0),pg&&ot(h,"pointerdown",x,!0))},[n,a]),m.useEffect(()=>{if(!a)return;function p(h){if(h.reason===ou||h.reason===v0){const y=n.select("domReferenceElement");st(y)&&(l.current=y,s.current=!0)}}return r.on("openchange",p),()=>{r.off("openchange",p)}},[r,a,n]);const u=m.useMemo(()=>({onMouseLeave(){s.current=!1,l.current=null},onFocus(p){const h=p.currentTarget;if(s.current){if(l.current===h)return;s.current=!1,l.current=null}const y=wr(p.nativeEvent);if(st(y)){if(pg&&!p.relatedTarget){if(!d.current&&!jh(y))return}else if(!kU(y))return}const g=rp(p.relatedTarget,n.context.triggerElements),{nativeEvent:x,currentTarget:v}=p,b=typeof o=="function"?o():o;if(n.select("open")&&g||b===0||b===void 0){n.setOpen(!0,dt(Fc,x,v));return}c.start(b,()=>{s.current||n.setOpen(!0,dt(Fc,x,v))})},onBlur(p){s.current=!1,l.current=null;const h=p.relatedTarget,y=p.nativeEvent,g=st(h)&&h.hasAttribute(lu("focus-guard"))&&h.getAttribute("data-type")==="outside";c.start(0,()=>{const x=n.select("domReferenceElement"),v=Qr(ut(x));!h&&v===x||Qe(i.current.floatingContext?.refs.floating.current,v)||Qe(x,v)||g||rp(h??v,n.context.triggerElements)||n.setOpen(!1,dt(Fc,y))})}}),[i,n,c,o]);return m.useMemo(()=>a?{reference:u,trigger:u}:{},[a,u])}class R0{constructor(){this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new na,this.restTimeout=new na,this.handleCloseOptions=void 0}static create(){return new R0}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose}const up=new WeakMap;function dp(e){if(!e.performedPointerEventsMutation)return;const t=e.pointerEventsScopeElement;t&&up.get(t)===e&&(e.pointerEventsScopeElement?.style.removeProperty("pointer-events"),e.pointerEventsReferenceElement?.style.removeProperty("pointer-events"),e.pointerEventsFloatingElement?.style.removeProperty("pointer-events"),up.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function bR(e,t){const{scopeElement:n,referenceElement:r,floatingElement:i}=t,a=up.get(n);a&&a!==e&&dp(a),dp(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=n,e.pointerEventsReferenceElement=r,e.pointerEventsFloatingElement=i,up.set(n,e),n.style.pointerEvents="none",r.style.pointerEvents="auto",i.style.pointerEvents="auto"}function wR(e){const t=cr(R0.create).current,n=e.context.dataRef.current;return n.hoverInteractionState||(n.hoverInteractionState=t),x0(n.hoverInteractionState.disposeEffect),n.hoverInteractionState}function P7(e,t={}){const n="rootStore"in e?e.rootStore:e,r=n.useState("open"),i=n.useState("floatingElement"),a=n.useState("domReferenceElement"),{dataRef:o}=n.context,{enabled:s=!0,closeDelay:l=0,nodeId:c}=t,d=wR(n),u=No(),p=$a(),h=et(()=>OA(o.current.openEvent?.type,d.interactedInside)),y=et(()=>{const _=o.current.openEvent?.type;return _?.includes("mouse")&&_!=="mousedown"}),g=et(_=>rp(_,n.context.triggerElements)),x=m.useCallback(_=>{const k=Hv(l,"close",d.pointerType),S=()=>{n.setOpen(!1,dt(gr,_)),u?.events.emit("floating.closed",_)};k?d.openChangeTimeout.start(k,S):(d.openChangeTimeout.clear(),S())},[l,n,d,u]),v=et(()=>{dp(d)}),b=et(_=>{const k=wr(_);if(!wU(k)){d.interactedInside=!1;return}d.interactedInside=k?.closest("[aria-haspopup]")!=null});Ge(()=>{r||(d.pointerType=void 0,d.restTimeoutPending=!1,d.interactedInside=!1,v())},[r,d,v]),m.useEffect(()=>v,[v]),Ge(()=>{if(s&&r&&d.handleCloseOptions?.blockPointerEvents&&y()&&st(a)&&i){const _=a,k=i,S=ut(i),E=u?.nodesRef.current.find(j=>j.id===p)?.context?.elements.floating;E&&(E.style.pointerEvents="");const C=d.handleCloseOptions?.getScope?.()??d.pointerEventsScopeElement??E??_.closest("[data-rootownerid]")??S.body;return bR(d,{scopeElement:C,referenceElement:_,floatingElement:k}),()=>{v()}}},[s,r,a,i,d,y,u,p,v]);const w=Fr();m.useEffect(()=>{if(!s)return;function _(){d.openChangeTimeout.clear(),w.clear(),u?.events.off("floating.closed",S),v()}function k(C){if(u&&p&&Xi(u.nodesRef.current,p).length>0){u.events.on("floating.closed",S);return}if(g(C.relatedTarget))return;const j=o.current.floatingContext?.nodeId??c,T=C.relatedTarget;if(!(u&&j&&st(T)&&Xi(u.nodesRef.current,j,!1).some(R=>Qe(R.context?.elements.floating,T)))){if(d.handler){d.handler(C);return}v(),h()||x(C)}}function S(C){!u||!p||Xi(u.nodesRef.current,p).length>0||w.start(0,()=>{u.events.off("floating.closed",S),n.setOpen(!1,dt(gr,C)),u.events.emit("floating.closed",C)})}const E=i;return Gi(E&&ot(E,"mouseenter",_),E&&ot(E,"mouseleave",k),E&&ot(E,"pointerdown",b,!0),()=>{u?.events.off("floating.closed",S)})},[s,i,n,o,c,h,g,x,v,b,d,u,p,w])}const N7={current:null};function T7(e,t={}){const n="rootStore"in e?e.rootStore:e,{dataRef:r,events:i}=n.context,{enabled:a=!0,delay:o=0,handleClose:s=null,mouseOnly:l=!1,restMs:c=0,move:d=!0,triggerElementRef:u=N7,externalTree:p,isActiveTrigger:h=!0,getHandleCloseContext:y,isClosing:g}=t,x=No(p),v=wR(n),b=m.useRef(!1),w=Fn(s),_=Fn(o),k=Fn(c),S=Fn(a),E=Fn(g);h&&(v.handleCloseOptions=w.current?.__options);const C=et(()=>OA(r.current.openEvent?.type,v.interactedInside)),j=et(M=>rp(M,n.context.triggerElements)),T=et((M,O,I)=>{const L=n.context.triggerElements;if(L.hasElement(O))return!M||!Qe(M,O);if(!st(I))return!1;const V=I;return L.hasMatchingElement(F=>Qe(F,V))&&(!M||!Qe(M,V))}),A=et((M,O=!0)=>{const I=Hv(_.current,"close",v.pointerType);I?v.openChangeTimeout.start(I,()=>{n.setOpen(!1,dt(gr,M)),x?.events.emit("floating.closed",M)}):O&&(v.openChangeTimeout.clear(),n.setOpen(!1,dt(gr,M)),x?.events.emit("floating.closed",M))}),R=et(()=>{if(!v.handler)return;ut(n.select("domReferenceElement")).removeEventListener("mousemove",v.handler),v.handler=void 0}),D=et(()=>{dp(v)});return m.useEffect(()=>R,[R]),m.useEffect(()=>{if(!a)return;function M(O){O.open?b.current=!1:(b.current=O.reason===gr,R(),v.openChangeTimeout.clear(),v.restTimeout.clear(),v.blockMouseMove=!0,v.restTimeoutPending=!1)}return i.on("openchange",M),()=>{i.off("openchange",M)}},[a,i,v,R]),m.useEffect(()=>{if(!a)return;const M=u.current??(h?n.select("domReferenceElement"):null);if(!st(M))return;function O(L){if(v.openChangeTimeout.clear(),v.blockMouseMove=!1,l&&!su(v.pointerType))return;const V=b_(k.current),F=Hv(_.current,"open",v.pointerType),N=wr(L),ee=L.currentTarget??null,Q=n.select("domReferenceElement");let P=ee;if(st(N)&&!n.context.triggerElements.hasElement(N)){for(const G of n.context.triggerElements.elements())if(Qe(G,N)){P=G;break}}st(ee)&&st(Q)&&!n.context.triggerElements.hasElement(ee)&&Qe(ee,Q)&&(P=Q);const z=P==null?!1:T(Q,P,N),$=n.select("open"),H=E.current?.()??n.select("transitionStatus")==="ending",oe=!$&&H&&b.current,q=!z&&st(P)&&st(Q)&&Qe(Q,P)&&oe,X=V>0&&!F,te=z&&($||oe)||q,ue=!$||z;if(te){n.setOpen(!0,dt(gr,L,P));return}X||(F?v.openChangeTimeout.start(F,()=>{ue&&n.setOpen(!0,dt(gr,L,P))}):ue&&n.setOpen(!0,dt(gr,L,P)))}function I(L){if(C()){D();return}R();const V=n.select("domReferenceElement"),F=ut(V);v.restTimeout.clear(),v.restTimeoutPending=!1;const N=r.current.floatingContext??y?.();if(j(L.relatedTarget))return;if(w.current&&N){n.select("open")||v.openChangeTimeout.clear();const P=u.current;v.handler=w.current({...N,tree:x,x:L.clientX,y:L.clientY,onClose(){D(),R(),S.current&&!C()&&P===n.select("domReferenceElement")&&A(L,!0)}}),F.addEventListener("mousemove",v.handler),v.handler(L);return}(v.pointerType!=="touch"||!Qe(n.select("floatingElement"),L.relatedTarget))&&A(L)}return d?Gi(ot(M,"mousemove",O,{once:!0}),ot(M,"mouseenter",O),ot(M,"mouseleave",I)):Gi(ot(M,"mouseenter",O),ot(M,"mouseleave",I))},[R,D,r,_,A,n,a,w,v,h,T,C,j,l,d,k,u,x,S,y,E]),m.useMemo(()=>{if(!a)return;function M(O){v.pointerType=O.pointerType}return{onPointerDown:M,onPointerEnter:M,onMouseMove(O){const{nativeEvent:I}=O,L=O.currentTarget,V=n.select("domReferenceElement"),F=n.select("open"),N=T(V,L,O.target);if(l&&!su(v.pointerType))return;if(F&&N&&v.handleCloseOptions?.blockPointerEvents){const P=n.select("floatingElement");if(P){const z=v.handleCloseOptions?.getScope?.()??L.ownerDocument.body;bR(v,{scopeElement:z,referenceElement:L,floatingElement:P})}}const ee=b_(k.current);if(F&&!N||ee===0||!N&&v.restTimeoutPending&&O.movementX**2+O.movementY**2<2)return;v.restTimeout.clear();function Q(){if(v.restTimeoutPending=!1,C())return;const P=n.select("open");!v.blockMouseMove&&(!P||N)&&n.setOpen(!0,dt(gr,I,L))}v.pointerType==="touch"?oi.flushSync(()=>{Q()}):N&&F?Q():(v.restTimeoutPending=!0,v.restTimeout.start(ee,Q))}}},[a,v,C,T,l,n,k])}function M0(e=[]){const t=e.map(c=>c?.reference),n=e.map(c=>c?.floating),r=e.map(c=>c?.item),i=e.map(c=>c?.trigger),a=m.useCallback(c=>Nd(c,e,"reference"),t),o=m.useCallback(c=>Nd(c,e,"floating"),n),s=m.useCallback(c=>Nd(c,e,"item"),r),l=m.useCallback(c=>Nd(c,e,"trigger"),i);return m.useMemo(()=>({getReferenceProps:a,getFloatingProps:o,getItemProps:s,getTriggerProps:l}),[a,o,s,l])}function Nd(e,t,n){const r=new Map,i=n==="item",a={};n==="floating"&&(a.tabIndex=-1,a[Uv]="");for(const o in e)i&&e&&(o===AA||o===RA)||(a[o]=e[o]);for(let o=0;o<t.length;o+=1){let s;const l=t[o]?.[n];typeof l=="function"?s=e?l(e):null:s=l,s&&U_(a,s,i,r)}return U_(a,e,i,r),a}function U_(e,t,n,r){for(const i in t){const a=t[i];n&&(i===AA||i===RA)||(i.startsWith("on")?(r.has(i)||r.set(i,[]),typeof a=="function"&&(r.get(i)?.push(a),e[i]=(...o)=>r.get(i)?.map(s=>s(...o)).find(s=>s!==void 0))):e[i]=a)}}const O7="Escape";function Oh(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function Td(e,t){return Oh(t,e===w0||e===$u,e===go||e===yo)}function hg(e,t,n){return Oh(t,e===$u,n?e===go:e===yo)||e==="Enter"||e===" "||e===""}function A7(e,t,n){return Oh(t,n?e===go:e===yo,e===$u)}function R7(e,t,n,r){const i=n?e===yo:e===go,a=e===w0;return t==="both"||t==="horizontal"&&r&&r>1?e===O7:Oh(t,i,a)}function M7(e,t){const n="rootStore"in e?e.rootStore:e,r=n.useState("open"),i=n.useState("floatingElement"),a=n.useState("domReferenceElement"),o=n.context.dataRef,{listRef:s,activeIndex:l,onNavigate:c=()=>{},enabled:d=!0,selectedIndex:u=null,allowEscape:p=!1,loopFocus:h=!1,nested:y=!1,rtl:g=!1,virtual:x=!1,focusItemOnOpen:v="auto",focusItemOnHover:b=!0,openOnArrowKeyDown:w=!0,disabledIndices:_=void 0,orientation:k="vertical",parentOrientation:S,cols:E=1,id:C,resetOnPointerLeave:j=!0,externalTree:T}=t,A=ip(i),R=Fn(A),D=$a(),M=No(T);Ge(()=>{o.current.orientation=k},[o,k]);const O=Vv(a),I=m.useRef(v),L=m.useRef(u??-1),V=m.useRef(null),F=m.useRef(!0),N=et(le=>{c(L.current===-1?null:L.current,le)}),ee=m.useRef(N),Q=m.useRef(!!i),P=m.useRef(r),z=m.useRef(!1),$=m.useRef(!1),H=m.useRef(null),oe=Fn(_),q=Fn(r),X=Fn(u),te=Fn(j),ue=et(()=>{function le(Se){x?M?.events.emit("virtualfocus",Se):H.current=jf(Se,{sync:z.current,preventScroll:!0})}const pe=s.current[L.current],K=$.current;pe&&le(pe),(z.current?Se=>Se():requestAnimationFrame)(()=>{const Se=s.current[L.current]||pe;if(!Se)return;pe||le(Se),xe&&(K||!F.current)&&Se.scrollIntoView?.({block:"nearest",inline:"nearest"})})});Ge(()=>{d&&(r&&i?(L.current=u??-1,I.current&&u!=null&&($.current=!0,N())):Q.current&&(L.current=-1,ee.current()))},[d,r,i,u,N]),Ge(()=>{if(d){if(!r){z.current=!1;return}if(i)if(l==null){if(z.current=!1,X.current!=null)return;if(Q.current&&(L.current=-1,ue()),(!P.current||!Q.current)&&I.current&&(V.current!=null||I.current===!0&&V.current==null)){let le=0;const pe=()=>{s.current[0]==null?(le<2&&(le?requestAnimationFrame:queueMicrotask)(pe),le+=1):(L.current=V.current==null||hg(V.current,k,g)||y?rg(s):__(s),V.current=null,N())};pe()}}else lp(s.current,l)||(L.current=l,ue(),$.current=!1)}},[d,r,i,l,X,y,s,k,g,N,ue,oe]),Ge(()=>{if(!d||i||!M||x||!Q.current)return;const le=M.nodesRef.current,pe=le.find(Se=>Se.id===D)?.context?.elements.floating,K=Qr(ut(i)),se=le.some(Se=>Se.context&&Qe(Se.context.elements.floating,K));pe&&!se&&F.current&&pe.focus({preventScroll:!0})},[d,i,M,D,x]),Ge(()=>{ee.current=N,P.current=r,Q.current=!!i}),Ge(()=>{r||(V.current=null,I.current=v)},[r,v]);const G=l!=null,be=et(le=>{if(!q.current)return;const pe=s.current.indexOf(le.currentTarget);pe!==-1&&(L.current!==pe||l!==pe)&&(L.current=pe,N(le))}),xe=m.useMemo(()=>({onFocus(pe){z.current=!0,be(pe)},onClick:({currentTarget:pe})=>pe.focus({preventScroll:!0}),onMouseMove(pe){z.current=!0,$.current=!1,b&&be(pe)},onPointerLeave(pe){if(!q.current||!F.current||pe.pointerType==="touch")return;z.current=!0;const K=pe.relatedTarget;if(!(!b||s.current.includes(K))&&te.current&&(H.current?.(),H.current=null,L.current=-1,N(pe),!x)){const se=R.current,Se=Qr(ut(se));se&&Qe(se,Se)&&se.focus({preventScroll:!0})}}}),[be,q,R,b,s,N,te,x]),Ae=m.useCallback(()=>S??M?.nodesRef.current.find(le=>le.id===D)?.context?.dataRef?.current.orientation,[D,M,S]),ge=et(le=>{if(F.current=!1,z.current=!0,le.which===229||!q.current&&le.currentTarget===R.current)return;if(y&&R7(le.key,k,g,E)){Td(le.key,Ae())||Mr(le),n.setOpen(!1,dt(Cf,le.nativeEvent)),Rt(a)&&(x?M?.events.emit("virtualfocus",a):a.focus());return}const pe=L.current,K=rg(s,_),se=__(s,_);if(O||(le.key==="Home"&&(Mr(le),L.current=K,N(le)),le.key==="End"&&(Mr(le),L.current=se,N(le))),E>1){const Se=Array.from({length:s.current.length},()=>({width:1,height:1})),Z=RU(Se,E),U=Z.findIndex(Re=>Re!=null&&!fl(s.current,Re,_)),fe=Z.reduce((Re,Ee,Ne)=>Ee!=null&&!fl(s.current,Ee,_)?Ne:Re,-1),we=Z[AU(Z.map(Re=>Re!=null?s.current[Re]:null),{event:le,orientation:k,loopFocus:h,rtl:g,cols:E,disabledIndices:IU([...(typeof _!="function"?_:null)||s.current.map((Re,Ee)=>fl(s.current,Ee,_)?Ee:void 0),void 0],Z),minIndex:U,maxIndex:fe,prevIndex:MU(L.current>se?K:L.current,Se,Z,E,le.key===$u?"bl":le.key===(g?go:yo)?"tr":"tl"),stopEvent:!0})];if(we!=null&&(L.current=we,N(le)),k==="both")return}if(Td(le.key,k)){if(Mr(le),r&&!x&&Qr(le.currentTarget.ownerDocument)===le.currentTarget){L.current=hg(le.key,k,g)?K:se,N(le);return}hg(le.key,k,g)?h?pe>=se?p&&pe!==s.current.length?L.current=-1:(z.current=!1,L.current=K):L.current=er(s.current,{startingIndex:pe,disabledIndices:_}):L.current=Math.min(se,er(s.current,{startingIndex:pe,disabledIndices:_})):h?pe<=K?p&&pe!==-1?L.current=s.current.length:(z.current=!1,L.current=se):L.current=er(s.current,{startingIndex:pe,decrement:!0,disabledIndices:_}):L.current=Math.max(K,er(s.current,{startingIndex:pe,decrement:!0,disabledIndices:_})),lp(s.current,L.current)&&(L.current=-1),N(le)}}),_e=m.useMemo(()=>x&&r&&G&&{"aria-activedescendant":`${C}-${l}`},[x,r,G,C,l]),De=m.useMemo(()=>({"aria-orientation":k==="both"?void 0:k,...O?{}:_e,onKeyDown(le){if(le.key==="Tab"&&le.shiftKey&&r&&!x){const pe=wr(le.nativeEvent);if(pe&&!Qe(R.current,pe))return;Mr(le),n.setOpen(!1,dt(Pl,le.nativeEvent)),Rt(a)&&a.focus();return}ge(le)},onPointerMove(){F.current=!0}}),[_e,ge,R,k,O,n,r,x,a]),ve=m.useMemo(()=>{function le(K){v==="auto"&&PA(K.nativeEvent)&&(I.current=!x)}function pe(K){I.current=v,v==="auto"&&NA(K.nativeEvent)&&(I.current=!0)}return{onKeyDown(K){const se=n.select("open");F.current=!1;const Se=K.key.startsWith("Arrow"),Z=A7(K.key,Ae(),g),U=Td(K.key,k),fe=(y?Z:U)||K.key==="Enter"||K.key.trim()==="";if(x&&se)return ge(K);if(!(!se&&!w&&Se)){if(fe){const we=Td(K.key,Ae());V.current=y&&we?null:K.key}if(y){Z&&(Mr(K),se?(L.current=rg(s,oe.current),N(K)):n.setOpen(!0,dt(Cf,K.nativeEvent,K.currentTarget)));return}U&&(X.current!=null&&(L.current=X.current),Mr(K),!se&&w?n.setOpen(!0,dt(Cf,K.nativeEvent,K.currentTarget)):ge(K),se&&N(K))}},onFocus(K){n.select("open")&&!x&&(L.current=-1,N(K))},onPointerDown:pe,onPointerEnter:pe,onMouseDown:le,onClick:le}},[ge,oe,v,s,y,N,n,w,k,Ae,g,X,x]),Le=m.useMemo(()=>({..._e,...ve}),[_e,ve]);return m.useMemo(()=>d?{reference:Le,floating:De,item:xe,trigger:ve}:{},[d,Le,De,ve,xe])}const I7=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function kR(e,t={}){const n="rootStore"in e?e.rootStore:e,r=n.useState("open"),i=n.useState("floatingId"),a=n.useState("domReferenceElement"),o=n.useState("floatingElement"),{role:s="dialog"}=t,l=Es(),c=a?.id||l,d=m.useMemo(()=>ip(o)?.id||i,[o,i]),u=I7.get(s)??s,h=$a()!=null,y=m.useMemo(()=>u==="tooltip"||s==="label"?Bn:{"aria-haspopup":u==="alertdialog"?"dialog":u,"aria-expanded":"false",...u==="listbox"&&{role:"combobox"},...u==="menu"&&h&&{role:"menuitem"},...s==="select"&&{"aria-autocomplete":"none"},...s==="combobox"&&{"aria-autocomplete":"list"}},[u,h,s]),g=m.useMemo(()=>u==="tooltip"||s==="label"?{[`aria-${s==="label"?"labelledby":"describedby"}`]:r?d:void 0}:{...y,"aria-expanded":r?"true":"false","aria-controls":r?d:void 0,...u==="menu"&&{id:c}},[u,d,r,c,s,y]),x=m.useMemo(()=>{const b={id:d,...u&&{role:u}};return u==="tooltip"||s==="label"?b:{...b,...u==="menu"&&{"aria-labelledby":c}}},[u,d,c,s]),v=m.useCallback(({active:b,selected:w})=>{const _={role:"option",...b&&{id:`${d}-fui-option`}};switch(s){case"select":case"combobox":return{..._,"aria-selected":w}}return{}},[d,s]);return m.useMemo(()=>({reference:g,floating:x,item:v,trigger:y}),[g,x,y,v])}function D7(e,t){const n="rootStore"in e?e.rootStore:e,r=n.context.dataRef,i=n.useState("open"),{listRef:a,elementsRef:o,activeIndex:s,onMatch:l,onTypingChange:c,enabled:d=!0,resetMs:u=750,selectedIndex:p=null}=t,h=Fr(),y=m.useRef(""),g=m.useRef(p??s??-1),x=m.useRef(null);Ge(()=>{!i&&p!==null||(h.clear(),x.current=null,y.current!==""&&(y.current=""))},[i,p,h]),Ge(()=>{i&&y.current===""&&(g.current=p??s??-1)},[i,p,s]);const v=et(S=>{S?r.current.typing||(r.current.typing=S,c?.(S)):r.current.typing&&(r.current.typing=S,c?.(S))}),b=et(S=>{function E(O){const I=o?.current[O];return!I||Ph(I)}function C(O,I,L=0){if(O.length===0)return-1;const V=(L%O.length+O.length)%O.length,F=I.toLocaleLowerCase();for(let N=0;N<O.length;N+=1){const ee=(V+N)%O.length;if(!(!O[ee]?.toLocaleLowerCase().startsWith(F)||!E(ee)))return ee}return-1}const j=a.current;if(y.current.length>0&&S.key===" "&&(Mr(S),v(!0)),y.current.length>0&&y.current[0]!==" "&&C(j,y.current)===-1&&S.key!==" "&&v(!1),j==null||S.key.length!==1||S.ctrlKey||S.metaKey||S.altKey)return;i&&S.key!==" "&&(Mr(S),v(!0));const T=y.current==="";T&&(g.current=p??s??-1),j.every(O=>O?O[0]?.toLocaleLowerCase()!==O[1]?.toLocaleLowerCase():!0)&&y.current===S.key&&(y.current="",g.current=x.current),y.current+=S.key,h.start(u,()=>{y.current="",g.current=x.current,v(!1)});const D=((T?p??s??-1:g.current)??0)+1,M=C(j,y.current,D);M!==-1?(l?.(M),x.current=M):S.key!==" "&&(y.current="",v(!1))}),w=et(S=>{const E=S.relatedTarget,C=n.select("domReferenceElement"),j=n.select("floatingElement"),T=Qe(C,E),A=Qe(j,E);T||A||(h.clear(),y.current="",g.current=x.current,v(!1))}),_=m.useMemo(()=>({onKeyDown:b,onBlur:w}),[b,w]),k=m.useMemo(()=>({onKeyDown:b,onBlur:w}),[b,w]);return m.useMemo(()=>d?{reference:_,floating:k}:{},[d,_,k])}const V_=.1,L7=V_*V_,St=.5;function Od(e,t,n,r,i,a){return r>=t!=a>=t&&e<=(i-n)*(t-r)/(a-r)+n}function Ad(e,t,n,r,i,a,o,s,l,c){let d=!1;return Od(e,t,n,r,i,a)&&(d=!d),Od(e,t,i,a,o,s)&&(d=!d),Od(e,t,o,s,l,c)&&(d=!d),Od(e,t,l,c,n,r)&&(d=!d),d}function $7(e,t,n){return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function Rd(e,t,n,r,i,a){const o=Math.min(n,i),s=Math.max(n,i),l=Math.min(r,a),c=Math.max(r,a);return e>=o&&e<=s&&t>=l&&t<=c}function z7(e={}){const{blockPointerEvents:t=!1}=e,n=new na,r=({x:i,y:a,placement:o,elements:s,onClose:l,nodeId:c,tree:d})=>{const u=o?.split("-")[0];let p=!1,h=null,y=null,g=typeof performance<"u"?performance.now():0;function x(b,w){const _=performance.now(),k=_-g;if(h===null||y===null||k===0)return h=b,y=w,g=_,!1;const S=b-h,E=w-y,C=S*S+E*E,j=k*k*L7;return h=b,y=w,g=_,C<j}function v(){n.clear(),l()}return function(w){n.clear();const _=s.domReference,k=s.floating;if(!_||!k||u==null||i==null||a==null)return;const{clientX:S,clientY:E}=w,C=wr(w),j=w.type==="mouseleave",T=Qe(k,C),A=Qe(_,C);if(T&&(p=!0,!j))return;if(A&&(p=!1,!j)){p=!0;return}if(j&&st(w.relatedTarget)&&Qe(k,w.relatedTarget))return;function R(){return!!(d&&Xi(d.nodesRef.current,c).length>0)}function D(){R()||v()}if(R())return;const M=_.getBoundingClientRect(),O=k.getBoundingClientRect(),I=i>O.right-O.width/2,L=a>O.bottom-O.height/2,V=O.width>M.width,F=O.height>M.height,N=(V?M:O).left,ee=(V?M:O).right,Q=(F?M:O).top,P=(F?M:O).bottom;if(u==="top"&&a>=M.bottom-1||u==="bottom"&&a<=M.top+1||u==="left"&&i>=M.right-1||u==="right"&&i<=M.left+1){D();return}let z=!1;switch(u){case"top":z=Rd(S,E,N,M.top+1,ee,O.bottom-1);break;case"bottom":z=Rd(S,E,N,O.top+1,ee,M.bottom-1);break;case"left":z=Rd(S,E,O.right-1,P,M.left+1,Q);break;case"right":z=Rd(S,E,M.right-1,P,O.left+1,Q);break}if(z)return;if(p&&!$7(S,E,M)){D();return}if(!j&&x(S,E)){D();return}let $=!1;switch(u){case"top":{const H=V?St/2:St*4,oe=V||I?i+H:i-H,q=V?i-H:I?i+H:i-H,X=a+St+1,te=I||V?O.bottom-St:O.top,ue=I?V?O.bottom-St:O.top:O.bottom-St;$=Ad(S,E,oe,X,q,X,O.left,te,O.right,ue);break}case"bottom":{const H=V?St/2:St*4,oe=V||I?i+H:i-H,q=V?i-H:I?i+H:i-H,X=a-St,te=I||V?O.top+St:O.bottom,ue=I?V?O.top+St:O.bottom:O.top+St;$=Ad(S,E,oe,X,q,X,O.left,te,O.right,ue);break}case"left":{const H=F?St/2:St*4,oe=F||L?a+H:a-H,q=F?a-H:L?a+H:a-H,X=i+St+1,te=L||F?O.right-St:O.left,ue=L?F?O.right-St:O.left:O.right-St;$=Ad(S,E,te,O.top,ue,O.bottom,X,oe,X,q);break}case"right":{const H=F?St/2:St*4,oe=F||L?a+H:a-H,q=F?a-H:L?a+H:a-H,X=i-St,te=L||F?O.left+St:O.right,ue=L?F?O.left+St:O.right:O.left+St;$=Ad(S,E,X,oe,X,q,te,O.top,ue,O.bottom);break}}$?p||n.start(40,D):D()}};return r.__options={...e,blockPointerEvents:t},r}let F7=(function(e){return e.nestedDialogs="--nested-dialogs",e})({}),B7=(function(e){return e[e.open=wi.open]="open",e[e.closed=wi.closed]="closed",e[e.startingStyle=wi.startingStyle]="startingStyle",e[e.endingStyle=wi.endingStyle]="endingStyle",e.nested="data-nested",e.nestedDialogOpen="data-nested-dialog-open",e})({});const _R=m.createContext(void 0);function SR(){const e=m.useContext(_R);if(e===void 0)throw new Error(fa(26));return e}const ER="ArrowUp",CR="ArrowDown",jR="ArrowLeft",PR="ArrowRight",NR="Home",TR="End",W7=new Set([jR,PR]),H7=new Set([ER,CR]),U7=new Set([...W7,...H7]);[...U7];const OR=new Set([ER,CR,jR,PR,NR,TR]),V7={...Lu,...bh,nestedDialogOpen(e){return e?{[B7.nestedDialogOpen]:""}:null}},q7=m.forwardRef(function(t,n){const{className:r,finalFocus:i,initialFocus:a,render:o,style:s,...l}=t,{store:c}=Co(),d=c.useState("descriptionElementId"),u=c.useState("disablePointerDismissal"),p=c.useState("floatingRootContext"),h=c.useState("popupProps"),y=c.useState("modal"),g=c.useState("mounted"),x=c.useState("nested"),v=c.useState("nestedOpenDialogCount"),b=c.useState("open"),w=c.useState("openMethod"),_=c.useState("titleElementId"),k=c.useState("transitionStatus"),S=c.useState("role");SR(),A0({open:b,ref:c.context.popupRef,onComplete(){b&&c.context.onOpenChangeComplete?.(!0)}});function E(R){return R==="touch"?c.context.popupRef.current:!0}const C=a===void 0?E:a,j=v>0,A=Ur("div",t,{state:{open:b,nested:x,transitionStatus:k,nestedDialogOpen:j},props:[h,{"aria-labelledby":_??void 0,"aria-describedby":d??void 0,role:S,tabIndex:-1,hidden:!g,onKeyDown(R){OR.has(R.key)&&R.stopPropagation()},style:{[F7.nestedDialogs]:v}},l],ref:[n,c.context.popupRef,c.useStateSetter("popupElement")],stateAttributesMapping:V7});return f.jsx(eR,{context:p,openInteractionType:w,disabled:!g,closeOnFocusOut:!u,initialFocus:C,returnFocus:i,modal:y!==!1,restoreFocus:"popup",children:A})});function AR(e){return u0(19)?e:e?"true":void 0}const RR=m.forwardRef(function(t,n){const{cutout:r,...i}=t;let a;if(r){const o=r.getBoundingClientRect();a=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${o.left}px ${o.top}px,${o.left}px ${o.bottom}px,${o.right}px ${o.bottom}px,${o.right}px ${o.top}px,${o.left}px ${o.top}px)`}return f.jsx("div",{ref:n,role:"presentation","data-base-ui-inert":"",...i,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:a}})}),K7=m.forwardRef(function(t,n){const{keepMounted:r=!1,...i}=t,{store:a}=Co(),o=a.useState("mounted"),s=a.useState("modal"),l=a.useState("open");return o||r?f.jsx(_R.Provider,{value:r,children:f.jsxs(YA,{ref:n,...i,children:[o&&s===!0&&f.jsx(RR,{ref:a.context.internalBackdropRef,inert:AR(!l)}),t.children]})}):null});function MR(e){const t=m.useRef(!0);t.current&&(t.current=!1,e())}let q_={},K_={},G_="";function G7(e){if(typeof document>"u")return!1;const t=ut(e);return an(t).innerWidth-t.documentElement.clientWidth>0}function Y7(e){if(!(typeof CSS<"u"&&CSS.supports&&CSS.supports("scrollbar-gutter","stable"))||typeof document>"u")return!1;const n=ut(e),r=n.documentElement,i=n.body,a=jo(r)?r:i,o=a.style.overflowY,s=r.style.scrollbarGutter;r.style.scrollbarGutter="stable",a.style.overflowY="scroll";const l=a.offsetWidth;a.style.overflowY="hidden";const c=a.offsetWidth;return a.style.overflowY=o,r.style.scrollbarGutter=s,l===c}function X7(e){const t=ut(e),n=t.documentElement,r=t.body,i=jo(n)?n:r,a={overflowY:i.style.overflowY,overflowX:i.style.overflowX};return Object.assign(i.style,{overflowY:"hidden",overflowX:"hidden"}),()=>{Object.assign(i.style,a)}}function Z7(e){const t=ut(e),n=t.documentElement,r=t.body,i=an(n);let a=0,o=0,s=!1;const l=Bi.create();if(_A&&(i.visualViewport?.scale??1)!==1)return()=>{};function c(){const h=i.getComputedStyle(n),y=i.getComputedStyle(r),v=(h.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";a=n.scrollTop,o=n.scrollLeft,q_={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},G_=n.style.scrollBehavior,K_={position:r.style.position,height:r.style.height,width:r.style.width,boxSizing:r.style.boxSizing,overflowY:r.style.overflowY,overflowX:r.style.overflowX,scrollBehavior:r.style.scrollBehavior};const b=n.scrollHeight>n.clientHeight,w=n.scrollWidth>n.clientWidth,_=h.overflowY==="scroll"||y.overflowY==="scroll",k=h.overflowX==="scroll"||y.overflowX==="scroll",S=Math.max(0,i.innerWidth-r.clientWidth),E=Math.max(0,i.innerHeight-r.clientHeight),C=parseFloat(y.marginTop)+parseFloat(y.marginBottom),j=parseFloat(y.marginLeft)+parseFloat(y.marginRight),T=jo(n)?n:r;if(s=Y7(e),s){n.style.scrollbarGutter=v,T.style.overflowY="hidden",T.style.overflowX="hidden";return}Object.assign(n.style,{scrollbarGutter:v,overflowY:"hidden",overflowX:"hidden"}),(b||_)&&(n.style.overflowY="scroll"),(w||k)&&(n.style.overflowX="scroll"),Object.assign(r.style,{position:"relative",height:C||E?`calc(100dvh - ${C+E}px)`:"100dvh",width:j||S?`calc(100vw - ${j+S}px)`:"100vw",boxSizing:"border-box",overflow:"hidden",scrollBehavior:"unset"}),r.scrollTop=a,r.scrollLeft=o,n.setAttribute("data-base-ui-scroll-locked",""),n.style.scrollBehavior="unset"}function d(){Object.assign(n.style,q_),Object.assign(r.style,K_),s||(n.scrollTop=a,n.scrollLeft=o,n.removeAttribute("data-base-ui-scroll-locked"),n.style.scrollBehavior=G_)}function u(){d(),l.request(c)}c();const p=ot(i,"resize",u);return()=>{l.cancel(),d(),typeof i.removeEventListener=="function"&&p()}}class Q7{lockCount=0;restore=null;timeoutLock=na.create();timeoutUnlock=na.create();acquire(t){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(t)),this.release}release=()=>{this.lockCount-=1,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(t){if(this.lockCount===0||this.restore!==null)return;const r=ut(t).documentElement,i=an(r).getComputedStyle(r).overflowY;if(i==="hidden"||i==="clip"){this.restore=d0;return}const a=SA||!G7(t);this.restore=a?X7(t):Z7(t)}}const J7=new Q7;function IR(e=!0,t=null){Ge(()=>{if(e)return J7.acquire(t)},[e,t])}function eV(e){const t=m.useRef(""),n=m.useCallback(i=>{i.defaultPrevented||(t.current=i.pointerType,e(i,i.pointerType))},[e]);return{onClick:m.useCallback(i=>{if(i.detail===0){e(i,"keyboard");return}"pointerType"in i?e(i,i.pointerType):e(i,t.current),t.current=""},[e]),onPointerDown:n}}function tV(e,t){const n=m.useRef(e),r=et(t);Ge(()=>{n.current!==e&&r(n.current)},[e,r]),Ge(()=>{n.current=e},[e])}function DR(e){const[t,n]=m.useState(null),r=et((o,s)=>{e||n(s||(SA?"touch":""))});tV(e,o=>{o&&!e&&n(null)});const{onClick:i,onPointerDown:a}=eV(r);return m.useMemo(()=>({openMethod:t,triggerProps:{onClick:i,onPointerDown:a}}),[t,i,a])}function nV(e){const{store:t,parentContext:n,actionsRef:r,isDrawer:i}=e,a=t.useState("open"),o=t.useState("disablePointerDismissal"),s=t.useState("modal"),l=t.useState("popupElement"),{openMethod:c,triggerProps:d}=DR(a);mR(t);const{forceUnmount:u}=gR(a,t),p=m.useCallback(()=>{t.setOpen(!1,dt(xA))},[t]);m.useImperativeHandle(r,()=>({unmount:u,close:p}),[u,p]);const h=xR({popupStore:t,onOpenChange:t.setOpen,treatPopupAsFloatingElement:!0}),[y,g]=m.useState(0),[x,v]=m.useState(0),b=y===0,w=kR(h),_=tR(h,{outsidePressEvent(){return t.context.internalBackdropRef.current||t.context.backdropRef.current?"intentional":{mouse:s==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}},outsidePress(A){if(!t.context.outsidePressEnabledRef.current||"button"in A&&A.button!==0||"touches"in A&&A.touches.length!==1)return!1;const R=wr(A);if(b&&!o){const D=R;return s&&(t.context.internalBackdropRef.current||t.context.backdropRef.current)?t.context.internalBackdropRef.current===D||t.context.backdropRef.current===D||Qe(D,l)&&!D?.hasAttribute("data-base-ui-portal"):!0}return!1},escapeKey:b});IR(a&&s===!0,l);const{getReferenceProps:k,getFloatingProps:S,getTriggerProps:E}=M0([w,_]);t.useContextCallback("onNestedDialogOpen",(A,R)=>{g(A),v(R)}),t.useContextCallback("onNestedDialogClose",()=>{g(0),v(0)}),m.useEffect(()=>(n?.onNestedDialogOpen&&a&&n.onNestedDialogOpen(y+1,x+(i?1:0)),n?.onNestedDialogClose&&!a&&n.onNestedDialogClose(),()=>{n?.onNestedDialogClose&&a&&n.onNestedDialogClose()}),[i,a,y,x,n]);const C=m.useMemo(()=>k(d),[k,d]),j=m.useMemo(()=>E(d),[E,d]),T=m.useMemo(()=>S(),[S]);t.useSyncedValues({openMethod:c,activeTriggerProps:C,inactiveTriggerProps:j,popupProps:T,floatingRootContext:h,nestedOpenDialogCount:y,nestedOpenDrawerCount:x})}const rV={...vR,modal:Ye(e=>e.modal),nested:Ye(e=>e.nested),nestedOpenDialogCount:Ye(e=>e.nestedOpenDialogCount),nestedOpenDrawerCount:Ye(e=>e.nestedOpenDrawerCount),disablePointerDismissal:Ye(e=>e.disablePointerDismissal),openMethod:Ye(e=>e.openMethod),descriptionElementId:Ye(e=>e.descriptionElementId),titleElementId:Ye(e=>e.titleElementId),viewportElement:Ye(e=>e.viewportElement),role:Ye(e=>e.role)};class I0 extends T0{constructor(t){super(iV(t),{popupRef:m.createRef(),backdropRef:m.createRef(),internalBackdropRef:m.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:new Th,onOpenChange:void 0,onOpenChangeComplete:void 0},rV)}setOpen=(t,n)=>{if(n.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},!t&&n.trigger==null&&this.state.activeTriggerId!=null&&(n.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(t,n),n.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(t,n);const r={open:t},i=n.trigger?.id??null;(i||t)&&(r.activeTriggerId=i,r.activeTriggerElement=n.trigger??null),this.update(r)};static useStore(t,n){const r=cr(()=>new I0(n)).current;return t??r}}function iV(e={}){return{...yR(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:"dialog",...e}}const Y_=m.createContext(!1);function aV(e){const{children:t,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:a,disablePointerDismissal:o=!1,modal:s=!0,actionsRef:l,handle:c,triggerId:d,defaultTriggerId:u=null}=e,p=Co(!0),h=m.useContext(Y_),y=!!p,g=I0.useStore(c?.store,{open:r,openProp:n,activeTriggerId:u,triggerIdProp:d,modal:s,disablePointerDismissal:o,nested:y});MR(()=>{n===void 0&&g.state.open===!1&&r===!0&&g.update({open:!0,activeTriggerId:u})}),g.useControlledProp("openProp",n),g.useControlledProp("triggerIdProp",d),g.useSyncedValues({disablePointerDismissal:o,nested:y,modal:s}),g.useContextCallback("onOpenChange",i),g.useContextCallback("onOpenChangeComplete",a);const x=g.useState("payload");nV({store:g,actionsRef:l,parentContext:p?.store.context,isDrawer:h});const v=m.useMemo(()=>({store:g}),[g]);return f.jsx(Y_.Provider,{value:!1,children:f.jsx(cA.Provider,{value:v,children:typeof t=="function"?t({payload:x}):t})})}let X_=(function(e){return e[e.open=wi.open]="open",e[e.closed=wi.closed]="closed",e[e.startingStyle=wi.startingStyle]="startingStyle",e[e.endingStyle=wi.endingStyle]="endingStyle",e.nested="data-nested",e.nestedDialogOpen="data-nested-dialog-open",e})({});const oV={...Lu,...bh,nested(e){return e?{[X_.nested]:""}:null},nestedDialogOpen(e){return e?{[X_.nestedDialogOpen]:""}:null}},sV=m.forwardRef(function(t,n){const{className:r,render:i,children:a,style:o,...s}=t,l=SR(),{store:c}=Co(),d=c.useState("open"),u=c.useState("nested"),p=c.useState("transitionStatus"),h=c.useState("nestedOpenDialogCount"),y=c.useState("mounted"),g=h>0;return Ur("div",t,{enabled:l||y,state:{open:d,nested:u,transitionStatus:p,nestedDialogOpen:g},ref:[n,c.useStateSetter("viewportElement")],stateAttributesMapping:oV,props:[{role:"presentation",hidden:!y,style:{pointerEvents:d?void 0:"none"},children:a},s]})}),lV=m.forwardRef(function(t,n){const{render:r,className:i,style:a,id:o,...s}=t,{store:l}=Co(),c=Ch(o);return l.useSyncedValueWithCleanup("titleElementId",c),Ur("h2",t,{ref:n,props:[{id:c},s]})}),cV=m.forwardRef(function(t,n){const{render:r,className:i,disabled:a=!1,focusableWhenDisabled:o=!1,nativeButton:s=!0,style:l,...c}=t,{getButtonProps:d,buttonRef:u}=Eh({disabled:a,focusableWhenDisabled:o,native:s});return Ur("button",t,{state:{disabled:a},ref:[n,u],props:[c,d]})}),Z_=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Q_=bt,uV=(e,t)=>n=>{var r;if(t?.variants==null)return Q_(e,n?.class,n?.className);const{variants:i,defaultVariants:a}=t,o=Object.keys(i).map(c=>{const d=n?.[c],u=a?.[c];if(d===null)return null;const p=Z_(d)||Z_(u);return i[c][p]}),s=n&&Object.entries(n).reduce((c,d)=>{let[u,p]=d;return p===void 0||(c[u]=p),c},{}),l=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((c,d)=>{let{class:u,className:p,...h}=d;return Object.entries(h).every(y=>{let[g,x]=y;return Array.isArray(x)?x.includes({...a,...s}[g]):{...a,...s}[g]===x})?[...c,u,p]:c},[]);return Q_(e,o,l,n?.class,n?.className)},dV=uV("group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",outline:"border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",ghost:"hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",destructive:"bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",xs:"h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",lg:"h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",icon:"size-8","icon-xs":"size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg","icon-lg":"size-9"}},defaultVariants:{variant:"default",size:"default"}});function LR({className:e,variant:t="default",size:n="default",...r}){return f.jsx(cV,{"data-slot":"button",className:ae(dV({variant:t,size:n,className:e})),...r})}function Sn({...e}){return f.jsx(aV,{"data-slot":"dialog",...e})}function fV({...e}){return f.jsx(K7,{"data-slot":"dialog-portal",...e})}function pV({className:e,...t}){return f.jsx(K8,{"data-slot":"dialog-overlay",className:ae("te-dialog-overlay",e),...t})}function En({className:e,children:t,showCloseButton:n=!0,...r}){return f.jsxs(fV,{children:[f.jsx(pV,{}),f.jsx("div",{"data-tauri-drag-region":!0,"aria-hidden":!0,className:"pointer-events-auto fixed inset-x-0 top-0 z-[70] h-8"}),f.jsx(sV,{className:"te-dialog-viewport fixed inset-0 z-[60] flex items-center justify-center",children:f.jsxs(q7,{"data-slot":"dialog-content",className:ae("te-dialog-popup relative grid w-full max-w-[calc(100%-2rem)] gap-4 rounded-xl bg-popover p-4 text-sm text-popover-foreground ring-1 ring-foreground/10 sm:max-w-sm",e),...r,children:[t,n&&f.jsxs(bA,{"data-slot":"dialog-close",render:f.jsx(LR,{variant:"ghost",className:"absolute top-2 right-2",size:"icon-sm"}),children:[f.jsx(Sr,{}),f.jsx("span",{className:"sr-only",children:"Close"})]})]})})]})}function Cn({className:e,...t}){return f.jsx("div",{"data-slot":"dialog-header",className:ae("flex flex-col gap-2",e),...t})}function D0({className:e,showCloseButton:t=!1,children:n,...r}){return f.jsxs("div",{"data-slot":"dialog-footer",className:ae("-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 sm:flex-row sm:justify-end",e),...r,children:[n,t&&f.jsx(bA,{render:f.jsx(LR,{variant:"outline"}),children:"Close"})]})}function jn({className:e,...t}){return f.jsx(lV,{"data-slot":"dialog-title",className:ae("font-heading text-base leading-none font-medium",e),...t})}function Pn({className:e,...t}){return f.jsx(cU,{"data-slot":"dialog-description",className:ae("text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",e),...t})}function hV(e){switch(e){case"lite":return"dialogs:account.membership.lite";case"pro":return"dialogs:account.membership.pro";case"premium":return"dialogs:account.membership.premium";default:return"dialogs:account.membership.free"}}async function J_(e){const t=await B("openloaf_web_url",{path:e});await Fb(t)}function mg({label:e,children:t}){return f.jsxs("div",{className:"flex items-start justify-between gap-4 border-b border-te-gray/30 py-3 last:border-b-0",children:[f.jsx("span",{className:"shrink-0 pt-0.5 font-mono text-xs uppercase tracking-[0.2em] text-te-light-gray",children:e}),f.jsx("div",{className:"min-w-0 flex-1 text-right",children:t})]})}function mV({open:e,onOpenChange:t}){const{t:n,i18n:r}=de(),{user:i,profile:a,isAuthenticated:o,init:s,loaded:l,logout:c}=pt(),[d,u]=m.useState(!1),p=a?.membershipLevel,h=n(p==="premium"?"dialogs:account.subscribe_button.manage":p==="pro"?"dialogs:account.subscribe_button.upgrade_to_premium":"dialogs:account.subscribe_button.default");m.useEffect(()=>{e&&s()},[e,s]),m.useEffect(()=>{e&&l&&!o&&t(!1)},[e,l,o,t]);const y=async()=>{if(!d){u(!0);try{await c()}finally{u(!1)}}},g=(a?.provider??"").toLowerCase()==="wechat",x=n(g?"dialogs:account.row.wechat":"dialogs:account.row.email"),v=g?a?.name??i?.name??"—":i?.email??a?.email??i?.name??"—",b=g?AW:BB;return f.jsx(Sn,{open:e,onOpenChange:t,children:f.jsxs(En,{className:"flex max-h-[88vh] w-[92vw] max-w-md flex-col !gap-0 rounded-none border border-te-dialog-border bg-te-dialog-bg p-0 shadow-2xl ring-0",children:[f.jsxs(Cn,{className:"border-b border-te-dialog-border bg-te-surface-hover px-5 py-4",children:[f.jsx(jn,{className:"font-mono text-base font-bold tracking-tighter text-te-fg",children:n("dialogs:account.title")}),f.jsx(Pn,{className:"sr-only",children:n("dialogs:account.description")})]}),f.jsx("div",{className:"flex-1 overflow-y-auto px-5 py-5",children:l?f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:"mb-5",children:[f.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[f.jsx("span",{className:"h-px w-4 bg-te-accent"}),f.jsx("span",{className:"font-mono text-[10px] uppercase tracking-[0.25em] text-te-light-gray",children:n("dialogs:account.section.identity")})]}),f.jsx(mg,{label:x,children:f.jsxs("span",{className:"inline-flex max-w-full items-start gap-2 font-mono text-sm text-te-fg",children:[f.jsx(b,{className:"mt-[3px] size-3.5 shrink-0 text-te-light-gray"}),f.jsx("span",{className:"break-all text-left",children:v})]})}),f.jsx(mg,{label:n("dialogs:account.row.subscription"),children:f.jsxs("span",{className:"inline-flex items-center gap-2 border border-te-accent/60 bg-te-accent/8 px-2.5 py-1 font-mono text-[11px] uppercase tracking-[0.15em] text-te-accent",children:[f.jsx("span",{className:"size-1.5 bg-te-accent"}),n(hV(p))]})}),f.jsx(mg,{label:n("dialogs:account.row.credits_balance"),children:f.jsx("span",{className:"font-mono text-sm tabular-nums text-te-fg",children:Math.round(a?.creditsBalance??0).toLocaleString(r.language)})})]}),f.jsxs("div",{className:"mb-5",children:[f.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[f.jsx("span",{className:"h-px w-4 bg-te-accent"}),f.jsx("span",{className:"font-mono text-[10px] uppercase tracking-[0.25em] text-te-light-gray",children:n("dialogs:account.section.subscription")})]}),f.jsxs("button",{type:"button",onClick:()=>{J_("/pricing")},className:"inline-flex w-full items-center justify-center gap-2 bg-te-accent px-4 py-2.5 font-mono text-xs uppercase tracking-[0.2em] text-te-accent-fg transition-colors hover:bg-te-accent/90",children:[f.jsx(ri,{className:"size-4"}),h]}),f.jsx("p",{className:"mt-2 font-sans text-xs text-te-light-gray",children:n("dialogs:account.subscribe_hint")})]}),f.jsxs("div",{className:"mb-5",children:[f.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[f.jsx("span",{className:"h-px w-4 bg-te-accent"}),f.jsx("span",{className:"font-mono text-[10px] uppercase tracking-[0.25em] text-te-light-gray",children:n("dialogs:account.section.recharge")})]}),f.jsxs("button",{type:"button",onClick:()=>{J_("/recharge")},className:"inline-flex w-full items-center justify-center gap-2 border border-te-gray px-4 py-2.5 font-mono text-xs uppercase tracking-[0.2em] text-te-fg transition-colors hover:border-te-accent hover:text-te-accent",children:[f.jsx(SB,{className:"size-4"}),n("dialogs:account.recharge_button")]}),f.jsx("p",{className:"mt-2 font-sans text-xs text-te-light-gray",children:n("dialogs:account.recharge_hint")})]}),f.jsxs("div",{children:[f.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[f.jsx("span",{className:"h-px w-4 bg-te-accent"}),f.jsx("span",{className:"font-mono text-[10px] uppercase tracking-[0.25em] text-te-light-gray",children:n("dialogs:account.section.session")})]}),f.jsxs("button",{type:"button",onClick:y,disabled:d,className:"inline-flex w-full items-center justify-center gap-2 border border-te-gray px-4 py-2.5 font-mono text-xs uppercase tracking-[0.2em] text-te-fg transition-colors hover:border-te-accent hover:text-te-accent disabled:opacity-50",children:[f.jsx(zB,{className:"size-4"}),n(d?"dialogs:account.logout_busy":"dialogs:account.logout_button")]}),f.jsx("p",{className:"mt-2 font-sans text-xs text-te-light-gray",children:n("dialogs:account.logout_hint")})]})]}):f.jsx("div",{className:"py-10 text-center font-mono text-xs uppercase tracking-[0.25em] text-te-light-gray",children:n("dialogs:account.loading")})})]})})}var eS;(function(e){e.Nsis="nsis",e.Msi="msi",e.Deb="deb",e.Rpm="rpm",e.AppImage="appimage",e.App="app"})(eS||(eS={}));async function Ah(){return B("plugin:app|version")}async function gV(){return await B("plugin:autostart|is_enabled")}async function yV(){await B("plugin:autostart|enable")}async function vV(){await B("plugin:autostart|disable")}async function $R(e){try{if(await gV()===e)return;e?await yV():await vV(),console.log("[autostart] synced →",e)}catch(t){console.warn("[autostart] sync failed:",t)}}async function xV(e){return await B("dictation_test_provider",{req:e})}function bV(){return typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID():`ex_${Date.now()}_${Math.random().toString(36).slice(2,8)}`}const zR=["*","chat","code","doc","email","browser","meeting","other"];function wV(e){const t=(e??"").trim().toLowerCase();return zR.includes(t)?t:"*"}function gg({description:e,value:t,isCustom:n,onChange:r,onReset:i,textareaRows:a=18}){const{t:o}=de("settings");return f.jsxs("div",{className:"flex flex-col gap-4",children:[f.jsx(kV,{description:e,isCustom:n,onReset:i}),f.jsx("textarea",{value:t,onChange:s=>r(s.target.value),rows:a,className:"w-full resize-y border border-te-gray/40 bg-te-surface p-3 font-mono text-xs leading-relaxed text-te-fg outline-none transition-colors focus:border-te-accent"}),f.jsx("p",{className:"font-sans text-[11px] leading-relaxed text-te-light-gray/70",children:o("ai.prompt_panel_save_hint")})]})}function kV({description:e,isCustom:t,onReset:n}){const{t:r}=de("settings");return f.jsxs("div",{className:"flex items-start justify-between gap-4 border-b border-te-gray/30 pb-3",children:[f.jsxs("div",{className:"flex flex-1 flex-col gap-1.5",children:[f.jsx("div",{className:"flex items-center gap-2",children:f.jsx("span",{className:ae("border px-1.5 py-px font-mono text-[10px] uppercase tracking-[0.2em]",t?"border-te-accent/60 text-te-accent":"border-te-gray/40 text-te-light-gray"),children:r(t?"ai.refine_status_modified":"ai.refine_status_default")})}),f.jsx("p",{className:"font-sans text-xs leading-relaxed text-te-light-gray",children:e})]}),f.jsxs("button",{type:"button",disabled:!t,onClick:n,className:"inline-flex shrink-0 items-center gap-1.5 border border-te-gray bg-te-surface px-3 py-1.5 font-mono text-[10px] uppercase tracking-[0.2em] text-te-light-gray transition-colors enabled:hover:border-te-accent enabled:hover:text-te-accent disabled:cursor-not-allowed disabled:opacity-40",children:[f.jsx(Aa,{className:"size-3"}),r("ai.prompt_reset")]})]})}function _V({examples:e,onChange:t}){const{t:n}=de("settings"),r=e.length>=Av,i=(s,l)=>{t(e.map((c,d)=>d===s?{...c,...l}:c))},a=s=>{t(e.filter((l,c)=>c!==s))},o=()=>{r||t([...e,{id:bV(),target:"*",input:"",focus:"",output:""}])};return f.jsxs("div",{className:"flex flex-col gap-4",children:[f.jsxs("div",{className:"flex items-baseline justify-between gap-2",children:[f.jsx("h3",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-te-fg",children:n("ai.refine_examples_my_title")}),f.jsx("span",{className:"font-mono text-[10px] uppercase tracking-[0.2em] text-te-light-gray",children:n("ai.refine_examples_count",{current:e.length,max:Av})})]}),e.length>0&&f.jsx("div",{className:"flex flex-col gap-4",children:e.map((s,l)=>f.jsx(SV,{example:s,onChange:c=>i(l,c),onRemove:()=>a(l)},s.id))}),f.jsxs("button",{type:"button",disabled:r,onClick:o,className:"inline-flex w-full items-center justify-center gap-2 border border-dashed border-te-gray/60 px-4 py-3 font-mono text-xs uppercase tracking-[0.2em] text-te-light-gray transition-colors enabled:hover:border-te-accent enabled:hover:text-te-accent disabled:cursor-not-allowed disabled:opacity-40",children:[f.jsx(us,{className:"size-3.5"}),n("ai.refine_example_add")]})]})}function SV({example:e,onChange:t,onRemove:n}){const{t:r}=de("settings"),i=wV(e.target);return f.jsxs("div",{className:"flex flex-col gap-3 border border-te-gray/40 bg-te-surface/50 px-4 py-4",children:[f.jsxs("div",{className:"flex items-start justify-between gap-3",children:[f.jsxs("label",{className:"flex flex-1 flex-col gap-1.5",children:[f.jsx("span",{className:"font-mono text-[10px] uppercase tracking-[0.2em] text-te-light-gray",children:r("ai.refine_example_target_label")}),f.jsx("select",{value:i,onChange:a=>t({target:a.target.value}),className:"w-full appearance-none border border-te-gray/40 bg-te-surface px-3 py-1.5 font-sans text-sm text-te-fg outline-none transition-colors focus:border-te-accent",children:zR.map(a=>f.jsx("option",{value:a,children:r(`ai.refine_example_target_option.${a}`)},a))})]}),f.jsxs("button",{type:"button",onClick:n,"aria-label":r("ai.refine_example_remove")??"Remove",className:"mt-6 inline-flex shrink-0 items-center gap-1 border border-te-gray/40 px-2 py-1.5 font-mono text-[10px] uppercase tracking-[0.2em] text-te-light-gray transition-colors hover:border-red-400 hover:text-red-400",children:[f.jsx(di,{className:"size-3"}),r("ai.refine_example_remove")]})]}),f.jsxs("label",{className:"flex flex-col gap-1.5",children:[f.jsx("span",{className:"font-mono text-[10px] uppercase tracking-[0.2em] text-te-light-gray",children:r("ai.refine_example_input_label")}),f.jsx("textarea",{value:e.input,onChange:a=>t({input:a.target.value}),rows:3,placeholder:r("ai.refine_example_input_placeholder_v2")??"",className:"w-full resize-y border border-te-gray/40 bg-te-surface p-2 font-sans text-sm leading-relaxed text-te-fg outline-none transition-colors focus:border-te-accent"})]}),f.jsxs("label",{className:"flex flex-col gap-1.5",children:[f.jsx("span",{className:"font-mono text-[10px] uppercase tracking-[0.2em] text-te-light-gray",children:r("ai.refine_example_output_label")}),f.jsx("textarea",{value:e.output,onChange:a=>t({output:a.target.value}),rows:3,placeholder:r("ai.refine_example_output_placeholder_v2")??"",className:"w-full resize-y border border-te-gray/40 bg-te-surface p-2 font-sans text-sm leading-relaxed text-te-fg outline-none transition-colors focus:border-te-accent"})]}),f.jsxs("label",{className:"flex flex-col gap-1.5",children:[f.jsx("span",{className:"font-mono text-[10px] uppercase tracking-[0.2em] text-te-light-gray",children:r("ai.refine_example_focus_label")}),f.jsx("input",{type:"text",value:e.focus,onChange:a=>t({focus:a.target.value}),placeholder:r("ai.refine_example_focus_placeholder_v2")??"",className:"w-full border border-te-gray/40 bg-te-surface px-3 py-1.5 font-sans text-sm text-te-fg outline-none transition-colors focus:border-te-accent"})]})]})}function EV({scenarios:e,onChange:t}){const{t:n}=de("settings"),r=re(u=>u.general.interfaceLang),i=re(u=>u.dictation.lang),a=lr(i,r),o=e??Zo[a],s=e!==null,l=(u,p)=>{const y=(e??Zo[a]).map((g,x)=>x===u?{...g,...p}:g);t(y)},c=u=>{const h=(e??Zo[a]).filter((y,g)=>g!==u);t(h)},d=()=>{const u=e??Zo[a],p=typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID():`scn_${Date.now()}_${Math.random().toString(36).slice(2,8)}`,h=[...u,{id:p,name:n("ai.polish_scenario_default_name"),instruction:""}];t(h)};return f.jsxs("div",{className:"flex flex-col gap-3",children:[f.jsxs("div",{className:"flex items-end justify-between gap-3",children:[f.jsxs("div",{children:[f.jsx("div",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-te-light-gray",children:n("ai.polish_scenarios_title")}),f.jsx("div",{className:"mt-1 font-sans text-xs text-te-light-gray/80",children:n("ai.polish_scenarios_hint")})]}),f.jsxs("button",{type:"button",disabled:!s,onClick:()=>t(null),className:"inline-flex items-center gap-1.5 border border-te-gray bg-te-surface px-3 py-1.5 font-mono text-[10px] uppercase tracking-[0.2em] text-te-light-gray transition-colors enabled:hover:border-te-accent enabled:hover:text-te-accent disabled:cursor-not-allowed disabled:opacity-40",children:[f.jsx(Aa,{className:"size-3"}),n("ai.prompt_reset")]})]}),o.length===0?f.jsx("div",{className:"border border-dashed border-te-gray/40 px-4 py-6 text-center font-mono text-xs text-te-light-gray",children:n("ai.polish_scenarios_empty")}):f.jsx("div",{className:"flex flex-col gap-3",children:o.map((u,p)=>f.jsxs("div",{className:"flex flex-col gap-2 border border-te-gray/40 bg-te-surface/50 px-3 py-3",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("input",{type:"text",value:u.name,onChange:h=>l(p,{name:h.target.value}),className:"flex-1 border border-te-gray/40 bg-te-surface px-3 py-1.5 font-mono text-sm text-te-fg outline-none transition-colors focus:border-te-accent"}),f.jsxs("button",{type:"button",onClick:()=>c(p),className:"inline-flex items-center gap-1 border border-te-gray/60 px-3 py-1.5 font-mono text-[11px] uppercase tracking-[0.2em] text-te-light-gray transition-colors hover:border-red-400 hover:text-red-400",children:[f.jsx(di,{className:"size-3"}),n("ai.polish_scenario_remove")]})]}),f.jsx("textarea",{value:u.instruction,onChange:h=>l(p,{instruction:h.target.value}),rows:3,placeholder:n("ai.polish_scenario_instruction_placeholder")??"",className:"w-full resize-y border border-te-gray/40 bg-te-surface p-2 font-mono text-xs text-te-fg outline-none transition-colors focus:border-te-accent"})]},u.id))}),f.jsx("div",{children:f.jsxs("button",{type:"button",onClick:d,className:"inline-flex items-center gap-2 border border-te-gray/60 px-4 py-2 font-mono text-xs uppercase tracking-[0.2em] text-te-fg transition-colors hover:border-te-accent hover:text-te-accent",children:[f.jsx(us,{className:"size-3.5"}),n("ai.polish_scenario_add")]})})]})}const CV="openspeech://hotkey-recording",jV=4e3,tS=8e3,L0={comfortable:{row:"py-5",label:"text-sm",hint:"mt-1 text-[11px] text-te-light-gray/70",button:"h-[44px] w-[20rem]",chip:"h-7 min-w-[1.75rem] px-2 text-xs",chipSep:"text-xs",placeholder:"text-xs tracking-[0.18em]"},compact:{row:"py-3",label:"text-sm",hint:null,button:"h-[34px] min-w-[12rem]",chip:"h-5 min-w-[1.4rem] px-1.5 text-[11px]",chipSep:"text-[10px]",placeholder:"text-[11px] tracking-[0.15em]"}};function $0({filterIds:e,divided:t=!0,size:n="compact"}){const r=e&&e.length>0?e:ub;return f.jsx("div",{className:ae(t&&"divide-y divide-te-gray/30"),children:r.map(i=>f.jsx(PV,{id:i,size:n},i))})}function PV({id:e,size:t}){const n=L0[t],{t:r}=de(),i=cn(),a=nn(z=>z.bindings[e]),o=nn(z=>z.allowSpecialKeys),s=nn(z=>z.setBinding),l=nn(z=>z.recordUndo),c=nn(z=>z.applyUndo),d=qe(z=>z.clearHotkeyConflict),[u,p]=m.useState({kind:"idle"}),h=m.useRef(null),y=m.useRef(null),g=m.useRef(null),x=m.useRef([]),v=m.useRef([]),b=m.useRef({}),w=m.useRef(!1),_=m.useRef(!1),k=m.useRef(!1),S=m.useRef({}),E=()=>{const{down:z,up:$}=S.current;z&&document.removeEventListener("keydown",z,{capture:!0}),$&&document.removeEventListener("keyup",$,{capture:!0}),S.current={}},C=()=>{E();const z=H=>{H.preventDefault(),H.stopPropagation(),H.stopImmediatePropagation(),O.current(H.code)},$=H=>{I.current(H.code)};document.addEventListener("keydown",z,{capture:!0}),document.addEventListener("keyup",$,{capture:!0}),S.current={down:z,up:$}},j=()=>{_.current||(_.current=!0,B("set_hotkey_recording",{enabled:!0}).catch(z=>console.warn("[HotkeyBinder] set_hotkey_recording(true) failed:",z)))},T=()=>{_.current&&(_.current=!1,B("set_hotkey_recording",{enabled:!1}).catch(z=>console.warn("[HotkeyBinder] set_hotkey_recording(false) failed:",z)))},A=()=>{u.kind!=="recording"&&(x.current=[],v.current=[],b.current={},w.current=!1,k.current=!1,g.current&&(window.clearTimeout(g.current),g.current=null),C(),j(),p({kind:"recording",everPressedMods:[],everPressedSides:{}}),y.current&&window.clearTimeout(y.current),y.current=window.setTimeout(()=>{E(),T(),p({kind:"idle"})},jV))},R=()=>{E(),T(),y.current&&(window.clearTimeout(y.current),y.current=null),p({kind:"idle"})};m.useEffect(()=>()=>{E(),T(),y.current&&window.clearTimeout(y.current),g.current&&window.clearTimeout(g.current)},[]);const D=z=>{E(),T(),y.current&&(window.clearTimeout(y.current),y.current=null),g.current&&window.clearTimeout(g.current),p({kind:"error",message:z}),g.current=window.setTimeout(()=>{g.current=null,p({kind:"idle"})},2500)};m.useEffect(()=>{if(u.kind!=="recording")return;const z=H=>{h.current&&!h.current.contains(H.target)&&R()},$=()=>{window.setTimeout(()=>{document.visibilityState==="hidden"&&R()},800)};return window.addEventListener("mousedown",z),window.addEventListener("blur",$),()=>{window.removeEventListener("mousedown",z),window.removeEventListener("blur",$)}},[u.kind]);const M=async z=>{await s(e,z),d(e)},O=m.useRef(()=>{}),I=m.useRef(()=>{});O.current=z=>{if(k.current)return;if(z==="Escape"){R();return}if(F1(z)){const q=Lf(z);if(!q)return;const X=db(z),te=x.current.includes(q),ue=v.current.includes(q);if(te&&ue)return;if(te||(x.current=cf([...x.current,q])),!ue){v.current=cf([...v.current,q]),q!=="fn"&&X&&(b.current={...b.current,[q]:X});const G=v.current,be=b.current;p(xe=>xe.kind==="recording"?{kind:"recording",everPressedMods:G,everPressedSides:be}:xe)}return}if(w.current)return;w.current=!0;const $=cf(x.current),H=$$(z,$,o);if(!H.ok){D(H.reason??r("dialogs:hotkey_field.error_illegal_combo"));return}const oe={kind:"combo",mods:$,code:z,modSides:nS(b.current,$)};L(oe)},I.current=z=>{if(k.current||!F1(z))return;const $=Lf(z);if($&&x.current.includes($)&&(x.current=x.current.filter(H=>H!==$),x.current.length===0&&!w.current&&v.current.length>0)){const H={kind:"modifierOnly",mods:v.current,code:"",modSides:nS(b.current,v.current)};L(H)}};const L=z=>{if(k.current)return;k.current=!0;const $=z$(z,i,o);if(!$.ok){k.current=!1,D($.reason??r("dialogs:hotkey_field.error_illegal_combo"));return}const H=F$(nn.getState().bindings,z,e);if(H){E(),T(),y.current&&(window.clearTimeout(y.current),y.current=null),p({kind:"conflict",with:H.with,candidate:z,reason:H.kind});return}M(z),R()};m.useEffect(()=>{if(u.kind!=="recording")return;let z=!1,$=null;return Ue(CV,H=>{const{code:oe,phase:q}=H.payload;q==="pressed"?O.current(oe):I.current(oe)}).then(H=>{z?H():$=H}),()=>{z=!0,$?.()}},[u.kind]);const V=async()=>{if(u.kind!=="conflict")return;const z=u.with,$=u.candidate,H=nn.getState().bindings[z];await s(z,null),await s(e,$),await l({replacedId:z,oldValue:H,changedId:e,newValue:$,expiresAt:Date.now()+tS}),d(e),d(z),ke(r("dialogs:hotkey_field.replaced_toast",{name:Pm[z]}),{duration:tS,action:{label:r("dialogs:hotkey_field.undo"),onClick:()=>{c()}}}),R()},F=()=>{p({kind:"idle"}),requestAnimationFrame(()=>A())},N=()=>R(),Q=e!=="dictate_ptt"&&!!a&&u.kind!=="recording",P=u.kind==="idle"&&a?B$(a,i):[];return f.jsxs("div",{className:ae("flex flex-col gap-1.5",n.row),ref:h,children:[f.jsxs("div",{className:"flex items-center justify-between gap-4",children:[f.jsxs("div",{className:"flex flex-col",children:[f.jsx("span",{className:ae("font-sans text-te-fg",n.label),children:Pm[e]}),n.hint?f.jsx("span",{className:ae("font-sans",n.hint),children:r(`hotkey:binding_hint.${e}`)}):null]}),f.jsxs("div",{className:"group relative",children:[f.jsx(tn,{mode:"wait",initial:!1,children:u.kind==="recording"?f.jsx(je.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.1},className:ae("inline-flex items-center justify-center border px-3","border-te-accent bg-te-accent/8",n.button),"aria-live":"polite",children:u.everPressedMods.length===0?f.jsx("span",{className:ae("font-mono uppercase text-te-accent opacity-80 animate-[pulse_1.4s_ease-in-out_infinite]",n.placeholder),children:r("dialogs:hotkey_field.press_new")}):f.jsx(yg,{items:u.everPressedMods.map(z=>BR(z,i,z==="fn"?null:u.everPressedSides[z]??null)),tone:"active",size:t})},"recording"):u.kind==="conflict"?f.jsx(je.button,{type:"button",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.1},onClick:F,className:ae("inline-flex items-center justify-center border border-te-accent/70 bg-te-accent/8 px-3",n.button),children:f.jsx(yg,{items:rS(u.candidate,i),tone:"active",size:t})},"conflict"):f.jsx(je.button,{type:"button",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.1},onClick:A,className:ae("inline-flex items-center justify-center border px-3 transition-colors","border-te-gray/40 bg-te-surface hover:border-te-gray",u.kind==="error"&&"border-te-accent/70 animate-[shake_0.25s]",Q&&"px-7",n.button),children:a?f.jsx(yg,{items:rS(a,i),tone:"idle",size:t}):f.jsx("span",{className:ae("font-mono uppercase text-te-light-gray",n.placeholder),children:r("hotkey:format.unbound")})},"display")}),Q?f.jsx("button",{type:"button",title:r("dialogs:hotkey_field.clear_title"),"aria-label":r("dialogs:hotkey_field.clear_aria"),onClick:z=>{z.stopPropagation(),M(null)},onMouseDown:z=>z.stopPropagation(),className:"absolute top-1/2 right-1.5 -translate-y-1/2 flex size-5 items-center justify-center text-te-light-gray opacity-0 transition-opacity group-hover:opacity-100 hover:text-te-fg focus-visible:opacity-100",children:f.jsx(Sr,{className:"size-3.5"})}):null]})]}),f.jsxs(tn,{initial:!1,children:[u.kind==="recording"?f.jsx(je.p,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},className:"text-right font-mono text-[10px] tracking-[0.18em] text-te-light-gray/70 uppercase",children:r("dialogs:hotkey_field.recording_hint")},"hint"):null,u.kind==="error"?f.jsxs(je.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},className:"flex items-center justify-end gap-1.5 font-mono text-[11px] text-te-accent",children:[f.jsx(Kf,{className:"size-3"}),f.jsxs("span",{children:[r("dialogs:hotkey_field.error_prefix"),": ",u.message]})]},"error"):null,u.kind==="conflict"?f.jsxs(je.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},className:"flex flex-col items-end gap-1.5 font-mono text-[11px]",children:[f.jsx("span",{className:"text-te-light-gray",children:r(`dialogs:hotkey_field.conflict_reason.${u.reason}`,{name:Pm[u.with]})}),f.jsxs("div",{className:"flex items-center gap-1.5",children:[f.jsx(vg,{variant:"ghost",onClick:N,children:r("dialogs:hotkey_field.cancel")}),f.jsxs(vg,{variant:"ghost",onClick:F,children:[f.jsx(Aa,{className:"size-3","aria-hidden":!0}),r("dialogs:hotkey_field.rebind")]}),f.jsx(vg,{variant:"solid",onClick:()=>{V()},children:r("dialogs:hotkey_field.replace")})]})]},"conflict-bar"):null,P.length>0?f.jsx(je.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},className:"flex flex-col items-end gap-0.5 font-mono text-[11px] text-te-accent/70",children:P.map(z=>f.jsxs("span",{className:"flex items-center gap-1.5",children:[f.jsx(Kf,{className:"size-3"}),r(z)]},z))},"warning-bar"):null]})]})}function nS(e,t){const n={};for(const r of t){if(r==="fn")continue;const i=e[r];i&&(n[r]=i)}return n}function NV({label:e,icon:t,side:n,tone:r,size:i}){return f.jsxs("span",{className:ae("inline-flex items-center justify-center border font-mono leading-none normal-case",r==="active"?"border-te-accent/50 bg-te-accent/12 text-te-accent":"border-te-gray/50 bg-te-surface-hover text-te-fg",L0[i].chip),children:[t?f.jsx("span",{"aria-hidden":!0,className:"mr-1 inline-flex items-center opacity-70",children:t}):null,n?f.jsx("span",{"aria-hidden":!0,className:"mr-1 text-[0.7em] font-bold opacity-70",children:n==="left"?"L":"R"}):null,e]})}function yg({items:e,tone:t,size:n}){return f.jsx("span",{className:"inline-flex items-center gap-1.5",children:e.map((r,i)=>f.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[i>0?f.jsx("span",{className:ae("font-mono leading-none",t==="active"?"text-te-accent/55":"text-te-light-gray/60",L0[n].chipSep),children:"+"}):null,f.jsx(NV,{label:r.label,icon:r.icon,side:r.side,tone:t,size:n})]},i))})}function FR(e,t){return hb(e,t,11)}function BR(e,t,n){return{label:fh(e,t),icon:FR(e,t),side:fb(e,t,n)??void 0}}function rS(e,t){if(e.kind==="doubleTap"&&e.mods.length>0){const r=e.mods[0];return[{label:`2× ${fh(r,t)}`,icon:FR(r,t),side:fb(r,t,wv(e,r))??void 0}]}const n=e.mods.map(r=>BR(r,t,wv(e,r)));return e.kind==="combo"&&e.code&&n.push({label:pb(e.code),icon:W$[e.code]}),n}function vg({onClick:e,children:t,variant:n}){return f.jsx("button",{type:"button",onClick:e,onMouseDown:r=>r.stopPropagation(),className:ae("inline-flex items-center gap-1 px-2.5 py-1 font-mono text-[11px] uppercase tracking-[0.15em] transition-colors",n==="solid"?"border border-te-accent bg-te-accent text-te-accent-fg hover:bg-te-accent/90":"border border-te-gray/40 text-te-light-gray hover:border-te-gray hover:text-te-fg"),children:t})}const fp={recordingControls:{id:"recordingControls",category:"action",threshold:3,autoHideMs:5e3,showDelayMs:500,i18nKeyPrefix:"recordingControls",devDescription:"录音中:松开结束 / ESC 取消"},resultActions:{id:"resultActions",category:"action",threshold:3,autoHideMs:6e3,showDelayMs:300,i18nKeyPrefix:"resultActions",devDescription:"结果态:复制 / 编辑 / 润色 / 翻译"},firstResultConfirm:{id:"firstResultConfirm",category:"confirm",threshold:1,autoHideMs:8e3,showDelayMs:0,i18nKeyPrefix:"firstResultConfirm",devDescription:"全局首次结果:✓ 已输入 · 修正"}};function WR(e,t){if(!e||!e.showHints)return!1;const n=fp[t];if(!n)return!1;const r=e.hints[t]??{successCount:0,dismissed:!1};return!(r.dismissed||r.successCount>=n.threshold)}const Nf=ui(e=>({forced:{},setForced:(t,n)=>e(r=>({forced:{...r.forced,[t]:n}})),clearAll:()=>e({forced:{}})}));function TV(){const{t:e}=de("settings"),t=re(u=>u.ui),n=re(u=>u.setShowHints),r=re(u=>u.markHintSuccess),i=re(u=>u.dismissHint),a=re(u=>u.resetHint),o=re(u=>u.resetAllHints),s=Nf(u=>u.forced),l=Nf(u=>u.setForced),c=Nf(u=>u.clearAll),d=Object.keys(fp);return f.jsxs("div",{className:"flex flex-col gap-4",children:[f.jsxs("div",{className:"flex items-center justify-between gap-3 border border-te-accent/40 bg-te-surface px-3 py-2",children:[f.jsxs("div",{className:"flex items-center gap-3",children:[f.jsx("span",{className:"font-mono text-[10px] uppercase tracking-[0.2em] text-te-accent",children:e("dev_hints.title")}),f.jsx("span",{className:"font-mono text-[10px] text-te-light-gray",children:e("dev_hints.subtitle")})]}),f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsxs("label",{className:"flex items-center gap-2 font-mono text-[11px] text-te-fg",children:[f.jsx("input",{type:"checkbox",checked:t.showHints,onChange:u=>{n(u.target.checked)},className:"size-3.5 accent-te-accent"}),e("dev_hints.global_switch")]}),f.jsx("button",{type:"button",onClick:()=>{o(),c()},className:"border border-te-gray/60 px-2 py-1 font-mono text-[11px] uppercase tracking-[0.1em] text-te-light-gray hover:border-te-accent hover:text-te-accent",children:e("dev_hints.reset_all")})]})]}),f.jsx("div",{className:"overflow-x-auto",children:f.jsxs("table",{className:"w-full border-collapse font-mono text-[11px]",children:[f.jsx("thead",{children:f.jsxs("tr",{className:"border-b border-te-gray/40 text-left text-te-light-gray",children:[f.jsx("th",{className:"px-2 py-2",children:e("dev_hints.col_id")}),f.jsx("th",{className:"px-2 py-2",children:e("dev_hints.col_category")}),f.jsx("th",{className:"px-2 py-2",children:e("dev_hints.col_threshold")}),f.jsx("th",{className:"px-2 py-2",children:e("dev_hints.col_success")}),f.jsx("th",{className:"px-2 py-2",children:e("dev_hints.col_dismissed")}),f.jsx("th",{className:"px-2 py-2",children:e("dev_hints.col_should")}),f.jsx("th",{className:"px-2 py-2",children:e("dev_hints.col_actions")})]})}),f.jsx("tbody",{children:d.map(u=>{const p=fp[u],h=t.hints[u]??{successCount:0,dismissed:!1},y=WR(t,u),g=s[u]===!0;return f.jsxs("tr",{className:"border-b border-te-gray/30 align-top text-te-fg",children:[f.jsxs("td",{className:"px-2 py-2",children:[f.jsx("div",{children:u}),f.jsx("div",{className:"mt-0.5 text-te-light-gray/80",children:p.devDescription})]}),f.jsx("td",{className:"px-2 py-2 text-te-light-gray",children:p.category}),f.jsx("td",{className:"px-2 py-2 tabular-nums",children:p.threshold}),f.jsx("td",{className:"px-2 py-2 tabular-nums",children:h.successCount}),f.jsx("td",{className:"px-2 py-2",children:h.dismissed?f.jsx("span",{className:"text-te-accent",children:e("dev_hints.yes")}):f.jsx("span",{className:"text-te-light-gray",children:e("dev_hints.no")})}),f.jsx("td",{className:"px-2 py-2",children:f.jsx("span",{className:ae("px-1.5 py-0.5",y?"border border-te-accent text-te-accent":"border border-te-gray/40 text-te-light-gray"),children:e(y?"dev_hints.yes":"dev_hints.no")})}),f.jsx("td",{className:"px-2 py-2",children:f.jsxs("div",{className:"flex flex-wrap items-center gap-1",children:[f.jsx("button",{type:"button",onClick:()=>{r(u)},className:"border border-te-gray/60 px-1.5 py-0.5 text-te-light-gray hover:border-te-accent hover:text-te-accent",children:"+1"}),f.jsx("button",{type:"button",onClick:()=>{i(u)},disabled:h.dismissed,className:"border border-te-gray/60 px-1.5 py-0.5 text-te-light-gray hover:border-te-accent hover:text-te-accent disabled:opacity-40",children:e("dev_hints.dismiss")}),f.jsx("button",{type:"button",onClick:()=>{a(u)},className:"border border-te-gray/60 px-1.5 py-0.5 text-te-light-gray hover:border-te-accent hover:text-te-accent",children:e("dev_hints.reset")}),f.jsx("button",{type:"button",onClick:()=>l(u,!g),className:ae("border px-1.5 py-0.5",g?"border-te-accent bg-te-accent text-te-bg":"border-te-gray/60 text-te-light-gray hover:border-te-accent hover:text-te-accent"),children:e(g?"dev_hints.forcing":"dev_hints.force")})]})})]},u)})})]})}),f.jsx("p",{className:"font-mono text-[10px] leading-relaxed text-te-light-gray/80",children:e("dev_hints.note")})]})}function OV(){const{t:e}=de("settings");return[{id:"GENERAL",label:e("tabs.general"),icon:wW},{id:"HOTKEYS",label:e("tabs.hotkeys"),icon:zO},{id:"DICTATION",label:e("tabs.dictation"),icon:as},{id:"AI",label:e("tabs.ai"),icon:AO},{id:"PROMPTS",label:e("tabs.prompts"),icon:Gb},{id:"ABOUT",label:e("tabs.about"),icon:Kb}]}function yi({children:e}){return f.jsxs("div",{className:"mt-10 mb-4 flex items-center gap-3 first:mt-0",children:[f.jsx("span",{className:"h-px w-4 bg-te-accent"}),f.jsx("h3",{className:"font-mono text-xs uppercase tracking-[0.25em] text-te-light-gray",children:e})]})}function rn({label:e,hint:t,children:n}){return f.jsxs("div",{className:"flex items-center justify-between gap-6 border-b border-te-gray/30 py-4 last:border-b-0",children:[f.jsxs("div",{className:"min-w-0 flex-1",children:[f.jsx("div",{className:"font-sans text-sm text-te-fg",children:e}),t?f.jsx("div",{className:"mt-1 font-sans text-xs text-te-light-gray/80",children:t}):null]}),f.jsx("div",{className:"shrink-0",children:n})]})}function Jo({checked:e,onChange:t,disabled:n}){return f.jsx("button",{type:"button",disabled:n,onClick:()=>t(!e),className:ae("relative flex h-[22px] w-10 items-center rounded-sm border transition-colors",e?"border-te-accent bg-te-accent":"border-te-gray/60 bg-te-gray",n&&"cursor-not-allowed opacity-40"),"aria-pressed":e,"aria-disabled":n,children:f.jsx(je.span,{layout:!0,transition:{type:"tween",duration:.18},className:ae("size-4",e?"ml-auto mr-[2px] bg-te-accent-fg":"ml-[2px] bg-te-bg")})})}function io({value:e,options:t,onChange:n,className:r}){const i=t.map(a=>typeof a=="string"?{value:a,label:a}:a);return f.jsxs("div",{className:ae("relative inline-flex items-center border border-te-gray/40 bg-te-surface transition-colors focus-within:border-te-accent hover:border-te-gray",r),children:[f.jsx("select",{value:e,onChange:a=>n(a.target.value),className:"min-w-[10rem] cursor-pointer appearance-none bg-transparent py-2 pr-8 pl-3 font-mono text-sm text-te-fg focus:outline-none",children:i.map(a=>f.jsx("option",{value:a.value,children:a.label},a.value))}),f.jsx(Pa,{className:"pointer-events-none absolute right-2 size-3.5 text-te-light-gray"})]})}function Qv({value:e,options:t,onChange:n}){return f.jsx("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2",children:t.map(r=>{const i=r.value===e;return f.jsxs("button",{type:"button",onClick:()=>n(r.value),className:ae("group relative flex flex-col items-start gap-1 border px-4 py-3 text-left transition-colors",i?"border-te-accent bg-te-accent/8 text-te-accent":"border-te-gray/40 text-te-fg hover:border-te-gray"),children:[f.jsxs("div",{className:"flex w-full items-center justify-between",children:[f.jsx("span",{className:"font-mono text-xs uppercase tracking-[0.15em]",children:r.label}),f.jsx("span",{className:ae("size-2",i?"bg-te-accent":"bg-te-gray")})]}),r.hint?f.jsx("span",{className:ae("font-sans text-xs",i?"text-te-accent/80":"text-te-light-gray"),children:r.hint}):null]},r.value)})})}function AV({peak:e}){const t=Math.max(0,Math.min(1,e)),n=t<.03?0:Math.sqrt(t),r=n===0?0:Math.min(5,Math.max(1,Math.ceil(n*5)));return f.jsx("div",{className:"flex items-center gap-1",children:Array.from({length:5}).map((i,a)=>f.jsx("span",{className:ae("h-4 w-6 border transition-colors",a<r?"border-te-accent bg-te-accent":"border-te-gray/40 bg-te-surface")},a))})}function RV(){const{t:e}=de("settings"),t=re(l=>l.general),n=re(l=>l.setGeneral),r=re(l=>l.dictation),i=re(l=>l.setDictationLang),a=re(l=>l.loaded),s=m.useMemo(()=>YW(r.lang,t.interfaceLang),[r.lang,t.interfaceLang])===t.translateTargetLang;return f.jsxs("div",{children:[f.jsx(yi,{children:e("section.language")}),f.jsx(rn,{label:e("general.interface_lang"),children:f.jsx(io,{value:t.interfaceLang,onChange:l=>{n("interfaceLang",l)},options:[{value:"system",label:e("common:lang.system")},{value:"zh-CN",label:e("common:lang.zh-CN")},{value:"zh-TW",label:e("common:lang.zh-TW")},{value:"en",label:e("common:lang.en")}]})}),f.jsx(rn,{label:e("general.dictation_output_lang"),hint:e("general.dictation_output_lang_hint"),children:f.jsx(io,{value:r.lang==="follow_interface"?"auto":r.lang,onChange:l=>{i(l)},options:[{value:"auto",label:e("dictation_lang.auto")},{value:"zh",label:e("dictation_lang.zh")},{value:"en",label:e("dictation_lang.en")},{value:"ja",label:e("dictation_lang.ja")},{value:"ko",label:e("dictation_lang.ko")},{value:"yue",label:e("dictation_lang.yue")}]})}),f.jsx(rn,{label:e("general.translate_target_lang"),hint:e("general.translate_target_lang_hint"),children:f.jsx(io,{value:t.translateTargetLang,onChange:l=>{n("translateTargetLang",l)},options:[{value:"en",label:e("translate_target_lang.en")},{value:"zh",label:e("translate_target_lang.zh")},{value:"zh-TW",label:e("translate_target_lang.zh-TW")},{value:"ja",label:e("translate_target_lang.ja")},{value:"ko",label:e("translate_target_lang.ko")},{value:"fr",label:e("translate_target_lang.fr")},{value:"de",label:e("translate_target_lang.de")},{value:"es",label:e("translate_target_lang.es")}]})}),s&&f.jsx("div",{className:"-mt-2 mb-3 px-1 font-mono text-[11px] uppercase tracking-[0.15em] text-red-500",children:e("general.translate_conflict_warning")}),f.jsx(rn,{label:e("general.translate_output_mode"),hint:e("general.translate_output_mode_hint"),children:f.jsx(io,{value:t.translateOutputMode,onChange:l=>{n("translateOutputMode",l)},options:[{value:"target_only",label:e("translate_output_mode.target_only")},{value:"bilingual",label:e("translate_output_mode.bilingual")}]})}),f.jsx(yi,{children:e("section.behavior")}),f.jsx(rn,{label:e("general.launch_startup"),children:f.jsx(Jo,{checked:t.launchStartup,onChange:l=>{n("launchStartup",l),$R(l)}})}),f.jsx(rn,{label:e("general.close_to_tray"),hint:e("general.close_to_tray_hint"),children:f.jsx(Jo,{checked:t.closeBehavior==="HIDE",onChange:l=>{n("closeBehavior",l?"HIDE":"ASK")}})}),f.jsx(rn,{label:e("general.update_policy"),hint:e("general.update_policy_hint"),children:f.jsx(io,{value:t.updatePolicy,onChange:l=>{n("updatePolicy",l)},options:[{value:"PROMPT",label:e("general.update_policy_options.prompt")},{value:"AUTO",label:e("general.update_policy_options.auto")},{value:"DISABLED",label:e("general.update_policy_options.disabled")}]})}),a?null:f.jsx("div",{className:"mt-6 font-mono text-xs text-te-light-gray/70",children:e("general.loading")})]})}function MV(){const{t:e}=de("settings"),t=nn(a=>a.resetAll),[n,r]=m.useState(!1),i=async()=>{await t(),r(!1),ke.success(e("hotkeys.reset_all_done"))};return f.jsxs("div",{children:[f.jsxs("div",{className:"mt-10 mb-4 flex items-center justify-between gap-3 first:mt-0",children:[f.jsxs("div",{className:"flex items-center gap-3",children:[f.jsx("span",{className:"h-px w-4 bg-te-accent"}),f.jsx("h3",{className:"font-mono text-xs uppercase tracking-[0.25em] text-te-light-gray",children:e("section.shortcuts")})]}),f.jsx("button",{type:"button",onClick:()=>r(!0),className:"border border-te-gray/40 bg-te-surface px-3 py-1.5 font-mono text-[11px] uppercase tracking-[0.15em] text-te-light-gray transition-colors hover:border-te-accent hover:text-te-accent",children:e("hotkeys.reset_all")})]}),f.jsx($0,{size:"comfortable"}),f.jsx(IV,{open:n,onOpenChange:r,onConfirm:()=>{i()}})]})}function IV({open:e,onOpenChange:t,onConfirm:n}){const{t:r}=de("settings");return f.jsx(Sn,{open:e,onOpenChange:t,children:f.jsxs(En,{showCloseButton:!1,className:"flex w-[92vw] max-w-sm flex-col !gap-0 rounded-none border border-te-dialog-border bg-te-dialog-bg p-0 shadow-2xl ring-0 sm:max-w-sm",children:[f.jsxs(Cn,{className:"border-b border-te-dialog-border bg-te-surface-hover px-5 py-4",children:[f.jsx(jn,{className:"font-mono text-base font-bold tracking-tighter text-te-fg",children:r("hotkeys.reset_all")}),f.jsx(Pn,{className:"sr-only",children:r("hotkeys.reset_all_confirm")})]}),f.jsx("div",{className:"px-5 py-5 font-sans text-sm text-te-light-gray",children:r("hotkeys.reset_all_confirm")}),f.jsxs("div",{className:"flex items-stretch border-t border-te-dialog-border",children:[f.jsx("button",{type:"button",onClick:()=>t(!1),className:"flex-1 border-r border-te-dialog-border px-4 py-3 font-mono text-xs uppercase tracking-[0.2em] text-te-light-gray transition-colors hover:bg-te-surface-hover hover:text-te-fg",children:r("common:actions.cancel")}),f.jsx("button",{type:"button",onClick:n,className:"flex-1 bg-te-accent px-4 py-3 font-mono text-xs uppercase tracking-[0.2em] text-te-accent-fg transition-colors hover:bg-te-accent/90",children:r("common:actions.confirm")})]})]})})}function DV(){const{t:e}=de("settings"),t=re(C=>C.general),n=re(C=>C.setGeneral),r=re(C=>C.loaded),i=re(C=>C.aiRefine),a=re(C=>C.setAiRefineEnabled),o=re(C=>C.dictation),s=re(C=>C.setDictationMode),l=re(C=>C.setDictationLang),c=re(C=>C.addDictationProvider),d=re(C=>C.updateDictationProvider),u=re(C=>C.removeDictationProvider),p=re(C=>C.setActiveDictationProvider),h=re(C=>C.setDictationStreamingInject),y=re(C=>C.setDictationClipboardCopy),[g,x]=m.useState([]);m.useEffect(()=>{(async()=>{const C=await P6();x(C)})()},[]);const[v,b]=m.useState(0),w=m.useRef(null);m.useEffect(()=>{let C,j=!1;const T=Bb(t.inputDevice||null);return(async()=>{const A=await Ue("openspeech://audio-level",R=>{const D=Math.max(0,Math.min(1,Number(R.payload)||0));b(D)});j?A():C=A})(),w.current=window.setInterval(()=>{b(A=>A>.02?A*.6:0)},150),()=>{j=!0,C?.(),cl(),T.then(A=>{A&&cl()}),w.current!==null&&(clearInterval(w.current),w.current=null)}},[t.inputDevice]);const _=m.useMemo(()=>g.find(C=>C.isDefault)?.name??"",[g]),k=t.inputDevice,S=k!==""&&g.some(C=>C.name===k)?k:_,E=m.useMemo(()=>{const C=[{value:"",label:_?e("device.system_default_with_current",{name:_}):e("device.system_default")}];for(const j of g)C.push({value:j.name,label:j.isDefault?e("device.is_default_suffix",{name:j.name}):j.name});return k&&!g.some(j=>j.name===k)&&C.push({value:k,label:_?e("device.disconnected_with_fallback",{name:k,fallback:_}):e("device.disconnected",{name:k})}),C},[g,k,_,e]);return f.jsxs("div",{children:[f.jsx(yi,{children:e("dictation_provider.section_mode")}),f.jsx("div",{className:"py-3",children:f.jsx(Qv,{value:o.mode,onChange:C=>{s(C)},options:[{value:"saas",label:e("dictation_provider.mode_saas_label"),hint:e("dictation_provider.mode_saas_hint")},{value:"custom",label:e("dictation_provider.mode_custom_label"),hint:e("dictation_provider.mode_custom_hint")}]})}),o.mode==="custom"&&f.jsxs(f.Fragment,{children:[f.jsx(yi,{children:e("dictation_provider.section_providers")}),o.customProviders.length===0?f.jsx("div",{className:"border border-dashed border-te-gray/40 px-4 py-6 text-center font-mono text-xs text-te-light-gray",children:e("dictation_provider.providers_empty")}):f.jsx("div",{className:"flex flex-col gap-3",children:o.customProviders.map(C=>f.jsx(FV,{provider:C,isActive:C.id===o.activeCustomProviderId,onUpdate:j=>{d(C.id,j)},onRemove:()=>{u(C.id)},onSetActive:()=>{p(C.id)}},C.id))}),f.jsxs("div",{className:"mt-4 flex flex-wrap gap-2",children:[f.jsxs("button",{type:"button",onClick:()=>{const C=typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID():`dict_${Date.now()}_${Math.random().toString(36).slice(2,8)}`;c({id:C,name:e("dictation_provider.tencent_default_name"),vendor:"tencent",tencentAppId:"",tencentRegion:"ap-shanghai"})},className:"inline-flex items-center gap-2 border border-te-gray/60 px-4 py-2 font-mono text-xs uppercase tracking-[0.2em] text-te-fg transition-colors hover:border-te-accent hover:text-te-accent",children:[f.jsx(us,{className:"size-3.5"}),e("dictation_provider.add_tencent")]}),f.jsxs("button",{type:"button",onClick:()=>{const C=typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID():`dict_${Date.now()}_${Math.random().toString(36).slice(2,8)}`;c({id:C,name:e("dictation_provider.aliyun_default_name"),vendor:"aliyun"})},className:"inline-flex items-center gap-2 border border-te-gray/60 px-4 py-2 font-mono text-xs uppercase tracking-[0.2em] text-te-fg transition-colors hover:border-te-accent hover:text-te-accent",children:[f.jsx(us,{className:"size-3.5"}),e("dictation_provider.add_aliyun")]})]})]}),f.jsx(yi,{children:e("section.audio")}),f.jsx(rn,{label:e("general.input_device"),children:f.jsx(io,{value:t.inputDevice,onChange:C=>{n("inputDevice",C)},className:"min-w-[18rem]",options:E})}),f.jsx(rn,{label:e("general.input_level"),hint:S?e("general.input_level_hint_listening",{name:S}):e("general.input_level_hint"),children:f.jsx(AV,{peak:v})}),f.jsx(rn,{label:e("general.cue_sound"),children:f.jsx(Jo,{checked:t.cueSound,onChange:C=>{n("cueSound",C)}})}),f.jsx(rn,{label:e("dictation_lang.label"),hint:e("dictation_lang.hint"),children:f.jsx(io,{value:o.lang==="follow_interface"?"auto":o.lang,onChange:C=>{l(C)},options:[{value:"auto",label:e("dictation_lang.auto")},{value:"zh",label:e("dictation_lang.zh")},{value:"en",label:e("dictation_lang.en")},{value:"ja",label:e("dictation_lang.ja")},{value:"ko",label:e("dictation_lang.ko")},{value:"yue",label:e("dictation_lang.yue")}]})}),f.jsx(yi,{children:e("section.asr_segment")}),f.jsx("div",{className:"py-3",children:f.jsx(Qv,{value:t.asrSegmentMode,onChange:C=>{n("asrSegmentMode",C)},options:[{value:"UTTERANCE",label:e("asr_segment.utterance_label"),hint:e("asr_segment.utterance_hint")},{value:"REALTIME",label:e("asr_segment.realtime_label"),hint:e("asr_segment.realtime_hint")}]})}),f.jsx(rn,{label:e("asr_segment.ai_refine_toggle.label"),hint:t.asrSegmentMode==="REALTIME"?e("asr_segment.ai_refine_toggle.disabled_in_realtime"):e("asr_segment.ai_refine_toggle.hint"),children:f.jsx(Jo,{checked:t.asrSegmentMode!=="REALTIME"&&i.enabled,disabled:t.asrSegmentMode==="REALTIME",onChange:C=>{a(C)}})}),f.jsx(yi,{children:e("section.output")}),f.jsx(rn,{label:e("output.streaming_inject.label"),hint:e("output.streaming_inject.hint"),children:f.jsx(Jo,{checked:o.streamingInject,onChange:C=>{h(C)}})}),f.jsx(rn,{label:e("output.clipboard_copy.label"),hint:e("output.clipboard_copy.hint"),children:f.jsx(Jo,{checked:o.clipboardCopy,onChange:C=>{y(C)}})}),r?null:f.jsx("div",{className:"mt-6 font-mono text-xs text-te-light-gray/70",children:e("general.loading")})]})}function LV(){const{t:e}=de("settings"),t=re(c=>c.aiRefine),n=re(c=>c.setAiRefineMode),r=re(c=>c.addAiProvider),i=re(c=>c.updateAiProvider),a=re(c=>c.removeAiProvider),o=re(c=>c.setActiveAiProvider),s=re(c=>c.setAiIncludeHistory),l=re(c=>c.setAiRecentHistoryCount);return f.jsxs("div",{children:[f.jsx(yi,{children:e("ai.section_mode")}),f.jsx("div",{className:"py-3",children:f.jsx(Qv,{value:t.mode,onChange:c=>{n(c)},options:[{value:"saas",label:e("ai.mode_saas_label"),hint:e("ai.mode_saas_hint")},{value:"custom",label:e("ai.mode_custom_label"),hint:e("ai.mode_custom_hint")}]})}),t.mode==="custom"&&f.jsxs(f.Fragment,{children:[f.jsx(yi,{children:e("ai.section_providers")}),t.customProviders.length===0?f.jsx("div",{className:"border border-dashed border-te-gray/40 px-4 py-6 text-center font-mono text-xs text-te-light-gray",children:e("ai.providers_empty")}):f.jsx("div",{className:"flex flex-col gap-3",children:t.customProviders.map(c=>f.jsx(zV,{provider:c,isActive:c.id===t.activeCustomProviderId,onUpdate:d=>{i(c.id,d)},onRemove:()=>{a(c.id)},onSetActive:()=>{o(c.id)}},c.id))}),f.jsx("div",{className:"mt-4 flex",children:f.jsxs("button",{type:"button",onClick:()=>{const c=typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID():`prov_${Date.now()}_${Math.random().toString(36).slice(2,8)}`;r({id:c,name:e("ai.provider_default_name"),baseUrl:e("ai.provider_default_base_url"),model:e("ai.provider_default_model")})},className:"inline-flex items-center gap-2 border border-te-gray/60 px-4 py-2 font-mono text-xs uppercase tracking-[0.2em] text-te-fg transition-colors hover:border-te-accent hover:text-te-accent",children:[f.jsx(us,{className:"size-3.5"}),e("ai.provider_add")]})})]}),f.jsx(yi,{children:e("ai.section_history")}),f.jsx(rn,{label:e("ai.include_history"),hint:e("ai.include_history_hint"),children:f.jsx(Jo,{checked:t.includeHistory,onChange:c=>{s(c)}})}),f.jsx(rn,{label:e("ai.recent_history_count"),hint:e("ai.recent_history_count_hint"),children:f.jsx(io,{value:String(t.recentHistoryCount),onChange:c=>{l(Number(c))},options:[{value:"3",label:"3"},{value:"5",label:"5"},{value:"10",label:"10"},{value:"15",label:"15"},{value:"20",label:"20"},{value:"30",label:"30"}]})})]})}function $V(){const{t:e}=de("settings"),t=re(x=>x.general.interfaceLang),n=re(x=>x.dictation.lang),r=lr(n,t),i=re(x=>x.aiRefine),a=re(x=>x.setCustomExamples),o=re(x=>x.setAiTranslationSystemPrompt),s=re(x=>x.setAiPolishSystemPrompt),l=re(x=>x.setAiMeetingSummaryPrompt),c=re(x=>x.setPolishScenarios),[d,u]=m.useState("refine"),p=[{id:"refine",label:e("ai.prompt_tab_refine")},{id:"translate",label:e("ai.prompt_tab_translate")},{id:"polish",label:e("ai.prompt_tab_polish")},{id:"meeting",label:e("ai.prompt_tab_meeting")}],h=hO[r],y=gO[r],g=mO[r];return f.jsxs("div",{className:"flex flex-col gap-4",children:[f.jsx("p",{className:"font-sans text-xs leading-relaxed text-te-light-gray",children:e("ai.prompts_intro")}),f.jsx("div",{className:"flex items-center gap-px border-b border-te-gray/30",children:p.map(x=>{const v=x.id===d;return f.jsx("button",{type:"button",onClick:()=>u(x.id),className:ae("relative -mb-px border-b-2 px-4 py-2 font-mono text-[11px] uppercase tracking-[0.2em] transition-colors",v?"border-te-accent text-te-accent":"border-transparent text-te-light-gray hover:text-te-fg"),children:x.label},x.id)})}),f.jsxs("div",{className:"pt-2",children:[d==="refine"&&f.jsxs("div",{className:"flex flex-col gap-6",children:[f.jsx("p",{className:"font-sans text-xs leading-relaxed text-te-light-gray",children:e("ai.refine_panel_intro")}),f.jsx(_V,{examples:i.customExamples,onChange:x=>{a(x)}})]}),d==="translate"&&f.jsx(gg,{description:e("ai.prompt_desc_translate"),value:i.customTranslationSystemPrompt??h,isCustom:i.customTranslationSystemPrompt!==null,onChange:x=>{o(x)},onReset:()=>{o(null)}}),d==="polish"&&f.jsxs("div",{className:"flex flex-col gap-8",children:[f.jsx(gg,{description:e("ai.prompt_desc_polish"),value:i.customPolishSystemPrompt??y,isCustom:i.customPolishSystemPrompt!==null,onChange:x=>{s(x)},onReset:()=>{s(null)}}),f.jsx("div",{className:"border-t border-te-gray/30 pt-6",children:f.jsx(EV,{scenarios:i.customPolishScenarios,onChange:x=>{c(x)}})})]}),d==="meeting"&&f.jsx(gg,{description:e("ai.prompt_desc_meeting"),value:i.customMeetingSummaryPrompt??g,isCustom:i.customMeetingSummaryPrompt!==null,onChange:x=>{l(x)},onReset:()=>{l(null)}})]})]})}function zV({provider:e,isActive:t,onUpdate:n,onRemove:r,onSetActive:i}){const{t:a}=de("settings"),o=re(x=>x.setAiProviderVerified),[s,l]=m.useState(""),[c,d]=m.useState(!1);m.useEffect(()=>{let x=!1;return(async()=>{try{const v=await OF(e.id);!x&&v!==null&&l(v)}catch(v){console.warn("[ai-refine] load api key failed:",v)}})(),()=>{x=!0}},[e.id]);const u=async()=>{if(c)try{await TF(e.id,s),d(!1),e.verified&&await o(e.id,!1)}catch(x){console.warn("[ai-refine] save api key failed:",x)}},[p,h]=m.useState(!1),y=async()=>{if(p)return!1;h(!0);try{await u();const x=(e.baseUrl??"").trim(),v=(e.model??"").trim();if(!x||!v)return ke.error(a("ai.provider_test_fail",{message:a("ai.provider_test_missing_fields")})),e.verified&&await o(e.id,!1),!1;let b="";const _=((await ea({mode:"custom",systemPrompt:"Reply with the single word: OK.",userText:"ping",customBaseUrl:x,customModel:v,customKeyringId:`ai_provider_${e.id}`},k=>{b+=k})).refinedText??b).trim();return console.info("[ai-refine][test] reply:",_),Ke(`[ai-refine][test] provider=${e.id} reply=${JSON.stringify(_)}`),_.length===0?(ke.error(a("ai.provider_test_fail",{message:a("ai.provider_test_empty_reply")})),e.verified&&await o(e.id,!1),!1):(ke.success(a("ai.provider_test_pass")),await o(e.id,!0),!0)}catch(x){const v=x instanceof Error?x.message:String(x);return ke.error(a("ai.provider_test_fail",{message:v})),e.verified&&await o(e.id,!1),!1}finally{h(!1)}},g=async()=>{p||!e.verified&&!await y()||i()};return f.jsxs("div",{className:ae("flex flex-col gap-3 border px-4 py-3 transition-colors",t?"border-te-accent bg-te-accent/8":"border-te-gray/40"),children:[f.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("span",{className:ae("size-2",t?"bg-te-accent":"bg-te-gray")}),f.jsx("span",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-te-light-gray",children:t?a("ai.provider_active"):e.id.slice(0,8)}),f.jsx("span",{className:ae("border px-2 py-0.5 font-mono text-[10px] uppercase tracking-[0.2em]",e.verified?"border-te-accent/60 text-te-accent":"border-amber-500/60 text-amber-500"),children:e.verified?a("dictation_provider.verified_badge"):a("dictation_provider.unverified_badge")})]}),f.jsxs("div",{className:"flex items-center gap-2",children:[!t&&f.jsx("button",{type:"button",onClick:()=>{g()},disabled:p,className:"border border-te-gray/60 px-3 py-1.5 font-mono text-[11px] uppercase tracking-[0.2em] text-te-fg transition-colors enabled:hover:border-te-accent enabled:hover:text-te-accent disabled:cursor-not-allowed disabled:opacity-50",children:a("ai.provider_set_active")}),f.jsxs("button",{type:"button",onClick:()=>{y()},disabled:p,className:"inline-flex items-center gap-1 border border-te-accent bg-te-accent px-3 py-1.5 font-mono text-[11px] uppercase tracking-[0.2em] text-te-bg transition-colors enabled:hover:bg-te-accent/85 disabled:cursor-not-allowed disabled:opacity-50",children:[p?f.jsx(jr,{className:"size-3 animate-spin"}):f.jsx(DO,{className:"size-3"}),a(p?"ai.provider_test_running":"ai.provider_test")]}),f.jsxs("button",{type:"button",onClick:r,className:"inline-flex items-center gap-1 border border-te-gray/60 px-3 py-1.5 font-mono text-[11px] uppercase tracking-[0.2em] text-te-light-gray transition-colors hover:border-red-400 hover:text-red-400",children:[f.jsx(di,{className:"size-3"}),a("ai.provider_remove")]})]})]}),f.jsxs("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2",children:[f.jsx(ml,{label:a("ai.provider_name"),value:e.name,onChange:x=>n({name:x})}),f.jsx(ml,{label:a("ai.provider_model"),value:e.model,onChange:x=>n({model:x})})]}),f.jsx(ml,{label:a("ai.provider_base_url"),value:e.baseUrl,onChange:x=>n({baseUrl:x})}),f.jsxs("div",{children:[f.jsx("div",{className:"mb-1 font-mono text-[11px] uppercase tracking-[0.2em] text-te-light-gray",children:a("ai.provider_api_key")}),f.jsx("input",{type:"password",value:s,onChange:x=>{l(x.target.value),d(!0)},onBlur:()=>{u()},className:"w-full border border-te-gray/40 bg-te-surface px-3 py-2 font-mono text-sm text-te-fg outline-none transition-colors focus:border-te-accent"}),f.jsx("div",{className:"mt-1 font-mono text-[11px] text-te-light-gray/80",children:a("ai.provider_api_key_hint")})]})]})}function FV({provider:e,isActive:t,onUpdate:n,onRemove:r,onSetActive:i}){const{t:a}=de("settings"),o=re(k=>k.setDictationProviderVerified),[s,l]=m.useState(""),[c,d]=m.useState(""),[u,p]=m.useState(""),[h,y]=m.useState(!1);m.useEffect(()=>{let k=!1;return(async()=>{try{const S=await MF(e.id);if(k||!S)return;S.vendor==="aliyun"&&l(S.apiKey),S.vendor==="tencent"&&(d(S.secretId),p(S.secretKey))}catch(S){console.warn("[dictation] load credentials failed:",S)}})(),()=>{k=!0}},[e.id]);const g=async()=>{if(h)try{const k=e.vendor==="aliyun"?{vendor:"aliyun",apiKey:s}:{vendor:"tencent",secretId:c,secretKey:u};await RF(e.id,k),y(!1),e.verified&&await o(e.id,!1)}catch(k){console.warn("[dictation] save credentials failed:",k)}},[x,v]=m.useState(!1),b=async()=>{if(x)return!1;v(!0);try{if(await g(),e.vendor==="aliyun"){if(!s.trim())return ke.error(a("dictation_provider.test_fail",{message:a("dictation_provider.test_missing_fields")})),!1}else if(!(e.tencentAppId??"").trim()||!c.trim()||!u.trim())return ke.error(a("dictation_provider.test_fail",{message:a("dictation_provider.test_missing_fields")})),!1;const k=await xV(e.vendor==="aliyun"?{vendor:"aliyun",apiKey:s}:{vendor:"tencent",appId:e.tencentAppId??"",region:e.tencentRegion??null,secretId:c,secretKey:u,cosBucket:e.tencentCosBucket??null});if(k.ok)return ke.success(a("dictation_provider.test_pass")),await o(e.id,!0),!0;const S=a(`dictation_provider.test_code.${k.code}`,{defaultValue:k.message})||k.message;return ke.error(a("dictation_provider.test_fail",{message:S})),e.verified&&await o(e.id,!1),!1}catch(k){const S=k instanceof Error?k.message:String(k);return ke.error(a("dictation_provider.test_fail",{message:S})),e.verified&&await o(e.id,!1),!1}finally{v(!1)}},w=async()=>{x||!e.verified&&!await b()||i()},_=e.vendor==="tencent"?a("dictation_provider.vendor_tencent"):a("dictation_provider.vendor_aliyun");return f.jsxs("div",{className:ae("flex flex-col gap-3 border px-4 py-3 transition-colors",t?"border-te-accent bg-te-accent/8":"border-te-gray/40"),children:[f.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("span",{className:ae("size-2",t?"bg-te-accent":"bg-te-gray")}),f.jsx("span",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-te-light-gray",children:t?a("dictation_provider.active_label",{vendor:_}):`${_} · ${e.id.slice(0,8)}`}),f.jsx("span",{className:ae("border px-2 py-0.5 font-mono text-[10px] uppercase tracking-[0.2em]",e.verified?"border-te-accent/60 text-te-accent":"border-amber-500/60 text-amber-500"),children:e.verified?a("dictation_provider.verified_badge"):a("dictation_provider.unverified_badge")})]}),f.jsxs("div",{className:"flex items-center gap-2",children:[!t&&f.jsx("button",{type:"button",onClick:()=>{w()},disabled:x,className:"border border-te-gray/60 px-3 py-1.5 font-mono text-[11px] uppercase tracking-[0.2em] text-te-fg transition-colors enabled:hover:border-te-accent enabled:hover:text-te-accent disabled:cursor-not-allowed disabled:opacity-50",children:a("dictation_provider.set_active")}),f.jsxs("button",{type:"button",onClick:()=>{b()},disabled:x,className:"inline-flex items-center gap-1 border border-te-accent bg-te-accent px-3 py-1.5 font-mono text-[11px] uppercase tracking-[0.2em] text-te-bg transition-colors enabled:hover:bg-te-accent/85 disabled:cursor-not-allowed disabled:opacity-50",children:[x?f.jsx(jr,{className:"size-3 animate-spin"}):f.jsx(DO,{className:"size-3"}),a(x?"dictation_provider.test_running":"dictation_provider.test")]}),f.jsxs("button",{type:"button",onClick:r,className:"inline-flex items-center gap-1 border border-te-gray/60 px-3 py-1.5 font-mono text-[11px] uppercase tracking-[0.2em] text-te-light-gray transition-colors hover:border-red-400 hover:text-red-400",children:[f.jsx(di,{className:"size-3"}),a("dictation_provider.remove")]})]})]}),f.jsx(ml,{label:a("dictation_provider.name_label"),value:e.name,onChange:k=>n({name:k})}),e.vendor==="tencent"?f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2",children:[f.jsx(ml,{label:a("dictation_provider.tencent_app_id"),value:e.tencentAppId??"",onChange:k=>n({tencentAppId:k}),required:!0}),f.jsx(ml,{label:a("dictation_provider.tencent_region"),value:e.tencentRegion??"",onChange:k=>n({tencentRegion:k}),required:!0})]}),f.jsxs("div",{children:[f.jsxs("div",{className:"mb-1 font-mono text-[11px] uppercase tracking-[0.2em] text-te-light-gray",children:[a("dictation_provider.tencent_cos_bucket_label"),f.jsx(Pc,{})]}),f.jsx("input",{type:"text",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1,placeholder:a("dictation_provider.tencent_cos_bucket_placeholder")??"",value:e.tencentCosBucket??"",onChange:k=>n({tencentCosBucket:k.target.value}),className:"w-full border border-te-gray/40 bg-te-surface px-3 py-2 font-mono text-sm text-te-fg outline-none transition-colors focus:border-te-accent"}),f.jsx("div",{className:"mt-1 font-mono text-[11px] text-te-light-gray/80",children:a("dictation_provider.tencent_cos_bucket_hint")})]}),f.jsxs("div",{children:[f.jsxs("div",{className:"mb-1 font-mono text-[11px] uppercase tracking-[0.2em] text-te-light-gray",children:[a("dictation_provider.tencent_secret_id"),f.jsx(Pc,{})]}),f.jsx("input",{type:"text",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1,value:c,onChange:k=>{d(k.target.value),y(!0)},onBlur:()=>{g()},className:"w-full border border-te-gray/40 bg-te-surface px-3 py-2 font-mono text-sm text-te-fg outline-none transition-colors focus:border-te-accent"})]}),f.jsxs("div",{children:[f.jsxs("div",{className:"mb-1 font-mono text-[11px] uppercase tracking-[0.2em] text-te-light-gray",children:[a("dictation_provider.tencent_secret_key"),f.jsx(Pc,{})]}),f.jsx("input",{type:"password",value:u,onChange:k=>{p(k.target.value),y(!0)},onBlur:()=>{g()},className:"w-full border border-te-gray/40 bg-te-surface px-3 py-2 font-mono text-sm text-te-fg outline-none transition-colors focus:border-te-accent"}),f.jsx("div",{className:"mt-1 font-mono text-[11px] text-te-light-gray/80",children:a("dictation_provider.tencent_credentials_hint")})]})]}):f.jsxs("div",{children:[f.jsxs("div",{className:"mb-1 font-mono text-[11px] uppercase tracking-[0.2em] text-te-light-gray",children:[a("dictation_provider.aliyun_api_key"),f.jsx(Pc,{})]}),f.jsx("input",{type:"password",value:s,onChange:k=>{l(k.target.value),y(!0)},onBlur:()=>{g()},className:"w-full border border-te-gray/40 bg-te-surface px-3 py-2 font-mono text-sm text-te-fg outline-none transition-colors focus:border-te-accent"}),f.jsx("div",{className:"mt-1 font-mono text-[11px] text-te-light-gray/80",children:a("dictation_provider.aliyun_api_key_hint")})]})]})}function Pc(){return f.jsx("span",{className:"ml-1 text-red-400",children:"*"})}function ml({label:e,value:t,onChange:n,required:r}){return f.jsxs("div",{children:[f.jsxs("div",{className:"mb-1 font-mono text-[11px] uppercase tracking-[0.2em] text-te-light-gray",children:[e,r?f.jsx(Pc,{}):null]}),f.jsx("input",{type:"text",value:t,onChange:i=>n(i.target.value),className:"w-full border border-te-gray/40 bg-te-surface px-3 py-2 font-mono text-sm text-te-fg outline-none transition-colors focus:border-te-accent"})]})}function BV(){const{t:e}=de("settings"),{t}=de("feedback"),n=mh(),r=re(_=>_.setGeneral),i=qe(_=>_.setSettingsOpen),a=qe(_=>_.openFeedback),[o,s]=m.useState(""),[l,c]=m.useState(!1),[d,u]=m.useState(null),[p,h]=m.useState(""),[y,g]=m.useState("stable");m.useEffect(()=>{Ah().then(s).catch(()=>s("unknown")),B("get_update_channel").then(_=>g(_==="beta"?"beta":"stable")).catch(()=>{}),B("get_platform_info").then(_=>u({os:_.os,arch:_.arch})).catch(()=>{})},[]);const x=d?(()=>{const _=d.os==="macos"?"macOS":d.os==="windows"?"Windows":d.os==="linux"?"Linux":d.os,k=d.os==="macos"&&d.arch==="aarch64"?"Apple Silicon":d.os==="macos"&&d.arch==="x86_64"?"Intel":d.arch;return`${_} · ${k}`})():"—",v=async _=>{if(_!==y){g(_);try{await B("set_update_channel",{channel:_}),Ke(`[updater] channel switched to ${_}`)}catch(k){ll(`[updater] channel switch failed: ${String(k?.message??k)}`)}}},b=async()=>{await r("onboardingCompleted",!1),i(!1),n("/onboarding",{replace:!0})},w=async()=>{if(!l){c(!0),Ke("[updater] about-page check start");try{const _=await Rb();_?(Ke(`[updater] about-page check found: ${_.version}`),ke.message(ie.t("pages:layout.tray.update_found_title"),{description:_.version,duration:3e4,action:{label:ie.t("settings:about.install_now"),onClick:()=>{jv(_,"about-page").catch(()=>{})}}})):(Ke("[updater] about-page check: no update"),ke(ie.t("pages:layout.tray.update_none")))}catch(_){ll(`[updater] about-page check failed: ${String(_?.message??_)}`),ke.error(ie.t("pages:layout.tray.update_check_failed"),{description:String(_?.message??_)})}finally{c(!1)}}};return f.jsxs("div",{children:[f.jsx(yi,{children:e("section.build")}),f.jsx(rn,{label:e("about.version"),children:f.jsxs("div",{className:"flex items-center gap-3",children:[f.jsx("span",{className:"font-mono text-sm text-te-fg",children:o?`v${o}`:"—"}),f.jsxs("button",{type:"button",onClick:()=>{w()},disabled:l,className:"inline-flex items-center gap-2 border border-te-gray/60 px-3 py-1.5 font-mono text-[11px] uppercase tracking-[0.2em] text-te-fg transition-colors hover:border-te-accent hover:text-te-accent disabled:cursor-not-allowed disabled:opacity-60",children:[f.jsx("span",{className:ae("size-1.5 bg-te-accent",l&&"animate-pulse")}),e("about.check_update")]})]})}),!1,f.jsx(rn,{label:e("about.platform"),children:f.jsx("span",{className:"font-mono text-sm text-te-fg",children:x})}),f.jsx(rn,{label:e("about.license"),children:f.jsx("span",{className:"font-mono text-sm text-te-fg",children:"PolyForm Noncommercial 1.0.0"})}),f.jsx(rn,{label:e("about.source"),children:f.jsxs("a",{href:"https://github.com/OpenLoaf/OpenSpeech",target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1.5 font-mono text-sm text-te-light-gray transition-colors hover:text-te-accent",children:["github.com/OpenLoaf/OpenSpeech",f.jsx(qb,{className:"size-3.5"})]})}),f.jsx(rn,{label:e("about.update_channel"),children:f.jsx("div",{className:"flex items-center gap-px border border-te-gray/60",children:["stable","beta"].map(_=>{const k=y===_;return f.jsx("button",{type:"button",onClick:()=>{v(_)},className:ae("px-3 py-1.5 font-mono text-[11px] uppercase tracking-[0.2em] transition-colors",k?"bg-te-accent text-te-bg":"bg-te-bg text-te-light-gray hover:text-te-fg"),children:e(`about.update_channel_${_}`)},_)})})}),f.jsx("div",{className:"-mt-2 px-1 pb-2 font-mono text-[11px] leading-relaxed text-te-light-gray",children:e("about.update_channel_hint")}),f.jsxs("div",{className:"flex flex-wrap items-center gap-3 py-4",children:[f.jsxs("button",{type:"button",onClick:()=>{b()},className:"inline-flex items-center gap-2 border border-te-gray/60 px-5 py-2.5 font-mono text-xs uppercase tracking-[0.2em] text-te-fg transition-colors hover:border-te-accent hover:text-te-accent",children:[f.jsx(oW,{className:"size-3.5"}),e("about.rerun_onboarding")]}),f.jsxs("button",{type:"button",onClick:()=>{a({returnToSettingsTab:"ABOUT"})},className:"inline-flex items-center gap-2 border border-te-gray/60 px-5 py-2.5 font-mono text-xs uppercase tracking-[0.2em] text-te-fg transition-colors hover:border-te-accent hover:text-te-accent",children:[f.jsx(Gb,{className:"size-3.5"}),t("menu_label")]}),f.jsxs("button",{type:"button",onClick:()=>{B("open_log_dir").catch(_=>{ll(`open_log_dir failed: ${String(_)}`),ke.error(String(_))})},className:"inline-flex items-center gap-2 border border-te-gray/60 px-5 py-2.5 font-mono text-xs uppercase tracking-[0.2em] text-te-fg transition-colors hover:border-te-accent hover:text-te-accent",children:[f.jsx(LO,{className:"size-3.5"}),e("about.open_log_dir")]})]})]})}function WV({tabs:e,active:t,onChange:n,actions:r}){const i=cn()==="macos";return f.jsxs("nav",{className:"flex flex-col gap-px border border-te-gray/30 bg-te-surface",children:[e.map((a,o)=>{const s=a.id===t,l=a.icon,c=i?`⌘ ${o+1}`:`Alt + ${o+1}`;return f.jsxs("button",{type:"button",onClick:()=>n(a.id),className:ae("group relative flex items-center gap-3 py-3 pr-4 pl-5 font-mono text-xs uppercase tracking-[0.2em] transition-colors",s?"bg-te-surface-hover text-te-accent":"text-te-light-gray hover:text-te-fg"),children:[f.jsx("span",{className:ae("absolute top-0 left-0 h-full w-[2px] transition-colors",s?"bg-te-accent":"bg-transparent")}),f.jsx(l,{className:"size-4 shrink-0"}),f.jsx("span",{children:a.label}),f.jsx("span",{"aria-hidden":!0,className:ae("ml-auto pl-4 font-mono text-[10px] normal-case tracking-normal transition-colors",s?"text-te-accent/35":"text-te-light-gray/20 group-hover:text-te-light-gray/40"),children:c})]},a.id)}),r?.map(a=>{const o=a.icon;return f.jsxs("button",{type:"button",onClick:a.onClick,className:"group relative flex items-center gap-3 py-3 pr-4 pl-5 font-mono text-xs uppercase tracking-[0.2em] text-te-light-gray transition-colors hover:text-te-fg",children:[f.jsx("span",{className:"absolute top-0 left-0 h-full w-[2px] bg-transparent"}),f.jsx(o,{className:"size-4 shrink-0"}),f.jsx("span",{children:a.label})]},a.id)})]})}function HR({initialTab:e="GENERAL"}={}){const{t}=de("settings"),[n,r]=m.useState(e),i=OV(),a=o=>{if(o===n)return;const s=re.getState(),l=[];if(n==="DICTATION"&&EO(s.dictation)&&(s.setDictationMode("saas"),l.push("dictation")),n==="AI"&&CO(s.aiRefine)&&(s.setAiRefineMode("saas"),l.push("ai")),l.length>0){const c=l.length===2?t("provider_rollback.both"):t(`provider_rollback.${l[0]}`);ke.message(f.jsx("span",{className:"text-te-accent",children:t("provider_rollback.title")}),{description:t("provider_rollback.description",{which:c})})}r(o)};return m.useEffect(()=>{const o=cn()==="macos",s=l=>{if(!(o?l.metaKey&&!l.ctrlKey&&!l.altKey:l.altKey&&!l.ctrlKey&&!l.metaKey)||l.shiftKey)return;const d=Number.parseInt(l.key,10);Number.isNaN(d)||d<1||d>i.length||(l.preventDefault(),a(i[d-1].id))};return document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[i,n]),f.jsxs("div",{className:"flex h-full min-h-0 w-full flex-col md:flex-row",children:[f.jsx(je.aside,{className:"flex w-full shrink-0 flex-col gap-6 overflow-y-auto border-b border-te-gray/30 p-3 md:w-60 md:border-b-0 md:border-r",initial:{opacity:0,x:-12},animate:{opacity:1,x:0},transition:{duration:.4},children:f.jsx(WV,{tabs:i,active:n,onChange:a})}),f.jsxs(je.div,{className:"min-w-0 min-h-0 flex-1 overflow-y-auto px-5 py-4",initial:{opacity:0,y:12},animate:{opacity:1,y:0},transition:{duration:.3},children:[n==="GENERAL"&&f.jsx(RV,{}),n==="HOTKEYS"&&f.jsx(MV,{}),n==="DICTATION"&&f.jsx(DV,{}),n==="AI"&&f.jsx(LV,{}),n==="PROMPTS"&&f.jsx($V,{}),n==="ABOUT"&&f.jsx(BV,{}),n==="DEV_HINTS"&&f.jsx(TV,{})]},n)]})}function HV(){const e=re.getState();return{dictation:EO(e.dictation),ai:CO(e.aiRefine)}}function UV({open:e,onOpenChange:t,initialTab:n="GENERAL"}){const{t:r}=de("settings"),[i,a]=m.useState(null),o=d=>{if(!d){const u=HV();if(u.dictation||u.ai){a(u);return}}t(d)},s=()=>{a(null)},l=async()=>{const d=re.getState();i?.dictation&&await d.setDictationMode("saas"),i?.ai&&await d.setAiRefineMode("saas"),a(null),t(!1)},c=i?i.dictation&&i.ai?r("provider_rollback.both"):i.dictation?r("provider_rollback.dictation"):r("provider_rollback.ai"):"";return f.jsxs(f.Fragment,{children:[f.jsx(Sn,{open:e,onOpenChange:o,children:f.jsxs(En,{className:"flex h-[82vh] w-[92vw] max-w-6xl flex-col !gap-0 rounded-none border border-te-dialog-border bg-te-dialog-bg p-0 shadow-2xl ring-0 sm:max-w-6xl",children:[f.jsxs(Cn,{className:"border-b border-te-dialog-border bg-te-surface-hover px-4 py-3",children:[f.jsx(jn,{className:"font-mono text-base font-bold tracking-tighter text-te-fg",children:r("page.dialog_title")}),f.jsx(Pn,{className:"sr-only",children:r("page.dialog_sr")})]}),f.jsx("div",{className:"flex min-h-0 flex-1",children:e?f.jsx(HR,{initialTab:n}):null})]})}),f.jsx(Sn,{open:i!=null,onOpenChange:d=>{d||s()},children:f.jsxs(En,{showCloseButton:!1,className:"flex w-[92vw] max-w-md flex-col !gap-0 rounded-none border border-te-dialog-border bg-te-dialog-bg p-0 shadow-2xl ring-0 sm:max-w-md",children:[f.jsxs(Cn,{className:"border-b border-te-dialog-border bg-te-surface-hover px-5 py-4",children:[f.jsx(jn,{className:"font-mono text-base font-bold tracking-tighter text-te-fg",children:r("provider_rollback.confirm_title")}),f.jsx(Pn,{className:"sr-only",children:r("provider_rollback.confirm_title")})]}),f.jsx("div",{className:"px-5 py-5 font-sans text-sm text-te-light-gray",children:r("provider_rollback.confirm_description",{which:c})}),f.jsxs("div",{className:"flex justify-end gap-2 border-t border-te-dialog-border bg-te-surface-hover px-4 py-3",children:[f.jsx("button",{type:"button",onClick:s,className:"border border-te-gray/60 px-3 py-1.5 font-mono text-[11px] uppercase tracking-[0.2em] text-te-fg transition-colors hover:border-te-accent hover:text-te-accent",children:r("provider_rollback.confirm_back_to_test")}),f.jsx("button",{type:"button",onClick:()=>{l()},className:"border border-amber-500/60 bg-amber-500/10 px-3 py-1.5 font-mono text-[11px] uppercase tracking-[0.2em] text-amber-200 transition-colors hover:bg-amber-500/20",children:r("provider_rollback.confirm_proceed")})]})]})})]})}function VV({open:e,onOpenChange:t,onConfirm:n}){const{t:r}=de(),[i,a]=m.useState(!1);return f.jsx(Sn,{open:e,onOpenChange:o=>{o||a(!1),t(o)},children:f.jsxs(En,{showCloseButton:!1,className:"flex w-[92vw] max-w-md flex-col !gap-0 rounded-none border border-te-dialog-border bg-te-dialog-bg p-0 shadow-2xl ring-0 sm:max-w-md",children:[f.jsxs(Cn,{className:"border-b border-te-dialog-border bg-te-surface-hover px-6 py-4",children:[f.jsx(jn,{className:"font-mono text-base font-bold tracking-tighter text-te-fg",children:r("dialogs:close_to_bg.title")}),f.jsx(Pn,{className:"sr-only",children:r("dialogs:close_to_bg.description")})]}),f.jsxs("div",{className:"space-y-3 px-6 py-5 font-sans text-sm text-te-fg",children:[f.jsxs("p",{children:[r("dialogs:close_to_bg.body_1_prefix"),f.jsx("span",{className:"text-te-accent",children:r("dialogs:close_to_bg.body_1_highlight")}),r("dialogs:close_to_bg.body_1_suffix")]}),f.jsx("p",{className:"text-te-light-gray",children:r("dialogs:close_to_bg.body_2")}),f.jsxs("label",{className:"mt-4 flex cursor-pointer items-center gap-3 pt-2 select-none",children:[f.jsx("span",{className:ae("relative flex size-4 items-center justify-center border transition-colors",i?"border-te-accent bg-te-accent":"border-te-gray/60 bg-te-surface"),children:i?f.jsx("span",{className:"size-1.5 bg-te-accent-fg","aria-hidden":!0}):null}),f.jsx("input",{type:"checkbox",checked:i,onChange:o=>a(o.target.checked),className:"sr-only"}),f.jsx("span",{className:"font-mono text-xs uppercase tracking-[0.15em] text-te-light-gray",children:r("dialogs:close_to_bg.remember")})]})]}),f.jsxs("div",{className:"flex items-stretch border-t border-te-dialog-border",children:[f.jsx("button",{type:"button",onClick:()=>n({remember:i,action:"quit"}),className:"flex-1 border-r border-te-dialog-border px-4 py-3 font-mono text-xs uppercase tracking-[0.2em] text-te-light-gray transition-colors hover:bg-te-surface-hover hover:text-te-fg",children:r("dialogs:close_to_bg.quit")}),f.jsx("button",{type:"button",onClick:()=>n({remember:i,action:"hide"}),className:"flex-1 bg-te-accent px-4 py-3 font-mono text-xs uppercase tracking-[0.2em] text-te-accent-fg transition-colors hover:bg-te-accent/90",children:r("dialogs:close_to_bg.stay")})]})]})})}const UR={AUTH_LOGIN_TIMEOUT:"errors:auth.login_timeout",AUTH_INTERNAL:"errors:auth.internal",AUTH_NOT_AUTHENTICATED:"errors:auth.not_authenticated"};function qV(e){const t=UR[e];return t?ie.t(t):e}function KV(e){return e in UR}function GV({className:e}){return f.jsxs("svg",{viewBox:"0 0 48 48",className:e,"aria-hidden":!0,children:[f.jsx("path",{fill:"#FFC107",d:"M43.611 20.083H42V20H24v8h11.303c-1.649 4.657-6.08 8-11.303 8-6.627 0-12-5.373-12-12s5.373-12 12-12c3.059 0 5.842 1.154 7.961 3.039l5.657-5.657C34.046 6.053 29.268 4 24 4 12.955 4 4 12.955 4 24s8.955 20 20 20 20-8.955 20-20c0-1.341-.138-2.65-.389-3.917z"}),f.jsx("path",{fill:"#FF3D00",d:"M6.306 14.691l6.571 4.819C14.655 15.108 18.961 12 24 12c3.059 0 5.842 1.154 7.961 3.039l5.657-5.657C34.046 6.053 29.268 4 24 4 16.318 4 9.656 8.337 6.306 14.691z"}),f.jsx("path",{fill:"#4CAF50",d:"M24 44c5.166 0 9.86-1.977 13.409-5.192l-6.19-5.238C29.211 35.091 26.715 36 24 36c-5.202 0-9.619-3.317-11.283-7.946l-6.522 5.025C9.505 39.556 16.227 44 24 44z"}),f.jsx("path",{fill:"#1976D2",d:"M43.611 20.083H42V20H24v8h11.303c-.792 2.237-2.231 4.166-4.087 5.571l.003-.002 6.19 5.238C36.971 39.205 44 34 44 24c0-1.341-.138-2.65-.389-3.917z"})]})}function YV({className:e}){return f.jsxs("svg",{viewBox:"0 0 48 48",className:e,"aria-hidden":!0,children:[f.jsx("path",{fill:"#09B83E",d:"M18.5 6C10.492 6 4 11.83 4 19.02c0 3.973 2.02 7.53 5.192 9.94L7.5 34l5.68-3.184c1.662.462 3.447.71 5.32.71.276 0 .55-.005.822-.016-.227-.828-.35-1.69-.35-2.576 0-5.87 5.604-10.627 12.52-10.627.325 0 .646.011.965.032C30.39 11.336 24.964 6 18.5 6zm-4.75 5.25c.966 0 1.75.784 1.75 1.75s-.784 1.75-1.75 1.75-1.75-.784-1.75-1.75.784-1.75 1.75-1.75zm9.5 0c.966 0 1.75.784 1.75 1.75s-.784 1.75-1.75 1.75-1.75-.784-1.75-1.75.784-1.75 1.75-1.75z"}),f.jsx("path",{fill:"#09B83E",d:"M44 28.87c0-5.89-5.82-10.664-13-10.664S18 22.98 18 28.87c0 5.887 5.82 10.662 13 10.662 1.54 0 3.02-.22 4.402-.623L40 41.066l-1.316-3.924C41.848 35.193 44 32.24 44 28.87zm-17.25-1.62a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3zm8.5 0a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3z"})]})}const XV={wechat:YV,google:GV},ZV=["wechat","google"];function QV(e,t){if(!e)return t("errors:auth.login_failed");if(KV(e))return qV(e);const n=e.toLowerCase();return n.includes("connection reset")?t("errors:auth.login_connection_reset"):n.includes("timed out")||n.includes("timeout")?t("errors:auth.login_timeout"):n.includes("connection refused")||n.includes("dns")||n.includes("error sending request")||n.includes("network error")?t("errors:auth.login_unreachable"):n.includes("not authenticated")?t("errors:auth.not_authenticated"):t("errors:auth.login_failed")}function JV({open:e,onOpenChange:t}){const{t:n}=de(),{loginStatus:r,loginError:i,lastProvider:a,isAuthenticated:o,startLogin:s,retryLogin:l,cancelLogin:c}=pt(),d=r==="opening"||r==="polling",u=r==="error",[p,h]=m.useState(!1);m.useEffect(()=>{e||h(!1)},[e]),m.useEffect(()=>{!e&&d&&c()},[e,d,c]),m.useEffect(()=>{if(e&&o){const g=window.setTimeout(()=>t(!1),800);return()=>window.clearTimeout(g)}},[e,o,t]);const y=o?n("dialogs:login.subtitle.success"):r==="opening"?n("dialogs:login.subtitle.opening"):r==="polling"?n("dialogs:login.subtitle.polling"):u?QV(i,n):n("dialogs:login.subtitle.idle");return f.jsx(Sn,{open:e,onOpenChange:(g,x)=>{if(!g&&d&&x?.reason==="escape-key"){x.cancel(),c();return}t(g)},children:f.jsxs(En,{className:"flex w-[92vw] max-w-md flex-col !gap-0 rounded-none border border-te-dialog-border bg-te-dialog-bg p-0 shadow-2xl ring-0",children:[f.jsxs(Cn,{className:"border-b border-te-dialog-border bg-te-surface-hover px-5 py-4",children:[f.jsx(jn,{className:"font-mono text-base font-bold tracking-tighter text-te-fg",children:n("dialogs:login.title")}),f.jsx("p",{className:"font-sans text-xs leading-snug text-te-light-gray",children:n("dialogs:login.openloaf_note")}),f.jsx(Pn,{className:"sr-only",children:n("dialogs:login.description")})]}),f.jsxs("div",{className:"flex flex-col gap-4 px-5 py-5",children:[f.jsx("div",{className:"flex flex-col gap-2",children:ZV.map(g=>{const x=XV[g];return f.jsxs("button",{type:"button",disabled:d||o,onClick:()=>{s(g)},className:ae("inline-flex w-full items-center justify-center gap-3 border border-te-gray bg-te-surface px-4 py-3 font-mono text-xs uppercase tracking-[0.2em] text-te-fg transition-colors",!d&&!o?"hover:border-te-accent hover:text-te-accent":"cursor-not-allowed opacity-50"),children:[f.jsx(x,{className:"size-5"}),n(`dialogs:login.providers.${g}`)]},g)})}),d||u||o?f.jsxs("div",{className:"flex items-center justify-center gap-2 pt-1",children:[f.jsx("span",{className:ae("size-1.5 shrink-0",u?"bg-red-500/70":o?"bg-green-500/80":"bg-te-accent")}),f.jsx("span",{className:ae("font-mono text-[11px] uppercase tracking-[0.2em]",u?"text-red-500/90":"text-te-light-gray"),children:y}),d?f.jsx(jr,{className:"size-3.5 shrink-0 animate-spin text-te-light-gray"}):null]}):null,u?f.jsxs("div",{className:"flex flex-col gap-2",children:[f.jsxs("div",{className:"flex items-center justify-center gap-2",children:[a?f.jsxs("button",{type:"button",onClick:()=>{l()},className:"inline-flex items-center gap-2 border border-te-accent bg-te-accent/10 px-4 py-2 font-mono text-[11px] uppercase tracking-[0.2em] text-te-accent transition-colors hover:bg-te-accent hover:text-te-bg",children:[f.jsx(Aa,{className:"size-3.5"}),n("dialogs:login.retry")]}):null,f.jsx("button",{type:"button",onClick:()=>t(!1),className:"inline-flex items-center gap-2 border border-te-gray px-4 py-2 font-mono text-[11px] uppercase tracking-[0.2em] text-te-light-gray transition-colors hover:border-te-fg hover:text-te-fg",children:n("dialogs:login.close")})]}),i?f.jsxs("div",{className:"flex flex-col items-center gap-1",children:[f.jsxs("button",{type:"button",onClick:()=>h(g=>!g),className:"inline-flex items-center gap-1 font-mono text-[10px] uppercase tracking-[0.25em] text-te-light-gray transition-colors hover:text-te-fg",children:[f.jsx(Pa,{className:ae("size-3 transition-transform",p?"rotate-180":"rotate-0")}),n(p?"dialogs:login.details_hide":"dialogs:login.details_show")]}),p?f.jsx("pre",{className:"max-h-32 w-full overflow-auto whitespace-pre-wrap break-all border border-te-gray/40 bg-te-surface/40 px-3 py-2 font-mono text-[10px] leading-relaxed text-te-light-gray",children:i}):null]}):null]}):null,d?f.jsx("button",{type:"button",onClick:()=>{c()},className:"self-center font-mono text-[11px] uppercase tracking-[0.2em] text-te-light-gray transition-colors hover:text-te-fg",children:n("dialogs:login.cancel")}):null]})]})})}function eq({open:e,onOpenChange:t}){const{t:n}=de(),[r,i]=m.useState(!1),[a,o]=m.useState(!1);m.useEffect(()=>{if(!e)return;o(!1);const l=()=>t(!1);return window.addEventListener("online",l),()=>window.removeEventListener("online",l)},[e,t]);const s=()=>{i(!0),o(!1),window.setTimeout(()=>{navigator.onLine?t(!1):o(!0),i(!1)},350)};return f.jsx(Sn,{open:e,onOpenChange:t,children:f.jsxs(En,{showCloseButton:!0,className:"flex w-[92vw] max-w-md flex-col !gap-0 rounded-none border border-te-dialog-border bg-te-dialog-bg p-0 shadow-2xl ring-0 sm:max-w-md",children:[f.jsxs(Cn,{className:"flex flex-row items-center gap-2 border-b border-te-dialog-border bg-te-surface-hover px-5 py-4",children:[f.jsx(Kf,{className:"size-4 shrink-0 text-te-accent","aria-hidden":!0}),f.jsx(jn,{className:"font-mono text-base font-bold tracking-tighter text-te-fg",children:n("dialogs:no_internet.title")}),f.jsx(Pn,{className:"sr-only",children:n("dialogs:no_internet.description")})]}),f.jsxs("div",{className:"px-5 py-5",children:[f.jsx("p",{className:"font-sans text-sm leading-relaxed text-te-light-gray",children:n("dialogs:no_internet.body")}),a?f.jsx("p",{className:"mt-2 font-mono text-[11px] uppercase tracking-[0.18em] text-te-accent",children:n("dialogs:no_internet.still_offline")}):null,f.jsx("div",{className:"mt-5 flex justify-center",children:f.jsxs("button",{type:"button",disabled:r,onClick:s,className:ae("inline-flex items-center justify-center gap-2 border border-te-gray bg-te-surface px-5 py-2.5 font-mono text-xs uppercase tracking-[0.2em] text-te-fg transition-colors",r?"cursor-not-allowed opacity-50":"hover:border-te-accent hover:text-te-accent"),children:[f.jsx(Iu,{className:ae("size-3.5",r&&"animate-spin"),"aria-hidden":!0}),n("dialogs:no_internet.retry")]})})]})]})})}const tq=["bug","feature","ui","performance","chat","other"];function nq(...e){for(const t of e){const n=t?.trim();if(n&&!(/@wechat\.local$/i.test(n)||/\.local$/i.test(n)))return n}return""}function rq({open:e,onOpenChange:t}){const{t:n}=de("feedback"),r=pt(w=>w.user),i=pt(w=>w.profile),[a,o]=m.useState("bug"),[s,l]=m.useState(""),[c,d]=m.useState(""),[u,p]=m.useState(!0),[h,y]=m.useState(!1),[g,x]=m.useState(!1);m.useEffect(()=>{e&&(o("bug"),l(""),d(nq(r?.email,i?.email)),p(!0),y(!1),x(!1))},[e,r?.email,i?.email]),m.useEffect(()=>{h||p(a==="bug")},[a,h]);const v=m.useMemo(()=>tq.map(w=>({id:w,label:n(`type.${w}`)})),[n]),b=async()=>{if(g)return;const w=s.trim();if(w.length===0){ke.error(n("validation.content_required"));return}const _=c.trim();if(_.length>0&&!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(_)){ke.error(n("validation.email_invalid"));return}x(!0);try{const k=await Ah().catch(()=>"");let S=null;if(u)try{S=await B("read_recent_log_tail")}catch(E){console.warn("[feedback] read log tail failed",E),ke.warning(n("attach_logs_failed"))}await B("openloaf_submit_feedback",{payload:{type:a,content:w,email:_||null,context:{platform:cn(),appVersion:k,userAgent:typeof navigator<"u"?navigator.userAgent:"",...S?{logs:S}:{}}}}),ke.success(n("toast.success")),t(!1)}catch(k){const S=String(k??"");S==="FEEDBACK_AUTH_LOST"?ke.error(n("toast.auth_lost")):S==="FEEDBACK_NETWORK"?ke.error(n("toast.network")):S==="FEEDBACK_TIMEOUT"?ke.error(n("toast.timeout")):ke.error(n("toast.generic",{message:S}))}finally{x(!1)}};return f.jsx(Sn,{open:e,onOpenChange:t,children:f.jsxs(En,{showCloseButton:!0,className:"flex w-[92vw] max-w-lg flex-col !gap-0 rounded-none border border-te-dialog-border bg-te-dialog-bg p-0 shadow-2xl ring-0 sm:max-w-lg",children:[f.jsxs(Cn,{className:"flex flex-row items-center gap-2 border-b border-te-dialog-border bg-te-surface-hover px-5 py-4",children:[f.jsx(Gb,{className:"size-4 shrink-0 text-te-accent","aria-hidden":!0}),f.jsx(jn,{className:"font-mono text-base font-bold tracking-tighter text-te-fg",children:n("dialog_title")}),f.jsx(Pn,{className:"sr-only",children:n("dialog_description")})]}),f.jsxs("div",{className:"flex flex-col gap-5 px-5 py-5",children:[f.jsx("p",{className:"font-sans text-xs leading-relaxed text-te-light-gray",children:n("dialog_description")}),f.jsxs("div",{children:[f.jsx("label",{className:"mb-1.5 block font-mono text-[10px] uppercase tracking-[0.2em] text-te-light-gray",children:n("type_label")}),f.jsxs("div",{className:"relative inline-flex w-full items-center border border-te-gray/40 bg-te-surface transition-colors focus-within:border-te-accent hover:border-te-gray",children:[f.jsx("select",{value:a,onChange:w=>o(w.target.value),disabled:g,className:"w-full cursor-pointer appearance-none bg-transparent py-2 pr-8 pl-3 font-mono text-sm text-te-fg focus:outline-none disabled:cursor-not-allowed disabled:opacity-60",children:v.map(w=>f.jsx("option",{value:w.id,children:w.label},w.id))}),f.jsx(Pa,{className:"pointer-events-none absolute right-2 size-3.5 text-te-light-gray"})]})]}),f.jsxs("div",{children:[f.jsx("label",{className:"mb-1.5 block font-mono text-[10px] uppercase tracking-[0.2em] text-te-light-gray",children:n("content_label")}),f.jsx("textarea",{value:s,onChange:w=>l(w.target.value),disabled:g,placeholder:n("content_placeholder"),rows:6,className:"w-full resize-none border border-te-gray/40 bg-te-surface px-3 py-2 font-sans text-sm text-te-fg placeholder:text-te-light-gray/60 transition-colors focus:border-te-accent focus:outline-none disabled:cursor-not-allowed disabled:opacity-60"})]}),f.jsxs("div",{children:[f.jsx("label",{className:"mb-1.5 block font-mono text-[10px] uppercase tracking-[0.2em] text-te-light-gray",children:n("email_label")}),f.jsx("input",{type:"email",value:c,onChange:w=>d(w.target.value),disabled:g,placeholder:n("email_placeholder"),className:"w-full border border-te-gray/40 bg-te-surface px-3 py-2 font-mono text-sm text-te-fg placeholder:text-te-light-gray/60 transition-colors focus:border-te-accent focus:outline-none disabled:cursor-not-allowed disabled:opacity-60"}),f.jsx("p",{className:"mt-1 font-sans text-[11px] text-te-light-gray/80",children:n("email_hint")})]}),f.jsx("div",{children:f.jsxs("button",{type:"button",role:"checkbox","aria-checked":u,onClick:()=>{y(!0),p(w=>!w)},disabled:g,className:"group flex w-full items-start gap-3 text-left disabled:cursor-not-allowed disabled:opacity-60",children:[f.jsx("span",{className:ae("mt-0.5 flex size-4 shrink-0 items-center justify-center border transition-colors",u?"border-te-accent bg-te-accent text-te-accent-fg":"border-te-gray/60 bg-te-surface group-hover:border-te-gray"),"aria-hidden":!0,children:u&&f.jsx(Er,{className:"size-3",strokeWidth:3})}),f.jsxs("span",{className:"flex-1",children:[f.jsx("span",{className:"block font-mono text-xs text-te-fg",children:n("attach_logs_label")}),f.jsx("span",{className:"mt-1 block font-sans text-[11px] leading-relaxed text-te-light-gray/80",children:n("attach_logs_hint")})]})]})}),f.jsxs("div",{className:"flex flex-row-reverse items-center gap-3 pt-1",children:[f.jsxs("button",{type:"button",onClick:()=>{b()},disabled:g,className:ae("inline-flex items-center gap-2 border border-te-accent bg-te-accent px-5 py-2.5 font-mono text-xs uppercase tracking-[0.2em] text-te-accent-fg transition-colors",g?"cursor-not-allowed opacity-60":"hover:bg-te-accent/90"),children:[f.jsx(FO,{className:ae("size-3.5",g&&"animate-pulse"),"aria-hidden":!0}),n(g?"submit_loading":"submit")]}),f.jsx("button",{type:"button",onClick:()=>t(!1),disabled:g,className:"inline-flex items-center gap-2 border border-te-gray bg-te-surface px-4 py-2.5 font-mono text-xs uppercase tracking-[0.2em] text-te-light-gray transition-colors hover:border-te-gray hover:text-te-fg disabled:cursor-not-allowed disabled:opacity-60",children:n("cancel")})]})]})]})})}const iS=new Set(ub);function iq(){const{t:e}=de(),t=qe(s=>s.hotkeyConflicts),n=qe(s=>s.clearHotkeyConflicts),r=m.useMemo(()=>t.filter(s=>iS.has(s.id)),[t]),i=m.useMemo(()=>r.map(s=>s.id),[r]),a=i.length>0,o=s=>{if(s)return;const l=qe.getState().hotkeyConflicts.filter(d=>iS.has(d.id));if(l.length===0){n();return}const c=nn.getState().setBinding;Promise.all(l.map(d=>c(d.id,null))).finally(()=>{n()}),ke.message(e("dialogs:hotkey_conflict.cleared_toast",{count:l.length}))};return f.jsx(Sn,{open:a,onOpenChange:o,children:f.jsxs(En,{showCloseButton:!0,className:"flex w-[92vw] max-w-md flex-col !gap-0 rounded-none border border-te-dialog-border bg-te-dialog-bg p-0 shadow-2xl ring-0 sm:max-w-md",children:[f.jsxs(Cn,{className:"flex flex-row items-center gap-2 border-b border-te-dialog-border bg-te-surface-hover px-5 py-4",children:[f.jsx(_l,{className:"size-4 shrink-0 text-te-accent","aria-hidden":!0}),f.jsx(jn,{className:"font-mono text-base font-bold tracking-tighter text-te-fg",children:e("dialogs:hotkey_conflict.title")}),f.jsx(Pn,{className:"sr-only",children:e("dialogs:hotkey_conflict.description",{count:i.length})})]}),f.jsx("div",{className:"px-5 pt-4 pb-3 font-sans text-sm leading-relaxed text-te-light-gray",children:e("dialogs:hotkey_conflict.description",{count:i.length})}),f.jsx("div",{className:"px-5 pt-1 pb-4",children:f.jsx($0,{filterIds:i,divided:!0})})]})})}function aq(){const{t:e}=de(),t=qe(c=>c.authRecoveryDialog),n=qe(c=>c.closeAuthRecoveryDialog),r=mt(c=>c.items),[i,a]=m.useState(!1),o=m.useMemo(()=>t.historyId?r.find(c=>c.id===t.historyId)??null:null,[t.historyId,r]),s=m.useMemo(()=>o?(o.refined_text??o.text??"").trim():"",[o]);m.useEffect(()=>{t.open||a(!1)},[t.open]);const l=async()=>{if(s)try{await zn(s),a(!0),window.setTimeout(()=>a(!1),1800)}catch(c){console.warn("[auth-recovery] copy failed:",c)}};return f.jsx(Sn,{open:t.open,onOpenChange:c=>{c||n()},children:f.jsxs(En,{showCloseButton:!0,className:"flex w-[92vw] max-w-md flex-col !gap-0 rounded-none border border-te-dialog-border bg-te-dialog-bg p-0 shadow-2xl ring-0 sm:max-w-lg",children:[f.jsxs(Cn,{className:"flex flex-row items-start gap-2 border-b border-te-dialog-border bg-te-surface-hover py-4 pr-12 pl-5",children:[t.status==="pending"?f.jsx(jr,{className:"mt-0.5 size-4 shrink-0 animate-spin text-te-accent","aria-hidden":!0}):t.status==="error"?f.jsx(_l,{className:"mt-0.5 size-4 shrink-0 text-[#ff4d4d]","aria-hidden":!0}):f.jsx(Kk,{className:"mt-0.5 size-4 shrink-0 text-te-accent","aria-hidden":!0}),f.jsx(jn,{className:"min-w-0 flex-1 font-mono text-base font-bold tracking-tighter text-te-fg",children:e(`dialogs:auth_recovery.title_${t.status}`)}),f.jsx(Pn,{className:"sr-only",children:e(`dialogs:auth_recovery.description_${t.status}`)})]}),f.jsxs("div",{className:"flex flex-col gap-4 px-5 py-5",children:[f.jsx("p",{className:"font-sans text-sm leading-relaxed text-te-light-gray",children:e(`dialogs:auth_recovery.description_${t.status}`)}),t.status==="success"&&f.jsx("div",{className:"flex max-h-72 flex-col gap-2 overflow-hidden",children:f.jsx("div",{className:ae("max-h-72 overflow-auto whitespace-pre-wrap break-words border border-te-gray/40 bg-te-surface px-3 py-2 font-sans text-sm leading-relaxed text-te-fg"),children:s||e("dialogs:auth_recovery.empty_transcript")})}),t.status==="error"&&t.errorMessage&&f.jsx("div",{className:"border border-[#ff4d4d]/40 bg-[#ff4d4d]/5 px-3 py-2 font-mono text-xs leading-relaxed break-words text-[#ff4d4d]",children:t.errorMessage}),f.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-2",children:[t.status==="success"&&f.jsxs("button",{type:"button",onClick:()=>{l()},disabled:!s,className:ae("inline-flex items-center justify-center gap-2 border px-4 py-2 font-mono text-xs uppercase tracking-[0.2em] transition",i?"border-te-accent bg-te-accent text-te-accent-fg":"border-te-accent text-te-accent hover:bg-te-accent hover:text-te-accent-fg",!s&&"cursor-not-allowed opacity-40 hover:bg-transparent hover:text-te-accent"),children:[i?f.jsx(Kk,{className:"size-3.5","aria-hidden":!0}):f.jsx(_s,{className:"size-3.5","aria-hidden":!0}),e(i?"dialogs:auth_recovery.copied":"dialogs:auth_recovery.copy")]}),f.jsx("button",{type:"button",onClick:n,disabled:t.status==="pending",className:ae("inline-flex items-center justify-center border border-te-gray bg-te-surface px-4 py-2 font-mono text-xs uppercase tracking-[0.2em] text-te-fg transition hover:border-te-accent hover:text-te-accent",t.status==="pending"&&"cursor-not-allowed opacity-40 hover:border-te-gray hover:text-te-fg"),children:e(t.status==="pending"?"dialogs:auth_recovery.close_disabled":"dialogs:auth_recovery.close")})]})]})]})})}var oq=["dangerouslySetInnerHTML","onCopy","onCopyCapture","onCut","onCutCapture","onPaste","onPasteCapture","onCompositionEnd","onCompositionEndCapture","onCompositionStart","onCompositionStartCapture","onCompositionUpdate","onCompositionUpdateCapture","onFocus","onFocusCapture","onBlur","onBlurCapture","onChange","onChangeCapture","onBeforeInput","onBeforeInputCapture","onInput","onInputCapture","onReset","onResetCapture","onSubmit","onSubmitCapture","onInvalid","onInvalidCapture","onLoad","onLoadCapture","onError","onErrorCapture","onKeyDown","onKeyDownCapture","onKeyPress","onKeyPressCapture","onKeyUp","onKeyUpCapture","onAbort","onAbortCapture","onCanPlay","onCanPlayCapture","onCanPlayThrough","onCanPlayThroughCapture","onDurationChange","onDurationChangeCapture","onEmptied","onEmptiedCapture","onEncrypted","onEncryptedCapture","onEnded","onEndedCapture","onLoadedData","onLoadedDataCapture","onLoadedMetadata","onLoadedMetadataCapture","onLoadStart","onLoadStartCapture","onPause","onPauseCapture","onPlay","onPlayCapture","onPlaying","onPlayingCapture","onProgress","onProgressCapture","onRateChange","onRateChangeCapture","onSeeked","onSeekedCapture","onSeeking","onSeekingCapture","onStalled","onStalledCapture","onSuspend","onSuspendCapture","onTimeUpdate","onTimeUpdateCapture","onVolumeChange","onVolumeChangeCapture","onWaiting","onWaitingCapture","onAuxClick","onAuxClickCapture","onClick","onClickCapture","onContextMenu","onContextMenuCapture","onDoubleClick","onDoubleClickCapture","onDrag","onDragCapture","onDragEnd","onDragEndCapture","onDragEnter","onDragEnterCapture","onDragExit","onDragExitCapture","onDragLeave","onDragLeaveCapture","onDragOver","onDragOverCapture","onDragStart","onDragStartCapture","onDrop","onDropCapture","onMouseDown","onMouseDownCapture","onMouseEnter","onMouseLeave","onMouseMove","onMouseMoveCapture","onMouseOut","onMouseOutCapture","onMouseOver","onMouseOverCapture","onMouseUp","onMouseUpCapture","onSelect","onSelectCapture","onTouchCancel","onTouchCancelCapture","onTouchEnd","onTouchEndCapture","onTouchMove","onTouchMoveCapture","onTouchStart","onTouchStartCapture","onPointerDown","onPointerDownCapture","onPointerMove","onPointerMoveCapture","onPointerUp","onPointerUpCapture","onPointerCancel","onPointerCancelCapture","onPointerEnter","onPointerEnterCapture","onPointerLeave","onPointerLeaveCapture","onPointerOver","onPointerOverCapture","onPointerOut","onPointerOutCapture","onGotPointerCapture","onGotPointerCaptureCapture","onLostPointerCapture","onLostPointerCaptureCapture","onScroll","onScrollCapture","onWheel","onWheelCapture","onAnimationStart","onAnimationStartCapture","onAnimationEnd","onAnimationEndCapture","onAnimationIteration","onAnimationIterationCapture","onTransitionEnd","onTransitionEndCapture"];function z0(e){if(typeof e!="string")return!1;var t=oq;return t.includes(e)}var sq=["aria-activedescendant","aria-atomic","aria-autocomplete","aria-busy","aria-checked","aria-colcount","aria-colindex","aria-colspan","aria-controls","aria-current","aria-describedby","aria-details","aria-disabled","aria-errormessage","aria-expanded","aria-flowto","aria-haspopup","aria-hidden","aria-invalid","aria-keyshortcuts","aria-label","aria-labelledby","aria-level","aria-live","aria-modal","aria-multiline","aria-multiselectable","aria-orientation","aria-owns","aria-placeholder","aria-posinset","aria-pressed","aria-readonly","aria-relevant","aria-required","aria-roledescription","aria-rowcount","aria-rowindex","aria-rowspan","aria-selected","aria-setsize","aria-sort","aria-valuemax","aria-valuemin","aria-valuenow","aria-valuetext","className","color","height","id","lang","max","media","method","min","name","style","target","width","role","tabIndex","accentHeight","accumulate","additive","alignmentBaseline","allowReorder","alphabetic","amplitude","arabicForm","ascent","attributeName","attributeType","autoReverse","azimuth","baseFrequency","baselineShift","baseProfile","bbox","begin","bias","by","calcMode","capHeight","clip","clipPath","clipPathUnits","clipRule","colorInterpolation","colorInterpolationFilters","colorProfile","colorRendering","contentScriptType","contentStyleType","cursor","cx","cy","d","decelerate","descent","diffuseConstant","direction","display","divisor","dominantBaseline","dur","dx","dy","edgeMode","elevation","enableBackground","end","exponent","externalResourcesRequired","fill","fillOpacity","fillRule","filter","filterRes","filterUnits","floodColor","floodOpacity","focusable","fontFamily","fontSize","fontSizeAdjust","fontStretch","fontStyle","fontVariant","fontWeight","format","from","fx","fy","g1","g2","glyphName","glyphOrientationHorizontal","glyphOrientationVertical","glyphRef","gradientTransform","gradientUnits","hanging","horizAdvX","horizOriginX","href","ideographic","imageRendering","in2","in","intercept","k1","k2","k3","k4","k","kernelMatrix","kernelUnitLength","kerning","keyPoints","keySplines","keyTimes","lengthAdjust","letterSpacing","lightingColor","limitingConeAngle","local","markerEnd","markerHeight","markerMid","markerStart","markerUnits","markerWidth","mask","maskContentUnits","maskUnits","mathematical","mode","numOctaves","offset","opacity","operator","order","orient","orientation","origin","overflow","overlinePosition","overlineThickness","paintOrder","panose1","pathLength","patternContentUnits","patternTransform","patternUnits","pointerEvents","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","r","radius","refX","refY","renderingIntent","repeatCount","repeatDur","requiredExtensions","requiredFeatures","restart","result","rotate","rx","ry","seed","shapeRendering","slope","spacing","specularConstant","specularExponent","speed","spreadMethod","startOffset","stdDeviation","stemh","stemv","stitchTiles","stopColor","stopOpacity","strikethroughPosition","strikethroughThickness","string","stroke","strokeDasharray","strokeDashoffset","strokeLinecap","strokeLinejoin","strokeMiterlimit","strokeOpacity","strokeWidth","surfaceScale","systemLanguage","tableValues","targetX","targetY","textAnchor","textDecoration","textLength","textRendering","to","transform","u1","u2","underlinePosition","underlineThickness","unicode","unicodeBidi","unicodeRange","unitsPerEm","vAlphabetic","values","vectorEffect","version","vertAdvY","vertOriginX","vertOriginY","vHanging","vIdeographic","viewTarget","visibility","vMathematical","widths","wordSpacing","writingMode","x1","x2","x","xChannelSelector","xHeight","xlinkActuate","xlinkArcrole","xlinkHref","xlinkRole","xlinkShow","xlinkTitle","xlinkType","xmlBase","xmlLang","xmlns","xmlnsXlink","xmlSpace","y1","y2","y","yChannelSelector","z","zoomAndPan","ref","key","angle"],lq=new Set(sq);function VR(e){return typeof e!="string"?!1:lq.has(e)}function qR(e){return typeof e=="string"&&e.startsWith("data-")}function ki(e){if(typeof e!="object"||e===null)return{};var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(VR(n)||qR(n))&&(t[n]=e[n]);return t}function Fu(e){if(e==null)return null;if(m.isValidElement(e)&&typeof e.props=="object"&&e.props!==null){var t=e.props;return ki(t)}return typeof e=="object"&&!Array.isArray(e)?ki(e):null}function ur(e){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(VR(n)||qR(n)||z0(n))&&(t[n]=e[n]);return t}function cq(e){return e==null?null:m.isValidElement(e)?ur(e.props):typeof e=="object"&&!Array.isArray(e)?ur(e):null}var uq=["children","width","height","viewBox","className","style","title","desc"];function Jv(){return Jv=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Jv.apply(null,arguments)}function dq(e,t){if(e==null)return{};var n,r,i=fq(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function fq(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var KR=m.forwardRef((e,t)=>{var{children:n,width:r,height:i,viewBox:a,className:o,style:s,title:l,desc:c}=e,d=dq(e,uq),u=a||{width:r,height:i,x:0,y:0},p=bt("recharts-surface",o);return m.createElement("svg",Jv({},ur(d),{className:p,width:r,height:i,style:s,viewBox:"".concat(u.x," ").concat(u.y," ").concat(u.width," ").concat(u.height),ref:t}),m.createElement("title",null,l),m.createElement("desc",null,c),n)}),pq=["children","className"];function ex(){return ex=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ex.apply(null,arguments)}function hq(e,t){if(e==null)return{};var n,r,i=mq(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function mq(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var Br=m.forwardRef((e,t)=>{var{children:n,className:r}=e,i=hq(e,pq),a=bt("recharts-layer",r);return m.createElement("g",ex({className:a},ur(i),{ref:t}),n)}),gq=m.createContext(null);function Ot(e){return function(){return e}}const GR=Math.cos,pp=Math.sin,ji=Math.sqrt,hp=Math.PI,Rh=2*hp,tx=Math.PI,nx=2*tx,Vo=1e-6,yq=nx-Vo;function YR(e){this._+=e[0];for(let t=1,n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function vq(e){let t=Math.floor(e);if(!(t>=0))throw new Error(`invalid digits: ${e}`);if(t>15)return YR;const n=10**t;return function(r){this._+=r[0];for(let i=1,a=r.length;i<a;++i)this._+=Math.round(arguments[i]*n)/n+r[i]}}class xq{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=t==null?YR:vq(t)}moveTo(t,n){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(t,n){this._append`L${this._x1=+t},${this._y1=+n}`}quadraticCurveTo(t,n,r,i){this._append`Q${+t},${+n},${this._x1=+r},${this._y1=+i}`}bezierCurveTo(t,n,r,i,a,o){this._append`C${+t},${+n},${+r},${+i},${this._x1=+a},${this._y1=+o}`}arcTo(t,n,r,i,a){if(t=+t,n=+n,r=+r,i=+i,a=+a,a<0)throw new Error(`negative radius: ${a}`);let o=this._x1,s=this._y1,l=r-t,c=i-n,d=o-t,u=s-n,p=d*d+u*u;if(this._x1===null)this._append`M${this._x1=t},${this._y1=n}`;else if(p>Vo)if(!(Math.abs(u*l-c*d)>Vo)||!a)this._append`L${this._x1=t},${this._y1=n}`;else{let h=r-o,y=i-s,g=l*l+c*c,x=h*h+y*y,v=Math.sqrt(g),b=Math.sqrt(p),w=a*Math.tan((tx-Math.acos((g+p-x)/(2*v*b)))/2),_=w/b,k=w/v;Math.abs(_-1)>Vo&&this._append`L${t+_*d},${n+_*u}`,this._append`A${a},${a},0,0,${+(u*h>d*y)},${this._x1=t+k*l},${this._y1=n+k*c}`}}arc(t,n,r,i,a,o){if(t=+t,n=+n,r=+r,o=!!o,r<0)throw new Error(`negative radius: ${r}`);let s=r*Math.cos(i),l=r*Math.sin(i),c=t+s,d=n+l,u=1^o,p=o?i-a:a-i;this._x1===null?this._append`M${c},${d}`:(Math.abs(this._x1-c)>Vo||Math.abs(this._y1-d)>Vo)&&this._append`L${c},${d}`,r&&(p<0&&(p=p%nx+nx),p>yq?this._append`A${r},${r},0,1,${u},${t-s},${n-l}A${r},${r},0,1,${u},${this._x1=c},${this._y1=d}`:p>Vo&&this._append`A${r},${r},0,${+(p>=tx)},${u},${this._x1=t+r*Math.cos(a)},${this._y1=n+r*Math.sin(a)}`)}rect(t,n,r,i){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${r=+r}v${+i}h${-r}Z`}toString(){return this._}}function F0(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{const r=Math.floor(n);if(!(r>=0))throw new RangeError(`invalid digits: ${n}`);t=r}return e},()=>new xq(t)}function B0(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function XR(e){this._context=e}XR.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function Mh(e){return new XR(e)}function ZR(e){return e[0]}function QR(e){return e[1]}function JR(e,t){var n=Ot(!0),r=null,i=Mh,a=null,o=F0(s);e=typeof e=="function"?e:e===void 0?ZR:Ot(e),t=typeof t=="function"?t:t===void 0?QR:Ot(t);function s(l){var c,d=(l=B0(l)).length,u,p=!1,h;for(r==null&&(a=i(h=o())),c=0;c<=d;++c)!(c<d&&n(u=l[c],c,l))===p&&((p=!p)?a.lineStart():a.lineEnd()),p&&a.point(+e(u,c,l),+t(u,c,l));if(h)return a=null,h+""||null}return s.x=function(l){return arguments.length?(e=typeof l=="function"?l:Ot(+l),s):e},s.y=function(l){return arguments.length?(t=typeof l=="function"?l:Ot(+l),s):t},s.defined=function(l){return arguments.length?(n=typeof l=="function"?l:Ot(!!l),s):n},s.curve=function(l){return arguments.length?(i=l,r!=null&&(a=i(r)),s):i},s.context=function(l){return arguments.length?(l==null?r=a=null:a=i(r=l),s):r},s}function Md(e,t,n){var r=null,i=Ot(!0),a=null,o=Mh,s=null,l=F0(c);e=typeof e=="function"?e:e===void 0?ZR:Ot(+e),t=typeof t=="function"?t:Ot(t===void 0?0:+t),n=typeof n=="function"?n:n===void 0?QR:Ot(+n);function c(u){var p,h,y,g=(u=B0(u)).length,x,v=!1,b,w=new Array(g),_=new Array(g);for(a==null&&(s=o(b=l())),p=0;p<=g;++p){if(!(p<g&&i(x=u[p],p,u))===v)if(v=!v)h=p,s.areaStart(),s.lineStart();else{for(s.lineEnd(),s.lineStart(),y=p-1;y>=h;--y)s.point(w[y],_[y]);s.lineEnd(),s.areaEnd()}v&&(w[p]=+e(x,p,u),_[p]=+t(x,p,u),s.point(r?+r(x,p,u):w[p],n?+n(x,p,u):_[p]))}if(b)return s=null,b+""||null}function d(){return JR().defined(i).curve(o).context(a)}return c.x=function(u){return arguments.length?(e=typeof u=="function"?u:Ot(+u),r=null,c):e},c.x0=function(u){return arguments.length?(e=typeof u=="function"?u:Ot(+u),c):e},c.x1=function(u){return arguments.length?(r=u==null?null:typeof u=="function"?u:Ot(+u),c):r},c.y=function(u){return arguments.length?(t=typeof u=="function"?u:Ot(+u),n=null,c):t},c.y0=function(u){return arguments.length?(t=typeof u=="function"?u:Ot(+u),c):t},c.y1=function(u){return arguments.length?(n=u==null?null:typeof u=="function"?u:Ot(+u),c):n},c.lineX0=c.lineY0=function(){return d().x(e).y(t)},c.lineY1=function(){return d().x(e).y(n)},c.lineX1=function(){return d().x(r).y(t)},c.defined=function(u){return arguments.length?(i=typeof u=="function"?u:Ot(!!u),c):i},c.curve=function(u){return arguments.length?(o=u,a!=null&&(s=o(a)),c):o},c.context=function(u){return arguments.length?(u==null?a=s=null:s=o(a=u),c):a},c}class e2{constructor(t,n){this._context=t,this._x=n}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(t,n){switch(t=+t,n=+n,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,n,t,n):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+n)/2,t,this._y0,t,n);break}}this._x0=t,this._y0=n}}function bq(e){return new e2(e,!0)}function wq(e){return new e2(e,!1)}const W0={draw(e,t){const n=ji(t/hp);e.moveTo(n,0),e.arc(0,0,n,0,Rh)}},kq={draw(e,t){const n=ji(t/5)/2;e.moveTo(-3*n,-n),e.lineTo(-n,-n),e.lineTo(-n,-3*n),e.lineTo(n,-3*n),e.lineTo(n,-n),e.lineTo(3*n,-n),e.lineTo(3*n,n),e.lineTo(n,n),e.lineTo(n,3*n),e.lineTo(-n,3*n),e.lineTo(-n,n),e.lineTo(-3*n,n),e.closePath()}},t2=ji(1/3),_q=t2*2,Sq={draw(e,t){const n=ji(t/_q),r=n*t2;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}},Eq={draw(e,t){const n=ji(t),r=-n/2;e.rect(r,r,n,n)}},Cq=.8908130915292852,n2=pp(hp/10)/pp(7*hp/10),jq=pp(Rh/10)*n2,Pq=-GR(Rh/10)*n2,Nq={draw(e,t){const n=ji(t*Cq),r=jq*n,i=Pq*n;e.moveTo(0,-n),e.lineTo(r,i);for(let a=1;a<5;++a){const o=Rh*a/5,s=GR(o),l=pp(o);e.lineTo(l*n,-s*n),e.lineTo(s*r-l*i,l*r+s*i)}e.closePath()}},xg=ji(3),Tq={draw(e,t){const n=-ji(t/(xg*3));e.moveTo(0,n*2),e.lineTo(-xg*n,-n),e.lineTo(xg*n,-n),e.closePath()}},qr=-.5,Kr=ji(3)/2,rx=1/ji(12),Oq=(rx/2+1)*3,Aq={draw(e,t){const n=ji(t/Oq),r=n/2,i=n*rx,a=r,o=n*rx+n,s=-a,l=o;e.moveTo(r,i),e.lineTo(a,o),e.lineTo(s,l),e.lineTo(qr*r-Kr*i,Kr*r+qr*i),e.lineTo(qr*a-Kr*o,Kr*a+qr*o),e.lineTo(qr*s-Kr*l,Kr*s+qr*l),e.lineTo(qr*r+Kr*i,qr*i-Kr*r),e.lineTo(qr*a+Kr*o,qr*o-Kr*a),e.lineTo(qr*s+Kr*l,qr*l-Kr*s),e.closePath()}};function Rq(e,t){let n=null,r=F0(i);e=typeof e=="function"?e:Ot(e||W0),t=typeof t=="function"?t:Ot(t===void 0?64:+t);function i(){let a;if(n||(n=a=r()),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),a)return n=null,a+""||null}return i.type=function(a){return arguments.length?(e=typeof a=="function"?a:Ot(a),i):e},i.size=function(a){return arguments.length?(t=typeof a=="function"?a:Ot(+a),i):t},i.context=function(a){return arguments.length?(n=a??null,i):n},i}function mp(){}function gp(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function r2(e){this._context=e}r2.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:gp(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:gp(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Mq(e){return new r2(e)}function i2(e){this._context=e}i2.prototype={areaStart:mp,areaEnd:mp,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:gp(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Iq(e){return new i2(e)}function a2(e){this._context=e}a2.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:gp(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Dq(e){return new a2(e)}function o2(e){this._context=e}o2.prototype={areaStart:mp,areaEnd:mp,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function Lq(e){return new o2(e)}function aS(e){return e<0?-1:1}function oS(e,t,n){var r=e._x1-e._x0,i=t-e._x1,a=(e._y1-e._y0)/(r||i<0&&-0),o=(n-e._y1)/(i||r<0&&-0),s=(a*i+o*r)/(r+i);return(aS(a)+aS(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(s))||0}function sS(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function bg(e,t,n){var r=e._x0,i=e._y0,a=e._x1,o=e._y1,s=(a-r)/3;e._context.bezierCurveTo(r+s,i+s*t,a-s,o-s*n,a,o)}function yp(e){this._context=e}yp.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:bg(this,this._t0,sS(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,bg(this,sS(this,n=oS(this,e,t)),n);break;default:bg(this,this._t0,n=oS(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function s2(e){this._context=new l2(e)}(s2.prototype=Object.create(yp.prototype)).point=function(e,t){yp.prototype.point.call(this,t,e)};function l2(e){this._context=e}l2.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,i,a){this._context.bezierCurveTo(t,e,r,n,a,i)}};function $q(e){return new yp(e)}function zq(e){return new s2(e)}function c2(e){this._context=e}c2.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),n===2)this._context.lineTo(e[1],t[1]);else for(var r=lS(e),i=lS(t),a=0,o=1;o<n;++a,++o)this._context.bezierCurveTo(r[0][a],i[0][a],r[1][a],i[1][a],e[o],t[o]);(this._line||this._line!==0&&n===1)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(e,t){this._x.push(+e),this._y.push(+t)}};function lS(e){var t,n=e.length-1,r,i=new Array(n),a=new Array(n),o=new Array(n);for(i[0]=0,a[0]=2,o[0]=e[0]+2*e[1],t=1;t<n-1;++t)i[t]=1,a[t]=4,o[t]=4*e[t]+2*e[t+1];for(i[n-1]=2,a[n-1]=7,o[n-1]=8*e[n-1]+e[n],t=1;t<n;++t)r=i[t]/a[t-1],a[t]-=r,o[t]-=r*o[t-1];for(i[n-1]=o[n-1]/a[n-1],t=n-2;t>=0;--t)i[t]=(o[t]-i[t+1])/a[t];for(a[n-1]=(e[n]+i[n-1])/2,t=0;t<n-1;++t)a[t]=2*e[t+1]-i[t+1];return[i,a]}function Fq(e){return new c2(e)}function Ih(e,t){this._context=e,this._t=t}Ih.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&this._point===2&&this._context.lineTo(this._x,this._y),(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}break}}this._x=e,this._y=t}};function Bq(e){return new Ih(e,.5)}function Wq(e){return new Ih(e,0)}function Hq(e){return new Ih(e,1)}function fs(e,t){if((o=e.length)>1)for(var n=1,r,i,a=e[t[0]],o,s=a.length;n<o;++n)for(i=a,a=e[t[n]],r=0;r<s;++r)a[r][1]+=a[r][0]=isNaN(i[r][1])?i[r][0]:i[r][1]}function ix(e){for(var t=e.length,n=new Array(t);--t>=0;)n[t]=t;return n}function Uq(e,t){return e[t]}function Vq(e){const t=[];return t.key=e,t}function qq(){var e=Ot([]),t=ix,n=fs,r=Uq;function i(a){var o=Array.from(e.apply(this,arguments),Vq),s,l=o.length,c=-1,d;for(const u of a)for(s=0,++c;s<l;++s)(o[s][c]=[0,+r(u,o[s].key,c,a)]).data=u;for(s=0,d=B0(t(o));s<l;++s)o[d[s]].index=s;return n(o,d),o}return i.keys=function(a){return arguments.length?(e=typeof a=="function"?a:Ot(Array.from(a)),i):e},i.value=function(a){return arguments.length?(r=typeof a=="function"?a:Ot(+a),i):r},i.order=function(a){return arguments.length?(t=a==null?ix:typeof a=="function"?a:Ot(Array.from(a)),i):t},i.offset=function(a){return arguments.length?(n=a??fs,i):n},i}function Kq(e,t){if((r=e.length)>0){for(var n,r,i=0,a=e[0].length,o;i<a;++i){for(o=n=0;n<r;++n)o+=e[n][i][1]||0;if(o)for(n=0;n<r;++n)e[n][i][1]/=o}fs(e,t)}}function Gq(e,t){if((i=e.length)>0){for(var n=0,r=e[t[0]],i,a=r.length;n<a;++n){for(var o=0,s=0;o<i;++o)s+=e[o][n][1]||0;r[n][1]+=r[n][0]=-s/2}fs(e,t)}}function Yq(e,t){if(!(!((o=e.length)>0)||!((a=(i=e[t[0]]).length)>0))){for(var n=0,r=1,i,a,o;r<a;++r){for(var s=0,l=0,c=0;s<o;++s){for(var d=e[t[s]],u=d[r][1]||0,p=d[r-1][1]||0,h=(u-p)/2,y=0;y<s;++y){var g=e[t[y]],x=g[r][1]||0,v=g[r-1][1]||0;h+=x-v}l+=u,c+=h*u}i[r-1][1]+=i[r-1][0]=n,l&&(n-=c/l)}i[r-1][1]+=i[r-1][0]=n,fs(e,t)}}var wg={},kg={},cS;function Xq(){return cS||(cS=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return n==="__proto__"}e.isUnsafeProperty=t})(kg)),kg}var _g={},uS;function u2(){return uS||(uS=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){switch(typeof n){case"number":case"symbol":return!1;case"string":return n.includes(".")||n.includes("[")||n.includes("]")}}e.isDeepKey=t})(_g)),_g}var Sg={},dS;function H0(){return dS||(dS=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return typeof n=="string"||typeof n=="symbol"?n:Object.is(n?.valueOf?.(),-0)?"-0":String(n)}e.toKey=t})(Sg)),Sg}var Eg={},Cg={},fS;function Zq(){return fS||(fS=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){if(n==null)return"";if(typeof n=="string")return n;if(Array.isArray(n))return n.map(t).join(",");const r=String(n);return r==="0"&&Object.is(Number(n),-0)?"-0":r}e.toString=t})(Cg)),Cg}var pS;function U0(){return pS||(pS=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Zq(),n=H0();function r(i){if(Array.isArray(i))return i.map(n.toKey);if(typeof i=="symbol")return[i];i=t.toString(i);const a=[],o=i.length;if(o===0)return a;let s=0,l="",c="",d=!1;for(i.charCodeAt(0)===46&&(a.push(""),s++);s<o;){const u=i[s];c?u==="\\"&&s+1<o?(s++,l+=i[s]):u===c?c="":l+=u:d?u==='"'||u==="'"?c=u:u==="]"?(d=!1,a.push(l),l=""):l+=u:u==="["?(d=!0,l&&(a.push(l),l="")):u==="."?l&&(a.push(l),l=""):l+=u,s++}return l&&a.push(l),a}e.toPath=r})(Eg)),Eg}var hS;function V0(){return hS||(hS=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Xq(),n=u2(),r=H0(),i=U0();function a(s,l,c){if(s==null)return c;switch(typeof l){case"string":{if(t.isUnsafeProperty(l))return c;const d=s[l];return d===void 0?n.isDeepKey(l)?a(s,i.toPath(l),c):c:d}case"number":case"symbol":{typeof l=="number"&&(l=r.toKey(l));const d=s[l];return d===void 0?c:d}default:{if(Array.isArray(l))return o(s,l,c);if(Object.is(l?.valueOf(),-0)?l="-0":l=String(l),t.isUnsafeProperty(l))return c;const d=s[l];return d===void 0?c:d}}}function o(s,l,c){if(l.length===0)return c;let d=s;for(let u=0;u<l.length;u++){if(d==null||t.isUnsafeProperty(l[u]))return c;d=d[l[u]]}return d===void 0?c:d}e.get=a})(wg)),wg}var jg,mS;function Qq(){return mS||(mS=1,jg=V0().get),jg}var Jq=Qq();const Ol=Ci(Jq);var eK=4;function fo(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:eK,n=10**t,r=Math.round(e*n)/n;return Object.is(r,-0)?0:r}function Yt(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return e.reduce((i,a,o)=>{var s=n[o-1];return typeof s=="string"?i+s+a:s!==void 0?i+fo(s)+a:i+a},"")}var yr=e=>e===0?0:e>0?1:-1,ra=e=>typeof e=="number"&&e!=+e,ps=e=>typeof e=="string"&&e.indexOf("%")===e.length-1,Me=e=>(typeof e=="number"||e instanceof Number)&&!ra(e),ia=e=>Me(e)||typeof e=="string",tK=0,cu=e=>{var t=++tK;return"".concat(e||"").concat(t)},_i=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!Me(t)&&typeof t!="string")return r;var a;if(ps(t)){if(n==null)return r;var o=t.indexOf("%");a=n*parseFloat(t.slice(0,o))/100}else a=+t;return ra(a)&&(a=r),i&&n!=null&&a>n&&(a=n),a},d2=e=>{if(!Array.isArray(e))return!1;for(var t=e.length,n={},r=0;r<t;r++)if(!n[String(e[r])])n[String(e[r])]=!0;else return!0;return!1};function Xt(e,t,n){return Me(e)&&Me(t)?fo(e+n*(t-e)):t}function f2(e,t,n){if(!(!e||!e.length))return e.find(r=>r&&(typeof t=="function"?t(r):Ol(r,t))===n)}var Ft=e=>e===null||typeof e>"u",Bu=e=>Ft(e)?e:"".concat(e.charAt(0).toUpperCase()).concat(e.slice(1));function vr(e){return e!=null}function Cs(){}var nK=["type","size","sizeType"];function ax(){return ax=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ax.apply(null,arguments)}function gS(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function yS(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?gS(Object(n),!0).forEach(function(r){rK(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):gS(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function rK(e,t,n){return(t=iK(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function iK(e){var t=aK(e,"string");return typeof t=="symbol"?t:t+""}function aK(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function oK(e,t){if(e==null)return{};var n,r,i=sK(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function sK(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var p2={symbolCircle:W0,symbolCross:kq,symbolDiamond:Sq,symbolSquare:Eq,symbolStar:Nq,symbolTriangle:Tq,symbolWye:Aq},lK=Math.PI/180,cK=e=>{var t="symbol".concat(Bu(e));return p2[t]||W0},uK=(e,t,n)=>{if(t==="area")return e;switch(n){case"cross":return 5*e*e/9;case"diamond":return .5*e*e/Math.sqrt(3);case"square":return e*e;case"star":{var r=18*lK;return 1.25*e*e*(Math.tan(r)-Math.tan(r*2)*Math.tan(r)**2)}case"triangle":return Math.sqrt(3)*e*e/4;case"wye":return(21-10*Math.sqrt(3))*e*e/8;default:return Math.PI*e*e/4}},dK=(e,t)=>{p2["symbol".concat(Bu(e))]=t},h2=e=>{var{type:t="circle",size:n=64,sizeType:r="area"}=e,i=oK(e,nK),a=yS(yS({},i),{},{type:t,size:n,sizeType:r}),o="circle";typeof t=="string"&&(o=t);var s=()=>{var p=cK(o),h=Rq().type(p).size(uK(n,r,o)),y=h();if(y!==null)return y},{className:l,cx:c,cy:d}=a,u=ur(a);return Me(c)&&Me(d)&&Me(n)?m.createElement("path",ax({},u,{className:bt("recharts-symbols",l),transform:"translate(".concat(c,", ").concat(d,")"),d:s()})):null};h2.registerSymbol=dK;var m2=e=>"radius"in e&&"startAngle"in e&&"endAngle"in e,q0=(e,t)=>{if(!e||typeof e=="function"||typeof e=="boolean")return null;var n=e;if(m.isValidElement(e)&&(n=e.props),typeof n!="object"&&typeof n!="function")return null;var r={};return Object.keys(n).forEach(i=>{z0(i)&&typeof n[i]=="function"&&(r[i]=(a=>n[i](n,a)))}),r},fK=(e,t,n)=>r=>(e(t,n,r),null),K0=(e,t,n)=>{if(e===null||typeof e!="object"&&typeof e!="function")return null;var r=null;return Object.keys(e).forEach(i=>{var a=e[i];z0(i)&&typeof a=="function"&&(r||(r={}),r[i]=fK(a,t,n))}),r};function vS(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function pK(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?vS(Object(n),!0).forEach(function(r){hK(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):vS(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function hK(e,t,n){return(t=mK(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function mK(e){var t=gK(e,"string");return typeof t=="symbol"?t:t+""}function gK(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function fr(e,t){var n=pK({},e),r=t,i=Object.keys(t),a=i.reduce((o,s)=>(o[s]===void 0&&r[s]!==void 0&&(o[s]=r[s]),o),n);return a}var Pg={},Ng={},xS;function yK(){return xS||(xS=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n,r){const i=new Map;for(let a=0;a<n.length;a++){const o=n[a],s=r(o,a,n);i.has(s)||i.set(s,o)}return Array.from(i.values())}e.uniqBy=t})(Ng)),Ng}var Tg={},bS;function vK(){return bS||(bS=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n,r){return function(...i){return n.apply(this,i.slice(0,r))}}e.ary=t})(Tg)),Tg}var Og={},wS;function g2(){return wS||(wS=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return n}e.identity=t})(Og)),Og}var Ag={},Rg={},Mg={},kS;function xK(){return kS||(kS=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return Number.isSafeInteger(n)&&n>=0}e.isLength=t})(Mg)),Mg}var _S;function y2(){return _S||(_S=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=xK();function n(r){return r!=null&&typeof r!="function"&&t.isLength(r.length)}e.isArrayLike=n})(Rg)),Rg}var Ig={},SS;function bK(){return SS||(SS=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return typeof n=="object"&&n!==null}e.isObjectLike=t})(Ig)),Ig}var ES;function wK(){return ES||(ES=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=y2(),n=bK();function r(i){return n.isObjectLike(i)&&t.isArrayLike(i)}e.isArrayLikeObject=r})(Ag)),Ag}var Dg={},Lg={},CS;function kK(){return CS||(CS=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=V0();function n(r){return function(i){return t.get(i,r)}}e.property=n})(Lg)),Lg}var $g={},zg={},Fg={},Bg={},jS;function v2(){return jS||(jS=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return n!==null&&(typeof n=="object"||typeof n=="function")}e.isObject=t})(Bg)),Bg}var Wg={},PS;function x2(){return PS||(PS=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return n==null||typeof n!="object"&&typeof n!="function"}e.isPrimitive=t})(Wg)),Wg}var Hg={},NS;function b2(){return NS||(NS=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n,r){return n===r||Number.isNaN(n)&&Number.isNaN(r)}e.isEqualsSameValueZero=t})(Hg)),Hg}var TS;function _K(){return TS||(TS=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=v2(),n=x2(),r=b2();function i(d,u,p){return typeof p!="function"?i(d,u,()=>{}):a(d,u,function h(y,g,x,v,b,w){const _=p(y,g,x,v,b,w);return _!==void 0?!!_:a(y,g,h,w)},new Map)}function a(d,u,p,h){if(u===d)return!0;switch(typeof u){case"object":return o(d,u,p,h);case"function":return Object.keys(u).length>0?a(d,{...u},p,h):r.isEqualsSameValueZero(d,u);default:return t.isObject(d)?typeof u=="string"?u==="":!0:r.isEqualsSameValueZero(d,u)}}function o(d,u,p,h){if(u==null)return!0;if(Array.isArray(u))return l(d,u,p,h);if(u instanceof Map)return s(d,u,p,h);if(u instanceof Set)return c(d,u,p,h);const y=Object.keys(u);if(d==null||n.isPrimitive(d))return y.length===0;if(y.length===0)return!0;if(h?.has(u))return h.get(u)===d;h?.set(u,d);try{for(let g=0;g<y.length;g++){const x=y[g];if(!n.isPrimitive(d)&&!(x in d)||u[x]===void 0&&d[x]!==void 0||u[x]===null&&d[x]!==null||!p(d[x],u[x],x,d,u,h))return!1}return!0}finally{h?.delete(u)}}function s(d,u,p,h){if(u.size===0)return!0;if(!(d instanceof Map))return!1;for(const[y,g]of u.entries()){const x=d.get(y);if(p(x,g,y,d,u,h)===!1)return!1}return!0}function l(d,u,p,h){if(u.length===0)return!0;if(!Array.isArray(d))return!1;const y=new Set;for(let g=0;g<u.length;g++){const x=u[g];let v=!1;for(let b=0;b<d.length;b++){if(y.has(b))continue;const w=d[b];let _=!1;if(p(w,x,g,d,u,h)&&(_=!0),_){y.add(b),v=!0;break}}if(!v)return!1}return!0}function c(d,u,p,h){return u.size===0?!0:d instanceof Set?l([...d],[...u],p,h):!1}e.isMatchWith=i,e.isSetMatch=c})(Fg)),Fg}var OS;function w2(){return OS||(OS=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=_K();function n(r,i){return t.isMatchWith(r,i,()=>{})}e.isMatch=n})(zg)),zg}var Ug={},Vg={},qg={},AS;function SK(){return AS||(AS=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return Object.getOwnPropertySymbols(n).filter(r=>Object.prototype.propertyIsEnumerable.call(n,r))}e.getSymbols=t})(qg)),qg}var Kg={},RS;function G0(){return RS||(RS=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return n==null?n===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(n)}e.getTag=t})(Kg)),Kg}var Gg={},MS;function k2(){return MS||(MS=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t="[object RegExp]",n="[object String]",r="[object Number]",i="[object Boolean]",a="[object Arguments]",o="[object Symbol]",s="[object Date]",l="[object Map]",c="[object Set]",d="[object Array]",u="[object Function]",p="[object ArrayBuffer]",h="[object Object]",y="[object Error]",g="[object DataView]",x="[object Uint8Array]",v="[object Uint8ClampedArray]",b="[object Uint16Array]",w="[object Uint32Array]",_="[object BigUint64Array]",k="[object Int8Array]",S="[object Int16Array]",E="[object Int32Array]",C="[object BigInt64Array]",j="[object Float32Array]",T="[object Float64Array]";e.argumentsTag=a,e.arrayBufferTag=p,e.arrayTag=d,e.bigInt64ArrayTag=C,e.bigUint64ArrayTag=_,e.booleanTag=i,e.dataViewTag=g,e.dateTag=s,e.errorTag=y,e.float32ArrayTag=j,e.float64ArrayTag=T,e.functionTag=u,e.int16ArrayTag=S,e.int32ArrayTag=E,e.int8ArrayTag=k,e.mapTag=l,e.numberTag=r,e.objectTag=h,e.regexpTag=t,e.setTag=c,e.stringTag=n,e.symbolTag=o,e.uint16ArrayTag=b,e.uint32ArrayTag=w,e.uint8ArrayTag=x,e.uint8ClampedArrayTag=v})(Gg)),Gg}var Yg={},Xg={},IS;function EK(){return IS||(IS=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=typeof globalThis=="object"&&globalThis||typeof window=="object"&&window||typeof self=="object"&&self||typeof B1=="object"&&B1||(function(){return this})()||Function("return this")();e.globalThis=t})(Xg)),Xg}var DS;function CK(){return DS||(DS=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=EK();function n(r){return typeof t.globalThis.Buffer<"u"&&t.globalThis.Buffer.isBuffer(r)}e.isBuffer=n})(Yg)),Yg}var Zg={},LS;function jK(){return LS||(LS=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}e.isTypedArray=t})(Zg)),Zg}var $S;function _2(){return $S||($S=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=SK(),n=G0(),r=k2(),i=CK(),a=x2(),o=jK();function s(u,p){return l(u,void 0,u,new Map,p)}function l(u,p,h,y=new Map,g=void 0){const x=g?.(u,p,h,y);if(x!==void 0)return x;if(a.isPrimitive(u))return u;if(y.has(u))return y.get(u);if(Array.isArray(u)){const v=new Array(u.length);y.set(u,v);for(let b=0;b<u.length;b++)v[b]=l(u[b],b,h,y,g);return Object.hasOwn(u,"index")&&(v.index=u.index),Object.hasOwn(u,"input")&&(v.input=u.input),v}if(u instanceof Date)return new Date(u.getTime());if(u instanceof RegExp){const v=new RegExp(u.source,u.flags);return v.lastIndex=u.lastIndex,v}if(u instanceof Map){const v=new Map;y.set(u,v);for(const[b,w]of u)v.set(b,l(w,b,h,y,g));return v}if(u instanceof Set){const v=new Set;y.set(u,v);for(const b of u)v.add(l(b,void 0,h,y,g));return v}if(i.isBuffer(u))return u.subarray();if(o.isTypedArray(u)){const v=new(Object.getPrototypeOf(u)).constructor(u.length);y.set(u,v);for(let b=0;b<u.length;b++)v[b]=l(u[b],b,h,y,g);return v}if(u instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&u instanceof SharedArrayBuffer)return u.slice(0);if(u instanceof DataView){const v=new DataView(u.buffer.slice(0),u.byteOffset,u.byteLength);return y.set(u,v),c(v,u,h,y,g),v}if(typeof File<"u"&&u instanceof File){const v=new File([u],u.name,{type:u.type});return y.set(u,v),c(v,u,h,y,g),v}if(typeof Blob<"u"&&u instanceof Blob){const v=new Blob([u],{type:u.type});return y.set(u,v),c(v,u,h,y,g),v}if(u instanceof Error){const v=structuredClone(u);return y.set(u,v),v.message=u.message,v.name=u.name,v.stack=u.stack,v.cause=u.cause,v.constructor=u.constructor,c(v,u,h,y,g),v}if(u instanceof Boolean){const v=new Boolean(u.valueOf());return y.set(u,v),c(v,u,h,y,g),v}if(u instanceof Number){const v=new Number(u.valueOf());return y.set(u,v),c(v,u,h,y,g),v}if(u instanceof String){const v=new String(u.valueOf());return y.set(u,v),c(v,u,h,y,g),v}if(typeof u=="object"&&d(u)){const v=Object.create(Object.getPrototypeOf(u));return y.set(u,v),c(v,u,h,y,g),v}return u}function c(u,p,h=u,y,g){const x=[...Object.keys(p),...t.getSymbols(p)];for(let v=0;v<x.length;v++){const b=x[v],w=Object.getOwnPropertyDescriptor(u,b);(w==null||w.writable)&&(u[b]=l(p[b],b,h,y,g))}}function d(u){switch(n.getTag(u)){case r.argumentsTag:case r.arrayTag:case r.arrayBufferTag:case r.dataViewTag:case r.booleanTag:case r.dateTag:case r.float32ArrayTag:case r.float64ArrayTag:case r.int8ArrayTag:case r.int16ArrayTag:case r.int32ArrayTag:case r.mapTag:case r.numberTag:case r.objectTag:case r.regexpTag:case r.setTag:case r.stringTag:case r.symbolTag:case r.uint8ArrayTag:case r.uint8ClampedArrayTag:case r.uint16ArrayTag:case r.uint32ArrayTag:return!0;default:return!1}}e.cloneDeepWith=s,e.cloneDeepWithImpl=l,e.copyProperties=c})(Vg)),Vg}var zS;function PK(){return zS||(zS=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=_2();function n(r){return t.cloneDeepWithImpl(r,void 0,r,new Map,void 0)}e.cloneDeep=n})(Ug)),Ug}var FS;function NK(){return FS||(FS=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=w2(),n=PK();function r(i){return i=n.cloneDeep(i),a=>t.isMatch(a,i)}e.matches=r})($g)),$g}var Qg={},Jg={},ey={},BS;function TK(){return BS||(BS=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=_2(),n=G0(),r=k2();function i(a,o){return t.cloneDeepWith(a,(s,l,c,d)=>{const u=o?.(s,l,c,d);if(u!==void 0)return u;if(typeof a=="object"){if(n.getTag(a)===r.objectTag&&typeof a.constructor!="function"){const p={};return d.set(a,p),t.copyProperties(p,a,c,d),p}switch(Object.prototype.toString.call(a)){case r.numberTag:case r.stringTag:case r.booleanTag:{const p=new a.constructor(a?.valueOf());return t.copyProperties(p,a),p}case r.argumentsTag:{const p={};return t.copyProperties(p,a),p.length=a.length,p[Symbol.iterator]=a[Symbol.iterator],p}default:return}}})}e.cloneDeepWith=i})(ey)),ey}var WS;function OK(){return WS||(WS=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=TK();function n(r){return t.cloneDeepWith(r)}e.cloneDeep=n})(Jg)),Jg}var ty={},ny={},HS;function S2(){return HS||(HS=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=/^(?:0|[1-9]\d*)$/;function n(r,i=Number.MAX_SAFE_INTEGER){switch(typeof r){case"number":return Number.isInteger(r)&&r>=0&&r<i;case"symbol":return!1;case"string":return t.test(r)}}e.isIndex=n})(ny)),ny}var ry={},US;function AK(){return US||(US=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=G0();function n(r){return r!==null&&typeof r=="object"&&t.getTag(r)==="[object Arguments]"}e.isArguments=n})(ry)),ry}var VS;function RK(){return VS||(VS=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=u2(),n=S2(),r=AK(),i=U0();function a(o,s){let l;if(Array.isArray(s)?l=s:typeof s=="string"&&t.isDeepKey(s)&&o?.[s]==null?l=i.toPath(s):l=[s],l.length===0)return!1;let c=o;for(let d=0;d<l.length;d++){const u=l[d];if((c==null||!Object.hasOwn(c,u))&&!((Array.isArray(c)||r.isArguments(c))&&n.isIndex(u)&&u<c.length))return!1;c=c[u]}return!0}e.has=a})(ty)),ty}var qS;function MK(){return qS||(qS=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=w2(),n=H0(),r=OK(),i=V0(),a=RK();function o(s,l){switch(typeof s){case"object":{Object.is(s?.valueOf(),-0)&&(s="-0");break}case"number":{s=n.toKey(s);break}}return l=r.cloneDeep(l),function(c){const d=i.get(c,s);return d===void 0?a.has(c,s):l===void 0?d===void 0:t.isMatch(d,l)}}e.matchesProperty=o})(Qg)),Qg}var KS;function IK(){return KS||(KS=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=g2(),n=kK(),r=NK(),i=MK();function a(o){if(o==null)return t.identity;switch(typeof o){case"function":return o;case"object":return Array.isArray(o)&&o.length===2?i.matchesProperty(o[0],o[1]):r.matches(o);case"string":case"symbol":case"number":return n.property(o)}}e.iteratee=a})(Dg)),Dg}var GS;function DK(){return GS||(GS=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=yK(),n=vK(),r=g2(),i=wK(),a=IK();function o(s,l=r.identity){return i.isArrayLikeObject(s)?t.uniqBy(Array.from(s),n.ary(a.iteratee(l),1)):[]}e.uniqBy=o})(Pg)),Pg}var iy,YS;function LK(){return YS||(YS=1,iy=DK().uniqBy),iy}var $K=LK();const XS=Ci($K);function zK(e,t,n){return t===!0?XS(e,n):typeof t=="function"?XS(e,t):e}var Y0=m.createContext(null),FK=e=>e,Ut=()=>{var e=m.useContext(Y0);return e?e.store.dispatch:FK},Tf=()=>{},BK=()=>Tf,WK=(e,t)=>e===t;function We(e){var t=m.useContext(Y0),n=m.useMemo(()=>t?r=>{if(r!=null)return e(r)}:Tf,[t,e]);return dR.useSyncExternalStoreWithSelector(t?t.subscription.addNestedSub:BK,t?t.store.getState:Tf,t?t.store.getState:Tf,n,WK)}var ay={},oy={},sy={},ZS;function HK(){return ZS||(ZS=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){return typeof r=="symbol"?1:r===null?2:r===void 0?3:r!==r?4:0}const n=(r,i,a)=>{if(r!==i){const o=t(r),s=t(i);if(o===s&&o===0){if(r<i)return a==="desc"?1:-1;if(r>i)return a==="desc"?-1:1}return a==="desc"?s-o:o-s}return 0};e.compareValues=n})(sy)),sy}var ly={},cy={},QS;function E2(){return QS||(QS=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return typeof n=="symbol"||n instanceof Symbol}e.isSymbol=t})(cy)),cy}var JS;function UK(){return JS||(JS=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=E2(),n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;function i(a,o){return Array.isArray(a)?!1:typeof a=="number"||typeof a=="boolean"||a==null||t.isSymbol(a)?!0:typeof a=="string"&&(r.test(a)||!n.test(a))||o!=null&&Object.hasOwn(o,a)}e.isKey=i})(ly)),ly}var eE;function VK(){return eE||(eE=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=HK(),n=UK(),r=U0();function i(a,o,s,l){if(a==null)return[];s=l?void 0:s,Array.isArray(a)||(a=Object.values(a)),Array.isArray(o)||(o=o==null?[null]:[o]),o.length===0&&(o=[null]),Array.isArray(s)||(s=s==null?[]:[s]),s=s.map(h=>String(h));const c=(h,y)=>{let g=h;for(let x=0;x<y.length&&g!=null;++x)g=g[y[x]];return g},d=(h,y)=>y==null||h==null?y:typeof h=="object"&&"key"in h?Object.hasOwn(y,h.key)?y[h.key]:c(y,h.path):typeof h=="function"?h(y):Array.isArray(h)?c(y,h):typeof y=="object"?y[h]:y,u=o.map(h=>(Array.isArray(h)&&h.length===1&&(h=h[0]),h==null||typeof h=="function"||Array.isArray(h)||n.isKey(h)?h:{key:h,path:r.toPath(h)}));return a.map(h=>({original:h,criteria:u.map(y=>d(y,h))})).slice().sort((h,y)=>{for(let g=0;g<u.length;g++){const x=t.compareValues(h.criteria[g],y.criteria[g],s[g]);if(x!==0)return x}return 0}).map(h=>h.original)}e.orderBy=i})(oy)),oy}var uy={},tE;function qK(){return tE||(tE=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n,r=1){const i=[],a=Math.floor(r),o=(s,l)=>{for(let c=0;c<s.length;c++){const d=s[c];Array.isArray(d)&&l<a?o(d,l+1):i.push(d)}};return o(n,0),i}e.flatten=t})(uy)),uy}var dy={},nE;function C2(){return nE||(nE=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=S2(),n=y2(),r=v2(),i=b2();function a(o,s,l){return r.isObject(l)&&(typeof s=="number"&&n.isArrayLike(l)&&t.isIndex(s)&&s<l.length||typeof s=="string"&&s in l)?i.isEqualsSameValueZero(l[s],o):!1}e.isIterateeCall=a})(dy)),dy}var rE;function KK(){return rE||(rE=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=VK(),n=qK(),r=C2();function i(a,...o){const s=o.length;return s>1&&r.isIterateeCall(a,o[0],o[1])?o=[]:s>2&&r.isIterateeCall(o[0],o[1],o[2])&&(o=[o[0]]),t.orderBy(a,n.flatten(o),["asc"])}e.sortBy=i})(ay)),ay}var fy,iE;function GK(){return iE||(iE=1,fy=KK().sortBy),fy}var YK=GK();const Dh=Ci(YK);var j2=e=>e.legend.settings,XK=e=>e.legend.size,ZK=e=>e.legend.payload;J([ZK,j2],(e,t)=>{var{itemSorter:n}=t,r=e.flat(1);return n?Dh(r,n):r});var Id=1;function QK(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],[t,n]=m.useState({height:0,left:0,top:0,width:0}),r=m.useCallback(i=>{if(i!=null){var a=i.getBoundingClientRect(),o={height:a.height,left:a.left,top:a.top,width:a.width};(Math.abs(o.height-t.height)>Id||Math.abs(o.left-t.left)>Id||Math.abs(o.top-t.top)>Id||Math.abs(o.width-t.width)>Id)&&n({height:o.height,left:o.left,top:o.top,width:o.width})}},[t.width,t.height,t.top,t.left,...e]);return[t,r]}function Dn(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var JK=typeof Symbol=="function"&&Symbol.observable||"@@observable",aE=JK,py=()=>Math.random().toString(36).substring(7).split("").join("."),eG={INIT:`@@redux/INIT${py()}`,REPLACE:`@@redux/REPLACE${py()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${py()}`},vp=eG;function X0(e){if(typeof e!="object"||e===null)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function P2(e,t,n){if(typeof e!="function")throw new Error(Dn(2));if(typeof t=="function"&&typeof n=="function"||typeof n=="function"&&typeof arguments[3]=="function")throw new Error(Dn(0));if(typeof t=="function"&&typeof n>"u"&&(n=t,t=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(Dn(1));return n(P2)(e,t)}let r=e,i=t,a=new Map,o=a,s=0,l=!1;function c(){o===a&&(o=new Map,a.forEach((x,v)=>{o.set(v,x)}))}function d(){if(l)throw new Error(Dn(3));return i}function u(x){if(typeof x!="function")throw new Error(Dn(4));if(l)throw new Error(Dn(5));let v=!0;c();const b=s++;return o.set(b,x),function(){if(v){if(l)throw new Error(Dn(6));v=!1,c(),o.delete(b),a=null}}}function p(x){if(!X0(x))throw new Error(Dn(7));if(typeof x.type>"u")throw new Error(Dn(8));if(typeof x.type!="string")throw new Error(Dn(17));if(l)throw new Error(Dn(9));try{l=!0,i=r(i,x)}finally{l=!1}return(a=o).forEach(b=>{b()}),x}function h(x){if(typeof x!="function")throw new Error(Dn(10));r=x,p({type:vp.REPLACE})}function y(){const x=u;return{subscribe(v){if(typeof v!="object"||v===null)throw new Error(Dn(11));function b(){const _=v;_.next&&_.next(d())}return b(),{unsubscribe:x(b)}},[aE](){return this}}}return p({type:vp.INIT}),{dispatch:p,subscribe:u,getState:d,replaceReducer:h,[aE]:y}}function tG(e){Object.keys(e).forEach(t=>{const n=e[t];if(typeof n(void 0,{type:vp.INIT})>"u")throw new Error(Dn(12));if(typeof n(void 0,{type:vp.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(Dn(13))})}function N2(e){const t=Object.keys(e),n={};for(let a=0;a<t.length;a++){const o=t[a];typeof e[o]=="function"&&(n[o]=e[o])}const r=Object.keys(n);let i;try{tG(n)}catch(a){i=a}return function(o={},s){if(i)throw i;let l=!1;const c={};for(let d=0;d<r.length;d++){const u=r[d],p=n[u],h=o[u],y=p(h,s);if(typeof y>"u")throw s&&s.type,new Error(Dn(14));c[u]=y,l=l||y!==h}return l=l||r.length!==Object.keys(o).length,l?c:o}}function xp(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,n)=>(...r)=>t(n(...r)))}function nG(...e){return t=>(n,r)=>{const i=t(n,r);let a=()=>{throw new Error(Dn(15))};const o={getState:i.getState,dispatch:(l,...c)=>a(l,...c)},s=e.map(l=>l(o));return a=xp(...s)(i.dispatch),{...i,dispatch:a}}}function T2(e){return X0(e)&&"type"in e&&typeof e.type=="string"}var O2=Symbol.for("immer-nothing"),oE=Symbol.for("immer-draftable"),dr=Symbol.for("immer-state");function vi(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Lr=Object,Al=Lr.getPrototypeOf,bp="constructor",Lh="prototype",ox="configurable",wp="enumerable",Of="writable",uu="value",Ma=e=>!!e&&!!e[dr];function Si(e){return e?A2(e)||zh(e)||!!e[oE]||!!e[bp]?.[oE]||Fh(e)||Bh(e):!1}var rG=Lr[Lh][bp].toString(),sE=new WeakMap;function A2(e){if(!e||!Z0(e))return!1;const t=Al(e);if(t===null||t===Lr[Lh])return!0;const n=Lr.hasOwnProperty.call(t,bp)&&t[bp];if(n===Object)return!0;if(!Js(n))return!1;let r=sE.get(n);return r===void 0&&(r=Function.toString.call(n),sE.set(n,r)),r===rG}function $h(e,t,n=!0){Wu(e)===0?(n?Reflect.ownKeys(e):Lr.keys(e)).forEach(i=>{t(i,e[i],e)}):e.forEach((r,i)=>t(i,r,e))}function Wu(e){const t=e[dr];return t?t.type_:zh(e)?1:Fh(e)?2:Bh(e)?3:0}var lE=(e,t,n=Wu(e))=>n===2?e.has(t):Lr[Lh].hasOwnProperty.call(e,t),sx=(e,t,n=Wu(e))=>n===2?e.get(t):e[t],kp=(e,t,n,r=Wu(e))=>{r===2?e.set(t,n):r===3?e.add(n):e[t]=n};function iG(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}var zh=Array.isArray,Fh=e=>e instanceof Map,Bh=e=>e instanceof Set,Z0=e=>typeof e=="object",Js=e=>typeof e=="function",hy=e=>typeof e=="boolean";function aG(e){const t=+e;return Number.isInteger(t)&&String(t)===e}var va=e=>e.copy_||e.base_,Q0=e=>e.modified_?e.copy_:e.base_;function lx(e,t){if(Fh(e))return new Map(e);if(Bh(e))return new Set(e);if(zh(e))return Array[Lh].slice.call(e);const n=A2(e);if(t===!0||t==="class_only"&&!n){const r=Lr.getOwnPropertyDescriptors(e);delete r[dr];let i=Reflect.ownKeys(r);for(let a=0;a<i.length;a++){const o=i[a],s=r[o];s[Of]===!1&&(s[Of]=!0,s[ox]=!0),(s.get||s.set)&&(r[o]={[ox]:!0,[Of]:!0,[wp]:s[wp],[uu]:e[o]})}return Lr.create(Al(e),r)}else{const r=Al(e);if(r!==null&&n)return{...e};const i=Lr.create(r);return Lr.assign(i,e)}}function J0(e,t=!1){return Wh(e)||Ma(e)||!Si(e)||(Wu(e)>1&&Lr.defineProperties(e,{set:Dd,add:Dd,clear:Dd,delete:Dd}),Lr.freeze(e),t&&$h(e,(n,r)=>{J0(r,!0)},!1)),e}function oG(){vi(2)}var Dd={[uu]:oG};function Wh(e){return e===null||!Z0(e)?!0:Lr.isFrozen(e)}var _p="MapSet",cx="Patches",cE="ArrayMethods",R2={};function hs(e){const t=R2[e];return t||vi(0,e),t}var uE=e=>!!R2[e],du,M2=()=>du,sG=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:uE(_p)?hs(_p):void 0,arrayMethodsPlugin_:uE(cE)?hs(cE):void 0});function dE(e,t){t&&(e.patchPlugin_=hs(cx),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function ux(e){dx(e),e.drafts_.forEach(lG),e.drafts_=null}function dx(e){e===du&&(du=e.parent_)}var fE=e=>du=sG(du,e);function lG(e){const t=e[dr];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function pE(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];if(e!==void 0&&e!==n){n[dr].modified_&&(ux(t),vi(4)),Si(e)&&(e=hE(t,e));const{patchPlugin_:i}=t;i&&i.generateReplacementPatches_(n[dr].base_,e,t)}else e=hE(t,n);return cG(t,e,!0),ux(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==O2?e:void 0}function hE(e,t){if(Wh(t))return t;const n=t[dr];if(!n)return Sp(t,e.handledSet_,e);if(!Hh(n,e))return t;if(!n.modified_)return n.base_;if(!n.finalized_){const{callbacks_:r}=n;if(r)for(;r.length>0;)r.pop()(e);L2(n,e)}return n.copy_}function cG(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&J0(t,n)}function I2(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var Hh=(e,t)=>e.scope_===t,uG=[];function D2(e,t,n,r){const i=va(e),a=e.type_;if(r!==void 0&&sx(i,r,a)===t){kp(i,r,n,a);return}if(!e.draftLocations_){const s=e.draftLocations_=new Map;$h(i,(l,c)=>{if(Ma(c)){const d=s.get(c)||[];d.push(l),s.set(c,d)}})}const o=e.draftLocations_.get(t)??uG;for(const s of o)kp(i,s,n,a)}function dG(e,t,n){e.callbacks_.push(function(i){const a=t;if(!a||!Hh(a,i))return;i.mapSetPlugin_?.fixSetContents(a);const o=Q0(a);D2(e,a.draft_??a,o,n),L2(a,i)})}function L2(e,t){if(e.modified_&&!e.finalized_&&(e.type_===3||e.type_===1&&e.allIndicesReassigned_||(e.assigned_?.size??0)>0)){const{patchPlugin_:r}=t;if(r){const i=r.getPath(e);i&&r.generatePatches_(e,i,t)}I2(e)}}function fG(e,t,n){const{scope_:r}=e;if(Ma(n)){const i=n[dr];Hh(i,r)&&i.callbacks_.push(function(){Af(e);const o=Q0(i);D2(e,n,o,t)})}else Si(n)&&e.callbacks_.push(function(){const a=va(e);e.type_===3?a.has(n)&&Sp(n,r.handledSet_,r):sx(a,t,e.type_)===n&&r.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&Sp(sx(e.copy_,t,e.type_),r.handledSet_,r)})}function Sp(e,t,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||Ma(e)||t.has(e)||!Si(e)||Wh(e)||(t.add(e),$h(e,(r,i)=>{if(Ma(i)){const a=i[dr];if(Hh(a,n)){const o=Q0(a);kp(e,r,o,e.type_),I2(a)}}else Si(i)&&Sp(i,t,n)})),e}function pG(e,t){const n=zh(e),r={type_:n?1:0,scope_:t?t.scope_:M2(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0};let i=r,a=Ep;n&&(i=[r],a=fu);const{revoke:o,proxy:s}=Proxy.revocable(i,a);return r.draft_=s,r.revoke_=o,[s,r]}var Ep={get(e,t){if(t===dr)return e;let n=e.scope_.arrayMethodsPlugin_;const r=e.type_===1&&typeof t=="string";if(r&&n?.isArrayOperationMethod(t))return n.createMethodInterceptor(e,t);const i=va(e);if(!lE(i,t,e.type_))return hG(e,i,t);const a=i[t];if(e.finalized_||!Si(a)||r&&e.operationMethod&&n?.isMutatingArrayMethod(e.operationMethod)&&aG(t))return a;if(a===my(e.base_,t)){Af(e);const o=e.type_===1?+t:t,s=px(e.scope_,a,e,o);return e.copy_[o]=s}return a},has(e,t){return t in va(e)},ownKeys(e){return Reflect.ownKeys(va(e))},set(e,t,n){const r=$2(va(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const i=my(va(e),t),a=i?.[dr];if(a&&a.base_===n)return e.copy_[t]=n,e.assigned_.set(t,!1),!0;if(iG(n,i)&&(n!==void 0||lE(e.base_,t,e.type_)))return!0;Af(e),fx(e)}return e.copy_[t]===n&&(n!==void 0||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_.set(t,!0),fG(e,t,n)),!0},deleteProperty(e,t){return Af(e),my(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),fx(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=va(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{[Of]:!0,[ox]:e.type_!==1||t!=="length",[wp]:r[wp],[uu]:n[t]}},defineProperty(){vi(11)},getPrototypeOf(e){return Al(e.base_)},setPrototypeOf(){vi(12)}},fu={};for(let e in Ep){let t=Ep[e];fu[e]=function(){const n=arguments;return n[0]=n[0][0],t.apply(this,n)}}fu.deleteProperty=function(e,t){return fu.set.call(this,e,t,void 0)};fu.set=function(e,t,n){return Ep.set.call(this,e[0],t,n,e[0])};function my(e,t){const n=e[dr];return(n?va(n):e)[t]}function hG(e,t,n){const r=$2(t,n);return r?uu in r?r[uu]:r.get?.call(e.draft_):void 0}function $2(e,t){if(!(t in e))return;let n=Al(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Al(n)}}function fx(e){e.modified_||(e.modified_=!0,e.parent_&&fx(e.parent_))}function Af(e){e.copy_||(e.assigned_=new Map,e.copy_=lx(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var mG=class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(n,r,i)=>{if(Js(n)&&!Js(r)){const o=r;r=n;const s=this;return function(c=o,...d){return s.produce(c,u=>r.call(this,u,...d))}}Js(r)||vi(6),i!==void 0&&!Js(i)&&vi(7);let a;if(Si(n)){const o=fE(this),s=px(o,n,void 0);let l=!0;try{a=r(s),l=!1}finally{l?ux(o):dx(o)}return dE(o,i),pE(a,o)}else if(!n||!Z0(n)){if(a=r(n),a===void 0&&(a=n),a===O2&&(a=void 0),this.autoFreeze_&&J0(a,!0),i){const o=[],s=[];hs(cx).generateReplacementPatches_(n,a,{patches_:o,inversePatches_:s}),i(o,s)}return a}else vi(1,n)},this.produceWithPatches=(n,r)=>{if(Js(n))return(s,...l)=>this.produceWithPatches(s,c=>n(c,...l));let i,a;return[this.produce(n,r,(s,l)=>{i=s,a=l}),i,a]},hy(t?.autoFreeze)&&this.setAutoFreeze(t.autoFreeze),hy(t?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(t.useStrictShallowCopy),hy(t?.useStrictIteration)&&this.setUseStrictIteration(t.useStrictIteration)}createDraft(t){Si(t)||vi(8),Ma(t)&&(t=ti(t));const n=fE(this),r=px(n,t,void 0);return r[dr].isManual_=!0,dx(n),r}finishDraft(t,n){const r=t&&t[dr];(!r||!r.isManual_)&&vi(9);const{scope_:i}=r;return dE(i,n),pE(void 0,i)}setAutoFreeze(t){this.autoFreeze_=t}setUseStrictShallowCopy(t){this.useStrictShallowCopy_=t}setUseStrictIteration(t){this.useStrictIteration_=t}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(t,n){let r;for(r=n.length-1;r>=0;r--){const a=n[r];if(a.path.length===0&&a.op==="replace"){t=a.value;break}}r>-1&&(n=n.slice(r+1));const i=hs(cx).applyPatches_;return Ma(t)?i(t,n):this.produce(t,a=>i(a,n))}};function px(e,t,n,r){const[i,a]=Fh(t)?hs(_p).proxyMap_(t,n):Bh(t)?hs(_p).proxySet_(t,n):pG(t,n);return(n?.scope_??M2()).drafts_.push(i),a.callbacks_=n?.callbacks_??[],a.key_=r,n&&r!==void 0?dG(n,a,r):a.callbacks_.push(function(l){l.mapSetPlugin_?.fixSetContents(a);const{patchPlugin_:c}=l;a.modified_&&c&&c.generatePatches_(a,[],l)}),i}function ti(e){return Ma(e)||vi(10,e),z2(e)}function z2(e){if(!Si(e)||Wh(e))return e;const t=e[dr];let n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=lx(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=lx(e,!0);return $h(n,(i,a)=>{kp(n,i,z2(a))},r),t&&(t.finalized_=!1),n}var gG=new mG,F2=gG.produce;function B2(e){return({dispatch:n,getState:r})=>i=>a=>typeof a=="function"?a(n,r,e):i(a)}var yG=B2(),vG=B2,xG=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?xp:xp.apply(null,arguments)};function Wr(e,t){function n(...r){if(t){let i=t(...r);if(!i)throw new Error(zr(0));return{type:e,payload:i.payload,..."meta"in i&&{meta:i.meta},..."error"in i&&{error:i.error}}}return{type:e,payload:r[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=r=>T2(r)&&r.type===e,n}var W2=class Nc extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,Nc.prototype)}static get[Symbol.species](){return Nc}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new Nc(...t[0].concat(this)):new Nc(...t.concat(this))}};function mE(e){return Si(e)?F2(e,()=>{}):e}function Ld(e,t,n){return e.has(t)?e.get(t):e.set(t,n(t)).get(t)}function bG(e){return typeof e=="boolean"}var wG=()=>function(t){const{thunk:n=!0,immutableCheck:r=!0,serializableCheck:i=!0,actionCreatorCheck:a=!0}=t??{};let o=new W2;return n&&(bG(n)?o.push(yG):o.push(vG(n.extraArgument))),o},H2="RTK_autoBatch",It=()=>e=>({payload:e,meta:{[H2]:!0}}),gE=e=>t=>{setTimeout(t,e)},U2=(e={type:"raf"})=>t=>(...n)=>{const r=t(...n);let i=!0,a=!1,o=!1;const s=new Set,l=e.type==="tick"?queueMicrotask:e.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame:gE(10):e.type==="callback"?e.queueNotification:gE(e.timeout),c=()=>{o=!1,a&&(a=!1,s.forEach(d=>d()))};return Object.assign({},r,{subscribe(d){const u=()=>i&&d(),p=r.subscribe(u);return s.add(d),()=>{p(),s.delete(d)}},dispatch(d){try{return i=!d?.meta?.[H2],a=!i,a&&(o||(o=!0,l(c))),r.dispatch(d)}finally{i=!0}}})},kG=e=>function(n){const{autoBatch:r=!0}=n??{};let i=new W2(e);return r&&i.push(U2(typeof r=="object"?r:void 0)),i};function _G(e){const t=wG(),{reducer:n=void 0,middleware:r,devTools:i=!0,preloadedState:a=void 0,enhancers:o=void 0}=e||{};let s;if(typeof n=="function")s=n;else if(X0(n))s=N2(n);else throw new Error(zr(1));let l;typeof r=="function"?l=r(t):l=t();let c=xp;i&&(c=xG({trace:!1,...typeof i=="object"&&i}));const d=nG(...l),u=kG(d);let p=typeof o=="function"?o(u):u();const h=c(...p);return P2(s,a,h)}function V2(e){const t={},n=[];let r;const i={addCase(a,o){const s=typeof a=="string"?a:a.type;if(!s)throw new Error(zr(28));if(s in t)throw new Error(zr(29));return t[s]=o,i},addAsyncThunk(a,o){return o.pending&&(t[a.pending.type]=o.pending),o.rejected&&(t[a.rejected.type]=o.rejected),o.fulfilled&&(t[a.fulfilled.type]=o.fulfilled),o.settled&&n.push({matcher:a.settled,reducer:o.settled}),i},addMatcher(a,o){return n.push({matcher:a,reducer:o}),i},addDefaultCase(a){return r=a,i}};return e(i),[t,n,r]}function SG(e){return typeof e=="function"}function EG(e,t){let[n,r,i]=V2(t),a;if(SG(e))a=()=>mE(e());else{const s=mE(e);a=()=>s}function o(s=a(),l){let c=[n[l.type],...r.filter(({matcher:d})=>d(l)).map(({reducer:d})=>d)];return c.filter(d=>!!d).length===0&&(c=[i]),c.reduce((d,u)=>{if(u)if(Ma(d)){const h=u(d,l);return h===void 0?d:h}else{if(Si(d))return F2(d,p=>u(p,l));{const p=u(d,l);if(p===void 0){if(d===null)return d;throw Error("A case reducer on a non-draftable value must not return undefined")}return p}}return d},s)}return o.getInitialState=a,o}var CG="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",jG=(e=21)=>{let t="",n=e;for(;n--;)t+=CG[Math.random()*64|0];return t},PG=Symbol.for("rtk-slice-createasyncthunk");function NG(e,t){return`${e}/${t}`}function TG({creators:e}={}){const t=e?.asyncThunk?.[PG];return function(r){const{name:i,reducerPath:a=i}=r;if(!i)throw new Error(zr(11));const o=(typeof r.reducers=="function"?r.reducers(AG()):r.reducers)||{},s=Object.keys(o),l={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},c={addCase(w,_){const k=typeof w=="string"?w:w.type;if(!k)throw new Error(zr(12));if(k in l.sliceCaseReducersByType)throw new Error(zr(13));return l.sliceCaseReducersByType[k]=_,c},addMatcher(w,_){return l.sliceMatchers.push({matcher:w,reducer:_}),c},exposeAction(w,_){return l.actionCreators[w]=_,c},exposeCaseReducer(w,_){return l.sliceCaseReducersByName[w]=_,c}};s.forEach(w=>{const _=o[w],k={reducerName:w,type:NG(i,w),createNotation:typeof r.reducers=="function"};MG(_)?DG(k,_,c,t):RG(k,_,c)});function d(){const[w={},_=[],k=void 0]=typeof r.extraReducers=="function"?V2(r.extraReducers):[r.extraReducers],S={...w,...l.sliceCaseReducersByType};return EG(r.initialState,E=>{for(let C in S)E.addCase(C,S[C]);for(let C of l.sliceMatchers)E.addMatcher(C.matcher,C.reducer);for(let C of _)E.addMatcher(C.matcher,C.reducer);k&&E.addDefaultCase(k)})}const u=w=>w,p=new Map,h=new WeakMap;let y;function g(w,_){return y||(y=d()),y(w,_)}function x(){return y||(y=d()),y.getInitialState()}function v(w,_=!1){function k(E){let C=E[w];return typeof C>"u"&&_&&(C=Ld(h,k,x)),C}function S(E=u){const C=Ld(p,_,()=>new WeakMap);return Ld(C,E,()=>{const j={};for(const[T,A]of Object.entries(r.selectors??{}))j[T]=OG(A,E,()=>Ld(h,E,x),_);return j})}return{reducerPath:w,getSelectors:S,get selectors(){return S(k)},selectSlice:k}}const b={name:i,reducer:g,actions:l.actionCreators,caseReducers:l.sliceCaseReducersByName,getInitialState:x,...v(a),injectInto(w,{reducerPath:_,...k}={}){const S=_??a;return w.inject({reducerPath:S,reducer:g},k),{...b,...v(S,!0)}}};return b}}function OG(e,t,n,r){function i(a,...o){let s=t(a);return typeof s>"u"&&r&&(s=n()),e(s,...o)}return i.unwrapped=e,i}var Zn=TG();function AG(){function e(t,n){return{_reducerDefinitionType:"asyncThunk",payloadCreator:t,...n}}return e.withTypes=()=>e,{reducer(t){return Object.assign({[t.name](...n){return t(...n)}}[t.name],{_reducerDefinitionType:"reducer"})},preparedReducer(t,n){return{_reducerDefinitionType:"reducerWithPrepare",prepare:t,reducer:n}},asyncThunk:e}}function RG({type:e,reducerName:t,createNotation:n},r,i){let a,o;if("reducer"in r){if(n&&!IG(r))throw new Error(zr(17));a=r.reducer,o=r.prepare}else a=r;i.addCase(e,a).exposeCaseReducer(t,a).exposeAction(t,o?Wr(e,o):Wr(e))}function MG(e){return e._reducerDefinitionType==="asyncThunk"}function IG(e){return e._reducerDefinitionType==="reducerWithPrepare"}function DG({type:e,reducerName:t},n,r,i){if(!i)throw new Error(zr(18));const{payloadCreator:a,fulfilled:o,pending:s,rejected:l,settled:c,options:d}=n,u=i(e,a,d);r.exposeAction(t,u),o&&r.addCase(u.fulfilled,o),s&&r.addCase(u.pending,s),l&&r.addCase(u.rejected,l),c&&r.addMatcher(u.settled,c),r.exposeCaseReducer(t,{fulfilled:o||$d,pending:s||$d,rejected:l||$d,settled:c||$d})}function $d(){}var LG="task",q2="listener",K2="completed",ew="cancelled",$G=`task-${ew}`,zG=`task-${K2}`,hx=`${q2}-${ew}`,FG=`${q2}-${K2}`,Uh=class{constructor(e){this.code=e,this.message=`${LG} ${ew} (reason: ${e})`}name="TaskAbortError";message},tw=(e,t)=>{if(typeof e!="function")throw new TypeError(zr(32))},Cp=()=>{},G2=(e,t=Cp)=>(e.catch(t),e),Y2=(e,t)=>(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)),ss=e=>{if(e.aborted)throw new Uh(e.reason)};function X2(e,t){let n=Cp;return new Promise((r,i)=>{const a=()=>i(new Uh(e.reason));if(e.aborted){a();return}n=Y2(e,a),t.finally(()=>n()).then(r,i)}).finally(()=>{n=Cp})}var BG=async(e,t)=>{try{return await Promise.resolve(),{status:"ok",value:await e()}}catch(n){return{status:n instanceof Uh?"cancelled":"rejected",error:n}}finally{t?.()}},jp=e=>t=>G2(X2(e,t).then(n=>(ss(e),n))),Z2=e=>{const t=jp(e);return n=>t(new Promise(r=>setTimeout(r,n)))},{assign:gl}=Object,yE={},Vh="listenerMiddleware",WG=(e,t)=>{const n=r=>Y2(e,()=>r.abort(e.reason));return(r,i)=>{tw(r);const a=new AbortController;n(a);const o=BG(async()=>{ss(e),ss(a.signal);const s=await r({pause:jp(a.signal),delay:Z2(a.signal),signal:a.signal});return ss(a.signal),s},()=>a.abort(zG));return i?.autoJoin&&t.push(o.catch(Cp)),{result:jp(e)(o),cancel(){a.abort($G)}}}},HG=(e,t)=>{const n=async(r,i)=>{ss(t);let a=()=>{};const s=[new Promise((l,c)=>{let d=e({predicate:r,effect:(u,p)=>{p.unsubscribe(),l([u,p.getState(),p.getOriginalState()])}});a=()=>{d(),c()}})];i!=null&&s.push(new Promise(l=>setTimeout(l,i,null)));try{const l=await X2(t,Promise.race(s));return ss(t),l}finally{a()}};return(r,i)=>G2(n(r,i))},Q2=e=>{let{type:t,actionCreator:n,matcher:r,predicate:i,effect:a}=e;if(t)i=Wr(t).match;else if(n)t=n.type,i=n.match;else if(r)i=r;else if(!i)throw new Error(zr(21));return tw(a),{predicate:i,type:t,effect:a}},J2=gl(e=>{const{type:t,predicate:n,effect:r}=Q2(e);return{id:jG(),effect:r,type:t,predicate:n,pending:new Set,unsubscribe:()=>{throw new Error(zr(22))}}},{withTypes:()=>J2}),vE=(e,t)=>{const{type:n,effect:r,predicate:i}=Q2(t);return Array.from(e.values()).find(a=>(typeof n=="string"?a.type===n:a.predicate===i)&&a.effect===r)},mx=e=>{e.pending.forEach(t=>{t.abort(hx)})},UG=(e,t)=>()=>{for(const n of t.keys())mx(n);e.clear()},xE=(e,t,n)=>{try{e(t,n)}catch(r){setTimeout(()=>{throw r},0)}},eM=gl(Wr(`${Vh}/add`),{withTypes:()=>eM}),VG=Wr(`${Vh}/removeAll`),tM=gl(Wr(`${Vh}/remove`),{withTypes:()=>tM}),qG=(...e)=>{console.error(`${Vh}/error`,...e)},Hu=(e={})=>{const t=new Map,n=new Map,r=h=>{const y=n.get(h)??0;n.set(h,y+1)},i=h=>{const y=n.get(h)??1;y===1?n.delete(h):n.set(h,y-1)},{extra:a,onError:o=qG}=e;tw(o);const s=h=>(h.unsubscribe=()=>t.delete(h.id),t.set(h.id,h),y=>{h.unsubscribe(),y?.cancelActive&&mx(h)}),l=h=>{const y=vE(t,h)??J2(h);return s(y)};gl(l,{withTypes:()=>l});const c=h=>{const y=vE(t,h);return y&&(y.unsubscribe(),h.cancelActive&&mx(y)),!!y};gl(c,{withTypes:()=>c});const d=async(h,y,g,x)=>{const v=new AbortController,b=HG(l,v.signal),w=[];try{h.pending.add(v),r(h),await Promise.resolve(h.effect(y,gl({},g,{getOriginalState:x,condition:(_,k)=>b(_,k).then(Boolean),take:b,delay:Z2(v.signal),pause:jp(v.signal),extra:a,signal:v.signal,fork:WG(v.signal,w),unsubscribe:h.unsubscribe,subscribe:()=>{t.set(h.id,h)},cancelActiveListeners:()=>{h.pending.forEach((_,k,S)=>{_!==v&&(_.abort(hx),S.delete(_))})},cancel:()=>{v.abort(hx),h.pending.delete(v)},throwIfCancelled:()=>{ss(v.signal)}})))}catch(_){_ instanceof Uh||xE(o,_,{raisedBy:"effect"})}finally{await Promise.all(w),v.abort(FG),i(h),h.pending.delete(v)}},u=UG(t,n);return{middleware:h=>y=>g=>{if(!T2(g))return y(g);if(eM.match(g))return l(g.payload);if(VG.match(g)){u();return}if(tM.match(g))return c(g.payload);let x=h.getState();const v=()=>{if(x===yE)throw new Error(zr(23));return x};let b;try{if(b=y(g),t.size>0){const w=h.getState(),_=Array.from(t.values());for(const k of _){let S=!1;try{S=k.predicate(g,w,x)}catch(E){S=!1,xE(o,E,{raisedBy:"predicate"})}S&&d(k,g,h,v)}}}finally{x=yE}return b},startListening:l,stopListening:c,clearListeners:u}};function zr(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var KG={layoutType:"horizontal",width:0,height:0,margin:{top:5,right:5,bottom:5,left:5},scale:1},nM=Zn({name:"chartLayout",initialState:KG,reducers:{setLayout(e,t){e.layoutType=t.payload},setChartSize(e,t){e.width=t.payload.width,e.height=t.payload.height},setMargin(e,t){var n,r,i,a;e.margin.top=(n=t.payload.top)!==null&&n!==void 0?n:0,e.margin.right=(r=t.payload.right)!==null&&r!==void 0?r:0,e.margin.bottom=(i=t.payload.bottom)!==null&&i!==void 0?i:0,e.margin.left=(a=t.payload.left)!==null&&a!==void 0?a:0},setScale(e,t){e.scale=t.payload}}}),{setMargin:GG,setLayout:YG,setChartSize:XG,setScale:ZG}=nM.actions,QG=nM.reducer;function rM(e,t,n){return Array.isArray(e)&&e&&t+n!==0?e.slice(t,n+1):e}function ct(e){return Number.isFinite(e)}function aa(e){return typeof e=="number"&&e>0&&Number.isFinite(e)}function bE(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function il(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?bE(Object(n),!0).forEach(function(r){JG(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):bE(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function JG(e,t,n){return(t=eY(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function eY(e){var t=tY(e,"string");return typeof t=="symbol"?t:t+""}function tY(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function on(e,t,n){return Ft(e)||Ft(t)?n:ia(t)?Ol(e,t,n):typeof t=="function"?t(e):n}var nY=(e,t,n)=>{if(t&&n){var{width:r,height:i}=n,{align:a,verticalAlign:o,layout:s}=t;if((s==="vertical"||s==="horizontal"&&o==="middle")&&a!=="center"&&Me(e[a]))return il(il({},e),{},{[a]:e[a]+(r||0)});if((s==="horizontal"||s==="vertical"&&a==="center")&&o!=="middle"&&Me(e[o]))return il(il({},e),{},{[o]:e[o]+(i||0)})}return e},za=(e,t)=>e==="horizontal"&&t==="xAxis"||e==="vertical"&&t==="yAxis"||e==="centric"&&t==="angleAxis"||e==="radial"&&t==="radiusAxis",iM=(e,t,n,r)=>{if(r)return e.map(s=>s.coordinate);var i,a,o=e.map(s=>(s.coordinate===t&&(i=!0),s.coordinate===n&&(a=!0),s.coordinate));return i||o.push(t),a||o.push(n),o},aM=(e,t,n)=>{if(!e)return null;var{duplicateDomain:r,type:i,range:a,scale:o,realScaleType:s,isCategorical:l,categoricalDomain:c,tickCount:d,ticks:u,niceTicks:p,axisType:h}=e;if(!o)return null;var y=s==="scaleBand"&&o.bandwidth?o.bandwidth()/2:2,g=i==="category"&&o.bandwidth?o.bandwidth()/y:0;if(g=h==="angleAxis"&&a&&a.length>=2?yr(a[0]-a[1])*2*g:g,u||p){var x=(u||p||[]).map((v,b)=>{var w=r?r.indexOf(v):v,_=o.map(w);return ct(_)?{coordinate:_+g,value:v,offset:g,index:b}:null}).filter(vr);return x}return l&&c?c.map((v,b)=>{var w=o.map(v);return ct(w)?{coordinate:w+g,value:v,index:b,offset:g}:null}).filter(vr):o.ticks&&d!=null?o.ticks(d).map((v,b)=>{var w=o.map(v);return ct(w)?{coordinate:w+g,value:v,index:b,offset:g}:null}).filter(vr):o.domain().map((v,b)=>{var w=o.map(v);return ct(w)?{coordinate:w+g,value:r?r[v]:v,index:b,offset:g}:null}).filter(vr)},rY=(e,t)=>{if(!t||t.length!==2||!Me(t[0])||!Me(t[1]))return e;var n=Math.min(t[0],t[1]),r=Math.max(t[0],t[1]),i=[e[0],e[1]];return(!Me(e[0])||e[0]<n)&&(i[0]=n),(!Me(e[1])||e[1]>r)&&(i[1]=r),i[0]>r&&(i[0]=r),i[1]<n&&(i[1]=n),i},iY=e=>{var t,n=e.length;if(!(n<=0)){var r=(t=e[0])===null||t===void 0?void 0:t.length;if(!(r==null||r<=0))for(var i=0;i<r;++i)for(var a=0,o=0,s=0;s<n;++s){var l=e[s],c=l?.[i];if(c!=null){var d=c[1],u=c[0],p=ra(d)?u:d;p>=0?(c[0]=a,a+=p,c[1]=a):(c[0]=o,o+=p,c[1]=o)}}}},aY=e=>{var t,n=e.length;if(!(n<=0)){var r=(t=e[0])===null||t===void 0?void 0:t.length;if(!(r==null||r<=0))for(var i=0;i<r;++i)for(var a=0,o=0;o<n;++o){var s=e[o],l=s?.[i];if(l!=null){var c=ra(l[1])?l[0]:l[1];c>=0?(l[0]=a,a+=c,l[1]=a):(l[0]=0,l[1]=0)}}}},oY={sign:iY,expand:Kq,none:fs,silhouette:Gq,wiggle:Yq,positive:aY},sY=(e,t,n)=>{var r,i=(r=oY[n])!==null&&r!==void 0?r:fs,a=qq().keys(t).value((s,l)=>Number(on(s,l,0))).order(ix).offset(i),o=a(e);return o.forEach((s,l)=>{s.forEach((c,d)=>{var u=on(e[d],t[l],0);Array.isArray(u)&&u.length===2&&Me(u[0])&&Me(u[1])&&(c[0]=u[0],c[1]=u[1])})}),o};function lY(e){return e==null?void 0:String(e)}function wE(e){var{axis:t,ticks:n,bandSize:r,entry:i,index:a,dataKey:o}=e;if(t.type==="category"){if(!t.allowDuplicatedCategory&&t.dataKey&&!Ft(i[t.dataKey])){var s=f2(n,"value",i[t.dataKey]);if(s)return s.coordinate+r/2}return n!=null&&n[a]?n[a].coordinate+r/2:null}var l=on(i,Ft(o)?t.dataKey:o),c=t.scale.map(l);return Me(c)?c:null}var kE=e=>{var{axis:t,ticks:n,offset:r,bandSize:i,entry:a,index:o}=e;if(t.type==="category")return n[o]?n[o].coordinate+r:null;var s=on(a,t.dataKey,t.scale.domain()[o]);if(Ft(s))return null;var l=t.scale.map(s);return Me(l)?l-i/2+r:null},cY=e=>{var{numericAxis:t}=e,n=t.scale.domain();if(t.type==="number"){var r=Math.min(n[0],n[1]),i=Math.max(n[0],n[1]);return r<=0&&i>=0?0:i<0?i:r}return n[0]},uY=e=>{var t=e.flat(2).filter(Me);return[Math.min(...t),Math.max(...t)]},dY=e=>[e[0]===1/0?0:e[0],e[1]===-1/0?0:e[1]],fY=(e,t,n)=>{if(e!=null)return dY(Object.keys(e).reduce((r,i)=>{var a=e[i];if(!a)return r;var{stackedData:o}=a,s=o.reduce((l,c)=>{var d=rM(c,t,n),u=uY(d);return!ct(u[0])||!ct(u[1])?l:[Math.min(l[0],u[0]),Math.max(l[1],u[1])]},[1/0,-1/0]);return[Math.min(s[0],r[0]),Math.max(s[1],r[1])]},[1/0,-1/0]))},_E=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,SE=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,Rl=(e,t,n)=>{if(e&&e.scale&&e.scale.bandwidth){var r=e.scale.bandwidth();if(!n||r>0)return r}if(e&&t&&t.length>=2){for(var i=Dh(t,d=>d.coordinate),a=1/0,o=1,s=i.length;o<s;o++){var l=i[o],c=i[o-1];a=Math.min((l?.coordinate||0)-(c?.coordinate||0),a)}return a===1/0?0:a}return n?void 0:0};function EE(e){var{tooltipEntrySettings:t,dataKey:n,payload:r,value:i,name:a}=e;return il(il({},t),{},{dataKey:n,payload:r,value:i,name:a})}function qh(e,t){if(e)return String(e);if(typeof t=="string")return t}var pY=(e,t)=>{if(t==="horizontal")return e.relativeX;if(t==="vertical")return e.relativeY},hY=(e,t)=>t==="centric"?e.angle:e.radius,Fa=e=>e.layout.width,Ba=e=>e.layout.height,mY=e=>e.layout.scale,oM=e=>e.layout.margin,Kh=J(e=>e.cartesianAxis.xAxis,e=>Object.values(e)),Gh=J(e=>e.cartesianAxis.yAxis,e=>Object.values(e)),gY="data-recharts-item-index",yY="data-recharts-item-id",Uu=60;function CE(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function zd(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?CE(Object(n),!0).forEach(function(r){vY(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):CE(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function vY(e,t,n){return(t=xY(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function xY(e){var t=bY(e,"string");return typeof t=="symbol"?t:t+""}function bY(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var wY=e=>e.brush.height;function kY(e){var t=Gh(e);return t.reduce((n,r)=>{if(r.orientation==="left"&&!r.mirror&&!r.hide){var i=typeof r.width=="number"?r.width:Uu;return n+i}return n},0)}function _Y(e){var t=Gh(e);return t.reduce((n,r)=>{if(r.orientation==="right"&&!r.mirror&&!r.hide){var i=typeof r.width=="number"?r.width:Uu;return n+i}return n},0)}function SY(e){var t=Kh(e);return t.reduce((n,r)=>r.orientation==="top"&&!r.mirror&&!r.hide?n+r.height:n,0)}function EY(e){var t=Kh(e);return t.reduce((n,r)=>r.orientation==="bottom"&&!r.mirror&&!r.hide?n+r.height:n,0)}var Nn=J([Fa,Ba,oM,wY,kY,_Y,SY,EY,j2,XK],(e,t,n,r,i,a,o,s,l,c)=>{var d={left:(n.left||0)+i,right:(n.right||0)+a},u={top:(n.top||0)+o,bottom:(n.bottom||0)+s},p=zd(zd({},u),d),h=p.bottom;p.bottom+=r,p=nY(p,l,c);var y=e-p.left-p.right,g=t-p.top-p.bottom;return zd(zd({brushBottom:h},p),{},{width:Math.max(y,0),height:Math.max(g,0)})}),CY=J(Nn,e=>({x:e.left,y:e.top,width:e.width,height:e.height})),nw=J(Fa,Ba,(e,t)=>({x:0,y:0,width:e,height:t})),jY=m.createContext(null),Qn=()=>m.useContext(jY)!=null,Yh=e=>e.brush,Xh=J([Yh,Nn,oM],(e,t,n)=>({height:e.height,x:Me(e.x)?e.x:t.left,y:Me(e.y)?e.y:t.top+t.height+t.brushBottom-(n?.bottom||0),width:Me(e.width)?e.width:t.width})),gy={},yy={},vy={},jE;function PY(){return jE||(jE=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n,r,{signal:i,edges:a}={}){let o,s=null;const l=a!=null&&a.includes("leading"),c=a==null||a.includes("trailing"),d=()=>{s!==null&&(n.apply(o,s),o=void 0,s=null)},u=()=>{c&&d(),g()};let p=null;const h=()=>{p!=null&&clearTimeout(p),p=setTimeout(()=>{p=null,u()},r)},y=()=>{p!==null&&(clearTimeout(p),p=null)},g=()=>{y(),o=void 0,s=null},x=()=>{d()},v=function(...b){if(i?.aborted)return;o=this,s=b;const w=p==null;h(),l&&w&&d()};return v.schedule=h,v.cancel=g,v.flush=x,i?.addEventListener("abort",g,{once:!0}),v}e.debounce=t})(vy)),vy}var PE;function NY(){return PE||(PE=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=PY();function n(r,i=0,a={}){typeof a!="object"&&(a={});const{leading:o=!1,trailing:s=!0,maxWait:l}=a,c=Array(2);o&&(c[0]="leading"),s&&(c[1]="trailing");let d,u=null;const p=t.debounce(function(...g){d=r.apply(this,g),u=null},i,{edges:c}),h=function(...g){return l!=null&&(u===null&&(u=Date.now()),Date.now()-u>=l)?(d=r.apply(this,g),u=Date.now(),p.cancel(),p.schedule(),d):(p.apply(this,g),d)},y=()=>(p.flush(),d);return h.cancel=p.cancel,h.flush=y,h}e.debounce=n})(yy)),yy}var NE;function TY(){return NE||(NE=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=NY();function n(r,i=0,a={}){const{leading:o=!0,trailing:s=!0}=a;return t.debounce(r,i,{leading:o,maxWait:i,trailing:s})}e.throttle=n})(gy)),gy}var xy,TE;function OY(){return TE||(TE=1,xy=TY().throttle),xy}var AY=OY();const RY=Ci(AY);var Pp=function(t,n){for(var r=arguments.length,i=new Array(r>2?r-2:0),a=2;a<r;a++)i[a-2]=arguments[a];if(typeof console<"u"&&console.warn&&(n===void 0&&console.warn("LogUtils requires an error message argument"),!t))if(n===void 0)console.warn("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var o=0;console.warn(n.replace(/%s/g,()=>i[o++]))}},Vi={width:"100%",height:"100%",debounce:0,minWidth:0,initialDimension:{width:-1,height:-1}},sM=(e,t,n)=>{var{width:r=Vi.width,height:i=Vi.height,aspect:a,maxHeight:o}=n,s=ps(r)?e:Number(r),l=ps(i)?t:Number(i);return a&&a>0&&(s?l=s/a:l&&(s=l*a),o&&l!=null&&l>o&&(l=o)),{calculatedWidth:s,calculatedHeight:l}},MY={width:0,height:0,overflow:"visible"},IY={width:0,overflowX:"visible"},DY={height:0,overflowY:"visible"},LY={},$Y=e=>{var{width:t,height:n}=e,r=ps(t),i=ps(n);return r&&i?MY:r?IY:i?DY:LY};function zY(e){var{width:t,height:n,aspect:r}=e,i=t,a=n;return i===void 0&&a===void 0?(i=Vi.width,a=Vi.height):i===void 0?i=r&&r>0?void 0:Vi.width:a===void 0&&(a=r&&r>0?void 0:Vi.height),{width:i,height:a}}function gx(){return gx=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},gx.apply(null,arguments)}function OE(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function AE(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?OE(Object(n),!0).forEach(function(r){FY(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):OE(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function FY(e,t,n){return(t=BY(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function BY(e){var t=WY(e,"string");return typeof t=="symbol"?t:t+""}function WY(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var lM=m.createContext(Vi.initialDimension);function HY(e){return aa(e.width)&&aa(e.height)}function cM(e){var{children:t,width:n,height:r}=e,i=m.useMemo(()=>({width:n,height:r}),[n,r]);return HY(i)?m.createElement(lM.Provider,{value:i},t):null}var rw=()=>m.useContext(lM),UY=m.forwardRef((e,t)=>{var{aspect:n,initialDimension:r=Vi.initialDimension,width:i,height:a,minWidth:o=Vi.minWidth,minHeight:s,maxHeight:l,children:c,debounce:d=Vi.debounce,id:u,className:p,onResize:h,style:y={}}=e,g=m.useRef(null),x=m.useRef();x.current=h,m.useImperativeHandle(t,()=>g.current);var[v,b]=m.useState({containerWidth:r.width,containerHeight:r.height}),w=m.useCallback((C,j)=>{b(T=>{var A=Math.round(C),R=Math.round(j);return T.containerWidth===A&&T.containerHeight===R?T:{containerWidth:A,containerHeight:R}})},[]);m.useEffect(()=>{if(g.current==null||typeof ResizeObserver>"u")return Cs;var C=R=>{var D,M=R[0];if(M!=null){var{width:O,height:I}=M.contentRect;w(O,I),(D=x.current)===null||D===void 0||D.call(x,O,I)}};d>0&&(C=RY(C,d,{trailing:!0,leading:!1}));var j=new ResizeObserver(C),{width:T,height:A}=g.current.getBoundingClientRect();return w(T,A),j.observe(g.current),()=>{j.disconnect()}},[w,d]);var{containerWidth:_,containerHeight:k}=v;Pp(!n||n>0,"The aspect(%s) must be greater than zero.",n);var{calculatedWidth:S,calculatedHeight:E}=sM(_,k,{width:i,height:a,aspect:n,maxHeight:l});return Pp(S!=null&&S>0||E!=null&&E>0,`The width(%s) and height(%s) of chart should be greater than 0,
449
+ `).slice(2,6).join(" | ");console.info(`[recording] abortAndSaveHistory called, caller=${e}`),console.log("[recording] abort: saving audio without transcription");const t=Ze.getState().activeId==="translate";nu(),gi();let n=null;try{n=await Hb()}catch(i){console.warn("[recording] abort: stopRecordingAndSave failed:",i)}if(n&&!n.voiced)return;if(n&&n.duration_ms<1e3){n.audio_path&&nl(n.audio_path).catch(i=>console.warn("[recording] abort: discard short clip file failed:",i));return}if(n){const i=mo(),a=ru??(i==="REALTIME"?"saas-realtime":"saas-file");try{await mt.getState().add({type:t?"translate":"dictation",text:ie.t("overlay:transcript.aborted_placeholder"),status:"cancelled",duration_ms:n.duration_ms,audio_path:n.audio_path,target_app:nr,target_app_id:Na,segment_mode:i,provider_kind:a,focus_title:_a})}catch(o){console.warn("[recording] abort: history.add failed:",o)}}ke.info(ie.t("overlay:toast.aborted_saved.title"),{description:n?ie.t("overlay:toast.aborted_saved.description"):void 0})},Ze=ui((e,t)=>{let n=Promise.resolve();return{state:"idle",activeId:null,errorMessage:null,recordingStartedAt:0,startedListening:!1,audioLevels:Qt(),recordingId:null,liveTranscript:"",pillEarlyHide:!1,segmentModeOverride:null,setSegmentModeOverride:r=>e({segmentModeOverride:r}),initListeners:async()=>{if(t().startedListening){console.log("[recording] initListeners: already started, skip");return}if(e({startedListening:!0}),console.log("[recording] initListeners: attaching listeners"),!Ct){console.log("[recording] non-main window: skip initListeners");return}let r="",i=t().state,a=null,o=t().state==="error",s=t().errorMessage,l=null;Ze.subscribe(d=>{const u=i!=="idle"&&i!=="error",p=d.state!=="idle"&&d.state!=="error";u!==p&&DF(p),i==="recording"&&d.state==="transcribing"?(Hm("stop"),re.getState().markHintSuccess("recordingControls")):(i==="preparing"||i==="recording")&&d.state==="idle"&&Hm("cancel");const h=i==="preparing"||i==="recording",y=d.state==="preparing"||d.state==="recording";h&&!y&&bd(!1);const g=i==="preparing"||i==="recording"||i==="transcribing",x=d.state==="preparing"||d.state==="recording"||d.state==="transcribing";!g&&x?hH():g&&!x&&mH();const v=i==="preparing"||i==="recording",b=d.state==="preparing"||d.state==="recording";!v&&b?(l!==null&&window.clearTimeout(l),l=window.setTimeout(()=>{l=null;const k=Ze.getState().state;k!=="preparing"&&k!=="recording"||(Jt(`[recording] watchdog tripped: stuck in state=${k} > ${Qk}ms → force abort`),Xm(),In(),Ze.setState({state:"idle",activeId:null,audioLevels:Qt(),recordingId:null,liveTranscript:""}))},Qk)):v&&!b&&l!==null&&(window.clearTimeout(l),l=null),i=d.state;const w=d.state==="error";w&&(!o||d.errorMessage!==s)?(a!==null&&window.clearTimeout(a),a=window.setTimeout(()=>{a=null,Ze.getState().state==="error"&&Ze.getState().dismissError()},fH)):!w&&a!==null&&(window.clearTimeout(a),a=null),o=w,s=d.errorMessage;const _=JSON.stringify({state:d.state,activeId:d.activeId,errorMessage:d.errorMessage,recordingId:d.recordingId,liveTranscript:d.liveTranscript,pillEarlyHide:d.pillEarlyHide});_!==r&&(r=_,ja("openspeech://recording-phase",{state:d.state,activeId:d.activeId,errorMessage:d.errorMessage,recordingId:d.recordingId,liveTranscript:d.liveTranscript,pillEarlyHide:d.pillEarlyHide}))}),await Ue("openspeech://overlay-action",d=>{const u=d.payload;console.log("[recording] overlay-action:",u),u==="cancel"?t().simulateCancel():u==="finalize"&&t().simulateFinalize()}),await Ue("openspeech://overlay-ready",()=>{const d=t();ja("openspeech://recording-phase",{state:d.state,activeId:d.activeId,errorMessage:d.errorMessage,recordingId:d.recordingId,liveTranscript:d.liveTranscript,pillEarlyHide:d.pillEarlyHide}),console.log("[recording] overlay-ready → resent recording-phase snapshot")}),await Ue("openspeech://hotkey",d=>{const u=d.payload.phase==="pressed"?++rc:0;n=n.then(async()=>{Ke(`[recording] event received: id=${d.payload.id} phase=${d.payload.phase} state=${t().state} activeId=${t().activeId??"null"}`);try{const{id:p,phase:h}=d.payload,y=performance.now(),g=t();if(h==="released")return;if(h==="pressed"){if(g.activeId===p&&(g.state==="recording"||g.state==="preparing")){const E=y-g.recordingStartedAt;if(g.state==="preparing"){console.log("[recording] toggle in preparing → silent abort (mic not ready)",{duration:E}),$i(),In(),e({state:"idle",activeId:null,audioLevels:Qt(),recordingId:null,liveTranscript:""});return}const C=100;if(p==="translate"&&E<C){console.log("[recording] toggle (translate): ignored (likely OS/webview-injected duplicate press)",{duration:E,threshold:C});return}if(E<vd){console.log("[recording] toggle: too short → discard (no save / no transcribe)",{duration:E,threshold:vd}),$i(),In(),e({state:"idle",activeId:null,audioLevels:Qt(),recordingId:null,liveTranscript:""});return}console.log("[recording] toggle: stopping → transcribing",{duration:E}),In(),e({state:"transcribing",audioLevels:Qt()}),i_().then(j=>{if(j.silent){e({state:"error",activeId:null,recordingId:null,liveTranscript:"",errorMessage:ie.t("overlay:toast.silent_recording.title")});return}if(!j.text){e({state:"error",activeId:null,recordingId:null,liveTranscript:"",errorMessage:ie.t("overlay:toast.transcribe_failed.title")});return}window.setTimeout(()=>{const T=t().state;T!=="transcribing"&&T!=="injecting"||e({state:"idle",activeId:null,recordingId:null,liveTranscript:""})},300)});return}if(g.activeId!==p&&Jk(g.activeId)&&Jk(p)&&(g.state==="recording"||g.state==="preparing")&&mo()==="UTTERANCE"){console.log("[recording] mode switch:",g.activeId,"→",p),e({activeId:p}),p==="translate"?bd(!0,e_()):bd(!1),yH(p==="translate"?"translate":"dictation",p),Hm("start");return}if(g.state==="error")console.log("[recording] press on error → dismiss & start new",{id:p}),t().dismissError();else if(g.state!=="idle"){console.warn("[recording] press IGNORED: state not idle and activeId mismatch",{pressed_id:p,cur_state:g.state,cur_activeId:g.activeId});return}const v=re.getState().dictation.mode==="custom";let b=pt.getState(),w=b.isAuthenticated;if(!w&&!v){Ke("[recording] gate: try_recover enter");const E=await Promise.race([B("openloaf_try_recover").catch(()=>!1),new Promise(C=>setTimeout(()=>C(!1),1500))]);Ke(`[recording] gate: try_recover exit recovered=${E}`),E&&(b=pt.getState(),w=b.isAuthenticated)}if(!w&&!v){console.log("[recording] gate blocked: no STT backend available");let E=!1;if(Ct){const C=si(),[j,T,A]=await Promise.all([C.isFocused().catch(()=>!1),C.isVisible().catch(()=>!1),C.isMinimized().catch(()=>!1)]);E=j||T&&!A}E?qe.getState().openLogin():Wt("error",ie.t("overlay:toast.not_logged_in.title"),{description:ie.t("overlay:toast.not_logged_in.description"),action:{label:ie.t("overlay:toast.not_logged_in.action"),key:"open_login"},durationMs:0});return}!v&&w&&Ct&&B("openloaf_health_check").then(E=>{E||console.warn("[recording] health check failed (logged for debug only)")}).catch(E=>{console.warn("[recording] health check invoke failed:",E)}),Ke("[recording] preflight enter");const k=await EH();if(Ke(`[recording] preflight exit ok=${k.ok}`),u!==rc){Ke(`[recording] press stale (myEpoch=${u} latest=${rc}) — abort`);return}if(!k.ok){console.warn("[recording] preflight failed:",k.reason),Wt("error",ie.t("overlay:toast.preflight_failed.title"),{description:k.reason});const E=p==="translate";mt.getState().add({type:E?"translate":"dictation",text:a0(),status:"failed",error:k.reason,duration_ms:0,target_lang:E?re.getState().general.translateTargetLang:null}).catch(C=>console.warn("[recording] preflight: history.add failed:",C));return}const S=po();gi(),Fi=!1,_f=!1,e({state:"preparing",activeId:p,errorMessage:null,recordingStartedAt:y,audioLevels:Qt(),recordingId:S,pillEarlyHide:!1,liveTranscript:""}),p==="translate"&&bd(!0,e_()),Ke(`[recording] startMic enter id=${p} recordingId=${S}`),pH().then(E=>{if(Ke(`[recording] startMic exit ok=${E} state=${t().state} activeId=${t().activeId??"null"}`),u!==rc){Ke(`[recording] startMic stale (myEpoch=${u} latest=${rc}) — balance only`),E&&In();return}const C=t();if(C.state!=="preparing"||C.activeId!==p){E&&(console.warn("[recording] startMic resolved after state changed → balancing stopMic",{resolvedFor:p,curState:C.state,curActiveId:C.activeId}),In());return}if(!E){const j=ie.t("overlay:error.stt_mic_not_ready");rl(j),e({state:"idle",activeId:null,audioLevels:Qt(),recordingId:null,liveTranscript:""}),Wt("error",ie.t("overlay:toast.recording_start_failed.title"),{description:j});return}kH(S),e({state:"recording"})});return}}catch(p){Jt(`[recording] hotkey handler threw: ${String(p)}`);try{In()}catch{}try{qf()}catch{}try{nu()}catch{}Ze.setState({state:"idle",activeId:null,audioLevels:Qt(),recordingId:null,liveTranscript:""})}}).catch(()=>{})}),await Ue("openspeech://audio-level",d=>{const u=Math.max(0,Math.min(1,Number(d.payload)||0));e(p=>({audioLevels:[u,...p.audioLevels.slice(0,-1)]}))}),await Ue("openspeech://audio-stream-error",d=>{const u=String(d.payload??"");console.warn("[audio] stream-error:",u);const p=t();if(p.state==="preparing"||p.state==="recording"||p.state==="transcribing"){const h=ie.t("overlay:error.stt_mic_not_ready");rl(h),$i(),In(),e({state:"error",activeId:null,errorMessage:h,audioLevels:Qt(),recordingId:null,liveTranscript:""}),Wt("error",ie.t("overlay:toast.recording_start_failed.title"),{description:h})}else In()}),await Ue("openspeech://asr-partial",d=>{e({liveTranscript:String(d.payload??"")})}),await Ue("openspeech://asr-final",d=>{const u=String(d.payload??"");e({liveTranscript:u});const p=mo(),h=t().activeId==="translate";p==="REALTIME"&&!h&&Jf(u)}),await Ue("openspeech://asr-error",d=>{console.warn("[stt] asr-error:",d.payload);const{code:u,message:p}=d.payload??{code:"",message:""};if(vH(u,p)){mo()==="REALTIME"?Wt("warning",ie.t("overlay:toast.realtime_degraded.title"),{description:ie.t("overlay:toast.realtime_degraded.realtime_mode")}):(Fi=!0,Wt("info",ie.t("overlay:toast.realtime_degraded.title"),{description:ie.t("overlay:toast.realtime_degraded.description")}));return}Wt("error",ie.t("overlay:toast.asr_error.title"),{description:u?`${u}: ${p}`:p||ie.t("overlay:toast.asr_error.unknown")})}),await Ue("openspeech://asr-closed",d=>{const{reason:u}=d.payload??{reason:"unknown"};u==="insufficient_credits"?(rl(ie.t("overlay:toast.insufficient_credits.error_message")),$i(),In(),Wt("error",ie.t("overlay:toast.insufficient_credits.title"),{description:ie.t("overlay:toast.insufficient_credits.description")}),e({state:"error",errorMessage:ie.t("overlay:toast.insufficient_credits.error_message"),audioLevels:Qt(),recordingId:null,liveTranscript:""})):u==="worker_dead"?(console.warn("[stt] worker_dead, aborting recording",d.payload),rl(ie.t("overlay:toast.worker_dead.error_message")),$i(),In(),Wt("error",ie.t("overlay:toast.worker_dead.title"),{description:ie.t("overlay:toast.worker_dead.description")}),e({state:"error",errorMessage:ie.t("overlay:toast.worker_dead.error_message"),audioLevels:Qt(),recordingId:null,liveTranscript:""})):u==="max_duration"?(Wt("warning",ie.t("overlay:toast.session_timeout.title"),{description:ie.t("overlay:toast.session_timeout.description")}),console.warn("[stt] session closed by server:",u)):u==="idle_timeout"&&console.warn("[stt] session closed by server:",u)}),await Ue("openspeech://stt-ready",d=>{const u=d.payload?.sessionId??"";_f=!0,u&&(dl=u,console.info(`[stt] session ready, id=${u}`))}),await Ue("openspeech://stt-provider-resolved",d=>{const u=d.payload;(u==="saas-realtime"||u==="saas-file"||u==="tencent-realtime"||u==="tencent-file"||u==="aliyun-realtime"||u==="aliyun-file")&&(ru=u,console.info(`[stt] provider resolved: ${u}`))}),await Ue("openspeech://dictation-fallback",()=>{Wt("warning",ie.t("overlay:toast.dictation_fallback.title"),{description:ie.t("overlay:toast.dictation_fallback.description")})});const c=d=>{if(console.log("[recording] Esc → cancelling",{state:d}),Go){t_(),e({state:"idle",activeId:null,audioLevels:Qt(),recordingId:null,liveTranscript:""});return}d==="preparing"||d==="recording"?Xm():$i(),In(),e({state:"idle",activeId:null,audioLevels:Qt(),recordingId:null,liveTranscript:""})};await Ue("openspeech://key-preview",d=>{if(d.payload.phase!=="pressed"||d.payload.code!=="Escape"||d.payload.isRepeat)return;const u=t().state;if(u==="error"){console.log("[recording] Esc on error → dismiss"),t().dismissError();return}u!=="idle"&&c(u)}),console.log("[recording] listeners attached (hotkey + audio-level + asr-* + stream-error)"),ja("openspeech://overlay-ready")},syncBindings:async r=>{console.log("[recording] syncBindings → invoking apply_hotkey_config",r);try{await B("apply_hotkey_config",{payload:{bindings:r}}),console.log("[recording] syncBindings OK")}catch(i){console.error("[recording] syncBindings FAILED:",i),e({state:"error",errorMessage:ie.t("overlay:error.sync_hotkey_failed",{error:String(i)})})}},dismissError:()=>{e({state:"idle",activeId:null,errorMessage:null,audioLevels:Qt(),recordingId:null,liveTranscript:""})},simulateCancel:()=>{if(Go){t_(),e({state:"idle",activeId:null,audioLevels:Qt(),recordingId:null,liveTranscript:""});return}const r=t();r.state==="preparing"||r.state==="recording"?Xm():$i(),In(),e({state:"idle",activeId:null,audioLevels:Qt(),recordingId:null,liveTranscript:""})},simulateDictationFromAudio:async(r,i)=>{if(!Ct)return;if(t().state!=="idle"){ke.warning("[DEBUG] 当前正在录音/转写,先结束再试");return}if(i>300*1e3){ke.error("[DEBUG] 录音超过 5 分钟,REST ASR 不支持");return}gi(),Fi=!1,_f=!1,dl=`debug-${po()}`,Go=!0;const o=Date.now()+i;B("overlay_show").catch(s=>console.warn("[debug] overlay_show failed:",s)),kf({active:!0,totalMs:i,endAtUnixMs:o}),xH(),e({state:"recording",liveTranscript:"",pillEarlyHide:!1,audioLevels:Qt(),recordingStartedAt:performance.now()});try{await bH(i)}catch{return}if(Dv(),kf({active:!1}),!!Go){e({state:"transcribing",liveTranscript:"",pillEarlyHide:!1});try{let s="";try{const u=os({corePrompt:e0[lr(re.getState().dictation.lang,re.getState().general.interfaceLang)],items:mt.getState().items,targetApp:nr,focusTitle:_a,audioDurationMs:i,expandDomainKeywords:!0,includeUserCorrections:!0});console.info(`[debug] file transcribe system_prompt: len=${u.length} chars`),s=(await Ub({audioPath:r,durationMs:i,lang:i0(),provider:Du(),systemPrompt:u})).text??""}catch(u){console.warn("[debug] transcribe failed:",u);const p=Zf(u);Wt("error",ie.t("overlay:toast.transcribe_failed.title"),{description:co(u),...p?{action:Qf(),durationMs:0}:{}}),e({state:"idle",liveTranscript:""});return}if(!s){Wt("warning",ie.t("overlay:toast.transcribe_failed.title"),{description:ie.t("overlay:toast.transcribe_failed.no_transcript")}),e({state:"idle",liveTranscript:""});return}const l=KO();l||e({state:"injecting",pillEarlyHide:!1});let c=null;if(l){let u="";const p=re.getState().aiRefine,h=re.getState(),y=lr(h.dictation.lang,h.general.interfaceLang),g=r0(Na,p),x=is({lang:y,customRules:g.customRules,customExamples:g.customExamples});let v=null;p.mode==="custom"&&(v=p.customProviders.find(b=>b.id===p.activeCustomProviderId)??null);try{if(p.mode==="custom"&&!v)throw new Error("no_active_custom_provider");const b=t0(nr,Na),w=os({corePrompt:x,items:mt.getState().items,targetApp:nr,focusTitle:_a,audioDurationMs:i,enrichHotwords:!0,appTypeAddon:n0(b,y)});console.info(`[debug-refine] system_prompt: len=${w.length} chars`),c=(await ea({mode:p.mode,systemPrompt:w,userText:s,customBaseUrl:v?.baseUrl,customModel:v?.model,customKeyringId:v?`ai_provider_${v.id}`:void 0,taskId:dl??void 0},k=>{u+=k,t().state==="transcribing"&&e({state:"injecting",pillEarlyHide:!1}),Jf(u)})).refinedText,e({pillEarlyHide:!0});try{await Sl}catch{}if(Sa())try{await zn(c)}catch(k){console.warn("[debug] clipboard write failed:",k)}}catch(b){const w=String(b??"");p.mode==="custom"?(console.warn("[debug] refine custom failed:",b),await ka(b)||Wt("warning",ie.t("overlay:toast.transcribe_failed.title"),{description:co(b)})):Xf(w)?Lv():(console.warn("[debug] refine failed:",b),Wt("warning",ie.t("overlay:toast.transcribe_failed.title"),{description:co(b)}))}t().state==="transcribing"&&e({state:"injecting",pillEarlyHide:!1})}const d=c??s;if(d&&Sa()){try{await Sl}catch{}if(!Sa()){gi(),e({state:"idle",liveTranscript:""});return}if(d.startsWith(tr)){const u=d.slice(tr.length);if(u)try{await B("inject_type",{text:u})}catch(p){console.warn("[debug] tail type failed:",p);try{await zn(u),await B("inject_paste")}catch(h){console.warn("[debug] tail paste fallback failed:",h)}}}else try{await zn(d)}catch{}gi()}e({state:"idle",liveTranscript:""}),ke.success("[DEBUG] 模拟完成",{description:`text=${d.length} chars`})}finally{Go=!1,Dv(),kf({active:!1})}}},debugRefineOnly:async r=>{if(!Ct)throw new Error("not main window");const i=r.trim();if(!i)throw new Error("empty text");const a=re.getState().aiRefine,o=re.getState(),s=lr(o.dictation.lang,o.general.interfaceLang),l=is({lang:s,customRules:a.customRules,customExamples:a.customExamples}),c=Vb(),d=`${new Date().toISOString()} (UTC)`;let u=null;if(a.mode==="custom"&&(u=a.customProviders.find(y=>y.id===a.activeCustomProviderId)??null,!u))throw new Error("no_active_custom_provider");const p=DW(a.selectedDomains);return(await ea({mode:a.mode,systemPrompt:l,userText:i,hotwords:c.length>0?c:void 0,requestTime:d,domains:p.length>0?p:void 0,customBaseUrl:u?.baseUrl,customModel:u?.model,customKeyringId:u?`ai_provider_${u.id}`:void 0,taskId:`debug-refine-${po()}`},()=>{})).refinedText},debugReinject:async r=>{if(!Ct)throw new Error("not main window");const i=r;if(!i)throw new Error("empty text");try{await B("inject_type",{text:i})}catch(a){console.warn("[debug] inject_type failed, fallback paste:",a),await zn(i),await B("inject_paste")}},simulateFinalize:()=>{const r=t();if(r.state!=="recording"&&r.state!=="preparing")return;const i=performance.now()-r.recordingStartedAt;if(i<vd){console.log("[recording] finalize: too short → discard (no save / no transcribe)",{duration:i,threshold:vd}),$i(),In(),e({state:"idle",activeId:null,audioLevels:Qt(),recordingId:null,liveTranscript:""});return}In(),e({state:"transcribing",audioLevels:Qt()}),i_().then(a=>{if(a.silent){e({state:"idle",activeId:null,recordingId:null,liveTranscript:""});return}if(!a.text){e({state:"error",activeId:null,recordingId:null,liveTranscript:"",errorMessage:ie.t("overlay:toast.transcribe_failed.title")});return}window.setTimeout(()=>{t().state==="transcribing"&&e({state:"idle",activeId:null,recordingId:null,liveTranscript:""})},800)})}}}),a_=300*1e3,CH=3e4,Zm=300,jH=6e4,Ht={policyListenerStarted:!1,homeActivated:!1,checkTimer:null,inFlight:!1,pendingAutoInstall:null,autoIdleTimer:null};function o0(){Ht.checkTimer&&(clearTimeout(Ht.checkTimer),Ht.checkTimer=null)}function Sf(){Ht.autoIdleTimer&&(clearInterval(Ht.autoIdleTimer),Ht.autoIdleTimer=null)}function ic(){o0(),Ht.checkTimer=setTimeout(()=>{s0()},a_),Ke(`[updater] next check scheduled in ${(a_/6e4).toFixed(0)} min`)}async function s0(){if(Ht.inFlight){Ke("[updater] tick skipped: another check still in flight");return}const{updatePolicy:e,skippedUpdateVersion:t}=re.getState().general,n=new Date().toISOString();if(e==="DISABLED"){Ke(`[updater] tick=${n} skipped: policy=DISABLED`);return}const r=qe.getState().pendingUpdate?.version??Ht.pendingAutoInstall?.version??null;Ke(`[updater] tick=${n} START policy=${e} skipped=${t||"none"} queued=${r??"none"}`),Ht.inFlight=!0;const i=Date.now();let a=null;try{a=await Promise.race([Rb(),new Promise((s,l)=>setTimeout(()=>l(new Error("updater check timeout")),CH))])}catch(s){const l=Date.now()-i;Jt(`[updater] tick=${n} FAIL after ${l}ms: ${String(s?.message??s)}`),Ht.inFlight=!1,ic();return}Ht.inFlight=!1;const o=Date.now()-i;if(!a){Ke(`[updater] tick=${n} DONE no-update (${o}ms)`),ic();return}if(Ke(`[updater] tick=${n} HIT version=${a.version} current=${a.currentVersion} (${o}ms)`),t&&t===a.version){Ke(`[updater] tick=${n} suppressed: ${a.version} matches skippedUpdateVersion`),ic();return}if(r&&r===a.version){Ke(`[updater] tick=${n} no-op: ${a.version} already queued`),ic();return}e==="AUTO"?(Ke(`[updater] tick=${n} → AUTO queue ${a.version}, will install on next idle window`),Ht.pendingAutoInstall={version:a.version,update:a},PH()):(Ke(`[updater] tick=${n} → PROMPT toast for ${a.version}`),qe.getState().setPendingUpdate({version:a.version,update:a})),ic()}function PH(){Ht.autoIdleTimer||(o_(),Ht.autoIdleTimer=setInterval(()=>{o_()},jH))}async function o_(){const e=Ht.pendingAutoInstall;if(!e){Sf();return}const t=re.getState().general.updatePolicy;if(t!=="AUTO"){Ke(`[updater] auto-install: policy changed to ${t}, hand off ${e.version}`),t==="PROMPT"&&qe.getState().setPendingUpdate({version:e.version,update:e.update}),Ht.pendingAutoInstall=null,Sf();return}const n=Ze.getState().state;if(n!=="idle"){Ke(`[updater] auto-install: waiting (recording state=${n}, version=${e.version})`);return}let r;try{r=await B("system_idle_seconds")}catch(i){Jt(`[updater] auto-install: idle probe failed (${String(i?.message??i)}), skipping tick`);return}if(r<Zm){Ke(`[updater] auto-install: idle ${r}s < threshold ${Zm}s, waiting (version=${e.version})`);return}Ke(`[updater] auto-install FIRING version=${e.version} idleSec=${r} threshold=${Zm}s`),Ht.pendingAutoInstall=null,Sf();try{await NH(e.update,e.version)}catch(i){ll(`[updater] auto-install failed: ${String(i?.message??i)}`),qe.getState().setPendingUpdate({version:e.version,update:e.update}),ke.error(ie.t("settings:about.install_failed"),{description:String(i?.message??i)})}}async function NH(e,t){Ke(`[updater] silentInstall start → ${t}`),await e.downloadAndInstall(void 0,{timeout:300*1e3}),Ke("[updater] silentInstall returned, requesting relaunch"),await B("relaunch_app")}function TH(){if(Ht.policyListenerStarted)return;Ht.policyListenerStarted=!0,Ke("[updater] policy listener attached, awaiting home activation");let e=re.getState().general.updatePolicy;re.subscribe(t=>{const n=t.general.updatePolicy;if(n!==e){if(Ke(`[updater] policy changed ${e} → ${n}`),e=n,n==="DISABLED"){o0(),Sf(),Ht.pendingAutoInstall=null;return}Ht.homeActivated&&s0()}})}function OH(){Ht.homeActivated=!0,Ke("[updater] home activated → running immediate check"),o0(),s0()}function GO(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=GO(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function bt(){for(var e,t,n=0,r="",i=arguments.length;n<i;n++)(e=arguments[n])&&(t=GO(e))&&(r&&(r+=" "),r+=t);return r}const AH=(e,t)=>{const n=new Array(e.length+t.length);for(let r=0;r<e.length;r++)n[r]=e[r];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},RH=(e,t)=>({classGroupId:e,validator:t}),YO=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),ep="-",s_=[],MH="arbitrary..",IH=e=>{const t=LH(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:o=>{if(o.startsWith("[")&&o.endsWith("]"))return DH(o);const s=o.split(ep),l=s[0]===""&&s.length>1?1:0;return XO(s,l,t)},getConflictingClassGroupIds:(o,s)=>{if(s){const l=r[o],c=n[o];return l?c?AH(c,l):l:c||s_}return n[o]||s_}}},XO=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const i=e[t],a=n.nextPart.get(i);if(a){const c=XO(e,t+1,a);if(c)return c}const o=n.validators;if(o===null)return;const s=t===0?e.join(ep):e.slice(t).join(ep),l=o.length;for(let c=0;c<l;c++){const d=o[c];if(d.validator(s))return d.classGroupId}},DH=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),r=t.slice(0,n);return r?MH+r:void 0})(),LH=e=>{const{theme:t,classGroups:n}=e;return $H(n,t)},$H=(e,t)=>{const n=YO();for(const r in e){const i=e[r];l0(i,n,r,t)}return n},l0=(e,t,n,r)=>{const i=e.length;for(let a=0;a<i;a++){const o=e[a];zH(o,t,n,r)}},zH=(e,t,n,r)=>{if(typeof e=="string"){FH(e,t,n);return}if(typeof e=="function"){BH(e,t,n,r);return}WH(e,t,n,r)},FH=(e,t,n)=>{const r=e===""?t:ZO(t,e);r.classGroupId=n},BH=(e,t,n,r)=>{if(HH(e)){l0(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(RH(n,e))},WH=(e,t,n,r)=>{const i=Object.entries(e),a=i.length;for(let o=0;o<a;o++){const[s,l]=i[o];l0(l,ZO(t,s),n,r)}},ZO=(e,t)=>{let n=e;const r=t.split(ep),i=r.length;for(let a=0;a<i;a++){const o=r[a];let s=n.nextPart.get(o);s||(s=YO(),n.nextPart.set(o,s)),n=s}return n},HH=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,UH=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null);const i=(a,o)=>{n[a]=o,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(a){let o=n[a];if(o!==void 0)return o;if((o=r[a])!==void 0)return i(a,o),o},set(a,o){a in n?n[a]=o:i(a,o)}}},$v="!",l_=":",VH=[],c_=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),qH=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=i=>{const a=[];let o=0,s=0,l=0,c;const d=i.length;for(let g=0;g<d;g++){const x=i[g];if(o===0&&s===0){if(x===l_){a.push(i.slice(l,g)),l=g+1;continue}if(x==="/"){c=g;continue}}x==="["?o++:x==="]"?o--:x==="("?s++:x===")"&&s--}const u=a.length===0?i:i.slice(l);let p=u,h=!1;u.endsWith($v)?(p=u.slice(0,-1),h=!0):u.startsWith($v)&&(p=u.slice(1),h=!0);const y=c&&c>l?c-l:void 0;return c_(a,h,p,y)};if(t){const i=t+l_,a=r;r=o=>o.startsWith(i)?a(o.slice(i.length)):c_(VH,!1,o,void 0,!0)}if(n){const i=r;r=a=>n({className:a,parseClassName:i})}return r},KH=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,r)=>{t.set(n,1e6+r)}),n=>{const r=[];let i=[];for(let a=0;a<n.length;a++){const o=n[a],s=o[0]==="[",l=t.has(o);s||l?(i.length>0&&(i.sort(),r.push(...i),i=[]),r.push(o)):i.push(o)}return i.length>0&&(i.sort(),r.push(...i)),r}},GH=e=>({cache:UH(e.cacheSize),parseClassName:qH(e),sortModifiers:KH(e),postfixLookupClassGroupIds:YH(e),...IH(e)}),YH=e=>{const t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let r=0;r<n.length;r++)t[n[r]]=!0;return t},XH=/\s+/,ZH=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a,postfixLookupClassGroupIds:o}=t,s=[],l=e.trim().split(XH);let c="";for(let d=l.length-1;d>=0;d-=1){const u=l[d],{isExternal:p,modifiers:h,hasImportantModifier:y,baseClassName:g,maybePostfixModifierPosition:x}=n(u);if(p){c=u+(c.length>0?" "+c:c);continue}let v=!!x,b;if(v){const E=g.substring(0,x);b=r(E);const C=b&&o[b]?r(g):void 0;C&&C!==b&&(b=C,v=!1)}else b=r(g);if(!b){if(!v){c=u+(c.length>0?" "+c:c);continue}if(b=r(g),!b){c=u+(c.length>0?" "+c:c);continue}v=!1}const w=h.length===0?"":h.length===1?h[0]:a(h).join(":"),_=y?w+$v:w,k=_+b;if(s.indexOf(k)>-1)continue;s.push(k);const S=i(b,v);for(let E=0;E<S.length;++E){const C=S[E];s.push(_+C)}c=u+(c.length>0?" "+c:c)}return c},QH=(...e)=>{let t=0,n,r,i="";for(;t<e.length;)(n=e[t++])&&(r=QO(n))&&(i&&(i+=" "),i+=r);return i},QO=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=QO(e[r]))&&(n&&(n+=" "),n+=t);return n},JH=(e,...t)=>{let n,r,i,a;const o=l=>{const c=t.reduce((d,u)=>u(d),e());return n=GH(c),r=n.cache.get,i=n.cache.set,a=s,s(l)},s=l=>{const c=r(l);if(c)return c;const d=ZH(l,n);return i(l,d),d};return a=o,(...l)=>a(QH(...l))},e8=[],mn=e=>{const t=n=>n[e]||e8;return t.isThemeGetter=!0,t},JO=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,eA=/^\((?:(\w[\w-]*):)?(.+)\)$/i,t8=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,n8=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,r8=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,i8=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,a8=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,o8=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ga=e=>t8.test(e),it=e=>!!e&&!Number.isNaN(Number(e)),Ri=e=>!!e&&Number.isInteger(Number(e)),Qm=e=>e.endsWith("%")&&it(e.slice(0,-1)),ha=e=>n8.test(e),tA=()=>!0,s8=e=>r8.test(e)&&!i8.test(e),c0=()=>!1,l8=e=>a8.test(e),c8=e=>o8.test(e),u8=e=>!Pe(e)&&!Te(e),d8=e=>e.startsWith("@container")&&(e[10]==="/"&&e[11]!==void 0||e[11]==="s"&&e[16]!==void 0&&e.startsWith("-size/",10)||e[11]==="n"&&e[18]!==void 0&&e.startsWith("-normal/",10)),f8=e=>Eo(e,iA,c0),Pe=e=>JO.test(e),$o=e=>Eo(e,aA,s8),u_=e=>Eo(e,b8,it),p8=e=>Eo(e,sA,tA),h8=e=>Eo(e,oA,c0),d_=e=>Eo(e,nA,c0),m8=e=>Eo(e,rA,c8),wd=e=>Eo(e,lA,l8),Te=e=>eA.test(e),ac=e=>Ss(e,aA),g8=e=>Ss(e,oA),f_=e=>Ss(e,nA),y8=e=>Ss(e,iA),v8=e=>Ss(e,rA),kd=e=>Ss(e,lA,!0),x8=e=>Ss(e,sA,!0),Eo=(e,t,n)=>{const r=JO.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},Ss=(e,t,n=!1)=>{const r=eA.exec(e);return r?r[1]?t(r[1]):n:!1},nA=e=>e==="position"||e==="percentage",rA=e=>e==="image"||e==="url",iA=e=>e==="length"||e==="size"||e==="bg-size",aA=e=>e==="length",b8=e=>e==="number",oA=e=>e==="family-name",sA=e=>e==="number"||e==="weight",lA=e=>e==="shadow",w8=()=>{const e=mn("color"),t=mn("font"),n=mn("text"),r=mn("font-weight"),i=mn("tracking"),a=mn("leading"),o=mn("breakpoint"),s=mn("container"),l=mn("spacing"),c=mn("radius"),d=mn("shadow"),u=mn("inset-shadow"),p=mn("text-shadow"),h=mn("drop-shadow"),y=mn("blur"),g=mn("perspective"),x=mn("aspect"),v=mn("ease"),b=mn("animate"),w=()=>["auto","avoid","all","avoid-page","page","left","right","column"],_=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],k=()=>[..._(),Te,Pe],S=()=>["auto","hidden","clip","visible","scroll"],E=()=>["auto","contain","none"],C=()=>[Te,Pe,l],j=()=>[Ga,"full","auto",...C()],T=()=>[Ri,"none","subgrid",Te,Pe],A=()=>["auto",{span:["full",Ri,Te,Pe]},Ri,Te,Pe],R=()=>[Ri,"auto",Te,Pe],D=()=>["auto","min","max","fr",Te,Pe],M=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],O=()=>["start","end","center","stretch","center-safe","end-safe"],I=()=>["auto",...C()],L=()=>[Ga,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...C()],V=()=>[Ga,"screen","full","dvw","lvw","svw","min","max","fit",...C()],F=()=>[Ga,"screen","full","lh","dvh","lvh","svh","min","max","fit",...C()],N=()=>[e,Te,Pe],ee=()=>[..._(),f_,d_,{position:[Te,Pe]}],Q=()=>["no-repeat",{repeat:["","x","y","space","round"]}],P=()=>["auto","cover","contain",y8,f8,{size:[Te,Pe]}],z=()=>[Qm,ac,$o],$=()=>["","none","full",c,Te,Pe],H=()=>["",it,ac,$o],oe=()=>["solid","dashed","dotted","double"],q=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],X=()=>[it,Qm,f_,d_],te=()=>["","none",y,Te,Pe],ue=()=>["none",it,Te,Pe],G=()=>["none",it,Te,Pe],be=()=>[it,Te,Pe],xe=()=>[Ga,"full",...C()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[ha],breakpoint:[ha],color:[tA],container:[ha],"drop-shadow":[ha],ease:["in","out","in-out"],font:[u8],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[ha],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[ha],shadow:[ha],spacing:["px",it],text:[ha],"text-shadow":[ha],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Ga,Pe,Te,x]}],container:["container"],"container-type":[{"@container":["","normal","size",Te,Pe]}],"container-named":[d8],columns:[{columns:[it,Pe,Te,s]}],"break-after":[{"break-after":w()}],"break-before":[{"break-before":w()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:k()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:E()}],"overscroll-x":[{"overscroll-x":E()}],"overscroll-y":[{"overscroll-y":E()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:j()}],"inset-x":[{"inset-x":j()}],"inset-y":[{"inset-y":j()}],start:[{"inset-s":j(),start:j()}],end:[{"inset-e":j(),end:j()}],"inset-bs":[{"inset-bs":j()}],"inset-be":[{"inset-be":j()}],top:[{top:j()}],right:[{right:j()}],bottom:[{bottom:j()}],left:[{left:j()}],visibility:["visible","invisible","collapse"],z:[{z:[Ri,"auto",Te,Pe]}],basis:[{basis:[Ga,"full","auto",s,...C()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[it,Ga,"auto","initial","none",Pe]}],grow:[{grow:["",it,Te,Pe]}],shrink:[{shrink:["",it,Te,Pe]}],order:[{order:[Ri,"first","last","none",Te,Pe]}],"grid-cols":[{"grid-cols":T()}],"col-start-end":[{col:A()}],"col-start":[{"col-start":R()}],"col-end":[{"col-end":R()}],"grid-rows":[{"grid-rows":T()}],"row-start-end":[{row:A()}],"row-start":[{"row-start":R()}],"row-end":[{"row-end":R()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":D()}],"auto-rows":[{"auto-rows":D()}],gap:[{gap:C()}],"gap-x":[{"gap-x":C()}],"gap-y":[{"gap-y":C()}],"justify-content":[{justify:[...M(),"normal"]}],"justify-items":[{"justify-items":[...O(),"normal"]}],"justify-self":[{"justify-self":["auto",...O()]}],"align-content":[{content:["normal",...M()]}],"align-items":[{items:[...O(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...O(),{baseline:["","last"]}]}],"place-content":[{"place-content":M()}],"place-items":[{"place-items":[...O(),"baseline"]}],"place-self":[{"place-self":["auto",...O()]}],p:[{p:C()}],px:[{px:C()}],py:[{py:C()}],ps:[{ps:C()}],pe:[{pe:C()}],pbs:[{pbs:C()}],pbe:[{pbe:C()}],pt:[{pt:C()}],pr:[{pr:C()}],pb:[{pb:C()}],pl:[{pl:C()}],m:[{m:I()}],mx:[{mx:I()}],my:[{my:I()}],ms:[{ms:I()}],me:[{me:I()}],mbs:[{mbs:I()}],mbe:[{mbe:I()}],mt:[{mt:I()}],mr:[{mr:I()}],mb:[{mb:I()}],ml:[{ml:I()}],"space-x":[{"space-x":C()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":C()}],"space-y-reverse":["space-y-reverse"],size:[{size:L()}],"inline-size":[{inline:["auto",...V()]}],"min-inline-size":[{"min-inline":["auto",...V()]}],"max-inline-size":[{"max-inline":["none",...V()]}],"block-size":[{block:["auto",...F()]}],"min-block-size":[{"min-block":["auto",...F()]}],"max-block-size":[{"max-block":["none",...F()]}],w:[{w:[s,"screen",...L()]}],"min-w":[{"min-w":[s,"screen","none",...L()]}],"max-w":[{"max-w":[s,"screen","none","prose",{screen:[o]},...L()]}],h:[{h:["screen","lh",...L()]}],"min-h":[{"min-h":["screen","lh","none",...L()]}],"max-h":[{"max-h":["screen","lh",...L()]}],"font-size":[{text:["base",n,ac,$o]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,x8,p8]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Qm,Pe]}],"font-family":[{font:[g8,h8,t]}],"font-features":[{"font-features":[Pe]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[i,Te,Pe]}],"line-clamp":[{"line-clamp":[it,"none",Te,u_]}],leading:[{leading:[a,...C()]}],"list-image":[{"list-image":["none",Te,Pe]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Te,Pe]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:N()}],"text-color":[{text:N()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...oe(),"wavy"]}],"text-decoration-thickness":[{decoration:[it,"from-font","auto",Te,$o]}],"text-decoration-color":[{decoration:N()}],"underline-offset":[{"underline-offset":[it,"auto",Te,Pe]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:C()}],"tab-size":[{tab:[Ri,Te,Pe]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Te,Pe]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Te,Pe]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:ee()}],"bg-repeat":[{bg:Q()}],"bg-size":[{bg:P()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Ri,Te,Pe],radial:["",Te,Pe],conic:[Ri,Te,Pe]},v8,m8]}],"bg-color":[{bg:N()}],"gradient-from-pos":[{from:z()}],"gradient-via-pos":[{via:z()}],"gradient-to-pos":[{to:z()}],"gradient-from":[{from:N()}],"gradient-via":[{via:N()}],"gradient-to":[{to:N()}],rounded:[{rounded:$()}],"rounded-s":[{"rounded-s":$()}],"rounded-e":[{"rounded-e":$()}],"rounded-t":[{"rounded-t":$()}],"rounded-r":[{"rounded-r":$()}],"rounded-b":[{"rounded-b":$()}],"rounded-l":[{"rounded-l":$()}],"rounded-ss":[{"rounded-ss":$()}],"rounded-se":[{"rounded-se":$()}],"rounded-ee":[{"rounded-ee":$()}],"rounded-es":[{"rounded-es":$()}],"rounded-tl":[{"rounded-tl":$()}],"rounded-tr":[{"rounded-tr":$()}],"rounded-br":[{"rounded-br":$()}],"rounded-bl":[{"rounded-bl":$()}],"border-w":[{border:H()}],"border-w-x":[{"border-x":H()}],"border-w-y":[{"border-y":H()}],"border-w-s":[{"border-s":H()}],"border-w-e":[{"border-e":H()}],"border-w-bs":[{"border-bs":H()}],"border-w-be":[{"border-be":H()}],"border-w-t":[{"border-t":H()}],"border-w-r":[{"border-r":H()}],"border-w-b":[{"border-b":H()}],"border-w-l":[{"border-l":H()}],"divide-x":[{"divide-x":H()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":H()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...oe(),"hidden","none"]}],"divide-style":[{divide:[...oe(),"hidden","none"]}],"border-color":[{border:N()}],"border-color-x":[{"border-x":N()}],"border-color-y":[{"border-y":N()}],"border-color-s":[{"border-s":N()}],"border-color-e":[{"border-e":N()}],"border-color-bs":[{"border-bs":N()}],"border-color-be":[{"border-be":N()}],"border-color-t":[{"border-t":N()}],"border-color-r":[{"border-r":N()}],"border-color-b":[{"border-b":N()}],"border-color-l":[{"border-l":N()}],"divide-color":[{divide:N()}],"outline-style":[{outline:[...oe(),"none","hidden"]}],"outline-offset":[{"outline-offset":[it,Te,Pe]}],"outline-w":[{outline:["",it,ac,$o]}],"outline-color":[{outline:N()}],shadow:[{shadow:["","none",d,kd,wd]}],"shadow-color":[{shadow:N()}],"inset-shadow":[{"inset-shadow":["none",u,kd,wd]}],"inset-shadow-color":[{"inset-shadow":N()}],"ring-w":[{ring:H()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:N()}],"ring-offset-w":[{"ring-offset":[it,$o]}],"ring-offset-color":[{"ring-offset":N()}],"inset-ring-w":[{"inset-ring":H()}],"inset-ring-color":[{"inset-ring":N()}],"text-shadow":[{"text-shadow":["none",p,kd,wd]}],"text-shadow-color":[{"text-shadow":N()}],opacity:[{opacity:[it,Te,Pe]}],"mix-blend":[{"mix-blend":[...q(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":q()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[it]}],"mask-image-linear-from-pos":[{"mask-linear-from":X()}],"mask-image-linear-to-pos":[{"mask-linear-to":X()}],"mask-image-linear-from-color":[{"mask-linear-from":N()}],"mask-image-linear-to-color":[{"mask-linear-to":N()}],"mask-image-t-from-pos":[{"mask-t-from":X()}],"mask-image-t-to-pos":[{"mask-t-to":X()}],"mask-image-t-from-color":[{"mask-t-from":N()}],"mask-image-t-to-color":[{"mask-t-to":N()}],"mask-image-r-from-pos":[{"mask-r-from":X()}],"mask-image-r-to-pos":[{"mask-r-to":X()}],"mask-image-r-from-color":[{"mask-r-from":N()}],"mask-image-r-to-color":[{"mask-r-to":N()}],"mask-image-b-from-pos":[{"mask-b-from":X()}],"mask-image-b-to-pos":[{"mask-b-to":X()}],"mask-image-b-from-color":[{"mask-b-from":N()}],"mask-image-b-to-color":[{"mask-b-to":N()}],"mask-image-l-from-pos":[{"mask-l-from":X()}],"mask-image-l-to-pos":[{"mask-l-to":X()}],"mask-image-l-from-color":[{"mask-l-from":N()}],"mask-image-l-to-color":[{"mask-l-to":N()}],"mask-image-x-from-pos":[{"mask-x-from":X()}],"mask-image-x-to-pos":[{"mask-x-to":X()}],"mask-image-x-from-color":[{"mask-x-from":N()}],"mask-image-x-to-color":[{"mask-x-to":N()}],"mask-image-y-from-pos":[{"mask-y-from":X()}],"mask-image-y-to-pos":[{"mask-y-to":X()}],"mask-image-y-from-color":[{"mask-y-from":N()}],"mask-image-y-to-color":[{"mask-y-to":N()}],"mask-image-radial":[{"mask-radial":[Te,Pe]}],"mask-image-radial-from-pos":[{"mask-radial-from":X()}],"mask-image-radial-to-pos":[{"mask-radial-to":X()}],"mask-image-radial-from-color":[{"mask-radial-from":N()}],"mask-image-radial-to-color":[{"mask-radial-to":N()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":_()}],"mask-image-conic-pos":[{"mask-conic":[it]}],"mask-image-conic-from-pos":[{"mask-conic-from":X()}],"mask-image-conic-to-pos":[{"mask-conic-to":X()}],"mask-image-conic-from-color":[{"mask-conic-from":N()}],"mask-image-conic-to-color":[{"mask-conic-to":N()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:ee()}],"mask-repeat":[{mask:Q()}],"mask-size":[{mask:P()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Te,Pe]}],filter:[{filter:["","none",Te,Pe]}],blur:[{blur:te()}],brightness:[{brightness:[it,Te,Pe]}],contrast:[{contrast:[it,Te,Pe]}],"drop-shadow":[{"drop-shadow":["","none",h,kd,wd]}],"drop-shadow-color":[{"drop-shadow":N()}],grayscale:[{grayscale:["",it,Te,Pe]}],"hue-rotate":[{"hue-rotate":[it,Te,Pe]}],invert:[{invert:["",it,Te,Pe]}],saturate:[{saturate:[it,Te,Pe]}],sepia:[{sepia:["",it,Te,Pe]}],"backdrop-filter":[{"backdrop-filter":["","none",Te,Pe]}],"backdrop-blur":[{"backdrop-blur":te()}],"backdrop-brightness":[{"backdrop-brightness":[it,Te,Pe]}],"backdrop-contrast":[{"backdrop-contrast":[it,Te,Pe]}],"backdrop-grayscale":[{"backdrop-grayscale":["",it,Te,Pe]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[it,Te,Pe]}],"backdrop-invert":[{"backdrop-invert":["",it,Te,Pe]}],"backdrop-opacity":[{"backdrop-opacity":[it,Te,Pe]}],"backdrop-saturate":[{"backdrop-saturate":[it,Te,Pe]}],"backdrop-sepia":[{"backdrop-sepia":["",it,Te,Pe]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":C()}],"border-spacing-x":[{"border-spacing-x":C()}],"border-spacing-y":[{"border-spacing-y":C()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Te,Pe]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[it,"initial",Te,Pe]}],ease:[{ease:["linear","initial",v,Te,Pe]}],delay:[{delay:[it,Te,Pe]}],animate:[{animate:["none",b,Te,Pe]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[g,Te,Pe]}],"perspective-origin":[{"perspective-origin":k()}],rotate:[{rotate:ue()}],"rotate-x":[{"rotate-x":ue()}],"rotate-y":[{"rotate-y":ue()}],"rotate-z":[{"rotate-z":ue()}],scale:[{scale:G()}],"scale-x":[{"scale-x":G()}],"scale-y":[{"scale-y":G()}],"scale-z":[{"scale-z":G()}],"scale-3d":["scale-3d"],skew:[{skew:be()}],"skew-x":[{"skew-x":be()}],"skew-y":[{"skew-y":be()}],transform:[{transform:[Te,Pe,"","none","gpu","cpu"]}],"transform-origin":[{origin:k()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:xe()}],"translate-x":[{"translate-x":xe()}],"translate-y":[{"translate-y":xe()}],"translate-z":[{"translate-z":xe()}],"translate-none":["translate-none"],zoom:[{zoom:[Ri,Te,Pe]}],accent:[{accent:N()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:N()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Te,Pe]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":N()}],"scrollbar-track-color":[{"scrollbar-track":N()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":C()}],"scroll-mx":[{"scroll-mx":C()}],"scroll-my":[{"scroll-my":C()}],"scroll-ms":[{"scroll-ms":C()}],"scroll-me":[{"scroll-me":C()}],"scroll-mbs":[{"scroll-mbs":C()}],"scroll-mbe":[{"scroll-mbe":C()}],"scroll-mt":[{"scroll-mt":C()}],"scroll-mr":[{"scroll-mr":C()}],"scroll-mb":[{"scroll-mb":C()}],"scroll-ml":[{"scroll-ml":C()}],"scroll-p":[{"scroll-p":C()}],"scroll-px":[{"scroll-px":C()}],"scroll-py":[{"scroll-py":C()}],"scroll-ps":[{"scroll-ps":C()}],"scroll-pe":[{"scroll-pe":C()}],"scroll-pbs":[{"scroll-pbs":C()}],"scroll-pbe":[{"scroll-pbe":C()}],"scroll-pt":[{"scroll-pt":C()}],"scroll-pr":[{"scroll-pr":C()}],"scroll-pb":[{"scroll-pb":C()}],"scroll-pl":[{"scroll-pl":C()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Te,Pe]}],fill:[{fill:["none",...N()]}],"stroke-w":[{stroke:[it,ac,$o,u_]}],stroke:[{stroke:["none",...N()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},k8=JH(w8);function ae(...e){return k8(bt(e))}function p_({version:e,onInstall:t,onSkip:n,duration:r}){const i=ie.t("pages:layout.tray.update_found_title"),a=ie.t("settings:about.install_now"),o=ie.t("settings:about.skip_version");return ke.custom(s=>f.jsxs("div",{className:"flex w-[340px] flex-col gap-3 border border-te-gray bg-te-bg p-4 font-mono text-xs text-te-fg shadow-2xl",children:[f.jsxs("div",{className:"flex flex-col gap-1",children:[f.jsx("span",{className:"text-[11px] font-bold uppercase tracking-[0.15em] text-te-fg",children:i}),f.jsx("span",{className:"text-te-light-gray",children:e})]}),f.jsxs("div",{className:"flex items-stretch justify-end gap-2",children:[n?f.jsx("button",{type:"button",onClick:()=>{ke.dismiss(s),n()},className:ae("border border-te-gray px-3 py-1.5 font-mono text-[11px] uppercase tracking-[0.15em] text-te-light-gray transition-colors","hover:bg-te-surface-hover hover:text-te-fg"),children:o}):null,f.jsx("button",{type:"button",onClick:()=>{ke.dismiss(s),t()},className:ae("border border-te-accent bg-te-accent px-3 py-1.5 font-mono text-[11px] uppercase tracking-[0.15em] text-te-accent-fg transition-colors","hover:bg-te-accent/90"),children:a})]})]}),{duration:r??1/0,unstyled:!0})}function _8(e,t){return function(r,...i){const a=new URL(e);return a.searchParams.set("code",r.toString()),i.forEach(o=>a.searchParams.append("args[]",o)),`${t} error #${r}; visit ${a} for the full message.`}}const fa=_8("https://base-ui.com/production-error","Base UI"),cA=m.createContext(void 0);function Co(e){const t=m.useContext(cA);if(e===!1&&t===void 0)throw new Error(fa(27));return t}const h_={};function cr(e,t){const n=m.useRef(h_);return n.current===h_&&(n.current=e(t)),n}function El(e,t,n,r){const i=cr(uA).current;return E8(i,e,t,n,r)&&dA(i,[e,t,n,r]),i.callback}function S8(e){const t=cr(uA).current;return C8(t,e)&&dA(t,e),t.callback}function uA(){return{callback:null,cleanup:null,refs:[]}}function E8(e,t,n,r,i){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==r||e.refs[3]!==i}function C8(e,t){return e.refs.length!==t.length||e.refs.some((n,r)=>n!==t[r])}function dA(e,t){if(e.refs=t,t.every(n=>n==null)){e.callback=null;return}e.callback=n=>{if(e.cleanup&&(e.cleanup(),e.cleanup=null),n!=null){const r=Array(t.length).fill(null);for(let i=0;i<t.length;i+=1){const a=t[i];if(a!=null)switch(typeof a){case"function":{const o=a(n);typeof o=="function"&&(r[i]=o);break}case"object":{a.current=n;break}}}e.cleanup=()=>{for(let i=0;i<t.length;i+=1){const a=t[i];if(a!=null)switch(typeof a){case"function":{const o=r[i];typeof o=="function"?o():a(null);break}case"object":{a.current=null;break}}}}}}}const j8=parseInt(m.version,10);function u0(e){return j8>=e}function m_(e){if(!m.isValidElement(e))return null;const t=e,n=t.props;return(u0(19)?n?.ref:t.ref)??null}function zv(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}function d0(){}const Fv=Object.freeze([]),Bn=Object.freeze({});function P8(e,t){const n={};for(const r in e){const i=e[r];if(t?.hasOwnProperty(r)){const a=t[r](i);a!=null&&Object.assign(n,a);continue}i===!0?n[`data-${r.toLowerCase()}`]="":i&&(n[`data-${r.toLowerCase()}`]=i.toString())}return n}function N8(e,t){return typeof e=="function"?e(t):e}function T8(e,t){return typeof e=="function"?e(t):e}const f0={};function Cl(e,t,n,r,i){if(!n&&!r&&!e)return tp(t);let a=tp(e);return t&&(a=Ef(a,t)),n&&(a=Ef(a,n)),r&&(a=Ef(a,r)),a}function O8(e){if(e.length===0)return f0;if(e.length===1)return tp(e[0]);let t=tp(e[0]);for(let n=1;n<e.length;n+=1)t=Ef(t,e[n]);return t}function tp(e){return p0(e)?{...pA(e,f0)}:A8(e)}function Ef(e,t){return p0(t)?pA(t,e):R8(e,t)}function A8(e){const t={...e};for(const n in t){const r=t[n];fA(n,r)&&(t[n]=hA(r))}return t}function R8(e,t){if(!t)return e;for(const n in t){const r=t[n];switch(n){case"style":{e[n]=zv(e.style,r);break}case"className":{e[n]=mA(e.className,r);break}default:fA(n,r)?e[n]=M8(e[n],r):e[n]=r}}return e}function fA(e,t){const n=e.charCodeAt(0),r=e.charCodeAt(1),i=e.charCodeAt(2);return n===111&&r===110&&i>=65&&i<=90&&(typeof t=="function"||typeof t>"u")}function p0(e){return typeof e=="function"}function pA(e,t){return p0(e)?e(t):e??f0}function M8(e,t){return t?e?(...n)=>{const r=n[0];if(gA(r)){const a=r;np(a);const o=t(...n);return a.baseUIHandlerPrevented||e?.(...n),o}const i=t(...n);return e?.(...n),i}:hA(t):e}function hA(e){return e&&((...t)=>{const n=t[0];return gA(n)&&np(n),e(...t)})}function np(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function mA(e,t){return t?e?t+" "+e:t:e}function gA(e){return e!=null&&typeof e=="object"&&"nativeEvent"in e}function Ur(e,t,n={}){const r=t.render,i=I8(t,n);if(n.enabled===!1)return null;const a=n.state??Bn;return $8(e,r,i,a)}function I8(e,t={}){const{className:n,style:r,render:i}=e,{state:a=Bn,ref:o,props:s,stateAttributesMapping:l,enabled:c=!0}=t,d=c?N8(n,a):void 0,u=c?T8(r,a):void 0,p=c?P8(a,l):Bn,h=c&&s?D8(s):void 0,y=c?zv(p,h)??{}:Bn;return typeof document<"u"&&(c?Array.isArray(o)?y.ref=S8([y.ref,m_(i),...o]):y.ref=El(y.ref,m_(i),o):El(null,null)),c?(d!==void 0&&(y.className=mA(y.className,d)),u!==void 0&&(y.style=zv(y.style,u)),y):Bn}function D8(e){return Array.isArray(e)?O8(e):Cl(void 0,e)}const L8=Symbol.for("react.lazy");function $8(e,t,n,r){if(t){if(typeof t=="function")return t(n,r);const i=Cl(n,t.props);i.ref=n.ref;let a=t;return a?.$$typeof===L8&&(a=m.Children.toArray(t)[0]),m.cloneElement(a,i)}if(e&&typeof e=="string")return z8(e,n);throw new Error(fa(8))}function z8(e,t){return e==="button"?m.createElement("button",{type:"button",...t,key:t.key}):e==="img"?m.createElement("img",{alt:"",...t,key:t.key}):m.createElement(e,t)}let iu=(function(e){return e.startingStyle="data-starting-style",e.endingStyle="data-ending-style",e})({});const F8={[iu.startingStyle]:""},B8={[iu.endingStyle]:""},bh={transitionStatus(e){return e==="starting"?F8:e==="ending"?B8:null}};let wi=(function(e){return e.open="data-open",e.closed="data-closed",e[e.startingStyle=iu.startingStyle]="startingStyle",e[e.endingStyle=iu.endingStyle]="endingStyle",e.anchorHidden="data-anchor-hidden",e.side="data-side",e.align="data-align",e})({}),g_=(function(e){return e.popupOpen="data-popup-open",e.pressed="data-pressed",e})({});const W8={[g_.popupOpen]:"",[g_.pressed]:""},H8={[wi.open]:""},U8={[wi.closed]:""},V8={[wi.anchorHidden]:""},y_={open(e){return e?W8:null}},Lu={open(e){return e?H8:U8},anchorHidden(e){return e?V8:null}},q8={...Lu,...bh},K8=m.forwardRef(function(t,n){const{render:r,className:i,style:a,forceRender:o=!1,...s}=t,{store:l}=Co(),c=l.useState("open"),d=l.useState("nested"),u=l.useState("mounted"),p=l.useState("transitionStatus");return Ur("div",t,{state:{open:c,transitionStatus:p},ref:[l.context.backdropRef,n],stateAttributesMapping:q8,props:[{role:"presentation",hidden:!u,style:{userSelect:"none",WebkitUserSelect:"none"}},s],enabled:o||!d})});function wh(){return typeof window<"u"}function Xn(e){return h0(e)?(e.nodeName||"").toLowerCase():"#document"}function an(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function pa(e){var t;return(t=(h0(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function h0(e){return wh()?e instanceof Node||e instanceof an(e).Node:!1}function st(e){return wh()?e instanceof Element||e instanceof an(e).Element:!1}function Rt(e){return wh()?e instanceof HTMLElement||e instanceof an(e).HTMLElement:!1}function jl(e){return!wh()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof an(e).ShadowRoot}function jo(e){const{overflow:t,overflowX:n,overflowY:r,display:i}=Pr(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!=="inline"&&i!=="contents"}function G8(e){return/^(table|td|th)$/.test(Xn(e))}function kh(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const Y8=/transform|translate|scale|rotate|perspective|filter/,X8=/paint|layout|strict|content/,zo=e=>!!e&&e!=="none";let Jm;function m0(e){const t=st(e)?Pr(e):e;return zo(t.transform)||zo(t.translate)||zo(t.scale)||zo(t.rotate)||zo(t.perspective)||!_h()&&(zo(t.backdropFilter)||zo(t.filter))||Y8.test(t.willChange||"")||X8.test(t.contain||"")}function Z8(e){let t=ta(e);for(;Rt(t)&&!Ki(t);){if(m0(t))return t;if(kh(t))return null;t=ta(t)}return null}function _h(){return Jm==null&&(Jm=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Jm}function Ki(e){return/^(html|body|#document)$/.test(Xn(e))}function Pr(e){return an(e).getComputedStyle(e)}function Sh(e){return st(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ta(e){if(Xn(e)==="html")return e;const t=e.assignedSlot||e.parentNode||jl(e)&&e.host||pa(e);return jl(t)?t.host:t}function yA(e){const t=ta(e);return Ki(t)?e.ownerDocument?e.ownerDocument.body:e.body:Rt(t)&&jo(t)?t:yA(t)}function au(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=yA(e),a=i===((r=e.ownerDocument)==null?void 0:r.body),o=an(i);if(a){const s=Bv(o);return t.concat(o,o.visualViewport||[],jo(i)?i:[],s&&n?au(s):[])}else return t.concat(i,au(i,[],n))}function Bv(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}const eg=dh[`useInsertionEffect${Math.random().toFixed(1)}`.slice(0,-3)],Q8=eg&&eg!==m.useLayoutEffect?eg:e=>e();function et(e){const t=cr(J8).current;return t.next=e,Q8(t.effect),t.trampoline}function J8(){const e={next:void 0,callback:eU,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function eU(){}const tU={...dh},nU=()=>{},Ge=typeof document<"u"?m.useLayoutEffect:nU,rU=m.createContext(void 0);function g0(e=!1){const t=m.useContext(rU);if(t===void 0&&!e)throw new Error(fa(16));return t}function iU(e){const{focusableWhenDisabled:t,disabled:n,composite:r=!1,tabIndex:i=0,isNativeButton:a}=e,o=r&&t!==!1,s=r&&t===!1;return{props:m.useMemo(()=>{const c={onKeyDown(d){n&&t&&d.key!=="Tab"&&d.preventDefault()}};return r||(c.tabIndex=i,!a&&n&&(c.tabIndex=t?i:-1)),(a&&(t||o)||!a&&n)&&(c["aria-disabled"]=n),a&&(!t||s)&&(c.disabled=n),c},[r,n,t,o,s,a,i])}}function Eh(e={}){const{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:i=!0,composite:a}=e,o=m.useRef(null),s=g0(!0),l=a??s!==void 0,{props:c}=iU({focusableWhenDisabled:n,disabled:t,composite:l,tabIndex:r,isNativeButton:i}),d=m.useCallback(()=>{const h=o.current;tg(h)&&l&&t&&c.disabled===void 0&&h.disabled&&(h.disabled=!1)},[t,c.disabled,l]);Ge(d,[d]);const u=m.useCallback((h={})=>{const{onClick:y,onMouseDown:g,onKeyUp:x,onKeyDown:v,onPointerDown:b,...w}=h;return Cl({type:i?"button":void 0,onClick(k){if(t){k.preventDefault();return}y?.(k)},onMouseDown(k){t||g?.(k)},onKeyDown(k){if(t||(np(k),v?.(k),k.baseUIHandlerPrevented))return;const S=k.target===k.currentTarget,E=k.currentTarget,C=tg(E),j=!i&&aU(E),T=S&&(i?C:!j),A=k.key==="Enter",R=k.key===" ",D=E.getAttribute("role"),M=D?.startsWith("menuitem")||D==="option"||D==="gridcell";if(S&&l&&R){if(k.defaultPrevented&&M)return;k.preventDefault(),j||i&&C?(E.click(),k.preventBaseUIHandler()):T&&(y?.(k),k.preventBaseUIHandler());return}T&&(!i&&(R||A)&&k.preventDefault(),!i&&A&&y?.(k))},onKeyUp(k){if(!t){if(np(k),x?.(k),k.target===k.currentTarget&&i&&l&&tg(k.currentTarget)&&k.key===" "){k.preventDefault();return}k.baseUIHandlerPrevented||k.target===k.currentTarget&&!i&&!l&&k.key===" "&&y?.(k)}},onPointerDown(k){if(t){k.preventDefault();return}b?.(k)}},i?void 0:{role:"button"},c,w)},[t,c,l,i]),p=et(h=>{o.current=h,d()});return{getButtonProps:u,buttonRef:p}}function tg(e){return Rt(e)&&e.tagName==="BUTTON"}function aU(e){return!!(e?.tagName==="A"&&e?.href)}const ou="trigger-press",gr="trigger-hover",Fc="trigger-focus",y0="outside-press",vA="item-press",oU="close-press",Pl="focus-out",v0="escape-key",Cf="list-navigation",sU="cancel-open",jc="sibling-open",xA="imperative-action";function dt(e,t,n,r){let i=!1,a=!1;const o=Bn;return{reason:e,event:t??new Event("base-ui"),cancel(){i=!0},allowPropagation(){a=!0},get isCanceled(){return i},get isPropagationAllowed(){return a},trigger:n,...o}}const bA=m.forwardRef(function(t,n){const{render:r,className:i,disabled:a=!1,nativeButton:o=!0,style:s,...l}=t,{store:c}=Co(),d=c.useState("open");function u(g){d&&c.setOpen(!1,dt(oU,g.nativeEvent))}const{getButtonProps:p,buttonRef:h}=Eh({disabled:a,native:o});return Ur("button",t,{state:{disabled:a},ref:[n,h],props:[{onClick:u},l,p]})});let v_=0;function lU(e,t="mui"){const[n,r]=m.useState(e),i=e||n;return m.useEffect(()=>{n==null&&(v_+=1,r(`${t}-${v_}`))},[n,t]),i}const x_=tU.useId;function Es(e,t){if(x_!==void 0){const n=x_();return e??(t?`${t}-${n}`:n)}return lU(e,t)}function Ch(e){return Es(e,"base-ui")}const cU=m.forwardRef(function(t,n){const{render:r,className:i,style:a,id:o,...s}=t,{store:l}=Co(),c=Ch(o);return l.useSyncedValueWithCleanup("descriptionElementId",c),Ur("p",t,{ref:n,props:[{id:c},s]})}),uU=[];function x0(e){m.useEffect(e,uU)}const oc=0;class na{static create(){return new na}currentId=oc;start(t,n){this.clear(),this.currentId=setTimeout(()=>{this.currentId=oc,n()},t)}isStarted(){return this.currentId!==oc}clear=()=>{this.currentId!==oc&&(clearTimeout(this.currentId),this.currentId=oc)};disposeEffect=()=>this.clear}function Fr(){const e=cr(na.create).current;return x0(e.disposeEffect),e}const Fl=typeof navigator<"u",ng=dU(),wA=pU(),kA=fU(),_A=typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter:none"),SA=ng.platform==="MacIntel"&&ng.maxTouchPoints>1?!0:/iP(hone|ad|od)|iOS/.test(ng.platform),EA=Fl&&/apple/i.test(navigator.vendor),Wv=Fl&&/android/i.test(wA)||/android/i.test(kA),CA=Fl&&wA.toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints,jA=kA.includes("jsdom/");function dU(){if(!Fl)return{platform:"",maxTouchPoints:-1};const e=navigator.userAgentData;return e?.platform?{platform:e.platform,maxTouchPoints:navigator.maxTouchPoints}:{platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??-1}}function fU(){if(!Fl)return"";const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(({brand:t,version:n})=>`${t}/${n}`).join(" "):navigator.userAgent}function pU(){if(!Fl)return"";const e=navigator.userAgentData;return e?.platform?e.platform:navigator.platform??""}function Mr(e){e.preventDefault(),e.stopPropagation()}function hU(e){return"nativeEvent"in e}function PA(e){return e.pointerType===""&&e.isTrusted?!0:Wv&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function NA(e){return jA?!1:!Wv&&e.width===0&&e.height===0||Wv&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType==="mouse"||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType==="touch"}function su(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}function TA(e){const t=e.type;return t==="click"||t==="mousedown"||t==="keydown"||t==="keyup"}function mU(e,t){return t!=null&&!su(t)?0:typeof e=="function"?e():e}function Hv(e,t,n){const r=mU(e,n);return typeof r=="number"?r:r?.[t]}function b_(e){return typeof e=="function"?e():e}function OA(e,t){return t||e==="click"||e==="mousedown"}function ot(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function Gi(...e){return()=>{for(let t=0;t<e.length;t+=1){const n=e[t];n&&n()}}}function Fn(e){const t=cr(gU,e).current;return t.next=e,Ge(t.effect),t}function gU(e){const t={current:e,next:e,effect:()=>{t.current=t.next}};return t}const _d=null;class yU{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=t=>{this.isScheduled=!1;const n=this.callbacks,r=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,r>0)for(let i=0;i<n.length;i+=1)n[i]?.(t)};request(t){const n=this.nextId;return this.nextId+=1,this.callbacks.push(t),this.callbacksCount+=1,!this.isScheduled&&(requestAnimationFrame(this.tick),this.isScheduled=!0),n}cancel(t){const n=t-this.startId;n<0||n>=this.callbacks.length||(this.callbacks[n]=null,this.callbacksCount-=1)}}const Sd=new yU;class Bi{static create(){return new Bi}static request(t){return Sd.request(t)}static cancel(t){return Sd.cancel(t)}currentId=_d;request(t){this.cancel(),this.currentId=Sd.request(()=>{this.currentId=_d,t()})}cancel=()=>{this.currentId!==_d&&(Sd.cancel(this.currentId),this.currentId=_d)};disposeEffect=()=>this.cancel}function b0(){const e=cr(Bi.create).current;return x0(e.disposeEffect),e}function ut(e){return e?.ownerDocument||document}const vU={clipPath:"inset(50%)",overflow:"hidden",whiteSpace:"nowrap",border:0,padding:0,width:1,height:1,margin:-1},xU={...vU,position:"fixed",top:0,left:0},Nl=m.forwardRef(function(t,n){const[r,i]=m.useState();Ge(()=>{EA&&i("button")},[]);const a={tabIndex:0,role:r};return f.jsx("span",{...t,ref:n,style:xU,"aria-hidden":r?void 0:!0,...a,"data-base-ui-focus-guard":""})}),Uv="data-base-ui-focusable",AA="active",RA="selected",MA="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])",go="ArrowLeft",yo="ArrowRight",w0="ArrowUp",$u="ArrowDown";function Qr(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function Qe(e,t){if(!e||!t)return!1;const n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&jl(n)){let r=t;for(;r;){if(e===r)return!0;r=r.parentNode||r.host}}return!1}function wr(e){return"composedPath"in e?e.composedPath()[0]:e.target}function rp(e,t){if(!st(e))return!1;const n=e;if(t.hasElement(n))return!n.hasAttribute("data-trigger-disabled");for(const[,r]of t.entries())if(Qe(r,n))return!r.hasAttribute("data-trigger-disabled");return!1}function hi(e,t){if(t==null)return!1;if("composedPath"in e)return e.composedPath().includes(t);const n=e;return n.target!=null&&t.contains(n.target)}function bU(e){return e.matches("html,body")}function jh(e){return Rt(e)&&e.matches(MA)}function wU(e){return e?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${MA}`)!=null}function Vv(e){return e?e.getAttribute("role")==="combobox"&&jh(e):!1}function kU(e){if(!e||jA)return!0;try{return e.matches(":focus-visible")}catch{return!0}}function ip(e){return e?e.hasAttribute(Uv)?e:e.querySelector(`[${Uv}]`)||e:null}const _U=["top","right","bottom","left"],Tl=Math.min,Ir=Math.max,ap=Math.round,Qo=Math.floor,Yi=e=>({x:e,y:e}),SU={left:"right",right:"left",bottom:"top",top:"bottom"};function qv(e,t,n){return Ir(e,Tl(t,n))}function Ra(e,t){return typeof e=="function"?e(t):e}function kr(e){return e.split("-")[0]}function Po(e){return e.split("-")[1]}function k0(e){return e==="x"?"y":"x"}function _0(e){return e==="y"?"height":"width"}function ei(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function S0(e){return k0(ei(e))}function EU(e,t,n){n===void 0&&(n=!1);const r=Po(e),i=S0(e),a=_0(i);let o=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[a]>t.floating[a]&&(o=op(o)),[o,op(o)]}function CU(e){const t=op(e);return[Kv(e),t,Kv(t)]}function Kv(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const w_=["left","right"],k_=["right","left"],jU=["top","bottom"],PU=["bottom","top"];function NU(e,t,n){switch(e){case"top":case"bottom":return n?t?k_:w_:t?w_:k_;case"left":case"right":return t?jU:PU;default:return[]}}function TU(e,t,n,r){const i=Po(e);let a=NU(kr(e),n==="start",r);return i&&(a=a.map(o=>o+"-"+i),t&&(a=a.concat(a.map(Kv)))),a}function op(e){const t=kr(e);return SU[t]+e.slice(t.length)}function OU(e){return{top:0,right:0,bottom:0,left:0,...e}}function IA(e){return typeof e!="number"?OU(e):{top:e,right:e,bottom:e,left:e}}function sp(e){const{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function Ed(e,t,n){return Math.floor(e/t)!==n}function lp(e,t){return t<0||t>=e.length}function rg(e,t){return er(e.current,{disabledIndices:t})}function __(e,t){return er(e.current,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function er(e,{startingIndex:t=-1,decrement:n=!1,disabledIndices:r,amount:i=1}={}){let a=t;do a+=n?-i:i;while(a>=0&&a<=e.length-1&&fl(e,a,r));return a}function AU(e,{event:t,orientation:n,loopFocus:r,onLoop:i,rtl:a,cols:o,disabledIndices:s,minIndex:l,maxIndex:c,prevIndex:d,stopEvent:u=!1}){let p=d,h;if(t.key===w0?h="up":t.key===$u&&(h="down"),h){const y=[],g=[];let x=!1,v=0;{let j=null,T=-1;e.forEach((A,R)=>{if(A==null)return;v+=1;const D=A.closest('[role="row"]');D&&(x=!0),(D!==j||T===-1)&&(j=D,T+=1,y[T]=[]),y[T].push(R),g[R]=T})}let b=!1,w=0;if(x)for(const j of y){const T=j.length;T>w&&(w=T),T!==o&&(b=!0)}const _=b&&v<e.length,k=w||o,S=j=>{if(!b||d===-1)return;const T=g[d];if(T==null)return;const A=y[T].indexOf(d),R=j==="up"?-1:1;for(let D=T+R,M=0;M<y.length;M+=1,D+=R){if(D<0||D>=y.length){if(!r||_)return;if(D=D<0?y.length-1:0,i){const I=Math.min(A,y[D].length-1),L=y[D][I]??y[D][0],V=i(t,d,L);D=g[V]??D}}const O=y[D];for(let I=Math.min(A,O.length-1);I>=0;I-=1){const L=O[I];if(!fl(e,L,s))return L}}},E=j=>{if(!_||d===-1)return;const T=d%k,A=j==="up"?-k:k,R=c-c%k,D=Qo(c/k)+1;for(let M=d-T+A,O=0;O<D;O+=1,M+=A){if(M<0||M>c){if(!r)return;M=M<0?R:0}const I=Math.min(M+k-1,c);for(let L=Math.min(M+T,I);L>=M;L-=1)if(!fl(e,L,s))return L}};u&&Mr(t);const C=S(h)??E(h);if(C!==void 0)p=C;else if(d===-1)p=h==="up"?c:l;else if(p=er(e,{startingIndex:d,amount:k,decrement:h==="up",disabledIndices:s}),r){if(h==="up"&&(d-k<l||p<0)){const j=d%k,T=c%k,A=c-(T-j);T===j?p=c:p=T>j?A:A-k,i&&(p=i(t,d,p))}h==="down"&&d+k>c&&(p=er(e,{startingIndex:d%k-k,amount:k,disabledIndices:s}),i&&(p=i(t,d,p)))}lp(e,p)&&(p=d)}if(n==="both"){const y=Qo(d/o);t.key===(a?go:yo)&&(u&&Mr(t),d%o!==o-1?(p=er(e,{startingIndex:d,disabledIndices:s}),r&&Ed(p,o,y)&&(p=er(e,{startingIndex:d-d%o-1,disabledIndices:s}),i&&(p=i(t,d,p)))):r&&(p=er(e,{startingIndex:d-d%o-1,disabledIndices:s}),i&&(p=i(t,d,p))),Ed(p,o,y)&&(p=d)),t.key===(a?yo:go)&&(u&&Mr(t),d%o!==0?(p=er(e,{startingIndex:d,decrement:!0,disabledIndices:s}),r&&Ed(p,o,y)&&(p=er(e,{startingIndex:d+(o-d%o),decrement:!0,disabledIndices:s}),i&&(p=i(t,d,p)))):r&&(p=er(e,{startingIndex:d+(o-d%o),decrement:!0,disabledIndices:s}),i&&(p=i(t,d,p))),Ed(p,o,y)&&(p=d));const g=Qo(c/o)===y;lp(e,p)&&(r&&g?(p=t.key===(a?yo:go)?c:er(e,{startingIndex:d-d%o-1,disabledIndices:s}),i&&(p=i(t,d,p))):p=d)}return p}function RU(e,t,n){const r=[];let i=0;return e.forEach(({width:a,height:o},s)=>{let l=!1;for(;!l;){const c=[];for(let d=0;d<a;d+=1)for(let u=0;u<o;u+=1)c.push(i+d+u*t);i%t+a<=t&&c.every(d=>r[d]==null)?(c.forEach(d=>{r[d]=s}),l=!0):i+=1}}),[...r]}function MU(e,t,n,r,i){if(e===-1)return-1;const a=n.indexOf(e),o=t[e];switch(i){case"tl":return a;case"tr":return o?a+o.width-1:a;case"bl":return o?a+(o.height-1)*r:a;case"br":return n.lastIndexOf(e);default:return-1}}function IU(e,t){return t.flatMap((n,r)=>e.includes(n)?[r]:[])}function fl(e,t,n){if(typeof n=="function"?n(t):n?.includes(t)??!1)return!0;const i=e[t];return i?Ph(i)?!n&&(i.hasAttribute("disabled")||i.getAttribute("aria-disabled")==="true"):!0:!1}function DU(e){return e.visibility==="hidden"||e.visibility==="collapse"}function Ph(e,t=e?Pr(e):null){return!e||!e.isConnected||!t||DU(t)?!1:typeof e.checkVisibility=="function"?e.checkVisibility():t.display!=="none"&&t.display!=="contents"}const LU='a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]';function $U(e){const t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;const n=e.getRootNode();return jl(n)?n.host:null}function Gv(e){for(const t of Array.from(e.children))if(Xn(t)==="summary")return t;return null}function zU(e,t){const n=Gv(t);return!!n&&(e===n||Qe(n,e))}function DA(e){const t=e?Xn(e):"";return e!=null&&e.matches(LU)&&(t!=="summary"||e.parentElement!=null&&Xn(e.parentElement)==="details"&&Gv(e.parentElement)===e)&&(t!=="details"||Gv(e)==null)&&(t!=="input"||e.type!=="hidden")}function LA(e){if(!DA(e)||!e.isConnected||e.matches(":disabled"))return!1;for(let t=e;t;t=$U(t)){const n=t!==e,r=Xn(t)==="slot";if(t.hasAttribute("inert")||n&&Xn(t)==="details"&&!t.open&&!zU(e,t)||t.hasAttribute("hidden")||!r&&!FU(t,n))return!1}return!0}function FU(e,t){const n=Pr(e);return t?n.display!=="none":Ph(e,n)}function $A(e){const t=e.tabIndex;if(t<0){const n=Xn(e);if(n==="details"||n==="audio"||n==="video"||Rt(e)&&e.isContentEditable)return 0}return t}function ig(e){if(Xn(e)!=="input")return null;const t=e;return t.type==="radio"&&t.name!==""?t:null}function BU(e,t){const n=ig(e);if(!n)return!0;const r=t.find(i=>{const a=ig(i);return a?.name===n.name&&a.form===n.form&&a.checked});return r?r===n:t.find(i=>{const a=ig(i);return a?.name===n.name&&a.form===n.form})===n}function zA(e){if(Rt(e)&&Xn(e)==="slot"){const t=e.assignedElements({flatten:!0});if(t.length>0)return t}return Rt(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function FA(e,t){zA(e).forEach(n=>{DA(n)&&t.push(n),FA(n,t)})}function BA(e,t,n){zA(e).forEach(r=>{Rt(r)&&r.matches(t)&&n.push(r),BA(r,t,n)})}function E0(e){return LA(e)&&$A(e)>=0}function WA(e){const t=[];return FA(e,t),t.filter(LA)}function zu(e){const t=WA(e);return t.filter(n=>$A(n)>=0&&BU(n,t))}function HA(e,t){const n=zu(e),r=n.length;if(r===0)return;const i=Qr(ut(e)),a=n.indexOf(i),o=a===-1?t===1?0:r-1:a+t;return n[o]}function C0(e){return HA(ut(e).body,1)||e}function UA(e){return HA(ut(e).body,-1)||e}function VA(e,t){if(!e)return null;const n=zu(ut(e).body),r=n.length;if(r===0)return null;const i=n.indexOf(e);if(i===-1)return null;const a=(i+t+r)%r;return n[a]}function WU(e){return VA(e,1)}function HU(e){return VA(e,-1)}function pl(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!Qe(n,r)}function UU(e){zu(e).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function S_(e){const t=[];BA(e,"[data-tabindex]",t),t.forEach(n=>{const r=n.dataset.tabindex;delete n.dataset.tabindex,r?n.setAttribute("tabindex",r):n.removeAttribute("tabindex")})}function Xi(e,t,n=!0){return e.filter(i=>i.parentId===t).flatMap(i=>[...!n||i.context?.open?[i]:[],...Xi(e,i.id,n)])}function E_(e,t){let n=[],r=e.find(i=>i.id===t)?.parentId;for(;r;){const i=e.find(a=>a.id===r);r=i?.parentId,i&&(n=n.concat(i))}return n}function lu(e){return`data-base-ui-${e}`}let Cd=0;function jf(e,t={}){const{preventScroll:n=!1,cancelPrevious:r=!0,sync:i=!1}=t;r&&cancelAnimationFrame(Cd);const a=()=>e?.focus({preventScroll:n});if(i)return a(),d0;const o=requestAnimationFrame(a);return Cd=o,()=>{Cd===o&&(cancelAnimationFrame(o),Cd=0)}}const ag={inert:new WeakMap,"aria-hidden":new WeakMap},C_="data-base-ui-inert",Yv={inert:new WeakSet,"aria-hidden":new WeakSet};let sc=new WeakMap,og=0;function VU(e){return Yv[e]}function qA(e){return e?jl(e)?e.host:qA(e.parentNode):null}const sg=(e,t)=>t.map(n=>{if(e.contains(n))return n;const r=qA(n);return e.contains(r)?r:null}).filter(n=>n!=null),j_=e=>{const t=new Set;return e.forEach(n=>{let r=n;for(;r&&!t.has(r);)t.add(r),r=r.parentNode}),t},P_=(e,t,n)=>{const r=[],i=a=>{!a||n.has(a)||Array.from(a.children).forEach(o=>{Xn(o)!=="script"&&(t.has(o)?i(o):r.push(o))})};return i(e),r};function qU(e,t,n,r,{mark:i=!0,markerIgnoreElements:a=[]}){const o=r?"inert":n?"aria-hidden":null;let s=null,l=null;const c=sg(t,e),d=i?sg(t,a):[],u=new Set(d),p=i?P_(t,j_(c),new Set(c)).filter(g=>!u.has(g)):[],h=[],y=[];if(o){const g=ag[o],x=VU(o);l=x,s=g;const v=sg(t,Array.from(t.querySelectorAll("[aria-live]"))),b=c.concat(v);P_(t,j_(b),new Set(b)).forEach(_=>{const k=_.getAttribute(o),S=k!==null&&k!=="false",E=(g.get(_)||0)+1;g.set(_,E),h.push(_),E===1&&S&&x.add(_),S||_.setAttribute(o,o==="inert"?"":"true")})}return i&&p.forEach(g=>{const x=(sc.get(g)||0)+1;sc.set(g,x),y.push(g),x===1&&g.setAttribute(C_,"")}),og+=1,()=>{s&&h.forEach(g=>{const v=(s.get(g)||0)-1;s.set(g,v),v||(!l?.has(g)&&o&&g.removeAttribute(o),l?.delete(g))}),i&&y.forEach(g=>{const x=(sc.get(g)||0)-1;sc.set(g,x),x||g.removeAttribute(C_)}),og-=1,og||(ag.inert=new WeakMap,ag["aria-hidden"]=new WeakMap,Yv.inert=new WeakSet,Yv["aria-hidden"]=new WeakSet,sc=new WeakMap)}}function N_(e,t={}){const{ariaHidden:n=!1,inert:r=!1,mark:i=!0,markerIgnoreElements:a=[]}=t,o=ut(e[0]).body;return qU(e,o,n,r,{mark:i,markerIgnoreElements:a})}const KU=500,GU=500,YU={style:{transition:"none"}},XU="data-base-ui-click-trigger",ZU={fallbackAxisSide:"none"},QU={fallbackAxisSide:"end"},JU={clipPath:"inset(50%)",position:"fixed",top:0,left:0},KA=m.createContext(null),GA=()=>m.useContext(KA),e9=lu("portal");function t9(e={}){const{ref:t,container:n,componentProps:r=Bn,elementProps:i}=e,a=Es(),s=GA()?.portalNode,[l,c]=m.useState(null),[d,u]=m.useState(null),p=et(x=>{x!==null&&u(x)}),h=m.useRef(null);Ge(()=>{if(n===null){h.current&&(h.current=null,u(null),c(null));return}if(a==null)return;const x=(n&&(h0(n)?n:n.current))??s??document.body;if(x==null){h.current&&(h.current=null,u(null),c(null));return}h.current!==x&&(h.current=x,u(null),c(x))},[n,s,a]);const y=Ur("div",r,{ref:[t,p],props:[{id:a,[e9]:""},i]});return{portalNode:d,portalSubtree:l&&y?oi.createPortal(y,l):null}}const YA=m.forwardRef(function(t,n){const{children:r,container:i,className:a,render:o,renderGuards:s,style:l,...c}=t,{portalNode:d,portalSubtree:u}=t9({container:i,ref:n,componentProps:t,elementProps:c}),p=m.useRef(null),h=m.useRef(null),y=m.useRef(null),g=m.useRef(null),[x,v]=m.useState(null),b=m.useRef(!1),w=x?.modal,_=x?.open,k=typeof s=="boolean"?s:!!x&&!x.modal&&x.open&&!!d;m.useEffect(()=>{if(!d||w)return;function E(C){d&&C.relatedTarget&&pl(C)&&(C.type==="focusin"?b.current&&(S_(d),b.current=!1):(UU(d),b.current=!0))}return Gi(ot(d,"focusin",E,!0),ot(d,"focusout",E,!0))},[d,w]),m.useEffect(()=>{!d||_!==!1||(S_(d),b.current=!1)},[_,d]);const S=m.useMemo(()=>({beforeOutsideRef:p,afterOutsideRef:h,beforeInsideRef:y,afterInsideRef:g,portalNode:d,setFocusManagerState:v}),[d]);return f.jsxs(m.Fragment,{children:[u,f.jsxs(KA.Provider,{value:S,children:[k&&d&&f.jsx(Nl,{"data-type":"outside",ref:p,onFocus:E=>{if(pl(E,d))y.current?.focus();else{const C=x?x.domReference:null;UA(C)?.focus()}}}),k&&d&&f.jsx("span",{"aria-owns":d.id,style:JU}),d&&oi.createPortal(r,d),k&&d&&f.jsx(Nl,{"data-type":"outside",ref:h,onFocus:E=>{if(pl(E,d))g.current?.focus();else{const C=x?x.domReference:null;C0(C)?.focus(),x?.closeOnFocusOut&&x?.onOpenChange(!1,dt(Pl,E.nativeEvent))}}})]})]})});function XA(){const e=new Map;return{emit(t,n){e.get(t)?.forEach(r=>r(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){e.get(t)?.delete(n)}}}class j0{nodesRef={current:[]};events=XA();addNode(t){this.nodesRef.current.push(t)}removeNode(t){const n=this.nodesRef.current.findIndex(r=>r===t);n!==-1&&this.nodesRef.current.splice(n,1)}}const ZA=m.createContext(null),QA=m.createContext(null),$a=()=>m.useContext(ZA)?.id||null,No=e=>{const t=m.useContext(QA);return e??t};function JA(e){const t=Es(),n=No(e),r=$a();return Ge(()=>{if(!t)return;const i={id:t,parentId:r};return n?.addNode(i),()=>{n?.removeNode(i)}},[n,t,r]),t}function n9(e){const{children:t,id:n}=e,r=$a();return f.jsx(ZA.Provider,{value:m.useMemo(()=>({id:n,parentId:r}),[n,r]),children:t})}function r9(e){const{children:t,externalTree:n}=e,r=cr(()=>n??new j0).current;return f.jsx(QA.Provider,{value:r,children:t})}function ga(e){return e==null?e:"current"in e?e.current:e}function i9(e,t){const n=an(wr(e));return e instanceof n.KeyboardEvent?"keyboard":e instanceof n.FocusEvent?t||"keyboard":"pointerType"in e?e.pointerType||"keyboard":"touches"in e?"touch":e instanceof n.MouseEvent?t||(e.detail===0?"keyboard":"mouse"):""}const T_=20;let uo=[];function P0(){uo=uo.filter(e=>e.deref()?.isConnected)}function a9(e){P0(),e&&Xn(e)!=="body"&&(uo.push(new WeakRef(e)),uo.length>T_&&(uo=uo.slice(-T_)))}function lg(){return P0(),uo[uo.length-1]?.deref()}function o9(e){return e?E0(e)?e:zu(e)[0]||e:null}function O_(e,t){if(e.hasAttribute("tabindex")&&!e.hasAttribute("data-tabindex")||!t.current.includes("floating")&&!e.getAttribute("role")?.includes("dialog"))return;const r=WA(e).filter(a=>{const o=a.getAttribute("data-tabindex")||"";return E0(a)||a.hasAttribute("data-tabindex")&&!o.startsWith("-")}),i=e.getAttribute("tabindex");t.current.includes("floating")||r.length===0?i!=="0"&&e.setAttribute("tabindex","0"):(i!=="-1"||e.hasAttribute("data-tabindex")&&e.getAttribute("data-tabindex")!=="-1")&&(e.setAttribute("tabindex","-1"),e.setAttribute("data-tabindex","-1"))}function eR(e){const{context:t,children:n,disabled:r=!1,initialFocus:i=!0,returnFocus:a=!0,restoreFocus:o=!1,modal:s=!0,closeOnFocusOut:l=!0,openInteractionType:c="",nextFocusableElement:d,previousFocusableElement:u,beforeContentFocusGuardRef:p,externalTree:h,getInsideElements:y}=e,g="rootStore"in t?t.rootStore:t,x=g.useState("open"),v=g.useState("domReferenceElement"),b=g.useState("floatingElement"),{events:w,dataRef:_}=g.context,k=et(()=>_.current.floatingContext?.nodeId),S=i===!1,E=Vv(v)&&S,C=m.useRef(["content"]),j=Fn(i),T=Fn(a),A=Fn(c),R=No(h),D=GA(),M=m.useRef(!1),O=m.useRef(!1),I=m.useRef(!1),L=m.useRef(null),V=m.useRef(""),F=m.useRef(""),N=m.useRef(null),ee=m.useRef(null),Q=El(N,p,D?.beforeInsideRef),P=El(ee,D?.afterInsideRef),z=Fr(),$=Fr(),H=b0(),oe=D!=null,q=ip(b),X=et((G=q)=>G?zu(G):[]),te=et(()=>y?.().filter(G=>G!=null)??[]);m.useEffect(()=>{if(r||!s)return;function G(xe){xe.key==="Tab"&&Qe(q,Qr(ut(q)))&&X().length===0&&!E&&Mr(xe)}const be=ut(q);return ot(be,"keydown",G)},[r,v,q,s,C,E,X]),m.useEffect(()=>{if(r||!x)return;const G=ut(q);function be(){I.current=!1}function xe(ge){const _e=wr(ge),De=te(),ve=Qe(b,_e)||Qe(v,_e)||Qe(D?.portalNode,_e)||De.some(Le=>Le===_e||Qe(Le,_e));I.current=!ve,F.current=ge.pointerType||"keyboard",_e?.closest(`[${XU}]`)&&(O.current=!0)}function Ae(){F.current="keyboard"}return Gi(ot(G,"pointerdown",xe,!0),ot(G,"pointerup",be,!0),ot(G,"pointercancel",be,!0),ot(G,"keydown",Ae,!0))},[r,b,v,q,x,D,te]),m.useEffect(()=>{if(r||!l)return;const G=ut(q);function be(){O.current=!0,$.start(0,()=>{O.current=!1})}function xe(De){const ve=wr(De);E0(ve)&&(L.current=ve)}function Ae(De){const ve=De.relatedTarget,Le=De.currentTarget,le=wr(De);queueMicrotask(()=>{const pe=k(),K=g.context.triggerElements,se=te(),Se=ve?.hasAttribute(lu("focus-guard"))&&[N.current,ee.current,D?.beforeInsideRef.current,D?.afterInsideRef.current,D?.beforeOutsideRef.current,D?.afterOutsideRef.current,ga(u),ga(d)].includes(ve),Z=!(Qe(v,ve)||Qe(b,ve)||Qe(ve,b)||Qe(D?.portalNode,ve)||se.some(U=>U===ve||Qe(U,ve))||ve!=null&&K.hasElement(ve)||K.hasMatchingElement(U=>Qe(U,ve))||Se||R&&(Xi(R.nodesRef.current,pe).find(U=>Qe(U.context?.elements.floating,ve)||Qe(U.context?.elements.domReference,ve))||E_(R.nodesRef.current,pe).find(U=>[U.context?.elements.floating,ip(U.context?.elements.floating)].includes(ve)||U.context?.elements.domReference===ve)));if(Le===v&&q&&O_(q,C),o&&Le!==v&&!Ph(le)&&Qr(G)===G.body){if(Rt(q)&&(q.focus(),o==="popup")){H.request(()=>{q.focus()});return}const U=X(),fe=L.current,we=(fe&&U.includes(fe)?fe:null)||U[U.length-1]||q;Rt(we)&&we.focus()}if(_.current.insideReactTree){_.current.insideReactTree=!1;return}(E||!s)&&ve&&Z&&!O.current&&(E||ve!==lg())&&(M.current=!0,g.setOpen(!1,dt(Pl,De)))})}function ge(){I.current||(_.current.insideReactTree=!0,z.start(0,()=>{_.current.insideReactTree=!1}))}const _e=Rt(v)?v:null;if(!(!b&&!_e))return Gi(_e&&ot(_e,"focusout",Ae),_e&&ot(_e,"pointerdown",be),b&&ot(b,"focusin",xe),b&&ot(b,"focusout",Ae),b&&D&&ot(b,"focusout",ge,!0))},[r,v,b,q,s,R,D,g,l,o,X,E,k,C,_,z,$,H,d,u,te]),m.useEffect(()=>{if(r||!b||!x)return;const G=Array.from(D?.portalNode?.querySelectorAll(`[${lu("portal")}]`)||[]),xe=(R?E_(R.nodesRef.current,k()):[]).find(Le=>Vv(Le.context?.elements.domReference||null))?.context?.elements.domReference,ge=[...[b,...G,N.current,ee.current,D?.beforeOutsideRef.current,D?.afterOutsideRef.current,...te()],xe,ga(u),ga(d),E?v:null].filter(Le=>Le!=null),_e=N_(ge,{ariaHidden:s||E,mark:!1}),De=[b,...G].filter(Le=>Le!=null),ve=N_(De);return()=>{ve(),_e()}},[x,r,v,b,s,C,D,E,R,k,d,u,te]),Ge(()=>{if(!x||r||!Rt(q))return;const G=ut(q),be=Qr(G);queueMicrotask(()=>{const xe=j.current,Ae=typeof xe=="function"?xe(A.current||""):xe;if(Ae===void 0||Ae===!1||Qe(q,be))return;let _e=null;const De=()=>(_e==null&&(_e=X(q)),_e[0]||q);let ve;Ae===!0||Ae===null?ve=De():ve=ga(Ae),ve=ve||De(),jf(ve,{preventScroll:ve===q})})},[r,x,q,S,X,j,A]),Ge(()=>{if(r||!q)return;const G=ut(q),be=Qr(G);a9(be);function xe(ge){if(ge.open||(V.current=i9(ge.nativeEvent,F.current)),ge.reason===gr&&ge.nativeEvent.type==="mouseleave"&&(M.current=!0),ge.reason===y0)if(ge.nested)M.current=!1;else if(PA(ge.nativeEvent)||NA(ge.nativeEvent))M.current=!1;else{let _e=!1;ut(q).createElement("div").focus({get preventScroll(){return _e=!0,!1}}),_e?M.current=!1:M.current=!0}}w.on("openchange",xe);function Ae(){const ge=T.current;let _e=typeof ge=="function"?ge(V.current):ge;if(_e===void 0||_e===!1)return null;if(_e===null&&(_e=!0),typeof _e=="boolean"){const ve=v||lg();return ve&&ve.isConnected?ve:null}const De=v||lg();return ga(_e)||De||null}return()=>{w.off("openchange",xe);const ge=Qr(G),_e=te(),De=Qe(b,ge)||_e.some(le=>le===ge||Qe(le,ge))||R&&Xi(R.nodesRef.current,k(),!1).some(le=>Qe(le.context?.elements.floating,ge)),ve=T.current,Le=Ae();queueMicrotask(()=>{const le=o9(Le),pe=typeof ve!="boolean";ve&&!M.current&&Rt(le)&&(!(!pe&&le!==ge&&ge!==G.body)||De)&&le.focus({preventScroll:!0}),M.current=!1})}},[r,b,q,T,_,w,R,v,k,te]),Ge(()=>{if(!_A||x||!b)return;const G=Qr(ut(b));!Rt(G)||!jh(G)||Qe(b,G)&&G.blur()},[x,b]),Ge(()=>{if(!(r||!D))return D.setFocusManagerState({modal:s,closeOnFocusOut:l,open:x,onOpenChange:g.setOpen,domReference:v}),()=>{D.setFocusManagerState(null)}},[r,D,s,x,g,l,v]),Ge(()=>{if(!(r||!q))return O_(q,C),()=>{queueMicrotask(P0)}},[r,q,C]);const ue=!r&&(s?!E:!0)&&(oe||s);return f.jsxs(m.Fragment,{children:[ue&&f.jsx(Nl,{"data-type":"inside",ref:Q,onFocus:G=>{if(s){const be=X();jf(be[be.length-1])}else D?.portalNode&&(M.current=!1,pl(G,D.portalNode)?C0(v)?.focus():ga(u??D.beforeOutsideRef)?.focus())}}),n,ue&&f.jsx(Nl,{"data-type":"inside",ref:P,onFocus:G=>{s?jf(X()[0]):D?.portalNode&&(l&&(M.current=!0),pl(G,D.portalNode)?UA(v)?.focus():ga(d??D.afterOutsideRef)?.focus())}})]})}function s9(e,t={}){const n="rootStore"in e?e.rootStore:e,r=n.context.dataRef,{enabled:i=!0,event:a="click",toggle:o=!0,ignoreMouse:s=!1,stickIfOpen:l=!0,touchOpenDelay:c=0,reason:d=ou}=t,u=m.useRef(void 0),p=b0(),h=Fr(),y=m.useMemo(()=>({onPointerDown(g){u.current=g.pointerType},onMouseDown(g){const x=u.current,v=g.nativeEvent,b=n.select("open");if(g.button!==0||a==="click"||su(x,!0)&&s)return;const w=r.current.openEvent,_=w?.type,k=n.select("domReferenceElement")!==g.currentTarget,S=b&&k||!(b&&o&&(!(w&&l)||_==="click"||_==="mousedown")),E=wr(v);if(jh(E)){const j=dt(d,v,E);S&&x==="touch"&&c>0?h.start(c,()=>{n.setOpen(!0,j)}):n.setOpen(S,j);return}const C=g.currentTarget;p.request(()=>{const j=dt(d,v,C);S&&x==="touch"&&c>0?h.start(c,()=>{n.setOpen(!0,j)}):n.setOpen(S,j)})},onClick(g){if(a==="mousedown-only")return;const x=u.current;if(a==="mousedown"&&x){u.current=void 0;return}if(su(x,!0)&&s)return;const v=n.select("open"),b=r.current.openEvent,w=n.select("domReferenceElement")!==g.currentTarget,_=v&&w||!(v&&o&&(!(b&&l)||TA(b))),k=dt(d,g.nativeEvent,g.currentTarget);_&&x==="touch"&&c>0?h.start(c,()=>{n.setOpen(!0,k)}):n.setOpen(_,k)},onKeyDown(){u.current=void 0}}),[r,a,s,n,l,o,p,h,c,d]);return m.useMemo(()=>i?{reference:y}:Bn,[i,y])}const l9={intentional:"onClick",sloppy:"onPointerDown"};function c9(){return!1}function u9(e){return{escapeKey:typeof e=="boolean"?e:e?.escapeKey??!1,outsidePress:typeof e=="boolean"?e:e?.outsidePress??!0}}function tR(e,t={}){const n="rootStore"in e?e.rootStore:e,r=n.useState("open"),i=n.useState("floatingElement"),{dataRef:a}=n.context,{enabled:o=!0,escapeKey:s=!0,outsidePress:l=!0,outsidePressEvent:c="sloppy",referencePress:d=c9,referencePressEvent:u="sloppy",bubbles:p,externalTree:h}=t,y=No(h),g=et(typeof l=="function"?l:()=>!1),x=typeof l=="function"?g:l,v=x!==!1,b=et(()=>c),w=m.useRef(!1),_=m.useRef(!1),k=m.useRef(!1),{escapeKey:S,outsidePress:E}=u9(p),C=m.useRef(null),j=Fr(),T=Fr(),A=et(()=>{T.clear(),a.current.insideReactTree=!1}),R=m.useRef(!1),D=m.useRef(""),M=et(d),O=et(ee=>{if(!r||!o||!s||ee.key!=="Escape"||R.current)return;const Q=a.current.floatingContext?.nodeId,P=y?Xi(y.nodesRef.current,Q):[];if(!S&&P.length>0){let H=!0;if(P.forEach(oe=>{oe.context?.open&&!oe.context.dataRef.current.__escapeKeyBubbles&&(H=!1)}),!H)return}const z=hU(ee)?ee.nativeEvent:ee,$=dt(v0,z);n.setOpen(!1,$),!S&&!$.isPropagationAllowed&&ee.stopPropagation()}),I=et(()=>{a.current.insideReactTree=!0,T.start(0,A)});m.useEffect(()=>{if(!r||!o)return;a.current.__escapeKeyBubbles=S,a.current.__outsidePressBubbles=E;const ee=new na,Q=new na;function P(){ee.clear(),R.current=!0}function z(){ee.start(_h()?5:0,()=>{R.current=!1})}function $(){k.current=!0,Q.start(0,()=>{k.current=!1})}function H(){w.current=!1,_.current=!1}function oe(){const K=D.current,se=K==="pen"||!K?"mouse":K,Se=b(),Z=typeof Se=="function"?Se():Se;return typeof Z=="string"?Z:Z[se]}function q(K){const se=oe();return se==="intentional"&&K.type!=="click"||se==="sloppy"&&K.type==="click"}function X(K){const se=a.current.floatingContext?.nodeId,Se=y&&Xi(y.nodesRef.current,se).some(Z=>hi(K,Z.context?.elements.floating));return hi(K,n.select("floatingElement"))||hi(K,n.select("domReferenceElement"))||Se}function te(K){if(q(K)){A();return}if(a.current.insideReactTree){A();return}const se=wr(K),Se=`[${lu("inert")}]`,Z=st(se)?se.getRootNode():null,U=Array.from((jl(Z)?Z:ut(n.select("floatingElement"))).querySelectorAll(Se)),fe=n.context.triggerElements;if(se&&(fe.hasElement(se)||fe.hasMatchingElement(Ne=>Qe(Ne,se))))return;let we=st(se)?se:null;for(;we&&!Ki(we);){const Ne=ta(we);if(Ki(Ne)||!st(Ne))break;we=Ne}if(U.length&&st(se)&&!bU(se)&&!Qe(se,n.select("floatingElement"))&&U.every(Ne=>!Qe(we,Ne)))return;if(Rt(se)&&!("touches"in K)){const Ne=Ki(se),nt=Pr(se),xt=/auto|scroll/,fn=Ne||xt.test(nt.overflowX),Nt=Ne||xt.test(nt.overflowY),sn=fn&&se.clientWidth>0&&se.scrollWidth>se.clientWidth,tt=Nt&&se.clientHeight>0&&se.scrollHeight>se.clientHeight,wt=nt.direction==="rtl",pn=tt&&(wt?K.offsetX<=se.offsetWidth-se.clientWidth:K.offsetX>se.clientWidth),hn=sn&&K.offsetY>se.clientHeight;if(pn||hn)return}if(X(K))return;if(oe()==="intentional"&&k.current){Q.clear(),k.current=!1;return}if(typeof x=="function"&&!x(K))return;const Re=a.current.floatingContext?.nodeId,Ee=y?Xi(y.nodesRef.current,Re):[];if(Ee.length>0){let Ne=!0;if(Ee.forEach(nt=>{nt.context?.open&&!nt.context.dataRef.current.__outsidePressBubbles&&(Ne=!1)}),!Ne)return}n.setOpen(!1,dt(y0,K)),A()}function ue(K){oe()!=="sloppy"||K.pointerType==="touch"||!n.select("open")||!o||hi(K,n.select("floatingElement"))||hi(K,n.select("domReferenceElement"))||te(K)}function G(K){if(oe()!=="sloppy"||!n.select("open")||!o||hi(K,n.select("floatingElement"))||hi(K,n.select("domReferenceElement")))return;const se=K.touches[0];se&&(C.current={startTime:Date.now(),startX:se.clientX,startY:se.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},j.start(1e3,()=>{C.current&&(C.current.dismissOnTouchEnd=!1,C.current.dismissOnMouseDown=!1)}))}function be(K,se){const Se=wr(K);if(!Se)return;const Z=ot(Se,K.type,()=>{se(K),Z()})}function xe(K){D.current="touch",be(K,G)}function Ae(K){j.clear(),K.type==="pointerdown"&&(D.current=K.pointerType),!(K.type==="mousedown"&&C.current&&!C.current.dismissOnMouseDown)&&be(K,se=>{se.type==="pointerdown"?ue(se):te(se)})}function ge(K){if(!w.current)return;const se=_.current;if(H(),oe()==="intentional"){if(K.type==="pointercancel"){se&&$();return}if(!X(K)){if(se){$();return}typeof x=="function"&&!x(K)||(Q.clear(),k.current=!0,A())}}}function _e(K){if(oe()!=="sloppy"||!C.current||hi(K,n.select("floatingElement"))||hi(K,n.select("domReferenceElement")))return;const se=K.touches[0];if(!se)return;const Se=Math.abs(se.clientX-C.current.startX),Z=Math.abs(se.clientY-C.current.startY),U=Math.sqrt(Se*Se+Z*Z);U>5&&(C.current.dismissOnTouchEnd=!0),U>10&&(te(K),j.clear(),C.current=null)}function De(K){be(K,_e)}function ve(K){oe()!=="sloppy"||!C.current||hi(K,n.select("floatingElement"))||hi(K,n.select("domReferenceElement"))||(C.current.dismissOnTouchEnd&&te(K),j.clear(),C.current=null)}function Le(K){be(K,ve)}const le=ut(i),pe=Gi(s&&Gi(ot(le,"keydown",O),ot(le,"compositionstart",P),ot(le,"compositionend",z)),v&&Gi(ot(le,"click",Ae,!0),ot(le,"pointerdown",Ae,!0),ot(le,"pointerup",ge,!0),ot(le,"pointercancel",ge,!0),ot(le,"mousedown",Ae,!0),ot(le,"mouseup",ge,!0),ot(le,"touchstart",xe,!0),ot(le,"touchmove",De,!0),ot(le,"touchend",Le,!0)));return()=>{pe(),ee.clear(),Q.clear(),H(),k.current=!1}},[a,i,s,v,x,r,o,S,E,O,A,b,y,n,j]),m.useEffect(A,[x,A]);const L=m.useMemo(()=>({onKeyDown:O,[l9[u]]:ee=>{M()&&n.setOpen(!1,dt(ou,ee.nativeEvent))},...u!=="intentional"&&{onClick(ee){M()&&n.setOpen(!1,dt(ou,ee.nativeEvent))}}}),[O,n,u,M]),V=et(ee=>{if(!r||!o||ee.button!==0)return;const Q=wr(ee.nativeEvent);Qe(n.select("floatingElement"),Q)&&(w.current||(w.current=!0,_.current=!1))}),F=et(ee=>{!r||!o||(ee.defaultPrevented||ee.nativeEvent.defaultPrevented)&&w.current&&(_.current=!0)}),N=m.useMemo(()=>({onKeyDown:O,onPointerDown:F,onMouseDown:F,onClickCapture:I,onMouseDownCapture(ee){I(),V(ee)},onPointerDownCapture(ee){I(),V(ee)},onMouseUpCapture:I,onTouchEndCapture:I,onTouchMoveCapture:I}),[O,I,V,F]);return m.useMemo(()=>o?{reference:L,floating:N,trigger:L}:{},[o,L,N])}function A_(e,t,n){let{reference:r,floating:i}=e;const a=ei(t),o=S0(t),s=_0(o),l=kr(t),c=a==="y",d=r.x+r.width/2-i.width/2,u=r.y+r.height/2-i.height/2,p=r[s]/2-i[s]/2;let h;switch(l){case"top":h={x:d,y:r.y-i.height};break;case"bottom":h={x:d,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:u};break;case"left":h={x:r.x-i.width,y:u};break;default:h={x:r.x,y:r.y}}switch(Po(t)){case"start":h[o]-=p*(n&&c?-1:1);break;case"end":h[o]+=p*(n&&c?-1:1);break}return h}async function d9(e,t){var n;t===void 0&&(t={});const{x:r,y:i,platform:a,rects:o,elements:s,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:d="viewport",elementContext:u="floating",altBoundary:p=!1,padding:h=0}=Ra(t,e),y=IA(h),x=s[p?u==="floating"?"reference":"floating":u],v=sp(await a.getClippingRect({element:(n=await(a.isElement==null?void 0:a.isElement(x)))==null||n?x:x.contextElement||await(a.getDocumentElement==null?void 0:a.getDocumentElement(s.floating)),boundary:c,rootBoundary:d,strategy:l})),b=u==="floating"?{x:r,y:i,width:o.floating.width,height:o.floating.height}:o.reference,w=await(a.getOffsetParent==null?void 0:a.getOffsetParent(s.floating)),_=await(a.isElement==null?void 0:a.isElement(w))?await(a.getScale==null?void 0:a.getScale(w))||{x:1,y:1}:{x:1,y:1},k=sp(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:b,offsetParent:w,strategy:l}):b);return{top:(v.top-k.top+y.top)/_.y,bottom:(k.bottom-v.bottom+y.bottom)/_.y,left:(v.left-k.left+y.left)/_.x,right:(k.right-v.right+y.right)/_.x}}const f9=50,p9=async(e,t,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:d9},l=await(o.isRTL==null?void 0:o.isRTL(t));let c=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:d,y:u}=A_(c,r,l),p=r,h=0;const y={};for(let g=0;g<a.length;g++){const x=a[g];if(!x)continue;const{name:v,fn:b}=x,{x:w,y:_,data:k,reset:S}=await b({x:d,y:u,initialPlacement:r,placement:p,strategy:i,middlewareData:y,rects:c,platform:s,elements:{reference:e,floating:t}});d=w??d,u=_??u,y[v]={...y[v],...k},S&&h<f9&&(h++,typeof S=="object"&&(S.placement&&(p=S.placement),S.rects&&(c=S.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):S.rects),{x:d,y:u}=A_(c,p,l)),g=-1)}return{x:d,y:u,placement:p,strategy:i,middlewareData:y}},h9=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:i,middlewareData:a,rects:o,initialPlacement:s,platform:l,elements:c}=t,{mainAxis:d=!0,crossAxis:u=!0,fallbackPlacements:p,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:y="none",flipAlignment:g=!0,...x}=Ra(e,t);if((n=a.arrow)!=null&&n.alignmentOffset)return{};const v=kr(i),b=ei(s),w=kr(s)===s,_=await(l.isRTL==null?void 0:l.isRTL(c.floating)),k=p||(w||!g?[op(s)]:CU(s)),S=y!=="none";!p&&S&&k.push(...TU(s,g,y,_));const E=[s,...k],C=await l.detectOverflow(t,x),j=[];let T=((r=a.flip)==null?void 0:r.overflows)||[];if(d&&j.push(C[v]),u){const M=EU(i,o,_);j.push(C[M[0]],C[M[1]])}if(T=[...T,{placement:i,overflows:j}],!j.every(M=>M<=0)){var A,R;const M=(((A=a.flip)==null?void 0:A.index)||0)+1,O=E[M];if(O&&(!(u==="alignment"?b!==ei(O):!1)||T.every(V=>ei(V.placement)===b?V.overflows[0]>0:!0)))return{data:{index:M,overflows:T},reset:{placement:O}};let I=(R=T.filter(L=>L.overflows[0]<=0).sort((L,V)=>L.overflows[1]-V.overflows[1])[0])==null?void 0:R.placement;if(!I)switch(h){case"bestFit":{var D;const L=(D=T.filter(V=>{if(S){const F=ei(V.placement);return F===b||F==="y"}return!0}).map(V=>[V.placement,V.overflows.filter(F=>F>0).reduce((F,N)=>F+N,0)]).sort((V,F)=>V[1]-F[1])[0])==null?void 0:D[0];L&&(I=L);break}case"initialPlacement":I=s;break}if(i!==I)return{reset:{placement:I}}}return{}}}};function R_(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function M_(e){return _U.some(t=>e[t]>=0)}const m9=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:i="referenceHidden",...a}=Ra(e,t);switch(i){case"referenceHidden":{const o=await r.detectOverflow(t,{...a,elementContext:"reference"}),s=R_(o,n.reference);return{data:{referenceHiddenOffsets:s,referenceHidden:M_(s)}}}case"escaped":{const o=await r.detectOverflow(t,{...a,altBoundary:!0}),s=R_(o,n.floating);return{data:{escapedOffsets:s,escaped:M_(s)}}}default:return{}}}}},nR=new Set(["left","top"]);async function g9(e,t){const{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=kr(n),s=Po(n),l=ei(n)==="y",c=nR.has(o)?-1:1,d=a&&l?-1:1,u=Ra(t,e);let{mainAxis:p,crossAxis:h,alignmentAxis:y}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return s&&typeof y=="number"&&(h=s==="end"?y*-1:y),l?{x:h*d,y:p*c}:{x:p*c,y:h*d}}const y9=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:i,y:a,placement:o,middlewareData:s}=t,l=await g9(t,e);return o===((n=s.offset)==null?void 0:n.placement)&&(r=s.arrow)!=null&&r.alignmentOffset?{}:{x:i+l.x,y:a+l.y,data:{...l,placement:o}}}}},v9=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:l={fn:v=>{let{x:b,y:w}=v;return{x:b,y:w}}},...c}=Ra(e,t),d={x:n,y:r},u=await a.detectOverflow(t,c),p=ei(kr(i)),h=k0(p);let y=d[h],g=d[p];if(o){const v=h==="y"?"top":"left",b=h==="y"?"bottom":"right",w=y+u[v],_=y-u[b];y=qv(w,y,_)}if(s){const v=p==="y"?"top":"left",b=p==="y"?"bottom":"right",w=g+u[v],_=g-u[b];g=qv(w,g,_)}const x=l.fn({...t,[h]:y,[p]:g});return{...x,data:{x:x.x-n,y:x.y-r,enabled:{[h]:o,[p]:s}}}}}},x9=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:l=!0,crossAxis:c=!0}=Ra(e,t),d={x:n,y:r},u=ei(i),p=k0(u);let h=d[p],y=d[u];const g=Ra(s,t),x=typeof g=="number"?{mainAxis:g,crossAxis:0}:{mainAxis:0,crossAxis:0,...g};if(l){const w=p==="y"?"height":"width",_=a.reference[p]-a.floating[w]+x.mainAxis,k=a.reference[p]+a.reference[w]-x.mainAxis;h<_?h=_:h>k&&(h=k)}if(c){var v,b;const w=p==="y"?"width":"height",_=nR.has(kr(i)),k=a.reference[u]-a.floating[w]+(_&&((v=o.offset)==null?void 0:v[u])||0)+(_?0:x.crossAxis),S=a.reference[u]+a.reference[w]+(_?0:((b=o.offset)==null?void 0:b[u])||0)-(_?x.crossAxis:0);y<k?y=k:y>S&&(y=S)}return{[p]:h,[u]:y}}}},b9=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:i,rects:a,platform:o,elements:s}=t,{apply:l=()=>{},...c}=Ra(e,t),d=await o.detectOverflow(t,c),u=kr(i),p=Po(i),h=ei(i)==="y",{width:y,height:g}=a.floating;let x,v;u==="top"||u==="bottom"?(x=u,v=p===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?"start":"end")?"left":"right"):(v=u,x=p==="end"?"top":"bottom");const b=g-d.top-d.bottom,w=y-d.left-d.right,_=Tl(g-d[x],b),k=Tl(y-d[v],w),S=!t.middlewareData.shift;let E=_,C=k;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(C=w),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(E=b),S&&!p){const T=Ir(d.left,0),A=Ir(d.right,0),R=Ir(d.top,0),D=Ir(d.bottom,0);h?C=y-2*(T!==0||A!==0?T+A:Ir(d.left,d.right)):E=g-2*(R!==0||D!==0?R+D:Ir(d.top,d.bottom))}await l({...t,availableWidth:C,availableHeight:E});const j=await o.getDimensions(s.floating);return y!==j.width||g!==j.height?{reset:{rects:!0}}:{}}}};function rR(e){const t=Pr(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=Rt(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=ap(n)!==a||ap(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function N0(e){return st(e)?e:e.contextElement}function hl(e){const t=N0(e);if(!Rt(t))return Yi(1);const n=t.getBoundingClientRect(),{width:r,height:i,$:a}=rR(t);let o=(a?ap(n.width):n.width)/r,s=(a?ap(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}const w9=Yi(0);function iR(e){const t=an(e);return!_h()||!t.visualViewport?w9:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function k9(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==an(e)?!1:t}function ds(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),a=N0(e);let o=Yi(1);t&&(r?st(r)&&(o=hl(r)):o=hl(e));const s=k9(a,n,r)?iR(a):Yi(0);let l=(i.left+s.x)/o.x,c=(i.top+s.y)/o.y,d=i.width/o.x,u=i.height/o.y;if(a){const p=an(a),h=r&&st(r)?an(r):r;let y=p,g=Bv(y);for(;g&&r&&h!==y;){const x=hl(g),v=g.getBoundingClientRect(),b=Pr(g),w=v.left+(g.clientLeft+parseFloat(b.paddingLeft))*x.x,_=v.top+(g.clientTop+parseFloat(b.paddingTop))*x.y;l*=x.x,c*=x.y,d*=x.x,u*=x.y,l+=w,c+=_,y=an(g),g=Bv(y)}}return sp({width:d,height:u,x:l,y:c})}function Nh(e,t){const n=Sh(e).scrollLeft;return t?t.left+n:ds(pa(e)).left+n}function aR(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Nh(e,n),i=n.top+t.scrollTop;return{x:r,y:i}}function _9(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e;const a=i==="fixed",o=pa(r),s=t?kh(t.floating):!1;if(r===o||s&&a)return n;let l={scrollLeft:0,scrollTop:0},c=Yi(1);const d=Yi(0),u=Rt(r);if((u||!u&&!a)&&((Xn(r)!=="body"||jo(o))&&(l=Sh(r)),u)){const h=ds(r);c=hl(r),d.x=h.x+r.clientLeft,d.y=h.y+r.clientTop}const p=o&&!u&&!a?aR(o,l):Yi(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+d.x+p.x,y:n.y*c.y-l.scrollTop*c.y+d.y+p.y}}function S9(e){return Array.from(e.getClientRects())}function E9(e){const t=pa(e),n=Sh(e),r=e.ownerDocument.body,i=Ir(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=Ir(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+Nh(e);const s=-n.scrollTop;return Pr(r).direction==="rtl"&&(o+=Ir(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}const I_=25;function C9(e,t){const n=an(e),r=pa(e),i=n.visualViewport;let a=r.clientWidth,o=r.clientHeight,s=0,l=0;if(i){a=i.width,o=i.height;const d=_h();(!d||d&&t==="fixed")&&(s=i.offsetLeft,l=i.offsetTop)}const c=Nh(r);if(c<=0){const d=r.ownerDocument,u=d.body,p=getComputedStyle(u),h=d.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,y=Math.abs(r.clientWidth-u.clientWidth-h);y<=I_&&(a-=y)}else c<=I_&&(a+=c);return{width:a,height:o,x:s,y:l}}function j9(e,t){const n=ds(e,!0,t==="fixed"),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=Rt(e)?hl(e):Yi(1),o=e.clientWidth*a.x,s=e.clientHeight*a.y,l=i*a.x,c=r*a.y;return{width:o,height:s,x:l,y:c}}function D_(e,t,n){let r;if(t==="viewport")r=C9(e,n);else if(t==="document")r=E9(pa(e));else if(st(t))r=j9(t,n);else{const i=iR(e);r={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return sp(r)}function oR(e,t){const n=ta(e);return n===t||!st(n)||Ki(n)?!1:Pr(n).position==="fixed"||oR(n,t)}function P9(e,t){const n=t.get(e);if(n)return n;let r=au(e,[],!1).filter(s=>st(s)&&Xn(s)!=="body"),i=null;const a=Pr(e).position==="fixed";let o=a?ta(e):e;for(;st(o)&&!Ki(o);){const s=Pr(o),l=m0(o);!l&&s.position==="fixed"&&(i=null),(a?!l&&!i:!l&&s.position==="static"&&!!i&&(i.position==="absolute"||i.position==="fixed")||jo(o)&&!l&&oR(e,o))?r=r.filter(d=>d!==o):i=s,o=ta(o)}return t.set(e,r),r}function N9(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const o=[...n==="clippingAncestors"?kh(t)?[]:P9(t,this._c):[].concat(n),r],s=D_(t,o[0],i);let l=s.top,c=s.right,d=s.bottom,u=s.left;for(let p=1;p<o.length;p++){const h=D_(t,o[p],i);l=Ir(h.top,l),c=Tl(h.right,c),d=Tl(h.bottom,d),u=Ir(h.left,u)}return{width:c-u,height:d-l,x:u,y:l}}function T9(e){const{width:t,height:n}=rR(e);return{width:t,height:n}}function O9(e,t,n){const r=Rt(t),i=pa(t),a=n==="fixed",o=ds(e,!0,a,t);let s={scrollLeft:0,scrollTop:0};const l=Yi(0);function c(){l.x=Nh(i)}if(r||!r&&!a)if((Xn(t)!=="body"||jo(i))&&(s=Sh(t)),r){const h=ds(t,!0,a,t);l.x=h.x+t.clientLeft,l.y=h.y+t.clientTop}else i&&c();a&&!r&&i&&c();const d=i&&!r&&!a?aR(i,s):Yi(0),u=o.left+s.scrollLeft-l.x-d.x,p=o.top+s.scrollTop-l.y-d.y;return{x:u,y:p,width:o.width,height:o.height}}function cg(e){return Pr(e).position==="static"}function L_(e,t){if(!Rt(e)||Pr(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return pa(e)===n&&(n=n.ownerDocument.body),n}function sR(e,t){const n=an(e);if(kh(e))return n;if(!Rt(e)){let i=ta(e);for(;i&&!Ki(i);){if(st(i)&&!cg(i))return i;i=ta(i)}return n}let r=L_(e,t);for(;r&&G8(r)&&cg(r);)r=L_(r,t);return r&&Ki(r)&&cg(r)&&!m0(r)?n:r||Z8(e)||n}const A9=async function(e){const t=this.getOffsetParent||sR,n=this.getDimensions,r=await n(e.floating);return{reference:O9(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function R9(e){return Pr(e).direction==="rtl"}const M9={convertOffsetParentRelativeRectToViewportRelativeRect:_9,getDocumentElement:pa,getClippingRect:N9,getOffsetParent:sR,getElementRects:A9,getClientRects:S9,getDimensions:T9,getScale:hl,isElement:st,isRTL:R9};function lR(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function I9(e,t){let n=null,r;const i=pa(e);function a(){var s;clearTimeout(r),(s=n)==null||s.disconnect(),n=null}function o(s,l){s===void 0&&(s=!1),l===void 0&&(l=1),a();const c=e.getBoundingClientRect(),{left:d,top:u,width:p,height:h}=c;if(s||t(),!p||!h)return;const y=Qo(u),g=Qo(i.clientWidth-(d+p)),x=Qo(i.clientHeight-(u+h)),v=Qo(d),w={rootMargin:-y+"px "+-g+"px "+-x+"px "+-v+"px",threshold:Ir(0,Tl(1,l))||1};let _=!0;function k(S){const E=S[0].intersectionRatio;if(E!==l){if(!_)return o();E?o(!1,E):r=setTimeout(()=>{o(!1,1e-7)},1e3)}E===1&&!lR(c,e.getBoundingClientRect())&&o(),_=!1}try{n=new IntersectionObserver(k,{...w,root:i.ownerDocument})}catch{n=new IntersectionObserver(k,w)}n.observe(e)}return o(!0),a}function $_(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:s=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,c=N0(e),d=i||a?[...c?au(c):[],...t?au(t):[]]:[];d.forEach(v=>{i&&v.addEventListener("scroll",n,{passive:!0}),a&&v.addEventListener("resize",n)});const u=c&&s?I9(c,n):null;let p=-1,h=null;o&&(h=new ResizeObserver(v=>{let[b]=v;b&&b.target===c&&h&&t&&(h.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var w;(w=h)==null||w.observe(t)})),n()}),c&&!l&&h.observe(c),t&&h.observe(t));let y,g=l?ds(e):null;l&&x();function x(){const v=ds(e);g&&!lR(g,v)&&n(),g=v,y=requestAnimationFrame(x)}return n(),()=>{var v;d.forEach(b=>{i&&b.removeEventListener("scroll",n),a&&b.removeEventListener("resize",n)}),u?.(),(v=h)==null||v.disconnect(),h=null,l&&cancelAnimationFrame(y)}}const D9=y9,L9=v9,$9=h9,z9=b9,F9=m9,B9=x9,W9=(e,t,n)=>{const r=new Map,i={platform:M9,...n},a={...i.platform,_c:r};return p9(e,t,{...i,platform:a})};var H9=typeof document<"u",U9=function(){},Pf=H9?m.useLayoutEffect:U9;function cp(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!cp(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){const a=i[r];if(!(a==="_owner"&&e.$$typeof)&&!cp(e[a],t[a]))return!1}return!0}return e!==e&&t!==t}function cR(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function z_(e,t){const n=cR(e);return Math.round(t*n)/n}function ug(e){const t=m.useRef(e);return Pf(()=>{t.current=e}),t}function V9(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:l,open:c}=e,[d,u]=m.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,h]=m.useState(r);cp(p,r)||h(r);const[y,g]=m.useState(null),[x,v]=m.useState(null),b=m.useCallback(V=>{V!==S.current&&(S.current=V,g(V))},[]),w=m.useCallback(V=>{V!==E.current&&(E.current=V,v(V))},[]),_=a||y,k=o||x,S=m.useRef(null),E=m.useRef(null),C=m.useRef(d),j=l!=null,T=ug(l),A=ug(i),R=ug(c),D=m.useCallback(()=>{if(!S.current||!E.current)return;const V={placement:t,strategy:n,middleware:p};A.current&&(V.platform=A.current),W9(S.current,E.current,V).then(F=>{const N={...F,isPositioned:R.current!==!1};M.current&&!cp(C.current,N)&&(C.current=N,oi.flushSync(()=>{u(N)}))})},[p,t,n,A,R]);Pf(()=>{c===!1&&C.current.isPositioned&&(C.current.isPositioned=!1,u(V=>({...V,isPositioned:!1})))},[c]);const M=m.useRef(!1);Pf(()=>(M.current=!0,()=>{M.current=!1}),[]),Pf(()=>{if(_&&(S.current=_),k&&(E.current=k),_&&k){if(T.current)return T.current(_,k,D);D()}},[_,k,D,T,j]);const O=m.useMemo(()=>({reference:S,floating:E,setReference:b,setFloating:w}),[b,w]),I=m.useMemo(()=>({reference:_,floating:k}),[_,k]),L=m.useMemo(()=>{const V={position:n,left:0,top:0};if(!I.floating)return V;const F=z_(I.floating,d.x),N=z_(I.floating,d.y);return s?{...V,transform:"translate("+F+"px, "+N+"px)",...cR(I.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:F,top:N}},[n,s,I.floating,d.x,d.y]);return m.useMemo(()=>({...d,update:D,refs:O,elements:I,floatingStyles:L}),[d,D,O,I,L])}const q9=(e,t)=>{const n=D9(e);return{name:n.name,fn:n.fn,options:[e,t]}},K9=(e,t)=>{const n=L9(e);return{name:n.name,fn:n.fn,options:[e,t]}},G9=(e,t)=>({fn:B9(e).fn,options:[e,t]}),Y9=(e,t)=>{const n=$9(e);return{name:n.name,fn:n.fn,options:[e,t]}},X9=(e,t)=>{const n=z9(e);return{name:n.name,fn:n.fn,options:[e,t]}},Z9=(e,t)=>{const n=F9(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ye=(e,t,n,r,i,a,...o)=>{if(o.length>0)throw new Error(fa(1));let s;if(e)s=e;else throw new Error("Missing arguments");return s};function Q9(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function J9(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!="object")throw new TypeError(t)}function e7(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(n=>typeof n=="function")){const n=e.map(r=>typeof r=="function"?`function ${r.name||"unnamed"}()`:typeof r).join(", ");throw new TypeError(`${t}[${n}]`)}}var F_=e=>Array.isArray(e)?e:[e];function t7(e){const t=Array.isArray(e[0])?e[0]:e;return e7(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function n7(e,t){const n=[],{length:r}=e;for(let i=0;i<r;i++)n.push(e[i].apply(null,t));return n}var r7=class{constructor(e){this.value=e}deref(){return this.value}},i7=typeof WeakRef<"u"?WeakRef:r7,a7=0,B_=1;function jd(){return{s:a7,v:void 0,o:null,p:null}}function uR(e,t={}){let n=jd();const{resultEqualityCheck:r}=t;let i,a=0;function o(){let s=n;const{length:l}=arguments;for(let u=0,p=l;u<p;u++){const h=arguments[u];if(typeof h=="function"||typeof h=="object"&&h!==null){let y=s.o;y===null&&(s.o=y=new WeakMap);const g=y.get(h);g===void 0?(s=jd(),y.set(h,s)):s=g}else{let y=s.p;y===null&&(s.p=y=new Map);const g=y.get(h);g===void 0?(s=jd(),y.set(h,s)):s=g}}const c=s;let d;if(s.s===B_)d=s.v;else if(d=e.apply(null,arguments),a++,r){const u=i?.deref?.()??i;u!=null&&r(u,d)&&(d=u,a!==0&&a--),i=typeof d=="object"&&d!==null||typeof d=="function"?new i7(d):d}return c.s=B_,c.v=d,d}return o.clearCache=()=>{n=jd(),o.resetResultsCount()},o.resultsCount=()=>a,o.resetResultsCount=()=>{a=0},o}function o7(e,...t){const n=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,r=(...i)=>{let a=0,o=0,s,l={},c=i.pop();typeof c=="object"&&(l=c,c=i.pop()),Q9(c,`createSelector expects an output function after the inputs, but received: [${typeof c}]`);const d={...n,...l},{memoize:u,memoizeOptions:p=[],argsMemoize:h=uR,argsMemoizeOptions:y=[]}=d,g=F_(p),x=F_(y),v=t7(i),b=u(function(){return a++,c.apply(null,arguments)},...g),w=h(function(){o++;const k=n7(v,arguments);return s=b.apply(null,k),s},...x);return Object.assign(w,{resultFunc:c,memoizedResultFunc:b,dependencies:v,dependencyRecomputations:()=>o,resetDependencyRecomputations:()=>{o=0},lastResult:()=>s,recomputations:()=>a,resetRecomputations:()=>{a=0},memoize:u,argsMemoize:h})};return Object.assign(r,{withTypes:()=>r}),r}var J=o7(uR),s7=Object.assign((e,t=J)=>{J9(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);const n=Object.keys(e),r=n.map(a=>e[a]);return t(r,(...a)=>a.reduce((o,s,l)=>(o[n[l]]=s,o),{}))},{withTypes:()=>s7}),dg={exports:{}},fg={};var W_;function l7(){if(W_)return fg;W_=1;var e=cb(),t=iO();function n(c,d){return c===d&&(c!==0||1/c===1/d)||c!==c&&d!==d}var r=typeof Object.is=="function"?Object.is:n,i=t.useSyncExternalStore,a=e.useRef,o=e.useEffect,s=e.useMemo,l=e.useDebugValue;return fg.useSyncExternalStoreWithSelector=function(c,d,u,p,h){var y=a(null);if(y.current===null){var g={hasValue:!1,value:null};y.current=g}else g=y.current;y=s(function(){function v(S){if(!b){if(b=!0,w=S,S=p(S),h!==void 0&&g.hasValue){var E=g.value;if(h(E,S))return _=E}return _=S}if(E=_,r(w,S))return E;var C=p(S);return h!==void 0&&h(E,C)?(w=S,E):(w=S,_=C)}var b=!1,w,_,k=u===void 0?null:u;return[function(){return v(d())},k===null?void 0:function(){return v(k())}]},[d,u,p,h]);var x=i(c,y[0],y[1]);return o(function(){g.hasValue=!0,g.value=x},[x]),l(x),x},fg}var H_;function c7(){return H_||(H_=1,dg.exports=l7()),dg.exports}var dR=c7();const Xv=[];let Zv;function u7(){return Zv}function d7(e){Xv.push(e)}function fR(e){const t=(n,r)=>{const i=cr(p7).current;let a;try{Zv=i;for(const o of Xv)o.before(i);a=e(n,r);for(const o of Xv)o.after(i);i.didInitialize=!0}finally{Zv=void 0}return a};return t.displayName=e.displayName||e.name,t}function f7(e){return m.forwardRef(fR(e))}function p7(){return{didInitialize:!1}}const h7=u0(19),m7=h7?y7:v7;function pR(e,t,n,r,i){return m7(e,t,n,r,i)}function g7(e,t,n,r,i){const a=m.useCallback(()=>t(e.getSnapshot(),n,r,i),[e,t,n,r,i]);return Mb.useSyncExternalStore(e.subscribe,a,a)}d7({before(e){e.syncIndex=0,e.didInitialize||(e.syncTick=1,e.syncHooks=[],e.didChangeStore=!0,e.getSnapshot=()=>{let t=!1;for(let n=0;n<e.syncHooks.length;n+=1){const r=e.syncHooks[n],i=r.selector(r.store.state,r.a1,r.a2,r.a3);(r.didChange||!Object.is(r.value,i))&&(t=!0,r.value=i,r.didChange=!1)}return t&&(e.syncTick+=1),e.syncTick})},after(e){e.syncHooks.length>0&&(e.didChangeStore&&(e.didChangeStore=!1,e.subscribe=t=>{const n=new Set;for(const i of e.syncHooks)n.add(i.store);const r=[];for(const i of n)r.push(i.subscribe(t));return()=>{for(const i of r)i()}}),Mb.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot))}});function y7(e,t,n,r,i){const a=u7();if(!a)return g7(e,t,n,r,i);const o=a.syncIndex;a.syncIndex+=1;let s;return a.didInitialize?(s=a.syncHooks[o],(s.store!==e||s.selector!==t||!Object.is(s.a1,n)||!Object.is(s.a2,r)||!Object.is(s.a3,i))&&(s.store!==e&&(a.didChangeStore=!0),s.store=e,s.selector=t,s.a1=n,s.a2=r,s.a3=i,s.didChange=!0)):(s={store:e,selector:t,a1:n,a2:r,a3:i,value:t(e.getSnapshot(),n,r,i),didChange:!1},a.syncHooks.push(s)),s.value}function v7(e,t,n,r,i){return dR.useSyncExternalStoreWithSelector(e.subscribe,e.getSnapshot,e.getSnapshot,a=>t(a,n,r,i))}class x7{constructor(t){this.state=t,this.listeners=new Set,this.updateTick=0}subscribe=t=>(this.listeners.add(t),()=>{this.listeners.delete(t)});getSnapshot=()=>this.state;setState(t){if(this.state===t)return;this.state=t,this.updateTick+=1;const n=this.updateTick;for(const r of this.listeners){if(n!==this.updateTick)return;r(t)}}update(t){for(const n in t)if(!Object.is(this.state[n],t[n])){this.setState({...this.state,...t});return}}set(t,n){Object.is(this.state[t],n)||this.setState({...this.state,[t]:n})}notifyAll(){const t={...this.state};this.setState(t)}use(t,n,r,i){return pR(this,t,n,r,i)}}class T0 extends x7{constructor(t,n={},r){super(t),this.context=n,this.selectors=r}useSyncedValue(t,n){m.useDebugValue(t),Ge(()=>{this.state[t]!==n&&this.set(t,n)},[t,n])}useSyncedValueWithCleanup(t,n){const r=this;Ge(()=>(r.state[t]!==n&&r.set(t,n),()=>{r.set(t,void 0)}),[r,t,n])}useSyncedValues(t){const n=this,r=Object.values(t);Ge(()=>{n.update(t)},[n,...r])}useControlledProp(t,n){m.useDebugValue(t);const r=n!==void 0;Ge(()=>{r&&!Object.is(this.state[t],n)&&super.setState({...this.state,[t]:n})},[t,n,r])}select(t,n,r,i){const a=this.selectors[t];return a(this.state,n,r,i)}useState(t,n,r,i){return m.useDebugValue(t),pR(this,this.selectors[t],n,r,i)}useContextCallback(t,n){m.useDebugValue(t);const r=et(n??d0);this.context[t]=r}useStateSetter(t){const n=m.useRef(void 0);return n.current===void 0&&(n.current=r=>{this.set(t,r)}),n.current}observe(t,n){let r;typeof t=="function"?r=t:r=this.selectors[t];let i=r(this.state);return n(i,i,this),this.subscribe(a=>{const o=r(a);if(!Object.is(i,o)){const s=i;i=o,n(o,s,this)}})}}const b7={open:Ye(e=>e.open),transitionStatus:Ye(e=>e.transitionStatus),domReferenceElement:Ye(e=>e.domReferenceElement),referenceElement:Ye(e=>e.positionReference??e.referenceElement),floatingElement:Ye(e=>e.floatingElement),floatingId:Ye(e=>e.floatingId)};class O0 extends T0{constructor(t){const{syncOnly:n,nested:r,onOpenChange:i,triggerElements:a,...o}=t;super({...o,positionReference:o.referenceElement,domReferenceElement:o.referenceElement},{onOpenChange:i,dataRef:{current:{}},events:XA(),nested:r,triggerElements:a},b7),this.syncOnly=n}syncOpenEvent=(t,n)=>{(!t||!this.state.open||n!=null&&TA(n))&&(this.context.dataRef.current.openEvent=t?n:void 0)};dispatchOpenChange=(t,n)=>{this.syncOpenEvent(t,n.event);const r={open:t,reason:n.reason,nativeEvent:n.event,nested:this.context.nested,triggerElement:n.trigger};this.context.events.emit("openchange",r)};setOpen=(t,n)=>{if(this.syncOnly){this.context.onOpenChange?.(t,n);return}this.dispatchOpenChange(t,n),this.context.onOpenChange?.(t,n)}}function w7(e,t=!1,n=!1){const[r,i]=m.useState(e&&t?"idle":void 0),[a,o]=m.useState(e);return e&&!a&&(o(!0),i("starting")),!e&&a&&r!=="ending"&&!n&&i("ending"),!e&&!a&&r==="ending"&&i(void 0),Ge(()=>{if(!e&&a&&r!=="ending"&&n){const s=Bi.request(()=>{i("ending")});return()=>{Bi.cancel(s)}}},[e,a,r,n]),Ge(()=>{if(!e||t)return;const s=Bi.request(()=>{i(void 0)});return()=>{Bi.cancel(s)}},[t,e]),Ge(()=>{if(!e||!t)return;e&&a&&r!=="idle"&&i("starting");const s=Bi.request(()=>{i("idle")});return()=>{Bi.cancel(s)}},[t,e,a,r]),{mounted:a,setMounted:o,transitionStatus:r}}function hR(e,t=!1,n=!0){const r=b0();return et((i,a=null)=>{r.cancel();const o=ga(e);if(o==null)return;const s=o,l=()=>{oi.flushSync(i)};if(typeof s.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED){i();return}function c(){Promise.all(s.getAnimations().map(d=>d.finished)).then(()=>{a?.aborted||l()}).catch(()=>{if(n){a?.aborted||l();return}const d=s.getAnimations();!a?.aborted&&d.length>0&&d.some(u=>u.pending||u.playState!=="finished")&&c()})}if(t){const d=iu.startingStyle;if(!s.hasAttribute(d)){r.request(c);return}const u=new MutationObserver(()=>{s.hasAttribute(d)||(u.disconnect(),c())});u.observe(s,{attributes:!0,attributeFilter:[d]}),a?.addEventListener("abort",()=>u.disconnect(),{once:!0});return}r.request(c)})}function A0(e){const{enabled:t=!0,open:n,ref:r,onComplete:i}=e,a=et(i),o=hR(r,n,!1);m.useEffect(()=>{if(!t)return;const s=new AbortController;return o(a,s.signal),()=>{s.abort()}},[t,n,a,o])}function k7(e,t){const n=m.useRef(null),r=m.useRef(null);return m.useCallback(i=>{if(e!==void 0){if(n.current!==null){const a=n.current,o=r.current,s=t.context.triggerElements.getById(a);o&&s===o&&t.context.triggerElements.delete(a),n.current=null,r.current=null}i!==null&&(n.current=e,r.current=i,t.context.triggerElements.add(e,i))}},[t,e])}function _7(e,t,n,r){const i=n.useState("isMountedByTrigger",e),a=k7(e,n),o=et(s=>{if(a(s),!s||!n.select("open"))return;const l=n.select("activeTriggerId");if(l===e){n.update({activeTriggerElement:s,...r});return}l==null&&n.update({activeTriggerId:e,activeTriggerElement:s,...r})});return Ge(()=>{i&&n.update({activeTriggerElement:t.current,...r})},[i,n,t,...Object.values(r)]),{registerTrigger:o,isMountedByThisTrigger:i}}function mR(e){const t=e.useState("open");Ge(()=>{if(t&&!e.select("activeTriggerId")&&e.context.triggerElements.size===1){const n=e.context.triggerElements.entries().next();if(!n.done){const[r,i]=n.value;e.update({activeTriggerId:r,activeTriggerElement:i})}}},[t,e])}function gR(e,t,n){const{mounted:r,setMounted:i,transitionStatus:a}=w7(e);t.useSyncedValues({mounted:r,transitionStatus:a});const o=et(()=>{i(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1}),n?.(),t.context.onOpenChangeComplete?.(!1)}),s=t.useState("preventUnmountingOnClose");return A0({enabled:!s,open:e,ref:t.context.popupRef,onComplete(){e||o()}}),{forceUnmount:o,transitionStatus:a}}class Th{constructor(){this.elementsSet=new Set,this.idMap=new Map}add(t,n){const r=this.idMap.get(t);r!==n&&(r!==void 0&&this.elementsSet.delete(r),this.elementsSet.add(n),this.idMap.set(t,n))}delete(t){const n=this.idMap.get(t);n&&(this.elementsSet.delete(n),this.idMap.delete(t))}hasElement(t){return this.elementsSet.has(t)}hasMatchingElement(t){for(const n of this.elementsSet)if(t(n))return!0;return!1}getById(t){return this.idMap.get(t)}entries(){return this.idMap.entries()}elements(){return this.elementsSet.values()}get size(){return this.idMap.size}}function S7(){return new O0({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:new Th,floatingId:"",syncOnly:!1,nested:!1,onOpenChange:void 0})}function yR(){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:S7(),preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:Bn,inactiveTriggerProps:Bn,popupProps:Bn}}const Pd=Ye(e=>e.triggerIdProp??e.activeTriggerId),vR={open:Ye(e=>e.openProp??e.open),mounted:Ye(e=>e.mounted),transitionStatus:Ye(e=>e.transitionStatus),floatingRootContext:Ye(e=>e.floatingRootContext),preventUnmountingOnClose:Ye(e=>e.preventUnmountingOnClose),payload:Ye(e=>e.payload),activeTriggerId:Pd,activeTriggerElement:Ye(e=>e.mounted?e.activeTriggerElement:null),isTriggerActive:Ye((e,t)=>t!==void 0&&Pd(e)===t),isOpenedByTrigger:Ye((e,t)=>t!==void 0&&Pd(e)===t&&e.open),isMountedByTrigger:Ye((e,t)=>t!==void 0&&Pd(e)===t&&e.mounted),triggerProps:Ye((e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps),popupProps:Ye(e=>e.popupProps),popupElement:Ye(e=>e.popupElement),positionerElement:Ye(e=>e.positionerElement)};function E7(e){const{open:t=!1,onOpenChange:n,elements:r={}}=e,i=Es(),a=$a()!=null,o=cr(()=>new O0({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new Th,floatingId:i,syncOnly:!1,nested:a})).current;return Ge(()=>{const s={open:t,floatingId:i};r.reference!==void 0&&(s.referenceElement=r.reference,s.domReferenceElement=st(r.reference)?r.reference:null),r.floating!==void 0&&(s.floatingElement=r.floating),o.update(s)},[t,i,r.reference,r.floating,o]),o.context.onOpenChange=n,o.context.nested=a,o}function C7(e={}){const{nodeId:t,externalTree:n}=e,r=E7(e),i=e.rootContext||r,a={reference:i.useState("referenceElement"),floating:i.useState("floatingElement"),domReference:i.useState("domReferenceElement")},[o,s]=m.useState(null),l=m.useRef(null),c=No(n);Ge(()=>{a.domReference&&(l.current=a.domReference)},[a.domReference]);const d=V9({...e,elements:{...a,...o&&{reference:o}}}),u=m.useCallback(C=>{const j=st(C)?{getBoundingClientRect:()=>C.getBoundingClientRect(),getClientRects:()=>C.getClientRects(),contextElement:C}:C;s(j),d.refs.setReference(j)},[d.refs]),[p,h]=m.useState(void 0),[y,g]=m.useState(null);i.useSyncedValue("referenceElement",p??null);const x=st(p)?p:null;i.useSyncedValue("domReferenceElement",p===void 0?a.domReference:x),i.useSyncedValue("floatingElement",y);const v=m.useCallback(C=>{(st(C)||C===null)&&(l.current=C,h(C)),(st(d.refs.reference.current)||d.refs.reference.current===null||C!==null&&!st(C))&&d.refs.setReference(C)},[d.refs,h]),b=m.useCallback(C=>{g(C),d.refs.setFloating(C)},[d.refs]),w=m.useMemo(()=>({...d.refs,setReference:v,setFloating:b,setPositionReference:u,domReference:l}),[d.refs,v,b,u]),_=m.useMemo(()=>({...d.elements,domReference:a.domReference}),[d.elements,a.domReference]),k=i.useState("open"),S=i.useState("floatingId"),E=m.useMemo(()=>({...d,dataRef:i.context.dataRef,open:k,onOpenChange:i.setOpen,events:i.context.events,floatingId:S,refs:w,elements:_,nodeId:t,rootStore:i}),[d,w,_,t,i,k,S]);return Ge(()=>{i.context.dataRef.current.floatingContext=E;const C=c?.nodesRef.current.find(j=>j.id===t);C&&(C.context=E)}),m.useMemo(()=>({...d,context:E,refs:w,elements:_,rootStore:i}),[d,w,_,E,i])}function xR(e){const{popupStore:t,treatPopupAsFloatingElement:n=!1,onOpenChange:r}=e,i=Es(),a=$a()!=null,o=t.useState("open"),s=t.useState("activeTriggerElement"),l=t.useState(n?"popupElement":"positionerElement"),c=t.context.triggerElements,d=cr(()=>new O0({open:o,transitionStatus:void 0,referenceElement:s,floatingElement:l,triggerElements:c,onOpenChange:r,floatingId:i,syncOnly:!0,nested:a})).current;return Ge(()=>{const u={open:o,floatingId:i,referenceElement:s,floatingElement:l};st(s)&&(u.domReferenceElement=s),d.state.positionReference===d.state.referenceElement&&(u.positionReference=s),d.update(u)},[o,i,s,l,d]),d.context.onOpenChange=r,d.context.nested=a,d}const pg=CA&&EA;function j7(e,t={}){const n="rootStore"in e?e.rootStore:e,{events:r,dataRef:i}=n.context,{enabled:a=!0,delay:o}=t,s=m.useRef(!1),l=m.useRef(null),c=Fr(),d=m.useRef(!0);m.useEffect(()=>{const p=n.select("domReferenceElement");if(!a)return;const h=an(p);function y(){const v=n.select("domReferenceElement");!n.select("open")&&Rt(v)&&v===Qr(ut(v))&&(s.current=!0)}function g(){d.current=!0}function x(){d.current=!1}return Gi(ot(h,"blur",y),pg&&ot(h,"keydown",g,!0),pg&&ot(h,"pointerdown",x,!0))},[n,a]),m.useEffect(()=>{if(!a)return;function p(h){if(h.reason===ou||h.reason===v0){const y=n.select("domReferenceElement");st(y)&&(l.current=y,s.current=!0)}}return r.on("openchange",p),()=>{r.off("openchange",p)}},[r,a,n]);const u=m.useMemo(()=>({onMouseLeave(){s.current=!1,l.current=null},onFocus(p){const h=p.currentTarget;if(s.current){if(l.current===h)return;s.current=!1,l.current=null}const y=wr(p.nativeEvent);if(st(y)){if(pg&&!p.relatedTarget){if(!d.current&&!jh(y))return}else if(!kU(y))return}const g=rp(p.relatedTarget,n.context.triggerElements),{nativeEvent:x,currentTarget:v}=p,b=typeof o=="function"?o():o;if(n.select("open")&&g||b===0||b===void 0){n.setOpen(!0,dt(Fc,x,v));return}c.start(b,()=>{s.current||n.setOpen(!0,dt(Fc,x,v))})},onBlur(p){s.current=!1,l.current=null;const h=p.relatedTarget,y=p.nativeEvent,g=st(h)&&h.hasAttribute(lu("focus-guard"))&&h.getAttribute("data-type")==="outside";c.start(0,()=>{const x=n.select("domReferenceElement"),v=Qr(ut(x));!h&&v===x||Qe(i.current.floatingContext?.refs.floating.current,v)||Qe(x,v)||g||rp(h??v,n.context.triggerElements)||n.setOpen(!1,dt(Fc,y))})}}),[i,n,c,o]);return m.useMemo(()=>a?{reference:u,trigger:u}:{},[a,u])}class R0{constructor(){this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new na,this.restTimeout=new na,this.handleCloseOptions=void 0}static create(){return new R0}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose}const up=new WeakMap;function dp(e){if(!e.performedPointerEventsMutation)return;const t=e.pointerEventsScopeElement;t&&up.get(t)===e&&(e.pointerEventsScopeElement?.style.removeProperty("pointer-events"),e.pointerEventsReferenceElement?.style.removeProperty("pointer-events"),e.pointerEventsFloatingElement?.style.removeProperty("pointer-events"),up.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function bR(e,t){const{scopeElement:n,referenceElement:r,floatingElement:i}=t,a=up.get(n);a&&a!==e&&dp(a),dp(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=n,e.pointerEventsReferenceElement=r,e.pointerEventsFloatingElement=i,up.set(n,e),n.style.pointerEvents="none",r.style.pointerEvents="auto",i.style.pointerEvents="auto"}function wR(e){const t=cr(R0.create).current,n=e.context.dataRef.current;return n.hoverInteractionState||(n.hoverInteractionState=t),x0(n.hoverInteractionState.disposeEffect),n.hoverInteractionState}function P7(e,t={}){const n="rootStore"in e?e.rootStore:e,r=n.useState("open"),i=n.useState("floatingElement"),a=n.useState("domReferenceElement"),{dataRef:o}=n.context,{enabled:s=!0,closeDelay:l=0,nodeId:c}=t,d=wR(n),u=No(),p=$a(),h=et(()=>OA(o.current.openEvent?.type,d.interactedInside)),y=et(()=>{const _=o.current.openEvent?.type;return _?.includes("mouse")&&_!=="mousedown"}),g=et(_=>rp(_,n.context.triggerElements)),x=m.useCallback(_=>{const k=Hv(l,"close",d.pointerType),S=()=>{n.setOpen(!1,dt(gr,_)),u?.events.emit("floating.closed",_)};k?d.openChangeTimeout.start(k,S):(d.openChangeTimeout.clear(),S())},[l,n,d,u]),v=et(()=>{dp(d)}),b=et(_=>{const k=wr(_);if(!wU(k)){d.interactedInside=!1;return}d.interactedInside=k?.closest("[aria-haspopup]")!=null});Ge(()=>{r||(d.pointerType=void 0,d.restTimeoutPending=!1,d.interactedInside=!1,v())},[r,d,v]),m.useEffect(()=>v,[v]),Ge(()=>{if(s&&r&&d.handleCloseOptions?.blockPointerEvents&&y()&&st(a)&&i){const _=a,k=i,S=ut(i),E=u?.nodesRef.current.find(j=>j.id===p)?.context?.elements.floating;E&&(E.style.pointerEvents="");const C=d.handleCloseOptions?.getScope?.()??d.pointerEventsScopeElement??E??_.closest("[data-rootownerid]")??S.body;return bR(d,{scopeElement:C,referenceElement:_,floatingElement:k}),()=>{v()}}},[s,r,a,i,d,y,u,p,v]);const w=Fr();m.useEffect(()=>{if(!s)return;function _(){d.openChangeTimeout.clear(),w.clear(),u?.events.off("floating.closed",S),v()}function k(C){if(u&&p&&Xi(u.nodesRef.current,p).length>0){u.events.on("floating.closed",S);return}if(g(C.relatedTarget))return;const j=o.current.floatingContext?.nodeId??c,T=C.relatedTarget;if(!(u&&j&&st(T)&&Xi(u.nodesRef.current,j,!1).some(R=>Qe(R.context?.elements.floating,T)))){if(d.handler){d.handler(C);return}v(),h()||x(C)}}function S(C){!u||!p||Xi(u.nodesRef.current,p).length>0||w.start(0,()=>{u.events.off("floating.closed",S),n.setOpen(!1,dt(gr,C)),u.events.emit("floating.closed",C)})}const E=i;return Gi(E&&ot(E,"mouseenter",_),E&&ot(E,"mouseleave",k),E&&ot(E,"pointerdown",b,!0),()=>{u?.events.off("floating.closed",S)})},[s,i,n,o,c,h,g,x,v,b,d,u,p,w])}const N7={current:null};function T7(e,t={}){const n="rootStore"in e?e.rootStore:e,{dataRef:r,events:i}=n.context,{enabled:a=!0,delay:o=0,handleClose:s=null,mouseOnly:l=!1,restMs:c=0,move:d=!0,triggerElementRef:u=N7,externalTree:p,isActiveTrigger:h=!0,getHandleCloseContext:y,isClosing:g}=t,x=No(p),v=wR(n),b=m.useRef(!1),w=Fn(s),_=Fn(o),k=Fn(c),S=Fn(a),E=Fn(g);h&&(v.handleCloseOptions=w.current?.__options);const C=et(()=>OA(r.current.openEvent?.type,v.interactedInside)),j=et(M=>rp(M,n.context.triggerElements)),T=et((M,O,I)=>{const L=n.context.triggerElements;if(L.hasElement(O))return!M||!Qe(M,O);if(!st(I))return!1;const V=I;return L.hasMatchingElement(F=>Qe(F,V))&&(!M||!Qe(M,V))}),A=et((M,O=!0)=>{const I=Hv(_.current,"close",v.pointerType);I?v.openChangeTimeout.start(I,()=>{n.setOpen(!1,dt(gr,M)),x?.events.emit("floating.closed",M)}):O&&(v.openChangeTimeout.clear(),n.setOpen(!1,dt(gr,M)),x?.events.emit("floating.closed",M))}),R=et(()=>{if(!v.handler)return;ut(n.select("domReferenceElement")).removeEventListener("mousemove",v.handler),v.handler=void 0}),D=et(()=>{dp(v)});return m.useEffect(()=>R,[R]),m.useEffect(()=>{if(!a)return;function M(O){O.open?b.current=!1:(b.current=O.reason===gr,R(),v.openChangeTimeout.clear(),v.restTimeout.clear(),v.blockMouseMove=!0,v.restTimeoutPending=!1)}return i.on("openchange",M),()=>{i.off("openchange",M)}},[a,i,v,R]),m.useEffect(()=>{if(!a)return;const M=u.current??(h?n.select("domReferenceElement"):null);if(!st(M))return;function O(L){if(v.openChangeTimeout.clear(),v.blockMouseMove=!1,l&&!su(v.pointerType))return;const V=b_(k.current),F=Hv(_.current,"open",v.pointerType),N=wr(L),ee=L.currentTarget??null,Q=n.select("domReferenceElement");let P=ee;if(st(N)&&!n.context.triggerElements.hasElement(N)){for(const G of n.context.triggerElements.elements())if(Qe(G,N)){P=G;break}}st(ee)&&st(Q)&&!n.context.triggerElements.hasElement(ee)&&Qe(ee,Q)&&(P=Q);const z=P==null?!1:T(Q,P,N),$=n.select("open"),H=E.current?.()??n.select("transitionStatus")==="ending",oe=!$&&H&&b.current,q=!z&&st(P)&&st(Q)&&Qe(Q,P)&&oe,X=V>0&&!F,te=z&&($||oe)||q,ue=!$||z;if(te){n.setOpen(!0,dt(gr,L,P));return}X||(F?v.openChangeTimeout.start(F,()=>{ue&&n.setOpen(!0,dt(gr,L,P))}):ue&&n.setOpen(!0,dt(gr,L,P)))}function I(L){if(C()){D();return}R();const V=n.select("domReferenceElement"),F=ut(V);v.restTimeout.clear(),v.restTimeoutPending=!1;const N=r.current.floatingContext??y?.();if(j(L.relatedTarget))return;if(w.current&&N){n.select("open")||v.openChangeTimeout.clear();const P=u.current;v.handler=w.current({...N,tree:x,x:L.clientX,y:L.clientY,onClose(){D(),R(),S.current&&!C()&&P===n.select("domReferenceElement")&&A(L,!0)}}),F.addEventListener("mousemove",v.handler),v.handler(L);return}(v.pointerType!=="touch"||!Qe(n.select("floatingElement"),L.relatedTarget))&&A(L)}return d?Gi(ot(M,"mousemove",O,{once:!0}),ot(M,"mouseenter",O),ot(M,"mouseleave",I)):Gi(ot(M,"mouseenter",O),ot(M,"mouseleave",I))},[R,D,r,_,A,n,a,w,v,h,T,C,j,l,d,k,u,x,S,y,E]),m.useMemo(()=>{if(!a)return;function M(O){v.pointerType=O.pointerType}return{onPointerDown:M,onPointerEnter:M,onMouseMove(O){const{nativeEvent:I}=O,L=O.currentTarget,V=n.select("domReferenceElement"),F=n.select("open"),N=T(V,L,O.target);if(l&&!su(v.pointerType))return;if(F&&N&&v.handleCloseOptions?.blockPointerEvents){const P=n.select("floatingElement");if(P){const z=v.handleCloseOptions?.getScope?.()??L.ownerDocument.body;bR(v,{scopeElement:z,referenceElement:L,floatingElement:P})}}const ee=b_(k.current);if(F&&!N||ee===0||!N&&v.restTimeoutPending&&O.movementX**2+O.movementY**2<2)return;v.restTimeout.clear();function Q(){if(v.restTimeoutPending=!1,C())return;const P=n.select("open");!v.blockMouseMove&&(!P||N)&&n.setOpen(!0,dt(gr,I,L))}v.pointerType==="touch"?oi.flushSync(()=>{Q()}):N&&F?Q():(v.restTimeoutPending=!0,v.restTimeout.start(ee,Q))}}},[a,v,C,T,l,n,k])}function M0(e=[]){const t=e.map(c=>c?.reference),n=e.map(c=>c?.floating),r=e.map(c=>c?.item),i=e.map(c=>c?.trigger),a=m.useCallback(c=>Nd(c,e,"reference"),t),o=m.useCallback(c=>Nd(c,e,"floating"),n),s=m.useCallback(c=>Nd(c,e,"item"),r),l=m.useCallback(c=>Nd(c,e,"trigger"),i);return m.useMemo(()=>({getReferenceProps:a,getFloatingProps:o,getItemProps:s,getTriggerProps:l}),[a,o,s,l])}function Nd(e,t,n){const r=new Map,i=n==="item",a={};n==="floating"&&(a.tabIndex=-1,a[Uv]="");for(const o in e)i&&e&&(o===AA||o===RA)||(a[o]=e[o]);for(let o=0;o<t.length;o+=1){let s;const l=t[o]?.[n];typeof l=="function"?s=e?l(e):null:s=l,s&&U_(a,s,i,r)}return U_(a,e,i,r),a}function U_(e,t,n,r){for(const i in t){const a=t[i];n&&(i===AA||i===RA)||(i.startsWith("on")?(r.has(i)||r.set(i,[]),typeof a=="function"&&(r.get(i)?.push(a),e[i]=(...o)=>r.get(i)?.map(s=>s(...o)).find(s=>s!==void 0))):e[i]=a)}}const O7="Escape";function Oh(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function Td(e,t){return Oh(t,e===w0||e===$u,e===go||e===yo)}function hg(e,t,n){return Oh(t,e===$u,n?e===go:e===yo)||e==="Enter"||e===" "||e===""}function A7(e,t,n){return Oh(t,n?e===go:e===yo,e===$u)}function R7(e,t,n,r){const i=n?e===yo:e===go,a=e===w0;return t==="both"||t==="horizontal"&&r&&r>1?e===O7:Oh(t,i,a)}function M7(e,t){const n="rootStore"in e?e.rootStore:e,r=n.useState("open"),i=n.useState("floatingElement"),a=n.useState("domReferenceElement"),o=n.context.dataRef,{listRef:s,activeIndex:l,onNavigate:c=()=>{},enabled:d=!0,selectedIndex:u=null,allowEscape:p=!1,loopFocus:h=!1,nested:y=!1,rtl:g=!1,virtual:x=!1,focusItemOnOpen:v="auto",focusItemOnHover:b=!0,openOnArrowKeyDown:w=!0,disabledIndices:_=void 0,orientation:k="vertical",parentOrientation:S,cols:E=1,id:C,resetOnPointerLeave:j=!0,externalTree:T}=t,A=ip(i),R=Fn(A),D=$a(),M=No(T);Ge(()=>{o.current.orientation=k},[o,k]);const O=Vv(a),I=m.useRef(v),L=m.useRef(u??-1),V=m.useRef(null),F=m.useRef(!0),N=et(le=>{c(L.current===-1?null:L.current,le)}),ee=m.useRef(N),Q=m.useRef(!!i),P=m.useRef(r),z=m.useRef(!1),$=m.useRef(!1),H=m.useRef(null),oe=Fn(_),q=Fn(r),X=Fn(u),te=Fn(j),ue=et(()=>{function le(Se){x?M?.events.emit("virtualfocus",Se):H.current=jf(Se,{sync:z.current,preventScroll:!0})}const pe=s.current[L.current],K=$.current;pe&&le(pe),(z.current?Se=>Se():requestAnimationFrame)(()=>{const Se=s.current[L.current]||pe;if(!Se)return;pe||le(Se),xe&&(K||!F.current)&&Se.scrollIntoView?.({block:"nearest",inline:"nearest"})})});Ge(()=>{d&&(r&&i?(L.current=u??-1,I.current&&u!=null&&($.current=!0,N())):Q.current&&(L.current=-1,ee.current()))},[d,r,i,u,N]),Ge(()=>{if(d){if(!r){z.current=!1;return}if(i)if(l==null){if(z.current=!1,X.current!=null)return;if(Q.current&&(L.current=-1,ue()),(!P.current||!Q.current)&&I.current&&(V.current!=null||I.current===!0&&V.current==null)){let le=0;const pe=()=>{s.current[0]==null?(le<2&&(le?requestAnimationFrame:queueMicrotask)(pe),le+=1):(L.current=V.current==null||hg(V.current,k,g)||y?rg(s):__(s),V.current=null,N())};pe()}}else lp(s.current,l)||(L.current=l,ue(),$.current=!1)}},[d,r,i,l,X,y,s,k,g,N,ue,oe]),Ge(()=>{if(!d||i||!M||x||!Q.current)return;const le=M.nodesRef.current,pe=le.find(Se=>Se.id===D)?.context?.elements.floating,K=Qr(ut(i)),se=le.some(Se=>Se.context&&Qe(Se.context.elements.floating,K));pe&&!se&&F.current&&pe.focus({preventScroll:!0})},[d,i,M,D,x]),Ge(()=>{ee.current=N,P.current=r,Q.current=!!i}),Ge(()=>{r||(V.current=null,I.current=v)},[r,v]);const G=l!=null,be=et(le=>{if(!q.current)return;const pe=s.current.indexOf(le.currentTarget);pe!==-1&&(L.current!==pe||l!==pe)&&(L.current=pe,N(le))}),xe=m.useMemo(()=>({onFocus(pe){z.current=!0,be(pe)},onClick:({currentTarget:pe})=>pe.focus({preventScroll:!0}),onMouseMove(pe){z.current=!0,$.current=!1,b&&be(pe)},onPointerLeave(pe){if(!q.current||!F.current||pe.pointerType==="touch")return;z.current=!0;const K=pe.relatedTarget;if(!(!b||s.current.includes(K))&&te.current&&(H.current?.(),H.current=null,L.current=-1,N(pe),!x)){const se=R.current,Se=Qr(ut(se));se&&Qe(se,Se)&&se.focus({preventScroll:!0})}}}),[be,q,R,b,s,N,te,x]),Ae=m.useCallback(()=>S??M?.nodesRef.current.find(le=>le.id===D)?.context?.dataRef?.current.orientation,[D,M,S]),ge=et(le=>{if(F.current=!1,z.current=!0,le.which===229||!q.current&&le.currentTarget===R.current)return;if(y&&R7(le.key,k,g,E)){Td(le.key,Ae())||Mr(le),n.setOpen(!1,dt(Cf,le.nativeEvent)),Rt(a)&&(x?M?.events.emit("virtualfocus",a):a.focus());return}const pe=L.current,K=rg(s,_),se=__(s,_);if(O||(le.key==="Home"&&(Mr(le),L.current=K,N(le)),le.key==="End"&&(Mr(le),L.current=se,N(le))),E>1){const Se=Array.from({length:s.current.length},()=>({width:1,height:1})),Z=RU(Se,E),U=Z.findIndex(Re=>Re!=null&&!fl(s.current,Re,_)),fe=Z.reduce((Re,Ee,Ne)=>Ee!=null&&!fl(s.current,Ee,_)?Ne:Re,-1),we=Z[AU(Z.map(Re=>Re!=null?s.current[Re]:null),{event:le,orientation:k,loopFocus:h,rtl:g,cols:E,disabledIndices:IU([...(typeof _!="function"?_:null)||s.current.map((Re,Ee)=>fl(s.current,Ee,_)?Ee:void 0),void 0],Z),minIndex:U,maxIndex:fe,prevIndex:MU(L.current>se?K:L.current,Se,Z,E,le.key===$u?"bl":le.key===(g?go:yo)?"tr":"tl"),stopEvent:!0})];if(we!=null&&(L.current=we,N(le)),k==="both")return}if(Td(le.key,k)){if(Mr(le),r&&!x&&Qr(le.currentTarget.ownerDocument)===le.currentTarget){L.current=hg(le.key,k,g)?K:se,N(le);return}hg(le.key,k,g)?h?pe>=se?p&&pe!==s.current.length?L.current=-1:(z.current=!1,L.current=K):L.current=er(s.current,{startingIndex:pe,disabledIndices:_}):L.current=Math.min(se,er(s.current,{startingIndex:pe,disabledIndices:_})):h?pe<=K?p&&pe!==-1?L.current=s.current.length:(z.current=!1,L.current=se):L.current=er(s.current,{startingIndex:pe,decrement:!0,disabledIndices:_}):L.current=Math.max(K,er(s.current,{startingIndex:pe,decrement:!0,disabledIndices:_})),lp(s.current,L.current)&&(L.current=-1),N(le)}}),_e=m.useMemo(()=>x&&r&&G&&{"aria-activedescendant":`${C}-${l}`},[x,r,G,C,l]),De=m.useMemo(()=>({"aria-orientation":k==="both"?void 0:k,...O?{}:_e,onKeyDown(le){if(le.key==="Tab"&&le.shiftKey&&r&&!x){const pe=wr(le.nativeEvent);if(pe&&!Qe(R.current,pe))return;Mr(le),n.setOpen(!1,dt(Pl,le.nativeEvent)),Rt(a)&&a.focus();return}ge(le)},onPointerMove(){F.current=!0}}),[_e,ge,R,k,O,n,r,x,a]),ve=m.useMemo(()=>{function le(K){v==="auto"&&PA(K.nativeEvent)&&(I.current=!x)}function pe(K){I.current=v,v==="auto"&&NA(K.nativeEvent)&&(I.current=!0)}return{onKeyDown(K){const se=n.select("open");F.current=!1;const Se=K.key.startsWith("Arrow"),Z=A7(K.key,Ae(),g),U=Td(K.key,k),fe=(y?Z:U)||K.key==="Enter"||K.key.trim()==="";if(x&&se)return ge(K);if(!(!se&&!w&&Se)){if(fe){const we=Td(K.key,Ae());V.current=y&&we?null:K.key}if(y){Z&&(Mr(K),se?(L.current=rg(s,oe.current),N(K)):n.setOpen(!0,dt(Cf,K.nativeEvent,K.currentTarget)));return}U&&(X.current!=null&&(L.current=X.current),Mr(K),!se&&w?n.setOpen(!0,dt(Cf,K.nativeEvent,K.currentTarget)):ge(K),se&&N(K))}},onFocus(K){n.select("open")&&!x&&(L.current=-1,N(K))},onPointerDown:pe,onPointerEnter:pe,onMouseDown:le,onClick:le}},[ge,oe,v,s,y,N,n,w,k,Ae,g,X,x]),Le=m.useMemo(()=>({..._e,...ve}),[_e,ve]);return m.useMemo(()=>d?{reference:Le,floating:De,item:xe,trigger:ve}:{},[d,Le,De,ve,xe])}const I7=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function kR(e,t={}){const n="rootStore"in e?e.rootStore:e,r=n.useState("open"),i=n.useState("floatingId"),a=n.useState("domReferenceElement"),o=n.useState("floatingElement"),{role:s="dialog"}=t,l=Es(),c=a?.id||l,d=m.useMemo(()=>ip(o)?.id||i,[o,i]),u=I7.get(s)??s,h=$a()!=null,y=m.useMemo(()=>u==="tooltip"||s==="label"?Bn:{"aria-haspopup":u==="alertdialog"?"dialog":u,"aria-expanded":"false",...u==="listbox"&&{role:"combobox"},...u==="menu"&&h&&{role:"menuitem"},...s==="select"&&{"aria-autocomplete":"none"},...s==="combobox"&&{"aria-autocomplete":"list"}},[u,h,s]),g=m.useMemo(()=>u==="tooltip"||s==="label"?{[`aria-${s==="label"?"labelledby":"describedby"}`]:r?d:void 0}:{...y,"aria-expanded":r?"true":"false","aria-controls":r?d:void 0,...u==="menu"&&{id:c}},[u,d,r,c,s,y]),x=m.useMemo(()=>{const b={id:d,...u&&{role:u}};return u==="tooltip"||s==="label"?b:{...b,...u==="menu"&&{"aria-labelledby":c}}},[u,d,c,s]),v=m.useCallback(({active:b,selected:w})=>{const _={role:"option",...b&&{id:`${d}-fui-option`}};switch(s){case"select":case"combobox":return{..._,"aria-selected":w}}return{}},[d,s]);return m.useMemo(()=>({reference:g,floating:x,item:v,trigger:y}),[g,x,y,v])}function D7(e,t){const n="rootStore"in e?e.rootStore:e,r=n.context.dataRef,i=n.useState("open"),{listRef:a,elementsRef:o,activeIndex:s,onMatch:l,onTypingChange:c,enabled:d=!0,resetMs:u=750,selectedIndex:p=null}=t,h=Fr(),y=m.useRef(""),g=m.useRef(p??s??-1),x=m.useRef(null);Ge(()=>{!i&&p!==null||(h.clear(),x.current=null,y.current!==""&&(y.current=""))},[i,p,h]),Ge(()=>{i&&y.current===""&&(g.current=p??s??-1)},[i,p,s]);const v=et(S=>{S?r.current.typing||(r.current.typing=S,c?.(S)):r.current.typing&&(r.current.typing=S,c?.(S))}),b=et(S=>{function E(O){const I=o?.current[O];return!I||Ph(I)}function C(O,I,L=0){if(O.length===0)return-1;const V=(L%O.length+O.length)%O.length,F=I.toLocaleLowerCase();for(let N=0;N<O.length;N+=1){const ee=(V+N)%O.length;if(!(!O[ee]?.toLocaleLowerCase().startsWith(F)||!E(ee)))return ee}return-1}const j=a.current;if(y.current.length>0&&S.key===" "&&(Mr(S),v(!0)),y.current.length>0&&y.current[0]!==" "&&C(j,y.current)===-1&&S.key!==" "&&v(!1),j==null||S.key.length!==1||S.ctrlKey||S.metaKey||S.altKey)return;i&&S.key!==" "&&(Mr(S),v(!0));const T=y.current==="";T&&(g.current=p??s??-1),j.every(O=>O?O[0]?.toLocaleLowerCase()!==O[1]?.toLocaleLowerCase():!0)&&y.current===S.key&&(y.current="",g.current=x.current),y.current+=S.key,h.start(u,()=>{y.current="",g.current=x.current,v(!1)});const D=((T?p??s??-1:g.current)??0)+1,M=C(j,y.current,D);M!==-1?(l?.(M),x.current=M):S.key!==" "&&(y.current="",v(!1))}),w=et(S=>{const E=S.relatedTarget,C=n.select("domReferenceElement"),j=n.select("floatingElement"),T=Qe(C,E),A=Qe(j,E);T||A||(h.clear(),y.current="",g.current=x.current,v(!1))}),_=m.useMemo(()=>({onKeyDown:b,onBlur:w}),[b,w]),k=m.useMemo(()=>({onKeyDown:b,onBlur:w}),[b,w]);return m.useMemo(()=>d?{reference:_,floating:k}:{},[d,_,k])}const V_=.1,L7=V_*V_,St=.5;function Od(e,t,n,r,i,a){return r>=t!=a>=t&&e<=(i-n)*(t-r)/(a-r)+n}function Ad(e,t,n,r,i,a,o,s,l,c){let d=!1;return Od(e,t,n,r,i,a)&&(d=!d),Od(e,t,i,a,o,s)&&(d=!d),Od(e,t,o,s,l,c)&&(d=!d),Od(e,t,l,c,n,r)&&(d=!d),d}function $7(e,t,n){return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function Rd(e,t,n,r,i,a){const o=Math.min(n,i),s=Math.max(n,i),l=Math.min(r,a),c=Math.max(r,a);return e>=o&&e<=s&&t>=l&&t<=c}function z7(e={}){const{blockPointerEvents:t=!1}=e,n=new na,r=({x:i,y:a,placement:o,elements:s,onClose:l,nodeId:c,tree:d})=>{const u=o?.split("-")[0];let p=!1,h=null,y=null,g=typeof performance<"u"?performance.now():0;function x(b,w){const _=performance.now(),k=_-g;if(h===null||y===null||k===0)return h=b,y=w,g=_,!1;const S=b-h,E=w-y,C=S*S+E*E,j=k*k*L7;return h=b,y=w,g=_,C<j}function v(){n.clear(),l()}return function(w){n.clear();const _=s.domReference,k=s.floating;if(!_||!k||u==null||i==null||a==null)return;const{clientX:S,clientY:E}=w,C=wr(w),j=w.type==="mouseleave",T=Qe(k,C),A=Qe(_,C);if(T&&(p=!0,!j))return;if(A&&(p=!1,!j)){p=!0;return}if(j&&st(w.relatedTarget)&&Qe(k,w.relatedTarget))return;function R(){return!!(d&&Xi(d.nodesRef.current,c).length>0)}function D(){R()||v()}if(R())return;const M=_.getBoundingClientRect(),O=k.getBoundingClientRect(),I=i>O.right-O.width/2,L=a>O.bottom-O.height/2,V=O.width>M.width,F=O.height>M.height,N=(V?M:O).left,ee=(V?M:O).right,Q=(F?M:O).top,P=(F?M:O).bottom;if(u==="top"&&a>=M.bottom-1||u==="bottom"&&a<=M.top+1||u==="left"&&i>=M.right-1||u==="right"&&i<=M.left+1){D();return}let z=!1;switch(u){case"top":z=Rd(S,E,N,M.top+1,ee,O.bottom-1);break;case"bottom":z=Rd(S,E,N,O.top+1,ee,M.bottom-1);break;case"left":z=Rd(S,E,O.right-1,P,M.left+1,Q);break;case"right":z=Rd(S,E,M.right-1,P,O.left+1,Q);break}if(z)return;if(p&&!$7(S,E,M)){D();return}if(!j&&x(S,E)){D();return}let $=!1;switch(u){case"top":{const H=V?St/2:St*4,oe=V||I?i+H:i-H,q=V?i-H:I?i+H:i-H,X=a+St+1,te=I||V?O.bottom-St:O.top,ue=I?V?O.bottom-St:O.top:O.bottom-St;$=Ad(S,E,oe,X,q,X,O.left,te,O.right,ue);break}case"bottom":{const H=V?St/2:St*4,oe=V||I?i+H:i-H,q=V?i-H:I?i+H:i-H,X=a-St,te=I||V?O.top+St:O.bottom,ue=I?V?O.top+St:O.bottom:O.top+St;$=Ad(S,E,oe,X,q,X,O.left,te,O.right,ue);break}case"left":{const H=F?St/2:St*4,oe=F||L?a+H:a-H,q=F?a-H:L?a+H:a-H,X=i+St+1,te=L||F?O.right-St:O.left,ue=L?F?O.right-St:O.left:O.right-St;$=Ad(S,E,te,O.top,ue,O.bottom,X,oe,X,q);break}case"right":{const H=F?St/2:St*4,oe=F||L?a+H:a-H,q=F?a-H:L?a+H:a-H,X=i-St,te=L||F?O.left+St:O.right,ue=L?F?O.left+St:O.right:O.left+St;$=Ad(S,E,X,oe,X,q,te,O.top,ue,O.bottom);break}}$?p||n.start(40,D):D()}};return r.__options={...e,blockPointerEvents:t},r}let F7=(function(e){return e.nestedDialogs="--nested-dialogs",e})({}),B7=(function(e){return e[e.open=wi.open]="open",e[e.closed=wi.closed]="closed",e[e.startingStyle=wi.startingStyle]="startingStyle",e[e.endingStyle=wi.endingStyle]="endingStyle",e.nested="data-nested",e.nestedDialogOpen="data-nested-dialog-open",e})({});const _R=m.createContext(void 0);function SR(){const e=m.useContext(_R);if(e===void 0)throw new Error(fa(26));return e}const ER="ArrowUp",CR="ArrowDown",jR="ArrowLeft",PR="ArrowRight",NR="Home",TR="End",W7=new Set([jR,PR]),H7=new Set([ER,CR]),U7=new Set([...W7,...H7]);[...U7];const OR=new Set([ER,CR,jR,PR,NR,TR]),V7={...Lu,...bh,nestedDialogOpen(e){return e?{[B7.nestedDialogOpen]:""}:null}},q7=m.forwardRef(function(t,n){const{className:r,finalFocus:i,initialFocus:a,render:o,style:s,...l}=t,{store:c}=Co(),d=c.useState("descriptionElementId"),u=c.useState("disablePointerDismissal"),p=c.useState("floatingRootContext"),h=c.useState("popupProps"),y=c.useState("modal"),g=c.useState("mounted"),x=c.useState("nested"),v=c.useState("nestedOpenDialogCount"),b=c.useState("open"),w=c.useState("openMethod"),_=c.useState("titleElementId"),k=c.useState("transitionStatus"),S=c.useState("role");SR(),A0({open:b,ref:c.context.popupRef,onComplete(){b&&c.context.onOpenChangeComplete?.(!0)}});function E(R){return R==="touch"?c.context.popupRef.current:!0}const C=a===void 0?E:a,j=v>0,A=Ur("div",t,{state:{open:b,nested:x,transitionStatus:k,nestedDialogOpen:j},props:[h,{"aria-labelledby":_??void 0,"aria-describedby":d??void 0,role:S,tabIndex:-1,hidden:!g,onKeyDown(R){OR.has(R.key)&&R.stopPropagation()},style:{[F7.nestedDialogs]:v}},l],ref:[n,c.context.popupRef,c.useStateSetter("popupElement")],stateAttributesMapping:V7});return f.jsx(eR,{context:p,openInteractionType:w,disabled:!g,closeOnFocusOut:!u,initialFocus:C,returnFocus:i,modal:y!==!1,restoreFocus:"popup",children:A})});function AR(e){return u0(19)?e:e?"true":void 0}const RR=m.forwardRef(function(t,n){const{cutout:r,...i}=t;let a;if(r){const o=r.getBoundingClientRect();a=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${o.left}px ${o.top}px,${o.left}px ${o.bottom}px,${o.right}px ${o.bottom}px,${o.right}px ${o.top}px,${o.left}px ${o.top}px)`}return f.jsx("div",{ref:n,role:"presentation","data-base-ui-inert":"",...i,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:a}})}),K7=m.forwardRef(function(t,n){const{keepMounted:r=!1,...i}=t,{store:a}=Co(),o=a.useState("mounted"),s=a.useState("modal"),l=a.useState("open");return o||r?f.jsx(_R.Provider,{value:r,children:f.jsxs(YA,{ref:n,...i,children:[o&&s===!0&&f.jsx(RR,{ref:a.context.internalBackdropRef,inert:AR(!l)}),t.children]})}):null});function MR(e){const t=m.useRef(!0);t.current&&(t.current=!1,e())}let q_={},K_={},G_="";function G7(e){if(typeof document>"u")return!1;const t=ut(e);return an(t).innerWidth-t.documentElement.clientWidth>0}function Y7(e){if(!(typeof CSS<"u"&&CSS.supports&&CSS.supports("scrollbar-gutter","stable"))||typeof document>"u")return!1;const n=ut(e),r=n.documentElement,i=n.body,a=jo(r)?r:i,o=a.style.overflowY,s=r.style.scrollbarGutter;r.style.scrollbarGutter="stable",a.style.overflowY="scroll";const l=a.offsetWidth;a.style.overflowY="hidden";const c=a.offsetWidth;return a.style.overflowY=o,r.style.scrollbarGutter=s,l===c}function X7(e){const t=ut(e),n=t.documentElement,r=t.body,i=jo(n)?n:r,a={overflowY:i.style.overflowY,overflowX:i.style.overflowX};return Object.assign(i.style,{overflowY:"hidden",overflowX:"hidden"}),()=>{Object.assign(i.style,a)}}function Z7(e){const t=ut(e),n=t.documentElement,r=t.body,i=an(n);let a=0,o=0,s=!1;const l=Bi.create();if(_A&&(i.visualViewport?.scale??1)!==1)return()=>{};function c(){const h=i.getComputedStyle(n),y=i.getComputedStyle(r),v=(h.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";a=n.scrollTop,o=n.scrollLeft,q_={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},G_=n.style.scrollBehavior,K_={position:r.style.position,height:r.style.height,width:r.style.width,boxSizing:r.style.boxSizing,overflowY:r.style.overflowY,overflowX:r.style.overflowX,scrollBehavior:r.style.scrollBehavior};const b=n.scrollHeight>n.clientHeight,w=n.scrollWidth>n.clientWidth,_=h.overflowY==="scroll"||y.overflowY==="scroll",k=h.overflowX==="scroll"||y.overflowX==="scroll",S=Math.max(0,i.innerWidth-r.clientWidth),E=Math.max(0,i.innerHeight-r.clientHeight),C=parseFloat(y.marginTop)+parseFloat(y.marginBottom),j=parseFloat(y.marginLeft)+parseFloat(y.marginRight),T=jo(n)?n:r;if(s=Y7(e),s){n.style.scrollbarGutter=v,T.style.overflowY="hidden",T.style.overflowX="hidden";return}Object.assign(n.style,{scrollbarGutter:v,overflowY:"hidden",overflowX:"hidden"}),(b||_)&&(n.style.overflowY="scroll"),(w||k)&&(n.style.overflowX="scroll"),Object.assign(r.style,{position:"relative",height:C||E?`calc(100dvh - ${C+E}px)`:"100dvh",width:j||S?`calc(100vw - ${j+S}px)`:"100vw",boxSizing:"border-box",overflow:"hidden",scrollBehavior:"unset"}),r.scrollTop=a,r.scrollLeft=o,n.setAttribute("data-base-ui-scroll-locked",""),n.style.scrollBehavior="unset"}function d(){Object.assign(n.style,q_),Object.assign(r.style,K_),s||(n.scrollTop=a,n.scrollLeft=o,n.removeAttribute("data-base-ui-scroll-locked"),n.style.scrollBehavior=G_)}function u(){d(),l.request(c)}c();const p=ot(i,"resize",u);return()=>{l.cancel(),d(),typeof i.removeEventListener=="function"&&p()}}class Q7{lockCount=0;restore=null;timeoutLock=na.create();timeoutUnlock=na.create();acquire(t){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(t)),this.release}release=()=>{this.lockCount-=1,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(t){if(this.lockCount===0||this.restore!==null)return;const r=ut(t).documentElement,i=an(r).getComputedStyle(r).overflowY;if(i==="hidden"||i==="clip"){this.restore=d0;return}const a=SA||!G7(t);this.restore=a?X7(t):Z7(t)}}const J7=new Q7;function IR(e=!0,t=null){Ge(()=>{if(e)return J7.acquire(t)},[e,t])}function eV(e){const t=m.useRef(""),n=m.useCallback(i=>{i.defaultPrevented||(t.current=i.pointerType,e(i,i.pointerType))},[e]);return{onClick:m.useCallback(i=>{if(i.detail===0){e(i,"keyboard");return}"pointerType"in i?e(i,i.pointerType):e(i,t.current),t.current=""},[e]),onPointerDown:n}}function tV(e,t){const n=m.useRef(e),r=et(t);Ge(()=>{n.current!==e&&r(n.current)},[e,r]),Ge(()=>{n.current=e},[e])}function DR(e){const[t,n]=m.useState(null),r=et((o,s)=>{e||n(s||(SA?"touch":""))});tV(e,o=>{o&&!e&&n(null)});const{onClick:i,onPointerDown:a}=eV(r);return m.useMemo(()=>({openMethod:t,triggerProps:{onClick:i,onPointerDown:a}}),[t,i,a])}function nV(e){const{store:t,parentContext:n,actionsRef:r,isDrawer:i}=e,a=t.useState("open"),o=t.useState("disablePointerDismissal"),s=t.useState("modal"),l=t.useState("popupElement"),{openMethod:c,triggerProps:d}=DR(a);mR(t);const{forceUnmount:u}=gR(a,t),p=m.useCallback(()=>{t.setOpen(!1,dt(xA))},[t]);m.useImperativeHandle(r,()=>({unmount:u,close:p}),[u,p]);const h=xR({popupStore:t,onOpenChange:t.setOpen,treatPopupAsFloatingElement:!0}),[y,g]=m.useState(0),[x,v]=m.useState(0),b=y===0,w=kR(h),_=tR(h,{outsidePressEvent(){return t.context.internalBackdropRef.current||t.context.backdropRef.current?"intentional":{mouse:s==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}},outsidePress(A){if(!t.context.outsidePressEnabledRef.current||"button"in A&&A.button!==0||"touches"in A&&A.touches.length!==1)return!1;const R=wr(A);if(b&&!o){const D=R;return s&&(t.context.internalBackdropRef.current||t.context.backdropRef.current)?t.context.internalBackdropRef.current===D||t.context.backdropRef.current===D||Qe(D,l)&&!D?.hasAttribute("data-base-ui-portal"):!0}return!1},escapeKey:b});IR(a&&s===!0,l);const{getReferenceProps:k,getFloatingProps:S,getTriggerProps:E}=M0([w,_]);t.useContextCallback("onNestedDialogOpen",(A,R)=>{g(A),v(R)}),t.useContextCallback("onNestedDialogClose",()=>{g(0),v(0)}),m.useEffect(()=>(n?.onNestedDialogOpen&&a&&n.onNestedDialogOpen(y+1,x+(i?1:0)),n?.onNestedDialogClose&&!a&&n.onNestedDialogClose(),()=>{n?.onNestedDialogClose&&a&&n.onNestedDialogClose()}),[i,a,y,x,n]);const C=m.useMemo(()=>k(d),[k,d]),j=m.useMemo(()=>E(d),[E,d]),T=m.useMemo(()=>S(),[S]);t.useSyncedValues({openMethod:c,activeTriggerProps:C,inactiveTriggerProps:j,popupProps:T,floatingRootContext:h,nestedOpenDialogCount:y,nestedOpenDrawerCount:x})}const rV={...vR,modal:Ye(e=>e.modal),nested:Ye(e=>e.nested),nestedOpenDialogCount:Ye(e=>e.nestedOpenDialogCount),nestedOpenDrawerCount:Ye(e=>e.nestedOpenDrawerCount),disablePointerDismissal:Ye(e=>e.disablePointerDismissal),openMethod:Ye(e=>e.openMethod),descriptionElementId:Ye(e=>e.descriptionElementId),titleElementId:Ye(e=>e.titleElementId),viewportElement:Ye(e=>e.viewportElement),role:Ye(e=>e.role)};class I0 extends T0{constructor(t){super(iV(t),{popupRef:m.createRef(),backdropRef:m.createRef(),internalBackdropRef:m.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:new Th,onOpenChange:void 0,onOpenChangeComplete:void 0},rV)}setOpen=(t,n)=>{if(n.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},!t&&n.trigger==null&&this.state.activeTriggerId!=null&&(n.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(t,n),n.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(t,n);const r={open:t},i=n.trigger?.id??null;(i||t)&&(r.activeTriggerId=i,r.activeTriggerElement=n.trigger??null),this.update(r)};static useStore(t,n){const r=cr(()=>new I0(n)).current;return t??r}}function iV(e={}){return{...yR(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:"dialog",...e}}const Y_=m.createContext(!1);function aV(e){const{children:t,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:a,disablePointerDismissal:o=!1,modal:s=!0,actionsRef:l,handle:c,triggerId:d,defaultTriggerId:u=null}=e,p=Co(!0),h=m.useContext(Y_),y=!!p,g=I0.useStore(c?.store,{open:r,openProp:n,activeTriggerId:u,triggerIdProp:d,modal:s,disablePointerDismissal:o,nested:y});MR(()=>{n===void 0&&g.state.open===!1&&r===!0&&g.update({open:!0,activeTriggerId:u})}),g.useControlledProp("openProp",n),g.useControlledProp("triggerIdProp",d),g.useSyncedValues({disablePointerDismissal:o,nested:y,modal:s}),g.useContextCallback("onOpenChange",i),g.useContextCallback("onOpenChangeComplete",a);const x=g.useState("payload");nV({store:g,actionsRef:l,parentContext:p?.store.context,isDrawer:h});const v=m.useMemo(()=>({store:g}),[g]);return f.jsx(Y_.Provider,{value:!1,children:f.jsx(cA.Provider,{value:v,children:typeof t=="function"?t({payload:x}):t})})}let X_=(function(e){return e[e.open=wi.open]="open",e[e.closed=wi.closed]="closed",e[e.startingStyle=wi.startingStyle]="startingStyle",e[e.endingStyle=wi.endingStyle]="endingStyle",e.nested="data-nested",e.nestedDialogOpen="data-nested-dialog-open",e})({});const oV={...Lu,...bh,nested(e){return e?{[X_.nested]:""}:null},nestedDialogOpen(e){return e?{[X_.nestedDialogOpen]:""}:null}},sV=m.forwardRef(function(t,n){const{className:r,render:i,children:a,style:o,...s}=t,l=SR(),{store:c}=Co(),d=c.useState("open"),u=c.useState("nested"),p=c.useState("transitionStatus"),h=c.useState("nestedOpenDialogCount"),y=c.useState("mounted"),g=h>0;return Ur("div",t,{enabled:l||y,state:{open:d,nested:u,transitionStatus:p,nestedDialogOpen:g},ref:[n,c.useStateSetter("viewportElement")],stateAttributesMapping:oV,props:[{role:"presentation",hidden:!y,style:{pointerEvents:d?void 0:"none"},children:a},s]})}),lV=m.forwardRef(function(t,n){const{render:r,className:i,style:a,id:o,...s}=t,{store:l}=Co(),c=Ch(o);return l.useSyncedValueWithCleanup("titleElementId",c),Ur("h2",t,{ref:n,props:[{id:c},s]})}),cV=m.forwardRef(function(t,n){const{render:r,className:i,disabled:a=!1,focusableWhenDisabled:o=!1,nativeButton:s=!0,style:l,...c}=t,{getButtonProps:d,buttonRef:u}=Eh({disabled:a,focusableWhenDisabled:o,native:s});return Ur("button",t,{state:{disabled:a},ref:[n,u],props:[c,d]})}),Z_=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Q_=bt,uV=(e,t)=>n=>{var r;if(t?.variants==null)return Q_(e,n?.class,n?.className);const{variants:i,defaultVariants:a}=t,o=Object.keys(i).map(c=>{const d=n?.[c],u=a?.[c];if(d===null)return null;const p=Z_(d)||Z_(u);return i[c][p]}),s=n&&Object.entries(n).reduce((c,d)=>{let[u,p]=d;return p===void 0||(c[u]=p),c},{}),l=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((c,d)=>{let{class:u,className:p,...h}=d;return Object.entries(h).every(y=>{let[g,x]=y;return Array.isArray(x)?x.includes({...a,...s}[g]):{...a,...s}[g]===x})?[...c,u,p]:c},[]);return Q_(e,o,l,n?.class,n?.className)},dV=uV("group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",outline:"border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",ghost:"hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",destructive:"bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",xs:"h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",lg:"h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",icon:"size-8","icon-xs":"size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg","icon-lg":"size-9"}},defaultVariants:{variant:"default",size:"default"}});function LR({className:e,variant:t="default",size:n="default",...r}){return f.jsx(cV,{"data-slot":"button",className:ae(dV({variant:t,size:n,className:e})),...r})}function Sn({...e}){return f.jsx(aV,{"data-slot":"dialog",...e})}function fV({...e}){return f.jsx(K7,{"data-slot":"dialog-portal",...e})}function pV({className:e,...t}){return f.jsx(K8,{"data-slot":"dialog-overlay",className:ae("te-dialog-overlay",e),...t})}function En({className:e,children:t,showCloseButton:n=!0,...r}){return f.jsxs(fV,{children:[f.jsx(pV,{}),f.jsx("div",{"data-tauri-drag-region":!0,"aria-hidden":!0,className:"pointer-events-auto fixed inset-x-0 top-0 z-[70] h-8"}),f.jsx(sV,{className:"te-dialog-viewport fixed inset-0 z-[60] flex items-center justify-center",children:f.jsxs(q7,{"data-slot":"dialog-content",className:ae("te-dialog-popup relative grid w-full max-w-[calc(100%-2rem)] gap-4 rounded-xl bg-popover p-4 text-sm text-popover-foreground ring-1 ring-foreground/10 sm:max-w-sm",e),...r,children:[t,n&&f.jsxs(bA,{"data-slot":"dialog-close",render:f.jsx(LR,{variant:"ghost",className:"absolute top-2 right-2",size:"icon-sm"}),children:[f.jsx(Sr,{}),f.jsx("span",{className:"sr-only",children:"Close"})]})]})})]})}function Cn({className:e,...t}){return f.jsx("div",{"data-slot":"dialog-header",className:ae("flex flex-col gap-2",e),...t})}function D0({className:e,showCloseButton:t=!1,children:n,...r}){return f.jsxs("div",{"data-slot":"dialog-footer",className:ae("-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 sm:flex-row sm:justify-end",e),...r,children:[n,t&&f.jsx(bA,{render:f.jsx(LR,{variant:"outline"}),children:"Close"})]})}function jn({className:e,...t}){return f.jsx(lV,{"data-slot":"dialog-title",className:ae("font-heading text-base leading-none font-medium",e),...t})}function Pn({className:e,...t}){return f.jsx(cU,{"data-slot":"dialog-description",className:ae("text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",e),...t})}function hV(e){switch(e){case"lite":return"dialogs:account.membership.lite";case"pro":return"dialogs:account.membership.pro";case"premium":return"dialogs:account.membership.premium";default:return"dialogs:account.membership.free"}}async function J_(e){const t=await B("openloaf_web_url",{path:e});await Fb(t)}function mg({label:e,children:t}){return f.jsxs("div",{className:"flex items-start justify-between gap-4 border-b border-te-gray/30 py-3 last:border-b-0",children:[f.jsx("span",{className:"shrink-0 pt-0.5 font-mono text-xs uppercase tracking-[0.2em] text-te-light-gray",children:e}),f.jsx("div",{className:"min-w-0 flex-1 text-right",children:t})]})}function mV({open:e,onOpenChange:t}){const{t:n,i18n:r}=de(),{user:i,profile:a,isAuthenticated:o,init:s,loaded:l,logout:c}=pt(),[d,u]=m.useState(!1),p=a?.membershipLevel,h=n(p==="premium"?"dialogs:account.subscribe_button.manage":p==="pro"?"dialogs:account.subscribe_button.upgrade_to_premium":"dialogs:account.subscribe_button.default");m.useEffect(()=>{e&&s()},[e,s]),m.useEffect(()=>{e&&l&&!o&&t(!1)},[e,l,o,t]);const y=async()=>{if(!d){u(!0);try{await c()}finally{u(!1)}}},g=(a?.provider??"").toLowerCase()==="wechat",x=n(g?"dialogs:account.row.wechat":"dialogs:account.row.email"),v=g?a?.name??i?.name??"—":i?.email??a?.email??i?.name??"—",b=g?AW:BB;return f.jsx(Sn,{open:e,onOpenChange:t,children:f.jsxs(En,{className:"flex max-h-[88vh] w-[92vw] max-w-md flex-col !gap-0 rounded-none border border-te-dialog-border bg-te-dialog-bg p-0 shadow-2xl ring-0",children:[f.jsxs(Cn,{className:"border-b border-te-dialog-border bg-te-surface-hover px-5 py-4",children:[f.jsx(jn,{className:"font-mono text-base font-bold tracking-tighter text-te-fg",children:n("dialogs:account.title")}),f.jsx(Pn,{className:"sr-only",children:n("dialogs:account.description")})]}),f.jsx("div",{className:"flex-1 overflow-y-auto px-5 py-5",children:l?f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:"mb-5",children:[f.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[f.jsx("span",{className:"h-px w-4 bg-te-accent"}),f.jsx("span",{className:"font-mono text-[10px] uppercase tracking-[0.25em] text-te-light-gray",children:n("dialogs:account.section.identity")})]}),f.jsx(mg,{label:x,children:f.jsxs("span",{className:"inline-flex max-w-full items-start gap-2 font-mono text-sm text-te-fg",children:[f.jsx(b,{className:"mt-[3px] size-3.5 shrink-0 text-te-light-gray"}),f.jsx("span",{className:"break-all text-left",children:v})]})}),f.jsx(mg,{label:n("dialogs:account.row.subscription"),children:f.jsxs("span",{className:"inline-flex items-center gap-2 border border-te-accent/60 bg-te-accent/8 px-2.5 py-1 font-mono text-[11px] uppercase tracking-[0.15em] text-te-accent",children:[f.jsx("span",{className:"size-1.5 bg-te-accent"}),n(hV(p))]})}),f.jsx(mg,{label:n("dialogs:account.row.credits_balance"),children:f.jsx("span",{className:"font-mono text-sm tabular-nums text-te-fg",children:Math.round(a?.creditsBalance??0).toLocaleString(r.language)})})]}),f.jsxs("div",{className:"mb-5",children:[f.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[f.jsx("span",{className:"h-px w-4 bg-te-accent"}),f.jsx("span",{className:"font-mono text-[10px] uppercase tracking-[0.25em] text-te-light-gray",children:n("dialogs:account.section.subscription")})]}),f.jsxs("button",{type:"button",onClick:()=>{J_("/pricing")},className:"inline-flex w-full items-center justify-center gap-2 bg-te-accent px-4 py-2.5 font-mono text-xs uppercase tracking-[0.2em] text-te-accent-fg transition-colors hover:bg-te-accent/90",children:[f.jsx(ri,{className:"size-4"}),h]}),f.jsx("p",{className:"mt-2 font-sans text-xs text-te-light-gray",children:n("dialogs:account.subscribe_hint")})]}),f.jsxs("div",{className:"mb-5",children:[f.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[f.jsx("span",{className:"h-px w-4 bg-te-accent"}),f.jsx("span",{className:"font-mono text-[10px] uppercase tracking-[0.25em] text-te-light-gray",children:n("dialogs:account.section.recharge")})]}),f.jsxs("button",{type:"button",onClick:()=>{J_("/recharge")},className:"inline-flex w-full items-center justify-center gap-2 border border-te-gray px-4 py-2.5 font-mono text-xs uppercase tracking-[0.2em] text-te-fg transition-colors hover:border-te-accent hover:text-te-accent",children:[f.jsx(SB,{className:"size-4"}),n("dialogs:account.recharge_button")]}),f.jsx("p",{className:"mt-2 font-sans text-xs text-te-light-gray",children:n("dialogs:account.recharge_hint")})]}),f.jsxs("div",{children:[f.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[f.jsx("span",{className:"h-px w-4 bg-te-accent"}),f.jsx("span",{className:"font-mono text-[10px] uppercase tracking-[0.25em] text-te-light-gray",children:n("dialogs:account.section.session")})]}),f.jsxs("button",{type:"button",onClick:y,disabled:d,className:"inline-flex w-full items-center justify-center gap-2 border border-te-gray px-4 py-2.5 font-mono text-xs uppercase tracking-[0.2em] text-te-fg transition-colors hover:border-te-accent hover:text-te-accent disabled:opacity-50",children:[f.jsx(zB,{className:"size-4"}),n(d?"dialogs:account.logout_busy":"dialogs:account.logout_button")]}),f.jsx("p",{className:"mt-2 font-sans text-xs text-te-light-gray",children:n("dialogs:account.logout_hint")})]})]}):f.jsx("div",{className:"py-10 text-center font-mono text-xs uppercase tracking-[0.25em] text-te-light-gray",children:n("dialogs:account.loading")})})]})})}var eS;(function(e){e.Nsis="nsis",e.Msi="msi",e.Deb="deb",e.Rpm="rpm",e.AppImage="appimage",e.App="app"})(eS||(eS={}));async function Ah(){return B("plugin:app|version")}async function gV(){return await B("plugin:autostart|is_enabled")}async function yV(){await B("plugin:autostart|enable")}async function vV(){await B("plugin:autostart|disable")}async function $R(e){try{if(await gV()===e)return;e?await yV():await vV(),console.log("[autostart] synced →",e)}catch(t){console.warn("[autostart] sync failed:",t)}}async function xV(e){return await B("dictation_test_provider",{req:e})}function bV(){return typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID():`ex_${Date.now()}_${Math.random().toString(36).slice(2,8)}`}const zR=["*","chat","code","doc","email","browser","meeting","other"];function wV(e){const t=(e??"").trim().toLowerCase();return zR.includes(t)?t:"*"}function gg({description:e,value:t,isCustom:n,onChange:r,onReset:i,textareaRows:a=18}){const{t:o}=de("settings");return f.jsxs("div",{className:"flex flex-col gap-4",children:[f.jsx(kV,{description:e,isCustom:n,onReset:i}),f.jsx("textarea",{value:t,onChange:s=>r(s.target.value),rows:a,className:"w-full resize-y border border-te-gray/40 bg-te-surface p-3 font-mono text-xs leading-relaxed text-te-fg outline-none transition-colors focus:border-te-accent"}),f.jsx("p",{className:"font-sans text-[11px] leading-relaxed text-te-light-gray/70",children:o("ai.prompt_panel_save_hint")})]})}function kV({description:e,isCustom:t,onReset:n}){const{t:r}=de("settings");return f.jsxs("div",{className:"flex items-start justify-between gap-4 border-b border-te-gray/30 pb-3",children:[f.jsxs("div",{className:"flex flex-1 flex-col gap-1.5",children:[f.jsx("div",{className:"flex items-center gap-2",children:f.jsx("span",{className:ae("border px-1.5 py-px font-mono text-[10px] uppercase tracking-[0.2em]",t?"border-te-accent/60 text-te-accent":"border-te-gray/40 text-te-light-gray"),children:r(t?"ai.refine_status_modified":"ai.refine_status_default")})}),f.jsx("p",{className:"font-sans text-xs leading-relaxed text-te-light-gray",children:e})]}),f.jsxs("button",{type:"button",disabled:!t,onClick:n,className:"inline-flex shrink-0 items-center gap-1.5 border border-te-gray bg-te-surface px-3 py-1.5 font-mono text-[10px] uppercase tracking-[0.2em] text-te-light-gray transition-colors enabled:hover:border-te-accent enabled:hover:text-te-accent disabled:cursor-not-allowed disabled:opacity-40",children:[f.jsx(Aa,{className:"size-3"}),r("ai.prompt_reset")]})]})}function _V({examples:e,onChange:t}){const{t:n}=de("settings"),r=e.length>=Av,i=(s,l)=>{t(e.map((c,d)=>d===s?{...c,...l}:c))},a=s=>{t(e.filter((l,c)=>c!==s))},o=()=>{r||t([...e,{id:bV(),target:"*",input:"",focus:"",output:""}])};return f.jsxs("div",{className:"flex flex-col gap-4",children:[f.jsxs("div",{className:"flex items-baseline justify-between gap-2",children:[f.jsx("h3",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-te-fg",children:n("ai.refine_examples_my_title")}),f.jsx("span",{className:"font-mono text-[10px] uppercase tracking-[0.2em] text-te-light-gray",children:n("ai.refine_examples_count",{current:e.length,max:Av})})]}),e.length>0&&f.jsx("div",{className:"flex flex-col gap-4",children:e.map((s,l)=>f.jsx(SV,{example:s,onChange:c=>i(l,c),onRemove:()=>a(l)},s.id))}),f.jsxs("button",{type:"button",disabled:r,onClick:o,className:"inline-flex w-full items-center justify-center gap-2 border border-dashed border-te-gray/60 px-4 py-3 font-mono text-xs uppercase tracking-[0.2em] text-te-light-gray transition-colors enabled:hover:border-te-accent enabled:hover:text-te-accent disabled:cursor-not-allowed disabled:opacity-40",children:[f.jsx(us,{className:"size-3.5"}),n("ai.refine_example_add")]})]})}function SV({example:e,onChange:t,onRemove:n}){const{t:r}=de("settings"),i=wV(e.target);return f.jsxs("div",{className:"flex flex-col gap-3 border border-te-gray/40 bg-te-surface/50 px-4 py-4",children:[f.jsxs("div",{className:"flex items-start justify-between gap-3",children:[f.jsxs("label",{className:"flex flex-1 flex-col gap-1.5",children:[f.jsx("span",{className:"font-mono text-[10px] uppercase tracking-[0.2em] text-te-light-gray",children:r("ai.refine_example_target_label")}),f.jsx("select",{value:i,onChange:a=>t({target:a.target.value}),className:"w-full appearance-none border border-te-gray/40 bg-te-surface px-3 py-1.5 font-sans text-sm text-te-fg outline-none transition-colors focus:border-te-accent",children:zR.map(a=>f.jsx("option",{value:a,children:r(`ai.refine_example_target_option.${a}`)},a))})]}),f.jsxs("button",{type:"button",onClick:n,"aria-label":r("ai.refine_example_remove")??"Remove",className:"mt-6 inline-flex shrink-0 items-center gap-1 border border-te-gray/40 px-2 py-1.5 font-mono text-[10px] uppercase tracking-[0.2em] text-te-light-gray transition-colors hover:border-red-400 hover:text-red-400",children:[f.jsx(di,{className:"size-3"}),r("ai.refine_example_remove")]})]}),f.jsxs("label",{className:"flex flex-col gap-1.5",children:[f.jsx("span",{className:"font-mono text-[10px] uppercase tracking-[0.2em] text-te-light-gray",children:r("ai.refine_example_input_label")}),f.jsx("textarea",{value:e.input,onChange:a=>t({input:a.target.value}),rows:3,placeholder:r("ai.refine_example_input_placeholder_v2")??"",className:"w-full resize-y border border-te-gray/40 bg-te-surface p-2 font-sans text-sm leading-relaxed text-te-fg outline-none transition-colors focus:border-te-accent"})]}),f.jsxs("label",{className:"flex flex-col gap-1.5",children:[f.jsx("span",{className:"font-mono text-[10px] uppercase tracking-[0.2em] text-te-light-gray",children:r("ai.refine_example_output_label")}),f.jsx("textarea",{value:e.output,onChange:a=>t({output:a.target.value}),rows:3,placeholder:r("ai.refine_example_output_placeholder_v2")??"",className:"w-full resize-y border border-te-gray/40 bg-te-surface p-2 font-sans text-sm leading-relaxed text-te-fg outline-none transition-colors focus:border-te-accent"})]}),f.jsxs("label",{className:"flex flex-col gap-1.5",children:[f.jsx("span",{className:"font-mono text-[10px] uppercase tracking-[0.2em] text-te-light-gray",children:r("ai.refine_example_focus_label")}),f.jsx("input",{type:"text",value:e.focus,onChange:a=>t({focus:a.target.value}),placeholder:r("ai.refine_example_focus_placeholder_v2")??"",className:"w-full border border-te-gray/40 bg-te-surface px-3 py-1.5 font-sans text-sm text-te-fg outline-none transition-colors focus:border-te-accent"})]})]})}function EV({scenarios:e,onChange:t}){const{t:n}=de("settings"),r=re(u=>u.general.interfaceLang),i=re(u=>u.dictation.lang),a=lr(i,r),o=e??Zo[a],s=e!==null,l=(u,p)=>{const y=(e??Zo[a]).map((g,x)=>x===u?{...g,...p}:g);t(y)},c=u=>{const h=(e??Zo[a]).filter((y,g)=>g!==u);t(h)},d=()=>{const u=e??Zo[a],p=typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID():`scn_${Date.now()}_${Math.random().toString(36).slice(2,8)}`,h=[...u,{id:p,name:n("ai.polish_scenario_default_name"),instruction:""}];t(h)};return f.jsxs("div",{className:"flex flex-col gap-3",children:[f.jsxs("div",{className:"flex items-end justify-between gap-3",children:[f.jsxs("div",{children:[f.jsx("div",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-te-light-gray",children:n("ai.polish_scenarios_title")}),f.jsx("div",{className:"mt-1 font-sans text-xs text-te-light-gray/80",children:n("ai.polish_scenarios_hint")})]}),f.jsxs("button",{type:"button",disabled:!s,onClick:()=>t(null),className:"inline-flex items-center gap-1.5 border border-te-gray bg-te-surface px-3 py-1.5 font-mono text-[10px] uppercase tracking-[0.2em] text-te-light-gray transition-colors enabled:hover:border-te-accent enabled:hover:text-te-accent disabled:cursor-not-allowed disabled:opacity-40",children:[f.jsx(Aa,{className:"size-3"}),n("ai.prompt_reset")]})]}),o.length===0?f.jsx("div",{className:"border border-dashed border-te-gray/40 px-4 py-6 text-center font-mono text-xs text-te-light-gray",children:n("ai.polish_scenarios_empty")}):f.jsx("div",{className:"flex flex-col gap-3",children:o.map((u,p)=>f.jsxs("div",{className:"flex flex-col gap-2 border border-te-gray/40 bg-te-surface/50 px-3 py-3",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("input",{type:"text",value:u.name,onChange:h=>l(p,{name:h.target.value}),className:"flex-1 border border-te-gray/40 bg-te-surface px-3 py-1.5 font-mono text-sm text-te-fg outline-none transition-colors focus:border-te-accent"}),f.jsxs("button",{type:"button",onClick:()=>c(p),className:"inline-flex items-center gap-1 border border-te-gray/60 px-3 py-1.5 font-mono text-[11px] uppercase tracking-[0.2em] text-te-light-gray transition-colors hover:border-red-400 hover:text-red-400",children:[f.jsx(di,{className:"size-3"}),n("ai.polish_scenario_remove")]})]}),f.jsx("textarea",{value:u.instruction,onChange:h=>l(p,{instruction:h.target.value}),rows:3,placeholder:n("ai.polish_scenario_instruction_placeholder")??"",className:"w-full resize-y border border-te-gray/40 bg-te-surface p-2 font-mono text-xs text-te-fg outline-none transition-colors focus:border-te-accent"})]},u.id))}),f.jsx("div",{children:f.jsxs("button",{type:"button",onClick:d,className:"inline-flex items-center gap-2 border border-te-gray/60 px-4 py-2 font-mono text-xs uppercase tracking-[0.2em] text-te-fg transition-colors hover:border-te-accent hover:text-te-accent",children:[f.jsx(us,{className:"size-3.5"}),n("ai.polish_scenario_add")]})})]})}const CV="openspeech://hotkey-recording",jV=4e3,tS=8e3,L0={comfortable:{row:"py-5",label:"text-sm",hint:"mt-1 text-[11px] text-te-light-gray/70",button:"h-[44px] w-[20rem]",chip:"h-7 min-w-[1.75rem] px-2 text-xs",chipSep:"text-xs",placeholder:"text-xs tracking-[0.18em]"},compact:{row:"py-3",label:"text-sm",hint:null,button:"h-[34px] min-w-[12rem]",chip:"h-5 min-w-[1.4rem] px-1.5 text-[11px]",chipSep:"text-[10px]",placeholder:"text-[11px] tracking-[0.15em]"}};function $0({filterIds:e,divided:t=!0,size:n="compact"}){const r=e&&e.length>0?e:ub;return f.jsx("div",{className:ae(t&&"divide-y divide-te-gray/30"),children:r.map(i=>f.jsx(PV,{id:i,size:n},i))})}function PV({id:e,size:t}){const n=L0[t],{t:r}=de(),i=cn(),a=nn(z=>z.bindings[e]),o=nn(z=>z.allowSpecialKeys),s=nn(z=>z.setBinding),l=nn(z=>z.recordUndo),c=nn(z=>z.applyUndo),d=qe(z=>z.clearHotkeyConflict),[u,p]=m.useState({kind:"idle"}),h=m.useRef(null),y=m.useRef(null),g=m.useRef(null),x=m.useRef([]),v=m.useRef([]),b=m.useRef({}),w=m.useRef(!1),_=m.useRef(!1),k=m.useRef(!1),S=m.useRef({}),E=()=>{const{down:z,up:$}=S.current;z&&document.removeEventListener("keydown",z,{capture:!0}),$&&document.removeEventListener("keyup",$,{capture:!0}),S.current={}},C=()=>{E();const z=H=>{H.preventDefault(),H.stopPropagation(),H.stopImmediatePropagation(),O.current(H.code)},$=H=>{I.current(H.code)};document.addEventListener("keydown",z,{capture:!0}),document.addEventListener("keyup",$,{capture:!0}),S.current={down:z,up:$}},j=()=>{_.current||(_.current=!0,B("set_hotkey_recording",{enabled:!0}).catch(z=>console.warn("[HotkeyBinder] set_hotkey_recording(true) failed:",z)))},T=()=>{_.current&&(_.current=!1,B("set_hotkey_recording",{enabled:!1}).catch(z=>console.warn("[HotkeyBinder] set_hotkey_recording(false) failed:",z)))},A=()=>{u.kind!=="recording"&&(x.current=[],v.current=[],b.current={},w.current=!1,k.current=!1,g.current&&(window.clearTimeout(g.current),g.current=null),C(),j(),p({kind:"recording",everPressedMods:[],everPressedSides:{}}),y.current&&window.clearTimeout(y.current),y.current=window.setTimeout(()=>{E(),T(),p({kind:"idle"})},jV))},R=()=>{E(),T(),y.current&&(window.clearTimeout(y.current),y.current=null),p({kind:"idle"})};m.useEffect(()=>()=>{E(),T(),y.current&&window.clearTimeout(y.current),g.current&&window.clearTimeout(g.current)},[]);const D=z=>{E(),T(),y.current&&(window.clearTimeout(y.current),y.current=null),g.current&&window.clearTimeout(g.current),p({kind:"error",message:z}),g.current=window.setTimeout(()=>{g.current=null,p({kind:"idle"})},2500)};m.useEffect(()=>{if(u.kind!=="recording")return;const z=H=>{h.current&&!h.current.contains(H.target)&&R()},$=()=>{window.setTimeout(()=>{document.visibilityState==="hidden"&&R()},800)};return window.addEventListener("mousedown",z),window.addEventListener("blur",$),()=>{window.removeEventListener("mousedown",z),window.removeEventListener("blur",$)}},[u.kind]);const M=async z=>{await s(e,z),d(e)},O=m.useRef(()=>{}),I=m.useRef(()=>{});O.current=z=>{if(k.current)return;if(z==="Escape"){R();return}if(F1(z)){const q=Lf(z);if(!q)return;const X=db(z),te=x.current.includes(q),ue=v.current.includes(q);if(te&&ue)return;if(te||(x.current=cf([...x.current,q])),!ue){v.current=cf([...v.current,q]),q!=="fn"&&X&&(b.current={...b.current,[q]:X});const G=v.current,be=b.current;p(xe=>xe.kind==="recording"?{kind:"recording",everPressedMods:G,everPressedSides:be}:xe)}return}if(w.current)return;w.current=!0;const $=cf(x.current),H=$$(z,$,o);if(!H.ok){D(H.reason??r("dialogs:hotkey_field.error_illegal_combo"));return}const oe={kind:"combo",mods:$,code:z,modSides:nS(b.current,$)};L(oe)},I.current=z=>{if(k.current||!F1(z))return;const $=Lf(z);if($&&x.current.includes($)&&(x.current=x.current.filter(H=>H!==$),x.current.length===0&&!w.current&&v.current.length>0)){const H={kind:"modifierOnly",mods:v.current,code:"",modSides:nS(b.current,v.current)};L(H)}};const L=z=>{if(k.current)return;k.current=!0;const $=z$(z,i,o);if(!$.ok){k.current=!1,D($.reason??r("dialogs:hotkey_field.error_illegal_combo"));return}const H=F$(nn.getState().bindings,z,e);if(H){E(),T(),y.current&&(window.clearTimeout(y.current),y.current=null),p({kind:"conflict",with:H.with,candidate:z,reason:H.kind});return}M(z),R()};m.useEffect(()=>{if(u.kind!=="recording")return;let z=!1,$=null;return Ue(CV,H=>{const{code:oe,phase:q}=H.payload;q==="pressed"?O.current(oe):I.current(oe)}).then(H=>{z?H():$=H}),()=>{z=!0,$?.()}},[u.kind]);const V=async()=>{if(u.kind!=="conflict")return;const z=u.with,$=u.candidate,H=nn.getState().bindings[z];await s(z,null),await s(e,$),await l({replacedId:z,oldValue:H,changedId:e,newValue:$,expiresAt:Date.now()+tS}),d(e),d(z),ke(r("dialogs:hotkey_field.replaced_toast",{name:Pm[z]}),{duration:tS,action:{label:r("dialogs:hotkey_field.undo"),onClick:()=>{c()}}}),R()},F=()=>{p({kind:"idle"}),requestAnimationFrame(()=>A())},N=()=>R(),Q=e!=="dictate_ptt"&&!!a&&u.kind!=="recording",P=u.kind==="idle"&&a?B$(a,i):[];return f.jsxs("div",{className:ae("flex flex-col gap-1.5",n.row),ref:h,children:[f.jsxs("div",{className:"flex items-center justify-between gap-4",children:[f.jsxs("div",{className:"flex flex-col",children:[f.jsx("span",{className:ae("font-sans text-te-fg",n.label),children:Pm[e]}),n.hint?f.jsx("span",{className:ae("font-sans",n.hint),children:r(`hotkey:binding_hint.${e}`)}):null]}),f.jsxs("div",{className:"group relative",children:[f.jsx(tn,{mode:"wait",initial:!1,children:u.kind==="recording"?f.jsx(je.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.1},className:ae("inline-flex items-center justify-center border px-3","border-te-accent bg-te-accent/8",n.button),"aria-live":"polite",children:u.everPressedMods.length===0?f.jsx("span",{className:ae("font-mono uppercase text-te-accent opacity-80 animate-[pulse_1.4s_ease-in-out_infinite]",n.placeholder),children:r("dialogs:hotkey_field.press_new")}):f.jsx(yg,{items:u.everPressedMods.map(z=>BR(z,i,z==="fn"?null:u.everPressedSides[z]??null)),tone:"active",size:t})},"recording"):u.kind==="conflict"?f.jsx(je.button,{type:"button",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.1},onClick:F,className:ae("inline-flex items-center justify-center border border-te-accent/70 bg-te-accent/8 px-3",n.button),children:f.jsx(yg,{items:rS(u.candidate,i),tone:"active",size:t})},"conflict"):f.jsx(je.button,{type:"button",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.1},onClick:A,className:ae("inline-flex items-center justify-center border px-3 transition-colors","border-te-gray/40 bg-te-surface hover:border-te-gray",u.kind==="error"&&"border-te-accent/70 animate-[shake_0.25s]",Q&&"px-7",n.button),children:a?f.jsx(yg,{items:rS(a,i),tone:"idle",size:t}):f.jsx("span",{className:ae("font-mono uppercase text-te-light-gray",n.placeholder),children:r("hotkey:format.unbound")})},"display")}),Q?f.jsx("button",{type:"button",title:r("dialogs:hotkey_field.clear_title"),"aria-label":r("dialogs:hotkey_field.clear_aria"),onClick:z=>{z.stopPropagation(),M(null)},onMouseDown:z=>z.stopPropagation(),className:"absolute top-1/2 right-1.5 -translate-y-1/2 flex size-5 items-center justify-center text-te-light-gray opacity-0 transition-opacity group-hover:opacity-100 hover:text-te-fg focus-visible:opacity-100",children:f.jsx(Sr,{className:"size-3.5"})}):null]})]}),f.jsxs(tn,{initial:!1,children:[u.kind==="recording"?f.jsx(je.p,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},className:"text-right font-mono text-[10px] tracking-[0.18em] text-te-light-gray/70 uppercase",children:r("dialogs:hotkey_field.recording_hint")},"hint"):null,u.kind==="error"?f.jsxs(je.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},className:"flex items-center justify-end gap-1.5 font-mono text-[11px] text-te-accent",children:[f.jsx(Kf,{className:"size-3"}),f.jsxs("span",{children:[r("dialogs:hotkey_field.error_prefix"),": ",u.message]})]},"error"):null,u.kind==="conflict"?f.jsxs(je.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},className:"flex flex-col items-end gap-1.5 font-mono text-[11px]",children:[f.jsx("span",{className:"text-te-light-gray",children:r(`dialogs:hotkey_field.conflict_reason.${u.reason}`,{name:Pm[u.with]})}),f.jsxs("div",{className:"flex items-center gap-1.5",children:[f.jsx(vg,{variant:"ghost",onClick:N,children:r("dialogs:hotkey_field.cancel")}),f.jsxs(vg,{variant:"ghost",onClick:F,children:[f.jsx(Aa,{className:"size-3","aria-hidden":!0}),r("dialogs:hotkey_field.rebind")]}),f.jsx(vg,{variant:"solid",onClick:()=>{V()},children:r("dialogs:hotkey_field.replace")})]})]},"conflict-bar"):null,P.length>0?f.jsx(je.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},className:"flex flex-col items-end gap-0.5 font-mono text-[11px] text-te-accent/70",children:P.map(z=>f.jsxs("span",{className:"flex items-center gap-1.5",children:[f.jsx(Kf,{className:"size-3"}),r(z)]},z))},"warning-bar"):null]})]})}function nS(e,t){const n={};for(const r of t){if(r==="fn")continue;const i=e[r];i&&(n[r]=i)}return n}function NV({label:e,icon:t,side:n,tone:r,size:i}){return f.jsxs("span",{className:ae("inline-flex items-center justify-center border font-mono leading-none normal-case",r==="active"?"border-te-accent/50 bg-te-accent/12 text-te-accent":"border-te-gray/50 bg-te-surface-hover text-te-fg",L0[i].chip),children:[t?f.jsx("span",{"aria-hidden":!0,className:"mr-1 inline-flex items-center opacity-70",children:t}):null,n?f.jsx("span",{"aria-hidden":!0,className:"mr-1 text-[0.7em] font-bold opacity-70",children:n==="left"?"L":"R"}):null,e]})}function yg({items:e,tone:t,size:n}){return f.jsx("span",{className:"inline-flex items-center gap-1.5",children:e.map((r,i)=>f.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[i>0?f.jsx("span",{className:ae("font-mono leading-none",t==="active"?"text-te-accent/55":"text-te-light-gray/60",L0[n].chipSep),children:"+"}):null,f.jsx(NV,{label:r.label,icon:r.icon,side:r.side,tone:t,size:n})]},i))})}function FR(e,t){return hb(e,t,11)}function BR(e,t,n){return{label:fh(e,t),icon:FR(e,t),side:fb(e,t,n)??void 0}}function rS(e,t){if(e.kind==="doubleTap"&&e.mods.length>0){const r=e.mods[0];return[{label:`2× ${fh(r,t)}`,icon:FR(r,t),side:fb(r,t,wv(e,r))??void 0}]}const n=e.mods.map(r=>BR(r,t,wv(e,r)));return e.kind==="combo"&&e.code&&n.push({label:pb(e.code),icon:W$[e.code]}),n}function vg({onClick:e,children:t,variant:n}){return f.jsx("button",{type:"button",onClick:e,onMouseDown:r=>r.stopPropagation(),className:ae("inline-flex items-center gap-1 px-2.5 py-1 font-mono text-[11px] uppercase tracking-[0.15em] transition-colors",n==="solid"?"border border-te-accent bg-te-accent text-te-accent-fg hover:bg-te-accent/90":"border border-te-gray/40 text-te-light-gray hover:border-te-gray hover:text-te-fg"),children:t})}const fp={recordingControls:{id:"recordingControls",category:"action",threshold:3,autoHideMs:5e3,showDelayMs:500,i18nKeyPrefix:"recordingControls",devDescription:"录音中:松开结束 / ESC 取消"},resultActions:{id:"resultActions",category:"action",threshold:3,autoHideMs:6e3,showDelayMs:300,i18nKeyPrefix:"resultActions",devDescription:"结果态:复制 / 编辑 / 润色 / 翻译"},firstResultConfirm:{id:"firstResultConfirm",category:"confirm",threshold:1,autoHideMs:8e3,showDelayMs:0,i18nKeyPrefix:"firstResultConfirm",devDescription:"全局首次结果:✓ 已输入 · 修正"}};function WR(e,t){if(!e||!e.showHints)return!1;const n=fp[t];if(!n)return!1;const r=e.hints[t]??{successCount:0,dismissed:!1};return!(r.dismissed||r.successCount>=n.threshold)}const Nf=ui(e=>({forced:{},setForced:(t,n)=>e(r=>({forced:{...r.forced,[t]:n}})),clearAll:()=>e({forced:{}})}));function TV(){const{t:e}=de("settings"),t=re(u=>u.ui),n=re(u=>u.setShowHints),r=re(u=>u.markHintSuccess),i=re(u=>u.dismissHint),a=re(u=>u.resetHint),o=re(u=>u.resetAllHints),s=Nf(u=>u.forced),l=Nf(u=>u.setForced),c=Nf(u=>u.clearAll),d=Object.keys(fp);return f.jsxs("div",{className:"flex flex-col gap-4",children:[f.jsxs("div",{className:"flex items-center justify-between gap-3 border border-te-accent/40 bg-te-surface px-3 py-2",children:[f.jsxs("div",{className:"flex items-center gap-3",children:[f.jsx("span",{className:"font-mono text-[10px] uppercase tracking-[0.2em] text-te-accent",children:e("dev_hints.title")}),f.jsx("span",{className:"font-mono text-[10px] text-te-light-gray",children:e("dev_hints.subtitle")})]}),f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsxs("label",{className:"flex items-center gap-2 font-mono text-[11px] text-te-fg",children:[f.jsx("input",{type:"checkbox",checked:t.showHints,onChange:u=>{n(u.target.checked)},className:"size-3.5 accent-te-accent"}),e("dev_hints.global_switch")]}),f.jsx("button",{type:"button",onClick:()=>{o(),c()},className:"border border-te-gray/60 px-2 py-1 font-mono text-[11px] uppercase tracking-[0.1em] text-te-light-gray hover:border-te-accent hover:text-te-accent",children:e("dev_hints.reset_all")})]})]}),f.jsx("div",{className:"overflow-x-auto",children:f.jsxs("table",{className:"w-full border-collapse font-mono text-[11px]",children:[f.jsx("thead",{children:f.jsxs("tr",{className:"border-b border-te-gray/40 text-left text-te-light-gray",children:[f.jsx("th",{className:"px-2 py-2",children:e("dev_hints.col_id")}),f.jsx("th",{className:"px-2 py-2",children:e("dev_hints.col_category")}),f.jsx("th",{className:"px-2 py-2",children:e("dev_hints.col_threshold")}),f.jsx("th",{className:"px-2 py-2",children:e("dev_hints.col_success")}),f.jsx("th",{className:"px-2 py-2",children:e("dev_hints.col_dismissed")}),f.jsx("th",{className:"px-2 py-2",children:e("dev_hints.col_should")}),f.jsx("th",{className:"px-2 py-2",children:e("dev_hints.col_actions")})]})}),f.jsx("tbody",{children:d.map(u=>{const p=fp[u],h=t.hints[u]??{successCount:0,dismissed:!1},y=WR(t,u),g=s[u]===!0;return f.jsxs("tr",{className:"border-b border-te-gray/30 align-top text-te-fg",children:[f.jsxs("td",{className:"px-2 py-2",children:[f.jsx("div",{children:u}),f.jsx("div",{className:"mt-0.5 text-te-light-gray/80",children:p.devDescription})]}),f.jsx("td",{className:"px-2 py-2 text-te-light-gray",children:p.category}),f.jsx("td",{className:"px-2 py-2 tabular-nums",children:p.threshold}),f.jsx("td",{className:"px-2 py-2 tabular-nums",children:h.successCount}),f.jsx("td",{className:"px-2 py-2",children:h.dismissed?f.jsx("span",{className:"text-te-accent",children:e("dev_hints.yes")}):f.jsx("span",{className:"text-te-light-gray",children:e("dev_hints.no")})}),f.jsx("td",{className:"px-2 py-2",children:f.jsx("span",{className:ae("px-1.5 py-0.5",y?"border border-te-accent text-te-accent":"border border-te-gray/40 text-te-light-gray"),children:e(y?"dev_hints.yes":"dev_hints.no")})}),f.jsx("td",{className:"px-2 py-2",children:f.jsxs("div",{className:"flex flex-wrap items-center gap-1",children:[f.jsx("button",{type:"button",onClick:()=>{r(u)},className:"border border-te-gray/60 px-1.5 py-0.5 text-te-light-gray hover:border-te-accent hover:text-te-accent",children:"+1"}),f.jsx("button",{type:"button",onClick:()=>{i(u)},disabled:h.dismissed,className:"border border-te-gray/60 px-1.5 py-0.5 text-te-light-gray hover:border-te-accent hover:text-te-accent disabled:opacity-40",children:e("dev_hints.dismiss")}),f.jsx("button",{type:"button",onClick:()=>{a(u)},className:"border border-te-gray/60 px-1.5 py-0.5 text-te-light-gray hover:border-te-accent hover:text-te-accent",children:e("dev_hints.reset")}),f.jsx("button",{type:"button",onClick:()=>l(u,!g),className:ae("border px-1.5 py-0.5",g?"border-te-accent bg-te-accent text-te-bg":"border-te-gray/60 text-te-light-gray hover:border-te-accent hover:text-te-accent"),children:e(g?"dev_hints.forcing":"dev_hints.force")})]})})]},u)})})]})}),f.jsx("p",{className:"font-mono text-[10px] leading-relaxed text-te-light-gray/80",children:e("dev_hints.note")})]})}function OV(){const{t:e}=de("settings");return[{id:"GENERAL",label:e("tabs.general"),icon:wW},{id:"HOTKEYS",label:e("tabs.hotkeys"),icon:zO},{id:"DICTATION",label:e("tabs.dictation"),icon:as},{id:"AI",label:e("tabs.ai"),icon:AO},{id:"PROMPTS",label:e("tabs.prompts"),icon:Gb},{id:"ABOUT",label:e("tabs.about"),icon:Kb}]}function yi({children:e}){return f.jsxs("div",{className:"mt-10 mb-4 flex items-center gap-3 first:mt-0",children:[f.jsx("span",{className:"h-px w-4 bg-te-accent"}),f.jsx("h3",{className:"font-mono text-xs uppercase tracking-[0.25em] text-te-light-gray",children:e})]})}function rn({label:e,hint:t,children:n}){return f.jsxs("div",{className:"flex items-center justify-between gap-6 border-b border-te-gray/30 py-4 last:border-b-0",children:[f.jsxs("div",{className:"min-w-0 flex-1",children:[f.jsx("div",{className:"font-sans text-sm text-te-fg",children:e}),t?f.jsx("div",{className:"mt-1 font-sans text-xs text-te-light-gray/80",children:t}):null]}),f.jsx("div",{className:"shrink-0",children:n})]})}function Jo({checked:e,onChange:t,disabled:n}){return f.jsx("button",{type:"button",disabled:n,onClick:()=>t(!e),className:ae("relative flex h-[22px] w-10 items-center rounded-sm border transition-colors",e?"border-te-accent bg-te-accent":"border-te-gray/60 bg-te-gray",n&&"cursor-not-allowed opacity-40"),"aria-pressed":e,"aria-disabled":n,children:f.jsx(je.span,{layout:!0,transition:{type:"tween",duration:.18},className:ae("size-4",e?"ml-auto mr-[2px] bg-te-accent-fg":"ml-[2px] bg-te-bg")})})}function io({value:e,options:t,onChange:n,className:r}){const i=t.map(a=>typeof a=="string"?{value:a,label:a}:a);return f.jsxs("div",{className:ae("relative inline-flex items-center border border-te-gray/40 bg-te-surface transition-colors focus-within:border-te-accent hover:border-te-gray",r),children:[f.jsx("select",{value:e,onChange:a=>n(a.target.value),className:"min-w-[10rem] cursor-pointer appearance-none bg-transparent py-2 pr-8 pl-3 font-mono text-sm text-te-fg focus:outline-none",children:i.map(a=>f.jsx("option",{value:a.value,children:a.label},a.value))}),f.jsx(Pa,{className:"pointer-events-none absolute right-2 size-3.5 text-te-light-gray"})]})}function Qv({value:e,options:t,onChange:n}){return f.jsx("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2",children:t.map(r=>{const i=r.value===e;return f.jsxs("button",{type:"button",onClick:()=>n(r.value),className:ae("group relative flex flex-col items-start gap-1 border px-4 py-3 text-left transition-colors",i?"border-te-accent bg-te-accent/8 text-te-accent":"border-te-gray/40 text-te-fg hover:border-te-gray"),children:[f.jsxs("div",{className:"flex w-full items-center justify-between",children:[f.jsx("span",{className:"font-mono text-xs uppercase tracking-[0.15em]",children:r.label}),f.jsx("span",{className:ae("size-2",i?"bg-te-accent":"bg-te-gray")})]}),r.hint?f.jsx("span",{className:ae("font-sans text-xs",i?"text-te-accent/80":"text-te-light-gray"),children:r.hint}):null]},r.value)})})}function AV({peak:e}){const t=Math.max(0,Math.min(1,e)),n=t<.03?0:Math.sqrt(t),r=n===0?0:Math.min(5,Math.max(1,Math.ceil(n*5)));return f.jsx("div",{className:"flex items-center gap-1",children:Array.from({length:5}).map((i,a)=>f.jsx("span",{className:ae("h-4 w-6 border transition-colors",a<r?"border-te-accent bg-te-accent":"border-te-gray/40 bg-te-surface")},a))})}function RV(){const{t:e}=de("settings"),t=re(l=>l.general),n=re(l=>l.setGeneral),r=re(l=>l.dictation),i=re(l=>l.setDictationLang),a=re(l=>l.loaded),s=m.useMemo(()=>YW(r.lang,t.interfaceLang),[r.lang,t.interfaceLang])===t.translateTargetLang;return f.jsxs("div",{children:[f.jsx(yi,{children:e("section.language")}),f.jsx(rn,{label:e("general.interface_lang"),children:f.jsx(io,{value:t.interfaceLang,onChange:l=>{n("interfaceLang",l)},options:[{value:"system",label:e("common:lang.system")},{value:"zh-CN",label:e("common:lang.zh-CN")},{value:"zh-TW",label:e("common:lang.zh-TW")},{value:"en",label:e("common:lang.en")}]})}),f.jsx(rn,{label:e("general.dictation_output_lang"),hint:e("general.dictation_output_lang_hint"),children:f.jsx(io,{value:r.lang==="follow_interface"?"auto":r.lang,onChange:l=>{i(l)},options:[{value:"auto",label:e("dictation_lang.auto")},{value:"zh",label:e("dictation_lang.zh")},{value:"en",label:e("dictation_lang.en")},{value:"ja",label:e("dictation_lang.ja")},{value:"ko",label:e("dictation_lang.ko")},{value:"yue",label:e("dictation_lang.yue")}]})}),f.jsx(rn,{label:e("general.translate_target_lang"),hint:e("general.translate_target_lang_hint"),children:f.jsx(io,{value:t.translateTargetLang,onChange:l=>{n("translateTargetLang",l)},options:[{value:"en",label:e("translate_target_lang.en")},{value:"zh",label:e("translate_target_lang.zh")},{value:"zh-TW",label:e("translate_target_lang.zh-TW")},{value:"ja",label:e("translate_target_lang.ja")},{value:"ko",label:e("translate_target_lang.ko")},{value:"fr",label:e("translate_target_lang.fr")},{value:"de",label:e("translate_target_lang.de")},{value:"es",label:e("translate_target_lang.es")}]})}),s&&f.jsx("div",{className:"-mt-2 mb-3 px-1 font-mono text-[11px] uppercase tracking-[0.15em] text-red-500",children:e("general.translate_conflict_warning")}),f.jsx(rn,{label:e("general.translate_output_mode"),hint:e("general.translate_output_mode_hint"),children:f.jsx(io,{value:t.translateOutputMode,onChange:l=>{n("translateOutputMode",l)},options:[{value:"target_only",label:e("translate_output_mode.target_only")},{value:"bilingual",label:e("translate_output_mode.bilingual")}]})}),f.jsx(yi,{children:e("section.behavior")}),f.jsx(rn,{label:e("general.launch_startup"),children:f.jsx(Jo,{checked:t.launchStartup,onChange:l=>{n("launchStartup",l),$R(l)}})}),f.jsx(rn,{label:e("general.close_to_tray"),hint:e("general.close_to_tray_hint"),children:f.jsx(Jo,{checked:t.closeBehavior==="HIDE",onChange:l=>{n("closeBehavior",l?"HIDE":"ASK")}})}),f.jsx(rn,{label:e("general.update_policy"),hint:e("general.update_policy_hint"),children:f.jsx(io,{value:t.updatePolicy,onChange:l=>{n("updatePolicy",l)},options:[{value:"PROMPT",label:e("general.update_policy_options.prompt")},{value:"AUTO",label:e("general.update_policy_options.auto")},{value:"DISABLED",label:e("general.update_policy_options.disabled")}]})}),a?null:f.jsx("div",{className:"mt-6 font-mono text-xs text-te-light-gray/70",children:e("general.loading")})]})}function MV(){const{t:e}=de("settings"),t=nn(a=>a.resetAll),[n,r]=m.useState(!1),i=async()=>{await t(),r(!1),ke.success(e("hotkeys.reset_all_done"))};return f.jsxs("div",{children:[f.jsxs("div",{className:"mt-10 mb-4 flex items-center justify-between gap-3 first:mt-0",children:[f.jsxs("div",{className:"flex items-center gap-3",children:[f.jsx("span",{className:"h-px w-4 bg-te-accent"}),f.jsx("h3",{className:"font-mono text-xs uppercase tracking-[0.25em] text-te-light-gray",children:e("section.shortcuts")})]}),f.jsx("button",{type:"button",onClick:()=>r(!0),className:"border border-te-gray/40 bg-te-surface px-3 py-1.5 font-mono text-[11px] uppercase tracking-[0.15em] text-te-light-gray transition-colors hover:border-te-accent hover:text-te-accent",children:e("hotkeys.reset_all")})]}),f.jsx($0,{size:"comfortable"}),f.jsx(IV,{open:n,onOpenChange:r,onConfirm:()=>{i()}})]})}function IV({open:e,onOpenChange:t,onConfirm:n}){const{t:r}=de("settings");return f.jsx(Sn,{open:e,onOpenChange:t,children:f.jsxs(En,{showCloseButton:!1,className:"flex w-[92vw] max-w-sm flex-col !gap-0 rounded-none border border-te-dialog-border bg-te-dialog-bg p-0 shadow-2xl ring-0 sm:max-w-sm",children:[f.jsxs(Cn,{className:"border-b border-te-dialog-border bg-te-surface-hover px-5 py-4",children:[f.jsx(jn,{className:"font-mono text-base font-bold tracking-tighter text-te-fg",children:r("hotkeys.reset_all")}),f.jsx(Pn,{className:"sr-only",children:r("hotkeys.reset_all_confirm")})]}),f.jsx("div",{className:"px-5 py-5 font-sans text-sm text-te-light-gray",children:r("hotkeys.reset_all_confirm")}),f.jsxs("div",{className:"flex items-stretch border-t border-te-dialog-border",children:[f.jsx("button",{type:"button",onClick:()=>t(!1),className:"flex-1 border-r border-te-dialog-border px-4 py-3 font-mono text-xs uppercase tracking-[0.2em] text-te-light-gray transition-colors hover:bg-te-surface-hover hover:text-te-fg",children:r("common:actions.cancel")}),f.jsx("button",{type:"button",onClick:n,className:"flex-1 bg-te-accent px-4 py-3 font-mono text-xs uppercase tracking-[0.2em] text-te-accent-fg transition-colors hover:bg-te-accent/90",children:r("common:actions.confirm")})]})]})})}function DV(){const{t:e}=de("settings"),t=re(C=>C.general),n=re(C=>C.setGeneral),r=re(C=>C.loaded),i=re(C=>C.aiRefine),a=re(C=>C.setAiRefineEnabled),o=re(C=>C.dictation),s=re(C=>C.setDictationMode),l=re(C=>C.setDictationLang),c=re(C=>C.addDictationProvider),d=re(C=>C.updateDictationProvider),u=re(C=>C.removeDictationProvider),p=re(C=>C.setActiveDictationProvider),h=re(C=>C.setDictationStreamingInject),y=re(C=>C.setDictationClipboardCopy),[g,x]=m.useState([]);m.useEffect(()=>{(async()=>{const C=await P6();x(C)})()},[]);const[v,b]=m.useState(0),w=m.useRef(null);m.useEffect(()=>{let C,j=!1;const T=Bb(t.inputDevice||null);return(async()=>{const A=await Ue("openspeech://audio-level",R=>{const D=Math.max(0,Math.min(1,Number(R.payload)||0));b(D)});j?A():C=A})(),w.current=window.setInterval(()=>{b(A=>A>.02?A*.6:0)},150),()=>{j=!0,C?.(),cl(),T.then(A=>{A&&cl()}),w.current!==null&&(clearInterval(w.current),w.current=null)}},[t.inputDevice]);const _=m.useMemo(()=>g.find(C=>C.isDefault)?.name??"",[g]),k=t.inputDevice,S=k!==""&&g.some(C=>C.name===k)?k:_,E=m.useMemo(()=>{const C=[{value:"",label:_?e("device.system_default_with_current",{name:_}):e("device.system_default")}];for(const j of g)C.push({value:j.name,label:j.isDefault?e("device.is_default_suffix",{name:j.name}):j.name});return k&&!g.some(j=>j.name===k)&&C.push({value:k,label:_?e("device.disconnected_with_fallback",{name:k,fallback:_}):e("device.disconnected",{name:k})}),C},[g,k,_,e]);return f.jsxs("div",{children:[f.jsx(yi,{children:e("dictation_provider.section_mode")}),f.jsx("div",{className:"py-3",children:f.jsx(Qv,{value:o.mode,onChange:C=>{s(C)},options:[{value:"saas",label:e("dictation_provider.mode_saas_label"),hint:e("dictation_provider.mode_saas_hint")},{value:"custom",label:e("dictation_provider.mode_custom_label"),hint:e("dictation_provider.mode_custom_hint")}]})}),o.mode==="custom"&&f.jsxs(f.Fragment,{children:[f.jsx(yi,{children:e("dictation_provider.section_providers")}),o.customProviders.length===0?f.jsx("div",{className:"border border-dashed border-te-gray/40 px-4 py-6 text-center font-mono text-xs text-te-light-gray",children:e("dictation_provider.providers_empty")}):f.jsx("div",{className:"flex flex-col gap-3",children:o.customProviders.map(C=>f.jsx(FV,{provider:C,isActive:C.id===o.activeCustomProviderId,onUpdate:j=>{d(C.id,j)},onRemove:()=>{u(C.id)},onSetActive:()=>{p(C.id)}},C.id))}),f.jsxs("div",{className:"mt-4 flex flex-wrap gap-2",children:[f.jsxs("button",{type:"button",onClick:()=>{const C=typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID():`dict_${Date.now()}_${Math.random().toString(36).slice(2,8)}`;c({id:C,name:e("dictation_provider.tencent_default_name"),vendor:"tencent",tencentAppId:"",tencentRegion:"ap-shanghai"})},className:"inline-flex items-center gap-2 border border-te-gray/60 px-4 py-2 font-mono text-xs uppercase tracking-[0.2em] text-te-fg transition-colors hover:border-te-accent hover:text-te-accent",children:[f.jsx(us,{className:"size-3.5"}),e("dictation_provider.add_tencent")]}),f.jsxs("button",{type:"button",onClick:()=>{const C=typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID():`dict_${Date.now()}_${Math.random().toString(36).slice(2,8)}`;c({id:C,name:e("dictation_provider.aliyun_default_name"),vendor:"aliyun"})},className:"inline-flex items-center gap-2 border border-te-gray/60 px-4 py-2 font-mono text-xs uppercase tracking-[0.2em] text-te-fg transition-colors hover:border-te-accent hover:text-te-accent",children:[f.jsx(us,{className:"size-3.5"}),e("dictation_provider.add_aliyun")]})]})]}),f.jsx(yi,{children:e("section.audio")}),f.jsx(rn,{label:e("general.input_device"),children:f.jsx(io,{value:t.inputDevice,onChange:C=>{n("inputDevice",C)},className:"min-w-[18rem]",options:E})}),f.jsx(rn,{label:e("general.input_level"),hint:S?e("general.input_level_hint_listening",{name:S}):e("general.input_level_hint"),children:f.jsx(AV,{peak:v})}),f.jsx(rn,{label:e("general.cue_sound"),children:f.jsx(Jo,{checked:t.cueSound,onChange:C=>{n("cueSound",C)}})}),f.jsx(rn,{label:e("dictation_lang.label"),hint:e("dictation_lang.hint"),children:f.jsx(io,{value:o.lang==="follow_interface"?"auto":o.lang,onChange:C=>{l(C)},options:[{value:"auto",label:e("dictation_lang.auto")},{value:"zh",label:e("dictation_lang.zh")},{value:"en",label:e("dictation_lang.en")},{value:"ja",label:e("dictation_lang.ja")},{value:"ko",label:e("dictation_lang.ko")},{value:"yue",label:e("dictation_lang.yue")}]})}),f.jsx(yi,{children:e("section.asr_segment")}),f.jsx("div",{className:"py-3",children:f.jsx(Qv,{value:t.asrSegmentMode,onChange:C=>{n("asrSegmentMode",C)},options:[{value:"UTTERANCE",label:e("asr_segment.utterance_label"),hint:e("asr_segment.utterance_hint")},{value:"REALTIME",label:e("asr_segment.realtime_label"),hint:e("asr_segment.realtime_hint")}]})}),f.jsx(rn,{label:e("asr_segment.ai_refine_toggle.label"),hint:t.asrSegmentMode==="REALTIME"?e("asr_segment.ai_refine_toggle.disabled_in_realtime"):e("asr_segment.ai_refine_toggle.hint"),children:f.jsx(Jo,{checked:t.asrSegmentMode!=="REALTIME"&&i.enabled,disabled:t.asrSegmentMode==="REALTIME",onChange:C=>{a(C)}})}),f.jsx(yi,{children:e("section.output")}),f.jsx(rn,{label:e("output.streaming_inject.label"),hint:e("output.streaming_inject.hint"),children:f.jsx(Jo,{checked:o.streamingInject,onChange:C=>{h(C)}})}),f.jsx(rn,{label:e("output.clipboard_copy.label"),hint:e("output.clipboard_copy.hint"),children:f.jsx(Jo,{checked:o.clipboardCopy,onChange:C=>{y(C)}})}),r?null:f.jsx("div",{className:"mt-6 font-mono text-xs text-te-light-gray/70",children:e("general.loading")})]})}function LV(){const{t:e}=de("settings"),t=re(c=>c.aiRefine),n=re(c=>c.setAiRefineMode),r=re(c=>c.addAiProvider),i=re(c=>c.updateAiProvider),a=re(c=>c.removeAiProvider),o=re(c=>c.setActiveAiProvider),s=re(c=>c.setAiIncludeHistory),l=re(c=>c.setAiRecentHistoryCount);return f.jsxs("div",{children:[f.jsx(yi,{children:e("ai.section_mode")}),f.jsx("div",{className:"py-3",children:f.jsx(Qv,{value:t.mode,onChange:c=>{n(c)},options:[{value:"saas",label:e("ai.mode_saas_label"),hint:e("ai.mode_saas_hint")},{value:"custom",label:e("ai.mode_custom_label"),hint:e("ai.mode_custom_hint")}]})}),t.mode==="custom"&&f.jsxs(f.Fragment,{children:[f.jsx(yi,{children:e("ai.section_providers")}),t.customProviders.length===0?f.jsx("div",{className:"border border-dashed border-te-gray/40 px-4 py-6 text-center font-mono text-xs text-te-light-gray",children:e("ai.providers_empty")}):f.jsx("div",{className:"flex flex-col gap-3",children:t.customProviders.map(c=>f.jsx(zV,{provider:c,isActive:c.id===t.activeCustomProviderId,onUpdate:d=>{i(c.id,d)},onRemove:()=>{a(c.id)},onSetActive:()=>{o(c.id)}},c.id))}),f.jsx("div",{className:"mt-4 flex",children:f.jsxs("button",{type:"button",onClick:()=>{const c=typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID():`prov_${Date.now()}_${Math.random().toString(36).slice(2,8)}`;r({id:c,name:e("ai.provider_default_name"),baseUrl:e("ai.provider_default_base_url"),model:e("ai.provider_default_model")})},className:"inline-flex items-center gap-2 border border-te-gray/60 px-4 py-2 font-mono text-xs uppercase tracking-[0.2em] text-te-fg transition-colors hover:border-te-accent hover:text-te-accent",children:[f.jsx(us,{className:"size-3.5"}),e("ai.provider_add")]})})]}),f.jsx(yi,{children:e("ai.section_history")}),f.jsx(rn,{label:e("ai.include_history"),hint:e("ai.include_history_hint"),children:f.jsx(Jo,{checked:t.includeHistory,onChange:c=>{s(c)}})}),f.jsx(rn,{label:e("ai.recent_history_count"),hint:e("ai.recent_history_count_hint"),children:f.jsx(io,{value:String(t.recentHistoryCount),onChange:c=>{l(Number(c))},options:[{value:"3",label:"3"},{value:"5",label:"5"},{value:"10",label:"10"},{value:"15",label:"15"},{value:"20",label:"20"},{value:"30",label:"30"}]})})]})}function $V(){const{t:e}=de("settings"),t=re(x=>x.general.interfaceLang),n=re(x=>x.dictation.lang),r=lr(n,t),i=re(x=>x.aiRefine),a=re(x=>x.setCustomExamples),o=re(x=>x.setAiTranslationSystemPrompt),s=re(x=>x.setAiPolishSystemPrompt),l=re(x=>x.setAiMeetingSummaryPrompt),c=re(x=>x.setPolishScenarios),[d,u]=m.useState("refine"),p=[{id:"refine",label:e("ai.prompt_tab_refine")},{id:"translate",label:e("ai.prompt_tab_translate")},{id:"polish",label:e("ai.prompt_tab_polish")},{id:"meeting",label:e("ai.prompt_tab_meeting")}],h=hO[r],y=gO[r],g=mO[r];return f.jsxs("div",{className:"flex flex-col gap-4",children:[f.jsx("p",{className:"font-sans text-xs leading-relaxed text-te-light-gray",children:e("ai.prompts_intro")}),f.jsx("div",{className:"flex items-center gap-px border-b border-te-gray/30",children:p.map(x=>{const v=x.id===d;return f.jsx("button",{type:"button",onClick:()=>u(x.id),className:ae("relative -mb-px border-b-2 px-4 py-2 font-mono text-[11px] uppercase tracking-[0.2em] transition-colors",v?"border-te-accent text-te-accent":"border-transparent text-te-light-gray hover:text-te-fg"),children:x.label},x.id)})}),f.jsxs("div",{className:"pt-2",children:[d==="refine"&&f.jsxs("div",{className:"flex flex-col gap-6",children:[f.jsx("p",{className:"font-sans text-xs leading-relaxed text-te-light-gray",children:e("ai.refine_panel_intro")}),f.jsx(_V,{examples:i.customExamples,onChange:x=>{a(x)}})]}),d==="translate"&&f.jsx(gg,{description:e("ai.prompt_desc_translate"),value:i.customTranslationSystemPrompt??h,isCustom:i.customTranslationSystemPrompt!==null,onChange:x=>{o(x)},onReset:()=>{o(null)}}),d==="polish"&&f.jsxs("div",{className:"flex flex-col gap-8",children:[f.jsx(gg,{description:e("ai.prompt_desc_polish"),value:i.customPolishSystemPrompt??y,isCustom:i.customPolishSystemPrompt!==null,onChange:x=>{s(x)},onReset:()=>{s(null)}}),f.jsx("div",{className:"border-t border-te-gray/30 pt-6",children:f.jsx(EV,{scenarios:i.customPolishScenarios,onChange:x=>{c(x)}})})]}),d==="meeting"&&f.jsx(gg,{description:e("ai.prompt_desc_meeting"),value:i.customMeetingSummaryPrompt??g,isCustom:i.customMeetingSummaryPrompt!==null,onChange:x=>{l(x)},onReset:()=>{l(null)}})]})]})}function zV({provider:e,isActive:t,onUpdate:n,onRemove:r,onSetActive:i}){const{t:a}=de("settings"),o=re(x=>x.setAiProviderVerified),[s,l]=m.useState(""),[c,d]=m.useState(!1);m.useEffect(()=>{let x=!1;return(async()=>{try{const v=await OF(e.id);!x&&v!==null&&l(v)}catch(v){console.warn("[ai-refine] load api key failed:",v)}})(),()=>{x=!0}},[e.id]);const u=async()=>{if(c)try{await TF(e.id,s),d(!1),e.verified&&await o(e.id,!1)}catch(x){console.warn("[ai-refine] save api key failed:",x)}},[p,h]=m.useState(!1),y=async()=>{if(p)return!1;h(!0);try{await u();const x=(e.baseUrl??"").trim(),v=(e.model??"").trim();if(!x||!v)return ke.error(a("ai.provider_test_fail",{message:a("ai.provider_test_missing_fields")})),e.verified&&await o(e.id,!1),!1;let b="";const _=((await ea({mode:"custom",systemPrompt:"Reply with the single word: OK.",userText:"ping",customBaseUrl:x,customModel:v,customKeyringId:`ai_provider_${e.id}`},k=>{b+=k})).refinedText??b).trim();return console.info("[ai-refine][test] reply:",_),Ke(`[ai-refine][test] provider=${e.id} reply=${JSON.stringify(_)}`),_.length===0?(ke.error(a("ai.provider_test_fail",{message:a("ai.provider_test_empty_reply")})),e.verified&&await o(e.id,!1),!1):(ke.success(a("ai.provider_test_pass")),await o(e.id,!0),!0)}catch(x){const v=x instanceof Error?x.message:String(x);return ke.error(a("ai.provider_test_fail",{message:v})),e.verified&&await o(e.id,!1),!1}finally{h(!1)}},g=async()=>{p||!e.verified&&!await y()||i()};return f.jsxs("div",{className:ae("flex flex-col gap-3 border px-4 py-3 transition-colors",t?"border-te-accent bg-te-accent/8":"border-te-gray/40"),children:[f.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("span",{className:ae("size-2",t?"bg-te-accent":"bg-te-gray")}),f.jsx("span",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-te-light-gray",children:t?a("ai.provider_active"):e.id.slice(0,8)}),f.jsx("span",{className:ae("border px-2 py-0.5 font-mono text-[10px] uppercase tracking-[0.2em]",e.verified?"border-te-accent/60 text-te-accent":"border-amber-500/60 text-amber-500"),children:e.verified?a("dictation_provider.verified_badge"):a("dictation_provider.unverified_badge")})]}),f.jsxs("div",{className:"flex items-center gap-2",children:[!t&&f.jsx("button",{type:"button",onClick:()=>{g()},disabled:p,className:"border border-te-gray/60 px-3 py-1.5 font-mono text-[11px] uppercase tracking-[0.2em] text-te-fg transition-colors enabled:hover:border-te-accent enabled:hover:text-te-accent disabled:cursor-not-allowed disabled:opacity-50",children:a("ai.provider_set_active")}),f.jsxs("button",{type:"button",onClick:()=>{y()},disabled:p,className:"inline-flex items-center gap-1 border border-te-accent bg-te-accent px-3 py-1.5 font-mono text-[11px] uppercase tracking-[0.2em] text-te-bg transition-colors enabled:hover:bg-te-accent/85 disabled:cursor-not-allowed disabled:opacity-50",children:[p?f.jsx(jr,{className:"size-3 animate-spin"}):f.jsx(DO,{className:"size-3"}),a(p?"ai.provider_test_running":"ai.provider_test")]}),f.jsxs("button",{type:"button",onClick:r,className:"inline-flex items-center gap-1 border border-te-gray/60 px-3 py-1.5 font-mono text-[11px] uppercase tracking-[0.2em] text-te-light-gray transition-colors hover:border-red-400 hover:text-red-400",children:[f.jsx(di,{className:"size-3"}),a("ai.provider_remove")]})]})]}),f.jsxs("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2",children:[f.jsx(ml,{label:a("ai.provider_name"),value:e.name,onChange:x=>n({name:x})}),f.jsx(ml,{label:a("ai.provider_model"),value:e.model,onChange:x=>n({model:x})})]}),f.jsx(ml,{label:a("ai.provider_base_url"),value:e.baseUrl,onChange:x=>n({baseUrl:x})}),f.jsxs("div",{children:[f.jsx("div",{className:"mb-1 font-mono text-[11px] uppercase tracking-[0.2em] text-te-light-gray",children:a("ai.provider_api_key")}),f.jsx("input",{type:"password",value:s,onChange:x=>{l(x.target.value),d(!0)},onBlur:()=>{u()},className:"w-full border border-te-gray/40 bg-te-surface px-3 py-2 font-mono text-sm text-te-fg outline-none transition-colors focus:border-te-accent"}),f.jsx("div",{className:"mt-1 font-mono text-[11px] text-te-light-gray/80",children:a("ai.provider_api_key_hint")})]})]})}function FV({provider:e,isActive:t,onUpdate:n,onRemove:r,onSetActive:i}){const{t:a}=de("settings"),o=re(k=>k.setDictationProviderVerified),[s,l]=m.useState(""),[c,d]=m.useState(""),[u,p]=m.useState(""),[h,y]=m.useState(!1);m.useEffect(()=>{let k=!1;return(async()=>{try{const S=await MF(e.id);if(k||!S)return;S.vendor==="aliyun"&&l(S.apiKey),S.vendor==="tencent"&&(d(S.secretId),p(S.secretKey))}catch(S){console.warn("[dictation] load credentials failed:",S)}})(),()=>{k=!0}},[e.id]);const g=async()=>{if(h)try{const k=e.vendor==="aliyun"?{vendor:"aliyun",apiKey:s}:{vendor:"tencent",secretId:c,secretKey:u};await RF(e.id,k),y(!1),e.verified&&await o(e.id,!1)}catch(k){console.warn("[dictation] save credentials failed:",k)}},[x,v]=m.useState(!1),b=async()=>{if(x)return!1;v(!0);try{if(await g(),e.vendor==="aliyun"){if(!s.trim())return ke.error(a("dictation_provider.test_fail",{message:a("dictation_provider.test_missing_fields")})),!1}else if(!(e.tencentAppId??"").trim()||!c.trim()||!u.trim())return ke.error(a("dictation_provider.test_fail",{message:a("dictation_provider.test_missing_fields")})),!1;const k=await xV(e.vendor==="aliyun"?{vendor:"aliyun",apiKey:s}:{vendor:"tencent",appId:e.tencentAppId??"",region:e.tencentRegion??null,secretId:c,secretKey:u,cosBucket:e.tencentCosBucket??null});if(k.ok)return ke.success(a("dictation_provider.test_pass")),await o(e.id,!0),!0;const S=a(`dictation_provider.test_code.${k.code}`,{defaultValue:k.message})||k.message;return ke.error(a("dictation_provider.test_fail",{message:S})),e.verified&&await o(e.id,!1),!1}catch(k){const S=k instanceof Error?k.message:String(k);return ke.error(a("dictation_provider.test_fail",{message:S})),e.verified&&await o(e.id,!1),!1}finally{v(!1)}},w=async()=>{x||!e.verified&&!await b()||i()},_=e.vendor==="tencent"?a("dictation_provider.vendor_tencent"):a("dictation_provider.vendor_aliyun");return f.jsxs("div",{className:ae("flex flex-col gap-3 border px-4 py-3 transition-colors",t?"border-te-accent bg-te-accent/8":"border-te-gray/40"),children:[f.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("span",{className:ae("size-2",t?"bg-te-accent":"bg-te-gray")}),f.jsx("span",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-te-light-gray",children:t?a("dictation_provider.active_label",{vendor:_}):`${_} · ${e.id.slice(0,8)}`}),f.jsx("span",{className:ae("border px-2 py-0.5 font-mono text-[10px] uppercase tracking-[0.2em]",e.verified?"border-te-accent/60 text-te-accent":"border-amber-500/60 text-amber-500"),children:e.verified?a("dictation_provider.verified_badge"):a("dictation_provider.unverified_badge")})]}),f.jsxs("div",{className:"flex items-center gap-2",children:[!t&&f.jsx("button",{type:"button",onClick:()=>{w()},disabled:x,className:"border border-te-gray/60 px-3 py-1.5 font-mono text-[11px] uppercase tracking-[0.2em] text-te-fg transition-colors enabled:hover:border-te-accent enabled:hover:text-te-accent disabled:cursor-not-allowed disabled:opacity-50",children:a("dictation_provider.set_active")}),f.jsxs("button",{type:"button",onClick:()=>{b()},disabled:x,className:"inline-flex items-center gap-1 border border-te-accent bg-te-accent px-3 py-1.5 font-mono text-[11px] uppercase tracking-[0.2em] text-te-bg transition-colors enabled:hover:bg-te-accent/85 disabled:cursor-not-allowed disabled:opacity-50",children:[x?f.jsx(jr,{className:"size-3 animate-spin"}):f.jsx(DO,{className:"size-3"}),a(x?"dictation_provider.test_running":"dictation_provider.test")]}),f.jsxs("button",{type:"button",onClick:r,className:"inline-flex items-center gap-1 border border-te-gray/60 px-3 py-1.5 font-mono text-[11px] uppercase tracking-[0.2em] text-te-light-gray transition-colors hover:border-red-400 hover:text-red-400",children:[f.jsx(di,{className:"size-3"}),a("dictation_provider.remove")]})]})]}),f.jsx(ml,{label:a("dictation_provider.name_label"),value:e.name,onChange:k=>n({name:k})}),e.vendor==="tencent"?f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2",children:[f.jsx(ml,{label:a("dictation_provider.tencent_app_id"),value:e.tencentAppId??"",onChange:k=>n({tencentAppId:k}),required:!0}),f.jsx(ml,{label:a("dictation_provider.tencent_region"),value:e.tencentRegion??"",onChange:k=>n({tencentRegion:k}),required:!0})]}),f.jsxs("div",{children:[f.jsxs("div",{className:"mb-1 font-mono text-[11px] uppercase tracking-[0.2em] text-te-light-gray",children:[a("dictation_provider.tencent_cos_bucket_label"),f.jsx(Pc,{})]}),f.jsx("input",{type:"text",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1,placeholder:a("dictation_provider.tencent_cos_bucket_placeholder")??"",value:e.tencentCosBucket??"",onChange:k=>n({tencentCosBucket:k.target.value}),className:"w-full border border-te-gray/40 bg-te-surface px-3 py-2 font-mono text-sm text-te-fg outline-none transition-colors focus:border-te-accent"}),f.jsx("div",{className:"mt-1 font-mono text-[11px] text-te-light-gray/80",children:a("dictation_provider.tencent_cos_bucket_hint")})]}),f.jsxs("div",{children:[f.jsxs("div",{className:"mb-1 font-mono text-[11px] uppercase tracking-[0.2em] text-te-light-gray",children:[a("dictation_provider.tencent_secret_id"),f.jsx(Pc,{})]}),f.jsx("input",{type:"text",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1,value:c,onChange:k=>{d(k.target.value),y(!0)},onBlur:()=>{g()},className:"w-full border border-te-gray/40 bg-te-surface px-3 py-2 font-mono text-sm text-te-fg outline-none transition-colors focus:border-te-accent"})]}),f.jsxs("div",{children:[f.jsxs("div",{className:"mb-1 font-mono text-[11px] uppercase tracking-[0.2em] text-te-light-gray",children:[a("dictation_provider.tencent_secret_key"),f.jsx(Pc,{})]}),f.jsx("input",{type:"password",value:u,onChange:k=>{p(k.target.value),y(!0)},onBlur:()=>{g()},className:"w-full border border-te-gray/40 bg-te-surface px-3 py-2 font-mono text-sm text-te-fg outline-none transition-colors focus:border-te-accent"}),f.jsx("div",{className:"mt-1 font-mono text-[11px] text-te-light-gray/80",children:a("dictation_provider.tencent_credentials_hint")})]})]}):f.jsxs("div",{children:[f.jsxs("div",{className:"mb-1 font-mono text-[11px] uppercase tracking-[0.2em] text-te-light-gray",children:[a("dictation_provider.aliyun_api_key"),f.jsx(Pc,{})]}),f.jsx("input",{type:"password",value:s,onChange:k=>{l(k.target.value),y(!0)},onBlur:()=>{g()},className:"w-full border border-te-gray/40 bg-te-surface px-3 py-2 font-mono text-sm text-te-fg outline-none transition-colors focus:border-te-accent"}),f.jsx("div",{className:"mt-1 font-mono text-[11px] text-te-light-gray/80",children:a("dictation_provider.aliyun_api_key_hint")})]})]})}function Pc(){return f.jsx("span",{className:"ml-1 text-red-400",children:"*"})}function ml({label:e,value:t,onChange:n,required:r}){return f.jsxs("div",{children:[f.jsxs("div",{className:"mb-1 font-mono text-[11px] uppercase tracking-[0.2em] text-te-light-gray",children:[e,r?f.jsx(Pc,{}):null]}),f.jsx("input",{type:"text",value:t,onChange:i=>n(i.target.value),className:"w-full border border-te-gray/40 bg-te-surface px-3 py-2 font-mono text-sm text-te-fg outline-none transition-colors focus:border-te-accent"})]})}function BV(){const{t:e}=de("settings"),{t}=de("feedback"),n=mh(),r=re(_=>_.setGeneral),i=qe(_=>_.setSettingsOpen),a=qe(_=>_.openFeedback),[o,s]=m.useState(""),[l,c]=m.useState(!1),[d,u]=m.useState(null),[p,h]=m.useState(""),[y,g]=m.useState("stable");m.useEffect(()=>{Ah().then(s).catch(()=>s("unknown")),B("get_update_channel").then(_=>g(_==="beta"?"beta":"stable")).catch(()=>{}),B("get_platform_info").then(_=>u({os:_.os,arch:_.arch})).catch(()=>{})},[]);const x=d?(()=>{const _=d.os==="macos"?"macOS":d.os==="windows"?"Windows":d.os==="linux"?"Linux":d.os,k=d.os==="macos"&&d.arch==="aarch64"?"Apple Silicon":d.os==="macos"&&d.arch==="x86_64"?"Intel":d.arch;return`${_} · ${k}`})():"—",v=async _=>{if(_!==y){g(_);try{await B("set_update_channel",{channel:_}),Ke(`[updater] channel switched to ${_}`)}catch(k){ll(`[updater] channel switch failed: ${String(k?.message??k)}`)}}},b=async()=>{await r("onboardingCompleted",!1),i(!1),n("/onboarding",{replace:!0})},w=async()=>{if(!l){c(!0),Ke("[updater] about-page check start");try{const _=await Rb();_?(Ke(`[updater] about-page check found: ${_.version}`),ke.message(ie.t("pages:layout.tray.update_found_title"),{description:_.version,duration:3e4,action:{label:ie.t("settings:about.install_now"),onClick:()=>{jv(_,"about-page").catch(()=>{})}}})):(Ke("[updater] about-page check: no update"),ke(ie.t("pages:layout.tray.update_none")))}catch(_){ll(`[updater] about-page check failed: ${String(_?.message??_)}`),ke.error(ie.t("pages:layout.tray.update_check_failed"),{description:String(_?.message??_)})}finally{c(!1)}}};return f.jsxs("div",{children:[f.jsx(yi,{children:e("section.build")}),f.jsx(rn,{label:e("about.version"),children:f.jsxs("div",{className:"flex items-center gap-3",children:[f.jsx("span",{className:"font-mono text-sm text-te-fg",children:o?`v${o}`:"—"}),f.jsxs("button",{type:"button",onClick:()=>{w()},disabled:l,className:"inline-flex items-center gap-2 border border-te-gray/60 px-3 py-1.5 font-mono text-[11px] uppercase tracking-[0.2em] text-te-fg transition-colors hover:border-te-accent hover:text-te-accent disabled:cursor-not-allowed disabled:opacity-60",children:[f.jsx("span",{className:ae("size-1.5 bg-te-accent",l&&"animate-pulse")}),e("about.check_update")]})]})}),!1,f.jsx(rn,{label:e("about.platform"),children:f.jsx("span",{className:"font-mono text-sm text-te-fg",children:x})}),f.jsx(rn,{label:e("about.license"),children:f.jsx("span",{className:"font-mono text-sm text-te-fg",children:"PolyForm Noncommercial 1.0.0"})}),f.jsx(rn,{label:e("about.source"),children:f.jsxs("a",{href:"https://github.com/OpenLoaf/OpenSpeech",target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1.5 font-mono text-sm text-te-light-gray transition-colors hover:text-te-accent",children:["github.com/OpenLoaf/OpenSpeech",f.jsx(qb,{className:"size-3.5"})]})}),f.jsx(rn,{label:e("about.update_channel"),children:f.jsx("div",{className:"flex items-center gap-px border border-te-gray/60",children:["stable","beta"].map(_=>{const k=y===_;return f.jsx("button",{type:"button",onClick:()=>{v(_)},className:ae("px-3 py-1.5 font-mono text-[11px] uppercase tracking-[0.2em] transition-colors",k?"bg-te-accent text-te-bg":"bg-te-bg text-te-light-gray hover:text-te-fg"),children:e(`about.update_channel_${_}`)},_)})})}),f.jsx("div",{className:"-mt-2 px-1 pb-2 font-mono text-[11px] leading-relaxed text-te-light-gray",children:e("about.update_channel_hint")}),f.jsxs("div",{className:"flex flex-wrap items-center gap-3 py-4",children:[f.jsxs("button",{type:"button",onClick:()=>{b()},className:"inline-flex items-center gap-2 border border-te-gray/60 px-5 py-2.5 font-mono text-xs uppercase tracking-[0.2em] text-te-fg transition-colors hover:border-te-accent hover:text-te-accent",children:[f.jsx(oW,{className:"size-3.5"}),e("about.rerun_onboarding")]}),f.jsxs("button",{type:"button",onClick:()=>{a({returnToSettingsTab:"ABOUT"})},className:"inline-flex items-center gap-2 border border-te-gray/60 px-5 py-2.5 font-mono text-xs uppercase tracking-[0.2em] text-te-fg transition-colors hover:border-te-accent hover:text-te-accent",children:[f.jsx(Gb,{className:"size-3.5"}),t("menu_label")]}),f.jsxs("button",{type:"button",onClick:()=>{B("open_log_dir").catch(_=>{ll(`open_log_dir failed: ${String(_)}`),ke.error(String(_))})},className:"inline-flex items-center gap-2 border border-te-gray/60 px-5 py-2.5 font-mono text-xs uppercase tracking-[0.2em] text-te-fg transition-colors hover:border-te-accent hover:text-te-accent",children:[f.jsx(LO,{className:"size-3.5"}),e("about.open_log_dir")]})]})]})}function WV({tabs:e,active:t,onChange:n,actions:r}){const i=cn()==="macos";return f.jsxs("nav",{className:"flex flex-col gap-px border border-te-gray/30 bg-te-surface",children:[e.map((a,o)=>{const s=a.id===t,l=a.icon,c=i?`⌘ ${o+1}`:`Alt + ${o+1}`;return f.jsxs("button",{type:"button",onClick:()=>n(a.id),className:ae("group relative flex items-center gap-3 py-3 pr-4 pl-5 font-mono text-xs uppercase tracking-[0.2em] transition-colors",s?"bg-te-surface-hover text-te-accent":"text-te-light-gray hover:text-te-fg"),children:[f.jsx("span",{className:ae("absolute top-0 left-0 h-full w-[2px] transition-colors",s?"bg-te-accent":"bg-transparent")}),f.jsx(l,{className:"size-4 shrink-0"}),f.jsx("span",{children:a.label}),f.jsx("span",{"aria-hidden":!0,className:ae("ml-auto pl-4 font-mono text-[10px] normal-case tracking-normal transition-colors",s?"text-te-accent/35":"text-te-light-gray/20 group-hover:text-te-light-gray/40"),children:c})]},a.id)}),r?.map(a=>{const o=a.icon;return f.jsxs("button",{type:"button",onClick:a.onClick,className:"group relative flex items-center gap-3 py-3 pr-4 pl-5 font-mono text-xs uppercase tracking-[0.2em] text-te-light-gray transition-colors hover:text-te-fg",children:[f.jsx("span",{className:"absolute top-0 left-0 h-full w-[2px] bg-transparent"}),f.jsx(o,{className:"size-4 shrink-0"}),f.jsx("span",{children:a.label})]},a.id)})]})}function HR({initialTab:e="GENERAL"}={}){const{t}=de("settings"),[n,r]=m.useState(e),i=OV(),a=o=>{if(o===n)return;const s=re.getState(),l=[];if(n==="DICTATION"&&EO(s.dictation)&&(s.setDictationMode("saas"),l.push("dictation")),n==="AI"&&CO(s.aiRefine)&&(s.setAiRefineMode("saas"),l.push("ai")),l.length>0){const c=l.length===2?t("provider_rollback.both"):t(`provider_rollback.${l[0]}`);ke.message(f.jsx("span",{className:"text-te-accent",children:t("provider_rollback.title")}),{description:t("provider_rollback.description",{which:c})})}r(o)};return m.useEffect(()=>{const o=cn()==="macos",s=l=>{if(!(o?l.metaKey&&!l.ctrlKey&&!l.altKey:l.altKey&&!l.ctrlKey&&!l.metaKey)||l.shiftKey)return;const d=Number.parseInt(l.key,10);Number.isNaN(d)||d<1||d>i.length||(l.preventDefault(),a(i[d-1].id))};return document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[i,n]),f.jsxs("div",{className:"flex h-full min-h-0 w-full flex-col md:flex-row",children:[f.jsx(je.aside,{className:"flex w-full shrink-0 flex-col gap-6 overflow-y-auto border-b border-te-gray/30 p-3 md:w-60 md:border-b-0 md:border-r",initial:{opacity:0,x:-12},animate:{opacity:1,x:0},transition:{duration:.4},children:f.jsx(WV,{tabs:i,active:n,onChange:a})}),f.jsxs(je.div,{className:"min-w-0 min-h-0 flex-1 overflow-y-auto px-5 py-4",initial:{opacity:0,y:12},animate:{opacity:1,y:0},transition:{duration:.3},children:[n==="GENERAL"&&f.jsx(RV,{}),n==="HOTKEYS"&&f.jsx(MV,{}),n==="DICTATION"&&f.jsx(DV,{}),n==="AI"&&f.jsx(LV,{}),n==="PROMPTS"&&f.jsx($V,{}),n==="ABOUT"&&f.jsx(BV,{}),n==="DEV_HINTS"&&f.jsx(TV,{})]},n)]})}function HV(){const e=re.getState();return{dictation:EO(e.dictation),ai:CO(e.aiRefine)}}function UV({open:e,onOpenChange:t,initialTab:n="GENERAL"}){const{t:r}=de("settings"),[i,a]=m.useState(null),o=d=>{if(!d){const u=HV();if(u.dictation||u.ai){a(u);return}}t(d)},s=()=>{a(null)},l=async()=>{const d=re.getState();i?.dictation&&await d.setDictationMode("saas"),i?.ai&&await d.setAiRefineMode("saas"),a(null),t(!1)},c=i?i.dictation&&i.ai?r("provider_rollback.both"):i.dictation?r("provider_rollback.dictation"):r("provider_rollback.ai"):"";return f.jsxs(f.Fragment,{children:[f.jsx(Sn,{open:e,onOpenChange:o,children:f.jsxs(En,{className:"flex h-[82vh] w-[92vw] max-w-6xl flex-col !gap-0 rounded-none border border-te-dialog-border bg-te-dialog-bg p-0 shadow-2xl ring-0 sm:max-w-6xl",children:[f.jsxs(Cn,{className:"border-b border-te-dialog-border bg-te-surface-hover px-4 py-3",children:[f.jsx(jn,{className:"font-mono text-base font-bold tracking-tighter text-te-fg",children:r("page.dialog_title")}),f.jsx(Pn,{className:"sr-only",children:r("page.dialog_sr")})]}),f.jsx("div",{className:"flex min-h-0 flex-1",children:e?f.jsx(HR,{initialTab:n}):null})]})}),f.jsx(Sn,{open:i!=null,onOpenChange:d=>{d||s()},children:f.jsxs(En,{showCloseButton:!1,className:"flex w-[92vw] max-w-md flex-col !gap-0 rounded-none border border-te-dialog-border bg-te-dialog-bg p-0 shadow-2xl ring-0 sm:max-w-md",children:[f.jsxs(Cn,{className:"border-b border-te-dialog-border bg-te-surface-hover px-5 py-4",children:[f.jsx(jn,{className:"font-mono text-base font-bold tracking-tighter text-te-fg",children:r("provider_rollback.confirm_title")}),f.jsx(Pn,{className:"sr-only",children:r("provider_rollback.confirm_title")})]}),f.jsx("div",{className:"px-5 py-5 font-sans text-sm text-te-light-gray",children:r("provider_rollback.confirm_description",{which:c})}),f.jsxs("div",{className:"flex justify-end gap-2 border-t border-te-dialog-border bg-te-surface-hover px-4 py-3",children:[f.jsx("button",{type:"button",onClick:s,className:"border border-te-gray/60 px-3 py-1.5 font-mono text-[11px] uppercase tracking-[0.2em] text-te-fg transition-colors hover:border-te-accent hover:text-te-accent",children:r("provider_rollback.confirm_back_to_test")}),f.jsx("button",{type:"button",onClick:()=>{l()},className:"border border-amber-500/60 bg-amber-500/10 px-3 py-1.5 font-mono text-[11px] uppercase tracking-[0.2em] text-amber-200 transition-colors hover:bg-amber-500/20",children:r("provider_rollback.confirm_proceed")})]})]})})]})}function VV({open:e,onOpenChange:t,onConfirm:n}){const{t:r}=de(),[i,a]=m.useState(!1);return f.jsx(Sn,{open:e,onOpenChange:o=>{o||a(!1),t(o)},children:f.jsxs(En,{showCloseButton:!1,className:"flex w-[92vw] max-w-md flex-col !gap-0 rounded-none border border-te-dialog-border bg-te-dialog-bg p-0 shadow-2xl ring-0 sm:max-w-md",children:[f.jsxs(Cn,{className:"border-b border-te-dialog-border bg-te-surface-hover px-6 py-4",children:[f.jsx(jn,{className:"font-mono text-base font-bold tracking-tighter text-te-fg",children:r("dialogs:close_to_bg.title")}),f.jsx(Pn,{className:"sr-only",children:r("dialogs:close_to_bg.description")})]}),f.jsxs("div",{className:"space-y-3 px-6 py-5 font-sans text-sm text-te-fg",children:[f.jsxs("p",{children:[r("dialogs:close_to_bg.body_1_prefix"),f.jsx("span",{className:"text-te-accent",children:r("dialogs:close_to_bg.body_1_highlight")}),r("dialogs:close_to_bg.body_1_suffix")]}),f.jsx("p",{className:"text-te-light-gray",children:r("dialogs:close_to_bg.body_2")}),f.jsxs("label",{className:"mt-4 flex cursor-pointer items-center gap-3 pt-2 select-none",children:[f.jsx("span",{className:ae("relative flex size-4 items-center justify-center border transition-colors",i?"border-te-accent bg-te-accent":"border-te-gray/60 bg-te-surface"),children:i?f.jsx("span",{className:"size-1.5 bg-te-accent-fg","aria-hidden":!0}):null}),f.jsx("input",{type:"checkbox",checked:i,onChange:o=>a(o.target.checked),className:"sr-only"}),f.jsx("span",{className:"font-mono text-xs uppercase tracking-[0.15em] text-te-light-gray",children:r("dialogs:close_to_bg.remember")})]})]}),f.jsxs("div",{className:"flex items-stretch border-t border-te-dialog-border",children:[f.jsx("button",{type:"button",onClick:()=>n({remember:i,action:"quit"}),className:"flex-1 border-r border-te-dialog-border px-4 py-3 font-mono text-xs uppercase tracking-[0.2em] text-te-light-gray transition-colors hover:bg-te-surface-hover hover:text-te-fg",children:r("dialogs:close_to_bg.quit")}),f.jsx("button",{type:"button",onClick:()=>n({remember:i,action:"hide"}),className:"flex-1 bg-te-accent px-4 py-3 font-mono text-xs uppercase tracking-[0.2em] text-te-accent-fg transition-colors hover:bg-te-accent/90",children:r("dialogs:close_to_bg.stay")})]})]})})}const UR={AUTH_LOGIN_TIMEOUT:"errors:auth.login_timeout",AUTH_INTERNAL:"errors:auth.internal",AUTH_NOT_AUTHENTICATED:"errors:auth.not_authenticated"};function qV(e){const t=UR[e];return t?ie.t(t):e}function KV(e){return e in UR}function GV({className:e}){return f.jsxs("svg",{viewBox:"0 0 48 48",className:e,"aria-hidden":!0,children:[f.jsx("path",{fill:"#FFC107",d:"M43.611 20.083H42V20H24v8h11.303c-1.649 4.657-6.08 8-11.303 8-6.627 0-12-5.373-12-12s5.373-12 12-12c3.059 0 5.842 1.154 7.961 3.039l5.657-5.657C34.046 6.053 29.268 4 24 4 12.955 4 4 12.955 4 24s8.955 20 20 20 20-8.955 20-20c0-1.341-.138-2.65-.389-3.917z"}),f.jsx("path",{fill:"#FF3D00",d:"M6.306 14.691l6.571 4.819C14.655 15.108 18.961 12 24 12c3.059 0 5.842 1.154 7.961 3.039l5.657-5.657C34.046 6.053 29.268 4 24 4 16.318 4 9.656 8.337 6.306 14.691z"}),f.jsx("path",{fill:"#4CAF50",d:"M24 44c5.166 0 9.86-1.977 13.409-5.192l-6.19-5.238C29.211 35.091 26.715 36 24 36c-5.202 0-9.619-3.317-11.283-7.946l-6.522 5.025C9.505 39.556 16.227 44 24 44z"}),f.jsx("path",{fill:"#1976D2",d:"M43.611 20.083H42V20H24v8h11.303c-.792 2.237-2.231 4.166-4.087 5.571l.003-.002 6.19 5.238C36.971 39.205 44 34 44 24c0-1.341-.138-2.65-.389-3.917z"})]})}function YV({className:e}){return f.jsxs("svg",{viewBox:"0 0 48 48",className:e,"aria-hidden":!0,children:[f.jsx("path",{fill:"#09B83E",d:"M18.5 6C10.492 6 4 11.83 4 19.02c0 3.973 2.02 7.53 5.192 9.94L7.5 34l5.68-3.184c1.662.462 3.447.71 5.32.71.276 0 .55-.005.822-.016-.227-.828-.35-1.69-.35-2.576 0-5.87 5.604-10.627 12.52-10.627.325 0 .646.011.965.032C30.39 11.336 24.964 6 18.5 6zm-4.75 5.25c.966 0 1.75.784 1.75 1.75s-.784 1.75-1.75 1.75-1.75-.784-1.75-1.75.784-1.75 1.75-1.75zm9.5 0c.966 0 1.75.784 1.75 1.75s-.784 1.75-1.75 1.75-1.75-.784-1.75-1.75.784-1.75 1.75-1.75z"}),f.jsx("path",{fill:"#09B83E",d:"M44 28.87c0-5.89-5.82-10.664-13-10.664S18 22.98 18 28.87c0 5.887 5.82 10.662 13 10.662 1.54 0 3.02-.22 4.402-.623L40 41.066l-1.316-3.924C41.848 35.193 44 32.24 44 28.87zm-17.25-1.62a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3zm8.5 0a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3z"})]})}const XV={wechat:YV,google:GV},ZV=["wechat","google"];function QV(e,t){if(!e)return t("errors:auth.login_failed");if(KV(e))return qV(e);const n=e.toLowerCase();return n.includes("connection reset")?t("errors:auth.login_connection_reset"):n.includes("timed out")||n.includes("timeout")?t("errors:auth.login_timeout"):n.includes("connection refused")||n.includes("dns")||n.includes("error sending request")||n.includes("network error")?t("errors:auth.login_unreachable"):n.includes("not authenticated")?t("errors:auth.not_authenticated"):t("errors:auth.login_failed")}function JV({open:e,onOpenChange:t}){const{t:n}=de(),{loginStatus:r,loginError:i,lastProvider:a,isAuthenticated:o,startLogin:s,retryLogin:l,cancelLogin:c}=pt(),d=r==="opening"||r==="polling",u=r==="error",[p,h]=m.useState(!1);m.useEffect(()=>{e||h(!1)},[e]),m.useEffect(()=>{!e&&d&&c()},[e,d,c]),m.useEffect(()=>{if(e&&o){const g=window.setTimeout(()=>t(!1),800);return()=>window.clearTimeout(g)}},[e,o,t]);const y=o?n("dialogs:login.subtitle.success"):r==="opening"?n("dialogs:login.subtitle.opening"):r==="polling"?n("dialogs:login.subtitle.polling"):u?QV(i,n):n("dialogs:login.subtitle.idle");return f.jsx(Sn,{open:e,onOpenChange:(g,x)=>{if(!g&&d&&x?.reason==="escape-key"){x.cancel(),c();return}t(g)},children:f.jsxs(En,{className:"flex w-[92vw] max-w-md flex-col !gap-0 rounded-none border border-te-dialog-border bg-te-dialog-bg p-0 shadow-2xl ring-0",children:[f.jsxs(Cn,{className:"border-b border-te-dialog-border bg-te-surface-hover px-5 py-4",children:[f.jsx(jn,{className:"font-mono text-base font-bold tracking-tighter text-te-fg",children:n("dialogs:login.title")}),f.jsx("p",{className:"font-sans text-xs leading-snug text-te-light-gray",children:n("dialogs:login.openloaf_note")}),f.jsx(Pn,{className:"sr-only",children:n("dialogs:login.description")})]}),f.jsxs("div",{className:"flex flex-col gap-4 px-5 py-5",children:[f.jsx("div",{className:"flex flex-col gap-2",children:ZV.map(g=>{const x=XV[g];return f.jsxs("button",{type:"button",disabled:d||o,onClick:()=>{s(g)},className:ae("inline-flex w-full items-center justify-center gap-3 border border-te-gray bg-te-surface px-4 py-3 font-mono text-xs uppercase tracking-[0.2em] text-te-fg transition-colors",!d&&!o?"hover:border-te-accent hover:text-te-accent":"cursor-not-allowed opacity-50"),children:[f.jsx(x,{className:"size-5"}),n(`dialogs:login.providers.${g}`)]},g)})}),d||u||o?f.jsxs("div",{className:"flex items-center justify-center gap-2 pt-1",children:[f.jsx("span",{className:ae("size-1.5 shrink-0",u?"bg-red-500/70":o?"bg-green-500/80":"bg-te-accent")}),f.jsx("span",{className:ae("font-mono text-[11px] uppercase tracking-[0.2em]",u?"text-red-500/90":"text-te-light-gray"),children:y}),d?f.jsx(jr,{className:"size-3.5 shrink-0 animate-spin text-te-light-gray"}):null]}):null,u?f.jsxs("div",{className:"flex flex-col gap-2",children:[f.jsxs("div",{className:"flex items-center justify-center gap-2",children:[a?f.jsxs("button",{type:"button",onClick:()=>{l()},className:"inline-flex items-center gap-2 border border-te-accent bg-te-accent/10 px-4 py-2 font-mono text-[11px] uppercase tracking-[0.2em] text-te-accent transition-colors hover:bg-te-accent hover:text-te-bg",children:[f.jsx(Aa,{className:"size-3.5"}),n("dialogs:login.retry")]}):null,f.jsx("button",{type:"button",onClick:()=>t(!1),className:"inline-flex items-center gap-2 border border-te-gray px-4 py-2 font-mono text-[11px] uppercase tracking-[0.2em] text-te-light-gray transition-colors hover:border-te-fg hover:text-te-fg",children:n("dialogs:login.close")})]}),i?f.jsxs("div",{className:"flex flex-col items-center gap-1",children:[f.jsxs("button",{type:"button",onClick:()=>h(g=>!g),className:"inline-flex items-center gap-1 font-mono text-[10px] uppercase tracking-[0.25em] text-te-light-gray transition-colors hover:text-te-fg",children:[f.jsx(Pa,{className:ae("size-3 transition-transform",p?"rotate-180":"rotate-0")}),n(p?"dialogs:login.details_hide":"dialogs:login.details_show")]}),p?f.jsx("pre",{className:"max-h-32 w-full overflow-auto whitespace-pre-wrap break-all border border-te-gray/40 bg-te-surface/40 px-3 py-2 font-mono text-[10px] leading-relaxed text-te-light-gray",children:i}):null]}):null]}):null,d?f.jsx("button",{type:"button",onClick:()=>{c()},className:"self-center font-mono text-[11px] uppercase tracking-[0.2em] text-te-light-gray transition-colors hover:text-te-fg",children:n("dialogs:login.cancel")}):null]})]})})}function eq({open:e,onOpenChange:t}){const{t:n}=de(),[r,i]=m.useState(!1),[a,o]=m.useState(!1);m.useEffect(()=>{if(!e)return;o(!1);const l=()=>t(!1);return window.addEventListener("online",l),()=>window.removeEventListener("online",l)},[e,t]);const s=()=>{i(!0),o(!1),window.setTimeout(()=>{navigator.onLine?t(!1):o(!0),i(!1)},350)};return f.jsx(Sn,{open:e,onOpenChange:t,children:f.jsxs(En,{showCloseButton:!0,className:"flex w-[92vw] max-w-md flex-col !gap-0 rounded-none border border-te-dialog-border bg-te-dialog-bg p-0 shadow-2xl ring-0 sm:max-w-md",children:[f.jsxs(Cn,{className:"flex flex-row items-center gap-2 border-b border-te-dialog-border bg-te-surface-hover px-5 py-4",children:[f.jsx(Kf,{className:"size-4 shrink-0 text-te-accent","aria-hidden":!0}),f.jsx(jn,{className:"font-mono text-base font-bold tracking-tighter text-te-fg",children:n("dialogs:no_internet.title")}),f.jsx(Pn,{className:"sr-only",children:n("dialogs:no_internet.description")})]}),f.jsxs("div",{className:"px-5 py-5",children:[f.jsx("p",{className:"font-sans text-sm leading-relaxed text-te-light-gray",children:n("dialogs:no_internet.body")}),a?f.jsx("p",{className:"mt-2 font-mono text-[11px] uppercase tracking-[0.18em] text-te-accent",children:n("dialogs:no_internet.still_offline")}):null,f.jsx("div",{className:"mt-5 flex justify-center",children:f.jsxs("button",{type:"button",disabled:r,onClick:s,className:ae("inline-flex items-center justify-center gap-2 border border-te-gray bg-te-surface px-5 py-2.5 font-mono text-xs uppercase tracking-[0.2em] text-te-fg transition-colors",r?"cursor-not-allowed opacity-50":"hover:border-te-accent hover:text-te-accent"),children:[f.jsx(Iu,{className:ae("size-3.5",r&&"animate-spin"),"aria-hidden":!0}),n("dialogs:no_internet.retry")]})})]})]})})}const tq=["bug","feature","ui","performance","chat","other"];function nq(...e){for(const t of e){const n=t?.trim();if(n&&!(/@wechat\.local$/i.test(n)||/\.local$/i.test(n)))return n}return""}function rq({open:e,onOpenChange:t}){const{t:n}=de("feedback"),r=pt(w=>w.user),i=pt(w=>w.profile),[a,o]=m.useState("bug"),[s,l]=m.useState(""),[c,d]=m.useState(""),[u,p]=m.useState(!0),[h,y]=m.useState(!1),[g,x]=m.useState(!1);m.useEffect(()=>{e&&(o("bug"),l(""),d(nq(r?.email,i?.email)),p(!0),y(!1),x(!1))},[e,r?.email,i?.email]),m.useEffect(()=>{h||p(a==="bug")},[a,h]);const v=m.useMemo(()=>tq.map(w=>({id:w,label:n(`type.${w}`)})),[n]),b=async()=>{if(g)return;const w=s.trim();if(w.length===0){ke.error(n("validation.content_required"));return}const _=c.trim();if(_.length>0&&!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(_)){ke.error(n("validation.email_invalid"));return}x(!0);try{const k=await Ah().catch(()=>"");let S=null;if(u)try{S=await B("read_recent_log_tail")}catch(E){console.warn("[feedback] read log tail failed",E),ke.warning(n("attach_logs_failed"))}await B("openloaf_submit_feedback",{payload:{type:a,content:w,email:_||null,context:{platform:cn(),appVersion:k,userAgent:typeof navigator<"u"?navigator.userAgent:"",...S?{logs:S}:{}}}}),ke.success(n("toast.success")),t(!1)}catch(k){const S=String(k??"");S==="FEEDBACK_AUTH_LOST"?ke.error(n("toast.auth_lost")):S==="FEEDBACK_NETWORK"?ke.error(n("toast.network")):S==="FEEDBACK_TIMEOUT"?ke.error(n("toast.timeout")):ke.error(n("toast.generic",{message:S}))}finally{x(!1)}};return f.jsx(Sn,{open:e,onOpenChange:t,children:f.jsxs(En,{showCloseButton:!0,className:"flex w-[92vw] max-w-lg flex-col !gap-0 rounded-none border border-te-dialog-border bg-te-dialog-bg p-0 shadow-2xl ring-0 sm:max-w-lg",children:[f.jsxs(Cn,{className:"flex flex-row items-center gap-2 border-b border-te-dialog-border bg-te-surface-hover px-5 py-4",children:[f.jsx(Gb,{className:"size-4 shrink-0 text-te-accent","aria-hidden":!0}),f.jsx(jn,{className:"font-mono text-base font-bold tracking-tighter text-te-fg",children:n("dialog_title")}),f.jsx(Pn,{className:"sr-only",children:n("dialog_description")})]}),f.jsxs("div",{className:"flex flex-col gap-5 px-5 py-5",children:[f.jsx("p",{className:"font-sans text-xs leading-relaxed text-te-light-gray",children:n("dialog_description")}),f.jsxs("div",{children:[f.jsx("label",{className:"mb-1.5 block font-mono text-[10px] uppercase tracking-[0.2em] text-te-light-gray",children:n("type_label")}),f.jsxs("div",{className:"relative inline-flex w-full items-center border border-te-gray/40 bg-te-surface transition-colors focus-within:border-te-accent hover:border-te-gray",children:[f.jsx("select",{value:a,onChange:w=>o(w.target.value),disabled:g,className:"w-full cursor-pointer appearance-none bg-transparent py-2 pr-8 pl-3 font-mono text-sm text-te-fg focus:outline-none disabled:cursor-not-allowed disabled:opacity-60",children:v.map(w=>f.jsx("option",{value:w.id,children:w.label},w.id))}),f.jsx(Pa,{className:"pointer-events-none absolute right-2 size-3.5 text-te-light-gray"})]})]}),f.jsxs("div",{children:[f.jsx("label",{className:"mb-1.5 block font-mono text-[10px] uppercase tracking-[0.2em] text-te-light-gray",children:n("content_label")}),f.jsx("textarea",{value:s,onChange:w=>l(w.target.value),disabled:g,placeholder:n("content_placeholder"),rows:6,className:"w-full resize-none border border-te-gray/40 bg-te-surface px-3 py-2 font-sans text-sm text-te-fg placeholder:text-te-light-gray/60 transition-colors focus:border-te-accent focus:outline-none disabled:cursor-not-allowed disabled:opacity-60"})]}),f.jsxs("div",{children:[f.jsx("label",{className:"mb-1.5 block font-mono text-[10px] uppercase tracking-[0.2em] text-te-light-gray",children:n("email_label")}),f.jsx("input",{type:"email",value:c,onChange:w=>d(w.target.value),disabled:g,placeholder:n("email_placeholder"),className:"w-full border border-te-gray/40 bg-te-surface px-3 py-2 font-mono text-sm text-te-fg placeholder:text-te-light-gray/60 transition-colors focus:border-te-accent focus:outline-none disabled:cursor-not-allowed disabled:opacity-60"}),f.jsx("p",{className:"mt-1 font-sans text-[11px] text-te-light-gray/80",children:n("email_hint")})]}),f.jsx("div",{children:f.jsxs("button",{type:"button",role:"checkbox","aria-checked":u,onClick:()=>{y(!0),p(w=>!w)},disabled:g,className:"group flex w-full items-start gap-3 text-left disabled:cursor-not-allowed disabled:opacity-60",children:[f.jsx("span",{className:ae("mt-0.5 flex size-4 shrink-0 items-center justify-center border transition-colors",u?"border-te-accent bg-te-accent text-te-accent-fg":"border-te-gray/60 bg-te-surface group-hover:border-te-gray"),"aria-hidden":!0,children:u&&f.jsx(Er,{className:"size-3",strokeWidth:3})}),f.jsxs("span",{className:"flex-1",children:[f.jsx("span",{className:"block font-mono text-xs text-te-fg",children:n("attach_logs_label")}),f.jsx("span",{className:"mt-1 block font-sans text-[11px] leading-relaxed text-te-light-gray/80",children:n("attach_logs_hint")})]})]})}),f.jsxs("div",{className:"flex flex-row-reverse items-center gap-3 pt-1",children:[f.jsxs("button",{type:"button",onClick:()=>{b()},disabled:g,className:ae("inline-flex items-center gap-2 border border-te-accent bg-te-accent px-5 py-2.5 font-mono text-xs uppercase tracking-[0.2em] text-te-accent-fg transition-colors",g?"cursor-not-allowed opacity-60":"hover:bg-te-accent/90"),children:[f.jsx(FO,{className:ae("size-3.5",g&&"animate-pulse"),"aria-hidden":!0}),n(g?"submit_loading":"submit")]}),f.jsx("button",{type:"button",onClick:()=>t(!1),disabled:g,className:"inline-flex items-center gap-2 border border-te-gray bg-te-surface px-4 py-2.5 font-mono text-xs uppercase tracking-[0.2em] text-te-light-gray transition-colors hover:border-te-gray hover:text-te-fg disabled:cursor-not-allowed disabled:opacity-60",children:n("cancel")})]})]})]})})}const iS=new Set(ub);function iq(){const{t:e}=de(),t=qe(s=>s.hotkeyConflicts),n=qe(s=>s.clearHotkeyConflicts),r=m.useMemo(()=>t.filter(s=>iS.has(s.id)),[t]),i=m.useMemo(()=>r.map(s=>s.id),[r]),a=i.length>0,o=s=>{if(s)return;const l=qe.getState().hotkeyConflicts.filter(d=>iS.has(d.id));if(l.length===0){n();return}const c=nn.getState().setBinding;Promise.all(l.map(d=>c(d.id,null))).finally(()=>{n()}),ke.message(e("dialogs:hotkey_conflict.cleared_toast",{count:l.length}))};return f.jsx(Sn,{open:a,onOpenChange:o,children:f.jsxs(En,{showCloseButton:!0,className:"flex w-[92vw] max-w-md flex-col !gap-0 rounded-none border border-te-dialog-border bg-te-dialog-bg p-0 shadow-2xl ring-0 sm:max-w-md",children:[f.jsxs(Cn,{className:"flex flex-row items-center gap-2 border-b border-te-dialog-border bg-te-surface-hover px-5 py-4",children:[f.jsx(_l,{className:"size-4 shrink-0 text-te-accent","aria-hidden":!0}),f.jsx(jn,{className:"font-mono text-base font-bold tracking-tighter text-te-fg",children:e("dialogs:hotkey_conflict.title")}),f.jsx(Pn,{className:"sr-only",children:e("dialogs:hotkey_conflict.description",{count:i.length})})]}),f.jsx("div",{className:"px-5 pt-4 pb-3 font-sans text-sm leading-relaxed text-te-light-gray",children:e("dialogs:hotkey_conflict.description",{count:i.length})}),f.jsx("div",{className:"px-5 pt-1 pb-4",children:f.jsx($0,{filterIds:i,divided:!0})})]})})}function aq(){const{t:e}=de(),t=qe(c=>c.authRecoveryDialog),n=qe(c=>c.closeAuthRecoveryDialog),r=mt(c=>c.items),[i,a]=m.useState(!1),o=m.useMemo(()=>t.historyId?r.find(c=>c.id===t.historyId)??null:null,[t.historyId,r]),s=m.useMemo(()=>o?(o.refined_text??o.text??"").trim():"",[o]);m.useEffect(()=>{t.open||a(!1)},[t.open]);const l=async()=>{if(s)try{await zn(s),a(!0),window.setTimeout(()=>a(!1),1800)}catch(c){console.warn("[auth-recovery] copy failed:",c)}};return f.jsx(Sn,{open:t.open,onOpenChange:c=>{c||n()},children:f.jsxs(En,{showCloseButton:!0,className:"flex w-[92vw] max-w-md flex-col !gap-0 rounded-none border border-te-dialog-border bg-te-dialog-bg p-0 shadow-2xl ring-0 sm:max-w-lg",children:[f.jsxs(Cn,{className:"flex flex-row items-start gap-2 border-b border-te-dialog-border bg-te-surface-hover py-4 pr-12 pl-5",children:[t.status==="pending"?f.jsx(jr,{className:"mt-0.5 size-4 shrink-0 animate-spin text-te-accent","aria-hidden":!0}):t.status==="error"?f.jsx(_l,{className:"mt-0.5 size-4 shrink-0 text-[#ff4d4d]","aria-hidden":!0}):f.jsx(Kk,{className:"mt-0.5 size-4 shrink-0 text-te-accent","aria-hidden":!0}),f.jsx(jn,{className:"min-w-0 flex-1 font-mono text-base font-bold tracking-tighter text-te-fg",children:e(`dialogs:auth_recovery.title_${t.status}`)}),f.jsx(Pn,{className:"sr-only",children:e(`dialogs:auth_recovery.description_${t.status}`)})]}),f.jsxs("div",{className:"flex flex-col gap-4 px-5 py-5",children:[f.jsx("p",{className:"font-sans text-sm leading-relaxed text-te-light-gray",children:e(`dialogs:auth_recovery.description_${t.status}`)}),t.status==="success"&&f.jsx("div",{className:"flex max-h-72 flex-col gap-2 overflow-hidden",children:f.jsx("div",{className:ae("max-h-72 overflow-auto whitespace-pre-wrap break-words border border-te-gray/40 bg-te-surface px-3 py-2 font-sans text-sm leading-relaxed text-te-fg"),children:s||e("dialogs:auth_recovery.empty_transcript")})}),t.status==="error"&&t.errorMessage&&f.jsx("div",{className:"border border-[#ff4d4d]/40 bg-[#ff4d4d]/5 px-3 py-2 font-mono text-xs leading-relaxed break-words text-[#ff4d4d]",children:t.errorMessage}),f.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-2",children:[t.status==="success"&&f.jsxs("button",{type:"button",onClick:()=>{l()},disabled:!s,className:ae("inline-flex items-center justify-center gap-2 border px-4 py-2 font-mono text-xs uppercase tracking-[0.2em] transition",i?"border-te-accent bg-te-accent text-te-accent-fg":"border-te-accent text-te-accent hover:bg-te-accent hover:text-te-accent-fg",!s&&"cursor-not-allowed opacity-40 hover:bg-transparent hover:text-te-accent"),children:[i?f.jsx(Kk,{className:"size-3.5","aria-hidden":!0}):f.jsx(_s,{className:"size-3.5","aria-hidden":!0}),e(i?"dialogs:auth_recovery.copied":"dialogs:auth_recovery.copy")]}),f.jsx("button",{type:"button",onClick:n,disabled:t.status==="pending",className:ae("inline-flex items-center justify-center border border-te-gray bg-te-surface px-4 py-2 font-mono text-xs uppercase tracking-[0.2em] text-te-fg transition hover:border-te-accent hover:text-te-accent",t.status==="pending"&&"cursor-not-allowed opacity-40 hover:border-te-gray hover:text-te-fg"),children:e(t.status==="pending"?"dialogs:auth_recovery.close_disabled":"dialogs:auth_recovery.close")})]})]})]})})}var oq=["dangerouslySetInnerHTML","onCopy","onCopyCapture","onCut","onCutCapture","onPaste","onPasteCapture","onCompositionEnd","onCompositionEndCapture","onCompositionStart","onCompositionStartCapture","onCompositionUpdate","onCompositionUpdateCapture","onFocus","onFocusCapture","onBlur","onBlurCapture","onChange","onChangeCapture","onBeforeInput","onBeforeInputCapture","onInput","onInputCapture","onReset","onResetCapture","onSubmit","onSubmitCapture","onInvalid","onInvalidCapture","onLoad","onLoadCapture","onError","onErrorCapture","onKeyDown","onKeyDownCapture","onKeyPress","onKeyPressCapture","onKeyUp","onKeyUpCapture","onAbort","onAbortCapture","onCanPlay","onCanPlayCapture","onCanPlayThrough","onCanPlayThroughCapture","onDurationChange","onDurationChangeCapture","onEmptied","onEmptiedCapture","onEncrypted","onEncryptedCapture","onEnded","onEndedCapture","onLoadedData","onLoadedDataCapture","onLoadedMetadata","onLoadedMetadataCapture","onLoadStart","onLoadStartCapture","onPause","onPauseCapture","onPlay","onPlayCapture","onPlaying","onPlayingCapture","onProgress","onProgressCapture","onRateChange","onRateChangeCapture","onSeeked","onSeekedCapture","onSeeking","onSeekingCapture","onStalled","onStalledCapture","onSuspend","onSuspendCapture","onTimeUpdate","onTimeUpdateCapture","onVolumeChange","onVolumeChangeCapture","onWaiting","onWaitingCapture","onAuxClick","onAuxClickCapture","onClick","onClickCapture","onContextMenu","onContextMenuCapture","onDoubleClick","onDoubleClickCapture","onDrag","onDragCapture","onDragEnd","onDragEndCapture","onDragEnter","onDragEnterCapture","onDragExit","onDragExitCapture","onDragLeave","onDragLeaveCapture","onDragOver","onDragOverCapture","onDragStart","onDragStartCapture","onDrop","onDropCapture","onMouseDown","onMouseDownCapture","onMouseEnter","onMouseLeave","onMouseMove","onMouseMoveCapture","onMouseOut","onMouseOutCapture","onMouseOver","onMouseOverCapture","onMouseUp","onMouseUpCapture","onSelect","onSelectCapture","onTouchCancel","onTouchCancelCapture","onTouchEnd","onTouchEndCapture","onTouchMove","onTouchMoveCapture","onTouchStart","onTouchStartCapture","onPointerDown","onPointerDownCapture","onPointerMove","onPointerMoveCapture","onPointerUp","onPointerUpCapture","onPointerCancel","onPointerCancelCapture","onPointerEnter","onPointerEnterCapture","onPointerLeave","onPointerLeaveCapture","onPointerOver","onPointerOverCapture","onPointerOut","onPointerOutCapture","onGotPointerCapture","onGotPointerCaptureCapture","onLostPointerCapture","onLostPointerCaptureCapture","onScroll","onScrollCapture","onWheel","onWheelCapture","onAnimationStart","onAnimationStartCapture","onAnimationEnd","onAnimationEndCapture","onAnimationIteration","onAnimationIterationCapture","onTransitionEnd","onTransitionEndCapture"];function z0(e){if(typeof e!="string")return!1;var t=oq;return t.includes(e)}var sq=["aria-activedescendant","aria-atomic","aria-autocomplete","aria-busy","aria-checked","aria-colcount","aria-colindex","aria-colspan","aria-controls","aria-current","aria-describedby","aria-details","aria-disabled","aria-errormessage","aria-expanded","aria-flowto","aria-haspopup","aria-hidden","aria-invalid","aria-keyshortcuts","aria-label","aria-labelledby","aria-level","aria-live","aria-modal","aria-multiline","aria-multiselectable","aria-orientation","aria-owns","aria-placeholder","aria-posinset","aria-pressed","aria-readonly","aria-relevant","aria-required","aria-roledescription","aria-rowcount","aria-rowindex","aria-rowspan","aria-selected","aria-setsize","aria-sort","aria-valuemax","aria-valuemin","aria-valuenow","aria-valuetext","className","color","height","id","lang","max","media","method","min","name","style","target","width","role","tabIndex","accentHeight","accumulate","additive","alignmentBaseline","allowReorder","alphabetic","amplitude","arabicForm","ascent","attributeName","attributeType","autoReverse","azimuth","baseFrequency","baselineShift","baseProfile","bbox","begin","bias","by","calcMode","capHeight","clip","clipPath","clipPathUnits","clipRule","colorInterpolation","colorInterpolationFilters","colorProfile","colorRendering","contentScriptType","contentStyleType","cursor","cx","cy","d","decelerate","descent","diffuseConstant","direction","display","divisor","dominantBaseline","dur","dx","dy","edgeMode","elevation","enableBackground","end","exponent","externalResourcesRequired","fill","fillOpacity","fillRule","filter","filterRes","filterUnits","floodColor","floodOpacity","focusable","fontFamily","fontSize","fontSizeAdjust","fontStretch","fontStyle","fontVariant","fontWeight","format","from","fx","fy","g1","g2","glyphName","glyphOrientationHorizontal","glyphOrientationVertical","glyphRef","gradientTransform","gradientUnits","hanging","horizAdvX","horizOriginX","href","ideographic","imageRendering","in2","in","intercept","k1","k2","k3","k4","k","kernelMatrix","kernelUnitLength","kerning","keyPoints","keySplines","keyTimes","lengthAdjust","letterSpacing","lightingColor","limitingConeAngle","local","markerEnd","markerHeight","markerMid","markerStart","markerUnits","markerWidth","mask","maskContentUnits","maskUnits","mathematical","mode","numOctaves","offset","opacity","operator","order","orient","orientation","origin","overflow","overlinePosition","overlineThickness","paintOrder","panose1","pathLength","patternContentUnits","patternTransform","patternUnits","pointerEvents","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","r","radius","refX","refY","renderingIntent","repeatCount","repeatDur","requiredExtensions","requiredFeatures","restart","result","rotate","rx","ry","seed","shapeRendering","slope","spacing","specularConstant","specularExponent","speed","spreadMethod","startOffset","stdDeviation","stemh","stemv","stitchTiles","stopColor","stopOpacity","strikethroughPosition","strikethroughThickness","string","stroke","strokeDasharray","strokeDashoffset","strokeLinecap","strokeLinejoin","strokeMiterlimit","strokeOpacity","strokeWidth","surfaceScale","systemLanguage","tableValues","targetX","targetY","textAnchor","textDecoration","textLength","textRendering","to","transform","u1","u2","underlinePosition","underlineThickness","unicode","unicodeBidi","unicodeRange","unitsPerEm","vAlphabetic","values","vectorEffect","version","vertAdvY","vertOriginX","vertOriginY","vHanging","vIdeographic","viewTarget","visibility","vMathematical","widths","wordSpacing","writingMode","x1","x2","x","xChannelSelector","xHeight","xlinkActuate","xlinkArcrole","xlinkHref","xlinkRole","xlinkShow","xlinkTitle","xlinkType","xmlBase","xmlLang","xmlns","xmlnsXlink","xmlSpace","y1","y2","y","yChannelSelector","z","zoomAndPan","ref","key","angle"],lq=new Set(sq);function VR(e){return typeof e!="string"?!1:lq.has(e)}function qR(e){return typeof e=="string"&&e.startsWith("data-")}function ki(e){if(typeof e!="object"||e===null)return{};var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(VR(n)||qR(n))&&(t[n]=e[n]);return t}function Fu(e){if(e==null)return null;if(m.isValidElement(e)&&typeof e.props=="object"&&e.props!==null){var t=e.props;return ki(t)}return typeof e=="object"&&!Array.isArray(e)?ki(e):null}function ur(e){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(VR(n)||qR(n)||z0(n))&&(t[n]=e[n]);return t}function cq(e){return e==null?null:m.isValidElement(e)?ur(e.props):typeof e=="object"&&!Array.isArray(e)?ur(e):null}var uq=["children","width","height","viewBox","className","style","title","desc"];function Jv(){return Jv=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Jv.apply(null,arguments)}function dq(e,t){if(e==null)return{};var n,r,i=fq(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function fq(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var KR=m.forwardRef((e,t)=>{var{children:n,width:r,height:i,viewBox:a,className:o,style:s,title:l,desc:c}=e,d=dq(e,uq),u=a||{width:r,height:i,x:0,y:0},p=bt("recharts-surface",o);return m.createElement("svg",Jv({},ur(d),{className:p,width:r,height:i,style:s,viewBox:"".concat(u.x," ").concat(u.y," ").concat(u.width," ").concat(u.height),ref:t}),m.createElement("title",null,l),m.createElement("desc",null,c),n)}),pq=["children","className"];function ex(){return ex=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ex.apply(null,arguments)}function hq(e,t){if(e==null)return{};var n,r,i=mq(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function mq(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var Br=m.forwardRef((e,t)=>{var{children:n,className:r}=e,i=hq(e,pq),a=bt("recharts-layer",r);return m.createElement("g",ex({className:a},ur(i),{ref:t}),n)}),gq=m.createContext(null);function Ot(e){return function(){return e}}const GR=Math.cos,pp=Math.sin,ji=Math.sqrt,hp=Math.PI,Rh=2*hp,tx=Math.PI,nx=2*tx,Vo=1e-6,yq=nx-Vo;function YR(e){this._+=e[0];for(let t=1,n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function vq(e){let t=Math.floor(e);if(!(t>=0))throw new Error(`invalid digits: ${e}`);if(t>15)return YR;const n=10**t;return function(r){this._+=r[0];for(let i=1,a=r.length;i<a;++i)this._+=Math.round(arguments[i]*n)/n+r[i]}}class xq{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=t==null?YR:vq(t)}moveTo(t,n){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(t,n){this._append`L${this._x1=+t},${this._y1=+n}`}quadraticCurveTo(t,n,r,i){this._append`Q${+t},${+n},${this._x1=+r},${this._y1=+i}`}bezierCurveTo(t,n,r,i,a,o){this._append`C${+t},${+n},${+r},${+i},${this._x1=+a},${this._y1=+o}`}arcTo(t,n,r,i,a){if(t=+t,n=+n,r=+r,i=+i,a=+a,a<0)throw new Error(`negative radius: ${a}`);let o=this._x1,s=this._y1,l=r-t,c=i-n,d=o-t,u=s-n,p=d*d+u*u;if(this._x1===null)this._append`M${this._x1=t},${this._y1=n}`;else if(p>Vo)if(!(Math.abs(u*l-c*d)>Vo)||!a)this._append`L${this._x1=t},${this._y1=n}`;else{let h=r-o,y=i-s,g=l*l+c*c,x=h*h+y*y,v=Math.sqrt(g),b=Math.sqrt(p),w=a*Math.tan((tx-Math.acos((g+p-x)/(2*v*b)))/2),_=w/b,k=w/v;Math.abs(_-1)>Vo&&this._append`L${t+_*d},${n+_*u}`,this._append`A${a},${a},0,0,${+(u*h>d*y)},${this._x1=t+k*l},${this._y1=n+k*c}`}}arc(t,n,r,i,a,o){if(t=+t,n=+n,r=+r,o=!!o,r<0)throw new Error(`negative radius: ${r}`);let s=r*Math.cos(i),l=r*Math.sin(i),c=t+s,d=n+l,u=1^o,p=o?i-a:a-i;this._x1===null?this._append`M${c},${d}`:(Math.abs(this._x1-c)>Vo||Math.abs(this._y1-d)>Vo)&&this._append`L${c},${d}`,r&&(p<0&&(p=p%nx+nx),p>yq?this._append`A${r},${r},0,1,${u},${t-s},${n-l}A${r},${r},0,1,${u},${this._x1=c},${this._y1=d}`:p>Vo&&this._append`A${r},${r},0,${+(p>=tx)},${u},${this._x1=t+r*Math.cos(a)},${this._y1=n+r*Math.sin(a)}`)}rect(t,n,r,i){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${r=+r}v${+i}h${-r}Z`}toString(){return this._}}function F0(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{const r=Math.floor(n);if(!(r>=0))throw new RangeError(`invalid digits: ${n}`);t=r}return e},()=>new xq(t)}function B0(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function XR(e){this._context=e}XR.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function Mh(e){return new XR(e)}function ZR(e){return e[0]}function QR(e){return e[1]}function JR(e,t){var n=Ot(!0),r=null,i=Mh,a=null,o=F0(s);e=typeof e=="function"?e:e===void 0?ZR:Ot(e),t=typeof t=="function"?t:t===void 0?QR:Ot(t);function s(l){var c,d=(l=B0(l)).length,u,p=!1,h;for(r==null&&(a=i(h=o())),c=0;c<=d;++c)!(c<d&&n(u=l[c],c,l))===p&&((p=!p)?a.lineStart():a.lineEnd()),p&&a.point(+e(u,c,l),+t(u,c,l));if(h)return a=null,h+""||null}return s.x=function(l){return arguments.length?(e=typeof l=="function"?l:Ot(+l),s):e},s.y=function(l){return arguments.length?(t=typeof l=="function"?l:Ot(+l),s):t},s.defined=function(l){return arguments.length?(n=typeof l=="function"?l:Ot(!!l),s):n},s.curve=function(l){return arguments.length?(i=l,r!=null&&(a=i(r)),s):i},s.context=function(l){return arguments.length?(l==null?r=a=null:a=i(r=l),s):r},s}function Md(e,t,n){var r=null,i=Ot(!0),a=null,o=Mh,s=null,l=F0(c);e=typeof e=="function"?e:e===void 0?ZR:Ot(+e),t=typeof t=="function"?t:Ot(t===void 0?0:+t),n=typeof n=="function"?n:n===void 0?QR:Ot(+n);function c(u){var p,h,y,g=(u=B0(u)).length,x,v=!1,b,w=new Array(g),_=new Array(g);for(a==null&&(s=o(b=l())),p=0;p<=g;++p){if(!(p<g&&i(x=u[p],p,u))===v)if(v=!v)h=p,s.areaStart(),s.lineStart();else{for(s.lineEnd(),s.lineStart(),y=p-1;y>=h;--y)s.point(w[y],_[y]);s.lineEnd(),s.areaEnd()}v&&(w[p]=+e(x,p,u),_[p]=+t(x,p,u),s.point(r?+r(x,p,u):w[p],n?+n(x,p,u):_[p]))}if(b)return s=null,b+""||null}function d(){return JR().defined(i).curve(o).context(a)}return c.x=function(u){return arguments.length?(e=typeof u=="function"?u:Ot(+u),r=null,c):e},c.x0=function(u){return arguments.length?(e=typeof u=="function"?u:Ot(+u),c):e},c.x1=function(u){return arguments.length?(r=u==null?null:typeof u=="function"?u:Ot(+u),c):r},c.y=function(u){return arguments.length?(t=typeof u=="function"?u:Ot(+u),n=null,c):t},c.y0=function(u){return arguments.length?(t=typeof u=="function"?u:Ot(+u),c):t},c.y1=function(u){return arguments.length?(n=u==null?null:typeof u=="function"?u:Ot(+u),c):n},c.lineX0=c.lineY0=function(){return d().x(e).y(t)},c.lineY1=function(){return d().x(e).y(n)},c.lineX1=function(){return d().x(r).y(t)},c.defined=function(u){return arguments.length?(i=typeof u=="function"?u:Ot(!!u),c):i},c.curve=function(u){return arguments.length?(o=u,a!=null&&(s=o(a)),c):o},c.context=function(u){return arguments.length?(u==null?a=s=null:s=o(a=u),c):a},c}class e2{constructor(t,n){this._context=t,this._x=n}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(t,n){switch(t=+t,n=+n,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,n,t,n):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+n)/2,t,this._y0,t,n);break}}this._x0=t,this._y0=n}}function bq(e){return new e2(e,!0)}function wq(e){return new e2(e,!1)}const W0={draw(e,t){const n=ji(t/hp);e.moveTo(n,0),e.arc(0,0,n,0,Rh)}},kq={draw(e,t){const n=ji(t/5)/2;e.moveTo(-3*n,-n),e.lineTo(-n,-n),e.lineTo(-n,-3*n),e.lineTo(n,-3*n),e.lineTo(n,-n),e.lineTo(3*n,-n),e.lineTo(3*n,n),e.lineTo(n,n),e.lineTo(n,3*n),e.lineTo(-n,3*n),e.lineTo(-n,n),e.lineTo(-3*n,n),e.closePath()}},t2=ji(1/3),_q=t2*2,Sq={draw(e,t){const n=ji(t/_q),r=n*t2;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}},Eq={draw(e,t){const n=ji(t),r=-n/2;e.rect(r,r,n,n)}},Cq=.8908130915292852,n2=pp(hp/10)/pp(7*hp/10),jq=pp(Rh/10)*n2,Pq=-GR(Rh/10)*n2,Nq={draw(e,t){const n=ji(t*Cq),r=jq*n,i=Pq*n;e.moveTo(0,-n),e.lineTo(r,i);for(let a=1;a<5;++a){const o=Rh*a/5,s=GR(o),l=pp(o);e.lineTo(l*n,-s*n),e.lineTo(s*r-l*i,l*r+s*i)}e.closePath()}},xg=ji(3),Tq={draw(e,t){const n=-ji(t/(xg*3));e.moveTo(0,n*2),e.lineTo(-xg*n,-n),e.lineTo(xg*n,-n),e.closePath()}},qr=-.5,Kr=ji(3)/2,rx=1/ji(12),Oq=(rx/2+1)*3,Aq={draw(e,t){const n=ji(t/Oq),r=n/2,i=n*rx,a=r,o=n*rx+n,s=-a,l=o;e.moveTo(r,i),e.lineTo(a,o),e.lineTo(s,l),e.lineTo(qr*r-Kr*i,Kr*r+qr*i),e.lineTo(qr*a-Kr*o,Kr*a+qr*o),e.lineTo(qr*s-Kr*l,Kr*s+qr*l),e.lineTo(qr*r+Kr*i,qr*i-Kr*r),e.lineTo(qr*a+Kr*o,qr*o-Kr*a),e.lineTo(qr*s+Kr*l,qr*l-Kr*s),e.closePath()}};function Rq(e,t){let n=null,r=F0(i);e=typeof e=="function"?e:Ot(e||W0),t=typeof t=="function"?t:Ot(t===void 0?64:+t);function i(){let a;if(n||(n=a=r()),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),a)return n=null,a+""||null}return i.type=function(a){return arguments.length?(e=typeof a=="function"?a:Ot(a),i):e},i.size=function(a){return arguments.length?(t=typeof a=="function"?a:Ot(+a),i):t},i.context=function(a){return arguments.length?(n=a??null,i):n},i}function mp(){}function gp(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function r2(e){this._context=e}r2.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:gp(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:gp(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Mq(e){return new r2(e)}function i2(e){this._context=e}i2.prototype={areaStart:mp,areaEnd:mp,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:gp(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Iq(e){return new i2(e)}function a2(e){this._context=e}a2.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:gp(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Dq(e){return new a2(e)}function o2(e){this._context=e}o2.prototype={areaStart:mp,areaEnd:mp,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function Lq(e){return new o2(e)}function aS(e){return e<0?-1:1}function oS(e,t,n){var r=e._x1-e._x0,i=t-e._x1,a=(e._y1-e._y0)/(r||i<0&&-0),o=(n-e._y1)/(i||r<0&&-0),s=(a*i+o*r)/(r+i);return(aS(a)+aS(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(s))||0}function sS(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function bg(e,t,n){var r=e._x0,i=e._y0,a=e._x1,o=e._y1,s=(a-r)/3;e._context.bezierCurveTo(r+s,i+s*t,a-s,o-s*n,a,o)}function yp(e){this._context=e}yp.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:bg(this,this._t0,sS(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,bg(this,sS(this,n=oS(this,e,t)),n);break;default:bg(this,this._t0,n=oS(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function s2(e){this._context=new l2(e)}(s2.prototype=Object.create(yp.prototype)).point=function(e,t){yp.prototype.point.call(this,t,e)};function l2(e){this._context=e}l2.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,i,a){this._context.bezierCurveTo(t,e,r,n,a,i)}};function $q(e){return new yp(e)}function zq(e){return new s2(e)}function c2(e){this._context=e}c2.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),n===2)this._context.lineTo(e[1],t[1]);else for(var r=lS(e),i=lS(t),a=0,o=1;o<n;++a,++o)this._context.bezierCurveTo(r[0][a],i[0][a],r[1][a],i[1][a],e[o],t[o]);(this._line||this._line!==0&&n===1)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(e,t){this._x.push(+e),this._y.push(+t)}};function lS(e){var t,n=e.length-1,r,i=new Array(n),a=new Array(n),o=new Array(n);for(i[0]=0,a[0]=2,o[0]=e[0]+2*e[1],t=1;t<n-1;++t)i[t]=1,a[t]=4,o[t]=4*e[t]+2*e[t+1];for(i[n-1]=2,a[n-1]=7,o[n-1]=8*e[n-1]+e[n],t=1;t<n;++t)r=i[t]/a[t-1],a[t]-=r,o[t]-=r*o[t-1];for(i[n-1]=o[n-1]/a[n-1],t=n-2;t>=0;--t)i[t]=(o[t]-i[t+1])/a[t];for(a[n-1]=(e[n]+i[n-1])/2,t=0;t<n-1;++t)a[t]=2*e[t+1]-i[t+1];return[i,a]}function Fq(e){return new c2(e)}function Ih(e,t){this._context=e,this._t=t}Ih.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&this._point===2&&this._context.lineTo(this._x,this._y),(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}break}}this._x=e,this._y=t}};function Bq(e){return new Ih(e,.5)}function Wq(e){return new Ih(e,0)}function Hq(e){return new Ih(e,1)}function fs(e,t){if((o=e.length)>1)for(var n=1,r,i,a=e[t[0]],o,s=a.length;n<o;++n)for(i=a,a=e[t[n]],r=0;r<s;++r)a[r][1]+=a[r][0]=isNaN(i[r][1])?i[r][0]:i[r][1]}function ix(e){for(var t=e.length,n=new Array(t);--t>=0;)n[t]=t;return n}function Uq(e,t){return e[t]}function Vq(e){const t=[];return t.key=e,t}function qq(){var e=Ot([]),t=ix,n=fs,r=Uq;function i(a){var o=Array.from(e.apply(this,arguments),Vq),s,l=o.length,c=-1,d;for(const u of a)for(s=0,++c;s<l;++s)(o[s][c]=[0,+r(u,o[s].key,c,a)]).data=u;for(s=0,d=B0(t(o));s<l;++s)o[d[s]].index=s;return n(o,d),o}return i.keys=function(a){return arguments.length?(e=typeof a=="function"?a:Ot(Array.from(a)),i):e},i.value=function(a){return arguments.length?(r=typeof a=="function"?a:Ot(+a),i):r},i.order=function(a){return arguments.length?(t=a==null?ix:typeof a=="function"?a:Ot(Array.from(a)),i):t},i.offset=function(a){return arguments.length?(n=a??fs,i):n},i}function Kq(e,t){if((r=e.length)>0){for(var n,r,i=0,a=e[0].length,o;i<a;++i){for(o=n=0;n<r;++n)o+=e[n][i][1]||0;if(o)for(n=0;n<r;++n)e[n][i][1]/=o}fs(e,t)}}function Gq(e,t){if((i=e.length)>0){for(var n=0,r=e[t[0]],i,a=r.length;n<a;++n){for(var o=0,s=0;o<i;++o)s+=e[o][n][1]||0;r[n][1]+=r[n][0]=-s/2}fs(e,t)}}function Yq(e,t){if(!(!((o=e.length)>0)||!((a=(i=e[t[0]]).length)>0))){for(var n=0,r=1,i,a,o;r<a;++r){for(var s=0,l=0,c=0;s<o;++s){for(var d=e[t[s]],u=d[r][1]||0,p=d[r-1][1]||0,h=(u-p)/2,y=0;y<s;++y){var g=e[t[y]],x=g[r][1]||0,v=g[r-1][1]||0;h+=x-v}l+=u,c+=h*u}i[r-1][1]+=i[r-1][0]=n,l&&(n-=c/l)}i[r-1][1]+=i[r-1][0]=n,fs(e,t)}}var wg={},kg={},cS;function Xq(){return cS||(cS=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return n==="__proto__"}e.isUnsafeProperty=t})(kg)),kg}var _g={},uS;function u2(){return uS||(uS=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){switch(typeof n){case"number":case"symbol":return!1;case"string":return n.includes(".")||n.includes("[")||n.includes("]")}}e.isDeepKey=t})(_g)),_g}var Sg={},dS;function H0(){return dS||(dS=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return typeof n=="string"||typeof n=="symbol"?n:Object.is(n?.valueOf?.(),-0)?"-0":String(n)}e.toKey=t})(Sg)),Sg}var Eg={},Cg={},fS;function Zq(){return fS||(fS=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){if(n==null)return"";if(typeof n=="string")return n;if(Array.isArray(n))return n.map(t).join(",");const r=String(n);return r==="0"&&Object.is(Number(n),-0)?"-0":r}e.toString=t})(Cg)),Cg}var pS;function U0(){return pS||(pS=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Zq(),n=H0();function r(i){if(Array.isArray(i))return i.map(n.toKey);if(typeof i=="symbol")return[i];i=t.toString(i);const a=[],o=i.length;if(o===0)return a;let s=0,l="",c="",d=!1;for(i.charCodeAt(0)===46&&(a.push(""),s++);s<o;){const u=i[s];c?u==="\\"&&s+1<o?(s++,l+=i[s]):u===c?c="":l+=u:d?u==='"'||u==="'"?c=u:u==="]"?(d=!1,a.push(l),l=""):l+=u:u==="["?(d=!0,l&&(a.push(l),l="")):u==="."?l&&(a.push(l),l=""):l+=u,s++}return l&&a.push(l),a}e.toPath=r})(Eg)),Eg}var hS;function V0(){return hS||(hS=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Xq(),n=u2(),r=H0(),i=U0();function a(s,l,c){if(s==null)return c;switch(typeof l){case"string":{if(t.isUnsafeProperty(l))return c;const d=s[l];return d===void 0?n.isDeepKey(l)?a(s,i.toPath(l),c):c:d}case"number":case"symbol":{typeof l=="number"&&(l=r.toKey(l));const d=s[l];return d===void 0?c:d}default:{if(Array.isArray(l))return o(s,l,c);if(Object.is(l?.valueOf(),-0)?l="-0":l=String(l),t.isUnsafeProperty(l))return c;const d=s[l];return d===void 0?c:d}}}function o(s,l,c){if(l.length===0)return c;let d=s;for(let u=0;u<l.length;u++){if(d==null||t.isUnsafeProperty(l[u]))return c;d=d[l[u]]}return d===void 0?c:d}e.get=a})(wg)),wg}var jg,mS;function Qq(){return mS||(mS=1,jg=V0().get),jg}var Jq=Qq();const Ol=Ci(Jq);var eK=4;function fo(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:eK,n=10**t,r=Math.round(e*n)/n;return Object.is(r,-0)?0:r}function Yt(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return e.reduce((i,a,o)=>{var s=n[o-1];return typeof s=="string"?i+s+a:s!==void 0?i+fo(s)+a:i+a},"")}var yr=e=>e===0?0:e>0?1:-1,ra=e=>typeof e=="number"&&e!=+e,ps=e=>typeof e=="string"&&e.indexOf("%")===e.length-1,Me=e=>(typeof e=="number"||e instanceof Number)&&!ra(e),ia=e=>Me(e)||typeof e=="string",tK=0,cu=e=>{var t=++tK;return"".concat(e||"").concat(t)},_i=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!Me(t)&&typeof t!="string")return r;var a;if(ps(t)){if(n==null)return r;var o=t.indexOf("%");a=n*parseFloat(t.slice(0,o))/100}else a=+t;return ra(a)&&(a=r),i&&n!=null&&a>n&&(a=n),a},d2=e=>{if(!Array.isArray(e))return!1;for(var t=e.length,n={},r=0;r<t;r++)if(!n[String(e[r])])n[String(e[r])]=!0;else return!0;return!1};function Xt(e,t,n){return Me(e)&&Me(t)?fo(e+n*(t-e)):t}function f2(e,t,n){if(!(!e||!e.length))return e.find(r=>r&&(typeof t=="function"?t(r):Ol(r,t))===n)}var Ft=e=>e===null||typeof e>"u",Bu=e=>Ft(e)?e:"".concat(e.charAt(0).toUpperCase()).concat(e.slice(1));function vr(e){return e!=null}function Cs(){}var nK=["type","size","sizeType"];function ax(){return ax=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ax.apply(null,arguments)}function gS(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function yS(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?gS(Object(n),!0).forEach(function(r){rK(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):gS(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function rK(e,t,n){return(t=iK(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function iK(e){var t=aK(e,"string");return typeof t=="symbol"?t:t+""}function aK(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function oK(e,t){if(e==null)return{};var n,r,i=sK(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function sK(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var p2={symbolCircle:W0,symbolCross:kq,symbolDiamond:Sq,symbolSquare:Eq,symbolStar:Nq,symbolTriangle:Tq,symbolWye:Aq},lK=Math.PI/180,cK=e=>{var t="symbol".concat(Bu(e));return p2[t]||W0},uK=(e,t,n)=>{if(t==="area")return e;switch(n){case"cross":return 5*e*e/9;case"diamond":return .5*e*e/Math.sqrt(3);case"square":return e*e;case"star":{var r=18*lK;return 1.25*e*e*(Math.tan(r)-Math.tan(r*2)*Math.tan(r)**2)}case"triangle":return Math.sqrt(3)*e*e/4;case"wye":return(21-10*Math.sqrt(3))*e*e/8;default:return Math.PI*e*e/4}},dK=(e,t)=>{p2["symbol".concat(Bu(e))]=t},h2=e=>{var{type:t="circle",size:n=64,sizeType:r="area"}=e,i=oK(e,nK),a=yS(yS({},i),{},{type:t,size:n,sizeType:r}),o="circle";typeof t=="string"&&(o=t);var s=()=>{var p=cK(o),h=Rq().type(p).size(uK(n,r,o)),y=h();if(y!==null)return y},{className:l,cx:c,cy:d}=a,u=ur(a);return Me(c)&&Me(d)&&Me(n)?m.createElement("path",ax({},u,{className:bt("recharts-symbols",l),transform:"translate(".concat(c,", ").concat(d,")"),d:s()})):null};h2.registerSymbol=dK;var m2=e=>"radius"in e&&"startAngle"in e&&"endAngle"in e,q0=(e,t)=>{if(!e||typeof e=="function"||typeof e=="boolean")return null;var n=e;if(m.isValidElement(e)&&(n=e.props),typeof n!="object"&&typeof n!="function")return null;var r={};return Object.keys(n).forEach(i=>{z0(i)&&typeof n[i]=="function"&&(r[i]=(a=>n[i](n,a)))}),r},fK=(e,t,n)=>r=>(e(t,n,r),null),K0=(e,t,n)=>{if(e===null||typeof e!="object"&&typeof e!="function")return null;var r=null;return Object.keys(e).forEach(i=>{var a=e[i];z0(i)&&typeof a=="function"&&(r||(r={}),r[i]=fK(a,t,n))}),r};function vS(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function pK(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?vS(Object(n),!0).forEach(function(r){hK(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):vS(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function hK(e,t,n){return(t=mK(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function mK(e){var t=gK(e,"string");return typeof t=="symbol"?t:t+""}function gK(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function fr(e,t){var n=pK({},e),r=t,i=Object.keys(t),a=i.reduce((o,s)=>(o[s]===void 0&&r[s]!==void 0&&(o[s]=r[s]),o),n);return a}var Pg={},Ng={},xS;function yK(){return xS||(xS=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n,r){const i=new Map;for(let a=0;a<n.length;a++){const o=n[a],s=r(o,a,n);i.has(s)||i.set(s,o)}return Array.from(i.values())}e.uniqBy=t})(Ng)),Ng}var Tg={},bS;function vK(){return bS||(bS=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n,r){return function(...i){return n.apply(this,i.slice(0,r))}}e.ary=t})(Tg)),Tg}var Og={},wS;function g2(){return wS||(wS=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return n}e.identity=t})(Og)),Og}var Ag={},Rg={},Mg={},kS;function xK(){return kS||(kS=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return Number.isSafeInteger(n)&&n>=0}e.isLength=t})(Mg)),Mg}var _S;function y2(){return _S||(_S=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=xK();function n(r){return r!=null&&typeof r!="function"&&t.isLength(r.length)}e.isArrayLike=n})(Rg)),Rg}var Ig={},SS;function bK(){return SS||(SS=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return typeof n=="object"&&n!==null}e.isObjectLike=t})(Ig)),Ig}var ES;function wK(){return ES||(ES=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=y2(),n=bK();function r(i){return n.isObjectLike(i)&&t.isArrayLike(i)}e.isArrayLikeObject=r})(Ag)),Ag}var Dg={},Lg={},CS;function kK(){return CS||(CS=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=V0();function n(r){return function(i){return t.get(i,r)}}e.property=n})(Lg)),Lg}var $g={},zg={},Fg={},Bg={},jS;function v2(){return jS||(jS=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return n!==null&&(typeof n=="object"||typeof n=="function")}e.isObject=t})(Bg)),Bg}var Wg={},PS;function x2(){return PS||(PS=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return n==null||typeof n!="object"&&typeof n!="function"}e.isPrimitive=t})(Wg)),Wg}var Hg={},NS;function b2(){return NS||(NS=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n,r){return n===r||Number.isNaN(n)&&Number.isNaN(r)}e.isEqualsSameValueZero=t})(Hg)),Hg}var TS;function _K(){return TS||(TS=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=v2(),n=x2(),r=b2();function i(d,u,p){return typeof p!="function"?i(d,u,()=>{}):a(d,u,function h(y,g,x,v,b,w){const _=p(y,g,x,v,b,w);return _!==void 0?!!_:a(y,g,h,w)},new Map)}function a(d,u,p,h){if(u===d)return!0;switch(typeof u){case"object":return o(d,u,p,h);case"function":return Object.keys(u).length>0?a(d,{...u},p,h):r.isEqualsSameValueZero(d,u);default:return t.isObject(d)?typeof u=="string"?u==="":!0:r.isEqualsSameValueZero(d,u)}}function o(d,u,p,h){if(u==null)return!0;if(Array.isArray(u))return l(d,u,p,h);if(u instanceof Map)return s(d,u,p,h);if(u instanceof Set)return c(d,u,p,h);const y=Object.keys(u);if(d==null||n.isPrimitive(d))return y.length===0;if(y.length===0)return!0;if(h?.has(u))return h.get(u)===d;h?.set(u,d);try{for(let g=0;g<y.length;g++){const x=y[g];if(!n.isPrimitive(d)&&!(x in d)||u[x]===void 0&&d[x]!==void 0||u[x]===null&&d[x]!==null||!p(d[x],u[x],x,d,u,h))return!1}return!0}finally{h?.delete(u)}}function s(d,u,p,h){if(u.size===0)return!0;if(!(d instanceof Map))return!1;for(const[y,g]of u.entries()){const x=d.get(y);if(p(x,g,y,d,u,h)===!1)return!1}return!0}function l(d,u,p,h){if(u.length===0)return!0;if(!Array.isArray(d))return!1;const y=new Set;for(let g=0;g<u.length;g++){const x=u[g];let v=!1;for(let b=0;b<d.length;b++){if(y.has(b))continue;const w=d[b];let _=!1;if(p(w,x,g,d,u,h)&&(_=!0),_){y.add(b),v=!0;break}}if(!v)return!1}return!0}function c(d,u,p,h){return u.size===0?!0:d instanceof Set?l([...d],[...u],p,h):!1}e.isMatchWith=i,e.isSetMatch=c})(Fg)),Fg}var OS;function w2(){return OS||(OS=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=_K();function n(r,i){return t.isMatchWith(r,i,()=>{})}e.isMatch=n})(zg)),zg}var Ug={},Vg={},qg={},AS;function SK(){return AS||(AS=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return Object.getOwnPropertySymbols(n).filter(r=>Object.prototype.propertyIsEnumerable.call(n,r))}e.getSymbols=t})(qg)),qg}var Kg={},RS;function G0(){return RS||(RS=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return n==null?n===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(n)}e.getTag=t})(Kg)),Kg}var Gg={},MS;function k2(){return MS||(MS=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t="[object RegExp]",n="[object String]",r="[object Number]",i="[object Boolean]",a="[object Arguments]",o="[object Symbol]",s="[object Date]",l="[object Map]",c="[object Set]",d="[object Array]",u="[object Function]",p="[object ArrayBuffer]",h="[object Object]",y="[object Error]",g="[object DataView]",x="[object Uint8Array]",v="[object Uint8ClampedArray]",b="[object Uint16Array]",w="[object Uint32Array]",_="[object BigUint64Array]",k="[object Int8Array]",S="[object Int16Array]",E="[object Int32Array]",C="[object BigInt64Array]",j="[object Float32Array]",T="[object Float64Array]";e.argumentsTag=a,e.arrayBufferTag=p,e.arrayTag=d,e.bigInt64ArrayTag=C,e.bigUint64ArrayTag=_,e.booleanTag=i,e.dataViewTag=g,e.dateTag=s,e.errorTag=y,e.float32ArrayTag=j,e.float64ArrayTag=T,e.functionTag=u,e.int16ArrayTag=S,e.int32ArrayTag=E,e.int8ArrayTag=k,e.mapTag=l,e.numberTag=r,e.objectTag=h,e.regexpTag=t,e.setTag=c,e.stringTag=n,e.symbolTag=o,e.uint16ArrayTag=b,e.uint32ArrayTag=w,e.uint8ArrayTag=x,e.uint8ClampedArrayTag=v})(Gg)),Gg}var Yg={},Xg={},IS;function EK(){return IS||(IS=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=typeof globalThis=="object"&&globalThis||typeof window=="object"&&window||typeof self=="object"&&self||typeof B1=="object"&&B1||(function(){return this})()||Function("return this")();e.globalThis=t})(Xg)),Xg}var DS;function CK(){return DS||(DS=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=EK();function n(r){return typeof t.globalThis.Buffer<"u"&&t.globalThis.Buffer.isBuffer(r)}e.isBuffer=n})(Yg)),Yg}var Zg={},LS;function jK(){return LS||(LS=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}e.isTypedArray=t})(Zg)),Zg}var $S;function _2(){return $S||($S=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=SK(),n=G0(),r=k2(),i=CK(),a=x2(),o=jK();function s(u,p){return l(u,void 0,u,new Map,p)}function l(u,p,h,y=new Map,g=void 0){const x=g?.(u,p,h,y);if(x!==void 0)return x;if(a.isPrimitive(u))return u;if(y.has(u))return y.get(u);if(Array.isArray(u)){const v=new Array(u.length);y.set(u,v);for(let b=0;b<u.length;b++)v[b]=l(u[b],b,h,y,g);return Object.hasOwn(u,"index")&&(v.index=u.index),Object.hasOwn(u,"input")&&(v.input=u.input),v}if(u instanceof Date)return new Date(u.getTime());if(u instanceof RegExp){const v=new RegExp(u.source,u.flags);return v.lastIndex=u.lastIndex,v}if(u instanceof Map){const v=new Map;y.set(u,v);for(const[b,w]of u)v.set(b,l(w,b,h,y,g));return v}if(u instanceof Set){const v=new Set;y.set(u,v);for(const b of u)v.add(l(b,void 0,h,y,g));return v}if(i.isBuffer(u))return u.subarray();if(o.isTypedArray(u)){const v=new(Object.getPrototypeOf(u)).constructor(u.length);y.set(u,v);for(let b=0;b<u.length;b++)v[b]=l(u[b],b,h,y,g);return v}if(u instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&u instanceof SharedArrayBuffer)return u.slice(0);if(u instanceof DataView){const v=new DataView(u.buffer.slice(0),u.byteOffset,u.byteLength);return y.set(u,v),c(v,u,h,y,g),v}if(typeof File<"u"&&u instanceof File){const v=new File([u],u.name,{type:u.type});return y.set(u,v),c(v,u,h,y,g),v}if(typeof Blob<"u"&&u instanceof Blob){const v=new Blob([u],{type:u.type});return y.set(u,v),c(v,u,h,y,g),v}if(u instanceof Error){const v=structuredClone(u);return y.set(u,v),v.message=u.message,v.name=u.name,v.stack=u.stack,v.cause=u.cause,v.constructor=u.constructor,c(v,u,h,y,g),v}if(u instanceof Boolean){const v=new Boolean(u.valueOf());return y.set(u,v),c(v,u,h,y,g),v}if(u instanceof Number){const v=new Number(u.valueOf());return y.set(u,v),c(v,u,h,y,g),v}if(u instanceof String){const v=new String(u.valueOf());return y.set(u,v),c(v,u,h,y,g),v}if(typeof u=="object"&&d(u)){const v=Object.create(Object.getPrototypeOf(u));return y.set(u,v),c(v,u,h,y,g),v}return u}function c(u,p,h=u,y,g){const x=[...Object.keys(p),...t.getSymbols(p)];for(let v=0;v<x.length;v++){const b=x[v],w=Object.getOwnPropertyDescriptor(u,b);(w==null||w.writable)&&(u[b]=l(p[b],b,h,y,g))}}function d(u){switch(n.getTag(u)){case r.argumentsTag:case r.arrayTag:case r.arrayBufferTag:case r.dataViewTag:case r.booleanTag:case r.dateTag:case r.float32ArrayTag:case r.float64ArrayTag:case r.int8ArrayTag:case r.int16ArrayTag:case r.int32ArrayTag:case r.mapTag:case r.numberTag:case r.objectTag:case r.regexpTag:case r.setTag:case r.stringTag:case r.symbolTag:case r.uint8ArrayTag:case r.uint8ClampedArrayTag:case r.uint16ArrayTag:case r.uint32ArrayTag:return!0;default:return!1}}e.cloneDeepWith=s,e.cloneDeepWithImpl=l,e.copyProperties=c})(Vg)),Vg}var zS;function PK(){return zS||(zS=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=_2();function n(r){return t.cloneDeepWithImpl(r,void 0,r,new Map,void 0)}e.cloneDeep=n})(Ug)),Ug}var FS;function NK(){return FS||(FS=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=w2(),n=PK();function r(i){return i=n.cloneDeep(i),a=>t.isMatch(a,i)}e.matches=r})($g)),$g}var Qg={},Jg={},ey={},BS;function TK(){return BS||(BS=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=_2(),n=G0(),r=k2();function i(a,o){return t.cloneDeepWith(a,(s,l,c,d)=>{const u=o?.(s,l,c,d);if(u!==void 0)return u;if(typeof a=="object"){if(n.getTag(a)===r.objectTag&&typeof a.constructor!="function"){const p={};return d.set(a,p),t.copyProperties(p,a,c,d),p}switch(Object.prototype.toString.call(a)){case r.numberTag:case r.stringTag:case r.booleanTag:{const p=new a.constructor(a?.valueOf());return t.copyProperties(p,a),p}case r.argumentsTag:{const p={};return t.copyProperties(p,a),p.length=a.length,p[Symbol.iterator]=a[Symbol.iterator],p}default:return}}})}e.cloneDeepWith=i})(ey)),ey}var WS;function OK(){return WS||(WS=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=TK();function n(r){return t.cloneDeepWith(r)}e.cloneDeep=n})(Jg)),Jg}var ty={},ny={},HS;function S2(){return HS||(HS=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=/^(?:0|[1-9]\d*)$/;function n(r,i=Number.MAX_SAFE_INTEGER){switch(typeof r){case"number":return Number.isInteger(r)&&r>=0&&r<i;case"symbol":return!1;case"string":return t.test(r)}}e.isIndex=n})(ny)),ny}var ry={},US;function AK(){return US||(US=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=G0();function n(r){return r!==null&&typeof r=="object"&&t.getTag(r)==="[object Arguments]"}e.isArguments=n})(ry)),ry}var VS;function RK(){return VS||(VS=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=u2(),n=S2(),r=AK(),i=U0();function a(o,s){let l;if(Array.isArray(s)?l=s:typeof s=="string"&&t.isDeepKey(s)&&o?.[s]==null?l=i.toPath(s):l=[s],l.length===0)return!1;let c=o;for(let d=0;d<l.length;d++){const u=l[d];if((c==null||!Object.hasOwn(c,u))&&!((Array.isArray(c)||r.isArguments(c))&&n.isIndex(u)&&u<c.length))return!1;c=c[u]}return!0}e.has=a})(ty)),ty}var qS;function MK(){return qS||(qS=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=w2(),n=H0(),r=OK(),i=V0(),a=RK();function o(s,l){switch(typeof s){case"object":{Object.is(s?.valueOf(),-0)&&(s="-0");break}case"number":{s=n.toKey(s);break}}return l=r.cloneDeep(l),function(c){const d=i.get(c,s);return d===void 0?a.has(c,s):l===void 0?d===void 0:t.isMatch(d,l)}}e.matchesProperty=o})(Qg)),Qg}var KS;function IK(){return KS||(KS=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=g2(),n=kK(),r=NK(),i=MK();function a(o){if(o==null)return t.identity;switch(typeof o){case"function":return o;case"object":return Array.isArray(o)&&o.length===2?i.matchesProperty(o[0],o[1]):r.matches(o);case"string":case"symbol":case"number":return n.property(o)}}e.iteratee=a})(Dg)),Dg}var GS;function DK(){return GS||(GS=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=yK(),n=vK(),r=g2(),i=wK(),a=IK();function o(s,l=r.identity){return i.isArrayLikeObject(s)?t.uniqBy(Array.from(s),n.ary(a.iteratee(l),1)):[]}e.uniqBy=o})(Pg)),Pg}var iy,YS;function LK(){return YS||(YS=1,iy=DK().uniqBy),iy}var $K=LK();const XS=Ci($K);function zK(e,t,n){return t===!0?XS(e,n):typeof t=="function"?XS(e,t):e}var Y0=m.createContext(null),FK=e=>e,Ut=()=>{var e=m.useContext(Y0);return e?e.store.dispatch:FK},Tf=()=>{},BK=()=>Tf,WK=(e,t)=>e===t;function We(e){var t=m.useContext(Y0),n=m.useMemo(()=>t?r=>{if(r!=null)return e(r)}:Tf,[t,e]);return dR.useSyncExternalStoreWithSelector(t?t.subscription.addNestedSub:BK,t?t.store.getState:Tf,t?t.store.getState:Tf,n,WK)}var ay={},oy={},sy={},ZS;function HK(){return ZS||(ZS=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){return typeof r=="symbol"?1:r===null?2:r===void 0?3:r!==r?4:0}const n=(r,i,a)=>{if(r!==i){const o=t(r),s=t(i);if(o===s&&o===0){if(r<i)return a==="desc"?1:-1;if(r>i)return a==="desc"?-1:1}return a==="desc"?s-o:o-s}return 0};e.compareValues=n})(sy)),sy}var ly={},cy={},QS;function E2(){return QS||(QS=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return typeof n=="symbol"||n instanceof Symbol}e.isSymbol=t})(cy)),cy}var JS;function UK(){return JS||(JS=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=E2(),n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;function i(a,o){return Array.isArray(a)?!1:typeof a=="number"||typeof a=="boolean"||a==null||t.isSymbol(a)?!0:typeof a=="string"&&(r.test(a)||!n.test(a))||o!=null&&Object.hasOwn(o,a)}e.isKey=i})(ly)),ly}var eE;function VK(){return eE||(eE=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=HK(),n=UK(),r=U0();function i(a,o,s,l){if(a==null)return[];s=l?void 0:s,Array.isArray(a)||(a=Object.values(a)),Array.isArray(o)||(o=o==null?[null]:[o]),o.length===0&&(o=[null]),Array.isArray(s)||(s=s==null?[]:[s]),s=s.map(h=>String(h));const c=(h,y)=>{let g=h;for(let x=0;x<y.length&&g!=null;++x)g=g[y[x]];return g},d=(h,y)=>y==null||h==null?y:typeof h=="object"&&"key"in h?Object.hasOwn(y,h.key)?y[h.key]:c(y,h.path):typeof h=="function"?h(y):Array.isArray(h)?c(y,h):typeof y=="object"?y[h]:y,u=o.map(h=>(Array.isArray(h)&&h.length===1&&(h=h[0]),h==null||typeof h=="function"||Array.isArray(h)||n.isKey(h)?h:{key:h,path:r.toPath(h)}));return a.map(h=>({original:h,criteria:u.map(y=>d(y,h))})).slice().sort((h,y)=>{for(let g=0;g<u.length;g++){const x=t.compareValues(h.criteria[g],y.criteria[g],s[g]);if(x!==0)return x}return 0}).map(h=>h.original)}e.orderBy=i})(oy)),oy}var uy={},tE;function qK(){return tE||(tE=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n,r=1){const i=[],a=Math.floor(r),o=(s,l)=>{for(let c=0;c<s.length;c++){const d=s[c];Array.isArray(d)&&l<a?o(d,l+1):i.push(d)}};return o(n,0),i}e.flatten=t})(uy)),uy}var dy={},nE;function C2(){return nE||(nE=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=S2(),n=y2(),r=v2(),i=b2();function a(o,s,l){return r.isObject(l)&&(typeof s=="number"&&n.isArrayLike(l)&&t.isIndex(s)&&s<l.length||typeof s=="string"&&s in l)?i.isEqualsSameValueZero(l[s],o):!1}e.isIterateeCall=a})(dy)),dy}var rE;function KK(){return rE||(rE=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=VK(),n=qK(),r=C2();function i(a,...o){const s=o.length;return s>1&&r.isIterateeCall(a,o[0],o[1])?o=[]:s>2&&r.isIterateeCall(o[0],o[1],o[2])&&(o=[o[0]]),t.orderBy(a,n.flatten(o),["asc"])}e.sortBy=i})(ay)),ay}var fy,iE;function GK(){return iE||(iE=1,fy=KK().sortBy),fy}var YK=GK();const Dh=Ci(YK);var j2=e=>e.legend.settings,XK=e=>e.legend.size,ZK=e=>e.legend.payload;J([ZK,j2],(e,t)=>{var{itemSorter:n}=t,r=e.flat(1);return n?Dh(r,n):r});var Id=1;function QK(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],[t,n]=m.useState({height:0,left:0,top:0,width:0}),r=m.useCallback(i=>{if(i!=null){var a=i.getBoundingClientRect(),o={height:a.height,left:a.left,top:a.top,width:a.width};(Math.abs(o.height-t.height)>Id||Math.abs(o.left-t.left)>Id||Math.abs(o.top-t.top)>Id||Math.abs(o.width-t.width)>Id)&&n({height:o.height,left:o.left,top:o.top,width:o.width})}},[t.width,t.height,t.top,t.left,...e]);return[t,r]}function Dn(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var JK=typeof Symbol=="function"&&Symbol.observable||"@@observable",aE=JK,py=()=>Math.random().toString(36).substring(7).split("").join("."),eG={INIT:`@@redux/INIT${py()}`,REPLACE:`@@redux/REPLACE${py()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${py()}`},vp=eG;function X0(e){if(typeof e!="object"||e===null)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function P2(e,t,n){if(typeof e!="function")throw new Error(Dn(2));if(typeof t=="function"&&typeof n=="function"||typeof n=="function"&&typeof arguments[3]=="function")throw new Error(Dn(0));if(typeof t=="function"&&typeof n>"u"&&(n=t,t=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(Dn(1));return n(P2)(e,t)}let r=e,i=t,a=new Map,o=a,s=0,l=!1;function c(){o===a&&(o=new Map,a.forEach((x,v)=>{o.set(v,x)}))}function d(){if(l)throw new Error(Dn(3));return i}function u(x){if(typeof x!="function")throw new Error(Dn(4));if(l)throw new Error(Dn(5));let v=!0;c();const b=s++;return o.set(b,x),function(){if(v){if(l)throw new Error(Dn(6));v=!1,c(),o.delete(b),a=null}}}function p(x){if(!X0(x))throw new Error(Dn(7));if(typeof x.type>"u")throw new Error(Dn(8));if(typeof x.type!="string")throw new Error(Dn(17));if(l)throw new Error(Dn(9));try{l=!0,i=r(i,x)}finally{l=!1}return(a=o).forEach(b=>{b()}),x}function h(x){if(typeof x!="function")throw new Error(Dn(10));r=x,p({type:vp.REPLACE})}function y(){const x=u;return{subscribe(v){if(typeof v!="object"||v===null)throw new Error(Dn(11));function b(){const _=v;_.next&&_.next(d())}return b(),{unsubscribe:x(b)}},[aE](){return this}}}return p({type:vp.INIT}),{dispatch:p,subscribe:u,getState:d,replaceReducer:h,[aE]:y}}function tG(e){Object.keys(e).forEach(t=>{const n=e[t];if(typeof n(void 0,{type:vp.INIT})>"u")throw new Error(Dn(12));if(typeof n(void 0,{type:vp.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(Dn(13))})}function N2(e){const t=Object.keys(e),n={};for(let a=0;a<t.length;a++){const o=t[a];typeof e[o]=="function"&&(n[o]=e[o])}const r=Object.keys(n);let i;try{tG(n)}catch(a){i=a}return function(o={},s){if(i)throw i;let l=!1;const c={};for(let d=0;d<r.length;d++){const u=r[d],p=n[u],h=o[u],y=p(h,s);if(typeof y>"u")throw s&&s.type,new Error(Dn(14));c[u]=y,l=l||y!==h}return l=l||r.length!==Object.keys(o).length,l?c:o}}function xp(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,n)=>(...r)=>t(n(...r)))}function nG(...e){return t=>(n,r)=>{const i=t(n,r);let a=()=>{throw new Error(Dn(15))};const o={getState:i.getState,dispatch:(l,...c)=>a(l,...c)},s=e.map(l=>l(o));return a=xp(...s)(i.dispatch),{...i,dispatch:a}}}function T2(e){return X0(e)&&"type"in e&&typeof e.type=="string"}var O2=Symbol.for("immer-nothing"),oE=Symbol.for("immer-draftable"),dr=Symbol.for("immer-state");function vi(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Lr=Object,Al=Lr.getPrototypeOf,bp="constructor",Lh="prototype",ox="configurable",wp="enumerable",Of="writable",uu="value",Ma=e=>!!e&&!!e[dr];function Si(e){return e?A2(e)||zh(e)||!!e[oE]||!!e[bp]?.[oE]||Fh(e)||Bh(e):!1}var rG=Lr[Lh][bp].toString(),sE=new WeakMap;function A2(e){if(!e||!Z0(e))return!1;const t=Al(e);if(t===null||t===Lr[Lh])return!0;const n=Lr.hasOwnProperty.call(t,bp)&&t[bp];if(n===Object)return!0;if(!Js(n))return!1;let r=sE.get(n);return r===void 0&&(r=Function.toString.call(n),sE.set(n,r)),r===rG}function $h(e,t,n=!0){Wu(e)===0?(n?Reflect.ownKeys(e):Lr.keys(e)).forEach(i=>{t(i,e[i],e)}):e.forEach((r,i)=>t(i,r,e))}function Wu(e){const t=e[dr];return t?t.type_:zh(e)?1:Fh(e)?2:Bh(e)?3:0}var lE=(e,t,n=Wu(e))=>n===2?e.has(t):Lr[Lh].hasOwnProperty.call(e,t),sx=(e,t,n=Wu(e))=>n===2?e.get(t):e[t],kp=(e,t,n,r=Wu(e))=>{r===2?e.set(t,n):r===3?e.add(n):e[t]=n};function iG(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}var zh=Array.isArray,Fh=e=>e instanceof Map,Bh=e=>e instanceof Set,Z0=e=>typeof e=="object",Js=e=>typeof e=="function",hy=e=>typeof e=="boolean";function aG(e){const t=+e;return Number.isInteger(t)&&String(t)===e}var va=e=>e.copy_||e.base_,Q0=e=>e.modified_?e.copy_:e.base_;function lx(e,t){if(Fh(e))return new Map(e);if(Bh(e))return new Set(e);if(zh(e))return Array[Lh].slice.call(e);const n=A2(e);if(t===!0||t==="class_only"&&!n){const r=Lr.getOwnPropertyDescriptors(e);delete r[dr];let i=Reflect.ownKeys(r);for(let a=0;a<i.length;a++){const o=i[a],s=r[o];s[Of]===!1&&(s[Of]=!0,s[ox]=!0),(s.get||s.set)&&(r[o]={[ox]:!0,[Of]:!0,[wp]:s[wp],[uu]:e[o]})}return Lr.create(Al(e),r)}else{const r=Al(e);if(r!==null&&n)return{...e};const i=Lr.create(r);return Lr.assign(i,e)}}function J0(e,t=!1){return Wh(e)||Ma(e)||!Si(e)||(Wu(e)>1&&Lr.defineProperties(e,{set:Dd,add:Dd,clear:Dd,delete:Dd}),Lr.freeze(e),t&&$h(e,(n,r)=>{J0(r,!0)},!1)),e}function oG(){vi(2)}var Dd={[uu]:oG};function Wh(e){return e===null||!Z0(e)?!0:Lr.isFrozen(e)}var _p="MapSet",cx="Patches",cE="ArrayMethods",R2={};function hs(e){const t=R2[e];return t||vi(0,e),t}var uE=e=>!!R2[e],du,M2=()=>du,sG=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:uE(_p)?hs(_p):void 0,arrayMethodsPlugin_:uE(cE)?hs(cE):void 0});function dE(e,t){t&&(e.patchPlugin_=hs(cx),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function ux(e){dx(e),e.drafts_.forEach(lG),e.drafts_=null}function dx(e){e===du&&(du=e.parent_)}var fE=e=>du=sG(du,e);function lG(e){const t=e[dr];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function pE(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];if(e!==void 0&&e!==n){n[dr].modified_&&(ux(t),vi(4)),Si(e)&&(e=hE(t,e));const{patchPlugin_:i}=t;i&&i.generateReplacementPatches_(n[dr].base_,e,t)}else e=hE(t,n);return cG(t,e,!0),ux(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==O2?e:void 0}function hE(e,t){if(Wh(t))return t;const n=t[dr];if(!n)return Sp(t,e.handledSet_,e);if(!Hh(n,e))return t;if(!n.modified_)return n.base_;if(!n.finalized_){const{callbacks_:r}=n;if(r)for(;r.length>0;)r.pop()(e);L2(n,e)}return n.copy_}function cG(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&J0(t,n)}function I2(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var Hh=(e,t)=>e.scope_===t,uG=[];function D2(e,t,n,r){const i=va(e),a=e.type_;if(r!==void 0&&sx(i,r,a)===t){kp(i,r,n,a);return}if(!e.draftLocations_){const s=e.draftLocations_=new Map;$h(i,(l,c)=>{if(Ma(c)){const d=s.get(c)||[];d.push(l),s.set(c,d)}})}const o=e.draftLocations_.get(t)??uG;for(const s of o)kp(i,s,n,a)}function dG(e,t,n){e.callbacks_.push(function(i){const a=t;if(!a||!Hh(a,i))return;i.mapSetPlugin_?.fixSetContents(a);const o=Q0(a);D2(e,a.draft_??a,o,n),L2(a,i)})}function L2(e,t){if(e.modified_&&!e.finalized_&&(e.type_===3||e.type_===1&&e.allIndicesReassigned_||(e.assigned_?.size??0)>0)){const{patchPlugin_:r}=t;if(r){const i=r.getPath(e);i&&r.generatePatches_(e,i,t)}I2(e)}}function fG(e,t,n){const{scope_:r}=e;if(Ma(n)){const i=n[dr];Hh(i,r)&&i.callbacks_.push(function(){Af(e);const o=Q0(i);D2(e,n,o,t)})}else Si(n)&&e.callbacks_.push(function(){const a=va(e);e.type_===3?a.has(n)&&Sp(n,r.handledSet_,r):sx(a,t,e.type_)===n&&r.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&Sp(sx(e.copy_,t,e.type_),r.handledSet_,r)})}function Sp(e,t,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||Ma(e)||t.has(e)||!Si(e)||Wh(e)||(t.add(e),$h(e,(r,i)=>{if(Ma(i)){const a=i[dr];if(Hh(a,n)){const o=Q0(a);kp(e,r,o,e.type_),I2(a)}}else Si(i)&&Sp(i,t,n)})),e}function pG(e,t){const n=zh(e),r={type_:n?1:0,scope_:t?t.scope_:M2(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0};let i=r,a=Ep;n&&(i=[r],a=fu);const{revoke:o,proxy:s}=Proxy.revocable(i,a);return r.draft_=s,r.revoke_=o,[s,r]}var Ep={get(e,t){if(t===dr)return e;let n=e.scope_.arrayMethodsPlugin_;const r=e.type_===1&&typeof t=="string";if(r&&n?.isArrayOperationMethod(t))return n.createMethodInterceptor(e,t);const i=va(e);if(!lE(i,t,e.type_))return hG(e,i,t);const a=i[t];if(e.finalized_||!Si(a)||r&&e.operationMethod&&n?.isMutatingArrayMethod(e.operationMethod)&&aG(t))return a;if(a===my(e.base_,t)){Af(e);const o=e.type_===1?+t:t,s=px(e.scope_,a,e,o);return e.copy_[o]=s}return a},has(e,t){return t in va(e)},ownKeys(e){return Reflect.ownKeys(va(e))},set(e,t,n){const r=$2(va(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const i=my(va(e),t),a=i?.[dr];if(a&&a.base_===n)return e.copy_[t]=n,e.assigned_.set(t,!1),!0;if(iG(n,i)&&(n!==void 0||lE(e.base_,t,e.type_)))return!0;Af(e),fx(e)}return e.copy_[t]===n&&(n!==void 0||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_.set(t,!0),fG(e,t,n)),!0},deleteProperty(e,t){return Af(e),my(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),fx(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=va(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{[Of]:!0,[ox]:e.type_!==1||t!=="length",[wp]:r[wp],[uu]:n[t]}},defineProperty(){vi(11)},getPrototypeOf(e){return Al(e.base_)},setPrototypeOf(){vi(12)}},fu={};for(let e in Ep){let t=Ep[e];fu[e]=function(){const n=arguments;return n[0]=n[0][0],t.apply(this,n)}}fu.deleteProperty=function(e,t){return fu.set.call(this,e,t,void 0)};fu.set=function(e,t,n){return Ep.set.call(this,e[0],t,n,e[0])};function my(e,t){const n=e[dr];return(n?va(n):e)[t]}function hG(e,t,n){const r=$2(t,n);return r?uu in r?r[uu]:r.get?.call(e.draft_):void 0}function $2(e,t){if(!(t in e))return;let n=Al(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Al(n)}}function fx(e){e.modified_||(e.modified_=!0,e.parent_&&fx(e.parent_))}function Af(e){e.copy_||(e.assigned_=new Map,e.copy_=lx(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var mG=class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(n,r,i)=>{if(Js(n)&&!Js(r)){const o=r;r=n;const s=this;return function(c=o,...d){return s.produce(c,u=>r.call(this,u,...d))}}Js(r)||vi(6),i!==void 0&&!Js(i)&&vi(7);let a;if(Si(n)){const o=fE(this),s=px(o,n,void 0);let l=!0;try{a=r(s),l=!1}finally{l?ux(o):dx(o)}return dE(o,i),pE(a,o)}else if(!n||!Z0(n)){if(a=r(n),a===void 0&&(a=n),a===O2&&(a=void 0),this.autoFreeze_&&J0(a,!0),i){const o=[],s=[];hs(cx).generateReplacementPatches_(n,a,{patches_:o,inversePatches_:s}),i(o,s)}return a}else vi(1,n)},this.produceWithPatches=(n,r)=>{if(Js(n))return(s,...l)=>this.produceWithPatches(s,c=>n(c,...l));let i,a;return[this.produce(n,r,(s,l)=>{i=s,a=l}),i,a]},hy(t?.autoFreeze)&&this.setAutoFreeze(t.autoFreeze),hy(t?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(t.useStrictShallowCopy),hy(t?.useStrictIteration)&&this.setUseStrictIteration(t.useStrictIteration)}createDraft(t){Si(t)||vi(8),Ma(t)&&(t=ti(t));const n=fE(this),r=px(n,t,void 0);return r[dr].isManual_=!0,dx(n),r}finishDraft(t,n){const r=t&&t[dr];(!r||!r.isManual_)&&vi(9);const{scope_:i}=r;return dE(i,n),pE(void 0,i)}setAutoFreeze(t){this.autoFreeze_=t}setUseStrictShallowCopy(t){this.useStrictShallowCopy_=t}setUseStrictIteration(t){this.useStrictIteration_=t}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(t,n){let r;for(r=n.length-1;r>=0;r--){const a=n[r];if(a.path.length===0&&a.op==="replace"){t=a.value;break}}r>-1&&(n=n.slice(r+1));const i=hs(cx).applyPatches_;return Ma(t)?i(t,n):this.produce(t,a=>i(a,n))}};function px(e,t,n,r){const[i,a]=Fh(t)?hs(_p).proxyMap_(t,n):Bh(t)?hs(_p).proxySet_(t,n):pG(t,n);return(n?.scope_??M2()).drafts_.push(i),a.callbacks_=n?.callbacks_??[],a.key_=r,n&&r!==void 0?dG(n,a,r):a.callbacks_.push(function(l){l.mapSetPlugin_?.fixSetContents(a);const{patchPlugin_:c}=l;a.modified_&&c&&c.generatePatches_(a,[],l)}),i}function ti(e){return Ma(e)||vi(10,e),z2(e)}function z2(e){if(!Si(e)||Wh(e))return e;const t=e[dr];let n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=lx(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=lx(e,!0);return $h(n,(i,a)=>{kp(n,i,z2(a))},r),t&&(t.finalized_=!1),n}var gG=new mG,F2=gG.produce;function B2(e){return({dispatch:n,getState:r})=>i=>a=>typeof a=="function"?a(n,r,e):i(a)}var yG=B2(),vG=B2,xG=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?xp:xp.apply(null,arguments)};function Wr(e,t){function n(...r){if(t){let i=t(...r);if(!i)throw new Error(zr(0));return{type:e,payload:i.payload,..."meta"in i&&{meta:i.meta},..."error"in i&&{error:i.error}}}return{type:e,payload:r[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=r=>T2(r)&&r.type===e,n}var W2=class Nc extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,Nc.prototype)}static get[Symbol.species](){return Nc}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new Nc(...t[0].concat(this)):new Nc(...t.concat(this))}};function mE(e){return Si(e)?F2(e,()=>{}):e}function Ld(e,t,n){return e.has(t)?e.get(t):e.set(t,n(t)).get(t)}function bG(e){return typeof e=="boolean"}var wG=()=>function(t){const{thunk:n=!0,immutableCheck:r=!0,serializableCheck:i=!0,actionCreatorCheck:a=!0}=t??{};let o=new W2;return n&&(bG(n)?o.push(yG):o.push(vG(n.extraArgument))),o},H2="RTK_autoBatch",It=()=>e=>({payload:e,meta:{[H2]:!0}}),gE=e=>t=>{setTimeout(t,e)},U2=(e={type:"raf"})=>t=>(...n)=>{const r=t(...n);let i=!0,a=!1,o=!1;const s=new Set,l=e.type==="tick"?queueMicrotask:e.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame:gE(10):e.type==="callback"?e.queueNotification:gE(e.timeout),c=()=>{o=!1,a&&(a=!1,s.forEach(d=>d()))};return Object.assign({},r,{subscribe(d){const u=()=>i&&d(),p=r.subscribe(u);return s.add(d),()=>{p(),s.delete(d)}},dispatch(d){try{return i=!d?.meta?.[H2],a=!i,a&&(o||(o=!0,l(c))),r.dispatch(d)}finally{i=!0}}})},kG=e=>function(n){const{autoBatch:r=!0}=n??{};let i=new W2(e);return r&&i.push(U2(typeof r=="object"?r:void 0)),i};function _G(e){const t=wG(),{reducer:n=void 0,middleware:r,devTools:i=!0,preloadedState:a=void 0,enhancers:o=void 0}=e||{};let s;if(typeof n=="function")s=n;else if(X0(n))s=N2(n);else throw new Error(zr(1));let l;typeof r=="function"?l=r(t):l=t();let c=xp;i&&(c=xG({trace:!1,...typeof i=="object"&&i}));const d=nG(...l),u=kG(d);let p=typeof o=="function"?o(u):u();const h=c(...p);return P2(s,a,h)}function V2(e){const t={},n=[];let r;const i={addCase(a,o){const s=typeof a=="string"?a:a.type;if(!s)throw new Error(zr(28));if(s in t)throw new Error(zr(29));return t[s]=o,i},addAsyncThunk(a,o){return o.pending&&(t[a.pending.type]=o.pending),o.rejected&&(t[a.rejected.type]=o.rejected),o.fulfilled&&(t[a.fulfilled.type]=o.fulfilled),o.settled&&n.push({matcher:a.settled,reducer:o.settled}),i},addMatcher(a,o){return n.push({matcher:a,reducer:o}),i},addDefaultCase(a){return r=a,i}};return e(i),[t,n,r]}function SG(e){return typeof e=="function"}function EG(e,t){let[n,r,i]=V2(t),a;if(SG(e))a=()=>mE(e());else{const s=mE(e);a=()=>s}function o(s=a(),l){let c=[n[l.type],...r.filter(({matcher:d})=>d(l)).map(({reducer:d})=>d)];return c.filter(d=>!!d).length===0&&(c=[i]),c.reduce((d,u)=>{if(u)if(Ma(d)){const h=u(d,l);return h===void 0?d:h}else{if(Si(d))return F2(d,p=>u(p,l));{const p=u(d,l);if(p===void 0){if(d===null)return d;throw Error("A case reducer on a non-draftable value must not return undefined")}return p}}return d},s)}return o.getInitialState=a,o}var CG="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",jG=(e=21)=>{let t="",n=e;for(;n--;)t+=CG[Math.random()*64|0];return t},PG=Symbol.for("rtk-slice-createasyncthunk");function NG(e,t){return`${e}/${t}`}function TG({creators:e}={}){const t=e?.asyncThunk?.[PG];return function(r){const{name:i,reducerPath:a=i}=r;if(!i)throw new Error(zr(11));const o=(typeof r.reducers=="function"?r.reducers(AG()):r.reducers)||{},s=Object.keys(o),l={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},c={addCase(w,_){const k=typeof w=="string"?w:w.type;if(!k)throw new Error(zr(12));if(k in l.sliceCaseReducersByType)throw new Error(zr(13));return l.sliceCaseReducersByType[k]=_,c},addMatcher(w,_){return l.sliceMatchers.push({matcher:w,reducer:_}),c},exposeAction(w,_){return l.actionCreators[w]=_,c},exposeCaseReducer(w,_){return l.sliceCaseReducersByName[w]=_,c}};s.forEach(w=>{const _=o[w],k={reducerName:w,type:NG(i,w),createNotation:typeof r.reducers=="function"};MG(_)?DG(k,_,c,t):RG(k,_,c)});function d(){const[w={},_=[],k=void 0]=typeof r.extraReducers=="function"?V2(r.extraReducers):[r.extraReducers],S={...w,...l.sliceCaseReducersByType};return EG(r.initialState,E=>{for(let C in S)E.addCase(C,S[C]);for(let C of l.sliceMatchers)E.addMatcher(C.matcher,C.reducer);for(let C of _)E.addMatcher(C.matcher,C.reducer);k&&E.addDefaultCase(k)})}const u=w=>w,p=new Map,h=new WeakMap;let y;function g(w,_){return y||(y=d()),y(w,_)}function x(){return y||(y=d()),y.getInitialState()}function v(w,_=!1){function k(E){let C=E[w];return typeof C>"u"&&_&&(C=Ld(h,k,x)),C}function S(E=u){const C=Ld(p,_,()=>new WeakMap);return Ld(C,E,()=>{const j={};for(const[T,A]of Object.entries(r.selectors??{}))j[T]=OG(A,E,()=>Ld(h,E,x),_);return j})}return{reducerPath:w,getSelectors:S,get selectors(){return S(k)},selectSlice:k}}const b={name:i,reducer:g,actions:l.actionCreators,caseReducers:l.sliceCaseReducersByName,getInitialState:x,...v(a),injectInto(w,{reducerPath:_,...k}={}){const S=_??a;return w.inject({reducerPath:S,reducer:g},k),{...b,...v(S,!0)}}};return b}}function OG(e,t,n,r){function i(a,...o){let s=t(a);return typeof s>"u"&&r&&(s=n()),e(s,...o)}return i.unwrapped=e,i}var Zn=TG();function AG(){function e(t,n){return{_reducerDefinitionType:"asyncThunk",payloadCreator:t,...n}}return e.withTypes=()=>e,{reducer(t){return Object.assign({[t.name](...n){return t(...n)}}[t.name],{_reducerDefinitionType:"reducer"})},preparedReducer(t,n){return{_reducerDefinitionType:"reducerWithPrepare",prepare:t,reducer:n}},asyncThunk:e}}function RG({type:e,reducerName:t,createNotation:n},r,i){let a,o;if("reducer"in r){if(n&&!IG(r))throw new Error(zr(17));a=r.reducer,o=r.prepare}else a=r;i.addCase(e,a).exposeCaseReducer(t,a).exposeAction(t,o?Wr(e,o):Wr(e))}function MG(e){return e._reducerDefinitionType==="asyncThunk"}function IG(e){return e._reducerDefinitionType==="reducerWithPrepare"}function DG({type:e,reducerName:t},n,r,i){if(!i)throw new Error(zr(18));const{payloadCreator:a,fulfilled:o,pending:s,rejected:l,settled:c,options:d}=n,u=i(e,a,d);r.exposeAction(t,u),o&&r.addCase(u.fulfilled,o),s&&r.addCase(u.pending,s),l&&r.addCase(u.rejected,l),c&&r.addMatcher(u.settled,c),r.exposeCaseReducer(t,{fulfilled:o||$d,pending:s||$d,rejected:l||$d,settled:c||$d})}function $d(){}var LG="task",q2="listener",K2="completed",ew="cancelled",$G=`task-${ew}`,zG=`task-${K2}`,hx=`${q2}-${ew}`,FG=`${q2}-${K2}`,Uh=class{constructor(e){this.code=e,this.message=`${LG} ${ew} (reason: ${e})`}name="TaskAbortError";message},tw=(e,t)=>{if(typeof e!="function")throw new TypeError(zr(32))},Cp=()=>{},G2=(e,t=Cp)=>(e.catch(t),e),Y2=(e,t)=>(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)),ss=e=>{if(e.aborted)throw new Uh(e.reason)};function X2(e,t){let n=Cp;return new Promise((r,i)=>{const a=()=>i(new Uh(e.reason));if(e.aborted){a();return}n=Y2(e,a),t.finally(()=>n()).then(r,i)}).finally(()=>{n=Cp})}var BG=async(e,t)=>{try{return await Promise.resolve(),{status:"ok",value:await e()}}catch(n){return{status:n instanceof Uh?"cancelled":"rejected",error:n}}finally{t?.()}},jp=e=>t=>G2(X2(e,t).then(n=>(ss(e),n))),Z2=e=>{const t=jp(e);return n=>t(new Promise(r=>setTimeout(r,n)))},{assign:gl}=Object,yE={},Vh="listenerMiddleware",WG=(e,t)=>{const n=r=>Y2(e,()=>r.abort(e.reason));return(r,i)=>{tw(r);const a=new AbortController;n(a);const o=BG(async()=>{ss(e),ss(a.signal);const s=await r({pause:jp(a.signal),delay:Z2(a.signal),signal:a.signal});return ss(a.signal),s},()=>a.abort(zG));return i?.autoJoin&&t.push(o.catch(Cp)),{result:jp(e)(o),cancel(){a.abort($G)}}}},HG=(e,t)=>{const n=async(r,i)=>{ss(t);let a=()=>{};const s=[new Promise((l,c)=>{let d=e({predicate:r,effect:(u,p)=>{p.unsubscribe(),l([u,p.getState(),p.getOriginalState()])}});a=()=>{d(),c()}})];i!=null&&s.push(new Promise(l=>setTimeout(l,i,null)));try{const l=await X2(t,Promise.race(s));return ss(t),l}finally{a()}};return(r,i)=>G2(n(r,i))},Q2=e=>{let{type:t,actionCreator:n,matcher:r,predicate:i,effect:a}=e;if(t)i=Wr(t).match;else if(n)t=n.type,i=n.match;else if(r)i=r;else if(!i)throw new Error(zr(21));return tw(a),{predicate:i,type:t,effect:a}},J2=gl(e=>{const{type:t,predicate:n,effect:r}=Q2(e);return{id:jG(),effect:r,type:t,predicate:n,pending:new Set,unsubscribe:()=>{throw new Error(zr(22))}}},{withTypes:()=>J2}),vE=(e,t)=>{const{type:n,effect:r,predicate:i}=Q2(t);return Array.from(e.values()).find(a=>(typeof n=="string"?a.type===n:a.predicate===i)&&a.effect===r)},mx=e=>{e.pending.forEach(t=>{t.abort(hx)})},UG=(e,t)=>()=>{for(const n of t.keys())mx(n);e.clear()},xE=(e,t,n)=>{try{e(t,n)}catch(r){setTimeout(()=>{throw r},0)}},eM=gl(Wr(`${Vh}/add`),{withTypes:()=>eM}),VG=Wr(`${Vh}/removeAll`),tM=gl(Wr(`${Vh}/remove`),{withTypes:()=>tM}),qG=(...e)=>{console.error(`${Vh}/error`,...e)},Hu=(e={})=>{const t=new Map,n=new Map,r=h=>{const y=n.get(h)??0;n.set(h,y+1)},i=h=>{const y=n.get(h)??1;y===1?n.delete(h):n.set(h,y-1)},{extra:a,onError:o=qG}=e;tw(o);const s=h=>(h.unsubscribe=()=>t.delete(h.id),t.set(h.id,h),y=>{h.unsubscribe(),y?.cancelActive&&mx(h)}),l=h=>{const y=vE(t,h)??J2(h);return s(y)};gl(l,{withTypes:()=>l});const c=h=>{const y=vE(t,h);return y&&(y.unsubscribe(),h.cancelActive&&mx(y)),!!y};gl(c,{withTypes:()=>c});const d=async(h,y,g,x)=>{const v=new AbortController,b=HG(l,v.signal),w=[];try{h.pending.add(v),r(h),await Promise.resolve(h.effect(y,gl({},g,{getOriginalState:x,condition:(_,k)=>b(_,k).then(Boolean),take:b,delay:Z2(v.signal),pause:jp(v.signal),extra:a,signal:v.signal,fork:WG(v.signal,w),unsubscribe:h.unsubscribe,subscribe:()=>{t.set(h.id,h)},cancelActiveListeners:()=>{h.pending.forEach((_,k,S)=>{_!==v&&(_.abort(hx),S.delete(_))})},cancel:()=>{v.abort(hx),h.pending.delete(v)},throwIfCancelled:()=>{ss(v.signal)}})))}catch(_){_ instanceof Uh||xE(o,_,{raisedBy:"effect"})}finally{await Promise.all(w),v.abort(FG),i(h),h.pending.delete(v)}},u=UG(t,n);return{middleware:h=>y=>g=>{if(!T2(g))return y(g);if(eM.match(g))return l(g.payload);if(VG.match(g)){u();return}if(tM.match(g))return c(g.payload);let x=h.getState();const v=()=>{if(x===yE)throw new Error(zr(23));return x};let b;try{if(b=y(g),t.size>0){const w=h.getState(),_=Array.from(t.values());for(const k of _){let S=!1;try{S=k.predicate(g,w,x)}catch(E){S=!1,xE(o,E,{raisedBy:"predicate"})}S&&d(k,g,h,v)}}}finally{x=yE}return b},startListening:l,stopListening:c,clearListeners:u}};function zr(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var KG={layoutType:"horizontal",width:0,height:0,margin:{top:5,right:5,bottom:5,left:5},scale:1},nM=Zn({name:"chartLayout",initialState:KG,reducers:{setLayout(e,t){e.layoutType=t.payload},setChartSize(e,t){e.width=t.payload.width,e.height=t.payload.height},setMargin(e,t){var n,r,i,a;e.margin.top=(n=t.payload.top)!==null&&n!==void 0?n:0,e.margin.right=(r=t.payload.right)!==null&&r!==void 0?r:0,e.margin.bottom=(i=t.payload.bottom)!==null&&i!==void 0?i:0,e.margin.left=(a=t.payload.left)!==null&&a!==void 0?a:0},setScale(e,t){e.scale=t.payload}}}),{setMargin:GG,setLayout:YG,setChartSize:XG,setScale:ZG}=nM.actions,QG=nM.reducer;function rM(e,t,n){return Array.isArray(e)&&e&&t+n!==0?e.slice(t,n+1):e}function ct(e){return Number.isFinite(e)}function aa(e){return typeof e=="number"&&e>0&&Number.isFinite(e)}function bE(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function il(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?bE(Object(n),!0).forEach(function(r){JG(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):bE(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function JG(e,t,n){return(t=eY(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function eY(e){var t=tY(e,"string");return typeof t=="symbol"?t:t+""}function tY(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function on(e,t,n){return Ft(e)||Ft(t)?n:ia(t)?Ol(e,t,n):typeof t=="function"?t(e):n}var nY=(e,t,n)=>{if(t&&n){var{width:r,height:i}=n,{align:a,verticalAlign:o,layout:s}=t;if((s==="vertical"||s==="horizontal"&&o==="middle")&&a!=="center"&&Me(e[a]))return il(il({},e),{},{[a]:e[a]+(r||0)});if((s==="horizontal"||s==="vertical"&&a==="center")&&o!=="middle"&&Me(e[o]))return il(il({},e),{},{[o]:e[o]+(i||0)})}return e},za=(e,t)=>e==="horizontal"&&t==="xAxis"||e==="vertical"&&t==="yAxis"||e==="centric"&&t==="angleAxis"||e==="radial"&&t==="radiusAxis",iM=(e,t,n,r)=>{if(r)return e.map(s=>s.coordinate);var i,a,o=e.map(s=>(s.coordinate===t&&(i=!0),s.coordinate===n&&(a=!0),s.coordinate));return i||o.push(t),a||o.push(n),o},aM=(e,t,n)=>{if(!e)return null;var{duplicateDomain:r,type:i,range:a,scale:o,realScaleType:s,isCategorical:l,categoricalDomain:c,tickCount:d,ticks:u,niceTicks:p,axisType:h}=e;if(!o)return null;var y=s==="scaleBand"&&o.bandwidth?o.bandwidth()/2:2,g=i==="category"&&o.bandwidth?o.bandwidth()/y:0;if(g=h==="angleAxis"&&a&&a.length>=2?yr(a[0]-a[1])*2*g:g,u||p){var x=(u||p||[]).map((v,b)=>{var w=r?r.indexOf(v):v,_=o.map(w);return ct(_)?{coordinate:_+g,value:v,offset:g,index:b}:null}).filter(vr);return x}return l&&c?c.map((v,b)=>{var w=o.map(v);return ct(w)?{coordinate:w+g,value:v,index:b,offset:g}:null}).filter(vr):o.ticks&&d!=null?o.ticks(d).map((v,b)=>{var w=o.map(v);return ct(w)?{coordinate:w+g,value:v,index:b,offset:g}:null}).filter(vr):o.domain().map((v,b)=>{var w=o.map(v);return ct(w)?{coordinate:w+g,value:r?r[v]:v,index:b,offset:g}:null}).filter(vr)},rY=(e,t)=>{if(!t||t.length!==2||!Me(t[0])||!Me(t[1]))return e;var n=Math.min(t[0],t[1]),r=Math.max(t[0],t[1]),i=[e[0],e[1]];return(!Me(e[0])||e[0]<n)&&(i[0]=n),(!Me(e[1])||e[1]>r)&&(i[1]=r),i[0]>r&&(i[0]=r),i[1]<n&&(i[1]=n),i},iY=e=>{var t,n=e.length;if(!(n<=0)){var r=(t=e[0])===null||t===void 0?void 0:t.length;if(!(r==null||r<=0))for(var i=0;i<r;++i)for(var a=0,o=0,s=0;s<n;++s){var l=e[s],c=l?.[i];if(c!=null){var d=c[1],u=c[0],p=ra(d)?u:d;p>=0?(c[0]=a,a+=p,c[1]=a):(c[0]=o,o+=p,c[1]=o)}}}},aY=e=>{var t,n=e.length;if(!(n<=0)){var r=(t=e[0])===null||t===void 0?void 0:t.length;if(!(r==null||r<=0))for(var i=0;i<r;++i)for(var a=0,o=0;o<n;++o){var s=e[o],l=s?.[i];if(l!=null){var c=ra(l[1])?l[0]:l[1];c>=0?(l[0]=a,a+=c,l[1]=a):(l[0]=0,l[1]=0)}}}},oY={sign:iY,expand:Kq,none:fs,silhouette:Gq,wiggle:Yq,positive:aY},sY=(e,t,n)=>{var r,i=(r=oY[n])!==null&&r!==void 0?r:fs,a=qq().keys(t).value((s,l)=>Number(on(s,l,0))).order(ix).offset(i),o=a(e);return o.forEach((s,l)=>{s.forEach((c,d)=>{var u=on(e[d],t[l],0);Array.isArray(u)&&u.length===2&&Me(u[0])&&Me(u[1])&&(c[0]=u[0],c[1]=u[1])})}),o};function lY(e){return e==null?void 0:String(e)}function wE(e){var{axis:t,ticks:n,bandSize:r,entry:i,index:a,dataKey:o}=e;if(t.type==="category"){if(!t.allowDuplicatedCategory&&t.dataKey&&!Ft(i[t.dataKey])){var s=f2(n,"value",i[t.dataKey]);if(s)return s.coordinate+r/2}return n!=null&&n[a]?n[a].coordinate+r/2:null}var l=on(i,Ft(o)?t.dataKey:o),c=t.scale.map(l);return Me(c)?c:null}var kE=e=>{var{axis:t,ticks:n,offset:r,bandSize:i,entry:a,index:o}=e;if(t.type==="category")return n[o]?n[o].coordinate+r:null;var s=on(a,t.dataKey,t.scale.domain()[o]);if(Ft(s))return null;var l=t.scale.map(s);return Me(l)?l-i/2+r:null},cY=e=>{var{numericAxis:t}=e,n=t.scale.domain();if(t.type==="number"){var r=Math.min(n[0],n[1]),i=Math.max(n[0],n[1]);return r<=0&&i>=0?0:i<0?i:r}return n[0]},uY=e=>{var t=e.flat(2).filter(Me);return[Math.min(...t),Math.max(...t)]},dY=e=>[e[0]===1/0?0:e[0],e[1]===-1/0?0:e[1]],fY=(e,t,n)=>{if(e!=null)return dY(Object.keys(e).reduce((r,i)=>{var a=e[i];if(!a)return r;var{stackedData:o}=a,s=o.reduce((l,c)=>{var d=rM(c,t,n),u=uY(d);return!ct(u[0])||!ct(u[1])?l:[Math.min(l[0],u[0]),Math.max(l[1],u[1])]},[1/0,-1/0]);return[Math.min(s[0],r[0]),Math.max(s[1],r[1])]},[1/0,-1/0]))},_E=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,SE=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,Rl=(e,t,n)=>{if(e&&e.scale&&e.scale.bandwidth){var r=e.scale.bandwidth();if(!n||r>0)return r}if(e&&t&&t.length>=2){for(var i=Dh(t,d=>d.coordinate),a=1/0,o=1,s=i.length;o<s;o++){var l=i[o],c=i[o-1];a=Math.min((l?.coordinate||0)-(c?.coordinate||0),a)}return a===1/0?0:a}return n?void 0:0};function EE(e){var{tooltipEntrySettings:t,dataKey:n,payload:r,value:i,name:a}=e;return il(il({},t),{},{dataKey:n,payload:r,value:i,name:a})}function qh(e,t){if(e)return String(e);if(typeof t=="string")return t}var pY=(e,t)=>{if(t==="horizontal")return e.relativeX;if(t==="vertical")return e.relativeY},hY=(e,t)=>t==="centric"?e.angle:e.radius,Fa=e=>e.layout.width,Ba=e=>e.layout.height,mY=e=>e.layout.scale,oM=e=>e.layout.margin,Kh=J(e=>e.cartesianAxis.xAxis,e=>Object.values(e)),Gh=J(e=>e.cartesianAxis.yAxis,e=>Object.values(e)),gY="data-recharts-item-index",yY="data-recharts-item-id",Uu=60;function CE(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function zd(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?CE(Object(n),!0).forEach(function(r){vY(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):CE(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function vY(e,t,n){return(t=xY(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function xY(e){var t=bY(e,"string");return typeof t=="symbol"?t:t+""}function bY(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var wY=e=>e.brush.height;function kY(e){var t=Gh(e);return t.reduce((n,r)=>{if(r.orientation==="left"&&!r.mirror&&!r.hide){var i=typeof r.width=="number"?r.width:Uu;return n+i}return n},0)}function _Y(e){var t=Gh(e);return t.reduce((n,r)=>{if(r.orientation==="right"&&!r.mirror&&!r.hide){var i=typeof r.width=="number"?r.width:Uu;return n+i}return n},0)}function SY(e){var t=Kh(e);return t.reduce((n,r)=>r.orientation==="top"&&!r.mirror&&!r.hide?n+r.height:n,0)}function EY(e){var t=Kh(e);return t.reduce((n,r)=>r.orientation==="bottom"&&!r.mirror&&!r.hide?n+r.height:n,0)}var Nn=J([Fa,Ba,oM,wY,kY,_Y,SY,EY,j2,XK],(e,t,n,r,i,a,o,s,l,c)=>{var d={left:(n.left||0)+i,right:(n.right||0)+a},u={top:(n.top||0)+o,bottom:(n.bottom||0)+s},p=zd(zd({},u),d),h=p.bottom;p.bottom+=r,p=nY(p,l,c);var y=e-p.left-p.right,g=t-p.top-p.bottom;return zd(zd({brushBottom:h},p),{},{width:Math.max(y,0),height:Math.max(g,0)})}),CY=J(Nn,e=>({x:e.left,y:e.top,width:e.width,height:e.height})),nw=J(Fa,Ba,(e,t)=>({x:0,y:0,width:e,height:t})),jY=m.createContext(null),Qn=()=>m.useContext(jY)!=null,Yh=e=>e.brush,Xh=J([Yh,Nn,oM],(e,t,n)=>({height:e.height,x:Me(e.x)?e.x:t.left,y:Me(e.y)?e.y:t.top+t.height+t.brushBottom-(n?.bottom||0),width:Me(e.width)?e.width:t.width})),gy={},yy={},vy={},jE;function PY(){return jE||(jE=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n,r,{signal:i,edges:a}={}){let o,s=null;const l=a!=null&&a.includes("leading"),c=a==null||a.includes("trailing"),d=()=>{s!==null&&(n.apply(o,s),o=void 0,s=null)},u=()=>{c&&d(),g()};let p=null;const h=()=>{p!=null&&clearTimeout(p),p=setTimeout(()=>{p=null,u()},r)},y=()=>{p!==null&&(clearTimeout(p),p=null)},g=()=>{y(),o=void 0,s=null},x=()=>{d()},v=function(...b){if(i?.aborted)return;o=this,s=b;const w=p==null;h(),l&&w&&d()};return v.schedule=h,v.cancel=g,v.flush=x,i?.addEventListener("abort",g,{once:!0}),v}e.debounce=t})(vy)),vy}var PE;function NY(){return PE||(PE=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=PY();function n(r,i=0,a={}){typeof a!="object"&&(a={});const{leading:o=!1,trailing:s=!0,maxWait:l}=a,c=Array(2);o&&(c[0]="leading"),s&&(c[1]="trailing");let d,u=null;const p=t.debounce(function(...g){d=r.apply(this,g),u=null},i,{edges:c}),h=function(...g){return l!=null&&(u===null&&(u=Date.now()),Date.now()-u>=l)?(d=r.apply(this,g),u=Date.now(),p.cancel(),p.schedule(),d):(p.apply(this,g),d)},y=()=>(p.flush(),d);return h.cancel=p.cancel,h.flush=y,h}e.debounce=n})(yy)),yy}var NE;function TY(){return NE||(NE=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=NY();function n(r,i=0,a={}){const{leading:o=!0,trailing:s=!0}=a;return t.debounce(r,i,{leading:o,maxWait:i,trailing:s})}e.throttle=n})(gy)),gy}var xy,TE;function OY(){return TE||(TE=1,xy=TY().throttle),xy}var AY=OY();const RY=Ci(AY);var Pp=function(t,n){for(var r=arguments.length,i=new Array(r>2?r-2:0),a=2;a<r;a++)i[a-2]=arguments[a];if(typeof console<"u"&&console.warn&&(n===void 0&&console.warn("LogUtils requires an error message argument"),!t))if(n===void 0)console.warn("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var o=0;console.warn(n.replace(/%s/g,()=>i[o++]))}},Vi={width:"100%",height:"100%",debounce:0,minWidth:0,initialDimension:{width:-1,height:-1}},sM=(e,t,n)=>{var{width:r=Vi.width,height:i=Vi.height,aspect:a,maxHeight:o}=n,s=ps(r)?e:Number(r),l=ps(i)?t:Number(i);return a&&a>0&&(s?l=s/a:l&&(s=l*a),o&&l!=null&&l>o&&(l=o)),{calculatedWidth:s,calculatedHeight:l}},MY={width:0,height:0,overflow:"visible"},IY={width:0,overflowX:"visible"},DY={height:0,overflowY:"visible"},LY={},$Y=e=>{var{width:t,height:n}=e,r=ps(t),i=ps(n);return r&&i?MY:r?IY:i?DY:LY};function zY(e){var{width:t,height:n,aspect:r}=e,i=t,a=n;return i===void 0&&a===void 0?(i=Vi.width,a=Vi.height):i===void 0?i=r&&r>0?void 0:Vi.width:a===void 0&&(a=r&&r>0?void 0:Vi.height),{width:i,height:a}}function gx(){return gx=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},gx.apply(null,arguments)}function OE(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function AE(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?OE(Object(n),!0).forEach(function(r){FY(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):OE(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function FY(e,t,n){return(t=BY(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function BY(e){var t=WY(e,"string");return typeof t=="symbol"?t:t+""}function WY(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var lM=m.createContext(Vi.initialDimension);function HY(e){return aa(e.width)&&aa(e.height)}function cM(e){var{children:t,width:n,height:r}=e,i=m.useMemo(()=>({width:n,height:r}),[n,r]);return HY(i)?m.createElement(lM.Provider,{value:i},t):null}var rw=()=>m.useContext(lM),UY=m.forwardRef((e,t)=>{var{aspect:n,initialDimension:r=Vi.initialDimension,width:i,height:a,minWidth:o=Vi.minWidth,minHeight:s,maxHeight:l,children:c,debounce:d=Vi.debounce,id:u,className:p,onResize:h,style:y={}}=e,g=m.useRef(null),x=m.useRef();x.current=h,m.useImperativeHandle(t,()=>g.current);var[v,b]=m.useState({containerWidth:r.width,containerHeight:r.height}),w=m.useCallback((C,j)=>{b(T=>{var A=Math.round(C),R=Math.round(j);return T.containerWidth===A&&T.containerHeight===R?T:{containerWidth:A,containerHeight:R}})},[]);m.useEffect(()=>{if(g.current==null||typeof ResizeObserver>"u")return Cs;var C=R=>{var D,M=R[0];if(M!=null){var{width:O,height:I}=M.contentRect;w(O,I),(D=x.current)===null||D===void 0||D.call(x,O,I)}};d>0&&(C=RY(C,d,{trailing:!0,leading:!1}));var j=new ResizeObserver(C),{width:T,height:A}=g.current.getBoundingClientRect();return w(T,A),j.observe(g.current),()=>{j.disconnect()}},[w,d]);var{containerWidth:_,containerHeight:k}=v;Pp(!n||n>0,"The aspect(%s) must be greater than zero.",n);var{calculatedWidth:S,calculatedHeight:E}=sM(_,k,{width:i,height:a,aspect:n,maxHeight:l});return Pp(S!=null&&S>0||E!=null&&E>0,`The width(%s) and height(%s) of chart should be greater than 0,
450
450
  please check the style of container, or the props width(%s) and height(%s),
451
451
  or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the
452
452
  height and width.`,S,E,i,a,o,s,n),m.createElement("div",{id:u?"".concat(u):void 0,className:bt("recharts-responsive-container",p),style:AE(AE({},y),{},{width:i,height:a,minWidth:o,minHeight:s,maxHeight:l}),ref:g},m.createElement("div",{style:$Y({width:i,height:a})},m.createElement(cM,{width:S,height:E},c)))}),uM=m.forwardRef((e,t)=>{var n=rw();if(aa(n.width)&&aa(n.height))return e.children;var{width:r,height:i}=zY({width:e.width,height:e.height,aspect:e.aspect}),{calculatedWidth:a,calculatedHeight:o}=sM(void 0,void 0,{width:r,height:i,aspect:e.aspect,maxHeight:e.maxHeight});return Me(a)&&Me(o)?m.createElement(cM,{width:a,height:o},e.children):m.createElement(UY,gx({},e,{width:r,height:i,ref:t}))});function iw(e){if(e)return{x:e.x,y:e.y,upperWidth:"upperWidth"in e?e.upperWidth:e.width,lowerWidth:"lowerWidth"in e?e.lowerWidth:e.width,width:e.width,height:e.height}}var Zh=()=>{var e,t=Qn(),n=We(CY),r=We(Xh),i=(e=We(Yh))===null||e===void 0?void 0:e.padding;return!t||!r||!i?n:{width:r.width-i.left-i.right,height:r.height-i.top-i.bottom,x:i.left,y:i.top}},VY={top:0,bottom:0,left:0,right:0,width:0,height:0,brushBottom:0},dM=()=>{var e;return(e=We(Nn))!==null&&e!==void 0?e:VY},fM=()=>We(Fa),pM=()=>We(Ba),_t=e=>e.layout.layoutType,js=()=>We(_t),hM=()=>{var e=js();if(e==="horizontal"||e==="vertical")return e},mM=e=>{var t=e.layout.layoutType;if(t==="centric"||t==="radial")return t},qY=()=>{var e=js();return e!==void 0},Vu=e=>{var t=Ut(),n=Qn(),{width:r,height:i}=e,a=rw(),o=r,s=i;return a&&(o=a.width>0?a.width:r,s=a.height>0?a.height:i),m.useEffect(()=>{!n&&aa(o)&&aa(s)&&t(XG({width:o,height:s}))},[t,n,o,s]),null},gM=Symbol.for("immer-nothing"),RE=Symbol.for("immer-draftable"),Hr=Symbol.for("immer-state");function xi(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var pu=Object.getPrototypeOf;function Ml(e){return!!e&&!!e[Hr]}function ms(e){return e?yM(e)||Array.isArray(e)||!!e[RE]||!!e.constructor?.[RE]||qu(e)||Jh(e):!1}var KY=Object.prototype.constructor.toString(),ME=new WeakMap;function yM(e){if(!e||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);if(t===null||t===Object.prototype)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;if(n===Object)return!0;if(typeof n!="function")return!1;let r=ME.get(n);return r===void 0&&(r=Function.toString.call(n),ME.set(n,r)),r===KY}function Np(e,t,n=!0){Qh(e)===0?(n?Reflect.ownKeys(e):Object.keys(e)).forEach(i=>{t(i,e[i],e)}):e.forEach((r,i)=>t(i,r,e))}function Qh(e){const t=e[Hr];return t?t.type_:Array.isArray(e)?1:qu(e)?2:Jh(e)?3:0}function yx(e,t){return Qh(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function vM(e,t,n){const r=Qh(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function GY(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function qu(e){return e instanceof Map}function Jh(e){return e instanceof Set}function qo(e){return e.copy_||e.base_}function vx(e,t){if(qu(e))return new Map(e);if(Jh(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=yM(e);if(t===!0||t==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(e);delete r[Hr];let i=Reflect.ownKeys(r);for(let a=0;a<i.length;a++){const o=i[a],s=r[o];s.writable===!1&&(s.writable=!0,s.configurable=!0),(s.get||s.set)&&(r[o]={configurable:!0,writable:!0,enumerable:s.enumerable,value:e[o]})}return Object.create(pu(e),r)}else{const r=pu(e);if(r!==null&&n)return{...e};const i=Object.create(r);return Object.assign(i,e)}}function aw(e,t=!1){return em(e)||Ml(e)||!ms(e)||(Qh(e)>1&&Object.defineProperties(e,{set:Fd,add:Fd,clear:Fd,delete:Fd}),Object.freeze(e),t&&Object.values(e).forEach(n=>aw(n,!0))),e}function YY(){xi(2)}var Fd={value:YY};function em(e){return e===null||typeof e!="object"?!0:Object.isFrozen(e)}var XY={};function gs(e){const t=XY[e];return t||xi(0,e),t}var hu;function xM(){return hu}function ZY(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function IE(e,t){t&&(gs("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function xx(e){bx(e),e.drafts_.forEach(QY),e.drafts_=null}function bx(e){e===hu&&(hu=e.parent_)}function DE(e){return hu=ZY(hu,e)}function QY(e){const t=e[Hr];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function LE(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[Hr].modified_&&(xx(t),xi(4)),ms(e)&&(e=Tp(t,e),t.parent_||Op(t,e)),t.patches_&&gs("Patches").generateReplacementPatches_(n[Hr].base_,e,t.patches_,t.inversePatches_)):e=Tp(t,n,[]),xx(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==gM?e:void 0}function Tp(e,t,n){if(em(t))return t;const r=e.immer_.shouldUseStrictIteration(),i=t[Hr];if(!i)return Np(t,(a,o)=>$E(e,i,t,a,o,n),r),t;if(i.scope_!==e)return t;if(!i.modified_)return Op(e,i.base_,!0),i.base_;if(!i.finalized_){i.finalized_=!0,i.scope_.unfinalizedDrafts_--;const a=i.copy_;let o=a,s=!1;i.type_===3&&(o=new Set(a),a.clear(),s=!0),Np(o,(l,c)=>$E(e,i,a,l,c,n,s),r),Op(e,a,!1),n&&e.patches_&&gs("Patches").generatePatches_(i,n,e.patches_,e.inversePatches_)}return i.copy_}function $E(e,t,n,r,i,a,o){if(i==null||typeof i!="object"&&!o)return;const s=em(i);if(!(s&&!o)){if(Ml(i)){const l=a&&t&&t.type_!==3&&!yx(t.assigned_,r)?a.concat(r):void 0,c=Tp(e,i,l);if(vM(n,r,c),Ml(c))e.canAutoFreeze_=!1;else return}else o&&n.add(i);if(ms(i)&&!s){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1||t&&t.base_&&t.base_[r]===i&&s)return;Tp(e,i),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&(qu(n)?n.has(r):Object.prototype.propertyIsEnumerable.call(n,r))&&Op(e,i)}}}function Op(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&aw(t,n)}function JY(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:xM(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let i=r,a=ow;n&&(i=[r],a=mu);const{revoke:o,proxy:s}=Proxy.revocable(i,a);return r.draft_=s,r.revoke_=o,s}var ow={get(e,t){if(t===Hr)return e;const n=qo(e);if(!yx(n,t))return eX(e,n,t);const r=n[t];return e.finalized_||!ms(r)?r:r===by(e.base_,t)?(wy(e),e.copy_[t]=kx(r,e)):r},has(e,t){return t in qo(e)},ownKeys(e){return Reflect.ownKeys(qo(e))},set(e,t,n){const r=bM(qo(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const i=by(qo(e),t),a=i?.[Hr];if(a&&a.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(GY(n,i)&&(n!==void 0||yx(e.base_,t)))return!0;wy(e),wx(e)}return e.copy_[t]===n&&(n!==void 0||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty(e,t){return by(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,wy(e),wx(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=qo(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){xi(11)},getPrototypeOf(e){return pu(e.base_)},setPrototypeOf(){xi(12)}},mu={};Np(ow,(e,t)=>{mu[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});mu.deleteProperty=function(e,t){return mu.set.call(this,e,t,void 0)};mu.set=function(e,t,n){return ow.set.call(this,e[0],t,n,e[0])};function by(e,t){const n=e[Hr];return(n?qo(n):e)[t]}function eX(e,t,n){const r=bM(t,n);return r?"value"in r?r.value:r.get?.call(e.draft_):void 0}function bM(e,t){if(!(t in e))return;let n=pu(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=pu(n)}}function wx(e){e.modified_||(e.modified_=!0,e.parent_&&wx(e.parent_))}function wy(e){e.copy_||(e.copy_=vx(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var tX=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!0,this.produce=(t,n,r)=>{if(typeof t=="function"&&typeof n!="function"){const a=n;n=t;const o=this;return function(l=a,...c){return o.produce(l,d=>n.call(this,d,...c))}}typeof n!="function"&&xi(6),r!==void 0&&typeof r!="function"&&xi(7);let i;if(ms(t)){const a=DE(this),o=kx(t,void 0);let s=!0;try{i=n(o),s=!1}finally{s?xx(a):bx(a)}return IE(a,r),LE(i,a)}else if(!t||typeof t!="object"){if(i=n(t),i===void 0&&(i=t),i===gM&&(i=void 0),this.autoFreeze_&&aw(i,!0),r){const a=[],o=[];gs("Patches").generateReplacementPatches_(t,i,a,o),r(a,o)}return i}else xi(1,t)},this.produceWithPatches=(t,n)=>{if(typeof t=="function")return(o,...s)=>this.produceWithPatches(o,l=>t(l,...s));let r,i;return[this.produce(t,n,(o,s)=>{r=o,i=s}),r,i]},typeof e?.autoFreeze=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof e?.useStrictShallowCopy=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),typeof e?.useStrictIteration=="boolean"&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){ms(e)||xi(8),Ml(e)&&(e=nX(e));const t=DE(this),n=kx(e,void 0);return n[Hr].isManual_=!0,bx(t),n}finishDraft(e,t){const n=e&&e[Hr];(!n||!n.isManual_)&&xi(9);const{scope_:r}=n;return IE(r,t),LE(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const i=t[n];if(i.path.length===0&&i.op==="replace"){e=i.value;break}}n>-1&&(t=t.slice(n+1));const r=gs("Patches").applyPatches_;return Ml(e)?r(e,t):this.produce(e,i=>r(i,t))}};function kx(e,t){const n=qu(e)?gs("MapSet").proxyMap_(e,t):Jh(e)?gs("MapSet").proxySet_(e,t):JY(e,t);return(t?t.scope_:xM()).drafts_.push(n),n}function nX(e){return Ml(e)||xi(10,e),wM(e)}function wM(e){if(!ms(e)||em(e))return e;const t=e[Hr];let n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=vx(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=vx(e,!0);return Np(n,(i,a)=>{vM(n,i,wM(a))},r),t&&(t.finalized_=!1),n}var rX=new tX;rX.produce;var iX={settings:{layout:"horizontal",align:"center",verticalAlign:"middle",itemSorter:"value"},size:{width:0,height:0},payload:[]},kM=Zn({name:"legend",initialState:iX,reducers:{setLegendSize(e,t){e.size.width=t.payload.width,e.size.height=t.payload.height},setLegendSettings(e,t){e.settings.align=t.payload.align,e.settings.layout=t.payload.layout,e.settings.verticalAlign=t.payload.verticalAlign,e.settings.itemSorter=t.payload.itemSorter},addLegendPayload:{reducer(e,t){e.payload.push(t.payload)},prepare:It()},replaceLegendPayload:{reducer(e,t){var{prev:n,next:r}=t.payload,i=ti(e).payload.indexOf(n);i>-1&&(e.payload[i]=r)},prepare:It()},removeLegendPayload:{reducer(e,t){var n=ti(e).payload.indexOf(t.payload);n>-1&&e.payload.splice(n,1)},prepare:It()}}}),{setLegendSize:dxe,setLegendSettings:fxe,addLegendPayload:aX,replaceLegendPayload:oX,removeLegendPayload:sX}=kM.actions,lX=kM.reducer,ky={exports:{}},_y={};var zE;function cX(){if(zE)return _y;zE=1;var e=cb();function t(l,c){return l===c&&(l!==0||1/l===1/c)||l!==l&&c!==c}var n=typeof Object.is=="function"?Object.is:t,r=e.useSyncExternalStore,i=e.useRef,a=e.useEffect,o=e.useMemo,s=e.useDebugValue;return _y.useSyncExternalStoreWithSelector=function(l,c,d,u,p){var h=i(null);if(h.current===null){var y={hasValue:!1,value:null};h.current=y}else y=h.current;h=o(function(){function x(k){if(!v){if(v=!0,b=k,k=u(k),p!==void 0&&y.hasValue){var S=y.value;if(p(S,k))return w=S}return w=k}if(S=w,n(b,k))return S;var E=u(k);return p!==void 0&&p(S,E)?(b=k,S):(b=k,w=E)}var v=!1,b,w,_=d===void 0?null:d;return[function(){return x(c())},_===null?void 0:function(){return x(_())}]},[c,d,u,p]);var g=r(l,h[0],h[1]);return a(function(){y.hasValue=!0,y.value=g},[g]),s(g),g},_y}var FE;function uX(){return FE||(FE=1,ky.exports=cX()),ky.exports}uX();function dX(e){e()}function fX(){let e=null,t=null;return{clear(){e=null,t=null},notify(){dX(()=>{let n=e;for(;n;)n.callback(),n=n.next})},get(){const n=[];let r=e;for(;r;)n.push(r),r=r.next;return n},subscribe(n){let r=!0;const i=t={callback:n,next:null,prev:t};return i.prev?i.prev.next=i:e=i,function(){!r||e===null||(r=!1,i.next?i.next.prev=i.prev:t=i.prev,i.prev?i.prev.next=i.next:e=i.next)}}}}var BE={notify(){},get:()=>[]};function pX(e,t){let n,r=BE,i=0,a=!1;function o(g){d();const x=r.subscribe(g);let v=!1;return()=>{v||(v=!0,x(),u())}}function s(){r.notify()}function l(){y.onStateChange&&y.onStateChange()}function c(){return a}function d(){i++,n||(n=e.subscribe(l),r=fX())}function u(){i--,n&&i===0&&(n(),n=void 0,r.clear(),r=BE)}function p(){a||(a=!0,d())}function h(){a&&(a=!1,u())}const y={addNestedSub:o,notifyNestedSubs:s,handleChangeWrapper:l,isSubscribed:c,trySubscribe:p,tryUnsubscribe:h,getListeners:()=>r};return y}var hX=()=>typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",mX=hX(),gX=()=>typeof navigator<"u"&&navigator.product==="ReactNative",yX=gX(),vX=()=>mX||yX?m.useLayoutEffect:m.useEffect,xX=vX();function WE(e,t){return e===t?e!==0||t!==0||1/e===1/t:e!==e&&t!==t}function bX(e,t){if(WE(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let i=0;i<n.length;i++)if(!Object.prototype.hasOwnProperty.call(t,n[i])||!WE(e[n[i]],t[n[i]]))return!1;return!0}var wX=Symbol.for("react-redux-context"),kX=typeof globalThis<"u"?globalThis:{};function _X(){if(!m.createContext)return{};const e=kX[wX]??=new Map;let t=e.get(m.createContext);return t||(t=m.createContext(null),e.set(m.createContext,t)),t}var SX=_X();function EX(e){const{children:t,context:n,serverState:r,store:i}=e,a=m.useMemo(()=>{const l=pX(i);return{store:i,subscription:l,getServerState:r?()=>r:void 0}},[i,r]),o=m.useMemo(()=>i.getState(),[i]);xX(()=>{const{subscription:l}=a;return l.onStateChange=l.notifyNestedSubs,l.trySubscribe(),o!==i.getState()&&l.notifyNestedSubs(),()=>{l.tryUnsubscribe(),l.onStateChange=void 0}},[a,o]);const s=n||SX;return m.createElement(s.Provider,{value:a},t)}var CX=EX,jX=new Set(["axisLine","tickLine","activeBar","activeDot","activeLabel","activeShape","allowEscapeViewBox","background","cursor","dot","label","line","margin","padding","position","shape","style","tick","wrapperStyle","radius","throttledEvents"]);function PX(e,t){return e==null&&t==null?!0:typeof e=="number"&&typeof t=="number"?e===t||e!==e&&t!==t:e===t}function Ku(e,t){var n=new Set([...Object.keys(e),...Object.keys(t)]);for(var r of n)if(jX.has(r)){if(e[r]==null&&t[r]==null)continue;if(!bX(e[r],t[r]))return!1}else if(!PX(e[r],t[r]))return!1;return!0}function _x(){return _x=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},_x.apply(null,arguments)}function HE(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function lc(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?HE(Object(n),!0).forEach(function(r){NX(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):HE(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function NX(e,t,n){return(t=TX(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function TX(e){var t=OX(e,"string");return typeof t=="symbol"?t:t+""}function OX(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function AX(e){return Array.isArray(e)&&ia(e[0])&&ia(e[1])?e.join(" ~ "):e}var zs={separator:" : ",contentStyle:{margin:0,padding:10,backgroundColor:"#fff",border:"1px solid #ccc",whiteSpace:"nowrap"},itemStyle:{display:"block",paddingTop:4,paddingBottom:4,color:"#000"},labelStyle:{},accessibilityLayer:!1};function RX(e,t){return t==null?e:Dh(e,t)}var MX=e=>{var{separator:t=zs.separator,contentStyle:n,itemStyle:r,labelStyle:i=zs.labelStyle,payload:a,formatter:o,itemSorter:s,wrapperClassName:l,labelClassName:c,label:d,labelFormatter:u,accessibilityLayer:p=zs.accessibilityLayer}=e,h=()=>{if(a&&a.length){var k={padding:0,margin:0},S=RX(a,s),E=S.map((C,j)=>{if(!C||C.type==="none")return null;var T=C.formatter||o||AX,{value:A,name:R}=C,D=A,M=R;if(T){var O=T(A,R,C,j,a);if(Array.isArray(O))[D,M]=O;else if(O!=null)D=O;else return null}var I=lc(lc({},zs.itemStyle),{},{color:C.color||zs.itemStyle.color},r);return m.createElement("li",{className:"recharts-tooltip-item",key:"tooltip-item-".concat(j),style:I},ia(M)?m.createElement("span",{className:"recharts-tooltip-item-name"},M):null,ia(M)?m.createElement("span",{className:"recharts-tooltip-item-separator"},t):null,m.createElement("span",{className:"recharts-tooltip-item-value"},D),m.createElement("span",{className:"recharts-tooltip-item-unit"},C.unit||""))});return m.createElement("ul",{className:"recharts-tooltip-item-list",style:k},E)}return null},y=lc(lc({},zs.contentStyle),n),g=lc({margin:0},i),x=!Ft(d),v=x?d:"",b=bt("recharts-default-tooltip",l),w=bt("recharts-tooltip-label",c);x&&u&&a!==void 0&&a!==null&&(v=u(d,a));var _=p?{role:"status","aria-live":"assertive"}:{};return m.createElement("div",_x({className:b,style:y},_),m.createElement("p",{className:w,style:g},m.isValidElement(v)?v:"".concat(v)),h())},cc="recharts-tooltip-wrapper",IX={visibility:"hidden"};function DX(e){var{coordinate:t,translateX:n,translateY:r}=e;return bt(cc,{["".concat(cc,"-right")]:Me(n)&&t&&Me(t.x)&&n>=t.x,["".concat(cc,"-left")]:Me(n)&&t&&Me(t.x)&&n<t.x,["".concat(cc,"-bottom")]:Me(r)&&t&&Me(t.y)&&r>=t.y,["".concat(cc,"-top")]:Me(r)&&t&&Me(t.y)&&r<t.y})}function UE(e){var{allowEscapeViewBox:t,coordinate:n,key:r,offset:i,position:a,reverseDirection:o,tooltipDimension:s,viewBox:l,viewBoxDimension:c}=e;if(a&&Me(a[r]))return a[r];var d=n[r]-s-(i>0?i:0),u=n[r]+i;if(t[r])return o[r]?d:u;var p=l[r];if(p==null)return 0;if(o[r]){var h=d,y=p;return h<y?Math.max(u,p):Math.max(d,p)}if(c==null)return 0;var g=u+s,x=p+c;return g>x?Math.max(d,p):Math.max(u,p)}function LX(e){var{translateX:t,translateY:n,useTranslate3d:r}=e;return{transform:r?"translate3d(".concat(t,"px, ").concat(n,"px, 0)"):"translate(".concat(t,"px, ").concat(n,"px)")}}function $X(e){var{allowEscapeViewBox:t,coordinate:n,offsetTop:r,offsetLeft:i,position:a,reverseDirection:o,tooltipBox:s,useTranslate3d:l,viewBox:c}=e,d,u,p;return s.height>0&&s.width>0&&n?(u=UE({allowEscapeViewBox:t,coordinate:n,key:"x",offset:i,position:a,reverseDirection:o,tooltipDimension:s.width,viewBox:c,viewBoxDimension:c.width}),p=UE({allowEscapeViewBox:t,coordinate:n,key:"y",offset:r,position:a,reverseDirection:o,tooltipDimension:s.height,viewBox:c,viewBoxDimension:c.height}),d=LX({translateX:u,translateY:p,useTranslate3d:l})):d=IX,{cssProperties:d,cssClasses:DX({translateX:u,translateY:p,coordinate:n})}}var zX=()=>!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout),Gu={isSsr:zX()};function _M(){var[e,t]=m.useState(()=>Gu.isSsr||!window.matchMedia?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches);return m.useEffect(()=>{if(window.matchMedia){var n=window.matchMedia("(prefers-reduced-motion: reduce)"),r=()=>{t(n.matches)};return n.addEventListener("change",r),()=>{n.removeEventListener("change",r)}}},[]),e}function VE(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Fs(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?VE(Object(n),!0).forEach(function(r){FX(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):VE(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function FX(e,t,n){return(t=BX(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function BX(e){var t=WX(e,"string");return typeof t=="symbol"?t:t+""}function WX(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function HX(e){if(!(e.prefersReducedMotion&&e.isAnimationActive==="auto")&&e.isAnimationActive&&e.active)return"transform ".concat(e.animationDuration,"ms ").concat(e.animationEasing)}function UX(e){var t,n,r,i,a,o,s=_M(),[l,c]=m.useState(()=>({dismissed:!1,dismissedAtCoordinate:{x:0,y:0}}));m.useEffect(()=>{var y=g=>{if(g.key==="Escape"){var x,v,b,w;c({dismissed:!0,dismissedAtCoordinate:{x:(x=(v=e.coordinate)===null||v===void 0?void 0:v.x)!==null&&x!==void 0?x:0,y:(b=(w=e.coordinate)===null||w===void 0?void 0:w.y)!==null&&b!==void 0?b:0}})}};return document.addEventListener("keydown",y),()=>{document.removeEventListener("keydown",y)}},[(t=e.coordinate)===null||t===void 0?void 0:t.x,(n=e.coordinate)===null||n===void 0?void 0:n.y]),l.dismissed&&(((r=(i=e.coordinate)===null||i===void 0?void 0:i.x)!==null&&r!==void 0?r:0)!==l.dismissedAtCoordinate.x||((a=(o=e.coordinate)===null||o===void 0?void 0:o.y)!==null&&a!==void 0?a:0)!==l.dismissedAtCoordinate.y)&&c(Fs(Fs({},l),{},{dismissed:!1}));var{cssClasses:d,cssProperties:u}=$X({allowEscapeViewBox:e.allowEscapeViewBox,coordinate:e.coordinate,offsetLeft:typeof e.offset=="number"?e.offset:e.offset.x,offsetTop:typeof e.offset=="number"?e.offset:e.offset.y,position:e.position,reverseDirection:e.reverseDirection,tooltipBox:{height:e.lastBoundingBox.height,width:e.lastBoundingBox.width},useTranslate3d:e.useTranslate3d,viewBox:e.viewBox}),p=e.hasPortalFromProps?{}:Fs(Fs({transition:HX({prefersReducedMotion:s,isAnimationActive:e.isAnimationActive,active:e.active,animationDuration:e.animationDuration,animationEasing:e.animationEasing})},u),{},{pointerEvents:"none",position:"absolute",top:0,left:0}),h=Fs(Fs({},p),{},{visibility:!l.dismissed&&e.active&&e.hasPayload?"visible":"hidden"},e.wrapperStyle);return m.createElement("div",{xmlns:"http://www.w3.org/1999/xhtml",tabIndex:-1,className:d,style:h,ref:e.innerRef},e.children)}var VX=m.memo(UX),SM=()=>{var e;return(e=We(t=>t.rootProps.accessibilityLayer))!==null&&e!==void 0?e:!0};function Sx(){return Sx=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Sx.apply(null,arguments)}function qE(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function KE(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?qE(Object(n),!0).forEach(function(r){qX(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):qE(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function qX(e,t,n){return(t=KX(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function KX(e){var t=GX(e,"string");return typeof t=="symbol"?t:t+""}function GX(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var GE={curveBasisClosed:Iq,curveBasisOpen:Dq,curveBasis:Mq,curveBumpX:bq,curveBumpY:wq,curveLinearClosed:Lq,curveLinear:Mh,curveMonotoneX:$q,curveMonotoneY:zq,curveNatural:Fq,curveStep:Bq,curveStepAfter:Hq,curveStepBefore:Wq},Ap=e=>ct(e.x)&&ct(e.y),YE=e=>e.base!=null&&Ap(e.base)&&Ap(e),uc=e=>e.x,dc=e=>e.y,YX=(e,t)=>{if(typeof e=="function")return e;var n="curve".concat(Bu(e));if((n==="curveMonotone"||n==="curveBump")&&t){var r=GE["".concat(n).concat(t==="vertical"?"Y":"X")];if(r)return r}return GE[n]||Mh},XE={connectNulls:!1,type:"linear"},XX=e=>{var{type:t=XE.type,points:n=[],baseLine:r,layout:i,connectNulls:a=XE.connectNulls}=e,o=YX(t,i),s=a?n.filter(Ap):n;if(Array.isArray(r)){var l,c=n.map((y,g)=>KE(KE({},y),{},{base:r[g]}));i==="vertical"?l=Md().y(dc).x1(uc).x0(y=>y.base.x):l=Md().x(uc).y1(dc).y0(y=>y.base.y);var d=l.defined(YE).curve(o),u=a?c.filter(YE):c;return d(u)}var p;i==="vertical"&&Me(r)?p=Md().y(dc).x1(uc).x0(r):Me(r)?p=Md().x(uc).y1(dc).y0(r):p=JR().x(uc).y(dc);var h=p.defined(Ap).curve(o);return h(s)},EM=e=>{var{className:t,points:n,path:r,pathRef:i}=e,a=js();if((!n||!n.length)&&!r)return null;var o={type:e.type,points:e.points,baseLine:e.baseLine,layout:e.layout||a,connectNulls:e.connectNulls},s=n&&n.length?XX(o):r;return m.createElement("path",Sx({},ki(e),q0(e),{className:bt("recharts-curve",t),d:s===null?void 0:s,ref:i}))},ZX=["x","y","top","left","width","height","className"];function Ex(){return Ex=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ex.apply(null,arguments)}function ZE(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function QX(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?ZE(Object(n),!0).forEach(function(r){JX(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ZE(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function JX(e,t,n){return(t=eZ(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function eZ(e){var t=tZ(e,"string");return typeof t=="symbol"?t:t+""}function tZ(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function nZ(e,t){if(e==null)return{};var n,r,i=rZ(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function rZ(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var iZ=(e,t,n,r,i,a)=>"M".concat(e,",").concat(i,"v").concat(r,"M").concat(a,",").concat(t,"h").concat(n),aZ=e=>{var{x:t=0,y:n=0,top:r=0,left:i=0,width:a=0,height:o=0,className:s}=e,l=nZ(e,ZX),c=QX({x:t,y:n,top:r,left:i,width:a,height:o},l);return!Me(t)||!Me(n)||!Me(a)||!Me(o)||!Me(r)||!Me(i)?null:m.createElement("path",Ex({},ur(c),{className:bt("recharts-cross",s),d:iZ(t,n,a,o,r,i)}))};function oZ(e,t,n,r){var i=r/2;return{stroke:"none",fill:"#ccc",x:e==="horizontal"?t.x-i:n.left+.5,y:e==="horizontal"?n.top+.5:t.y-i,width:e==="horizontal"?r:n.width-1,height:e==="horizontal"?n.height-1:r}}function QE(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function JE(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?QE(Object(n),!0).forEach(function(r){sZ(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):QE(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function sZ(e,t,n){return(t=lZ(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function lZ(e){var t=cZ(e,"string");return typeof t=="symbol"?t:t+""}function cZ(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var uZ=e=>e.replace(/([A-Z])/g,t=>"-".concat(t.toLowerCase())),CM=(e,t,n)=>e.map(r=>"".concat(uZ(r)," ").concat(t,"ms ").concat(n)).join(","),dZ=(e,t)=>[Object.keys(e),Object.keys(t)].reduce((n,r)=>n.filter(i=>r.includes(i))),gu=(e,t)=>Object.keys(t).reduce((n,r)=>JE(JE({},n),{},{[r]:e(r,t[r])}),{});function eC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function vn(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?eC(Object(n),!0).forEach(function(r){fZ(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):eC(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function fZ(e,t,n){return(t=pZ(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function pZ(e){var t=hZ(e,"string");return typeof t=="symbol"?t:t+""}function hZ(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Rp=(e,t,n)=>e+(t-e)*n,Cx=e=>{var{from:t,to:n}=e;return t!==n},jM=(e,t,n)=>{var r=gu((i,a)=>{if(Cx(a)){var[o,s]=e(a.from,a.to,a.velocity);return vn(vn({},a),{},{from:o,velocity:s})}return a},t);return n<1?gu((i,a)=>Cx(a)&&r[i]!=null?vn(vn({},a),{},{velocity:Rp(a.velocity,r[i].velocity,n),from:Rp(a.from,r[i].from,n)}):a,t):jM(e,r,n-1)};function mZ(e,t,n,r,i,a){var o,s=r.reduce((p,h)=>vn(vn({},p),{},{[h]:{from:e[h],velocity:0,to:t[h]}}),{}),l=()=>gu((p,h)=>h.from,s),c=()=>!Object.values(s).filter(Cx).length,d=null,u=p=>{o||(o=p);var h=p-o,y=h/n.dt;s=jM(n,s,y),i(vn(vn(vn({},e),t),l())),o=p,c()||(d=a.setTimeout(u))};return()=>(d=a.setTimeout(u),()=>{var p;(p=d)===null||p===void 0||p()})}function gZ(e,t,n,r,i,a,o){var s=null,l=i.reduce((u,p)=>{var h=e[p],y=t[p];return h==null||y==null?u:vn(vn({},u),{},{[p]:[h,y]})},{}),c,d=u=>{c||(c=u);var p=(u-c)/r,h=gu((g,x)=>Rp(...x,n(p)),l);if(a(vn(vn(vn({},e),t),h)),p<1)s=o.setTimeout(d);else{var y=gu((g,x)=>Rp(...x,n(1)),l);a(vn(vn(vn({},e),t),y))}};return()=>(s=o.setTimeout(d),()=>{var u;(u=s)===null||u===void 0||u()})}const yZ=(e,t,n,r,i,a)=>{var o=dZ(e,t);return n==null?()=>(i(vn(vn({},e),t)),()=>{}):n.isStepper===!0?mZ(e,t,n,o,i,a):gZ(e,t,n,r,o,i,a)};var Mp=1e-4,PM=(e,t)=>[0,3*e,3*t-6*e,3*e-3*t+1],NM=(e,t)=>e.map((n,r)=>n*t**r).reduce((n,r)=>n+r),tC=(e,t)=>n=>{var r=PM(e,t);return NM(r,n)},vZ=(e,t)=>n=>{var r=PM(e,t),i=[...r.map((a,o)=>a*o).slice(1),0];return NM(i,n)},xZ=e=>{var t,n=e.split("(");if(n.length!==2||n[0]!=="cubic-bezier")return null;var r=(t=n[1])===null||t===void 0||(t=t.split(")")[0])===null||t===void 0?void 0:t.split(",");if(r==null||r.length!==4)return null;var i=r.map(a=>parseFloat(a));return[i[0],i[1],i[2],i[3]]},bZ=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];if(n.length===1)switch(n[0]){case"linear":return[0,0,1,1];case"ease":return[.25,.1,.25,1];case"ease-in":return[.42,0,1,1];case"ease-out":return[.42,0,.58,1];case"ease-in-out":return[0,0,.58,1];default:{var i=xZ(n[0]);if(i)return i}}return n.length===4?n:[0,0,1,1]},wZ=(e,t,n,r)=>{var i=tC(e,n),a=tC(t,r),o=vZ(e,n),s=c=>c>1?1:c<0?0:c,l=c=>{for(var d=c>1?1:c,u=d,p=0;p<8;++p){var h=i(u)-d,y=o(u);if(Math.abs(h-d)<Mp||y<Mp)return a(u);u=s(u-h/y)}return a(u)};return l.isStepper=!1,l},nC=function(){return wZ(...bZ(...arguments))},kZ=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},{stiff:n=100,damping:r=8,dt:i=17}=t,a=(o,s,l)=>{var c=-(o-s)*n,d=l*r,u=l+(c-d)*i/1e3,p=l*i/1e3+o;return Math.abs(p-s)<Mp&&Math.abs(u)<Mp?[s,0]:[p,u]};return a.isStepper=!0,a.dt=i,a},_Z=e=>{if(typeof e=="string")switch(e){case"ease":case"ease-in-out":case"ease-out":case"ease-in":case"linear":return nC(e);case"spring":return kZ();default:if(e.split("(")[0]==="cubic-bezier")return nC(e)}return typeof e=="function"?e:null};function SZ(e){var t,n=()=>null,r=!1,i=null,a=o=>{if(!r){if(Array.isArray(o)){if(!o.length)return;var s=o,[l,...c]=s;if(typeof l=="number"){i=e.setTimeout(a.bind(null,c),l);return}a(l),i=e.setTimeout(a.bind(null,c));return}typeof o=="string"&&(t=o,n(t)),typeof o=="object"&&(t=o,n(t)),typeof o=="function"&&o()}};return{stop:()=>{r=!0},start:o=>{r=!1,i&&(i(),i=null),a(o)},subscribe:o=>(n=o,()=>{n=()=>null}),getTimeoutController:()=>e}}class EZ{setTimeout(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=performance.now(),i=null,a=o=>{o-r>=n?t(o):typeof requestAnimationFrame=="function"&&(i=requestAnimationFrame(a))};return i=requestAnimationFrame(a),()=>{i!=null&&cancelAnimationFrame(i)}}}function CZ(){return SZ(new EZ)}var jZ=m.createContext(CZ);function PZ(e,t){var n=m.useContext(jZ);return m.useMemo(()=>t??n(e),[e,t,n])}var NZ={begin:0,duration:1e3,easing:"ease",isActive:!0,canBegin:!0,onAnimationEnd:()=>{},onAnimationStart:()=>{}},rC={t:0},Sy={t:1};function tm(e){var t=fr(e,NZ),{isActive:n,canBegin:r,duration:i,easing:a,begin:o,onAnimationEnd:s,onAnimationStart:l,children:c}=t,d=_M(),u=n==="auto"?!Gu.isSsr&&!d:n,p=PZ(t.animationId,t.animationManager),[h,y]=m.useState(u?rC:Sy),g=m.useRef(null);return m.useEffect(()=>{u||y(Sy)},[u]),m.useEffect(()=>{if(!u||!r)return Cs;var x=yZ(rC,Sy,_Z(a),i,y,p.getTimeoutController()),v=()=>{g.current=x()};return p.start([l,o,v,i,s]),()=>{p.stop(),g.current&&g.current(),s()}},[u,r,i,a,o,l,s,p]),c(h.t)}function nm(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"animation-",n=m.useRef(cu(t)),r=m.useRef(e);return r.current!==e&&(n.current=cu(t),r.current=e),n.current}var TZ=["radius"],OZ=["radius"],iC,aC,oC,sC,lC,cC,uC,dC,fC,pC;function hC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function mC(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?hC(Object(n),!0).forEach(function(r){AZ(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):hC(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function AZ(e,t,n){return(t=RZ(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function RZ(e){var t=MZ(e,"string");return typeof t=="symbol"?t:t+""}function MZ(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Ip(){return Ip=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ip.apply(null,arguments)}function gC(e,t){if(e==null)return{};var n,r,i=IZ(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function IZ(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function Mi(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var yC=(e,t,n,r,i)=>{var a=fo(n),o=fo(r),s=Math.min(Math.abs(a)/2,Math.abs(o)/2),l=o>=0?1:-1,c=a>=0?1:-1,d=o>=0&&a>=0||o<0&&a<0?1:0,u;if(s>0&&Array.isArray(i)){for(var p=[0,0,0,0],h=0,y=4;h<y;h++){var g,x=(g=i[h])!==null&&g!==void 0?g:0;p[h]=x>s?s:x}u=Yt(iC||(iC=Mi(["M",",",""])),e,t+l*p[0]),p[0]>0&&(u+=Yt(aC||(aC=Mi(["A ",",",",0,0,",",",",",""])),p[0],p[0],d,e+c*p[0],t)),u+=Yt(oC||(oC=Mi(["L ",",",""])),e+n-c*p[1],t),p[1]>0&&(u+=Yt(sC||(sC=Mi(["A ",",",",0,0,",`,