@heybejs/core 1.2.1 → 1.4.0
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/package.json +1 -1
- package/src/app.ts +5 -1
- package/src/commands/args.ts +1 -0
- package/src/commands/help.ts +6 -0
- package/src/commands/serve.ts +1 -0
- package/src/http/routes/health.ts +3 -1
- package/src/http/routes/installer.ts +1 -1
- package/src/import/decrypt.ts +12 -1
- package/src/settings.ts +60 -3
- package/ui/dist/assets/index-DYrAitH0.js +23 -0
- package/ui/dist/index.html +1 -1
- package/ui/dist/assets/index-CEiZE18p.js +0 -23
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/RichTextEditor-1oGZgu61.js","assets/rolldown-runtime-BWaJ3C7D.js","assets/Popover-BKknruJI.js","assets/lib-C_lvLDN7.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{a as e,t}from"./rolldown-runtime-BWaJ3C7D.js";import{C as n,D as r,E as i,S as a,_ as o,a as s,b as c,c as l,d as u,f as d,i as f,l as p,m,n as h,o as g,p as _,r as v,s as y,t as b,u as x,v as S,w as C,x as w,y as ee}from"./Popover-BKknruJI.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var T=e(r(),1),te=T.useLayoutEffect;function ne(e){return e[e.length-1]}function re(e,t){return typeof e==`function`?e(t):e}var ie=Object.prototype.hasOwnProperty;function ae(e){for(let t in e)if(ie.call(e,t))return!0;return!1}var E=()=>Object.create(null),oe=(e,t)=>se(e,t,!0);function se(e,t,n,r=0){if(e===t)return e;if(r++>500)return t;let i=Array.isArray(e)&&Array.isArray(t);if(!i&&!(ce(e)&&ce(t)))return t;let a=Object.keys(e),o=a.length,s=Object.keys(t),c=s.length;if(i?o!==e.length||c!==t.length||o&&ne(a)!==`${o-1}`||c&&ne(s)!==`${c-1}`:o!==Object.getOwnPropertyNames(e).length||c!==Object.getOwnPropertyNames(t).length||Object.getOwnPropertySymbols(t).length)return t;let l=0,u,d,f;if(i){for(;l<c&&(f=l,d=e[f],u=t[f],u=d===u?d:typeof d==`object`?se(d,u,n,r):u,u===d);l++);if(l===c&&o===c)return e}else{let i=o===c,p=!0;for(;l<c;l++){f=s[l],d=e[f];let o=t[f];u=d===o?d:typeof d==`object`?se(d,o,n,r):o,i&&=u===d&&(a[l]===f||ie.call(e,f)),p&&=Object.is(u,o),a[l]=u}if(i)return Object.getOwnPropertySymbols(e).length?t:e;if(p)return t}let p=i?s.fill(0):n?E():{};for(let o=0;o<c;o++)f=i?o:s[o],i?(d=e[f],o>l&&(u=t[f],u=d===u?d:typeof d==`object`?se(d,u,n,r):u),p[f]=o<l?d:u):p[f]=a[o];return p}function ce(e){return!e||typeof e!=`object`?!1:(Object.getPrototypeOf(e)?.constructor??Object)===Object}function le(e,t,n,r){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let i=0,a=e.length;i<a;i++){let a=e[i],o=t[i];if(a!==o&&!le(a,o,n,r))return!1}return!0}if(ce(e)&&ce(t)){if(n){for(let i in t)if((r||t[i]!==void 0)&&!le(e[i],t[i],n,r))return!1;return!0}let i=0;if(r)i=Object.keys(e).length;else for(let t in e)e[t]!==void 0&&i++;for(let a in t)if((r||t[a]!==void 0)&&(i--===0||!le(e[a],t[a],n,r)))return!1;return i===0}return!1}var ue=/[\x00-\x1f\x7f"<>`{}]/g;function de(e){return e.replace(ue,e=>`%`+e.charCodeAt(0).toString(16).toUpperCase().padStart(2,`0`))}function fe(e){let t;try{t=decodeURI(e)}catch{t=e.replaceAll(/%[0-9A-F]{2}/gi,e=>{try{return decodeURI(e)}catch{return e}})}return de(t)}var pe=[`http:`,`https:`,`mailto:`,`tel:`];function me(e){if(e[0]!==`/`&&e.includes(`:`))return/^[\x00-\x20]*([a-z][a-z\d+.\t\n\r-]*:)/i.exec(e)?.[1]?.replace(/[\t\n\r]/g,``).toLowerCase()}var he=/^[\x00-\x20]*[\\/][\t\n\r]*[\\/]/;function ge(e,t){if(!e)return!1;if(he.test(e))return!0;let n=me(e);return n?!t.has(n):!1}function _e(e){if(!e)return e;let t=e;if(/[%\\\x00-\x1f\x7f]/.test(e)){let n=/%25|%5C/gi,r=0,i;for(t=``;(i=n.exec(e))!==null;)t+=fe(e.slice(r,i.index))+i[0],r=n.lastIndex;t+=fe(r?e.slice(r):e)}return t}function ve(e){return/[\s\u0080-\uFFFF]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function ye(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function be(){throw Error(`Invariant failed`)}function xe(e){return e.replace(/\/{2,}/g,`/`)}function Se(e){return e===`/`?e:e.replace(/^\/+/,``)}function D(e){let t=e.length;return t>1&&e[t-1]===`/`?e.replace(/\/+$/,``):e}function O(e){return D(Se(e))}function Ce(e,t){return e?.endsWith(`/`)&&e!==`/`&&e!==`${t}/`?e.slice(0,-1):e}function we(e,t,n=`never`,r){if(t.includes(`//`)&&(t=xe(t)),t.startsWith(`/`))return t.length===1||n===`preserve`?t:n===`always`?t.endsWith(`/`)?t:`${t}/`:t.endsWith(`/`)?t.slice(0,-1):t;let i=t===`.`,a;if(r){a=i?e:e+`\0`+t;let n=r.get(a);if(n)return n}let o;if(i)o=e.split(`/`);else{for(e.includes(`//`)&&(e=xe(e)),o=e.split(`/`);o.length>1&&ne(o)===``;)o.pop();let n=t.split(`/`);for(let e=0,t=n.length;e<t;e++){let r=n[e];r===``?e?e===t-1&&o.push(r):o=[r]:r===`..`?o.length>1?o.pop():o=[``]:r===`.`||o.push(r)}}o.length>1&&(ne(o)===``?n===`never`&&o.pop():n===`always`&&o.push(``));let s=o.join(`/`),c=(i?xe(s):s)||`/`;return a&&r&&r.set(a,c),c}function Te(e){let t=new Map(e.map(e=>[encodeURIComponent(e),e])),n=new RegExp([...t.keys()].join(`|`).replace(/[.*()]/g,`\\$&`),`g`);return e=>e.replace(n,e=>t.get(e)??e)}function Ee(e){return e==null||e===``}function De(e,t,n){if(typeof t!=`string`)return``+(t??void 0);let r=e===`_splat`;if(r&&(!t||/^[a-zA-Z0-9\-._~!/]*$/.test(t)))return t;let i=encodeURIComponent(t);return r&&(i=i.replaceAll(`%2F`,`/`)),n?n(i):i}function k(e,t,n,r,i){let a=e.endsWith(`/`)?`/`:``,o=``;for(let e of t){if(typeof e==`string`){o+=e;continue}let[t,s,c,l]=e,u=t===2,d=u&&l!==void 0?l+a:l,f=n[s];if(t!==3||f!=null){if(i&&(i[s]=f,u&&(i[`*`]=f)),u&&Ee(f)){if(c===`/`&&!d)continue;f=``}o+=c+De(s,f,r)+(d||``)}}return o+a||`/`}function Oe(e){return e?.isNotFound===!0}function ke(){try{return sessionStorage}catch{return}}var Ae=`tsr-scroll-restoration-v1_3`,je=ke();function Me(){try{return JSON.parse(je?.getItem(`tsr-scroll-restoration-v1_3`)||`{}`)}catch{return{}}}var Ne=Me(),Pe=`data-scroll-restoration-id`,Fe=e=>e.state.__TSR_key||e.href;function Ie(e){let t=e.getAttribute(Pe);if(t)return`[${Pe}="${t}"]`;let n=``,r=e,i;for(;i=r.parentNode;){let e=1,t=r;for(;t=t.previousElementSibling;)e++;let a=`${r.localName}:nth-child(${e})`;n=n?`${a} > ${n}`:a,r=i}return n}var Le=!1,Re=`window`;function ze(e){try{return typeof e==`function`?e():document.querySelector(e)}catch{}}function Be(e){let t=new Set;for(let n of e){if(n===Re)continue;let e=ze(n);e&&t.add(e)}return t}function Ve(e,t){let n=t??e.options.scrollRestoration,r=e._scroll;n&&(r.e=!0);let i=e.options.getScrollRestorationKey||Fe,a=new Set,o=e=>{let t=Ne[e]||={};for(let e of a)e===document?t[Re]={scrollX,scrollY}:e.isConnected&&(t[Ie(e)]={scrollX:e.scrollLeft,scrollY:e.scrollTop})};n&&!r.s&&(r.s=!0,Le=!1,history.scrollRestoration=`manual`,document.addEventListener(`scroll`,e=>{Le||a.add(e.target)},!0),e.subscribe(`onBeforeLoad`,e=>{e.fromLocation&&o(i(e.fromLocation)),a.clear()}),addEventListener(`pagehide`,()=>{history.scrollRestoration=`auto`,o(i(e.stores.resolvedLocation.get()??e.stores.location.get()));try{je?.setItem(Ae,JSON.stringify(Ne))}catch{}}),addEventListener(`pageshow`,e=>{e.persisted&&(history.scrollRestoration=`manual`)})),r.r||(r.r=!0,e.subscribe(`onRendered`,t=>{let n=e.options.scrollRestorationBehavior,o=e.options.scrollToTopSelectors,s=r.n,c=r.h,l;if(a.clear(),r.n=!0,r.h=!1,typeof e.options.scrollRestoration==`function`&&!e.options.scrollRestoration({location:e.latestLocation}))return;let u=i(t.toLocation),d=t.fromLocation&&i(t.fromLocation);if(r.e&&d&&d!==u){let e=Ne[d];if(e){let t=Ne[u];for(let n in e){if(n===Re){if(s)continue}else{let e=ze(n);if(!e||s&&o&&(l??=Be(o),l.has(e)))continue}t||=Ne[u]={},t[n]??=e[n]}}}Le=!0;try{let e=t.toLocation.hash,i=t.toLocation.state.__hashScrollIntoViewOptions??!0,a=!1;if(s){!e&&o&&(l??=Be(o));let t=e&&i&&c,s=r.e?Ne[u]:void 0;if(s)for(let e in s){let{scrollX:r,scrollY:i}=s[e];if(e===Re){if(t)continue;scrollTo({top:i,left:r,behavior:n}),a=!0}else{let t=ze(e);t&&(t.scrollLeft=r,t.scrollTop=i,l?.delete(t))}}if(!e){let e={top:0,left:0,behavior:n};if(a||scrollTo(e),l)for(let t of l)t.scrollTo(e)}}!a&&e&&i&&document.getElementById(e)?.scrollIntoView(i)}finally{Le=!1}}))}function He(e,t=String){let n;for(let r in e){let i=e[r];i!==void 0&&(n||=new URLSearchParams).set(r,t(i))}return n?n.toString():``}function Ue(e){return e?e===`false`?!1:e===`true`?!0:e*0==0&&+e+``===e?+e:e:``}function We(e){let t=new URLSearchParams(e),n=Object.create(null);for(let[e,r]of t.entries()){let t=n[e];t==null?n[e]=Ue(r):Array.isArray(t)?t.push(Ue(r)):n[e]=[t,Ue(r)]}return n}var Ge=/^(?:\s|["[{\d-]|fa|nu|tr)/,Ke=Je(JSON.parse),qe=Ye(JSON.stringify,JSON.parse);function Je(e){let t=e===JSON.parse;return n=>{n[0]===`?`&&(n=n.slice(1));let r=We(n);for(let n in r){let i=r[n];if(typeof i==`string`){if(t&&!Ge.test(i))continue;try{r[n]=e(i)}catch{}}}return r}}function Ye(e,t){let n=t===JSON.parse;function r(r){if(r&&typeof r==`object`)try{return e(r)}catch{}else if(t&&typeof r==`string`){if(n&&!Ge.test(r))return r;try{return t(r),e(r)}catch{}}return r}return e=>{let t=He(e,r);return t?`?${t}`:``}}var Xe=`__root__`;function Ze(e){e.statusCode=e.statusCode||e.code||307;let t=new Headers(e.headers);e.href&&t.get(`Location`)===null&&t.set(`Location`,e.href);let n=new Response(null,{status:e.statusCode,headers:t});if(n.options=e,e.throw)throw n;return n}function Qe(e){return e instanceof Response&&!!e.options}function $e(e){let t=new Map,n,r;return{get(e){let n=t.get(e);if(n)return n.visited=!0,n.value},set(i,a){let o=t.get(i);if(o){o.value=a;return}if(t.size>=e){let e=n?.next().value;for(;!e||e.visited;)e?e.visited=!1:n=t.values(),e=n.next().value;e===r&&(n=void 0),t.delete(e.key)}let s={key:i,value:a,visited:!1};r=s,t.set(i,s)},clear(){t.clear(),n=void 0,r=void 0}}}var et=4,tt=5;function nt(e){let t=e.names;if(t)return t;let n=[];for(let t of e)typeof t!=`string`&&n.push(t[1]);return e.names=n}function rt(e,t,n){let r=e.slice(t,n);if(r.charCodeAt(0)===36)return r.length===1?[2,`_splat`,``,void 0]:[1,r.slice(1),``,``];let i=r.indexOf(`{`);if(i>=0){let a=r.indexOf(`}`,i),o=r.charCodeAt(i+1)===45,s=i+(o?3:2);if(a>=0&&r.charCodeAt(s-1)===36&&(!o||s<a)){let c=r.slice(s,a);return[o?3:c?1:2,c||`_splat`,r.slice(0,i),e.slice(t+a+1,c?n:e.length)]}}return r}function it(e,t,n,r,i,a){let o=n,s=t.fullPath??t.from,c=t.options,l=s.length,u=s.endsWith(`/`)?l-1:l,d=c?.caseSensitive??e,f=c?.params?.parse??c?.parseParams,p,m=a?n-1:0;if(!r||s.includes(`$`)){p=a?.slice()??[];let e=ne(p);e&&typeof e!=`string`&&e[0]===2&&(p[p.length-1]=[e[0],e[1],e[2],e[3]===void 0?void 0:e[3]+s.substring(n-(s[n-2]===`/`?2:1),u)],m=l)}for(;o<l;){let e=o,t=s.indexOf(`/`,e),n=t===-1?l:t,a=rt(s,e,n);o=n+1;let c;if(typeof a==`string`){if(!r)continue;let e=a,t;d?t=r.static??=new Map:(e=a.toLowerCase(),t=r.staticInsensitive??=new Map);let n=t.get(e);if(n)c=n;else{let n=ot(r);c=n,t.set(e,n)}}else{let t=a[0],h=a[2],g=a[3]??``;if(t===2&&(n=l,o=n+1),p&&m<n&&(m<e-1&&p.push(s.slice(m,e-1)),a[2]=`/`+h,t===2&&a[3]!==void 0&&u<l&&(a[3]=g.slice(0,-1)),p.push(a),m=n),!r)continue;let _=d&&!!(h||g);d||(h=h.toLowerCase(),g=g.toLowerCase());let v=t===1?r.dynamic??=[]:t===3?r.optional??=[]:r.wildcard??=[],y=t!==2&&!f&&v.find(e=>!e.parse&&e.caseSensitive===_&&e.prefix===h&&e.suffix===g);if(y)c=y;else{let e=ot(r,t,_,h,g);c=e,v.push(e),v.length===2&&i?.push(v)}}r=c}p&&m<u&&p.push(s.slice(m,u));let h=p?.slice();if(!r)return h;if(f&&t.children&&!t.isRoot&&t.id&&t.id.charCodeAt(t.id.lastIndexOf(`/`)+1)===95){let e=ot(r,tt);(r.pathless??=[]).push(e),r=e}let g=(t.path||!t.children)&&!t.isRoot;if(g&&u<l){let e=ot(r,et);r.index=e,r=e}return r.parse=f??null,r.priority=c?.params?.priority??0,r.route||(r.data=h,g&&(r.route=t)),[r,o,h]}function at(e,t){if(e.parse&&!t.parse)return-1;if(!e.parse&&t.parse)return 1;if(e.parse&&t.parse&&(e.priority||t.priority))return t.priority-e.priority;if(e.prefix&&t.prefix&&e.prefix!==t.prefix){if(e.prefix.startsWith(t.prefix))return-1;if(t.prefix.startsWith(e.prefix))return 1}if(e.suffix&&t.suffix&&e.suffix!==t.suffix){if(e.suffix.endsWith(t.suffix))return-1;if(t.suffix.endsWith(e.suffix))return 1}return e.prefix&&!t.prefix?-1:!e.prefix&&t.prefix?1:e.suffix&&!t.suffix?-1:!e.suffix&&t.suffix?1:e.caseSensitive&&!t.caseSensitive?-1:!e.caseSensitive&&t.caseSensitive?1:0}function ot(e,t=0,n,r,i){return{kind:t,depth:e?e.depth+1:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,data:void 0,parent:e,parse:null,priority:0,caseSensitive:n,prefix:r,suffix:i}}function st(e,t){let n=ot(),r=[];function i(e,t,n,a){let[o,s,c]=it(!1,e,t,n,r,a);if(e.children)for(let t of e.children)i(t,s,o,c)}for(let t of e)i(t,1,n);for(let e of r)e.sort(at);t.masksTree=n,t.flatCache=$e(1e3)}function ct(e,t){e||=`/`;let n=t.flatCache.get(e);if(n!==void 0)return n;let r=ft(e,t.masksTree);return t.flatCache.set(e,r),r}function lt(e,t,n,r,i){e||=`/`,r||=`/`;let a=t?`case\0${e}`:e,o=i.singleCache.get(a);return o||(o=ot(),it(t,{from:e},1,o),i.singleCache.set(a,o)),ft(r,o,n)}function ut(e,t,n=!1){let r=n?e:`nofuzz\0${e}`,i=t.matchCache.get(r);if(i!==void 0)return i;e||=`/`;let a;try{a=ft(e,t.segmentTree,n)}catch(e){if(e instanceof URIError)a=null;else throw e}return a&&(a.branch=mt(a.route)),t.matchCache.set(r,a),a}function dt(e,t=!1){let n=ot(),r=[],i={},a={},o=0;function s(e,n,c,l){if(e.init(o),e.id in i&&be(),i[e.id]=e,o!==0&&e.path){let t=D(e.fullPath);(!a[t]||e.fullPath.endsWith(`/`))&&(a[t]=e)}o++;let[u,d,f]=it(t,e,n,c,r,l);if(e._interpolation=f,e.children)for(let t of e.children)s(t,d,u,f)}s(e,1,n);for(let e of r)e.sort(at);return{processedTree:{segmentTree:n,singleCache:$e(1e3),matchCache:$e(1e3),flatCache:null,masksTree:null},routesById:i,routesByPath:a}}function ft(e,t,n=!1){let r=e.split(`/`),i=gt(e,r,t,n);if(!i)return null;let[a]=pt(e,r,i);return{route:i.node.route,rawParams:a}}function pt(e,t,n){let r=ht(n.node),i=n.node.data&&nt(n.node.data),a=Object.create(null),o=n.extract?.part??0,s=n.extract?.node??0,c=n.extract?.path??0,l=n.extract?.param??0;for(;s<r.length;o++,s++,c++){let u=r[s];if(u.kind===et)break;if(u.kind===tt){o--,c--;continue}let d=t[o],f=c;if(d&&(c+=d.length),u.kind===1||u.kind===3){let e=i[l++];if(u.kind===3&&n.skipped&1<<s){o--,c=f-1;continue}let t=u.suffix||u.prefix?d.substring(u.prefix.length,d.length-u.suffix.length):d;(t||u.kind===1)&&(a[e]=decodeURIComponent(t))}else if(u.kind===2){let t=u,n=e.substring(f+t.prefix.length,e.length-t.suffix.length),r=decodeURIComponent(n);a[`*`]=r,a._splat=r;break}}return n.rawParams&&Object.assign(a,n.rawParams),[a,{part:o,node:s,path:c,param:l}]}function mt(e){let t=[e];for(;e.parentRoute;)e=e.parentRoute,t.push(e);return t.reverse(),t}function ht(e){let t=Array(e.depth+1);do t[e.depth]=e,e=e.parent;while(e);return t}function gt(e,t,n,r){if(e===`/`&&n.index)return{node:n.index,skipped:0};let i=!ne(t),a=i&&e!==`/`,o=t.length-+!!i,s=[{node:n,index:1,skipped:0,statics:0,dynamics:0,optionals:0}],c=null,l=null;for(;s.length;){let n=s.pop(),{node:i,index:u,skipped:d,statics:f,dynamics:p,optionals:m}=n,{extract:h,rawParams:g}=n;if(i.kind===2&&i.route&&!bt(l,n))continue;if(i.parse){if(!yt(e,t,n))continue;g=n.rawParams,h=n.extract}r&&i.route&&i.kind!==et&&bt(c,n)&&(c=n);let _=u===o;if(_&&(i.route&&(!a||i.kind===et||i.kind===2)&&bt(l,n)&&(l=n),!i.optional&&!i.wildcard&&!i.index&&!i.pathless))continue;let v=_?void 0:t[u],y;if(_&&i.index){let n={node:i.index,index:u,skipped:d,statics:f,dynamics:p,optionals:m,extract:h,rawParams:g},r=!0;if(i.index.parse&&(yt(e,t,n)||(r=!1)),r){if(!p&&!m&&!d&&vt(f,o))return n;bt(l,n)&&(l=n)}}if(i.wildcard)for(let e=i.wildcard.length-1;e>=0;e--){let n=i.wildcard[e],{prefix:r,suffix:a}=n;if(!r||!_&&(n.caseSensitive?v:y??=v.toLowerCase()).startsWith(r)){if(a){if(_)continue;let e=t.slice(u).join(`/`),i=e.slice(-a.length);if((n.caseSensitive?i:i.toLowerCase())!==a||e.length-a.length<r.length)continue}s.push({node:n,index:o,skipped:d,statics:f,dynamics:p,optionals:m,extract:h,rawParams:g})}}if(i.optional){let e=d|1<<i.depth+1;for(let t=i.optional.length-1;t>=0;t--){let n=i.optional[t];s.push({node:n,index:u,skipped:e,statics:f,dynamics:p,optionals:m,extract:h,rawParams:g})}if(!_)for(let e=i.optional.length-1;e>=0;e--){let t=i.optional[e],{prefix:n,suffix:r}=t;if(n||r){let e=t.caseSensitive?v:y??=v.toLowerCase();if(n&&!e.startsWith(n)||r&&e.indexOf(r,e.length-r.length)<n.length)continue}s.push({node:t,index:u+1,skipped:d,statics:f,dynamics:p,optionals:m+_t(o,u),extract:h,rawParams:g})}}if(!_&&i.dynamic&&v)for(let e=i.dynamic.length-1;e>=0;e--){let t=i.dynamic[e],{prefix:n,suffix:r}=t;if(n||r){let e=t.caseSensitive?v:y??=v.toLowerCase();if(n&&!e.startsWith(n)||r&&e.indexOf(r,e.length-r.length)<n.length)continue}s.push({node:t,index:u+1,skipped:d,statics:f,dynamics:p+_t(o,u),optionals:m,extract:h,rawParams:g})}if(!_&&i.staticInsensitive){let e=i.staticInsensitive.get(y??=v.toLowerCase());e&&s.push({node:e,index:u+1,skipped:d,statics:f+_t(o,u),dynamics:p,optionals:m,extract:h,rawParams:g})}if(!_&&i.static){let e=i.static.get(v);e&&s.push({node:e,index:u+1,skipped:d,statics:f+_t(o,u),dynamics:p,optionals:m,extract:h,rawParams:g})}if(i.pathless)for(let e=i.pathless.length-1;e>=0;e--){let t=i.pathless[e];s.push({node:t,index:u,skipped:d,statics:f,dynamics:p,optionals:m,extract:h,rawParams:g})}}if(l)return l;if(r&&c){let n=c.index;for(let e=0;e<c.index;e++)n+=t[e].length;let r=n===e.length?`/`:e.slice(n);return c.rawParams??=Object.create(null),c.rawParams[`**`]=decodeURIComponent(r),c}return null}function _t(e,t){return 2**(e-t-1)}function vt(e,t){return e===2**(t-1)-1}function yt(e,t,n){let r,i;try{[r,i]=pt(e,t,n)}catch{return null}if(n.rawParams=r,n.extract=i,!n.node.parse)return!0;try{if(n.node.parse(r)===!1)return null}catch{}return!0}function bt(e,t){return!e||t.statics>e.statics||t.statics===e.statics&&(t.dynamics>e.dynamics||t.dynamics===e.dynamics&&(t.optionals>e.optionals||t.optionals===e.optionals&&((t.node.kind===et)>(e.node.kind===et)||t.node.kind===et==(e.node.kind===et)&&t.node.depth>e.node.depth)))}function xt(e,t,n){let r=O(e),i=`/${r}`,a=t?i:i.toLowerCase(),o=`${a}/`,s={input:({url:e})=>{let n=t?e.pathname:e.pathname.toLowerCase();return n===a?e.pathname=`/`:n.startsWith(o)&&(e.pathname=e.pathname.slice(i.length)),e},output:({url:e})=>(e.pathname=xe(`/${r}${e.pathname}`),e)};return n?{input:({url:e})=>St(n,s.input({url:e})),output:({url:e})=>s.output({url:Ct(n,e)})}:s}function St(e,t){let n=e?.input?.({url:t});if(n){if(typeof n==`string`)return new URL(n);if(n instanceof URL)return n}return t}function Ct(e,t){let n=e?.output?.({url:t});if(n){if(typeof n==`string`)return new URL(n);if(n instanceof URL)return n}return t}function wt(e,t){let{createMutableStore:n,createReadonlyStore:r,batch:i}=t,a=new Map,o=n(`idle`),s=n(e),c=n(void 0),l=n([]),u=r(()=>l.get().map(e=>a.get(e).get())),d=r(()=>({status:o.get(),isLoading:o.get()===`pending`,matches:u.get(),location:s.get(),resolvedLocation:c.get()}));function f(e){let t=a.get(e);return t||(t=n(void 0),a.set(e,t)),t}let p={status:o,location:s,resolvedLocation:c,ids:l,matches:u,byRoute:a,__store:d,getMatchStore:f,setMatches:m};function m(e){let t=l.get(),n=e.map(e=>e.routeId);i(()=>{ye(t,n)||l.set(n);for(let e of t)n.includes(e)||a.get(e).set(()=>void 0);for(let t of e){let e=f(t.routeId);e.get()!==t&&e.set(t)}})}return p}var Tt=`__TSR_index`,Et=`popstate`,Dt=`beforeunload`,Ot=/^[\x00-\x20]*(?:[\\/][\t\n\r]*){2,}/;function kt(e){let t=Ot.exec(e);return t?`/`+e.slice(t[0].length):e}function At(e){return/[\x00-\x1f\x7f]/.test(e)&&(e=e.replace(/[\x00-\x1f\x7f]/g,e=>`
|
|
3
|
+
\r`.includes(e)?``:encodeURIComponent(e))),kt(e)}function jt(e){let t=e.getLocation(),n=new Set,r=r=>{t=e.getLocation(),n.forEach(e=>e({location:t,action:r}))},i=n=>{e.notifyOnIndexChange??!0?r(n):t=e.getLocation()},a=async n=>{let r=n.navigateOpts?.ignoreBlocker?void 0:e.getBlockers?.();if(typeof document<`u`&&r?.length&&(n.type===`PUSH`||n.type===`REPLACE`))for(let i of r){let r=Ft(n.path,n.state);if(await i.blockerFn({currentLocation:t,nextLocation:r,action:n.type})){e.onBlocked?.();return}}n.task()};return{get location(){return t},get length(){return e.getLength()},subscribers:n,subscribe:e=>(n.add(e),()=>{n.delete(e)}),push:(n,i,o)=>{let s=t.state[Tt];i=Mt(s+1,i),a({task:()=>{e.pushState(n,i),r({type:`PUSH`})},navigateOpts:o,type:`PUSH`,path:n,state:i})},replace:(n,i,o)=>{let s=t.state[Tt];i=Mt(s,i),a({task:()=>{e.replaceState(n,i),r({type:`REPLACE`})},navigateOpts:o,type:`REPLACE`,path:n,state:i})},go:(t,n)=>{a({task:()=>{e.go(t,n?.ignoreBlocker??!1),i({type:`GO`,index:t})},navigateOpts:n,type:`GO`})},back:t=>{a({task:()=>{e.back(t?.ignoreBlocker??!1),i({type:`BACK`})},navigateOpts:t,type:`BACK`})},forward:t=>{a({task:()=>{e.forward(t?.ignoreBlocker??!1),i({type:`FORWARD`})},navigateOpts:t,type:`FORWARD`})},canGoBack:()=>t.state[Tt]!==0,createHref:t=>e.createHref(t),block:t=>{if(!e.setBlockers)return()=>{};let n=e.getBlockers?.()??[];return e.setBlockers([...n,t]),()=>{let n=e.getBlockers?.()??[];e.setBlockers?.(n.filter(e=>e!==t))}},flush:()=>e.flush?.(),destroy:()=>e.destroy?.(),notify:r,_getBlockers:()=>e.getBlockers?.()??[]}}function Mt(e,t){let n=It();return{...t,key:n,__TSR_key:n,[Tt]:e}}function Nt(e){let t=e?.window??(typeof document<`u`?window:void 0),n=t.history.pushState,r=t.history.replaceState,i=[],a=()=>i,o=e=>i=e,s=t=>At(e?.createHref?e.createHref(t):t),c=e?.parseLocation??(()=>Ft(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!t.history.state?.__TSR_key&&!t.history.state?.key){let e=It();t.history.replaceState({[Tt]:0,key:e,__TSR_key:e},``)}let l=c(),u,d=!1,f=!1,p=!1,m=!1,h=()=>l,g,_=()=>{g&&(S._ignoreSubscribers=!0,(g[2]?t.history.pushState:t.history.replaceState)(g[1],``,g[0]),S._ignoreSubscribers=!1,g=void 0,u=void 0)},v=(t,n,r)=>{let i=e?.createHref?s(n):void 0,a=!!g;a||(u=l),l=Ft(n,r),g=[i??l.href,r,g?.[2]||t],a||queueMicrotask(()=>_())},y=e=>{l=c(),S.notify({type:e})},b=async()=>{if(m=!1,f){f=!1;return}let e=c(),n=e.state[Tt]-l.state[Tt],r=n===1,i=n===-1,o=!r&&!i||d;d=!1;let s=o?`GO`:i?`BACK`:`FORWARD`,u=o?{type:`GO`,index:n}:{type:i?`BACK`:`FORWARD`};if(p)p=!1;else{let r=a();if(typeof document<`u`&&r.length){for(let i of r)if(await i.blockerFn({currentLocation:l,nextLocation:e,action:s})){f=!0,t.history.go(-n),S.notify(u);return}}}l=c(),S.notify(u)},x=e=>{if(m){m=!1;return}let t=!1,n=a();if(typeof document<`u`&&n.length)for(let e of n){let n=e.enableBeforeUnload??!0;if(n===!0||typeof n==`function`&&n()===!0){t=!0;break}}if(t)return e.preventDefault(),e.returnValue=``},S=jt({getLocation:h,getLength:()=>t.history.length,pushState:(e,t)=>v(!0,e,t),replaceState:(e,t)=>v(!1,e,t),back:e=>(e&&(p=!0,m=!0),t.history.back()),forward:e=>{e&&(p=!0,m=!0),t.history.forward()},go:(e,n)=>{d=!0,n&&(p=!0,m=!0),t.history.go(e)},createHref:s,flush:_,destroy:()=>{t.history.pushState=n,t.history.replaceState=r,t.removeEventListener(Dt,x,{capture:!0}),t.removeEventListener(Et,b)},onBlocked:()=>{u&&l!==u&&(l=u)},getBlockers:a,setBlockers:o,notifyOnIndexChange:!1});return S._ignoreNextBeforeUnload=e=>{m=!1;try{e=new URL(e,t.document.baseURI).href,m=/^https?:/.test(e)&&(!e.includes(`#`)||e.split(`#`)[0]!==t.location.href.split(`#`)[0])}catch{}},t.addEventListener(Dt,x,{capture:!0}),t.addEventListener(Et,b),t.history.pushState=function(...e){let r=n.apply(t.history,e);return S._ignoreSubscribers||y(`PUSH`),r},t.history.replaceState=function(...e){let n=r.apply(t.history,e);return S._ignoreSubscribers||y(`REPLACE`),n},S}function Pt(e){let t=e?.window??(typeof document<`u`?window:void 0);return Nt({window:t,parseLocation:()=>{let e=t.location.hash,n=e.indexOf(`#`,1);return n<0&&(n=e.length),Ft(`${e?e.slice(1,n):`/`}${t.location.search}${e.slice(n)}`,t.history.state)},createHref:e=>`${t.location.pathname}${t.location.search}#${e}`})}function Ft(e,t){let n=At(e),r=n.indexOf(`#`),i=n.indexOf(`?`);if(!t){let e=It();t={[Tt]:0,key:e,__TSR_key:e}}return{href:n,pathname:n.slice(0,r>-1?i>-1?Math.min(r,i):r:i>-1?i:n.length),hash:r>-1?n.slice(r):``,search:i>-1?n.slice(i,r===-1?void 0:r):``,state:t}}function It(){return(Math.random()+1).toString(36).slice(7)}function Lt(e,t){return e.protocol!==`http:`&&e.protocol!==`https:`||e.origin!==t||!!e.username||!!e.password}function Rt(e){return e.pathname+e.search+e.hash}function zt(e){return e.options.loader||e.options.beforeLoad||e.lazyFn||e.options.component?.preload||e.options.pendingComponent?.preload}function Bt(e,t){return{fromLocation:t,toLocation:e,pathChanged:t?.pathname!==e.pathname,hrefChanged:t?.href!==e.href,hashChanged:t?.hash!==e.hash}}function Vt({key:e,__TSR_key:t,__TSR_index:n,__hashScrollIntoViewOptions:r,...i}){return i}function Ht(e){return e.findIndex(e=>e.status===`error`||e.status===`notFound`||e._notFound)+1}function Ut(e,t,n,r,i,a){r&&(t=t.slice(0,r)),i&&(n=n.slice(0,i));for(let r of t){if(a&&e._tx!==a)return;n.some(e=>e.routeId===r.routeId)||e.routesById[r.routeId].options.onLeave?.(r)}for(let r of n){if(a&&e._tx!==a)return;e.routesById[r.routeId].options[t.some(e=>e.routeId===r.routeId)?`onStay`:`onEnter`]?.(r)}}var Wt=class{constructor(e,t){this.tempLocationKey=`${Math.round(Math.random()*1e7)}`,this._scroll={n:!0},this.subscribers=new Set,this._cache=new Map,this._committed=[],this.startTransition=async e=>(e(),!1),this.update=e=>{let t=this.options;this.options={...t,...e},this.isServer=this.options.isServer??!1??typeof document>`u`,this.staticLocations=new WeakMap,this.protocolAllowlist=new Set(this.options.protocolAllowlist),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.history=this.options.history?this.options.history:Nt()),this.origin=this.options.origin,this.origin||=window?.origin&&window.origin!==`null`?window.origin:`http://localhost`;let n=this.options.basepath??`/`,r=this.options.rewrite,i=this.basepath!==n||t?.rewrite!==r||t?.caseSensitive!==this.options.caseSensitive;if(i&&(this.basepath=n,this.rewrite=n!==`/`&&O(n)?xt(n,this.options.caseSensitive,r):r),this.history&&this.updateLatestLocation(),this.options.routeTree!==this.routeTree){this.routeTree=this.options.routeTree;let e;e=this.buildRouteTree(),this.setRoutes(e)}if(this.stores)i&&this.stores.location.set(this.latestLocation);else if(this.latestLocation){let e=this.getStoreConfig(this);this.batch=e.batch,this.stores=wt(this.latestLocation,e),Ve(this)}},this.updateLatestLocation=()=>{this.latestLocation=this.parseLocation(this.history.location,this.latestLocation)},this.buildRouteTree=()=>{let e=dt(this.routeTree,this.options.caseSensitive);return this.options.routeMasks&&st(this.options.routeMasks,e.processedTree),{...e,resolvePathCache:$e(1e3)}},this.subscribe=(e,t)=>{let n={eventType:e,fn:t};return this.subscribers.add(n),()=>{this.subscribers.delete(n)}},this.emit=e=>{for(let t of this.subscribers)if(t.eventType===e.type)try{t.fn(e)}catch(e){console.error(e)}},this.parseLocation=(e,t)=>{let n=({pathname:e,search:n,hash:r,href:i},a)=>{if(!this.rewrite&&!/[ \x00-\x1f\x7f\u0080-\uffff]/.test(e)){let i=this.options.parseSearch(n),o=this.options.stringifySearch(i);return{href:e+o+r,publicHref:e+o+r,pathname:_e(e),external:!1,searchStr:o,search:oe(t?.search,i),hash:_e(r.slice(1)),state:se(t?.state,a)}}let o=St(this.rewrite,new URL(i,this.origin)),s=this.options.parseSearch(o.search),c=this.options.stringifySearch(s);return o.search=c,{href:o.href.replace(o.origin,``),publicHref:i,pathname:_e(kt(o.pathname)),external:!!this.rewrite&&Lt(o,this.origin),searchStr:c,search:oe(t?.search,s),hash:_e(o.hash.slice(1)),state:se(t?.state,a)}},r=n(e,e.state),{__tempLocation:i,__tempKey:a}=r.state;if(i&&(!a||a===this.tempLocationKey)){let e=n(i,{...i.state,__tempLocation:void 0,key:r.state.key,__TSR_key:r.state.__TSR_key});return e.maskedLocation=r,e}return r},this.matchRoutes=(e,t,n)=>typeof e==`string`?this.matchRoutesInternal({pathname:e,search:t},n):this.matchRoutesInternal(e,t),this.getMatchedRoutes=e=>{let t=Object.create(null),n=ut(D(e),this.processedTree,!0);return n&&Object.assign(t,n.rawParams),[n?.branch||[this.routesById.__root__],t,n?.route]},this.buildLocation=e=>{{let t=this.staticLocations.get(e);if(t)return t}let t=!1,n=(n={})=>{if(n.href){let e=Ft(n.href,{});n={...n,to:St(this.rewrite,new URL(e.pathname,this.origin)).pathname,search:this.options.parseSearch(e.search),hash:e.hash.slice(1)}}let r=e._fromLocation||this._pendingLocation||this.latestLocation,i,a=()=>(t=!0,r),o=()=>i??=this.matchRoutesLightweight(a()),s=n.to?`${n.to}`:`.`,c=we(s[0]===`/`?``:n.unsafeRelative===`path`?a().pathname:n.from??o()[1],s,this.options.trailingSlash,this.resolvePathCache),l=this.routesByPath[D(c)],u=c.includes(`$`),d;if(l)d=l._branch??=mt(l);else if(u)d=[];else{let[e,t,n]=this.getMatchedRoutes(c);d=e,this.options.notFoundRoute&&(!n||n.path!==`/`&&t[`**`])&&(d=[...d,this.options.notFoundRoute])}let f=u?l?._interpolation??it(!1,{fullPath:c},0):void 0,p;for(let e of d){let t=e.options.params?.stringify??e.options.stringifyParams;if(t){let e=o()[3];if(p??=Yt(n.params,e),!ae(p))break;p===e&&(p=Object.assign(E(),p));try{Object.assign(p,t(p))}catch{}}}p??=Yt(n.params,Xt(n.params,f)?o()[3]:Zt);let m=e.leaveParams?c:kt(_e(f?k(c,f,p,this.pathParamsDecoder):c)),h=Qt(d,e._includeValidateSearch),g=()=>{let t=o()[2];if(e._includeValidateSearch&&this.options.search?.strict){let e={};d.forEach(n=>{if(n.options.validateSearch)try{Object.assign(e,Jt(n.options.validateSearch,{...e,...t}))}catch{}}),t=e}return t},_=h.length?$t(h,g(),n):n.search===!0?g():typeof n.search==`function`?n.search(g()):n.search||Zt,v=this.options.stringifySearch(_),y=n.hash===!0?a().hash:typeof n.hash==`function`?n.hash(a().hash):n.hash||void 0,b=y?`#${y}`:``,x=n.state?n.state===!0?a().state:typeof n.state==`function`?n.state(a().state):n.state:Zt,S=`${m}${v}${b}`,C,w,ee=!1;if(this.rewrite){let e=new URL(S,this.origin),t=e.origin,n=Ct(this.rewrite,e);C=Rt(e),Lt(n,t)?(w=n.href,ee=!0):w=kt(Rt(n))}else C=ve(S),w=C;return{publicHref:w,href:C,pathname:m,search:_,searchStr:v,state:x,hash:y??``,external:ee,unmaskOnReload:n.unmaskOnReload}},r=n(e);if(e.mask)r.maskedLocation=n({from:e.from,...e.mask});else if(this.options.routeMasks){let t=ct(r.pathname,this.processedTree);if(t){let i=Object.assign(E(),t.rawParams),{from:a,params:o,...s}=t.route,c=Yt(o,i);r.maskedLocation=n({from:e.from,...s,params:c})}}return!t&&e._fromLocation&&this.staticLocations.set(e,r),r},this.commitLocation=async({viewTransition:e,ignoreBlocker:t,...n})=>{let r=n.maskedLocation??n;if(r.external)return Gt(this,r.publicHref,{replace:n.replace,ignoreBlocker:t});let i,a=D(this.latestLocation.href)===D(n.href)&&le(Vt(n.state),Vt(this.latestLocation.state)),o=this._commitPromise,s,c=new Promise(e=>{s=e});if(c.resolve=()=>{s(),o?.resolve()},this._commitPromise=c,a)this.load();else{let{maskedLocation:r,hashScrollIntoView:a,...o}=n;r&&(o={...r,state:{...r.state,__tempKey:void 0,__tempLocation:{...o,search:o.searchStr,state:{...o.state,__tempKey:void 0,__tempLocation:void 0,__TSR_key:void 0,key:void 0}}}},(o.unmaskOnReload??this.options.unmaskOnReload??!1)&&(o.state.__tempKey=this.tempLocationKey)),o.state={...o.state,__hashScrollIntoViewOptions:a??this.options.defaultHashScrollIntoView??!0},this.shouldViewTransition=e,i=n.replace?`REPLACE`:`PUSH`,this.history[i===`REPLACE`?`replace`:`push`](o.publicHref,o.state,{ignoreBlocker:t}),this.history.subscribers.size||this.load({action:{type:i}})}return this._scroll.n=n.resetScroll??!0,this._commitPromise},this.buildAndCommitLocation=({replace:e,resetScroll:t,hashScrollIntoView:n,viewTransition:r,ignoreBlocker:i,...a}={})=>{let o=this.buildLocation({...a,_includeValidateSearch:!0});this._pendingLocation=o;let s=this.commitLocation({...o,viewTransition:r,replace:e,resetScroll:t,hashScrollIntoView:n,ignoreBlocker:i});return queueMicrotask(()=>{this._pendingLocation===o&&(this._pendingLocation=void 0)}),s},this.navigate=async({to:e,reloadDocument:t,href:n,publicHref:r,...i})=>{let a=n?me(n):void 0;if(a||t){if(e!==void 0||!n){let t=this.buildLocation({to:e,...i}),a=t.maskedLocation??t;n??=a.publicHref,r??=a.publicHref}let t=!a&&r?r:n;return Gt(this,t,i)}return this.buildAndCommitLocation({...i,href:n,to:e,_isNavigate:!0})},this.load=async e=>{this.updateLatestLocation(),e?.action&&(this._scroll.h=e.action.type===`PUSH`||e.action.type===`REPLACE`),await Kn(this,e)},this.startViewTransition=e=>{let t=this.shouldViewTransition??this.options.defaultViewTransition;if(this.shouldViewTransition=void 0,t&&typeof document.startViewTransition==`function`){let n;if(typeof t==`object`&&window.CSS?.supports?.(`selector(:active-view-transition-type(a))`)){let r=this.latestLocation,i=this.stores.resolvedLocation.get(),a=typeof t.types==`function`?t.types(Bt(r,i)):t.types;if(a===!1)return e();n={update:e,types:a}}else n=e;return document.startViewTransition(n).updateCallbackDone}return e()},this.invalidate=e=>{let t=this._committed,n=e?.filter,r=this._preloads,i=new Set,a=e=>{(!n||n(e))&&i.add(e.id)};t.forEach(a),this._cache.forEach(a),r?.forEach(e=>e.forEach(a)),this._tx?.[3].forEach(a);let o=[];for(let[e,t]of r??[])t.some(e=>i.has(e.id))&&(r.delete(e),o.push(e));let s=t=>{if(i.has(t.id)){let n=this.routesById[t.routeId],r={...t,invalid:!0,...(e?.forcePending||t.status===`error`||t.status===`notFound`)&&zt(n)?{status:`pending`,error:void 0}:void 0};return t._flight=void 0,r}return t};this._committed=t.map(s);for(let[t,n]of this._cache)i.has(t)&&(n.invalid=!0,e?.forcePending&&(n.status=`pending`));for(let e of i){let t=this._flights?.get(e);this._flights?.delete(e),t&&!t[2]&&o.push(t[1])}for(let e of o)e.abort();return this.shouldViewTransition=!1,this.load({sync:e?.sync})},this.resolveRedirect=e=>{let t=e.options,n=e.headers.get(`Location`)||t.href;if(!n){let e=this.buildLocation(t);n=(e.maskedLocation??e).publicHref||`/`}let r;if(he.test(n)||(r=me(n))&&!this.protocolAllowlist.has(r))throw Error(`Redirect blocked: unsafe protocol`);if(r===`http:`||r===`https:`){let e=new URL(n);e.pathname.startsWith(`//`)?n=e.href:Lt(e,this.origin)||(n=Rt(e),r=void 0)}return r&&(t.reloadDocument=!0),t.href=n,e.headers.set(`Location`,n),e},this.clearCache=e=>{let t=this._cache,n=this._preloads,r=e?.filter,i=[],a=[];for(let[e,n]of t)(!r||r(n))&&(a.push(e),i.push(n));let o=[];for(let[e,t]of n??[])(!r||t.some(r))&&(o.push(e),i.push(...t));for(let e of a)t.delete(e);for(let e of o)n.delete(e);for(let e of i){let t=e._flight;e._flight=void 0,t&&!--t[2]&&(this._flights?.get(e.id)===t&&this._flights.delete(e.id),o.push(t[1]))}for(let e of o)e.abort()},this.loadRouteChunk=rn,this.preloadRoute=e=>qn(this,e),this.matchRoute=(e,t)=>{let n={...e,to:e.to?we(e.from||``,e.to,this.options.trailingSlash,this.resolvePathCache):void 0,params:e.params||{},leaveParams:!0},r=this.buildLocation(n),i=this.stores.status.get()===`pending`;if(t?.pending&&!i)return!1;let a=t?.pending??!i?this.latestLocation:this.stores.resolvedLocation.get()||this.stores.location.get(),o=lt(r.pathname,t?.caseSensitive??!1,t?.fuzzy??!1,a.pathname,this.processedTree);return!o||e.params&&!le(o.rawParams,e.params,!0)?!1:t?.includeSearch??!0?le(a.search,r.search,!0)?o.rawParams:!1:o.rawParams},this.getStoreConfig=t,e.pathParamsAllowedCharacters?.length&&(this.pathParamsDecoder=Te(e.pathParamsAllowedCharacters)),this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...e,caseSensitive:e.caseSensitive??!1,notFoundMode:e.notFoundMode??`fuzzy`,stringifySearch:e.stringifySearch??qe,parseSearch:e.parseSearch??Ke,protocolAllowlist:e.protocolAllowlist??pe}),self.__TSR_ROUTER__=this}isShell(){return!!this.options.isShell}get state(){return this.stores.__store.get()}setRoutes(e){Object.assign(this,e),this.lightweightCache=new WeakMap,this.staticLocations=new WeakMap;let t=this.options.notFoundRoute;t&&(t.init(99999999999),this.routesById[t.id]!==t&&(t._interpolation=it(!1,t,0)),this.routesById[t.id]=t)}matchRoutesInternal(e,t){let[n,r,i]=this.getMatchedRoutes(e.pathname),a=n,o=!1;(i?i.path!==`/`&&r[`**`]:D(e.pathname))&&(this.options.notFoundRoute?a=[...a,this.options.notFoundRoute]:o=!0);let s=o?A(this.options.notFoundMode,a):void 0,c=Array(a.length),l=this._committed,u=(e,t)=>{let n=l[t];return n?.routeId===e.id?n:e===this.options.notFoundRoute?l.find(t=>t.routeId===e.id):void 0},d;for(let n=0;n<a.length;n++){let i=a[n],o=c[n-1],l,f,p;{let n=o?.search??e.search,r=o?._strictSearch??void 0;try{let e=Jt(i.options.validateSearch,{...n})??void 0;l={...n,...e},f={...r,...e}}catch(e){let r=e;if(e instanceof Kt||(r=new Kt(e.message,{cause:e})),t?.throwOnError)throw r;l=n,f={},p=r}}let m=``,h=``;try{m=i.options.loaderDeps?.({search:l})??``,h=m&&JSON.stringify(m)||``}catch(e){if(t?.throwOnError)throw e;p??=e}let g=E(),_=i._interpolation?k(i.fullPath,i._interpolation,r,this.pathParamsDecoder,g):i.fullPath,v=i.id+_+h,y=u(i,n),b=this._cache.get(v)??(y?.id===v?y:void 0);d=b?._strictParams??Object.assign(g,d);let x;if(!b)try{en(i,d)}catch(e){if(x=Oe(e)||Qe(e)?e:new qt(e.message,{cause:e}),t?.throwOnError)throw x}let S=y?`stay`:`enter`,C;if(b)C={...b,cause:S,search:oe(y?y.search:b.search,l),_strictSearch:f,searchError:p};else{let e=zt(i)?`pending`:`success`;C={id:v,ssr:i.options.ssr,index:n,routeId:i.id,params:y?.params??d,_strictParams:d,pathname:_,updatedAt:Date.now(),search:y?oe(y.search,l):l,_strictSearch:f,searchError:p,status:e,isFetching:!1,error:void 0,paramsError:x,context:{},abortController:t?._controller??new AbortController,cause:S,loaderDeps:y?se(y.loaderDeps,m):m,invalid:!1,preload:!1,staticData:i.options.staticData||{},fullPath:i.fullPath}}let w=s===i.id;C._notFound&&!w&&(C.error=void 0),C._notFound=w,c[n]=C}for(let e=0;e<c.length;e++){let n=c[e];n.params=n.cause===`stay`?oe(n.params,d):d,t?._controller&&(n.context={})}return c}matchRoutesLightweight(e){let t=ne(this.stores.ids.get()),n=t?this.stores.byRoute.get(t).get():void 0,r=n?.id,i=this.lightweightCache.get(e);if(i&&i[0]===r)return i[1];let[a,o]=this.getMatchedRoutes(e.pathname),s=ne(a),c={...e.search};for(let e of a)try{Object.assign(c,Jt(e.options.validateSearch,c))}catch{}let l=n&&n.routeId===s.id&&n.pathname===e.pathname,u;if(l)u=n.params;else{let e=o;for(let t of a)try{en(t,e)}catch{}u=e}let d=[a,s.fullPath,c,u];return this.lightweightCache.set(e,[r,d]),d}};async function Gt(e,t,{replace:n,ignoreBlocker:r}){if(!ge(t,e.protocolAllowlist)){if(!r){let t=e.history._getBlockers();for(let r of t)if(r?.blockerFn&&await r.blockerFn({currentLocation:e.history.location,nextLocation:e.history.location,action:n?`REPLACE`:`PUSH`}))return}e.history._ignoreNextBeforeUnload?.(t),n?window.location.replace(t):window.location.href=t}}var Kt=class extends Error{},qt=class extends Error{};function Jt(e,t){if(e==null)return{};if(`~standard`in e){let n=e[`~standard`].validate(t);if(n instanceof Promise)throw new Kt(`Async validation not supported`);if(n.issues)throw new Kt(JSON.stringify(n.issues,void 0,2),{cause:n});return n.value}return`parse`in e?e.parse(t):typeof e==`function`?e(t):{}}function Yt(e,t){if(e===void 0||e===!0)return t;let n=Object.create(null);return e===!1||e===null?n:typeof e==`function`?(Object.assign(n,t),Object.assign(n,e(n))):Object.assign(n,t,e)}function Xt(e,t){return typeof e==`function`?!0:!t||e===!1||e===null?!1:e===void 0||e===!0||t.some(t=>typeof t!=`string`&&!ie.call(e,t[1]))}var Zt=Object.freeze({});function Qt(e,t){let n=[];for(let r=0;r<e.length;r++){let i=e[r].options;`search`in i?i.search?.middlewares&&n.push(...i.search.middlewares):(i.preSearchFilters||i.postSearchFilters)&&n.push(({search:e,next:t})=>{let n=t(i.preSearchFilters?i.preSearchFilters.reduce((e,t)=>t(e),e):e);return i.postSearchFilters?i.postSearchFilters.reduce((e,t)=>t(e),n):n});let a=i.validateSearch;t&&a&&n.push(({search:e,next:t,meta:n})=>{let r=t(e);try{let e=Jt(a,r);if(n&&e)for(let t in e)t in r||(n.defaulted||=new Map).set(t,e[t]);return{...r,...e}}catch{}return r})}return n}function $t(e,t,n){let r=(t,i,a)=>{if(t>=e.length){if(!n.search)return{};if(n.search===!0)return i;let e=re(n.search,i);return a&&(a.explicit=e),e}return e[t]({search:i,next:(e,n)=>{if(n){let n=a||{};return{search:r(t+1,e,n),meta:n}}return r(t+1,e,a)},meta:a})};return r(0,t)}function A(e,t){if(e!==`root`){let e;for(let n=t.length-1;n>=0;n--){let r=t[n];if(r.options.notFoundComponent)return r.id;e||=r.children&&r.id}if(e)return e}return Xe}function en(e,t){let n=e.options.params?.parse??e.options.parseParams;n&&Object.assign(t,n(t))}function tn(e,t){return e.options[t]?.preload?.()}function nn(e,t){let n=tn(e,`component`),r=tn(e,`pendingComponent`);return t&&(r?r=r.then(t):t()),n&&r?Promise.all([n,r]).then(()=>{}):n??r}function rn(e,t,n){let r=()=>t===!1?void 0:t?tn(e,t):nn(e,n),i=e._lazy;if(i)return i===!0?r():i.then(r);if(!e.lazyFn)return r();let a=e.lazyFn().then(t=>{{let{id:n,...r}=t.options;Object.assign(e.options,r),e._lazy=!0}},t=>{throw e._lazy=void 0,t});return e._lazy=a,a.then(r)}function an(e){let t=e.findIndex(e=>e.status!==`success`||e._notFound)+1;return t&&t<e.length?e.slice(0,t):e}function on(e,t,n){let r=e._tx;return t&&r?.[2]===n&&!r[3].some(e=>e.routeId===t)}var sn=0,cn=1,ln=2,un=3,dn=[4];function fn(e){return typeof e[0]==`number`}function pn(e,t){return t.aborted?Promise.race([Promise.reject(t),e]):new Promise((n,r)=>{let i=()=>r(t);t.addEventListener(`abort`,i,{once:!0}),Promise.resolve(e).then(n,r).then(()=>t.removeEventListener(`abort`,i))})}function mn(e,t){return e.routesById[t.routeId]}function hn(e,t,n){return Qe(e)?[un,e]:Oe(e)?(e.routeId||=n,[ln,e]):t?(typeof e?.then==`function`&&(e=Error(`A Promise was thrown`,{cause:e})),[cn,e]):[sn,e]}function gn(e,t){let n=hn(t,!0,e.id);if(n[0]!==cn)return n;try{e.options.onError?.(n[1])}catch(t){n=hn(t,!0,e.id)}return n}function _n(e,t,n,r,i){return i[0].signal.aborted?dn:Nn(e,t,n,gn(n,r),i)}async function vn(e,t,n,r,i,a){let[o,s]=t,c=n[0].signal,l=!!n[3];for(let i=n[6]??0;i<r;i++){let r=s[i],u=mn(e,r);r.abortController=n[0];let d=s[i-1]?.context??e.options.context??{},f={params:r.params,location:o,navigate:t=>e.navigate({...t,_fromLocation:o}),buildLocation:e.buildLocation,cause:l?`preload`:r.cause,abortController:n[0],preload:l,matches:s,routeId:u.id};try{let e=r._ctx||=u.options.context?u.options.context({...f,deps:r.loaderDeps,context:d})||{}:void 0;r.context={...d,...e}}catch(a){return bn(e,r),[i,_n(e,t,u,a,n)]}if(c.aborted)return[i,dn];let p=r.paramsError??r.searchError;if(p!==void 0)return bn(e,r),[i,_n(e,t,u,p,n)];let m=u.options.beforeLoad;if(!m)continue;let h=r.status;i>=a&&(r.status=`pending`,n[7]?.());try{Cn(e,r,`beforeLoad`,n[0]);let a=m({...f,search:r.search,context:r.context,...e.options.additionalContext}),o=await(typeof a?.then==`function`?pn(a,c):a);if(c.aborted)return[i,dn];let s=Nn(e,t,u,hn(o,!1,u.id),n);if(s[0]!==sn)return bn(e,r),[i,s];r.context={...r.context,...o}}catch(a){return bn(e,r),[i,_n(e,t,u,a,n)]}finally{r.status=h,Cn(e,r,!1,n[0])}}i()}function yn(e,t,n){if(!(!n||--n[2])){if(e._flights?.get(t.id)===n){let n=e._tx;if(n&&!n[0].signal.aborted&&!n[3].includes(t)&&n[3].some(e=>e.id===t.id)&&n[3].some(e=>e.isFetching===`beforeLoad`))return;e._flights.delete(t.id)}return n[1]}}function bn(e,t){let n=t._flight;t._flight=void 0,yn(e,t,n)?.abort()}function xn(e,t,n,r){let i=[];for(let a of t)if(!n?.includes(a)){let t=a._flight;if(a._flight=void 0,r&&t?.[2]===1&&e._flights?.get(a.id)===t&&n?.some(e=>e.id===a.id))t[2]=0;else{let n=yn(e,a,t);n&&i.push(n)}}for(let e of i)e.abort()}function Sn(e){for(let t of e){let e=t._flight;e&&e[2]++}}function Cn(e,t,n,r){if(t.isFetching=n,r&&e._tx?.[0]!==r)return;let i=e.stores.byRoute.get(t.routeId),a=i?.get();a?.id===t.id&&i.set({...a,isFetching:n})}function wn(e,t,n,r,i,a,o){let s=t[0];return{params:n.params,location:s,navigate:t=>e.navigate({...t,_fromLocation:s}),cause:o?`preload`:n.cause,abortController:i,preload:o,deps:n.loaderDeps,parentMatchPromise:a,context:n.context,route:r,...e.options.additionalContext}}async function Tn(e,t,n,r,i,a,o){let s=o[0],c=s.signal;if(c.aborted)return dn;if(!i)return[sn,void 0];let l=n._flight;Cn(e,n,`loader`,s);try{if(!l){let s=new AbortController;l=[Promise.resolve().then(()=>i(wn(e,t,n,r,s,a,!!o[3]))).then(e=>hn(e,!1,r.id),e=>hn(e,!0,r.id)).then(t=>(t[0]!==sn&&e._flights?.get(n.id)===l&&(e._flights.delete(n.id),l[2]||s.abort()),t[0]===cn&&l[2]?gn(r,t[1]):t)),s,1],(e._flights??=new Map).set(n.id,l)}return n._flight=l,n.abortController=l[1],Nn(e,t,r,await pn(l[0],c),o)}catch(t){if(t!==c||!c.aborted)throw t;return bn(e,n),dn}finally{Cn(e,n,!1,s)}}function En(e,t,n){t[0]!==un&&(e.status=`success`,e.error=void 0,t[0]===sn?(e.loaderData=t[1],e.invalid=!1,e.updatedAt=Date.now(),e.preload=n):e.invalid=!0)}function Dn(e,t,n){let r=e._cache.get(t.id);if(r!==n||e._committed.some(e=>e.id===t.id&&e._flight===t._flight))return;let i={...t,_notFound:void 0,context:{}};i._flight&&i._flight[2]++,e._cache.set(t.id,i),r&&bn(e,r)}function On(e,t){return t[0]===cn||t[0]===ln?{...e,status:t[0]===cn?`error`:`notFound`,error:t[1],_flight:void 0}:e}function kn(e,t,n,r,i,a,o){let s=t[1][n],c=mn(e,s),l=!!a[3],u=e._cache.get(s.id),d,f=!1,p;try{if(s.status===`success`&&(d=c.options.shouldReload,typeof d==`function`&&(d=d(wn(e,t,s,c,a[0],i,l))),a[0].signal.aborted&&(p=dn)),!p){if(s.status!==`success`)f=!0;else{let t=l||s.preload?c.options.preloadStaleTime??e.options.defaultPreloadStaleTime??3e4:c.options.staleTime??e.options.defaultStaleTime??0;f=!!(s.invalid||d||d===void 0&&Date.now()-s.updatedAt>=t&&(a[5]||s.cause===`enter`||a[2].some(e=>e.routeId===s.routeId&&e.id!==s.id)))}}}catch(n){s.invalid=!0,bn(e,s),p=_n(e,t,c,n,a)}let m=c.options.loader,h=typeof m==`function`,g=h?m:m?.handler,_=!l||c.options.preload!==!1,v=_&&m?e._flights?.get(s.id):void 0;v===s._flight||p?v=void 0:v&&!f&&!l&&d===void 0?f=!0:f||(v=void 0);let y=!(!m||!f||s.status!==`success`||l||a[4]||((h?void 0:m.staleReloadMode)??e.options.defaultStaleReloadMode)===`blocking`),b=f&&_,x=b&&!y&&(s.status!==`success`||!!m),S=n>=o?a[7]:void 0,C=c.lazyFn&&c._lazy!==!0?S:void 0;if(b&&!m&&(s.invalid=!1,s.updatedAt=Date.now()),v&&v[2]++,x){let t=s._flight;s._flight=v,yn(e,s,t)?.abort(),n>=o&&(s.status=`pending`),S?.()}b||(s.isFetching=!1);let w=!p&&x?Tn(e,t,s,c,g,i,a).then(t=>(En(s,t,l),t[0]===sn&&(m&&!a[0].signal.aborted&&Dn(e,s,u),n>=o&&(s.status=`pending`)),t)):Promise.resolve(p??[sn,s.loaderData]),ee=(async()=>{try{let e=rn(c,void 0,C);e&&await pn(e,a[0].signal)}catch(r){if(!t[1].some((e,t)=>t<=n&&(e.status===`error`||e.status===`notFound`||e._notFound)))return[n,_n(e,t,c,r,a)]}let r=await w;x&&r[0]===sn&&s.status===`pending`&&!a[0].signal.aborted&&(s.status=`success`,S?.())})();if(r.push([n,w,ee]),!y)return w.then(e=>On(s,e));let T={...s,status:`pending`,preload:!1,_flight:v};s.invalid=!1,s.isFetching=`loader`;let te=Tn(e,t,T,c,g,i,a).then(e=>(s.isFetching=!1,En(T,e,!1),e));return(t[2]??=[]).push([n,te,ee,T]),te.then(e=>On(T,e))}async function An(e,t,n,r,i=0){let a=n?.[1][1],o=a?.routeId?t.findIndex(e=>e.routeId===a.routeId):n?.[0]??t.length-1;o<0&&(o=0);for(let n=o;n>=0;n--){let i=mn(e,t[n]);try{let e=rn(i,!1);e&&await pn(e,r)}catch(e){if(e===r&&r.aborted)throw e}if(i.options.notFoundComponent)return n}return a?.routeId?o:i}function jn(e,t){t[2]&&=(xn(e,t[2].map(e=>e[3])),void 0)}async function Mn(e,t,n,r){let i;try{await Promise.all(e.map(e=>e[1].then(async t=>{let a=e[0];if(!(r&&a>=await r)){if(t[0]>=un)throw[a,t];!i&&t[0]!==sn&&(i=[a,t],await Promise.all((n??[]).map(e=>{if(!(e[0]<=a))return e[1].then(t=>{if(t[0]===un)throw[e[0],t]})})))}})))}catch(e){return e}return t??i}function Nn(e,t,n,r,i,a){for(;r[0]===un;){let o=r[1],s=o.options;try{if((s.href||o.headers.has(`Location`))&&(e.resolveRedirect(o),s.reloadDocument)||(s.reloadDocument?i[3]:i[1]>=20))return r;let n=e.buildLocation({...s,_fromLocation:t[0],_includeValidateSearch:!0}),a=n.maskedLocation??n;if(a.external){let t=o.clone();return t.options={...s},t.headers.set(`Location`,a.publicHref),e.resolveRedirect(t),i[3]?[un,t]:[un,t,a]}return[un,o,n]}catch(e){r=a?[cn,e]:gn(n,e),a=!0}}return r}async function Pn(e,t,n,r,i,a){let o=t[1],s=await i,c=!1,l=o.findIndex(e=>e._notFound),u=t=>t[1][0]===ln?An(e,o,t,r.signal):t[0],d=l<0?o.length:l;if((s?.[1][0]??0)>=un)d=0;else if(s){d=s[2]??=await u(s);for(let e of n){if(e[0]>=d)break;let t=await e[1];if(t[0]!==sn&&t[0]<un&&!(`loaderData`in o[e[0]])){s=[e[0],t],d=s[2]=await u(s);break}}}for(let e of n){if(e[0]>=d)break;let t=await e[2];if(t){s=t;break}}if((s?.[1][0]??0)>=un){let n=s[1];if(n[0]!==un||n[1].options.reloadDocument||n[2])return jn(e,t),n;c=!0,s=[0,[cn,Error(`Too many redirects`)]]}let f=s?s[2]??await u(s):l;if(f>=0){let i=s?.[1],l=i?.[0],u=o[f],d=i?.[1],p=()=>{i&&(u._notFound=void 0,l===cn?u.status=`error`:(d.routeId=u.routeId,u.routeId===e.routeTree.id?(u.status=`success`,u._notFound=!0):u.status=`notFound`),u.error=d,u.isFetching=!1)};p(),i||a?.();let m=mn(e,u);try{await pn(i?Promise.resolve().then(()=>rn(m,l===cn?`errorComponent`:`notFoundComponent`)):Promise.all([rn(m),rn(m,`notFoundComponent`)]),r.signal)}catch(n){if(n===r.signal&&r.signal.aborted)return jn(e,t),dn}i?c&&(r.abort(),await Promise.all([...n.map(e=>e[1]),...n.map(e=>e[2]),...(t[2]??[]).map(e=>e[1])]),jn(e,t),xn(e,o),p()):u.status=`success`}return t}async function Fn(e,t,n,r=0,i=t[1].length){let a=t[1];for(let t=r;t<i;t++){let r=a[t],i=mn(e,r).options;if(i.head||i.scripts)try{let t={ssr:e.options.ssr,matches:a,match:r,params:r.params,loaderData:r.loaderData},[o,s]=await pn(Promise.all([i.head?.(t),i.scripts?.(t)]),n);r.meta=o?.meta,r.links=o?.links,r.headScripts=o?.scripts,r.styles=o?.styles,r.scripts=s}catch(e){if(e===n&&n.aborted)break;console.error(e)}if(r.status!==`success`||r._notFound)break}return t}async function In(e,t,n,r){let i=[t,n],a=r[0].signal,o;try{let t=e.stores.matches.get(),s=n.findIndex(e=>e._notFound);if(e.options.notFoundMode!==`root`&&s>=0){let t=await An(e,n,void 0,a,s);n[s]._notFound=void 0,n[t]._notFound=!0,s=t}let c=s<0?n.length:s+1,l=0;for(;l<c&&l!==s;){let e=n[l],i=r[2][l],a=t[l];if(i?.id!==e.id||i.status!==`success`||e.preload||a?.id!==e.id||a.status!==`success`||(l++,i._notFound||a._notFound))break}let u=[],d=r[6]??0,f=d?Promise.resolve(n[d-1]):void 0,p=()=>{for(let t=d;t<c&&!a.aborted;t++)f=kn(e,i,t,u,f,r,l)},m=await vn(e,i,r,c,p,l);if(m){if(r[4]=!0,c=m[0],m[1][0]===ln){let t=await An(e,n,m,a);m[2]=t,c=Math.min(c,t+1)}else m[1][0]>=un&&(c=0);p()}if(!a.aborted&&!r[3]){let t=[];for(let[n,r]of e._flights??[])r[2]||(e._flights.delete(n),t.push(r[1]));for(let e of t)e.abort()}let h=Pn(e,i,u,r[0],Mn(u,m,i[2]),r[7]);i[2]?.length&&(i[3]=Mn(i[2],void 0,void 0,h.then(e=>fn(e)?0:an(n).length,()=>0))),o=await h}catch(t){if(jn(e,i),t===a&&a.aborted)return dn;throw t}return fn(o)?o:Fn(e,o,a,r[6]===n.length?r[6]:0)}function Ln(e,t){if(e._tx!==t)return;let n=t[3],r=e.stores.matches.get(),i=e._pending;for(let a=0;a<n.length;a++){let o=n[a],s=o.status===`success`&&!o._notFound,c=r[a]?.id===o.id&&r[a]?.status===`pending`;if(s&&!c)continue;let l=mn(e,o),u=s||o.invalid?0:l.options.pendingMs??e.options.defaultPendingMs,d=l.options.pendingComponent??e.options.defaultPendingComponent;if(!d||typeof u!=`number`||u===1/0){i&&(i[0]=t,i[2]=0,i[4]=!0);return}let f=l.options.pendingMinMs??e.options.defaultPendingMinMs??0,p=!1;if(i?.[1]===o.id?(p=i[0]!==t,i[0]=t):(clearTimeout(i?.[3]),e._pending=i=void 0),i||(e._pending=i=[t,o.id,c?Date.now()+f:t[4]+u,void 0,c||void 0,d]),i[4]&&!p&&i[5]===d)return;if(i[5]=d,!i[4]){clearTimeout(i[3]);let n=i[2]-Date.now();if(n>0){i[3]=setTimeout(()=>Ln(e,t),n);return}i[2]=0}let m=n.map(e=>({...e,_flight:void 0}));m[a].status=`pending`;let h=i[4]=e.startTransition(()=>e.stores.setMatches(m),m).then(t=>(t&&e._pending===i&&i[4]===h&&!i[2]&&(i[2]=Date.now()+f),t));return}}function Rn(e,t){let n=e._pending;e._tx!==t&&e._tx?.[3].some(e=>e.id===n?.[1])||(clearTimeout(n?.[3]),e._pending=void 0)}async function zn(e,t){let n=e._pending;if(!n)return;clearTimeout(n[3]);let r=n[2]-Date.now();if(!n[4]||r<=0||!an(t[3]).some(e=>e.id===n[1]))return;let i;try{await pn(new Promise(e=>{i=setTimeout(e,r)}),t[0].signal)}catch{}clearTimeout(i)}function Bn(e,t){e._committed=t,e.stores.setMatches(t)}function Vn(e,t,n,r){let i=e._committed,a=e._lifecycleEnd,o=e._cache;for(let e of n)e.preload=!1,r&&(e._assetEnd=void 0);let s=an(n).length,c=new Map;{let t=Date.now(),r=new Set;for(let e=0;e<n.length;e++){let t=n[e];(e<s||t.status===`success`)&&r.add(t.id)}for(let n of[...i,...o.values()]){if(n.status!==`success`||r.has(n.id))continue;let i=mn(e,n);!i.options.loader||t-n.updatedAt>=(n.preload?i.options.preloadGcTime??e.options.defaultPreloadGcTime??3e5:i.options.gcTime??e.options.defaultGcTime??3e5)||c.set(n.id,o.get(n.id)===n?n:{...n,_flight:void 0,isFetching:!1,context:{}})}}t[3]=[],e._cache=c;let l=e._lifecycleEnd=Ht(n);Bn(e,n),xn(e,[...o.values(),...i].filter(e=>e._flight&&c.get(e.id)!==e),n),Ut(e,i,n,a,l,t)}async function Hn(e,t){let n=e._tx;for(;n&&n!==t;)t=n,await n[5],n=e._tx}function Un(e,t,n){let r=n[1].options,i=n[2];if(!i)return e.navigate({...r,replace:!0,ignoreBlocker:!0});if(r.reloadDocument)return e.navigate({href:(i.maskedLocation??i).publicHref,reloadDocument:!0,replace:!0,ignoreBlocker:!0});i._redirects=t[1]+1,e._pendingLocation=i;let a=e.commitLocation({...i,viewTransition:r.viewTransition,replace:!0,resetScroll:r.resetScroll,hashScrollIntoView:r.hashScrollIntoView,ignoreBlocker:!0});return queueMicrotask(()=>{e._pendingLocation===i&&(e._pendingLocation=void 0)}),a}async function Wn(e,t,n,r,i){let a=n.map(e=>({...e}));Sn(a);for(let t of r)bn(e,a[t[0]]),a[t[0]]=t[3];let o=[t[2],a],s;try{s=await Pn(e,o,r,t[0],i)}catch(t){throw xn(e,a),t}if(fn(s))xn(e,a),s[0]===un&&e._tx===t&&e._committed===n&&await Un(e,t,s);else if(await Fn(e,s,t[0].signal),e._tx!==t||e._committed!==n)xn(e,a);else{for(let t of a){let n=e._cache.get(t.id);n?._flight&&n._flight===t._flight&&(e._cache.delete(t.id),bn(e,n))}Bn(e,a),xn(e,n,a)}}async function Gn(e,t,n,r,i,a){let o=await In(e,t[2],t[3],[t[0],t[1],e._committed,void 0,i,n,a,r]);if(fn(o)){let n=o[0]===un&&e._tx===t;if((!n||o[1].options.reloadDocument)&&Rn(e,t),xn(e,t[3]),t[3]=[],!n)return;if(e._tx!==t){Rn(e,t);return}await Un(e,t,o);return}let s=o[1];if(e._tx===t&&await zn(e,t),e._tx!==t){Rn(e,t),xn(e,s),jn(e,o);return}let c=t[2],l=Bt(c,e.stores.resolvedLocation.get()),u=o[2];await e.startViewTransition(async()=>{if(e._tx===t&&await zn(e,t),e._tx!==t){Rn(e,t),xn(e,s),jn(e,o);return}let n=await e.startTransition(()=>{Rn(e,t),Vn(e,t,s,a),e._tx===t&&(e.emit({type:`onLoad`,...l}),e._tx===t&&e.emit({type:`onBeforeRouteMount`,...l}))},s);e._tx===t?(u?.length&&Wn(e,t,s,u,o[3]).catch(console.error),e.batch(()=>{e.stores.resolvedLocation.set(c),e.stores.status.set(`idle`),e._tx===t&&e.emit({type:`onResolved`,...l}),n&&e._tx===t&&e.emit({type:`onRendered`,...l})}),e._tx===t&&(e._commitPromise?.resolve(),e._commitPromise=void 0)):jn(e,o)})}async function Kn(e,t){let n=e._tx,r=e.stores.resolvedLocation.get(),i=r??e.stores.location.get(),a=e.latestLocation,o=e._pendingLocation,s=o?.href===a.href?o._redirects??0:0,c=e._handoff,l=c?.[0](),u=new AbortController,d=e._preflight;if(e._preflight=u,l||c?.[1](),d?.abort(),!u.signal.aborted){let t=Bt(a,r);e.emit({type:`onBeforeNavigate`,...t}),u.signal.aborted||e.emit({type:`onBeforeLoad`,...t})}if(u.signal.aborted){await Hn(e,n);return}let f=i.href===a.href,p=u,m=e.matchRoutes(a,{_controller:u});Sn(m);let h=l?c[1](m):void 0;if(h?p=l:l?.abort(),u.signal.aborted){xn(e,m),await Hn(e,n);return}e._preflight=void 0;let g,_=()=>Gn(e,y,f,()=>Ln(e,y),t?.sync,h),v=t?.sync?new Promise(e=>g=e):Promise.resolve().then(_),y=[p,s,a,m,Date.now(),v.then(()=>Hn(e,y))];if(e._tx=y,n){for(let t of e.stores.matches.get()){if(e._tx!==y)break;t.isFetching&&Cn(e,t,!1)}n[0].abort(),xn(e,n[3],y[3],!0)}e._tx===y?(e.batch(()=>{e.stores.status.set(`pending`),e.stores.location.set(a)}),(h||!e._committed.length&&m[0]?.status!==`success`&&!m.some(e=>e._notFound))&&Ln(e,y),g?.(_()),await y[5]):(xn(e,y[3]),y[3]=[],g?.(),await Hn(e,y))}async function qn(e,t){let n=e.buildLocation(t);for(let t=0;;t++){let r=e._committed,i=new AbortController,a,o,s;try{try{a=e.matchRoutes(n,{_controller:i}),Sn(a),o=(e._preloads??=new Map).set(i,a),s=await In(e,n,a,[i,t,r,!0])}finally{o&&(o=o.delete(i),xn(e,a)),i.abort()}if(!fn(s))return s[1];if(!o||s.length<3)return;n=s[2]}catch(e){Oe(e)||console.error(e);return}}}var Jn=`Error preloading route! ☝️`,Yn=class{get to(){return this._to}get id(){return this._id}get path(){return this._path}get fullPath(){return this._fullPath}constructor(e){if(this.init=e=>{this.originalIndex=e,this._branch=void 0;let t=this.options,n=!t?.path&&!t?.id;this.parentRoute=this.options.getParentRoute?.(),n?this._path=Xe:this.parentRoute||be();let r=n?Xe:t?.path;r&&r!==`/`&&(r=Se(r));let i=t?.id||r,a=n?Xe:xe((this.parentRoute.id===`__root__`?``:this.parentRoute.id)+`/`+(i??``));r===`__root__`&&(r=`/`);let o=a===`__root__`?`/`:r===void 0?this.parentRoute.fullPath:xe(this.parentRoute.fullPath+`/`+r);this._path=r,this._id=a,this._fullPath=o,this._to=D(o)},this.addChildren=e=>this._addFileChildren(e),this._addFileChildren=e=>(Array.isArray(e)&&(this.children=e),typeof e==`object`&&e&&(this.children=Object.values(e)),this),this._addFileTypes=()=>this,this.updateLoader=e=>(Object.assign(this.options,e),this),this.update=e=>(Object.assign(this.options,e),this),this.lazy=e=>(this.lazyFn=e,this),this.redirect=e=>Ze({from:this.fullPath,...e}),this.options=e||{},this.isRoot=!e?.getParentRoute,e?.id&&e?.path)throw Error(`Route cannot have both an 'id' and a 'path' option.`)}},Xn=class extends Yn{constructor(e){super(e)}},j=i(),Zn=class extends T.Component{constructor(...e){super(...e),this.state={error:0},this.reset=()=>{this.setState({error:0})}}static getDerivedStateFromProps(e,t){let n=e.getResetKey();return t.error&&t.resetKey!==n?{resetKey:n,error:0}:{resetKey:n}}static getDerivedStateFromError(e){return{error:[e]}}componentDidCatch(e,t){this.props.onCatch?.(e,t)}render(){let e=this.state.error;return e?T.createElement(this.props.errorComponent??Qn,{error:e[0],reset:this.reset}):this.props.children}};function Qn({error:e}){let[t,n]=T.useState(!1);return(0,j.jsxs)(`div`,{style:{padding:`.5rem`,maxWidth:`100%`},children:[(0,j.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`.5rem`},children:[(0,j.jsx)(`strong`,{style:{fontSize:`1rem`},children:`Something went wrong!`}),(0,j.jsx)(`button`,{style:{appearance:`none`,fontSize:`.6em`,border:`1px solid currentColor`,padding:`.1rem .2rem`,fontWeight:`bold`,borderRadius:`.25rem`},onClick:()=>n(e=>!e),children:t?`Hide Error`:`Show Error`})]}),(0,j.jsx)(`div`,{style:{height:`.25rem`}}),t?(0,j.jsx)(`div`,{children:(0,j.jsx)(`pre`,{style:{fontSize:`.7em`,border:`1px solid red`,borderRadius:`.25rem`,padding:`.3rem`,color:`red`,overflow:`auto`},children:e?.message?(0,j.jsx)(`code`,{children:e.message}):null})}):null]})}var $n=()=>!0,er=()=>!1;function tr({children:e,fallback:t=null}){return(0,j.jsx)(T.Fragment,{children:nr()?e:t})}function nr(e=!0){return T.useSyncExternalStore(rr,$n,e?er:$n)}function rr(){return()=>{}}var ir=T.createContext(null);function ar(e){return T.useContext(ir)}function or(e,t){let n=e.stores.location,r=new Set,i,a,o=n=>{on(e,t,n)||(i=n,r.forEach(e=>e()))};return[()=>i??n.get(),e=>(r.size||(i=n.get(),a=n.subscribe(o).unsubscribe),r.add(e),()=>{r.delete(e),r.size||(a(),i=void 0)})]}var sr=T.createContext(void 0),cr=T.createContext(void 0);function lr({update:e,notify:t,unwatched:n}){return{link:r,unlink:i,propagate:a,checkDirty:o,shallowPropagate:s};function r(e,t,n){let r=t.depsTail;if(r!==void 0&&r.dep===e)return;let i=r===void 0?t.deps:r.nextDep;if(i!==void 0&&i.dep===e){i.version=n,t.depsTail=i;return}let a=e.subsTail;if(a!==void 0&&a.version===n&&a.sub===t)return;let o=t.depsTail=e.subsTail={version:n,dep:e,sub:t,prevDep:r,nextDep:i,prevSub:a,nextSub:void 0};i!==void 0&&(i.prevDep=o),r===void 0?t.deps=o:r.nextDep=o,a===void 0?e.subs=o:a.nextSub=o}function i(e,t=e.sub){let r=e.dep,i=e.prevDep,a=e.nextDep,o=e.nextSub,s=e.prevSub;return a===void 0?t.depsTail=i:a.prevDep=i,i===void 0?t.deps=a:i.nextDep=a,o===void 0?r.subsTail=s:o.prevSub=s,s===void 0?(r.subs=o)===void 0&&n(r):s.nextSub=o,a}function a(e){let n=e.nextSub,r;top:do{let i=e.sub,a=i.flags;if(a&60?a&12?a&4?!(a&48)&&c(e,i)?(i.flags=a|40,a&=1):a=0:i.flags=a&-9|32:a=0:i.flags=a|32,a&2&&t(i),a&1){let t=i.subs;if(t!==void 0){let i=(e=t).nextSub;i!==void 0&&(r={value:n,prev:r},n=i);continue}}if((e=n)!==void 0)n=e.nextSub;else{for(;r!==void 0;)if(e=r.value,r=r.prev,e!==void 0){n=e.nextSub;continue top}break}}while(1)}function o(t,n){let r,i=0,a=!1;top:do{let o=t.dep,c=o.flags;if(n.flags&16)a=!0;else if((c&17)==17){if(e(o)){let e=o.subs;e.nextSub!==void 0&&s(e),a=!0}}else if((c&33)==33){(t.nextSub!==void 0||t.prevSub!==void 0)&&(r={value:t,prev:r}),t=o.deps,n=o,++i;continue}if(!a){let e=t.nextDep;if(e!==void 0){t=e;continue}}for(;i--;){let i=n.subs,o=i.nextSub!==void 0;if(o?(t=r.value,r=r.prev):t=i,a){if(e(n)){o&&s(i),n=t.sub;continue}a=!1}else n.flags&=-33;n=t.sub;let c=t.nextDep;if(c!==void 0){t=c;continue top}}return a}while(1)}function s(e){do{let n=e.sub,r=n.flags;(r&48)==32&&(n.flags=r|16,(r&6)==2&&t(n))}while((e=e.nextSub)!==void 0)}function c(e,t){let n=t.depsTail;for(;n!==void 0;){if(n===e)return!0;n=n.prevDep}return!1}}function ur(e,t,n){let r=typeof e==`object`,i=r?e:void 0;return{next:(r?e.next:e)?.bind(i),error:(r?e.error:t)?.bind(i),complete:(r?e.complete:n)?.bind(i)}}var dr=[],fr=0,{link:pr,unlink:mr,propagate:hr,checkDirty:gr,shallowPropagate:_r}=lr({update(e){return e._update()},notify(e){dr[yr++]=e,e.flags&=-3},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=17,Cr(e))}}),vr=0,yr=0,br,xr=0;function Sr(e){try{++xr,e()}finally{--xr||wr()}}function Cr(e){let t=e.depsTail,n=t===void 0?e.deps:t.nextDep;for(;n!==void 0;)n=mr(n,e)}function wr(){if(!(xr>0)){for(;vr<yr;){let e=dr[vr];dr[vr++]=void 0,e.notify()}vr=0,yr=0}}function Tr(e,t){let n=typeof e==`function`,r=e,i={_snapshot:n?void 0:e,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:+!n,get(){return br!==void 0&&pr(i,br,fr),i._snapshot},subscribe(e){let t=ur(e),n={current:!1},r=Er(()=>{i.get(),n.current?(br=void 0,t.next?.(i._snapshot)):n.current=!0});return{unsubscribe:()=>{r.stop()}}},_update(e){let a=br,o=t?.compare??Object.is;if(n)br=i,++fr,i.depsTail=void 0;else if(e===void 0)return!1;n&&(i.flags=5);try{let t=i._snapshot,a=typeof e==`function`?e(t):e===void 0&&n?r(t):e;return t===void 0||!o(t,a)?(i._snapshot=a,!0):!1}finally{br=a,n&&(i.flags&=-5),Cr(i)}}};return n?(i.flags=17,i.get=function(){let e=i.flags;if(e&16||e&32&&gr(i.deps,i)){if(i._update()){let e=i.subs;e!==void 0&&_r(e)}}else e&32&&(i.flags=e&-33);return br!==void 0&&pr(i,br,fr),i._snapshot}):i.set=function(e){if(i._update(e)){let e=i.subs;e!==void 0&&(hr(e),_r(e),wr())}},i}function Er(e){let t=()=>{let t=br;br=n,++fr,n.depsTail=void 0,n.flags=6;try{return e()}finally{br=t,n.flags&=-5,Cr(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:6,notify(){let e=this.flags;e&16||e&32&&gr(this.deps,this)?t():this.flags=2},stop(){this.flags=0,this.depsTail=void 0,Cr(this)}};return t(),n}var Dr=class{constructor(e,t){this.atom=Tr(e),this.get=this.get.bind(this),this.setState=this.setState.bind(this),this.subscribe=this.subscribe.bind(this),t&&(this.actions=t(this))}setState(e){this.atom.set(e)}get state(){return this.atom.get()}get(){return this.state}subscribe(e){return this.atom.subscribe(ur(e))}},Or=class{constructor(e){this.atom=Tr(e)}get state(){return this.atom.get()}get(){return this.state}subscribe(e){return this.atom.subscribe(ur(e))}};function kr(e,t){return typeof e==`function`?new Or(e):t?new Dr(e,t):new Dr(e)}var Ar=C();function jr(e,t){return e===t}function M(e,t=e=>e,n){let r=n?.compare??jr,i=(0,T.useCallback)(t=>{let{unsubscribe:n}=e.subscribe(t);return n},[e]),a=(0,T.useCallback)(()=>e.get(),[e]);return(0,Ar.useSyncExternalStoreWithSelector)(i,a,a,t,r)}var Mr=(e,t=e=>e,n)=>M(e,t,{compare:n}),Nr={};function Pr(e,t){let n=T.useRef();return r=>{let i=e?.select?e.select(r):r;return e?.structuralSharing??t.options.defaultStructuralSharing?n.current=se(n.current,i):i}}function Fr(e){let t=ar(),n=T.useContext(e.from?cr:sr),r=e.from??n,i=t.stores.getMatchStore(r),a=Pr(e,t),o=M(i,e=>e?a(e):Nr);if(o!==Nr)return o;(e.shouldThrow??!0)&&be()}function Ir(e){return Fr({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function Lr(e){let{select:t,...n}=e;return Fr({...n,select:e=>t?t(e.loaderDeps):e.loaderDeps})}function Rr(e){return Fr({from:e.from,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,strict:e.strict,select:t=>{let n=e.strict===!1?t.params:t._strictParams;return e.select?e.select(n):n}})}function zr(e){return Fr({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function Br(e){let t=ar();return T.useCallback(n=>t.navigate({...n,from:n.from??e?.from}),[e?.from,t])}function Vr(e){let t=ar(),n=Br(),r=T.useRef(null);return te(()=>{r.current!==e&&(n(e),r.current=e)},[t,e,n]),null}function Hr(e){return Fr({...e,select:t=>e.select?e.select(t.context):t.context})}function Ur(...e){let t=T.useRef(e),n=t.current;return e.forEach((e,t)=>{le(n[t],e,!1,!0)||(n[t]=e)}),t.current}function Wr(e,t){e.preloadRoute(t).catch(e=>{console.warn(e),console.warn(Jn)})}function Gr(e,t){let n=typeof e==`string`&&me(e);if(n)return t.has(n)?e:null}function Kr(e,t,n,r){let i=Ce(e.pathname,r),a=Ce(t.pathname,r);return(n?.exact?i!==a:!i.startsWith(a)||i.length!==a.length&&i[a.length]!==`/`)||(n?.includeSearch??!0)&&!le(e.search,t.search,!n?.exact,n?.explicitUndefined)?!1:!n?.includeHash||e.hash===t.hash}function qr(e,t,n){let r=ar(),i=T.useRef(null),a=T.useCallback(e=>{if(i.current=e,typeof t==`function`)return t(e);t&&(t.current=e)},[t]),{activeOptions:o,to:s,preload:c,preloadDelay:l,disabled:u,target:d,onClick:f,onBlur:p,onFocus:m,onMouseEnter:h,onMouseLeave:g,onTouchStart:_}=e,[v,y,b]=Ur(e.search,e.params,o),x=T.useContext(sr),S=(r.stores._linkScopes??={})[x]??=or(r,x),[C,w,ee]=T.useMemo(()=>{let t=Gr(s,r.protocolAllowlist);if(t!==void 0){let n=[t??void 0];return[e,()=>n]}let n={...e},i,a,o,c=()=>{let e=S[0]();if(e!==i){n._fromLocation=e;let t=r.buildLocation(n),o=ti(t,r,u),s=u||o&&!me(o)?Kr(e,t,b,r.basepath):void 0;a&&a[0]===o&&a[1]===s||(a=[o,s]),i=e}return a};return[n,c,b?.includeHash&&(()=>{let e=c();return e[1]?o??=[e[0],!1]:e})]},[r,S,e.from,e.hash,e.href,s,v,y,e.state,e.mask,e.unsafeRelative,b,u]),[te,ne]=T.useSyncExternalStore(S[1],w,ee||w),re=ne===void 0&&te,ie=u||te===void 0,ae=T.useRef(!1),E=e.reloadDocument||re||ie?!1:c??r.options.defaultPreload,oe=l??r.options.defaultPreloadDelay??0,se=T.useCallback(e=>{let t=e?.isIntersecting;t??E===`intent`?oe?i.t??=setTimeout(()=>{i.t=void 0,Wr(r,C)},oe):Wr(r,C):t===!1&&$r(i)},[r,C,i,E,oe]);T.useEffect(()=>{if(!E)return;E===`render`&&!ae.current&&(ae.current=!0,Wr(r,C));let e=!0,t;return E===`viewport`&&i.current&&typeof IntersectionObserver==`function`&&(t=new IntersectionObserver(t=>{e&&se(t.pop())},{rootMargin:`100px`}),t.observe(i.current)),()=>{e=!1,t?.disconnect(),$r(i)}},[r,C,E,se,i]);let ce=Zr(e,n);if(ce.ref=t?a:i,re)return ce.href=re,ce;let le=t=>{let n=d??t.currentTarget.getAttribute(`target`);ie||t.metaKey||t.altKey||t.ctrlKey||t.shiftKey||t.defaultPrevented||n&&n!==`_self`||t.button!==0||(t.preventDefault(),$r(i),r.navigate({...e,_fromLocation:C._fromLocation}))},ue=()=>{E===`intent`&&Wr(r,C)},de=()=>{E===`intent`&&$r(i)};return ce.onClick=ei(f,le),ce.onBlur=ei(p,de),ce.onFocus=ei(m,se),ce.onMouseEnter=ei(h,se),ce.onMouseLeave=ei(g,de),ce.onTouchStart=ei(_,ue),Qr(ce,e,ne,te,ie,n)}var Jr={},Yr={className:`active`},Xr=new Set([`to`,`params`,`search`,`hash`,`state`,`mask`,`from`,`unsafeRelative`,`reloadDocument`,`preload`,`preloadDelay`,`preloadIntentProximity`,`hashScrollIntoView`,`replace`,`startTransition`,`resetScroll`,`viewTransition`,`ignoreBlocker`,`activeProps`,`inactiveProps`,`activeOptions`,`_asChild`]);function Zr(e,t){let n={};for(let r in e)Xr.has(r)||r===`type`&&t!==void 0||r===`disabled`&&t===`a`||(n[r]=e[r]);return n}function Qr(e,t,n,r,i,a){let{activeProps:o,inactiveProps:s,className:c,style:l,target:u}=t,d=re(n?o:s,{})??(n?Yr:Jr);Object.assign(e,d),e.href=r,a!==`a`&&(e.disabled=i),e.target=u;let f=d.style;(l||f)&&(e.style=l&&f?{...l,...f}:l||f);let p=d.className;return(c||p)&&(e.className=c?p?`${c} ${p}`:c:p),i&&(e.role=`link`,e[`aria-disabled`]=!0),n&&(e[`data-status`]=`active`,e[`aria-current`]=`page`),e}var $r=e=>{clearTimeout(e.t),e.t=void 0},ei=(e,t)=>e?n=>n.defaultPrevented||(e(n),n.defaultPrevented||t(n)):t;function ti(e,t,n){if(n)return;let r=e.maskedLocation??e,i=r.external?r.publicHref:t.history.createHref(r.publicHref)||`/`;if(!r.external&&i===r.publicHref||!ge(i,t.protocolAllowlist))return i}var ni=T.memo(T.forwardRef((e,t)=>{let n=e._asChild||`a`,r=qr(e,t,n),i=typeof e.children==`function`?e.children({isActive:r[`data-status`]===`active`}):e.children;return T.createElement(n,r,i)}),ri);function ri(e,t){let n=0;for(let r in t)if(n++,e[r]!==t[r]&&(!Xr.has(r)||!le(e[r],t[r],!1,!0)))return!1;for(let t in e)n--;return n===0}var ii=class extends Yn{constructor(e){super(e),this.useMatch=e=>Fr({...e,from:this.id}),this.useRouteContext=e=>Hr({...e,from:this.id}),this.useSearch=e=>zr({...e,from:this.id}),this.useParams=e=>Rr({...e,from:this.id}),this.useLoaderDeps=e=>Lr({...e,from:this.id}),this.useLoaderData=e=>Ir({...e,from:this.id}),this.useNavigate=()=>Br({from:this.fullPath}),this.Link=T.forwardRef((e,t)=>(0,j.jsx)(ni,{ref:t,from:this.fullPath,...e}))}};function ai(e){return new ii(e)}function oi(){return e=>ci(e)}var si=class extends Xn{constructor(e){super(e),this.useMatch=e=>Fr({...e,from:this.id}),this.useRouteContext=e=>Hr({...e,from:this.id}),this.useSearch=e=>zr({...e,from:this.id}),this.useParams=e=>Rr({...e,from:this.id}),this.useLoaderDeps=e=>Lr({...e,from:this.id}),this.useLoaderData=e=>Ir({...e,from:this.id}),this.useNavigate=()=>Br({from:this.fullPath}),this.Link=T.forwardRef((e,t)=>(0,j.jsx)(ni,{ref:t,from:this.fullPath,...e}))}};function ci(e){return new si(e)}function li(e){let t=ar(),n=`not-found-${M(t.stores.location,e=>e.pathname)}-${M(t.stores.status)}`;return(0,j.jsx)(Zn,{getResetKey:()=>n,onCatch:(t,n)=>{if(Oe(t))e.onCatch?.(t,n);else throw t},errorComponent:({error:t})=>{if(Oe(t))return e.fallback?.(t);throw t},children:e.children})}function ui(){return(0,j.jsx)(`p`,{children:`Not Found`})}function di(e,t,n){return t.options.notFoundComponent?(0,j.jsx)(t.options.notFoundComponent,{...n}):e.options.defaultNotFoundComponent?(0,j.jsx)(e.options.defaultNotFoundComponent,{...n}):(0,j.jsx)(ui,{})}function fi(e,t){let n=t?.options.pendingComponent??e.options.defaultPendingComponent;return n?(0,j.jsx)(n,{}):null}var pi=(e,t)=>e[0]===t[0]&&e[1]===t[1],mi=(e,t,n)=>!t.isRoot||t.options.shellComponent||t.options.wrapInSuspense||n===!1||n===`data-only`||!e.ssr,hi=T.memo(function({routeId:e}){let t=ar();return gi(t,M(t.stores.getMatchStore(e)))});function gi(e,t){let n=e.routesById[t.routeId],r=fi(e,n),i=n.options.errorComponent??e.options.defaultErrorComponent,a=n.options.onCatch??e.options.defaultOnCatch,o=n.isRoot?n.options.notFoundComponent??e.options.notFoundRoute?.options.component:n.options.notFoundComponent,s=t.ssr===!1||t.ssr===`data-only`,c=mi(e,n,t.ssr)&&(n.options.wrapInSuspense??r??(n.options.errorComponent?.preload||s)),l=(0,j.jsx)(_i,{match:t});s&&(l=(0,j.jsx)(tr,{fallback:r,children:l})),o&&(l=(0,j.jsx)(li,{fallback:e=>{if(e.routeId??=t.routeId,e.routeId!==t.routeId)throw e;return T.createElement(o,e)},children:l})),i&&(l=(0,j.jsx)(Zn,{getResetKey:()=>t,errorComponent:i,onCatch:(e,n)=>{if(Oe(e))throw e.routeId??=t.routeId,e;a?.(e,n)},children:l})),c&&(l=(0,j.jsx)(T.Suspense,{fallback:r,children:l}));let u=n.isRoot&&n.options.shellComponent;return u?(0,j.jsx)(sr.Provider,{value:t.routeId,children:(0,j.jsxs)(u,{children:[l,null]})}):(0,j.jsxs)(sr.Provider,{value:t.routeId,children:[l,null]})}var _i=T.memo(function({match:e}){let t=ar(),n=e.routeId,r=t.routesById[n],i=T.useMemo(()=>{let i=(r.options.remountDeps??t.options.defaultRemountDeps)?.({routeId:n,loaderDeps:e.loaderDeps,params:e._strictParams,search:e._strictSearch});return i?JSON.stringify(i):void 0},[n,e.loaderDeps,e._strictParams,e._strictSearch,r.options.remountDeps,t.options.defaultRemountDeps]),a=T.useMemo(()=>{let e=r.options.component??t.options.defaultComponent;return e?(0,j.jsx)(e,{},i):(0,j.jsx)(vi,{})},[i,r.options.component,t.options.defaultComponent]);if(e.status===`pending`){if(t.ssr&&!mi(t,r,e.ssr))return a;if(t._tx)throw t._tx[5];return fi(t,r)}if(e.status===`notFound`)return di(t,r,e.error);if(e.status===`error`)throw e.error;return a}),vi=T.memo(function(){let e=ar(),t=T.useContext(sr),n,r,i;{let a=e.stores.getMatchStore(t);[n,r]=M(a,e=>[!!e._notFound,e.error],{compare:pi}),i=M(e.stores.ids,e=>e[e.indexOf(t)+1])}if(n)return di(e,e.routesById[t],r);if(!i)return null;let a=(0,j.jsx)(hi,{routeId:i});return t===`__root__`?(0,j.jsx)(T.Suspense,{fallback:fi(e),children:a}):a});function yi(e,t){let n=e[1];e.length=0,n?.(t)}function bi({t:e}){let t=ar(),n=t._rendered??=[];return t.startTransition=(r,i)=>new Promise(a=>{yi(n,!1),n.push(i,a),e(t),T.startTransition(r)}),te(()=>{let e=t.history.subscribe(t.load);t.updateLatestLocation();let r=t.latestLocation,i=t.buildLocation({to:r.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});if(D(r.publicHref)!==D(i.publicHref))return t.commitLocation({...i,replace:!0,ignoreBlocker:!0}),e;let a=t.stores.resolvedLocation.get();return a?.href===r.href&&a.state.__TSR_key===r.state.__TSR_key?n.push(t.stores.matches.get(),e=>{e&&t.emit({type:`onRendered`,...Bt(a,a)})}):t._tx||t.load({sync:!0}).catch(console.error),e},[t,t.history]),null}function xi(){let e=ar(),t=e.routesById[Xe],n=fi(e,t),r=(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(bi,{t:T.useState()[1]}),e.ssr?(0,j.jsx)(Si,{}):(0,j.jsx)(T.Suspense,{fallback:n,children:(0,j.jsx)(Si,{})})]});return e.options.InnerWrap?(0,j.jsx)(e.options.InnerWrap,{children:r}):r}function Si(){let e=ar(),t=e._rendered,n=M(e.stores.matches,e=>t[0]??e),r=n[0],i=r?.routeId;te(()=>{t[0]===n&&yi(t,!0)},[t,n]);let a=i?(0,j.jsx)(hi,{routeId:i}):null;return e.options.disableGlobalCatchBoundary?a:(0,j.jsx)(Zn,{getResetKey:()=>r,onCatch:void 0,children:a})}var Ci=e=>({createMutableStore:Tr,createReadonlyStore:Tr,batch:Sr}),wi=e=>new Ti(e),Ti=class extends Wt{constructor(e){super(e,Ci)}};function Ei({router:e,children:t,...n}){ae(n)&&e.update({...e.options,...n,context:{...e.options.context,...n.context}});let r=(0,j.jsx)(ir.Provider,{value:e,children:t});return e.options.Wrap?(0,j.jsx)(e.options.Wrap,{children:r}):r}function Di({router:e,...t}){return(0,j.jsx)(Ei,{router:e,...t,children:(0,j.jsx)(xi,{})})}function Oi(e,t){if(e===void 0)return{shouldBlockFn:()=>!0,withResolver:!1};if(`shouldBlockFn`in e)return e;if(typeof e==`function`){let n=!!(t??!0);return{shouldBlockFn:async()=>n?await e():!1,enableBeforeUnload:n,withResolver:!1}}let n=!!(e.condition??!0),r=e.blockerFn;return{shouldBlockFn:async()=>n&&r!==void 0?await r():n,enableBeforeUnload:n,withResolver:r===void 0}}function ki(e,t){let{shouldBlockFn:n,enableBeforeUnload:r=!0,disabled:i=!1,withResolver:a=!1}=Oi(e,t),o=ar(),{history:s}=o,[c,l]=T.useState({status:`idle`,current:void 0,next:void 0,action:void 0,proceed:void 0,reset:void 0});return T.useEffect(()=>i?void 0:s.block({blockerFn:async e=>{function t(e){let t=o.parseLocation(e),[,n,r]=o.getMatchedRoutes(t.pathname);return r===void 0?{routeId:`__notFound__`,fullPath:t.pathname,pathname:t.pathname,params:n,search:o.options.parseSearch(e.search)}:{routeId:r.id,fullPath:r.fullPath,pathname:t.pathname,params:n,search:o.options.parseSearch(e.search)}}let r=t(e.currentLocation),i=t(e.nextLocation);if(r.routeId===`__notFound__`&&i.routeId!==`__notFound__`)return!1;let s=await n({action:e.action,current:r,next:i});if(!a)return s;if(!s)return!1;let c=await new Promise(t=>{l({status:`blocked`,current:r,next:i,action:e.action,proceed:()=>t(!1),reset:()=>t(!0)})});return l({status:`idle`,current:void 0,next:void 0,action:void 0,proceed:void 0,reset:void 0}),c},enableBeforeUnload:r}),[n,r,i,a,s,o]),c}function Ai(e){let t=ar();return M(t.stores.location,Pr(e,t))}var ji=t((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,S||(S=!0,ne());else{var t=n(l);t!==null&&ae(x,t.startTime-e)}}}var S=!1,C=-1,w=5,ee=-1;function T(){return g?!0:!(e.unstable_now()-ee<w)}function te(){if(g=!1,S){var t=e.unstable_now();ee=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&T());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&ae(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?ne():S=!1}}}var ne;if(typeof y==`function`)ne=function(){y(te)};else if(typeof MessageChannel<`u`){var re=new MessageChannel,ie=re.port2;re.port1.onmessage=te,ne=function(){ie.postMessage(null)}}else ne=function(){_(te,0)};function ae(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,ae(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,ne()))),r},e.unstable_shouldYield=T,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),Mi=t(((e,t)=>{t.exports=ji()})),Ni=t((e=>{var t=Mi(),i=r(),a=n();function o(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function s(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function c(e){for(var t=e,n=t;n&&!n.alternate;)t=n,t.flags&4098&&(e=t.return),n=t.return;for(;t.return;)t=t.return;return t.tag===3?e:null}function l(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function u(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function d(e){if(c(e)!==e)throw Error(o(188))}function f(e){var t=e.alternate;if(!t){if(t=c(e),t===null)throw Error(o(188));return t===e?e:null}for(var n=e,r=t;;){var i=n.return;if(i===null)break;var a=i.alternate;if(a===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===a.child){for(a=i.child;a;){if(a===n)return d(i),e;if(a===r)return d(i),t;a=a.sibling}throw Error(o(188))}if(n.return!==r.return)n=i,r=a;else{for(var s=!1,l=i.child;l;){if(l===n){s=!0,n=i,r=a;break}if(l===r){s=!0,r=i,n=a;break}l=l.sibling}if(!s){for(l=a.child;l;){if(l===n){s=!0,n=a,r=i;break}if(l===r){s=!0,r=a,n=i;break}l=l.sibling}if(!s)throw Error(o(189))}}if(n.alternate!==r)throw Error(o(190))}if(n.tag!==3)throw Error(o(188));return n.stateNode.current===n?e:t}function p(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=p(e),t!==null)return t;e=e.sibling}return null}function m(e,t,n,r,i,a){for(;e!==null;){if((e.tag===5||e.tag===27||e.tag===6)&&n(e,r,i,a)||(e.tag!==22||e.memoizedState===null)&&(t||e.tag!==5&&e.tag!==27)&&m(e.child,t,n,r,i,a))return!0;e=e.sibling}return!1}function h(e){for(e=e.return;e!==null;){if(e.tag===3||e.tag===5||e.tag===27)return e;e=e.return}return null}function g(e){var t=!1;for(e=e.return;e!==null&&(e.tag===4&&(t=!0),e.tag!==3&&e.tag!==5&&e.tag!==27);)e=e.return;return t}function _(e){var t=[null,null],n=h(e);return n===null||v(t,e,n.child,{foundSelf:!1}),t}function v(e,t,n,r){for(;n!==null;){if(n===t)r.foundSelf=!0;else if(n.tag===5||n.tag===27||n.tag===6){if(r.foundSelf)return e[1]=n,!0;e[0]=n}else if((n.tag!==22||n.memoizedState===null)&&v(e,t,n.child,r))return!0;n=n.sibling}return!1}function y(e){switch(e.tag){case 5:case 27:case 6:return e.stateNode;case 3:return e.stateNode.containerInfo;default:throw Error(o(559))}}var b=null,x=null;function S(e,t,n){return e===n||e===t&&(b=e,!0)}function C(e,t,n){return e===n?(x=e,!1):e===t&&(x!==null&&(b=e),!0)}function w(e){if(e===null)return null;do e=e===null?null:e.return;while(e&&e.tag!==5&&e.tag!==27&&e.tag!==3);return e||null}function ee(e,t,n){for(var r=0,i=e;i;i=n(i))r++;i=0;for(var a=t;a;a=n(a))i++;for(;0<r-i;)e=n(e),r--;for(;0<i-r;)t=n(t),i--;for(;r--;){if(e===t||t!==null&&e===t.alternate)return e;e=n(e),t=n(t)}return null}var T=Object.assign,te=Symbol.for(`react.element`),ne=Symbol.for(`react.transitional.element`),re=Symbol.for(`react.portal`),ie=Symbol.for(`react.fragment`),ae=Symbol.for(`react.strict_mode`),E=Symbol.for(`react.profiler`),oe=Symbol.for(`react.consumer`),se=Symbol.for(`react.context`),ce=Symbol.for(`react.forward_ref`),le=Symbol.for(`react.suspense`),ue=Symbol.for(`react.suspense_list`),de=Symbol.for(`react.memo`),fe=Symbol.for(`react.lazy`),pe=Symbol.for(`react.activity`),me=Symbol.for(`react.legacy_hidden`),he=Symbol.for(`react.memo_cache_sentinel`),ge=Symbol.for(`react.view_transition`),_e=Symbol.for(`react.recoverable`),ve=Symbol.iterator;function ye(e){return typeof e!=`object`||!e?null:(e=ve&&e[ve]||e[`@@iterator`],typeof e==`function`?e:null)}var be=Symbol.for(`react.client.reference`);function xe(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===be?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case ie:return`Fragment`;case E:return`Profiler`;case ae:return`StrictMode`;case le:return`Suspense`;case ue:return`SuspenseList`;case pe:return`Activity`;case ge:return`ViewTransition`}if(typeof e==`object`)switch(e.$$typeof){case re:return`Portal`;case se:return e.displayName||`Context`;case oe:return(e._context.displayName||`Context`)+`.Consumer`;case ce:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case de:return t=e.displayName||null,t===null?xe(e.type)||`Memo`:t;case fe:t=e._payload,e=e._init;try{return xe(e(t))}catch{}}return null}var Se=Array.isArray,D=i.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,O=a.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Ce={pending:!1,data:null,method:null,action:null},we=[],Te=-1;function Ee(e){return{current:e}}function De(e){0>Te||(e.current=we[Te],we[Te]=null,Te--)}function k(e,t){Te++,we[Te]=e.current,e.current=t}var Oe=Ee(null),ke=Ee(null),Ae=Ee(null),je=Ee(null);function Me(e,t){switch(k(Ae,t),k(ke,e),k(Oe,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?up(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=up(t),e=dp(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}De(Oe),k(Oe,e)}function Ne(){De(Oe),De(ke),De(Ae)}function Pe(e){var t=e.memoizedState;t!==null&&(sh._currentValue=t.memoizedState,k(je,e)),t=Oe.current;var n=dp(t,e.type);t!==n&&(k(ke,e),k(Oe,n))}function Fe(e){ke.current===e&&(De(Oe),De(ke)),je.current===e&&(De(je),sh._currentValue=Ce)}var Ie,Le;function Re(e){if(Ie===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);Ie=t&&t[1]||``,Le=-1<e.stack.indexOf(`
|
|
4
|
+
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
|
|
5
|
+
`+Ie+e+Le}var ze=!1;function Be(e,t){if(!e||ze)return``;ze=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}n=!1;try{var i=Object.getOwnPropertyDescriptor(e.prototype,`props`);Object.defineProperty(e.prototype,"props",{configurable:!0,set:function(){throw Error()}}),n=!0,new e}finally{n&&(i===void 0?delete e.prototype.props:Object.defineProperty(e.prototype,"props",i))}}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
|
|
6
|
+
`),l=s.split(`
|
|
7
|
+
`);for(i=r=0;r<c.length&&!c[r].includes(`DetermineComponentFrameRoot`);)r++;for(;i<l.length&&!l[i].includes(`DetermineComponentFrameRoot`);)i++;if(r===c.length||i===l.length)for(r=c.length-1,i=l.length-1;1<=r&&0<=i&&c[r]!==l[i];)i--;for(;1<=r&&0<=i;r--,i--)if(c[r]!==l[i]){if(r!==1||i!==1)do if(r--,i--,0>i||c[r]!==l[i]){var u=`
|
|
8
|
+
`+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(`<anonymous>`)&&(u=u.replace(`<anonymous>`,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{ze=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?Re(n):``}function Ve(e,t){switch(e.tag){case 26:case 27:case 5:return Re(e.type);case 16:return Re(`Lazy`);case 13:return e.child!==t&&t!==null?Re(`Suspense Fallback`):Re(`Suspense`);case 19:return Re(`SuspenseList`);case 0:case 15:return Be(e.type,!1);case 11:return Be(e.type.render,!1);case 1:return Be(e.type,!0);case 31:return Re(`Activity`);case 30:return Re(`ViewTransition`);default:return``}}function He(e){try{var t=``,n=null;do t+=Ve(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
|
|
9
|
+
Error generating stack: `+e.message+`
|
|
10
|
+
`+e.stack}}var Ue=Object.prototype.hasOwnProperty,We=t.unstable_scheduleCallback,Ge=t.unstable_cancelCallback,Ke=t.unstable_shouldYield,qe=t.unstable_requestPaint,Je=t.unstable_now,Ye=t.unstable_getCurrentPriorityLevel,Xe=t.unstable_ImmediatePriority,Ze=t.unstable_UserBlockingPriority,Qe=t.unstable_NormalPriority,$e=t.unstable_LowPriority,et=t.unstable_IdlePriority,tt=t.log,nt=t.unstable_setDisableYieldValue,rt=null,it=null;function at(e){if(typeof tt==`function`&&nt(e),it&&typeof it.setStrictMode==`function`)try{it.setStrictMode(rt,e)}catch{}}var ot=Math.clz32?Math.clz32:lt,st=Math.log,ct=Math.LN2;function lt(e){return e>>>=0,e===0?32:31-(st(e)/ct|0)|0}var ut=256,dt=262144,ft=4194304;function pt(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&-e;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function mt(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=pt(n))):i=pt(o):i=pt(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=pt(n))):i=pt(o)):i=pt(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function ht(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function gt(e,t){t&8&&(t|=t&32);var n=e.entangledLanes;if(n!==0)for(e=e.entanglements,n&=t;0<n;){var r=31-ot(n),i=1<<r;t|=e[r],n&=~i}return t}function _t(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function vt(){var e=ft;return ft<<=1,!(ft&62914560)&&(ft=4194304),e}function yt(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function bt(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function xt(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0<n;){var u=31-ot(n),d=1<<u;s[u]=0,c[u]=-1;var f=l[u];if(f!==null)for(l[u]=null,u=0;u<f.length;u++){var p=f[u];p!==null&&(p.lane&=-536870913)}n&=~d}r!==0&&St(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function St(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-ot(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function Ct(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-ot(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function wt(e,t){var n=t&-t;return n=n&42?1:Tt(n),(n&(e.suspendedLanes|t))===0?n:0}function Tt(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function Et(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function Dt(){var e=O.p;return e===0?(e=window.event,e===void 0?32:Ch(e.type)):e}function Ot(e,t){var n=O.p;try{return O.p=e,t()}finally{O.p=n}}var kt=Math.random().toString(36).slice(2),At=`__reactFiber$`+kt,jt=`__reactProps$`+kt,Mt=`__reactContainer$`+kt,Nt=`__reactEvents$`+kt,Pt=`__reactListeners$`+kt,Ft=`__reactHandles$`+kt,It=`__reactResources$`+kt,Lt=`__reactMarker$`+kt,Rt=`__reactLoad$`+kt;function zt(e){delete e[At],delete e[jt],delete e[Pt],delete e[Ft]}function Bt(e){var t;if(t=e[At])return t;for(var n=e.parentNode;n;){if(t=n[Mt]||n[At]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=fm(e);e!==null;){if(n=e[At])return n;e=fm(e)}return t}e=n,n=e.parentNode}return null}function Vt(e){if(e=e[At]||e[Mt]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function Ht(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(o(33))}function Ut(e){var t=e[It];return t||=e[It]={hoistableStyles:new Map,hoistableScripts:new Map},t}function Wt(e){e[Lt]=!0}function Gt(e){e[Rt]=void 0}var Kt=new Set,qt={};function Jt(e,t){Yt(e,t),Yt(e+`Capture`,t)}function Yt(e,t){for(qt[e]=t,e=0;e<t.length;e++)Kt.add(t[e])}var Xt=RegExp(`^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$`),Zt={},Qt={};function $t(e){return Ue.call(Qt,e)?!0:Ue.call(Zt,e)?!1:Xt.test(e)?Qt[e]=!0:(Zt[e]=!0,!1)}var A=!1;function en(){var e=A;return A=!1,e}function tn(e,t,n){if($t(t)){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:e.removeAttribute(t);return;case`boolean`:var r=t.toLowerCase().slice(0,5);if(r!==`data-`&&r!==`aria-`){e.removeAttribute(t);return}}e.setAttribute(t,n)}}}function nn(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(t);return}e.setAttribute(t,n)}}function rn(e,t,n,r){if(r===null)e.removeAttribute(n);else{switch(typeof r){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(n);return}e.setAttributeNS(t,n,r)}}function an(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function on(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function sn(e,t,n){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&r!==void 0&&typeof r.get==`function`&&typeof r.set==`function`){var i=r.get,a=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){n=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(e){n=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function cn(e){if(!e._valueTracker){var t=on(e)?`checked`:`value`;e._valueTracker=sn(e,t,``+e[t])}}function ln(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=on(e)?e.checked?`true`:`false`:e.value),e=r,e!==n&&(t.setValue(e),!0)}var un=/[\n"\\]/g;function dn(e){return e.replace(un,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function fn(e,t,n,r,i,a,o,s){e.name=``,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`?e.type=o:e.removeAttribute(`type`),t==null?o!==`submit`&&o!==`reset`||e.removeAttribute(`value`):o===`number`?(t===0&&e.value===``||e.value!=t)&&(e.value=``+an(t)):e.value!==``+an(t)&&(e.value=``+an(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):mn(e,an(n)):o===`number`&&e.value==t?mn(e,an(e.value)):mn(e,an(t)),i==null&&a!=null&&(e.defaultChecked=!!a),i!=null&&(e.checked=i&&typeof i!=`function`&&typeof i!=`symbol`),s!=null&&typeof s!=`function`&&typeof s!=`symbol`&&typeof s!=`boolean`?e.name=``+an(s):e.removeAttribute(`name`)}function pn(e,t,n,r,i,a,o,s){if(a!=null&&typeof a!=`function`&&typeof a!=`symbol`&&typeof a!=`boolean`&&(e.type=a),t!=null||n!=null){if(!(a!==`submit`&&a!==`reset`||t!=null)){cn(e);return}n=n==null?``:``+an(n),t=t==null?n:``+an(t),s||t===e.value||(e.value=t),e.defaultValue=t}r??=i,r=typeof r!=`function`&&typeof r!=`symbol`&&!!r,e.checked=s?e.checked:!!r,e.defaultChecked=!!r,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`&&(e.name=o),cn(e)}function mn(e,t){e.defaultValue!==``+t&&(e.defaultValue=``+t)}function hn(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t[`$`+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty(`$`+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=``+an(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function gn(e,t,n){t!=null&&(t=``+an(t),t!==e.value&&(e.value=t),n==null)?e.defaultValue!==t&&(e.defaultValue=t):e.defaultValue=n==null?``:``+an(n)}function _n(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(o(92));if(Se(r)){if(1<r.length)throw Error(o(93));r=r[0]}n=r}n??=``,t=n}n=an(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),cn(e)}function vn(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var yn=new Set(`animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp`.split(` `));function bn(e,t,n){var r=t.indexOf(`--`)===0;n==null||typeof n==`boolean`||n===``?r?e.setProperty(t,``):t===`float`?e.cssFloat=``:e[t]=``:r?e.setProperty(t,n):typeof n!=`number`||n===0||yn.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function xn(e,t,n){if(t!=null&&typeof t!=`object`)throw Error(o(62));if(e=e.style,n!=null){for(var r in n)!n.hasOwnProperty(r)||t!=null&&t.hasOwnProperty(r)||(r.indexOf(`--`)===0?e.setProperty(r,``):r===`float`?e.cssFloat=``:e[r]=``,A=!0);for(var i in t)r=t[i],t.hasOwnProperty(i)&&n[i]!==r&&(bn(e,i,r),A=!0)}else for(var a in t)t.hasOwnProperty(a)&&bn(e,a,t[a])}function Sn(e){if(e.indexOf(`-`)===-1)return!1;switch(e){case`annotation-xml`:case`color-profile`:case`font-face`:case`font-face-src`:case`font-face-uri`:case`font-face-format`:case`font-face-name`:case`missing-glyph`:return!1;default:return!0}}var Cn=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`],[`maskType`,`mask-type`],[`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`]]),wn=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Tn(e){return wn.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function En(){}var Dn=null;function On(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var kn=null,An=null;function jn(e){var t=Vt(e);if(t&&(e=t.stateNode)){var n=e[jt]||null;a:switch(e=t.stateNode,t.type){case`input`:if(fn(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name="`+dn(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var i=r[jt]||null;if(!i)throw Error(o(90));fn(r,i.value,i.defaultValue,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name)}}for(t=0;t<n.length;t++)r=n[t],r.form===e.form&&ln(r)}break a;case`textarea`:gn(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&hn(e,!!n.multiple,t,!1)}}}var Mn=!1;function Nn(e,t,n){if(Mn)return e(t,n);Mn=!0;try{return e(t)}finally{if(Mn=!1,(kn!==null||An!==null)&&(zd(),kn&&(t=kn,e=An,An=kn=null,jn(t),e)))for(t=0;t<e.length;t++)jn(e[t])}}function Pn(e,t){var n=e.stateNode;if(n===null)return null;var r=n[jt]||null;if(r===null)return null;n=r[t];a:switch(t){case`onClick`:case`onClickCapture`:case`onDoubleClick`:case`onDoubleClickCapture`:case`onMouseDown`:case`onMouseDownCapture`:case`onMouseMove`:case`onMouseMoveCapture`:case`onMouseUp`:case`onMouseUpCapture`:case`onMouseEnter`:(r=!r.disabled)||(e=e.type,r=e!==`button`&&e!==`input`&&e!==`select`&&e!==`textarea`),e=!r;break a;default:e=!1}if(e)return null;if(n&&typeof n!=`function`)throw Error(o(231,t,typeof n));return n}var Fn=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0,In=!1;if(Fn)try{var Ln={};Object.defineProperty(Ln,"passive",{get:function(){In=!0}}),window.addEventListener(`test`,Ln,Ln),window.removeEventListener(`test`,Ln,Ln)}catch{In=!1}var Rn=null,zn=null,Bn=null;function Vn(){if(Bn)return Bn;var e,t=zn,n=t.length,r,i=`value`in Rn?Rn.value:Rn.textContent,a=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===i[a-r];r++);return Bn=i.slice(e,1<r?1-r:void 0)}function Hn(e){var t=e.keyCode;return`charCode`in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function Un(){return!0}function Wn(){return!1}function Gn(e){function t(t,n,r,i,a){for(var o in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=i,this.target=a,this.currentTarget=null,e)e.hasOwnProperty(o)&&(t=e[o],this[o]=t?t(i):i[o]);return this.isDefaultPrevented=(i.defaultPrevented==null?!1===i.returnValue:i.defaultPrevented)?Un:Wn,this.isPropagationStopped=Wn,this}return T(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():typeof e.returnValue!=`unknown`&&(e.returnValue=!1),this.isDefaultPrevented=Un)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=Un)},persist:function(){},isPersistent:Un}),t}var Kn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},qn=Gn(Kn),Jn=T({},Kn,{view:0,detail:0}),Yn=Gn(Jn),Xn,j,Zn,Qn=T({},Jn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:lr,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return`movementX`in e?e.movementX:(e!==Zn&&(Zn&&e.type===`mousemove`?(Xn=e.screenX-Zn.screenX,j=e.screenY-Zn.screenY):j=Xn=0,Zn=e),Xn)},movementY:function(e){return`movementY`in e?e.movementY:j}}),$n=Gn(Qn),er=Gn(T({},Qn,{dataTransfer:0})),tr=Gn(T({},Jn,{relatedTarget:0})),nr=Gn(T({},Kn,{animationName:0,elapsedTime:0,pseudoElement:0})),rr=Gn(T({},Kn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),ir=Gn(T({},Kn,{data:0})),ar={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},or={8:`Backspace`,9:`Tab`,12:`Clear`,13:`Enter`,16:`Shift`,17:`Control`,18:`Alt`,19:`Pause`,20:`CapsLock`,27:`Escape`,32:` `,33:`PageUp`,34:`PageDown`,35:`End`,36:`Home`,37:`ArrowLeft`,38:`ArrowUp`,39:`ArrowRight`,40:`ArrowDown`,45:`Insert`,46:`Delete`,112:`F1`,113:`F2`,114:`F3`,115:`F4`,116:`F5`,117:`F6`,118:`F7`,119:`F8`,120:`F9`,121:`F10`,122:`F11`,123:`F12`,144:`NumLock`,145:`ScrollLock`,224:`Meta`},sr={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function cr(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=sr[e])?!!t[e]:!1}function lr(){return cr}var ur=Gn(T({},Jn,{key:function(e){if(e.key){var t=ar[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=Hn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?or[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:lr,charCode:function(e){return e.type===`keypress`?Hn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?Hn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),dr=Gn(T({},Qn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),fr=Gn(T({},Kn,{submitter:0})),pr=Gn(T({},Jn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:lr})),mr=Gn(T({},Kn,{propertyName:0,elapsedTime:0,pseudoElement:0})),hr=Gn(T({},Qn,{deltaX:function(e){return`deltaX`in e?e.deltaX:`wheelDeltaX`in e?-e.wheelDeltaX:0},deltaY:function(e){return`deltaY`in e?e.deltaY:`wheelDeltaY`in e?-e.wheelDeltaY:`wheelDelta`in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0})),gr=Gn(T({},Kn,{newState:0,oldState:0,source:0})),_r=[9,13,27,32],vr=Fn&&`CompositionEvent`in window,yr=null;Fn&&`documentMode`in document&&(yr=document.documentMode);var br=Fn&&`TextEvent`in window&&!yr,xr=Fn&&(!vr||yr&&8<yr&&11>=yr),Sr=` `,Cr=!1;function wr(e,t){switch(e){case`keyup`:return _r.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function Tr(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var Er=!1;function Dr(e,t){switch(e){case`compositionend`:return Tr(t);case`keypress`:return t.which===32?(Cr=!0,Sr):null;case`textInput`:return e=t.data,e===Sr&&Cr?null:e;default:return null}}function Or(e,t){if(Er)return e===`compositionend`||!vr&&wr(e,t)?(e=Vn(),Bn=zn=Rn=null,Er=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case`compositionend`:return xr&&t.locale!==`ko`?null:t.data;default:return null}}var kr={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Ar(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!kr[e.type]:t===`textarea`}function jr(e,t,n,r){kn?An?An.push(r):An=[r]:kn=r,t=Jf(t,`onChange`),0<t.length&&(n=new qn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var M=null,Mr=null;function Nr(e){Vf(e,0)}function Pr(e){if(ln(Ht(e)))return e}function Fr(e,t){if(e===`change`)return t}var Ir=!1;if(Fn){var Lr;if(Fn){var Rr=`oninput`in document;if(!Rr){var zr=document.createElement(`div`);zr.setAttribute(`oninput`,`return;`),Rr=typeof zr.oninput==`function`}Lr=Rr}else Lr=!1;Ir=Lr&&(!document.documentMode||9<document.documentMode)}function Br(){M&&(M.detachEvent(`onpropertychange`,Vr),Mr=M=null)}function Vr(e){if(e.propertyName===`value`&&Pr(Mr)){var t=[];jr(t,Mr,e,On(e)),Nn(Nr,t)}}function Hr(e,t,n){e===`focusin`?(Br(),M=t,Mr=n,M.attachEvent(`onpropertychange`,Vr)):e===`focusout`&&Br()}function Ur(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return Pr(Mr)}function Wr(e,t){if(e===`click`)return Pr(t)}function Gr(e,t){if(e===`input`||e===`change`)return Pr(t)}function Kr(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var qr=typeof Object.is==`function`?Object.is:Kr;function Jr(e,t){if(qr(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!Ue.call(t,i)||!qr(e[i],t[i]))return!1}return!0}function Yr(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}function Xr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Zr(e,t){var n=Xr(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=Xr(n)}}function Qr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Qr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function $r(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Yr(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=Yr(e.document)}return t}function ei(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}var ti=Fn&&`documentMode`in document&&11>=document.documentMode,ni=null,ri=null,ii=null,ai=!1;function oi(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;ai||ni==null||ni!==Yr(r)||(r=ni,`selectionStart`in r&&ei(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),ii&&Jr(ii,r)||(ii=r,r=Jf(ri,`onSelect`),0<r.length&&(t=new qn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=ni)))}function si(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var ci={animationend:si(`Animation`,`AnimationEnd`),animationiteration:si(`Animation`,`AnimationIteration`),animationstart:si(`Animation`,`AnimationStart`),transitionrun:si(`Transition`,`TransitionRun`),transitionstart:si(`Transition`,`TransitionStart`),transitioncancel:si(`Transition`,`TransitionCancel`),transitionend:si(`Transition`,`TransitionEnd`)},li={},ui={};Fn&&(ui=document.createElement(`div`).style,`AnimationEvent`in window||(delete ci.animationend.animation,delete ci.animationiteration.animation,delete ci.animationstart.animation),`TransitionEvent`in window||delete ci.transitionend.transition);function di(e){if(li[e])return li[e];if(!ci[e])return e;var t=ci[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in ui)return li[e]=t[n];return e}var fi=di(`animationend`),pi=di(`animationiteration`),mi=di(`animationstart`),hi=di(`transitionrun`),gi=di(`transitionstart`),_i=di(`transitioncancel`),vi=di(`transitionend`),yi=new Map,bi=`abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error fullscreenChange fullscreenError gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel`.split(` `);bi.push(`scrollEnd`);function xi(e,t){yi.set(e,t),Jt(t,[e])}var Si=0;function Ci(e,t){if(e.name!=null&&e.name!==`auto`)return e.name;if(t.autoName!==null)return t.autoName;e=Cd.identifierPrefix;var n=Si++;return e=`_`+e+`t_`+n.toString(32)+`_`,t.autoName=e}function wi(e){if(e==null||typeof e==`string`)return e;var t=null,n=Ad;if(n!==null)for(var r=0;r<n.length;r++){var i=e[n[r]];if(i!=null){if(i===`none`)return`none`;t=t==null?i:t+(` `+i)}}return t??e.default}function Ti(e,t){return e=wi(e),t=wi(t),t==null?e===`auto`?null:e:t===`auto`?null:t}var Ei=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},Di=[],Oi=0,ki=0;function Ai(){for(var e=Oi,t=ki=Oi=0;t<e;){var n=Di[t];Di[t++]=null;var r=Di[t];Di[t++]=null;var i=Di[t];Di[t++]=null;var a=Di[t];if(Di[t++]=null,r!==null&&i!==null){var o=r.pending;o===null?i.next=i:(i.next=o.next,o.next=i),r.pending=i}a!==0&&Fi(n,i,a)}}function ji(e,t,n,r){Di[Oi++]=e,Di[Oi++]=t,Di[Oi++]=n,Di[Oi++]=r,ki|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function Ni(e,t,n,r){return ji(e,t,n,r),Ii(e)}function Pi(e,t){return ji(e,null,null,t),Ii(e)}function Fi(e,t,n){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n);for(var i=!1,a=e.return;a!==null;)a.childLanes|=n,r=a.alternate,r!==null&&(r.childLanes|=n),a.tag===22&&(e=a.stateNode,e===null||e._visibility&1||(i=!0)),e=a,a=a.return;return e.tag===3?(a=e.stateNode,i&&t!==null&&(i=31-ot(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function Ii(e){if(50<jd)throw jd=0,Y=null,Error(o(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Li={};function Ri(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function zi(e,t,n,r){return new Ri(e,t,n,r)}function Bi(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Vi(e,t){var n=e.alternate;return n===null?(n=zi(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&1206910976,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function Hi(e,t){e.flags&=1206910978;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function Ui(e,t,n,r,i,a){var s=0;if(r=e,typeof r==`function`)Bi(r)&&(s=1);else if(typeof r==`string`)s=qm(e,n,Oe.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(r){case pe:return e=zi(31,n,t,i),e.elementType=pe,e.lanes=a,e;case ie:return Wi(n.children,i,a,t);case ae:s=8,i|=24;break;case E:return e=zi(12,n,t,i|2),e.elementType=E,e.lanes=a,e;case le:return e=zi(13,n,t,i),e.elementType=le,e.lanes=a,e;case ue:return e=zi(19,n,t,i),e.elementType=ue,e.lanes=a,e;case me:case ge:return e=i|32,e=zi(30,n,t,e),e.elementType=ge,e.lanes=a,e.stateNode={autoName:null,paired:null,clones:null,ref:null},e;default:if(typeof r==`object`&&r)switch(r.$$typeof){case se:s=10;break a;case oe:s=9;break a;case ce:s=11;break a;case de:s=14;break a;case fe:s=16,r=null;break a}s=29,n=Error(o(130,e===null?`null`:typeof e,``)),r=null}return t=zi(s,n,t,i),t.elementType=e,t.type=r,t.lanes=a,t}function Wi(e,t,n,r){return e=zi(7,e,r,t),e.lanes=n,e}function Gi(e,t,n){return e=zi(6,e,null,t),e.lanes=n,e}function Ki(e){var t=zi(18,null,null,0);return t.stateNode=e,t}function qi(e,t,n){return t=zi(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Ji=new WeakMap;function Yi(e,t){if(typeof e==`object`&&e){var n=Ji.get(e);return n===void 0?(t={value:e,source:t,stack:He(t)},Ji.set(e,t),t):n}return{value:e,source:t,stack:He(t)}}var Xi=[],Zi=0,Qi=null,$i=0,ea=[],ta=0,na=null,ra=1,ia=``;function aa(e,t){Xi[Zi++]=$i,Xi[Zi++]=Qi,Qi=e,$i=t}function oa(e,t,n){ea[ta++]=ra,ea[ta++]=ia,ea[ta++]=na,na=e;var r=ra;e=ia;var i=32-ot(r)-1;r&=~(1<<i),n+=1;var a=32-ot(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,ra=1<<32-ot(t)+i|n<<i|r,ia=a+e}else ra=1<<a|n<<i|r,ia=e}function sa(e){e.return!==null&&(aa(e,1),oa(e,1,0))}function ca(e){for(;e===Qi;)Qi=Xi[--Zi],Xi[Zi]=null,$i=Xi[--Zi],Xi[Zi]=null;for(;e===na;)na=ea[--ta],ea[ta]=null,ia=ea[--ta],ea[ta]=null,ra=ea[--ta],ea[ta]=null}function la(e,t){ea[ta++]=ra,ea[ta++]=ia,ea[ta++]=na,ra=t.id,ia=t.overflow,na=e}var ua=null,N=null,P=!1,da=null,fa=!1,pa=Error(o(519));function ma(e){throw ba(Yi(Error(o(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),pa}function ha(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[At]=e,t[jt]=r,n){case`dialog`:Q(`cancel`,t),Q(`close`,t);break;case`iframe`:case`object`:case`embed`:Q(`load`,t);break;case`video`:case`audio`:for(n=0;n<zf.length;n++)Q(zf[n],t);break;case`source`:Q(`error`,t);break;case`img`:case`image`:case`link`:Q(`error`,t),Q(`load`,t);break;case`details`:Q(`toggle`,t);break;case`input`:Q(`invalid`,t),pn(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:Q(`invalid`,t);break;case`textarea`:Q(`invalid`,t),_n(t,r.value,r.defaultValue,r.children)}n=r.children,typeof n!=`string`&&typeof n!=`number`&&typeof n!=`bigint`||t.textContent===``+n||!0===r.suppressHydrationWarning||ep(t.textContent,n)?(r.popover!=null&&(Q(`beforetoggle`,t),Q(`toggle`,t)),r.onScroll!=null&&Q(`scroll`,t),r.onScrollEnd!=null&&Q(`scrollend`,t),r.onClick!=null&&(t.onclick=En),t=!0):t=!1,t||ma(e,!0)}function ga(e){for(ua=e.return;ua;)switch(ua.tag){case 5:case 31:case 13:fa=!1;return;case 27:case 3:fa=!0;return;default:ua=ua.return}}function _a(e){if(e!==ua)return!1;if(!P)return ga(e),P=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=n===`form`||n===`button`||pp(e.type,e.memoizedProps)),n=!n),n&&N&&ma(e),ga(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(o(317));N=dm(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(o(317));N=dm(e)}else t===27?(t=N,Sp(e.type)?(e=um,um=null,N=e):N=t):N=ua?lm(e.stateNode.nextSibling):null;return!0}function va(){N=ua=null,P=!1}function ya(){var e=da;return e!==null&&(hd===null?hd=e:hd.push.apply(hd,e),da=null),e}function ba(e){da===null?da=[e]:da.push(e)}var xa=Ee(null),Sa=null,Ca=null;function wa(e,t,n){k(xa,t._currentValue),t._currentValue=n}function Ta(e){e._currentValue=xa.current,De(xa)}function Ea(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function Da(e,t,n,r){var i=e.child;for(i!==null&&(i.return=e);i!==null;){var a=i.dependencies;if(a!==null){var s=i.child;a=a.firstContext;a:for(;a!==null;){var c=a;a=i;for(var l=0;l<t.length;l++)if(c.context===t[l]){a.lanes|=n,c=a.alternate,c!==null&&(c.lanes|=n),Ea(a.return,n,e),r||(s=null);break a}a=c.next}}else if(i.tag===18){if(s=i.return,s===null)throw Error(o(341));s.lanes|=n,a=s.alternate,a!==null&&(a.lanes|=n),Ea(s,n,e),s=null}else i.tag===13&&i.memoizedState!==null&&i.memoizedState.dehydrated===null?(i.lanes|=n,s=i.alternate,s!==null&&(s.lanes|=n),Ea(i.return,n,e),s=i.child,s=s===null?null:s.sibling):s=i.child;if(s!==null)s.return=i;else for(s=i;s!==null;){if(s===e){s=null;break}if(i=s.sibling,i!==null){i.return=s.return,s=i;break}s=s.return}i=s}}function Oa(e,t,n,r){e=null;for(var i=t,a=!1;i!==null;){if(!a){if(i.flags&524288)a=!0;else if(i.flags&262144)break}if(i.tag===10){var s=i.alternate;if(s===null)throw Error(o(387));if(s=s.memoizedProps,s!==null){var c=i.type;qr(i.pendingProps.value,s.value)||(e===null?e=[c]:e.push(c))}}else if(i===je.current){if(s=i.alternate,s===null)throw Error(o(387));s.memoizedState.memoizedState!==i.memoizedState.memoizedState&&(e===null?e=[sh]:e.push(sh))}i=i.return}return e!==null&&Da(t,e,n,r),t.flags|=262144,e!==null}function ka(e){for(e=e.firstContext;e!==null;){if(!qr(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Aa(e){Sa=e,Ca=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function ja(e){return Na(Sa,e)}function Ma(e,t){return Sa===null&&Aa(e),Na(e,t)}function Na(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Ca===null){if(e===null)throw Error(o(308));Ca=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Ca=Ca.next=t;return n}var Pa=typeof AbortController<`u`?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(t,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(e){return e()})}},Fa=t.unstable_scheduleCallback,Ia=t.unstable_NormalPriority,La={$$typeof:se,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Ra(){return{controller:new Pa,data:new Map,refCount:0}}function za(e){e.refCount--,e.refCount===0&&Fa(Ia,function(){e.controller.abort()})}function Ba(e,t){if(e.pendingLanes&4194048){var n=e.transitionTypes;for(n===null&&(n=e.transitionTypes=[]),e=0;e<t.length;e++){var r=t[e];n.indexOf(r)===-1&&n.push(r)}}}var Va=null;function Ha(e){var t=e.transitionTypes;return e.transitionTypes=null,t}var Ua=null,Wa=0,Ga=0,Ka=null;function qa(e,t){if(Ua===null){var n=Ua=[];Wa=0,Ga=Pf(),Ka={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return Wa++,t.then(Ja,Ja),t}function Ja(){if(--Wa===0&&(Va=null,Ua!==null)){Ka!==null&&(Ka.status=`fulfilled`);var e=Ua;Ua=null,Ga=0,Ka=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function Ya(e,t){var n=[],r={status:`pending`,value:null,reason:null,then:function(e){n.push(e)}};return e.then(function(){r.status=`fulfilled`,r.value=t;for(var e=0;e<n.length;e++)(0,n[e])(t)},function(e){for(r.status=`rejected`,r.reason=e,e=0;e<n.length;e++)(0,n[e])(void 0)}),r}var Xa=D.S;D.S=function(e,t){if(vd=Je(),typeof t==`object`&&t&&typeof t.then==`function`&&qa(e,t),Va!==null)for(var n=bf;n!==null;)Ba(n,Va),n=n.next;if(n=e.types,n!==null){for(var r=bf;r!==null;)Ba(r,n),r=r.next;if(Ga!==0){r=Va,r===null&&(r=Va=[]);for(var i=0;i<n.length;i++){var a=n[i];r.indexOf(a)===-1&&r.push(a)}}}Xa!==null&&Xa(e,t)};var Za=Ee(null);function Qa(){var e=Za.current;return e===null?U.pooledCache:e}function $a(e,t){t===null?k(Za,Za.current):k(Za,t.pool)}function eo(){var e=Qa();return e===null?null:{parent:La._currentValue,pool:e}}var to=Error(o(460)),no=Error(o(474)),ro=Error(o(542)),io={then:function(){}};function ao(e){return e=e.status,e===`fulfilled`||e===`rejected`}function oo(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(En,En),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,uo(e),e===void 0&&!(`reason`in t)?Error(o(600)):e;default:if(typeof t.status==`string`)t.then(En,En);else{if(e=U,e!==null&&100<e.shellSuspendCounter)throw Error(o(482));e=t,e.status=`pending`,e.then(function(e){if(t.status===`pending`){var n=t;n.status=`fulfilled`,n.value=e}},function(e){if(t.status===`pending`){var n=t;n.status=`rejected`,n.reason=e}})}switch(t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,uo(e),e}throw co=t,to}}function so(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(co=e,to):e}}var co=null;function lo(){if(co===null)throw Error(o(459));var e=co;return co=null,e}function uo(e){if(e===to||e===ro)throw Error(o(483))}var fo=null,po=0;function mo(e){var t=po;return po+=1,fo===null&&(fo=[]),oo(fo,e,t)}function ho(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function go(e,t){throw t.$$typeof===te?Error(o(525)):(e=Object.prototype.toString.call(t),Error(o(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e)))}function _o(e){function t(t,n){if(e){var r=t.deletions;r===null?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;r!==null;)t(n,r),r=r.sibling;return null}function r(e){for(var t=new Map;e!==null;)e.key===null?t.set(e.index,e):t.set(e.key,e),e=e.sibling;return t}function i(e,t){return e=Vi(e,t),e.index=0,e.sibling=null,e}function a(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=134217730,n):(r=r.index,r<n?(t.flags|=2,n):r)):(t.flags|=1048576,n)}function s(t){return e&&t.alternate===null&&(t.flags|=134217730),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=Gi(n,e.mode,r),t.return=e,t):(t=i(t,n),t.return=e,t)}function l(e,t,n,r){var a=n.type;return a===ie?(e=d(e,t,n.props.children,r,n.key),ho(e,n),e):t!==null&&(t.elementType===a||typeof a==`object`&&a&&a.$$typeof===fe&&so(a)===t.type)?(t=i(t,n.props),ho(t,n),t.return=e,t):(t=Ui(n.type,n.key,n.props,null,e.mode,r),ho(t,n),t.return=e,t)}function u(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=qi(n,e.mode,r),t.return=e,t):(t=i(t,n.children||[]),t.return=e,t)}function d(e,t,n,r,a){return t===null||t.tag!==7?(t=Wi(n,e.mode,r,a),t.return=e,t):(t=i(t,n),t.return=e,t)}function f(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`||typeof t==`bigint`)return t=Gi(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case ne:return n=Ui(t.type,t.key,t.props,null,e.mode,n),ho(n,t),n.return=e,n;case re:return t=qi(t,e.mode,n),t.return=e,t;case fe:return t=so(t),f(e,t,n)}if(Se(t)||ye(t))return t=Wi(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,mo(t),n);if(t.$$typeof===se)return f(e,Ma(e,t),n);go(e,t)}return null}function p(e,t,n,r){var i=t===null?null:t.key;if(typeof n==`string`&&n!==``||typeof n==`number`||typeof n==`bigint`)return i===null?c(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case ne:return n.key===i?l(e,t,n,r):null;case re:return n.key===i?u(e,t,n,r):null;case fe:return n=so(n),p(e,t,n,r)}if(Se(n)||ye(n))return i===null?d(e,t,n,r,null):null;if(typeof n.then==`function`)return p(e,t,mo(n),r);if(n.$$typeof===se)return p(e,t,Ma(e,n),r);go(e,n)}return null}function m(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`||typeof r==`bigint`)return e=e.get(n)||null,c(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case ne:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case re:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case fe:return r=so(r),m(e,t,n,r,i)}if(Se(r)||ye(r))return e=e.get(n)||null,d(t,e,r,i,null);if(typeof r.then==`function`)return m(e,t,n,mo(r),i);if(r.$$typeof===se)return m(e,t,n,Ma(t,r),i);go(t,r)}return null}function h(i,o,s,c){for(var l=null,u=null,d=o,h=o=0,g=null;d!==null&&h<s.length;h++){d.index>h?(g=d,d=null):g=d.sibling;var _=p(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),o=a(_,o,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),P&&aa(i,h),l;if(d===null){for(;h<s.length;h++)d=f(i,s[h],c),d!==null&&(o=a(d,o,h),u===null?l=d:u.sibling=d,u=d);return P&&aa(i,h),l}for(d=r(d);h<s.length;h++)g=m(d,i,h,s[h],c),g!==null&&(e&&(_=g.alternate,_!==null&&d.delete(_.key===null?h:_.key)),o=a(g,o,h),u===null?l=g:u.sibling=g,u=g);return e&&d.forEach(function(e){return t(i,e)}),P&&aa(i,h),l}function g(i,s,c,l){if(c==null)throw Error(o(151));for(var u=null,d=null,h=s,g=s=0,_=null,v=c.next();h!==null&&!v.done;g++,v=c.next()){h.index>g?(_=h,h=null):_=h.sibling;var y=p(i,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(i,h),s=a(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(i,h),P&&aa(i,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(i,v.value,l),v!==null&&(s=a(v,s,g),d===null?u=v:d.sibling=v,d=v);return P&&aa(i,g),u}for(h=r(h);!v.done;g++,v=c.next())v=m(h,i,g,v.value,l),v!==null&&(e&&(_=v.alternate,_!==null&&h.delete(_.key===null?g:_.key)),s=a(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(i,e)}),P&&aa(i,g),u}function _(e,r,a,c){if(typeof a==`object`&&a&&a.type===ie&&a.key===null&&a.props.ref===void 0&&(a=a.props.children),typeof a==`object`&&a){switch(a.$$typeof){case ne:a:{for(var l=a.key;r!==null;){if(r.key===l){if(l=a.type,l===ie){if(r.tag===7){n(e,r.sibling),c=i(r,a.props.children),ho(c,a),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===fe&&so(l)===r.type){n(e,r.sibling),c=i(r,a.props),ho(c,a),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}a.type===ie?(c=Wi(a.props.children,e.mode,c,a.key),ho(c,a),c.return=e,e=c):(c=Ui(a.type,a.key,a.props,null,e.mode,c),ho(c,a),c.return=e,e=c)}return s(e);case re:a:{for(l=a.key;r!==null;){if(r.key===l){if(r.tag===4&&r.stateNode.containerInfo===a.containerInfo&&r.stateNode.implementation===a.implementation){n(e,r.sibling),c=i(r,a.children||[]),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}c=qi(a,e.mode,c),c.return=e,e=c}return s(e);case fe:return a=so(a),_(e,r,a,c)}if(Se(a))return h(e,r,a,c);if(ye(a)){if(l=ye(a),typeof l!=`function`)throw Error(o(150));return a=l.call(a),g(e,r,a,c)}if(typeof a.then==`function`)return _(e,r,mo(a),c);if(a.$$typeof===se)return _(e,r,Ma(e,a),c);go(e,a)}return typeof a==`string`&&a!==``||typeof a==`number`||typeof a==`bigint`?(a=``+a,r!==null&&r.tag===6?(n(e,r.sibling),c=i(r,a),c.return=e,e=c):(n(e,r),c=Gi(a,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{po=0;var i=_(e,t,n,r);return fo=null,i}catch(t){if(t===to||t===ro)throw t;var a=zi(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var vo=_o(!0),yo=_o(!1),bo=!1;function xo(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function So(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Co(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function wo(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,H&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=Ii(e),Fi(e,null,n),t}return ji(e,r,t,n),Ii(e)}function To(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ct(e,n)}}function Eo(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n}else e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Do=!1;function Oo(){if(Do){var e=Ka;if(e!==null)throw e}}function ko(e,t,n,r){Do=!1;var i=e.updateQueue;bo=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane&-536870913,p=f!==s.lane;if(p?(G&f)===f:(r&f)===f){f!==0&&f===Ga&&(Do=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var m=e,h=s;f=t;var g=n;switch(h.tag){case 1:if(m=h.payload,typeof m==`function`){d=m.call(g,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=h.payload,f=typeof m==`function`?m.call(g,d,f):m,f==null)break a;d=T({},d,f);break a;case 2:bo=!0}}f=s.callback,f!==null&&(e.flags|=64,p&&(e.flags|=8192),p=i.callbacks,p===null?i.callbacks=[f]:p.push(f))}else p={lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;p=s,s=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),ld|=o,e.lanes=o,e.memoizedState=d}}function Ao(e,t){if(typeof e!=`function`)throw Error(o(191,e));e.call(t)}function jo(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)Ao(n[e],t)}var Mo=Ee(null),No=Ee(0);function Po(e,t){e=cd,k(No,e),k(Mo,t),cd=e|t.baseLanes}function Fo(){k(No,cd),k(Mo,Mo.current)}function Io(){cd=No.current,De(Mo),De(No)}var Lo=Ee(null),Ro=null;function zo(e){var t=e.alternate;k(F,F.current&1),k(Lo,e),Ro===null&&(t===null||Mo.current!==null||t.memoizedState!==null)&&(Ro=e)}function Bo(e){k(F,F.current),k(Lo,e),Ro===null&&(Ro=e)}function Vo(e){e.tag===22?(k(F,F.current),k(Lo,e),Ro===null&&(Ro=e)):Ho()}function Ho(){k(F,F.current),k(Lo,Lo.current)}function Uo(e){De(Lo),Ro===e&&(Ro=null),De(F)}var F=Ee(0);function Wo(e,t){k(Lo,Lo.current),k(F,t)}function Go(e){De(F),De(Lo),Ro===e&&(Ro=null)}function Ko(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||om(n)||sm(n)))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==`independent`){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var qo=0,I=null,L=null,Jo=null,Yo=!1,Xo=!1,Zo=!1,Qo=0,$o=0,es=null,ts=0;function ns(){throw Error(o(321))}function rs(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!qr(e[n],t[n]))return!1;return!0}function is(e,t,n,r,i,a){return qo=a,I=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,D.H=e===null||e.memoizedState===null?xc:Sc,Zo=!1,a=n(r,i),Zo=!1,Xo&&(a=os(t,n,r,i)),as(e),a}function as(e){D.H=bc;var t=L!==null&&L.next!==null;if(qo=0,Jo=L=I=null,Yo=!1,$o=0,es=null,t)throw Error(o(300));e===null||zc||(e=e.dependencies,e!==null&&ka(e)&&(zc=!0))}function os(e,t,n,r){I=e;var i=0;do{if(Xo&&(es=null),$o=0,Xo=!1,25<=i)throw Error(o(301));if(i+=1,Jo=L=null,e.updateQueue!=null){var a=e.updateQueue;a.lastEffect=null,a.events=null,a.stores=null,a.memoCache!=null&&(a.memoCache.index=0)}D.H=Cc,a=t(n,r)}while(Xo);return a}function ss(){var e=D.H,t=e.useState()[0];return t=typeof t.then==`function`?ms(t):t,e=e.useState()[0],(L===null?null:L.memoizedState)!==e&&(I.flags|=1024),t}function cs(){var e=Qo!==0;return Qo=0,e}function ls(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function us(e){if(Yo){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Yo=!1}qo=0,Jo=L=I=null,Xo=!1,$o=Qo=0,es=null}function ds(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Jo===null?I.memoizedState=Jo=e:Jo=Jo.next=e,Jo}function fs(){if(L===null){var e=I.alternate;e=e===null?null:e.memoizedState}else e=L.next;var t=Jo===null?I.memoizedState:Jo.next;if(t!==null)Jo=t,L=e;else{if(e===null)throw I.alternate===null?Error(o(467)):Error(o(310));L=e,e={memoizedState:L.memoizedState,baseState:L.baseState,baseQueue:L.baseQueue,queue:L.queue,next:null},Jo===null?I.memoizedState=Jo=e:Jo=Jo.next=e}return Jo}function ps(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ms(e){var t=$o;return $o+=1,es===null&&(es=[]),e=oo(es,e,t),t=I,(Jo===null?t.memoizedState:Jo.next)===null&&(t=t.alternate,D.H=t===null||t.memoizedState===null?xc:Sc),e}function hs(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return ms(e);if(e.$$typeof===_e)return;if(e.$$typeof===se)return ja(e)}throw Error(o(438,String(e)))}function gs(e){var t=null,n=I.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=I.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(e){return e.slice()}),index:0})))}if(t??={data:[],index:0},n===null&&(n=ps(),I.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),r=0;r<e;r++)n[r]=he;return t.index++,n}function _s(e,t){return typeof t==`function`?t(e):t}function vs(e){return ys(fs(),L,e)}function ys(e,t,n){var r=e.queue;if(r===null)throw Error(o(311));r.lastRenderedReducer=n;var i=e.baseQueue,a=r.pending;if(a!==null){if(i!==null){var s=i.next;i.next=a.next,a.next=s}t.baseQueue=i=a,r.pending=null}if(a=e.baseState,i===null)e.memoizedState=a;else{t=i.next;var c=s=null,l=null,u=t,d=!1;do{var f=u.lane&-536870913;if(f===u.lane?(qo&f)===f:(G&f)===f){var p=u.revertLane;if(p===0)l!==null&&(l=l.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),f===Ga&&(d=!0);else if((qo&p)===p){u=u.next,p===Ga&&(d=!0);continue}else f={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=f,s=a):l=l.next=f,I.lanes|=p,ld|=p;f=u.action,Zo&&n(a,f),a=u.hasEagerState?u.eagerState:n(a,f)}else p={lane:f,revertLane:u.revertLane,gesture:u.gesture,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=p,s=a):l=l.next=p,I.lanes|=f,ld|=f;u=u.next}while(u!==null&&u!==t);if(l===null?s=a:l.next=c,!qr(a,e.memoizedState)&&(zc=!0,d&&(n=Ka,n!==null)))throw n;e.memoizedState=a,e.baseState=s,e.baseQueue=l,r.lastRenderedState=a}return i===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function bs(e){var t=fs(),n=t.queue;if(n===null)throw Error(o(311));n.lastRenderedReducer=e;var r=n.dispatch,i=n.pending,a=t.memoizedState;if(i!==null){n.pending=null;var s=i=i.next;do a=e(a,s.action),s=s.next;while(s!==i);qr(a,t.memoizedState)||(zc=!0),t.memoizedState=a,t.baseQueue===null&&(t.baseState=a),n.lastRenderedState=a}return[a,r]}function xs(e,t,n){var r=I,i=fs(),a=P;if(a){if(n===void 0)throw Error(o(407));n=n()}else n=t();var s=!qr((L||i).memoizedState,n);if(s&&(i.memoizedState=n,zc=!0),i=i.queue,Ks(ws.bind(null,r,i,e),[e]),e=i.getSnapshot!==t||s||Jo!==null&&!!(Jo.memoizedState.tag&1),Vs(e?9:8,{destroy:void 0},Cs.bind(null,r,i,n,t),null),e){if(r.flags|=2048,U===null)throw Error(o(349));a||qo&127||Ss(r,t,n)}return n}function Ss(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=I.updateQueue,t===null?(t=ps(),I.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Cs(e,t,n,r){t.value=n,t.getSnapshot=r,Ts(t)&&Es(e)}function ws(e,t,n){return n(function(){Ts(t)&&Es(e)})}function Ts(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!qr(e,n)}catch{return!0}}function Es(e){var t=Pi(e,2);t!==null&&Pd(t,e,2)}function Ds(e){var t=ds();if(typeof e==`function`){var n=e;if(e=n(),Zo){at(!0);try{n()}finally{at(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:_s,lastRenderedState:e},t}function Os(e,t,n,r){return e.baseState=n,ys(e,L,typeof r==`function`?r:_s)}function ks(e,t,n,r,i){if(_c(e))throw Error(o(485));if(e=t.action,e!==null){var a={payload:i,action:e,next:null,isTransition:!0,status:`pending`,value:null,reason:null,listeners:[],then:function(e){a.listeners.push(e)}};D.T===null?a.isTransition=!1:n(!0),r(a),n=t.pending,n===null?(a.next=t.pending=a,As(t,a)):(a.next=n.next,t.pending=n.next=a)}}function As(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var a=D.T,o={};o.types=a===null?null:a.types,D.T=o;try{var s=n(i,r),c=D.S;c!==null&&c(o,s),js(e,t,s)}catch(n){Ns(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),D.T=a}}else try{a=n(i,r),js(e,t,a)}catch(n){Ns(e,t,n)}}function js(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){Ms(e,t,n)},function(n){return Ns(e,t,n)}):Ms(e,t,n)}function Ms(e,t,n){t.status=`fulfilled`,t.value=n,Ps(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,As(e,n)))}function Ns(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,Ps(t),t=t.next;while(t!==r)}e.action=null}function Ps(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Fs(e,t){return t}function Is(e,t){if(P){var n=U.formState;if(n!==null){a:{var r=I;if(P){if(N){b:{for(var i=N,a=fa;i.nodeType!==8;)if(!a||(i=lm(i.nextSibling),i===null)){i=null;break b}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){N=lm(i.nextSibling),r=i.data===`F!`;break a}}ma(r)}r=!1}r&&(t=n[0])}}return n=ds(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Fs,lastRenderedState:t},n.queue=r,n=mc.bind(null,I,r),r.dispatch=n,r=Ds(!1),a=gc.bind(null,I,!1,r.queue),r=ds(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=ks.bind(null,I,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function Ls(e){return Rs(fs(),L,e)}function Rs(e,t,n){if(t=ys(e,t,Fs)[0],e=vs(_s)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=ms(t)}catch(e){throw e===to?ro:e}else r=t;t=fs();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(I.flags|=2048,Vs(9,{destroy:void 0},zs.bind(null,i,n),null)),[r,a,e]}function zs(e,t){e.action=t}function Bs(e){var t=fs(),n=L;if(n!==null)return Rs(t,n,e);fs(),t=t.memoizedState,n=fs();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function Vs(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=I.updateQueue,t===null&&(t=ps(),I.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function Hs(){return fs().memoizedState}function Us(e,t,n,r){var i=ds();I.flags|=e,i.memoizedState=Vs(1|t,{destroy:void 0},n,r===void 0?null:r)}function Ws(e,t,n,r){var i=fs();r=r===void 0?null:r;var a=i.memoizedState.inst;L!==null&&r!==null&&rs(r,L.memoizedState.deps)?i.memoizedState=Vs(t,a,n,r):(I.flags|=e,i.memoizedState=Vs(1|t,a,n,r))}function Gs(e,t){Us(8390656,8,e,t)}function Ks(e,t){Ws(2048,8,e,t)}function qs(e){I.flags|=4;var t=I.updateQueue;if(t===null)t=ps(),I.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function Js(e){var t=fs().memoizedState;return qs({ref:t,nextImpl:e}),function(){if(H&2)throw Error(o(440));return t.impl.apply(void 0,arguments)}}function Ys(e,t){return Ws(4,2,e,t)}function Xs(e,t){return Ws(4,4,e,t)}function Zs(e,t){if(typeof t==`function`){e=e();var n=t(e);return function(){typeof n==`function`?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Qs(e,t,n){n=n==null?null:n.concat([e]),Ws(4,4,Zs.bind(null,t,e),n)}function $s(){}function ec(e,t){var n=fs();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&rs(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function tc(e,t){var n=fs();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&rs(t,r[1]))return r[0];if(r=e(),Zo){at(!0);try{e()}finally{at(!1)}}return n.memoizedState=[r,t],r}function nc(e,t,n){return n===void 0||qo&1073741824&&!(G&261930)?e.memoizedState=t:(e.memoizedState=n,e=Md(),I.lanes|=e,ld|=e,n)}function rc(e,t,n,r){return qr(n,t)?n:Mo.current===null?!(qo&106)||qo&1073741824&&!(G&261930)?(zc=!0,e.memoizedState=n):(e=Md(),I.lanes|=e,ld|=e,t):(e=nc(e,n,r),qr(e,t)||(zc=!0),e)}function ic(e,t,n,r,i){var a=O.p;O.p=a!==0&&8>a?a:8;var o=D.T,s={};s.types=o===null?null:o.types,D.T=s,gc(e,!1,t,n);try{var c=i(),l=D.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?hc(e,t,Ya(c,r),X(e)):hc(e,t,r,X(e))}catch(n){hc(e,t,{then:function(){},status:`rejected`,reason:n},X())}finally{O.p=a,o!==null&&s.types!==null&&(o.types=s.types),D.T=o}}function ac(){}function oc(e,t,n,r){if(e.tag!==5)throw Error(o(476));var i=sc(e).queue;ic(e,i,t,Ce,n===null?ac:function(){return cc(e),n(r)})}function sc(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:Ce,baseState:Ce,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:_s,lastRenderedState:Ce},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:_s,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function cc(e){var t=sc(e);t.next===null&&(t=e.alternate.memoizedState),hc(e,t.next.queue,{},X())}function lc(){return ja(sh)}function uc(){return fs().memoizedState}function dc(){return fs().memoizedState}function fc(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=X();e=Co(n);var r=wo(t,e,n);r!==null&&(Pd(r,t,n),To(r,t,n)),t={cache:Ra()},e.payload=t;return}t=t.return}}function pc(e,t,n){var r=X();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},_c(e)?vc(t,n):(n=Ni(e,t,n,r),n!==null&&(Pd(n,e,r),yc(n,t,r)))}function mc(e,t,n){hc(e,t,n,X())}function hc(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(_c(e))vc(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,qr(s,o))return ji(e,t,i,0),U===null&&Ai(),!1}catch{}if(n=Ni(e,t,i,r),n!==null)return Pd(n,e,r),yc(n,t,r),!0}return!1}function gc(e,t,n,r){if(r={lane:2,revertLane:Pf(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},_c(e)){if(t)throw Error(o(479))}else t=Ni(e,n,r,2),t!==null&&Pd(t,e,2)}function _c(e){var t=e.alternate;return e===I||t!==null&&t===I}function vc(e,t){Xo=Yo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function yc(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ct(e,n)}}var bc={readContext:ja,use:hs,useCallback:ns,useContext:ns,useEffect:ns,useImperativeHandle:ns,useLayoutEffect:ns,useInsertionEffect:ns,useMemo:ns,useReducer:ns,useRef:ns,useState:ns,useDebugValue:ns,useDeferredValue:ns,useTransition:ns,useSyncExternalStore:ns,useId:ns,useHostTransitionStatus:ns,useFormState:ns,useActionState:ns,useOptimistic:ns,useMemoCache:ns,useCacheRefresh:ns,useEffectEvent:ns},xc={readContext:ja,use:hs,useCallback:function(e,t){return ds().memoizedState=[e,t===void 0?null:t],e},useContext:ja,useEffect:Gs,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),Us(4194308,4,Zs.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Us(4194308,4,e,t)},useInsertionEffect:function(e,t){Us(4,2,e,t)},useMemo:function(e,t){var n=ds();t=t===void 0?null:t;var r=e();if(Zo){at(!0);try{e()}finally{at(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=ds();if(n!==void 0){var i=n(t);if(Zo){at(!0);try{n(t)}finally{at(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=pc.bind(null,I,e),[r.memoizedState,e]},useRef:function(e){var t=ds();return e={current:e},t.memoizedState=e},useState:function(e){e=Ds(e);var t=e.queue,n=mc.bind(null,I,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:$s,useDeferredValue:function(e,t){return nc(ds(),e,t)},useTransition:function(){var e=Ds(!1);return e=ic.bind(null,I,e.queue,!0,!1),ds().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=I,i=ds();if(P){if(n===void 0)throw Error(o(407));n=n()}else{if(n=t(),U===null)throw Error(o(349));G&127||Ss(r,t,n)}i.memoizedState=n;var a={value:n,getSnapshot:t};return i.queue=a,Gs(ws.bind(null,r,a,e),[e]),r.flags|=2048,Vs(9,{destroy:void 0},Cs.bind(null,r,a,n,t),null),n},useId:function(){var e=ds(),t=U.identifierPrefix;if(P){var n=ia,r=ra;n=(r&~(1<<32-ot(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=Qo++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=ts++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:lc,useFormState:Is,useActionState:Is,useOptimistic:function(e){var t=ds();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=gc.bind(null,I,!0,n),n.dispatch=t,[e,t]},useMemoCache:gs,useCacheRefresh:function(){return ds().memoizedState=fc.bind(null,I)},useEffectEvent:function(e){var t=ds(),n={impl:e};return t.memoizedState=n,function(){if(H&2)throw Error(o(440));return n.impl.apply(void 0,arguments)}}},Sc={readContext:ja,use:hs,useCallback:ec,useContext:ja,useEffect:Ks,useImperativeHandle:Qs,useInsertionEffect:Ys,useLayoutEffect:Xs,useMemo:tc,useReducer:vs,useRef:Hs,useState:function(){return vs(_s)},useDebugValue:$s,useDeferredValue:function(e,t){return rc(fs(),L.memoizedState,e,t)},useTransition:function(){var e=vs(_s)[0],t=fs().memoizedState;return[typeof e==`boolean`?e:ms(e),t]},useSyncExternalStore:xs,useId:uc,useHostTransitionStatus:lc,useFormState:Ls,useActionState:Ls,useOptimistic:function(e,t){return Os(fs(),L,e,t)},useMemoCache:gs,useCacheRefresh:dc,useEffectEvent:Js},Cc={readContext:ja,use:hs,useCallback:ec,useContext:ja,useEffect:Ks,useImperativeHandle:Qs,useInsertionEffect:Ys,useLayoutEffect:Xs,useMemo:tc,useReducer:bs,useRef:Hs,useState:function(){return bs(_s)},useDebugValue:$s,useDeferredValue:function(e,t){var n=fs();return L===null?nc(n,e,t):rc(n,L.memoizedState,e,t)},useTransition:function(){var e=bs(_s)[0],t=fs().memoizedState;return[typeof e==`boolean`?e:ms(e),t]},useSyncExternalStore:xs,useId:uc,useHostTransitionStatus:lc,useFormState:Bs,useActionState:Bs,useOptimistic:function(e,t){var n=fs();return L===null?(n.baseState=e,[e,n.queue.dispatch]):Os(n,L,e,t)},useMemoCache:gs,useCacheRefresh:dc,useEffectEvent:Js};function wc(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:T({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Tc={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=X(),i=Co(r);i.payload=t,n!=null&&(i.callback=n),t=wo(e,i,r),t!==null&&(Pd(t,e,r),To(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=X(),i=Co(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=wo(e,i,r),t!==null&&(Pd(t,e,r),To(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=X(),r=Co(n);r.tag=2,t!=null&&(r.callback=t),t=wo(e,r,n),t!==null&&(Pd(t,e,n),To(t,e,n))}};function Ec(e,t,n,r,i,a,o){return e=e.stateNode,typeof e.shouldComponentUpdate==`function`?e.shouldComponentUpdate(r,a,o):t.prototype&&t.prototype.isPureReactComponent?!Jr(n,r)||!Jr(i,a):!0}function Dc(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps==`function`&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps==`function`&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&Tc.enqueueReplaceState(t,t.state,null)}function Oc(e,t){var n=t;if(`ref`in t)for(var r in n={},t)r!==`ref`&&(n[r]=t[r]);if(e=e.defaultProps)for(var i in n===t&&(n=T({},n)),e)n[i]===void 0&&(n[i]=e[i]);return n}function kc(e){Ei(e)}function Ac(e){console.error(e)}function jc(e){Ei(e)}function Mc(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function Nc(e,t,n){try{var r=e.onCaughtError;r(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(e){setTimeout(function(){throw e})}}function Pc(e,t,n){return n=Co(n),n.tag=3,n.payload={element:null},n.callback=function(){Mc(e,t)},n}function Fc(e){return e=Co(e),e.tag=3,e}function Ic(e,t,n,r){var i=n.type.getDerivedStateFromError;if(typeof i==`function`){var a=r.value;e.payload=function(){return i(a)},e.callback=function(){Nc(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){Nc(t,n,r),typeof i!=`function`&&(xd===null?xd=new Set([this]):xd.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function Lc(e,t,n,r,i){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&Oa(t,n,i,!0),n=Lo.current,n!==null){switch(n.tag){case 31:case 13:case 19:return Ro===null?Kd():n.alternate===null&&q===0&&(q=3),n.flags&=-257,n.flags|=65536,n.lanes=i,r===io?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),mf(e,r,i)),!1;case 22:return n.flags|=65536,r===io?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([r]):n.add(r)),mf(e,r,i)),!1}throw Error(o(435,n.tag))}return mf(e,r,i),Kd(),!1}if(P)return t=Lo.current,t===null?(r!==pa&&(t=Error(o(423),{cause:r}),ba(Yi(t,n))),e=e.current.alternate,e.flags|=65536,i&=-i,e.lanes|=i,r=Yi(r,n),i=Pc(e.stateNode,r,i),Eo(e,i),q!==4&&(q=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=i,r!==pa&&(e=Error(o(422),{cause:r}),ba(Yi(e,n)))),!1;var a=Error(o(520),{cause:r});if(a=Yi(a,n),md===null?md=[a]:md.push(a),q!==4&&(q=2),t===null)return!0;r=Yi(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=i&-i,n.lanes|=e,e=Pc(n.stateNode,r,e),Eo(n,e),!1;case 1:if(t=n.type,a=n.stateNode,!(n.flags&128)&&(typeof t.getDerivedStateFromError==`function`||a!==null&&typeof a.componentDidCatch==`function`&&(xd===null||!xd.has(a))))return n.flags|=65536,i&=-i,n.lanes|=i,i=Fc(i),Ic(i,e,n,r),Eo(n,i),!1;break;case 22:if(n.memoizedState!==null)return n.flags|=65536,!1}n=n.return}while(n!==null);return!1}var Rc=Error(o(461)),zc=!1;function Bc(e,t,n,r){t.child=e===null?yo(t,null,n,r):vo(t,e.child,n,r)}function Vc(e,t,n,r,i){n=n.render;var a=t.ref;if(`ref`in r){var o={};for(var s in r)s!==`ref`&&(o[s]=r[s])}else o=r;return Aa(t),r=is(e,t,n,o,a,i),s=cs(),e!==null&&!zc?(ls(e,t,i),hl(e,t,i)):(P&&s&&sa(t),t.flags|=1,Bc(e,t,r,i),t.child)}function Hc(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!Bi(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,Uc(e,t,a,r,i)):(e=Ui(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!gl(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?Jr:n,n(o,r)&&e.ref===t.ref)return hl(e,t,i)}return t.flags|=1,e=Vi(a,r),e.ref=t.ref,e.return=t,t.child=e}function Uc(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(Jr(a,r)&&e.ref===t.ref){if(zc=!1,t.pendingProps=r=a,gl(e,i))e.flags&131072&&(zc=!0);else return t.lanes=e.lanes,hl(e,t,i)}}return Zc(e,t,n,r,i)}function Wc(e,t,n,r){var i=r.children,a=e===null?null:e.memoizedState;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode===`hidden`){if(t.flags&128){if(a=a===null?n:a.baseLanes|n,e!==null){for(r=t.child=e.child,i=0;r!==null;)i=i|r.lanes|r.childLanes,r=r.sibling;r=i&~a}else r=0,t.child=null;return Kc(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&$a(t,a===null?null:a.cachePool),a===null?Fo():Po(t,a),Vo(t);else return r=t.lanes=536870912,Kc(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&$a(t,null),Fo(),Ho()):($a(t,a.cachePool),Po(t,a),Ho(),t.memoizedState=null);return Bc(e,t,i,n),t.child}function Gc(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Kc(e,t,n,r,i){var a=Qa();return a=a===null?null:{parent:La._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&$a(t,null),Fo(),Vo(t),e!==null&&Oa(e,t,r,!0),t.childLanes=i,null}function qc(e,t){return t=ol({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Jc(e,t,n){return vo(t,e.child,null,n),e=qc(t,t.pendingProps),e.flags|=2,Uo(t),t.memoizedState=null,e}function Yc(e,t,n){var r=t.pendingProps,i=!!(t.flags&128);if(t.flags&=-129,e===null){if(P){if(r.mode===`hidden`)return e=qc(t,r),t.lanes=536870912,e.memoizedState={baseLanes:0,cachePool:null},Gc(null,e);if(Bo(t),(e=N)?(e=am(e,fa),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:na===null?null:{id:ra,overflow:ia},retryLane:536870912,hydrationErrors:null},n=Ki(e),n.return=t,t.child=n,ua=t,N=null)):e=null,e===null)throw ma(t);return t.lanes=536870912,null}return qc(t,r)}var a=e.memoizedState;if(a!==null){var s=a.dehydrated;if(Bo(t),i){if(t.flags&256)t.flags&=-257,t=Jc(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(o(558))}else if(zc||Oa(e,t,n,!1),i=(n&e.childLanes)!==0,zc||i){if(Mo.current===null){if(r=U,r!==null&&(s=wt(r,n),s!==0&&s!==a.retryLane))throw a.retryLane=s,Pi(e,s),Pd(r,e,s),Rc;Kd()}t=Jc(e,t,n)}else e=a.treeContext,N=lm(s.nextSibling),ua=t,P=!0,da=null,fa=!1,e!==null&&la(t,e),t=qc(t,r),t.flags|=134221824;return t}return e=Vi(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Xc(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!=`function`&&typeof n!=`object`)throw Error(o(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function Zc(e,t,n,r,i){return Aa(t),n=is(e,t,n,r,void 0,i),r=cs(),e!==null&&!zc?(ls(e,t,i),hl(e,t,i)):(P&&r&&sa(t),t.flags|=1,Bc(e,t,n,i),t.child)}function Qc(e,t,n,r,i,a){return Aa(t),t.updateQueue=null,n=os(t,r,n,i),as(e),r=cs(),e!==null&&!zc?(ls(e,t,a),hl(e,t,a)):(P&&r&&sa(t),t.flags|=1,Bc(e,t,n,a),t.child)}function $c(e,t,n,r,i){if(Aa(t),t.stateNode===null){var a=Li,o=n.contextType;typeof o==`object`&&o&&(a=ja(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=Tc,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},xo(t),o=n.contextType,a.context=typeof o==`object`&&o?ja(o):Li,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(wc(t,n,o,r),a.state=t.memoizedState),typeof n.getDerivedStateFromProps==`function`||typeof a.getSnapshotBeforeUpdate==`function`||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(o=a.state,typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount(),o!==a.state&&Tc.enqueueReplaceState(a,a.state,null),ko(t,r,a,i),Oo(),a.state=t.memoizedState),typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!0}else if(e===null){a=t.stateNode;var s=t.memoizedProps,c=Oc(n,s);a.props=c;var l=a.context,u=n.contextType;o=Li,typeof u==`object`&&u&&(o=ja(u));var d=n.getDerivedStateFromProps;u=typeof d==`function`||typeof a.getSnapshotBeforeUpdate==`function`,s=t.pendingProps!==s,u||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(s||l!==o)&&Dc(t,a,r,o),bo=!1;var f=t.memoizedState;a.state=f,ko(t,r,a,i),Oo(),l=t.memoizedState,s||f!==l||bo?(typeof d==`function`&&(wc(t,n,d,r),l=t.memoizedState),(c=bo||Ec(t,n,c,r,f,l,o))?(u||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount==`function`&&(t.flags|=4194308)):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),a.props=r,a.state=l,a.context=o,r=c):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,So(e,t),o=t.memoizedProps,u=Oc(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=Li,typeof l==`object`&&l&&(c=ja(l)),s=n.getDerivedStateFromProps,(l=typeof s==`function`||typeof a.getSnapshotBeforeUpdate==`function`)||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(o!==d||f!==c)&&Dc(t,a,r,c),bo=!1,f=t.memoizedState,a.state=f,ko(t,r,a,i),Oo();var p=t.memoizedState;o!==d||f!==p||bo||e!==null&&e.dependencies!==null&&ka(e.dependencies)?(typeof s==`function`&&(wc(t,n,s,r),p=t.memoizedState),(u=bo||Ec(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&ka(e.dependencies))?(l||typeof a.UNSAFE_componentWillUpdate!=`function`&&typeof a.componentWillUpdate!=`function`||(typeof a.componentWillUpdate==`function`&&a.componentWillUpdate(r,p,c),typeof a.UNSAFE_componentWillUpdate==`function`&&a.UNSAFE_componentWillUpdate(r,p,c)),typeof a.componentDidUpdate==`function`&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),a.props=r,a.state=p,a.context=c,r=u):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return a=r,Xc(e,t),r=!!(t.flags&128),a||r?(a=t.stateNode,n=r&&typeof n.getDerivedStateFromError!=`function`?null:a.render(),t.flags|=1,e!==null&&r?(t.child=vo(t,e.child,null,i),t.child=vo(t,null,n,i)):Bc(e,t,n,i),t.memoizedState=a.state,e=t.child):e=hl(e,t,i),e}function el(e,t,n,r){return va(),t.flags|=256,Bc(e,t,n,r),t.child}var tl={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function nl(e){return{baseLanes:e,cachePool:eo()}}function rl(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=fd),e}function il(e,t,n){var r=t.pendingProps,i=!1,a=!!(t.flags&128),o;if((o=a)||(o=e!==null&&e.memoizedState===null?!1:!!(F.current&2)),o&&(i=!0,t.flags&=-129),o=!!(t.flags&32),t.flags&=-33,e===null){if(P){if(i?zo(t):Ho(),(e=N)?(e=am(e,fa),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:na===null?null:{id:ra,overflow:ia},retryLane:536870912,hydrationErrors:null},n=Ki(e),n.return=t,t.child=n,ua=t,N=null)):e=null,e===null)throw ma(t);return t.lanes=sm(e)?32:536870912,null}return a=r.children,r=r.fallback,i?(Ho(),i=t.mode,a=ol({mode:`hidden`,children:a},i),r=Wi(r,i,n,null),a.return=t,r.return=t,a.sibling=r,t.child=a,r=t.child,r.memoizedState=nl(n),r.childLanes=rl(e,o,n),t.memoizedState=tl,Gc(null,r)):(zo(t),al(t,a))}var s=e.memoizedState;if(s!==null){var c=s.dehydrated;if(c!==null)return cl(e,t,a,o,r,c,s,n)}return i?(Ho(),i=r.fallback,a=t.mode,s=e.child,c=s.sibling,r=Vi(s,{mode:`hidden`,children:r.children}),r.subtreeFlags=s.subtreeFlags&1206910976,c===null?(i=Wi(i,a,n,null),i.flags|=2):i=Vi(c,i),i.return=t,r.return=t,r.sibling=i,t.child=r,Gc(null,r),r=t.child,i=e.child.memoizedState,i===null?i=nl(n):(a=i.cachePool,a===null?a=eo():(s=La._currentValue,a=a.parent===s?a:{parent:s,pool:s}),i={baseLanes:i.baseLanes|n,cachePool:a}),r.memoizedState=i,r.childLanes=rl(e,o,n),t.memoizedState=tl,Gc(e.child,r)):(zo(t),n=e.child,e=n.sibling,n=Vi(n,{mode:`visible`,children:r.children}),n.return=t,n.sibling=null,e!==null&&(o=t.deletions,o===null?(t.deletions=[e],t.flags|=16):o.push(e)),t.child=n,t.memoizedState=null,n)}function al(e,t){return t=ol({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function ol(e,t){return e=zi(22,e,null,t),e.lanes=0,e}function sl(e,t,n){return vo(t,e.child,null,n),e=al(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function cl(e,t,n,r,i,a,s,c){if(n)return t.flags&256?(zo(t),t.flags&=-257,sl(e,t,c)):t.memoizedState===null?(Ho(),a=i.fallback,s=t.mode,i=ol({mode:`visible`,children:i.children},s),a=Wi(a,s,c,null),a.flags|=2,i.return=t,a.return=t,i.sibling=a,t.child=i,vo(t,e.child,null,c),i=t.child,i.memoizedState=nl(c),i.childLanes=rl(e,r,c),t.memoizedState=tl,Gc(null,i)):(Ho(),t.child=e.child,t.flags|=128,null);if(zo(t),sm(a)){if(r=a.nextSibling&&a.nextSibling.dataset,r)var l=r.dgst;return r=l,r!==``&&(i=Error(o(419)),i.stack=``,i.digest=r,ba({value:i,source:null,stack:null})),sl(e,t,c)}if(zc||Oa(e,t,c,!1),r=(c&e.childLanes)!==0,zc||r){if(Mo.current!==null)return sl(e,t,c);if(r=U,r!==null&&(i=wt(r,c),i!==0&&i!==s.retryLane))throw s.retryLane=i,Pi(e,i),Pd(r,e,i),Rc;return om(a)||Kd(),sl(e,t,c)}return om(a)?(t.flags|=192,t.child=e.child,null):(e=s.treeContext,N=lm(a.nextSibling),ua=t,P=!0,da=null,fa=!1,e!==null&&la(t,e),t=al(t,i.children),t.flags|=134221824,t)}function ll(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Ea(e.return,t,n)}function ul(e){for(var t=null;e!==null;){var n=e.alternate;n!==null&&Ko(n)===null&&(t=e),e=e.sibling}return t}function dl(e,t,n,r,i,a){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i,treeForkCount:a}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i,o.treeForkCount=a)}function fl(e){var t=e.child;for(e.child=null;t!==null;){var n=t.sibling;t.sibling=e.child,e.child=t,t=n}}function pl(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=F.current;if(t.flags&128)return Wo(t,o),null;var s=!!(o&2);if(s?(o=o&1|2,t.flags|=128):o&=1,Wo(t,o),i===`backwards`&&e!==null?(fl(e),Bc(e,t,r,n),fl(e)):Bc(e,t,r,n),r=P?$i:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&ll(e,n,t);else if(e.tag===19)ll(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(i){case`backwards`:n=ul(t.child),n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null,fl(t)),dl(t,!0,i,null,a,r);break;case`unstable_legacy-backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&Ko(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}dl(t,!0,n,null,a,r);break;case`together`:dl(t,!1,null,null,void 0,r);break;case`independent`:t.memoizedState=null;break;default:n=ul(t.child),n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),dl(t,!1,i,n,a,r)}return t.child}function ml(e,t,n){var r=t.pendingProps;return wa(t,t.type,r.value),Bc(e,t,r.children,n),t.child}function hl(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),ld|=t.lanes,(n&t.childLanes)===0){if(e!==null){if(Oa(e,t,n,!1),(n&t.childLanes)===0)return null}else return null}if(e!==null&&t.child!==e.child)throw Error(o(153));if(t.child!==null){for(e=t.child,n=Vi(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Vi(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function gl(e,t){return(e.lanes&t)!==0||(e=e.dependencies,!!(e!==null&&ka(e)))}function _l(e,t,n){switch(t.tag){case 3:Me(t,t.stateNode.containerInfo),wa(t,La,e.memoizedState.cache),va();break;case 27:case 5:Pe(t);break;case 4:Me(t,t.stateNode.containerInfo);break;case 10:wa(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Bo(t),null;break;case 13:var r=t.memoizedState;if(r!==null){if(r.dehydrated!==null)return zo(t),t.flags|=128,null;r=Oa(e,t,n,!1);var i=t.child.childLanes;return r||(n&i)!==0?il(e,t,n):(zo(t),e=hl(e,t,n),e===null?null:e.sibling)}zo(t);break;case 19:if(t.flags&128)return pl(e,t,n);if(i=!!(e.flags&128),r=(n&t.childLanes)!==0,r||=(Oa(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return pl(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),Wo(t,F.current),r)break;return null;case 22:return t.lanes=0,Wc(e,t,n,t.pendingProps);case 24:wa(t,La,e.memoizedState.cache)}return hl(e,t,n)}function vl(e,t,n){if(e!==null){if(e.memoizedProps!==t.pendingProps)zc=!0;else{if(!gl(e,n)&&!(t.flags&128))return zc=!1,_l(e,t,n);zc=!!(e.flags&131072)}}else zc=!1,P&&t.flags&1048576&&oa(t,$i,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=so(t.elementType),t.type=e,typeof e==`function`)Bi(e)?(r=Oc(e,r),t.tag=1,t=$c(null,t,e,r,n)):(t.tag=0,t=Zc(null,t,e,r,n));else{if(e!=null){var i=e.$$typeof;if(i===ce){t.tag=11,t=Vc(null,t,e,r,n);break a}if(i===de){t.tag=14,t=Hc(null,t,e,r,n);break a}if(i===se){t.tag=10,t.type=e,t=ml(null,t,n);break a}}throw t=xe(e)||e,Error(o(306,t,``))}}return t;case 0:return Zc(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,i=Oc(r,t.pendingProps),$c(e,t,r,i,n);case 3:a:{if(Me(t,t.stateNode.containerInfo),e===null)throw Error(o(387));r=t.pendingProps;var a=t.memoizedState;i=a.element,So(e,t),ko(t,r,null,n);var s=t.memoizedState;if(r=s.cache,wa(t,La,r),r!==a.cache&&Da(t,[La],n,!0),Oo(),r=s.element,a.isDehydrated){if(a={element:r,isDehydrated:!1,cache:s.cache},t.updateQueue.baseState=a,t.memoizedState=a,t.flags&256){t=el(e,t,r,n);break a}if(r!==i){i=Yi(Error(o(424)),t),ba(i),t=el(e,t,r,n);break a}switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName===`HTML`?e.ownerDocument.body:e}for(N=lm(e.firstChild),ua=t,P=!0,da=null,fa=!0,n=yo(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|134221824,n=n.sibling}else{if(va(),r===i){t=hl(e,t,n);break a}Bc(e,t,r,n)}t=t.child}return t;case 26:return Xc(e,t),e===null?(n=Nm(t.type,null,t.pendingProps,null))?t.memoizedState=n:P||(t.stateNode=fp(t.type,t.pendingProps,Ae.current,t)):t.memoizedState=Nm(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Pe(t),e===null&&P&&(r=t.stateNode=hm(t.type,t.pendingProps,Ae.current),ua=t,fa=!0,i=N,Sp(t.type)?(um=i,N=lm(r.firstChild)):N=i),Bc(e,t,t.pendingProps.children,n),Xc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&P&&((i=r=N)&&(r=rm(r,t.type,t.pendingProps,fa),r===null?i=!1:(t.stateNode=r,ua=t,N=lm(r.firstChild),fa=!1,i=!0)),i||ma(t)),Pe(t),i=t.type,a=t.pendingProps,s=e===null?null:e.memoizedProps,r=a.children,pp(i,a)?r=null:s!==null&&pp(i,s)&&(t.flags|=32),t.memoizedState!==null&&(i=is(e,t,ss,null,null,n),sh._currentValue=i),Xc(e,t),Bc(e,t,r,n),t.child;case 6:return e===null&&P&&((e=n=N)&&(n=im(n,t.pendingProps,fa),n===null?e=!1:(t.stateNode=n,ua=t,N=null,e=!0)),e||ma(t)),null;case 13:return il(e,t,n);case 4:return Me(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=vo(t,null,r,n):Bc(e,t,r,n),t.child;case 11:return Vc(e,t,t.type,t.pendingProps,n);case 7:return r=t.pendingProps,Xc(e,t),Bc(e,t,r,n),t.child;case 8:return Bc(e,t,t.pendingProps.children,n),t.child;case 12:return Bc(e,t,t.pendingProps.children,n),t.child;case 10:return ml(e,t,n);case 9:return i=t.type._context,r=t.pendingProps.children,Aa(t),i=ja(i),r=r(i),t.flags|=1,Bc(e,t,r,n),t.child;case 14:return Hc(e,t,t.type,t.pendingProps,n);case 15:return Uc(e,t,t.type,t.pendingProps,n);case 19:return pl(e,t,n);case 31:return Yc(e,t,n);case 22:return Wc(e,t,n,t.pendingProps);case 24:return Aa(t),r=ja(La),e===null?(i=Qa(),i===null&&(i=U,a=Ra(),i.pooledCache=a,a.refCount++,a!==null&&(i.pooledCacheLanes|=n),i=a),t.memoizedState={parent:r,cache:i},xo(t),wa(t,La,i)):((e.lanes&n)!==0&&(So(e,t),ko(t,null,null,n),Oo()),i=e.memoizedState,a=t.memoizedState,i.parent===r?(r=a.cache,wa(t,La,r),r!==i.cache&&Da(t,[La],n,!0)):(i={parent:r,cache:r},t.memoizedState=i,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=i),wa(t,La,r))),Bc(e,t,t.pendingProps.children,n),t.child;case 30:return t.stateNode===null&&(t.stateNode={autoName:null,paired:null,clones:null,ref:null}),r=t.pendingProps,r.name!=null&&r.name!==`auto`?t.flags|=e===null?18882560:18874368:P&&sa(t),e!==null&&e.memoizedProps.name!==r.name?t.flags|=4194816:Xc(e,t),Bc(e,t,r.children,n),t.child;case 29:throw t.pendingProps}throw Error(o(156,t.tag))}function yl(e){e.flags|=4}function bl(e,t,n,r,i){var a;if((a=!!(e.mode&32))&&(a=n===null?Jm(t,r):Jm(t,r)&&(r.src!==n.src||r.srcSet!==n.srcSet)),a){if(e.flags|=16777216,(i&335544128)===i){if(e.stateNode.complete)e.flags|=8192;else if(Ud())e.flags|=8192;else throw co=io,no}}else e.flags&=-16777217}function xl(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!Ym(t)){if(Ud())e.flags|=8192;else throw co=io,no}}function Sl(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:vt(),e.lanes|=t,pd|=t)}function Cl(e,t){if(!P)switch(e.tailMode){case`visible`:break;case`collapsed`:for(var n=e.tail,r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null;break;default:for(t=e.tail,n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null}}function R(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&1206910976,r|=i.flags&1206910976,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function wl(e,t,n){var r=t.pendingProps;switch(ca(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return R(t),null;case 1:return R(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),Ta(La),Ne(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(_a(t)?yl(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,ya())),R(t),null;case 26:var i=t.type,a=t.memoizedState;return e===null?(yl(t),a===null?(R(t),bl(t,i,null,r,n)):(R(t),xl(t,a))):a?a===e.memoizedState?(R(t),t.flags&=-16777217):(yl(t),R(t),xl(t,a)):(e=e.memoizedProps,e!==r&&yl(t),R(t),bl(t,i,e,r,n)),null;case 27:if(Fe(t),n=Ae.current,i=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&yl(t);else{if(!r){if(t.stateNode===null)throw Error(o(166));return R(t),t.subtreeFlags&=-33554433,null}e=Oe.current,_a(t)?ha(t,e):(e=hm(i,r,n),t.stateNode=e,yl(t))}return R(t),t.subtreeFlags&=-33554433,null;case 5:if(Fe(t),i=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&yl(t);else{if(!r){if(t.stateNode===null)throw Error(o(166));return R(t),t.subtreeFlags&=-33554433,null}if(a=Oe.current,_a(t))ha(t,a);else{var s=lp(Ae.current);switch(a){case 1:a=s.createElementNS(`http://www.w3.org/2000/svg`,i);break;case 2:a=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,i);break;default:switch(i){case`svg`:a=s.createElementNS(`http://www.w3.org/2000/svg`,i);break;case`math`:a=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,i);break;case`script`:a=s.createElement(`div`),a.innerHTML=`<script><\/script>`,a=a.removeChild(a.firstChild);break;case`select`:a=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?a.multiple=!0:r.size&&(a.size=r.size);break;default:a=typeof r.is==`string`?s.createElement(i,{is:r.is}):s.createElement(i)}}a[At]=t,a[jt]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)a.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break a;for(;s.sibling===null;){if(s.return===null||s.return===t)break a;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=a;a:switch(np(a,i,r),i){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&yl(t)}}return R(t),t.subtreeFlags&=-33554433,bl(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&yl(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(o(166));if(e=Ae.current,_a(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,i=ua,i!==null)switch(i.tag){case 27:case 5:r=i.memoizedProps}e[At]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||ep(e.nodeValue,n)),e||ma(t,!0)}else e=lp(e).createTextNode(r),e[At]=t,t.stateNode=e}return R(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=_a(t),n!==null){if(e===null){if(!r)throw Error(o(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(o(557));e[At]=t}else va(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;R(t),e=!1}else n=ya(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(Uo(t),t):(Uo(t),null);if(t.flags&128)throw Error(o(558))}return R(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(i=_a(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(o(318));if(i=t.memoizedState,i=i===null?null:i.dehydrated,!i)throw Error(o(317));i[At]=t}else va(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;R(t),i=!1}else i=ya(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),i=!0;if(!i)return t.flags&256?(Uo(t),t):(Uo(t),null)}return Uo(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,i=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(i=r.alternate.memoizedState.cachePool.pool),a=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(a=r.memoizedState.cachePool.pool),a!==i&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Sl(t,t.updateQueue),R(t),null);case 4:return Ne(),e===null&&Wf(t.stateNode.containerInfo),t.flags|=67108864,R(t),null;case 10:return Ta(t.type),R(t),null;case 19:if(Go(t),r=t.memoizedState,r===null)return R(t),null;if(i=!!(t.flags&128),a=r.rendering,a===null){if(i)Cl(r,!1);else{if(q!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(a=Ko(e),a!==null){for(t.flags|=128,Cl(r,!1),e=a.updateQueue,t.updateQueue=e,Sl(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)Hi(n,e),n=n.sibling;return Wo(t,F.current&1|2),P&&aa(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&Je()>yd&&(t.flags|=128,i=!0,Cl(r,!1),t.lanes=4194304)}}else{if(!i){if(e=Ko(a),e!==null){if(t.flags|=128,i=!0,e=e.updateQueue,t.updateQueue=e,Sl(t,e),Cl(r,!0),r.tail===null&&r.tailMode!==`collapsed`&&r.tailMode!==`visible`&&!a.alternate&&!P)return R(t),null}else 2*Je()-r.renderingStartTime>yd&&n!==536870912&&(t.flags|=128,i=!0,Cl(r,!1),t.lanes=4194304)}r.isBackwards?(a.sibling=t.child,t.child=a):(e=r.last,e===null?t.child=a:e.sibling=a,r.last=a)}if(r.tail!==null){e=r.tail;a:{for(n=e;n!==null;){if(n.alternate!==null){n=!1;break a}n=n.sibling}n=!0}return r.rendering=e,r.tail=e.sibling,r.renderingStartTime=Je(),e.sibling=null,a=F.current,a=i?a&1|2:a&1,r.tailMode===`visible`||r.tailMode===`collapsed`||!n||P?Wo(t,a):(n=a,k(Lo,t),k(F,n),Ro===null&&(Ro=t)),P&&aa(t,r.treeForkCount),e}return R(t),null;case 22:case 23:return Uo(t),Io(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(R(t),t.subtreeFlags&6&&(t.flags|=8192)):R(t),n=t.updateQueue,n!==null&&Sl(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&De(Za),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Ta(La),R(t),null;case 25:return null;case 30:return t.flags|=33554432,R(t),null}throw Error(o(156,t.tag))}function Tl(e,t){switch(ca(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Ta(La),Ne(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Fe(t),null;case 31:if(t.memoizedState!==null){if(Uo(t),t.alternate===null)throw Error(o(340));va()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Uo(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(o(340));va()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Go(t),e=t.flags,e&65536?(t.flags=e&-65537|128,e=t.memoizedState,e!==null&&(e.rendering=null,e.tail=null),t.flags|=4,t):null;case 4:return Ne(),null;case 10:return Ta(t.type),null;case 22:case 23:return Uo(t),Io(),e!==null&&De(Za),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Ta(La),null;case 25:return null;default:return null}}function El(e,t){switch(ca(t),t.tag){case 3:Ta(La),Ne();break;case 26:case 27:case 5:Fe(t);break;case 4:Ne();break;case 31:t.memoizedState!==null&&Uo(t);break;case 13:Uo(t);break;case 19:Go(t);break;case 10:Ta(t.type);break;case 22:case 23:Uo(t),Io(),e!==null&&De(Za);break;case 24:Ta(La)}}function Dl(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){Z(t,t.return,e)}}function Ol(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){Z(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){Z(t,t.return,e)}}function kl(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{jo(t,n)}catch(t){Z(e,e.return,t)}}}function Al(e,t,n){n.props=Oc(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){Z(e,t,n)}}function jl(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:var i=e.stateNode,a=Ci(e.memoizedProps,i);(i.ref===null||i.ref.name!==a)&&(i.ref=Pp(a)),r=i.ref;break;case 7:if(e.stateNode===null){var o=new Fp(e);m(e.child,!1,Qp,o,void 0,void 0),e.stateNode=o}r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){Z(e,t,n)}}function Ml(e,t){var n=e.ref,r=e.refCleanup;if(n!==null){if(typeof r==`function`)try{r()}catch(n){Z(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){Z(e,t,n)}else n.current=null}}function Nl(e,t){if((e.tag===5||e.tag===27||e.tag===6)&&e.alternate===null&&t!==null)for(var n=0;n<t.length;n++)em(e.stateNode,t[n])}function Pl(e){for(var t=e.return;t!==null&&(Ll(t)&&em(e.stateNode,t.stateNode),!Il(t));)t=t.return}function Fl(e){for(var t=e.return;t!==null&&(Ll(t)&&tm(e.stateNode,t.stateNode),!Il(t));)t=t.return}function Il(e){return e.tag===5||e.tag===3||e.tag===27}function Ll(e){return e&&e.tag===7&&e.stateNode!==null}function Rl(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){Z(e,e.return,t)}}function zl(e,t,n){try{var r=e.stateNode;ip(r,e.type,n,t),r[jt]=t}catch(t){Z(e,e.return,t)}}function Bl(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Sp(e.type)||e.tag===4}function Vl(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Bl(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Sp(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Hl(e,t,n,r){var i=e.tag;if(i===5||i===6)i=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(i,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(i),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=En)),Nl(e,r),A=!0;else if(i!==4&&(i===27&&(Nl(e,r),r=null,Sp(e.type)&&(n=e.stateNode,t=null)),e=e.child,e!==null))for(Hl(e,t,n,r),e=e.sibling;e!==null;)Hl(e,t,n,r),e=e.sibling}function Ul(e,t,n,r){var i=e.tag;if(i===5||i===6)i=e.stateNode,t?n.insertBefore(i,t):n.appendChild(i),Nl(e,r),A=!0;else if(i!==4&&(i===27&&(Nl(e,r),r=null,Sp(e.type)&&(n=e.stateNode)),e=e.child,e!==null))for(Ul(e,t,n,r),e=e.sibling;e!==null;)Ul(e,t,n,r),e=e.sibling}function Wl(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);np(t,r,n),t[At]=e,t[jt]=n}catch(t){Z(e,e.return,t)}}var Gl=!1,Kl=null;function ql(e){(e.tag===30||e.subtreeFlags&33554432)&&(Gl=!0)}var Jl=null;function Yl(){var e=Jl;return Jl=null,e}var Xl=0;function Zl(e,t,n,r,i){return Xl=0,Ql(e.child,t,n,r,i)}function Ql(e,t,n,r,i){for(var a=!1;e!==null;){if(e.tag===5){var o=e.stateNode;if(r!==null){var s=Op(o);r.push(s),s.view&&(a=!0)}else a||Op(o).view&&(a=!0);Gl=!0,Tp(o,Xl===0?t:t+`_`+Xl,n),Xl++}else e.tag===22&&e.memoizedState!==null||e.tag===30&&i||Ql(e.child,t,n,r,i)&&(a=!0);e=e.sibling}return a}function $l(e,t){for(;e!==null;)e.tag===5?Ep(e.stateNode,e.memoizedProps):e.tag===22&&e.memoizedState!==null||e.tag===30&&t||$l(e.child,t),e=e.sibling}function eu(e){if(e.subtreeFlags&18874368)for(e=e.child;e!==null;){if((e.tag!==22||e.memoizedState===null)&&(eu(e),e.tag===30&&e.flags&18874368&&e.stateNode.paired)){var t=e.memoizedProps;if(t.name==null||t.name===`auto`)throw Error(o(544));var n=t.name;t=Ti(t.default,t.share),t!==`none`&&(Zl(e,n,t,null,!1)||$l(e.child,!1))}e=e.sibling}}function tu(e,t){if(e.tag===30){var n=e.stateNode,r=e.memoizedProps,i=Ci(r,n),a=Ti(r.default,n.paired?r.share:r.enter);a===`none`?eu(e):Zl(e,i,a,null,!1)?(eu(e),n.paired||t||Nd(e,r.onEnter)):$l(e.child,!1)}else if(e.subtreeFlags&33554432)for(e=e.child;e!==null;)tu(e,t),e=e.sibling;else eu(e)}function nu(e){if(Kl!==null&&Kl.size!==0){var t=Kl;if(e.subtreeFlags&18874368)for(e=e.child;e!==null;){if(e.tag!==22||e.memoizedState===null){if(e.tag===30&&e.flags&18874368){var n=e.memoizedProps,r=n.name;if(r!=null&&r!==`auto`){var i=t.get(r);if(i!==void 0){var a=Ti(n.default,n.share);if(a!==`none`&&(Zl(e,r,a,null,!1)?(a=e.stateNode,i.paired=a,a.paired=i,Nd(e,n.onShare)):$l(e.child,!1)),t.delete(r),t.size===0)break}}}nu(e)}e=e.sibling}}}function ru(e){if(e.tag===30){var t=e.memoizedProps,n=Ci(t,e.stateNode),r=Kl===null?void 0:Kl.get(n),i=Ti(t.default,r===void 0?t.exit:t.share);i!==`none`&&(Zl(e,n,i,null,!1)?r===void 0?Nd(e,t.onExit):(i=e.stateNode,r.paired=i,i.paired=r,Kl.delete(n),Nd(e,t.onShare)):$l(e.child,!1)),Kl!==null&&nu(e)}else if(e.subtreeFlags&33554432)for(e=e.child;e!==null;)ru(e),e=e.sibling;else Kl!==null&&nu(e)}function iu(e){for(e=e.child;e!==null;){if(e.tag===30){var t=e.memoizedProps,n=Ci(t,e.stateNode);t=Ti(t.default,t.update),e.flags&=-5,t!==`none`&&Zl(e,n,t,e.memoizedState=[],!1)}else e.subtreeFlags&33554432&&iu(e);e=e.sibling}}function au(e){if(e.subtreeFlags&18874368)for(e=e.child;e!==null;){if(e.tag!==22||e.memoizedState===null){if(e.tag===30&&e.flags&18874368){var t=e.stateNode;t.paired!==null&&(t.paired=null,$l(e.child,!1))}au(e)}e=e.sibling}}function ou(e){if(e.tag===30)e.stateNode.paired=null,$l(e.child,!1),au(e);else if(e.subtreeFlags&33554432)for(e=e.child;e!==null;)ou(e),e=e.sibling;else au(e)}function su(e){for(e=e.child;e!==null;)e.tag===30?$l(e.child,!1):e.subtreeFlags&33554432&&su(e),e=e.sibling}function cu(e,t,n,r,i,a,o){for(var s=!1;t!==null;){if(t.tag===5){var c=t.stateNode;if(a!==null&&Xl<a.length){var l=a[Xl],u=Op(c);(l.view||u.view)&&(s=!0);var d;if(d=!(e.flags&4)){if(u.clip)d=!0;else{d=l.rect;var f=u.rect;d=d.y!==f.y||d.x!==f.x||d.height!==f.height||d.width!==f.width}}d&&(e.flags|=4),u.abs?u=!l.abs:(l=l.rect,u=u.rect,u=l.height!==u.height||l.width!==u.width),u&&(e.flags|=32)}else e.flags|=32;e.flags&4&&Tp(c,Xl===0?n:n+`_`+Xl,i),s&&e.flags&4||(Jl===null&&(Jl=[]),Jl.push(c,Xl===0?r:r+`_`+Xl,t.memoizedProps)),Xl++}else(t.tag!==22||t.memoizedState===null)&&(t.tag===30&&o?e.flags|=t.flags&32:cu(e,t.child,n,r,i,a,o)&&(s=!0));t=t.sibling}return s}function z(e,t){for(e=e.child;e!==null;){if(e.tag===30){var n=e.memoizedProps,r=e.stateNode,i=Ci(n,r),a=Ti(n.default,n.update);if(t){r=r.clones;var o=r===null?null:r.map(kp)}else o=e.memoizedState,e.memoizedState=null;r=e;var s=e.child;Xl=0,i=cu(r,s,i,i,a,o,!1),e.flags&4&&i&&(t||Nd(e,n.onUpdate))}else e.subtreeFlags&33554432&&z(e,t);e=e.sibling}}var lu=!1,B=!1,uu=!1,du=!1,fu=typeof WeakSet==`function`?WeakSet:Set,pu=null,mu=!1,hu=!1,gu=!1,_u=!1;function vu(e,t,n){if(e=e.containerInfo,sp=gh,e=$r(e),ei(e)){if(`selectionStart`in e)var r={start:e.selectionStart,end:e.selectionEnd};else a:{r=(r=e.ownerDocument)&&r.defaultView||window;var i=r.getSelection&&r.getSelection();if(i&&i.rangeCount!==0){r=i.anchorNode;var a=i.anchorOffset,o=i.focusNode;i=i.focusOffset;try{r.nodeType,o.nodeType}catch{r=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==r||a!==0&&f.nodeType!==3||(c=s+a),f!==o||i!==0&&f.nodeType!==3||(l=s+i),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===r&&++u===a&&(c=s),p===o&&++d===i&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}r=c===-1||l===-1?null:{start:c,end:l}}else r=null}r||={start:0,end:0}}else r=null;for(cp={focusedElem:e,selectionRange:r},gh=!1,n=(n&335544064)===n,pu=t,t=n?9270:1024;pu!==null;){if(e=pu,n&&(r=e.deletions,r!==null))for(a=0;a<r.length;a++)n&&ru(r[a]);if(e.alternate===null&&e.flags&2)n&&ql(e),yu(n);else{if(e.tag===22){if(r=e.alternate,e.memoizedState!==null){r!==null&&r.memoizedState===null&&n&&ru(r),yu(n);continue}if(r!==null&&r.memoizedState!==null){n&&ql(e),yu(n);continue}}r=e.child,(e.subtreeFlags&t)!==0&&r!==null?(r.return=e,pu=r):(n&&iu(e),yu(n))}}Kl=null}function yu(e){for(;pu!==null;){var t=pu,n=e,r=t.alternate,i=t.flags;switch(t.tag){case 0:case 11:case 15:break;case 1:if(i&1024&&r!==null){n=void 0,i=r.memoizedProps,r=r.memoizedState;var a=t.stateNode;try{var s=Oc(t.type,i);n=a.getSnapshotBeforeUpdate(s,r),a.__reactInternalSnapshotBeforeUpdate=n}catch(e){Z(t,t.return,e)}}break;case 3:if(i&1024){if(r=t.stateNode.containerInfo,n=r.nodeType,n===9)nm(r);else if(n===1)switch(r.nodeName){case`HEAD`:case`HTML`:case`BODY`:nm(r);break;default:r.textContent=``}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;case 30:n&&r!==null&&(n=Ci(r.memoizedProps,r.stateNode),i=t.memoizedProps,i=Ti(i.default,i.update),i!==`none`&&Zl(r,n,i,r.memoizedState=[],!0));break;default:if(i&1024)throw Error(o(163))}if(r=t.sibling,r!==null){r.return=t.return,pu=r;break}pu=t.return}}function bu(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:zu(e,n),r&4&&Dl(5,n);break;case 1:if(zu(e,n),r&4){if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){Z(n,n.return,e)}else{var i=Oc(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){Z(n,n.return,e)}}}r&64&&kl(n),r&512&&jl(n,n.return);break;case 3:if(zu(e,n),r&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{jo(e,t)}catch(e){Z(n,n.return,e)}}break;case 27:t===null&&r&4&&Wl(n);case 26:case 5:zu(e,n),t===null&&r&4&&Rl(n),r&512&&jl(n,n.return);break;case 12:zu(e,n);break;case 31:zu(e,n),r&4&&Ou(e,n);break;case 13:zu(e,n),r&4&&ku(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=_f.bind(null,n),cm(e,n))));break;case 22:if(r=n.memoizedState!==null||lu,!r){var a=t!==null&&t.memoizedState!==null||B;t=lu,i=B,lu=r,(B=a)&&!i?(r=2,n.subtreeFlags&8772&&(r|=1),Vu(e,n,r)):zu(e,n),lu=t,B=i}break;case 30:zu(e,n),r&512&&jl(n,n.return);break;case 7:r&512&&jl(n,n.return);default:zu(e,n)}}function xu(e,t){for(e=e.child;e!==null;)Su(e,t),e=e.sibling}function Su(e,t){switch(e.tag){case 5:case 26:try{var n=e.stateNode;if(t){var r=n.style;typeof r.setProperty==`function`?r.setProperty(`display`,`none`,`important`):r.display=`none`}else{var i=e.stateNode,a=e.memoizedProps.style,o=a!=null&&a.hasOwnProperty(`display`)?a.display:null;i.style.display=o==null||typeof o==`boolean`?``:(``+o).trim()}}catch(t){Z(e,e.return,t)}Cu(e,t);break;case 6:try{e.stateNode.nodeValue=t?``:e.memoizedProps,A=!0}catch(t){Z(e,e.return,t)}break;case 18:try{var s=e.stateNode;t?wp(s,!0):wp(e.stateNode,!1)}catch(t){Z(e,e.return,t)}break;case 22:case 23:e.memoizedState===null&&xu(e,t);break;default:xu(e,t)}}function Cu(e,t){if(e.subtreeFlags&67108864)for(e=e.child;e!==null;){a:{var n=e,r=t;switch(n.tag){case 4:Su(n,r);break a;case 22:n.memoizedState===null&&Cu(n,r);break a;default:Cu(n,r)}}e=e.sibling}}function wu(e){var t=e.alternate;t!==null&&(e.alternate=null,wu(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&zt(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var V=null,Tu=!1;function Eu(e,t,n){for(n=n.child;n!==null;)Du(e,t,n),n=n.sibling}function Du(e,t,n){if(it&&typeof it.onCommitFiberUnmount==`function`)try{it.onCommitFiberUnmount(rt,n)}catch{}switch(n.tag){case 26:B||Ml(n,t),Eu(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&!B&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:B||Ml(n,t),Fl(n);var r=V,i=Tu;Sp(n.type)&&(V=n.stateNode,Tu=!1),Eu(e,t,n),gm(n.stateNode,n.type,n.memoizedProps),V=r,Tu=i;break;case 5:B||Ml(n,t),Fl(n);case 6:if(n.tag===6&&Fl(n),r=V,i=Tu,V=null,Eu(e,t,n),V=r,Tu=i,V!==null){if(Tu)try{(V.nodeType===9?V.body:V.nodeName===`HTML`?V.ownerDocument.body:V).removeChild(n.stateNode),A=!0}catch(e){Z(n,t,e)}else try{V.removeChild(n.stateNode),A=!0}catch(e){Z(n,t,e)}}break;case 18:V!==null&&(Tu?(e=V,Cp(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),Hh(e)):Cp(V,n.stateNode));break;case 4:r=V,i=Tu,V=n.stateNode.containerInfo,Tu=!0,Eu(e,t,n),V=r,Tu=i;break;case 0:case 11:case 14:case 15:Ol(2,n,t),B||Ol(4,n,t),Eu(e,t,n);break;case 1:B||(Ml(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&Al(n,t,r)),Eu(e,t,n);break;case 21:Eu(e,t,n);break;case 22:B=(r=B)||n.memoizedState!==null,Eu(e,t,n),B=r;break;case 30:Ml(n,t),Eu(e,t,n);break;case 7:B||Ml(n,t),Eu(e,t,n);break;default:Eu(e,t,n)}}function Ou(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Hh(e)}catch(e){Z(t,t.return,e)}}}function ku(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Hh(e)}catch(e){Z(t,t.return,e)}}function Au(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new fu),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new fu),t;default:throw Error(o(435,e.tag))}}function ju(e,t){var n=Au(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=vf.bind(null,e,t);t.then(r,r)}})}function Mu(e,t,n){var r=t.deletions;if(r!==null)for(var i=0;i<r.length;i++){var a=r[i],s=e,c=t,l=c;a:for(;l!==null;){switch(l.tag){case 27:if(Sp(l.type)){V=l.stateNode,Tu=!1;break a}break;case 5:V=l.stateNode,Tu=!1;break a;case 3:case 4:V=l.stateNode.containerInfo,Tu=!0;break a}l=l.return}if(V===null)throw Error(o(160));Du(s,c,a),V=null,Tu=!1,s=a.alternate,s!==null&&(s.return=null),a.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Pu(t,e,n),t=t.sibling}var Nu=null;function Pu(e,t,n){var r=e.alternate,i=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(i&4&&(r=e.updateQueue,r=r===null?null:r.events,r!==null))for(var a=0;a<r.length;a++){var s=r[a];s.ref.impl=s.nextImpl}Mu(t,e,n),Fu(e),i&4&&(Ol(3,e,e.return),Dl(3,e),Ol(5,e,e.return));break;case 1:Mu(t,e,n),Fu(e),i&512&&(B||r===null||Ml(r,r.return)),i&64&&lu&&(e=e.updateQueue,e!==null&&(t=e.callbacks,t!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?t:n.concat(t))));break;case 26:if(a=Nu,Mu(t,e,n),Fu(e),i&512&&(B||r===null||Ml(r,r.return)),i&4){if(i=r===null?null:r.memoizedState,n=e.memoizedState,r===null){if(n===null){if(e.stateNode===null){if(lu)e.stateNode=fp(e.type,e.memoizedProps,t.containerInfo,e);else{a:{t=e.type,n=e.memoizedProps,i=a.ownerDocument||a;b:switch(t){case`title`:r=i.getElementsByTagName(`title`)[0],(!r||r[Lt]||r[At]||r.namespaceURI===`http://www.w3.org/2000/svg`||r.hasAttribute(`itemprop`))&&(r=i.createElement(t),i.head.insertBefore(r,i.querySelector(`head > title`))),np(r,t,n),r[At]=e,Wt(r),t=r;break a;case`link`:if(a=Gm(`link`,`href`,i).get(t+(n.href||``))){for(s=0;s<a.length;s++)if(r=a[s],r.getAttribute(`href`)===(n.href==null||n.href===``?null:n.href)&&r.getAttribute(`rel`)===(n.rel==null?null:n.rel)&&r.getAttribute(`title`)===(n.title==null?null:n.title)&&r.getAttribute(`crossorigin`)===(n.crossOrigin==null?null:n.crossOrigin)){a.splice(s,1);break b}}r=i.createElement(t),np(r,t,n),i.head.appendChild(r);break;case`meta`:if(a=Gm(`meta`,`content`,i).get(t+(n.content||``))){for(s=0;s<a.length;s++)if(r=a[s],r.getAttribute(`content`)===(n.content==null?null:``+n.content)&&r.getAttribute(`name`)===(n.name==null?null:n.name)&&r.getAttribute(`property`)===(n.property==null?null:n.property)&&r.getAttribute(`http-equiv`)===(n.httpEquiv==null?null:n.httpEquiv)&&r.getAttribute(`charset`)===(n.charSet==null?null:n.charSet)){a.splice(s,1);break b}}r=i.createElement(t),np(r,t,n),i.head.appendChild(r);break;default:throw Error(o(468,t))}r[At]=e,Wt(r),t=r}e.stateNode=t}}else lu||Km(a,e.type,e.stateNode)}else e.stateNode=Bm(a,n,e.memoizedProps)}else i===n?n===null&&e.stateNode!==null&&zl(e,e.memoizedProps,r.memoizedProps):(i===null?(t=r.stateNode,t===null||B||t.parentNode.removeChild(t)):i.count--,n===null?lu||Km(a,e.type,e.stateNode):Bm(a,n,e.memoizedProps))}break;case 27:Mu(t,e,n),Fu(e),i&512&&(B||r===null||Ml(r,r.return)),r!==null&&i&4&&zl(e,e.memoizedProps,r.memoizedProps);break;case 5:if(a=uu,uu=!1,Mu(t,e,n),uu=a,Fu(e),i&512&&(B||r===null||Ml(r,r.return)),e.flags&32){t=e.stateNode;try{vn(t,``),A=!0}catch(t){Z(e,e.return,t)}}i&4&&e.stateNode!=null&&(t=e.memoizedProps,zl(e,t,r===null?t:r.memoizedProps)),i&1024&&(du=!0);break;case 6:if(Mu(t,e,n),Fu(e),i&4){if(e.stateNode===null)throw Error(o(162));t=e.memoizedProps,n=e.stateNode;try{n.nodeValue=t,A=!0}catch(t){Z(e,e.return,t)}}break;case 3:if(A=!1,Wm=null,a=Nu,Nu=bm(t.containerInfo),Mu(t,e,n),Nu=a,Fu(e),i&4&&r!==null&&r.memoizedState.isDehydrated)try{Hh(t.containerInfo)}catch(t){Z(e,e.return,t)}du&&(du=!1,Iu(e)),A=!1;break;case 4:i=uu,uu=lu,r=en(),a=Nu,Nu=bm(e.stateNode.containerInfo),Mu(t,e,n),Fu(e),Nu=a,A&&hu&&(gu=!0),A=r,uu=i;break;case 12:Mu(t,e,n),Fu(e);break;case 31:Mu(t,e,n),Fu(e),i&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,ju(e,t)));break;case 13:Mu(t,e,n),Fu(e),e.child.flags&8192&&e.memoizedState!==null!=(r!==null&&r.memoizedState!==null)&&(_d=Je()),i&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,ju(e,t)));break;case 22:a=e.memoizedState!==null,s=r!==null&&r.memoizedState!==null;var c=lu,l=B,u=uu;lu=c||a,uu=u||a,B=l||s,Mu(t,e,n),B=l,uu=u,lu=c,Fu(e),i&8192&&(t=e.stateNode,t._visibility=a?t._visibility&-2:t._visibility|1,!a||r===null||s||lu||B||(t=s||B,n=lu,r=B,lu=a||lu,B=t,Bu(e,2),lu=n,B=r),!a&&uu||xu(e,a)),i&4&&(t=e.updateQueue,t!==null&&(n=t.retryQueue,n!==null&&(t.retryQueue=null,ju(e,n))));break;case 19:Mu(t,e,n),Fu(e),i&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,ju(e,t)));break;case 30:i&512&&(B||r===null||Ml(r,r.return)),i=en(),a=hu,s=(n&335544064)===n,c=e.memoizedProps,hu=s&&Ti(c.default,c.update)!==`none`,Mu(t,e,n),Fu(e),s&&r!==null&&A&&(e.flags|=4),hu=a,A=i;break;case 21:break;case 7:i&512&&(B||r===null||Ml(r,r.return)),r&&r.stateNode!==null&&(r.stateNode._fragmentFiber=e);default:Mu(t,e,n),Fu(e)}}function Fu(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(Bl(r)){n=r;break}r=r.return}r=null;for(var i=e.return;i!==null;){if(Ll(i)){var a=i.stateNode;r===null?r=[a]:r.push(a)}if(Il(i))break;i=i.return}var s=r;if(n==null)throw Error(o(160));switch(n.tag){case 27:var c=n.stateNode;Ul(e,Vl(e),c,s);break;case 5:var l=n.stateNode;n.flags&32&&(vn(l,``),n.flags&=-33),Ul(e,Vl(e),l,s);break;case 3:case 4:var u=n.stateNode.containerInfo;Hl(e,Vl(e),u,s);break;default:throw Error(o(161))}}catch(t){Z(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Iu(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Iu(t),t.tag===5&&t.flags&1024&&(t=t.stateNode,gh=!0,t.reset(),gh=!1),e=e.sibling}}function Lu(e,t){if(t.subtreeFlags&9270)for(t=t.child;t!==null;)Ru(t,e),t=t.sibling;else z(t,!1)}function Ru(e,t){var n=e.alternate;if(n===null)tu(e,!1);else switch(e.tag){case 3:if(_u=mu=!1,Yl(),Lu(t,e),!mu&&!gu){if(e=Jl,e!==null)for(var r=0;r<e.length;r+=3){n=e[r];var i=e[r+1];Ep(n,e[r+2]),n=n.ownerDocument.documentElement,n!==null&&n.animate({opacity:[0,0],pointerEvents:[`none`,`none`]},{duration:0,fill:`forwards`,pseudoElement:`::view-transition-group(`+i+`)`})}e=t.containerInfo,e=e.nodeType===9?e.documentElement:e.ownerDocument.documentElement,e!==null&&e.style.viewTransitionName===``&&(e.style.viewTransitionName=`none`,e.animate({opacity:[0,0],pointerEvents:[`none`,`none`]},{duration:0,fill:`forwards`,pseudoElement:`::view-transition-group(root)`}),e.animate({width:[0,0],height:[0,0]},{duration:0,fill:`forwards`,pseudoElement:`::view-transition`})),_u=!0}Jl=null;break;case 5:Lu(t,e);break;case 4:r=mu,mu=!1,Lu(t,e),mu&&(gu=!0),mu=r;break;case 22:e.memoizedState===null&&(n.memoizedState===null?Lu(t,e):tu(e,!1));break;case 30:r=mu,i=Yl(),mu=!1,Lu(t,e),mu&&(e.flags|=4);var a=e.memoizedProps,o=e.stateNode;t=Ci(a,o),o=Ci(n.memoizedProps,o);var s=Ti(a.default,a.update);s===`none`?t=!1:(a=n.memoizedState,n.memoizedState=null,n=e.child,Xl=0,t=cu(e,n,t,o,s,a,!0),Xl!==(a===null?0:a.length)&&(e.flags|=32)),e.flags&4&&t?(Nd(e,e.memoizedProps.onUpdate),Jl=i):i!==null&&(i.push.apply(i,Jl),Jl=i),mu=e.flags&32?!0:r;break;default:Lu(t,e)}}function zu(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)bu(e,t.alternate,t),t=t.sibling}function Bu(e,t){for(e=e.child;e!==null;){var n=e,r=t;switch(n.tag){case 0:case 11:case 14:case 15:Ol(4,n,n.return),Bu(n,r);break;case 1:Ml(n,n.return);var i=n.stateNode;typeof i.componentWillUnmount==`function`&&Al(n,n.return,i),Bu(n,r);break;case 27:r&2&&gm(n.stateNode,n.type,n.memoizedProps);case 5:Ml(n,n.return),n.tag!==5&&n.tag!==27||Fl(n),Bu(n,r);break;case 6:Fl(n);break;case 26:Ml(n,n.return),i=n.stateNode,n.memoizedState!==null||i===null||B||i.parentNode.removeChild(i),Bu(n,r);break;case 22:n.memoizedState===null&&Bu(n,r);break;case 30:Ml(n,n.return),Bu(n,r);break;case 7:Ml(n,n.return);default:Bu(n,r)}e=e.sibling}}function Vu(e,t,n){for(n=t.subtreeFlags&8772?n:n&-2,t=t.child;t!==null;){var r=t.alternate,i=e,a=t,o=a.flags,s=!!(n&1);switch(a.tag){case 0:case 11:case 15:Vu(i,a,n),Dl(4,a);break;case 1:if(Vu(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){Z(r,r.return,e)}if(r=a,i=r.updateQueue,i!==null){var c=r.stateNode;try{var l=i.shared.hiddenCallbacks;if(l!==null)for(i.shared.hiddenCallbacks=null,i=0;i<l.length;i++)Ao(l[i],c)}catch(e){Z(r,r.return,e)}}s&&o&64&&kl(a),jl(a,a.return);break;case 27:n&2&&Wl(a);case 5:a.tag!==5&&a.tag!==27||Pl(a),Vu(i,a,n),s&&r===null&&o&4&&Rl(a),jl(a,a.return);break;case 6:Pl(a);break;case 26:c=a.stateNode,a.memoizedState!==null||c===null||lu||Km(bm(c.ownerDocument),a.type,c),Vu(i,a,n),s&&r===null&&o&4&&Rl(a),jl(a,a.return);break;case 12:Vu(i,a,n);break;case 31:Vu(i,a,n),s&&o&4&&Ou(i,a);break;case 13:Vu(i,a,n),s&&o&4&&ku(i,a);break;case 22:a.memoizedState===null&&Vu(i,a,n),jl(a,a.return);break;case 30:Vu(i,a,n),jl(a,a.return);break;case 7:jl(a,a.return);default:Vu(i,a,n)}t=t.sibling}}function Hu(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&za(n))}function Uu(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&za(e))}function Wu(e,t,n,r){var i=(n&335544064)===n;if(t.subtreeFlags&(i?10262:10256))for(t=t.child;t!==null;)Gu(e,t,n,r),t=t.sibling;else i&&su(t)}function Gu(e,t,n,r){var i=(n&335544064)===n;i&&t.alternate===null&&t.return!==null&&t.return.alternate!==null&&ou(t);var a=t.flags;switch(t.tag){case 0:case 11:case 15:Wu(e,t,n,r),a&2048&&Dl(9,t);break;case 1:Wu(e,t,n,r);break;case 3:Wu(e,t,n,r),i&&_u&&(e=e.containerInfo,e=e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,e.style.viewTransitionName===`root`&&(e.style.viewTransitionName=``),e=e.ownerDocument.documentElement,e!==null&&e.style.viewTransitionName===`none`&&(e.style.viewTransitionName=``)),a&2048&&(a=null,t.alternate!==null&&(a=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==a&&(t.refCount++,a!=null&&za(a)));break;case 12:if(a&2048){Wu(e,t,n,r),a=t.stateNode;try{var o=t.memoizedProps,s=o.id,c=o.onPostCommit;typeof c==`function`&&c(s,t.alternate===null?`mount`:`update`,a.passiveEffectDuration,-0)}catch(e){Z(t,t.return,e)}}else Wu(e,t,n,r);break;case 31:Wu(e,t,n,r);break;case 13:Wu(e,t,n,r);break;case 23:break;case 22:o=t.stateNode,s=t.alternate,t.memoizedState===null?(i&&s!==null&&s.memoizedState!==null&&ou(t),o._visibility&2?Wu(e,t,n,r):(o._visibility|=2,Ku(e,t,n,r,!!(t.subtreeFlags&10256)||!1))):(i&&s!==null&&s.memoizedState===null&&ou(s),o._visibility&2?Wu(e,t,n,r):qu(e,t)),a&2048&&Hu(s,t);break;case 24:Wu(e,t,n,r),a&2048&&Uu(t.alternate,t);break;case 30:i&&(a=t.alternate,a!==null&&($l(a.child,!0),$l(t.child,!0))),Wu(e,t,n,r);break;default:Wu(e,t,n,r)}}function Ku(e,t,n,r,i){for(i&&=!!(t.subtreeFlags&10256)||!1,t=t.child;t!==null;){var a=e,o=t,s=n,c=r,l=o.flags;switch(o.tag){case 0:case 11:case 15:Ku(a,o,s,c,i),Dl(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,Ku(a,o,s,c,i)):u._visibility&2?Ku(a,o,s,c,i):qu(a,o),i&&l&2048&&Hu(o.alternate,o);break;case 24:Ku(a,o,s,c,i),i&&l&2048&&Uu(o.alternate,o);break;default:Ku(a,o,s,c,i)}t=t.sibling}}function qu(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,r=t,i=r.flags;switch(r.tag){case 22:qu(n,r),i&2048&&Hu(r.alternate,r);break;case 24:qu(n,r),i&2048&&Uu(r.alternate,r);break;default:qu(n,r)}t=t.sibling}}var Ju=8192;function Yu(e,t,n){if(e.subtreeFlags&Ju)for(e=e.child;e!==null;)Xu(e,t,n),e=e.sibling}function Xu(e,t,n){switch(e.tag){case 26:Yu(e,t,n),e.flags&Ju&&(e.memoizedState===null?(e=e.stateNode,(t&335544128)===t&&Zm(n,e)):Qm(n,Nu,e.memoizedState,e.memoizedProps));break;case 5:Yu(e,t,n),e.flags&Ju&&(e=e.stateNode,(t&335544128)===t&&Zm(n,e));break;case 3:case 4:var r=Nu;Nu=bm(e.stateNode.containerInfo),Yu(e,t,n),Nu=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=Ju,Ju=16777216,Yu(e,t,n),Ju=r):Yu(e,t,n));break;case 30:if((e.flags&Ju)!==0&&(r=e.memoizedProps.name,r!=null&&r!==`auto`)){var i=e.stateNode;i.paired=null,Kl===null&&(Kl=new Map),Kl.set(r,i)}Yu(e,t,n);break;default:Yu(e,t,n)}}function Zu(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function Qu(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];pu=r,td(r,e)}Zu(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)$u(e),e=e.sibling}function $u(e){switch(e.tag){case 0:case 11:case 15:Qu(e),e.flags&2048&&Ol(9,e,e.return);break;case 3:Qu(e);break;case 12:Qu(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,ed(e)):Qu(e);break;default:Qu(e)}}function ed(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];pu=r,td(r,e)}Zu(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Ol(8,t,t.return),ed(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,ed(t));break;default:ed(t)}e=e.sibling}}function td(e,t){for(;pu!==null;){var n=pu;switch(n.tag){case 0:case 11:case 15:Ol(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var r=n.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:za(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,pu=r;else a:for(n=e;pu!==null;){r=pu;var i=r.sibling,a=r.return;if(wu(r),r===n){pu=null;break a}if(i!==null){i.return=a,pu=i;break a}pu=a}}}var nd={getCacheForType:function(e){var t=ja(La),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return ja(La).controller.signal}},rd=typeof WeakMap==`function`?WeakMap:Map,H=0,U=null,W=null,G=0,K=0,id=null,ad=!1,od=!1,sd=!1,cd=0,q=0,ld=0,ud=0,dd=0,fd=0,pd=0,md=null,hd=null,gd=!1,_d=0,vd=0,yd=1/0,bd=null,xd=null,Sd=0,Cd=null,wd=null,Td=0,Ed=0,J=null,Dd=null,Od=null,kd=null,Ad=null,jd=0,Y=null;function X(){return H&2&&G!==0?G&-G:D.T===null?Dt():Pf()}function Md(){if(fd===0){if(!(G&536870912)||P){var e=dt;dt<<=1,!(dt&3932160)&&(dt=262144),fd=e}else fd=536870912}return e=Lo.current,e!==null&&(e.flags|=32),fd}function Nd(e,t){if(t!=null){var n=e.stateNode,r=n.ref;r===null&&(r=n.ref=Pp(Ci(e.memoizedProps,n))),kd===null&&(kd=[]),kd.push(t.bind(null,r))}}function Pd(e,t,n){(e===U&&(K===2||K===9)||e.cancelPendingCommit!==null)&&(Vd(e,0),Rd(e,G,fd,!1)),bt(e,n),H&2&&e===U||(e===U&&(!(H&2)&&(ud|=n),q===4&&Rd(e,G,fd,!1)),Ef(e))}function Fd(e,t,n){if(H&6)throw Error(o(327));var r=!n&&!(t&127)&&(t&e.expiredLanes)===0||ht(e,t),i=r?Yd(e,t):qd(e,t,!0),a=r;do{if(i===0){od&&!r&&Rd(e,t,0,!1);break}if(n=e.current.alternate,a&&!Ld(n))i=qd(e,t,!1),a=!1;else{if(i===2){if(a=t,e.errorRecoveryDisabledLanes&a)var s=0;else s=e.pendingLanes&-536870913,s=s===0?s&536870912?536870912:0:s;if(s!==0){t=s;a:{var c=e;i=md;var l=c.current.memoizedState.isDehydrated;if(l&&(Vd(c,s).flags|=256),s=qd(c,s,!1),s!==2&&s!==6){if(sd&&!l){c.errorRecoveryDisabledLanes|=a,ud|=a,i=4;break a}a=hd,hd=i,a!==null&&(hd===null?hd=a:hd.push.apply(hd,a))}i=s}if(a=!1,i!==2)continue}}if(i===1){Vd(e,0),Rd(e,t,0,!0);break}a:{switch(r=e,a=i,a){case 0:case 1:throw Error(o(345));case 4:if((t&4194048)!==t&&(t&62914560)!==t)break;case 6:Rd(r,t,fd,!ad);break a;case 2:hd=null;break;case 3:case 5:break;default:throw Error(o(329))}if((t&62914560)===t&&(i=_d+300-Je(),10<i)){if(Rd(r,t,fd,!ad),mt(r,0,!0)!==0)break a;Td=t,r.timeoutHandle=gp(Id.bind(null,r,n,hd,bd,gd,t,fd,ud,pd,ad,a,`Throttled`,-0,0),i);break a}Id(r,n,hd,bd,gd,t,fd,ud,pd,ad,a,null,-0,0)}break}}while(1);Ef(e)}function Id(e,t,n,r,i,a,o,s,c,l,u,d,f,p){e.timeoutHandle=-1;var m=t.subtreeFlags,h=(a&335544064)===a;d=null,(h||m&8192||(m&16785408)==16785408)&&(d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:En},Kl=null,Xu(t,a,d),h&&(m=d,h=e.containerInfo,h=(h.nodeType===9?h:h.ownerDocument).__reactViewTransition,h!=null&&(m.count++,m.waitingForViewTransition=!0,m=nh.bind(m),h.finished.then(m,m))),m=(a&62914560)===a?_d-Je():(a&4194048)===a?vd-Je():0,m=eh(d,m),m!==null)?(Td=a,e.cancelPendingCommit=m(nf.bind(null,e,t,a,n,r,i,o,s,c,l,u,d,null,f,p)),Rd(e,a,o,!l)):nf(e,t,a,n,r,i,o,s,c,l,u,d)}function Ld(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!qr(a(),i))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Rd(e,t,n,r){t=gt(e,t),t&=~dd,t&=~ud,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-ot(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&St(e,n,t)}function zd(){return H&6?!0:(Df(0,!1),!1)}function Bd(){if(W!==null){if(K===0)var e=W.return;else e=W,Ca=Sa=null,us(e),fo=null,po=0,e=W;for(;e!==null;)El(e.alternate,e),e=e.return;W=null}}function Vd(e,t){var n=e.timeoutHandle;return n!==-1&&(e.timeoutHandle=-1,_p(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),Td=0,Bd(),U=e,W=n=Vi(e.current,null),G=t,K=0,id=null,ad=!1,od=ht(e,t),sd=!1,pd=fd=dd=ud=ld=q=0,hd=md=null,gd=!1,cd=gt(e,t),Ai(),n}function Hd(e,t){I=null,D.H=bc,t===to||t===ro?(t=lo(),K=3):t===no?(t=lo(),K=4):K=t===Rc?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,id=t,W===null&&(q=1,Mc(e,Yi(t,e.current)))}function Ud(){var e=Lo.current;return e===null?!0:(G&4194048)===G?Ro===null:(G&62914560)===G||G&536870912?e===Ro:!1}function Wd(){var e=D.H;return D.H=bc,e===null?bc:e}function Gd(){var e=D.A;return D.A=nd,e}function Kd(){q=4,ad||(G&4194048)!==G&&Lo.current!==null||(od=!0),!(ld&134217727)&&!(ud&134217727)||U===null||Rd(U,G,fd,!1)}function qd(e,t,n){var r=H;H|=2;var i=Wd(),a=Gd();(U!==e||G!==t)&&(bd=null,Vd(e,t)),t=!1;var o=q;a:do try{if(K!==0&&W!==null){var s=W,c=id;switch(K){case 8:Bd(),o=6;break a;case 3:case 2:case 9:case 6:Lo.current===null&&(t=!0);var l=K;if(K=0,id=null,$d(e,s,c,l),n&&od){o=0;break a}break;default:l=K,K=0,id=null,$d(e,s,c,l)}}Jd(),o=q;break}catch(t){Hd(e,t)}while(1);return t&&e.shellSuspendCounter++,Ca=Sa=null,H=r,D.H=i,D.A=a,W===null&&(U=null,G=0,Ai()),o}function Jd(){for(;W!==null;)Zd(W)}function Yd(e,t){var n=H;H|=2;var r=Wd(),i=Gd();U!==e||G!==t?(bd=null,yd=Je()+500,Vd(e,t)):od=ht(e,t);a:do try{if(K!==0&&W!==null){t=W;var a=id;b:switch(K){case 1:K=0,id=null,$d(e,t,a,1);break;case 2:case 9:if(ao(a)){K=0,id=null,Qd(t);break}t=function(){K!==2&&K!==9||U!==e||(K=7),Ef(e)},a.then(t,t);break a;case 3:K=7;break a;case 4:K=5;break a;case 7:ao(a)?(K=0,id=null,Qd(t)):(K=0,id=null,$d(e,t,a,7));break;case 5:var s=null;switch(W.tag){case 26:s=W.memoizedState;case 5:case 27:var c=W;if(s?Ym(s):c.stateNode.complete){K=0,id=null;var l=c.sibling;if(l!==null)W=l;else{var u=c.return;u===null?W=null:(W=u,ef(u))}break b}}K=0,id=null,$d(e,t,a,5);break;case 6:K=0,id=null,$d(e,t,a,6);break;case 8:Bd(),q=6;break a;default:throw Error(o(462))}}Xd();break}catch(t){Hd(e,t)}while(1);return Ca=Sa=null,D.H=r,D.A=i,H=n,W===null?(U=null,G=0,Ai(),q):0}function Xd(){for(;W!==null&&!Ke();)Zd(W)}function Zd(e){var t=vl(e.alternate,e,cd);e.memoizedProps=e.pendingProps,t===null?ef(e):W=t}function Qd(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=Qc(n,t,t.pendingProps,t.type,void 0,G);break;case 11:t=Qc(n,t,t.pendingProps,t.type.render,t.ref,G);break;case 5:us(t);var r=t;r===ua&&(P?(ga(r),r.tag===5&&r.stateNode!=null&&(N=r.stateNode)):(ga(r),P=!0));default:El(n,t),t=W=Hi(t,cd),t=vl(n,t,cd)}e.memoizedProps=e.pendingProps,t===null?ef(e):W=t}function $d(e,t,n,r){Ca=Sa=null,us(t),fo=null,po=0;var i=t.return;try{if(Lc(e,i,t,n,G)){q=1,Mc(e,Yi(n,e.current)),W=null;return}}catch(t){if(i!==null)throw W=i,t;q=1,Mc(e,Yi(n,e.current)),W=null;return}t.flags&32768?(P||r===1?e=!0:od||G&536870912?e=!1:(ad=e=!0,(r===2||r===9||r===3||r===6)&&(r=Lo.current,r!==null&&r.tag===13&&(r.flags|=16384))),tf(t,e)):ef(t)}function ef(e){var t=e;do{if(t.flags&32768){tf(t,ad);return}e=t.return;var n=wl(t.alternate,t,cd);if(n!==null){W=n;return}if(t=t.sibling,t!==null){W=t;return}W=t=e}while(t!==null);q===0&&(q=5)}function tf(e,t){do{var n=Tl(e.alternate,e);if(n!==null){n.flags&=32767,W=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){W=e;return}W=e=n}while(e!==null);q=6,W=null}function nf(e,t,n,r,i,a,s,c,l,u,d,f){e.cancelPendingCommit=null;do df();while(Sd!==0);if(H&6)throw Error(o(327));if(t!==null){if(t===e.current)throw Error(o(177));e===U&&(W=U=null,G=0),wd=t,Cd=e,Td=n,J=i,Dd=r,rf(e,t,n,s,c,l,f)}}function rf(e,t,n,r,i,a,o){var s=t.lanes|t.childLanes;if(Ed=s,s|=ki,xt(e,n,s,r,i,a),kd=null,(n&335544064)===n?(Ad=Ha(e),r=10262):(Ad=null,r=10256),(t.subtreeFlags&r)!==0||(t.flags&r)!==0?(e.callbackNode=null,e.callbackPriority=0,yf(Qe,function(){return ff(),null})):(e.callbackNode=null,e.callbackPriority=0),Gl=!1,r=!!(t.flags&13878),t.subtreeFlags&13878||r){r=D.T,D.T=null,i=O.p,O.p=2,a=H,H|=4;try{vu(e,t,n)}finally{H=a,O.p=i,D.T=r}}Sd=1,Gl?Od=Mp(o,e.containerInfo,Ad,sf,cf,of,lf,ff,af,null,null):(sf(),cf(),lf())}function af(e){if(Sd!==0){var t=Cd.onRecoverableError;t(e,{componentStack:null})}}function of(){Sd===3&&(Sd=0,Ru(wd,Cd),Sd=4)}function sf(){if(Sd===1){Sd=0;var e=Cd,t=wd,n=Td,r=!!(t.flags&13878);if(t.subtreeFlags&13878||r){r=D.T,D.T=null;var i=O.p;O.p=2;var a=H;H|=4;try{hu=gu=!1,Pu(t,e,n),n=cp;var o=$r(e.containerInfo),s=n.focusedElem,c=n.selectionRange;if(o!==s&&s&&s.ownerDocument&&Qr(s.ownerDocument.documentElement,s)){if(c!==null&&ei(s)){var l=c.start,u=c.end;if(u===void 0&&(u=l),`selectionStart`in s)s.selectionStart=l,s.selectionEnd=Math.min(u,s.value.length);else{var d=s.ownerDocument||document,f=d&&d.defaultView||window;if(f.getSelection){var p=f.getSelection(),m=s.textContent.length,h=Math.min(c.start,m),g=c.end===void 0?h:Math.min(c.end,m);!p.extend&&h>g&&(o=g,g=h,h=o);var _=Zr(s,h),v=Zr(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;s<d.length;s++){var b=d[s];b.element.scrollLeft=b.left,b.element.scrollTop=b.top}}gh=!!sp,cp=sp=null}finally{H=a,O.p=i,D.T=r}}e.current=t,Sd=2}}function cf(){if(Sd===2){Sd=0;var e=Cd,t=wd,n=!!(t.flags&8772);if(t.subtreeFlags&8772||n){n=D.T,D.T=null;var r=O.p;O.p=2;var i=H;H|=4;try{bu(e,t.alternate,t)}finally{H=i,O.p=r,D.T=n}}Sd=3}}function lf(){if(Sd===4||Sd===3){Sd=0;var e=Od;Od=null,qe();var t=Cd,n=wd,r=Td,i=Dd,a=(r&335544064)===r?10262:10256;if((n.subtreeFlags&a)!==0||(n.flags&a)!==0?Sd=5:(Sd=0,wd=Cd=null,uf(t,t.pendingLanes)),a=t.pendingLanes,a===0&&(xd=null),Et(r),n=n.stateNode,it&&typeof it.onCommitFiberRoot==`function`)try{it.onCommitFiberRoot(rt,n,void 0,(n.current.flags&128)==128)}catch{}if(i!==null){n=D.T,a=O.p,O.p=2,D.T=null;try{for(var o=t.onRecoverableError,s=0;s<i.length;s++){var c=i[s];o(c.value,{componentStack:c.stack})}}finally{D.T=n,O.p=a}}if(i=kd,o=Ad,Ad=null,i!==null&&(kd=null,o===null&&(o=[]),e!==null))for(c=0;c<i.length;c++)n=(0,i[c])(o),n!==void 0&&e.finished.finally(n);Td&3&&df(),Ef(t),a=t.pendingLanes,r&261930&&a&42?t===Y?jd++:(jd=0,Y=t):(jd=0,Y=null),Df(0,!1)}}function uf(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,za(t)))}function df(){return Od!==null&&(Od.skipTransition(),Od=null),sf(),cf(),lf(),ff()}function ff(){if(Sd!==5)return!1;var e=Cd,t=Ed;Ed=0;var n=Et(Td),r=D.T,i=O.p;try{O.p=32>n?32:n,D.T=null,n=J,J=null;var a=Cd,s=Td;if(Sd=0,wd=Cd=null,Td=0,H&6)throw Error(o(331));var c=H;if(H|=4,$u(a.current),Gu(a,a.current,s,n),H=c,Df(0,!1),it&&typeof it.onPostCommitFiberRoot==`function`)try{it.onPostCommitFiberRoot(rt,a)}catch{}return!0}finally{O.p=i,D.T=r,uf(e,t)}}function pf(e,t,n){t=Yi(n,t),t=Pc(e.stateNode,t,2),e=wo(e,t,2),e!==null&&(bt(e,2),Ef(e))}function Z(e,t,n){if(e.tag===3)pf(e,e,n);else for(;t!==null;){if(t.tag===3){pf(t,e,n);break}if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(xd===null||!xd.has(r))){e=Yi(n,e),n=Fc(2),r=wo(t,n,2),r!==null&&(Ic(n,r,t,e),bt(r,2),Ef(r));break}}t=t.return}}function mf(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new rd;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(sd=!0,i.add(n),e=hf.bind(null,e,t,n),t.then(e,e))}function hf(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,U===e&&(G&n)===n&&(q===4||q===3&&(G&62914560)===G&&300>Je()-_d?H&2?dd|=n:Vd(e,0):dd|=n,pd===G&&(pd=0)),Ef(e)}function gf(e,t){t===0&&(t=vt()),e=Pi(e,t),e!==null&&(bt(e,t),Ef(e))}function _f(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),gf(e,n)}function vf(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(o(314))}r!==null&&r.delete(t),gf(e,n)}function yf(e,t){return We(e,t)}var bf=null,xf=null,Sf=!1,Cf=!1,wf=!1,Tf=0;function Ef(e){e!==xf&&e.next===null&&(xf===null?bf=xf=e:xf=xf.next=e),Cf=!0,Sf||(Sf=!0,Nf())}function Df(e,t){if(!wf&&Cf){wf=!0;do for(var n=!1,r=bf;r!==null;){if(!t){if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-ot(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,Mf(r,a))}else a=G,a=mt(r,r===U?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||ht(r,a)||(n=!0,Mf(r,a))}r=r.next}while(n);wf=!1}}function Of(){kf()}function kf(){Cf=Sf=!1;var e=0;Tf!==0&&hp()&&(e=Tf);for(var t=Je(),n=null,r=bf;r!==null;){var i=r.next,a=Af(r,t);a===0?(r.next=null,n===null?bf=i:n.next=i,i===null&&(xf=n)):(n=r,(e!==0||a&3)&&(Cf=!0)),r=i}Sd!==0&&Sd!==5||Df(e,!1),Tf!==0&&(Tf=0)}function Af(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-ot(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=_t(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=U,n=G,n=mt(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(K===2||K===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&Ge(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||ht(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&Ge(r),Et(n)){case 2:case 8:n=Ze;break;case 32:n=Qe;break;case 268435456:n=et;break;default:n=Qe}return r=jf.bind(null,e),n=We(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&Ge(r),e.callbackPriority=2,e.callbackNode=null,2}function jf(e,t){if(Sd!==0&&Sd!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(df()&&e.callbackNode!==n)return null;var r=G;return r=mt(e,e===U?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(Fd(e,r,t),Af(e,Je()),e.callbackNode!=null&&e.callbackNode===n?jf.bind(null,e):null)}function Mf(e,t){if(df())return null;Fd(e,t,!0)}function Nf(){bp(function(){H&6?We(Xe,Of):kf()})}function Pf(){if(Tf===0){var e=Ga;e===0&&(e=ut,ut<<=1,!(ut&261888)&&(ut=256)),Tf=e}return Tf}function Ff(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:Tn(e)}function If(e,t,n,r,i){if(t===`submit`&&n&&n.stateNode===i){var a=Ff((i[jt]||null).action),o=r.submitter;o&&(t=(t=o[jt]||null)?Ff(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new qn(`action`,`action`,null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(Tf!==0){var e=new FormData(i,o);oc(n,{pending:!0,data:e,method:i.method,action:a},null,e)}}else typeof a==`function`&&(s.preventDefault(),e=new FormData(i,o),oc(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var Lf=0;Lf<bi.length;Lf++){var Rf=bi[Lf];xi(Rf.toLowerCase(),`on`+(Rf[0].toUpperCase()+Rf.slice(1)))}xi(fi,`onAnimationEnd`),xi(pi,`onAnimationIteration`),xi(mi,`onAnimationStart`),xi(`dblclick`,`onDoubleClick`),xi(`focusin`,`onFocus`),xi(`focusout`,`onBlur`),xi(hi,`onTransitionRun`),xi(gi,`onTransitionStart`),xi(_i,`onTransitionCancel`),xi(vi,`onTransitionEnd`),Yt(`onMouseEnter`,[`mouseout`,`mouseover`]),Yt(`onMouseLeave`,[`mouseout`,`mouseover`]),Yt(`onPointerEnter`,[`pointerout`,`pointerover`]),Yt(`onPointerLeave`,[`pointerout`,`pointerover`]),Jt(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),Jt(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),Jt(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),Jt(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),Jt(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),Jt(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var zf=`abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting`.split(` `),Bf=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(zf));function Vf(e,t){t=!!(t&4);for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;a:{var a=void 0;if(t)for(var o=r.length-1;0<=o;o--){var s=r[o],c=s.instance,l=s.currentTarget;if(s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Ei(e)}i.currentTarget=null,a=c}else for(o=0;o<r.length;o++){if(s=r[o],c=s.instance,l=s.currentTarget,s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Ei(e)}i.currentTarget=null,a=c}}}}function Q(e,t){var n=t[Nt];n===void 0&&(n=t[Nt]=new Set);var r=e+`__bubble`;n.has(r)||(Gf(t,e,2,!1),n.add(r))}function Hf(e,t,n){var r=0;t&&(r|=4),Gf(n,e,r,t)}var Uf=`_reactListening`+Math.random().toString(36).slice(2);function Wf(e){if(!e[Uf]){e[Uf]=!0,Kt.forEach(function(t){t!==`selectionchange`&&(Bf.has(t)||Hf(t,!1,e),Hf(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Uf]||(t[Uf]=!0,Hf(`selectionchange`,!1,t))}}function Gf(e,t,n,r){switch(Ch(t)){case 2:var i=_h;break;case 8:i=vh;break;default:i=yh}n=i.bind(null,t,n,e),i=void 0,!In||t!==`touchstart`&&t!==`touchmove`&&t!==`wheel`||(i=!0),r?i===void 0?e.addEventListener(t,n,!0):e.addEventListener(t,n,{capture:!0,passive:i}):i===void 0?e.addEventListener(t,n,!1):e.addEventListener(t,n,{passive:i})}function Kf(e,t,n,r,i){var a=r;if(!(t&1)&&!(t&2)&&r!==null)a:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var s=r.stateNode.containerInfo;if(s===i)break;if(o===4)for(o=r.return;o!==null;){var l=o.tag;if((l===3||l===4)&&o.stateNode.containerInfo===i)return;o=o.return}for(;s!==null;){if(o=Bt(s),o===null)return;if(l=o.tag,l===5||l===6||l===26||l===27){r=a=o;continue a}s=s.parentNode}}r=r.return}Nn(function(){var r=a,i=On(n),o=[];a:{var s=yi.get(e);if(s!==void 0){var l=qn,u=e;switch(e){case`keypress`:if(Hn(n)===0)break a;case`keydown`:case`keyup`:l=ur;break;case`focusin`:u=`focus`,l=tr;break;case`focusout`:u=`blur`,l=tr;break;case`beforeblur`:case`afterblur`:l=tr;break;case`click`:if(n.button===2)break a;case`auxclick`:case`dblclick`:case`mousedown`:case`mousemove`:case`mouseup`:case`mouseout`:case`mouseover`:case`contextmenu`:l=$n;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:l=er;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:l=pr;break;case fi:case pi:case mi:l=nr;break;case vi:l=mr;break;case`scroll`:case`scrollend`:l=Yn;break;case`wheel`:l=hr;break;case`copy`:case`cut`:case`paste`:l=rr;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:l=dr;break;case`submit`:l=fr;break;case`toggle`:case`beforetoggle`:l=gr}var d=!!(t&4),f=!d&&(e===`scroll`||e===`scrollend`),p=d?s===null?null:s+`Capture`:s;d=[];for(var m=r,h;m!==null;){var g=m;if(h=g.stateNode,g=g.tag,g!==5&&g!==26&&g!==27||h===null||p===null||(g=Pn(m,p),g!=null&&d.push(qf(m,g,h))),f)break;m=m.return}0<d.length&&(s=new l(s,u,null,n,i),o.push({event:s,listeners:d}))}}if(!(t&7)){a:{if(l=e===`mouseover`||e===`pointerover`,s=e===`mouseout`||e===`pointerout`,l&&n!==Dn&&(u=n.relatedTarget||n.fromElement)&&(Bt(u)||u[Mt]))break a;(s||l)&&(u=i.window===i?i:(l=i.ownerDocument)?l.defaultView||l.parentWindow:window,s?(l=n.relatedTarget||n.toElement,s=r,l=l?Bt(l):null,l!==null&&(f=c(l),d=l.tag,l!==f||d!==5&&d!==27&&d!==6)&&(l=null)):(s=null,l=r),s!==l&&(d=$n,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=dr,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=s==null?u:Ht(s),h=l==null?u:Ht(l),u=new d(g,m+`leave`,s,n,i),u.target=f,u.relatedTarget=h,g=null,Bt(i)===r&&(d=new d(p,m+`enter`,l,n,i),d.target=h,d.relatedTarget=f,g=d),f=g,d=s&&l?ee(s,l,Yf):null,s!==null&&Xf(o,u,s,d,!1),l!==null&&f!==null&&Xf(o,f,l,d,!0)))}a:{if(s=r?Ht(r):window,l=s.nodeName&&s.nodeName.toLowerCase(),l===`select`||l===`input`&&s.type===`file`)var _=Fr;else if(Ar(s)){if(Ir)_=Gr;else{_=Ur;var v=Hr}}else l=s.nodeName,!l||l.toLowerCase()!==`input`||s.type!==`checkbox`&&s.type!==`radio`?r&&Sn(r.elementType)&&(_=Fr):_=Wr;if(_&&=_(e,r)){jr(o,_,n,i);break a}v&&v(e,s,r)}switch(v=r?Ht(r):window,e){case`focusin`:(Ar(v)||v.contentEditable===`true`)&&(ni=v,ri=r,ii=null);break;case`focusout`:ii=ri=ni=null;break;case`mousedown`:ai=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:ai=!1,oi(o,n,i);break;case`selectionchange`:if(ti)break;case`keydown`:case`keyup`:oi(o,n,i)}var y;if(vr)b:{switch(e){case`compositionstart`:var b=`onCompositionStart`;break b;case`compositionend`:b=`onCompositionEnd`;break b;case`compositionupdate`:b=`onCompositionUpdate`;break b}b=void 0}else Er?wr(e,n)&&(b=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(b=`onCompositionStart`);b&&(xr&&n.locale!==`ko`&&(Er||b!==`onCompositionStart`?b===`onCompositionEnd`&&Er&&(y=Vn()):(Rn=i,zn=`value`in Rn?Rn.value:Rn.textContent,Er=!0)),v=Jf(r,b),0<v.length&&(b=new ir(b,e,null,n,i),o.push({event:b,listeners:v}),y?b.data=y:(y=Tr(n),y!==null&&(b.data=y)))),(y=br?Dr(e,n):Or(e,n))&&(b=Jf(r,`onBeforeInput`),0<b.length&&(v=new ir(`onBeforeInput`,`beforeinput`,null,n,i),o.push({event:v,listeners:b}),v.data=y)),If(o,e,r,n,i)}Vf(o,t)})}function qf(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Jf(e,t){for(var n=t+`Capture`,r=[];e!==null;){var i=e,a=i.stateNode;if(i=i.tag,i!==5&&i!==26&&i!==27||a===null||(i=Pn(e,n),i!=null&&r.unshift(qf(e,i,a)),i=Pn(e,t),i!=null&&r.push(qf(e,i,a))),e.tag===3)return r;e=e.return}return[]}function Yf(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Xf(e,t,n,r,i){for(var a=t._reactName,o=[];n!==null&&n!==r;){var s=n,c=s.alternate,l=s.stateNode;if(s=s.tag,c!==null&&c===r)break;s!==5&&s!==26&&s!==27||l===null||(c=l,i?(l=Pn(n,a),l!=null&&o.unshift(qf(n,l,c))):i||(l=Pn(n,a),l!=null&&o.push(qf(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var Zf=/\r\n?/g,Qf=/\u0000|\uFFFD/g;function $f(e){return(typeof e==`string`?e:``+e).replace(Zf,`
|
|
11
|
+
`).replace(Qf,``)}function ep(e,t){return t=$f(t),$f(e)===t}function $(e,t,n,r,i,a){switch(n){case`children`:if(typeof r==`string`)t===`body`||t===`textarea`&&r===``||vn(e,r);else if(typeof r==`number`||typeof r==`bigint`)t!==`body`&&vn(e,``+r);else return;break;case`className`:nn(e,`class`,r);break;case`tabIndex`:nn(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:nn(e,n,r);break;case`style`:xn(e,r,a);return;case`data`:if(t!==`object`){nn(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)||r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Tn(r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')`);break}if(typeof a==`function`&&(n===`formAction`?(t!==`input`&&$(e,t,`name`,i.name,i,null),$(e,t,`formEncType`,i.formEncType,i,null),$(e,t,`formMethod`,i.formMethod,i,null),$(e,t,`formTarget`,i.formTarget,i,null)):($(e,t,`encType`,i.encType,i,null),$(e,t,`method`,i.method,i,null),$(e,t,`target`,i.target,i,null))),r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Tn(r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=En);return;case`onScroll`:r!=null&&Q(`scroll`,e);return;case`onScrollEnd`:r!=null&&Q(`scrollend`,e);return;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(o(61));if(n=r.__html,n!=null){if(i.children!=null)throw Error(o(60));a?.__html!==n&&(e.innerHTML=n)}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=Tn(r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`inert`:case`allowFullScreen`:case`async`:case`autoPlay`:case`controls`:case`credentialless`:case`default`:case`defer`:case`disabled`:case`disablePictureInPicture`:case`disableRemotePlayback`:case`formNoValidate`:case`hidden`:case`loop`:case`noModule`:case`noValidate`:case`open`:case`playsInline`:case`readOnly`:case`required`:case`reversed`:case`scoped`:case`seamless`:case`itemScope`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:Q(`beforetoggle`,e),Q(`toggle`,e),tn(e,`popover`,r);break;case`xlinkActuate`:rn(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:rn(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:rn(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:rn(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:rn(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:rn(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:rn(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:rn(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:rn(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:tn(e,`is`,r);break;case`innerText`:case`textContent`:return;default:if(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)n=Cn.get(n)||n,tn(e,n,r);else return}A=!0}function tp(e,t,n,r,i,a){switch(n){case`style`:xn(e,r,a);return;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(o(61));if(n=r.__html,n!=null){if(i.children!=null)throw Error(o(60));a?.__html!==n&&(e.innerHTML=n)}}break;case`children`:if(typeof r==`string`)vn(e,r);else if(typeof r==`number`||typeof r==`bigint`)vn(e,``+r);else return;break;case`onScroll`:r!=null&&Q(`scroll`,e);return;case`onScrollEnd`:r!=null&&Q(`scrollend`,e);return;case`onClick`:r!=null&&(e.onclick=En);return;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:return;case`innerText`:case`textContent`:return;default:if(!qt.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(i=n.endsWith(`Capture`),a=n.slice(2,i?n.length-7:void 0),t=e[jt]||null,t=t==null?null:t[n],typeof t==`function`&&e.removeEventListener(a,t,i),typeof r==`function`)){typeof t!=`function`&&t!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(a,r,i);break a}A=!0,n in e?e[n]=r:!0===r?e.setAttribute(n,``):tn(e,n,r)}return}A=!0}function np(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:Q(`error`,e),Q(`load`,e);var r=!1,i=!1,a;for(a in n)if(n.hasOwnProperty(a)){var s=n[a];if(s!=null)switch(a){case`src`:r=!0;break;case`srcSet`:i=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(o(137,t));default:$(e,t,a,s,n,null)}}i&&$(e,t,`srcSet`,n.srcSet,n,null),r&&$(e,t,`src`,n.src,n,null);return;case`input`:Q(`invalid`,e);var c=a=s=i=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case`name`:i=d;break;case`type`:s=d;break;case`checked`:l=d;break;case`defaultChecked`:u=d;break;case`value`:a=d;break;case`defaultValue`:c=d;break;case`children`:case`dangerouslySetInnerHTML`:if(d!=null)throw Error(o(137,t));break;default:$(e,t,r,d,n,null)}}pn(e,a,c,l,u,s,i,!1);return;case`select`:for(i in Q(`invalid`,e),r=s=a=null,n)if(n.hasOwnProperty(i)&&(c=n[i],c!=null))switch(i){case`value`:a=c;break;case`defaultValue`:s=c;break;case`multiple`:r=c;default:$(e,t,i,c,n,null)}t=a,n=s,e.multiple=!!r,t==null?n!=null&&hn(e,!!r,n,!0):hn(e,!!r,t,!1);return;case`textarea`:for(s in Q(`invalid`,e),a=i=r=null,n)if(n.hasOwnProperty(s)&&(c=n[s],c!=null))switch(s){case`value`:r=c;break;case`defaultValue`:i=c;break;case`children`:a=c;break;case`dangerouslySetInnerHTML`:if(c!=null)throw Error(o(91));break;default:$(e,t,s,c,n,null)}_n(e,r,i,a);return;case`option`:for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case`selected`:e.selected=r&&typeof r!=`function`&&typeof r!=`symbol`;break;default:$(e,t,l,r,n,null)}return;case`dialog`:Q(`beforetoggle`,e),Q(`toggle`,e),Q(`cancel`,e),Q(`close`,e);break;case`iframe`:case`object`:Q(`load`,e);break;case`video`:case`audio`:for(r=0;r<zf.length;r++)Q(zf[r],e);break;case`image`:Q(`error`,e),Q(`load`,e);break;case`details`:Q(`toggle`,e);break;case`embed`:case`source`:case`link`:Q(`error`,e),Q(`load`,e);case`area`:case`base`:case`br`:case`col`:case`hr`:case`keygen`:case`meta`:case`param`:case`track`:case`wbr`:case`menuitem`:for(u in n)if(n.hasOwnProperty(u)&&(r=n[u],r!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:throw Error(o(137,t));default:$(e,t,u,r,n,null)}return;default:if(Sn(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&tp(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&$(e,t,c,r,n,null))}var rp={};function ip(e,t,n,r){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`input`:var i=null,a=null,s=null,c=null,l=null,u=null,d=null;for(m in n){var f=n[m];if(n.hasOwnProperty(m)&&f!=null)switch(m){case`checked`:break;case`value`:break;case`defaultValue`:l=f;default:r.hasOwnProperty(m)||$(e,t,m,null,r,f)}}for(var p in r){var m=r[p];if(f=n[p],r.hasOwnProperty(p)&&(m!=null||f!=null))switch(p){case`type`:m!==f&&(A=!0),a=m;break;case`name`:m!==f&&(A=!0),i=m;break;case`checked`:m!==f&&(A=!0),u=m;break;case`defaultChecked`:m!==f&&(A=!0),d=m;break;case`value`:m!==f&&(A=!0),s=m;break;case`defaultValue`:m!==f&&(A=!0),c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(o(137,t));break;default:m!==f&&$(e,t,p,m,r,f)}}fn(e,s,c,l,u,d,a,i);return;case`select`:for(a in m=s=c=p=null,n)if(l=n[a],n.hasOwnProperty(a)&&l!=null)switch(a){case`value`:break;case`multiple`:m=l;default:r.hasOwnProperty(a)||$(e,t,a,null,r,l)}for(i in r)if(a=r[i],l=n[i],r.hasOwnProperty(i)&&(a!=null||l!=null))switch(i){case`value`:a!==l&&(A=!0),p=a;break;case`defaultValue`:a!==l&&(A=!0),c=a;break;case`multiple`:a!==l&&(A=!0),s=a;default:a!==l&&$(e,t,i,a,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?hn(e,!!n,n?[]:``,!1):hn(e,!!n,t,!0)):hn(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(i=n[c],n.hasOwnProperty(c)&&i!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:$(e,t,c,null,r,i)}for(s in r)if(i=r[s],a=n[s],r.hasOwnProperty(s)&&(i!=null||a!=null))switch(s){case`value`:i!==a&&(A=!0),p=i;break;case`defaultValue`:i!==a&&(A=!0),m=i;break;case`children`:break;case`dangerouslySetInnerHTML`:if(i!=null)throw Error(o(91));break;default:i!==a&&$(e,t,s,i,r,a)}gn(e,p,m);return;case`option`:for(var h in n)if(p=n[h],n.hasOwnProperty(h)&&p!=null&&!r.hasOwnProperty(h))switch(h){case`selected`:e.selected=!1;break;default:$(e,t,h,null,r,p)}for(l in r)if(p=r[l],m=n[l],r.hasOwnProperty(l)&&p!==m&&(p!=null||m!=null))switch(l){case`selected`:p!==m&&(A=!0),e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:$(e,t,l,p,r,m)}return;case`img`:case`link`:case`area`:case`base`:case`br`:case`col`:case`embed`:case`hr`:case`keygen`:case`meta`:case`param`:case`source`:case`track`:case`wbr`:case`menuitem`:for(var g in n)p=n[g],n.hasOwnProperty(g)&&p!=null&&!r.hasOwnProperty(g)&&$(e,t,g,null,r,p);for(u in r)if(p=r[u],m=n[u],r.hasOwnProperty(u)&&p!==m&&(p!=null||m!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:if(p!=null)throw Error(o(137,t));break;default:$(e,t,u,p,r,m)}return;default:if(Sn(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&tp(e,t,_,void 0,r,p);for(d in r)p=r[d],m=n[d],!r.hasOwnProperty(d)||p===m||p===void 0&&m===void 0||tp(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&$(e,t,v,null,r,p);for(f in r)p=r[f],m=n[f],!r.hasOwnProperty(f)||p===m||p==null&&m==null||$(e,t,f,p,r,m)}function ap(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function op(){if(typeof performance.getEntriesByType==`function`){for(var e=0,t=0,n=performance.getEntriesByType(`resource`),r=0;r<n.length;r++){var i=n[r],a=i.transferSize,o=i.initiatorType,s=i.duration;if(a&&s&&ap(o)){for(o=0,s=i.responseEnd,r+=1;r<n.length;r++){var c=n[r],l=c.startTime;if(l>s)break;var u=c.transferSize,d=c.initiatorType;u&&ap(d)&&(c=c.responseEnd,o+=u*(c<s?1:(s-l)/(c-l)))}if(--r,t+=8*(a+o)/(i.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e==`number`)?e:5}var sp=null,cp=null;function lp(e){return e.nodeType===9?e:e.ownerDocument}function up(e){switch(e){case`http://www.w3.org/2000/svg`:return 1;case`http://www.w3.org/1998/Math/MathML`:return 2;default:return 0}}function dp(e,t){if(e===0)switch(t){case`svg`:return 1;case`math`:return 2;default:return 0}return e===1&&t===`foreignObject`?0:e}function fp(e,t,n,r){return n=lp(n).createElement(e),n[At]=r,n[jt]=t,np(n,e,t),Wt(n),n}function pp(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.children==`bigint`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var mp=null;function hp(){var e=window.event;return e&&e.type===`popstate`?e!==mp&&(mp=e,!0):(mp=null,!1)}var gp=typeof setTimeout==`function`?setTimeout:void 0,_p=typeof clearTimeout==`function`?clearTimeout:void 0,vp=typeof Promise==`function`?Promise:void 0,yp=typeof requestAnimationFrame==`function`?requestAnimationFrame:gp,bp=typeof queueMicrotask==`function`?queueMicrotask:vp===void 0?gp:function(e){return vp.resolve(null).then(e).catch(xp)};function xp(e){setTimeout(function(){throw e})}function Sp(e){return e===`head`}function Cp(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8){if(n=i.data,n===`/$`||n===`/&`){if(r===0){e.removeChild(i),Hh(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)_m(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,_m(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[Lt]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&_m(e.ownerDocument.body)}n=i}while(n);Hh(t)}function wp(e,t){var n=e;e=0;do{var r=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display=`none`):(n.style.display=n._stashedDisplay||``,n.getAttribute(`style`)===``&&n.removeAttribute(`style`)):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=``):n.nodeValue=n._stashedText||``),r&&r.nodeType===8){if(n=r.data,n===`/$`){if(e===0)break;e--}else n!==`$`&&n!==`$?`&&n!==`$~`&&n!==`$!`||e++}n=r}while(n)}function Tp(e,t,n){if(t=CSS.escape(t)===t?t:`r-`+btoa(t).replace(/=/g,``),e.style.viewTransitionName=t,n!=null&&(e.style.viewTransitionClass=n),n=getComputedStyle(e),n.display===`inline`){if(t=e.getClientRects(),t.length===1)var r=1;else for(var i=r=0;i<t.length;i++){var a=t[i];0<a.width&&0<a.height&&r++}r===1&&(e=e.style,e.display=t.length===1?`inline-block`:`block`,e.marginTop=`-`+n.paddingTop,e.marginBottom=`-`+n.paddingBottom)}}function Ep(e,t){e=e.style,t=t.style;var n=t==null?null:t.hasOwnProperty(`viewTransitionName`)?t.viewTransitionName:t.hasOwnProperty(`view-transition-name`)?t[`view-transition-name`]:null;e.viewTransitionName=n==null||typeof n==`boolean`?``:(``+n).trim(),n=t==null?null:t.hasOwnProperty(`viewTransitionClass`)?t.viewTransitionClass:t.hasOwnProperty(`view-transition-class`)?t[`view-transition-class`]:null,e.viewTransitionClass=n==null||typeof n==`boolean`?``:(``+n).trim(),e.display===`inline-block`&&(t==null?e.display=e.margin=``:(n=t.display,e.display=n==null||typeof n==`boolean`?``:n,n=t.margin,n==null?(n=t.hasOwnProperty(`marginTop`)?t.marginTop:t[`margin-top`],e.marginTop=n==null||typeof n==`boolean`?``:n,t=t.hasOwnProperty(`marginBottom`)?t.marginBottom:t[`margin-bottom`],e.marginBottom=t==null||typeof t==`boolean`?``:t):e.margin=n))}function Dp(e,t,n){return n=n.ownerDocument.defaultView,{rect:e,abs:t.position===`absolute`||t.position===`fixed`,clip:t.clipPath!==`none`||t.overflow!==`visible`||t.filter!==`none`||t.mask!==`none`||t.mask!==`none`||t.borderRadius!==`0px`,view:0<=e.bottom&&0<=e.right&&e.top<=n.innerHeight&&e.left<=n.innerWidth}}function Op(e){return Dp(e.getBoundingClientRect(),getComputedStyle(e),e)}function kp(e){var t=e.getBoundingClientRect();t=new DOMRect(t.x+2e4,t.y+2e4,t.width,t.height);var n=getComputedStyle(e);return Dp(t,n,e)}function Ap(e){return e.documentElement.clientHeight}function jp(e){this.addEventListener(`load`,e),this.addEventListener(`error`,e)}function Mp(e,t,n,r,i,a,o,s,c){var l=t.nodeType===9?t:t.ownerDocument;try{var u=l.startViewTransition({update:function(){var t=l.defaultView,n=t.navigation&&t.navigation.transition,o=l.fonts.status;r();var s=[];if(o===`loaded`&&(Ap(l),l.fonts.status===`loading`&&s.push(l.fonts.ready)),o=s.length,e!==null)for(var c=e.suspenseyImages,u=0,d=0;d<c.length;d++){var f=c[d];if(!f.complete){var p=f.getBoundingClientRect();if(0<p.bottom&&0<p.right&&p.top<t.innerHeight&&p.left<t.innerWidth){if(u+=Xm(f),u>$m){s.length=o;break}f=new Promise(jp.bind(f)),s.push(f)}}}if(0<s.length)return t=Promise.race([Promise.all(s),new Promise(function(e){return setTimeout(e,500)})]).then(i,i),(n?Promise.allSettled([n.finished,t]):t).then(a,a);if(i(),n)return n.finished.then(a,a);a()},types:n});l.__reactViewTransition=u;var d=[];return u.ready.then(function(){for(var e=l.documentElement.getAnimations({subtree:!0}),t=0;t<e.length;t++){var n=e[t],r=n.effect,i=r.pseudoElement;if(i!=null&&i.startsWith(`::view-transition`)){d.push(n),n=r.getKeyframes();for(var a=i=void 0,s=!0,c=0;c<n.length;c++){var u=n[c],f=u.width;if(i===void 0)i=f;else if(i!==f){s=!1;break}if(f=u.height,a===void 0)a=f;else if(a!==f){s=!1;break}delete u.width,delete u.height,u.transform===`none`&&delete u.transform}s&&i!==void 0&&a!==void 0&&(r.setKeyframes(n),s=getComputedStyle(r.target,r.pseudoElement),s.width!==i||s.height!==a)&&(s=n[0],s.width=i,s.height=a,s=n[n.length-1],s.width=i,s.height=a,r.setKeyframes(n))}}o()},function(e){l.__reactViewTransition===u&&(l.__reactViewTransition=null);try{if(typeof e==`object`&&e)switch(e.name){case`InvalidStateError`:(e.message===`View transition was skipped because document visibility state is hidden.`||e.message===`Skipping view transition because document visibility state has become hidden.`||e.message===`Skipping view transition because viewport size changed.`||e.message===`Transition was aborted because of invalid state`)&&(e=null)}e!==null&&c(e)}finally{r(),i(),o()}}),u.finished.finally(function(){for(var e=0;e<d.length;e++)d[e].cancel();l.__reactViewTransition===u&&(l.__reactViewTransition=null),s()}),u}catch{return r(),i(),o(),null}}function Np(e,t){this._scope=document.documentElement,this._selector=`::view-transition-`+e+`(`+t+`)`}Np.prototype.animate=function(e,t){return t=typeof t==`number`?{duration:t}:T({},t),t.pseudoElement=this._selector,this._scope.animate(e,t)},Np.prototype.getAnimations=function(){for(var e=this._scope,t=this._selector,n=e.getAnimations({subtree:!0}),r=[],i=0;i<n.length;i++){var a=n[i].effect;a!==null&&a.target===e&&a.pseudoElement===t&&r.push(n[i])}return r},Np.prototype.getComputedStyle=function(){return getComputedStyle(this._scope,this._selector)};function Pp(e){return{name:e,group:new Np(`group`,e),imagePair:new Np(`image-pair`,e),old:new Np(`old`,e),new:new Np(`new`,e)}}function Fp(e){this._fragmentFiber=e,this._observers=this._eventListeners=null}Fp.prototype.addEventListener=function(e,t,n){var r=null,i=null;if(!(n!=null&&typeof n!=`boolean`&&(r=n.signal||null,r!==null&&r.aborted))){this._eventListeners===null&&(this._eventListeners=[]);var a=this._eventListeners;if(Bp(a,e,t,n)===-1){var o=this,s=t;n!=null&&typeof n!=`boolean`&&!0===n.once&&(s=function(r){o.removeEventListener(e,t,n),typeof t==`function`?t.call(this,r):t.handleEvent(r)}),r!==null&&(i=o.removeEventListener.bind(o,e,t,n),r.addEventListener(`abort`,i,{once:!0}),i=r.removeEventListener.bind(r,`abort`,i)),r=Rp(n),a.push({type:e,listener:t,optionsOrUseCapture:n,attachedListener:s,cleanup:i}),m(this._fragmentFiber.child,!1,Ip,e,s,r)}this._eventListeners=a}};function Ip(e,t,n,r){return y(e).addEventListener(t,n,r),!1}Fp.prototype.removeEventListener=function(e,t,n){var r=this._eventListeners;if(r!==null&&(t=Bp(r,e,t,n),t!==-1)){var i=r[t];n=i.attachedListener;var a=i.cleanup;i=Rp(i.optionsOrUseCapture),m(this._fragmentFiber.child,!1,Lp,e,n,i),r.splice(t,1),a!==null&&a()}};function Lp(e,t,n,r){return y(e).removeEventListener(t,n,r),!1}function Rp(e){return e!=null&&typeof e!=`boolean`&&(!0===e.once||e.signal instanceof AbortSignal)?{capture:e.capture,passive:e.passive}:e}function zp(e){return e==null?`c=0`:typeof e==`boolean`?`c=`+(e?`1`:`0`):`c=`+(e.capture?`1`:`0`)}function Bp(e,t,n,r){if(e.length===0)return-1;r=zp(r);for(var i=0;i<e.length;i++){var a=e[i];if(a.type===t&&a.listener===n&&zp(a.optionsOrUseCapture)===r)return i}return-1}Fp.prototype.dispatchEvent=function(e){var t=h(this._fragmentFiber);if(t===null)return!0;t=y(t);var n=this._eventListeners;if(n!==null&&0<n.length||!e.bubbles){var r=t.nodeType===9?t.createComment(``):document.createTextNode(``);if(n)for(var i=0;i<n.length;i++){var a=n[i];r.addEventListener(a.type,a.attachedListener,Rp(a.optionsOrUseCapture))}if(t.appendChild(r),e=r.dispatchEvent(e),n)for(i=0;i<n.length;i++)a=n[i],r.removeEventListener(a.type,a.attachedListener,Rp(a.optionsOrUseCapture));return t.removeChild(r),e}return t.dispatchEvent(e)},Fp.prototype.focus=function(e){m(this._fragmentFiber.child,!0,Vp,e,void 0,void 0)};function Vp(e,t){return e.tag!==6&&(e=y(e),pm(e,t))}Fp.prototype.focusLast=function(e){var t=[];m(this._fragmentFiber.child,!0,Hp,t,void 0,void 0);for(var n=t.length-1;0<=n&&!Vp(t[n],e);n--);};function Hp(e,t){return t.push(e),!1}Fp.prototype.blur=function(){var e=h(this._fragmentFiber);e!==null&&(e=y(e),e=lp(e).activeElement,e!==null&&m(this._fragmentFiber.child,!1,Up,e,void 0,void 0))};function Up(e,t){return e.tag!==6&&(e=y(e),e===t||e.contains(t)?(t.blur(),!0):!1)}Fp.prototype.observeUsing=function(e){this._observers===null&&(this._observers=new Set),this._observers.add(e),m(this._fragmentFiber.child,!1,Wp,e,void 0,void 0)};function Wp(e,t){return e.tag===6||(e=y(e),t.observe(e)),!1}Fp.prototype.unobserveUsing=function(e){var t=this._observers;if(t!==null&&t.has(e)){t.delete(e),m(this._fragmentFiber.child,!1,Gp,e,void 0,void 0);for(var n=t=0;n<Kp.length;n++){var r=Kp[n];r.fragmentInstance===this&&r.observer===e?e.unobserve(r.instance):Kp[t++]=r}Kp.length=t}};function Gp(e,t){return e.tag===6||(e=y(e),t.unobserve(e)),!1}var Kp=[],qp=!1;function Jp(e,t,n){Kp.push({fragmentInstance:e,observer:t,instance:n}),qp||(qp=!0,mm(function(){qp=!1;var e=Kp;Kp=[];for(var t=0;t<e.length;t++){var n=e[t];n.observer.unobserve(n.instance)}}))}Fp.prototype.getClientRects=function(){var e=[];return m(this._fragmentFiber.child,!1,Yp,e,void 0,void 0),e};function Yp(e,t){if(e.tag===6){e=e.stateNode;var n=e.ownerDocument.createRange();n.selectNodeContents(e),t.push.apply(t,n.getClientRects())}else e=y(e),t.push.apply(t,e.getClientRects());return!1}Fp.prototype.getRootNode=function(e){var t=h(this._fragmentFiber);return t===null?this:y(t).getRootNode(e)},Fp.prototype.compareDocumentPosition=function(e){var t=h(this._fragmentFiber);if(t===null)return Node.DOCUMENT_POSITION_DISCONNECTED;var n=[];m(this._fragmentFiber.child,!1,Hp,n,void 0,void 0);var r=y(t);if(n.length===0){if(n=r,g(this._fragmentFiber)){a:{for(t=this._fragmentFiber.return;t!==null;){if(t.tag===4){t=t.stateNode.containerInfo;break a}if(t.tag===3||t.tag===5||t.tag===27)break;t=t.return}t=null}t!=null&&(n=t)}t=this._fragmentFiber;var i=r=n.compareDocumentPosition(e);return n===e?i=Node.DOCUMENT_POSITION_CONTAINS:r&Node.DOCUMENT_POSITION_CONTAINED_BY&&(n=_(t)[1],n===null?i=Node.DOCUMENT_POSITION_PRECEDING:(e=y(n).compareDocumentPosition(e),i=e===0||e&Node.DOCUMENT_POSITION_FOLLOWING?Node.DOCUMENT_POSITION_FOLLOWING:Node.DOCUMENT_POSITION_PRECEDING)),i|=Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC}t=y(n[0]),i=y(n[n.length-1]);var a=g(this._fragmentFiber)?t.parentElement:r;if(a==null)return Node.DOCUMENT_POSITION_DISCONNECTED;r=a.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_CONTAINED_BY,a=a.compareDocumentPosition(i)&Node.DOCUMENT_POSITION_CONTAINED_BY;var o=t.compareDocumentPosition(e),s=i.compareDocumentPosition(e),c=o&Node.DOCUMENT_POSITION_CONTAINED_BY||s&Node.DOCUMENT_POSITION_CONTAINED_BY;return s=r&&a&&o&Node.DOCUMENT_POSITION_FOLLOWING&&s&Node.DOCUMENT_POSITION_PRECEDING,t=r&&t===e||a&&i===e||c||s?Node.DOCUMENT_POSITION_CONTAINED_BY:!r&&t===e||!a&&i===e?Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:o,t&Node.DOCUMENT_POSITION_DISCONNECTED||t&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC||Xp(t,this._fragmentFiber,n[0],n[n.length-1],e)?t:Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC};function Xp(e,t,n,r,i){var a=Bt(i);if(e&Node.DOCUMENT_POSITION_CONTAINED_BY){if(n=!!a)a:{for(;a!==null;){if(a.tag===7&&(a===t||a.alternate===t)){n=!0;break a}a=a.return}n=!1}return n}if(e&Node.DOCUMENT_POSITION_CONTAINS){if(a===null)return a=i.ownerDocument,i===a||i===a.documentElement||i===a.body;a:{for(a=t,t=h(t);a!==null;){if(!(a.tag!==5&&a.tag!==3&&a.tag!==27||a!==t&&a.alternate!==t)){a=!0;break a}a=a.return}a=!1}return a}return e&Node.DOCUMENT_POSITION_PRECEDING?((t=!!a)&&!(t=a===n)&&(t=ee(n,a,w),t===null?t=!1:(m(t,!0,S,a,n),a=b,b=null,t=a!==null)),t):e&Node.DOCUMENT_POSITION_FOLLOWING?((t=!!a)&&!(t=a===r)&&(t=ee(r,a,w),t===null?t=!1:(m(t,!0,C,a,r),a=b,x=b=null,t=a!==null)),t):!1}function Zp(e,t){var n=e.ownerDocument.createRange();n.selectNodeContents(e),e=n.getBoundingClientRect(),window.scrollTo(window.scrollX+e.left,t?window.scrollY+e.top:window.scrollY+e.bottom-window.innerHeight)}Fp.prototype.scrollIntoView=function(e){if(typeof e==`object`)throw Error(o(566));var t=[];m(this._fragmentFiber.child,!1,Hp,t,void 0,void 0);var n=!1!==e;if(t.length===0){var r=_(this._fragmentFiber);if(r=n?r[1]||r[0]||h(this._fragmentFiber):r[0]||r[1],r===null)return;if(r.tag===6){e=y(r),Zp(e,n);return}if(r=y(r),r.nodeType!==9){if(r.nodeType===11){n=`host`in r?r.host:null,n!==null&&n.scrollIntoView(e);return}r.scrollIntoView(e)}}for(r=n?t.length-1:0;r!==(n?-1:t.length);){var i=t[r];i.tag===6?(i=y(i),Zp(i,n)):y(i).scrollIntoView(e),r+=n?-1:1}};function Qp(e,t){return e=y(e),$p(e,t),!1}function $p(e,t){e.reactFragments??=new Set,e.reactFragments.add(t)}function em(e,t){var n=t._eventListeners;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];e.addEventListener(i.type,i.attachedListener,Rp(i.optionsOrUseCapture))}e.nodeType!==3&&(n=t._observers,n!==null&&n.forEach(function(n){for(var r=0,i=0;i<Kp.length;i++){var a=Kp[i];(a.fragmentInstance!==t||a.observer!==n||a.instance!==e)&&(Kp[r++]=a)}Kp.length=r,n.observe(e)}),$p(e,t))}function tm(e,t){var n=t._eventListeners;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];e.removeEventListener(i.type,i.attachedListener,Rp(i.optionsOrUseCapture))}e.nodeType!==3&&(n=t._observers,n!==null&&n.forEach(function(n){typeof n.rootMargin==`string`?Jp(t,n,e):n.unobserve(e)}),e.reactFragments!=null&&e.reactFragments.delete(t))}function nm(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case`HTML`:case`HEAD`:case`BODY`:nm(n),zt(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function rm(e,t,n,r){for(;e.nodeType===1;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!==`INPUT`||e.type!==`hidden`))break}else if(!r){if(t===`input`&&e.type===`hidden`){var a=i.name==null?null:``+i.name;if(i.type===`hidden`&&e.getAttribute(`name`)===a)return e}else return e}else if(!e[Lt])switch(t){case`meta`:if(!e.hasAttribute(`itemprop`))break;return e;case`link`:if(a=e.getAttribute(`rel`),a===`stylesheet`&&e.hasAttribute(`data-precedence`)||a!==i.rel||e.getAttribute(`href`)!==(i.href==null||i.href===``?null:i.href)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute(`title`)!==(i.title==null?null:i.title))break;return e;case`style`:if(e.hasAttribute(`data-precedence`))break;return e;case`script`:if(a=e.getAttribute(`src`),(a!==(i.src==null?null:i.src)||e.getAttribute(`type`)!==(i.type==null?null:i.type)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin))&&a&&e.hasAttribute(`async`)&&!e.hasAttribute(`itemprop`))break;return e;default:return e}if(e=lm(e.nextSibling),e===null)break}return null}function im(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=lm(e.nextSibling),e===null))return null;return e}function am(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=lm(e.nextSibling),e===null))return null;return e}function om(e){return e.data===`$?`||e.data===`$~`}function sm(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function cm(e,t){var n=e.ownerDocument;if(e.data===`$~`)e._reactRetry=t;else if(e.data!==`$?`||n.readyState!==`loading`)t();else{var r=function(){t(),n.removeEventListener(`DOMContentLoaded`,r)};n.addEventListener(`DOMContentLoaded`,r),e._reactRetry=r}}function lm(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t===`$`||t===`$!`||t===`$?`||t===`$~`||t===`&`||t===`F!`||t===`F`)break;if(t===`/$`||t===`/&`)return null}}return e}var um=null;function dm(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return lm(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function fm(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`||n===`$~`||n===`&`){if(t===0)return e;t--}else n!==`/$`&&n!==`/&`||t++}e=e.previousSibling}return null}function pm(e,t){function n(){r=!0}if(e.ownerDocument.activeElement===e)return!0;var r=!1;try{e.ownerDocument.addEventListener(`focus`,n,!0),(e.focus||HTMLElement.prototype.focus).call(e,t)}finally{e.ownerDocument.removeEventListener(`focus`,n,!0)}return r}function mm(e){yp(function(){yp(function(t){return e(t)})})}function hm(e,t,n){switch(t=lp(n),e){case`html`:if(e=t.documentElement,!e)throw Error(o(452));return e;case`head`:if(e=t.head,!e)throw Error(o(453));return e;case`body`:if(e=t.body,!e)throw Error(o(454));return e;default:throw Error(o(451))}}function gm(e,t,n){for(var r in n){var i=n[r];n.hasOwnProperty(r)&&i!=null&&$(e,t,r,null,rp,i)}n.dangerouslySetInnerHTML!=null&&(e.textContent=``),e.onclick===En&&(e.onclick=null),zt(e)}function _m(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);zt(e)}var vm=new Map,ym=new Set;function bm(e){if(typeof e.getRootNode==`function`){var t=e.getRootNode();if(t.nodeType===9||t.nodeType===11)return t}return e.nodeType===9?e:e.ownerDocument}var xm=O.d;O.d={f:Sm,r:Cm,D:Em,C:Dm,L:Om,m:km,X:jm,S:Am,M:Mm};function Sm(){var e=xm.f(),t=zd();return e||t}function Cm(e){var t=Vt(e);t!==null&&t.tag===5&&t.type===`form`?cc(t):xm.r(e)}var wm=typeof document>`u`?null:document;function Tm(e,t,n){var r=wm;if(r&&typeof t==`string`&&t){var i=dn(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),ym.has(i)||(ym.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),np(t,`link`,e),Wt(t),r.head.appendChild(t)))}}function Em(e){xm.D(e),Tm(`dns-prefetch`,e,null)}function Dm(e,t){xm.C(e,t),Tm(`preconnect`,e,t)}function Om(e,t,n){xm.L(e,t,n);var r=wm;if(r&&e&&t){var i=`link[rel="preload"][as="`+dn(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+dn(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+dn(n.imageSizes)+`"]`)):i+=`[href="`+dn(e)+`"]`;var a=i;switch(t){case`style`:a=Pm(e);break;case`script`:a=Rm(e)}if(!(vm.has(a)||(e=T({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),vm.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Fm(a))||t===`script`&&r.querySelector(zm(a))))){var o=r.createElement(`link`);np(o,`link`,e),t===`style`&&(o[Rt]=!0,o.onload=o.onerror=function(){Gt(o)}),Wt(o),r.head.appendChild(o)}}}function km(e,t){xm.m(e,t);var n=wm;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+dn(r)+`"][href="`+dn(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Rm(e)}if(!vm.has(a)&&(e=T({rel:`modulepreload`,href:e},t),vm.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(zm(a)))return}r=n.createElement(`link`),np(r,`link`,e),Wt(r),n.head.appendChild(r)}}}function Am(e,t,n){xm.S(e,t,n);var r=wm;if(r&&e){var i=Ut(r).hoistableStyles,a=Pm(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Fm(a)))s.loading=5;else{e=T({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=vm.get(a))&&Hm(e,n);var c=o=r.createElement(`link`);Wt(c),np(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Vm(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function jm(e,t){xm.X(e,t);var n=wm;if(n&&e){var r=Ut(n).hoistableScripts,i=Rm(e),a=r.get(i);a||(a=n.querySelector(zm(i)),a||(e=T({src:e,async:!0},t),(t=vm.get(i))&&Um(e,t),a=n.createElement(`script`),Wt(a),np(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Mm(e,t){xm.M(e,t);var n=wm;if(n&&e){var r=Ut(n).hoistableScripts,i=Rm(e),a=r.get(i);a||(a=n.querySelector(zm(i)),a||(e=T({src:e,async:!0,type:`module`},t),(t=vm.get(i))&&Um(e,t),a=n.createElement(`script`),Wt(a),np(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Nm(e,t,n,r){var i=(i=Ae.current)?bm(i):null;if(!i)throw Error(o(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(n=Pm(n.href),t=Ut(i).hoistableStyles,r=t.get(n),r||(r={type:`style`,instance:null,count:0,state:null},t.set(n,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Pm(n.href);var a=Ut(i).hoistableStyles,s=a.get(e);if(s||(i=i.ownerDocument||i,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},a.set(e,s),(a=i.querySelector(Fm(e)))?a._p||(s.instance=a,s.state.loading=5):(a=vm.get(e),a||(a={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},vm.set(e,a)),Lm(i,e,a,s.state))),t&&r===null)throw Error(o(528,``));return s}if(t&&r!==null)throw Error(o(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(n=Rm(n),t=Ut(i).hoistableScripts,r=t.get(n),r||(r={type:`script`,instance:null,count:0,state:null},t.set(n,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(o(444,e))}}function Pm(e){return`href="`+dn(e)+`"`}function Fm(e){return`link[rel="stylesheet"][`+e+`]`}function Im(e){return T({},e,{"data-precedence":e.precedence,precedence:null})}function Lm(e,t,n,r){if(t=e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)){if(!0!==t[Rt]){r.loading=1;return}}else t=e.createElement(`link`),t[Rt]=!0,t.onload=t.onerror=Gt.bind(null,t),np(t,`link`,n),Wt(t),e.head.appendChild(t);r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2})}function Rm(e){return`[src="`+dn(e)+`"]`}function zm(e){return`script[async]`+e}function Bm(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+dn(n.href)+`"]`);if(r)return t.instance=r,Wt(r),r;var i=T({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),Wt(r),np(r,`style`,i),Vm(r,n.precedence,e),t.instance=r;case`stylesheet`:i=Pm(n.href);var a=e.querySelector(Fm(i));if(a)return t.state.loading|=4,t.instance=a,Wt(a),a;r=Im(n),(i=vm.get(i))&&Hm(r,i),a=(e.ownerDocument||e).createElement(`link`),Wt(a);var s=a;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),np(a,`link`,r),t.state.loading|=4,Vm(a,n.precedence,e),t.instance=a;case`script`:return a=Rm(n.src),(i=e.querySelector(zm(a)))?(t.instance=i,Wt(i),i):(r=n,(i=vm.get(a))&&(r=T({},n),Um(r,i)),e=e.ownerDocument||e,i=e.createElement(`script`),Wt(i),np(i,`link`,r),e.head.appendChild(i),t.instance=i);case`void`:return null;default:throw Error(o(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Vm(r,n.precedence,e));return t.instance}function Vm(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o<r.length;o++){var s=r[o];if(s.dataset.precedence===t)a=s;else if(a!==i)break}a?a.parentNode.insertBefore(e,a.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function Hm(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function Um(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var Wm=null;function Gm(e,t,n){if(Wm===null){var r=new Map,i=Wm=new Map;i.set(n,r)}else i=Wm,r=i.get(n),r||(r=new Map,i.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),i=0;i<n.length;i++){var a=n[i];if(!(a[Lt]||a[At]||e===`link`&&a.getAttribute(`rel`)===`stylesheet`)&&a.namespaceURI!==`http://www.w3.org/2000/svg`){var o=a.getAttribute(t)||``;o=e+o;var s=r.get(o);s?s.push(a):r.set(o,[a])}}return r}function Km(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function qm(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function Jm(e,t){return e===`img`&&t.src!=null&&t.src!==``&&t.onLoad==null&&t.loading!==`lazy`}function Ym(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Xm(e){return(e.width||100)*(e.height||100)*(typeof devicePixelRatio==`number`?devicePixelRatio:1)*.25}function Zm(e,t){typeof t.decode==`function`&&(e.imgCount++,t.complete||(e.imgBytes+=Xm(t),e.suspenseyImages.push(t)),e=rh.bind(e),t.decode().then(e,e))}function Qm(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Pm(r.href),a=t.querySelector(Fm(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=nh.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,Wt(a);return}a=t.ownerDocument||t,r=Im(r),(i=vm.get(i))&&Hm(r,i),a=a.createElement(`link`),Wt(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),np(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=nh.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var $m=0;function eh(e,t){return e.stylesheets&&e.count===0&&ah(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&ah(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&$m===0&&($m=62500*op());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&ah(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>$m?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function th(e){if(e.count===0&&(e.imgCount===0||!e.waitingForImages)){if(e.stylesheets)ah(e,e.stylesheets);else if(e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}}}function nh(){this.count--,th(this)}function rh(){this.imgCount--,th(this)}var ih=null;function ah(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,ih=new Map,t.forEach(oh,e),ih=null,nh.call(e))}function oh(e,t){if(!(t.state.loading&4)){var n=ih.get(e);if(n)var r=n.get(null);else{n=new Map,ih.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a<i.length;a++){var o=i[a];(o.nodeName===`LINK`||o.getAttribute(`media`)!==`not all`)&&(n.set(o.dataset.precedence,o),r=o)}r&&n.set(null,r)}i=t.instance,o=i.getAttribute(`data-precedence`),a=n.get(o)||r,a===r&&n.set(null,i),n.set(o,i),this.count++,r=nh.bind(this),i.addEventListener(`load`,r),i.addEventListener(`error`,r),a?a.parentNode.insertBefore(i,a.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var sh={$$typeof:se,Provider:null,Consumer:null,_currentValue:Ce,_currentValue2:Ce,_threadCount:0};function ch(e,t,n,r,i,a,o,s,c){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=yt(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=yt(0),this.hiddenUpdates=yt(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.transitionTypes=null,this.incompleteTransitions=new Map}function lh(e,t,n,r,i,a,o,s,c,l,u,d){return e=new ch(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=zi(3,null,null,t),e.current=a,a.stateNode=e,t=Ra(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},xo(a),e}function uh(e){return e?(e=Li,e):Li}function dh(e,t,n,r,i,a){i=uh(i),r.context===null?r.context=i:r.pendingContext=i,r=Co(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=wo(e,r,t),n!==null&&(Pd(n,e,t),To(n,e,t))}function fh(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function ph(e,t){fh(e,t),(e=e.alternate)&&fh(e,t)}function mh(e){if(e.tag===13||e.tag===31){var t=Pi(e,67108864);t!==null&&Pd(t,e,67108864),ph(e,67108864)}}function hh(e){if(e.tag===13||e.tag===31){var t=X();t=Tt(t);var n=Pi(e,t);n!==null&&Pd(n,e,t),ph(e,t)}}var gh=!0;function _h(e,t,n,r){var i=D.T;D.T=null;var a=O.p;try{O.p=2,yh(e,t,n,r)}finally{O.p=a,D.T=i}}function vh(e,t,n,r){var i=D.T;D.T=null;var a=O.p;try{O.p=8,yh(e,t,n,r)}finally{O.p=a,D.T=i}}function yh(e,t,n,r){if(gh){var i=bh(r);if(i===null)Kf(e,t,r,xh,n),Mh(e,r);else if(Ph(i,e,t,n,r))r.stopPropagation();else if(Mh(e,r),t&4&&-1<jh.indexOf(e)){for(;i!==null;){var a=Vt(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=pt(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-ot(o);s.entanglements[1]|=c,o&=~c}Ef(a),!(H&6)&&(yd=Je()+500,Df(0,!1))}}break;case 31:case 13:s=Pi(a,2),s!==null&&Pd(s,a,2),zd(),ph(a,2)}if(a=bh(r),a===null&&Kf(e,t,r,xh,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else Kf(e,t,r,null,n)}}function bh(e){return e=On(e),Sh(e)}var xh=null;function Sh(e){if(xh=null,e=Bt(e),e!==null){var t=c(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=l(t),e!==null)return e;e=null}else if(n===31){if(e=u(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return xh=e,null}function Ch(e){switch(e){case`beforetoggle`:case`cancel`:case`click`:case`close`:case`contextmenu`:case`copy`:case`cut`:case`auxclick`:case`dblclick`:case`dragend`:case`dragstart`:case`drop`:case`focusin`:case`focusout`:case`input`:case`invalid`:case`keydown`:case`keypress`:case`keyup`:case`mousedown`:case`mouseup`:case`paste`:case`pause`:case`play`:case`pointercancel`:case`pointerdown`:case`pointerup`:case`ratechange`:case`reset`:case`seeked`:case`submit`:case`toggle`:case`touchcancel`:case`touchend`:case`touchstart`:case`volumechange`:case`change`:case`selectionchange`:case`textInput`:case`compositionstart`:case`compositionend`:case`compositionupdate`:case`beforeblur`:case`afterblur`:case`beforeinput`:case`blur`:case`fullscreenchange`:case`fullscreenerror`:case`focus`:case`hashchange`:case`popstate`:case`select`:case`selectstart`:return 2;case`drag`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`mousemove`:case`mouseout`:case`mouseover`:case`pointermove`:case`pointerout`:case`pointerover`:case`resize`:case`scroll`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 8;case`message`:switch(Ye()){case Xe:return 2;case Ze:return 8;case Qe:case $e:return 32;case et:return 268435456;default:return 32}default:return 32}}var wh=!1,Th=null,Eh=null,Dh=null,Oh=new Map,kh=new Map,Ah=[],jh=`mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset`.split(` `);function Mh(e,t){switch(e){case`focusin`:case`focusout`:Th=null;break;case`dragenter`:case`dragleave`:Eh=null;break;case`mouseover`:case`mouseout`:Dh=null;break;case`pointerover`:case`pointerout`:Oh.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:kh.delete(t.pointerId)}}function Nh(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=Vt(t),t!==null&&mh(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Ph(e,t,n,r,i){switch(t){case`focusin`:return Th=Nh(Th,e,t,n,r,i),!0;case`dragenter`:return Eh=Nh(Eh,e,t,n,r,i),!0;case`mouseover`:return Dh=Nh(Dh,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return Oh.set(a,Nh(Oh.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,kh.set(a,Nh(kh.get(a)||null,e,t,n,r,i)),!0}return!1}function Fh(e){var t=Bt(e.target);if(t!==null){var n=c(t);if(n!==null){if(t=n.tag,t===13){if(t=l(n),t!==null){e.blockedOn=t,Ot(e.priority,function(){hh(n)});return}}else if(t===31){if(t=u(n),t!==null){e.blockedOn=t,Ot(e.priority,function(){hh(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Ih(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=bh(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Dn=r,n.target.dispatchEvent(r),Dn=null}else return t=Vt(n),t!==null&&mh(t),e.blockedOn=n,!1;t.shift()}return!0}function Lh(e,t,n){Ih(e)&&n.delete(t)}function Rh(){wh=!1,Th!==null&&Ih(Th)&&(Th=null),Eh!==null&&Ih(Eh)&&(Eh=null),Dh!==null&&Ih(Dh)&&(Dh=null),Oh.forEach(Lh),kh.forEach(Lh)}function zh(e,n){e.blockedOn===n&&(e.blockedOn=null,wh||(wh=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Rh)))}var Bh=null;function Vh(e){Bh!==e&&(Bh=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Bh===e&&(Bh=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],i=e[t+2];if(typeof r!=`function`){if(Sh(r||n)===null)continue;break}var a=Vt(n);a!==null&&(e.splice(t,3),t-=3,oc(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Hh(e){function t(t){return zh(t,e)}Th!==null&&zh(Th,e),Eh!==null&&zh(Eh,e),Dh!==null&&zh(Dh,e),Oh.forEach(t),kh.forEach(t);for(var n=0;n<Ah.length;n++){var r=Ah[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<Ah.length&&(n=Ah[0],n.blockedOn===null);)Fh(n),n.blockedOn===null&&Ah.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var i=n[r],a=n[r+1],o=i[jt]||null;if(typeof a==`function`)o||Vh(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[jt]||null)s=o.formAction;else if(Sh(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Vh(n)}}}function Uh(){function e(e){e.canIntercept&&e.info===`react-transition`&&e.intercept({handler:function(){return new Promise(function(e){return i=e})},focusReset:`manual`,scroll:`manual`})}function t(){i!==null&&(i(),i=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var e=navigation.currentEntry;e&&e.url!=null&&navigation.navigate(e.url,{state:e.getState(),info:`react-transition`,history:`replace`})}}if(typeof navigation==`object`){var r=!1,i=null;return navigation.addEventListener(`navigate`,e),navigation.addEventListener(`navigatesuccess`,t),navigation.addEventListener(`navigateerror`,t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener(`navigate`,e),navigation.removeEventListener(`navigatesuccess`,t),navigation.removeEventListener(`navigateerror`,t),i!==null&&(i(),i=null)}}}function Wh(e){this._internalRoot=e}Gh.prototype.render=Wh.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(o(409));var n=t.current;dh(n,X(),e,t,null,null)},Gh.prototype.unmount=Wh.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;dh(e.current,2,null,e,null,null),zd(),t[Mt]=null}};function Gh(e){this._internalRoot=e}Gh.prototype.unstable_scheduleHydration=function(e){if(e){var t=Dt();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Ah.length&&t!==0&&t<Ah[n].priority;n++);Ah.splice(n,0,e),n===0&&Fh(e)}};var Kh=i.version;if(Kh!==`19.3.1`)throw Error(o(527,Kh,`19.3.1`));O.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(o(188)):(e=Object.keys(e).join(`,`),Error(o(268,e)));return e=f(t),e=e===null?null:p(e),e=e===null?null:e.stateNode,e};var qh={bundleType:0,version:`19.3.1`,rendererPackageName:`react-dom`,currentDispatcherRef:D,reconcilerVersion:`19.3.1`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var Jh=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Jh.isDisabled&&Jh.supportsFiber)try{rt=Jh.inject(qh),it=Jh}catch{}}e.createRoot=function(e,t){if(!s(e))throw Error(o(299));var n=!1,r=``,i=kc,a=Ac,c=jc;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(i=t.onUncaughtError),t.onCaughtError!==void 0&&(a=t.onCaughtError),t.onRecoverableError!==void 0&&(c=t.onRecoverableError)),t=lh(e,1,!1,null,null,n,r,null,i,a,c,Uh),e[Mt]=t.current,Wf(e),new Wh(t)}})),Pi=t(((e,t)=>{function n(){if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE==`function`)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=Ni()}));function Fi(e){try{let t=(e.split(`.`)[1]??``).replace(/-/g,`+`).replace(/_/g,`/`),n=atob(t.padEnd(Math.ceil(t.length/4)*4,`=`)),r=Uint8Array.from(n,e=>e.charCodeAt(0)),i=JSON.parse(new TextDecoder().decode(r));return i&&typeof i==`object`?i:{}}catch{return{}}}function Ii(e,t,n=0){let r=Fi(e);if(Object.keys(r).length===0)return!0;let i=r.exp;return!(i==null||typeof i==`number`&&i-n>t/1e3)}var Li=`hbc_3142635823`;function Ri(e,t,n){let r=t.token,i=t.record,a=[],o=(e,t,o)=>{r=e,i=t,o&&n?.(e,t);for(let n of[...a])n(e,t)};return{store:{get token(){return r},get record(){return i},get isValid(){return!Ii(r,e())},get isSuperuser(){let e=Fi(r);return e.type===`auth`&&(i?.collectionName===`_superusers`||e.collectionId===`hbc_3142635823`)},save:(e,t)=>o(e,t,!0),clear:()=>o(``,null,!0),onChange(e,t=!1){return a.push(e),t&&e(r,i),()=>{let t=a.indexOf(e);t>=0&&a.splice(t,1)}}},replace:(e,t)=>o(e,t,!1)}}function zi(e=Date.now){return Ri(e,{token:``,record:null}).store}function Bi(e){try{let t=e?JSON.parse(e):null;if(t&&typeof t==`object`){let{token:e,record:n}=t;return{token:typeof e==`string`?e:``,record:n&&typeof n==`object`?n:null}}}catch{}return{token:``,record:null}}function Vi(e){let t=(t,n)=>{try{let r=e();return r?t(r):n}catch{return n}};return{getItem:e=>t(t=>t.getItem(e),null),setItem:(e,n)=>t(t=>t.setItem(e,n),void 0),removeItem:e=>t(t=>t.removeItem(e),void 0)}}function Hi(e=`hb_auth`,t,n=Date.now){let r=Vi(()=>t??globalThis.localStorage),{store:i,replace:a}=Ri(n,Bi(r.getItem(e)),(t,n)=>{t||n?r.setItem(e,JSON.stringify({token:t,record:n})):r.removeItem(e)});return globalThis.addEventListener?.(`storage`,t=>{if(t.key!==e)return;let n=Bi(t.newValue);a(n.token,n.record)}),i}var Ui={fetch:(e,t)=>globalThis.fetch(e,t),setTimeout:(e,t)=>globalThis.setTimeout(e,t),clearTimeout:e=>globalThis.clearTimeout(e),now:()=>Date.now()},Wi=new Set([`@now`,`@second`,`@minute`,`@hour`,`@weekday`,`@day`,`@month`,`@year`,`@yesterday`,`@tomorrow`,`@todayStart`,`@todayEnd`,`@monthStart`,`@monthEnd`,`@yearStart`,`@yearEnd`]),Gi=[[`eq`,`=`],[`neq`,`!=`],[`gt`,`>`],[`gte`,`>=`],[`lt`,`<`],[`lte`,`<=`],[`like`,`~`],[`notLike`,`!~`],[`anyEq`,`?=`],[`anyNeq`,`?!=`],[`anyGt`,`?>`],[`anyGte`,`?>=`],[`anyLt`,`?<`],[`anyLte`,`?<=`],[`anyLike`,`?~`],[`anyNotLike`,`?!~`]],Ki=new Set([...Gi.map(([e])=>e),`insensitive`,`length`,`each`,`empty`]),qi=e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&!(e instanceof Date),Ji=e=>!(typeof e==`string`&&e!==``||typeof e==`number`&&Number.isFinite(e)||typeof e==`boolean`||e instanceof Date&&!Number.isNaN(e.getTime())),Yi=e=>({kind:`field`,path:e});function Xi(e,t){return e instanceof Date?{kind:`value`,value:e.toISOString().replace(`T`,` `)}:typeof e==`string`?Wi.has(e)?{kind:`macro`,name:e}:{kind:`value`,value:t?e.toLowerCase():e}:{kind:`value`,value:e}}function Zi(e,t,n){let r=n||t.insensitive===!0,i=[];for(let[n,a]of Gi){let o=t[n];if(Ji(o))continue;let s=r&&typeof o==`string`;i.push({kind:`cmp`,op:a,left:Yi(s?`${e}:lower`:e),right:Xi(o,s)})}typeof t.empty==`boolean`&&i.push({kind:`cmp`,op:t.empty?`=`:`!=`,left:Yi(e),right:{kind:`value`,value:``}});for(let n of[`length`,`each`])qi(t[n])&&i.push(...Zi(`${e}:${n}`,t[n],n===`each`&&r));return i}function Qi(e,t){return t.length===0?null:t.length===1?t[0]:{kind:e,items:t.flatMap(t=>t.kind===e?t.items:[t])}}function $i(e,t){let n=[];for(let[r,i]of Object.entries(e)){if(r===`AND`||r===`OR`){if(!Array.isArray(i))continue;let e=i.flatMap(e=>{if(!qi(e))return[];let n=Qi(`and`,$i(e,t));return n?[n]:[]}),a=Qi(r===`AND`?`and`:`or`,e);a&&n.push(a);continue}let e=t?`${t}.${r}`:r;if(qi(i)){let t=Object.keys(i).some(e=>Ki.has(e));n.push(...t?Zi(e,i,!1):$i(i,e))}else Ji(i)||n.push({kind:`cmp`,op:`=`,left:Yi(e),right:Xi(i,!1)})}return n}function ea(e){return Qi(`and`,$i(e,``))}function ta(e){let t=(e,n)=>Object.entries(e).flatMap(([e,r])=>{if(r===!0)return[n+e];if(typeof r!=`object`||!r)return[];let i=t(r,`${n}${e}.`);return i.length>0?i:[n+e]});return e?t(e,``).join(`,`):``}var na={"\\":`\\\\`,'"':`\\"`,"\n":`\\n`," ":`\\t`,"\r":`\\r`},ra=e=>`"${e.replace(/[\\"\n\t\r]/g,e=>na[e])}"`;function ia(e){switch(e.kind){case`field`:return e.path;case`macro`:return e.name;case`call`:return`${e.name}(${e.args.map(ia).join(`,`)})`;case`value`:return typeof e.value==`string`?ra(e.value):String(e.value)}}function aa(e){if(e.kind===`cmp`)return`${ia(e.left)}${e.op}${ia(e.right)}`;let t=e.kind===`and`?` && `:` || `;return e.items.flatMap(t=>{let n=aa(t);return n===``?[]:[t.kind!==`cmp`&&t.kind!==e.kind?`(${n})`:n]}).join(t)}function oa(e){return e?aa(e):``}function sa(e){return e?(Array.isArray(e)?e:[e]).flatMap(e=>Object.entries(e)).map(([e,t])=>t===`desc`?`-${e}`:e).join(`,`):``}function ca(e,t){return!e||!t?e||t||``:`(${e}) && (${t})`}function la(e,t){return[e,t].filter(Boolean).join(`,`)}var ua=encodeURIComponent;function N(e){let t=e=>`/api/collections/${ua(e)}`;return{findMany(t,n){let r=ca(t?.where?oa(ea(t.where)):``,t?.filter),i=la(sa(t?.orderBy),t?.sort);return e.send(`/api/collections`,{...n,query:{page:t?.page,perPage:t?.perPage,skipTotal:t?.count===!1?1:void 0,filter:r||void 0,sort:i||void 0}})},findOne:(n,r)=>e.send(t(n),r),create:(t,n)=>e.send(`/api/collections`,{...n,method:`POST`,body:t}),update:(n,r,i)=>e.send(t(n),{...i,method:`PATCH`,body:r}),delete:(n,r)=>e.send(t(n),{...r,method:`DELETE`}),truncate:(n,r)=>e.send(`${t(n)}/truncate`,{...r,method:`DELETE`}),import:(t,n=!1,r)=>e.send(`/api/collections/import`,{...r,method:`PUT`,body:{collections:t,deleteMissing:n}}),scaffolds:t=>e.send(`/api/collections/meta/scaffolds`,t)}}function P(e){return{get:t=>e.send(`/api/settings`,t),update:(t,n)=>e.send(`/api/settings`,{...n,method:`PATCH`,body:t}),testEmail:(t,n,r,i)=>e.send(`/api/settings/test/email`,{...i,method:`POST`,body:{email:n,template:r,collection:t}}),generateAppleClientSecret:(t,n,r,i,a,o)=>e.send(`/api/settings/apple/generate-client-secret`,{...o,method:`POST`,body:{clientId:t,teamId:n,keyId:r,privateKey:i,duration:a}}),testS3:(t,n)=>e.send(`/api/settings/test/s3`,{...n,method:`POST`,body:{filesystem:t}})}}function da(e){return{list:t=>e.send(`/api/crons`,t),run:(t,n)=>e.send(`/api/crons/${ua(t)}`,{...n,method:`POST`})}}function fa(e){return{check:t=>e.send(`/api/health`,t)}}var pa=`The request was aborted (most likely autocancelled).`,ma=class extends Error{constructor(e={}){let t=e.response!==null&&typeof e.response==`object`?e.response:{},n=!!e.isAbort,r=typeof t.message==`string`&&t.message?t.message:n?pa:`Something went wrong.`;super(r),this.name=`HeybeError`,this.url=e.url??``,this.status=e.status??0,this.response=t,this.isAbort=n,this.cause=e.cause}};function ha(e,t=!1){let n=new ma({isAbort:t,cause:Error(e)});return n.message=e,n}function ga(e){let t=globalThis.window;if(!t?.open)throw ha(`Not in a browser context - please pass a custom urlCallback function.`);let n=Math.min(1024,t.innerWidth),r=Math.min(768,t.innerHeight),i=t.innerWidth/2-n/2,a=t.innerHeight/2-r/2;return t.open(e,`popup_window`,`width=${n},height=${r},top=${a},left=${i},resizable,menubar=no`)}function _a(e,t){let n=e.indexOf(`?`),r=n<0?e:e.slice(0,n),i=e=>decodeURIComponent(e.replace(/\+/g,` `)),a=new Map;for(let t of n<0?[]:e.slice(n+1).split(`&`)){if(!t)continue;let[e,n=``]=t.split(`=`);a.set(i(e),i(n))}for(let[e,n]of Object.entries(t))a.set(e,n);let o=[...a].map(([e,t])=>`${encodeURIComponent(e)}=${encodeURIComponent(t)}`).join(`&`);return o?`${r}?${o}`:r}async function va(e,t){let{provider:n,scopes:r,createData:i,urlCallback:a,...o}=t,s=a?null:ga(),c=e.realtime(),l=()=>{},u,d=``,f,p=!1;try{if(u=(await e.auth.methods({requestKey:o.requestKey,signal:o.signal})).oauth2.providers.find(e=>e.name===n),!u)throw ha(`Missing or invalid provider "${n}".`);let{authURL:t}=u;d=e.buildURL(`/api/oauth2-redirect`),f=await new Promise((e,n)=>{if(l=()=>n(ha(`manually cancelled`,!0)),o.signal?.aborted)return l();o.signal?.addEventListener(`abort`,l,{once:!0}),c.onDisconnect=e=>{e.length&&n(ha(`realtime connection interrupted`))},(async()=>{if(await c.subscribe(`@oauth2`,t=>{!t.state||t.state!==c.clientId?n(ha(`State parameters don't match.`)):t.error||!t.code?n(ha(`OAuth2 redirect error or missing code: `+t.error)):e(t.code)}),p)return;let i={state:c.clientId};r?.length&&(i.scope=r.join(` `));let o=_a(t+d,i);a?await a(o):s?s.location.href=o:s=ga(o)})().catch(n)})}catch(e){throw e instanceof ma?e:new ma({cause:e})}finally{p=!0,c.onDisconnect=void 0,o.signal?.removeEventListener(`abort`,l),s?.close(),c.unsubscribe().catch(()=>{})}return e.auth.withOAuth2Code(u.name,f,u.codeVerifier,d,i,o)}function ya(e,t){let n=e,r=globalThis.location;return r&&!/^https?:\/\//.test(e)&&(n=r.origin.replace(/\/$/,``),e.startsWith(`/`)||(n+=r.pathname||`/`,n.endsWith(`/`)||(n+=`/`)),n+=e),t&&(n.endsWith(`/`)||(n+=`/`),n+=t.startsWith(`/`)?t.slice(1):t),n}function ba(e){return e==null?null:e instanceof Date?encodeURIComponent(e.toISOString().replace(`T`,` `)):encodeURIComponent(typeof e==`object`?JSON.stringify(e):String(e))}function xa(e){let t=[];for(let[n,r]of Object.entries(e))for(let e of Array.isArray(r)?r:[r]){let r=ba(e);r!==null&&t.push(`${encodeURIComponent(n)}=${r}`)}return t.join(`&`)}function Sa(e){return typeof Blob<`u`&&e instanceof Blob}function Ca(e){return(Array.isArray(e)?e:[e]).some(Sa)}function wa(e){return typeof e==`string`||e instanceof FormData||e instanceof URLSearchParams||Sa(e)}function Ta(e){if(e==null)return;if(wa(e))return e;if(typeof e!=`object`||!Object.values(e).some(Ca))return JSON.stringify(e);let t=new FormData;for(let[n,r]of Object.entries(e))if(r!==void 0){if(typeof r==`object`&&!Ca(r))t.append(`@jsonPayload`,JSON.stringify({[n]:r}));else for(let e of Array.isArray(r)?r:[r])t.append(n,Sa(e)?e:String(e))}return t}function Ea(e){return Object.keys(e??{}).some(e=>e.toLowerCase()===`authorization`)}function Da(e){return e instanceof Error&&(e.name===`AbortError`||e.message===`Aborted`)}function Oa(e){let t=new Map;function n(e){t.get(e)?.abort(),t.delete(e)}function r(){for(let e of t.values())e.abort();t.clear()}async function i(r,i={}){let a=e.beforeSend?.(r,i.headers);a&&await a;let o=i.method??`GET`,s=ya(e.url,r),c=i.query?xa(i.query):``;c&&(s+=(s.includes(`?`)?`&`:`?`)+c);let l=Ta(i.body),u=new Headers(i.headers);u.has(`Content-Type`)||wa(i.body)||l instanceof FormData||u.set(`Content-Type`,`application/json`),u.has(`Accept-Language`)||u.set(`Accept-Language`,e.lang);let d=e.token();d&&!u.has(`Authorization`)&&u.set(`Authorization`,d);let f=i.signal,p=``,m,h=()=>m?.abort();e.autoCancel()&&i.requestKey!==null&&(p=i.requestKey||o+r.split(`?`)[0],n(p),m=new AbortController,t.set(p,m),f?.aborted?m.abort():f?.addEventListener(`abort`,h,{once:!0}),f=m.signal);let g=e.env.fetch;try{let e=await g(s,{method:o,headers:u,body:l,signal:f}),t=await e.text(),n;try{n=t?JSON.parse(t):void 0}catch{}if(e.status>=400)throw new ma({url:e.url||s,status:e.status,response:n});return n}catch(e){throw e instanceof ma?e:new ma({url:s,isAbort:!!f?.aborted||Da(e),cause:e})}finally{i.signal?.removeEventListener(`abort`,h),m&&t.get(p)===m&&t.delete(p)}}return{send:i,cancelRequest:n,cancelAllRequests:r}}var ka=[`_superusers`,Li];function Aa(e,t,n){let r=`/api/collections/${encodeURIComponent(t)}`,i=e.authStore,a=async(t,n,i)=>{await e.send(r+t,{...i,method:`POST`,body:n})};async function o(t,n,a={}){let{mfaId:o,expand:s,autoRefreshThreshold:c,...l}=a,u=ta(s),d=await e.send(r+t,{...l,method:`POST`,body:o?{...n,mfaId:o}:n,query:u?{expand:u}:void 0});return i.save(d.token,d.record),d}async function s(e,r,a={},c=!1){let l=ka.includes(t);l&&!c&&n.autoRefresh.reset();let u=await o(`/auth-with-password`,{identity:e,password:r},a),{autoRefreshThreshold:d,expand:f}=a;return d!==void 0&&l&&n.autoRefresh.register({threshold:d,record:i.record,run:()=>s(e,r,{autoRefreshThreshold:d,expand:f},!0)}),u}let c=e=>{let t=Fi(e),n=i.record;return!!n&&n.id===t.id&&n.collectionId===t.collectionId},l={methods(t){return e.send(r+`/auth-methods`,{...t,query:{fields:`mfa,otp,password,oauth2`}})},withPassword:(e,t,n)=>s(e,t,n),requestOTP(t,n){return e.send(r+`/request-otp`,{...n,method:`POST`,body:{email:t}})},withOTP(e,t,n){return o(`/auth-with-otp`,{otpId:e,password:t},n)},withOAuth2Code(e,t,n,r,i,a){return o(`/auth-with-oauth2`,{provider:e,code:t,codeVerifier:n,redirectURL:r,createData:i},a)},withOAuth2:t=>va({auth:l,realtime:n.realtime,buildURL:e.buildURL},t),refresh(e){return o(`/auth-refresh`,void 0,e)},async impersonate(e,t,a){let o=n.fork(),s=await o.send(`${r}/impersonate/${encodeURIComponent(e)}`,{...a,method:`POST`,body:{duration:t},headers:i.token&&!Ea(a?.headers)?{...a?.headers,Authorization:i.token}:a?.headers});return o.authStore.save(s.token,s.record),o},requestVerification:(e,t)=>a(`/request-verification`,{email:e},t),async confirmVerification(e,t){await a(`/confirm-verification`,{token:e},t),c(e)&&!i.record.verified&&i.save(i.token,{...i.record,verified:!0})},requestPasswordReset:(e,t)=>a(`/request-password-reset`,{email:e},t),confirmPasswordReset:(e,t,n,r)=>a(`/confirm-password-reset`,{token:e,password:t,passwordConfirm:n},r),requestEmailChange:(e,t)=>a(`/request-email-change`,{newEmail:e},t),async confirmEmailChange(e,t,n){await a(`/confirm-email-change`,{token:e,password:t},n),c(e)&&i.clear()}};return l}var ja=encodeURIComponent;function Ma(e){return{list:t=>e.send(`/api/backups`,t),create:(t,n)=>e.send(`/api/backups`,{...n,method:`POST`,body:{name:t}}),upload(t,n){let r=new FormData;return r.append(`file`,t),e.send(`/api/backups/upload`,{...n,method:`POST`,body:r})},delete:(t,n)=>e.send(`/api/backups/${ja(t)}`,{...n,method:`DELETE`}),restore:(t,n)=>e.send(`/api/backups/${ja(t)}/restore`,{...n,method:`POST`}),downloadURL:(t,n)=>`${e.buildURL(`/api/backups/${ja(n)}`)}?token=${ja(t)}`}}var Na=e=>e instanceof Blob;function Pa(e){let t={},n={};for(let[r,i]of Object.entries(e)){if(!Array.isArray(i)){Na(i)?n[r]=[i]:t[r]=i;continue}let e=i.filter(Na);if(e.length===0){t[r]=i;continue}let a=i.filter(e=>!Na(e));a.length===0?n[r]=e:(t[r]=a,n[r.endsWith(`+`)?r:`${r}+`]=e)}return{body:t,files:n}}function Fa(e){let t=[],n=[];function r(e,r,i={},a){let o=Pa(i),s=xa({expand:ta(a)||void 0});t.push({method:e,url:s?`${r}?${s}`:r,headers:{},body:o.body});for(let[e,r]of Object.entries(o.files))for(let i of r)n.push([t.length-1,e,i])}return{records:e=>{let t=`/api/collections/${encodeURIComponent(e)}/records`,n=e=>`${t}/${encodeURIComponent(e)}`;return{create:(e,n)=>r(`POST`,t,e,n?.expand),update:(e,t,i)=>r(`PATCH`,n(e),t,i?.expand),upsert:(e,n)=>r(`PUT`,t,e,n?.expand),delete:e=>r(`DELETE`,n(e))}},async send(r){let i=new FormData;i.append(`@jsonPayload`,JSON.stringify({requests:t}));for(let[e,t,r]of n)i.append(`requests.${e}.${t}`,r);return e.send(`/api/batch`,{...r,method:`POST`,body:i})}}}function Ia(e){return{url(t,n,r={}){let i=t.collectionId||t.collectionName;if(!n||!t.id||!i)return``;let a=encodeURIComponent,o=e.buildURL(`api/files/${a(i)}/${a(t.id)}/${a(n)}`),s=xa({...r,download:r.download||void 0});return s?`${o}?${s}`:o},async token(t){return(await e.send(`/api/files/token`,{...t,method:`POST`}))?.token||``}}}var La=e=>ca(e?.where?oa(ea(e.where)):``,e?.filter)||void 0;function Ra(e){return{findMany(t,n){return e.send(`/api/logs`,{...n,query:{page:t?.page,perPage:t?.perPage,skipTotal:t?.count===!1?1:void 0,filter:La(t),sort:la(sa(t?.orderBy),t?.sort)||void 0}})},findOne:(t,n)=>e.send(`/api/logs/${encodeURIComponent(t)}`,n),stats:(t,n)=>e.send(`/api/logs/stats`,{...n,query:{filter:La(t)}}),truncate:t=>e.send(`/api/logs`,{...t,method:`DELETE`})}}async function za(e,t,n){let r=e.getReader(),i=()=>void r.cancel().catch(()=>{});n?.aborted&&i(),n?.addEventListener(`abort`,i,{once:!0});let a=new TextDecoder,o=``,s=``,c=``,l=[],u=!1,d=e=>{if(e.endsWith(`\r`)&&(e=e.slice(0,-1)),!e){u&&t({id:s,event:c||`message`,data:l.join(`
|
|
12
|
+
`)}),s=``,c=``,l=[],u=!1;return}let n=e.indexOf(`:`);if(n===0)return;let r=n<0?e:e.slice(0,n),i=n<0?``:e.slice(n+1);if(i.startsWith(` `)&&(i=i.slice(1)),r===`id`)s=i;else if(r===`event`)c=i;else if(r===`data`)l.push(i);else return;u=!0};try{for(;;){let{done:e,value:t}=await r.read();o+=e?a.decode():a.decode(t,{stream:!0});let n;for(;(n=o.indexOf(`
|
|
13
|
+
`))>=0;)d(o.slice(0,n)),o=o.slice(n+1);if(e)return}}finally{n?.removeEventListener(`abort`,i),r.releaseLock()}}var Ba=15e3,Va=[200,300,500,1e3,1200,1500,2e3];function Ha(e,t){if(!e)return``;let n=Fi(e);return`${n.collectionId??t?.collectionId}/${n.id??t?.id}`}function Ua(e){try{return JSON.parse(e)||{}}catch{return{}}}function Wa(e){let{env:t}=e,n=new Map,r=``,i=null,a=[],o,s,c=0,l=!1,u=[],d=[],f=!1,p=e.authStore.token,m=Ha(p,e.authStore.record),h=``,g=()=>`realtime_${r}`,_=()=>[...n.keys()].filter(e=>n.get(e).length),v=()=>{let e=_();return e.length!==a.length||e.some(e=>!a.includes(e))},y=e=>[...n.keys()].filter(t=>(t+`?`).startsWith(e)),b=e=>y(e.includes(`?`)?e:e+`?`),x=e=>{let t=u;u=[];for(let n of t)e?n.reject(e):n.resolve()};async function S(){if(!_().length)return ie();if(r&&(v()||h!==e.authStore.token)){a=_();try{await e.send(`/api/realtime`,{method:`POST`,body:{clientId:r,subscriptions:a},requestKey:g()}),h=e.authStore.token}catch(e){if(!e?.isAbort)throw e}}}async function C(){if(f||!d.length)return;let e=d;d=[],f=!0;try{await S();for(let t of e)t.resolve()}catch(t){for(let n of e)n.reject(t)}finally{f=!1,d.length&&await C()}}function w(){return new Promise((e,t)=>{d.push({resolve:e,reject:t}),d.length===1&&Promise.resolve().then(C)})}function ee(){return c>0?Promise.resolve():new Promise((e,t)=>{u.push({resolve:e,reject:t}),u.length===1&&!i&&Promise.resolve().then(T)})}function T(){ie(!0),o=t.setTimeout(()=>re(Error(`Realtime connect took too long.`)),Ba);let n=new AbortController;i=n;let r=()=>i===n;t.fetch(e.buildURL(`/api/realtime`),{headers:{Accept:`text/event-stream`},signal:n.signal}).then(e=>{if(!e.ok||!e.body)throw e.body?.cancel().catch(()=>{}),Error(`Failed to establish realtime connection.`);return za(e.body,e=>r()&&te(e),n.signal)}).then(()=>r()&&re(Error(`Realtime stream ended.`)),e=>r()&&re(e))}function te(e){if(e.event===`HB_CONNECT`)return ne(e);for(let t of[...n.get(e.event)??[]])t(Ua(e.data))}function ne(e){let u=i;r=e.id,a=[],w().then(async()=>{if(i===u){for(let e=3;v()&&e>0;e--)await w();x(),c=0,l=!1,t.clearTimeout(s),t.clearTimeout(o);for(let t of b(`HB_CONNECT`))for(let r of[...n.get(t)])r(Ua(e.data));v()&&await w()}}).catch(e=>{i===u&&(r=``,a=[],re(e))})}function re(e){if(t.clearTimeout(o),t.clearTimeout(s),!r&&!c&&!l){x(e instanceof ma?e:new ma({cause:e})),ie();return}ie(!0);let n=Va[Math.min(c,Va.length-1)];c++,s=t.setTimeout(T,n)}function ie(u=!1){r&&E.onDisconnect?.([...n.keys()]),t.clearTimeout(o),t.clearTimeout(s),e.cancelRequest(g()),i?.abort(),i=null,r=``,a=[],u||(c=0,l=!1,x())}function ae(e,t){for(let r of e){let e=n.get(r);if(!e)continue;let i=t?e.filter(e=>e!==t):[];i.length?n.set(r,i):n.delete(r)}}e.authStore.onChange((e,t)=>{if(e===p)return;let n=Ha(e,t)===m;if(p=e,m=Ha(e,t),r){if(n)return void w().catch(()=>{});l=!0,T()}});let E={get clientId(){return r},get isConnected(){return!!i&&!!r&&!u.length},async subscribe(e,t,r){if(!e)throw Error(`topic must be set.`);let i=e;r&&(i+=(e.includes(`?`)?`&`:`?`)+`options=`+encodeURIComponent(JSON.stringify({query:r.query,headers:r.headers})));let a=e=>t(e),o=n.get(i)??[];return o.push(a),n.set(i,o),E.isConnected?o.length===1&&await w():await ee(),()=>(ae(b(e),a),w())},async unsubscribe(e){ae(e?b(e):[...n.keys()]),await w()},async unsubscribeByPrefix(e){let t=y(e);t.length&&(ae(t),await w())}};return E}function Ga(e){return Object.fromEntries(Object.entries(e).filter(([,e])=>e!==``&&e!=null))}function Ka(e,t){return Ga({page:t?1:e?.page,perPage:t?1:e?.perPage,skipTotal:t||e?.count===!1?1:void 0,filter:ca(e?.where?oa(ea(e.where)):``,e?.filter),sort:la(sa(e?.orderBy),e?.sort),expand:ta(e?.expand)})}var qa=(e,t={})=>new ma({status:404,response:{code:404,message:e,data:t}});function Ja(e,t){let n=`/api/collections/${encodeURIComponent(t)}/records`,r=e=>`${n}/${encodeURIComponent(e)}`,i=e=>Ga({expand:ta(e?.expand)});function a(n){let r=e.authStore.record;return r?.id===n&&(r.collectionId===t||r.collectionName===t)}return{collection:t,findMany(t,r){return e.send(n,{...r,query:Ka(t,!1)})},async findOne(t,n,a){if(!t)throw qa(`Missing required record id.`);return e.send(r(t),{...a,query:i(n)})},async findFirst(t,r){let i=Ka(t,!0),a=await e.send(n,{...r,requestKey:r?.requestKey===void 0?`one_by_filter_${n}_${i.filter??``}`:r.requestKey,query:i});if(!a?.items?.length)throw qa(`The requested resource wasn't found.`);return a.items[0]},create(t,r,a){return e.send(n,{...a,method:`POST`,body:t,query:i(r)})},async update(t,n,o,s){let c=await e.send(r(t),{...s,method:`PATCH`,body:n,query:i(o)});if(a(c.id)){let t=e.authStore.record,n={...t,...c};(t.expand||c.expand)&&(n.expand={...t.expand,...c.expand}),e.authStore.save(e.authStore.token,n)}return c},async delete(t,n){await e.send(r(t),{...n,method:`DELETE`}),a(t)&&e.authStore.clear()},subscribe(n,r,i){let a=Ga({filter:i?.where?oa(ea(i.where)):``,expand:ta(i?.expand)}),o=Object.keys(a).length>0,s=o||i?.headers?{query:o?a:void 0,headers:i?.headers}:void 0;return e.realtime.subscribe(`${t}/${n}`,r,s)},unsubscribe(n){return n?e.realtime.unsubscribe(`${t}/${n}`):e.realtime.unsubscribeByPrefix(`${t}/`)}}}var Ya=[`/auth-refresh`,`/auth-with-password`];function Xa(e){let{store:t}=e,n=null,r=null;t.onChange((e,t)=>{n&&(!e||t?.id!==n.record.id||t?.collectionId!==n.record.collectionId)&&(n=null)});let i=n=>t.isValid&&!!t.record&&Ii(t.token,e.now(),n);async function a(n,r){let a=t.isValid;if(i(r)){let{token:n,record:r}=t;try{let i=await e.refresh(r.collectionName||r.collectionId);t.token===n&&t.save(i.token,i.record)}catch{a=!1}}!a&&n&&await n.run()}return{register(e){n=e},reset(){n=null},before(o,s){if(Ya.some(e=>o.endsWith(e))||Ea(s))return;if(r)return r;let c=n,l=c?.threshold??e.threshold;if(l!==void 0&&(i(l)||c&&!t.isValid))return r=a(c,l).finally(()=>{r=null}),r}}}function Za(e){return{run:(t,n)=>e.send(`/api/sql`,{...n,method:`POST`,body:{query:t}})}}function Qa(e,t={}){return $a(e,t,{...Ui,fetch:t.fetch??Ui.fetch})}function $a(e,t,n){let r=t.lang??`en-US`,i=t.authStore??eo(n.now),a=Xa({store:i,now:n.now,threshold:t.autoRefreshThreshold,refresh:e=>l.send(`/api/collections/${encodeURIComponent(e)}/auth-refresh`,{method:`POST`,requestKey:null})}),o=Oa({url:e,lang:r,env:n,token:()=>i.token,autoCancel:()=>l.autoCancel,beforeSend:a.before}),s=()=>$a(e,{lang:r,autoCancel:l.autoCancel,authStore:zi(n.now)},n),c=(t=i)=>Wa({env:n,authStore:t,buildURL:t=>ya(e,t),send:o.send,cancelRequest:o.cancelRequest}),l={url:e,lang:r,authStore:i,autoCancel:t.autoCancel??!0,buildURL:t=>ya(e,t),...o,realtime:c(),files:Ia({send:o.send,buildURL:t=>ya(e,t)}),collections:N(o),settings:P(o),crons:da(o),health:fa(o),logs:Ra(o),backups:Ma({send:o.send,buildURL:t=>ya(e,t)}),sql:Za(o),batch:()=>Fa(l),records:e=>Ja(l,e),auth:e=>Aa(l,e,{autoRefresh:a,fork:s,realtime:()=>c(zi(n.now))})};return l}function eo(e){try{if(typeof window<`u`&&window.localStorage)return Hi(void 0,void 0,e)}catch{}return zi(e)}var to=Pi(),no=new WeakMap;function ro(e,t){no.set(e,t)}function io(e={}){let t=e.fetch??((e,t)=>globalThis.fetch(e,t)),n=Qa(e.url??`/`,{fetch:async(e,r)=>{let i=await t(e,r),a=n.authStore.token;return i.status===401&&a&&new Headers(r?.headers).get(`Authorization`)===a&&no.get(n)?.(),i},authStore:e.authStore??Hi(`hb_superuser_auth`),autoCancel:!1});return n}var ao=T.createContext(void 0),oo=e=>{let t=T.useContext(ao);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},so=({client:e,children:t})=>(T.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,j.jsx)(ao.Provider,{value:e,children:t})),co={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},lo=new class{#e=co;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 uo(e){setTimeout(e,0)}var fo=typeof window>`u`||`Deno`in globalThis;function po(){}function mo(e,t){return typeof e==`function`?e(t):e}function ho(e){return typeof e==`number`&&e>=0&&e!==1/0}function go(e,t){return Math.max(e+(t||0)-Date.now(),0)}function _o(e,t){return typeof e==`function`?e(t):e}function vo(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==bo(o,t.options))return!1}else if(!So(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 yo(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(xo(t.options.mutationKey)!==xo(a))return!1}else if(!So(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function bo(e,t){return(t?.queryKeyHashFn||xo)(e)}function xo(e){return JSON.stringify(e,(e,t)=>Do(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function So(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(e&&t&&typeof e==`object`&&typeof t==`object`){if(Array.isArray(e)&&Array.isArray(t)){if(t.length>e.length)return!1;for(let n=0;n<t.length;n++)if(!So(e[n],t[n]))return!1;return!0}let n=Object.keys(t);for(let r of n)if(!So(e[r],t[r]))return!1;return!0}return!1}var Co=Object.prototype.hasOwnProperty;function wo(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=Eo(e)&&Eo(t);if(!r&&!(Do(e)&&Do(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:Co.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=wo(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function To(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n of Object.keys(e))if(!Co.call(t,n)||e[n]!==t[n])return!1;return!0}function Eo(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Do(e){if(!Oo(e))return!1;let t=Object.getPrototypeOf(e),n=t?.constructor;if(n===void 0)return!0;if(typeof n!=`function`)return!1;let r=n.prototype;return!(!Oo(r)||!r.hasOwnProperty(`isPrototypeOf`)||t!==Object.prototype)}function Oo(e){return Object.prototype.toString.call(e)===`[object Object]`}function ko(e){return new Promise(t=>{lo.setTimeout(t,e)})}function Ao(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:wo(e,t)}function jo(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(-n):r}function Mo(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,n):r}var No=Symbol();function Po(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===No?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Fo(e,t){return typeof e==`function`?e(...t):!!e}var Io=Symbol();function Lo(e,t,n,r){let i=!1,a;return Object.defineProperties(e,{[Io]:{value:r},signal:{enumerable:!0,get:()=>(a??=t(),i||(i=!0,a.aborted?n():a.addEventListener(`abort`,n,{once:!0})),a)}}),e}var Ro=()=>fo,zo=()=>Ro(),Bo=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(){}},Vo=new class extends Bo{#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`}},Ho=uo;function Uo(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=Ho,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 F=Uo(),Wo=new class extends Bo{#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 Go(e){return Math.min(1e3*2**e,3e4)}function Ko(e){return(e??`online`)!==`online`||Wo.isOnline()}var qo=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function I(e){let t=!1,n=0,r,i=`pending`,a,o,s=new Promise((e,t)=>{a=e,o=t});s.catch(po);let c=()=>i!==`pending`,l=t=>{if(!c()){let n=new qo(t);h(n),e.onCancel?.(n)}},u=()=>{t=!0},d=()=>{t=!1},f=()=>Vo.isFocused()&&(e.networkMode===`always`||Wo.isOnline())&&e.canRun(),p=()=>Ko(e.networkMode)&&e.canRun(),m=e=>{c()||(r?.(),i=`resolved`,a(e))},h=e=>{c()||(r?.(),i=`rejected`,o(e))},g=t=>new Promise(n=>{r=e=>{(c()||t())&&n(e)},e.onPause?.()}).then(()=>{r=void 0,c()||e.onContinue?.()}),_=()=>{if(c())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(m).catch(r=>{if(c())return;let i=e.retry??(zo()?0:3),a=e.retryDelay??Go,o=typeof a==`function`?a(n,r):a,s=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);t||!s?h(r):(n++,e.onFail?.(n,r),ko(o).then(()=>c()||f()?void 0:g(f)).then(()=>{t?h(r):_()}))})};return{promise:s,status:()=>i,cancel:l,continue:()=>(r?.(),s),cancelRetry:u,continueRetry:d,canStart:p,start:()=>(p()?_():g(p).then(_),s)}}var L=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),ho(this.gcTime)&&(this.#e=lo.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(zo()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(lo.clearTimeout(this.#e),this.#e=void 0)}};function Jo(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=t,u=e=>{Lo(e,()=>t.signal,()=>n=!0,l[Io])},d=Po(t.options,t.fetchOptions),f=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return u(e),e})(),o=await d(a),{maxPages:s}=t.options,c=i?Mo:jo;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?Xo:Yo,n={pages:a,pageParams:o};s=await f(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]===void 0?r.initialPageParam:o[0]:Yo(r,s);if(c>0&&e==null)break;s=await f(s,e),c++}while(c<t)}return s};t.fetchFn=t.options.persister?()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):l}}}function Yo(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 Xo(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function Zo(e,t){return t?Yo(e,t)!=null:!1}function Qo(e,t){return!t||!e.getPreviousPageParam?!1:Xo(e,t)!=null}var $o=class extends L{#e;#t;#n;#r;#i;#a;#o;#s;#c;constructor(e){super(),this.#c=!1,this.#s=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=ns(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.#s,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=ns(this.options);e.data!==void 0&&(this.setState(ts(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=Ao(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(po).catch(po):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=>_o(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===No||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.state.data!==void 0&&this.getObserversCount()>0&&this.observers.some(e=>_o(e.options.staleTime,this)===`static`)}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:!go(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){let t=this.observers.indexOf(e);t!==-1&&(this.observers.splice(t,1),this.observers.length||(this.#a&&(this.#c||this.state.fetchStatus===`paused`&&this.state.status===`pending`?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}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&&this.#o)return this.#a.continueRetry(),this.#o}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.defineProperties(e,{[Io]:{value:n.signal,enumerable:!0},signal:{enumerable:!0,get:()=>(this.#c=!0,n.signal)}})},i=()=>{let e=Po(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#c=!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`?Jo(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});let o=this.#a=I({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof qo&&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}),s=(async()=>{try{let e=await o.promise;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 qo){if(e.silent){if(this.#a!==o&&this.#o)return this.#o;throw e}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.#a===o&&(this.#a=void 0,this.#o=void 0),this.scheduleGc()}})();return this.#o=s,o.start(),s}#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,...es(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...ts(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),F.batch(()=>{this.observers.slice().forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function es(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Ko(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function ts(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function ns(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 rs=class extends Bo{#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p=new Set;constructor(e,t){super(),this.options=t,this.#e=e,this.#o=null,this.bindMethods(),this.setOptions(t)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),as(this.#t,this.options)?this.#m():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return os(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return os(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 _o(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&&!To(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&ss(this.#t,n,this.options,t)&&this.#m(),this.updateResult(),r&&(this.#t!==n||_o(this.options.enabled,this.#t)!==_o(t.enabled,this.#t)||_o(this.options.staleTime,this.#t)!==_o(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||_o(this.options.enabled,this.#t)!==_o(t.enabled,this.#t)||i!==this.#f)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return To(this.getCurrentResult(),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),Reflect.get(e,n))})}trackProp(e){this.#p.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),r=()=>{},i,a=new Promise(e=>{i=e,r=this.#e.getQueryCache().subscribe(i=>{i.type===`updated`&&i.query.queryHash===n.queryHash&&n.state.data!==void 0&&(r(),e(this.createResult(n,t)))})});return Promise.race([n.fetch(t).then(()=>{let e=this.createResult(n,t);return i?.(e),e}).finally(()=>{r()}),a])}fetch(e){return this.#m({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#m(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(po)),t}#h(e){return!zo()&&_o(this.options.enabled,this.#t)!==!1&&ho(e)}#g(){this.#b();let e=_o(this.options.staleTime,this.#t);if(this.#r.isStale||!this.#h(e))return;let t=go(this.#r.dataUpdatedAt,e)+1;this.#u=lo.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return _o(this.options.refetchInterval,this.#t)??!1}#v(e){this.#x(),this.#f=e,this.#f!==0&&this.#h(this.#f)&&(this.#d=lo.setInterval(()=>{(this.options.refetchIntervalInBackground||Vo.isFocused())&&this.#m()},this.#f))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#u!==void 0&&(lo.clearTimeout(this.#u),this.#u=void 0)}#x(){this.#d!==void 0&&(lo.clearInterval(this.#d),this.#d=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&&as(e,t),o=i&&ss(e,n,t,r);(a||o)&&(l={...l,...es(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.#l?.state.data,this.#l):t.placeholderData,e!==void 0&&(m=`success`,d=Ao(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h){if(i&&d===a?.data&&t.select===this.#s)d=this.#c;else try{this.#s=t.select,d=t.select(d),d=Ao(i?.data,d,t),this.#c=d,this.#o=null}catch(e){this.#o=e}}else d===void 0&&(this.#o=null);this.#o&&(f=this.#o,d=this.#c,p=i?.error===f?i.errorUpdatedAt:Date.now(),m=`error`,u=!1);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,b=d!==void 0;return{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:cs(e,t),refetch:this.refetch,isEnabled:_o(t.enabled,e)!==!1}}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);if(this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#l=this.#t),To(t,e))return;this.#r=t;let n=(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#p.size||this.options.throwOnError&&this.#r.error!==e.error)return!0;for(let t of n??this.#p)if(this.#r[t]!==e[t])return!0;return!1})();F.batch(()=>{n&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}#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()}};function is(e,t){return _o(t.enabled,e)!==!1&&e.state.data===void 0&&(e.state.status!==`error`||_o(t.retryOnMount,e)!==!1)}function as(e,t){return is(e,t)||e.state.data!==void 0&&os(e,t,t.refetchOnMount)}function os(e,t,n){if(_o(t.enabled,e)!==!1&&_o(t.staleTime,e)!==`static`){let r=_o(n,e);return r===`always`||r!==!1&&cs(e,t)}return!1}function ss(e,t,n,r){return(e!==t||_o(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&cs(e,n)}function cs(e,t){return _o(t.enabled,e)!==!1&&e.isStaleByTime(_o(t.staleTime,e))}var ls=class extends rs{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:Zo(t,n.data),hasPreviousPage:Qo(t,n.data),isFetchNextPageError:l,isFetchingNextPage:u,isFetchPreviousPageError:d,isFetchingPreviousPage:f,isRefetchError:s&&!l&&!d,isRefetching:a&&!u&&!f}}},us=class extends L{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||ds(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??(this.state.status===`pending`?this.execute(this.state.variables):Promise.resolve())}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey},r=this.#r=I({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)}),i=this.state.status===`pending`,a=!r.canStart();try{if(i)t();else{this.#i({type:`pending`,variables:e,isPaused:a}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:a})}this.state.isPaused&&r.canStart()&&t();let o=await r.start();return await this.#n.config.onSuccess?.(o,e,this.state.context,this,n),await this.options.onSuccess?.(o,e,this.state.context,n),await this.#n.config.onSettled?.(o,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(o,null,e,this.state.context,n),this.#i({type:`success`,data:o}),o}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#r===r&&(this.#r=void 0),this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),F.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function ds(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var fs=class extends Bo{#e;#t;#n;constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}build(e,t,n){let r=new us({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=ps(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=ps(e);if(typeof t==`string`){let n=this.#t.get(t);if(n){if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=ps(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}return!0}runNext(e){let t=ps(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){F.batch(()=>{let e=this.getAll();this.#e.clear(),this.#t.clear(),e.forEach(e=>{this.notify({type:`removed`,mutation:e})})})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>yo(t,e))}findAll(e={}){return this.getAll().filter(t=>yo(e,t))}notify(e){F.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return F.batch(()=>Promise.all(e.map(e=>e.continue().catch(po))))}};function ps(e){return e.options.scope?.id}var ms=class extends Bo{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),To(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&xo(t.mutationKey)!==xo(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onSubscribe(){this.listeners.size===1&&this.#n&&(this.#n.addObserver(this),this.#i())}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??ds();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){F.batch(()=>{let t=this.#r;if(t&&this.hasListeners()){let n=this.#t.variables,r=this.#t.context,i={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{t.onSuccess?.(e.data,n,r,i)}catch(e){Promise.reject(e)}try{t.onSettled?.(e.data,null,n,r,i)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{t.onError?.(e.error,n,r,i)}catch(e){Promise.reject(e)}try{t.onSettled?.(void 0,e.error,n,r,i)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}},hs=class extends Bo{#e;constructor(e={}){super(),this.config=e,this.#e=new Map}build(e,t,n){let r=t.queryKey,i=t.queryHash??bo(r,t),a=this.get(i);return a||(a=new $o({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){this.#e.get(e.queryHash)===e&&(e.destroy(),this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){F.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>vo(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>vo(e,t)):t}notify(e){F.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){F.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){F.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},gs=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new hs,this.#t=e.mutationCache||new fs,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=Vo.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=Wo.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(_o(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=mo(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return F.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;F.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return F.batch(()=>{let r=n.findAll(e),i=new Set(r);return r.forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,predicate:e=>i.has(e)},t)})}cancelQueries(e,t={}){let n={revert:!0,...t},r=F.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(po).catch(po)}invalidateQueries(e,t={}){return F.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=F.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n),r=e.state.fetchStatus===`paused`;return(!n.throwOnError||r)&&(t=t.catch(po)),r?Promise.resolve():t}));return Promise.all(r).then(po)}async query(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t),r=n.isStaleByTime(_o(t.staleTime,n))?await n.fetch(t):n.state.data,i=t.select;return i?i(r):r}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(_o(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(po).catch(po)}infiniteQuery(e){return e._type=`infinite`,this.query(e)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(po).catch(po)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return Wo.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(xo(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{So(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(xo(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{So(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=bo(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===No&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},_s=T.createContext(!1),vs=()=>T.useContext(_s);_s.Provider;function ys(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var bs=T.createContext(ys()),xs=()=>T.useContext(bs),Ss=(e,t,n)=>{let r=n?.state.status===`error`&&typeof e.throwOnError==`function`?Fo(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||r)&&(t.isReset()||(e.retryOnMount=!1))},Cs=e=>{T.useEffect(()=>{e.clearReset()},[e])},ws=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||Fo(n,[e.error,r])),Ts=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))}},Es=(e,t)=>e?.suspense&&t.isPending,Ds=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Os(e,t,n){let r=vs(),i=xs(),a=oo(n),o=a.defaultQueryOptions(e),s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,Ts(o),Ss(o,i,s),Cs(i);let[l]=T.useState(()=>new t(a,o)),u=l.getOptimisticResult(o);T.useEffect(()=>{l.setOptions(o)},[o,l]);let d=!r&&c;if(T.useSyncExternalStore(T.useCallback(e=>{let t=d?l.subscribe(F.batchCalls(e)):po;return l.updateResult(),t},[l,d]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),Es(o,u))throw Ds(o,l,i);if(ws({result:u,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw u.error;return o.notifyOnChangeProps?u:l.trackResult(u)}function ks(e,t){return Os(e,rs,t)}function As(e,t){let n=oo(t),[r]=T.useState(()=>new ms(n,e));T.useEffect(()=>{r.setOptions(e)},[r,e]);let i=T.useSyncExternalStore(T.useCallback(e=>r.subscribe(F.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=T.useCallback((...e)=>{r.mutate(e[0],e[1]).catch(po)},[r]);if(i.error&&Fo(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}function js(e,t){return Os(e,ls,t)}var Ms={neutral:`bg-hover text-muted`,success:`bg-success/15 text-success-text`,danger:`bg-danger/15 text-danger-text`,warning:`border border-warning-line bg-warning-bg text-warning-text`};function Ns({tone:e,children:t}){return(0,j.jsx)(`span`,{className:`inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium ${Ms[e]}`,children:t})}function Ps({label:e,error:t,hint:n,hideLabel:r,...i}){let{id:a,errorId:o,hintId:s,aria:c}=S({error:t,hint:n});return(0,j.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(`input`,{type:`checkbox`,...i,...c,className:`size-4 shrink-0 appearance-none rounded-[4px] border border-field-line bg-field bg-center bg-no-repeat checked:border-accent checked:bg-accent checked:bg-[url(data:image/svg+xml,%3Csvg%20xmlns=%27http://www.w3.org/2000/svg%27%20viewBox=%270%200%2016%2016%27%20fill=%27none%27%20stroke=%27white%27%20stroke-width=%272%27%20stroke-linecap=%27round%27%20stroke-linejoin=%27round%27%3E%3Cpath%20d=%27M3.5%208.5l3%203%206-7%27/%3E%3C/svg%3E)] forced-colors:appearance-auto disabled:opacity-50 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus aria-[invalid=true]:outline-2 aria-[invalid=true]:outline-danger`}),(0,j.jsx)(`label`,{htmlFor:a,className:r?`sr-only`:`text-sm text-text`,children:e})]}),(0,j.jsx)(ee,{errorId:o,hintId:s,error:t,hint:n})]})}var Fs={name:`archive`,size:24,node:[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8`,key:`1s80jp`}],[`path`,{d:`M10 12h4`,key:`a56b0p`}]]};Fs.node;var Is=_(Fs),Ls={name:`arrow-down`,size:24,node:[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]};Ls.node;var Rs=_(Ls),zs={name:`arrow-up`,size:24,node:[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]};zs.node;var Bs=_(zs),Vs={name:`at-sign`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8`,key:`7n84p3`}]]};Vs.node;var Hs=_(Vs),Us={name:`braces`,size:24,node:[[`path`,{d:`M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1`,key:`ezmyqa`}],[`path`,{d:`M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1`,key:`e1hn23`}]],aliases:[`curly-braces`]};Us.node;var Ws=_(Us),Gs={name:`calendar`,size:24,node:[[`path`,{d:`M8 2v3`,key:`1ioesn`}],[`path`,{d:`M16 2v3`,key:`otl347`}],[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}],[`path`,{d:`M3 9h18`,key:`1pudct`}]]};Gs.node;var Ks=_(Gs),qs={name:`check`,size:24,node:[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]};qs.node;var Js=_(qs),Ys={name:`chevron-down`,size:24,node:[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]};Ys.node;var Xs=_(Ys),Zs={name:`chevron-right`,size:24,node:[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]};Zs.node;var Qs=_(Zs),$s={name:`chevrons-up-down`,size:24,node:[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]};$s.node;var ec=_($s),tc={name:`circle-check`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16 9-5.5 5.5L8 12`,key:`xofnsj`}]],aliases:[`check-circle-2`]};tc.node;var nc=_(tc),rc={name:`circle-exclamation-point`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]],aliases:[`alert-circle`,`circle-alert`]};rc.node;var ic=_(rc),ac={name:`clock`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]};ac.node;var oc=_(ac),sc={name:`copy`,size:24,node:[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]};sc.node;var cc=_(sc),lc={name:`database`,size:24,node:[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 21 19V5`,key:`1wlel7`}],[`path`,{d:`M3 12A9 3 0 0 0 21 12`,key:`mv7ke4`}]]};lc.node;var uc=_(lc),dc={name:`ellipsis`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]],aliases:[`more-horizontal`]};dc.node;var fc=_(dc),pc={name:`eye`,size:24,node:[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]};pc.node;var mc=_(pc),hc={name:`file-down`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M12 18v-6`,key:`17g6i2`}],[`path`,{d:`m9 15 3 3 3-3`,key:`1npd3o`}]]};hc.node;var gc=_(hc),_c={name:`file-text`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]};_c.node;var vc=_(_c),yc={name:`file-up`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M12 12v6`,key:`3ahymv`}],[`path`,{d:`m15 15-3-3-3 3`,key:`15xj92`}]]};yc.node;var bc=_(yc),xc={name:`grip-vertical`,size:24,node:[[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}],[`circle`,{cx:`9`,cy:`5`,r:`1`,key:`hp0tcf`}],[`circle`,{cx:`9`,cy:`19`,r:`1`,key:`fkjjf6`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`15`,cy:`5`,r:`1`,key:`19l28e`}],[`circle`,{cx:`15`,cy:`19`,r:`1`,key:`f4zoj3`}]]};xc.node;var Sc=_(xc),Cc={name:`hard-drive`,size:24,node:[[`path`,{d:`M10 16h.01`,key:`1bzywj`}],[`path`,{d:`M2.212 11.577a2 2 0 0 0-.212.896V18a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-5.527a2 2 0 0 0-.212-.896L18.55 5.11A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`18tbho`}],[`path`,{d:`M21.946 12.013H2.054`,key:`zqlbp7`}],[`path`,{d:`M6 16h.01`,key:`1pmjb7`}]]};Cc.node;var wc=_(Cc),Tc={name:`hash`,size:24,node:[[`line`,{x1:`4`,x2:`20`,y1:`9`,y2:`9`,key:`4lhtct`}],[`line`,{x1:`4`,x2:`20`,y1:`15`,y2:`15`,key:`vyu0kd`}],[`line`,{x1:`10`,x2:`8`,y1:`3`,y2:`21`,key:`1ggp8o`}],[`line`,{x1:`16`,x2:`14`,y1:`3`,y2:`21`,key:`weycgp`}]]};Tc.node;var Ec=_(Tc),Dc={name:`inbox`,size:24,node:[[`polyline`,{points:`22 12 16 12 14 15 10 15 8 12 2 12`,key:`o97t9d`}],[`path`,{d:`M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`oot6mr`}]]};Dc.node;var Oc=_(Dc),kc={name:`key-round`,size:24,node:[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]};kc.node;var Ac=_(kc),jc={name:`layout-grid`,size:24,node:[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`1g98yp`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`,key:`6d4xhi`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`,key:`nxv5o0`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}]]};jc.node;var Mc=_(jc),Nc={name:`link-2`,size:24,node:[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7h2`,key:`8i5ue5`}],[`path`,{d:`M15 7h2a5 5 0 1 1 0 10h-2`,key:`1b9ql8`}],[`line`,{x1:`8`,x2:`16`,y1:`12`,y2:`12`,key:`1jonct`}]]};Nc.node;var Pc=_(Nc),Fc={name:`lock`,size:24,node:[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`,key:`fwvmzm`}]]};Fc.node;var Ic=_(Fc),Lc={name:`log-out`,size:24,node:[[`path`,{d:`m16 17 5-5-5-5`,key:`1bji2h`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}]]};Lc.node;var Rc=_(Lc),zc={name:`mail`,size:24,node:[[`path`,{d:`m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7`,key:`132q7q`}],[`rect`,{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`,key:`izxlao`}]]};zc.node;var Bc=_(zc),Vc={name:`map-pin`,size:24,node:[[`path`,{d:`M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0`,key:`1r0f0z`}],[`circle`,{cx:`12`,cy:`10`,r:`3`,key:`ilqhr7`}]]};Vc.node;var Hc=_(Vc),Uc={name:`menu`,size:24,node:[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]};Uc.node;var Wc=_(Uc),Gc={name:`paperclip`,size:24,node:[[`path`,{d:`m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551`,key:`1miecu`}]]};Gc.node;var Kc=_(Gc),qc={name:`plus`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]};qc.node;var Jc=_(qc),Yc={name:`power-off`,size:24,node:[[`path`,{d:`M18.36 6.64A9 9 0 0 1 20.77 15`,key:`dxknvb`}],[`path`,{d:`M6.16 6.16a9 9 0 1 0 12.68 12.68`,key:`1x7qb5`}],[`path`,{d:`M12 2v4`,key:`3427ic`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]};Yc.node;var Xc=_(Yc),Zc={name:`puzzle`,size:24,node:[[`path`,{d:`M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z`,key:`w46dr5`}]]};Zc.node;var Qc=_(Zc),$c={name:`scroll-text`,size:24,node:[[`path`,{d:`M15 12h-5`,key:`r7krc0`}],[`path`,{d:`M15 8h-5`,key:`1khuty`}],[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`,key:`zz82l3`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`,key:`1ph1d7`}]]};$c.node;var el=_($c),tl={name:`search-x`,size:24,node:[[`path`,{d:`m13.5 8.5-5 5`,key:`1cs55j`}],[`path`,{d:`m8.5 8.5 5 5`,key:`a8mexj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`path`,{d:`m21 21-4.3-4.3`,key:`1qie3q`}]]};tl.node;var nl=_(tl),rl={name:`search`,size:24,node:[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]};rl.node;var il=_(rl),al={name:`settings`,size:24,node:[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]};al.node;var ol=_(al),sl={name:`shield`,size:24,node:[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}]]};sl.node;var cl=_(sl),ll={name:`sliders-horizontal`,size:24,node:[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]};ll.node;var ul=_(ll),dl={name:`terminal`,size:24,node:[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]};dl.node;var fl=_(dl),pl={name:`toggle-left`,size:24,node:[[`circle`,{cx:`9`,cy:`12`,r:`3`,key:`u3jwor`}],[`rect`,{width:`20`,height:`14`,x:`2`,y:`5`,rx:`7`,key:`g7kal2`}]]};pl.node;var ml=_(pl),hl={name:`trash`,size:24,node:[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]],aliases:[`trash-2`]};hl.node;var gl=_(hl),_l={name:`triangle-exclamation-point`,size:24,node:[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]],aliases:[`alert-triangle`,`triangle-alert`]};_l.node;var vl=_(_l),yl={name:`type`,size:24,node:[[`path`,{d:`M12 4v16`,key:`1654pz`}],[`path`,{d:`M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2`,key:`e0r10z`}],[`path`,{d:`M9 20h6`,key:`s66wpe`}]]};yl.node;var bl=_(yl),xl={name:`users`,size:24,node:[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]};xl.node;var Sl=_(xl),Cl={name:`x`,size:24,node:[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]};Cl.node;var R=_(Cl),wl=e(n(),1),Tl=[`body`,`footer`].flatMap(e=>[`input`,`select`,`textarea`,`button`].map(t=>`[data-part=${e}] ${t}:not([disabled])`)).join(`, `);function El(e){let t=(0,T.useRef)(null),n=(0,T.useRef)(null),r=(0,T.useId)(),i=()=>{n.current?.focus?.(),n.current=null};return(0,T.useEffect)(()=>{let r=t.current;r&&(e.open&&!r.open&&(n.current=document.activeElement,r.showModal(),r.contains(document.activeElement)||([...r.querySelectorAll(Tl)].find(e=>!e.closest(`[hidden]`))??r.querySelector(`[data-part=close]`))?.focus()),!e.open&&r.open&&(r.close(),i()))},[e.open]),(0,T.useEffect)(()=>i,[]),(0,wl.createPortal)((0,j.jsx)(`dialog`,{ref:t,"aria-labelledby":r,className:e.className,onSubmit:e=>e.stopPropagation(),onKeyDown:t=>{t.key===`Escape`&&(t.preventDefault(),t.stopPropagation(),e.onClose())},onClose:t=>{t.target===t.currentTarget&&(i(),e.open&&e.onClose())},children:e.open&&(0,j.jsxs)(`div`,{"data-part":`content`,children:[(0,j.jsxs)(`div`,{"data-part":`header`,children:[(0,j.jsx)(`h2`,{id:r,"data-part":`title`,children:e.title}),(0,j.jsx)(`button`,{type:`button`,"data-part":`close`,"aria-label":`Close`,onClick:e.onClose,children:e.closeIcon??`×`})]}),(0,j.jsx)(`div`,{"data-part":`body`,children:e.children}),e.footer&&(0,j.jsx)(`div`,{"data-part":`footer`,children:e.footer})]})}),document.body)}var Dl=a({base:[`border border-line bg-raised p-0 text-text shadow-overlay backdrop:bg-scrim`,`[&_[data-part=content]]:flex [&_[data-part=content]]:max-h-dvh [&_[data-part=content]]:flex-col`,`[&_[data-part=header]]:flex [&_[data-part=header]]:items-center [&_[data-part=header]]:justify-between [&_[data-part=header]]:gap-2 [&_[data-part=header]]:border-b [&_[data-part=header]]:border-line [&_[data-part=header]]:py-3 [&_[data-part=header]]:pl-4 [&_[data-part=header]]:pr-3`,`[&_[data-part=title]]:text-base [&_[data-part=title]]:font-semibold`,`[&_[data-part=close]]:inline-flex [&_[data-part=close]]:size-8 [&_[data-part=close]]:items-center [&_[data-part=close]]:justify-center [&_[data-part=close]]:rounded-control [&_[data-part=close]]:text-muted [&_[data-part=close]:hover]:bg-hover [&_[data-part=close]:hover]:text-text [&_[data-part=close]:focus-visible]:outline-2 [&_[data-part=close]:focus-visible]:outline-focus`,`[&_[data-part=body]]:flex-1 [&_[data-part=body]]:overflow-auto [&_[data-part=body]]:p-4`,`[&_[data-part=footer]]:flex [&_[data-part=footer]]:flex-wrap [&_[data-part=footer]]:justify-end [&_[data-part=footer]]:gap-2 [&_[data-part=footer]]:border-t [&_[data-part=footer]]:border-line [&_[data-part=footer]]:p-4`],variants:{variant:{center:`m-auto w-full max-w-lg rounded-base`,side:`ml-auto h-dvh max-h-dvh w-full max-w-xl [&_[data-part=content]]:h-full`},size:{md:``,lg:``}},compoundVariants:[{variant:`center`,size:`lg`,class:`max-w-3xl`}],defaultVariants:{variant:`center`,size:`md`}});function Ol({variant:e,size:t,...n}){return(0,j.jsx)(El,{...n,closeIcon:(0,j.jsx)(R,{size:15,strokeWidth:1.75,"aria-hidden":!0}),className:Dl({variant:e,size:t})})}function kl({label:e,error:t,hint:n,className:r,...i}){let a=S({error:t,hint:n});return(0,j.jsx)(c,{...a,label:e,error:t,hint:n,children:(0,j.jsx)(`input`,{type:`text`,...i,...a.aria,className:`${o} ${r??``}`})})}var Al=(0,T.createContext)(null);function jl({children:e}){let[t,n]=(0,T.useState)(null),[r,i]=(0,T.useState)(``),a=(0,T.useRef)(()=>{}),o=(0,T.useCallback)(e=>new Promise(t=>{a.current(!1),a.current=t,i(``),n(e)}),[]),s=e=>{a.current(e),n(null)},c=!!t?.typeToConfirm&&r!==t.typeToConfirm;return(0,j.jsxs)(Al.Provider,{value:o,children:[e,(0,j.jsxs)(Ol,{open:!!t,onClose:()=>s(!1),title:t?.title??``,footer:(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(w,{onClick:()=>s(!1),children:t?.cancelLabel??`Cancel`}),(0,j.jsx)(w,{variant:t?.danger?`danger`:`primary`,disabled:c,onClick:()=>s(!0),children:t?.confirmLabel})]}),children:[(0,j.jsx)(`p`,{className:`text-sm text-text`,children:t?.message}),t?.typeToConfirm&&(0,j.jsx)(`div`,{className:`mt-3`,children:(0,j.jsx)(kl,{label:`Type "${t.typeToConfirm}" to confirm`,value:r,onChange:e=>i(e.target.value)})})]})]})}function Ml(){let e=(0,T.useContext)(Al);if(!e)throw Error(`ConfirmProvider is missing`);return e}var Nl={idle:`Copy`,copied:`Copied`,failed:`Could not copy`},Pl={idle:cc,copied:Js,failed:vl};function Fl({text:e,label:t=`Copy`,showLabel:n=!1}){let[r,i]=(0,T.useState)(`idle`),a=(0,T.useRef)(void 0);(0,T.useEffect)(()=>()=>clearTimeout(a.current),[]);let o=async()=>{let t=`copied`;try{await navigator.clipboard.writeText(e)}catch{t=`failed`}i(t),clearTimeout(a.current),a.current=setTimeout(()=>i(`idle`),2e3)},s=Pl[r];return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(f,{content:Nl[r],children:(0,j.jsx)(w,{variant:n?void 0:`ghost`,size:n?void 0:`sm`,"aria-label":n?void 0:t,onClick:o,icon:(0,j.jsx)(s,{size:15,strokeWidth:1.75,className:r===`failed`?`text-danger-text`:void 0}),children:n&&t})}),(0,j.jsx)(`span`,{role:`status`,className:`sr-only`,children:r===`idle`?``:Nl[r]})]})}function Il({title:e,icon:t,badge:n,defaultOpen:r=!1,open:i,onOpenChange:a,children:o}){let[s,c]=(0,T.useState)(r),l=i??s,u=()=>{c(!l),a?.(!l)},d=(0,T.useId)();return(0,j.jsxs)(`div`,{className:`rounded-base border border-line`,children:[(0,j.jsxs)(`button`,{type:`button`,"aria-expanded":l,"aria-controls":d,onClick:u,className:`flex w-full items-center gap-2 rounded-base px-3 py-2 text-left text-sm font-medium text-text hover:bg-hover focus-visible:outline-2 focus-visible:outline-focus`,children:[(0,j.jsx)(Qs,{size:15,strokeWidth:1.75,"aria-hidden":!0,className:`text-muted transition-transform duration-(--hb-duration) motion-reduce:transition-none ${l?`rotate-90`:``}`}),t,(0,j.jsx)(`span`,{children:e}),n!=null&&(0,j.jsx)(`span`,{className:`ml-auto`,children:n})]}),(0,j.jsx)(`div`,{id:d,hidden:!l,className:`border-t border-line p-3`,children:o})]})}function Ll({title:e,icon:t,children:n}){return(0,j.jsxs)(`div`,{className:`flex flex-col items-center gap-2 px-8 py-12 text-center text-sm text-muted`,children:[t&&(0,j.jsx)(`span`,{className:`mb-1 flex size-9 items-center justify-center rounded-full bg-hover text-muted`,children:t}),(0,j.jsx)(`p`,{className:`font-medium text-text`,children:e}),n]})}function Rl({label:e,error:t,hint:n,accept:r,multiple:i,disabled:a,name:o,onChange:s}){let l=S({error:t,hint:n}),u=(0,T.useRef)(null),[d,f]=(0,T.useState)([]),[p,m]=(0,T.useState)(!1),h=e=>{e.length!==0&&(f(e.map(e=>e.name)),s(e))};return(0,j.jsx)(c,{...l,label:e,error:t,hint:n,children:(0,j.jsxs)(`div`,{"data-testid":`file-drop`,onDragOver:e=>{e.preventDefault(),a||m(!0)},onDragLeave:()=>m(!1),onDrop:e=>{if(e.preventDefault(),m(!1),a)return;let t=[...e.dataTransfer.files];h(i?t:t.slice(0,1))},className:`flex items-center gap-3 rounded-control border border-dashed bg-surface p-3 text-sm has-[input:focus-visible]:outline-2 has-[input:focus-visible]:outline-focus ${p?`border-accent`:`border-field-line`} ${a?`opacity-50`:``}`,children:[(0,j.jsx)(`input`,{ref:u,type:`file`,name:o,accept:r,multiple:i,disabled:a,...l.aria,className:`sr-only`,onChange:e=>{h([...e.target.files??[]]),e.target.value=``}}),(0,j.jsx)(w,{tabIndex:-1,disabled:a,onClick:()=>u.current?.click(),children:i?`Choose files`:`Choose file`}),(0,j.jsx)(`span`,{className:`min-w-0 truncate text-muted`,children:d.length>0?d.join(`, `):`or drop here`})]})})}function zl({label:e,error:t,hint:n,...r}){let i=S({error:t,hint:n}),a=[i.aria[`aria-describedby`],r[`aria-describedby`]].filter(Boolean).join(` `)||void 0;return(0,j.jsx)(c,{...i,label:e,error:t,hint:n,children:(0,j.jsx)(`input`,{type:`number`,...r,...i.aria,"aria-invalid":i.aria[`aria-invalid`]??r[`aria-invalid`],"aria-describedby":a,className:o})})}function Bl({title:e,children:t}){let n=(0,T.useId)();return(0,j.jsxs)(`section`,{"aria-labelledby":n,className:`flex flex-col gap-3`,children:[(0,j.jsx)(`h3`,{id:n,className:`text-sm font-semibold text-text`,children:e}),t]})}function Vl({label:e,error:t,hint:n,children:r,...i}){let a=S({error:t,hint:n});return(0,j.jsx)(c,{...a,label:e,error:t,hint:n,children:(0,j.jsxs)(`div`,{className:`relative`,children:[(0,j.jsx)(`select`,{...i,...a.aria,className:`${o} appearance-none pr-8`,children:r}),(0,j.jsx)(Xs,{size:15,strokeWidth:1.75,"aria-hidden":!0,className:`pointer-events-none absolute right-2.5 top-1/2 -translate-y-1/2 text-muted`})]})})}function Hl({caption:e,stickyHeader:t,children:n}){return(0,j.jsx)(`div`,{className:`overflow-auto${t?` max-h-[calc(100dvh-12rem)]`:``}`,children:(0,j.jsxs)(`table`,{"data-sticky-header":t||void 0,className:`w-full border-collapse text-left text-sm${t?` [&_th]:sticky [&_th]:top-0 [&_th]:z-10 [&_th]:bg-surface`:``}`,children:[e&&(0,j.jsx)(`caption`,{className:`sr-only`,children:e}),n]})})}var Ul={asc:Bs,desc:Rs};function Wl({children:e,sort:t,onSort:n,align:r}){let i=t===`asc`?`ascending`:t===`desc`?`descending`:`none`,a=t?Ul[t]:ec;return(0,j.jsx)(`th`,{scope:`col`,"aria-sort":n?i:void 0,className:`border-b border-line px-3 py-2 text-xs font-medium text-muted${r===`right`?` text-right`:``}`,children:n?(0,j.jsxs)(`button`,{type:`button`,onClick:n,className:`inline-flex items-center gap-1 rounded font-medium hover:text-text focus-visible:outline-2 focus-visible:outline-focus`,children:[e,(0,j.jsx)(a,{size:13,strokeWidth:1.75,"aria-hidden":!0,className:t?`text-text`:`text-faint`})]}):e})}function Gl({children:e,wrap:t,fill:n,align:r}){let i=!t&&typeof e==`string`;return(0,j.jsx)(`td`,{title:i?e:void 0,className:`border-b border-line px-3 py-2 text-text${r===`right`?` text-right`:``}${n?` w-full max-w-0`:t?``:` max-w-xs whitespace-nowrap`}${i?` truncate`:``}`,children:e})}function Kl(e,t){return{tab:`${e}-tab-${t}`,panel:`${e}-panel-${t}`}}function ql(e){let t=(0,T.useId)(),n=e.id??t,r=(0,T.useRef)(null),i=e.tabs.filter(e=>!e.disabled),a=i.some(t=>t.value===e.value)?e.value:i[0]?.value,o=t=>{e.onChange(t),r.current?.querySelector(`[data-key="${CSS.escape(t)}"]`)?.focus()};return(0,j.jsx)(`div`,{ref:r,role:`tablist`,"aria-label":e.label,className:e.className,onKeyDown:t=>{if(!i.length)return;let n=i.findIndex(t=>t.value===e.value),r=n<=0?i.length-1:n-1,a=t.key===`ArrowRight`?i[(n+1)%i.length]:t.key===`ArrowLeft`?i[r]:t.key===`Home`?i[0]:t.key===`End`?i[i.length-1]:void 0;a&&(t.preventDefault(),o(a.value))},children:e.tabs.map(t=>{let r=t.value===e.value,i=Kl(n,t.value);return(0,j.jsx)(`button`,{id:i.tab,role:`tab`,type:`button`,"data-key":t.value,"aria-selected":r,"aria-controls":i.panel,"data-selected":r?``:void 0,disabled:t.disabled,tabIndex:t.value===a?0:-1,onClick:()=>e.onChange(t.value),children:t.label},t.value)})})}function Jl(e){return(0,j.jsx)(ql,{...e,className:`flex gap-1 border-b border-line [&_[role=tab]]:-mb-px [&_[role=tab]]:border-b-2 [&_[role=tab]]:border-transparent [&_[role=tab]]:px-3 [&_[role=tab]]:py-2 [&_[role=tab]]:text-sm [&_[role=tab]]:text-muted [&_[role=tab]]:transition-colors [&_[role=tab]]:duration-[var(--hb-duration)] motion-reduce:[&_[role=tab]]:transition-none [&_[role=tab]:disabled]:cursor-not-allowed [&_[role=tab]:disabled]:opacity-50 [&_[role=tab]:hover:not(:disabled)]:text-text [&_[role=tab]:focus-visible]:outline-2 [&_[role=tab]:focus-visible]:outline-focus [&_[role=tab][data-selected]]:border-accent [&_[role=tab][data-selected]]:font-medium [&_[role=tab][data-selected]]:text-text`})}var Yl=(0,T.createContext)(null);function Xl(e){let t=e.kind===`error`?ic:nc;return(0,j.jsxs)(`div`,{role:e.kind===`error`?`alert`:void 0,className:`${s} flex items-center gap-2 rounded-base px-3 py-2 text-sm text-text`,children:[(0,j.jsx)(t,{size:15,strokeWidth:1.75,className:e.kind===`error`?`text-danger-text`:`text-accent-text`}),e.message]},e.id)}function Zl({children:e}){let[t,n]=(0,T.useState)([]),r=(0,T.useRef)(1),i=(0,T.useCallback)((e,t)=>{let i=r.current++;n(n=>[...n,{id:i,kind:e,message:t}]),setTimeout(()=>n(e=>e.filter(e=>e.id!==i)),4e3)},[]),a=(0,T.useMemo)(()=>({success:e=>i(`success`,e),error:e=>i(`error`,e)}),[i]);return(0,j.jsxs)(Yl.Provider,{value:a,children:[e,(0,j.jsx)(`div`,{role:`status`,"aria-live":`polite`,className:`fixed right-4 bottom-4 z-50 flex flex-col gap-2`,children:t.map(Xl)})]})}function Ql(){let e=(0,T.useContext)(Yl);if(!e)throw Error(`ToastProvider is missing`);return e}function $l(e){let[t,n]=v(e.checked,e.defaultChecked??!1,e.onChange);return(0,j.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":t,"aria-label":e.label,"aria-describedby":e[`aria-describedby`],"aria-invalid":e[`aria-invalid`],disabled:e.disabled,className:e.className,"data-checked":t?``:void 0,"data-disabled":e.disabled?``:void 0,onClick:()=>n(!t),children:(0,j.jsx)(`span`,{"data-thumb":``})})}function eu({label:e,error:t,hint:n,...r}){let{errorId:i,hintId:a,aria:o}=S({error:t,hint:n});return(0,j.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,j.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,j.jsx)($l,{...r,label:e,"aria-describedby":o[`aria-describedby`],"aria-invalid":o[`aria-invalid`],className:`relative h-5 w-9 shrink-0 rounded-full bg-control transition-colors duration-[var(--hb-duration)] motion-reduce:transition-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus aria-[invalid=true]:outline-2 aria-[invalid=true]:outline-danger disabled:opacity-50 data-[checked]:bg-accent [&>span]:absolute [&>span]:top-0.5 [&>span]:left-0.5 [&>span]:size-4 [&>span]:rounded-full [&>span]:bg-thumb [&>span]:transition-transform [&>span]:duration-[var(--hb-duration)] motion-reduce:[&>span]:transition-none data-[checked]:[&>span]:translate-x-4`}),(0,j.jsx)(`span`,{className:`text-sm text-text`,children:e})]}),(0,j.jsx)(ee,{errorId:i,hintId:a,error:t,hint:n})]})}function tu(e,t){let n=(0,T.useRef)(``),r=(0,T.useRef)(void 0),i=(0,T.useCallback)(i=>{let a=t.orientation===`horizontal`;if(!a&&i.key===`ArrowDown`||a&&i.key===`ArrowRight`){i.preventDefault(),e.next();return}if(!a&&i.key===`ArrowUp`||a&&i.key===`ArrowLeft`){i.preventDefault(),e.previous();return}if(i.key===`Home`){i.preventDefault(),e.first();return}if(i.key===`End`){i.preventDefault(),e.last();return}if((i.key===`Enter`||i.key===` `)&&e.activeKey){i.preventDefault(),t.onSelect?.(e.activeKey);return}if(i.key.length!==1||i.ctrlKey||i.metaKey||i.altKey)return;n.current+=i.key.toLocaleLowerCase(),clearTimeout(r.current),r.current=setTimeout(()=>{n.current=``},500);let o=e.enabledKeys,s=e.activeKey?o.indexOf(e.activeKey):-1;for(let r=1;r<=o.length;r++){let i=o[(s+r)%o.length];if(t.labels[i]?.toLocaleLowerCase().startsWith(n.current)){e.setActiveKey(i);break}}},[e,t]);return(0,T.useEffect)(()=>()=>clearTimeout(r.current),[]),{onKeyDown:i}}function nu(e){let[t,n]=(0,T.useState)(null),r=e.keys.filter(t=>!e.disabledKeys?.includes(t)),i=(0,T.useCallback)(()=>n(r[0]??null),[r.join(`\0`)]),a=(0,T.useCallback)(()=>n(r[r.length-1]??null),[r.join(`\0`)]),o=(0,T.useCallback)(e=>{if(!r.length){n(null);return}let i=r.indexOf(t);n(i===-1?e>0?r[0]:r[r.length-1]:r[(i+e+r.length)%r.length])},[t,r.join(`\0`)]);return{activeKey:t,enabledKeys:r,setActiveKey:n,first:i,last:a,next:(0,T.useCallback)(()=>o(1),[o]),previous:(0,T.useCallback)(()=>o(-1),[o])}}function ru(e){let t=h({}),n=(0,T.useId)(),r=e.trigger.props.id??`${n}-trigger`,i=(0,T.useRef)(null),a=x(i,e.trigger.props.ref),o=(0,T.useRef)(null),s=(0,T.useRef)(!1),c=e.items.filter(e=>`key`in e),u=nu({keys:c.map(e=>e.key),disabledKeys:c.filter(e=>e.disabled).map(e=>e.key)}),d=g(i,o,t.open),f=y(i,o,{open:t.open,placement:e.placement??`bottom-start`});p(o,{open:t.open,onDismiss:t.close,triggerRef:i});let m=n=>{t.close(),e.onAction(n)},_=tu(u,{orientation:`vertical`,labels:Object.fromEntries(c.map(e=>[e.key,e.label])),onSelect:m}),v=()=>{document.activeElement&&document.activeElement!==document.body||i.current?.focus()};(0,T.useEffect)(()=>{t.open&&u.activeKey&&o.current?.querySelector(`[data-key="${CSS.escape(u.activeKey)}"]`)?.focus()},[t.open,u.activeKey]),(0,T.useEffect)(()=>{!t.open&&s.current&&queueMicrotask(v),s.current=t.open},[t.open]);let b=c.find(e=>e.checked)?.key,S=e=>{b?u.setActiveKey(b):u[e](),t.setOpen(!0)},C=e=>{(e.key===`ArrowDown`||e.key===`ArrowUp`)&&(e.preventDefault(),S(e.key===`ArrowDown`?`first`:`last`))},w=e=>{e.key===`Tab`?t.close():_.onKeyDown(e)},ee=(0,T.cloneElement)(e.trigger,l(e.trigger.props,{ref:a,id:r,"aria-expanded":t.open,"aria-controls":t.open?n:void 0,"aria-haspopup":`menu`,onClick:()=>{t.open||(b?u.setActiveKey(b):u.first()),t.toggle()},onKeyDown:C}));return(0,j.jsxs)(j.Fragment,{children:[ee,d&&(0,wl.createPortal)((0,j.jsx)(`div`,{ref:o,id:n,role:`menu`,popover:`manual`,"aria-labelledby":r,className:e.className,style:f.style,onKeyDown:w,"data-open":``,"data-placement":f.placement,children:e.items.map((e,t)=>`separator`in e?(0,j.jsx)(`div`,{role:`separator`},`separator-${t}`):`heading`in e?(0,j.jsx)(`div`,{role:`presentation`,"data-heading":``,children:e.heading},`heading-${t}`):(0,j.jsxs)(`div`,{role:e.checked===void 0?`menuitem`:`menuitemradio`,"aria-checked":e.checked,"data-key":e.key,tabIndex:u.activeKey===e.key?0:-1,"aria-disabled":e.disabled||void 0,"data-disabled":e.disabled?``:void 0,"data-active":u.activeKey===e.key?``:void 0,"data-danger":e.danger?``:void 0,onClick:()=>!e.disabled&&m(e.key),onPointerMove:()=>!e.disabled&&u.setActiveKey(e.key),children:[e.icon,(0,j.jsx)(`span`,{children:e.label}),e.shortcut&&(0,j.jsx)(`kbd`,{children:e.shortcut})]},e.key))}),d)]})}var iu=a({base:[s,`z-50 min-w-44 rounded-base p-1 text-sm text-text outline-none`,`[&_[role^=menuitem]]:flex [&_[role^=menuitem]]:cursor-default [&_[role^=menuitem]]:items-center [&_[role^=menuitem]]:gap-2 [&_[role^=menuitem]]:rounded-control [&_[role^=menuitem]]:px-2.5 [&_[role^=menuitem]]:py-1.5 [&_[role^=menuitem]]:outline-none`,`[&_[role^=menuitem]>span]:flex-1 [&_kbd]:font-sans [&_kbd]:text-xs [&_kbd]:text-faint`,`[&_[data-active]]:bg-hover [&_[data-disabled]]:opacity-50`,`[&_[data-danger]]:text-danger-text [&_[data-danger][data-active]]:bg-danger/10`,`[&_[data-heading]]:px-2.5 [&_[data-heading]]:py-1 [&_[data-heading]]:text-xs [&_[data-heading]]:font-medium [&_[data-heading]]:text-faint`,`[&_[role=separator]]:my-1 [&_[role=separator]]:h-px [&_[role=separator]]:bg-line`]});function au({className:e,...t}){return(0,j.jsx)(ru,{...t,className:iu({className:e})})}var ou=(0,T.createContext)(null),su=(0,T.createContext)(null);function cu(){let e=(0,T.useContext)(su);if(!e)throw Error(`ExtensionsContext is missing`);return e}function z(){let e=(0,T.useContext)(ou);if(!e)throw Error(`ClientContext is missing`);return e}function lu(){return new gs({defaultOptions:{queries:{retry:!1},mutations:{retry:!1}}})}function B({client:e,queryClient:t,extensions:n,children:r}){return(0,j.jsx)(ou.Provider,{value:e,children:(0,j.jsx)(su.Provider,{value:n,children:(0,j.jsx)(so,{client:t,children:(0,j.jsx)(Zl,{children:(0,j.jsx)(jl,{children:r})})})})})}var uu=/^[a-z0-9-]+(\/[a-z0-9-]+)*$/;function du(){let e=[],t=[],n=!1,r=()=>{if(n)throw Error(`Dashboard extensions must be registered while extensions.js loads.`)};return{pages:e,links:t,api:n=>({client:n,addPage(t){if(r(),!uu.test(t.path))throw Error(`Invalid extension page path "${t.path}".`);if(e.some(e=>e.path===t.path))throw Error(`Extension page "${t.path}" is already registered.`);e.push(t)},addLink(e){r(),t.push(e)}}),freeze(){n=!0}}}function fu(e,t,n){return window.heybe={dashboard:e.api(t)},new Promise(e=>{let r=document.createElement(`script`);r.type=`module`,r.src=n??t.buildURL(`/_/extensions.js`),r.addEventListener(`load`,()=>e()),r.addEventListener(`error`,()=>{console.warn(`Failed to load dashboard extensions`),e()}),document.head.append(r)}).then(()=>e.freeze())}function pu(e){let{token:t,record:n}=e.authStore;return!!t&&!Ii(t,Date.now())&&n?.collectionName===`_superusers`}async function mu(e){try{return await e.auth(`_superusers`).refresh(),!0}catch(t){return t instanceof ma&&[401,403,404].includes(t.status)?(e.authStore.clear(),!1):!0}}function hu(e){e.client.authStore.clear(),e.queryClient.clear()}async function gu(e){try{let{data:t}=await e.health.check();return t.needsSetup===!0}catch{return}}var _u=async({context:e,location:t})=>{if(!pu(e.client))throw hu(e),await gu(e.client)?Ze({to:`/hbinstall`}):Ze({to:`/login`,search:{redirect:t.href}})},vu=({context:e})=>{if(pu(e.client))throw Ze({to:`/`});e.client.authStore.clear()},yu=async e=>{if(vu(e),await gu(e.context.client))throw Ze({to:`/hbinstall`})},bu=async e=>{if(vu(e),await gu(e.context.client)===!1)throw Ze({to:`/login`})};function xu(e){let t=e.trim(),n=t.match(/\/hbinstall\/([^/?#\s]+)/);return n?n[1]:t}function Su(e){return e&&/^\/(?![/\\])/.test(e)?e:`/collections`}function Cu(e,t){ro(e.client,()=>{let n=t.state.location.href;hu(e),t.navigate({to:`/login`,search:{redirect:n}})})}var wu=`https://github.com/emresandikci/heybe#readme`;function V({crumbs:e,actions:t,width:n=`form`,footer:r,children:i}){let a=`mx-auto w-full ${n===`form`?`max-w-240`:``}`;return(0,j.jsxs)(`div`,{className:`flex flex-1 flex-col gap-4`,children:[(0,j.jsxs)(`div`,{className:`${a} flex flex-1 flex-col gap-4`,children:[(0,j.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-x-4 gap-y-2`,children:[(0,j.jsx)(`h1`,{className:`flex min-w-0 items-center text-lg font-semibold`,children:e.map((t,n)=>{let r=n===e.length-1;return(0,j.jsxs)(T.Fragment,{children:[n>0&&(0,j.jsx)(`span`,{className:`shrink-0 whitespace-pre text-faint`,children:` / `}),t.to&&!r?(0,j.jsx)(ni,{to:t.to,params:t.params,className:`shrink-0 rounded-control text-muted hover:text-text`,children:t.label}):(0,j.jsx)(`span`,{"aria-current":r?`page`:void 0,title:r?t.label:void 0,className:r?`min-w-0 truncate`:`shrink-0 text-muted`,children:t.label})]},n)})}),t&&(0,j.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:t})]}),i]}),(0,j.jsxs)(`footer`,{className:`${a} flex flex-wrap items-center justify-between gap-x-4 gap-y-2 border-t border-line pt-3 text-xs text-faint`,children:[(0,j.jsx)(`div`,{children:r}),(0,j.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,j.jsx)(`a`,{href:wu,target:`_blank`,rel:`noreferrer`,className:`hover:text-text`,children:`Docs`}),(0,j.jsxs)(`span`,{children:[`Heybe v`,`1.4.0`]})]})]})]})}function Tu(){return(0,j.jsx)(V,{crumbs:[{label:`Page not found`}],children:(0,j.jsx)(Ll,{title:`This page does not exist.`,children:(0,j.jsx)(ni,{to:`/collections`,className:`text-accent-text hover:underline`,children:`Collections`})})})}var Eu=class{constructor(e,t){this.fn=e,this.options=t,this.lastExecutionTime=0,this.isPending=!1,this.maybeExecute=(...e)=>{let t=Date.now()-this.lastExecutionTime;if(this.options.leading&&t>=this.options.wait)this.execute(...e);else if(this.lastArgs=e,!this.timeoutId&&this.options.trailing){let e=this.options.wait-t;this.isPending=!0,this.timeoutId=setTimeout(()=>{this.lastArgs!==void 0&&this.execute(...this.lastArgs)},e)}},this.execute=(...e)=>{this.fn(...e),this.options.onExecute?.(e,this),this.lastExecutionTime=Date.now(),this.clearTimeout(),this.lastArgs=void 0,this.isPending=!1},this.flush=()=>{this.isPending&&this.lastArgs&&this.execute(...this.lastArgs)},this.cancel=()=>{this.clearTimeout(),this.lastArgs=void 0,this.isPending=!1},this.clearTimeout=()=>{this.timeoutId&&=(clearTimeout(this.timeoutId),void 0)},this.options.leading===void 0&&this.options.trailing===void 0&&(this.options.leading=!0,this.options.trailing=!0)}};function Du(e,t){return new Eu(e,t).maybeExecute}var Ou=class{#e=!0;#t;#n;#r;#i;#a;#o;#s;#c=0;#l=5;#u=!1;#d=!1;#f=null;#p=()=>{this.debugLog(`Connected to event bus`),this.#a=!0,this.#u=!1,this.debugLog(`Emitting queued events`,this.#i),this.#i.forEach(e=>this.emitEventToBus(e)),this.#i=[],this.stopConnectLoop(),this.#n().removeEventListener(`tanstack-connect-success`,this.#p)};#m=()=>{this.#c<this.#l?(this.#c++,this.dispatchCustomEvent(`tanstack-connect`,{})):(this.#n().removeEventListener(`tanstack-connect`,this.#m),this.#d=!0,this.debugLog(`Max retries reached, giving up on connection`),this.stopConnectLoop())};#h=()=>{this.#u||(this.#u=!0,this.#n().addEventListener(`tanstack-connect-success`,this.#p),this.#m())};constructor({pluginId:e,debug:t=!1,enabled:n=!0,reconnectEveryMs:r=300}){this.#t=e,this.#e=n,this.#n=this.getGlobalTarget,this.#r=t,this.debugLog(` Initializing event subscription for plugin`,this.#t),this.#i=[],this.#a=!1,this.#d=!1,this.#o=null,this.#s=r}startConnectLoop(){this.#o!==null||this.#a||(this.debugLog(`Starting connect loop (every ${this.#s}ms)`),this.#o=setInterval(this.#m,this.#s))}stopConnectLoop(){this.#u=!1,this.#o!==null&&(clearInterval(this.#o),this.#o=null,this.#i=[],this.debugLog(`Stopped connect loop`))}debugLog(...e){this.#r&&console.log(`🌴 [tanstack-devtools:${this.#t}-plugin]`,...e)}getGlobalTarget(){if(typeof globalThis<`u`&&globalThis.__TANSTACK_EVENT_TARGET__)return this.debugLog(`Using global event target`),globalThis.__TANSTACK_EVENT_TARGET__;if(typeof window<`u`&&window.addEventListener!==void 0)return this.debugLog(`Using window as event target`),window;let e=typeof EventTarget<`u`?new EventTarget:void 0;return e===void 0||e.addEventListener===void 0?(this.debugLog(`No event mechanism available, running in non-web environment`),{addEventListener:()=>{},removeEventListener:()=>{},dispatchEvent:()=>!1}):(this.debugLog(`Using new EventTarget as fallback`),e)}getPluginId(){return this.#t}dispatchCustomEventShim(e,t){try{let n=new Event(e,{detail:t});this.#n().dispatchEvent(n)}catch{this.debugLog(`Failed to dispatch shim event`)}}dispatchCustomEvent(e,t){try{this.#n().dispatchEvent(new CustomEvent(e,{detail:t}))}catch{this.dispatchCustomEventShim(e,t)}}emitEventToBus(e){this.debugLog(`Emitting event to client bus`,e),this.dispatchCustomEvent(`tanstack-dispatch-event`,e)}createEventPayload(e,t){return{type:`${this.#t}:${e}`,payload:t,pluginId:this.#t}}emit(e,t){if(!this.#e)this.debugLog(`Event bus client is disabled, not emitting event`,e,t);else if(this.#f&&(this.debugLog(`Emitting event to internal event target`,e,t),this.#f.dispatchEvent(new CustomEvent(`${this.#t}:${e}`,{detail:this.createEventPayload(e,t)}))),this.#d)this.debugLog(`Previously failed to connect, not emitting to bus`);else if(!this.#a)this.debugLog(`Bus not available, will be pushed as soon as connected`),this.#i.push(this.createEventPayload(e,t)),typeof CustomEvent<`u`&&!this.#u&&(this.#h(),this.startConnectLoop());else return this.emitEventToBus(this.createEventPayload(e,t))}on(e,t,n){let r=n?.withEventTarget??!1,i=`${this.#t}:${e}`;if(r&&(this.#f||=new EventTarget,this.#f.addEventListener(i,e=>{t(e.detail)})),!this.#e)return this.debugLog(`Event bus client is disabled, not registering event`,i),()=>{};let a=e=>{this.debugLog(`Received event from bus`,e.detail),t(e.detail)};return this.#n().addEventListener(i,a),this.debugLog(`Registered event to bus`,i),()=>{r&&this.#f?.removeEventListener(i,a),this.#n().removeEventListener(i,a)}}onAll(e){if(!this.#e)return this.debugLog(`Event bus client is disabled, not registering event`),()=>{};let t=t=>{let n=t.detail;e(n)};return this.#n().addEventListener(`tanstack-devtools-global`,t),()=>this.#n().removeEventListener(`tanstack-devtools-global`,t)}onAllPluginEvents(e){if(!this.#e)return this.debugLog(`Event bus client is disabled, not registering event`),()=>{};let t=t=>{let n=t.detail;this.#t&&n.pluginId!==this.#t||e(n)};return this.#n().addEventListener(`tanstack-devtools-global`,t),()=>this.#n().removeEventListener(`tanstack-devtools-global`,t)}},ku=new class extends Ou{constructor(){super({pluginId:`form-devtools`,reconnectEveryMs:1e3})}};function Au(e,t){return typeof e==`function`?e(t):e}function ju(e,t){return zu(t).reduce((e,t)=>{if(e===null)return null;if(e!==void 0)return e[t]},e)}function Mu(e,t,n){let r=zu(t);function i(e){if(!r.length)return Au(n,e);let t=r.shift();if(typeof t==`string`||typeof t==`number`&&!Array.isArray(e))return typeof e==`object`?(e===null&&(e={}),{...e,[t]:i(e[t])}):{[t]:i()};if(Array.isArray(e)&&typeof t==`number`){let n=e.slice(0,t);return[...n.length?n:Array(t),i(e[t]),...e.slice(t+1)]}return[...Array(t),i()]}return i(e)}function Nu(e,t){let n=zu(t);function r(e){if(!e)return;if(n.length===1){let t=n[0];if(Array.isArray(e)&&typeof t==`number`)return e.filter((e,n)=>n!==t);let{[t]:r,...i}=e;return i}let t=n.shift();if((typeof t==`string`||typeof t==`number`&&!Array.isArray(e))&&typeof e==`object`)return{...e,[t]:r(e[t])};if(typeof t==`number`&&Array.isArray(e)){if(t>=e.length)return e;let n=e.slice(0,t);return[...n.length?n:Array(t),r(e[t]),...e.slice(t+1)]}throw Error(`It seems we have created an infinite loop in deleteBy. `)}return r(e)}var Pu=46,Fu=91,Iu=93,Lu=48,Ru=57;function zu(e){if(Array.isArray(e))return[...e];if(typeof e!=`string`)throw Error(`Path must be a string.`);let t=e.length,n=[],r=+(t>0&&e.charCodeAt(0)===Fu),i=!0,a=-1;for(let o=r;o<=t;o++){let s=o<t?e.charCodeAt(o):-1;if(o===t||s===Pu||s===Fu||s===Iu){let t=o-r;if(t>0){let a=i&&(t===1||e.charCodeAt(r)!==Lu),s=e.slice(r,o);if(a){let e=parseInt(s,10);t<=15||String(e)===s?n.push(e):n.push(s)}else n.push(s)}else a!==Iu&&(a!==-1||s!==Iu)&&(a!==s||s!==Pu&&s!==Fu)&&n.push(``);r=o+1,i=!0}else(s<Lu||s>Ru)&&(i=!1);a=s}return n.length||n.push(``),n}function Bu(e){return!(Array.isArray(e)&&e.length===0)}function Vu(e,t){return t.validationLogic({form:t.form,group:t.group,validators:t.validators,event:{type:e,fieldName:t.fieldName,async:!1},runValidation:e=>e.validators.filter(Boolean).map(e=>({cause:e.cause,validate:e.fn}))})}function Hu(e,t){let{asyncDebounceMs:n}=t,{onBlurAsyncDebounceMs:r,onChangeAsyncDebounceMs:i,onDynamicAsyncDebounceMs:a}=t.validators||{},o=n??0;return t.validationLogic({form:t.form,group:t.group,validators:t.validators,event:{type:e,fieldName:t.fieldName,async:!0},runValidation:t=>t.validators.filter(Boolean).map(t=>{let n=t?.cause||e,s=o;switch(n){case`change`:s=i??o;break;case`blur`:s=r??o;break;case`dynamic`:s=a??o;break;case`submit`:s=0}return e===`submit`&&(s=0),{cause:n,validate:t.fn,debounceMs:s}})})}var Uu=e=>!!e&&typeof e==`object`&&`fields`in e;function Wu(e,t){if(Object.is(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(let[n,r]of e)if(!t.has(n)||!Object.is(r,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length||n.length===0&&!Array.isArray(e)&&!Array.isArray(t)&&(Object.getPrototypeOf(e)!==Object.prototype||Object.getPrototypeOf(t)!==Object.prototype))return!1;for(let i of n)if(!r.includes(i)||!Wu(e[i],t[i]))return!1;return!0}var Gu=({newFormValidatorError:e,isPreviousErrorFromFormValidator:t,previousErrorValue:n})=>e?{newErrorValue:e,newSource:`form`}:t?{newErrorValue:void 0,newSource:void 0}:n?{newErrorValue:n,newSource:`field`}:{newErrorValue:void 0,newSource:void 0},Ku=({formLevelError:e,fieldLevelError:t})=>t?{newErrorValue:t,newSource:`field`}:e?{newErrorValue:e,newSource:`form`}:{newErrorValue:void 0,newSource:void 0};function qu(e,t){return e==null?t:{...e,...t}}for(var Ju=256,Yu=[],Xu;Ju--;)Yu[Ju]=(Ju+256).toString(16).substring(1);function Zu(){let e=0,t,n=``;if(!Xu||Ju+16>256){for(Xu=Array(256),e=256;e--;)Xu[e]=256*Math.random()|0;e=0,Ju=0}for(;e<16;e++)t=Xu[Ju+e],n+=e===6?Yu[t&15|64]:e===8?Yu[t&63|128]:Yu[t],e&1&&e>1&&e<11&&(n+=`-`);return Ju++,n}var Qu=Du(e=>ku.emit(`form-state`,{id:e.formId,state:e.store.state}),{wait:300});function $u(e){if(typeof e!=`object`||!e)return e;if(e instanceof Date)return new Date(e.getTime());if(Array.isArray(e)){let t=[];for(let n=0;n<e.length;n++)t[n]=$u(e[n]);return t}if(e instanceof Map){let t=new Map;return e.forEach((e,n)=>{t.set(n,$u(e))}),t}if(e instanceof Set){let t=new Set;return e.forEach(e=>{t.add($u(e))}),t}let t={};for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=$u(e[n]));return t}function ed(e,t){return t===e||t.startsWith(`${e}.`)||t.startsWith(`${e}[`)}var td=e=>{if(!e.validators)return e.runValidation({validators:[],form:e.form});let t=e.event.async,n=t?void 0:{fn:e.validators.onMount,cause:`mount`},r={fn:t?e.validators.onChangeAsync:e.validators.onChange,cause:`change`},i={fn:t?e.validators.onBlurAsync:e.validators.onBlur,cause:`blur`},a={fn:t?e.validators.onSubmitAsync:e.validators.onSubmit,cause:`submit`},o=t?void 0:{fn:()=>void 0,cause:`server`};switch(e.event.type){case`mount`:return e.runValidation({validators:[n],form:e.form});case`submit`:return e.runValidation({validators:[r,i,a,o],form:e.form});case`server`:return e.runValidation({validators:[],form:e.form});case`blur`:return e.runValidation({validators:[i,o],form:e.form});case`change`:return e.runValidation({validators:[r,o],form:e.form});default:throw Error(`Unknown validation event type: ${e.event.type}`)}};function nd(e,t){let n=new Map;for(let r of e){let e=r.path??[],i=t,a=``;for(let t=0;t<e.length;t++){let n=e[t];if(n===void 0)continue;let r=typeof n==`object`?n.key:n,o=Number(r);a+=Array.isArray(i)&&!Number.isNaN(o)?`[${o}]`:(t>0?`.`:``)+String(r),i=typeof i==`object`&&i?i[r]:void 0}n.set(a,(n.get(a)??[]).concat(r))}return Object.fromEntries(n)}var rd=(e,t)=>{let n=nd(e,t);return{form:n,fields:n}},H={validate({value:e,validationSource:t},n){let r=n[`~standard`].validate(e);if(r instanceof Promise)throw Error(`async function passed to sync validator`);if(r.issues)return t===`field`?r.issues:rd(r.issues,e)},async validateAsync({value:e,validationSource:t},n){let r=await n[`~standard`].validate(e);if(r.issues)return t===`field`?r.issues:rd(r.issues,e)}},U=e=>!!e&&`~standard`in e,W={isValidating:!1,isTouched:!1,isBlurred:!1,isDirty:!1,isPristine:!0,isValid:!0,isDefaultValue:!0,errors:[],errorMap:{},errorSourceMap:{},_arrayVersion:0,_pendingValidationsCount:0};function G(e){function t(t){let n=e.getFieldMeta(t)??W;e.setFieldMeta(t,{...n,_arrayVersion:(n._arrayVersion||0)+1})}function n(n,r,i){t(n);let a=s(n,r,`move`,i),c=Math.min(r,i),u=Math.max(r,i);for(let e=c;e<=u;e++)a.push(o(n,e));let d=Object.keys(e.fieldInfo).reduce((t,i)=>(i.startsWith(o(n,r))&&t.set(i,e.getFieldMeta(i)),t),new Map);l(a,r<i?`up`:`down`),Object.keys(e.fieldInfo).filter(e=>e.startsWith(o(n,i))).forEach(t=>{let a=t.replace(o(n,i),o(n,r)),s=d.get(a);s&&e.setFieldMeta(t,s)})}function r(e,n){t(e),l(s(e,n,`remove`),`up`)}function i(n,r,i){t(n),s(n,r,`swap`,i).forEach(t=>{if(!t.toString().startsWith(o(n,r)))return;let a=t.toString().replace(o(n,r),o(n,i)),[s,c]=[e.getFieldMeta(t),e.getFieldMeta(a)];s&&e.setFieldMeta(a,s),c&&e.setFieldMeta(t,c)})}function a(n,r){t(n);let i=s(n,r,`insert`);l(i,`down`),i.forEach(t=>{t.toString().startsWith(o(n,r))&&e.setFieldMeta(t,u())})}function o(e,t){return`${e}[${t}]`}function s(t,n,r,i){let a=[o(t,n)];switch(r){case`swap`:a.push(o(t,i));break;case`move`:{let[e,r]=[Math.min(n,i),Math.max(n,i)];for(let n=e;n<=r;n++)a.push(o(t,n));break}default:{let r=e.getFieldValue(t),i=Array.isArray(r)?r.length:0;for(let e=n+1;e<i;e++)a.push(o(t,e));break}}return Object.keys(e.fieldInfo).filter(e=>a.some(t=>e.startsWith(t)))}function c(e,t){return e.replace(/\[(\d+)\]/,(e,n)=>{let r=parseInt(n,10);return`[${t===`up`?r+1:Math.max(0,r-1)}]`})}function l(t,n){(n===`up`?t:[...t].reverse()).forEach(t=>{let r=c(t.toString(),n),i=e.getFieldMeta(r);i?e.setFieldMeta(t,i):e.setFieldMeta(t,u())})}let u=()=>W;return{bumpArrayVersion:t,handleArrayMove:n,handleArrayRemove:r,handleArraySwap:i,handleArrayInsert:a}}function K(e){return{values:e.values??{},errorMap:e.errorMap??{},fieldMetaBase:e.fieldMetaBase??{},formGroupStateBase:e.formGroupStateBase??{},isSubmitted:e.isSubmitted??!1,isSubmitting:e.isSubmitting??!1,isValidating:e.isValidating??!1,submissionAttempts:e.submissionAttempts??0,isSubmitSuccessful:e.isSubmitSuccessful??!1,validationMetaMap:e.validationMetaMap??{onChange:void 0,onBlur:void 0,onSubmit:void 0,onMount:void 0,onServer:void 0,onDynamic:void 0}}}var id=class{constructor(e){this.options={},this.fieldInfo={},this.formGroupApis=new Set,this.mount=()=>{let e=this.store.subscribe(()=>{Qu(this)}),t=ku.on(`request-form-state`,e=>{e.payload.id===this._formId&&ku.emit(`form-api`,{id:this._formId,state:this.store.state,options:this.options})}),n=ku.on(`request-form-reset`,e=>{e.payload.id===this._formId&&this.reset()}),r=ku.on(`request-form-force-submit`,e=>{e.payload.id===this._formId&&(this._devtoolsSubmissionOverride=!0,this.handleSubmit(),this._devtoolsSubmissionOverride=!1)}),i=()=>{r(),n(),t(),e.unsubscribe(),ku.emit(`form-unmounted`,{id:this._formId})};this.options.listeners?.onMount?.({formApi:this});let{onMount:a}=this.options.validators||{};return ku.emit(`form-api`,{id:this._formId,state:this.store.state,options:this.options}),a&&this.validateSync(`mount`),i},this.update=e=>{if(!e)return;let t=this.options;this.options=e;let n=e.defaultValues&&!Wu(e.defaultValues,t.defaultValues)&&!this.state.isTouched,r=!Wu(e.defaultState,t.defaultState)&&!this.state.isTouched;if(n||r){if(Sr(()=>{this.baseStore.setState(()=>K(Object.assign({},this.state,r?e.defaultState:{},n?{values:e.defaultValues}:{})))}),n){let e=G(this);for(let t of Object.keys(this.fieldInfo))Array.isArray(this.getFieldValue(t))&&e.bumpArrayVersion(t)}ku.emit(`form-api`,{id:this._formId,state:this.store.state,options:this.options})}},this.reset=(e,t)=>{let{fieldMeta:n}=this.state,r=this.resetFieldMeta(n);e&&!t?.keepDefaultValues&&(this.options={...this.options,defaultValues:e}),this.baseStore.setState(()=>{let t=e??this.options.defaultValues??this.options.defaultState?.values;return e||Object.values(this.fieldInfo).forEach(e=>{e.instance&&e.instance.options.defaultValue!==void 0&&(t=Mu(t,e.instance.name,e.instance.options.defaultValue))}),K({...this.options.defaultState,values:t,fieldMetaBase:r})})},this.validateAllFields=async e=>{let t=[];return Sr(()=>{Object.values(this.fieldInfo).forEach(n=>{if(!n.instance)return;let r=n.instance;t.push(Promise.resolve().then(()=>r.validate(e,{skipFormValidation:!0,skipGroupValidation:!0}))),n.instance.store.state.meta.isTouched||n.instance.setMeta(e=>({...e,isTouched:!0}))})}),(await Promise.all(t)).flat()},this.validateArrayFieldsStartingFrom=async(e,t,n)=>{let r=this.getFieldValue(e),i=Array.isArray(r)?Math.max(r.length-1,0):null,a=[`${e}[${t}]`];for(let n=t+1;n<=(i??0);n++)a.push(`${e}[${n}]`);let o=Object.keys(this.fieldInfo).filter(e=>a.some(t=>e.startsWith(t))),s=[];return Sr(()=>{o.forEach(e=>{s.push(Promise.resolve().then(()=>this.validateField(e,n)))})}),(await Promise.all(s)).flat()},this.validateField=(e,t)=>{let n=this.fieldInfo[e]?.instance;if(!n){let{hasErrored:n}=this.validateSync(t);return n&&!this.options.asyncAlways?this.getFieldMeta(e)?.errors??[]:this.validateAsync(t).then(()=>this.getFieldMeta(e)?.errors??[])}return n.store.state.meta.isTouched||n.setMeta(e=>({...e,isTouched:!0})),n.validate(t)},this.validateSync=(e,t)=>{let n=Vu(e,{...this.options,form:this,group:t?.group,validationLogic:this.options.validationLogic||td}),r=!1,i={};return Sr(()=>{for(let e of n){if(!e.validate)continue;let{formError:n,fieldErrors:a}=ad(this.runValidator({validate:e.validate,value:{value:this.state.values,formApi:this,validationSource:`form`},type:`validate`})),o=od(e.cause),s=new Set([...Object.keys(this.state.fieldMeta),...Object.keys(a||{})]);t?.filterFieldNames&&(s=new Set([...s].filter(t.filterFieldNames)));for(let e of s){if(this.baseStore.state.fieldMetaBase[e]===void 0&&!a?.[e])continue;let{errorMap:t,errorSourceMap:n}=this.getFieldMeta(e)??W,r=a?.[e],{newErrorValue:s,newSource:c}=Gu({newFormValidatorError:r,isPreviousErrorFromFormValidator:n?.[o]===`form`,previousErrorValue:t?.[o]});c===`form`&&(i[e]={...i[e],[o]:r}),t?.[o]!==s&&this.setFieldMeta(e,(e=W)=>({...e,errorMap:{...e.errorMap,[o]:s},errorSourceMap:{...e.errorSourceMap,[o]:c}}))}t?.dontUpdateFormErrorMap||this.state.errorMap?.[o]!==n&&this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[o]:n}})),(n||a)&&(r=!0)}if(t?.dontUpdateFormErrorMap)return;let a=od(`submit`);this.state.errorMap?.[a]&&e!==`submit`&&!r&&this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[a]:void 0}}));let o=od(`server`);this.state.errorMap?.[o]&&e!==`server`&&!r&&this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[o]:void 0}}))}),{hasErrored:r,fieldsErrorMap:i}},this.validateAsync=async(e,t)=>{let n=Hu(e,{...this.options,form:this,group:t?.group,validationLogic:this.options.validationLogic||td});this.state.isFormValidating||this.baseStore.setState(e=>({...e,isFormValidating:!0}));let r=[],i;for(let e of n){if(!e.validate)continue;let n=od(e.cause);this.state.validationMetaMap[n]?.lastAbortController.abort();let a=new AbortController;this.state.validationMetaMap[n]={lastAbortController:a},r.push(new Promise(async n=>{let r;try{r=await new Promise((t,n)=>{setTimeout(async()=>{if(a.signal.aborted)return t(void 0);try{t(await this.runValidator({validate:e.validate,value:{value:this.state.values,formApi:this,validationSource:`form`,signal:a.signal},type:`validateAsync`}))}catch(e){n(e)}},e.debounceMs)})}catch(e){r=e}let{formError:o,fieldErrors:s}=ad(r);s&&(i=i?{...i,...s}:s);let c=od(e.cause),l=new Set([...Object.keys(this.state.fieldMeta),...Object.keys(i||{})]),u=Array.from(l);t?.filterFieldNames&&(u=u.filter(t.filterFieldNames));for(let e of u){if(this.baseStore.state.fieldMetaBase[e]===void 0&&!i?.[e])continue;let{errorMap:t,errorSourceMap:n}=this.getFieldMeta(e)??W,r=i?.[e],{newErrorValue:a,newSource:o}=Gu({newFormValidatorError:r,isPreviousErrorFromFormValidator:n?.[c]===`form`,previousErrorValue:t?.[c]});t?.[c]!==a&&this.setFieldMeta(e,(e=W)=>({...e,errorMap:{...e.errorMap,[c]:a},errorSourceMap:{...e.errorSourceMap,[c]:o}}))}t?.dontUpdateFormErrorMap||this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[c]:o}})),n(i?{fieldErrors:i,errorMapKey:c}:void 0)}))}let a=[],o={};if(r.length){a=await Promise.all(r);for(let e of a)if(e?.fieldErrors){let{errorMapKey:t}=e;for(let[n,r]of Object.entries(e.fieldErrors))o[n]={...o[n]||{},[t]:r}}}return this.baseStore.setState(e=>({...e,isFormValidating:!1})),o},this.validate=(e,t)=>{let{hasErrored:n,fieldsErrorMap:r}=this.validateSync(e,t);return n&&!this.options.asyncAlways?r:this.validateAsync(e,t)},this._handleSubmit=async e=>{this.baseStore.setState(e=>({...e,isSubmitted:!1,submissionAttempts:e.submissionAttempts+1,isSubmitSuccessful:!1})),Sr(()=>{Object.values(this.fieldInfo).forEach(e=>{e.instance&&(e.instance.store.state.meta.isTouched||e.instance.setMeta(e=>({...e,isTouched:!0})))})});let t=e??this.options.onSubmitMeta;if(!this.state.canSubmit&&!this._devtoolsSubmissionOverride&&this.baseStore.state.submissionAttempts<=1){this.options.onSubmitInvalid?.({value:this.state.values,formApi:this,meta:t});return}this.baseStore.setState(e=>({...e,isSubmitting:!0}));let n=()=>{this.baseStore.setState(e=>({...e,isSubmitting:!1}))};if(await this.validateAllFields(`submit`),!this.state.isFieldsValid)n(),this.options.onSubmitInvalid?.({value:this.state.values,formApi:this,meta:t}),ku.emit(`form-submission`,{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:`validateAllFields`,errors:Object.values(this.state.fieldMeta).map(e=>e.errors).flat()});else if(await this.validate(`submit`),!this.state.isValid)n(),this.options.onSubmitInvalid?.({value:this.state.values,formApi:this,meta:t}),ku.emit(`form-submission`,{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:`validate`,errors:this.state.errors});else{Sr(()=>{Object.values(this.fieldInfo).forEach(e=>{e.instance?.triggerOnSubmitListener()})}),this.options.listeners?.onSubmit?.({formApi:this,meta:t});try{await this.options.onSubmit?.({value:this.state.values,formApi:this,meta:t}),Sr(()=>{this.baseStore.setState(e=>({...e,isSubmitted:!0,isSubmitSuccessful:!0})),ku.emit(`form-submission`,{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!0}),n()})}catch(e){throw this.baseStore.setState(e=>({...e,isSubmitSuccessful:!1})),ku.emit(`form-submission`,{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:`inflight`,onError:e}),n(),e}}},this.getFieldValue=e=>ju(this.state.values,e),this.getFieldMeta=e=>this.state.fieldMeta[e],this.getFormGroupMeta=e=>this.formGroupMetaDerived.state[e],this.getFieldInfo=e=>this.fieldInfo[e]||={instance:null,validationMetaMap:{onChange:void 0,onBlur:void 0,onSubmit:void 0,onMount:void 0,onServer:void 0,onDynamic:void 0}},this.setFieldMeta=(e,t)=>{this.baseStore.setState(n=>({...n,fieldMetaBase:{...n.fieldMetaBase,[e]:Au(t,n.fieldMetaBase[e])}}))},this.resetFieldMeta=e=>Object.keys(e).reduce((e,t)=>{let n=t;return e[n]=W,e},{}),this.setFieldValue=(e,t,n)=>{let r=n?.dontUpdateMeta??!1,i=n?.dontRunListeners??!1,a=n?.dontValidate??!1;Sr(()=>{r||this.setFieldMeta(e,e=>({...e,isTouched:!0,isDirty:!0,errorMap:{...e?.errorMap,onMount:void 0}})),this.baseStore.setState(n=>({...n,values:Mu(n.values,e,t)}))}),i||this.getFieldInfo(e).instance?.triggerOnChangeListener(),a||this.validateField(e,`change`)},this.deleteField=e=>{let t=[...Object.keys(this.fieldInfo).filter(t=>{let n=e.toString();return t.startsWith(`${n}.`)||t.startsWith(`${n}[`)}),e];this.baseStore.setState(e=>{let n={...e};return t.forEach(e=>{n.values=Nu(n.values,e),delete this.fieldInfo[e],delete n.fieldMetaBase[e]}),n})},this.pushFieldValue=(e,t,n)=>{this.setFieldValue(e,e=>[...Array.isArray(e)?e:[],t],n),G(this).bumpArrayVersion(e)},this.insertFieldValue=async(e,t,n,r)=>{this.setFieldValue(e,e=>[...e.slice(0,t),n,...e.slice(t)],qu(r,{dontValidate:!0}));let i=r?.dontValidate??!1;i||await this.validateField(e,`change`),G(this).handleArrayInsert(e,t),i||await this.validateArrayFieldsStartingFrom(e,t,`change`)},this.replaceFieldValue=async(e,t,n,r)=>{this.setFieldValue(e,e=>e.map((e,r)=>r===t?n:e),qu(r,{dontValidate:!0})),G(this).bumpArrayVersion(e),(r?.dontValidate??!1)||(await this.validateField(e,`change`),await this.validateArrayFieldsStartingFrom(e,t,`change`))},this.removeFieldValue=async(e,t,n)=>{let r=this.getFieldValue(e),i=Array.isArray(r)?Math.max(r.length-1,0):null;if(this.setFieldValue(e,e=>e.filter((e,n)=>n!==t),qu(n,{dontValidate:!0})),G(this).handleArrayRemove(e,t),i!==null){let t=`${e}[${i}]`;this.deleteField(t)}(n?.dontValidate??!1)||(await this.validateField(e,`change`),await this.validateArrayFieldsStartingFrom(e,t,`change`))},this.swapFieldValues=(e,t,n,r)=>{this.setFieldValue(e,e=>{let r=e[t],i=e[n];return Mu(Mu(e,`${t}`,i),`${n}`,r)},qu(r,{dontValidate:!0})),G(this).handleArraySwap(e,t,n),(r?.dontValidate??!1)||(this.validateField(e,`change`),this.validateField(`${e}[${t}]`,`change`),this.validateField(`${e}[${n}]`,`change`))},this.moveFieldValues=(e,t,n,r)=>{this.setFieldValue(e,e=>{let r=[...e];return r.splice(n,0,r.splice(t,1)[0]),r},qu(r,{dontValidate:!0})),G(this).handleArrayMove(e,t,n),(r?.dontValidate??!1)||(this.validateField(e,`change`),this.validateField(`${e}[${t}]`,`change`),this.validateField(`${e}[${n}]`,`change`))},this.clearFieldValues=(e,t)=>{let n=this.getFieldValue(e),r=Array.isArray(n)?Math.max(n.length-1,0):null;if(this.setFieldValue(e,[],qu(t,{dontValidate:!0})),G(this).bumpArrayVersion(e),r!==null)for(let t=0;t<=r;t++){let n=`${e}[${t}]`;this.deleteField(n)}(t?.dontValidate??!1)||this.validateField(e,`change`)},this.resetField=e=>{this.baseStore.setState(t=>{let n=this.getFieldInfo(e).instance?.options.defaultValue,r=ju(this.options.defaultValues,e),i=n??r;return{...t,fieldMetaBase:{...t.fieldMetaBase,[e]:W},values:i===void 0?t.values:Mu(t.values,e,i)}})},this.setErrorMap=e=>{Sr(()=>{Object.entries(e).forEach(([e,t])=>{let n=e;if(Uu(t)){let{formError:e,fieldErrors:r}=ad(t);for(let e of Object.keys(this.fieldInfo))this.getFieldMeta(e)&&this.setFieldMeta(e,t=>({...t,errorMap:{...t.errorMap,[n]:r?.[e]},errorSourceMap:{...t.errorSourceMap,[n]:`form`}}));this.baseStore.setState(t=>({...t,errorMap:{...t.errorMap,[n]:e}}))}else this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[n]:t}}))})})},this.getAllErrors=()=>({form:{errors:this.state.errors,errorMap:this.state.errorMap},fields:Object.entries(this.state.fieldMeta).reduce((e,[t,n])=>(Object.keys(n).length&&n.errors.length&&(e[t]={errors:n.errors,errorMap:n.errorMap}),e),{})}),this.parseValuesWithSchema=e=>H.validate({value:this.state.values,validationSource:`form`},e),this.parseValuesWithSchemaAsync=e=>H.validateAsync({value:this.state.values,validationSource:`form`},e),this.timeoutIds={validations:{},listeners:{},formListeners:{}},this._formId=e?.formId??Zu(),this._devtoolsSubmissionOverride=!1;let t=K({...e?.defaultState,values:e?.defaultValues??e?.defaultState?.values});if(e?.transform){t=e.transform({state:t}).state;for(let e of Object.keys(t.errorMap)){let n=t.errorMap[e];if(n!==void 0&&Uu(n))for(let r of Object.keys(n.fields)){let i=n.fields[r];if(i===void 0)continue;let a=t.fieldMetaBase[r];t.fieldMetaBase[r]={isTouched:!1,isValidating:!1,isBlurred:!1,isDirty:!1,_arrayVersion:0,_pendingValidationsCount:0,...a??{},errorSourceMap:{...a?.errorSourceMap??{},onChange:`form`},errorMap:{...a?.errorMap??{},[e]:i}}}}}this.baseStore=kr(t);let n;this.fieldMetaDerived=kr(e=>{let t=this.baseStore.get(),r=0,i={};for(let a of Object.keys(t.fieldMetaBase)){let o=t.fieldMetaBase[a],s=n?.fieldMetaBase[a],c=e?.[a],l=ju(t.values,a),u=c?.errors;if(!s||o.errorMap!==s.errorMap){u=Object.values(o.errorMap??{}).filter(e=>e!==void 0);let e=this.getFieldInfo(a)?.instance;e&&e.options.disableErrorFlat||(u=u.flat(1))}let d=!Bu(u),f=!o.isDirty,p=Wu(l,this.getFieldInfo(a)?.instance?.options.defaultValue??ju(this.options.defaultValues,a));c&&c.isPristine===f&&c.isValid===d&&c.isDefaultValue===p&&c.errors===u&&o===s?(i[a]=c,r++):i[a]={...o,errors:u??[],isPristine:f,isValid:d,isDefaultValue:p}}return Object.keys(t.fieldMetaBase).length?e&&r===Object.keys(t.fieldMetaBase).length?e:(n=this.baseStore.get(),i):i}),this.formGroupMetaDerived=kr(e=>{let t=this.baseStore.get(),n=this.fieldMetaDerived.get(),r={};for(let i of this.formGroupApis){let a=i.name,o=t.formGroupStateBase[a]??{isSubmitted:!1,isSubmitting:!1,isValidating:!1,submissionAttempts:0,isSubmitSuccessful:!1},s=n[a],c=!1,l=!0,u=!1,d=!1,f=!0,p=!1;for(let e in n){if(e===a||!ed(a,e))continue;let t=n[e];t&&(t.isValidating&&(c=!0),t.isValid||(l=!1),t.isTouched&&(u=!0),t.isBlurred&&(d=!0),t.isDefaultValue||(f=!1),t.isDirty&&(p=!0))}let m=!p,h=!!c||o.isValidating,g=s?.errorMap??{},_=s?.errorSourceMap??{},v=!!(g.onMount||Object.entries(n).some(([e,t])=>t&&e!==a&&ed(a,e)&&t.errorMap.onMount)),y=e?.[a],b=y?.errors??[];y&&y.__srcErrorMap===g||(b=Object.values(g).reduce((e,t)=>{if(t===void 0)return e;if(t&&typeof t==`object`&&`fields`in t){let n=t.group;return n!==void 0&&e.push(n),e}return e.push(t),e},[]));let x=b.length===0,S=l&&x,C=i.options.canSubmitWhenInvalid??!1,w=o.submissionAttempts===0&&!u&&!v||!h&&!o.isSubmitting&&S||C;if(y&&y.errorMap===g&&y.errorSourceMap===_&&y.errors===b&&y.isFieldsValidating===c&&y.isFieldsValid===l&&y.isGroupValid===x&&y.isValid===S&&y.canSubmit===w&&y.isTouched===u&&y.isBlurred===d&&y.isPristine===m&&y.isDefaultValue===f&&y.isDirty===p&&y.isValidating===h&&y.isSubmitting===o.isSubmitting&&y.isSubmitted===o.isSubmitted&&y.submissionAttempts===o.submissionAttempts&&y.isSubmitSuccessful===o.isSubmitSuccessful){r[a]=y;continue}let ee={...o,errorMap:g,errorSourceMap:_,_arrayVersion:s?._arrayVersion??0,isTouched:u,isBlurred:d,isDirty:p,isPristine:m,isDefaultValue:f,isValid:S,errors:b,isValidating:h,isFieldsValidating:c,isFieldsValid:l,isGroupValid:x,canSubmit:w};Object.defineProperty(ee,"__srcErrorMap",{value:g,enumerable:!1,configurable:!0}),r[a]=ee}return r});let r;this.store=kr(e=>{let t=this.baseStore.get(),n=this.fieldMetaDerived.get(),i=Object.values(n).filter(Boolean),a=i.some(e=>e.isValidating),o=i.every(e=>e.isValid),s=i.some(e=>e.isTouched),c=i.some(e=>e.isBlurred),l=i.every(e=>e.isDefaultValue),u=s&&t.errorMap?.onMount,d=i.some(e=>e.isDirty),f=!d,p=!!(t.errorMap?.onMount||i.some(e=>e?.errorMap?.onMount)),m=!!a,h=e?.errors??[];r&&t.errorMap===r.errorMap||(h=Object.values(t.errorMap).reduce((e,t)=>t===void 0?e:t&&Uu(t)?(e.push(t.form),e):(e.push(t),e),[]));let g=h.length===0,_=o&&g,v=this.options.canSubmitWhenInvalid??!1,y=t.submissionAttempts===0&&!s&&!p||!m&&!t.isSubmitting&&_||v,b=t.errorMap;if(u&&(h=h.filter(e=>e!==t.errorMap.onMount),b=Object.assign(b,{onMount:void 0})),e&&r&&e.errorMap===b&&e.fieldMeta===this.fieldMetaDerived.state&&e.errors===h&&e.isFieldsValidating===a&&e.isFieldsValid===o&&e.isFormValid===g&&e.isValid===_&&e.canSubmit===y&&e.isTouched===s&&e.isBlurred===c&&e.isPristine===f&&e.isDefaultValue===l&&e.isDirty===d&&Wu(r,t))return e;let x={...t,errorMap:b,fieldMeta:this.fieldMetaDerived.state,errors:h,isFieldsValidating:a,isFieldsValid:o,isFormValid:g,isValid:_,canSubmit:y,isTouched:s,isBlurred:c,isPristine:f,isDefaultValue:l,isDirty:d};return r=this.baseStore.get(),x}),this.handleSubmit=this.handleSubmit.bind(this),this.update(e||{})}get state(){return this.store.state}get formId(){return this._formId}runValidator(e){return U(e.validate)?H[e.type](e.value,e.validate):e.validate(e.value)}handleSubmit(e){return this._handleSubmit(e)}};function ad(e){return e?Uu(e)?{formError:ad(e.form).formError,fieldErrors:e.fields}:{formError:e}:{formError:void 0}}function od(e){switch(e){case`submit`:return`onSubmit`;case`blur`:return`onBlur`;case`mount`:return`onMount`;case`server`:return`onServer`;case`dynamic`:return`onDynamic`;default:return`onChange`}}var sd=class e{constructor(t){this.options={},this.mount=()=>{this.options.defaultValue!==void 0&&!this.getMeta().isTouched&&this.form.setFieldValue(this.name,this.options.defaultValue,{dontUpdateMeta:!0});let e=this.getInfo();e.instance=this,this.update(this.options);let{onMount:t}=this.options.validators||{};if(t){let e=this.runValidator({validate:t,value:{value:this.state.value,fieldApi:this,validationSource:`field`},type:`validate`});e&&this.setMeta(t=>({...t,errorMap:{...t?.errorMap,onMount:e},errorSourceMap:{...t?.errorSourceMap,onMount:`field`}}))}return this.options.listeners?.onMount?.({value:this.state.value,fieldApi:this}),()=>{for(let[e,t]of Object.entries(this.timeoutIds.validations))t&&(clearTimeout(t),this.timeoutIds.validations[e]=null);for(let[e,t]of Object.entries(this.timeoutIds.listeners))t&&(clearTimeout(t),this.timeoutIds.listeners[e]=null);for(let[e,t]of Object.entries(this.timeoutIds.formListeners))t&&(clearTimeout(t),this.timeoutIds.formListeners[e]=null);let e=this.form.fieldInfo[this.name];if(e&&e.instance===this){for(let[t,n]of Object.entries(e.validationMetaMap))n?.lastAbortController.abort(),e.validationMetaMap[t]=void 0;this.form.baseStore.setState(e=>({...e,fieldMetaBase:{...e.fieldMetaBase,[this.name]:{...W,isTouched:e.fieldMetaBase[this.name]?.isTouched??W.isTouched,isBlurred:e.fieldMetaBase[this.name]?.isBlurred??W.isBlurred,isDirty:e.fieldMetaBase[this.name]?.isDirty??W.isDirty}}})),e.instance=null,this.options.listeners?.onUnmount?.({value:this.state.value,fieldApi:this}),this.form.options.listeners?.onFieldUnmount?.({formApi:this.form,fieldApi:this})}}},this.update=e=>{this.options=e,this.name=e.name,this.state.meta.isTouched||this.options.defaultValue===void 0||Wu(this.form.getFieldValue(this.name),e.defaultValue)||this.form.setFieldValue(this.name,e.defaultValue,{dontUpdateMeta:!0,dontValidate:!0,dontRunListeners:!0}),this.form.getFieldMeta(this.name)||this.form.setFieldMeta(this.name,this.state.meta)},this.getValue=()=>this.form.getFieldValue(this.name),this.setValue=(e,t)=>{this.form.setFieldValue(this.name,e,qu(t,{dontRunListeners:!0,dontValidate:!0})),t?.dontRunListeners||this.triggerOnChangeListener(),t?.dontValidate||this.validate(`change`)},this.getMeta=()=>this.store.state.meta,this.setMeta=e=>this.form.setFieldMeta(this.name,e),this.getInfo=()=>this.form.getFieldInfo(this.name),this.pushValue=(e,t)=>{this.form.pushFieldValue(this.name,e,qu(t,{dontRunListeners:!0})),t?.dontRunListeners||this.triggerOnChangeListener()},this.insertValue=(e,t,n)=>{this.form.insertFieldValue(this.name,e,t,qu(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.replaceValue=(e,t,n)=>{this.form.replaceFieldValue(this.name,e,t,qu(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.removeValue=(e,t)=>{this.form.removeFieldValue(this.name,e,qu(t,{dontRunListeners:!0})),t?.dontRunListeners||this.triggerOnChangeListener()},this.swapValues=(e,t,n)=>{this.form.swapFieldValues(this.name,e,t,qu(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.moveValue=(e,t,n)=>{this.form.moveFieldValues(this.name,e,t,qu(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.clearValues=e=>{this.form.clearFieldValues(this.name,qu(e,{dontRunListeners:!0})),e?.dontRunListeners||this.triggerOnChangeListener()},this.getLinkedFields=t=>{let n=Object.values(this.form.fieldInfo),r=[];for(let i of n){if(!i.instance||!(i.instance instanceof e))continue;let{onChangeListenTo:n,onBlurListenTo:a}=i.instance.options.validators||{};t===`change`&&n?.includes(this.name)&&r.push(i.instance),t===`blur`&&a?.includes(this.name)&&r.push(i.instance)}return r},this.validateSync=(e,t)=>{let n=Vu(e,{...this.options,form:this.form,fieldName:this.name,validationLogic:this.form.options.validationLogic||td}),r=this.getLinkedFields(e).reduce((t,n)=>{let r=Vu(e,{...n.options,form:n.form,fieldName:n.name,validationLogic:n.form.options.validationLogic||td});return r.forEach(e=>{e.field=n}),t.concat(r)},[]),i=!1;Sr(()=>{let e=(e,n)=>{let r=q(n.cause),a=n.validate?cd(e.runValidator({validate:n.validate,value:{value:e.store.state.value,validationSource:`field`,fieldApi:e},type:`validate`})):void 0,o=t[r],{newErrorValue:s,newSource:c}=Ku({formLevelError:o,fieldLevelError:a});e.state.meta.errorMap?.[r]!==s&&e.setMeta(e=>({...e,errorMap:{...e.errorMap,[r]:s},errorSourceMap:{...e.errorSourceMap,[r]:c}})),s&&(i=!0)};for(let t of n)e(this,t);for(let t of r)t.validate&&e(t.field,t)});let a=q(`submit`);return this.state.meta.errorMap?.[a]&&e!==`submit`&&!i&&this.setMeta(e=>({...e,errorMap:{...e.errorMap,[a]:void 0},errorSourceMap:{...e.errorSourceMap,[a]:void 0}})),{hasErrored:i}},this.validateAsync=async(e,t)=>{let n=Hu(e,{...this.options,form:this.form,fieldName:this.name,validationLogic:this.form.options.validationLogic||td}),r=await t,i=this.getLinkedFields(e).reduce((t,n)=>{let r=Hu(e,{...n.options,form:n.form,fieldName:n.name,validationLogic:n.form.options.validationLogic||td});return r.forEach(e=>{e.field=n}),t.concat(r)},[]),a=[],o=[],s=n.some(e=>e.validate),c=Array.from(new Set(i.filter(e=>e.validate).map(e=>e.field)));Sr(()=>{s&&this.startValidation();for(let e of c)e.startValidation()});let l=(e,t,n)=>{let i=q(t.cause),a=e.getInfo();a.validationMetaMap[i]?.lastAbortController.abort();let o=new AbortController;a.validationMetaMap[i]={lastAbortController:o},n.push(new Promise(async n=>{let a;try{a=await new Promise((n,r)=>{e.timeoutIds.validations[t.cause]&&(clearTimeout(e.timeoutIds.validations[t.cause]),e.endValidation()),e.timeoutIds.validations[t.cause]=setTimeout(async()=>{if(o.signal.aborted)return n(void 0);try{n(await this.runValidator({validate:t.validate,value:{value:e.store.state.value,fieldApi:e,signal:o.signal,validationSource:`field`},type:`validateAsync`}))}catch(e){r(e)}},t.debounceMs)})}catch(e){a=e}if(o.signal.aborted)return n(void 0);let s=cd(a),c=r[e.name]?.[i],{newErrorValue:l,newSource:u}=Ku({formLevelError:c,fieldLevelError:s});if(e.getInfo().instance!==e)return n(void 0);e.setMeta(e=>({...e,errorMap:{...e?.errorMap,[i]:l},errorSourceMap:{...e.errorSourceMap,[i]:u}})),n(l)}))};for(let e of n)e.validate&&l(this,e,a);for(let e of i)e.validate&&l(e.field,e,o);let u=[];return(a.length||o.length)&&(u=await Promise.all(a),await Promise.all(o)),Sr(()=>{s&&this.endValidation();for(let e of c)e.endValidation()}),u.filter(Boolean)},this.validate=(e,t)=>{if(!this.state.meta.isTouched)return[];let n=t?.skipGroupValidation?[]:Array.from(this.form.formGroupApis).filter(e=>this.name.startsWith(e.name)),r=(t?.skipFormValidation?{fieldsErrorMap:{}}:this.form.validateSync(e)).fieldsErrorMap[this.name]??{};if(!t?.skipFormValidation)for(let t of n){if(t.state.meta.submissionAttempts===0)continue;let{fieldsErrorMap:n}=this.form.validateSync(e,{group:t,dontUpdateFormErrorMap:!0,filterFieldNames:e=>ed(t.name,e)});r={...r,...n[this.name]??{}}}let{hasErrored:i}=this.validateSync(e,r),a=new WeakMap;for(let t of n){let{hasErrored:n}=t.validateSync(e,{},{skipRelatedFieldValidation:!0});a.set(t,n)}if(i&&!this.options.asyncAlways){this.getInfo().validationMetaMap[q(e)]?.lastAbortController.abort();let t=[];for(let r of n)r.getInfo().validationMetaMap[q(e)]?.lastAbortController.abort(),t.push(r.state.meta.errors);return[...this.state.meta.errors,...t.flat()]}let o=t?.skipFormValidation?Promise.resolve({}):this.form.validateAsync(e),s=this.validateAsync(e,o),c=[];for(let t of n)(!a.get(t)||t.options.asyncAlways)&&c.push(t.validateAsync(e,o,{skipRelatedFieldValidation:!0}));return c.length===0?s:Promise.all([s,...c]).then(e=>e.flat())},this.handleChange=e=>{this.setValue(e)},this.handleBlur=()=>{this.state.meta.isTouched||this.setMeta(e=>({...e,isTouched:!0})),this.state.meta.isBlurred||this.setMeta(e=>({...e,isBlurred:!0})),this.validate(`blur`),this.triggerOnBlurListener()},this.setErrorMap=e=>{this.setMeta(t=>({...t,errorMap:{...t.errorMap,...e}}))},this.parseValueWithSchema=e=>H.validate({value:this.state.value,validationSource:`field`},e),this.parseValueWithSchemaAsync=e=>H.validateAsync({value:this.state.value,validationSource:`field`},e),this.triggerOnBlurListener=()=>{let e=this.form.options.listeners?.onBlurDebounceMs;e&&e>0?(this.timeoutIds.formListeners.blur&&clearTimeout(this.timeoutIds.formListeners.blur),this.timeoutIds.formListeners.blur=setTimeout(()=>{this.form.options.listeners?.onBlur?.({formApi:this.form,fieldApi:this})},e)):this.form.options.listeners?.onBlur?.({formApi:this.form,fieldApi:this});let t=this.options.listeners?.onBlurDebounceMs;t&&t>0?(this.timeoutIds.listeners.blur&&clearTimeout(this.timeoutIds.listeners.blur),this.timeoutIds.listeners.blur=setTimeout(()=>{this.options.listeners?.onBlur?.({value:this.state.value,fieldApi:this})},t)):this.options.listeners?.onBlur?.({value:this.state.value,fieldApi:this})},this.triggerOnChangeListener=()=>{let e=this.form.options.listeners?.onChangeDebounceMs;e&&e>0?(this.timeoutIds.formListeners.change&&clearTimeout(this.timeoutIds.formListeners.change),this.timeoutIds.formListeners.change=setTimeout(()=>{this.form.options.listeners?.onChange?.({formApi:this.form,fieldApi:this})},e)):this.form.options.listeners?.onChange?.({formApi:this.form,fieldApi:this});let t=this.options.listeners?.onChangeDebounceMs;t&&t>0?(this.timeoutIds.listeners.change&&clearTimeout(this.timeoutIds.listeners.change),this.timeoutIds.listeners.change=setTimeout(()=>{this.options.listeners?.onChange?.({value:this.state.value,fieldApi:this})},t)):this.options.listeners?.onChange?.({value:this.state.value,fieldApi:this});for(let e of this.form.formGroupApis)ed(e.name,this.name)&&e.triggerOnChangeListener()},this.triggerOnSubmitListener=()=>{this.options.listeners?.onSubmit?.({value:this.state.value,fieldApi:this})},this.form=t.form,this.name=t.name,this.options=t,this.timeoutIds={validations:{},listeners:{},formListeners:{}},this.store=kr(e=>{this.form.store.get();let n=this.form.getFieldMeta(this.name)??{...W,...t.defaultMeta},r=this.form.getFieldValue(this.name);return!n.isTouched&&r===void 0&&this.options.defaultValue!==void 0&&!Wu(r,this.options.defaultValue)&&(r=this.options.defaultValue),e&&e.value===r&&e.meta===n?e:{value:r,meta:n}})}get state(){return this.store.state}runValidator(e){return U(e.validate)?H[e.type](e.value,e.validate):e.validate(e.value)}startValidation(){this.setMeta(e=>{let t=e._pendingValidationsCount+1;return{...e,_pendingValidationsCount:t,isValidating:t>0&&!e.isValidating||e.isValidating}})}endValidation(){this.setMeta(e=>{let t=Math.max(0,e._pendingValidationsCount-1);return{...e,_pendingValidationsCount:t,isValidating:t===0&&e.isValidating?!1:e.isValidating}})}};function cd(e){if(e)return e}function q(e){switch(e){case`submit`:return`onSubmit`;case`blur`:return`onBlur`;case`mount`:return`onMount`;case`server`:return`onServer`;case`dynamic`:return`onDynamic`;default:return`onChange`}}function ld(e){return{isSubmitted:e.isSubmitted??!1,isSubmitting:e.isSubmitting??!1,isValidating:e.isValidating??!1,submissionAttempts:e.submissionAttempts??0,isSubmitSuccessful:e.isSubmitSuccessful??!1}}function ud(e){return{...W,...e,errors:[],isPristine:!0,isValid:!0,isDefaultValue:!0,isFieldsValidating:!1,isFieldsValid:!0,isGroupValid:!0,canSubmit:!0,isSubmitting:!1,isSubmitted:!1,isValidating:!1,submissionAttempts:0,isSubmitSuccessful:!1}}var dd=class e{constructor(t){this.options={},this.setFormGroupState=e=>{this.form.baseStore.setState(t=>{let n=t.formGroupStateBase[this.name]??ld({});return{...t,formGroupStateBase:{...t.formGroupStateBase,[this.name]:e(n)}}})},this._lastDistributedFieldNames={},this.update=e=>{this.options=e,this.name=e.name,this.state.meta.isTouched||this.options.defaultValue===void 0||Wu(this.form.getFieldValue(this.name),e.defaultValue)||this.form.setFieldValue(this.name,e.defaultValue,{dontUpdateMeta:!0,dontValidate:!0,dontRunListeners:!0}),this.form.getFieldMeta(this.name)||this.form.setFieldMeta(this.name,{...W,...this.options.defaultMeta})},this.mount=()=>{this.update(this.options),this.form.formGroupApis.add(this),this.fieldInfo.instance=this,this.form.baseStore.setState(e=>({...e,formGroupStateBase:{...e.formGroupStateBase,[this.name]:e.formGroupStateBase[this.name]??ld({...this.options.defaultState})}}));let{onMount:e}=this.options.validators||{};if(e){let t=this.runValidator({validate:e,value:{value:this.state.value,groupApi:this,validationSource:`form`},type:`validate`}),n=t,r;pd(t)&&(n=t.group,r=t.fields);let i=fd(n);i&&this.setMeta(e=>({...e,errorMap:{...e.errorMap,onMount:i},errorSourceMap:{...e.errorSourceMap,onMount:`field`}})),this.distributeFieldErrors(`onMount`,r)}return this.options.listeners?.onMount?.({value:this.state.value,groupApi:this}),()=>{for(let[e,t]of Object.entries(this.timeoutIds.validations))t&&(clearTimeout(t),this.timeoutIds.validations[e]=null);for(let[e,t]of Object.entries(this.timeoutIds.listeners))t&&(clearTimeout(t),this.timeoutIds.listeners[e]=null);for(let[e,t]of Object.entries(this.timeoutIds.formListeners))t&&(clearTimeout(t),this.timeoutIds.formListeners[e]=null);if(this.fieldInfo.instance===this){for(let[e,t]of Object.entries(this.fieldInfo.validationMetaMap))t?.lastAbortController.abort(),this.fieldInfo.validationMetaMap[e]=void 0;this.form.formGroupApis.delete(this),this.form.baseStore.setState(e=>({...e,formGroupStateBase:{...e.formGroupStateBase,[this.name]:ld({})}})),this.fieldInfo.instance=null,this.options.listeners?.onUnmount?.({value:this.state.value,groupApi:this})}}},this.setValue=(e,t)=>{this.form.setFieldValue(this.name,e,qu(t,{dontRunListeners:!0,dontValidate:!0})),t?.dontRunListeners||this.triggerOnChangeListener(),t?.dontValidate||this.validate(`change`)},this.getMeta=()=>this.store.state.meta,this.setMeta=e=>this.form.setFieldMeta(this.name,e),this.getInfo=()=>this.fieldInfo,this.getRelatedFields=()=>{let e=Object.values(this.form.fieldInfo),t=[];for(let n of e)n.instance&&n.instance instanceof sd&&n.instance.name.startsWith(this.name)&&t.push(n.instance);return t},this.getRelatedFieldMetasDerived=()=>{let e=Object.entries(this.form.fieldMetaDerived.state),t=[];for(let[n,r]of e)n!==this.name&&ed(this.name,n)&&t.push({...r,name:n});return t},this.buildChildFieldName=e=>e===``?this.name:e.startsWith(`[`)?`${this.name}${e}`:`${this.name}.${e}`,this.distributeFieldErrors=(e,t)=>{let n=this._lastDistributedFieldNames[e]??new Set,r=new Set;if(t)for(let[e,n]of Object.entries(t))n!=null&&n!==!1&&r.add(this.buildChildFieldName(e));let i=new Set([...n,...r]),a=!1;for(let n of i){let r=n.startsWith(this.name+`[`)?n.slice(this.name.length):n.slice(this.name.length+1),i=t?.[r],o=this.form.getFieldMeta(n);if(!o&&!i)continue;let s=o?.errorMap[e],{newErrorValue:c,newSource:l}=Gu({newFormValidatorError:i,isPreviousErrorFromFormValidator:o?.errorSourceMap[e]===`form`,previousErrorValue:s});c&&(a=!0),(s!==c||o?.errorSourceMap[e]!==l)&&this.form.setFieldMeta(n,(t=W)=>({...t,errorMap:{...t.errorMap,[e]:c},errorSourceMap:{...t.errorSourceMap,[e]:l}}))}return this._lastDistributedFieldNames[e]=r,a},this.validateSync=(t,n,r={})=>{let i=Vu(t,{...this.options,form:this.form,group:this,validationLogic:this.options.validationLogic||this.form.options.validationLogic||td}),a=(r.skipRelatedFieldValidation?[]:this.getRelatedFields()).reduce((e,n)=>{let r=Vu(t,{...n.options,form:n.form,validationLogic:n.form.options.validationLogic||td});return r.forEach(e=>{e.field=n}),e.concat(r)},[]),o=!1;Sr(()=>{let t=(t,r)=>{let i=hd(r.cause),a=t===this,s;r.validate&&(s=t.runValidator({validate:r.validate,value:{value:t.store.state.value,validationSource:a?`form`:`field`,...t instanceof e?{groupApi:t}:{fieldApi:t}},type:`validate`}));let c=s,l;a&&pd(s)&&(c=s.group,l=s.fields);let u=fd(c),d=n[i],{newErrorValue:f,newSource:p}=Ku({formLevelError:d,fieldLevelError:u});t.state.meta.errorMap?.[i]!==f&&t.setMeta(e=>({...e,errorMap:{...e.errorMap,[i]:f},errorSourceMap:{...e.errorSourceMap,[i]:p}})),f&&(o=!0),a&&this.distributeFieldErrors(i,l)&&(o=!0)};for(let e of i)t(this,e);for(let e of a)e.validate&&t(e.field,e)});let s=hd(`submit`);return this.state.meta.errorMap?.[s]&&t!==`submit`&&!o&&this.setMeta(e=>({...e,errorMap:{...e.errorMap,[s]:void 0},errorSourceMap:{...e.errorSourceMap,[s]:void 0}})),{hasErrored:o}},this.validateAsync=async(t,n,r={})=>{let i=Hu(t,{...this.options,form:this.form,group:this,validationLogic:this.options.validationLogic||this.form.options.validationLogic||td}),a=await n,o=r.skipRelatedFieldValidation?[]:this.getRelatedFields(),s=o.reduce((e,n)=>{let r=Hu(t,{...n.options,form:n.form,validationLogic:n.form.options.validationLogic||td});return r.forEach(e=>{e.field=n}),e.concat(r)},[]),c=[],l=[],u=i.some(e=>e.validate)||s.some(e=>e.validate);if(u){this.state.meta.isValidating||this.setMeta(e=>({...e,isValidating:!0}));for(let e of o)e.setMeta(e=>({...e,isValidating:!0}))}let d=(t,n,r)=>{let i=hd(n.cause),o=t.getInfo();o.validationMetaMap[i]?.lastAbortController.abort();let s=new AbortController;o.validationMetaMap[i]={lastAbortController:s};let c=t===this;r.push(new Promise(async r=>{let o;try{o=await new Promise((r,i)=>{t.timeoutIds.validations[n.cause]&&clearTimeout(t.timeoutIds.validations[n.cause]),t.timeoutIds.validations[n.cause]=setTimeout(async()=>{if(s.signal.aborted)return r(void 0);try{r(await this.runValidator({validate:n.validate,value:{value:t.store.state.value,signal:s.signal,validationSource:c?`form`:`field`,...t instanceof e?{groupApi:t}:{fieldApi:t}},type:`validateAsync`}))}catch(e){i(e)}},n.debounceMs)})}catch(e){o=e}if(s.signal.aborted)return r(void 0);let l=o,u;c&&pd(o)&&(l=o.group,u=o.fields);let d=fd(l),f=a[t.name]?.[i],{newErrorValue:p,newSource:m}=Ku({formLevelError:f,fieldLevelError:d});if(t.getInfo().instance!==t)return r(void 0);t.setMeta(e=>({...e,errorMap:{...e?.errorMap,[i]:p},errorSourceMap:{...e.errorSourceMap,[i]:m}})),c&&this.distributeFieldErrors(i,u),r(p)}))};for(let e of i)e.validate&&d(this,e,c);for(let e of s)e.validate&&d(e.field,e,l);let f=[];if((c.length||l.length)&&(f=await Promise.all(c),await Promise.all(l)),u){this.setMeta(e=>({...e,isValidating:!1}));for(let e of o)e.setMeta(e=>({...e,isValidating:!1}))}return f.filter(Boolean)},this.validateAllFields=async e=>{let t=[];return Sr(()=>{Object.values(this.getRelatedFields()).forEach(n=>{t.push(Promise.resolve().then(()=>n.validate(e,{skipFormValidation:!0,skipGroupValidation:!0}))),n.store.state.meta.isTouched||n.setMeta(e=>({...e,isTouched:!0}))})}),(await Promise.all(t)).flat()},this.validateArrayFieldsStartingFrom=(e,t,n)=>this.form.validateArrayFieldsStartingFrom(e,t,n),this.validateField=(e,t)=>this.form.validateField(e,t),this.getFieldValue=e=>this.form.getFieldValue(e),this.getFieldMeta=e=>this.form.getFieldMeta(e),this.setFieldMeta=(e,t)=>this.form.setFieldMeta(e,t),this.setFieldValue=(e,t)=>this.form.setFieldValue(e,t),this.deleteField=e=>this.form.deleteField(e),this.pushFieldValue=(e,t)=>this.form.pushFieldValue(e,t),this.insertFieldValue=(e,t,n)=>this.form.insertFieldValue(e,t,n),this.replaceFieldValue=(e,t,n)=>this.form.replaceFieldValue(e,t,n),this.swapFieldValues=(e,t,n)=>this.form.swapFieldValues(e,t,n),this.moveFieldValues=(e,t,n)=>this.form.moveFieldValues(e,t,n),this.clearFieldValues=e=>this.form.clearFieldValues(e),this.resetField=e=>this.form.resetField(e),this.removeFieldValue=(e,t)=>this.form.removeFieldValue(e,t),this.areRelatedFieldsValid=()=>Object.values(this.getRelatedFields()).every(e=>e.state.meta.isValid),this.validate=(e,t)=>{let{fieldsErrorMap:n}=t?.skipFormValidation?{fieldsErrorMap:{}}:this.form.validateSync(e,{dontUpdateFormErrorMap:!0,filterFieldNames:e=>ed(this.name,e)}),{hasErrored:r}=this.validateSync(e,n[this.name]??{},{skipRelatedFieldValidation:t?.skipRelatedFieldValidation});if(r&&!this.options.asyncAlways)return this.getInfo().validationMetaMap[hd(e)]?.lastAbortController.abort(),this.state.meta.errors;let i=t?.skipFormValidation?Promise.resolve({}):this.form.validateAsync(e,{dontUpdateFormErrorMap:!0,filterFieldNames:e=>ed(this.name,e)});return this.validateAsync(e,i,{skipRelatedFieldValidation:t?.skipRelatedFieldValidation})},this.triggerOnChangeListener=()=>{let e=this.form.options.listeners?.onChangeGroupDebounceMs;e&&e>0?(this.timeoutIds.formListeners.change&&clearTimeout(this.timeoutIds.formListeners.change),this.timeoutIds.formListeners.change=setTimeout(()=>{this.form.options.listeners?.onChangeGroup?.({formApi:this.form,groupApi:this})},e)):this.form.options.listeners?.onChangeGroup?.({formApi:this.form,groupApi:this});let t=this.options.listeners?.onChangeDebounceMs;t&&t>0?(this.timeoutIds.listeners.change&&clearTimeout(this.timeoutIds.listeners.change),this.timeoutIds.listeners.change=setTimeout(()=>{this.options.listeners?.onChange?.({value:this.state.value,groupApi:this})},t)):this.options.listeners?.onChange?.({value:this.state.value,groupApi:this})},this.triggerOnSubmitListener=()=>{this.options.listeners?.onSubmit?.({value:this.state.value,groupApi:this})},this._handleSubmit=async e=>{this.setFormGroupState(e=>({...e,isSubmitted:!1,submissionAttempts:e.submissionAttempts+1,isSubmitSuccessful:!1})),Sr(()=>{Object.values(this.getRelatedFields()).forEach(e=>{e.state.meta.isTouched||e.setMeta(e=>({...e,isTouched:!0}))})});let t=e??this.options.onSubmitMeta;this.setFormGroupState(e=>({...e,isSubmitting:!0}));let n=()=>{this.setFormGroupState(e=>({...e,isSubmitting:!1}))};if(await this.validateAllFields(`submit`),!this.areRelatedFieldsValid())n(),this.options.onGroupSubmitInvalid?.({value:this.state.value,groupApi:this,meta:t});else if(await this.validate(`submit`,{skipRelatedFieldValidation:!0}),!this.areRelatedFieldsValid()||!this.state.meta.isValid)n(),this.options.onGroupSubmitInvalid?.({value:this.state.value,groupApi:this,meta:t});else{Sr(()=>{Object.values(this.getRelatedFields()).forEach(e=>{e.options.listeners?.onGroupSubmit?.({value:e.state.value,fieldApi:e})})}),this.options.listeners?.onSubmit?.({groupApi:this,value:this.state.value});try{await this.options.onGroupSubmit?.({value:this.state.value,groupApi:this,meta:t}),Sr(()=>{this.setFormGroupState(e=>({...e,isSubmitted:!0,isSubmitSuccessful:!0})),n()})}catch(e){throw this.setFormGroupState(e=>({...e,isSubmitSuccessful:!1})),n(),e}}},this.form=t.form,this.name=t.name,this.options=t,this.timeoutIds={validations:{},listeners:{},formListeners:{}},this.fieldInfo={instance:null,validationMetaMap:{onChange:void 0,onBlur:void 0,onSubmit:void 0,onMount:void 0,onServer:void 0,onDynamic:void 0}},this.store=kr(e=>{this.form.formGroupMetaDerived.get(),this.form.baseStore.get();let n=this.form.getFormGroupMeta(this.name)??ud(t.defaultMeta),r=this.form.getFieldValue(this.name);return!n.isTouched&&r===void 0&&this.options.defaultValue!==void 0&&!Wu(r,this.options.defaultValue)&&(r=this.options.defaultValue),e&&e.value===r&&e.meta===n?e:{value:r,meta:n}}),this.handleSubmit=this.handleSubmit.bind(this)}get state(){return this.store.state}runValidator(e){if(U(e.validate)){let t=H[e.type](e.value,e.validate);return e.type===`validate`?md(t):t.then(md)}return e.validate(e.value)}handleSubmit(e){return this._handleSubmit(e)}};function fd(e){if(e)return e}function pd(e){return!!e&&typeof e==`object`&&`fields`in e}function md(e){if(!e||typeof e!=`object`||!(`form`in e)&&!(`fields`in e))return e;let{form:t,fields:n,...r}=e;return{...r,group:t,fields:n}}function hd(e){switch(e){case`submit`:return`onSubmit`;case`blur`:return`onBlur`;case`mount`:return`onMount`;case`server`:return`onServer`;case`dynamic`:return`onDynamic`;default:return`onChange`}}function gd(e,t){if(!t)return;let n=Object.assign({},e,{state:$u(e.state)});t(n),n.fieldInfo!==e.fieldInfo&&(e.fieldInfo=n.fieldInfo),n.options!==e.options&&(e.options=n.options);let r=Object.keys({values:null,validationMetaMap:null,fieldMetaBase:null,formGroupStateBase:null,isSubmitting:null,isSubmitted:null,isValidating:null,submissionAttempts:null,isSubmitSuccessful:null,_force_re_eval:null}).reduce((t,r)=>(e.state[r]!==n.state[r]&&(t[r]=n.state[r]),t),{});return Sr(()=>{Object.keys(r).length&&e.baseStore.setState(e=>({...e,...r})),n.state.errorMap!==e.state.errorMap&&e.setErrorMap(n.state.errorMap)}),n}var _d=typeof window<`u`?T.useLayoutEffect:T.useEffect;function vd(e){let[t,n]=(0,T.useState)(()=>({form:e.form,name:e.name})),[r,i]=(0,T.useState)(()=>new sd({...e})),a=r;(t.form!==e.form||t.name!==e.name)&&(a=new sd({...e}),i(a),n({form:e.form,name:e.name}));let o=M(a.store,e.mode===`array`?e=>e.meta._arrayVersion||0:e=>e.value),s=M(a.store,e=>e.meta.isTouched),c=M(a.store,e=>e.meta.isBlurred),l=M(a.store,e=>e.meta.isDirty),u=M(a.store,e=>e.meta.errorMap),d=M(a.store,e=>e.meta.errorSourceMap),f=M(a.store,e=>e.meta.isValidating),p=(0,T.useMemo)(()=>({...a,get state(){return{value:e.mode===`array`?a.state.value:o,get meta(){return{...a.state.meta,isTouched:s,isBlurred:c,isDirty:l,errorMap:u,errorSourceMap:d,isValidating:f}}}}}),[a,e.mode,o,s,c,l,u,d,f]);return _d(a.mount,[a]),_d(()=>{a.update(e)}),p}var yd=(({children:e,...t})=>{let n=vd(t),r=(0,T.useMemo)(()=>Au(e,n),[e,n]);return(0,j.jsx)(j.Fragment,{children:r})});function bd(){return(0,T.useState)(()=>Zu())[0]}var xd=T,Sd=`19.3.1`.split(`.`)[0]===`17`?bd:xd.useId;function Cd(e){let[t,n]=(0,T.useState)(()=>({form:e.form,name:e.name})),[r,i]=(0,T.useState)(()=>new dd({...e}));(t.form!==e.form||t.name!==e.name)&&(i(new dd({...e})),n({form:e.form,name:e.name}));let a=M(r.store,e=>e.value),o=M(r.store,e=>e.meta.isTouched),s=M(r.store,e=>e.meta.isBlurred),c=M(r.store,e=>e.meta.isDirty),l=M(r.store,e=>e.meta.errorMap),u=M(r.store,e=>e.meta.errorSourceMap),d=M(r.store,e=>e.meta.isValidating),f=M(r.store,e=>e.meta.isSubmitting),p=M(r.store,e=>e.meta.isSubmitted),m=M(r.store,e=>e.meta.submissionAttempts),h=M(r.store,e=>e.meta.isSubmitSuccessful),g=M(r.store,e=>e.meta.canSubmit),_=M(r.store,e=>e.meta.isValid),v=M(r.store,e=>e.meta.isFieldsValid),y=M(r.store,e=>e.meta.isFieldsValidating),b=M(r.store,e=>e.meta.isGroupValid),x=(0,T.useMemo)(()=>({...r,handleSubmit:((...e)=>r._handleSubmit(...e)),get state(){return{...r.state,value:a,get meta(){return{...r.state.meta,isTouched:o,isBlurred:s,isDirty:c,errorMap:l,errorSourceMap:u,isValidating:d,isSubmitting:f,isSubmitted:p,submissionAttempts:m,isSubmitSuccessful:h,canSubmit:g,isValid:_,isFieldsValid:v,isFieldsValidating:y,isGroupValid:b}}}}}),[r,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b]);return _d(r.mount,[r]),_d(()=>{r.update(e)}),x}var wd=(({children:e,...t})=>{let n=Cd(t),r=(0,T.useMemo)(()=>Au(e,n),[e,n]);return(0,j.jsx)(j.Fragment,{children:r})});function Td({form:e,selector:t=e=>e,children:n}){let r=M(e.store,t);return(0,j.jsx)(j.Fragment,{children:Au(n,r)})}function Ed(e){let t=Sd(),[n,r]=(0,T.useState)(e?.formId),[i,a]=(0,T.useState)(()=>new id({...e,formId:e?.formId??t}));if(n!==e?.formId){let n=e?.formId??t;a(new id({...e,formId:n})),r(n)}let o=(0,T.useMemo)(()=>{let e={...i,handleSubmit:((...e)=>i._handleSubmit(...e)),get formId(){return i._formId},get state(){return i.store.state}};return e.Field=function(e){return(0,j.jsx)(yd,{...e,form:i})},e.FormGroup=function(e){return(0,j.jsx)(wd,{...e,form:i})},e.Subscribe=function(e){return(0,j.jsx)(Td,{form:i,selector:e.selector,children:e.children})},e},[i]);_d(i.mount,[]),_d(()=>{i.update(e)});let s=(0,T.useRef)(!1);return _d(()=>{s.current&&e?.transform&&gd(i,e.transform)},[i,e?.transform]),_d(()=>{s.current=!0}),o}function J(e){let t=e?.response;return typeof t?.message==`string`&&t.message?t.message:e instanceof Error&&e.message?e.message:`Something went wrong.`}function Dd(e){return e?.status===400?`Invalid filter. Check the syntax and field names.`:J(e)}function Od(e,t=``){let n={};if(typeof e!=`object`||!e)return n;let r=e;if(typeof r.message==`string`&&t)return n[t]=r.message,n;for(let[e,i]of Object.entries(r))Object.assign(n,Od(i,t?`${t}.${e}`:e));return n}var kd=(0,T.createContext)(null),Ad=e=>e?.response?.data;function jd({error:e,children:t}){let n=(0,T.useRef)(new Set),r=(0,T.useRef)(new Map),i=(0,T.useMemo)(()=>{let t=()=>n.current.forEach(e=>e());return{errors:e?Od(Ad(e)):{},message:e?J(e):``,claimed:()=>new Set(r.current.keys()),subscribe(e){return n.current.add(e),()=>n.current.delete(e)},claim(e){r.current.set(e,(r.current.get(e)??0)+1),t()},release(e){let n=(r.current.get(e)??1)-1;n<=0?r.current.delete(e):r.current.set(e,n),t()}}},[e]);return(0,j.jsx)(kd.Provider,{value:i,children:t})}function Y(e){let t=(0,T.useContext)(kd);return(0,T.useLayoutEffect)(()=>(t?.claim(e),()=>t?.release(e)),[t,e]),t?.errors[e]}function X(){let e=(0,T.useContext)(kd),[,t]=(0,T.useState)(0),n=!!e?.message;if((0,T.useLayoutEffect)(()=>{if(!e||!n)return;let r=()=>t(e=>e+1);return r(),e.subscribe(r)},[e,n]),!e||!e.message)return null;let r=e.claimed(),i=Object.entries(e.errors).filter(([e])=>!r.has(e));return i.length===0&&Object.keys(e.errors).length>0?null:(0,j.jsxs)(`div`,{role:`alert`,className:`rounded border border-danger/40 bg-danger/10 p-3 text-sm text-danger-text`,children:[(0,j.jsx)(`p`,{children:e.message}),i.length>0&&(0,j.jsx)(`ul`,{className:`mt-1 list-disc pl-5`,children:i.map(([e,t])=>(0,j.jsxs)(`li`,{children:[e,`: `,t]},e))})]})}function Md(e,t=!0){let n=(0,T.useContext)(kd),r=Object.entries(n?.errors??{}).filter(([t])=>t.startsWith(e)),i=t?r.map(([e])=>e).join(`
|
|
14
|
+
`):``;return(0,T.useLayoutEffect)(()=>{if(!n||!i)return;let e=i.split(`
|
|
15
|
+
`);return e.forEach(e=>n.claim(e)),()=>e.forEach(e=>n.release(e))},[n,i]),r}function Nd({size:e=22}){return(0,j.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 64 64`,"aria-hidden":`true`,children:[(0,j.jsx)(`rect`,{width:`64`,height:`64`,rx:`14`,fill:`#1b7b9b`}),(0,j.jsxs)(`g`,{fill:`none`,stroke:`#fff`,strokeWidth:`2.8`,children:[(0,j.jsx)(`path`,{d:`M29 7H35V14H42V22H50V29H57V35H50V42H42V50H35V57H29V50H22V42H14V35H7V29H14V22H22V14H29Z`}),(0,j.jsx)(`path`,{d:`M32 19 45 32 32 45 19 32Z`})]}),(0,j.jsx)(`path`,{d:`M32 27 37 32 32 37 27 32Z`,fill:`#fff`})]})}function Pd({title:e,children:t}){return(0,j.jsx)(`main`,{className:`flex min-h-dvh items-center justify-center bg-bg p-4`,children:(0,j.jsxs)(`div`,{className:`flex w-full max-w-sm flex-col gap-4 rounded-base border border-line bg-raised p-6`,children:[(0,j.jsx)(Nd,{size:40}),(0,j.jsx)(`h1`,{className:`text-xl font-semibold`,children:e}),t]})})}function Fd({path:e,...t}){return(0,j.jsx)(kl,{...t,error:Y(e)})}function Id(){let{token:e}=Rr({from:`/hbinstall/$token`});return Ii(e,Date.now())?(0,j.jsxs)(Pd,{title:`Installer link expired`,children:[(0,j.jsx)(`p`,{role:`alert`,children:`This installer link has expired. Restart the server to print a new one.`}),(0,j.jsx)(ni,{to:`/login`,className:`text-accent-text hover:underline`,children:`Sign in`})]}):(0,j.jsx)(Rd,{token:e})}function Ld(){let e=Br(),[t,n]=(0,T.useState)(``),r=xu(t);return(0,j.jsxs)(Pd,{title:`Set up Heybe`,children:[(0,j.jsxs)(`p`,{className:`text-sm`,children:[`This server has no superuser yet. Open the setup link printed where Heybe runs: the terminal, `,(0,j.jsx)(`code`,{children:`journalctl -u heybe`}),` or`,` `,(0,j.jsx)(`code`,{children:`docker logs`}),`. Paste it here to continue.`]}),(0,j.jsxs)(`form`,{onSubmit:t=>{t.preventDefault(),e({to:`/hbinstall/$token`,params:{token:r}})},className:`flex flex-col gap-3`,children:[(0,j.jsx)(kl,{label:`Setup link or token`,autoFocus:!0,required:!0,value:t,onChange:e=>n(e.target.value)}),(0,j.jsx)(w,{type:`submit`,variant:`primary`,disabled:!r,children:`Continue`})]}),(0,j.jsxs)(`p`,{className:`text-sm text-muted`,children:[`You can also create one on the server with`,` `,(0,j.jsx)(`code`,{children:`heybe superuser upsert EMAIL PASS`}),`.`]})]})}function Rd({token:e}){let t=z(),n=Br(),r={headers:{Authorization:e}},[i,a]=(0,T.useState)(null),[o,s]=(0,T.useState)(null),[c,l]=(0,T.useState)(!1),u=Ed({defaultValues:{email:``,password:``,passwordConfirm:``},onSubmit:async({value:e})=>{a(null);try{await t.records(`_superusers`).create(e,void 0,r),await t.auth(`_superusers`).withPassword(e.email,e.password),await n({to:`/collections`})}catch(e){a(e)}}}),d=Ed({defaultValues:{file:null},onSubmit:async({value:{file:e}})=>{if(e){s(null);try{await t.backups.upload(e,r),await t.backups.restore(e.name,r),l(!0)}catch(e){s(e)}}}});return c?(0,j.jsxs)(Pd,{title:`Restoring backup`,children:[(0,j.jsx)(`p`,{role:`status`,children:`Restore started. The server restarts with the restored data; reload this page in a few seconds.`}),(0,j.jsx)(w,{variant:`primary`,onClick:async()=>{await n({to:`/login`}),location.reload()},children:`Reload`})]}):(0,j.jsxs)(Pd,{title:`Create your first superuser`,children:[(0,j.jsx)(jd,{error:i,children:(0,j.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),u.handleSubmit()},className:`flex flex-col gap-3`,children:[(0,j.jsx)(u.Field,{name:`email`,children:e=>(0,j.jsx)(Fd,{path:`email`,label:`Email`,type:`email`,autoFocus:!0,autoComplete:`username`,required:!0,value:e.state.value,onChange:t=>e.handleChange(t.target.value)})}),(0,j.jsx)(u.Field,{name:`password`,children:e=>(0,j.jsx)(Fd,{path:`password`,label:`Password`,type:`password`,autoComplete:`new-password`,required:!0,value:e.state.value,onChange:t=>e.handleChange(t.target.value)})}),(0,j.jsx)(u.Field,{name:`passwordConfirm`,children:e=>(0,j.jsx)(Fd,{path:`passwordConfirm`,label:`Confirm password`,type:`password`,autoComplete:`new-password`,required:!0,value:e.state.value,onChange:t=>e.handleChange(t.target.value)})}),(0,j.jsx)(X,{}),(0,j.jsx)(u.Subscribe,{selector:e=>e.isSubmitting,children:e=>(0,j.jsx)(d.Subscribe,{selector:e=>e.isSubmitting,children:t=>(0,j.jsx)(w,{type:`submit`,variant:`primary`,loading:e,disabled:t,children:`Create superuser`})})})]})}),(0,j.jsx)(jd,{error:o,children:(0,j.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),d.handleSubmit()},className:`flex flex-col gap-3 border-t border-line pt-4`,children:[(0,j.jsx)(`h2`,{className:`font-medium`,children:`Restore from a backup`}),(0,j.jsx)(`p`,{className:`text-sm text-muted`,children:`The backup is not validated. Only use files you trust.`}),(0,j.jsx)(d.Field,{name:`file`,children:e=>(0,j.jsx)(Rl,{label:`Backup file`,accept:`.zip,application/zip`,onChange:t=>e.handleChange(t[0]??null)})}),(0,j.jsx)(X,{}),(0,j.jsx)(d.Subscribe,{selector:e=>[e.isSubmitting,e.values.file],children:([e,t])=>(0,j.jsx)(u.Subscribe,{selector:e=>e.isSubmitting,children:n=>(0,j.jsx)(w,{type:`submit`,loading:e,disabled:!t||n,children:`Upload and restore`})})})]})})]})}var zd=/^[^@\s]+@[^@\s]+$/;function Bd(){let e=z(),t=Br(),n=zr({from:`/login`}),r=e.auth(`_superusers`),i=ks({queryKey:[`superuserAuthMethods`],queryFn:({signal:e})=>r.methods({signal:e})}),[a,o]=(0,T.useState)(``),[s,c]=(0,T.useState)(``),[l,u]=(0,T.useState)(``),[d,f]=(0,T.useState)(null),p=()=>t({href:Su(n.redirect)}),m=async e=>{try{let t=await r.requestOTP(e);c(t.otpId),u(t.otpId)}catch(e){throw e instanceof ma&&e.status===429&&c(l),e}},h=async({identity:e,password:t})=>{try{await r.withPassword(e,t)}catch(t){let n=t instanceof ma&&t.response.mfaId;if(t instanceof ma&&t.status===401&&n){o(String(n)),zd.test(e)&&(g.setFieldValue(`otpEmail`,e),await m(e));return}throw t}await p()},g=Ed({defaultValues:{identity:``,password:``,otpEmail:``,otpPassword:``},onSubmitMeta:{step:`password`},onSubmit:async({value:e,meta:t})=>{f(null);try{t.step===`password`?await h(e):t.step===`sendCode`?await m(e.otpEmail):(await r.withOTP(s,e.otpPassword,a?{mfaId:a}:{}),await p())}catch(e){f(e)}}}),_;return _=i.isPending?(0,j.jsx)(`p`,{children:`Loading...`}):i.isError?(0,j.jsx)(`p`,{role:`alert`,children:J(i.error)}):i.data.password.enabled&&!a?(0,j.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),g.handleSubmit({step:`password`})},className:`flex flex-col gap-3`,children:[(0,j.jsx)(g.Field,{name:`identity`,children:e=>(0,j.jsx)(Fd,{path:`identity`,label:`Email`,type:`email`,autoFocus:!0,autoComplete:`username`,required:!0,value:e.state.value,onChange:t=>e.handleChange(t.target.value)})}),(0,j.jsx)(g.Field,{name:`password`,children:e=>(0,j.jsx)(Fd,{path:`password`,label:`Password`,type:`password`,autoComplete:`current-password`,required:!0,value:e.state.value,onChange:t=>e.handleChange(t.target.value)})}),(0,j.jsx)(X,{}),(0,j.jsx)(g.Subscribe,{selector:e=>e.isSubmitting,children:e=>(0,j.jsx)(w,{type:`submit`,variant:`primary`,loading:e,children:`Sign in`})}),(0,j.jsx)(ni,{to:`/request-password-reset`,className:`text-sm underline`,children:`Forgot password?`})]},`password`):(i.data.otp.enabled||a)&&!s?(0,j.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),g.handleSubmit({step:`sendCode`})},className:`flex flex-col gap-3`,children:[a&&(0,j.jsx)(`p`,{className:`text-sm`,children:`Finish signing in with a code.`}),(0,j.jsx)(g.Field,{name:`otpEmail`,children:e=>(0,j.jsx)(Fd,{path:`email`,label:`Email`,type:`email`,autoFocus:!0,autoComplete:`username`,required:!0,value:e.state.value,onChange:t=>e.handleChange(t.target.value)})}),(0,j.jsx)(X,{}),(0,j.jsx)(g.Subscribe,{selector:e=>e.isSubmitting,children:e=>(0,j.jsx)(w,{type:`submit`,variant:`primary`,loading:e,children:`Send code`})})]},`request-otp`):s?(0,j.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),g.handleSubmit({step:`verify`})},className:`flex flex-col gap-3`,children:[(0,j.jsx)(g.Subscribe,{selector:e=>e.values.otpEmail,children:e=>(0,j.jsxs)(`p`,{className:`text-sm`,children:[`Check `,e,` for the code.`]})}),(0,j.jsx)(g.Field,{name:`otpPassword`,children:e=>(0,j.jsx)(Fd,{path:`password`,label:`One-time password`,autoFocus:!0,autoComplete:`one-time-code`,required:!0,value:e.state.value,onChange:t=>e.handleChange(t.target.value)})}),(0,j.jsx)(X,{}),(0,j.jsx)(g.Subscribe,{selector:e=>e.isSubmitting,children:e=>(0,j.jsx)(w,{type:`submit`,variant:`primary`,loading:e,children:`Verify`})}),(0,j.jsx)(w,{variant:`ghost`,onClick:()=>c(``),children:`Send a new code`})]},`verify-otp`):(0,j.jsx)(`p`,{children:`No sign-in method is enabled for superusers.`}),(0,j.jsx)(Pd,{title:`Superuser sign in`,children:(0,j.jsx)(jd,{error:d,children:_})})}function Vd(){let e=z(),[t,n]=(0,T.useState)(!1),[r,i]=(0,T.useState)(null),a=Ed({defaultValues:{email:``},onSubmit:async({value:t})=>{i(null);try{await e.auth(`_superusers`).requestPasswordReset(t.email)}catch(e){let t=e.status??0;if(t===0||t>=500)return i(e)}n(!0)}});return(0,j.jsxs)(Pd,{title:`Reset password`,children:[t?(0,j.jsx)(`p`,{role:`status`,children:`If the email exists, a reset link was sent.`}):(0,j.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),a.handleSubmit()},className:`flex flex-col gap-3`,children:[(0,j.jsx)(a.Field,{name:`email`,children:e=>(0,j.jsx)(kl,{label:`Email`,type:`email`,autoComplete:`username`,required:!0,value:e.state.value,onChange:t=>e.handleChange(t.target.value)})}),r!==null&&(0,j.jsx)(`p`,{role:`alert`,children:J(r)}),(0,j.jsx)(a.Subscribe,{selector:e=>e.isSubmitting,children:e=>(0,j.jsx)(w,{type:`submit`,variant:`primary`,loading:e,children:`Send reset link`})})]}),(0,j.jsx)(ni,{to:`/login`,className:`text-sm underline`,children:`Back to sign in`})]})}function Hd(e){let t=Fi(e).collectionId;return typeof t==`string`&&t?t:null}function Ud({title:e}){return(0,j.jsx)(Pd,{title:e,children:(0,j.jsx)(`p`,{role:`alert`,children:`Invalid or expired link.`})})}var Wd=`Confirm new email`;function Gd(){let{token:e}=Rr({from:`/auth/confirm-email-change/$token`}),t=Hd(e);return t?(0,j.jsx)(Kd,{token:e,collectionId:t}):(0,j.jsx)(Ud,{title:Wd})}function Kd({token:e,collectionId:t}){let n=z(),[r,i]=(0,T.useState)(!1),[a,o]=(0,T.useState)(null),s=Ed({defaultValues:{password:``},onSubmit:async({value:r})=>{o(null);try{await n.auth(t).confirmEmailChange(e,r.password),i(!0)}catch(e){o(e)}}});return r?(0,j.jsx)(Pd,{title:Wd,children:(0,j.jsx)(`p`,{role:`status`,children:`Your email address was changed.`})}):(0,j.jsx)(Pd,{title:Wd,children:(0,j.jsx)(jd,{error:a,children:(0,j.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),s.handleSubmit()},className:`flex flex-col gap-3`,children:[(0,j.jsx)(s.Field,{name:`password`,children:e=>(0,j.jsx)(Fd,{path:`password`,label:`Password`,type:`password`,autoFocus:!0,autoComplete:`current-password`,required:!0,value:e.state.value,onChange:t=>e.handleChange(t.target.value)})}),(0,j.jsx)(X,{}),(0,j.jsx)(s.Subscribe,{selector:e=>e.isSubmitting,children:e=>(0,j.jsx)(w,{type:`submit`,variant:`primary`,loading:e,children:`Confirm new email`})})]})})})}var qd=`Reset password`,Jd=`hbc_3142635823`;function Yd(){let{token:e}=Rr({from:`/auth/confirm-password-reset/$token`}),t=Hd(e);return t?(0,j.jsx)(Xd,{token:e,collectionId:t}):(0,j.jsx)(Ud,{title:qd})}function Xd({token:e,collectionId:t}){let n=z(),[r,i]=(0,T.useState)(!1),[a,o]=(0,T.useState)(null),s=Ed({defaultValues:{password:``,passwordConfirm:``},onSubmit:async({value:r})=>{o(null);try{await n.auth(t).confirmPasswordReset(e,r.password,r.passwordConfirm),i(!0)}catch(e){o(e)}}});return r?(0,j.jsxs)(Pd,{title:qd,children:[(0,j.jsx)(`p`,{role:`status`,children:`Your password was changed.`}),t===Jd&&(0,j.jsx)(ni,{to:`/login`,className:`text-sm underline`,children:`Sign in`})]}):(0,j.jsx)(Pd,{title:qd,children:(0,j.jsx)(jd,{error:a,children:(0,j.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),s.handleSubmit()},className:`flex flex-col gap-3`,children:[(0,j.jsx)(s.Field,{name:`password`,children:e=>(0,j.jsx)(Fd,{path:`password`,label:`New password`,type:`password`,autoFocus:!0,autoComplete:`new-password`,required:!0,value:e.state.value,onChange:t=>e.handleChange(t.target.value)})}),(0,j.jsx)(s.Field,{name:`passwordConfirm`,children:e=>(0,j.jsx)(Fd,{path:`passwordConfirm`,label:`Confirm new password`,type:`password`,autoComplete:`new-password`,required:!0,value:e.state.value,onChange:t=>e.handleChange(t.target.value)})}),(0,j.jsx)(X,{}),(0,j.jsx)(s.Subscribe,{selector:e=>e.isSubmitting,children:e=>(0,j.jsx)(w,{type:`submit`,variant:`primary`,loading:e,children:`Set new password`})})]})})})}var Zd=`Verify email`;function Qd(){let{token:e}=Rr({from:`/auth/confirm-verification/$token`}),t=Hd(e);return t?(0,j.jsx)($d,{token:e,collectionId:t}):(0,j.jsx)(Ud,{title:Zd})}function $d({token:e,collectionId:t}){let n=z(),[r,i]=(0,T.useState)(null);return(0,T.useEffect)(()=>{let r=new AbortController;return n.auth(t).confirmVerification(e,{signal:r.signal}).then(()=>i({}),e=>{r.signal.aborted||i({error:J(e)})}),()=>r.abort()},[n,t,e]),(0,j.jsx)(Pd,{title:Zd,children:r===null?(0,j.jsx)(`p`,{role:`status`,children:`Verifying...`}):r.error?(0,j.jsx)(`p`,{role:`alert`,children:r.error}):(0,j.jsx)(`p`,{role:`status`,children:`Your email address is verified.`})})}function ef({success:e}){return(0,T.useEffect)(()=>{window.close()},[]),(0,j.jsx)(Pd,{title:`Sign in`,children:(0,j.jsx)(`p`,{role:e?`status`:`alert`,children:e?`Sign-in completed. You can close this window.`:`Sign-in failed. Close this window and try again.`})})}var tf={collections:[`collections`],settings:[`settings`],records:(e,t)=>[`records`,e,t],logs:e=>[`logs`,e],backups:[`backups`],crons:[`crons`],health:[`health`],fileToken:[`fileToken`]};function nf(){let{data:e}=af();return Object.fromEntries((e??[]).map(e=>[e.name,e.fields.map(e=>String(e.name))]))}async function rf(e){let t=[],n=1;for(;;){let r=await e(n);if(t.push(...r.items),r.page>=r.totalPages)return t;n=r.page+1}}function af(){let e=z();return ks({queryKey:tf.collections,queryFn:({signal:t})=>rf(n=>e.collections.findMany({perPage:1e3,page:n,orderBy:{name:`asc`}},{signal:t}))})}function of(){let e=z();return ks({queryKey:tf.settings,queryFn:async({signal:t})=>await e.settings.get({signal:t})})}function sf(){let e=of();return!e.data||e.data.meta.hideControls}function cf(){let e=z(),t=oo();return As({mutationFn:async t=>await e.settings.update(t),onSuccess:e=>t.setQueryData(tf.settings,e)})}function lf(e,t){let n={};for(let r of Object.keys(t))JSON.stringify(e[r])!==JSON.stringify(t[r])&&(n[r]=t[r]);return n}function uf(e){return e==null?`Superusers only`:e===``?`Everyone`:String(e)}function df({collection:e,onClose:t}){let n=`/api/collections/${encodeURIComponent(e.name)}`,r=[[`List/Search`,`GET`,`${n}/records`,e.listRule],[`View`,`GET`,`${n}/records/{id}`,e.viewRule]];e.type!==`view`&&r.push([`Create`,`POST`,`${n}/records`,e.createRule],[`Update`,`PATCH`,`${n}/records/{id}`,e.updateRule],[`Delete`,`DELETE`,`${n}/records/{id}`,e.deleteRule]),e.type===`auth`&&r.push([`Auth with password`,`POST`,`${n}/auth-with-password`,e.authRule]);let i=[`import { createClient } from "@heybejs/client";`,``,`const heybe = createClient(${JSON.stringify(location.origin)});`,`const page = await heybe.records(${JSON.stringify(e.name)}).findMany({ page: 1, perPage: 20 });`].join(`
|
|
16
|
+
`);return(0,j.jsxs)(Ol,{open:!0,size:`lg`,onClose:t,title:`API preview`,children:[(0,j.jsxs)(Hl,{caption:`${e.name} endpoints`,children:[(0,j.jsx)(`thead`,{children:(0,j.jsxs)(`tr`,{children:[(0,j.jsx)(Wl,{children:`Action`}),(0,j.jsx)(Wl,{children:`Method`}),(0,j.jsx)(Wl,{children:`Path`}),(0,j.jsx)(Wl,{children:`Rule`})]})}),(0,j.jsx)(`tbody`,{children:r.map(([e,t,n,r])=>(0,j.jsxs)(`tr`,{className:`h-11`,children:[(0,j.jsx)(Gl,{children:e}),(0,j.jsx)(Gl,{children:(0,j.jsx)(Ns,{tone:`neutral`,children:t})}),(0,j.jsx)(Gl,{wrap:!0,children:(0,j.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,j.jsx)(`code`,{className:`min-w-0 max-w-md truncate`,title:n,children:n}),(0,j.jsx)(Fl,{text:n,label:`Copy ${e} path`})]})}),(0,j.jsx)(Gl,{children:uf(r)})]},e))})]}),(0,j.jsxs)(`div`,{className:`mt-4 flex items-center justify-between`,children:[(0,j.jsx)(`h3`,{className:`text-sm font-medium`,children:`Client`}),(0,j.jsx)(Fl,{text:i,label:`Copy snippet`})]}),(0,j.jsx)(`div`,{className:`mt-1`,children:(0,j.jsx)(m,{label:`Client snippet`,hideLabel:!0,language:`javascript`,readOnly:!0,value:i})})]})}function ff({collections:e,onClose:t}){let n=t=>e.find(e=>e.id===t)?.name??String(t);return(0,j.jsx)(Ol,{open:!0,onClose:t,title:`Collections overview`,children:(0,j.jsxs)(Hl,{caption:`Collections and their relations`,children:[(0,j.jsx)(`thead`,{children:(0,j.jsxs)(`tr`,{children:[(0,j.jsx)(Wl,{children:`Collection`}),(0,j.jsx)(Wl,{children:`Type`}),(0,j.jsx)(Wl,{children:`Relations`})]})}),(0,j.jsx)(`tbody`,{children:e.map(e=>(0,j.jsxs)(`tr`,{children:[(0,j.jsx)(Gl,{children:e.name}),(0,j.jsx)(Gl,{children:e.type}),(0,j.jsx)(Gl,{children:e.fields.filter(e=>e.type===`relation`).map(e=>`${String(e.name)}: ${n(e.collectionId)}`).join(`, `)})]},e.id))})]})})}var pf=(0,T.createContext)(()=>{}),Z=()=>(0,T.useContext)(pf);function mf(){let e=af(),t=sf(),[n,r]=(0,T.useState)(``),[i,a]=(0,T.useState)(!1),[s,c]=(0,T.useState)(!1),l=Z(),u=n.trim().toLowerCase(),d=(e.data??[]).filter(e=>e.name.toLowerCase().includes(u)),f=d.filter(e=>e.system),{collectionId:p}=Rr({strict:!1}),m=(e.data??[]).some(e=>e.system&&(e.id===p||e.name===p)),h=u!==``||m,g=i||h,_=(0,T.useId)(),[v,y]=(0,T.useState)(!1),b=(0,T.useId)();return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`nav`,{"aria-label":`Collections`,className:`flex w-full flex-col gap-3 overflow-y-auto p-1 md:sticky md:-m-1 md:top-14 md:max-h-[calc(100dvh-4.5rem)] md:w-56 md:shrink-0 md:self-start`,children:[(0,j.jsxs)(`button`,{type:`button`,"aria-expanded":v,"aria-controls":b,onClick:()=>y(!v),className:`${gf} font-medium hover:bg-hover md:hidden`,children:[v?(0,j.jsx)(Xs,{...hf}):(0,j.jsx)(Qs,{...hf}),`Collections`]}),(0,j.jsxs)(`div`,{id:b,className:`${v?`flex`:`hidden`} flex-col gap-3 md:flex`,children:[(0,j.jsxs)(`div`,{className:`relative`,children:[(0,j.jsx)(il,{...hf,className:`pointer-events-none absolute top-1/2 left-2.5 -translate-y-1/2 text-faint`}),(0,j.jsx)(`input`,{type:`text`,"aria-label":`Search collections`,placeholder:`Search collections`,value:n,onChange:e=>r(e.target.value),className:`${o} pr-8 pl-8`}),n&&(0,j.jsx)(`button`,{type:`button`,"aria-label":`Clear search`,onClick:()=>r(``),className:`absolute top-1/2 right-1.5 flex size-6 -translate-y-1/2 items-center justify-center rounded-control text-faint hover:bg-hover hover:text-text focus-visible:outline-2 focus-visible:outline-focus`,children:(0,j.jsx)(R,{...hf})})]}),(0,j.jsxs)(`button`,{type:`button`,onClick:()=>c(!0),className:`${gf} text-left hover:bg-hover`,children:[(0,j.jsx)(Mc,{...hf,className:`text-muted`}),`Overview`]}),(0,j.jsx)(yf,{items:d.filter(e=>!e.system),editable:!t,onNavigate:()=>y(!1)}),f.length>0&&(0,j.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,j.jsxs)(`button`,{type:`button`,"aria-expanded":g,"aria-controls":_,disabled:h,onClick:()=>a(!i),className:`flex items-center gap-1 rounded-control px-1 text-left text-xs font-medium text-muted uppercase focus-visible:outline-2 focus-visible:outline-focus disabled:cursor-default`,children:[g?(0,j.jsx)(Xs,{size:13,strokeWidth:1.75,"aria-hidden":!0}):(0,j.jsx)(Qs,{size:13,strokeWidth:1.75,"aria-hidden":!0}),`System`]}),(0,j.jsx)(`div`,{id:_,hidden:!g,children:g&&(0,j.jsx)(yf,{items:f,editable:!t,onNavigate:()=>y(!1)})})]}),u!==``&&d.length===0&&(0,j.jsx)(`p`,{className:`px-2 text-sm text-muted`,children:`No collections match`}),!t&&(0,j.jsx)(w,{variant:`ghost`,onClick:()=>l(),icon:(0,j.jsx)(Jc,{...hf}),className:`justify-start`,children:`New collection`})]})]}),s&&(0,j.jsx)(ff,{collections:e.data??[],onClose:()=>c(!1)})]})}var hf={size:15,strokeWidth:1.75,"aria-hidden":!0},gf=`flex w-full items-center gap-2 rounded-control px-2 py-1.5 text-sm focus-visible:outline-2 focus-visible:outline-focus`,_f={base:uc,auth:Sl,view:mc};function vf(){let e=Z();return(0,j.jsx)(w,{variant:`primary`,onClick:()=>e(),children:`New collection`})}function yf({items:e,editable:t,onNavigate:n}){let r=Z();return(0,j.jsx)(`ul`,{className:`flex flex-col gap-1`,children:e.map(e=>{let i=_f[e.type];return(0,j.jsxs)(`li`,{className:`group relative flex items-center`,children:[(0,j.jsxs)(ni,{to:`/collections/$collectionId`,params:{collectionId:e.id},onClick:n,className:`${gf} min-w-0 hover:bg-hover`,activeProps:{"aria-current":`page`,className:`bg-hover font-medium`},children:[(0,j.jsx)(i,{...hf,className:`shrink-0 text-muted`}),(0,j.jsx)(`span`,{className:`truncate`,children:e.name})]}),t&&(0,j.jsx)(w,{variant:`ghost`,size:`sm`,"aria-label":`Edit collection ${e.name}`,onClick:()=>r(e),icon:(0,j.jsx)(ol,{size:14,strokeWidth:1.75}),className:`absolute right-1 w-7 px-0 opacity-0 focus-visible:opacity-100 group-hover:opacity-100`})]},e.id)})})}function bf({names:e,hidden:t,onToggle:n}){return(0,j.jsx)(b,{trigger:(0,j.jsx)(w,{children:`Columns`}),placement:`bottom-end`,children:(0,j.jsx)(`div`,{className:`flex flex-col gap-1`,children:e.map(e=>(0,j.jsx)(Ps,{label:e,checked:!t.includes(e),onChange:()=>n(e)},e))})})}function xf({page:e,totalPages:t,onPage:n}){return t<=1?null:(0,j.jsx)(`div`,{className:`flex flex-wrap items-center justify-end gap-2 text-sm`,children:(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(w,{disabled:e<=1,onClick:()=>n(e-1),children:`Previous`}),(0,j.jsxs)(`span`,{children:[`Page `,e,` of `,Math.max(t,1)]}),(0,j.jsx)(w,{disabled:e>=t,onClick:()=>n(e+1),children:`Next`})]})})}var Sf=new Intl.DateTimeFormat(`en-US`,{month:`short`,day:`numeric`,year:`numeric`}),Cf=new Intl.DateTimeFormat(`en-US`,{hour:`numeric`,minute:`2-digit`}),wf=new Intl.DateTimeFormat(`en-US`,{hour:`numeric`,minute:`2-digit`,second:`2-digit`,timeZoneName:`shortOffset`});function Tf(e,t=`short`){let n=new Date(typeof e==`string`?e.replace(` `,`T`):e);return Number.isNaN(n.getTime())?String(e):`${Sf.format(n)}, ${(t===`full`?wf:Cf).format(n)}`}function Ef({collection:e,recordId:t,label:n,onClose:r}){let i=z(),a=As({mutationFn:async n=>(await i.auth(e.name).impersonate(t,n)).authStore.token}),o=Ed({defaultValues:{duration:`0`},onSubmit:({value:e})=>a.mutateAsync(Number(e.duration)).catch(()=>void 0)});return(0,j.jsx)(Ol,{open:!0,title:`Impersonate ${n}`,onClose:r,footer:(0,j.jsx)(w,{onClick:r,children:`Close`}),children:(0,j.jsxs)(`form`,{noValidate:!0,onSubmit:e=>{e.preventDefault(),o.handleSubmit()},className:`flex flex-col gap-4`,children:[(0,j.jsx)(o.Field,{name:`duration`,validators:{onSubmit:({value:e})=>/^\d+$/.test(e)?void 0:`Enter a whole number of seconds, 0 or more.`},children:e=>(0,j.jsx)(zl,{label:`Token duration (seconds)`,hint:`0 uses the collection's auth token duration.`,min:0,step:1,error:e.state.meta.errors[0],value:e.state.value,onChange:t=>e.handleChange(t.target.value)})}),(0,j.jsx)(o.Subscribe,{selector:e=>e.isSubmitting,children:e=>(0,j.jsx)(w,{type:`submit`,variant:`primary`,loading:e,children:`Generate token`})}),a.isError&&(0,j.jsx)(`p`,{role:`alert`,className:`text-sm text-danger-text`,children:J(a.error)}),a.data&&(0,j.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,j.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,j.jsx)(`div`,{className:`flex-1`,children:(0,j.jsx)(kl,{label:`Token`,readOnly:!0,value:a.data,className:`font-mono`})}),(0,j.jsx)(Fl,{label:`Copy token`,text:a.data})]}),(0,j.jsx)(`p`,{className:`text-sm text-muted`,children:`This token is not refreshable.`})]})]})})}function Df(e,t){let n=z(),r=Ql(),[i,a]=(0,T.useState)(!1),o=n.auth(e.name),s=String(t.email??``),c=e.passwordAuth,l=As({mutationFn:e=>e===`verification`?o.requestVerification(s):o.requestPasswordReset(s),onSuccess:(e,t)=>r.success(t===`verification`?`Verification email sent.`:`Password reset email sent.`),onError:e=>r.error(J(e))}),u=[];return s&&!t.verified&&u.push({key:`verification`,label:`Send verification email`}),s&&c?.enabled!==!1&&u.push({key:`reset`,label:`Send password reset email`}),u.push({key:`impersonate`,label:`Impersonate`}),{items:u,run:e=>{e===`verification`||e===`reset`?l.mutate(e):e===`impersonate`&&a(!0)},dialog:i?(0,j.jsx)(Ef,{collection:e,recordId:t.id,label:s||t.id,onClose:()=>a(!1)}):null}}var Of=class extends Error{constructor(e){super(`Invalid JSON in ${e}.`),this.field=e}},kf=[`autodate`,`password`],Af=e=>e.fields,jf=e=>Number(e.maxSelect)>1;function Mf(e){return Object.fromEntries(Af(e).filter(e=>!e.hidden&&e.type===`relation`).map(e=>[e.name,!0]))}function Nf(e){let t=/^(\d{4}-\d\d-\d\d)T(\d\d:\d\d)(?::(\d\d))?/.exec(e);return t?`${t[1]} ${t[2]}:${t[3]??`00`}.000Z`:``}function Pf(e){let t=/^(\d{4}-\d\d-\d\d)[ T](\d\d:\d\d:\d\d)/.exec(e);return t?`${t[1]}T${t[2]}`:``}function Ff(e,t){switch(e.type){case`number`:return t==null?``:String(t);case`bool`:return!!t;case`date`:return Pf(String(t??``));case`select`:case`relation`:return jf(e)?Array.isArray(t)?t:t?[t]:[]:String(Array.isArray(t)?t[0]??``:t??``);case`file`:return{removed:[],added:[]};case`json`:return t==null||t===``?``:JSON.stringify(t,null,2);case`geoPoint`:{let e=t;return{lon:e?String(e.lon??0):``,lat:e?String(e.lat??0):``}}default:return String(t??``)}}function If(e,t){let n={};for(let r of Af(e))r.type===`password`?(n.password=``,n.passwordConfirm=``):r.hidden||(n[r.name]=Ff(r,t?.[r.name]));return n}function Lf(e,t){switch(e.type){case`number`:return t===``?null:Number(t);case`date`:return Nf(String(t));case`json`:{let n=String(t).trim();if(!n)return null;try{JSON.parse(n)}catch{throw new Of(e.name)}return n}case`geoPoint`:{let{lon:e,lat:n}=t;return{lon:Number(e||0),lat:Number(n||0)}}default:return t}}function Rf(e,{removed:t,added:n},r){let i=jf(e);return r?n.length?{[e.name]:i?n:n[0]}:{}:i?{...n.length&&{[`${e.name}+`]:n},...t.length&&{[`${e.name}-`]:t}}:n.length?{[e.name]:n[0]}:t.length?{[`${e.name}-`]:t}:{}}var zf=(e,t)=>{if(e.type===`bool`)return t===!1;if(e.type===`geoPoint`){let{lon:e,lat:n}=t;return e===``&&n===``}return Array.isArray(t)?t.length===0:String(t).trim()===``};function Bf(e,t,n){let r=n?If(e,n):void 0,i={};for(let n of Af(e)){if(n.hidden||kf.includes(n.type)||!(n.name in t))continue;let e=t[n.name];n.type===`file`?Object.assign(i,Rf(n,e,!r)):(r?JSON.stringify(e)!==JSON.stringify(r[n.name]):!zf(n,e))&&(i[n.name]=Lf(n,e))}return e.type===`auth`&&t.password&&(i.password=t.password,i.passwordConfirm=t.passwordConfirm),i}function Vf({name:e,value:t,error:n,disabled:r,onChange:i}){let a=S({error:n});return(0,j.jsx)(c,{...a,label:`${e} (UTC)`,error:n,children:(0,j.jsxs)(`div`,{className:`flex h-9 items-center rounded-control border bg-field pr-1 focus-within:outline-2 focus-within:outline-focus ${n?`border-danger`:`border-field-line`} ${r?`opacity-50`:``}`,children:[(0,j.jsx)(`input`,{...a.aria,type:`datetime-local`,step:1,value:t,disabled:r,onChange:e=>i(e.target.value),className:`h-full min-w-0 flex-1 bg-transparent px-2.5 text-sm text-text outline-none`}),t&&(0,j.jsx)(`button`,{type:`button`,"aria-label":`Clear ${e}`,disabled:r,onClick:()=>i(``),className:`inline-flex size-7 items-center justify-center rounded-control text-muted hover:bg-hover hover:text-text focus-visible:outline-2 focus-visible:outline-focus`,children:(0,j.jsx)(R,{size:15,strokeWidth:1.75,"aria-hidden":!0})})]})})}var Q=`modulepreload`,Hf=function(e){return`/_/`+e},Uf={},Wf=function(e){return e.pathname.endsWith(`.css`)},Gf=function(e,t,n){if(t in e)return e[t];let r=n();if(!r){e[t]=void 0;return}let i=r.then(()=>{e[t]=void 0},n=>{throw e[t]=void 0,n});return e[t]=i,i},Kf=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e,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}))))}function s(e){return import.meta.resolve?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}r=o(t.map(t=>{t=Hf(t,n);let r=s(t),i=Wf(r);return Gf(Uf,r.href,()=>{if(e===void 0){e={all:new Set,styles:new Set};let t=document.getElementsByTagName(`link`);for(let n=t.length-1;n>=0;n--){let r=t[n];e.all.add(r.href),r.rel===`stylesheet`&&e.styles.add(r.href)}}if((i?e.styles:e.all).has(r.href))return;let t=document.createElement(`link`);if(t.rel=i?`stylesheet`:Q,i||(t.as=`script`),t.crossOrigin=``,t.href=r.href,a&&t.setAttribute(`nonce`,a),document.head.appendChild(t),i)return new Promise((e,n)=>{let i=a=>{t.removeEventListener(`load`,i),t.removeEventListener(`error`,i),a.type===`error`?n(Error(`Unable to preload CSS for ${r}`)):e(a)};t.addEventListener(`load`,i),t.addEventListener(`error`,i)})})}).filter(e=>e!==void 0))}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)})},qf=(0,T.lazy)(()=>Kf(()=>import(`./RichTextEditor-1oGZgu61.js`),__vite__mapDeps([0,1,2])));function Jf({name:e,error:t}){let n=S({error:t});return(0,j.jsx)(c,{...n,label:e,error:t,children:(0,j.jsx)(`div`,{role:`status`,"aria-label":`Loading ${e} editor`,className:`h-52 animate-pulse rounded-control border border-field-line bg-field motion-reduce:animate-none`})})}function Yf(e){return(0,j.jsx)(T.Suspense,{fallback:(0,j.jsx)(Jf,{name:e.name,error:e.error}),children:(0,j.jsx)(qf,{...e})})}var Xf=100,Zf=/\.(jpe?g|png|gif|webp)$/i,Qf=e=>e.slice(0,Xf),$f=e=>Array.isArray(e)?e:e?[e]:[];function ep(e){let{body:t}=new DOMParser().parseFromString(e,`text/html`);return t.querySelectorAll(`script, style`).forEach(e=>e.remove()),t.textContent??``}function $({value:e}){let t=Tf(e);return t===e?(0,j.jsx)(`span`,{children:e}):(0,j.jsx)(f,{content:e,children:(0,j.jsx)(`span`,{tabIndex:0,children:t})})}function tp(e){let t=z();return ks({queryKey:tf.fileToken,queryFn:({signal:e})=>t.files.token({signal:e}),staleTime:12e4,enabled:!!e.protected}).data}function np({field:e,names:t,record:n}){let r=z(),i=tp(e);return e.protected&&i===void 0?null:(0,j.jsx)(`span`,{className:`flex gap-1`,children:t.map(e=>Zf.test(e)?(0,j.jsx)(`img`,{alt:e,width:32,height:32,src:r.files.url(n,e,{thumb:`100x100`,token:i})},e):(0,j.jsx)(`span`,{children:e},e))})}function rp(e,t,n){return(e?.fields??[]).filter(e=>e.presentable).map(e=>t?.[e.name]).filter(e=>e!=null&&e!==``).join(` `)||n}function ip(e,t){let n=e.expand?.[t];return new Map($f(n).map(e=>[e.id,e]))}function ap({field:e,value:t,record:n}){let r=af().data?.find(t=>t.id===e.collectionId),i=ip(n,e.name),a=Qf($f(t).map(e=>rp(r,i.get(e),String(e))).join(`, `));return(0,j.jsx)(`span`,{className:`block truncate`,title:a,children:a})}function op({field:e,value:t,record:n}){if(t==null||t===``)return null;switch(e.type){case`bool`:return t?`Yes`:`No`;case`date`:case`autodate`:return(0,j.jsx)($,{value:String(t)});case`editor`:return Qf(ep(String(t)));case`json`:return Qf(JSON.stringify(t)??``);case`select`:return Qf($f(t).join(`, `));case`geoPoint`:{let{lon:e,lat:n}=t;return`${e}, ${n}`}case`password`:return`******`;case`relation`:return(0,j.jsx)(ap,{field:e,value:t,record:n});case`file`:return(0,j.jsx)(np,{field:e,names:$f(t).map(String),record:n});default:return Qf(String(t))}}function sp({name:e,url:t,onClose:n}){return(0,j.jsx)(Ol,{open:!0,title:e,onClose:n,children:(0,j.jsx)(`img`,{src:t,alt:e,className:`mx-auto max-h-[70vh]`})})}function cp({field:e,name:t,value:n,record:r,error:i,disabled:a,onChange:o}){let s=z(),c=tp(e),[l,u]=(0,T.useState)(null),[d,f]=(0,T.useState)(0),p=jf(e),m=r?$f(r[e.name]).map(String):[],h=m.filter(e=>!n.removed.includes(e)).length+n.added.length,g=p&&h>=Number(e.maxSelect),_=!!e.protected&&c===void 0,v=(e,t)=>s.files.url(r??{},e,{thumb:t,token:c}),y=e=>o({...n,removed:n.removed.includes(e)?n.removed.filter(t=>t!==e):[...n.removed,e]});return(0,j.jsxs)(`fieldset`,{className:`flex flex-col gap-2`,children:[(0,j.jsx)(`legend`,{className:`text-sm font-medium`,children:t}),(0,j.jsxs)(`ul`,{className:`flex flex-col gap-2`,children:[m.map(e=>{let t=n.removed.includes(e);return(0,j.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,j.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center gap-2 ${t?`line-through opacity-50`:``}`,children:[!_&&Zf.test(e)&&(0,j.jsx)(`button`,{type:`button`,"aria-label":`Preview ${e}`,onClick:()=>u(e),children:(0,j.jsx)(`img`,{src:v(e,`100x100`),alt:e,width:48,height:48})}),_||Zf.test(e)?(0,j.jsx)(`span`,{className:`min-w-0 truncate`,title:e,children:e}):(0,j.jsx)(`a`,{href:v(e),target:`_blank`,rel:`noopener noreferrer`,className:`min-w-0 truncate`,title:e,children:e})]}),(0,j.jsx)(w,{"aria-label":`${t?`Restore`:`Remove`} ${e}`,disabled:a,onClick:()=>y(e),children:t?`Restore`:`Remove`})]},e)}),n.added.map((e,t)=>(0,j.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,title:e.name,children:e.name}),(0,j.jsx)(w,{"aria-label":`Remove new ${e.name}`,disabled:a,onClick:()=>o({...n,added:n.added.filter((e,n)=>n!==t)}),children:`Remove`})]},`${e.name}-${t}`))]}),(0,j.jsx)(`div`,{className:`[&_label]:sr-only`,children:(0,j.jsx)(Rl,{label:`Add files`,multiple:p,disabled:a||g,error:i,onChange:e=>{e.length!==0&&(o({...n,added:p?[...n.added,...e]:[e[0]]}),f(e=>e+1))}},d)}),l&&(0,j.jsx)(sp,{name:l,url:v(l),onClose:()=>u(null)})]})}var lp=[`=`,`~`,`>`,`<`,`(`,`)`,`&`,`|`];function up(e,t){let n=e.trim();if(!n||t.length===0||lp.some(e=>n.includes(e)))return n;let r=`"${(Number.isNaN(Number(n))&&n!==`true`&&n!==`false`?n.replace(/^["'`]|["'`]$/g,``):n).replaceAll(`\\`,`\\\\`).replaceAll(`"`,`\\"`)}"`;return t.map(e=>`${e}?~${r}`).join(`||`)}function dp({title:e,target:t,selected:n,known:r,maxSelect:i,onClose:a,onSelect:o}){let s=z(),[c,l]=(0,T.useState)(``),[u,d]=(0,T.useState)(``),[f,p]=(0,T.useState)(()=>new Map(n.map(e=>[e,r.get(e)??{id:e}]))),m=t.fields.filter(e=>!e.hidden&&e.type!==`password`).map(e=>e.name),h=js({queryKey:[`records`,t.id,`picker`,u],initialPageParam:1,queryFn:({pageParam:e,signal:n})=>s.records(t.name).findMany({page:e,perPage:40,filter:up(u,m),sort:`-@rowid`},{signal:n}),getNextPageParam:e=>e.page<e.totalPages?e.page+1:void 0}),g=(h.data?.pages??[]).flatMap(e=>e.items),_=i<=1,v=f.size>=i,y=e=>p(t=>{if(_)return new Map([[e.id,e]]);let n=new Map(t);return n.delete(e.id)||n.set(e.id,e),n});return(0,j.jsx)(Ol,{open:!0,title:e,onClose:a,footer:(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(w,{onClick:a,children:`Cancel`}),(0,j.jsx)(w,{variant:`primary`,onClick:()=>o([...f.values()]),children:`Select`})]}),children:(0,j.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,j.jsx)(kl,{label:`Search`,value:c,onChange:e=>l(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),d(c.trim()))}}),h.isError&&(0,j.jsx)(`p`,{role:`alert`,children:J(h.error)}),h.isPending&&(0,j.jsx)(`p`,{role:`status`,className:`text-sm text-muted`,children:`Loading...`}),h.isSuccess&&g.length===0&&(0,j.jsx)(`p`,{className:`text-sm text-muted`,children:u?`No records match the search.`:`No records yet.`}),(0,j.jsx)(`ul`,{className:`flex flex-col gap-1`,children:g.map(e=>{let n=e.id,r=rp(t,e,n),i=f.has(n);return(0,j.jsx)(`li`,{children:(0,j.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,j.jsx)(`input`,{type:_?`radio`:`checkbox`,name:`picker`,checked:i,disabled:!_&&v&&!i,onChange:()=>y(e)}),r]})},n)})}),h.hasNextPage&&(0,j.jsx)(w,{loading:h.isFetchingNextPage,onClick:()=>void h.fetchNextPage(),children:`Load more`})]})})}function fp({field:e,name:t,value:n,record:r,error:i,disabled:a,onChange:o}){let s=af().data?.find(t=>t.id===e.collectionId),c=jf(e),l=Array.isArray(n)?n:n?[n]:[],[u,d]=(0,T.useState)(()=>r?ip(r,e.name):new Map),[f,p]=(0,T.useState)(!1),m=(0,T.useId)(),h=e=>o(c?e:e[0]??``);return(0,j.jsxs)(`fieldset`,{"aria-invalid":i?!0:void 0,"aria-describedby":i?m:void 0,className:`flex flex-col gap-2`,children:[(0,j.jsx)(`legend`,{className:`text-sm font-medium`,children:t}),(0,j.jsx)(`ul`,{className:`flex flex-wrap gap-2`,children:l.map(e=>{let t=rp(s,u.get(e),e);return(0,j.jsxs)(`li`,{className:`flex items-center gap-1 rounded-control border border-line bg-field py-0.5 pl-2.5 pr-1 text-sm`,children:[(0,j.jsx)(`span`,{children:t}),(0,j.jsx)(`button`,{type:`button`,disabled:a,"aria-label":`Remove ${t}`,onClick:()=>h(l.filter(t=>t!==e)),className:`inline-flex size-5 items-center justify-center rounded-control text-muted hover:bg-hover hover:text-text focus-visible:outline-2 focus-visible:outline-focus`,children:(0,j.jsx)(R,{size:13,strokeWidth:1.75,"aria-hidden":!0})})]},e)})}),(0,j.jsx)(w,{className:`self-start`,disabled:a||!s,onClick:()=>p(!0),children:`Choose records`}),i&&(0,j.jsx)(`p`,{id:m,className:`text-xs text-danger-text`,children:i}),f&&s&&(0,j.jsx)(dp,{title:`Choose ${t}`,target:s,selected:l,known:u,maxSelect:c?Number(e.maxSelect):1,onClose:()=>p(!1),onSelect:e=>{d(t=>{let n=new Map(t);return e.forEach(e=>n.set(e.id,e)),n}),h(e.map(e=>e.id)),p(!1)}})]})}function pp({name:e,value:t,error:n,disabled:r,onChange:i}){let a=(0,T.useId)(),o={"aria-invalid":n?!0:void 0,"aria-describedby":n?a:void 0};return(0,j.jsxs)(`fieldset`,{className:`flex flex-col gap-2`,children:[(0,j.jsx)(`legend`,{className:`text-sm font-medium`,children:e}),(0,j.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,j.jsx)(zl,{label:`Longitude`,min:-180,max:180,step:`any`,value:t.lon,disabled:r,...o,onChange:e=>i({...t,lon:e.target.value})}),(0,j.jsx)(zl,{label:`Latitude`,min:-90,max:90,step:`any`,value:t.lat,disabled:r,...o,onChange:e=>i({...t,lat:e.target.value})})]}),n&&(0,j.jsx)(`p`,{id:a,className:`text-xs text-danger-text`,children:n})]})}function mp({name:e,value:t,error:n,disabled:r,onChange:i}){return(0,j.jsx)(m,{label:e,language:`json`,value:t,error:n,disabled:r,onChange:i})}function hp({name:e,options:t,multiple:n,value:r,error:i,disabled:a,onChange:o}){let s=(0,T.useId)();if(!n)return(0,j.jsxs)(Vl,{label:e,value:r,error:i,disabled:a,onChange:e=>o(e.target.value),children:[(0,j.jsx)(`option`,{value:``}),t.map(e=>(0,j.jsx)(`option`,{value:e,children:e},e))]});let c=r;return(0,j.jsxs)(`fieldset`,{"aria-invalid":i?!0:void 0,"aria-describedby":i?s:void 0,className:`flex flex-col gap-1`,children:[(0,j.jsx)(`legend`,{className:`text-sm font-medium`,children:e}),t.map(e=>(0,j.jsx)(Ps,{label:e,checked:c.includes(e),disabled:a,onChange:n=>o(n.target.checked?t.filter(t=>t===e||c.includes(t)):c.filter(t=>t!==e))},e)),i&&(0,j.jsx)(`p`,{id:s,className:`text-xs text-danger-text`,children:i})]})}function gp({field:e,value:t,record:n,disabled:r,localError:i,onChange:a}){let o=Y(e.name)??i,s=e.name,c=t;switch(e.type){case`text`:case`email`:case`url`:return(0,j.jsx)(kl,{label:s,type:e.type===`text`?`text`:e.type,hint:e.name===`id`&&e.primaryKey?`Leave empty to generate`:void 0,value:c,error:o,disabled:r,onChange:e=>a(e.target.value)});case`number`:return(0,j.jsx)(zl,{label:s,step:e.onlyInt?1:`any`,value:c,error:o,disabled:r,onChange:e=>a(e.target.value)});case`bool`:return(0,j.jsx)(Ps,{label:s,checked:t,error:o,disabled:r,onChange:e=>a(e.target.checked)});case`date`:return(0,j.jsx)(Vf,{name:s,value:c,error:o,disabled:r,onChange:a});case`select`:return(0,j.jsx)(hp,{name:s,options:e.values??[],multiple:jf(e),value:t,error:o,disabled:r,onChange:a});case`json`:return(0,j.jsx)(mp,{name:s,value:c,error:o,disabled:r,onChange:a});case`editor`:return(0,j.jsx)(Yf,{name:s,value:c,error:o,disabled:r,onChange:a});case`geoPoint`:return(0,j.jsx)(pp,{name:s,value:t,error:o,disabled:r,onChange:a});case`file`:return(0,j.jsx)(cp,{field:e,name:s,value:t,record:n,error:o,disabled:r,onChange:a});case`relation`:return(0,j.jsx)(fp,{field:e,name:s,value:t,record:n,error:o,disabled:r,onChange:a});default:return null}}var _p=e=>e.type!==`password`;function vp({isNew:e,password:t,confirm:n,onChange:r}){let[i,a]=(0,T.useState)(e),o=Y(`password`),s=Y(`passwordConfirm`);return(0,j.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[!e&&(0,j.jsx)(Ps,{label:`Change password`,checked:i,onChange:e=>{a(e.target.checked),e.target.checked||r(``,``)}}),i&&(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(kl,{label:`Password`,type:`password`,autoComplete:`new-password`,value:t,error:o,onChange:e=>r(e.target.value,n)}),(0,j.jsx)(kl,{label:`Confirm password`,type:`password`,autoComplete:`new-password`,value:n,error:s,onChange:e=>r(t,e.target.value)})]})]})}var yp=[`autodate`,`file`,`password`];function bp(e,t){let n={...t,id:``};for(let t of Af(e))yp.includes(t.type)&&delete n[t.name];return n}function xp({collection:e,recordId:t,prefill:n,onClose:r,onDuplicate:i}){let a=z(),o=t===`new`,s=a.records(e.name),c=ks({queryKey:[`records`,e.id,{id:t}],queryFn:({signal:n})=>s.findOne(t,{expand:Mf(e)},{signal:n}),enabled:!o}),l=e.type===`view`,u=o?`New record`:l?`Record`:`Edit record`,d=null;return!o&&c.isError?d=(0,j.jsx)(`p`,{role:`alert`,children:J(c.error)}):!o&&!c.data&&(d=(0,j.jsx)(`p`,{children:`Loading...`})),d?(0,j.jsx)(Ol,{open:!0,variant:`side`,title:u,onClose:r,children:d}):(0,j.jsx)(Sp,{collection:e,title:u,isNew:o,readOnly:l,record:o?n:c.data,onClose:r,onDuplicate:i})}function Sp({collection:e,title:t,isNew:n,readOnly:r,record:i,onClose:a,onDuplicate:o}){let s=z(),c=oo(),l=Br(),u=Ml(),d=Ql(),f=(0,T.useId)(),p=If(e,i),[m,h]=(0,T.useState)(null),[g,_]=(0,T.useState)({}),v=e.type===`auth`,y=s.records(e.name),b=e.name===`_superusers`&&!!i&&i.id===s.authStore.record?.id,x=()=>{hu({client:s,queryClient:c}),l({to:`/login`})},S=async t=>{let r;try{r=Bf(e,t,n?void 0:i)}catch(e){if(!(e instanceof Of))throw e;h(null),_({[e.field]:`Invalid JSON.`});return}_({}),h(null);try{if(n?await y.create(r):await y.update(i.id,r),b&&t.password){d.success(`Record saved.`),x();return}await c.invalidateQueries({queryKey:[`records`,e.id]}),d.success(`Record saved.`),a()}catch(e){h(e)}},C=Df(e,i??{id:``});(0,T.useEffect)(()=>{if(!m&&Object.keys(g).length===0)return;let e=document.getElementById(f)?.querySelector(`[aria-invalid="true"]`);(e?.matches(`input, select, textarea, button`)?e:e?.querySelector(`input, select, textarea, button`))?.focus()},[m,g,f]);let ee=Ed({defaultValues:p,onSubmit:({value:e})=>S(e)}),te=async()=>JSON.stringify(ee.state.values)===JSON.stringify(p)||await u({title:`Discard unsaved changes?`,message:`Your edits to this record will be lost.`,confirmLabel:`Discard`,cancelLabel:`Keep editing`,danger:!0}),ne=async()=>{await te()&&a()},re=async()=>{if(await u({title:`Delete record`,message:`Delete record ${i.id}? This cannot be undone.`,confirmLabel:`Delete`,danger:!0}))try{if(await y.delete(i.id),b){d.success(`Record deleted.`),x();return}a(),d.success(`Record deleted.`),await c.invalidateQueries({queryKey:[`records`,e.id],predicate:e=>e.queryKey[2]?.id!==i.id})}catch(e){d.error(J(e))}},ie=Af(e).filter(e=>e.type===`password`?!r:!e.hidden&&e.type!==`autodate`&&_p(e)&&(n||e.name!==`id`)),ae=[];i&&!n&&(r||ae.push({key:`duplicate`,label:`Duplicate`}),ae.push({key:`copy`,label:`Copy JSON`}),v&&ae.push(...C.items),r||ae.push({separator:!0},{key:`delete`,label:`Delete`,danger:!0}));let E=t=>{t===`duplicate`?te().then(t=>t&&o(bp(e,i))):t===`copy`?navigator.clipboard.writeText(JSON.stringify(i,null,2)).then(()=>d.success(`Copied.`),()=>d.error(`Could not copy.`)):t===`delete`?re():C.run(t)},oe=n?[]:Af(e).filter(e=>e.type===`autodate`&&!e.hidden&&i?.[e.name]);return(0,j.jsx)(jd,{error:m,children:(0,j.jsxs)(Ol,{open:!0,variant:`side`,title:t,onClose:()=>void ne(),footer:(0,j.jsxs)(j.Fragment,{children:[i&&!n&&(0,j.jsx)(`div`,{className:`mr-auto`,children:(0,j.jsx)(au,{trigger:(0,j.jsx)(w,{icon:(0,j.jsx)(fc,{size:15,"aria-hidden":!0}),children:`More actions`}),placement:`top-start`,items:ae,onAction:E})}),(0,j.jsx)(w,{onClick:()=>void ne(),children:r?`Close`:`Cancel`}),!r&&(0,j.jsx)(ee.Subscribe,{selector:e=>e.isSubmitting,children:e=>(0,j.jsx)(w,{type:`submit`,form:f,variant:`primary`,loading:e,children:n?`Create`:`Save changes`})})]}),children:[(0,j.jsxs)(`form`,{id:f,noValidate:!0,onSubmit:e=>{e.preventDefault(),ee.handleSubmit()},className:`flex flex-col gap-4`,children:[(0,j.jsx)(`div`,{className:`flex flex-col gap-4`,children:ie.map(e=>e.type===`password`?v&&(0,j.jsx)(ee.Subscribe,{selector:e=>[e.values.password,e.values.passwordConfirm],children:([e,t])=>(0,j.jsx)(vp,{isNew:n,password:e,confirm:t,onChange:(e,t)=>{ee.setFieldValue(`password`,e),ee.setFieldValue(`passwordConfirm`,t)}})},e.name):(0,j.jsx)(ee.Field,{name:e.name,children:t=>(0,j.jsx)(gp,{field:e,value:t.state.value,record:i,disabled:r,localError:g[e.name],onChange:t.handleChange})},e.name))}),!n&&(0,j.jsxs)(`dl`,{className:`flex flex-col gap-1 border-t border-line pt-3 text-xs text-muted`,children:[(0,j.jsxs)(`div`,{className:`flex gap-2`,children:[(0,j.jsx)(`dt`,{children:`id`}),(0,j.jsx)(`dd`,{className:`font-mono`,children:i.id})]}),oe.map(e=>(0,j.jsxs)(`div`,{className:`flex gap-2`,children:[(0,j.jsx)(`dt`,{children:e.name}),(0,j.jsx)(`dd`,{children:Tf(String(i[e.name]))})]},e.name))]}),(0,j.jsx)(X,{})]}),C.dialog]})})}var Cp=`[&_tr>:nth-child(1)]:sticky [&_tr>:nth-child(1)]:left-0 [&_tr>:nth-child(1)]:z-[5] [&_thead_tr>:nth-child(1)]:z-20`,wp=`[&_tr>:nth-child(2)]:sticky [&_tr>:nth-child(2)]:left-10 [&_tr>:nth-child(2)]:z-[5] [&_thead_tr>:nth-child(2)]:z-20`,Tp=`cursor-pointer bg-surface [&>td]:bg-surface [&:not([data-selected]):hover>td]:shadow-[inset_0_0_0_100vmax_var(--hb-hover)] data-[selected]:[&>td]:shadow-[inset_0_0_0_100vmax_var(--hb-accent-soft)]`;function Ep(e,t){return e===t?`asc`:e===`-${t}`?`desc`:null}function Dp({caption:e,fields:t,rows:n,sort:r,selected:i,onSort:a,onSelect:o,onSelectAll:s,onOpen:c,selectable:l=!0}){let[u,d]=(0,T.useState)({left:!1,right:!1}),f=(0,T.useRef)(null),p=e=>{let t=e.scrollLeft>0,n=e.scrollLeft+e.clientWidth<e.scrollWidth-1;d(e=>e.left===t&&e.right===n?e:{left:t,right:n})};(0,T.useLayoutEffect)(()=>{let e=f.current?.querySelector(`.overflow-auto`);if(!e||(p(e),typeof ResizeObserver>`u`))return;let t=new ResizeObserver(()=>p(e));return t.observe(e),e.firstElementChild&&t.observe(e.firstElementChild),()=>t.disconnect()},[t.length,n.length]);let m=t[0]?.name===`id`,h=[l?Cp:``,m?l?wp:Cp:``].join(` `),g=e=>{let t=Ep(r,e);return t===null?e:t===`asc`?`-${e}`:``},_=n.length>0&&n.every(e=>i.has(e.id)),v=e=>String(e.title??e.name??e.id);return(0,j.jsxs)(`div`,{ref:f,onScrollCapture:e=>p(e.target),className:`relative ${h}`,children:[(0,j.jsx)(Op,{side:`left`,show:u.left}),(0,j.jsx)(Op,{side:`right`,show:u.right}),(0,j.jsxs)(Hl,{caption:e,stickyHeader:!0,children:[(0,j.jsx)(`thead`,{children:(0,j.jsxs)(`tr`,{children:[l&&(0,j.jsx)(`th`,{scope:`col`,className:`w-10 border-b border-line px-3 py-2`,children:(0,j.jsx)(Ps,{hideLabel:!0,label:`Select all`,checked:_,onChange:e=>s(e.target.checked)})}),t.map(e=>(0,j.jsx)(Wl,{sort:Ep(r,e.name),onSort:()=>a(g(e.name)),children:e.name},e.name))]})}),(0,j.jsx)(`tbody`,{children:n.map(e=>(0,j.jsxs)(`tr`,{tabIndex:0,"data-selected":i.has(e.id)||void 0,className:Tp,onClick:()=>c(e.id),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&t.target===t.currentTarget&&(t.preventDefault(),c(e.id))},children:[l&&(0,j.jsx)(Gl,{children:(0,j.jsx)(Ps,{hideLabel:!0,label:`Select ${v(e)}`,checked:i.has(e.id),onClick:e=>e.stopPropagation(),onChange:()=>o(e.id)})}),t.map(t=>(0,j.jsx)(Gl,{children:op({field:t,value:e[t.name],record:e})},t.name))]},e.id))})]})]})}function Op({side:e,show:t}){return(0,j.jsx)(`div`,{"aria-hidden":!0,"data-edge":e,className:`pointer-events-none absolute inset-y-0 z-30 w-3 transition-opacity motion-reduce:transition-none ${e===`left`?`left-0 bg-gradient-to-r`:`right-0 bg-gradient-to-l`} from-black/15 to-transparent ${t?`opacity-100`:`opacity-0`}`})}var kp=[`=`,`!=`,`>`,`>=`,`<`,`<=`,`~`,`!~`],Ap=[`@now`,`@yesterday`,`@tomorrow`,`@second`,`@minute`,`@hour`,`@day`,`@month`,`@weekday`,`@year`,`@todayStart`,`@todayEnd`,`@monthStart`,`@monthEnd`,`@yearStart`,`@yearEnd`],jp=[`id`,`collectionId`,`collectionName`],Mp=/[\w@.:+-]+$/,Np=/[?!=<>~]+$/,Pp=/[&|]+$/,Fp=/\s+|(["'`])(?:\\.|(?!\1)[^\\])*(?:\1|$)|&&|\|\||\??(?:!=|!~|>=|<=|=|>|<|~)|[\w@.:+-]+|[(),]|[^]/y,Ip={fields:[{name:`id`,type:`text`},{name:`created`,type:`autodate`},{name:`level`,type:`number`},{name:`message`,type:`text`},{name:`data.status`,type:`number`},{name:`data.method`,type:`text`},{name:`data.url`,type:`text`},{name:`data.auth`,type:`text`},{name:`data.userIP`,type:`text`},{name:`data.execTime`,type:`number`}]},Lp=(e,t,n=`variable`)=>({label:e,detail:t,type:n});function Rp(e){let t=[];Fp.lastIndex=0;let n;for(;Fp.lastIndex<e.length&&(n=Fp.exec(e));){let e=n[0];if(!/^\s/.test(e)){if(n[1]){if(e.length<2||!e.endsWith(n[1]))return null;t.push({kind:`word`})}else e===`&&`||e===`||`?t.push({kind:`logic`}):e===`(`?t.push({kind:`open`}):e===`)`?t.push({kind:`close`}):e===`,`?t.push({kind:`comma`}):/^\??[!=<>~]/.test(e)?t.push({kind:`op`}):/^[\w@.:+-]/.test(e)&&t.push({kind:`word`})}}return t}function zp(e){let t=[],n=`operand`,r=!1,i=e=>{n=t.at(-1)?.fn?`arg`:e?`logic`:`operator`};return e.forEach((a,o)=>{if(a.kind===`word`)e[o+1]?.kind!==`open`&&i(r);else if(a.kind===`op`)n=`operand`,r=!0;else if(a.kind===`logic`)n=`operand`,r=!1;else if(a.kind===`open`){let i=e[o-1]?.kind===`word`;t.push({fn:i,right:r}),n=`operand`,r=i}else if(a.kind===`close`){let e=t.pop();e?.fn?(r=e.right,i(e.right)):n=`logic`}else n=`operand`,r=!0}),{state:n,depth:t.length}}var Bp=(e,t)=>e.type!==`password`&&(t||!e.hidden);function Vp(e,t){let n=!!e.request,r=e.collections??[],i=(e,t)=>t.fields.filter(e=>Bp(e,!1)).map(t=>Lp(`${e}.${t.name}`,t.type)),a=[];for(let t of e.fields){if(!Bp(t,n)||(a.push(Lp(t.name,t.type)),t.type!==`relation`))continue;let e=r.find(e=>e.id===t.collectionId);e&&a.push(...i(t.name,e))}for(let t of r)for(let n of t.fields){if(n.type!==`relation`||n.collectionId!==e.collectionId)continue;let r=`${t.name}_via_${n.name}`;a.push(Lp(r,`back-relation`),...i(r,t))}if(n){a.push(Lp(`@request.method`,`request`),Lp(`@request.context`,`request`),Lp(`@request.query.`,`request`),Lp(`@request.headers.`,`request`));for(let[e,t]of Hp(r))a.push(Lp(`@request.auth.${e}`,t));if(e.request.body)for(let t of e.fields)a.push(Lp(`@request.body.${t.name}`,t.type));let n=/^@collection\.(\w+)(?::\w+)?\./.exec(t),o=n&&r.find(e=>e.name===n[1]);if(n&&o)a.push(...i(n[0].slice(0,-1),o));else for(let e of r)a.push(Lp(`@collection.${e.name}.`,`collection`))}return a.push(...Ap.map(e=>Lp(e,`macro`)),Lp(`geoDistance(`,`function`,`function`),Lp(`strftime(`,`function`,`function`),Lp(`true`,`literal`,`keyword`),Lp(`false`,`literal`,`keyword`),Lp(`null`,`literal`,`keyword`),Lp(`""`,`literal`,`keyword`)),a}function Hp(e){let t=new Map(jp.map(e=>[e,`text`]));for(let n of e)if(n.type===`auth`)for(let e of n.fields)Bp(e,!1)&&t.set(e.name,e.type);return t}var Up=(e,t)=>e.find(e=>e.name===t)?.type;function Wp(e,t){let n=e.collections??[],r=e=>n.find(t=>t.name===e),i=Up(e.fields,t);if(i)return i;if(t.startsWith(`@request.body.`))return Up(e.fields,t.slice(14));if(t.startsWith(`@request.auth.`))return Hp(n).get(t.slice(14));let a=/^@collection\.(\w+)(?::\w+)?\.(.+)$/.exec(t),o=e.fields,s=t;if(a){let e=r(a[1]);if(!e)return;o=e.fields,s=a[2]}let c=s.split(`.`);for(let[e,t]of c.entries()){if(e===c.length-1)return Up(o,t);let i=/^(\w+)_via_\w+$/.exec(t),a=o.find(e=>e.name===t),s=i?r(i[1]):n.find(e=>e.id===a?.collectionId);if(!s)return;o=s.fields}}var Gp=[`select`,`relation`,`file`],Kp=[...jp,`email`,`emailVisibility`,`verified`];function qp(e,t){let n=t.slice(0,t.lastIndexOf(`:`)),r=Wp(e,n),i=r!==void 0&&Gp.includes(r)?[`length`,`each`,`lower`]:[`lower`],a=i;return n.startsWith(`@request.body.`)?a=[`isset`,`changed`,...i]:n.startsWith(`@request.auth.`)?Kp.includes(n.slice(14))&&(a=[`isset`,`lower`]):n.startsWith(`@request.`)&&(a=[`isset`,`lower`]),a.map(e=>Lp(e,`modifier`,`keyword`))}var Jp=()=>[...kp.map(e=>Lp(e,`operator`,`keyword`)),...kp.map(e=>Lp(`?${e}`,`operator`,`keyword`))],Yp=()=>[Lp(`&&`,`logic`,`keyword`),Lp(`||`,`logic`,`keyword`)];function Xp(e){return(t,n)=>{let r=t.slice(0,n);if(!Rp(r))return null;let i=Mp.exec(r)??Np.exec(r)??Pp.exec(r),a=i?.index??n,{state:o,depth:s}=zp(Rp(r.slice(0,a))),c=(e,t)=>({from:e,options:t}),l=i&&Mp.test(i[0])?i[0]:``;if(l)return o===`operand`?l.replace(/^@collection\.\w+(?::\w+)?\./,``).includes(`:`)&&!/^@collection\.\w+:\w*$/.test(l)?c(a+l.lastIndexOf(`:`)+1,qp(e,l)):c(a,Vp(e,l)):null;if(i&&Np.test(i[0]))return o===`operator`?c(a,Jp()):null;if(i&&Pp.test(i[0]))return o===`logic`?c(a,Yp()):null;if(o===`operand`)return c(n,Vp(e,``));if(o===`operator`)return c(n,Jp());let u=Lp(`)`,`logic`,`keyword`);return o===`arg`?c(n,[Lp(`,`,`separator`,`keyword`),u]):c(n,[...Yp(),...s?[u]:[]])}}function Zp(e){try{let t=JSON.parse(localStorage.getItem(e)??`[]`);return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}catch{return[]}}function Qp(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch{}}var $p=`hb_filter_history`;function em({filter:e,error:t,label:n=`Filter records`,placeholder:r=`e.g. title ~ "hello" && created > "2026-01-01"`,suggest:i,onSearch:a}){let[o,s]=(0,T.useState)(e),[c,l]=(0,T.useState)(e),[u,d]=(0,T.useState)(()=>Zp($p));e!==c&&(l(e),s(e));let f=e=>{if(e){let t=[e,...u.filter(t=>t!==e)].slice(0,10);d(t),Qp($p,t)}a(e)};return(0,j.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,j.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,j.jsx)(m,{label:n,hideLabel:!0,singleLine:!0,placeholder:r,suggest:i,value:o,error:t,onChange:s,onRun:()=>f(o.trim())})}),(0,j.jsx)(w,{disabled:!o&&!e,onClick:()=>{s(``),a(``)},children:`Clear`}),(0,j.jsx)(au,{trigger:(0,j.jsx)(w,{disabled:u.length===0,children:`Recent filters`}),items:u.map(e=>({key:e,label:e})),placement:`bottom-end`,onAction:e=>{s(e),f(e)}})]})}function tm(e){let t={};typeof e.filter==`string`&&e.filter&&(t.filter=e.filter),typeof e.sort==`string`&&e.sort&&(t.sort=e.sort),typeof e.record==`string`&&e.record&&(t.record=e.record);let n=Number(e.page);return Number.isInteger(n)&&n>=1&&(t.page=n),t}function nm({collection:e}){let t=z(),n=oo(),r=Ml(),i=Ql(),a=Z(),o=sf(),[s,c]=(0,T.useState)(!1),l=Br(),u=zr({strict:!1}),d=e.type===`view`,p=`hb_columns_${e.id}`,[m,h]=(0,T.useState)(()=>Zp(p)),[g,_]=(0,T.useState)(new Set),[v,y]=(0,T.useState)(),b=u.page??1,x=u.filter??``,S=u.sort??``,C=e.fields.filter(e=>!e.hidden),ee=C.filter(e=>!m.includes(e.name)),te=Mf(e),ne=C.filter(e=>e.type!==`password`).map(e=>e.name),re=af(),ie=Xp({collectionId:e.id,fields:C,collections:re.data}),ae={page:b,filter:x,sort:S},E=ks({queryKey:tf.records(e.id,ae),queryFn:({signal:n})=>t.records(e.name).findMany({page:b,perPage:40,filter:up(x,ne),sort:S||(d?``:`-@rowid`),expand:te},{signal:n}),placeholderData:e=>e}),oe=e=>l({to:`.`,search:t=>tm({...t,...e})}),se=e=>{let t=m.includes(e)?m.filter(t=>t!==e):[...m,e];h(t),Qp(p,t)},ce=e=>_(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n}),le=async()=>{let a=[...g];if(!await r({title:`Delete records`,message:`Delete ${a.length} selected record${a.length===1?``:`s`}? This cannot be undone.`,confirmLabel:`Delete`,danger:!0}))return;let o=await Promise.allSettled(a.map(n=>t.records(e.name).delete(n))),s=new Set(a.filter((e,t)=>o[t].status===`rejected`));if(s.size===0)i.success(`Records deleted.`);else{let e=a.length-s.size;i.error(`Deleted ${e} of ${a.length} records, ${s.size} failed.`)}_(s),await n.invalidateQueries({queryKey:[`records`,e.id]})},ue=()=>{y(void 0),oe({record:`new`})},de=E.data?.items??[];return(0,j.jsxs)(V,{width:`full`,crumbs:[{label:`Collections`,to:`/collections`},{label:e.name}],footer:E.data&&!E.isError?`Total: ${E.data.totalItems}`:void 0,actions:(0,j.jsxs)(j.Fragment,{children:[g.size>0&&(0,j.jsxs)(w,{variant:`danger`,onClick:le,children:[`Delete selected (`,g.size,`)`]}),(0,j.jsx)(w,{onClick:()=>c(!0),children:`API preview`}),(0,j.jsx)(bf,{names:C.map(e=>e.name),hidden:m,onToggle:se}),!d&&(0,j.jsx)(w,{variant:`primary`,onClick:ue,children:`New record`}),!o&&(0,j.jsx)(f,{content:`Edit ${e.name}`,children:(0,j.jsx)(w,{"aria-label":`Edit ${e.name}`,onClick:()=>a(e),icon:(0,j.jsx)(ol,{"aria-hidden":!0,size:15,strokeWidth:1.75})})})]}),children:[(0,j.jsx)(em,{filter:x,suggest:ie,error:E.error?Dd(E.error):void 0,onSearch:e=>{_(new Set),oe({filter:e,page:1})}}),E.isError?(0,j.jsx)(Ll,{title:`Could not load records`,children:x&&(0,j.jsx)(w,{onClick:()=>oe({filter:``,page:1}),children:`Clear filter`})}):E.data?de.length===0?x?(0,j.jsx)(Ll,{title:`No records match this filter`,icon:(0,j.jsx)(nl,{size:15,strokeWidth:1.75,"aria-hidden":!0})}):(0,j.jsx)(Ll,{title:`No records yet`,icon:(0,j.jsx)(Oc,{size:15,strokeWidth:1.75,"aria-hidden":!0}),children:!d&&(0,j.jsx)(w,{variant:`primary`,onClick:ue,children:`New record`})}):(0,j.jsx)(Dp,{caption:`${e.name} records`,fields:ee,rows:de,sort:S,selected:g,onSort:e=>{_(new Set),oe({sort:e,page:1})},selectable:!d,onSelect:ce,onSelectAll:e=>_(new Set(e?de.map(e=>e.id):[])),onOpen:e=>oe({record:e})}):(0,j.jsx)(`p`,{role:`status`,className:`text-sm text-muted`,children:`Loading...`}),s&&(0,j.jsx)(df,{collection:e,onClose:()=>c(!1)}),E.data&&!E.isError&&(0,j.jsx)(xf,{page:E.data.page,totalPages:E.data.totalPages,onPage:e=>{_(new Set),oe({page:e})}}),u.record&&(0,j.jsx)(xp,{collection:e,recordId:u.record,prefill:v,onClose:()=>oe({record:void 0}),onDuplicate:e=>{y(e),oe({record:`new`})}},u.record)]})}function rm({query:e}){return e.isError?(0,j.jsxs)(`div`,{role:`alert`,className:`flex items-center gap-3 rounded-control border border-danger/40 bg-danger/10 p-3 text-sm text-danger-text`,children:[(0,j.jsx)(`p`,{children:J(e.error)}),(0,j.jsx)(w,{onClick:()=>void e.refetch(),children:`Retry`})]}):(0,j.jsx)(`p`,{role:`status`,className:`text-sm text-muted`,children:`Loading...`})}function im({changes:e,onConfirm:t,onCancel:n}){let{renamedCollection:r,deletedFields:i,renamedFields:a,changedRules:o}=e;return(0,j.jsxs)(Ol,{open:!0,onClose:n,title:`Confirm changes`,footer:(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(w,{onClick:n,children:`Cancel`}),(0,j.jsx)(w,{variant:`primary`,onClick:t,children:`Confirm`})]}),children:[(0,j.jsx)(`p`,{className:`text-sm`,children:`Review these changes before saving.`}),(0,j.jsxs)(`ul`,{className:`mt-2 list-disc pl-5 text-sm`,children:[r&&(0,j.jsxs)(`li`,{children:[`Rename collection `,r[0],` to `,r[1]]}),i.map(e=>(0,j.jsxs)(`li`,{children:[`Delete field `,e]},`delete-${e}`)),a.map(([e,t])=>(0,j.jsxs)(`li`,{children:[`Rename field `,e,` to `,t]},`rename-${e}`)),o.length>0&&(0,j.jsxs)(`li`,{children:[`Change API rules: `,o.join(`, `)]})]}),i.length>0&&(0,j.jsx)(`p`,{className:`mt-2 text-sm text-danger-text`,children:`Deleted fields lose all their data.`})]})}var am=0,om=()=>`f${++am}`,sm=[{type:`text`,label:`Plain text`},{type:`editor`,label:`Rich editor`},{type:`number`,label:`Number`},{type:`bool`,label:`Bool`},{type:`email`,label:`Email`},{type:`url`,label:`URL`},{type:`date`,label:`Date`},{type:`autodate`,label:`Autodate`},{type:`select`,label:`Select`},{type:`file`,label:`File`},{type:`relation`,label:`Relation`},{type:`json`,label:`JSON`},{type:`geoPoint`,label:`Geo point`},{type:`password`,label:`Password`}],cm=()=>({exceptDomains:[],onlyDomains:[]}),lm={text:()=>({autogeneratePattern:``,max:0,min:0,pattern:``,primaryKey:!1}),number:()=>({max:null,min:null,onlyInt:!1}),bool:()=>({}),email:cm,url:cm,date:()=>({max:``,min:``}),autodate:()=>({onCreate:!1,onUpdate:!1}),select:()=>({maxSelect:0,values:[]}),json:()=>({maxSize:0}),relation:()=>({cascadeDelete:!1,collectionId:``,maxSelect:0,minSelect:0}),file:()=>({maxSelect:0,maxSize:0,mimeTypes:[],protected:!1,thumbs:[]}),editor:()=>({maxSize:0,convertURLs:!1}),geoPoint:()=>({}),password:()=>({cost:0,max:0,min:0,pattern:``})};function um(e){return sm.find(t=>t.type===e)?.label??e}function dm(e){return{_key:om(),name:``,type:e,system:!1,hidden:!1,presentable:!1,...e===`autodate`?{}:{help:``,required:!1},...lm[e]()}}var fm='`[^`]*`|"[^"]*"|\\[[^\\]]*\\]|\\w+',pm=RegExp(`^\\s*CREATE\\s+(UNIQUE\\s+)?INDEX\\s+(?:IF\\s+NOT\\s+EXISTS\\s+)?(?:(?:${fm})\\.)?(${fm})\\s+ON\\s+(${fm})\\s*\\(`,`i`),mm=RegExp(`^\\s*(${fm})`),hm=RegExp(`^\\s*(?:${fm})\\s*$`),gm=e=>"`"+e.replaceAll("`","``")+"`",_m=e=>/^[`"[]/.test(e)?e.slice(1,-1):e;function vm(){let e=crypto.getRandomValues(new Uint8Array(10));return`idx_`+Array.from(e,e=>`abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789`[e%62]).join(``)}function ym(e){let t=gm(e.name??vm()),n=e.columns.map(gm).join(`, `);return`CREATE ${e.unique?`UNIQUE `:``}INDEX ${t} ON ${gm(e.table)} (${n})`}function bm(e){let t=[],n=0,r=0;for(let i=0;i<e.length;i++){let a=e[i];if(a===`(`)n++;else if(a===`)`){if(n===0)return t.push(e.slice(r,i)),{parts:t,end:i+1};n--}else a===`,`&&n===0&&(t.push(e.slice(r,i)),r=i+1)}return null}function xm(e){let t=pm.exec(e);if(!t)return null;let n=e.slice(t[0].length),r=bm(n),i=r?.parts.map(e=>mm.exec(e)?.[1]);return!r||!i||i.some(e=>!e)?null:{name:_m(t[2]),unique:!!t[1],table:_m(t[3]),columns:i.map(e=>_m(e)),simple:r.parts.every(e=>hm.test(e))&&/^\s*;?\s*$/.test(n.slice(r.end))}}var Sm=[`listRule`,`viewRule`,`createRule`,`updateRule`,`deleteRule`,`authRule`,`manageRule`],Cm=RegExp(`\\bON\\s+(${fm})`,`i`),wm=RegExp(`(\\bINDEX\\s+(?:IF\\s+NOT\\s+EXISTS\\s+)?)(${fm})`,`i`),Tm=RegExp(`'(?:[^']|'')*'|${fm}`,`g`);function Em(e,t,n){let r=Cm.exec(e);if(!r)return e;let i=r.index+r[0].length,[a,o]=t;return(a!==o&&_m(r[1]).toLowerCase()===a.toLowerCase()?e.slice(0,i-r[1].length)+gm(o):e.slice(0,i))+e.slice(i).replace(Tm,(e,t,r)=>{if(e.startsWith(`'`))return e;let i=n.get(_m(e).toLowerCase()),a=/^\s*\(/.test(r.slice(t+e.length));return i===void 0||a?e:gm(i)})}var Dm={select:{maxSelect:1},relation:{maxSelect:1},file:{maxSelect:1},autodate:{onCreate:!0}};function Om(e){let t=structuredClone(e);return{...t,_originalName:e.name,fields:t.fields.map(e=>({...e,_key:om(),_original:e.name}))}}function km(e,t){return Om(t[e])}function Am(e){let t=Om(e);return{...t,id:``,name:`${e.name}_duplicate`,system:!1,fields:t.fields.map(({id:e,...t})=>t),indexes:t.indexes.map(e=>e.replace(wm,(e,t)=>t+gm(vm())))}}function jm(e,t){let n=new Set(e.map(e=>e.name.toLowerCase())),r=`field`;for(let e=2;n.has(r);e++)r=`field${e}`;return{...dm(t),...Dm[t],name:r}}function Mm(e,t){return{...e,name:t}}function Nm(e){return e.fields.filter(e=>!e._removed)}function Pm(e){let t=new Map;for(let n of e.fields)n._original!==void 0&&n._original!==n.name&&t.set(n._original.toLowerCase(),n.name);return e.indexes.map(n=>Em(n,[e._originalName,e.name],t))}function Fm(e,t){return{...e,_originalName:e.name,fields:e.fields.map(e=>({...e,_original:e.name})),indexes:t}}function Im(e){let{id:t,_originalName:n,created:r,updated:i,fields:a,...o}=e;return{...t?{id:t}:{},...o,indexes:Pm(e),...e.type===`view`?{}:{fields:Nm(e).map(({_key:e,_removed:t,_original:n,...r})=>r)}}}function Lm(e,t){let n=Nm(t),r=[],i=[];for(let t of e.fields){let e=n.find(e=>e.id&&e.id===t.id);e?e.name!==t.name&&r.push([String(t.name),e.name]):i.push(String(t.name))}return{renamedCollection:e.name===t.name?null:[e.name,t.name],deletedFields:i,renamedFields:r,changedRules:Sm.filter(n=>(e[n]??null)!==(t[n]??null))}}function Rm(e){return!!e.renamedCollection||e.deletedFields.length>0||e.renamedFields.length>0||e.changedRules.length>0}function zm(e,t){return Ed({defaultValues:e,onSubmitMeta:{confirmed:!1},onSubmit:({value:e,meta:n})=>t(e,n.confirmed)})}var Bm=`rounded-full border border-line bg-hover px-2.5 py-0.5 text-xs text-text hover:border-accent hover:text-accent-text focus-visible:outline-2 focus-visible:outline-focus`,Vm={Images:[`image/jpeg`,`image/png`,`image/svg+xml`,`image/gif`,`image/webp`],Documents:[`application/pdf`,`application/msword`,`application/vnd.openxmlformats-officedocument.wordprocessingml.document`,`application/vnd.ms-excel`,`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`,`text/plain`,`text/csv`],Videos:[`video/mp4`,`video/webm`,`video/quicktime`,`video/x-ms-wmv`],Archives:[`application/zip`,`application/x-7z-compressed`,`application/x-rar-compressed`,`application/gzip`]},Hm=(e,t)=>Y(`${e.errorPath}.${t}`);function Um({p:e,k:t,label:n,hint:r}){return(0,j.jsx)(kl,{label:n,hint:r,value:String(e.field[t]??``),error:Hm(e,t),onChange:n=>e.onChange({[t]:n.target.value})})}function Wm({p:e,k:t,label:n,nullable:r}){let i=e.field[t];return(0,j.jsx)(zl,{label:n,step:r?`any`:void 0,value:typeof i==`number`?i:``,error:Hm(e,t),onChange:n=>e.onChange({[t]:n.target.value===``?r?null:0:Number(n.target.value)})})}function Gm({p:e,k:t,label:n,disabled:r}){return(0,j.jsx)(Ps,{label:n,checked:!!e.field[t],disabled:r,error:Hm(e,t),onChange:n=>e.onChange({[t]:n.target.checked})})}function Km({p:e,k:t,label:n,hint:r,disabled:i,lines:a}){let o=e.field[t]??[],s=a?`
|
|
17
|
+
`:`, `,c=e=>e.split(a?`
|
|
18
|
+
`:`,`).map(e=>e.trim()).filter(Boolean),[l,u]=(0,T.useState)(o.join(s)),d=o.join(`
|
|
19
|
+
`);(0,T.useEffect)(()=>{u(e=>c(e).join(`
|
|
20
|
+
`)===d?e:o.join(s))},[d]);let f=Md(`${e.errorPath}.${t}.`),p=Hm(e,t)??(f.map(([e,t])=>{let n=Number(e.slice(e.lastIndexOf(`.`)+1));return`${o[n]??n}: ${t}`}).join(` `)||void 0),h=n=>{u(n),e.onChange({[t]:c(n)})};return a?(0,j.jsx)(m,{label:n,hint:r,rows:4,value:l,error:p,onChange:h}):(0,j.jsx)(kl,{label:n,hint:r,value:l,disabled:i,error:p,onChange:e=>h(e.target.value)})}function qm({p:e,many:t}){let[n,r]=(0,T.useState)(Number(e.field.maxSelect)>1);return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(Ps,{label:`Allow multiple`,checked:n,onChange:n=>{r(n.target.checked),e.onChange({maxSelect:n.target.checked?t():1})}}),n&&(0,j.jsx)(Wm,{p:e,k:`maxSelect`,label:`Max select`})]})}function Jm({p:e}){let t=e.field.onlyDomains??[],n=e.field.exceptDomains??[];return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(Km,{p:e,k:`onlyDomains`,label:`Only domains`,hint:`Comma separated.`,disabled:n.length>0}),(0,j.jsx)(Km,{p:e,k:`exceptDomains`,label:`Except domains`,hint:`Comma separated.`,disabled:t.length>0})]})}function Ym({p:e}){let t=af();return(0,j.jsxs)(Vl,{label:`Collection`,value:String(e.field.collectionId??``),disabled:!!e.field.id,error:Hm(e,`collectionId`),onChange:t=>e.onChange({collectionId:t.target.value}),children:[(0,j.jsx)(`option`,{value:``,disabled:!0,children:`Choose a collection`}),(t.data??[]).filter(e=>e.type!==`view`).map(e=>(0,j.jsx)(`option`,{value:e.id,children:e.name},e.id))]})}function Xm({p:e}){let t=e.field.mimeTypes??[];return(0,j.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,j.jsx)(Km,{p:e,k:`mimeTypes`,label:`MIME types`,hint:`Comma separated.`}),(0,j.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:Object.entries(Vm).map(([n,r])=>(0,j.jsx)(`button`,{type:`button`,className:Bm,onClick:()=>e.onChange({mimeTypes:[...t,...r.filter(e=>!t.includes(e))]}),children:n},n))})]})}function Zm({p:e}){switch(e.field.type){case`text`:return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(Wm,{p:e,k:`min`,label:`Min length`}),(0,j.jsx)(Wm,{p:e,k:`max`,label:`Max length`}),(0,j.jsx)(Um,{p:e,k:`pattern`,label:`Pattern`}),(0,j.jsx)(Um,{p:e,k:`autogeneratePattern`,label:`Autogenerate pattern`}),!!e.field.primaryKey&&(0,j.jsx)(Gm,{p:e,k:`primaryKey`,label:`Primary key`,disabled:!0})]});case`number`:return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(Wm,{p:e,k:`min`,label:`Min`,nullable:!0}),(0,j.jsx)(Wm,{p:e,k:`max`,label:`Max`,nullable:!0}),(0,j.jsx)(Gm,{p:e,k:`onlyInt`,label:`Integers only`})]});case`email`:case`url`:return(0,j.jsx)(Jm,{p:e});case`date`:return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(Um,{p:e,k:`min`,label:`Min date`,hint:`YYYY-MM-DD HH:mm:ss.SSSZ (UTC)`}),(0,j.jsx)(Um,{p:e,k:`max`,label:`Max date`,hint:`YYYY-MM-DD HH:mm:ss.SSSZ (UTC)`})]});case`autodate`:return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(Gm,{p:e,k:`onCreate`,label:`On create`}),(0,j.jsx)(Gm,{p:e,k:`onUpdate`,label:`On update`})]});case`select`:return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(Km,{p:e,k:`values`,label:`Values`,hint:`One per line.`,lines:!0}),(0,j.jsx)(qm,{p:e,many:()=>Math.max(2,(e.field.values??[]).length)})]});case`json`:return(0,j.jsx)(Wm,{p:e,k:`maxSize`,label:`Max size (bytes)`});case`editor`:return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(Wm,{p:e,k:`maxSize`,label:`Max size (bytes)`}),(0,j.jsx)(Gm,{p:e,k:`convertURLs`,label:`Convert URLs`})]});case`relation`:return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(Ym,{p:e}),(0,j.jsx)(qm,{p:e,many:()=>999}),(0,j.jsx)(Wm,{p:e,k:`minSelect`,label:`Min select`}),(0,j.jsx)(Gm,{p:e,k:`cascadeDelete`,label:`Cascade delete`})]});case`file`:return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(qm,{p:e,many:()=>99}),(0,j.jsx)(Wm,{p:e,k:`maxSize`,label:`Max size (bytes)`}),(0,j.jsx)(Xm,{p:e}),(0,j.jsx)(Km,{p:e,k:`thumbs`,label:`Thumb sizes`,hint:`WxH, WxHt, WxHb, WxHf, 0xH, Wx0`}),(0,j.jsx)(Gm,{p:e,k:`protected`,label:`Protected`})]});case`password`:return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(Wm,{p:e,k:`min`,label:`Min length`}),(0,j.jsx)(Wm,{p:e,k:`max`,label:`Max length`}),(0,j.jsx)(Um,{p:e,k:`pattern`,label:`Pattern`}),(0,j.jsx)(Wm,{p:e,k:`cost`,label:`Bcrypt cost`})]});default:return null}}function Qm(e){return(0,j.jsxs)(`div`,{className:`grid items-end gap-3 sm:grid-cols-2`,children:[(0,j.jsx)(Zm,{p:e}),e.field.type!==`autodate`&&(0,j.jsx)(Um,{p:e,k:`help`,label:`Help text`})]})}var $m={text:bl,editor:vc,number:Ec,bool:ml,email:Hs,url:d,date:Ks,autodate:oc,select:u,file:Kc,relation:Pc,json:Ws,geoPoint:Hc,password:Ic},eh=`flex flex-col gap-2 rounded border border-line p-3`;function th(e){let{field:t}=e;return t._removed?(0,j.jsx)(`fieldset`,{"aria-label":t.name,className:`${eh} opacity-60`,children:(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,j.jsx)(`span`,{className:`text-sm line-through`,children:t.name}),(0,j.jsx)(w,{onClick:e.onRestore,children:`Restore`})]})}):(0,j.jsx)(nh,{...e})}function nh({field:e,errorPath:t,canMoveUp:n,canMoveDown:r,onChange:i,onMove:a,onDragStart:o,onDragEnd:s,onRemove:c}){let l=$m[e.type],u=Y(`${t}.name`),[d,f]=(0,T.useState)(!e.id),p=Md(`${t}.`,!1).filter(([e])=>e!==`${t}.name`).length>0;return(0,T.useEffect)(()=>{p&&f(!0)},[p]),(0,j.jsxs)(`fieldset`,{"aria-label":e.name||`New field`,className:eh,children:[(0,j.jsxs)(`div`,{className:`grid grid-cols-[auto_auto_1fr_9rem_auto] items-center gap-2`,children:[(0,j.jsx)(`span`,{draggable:!0,"aria-hidden":!0,title:`Drag to reorder`,className:`-ml-1 cursor-grab text-muted active:cursor-grabbing`,onDragStart:t=>{t.dataTransfer.effectAllowed=`move`,t.dataTransfer.setData(`text/plain`,e.name);let n=t.currentTarget.closest(`fieldset`);n&&t.dataTransfer.setDragImage(n,16,16),o()},onDragEnd:s,children:(0,j.jsx)(Sc,{size:15,strokeWidth:1.75})}),(0,j.jsx)(l,{size:15,strokeWidth:1.75,"aria-hidden":!0,className:`text-muted`}),(0,j.jsx)(`div`,{className:`[&_label]:sr-only`,children:(0,j.jsx)(kl,{label:`Field name`,value:e.name,disabled:e.system,error:u,onChange:e=>i({name:e.target.value})})}),(0,j.jsx)(`span`,{className:`justify-self-end`,children:(0,j.jsxs)(Ns,{tone:`neutral`,children:[um(e.type),e.system&&` (system)`]})}),(0,j.jsx)(au,{trigger:(0,j.jsx)(w,{variant:`ghost`,"aria-label":`Actions for ${e.name||`new field`}`,icon:(0,j.jsx)(fc,{size:15,strokeWidth:1.75}),className:`w-9 px-0`}),items:[{key:`up`,label:`Move up`,icon:(0,j.jsx)(Bs,{size:15,strokeWidth:1.75}),disabled:!n},{key:`down`,label:`Move down`,icon:(0,j.jsx)(Rs,{size:15,strokeWidth:1.75}),disabled:!r},...e.system?[]:[{separator:!0},{key:`remove`,label:`Remove field`,icon:(0,j.jsx)(gl,{size:15,strokeWidth:1.75}),danger:!0}]],onAction:e=>e===`remove`?c():a(e===`up`?-1:1),placement:`bottom-start`})]}),(0,j.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[e.type!==`autodate`&&(0,j.jsx)(Ps,{label:`Required`,checked:!!e.required,onChange:e=>i({required:e.target.checked})}),(0,j.jsx)(Ps,{label:`Hidden`,checked:e.hidden,onChange:e=>i({hidden:e.target.checked})}),(0,j.jsx)(Ps,{label:`Presentable`,checked:e.presentable,onChange:e=>i({presentable:e.target.checked})}),(0,j.jsx)(w,{variant:`ghost`,className:`ml-auto`,"aria-expanded":d,onClick:()=>f(!d),children:`Options`})]}),d&&(0,j.jsx)(Qm,{field:e,errorPath:t,onChange:i})]})}var rh=`SELECT.DISTINCT.FROM.WHERE.JOIN.LEFT JOIN.INNER JOIN.ON.GROUP BY.HAVING.ORDER BY.LIMIT.AS.AND.OR.NOT.IN.LIKE.IS.NULL.CASE.WHEN.THEN.ELSE.END.COUNT.SUM.MAX.MIN.AVG`.split(`.`),ih=[`CREATE`,`UNIQUE`,`INDEX`,`IF NOT EXISTS`,`ON`,`ASC`,`DESC`,`COLLATE NOCASE`,`WHERE`,`AND`,`OR`,`NOT`,`IS`,`NULL`,`IN`,`LIKE`,`LOWER`,`UPPER`,`LENGTH`,`COALESCE`,`SUBSTR`];function ah(e){let t=e.flatMap(e=>e.fields.map(t=>[e.name,String(t.name)]));return[...new Set([...e.map(e=>e.name),...t.map(([e,t])=>`${e}.${t}`),...t.map(([,e])=>e),...rh])]}function oh(e){return[...new Set([...e,...ih])]}function sh({draft:e,onChange:t}){let n=(0,T.useId)(),[r,i]=(0,T.useState)(null),a=Pm(e);return(0,j.jsxs)(`section`,{"aria-labelledby":n,className:`flex flex-col gap-2`,children:[(0,j.jsx)(`h3`,{id:n,className:`text-sm font-medium`,children:`Indexes`}),(0,j.jsx)(`ul`,{className:`flex flex-col gap-2`,children:a.map((e,n)=>(0,j.jsx)(ch,{sql:e,errorPath:`indexes.${n}`,onEdit:()=>i(n),onRemove:()=>t(a.filter((e,t)=>t!==n))},n))}),(0,j.jsx)(w,{className:`self-start`,onClick:()=>i(`new`),children:`Add index`}),r!==null&&(0,j.jsx)(lh,{table:e.name,columns:Nm(e).map(e=>e.name).filter(Boolean),sql:r===`new`?null:a[r],onCancel:()=>i(null),onSave:e=>{t(r===`new`?[...a,e]:a.map((t,n)=>n===r?e:t)),i(null)}})]})}function ch({sql:e,errorPath:t,onEdit:n,onRemove:r}){let i=Y(t),a=xm(e);return(0,j.jsxs)(`li`,{className:`flex flex-col gap-1 rounded border border-line p-2`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(`span`,{className:`flex-1 font-mono text-xs`,title:e,children:a?`${a.unique?`Unique: `:``}${a.columns.join(`, `)}`:e}),(0,j.jsx)(w,{variant:`ghost`,onClick:n,children:`Edit index`}),(0,j.jsx)(w,{variant:`ghost`,onClick:r,children:`Remove index`})]}),i&&(0,j.jsx)(`p`,{className:`text-xs text-danger-text`,children:i})]})}function lh({table:e,columns:t,sql:n,onCancel:r,onSave:i}){let a=Ed({defaultValues:{text:n??``,uniqueChoice:!1},onSubmit:({value:e})=>i(e.text.trim())}),{text:o,uniqueChoice:s}=Mr(a.store,e=>e.values),[c]=(0,T.useState)(vm),l=xm(o),u=o.trim()===``||!!l?.simple,d=l?.columns??[],f=l?.unique??s,p=l?.name??c,h=(t,n)=>{a.setFieldValue(`uniqueChoice`,n),a.setFieldValue(`text`,t.length?ym({table:e,columns:t,unique:n,name:p}):``)};return(0,j.jsx)(Ol,{open:!0,onClose:r,title:n?`Edit index`:`Add index`,footer:(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(w,{onClick:r,children:`Cancel`}),(0,j.jsx)(w,{variant:`primary`,disabled:o.trim()===``,onClick:()=>void a.handleSubmit(),children:`Apply`})]}),children:(0,j.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,j.jsxs)(`fieldset`,{className:`flex flex-wrap gap-3`,children:[(0,j.jsx)(`legend`,{className:`mb-1 text-sm font-medium`,children:`Columns`}),t.map(e=>(0,j.jsx)(Ps,{label:e,disabled:!u,checked:d.includes(e),onChange:t=>h(t.target.checked?[...d,e]:d.filter(t=>t!==e),f)},e))]}),(0,j.jsx)(Ps,{label:`Unique`,disabled:!u,hint:u?void 0:`This index uses SQL the checkboxes cannot show. Edit the SQL instead.`,checked:f,onChange:e=>h(d,e.target.checked)}),(0,j.jsx)(a.Field,{name:`text`,children:n=>(0,j.jsx)(m,{label:`Index SQL`,language:`sql`,sqlSchema:{[e]:t},completions:oh(t),rows:4,value:n.state.value,onChange:n.handleChange})})]})})}function uh({label:e,value:t,onChange:n,chips:r,suggest:i,errorPath:a,emptyHint:o=`Empty rule: everyone, guests included.`,lockable:s=!0}){let c=Y(a),l=(0,T.useRef)(null),u=(0,T.useRef)(t??``);(0,T.useEffect)(()=>{t!==null&&(u.current=t)},[t]);let d=e=>l.current?.insert(e);return(0,j.jsxs)(`fieldset`,{className:`flex flex-col gap-2 rounded border border-line p-3`,children:[(0,j.jsx)(`legend`,{className:`sr-only`,children:e}),(0,j.jsx)(m,{ref:l,label:e,rows:3,suggest:i,value:t??``,disabled:t===null,error:c,hint:t===null?`Only superusers can do this.`:t===``?o:void 0,onChange:n}),s&&(0,j.jsx)(Ps,{label:`Superusers only`,checked:t===null,onChange:e=>n(e.target.checked?null:u.current)}),t!==null&&(0,j.jsx)(j.Fragment,{children:(0,j.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:r.map(e=>(0,j.jsx)(`button`,{type:`button`,className:`rounded-full border border-line bg-hover px-2.5 py-0.5 text-xs text-text hover:border-accent hover:text-accent-text focus-visible:outline-2 focus-visible:outline-focus font-mono`,onClick:()=>d(e),children:e},e))})})]})}var dh=[`@now`,`@todayStart`,`@todayEnd`,`@monthStart`,`@monthEnd`,`@yearStart`,`@yearEnd`];function fh(e,t,n){let r=Nm(e).map(e=>e.name).filter(Boolean),i=n===`createRule`||n===`updateRule`?r.map(e=>`@request.body.${e}`):[];return[...r,`@request.auth.id`,`@request.auth.collectionName`,...i,`@request.query.`,`@request.headers.`,...t.filter(t=>!e.id||t.id!==e.id).map(e=>`@collection.${e.name}.`),...dh]}function ph(e,t,n){return Xp({collectionId:e.id,fields:Nm(e).filter(e=>e.name),collections:t,request:{body:n===`createRule`||n===`updateRule`}})}var mh=[{key:`listRule`,label:`List/Search rule`},{key:`viewRule`,label:`View rule`},{key:`createRule`,label:`Create rule`},{key:`updateRule`,label:`Update rule`},{key:`deleteRule`,label:`Delete rule`},{key:`authRule`,label:`Auth rule`,emptyHint:`Empty rule: any account with valid credentials can sign in.`},{key:`manageRule`,label:`Manage rule`,emptyHint:`A manage rule cannot be empty. Write a rule or lock it.`}],hh=mh.map(e=>e.key);function gh(e){return e===`view`?mh.slice(0,2):e===`auth`?mh:mh.slice(0,5)}function _h({form:e,draft:t}){let n=af();return(0,j.jsx)(`div`,{className:`flex flex-col gap-3`,children:gh(t.type).map(({key:r,label:i,emptyHint:a})=>(0,j.jsx)(e.Field,{name:r,children:e=>(0,j.jsx)(uh,{label:i,emptyHint:a,errorPath:r,value:e.state.value??null,chips:fh(t,n.data??[],r),suggest:ph(t,n.data??[],r),onChange:e.handleChange})},r))})}var vh=`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>`,yh=`</title><path d="`,bh=`"/></svg>`,xh={title:`Apple`,slug:`apple`,get svg(){return vh+`Apple`+yh+this.path+bh},path:`M12.152 6.896c-.948 0-2.415-1.078-3.96-1.04-2.04.027-3.91 1.183-4.961 3.014-2.117 3.675-.546 9.103 1.519 12.09 1.013 1.454 2.208 3.09 3.792 3.039 1.52-.065 2.09-.987 3.935-.987 1.831 0 2.35.987 3.96.948 1.637-.026 2.676-1.48 3.676-2.948 1.156-1.688 1.636-3.325 1.662-3.415-.039-.013-3.182-1.221-3.22-4.857-.026-3.04 2.48-4.494 2.597-4.559-1.429-2.09-3.623-2.324-4.39-2.376-2-.156-3.675 1.09-4.61 1.09zM15.53 3.83c.843-1.012 1.4-2.427 1.245-3.83-1.207.052-2.662.805-3.532 1.818-.78.896-1.454 2.338-1.273 3.714 1.338.104 2.715-.688 3.559-1.701`,source:`https://www.apple.com`,hex:`000000`},Sh={title:`Bitbucket`,slug:`bitbucket`,get svg(){return vh+`Bitbucket`+yh+this.path+bh},path:`M.778 1.213a.768.768 0 00-.768.892l3.263 19.81c.084.5.515.868 1.022.873H19.95a.772.772 0 00.77-.646l3.27-20.03a.768.768 0 00-.768-.891zM14.52 15.53H9.522L8.17 8.466h7.561z`,source:`https://atlassian.design/resources/logo-library`,hex:`0052CC`,guidelines:`https://atlassian.design/foundations/logos`},Ch={title:`Box`,slug:`box`,get svg(){return vh+`Box`+yh+this.path+bh},path:`M.959 5.523c-.54 0-.959.42-.959.899v7.549a4.59 4.59 0 004.613 4.494 4.717 4.717 0 004.135-2.457c.779 1.438 2.337 2.457 4.074 2.457 2.577 0 4.674-2.037 4.674-4.613.06-2.457-2.037-4.495-4.613-4.495-1.738 0-3.295.959-4.074 2.397-.78-1.438-2.338-2.397-4.135-2.397-1.079 0-2.038.36-2.817.899V6.422a.92.92 0 00-.898-.899zM17.602 9.26a.95.95 0 00-.704.158c-.36.3-.479.899-.18 1.318l2.397 3.116-2.396 3.115c-.3.42-.24.96.18 1.26.419.3 1.016.298 1.316-.122l2.039-2.636 2.096 2.697c.3.36.899.419 1.318.12.36-.3.42-.84.121-1.259l-2.338-3.115 2.338-3.057c.3-.419.298-1.018-.121-1.318-.48-.3-1.019-.24-1.318.18l-2.096 2.576-2.04-2.695c-.149-.18-.373-.3-.612-.338zM4.613 11.154c1.558 0 2.817 1.26 2.817 2.758 0 1.558-1.259 2.756-2.817 2.756-1.558 0-2.816-1.198-2.816-2.756 0-1.498 1.258-2.758 2.816-2.758zm8.27 0c1.558 0 2.816 1.26 2.816 2.758-.06 1.558-1.318 2.756-2.816 2.756-1.558 0-2.817-1.198-2.817-2.756 0-1.498 1.259-2.758 2.817-2.758Z`,source:`https://www.box.com/en-gb/about-us/press`,hex:`0061D5`,guidelines:`https://www.box.com/en-gb/about-us/press`},wh={title:`Discord`,slug:`discord`,get svg(){return vh+`Discord`+yh+this.path+bh},path:`M20.317 4.3698a19.7913 19.7913 0 00-4.8851-1.5152.0741.0741 0 00-.0785.0371c-.211.3753-.4447.8648-.6083 1.2495-1.8447-.2762-3.68-.2762-5.4868 0-.1636-.3933-.4058-.8742-.6177-1.2495a.077.077 0 00-.0785-.037 19.7363 19.7363 0 00-4.8852 1.515.0699.0699 0 00-.0321.0277C.5334 9.0458-.319 13.5799.0992 18.0578a.0824.0824 0 00.0312.0561c2.0528 1.5076 4.0413 2.4228 5.9929 3.0294a.0777.0777 0 00.0842-.0276c.4616-.6304.8731-1.2952 1.226-1.9942a.076.076 0 00-.0416-.1057c-.6528-.2476-1.2743-.5495-1.8722-.8923a.077.077 0 01-.0076-.1277c.1258-.0943.2517-.1923.3718-.2914a.0743.0743 0 01.0776-.0105c3.9278 1.7933 8.18 1.7933 12.0614 0a.0739.0739 0 01.0785.0095c.1202.099.246.1981.3728.2924a.077.077 0 01-.0066.1276 12.2986 12.2986 0 01-1.873.8914.0766.0766 0 00-.0407.1067c.3604.698.7719 1.3628 1.225 1.9932a.076.076 0 00.0842.0286c1.961-.6067 3.9495-1.5219 6.0023-3.0294a.077.077 0 00.0313-.0552c.5004-5.177-.8382-9.6739-3.5485-13.6604a.061.061 0 00-.0312-.0286zM8.02 15.3312c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9555-2.4189 2.157-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.9555 2.4189-2.1569 2.4189zm7.9748 0c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9554-2.4189 2.1569-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.946 2.4189-2.1568 2.4189Z`,source:`https://discord.com/branding`,hex:`5865F2`,guidelines:`https://discord.com/branding`},Th={title:`Facebook`,slug:`facebook`,get svg(){return vh+`Facebook`+yh+this.path+bh},path:`M9.101 23.691v-7.98H6.627v-3.667h2.474v-1.58c0-4.085 1.848-5.978 5.858-5.978.401 0 .955.042 1.468.103a8.68 8.68 0 0 1 1.141.195v3.325a8.623 8.623 0 0 0-.653-.036 26.805 26.805 0 0 0-.733-.009c-.707 0-1.259.096-1.675.309a1.686 1.686 0 0 0-.679.622c-.258.42-.374.995-.374 1.752v1.297h3.919l-.386 2.103-.287 1.564h-3.246v8.245C19.396 23.238 24 18.179 24 12.044c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.628 3.874 10.35 9.101 11.647Z`,source:`https://about.meta.com/brand/resources/facebook/logo`,hex:`0866FF`,guidelines:`https://about.meta.com/brand/resources/facebook/logo`},Eh={title:`Gitea`,slug:`gitea`,get svg(){return vh+`Gitea`+yh+this.path+bh},path:`M4.209 4.603c-.247 0-.525.02-.84.088-.333.07-1.28.283-2.054 1.027C-.403 7.25.035 9.685.089 10.052c.065.446.263 1.687 1.21 2.768 1.749 2.141 5.513 2.092 5.513 2.092s.462 1.103 1.168 2.119c.955 1.263 1.936 2.248 2.89 2.367 2.406 0 7.212-.004 7.212-.004s.458.004 1.08-.394c.535-.324 1.013-.893 1.013-.893s.492-.527 1.18-1.73c.21-.37.385-.729.538-1.068 0 0 2.107-4.471 2.107-8.823-.042-1.318-.367-1.55-.443-1.627-.156-.156-.366-.153-.366-.153s-4.475.252-6.792.306c-.508.011-1.012.023-1.512.027v4.474l-.634-.301c0-1.39-.004-4.17-.004-4.17-1.107.016-3.405-.084-3.405-.084s-5.399-.27-5.987-.324c-.187-.011-.401-.032-.648-.032zm.354 1.832h.111s.271 2.269.6 3.597C5.549 11.147 6.22 13 6.22 13s-.996-.119-1.641-.348c-.99-.324-1.409-.714-1.409-.714s-.73-.511-1.096-1.52C1.444 8.73 2.021 7.7 2.021 7.7s.32-.859 1.47-1.145c.395-.106.863-.12 1.072-.12zm8.33 2.554c.26.003.509.127.509.127l.868.422-.529 1.075a.686.686 0 0 0-.614.359.685.685 0 0 0 .072.756l-.939 1.924a.69.69 0 0 0-.66.527.687.687 0 0 0 .347.763.686.686 0 0 0 .867-.206.688.688 0 0 0-.069-.882l.916-1.874a.667.667 0 0 0 .237-.02.657.657 0 0 0 .271-.137 8.826 8.826 0 0 1 1.016.512.761.761 0 0 1 .286.282c.073.21-.073.569-.073.569-.087.29-.702 1.55-.702 1.55a.692.692 0 0 0-.676.477.681.681 0 1 0 1.157-.252c.073-.141.141-.282.214-.431.19-.397.515-1.16.515-1.16.035-.066.218-.394.103-.814-.095-.435-.48-.638-.48-.638-.467-.301-1.116-.58-1.116-.58s0-.156-.042-.27a.688.688 0 0 0-.148-.241l.516-1.062 2.89 1.401s.48.218.583.619c.073.282-.019.534-.069.657-.24.587-2.1 4.317-2.1 4.317s-.232.554-.748.588a1.065 1.065 0 0 1-.393-.045l-.202-.08-4.31-2.1s-.417-.218-.49-.596c-.083-.31.104-.691.104-.691l2.073-4.272s.183-.37.466-.497a.855.855 0 0 1 .35-.077z`,source:`https://github.com/go-gitea/gitea/blob/e0c753e770a64cda5e3900aa1da3d7e1f3263c9a/assets/logo.svg`,hex:`609926`},Dh={title:`Gitee`,slug:`gitee`,get svg(){return vh+`Gitee`+yh+this.path+bh},path:`M11.984 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.016 0zm6.09 5.333c.328 0 .593.266.592.593v1.482a.594.594 0 0 1-.593.592H9.777c-.982 0-1.778.796-1.778 1.778v5.63c0 .327.266.592.593.592h5.63c.982 0 1.778-.796 1.778-1.778v-.296a.593.593 0 0 0-.592-.593h-4.15a.592.592 0 0 1-.592-.592v-1.482a.593.593 0 0 1 .593-.592h6.815c.327 0 .593.265.593.592v3.408a4 4 0 0 1-4 4H5.926a.593.593 0 0 1-.593-.593V9.778a4.444 4.444 0 0 1 4.445-4.444h8.296Z`,source:`https://gitee.com/about_us`,hex:`C71D23`},Oh={title:`GitHub`,slug:`github`,get svg(){return vh+`GitHub`+yh+this.path+bh},path:`M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12`,source:`https://github.com/logos`,hex:`181717`,guidelines:`https://github.com/logos`},kh={title:`GitLab`,slug:`gitlab`,get svg(){return vh+`GitLab`+yh+this.path+bh},path:`m23.6004 9.5927-.0337-.0862L20.3.9814a.851.851 0 0 0-.3362-.405.8748.8748 0 0 0-.9997.0539.8748.8748 0 0 0-.29.4399l-2.2055 6.748H7.5375l-2.2057-6.748a.8573.8573 0 0 0-.29-.4412.8748.8748 0 0 0-.9997-.0537.8585.8585 0 0 0-.3362.4049L.4332 9.5015l-.0325.0862a6.0657 6.0657 0 0 0 2.0119 7.0105l.0113.0087.03.0213 4.976 3.7264 2.462 1.8633 1.4995 1.1321a1.0085 1.0085 0 0 0 1.2197 0l1.4995-1.1321 2.4619-1.8633 5.006-3.7489.0125-.01a6.0682 6.0682 0 0 0 2.0094-7.003z`,source:`https://about.gitlab.com/press/press-kit/`,hex:`FC6D26`,guidelines:`https://about.gitlab.com/handbook/marketing/corporate-marketing/brand-activation/trademark-guidelines/`},Ah={title:`Google`,slug:`google`,get svg(){return vh+`Google`+yh+this.path+bh},path:`M12.48 10.92v3.28h7.84c-.24 1.84-.853 3.187-1.787 4.133-1.147 1.147-2.933 2.4-6.053 2.4-4.827 0-8.6-3.893-8.6-8.72s3.773-8.72 8.6-8.72c2.6 0 4.507 1.027 5.907 2.347l2.307-2.307C18.747 1.44 16.133 0 12.48 0 5.867 0 .307 5.387.307 12s5.56 12 12.173 12c3.573 0 6.267-1.173 8.373-3.36 2.16-2.16 2.84-5.213 2.84-7.667 0-.76-.053-1.467-.173-2.053H12.48z`,source:`https://partnermarketinghub.withgoogle.com`,hex:`4285F4`,guidelines:`https://about.google/brand-resource-center/brand-elements/`},jh={title:`Instagram`,slug:`instagram`,get svg(){return vh+`Instagram`+yh+this.path+bh},path:`M7.0301.084c-1.2768.0602-2.1487.264-2.911.5634-.7888.3075-1.4575.72-2.1228 1.3877-.6652.6677-1.075 1.3368-1.3802 2.127-.2954.7638-.4956 1.6365-.552 2.914-.0564 1.2775-.0689 1.6882-.0626 4.947.0062 3.2586.0206 3.6671.0825 4.9473.061 1.2765.264 2.1482.5635 2.9107.308.7889.72 1.4573 1.388 2.1228.6679.6655 1.3365 1.0743 2.1285 1.38.7632.295 1.6361.4961 2.9134.552 1.2773.056 1.6884.069 4.9462.0627 3.2578-.0062 3.668-.0207 4.9478-.0814 1.28-.0607 2.147-.2652 2.9098-.5633.7889-.3086 1.4578-.72 2.1228-1.3881.665-.6682 1.0745-1.3378 1.3795-2.1284.2957-.7632.4966-1.636.552-2.9124.056-1.2809.0692-1.6898.063-4.948-.0063-3.2583-.021-3.6668-.0817-4.9465-.0607-1.2797-.264-2.1487-.5633-2.9117-.3084-.7889-.72-1.4568-1.3876-2.1228C21.2982 1.33 20.628.9208 19.8378.6165 19.074.321 18.2017.1197 16.9244.0645 15.6471.0093 15.236-.005 11.977.0014 8.718.0076 8.31.0215 7.0301.0839m.1402 21.6932c-1.17-.0509-1.8053-.2453-2.2287-.408-.5606-.216-.96-.4771-1.3819-.895-.422-.4178-.6811-.8186-.9-1.378-.1644-.4234-.3624-1.058-.4171-2.228-.0595-1.2645-.072-1.6442-.079-4.848-.007-3.2037.0053-3.583.0607-4.848.05-1.169.2456-1.805.408-2.2282.216-.5613.4762-.96.895-1.3816.4188-.4217.8184-.6814 1.3783-.9003.423-.1651 1.0575-.3614 2.227-.4171 1.2655-.06 1.6447-.072 4.848-.079 3.2033-.007 3.5835.005 4.8495.0608 1.169.0508 1.8053.2445 2.228.408.5608.216.96.4754 1.3816.895.4217.4194.6816.8176.9005 1.3787.1653.4217.3617 1.056.4169 2.2263.0602 1.2655.0739 1.645.0796 4.848.0058 3.203-.0055 3.5834-.061 4.848-.051 1.17-.245 1.8055-.408 2.2294-.216.5604-.4763.96-.8954 1.3814-.419.4215-.8181.6811-1.3783.9-.4224.1649-1.0577.3617-2.2262.4174-1.2656.0595-1.6448.072-4.8493.079-3.2045.007-3.5825-.006-4.848-.0608M16.953 5.5864A1.44 1.44 0 1 0 18.39 4.144a1.44 1.44 0 0 0-1.437 1.4424M5.8385 12.012c.0067 3.4032 2.7706 6.1557 6.173 6.1493 3.4026-.0065 6.157-2.7701 6.1506-6.1733-.0065-3.4032-2.771-6.1565-6.174-6.1498-3.403.0067-6.156 2.771-6.1496 6.1738M8 12.0077a4 4 0 1 1 4.008 3.9921A3.9996 3.9996 0 0 1 8 12.0077`,source:`https://about.meta.com/brand/resources/instagram`,hex:`FF0069`,guidelines:`https://about.meta.com/brand/resources/instagram`},Mh={title:`KakaoTalk`,slug:`kakaotalk`,get svg(){return vh+`KakaoTalk`+yh+this.path+bh},path:`M22.125 0H1.875C.8394 0 0 .8394 0 1.875v20.25C0 23.1606.8394 24 1.875 24h20.25C23.1606 24 24 23.1606 24 22.125V1.875C24 .8394 23.1606 0 22.125 0zM12 18.75c-.591 0-1.1697-.0413-1.7317-.1209-.5626.3965-3.813 2.6797-4.1198 2.7225 0 0-.1258.0489-.2328-.0141s-.0876-.2282-.0876-.2282c.0322-.2198.8426-3.0183.992-3.5333-2.7452-1.36-4.5701-3.7686-4.5701-6.5135C2.25 6.8168 6.6152 3.375 12 3.375s9.75 3.4418 9.75 7.6875c0 4.2457-4.3652 7.6875-9.75 7.6875zM8.0496 9.8672h-.8777v3.3417c0 .2963-.2523.5372-.5625.5372s-.5625-.2409-.5625-.5372V9.8672h-.8777c-.3044 0-.552-.2471-.552-.5508s.2477-.5508.552-.5508h2.8804c.3044 0 .552.2471.552.5508s-.2477.5508-.552.5508zm10.9879 2.9566a.558.558 0 0 1 .108.4167.5588.5588 0 0 1-.2183.371.5572.5572 0 0 1-.3383.1135.558.558 0 0 1-.4493-.2236l-1.3192-1.7479-.1952.1952v1.2273a.5635.5635 0 0 1-.5627.5628.563.563 0 0 1-.5625-.5625V9.3281c0-.3102.2523-.5625.5625-.5625s.5625.2523.5625.5625v1.209l1.5694-1.5694c.0807-.0807.1916-.1252.312-.1252.1404 0 .2814.0606.3871.1661.0985.0984.1573.2251.1654.3566.0082.1327-.036.2542-.1241.3425l-1.2818 1.2817 1.3845 1.8344zm-8.3502-3.5023c-.095-.2699-.3829-.5475-.7503-.5557-.3663.0083-.6542.2858-.749.5551l-1.3455 3.5415c-.1708.5305-.0217.7272.1333.7988a.8568.8568 0 0 0 .3576.0776c.2346 0 .4139-.0952.4678-.2481l.2787-.7297 1.7152.0001.2785.7292c.0541.1532.2335.2484.4681.2484a.8601.8601 0 0 0 .3576-.0775c.1551-.0713.3041-.2681.1329-.7999l-1.3449-3.5398zm-1.3116 2.4433l.5618-1.5961.5618 1.5961H9.3757zm5.9056 1.3836c0 .2843-.2418.5156-.5391.5156h-1.8047c-.2973 0-.5391-.2314-.5391-.5156V9.3281c0-.3102.2576-.5625.5742-.5625s.5742.2523.5742.5625v3.3047h1.1953c.2974 0 .5392.2314.5392.5156z`,source:`https://commons.wikimedia.org/wiki/File:KakaoTalk_logo.svg`,hex:`FFCD00`},Nh={title:`Linear`,slug:`linear`,get svg(){return vh+`Linear`+yh+this.path+bh},path:`M2.886 4.18A11.982 11.982 0 0 1 11.99 0C18.624 0 24 5.376 24 12.009c0 3.64-1.62 6.903-4.18 9.105L2.887 4.18ZM1.817 5.626l16.556 16.556c-.524.33-1.075.62-1.65.866L.951 7.277c.247-.575.537-1.126.866-1.65ZM.322 9.163l14.515 14.515c-.71.172-1.443.282-2.195.322L0 11.358a12 12 0 0 1 .322-2.195Zm-.17 4.862 9.823 9.824a12.02 12.02 0 0 1-9.824-9.824Z`,source:`https://linear.app`,hex:`5E6AD2`},Ph={title:`LiveChat`,slug:`livechat`,get svg(){return vh+`LiveChat`+yh+this.path+bh},path:`M23.849 14.91c-.24 2.94-2.73 5.22-5.7 5.19h-3.15l-6 3.9v-3.9l6-3.9h3.15c.93.03 1.71-.66 1.83-1.59.18-3 .18-6-.06-9-.06-.84-.75-1.47-1.56-1.53-2.04-.09-4.2-.18-6.36-.18s-4.32.06-6.36.21c-.84.06-1.5.69-1.56 1.53-.21 3-.24 6-.06 9 .09.93.9 1.59 1.83 1.56h3.15v3.9h-3.15a5.644 5.644 0 01-5.7-5.19c-.21-3.21-.18-6.39.06-9.6a5.57 5.57 0 015.19-5.1c2.1-.15 4.35-.21 6.6-.21s4.5.06 6.63.24a5.57 5.57 0 015.19 5.1c.21 3.18.24 6.39.03 9.57z`,source:`https://livechat.design`,hex:`FF5100`,guidelines:`https://livechat.design`},Fh={title:`Notion`,slug:`notion`,get svg(){return vh+`Notion`+yh+this.path+bh},path:`M4.459 4.208c.746.606 1.026.56 2.428.466l13.215-.793c.28 0 .047-.28-.046-.326L17.86 1.968c-.42-.326-.981-.7-2.055-.607L3.01 2.295c-.466.046-.56.28-.374.466zm.793 3.08v13.904c0 .747.373 1.027 1.214.98l14.523-.84c.841-.046.935-.56.935-1.167V6.354c0-.606-.233-.933-.748-.887l-15.177.887c-.56.047-.747.327-.747.933zm14.337.745c.093.42 0 .84-.42.888l-.7.14v10.264c-.608.327-1.168.514-1.635.514-.748 0-.935-.234-1.495-.933l-4.577-7.186v6.952L12.21 19s0 .84-1.168.84l-3.222.186c-.093-.186 0-.653.327-.746l.84-.233V9.854L7.822 9.76c-.094-.42.14-1.026.793-1.073l3.456-.233 4.764 7.279v-6.44l-1.215-.139c-.093-.514.28-.887.747-.933zM1.936 1.035l13.31-.98c1.634-.14 2.055-.047 3.082.7l4.249 2.986c.7.513.934.653.934 1.213v16.378c0 1.026-.373 1.634-1.68 1.726l-15.458.934c-.98.047-1.448-.093-1.962-.747l-3.129-4.06c-.56-.747-.793-1.306-.793-1.96V2.667c0-.839.374-1.54 1.447-1.632z`,source:`https://www.notion.so`,hex:`000000`},Ih={title:`OpenID`,slug:`openid`,get svg(){return vh+`OpenID`+yh+this.path+bh},path:`M14.54.889l-3.63 1.773v18.17c-4.15-.52-7.27-2.78-7.27-5.5 0-2.58 2.8-4.75 6.63-5.41v-2.31C4.42 8.322 0 11.502 0 15.332c0 3.96 4.74 7.24 10.91 7.78l3.63-1.71V.888m.64 6.724v2.31c1.43.25 2.71.7 3.76 1.31l-1.97 1.11 7.03 1.53-.5-5.21-1.87 1.06c-1.74-1.06-3.96-1.81-6.45-2.11z`,source:`https://openid.net/add-openid/logos/`,hex:`F78C40`},Lh={title:`Patreon`,slug:`patreon`,get svg(){return vh+`Patreon`+yh+this.path+bh},path:`M22.957 7.21c-.004-3.064-2.391-5.576-5.191-6.482-3.478-1.125-8.064-.962-11.384.604C2.357 3.231 1.093 7.391 1.046 11.54c-.039 3.411.302 12.396 5.369 12.46 3.765.047 4.326-4.804 6.068-7.141 1.24-1.662 2.836-2.132 4.801-2.618 3.376-.836 5.678-3.501 5.673-7.031Z`,source:`https://www.patreon.com/brand`,hex:`000000`,guidelines:`https://www.patreon.com/brand`},Rh={title:`Spotify`,slug:`spotify`,get svg(){return vh+`Spotify`+yh+this.path+bh},path:`M12 0C5.4 0 0 5.4 0 12s5.4 12 12 12 12-5.4 12-12S18.66 0 12 0zm5.521 17.34c-.24.359-.66.48-1.021.24-2.82-1.74-6.36-2.101-10.561-1.141-.418.122-.779-.179-.899-.539-.12-.421.18-.78.54-.9 4.56-1.021 8.52-.6 11.64 1.32.42.18.479.659.301 1.02zm1.44-3.3c-.301.42-.841.6-1.262.3-3.239-1.98-8.159-2.58-11.939-1.38-.479.12-1.02-.12-1.14-.6-.12-.48.12-1.021.6-1.141C9.6 9.9 15 10.561 18.72 12.84c.361.181.54.78.241 1.2zm.12-3.36C15.24 8.4 8.82 8.16 5.16 9.301c-.6.179-1.2-.181-1.38-.721-.18-.601.18-1.2.72-1.381 4.26-1.26 11.28-1.02 15.721 1.621.539.3.719 1.02.419 1.56-.299.421-1.02.599-1.559.3z`,source:`https://developer.spotify.com/documentation/general/design-and-branding/#using-our-logo`,hex:`1ED760`,guidelines:`https://developer.spotify.com/documentation/general/design-and-branding/#using-our-logo`},zh={title:`Strava`,slug:`strava`,get svg(){return vh+`Strava`+yh+this.path+bh},path:`M15.387 17.944l-2.089-4.116h-3.065L15.387 24l5.15-10.172h-3.066m-7.008-5.599l2.836 5.598h4.172L10.463 0l-7 13.828h4.169`,source:`https://itunes.apple.com/us/app/strava-running-and-cycling-gps/id426826309`,hex:`FC4C02`},Bh={title:`Trakt`,slug:`trakt`,get svg(){return vh+`Trakt`+yh+this.path+bh},path:`m15.082 15.107-.73-.73 9.578-9.583a4.499 4.499 0 0 0-.115-.575L13.662 14.382l1.08 1.08-.73.73-1.81-1.81L23.422 3.144c-.075-.15-.155-.3-.25-.44L11.508 14.377l2.154 2.155-.73.73-7.193-7.199.73-.73 4.309 4.31L22.546 1.86A5.618 5.618 0 0 0 18.362 0H5.635A5.637 5.637 0 0 0 0 5.634V18.37A5.632 5.632 0 0 0 5.635 24h12.732C21.477 24 24 21.48 24 18.37V6.19l-8.913 8.918zm-4.314-2.155L6.814 8.988l.73-.73 3.954 3.96zm1.075-1.084-3.954-3.96.73-.73 3.959 3.96zm9.853 5.688a4.141 4.141 0 0 1-4.14 4.14H6.438a4.144 4.144 0 0 1-4.139-4.14V6.438A4.141 4.141 0 0 1 6.44 2.3h10.387v1.04H6.438c-1.71 0-3.099 1.39-3.099 3.1V17.55c0 1.71 1.39 3.105 3.1 3.105h11.117c1.71 0 3.1-1.395 3.1-3.105v-1.754h1.04v1.754z`,source:`https://trakt.tv/branding`,hex:`9F42C6`,guidelines:`https://trakt.tv/branding`},Vh={title:`Twitch`,slug:`twitch`,get svg(){return vh+`Twitch`+yh+this.path+bh},path:`M11.571 4.714h1.715v5.143H11.57zm4.715 0H18v5.143h-1.714zM6 0L1.714 4.286v15.428h5.143V24l4.286-4.286h3.428L22.286 12V0zm14.571 11.143l-3.428 3.428h-3.429l-3 3v-3H6.857V1.714h13.714Z`,source:`https://brand.twitch.tv`,hex:`9146FF`,guidelines:`https://brand.twitch.tv`},Hh={title:`VK`,slug:`vk`,get svg(){return vh+`VK`+yh+this.path+bh},path:`m9.489.004.729-.003h3.564l.73.003.914.01.433.007.418.011.403.014.388.016.374.021.36.025.345.03.333.033c1.74.196 2.933.616 3.833 1.516.9.9 1.32 2.092 1.516 3.833l.034.333.029.346.025.36.02.373.025.588.012.41.013.644.009.915.004.98-.001 3.313-.003.73-.01.914-.007.433-.011.418-.014.403-.016.388-.021.374-.025.36-.03.345-.033.333c-.196 1.74-.616 2.933-1.516 3.833-.9.9-2.092 1.32-3.833 1.516l-.333.034-.346.029-.36.025-.373.02-.588.025-.41.012-.644.013-.915.009-.98.004-3.313-.001-.73-.003-.914-.01-.433-.007-.418-.011-.403-.014-.388-.016-.374-.021-.36-.025-.345-.03-.333-.033c-1.74-.196-2.933-.616-3.833-1.516-.9-.9-1.32-2.092-1.516-3.833l-.034-.333-.029-.346-.025-.36-.02-.373-.025-.588-.012-.41-.013-.644-.009-.915-.004-.98.001-3.313.003-.73.01-.914.007-.433.011-.418.014-.403.016-.388.021-.374.025-.36.03-.345.033-.333c.196-1.74.616-2.933 1.516-3.833.9-.9 2.092-1.32 3.833-1.516l.333-.034.346-.029.36-.025.373-.02.588-.025.41-.012.644-.013.915-.009ZM6.79 7.3H4.05c.13 6.24 3.25 9.99 8.72 9.99h.31v-3.57c2.01.2 3.53 1.67 4.14 3.57h2.84c-.78-2.84-2.83-4.41-4.11-5.01 1.28-.74 3.08-2.54 3.51-4.98h-2.58c-.56 1.98-2.22 3.78-3.8 3.95V7.3H10.5v6.92c-1.6-.4-3.62-2.34-3.71-6.92Z`,source:`https://vk.com/brand`,hex:`0077FF`,guidelines:`https://vk.com/brand`},Uh={title:`WakaTime`,slug:`wakatime`,get svg(){return vh+`WakaTime`+yh+this.path+bh},path:`M12 0C5.373 0 0 5.373 0 12s5.373 12 12 12 12-5.373 12-12S18.627 0 12 0zm0 2.824a9.176 9.176 0 1 1 0 18.352 9.176 9.176 0 0 1 0-18.352zm5.097 5.058c-.327 0-.61.19-.764.45-1.025 1.463-2.21 3.162-3.288 4.706l-.387-.636a.897.897 0 0 0-.759-.439.901.901 0 0 0-.788.492l-.357.581-1.992-2.943a.897.897 0 0 0-.761-.446c-.514 0-.903.452-.903.96a1 1 0 0 0 .207.61l2.719 3.96c.152.272.44.47.776.47a.91.91 0 0 0 .787-.483c.046-.071.23-.368.314-.504l.324.52c-.035-.047.076.113.087.13.024.031.054.059.078.085.019.019.04.036.058.052.036.033.08.056.115.08.025.016.052.028.076.04.029.015.06.024.088.035.058.025.122.027.18.04.031.004.064.003.092.005.29 0 .546-.149.707-.36 1.4-2 2.842-4.055 4.099-5.849A.995.995 0 0 0 18 8.842c0-.508-.389-.96-.903-.96`,source:`https://wakatime.com/legal/logos-and-trademark-usage`,hex:`000000`,guidelines:`https://wakatime.com/legal/logos-and-trademark-usage`},Wh={title:`X`,slug:`x`,get svg(){return vh+`X`+yh+this.path+bh},path:`M14.234 10.162 22.977 0h-2.072l-7.591 8.824L7.251 0H.258l9.168 13.343L.258 24H2.33l8.016-9.318L16.749 24h6.993zm-2.837 3.299-.929-1.329L3.076 1.56h3.182l5.965 8.532.929 1.329 7.754 11.09h-3.182z`,source:`https://x.com`,hex:`000000`,guidelines:`https://about.x.com/en/who-we-are/brand-toolkit`},Gh=(e,t,n,r)=>({d:`M${e} ${t}h${n}v${n}H${e}z`,fill:r}),Kh={apple:xh,bitbucket:Sh,box:Ch,discord:wh,facebook:Th,gitea:Eh,gitee:Dh,github:Oh,gitlab:kh,google:Ah,instagram2:jh,linear:Nh,livechat:Ph,notion:Fh,oidc:Ih,oidc2:Ih,oidc3:Ih,patreon:Lh,spotify:Rh,strava:zh,trakt:Bh,twitch:Vh,twitter:Wh,vk:Hh,wakatime:Uh,microsoft:{viewBox:`0 0 256 256`,shapes:[Gh(0,0,121.666,`#F1511B`),Gh(134.335,0,121.665,`#80CC28`),Gh(0,134.336,121.666,`#00ADEF`),Gh(134.335,134.336,121.666,`#FBBC09`)]},monday:{viewBox:`0 0 256 156`,shapes:[{d:`M31.846 153.489a31.97 31.97 0 0 1-27.86-16.167a30.91 30.91 0 0 1 .875-31.823l57.373-90.096A31.99 31.99 0 0 1 90.556.015a31.93 31.93 0 0 1 27.41 16.896c5.349 10.113 4.68 22.28-1.725 31.774L58.904 138.78a31.98 31.98 0 0 1-27.058 14.709`,fill:`#f62b54`},{d:`M130.256 153.488c-11.572 0-22.22-6.187-27.812-16.13a30.81 30.81 0 0 1 .875-31.737l57.264-89.89A31.94 31.94 0 0 1 188.93.016c11.669.255 22.244 6.782 27.592 16.993a30.81 30.81 0 0 1-2.066 31.92l-57.252 89.889a31.93 31.93 0 0 1-26.948 14.671`,fill:`#fc0`},{d:`M226.466 96.406a29.538 28.918 0 1 0 0 57.836a29.538 28.918 0 0 0 0-57.836z`,fill:`#00ca72`}]},yandex:{viewBox:`0 0 24 24`,shapes:[{d:`M16.376 12.644L21 2h-3.842l-4.624 10.644h3.842zM13.915 24v-3.733c0-2.822-.352-3.64-1.407-5.988L6.933 2H3l7.124 15.709V24h3.79z`,fill:`#FC3F1D`,fillRule:`evenodd`}]},kakao:{viewBox:`0 0 24 24`,shapes:[{d:`M22.125 0H1.875C.8394 0 0 .8394 0 1.875v20.25C0 23.1606.8394 24 1.875 24h20.25C23.1606 24 24 23.1606 24 22.125V1.875C24 .8394 23.1606 0 22.125 0z`,fill:`#191919`},{d:Mh.path,fill:`#FFCD00`}]},lark:{viewBox:`0 0 1024 1024`,shapes:[{d:`M512 0a512 512 0 1 0 0 1024A512 512 0 0 0 512 0z`,fill:`#3370ff`},{d:`M452.66 735.98c129.21-.05 240.96-73.62 296.01-181.49-28.47 55.36-88.93 81.63-149.06 66.88-34.65-8.89-68.49-21.04-101.43-34.95-88.52-38.05-168.71-94.13-234.5-164.53-2.65-2.92-7.95-.95-7.87 3.1l.14 213.29v17.31c0 10.06 4.96 19.44 13.3 25.03a328.727 328.727 0 0 0 183.41 55.37v-.02Zm89.96-222.18-.08.08a705.434 705.434 0 0 0-194.67-217.69 4.554 4.554 0 0 1 2.71-8.21h241.67c9.13 0 17.78 4.13 23.52 11.24a330.672 330.672 0 0 1 59.66 114.96c-30.57 9.47-58.51 25.96-80.81 48.28-7.65 7.52-15.59 15.38-23.27 23-8.6 8.53-17.5 17.35-26.05 25.72l-.07.07-.07.07c-.83.84-1.68 1.67-2.54 2.48Zm-55.3 55.67c22.18-13.01 42.79-28.57 61.47-46.28l1.38-1.38c.96-.9 1.9-1.83 2.83-2.77 16.22-15.89 33.15-32.84 49.36-48.76 53.08-53.16 136.95-68.88 205.83-40.1l-7.52 8.74c-12.15 14.11-22.3 29.94-30.16 47.04l-6.3 12.56c-8.01 15.97-24.68 49.19-25.58 50.92-8.74 16.48-20.4 30.55-33.74 40.68l-.13.1c-1.85 1.45-3.84 2.81-5.96 4.26-18.58 12.7-42.04 19.7-66.07 19.7-7.53 0-15.09-.68-22.47-2.02-2.72-.54-5.29-1.04-7.85-1.66-22.19-5.75-45.25-13.11-68.54-21.88-10.76-4.05-22.21-8.68-34.06-13.76l-12.5-5.38Z`,fill:`#ffffff`}]},mailcow:{viewBox:`0 0 1024 1024`,shapes:[{d:`M512 0a512 512 0 1 0 0 1024A512 512 0 0 0 512 0z`,fill:`#b58765`},{d:`M889.1 606.6s-13.8 81.8-57.6 81.1c-14.1.6-24-3.5-30.7-8.3-10.1 10.7-23.3 19.9-36.5 27.6l-.1.1c-10.8 6.2-21.5 11.3-30.3 15.2-3.1 1.3-5.9 2.5-8.4 3.5v-43.9c6.4.2 12.3-.1 17.8-1 22.6-3.5 37.6-14.7 43.7-20.1-4.3-13.2-10.9-52 55-58.1-2.7.6-9.3 3.5-15.1 18.3 19.5 1.6 51.5 4.4 62.2-14.4zm-242.4-16.1c-.5.5-1 1-1.4 1.3l-.7.6c-13.8 13.3-29.3 24.5-46.2 33.4-3.4 1.8-6.9 3.5-10.4 5-1.7.8-3.5 1.6-5.3 2.3-3.6 1.5-7.2 2.9-10.9 4.1-.5.2-1 .3-1.4.5L719.3 763c.9-2.8 1.4-5.7 1.4-8.6V479.2L700 495.8c-8.4 35.4-26.6 67.9-52.5 93.9l-.8.8zM563.8 640c-18.6 5.6-37.9 8.5-57.4 8.5-21.1 0-42-3.3-62-9.9L290.6 766.8l-2.2 1.7c5 8.5 14.1 13.8 24 13.8h380.4c9.9 0 19-5.3 24-13.8l-2.1-1.6L563.8 640zM316.1 507.8c-.5-1.5-.9-3.1-1.4-4.7l-30.2-24v275.2c0 2.9.5 5.8 1.4 8.6l152-126.7c-58.2-21.3-103.7-69.1-121.8-128.4zm388.2-36.7c-.6 5.3-1.4 10.6-2.5 15.9l14.1-11.3-11.6-4.6zm-414.6 4.2 22.5 17.9c-1.8-7.9-3.1-15.8-3.9-23.6l-18.6 5.7zm385.6-119.6c15.8 28.5 24.2 60.9 24.2 93.6 0 51.1-19.7 99.1-55.5 135.5-.6.6-2.1 2.2-2.8 2.8l-.6.6c-13.4 12.9-28.5 23.8-44.9 32.4-3.3 1.7-6.7 3.4-10.1 4.9-1.7.8-3.4 1.5-5.2 2.2-3.4 1.4-7 2.8-10.5 4-1.7.6-3.6 1.2-5.4 1.8-18.8 5.9-38.3 8.9-58.2 8.9-21.4 0-42.5-3.5-62.7-10.4-58.3-20-103.9-67.1-122-126-3.8-12.4-6.4-25.4-7.6-38.4-.6-6.1-.9-12.3-.9-18.3 0-6.6.3-13.2 1-19.8 2.5-24.8 9.7-48.5 21.4-70.5 2.2-4.1 4.5-8.1 6.9-12 5.9-9.4 12.6-18.3 19.9-26.5l.4-.4.7-.8c2.7-3 5.6-5.9 8.4-8.7 9-8.7 18.9-16.6 29.4-23.4 7-4.6 14.4-8.7 22-12.3 17.7-8.4 36.5-14.1 55.9-16.8 17-2.4 34.3-2.5 51.3-.4 18.9 2.4 37.3 7.5 54.7 15.3 7.4 3.3 14.6 7.1 21.4 11.3 11 6.7 21.4 14.6 30.9 23.4 11.5 10.7 21.7 22.7 30.3 35.8 2.8 3.9 5.3 8 7.6 12.2zm-32 89.7c0-80.5-59-148.5-137.1-158.2-6.3-.8-12.7-1.2-19.1-1.2-29.7 0-58.7 8.6-83.6 24.8-24.3 15.8-43.9 38-56.6 64.3-10.6 22-16 45.7-16 70.3 0 40.7 15 79.5 42.4 109.1 29.9 32.4 70.3 50.3 113.9 50.3 55.7 0 107.6-30.7 135.5-80 5.9-10.5 10.7-21.7 14.1-33.4 4.2-14.9 6.5-30.4 6.5-46zm48.9 11.9h2.2v-.1h-2.2v.1zm-77.8 63.6 1.7 3.1c-27.1 46.2-76.5 74.9-129.1 74.9-41.4 0-79.9-16.8-108.5-47.3v-4.2l.8-.3-.8-.9c1.9-41.9 56.4-75.9 121.8-75.9 50.4 0 96.2 20.4 114.1 50.6zm-170.3 14.8c0-10.7-8.7-19.3-19.3-19.3-10.6 0-19.3 8.7-19.3 19.3 0 10.7 8.7 19.3 19.3 19.3 10.7 0 19.3-8.7 19.3-19.3zm151.6 0c0-10.7-8.7-19.3-19.3-19.3-10.7 0-19.3 8.7-19.3 19.3 0 10.7 8.7 19.3 19.3 19.3 10.6 0 19.3-8.7 19.3-19.3zM487 291.9v-1.1 1.1c6.1 0 12.3.4 18.4 1.1 75.2 9.4 132 74.9 132 152.4 0 15.1-2.2 30-6.4 44.5v.1c-.5 1.7-1.1 3.6-1.8 5.8l-.5 1.4c-.7 1.9-1.4 3.8-2.1 5.6l-.5 1.2c-.7 1.7-1.4 3.4-2.1 5l-.4 1c-.8 1.7-1.6 3.5-2.6 5.4-.4.9-.9 1.8-1.4 2.7-19-32.1-66.5-53.6-119.1-53.6-33.9 0-65.8 8.6-89.9 24.3-22.9 14.9-36.1 34.5-37.7 55.5-1.2-4.1-2.1-8.3-2.7-12.3 0-.3-.1-.7-.2-1-.1-.3-.1-.6-.2-1-8.6-37.9-14.6-66.3-21.7-107.8-.8-6.6-1.2-12.3-1.4-17.9 0-.8-.1-1.6-.1-2.4-.1-1.4-.1-2.8-.1-4.3 0-2.2.1-4.5.3-7.3 1.3-3.5 2.8-7 4.4-10.4l1.1-2.3.1-.3 1.2-2.4.6-1.2c.2-.4.3-.7.5-1 .1-.2.2-.3.3-.5l.2-.4c12.2-22.7 30-42.1 51.4-56 24-15.7 51.8-23.9 80.4-23.9zm-34.8 104.9c0-11.9-9.6-21.5-21.5-21.5s-21.5 9.6-21.5 21.5 9.6 21.5 21.5 21.5c5.7 0 11.1-2.2 15.2-6.3 4-4 6.3-9.4 6.3-15.2zm105.4 0c0 11.9 9.6 21.5 21.5 21.5s21.5-9.6 21.5-21.5-9.7-21.5-21.5-21.5-21.5 9.7-21.5 21.5zm27.8 1.4c4.1 0 7.5-3.3 7.5-7.5 0-4.1-3.4-7.5-7.5-7.5s-7.5 3.4-7.5 7.5c0 4.2 3.3 7.5 7.5 7.5zm-147.1 0c4.1 0 7.5-3.3 7.5-7.5 0-4.1-3.3-7.5-7.5-7.5-4.1 0-7.5 3.4-7.5 7.5 0 4.2 3.3 7.5 7.5 7.5zm146.4-189.6c-3 6.5-16.4 33-40.4 44.6 14.9 2.9 29.4 7.4 43.1 13.5 6.4-11.8 17.4-38.7-2.7-58.1zm-163.9 60.1c13.9-6.6 28.6-11.6 43.7-14.8-25.1-11.1-39-38.7-42.1-45.4-20.9 20.3-8.6 48.1-1.6 60.2zm191.3 11c10.7 6.7 20.8 14.4 30 22.9l.1.1c14.1-9.1 35.8-18.6 59.7-12.8l1 .2-.1 1c0 .3-4 27.3-29 49 2.3 3.5 4.5 7.1 6.6 10.8 28.2-20.2 40.6-48.3 37-83.5-6.8-2.4-67.8-24-105.3 12.3zm-284.6-20.6c-19.9 1.4-36.2 7.2-39.5 8.5-3.9 37.5 10.4 66.8 42.4 87.1 1.9-3.6 4-7.1 6.1-10.5-29.3-22.2-33.8-52.7-33.9-53l-.1-1 1-.2c25.8-6.2 48.9 5 64 15.7 8.8-8.5 18.4-16.2 28.6-23-20.3-22-48.4-25-68.6-23.6z`,fill:`#ffffff`}]},planningcenter:{viewBox:`0 0 1024 1024`,shapes:[{d:`M512 0a512 512 0 1 0 0 1024A512 512 0 0 0 512 0z`,fill:`#2265f7`},{d:`M510.93 250.26c-14.18 0-28.57 2.12-42.95 6.35l-155.74 47.4c-35.55 11.85-59.25 44.01-59.25 81.25v253.92c0 37.24 23.7 69.4 59.25 81.25l157.43 47.4c27.08 8.46 55.86 8.46 84.64 0l157.43-47.4c35.55-11.85 59.25-44.01 59.25-81.25V385.26c-1.69-37.24-27.08-69.4-60.94-81.25l-157.43-47.4a139.3 139.3 0 0 0-41.68-6.35Zm102.93 150.3c15.7-.26 30.17 13.26 30.17 30.4v130.35c0 10.16-6.77 18.62-15.23 22.01l-104.95 32.16c-8.46 3.39-18.62 3.39-27.09 0l-67.71-20.31s-1.69 0-1.69 1.69v50.78c0 5.08-5.08 8.46-10.16 6.77l-35.55-10.16c-3.38-1.69-5.08-5.08-5.08-8.46V429.27c0-18.62 18.62-32.16 37.24-27.08l91.41 27.08c3.39 1.69 6.77 0 8.46 0l91.41-27.08c2.81-1.03 5.77-1.58 8.77-1.63Zm-179.74 55.8c-1.69 0-5.08 1.69-5.08 3.39v76.17c0 1.69 1.69 3.39 3.39 5.08l72.79 22c3.39 1.69 8.46 1.69 11.85 0l72.79-22.01c1.69 0 3.38-1.69 3.38-5.08v-74.48c0-1.69-1.69-3.39-5.08-3.39l-59.25 16.93c-11.85 3.39-23.7 3.39-35.55 0l-59.25-18.62Z`,fill:`#ffffff`}]}},qh=`#ffffff`,Jh=`#121216`;function Yh(e){let[t,n,r]=[0,2,4].map(t=>{let n=parseInt(e.slice(t,t+2),16)/255;return n<=.03928?n/12.92:((n+.055)/1.055)**2.4});return .2126*t+.7152*n+.0722*r}function Xh(e,t){let[n,r]=[Yh(e),Yh(t)].sort((e,t)=>t-e);return(n+.05)/(r+.05)}function Zh({name:e,displayName:t}){let n=Kh[e],r=`flex size-8 shrink-0 items-center justify-center rounded-control bg-hover`;if(!n)return(0,j.jsx)(`span`,{"data-testid":`monogram`,"aria-hidden":`true`,className:`${r} text-sm font-semibold text-text`,children:t.charAt(0).toUpperCase()});if(`shapes`in n)return(0,j.jsx)(`span`,{"aria-hidden":`true`,className:r,children:(0,j.jsx)(`svg`,{viewBox:n.viewBox,className:`size-[18px]`,children:n.shapes.map(e=>(0,j.jsx)(`path`,{d:e.d,fill:e.fill,fillRule:e.fillRule},e.d))})});let i=Xh(n.hex,qh)>=3,a=Xh(n.hex,Jh)>=3;return(0,j.jsx)(`span`,{"aria-hidden":`true`,className:`${r} ${i?`text-[var(--brand)]`:`text-text`} ${a?`dark:text-[var(--brand)]`:`dark:text-text`}`,style:{"--brand":`#${n.hex}`},children:(0,j.jsx)(`svg`,{viewBox:`0 0 24 24`,className:`size-[18px]`,fill:`currentColor`,children:(0,j.jsx)(`path`,{d:n.path})})})}var Qh=[{name:`apple`,displayName:`Apple`,needsURLs:!1},{name:`google`,displayName:`Google`,needsURLs:!1},{name:`microsoft`,displayName:`Microsoft`,needsURLs:!1},{name:`yandex`,displayName:`Yandex`,needsURLs:!1},{name:`facebook`,displayName:`Facebook`,needsURLs:!1},{name:`instagram2`,displayName:`Instagram`,needsURLs:!1},{name:`github`,displayName:`GitHub`,needsURLs:!1},{name:`gitlab`,displayName:`GitLab`,needsURLs:!1},{name:`bitbucket`,displayName:`Bitbucket`,needsURLs:!1},{name:`gitee`,displayName:`Gitee`,needsURLs:!1},{name:`gitea`,displayName:`Gitea/Forgejo`,needsURLs:!1},{name:`discord`,displayName:`Discord`,needsURLs:!1},{name:`twitter`,displayName:`X/Twitter`,needsURLs:!1},{name:`kakao`,displayName:`Kakao`,needsURLs:!1},{name:`vk`,displayName:`ВКонтакте`,needsURLs:!1},{name:`linear`,displayName:`Linear`,needsURLs:!1},{name:`notion`,displayName:`Notion`,needsURLs:!1},{name:`monday`,displayName:`monday.com`,needsURLs:!1},{name:`lark`,displayName:`Lark`,needsURLs:!1},{name:`box`,displayName:`Box`,needsURLs:!1},{name:`spotify`,displayName:`Spotify`,needsURLs:!1},{name:`trakt`,displayName:`Trakt`,needsURLs:!1},{name:`twitch`,displayName:`Twitch`,needsURLs:!1},{name:`patreon`,displayName:`Patreon`,needsURLs:!1},{name:`strava`,displayName:`Strava`,needsURLs:!1},{name:`wakatime`,displayName:`WakaTime`,needsURLs:!1},{name:`livechat`,displayName:`LiveChat`,needsURLs:!1},{name:`mailcow`,displayName:`mailcow`,needsURLs:!0},{name:`planningcenter`,displayName:`Planning Center`,needsURLs:!1},{name:`oidc`,displayName:`OpenID Connect`,needsURLs:!0},{name:`oidc2`,displayName:`OpenID Connect 2`,needsURLs:!0},{name:`oidc3`,displayName:`OpenID Connect 3`,needsURLs:!0}],$h=`abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789`;function eg(e=50){let t=crypto.getRandomValues(new Uint32Array(e));return Array.from(t,e=>$h[e%62]).join(``)}function tg(e,t){return t.split(`.`).reduce((e,t)=>e?.[t],e)}function ng({c:e,path:t,label:n,hint:r}){let i=Y(t);return(0,j.jsx)(e.form.Field,{name:t,children:e=>(0,j.jsx)(kl,{label:n,hint:r,value:e.state.value??``,error:i,onChange:t=>e.handleChange(t.target.value)})})}function rg({c:e,path:t,label:n,hint:r}){let i=Y(t);return(0,j.jsx)(e.form.Field,{name:t,children:e=>(0,j.jsx)(zl,{label:n,hint:r,value:e.state.value??``,error:i,onChange:t=>e.handleChange(t.target.value===``?0:Number(t.target.value))})})}function ig({c:e,path:t,label:n,hint:r}){let i=Y(t);return(0,j.jsx)(e.form.Field,{name:t,children:e=>(0,j.jsx)(Ps,{label:n,hint:r,checked:e.state.value===!0,error:i,onChange:t=>e.handleChange(t.target.checked)})})}var ag=`flex flex-col gap-2 rounded border border-line p-3`;function og({title:e,prefixes:t,defaultOpen:n=!1,children:r}){let i=Md(``,!1).some(([e])=>t.some(t=>e===t||e.startsWith(`${t}.`))),[a,o]=(0,T.useState)(n||i),[s,c]=(0,T.useState)(i);return i!==s&&(c(i),i&&o(!0)),(0,j.jsx)(Il,{title:e,open:a,onOpenChange:o,children:(0,j.jsx)(`div`,{className:`flex flex-col gap-3`,children:r})})}var sg=15777e3;function cg({label:e,path:t,value:n,onChange:r,hint:i,type:a,required:o,error:s}){let c=Y(t);return(0,j.jsx)(kl,{label:e,hint:i,type:a,required:o,value:n,error:s??c,onChange:e=>r(e.target.value)})}function lg({provider:e,errorPath:t,onCancel:n,onSave:r,submitLabel:i=`Apply`}){let a=Qh.find(t=>t.name===e.name),o=!!e.clientId,[s,c]=(0,T.useState)({}),l=t=>String(e[t]??``),u=Ed({defaultValues:{clientId:l(`clientId`),clientSecret:``,displayName:l(`displayName`),authURL:l(`authURL`),tokenURL:l(`tokenURL`),userInfoURL:l(`userInfoURL`),pkce:e.pkce===!0?`on`:e.pkce===!1?`off`:`unset`},onSubmit:({value:{clientSecret:t,pkce:n,...i}})=>{let a={clientId:i.clientId.trim()?void 0:`Cannot be blank.`,clientSecret:t||o?void 0:`Cannot be blank.`};c(a),a.clientId||a.clientSecret||r({...e,...i,pkce:n===`on`||n!==`off`&&null,...t?{clientSecret:t}:{}})}}),d=(e,n,r={})=>(0,j.jsx)(u.Field,{name:e,children:i=>(0,j.jsx)(cg,{label:n,path:`${t}.${e}`,value:i.state.value,onChange:t=>{i.handleChange(t),c(t=>({...t,[e]:void 0}))},error:s[e],...r})}),f=(0,j.jsxs)(j.Fragment,{children:[d(`authURL`,`Auth URL`,{type:`url`,required:a?.needsURLs}),d(`tokenURL`,`Token URL`,{type:`url`,required:a?.needsURLs}),d(`userInfoURL`,`User info URL`,{type:`url`,required:a?.needsURLs})]});return(0,j.jsx)(Ol,{open:!0,onClose:n,title:`${a?.displayName??e.name} provider`,footer:(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(w,{onClick:n,children:`Cancel`}),(0,j.jsx)(w,{variant:`primary`,onClick:()=>void u.handleSubmit(),children:i})]}),children:(0,j.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,j.jsx)(X,{}),d(`clientId`,`Client ID`),d(`clientSecret`,`Client secret`,{type:`password`,hint:o?`Leave empty to keep the current value`:void 0}),e.name===`apple`&&(0,j.jsxs)(`fieldset`,{className:`flex flex-col gap-2 rounded border border-line p-3`,children:[(0,j.jsx)(`legend`,{className:`px-1 text-sm font-medium`,children:`Generate client secret`}),(0,j.jsx)(ug,{clientId:()=>u.state.values.clientId,onSecret:e=>u.setFieldValue(`clientSecret`,e)})]}),d(`displayName`,`Display name`),(0,j.jsx)(u.Field,{name:`pkce`,children:e=>(0,j.jsxs)(Vl,{label:`PKCE`,value:e.state.value,onChange:t=>e.handleChange(t.target.value),children:[(0,j.jsx)(`option`,{value:`unset`,children:`Provider default`}),(0,j.jsx)(`option`,{value:`on`,children:`On`}),(0,j.jsx)(`option`,{value:`off`,children:`Off`})]})}),a?.needsURLs?f:(0,j.jsx)(Il,{title:`Custom endpoints`,children:(0,j.jsx)(`div`,{className:`flex flex-col gap-3`,children:f})})]})})}function ug({clientId:e,onSecret:t}){let n=z(),[r,i]=(0,T.useState)(null),a=Ed({defaultValues:{teamId:``,keyId:``,privateKey:``,duration:sg},onSubmit:async({value:r})=>{i(null);try{let{secret:i}=await n.settings.generateAppleClientSecret(e(),r.teamId,r.keyId,r.privateKey,r.duration);t(i)}catch(e){i(e)}}});return(0,j.jsxs)(jd,{error:r,children:[(0,j.jsx)(X,{}),(0,j.jsx)(a.Field,{name:`teamId`,children:e=>(0,j.jsx)(cg,{label:`Team ID`,path:`teamId`,value:e.state.value,onChange:e.handleChange})}),(0,j.jsx)(a.Field,{name:`keyId`,children:e=>(0,j.jsx)(cg,{label:`Key ID`,path:`keyId`,value:e.state.value,onChange:e.handleChange})}),(0,j.jsx)(a.Field,{name:`privateKey`,children:e=>(0,j.jsx)(dg,{value:e.state.value,onChange:e.handleChange})}),(0,j.jsx)(a.Field,{name:`duration`,children:e=>(0,j.jsx)(fg,{value:e.state.value,onChange:e.handleChange})}),(0,j.jsx)(a.Subscribe,{selector:e=>e.isSubmitting,children:e=>(0,j.jsx)(w,{className:`self-start`,loading:e,onClick:()=>void a.handleSubmit(),children:`Generate client secret`})})]})}function dg(e){return(0,j.jsx)(m,{label:`Private key`,rows:4,value:e.value,error:Y(`privateKey`),onChange:e.onChange})}function fg(e){return(0,j.jsx)(zl,{label:`Duration (seconds)`,max:sg,value:e.value,error:Y(`duration`),onChange:t=>e.onChange(Number(t.target.value))})}var pg=/\n?<!-- hb:mjml:([A-Za-z0-9+/=]*) -->\s*$/;function mg(e){let t=``;for(let n of new TextEncoder().encode(e))t+=String.fromCharCode(n);return btoa(t)}function hg(e){let t=Uint8Array.from(atob(e),e=>e.charCodeAt(0));return new TextDecoder(`utf-8`,{fatal:!0}).decode(t)}function gg(e,t){return`${e}\n<!-- hb:mjml:${mg(t)} -->`}function _g(e){let t=pg.exec(e);if(!t)return null;try{return hg(t[1])}catch{return null}}function vg(e){return e.replace(pg,``)}function yg(e){let t=/<head[^>]*>([\s\S]*?)<\/head>/i.exec(e)?.[1]??``,n=/<body[^>]*>([\s\S]*?)<\/body>/i.exec(e)?.[1]??e;return`${t.replace(/<title>[\s\S]*?<\/title>/gi,``).replace(/<meta [^>]*>/gi,``).trim()}\n${n.trim()}`}var bg=()=>Kf(()=>import(`./lib-C_lvLDN7.js`).then(t=>e(t.default,1)).then(e=>e.default),__vite__mapDeps([3,1])),xg=null;async function Sg(e,t=bg){xg?.load!==t&&(xg={load:t,promise:t()});let n;try{n=await xg.promise}catch(e){return xg=null,{html:``,errors:[J(e)]}}try{let t=await n(e,{validationLevel:`soft`,fonts:{}});return{html:yg(t.html),errors:t.errors.map(e=>`Line ${e.line}: ${e.message}`)}}catch(e){return{html:``,errors:[J(e)]}}}var Cg=e=>` <mj-text>${e}</mj-text>`,wg=(e,t)=>` <mj-button href="{APP_URL}/_/#/auth/${e}/{TOKEN}" background-color="#16161a">${t}</mj-button>`;function Tg(e,t){return[`<mjml>`,` <mj-head>`,` <mj-title>${e}</mj-title>`,` <mj-attributes>`,` <mj-all font-family="-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif" />`,` <mj-text font-size="14px" line-height="1.5" />`,` </mj-attributes>`,` </mj-head>`,` <mj-body>`,` <mj-section>`,` <mj-column>`,Cg(`Hello,`),...t,Cg(`Thanks,<br />{APP_NAME} team`),` </mj-column>`,` </mj-section>`,` </mj-body>`,`</mjml>`,``].join(`
|
|
21
|
+
`)}function Eg(e,t){let n=t?`{APP_NAME} superuser account`:`{APP_NAME} account`;switch(e){case`verification`:return Tg(`Verify your {APP_NAME} email`,[Cg(t?`Click on the button below to verify the email of your {APP_NAME} superuser account.`:`Thank you for joining us at {APP_NAME}. Click on the button below to verify your email address.`),wg(`confirm-verification`,`Verify`),Cg(`<i>If you didn't recently register, please ignore this email.</i>`)]);case`resetPassword`:return Tg(`Reset your {APP_NAME} password`,[Cg(`Click on the button below to reset the password of your ${n}.`),wg(`confirm-password-reset`,`Reset password`),Cg(`<i>If you didn't ask to reset your password, please ignore this email.</i>`)]);case`confirmEmailChange`:return Tg(`Confirm your {APP_NAME} new email address`,[Cg(`Click on the button below to confirm the new email address of your ${n}.`),wg(`confirm-email-change`,`Confirm new email`),Cg(`<i>If you didn't ask to change your email address, please ignore this email.</i>`)]);case`otp`:return Tg(`OTP for {APP_NAME}`,[Cg(`Your one-time password for your ${n} is: <strong>{OTP}</strong>`),Cg(`<i>If you didn't ask for the one-time password, you can ignore this email.</i>`)]);case`authAlert`:return Tg(`Login from a new location`,[Cg(`We noticed a login to your ${n} from a new location:`),Cg(`<em>{ALERT_INFO}</em>`),Cg(`<strong>If this wasn't you, you should immediately change your {APP_NAME} account password to revoke access from all other locations.</strong>`),Cg(`If this was you, you may disregard this email.`)])}}var Dg=(0,T.createContext)(null),Og=Dg.Provider;function kg(){let[e,t]=(0,T.useState)({}),n=(0,T.useRef)({}),r={states:e,put:(e,n)=>t(t=>({...t,[e]:n})),ticket:e=>n.current[e]=(n.current[e]??0)+1,latest:(e,t)=>n.current[e]===t},i=Object.values(e);return{store:r,invalid:i.some(e=>e.error),compiling:i.some(e=>e.compiling),reset:()=>t({})}}var Ag=`Placeholders: {APP_NAME}, {APP_URL}, {TOKEN}, {OTP}, {OTP_ID}, {RECORD:<field>}, {ALERT_INFO}`;function jg({c:e,path:t,label:n,kind:r,superuser:i,actions:a}){let o=(0,T.useContext)(Dg),s=Ml(),[c,l]=(0,T.useState)(!1),u=t,d=`${t}.body`,f=e.form.getFieldValue(t)?.body??``,p=Y(d),h=_g(f),g=h===null&&!e.draft.id,_=o.states[u]??{mode:h!==null||g?`mjml`:`html`,source:h??(g?Eg(r,i):``),error:null,compiling:!1},v=async t=>{let n=o.ticket(u);o.put(u,{mode:`mjml`,source:t,error:null,compiling:!0});let{html:r,errors:i}=await Sg(t);if(!o.latest(u,n))return;let a=i.length>0?i.join(` `):null;o.put(u,{mode:`mjml`,source:t,error:a,compiling:!1}),a||e.form.setFieldValue(d,gg(r,t))};(0,T.useEffect)(()=>{g&&!o.states[u]&&v(_.source)},[]);let y=async()=>{if(h!==null)return void v(h);await s({title:`Convert to MJML`,message:`The HTML body is replaced by the MJML starter for this email.`,confirmLabel:`Convert`})&&v(Eg(r,i))},b=async()=>{await s({title:`Edit as HTML`,message:`The MJML source is dropped on your first HTML edit. Until then, Convert to MJML brings it back.`,confirmLabel:`Edit as HTML`})&&o.put(u,{..._,mode:`html`,error:null})},x=vg(f);return(0,j.jsxs)(j.Fragment,{children:[_.mode===`mjml`?(0,j.jsx)(m,{label:`Body (MJML)`,language:`html`,rows:12,value:_.source,error:p??_.error??void 0,hint:Ag,onChange:e=>void v(e)}):(0,j.jsx)(m,{label:`Body (HTML)`,language:`html`,rows:8,value:x,error:p,hint:Ag,onChange:t=>e.form.setFieldValue(d,t)}),(0,j.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[_.mode===`mjml`?(0,j.jsx)(w,{onClick:()=>void b(),children:`Edit as HTML`}):(0,j.jsx)(w,{onClick:()=>void y(),children:`Convert to MJML`}),(0,j.jsx)(w,{"aria-expanded":c,onClick:()=>l(!c),children:c?`Hide preview`:`Show preview`}),a]}),c&&(0,j.jsx)(`iframe`,{sandbox:``,title:`${n} preview`,srcDoc:x,className:`h-72 w-full rounded border border-line-strong bg-surface`})]})}function Mg({collection:e,template:t,onClose:n}){let r=z(),i=Ql(),[a,o]=(0,T.useState)(null),s=Ed({defaultValues:{email:``},onSubmit:async({value:a})=>{o(null);try{await r.settings.testEmail(e,a.email,t),i.success(`Test email sent.`),n()}catch(e){o(e)}}});return(0,j.jsx)(jd,{error:a,children:(0,j.jsx)(Ol,{open:!0,onClose:n,title:`Send test email`,footer:(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(w,{onClick:n,children:`Cancel`}),(0,j.jsx)(s.Subscribe,{selector:e=>e.isSubmitting,children:e=>(0,j.jsx)(w,{type:`submit`,form:`test-email`,variant:`primary`,loading:e,children:`Send`})})]}),children:(0,j.jsxs)(`form`,{id:`test-email`,onSubmit:e=>{e.preventDefault(),s.handleSubmit()},className:`flex flex-col gap-3`,children:[(0,j.jsx)(X,{}),(0,j.jsx)(s.Field,{name:`email`,children:e=>(0,j.jsx)(Ng,{value:e.state.value,onChange:e.handleChange})})]})})})}function Ng({value:e,onChange:t}){return(0,j.jsx)(kl,{label:`Email`,type:`email`,required:!0,value:e,error:Y(`email`),onChange:e=>t(e.target.value)})}var Pg=[{path:`verificationTemplate`,label:`Verification email`,kind:`verification`,template:`verification`},{path:`resetPasswordTemplate`,label:`Password reset email`,kind:`resetPassword`,template:`password-reset`},{path:`confirmEmailChangeTemplate`,label:`Email change email`,kind:`confirmEmailChange`,template:`email-change`},{path:`otp.emailTemplate`,label:`OTP email`,kind:`otp`,template:`otp`},{path:`authAlert.emailTemplate`,label:`Login alert email`,kind:`authAlert`,template:`login-alert`}];function Fg({c:e,saved:t}){let[n,r]=(0,T.useState)(null);return(0,j.jsxs)(og,{title:`Email templates`,prefixes:Pg.map(e=>e.path),children:[Pg.map(({path:n,label:i,kind:a,template:o})=>{let s=JSON.stringify(e.form.getFieldValue(n))!==JSON.stringify(tg(t,n));return(0,j.jsxs)(`fieldset`,{className:ag,children:[(0,j.jsx)(`legend`,{className:`px-1 text-sm font-medium`,children:i}),(0,j.jsx)(ng,{c:e,path:`${n}.subject`,label:`Subject`}),(0,j.jsx)(jg,{c:e,path:n,label:i,kind:a,superuser:e.draft.name===`_superusers`,actions:t&&(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(w,{disabled:s,onClick:()=>r(o),children:`Send test email`}),s&&(0,j.jsx)(`span`,{className:`self-center text-xs text-muted`,children:`Save first: the test email uses the saved template.`})]})})]},o)}),n&&t&&(0,j.jsx)(Mg,{collection:t.name,template:n,onClose:()=>r(null)})]})}var Ig=[[`authToken`,`Auth token`],[`verificationToken`,`Verification token`],[`passwordResetToken`,`Password reset token`],[`emailChangeToken`,`Email change token`],[`fileToken`,`File token`]];function Lg({c:e}){return(0,j.jsx)(og,{title:`Tokens`,prefixes:Ig.map(([e])=>e),children:Ig.map(([t,n])=>{let r=!!e.draft[t]?.secret;return(0,j.jsxs)(`fieldset`,{className:ag,children:[(0,j.jsx)(`legend`,{className:`px-1 text-sm font-medium`,children:n}),(0,j.jsx)(rg,{c:e,path:`${t}.duration`,label:`Duration (seconds)`}),r?(0,j.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,j.jsx)(`span`,{children:`All issued tokens stop working on save.`}),(0,j.jsx)(w,{onClick:()=>e.form.setFieldValue(`${t}.secret`,void 0),children:`Undo`})]}):(0,j.jsx)(w,{className:`self-start`,onClick:()=>e.form.setFieldValue(`${t}.secret`,eg()),children:`Invalidate all issued tokens`})]},t)})})}function Rg({form:e,draft:t,clearError:n,saved:r}){let i=af(),a={form:e,draft:t,clearError:n};return(0,j.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[t.name!==`_superusers`&&(0,j.jsx)(Vg,{c:a}),(0,j.jsxs)(og,{title:`Password auth`,prefixes:[`passwordAuth`],defaultOpen:!0,children:[(0,j.jsx)(ig,{c:a,path:`passwordAuth.enabled`,label:`Enable password auth`}),(0,j.jsx)(zg,{c:a})]}),(0,j.jsxs)(og,{title:`One-time password`,prefixes:[`otp`],children:[(0,j.jsx)(ig,{c:a,path:`otp.enabled`,label:`Enable one-time password`}),(0,j.jsx)(rg,{c:a,path:`otp.duration`,label:`OTP duration (seconds)`}),(0,j.jsx)(rg,{c:a,path:`otp.length`,label:`OTP length`})]}),(0,j.jsxs)(og,{title:`Multi-factor auth`,prefixes:[`mfa`],children:[(0,j.jsx)(ig,{c:a,path:`mfa.enabled`,label:`Enable multi-factor auth`,hint:`Needs at least two other auth methods.`}),(0,j.jsx)(rg,{c:a,path:`mfa.duration`,label:`MFA duration (seconds)`}),(0,j.jsx)(e.Field,{name:`mfa.rule`,children:e=>(0,j.jsx)(uh,{label:`MFA rule`,lockable:!1,value:e.state.value??``,onChange:t=>e.handleChange(t??``),chips:fh(t,i.data??[],`mfaRule`),suggest:ph(t,i.data??[],`mfaRule`),errorPath:`mfa.rule`,emptyHint:`Empty rule: MFA applies to every account.`})})]}),(0,j.jsx)(og,{title:`Login alerts`,prefixes:[`authAlert`],children:(0,j.jsx)(ig,{c:a,path:`authAlert.enabled`,label:`Send login alerts`})}),(0,j.jsx)(Lg,{c:a}),(0,j.jsx)(Fg,{c:a,saved:r})]})}function zg({c:e}){let t=Y(`passwordAuth.identityFields`),n=e.draft.passwordAuth?.identityFields??[],r=new Set(Nm(e.draft).filter(e=>!e.hidden).map(e=>e.name)),i=[...new Set(Pm(e.draft).map(xm).filter(e=>e?.unique&&e.columns.length===1).map(e=>e.columns[0]).filter(e=>r.has(e)))];return(0,j.jsxs)(`fieldset`,{className:`flex flex-col gap-1`,children:[(0,j.jsx)(`legend`,{className:`text-sm font-medium`,children:`Identity fields`}),(0,j.jsx)(`div`,{className:`flex flex-wrap gap-3`,children:i.map(t=>(0,j.jsx)(Ps,{label:t,checked:n.includes(t),onChange:r=>e.form.setFieldValue(`passwordAuth.identityFields`,r.target.checked?[...n,t]:n.filter(e=>e!==t))},t))}),(0,j.jsx)(`p`,{className:`text-xs text-muted`,children:`Fields with a single column unique index.`}),t&&(0,j.jsx)(`p`,{className:`text-xs text-danger-text`,children:t})]})}var Bg=[[`id`,`ID field`],[`name`,`Name field`],[`username`,`Username field`],[`avatarURL`,`Avatar URL field`]];function Vg({c:e}){let t=e.draft.oauth2?.providers??[],[n,r]=(0,T.useState)(``),[i,a]=(0,T.useState)(null),o=Qh.filter(e=>!t.some(t=>t.name===e.name)),s=t=>{e.clearError(),e.form.setFieldValue(`oauth2.providers`,t)},c=Nm(e.draft).map(e=>e.name);return(0,j.jsxs)(og,{title:`OAuth2`,prefixes:[`oauth2`],defaultOpen:!0,children:[(0,j.jsx)(ig,{c:e,path:`oauth2.enabled`,label:`Enable OAuth2`}),(0,j.jsx)(`ul`,{className:`flex flex-col gap-2`,children:t.map((e,n)=>(0,j.jsx)(Hg,{provider:e,errorPath:`oauth2.providers.${n}`,onEdit:()=>a({index:n,provider:e}),onRemove:()=>s(t.filter((e,t)=>t!==n))},e.name))}),(0,j.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,j.jsx)(`div`,{className:`flex-1`,children:(0,j.jsxs)(Vl,{label:`Provider`,value:n,onChange:e=>r(e.target.value),children:[(0,j.jsx)(`option`,{value:``,disabled:!0,children:`Choose a provider`}),o.map(e=>(0,j.jsxs)(`option`,{value:e.name,children:[e.displayName,` (`,e.name,`)`]},e.name))]})}),(0,j.jsx)(w,{disabled:!n,onClick:()=>{a({index:null,provider:{name:n}}),r(``)},children:`Add provider`})]}),(0,j.jsxs)(`fieldset`,{className:ag,children:[(0,j.jsx)(`legend`,{className:`px-1 text-sm font-medium`,children:`Mapped fields`}),Bg.map(([t,n])=>(0,j.jsx)(e.form.Field,{name:`oauth2.mappedFields.${t}`,children:e=>(0,j.jsxs)(Vl,{label:n,value:e.state.value??``,onChange:t=>e.handleChange(t.target.value),children:[(0,j.jsx)(`option`,{value:``,children:`Not mapped`}),c.map(e=>(0,j.jsx)(`option`,{value:e,children:e},e))]})},t))]}),i&&(0,j.jsx)(lg,{provider:i.provider,errorPath:i.index===null?`oauth2.providers.new`:`oauth2.providers.${i.index}`,onCancel:()=>a(null),onSave:n=>{i.index===null?s([...t,n]):e.form.setFieldValue(`oauth2.providers`,t.map((e,t)=>t===i.index?n:e)),a(null)}})]})}function Hg({provider:e,errorPath:t,onEdit:n,onRemove:r}){let i=Md(`${t}.`),a=String(e.displayName||``)||Qh.find(t=>t.name===e.name)?.displayName||e.name;return(0,j.jsxs)(`li`,{className:`flex flex-col gap-1 rounded border border-line p-2`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(Zh,{name:e.name,displayName:a}),(0,j.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm`,children:a}),(0,j.jsx)(w,{variant:`ghost`,"aria-label":`Edit provider ${a}`,onClick:n,children:`Edit`}),(0,j.jsx)(w,{variant:`ghost`,"aria-label":`Remove provider ${a}`,onClick:r,children:`Remove`})]}),i.map(([e,n])=>(0,j.jsxs)(`p`,{className:`text-xs text-danger-text`,children:[e.slice(t.length+1),`: `,n]},e))]})}var Ug=[`authAlert`,`oauth2`,`passwordAuth`,`mfa`,`otp`,`authToken`,`passwordResetToken`,`emailChangeToken`,`verificationToken`,`fileToken`,`verificationTemplate`,`resetPasswordTemplate`,`confirmEmailChangeTemplate`];function Wg(e){let t=e.split(`.`)[0];return hh.includes(t)?`rules`:[`fields`,`indexes`,`viewQuery`].includes(t)?`fields`:Ug.includes(t)?`options`:null}var Gg=(e,t)=>JSON.stringify(Im(e))===JSON.stringify(Im(t));function Kg(e){let t=z();return ks({queryKey:[`collectionScaffolds`],queryFn:({signal:e})=>t.collections.scaffolds({signal:e}),enabled:e})}function qg({collection:e,onClose:t}){let n=Kg(!e);return!e&&!n.data?(0,j.jsx)(Ol,{open:!0,variant:`side`,onClose:t,title:`New collection`,children:(0,j.jsx)(rm,{query:n})}):(0,j.jsx)(Jg,{collection:e,onClose:t})}function Jg({collection:e,onClose:t}){let n=z(),r=oo(),i=Br(),{collectionId:a}=Rr({strict:!1}),o=Ml(),s=Ql(),c=(0,T.useId)(),[l,u]=(0,T.useState)(e),d=Kg(!l),[f,p]=(0,T.useState)(()=>e?Om(e):km(`base`,d.data)),[m,h]=(0,T.useState)(`fields`),[g,_]=(0,T.useState)(null),[v,y]=(0,T.useState)(null),b=kg(),x=async e=>{y(null),_(null);try{let o=Im(e),c=l?await n.collections.update(l.id,o):await n.collections.create(o);l&&a===l.name&&c.name!==l.name&&await i({to:`/collections/$collectionId`,params:{collectionId:c.id},replace:!0}),await r.invalidateQueries({queryKey:tf.collections}),await r.invalidateQueries({queryKey:[`records`,c.id]}),s.success(l?`Collection saved.`:`Collection created.`),t(),l||i({to:`/collections/$collectionId`,params:{collectionId:c.id}})}catch(e){_(e);let t=Object.keys(Od(Ad(e))).map(Wg),n=t.find(e=>e!==null);n&&!t.includes(ue)&&h(n)}},S=zm(f,async(e,t)=>{if(!(b.invalid||b.compiling)){if(l&&!t){let t=Lm(l,e);if(Rm(t))return y(t)}await x(e)}}),C=Mr(S.store,e=>e.values),ee=e=>{p(e),S.reset(e),_(null),b.reset()},te=()=>_(null),ne=async()=>Gg(S.state.values,f)||await o({title:`Discard unsaved changes?`,message:`Your edits to this collection will be lost.`,confirmLabel:`Discard`,danger:!0}),re=async()=>{await ne()&&t()},ie=e=>{if(!d.data)return;let t=S.state.values;b.reset();let n=Mm(km(e,d.data),t.name);if(e===`view`)return S.reset(n,{keepDefaultValues:!0});let r=new Set(d.data[t.type].indexes.map(e=>xm(e)?.name)),i=Pm(t).filter(e=>!r.has(xm(e)?.name));S.reset(Fm({...n,fields:[...n.fields,...t.fields.filter(e=>!e.system)]},[...Pm(n),...i]),{keepDefaultValues:!0})},ae=e=>{te();let t=Fm(S.state.values,e);S.setFieldValue(`_originalName`,t._originalName),S.setFieldValue(`fields`,t.fields),S.setFieldValue(`indexes`,t.indexes)},E=async()=>{l&&await ne()&&(u(void 0),ee(Am(l)))},oe=async()=>{if(l&&await o({title:`Truncate collection`,message:`Delete all records of ${l.name}? This cannot be undone.`,confirmLabel:`Truncate`,danger:!0,typeToConfirm:l.name}))try{await n.collections.truncate(l.id),await r.invalidateQueries({queryKey:[`records`]}),s.success(`Collection truncated.`)}catch(e){s.error(J(e))}},se=async()=>{if(l&&await o({title:`Delete collection`,message:`Delete ${l.name} with all its records? This cannot be undone.`,confirmLabel:`Delete`,danger:!0,typeToConfirm:l.name}))try{await n.collections.delete(l.id),await r.invalidateQueries({queryKey:tf.collections}),s.success(`Collection deleted.`),t(),i({to:`/collections`})}catch(e){s.error(J(e))}},ce=!!l?.system,le=[{value:`fields`,label:C.type===`view`?`Query`:`Fields`},{value:`rules`,label:`API rules`},...C.type===`auth`?[{value:`options`,label:`Auth`}]:[]],ue=le.some(e=>e.value===m)?m:`fields`;return(0,j.jsx)(Og,{value:b.store,children:(0,j.jsxs)(jd,{error:g,children:[(0,j.jsx)(Ol,{open:!0,variant:`side`,onClose:()=>void re(),title:l?`Edit ${l.name}`:`New collection`,footer:(0,j.jsxs)(j.Fragment,{children:[l&&(0,j.jsxs)(`div`,{className:`mr-auto flex gap-2`,children:[(0,j.jsx)(w,{onClick:()=>void E(),children:`Duplicate`}),!ce&&l.type!==`view`&&(0,j.jsx)(au,{trigger:(0,j.jsx)(w,{"aria-label":`More actions`,icon:(0,j.jsx)(fc,{size:15,strokeWidth:1.75}),className:`w-9 px-0`}),items:[{key:`truncate`,label:`Truncate`,danger:!0}],onAction:()=>void oe(),placement:`top-start`}),!ce&&(0,j.jsx)(w,{variant:`danger`,onClick:()=>void se(),children:`Delete`})]}),b.invalid&&(0,j.jsx)(`span`,{className:`self-center text-sm text-danger-text`,children:`Fix the MJML errors in the email templates before saving.`}),(0,j.jsx)(w,{onClick:()=>void re(),children:`Cancel`}),(0,j.jsx)(S.Subscribe,{selector:e=>e.isSubmitting,children:e=>(0,j.jsx)(w,{type:`submit`,form:c,variant:`primary`,loading:e,disabled:b.invalid||b.compiling,children:l?`Save changes`:`Create`})})]}),children:(0,j.jsxs)(`form`,{id:c,onSubmit:e=>{e.preventDefault(),S.handleSubmit()},className:`flex flex-col gap-4`,children:[(0,j.jsx)(X,{}),(0,j.jsxs)(`div`,{className:`grid grid-cols-[1fr_9rem] items-start gap-3`,children:[(0,j.jsx)(`div`,{children:(0,j.jsx)(S.Field,{name:`name`,children:e=>(0,j.jsx)(Yg,{label:`Name`,path:`name`,value:e.state.value,disabled:ce,onChange:e.handleChange})})}),(0,j.jsxs)(Vl,{label:`Type`,value:C.type,disabled:!!l,onChange:e=>ie(e.target.value),children:[(0,j.jsx)(`option`,{value:`base`,children:`Base`}),(0,j.jsx)(`option`,{value:`view`,children:`View`}),(0,j.jsx)(`option`,{value:`auth`,children:`Auth`})]})]}),(0,j.jsx)(Jl,{label:`Collection sections`,tabs:le,value:ue,onChange:h}),ue===`fields`&&(C.type===`view`?(0,j.jsx)(Xg,{form:S,draft:C}):(0,j.jsx)(Zg,{form:S,draft:C,clearError:te,onIndexes:ae})),ue===`rules`&&(0,j.jsx)(_h,{form:S,draft:C}),ue===`options`&&(0,j.jsx)(Rg,{form:S,draft:C,clearError:te,saved:l})]})}),v&&(0,j.jsx)(im,{changes:v,onCancel:()=>y(null),onConfirm:()=>void S.handleSubmit({confirmed:!0})})]})})}function Yg({label:e,path:t,value:n,disabled:r,onChange:i}){return(0,j.jsx)(kl,{label:e,value:n,disabled:r,error:Y(t),onChange:e=>i(e.target.value)})}function Xg({form:e,draft:t}){let n=Y(`viewQuery`),r=nf(),i=af(),a=(0,T.useMemo)(()=>ah(i.data??[]),[i.data]);return(0,j.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,j.jsx)(e.Field,{name:`viewQuery`,children:e=>(0,j.jsx)(m,{label:`Select query`,language:`sql`,sqlSchema:r,completions:a,rows:8,value:e.state.value??``,error:n,onChange:e.handleChange})}),t.fields.length>0&&(0,j.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,j.jsx)(`p`,{className:`text-sm font-medium`,children:`Fields from the saved query`}),(0,j.jsx)(`ul`,{"aria-label":`View fields`,className:`flex flex-wrap gap-2`,children:t.fields.map(e=>(0,j.jsx)(`li`,{className:`rounded bg-hover px-2 py-0.5 font-mono text-xs`,children:e.name},e._key))})]})]})}function Zg({form:e,draft:t,clearError:n,onIndexes:r}){let[i,a]=(0,T.useState)(`text`),o=Mr(e.store,e=>e.values.fields.map(e=>e._key)),s=Mr(e.store,e=>e.values.fields.map(e=>!!e._removed)),c=0,l=s.map(e=>e?-1:c++),[u,d]=(0,T.useState)(null),[f,p]=(0,T.useState)(null),m=()=>{d(null),p(null)},h=t=>{let r=e.getFieldValue(`fields[${t}]`);r.system||(n(),r.id?e.setFieldValue(`fields[${t}]._removed`,!0):e.removeFieldValue(`fields`,t))};return(0,j.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[o.map((t,r)=>(0,j.jsx)(`div`,{className:f===r&&u!==r?`rounded outline-2 outline-focus`:void 0,onDragOver:e=>{u!==null&&(e.preventDefault(),p(r))},onDrop:t=>{t.preventDefault(),u!==null&&u!==r&&(n(),e.moveFieldValues(`fields`,u,r)),m()},children:(0,j.jsx)(e.Field,{name:`fields[${r}]`,children:t=>(0,j.jsx)(th,{field:t.state.value,errorPath:`fields.${s[r]?-1:l[r]}`,canMoveUp:r>0,canMoveDown:r<o.length-1,onChange:e=>t.handleChange(t=>({...t,...e})),onMove:t=>{n(),e.moveFieldValues(`fields`,r,r+t)},onDragStart:()=>d(r),onDragEnd:m,onRemove:()=>h(r),onRestore:()=>{n(),e.setFieldValue(`fields[${r}]._removed`,!1)}})})},t)),(0,j.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,j.jsx)(`div`,{className:`flex-1`,children:(0,j.jsx)(Vl,{label:`New field type`,value:i,onChange:e=>a(e.target.value),children:sm.map(e=>(0,j.jsx)(`option`,{value:e.type,children:e.label},e.type))})}),(0,j.jsx)(w,{onClick:()=>{n(),e.pushFieldValue(`fields`,jm(e.state.values.fields,i))},children:`Add field`})]}),(0,j.jsx)(sh,{draft:t,onChange:r})]})}function Qg(){let[e,t]=(0,T.useState)(null);return(0,j.jsxs)(pf.Provider,{value:e=>t({collection:e}),children:[(0,j.jsxs)(`div`,{className:`flex flex-col gap-6 md:flex-row`,children:[(0,j.jsx)(mf,{}),(0,j.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,j.jsx)(vi,{})})]}),e&&(0,j.jsx)(qg,{collection:e.collection,onClose:()=>t(null)})]})}function $g(){let e=af(),t=sf();if(!e.data)return(0,j.jsx)(rm,{query:e});let n=e.data.find(e=>!e.system);return n?(0,j.jsx)(Vr,{to:`/collections/$collectionId`,params:{collectionId:n.id},replace:!0}):(0,j.jsx)(V,{crumbs:[{label:`Collections`}],width:`full`,children:(0,j.jsx)(Ll,{title:`No collections yet`,children:!t&&(0,j.jsx)(vf,{})})})}function e_(){let{collectionId:e}=Rr({strict:!1}),t=af(),[n,r]=(0,T.useState)(),i=t.data?.find(t=>t.id===e||t.name===e),a=!!t.data&&!i,{refetch:o}=t;return(0,T.useEffect)(()=>{a&&n!==e&&(r(e),o())},[a,n,e,o]),i?(0,j.jsx)(nm,{collection:i},i.id):n===e&&!t.isFetching?(0,j.jsx)(V,{crumbs:[{label:`Collections`,to:`/collections`},{label:`Not found`}],width:`full`,children:(0,j.jsx)(Ll,{title:`Collection not found`})}):null}function t_(){let e=Rr({strict:!1})._splat??``,t=cu().pages.find(t=>t.path===e),n=z(),r=(0,T.useRef)(null),[i,a]=(0,T.useState)();return(0,T.useEffect)(()=>{if(t){document.title=`${t.title} - Heybe`,a(void 0);try{let e=t.mount(r.current,{client:n});return()=>{try{e?.()}catch(e){console.warn(`Extension page "${t.path}" cleanup failed`,e)}}}catch(e){a(e instanceof Error?e.message:String(e))}}},[t,n]),t?i?(0,j.jsx)(V,{crumbs:[{label:`Extensions`},{label:t.title}],width:`full`,children:(0,j.jsxs)(`p`,{role:`alert`,className:`text-danger-text`,children:[`Extension "`,t.title,`" failed: `,i]})}):(0,j.jsx)(V,{crumbs:[{label:`Extensions`},{label:t.title}],width:`full`,children:(0,j.jsx)(`div`,{ref:r})}):(0,j.jsx)(V,{crumbs:[{label:`Extensions`}],width:`full`,children:(0,j.jsx)(Ll,{title:`Page not found.`})})}var n_=`hb_theme`;function r_(e,t){return e===`system`?t?`dark`:`light`:e}function i_(){return window.matchMedia?.(`(prefers-color-scheme: dark)`).matches??!1}function a_(){try{let e=localStorage.getItem(n_);if(e===`light`||e===`dark`||e===`system`)return e}catch{}return`system`}function o_(e){document.documentElement.dataset.theme=r_(e,i_());try{localStorage.setItem(n_,e)}catch{}}function s_(){o_(a_())}function c_(){let[e,t]=(0,T.useState)(a_),n=(0,T.useCallback)(e=>{o_(e),t(e)},[]);return(0,T.useEffect)(()=>{if(e!==`system`||!window.matchMedia)return;let t=window.matchMedia(`(prefers-color-scheme: dark)`),n=()=>o_(`system`);return t.addEventListener(`change`,n),()=>t.removeEventListener(`change`,n)},[e]),[e,n]}var l_={size:15,strokeWidth:1.75},u_=[{to:`/collections`,label:`Collections`,icon:(0,j.jsx)(uc,{...l_})},{to:`/collections/$collectionId`,params:{collectionId:`hbc_3142635823`},label:`Superusers`,icon:(0,j.jsx)(cl,{...l_})},{to:`/logs`,label:`Logs`,icon:(0,j.jsx)(el,{...l_})},{to:`/settings`,label:`Settings`,icon:(0,j.jsx)(ol,{...l_})}],d_=`/collections/hbc_3142635823`,f_=`flex items-center gap-2 rounded-control px-2.5 py-1.5 text-muted hover:bg-hover hover:text-text`,p_=`bg-hover font-medium text-text`;function m_({icon:e,children:t}){return(0,j.jsxs)(j.Fragment,{children:[e,t]})}function h_({onNavigate:e}){let{pages:t,links:n}=cu(),{pathname:r}=Ai(),i=of().data?.meta?.appName,a=r===d_||r===`/collections/_superusers`;return(0,j.jsxs)(`nav`,{"aria-label":`Main`,className:`flex h-full w-full flex-col gap-0.5 overflow-y-auto border-r border-line bg-glass p-2 backdrop-blur-(--hb-glass-blur) backdrop-saturate-150`,children:[(0,j.jsxs)(`div`,{className:`mb-2 flex h-9 items-center gap-2 px-2`,children:[(0,j.jsx)(Nd,{}),(0,j.jsx)(`span`,{className:`text-[15px] font-semibold tracking-tight text-text`,children:i||`heybe`})]}),u_.map(t=>(0,j.jsx)(ni,{to:t.to,params:`params`in t?t.params:void 0,className:f_,onClick:e,activeProps:{"aria-current":`page`,className:p_},activeOptions:{exact:t.label===`Superusers`||t.label===`Collections`&&a},children:(0,j.jsx)(m_,{icon:t.icon,children:t.label})},t.label)),(t.length>0||n.length>0)&&(0,j.jsxs)(`div`,{className:`mt-3 flex flex-col gap-0.5`,children:[(0,j.jsx)(`h2`,{className:`px-2.5 text-xs font-medium uppercase text-faint`,children:`Extensions`}),t.map(t=>(0,j.jsx)(ni,{to:`/ext/$`,params:{_splat:t.path},className:f_,onClick:e,activeProps:{"aria-current":`page`,className:p_},children:(0,j.jsx)(m_,{icon:(0,j.jsx)(Qc,{...l_}),children:t.title})},t.path)),n.map(e=>(0,j.jsx)(`a`,{href:e.href,target:`_blank`,rel:`noopener noreferrer`,className:f_,children:(0,j.jsx)(m_,{icon:(0,j.jsx)(Qc,{...l_}),children:e.label})},e.href))]})]})}var g_={size:15,strokeWidth:1.75},__=[{key:`light`,label:`Light`},{key:`dark`,label:`Dark`},{key:`system`,label:`System`}];function v_(){let e=z(),t=oo(),n=Br(),[r,i]=c_(),a=of().data?.meta?.appName;(0,T.useEffect)(()=>{document.title=a||`Heybe`},[a]);let o=e.authStore.record?.email,[s,c]=(0,T.useState)(!1),l=(0,T.useRef)(null),u=(0,T.useRef)(null);(0,T.useEffect)(()=>{let e=l.current;e&&(s&&!e.open&&e.showModal(),!s&&e.open&&e.close())},[s]);let d=[{heading:`Theme`},...__.map(({key:e,label:t})=>({key:e,label:t,checked:r===e,icon:(0,j.jsx)(Js,{...g_,"aria-hidden":!0,className:r===e?``:`invisible`})})),{separator:!0},{key:`sign-out`,label:`Sign out`,icon:(0,j.jsx)(Rc,{...g_})}],f=r=>{r===`sign-out`?(hu({client:e,queryClient:t}),n({to:`/login`})):i(r)};return(0,j.jsxs)(`div`,{className:`flex min-h-dvh bg-bg text-sm text-text`,children:[(0,j.jsx)(`div`,{className:`sticky top-0 hidden h-dvh w-48 shrink-0 md:block`,children:(0,j.jsx)(h_,{})}),(0,j.jsx)(`dialog`,{ref:l,"aria-label":`Menu`,className:`m-0 h-dvh max-h-dvh w-60 max-w-[85vw] bg-transparent p-0 backdrop:bg-scrim`,onClick:e=>{e.target===e.currentTarget&&c(!1)},onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),c(!1))},onClose:()=>{c(!1),u.current?.focus()},children:s&&(0,j.jsx)(h_,{onNavigate:()=>c(!1)})}),(0,j.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,j.jsxs)(`header`,{className:`sticky top-0 z-10 flex h-11 items-center justify-end gap-4 border-b border-line bg-bg px-4`,children:[(0,j.jsx)(`button`,{ref:u,type:`button`,"aria-label":`Open menu`,"aria-haspopup":`dialog`,onClick:()=>c(!0),className:`mr-auto inline-flex size-8 items-center justify-center rounded-control text-muted hover:bg-hover hover:text-text focus-visible:outline-2 focus-visible:outline-focus md:hidden`,children:(0,j.jsx)(Wc,{size:17,strokeWidth:1.75,"aria-hidden":!0})}),o&&(0,j.jsx)(au,{trigger:(0,j.jsx)(w,{variant:`ghost`,size:`sm`,icon:(0,j.jsx)(Xs,{...g_,className:`order-1`}),children:o}),items:d,onAction:f,placement:`bottom-end`})]}),(0,j.jsx)(`main`,{className:`flex flex-1 flex-col p-4`,children:(0,j.jsx)(vi,{})})]})]})}function y_({path:e,label:t,field:n,hint:r,type:i,autoComplete:a}){return(0,j.jsx)(kl,{label:t,hint:r,type:i,autoComplete:a,value:n.state.value,error:Y(e),onChange:e=>n.handleChange(e.target.value)})}function b_(e,t){let[n,r]=(0,T.useState)(String(e));return{value:Number(n)===e?n:String(e),onChange:e=>{r(e.target.value),t(Math.trunc(Number(e.target.value)))}}}function x_({value:e,onChange:t,...n}){return(0,j.jsx)(zl,{step:1,...n,...b_(e,t)})}function S_({path:e,label:t,field:n}){return(0,j.jsx)(x_,{label:t,error:Y(e),value:n.state.value,onChange:n.handleChange})}function C_({path:e,label:t,field:n}){return(0,j.jsx)(Ps,{label:t,checked:n.state.value,error:Y(e),onChange:e=>n.handleChange(e.target.checked)})}function w_({path:e,label:t,field:n}){return(0,j.jsx)(eu,{label:t,checked:n.state.value,error:Y(e),onChange:n.handleChange})}var T_=e=>e.split(`,`).map(e=>e.trim()).filter(Boolean),E_=(e,t)=>e.join(`
|
|
22
|
+
`)===t.join(`
|
|
23
|
+
`);function D_({path:e,label:t,field:n,hint:r,disabled:i}){let[a,o]=(0,T.useState)(()=>n.state.value.join(`, `)),s=E_(T_(a),n.state.value)?a:n.state.value.join(`, `),c=[Y(e),...Md(`${e}.`).map(([t,n])=>`Item ${Number(t.slice(e.length+1).split(`.`)[0])+1}: ${n}`)].filter(Boolean).join(` `)||void 0;return(0,j.jsx)(kl,{label:t,hint:r?`${r} Separate entries with commas.`:`Separate entries with commas.`,disabled:i,value:s,error:c,onChange:e=>{o(e.target.value),n.handleChange(T_(e.target.value))}})}function O_({path:e,label:t,field:n}){return(0,j.jsx)(y_,{path:e,label:t,type:`password`,autoComplete:`new-password`,hint:`Leave empty to keep the current value`,field:n})}function k_({enabled:e,children:t}){return(0,j.jsx)(`fieldset`,{disabled:!e,className:`flex min-w-0 flex-col gap-3 transition-opacity disabled:opacity-60`,children:t})}function A_({on:e}){return(0,j.jsx)(Ns,{tone:e?`success`:`neutral`,children:e?`Enabled`:`Disabled`})}function j_({errorPrefix:e,defaultOpen:t,...n}){let r=Md(e,!1).length>0,[i,a]=(0,T.useState)(!!t||r),[o,s]=(0,T.useState)(r);return r!==o&&(s(r),r&&a(!0)),(0,j.jsx)(Il,{...n,open:i,onOpenChange:a})}function M_({dirty:e,saving:t,onReset:n}){return(0,j.jsxs)(`div`,{role:`group`,"aria-label":`Form actions`,className:`flex items-start justify-between gap-3 border-t border-line pt-4`,children:[(0,j.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,j.jsx)(X,{})}),(0,j.jsxs)(`div`,{className:`flex shrink-0 gap-2`,children:[(0,j.jsx)(w,{disabled:!e,onClick:n,children:`Reset`}),(0,j.jsx)(w,{type:`submit`,variant:`primary`,disabled:!e,loading:t,children:`Save changes`})]})]})}function N_({title:e,width:t,children:n}){return(0,j.jsx)(V,{width:t,crumbs:[{label:`Settings`,to:`/settings`},{label:e}],children:n})}var P_=(e,t)=>JSON.stringify(e)===JSON.stringify(t),F_={smtpPassword:``,s3Secret:``,backupsS3Secret:``},I_={smtpPassword:`smtp.password`,s3Secret:`s3.secret`,backupsS3Secret:`backups.s3.secret`},L_=e=>({settings:e,secrets:F_});function R_(e,t){let n=Ql(),r=Ml(),i=cf(),a=e=>{s.current=e,c.reset(L_(e),{keepDefaultValues:!0})},[o]=(0,T.useState)(()=>L_(e)),s=(0,T.useRef)(e),c=Ed({defaultValues:o,onSubmit:({value:r})=>{let o=lf(e,r.settings);for(let[e,t]of Object.entries(I_)){let n=r.secrets[e];if(!n)continue;let i=t.split(`.`);o[i[0]]??=structuredClone(r.settings[i[0]]);let a=o[i[0]];for(let e of i.slice(1,-1))a=a[e];a[i.at(-1)]=n}i.mutate(o,{onSuccess:e=>{a(e),n.success(`Settings saved.`),t?.()}})}}),l=Mr(c.store,t=>!P_(t.values.settings,e)||Object.values(t.values.secrets).some(Boolean));return(0,T.useEffect)(()=>{!l&&!P_(e,s.current)&&a(e)},[e]),ki({shouldBlockFn:async()=>l&&!await r({title:`Discard unsaved changes?`,message:`Your edits to these settings will be lost.`,confirmLabel:`Discard`,danger:!0}),enableBeforeUnload:()=>l}),{form:c,dirty:l,save:i,submit:e=>{e.preventDefault(),c.handleSubmit()},reset:()=>{i.reset(),a(e)}}}function z_(){let e=of();return(0,j.jsx)(N_,{title:`Application`,children:e.data?(0,j.jsx)(B_,{settings:e.data}):(0,j.jsx)(rm,{query:e})})}function B_({settings:e}){let{form:t,dirty:n,save:r,submit:i,reset:a}=R_(e);return(0,j.jsx)(jd,{error:r.error,children:(0,j.jsxs)(`form`,{onSubmit:i,className:`flex flex-col gap-4`,children:[(0,j.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,j.jsx)(t.Field,{name:`settings.meta.appName`,children:e=>(0,j.jsx)(y_,{path:`meta.appName`,label:`Application name`,field:e})}),(0,j.jsx)(t.Field,{name:`settings.meta.appURL`,children:e=>(0,j.jsx)(y_,{path:`meta.appURL`,label:`Application URL`,field:e})})]}),(0,j.jsx)(t.Field,{name:`settings.meta.hideControls`,children:e=>(0,j.jsx)(w_,{path:`meta.hideControls`,label:`Hide collection controls`,field:e})}),(0,j.jsx)(t.Subscribe,{selector:e=>e.values.settings.batch.enabled,children:e=>(0,j.jsx)(j_,{errorPrefix:`batch.`,title:`Batch API`,badge:(0,j.jsx)(A_,{on:e}),children:(0,j.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,j.jsx)(t.Field,{name:`settings.batch.enabled`,children:e=>(0,j.jsx)(w_,{path:`batch.enabled`,label:`Enable batch API`,field:e})}),(0,j.jsx)(t.Field,{name:`settings.batch.maxRequests`,children:e=>(0,j.jsx)(S_,{path:`batch.maxRequests`,label:`Max requests`,field:e})}),(0,j.jsx)(t.Field,{name:`settings.batch.timeout`,children:e=>(0,j.jsx)(S_,{path:`batch.timeout`,label:`Timeout (seconds)`,field:e})}),(0,j.jsx)(t.Field,{name:`settings.batch.maxBodySize`,children:e=>(0,j.jsx)(S_,{path:`batch.maxBodySize`,label:`Max body size (bytes)`,field:e})})]})})}),(0,j.jsx)(t.Subscribe,{selector:e=>e.values.settings.trustedProxy.headers.length>0,children:e=>(0,j.jsx)(j_,{errorPrefix:`trustedProxy.`,title:`IP proxy headers`,badge:(0,j.jsx)(A_,{on:e}),children:(0,j.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,j.jsx)(t.Field,{name:`settings.trustedProxy.headers`,children:e=>(0,j.jsx)(D_,{path:`trustedProxy.headers`,label:`Trusted proxy headers`,hint:`Headers such as X-Forwarded-For.`,field:e})}),(0,j.jsx)(t.Field,{name:`settings.trustedProxy.useLeftmostIP`,children:e=>(0,j.jsx)(w_,{path:`trustedProxy.useLeftmostIP`,label:`Use leftmost IP`,field:e})})]})})}),(0,j.jsx)(t.Subscribe,{selector:e=>e.values.settings.rateLimits.enabled,children:e=>(0,j.jsx)(j_,{errorPrefix:`rateLimits.`,title:`Rate limiting`,badge:(0,j.jsx)(A_,{on:e}),children:(0,j.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,j.jsx)(t.Field,{name:`settings.rateLimits.enabled`,children:e=>(0,j.jsx)(w_,{path:`rateLimits.enabled`,label:`Enable rate limits`,field:e})}),(0,j.jsxs)(k_,{enabled:e,children:[(0,j.jsx)(t.Field,{name:`settings.rateLimits.rules`,children:e=>(0,j.jsx)(H_,{rules:e.state.value,onChange:e.handleChange})}),(0,j.jsx)(t.Field,{name:`settings.rateLimits.excludedIPs`,children:t=>(0,j.jsx)(D_,{path:`rateLimits.excludedIPs`,label:`Excluded IPs`,disabled:!e,field:t})})]})]})})}),(0,j.jsx)(t.Subscribe,{selector:e=>e.values.settings.superuserIPs.length>0,children:e=>(0,j.jsx)(j_,{errorPrefix:`superuserIPs`,title:`Superuser IPs`,badge:(0,j.jsx)(A_,{on:e}),children:(0,j.jsx)(t.Field,{name:`settings.superuserIPs`,children:e=>(0,j.jsx)(D_,{path:`superuserIPs`,label:`Allowed IPs`,hint:`Leave empty to allow any IP.`,field:e})})})}),(0,j.jsx)(M_,{dirty:n,saving:r.isPending,onReset:a})]})})}var V_={label:``,audience:``,duration:1,maxRequests:1};function H_({rules:e,onChange:t}){return(0,j.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,j.jsxs)(Hl,{caption:`Rate limit rules`,children:[(0,j.jsxs)(`colgroup`,{children:[(0,j.jsx)(`col`,{}),(0,j.jsx)(`col`,{className:`w-28`}),(0,j.jsx)(`col`,{className:`w-32`}),(0,j.jsx)(`col`,{className:`w-36`}),(0,j.jsx)(`col`,{className:`w-12`})]}),(0,j.jsx)(`thead`,{children:(0,j.jsxs)(`tr`,{children:[(0,j.jsx)(Wl,{children:`Label`}),(0,j.jsx)(Wl,{children:`Audience`}),(0,j.jsx)(Wl,{children:`Max requests`}),(0,j.jsx)(Wl,{children:`Duration (seconds)`}),(0,j.jsx)(Wl,{children:(0,j.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]})}),(0,j.jsx)(`tbody`,{children:e.map((n,r)=>(0,j.jsx)(U_,{index:r,rule:n,onChange:n=>t(e.map((e,t)=>t===r?n:e)),onRemove:()=>t(e.filter((e,t)=>t!==r))},r))})]}),(0,j.jsx)(w,{className:`self-start`,onClick:()=>t([...e,{...V_}]),children:`Add rule`})]})}function U_({index:e,rule:t,onChange:n,onRemove:r}){let i=`rateLimits.rules.${e}`,a=e=>(0,j.jsx)(Gl,{children:(0,j.jsx)(`div`,{className:`[&_label]:sr-only`,children:e})});return(0,j.jsxs)(`tr`,{children:[a((0,j.jsx)(kl,{label:`Label`,value:t.label,error:Y(`${i}.label`),onChange:e=>n({...t,label:e.target.value})})),a((0,j.jsxs)(Vl,{label:`Audience`,value:t.audience,error:Y(`${i}.audience`),onChange:e=>n({...t,audience:e.target.value}),children:[(0,j.jsx)(`option`,{value:``,children:`All`}),(0,j.jsx)(`option`,{value:`@guest`,children:`@guest`}),(0,j.jsx)(`option`,{value:`@auth`,children:`@auth`})]})),a((0,j.jsx)(x_,{label:`Max requests`,value:t.maxRequests,error:Y(`${i}.maxRequests`),onChange:e=>n({...t,maxRequests:e})})),a((0,j.jsx)(x_,{label:`Duration (seconds)`,value:t.duration,error:Y(`${i}.duration`),onChange:e=>n({...t,duration:e})})),(0,j.jsx)(Gl,{children:(0,j.jsx)(w,{variant:`ghost`,size:`sm`,"aria-label":`Remove rule ${e+1}`,icon:(0,j.jsx)(gl,{size:15,strokeWidth:1.75}),onClick:r})})]})}var W_={[-4]:`DEBUG`,0:`INFO`,4:`WARN`,8:`ERROR`},G_=e=>W_[e]??String(e),K_=e=>e==null?``:typeof e==`string`?e:JSON.stringify(e);function q_({id:e,onClose:t}){let n=z(),r=ks({queryKey:[`logs`,`one`,e],queryFn:({signal:t})=>n.logs.findOne(e,{signal:t})}),i=(r.data?[[`id`,r.data.id],[`created`,Tf(r.data.created,`full`)],[`level`,G_(r.data.level)],[`message`,r.data.message],...Object.entries(r.data.data).map(([e,t])=>[e,K_(t)])]:[]).filter(([,e])=>e!==``);return(0,j.jsxs)(Ol,{open:!0,onClose:t,title:`Log details`,footer:(0,j.jsxs)(j.Fragment,{children:[r.data&&(0,j.jsx)(Fl,{label:`Copy JSON`,showLabel:!0,text:JSON.stringify(r.data,null,2)}),(0,j.jsx)(w,{onClick:t,children:`Close`})]}),children:[r.isPending&&(0,j.jsx)(`p`,{role:`status`,className:`text-sm text-muted`,children:`Loading...`}),r.error&&(0,j.jsx)(`p`,{role:`alert`,children:J(r.error)}),(0,j.jsx)(`dl`,{className:`grid grid-cols-[7rem_minmax(0,1fr)] gap-x-4 gap-y-2 text-sm`,children:i.map(([e,t])=>(0,j.jsxs)(`div`,{className:`contents`,children:[(0,j.jsx)(`dt`,{className:`truncate font-medium text-muted`,title:e,children:e}),(0,j.jsx)(`dd`,{className:`min-w-0 whitespace-pre-wrap font-mono text-xs [overflow-wrap:anywhere]`,children:t})]},e))})]})}var J_=36e5,Y_=e=>Tf(new Date(e));function X_({stats:e}){if(e.length===0)return(0,j.jsx)(`p`,{className:`text-sm text-muted`,children:`No logs for this filter.`});let t=new Map(e.map(e=>[Date.parse(e.date.replace(` `,`T`)),e.total])),n=[...t.keys()],r=Math.max(...n),i=Math.min(Math.min(...n),r-23*J_),a=Array.from({length:(r-i)/J_+1},(e,t)=>i+t*J_),o=e.reduce((e,t)=>e+t.total,0),s=Math.max(...e.map(e=>e.total)),c=[...new Set([s,Math.round(s/2),0])],l=[i,i+Math.floor((a.length-1)/2)*J_,r];return(0,j.jsxs)(`div`,{role:`img`,"aria-label":`Requests per hour, ${o} in total`,className:`flex gap-2 text-xs text-faint`,children:[(0,j.jsx)(`div`,{className:`flex h-28 flex-col justify-between text-right tabular-nums`,children:c.map(e=>(0,j.jsx)(`span`,{children:e},e))}),(0,j.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,j.jsx)(`div`,{className:`flex h-28 items-end border-b border-line-strong`,children:a.map(e=>{let n=t.get(e)??0,r=(0,j.jsx)(`div`,{className:`group flex h-full min-w-px flex-1 items-end justify-center`,children:(0,j.jsx)(`div`,{"data-bar":!0,style:{height:`${n>0?Math.max(n/s*100,2):0}%`,width:`calc(100% - 2px)`,maxWidth:16},className:`rounded-t-sm bg-accent group-hover:brightness-125`})},e);return n>0?(0,j.jsx)(f,{content:`${Y_(e)}: ${n}`,children:r},e):r})}),(0,j.jsx)(`div`,{className:`mt-1 flex justify-between`,children:l.map(e=>(0,j.jsx)(`span`,{children:Y_(e)},e))})]})]})}function Z_({settings:e,onClose:t}){let{form:n,save:r,submit:i}=R_(e,t);return(0,j.jsx)(jd,{error:r.error,children:(0,j.jsx)(Ol,{open:!0,onClose:t,title:`Logs settings`,footer:(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(w,{onClick:t,children:`Cancel`}),(0,j.jsx)(w,{type:`submit`,form:`logs-settings`,variant:`primary`,loading:r.isPending,children:`Save changes`})]}),children:(0,j.jsxs)(`form`,{id:`logs-settings`,onSubmit:i,className:`flex flex-col gap-3`,children:[(0,j.jsx)(X,{}),(0,j.jsx)(n.Field,{name:`settings.logs.maxDays`,children:e=>(0,j.jsx)(S_,{path:`logs.maxDays`,label:`Retention (days)`,field:e})}),(0,j.jsx)(n.Field,{name:`settings.logs.minLevel`,children:e=>(0,j.jsx)(Q_,{value:e.state.value,onChange:e.handleChange})}),(0,j.jsx)(n.Field,{name:`settings.logs.logIP`,children:e=>(0,j.jsx)(C_,{path:`logs.logIP`,label:`Log IP addresses`,field:e})}),(0,j.jsx)(n.Field,{name:`settings.logs.logAuthId`,children:e=>(0,j.jsx)(C_,{path:`logs.logAuthId`,label:`Log authenticated user ids`,field:e})})]})})})}function Q_({value:e,onChange:t}){let n=[-4,0,4,8];return n.includes(e)||n.push(e),(0,j.jsx)(Vl,{label:`Min level`,value:e,error:Y(`logs.minLevel`),onChange:e=>t(Number(e.target.value)),children:n.map(e=>(0,j.jsx)(`option`,{value:e,children:G_(e)},e))})}var $_={INFO:`success`,WARN:`warning`,ERROR:`danger`};function ev({level:e}){let t=G_(e);return(0,j.jsx)(Ns,{tone:$_[t]??`neutral`,children:t})}var tv=Xp(Ip);function nv(e){let t={};return typeof e.filter==`string`&&e.filter&&(t.filter=e.filter),(e.superusers===!0||e.superusers===`true`)&&(t.superusers=!0),typeof e.log==`string`&&e.log&&(t.log=e.log),t}var rv=`data.auth != "_superusers"`;function iv({filter:e,superusers:t}){return t?e??``:e?`(${e}) && (${rv})`:rv}var av=e=>e==null?``:String(e);function ov(e){let{method:t,url:n,status:r,execTime:i}=e.data;if(!t)return e.message;let a=typeof i==`number`?`${Math.round(i)}ms`:``;return[av(t),av(r),a,av(n)].filter(Boolean).join(` `)}function sv(){let e=z(),t=Br(),n=zr({strict:!1}),r=of(),[i,a]=(0,T.useState)(!1),o=iv(n),s=js({queryKey:[`logs`,`list`,o],initialPageParam:1,queryFn:({signal:t,pageParam:n})=>e.logs.findMany({perPage:50,page:n,filter:o,sort:`-@rowid`},{signal:t}),getNextPageParam:e=>e.page<e.totalPages?e.page+1:void 0}),c=ks({queryKey:[`logs`,`stats`,o],queryFn:({signal:t})=>e.logs.stats({filter:o},{signal:t})}),l=e=>t({to:`.`,search:t=>nv({...t,...e})}),u=s.data?.pages.flatMap(e=>e.items);return(0,j.jsxs)(V,{crumbs:[{label:`Logs`}],width:`full`,footer:s.data&&`Total: ${s.data.pages[0].totalItems}`,actions:(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(w,{onClick:()=>{s.refetch(),c.refetch()},children:`Refresh`}),(0,j.jsx)(w,{disabled:!r.data,onClick:()=>a(!0),children:`Logs settings`})]}),children:[(0,j.jsx)(em,{label:`Filter logs`,suggest:tv,placeholder:`e.g. level >= 8 && data.status >= 400`,filter:n.filter??``,error:s.error?Dd(s.error):void 0,onSearch:e=>void l({filter:e||void 0})}),(0,j.jsx)(Ps,{label:`Include superuser requests`,checked:!!n.superusers,onChange:e=>void l({superusers:e.target.checked||void 0})}),(c.data||s.error)&&(0,j.jsx)(X_,{stats:c.data??[]}),c.isError&&!s.error&&(0,j.jsx)(rm,{query:c}),s.isPending&&(0,j.jsx)(`p`,{role:`status`,className:`text-sm text-muted`,children:`Loading...`}),u?.length===0&&(0,j.jsx)(`p`,{className:`text-sm text-muted`,children:n.filter?`No logs match the filter.`:`No logs yet.`}),(u&&u.length>0||s.error)&&(0,j.jsxs)(Hl,{caption:`Logs`,children:[(0,j.jsx)(`thead`,{children:(0,j.jsxs)(`tr`,{children:[(0,j.jsx)(Wl,{children:`Level`}),(0,j.jsx)(Wl,{children:`Message`}),(0,j.jsx)(Wl,{children:`Created`})]})}),(0,j.jsx)(`tbody`,{children:(u??[]).map(e=>(0,j.jsxs)(`tr`,{className:`cursor-pointer hover:bg-hover`,onClick:()=>void l({log:e.id}),children:[(0,j.jsx)(Gl,{children:(0,j.jsx)(ev,{level:e.level})}),(0,j.jsx)(Gl,{fill:!0,children:(0,j.jsx)(`button`,{type:`button`,title:ov(e),className:`block w-full truncate text-left font-mono text-xs focus-visible:outline-2 focus-visible:outline-focus`,onClick:t=>{t.stopPropagation(),l({log:e.id})},children:ov(e)})}),(0,j.jsx)(Gl,{children:(0,j.jsx)(`span`,{title:e.created,className:`whitespace-nowrap text-muted`,children:Tf(e.created)})})]},e.id))})]}),s.hasNextPage&&(0,j.jsx)(w,{className:`self-center`,loading:s.isFetchingNextPage,onClick:()=>void s.fetchNextPage(),children:`Load more`}),n.log&&(0,j.jsx)(q_,{id:n.log,onClose:()=>void l({log:void 0})}),i&&r.data&&(0,j.jsx)(Z_,{settings:r.data,onClose:()=>a(!1)})]})}var cv=/'(?:[^']|'')*'|"(?:[^"]|"")*"|`[^`]*`|\[[^\]]*\]|--[^\n]*|\/\*[\s\S]*?\*\//g;function lv(e){return/\b(delete|update|drop|alter)\b|\b(replace\s+into|or\s+replace)\b/i.test(e.replace(cv,` `))}function uv(){let e=z(),[t,n]=(0,T.useState)(null),[r,i]=(0,T.useState)(``),a=Ml(),o=af(),s=nf(),c=Ed({defaultValues:{query:``},onSubmit:async({value:t})=>{if(t.query.trim()&&(i(``),!lv(t.query)||await a({title:`Run query`,message:`This query changes or removes data or tables. It cannot be undone. Run it?`,confirmLabel:`Run`,danger:!0})))try{n(await e.sql.run(t.query))}catch(e){n(null),i(J(e))}}});return(0,j.jsx)(N_,{title:`SQL`,width:`full`,children:(0,j.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),c.handleSubmit()},className:`flex flex-col gap-3`,children:[o.isError&&(0,j.jsx)(rm,{query:o}),(0,j.jsx)(`p`,{className:`rounded-control border border-warning-line bg-warning-bg p-3 text-sm text-warning-text`,children:`Queries run directly on the database. They skip API rules, hooks and migrations.`}),(0,j.jsx)(c.Field,{name:`query`,children:e=>(0,j.jsx)(m,{label:`SQL query`,language:`sql`,sqlSchema:s,rows:8,value:e.state.value,onChange:t=>{e.handleChange(t),i(``)},onRun:()=>void c.handleSubmit()})}),(0,j.jsx)(c.Subscribe,{selector:e=>e.isSubmitting,children:e=>(0,j.jsx)(w,{type:`submit`,className:`self-start`,variant:`primary`,loading:e,children:`Run`})}),r&&(0,j.jsx)(`div`,{role:`alert`,className:`rounded border border-danger/40 bg-danger/10 p-3 text-sm text-danger-text`,children:r}),t&&(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`p`,{className:`text-sm`,children:[t.rows.length,` rows, `,t.affectedRows,` affected,`,` `,t.execTime,` ms`]}),t.columns.length>0&&(0,j.jsxs)(Hl,{caption:`Result`,children:[(0,j.jsx)(`thead`,{children:(0,j.jsx)(`tr`,{children:t.columns.map((e,t)=>(0,j.jsx)(Wl,{children:e.name},t))})}),(0,j.jsx)(`tbody`,{children:t.rows.map((e,t)=>(0,j.jsx)(`tr`,{children:e.map((e,t)=>(0,j.jsx)(Gl,{children:e===null?`NULL`:e},t))},t))})]})]})]})})}function dv(){let e=af(),t=e.data?.filter(e=>e.type===`auth`&&e.name!==`_superusers`);return(0,j.jsx)(N_,{title:`Auth providers`,children:t?t.length===0?(0,j.jsx)(Ll,{title:`No auth collections`,children:`Create an auth collection to configure its OAuth2 providers.`}):(0,j.jsx)(fv,{collections:t}):(0,j.jsx)(rm,{query:e})})}function fv({collections:e}){let t=z(),n=oo(),r=Ml(),i=Ql(),[a,o]=(0,T.useState)((e.find(e=>e.name===`users`)??e[0]).name),[s,c]=(0,T.useState)(null),l=e.find(e=>e.name===a)??e[0],u=l.oauth2,d=u.providers,f=As({mutationFn:e=>t.collections.update(l.id,{oauth2:{...u,...e}}),onSuccess:async()=>{await n.invalidateQueries({queryKey:tf.collections}),c(null),i.success(`Auth providers saved.`)}}),p=e=>{f.isPending||f.mutate(e)},m=e=>Qh.find(t=>t.name===e),h=e=>String(e.displayName||``)||m(e.name)?.displayName||e.name,g=d.map((e,t)=>({provider:e,index:t})),_=Qh.filter(e=>!d.some(t=>t.name===e.name)),v=async(e,t)=>{await r({title:`Disable ${t}?`,message:`Users will no longer be able to sign in with ${t}.`,confirmLabel:`Disable`,danger:!0})&&p({providers:d.filter((t,n)=>n!==e)})},y=(e,t)=>p({providers:e<d.length?d.map((n,r)=>r===e?t:n):[...d,t]});return(0,j.jsx)(jd,{error:f.error,children:(0,j.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[!s&&(0,j.jsx)(X,{}),e.length>1&&(0,j.jsx)(Vl,{label:`Collection`,value:l.name,onChange:e=>o(e.target.value),children:e.map(e=>(0,j.jsx)(`option`,{value:e.name,children:e.name},e.id))}),(0,j.jsx)(eu,{label:`Enable OAuth2`,checked:u.enabled,disabled:f.isPending,onChange:e=>p({enabled:e})}),g.length>0&&(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`ul`,{"aria-label":`Enabled providers`,className:`grid grid-cols-[repeat(auto-fill,minmax(18rem,1fr))] gap-3`,children:g.map(({provider:e,index:t})=>(0,j.jsx)(pv,{name:e.name,label:h(e),status:u.enabled?`Enabled`:`Configured`,onConfigure:()=>c({index:t,provider:e}),onDisable:()=>void v(t,h(e))},e.name))}),(0,j.jsx)(`hr`,{className:`border-line`})]}),(0,j.jsx)(`ul`,{"aria-label":`Other providers`,className:`grid grid-cols-[repeat(auto-fill,minmax(18rem,1fr))] gap-3`,children:_.map(e=>(0,j.jsx)(pv,{name:e.name,label:e.displayName,onConfigure:()=>c({index:d.length,provider:{name:e.name}})},e.name))}),s&&(0,j.jsx)(lg,{provider:s.provider,errorPath:`oauth2.providers.${s.index}`,onCancel:()=>{c(null),f.reset()},onSave:e=>y(s.index,e),submitLabel:s.index<d.length?`Save changes`:`Create`})]})})}function pv({name:e,label:t,status:n,onConfigure:r,onDisable:i}){return(0,j.jsxs)(`li`,{className:`flex items-center gap-3 rounded-base border border-line-strong bg-surface p-3`,children:[(0,j.jsx)(Zh,{name:e,displayName:t}),(0,j.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,j.jsx)(`span`,{className:`block break-words text-sm text-text`,children:t}),(0,j.jsx)(`span`,{className:`block break-all text-xs text-muted`,children:e})]}),n&&(0,j.jsx)(Ns,{tone:n===`Enabled`?`success`:`neutral`,children:n}),i&&(0,j.jsx)(w,{variant:`ghost`,size:`sm`,"aria-label":`Disable ${t}`,title:`Disable`,icon:(0,j.jsx)(Xc,{size:15,strokeWidth:1.75,"aria-hidden":`true`}),onClick:i}),(0,j.jsx)(w,{variant:`ghost`,size:`sm`,"aria-label":`Configure ${t}`,title:`Configure`,icon:(0,j.jsx)(ol,{size:15,strokeWidth:1.75,"aria-hidden":`true`}),onClick:r})]})}function mv(e){if(e<1024)return`${e} B`;let t=[`KB`,`MB`,`GB`],n=e,r=-1;do n/=1024,r++;while(n>=1024&&r<t.length-1);return`${n.toFixed(1)} ${t[r]}`}function hv({form:e,prefix:t}){let n=t===`s3`?`secrets.s3Secret`:`secrets.backupsS3Secret`;return(0,j.jsx)(e.Subscribe,{selector:e=>t===`s3`?e.values.settings.s3.enabled:e.values.settings.backups.s3.enabled,children:r=>(0,j.jsx)(j_,{errorPrefix:`${t}.`,title:`S3 storage`,badge:(0,j.jsx)(A_,{on:r}),children:(0,j.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,j.jsx)(e.Field,{name:`settings.${t}.enabled`,children:e=>(0,j.jsx)(w_,{path:`${t}.enabled`,label:`Use S3 storage`,field:e})}),(0,j.jsxs)(k_,{enabled:r,children:[(0,j.jsx)(e.Field,{name:`settings.${t}.endpoint`,children:e=>(0,j.jsx)(y_,{path:`${t}.endpoint`,label:`Endpoint`,field:e})}),(0,j.jsx)(e.Field,{name:`settings.${t}.bucket`,children:e=>(0,j.jsx)(y_,{path:`${t}.bucket`,label:`Bucket`,field:e})}),(0,j.jsx)(e.Field,{name:`settings.${t}.region`,children:e=>(0,j.jsx)(y_,{path:`${t}.region`,label:`Region`,field:e})}),(0,j.jsx)(e.Field,{name:`settings.${t}.accessKey`,children:e=>(0,j.jsx)(y_,{path:`${t}.accessKey`,label:`Access key`,field:e})}),(0,j.jsx)(e.Field,{name:n,children:e=>(0,j.jsx)(O_,{path:`${t}.secret`,label:`Secret`,field:e})}),(0,j.jsx)(e.Field,{name:`settings.${t}.forcePathStyle`,children:e=>(0,j.jsx)(w_,{path:`${t}.forcePathStyle`,label:`Force path style`,field:e})})]})]})})})}function gv({filesystem:e,disabled:t}){let n=z(),r=Ql(),[i,a]=(0,T.useState)(!1),o=async()=>{a(!0);try{await n.settings.testS3(e),r.success(`Connection works.`)}catch(e){r.error(J(e))}finally{a(!1)}};return(0,j.jsx)(w,{className:`self-start`,disabled:t,loading:i,onClick:()=>void o(),children:`Test connection`})}function _v(){let e=of();return(0,j.jsx)(N_,{title:`Backups`,children:(0,j.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,j.jsx)(vv,{}),e.data?(0,j.jsx)(Ev,{settings:e.data}):(0,j.jsx)(rm,{query:e})]})})}function vv(){let e=z(),t=oo(),n=Ql(),r=Ml(),[i,a]=(0,T.useState)(!1),[o,s]=(0,T.useState)(null),c=ks({queryKey:tf.backups,queryFn:({signal:t})=>e.backups.list({signal:t}).then(e=>e.sort((e,t)=>t.modified.localeCompare(e.modified)))}),l=ks({queryKey:tf.health,queryFn:({signal:t})=>e.health.check({signal:t}),retry:!1,refetchInterval:e=>e.state.data?.data.canBackup===!1||o&&!o.answered?Sv:!1}),u=l.data?.data.canBackup===!1;o&&!o.answered&&l.isSuccess&&!u&&l.dataUpdatedAt>o.at+Cv&&s({...o,answered:!0});let d=()=>Promise.all([t.invalidateQueries({queryKey:tf.backups}),t.invalidateQueries({queryKey:tf.health})]),[f,p]=(0,T.useState)(!1),m=async t=>{let r=t[0];if(r){p(!0);try{await e.backups.upload(r),n.success(`Backup uploaded.`),await d()}catch(e){n.error(J(e))}finally{p(!1)}}},h=async t=>{try{let n=await e.files.token(),r=document.createElement(`a`);r.href=e.backups.downloadURL(n,t),r.download=t,r.click()}catch(e){n.error(J(e))}},g=async t=>{if(await r({title:`Delete backup`,message:`Delete ${t}? This cannot be undone.`,confirmLabel:`Delete`,danger:!0}))try{await e.backups.delete(t),n.success(`Backup deleted.`),await d()}catch(e){n.error(J(e))}},_=async t=>{if(await r({title:`Restore backup`,message:`Restore ${t}? The current data is replaced and the server restarts.`,confirmLabel:`Restore`,danger:!0,typeToConfirm:t}))try{await e.backups.restore(t),s({at:Date.now(),accepted:!0,answered:!1})}catch(e){e instanceof ma&&e.status===0&&!e.isAbort?s({at:Date.now(),accepted:!1,answered:!1}):n.error(J(e))}};return(0,j.jsxs)(Bl,{title:`Backup files`,children:[o&&(0,j.jsxs)(`div`,{role:`status`,className:`flex items-center gap-3 rounded border border-warning-line bg-warning-bg p-3 text-sm text-warning-text`,children:[(0,j.jsxs)(`p`,{children:[o.accepted?`Restore started. The server restarts with the restored data.`:`The connection was lost, so the restore may not have started.`,o.answered&&` The server is answering again: reload this page and check the data.`]}),(0,j.jsx)(w,{onClick:()=>window.location.reload(),children:`Reload`})]}),(0,j.jsxs)(`div`,{className:`flex flex-col items-start gap-3`,children:[(0,j.jsx)(w,{disabled:u,onClick:()=>a(!0),children:`Create backup`}),(0,j.jsx)(`div`,{className:`w-full`,children:(0,j.jsx)(Rl,{label:`Backup file`,accept:`.zip`,disabled:f,onChange:e=>void m(e)})}),u&&(0,j.jsx)(`p`,{className:`text-sm`,children:`A backup or restore is already running.`})]}),c.data?c.data.length===0?(0,j.jsx)(Ll,{title:`No backups yet.`,children:(0,j.jsx)(`p`,{children:`Create a backup or upload a backup file.`})}):(0,j.jsxs)(Hl,{caption:`Backups`,children:[(0,j.jsx)(`thead`,{children:(0,j.jsxs)(`tr`,{children:[(0,j.jsx)(Wl,{children:`Name`}),(0,j.jsx)(Wl,{children:`Size`}),(0,j.jsx)(Wl,{children:`Modified`}),(0,j.jsx)(Wl,{children:(0,j.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]})}),(0,j.jsx)(`tbody`,{children:c.data.map(e=>(0,j.jsxs)(`tr`,{children:[(0,j.jsx)(Gl,{children:e.key}),(0,j.jsx)(Gl,{children:mv(e.size)}),(0,j.jsx)(Gl,{children:e.modified}),(0,j.jsx)(Gl,{children:(0,j.jsxs)(`div`,{className:`flex gap-2`,children:[(0,j.jsx)(w,{onClick:()=>void h(e.key),children:`Download`}),(0,j.jsx)(w,{disabled:u,onClick:()=>void _(e.key),children:`Restore`}),(0,j.jsx)(w,{onClick:()=>void g(e.key),children:`Delete`})]})})]},e.key))})]}):(0,j.jsx)(rm,{query:c}),i&&(0,j.jsx)(yv,{onClose:()=>a(!1),onCreated:()=>void d()})]})}function yv({onClose:e,onCreated:t}){let n=z(),r=Ql(),[i,a]=(0,T.useState)(null),o=Ed({defaultValues:{name:``},onSubmit:async({value:i})=>{a(null);try{await n.backups.create(i.name||void 0),r.success(`Backup created.`),t(),e()}catch(e){a(e)}}});return(0,j.jsx)(jd,{error:i,children:(0,j.jsx)(Ol,{open:!0,onClose:e,title:`Create backup`,footer:(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(w,{onClick:e,children:`Cancel`}),(0,j.jsx)(o.Subscribe,{selector:e=>e.isSubmitting,children:e=>(0,j.jsx)(w,{type:`submit`,form:`create-backup`,variant:`primary`,loading:e,children:`Create`})})]}),children:(0,j.jsxs)(`form`,{id:`create-backup`,onSubmit:e=>{e.preventDefault(),o.handleSubmit()},className:`flex flex-col gap-3`,children:[(0,j.jsx)(X,{}),(0,j.jsx)(o.Field,{name:`name`,children:e=>(0,j.jsx)(bv,{value:e.state.value,onChange:e.handleChange})})]})})})}function bv({value:e,onChange:t}){return(0,j.jsx)(kl,{label:`Name`,hint:`Lowercase letters, digits, - and _, ending in .zip. Leave empty for a generated name.`,value:e,error:Y(`name`),onChange:e=>t(e.target.value)})}var xv=[``,`0 0 * * *`,`0 0 * * 0`],Sv=1e3,Cv=5e3;function wv({field:e}){let t=e.state.value,n=e.handleChange,[r,i]=(0,T.useState)(!1),a=r||!xv.includes(t);return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(Tv,{value:a?`custom`:t,onChange:e=>{i(e===`custom`),e!==`custom`&&n(e)}}),a&&(0,j.jsx)(y_,{path:`backups.cron`,label:`Custom cron expression`,field:e})]})}function Tv({value:e,onChange:t}){return(0,j.jsxs)(Vl,{label:`Schedule`,value:e,error:Y(`backups.cron`),onChange:e=>t(e.target.value),children:[(0,j.jsx)(`option`,{value:``,children:`Off`}),(0,j.jsx)(`option`,{value:`0 0 * * *`,children:`Every day at 00:00`}),(0,j.jsx)(`option`,{value:`0 0 * * 0`,children:`Every Sunday at 00:00`}),(0,j.jsx)(`option`,{value:`custom`,children:`Custom`})]})}function Ev({settings:e}){let{form:t,dirty:n,save:r,submit:i,reset:a}=R_(e);return(0,j.jsx)(jd,{error:r.error,children:(0,j.jsxs)(`form`,{onSubmit:i,className:`flex flex-col gap-4`,children:[(0,j.jsxs)(Bl,{title:`Automatic backups`,children:[(0,j.jsx)(t.Field,{name:`settings.backups.cron`,children:e=>(0,j.jsx)(wv,{field:e})}),(0,j.jsx)(t.Field,{name:`settings.backups.cronMaxKeep`,children:e=>(0,j.jsx)(S_,{path:`backups.cronMaxKeep`,label:`Keep the last`,field:e})}),(0,j.jsx)(hv,{form:t,prefix:`backups.s3`}),(0,j.jsx)(gv,{filesystem:`backups`,disabled:n})]}),(0,j.jsx)(M_,{dirty:n,saving:r.isPending,onReset:a})]})})}var Dv=[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`],Ov=(e,t)=>e===`1`?`every ${t}`:`every ${e} ${t}s`,kv=(e,t)=>`${e.padStart(2,`0`)}:${t.padStart(2,`0`)}`;function Av(e){let t=e.trim().split(/\s+/);if(t.length!==5)return null;let[n,r,i,a,o]=t;if(i!==`*`||a!==`*`)return null;let s=/^\*\/(\d+)$/,c=/^\d+$/;if(r===`*`&&o===`*`){if(n===`*`)return`every minute`;if(n===`0`)return`every hour`;let e=s.exec(n);return e?Ov(e[1],`minute`):null}if(n===`0`&&o===`*`){if(r===`*`)return`every hour`;let e=s.exec(r);if(e)return Ov(e[1],`hour`)}return!c.test(n)||!c.test(r)?null:o===`*`?`daily at ${kv(r,n)}`:c.test(o)&&Number(o)<=7?`weekly on ${Dv[Number(o)%7]} at ${kv(r,n)}`:null}function jv(){let e=z(),t=Ql(),n=ks({queryKey:tf.crons,queryFn:({signal:t})=>e.crons.list({signal:t})}),[r,i]=(0,T.useState)(null),a=async n=>{i(n);try{await e.crons.run(n),t.success(`Started ${n}.`)}catch(e){t.error(J(e))}finally{i(null)}};return n.data?(0,j.jsx)(N_,{title:`Crons`,children:(0,j.jsxs)(Hl,{caption:`Crons`,children:[(0,j.jsx)(`thead`,{children:(0,j.jsxs)(`tr`,{children:[(0,j.jsx)(Wl,{children:`ID`}),(0,j.jsx)(Wl,{children:`Schedule`}),(0,j.jsx)(Wl,{align:`right`,children:`Action`})]})}),(0,j.jsx)(`tbody`,{children:n.data.map(e=>{let t=Av(e.expression);return(0,j.jsxs)(`tr`,{children:[(0,j.jsx)(Gl,{children:(0,j.jsx)(`span`,{className:`font-mono text-xs`,children:e.id})}),(0,j.jsxs)(Gl,{children:[(0,j.jsx)(`span`,{className:`font-mono text-xs`,children:e.expression}),t&&(0,j.jsx)(`span`,{className:`ml-2 text-muted`,children:t})]}),(0,j.jsx)(Gl,{align:`right`,children:(0,j.jsx)(w,{loading:r===e.id,onClick:()=>void a(e.id),children:`Run now`})})]},e.id)})})]})}):(0,j.jsx)(N_,{title:`Crons`,children:(0,j.jsx)(rm,{query:n})})}function Mv(e){let t;try{t=JSON.parse(e)}catch(e){let t=e.message.replace(/\.$/,``);throw Error(`Invalid collections JSON: ${t}.`)}if(!Array.isArray(t))throw Error(`Invalid collections JSON: expected an array.`);return t.forEach((e,t)=>{let n=e?.name;if(typeof n!=`string`||!n)throw Error(`Invalid collections JSON: item ${t+1} has no name.`)}),t}function Nv(e){return JSON.stringify(e.map(({created:e,updated:t,...n})=>n),null,2)}var Pv=e=>JSON.stringify(e,(e,t)=>t&&typeof t==`object`&&!Array.isArray(t)?Object.fromEntries(Object.entries(t).sort(([e],[t])=>e<t?-1:1)):t),Fv=({id:e,created:t,updated:n,fields:r,...i})=>i,Iv=Array.from({length:256},(e,t)=>{let n=t;for(let e=0;e<8;e++)n=n&1?3988292384^n>>>1:n>>>1;return n>>>0});function Lv(e){let t=4294967295;for(let n of new TextEncoder().encode(e))t=Iv[(t^n)&255]^t>>>8;return String((t^4294967295)>>>0)}function Rv(e,t){let n=[...e];for(let e of t){let t={...e},r=!t.id;if(r){let e=`${String(t.type)}${Lv(String(t.name??``))}`,r=e;for(let t=2;t<1e3&&n.some(e=>e.id===r);t++)r=e+t;t.id=r}let i=n.findIndex(e=>r?t.name!==``&&e.name===t.name:e.id===t.id);i>=0?(r&&(t.id=n[i].id),n[i]=t):n.push(t)}return n}function zv(e,t,n){let r=Rv([],t??[]);for(let t of e){if(!t.system&&n||r.some(e=>e.id===t.id))continue;let e=r.find(e=>e.name===t.name);e&&e.type===t.type&&(e.id=t.id),r=Rv(r,[t])}return r}function Bv(e){if(!sm.some(t=>t.type===e.type))return e;let{_key:t,...n}=dm(e.type);return{...n,...e}}function Vv(e,t,n){let r=zv(e,t,n),i={added:[],changed:[],deleted:[]};for(let t of r){let n=e.find(e=>e.id===t.id);n?n.name===t.name?Pv(Bv(t))!==Pv(Bv(n))&&i.changed.push(String(t.name)):i.changed.push(`${String(n.name)} -> ${String(t.name)}`):i.added.push(String(t.name))}for(let t of e)r.some(e=>e.id===t.id)||i.deleted.push(String(t.name));return i}function Hv(e,t,n){let r={added:[],changed:[],deleted:[]},i=new Set;for(let a of t){let t=String(a.id||a.name),o=e.find(e=>e.id===t||e.name.toLowerCase()===t.toLowerCase());if(!o){r.added.push(String(a.name));continue}i.add(o);let s=(a.type??o.type)===`view`?{added:[],changed:[],deleted:[]}:Vv(o.fields,a.fields,n);if(Pv(Fv({...o,...a}))!==Pv(Fv(o))||s.added.length+s.changed.length+s.deleted.length>0){let e=String(a.name??o.name);r.changed.push(e===o.name?{name:e,fields:s}:{name:e,previousName:o.name,fields:s})}}if(n)for(let t of e)!i.has(t)&&!t.system&&r.deleted.push(t.name);return r}function Uv(){let e=af(),[t,n]=(0,T.useState)(new Set);if(!e.data)return(0,j.jsx)(N_,{title:`Export collections`,children:(0,j.jsx)(rm,{query:e})});let r=e.data,i=r.filter(e=>!t.has(e.id)),a=Nv(i),o=e=>{let r=new Set(t);r.delete(e)||r.add(e),n(r)};return(0,j.jsx)(N_,{title:`Export collections`,children:(0,j.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,j.jsx)(Ps,{label:`Select all`,checked:i.length===r.length,onChange:()=>n(i.length===r.length?new Set(r.map(e=>e.id)):new Set)}),(0,j.jsx)(Wv,{legend:`Collections`,items:r.filter(e=>!e.system),unselected:t,onToggle:o}),(0,j.jsx)(Wv,{legend:`System collections`,items:r.filter(e=>e.system),unselected:t,onToggle:o}),(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(w,{variant:`primary`,onClick:()=>{let e=URL.createObjectURL(new Blob([a],{type:`application/json`})),t=document.createElement(`a`);t.href=e,t.download=`hb_collections.json`,t.click(),setTimeout(()=>URL.revokeObjectURL(e))},children:`Download`}),(0,j.jsx)(Fl,{text:a,label:`Copy JSON`,showLabel:!0})]}),(0,j.jsx)(`pre`,{"aria-label":`Export preview`,className:`max-h-[32rem] overflow-auto whitespace-pre-wrap break-all rounded-control border border-line p-3 font-mono text-xs`,children:a})]})})}function Wv({legend:e,items:t,unselected:n,onToggle:r}){return t.length===0?null:(0,j.jsxs)(`fieldset`,{className:`flex flex-wrap gap-x-4 gap-y-2`,children:[(0,j.jsx)(`legend`,{className:`mb-2 text-sm font-medium`,children:e}),t.map(e=>(0,j.jsx)(Ps,{label:e.name,checked:!n.has(e.id),onChange:()=>r(e.id)},e.id))]})}var Gv=(e,t)=>`${e} ${t}${e===1?``:`s`}`;function Kv(){let e=z(),t=of(),n=af(),r=oo(),i=Ql(),a=Ml(),[o,s]=(0,T.useState)(),[c,l]=(0,T.useState)(null),u=Ed({defaultValues:{text:``,deleteMissing:!1},onSubmitMeta:{step:`review`},onSubmit:async({value:e,meta:t})=>{t.step===`review`?await p(e):await h(t.review,e.deleteMissing)}});if(!t.data)return(0,j.jsx)(N_,{title:`Import collections`,children:(0,j.jsx)(rm,{query:t})});if(t.data.meta.hideControls)return(0,j.jsx)(N_,{title:`Import collections`,children:(0,j.jsx)(Ll,{title:`Collection controls are hidden.`})});let d=async e=>{let t=e[0];t&&(u.setFieldValue(`text`,await t.text()),s(void 0))},f=async(e,t)=>{let{data:r}=await n.refetch({throwOnError:!0});return Hv(r,e,t)},p=async({text:e,deleteMissing:t})=>{try{let n=Mv(e);s(void 0),l({list:n,diff:await f(n,t)})}catch(e){s({message:J(e),details:[]})}},h=async({list:t,diff:n},o)=>{let c=n.changed.reduce((e,t)=>e+t.fields.deleted.length,0);if(!(n.deleted.length+c>0&&!await a({title:`Delete data`,message:`This import deletes ${[n.deleted.length>0&&Gv(n.deleted.length,`collection`),c>0&&Gv(c,`field`)].filter(Boolean).join(` and `)} with all their data. This cannot be undone.`,confirmLabel:`Import and delete`,danger:!0})))try{let a=await f(t,o);if(JSON.stringify(a)!==JSON.stringify(n)){l({list:t,diff:a}),i.error(`The collections changed. Review the import again.`);return}await e.collections.import(t,o),await r.invalidateQueries({queryKey:tf.collections}),i.success(`Collections imported.`)}catch(e){s({message:J(e),details:Object.values(Od(Ad(e)))})}};return(0,j.jsx)(N_,{title:`Import collections`,children:(0,j.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),u.handleSubmit({step:`review`})},className:`flex flex-col gap-3`,children:[(0,j.jsxs)(`p`,{className:`rounded-control border border-warning-line bg-warning-bg p-3 text-sm text-warning-text`,children:[`Imports do not write migration files. Run`,` `,(0,j.jsx)(`code`,{children:`heybe migrate collections`}),` afterwards to snapshot the schema.`]}),(0,j.jsx)(`div`,{children:(0,j.jsx)(Rl,{label:`Collections file`,accept:`.json,application/json`,onChange:e=>void d(e)})}),(0,j.jsx)(u.Field,{name:`text`,children:e=>(0,j.jsx)(m,{label:`Collections JSON`,language:`json`,rows:16,value:e.state.value,onChange:t=>{e.handleChange(t),s(void 0)}})}),(0,j.jsx)(u.Field,{name:`deleteMissing`,children:e=>(0,j.jsx)(Ps,{label:`Delete collections and fields missing from the import`,hint:`System collections and system fields are never deleted.`,checked:e.state.value,onChange:t=>e.handleChange(t.target.checked)})}),o&&(0,j.jsxs)(`div`,{role:`alert`,className:`rounded border border-danger/40 bg-danger/10 p-3 text-sm text-danger-text`,children:[(0,j.jsx)(`p`,{children:o.message}),o.details.map((e,t)=>(0,j.jsx)(`pre`,{className:`mt-2 whitespace-pre-wrap text-xs`,children:e},t))]}),(0,j.jsx)(u.Subscribe,{selector:e=>[e.isSubmitting,!e.values.text.trim()],children:([e,t])=>(0,j.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,j.jsx)(w,{type:`submit`,variant:`primary`,loading:e,disabled:t||!n.data,children:`Review`}),t&&(0,j.jsx)(`p`,{className:`text-xs text-muted`,children:`Paste or load a JSON file to enable Review.`})]})}),c&&(0,j.jsx)(qv,{diff:c.diff,onCancel:()=>l(null),onImport:()=>{l(null),u.handleSubmit({step:`import`,review:c})}})]})})}function qv({diff:e,onCancel:t,onImport:n}){let r=e.added.length+e.changed.length+e.deleted.length===0,i=e.deleted.length>0||e.changed.some(e=>e.fields.deleted.length>0);return(0,j.jsxs)(Ol,{open:!0,onClose:t,title:`Review import`,footer:(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(w,{onClick:t,children:`Cancel`}),(0,j.jsx)(w,{variant:`primary`,disabled:r,onClick:n,children:`Import`})]}),children:[r&&(0,j.jsx)(`p`,{className:`text-sm`,children:`No changes.`}),(0,j.jsx)(Yv,{title:`Added`,items:e.added.map(e=>({name:e}))}),(0,j.jsx)(Yv,{title:`Changed`,items:e.changed.map(Jv)}),(0,j.jsx)(Yv,{title:`Deleted`,items:e.deleted.map(e=>({name:e}))}),i&&(0,j.jsx)(`p`,{className:`mt-3 text-sm text-danger-text`,children:`Deleted collections and fields lose all their data.`})]})}function Jv(e){let{added:t,changed:n,deleted:r}=e.fields;return{name:e.previousName?`${e.previousName} -> ${e.name}`:e.name,lines:[t.length>0&&`Added fields: ${t.join(`, `)}`,n.length>0&&`Changed fields: ${n.join(`, `)}`,r.length>0&&`Deleted fields: ${r.join(`, `)}`].filter(e=>!!e)}}function Yv({title:e,items:t}){let n=(0,T.useId)();if(t.length===0)return null;let r=`${e} (${t.length})`;return(0,j.jsxs)(`section`,{className:`mt-3 first:mt-0`,children:[(0,j.jsx)(`h3`,{id:n,className:`text-sm font-semibold`,children:r}),(0,j.jsx)(`ul`,{"aria-labelledby":n,className:`mt-1 list-disc pl-5 text-sm`,children:t.map(e=>(0,j.jsxs)(`li`,{children:[(0,j.jsx)(`span`,{className:`font-mono`,children:e.name}),e.lines?.map(e=>(0,j.jsx)(`p`,{className:`text-xs text-muted`,children:e},e))]},e.name))})]})}function Xv(){let e=of();return(0,j.jsx)(N_,{title:`Mail`,children:e.data?(0,j.jsx)(Zv,{settings:e.data}):(0,j.jsx)(rm,{query:e})})}function Zv({settings:e}){let{form:t,dirty:n,save:r,submit:i,reset:a}=R_(e),[o,s]=(0,T.useState)(!1);return(0,j.jsxs)(jd,{error:r.error,children:[(0,j.jsxs)(`form`,{onSubmit:i,className:`flex flex-col gap-4`,children:[(0,j.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,j.jsx)(t.Field,{name:`settings.meta.senderName`,children:e=>(0,j.jsx)(y_,{path:`meta.senderName`,label:`Sender name`,field:e})}),(0,j.jsx)(t.Field,{name:`settings.meta.senderAddress`,children:e=>(0,j.jsx)(y_,{path:`meta.senderAddress`,label:`Sender address`,field:e})})]}),(0,j.jsx)(t.Subscribe,{selector:e=>e.values.settings.smtp.enabled,children:e=>(0,j.jsx)(j_,{errorPrefix:`smtp.`,title:`SMTP server`,badge:(0,j.jsx)(A_,{on:e}),children:(0,j.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,j.jsx)(t.Field,{name:`settings.smtp.enabled`,children:e=>(0,j.jsx)(w_,{path:`smtp.enabled`,label:`Use SMTP`,field:e})}),(0,j.jsxs)(k_,{enabled:e,children:[(0,j.jsx)(t.Field,{name:`settings.smtp.host`,children:e=>(0,j.jsx)(y_,{path:`smtp.host`,label:`Host`,field:e})}),(0,j.jsx)(t.Field,{name:`settings.smtp.port`,children:e=>(0,j.jsx)(S_,{path:`smtp.port`,label:`Port`,field:e})}),(0,j.jsx)(t.Field,{name:`settings.smtp.username`,children:e=>(0,j.jsx)(y_,{path:`smtp.username`,label:`Username`,field:e})}),(0,j.jsx)(t.Field,{name:`secrets.smtpPassword`,children:e=>(0,j.jsx)(O_,{path:`smtp.password`,label:`Password`,field:e})}),(0,j.jsx)(t.Field,{name:`settings.smtp.authMethod`,children:e=>(0,j.jsx)(Qv,{value:e.state.value,onChange:e.handleChange})}),(0,j.jsx)(t.Field,{name:`settings.smtp.tls`,children:e=>(0,j.jsx)(w_,{path:`smtp.tls`,label:`TLS`,field:e})}),(0,j.jsx)(t.Field,{name:`settings.smtp.localName`,children:e=>(0,j.jsx)(y_,{path:`smtp.localName`,label:`Local name`,field:e})})]})]})})}),(0,j.jsx)(`div`,{children:(0,j.jsx)(w,{disabled:n,onClick:()=>s(!0),children:`Send test email`})}),(0,j.jsx)(M_,{dirty:n,saving:r.isPending,onReset:a})]}),o&&(0,j.jsx)(ey,{onClose:()=>s(!1)})]})}function Qv({value:e,onChange:t}){return(0,j.jsxs)(Vl,{label:`Auth method`,value:e,error:Y(`smtp.authMethod`),onChange:e=>t(e.target.value),children:[(0,j.jsx)(`option`,{value:``,children:`Default`}),(0,j.jsx)(`option`,{value:`PLAIN`,children:`PLAIN`}),(0,j.jsx)(`option`,{value:`LOGIN`,children:`LOGIN`})]})}var $v=[`verification`,`password-reset`,`email-change`,`otp`,`login-alert`];function ey({onClose:e}){let t=z(),n=Ql(),r=af(),[i,a]=(0,T.useState)(null),o=(r.data??[]).filter(e=>e.type===`auth`),s=Ed({defaultValues:{template:$v[0],email:``,collection:`_superusers`},onSubmit:async({value:r})=>{a(null);try{await t.settings.testEmail(r.collection,r.email,r.template),n.success(`Test email sent.`),e()}catch(e){a(e)}}});return(0,j.jsx)(jd,{error:i,children:(0,j.jsx)(Ol,{open:!0,onClose:e,title:`Send test email`,footer:(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(w,{onClick:e,children:`Cancel`}),(0,j.jsx)(s.Subscribe,{selector:e=>e.isSubmitting,children:e=>(0,j.jsx)(w,{type:`submit`,form:`send-test-email`,variant:`primary`,loading:e,children:`Send`})})]}),children:(0,j.jsxs)(`form`,{id:`send-test-email`,onSubmit:e=>{e.preventDefault(),s.handleSubmit()},className:`flex flex-col gap-3`,children:[(0,j.jsx)(X,{}),(0,j.jsxs)(`fieldset`,{className:`flex flex-col gap-1`,children:[(0,j.jsx)(`legend`,{className:`text-sm font-medium`,children:`Template`}),(0,j.jsx)(s.Field,{name:`template`,children:e=>$v.map(t=>(0,j.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,j.jsx)(`input`,{type:`radio`,name:`template`,checked:e.state.value===t,onChange:()=>e.handleChange(t)}),t]},t))})]}),(0,j.jsx)(s.Field,{name:`email`,children:e=>(0,j.jsx)(ty,{value:e.state.value,onChange:e.handleChange})}),(0,j.jsx)(s.Field,{name:`collection`,children:e=>(0,j.jsxs)(Vl,{label:`Auth collection`,value:e.state.value,disabled:!r.data,onChange:t=>e.handleChange(t.target.value),children:[!r.data&&(0,j.jsx)(`option`,{value:e.state.value,children:e.state.value}),o.map(e=>(0,j.jsx)(`option`,{value:e.name,children:e.name},e.id))]})})]})})})}function ty({value:e,onChange:t}){return(0,j.jsx)(kl,{label:`Email`,type:`email`,required:!0,value:e,error:Y(`email`),onChange:e=>t(e.target.value)})}function ny(){let e=of();return(0,j.jsx)(N_,{title:`File storage`,children:e.data?(0,j.jsx)(ry,{settings:e.data}):(0,j.jsx)(rm,{query:e})})}function ry({settings:e}){let{form:t,dirty:n,save:r,submit:i,reset:a}=R_(e);return(0,j.jsx)(jd,{error:r.error,children:(0,j.jsxs)(`form`,{onSubmit:i,className:`flex flex-col gap-4`,children:[(0,j.jsx)(`p`,{className:`text-sm text-muted`,children:`Existing files are not moved when you switch storage.`}),(0,j.jsx)(hv,{form:t,prefix:`s3`}),(0,j.jsx)(gv,{filesystem:`storage`,disabled:n}),(0,j.jsx)(M_,{dirty:n,saving:r.isPending,onReset:a})]})})}var iy={size:15,strokeWidth:1.75},ay=[{title:`System`,links:[{to:`/settings`,label:`Application`,icon:(0,j.jsx)(ul,{...iy})},{to:`/settings/mail`,label:`Mail`,icon:(0,j.jsx)(Bc,{...iy})},{to:`/settings/storage`,label:`File storage`,icon:(0,j.jsx)(wc,{...iy})},{to:`/settings/backups`,label:`Backups`,icon:(0,j.jsx)(Is,{...iy})},{to:`/settings/crons`,label:`Crons`,icon:(0,j.jsx)(oc,{...iy})}]},{title:`Sync`,links:[{to:`/settings/export-collections`,label:`Export collections`,icon:(0,j.jsx)(gc,{...iy})},{to:`/settings/import-collections`,label:`Import collections`,icon:(0,j.jsx)(bc,{...iy})}]},{title:`Authentication`,links:[{to:`/settings/auth-providers`,label:`Auth providers`,icon:(0,j.jsx)(Ac,{...iy})}]},{title:`Debug`,links:[{to:`/settings/sql`,label:`SQL`,icon:(0,j.jsx)(fl,{...iy})}]}];function oy(){let e=sf();return(0,j.jsxs)(`div`,{className:`flex flex-col gap-6 md:flex-row`,children:[(0,j.jsx)(`nav`,{"aria-label":`Settings`,className:`flex flex-col gap-0.5 md:sticky md:top-0 md:w-48 md:shrink-0 md:self-start`,children:ay.map((t,n)=>(0,j.jsxs)(T.Fragment,{children:[(0,j.jsx)(`h2`,{className:`px-2.5 pb-1 text-xs font-medium uppercase text-faint ${n>0?`mt-3`:``}`,children:t.title}),t.links.filter(t=>!(e&&t.label===`Import collections`)).map(e=>(0,j.jsxs)(ni,{to:e.to,activeOptions:{exact:!0},className:`flex items-center gap-2 rounded-control px-2.5 py-1.5 text-muted hover:bg-hover/50 hover:text-text focus-visible:outline-2 focus-visible:outline-focus`,activeProps:{"aria-current":`page`,className:`bg-hover font-medium text-text hover:bg-hover`},children:[e.icon,e.label]},e.to))]},t.title))}),(0,j.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:(0,j.jsx)(vi,{})})]})}var sy=oi()({component:vi}),cy=ai({getParentRoute:()=>sy,id:`shell`,beforeLoad:_u,component:v_}),ly=ai({getParentRoute:()=>sy,path:`/login`,validateSearch:e=>typeof e.redirect==`string`?{redirect:e.redirect}:{},beforeLoad:yu,component:Bd}),uy=ai({getParentRoute:()=>sy,path:`/request-password-reset`,beforeLoad:vu,component:Vd}),dy=ai({getParentRoute:()=>sy,path:`/hbinstall`,beforeLoad:bu,component:Ld}),fy=ai({getParentRoute:()=>sy,path:`/hbinstall/$token`,beforeLoad:bu,component:Id}),py=[ai({getParentRoute:()=>sy,path:`/auth/confirm-verification/$token`,component:Qd}),ai({getParentRoute:()=>sy,path:`/auth/confirm-password-reset/$token`,component:Yd}),ai({getParentRoute:()=>sy,path:`/auth/confirm-email-change/$token`,component:Gd}),ai({getParentRoute:()=>sy,path:`/auth/oauth2-redirect-success`,component:()=>(0,j.jsx)(ef,{success:!0})}),ai({getParentRoute:()=>sy,path:`/auth/oauth2-redirect-failure`,component:()=>(0,j.jsx)(ef,{success:!1})})],my=ai({getParentRoute:()=>cy,path:`/`,beforeLoad:()=>{throw Ze({to:`/collections`})}}),hy=ai({getParentRoute:()=>cy,path:`/collections`,component:Qg}),gy=ai({getParentRoute:()=>hy,path:`/`,component:$g}),_y=ai({getParentRoute:()=>hy,path:`$collectionId`,validateSearch:tm,component:e_}),vy=ai({getParentRoute:()=>cy,path:`/logs`,validateSearch:nv,component:sv}),yy=ai({getParentRoute:()=>cy,path:`/ext/$`,component:t_}),by=ai({getParentRoute:()=>cy,path:`$`,component:Tu}),xy=ai({getParentRoute:()=>cy,path:`/settings`,component:oy}),Sy=ai({getParentRoute:()=>xy,path:`/`,component:z_}),Cy=(e,t)=>ai({getParentRoute:()=>xy,path:e,component:t}),wy=[Cy(`mail`,Xv),Cy(`storage`,ny),Cy(`backups`,_v),Cy(`crons`,jv),Cy(`export-collections`,Uv),Cy(`import-collections`,Kv),Cy(`sql`,uv),Cy(`auth-providers`,dv)],Ty=sy.addChildren([ly,uy,dy,fy,...py,cy.addChildren([my,hy.addChildren([gy,_y]),vy,yy,by,xy.addChildren([Sy,...wy])])]);function Ey(e,t){let n=wi({routeTree:Ty,context:e,history:t??Pt(),defaultNotFoundComponent:Tu});return Cu(e,n),n}s_();var Dy=io();pu(Dy)&&await mu(Dy);var Oy=du();await fu(Oy,Dy);var ky=lu(),Ay=Ey({client:Dy,queryClient:ky,extensions:Oy});(0,to.createRoot)(document.getElementById(`root`)).render((0,j.jsx)(T.StrictMode,{children:(0,j.jsx)(B,{client:Dy,queryClient:ky,extensions:Oy,children:(0,j.jsx)(Di,{router:Ay})})}));
|