tarsk 0.5.59 → 0.5.60
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +862 -144
- package/dist/public/assets/account-view-DPM8TZiH.js +1 -0
- package/dist/public/assets/api-BcqwPTwD.js +1 -0
- package/dist/public/assets/{async-error-boundary-CaRNnJZe.js → async-error-boundary-B56Jpu_o.js} +1 -1
- package/dist/public/assets/browser-tab-k2H96rcs.js +8 -0
- package/dist/public/assets/{card-DFACZp3F.js → card-C2MSBS4a.js} +1 -1
- package/dist/public/assets/commit-dialog-CPsT5k3n.js +1 -0
- package/dist/public/assets/context-menu-7zA2_Vvh.js +1 -0
- package/dist/public/assets/create-repo-dialog-wC-DyHKe.js +1 -0
- package/dist/public/assets/dialogs-config-C7xqDv5K.js +51 -0
- package/dist/public/assets/diff-view-dAnk7skm.js +4 -0
- package/dist/public/assets/{explorer-tab-context-DCq1BBX_.js → explorer-tab-context-gi63e_bv.js} +1 -1
- package/dist/public/assets/explorer-tab-view-ai_mDxBQ.js +2 -0
- package/dist/public/assets/explorer-tree-BZFGE0sU.js +1 -0
- package/dist/public/assets/explorer-view-D6MhosMA.js +75 -0
- package/dist/public/assets/git-history-dialog-Dd_DmfZC.js +1 -0
- package/dist/public/assets/git-ops-button-BhHIYXxb.js +2 -0
- package/dist/public/assets/history-view-DVqIaJOR.js +16 -0
- package/dist/public/assets/index-CyxfX_DC.css +1 -0
- package/dist/public/assets/index-D2AOIdVd.js +75 -0
- package/dist/public/assets/mcp-server-card-CuBKoFtN.js +1 -0
- package/dist/public/assets/merged-pr-dialog-M4vwv3lT.js +1 -0
- package/dist/public/assets/model-list-controls-DBAyi2PU.js +1 -0
- package/dist/public/assets/{monaco-CMkNoWsM.js → monaco-D3l3Gbj2.js} +1 -1
- package/dist/public/assets/onboarding-BpwQ9yz5.js +1 -0
- package/dist/public/assets/project-env-vars-view-Cs3LO_18.js +1 -0
- package/dist/public/assets/project-model-aliases-view-Z5b4ZC1k.js +1 -0
- package/dist/public/assets/project-settings-view-BOO6FS8b.js +1 -0
- package/dist/public/assets/project-tools-view-cjwDYCta.js +1 -0
- package/dist/public/assets/providers-list-view-BBGnB3Rq.js +1 -0
- package/dist/public/assets/pull-request-dialog-VOoEmwTG.js +1 -0
- package/dist/public/assets/pull-with-changes-dialog-CoHIwHJZ.js +1 -0
- package/dist/public/assets/push-before-pr-dialog-9fV4cFz5.js +1 -0
- package/dist/public/assets/react-vendor-XZeum4Wo.js +14 -0
- package/dist/public/assets/settings-general-view-CDr9M3SH.js +1 -0
- package/dist/public/assets/settings-instructions-view-B2mWcZiS.js +1 -0
- package/dist/public/assets/settings-list-JqM9DgX9.js +1 -0
- package/dist/public/assets/settings-logs-view-BjlFrCXc.js +5 -0
- package/dist/public/assets/settings-mcp-servers-view-BmVtKqmN.js +5 -0
- package/dist/public/assets/settings-models-view-E-HNZWxO.js +1 -0
- package/dist/public/assets/settings-rules-view-CdOk3Osl.js +8 -0
- package/dist/public/assets/settings-skills-view-Cn-GySxU.js +3 -0
- package/dist/public/assets/settings-slash-commands-view-CqYBr6_A.js +1 -0
- package/dist/public/assets/settings-statistics-view-B92b4bKS.js +1 -0
- package/dist/public/assets/settings-subagents-view-AL0iV3gX.js +2 -0
- package/dist/public/assets/settings-system-prompt-view-B6CBgNW3.js +1 -0
- package/dist/public/assets/settings-telegram-view-DHQxRoFn.js +1 -0
- package/dist/public/assets/settings-view-CBLOR6Gr.js +2 -0
- package/dist/public/assets/{skeleton-DBWV1Usf.js → skeleton-CK0EzL_G.js} +1 -1
- package/dist/public/assets/slug-utils-CdbHvCiP.js +1 -0
- package/dist/public/assets/tasks-view-D1nPjESr.js +2 -0
- package/dist/public/assets/{terminal-panel-Dlon-VDl.js → terminal-panel-m9GEHtY2.js} +2 -2
- package/dist/public/assets/{ui-components-Dd2afm0c.js → ui-components-BuIiDdYp.js} +1 -1
- package/dist/public/assets/{use-deferred-search-Cu-o4nau.js → use-deferred-search-hIqqinof.js} +1 -1
- package/dist/public/assets/use-installed-ai-files-C1Uta9US.js +1 -0
- package/dist/public/assets/{use-settings-page-loading-D1JlmLmD.js → use-settings-page-loading-DtwNt6_e.js} +1 -1
- package/dist/public/assets/{utils-Dt07QR3w.js → utils-B1IYtes_.js} +1 -1
- package/dist/public/assets/{web-CdkfJJZ3.js → web-BF1VNxf3.js} +1 -1
- package/dist/public/assets/{web-DeCAC9ap.js → web-BGxrdTO9.js} +1 -1
- package/dist/public/assets/{web-DsLUxLTR.js → web-DrKfK3e-.js} +1 -1
- package/dist/public/assets/{web-CiaJzwav.js → web-LjAIxEG5.js} +1 -1
- package/dist/public/index.html +9 -9
- package/package.json +1 -1
- package/dist/public/assets/account-view-Cc6oDwk4.js +0 -1
- package/dist/public/assets/api-CtfZCd77.js +0 -1
- package/dist/public/assets/browser-tab-BfAt-Sho.js +0 -8
- package/dist/public/assets/commit-dialog-Ck0r2v9S.js +0 -1
- package/dist/public/assets/context-menu-CBvTcHUI.js +0 -1
- package/dist/public/assets/create-repo-dialog-CBvRaov7.js +0 -1
- package/dist/public/assets/dialogs-config-C2KFQf9x.js +0 -51
- package/dist/public/assets/diff-view-DDECIdhE.js +0 -4
- package/dist/public/assets/explorer-tab-view-72Krb0Ir.js +0 -2
- package/dist/public/assets/explorer-tree-CcFgAYMn.js +0 -1
- package/dist/public/assets/explorer-view-DsNxf6nu.js +0 -75
- package/dist/public/assets/git-history-dialog--akFTQOd.js +0 -1
- package/dist/public/assets/git-ops-button-CKGLh3Zk.js +0 -2
- package/dist/public/assets/history-view-IcXfB6BD.js +0 -15
- package/dist/public/assets/index-BmpLvHah.js +0 -75
- package/dist/public/assets/index-r8I03VVW.css +0 -1
- package/dist/public/assets/mcp-server-card-DDmDAlY8.js +0 -1
- package/dist/public/assets/merged-pr-dialog-CiwhRqFv.js +0 -1
- package/dist/public/assets/model-list-controls-D5IaOffK.js +0 -1
- package/dist/public/assets/onboarding-CFIVEI92.js +0 -1
- package/dist/public/assets/project-settings-view-Klpu7p3U.js +0 -1
- package/dist/public/assets/providers-list-view-Df-ONKwe.js +0 -1
- package/dist/public/assets/pull-request-dialog-DVYZgMuN.js +0 -1
- package/dist/public/assets/pull-with-changes-dialog-CHHJ0gpA.js +0 -1
- package/dist/public/assets/push-before-pr-dialog-DoNMB3C8.js +0 -1
- package/dist/public/assets/react-vendor-tSKmVA4e.js +0 -14
- package/dist/public/assets/settings-general-view-yDDYKQmO.js +0 -1
- package/dist/public/assets/settings-instructions-view-y9bUZtKn.js +0 -1
- package/dist/public/assets/settings-list-j_NDw-aW.js +0 -1
- package/dist/public/assets/settings-logs-view-BzrjJRk6.js +0 -5
- package/dist/public/assets/settings-mcp-servers-view-NuKeyQ92.js +0 -5
- package/dist/public/assets/settings-models-view-64UG4njI.js +0 -1
- package/dist/public/assets/settings-rules-view-DdxIfxki.js +0 -8
- package/dist/public/assets/settings-skills-view-DoVxhA-A.js +0 -3
- package/dist/public/assets/settings-slash-commands-view-vm0HNVw1.js +0 -1
- package/dist/public/assets/settings-statistics-view-CKc3bD1x.js +0 -1
- package/dist/public/assets/settings-subagents-view-DuHK-7uc.js +0 -2
- package/dist/public/assets/settings-system-prompt-view-1clIREZ5.js +0 -1
- package/dist/public/assets/settings-telegram-view-DCPC5GxD.js +0 -1
- package/dist/public/assets/settings-view-BweC2YuW.js +0 -2
- package/dist/public/assets/slug-utils-D8SJJo7H.js +0 -1
- package/dist/public/assets/tasks-view-Cg9N8GZb.js +0 -2
- package/dist/public/assets/use-installed-ai-files-X8NXRdGD.js +0 -1
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import{i as e,n as t}from"./rolldown-runtime-aKtaBQYM.js";import{$ as n,$n as r,A as i,B as a,C as o,Ci as s,Co as c,Cs as l,D as u,E as d,F as f,H as p,J as m,K as h,L as g,M as _,Mn as v,N as y,Nn as b,O as x,Oa as S,On as C,Ot as w,P as T,Pi as E,Q as ee,S as te,T as ne,Tt as D,U as O,Us as re,V as ie,W as ae,X as oe,Y as se,Yn as ce,Z as le,Zi as ue,_ as de,_a as fe,_c as pe,_n as me,ac as he,b as ge,bc as _e,bs as ve,ca as ye,ct as be,dn as xe,et as k,fa as Se,fn as Ce,gc as we,gt as Te,hc as Ee,ht as De,il as Oe,j as ke,k as Ae,la as je,ma as Me,mc as Ne,ms as Pe,mt as Fe,nl as Ie,rl as Le,ss as Re,tl as ze,ua as A,v as Be,va as Ve,w as He,x as Ue,xc as j,y as We,yo as Ge,yr as Ke,yt as qe,z as Je}from"./dialogs-config-C7xqDv5K.js";var M=e(Oe(),1),Ye=`modulepreload`,Xe=function(e){return`/`+e},Ze={},Qe=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}r=o(t.map(t=>{if(t=Xe(t,n),t in Ze)return;Ze[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:Ye,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},$e=`popstate`;function et(e){return typeof e==`object`&&!!e&&`pathname`in e&&`search`in e&&`hash`in e&&`state`in e&&`key`in e}function tt(e={}){let{initialEntries:t=[`/`],initialIndex:n,v5Compat:r=!1}=e,i;i=t.map((e,t)=>u(e,typeof e==`string`?null:e.state,t===0?`default`:void 0,typeof e==`string`?void 0:e.unstable_mask));let a=c(n??i.length-1),o=`POP`,s=null;function c(e){return Math.min(Math.max(e,0),i.length-1)}function l(){return i[a]}function u(e,t=null,n,r){let a=ot(i?l().pathname:`/`,e,t,n,r);return rt(a.pathname.charAt(0)===`/`,`relative pathnames are not supported in memory history: ${JSON.stringify(e)}`),a}function d(e){return typeof e==`string`?e:st(e)}return{get index(){return a},get action(){return o},get location(){return l()},createHref:d,createURL(e){return new URL(d(e),`http://localhost`)},encodeLocation(e){let t=typeof e==`string`?ct(e):e;return{pathname:t.pathname||``,search:t.search||``,hash:t.hash||``}},push(e,t){o=`PUSH`;let n=et(e)?e:u(e,t);a+=1,i.splice(a,i.length,n),r&&s&&s({action:o,location:n,delta:1})},replace(e,t){o=`REPLACE`;let n=et(e)?e:u(e,t);i[a]=n,r&&s&&s({action:o,location:n,delta:0})},go(e){o=`POP`;let t=c(a+e),n=i[t];a=t,s&&s({action:o,location:n,delta:e})},listen(e){return s=e,()=>{s=null}}}}function nt(e={}){function t(e,t){let{pathname:n=`/`,search:r=``,hash:i=``}=ct(e.location.hash.substring(1));return!n.startsWith(`/`)&&!n.startsWith(`.`)&&(n=`/`+n),ot(``,{pathname:n,search:r,hash:i},t.state&&t.state.usr||null,t.state&&t.state.key||`default`)}function n(e,t){let n=e.document.querySelector(`base`),r=``;if(n&&n.getAttribute(`href`)){let t=e.location.href,n=t.indexOf(`#`);r=n===-1?t:t.slice(0,n)}return r+`#`+(typeof t==`string`?t:st(t))}function r(e,t){rt(e.pathname.charAt(0)===`/`,`relative pathnames are not supported in hash history.push(${JSON.stringify(t)})`)}return lt(t,n,r,e)}function N(e,t){if(e===!1||e==null)throw Error(t)}function rt(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function it(){return Math.random().toString(36).substring(2,10)}function at(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.unstable_mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function ot(e,t,n=null,r,i){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?ct(t):t,state:n,key:t&&t.key||r||it(),unstable_mask:i}}function st({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 ct(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 lt(e,t,n,r={}){let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,s=`POP`,c=null,l=u();l??(l=0,o.replaceState({...o.state,idx:l},``));function u(){return(o.state||{idx:null}).idx}function d(){s=`POP`;let e=u(),t=e==null?null:e-l;l=e,c&&c({action:s,location:h.location,delta:t})}function f(e,t){s=`PUSH`;let r=et(e)?e:ot(h.location,e,t);n&&n(r,e),l=u()+1;let d=at(r,l),f=h.createHref(r.unstable_mask||r);try{o.pushState(d,``,f)}catch(e){if(e instanceof DOMException&&e.name===`DataCloneError`)throw e;i.location.assign(f)}a&&c&&c({action:s,location:h.location,delta:1})}function p(e,t){s=`REPLACE`;let r=et(e)?e:ot(h.location,e,t);n&&n(r,e),l=u();let i=at(r,l),d=h.createHref(r.unstable_mask||r);o.replaceState(i,``,d),a&&c&&c({action:s,location:h.location,delta:0})}function m(e){return ut(e)}let h={get action(){return s},get location(){return e(i,o)},listen(e){if(c)throw Error(`A history only accepts one active listener`);return i.addEventListener($e,d),c=e,()=>{i.removeEventListener($e,d),c=null}},createHref(e){return t(i,e)},createURL:m,encodeLocation(e){let t=m(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:f,replace:p,go(e){return o.go(e)}};return h}function ut(e,t=!1){let n=`http://localhost`;typeof window<`u`&&(n=window.location.origin===`null`?window.location.href:window.location.origin),N(n,`No window.location.(origin|href) available to create URL`);let r=typeof e==`string`?e:st(e);return r=r.replace(/ $/,`%20`),!t&&r.startsWith(`//`)&&(r=n+r),new URL(r,n)}function dt(e,t,n=`/`){return ft(e,t,n,!1)}function ft(e,t,n,r){let i=At((typeof t==`string`?ct(t):t).pathname||`/`,n);if(i==null)return null;let a=mt(e);gt(a);let o=null;for(let e=0;o==null&&e<a.length;++e){let t=kt(i);o=Et(a[e],t,r)}return o}function pt(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 mt(e,t=[],n=[],r=``,i=!1){let a=(e,a,o=i,s)=>{let c={relativePath:s===void 0?e.path||``:s,caseSensitive:e.caseSensitive===!0,childrenIndex:a,route:e};if(c.relativePath.startsWith(`/`)){if(!c.relativePath.startsWith(r)&&o)return;N(c.relativePath.startsWith(r),`Absolute route path "${c.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),c.relativePath=c.relativePath.slice(r.length)}let l=Rt([r,c.relativePath]),u=n.concat(c);e.children&&e.children.length>0&&(N(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${l}".`),mt(e.children,t,u,l,o)),!(e.path==null&&!e.index)&&t.push({path:l,score:wt(l,e.index),routesMeta:u})};return e.forEach((e,t)=>{if(e.path===``||!e.path?.includes(`?`))a(e,t);else for(let n of ht(e.path))a(e,t,!0,n)}),t}function ht(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=ht(r.join(`/`)),s=[];return s.push(...o.map(e=>e===``?a:[a,e].join(`/`))),i&&s.push(...o),s.map(t=>e.startsWith(`/`)&&t===``?`/`:t)}function gt(e){e.sort((e,t)=>e.score===t.score?Tt(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var _t=/^:[\w-]+$/,vt=3,yt=2,bt=1,xt=10,St=-2,Ct=e=>e===`*`;function wt(e,t){let n=e.split(`/`),r=n.length;return n.some(Ct)&&(r+=St),t&&(r+=yt),n.filter(e=>!Ct(e)).reduce((e,t)=>e+(_t.test(t)?vt:t===``?bt:xt),r)}function Tt(e,t){return e.length===t.length&&e.slice(0,-1).every((e,n)=>e===t[n])?e[e.length-1]-t[t.length-1]:0}function Et(e,t,n=!1){let{routesMeta:r}=e,i={},a=`/`,o=[];for(let e=0;e<r.length;++e){let s=r[e],c=e===r.length-1,l=a===`/`?t:t.slice(a.length)||`/`,u=Dt({path:s.relativePath,caseSensitive:s.caseSensitive,end:c},l),d=s.route;if(!u&&c&&n&&!r[r.length-1].route.index&&(u=Dt({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},l)),!u)return null;Object.assign(i,u.params),o.push({params:i,pathname:Rt([a,u.pathname]),pathnameBase:zt(Rt([a,u.pathnameBase])),route:d}),u.pathnameBase!==`/`&&(a=Rt([a,u.pathnameBase]))}return o}function Dt(e,t){typeof e==`string`&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=Ot(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((e,{paramName:t,isOptional:n},r)=>{if(t===`*`){let e=s[r]||``;o=a.slice(0,a.length-e.length).replace(/(.)\/+$/,`$1`)}let i=s[r];return n&&!i?e[t]=void 0:e[t]=(i||``).replace(/%2F/g,`/`),e},{}),pathname:a,pathnameBase:o,pattern:e}}function Ot(e,t=!1,n=!0){rt(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,(e,t,n,i,a)=>{if(r.push({paramName:t,isOptional:n!=null}),n){let t=a.charAt(i+e.length);return t&&t!==`/`?`/([^\\/]*)`:`(?:/([^\\/]*))?`}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 kt(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return rt(!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 At(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)||`/`}var jt=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function Mt(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?ct(e):e,a;return n?(n=n.replace(/\/\/+/g,`/`),a=n.startsWith(`/`)?Nt(n.substring(1),`/`):Nt(n,t)):a=t,{pathname:a,search:Bt(r),hash:Vt(i)}}function Nt(e,t){let n=t.replace(/\/+$/,``).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function Pt(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 Ft(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function It(e){let t=Ft(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function Lt(e,t,n,r=!1){let i;typeof e==`string`?i=ct(e):(i={...e},N(!i.pathname||!i.pathname.includes(`?`),Pt(`?`,`pathname`,`search`,i)),N(!i.pathname||!i.pathname.includes(`#`),Pt(`#`,`pathname`,`hash`,i)),N(!i.search||!i.search.includes(`#`),Pt(`#`,`search`,`hash`,i)));let a=e===``||i.pathname===``,o=a?`/`:i.pathname,s;if(o==null)s=n;else{let e=t.length-1;if(!r&&o.startsWith(`..`)){let t=o.split(`/`);for(;t[0]===`..`;)t.shift(),--e;i.pathname=t.join(`/`)}s=e>=0?t[e]:`/`}let c=Mt(i,s),l=o&&o!==`/`&&o.endsWith(`/`),u=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||u)&&(c.pathname+=`/`),c}var Rt=e=>e.join(`/`).replace(/\/\/+/g,`/`),zt=e=>e.replace(/\/+$/,``).replace(/^\/*/,`/`),Bt=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,Vt=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,Ht=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 Ut(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function Wt(e){return e.map(e=>e.route.path).filter(Boolean).join(`/`).replace(/\/\/*/g,`/`)||`/`}var Gt=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function Kt(e,t){let n=e;if(typeof n!=`string`||!jt.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(Gt)try{let e=new URL(window.location.href),r=n.startsWith(`//`)?new URL(e.protocol+n):new URL(n),a=At(r.pathname,t);r.origin===e.origin&&a!=null?n=a+r.search+r.hash:i=!0}catch{rt(!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}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);var qt=[`POST`,`PUT`,`PATCH`,`DELETE`];new Set(qt);var Jt=[`GET`,...qt];new Set(Jt);var Yt=M.createContext(null);Yt.displayName=`DataRouter`;var Xt=M.createContext(null);Xt.displayName=`DataRouterState`;var Zt=M.createContext(!1);function Qt(){return M.useContext(Zt)}var $t=M.createContext({isTransitioning:!1});$t.displayName=`ViewTransition`;var en=M.createContext(new Map);en.displayName=`Fetchers`;var tn=M.createContext(null);tn.displayName=`Await`;var nn=M.createContext(null);nn.displayName=`Navigation`;var rn=M.createContext(null);rn.displayName=`Location`;var an=M.createContext({outlet:null,matches:[],isDataRoute:!1});an.displayName=`Route`;var on=M.createContext(null);on.displayName=`RouteError`;var sn=`REACT_ROUTER_ERROR`,cn=`REDIRECT`,ln=`ROUTE_ERROR_RESPONSE`;function un(e){if(e.startsWith(`${sn}:${cn}:{`))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 dn(e){if(e.startsWith(`${sn}:${ln}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`)return new Ht(t.status,t.statusText,t.data)}catch{}}function fn(e,{relative:t}={}){N(pn(),`useHref() may be used only in the context of a <Router> component.`);let{basename:n,navigator:r}=M.useContext(nn),{hash:i,pathname:a,search:o}=bn(e,{relative:t}),s=a;return n!==`/`&&(s=a===`/`?n:Rt([n,a])),r.createHref({pathname:s,search:o,hash:i})}function pn(){return M.useContext(rn)!=null}function mn(){return N(pn(),`useLocation() may be used only in the context of a <Router> component.`),M.useContext(rn).location}var hn=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function gn(e){M.useContext(nn).static||M.useLayoutEffect(e)}function _n(){let{isDataRoute:e}=M.useContext(an);return e?zn():vn()}function vn(){N(pn(),`useNavigate() may be used only in the context of a <Router> component.`);let e=M.useContext(Yt),{basename:t,navigator:n}=M.useContext(nn),{matches:r}=M.useContext(an),{pathname:i}=mn(),a=JSON.stringify(It(r)),o=M.useRef(!1);return gn(()=>{o.current=!0}),M.useCallback((r,s={})=>{if(rt(o.current,hn),!o.current)return;if(typeof r==`number`){n.go(r);return}let c=Lt(r,JSON.parse(a),i,s.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:Rt([t,c.pathname])),(s.replace?n.replace:n.push)(c,s.state,s)},[t,n,a,i,e])}M.createContext(null);function yn(){let{matches:e}=M.useContext(an),t=e[e.length-1];return t?t.params:{}}function bn(e,{relative:t}={}){let{matches:n}=M.useContext(an),{pathname:r}=mn(),i=JSON.stringify(It(n));return M.useMemo(()=>Lt(e,JSON.parse(i),r,t===`path`),[e,i,r,t])}function xn(e,t){return Sn(e,t)}function Sn(e,t,n){N(pn(),`useRoutes() may be used only in the context of a <Router> component.`);let{navigator:r}=M.useContext(nn),{matches:i}=M.useContext(an),a=i[i.length-1],o=a?a.params:{},s=a?a.pathname:`/`,c=a?a.pathnameBase:`/`,l=a&&a.route;{let e=l&&l.path||``;Vn(s,!l||e.endsWith(`*`)||e.endsWith(`*?`),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${s}" (under <Route path="${e}">) 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.
|
|
2
|
+
|
|
3
|
+
Please change the parent <Route path="${e}"> to <Route path="${e===`/`?`*`:`${e}/*`}">.`)}let u=mn(),d;if(t){let e=typeof t==`string`?ct(t):t;N(c===`/`||e.pathname?.startsWith(c),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${c}" but pathname "${e.pathname}" was given in the \`location\` prop.`),d=e}else d=u;let f=d.pathname||`/`,p=f;if(c!==`/`){let e=c.replace(/^\//,``).split(`/`);p=`/`+f.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let m=dt(e,{pathname:p});rt(l||m!=null,`No routes matched location "${d.pathname}${d.search}${d.hash}" `),rt(m==null||m[m.length-1].route.element!==void 0||m[m.length-1].route.Component!==void 0||m[m.length-1].route.lazy!==void 0,`Matched leaf route at location "${d.pathname}${d.search}${d.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.`);let h=kn(m&&m.map(e=>Object.assign({},e,{params:Object.assign({},o,e.params),pathname:Rt([c,r.encodeLocation?r.encodeLocation(e.pathname.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?c:Rt([c,r.encodeLocation?r.encodeLocation(e.pathnameBase.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),i,n);return t&&h?M.createElement(rn.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,unstable_mask:void 0,...d},navigationType:`POP`}},h):h}function Cn(){let e=Rn(),t=Ut(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 wn=M.createElement(Cn,null),Tn=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?t.error:e.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`){let t=dn(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:M.createElement(an.Provider,{value:this.props.routeContext},M.createElement(on.Provider,{value:e,children:this.props.component}));return this.context?M.createElement(Dn,{error:e},t):t}};Tn.contextType=Zt;var En=new WeakMap;function Dn({children:e,error:t}){let{basename:n}=M.useContext(nn);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=un(t.digest);if(e){let r=En.get(t);if(r)throw r;let i=Kt(e.location,n);if(Gt&&!En.get(t))if(i.isExternal||e.reloadDocument)window.location.href=i.absoluteURL||i.to;else{let n=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:e.replace}));throw En.set(t,n),n}return M.createElement(`meta`,{httpEquiv:`refresh`,content:`0;url=${i.absoluteURL||i.to}`})}}return e}function On({routeContext:e,match:t,children:n}){let r=M.useContext(Yt);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),M.createElement(an.Provider,{value:e},n)}function kn(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 e=i.findIndex(e=>e.route.id&&a?.[e.route.id]!==void 0);N(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(a).join(`,`)}`),i=i.slice(0,Math.min(i.length,e+1))}let o=!1,s=-1;if(n&&r){o=r.renderFallback;for(let e=0;e<i.length;e++){let t=i[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(s=e),t.route.id){let{loaderData:e,errors:a}=r,c=t.route.loader&&!e.hasOwnProperty(t.route.id)&&(!a||a[t.route.id]===void 0);if(t.route.lazy||c){n.isStatic&&(o=!0),i=s>=0?i.slice(0,s+1):[i[0]];break}}}}let c=n?.onError,l=r&&c?(e,t)=>{c(e,{location:r.location,params:r.matches?.[0]?.params??{},unstable_pattern:Wt(r.matches),errorInfo:t})}:void 0;return i.reduceRight((e,n,c)=>{let u,d=!1,f=null,p=null;r&&(u=a&&n.route.id?a[n.route.id]:void 0,f=n.route.errorElement||wn,o&&(s<0&&c===0?(Vn(`route-fallback`,!1,"No `HydrateFallback` element provided to render during initial hydration"),d=!0,p=null):s===c&&(d=!0,p=n.route.hydrateFallbackElement||null)));let m=t.concat(i.slice(0,c+1)),h=()=>{let t;return t=u?f:d?p:n.route.Component?M.createElement(n.route.Component,null):n.route.element?n.route.element:e,M.createElement(On,{match:n,routeContext:{outlet:e,matches:m,isDataRoute:r!=null},children:t})};return r&&(n.route.ErrorBoundary||n.route.errorElement||c===0)?M.createElement(Tn,{location:r.location,revalidation:r.revalidation,component:f,error:u,children:h(),routeContext:{outlet:null,matches:m,isDataRoute:!0},onError:l}):h()},null)}function An(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function jn(e){let t=M.useContext(Yt);return N(t,An(e)),t}function Mn(e){let t=M.useContext(Xt);return N(t,An(e)),t}function Nn(e){let t=M.useContext(an);return N(t,An(e)),t}function Pn(e){let t=Nn(e),n=t.matches[t.matches.length-1];return N(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function Fn(){return Pn(`useRouteId`)}function In(){return Mn(`useNavigation`).navigation}function Ln(){let{matches:e,loaderData:t}=Mn(`useMatches`);return M.useMemo(()=>e.map(e=>pt(e,t)),[e,t])}function Rn(){let e=M.useContext(on),t=Mn(`useRouteError`),n=Pn(`useRouteError`);return e===void 0?t.errors?.[n]:e}function zn(){let{router:e}=jn(`useNavigate`),t=Pn(`useNavigate`),n=M.useRef(!1);return gn(()=>{n.current=!0}),M.useCallback(async(r,i={})=>{rt(n.current,hn),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var Bn={};function Vn(e,t,n){!t&&!Bn[e]&&(Bn[e]=!0,rt(!1,n))}M.memo(Hn);function Hn({routes:e,future:t,state:n,isStatic:r,onError:i}){return Sn(e,void 0,{state:n,isStatic:r,onError:i,future:t})}function Un({basename:e,children:t,initialEntries:n,initialIndex:r,unstable_useTransitions:i}){let a=M.useRef();a.current??=tt({initialEntries:n,initialIndex:r,v5Compat:!0});let o=a.current,[s,c]=M.useState({action:o.action,location:o.location}),l=M.useCallback(e=>{i===!1?c(e):M.startTransition(()=>c(e))},[i]);return M.useLayoutEffect(()=>o.listen(l),[o,l]),M.createElement(Gn,{basename:e,children:t,location:s.location,navigationType:s.action,navigator:o,unstable_useTransitions:i})}function Wn(e){N(!1,`A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.`)}function Gn({basename:e=`/`,children:t=null,location:n,navigationType:r=`POP`,navigator:i,static:a=!1,unstable_useTransitions:o}){N(!pn(),`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`);let s=e.replace(/^\/*/,`/`),c=M.useMemo(()=>({basename:s,navigator:i,static:a,unstable_useTransitions:o,future:{}}),[s,i,a,o]);typeof n==`string`&&(n=ct(n));let{pathname:l=`/`,search:u=``,hash:d=``,state:f=null,key:p=`default`,unstable_mask:m}=n,h=M.useMemo(()=>{let e=At(l,s);return e==null?null:{location:{pathname:e,search:u,hash:d,state:f,key:p,unstable_mask:m},navigationType:r}},[s,l,u,d,f,p,r,m]);return rt(h!=null,`<Router basename="${s}"> is not able to match the URL "${l}${u}${d}" because it does not start with the basename, so the <Router> won't render anything.`),h==null?null:M.createElement(nn.Provider,{value:c},M.createElement(rn.Provider,{children:t,value:h}))}function Kn({children:e,location:t}){return xn(qn(e),t)}M.Component;function qn(e,t=[]){let n=[];return M.Children.forEach(e,(e,r)=>{if(!M.isValidElement(e))return;let i=[...t,r];if(e.type===M.Fragment){n.push.apply(n,qn(e.props.children,i));return}N(e.type===Wn,`[${typeof e.type==`string`?e.type:e.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),N(!e.props.index||!e.props.children,`An index route cannot have child routes.`);let a={id:e.props.id||i.join(`-`),caseSensitive:e.props.caseSensitive,element:e.props.element,Component:e.props.Component,index:e.props.index,path:e.props.path,middleware:e.props.middleware,loader:e.props.loader,action:e.props.action,hydrateFallbackElement:e.props.hydrateFallbackElement,HydrateFallback:e.props.HydrateFallback,errorElement:e.props.errorElement,ErrorBoundary:e.props.ErrorBoundary,hasErrorBoundary:e.props.hasErrorBoundary===!0||e.props.ErrorBoundary!=null||e.props.errorElement!=null,shouldRevalidate:e.props.shouldRevalidate,handle:e.props.handle,lazy:e.props.lazy};e.props.children&&(a.children=qn(e.props.children,i)),n.push(a)}),n}var Jn=`get`,Yn=`application/x-www-form-urlencoded`;function Xn(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function Zn(e){return Xn(e)&&e.tagName.toLowerCase()===`button`}function Qn(e){return Xn(e)&&e.tagName.toLowerCase()===`form`}function $n(e){return Xn(e)&&e.tagName.toLowerCase()===`input`}function er(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function tr(e,t){return e.button===0&&(!t||t===`_self`)&&!er(e)}var nr=null;function rr(){if(nr===null)try{new FormData(document.createElement(`form`),0),nr=!1}catch{nr=!0}return nr}var ir=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function ar(e){return e!=null&&!ir.has(e)?(rt(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Yn}"`),null):e}function or(e,t){let n,r,i,a,o;if(Qn(e)){let o=e.getAttribute(`action`);r=o?At(o,t):null,n=e.getAttribute(`method`)||Jn,i=ar(e.getAttribute(`enctype`))||Yn,a=new FormData(e)}else if(Zn(e)||$n(e)&&(e.type===`submit`||e.type===`image`)){let o=e.form;if(o==null)throw Error(`Cannot submit a <button> or <input type="submit"> without a <form>`);let s=e.getAttribute(`formaction`)||o.getAttribute(`action`);if(r=s?At(s,t):null,n=e.getAttribute(`formmethod`)||o.getAttribute(`method`)||Jn,i=ar(e.getAttribute(`formenctype`))||ar(o.getAttribute(`enctype`))||Yn,a=new FormData(o,e),!rr()){let{name:t,type:n,value:r}=e;if(n===`image`){let e=t?`${t}.`:``;a.append(`${e}x`,`0`),a.append(`${e}y`,`0`)}else t&&a.append(t,r)}}else if(Xn(e))throw Error(`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`);else n=Jn,r=null,i=Yn,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`);var sr={"&":`\\u0026`,">":`\\u003e`,"<":`\\u003c`,"\u2028":`\\u2028`,"\u2029":`\\u2029`},cr=/[&><\u2028\u2029]/g;function lr(e){return e.replace(cr,e=>sr[e])}function ur(e,t){if(e===!1||e==null)throw Error(t)}function dr(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&&At(i.pathname,t)===`/`?i.pathname=`${t.replace(/\/$/,``)}/_root.${r}`:i.pathname=`${i.pathname.replace(/\/$/,``)}.${r}`,i}async function fr(e,t){if(e.id in t)return t[e.id];try{let n=await Qe(()=>import(e.module),[]);return t[e.id]=n,n}catch(t){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(t),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function pr(e){return e!=null&&typeof e.page==`string`}function mr(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 hr(e,t,n){return br((await Promise.all(e.map(async e=>{let r=t.routes[e.route.id];if(r){let e=await fr(r,n);return e.links?e.links():[]}return[]}))).flat(1).filter(mr).filter(e=>e.rel===`stylesheet`||e.rel===`preload`).map(e=>e.rel===`stylesheet`?{...e,rel:`prefetch`,as:`style`}:{...e,rel:`prefetch`}))}function gr(e,t,n,r,i,a){let o=(e,t)=>n[t]?e.route.id!==n[t].route.id:!0,s=(e,t)=>n[t].pathname!==e.pathname||n[t].route.path?.endsWith(`*`)&&n[t].params[`*`]!==e.params[`*`];return a===`assets`?t.filter((e,t)=>o(e,t)||s(e,t)):a===`data`?t.filter((t,a)=>{let c=r.routes[t.route.id];if(!c||!c.hasLoader)return!1;if(o(t,a)||s(t,a))return!0;if(t.route.shouldRevalidate){let r=t.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:t.params,defaultShouldRevalidate:!0});if(typeof r==`boolean`)return r}return!0}):[]}function _r(e,t,{includeHydrateFallback:n}={}){return vr(e.map(e=>{let r=t.routes[e.route.id];if(!r)return[];let i=[r.module];return r.clientActionModule&&(i=i.concat(r.clientActionModule)),r.clientLoaderModule&&(i=i.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(i=i.concat(r.hydrateFallbackModule)),r.imports&&(i=i.concat(r.imports)),i}).flat(1))}function vr(e){return[...new Set(e)]}function yr(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function br(e,t){let n=new Set,r=new Set(t);return e.reduce((e,i)=>{if(t&&!pr(i)&&i.as===`script`&&i.href&&r.has(i.href))return e;let a=JSON.stringify(yr(i));return n.has(a)||(n.add(a),e.push({key:a,link:i})),e},[])}function xr(){let e=M.useContext(Yt);return ur(e,`You must render this element inside a <DataRouterContext.Provider> element`),e}function Sr(){let e=M.useContext(Xt);return ur(e,`You must render this element inside a <DataRouterStateContext.Provider> element`),e}var Cr=M.createContext(void 0);Cr.displayName=`FrameworkContext`;function wr(){let e=M.useContext(Cr);return ur(e,`You must render this element inside a <HydratedRouter> element`),e}function Tr(e,t){let n=M.useContext(Cr),[r,i]=M.useState(!1),[a,o]=M.useState(!1),{onFocus:s,onBlur:c,onMouseEnter:l,onMouseLeave:u,onTouchStart:d}=t,f=M.useRef(null);M.useEffect(()=>{if(e===`render`&&o(!0),e===`viewport`){let e=new IntersectionObserver(e=>{e.forEach(e=>{o(e.isIntersecting)})},{threshold:.5});return f.current&&e.observe(f.current),()=>{e.disconnect()}}},[e]),M.useEffect(()=>{if(r){let e=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(e)}}},[r]);let p=()=>{i(!0)},m=()=>{i(!1),o(!1)};return n?e===`intent`?[a,f,{onFocus:Er(s,p),onBlur:Er(c,m),onMouseEnter:Er(l,p),onMouseLeave:Er(u,m),onTouchStart:Er(d,p)}]:[a,f,{}]:[!1,f,{}]}function Er(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function Dr({page:e,...t}){let n=Qt(),{router:r}=xr(),i=M.useMemo(()=>dt(r.routes,e,r.basename),[r.routes,e,r.basename]);return i?n?M.createElement(kr,{page:e,matches:i,...t}):M.createElement(Ar,{page:e,matches:i,...t}):null}function Or(e){let{manifest:t,routeModules:n}=wr(),[r,i]=M.useState([]);return M.useEffect(()=>{let r=!1;return hr(e,t,n).then(e=>{r||i(e)}),()=>{r=!0}},[e,t,n]),r}function kr({page:e,matches:t,...n}){let r=mn(),{future:i}=wr(),{basename:a}=xr(),o=M.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=dr(e,a,i.unstable_trailingSlashAwareDataRequests,`rsc`),o=!1,s=[];for(let e of t)typeof e.route.shouldRevalidate==`function`?o=!0:s.push(e.route.id);return o&&s.length>0&&n.searchParams.set(`_routes`,s.join(`,`)),[n.pathname+n.search]},[a,i.unstable_trailingSlashAwareDataRequests,e,r,t]);return M.createElement(M.Fragment,null,o.map(e=>M.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})))}function Ar({page:e,matches:t,...n}){let r=mn(),{future:i,manifest:a,routeModules:o}=wr(),{basename:s}=xr(),{loaderData:c,matches:l}=Sr(),u=M.useMemo(()=>gr(e,t,l,a,r,`data`),[e,t,l,a,r]),d=M.useMemo(()=>gr(e,t,l,a,r,`assets`),[e,t,l,a,r]),f=M.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=new Set,l=!1;if(t.forEach(e=>{let t=a.routes[e.route.id];!t||!t.hasLoader||(!u.some(t=>t.route.id===e.route.id)&&e.route.id in c&&o[e.route.id]?.shouldRevalidate||t.hasClientLoader?l=!0:n.add(e.route.id))}),n.size===0)return[];let d=dr(e,s,i.unstable_trailingSlashAwareDataRequests,`data`);return l&&n.size>0&&d.searchParams.set(`_routes`,t.filter(e=>n.has(e.route.id)).map(e=>e.route.id).join(`,`)),[d.pathname+d.search]},[s,i.unstable_trailingSlashAwareDataRequests,c,r,a,u,t,e,o]),p=M.useMemo(()=>_r(d,a),[d,a]),m=Or(d);return M.createElement(M.Fragment,null,f.map(e=>M.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})),p.map(e=>M.createElement(`link`,{key:e,rel:`modulepreload`,href:e,...n})),m.map(({key:e,link:t})=>M.createElement(`link`,{key:e,nonce:n.nonce,...t,crossOrigin:t.crossOrigin??n.crossOrigin})))}function jr(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}M.Component;var Mr=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;try{Mr&&(window.__reactRouterVersion=`7.14.0`)}catch{}function Nr({basename:e,children:t,unstable_useTransitions:n,window:r}){let i=M.useRef();i.current??=nt({window:r,v5Compat:!0});let a=i.current,[o,s]=M.useState({action:a.action,location:a.location}),c=M.useCallback(e=>{n===!1?s(e):M.startTransition(()=>s(e))},[n]);return M.useLayoutEffect(()=>a.listen(c),[a,c]),M.createElement(Gn,{basename:e,children:t,location:o.location,navigationType:o.action,navigator:a,unstable_useTransitions:n})}function Pr({basename:e,children:t,history:n,unstable_useTransitions:r}){let[i,a]=M.useState({action:n.action,location:n.location}),o=M.useCallback(e=>{r===!1?a(e):M.startTransition(()=>a(e))},[r]);return M.useLayoutEffect(()=>n.listen(o),[n,o]),M.createElement(Gn,{basename:e,children:t,location:i.location,navigationType:i.action,navigator:n,unstable_useTransitions:r})}Pr.displayName=`unstable_HistoryRouter`;var Fr=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Ir=M.forwardRef(function({onClick:e,discover:t=`render`,prefetch:n=`none`,relative:r,reloadDocument:i,replace:a,unstable_mask:o,state:s,target:c,to:l,preventScrollReset:u,viewTransition:d,unstable_defaultShouldRevalidate:f,...p},m){let{basename:h,navigator:g,unstable_useTransitions:_}=M.useContext(nn),v=typeof l==`string`&&Fr.test(l),y=Kt(l,h);l=y.to;let b=fn(l,{relative:r}),x=mn(),S=null;if(o){let e=Lt(o,[],x.unstable_mask?x.unstable_mask.pathname:`/`,!0);h!==`/`&&(e.pathname=e.pathname===`/`?h:Rt([h,e.pathname])),S=g.createHref(e)}let[C,w,T]=Tr(n,p),E=Ur(l,{replace:a,unstable_mask:o,state:s,target:c,preventScrollReset:u,relative:r,viewTransition:d,unstable_defaultShouldRevalidate:f,unstable_useTransitions:_});function ee(t){e&&e(t),t.defaultPrevented||E(t)}let te=!(y.isExternal||i),ne=M.createElement(`a`,{...p,...T,href:(te?S:void 0)||y.absoluteURL||b,onClick:te?ee:e,ref:jr(m,w),target:c,"data-discover":!v&&t===`render`?`true`:void 0});return C&&!v?M.createElement(M.Fragment,null,ne,M.createElement(Dr,{page:b})):ne});Ir.displayName=`Link`;var Lr=M.forwardRef(function({"aria-current":e=`page`,caseSensitive:t=!1,className:n=``,end:r=!1,style:i,to:a,viewTransition:o,children:s,...c},l){let u=bn(a,{relative:c.relative}),d=mn(),f=M.useContext(Xt),{navigator:p,basename:m}=M.useContext(nn),h=f!=null&&$r(u)&&o===!0,g=p.encodeLocation?p.encodeLocation(u).pathname:u.pathname,_=d.pathname,v=f&&f.navigation&&f.navigation.location?f.navigation.location.pathname:null;t||(_=_.toLowerCase(),v=v?v.toLowerCase():null,g=g.toLowerCase()),v&&m&&(v=At(v,m)||v);let y=g!==`/`&&g.endsWith(`/`)?g.length-1:g.length,b=_===g||!r&&_.startsWith(g)&&_.charAt(y)===`/`,x=v!=null&&(v===g||!r&&v.startsWith(g)&&v.charAt(g.length)===`/`),S={isActive:b,isPending:x,isTransitioning:h},C=b?e:void 0,w;w=typeof n==`function`?n(S):[n,b?`active`:null,x?`pending`:null,h?`transitioning`:null].filter(Boolean).join(` `);let T=typeof i==`function`?i(S):i;return M.createElement(Ir,{...c,"aria-current":C,className:w,ref:l,style:T,to:a,viewTransition:o},typeof s==`function`?s(S):s)});Lr.displayName=`NavLink`;var Rr=M.forwardRef(({discover:e=`render`,fetcherKey:t,navigate:n,reloadDocument:r,replace:i,state:a,method:o=Jn,action:s,onSubmit:c,relative:l,preventScrollReset:u,viewTransition:d,unstable_defaultShouldRevalidate:f,...p},m)=>{let{unstable_useTransitions:h}=M.useContext(nn),g=Kr(),_=qr(s,{relative:l}),v=o.toLowerCase()===`get`?`get`:`post`,y=typeof s==`string`&&Fr.test(s);return M.createElement(`form`,{ref:m,method:v,action:_,onSubmit:r?c:e=>{if(c&&c(e),e.defaultPrevented)return;e.preventDefault();let r=e.nativeEvent.submitter,s=r?.getAttribute(`formmethod`)||o,p=()=>g(r||e.currentTarget,{fetcherKey:t,method:s,navigate:n,replace:i,state:a,relative:l,preventScrollReset:u,viewTransition:d,unstable_defaultShouldRevalidate:f});h&&n!==!1?M.startTransition(()=>p()):p()},...p,"data-discover":!y&&e===`render`?`true`:void 0})});Rr.displayName=`Form`;function zr({getKey:e,storageKey:t,...n}){let r=M.useContext(Cr),{basename:i}=M.useContext(nn),a=mn(),o=Ln();Zr({getKey:e,storageKey:t});let s=M.useMemo(()=>{if(!r||!e)return null;let t=Xr(a,o,i,e);return t===a.key?null:t},[]);if(!r||r.isSpaMode)return null;let c=((e,t)=>{if(!window.history.state||!window.history.state.key){let e=Math.random().toString(32).slice(2);window.history.replaceState({key:e},``)}try{let n=JSON.parse(sessionStorage.getItem(e)||`{}`)[t||window.history.state.key];typeof n==`number`&&window.scrollTo(0,n)}catch(t){console.error(t),sessionStorage.removeItem(e)}}).toString();return M.createElement(`script`,{...n,suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:`(${c})(${lr(JSON.stringify(t||Jr))}, ${lr(JSON.stringify(s))})`}})}zr.displayName=`ScrollRestoration`;function Br(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Vr(e){let t=M.useContext(Yt);return N(t,Br(e)),t}function Hr(e){let t=M.useContext(Xt);return N(t,Br(e)),t}function Ur(e,{target:t,replace:n,unstable_mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,unstable_defaultShouldRevalidate:c,unstable_useTransitions:l}={}){let u=_n(),d=mn(),f=bn(e,{relative:o});return M.useCallback(p=>{if(tr(p,t)){p.preventDefault();let t=n===void 0?st(d)===st(f):n,m=()=>u(e,{replace:t,unstable_mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,unstable_defaultShouldRevalidate:c});l?M.startTransition(()=>m()):m()}},[d,u,f,n,r,i,t,e,a,o,s,c,l])}var Wr=0,Gr=()=>`__${String(++Wr)}__`;function Kr(){let{router:e}=Vr(`useSubmit`),{basename:t}=M.useContext(nn),n=Fn(),r=e.fetch,i=e.navigate;return M.useCallback(async(e,a={})=>{let{action:o,method:s,encType:c,formData:l,body:u}=or(e,t);a.navigate===!1?await r(a.fetcherKey||Gr(),n,a.action||o,{unstable_defaultShouldRevalidate:a.unstable_defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,flushSync:a.flushSync}):await i(a.action||o,{unstable_defaultShouldRevalidate:a.unstable_defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,replace:a.replace,state:a.state,fromRouteId:n,flushSync:a.flushSync,viewTransition:a.viewTransition})},[r,i,t,n])}function qr(e,{relative:t}={}){let{basename:n}=M.useContext(nn),r=M.useContext(an);N(r,`useFormAction must be used inside a RouteContext`);let[i]=r.matches.slice(-1),a={...bn(e||`.`,{relative:t})},o=mn();if(e==null){a.search=o.search;let e=new URLSearchParams(a.search),t=e.getAll(`index`);if(t.some(e=>e===``)){e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();a.search=n?`?${n}`:``}}return(!e||e===`.`)&&i.route.index&&(a.search=a.search?a.search.replace(/^\?/,`?index&`):`?index`),n!==`/`&&(a.pathname=a.pathname===`/`?n:Rt([n,a.pathname])),st(a)}var Jr=`react-router-scroll-positions`,Yr={};function Xr(e,t,n,r){let i=null;return r&&(i=r(n===`/`?e:{...e,pathname:At(e.pathname,n)||e.pathname},t)),i??=e.key,i}function Zr({getKey:e,storageKey:t}={}){let{router:n}=Vr(`useScrollRestoration`),{restoreScrollPosition:r,preventScrollReset:i}=Hr(`useScrollRestoration`),{basename:a}=M.useContext(nn),o=mn(),s=Ln(),c=In();M.useEffect(()=>(window.history.scrollRestoration=`manual`,()=>{window.history.scrollRestoration=`auto`}),[]),Qr(M.useCallback(()=>{if(c.state===`idle`){let t=Xr(o,s,a,e);Yr[t]=window.scrollY}try{sessionStorage.setItem(t||Jr,JSON.stringify(Yr))}catch(e){rt(!1,`Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (${e}).`)}window.history.scrollRestoration=`auto`},[c.state,e,a,o,s,t])),typeof document<`u`&&(M.useLayoutEffect(()=>{try{let e=sessionStorage.getItem(t||Jr);e&&(Yr=JSON.parse(e))}catch{}},[t]),M.useLayoutEffect(()=>{let t=n?.enableScrollRestoration(Yr,()=>window.scrollY,e?(t,n)=>Xr(t,n,a,e):void 0);return()=>t&&t()},[n,a,e]),M.useLayoutEffect(()=>{if(r!==!1){if(typeof r==`number`){window.scrollTo(0,r);return}try{if(o.hash){let e=document.getElementById(decodeURIComponent(o.hash.slice(1)));if(e){e.scrollIntoView();return}}}catch{rt(!1,`"${o.hash.slice(1)}" is not a decodable element ID. The view will not scroll to it.`)}i!==!0&&window.scrollTo(0,0)}},[o,r,i]))}function Qr(e,t){let{capture:n}=t||{};M.useEffect(()=>{let t=n==null?void 0:{capture:n};return window.addEventListener(`pagehide`,e,t),()=>{window.removeEventListener(`pagehide`,e,t)}},[e,n])}function $r(e,{relative:t}={}){let n=M.useContext($t);N(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=Vr(`useViewTransitionState`),i=bn(e,{relative:t});if(!n.isTransitioning)return!1;let a=At(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=At(n.nextLocation.pathname,r)||n.nextLocation.pathname;return Dt(i.pathname,o)!=null||Dt(i.pathname,a)!=null}var ei=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},ti=new class extends ei{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},ni={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},ri=new class{#e=ni;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function ii(e){setTimeout(e,0)}var ai=typeof window>`u`||`Deno`in globalThis;function oi(){}function si(e,t){return typeof e==`function`?e(t):e}function ci(e){return typeof e==`number`&&e>=0&&e!==1/0}function li(e,t){return Math.max(e+(t||0)-Date.now(),0)}function ui(e,t){return typeof e==`function`?e(t):e}function di(e,t){return typeof e==`function`?e(t):e}function fi(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==mi(o,t.options))return!1}else if(!gi(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function pi(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(hi(t.options.mutationKey)!==hi(a))return!1}else if(!gi(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function mi(e,t){return(t?.queryKeyHashFn||hi)(e)}function hi(e){return JSON.stringify(e,(e,t)=>xi(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function gi(e,t){return e===t?!0:typeof e==typeof t&&e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(t).every(n=>gi(e[n],t[n])):!1}var _i=Object.prototype.hasOwnProperty;function vi(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=bi(e)&&bi(t);if(!r&&!(xi(e)&&xi(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:_i.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=vi(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function yi(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function bi(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function xi(e){if(!Si(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!Si(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function Si(e){return Object.prototype.toString.call(e)===`[object Object]`}function Ci(e){return new Promise(t=>{ri.setTimeout(t,e)})}function wi(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:vi(e,t)}function Ti(e){return e}function Ei(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function Di(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Oi=Symbol();function ki(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===Oi?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Ai(e,t){return typeof e==`function`?e(...t):!!e}function ji(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var Mi=(()=>{let e=()=>ai;return{isServer(){return e()},setIsServer(t){e=t}}})();function Ni(){let e,t,n=new Promise((n,r)=>{e=n,t=r});n.status=`pending`,n.catch(()=>{});function r(e){Object.assign(n,e),delete n.resolve,delete n.reject}return n.resolve=t=>{r({status:`fulfilled`,value:t}),e(t)},n.reject=e=>{r({status:`rejected`,reason:e}),t(e)},n}var Pi=ii;function Fi(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=Pi,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var Ii=Fi(),Li=new class extends ei{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function Ri(e){return Math.min(1e3*2**e,3e4)}function zi(e){return(e??`online`)===`online`?Li.isOnline():!0}var Bi=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function Vi(e){let t=!1,n=0,r,i=Ni(),a=()=>i.status!==`pending`,o=t=>{if(!a()){let n=new Bi(t);f(n),e.onCancel?.(n)}},s=()=>{t=!0},c=()=>{t=!1},l=()=>ti.isFocused()&&(e.networkMode===`always`||Li.isOnline())&&e.canRun(),u=()=>zi(e.networkMode)&&e.canRun(),d=e=>{a()||(r?.(),i.resolve(e))},f=e=>{a()||(r?.(),i.reject(e))},p=()=>new Promise(t=>{r=e=>{(a()||l())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,a()||e.onContinue?.()}),m=()=>{if(a())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(d).catch(r=>{if(a())return;let i=e.retry??(Mi.isServer()?0:3),o=e.retryDelay??Ri,s=typeof o==`function`?o(n,r):o,c=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!c){f(r);return}n++,e.onFail?.(n,r),Ci(s).then(()=>l()?void 0:p()).then(()=>{t?f(r):m()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(r?.(),i),cancelRetry:s,continueRetry:c,canStart:u,start:()=>(u()?m():p().then(m),i)}}var Hi=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),ci(this.gcTime)&&(this.#e=ri.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Mi.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&(ri.clearTimeout(this.#e),this.#e=void 0)}};function Ui(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{ji(e,()=>t.signal,()=>n=!0)},u=ki(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=await u((()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})()),{maxPages:o}=t.options,s=i?Di:Ei;return{pages:s(e.pages,a,o),pageParams:s(e.pageParams,r,o)}};if(i&&a.length){let e=i===`backward`,t=e?Gi:Wi,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:Wi(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.options.persister?t.fetchFn=()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=l}}}function Wi(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function Gi(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function Ki(e,t){return t?Wi(e,t)!=null:!1}function qi(e,t){return!t||!e.getPreviousPageParam?!1:Gi(e,t)!=null}var Ji=class extends Hi{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=Zi(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=Zi(this.options);e.data!==void 0&&(this.setState(Xi(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=wi(this.state.data,e,this.options);return this.#l({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#l({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(oi).catch(oi):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>di(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Oi||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>ui(e.options.staleTime,this)===`static`):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!li(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#a&&(this.#s||this.#c()?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}#c(){return this.state.fetchStatus===`paused`&&this.state.status===`pending`}invalidate(){this.state.isInvalidated||this.#l({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=ki(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?Ui(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#l({type:`fetch`,meta:a.fetchOptions?.meta}),this.#a=Vi({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof Bi&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#l({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#l({type:`pause`})},onContinue:()=>{this.#l({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await this.#a.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof Bi){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#l({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#l(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...Yi(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...Xi(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),Ii.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function Yi(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:zi(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function Xi(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function Zi(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var Qi=class extends ei{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=Ni(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),ea(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return ta(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return ta(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof di(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!yi(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&na(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||di(this.options.enabled,this.#t)!==di(t.enabled,this.#t)||ui(this.options.staleTime,this.#t)!==ui(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||di(this.options.enabled,this.#t)!==di(t.enabled,this.#t)||i!==this.#p)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return ia(this,n)&&(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),n===`promise`&&(this.trackProp(`data`),!this.options.experimental_prefetchInRender&&this.#o.status===`pending`&&this.#o.reject(Error(`experimental_prefetchInRender feature flag is not enabled`))),Reflect.get(e,n))})}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(oi)),t}#g(){this.#b();let e=ui(this.options.staleTime,this.#t);if(Mi.isServer()||this.#r.isStale||!ci(e))return;let t=li(this.#r.dataUpdatedAt,e)+1;this.#d=ri.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#p=e,!(Mi.isServer()||di(this.options.enabled,this.#t)===!1||!ci(this.#p)||this.#p===0)&&(this.#f=ri.setInterval(()=>{(this.options.refetchIntervalInBackground||ti.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d!==void 0&&(ri.clearTimeout(this.#d),this.#d=void 0)}#x(){this.#f!==void 0&&(ri.clearInterval(this.#f),this.#f=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&ea(e,t),o=i&&na(e,n,t,r);(a||o)&&(l={...l,...Yi(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#u?.state.data,this.#u):t.placeholderData,e!==void 0&&(m=`success`,d=wi(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h)if(i&&d===a?.data&&t.select===this.#c)d=this.#l;else try{this.#c=t.select,d=t.select(d),d=wi(i?.data,d,t),this.#l=d,this.#s=null}catch(e){this.#s=e}this.#s&&(f=this.#s,d=this.#l,p=Date.now(),m=`error`);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,b=d!==void 0,x={status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:v,isInitialLoading:y,isLoading:y,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!b,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:v&&b,isStale:ra(e,t),refetch:this.refetch,promise:this.#o,isEnabled:di(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=x.data!==void 0,r=x.status===`error`&&!t,i=e=>{r?e.reject(x.error):t&&e.resolve(x.data)},a=()=>{i(this.#o=x.promise=Ni())},o=this.#o;switch(o.status){case`pending`:e.queryHash===n.queryHash&&i(o);break;case`fulfilled`:(r||x.data!==o.value)&&a();break;case`rejected`:(!r||x.error!==o.reason)&&a();break}}return x}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#u=this.#t),!yi(t,e)&&(this.#r=t,this.#C({listeners:(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#m.size)return!0;let r=new Set(n??this.#m);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})()}))}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#C(e){Ii.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function $i(e,t){return di(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&di(t.retryOnMount,e)===!1)}function ea(e,t){return $i(e,t)||e.state.data!==void 0&&ta(e,t,t.refetchOnMount)}function ta(e,t,n){if(di(t.enabled,e)!==!1&&ui(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&ra(e,t)}return!1}function na(e,t,n,r){return(e!==t||di(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&ra(e,n)}function ra(e,t){return di(t.enabled,e)!==!1&&e.isStaleByTime(ui(t.staleTime,e))}function ia(e,t){return!yi(e.getCurrentResult(),t)}var aa=class extends Qi{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type=`infinite`,super.setOptions(e)}getOptimisticResult(e){return e._type=`infinite`,super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`forward`}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`backward`}}})}createResult(e,t){let{state:n}=e,r=super.createResult(e,t),{isFetching:i,isRefetching:a,isError:o,isRefetchError:s}=r,c=n.fetchMeta?.fetchMore?.direction,l=o&&c===`forward`,u=i&&c===`forward`,d=o&&c===`backward`,f=i&&c===`backward`;return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:Ki(t,n.data),hasPreviousPage:qi(t,n.data),isFetchNextPageError:l,isFetchingNextPage:u,isFetchPreviousPageError:d,isFetchingPreviousPage:f,isRefetchError:s&&!l&&!d,isRefetching:a&&!u&&!f}}},P=ze(),oa=M.createContext(void 0),sa=e=>{let t=M.useContext(oa);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},ca=({client:e,children:t})=>(M.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,P.jsx)(oa.Provider,{value:e,children:t})),la=M.createContext(!1),ua=()=>M.useContext(la);la.Provider;function da(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var fa=M.createContext(da()),pa=()=>M.useContext(fa),ma=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?Ai(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},ha=e=>{M.useEffect(()=>{e.clearReset()},[e])},ga=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||Ai(n,[e.error,r])),_a=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},va=(e,t)=>e.isLoading&&e.isFetching&&!t,ya=(e,t)=>e?.suspense&&t.isPending,ba=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function xa(e,t,n){let r=ua(),i=pa(),a=sa(n),o=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(o);let s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,_a(o),ma(o,i,s),ha(i);let l=!a.getQueryCache().get(o.queryHash),[u]=M.useState(()=>new t(a,o)),d=u.getOptimisticResult(o),f=!r&&c;if(M.useSyncExternalStore(M.useCallback(e=>{let t=f?u.subscribe(Ii.batchCalls(e)):oi;return u.updateResult(),t},[u,f]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),M.useEffect(()=>{u.setOptions(o)},[o,u]),ya(o,d))throw ba(o,u,i);if(ga({result:d,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw d.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(o,d),o.experimental_prefetchInRender&&!Mi.isServer()&&va(d,r)&&(l?ba(o,u,i):s?.promise)?.catch(oi).finally(()=>{u.updateResult()}),o.notifyOnChangeProps?d:u.trackResult(d)}function Sa(e,t){return xa(e,aa,t)}var Ca=e(Le(),1),F=Ie(),I=function(e){return e.SetProjects=`SET_PROJECTS`,e.SetProjectsLoading=`SET_PROJECTS_LOADING`,e.SelectThread=`SELECT_THREAD`,e.SelectProject=`SELECT_PROJECT`,e.SetMessages=`SET_MESSAGES`,e.AddMessage=`ADD_MESSAGE`,e.EnqueueChatMessage=`ENQUEUE_CHAT_MESSAGE`,e.RemoveQueuedChatMessage=`REMOVE_QUEUED_CHAT_MESSAGE`,e.SetStreaming=`SET_STREAMING`,e.AppendStreamContent=`APPEND_STREAM_CONTENT`,e.SetStreamContent=`SET_STREAM_CONTENT`,e.AppendStreamThinking=`APPEND_STREAM_THINKING`,e.AppendStreamChunk=`APPEND_STREAM_CHUNK`,e.SetStreamModel=`SET_STREAM_MODEL`,e.SetStreamAgentMode=`SET_STREAM_AGENT_MODE`,e.SetContextUsage=`SET_CONTEXT_USAGE`,e.SetProjectModel=`SET_PROJECT_MODEL`,e.ResetStream=`RESET_STREAM`,e.StopStream=`STOP_STREAM`,e.ToggleSidebar=`TOGGLE_SIDEBAR`,e.CloseSidebar=`CLOSE_SIDEBAR`,e.OpenProjectPanel=`OPEN_PROJECT_PANEL`,e.CloseProjectPanel=`CLOSE_PROJECT_PANEL`,e.SetCreatingProject=`SET_CREATING_PROJECT`,e.ConfigUpdated=`CONFIG_UPDATED`,e.SetProcessingThreads=`SET_PROCESSING_THREADS`,e.AddProcessingThread=`ADD_PROCESSING_THREAD`,e.RemoveProcessingThread=`REMOVE_PROCESSING_THREAD`,e.AddCreatingProject=`ADD_CREATING_PROJECT`,e.AddCreatingThread=`ADD_CREATING_THREAD`,e.RemoveCreatingProject=`REMOVE_CREATING_PROJECT`,e.RemoveCreatingThread=`REMOVE_CREATING_THREAD`,e.MarkThreadCompleted=`MARK_THREAD_COMPLETED`,e.ClearThreadCompleted=`CLEAR_THREAD_COMPLETED`,e.AddDeletingThread=`ADD_DELETING_THREAD`,e.RemoveDeletingThread=`REMOVE_DELETING_THREAD`,e.AddDeletingProject=`ADD_DELETING_PROJECT`,e.RemoveDeletingProject=`REMOVE_DELETING_PROJECT`,e.AppendCommandOutput=`APPEND_COMMAND_OUTPUT`,e.SetRunningCommand=`SET_RUNNING_COMMAND`,e.ClearCommandOutput=`CLEAR_COMMAND_OUTPUT`,e.ToggleTerminal=`TOGGLE_TERMINAL`,e.SetTerminalOpen=`SET_TERMINAL_OPEN`,e.QueueTerminalCommand=`QUEUE_TERMINAL_COMMAND`,e.ClearQueuedTerminalCommand=`CLEAR_QUEUED_TERMINAL_COMMAND`,e.AppendTerminalLine=`APPEND_TERMINAL_LINE`,e.ClearTerminalOutput=`CLEAR_TERMINAL_OUTPUT`,e.SetTerminalHeight=`SET_TERMINAL_HEIGHT`,e.SetTerminalCwd=`SET_TERMINAL_CWD`,e.SetTerminalRunning=`SET_TERMINAL_RUNNING`,e.SetTerminalHistory=`SET_TERMINAL_HISTORY`,e.SetTerminalHistoryIndex=`SET_TERMINAL_HISTORY_INDEX`,e.UpdateThreadTitle=`UPDATE_THREAD_TITLE`,e.UpdateChatTitle=`UPDATE_CHAT_TITLE`,e.FocusChatInput=`FOCUS_CHAT_INPUT`,e.ClearFocusChatInput=`CLEAR_FOCUS_CHAT_INPUT`,e.ClearMessages=`CLEAR_MESSAGES`,e.UpdateMessage=`UPDATE_MESSAGE`,e.UpdateMessageCheckpointRef=`UPDATE_MESSAGE_CHECKPOINT_REF`,e.SetDevServerToolSession=`SET_DEV_SERVER_TOOL_SESSION`,e.SetThreadToolSession=`SET_THREAD_TOOL_SESSION`,e.ClearThreadToolSession=`CLEAR_THREAD_TOOL_SESSION`,e.SetThreadCreationSummary=`SET_THREAD_CREATION_SUMMARY`,e.ClearThreadCreationSummary=`CLEAR_THREAD_CREATION_SUMMARY`,e.UpdateToolCallProgress=`UPDATE_TOOL_CALL_PROGRESS`,e.UpdateToolExecutionOutput=`UPDATE_TOOL_EXECUTION_OUTPUT`,e.AppendToolExecutionOutput=`APPEND_TOOL_EXECUTION_OUTPUT`,e.AppendSubagentEvent=`APPEND_SUBAGENT_EVENT`,e.ClearToolCallProgress=`CLEAR_TOOL_CALL_PROGRESS`,e.SetPendingChatMessage=`SET_PENDING_CHAT_MESSAGE`,e.ClearPendingChatMessage=`CLEAR_PENDING_CHAT_MESSAGE`,e.IncrementStreamEventCount=`INCREMENT_STREAM_EVENT_COUNT`,e.SetDiffComments=`SET_DIFF_COMMENTS`,e.ClearSelection=`CLEAR_SELECTION`,e.SetChatInputDraft=`SET_CHAT_INPUT_DRAFT`,e.ClearChatInputDraft=`CLEAR_CHAT_INPUT_DRAFT`,e.StartAutoRoute=`START_AUTO_ROUTE`,e.EndAutoRoute=`END_AUTO_ROUTE`,e.AddChatPane=`ADD_CHAT_PANE`,e.RemoveChatPane=`REMOVE_CHAT_PANE`,e.SetFocusedPane=`SET_FOCUSED_PANE`,e.SetPaneMessages=`SET_PANE_MESSAGES`,e.AddPaneMessage=`ADD_PANE_MESSAGE`,e.SetActiveStreamPane=`SET_ACTIVE_STREAM_PANE`,e.HydrateProjectChatPanes=`HYDRATE_PROJECT_CHAT_PANES`,e.AddOpenWidget=`ADD_OPEN_WIDGET`,e.CloseWidget=`CLOSE_WIDGET`,e.SyncOpenWidgetsFromMessages=`SYNC_OPEN_WIDGETS_FROM_MESSAGES`,e}({}),wa=he,Ta={projects:[],projectsLoading:!0,selectedThreadId:null,selectedProjectId:null,messages:[],messagesLoaded:!1,queuedChatMessages:[],isStreaming:!1,streamingContent:``,streamingThinking:``,streamingSegments:[],streamingModel:``,streamingAgentMode:null,streamingEventCount:0,threadStreamingStates:{},threadMultiPaneStates:{},threadWidgetStates:{},projectModelSelections:{},sidebarOpen:!0,projectPanelView:`projects`,projectPanelProjectId:null,isCreatingProject:!1,configUpdatedAt:0,processingThreadIds:[],completedThreadIds:[],deletingThreadIds:[],deletingProjectIds:[],commandOutput:``,isRunningCommand:!1,terminalStates:{},focusChatInput:!1,toolCallProgress:{},subagentTranscripts:{},devServerToolSession:null,threadToolSessions:{},threadCreationSummaries:{},pendingChatMessage:null,diffComments:{},chatInputDrafts:{},pendingAutoRoutes:{},focusedPane:`primary`,extraChatPanes:{},activeStreamPane:null,openWidgets:[],closedWidgetIds:[]},Ea={open:!1,queuedCommand:null,queuedRelativeFolder:null,outputLines:[],height:300,history:[],historyIndex:-1,cwd:`.`,isRunning:!1};function Da(e,t){return`${e}:${t}`}function Oa(e,t,n=wa){return t?e[Da(t,n)]??null:null}function ka(e,t){switch(t.type){case I.StartAutoRoute:{let n=Da(t.route.threadId,t.route.paneId);return{...e,pendingAutoRoutes:{...e.pendingAutoRoutes,[n]:t.route}}}case I.EndAutoRoute:{let n=Da(t.threadId,t.paneId);if(!e.pendingAutoRoutes[n])return e;let{[n]:r,...i}=e.pendingAutoRoutes;return{...e,pendingAutoRoutes:i}}default:return null}}function Aa(e,t){let n=`${t}:`,r=new Set([wa]);for(let t of Object.keys(e))t.startsWith(n)&&r.add(t.slice(n.length));return[...r]}function ja(e,t,n,r){if(t.includes(e))return!0;for(let t of Aa(n,e))if(Ia(n,e,t).isStreaming)return!0;return r?.threadId===e}var Ma={isStreaming:!1,streamingContent:``,streamingThinking:``,streamingSegments:[],streamingModel:``,streamingAgentMode:null,streamingEventCount:0},Na=Ma;function Pa(){return{...Ma,streamingSegments:[]}}function Fa(e,t=wa){return`${e}:${t}`}function Ia(e,t,n=wa){return t?e[Fa(t,n)]??Na:Na}function La(e,t){let n=new Set([wa,...t.sessionPaneIds??[],...Aa(t.streamingStates,e)]);for(let r of n)if(t.hasSession(r)||Ia(t.streamingStates,e,r).isStreaming)return!0;return!1}function Ra(e,t){return t.threadId??e.selectedThreadId}function za(e,t){return t.paneId??e.activeStreamPane??wa}function Ba(e,t,n){return t===e.selectedThreadId?e.activeStreamPane===null?n===wa:e.activeStreamPane===n:!1}function Va(e,t,n,r,i=!1){if(!t)return{...e,...r,toolCallProgress:i?{}:e.toolCallProgress};let a=Fa(t,n),o={...e.threadStreamingStates,[a]:r};return Ba(e,t,n)?{...e,...r,threadStreamingStates:o,toolCallProgress:i?{}:e.toolCallProgress}:{...e,threadStreamingStates:o}}function Ha(){return{open:!1,queuedCommand:null,queuedRelativeFolder:null,outputLines:[],height:300,history:[],historyIndex:-1,cwd:`.`,isRunning:!1}}var Ua={focusedPane:wa,extraChatPanes:{},activeStreamPane:null};function Wa(){return{focusedPane:wa,extraChatPanes:{},activeStreamPane:null}}function Ga(e){return{focusedPane:e.focusedPane,extraChatPanes:e.extraChatPanes,activeStreamPane:e.activeStreamPane}}function Ka(e,t){return t?e[t]??Ua:Ua}function qa(e){let t={};for(let[n,r]of Object.entries(e))t[n]={...r,messages:[...r.messages]};return t}function Ja(e){return{...e,extraChatPanes:qa(e.extraChatPanes)}}function Ya(e,t,n){let r=Ja(n),i=t===null?e.threadMultiPaneStates:{...e.threadMultiPaneStates,[t]:r};return t===e.selectedThreadId?{...e,...r,threadMultiPaneStates:i}:{...e,threadMultiPaneStates:i}}function Xa(e,t,n){let r=e.threadMultiPaneStates;return t&&(r={...r,[t]:Ja(Ga(e))}),{...Ja(Ka(r,n)),threadMultiPaneStates:r}}function Za(e,t){return Ya(e,e.selectedThreadId,{...Ga(e),...t})}function Qa(e,t){let n=e.chatPanesByThread[t];if(!n)return Ja(Ua);let r={};for(let e of n.panes)r[e.paneId]={conversationId:e.conversationId,messages:[],messagesLoaded:!1};return{focusedPane:n.focusedPaneId,extraChatPanes:r,activeStreamPane:null}}function $a(e,t){return t===wa?e.messages:e.extraChatPanes[t]?.messages??[]}function eo(e,t){if(t!==wa)return e.extraChatPanes[t]?.conversationId}function to(e,t){return t===wa?e.messagesLoaded:e.extraChatPanes[t]?.messagesLoaded??!1}function no(e){return Object.keys(e.extraChatPanes)}function ro(e,t){switch(t.type){case I.HydrateProjectChatPanes:{let n=new Set(t.threadIds),r={...e.threadMultiPaneStates};for(let e of t.threadIds)r[e]=Qa(t,e);return!e.selectedThreadId||!n.has(e.selectedThreadId)?{...e,threadMultiPaneStates:r}:{...e,...r[e.selectedThreadId],threadMultiPaneStates:r}}case I.AddChatPane:return t.paneId===wa?e:e.extraChatPanes[t.paneId]?Za(e,{focusedPane:t.paneId}):Za(e,{focusedPane:t.paneId,extraChatPanes:{...e.extraChatPanes,[t.paneId]:{conversationId:t.conversationId,messages:[],messagesLoaded:!0}}});case I.RemoveChatPane:{if(t.paneId===wa||!e.extraChatPanes[t.paneId])return e;let{[t.paneId]:n,...r}=e.extraChatPanes;return Za(e,{extraChatPanes:r,focusedPane:e.focusedPane===t.paneId?wa:e.focusedPane,activeStreamPane:e.activeStreamPane===t.paneId?null:e.activeStreamPane})}case I.SetFocusedPane:return Za(e,{focusedPane:t.paneId});case I.SetPaneMessages:{if(t.paneId===wa)return{...e,messages:t.messages,messagesLoaded:!0};let n=e.extraChatPanes[t.paneId];return n?Za(e,{extraChatPanes:{...e.extraChatPanes,[t.paneId]:{...n,messages:t.messages,messagesLoaded:!0}}}):e}case I.AddPaneMessage:{if(t.paneId===wa)return{...e,messages:[...e.messages,t.message]};let n=e.extraChatPanes[t.paneId];return n?Za(e,{extraChatPanes:{...e.extraChatPanes,[t.paneId]:{...n,messages:[...n.messages,t.message]}}}):e}case I.SetActiveStreamPane:{if(!e.selectedThreadId||t.paneId===null)return Za(e,{activeStreamPane:null});let n=Ia(e.threadStreamingStates,e.selectedThreadId,t.paneId);return{...Za(e,{activeStreamPane:t.paneId}),...n}}default:return null}}function io(e){return e.trim().replace(/\/+$/,``)}function ao(e,t){if(e?.trim())return e.trim();try{let e=new URL(t).hostname;return e.replace(/\.(netlify\.app|vercel\.app|github\.io)$/i,``).split(`.`)[0]??e}catch{return t}}function oo(e,t){return ao(e,t)}var so={openWidgets:[],closedWidgetIds:[]};function co(){return{openWidgets:[],closedWidgetIds:[]}}function lo(e){return{openWidgets:e.openWidgets,closedWidgetIds:e.closedWidgetIds}}function uo(e,t){return t?e[t]??so:so}function fo(e){return{openWidgets:[...e.openWidgets],closedWidgetIds:[...e.closedWidgetIds]}}function po(e,t,n){let r=fo(n),i=t===null?e.threadWidgetStates:{...e.threadWidgetStates,[t]:r};return t===e.selectedThreadId?{...e,...r,threadWidgetStates:i}:{...e,threadWidgetStates:i}}function mo(e,t,n){let r=e.threadWidgetStates;return t&&(r={...r,[t]:fo(lo(e))}),{...fo(uo(r,n)),threadWidgetStates:r}}function ho(e,t){if(e.some(e=>e.id===t.id))return e;let n=io(t.url),r=e.filter(e=>io(e.url)!==n),i=e.find(e=>io(e.url)===n);return i?[...r,{id:t.id,url:t.url,title:t.title??i.title}]:[...e,t]}function go(e,t){return po(e,e.selectedThreadId,{...lo(e),...t})}function _o(e,t){switch(t.type){case I.AddOpenWidget:return go(e,{openWidgets:ho(lo(e).openWidgets,t.widget)});case I.CloseWidget:{let n=lo(e);return n.openWidgets.some(e=>e.id===t.id)?go(e,{openWidgets:n.openWidgets.filter(e=>e.id!==t.id),closedWidgetIds:n.closedWidgetIds.includes(t.id)?n.closedWidgetIds:[...n.closedWidgetIds,t.id]}):e}case I.SyncOpenWidgetsFromMessages:{let n=lo(e),r=new Set(n.closedWidgetIds),i=new Set(n.openWidgets.map(e=>e.id)),a=[...n.openWidgets];for(let e of t.widgets)r.has(e.id)||i.has(e.id)||(a=ho(a,e),i.add(e.id));return a.length===n.openWidgets.length?e:go(e,{openWidgets:a})}default:return null}}function vo(e,t){let n=e.selectedThreadId?e.threadCreationSummaries[e.selectedThreadId]:void 0;return!n||t.some(e=>e.messageId===n.messageId)?t:[n,...t]}function yo(e,t){switch(t.type){case I.SetMessages:return{...e,messages:vo(e,t.messages),messagesLoaded:!0};case I.AddMessage:{let n=t.paneId??wa;if(n!==wa){if(t.threadId&&t.threadId!==e.selectedThreadId)return e;let r=e.extraChatPanes[n];return r?Ya(e,e.selectedThreadId,{...Ga(e),extraChatPanes:{...e.extraChatPanes,[n]:{...r,messages:[...r.messages,t.message]}}}):e}return t.threadId&&t.threadId!==e.selectedThreadId?e:{...e,messages:[...e.messages,t.message]}}case I.EnqueueChatMessage:return{...e,queuedChatMessages:[...e.queuedChatMessages,t.message]};case I.RemoveQueuedChatMessage:return{...e,queuedChatMessages:e.queuedChatMessages.filter(e=>e.id!==t.queuedMessageId)};case I.ClearMessages:return{...e,messages:[]};case I.UpdateMessage:{if(t.threadId!==e.selectedThreadId)return e;let n=e.messages.some(e=>e.messageId===t.messageId)?e.messages.map(e=>e.messageId===t.messageId?{...e,content:t.content}:e):[...e.messages,{messageId:t.messageId,sender:`agent`,content:t.content,contentType:`markdown`,timestamp:new Date().toISOString(),isThinking:!1}];return{...e,messages:n}}case I.UpdateMessageCheckpointRef:{if(t.threadId!==e.selectedThreadId)return e;let n=t.paneId??wa;if(n!==wa){let r=e.extraChatPanes[n];return r?Ya(e,e.selectedThreadId,{...Ga(e),extraChatPanes:{...e.extraChatPanes,[n]:{...r,messages:r.messages.map(e=>e.messageId===t.messageId?{...e,checkpointRef:t.checkpointRef}:e)}}}):e}return{...e,messages:e.messages.map(e=>e.messageId===t.messageId?{...e,checkpointRef:t.checkpointRef}:e)}}case I.SetDevServerToolSession:return{...e,devServerToolSession:t.session};case I.SetThreadToolSession:return{...e,threadToolSessions:{...e.threadToolSessions,[t.session.threadId]:t.session}};case I.ClearThreadToolSession:{if(!e.threadToolSessions[t.threadId])return e;let{[t.threadId]:n,...r}=e.threadToolSessions;return{...e,threadToolSessions:r}}case I.SetThreadCreationSummary:return{...e,threadCreationSummaries:{...e.threadCreationSummaries,[t.threadId]:t.message}};case I.ClearThreadCreationSummary:{if(!e.threadCreationSummaries[t.threadId])return e;let{[t.threadId]:n,...r}=e.threadCreationSummaries;return{...e,threadCreationSummaries:r}}case I.UpdateToolCallProgress:{let n=e.toolCallProgress[t.toolCallId];return{...e,toolCallProgress:{...e.toolCallProgress,[t.toolCallId]:{...n,...t.progress}}}}case I.UpdateToolExecutionOutput:{let n=e.toolCallProgress[t.toolCallId];return{...e,toolCallProgress:{...e.toolCallProgress,[t.toolCallId]:{toolCallId:t.toolCallId,toolName:t.toolName??n?.toolName??``,delta:n?.delta??``,partial:n?.partial??{role:`tool`,content:[]},executionOutput:t.executionOutput}}}}case I.AppendToolExecutionOutput:{let n=e.toolCallProgress[t.toolCallId],r=n?.executionOutput??``;return{...e,toolCallProgress:{...e.toolCallProgress,[t.toolCallId]:{toolCallId:t.toolCallId,toolName:t.toolName??n?.toolName??`agent`,delta:n?.delta??``,partial:n?.partial??{role:`tool`,content:[]},executionOutput:r+t.delta}}}}case I.AppendSubagentEvent:{let n=e.subagentTranscripts[t.toolCallId]??[];return{...e,subagentTranscripts:{...e.subagentTranscripts,[t.toolCallId]:[...n,t.event]}}}case I.ClearToolCallProgress:{if(!t.toolCallId)return{...e,toolCallProgress:{}};let{[t.toolCallId]:n,...r}=e.toolCallProgress;return{...e,toolCallProgress:r}}case I.SetPendingChatMessage:return{...e,pendingChatMessage:t.message};case I.ClearPendingChatMessage:return{...e,pendingChatMessage:null};case I.SetChatInputDraft:return{...e,chatInputDrafts:{...e.chatInputDrafts,[t.threadId]:t.draft}};case I.ClearChatInputDraft:{let{[t.threadId]:n,...r}=e.chatInputDrafts;return{...e,chatInputDrafts:r}}case I.SelectThread:{let n=Xa(e,e.selectedThreadId,t.threadId),r=mo(e,e.selectedThreadId,t.threadId),i=Ia(e.threadStreamingStates,t.threadId,wa);return{...e,...i,...n,...r,selectedThreadId:t.threadId,selectedProjectId:t.projectId,messages:t.initialMessages??[],messagesLoaded:!1,focusChatInput:t.focusInput??!1,subagentTranscripts:{}}}case I.SelectProject:{let n=Xa(e,e.selectedThreadId,``),r=mo(e,e.selectedThreadId,``);return{...e,...Pa(),...n,...r,selectedThreadId:null,selectedProjectId:t.projectId,messages:[],messagesLoaded:!1,focusChatInput:!1,subagentTranscripts:{}}}case I.ClearSelection:return{...e,...Pa(),selectedThreadId:null,selectedProjectId:null,messages:[],messagesLoaded:!1,...Wa(),...co()};default:return null}}var bo=re(`store.project`);function xo(e,t){switch(t.type){case I.SetProjects:{let n={...e.projectModelSelections};for(let e of t.projects)for(let t of e.threads){if(!t.model)continue;let e=n[t.threadId];n[t.threadId]={id:t.model,provider:t.modelProvider,name:e?.name??t.model,description:e?.description??``,context_length:e?.context_length,contextWindow:e?.contextWindow,features:e?.features,input_modalities:e?.input_modalities,max_output:e?.max_output,pricing:e?.pricing,tarsk_use:e?.tarsk_use,coding_index:e?.coding_index,supportsImages:e?.supportsImages}}return{...e,projects:t.projects,projectModelSelections:n}}case I.SetProjectsLoading:return{...e,projectsLoading:t.projectsLoading};case I.SetProjectModel:return bo.debug(`Set project model`,{threadId:t.threadId,model:{id:t.model.id,provider:t.model.provider}}),{...e,projects:e.projects.map(e=>({...e,threads:e.threads.map(e=>e.threadId===t.threadId?{...e,model:t.model.id,modelProvider:t.model.provider}:e)})),projectModelSelections:{...e.projectModelSelections,[t.threadId]:t.model}};case I.SetProcessingThreads:return{...e,processingThreadIds:t.threadIds,completedThreadIds:e.completedThreadIds.filter(e=>!t.threadIds.includes(e))};case I.AddProcessingThread:return{...e,processingThreadIds:e.processingThreadIds.includes(t.threadId)?e.processingThreadIds:[...e.processingThreadIds,t.threadId],completedThreadIds:e.completedThreadIds.filter(e=>e!==t.threadId)};case I.RemoveProcessingThread:return{...e,processingThreadIds:e.processingThreadIds.filter(e=>e!==t.threadId)};case I.AddCreatingProject:return{...e,projects:[...e.projects,{projectId:t.projectId,name:t.projectName,gitUrl:t.gitUrl,threads:[{threadId:t.threadId,title:`thread-1`,path:``,currentBranch:``}]}]};case I.AddCreatingThread:return{...e,projects:e.projects.map(e=>e.projectId===t.projectId?{...e,threads:[...e.threads,{threadId:t.threadId,title:t.title,path:``,currentBranch:``}]}:e)};case I.RemoveCreatingProject:return{...e,projects:e.projects.filter(e=>e.projectId!==t.projectId)};case I.RemoveCreatingThread:return{...e,projects:e.projects.map(e=>e.projectId===t.projectId?{...e,threads:e.threads.filter(e=>e.threadId!==t.threadId)}:e)};case I.MarkThreadCompleted:return{...e,completedThreadIds:e.completedThreadIds.includes(t.threadId)?e.completedThreadIds:[...e.completedThreadIds,t.threadId]};case I.ClearThreadCompleted:return{...e,completedThreadIds:e.completedThreadIds.filter(e=>e!==t.threadId)};case I.AddDeletingThread:return{...e,deletingThreadIds:e.deletingThreadIds.includes(t.threadId)?e.deletingThreadIds:[...e.deletingThreadIds,t.threadId]};case I.RemoveDeletingThread:return{...e,deletingThreadIds:e.deletingThreadIds.filter(e=>e!==t.threadId)};case I.AddDeletingProject:return{...e,deletingProjectIds:e.deletingProjectIds.includes(t.projectId)?e.deletingProjectIds:[...e.deletingProjectIds,t.projectId]};case I.RemoveDeletingProject:return{...e,deletingProjectIds:e.deletingProjectIds.filter(e=>e!==t.projectId)};case I.UpdateThreadTitle:return{...e,projects:e.projects.map(e=>e.projectId===t.projectId?{...e,threads:e.threads.map(e=>e.threadId===t.threadId?{...e,title:t.title}:e)}:e)};case I.UpdateChatTitle:return{...e,projects:e.projects.map(e=>e.projectId===t.projectId?{...e,threads:e.threads.map(e=>e.threadId===t.threadId?{...e,chatTitles:{...e.chatTitles,[t.paneId]:t.title}}:e)}:e)};default:return null}}function So(e){return e.type===`tool_use`}function Co(e){return e.type===`tool-result`}function wo(e){return typeof e==`string`?e.replace(/\\n/g,`
|
|
4
|
+
`).replace(/✅/g,`✓`):``}function To(e){if(!e||typeof e!=`string`)return null;let t=e.trim();if(!t)return null;let n=/\[([A-Za-z]+)\]\s*/g,r,i=0;for(let e of t.matchAll(n))r=e[1],i=e.index+e[0].length;let a=r,o=a?t.slice(i):t;if(a&&o)return[{type:`reasoning`,text:o,label:a}];let s=[],c=0;for(;c<t.length;){let e=t.indexOf(`[`,c);if(e===-1){let e=t.slice(c).trim();e&&s.push({type:`reasoning`,text:e});break}let n=t.slice(c,e).trim();n&&s.push({type:`reasoning`,text:n});let r=0,i=-1;for(let n=e;n<t.length;n++)if(t[n]===`[`)r++;else if(t[n]===`]`&&(r--,r===0)){i=n;break}if(i===-1){let n=t.slice(e).trim();n&&s.push({type:`reasoning`,text:n});break}try{let n=JSON.parse(t.slice(e,i+1));if(Array.isArray(n)){for(let e of n)if(e&&typeof e==`object`&&`type`in e){let t=e.type;(t===`tool-result`||t===`tool_use`)&&s.push(e)}}}catch{let n=t.slice(e,i+1).trim();n&&s.push({type:`reasoning`,text:n})}c=i+1}return s.length>0?s:null}function Eo(e,t){let n=0;for(let r=t;r<e.length;r++){let t=e[r];if(t===`[`)n++;else if(t===`]`&&(n--,n===0))return r}return-1}function Do(e,t=0){let n=[],r=t;for(;r<e.length;){for(;r<e.length&&/\s/.test(e.charAt(r));)r++;if(r>=e.length||e.charAt(r)!==`[`)break;let t=Eo(e,r);if(t===-1)break;try{let i=JSON.parse(e.slice(r,t+1));if(!Array.isArray(i))break;n.push(...ko(i))}catch{break}r=t+1}return n.length===0?null:{blocks:n,nextIndex:r}}function Oo(e,t){let n=[...e];for(let e of t){if(e.type===`tool_use`){let t=n.findIndex(t=>t.type===`tool_use`&&t.id===e.id);t>=0?n[t]=e:n.push(e);continue}if(e.type===`tool-result`){let t=n.findIndex(t=>t.type===`tool-result`&&t.toolCallId===e.toolCallId);t>=0?n[t]=e:n.push(e);continue}n.push(e)}return n}function ko(e){return e.map(e=>{if(typeof e==`object`&&e&&!(`type`in e)){let t=e;if(t.reasoning)return{type:`reasoning`,text:typeof t.reasoning==`string`?t.reasoning:JSON.stringify(t.reasoning)};let n=t.text??t.content??t.answer;if(n)return{type:`text`,text:typeof n==`string`?n:JSON.stringify(n)}}return e})}function Ao(e){let t=[];if(e.type===`long_running_confirmation`&&typeof e.prompt==`object`&&e.prompt!==null&&typeof e.prompt.question==`string`&&Array.isArray(e.prompt.options)){let n=e.prompt;return t.push({type:`long_running_confirmation`,prompt:{toolCallId:typeof n.toolCallId==`string`?n.toolCallId:void 0,question:n.question,options:n.options.filter(e=>typeof e==`string`),context:typeof n.context==`string`?n.context:void 0}}),t}if(e.type===`shell_permission`&&typeof e.shellPermission==`object`&&e.shellPermission!==null&&typeof e.shellPermission.command==`string`){let n=e.shellPermission;return t.push({type:`shell_permission`,prompt:{toolCallId:typeof n.toolCallId==`string`?n.toolCallId:`shell-permission`,command:n.command,source:n.source===`bash`||n.source===`skill_script`||n.source===`browser_js`?n.source:`bash`,wildcardOptions:Array.isArray(n.wildcardOptions)?n.wildcardOptions.filter(e=>typeof e==`object`&&!!e&&typeof e.label==`string`&&typeof e.pattern==`string`&&(e.scope===`session`||e.scope===`project`)):[]}}),t}if(e.type===`web_fetch_permission`&&typeof e.webFetchPermission==`object`&&e.webFetchPermission!==null&&typeof e.webFetchPermission.hostname==`string`){let n=e.webFetchPermission;return t.push({type:`web_fetch_permission`,prompt:{toolCallId:typeof n.toolCallId==`string`?n.toolCallId:`web-fetch-permission`,hostname:n.hostname,url:typeof n.url==`string`?n.url:``,wildcardOptions:Array.isArray(n.wildcardOptions)?n.wildcardOptions.filter(e=>typeof e==`object`&&!!e&&typeof e.label==`string`&&typeof e.pattern==`string`&&(e.scope===`session`||e.scope===`project`)):[]}}),t}e.reasoning&&typeof e.reasoning==`string`&&t.push({type:`reasoning`,text:e.reasoning});let n=(typeof e.text==`string`?e.text:null)??(typeof e.content==`string`?e.content:null)??(typeof e.answer==`string`?e.answer:null);return n&&t.push({type:`text`,text:n}),t.length===0&&Object.keys(e).length>0&&t.push({type:`text`,text:JSON.stringify(e,null,2)}),t}function jo(e){return Mo(e)?.some(e=>e.type===`tool_use`||e.type===`tool-result`)??!1}function Mo(e){if(!e)return null;let t=e.trim();if(t.startsWith(`{`)||t.startsWith(`[`))try{let e=JSON.parse(t);if(Array.isArray(e))return ko(e);if(typeof e==`object`&&e)return Ao(e)}catch{if(t.startsWith(`[`)){let e=Do(t);if(e){let n=t.slice(e.nextIndex).trim();return n?[...e.blocks,{type:`text`,text:n}]:e.blocks}}}let n=[],r=e.indexOf(`{`),i=e.indexOf(`[`),a=r===-1?i:i===-1?r:Math.min(r,i);if(a!==-1){let t=e.slice(0,a).trim();t&&n.push({type:`text`,text:t});let r=e.slice(a),i=Do(r);if(i){n.push(...i.blocks);let e=r.slice(i.nextIndex).trim();return e&&n.push({type:`text`,text:e}),n}let o=Math.max(r.lastIndexOf(`]`),r.lastIndexOf(`}`));if(o!==-1){let e=r.substring(0,o+1);try{let t=JSON.parse(e);Array.isArray(t)?n.push(...ko(t)):n.push(...Ao(t));let i=r.substring(o+1).trim();return i&&n.push({type:`text`,text:i}),n}catch{}}}return n.length>0?n:null}function No(e,t,n){let r=e[e.length-1];return r?.type===t?[...e.slice(0,-1),{type:t,chunks:[...r.chunks,n]}]:[...e,{type:t,chunks:[n]}]}function Po(e,t){return e[e.length-1]?.type===`content`?[...e.slice(0,-1),{type:`content`,chunks:[t]}]:[...e,{type:`content`,chunks:[t]}]}function Fo(e,t){let n=Mo(t);if(!n?.some(e=>e.type===`tool_use`||e.type===`tool-result`))return No(e,`content`,t);let r=e[e.length-1],i=n;if(r?.type===`content`){let e=r.chunks.join(``);i=Oo(Mo(e)??(e.trim()?[{type:`text`,text:e}]:[]),n)}let a=JSON.stringify(i);return r?.type===`content`?[...e.slice(0,-1),{type:`content`,chunks:[a]}]:[...e,{type:`content`,chunks:[a]}]}function Io(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n.type===`content`)return n.chunks.join(``)}return``}function Lo(e,t){return[...e,{type:`long_running_confirmation`,prompt:t}]}function Ro(e,t){return[...e,{type:`shell_permission`,prompt:t}]}function zo(e,t){return[...e,{type:`web_fetch_permission`,prompt:t}]}function Bo(e){let t=[];for(let n of e){if(n.type===`long_running_confirmation`){t.push({type:`long_running_confirmation`,prompt:n.prompt});continue}if(n.type===`shell_permission`){t.push({type:`shell_permission`,prompt:n.prompt});continue}if(n.type===`web_fetch_permission`){t.push({type:`web_fetch_permission`,prompt:n.prompt});continue}let e=n.chunks.join(``);if(n.type===`thinking`){let n=To(e)??[];t.push(...n)}else{let n=Mo(e)??(e.trim()?[{type:`text`,text:e}]:[]);t.push(...n)}}return t}function Vo(e){return e.type===`thinking-group`}function Ho(e,t=!1){let n=[],r=[],i,a=()=>{r.length>0&&(n.push({type:`thinking-group`,text:r.join(`
|
|
5
|
+
|
|
6
|
+
`),label:i,isCurrentlyStreaming:!1}),r=[],i=void 0)};for(let t of e)if(t.type===`reasoning`&&`text`in t){let e=t;r.push(e.text),e.label&&(i=e.label)}else a(),n.push(t);if(a(),t&&n.length>0){let e=n[n.length-1];if(e.type===`thinking-group`){let t=e;t.label!==`Validated`&&(t.isCurrentlyStreaming=!0)}}return n}function Uo(e){return e.type===`tool-call-group`}function Wo(e,t,n){if(!t||n||e.length===0)return!1;let r=e[e.length-1];return Vo(r)?r.label!==`Validated`:!1}var Go=new Set([`todo`,`call_widget_tool`]),Ko=new Set([`todo`,`ask_user`,`open_widget`,`call_widget_tool`]),qo=new Map(we.map((e,t)=>[e.id,t]));function Jo(e){if(Vo(e))return!1;switch(e.type){case`text`:return e.text.trim().length>0;case`shell_permission`:case`web_fetch_permission`:case`long_running_confirmation`:return!0;case`tool_use`:return e.name===`ask_user`;case`tool-result`:return!1}}function Yo(e){return Vo(e)?!1:e.type===`tool_use`?!Go.has(e.name):e.type===`tool-result`?!Ko.has(e.toolName):!1}function Xo(e){let t=[],n=[];function r(){n.some(Yo)?t.push({type:`tool-call-group`,items:n}):t.push(...n),n=[]}for(let i of e)Jo(i)?(n.length>0&&r(),t.push(i)):n.push(i);return n.length>0&&r(),t}function Zo(e){return e.length===0?0:e.split(`
|
|
7
|
+
`).length}function Qo(e){let t=0,n=0;if(Array.isArray(e.replacements)){for(let r of e.replacements)if(r&&typeof r==`object`){let e=r;typeof e.newText==`string`&&(t+=Zo(e.newText)),typeof e.oldText==`string`&&(n+=Zo(e.oldText))}return{added:t,removed:n}}return typeof e.newText==`string`&&(t+=Zo(e.newText)),typeof e.oldText==`string`&&(n+=Zo(e.oldText)),{added:t,removed:n}}function $o(e){let t=new Set;for(let n of e)(n.type===`shell_permission`||n.type===`web_fetch_permission`||n.type===`long_running_confirmation`&&n.prompt.toolCallId)&&t.add(n.prompt.toolCallId);return t}function es(e){let t=typeof e.path==`string`&&e.path?e.path:null;return t?t.split(`/`).pop()??t:null}function ts(e){let t=typeof e.description==`string`?e.description.trim():``;return t?`${t}…`:null}function ns(e,t){let n=e[0];return Ee(n!==void 0&&e.every(e=>e===n)?n:`other`).formatNeutral(t)}function rs(e){return e.charAt(0).toUpperCase()+e.slice(1)}function is(e,t){let n=[],r=new Map;for(let t of e)Vo(t)||(So(t)?n.push(t):Co(t)&&r.set(t.toolCallId,t));let i=new Set(n.map(e=>e.id)),a=$o(t),o=new Map,s=[],c=new Set,l=0,u=0,d=0,f=0,p=null;function m(e){let t=Ne(e.name);o.set(t.id,(o.get(t.id)??0)+1);let n=e.name.toLowerCase();if(n===`edit`||n===`write`){let t=typeof e.input.path==`string`&&e.input.path?e.input.path:e.id;if(c.add(t),n===`edit`){let t=Qo(e.input);u+=t.added,d+=t.removed}else typeof e.input.content==`string`&&(u+=Zo(e.input.content))}}for(let e of n){if(Go.has(e.name))continue;let n=r.has(e.id),i=t.some(t=>Co(t)&&t.toolCallId===e.id&&!Ko.has(t.toolName));n?m(e):i||(l+=1,s.push(Ne(e.name).id),p=e)}for(let e of r.values())if(!Ko.has(e.toolName)&&(e.isError===!0&&(f+=1),!i.has(e.toolCallId))){let n=t.find(t=>So(t)&&t.id===e.toolCallId);n?m(n):o.set(`other`,(o.get(`other`)??0)+1)}let h=[];for(let[e,t]of o)e===`other`||t===0||h.push({id:e,count:e===`files`?c.size:t});h.sort((e,t)=>(qo.get(e.id)??2**53-1)-(qo.get(t.id)??2**53-1));let g=c.size,_=null;if(p)if(a.has(p.id))_=`Awaiting permission · ${ns(s,l)}`;else if(p.name.toLowerCase()===`agent`)_=ts(p.input)??`${p.activeDisplayName??pe(p.name)}…`;else{let e=p.activeDisplayName??pe(p.name),t=es(p.input);_=t?`${e} ${t}…`:`${e}…`}return{categories:h,distinctFiles:g,otherCount:o.get(`other`)??0,pendingCount:l,pendingCategoryIds:s,linesAdded:u,linesRemoved:d,errorCount:f,activeLabel:_}}function as(e,t){let n=e.categories.slice(0,3),r=e.categories.slice(3).reduce((e,t)=>e+t.count,0),i=e.otherCount+r,a=n.map(e=>Ee(e.id).formatPhrase(e.count)),o=``;a.length>0?(o=a.join(`, `),i>0&&(o+=`, and ${i} more`),o=rs(o)):i>0&&(o=rs(Ee(`other`).formatPhrase(i)));let s=t.showActive&&e.activeLabel!==null;if(!s&&e.pendingCount>0){let t=ns(e.pendingCategoryIds,e.pendingCount);o=o?`${o} · ${t}`:rs(t)}let c=e.linesAdded+e.linesRemoved>0?`+${e.linesAdded} −${e.linesRemoved}`:null;return{text:o,lineStats:c,errorCount:e.errorCount,activeLabel:s?e.activeLabel:null}}function os(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n.type===`long_running_confirmation`||n.type===`shell_permission`||n.type===`web_fetch_permission`)return t}return-1}function ss(e){return e.type===`content`||e.type===`thinking`?e.chunks.some(e=>e.trim().length>0):!1}function cs(e){let t=Bo(e),n=t.some(e=>So(e)&&e.name===`ask_user`),r=t.some(e=>Co(e)&&e.toolName===`ask_user`);if(n&&!r)return!0;let i=os(e);return i===-1?!1:!e.slice(i+1).some(ss)}function ls(e){let t=Bo(e);return t.length===0?`...`:t.length===1&&t[0]?.type===`text`&&`text`in t[0]?t[0].text:JSON.stringify(t)}function us(e,t){switch(t.type){case I.SetStreaming:{let n=Ra(e,t),r=za(e,t);return Va(e,n,r,{...Ia(e.threadStreamingStates,n,r),isStreaming:t.isStreaming})}case I.AppendStreamContent:{let n=Ra(e,t),r=za(e,t),i=Ia(e.threadStreamingStates,n,r);return Va(e,n,r,{...i,streamingContent:i.streamingContent+t.content})}case I.SetStreamContent:{let n=Ra(e,t),r=za(e,t),i=Ia(e.threadStreamingStates,n,r),a=Po(i.streamingSegments,t.content);return Va(e,n,r,{...i,streamingContent:t.content,streamingSegments:a})}case I.AppendStreamThinking:{let n=Ra(e,t),r=za(e,t),i=Ia(e.threadStreamingStates,n,r);return Va(e,n,r,{...i,streamingThinking:i.streamingThinking+t.content})}case I.IncrementStreamEventCount:{let n=Ra(e,t),r=za(e,t),i=Ia(e.threadStreamingStates,n,r);return Va(e,n,r,{...i,streamingEventCount:i.streamingEventCount+1})}case I.AppendStreamChunk:{let n=Ra(e,t),r=za(e,t),i=Ia(e.threadStreamingStates,n,r);return Va(e,n,r,{...i,streamingSegments:t.segments,streamingContent:t.chunkType===`content`?i.streamingContent+t.content:i.streamingContent,streamingThinking:t.chunkType===`thinking`?i.streamingThinking+t.content:i.streamingThinking})}case I.SetStreamModel:{let n=Ra(e,t),r=za(e,t);return Va(e,n,r,{...Ia(e.threadStreamingStates,n,r),streamingModel:t.model})}case I.SetStreamAgentMode:{let n=Ra(e,t),r=za(e,t);return Va(e,n,r,{...Ia(e.threadStreamingStates,n,r),streamingAgentMode:t.mode})}case I.SetContextUsage:{let n=Ra(e,t),r=za(e,t);return Va(e,n,r,{...Ia(e.threadStreamingStates,n,r),contextUsage:t.contextUsage})}case I.ResetStream:return Va(e,Ra(e,t),za(e,t),Pa(),!0);case I.StopStream:{let n=Ra(e,t),r=za(e,t);return Va(e,n,r,{...Ia(e.threadStreamingStates,n,r),isStreaming:!1})}default:return null}}function ds(e,t){return e.terminalStates[t]??Ha()}function fs(e,t){switch(t.type){case I.AppendCommandOutput:return{...e,commandOutput:e.commandOutput+t.content};case I.SetRunningCommand:return{...e,isRunningCommand:t.isRunning};case I.ClearCommandOutput:return{...e,commandOutput:``};case I.ToggleTerminal:{let n=ds(e,t.threadId);return{...e,terminalStates:{...e.terminalStates,[t.threadId]:{...n,open:!n.open}}}}case I.SetTerminalOpen:{let n=t.threadId??`default`,r=ds(e,n);return{...e,terminalStates:{...e.terminalStates,[n]:{...r,open:t.open}}}}case I.QueueTerminalCommand:{let n=ds(e,t.threadId);return{...e,terminalStates:{...e.terminalStates,[t.threadId]:{...n,queuedCommand:t.command,queuedRelativeFolder:t.relativeFolder??null,open:!0}}}}case I.ClearQueuedTerminalCommand:{let n=ds(e,t.threadId);return{...e,terminalStates:{...e.terminalStates,[t.threadId]:{...n,queuedCommand:null}}}}case I.AppendTerminalLine:{let n=t.threadId??`default`,r=ds(e,n);return{...e,terminalStates:{...e.terminalStates,[n]:{...r,outputLines:[...r.outputLines,t.line]}}}}case I.ClearTerminalOutput:{let n=t.threadId??`default`,r=ds(e,n);return{...e,terminalStates:{...e.terminalStates,[n]:{...r,outputLines:[]}}}}case I.SetTerminalHeight:{let n=ds(e,t.threadId);return{...e,terminalStates:{...e.terminalStates,[t.threadId]:{...n,height:t.height}}}}case I.SetTerminalCwd:{let n=ds(e,t.threadId);return{...e,terminalStates:{...e.terminalStates,[t.threadId]:{...n,cwd:t.cwd}}}}case I.SetTerminalRunning:{let n=ds(e,t.threadId);return{...e,terminalStates:{...e.terminalStates,[t.threadId]:{...n,isRunning:t.isRunning}}}}case I.SetTerminalHistory:{let n=ds(e,t.threadId);return{...e,terminalStates:{...e.terminalStates,[t.threadId]:{...n,history:t.history}}}}case I.SetTerminalHistoryIndex:{let n=ds(e,t.threadId);return{...e,terminalStates:{...e.terminalStates,[t.threadId]:{...n,historyIndex:t.index}}}}default:return null}}function ps(e,t){switch(t.type){case I.ToggleSidebar:return{...e,sidebarOpen:!e.sidebarOpen};case I.CloseSidebar:return e.sidebarOpen?{...e,sidebarOpen:!1}:e;case I.OpenProjectPanel:return{...e,projectPanelView:`actions`,projectPanelProjectId:t.projectId};case I.CloseProjectPanel:return{...e,projectPanelView:`projects`,projectPanelProjectId:null};case I.SetCreatingProject:return{...e,isCreatingProject:t.isCreating};case I.ConfigUpdated:return{...e,configUpdatedAt:Date.now()};case I.FocusChatInput:return{...e,focusChatInput:!0};case I.ClearFocusChatInput:return{...e,focusChatInput:!1};case I.SetDiffComments:return{...e,diffComments:{...e.diffComments,[t.threadId]:t.comments}};default:return null}}var ms=[us,ka,yo,ro,_o,xo,fs,ps];function hs(e,t){for(let n of ms){let r=n(e,t);if(r!==null)return r}return e}var gs=new Set([I.AppendStreamChunk,I.IncrementStreamEventCount,I.SetStreamModel,I.AppendStreamContent,I.AppendStreamThinking,I.SetStreamContent,I.AppendSubagentEvent,I.AppendToolExecutionOutput,I.UpdateToolCallProgress,I.UpdateToolExecutionOutput]);function _s(e){return`${`threadId`in e&&typeof e.threadId==`string`?e.threadId:``}:${`paneId`in e&&typeof e.paneId==`string`?e.paneId:``}`}function vs(e){if(e.length<=1)return e;let t=[],n=new Map,r=new Map,i=new Map,a=new Map,o=new Map,s=new Map,c=new Map,l=new Map,u=[];for(let t of e)switch(t.type){case I.AppendStreamChunk:{let e=_s(t),r=n.get(e);r?(t.chunkType===`thinking`?r.thinkingContent+=t.content:t.chunkType===`content`&&(r.contentContent+=t.content),r.lastAction=t):n.set(e,{thinkingContent:t.chunkType===`thinking`?t.content:``,contentContent:t.chunkType===`content`?t.content:``,lastAction:t});break}case I.IncrementStreamEventCount:r.set(_s(t),t);break;case I.SetStreamModel:i.set(_s(t),t);break;case I.AppendStreamContent:{let e=_s(t),n=a.get(e);n?(n.value+=t.content,n.last=t):a.set(e,{value:t.content,last:t});break}case I.AppendStreamThinking:{let e=_s(t),n=o.get(e);n?(n.value+=t.content,n.last=t):o.set(e,{value:t.content,last:t});break}case I.SetStreamContent:s.set(_s(t),t);break;case I.UpdateToolCallProgress:c.set(t.toolCallId,t);break;case I.UpdateToolExecutionOutput:l.set(t.toolCallId,t);break;default:u.push(t);break}for(let e of i.values())t.push(e);for(let e of r.values())t.push(e);for(let{value:e,last:n}of a.values())n.type===I.AppendStreamContent&&t.push({...n,content:e});for(let{value:e,last:n}of o.values())n.type===I.AppendStreamThinking&&t.push({...n,content:e});for(let e of s.values())t.push(e);for(let{thinkingContent:e,contentContent:r,lastAction:i}of n.values())e&&t.push({...i,chunkType:`thinking`,content:e,segments:i.segments}),r&&t.push({...i,chunkType:`content`,content:r,segments:i.segments}),!e&&!r&&t.push(i);for(let e of c.values())t.push(e);for(let e of l.values())t.push(e);return t.push(...u),t}function ys(e=Ta){let t=e,n=new Set,r=0,i=[];function a(){return t}function o(){for(let e of n)e()}function s(e){let n=hs(t,e);n!==t&&(t=n)}function c(){if(r=0,i.length===0)return;let e=i.splice(0,i.length);for(let t of vs(e))s(t);o()}function l(e){if(gs.has(e.type)){i.push(e),r===0&&(r=requestAnimationFrame(c));return}i.length>0&&(r!==0&&(cancelAnimationFrame(r),r=0),c()),s(e),o()}function u(e){return n.add(e),function(){n.delete(e)}}return{getState:a,dispatch:l,subscribe:u}}var bs=(0,M.createContext)(null);function xs(){let e=(0,M.useContext)(bs);if(!e)throw Error(`useAppStore must be used within an AppStoreContext.Provider`);return e}function Ss(e){let t=(0,F.c)(3),n=xs(),r;t[0]!==e||t[1]!==n?(r=function(){return e(n.getState())},t[0]=e,t[1]=n,t[2]=r):r=t[2];let i=r;return(0,M.useSyncExternalStore)(n.subscribe,i,i)}function Cs(){return xs().dispatch}function ws(e){let t=(0,F.c)(8),n=Cs(),r;t[0]===e?r=t[1]:(r=t=>(e?t.terminalStates[e]:void 0)??Ea,t[0]=e,t[1]=r);let i=Ss(r),a;t[2]!==n||t[3]!==e?(a=t=>{e&&n({...t,threadId:e})},t[2]=n,t[3]=e,t[4]=a):a=t[4];let o=a,s;return t[5]!==o||t[6]!==i?(s={terminalState:i,dispatch:o},t[5]=o,t[6]=i,t[7]=s):s=t[7],s}var Ts=Object,Es=Map,Ds=Set,Os=Ds.prototype.has,ks=Ds.prototype.add,As=Es.prototype.has,js=Es.prototype.get,Ms=Es.prototype.set,Ns=1,Ps=2,Fs=4,Is=8,Ls=16,Rs=32,zs=`__t`,Bs=`__p`,Vs=`__e`,Hs=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Us=`http://www.w3.org/1999/xlink`,Ws=`http://www.w3.org/2000/xmlns/`,Gs=120,Ks=new Ds([`href`,`list`,`form`,`tabIndex`,`download`]),qs=new Ds([`area`,`base`,`basefont`,`bgsound`,`br`,`col`,`command`,`embed`,`frame`,`hr`,`image`,`img`,`input`,`isindex`,`keygen`,`link`,`menuitem`,`meta`,`nextid`,`param`,`source`,`track`,`wbr`]);if(typeof window>`u`)throw Error(`See http://million.dev/docs/install to install the compiler.`);var Js=document;Js.createElement(`template`);var Ys=Js.createElement(`template`),Xs=Ys.content,Zs=Js.createElementNS(`http://www.w3.org/2000/svg`,`svg`),Qs=Node.prototype,$s=Element.prototype,ec=CharacterData.prototype,tc=Ts.getOwnPropertyDescriptor,nc=Qs.insertBefore,rc=Qs.cloneNode,ic=Qs.replaceChild,ac=$s.remove,oc=Qs.addEventListener,sc=$s.removeAttribute,cc=$s.setAttribute,lc=$s.setAttributeNS,uc=tc(Qs,`textContent`).set,dc=tc(Qs,`firstChild`).get,fc=tc(Qs,`nextSibling`).get,pc=tc(ec,`data`).set,mc=(e,t)=>{let n=t?Zs:Ys;return n.innerHTML=e,(t?Zs:Xs).firstChild};Js[Vs]=new Ds;var hc=(e,t,n)=>{let r=t.toLowerCase(),i=!1;r.endsWith(`capture`)&&(r=r.slice(0,-7),i=!0);let a=`$$${r}`;Os.call(Js[Vs],r)||(oc.call(Js,r,e=>{let t=e.target;for(;t;){let n=t[a];n&&(Ts.defineProperty(e,`currentTarget`,{configurable:!0,get(){return t}}),n(e)),t=t.parentNode}},{capture:i}),ks.call(Js[Vs],r));let o=t=>{t?`key`in t&&t.key===e[a]?.key||(e[a]=t):e[a]=null};return o(n),o},gc=(e,t)=>{let n=dc.call(e);if(t)for(let e=0;e<t&&n;++e)n=fc.call(n);return n},_c=new WeakSet,vc=e=>{if(_c.has(e))return;e.nodeType===8&&e.parentNode?.removeChild(e);let t=dc.call(e);for(;t;)vc(t),t=t.nextSibling;_c.add(e)},yc=(e,t,n)=>{let r=Js.createTextNode(t),i=gc(e,n);return nc.call(e,r,i),r},bc=(e,t)=>{pc.call(e,t)},xc=(e,t,n)=>{typeof n!=`number`||Hs.test(t)?e.style[t]=n:typeof n==`string`?e.style.cssText=n:t.startsWith(`-`)?e.style.setProperty(t,String(n)):n==null?e.style[t]=``:e.style[t]=`${String(n)}px`},Sc=(e,t,n)=>{t=t.replace(/xlink(?:H|:h)/,`h`).replace(/sName$/,`s`),t.startsWith(`xmlns`)?lc.call(e,Ws,t,String(n)):t.startsWith(`xlink`)&&lc.call(e,Us,`href`,String(n))},Cc=(e,t,n)=>{let r=n==null;if(n=r?``:n,t in e&&e[t]!==void 0&&e[t]!==null&&!(e instanceof SVGElement)&&Os.call(Ks,t))try{e[t]=n}catch{}else !r&&n!==``&&(n!==!1||t.includes(`-`))?cc.call(e,t,String(n)):sc.call(e,t);let i=e instanceof HTMLInputElement,a=e instanceof HTMLSelectElement,o=e instanceof HTMLTextAreaElement;t===`value`&&(i||a||o)&&(cc.call(e,t,String(n)),e.value=n)},wc=new Map([[`acceptCharset`,`accept-charset`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`],[`crossOrigin`,`crossorigin`],[`accentHeight`,`accent-height`],[`alignmentBaseline`,`alignment-baseline`],[`arabicForm`,`arabic-form`],[`baselineShift`,`baseline-shift`],[`capHeight`,`cap-height`],[`clipPath`,`clip-path`],[`clipRule`,`clip-rule`],[`colorInterpolation`,`color-interpolation`],[`colorInterpolationFilters`,`color-interpolation-filters`],[`colorProfile`,`color-profile`],[`colorRendering`,`color-rendering`],[`dominantBaseline`,`dominant-baseline`],[`enableBackground`,`enable-background`],[`fillOpacity`,`fill-opacity`],[`fillRule`,`fill-rule`],[`floodColor`,`flood-color`],[`floodOpacity`,`flood-opacity`],[`fontFamily`,`font-family`],[`fontSize`,`font-size`],[`fontSizeAdjust`,`font-size-adjust`],[`fontStretch`,`font-stretch`],[`fontStyle`,`font-style`],[`fontVariant`,`font-variant`],[`fontWeight`,`font-weight`],[`glyphName`,`glyph-name`],[`glyphOrientationHorizontal`,`glyph-orientation-horizontal`],[`glyphOrientationVertical`,`glyph-orientation-vertical`],[`horizAdvX`,`horiz-adv-x`],[`horizOriginX`,`horiz-origin-x`],[`imageRendering`,`image-rendering`],[`letterSpacing`,`letter-spacing`],[`lightingColor`,`lighting-color`],[`markerEnd`,`marker-end`],[`markerMid`,`marker-mid`],[`markerStart`,`marker-start`],[`overlinePosition`,`overline-position`],[`overlineThickness`,`overline-thickness`],[`paintOrder`,`paint-order`],[`panose-1`,`panose-1`],[`pointerEvents`,`pointer-events`],[`renderingIntent`,`rendering-intent`],[`shapeRendering`,`shape-rendering`],[`stopColor`,`stop-color`],[`stopOpacity`,`stop-opacity`],[`strikethroughPosition`,`strikethrough-position`],[`strikethroughThickness`,`strikethrough-thickness`],[`strokeDasharray`,`stroke-dasharray`],[`strokeDashoffset`,`stroke-dashoffset`],[`strokeLinecap`,`stroke-linecap`],[`strokeLinejoin`,`stroke-linejoin`],[`strokeMiterlimit`,`stroke-miterlimit`],[`strokeOpacity`,`stroke-opacity`],[`strokeWidth`,`stroke-width`],[`textAnchor`,`text-anchor`],[`textDecoration`,`text-decoration`],[`textRendering`,`text-rendering`],[`transformOrigin`,`transform-origin`],[`underlinePosition`,`underline-position`],[`underlineThickness`,`underline-thickness`],[`unicodeBidi`,`unicode-bidi`],[`unicodeRange`,`unicode-range`],[`unitsPerEm`,`units-per-em`],[`vAlphabetic`,`v-alphabetic`],[`vHanging`,`v-hanging`],[`vIdeographic`,`v-ideographic`],[`vMathematical`,`v-mathematical`],[`vectorEffect`,`vector-effect`],[`vertAdvY`,`vert-adv-y`],[`vertOriginX`,`vert-origin-x`],[`vertOriginY`,`vert-origin-y`],[`wordSpacing`,`word-spacing`],[`writingMode`,`writing-mode`],[`xmlnsXlink`,`xmlns:xlink`],[`xHeight`,`x-height`]]);function Tc(e){return wc.get(e)||e}var Ec=Object.defineProperty,Dc=(e,t,n)=>t in e?Ec(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Oc=(e,t,n)=>(Dc(e,typeof t==`symbol`?t:t+``,n),n),kc=class{constructor(){Oc(this,`r`),Oc(this,`e`),Oc(this,`l`),Oc(this,`g`),Oc(this,`_u`),Oc(this,`_t`),Oc(this,`d`),Oc(this,`k`),Oc(this,`c`)}},Ac=(e,t=[],n=[])=>{if(typeof e==`string`)return e;if(typeof e==`number`||typeof e==`bigint`||e===!0)return String(e);if(e==null||e===!1)return``;if(typeof e==`object`&&`$`in e)return t.push({p:n,e:[{t:Ns,n:null,v:null,h:e.$,i:0,l:null,p:null,b:null}],i:[]}),`<slot/>`;let r=``,i=``,a={p:n,e:[],i:[]};for(let t in e.props){let n=e.props[t];if(t===`key`||t===`ref`||t===`children`)continue;let i=Tc(t);if(i&&(t=i),t===`className`&&(t=`class`),t.startsWith(`on`)){`$`in n?a.e.push({t:Fs,n:t.slice(2),v:null,h:n.$,i:null,l:null,p:null,b:null}):a.i.push({t:Fs,n:t.slice(2),v:null,h:null,i:null,l:n,p:null,b:null});continue}if(n){if(typeof n==`object`&&`$`in n){t===`style`?a.e.push({t:Is,n:t,v:null,h:n.$,i:null,l:null,p:null,b:null}):t.charCodeAt(0)===Gs?a.e.push({t:Ls,n:t,v:null,h:n.$,i:null,l:null,p:null,b:null}):a.e.push({t:Ps,n:t,v:null,h:n.$,i:null,l:null,p:null,b:null});continue}if(t===`style`&&typeof n==`object`){let e=``;for(let t in n){if(typeof n[t]==`object`){a.e.push({t:Is,n:t,v:null,h:n[t].$,i:null,l:null,p:null,b:null});continue}let r=``;for(let e=0,n=t.length;e<n;++e){let n=t.charCodeAt(e);n<97?r+=`-${String.fromCharCode(n+32)}`:r+=t[e]}e+=`${r}:${String(n[t])};`}r+=` style="${e}"`;continue}r+=` ${t}="${String(n)}"`}}if(Os.call(qs,e.type))return a.e.length&&t.push(a),`<${e.type}${r} />`;let o=!1;for(let r=0,s=e.props.children?.length||0,c=0;r<s;++r){let s=e.props.children?.[r];if(s==null||s===!1)continue;if(typeof s==`object`&&`$`in s){a.e.push({t:Ns,n:null,v:null,h:s.$,i:r,l:null,p:null,b:null});continue}if(s instanceof kc){a.i.push({t:Rs,n:null,v:null,h:null,i:r,l:null,p:null,b:s});continue}if(typeof s==`string`||typeof s==`number`||typeof s==`bigint`){let e=typeof s==`number`||typeof s==`bigint`?String(s):s;if(o){a.i.push({t:Ns,n:null,v:e,h:null,i:r,l:null,p:null,b:null});continue}o=!0,i+=e,c++;continue}o=!1;let l=n.slice();l.push(c++),i+=Ac(s,t,l)}return(a.i.length||a.e.length)&&t.push(a),`<${e.type}${r}>${i}</${e.type}>`},jc=Object.defineProperty,Mc=(e,t,n)=>t in e?jc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Nc=(e,t,n)=>(Mc(e,typeof t==`symbol`?t:t+``,n),n),Pc=e=>new Fc(e),Fc=class extends kc{constructor(e){super(),Nc(this,`b`),this.b=e}v(){}p(e){let t=this.b,n=e.b,r=t.length,i=n.length,a=this.t();if(this===e||i===0&&r===0)return a;if(this.b=n,i===0)return zc.call(this),a;if(r===0)return Lc.call(e,a),a;let o=0,s=0,c=r-1,l=i-1,u=t[0],d=n[0],f=t[c],p=n[l],m;for(;o<=c&&s<=l;){if(!u){u=t[++o];continue}if(!f){f=t[--c];continue}let e=u.k,r=d.k;if(e===r){qc.call(u,d),n[s]=u,u=t[++o],d=n[++s];continue}let i=f.k,h=p.k;if(i===h){qc.call(f,p),n[l]=f,f=t[--c],p=n[--l];continue}if(e===h){qc.call(u,p),n[l]=u;let e=n[l+1];Jc.call(u,e,e?.l||null),u=t[++o],p=n[--l];continue}if(i===r){qc.call(f,d),n[s]=f;let e=t[o];Jc.call(f,e,e?.l||null),f=t[--c],d=n[++s];continue}if(!m){m=new Es;for(let e=o;e<=c;e++)Ms.call(m,t[e].k,e)}let g=m.get(r);if(g===void 0)Kc.call(d,a,u.l||null);else{let e=t[g];Jc.call(e,u,null),qc.call(e,d),n[s]=e,t[g]=null}d=n[++s]}if(o<=c||s<=l)if(o>c){let e=n[l+1];for(let t=s;t<=l;++t)Kc.call(n[t],a,e?e.l:null)}else for(let e=o;e<=c;++e)Yc.call(t[e]);return a}m(e,t=null){if(this._t)return this._t;for(let n=0,r=this.b.length;n<r;++n){let r=this.b[n];Kc.call(r,e,t)}return this._t=e,e}x(){let e=this.t();if(e)uc.call(e,``);else for(let e=0,t=this.b.length;e<t;++e)Yc.call(this.b[e]);this.b=[]}u(){return!0}s(){return this.b.map(e=>e.s()).join(``)}t(){return this._t||=this.b[0].t(),this._t}},Ic=Fc.prototype,Lc=Ic.m,Rc=Ic.p,zc=Ic.x,Bc=new Proxy({},{get(e,t){return{$:t}}}),Vc=(e,t,n,r)=>{let i=e(Bc),a=[],o=mc(Ac(t?t(i):i,a),r);return vc(o),(e,t,r)=>new Uc(o,a,e,t??e?.key??null,r??n??null,null)},Hc=(e,t)=>{if((`b`in e||`b`in t)&&Rc.call(e,t),e.l||Kc.call(e,void 0,null,null),e.k&&e.k===t.k||e.r===t.r)return qc.call(e,t);let n=Kc.call(t,e.t(),e.l,null);return Yc.call(e),e.k=t.k,n},Uc=class extends kc{constructor(e,t,n,r,i,a){super(),this.r=e,this.d=n,this.e=t,this.k=r,this.c=Array(t.length),i?this._u=i:this._u=null,a?this.g=a:this.g=null}m(e,t=null,n){if(this.l)return this.l;let r=n??rc.call(this.r,!0),i=this.g?.(r);i&&(this.c=i);for(let e=0,t=this.e.length;e<t;++e){let t=this.e[e],a=i?.[e]??Wc(t.p,r,this.c,e);for(let e=0,r=t.e.length;e<r;++e){let i=t.e[e],o=this.d[i.h];if(i.t&Ns){if(o instanceof kc){let e=gc(a,i.i);n?o.m(a,e,e):o.m(a,e);continue}if(a[zs]||(a[zs]=Array(r)),o&&typeof o==`object`&&`foreign`in o){if(n){let e=gc(a,i.i);o.reset(e)}let t=o.current;a[zs][e]=t,n||nc.call(a,t,gc(a,i.i));continue}if(n){a[zs][e]=gc(a,i.i);continue}a[zs][e]=yc(a,o==null||o===!1?``:String(o),i.i)}else if(i.t&Fs){let e=hc(a,i.n,o);a[Bs+i.n]=e}else if(i.t&Ps)Cc(a,i.n,o);else if(i.t&Is)if(typeof o==`string`||typeof o==`number`)xc(a,i.n,o);else for(let e in o)xc(a,e,o[e]);else Sc(a,i.n,o)}let o=t.i?.length;if(o)for(let e=0;e<o;++e){let r=t.i[e];if(r.t&Ns)r.v&&!n&&yc(a,r.v,r.i);else if(r.t&Fs)hc(a,r.n,r.l);else{let e=gc(a,r.i);n?r.b.m(a,e,e):r.b.m(a,e)}}}return e&&!n&&nc.call(e,r,t),this.l=r,r}p(e){let t=this.l;if(!e.d)return t;let n=this.d;if(!Xc.call(this,n,e.d))return t;this.d=e.d;for(let r=0,i=this.e.length;r<i;++r){let i=this.e[r],a=this.c[r]??Wc(i.p,t,this.c,r);for(let t=0,o=i.e.length;t<o;++t){let o=i.e[t],s=n[o.h],c=e.d[o.h];if(c!==s){if(o.t&Fs){a[Bs+o.n](c);continue}if(o.t&Ns){if(s instanceof kc){let n=e.e?.[r]?.e[t],i=e.d[n.h];s.p(i);continue}if(c&&typeof c==`object`&&`foreign`in c){let e=a[zs][t];if(c.unstable&&s!==c){let n=c.current;a[zs][t]=n,ic.call(a,n,e)}else c.current=e;continue}bc(a[zs][t],c==null||c===!1?``:String(c))}else if(o.t&Ps)Cc(a,o.n,c);else if(o.t&Is)if(typeof c==`string`||typeof c==`number`)xc(a,o.n,c);else for(let e in c)c[e]!==s[e]&&xc(a,e,c[e]);else Sc(a,o.n,c)}}}return t}v(e=null,t=null){nc.call(this.t(),this.l,e?e.l:t)}x(){ac.call(this.l),this.l=null}u(e,t){return this._u?this._u(e,t):!0}s(){return String(this.l?.outerHTML)}t(){return this._t||=this.l?.parentElement,this._t}},Wc=(e,t,n,r)=>{let i=e.length;if(!i)return t;let a=n&&r!==void 0;if(a&&n[r])return n[r];for(let n=0;n<i;++n){let r=e[n];t=gc(t,r)}return a&&(n[r]=t),t},Gc=Uc.prototype,Kc=Gc.m,qc=Gc.p,Jc=Gc.v,Yc=Gc.x,Xc=Gc.u,Zc={noSlot:!1},Qc=`slot`,$c=({effect:e,deps:t})=>((0,M.useEffect)(e,t||[]),null),el=new Map,tl=(0,M.createContext)(!1),nl=(e,t,n)=>{let r={ref:t},i=0;for(let t in e){let a=e[t];if((0,M.isValidElement)(a)||Array.isArray(a)&&a.length&&(0,M.isValidElement)(a[0])){r[t]=il(a,!1,n,i++);continue}r[t]=e[t]}return r},rl=(e,t)=>(0,M.createElement)(Qc,{suppressHydrationWarning:!0,id:t},e),il=(e,t,n,r,i)=>{let a=n?.[r]?.current,o=(0,M.isValidElement)(e)&&typeof e.type==`function`&&`_c`in e.type,s=o&&e.type._c;if(typeof window>`u`)return o?s?e:rl(rl(e),i):rl(e,i);if(s){let t=e.type(e.props);if(el.has(t.type)){let e=el.get(t.type);if(typeof e==`function`)return e(t.props)}}let c=a??(i?document.getElementById(i):null)??document.createElement(`slot`),l={foreign:!0,current:c,portal:(0,Ca.createPortal)((0,M.createElement)(M.Fragment,{children:e}),c,i),reset:e=>{e.childNodes.forEach(t=>e.removeChild(t))},unstable:t};return n&&(n[r]=l),l},al=e=>{if(typeof e!=`object`||!e||!(`type`in e))return typeof e==`number`?String(e):e;let t=e.type;if(typeof t==`function`)return al(t(e.props??{}));if(typeof t==`object`&&`$`in t)return t;let n={...e.props};return`css`in n&&`__EMOTION_TYPE_PLEASE_DO_NOT_USE__`in n&&(n.style=n.css.styles,t=n.__EMOTION_TYPE_PLEASE_DO_NOT_USE__,delete n.__EMOTION_TYPE_PLEASE_DO_NOT_USE__,delete n.css),e.props?.children!=null&&(n.children=ol(e.props.children).map(e=>al(e))),{type:t,props:n}},ol=e=>{if(e==null)return[];if(typeof e==`object`&&`type`in e&&e.type===M.Fragment)return ol(e.props.children);if(!Array.isArray(e)||typeof e==`object`&&`$`in e)return[e];let t=e.flat(1/0),n=[];for(let e=0,r=t.length;e<r;++e)n.push(...ol(t[e]));return n},sl=typeof window>`u`?M.useEffect:M.useLayoutEffect;function cl(e,t,n){if(!e||t(e))return e;let r=n?e.return:e.child;for(;r;){let e=cl(r,t,n);if(e)return e;r=n?null:r.sibling}}function ll(){let e=(0,M.useRef)();return(0,M.useState)(()=>{let t=Function.prototype.bind;Function.prototype.bind=function(n,r){return n===null&&typeof r?.type==`function`&&(e.current=r,Function.prototype.bind=t),t.apply(this,arguments)}}),e.current}function ul(e){let t=ll(),n=(0,M.useRef)({el:null,depth:0});return sl(()=>{n.current.el=cl(t,t=>(n.current.depth++,typeof t.type==`string`&&(e===void 0||t.type===e)),!0)?.stateNode},[t]),n}function dl(){let e=ll(),t=(0,M.useRef)({el:null,depth:0});return sl(()=>{t.current.el=cl(e,e=>(t.current.depth++,e.stateNode?.containerInfo!=null),!0)?.stateNode.containerInfo},[e]),t}var fl=(e,t={})=>{let n=t?.experimental_noSlot??Zc.noSlot,r=t?.block,i=t?.svg?`g`:Qc;e&&(r=Vc(e,al,t?.shouldUpdate,t?.svg));let a=(e,a)=>{let o=dl(),s=ul(),c=e._hmr,l=(0,M.useRef)(null),u=(0,M.useRef)(null),d=(0,M.useRef)([]);e=nl(e,a,d.current),u.current?.(e);let f=(0,M.useCallback)(()=>{if(!l.current&&!n)return;let i=r(e,e.key);return c&&l.current?.textContent&&(l.current.textContent=``),n&&(l.current=s.current?.el??o.current?.el,(e.scoped||s.current&&o.current&&s.current.depth>o.current.depth)&&(l.current=o.current.el),l.current.childNodes.length&&console.error(Error(`\`experimental_options.noSlot\` does not support having siblings at the moment.
|
|
8
|
+
The block element should be the only child of the \`${rc.call(l.current).outerHTML}\` element.
|
|
9
|
+
To avoid this error, \`experimental_options.noSlot\` should be false`))),(u.current===null||c)&&(Kc.call(i,l.current,null),u.current=e=>{Hc(i,r(e,e.key,t?.shouldUpdate))}),()=>{Yc.call(i)}},[]),p=(0,M.useMemo)(()=>n?null:(0,M.createElement)(t?.as??i,{ref:l}),[]),m=d.current.length,h=Array(m);for(let e=0;e<m;++e)h[e]=d.current[e]?.portal;return(0,M.createElement)(M.Fragment,{},p,(0,M.createElement)($c,{effect:f,deps:c?[c]:[]}),h)};return As.call(el,a)||Ms.call(el,a,fl),t?.name&&(e&&(e.displayName=`Million(Render(${t.name}))`),a.displayName=`Million(Block(${t.name}))`),a};(0,M.memo)(({each:e,children:t,memo:n,svg:r,as:i,...a})=>{let o=(0,M.useRef)(null),[s]=(0,M.useState)(()=>({current:Array(e.length)})),c=(0,M.useRef)(null),l=(0,M.useRef)({each:null,children:null,mounted:!1}),[,u]=(0,M.useState)(!1);if(c.current&&(e!==l.current.each||!n)){let r=pl(e,t,l,s,n);Rc.call(c.current,Pc(r))}let d=(0,M.createElement)(M.Fragment,null,(0,M.createElement)(i??(r?`g`:`slot`),{...a,ref:o}),...s.current.map(e=>e.portal));return(0,M.useEffect)(()=>{!o.current||c.current||l.current.mounted||(c.current=Pc(pl(e,t,l,s,n)),As.call(el,d)||Ms.call(el,d,c.current),Lc.call(c.current,o.current),l.current.mounted=!0,u(!0))},[o.current]),d});var pl=(e,t,n,r,i)=>{let a=Array(e.length),o=n.current;for(let n=0,s=e.length;n<s;++n){if(i&&o.each&&o.each[n]===e[n]){a[n]=o.children?.[n];continue}let s=t(e[n],n);if(As.call(el,s.type)){o.block||=js.call(el,s.type),a[n]=o.block(s.props,r,n);continue}if(typeof s.type==`function`&&`_c`in s.type){let e=s.type(s.props);if(As.call(el,e.type)){let t=js.call(el,e.type);if(typeof t==`function`){a[n]=t(e.props);continue}}}let c=Vc(e=>e?.scope),l=(e,t,n)=>c({scope:il((0,M.createElement)(s.type,e),!1,t.current,n)},s.key?String(s.key):void 0);Ms.call(el,s.type,l),o.block=l,a[n]=l(s.props,r,n)}return o.each=e,o.children=a,a};function ml(e,t){return e===t||e!==e&&t!==t}function hl(e,t){for(let n in e)if(!ml(e[n],t[n]))return!0;return!1}function gl(e,{portals:t,...n}){let r=`CompiledBlock(Inner(${n.name}))`,i=fl(t=>e(t),{...n,scoped:void 0,name:r,shouldUpdate:hl}),a=t?.length||0,o=t&&a>0?e=>{let n=(0,M.useContext)(tl),[r]=(0,M.useState)(()=>[]),o={...e,scoped:n};for(let e=0;e<a;e++){let n=t[e];o[n]=il(o[n],!1,r,e)}let s=[];for(let e=0,t=r.length;e<t;e++)s[e]=r[e].portal;return(0,M.createElement)(M.Fragment,null,(0,M.createElement)(i,o),s)}:e=>(0,M.createElement)(i,e);return n.name&&(o.displayName=`Million(CompiledBlock(Outer(${n.name})))`),o}typeof window<`u`&&(window.__MILLION_DATA__={version:`3.1.11`});var _l=[`top`,`right`,`bottom`,`left`],vl=Math.min,yl=Math.max,bl=Math.round,xl=Math.floor,Sl=e=>({x:e,y:e}),Cl={left:`right`,right:`left`,bottom:`top`,top:`bottom`},wl={start:`end`,end:`start`};function Tl(e,t,n){return yl(e,vl(t,n))}function El(e,t){return typeof e==`function`?e(t):e}function Dl(e){return e.split(`-`)[0]}function Ol(e){return e.split(`-`)[1]}function kl(e){return e===`x`?`y`:`x`}function Al(e){return e===`y`?`height`:`width`}var jl=new Set([`top`,`bottom`]);function Ml(e){return jl.has(Dl(e))?`y`:`x`}function Nl(e){return kl(Ml(e))}function Pl(e,t,n){n===void 0&&(n=!1);let r=Ol(e),i=Nl(e),a=Al(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=Ul(o)),[o,Ul(o)]}function Fl(e){let t=Ul(e);return[Il(e),t,Il(t)]}function Il(e){return e.replace(/start|end/g,e=>wl[e])}var Ll=[`left`,`right`],Rl=[`right`,`left`],zl=[`top`,`bottom`],Bl=[`bottom`,`top`];function Vl(e,t,n){switch(e){case`top`:case`bottom`:return n?t?Rl:Ll:t?Ll:Rl;case`left`:case`right`:return t?zl:Bl;default:return[]}}function Hl(e,t,n,r){let i=Ol(e),a=Vl(Dl(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(Il)))),a}function Ul(e){return e.replace(/left|right|bottom|top/g,e=>Cl[e])}function Wl(e){return{top:0,right:0,bottom:0,left:0,...e}}function Gl(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Wl(e)}function Kl(e){let{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 ql(e,t,n){let{reference:r,floating:i}=e,a=Ml(t),o=Nl(t),s=Al(o),c=Dl(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(Ol(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}async function Jl(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=El(t,e),p=Gl(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=Kl(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=Kl(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var Yl=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=a.filter(Boolean),c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=ql(l,r,c),f=r,p={},m=0;for(let n=0;n<s.length;n++){let{name:a,fn:h}=s[n],{x:g,y:_,data:v,reset:y}=await h({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:p,rects:l,platform:{...o,detectOverflow:o.detectOverflow??Jl},elements:{reference:e,floating:t}});u=g??u,d=_??d,p={...p,[a]:{...p[a],...v}},y&&m<=50&&(m++,typeof y==`object`&&(y.placement&&(f=y.placement),y.rects&&(l=y.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):y.rects),{x:u,y:d}=ql(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:p}},Xl=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=El(e,t)||{};if(l==null)return{};let d=Gl(u),f={x:n,y:r},p=Nl(i),m=Al(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=vl(d[_],T),ee=vl(d[v],T),te=E,ne=C-h[m]-ee,D=C/2-h[m]/2+w,O=Tl(te,D,ne),re=!c.arrow&&Ol(i)!=null&&D!==O&&a.reference[m]/2-(D<te?E:ee)-h[m]/2<0,ie=re?D<te?D-te:D-ne:0;return{[p]:f[p]+ie,data:{[p]:O,centerOffset:D-O-ie,...re&&{alignmentOffset:ie}},reset:re}}}),Zl=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=El(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=Dl(r),_=Ml(o),v=Dl(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[Ul(o)]:Fl(o)),x=p!==`none`;!d&&x&&b.push(...Hl(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=Pl(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==Ml(t))||T.every(e=>Ml(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=Ml(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function Ql(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function $l(e){return _l.some(t=>e[t]>=0)}var eu=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=El(e,t);switch(i){case`referenceHidden`:{let e=Ql(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:$l(e)}}}case`escaped`:{let e=Ql(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:$l(e)}}}default:return{}}}}},tu=new Set([`left`,`top`]);async function nu(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=Dl(n),s=Ol(n),c=Ml(n)===`y`,l=tu.has(o)?-1:1,u=a&&c?-1:1,d=El(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var ru=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await nu(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},iu=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=El(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=Ml(Dl(i)),p=kl(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=Tl(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=Tl(n,h,r)}let g=c.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}}}}},au=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=El(e,t),u={x:n,y:r},d=Ml(i),f=kl(d),p=u[f],m=u[d],h=El(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=tu.has(Dl(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},ou=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=El(e,t),u=await o.detectOverflow(t,l),d=Dl(i),f=Ol(i),p=Ml(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=vl(h-u[g],v),x=vl(m-u[_],y),S=!t.middlewareData.shift,C=b,w=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(w=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=v),S&&!f){let e=yl(u.left,0),t=yl(u.right,0),n=yl(u.top,0),r=yl(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:yl(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:yl(u.top,u.bottom))}await c({...t,availableWidth:w,availableHeight:C});let T=await o.getDimensions(s.floating);return m!==T.width||h!==T.height?{reset:{rects:!0}}:{}}}};function su(){return typeof window<`u`}function cu(e){return du(e)?(e.nodeName||``).toLowerCase():`#document`}function lu(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function uu(e){return((du(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function du(e){return su()?e instanceof Node||e instanceof lu(e).Node:!1}function fu(e){return su()?e instanceof Element||e instanceof lu(e).Element:!1}function pu(e){return su()?e instanceof HTMLElement||e instanceof lu(e).HTMLElement:!1}function mu(e){return!su()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof lu(e).ShadowRoot}var hu=new Set([`inline`,`contents`]);function gu(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=ku(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!hu.has(i)}var _u=new Set([`table`,`td`,`th`]);function vu(e){return _u.has(cu(e))}var yu=[`:popover-open`,`:modal`];function bu(e){return yu.some(t=>{try{return e.matches(t)}catch{return!1}})}var xu=[`transform`,`translate`,`scale`,`rotate`,`perspective`],Su=[`transform`,`translate`,`scale`,`rotate`,`perspective`,`filter`],Cu=[`paint`,`layout`,`strict`,`content`];function wu(e){let t=Eu(),n=fu(e)?ku(e):e;return xu.some(e=>n[e]?n[e]!==`none`:!1)||(n.containerType?n.containerType!==`normal`:!1)||!t&&(n.backdropFilter?n.backdropFilter!==`none`:!1)||!t&&(n.filter?n.filter!==`none`:!1)||Su.some(e=>(n.willChange||``).includes(e))||Cu.some(e=>(n.contain||``).includes(e))}function Tu(e){let t=ju(e);for(;pu(t)&&!Ou(t);){if(wu(t))return t;if(bu(t))return null;t=ju(t)}return null}function Eu(){return typeof CSS>`u`||!CSS.supports?!1:CSS.supports(`-webkit-backdrop-filter`,`none`)}var Du=new Set([`html`,`body`,`#document`]);function Ou(e){return Du.has(cu(e))}function ku(e){return lu(e).getComputedStyle(e)}function Au(e){return fu(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ju(e){if(cu(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||mu(e)&&e.host||uu(e);return mu(t)?t.host:t}function Mu(e){let t=ju(e);return Ou(t)?e.ownerDocument?e.ownerDocument.body:e.body:pu(t)&&gu(t)?t:Mu(t)}function Nu(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Mu(e),i=r===e.ownerDocument?.body,a=lu(r);if(i){let e=Pu(a);return t.concat(a,a.visualViewport||[],gu(r)?r:[],e&&n?Nu(e):[])}return t.concat(r,Nu(r,[],n))}function Pu(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Fu(e){let t=ku(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=pu(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=bl(n)!==a||bl(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Iu(e){return fu(e)?e:e.contextElement}function Lu(e){let t=Iu(e);if(!pu(t))return Sl(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Fu(t),o=(a?bl(n.width):n.width)/r,s=(a?bl(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var Ru=Sl(0);function zu(e){let t=lu(e);return!Eu()||!t.visualViewport?Ru:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Bu(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==lu(e)?!1:t}function Vu(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=Iu(e),o=Sl(1);t&&(r?fu(r)&&(o=Lu(r)):o=Lu(e));let s=Bu(a,n,r)?zu(a):Sl(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=lu(a),t=r&&fu(r)?lu(r):r,n=e,i=Pu(n);for(;i&&r&&t!==n;){let e=Lu(i),t=i.getBoundingClientRect(),r=ku(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=lu(i),i=Pu(n)}}return Kl({width:u,height:d,x:c,y:l})}function Hu(e,t){let n=Au(e).scrollLeft;return t?t.left+n:Vu(uu(e)).left+n}function Uu(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-Hu(e,n),y:n.top+t.scrollTop}}function Wu(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=uu(r),s=t?bu(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=Sl(1),u=Sl(0),d=pu(r);if((d||!d&&!a)&&((cu(r)!==`body`||gu(o))&&(c=Au(r)),pu(r))){let e=Vu(r);l=Lu(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Uu(o,c):Sl(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function Gu(e){return Array.from(e.getClientRects())}function Ku(e){let t=uu(e),n=Au(e),r=e.ownerDocument.body,i=yl(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=yl(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+Hu(e),s=-n.scrollTop;return ku(r).direction===`rtl`&&(o+=yl(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var qu=25;function Ju(e,t){let n=lu(e),r=uu(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=Eu();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=Hu(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=qu&&(a-=o)}else l<=qu&&(a+=l);return{width:a,height:o,x:s,y:c}}var Yu=new Set([`absolute`,`fixed`]);function Xu(e,t){let n=Vu(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=pu(e)?Lu(e):Sl(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Zu(e,t,n){let r;if(t===`viewport`)r=Ju(e,n);else if(t===`document`)r=Ku(uu(e));else if(fu(t))r=Xu(t,n);else{let n=zu(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Kl(r)}function Qu(e,t){let n=ju(e);return n===t||!fu(n)||Ou(n)?!1:ku(n).position===`fixed`||Qu(n,t)}function $u(e,t){let n=t.get(e);if(n)return n;let r=Nu(e,[],!1).filter(e=>fu(e)&&cu(e)!==`body`),i=null,a=ku(e).position===`fixed`,o=a?ju(e):e;for(;fu(o)&&!Ou(o);){let t=ku(o),n=wu(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&Yu.has(i.position)||gu(o)&&!n&&Qu(e,o))?r=r.filter(e=>e!==o):i=t,o=ju(o)}return t.set(e,r),r}function ed(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?bu(t)?[]:$u(t,this._c):[].concat(n),r],o=a[0],s=a.reduce((e,n)=>{let r=Zu(t,n,i);return e.top=yl(r.top,e.top),e.right=vl(r.right,e.right),e.bottom=vl(r.bottom,e.bottom),e.left=yl(r.left,e.left),e},Zu(t,o,i));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}}function td(e){let{width:t,height:n}=Fu(e);return{width:t,height:n}}function nd(e,t,n){let r=pu(t),i=uu(t),a=n===`fixed`,o=Vu(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=Sl(0);function l(){c.x=Hu(i)}if(r||!r&&!a)if((cu(t)!==`body`||gu(i))&&(s=Au(t)),r){let e=Vu(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l();a&&!r&&i&&l();let u=i&&!r&&!a?Uu(i,s):Sl(0);return{x:o.left+s.scrollLeft-c.x-u.x,y:o.top+s.scrollTop-c.y-u.y,width:o.width,height:o.height}}function rd(e){return ku(e).position===`static`}function id(e,t){if(!pu(e)||ku(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return uu(e)===n&&(n=n.ownerDocument.body),n}function ad(e,t){let n=lu(e);if(bu(e))return n;if(!pu(e)){let t=ju(e);for(;t&&!Ou(t);){if(fu(t)&&!rd(t))return t;t=ju(t)}return n}let r=id(e,t);for(;r&&vu(r)&&rd(r);)r=id(r,t);return r&&Ou(r)&&rd(r)&&!wu(r)?n:r||Tu(e)||n}var od=async function(e){let t=this.getOffsetParent||ad,n=this.getDimensions,r=await n(e.floating);return{reference:nd(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function sd(e){return ku(e).direction===`rtl`}var cd={convertOffsetParentRelativeRectToViewportRelativeRect:Wu,getDocumentElement:uu,getClippingRect:ed,getOffsetParent:ad,getElementRects:od,getClientRects:Gu,getDimensions:td,getScale:Lu,isElement:fu,isRTL:sd};function ld(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function ud(e,t){let n=null,r,i=uu(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=xl(d),h=xl(i.clientWidth-(u+f)),g=xl(i.clientHeight-(d+p)),_=xl(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:yl(0,vl(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(n!==c){if(!y)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!ld(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function dd(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=Iu(e),u=i||a?[...l?Nu(l):[],...Nu(t)]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?ud(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),p.observe(t));let m,h=c?Vu(e):null;c&&g();function g(){let t=Vu(e);h&&!ld(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var fd=ru,pd=iu,md=Zl,hd=ou,gd=eu,_d=Xl,vd=au,yd=(e,t,n)=>{let r=new Map,i={platform:cd,...n},a={...i.platform,_c:r};return Yl(e,t,{...i,platform:a})},bd=typeof document<`u`?M.useLayoutEffect:function(){};function xd(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(!xd(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;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!xd(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function Sd(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Cd(e,t){let n=Sd(e);return Math.round(t*n)/n}function wd(e){let t=M.useRef(e);return bd(()=>{t.current=e}),t}function Td(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=M.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=M.useState(r);xd(f,r)||p(r);let[m,h]=M.useState(null),[g,_]=M.useState(null),v=M.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=M.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=M.useRef(null),C=M.useRef(null),w=M.useRef(u),T=c!=null,E=wd(c),ee=wd(i),te=wd(l),ne=M.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};ee.current&&(e.platform=ee.current),yd(S.current,C.current,e).then(e=>{let t={...e,isPositioned:te.current!==!1};D.current&&!xd(w.current,t)&&(w.current=t,Ca.flushSync(()=>{d(t)}))})},[f,t,n,ee,te]);bd(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let D=M.useRef(!1);bd(()=>(D.current=!0,()=>{D.current=!1}),[]),bd(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(E.current)return E.current(b,x,ne);ne()}},[b,x,ne,E,T]);let O=M.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),re=M.useMemo(()=>({reference:b,floating:x}),[b,x]),ie=M.useMemo(()=>{let e={position:n,left:0,top:0};if(!re.floating)return e;let t=Cd(re.floating,u.x),r=Cd(re.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...Sd(re.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,re.floating,u.x,u.y]);return M.useMemo(()=>({...u,update:ne,refs:O,elements:re,floatingStyles:ie}),[u,ne,O,re,ie])}var Ed=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:_d({element:r.current,padding:i}).fn(n):r?_d({element:r,padding:i}).fn(n):{}}}},Dd=(e,t)=>({...fd(e),options:[e,t]}),Od=(e,t)=>({...pd(e),options:[e,t]}),kd=(e,t)=>({...vd(e),options:[e,t]}),Ad=(e,t)=>({...md(e),options:[e,t]}),jd=(e,t)=>({...hd(e),options:[e,t]}),Md=(e,t)=>({...gd(e),options:[e,t]}),Nd=(e,t)=>({...Ed(e),options:[e,t]}),Pd=`Arrow`,Fd=M.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,P.jsx)(se.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,P.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});Fd.displayName=Pd;var Id=Fd;function Ld(e){let[t,n]=M.useState(void 0);return ae(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}else n(void 0)},[e]),t}var Rd=`Popper`,[zd,Bd]=n(Rd),[Vd,Hd]=zd(Rd),Ud=e=>{let{__scopePopper:t,children:n}=e,[r,i]=M.useState(null);return(0,P.jsx)(Vd,{scope:t,anchor:r,onAnchorChange:i,children:n})};Ud.displayName=Rd;var Wd=`PopperAnchor`,Gd=M.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,a=Hd(Wd,n),o=M.useRef(null),s=Ve(t,o),c=M.useRef(null);return M.useEffect(()=>{let e=c.current;c.current=r?.current||o.current,e!==c.current&&a.onAnchorChange(c.current)}),r?null:(0,P.jsx)(se.div,{...i,ref:s})});Gd.displayName=Wd;var Kd=`PopperContent`,[qd,Jd]=zd(Kd),Yd=M.forwardRef((e,t)=>{let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:u=0,sticky:d=`partial`,hideWhenDetached:f=!1,updatePositionStrategy:p=`optimized`,onPlaced:h,...g}=e,_=Hd(Kd,n),[v,y]=M.useState(null),b=Ve(t,e=>y(e)),[x,S]=M.useState(null),C=Ld(x),w=C?.width??0,T=C?.height??0,E=r+(a===`center`?``:`-`+a),ee=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},te=Array.isArray(l)?l:[l],ne=te.length>0,D={padding:ee,boundary:te.filter($d),altBoundary:ne},{refs:O,floatingStyles:re,placement:ie,isPositioned:oe,middlewareData:ce}=Td({strategy:`fixed`,placement:E,whileElementsMounted:(...e)=>dd(...e,{animationFrame:p===`always`}),elements:{reference:_.anchor},middleware:[Dd({mainAxis:i+T,alignmentAxis:o}),c&&Od({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?kd():void 0,...D}),c&&Ad({...D}),jd({...D,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)}}),x&&Nd({element:x,padding:s}),ef({arrowWidth:w,arrowHeight:T}),f&&Md({strategy:`referenceHidden`,...D})]}),[le,ue]=tf(ie),de=m(h);ae(()=>{oe&&de?.()},[oe,de]);let fe=ce.arrow?.x,pe=ce.arrow?.y,me=ce.arrow?.centerOffset!==0,[he,ge]=M.useState();return ae(()=>{v&&ge(window.getComputedStyle(v).zIndex)},[v]),(0,P.jsx)(`div`,{ref:O.setFloating,"data-radix-popper-content-wrapper":``,style:{...re,transform:oe?re.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:he,"--radix-popper-transform-origin":[ce.transformOrigin?.x,ce.transformOrigin?.y].join(` `),...ce.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,P.jsx)(qd,{scope:n,placedSide:le,onArrowChange:S,arrowX:fe,arrowY:pe,shouldHideArrow:me,children:(0,P.jsx)(se.div,{"data-side":le,"data-align":ue,...g,ref:b,style:{...g.style,animation:oe?void 0:`none`}})})})});Yd.displayName=Kd;var Xd=`PopperArrow`,Zd={top:`bottom`,right:`left`,bottom:`top`,left:`right`},Qd=M.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=Jd(Xd,n),a=Zd[i.placedSide];return(0,P.jsx)(`span`,{ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:(0,P.jsx)(Id,{...r,ref:t,style:{...r.style,display:`block`}})})});Qd.displayName=Xd;function $d(e){return e!==null}var ef=e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=tf(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}});function tf(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var nf=Ud,rf=Gd,af=Yd,of=Qd,sf=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),cf=`VisuallyHidden`,lf=M.forwardRef((e,t)=>(0,P.jsx)(se.span,{...e,ref:t,style:{...sf,...e.style}}));lf.displayName=cf;var uf=lf,[df,ff]=n(`Tooltip`,[Bd]),pf=Bd(),mf=`TooltipProvider`,hf=700,gf=`tooltip.open`,[_f,vf]=df(mf),yf=e=>{let{__scopeTooltip:t,delayDuration:n=hf,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=M.useRef(!0),s=M.useRef(!1),c=M.useRef(0);return M.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,P.jsx)(_f,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:M.useCallback(()=>{window.clearTimeout(c.current),o.current=!1},[]),onClose:M.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:s,onPointerInTransitChange:M.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};yf.displayName=mf;var bf=`Tooltip`,[xf,Sf]=df(bf),Cf=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:o,disableHoverableContent:s,delayDuration:c}=e,l=vf(bf,e.__scopeTooltip),u=pf(t),[d,f]=M.useState(null),p=O(),m=M.useRef(0),h=s??l.disableHoverableContent,g=c??l.delayDuration,_=M.useRef(!1),[v,y]=a({prop:r,defaultProp:i??!1,onChange:e=>{e?(l.onOpen(),document.dispatchEvent(new CustomEvent(gf))):l.onClose(),o?.(e)},caller:bf}),b=M.useMemo(()=>v?_.current?`delayed-open`:`instant-open`:`closed`,[v]),x=M.useCallback(()=>{window.clearTimeout(m.current),m.current=0,_.current=!1,y(!0)},[y]),S=M.useCallback(()=>{window.clearTimeout(m.current),m.current=0,y(!1)},[y]),C=M.useCallback(()=>{window.clearTimeout(m.current),m.current=window.setTimeout(()=>{_.current=!0,y(!0),m.current=0},g)},[g,y]);return M.useEffect(()=>()=>{m.current&&=(window.clearTimeout(m.current),0)},[]),(0,P.jsx)(nf,{...u,children:(0,P.jsx)(xf,{scope:t,contentId:p,open:v,stateAttribute:b,trigger:d,onTriggerChange:f,onTriggerEnter:M.useCallback(()=>{l.isOpenDelayedRef.current?C():x()},[l.isOpenDelayedRef,C,x]),onTriggerLeave:M.useCallback(()=>{h?S():(window.clearTimeout(m.current),m.current=0)},[S,h]),onOpen:x,onClose:S,disableHoverableContent:h,children:n})})};Cf.displayName=bf;var wf=`TooltipTrigger`,Tf=M.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=Sf(wf,n),a=vf(wf,n),o=pf(n),s=Ve(t,M.useRef(null),i.onTriggerChange),c=M.useRef(!1),l=M.useRef(!1),u=M.useCallback(()=>c.current=!1,[]);return M.useEffect(()=>()=>document.removeEventListener(`pointerup`,u),[u]),(0,P.jsx)(rf,{asChild:!0,...o,children:(0,P.jsx)(se.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:s,onPointerMove:k(e.onPointerMove,e=>{e.pointerType!==`touch`&&!l.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),l.current=!0)}),onPointerLeave:k(e.onPointerLeave,()=>{i.onTriggerLeave(),l.current=!1}),onPointerDown:k(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener(`pointerup`,u,{once:!0})}),onFocus:k(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:k(e.onBlur,i.onClose),onClick:k(e.onClick,i.onClose)})})});Tf.displayName=wf;var Ef=`TooltipPortal`,[Df,Of]=df(Ef,{forceMount:void 0}),kf=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=Sf(Ef,t);return(0,P.jsx)(Df,{scope:t,forceMount:n,children:(0,P.jsx)(ie,{present:n||a.open,children:(0,P.jsx)(p,{asChild:!0,container:i,children:r})})})};kf.displayName=Ef;var Af=`TooltipContent`,jf=M.forwardRef((e,t)=>{let n=Of(Af,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=Sf(Af,e.__scopeTooltip);return(0,P.jsx)(ie,{present:r||o.open,children:o.disableHoverableContent?(0,P.jsx)(If,{side:i,...a,ref:t}):(0,P.jsx)(Mf,{side:i,...a,ref:t})})}),Mf=M.forwardRef((e,t)=>{let n=Sf(Af,e.__scopeTooltip),r=vf(Af,e.__scopeTooltip),i=M.useRef(null),a=Ve(t,i),[o,s]=M.useState(null),{trigger:c,onClose:l}=n,u=i.current,{onPointerInTransitChange:d}=r,f=M.useCallback(()=>{s(null),d(!1)},[d]),p=M.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=Bf(r,zf(r,n.getBoundingClientRect())),a=Vf(t.getBoundingClientRect());s(Uf([...i,...a])),d(!0)},[d]);return M.useEffect(()=>()=>f(),[f]),M.useEffect(()=>{if(c&&u){let e=e=>p(e,u),t=e=>p(e,c);return c.addEventListener(`pointerleave`,e),u.addEventListener(`pointerleave`,t),()=>{c.removeEventListener(`pointerleave`,e),u.removeEventListener(`pointerleave`,t)}}},[c,u,p,f]),M.useEffect(()=>{if(o){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||u?.contains(t),i=!Hf(n,o);r?f():i&&(f(),l())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,f]),(0,P.jsx)(If,{...e,ref:a})}),[Nf,Pf]=df(bf,{isInside:!1}),Ff=ee(`TooltipContent`),If=M.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,c=Sf(Af,n),l=pf(n),{onClose:u}=c;return M.useEffect(()=>(document.addEventListener(gf,u),()=>document.removeEventListener(gf,u)),[u]),M.useEffect(()=>{if(c.trigger){let e=e=>{e.target?.contains(c.trigger)&&u()};return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[c.trigger,u]),(0,P.jsx)(h,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:u,children:(0,P.jsxs)(af,{"data-state":c.stateAttribute,...l,...s,ref:t,style:{...s.style,"--radix-tooltip-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-tooltip-content-available-width":`var(--radix-popper-available-width)`,"--radix-tooltip-content-available-height":`var(--radix-popper-available-height)`,"--radix-tooltip-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-tooltip-trigger-height":`var(--radix-popper-anchor-height)`},children:[(0,P.jsx)(Ff,{children:r}),(0,P.jsx)(Nf,{scope:n,isInside:!0,children:(0,P.jsx)(uf,{id:c.contentId,role:`tooltip`,children:i||r})})]})})});jf.displayName=Af;var Lf=`TooltipArrow`,Rf=M.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=pf(n);return Pf(Lf,n).isInside?null:(0,P.jsx)(of,{...i,...r,ref:t})});Rf.displayName=Lf;function zf(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}function Bf(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function Vf(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function Hf(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function Uf(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:+(e.y>t.y)),Wf(t)}function Wf(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var Gf=yf,Kf=Cf,qf=Tf,Jf=kf,Yf=jf,Xf=Gf,Zf=Kf,Qf=qf,$f=M.forwardRef((e,t)=>{let n=(0,F.c)(11),r,i,a;n[0]===e?(r=n[1],i=n[2],a=n[3]):({className:r,sideOffset:a,...i}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a);let o=a===void 0?4:a,s;n[4]===r?s=n[5]:(s=A(`z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-base text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,r),n[4]=r,n[5]=s);let c;return n[6]!==i||n[7]!==t||n[8]!==o||n[9]!==s?(c=(0,P.jsx)(Jf,{children:(0,P.jsx)(Yf,{ref:t,sideOffset:o,className:s,...i})}),n[6]=i,n[7]=t,n[8]=o,n[9]=s,n[10]=c):c=n[10],c});$f.displayName=Yf.displayName;function ep(e){let t=(0,F.c)(16),{className:n,label:r,size:i,overScenic:a}=e,o=i===void 0?`md`:i,s=a===void 0?!1:a,l=o===`sm`?`h-4 w-4`:o===`lg`?`h-8 w-8`:`h-6 w-6`,u;t[0]===n?u=t[1]:(u=A(`flex h-full items-center justify-center`,n),t[0]=n,t[1]=u);let d=s?`scenic-foreground`:`text-muted-foreground`,f;t[2]!==l||t[3]!==d?(f=A(l,`animate-spin mx-auto`,d),t[2]=l,t[3]=d,t[4]=f):f=t[4];let p;t[5]===f?p=t[6]:(p=(0,P.jsx)(c,{className:f}),t[5]=f,t[6]=p);let m;t[7]!==r||t[8]!==s?(m=r?(0,P.jsx)(`p`,{className:A(s?A(j.body,`scenic-foreground-muted`):j.bodyMuted,`mt-2`),children:r}):null,t[7]=r,t[8]=s,t[9]=m):m=t[9];let h;t[10]!==p||t[11]!==m?(h=(0,P.jsxs)(`div`,{className:`text-center`,children:[p,m]}),t[10]=p,t[11]=m,t[12]=h):h=t[12];let g;return t[13]!==u||t[14]!==h?(g=(0,P.jsx)(`div`,{className:u,children:h}),t[13]=u,t[14]=h,t[15]=g):g=t[15],g}function tp(){let e=(0,F.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,P.jsx)(`div`,{className:`space-y-1 px-2 py-2`,children:[1,2,3].map(np)}),e[0]=t):t=e[0],t}function np(e){return(0,P.jsx)(`div`,{className:`animate-pulse h-7 bg-muted rounded-full`},e)}function rp(){let e=(0,F.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,P.jsx)(`div`,{className:`animate-pulse h-4 bg-muted rounded mx-4 my-1`}),e[0]=t):t=e[0],t}var ip=gl(e=>(0,P.jsxs)(`div`,{className:e.v0,children:[(0,P.jsx)(`div`,{className:e.v1,children:e.v2}),(0,P.jsx)(`div`,{className:e.v3,children:e.v4})]}),{name:`SettingsFieldRow_1`,portals:[`v2`,`v4`]}),ap=function(e){let t=(0,F.c)(7),{label:n,control:r,className:i,align:a}=e,o=(a===void 0?`center`:a)===`start`?`@md/settings-page:items-start`:null,s;t[0]!==i||t[1]!==o?(s=A(_e.settingsFieldRow,o,i),t[0]=i,t[1]=o,t[2]=s):s=t[2];let c;return t[3]!==r||t[4]!==n||t[5]!==s?(c=(0,P.jsx)(ip,{v0:s,v1:_e.settingsFieldLabel,v2:n,v3:_e.settingsFieldControl,v4:r}),t[3]=r,t[4]=n,t[5]=s,t[6]=c):c=t[6],c},op=gl(e=>(0,P.jsxs)(`div`,{className:e.v0,children:[(0,P.jsxs)(`div`,{className:e.v1,children:[(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`h2`,{className:e.v2,children:e.v3}),e.v4]}),e.v5]}),e.v6]}),{name:`PageHeader_1`,portals:[`v3`,`v4`,`v5`,`v6`]}),sp=function(e){let t=(0,F.c)(21),{title:n,description:r,action:i,className:a,titleClassName:o,tableHeader:s,sticky:c,border:l}=e,u=c===void 0?!0:c,d=l===void 0?!1:l,f=u?`sticky top-0 z-10 -mx-6`:null,p;t[0]!==a||t[1]!==f?(p=A(`shrink-0`,f,a),t[0]=a,t[1]=f,t[2]=p):p=t[2];let m=d&&!s?`border-b border-divider`:null,h;t[3]===m?h=t[4]:(h=A(`flex items-center justify-between bg-transparent px-6 py-4 electrobun-webkit-app-region-drag`,m),t[3]=m,t[4]=h);let g;t[5]===o?g=t[6]:(g=A(j.sectionTitle,o),t[5]=o,t[6]=g);let _;t[7]===r?_=t[8]:(_=r?(0,P.jsx)(`p`,{className:A(j.pageSubtitle,`pt-1.5`),children:r}):null,t[7]=r,t[8]=_);let v;t[9]===i?v=t[10]:(v=i?(0,P.jsx)(`div`,{className:`electrobun-webkit-app-region-no-drag`,children:i}):null,t[9]=i,t[10]=v);let y;t[11]===s?y=t[12]:(y=s?(0,P.jsx)(`div`,{className:`electrobun-webkit-app-region-no-drag px-6 pb-2`,children:s}):null,t[11]=s,t[12]=y);let b;return t[13]!==y||t[14]!==p||t[15]!==h||t[16]!==g||t[17]!==_||t[18]!==v||t[19]!==n?(b=(0,P.jsx)(op,{v0:p,v1:h,v2:g,v3:n,v4:_,v5:v,v6:y}),t[13]=y,t[14]=p,t[15]=h,t[16]=g,t[17]=_,t[18]=v,t[19]=n,t[20]=b):b=t[20],b};function cp(e){let t=(0,F.c)(5),{children:n,className:r}=e,i;t[0]===r?i=t[1]:(i=A(_e.settingsPage,r),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,P.jsx)(`div`,{className:i,children:n}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a}function lp(e){let t=(0,F.c)(5),{children:n,className:r}=e,i;t[0]===r?i=t[1]:(i=A(_e.formPage,r),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,P.jsx)(`div`,{className:i,children:n}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a}function up(e){let t=(0,F.c)(16),{title:n,description:r,action:i,titleClassName:a,tableHeader:o,border:s,children:c,pageClassName:l,className:u}=e,d=s===void 0?!1:s,f;t[0]===u?f=t[1]:(f=A(`flex h-full min-h-0 flex-col`,u),t[0]=u,t[1]=f);let p;t[2]!==i||t[3]!==d||t[4]!==r||t[5]!==o||t[6]!==n||t[7]!==a?(p=(0,P.jsx)(sp,{title:n,description:r,action:i,titleClassName:a,tableHeader:o,border:d,sticky:!1}),t[2]=i,t[3]=d,t[4]=r,t[5]=o,t[6]=n,t[7]=a,t[8]=p):p=t[8];let m;t[9]!==c||t[10]!==l?(m=(0,P.jsx)(g,{className:`min-h-0 flex-1`,children:(0,P.jsx)(cp,{className:l,children:c})}),t[9]=c,t[10]=l,t[11]=m):m=t[11];let h;return t[12]!==f||t[13]!==p||t[14]!==m?(h=(0,P.jsxs)(`div`,{className:f,children:[p,m]}),t[12]=f,t[13]=p,t[14]=m,t[15]=h):h=t[15],h}function dp(e){let t=(0,F.c)(5),{title:n,className:r}=e,i;t[0]===r?i=t[1]:(i=A(j.sectionTitle,`mb-3`,r),t[0]=r,t[1]=i);let a;return t[2]!==i||t[3]!==n?(a=(0,P.jsx)(`h2`,{className:i,children:n}),t[2]=i,t[3]=n,t[4]=a):a=t[4],a}function fp(e){let t=(0,F.c)(6),{children:n,variant:r,className:i}=e,a=r===void 0?`info`:r,o;t[0]!==i||t[1]!==a?(o=A(a===`hint`?j.hintBanner:a===`success`?A(j.body,`text-green-700 bg-green-50 dark:text-green-400 dark:bg-green-950/30 rounded-md px-3 py-2 mb-4`):a===`error`?A(j.error,`bg-destructive/10 rounded-md px-3 py-2 mb-4`):j.infoBanner,i),t[0]=i,t[1]=a,t[2]=o):o=t[2];let s;return t[3]!==n||t[4]!==o?(s=(0,P.jsx)(`div`,{className:o,children:n}),t[3]=n,t[4]=o,t[5]=s):s=t[5],s}function pp(e){let t=(0,F.c)(5),{children:n,className:r}=e,i;t[0]===r?i=t[1]:(i=A(`min-h-0 flex-1`,r),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,P.jsx)(f,{className:i,children:n}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a}function mp(e){let t=(0,F.c)(10),{children:n,title:r,action:i}=e,a;t[0]===r?a=t[1]:(a=r?(0,P.jsx)(`h2`,{className:A(j.emptyStateTitle,`mb-2`),children:r}):null,t[0]=r,t[1]=a);let o;t[2]===n?o=t[3]:(o=(0,P.jsx)(`p`,{className:j.bodyMuted,children:n}),t[2]=n,t[3]=o);let s;t[4]===i?s=t[5]:(s=i?(0,P.jsx)(`div`,{className:`mt-4`,children:i}):null,t[4]=i,t[5]=s);let c;return t[6]!==a||t[7]!==o||t[8]!==s?(c=(0,P.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,P.jsxs)(`div`,{className:`text-center`,children:[a,o,s]})}),t[6]=a,t[7]=o,t[8]=s,t[9]=c):c=t[9],c}function hp(e){let t=(0,F.c)(5),{children:n,className:r}=e,i;t[0]===r?i=t[1]:(i=A(`h-full flex flex-col overflow-hidden`,r),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,P.jsx)(`div`,{className:i,children:n}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a}function gp(e){let t=(0,F.c)(5),{children:n,className:r}=e,i;t[0]===r?i=t[1]:(i=A(`flex flex-col overflow-hidden rounded-xl`,r),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,P.jsx)(`div`,{className:i,children:n}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a}var _p=`animate-in fade-in duration-[50ms]`;function vp(e){let t=(0,F.c)(10),{loading:n,children:r,className:i,containerRef:a}=e;if(n){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,P.jsx)(ep,{className:`min-h-0 flex-1`}),t[0]=e):e=t[0],e}let o;t[1]===i?o=t[2]:(o=A(`h-full min-h-0 flex-1`,i),t[1]=i,t[2]=o);let s;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=A(`flex flex-col gap-2.5`,_p),t[3]=s):s=t[3];let c;t[4]===r?c=t[5]:(c=(0,P.jsx)(`div`,{className:s,children:r}),t[4]=r,t[5]=c);let l;return t[6]!==a||t[7]!==o||t[8]!==c?(l=(0,P.jsx)(g,{ref:a,className:o,children:c}),t[6]=a,t[7]=o,t[8]=c,t[9]=l):l=t[9],l}function yp(e){let t=(0,F.c)(6),{loading:n,children:r,className:i}=e;if(n){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,P.jsx)(ep,{className:`min-h-0 flex-1`}),t[0]=e):e=t[0],e}let a;t[1]===i?a=t[2]:(a=A(`flex h-full min-h-0 flex-col overflow-hidden`,_p,i),t[1]=i,t[2]=a);let o;return t[3]!==r||t[4]!==a?(o=(0,P.jsx)(`div`,{className:a,children:r}),t[3]=r,t[4]=a,t[5]=o):o=t[5],o}function bp(e){let t=(0,F.c)(9),{label:n,control:r,className:i,align:a}=e,o=(a===void 0?`start`:a)===`end`?`justify-between`:`flex-wrap`,s;t[0]!==i||t[1]!==o?(s=A(`flex w-full items-center gap-x-4 gap-y-2`,o,i),t[0]=i,t[1]=o,t[2]=s):s=t[2];let c;t[3]===r?c=t[4]:(c=(0,P.jsx)(`div`,{className:`w-fit shrink-0`,children:r}),t[3]=r,t[4]=c);let l;return t[5]!==n||t[6]!==s||t[7]!==c?(l=(0,P.jsxs)(`div`,{className:s,children:[n,c]}),t[5]=n,t[6]=s,t[7]=c,t[8]=l):l=t[8],l}function xp(e,t,n){let r=A(j.label,`w-fit`,n?`cursor-pointer hover:underline`:t?`cursor-help`:null),i=n?(0,P.jsx)(`button`,{type:`button`,tabIndex:0,className:A(r,`border-0 bg-transparent p-0 text-left`),onClick:n,"aria-label":`${e} (click to reset)`,children:e}):(0,P.jsx)(`span`,{tabIndex:t?0:void 0,className:r,children:e});return t?(0,P.jsxs)(Zf,{children:[(0,P.jsx)(Qf,{asChild:!0,children:i}),(0,P.jsx)($f,{side:`top`,className:`max-w-xs`,children:t})]}):i}function Sp(e){let t=(0,F.c)(6),{children:n,className:r,id:i}=e,a;t[0]===r?a=t[1]:(a=A(_e.settingsFieldStack,r),t[0]=r,t[1]=a);let o;return t[2]!==n||t[3]!==i||t[4]!==a?(o=(0,P.jsx)(`div`,{id:i,className:a,children:n}),t[2]=n,t[3]=i,t[4]=a,t[5]=o):o=t[5],o}function Cp(e){let t=(0,F.c)(59),{title:n,description:r,action:i,children:a,className:o,controlLayout:s,onTitleClick:c}=e,l=s===void 0?`responsive-row`:s,u;t[0]!==r||t[1]!==c||t[2]!==n?(u=xp(n,r,c),t[0]=r,t[1]=c,t[2]=n,t[3]=u):u=t[3];let d=u,f=l===`responsive-row`,p=l===`row-end`?`end`:l===`row-start`?`start`:null;if(i&&a){if(f){let e;t[4]===o?e=t[5]:(e=A(`space-y-2`,o),t[4]=o,t[5]=e);let n;t[6]!==i||t[7]!==d?(n=(0,P.jsx)(ap,{label:d,control:i}),t[6]=i,t[7]=d,t[8]=n):n=t[8];let r;return t[9]!==a||t[10]!==e||t[11]!==n?(r=(0,P.jsxs)(`div`,{className:e,children:[n,a]}),t[9]=a,t[10]=e,t[11]=n,t[12]=r):r=t[12],r}if(p){let e;t[13]===o?e=t[14]:(e=A(`space-y-2`,o),t[13]=o,t[14]=e);let n;t[15]!==i||t[16]!==d||t[17]!==p?(n=(0,P.jsx)(bp,{label:d,control:i,align:p}),t[15]=i,t[16]=d,t[17]=p,t[18]=n):n=t[18];let r;return t[19]!==a||t[20]!==e||t[21]!==n?(r=(0,P.jsxs)(`div`,{className:e,children:[n,a]}),t[19]=a,t[20]=e,t[21]=n,t[22]=r):r=t[22],r}let e;t[23]===o?e=t[24]:(e=A(`space-y-2`,o),t[23]=o,t[24]=e);let n;t[25]===i?n=t[26]:(n=(0,P.jsx)(`div`,{children:i}),t[25]=i,t[26]=n);let r;return t[27]!==a||t[28]!==d||t[29]!==e||t[30]!==n?(r=(0,P.jsxs)(`div`,{className:e,children:[d,n,a]}),t[27]=a,t[28]=d,t[29]=e,t[30]=n,t[31]=r):r=t[31],r}if(i){if(f){let e;return t[32]!==i||t[33]!==o||t[34]!==d?(e=(0,P.jsx)(ap,{label:d,control:i,className:o}),t[32]=i,t[33]=o,t[34]=d,t[35]=e):e=t[35],e}if(p){let e;return t[36]!==i||t[37]!==o||t[38]!==d||t[39]!==p?(e=(0,P.jsx)(bp,{label:d,control:i,align:p,className:o}),t[36]=i,t[37]=o,t[38]=d,t[39]=p,t[40]=e):e=t[40],e}let e;t[41]===o?e=t[42]:(e=A(`space-y-2`,o),t[41]=o,t[42]=e);let n;t[43]===i?n=t[44]:(n=(0,P.jsx)(`div`,{children:i}),t[43]=i,t[44]=n);let r;return t[45]!==d||t[46]!==e||t[47]!==n?(r=(0,P.jsxs)(`div`,{className:e,children:[d,n]}),t[45]=d,t[46]=e,t[47]=n,t[48]=r):r=t[48],r}if(f&&a){let e;return t[49]!==a||t[50]!==o||t[51]!==d?(e=(0,P.jsx)(ap,{label:d,control:a,className:o,align:`start`}),t[49]=a,t[50]=o,t[51]=d,t[52]=e):e=t[52],e}let m;t[53]===o?m=t[54]:(m=A(`space-y-2`,o),t[53]=o,t[54]=m);let h;return t[55]!==a||t[56]!==d||t[57]!==m?(h=(0,P.jsxs)(`div`,{className:m,children:[d,a]}),t[55]=a,t[56]=d,t[57]=m,t[58]=h):h=t[58],h}var wp=[`Enter`,` `],Tp=[`ArrowDown`,`PageUp`,`Home`],Ep=[`ArrowUp`,`PageDown`,`End`],Dp=[...Tp,...Ep],Op={ltr:[...wp,`ArrowRight`],rtl:[...wp,`ArrowLeft`]},kp={ltr:[`ArrowLeft`],rtl:[`ArrowRight`]},Ap=`Menu`,[jp,Mp,Np]=T(Ap),[Pp,Fp]=n(Ap,[Np,Bd,ke]),Ip=Bd(),Lp=ke(),[Rp,zp]=Pp(Ap),[Bp,Vp]=Pp(Ap),Hp=e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=Ip(t),[c,l]=M.useState(null),u=M.useRef(!1),d=m(a),f=Je(i);return M.useEffect(()=>{let e=()=>{u.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},t=()=>u.current=!1;return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),(0,P.jsx)(nf,{...s,children:(0,P.jsx)(Rp,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,P.jsx)(Bp,{scope:t,onClose:M.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})};Hp.displayName=Ap;var Up=`MenuAnchor`,Wp=M.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=Ip(n);return(0,P.jsx)(rf,{...i,...r,ref:t})});Wp.displayName=Up;var Gp=`MenuPortal`,[Kp,qp]=Pp(Gp,{forceMount:void 0}),Jp=e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=zp(Gp,t);return(0,P.jsx)(Kp,{scope:t,forceMount:n,children:(0,P.jsx)(ie,{present:n||a.open,children:(0,P.jsx)(p,{asChild:!0,container:i,children:r})})})};Jp.displayName=Gp;var Yp=`MenuContent`,[Xp,Zp]=Pp(Yp),Qp=M.forwardRef((e,t)=>{let n=qp(Yp,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=zp(Yp,e.__scopeMenu),o=Vp(Yp,e.__scopeMenu);return(0,P.jsx)(jp.Provider,{scope:e.__scopeMenu,children:(0,P.jsx)(ie,{present:r||a.open,children:(0,P.jsx)(jp.Slot,{scope:e.__scopeMenu,children:o.modal?(0,P.jsx)($p,{...i,ref:t}):(0,P.jsx)(em,{...i,ref:t})})})})}),$p=M.forwardRef((e,t)=>{let n=zp(Yp,e.__scopeMenu),r=M.useRef(null),i=Ve(t,r);return M.useEffect(()=>{let e=r.current;if(e)return x(e)},[]),(0,P.jsx)(nm,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:k(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),em=M.forwardRef((e,t)=>{let n=zp(Yp,e.__scopeMenu);return(0,P.jsx)(nm,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),tm=le(`MenuContent.ScrollLock`),nm=M.forwardRef((e,t)=>{let{__scopeMenu:n,loop:r=!1,trapFocus:a,onOpenAutoFocus:o,onCloseAutoFocus:s,disableOutsidePointerEvents:c,onEntryFocus:l,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:p,onInteractOutside:m,onDismiss:g,disableOutsideScroll:v,...b}=e,x=zp(Yp,n),S=Vp(Yp,n),C=Ip(n),w=Lp(n),T=Mp(n),[E,ee]=M.useState(null),te=M.useRef(null),ne=Ve(t,te,x.onContentChange),D=M.useRef(0),O=M.useRef(``),re=M.useRef(0),ie=M.useRef(null),ae=M.useRef(`right`),oe=M.useRef(0),se=v?u:M.Fragment,ce=v?{as:tm,allowPinchZoom:!0}:void 0,le=e=>{let t=O.current+e,n=T().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=Bm(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;(function e(t){O.current=t,window.clearTimeout(D.current),t!==``&&(D.current=window.setTimeout(()=>e(``),1e3))})(t),o&&setTimeout(()=>o.focus())};M.useEffect(()=>()=>window.clearTimeout(D.current),[]),y();let ue=M.useCallback(e=>ae.current===ie.current?.side&&Hm(e,ie.current?.area),[]);return(0,P.jsx)(Xp,{scope:n,searchRef:O,onItemEnter:M.useCallback(e=>{ue(e)&&e.preventDefault()},[ue]),onItemLeave:M.useCallback(e=>{ue(e)||(te.current?.focus(),ee(null))},[ue]),onTriggerLeave:M.useCallback(e=>{ue(e)&&e.preventDefault()},[ue]),pointerGraceTimerRef:re,onPointerGraceIntentChange:M.useCallback(e=>{ie.current=e},[]),children:(0,P.jsx)(se,{...ce,children:(0,P.jsx)(_,{asChild:!0,trapped:a,onMountAutoFocus:k(o,e=>{e.preventDefault(),te.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:s,children:(0,P.jsx)(h,{asChild:!0,disableOutsidePointerEvents:c,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:p,onInteractOutside:m,onDismiss:g,children:(0,P.jsx)(i,{asChild:!0,...w,dir:S.dir,orientation:`vertical`,loop:r,currentTabStopId:E,onCurrentTabStopIdChange:ee,onEntryFocus:k(l,e=>{S.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,P.jsx)(af,{role:`menu`,"aria-orientation":`vertical`,"data-state":Fm(x.open),"data-radix-menu-content":``,dir:S.dir,...C,...b,ref:ne,style:{outline:`none`,...b.style},onKeyDown:k(b.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&le(e.key));let i=te.current;if(e.target!==i||!Dp.includes(e.key))return;e.preventDefault();let a=T().filter(e=>!e.disabled).map(e=>e.ref.current);Ep.includes(e.key)&&a.reverse(),Rm(a)}),onBlur:k(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(D.current),O.current=``)}),onPointerMove:k(e.onPointerMove,Um(e=>{let t=e.target,n=oe.current!==e.clientX;e.currentTarget.contains(t)&&n&&(ae.current=e.clientX>oe.current?`right`:`left`,oe.current=e.clientX)}))})})})})})})});Qp.displayName=Yp;var rm=`MenuGroup`,im=M.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,P.jsx)(se.div,{role:`group`,...r,ref:t})});im.displayName=rm;var am=`MenuLabel`,om=M.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,P.jsx)(se.div,{...r,ref:t})});om.displayName=am;var sm=`MenuItem`,cm=`menu.itemSelect`,lm=M.forwardRef((e,t)=>{let{disabled:n=!1,onSelect:r,...i}=e,a=M.useRef(null),o=Vp(sm,e.__scopeMenu),s=Zp(sm,e.__scopeMenu),c=Ve(t,a),l=M.useRef(!1),u=()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(cm,{bubbles:!0,cancelable:!0});e.addEventListener(cm,e=>r?.(e),{once:!0}),oe(e,t),t.defaultPrevented?l.current=!1:o.onClose()}};return(0,P.jsx)(um,{...i,ref:c,disabled:n,onClick:k(e.onClick,u),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:k(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:k(e.onKeyDown,e=>{let t=s.searchRef.current!==``;n||t&&e.key===` `||wp.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});lm.displayName=sm;var um=M.forwardRef((e,t)=>{let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=Zp(sm,n),s=Lp(n),c=M.useRef(null),l=Ve(t,c),[u,d]=M.useState(!1),[f,p]=M.useState(``);return M.useEffect(()=>{let e=c.current;e&&p((e.textContent??``).trim())},[a.children]),(0,P.jsx)(jp.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:(0,P.jsx)(Ae,{asChild:!0,...s,focusable:!r,children:(0,P.jsx)(se.div,{role:`menuitem`,"data-highlighted":u?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:l,onPointerMove:k(e.onPointerMove,Um(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:k(e.onPointerLeave,Um(e=>o.onItemLeave(e))),onFocus:k(e.onFocus,()=>d(!0)),onBlur:k(e.onBlur,()=>d(!1))})})})}),dm=`MenuCheckboxItem`,fm=M.forwardRef((e,t)=>{let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,P.jsx)(bm,{scope:e.__scopeMenu,checked:n,children:(0,P.jsx)(lm,{role:`menuitemcheckbox`,"aria-checked":Im(n)?`mixed`:n,...i,ref:t,"data-state":Lm(n),onSelect:k(i.onSelect,()=>r?.(Im(n)?!0:!n),{checkForDefaultPrevented:!1})})})});fm.displayName=dm;var pm=`MenuRadioGroup`,[mm,hm]=Pp(pm,{value:void 0,onValueChange:()=>{}}),gm=M.forwardRef((e,t)=>{let{value:n,onValueChange:r,...i}=e,a=m(r);return(0,P.jsx)(mm,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,P.jsx)(im,{...i,ref:t})})});gm.displayName=pm;var _m=`MenuRadioItem`,vm=M.forwardRef((e,t)=>{let{value:n,...r}=e,i=hm(_m,e.__scopeMenu),a=n===i.value;return(0,P.jsx)(bm,{scope:e.__scopeMenu,checked:a,children:(0,P.jsx)(lm,{role:`menuitemradio`,"aria-checked":a,...r,ref:t,"data-state":Lm(a),onSelect:k(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});vm.displayName=_m;var ym=`MenuItemIndicator`,[bm,xm]=Pp(ym,{checked:!1}),Sm=M.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:r,...i}=e,a=xm(ym,n);return(0,P.jsx)(ie,{present:r||Im(a.checked)||a.checked===!0,children:(0,P.jsx)(se.span,{...i,ref:t,"data-state":Lm(a.checked)})})});Sm.displayName=ym;var Cm=`MenuSeparator`,wm=M.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,P.jsx)(se.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})});wm.displayName=Cm;var Tm=`MenuArrow`,Em=M.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=Ip(n);return(0,P.jsx)(of,{...i,...r,ref:t})});Em.displayName=Tm;var Dm=`MenuSub`,[Om,km]=Pp(Dm),Am=e=>{let{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,a=zp(Dm,t),o=Ip(t),[s,c]=M.useState(null),[l,u]=M.useState(null),d=m(i);return M.useEffect(()=>(a.open===!1&&d(!1),()=>d(!1)),[a.open,d]),(0,P.jsx)(nf,{...o,children:(0,P.jsx)(Rp,{scope:t,open:r,onOpenChange:d,content:l,onContentChange:u,children:(0,P.jsx)(Om,{scope:t,contentId:O(),triggerId:O(),trigger:s,onTriggerChange:c,children:n})})})};Am.displayName=Dm;var jm=`MenuSubTrigger`,Mm=M.forwardRef((e,t)=>{let n=zp(jm,e.__scopeMenu),r=Vp(jm,e.__scopeMenu),i=km(jm,e.__scopeMenu),a=Zp(jm,e.__scopeMenu),o=M.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:c}=a,l={__scopeMenu:e.__scopeMenu},u=M.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return M.useEffect(()=>u,[u]),M.useEffect(()=>{let e=s.current;return()=>{window.clearTimeout(e),c(null)}},[s,c]),(0,P.jsx)(Wp,{asChild:!0,...l,children:(0,P.jsx)(um,{id:i.triggerId,"aria-haspopup":`menu`,"aria-expanded":n.open,"aria-controls":i.contentId,"data-state":Fm(n.open),...e,ref:fe(t,i.onTriggerChange),onClick:t=>{e.onClick?.(t),!(e.disabled||t.defaultPrevented)&&(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:k(e.onPointerMove,Um(t=>{a.onItemEnter(t),!t.defaultPrevented&&!e.disabled&&!n.open&&!o.current&&(a.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:k(e.onPointerLeave,Um(e=>{u();let t=n.content?.getBoundingClientRect();if(t){let r=n.content?.dataset.side,i=r===`right`,o=i?-5:5,c=t[i?`left`:`right`],l=t[i?`right`:`left`];a.onPointerGraceIntentChange({area:[{x:e.clientX+o,y:e.clientY},{x:c,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:c,y:t.bottom}],side:r}),window.clearTimeout(s.current),s.current=window.setTimeout(()=>a.onPointerGraceIntentChange(null),300)}else{if(a.onTriggerLeave(e),e.defaultPrevented)return;a.onPointerGraceIntentChange(null)}})),onKeyDown:k(e.onKeyDown,t=>{let i=a.searchRef.current!==``;e.disabled||i&&t.key===` `||Op[r.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})});Mm.displayName=jm;var Nm=`MenuSubContent`,Pm=M.forwardRef((e,t)=>{let n=qp(Yp,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=zp(Yp,e.__scopeMenu),o=Vp(Yp,e.__scopeMenu),s=km(Nm,e.__scopeMenu),c=M.useRef(null),l=Ve(t,c);return(0,P.jsx)(jp.Provider,{scope:e.__scopeMenu,children:(0,P.jsx)(ie,{present:r||a.open,children:(0,P.jsx)(jp.Slot,{scope:e.__scopeMenu,children:(0,P.jsx)(nm,{id:s.contentId,"aria-labelledby":s.triggerId,...i,ref:l,align:`start`,side:o.dir===`rtl`?`left`:`right`,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{o.isUsingKeyboardRef.current&&c.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:k(e.onFocusOutside,e=>{e.target!==s.trigger&&a.onOpenChange(!1)}),onEscapeKeyDown:k(e.onEscapeKeyDown,e=>{o.onClose(),e.preventDefault()}),onKeyDown:k(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=kp[o.dir].includes(e.key);t&&n&&(a.onOpenChange(!1),s.trigger?.focus(),e.preventDefault())})})})})})});Pm.displayName=Nm;function Fm(e){return e?`open`:`closed`}function Im(e){return e===`indeterminate`}function Lm(e){return Im(e)?`indeterminate`:e?`checked`:`unchecked`}function Rm(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function zm(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function Bm(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=zm(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function Vm(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function Hm(e,t){return t?Vm({x:e.clientX,y:e.clientY},t):!1}function Um(e){return t=>t.pointerType===`mouse`?e(t):void 0}var Wm=Hp,Gm=Wp,Km=Jp,qm=Qp,Jm=im,Ym=om,Xm=lm,Zm=fm,Qm=gm,$m=vm,eh=Sm,th=wm,nh=Em,rh=Am,ih=Mm,ah=Pm,oh=`DropdownMenu`,[sh,ch]=n(oh,[Fp]),lh=Fp(),[uh,dh]=sh(oh),fh=e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:o,onOpenChange:s,modal:c=!0}=e,l=lh(t),u=M.useRef(null),[d,f]=a({prop:i,defaultProp:o??!1,onChange:s,caller:oh});return(0,P.jsx)(uh,{scope:t,triggerId:O(),triggerRef:u,contentId:O(),open:d,onOpenChange:f,onOpenToggle:M.useCallback(()=>f(e=>!e),[f]),modal:c,children:(0,P.jsx)(Wm,{...l,open:d,onOpenChange:f,dir:r,modal:c,children:n})})};fh.displayName=oh;var ph=`DropdownMenuTrigger`,mh=M.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=dh(ph,n),o=lh(n);return(0,P.jsx)(Gm,{asChild:!0,...o,children:(0,P.jsx)(se.button,{type:`button`,id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,disabled:r,...i,ref:fe(t,a.triggerRef),onPointerDown:k(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:k(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})});mh.displayName=ph;var hh=`DropdownMenuPortal`,gh=e=>{let{__scopeDropdownMenu:t,...n}=e,r=lh(t);return(0,P.jsx)(Km,{...r,...n})};gh.displayName=hh;var _h=`DropdownMenuContent`,vh=M.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=dh(_h,n),a=lh(n),o=M.useRef(!1);return(0,P.jsx)(qm,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:k(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:k(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});vh.displayName=_h;var yh=`DropdownMenuGroup`,bh=M.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=lh(n);return(0,P.jsx)(Jm,{...i,...r,ref:t})});bh.displayName=yh;var xh=`DropdownMenuLabel`,Sh=M.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=lh(n);return(0,P.jsx)(Ym,{...i,...r,ref:t})});Sh.displayName=xh;var Ch=`DropdownMenuItem`,wh=M.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=lh(n);return(0,P.jsx)(Xm,{...i,...r,ref:t})});wh.displayName=Ch;var Th=`DropdownMenuCheckboxItem`,Eh=M.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=lh(n);return(0,P.jsx)(Zm,{...i,...r,ref:t})});Eh.displayName=Th;var Dh=`DropdownMenuRadioGroup`,Oh=M.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=lh(n);return(0,P.jsx)(Qm,{...i,...r,ref:t})});Oh.displayName=Dh;var kh=`DropdownMenuRadioItem`,Ah=M.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=lh(n);return(0,P.jsx)($m,{...i,...r,ref:t})});Ah.displayName=kh;var jh=`DropdownMenuItemIndicator`,Mh=M.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=lh(n);return(0,P.jsx)(eh,{...i,...r,ref:t})});Mh.displayName=jh;var Nh=`DropdownMenuSeparator`,Ph=M.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=lh(n);return(0,P.jsx)(th,{...i,...r,ref:t})});Ph.displayName=Nh;var Fh=`DropdownMenuArrow`,Ih=M.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=lh(n);return(0,P.jsx)(nh,{...i,...r,ref:t})});Ih.displayName=Fh;var Lh=e=>{let{__scopeDropdownMenu:t,children:n,open:r,onOpenChange:i,defaultOpen:o}=e,s=lh(t),[c,l]=a({prop:r,defaultProp:o??!1,onChange:i,caller:`DropdownMenuSub`});return(0,P.jsx)(rh,{...s,open:c,onOpenChange:l,children:n})},Rh=`DropdownMenuSubTrigger`,zh=M.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=lh(n);return(0,P.jsx)(ih,{...i,...r,ref:t})});zh.displayName=Rh;var Bh=`DropdownMenuSubContent`,Vh=M.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=lh(n);return(0,P.jsx)(ah,{...i,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});Vh.displayName=Bh;var Hh=fh,Uh=mh,Wh=gh,Gh=vh,Kh=Sh,qh=wh,Jh=Eh,Yh=Ah,Xh=Mh,Zh=Ph,Qh=Lh,$h=zh,eg=Vh,tg=Hh,ng=Uh,rg=Qh,ig=M.forwardRef((e,t)=>{let n=(0,F.c)(14),r,i,a,o;n[0]===e?(r=n[1],i=n[2],a=n[3],o=n[4]):({className:i,inset:a,children:r,...o}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=o);let s;n[5]!==i||n[6]!==a?(s=A(A(j.body,`flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0`),a&&`pl-8`,i),n[5]=i,n[6]=a,n[7]=s):s=n[7];let c;n[8]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,P.jsx)(ve,{className:`ml-auto`}),n[8]=c):c=n[8];let l;return n[9]!==r||n[10]!==o||n[11]!==t||n[12]!==s?(l=(0,P.jsxs)($h,{ref:t,className:s,...o,children:[r,c]}),n[9]=r,n[10]=o,n[11]=t,n[12]=s,n[13]=l):l=n[13],l});ig.displayName=$h.displayName;var ag=M.forwardRef((e,t)=>{let n=(0,F.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=A(`z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,P.jsx)(eg,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});ag.displayName=eg.displayName;var og=M.forwardRef((e,t)=>{let n=(0,F.c)(11),r,i,a;n[0]===e?(r=n[1],i=n[2],a=n[3]):({className:r,sideOffset:a,...i}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a);let o=a===void 0?4:a,s;n[4]===r?s=n[5]:(s=A(`z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,r),n[4]=r,n[5]=s);let c;return n[6]!==i||n[7]!==t||n[8]!==o||n[9]!==s?(c=(0,P.jsx)(Wh,{children:(0,P.jsx)(Gh,{ref:t,sideOffset:o,className:s,...i})}),n[6]=i,n[7]=t,n[8]=o,n[9]=s,n[10]=c):c=n[10],c});og.displayName=Gh.displayName;var sg=M.forwardRef((e,t)=>{let n=(0,F.c)(11),r,i,a;n[0]===e?(r=n[1],i=n[2],a=n[3]):({className:r,inset:i,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a);let o;n[4]!==r||n[5]!==i?(o=A(A(j.body,`relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0`),i&&`pl-8`,r),n[4]=r,n[5]=i,n[6]=o):o=n[6];let s;return n[7]!==a||n[8]!==t||n[9]!==o?(s=(0,P.jsx)(qh,{ref:t,className:o,...a}),n[7]=a,n[8]=t,n[9]=o,n[10]=s):s=n[10],s});sg.displayName=qh.displayName;var cg=M.forwardRef((e,t)=>{let n=(0,F.c)(14),r,i,a,o;n[0]===e?(r=n[1],i=n[2],a=n[3],o=n[4]):({className:a,children:i,checked:r,...o}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=o);let s;n[5]===a?s=n[6]:(s=A(A(j.body,`group relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0`),a),n[5]=a,n[6]=s);let c;n[7]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,P.jsx)(`span`,{className:`ml-auto flex h-4 w-4 shrink-0 items-center justify-center rounded-sm border border-primary group-data-[state=checked]:bg-primary group-data-[state=checked]:text-primary-foreground`,children:(0,P.jsx)(Xh,{children:(0,P.jsx)(l,{className:`h-4 w-4`})})}),n[7]=c):c=n[7];let u;return n[8]!==r||n[9]!==i||n[10]!==o||n[11]!==t||n[12]!==s?(u=(0,P.jsxs)(Jh,{ref:t,className:s,checked:r,...o,children:[i,c]}),n[8]=r,n[9]=i,n[10]=o,n[11]=t,n[12]=s,n[13]=u):u=n[13],u});cg.displayName=Jh.displayName;var lg=M.forwardRef((e,t)=>{let n=(0,F.c)(12),r,i,a;n[0]===e?(r=n[1],i=n[2],a=n[3]):({className:i,children:r,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a);let o;n[4]===i?o=n[5]:(o=A(A(j.body,`relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`),i),n[4]=i,n[5]=o);let s;n[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,P.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,P.jsx)(Xh,{children:(0,P.jsx)(Pe,{className:`h-2 w-2 fill-current`})})}),n[6]=s):s=n[6];let c;return n[7]!==r||n[8]!==a||n[9]!==t||n[10]!==o?(c=(0,P.jsxs)(Yh,{ref:t,className:o,...a,children:[s,r]}),n[7]=r,n[8]=a,n[9]=t,n[10]=o,n[11]=c):c=n[11],c});lg.displayName=Yh.displayName;var ug=M.forwardRef((e,t)=>{let n=(0,F.c)(11),r,i,a;n[0]===e?(r=n[1],i=n[2],a=n[3]):({className:r,inset:i,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a);let o=i&&`pl-8`,s;n[4]!==r||n[5]!==o?(s=A(j.body,`px-2 py-1.5 font-semibold`,o,r),n[4]=r,n[5]=o,n[6]=s):s=n[6];let c;return n[7]!==a||n[8]!==t||n[9]!==s?(c=(0,P.jsx)(Kh,{ref:t,className:s,...a}),n[7]=a,n[8]=t,n[9]=s,n[10]=c):c=n[10],c});ug.displayName=Kh.displayName;var dg=M.forwardRef((e,t)=>{let n=(0,F.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=A(`-mx-1 my-1 h-px bg-divider`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,P.jsx)(Zh,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});dg.displayName=Zh.displayName;var fg=e=>{let t=(0,F.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=A(j.compact,`ml-auto tracking-widest opacity-60`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,P.jsx)(`span`,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a};fg.displayName=`DropdownMenuShortcut`;var pg=0,mg=1,hg=2,gg=4;function _g(e){return()=>e}function vg(e){e()}function yg(e,t){return n=>e(t(n))}function bg(e,t){return()=>e(t)}function xg(e,t){return n=>e(t,n)}function Sg(e){return e!==void 0}function Cg(...e){return()=>{e.map(vg)}}function wg(){}function Tg(e,t){return t(e),e}function Eg(e,t){return t(e)}function L(...e){return e}function R(e,t){return e(mg,t)}function z(e,t){e(pg,t)}function Dg(e){e(hg)}function Og(e){return e(gg)}function B(e,t){return R(e,xg(t,pg))}function kg(e,t){let n=e(mg,e=>{n(),t(e)});return n}function Ag(e){let t,n;return r=>i=>{t=i,n&&clearTimeout(n),n=setTimeout(()=>{r(t)},e)}}function jg(e,t){return e===t}function V(e=jg){let t;return n=>r=>{e(t,r)||(t=r,n(r))}}function H(e){return t=>n=>{e(n)&&t(n)}}function U(e){return t=>yg(t,e)}function Mg(e){return t=>()=>{t(e)}}function W(e,...t){let n=Ig(...t);return((t,r)=>{switch(t){case hg:Dg(e);return;case mg:return R(e,n(r))}})}function Ng(e,t){return n=>r=>{n(t=e(t,r))}}function Pg(e){return t=>n=>{e>0?e--:t(n)}}function Fg(e){let t=null,n;return r=>i=>{t=i,!n&&(n=setTimeout(()=>{n=void 0,r(t)},e))}}function G(...e){let t=Array(e.length),n=0,r=null,i=2**e.length-1;return e.forEach((e,a)=>{let o=2**a;R(e,e=>{let s=n;n|=o,t[a]=e,s!==i&&n===i&&r&&(r(),r=null)})}),e=>a=>{let o=()=>{e([a].concat(t))};n===i?o():r=o}}function Ig(...e){return t=>e.reduceRight(Eg,t)}function Lg(e){let t,n,r=()=>t?.();return function(i,a){switch(i){case mg:return a?n===a?void 0:(r(),n=a,t=R(e,a),t):(r(),wg);case hg:r(),n=null;return}}}function K(e){let t=e,n=q();return((e,r)=>{switch(e){case pg:t=r;break;case mg:r(t);break;case gg:return t}return n(e,r)})}function Rg(e,t){return Tg(K(t),t=>B(e,t))}function q(){let e=[];return((t,n)=>{switch(t){case pg:e.slice().forEach(e=>{e(n)});return;case hg:e.splice(0,e.length);return;case mg:return e.push(n),()=>{let t=e.indexOf(n);t>-1&&e.splice(t,1)}}})}function zg(e){return Tg(q(),t=>B(e,t))}function J(e,t=[],{singleton:n}={singleton:!0}){return{constructor:e,dependencies:t,id:Bg(),singleton:n}}var Bg=()=>Symbol();function Vg(e){let t=new Map,n=({constructor:e,dependencies:r,id:i,singleton:a})=>{if(a&&t.has(i))return t.get(i);let o=e(r.map(e=>n(e)));return a&&t.set(i,o),o};return n(e)}function Hg(...e){let t=q(),n=Array(e.length),r=0,i=2**e.length-1;return e.forEach((e,a)=>{let o=2**a;R(e,e=>{n[a]=e,r|=o,r===i&&z(t,n)})}),function(e,a){switch(e){case hg:Dg(t);return;case mg:return r===i&&a(n),R(t,a)}}}function Y(e,t=jg){return W(e,V(t))}function Ug(...e){return function(t,n){switch(t){case hg:return;case mg:return Cg(...e.map(e=>R(e,n)))}}}var Wg={DEBUG:0,INFO:1,WARN:2,ERROR:3},Gg={[Wg.DEBUG]:`debug`,[Wg.ERROR]:`error`,[Wg.INFO]:`log`,[Wg.WARN]:`warn`},Kg=()=>typeof globalThis>`u`?window:globalThis,qg=J(()=>{let e=K(Wg.ERROR);return{log:K((t,n,r=Wg.INFO)=>{r>=(Kg().VIRTUOSO_LOG_LEVEL??Og(e))&&console[Gg[r]](`%creact-virtuoso: %c%s %o`,`color: #0253b3; font-weight: bold`,`color: initial`,t,n)}),logLevel:e}},[],{singleton:!0});function Jg(e,t,n){return Yg(e,t,n).callbackRef}function Yg(e,t,n){let r=M.useRef(null),i=e=>{},a=M.useMemo(()=>typeof ResizeObserver<`u`?new ResizeObserver(t=>{let r=()=>{let n=t[0].target;n.offsetParent!==null&&e(n)};n?r():requestAnimationFrame(r)}):null,[e,n]);return i=e=>{e&&t?(a?.observe(e),r.current=e):(r.current&&a?.unobserve(r.current),r.current=null)},{callbackRef:i,ref:r}}function Xg(e,t,n,r,i,a,o,s,c){return Yg(M.useCallback(n=>{let c=Zg(n.children,t,s?`offsetWidth`:`offsetHeight`,i),l=n.parentElement;for(;l.dataset.virtuosoScroller===void 0;)l=l.parentElement;let u=l.lastElementChild.dataset.viewportType===`window`,d;u&&(d=l.ownerDocument.defaultView);let f=o?s?o.scrollLeft:o.scrollTop:u?s?d.scrollX||d.document.documentElement.scrollLeft:d.scrollY||d.document.documentElement.scrollTop:s?l.scrollLeft:l.scrollTop,p=o?s?o.scrollWidth:o.scrollHeight:u?s?d.document.documentElement.scrollWidth:d.document.documentElement.scrollHeight:s?l.scrollWidth:l.scrollHeight,m=o?s?o.offsetWidth:o.offsetHeight:u?s?d.innerWidth:d.innerHeight:s?l.offsetWidth:l.offsetHeight;r({scrollHeight:p,scrollTop:Math.max(f,0),viewportHeight:m}),a?.(s?Qg(`column-gap`,getComputedStyle(n).columnGap,i):Qg(`row-gap`,getComputedStyle(n).rowGap,i)),c!==null&&e(c)},[e,t,i,a,o,r,s]),n,c)}function Zg(e,t,n,r){let i=e.length;if(i===0)return null;let a=[];for(let o=0;o<i;o++){let i=e.item(o);if(i.dataset.index===void 0)continue;let s=parseInt(i.dataset.index),c=parseFloat(i.dataset.knownSize),l=t(i,n);if(l===0&&r(`Zero-sized element, this should not happen`,{child:i},Wg.ERROR),l===c)continue;let u=a[a.length-1];a.length===0||u.size!==l||u.endIndex!==s-1?a.push({endIndex:s,size:l,startIndex:s}):a[a.length-1].endIndex++}return a}function Qg(e,t,n){return t!==`normal`&&t?.endsWith(`px`)!==!0&&n(`${e} was not resolved to pixel value correctly`,t,Wg.WARN),t===`normal`?0:parseInt(t??`0`,10)}function $g(e,t,n){let r=M.useRef(null),i=M.useCallback(n=>{if(!n?.offsetParent)return;let i=n.getBoundingClientRect(),a=i.width,s,c;if(t){let e=t.getBoundingClientRect(),n=i.top-e.top;c=e.height-Math.max(0,n),s=n+t.scrollTop}else{let e=o.current.ownerDocument.defaultView;c=e.innerHeight-Math.max(0,i.top),s=i.top+e.scrollY}r.current={listHeight:i.height,offsetTop:s,visibleHeight:c,visibleWidth:a},e(r.current)},[e,t]),{callbackRef:a,ref:o}=Yg(i,!0,n),s=M.useCallback(()=>{i(o.current)},[i,o]);return M.useEffect(()=>{if(t){t.addEventListener(`scroll`,s);let e=new ResizeObserver(()=>{requestAnimationFrame(s)});return e.observe(t),()=>{t.removeEventListener(`scroll`,s),e.unobserve(t)}}let e=o.current?.ownerDocument.defaultView;return e?.addEventListener(`scroll`,s),e?.addEventListener(`resize`,s),()=>{e?.removeEventListener(`scroll`,s),e?.removeEventListener(`resize`,s)}},[s,t,o]),a}var e_=J(()=>{let e=q(),t=q(),n=K(0),r=q(),i=K(0),a=q(),o=q(),s=K(0),c=K(0),l=K(0),u=K(0),d=q(),f=q(),p=K(!1),m=K(!1),h=K(!1);return B(W(e,U(({scrollTop:e})=>e)),t),B(W(e,U(({scrollHeight:e})=>e)),o),B(t,i),{deviation:n,fixedFooterHeight:l,fixedHeaderHeight:c,footerHeight:u,headerHeight:s,horizontalDirection:m,scrollBy:f,scrollContainerState:e,scrollHeight:o,scrollingInProgress:p,scrollTo:d,scrollTop:t,skipAnimationFrameInResizeObserver:h,smoothScrollTargetReached:r,statefulScrollTop:i,viewportHeight:a}},[],{singleton:!0}),t_={lvl:0};function n_(e,t){let n=e.length;if(n===0)return[];let{index:r,value:i}=t(e[0]),a=[];for(let o=1;o<n;o++){let{index:n,value:s}=t(e[o]);a.push({end:n-1,start:r,value:i}),r=n,i=s}return a.push({end:1/0,start:r,value:i}),a}function X(e){return e===t_}function r_(e,t){if(!X(e))return t===e.k?e.v:t<e.k?r_(e.l,t):r_(e.r,t)}function i_(e,t,n=`k`){if(X(e))return[-1/0,void 0];if(Number(e[n])===t)return[e.k,e.v];if(Number(e[n])<t){let r=i_(e.r,t,n);return r[0]===-1/0?[e.k,e.v]:r}return i_(e.l,t,n)}function a_(e,t,n){return X(e)?g_(t,n,1):t===e.k?f_(e,{k:t,v:n}):t<e.k?__(f_(e,{l:a_(e.l,t,n)})):__(f_(e,{r:a_(e.r,t,n)}))}function o_(){return t_}function s_(e,t,n){if(X(e))return[];let r=i_(e,t)[0];return b_(u_(e,r,n))}function c_(e,t){if(X(e))return t_;let{k:n,l:r,r:i}=e;if(t===n){if(X(r))return i;if(X(i))return r;let[t,n]=h_(r);return d_(f_(e,{k:t,l:p_(r),v:n}))}return d_(t<n?f_(e,{l:c_(r,t)}):f_(e,{r:c_(i,t)}))}function l_(e){return X(e)?[]:[...l_(e.l),{k:e.k,v:e.v},...l_(e.r)]}function u_(e,t,n){if(X(e))return[];let{k:r,l:i,r:a,v:o}=e,s=[];return r>t&&(s=s.concat(u_(i,t,n))),r>=t&&r<=n&&s.push({k:r,v:o}),r<=n&&(s=s.concat(u_(a,t,n))),s}function d_(e){let{l:t,lvl:n,r}=e;if(r.lvl>=n-1&&t.lvl>=n-1)return e;if(n>r.lvl+1){if(m_(t))return v_(f_(e,{lvl:n-1}));if(!X(t)&&!X(t.r))return f_(t.r,{l:f_(t,{r:t.r.l}),lvl:n,r:f_(e,{l:t.r.r,lvl:n-1})});throw Error(`Unexpected empty nodes`)}if(m_(e))return y_(f_(e,{lvl:n-1}));if(!X(r)&&!X(r.l)){let t=r.l,i=m_(t)?r.lvl-1:r.lvl;return f_(t,{l:f_(e,{lvl:n-1,r:t.l}),lvl:t.lvl+1,r:y_(f_(r,{l:t.r,lvl:i}))})}throw Error(`Unexpected empty nodes`)}function f_(e,t){return g_(t.k===void 0?e.k:t.k,t.v===void 0?e.v:t.v,t.lvl===void 0?e.lvl:t.lvl,t.l===void 0?e.l:t.l,t.r===void 0?e.r:t.r)}function p_(e){return X(e.r)?e.l:d_(f_(e,{r:p_(e.r)}))}function m_(e){return X(e)||e.lvl>e.r.lvl}function h_(e){return X(e.r)?[e.k,e.v]:h_(e.r)}function g_(e,t,n,r=t_,i=t_){return{k:e,l:r,lvl:n,r:i,v:t}}function __(e){return y_(v_(e))}function v_(e){let{l:t}=e;return!X(t)&&t.lvl===e.lvl?f_(t,{r:f_(e,{l:t.r})}):e}function y_(e){let{lvl:t,r:n}=e;return!X(n)&&!X(n.r)&&n.lvl===t&&n.r.lvl===t?f_(n,{l:f_(e,{r:n.l}),lvl:t+1}):e}function b_(e){return n_(e,({k:e,v:t})=>({index:e,value:t}))}function x_(e,t){return!!(e&&e.startIndex===t.startIndex&&e.endIndex===t.endIndex)}function S_(e,t){return!!(e&&e[0]===t[0]&&e[1]===t[1])}var C_=J(()=>({recalcInProgress:K(!1)}),[],{singleton:!0});function w_(e,t,n){return e[T_(e,t,n)]}function T_(e,t,n,r=0){let i=e.length-1;for(;r<=i;){let a=Math.floor((r+i)/2),o=e[a],s=n(o,t);if(s===0)return a;if(s===-1){if(i-r<2)return a-1;i=a-1}else{if(i===r)return a;r=a+1}}throw Error(`Failed binary finding record in array - ${e.join(`,`)}, searched for ${t}`)}function E_(e,t,n,r){let i=T_(e,t,r),a=T_(e,n,r,i);return e.slice(i,a+1)}function D_(e,t){return Math.round(e.getBoundingClientRect()[t])}function O_(e){return!X(e.groupOffsetTree)}function k_({index:e},t){return t===e?0:t<e?-1:1}function A_(){return{groupIndices:[],groupOffsetTree:o_(),lastIndex:0,lastOffset:0,lastSize:0,offsetTree:[],sizeTree:o_()}}function j_(e,t){let n=X(e)?0:1/0;for(let r of t){let{endIndex:t,size:i,startIndex:a}=r;if(n=Math.min(n,a),X(e)){e=a_(e,0,i);continue}let o=s_(e,a-1,t+1);if(o.some(U_(r)))continue;let s=!1,c=!1;for(let{end:n,start:r,value:a}of o)s?(t>=r||i===a)&&(e=c_(e,r)):(c=a!==i,s=!0),n>t&&t>=r&&a!==i&&(e=a_(e,t+1,a));c&&(e=a_(e,a,i))}return[e,n]}function M_(e){return typeof e.groupIndex<`u`}function N_({offset:e},t){return t===e?0:t<e?-1:1}function P_(e,t,n){if(t.length===0)return 0;let{index:r,offset:i,size:a}=w_(t,e,k_),o=e-r,s=a*o+(o-1)*n+i;return s>0?s+n:s}function F_(e,t){if(!O_(t))return e;let n=0;for(;t.groupIndices[n]<=e+n;)n++;return e+n}function I_(e,t,n){if(M_(e))return t.groupIndices[e.groupIndex]+1;let r=F_(e.index===`LAST`?n:e.index,t);return r=Math.max(0,r,Math.min(n,r)),r}function L_(e,t,n,r=0){return r>0&&(t=Math.max(t,w_(e,r,k_).offset)),n_(E_(e,t,n,N_),H_)}function R_(e,[t,n,r,i]){t.length>0&&r(`received item sizes`,t,Wg.DEBUG);let a=e.sizeTree,o=a,s=0;if(n.length>0&&X(a)&&t.length===2){let e=t[0].size,r=t[1].size;o=n.reduce((t,n)=>a_(a_(t,n,e),n+1,r),o)}else [o,s]=j_(o,t);if(o===a)return e;let{lastIndex:c,lastOffset:l,lastSize:u,offsetTree:d}=V_(e.offsetTree,s,o,i);return{groupIndices:n,groupOffsetTree:n.reduce((e,t)=>a_(e,t,P_(t,d,i)),o_()),lastIndex:c,lastOffset:l,lastSize:u,offsetTree:d,sizeTree:o}}function z_(e){return l_(e).map(({k:e,v:t},n,r)=>{let i=r[n+1];return{endIndex:i===void 0?1/0:i.k-1,size:t,startIndex:e}})}function B_(e,t){let n=0,r=0;for(;n<e;)n+=t[r+1]-t[r]-1,r++;return r-(n===e?0:1)}function V_(e,t,n,r){let i=e,a=0,o=0,s=0,c=0;if(t!==0){c=T_(i,t-1,k_),s=i[c].offset;let e=i_(n,t-1);a=e[0],o=e[1],i.length&&i[c].size===i_(n,t)[1]&&--c,i=i.slice(0,c+1)}else i=[];for(let{start:e,value:c}of s_(n,t,1/0)){let t=e-a,n=t*o+s+t*r;i.push({index:e,offset:n,size:c}),a=e,s=n,o=c}return{lastIndex:a,lastOffset:s,lastSize:o,offsetTree:i}}function H_(e){return{index:e.index,value:e}}function U_(e){let{endIndex:t,size:n,startIndex:r}=e;return e=>e.start===r&&(e.end===t||e.end===1/0)&&e.value===n}var W_={offsetHeight:`height`,offsetWidth:`width`},G_=J(([{log:e},{recalcInProgress:t}])=>{let n=q(),r=q(),i=Rg(r,0),a=q(),o=q(),s=K(0),c=K([]),l=K(void 0),u=K(void 0),d=K(void 0),f=K(void 0),p=K((e,t)=>D_(e,W_[t])),m=K(void 0),h=K(0),g=A_(),_=Rg(W(n,G(c,e,h),Ng(R_,g),V()),g),v=Rg(W(c,V(),Ng((e,t)=>({current:t,prev:e.current}),{current:[],prev:[]}),U(({prev:e})=>e)),[]);B(W(c,H(e=>e.length>0),G(_,h),U(([e,t,n])=>{let r=e.reduce((e,r,i)=>a_(e,r,P_(r,t.offsetTree,n)||i),o_());return{...t,groupIndices:e,groupOffsetTree:r}})),_),B(W(r,G(_),H(([e,{lastIndex:t}])=>e<t),U(([e,{lastIndex:t,lastSize:n}])=>[{endIndex:t,size:n,startIndex:e}])),n),B(l,u);let y=Rg(W(l,U(e=>e===void 0)),!0);B(W(u,H(e=>e!==void 0&&X(Og(_).sizeTree)),U(e=>{let t=Og(d),n=Og(c).length>0;return t!==void 0&&t!==0?n?[{endIndex:0,size:t,startIndex:0},{endIndex:1,size:e,startIndex:1}]:[]:[{endIndex:0,size:e,startIndex:0}]})),n),B(W(f,H(e=>e!==void 0&&e.length>0&&X(Og(_).sizeTree)),U(e=>{let t=[],n=e[0],r=0;for(let i=1;i<e.length;i++){let a=e[i];a!==n&&(t.push({endIndex:i-1,size:n,startIndex:r}),n=a,r=i)}return t.push({endIndex:e.length-1,size:n,startIndex:r}),t})),n),B(W(c,G(d,u),H(([,e,t])=>e!==void 0&&t!==void 0),U(([e,t,n])=>{let r=[];for(let i=0;i<e.length;i++){let a=e[i],o=e[i+1];r.push({startIndex:a,endIndex:a,size:t}),o!==void 0&&r.push({startIndex:a+1,endIndex:o-1,size:n})}return r})),n);let b=zg(W(n,G(_),Ng(({sizes:e},[t,n])=>({changed:n!==e,sizes:n}),{changed:!1,sizes:g}),U(e=>e.changed)));R(W(s,Ng((e,t)=>({diff:e.prev-t,prev:t}),{diff:0,prev:0}),U(e=>e.diff)),e=>{let{groupIndices:n}=Og(_);if(e>0)z(t,!0),z(a,e+B_(e,n));else if(e<0){let t=Og(v);t.length>0&&(e-=B_(-e,t)),z(o,e)}}),R(W(s,G(e)),([e,t])=>{e<0&&t("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:s},Wg.ERROR)});let x=zg(a);B(W(a,G(_),U(([e,t])=>{let n=t.groupIndices.length>0,r=[],i=t.lastSize;if(n){let n=r_(t.sizeTree,0),a=0,o=0;for(;a<e;){let e=t.groupIndices[o],s=t.groupIndices.length===o+1?1/0:t.groupIndices[o+1]-e-1;r.push({endIndex:e,size:n,startIndex:e}),r.push({endIndex:e+1+s-1,size:i,startIndex:e+1}),o++,a+=s+1}let s=l_(t.sizeTree);return a!==e&&s.shift(),s.reduce((t,{k:n,v:r})=>{let i=t.ranges;return t.prevSize!==0&&(i=[...t.ranges,{endIndex:n+e-1,size:t.prevSize,startIndex:t.prevIndex}]),{prevIndex:n+e,prevSize:r,ranges:i}},{prevIndex:e,prevSize:0,ranges:r}).ranges}return l_(t.sizeTree).reduce((t,{k:n,v:r})=>({prevIndex:n+e,prevSize:r,ranges:[...t.ranges,{endIndex:n+e-1,size:t.prevSize,startIndex:t.prevIndex}]}),{prevIndex:0,prevSize:i,ranges:[]}).ranges})),n);let S=zg(W(o,G(_,h),U(([e,{offsetTree:t},n])=>P_(-e,t,n))));return B(W(o,G(_,h),U(([e,t,n])=>{if(t.groupIndices.length>0){if(X(t.sizeTree))return t;let r=o_(),i=Og(v),a=0,o=0,s=0;for(;a<-e;){s=i[o];let e=i[o+1]-s-1;o++,a+=e+1}if(r=l_(t.sizeTree).reduce((t,{k:n,v:r})=>a_(t,Math.max(0,n+e),r),r),a!==-e){let n=r_(t.sizeTree,s);r=a_(r,0,n);let i=i_(t.sizeTree,-e+1)[1];r=a_(r,1,i)}return{...t,sizeTree:r,...V_(t.offsetTree,0,r,n)}}let r=l_(t.sizeTree).reduce((t,{k:n,v:r})=>a_(t,Math.max(0,n+e),r),o_());return{...t,sizeTree:r,...V_(t.offsetTree,0,r,n)}})),_),{beforeUnshiftWith:x,data:m,defaultItemSize:u,firstItemIndex:s,fixedItemSize:l,fixedGroupSize:d,gap:h,groupIndices:c,heightEstimates:f,itemSize:p,listRefresh:b,shiftWith:o,shiftWithOffset:S,sizeRanges:n,sizes:_,statefulTotalCount:i,totalCount:r,trackItemSizes:y,unshiftWith:a}},L(qg,C_),{singleton:!0});function K_(e){return e.reduce((e,t)=>(e.groupIndices.push(e.totalCount),e.totalCount+=t+1,e),{groupIndices:[],totalCount:0})}var q_=J(([{groupIndices:e,sizes:t,totalCount:n},{headerHeight:r,scrollTop:i}])=>{let a=q(),o=q(),s=zg(W(a,U(K_)));return B(W(s,U(e=>e.totalCount)),n),B(W(s,U(e=>e.groupIndices)),e),B(W(Hg(i,t,r),H(([e,t])=>O_(t)),U(([e,t,n])=>i_(t.groupOffsetTree,Math.max(e-n,0),`v`)[0]),V(),U(e=>[e])),o),{groupCounts:a,topItemsIndexes:o}},L(G_,e_)),J_=J(([{log:e}])=>{let t=K(!1),n=zg(W(t,H(e=>e),V()));return R(t,t=>{t&&Og(e)(`props updated`,{},Wg.DEBUG)}),{didMount:n,propsReady:t}},L(qg),{singleton:!0}),Y_=typeof document<`u`&&`scrollBehavior`in document.documentElement.style;function X_(e){let t=typeof e==`number`?{index:e}:e;return t.align||=`start`,(!t.behavior||!Y_)&&(t.behavior=`auto`),t.offset===void 0&&(t.offset=0),t}var Z_=J(([{gap:e,listRefresh:t,sizes:n,totalCount:r},{fixedFooterHeight:i,fixedHeaderHeight:a,footerHeight:o,headerHeight:s,scrollingInProgress:c,scrollTo:l,smoothScrollTargetReached:u,viewportHeight:d},{log:f}])=>{let p=q(),m=q(),h=K(0),g=null,_=null,v=null;function y(){g!==null&&(g(),g=null),v!==null&&(v(),v=null),_&&=(clearTimeout(_),null),z(c,!1)}return B(W(p,G(n,d,r,h,s,o,f),G(e,a,i),U(([[e,n,r,i,a,o,s,l],d,f,h])=>{let b=X_(e),{align:x,behavior:S,offset:C}=b,w=i-1,T=I_(b,n,w),E=P_(T,n.offsetTree,d)+o;x===`end`?(E+=f+i_(n.sizeTree,T)[1]-r+h,T===w&&(E+=s)):x===`center`?E+=(f+i_(n.sizeTree,T)[1]-r+h)/2:E-=a,C!==void 0&&C!==0&&(E+=C);let ee=t=>{y(),t?(l(`retrying to scroll to`,{location:e},Wg.DEBUG),z(p,e)):(z(m,!0),l(`list did not change, scroll successful`,{},Wg.DEBUG))};if(y(),S===`smooth`){let e=!1;v=R(t,t=>{e||=t}),g=kg(u,()=>{ee(e)})}else g=kg(W(t,Q_(150)),ee);return _=setTimeout(()=>{y()},1200),z(c,!0),l(`scrolling from index to`,{behavior:S,index:T,top:E},Wg.DEBUG),{behavior:S,top:E}})),l),{scrollTargetReached:m,scrollToIndex:p,topListHeight:h}},L(G_,e_,qg),{singleton:!0});function Q_(e){return t=>{let n=setTimeout(()=>{t(!1)},e);return e=>{e&&(t(!0),clearTimeout(n))}}}function $_(e,t){e===0?t():requestAnimationFrame(()=>{$_(e-1,t)})}function ev(e,t){let n=t-1;return typeof e==`number`?e:e.index===`LAST`?n:e.index}var tv=J(([{defaultItemSize:e,listRefresh:t,sizes:n},{scrollTop:r},{scrollTargetReached:i,scrollToIndex:a},{didMount:o}])=>{let s=K(!0),c=K(0),l=K(!0);return B(W(o,G(c),H(([e,t])=>t!==0),Mg(!1)),s),B(W(o,G(c),H(([e,t])=>t!==0),Mg(!1)),l),R(W(Hg(t,o),G(s,n,e,l),H(([[,e],t,{sizeTree:n},r,i])=>e&&(!X(n)||Sg(r))&&!t&&!i),G(c)),([,e])=>{kg(i,()=>{z(l,!0)}),$_(4,()=>{kg(r,()=>{z(s,!0)}),z(a,e)})}),{initialItemFinalLocationReached:l,initialTopMostItemIndex:c,scrolledToInitialItem:s}},L(G_,e_,Z_,J_),{singleton:!0});function nv(e,t){return Math.abs(e-t)<1.01}var rv=`up`,iv=`down`,av=`none`,ov={atBottom:!1,notAtBottomBecause:`NOT_SHOWING_LAST_ITEM`,state:{offsetBottom:0,scrollHeight:0,scrollTop:0,viewportHeight:0}},sv=0,cv=J(([{footerHeight:e,headerHeight:t,scrollBy:n,scrollContainerState:r,scrollTop:i,viewportHeight:a}])=>{let o=K(!1),s=K(!0),c=q(),l=q(),u=K(4),d=K(sv),f=Rg(W(Ug(W(Y(i),Pg(1),Mg(!0)),W(Y(i),Pg(1),Mg(!1),Ag(100))),V()),!1),p=Rg(W(Ug(W(n,Mg(!0)),W(n,Mg(!1),Ag(200))),V()),!1);B(W(Hg(Y(i),Y(d)),U(([e,t])=>e<=t),V()),s),B(W(s,Fg(50)),l);let m=zg(W(Hg(r,Y(a),Y(t),Y(e),Y(u)),Ng((e,[{scrollHeight:t,scrollTop:n},r,i,a,o])=>{let s=n+r-t>-o,c={scrollHeight:t,scrollTop:n,viewportHeight:r};if(s){let t,r;return n>e.state.scrollTop?(t=`SCROLLED_DOWN`,r=e.state.scrollTop-n):(t=`SIZE_DECREASED`,r=e.state.scrollTop-n||e.scrollTopDelta),{atBottom:!0,atBottomBecause:t,scrollTopDelta:r,state:c}}let l;return l=c.scrollHeight>e.state.scrollHeight?`SIZE_INCREASED`:r<e.state.viewportHeight?`VIEWPORT_HEIGHT_DECREASING`:n<e.state.scrollTop?`SCROLLING_UPWARDS`:`NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM`,{atBottom:!1,notAtBottomBecause:l,state:c}},ov),V((e,t)=>e!==void 0&&e.atBottom===t.atBottom))),h=Rg(W(r,Ng((e,{scrollHeight:t,scrollTop:n,viewportHeight:r})=>{if(!nv(e.scrollHeight,t)){let i=t-(n+r)<1;return e.scrollTop!==n&&i?{changed:!0,jump:e.scrollTop-n,scrollHeight:t,scrollTop:n}:{changed:!0,jump:0,scrollHeight:t,scrollTop:n}}return{changed:!1,jump:0,scrollHeight:t,scrollTop:n}},{changed:!1,jump:0,scrollHeight:0,scrollTop:0}),H(e=>e.changed),U(e=>e.jump)),0);B(W(m,U(e=>e.atBottom)),o),B(W(o,Fg(50)),c);let g=K(iv);B(W(r,U(({scrollTop:e})=>e),V(),Ng((e,t)=>Og(p)?{direction:e.direction,prevScrollTop:t}:{direction:t<e.prevScrollTop?rv:iv,prevScrollTop:t},{direction:iv,prevScrollTop:0}),U(e=>e.direction)),g),B(W(r,Fg(50),Mg(av)),g);let _=K(0);return B(W(f,H(e=>!e),Mg(0)),_),B(W(i,Fg(100),G(f),H(([e,t])=>t),Ng(([e,t],[n])=>[t,n],[0,0]),U(([e,t])=>t-e)),_),{atBottomState:m,atBottomStateChange:c,atBottomThreshold:u,atTopStateChange:l,atTopThreshold:d,isAtBottom:o,isAtTop:s,isScrolling:f,lastJumpDueToItemResize:h,scrollDirection:g,scrollVelocity:_}},L(e_)),lv=`top`,uv=`bottom`,dv=`none`;function fv(e,t,n){return typeof e==`number`?n===rv&&t===lv||n===iv&&t===uv?e:0:n===rv?t===lv?e.main:e.reverse:t===uv?e.main:e.reverse}function pv(e,t){return typeof e==`number`?e:e[t]??0}var mv=J(([{deviation:e,fixedHeaderHeight:t,headerHeight:n,scrollTop:r,viewportHeight:i}])=>{let a=q(),o=K(0),s=K(0),c=K(0);return{increaseViewportBy:s,listBoundary:a,overscan:c,topListHeight:o,visibleRange:Rg(W(Hg(Y(r),Y(i),Y(n),Y(a,S_),Y(c),Y(o),Y(t),Y(e),Y(s)),U(([e,t,n,[r,i],a,o,s,c,l])=>{let u=e-c,d=o+s,f=Math.max(n-u,0),p=dv,m=pv(l,lv),h=pv(l,uv);return r-=c,r+=n+s,i+=n+s,i-=c,r>e+d-m&&(p=rv),i<e-f+t+h&&(p=iv),p===dv?null:[Math.max(u-n-fv(a,lv,p)-m,0),u-f-s+t+fv(a,uv,p)+h]}),H(e=>e!==null),V(S_)),[0,0])}},L(e_),{singleton:!0});function hv(e,t,n){if(O_(t)){let r=F_(e,t);return[{index:i_(t.groupOffsetTree,r)[0],offset:0,size:0},{data:n?.[0],index:r,offset:0,size:0}]}return[{data:n?.[0],index:e,offset:0,size:0}]}var gv={bottom:0,firstItemIndex:0,items:[],offsetBottom:0,offsetTop:0,top:0,topItems:[],topListHeight:0,totalCount:0};function _v(e,t,n,r,i,a){let{lastIndex:o,lastOffset:s,lastSize:c}=i,l=0,u=0;if(e.length>0){l=e[0].offset;let t=e[e.length-1];u=t.offset+t.size}let d=n-o,f=s+d*c+(d-1)*r,p=l,m=f-u;return{bottom:u,firstItemIndex:a,items:yv(e,i,a),offsetBottom:m,offsetTop:l,top:p,topItems:yv(t,i,a),topListHeight:t.reduce((e,t)=>t.size+e,0),totalCount:n}}function vv(e,t,n,r,i,a){let o=0;if(n.groupIndices.length>0)for(let t of n.groupIndices){if(t-o>=e)break;o++}let s=e+o,c=ev(t,s);return _v(Array.from({length:s}).map((e,t)=>({data:a[t+c],index:t+c,offset:0,size:0})),[],s,i,n,r)}function yv(e,t,n){if(e.length===0)return[];if(!O_(t))return e.map(e=>({...e,index:e.index+n,originalIndex:e.index}));let r=e[0].index,i=e[e.length-1].index,a=[],o=s_(t.groupOffsetTree,r,i),s,c=0;for(let r of e){(!s||s.end<r.index)&&(s=o.shift(),c=t.groupIndices.indexOf(s.start));let e;e=r.index===s.start?{index:c,type:`group`}:{groupIndex:c,index:r.index-(c+1)+n},a.push({...e,data:r.data,offset:r.offset,originalIndex:r.index,size:r.size})}return a}function bv(e,t){return e===void 0?0:typeof e==`number`?e:e[t]??0}var xv=J(([{data:e,firstItemIndex:t,gap:n,sizes:r,totalCount:i},a,{listBoundary:o,topListHeight:s,visibleRange:c},{initialTopMostItemIndex:l,scrolledToInitialItem:u},{topListHeight:d},f,{didMount:p},{recalcInProgress:m}])=>{let h=K([]),g=K(0),_=q(),v=K(0);B(a.topItemsIndexes,h);let y=Rg(W(Hg(p,m,Y(c,S_),Y(i),Y(r),Y(l),u,Y(h),Y(t),Y(n),Y(v),e),H(([e,t,,n,,,,,,,,r])=>{let i=r!==void 0&&r.length!==n;return e&&!t&&!i}),U(([,,[e,t],n,r,i,a,o,s,c,l,u])=>{let d=r,{offsetTree:f,sizeTree:p}=d,m=Og(g);if(n===0)return{...gv,totalCount:n};if(e===0&&t===0)return m===0?{...gv,totalCount:n}:vv(m,i,r,s,c,u||[]);if(X(p))return m>0?null:_v(hv(ev(i,n),d,u),[],n,c,d,s);let h=[];if(o.length>0){let e=o[0],t=o[o.length-1],n=0;for(let r of s_(p,e,t)){let i=r.value,a=Math.max(r.start,e),o=Math.min(r.end,t);for(let e=a;e<=o;e++)h.push({data:u?.[e],index:e,offset:n,size:i}),n+=i}}if(!a)return _v([],h,n,c,d,s);let _=o.length>0?o[o.length-1]+1:0,v=L_(f,e,t,_);if(v.length===0)return null;let y=n-1,b=Tg([],n=>{for(let r of v){let i=r.value,a=i.offset,o=r.start,s=i.size;if(i.offset<e){o+=Math.floor((e-i.offset+c)/(s+c));let t=o-r.start;a+=t*s+t*c}o<_&&(a+=(_-o)*s,o=_);let l=Math.min(r.end,y);for(let e=o;e<=l&&!(a>=t);e++)n.push({data:u?.[e],index:e,offset:a,size:s}),a+=s+c}}),x=bv(l,lv),S=bv(l,uv);if(b.length>0&&(x>0||S>0)){let e=b[0],t=b[b.length-1];if(x>0&&e.index>_){let t=Math.min(x,e.index-_),n=[],r=e.offset;for(let i=e.index-1;i>=e.index-t;i--){let t=s_(p,i,i)[0]?.value??e.size;r-=t+c,n.unshift({data:u?.[i],index:i,offset:r,size:t})}b.unshift(...n)}if(S>0&&t.index<y){let e=Math.min(S,y-t.index),n=t.offset+t.size+c;for(let r=t.index+1;r<=t.index+e;r++){let e=s_(p,r,r)[0]?.value??t.size;b.push({data:u?.[r],index:r,offset:n,size:e}),n+=e+c}}}return _v(b,h,n,c,d,s)}),H(e=>e!==null),V()),gv);B(W(e,H(Sg),U(e=>e?.length)),i),B(W(y,U(e=>e.topListHeight)),d),B(d,s),B(W(y,U(e=>[e.top,e.bottom])),o),B(W(y,U(e=>e.items)),_);let b=zg(W(y,H(({items:e})=>e.length>0),G(i,e),H(([{items:e},t])=>e[e.length-1].originalIndex===t-1),U(([,e,t])=>[e-1,t]),V(S_),U(([e])=>e))),x=zg(W(y,Fg(200),H(({items:e,topItems:t})=>e.length>0&&e[0].originalIndex===t.length),U(({items:e})=>e[0].index),V()));return{endReached:b,initialItemCount:g,itemsRendered:_,listState:y,minOverscanItemCount:v,rangeChanged:zg(W(y,H(({items:e})=>e.length>0),U(({items:e})=>{let t=0,n=e.length-1;for(;e[t].type===`group`&&t<n;)t++;for(;e[n].type===`group`&&n>t;)n--;return{endIndex:e[n].index,startIndex:e[t].index}}),V(x_))),startReached:x,topItemsIndexes:h,...f}},L(G_,q_,mv,tv,Z_,cv,J_,C_),{singleton:!0}),Sv=J(([{fixedFooterHeight:e,fixedHeaderHeight:t,footerHeight:n,headerHeight:r},{listState:i}])=>{let a=q(),o=Rg(W(Hg(n,e,r,t,i),U(([e,t,n,r,i])=>e+t+n+r+i.offsetBottom+i.bottom)),0);return B(Y(o),a),{totalListHeight:o,totalListHeightChanged:a}},L(e_,xv),{singleton:!0}),Cv=J(([{viewportHeight:e},{totalListHeight:t}])=>{let n=K(!1);return{alignToBottom:n,paddingTopAddition:Rg(W(Hg(n,e,t),H(([e])=>e),U(([,e,t])=>Math.max(0,e-t)),Fg(0),V()),0)}},L(e_,Sv),{singleton:!0}),wv=J(()=>({context:K(null)})),Tv=({itemBottom:e,itemTop:t,locationParams:{align:n,behavior:r,...i},viewportBottom:a,viewportTop:o})=>t<o?{...i,align:n??`start`,...r===void 0?{}:{behavior:r}}:e>a?{...i,align:n??`end`,...r===void 0?{}:{behavior:r}}:null,Ev=J(([{gap:e,sizes:t,totalCount:n},{fixedFooterHeight:r,fixedHeaderHeight:i,headerHeight:a,scrollingInProgress:o,scrollTop:s,viewportHeight:c},{scrollToIndex:l}])=>{let u=q();return B(W(u,G(t,c,n,a,i,r,s),G(e),U(([[e,t,n,r,i,a,s,c],l])=>{let{calculateViewLocation:u=Tv,done:d,...f}=e,p=I_(e,t,r-1),m=P_(p,t.offsetTree,l)+i+a,h=m+i_(t.sizeTree,p)[1],g=c+a,_=u({itemBottom:h,itemTop:m,locationParams:f,viewportBottom:c+n-s,viewportTop:g});return _===null?d?.():d&&kg(W(o,H(e=>!e),Pg(Og(o)?1:2)),d),_}),H(e=>e!==null)),l),{scrollIntoView:u}},L(G_,e_,Z_,xv,qg),{singleton:!0});function Dv(e){return e===!1?!1:e===`smooth`?`smooth`:`auto`}var Ov=(e,t)=>typeof e==`function`?Dv(e(t)):t&&Dv(e),kv=J(([{listRefresh:e,totalCount:t,fixedItemSize:n,data:r},{atBottomState:i,isAtBottom:a},{scrollToIndex:o},{scrolledToInitialItem:s},{didMount:c,propsReady:l},{log:u},{scrollingInProgress:d},{context:f},{scrollIntoView:p}])=>{let m=K(!1),h=q(),g=null;function _(e){z(o,{align:`end`,behavior:e,index:`LAST`})}R(W(Hg(W(Y(t),Pg(1)),c),G(Y(m),a,s,d),U(([[e,t],n,r,i,a])=>{let o=t&&i,s=`auto`;return o&&(s=Ov(n,r||a),o&&=s!==!1),{followOutputBehavior:s,shouldFollow:o,totalCount:e}}),H(({shouldFollow:e})=>e)),({followOutputBehavior:t,totalCount:r})=>{g!==null&&(g(),g=null),Og(n)===void 0?g=kg(e,()=>{Og(u)(`following output to `,{totalCount:r},Wg.DEBUG),_(t),g=null}):requestAnimationFrame(()=>{Og(u)(`following output to `,{totalCount:r},Wg.DEBUG),_(t)})});function v(e){let t=kg(i,t=>{e&&!t.atBottom&&t.notAtBottomBecause===`SIZE_INCREASED`&&g===null&&(Og(u)(`scrolling to bottom due to increased size`,{},Wg.DEBUG),_(`auto`))});setTimeout(t,100)}R(W(Hg(Y(m),t,l),H(([e,,t])=>e!==!1&&t),Ng(({value:e},[,t])=>({refreshed:e===t,value:t}),{refreshed:!1,value:0}),H(({refreshed:e})=>e),G(m,t)),([,e])=>{Og(s)&&v(e!==!1)}),R(h,()=>{v(Og(m)!==!1)}),R(Hg(Y(m),i),([e,t])=>{e!==!1&&!t.atBottom&&t.notAtBottomBecause===`VIEWPORT_HEIGHT_DECREASING`&&_(`auto`)});let y=K(null),b=q();return B(Ug(W(Y(r),U(e=>e?.length??0)),W(Y(t))),b),R(W(Hg(W(b,Pg(1)),c),G(Y(y),s,d,f),U(([[e,t],n,r,i,a])=>t&&r&&n?.({context:a,totalCount:e,scrollingInProgress:i})),H(e=>!!e),Fg(0)),t=>{g!==null&&(g(),g=null),Og(n)===void 0?g=kg(e,()=>{Og(u)(`scrolling into view`,{}),z(p,t),g=null}):requestAnimationFrame(()=>{Og(u)(`scrolling into view`,{}),z(p,t)})}),{autoscrollToBottom:h,followOutput:m,scrollIntoViewOnChange:y}},L(G_,cv,Z_,tv,J_,qg,e_,wv,Ev)),Av=J(([{data:e,firstItemIndex:t,gap:n,sizes:r},{initialTopMostItemIndex:i},{initialItemCount:a,listState:o},{didMount:s}])=>(B(W(s,G(a),H(([,e])=>e!==0),G(i,r,t,n,e),U(([[,e],t,n,r,i,a=[]])=>vv(e,t,n,r,i,a))),o),{}),L(G_,tv,xv,J_),{singleton:!0}),jv=J(([{didMount:e},{scrollTo:t},{listState:n}])=>{let r=K(0);return R(W(e,G(r),H(([,e])=>e!==0),U(([,e])=>({top:e}))),e=>{kg(W(n,Pg(1),H(e=>e.items.length>1)),()=>{requestAnimationFrame(()=>{z(t,e)})})}),{initialScrollTop:r}},L(J_,e_,xv),{singleton:!0}),Mv=J(([{scrollVelocity:e}])=>{let t=K(!1),n=q(),r=K(!1);return B(W(e,G(r,t,n),H(([e,t])=>t!==!1&&t!==void 0),U(([e,t,n,r])=>{let{enter:i,exit:a}=t;if(n){if(a(e,r))return!1}else if(i(e,r))return!0;return n}),V()),t),R(W(Hg(t,e,n),G(r)),([[e,t,n],r])=>{e&&r!==!1&&r!==void 0&&r.change&&r.change(t,n)}),{isSeeking:t,scrollSeekConfiguration:r,scrollSeekRangeChanged:n,scrollVelocity:e}},L(cv),{singleton:!0}),Nv=J(([{scrollContainerState:e,scrollTo:t}])=>{let n=q(),r=q(),i=q(),a=K(!1),o=K(void 0);return B(W(Hg(n,r),U(([{scrollTop:e,viewportHeight:t},{offsetTop:n,listHeight:r}])=>({scrollHeight:r,scrollTop:Math.max(0,e-n),viewportHeight:t}))),e),B(W(t,G(r),U(([e,{offsetTop:t}])=>({...e,top:e.top+t}))),i),{customScrollParent:o,useWindowScroll:a,windowScrollContainerState:n,windowScrollTo:i,windowViewportRect:r}},L(e_)),Pv=J(([{sizeRanges:e,sizes:t},{headerHeight:n,scrollTop:r},{initialTopMostItemIndex:i},{didMount:a},{useWindowScroll:o,windowScrollContainerState:s,windowViewportRect:c}])=>{let l=q(),u=K(void 0),d=K(null),f=K(null);return B(s,d),B(c,f),R(W(l,G(t,r,o,d,f,n)),([e,t,n,r,i,a,o])=>{let s=z_(t.sizeTree);r&&i!==null&&a!==null&&(n=i.scrollTop-a.offsetTop),n-=o,e({ranges:s,scrollTop:n})}),B(W(u,H(Sg),U(Fv)),i),B(W(a,G(u),H(([,e])=>e!==void 0),V(),U(([,e])=>e.ranges)),e),{getState:l,restoreStateFrom:u}},L(G_,e_,tv,J_,Nv));function Fv(e){return{align:`start`,index:0,offset:e.scrollTop}}var Iv=J(([{topItemsIndexes:e}])=>{let t=K(0);return B(W(t,H(e=>e>=0),U(e=>Array.from({length:e}).map((e,t)=>t))),e),{topItemCount:t}},L(xv));function Lv(e){let t=!1,n;return(()=>(t||(t=!0,n=e()),n))}var Rv=Lv(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),zv=J(([{data:e,defaultItemSize:t,firstItemIndex:n,fixedItemSize:r,fixedGroupSize:i,gap:a,groupIndices:o,heightEstimates:s,itemSize:c,sizeRanges:l,sizes:u,statefulTotalCount:d,totalCount:f,trackItemSizes:p},{initialItemFinalLocationReached:m,initialTopMostItemIndex:h,scrolledToInitialItem:g},_,v,y,b,{scrollToIndex:x},S,{topItemCount:C},{groupCounts:w},T])=>{let{listState:E,minOverscanItemCount:ee,topItemsIndexes:te,rangeChanged:ne,...D}=b;return B(ne,T.scrollSeekRangeChanged),B(W(T.windowViewportRect,U(e=>e.visibleHeight)),_.viewportHeight),{data:e,defaultItemHeight:t,firstItemIndex:n,fixedItemHeight:r,fixedGroupHeight:i,gap:a,groupCounts:w,heightEstimates:s,initialItemFinalLocationReached:m,initialTopMostItemIndex:h,scrolledToInitialItem:g,sizeRanges:l,topItemCount:C,topItemsIndexes:te,totalCount:f,...y,groupIndices:o,itemSize:c,listState:E,minOverscanItemCount:ee,scrollToIndex:x,statefulTotalCount:d,trackItemSizes:p,rangeChanged:ne,...D,...T,..._,sizes:u,...v}},L(G_,tv,e_,Pv,kv,xv,Z_,J(([{deviation:e,scrollBy:t,scrollingInProgress:n,scrollTop:r},{isAtBottom:i,isScrolling:a,lastJumpDueToItemResize:o,scrollDirection:s},{listState:c},{beforeUnshiftWith:l,gap:u,shiftWithOffset:d,sizes:f},{log:p},{recalcInProgress:m}])=>{let h=zg(W(c,G(o),Ng(([,e,t,n],[{bottom:r,items:i,offsetBottom:a,totalCount:o},s])=>{let c=r+a,l=0;return t===o&&e.length>0&&i.length>0&&(i[0].originalIndex===0&&e[0].originalIndex===0||(l=c-n,l!==0&&(l+=s))),[l,i,o,c]},[0,[],0,0]),H(([e])=>e!==0),G(r,s,n,i,p,m),H(([,e,t,n,,,r])=>!r&&!n&&e!==0&&t===rv),U(([[e],,,,,t])=>(t(`Upward scrolling compensation`,{amount:e},Wg.DEBUG),e))));function g(n){n>0?(z(t,{behavior:`auto`,top:-n}),z(e,0)):(z(e,0),z(t,{behavior:`auto`,top:-n}))}return R(W(h,G(e,a)),([t,n,r])=>{r&&Rv()?z(e,n-t):g(-t)}),R(W(Hg(Rg(a,!1),e,m),H(([e,t,n])=>!e&&!n&&t!==0),U(([e,t])=>t),Fg(1)),g),B(W(d,U(e=>({top:-e}))),t),R(W(l,G(f,u),U(([e,{groupIndices:t,lastSize:n,sizeTree:r},i])=>{function a(e){return e*(n+i)}if(t.length===0)return a(e);let o=0,s=r_(r,0),c=0,l=0;for(;c<e;){c++,o+=s;let n=t.length===l+1?1/0:t[l+1]-t[l]-1;c+n>e&&(o-=s,n=e-c+1),c+=n,o+=a(n),l++}return o})),n=>{z(e,n),requestAnimationFrame(()=>{z(t,{top:n}),requestAnimationFrame(()=>{z(e,0),z(m,!1)})})}),{deviation:e}},L(e_,cv,xv,G_,qg,C_)),Iv,q_,J(([e,t,n,r,i,a,o,s,c,l,u])=>({...e,...t,...n,...r,...i,...a,...o,...s,...c,...l,...u}),L(mv,Av,J_,Mv,Sv,jv,Cv,Nv,Ev,qg,wv))));function Bv(e,t){let n={},r={},i=0,a=e.length;for(;i<a;)r[e[i]]=1,i+=1;for(let e in t)Object.hasOwn(r,e)||(n[e]=t[e]);return n}var Vv=typeof document<`u`?M.useLayoutEffect:M.useEffect;function Hv(e,t,n){let r=Object.keys(t.required||{}),i=Object.keys(t.optional||{}),a=Object.keys(t.methods||{}),o=Object.keys(t.events||{}),s=M.createContext({});function c(e,n){e.propsReady!==void 0&&z(e.propsReady,!1);for(let i of r){let r=e[t.required[i]];z(r,n[i])}for(let r of i)if(r in n){let i=e[t.optional[r]];z(i,n[r])}e.propsReady!==void 0&&z(e.propsReady,!0)}function l(e){return a.reduce((n,r)=>(n[r]=n=>{let i=e[t.methods[r]];z(i,n)},n),{})}function u(e){return o.reduce((n,r)=>(n[r]=Lg(e[t.events[r]]),n),{})}return{Component:M.forwardRef(function(t,a){let{children:d,...f}=t,[p]=M.useState(()=>Tg(Vg(e),e=>{c(e,f)})),[m]=M.useState(bg(u,p));Vv(()=>{for(let e of o)e in f&&R(m[e],f[e]);return()=>{Object.values(m).map(Dg)}},[f,m,p]),Vv(()=>{c(p,f)}),M.useImperativeHandle(a,_g(l(p)));let h=n;return(0,P.jsx)(s.Provider,{value:p,children:n===void 0?d:(0,P.jsx)(h,{...Bv([...r,...i,...o],f),children:d})})}),useEmitter:(e,t)=>{let n=M.useContext(s)[e];Vv(()=>R(n,t),[t,n])},useEmitterValue:e=>{let t=M.useContext(s)[e],[n,r]=M.useState(bg(Og,t));return Vv(()=>R(t,e=>{e!==n&&r(_g(e))}),[t,n]),n},usePublisher:e=>{let t=M.useContext(s);return M.useCallback(n=>{z(t[e],n)},[t,e])}}}var Uv=M.createContext(void 0),Wv=M.createContext(void 0),Gv=`-webkit-sticky`,Kv=`sticky`,qv=Lv(()=>{if(typeof document>`u`)return Kv;let e=document.createElement(`div`);return e.style.position=Gv,e.style.position===Gv?Gv:Kv}),Jv=typeof document<`u`?M.useLayoutEffect:M.useEffect;function Yv(e){return`self`in e}function Xv(e){return`body`in e}function Zv(e,t,n,r=wg,i,a){let o=M.useRef(null),s=M.useRef(null),c=M.useRef(null),l=M.useCallback(n=>{let r,i,o,l=n.target;if(Xv(l)||Yv(l)){let e=Yv(l)?l:l.defaultView;o=a===!0?e.scrollX:e.scrollY,r=a===!0?e.document.documentElement.scrollWidth:e.document.documentElement.scrollHeight,i=a===!0?e.innerWidth:e.innerHeight}else o=a===!0?l.scrollLeft:l.scrollTop,r=a===!0?l.scrollWidth:l.scrollHeight,i=a===!0?l.offsetWidth:l.offsetHeight;let u=()=>{e({scrollHeight:r,scrollTop:Math.max(o,0),viewportHeight:i})};n.suppressFlushSync===!0?u():Ca.flushSync(u),s.current!==null&&(o===s.current||o<=0||o===r-i)&&(s.current=null,t(!0),c.current&&=(clearTimeout(c.current),null))},[e,t,a]);M.useEffect(()=>{let e=i||o.current;return r(i||o.current),l({suppressFlushSync:!0,target:e}),e.addEventListener(`scroll`,l,{passive:!0}),()=>{r(null),e.removeEventListener(`scroll`,l)}},[o,l,n,r,i]);function u(n){let r=o.current;if(!r||(a===!0?`offsetWidth`in r&&r.offsetWidth===0:`offsetHeight`in r&&r.offsetHeight===0))return;let i=n.behavior===`smooth`,l,u,d;Yv(r)?(u=Math.max(D_(r.document.documentElement,a===!0?`width`:`height`),a===!0?r.document.documentElement.scrollWidth:r.document.documentElement.scrollHeight),l=a===!0?r.innerWidth:r.innerHeight,d=a===!0?window.scrollX:window.scrollY):(u=r[a===!0?`scrollWidth`:`scrollHeight`],l=D_(r,a===!0?`width`:`height`),d=r[a===!0?`scrollLeft`:`scrollTop`]);let f=u-l;if(n.top=Math.ceil(Math.max(Math.min(f,n.top),0)),nv(l,u)||n.top===d){e({scrollHeight:u,scrollTop:d,viewportHeight:l}),i&&t(!0);return}i?(s.current=n.top,c.current&&clearTimeout(c.current),c.current=setTimeout(()=>{c.current=null,s.current=null,t(!0)},1e3)):s.current=null,a===!0&&(n={...n.behavior===void 0?{}:{behavior:n.behavior},left:n.top}),r.scrollTo(n)}function d(e){a===!0&&(e={...e.behavior===void 0?{}:{behavior:e.behavior},...e.top===void 0?{}:{left:e.top}}),o.current.scrollBy(e)}return{scrollByCallback:d,scrollerRef:o,scrollToCallback:u}}function Qv(e){return e}var $v=J(([e,t])=>({...e,...t}),L(zv,J(()=>{let e=K(e=>`Item ${e}`),t=K(e=>`Group ${e}`),n=K({}),r=K(Qv),i=K(`div`),a=K(wg),o=(e,t=null)=>Rg(W(n,U(t=>t[e]),V()),t);return{components:n,computeItemKey:r,EmptyPlaceholder:o(`EmptyPlaceholder`),FooterComponent:o(`Footer`),GroupComponent:o(`Group`,`div`),groupContent:t,HeaderComponent:o(`Header`),HeaderFooterTag:i,ItemComponent:o(`Item`,`div`),itemContent:e,ListComponent:o(`List`,`div`),ScrollerComponent:o(`Scroller`,`div`),scrollerRef:a,ScrollSeekPlaceholder:o(`ScrollSeekPlaceholder`),TopItemListComponent:o(`TopItemList`)}}))),ey=({height:e})=>(0,P.jsx)(`div`,{style:{height:e}}),ty={overflowAnchor:`none`,position:qv(),zIndex:1},ny={overflowAnchor:`none`},ry={...ny,display:`inline-block`,height:`100%`},iy=M.memo(function({showTopList:e=!1}){let t=Q(`listState`),n=yy(`sizeRanges`),r=Q(`useWindowScroll`),i=Q(`customScrollParent`),a=yy(`windowScrollContainerState`),o=yy(`scrollContainerState`),s=i||r?a:o,c=Q(`itemContent`),l=Q(`context`),u=Q(`groupContent`),d=Q(`trackItemSizes`),f=Q(`itemSize`),p=Q(`log`),m=yy(`gap`),h=Q(`horizontalDirection`),{callbackRef:g}=Xg(n,f,d,e?wg:s,p,m,i,h,Q(`skipAnimationFrameInResizeObserver`)),[_,v]=M.useState(0);vy(`deviation`,e=>{_!==e&&v(e)});let y=Q(`EmptyPlaceholder`),b=Q(`ScrollSeekPlaceholder`)??ey,x=Q(`ListComponent`),S=Q(`ItemComponent`),C=Q(`GroupComponent`),w=Q(`computeItemKey`),T=Q(`isSeeking`),E=Q(`groupIndices`).length>0,ee=Q(`alignToBottom`),te=Q(`initialItemFinalLocationReached`),ne=e?{}:{boxSizing:`border-box`,...h?{display:`inline-block`,height:`100%`,marginLeft:_===0?ee?`auto`:0:_,paddingLeft:t.offsetTop,paddingRight:t.offsetBottom,whiteSpace:`nowrap`}:{marginTop:_===0?ee?`auto`:0:_,paddingBottom:t.offsetBottom,paddingTop:t.offsetTop},...te?{}:{visibility:`hidden`}};return!e&&t.totalCount===0&&y!=null?(0,P.jsx)(y,{...Z(y,l)}):(0,P.jsx)(x,{...Z(x,l),"data-testid":e?`virtuoso-top-item-list`:`virtuoso-item-list`,ref:g,style:ne,children:(e?t.topItems:t.items).map(e=>{let n=e.originalIndex,r=w(n+t.firstItemIndex,e.data,l);return T?(0,M.createElement)(b,{...Z(b,l),height:e.size,index:e.index,key:r,type:e.type||`item`,...e.type===`group`?{}:{groupIndex:e.groupIndex}}):e.type===`group`?(0,M.createElement)(C,{...Z(C,l),"data-index":n,"data-item-index":e.index,"data-known-size":e.size,key:r,style:ty},u(e.index,l)):(0,M.createElement)(S,{...Z(S,l),...ly(S,e.data),"data-index":n,"data-item-group-index":e.groupIndex,"data-item-index":e.index,"data-known-size":e.size,key:r,style:h?ry:ny},E?c(e.index,e.groupIndex,e.data,l):c(e.index,e.data,l))})})}),ay={height:`100%`,outline:`none`,overflowY:`auto`,position:`relative`,WebkitOverflowScrolling:`touch`},oy={outline:`none`,overflowX:`auto`,position:`relative`},sy=e=>({height:`100%`,position:`absolute`,top:0,width:`100%`,...e?{display:`flex`,flexDirection:`column`}:void 0}),cy={position:qv(),top:0,width:`100%`,zIndex:1};function Z(e,t){if(typeof e!=`string`)return{context:t}}function ly(e,t){return{item:typeof e==`string`?void 0:t}}var uy=M.memo(function(){let e=Q(`HeaderComponent`),t=yy(`headerHeight`),n=Q(`HeaderFooterTag`),r=Jg(M.useMemo(()=>e=>{t(D_(e,`height`))},[t]),!0,Q(`skipAnimationFrameInResizeObserver`)),i=Q(`context`);return e==null?null:(0,P.jsx)(n,{ref:r,children:(0,P.jsx)(e,{...Z(e,i)})})}),dy=M.memo(function(){let e=Q(`FooterComponent`),t=yy(`footerHeight`),n=Q(`HeaderFooterTag`),r=Jg(M.useMemo(()=>e=>{t(D_(e,`height`))},[t]),!0,Q(`skipAnimationFrameInResizeObserver`)),i=Q(`context`);return e==null?null:(0,P.jsx)(n,{ref:r,children:(0,P.jsx)(e,{...Z(e,i)})})});function fy({useEmitter:e,useEmitterValue:t,usePublisher:n}){return M.memo(function({children:r,style:i,context:a,...o}){let s=n(`scrollContainerState`),c=t(`ScrollerComponent`),l=n(`smoothScrollTargetReached`),u=t(`scrollerRef`),d=t(`horizontalDirection`)||!1,{scrollByCallback:f,scrollerRef:p,scrollToCallback:m}=Zv(s,l,c,u,void 0,d);return e(`scrollTo`,m),e(`scrollBy`,f),(0,P.jsx)(c,{"data-testid":`virtuoso-scroller`,"data-virtuoso-scroller":!0,ref:p,style:{...d?oy:ay,...i},tabIndex:0,...o,...Z(c,a),children:r})})}function py({useEmitter:e,useEmitterValue:t,usePublisher:n}){return M.memo(function({children:r,style:i,context:a,...o}){let s=n(`windowScrollContainerState`),c=t(`ScrollerComponent`),l=n(`smoothScrollTargetReached`),u=t(`totalListHeight`),d=t(`deviation`),f=t(`customScrollParent`),p=M.useRef(null),{scrollByCallback:m,scrollerRef:h,scrollToCallback:g}=Zv(s,l,c,t(`scrollerRef`),f);return Jv(()=>(h.current=f||p.current?.ownerDocument.defaultView,()=>{h.current=null}),[h,f]),e(`windowScrollTo`,g),e(`scrollBy`,m),(0,P.jsx)(c,{ref:p,"data-virtuoso-scroller":!0,style:{position:`relative`,...i,...u===0?void 0:{height:u+d}},...o,...Z(c,a),children:r})})}var my=({children:e})=>{let t=M.useContext(Uv),n=yy(`viewportHeight`),r=yy(`fixedItemHeight`),i=Q(`alignToBottom`),a=Q(`horizontalDirection`),o=Jg(M.useMemo(()=>yg(n,e=>D_(e,a?`width`:`height`)),[n,a]),!0,Q(`skipAnimationFrameInResizeObserver`));return M.useEffect(()=>{t&&(n(t.viewportHeight),r(t.itemHeight))},[t,n,r]),(0,P.jsx)(`div`,{"data-viewport-type":`element`,ref:o,style:sy(i),children:e})},hy=({children:e})=>{let t=M.useContext(Uv),n=yy(`windowViewportRect`),r=yy(`fixedItemHeight`),i=$g(n,Q(`customScrollParent`),Q(`skipAnimationFrameInResizeObserver`)),a=Q(`alignToBottom`);return M.useEffect(()=>{t&&(r(t.itemHeight),n({listHeight:0,offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:100}))},[t,n,r]),(0,P.jsx)(`div`,{"data-viewport-type":`window`,ref:i,style:sy(a),children:e})},gy=({children:e})=>{let t=Q(`TopItemListComponent`)??`div`,n=Q(`headerHeight`);return(0,P.jsx)(t,{style:{...cy,marginTop:`${n}px`},...Z(t,Q(`context`)),children:e})},{Component:_y,useEmitter:vy,useEmitterValue:Q,usePublisher:yy}=Hv($v,{optional:{restoreStateFrom:`restoreStateFrom`,context:`context`,followOutput:`followOutput`,scrollIntoViewOnChange:`scrollIntoViewOnChange`,itemContent:`itemContent`,groupContent:`groupContent`,overscan:`overscan`,increaseViewportBy:`increaseViewportBy`,minOverscanItemCount:`minOverscanItemCount`,totalCount:`totalCount`,groupCounts:`groupCounts`,topItemCount:`topItemCount`,firstItemIndex:`firstItemIndex`,initialTopMostItemIndex:`initialTopMostItemIndex`,components:`components`,atBottomThreshold:`atBottomThreshold`,atTopThreshold:`atTopThreshold`,computeItemKey:`computeItemKey`,defaultItemHeight:`defaultItemHeight`,fixedGroupHeight:`fixedGroupHeight`,fixedItemHeight:`fixedItemHeight`,heightEstimates:`heightEstimates`,itemSize:`itemSize`,scrollSeekConfiguration:`scrollSeekConfiguration`,headerFooterTag:`HeaderFooterTag`,data:`data`,initialItemCount:`initialItemCount`,initialScrollTop:`initialScrollTop`,alignToBottom:`alignToBottom`,useWindowScroll:`useWindowScroll`,customScrollParent:`customScrollParent`,scrollerRef:`scrollerRef`,logLevel:`logLevel`,horizontalDirection:`horizontalDirection`,skipAnimationFrameInResizeObserver:`skipAnimationFrameInResizeObserver`},methods:{scrollToIndex:`scrollToIndex`,scrollIntoView:`scrollIntoView`,scrollTo:`scrollTo`,scrollBy:`scrollBy`,autoscrollToBottom:`autoscrollToBottom`,getState:`getState`},events:{isScrolling:`isScrolling`,endReached:`endReached`,startReached:`startReached`,rangeChanged:`rangeChanged`,atBottomStateChange:`atBottomStateChange`,atTopStateChange:`atTopStateChange`,totalListHeightChanged:`totalListHeightChanged`,itemsRendered:`itemsRendered`,groupIndices:`groupIndices`}},M.memo(function(e){let t=Q(`useWindowScroll`),n=Q(`topItemsIndexes`).length>0,r=Q(`customScrollParent`),i=Q(`context`);return(0,P.jsxs)(r||t?xy:by,{...e,context:i,children:[n&&(0,P.jsx)(gy,{children:(0,P.jsx)(iy,{showTopList:!0})}),(0,P.jsxs)(r||t?hy:my,{children:[(0,P.jsx)(uy,{}),(0,P.jsx)(iy,{}),(0,P.jsx)(dy,{})]})]})})),by=fy({useEmitter:vy,useEmitterValue:Q,usePublisher:yy}),xy=py({useEmitter:vy,useEmitterValue:Q,usePublisher:yy}),Sy=_y,Cy=J(([e,t])=>({...e,...t}),L(zv,J(()=>{let e=K(e=>(0,P.jsxs)(`td`,{children:[`Item $`,e]})),t=K(null),n=K(e=>(0,P.jsxs)(`td`,{colSpan:1e3,children:[`Group `,e]})),r=K(null),i=K(null),a=K({}),o=K(Qv),s=K(wg),c=(e,t=null)=>Rg(W(a,U(t=>t[e]),V()),t);return{components:a,computeItemKey:o,context:t,EmptyPlaceholder:c(`EmptyPlaceholder`),FillerRow:c(`FillerRow`),fixedFooterContent:i,fixedHeaderContent:r,itemContent:e,groupContent:n,ScrollerComponent:c(`Scroller`,`div`),scrollerRef:s,ScrollSeekPlaceholder:c(`ScrollSeekPlaceholder`),TableBodyComponent:c(`TableBody`,`tbody`),TableComponent:c(`Table`,`table`),TableFooterComponent:c(`TableFoot`,`tfoot`),TableHeadComponent:c(`TableHead`,`thead`),TableRowComponent:c(`TableRow`,`tr`),GroupComponent:c(`Group`,`tr`)}}))),wy=({height:e})=>(0,P.jsx)(`tr`,{children:(0,P.jsx)(`td`,{style:{height:e}})}),Ty=({height:e})=>(0,P.jsx)(`tr`,{children:(0,P.jsx)(`td`,{style:{border:0,height:e,padding:0}})}),Ey={overflowAnchor:`none`},Dy={position:qv(),zIndex:2,overflowAnchor:`none`},Oy=M.memo(function({showTopList:e=!1}){let t=$(`listState`),n=$(`computeItemKey`),r=$(`firstItemIndex`),i=$(`context`),a=$(`isSeeking`),o=$(`fixedHeaderHeight`),s=$(`groupIndices`).length>0,c=$(`itemContent`),l=$(`groupContent`),u=$(`ScrollSeekPlaceholder`)??wy,d=$(`GroupComponent`),f=$(`TableRowComponent`),p=(e?t.topItems:[]).reduce((e,t,n)=>(n===0?e.push(t.size):e.push(e[n-1]+t.size),e),[]);return(e?t.topItems:t.items).map(t=>{let m=t.originalIndex,h=n(m+r,t.data,i),g=e?m===0?0:p[m-1]:0;return a?(0,M.createElement)(u,{...Z(u,i),height:t.size,index:t.index,key:h,type:t.type||`item`}):t.type===`group`?(0,M.createElement)(d,{...Z(d,i),"data-index":m,"data-item-index":t.index,"data-known-size":t.size,key:h,style:{...Dy,top:o}},l(t.index,i)):(0,M.createElement)(f,{...Z(f,i),...ly(f,t.data),"data-index":m,"data-item-index":t.index,"data-known-size":t.size,"data-item-group-index":t.groupIndex,key:h,style:e?{...Dy,top:o+g}:Ey},s?c(t.index,t.groupIndex,t.data,i):c(t.index,t.data,i))})}),ky=M.memo(function(){let e=$(`listState`),t=$(`topItemsIndexes`).length>0,n=Py(`sizeRanges`),r=$(`useWindowScroll`),i=$(`customScrollParent`),a=Py(`windowScrollContainerState`),o=Py(`scrollContainerState`),s=i||r?a:o,c=$(`trackItemSizes`),{callbackRef:l,ref:u}=Xg(n,$(`itemSize`),c,s,$(`log`),void 0,i,!1,$(`skipAnimationFrameInResizeObserver`)),[d,f]=M.useState(0);Ny(`deviation`,e=>{d!==e&&(u.current.style.marginTop=`${e}px`,f(e))});let p=$(`EmptyPlaceholder`),m=$(`FillerRow`)??Ty,h=$(`TableBodyComponent`),g=$(`paddingTopAddition`),_=$(`statefulTotalCount`),v=$(`context`);if(_===0&&p!=null)return(0,P.jsx)(p,{...Z(p,v)});let y=(t?e.topItems:[]).reduce((e,t)=>e+t.size,0),b=e.offsetTop+g+d-y,x=e.offsetBottom,S=b>0?(0,P.jsx)(m,{context:v,height:b},`padding-top`):null,C=x>0?(0,P.jsx)(m,{context:v,height:x},`padding-bottom`):null;return(0,P.jsxs)(h,{"data-testid":`virtuoso-item-list`,ref:l,...Z(h,v),children:[S,t&&(0,P.jsx)(Oy,{showTopList:!0}),(0,P.jsx)(Oy,{}),C]})}),Ay=({children:e})=>{let t=M.useContext(Uv),n=Py(`viewportHeight`),r=Py(`fixedItemHeight`),i=Jg(M.useMemo(()=>yg(n,e=>D_(e,`height`)),[n]),!0,$(`skipAnimationFrameInResizeObserver`));return M.useEffect(()=>{t&&(n(t.viewportHeight),r(t.itemHeight))},[t,n,r]),(0,P.jsx)(`div`,{"data-viewport-type":`element`,ref:i,style:sy(!1),children:e})},jy=({children:e})=>{let t=M.useContext(Uv),n=Py(`windowViewportRect`),r=Py(`fixedItemHeight`),i=$g(n,$(`customScrollParent`),$(`skipAnimationFrameInResizeObserver`));return M.useEffect(()=>{t&&(r(t.itemHeight),n({listHeight:0,offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:100}))},[t,n,r]),(0,P.jsx)(`div`,{"data-viewport-type":`window`,ref:i,style:sy(!1),children:e})},{Component:My,useEmitter:Ny,useEmitterValue:$,usePublisher:Py}=Hv(Cy,{optional:{restoreStateFrom:`restoreStateFrom`,context:`context`,followOutput:`followOutput`,firstItemIndex:`firstItemIndex`,itemContent:`itemContent`,groupContent:`groupContent`,fixedHeaderContent:`fixedHeaderContent`,fixedFooterContent:`fixedFooterContent`,overscan:`overscan`,increaseViewportBy:`increaseViewportBy`,minOverscanItemCount:`minOverscanItemCount`,totalCount:`totalCount`,topItemCount:`topItemCount`,initialTopMostItemIndex:`initialTopMostItemIndex`,components:`components`,groupCounts:`groupCounts`,atBottomThreshold:`atBottomThreshold`,atTopThreshold:`atTopThreshold`,computeItemKey:`computeItemKey`,defaultItemHeight:`defaultItemHeight`,fixedGroupHeight:`fixedGroupHeight`,fixedItemHeight:`fixedItemHeight`,itemSize:`itemSize`,scrollSeekConfiguration:`scrollSeekConfiguration`,data:`data`,initialItemCount:`initialItemCount`,initialScrollTop:`initialScrollTop`,alignToBottom:`alignToBottom`,useWindowScroll:`useWindowScroll`,customScrollParent:`customScrollParent`,scrollerRef:`scrollerRef`,logLevel:`logLevel`},methods:{scrollToIndex:`scrollToIndex`,scrollIntoView:`scrollIntoView`,scrollTo:`scrollTo`,scrollBy:`scrollBy`,getState:`getState`},events:{isScrolling:`isScrolling`,endReached:`endReached`,startReached:`startReached`,rangeChanged:`rangeChanged`,atBottomStateChange:`atBottomStateChange`,atTopStateChange:`atTopStateChange`,totalListHeightChanged:`totalListHeightChanged`,itemsRendered:`itemsRendered`,groupIndices:`groupIndices`}},M.memo(function(e){let t=$(`useWindowScroll`),n=$(`customScrollParent`),r=Py(`fixedHeaderHeight`),i=Py(`fixedFooterHeight`),a=$(`fixedHeaderContent`),o=$(`fixedFooterContent`),s=$(`context`),c=Jg(M.useMemo(()=>yg(r,e=>D_(e,`height`)),[r]),!0,$(`skipAnimationFrameInResizeObserver`)),l=Jg(M.useMemo(()=>yg(i,e=>D_(e,`height`)),[i]),!0,$(`skipAnimationFrameInResizeObserver`)),u=n||t?Iy:Fy,d=n||t?jy:Ay,f=$(`TableComponent`),p=$(`TableHeadComponent`),m=$(`TableFooterComponent`),h=a?(0,P.jsx)(p,{ref:c,style:{position:`sticky`,top:0,zIndex:2},...Z(p,s),children:a()},`TableHead`):null,g=o?(0,P.jsx)(m,{ref:l,style:{bottom:0,position:`sticky`,zIndex:1},...Z(m,s),children:o()},`TableFoot`):null;return(0,P.jsx)(u,{...e,...Z(u,s),children:(0,P.jsx)(d,{children:(0,P.jsxs)(f,{style:{borderSpacing:0,overflowAnchor:`none`},...Z(f,s),children:[h,(0,P.jsx)(ky,{},`TableBody`),g]})})})})),Fy=fy({useEmitter:Ny,useEmitterValue:$,usePublisher:Py}),Iy=py({useEmitter:Ny,useEmitterValue:$,usePublisher:Py}),Ly=My,Ry={bottom:0,itemHeight:0,items:[],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},zy={bottom:0,itemHeight:0,items:[{index:0}],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},{ceil:By,floor:Vy,max:Hy,min:Uy,round:Wy}=Math;function Gy(e,t,n){return Array.from({length:t-e+1}).map((t,r)=>({data:n===null?null:n[r+e],index:r+e}))}function Ky(e){return{...zy,items:e}}function qy(e,t){return e!==void 0&&e.width===t.width&&e.height===t.height}function Jy(e,t){return e!==void 0&&e.column===t.column&&e.row===t.row}var Yy=J(([{increaseViewportBy:e,listBoundary:t,overscan:n,visibleRange:r},{footerHeight:i,headerHeight:a,scrollBy:o,scrollContainerState:s,scrollTo:c,scrollTop:l,smoothScrollTargetReached:u,viewportHeight:d},f,p,{didMount:m,propsReady:h},{customScrollParent:g,useWindowScroll:_,windowScrollContainerState:v,windowScrollTo:y,windowViewportRect:b},x])=>{let S=K(0),C=K(0),w=K(Ry),T=K({height:0,width:0}),E=K({height:0,width:0}),ee=q(),te=q(),ne=K(0),D=K(null),O=K({column:0,row:0}),re=q(),ie=q(),ae=K(!1),oe=K(0),se=K(!0),ce=K(!1),le=K(!1);R(W(m,G(oe),H(([e,t])=>t!==0)),()=>{z(se,!1)}),R(W(Hg(m,se,E,T,oe,ce),H(([e,t,n,r,,i])=>e&&!t&&n.height!==0&&r.height!==0&&!i)),([,,,,e])=>{z(ce,!0),$_(1,()=>{z(ee,e)}),kg(W(l),()=>{z(t,[0,0]),z(se,!0)})}),B(W(ie,H(e=>e!=null&&e.scrollTop>0),Mg(0)),C),R(W(m,G(ie),H(([,e])=>e!=null)),([,e])=>{e&&(z(T,e.viewport),z(E,e.item),z(O,e.gap),e.scrollTop>0&&(z(ae,!0),kg(W(l,Pg(1)),e=>{z(ae,!1)}),z(c,{top:e.scrollTop})))}),B(W(T,U(({height:e})=>e)),d),B(W(Hg(Y(T,qy),Y(E,qy),Y(O,(e,t)=>e!==void 0&&e.column===t.column&&e.row===t.row),Y(l)),U(([e,t,n,r])=>({gap:n,item:t,scrollTop:r,viewport:e}))),re),B(W(Hg(Y(S),r,Y(O,Jy),Y(E,qy),Y(T,qy),Y(D),Y(C),Y(ae),Y(se),Y(oe)),H(([,,,,,,,e])=>!e),U(([e,[t,n],r,i,a,o,s,,c,l])=>{let{column:u,row:d}=r,{height:f,width:p}=i,{width:m}=a;if(s===0&&(e===0||m===0))return Ry;if(p===0){let t=ev(l,e);return Ky(Gy(t,t+Math.max(s-1,0),o))}let h=Xy(m,p,u),g,_;c?t===0&&n===0&&s>0?(g=0,_=s-1):(g=h*Vy((t+d)/(f+d)),_=h*By((n+d)/(f+d))-1,_=Uy(e-1,Hy(_,h-1)),g=Uy(_,Hy(0,g))):(g=0,_=-1);let v=Gy(g,_,o),{bottom:y,top:b}=Zy(a,r,i,v),x=By(e/h);return{bottom:y,itemHeight:f,items:v,itemWidth:p,offsetBottom:x*f+(x-1)*d-y,offsetTop:b,top:b}})),w),B(W(D,H(e=>e!==null),U(e=>e.length)),S),B(W(Hg(T,E,w,O),H(([e,t,{items:n}])=>n.length>0&&t.height!==0&&e.height!==0),U(([e,t,{items:n},r])=>{let{bottom:i,top:a}=Zy(e,r,t,n);return[a,i]}),V(S_)),t);let ue=K(!1);B(W(l,G(ue),U(([e,t])=>t||e!==0)),ue);let de=zg(W(Hg(w,S),H(([{items:e}])=>e.length>0),G(ue),H(([[e,t],n])=>{let r=e.items[e.items.length-1].index===t-1;return(n||e.bottom>0&&e.itemHeight>0&&e.offsetBottom===0&&e.items.length===t)&&r}),U(([[,e]])=>e-1),V())),fe=zg(W(Y(w),H(({items:e})=>e.length>0&&e[0].index===0),Mg(0),V())),pe=zg(W(Y(w),G(ae),H(([{items:e},t])=>e.length>0&&!t),U(([{items:e}])=>({endIndex:e[e.length-1].index,startIndex:e[0].index})),V(x_),Fg(0)));B(pe,p.scrollSeekRangeChanged),B(W(ee,G(T,E,S,O),U(([e,t,n,r,i])=>{let a=X_(e),{align:o,behavior:s,offset:c}=a,l=a.index;l===`LAST`&&(l=r-1),l=Hy(0,l,Uy(r-1,l));let u=Qy(t,i,n,l);return o===`end`?u=Wy(u-t.height+n.height):o===`center`&&(u=Wy(u-t.height/2+n.height/2)),c!==void 0&&c!==0&&(u+=c),{behavior:s,top:u}})),c);let me=Rg(W(w,U(e=>e.offsetBottom+e.bottom)),0);return B(W(b,U(e=>({height:e.visibleHeight,width:e.visibleWidth}))),T),{customScrollParent:g,data:D,deviation:ne,footerHeight:i,gap:O,headerHeight:a,increaseViewportBy:e,initialItemCount:C,itemDimensions:E,overscan:n,restoreStateFrom:ie,scrollBy:o,scrollContainerState:s,scrollHeight:te,scrollTo:c,scrollToIndex:ee,scrollTop:l,smoothScrollTargetReached:u,totalCount:S,useWindowScroll:_,viewportDimensions:T,windowScrollContainerState:v,windowScrollTo:y,windowViewportRect:b,...p,gridState:w,horizontalDirection:le,initialTopMostItemIndex:oe,totalListHeight:me,...f,endReached:de,propsReady:h,rangeChanged:pe,startReached:fe,stateChanged:re,stateRestoreInProgress:ae,...x}},L(mv,e_,cv,Mv,J_,Nv,qg));function Xy(e,t,n){return Hy(1,Vy((e+n)/(Vy(t)+n)))}function Zy(e,t,n,r){let{height:i}=n;if(i===void 0||r.length===0)return{bottom:0,top:0};let a=Qy(e,t,n,r[0].index);return{bottom:Qy(e,t,n,r[r.length-1].index)+i,top:a}}function Qy(e,t,n,r){let i=Vy(r/Xy(e.width,n.width,t.column)),a=i*n.height+Hy(0,i-1)*t.row;return a>0?a+t.row:a}var $y=J(([e,t])=>({...e,...t}),L(Yy,J(()=>{let e=K(e=>`Item ${e}`),t=K({}),n=K(null),r=K(`virtuoso-grid-item`),i=K(`virtuoso-grid-list`),a=K(Qv),o=K(`div`),s=K(wg),c=(e,n=null)=>Rg(W(t,U(t=>t[e]),V()),n),l=K(!1),u=K(!1);return B(Y(u),l),{components:t,computeItemKey:a,context:n,FooterComponent:c(`Footer`),HeaderComponent:c(`Header`),headerFooterTag:o,itemClassName:r,ItemComponent:c(`Item`,`div`),itemContent:e,listClassName:i,ListComponent:c(`List`,`div`),readyStateChanged:l,reportReadyState:u,ScrollerComponent:c(`Scroller`,`div`),scrollerRef:s,ScrollSeekPlaceholder:c(`ScrollSeekPlaceholder`,`div`)}}))),eb=M.memo(function(){let e=sb(`gridState`),t=sb(`listClassName`),n=sb(`itemClassName`),r=sb(`itemContent`),i=sb(`computeItemKey`),a=sb(`isSeeking`),o=cb(`scrollHeight`),s=sb(`ItemComponent`),c=sb(`ListComponent`),l=sb(`ScrollSeekPlaceholder`),u=sb(`context`),d=cb(`itemDimensions`),f=cb(`gap`),p=sb(`log`),m=sb(`stateRestoreInProgress`),h=cb(`reportReadyState`),g=Jg(M.useMemo(()=>e=>{let t=e.parentElement.parentElement.scrollHeight;o(t);let n=e.firstChild;if(n!==null){let{height:e,width:t}=n.getBoundingClientRect();d({height:e,width:t})}f({column:db(`column-gap`,getComputedStyle(e).columnGap,p),row:db(`row-gap`,getComputedStyle(e).rowGap,p)})},[o,d,f,p]),!0,!1);return Jv(()=>{e.itemHeight>0&&e.itemWidth>0&&h(!0)},[e]),m?null:(0,P.jsx)(c,{className:t,ref:g,...Z(c,u),"data-testid":`virtuoso-item-list`,style:{paddingBottom:e.offsetBottom,paddingTop:e.offsetTop},children:e.items.map(t=>{let o=i(t.index,t.data,u);return a?(0,P.jsx)(l,{...Z(l,u),height:e.itemHeight,index:t.index,width:e.itemWidth},o):(0,M.createElement)(s,{...Z(s,u),className:n,"data-index":t.index,key:o},r(t.index,t.data,u))})})}),tb=M.memo(function(){let e=sb(`HeaderComponent`),t=cb(`headerHeight`),n=sb(`headerFooterTag`),r=Jg(M.useMemo(()=>e=>{t(D_(e,`height`))},[t]),!0,!1),i=sb(`context`);return e==null?null:(0,P.jsx)(n,{ref:r,children:(0,P.jsx)(e,{...Z(e,i)})})}),nb=M.memo(function(){let e=sb(`FooterComponent`),t=cb(`footerHeight`),n=sb(`headerFooterTag`),r=Jg(M.useMemo(()=>e=>{t(D_(e,`height`))},[t]),!0,!1),i=sb(`context`);return e==null?null:(0,P.jsx)(n,{ref:r,children:(0,P.jsx)(e,{...Z(e,i)})})}),rb=({children:e})=>{let t=M.useContext(Wv),n=cb(`itemDimensions`),r=cb(`viewportDimensions`),i=Jg(M.useMemo(()=>e=>{r(e.getBoundingClientRect())},[r]),!0,!1);return M.useEffect(()=>{t&&(r({height:t.viewportHeight,width:t.viewportWidth}),n({height:t.itemHeight,width:t.itemWidth}))},[t,r,n]),(0,P.jsx)(`div`,{ref:i,style:sy(!1),children:e})},ib=({children:e})=>{let t=M.useContext(Wv),n=cb(`windowViewportRect`),r=cb(`itemDimensions`),i=$g(n,sb(`customScrollParent`),!1);return M.useEffect(()=>{t&&(r({height:t.itemHeight,width:t.itemWidth}),n({listHeight:0,offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:t.viewportWidth}))},[t,n,r]),(0,P.jsx)(`div`,{ref:i,style:sy(!1),children:e})},{Component:ab,useEmitter:ob,useEmitterValue:sb,usePublisher:cb}=Hv($y,{optional:{context:`context`,totalCount:`totalCount`,overscan:`overscan`,itemContent:`itemContent`,components:`components`,computeItemKey:`computeItemKey`,data:`data`,initialItemCount:`initialItemCount`,scrollSeekConfiguration:`scrollSeekConfiguration`,headerFooterTag:`headerFooterTag`,listClassName:`listClassName`,itemClassName:`itemClassName`,useWindowScroll:`useWindowScroll`,customScrollParent:`customScrollParent`,scrollerRef:`scrollerRef`,logLevel:`logLevel`,restoreStateFrom:`restoreStateFrom`,initialTopMostItemIndex:`initialTopMostItemIndex`,increaseViewportBy:`increaseViewportBy`},methods:{scrollTo:`scrollTo`,scrollBy:`scrollBy`,scrollToIndex:`scrollToIndex`},events:{isScrolling:`isScrolling`,endReached:`endReached`,startReached:`startReached`,rangeChanged:`rangeChanged`,atBottomStateChange:`atBottomStateChange`,atTopStateChange:`atTopStateChange`,stateChanged:`stateChanged`,readyStateChanged:`readyStateChanged`}},M.memo(function({...e}){let t=sb(`useWindowScroll`),n=sb(`customScrollParent`),r=n||t?ub:lb,i=n||t?ib:rb,a=sb(`context`);return(0,P.jsx)(r,{...e,...Z(r,a),children:(0,P.jsxs)(i,{children:[(0,P.jsx)(tb,{}),(0,P.jsx)(eb,{}),(0,P.jsx)(nb,{})]})})})),lb=fy({useEmitter:ob,useEmitterValue:sb,usePublisher:cb}),ub=py({useEmitter:ob,useEmitterValue:sb,usePublisher:cb});function db(e,t,n){return t!==`normal`&&t?.endsWith(`px`)!==!0&&n(`${e} was not resolved to pixel value correctly`,t,Wg.WARN),t===`normal`?0:parseInt(t??`0`,10)}var fb=1,pb=1e3,mb=0;function hb(){return mb=(mb+1)%(2**53-1),mb.toString()}var gb=new Map,_b=e=>{if(gb.has(e))return;let t=setTimeout(()=>{gb.delete(e),xb({type:`REMOVE_TOAST`,toastId:e})},pb);gb.set(e,t)},vb=(e,t)=>{switch(t.type){case`ADD_TOAST`:return{...e,toasts:[t.toast,...e.toasts].slice(0,fb)};case`UPDATE_TOAST`:return{...e,toasts:e.toasts.map(e=>e.id===t.toast.id?{...e,...t.toast}:e)};case`DISMISS_TOAST`:{let{toastId:n}=t;return n?_b(n):e.toasts.forEach(e=>{_b(e.id)}),{...e,toasts:e.toasts.map(e=>e.id===n||n===void 0?{...e,open:!1}:e)}}case`REMOVE_TOAST`:return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(e=>e.id!==t.toastId)}}},yb=[],bb={toasts:[]};function xb(e){bb=vb(bb,e),yb.forEach(e=>{e(bb)})}function Sb({...e}){let t=hb(),n=e=>xb({type:`UPDATE_TOAST`,toast:{...e,id:t}}),r=()=>xb({type:`DISMISS_TOAST`,toastId:t});return xb({type:`ADD_TOAST`,toast:{...e,id:t,open:!0,onOpenChange:e=>{e||r()}}}),{id:t,dismiss:r,update:n}}function Cb(){let e=(0,F.c)(4),[t,n]=M.useState(bb),r,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>(yb.push(n),()=>{let e=yb.indexOf(n);e>-1&&yb.splice(e,1)}),i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),M.useEffect(r,i);let a;return e[2]===t?a=e[3]:(a={...t,toast:Sb,dismiss:wb},e[2]=t,e[3]=a),a}function wb(e){return xb({type:`DISMISS_TOAST`,toastId:e})}var Tb=`AlertDialog`,[Eb,Db]=n(Tb,[d]),Ob=d(),kb=e=>{let{__scopeAlertDialog:t,...n}=e,r=Ob(t);return(0,P.jsx)(te,{...r,...n,modal:!0})};kb.displayName=Tb;var Ab=`AlertDialogTrigger`,jb=M.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=Ob(n);return(0,P.jsx)(He,{...i,...r,ref:t})});jb.displayName=Ab;var Mb=`AlertDialogPortal`,Nb=e=>{let{__scopeAlertDialog:t,...n}=e,r=Ob(t);return(0,P.jsx)(Ue,{...r,...n})};Nb.displayName=Mb;var Pb=`AlertDialogOverlay`,Fb=M.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=Ob(n);return(0,P.jsx)(ge,{...i,...r,ref:t})});Fb.displayName=Pb;var Ib=`AlertDialogContent`,[Lb,Rb]=Eb(Ib),zb=ee(`AlertDialogContent`),Bb=M.forwardRef((e,t)=>{let{__scopeAlertDialog:n,children:r,...i}=e,a=Ob(n),o=M.useRef(null),s=Ve(t,o),c=M.useRef(null);return(0,P.jsx)(ne,{contentName:Ib,titleName:Vb,docsSlug:`alert-dialog`,children:(0,P.jsx)(Lb,{scope:n,cancelRef:c,children:(0,P.jsxs)(Be,{role:`alertdialog`,...a,...i,ref:s,onOpenAutoFocus:k(i.onOpenAutoFocus,e=>{e.preventDefault(),c.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:[(0,P.jsx)(zb,{children:r}),(0,P.jsx)(Yb,{contentRef:o})]})})})});Bb.displayName=Ib;var Vb=`AlertDialogTitle`,Hb=M.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=Ob(n);return(0,P.jsx)(o,{...i,...r,ref:t})});Hb.displayName=Vb;var Ub=`AlertDialogDescription`,Wb=M.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=Ob(n);return(0,P.jsx)(We,{...i,...r,ref:t})});Wb.displayName=Ub;var Gb=`AlertDialogAction`,Kb=M.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=Ob(n);return(0,P.jsx)(de,{...i,...r,ref:t})});Kb.displayName=Gb;var qb=`AlertDialogCancel`,Jb=M.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,{cancelRef:i}=Rb(qb,n),a=Ob(n),o=Ve(t,i);return(0,P.jsx)(de,{...a,...r,ref:o})});Jb.displayName=qb;var Yb=({contentRef:e})=>{let t=`\`${Ib}\` requires a description for the component to be accessible for screen reader users.
|
|
10
|
+
|
|
11
|
+
You can add a description to the \`${Ib}\` by passing a \`${Ub}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
|
|
12
|
+
|
|
13
|
+
Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${Ib}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.
|
|
14
|
+
|
|
15
|
+
For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return M.useEffect(()=>{document.getElementById(e.current?.getAttribute(`aria-describedby`))||console.warn(t)},[t,e]),null},Xb=kb,Zb=Nb,Qb=Fb,$b=Bb,ex=Kb,tx=Jb,nx=Hb,rx=Wb,ix=Xb,ax=Zb,ox=M.forwardRef((e,t)=>{let n=(0,F.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=A(`fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,P.jsx)(Qb,{className:a,...i,ref:t}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});ox.displayName=Qb.displayName;var sx=M.forwardRef((e,t)=>{let n=(0,F.c)(10),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,P.jsx)(ox,{}),n[3]=a):a=n[3];let o;n[4]===r?o=n[5]:(o=A(`fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg`,r),n[4]=r,n[5]=o);let s;return n[6]!==i||n[7]!==t||n[8]!==o?(s=(0,P.jsxs)(ax,{children:[a,(0,P.jsx)($b,{ref:t,className:o,...i})]}),n[6]=i,n[7]=t,n[8]=o,n[9]=s):s=n[9],s});sx.displayName=$b.displayName;var cx=e=>{let t=(0,F.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=A(`flex flex-col space-y-2 text-center sm:text-left`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,P.jsx)(`div`,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a};cx.displayName=`AlertDialogHeader`;var lx=e=>{let t=(0,F.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=A(`flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,P.jsx)(`div`,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a};lx.displayName=`AlertDialogFooter`;var ux=M.forwardRef((e,t)=>{let n=(0,F.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=A(j.dialogTitle,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,P.jsx)(nx,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});ux.displayName=nx.displayName;var dx=M.forwardRef((e,t)=>{let n=(0,F.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=A(j.dialogDescription,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,P.jsx)(rx,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});dx.displayName=rx.displayName;var fx=M.forwardRef((e,t)=>{let n=(0,F.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=A(je(),r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,P.jsx)(ex,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});fx.displayName=ex.displayName;var px=M.forwardRef((e,t)=>{let n=(0,F.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=A(je({variant:`outline`}),`mt-2 sm:mt-0`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,P.jsx)(tx,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});px.displayName=tx.displayName;var mx=(0,M.createContext)(null);function hx(e){let t=(0,F.c)(12),{children:n}=e,[r,i]=(0,M.useState)(`chat`),[a,o]=(0,M.useState)(!1),[s,c]=(0,M.useState)(!1),l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l={},t[0]=l):l=t[0];let[u,d]=(0,M.useState)(l),[f,p]=(0,M.useState)(0),m;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(m=e=>{e&&d(t=>({...t,[e]:(t[e]??0)+1}))},t[1]=m):m=t[1];let h=m,g;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(g=()=>{p(gx)},t[2]=g):g=t[2];let _=g,v;t[3]!==r||t[4]!==s||t[5]!==u||t[6]!==f||t[7]!==a?(v={activeMainTab:r,setActiveMainTab:i,terminalNotification:a,setTerminalNotification:o,chatNotification:s,setChatNotification:c,reviewRefreshTickByThread:u,triggerReviewRefresh:h,tasksRefreshTick:f,triggerTasksRefresh:_},t[3]=r,t[4]=s,t[5]=u,t[6]=f,t[7]=a,t[8]=v):v=t[8];let y=v,b;return t[9]!==n||t[10]!==y?(b=(0,P.jsx)(mx.Provider,{value:y,children:n}),t[9]=n,t[10]=y,t[11]=b):b=t[11],b}function gx(e){return e+1}function _x(){let e=(0,M.useContext)(mx);if(!e)throw Error(`useMainTab must be used within a MainTabProvider`);return e}function vx({nonChatWindows:e,expandedWindowId:t,selectedWindowId:n,threadIds:r,threadMultiPaneStates:i}){let a={};for(let e of r){let t=i[e];!t||Object.keys(t.extraChatPanes).length===0||(a[e]={focusedPaneId:t.focusedPane,panes:Object.entries(t.extraChatPanes).map(([e,t])=>({paneId:e,conversationId:t.conversationId}))})}return{version:1,nonChatWindows:e,layout:t===null?`grid`:`expanded`,expandedWindowId:t,selectedWindowId:n,chatPanesByThread:a}}function yx(e,t){let n=new Set(t?e.chatPanesByThread[t]?.panes.map(e=>e.paneId)??[]:[]),r=new Set(e.nonChatWindows.map(e=>e.id)),i=n.size>0||r.size>0;function a(e){return e===`primary`||e!==null&&(n.has(e)||r.has(e))}let o=a(e.selectedWindowId)?e.selectedWindowId:he,s=null;return e.layout===`expanded`&&i&&(s=a(e.expandedWindowId)?e.expandedWindowId:he),{nonChatWindows:e.nonChatWindows,expandedWindowId:s,selectedWindowId:o}}var bx=re(`app.window-state`);function xx(e){let t=(0,F.c)(25),{nonChatWindows:n,expandedWindowId:r,selectedWindowId:i,onReset:a,onHydrate:o}=e,s=Cs(),c=Ss(Ex),l=Ss(Tx),u=Ss(wx),d,f;if(t[0]!==l||t[1]!==c){let e;t[4]===c?e=t[5]:(e=e=>e.projectId===c,t[4]=c,t[5]=e),d=l.find(e),f=(d?.threads.map(Cx)??[]).join(`\0`),t[0]=l,t[1]=c,t[2]=d,t[3]=f}else d=t[2],f=t[3];let p=f,m=d!==void 0,[h,g]=(0,M.useState)(null),_=(0,M.useRef)(null),v;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(v=Promise.resolve(),t[6]=v):v=t[6];let y=(0,M.useRef)(v),b,x;t[7]!==s||t[8]!==m||t[9]!==o||t[10]!==a||t[11]!==p||t[12]!==c?(b=()=>{if(a(),g(null),_.current=null,!c||!m)return;let e=c,t=p?p.split(`\0`):[],n=!1;return(async function(){try{let r=await xe(e);if(n)return;s({type:I.HydrateProjectChatPanes,threadIds:t,chatPanesByThread:r.chatPanesByThread}),_.current=JSON.stringify(r),o(r),g(e)}catch(e){let t=e;n||bx.error(`Failed to restore project window state`,t)}})(),()=>{n=!0}},x=[s,m,o,a,p,c],t[7]=s,t[8]=m,t[9]=o,t[10]=a,t[11]=p,t[12]=c,t[13]=b,t[14]=x):(b=t[13],x=t[14]),(0,M.useEffect)(b,x);let S,C;t[15]!==r||t[16]!==m||t[17]!==h||t[18]!==n||t[19]!==p||t[20]!==c||t[21]!==i||t[22]!==u?(S=()=>{if(!c||c!==h||!m)return;let e=vx({nonChatWindows:n,expandedWindowId:r,selectedWindowId:i,threadIds:p?p.split(`\0`):[],threadMultiPaneStates:u}),t=JSON.stringify(e);if(t===_.current)return;let a=c;_.current=t,y.current=y.current.catch(Sx).then(()=>ce(a,e)).catch(e=>{bx.error(`Failed to save project window state`,e),_.current===t&&(_.current=null)})},C=[r,m,h,n,c,i,p,u],t[15]=r,t[16]=m,t[17]=h,t[18]=n,t[19]=p,t[20]=c,t[21]=i,t[22]=u,t[23]=S,t[24]=C):(S=t[23],C=t[24]),(0,M.useEffect)(S,C)}function Sx(){}function Cx(e){return e.threadId}function wx(e){return e.threadMultiPaneStates}function Tx(e){return e.projects}function Ex(e){return e.selectedProjectId}var Dx=(0,M.createContext)(null);function Ox(e){let t=(0,F.c)(61),{children:n}=e,r=Cs(),i=xs(),a=Ss(jx),o=Ss(Ax),s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=[],t[0]=s):s=t[0];let[c,l]=(0,M.useState)(s),[u,d]=(0,M.useState)(null),[f,p]=(0,M.useState)(he),[m,h]=(0,M.useState)(null),g;t[1]===o?g=t[2]:(g=Object.keys(o).map(kx),t[1]=o,t[2]=g);let _=g,v;t[3]!==_||t[4]!==c?(v=[..._,...c],t[3]=_,t[4]=c,t[5]=v):v=t[5];let y=v,b;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(b=()=>{l([]),d(null),p(he),h(null)},t[6]=b):b=t[6];let x=b,S;t[7]===i?S=t[8]:(S=e=>{let t=yx(e,i.getState().selectedThreadId);l(t.nonChatWindows),d(t.expandedWindowId),p(t.selectedWindowId),h(null)},t[7]=i,t[8]=S);let C=S,w;t[9]!==u||t[10]!==C||t[11]!==c||t[12]!==f?(w={nonChatWindows:c,expandedWindowId:u,selectedWindowId:f,onReset:x,onHydrate:C},t[9]=u,t[10]=C,t[11]=c,t[12]=f,t[13]=w):w=t[13],xx(w);let T,E;t[14]!==u||t[15]!==o||t[16]!==y?(T=()=>{u&&u!==`primary`&&!y.some(e=>e.id===u)&&!o[u]&&d(y.length>0?he:null)},E=[u,o,y],t[14]=u,t[15]=o,t[16]=y,t[17]=T,t[18]=E):(T=t[17],E=t[18]),(0,M.useEffect)(T,E);let ee,te;t[19]!==o||t[20]!==f||t[21]!==y?(te=()=>{f!==`primary`&&!y.some(e=>e.id===f)&&!o[f]&&p(he)},ee=[o,f,y],t[19]=o,t[20]=f,t[21]=y,t[22]=ee,t[23]=te):(ee=t[22],te=t[23]),(0,M.useEffect)(te,ee);let ne,D;t[24]!==u||t[25]!==y.length?(ne=()=>{y.length===0&&u!==null&&d(null)},D=[u,y.length],t[24]=u,t[25]=y.length,t[26]=ne,t[27]=D):(ne=t[26],D=t[27]),(0,M.useEffect)(ne,D);let O;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(O=e=>{p(e)},t[28]=O):O=t[28];let re=O,ie;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(ie=e=>{p(e),d(e)},t[29]=ie):ie=t[29];let ae=ie,oe;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(oe=()=>{d(null)},t[30]=oe):oe=t[30];let se=oe,ce;t[31]===y.length?ce=t[32]:(ce=e=>{d(t=>t===null&&y.length>0?null:e),h(e)},t[31]=y.length,t[32]=ce);let le=ce,ue;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(ue=()=>{h(null)},t[33]=ue):ue=t[33];let de=ue,fe;t[34]!==r||t[35]!==le||t[36]!==a?(fe=e=>{let t=crypto.randomUUID();return e===`chat`?a?(r({type:I.AddChatPane,paneId:t,conversationId:crypto.randomUUID()}),le(t),t):t:(l(n=>[...n,{id:t,panelId:e}]),le(t),t)},t[34]=r,t[35]=le,t[36]=a,t[37]=fe):fe=t[37];let pe=fe,me;t[38]!==r||t[39]!==y?(me=e=>{let t=y.find(t=>t.id===e);t&&(t.panelId===`chat`?r({type:I.RemoveChatPane,paneId:e}):l(t=>t.filter(t=>t.id!==e)),d(t=>y.length===1?null:t===e?he:t),p(t=>t===e?he:t))},t[38]=r,t[39]=y,t[40]=me):me=t[40];let ge=me,_e;t[41]!==r||t[42]!==y?(_e=()=>{d(null),p(he);for(let e of y)e.panelId===`chat`&&r({type:I.RemoveChatPane,paneId:e.id});l([])},t[41]=r,t[42]=y,t[43]=_e):_e=t[43];let ve=_e,ye;t[44]===y?ye=t[45]:(ye=e=>y.some(t=>t.panelId===e),t[44]=y,t[45]=ye);let be=ye,xe=y.length>0,k=u!==null,Se;t[46]!==pe||t[47]!==ve||t[48]!==ge||t[49]!==u||t[50]!==xe||t[51]!==k||t[52]!==be||t[53]!==m||t[54]!==le||t[55]!==f||t[56]!==y?(Se={windows:y,addWindow:pe,closeWindow:ge,closeAllWindows:ve,isPanelOpen:be,hasOpenWindows:xe,isLayoutExpanded:k,expandedWindowId:u,expandWindow:ae,collapseLayout:se,selectedWindowId:f,selectWindow:re,revealWindow:le,pendingScrollWindowId:m,clearPendingScrollWindow:de},t[46]=pe,t[47]=ve,t[48]=ge,t[49]=u,t[50]=xe,t[51]=k,t[52]=be,t[53]=m,t[54]=le,t[55]=f,t[56]=y,t[57]=Se):Se=t[57];let Ce=Se,we;return t[58]!==n||t[59]!==Ce?(we=(0,P.jsx)(Dx.Provider,{value:Ce,children:n}),t[58]=n,t[59]=Ce,t[60]=we):we=t[60],we}function kx(e){return{id:e,panelId:`chat`}}function Ax(e){return e.extraChatPanes}function jx(e){return e.selectedThreadId}function Mx(){let e=(0,M.useContext)(Dx);if(!e)throw Error(`useChatDock must be used within a ChatDockProvider`);return e}var Nx={onboarding:{status:()=>[`onboarding`,`status`]},app:{update:()=>[`app`,`update`]},models:{enabled:e=>[`models`,`enabled`,e]},userTasks:e=>[`user-tasks`,e],conversations:{recent:()=>[`conversations`,`recent`]}};async function Px(e,t){let n=e.getReader(),r=new TextDecoder,i=``;try{for(;;){let{done:e,value:a}=await n.read();if(e)break;i+=r.decode(a,{stream:!0});let o=i.split(`
|
|
16
|
+
`);i=o.pop()??``;for(let e of o){let n=e.trim();if(n)try{await t(JSON.parse(n),n)}catch{await t(n,n)}}}if(i.trim())try{await t(JSON.parse(i),i)}catch{await t(i,i)}}finally{n.releaseLock()}}async function Fx(e,t){await Px(e,e=>{if(typeof e==`string`){t.onOutput(e);return}if(!e||typeof e!=`object`)return;let n=e;n.type===`error`&&typeof n.message==`string`&&t.onError(n.message)})}function Ix(e,t,n){return JSON.stringify([{type:`tool_use`,name:`bash`,id:t,input:e===null?{}:{command:e},...n?.displayName?{displayName:n.displayName}:{},...n?.activeDisplayName?{activeDisplayName:n.activeDisplayName}:{}}])}function Lx(e,t,n,r){return JSON.stringify([{type:`tool-result`,toolCallId:e,toolName:`bash`,content:t,isError:n,...r?.displayName?{displayName:r.displayName}:{},...r?.activeDisplayName?{activeDisplayName:r.activeDisplayName}:{}}])}function Rx(e,t,n,r,i){return e+Lx(t,n,r,i)}function zx(e){return{messageId:e.messageId,sender:`agent`,content:Ix(e.command,e.toolCallId,e.labels),contentType:`markdown`,timestamp:new Date().toISOString(),isThinking:!1}}var Bx=new Map;function Vx(e,t){let n=Bx.get(e);return n||(n={promise:t().catch(t=>{throw Bx.delete(e),t})},Bx.set(e,n)),n.promise}function Hx(e){Bx.delete(e)}function Ux(e){for(let t of Bx.keys())t.startsWith(e)&&Bx.delete(t)}function Wx(e,t){return(0,M.use)(Vx(e,t))}var Gx={create:`Creating thread`,delete:`Deleting thread`},Kx={create:`Created thread`,delete:`Deleted thread`},qx={create:`Thread creation failed`,delete:`Thread deletion failed`};function Jx(e){return{displayName:Kx[e.kind],activeDisplayName:Gx[e.kind]}}function Yx(e,t){return t?`The branch I created is ${t} and I'm ready to start working on ${e}.`:`I'm ready to start working on ${e}.`}function Xx(e,t){let n=`thread-${e}-${t.threadId}`;return{kind:e,threadId:t.threadId,projectId:t.projectId,projectName:t.projectName,toolCallId:n,messageId:`msg-${n}`}}function Zx(e){return Xx(`create`,e)}function Qx(e){return Xx(`delete`,e)}function $x(e){return zx({messageId:e.messageId,command:e.projectName,toolCallId:e.toolCallId,labels:Jx(e)})}function eS(e,t,n){e({type:I.SetThreadToolSession,session:t}),e({type:I.UpdateToolExecutionOutput,toolCallId:t.toolCallId,toolName:`bash`,executionOutput:n})}function tS(e,t,n){e({type:I.SetThreadToolSession,session:t}),e({type:I.SelectThread,threadId:t.threadId,projectId:t.projectId,focusInput:!0}),e({type:I.SetMessages,messages:[$x(t)]}),eS(e,t,n)}function nS(e,t,n){e({type:I.AddMessage,message:$x(t),threadId:t.threadId}),eS(e,t,n)}function rS(e,t,n){n&&e({type:I.AppendToolExecutionOutput,toolCallId:t,toolName:`bash`,delta:n})}function iS(e,t,n,r){let i=r?.isError===!0,a=t.kind===`create`?Yx(t.projectName,r?.branch):Kx.delete,o={displayName:i?qx[t.kind]:a,activeDisplayName:Gx[t.kind]},s=Rx(Ix(!i&&t.kind===`create`?null:t.projectName,t.toolCallId,o),t.toolCallId,n,i,o);e({type:I.UpdateMessage,messageId:t.messageId,threadId:t.threadId,content:s}),t.kind===`create`&&!i&&e({type:I.SetThreadCreationSummary,threadId:t.threadId,message:{...$x(t),content:s}}),e({type:I.ClearToolCallProgress,toolCallId:t.toolCallId}),e({type:I.ClearThreadToolSession,threadId:t.threadId})}var aS=re(`app.use-projects.hook`);function oS(){let e=(0,F.c)(16),t=Cs(),n=Ss(uS),r=Ss(lS),i=Ss(cS);i>0&&C();let a=Wx(`projects:bootstrap:${i}`,Ce),o=(0,M.useRef)(!1),s;e[0]!==a.projects||e[1]!==t?(s=()=>{t({type:I.SetProjects,projects:a.projects}),t({type:I.SetProjectsLoading,projectsLoading:!1})},e[0]=a.projects,e[1]=t,e[2]=s):s=e[2];let c;e[3]!==a||e[4]!==t?(c=[a,t],e[3]=a,e[4]=t,e[5]=c):c=e[5],(0,M.useLayoutEffect)(s,c);let l;e[6]!==a.projects||e[7]!==t||e[8]!==r||e[9]!==n?(l=()=>{if(!o.current){if(n||r){o.current=!0;return}for(let e of a.projects){let n=e.threads.find(sS);if(n){t({type:I.SelectThread,threadId:n.threadId,projectId:e.projectId}),o.current=!0;break}}}},e[6]=a.projects,e[7]=t,e[8]=r,e[9]=n,e[10]=l):l=e[10];let u;return e[11]!==a||e[12]!==t||e[13]!==r||e[14]!==n?(u=[a,t,n,r],e[11]=a,e[12]=t,e[13]=r,e[14]=n,e[15]=u):u=e[15],(0,M.useLayoutEffect)(l,u),null}function sS(e){return e.isSelected}function cS(e){return e.configUpdatedAt}function lS(e){return e.selectedProjectId}function uS(e){return e.selectedThreadId}function dS(e){let t=Cs(),n=Ss(e=>e.projects),i=Ss(e=>e.selectedProjectId),a=Ss(e=>e.selectedThreadId),{toast:o}=Cb(),s=ws(`project-creation`).dispatch,[c,l]=(0,M.useState)(null),u=(0,M.useCallback)(async()=>{try{t({type:I.SetProjectsLoading,projectsLoading:!0}),C(),Ux(`projects:bootstrap:`);let e=await Ce();t({type:I.SetProjects,projects:e.projects})}catch(e){aS.error(`Failed to refresh projects:`,e)}finally{t({type:I.SetProjectsLoading,projectsLoading:!1})}},[t]),d=(0,M.useCallback)((e,n)=>{(a!==n||i!==e)&&t({type:I.SelectThread,threadId:n,projectId:e}),r(e,n).catch(e=>{aS.error(`Failed to select thread:`,e)})},[t,a,i]),f=(0,M.useCallback)(async n=>{t({type:I.SetCreatingProject,isCreating:!0});try{let r=await n.apiCall();if(!r){t({type:I.SetCreatingProject,isCreating:!1}),await u();return}let i=n.useTerminalDispatch?s:t;i({type:I.ClearTerminalOutput}),i({type:I.SetTerminalOpen,open:!0}),i({type:I.AppendTerminalLine,line:{type:`system`,content:n.initialMessage}});let a=null,o=!1,c=null,d=null;await Px(r,e=>{if(!e||typeof e!=`object`)return;let r=e;try{if(r.type===`progress`)!o&&typeof r.threadId==`string`&&typeof r.projectId==`string`&&(o=!0,c=r.projectId,d=r.threadId,t({type:I.AddCreatingProject,projectId:r.projectId,threadId:r.threadId,projectName:n.optimisticProjectName,gitUrl:n.gitUrl??``}),t({type:I.AddProcessingThread,threadId:r.threadId})),t({type:I.AppendTerminalLine,...n.useTerminalDispatch?{threadId:d??`project-creation`}:{},line:{type:`output`,content:typeof r.message==`string`?r.message:``}});else if(r.type===`complete`){let e=r.project;if(e){a=e.id;let o=n.includeThreadPath&&e.threads&&e.threads.length>0?`${e.path}/${e.threads[0]}`:e.path;i({type:I.AppendTerminalLine,line:{type:`system`,content:`Project created successfully at: ${o}`}}),t({type:I.SetTerminalOpen,open:!1}),n.handleSetupScript&&typeof r.suggestedSetupScript==`string`&&l({projectId:e.id,command:r.suggestedSetupScript,remainingScripts:e.pendingSetupScripts??[]})}}else r.type===`error`&&(o&&c&&(t({type:I.RemoveCreatingProject,projectId:c}),d&&t({type:I.RemoveProcessingThread,threadId:d})),t({type:I.AppendTerminalLine,...n.useTerminalDispatch?{threadId:d??`project-creation`}:{},line:{type:`error`,content:`Error: ${typeof r.message==`string`?r.message:`Unknown error`}`}}))}catch(e){aS.error(`Failed to parse ${n.logTag} event`,e)}}),t({type:I.SetCreatingProject,isCreating:!1}),o&&d&&t({type:I.RemoveProcessingThread,threadId:d}),C();let f=await Ce();if(t({type:I.SetProjects,projects:f.projects}),t({type:I.SetProjectsLoading,projectsLoading:!1}),a){let n=f.projects.find(e=>e.projectId===a);if(n&&n.threads.length>0){let e=n.threads[0].threadId;t({type:I.SelectThread,threadId:e,projectId:a,focusInput:!0})}e?.onProjectCreated?.(a)}}catch(e){aS.error(`Failed to ${n.logTag}:`,e),t({type:I.SetCreatingProject,isCreating:!1}),(n.useTerminalDispatch?s:t)({type:I.AppendTerminalLine,line:{type:`error`,content:`${n.catchErrorPrefix}: ${e instanceof Error?e.message:`Unknown error`}`}})}},[t,u,s,e?.onProjectCreated]),p=(0,M.useCallback)(async(e,t)=>{let n=e.split(`/`).pop()?.replace(`.git`,``)??`project`;await f({apiCall:()=>De(e,t),initialMessage:`Cloning repository: ${e}...`,optimisticProjectName:n,gitUrl:e,useTerminalDispatch:!0,includeThreadPath:!0,handleSetupScript:!0,logTag:`create project`,catchErrorPrefix:`Failed to create project`})},[f]),m=(0,M.useCallback)(async(e,t,n)=>{await f({apiCall:()=>Te(e,t,n),initialMessage:`Creating app "${e}"...`,optimisticProjectName:e,useTerminalDispatch:!0,handleSetupScript:!1,logTag:`create web app`,catchErrorPrefix:`Failed to create web app`})},[f]),h=(0,M.useCallback)(async e=>{await f({apiCall:()=>Fe(e),initialMessage:`Creating folder "${e}"...`,optimisticProjectName:e,useTerminalDispatch:!0,handleSetupScript:!1,logTag:`create folder`,catchErrorPrefix:`Failed to create folder`})},[f]),g=(0,M.useCallback)(async(r,i)=>{let a={current:null};try{let s=n.find(e=>e.projectId===r),c=s?Me(s):`project`;e?.onThreadCreateStart?.(r);let l=i??(()=>{let e=s?.threads.map(e=>e.title)??[],t=/^thread-(\d+)$/i,n=0;for(let r of e){let e=r.match(t);e&&(n=Math.max(n,parseInt(e[1],10)))}return`thread-${n+1}`})(),d=await qe(r,i);if(!d){await u();return}let f=!0,p,m=`Creating thread "${l}"...`,h=[{type:`system`,content:m}],g=`${m}\n`;function _(e,n){let r={type:n,content:e};g+=`${e}\n`;let i=a.current;if(!i){h.push(r);return}t({type:I.AppendTerminalLine,threadId:i.threadId,line:r}),rS(t,i.toolCallId,`${e}\n`)}function v(e){t({type:I.AddCreatingThread,projectId:r,threadId:e,title:l}),t({type:I.AddProcessingThread,threadId:e}),t({type:I.ClearTerminalOutput,threadId:e});for(let n of h)t({type:I.AppendTerminalLine,threadId:e,line:n});h.length=0;let n=Zx({threadId:e,projectId:r,projectName:c});a.current=n,tS(t,n,g)}function y(e){t({type:I.RemoveCreatingThread,projectId:r,threadId:e}),t({type:I.SelectProject,projectId:r})}try{await Px(d,e=>{if(!e||typeof e!=`object`){typeof e==`string`&&aS.error(`Failed to parse thread event`,e);return}let t=e;if(t.type===`progress`)!a.current&&typeof t.threadId==`string`&&v(t.threadId),_(typeof t.message==`string`?t.message:``,`output`);else if(t.type===`complete`){let e=t.thread;typeof e?.currentBranch==`string`&&(p=e.currentBranch)}else if(t.type===`error`){let e=typeof t.message==`string`?t.message:`Unknown error`;_(`Error: ${e}`,`error`),aS.error(`Thread creation error:`,e),o({title:`Thread Creation Failed`,description:e,variant:`destructive`}),f=!1}});let e=a.current;e&&(iS(t,e,g,{branch:p,isError:!f}),t({type:I.RemoveProcessingThread,threadId:e.threadId}),f||y(e.threadId)),C(),await u()}catch(e){let n=e instanceof Error?e.message:String(e),r=a.current;throw r&&(_(`Error: ${n}`,`error`),iS(t,r,g,{isError:!0}),t({type:I.RemoveProcessingThread,threadId:r.threadId}),y(r.threadId)),o({title:`Thread Creation Failed`,description:n,variant:`destructive`}),e}}catch(e){aS.error(`Failed to create thread:`,e);let n=`Failed to create thread: ${e instanceof Error?e.message:`Unknown error`}`;throw t({type:I.AppendTerminalLine,line:{type:`error`,content:n}}),o({variant:`destructive`,title:`Thread Creation Failed`,description:n}),e}},[u,t,n,o,e?.onThreadCreateStart]),_=(0,M.useCallback)(async(e,r)=>{t({type:I.AddDeletingThread,threadId:r}),t({type:I.ClearChatInputDraft,threadId:r});let i=n.find(t=>t.projectId===e),s=i?Me(i):`project`,c=i?.threads.find(e=>e.threadId===r)?.title??`thread`,l=a===r,d=l?Qx({threadId:r,projectId:e,projectName:s}):null,f=`Deleting thread "${c}"...\n`,p=!0,m;function h(e){f+=`${e}\n`,d&&rS(t,d.toolCallId,`${e}\n`)}d&&nS(t,d,f);try{let n=await w(e,r);n&&await Px(n,e=>{if(!e||typeof e!=`object`)return;let t=e;if(t.type===`progress`)h(typeof t.message==`string`?t.message:``);else if(t.type===`complete`)typeof t.removedPath==`string`&&(m=t.removedPath);else if(t.type===`error`){let e=typeof t.message==`string`?t.message:`Unknown error`;h(`Error: ${e}`),aS.error(`Thread deletion error:`,e),o({variant:`destructive`,title:`Failed to delete thread`,description:e}),p=!1}}),d&&iS(t,d,f,{isError:!p}),p&&o({title:`Deleted Cloned Repo`,description:m?`The ${s} repository at ${m} was deleted.`:`${s} was opened from a local folder, so its files were left in place.`}),p&&t({type:I.ClearThreadCreationSummary,threadId:r}),l&&p&&t({type:I.ClearSelection}),await u(),t({type:I.ConfigUpdated})}catch(e){aS.error(`Failed to delete thread:`,e);let n=e instanceof Error?e.message:`Unknown error`;d&&(h(`Error: ${n}`),iS(t,d,f,{isError:!0})),o({variant:`destructive`,title:`Failed to delete thread`,description:n})}finally{t({type:I.RemoveDeletingThread,threadId:r})}},[u,a,t,o,n]),y=(0,M.useCallback)(async e=>{t({type:I.AddDeletingProject,projectId:e});let r=n.find(t=>t.projectId===e)?.threads.map(e=>e.threadId)??[];for(let e of r)t({type:I.AddDeletingThread,threadId:e}),t({type:I.ClearChatInputDraft,threadId:e});try{if(await D(e),i===e){let r=n.find(t=>t.projectId!==e&&t.threads.length>0);t(r?{type:I.SelectThread,threadId:r.threads[0].threadId,projectId:r.projectId}:{type:I.SelectThread,threadId:``,projectId:``})}await u(),t({type:I.ConfigUpdated})}catch(e){aS.error(`Failed to delete project:`,e)}finally{t({type:I.RemoveDeletingProject,projectId:e});for(let e of r)t({type:I.RemoveDeletingThread,threadId:e})}},[u,i,n,t]),x=(0,M.useCallback)(async e=>{let n=c;if(l(null),!n||!e)return;let{projectId:r,command:i,remainingScripts:a}=n,o=[i,...a||[]];try{t({type:I.SetCreatingProject,isCreating:!0}),t({type:I.SetTerminalOpen,open:!0}),t({type:I.AppendTerminalLine,line:{type:`system`,content:`Installing dependencies for ${o.length} package${o.length===1?``:`s`}...`}});for(let e=0;e<o.length;e++){let n=o[e],i=n.match(/^cd "([^"]+)" && (.+)$/),a=i?i[1]:`root`;t({type:I.AppendTerminalLine,line:{type:`system`,content:`Installing package ${e+1}/${o.length} in ${a}...`}}),t({type:I.AppendTerminalLine,line:{type:`output`,content:`📦 Installing dependencies in ${a}: ${n}`}});let s=await Ke(r,n,!0);s&&await Fx(s,{onOutput:e=>{t({type:I.AppendTerminalLine,line:{type:`output`,content:e}})},onError:e=>{t({type:I.AppendTerminalLine,line:{type:`error`,content:e}})}}),e<o.length-1&&(t({type:I.AppendTerminalLine,line:{type:`system`,content:``}}),t({type:I.AppendTerminalLine,line:{type:`system`,content:`---`}}),t({type:I.AppendTerminalLine,line:{type:`system`,content:``}}))}t({type:I.AppendTerminalLine,line:{type:`system`,content:`All dependencies installed successfully!`}}),t({type:I.SetCreatingProject,isCreating:!1}),await u()}catch(e){t({type:I.SetCreatingProject,isCreating:!1}),aS.error(`Failed to run setup script:`,e),t({type:I.AppendTerminalLine,line:{type:`error`,content:`Failed to run setup script: ${e instanceof Error?e.message:`Unknown error`}`}})}},[c,t,u]);return{projects:n,selectedProjectId:i,selectedThreadId:a,refreshProjects:u,handleSelectThread:d,handleCreateProject:p,handleCreateWebApp:m,handleCreateFolder:h,handleOpenFolder:(0,M.useCallback)(async()=>{await f({apiCall:v,initialMessage:`Opening folder...`,optimisticProjectName:`Opening folder...`,useTerminalDispatch:!0,handleSetupScript:!0,logTag:`open folder`,catchErrorPrefix:`Failed to open folder`})},[f]),handleOpenPath:(0,M.useCallback)(async e=>{let t=e.split(/[/\\]/).filter(Boolean).pop()??`project`;await f({apiCall:()=>b(e),initialMessage:`Opening folder: ${e}...`,optimisticProjectName:t,useTerminalDispatch:!0,handleSetupScript:!0,logTag:`open path`,catchErrorPrefix:`Failed to open folder path`})},[f]),handleCreateThread:g,handleDeleteThread:_,confirmDeleteProject:y,pendingSetupScriptConfirmation:c,resolveSetupScriptConfirmation:x}}function fS(){let e=(0,F.c)(15),t=Cs(),n=xs(),r=_n(),i=mn(),{selectWindow:a,revealWindow:o,expandWindow:s,hasOpenWindows:c}=Mx(),{setActiveMainTab:l}=_x(),{handleSelectThread:u}=dS(),d=Ss(mS),f=Ss(pS),p;e[0]!==t||e[1]!==s||e[2]!==u||e[3]!==c||e[4]!==i.pathname||e[5]!==r||e[6]!==f||e[7]!==o||e[8]!==a||e[9]!==d||e[10]!==l||e[11]!==n?(p=function(e){let p=f.find(t=>t.threads.some(t=>t.threadId===e.threadId));if(!p)return;if((i.pathname.startsWith(`/settings`)||i.pathname!==`/`)&&(r(`/`),l(`chat`)),t({type:I.OpenProjectPanel,projectId:p.projectId}),e.threadId!==d)u(p.projectId,e.threadId);else if(!d)return;c&&s(he);let m=function(e){t({type:I.SetFocusedPane,paneId:e}),a(e),o(e)},h=n.getState().extraChatPanes,g=Object.entries(h).find(t=>{let[,n]=t;return n.conversationId===e.conversationId})?.[0];if(g){m(g);return}let _=crypto.randomUUID();t({type:I.AddChatPane,paneId:_,conversationId:e.conversationId}),a(_),o(_)},e[0]=t,e[1]=s,e[2]=u,e[3]=c,e[4]=i.pathname,e[5]=r,e[6]=f,e[7]=o,e[8]=a,e[9]=d,e[10]=l,e[11]=n,e[12]=p):p=e[12];let m=p,h;return e[13]===m?h=e[14]:(h={openConversation:m},e[13]=m,e[14]=h),h}function pS(e){return e.projects}function mS(e){return e.selectedThreadId}var hS=M.forwardRef((e,t)=>{let n=(0,F.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=A(`w-full caption-bottom`,j.body,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,P.jsx)(`div`,{className:`relative w-full overflow-auto`,children:(0,P.jsx)(`table`,{ref:t,className:a,...i})}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});hS.displayName=`Table`;var gS=M.forwardRef((e,t)=>{let n=(0,F.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=A(`[&_tr]:border-b`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,P.jsx)(`thead`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});gS.displayName=`TableHeader`;var _S=M.forwardRef((e,t)=>{let n=(0,F.c)(7),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;return n[3]!==r||n[4]!==i||n[5]!==t?(a=(0,P.jsx)(`tbody`,{ref:t,className:r,...i}),n[3]=r,n[4]=i,n[5]=t,n[6]=a):a=n[6],a});_S.displayName=`TableBody`;var vS=M.forwardRef((e,t)=>{let n=(0,F.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=A(`border-t font-medium [&>tr]:last:border-b-0`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,P.jsx)(`tfoot`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});vS.displayName=`TableFooter`;var yS=M.forwardRef((e,t)=>{let n=(0,F.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=A(`transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,P.jsx)(`tr`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});yS.displayName=`TableRow`;var bS=M.forwardRef((e,t)=>{let n=(0,F.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=A(`h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,P.jsx)(`th`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});bS.displayName=`TableHead`;var xS=M.forwardRef((e,t)=>{let n=(0,F.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=A(`p-4 align-middle [&:has([role=checkbox])]:pr-0`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,P.jsx)(`td`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});xS.displayName=`TableCell`;var SS=M.forwardRef((e,t)=>{let n=(0,F.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=A(j.caption,`mt-4`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,P.jsx)(`caption`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});SS.displayName=`TableCaption`;var CS=25;function wS(){let e=(0,F.c)(12),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={queryKey:Nx.conversations.recent(),queryFn:TS,initialPageParam:0,getNextPageParam(e){let t=e.offset+e.conversations.length;return t<e.total?t:void 0}},e[0]=t):t=e[0];let n=Sa(t),r;e[1]===n.data?.pages?r=e[2]:(r=n.data?.pages.flatMap(function(e){return e.conversations})??[],e[1]=n.data?.pages,e[2]=r);let i=r,a=n.data?.pages[0]?.total??0,o;return e[3]!==i||e[4]!==n.error||e[5]!==n.fetchNextPage||e[6]!==n.hasNextPage||e[7]!==n.isFetchingNextPage||e[8]!==n.isPending||e[9]!==n.refetch||e[10]!==a?(o={conversations:i,total:a,isInitialLoading:n.isPending,isLoadingMore:n.isFetchingNextPage,error:n.error,hasNextPage:n.hasNextPage,fetchNextPage:n.fetchNextPage,refetch:n.refetch},e[3]=i,e[4]=n.error,e[5]=n.fetchNextPage,e[6]=n.hasNextPage,e[7]=n.isFetchingNextPage,e[8]=n.isPending,e[9]=n.refetch,e[10]=a,e[11]=o):o=e[11],o}function TS(e){let{pageParam:t}=e;return me(CS,t)}var ES=[{id:`turns`,label:`Turns`},{id:`inputTokens`,label:`Input Tokens`},{id:`outputTokens`,label:`Output Tokens`},{id:`model`,label:`Model`},{id:`branch`,label:`Branch`}],DS=new Set(ES.map(function(e){return e.id}));function OS(e){if(!e)return[];try{let t=JSON.parse(e);return Array.isArray(t)?t.filter(function(e){return typeof e==`string`&&DS.has(e)}):[]}catch{return[]}}function kS(){return OS(E(s.HISTORY_COLUMNS))}function AS(){let e=(0,F.c)(6),[t,n]=(0,M.useState)(kS),r;e[0]===t?r=e[1]:(r=function(e){return t.includes(e)},e[0]=t,e[1]=r);let i=r,a;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=function(e,t){n(function(n){let r=t?n.includes(e)?n:[...n,e]:n.filter(function(t){return t!==e});return ue(s.HISTORY_COLUMNS,JSON.stringify(r)),r})},e[2]=a):a=e[2];let o=a,c;return e[3]!==i||e[4]!==t?(c={visibleColumns:t,isColumnVisible:i,setColumnVisible:o},e[3]=i,e[4]=t,e[5]=c):c=e[5],c}function jS(e){let t=(0,F.c)(19),{open:n,onOpenChange:r,title:i,description:a,onConfirm:o,confirming:s,confirmLabel:c,confirmingLabel:l}=e,u=s===void 0?!1:s,d=c===void 0?`Delete`:c,f=l===void 0?`Deleting...`:l,p;t[0]===i?p=t[1]:(p=(0,P.jsx)(ux,{children:i}),t[0]=i,t[1]=p);let m;t[2]===a?m=t[3]:(m=(0,P.jsx)(dx,{children:a}),t[2]=a,t[3]=m);let h;t[4]!==p||t[5]!==m?(h=(0,P.jsxs)(cx,{children:[p,m]}),t[4]=p,t[5]=m,t[6]=h):h=t[6];let g;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,P.jsx)(px,{children:`Cancel`}),t[7]=g):g=t[7];let _=u?f:d,v;t[8]!==u||t[9]!==o||t[10]!==_?(v=(0,P.jsxs)(lx,{children:[g,(0,P.jsx)(fx,{onClick:o,disabled:u,className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:_})]}),t[8]=u,t[9]=o,t[10]=_,t[11]=v):v=t[11];let y;t[12]!==h||t[13]!==v?(y=(0,P.jsxs)(sx,{children:[h,v]}),t[12]=h,t[13]=v,t[14]=y):y=t[14];let b;return t[15]!==r||t[16]!==n||t[17]!==y?(b=(0,P.jsx)(ix,{open:n,onOpenChange:r,children:y}),t[15]=r,t[16]=n,t[17]=y,t[18]=b):b=t[18],b}var MS=t({default:()=>aC}),NS=36,PS=3,FS=`table-fixed`,IS=`h-9 w-48 bg-transparent py-2`,LS=`h-9 bg-transparent py-2`,RS=`h-9 w-20 bg-transparent py-2 text-right`,zS=`h-9 w-28 bg-transparent py-2 text-right`,BS=`h-9 w-28 bg-transparent py-2 text-right`,VS=`h-9 w-40 bg-transparent py-2`,HS=`h-9 w-32 bg-transparent py-2`,US=`h-9 w-24 bg-transparent py-2 text-right`,WS=A(j.bodyMuted,`w-48 truncate py-1.5`),GS=`py-1.5`,KS=A(j.bodyMuted,`w-20 py-1.5 text-right tabular-nums`),qS=A(j.bodyMuted,`w-28 py-1.5 text-right tabular-nums`),JS=A(j.bodyMuted,`w-28 py-1.5 text-right tabular-nums`),YS=A(j.bodyMuted,`w-40 truncate py-1.5`),XS=A(j.bodyMuted,`w-32 truncate py-1.5`),ZS=A(j.bodyMuted,`w-24 py-1.5 text-right tabular-nums`);function QS(e){let t=(0,F.c)(4),n;if(t[0]!==e){let{style:r,...i}=e,a;t[2]===r?a=t[3]:(a={...r,width:`100%`},t[2]=r,t[3]=a),n=(0,P.jsx)(`table`,{...i,style:a,className:A(`w-full caption-bottom`,FS,j.body,i.className)}),t[0]=e,t[1]=n}else n=t[1];return n}function $S(e){let t=(0,F.c)(5),n;t[0]===e.className?n=t[1]:(n=A(`hidden`,e.className),t[0]=e.className,t[1]=n);let r;return t[2]!==e||t[3]!==n?(r=(0,P.jsx)(`thead`,{...e,className:n}),t[2]=e,t[3]=n,t[4]=r):r=t[4],r}function eC(e){let t=(0,F.c)(5),n;t[0]===e.className?n=t[1]:(n=A(`[&_tr:last-child]:border-0`,e.className),t[0]=e.className,t[1]=n);let r;return t[2]!==e||t[3]!==n?(r=(0,P.jsx)(`tbody`,{...e,className:n}),t[2]=e,t[3]=n,t[4]=r):r=t[4],r}function tC(e){let t=(0,F.c)(5),n;t[0]===e.className?n=t[1]:(n=A(`frosted-scrollbar`,e.className),t[0]=e.className,t[1]=n);let r;return t[2]!==e||t[3]!==n?(r=(0,P.jsx)(`div`,{...e,className:n}),t[2]=e,t[3]=n,t[4]=r):r=t[4],r}function nC(e){return function(){return(0,P.jsx)(`tr`,{children:(0,P.jsx)(`td`,{colSpan:e,className:`py-3 text-center`,children:(0,P.jsx)(ep,{label:`Loading more…`,size:`sm`})})})}}function rC(e){switch(e){case`turns`:return(0,P.jsx)(bS,{className:RS,children:`Turns`},e);case`inputTokens`:return(0,P.jsx)(bS,{className:zS,children:`Input Tokens`},e);case`outputTokens`:return(0,P.jsx)(bS,{className:BS,children:`Output Tokens`},e);case`model`:return(0,P.jsx)(bS,{className:VS,children:`Model`},e);case`branch`:return(0,P.jsx)(bS,{className:HS,children:`Branch`},e)}}function iC(e,t){switch(t){case`turns`:return(0,P.jsx)(xS,{className:KS,children:e.turnCount.toLocaleString()},t);case`inputTokens`:return(0,P.jsx)(xS,{className:qS,children:e.inputTokens.toLocaleString()},t);case`outputTokens`:return(0,P.jsx)(xS,{className:JS,children:e.outputTokens.toLocaleString()},t);case`model`:return(0,P.jsx)(xS,{className:YS,children:e.model??`—`},t);case`branch`:return(0,P.jsx)(xS,{className:XS,children:e.branch},t)}}function aC(){let{openConversation:e}=fS(),{toast:t}=Cb(),[n,r]=(0,M.useState)(!1),[i,a]=(0,M.useState)(!1),{visibleColumns:o,isColumnVisible:s,setColumnVisible:c}=AS(),{conversations:l,isInitialLoading:u,isLoadingMore:d,error:f,hasNextPage:p,fetchNextPage:m,refetch:h}=wS(),g=PS+o.length,_=(0,M.useCallback)(()=>{p&&!d&&m()},[m,p,d]);async function v(){a(!0);try{await be(),await h(),r(!1),t({title:`Conversation history cleared`})}catch(e){t({title:`Failed to clear conversation history`,description:e instanceof Error?e.message:String(e),variant:`destructive`})}finally{a(!1)}}let y=(0,M.useMemo)(function(){return function({item:t,...n}){return(0,P.jsx)(`tr`,{...n,className:A(`cursor-pointer border-0 transition-colors hover:bg-muted/50`,n.className),onClick:()=>{t&&e(t)}})}},[e]),b=(0,M.useMemo)(function(){return{Table:QS,TableHead:$S,TableBody:eC,TableRow:y,Scroller:tC,Footer:d?nC(g):void 0}},[y,g,d]);function x(e,t){return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(xS,{className:WS,children:t.projectName}),(0,P.jsx)(xS,{className:GS,children:(0,P.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,P.jsx)(Ge,{className:`h-4 w-4 shrink-0 text-muted-foreground`}),(0,P.jsx)(`span`,{className:A(j.body,`truncate`),children:t.title})]})}),ES.map(function(e){return s(e.id)?iC(t,e.id):null}),(0,P.jsx)(xS,{className:ZS,"aria-label":`Last updated ${Se(t.lastMessageAt)} ago`,children:Se(t.lastMessageAt)})]})}function C(){return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(bS,{className:IS,children:`Project`}),(0,P.jsx)(bS,{className:LS,children:`Chat`}),ES.map(function(e){return s(e.id)?rC(e.id):null}),(0,P.jsx)(bS,{className:US,children:`Updated`})]})}let w=(0,P.jsx)(`table`,{className:A(`w-full caption-bottom`,FS,j.body),children:(0,P.jsx)(`thead`,{className:`[&_tr]:border-b [&_tr]:border-table-border`,children:(0,P.jsx)(`tr`,{children:C()})})});return(0,P.jsxs)(`div`,{className:`flex h-full min-h-0 w-full min-w-0 flex-1 flex-col`,children:[(0,P.jsxs)(cp,{className:`flex w-full max-w-none min-w-0 min-h-0 flex-1 flex-col pb-0 pt-0`,children:[(0,P.jsx)(sp,{title:`History`,description:`Browse recent chats across all projects.`,tableHeader:l.length>0?w:void 0,action:(0,P.jsxs)(tg,{children:[(0,P.jsx)(ng,{asChild:!0,children:(0,P.jsx)(ye,{type:`button`,variant:`ghost`,size:`icon`,className:`h-8 w-8`,"aria-label":`Choose columns`,children:(0,P.jsx)(Re,{className:`h-4 w-4`})})}),(0,P.jsxs)(og,{align:`end`,className:`w-48`,children:[(0,P.jsx)(ug,{className:j.body,children:`Columns`}),ES.map(function(e){return(0,P.jsx)(cg,{checked:s(e.id),onCheckedChange:t=>{c(e.id,t===!0)},onSelect:e=>{e.preventDefault()},children:e.label},e.id)}),(0,P.jsx)(dg,{}),(0,P.jsxs)(sg,{className:A(j.body,`gap-2 text-destructive focus:text-destructive`),disabled:l.length===0,onSelect:()=>r(!0),children:[(0,P.jsx)(S,{className:`h-4 w-4`}),`Clear history`]})]})]})}),(0,P.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:u?(0,P.jsx)(ep,{label:`Loading conversation history...`,size:`lg`}):f?(0,P.jsx)(`div`,{className:`flex h-full items-center justify-center p-6`,children:(0,P.jsxs)(`div`,{className:`max-w-md space-y-4 text-center`,children:[(0,P.jsx)(`p`,{className:j.body,children:f instanceof Error?f.message:`Failed to load conversation history`}),(0,P.jsx)(ye,{onClick:()=>void h(),children:`Try again`})]})}):l.length===0?(0,P.jsx)(`div`,{className:`flex h-full items-center justify-center p-6`,children:(0,P.jsxs)(`div`,{className:`max-w-md space-y-2 text-center`,children:[(0,P.jsx)(`h3`,{className:j.emptyStateTitle,children:`No history`}),(0,P.jsx)(`p`,{className:j.bodyMuted,children:`No conversations found yet.`})]})}):(0,P.jsx)(Ly,{style:{height:`100%`},data:l,computeItemKey:(e,t)=>t.conversationId,itemContent:x,endReached:_,defaultItemHeight:NS,increaseViewportBy:NS*5,components:b})})]}),(0,P.jsx)(jS,{open:n,onOpenChange:r,title:`Clear conversation history?`,description:`This permanently clears conversation history across all projects. This action cannot be undone.`,onConfirm:()=>void v(),confirming:i,confirmLabel:`Clear`,confirmingLabel:`Clearing...`})]})}export{Ym as $,Wn as $n,Fo as $t,cx as A,ca as An,Qf as At,dg as B,mi as Bn,bs as Bt,_x as C,ja as Cn,gp as Ct,sx as D,wa as Dn,Zf as Dt,px as E,I as En,tp as Et,tg as F,Vi as Fn,af as Ft,ng as G,gi as Gn,ys as Gt,rg as H,pi as Hn,Ss as Ht,cg as I,Li as In,nf as It,Zm as J,ti as Jn,as as Jt,Gm as K,ui as Kn,ls as Kt,og as L,Ii as Ln,Bd as Lt,Sb as M,Qi as Mn,lf as Mt,Cb as N,Ji as Nn,rf as Nt,dx as O,Sa as On,$f as Ot,Sy as P,Hi as Pn,of as Pt,eh as Q,Un as Qn,Lo as Qt,sg as R,si as Rn,Ld as Rt,hx as S,Ia as Sn,pp as St,fx as T,Oa as Tn,ep as Tt,ag as U,fi as Un,xs as Ut,fg as V,Ti as Vn,Cs as Vt,ig as W,oi as Wn,ws as Wt,Jm as X,Nr as Xn,Bo as Xt,qm as Y,ei as Yn,Io as Yt,Xm as Z,Ir as Zn,No as Zt,zx as _,no as _n,ap as _t,xS as a,cs as an,rh as at,Ox as b,to as bn,cp as bt,fS as c,Wo as cn,Fp as ct,$x as d,wo as dn,fp as dt,Po as en,Kn as er,Km as et,Wx as f,Mo as fn,sp as ft,Ix as g,oo as gn,vp as gt,Rx as h,io as hn,yp as ht,_S as i,Xo as in,Qe as ir,th as it,ux as j,sa as jn,sf as jt,lx as k,xa as kn,Xf as kt,oS as l,Co as ln,lp as lt,Ux as m,is as mn,hp as mt,jS as n,zo as nn,_n as nr,$m as nt,bS as o,Vo as on,ah as ot,Hx as p,To as pn,dp as pt,nh as q,Oi as qn,jo as qt,hS as r,Ho as rn,yn as rr,Wm as rt,yS as s,Uo as sn,ih as st,MS as t,Ro as tn,mn as tr,Qm as tt,dS as u,So as un,Cp as ut,Px as v,eo as vn,Sp as vt,ix as w,La as wn,rp as wt,Mx as x,Fa as xn,up as xt,Nx as y,$a as yn,mp as yt,ug as z,hi as zn,gl as zt};
|