offsite 0.0.79 → 0.0.81
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/apps/client/dist/assets/{XIcon-hd7a6qPG.js → XIcon-41gae75-.js} +1 -1
- package/apps/client/dist/assets/{diff-panel-Dp94FfM1.js → diff-panel-C5Y2kAT1.js} +1 -1
- package/apps/client/dist/assets/{editor-dialog-DYSeKCLc.js → editor-dialog-Ca40iXLG.js} +1 -1
- package/apps/client/dist/assets/{image-viewer-BhMHI8JP.js → image-viewer-juD9pPaf.js} +1 -1
- package/apps/client/dist/assets/{index-D2R_GuSa.js → index-Bi58_RHj.js} +5 -5
- package/apps/client/dist/assets/index-Kw4OdzUC.css +2 -0
- package/apps/client/dist/assets/{preview-dialog-DXN8c37K.js → preview-dialog-BQ7xp6ft.js} +1 -1
- package/apps/client/dist/assets/{use-editor-shortcut-BKupwQEX.js → use-editor-shortcut-BAl1jKWS.js} +3 -3
- package/apps/client/dist/assets/{video-viewer-CizhN4mT.js → video-viewer-B6wuIPsW.js} +1 -1
- package/apps/client/dist/index.html +5 -5
- package/apps/client/dist/sw.js +1 -1
- package/package.json +1 -1
- package/apps/client/dist/assets/index-CzN7BToF.css +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import{i as e,t}from"./rolldown-runtime-COiEfhsA.js";import{c as n,l as r,r as i}from"./utils-U6QfaJBO.js";import{A as a,C as o,D as s,E as c,O as l,S as u,T as d,_ as f,a as p,b as m,c as h,d as g,f as _,g as v,h as y,i as b,k as x,l as S,m as C,n as w,o as ee,p as te,r as ne,s as re,u as ie,v as ae,w as oe,x as se,y as ce}from"./tags-DrTyXsO5.js";function T(e){return e[e.length-1]}function le(e,t){return typeof e==`function`?e(t):e}var ue=Object.prototype.hasOwnProperty;function de(e){for(let t in e)if(ue.call(e,t))return!0;return!1}var fe=()=>Object.create(null),pe=(e,t)=>me(e,t,!0);function me(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&&!(he(e)&&he(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&&T(a)!==`${o-1}`||c&&T(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`?me(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`?me(d,o,n,r):o,i&&=u===d&&(a[l]===f||ue.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?fe():{};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`?me(d,u,n,r):u),p[f]=o<l?d:u):p[f]=a[o];return p}function he(e){return!e||typeof e!=`object`?!1:(Object.getPrototypeOf(e)?.constructor??Object)===Object}function ge(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&&!ge(a,o,n,r))return!1}return!0}if(he(e)&&he(t)){if(n){for(let i in t)if((r||t[i]!==void 0)&&!ge(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||!ge(e[a],t[a],n,r)))return!1;return i===0}return!1}var _e=/[\x00-\x1f\x7f"<>`{}]/g;function ve(e){return e.replace(_e,e=>`%`+e.charCodeAt(0).toString(16).toUpperCase().padStart(2,`0`))}function ye(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 ve(t)}var be=[`http:`,`https:`,`mailto:`,`tel:`];function xe(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 Se=/^[\x00-\x20]*[\\/][\t\n\r]*[\\/]/;function Ce(e,t){if(!e)return!1;if(Se.test(e))return!0;let n=xe(e);return n?!t.has(n):!1}function we(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+=ye(e.slice(r,i.index))+i[0],r=n.lastIndex;t+=ye(r?e.slice(r):e)}return t}function Te(e){return/[\s\u0080-\uFFFF]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function Ee(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 De(){throw Error(`Invariant failed`)}function Oe(e){return e.replace(/\/{2,}/g,`/`)}function ke(e){return e===`/`?e:e.replace(/^\/+/,``)}function Ae(e){let t=e.length;return t>1&&e[t-1]===`/`?e.replace(/\/+$/,``):e}function je(e){return Ae(ke(e))}function Me(e,t){return e?.endsWith(`/`)&&e!==`/`&&e!==`${t}/`?e.slice(0,-1):e}function Ne(e,t,n=`never`,r){if(t.includes(`//`)&&(t=Oe(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=Oe(e)),o=e.split(`/`);o.length>1&&T(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&&(T(o)===``?n===`never`&&o.pop():n===`always`&&o.push(``));let s=o.join(`/`),c=(i?Oe(s):s)||`/`;return a&&r&&r.set(a,c),c}function Pe(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 Fe(e){return e==null||e===``}function Ie(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 Le(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&&Fe(f)){if(c===`/`&&!d)continue;f=``}o+=c+Ie(s,f,r)+(d||``)}}return o+a||`/`}function Re(e){return e?.isNotFound===!0}function ze(){try{return sessionStorage}catch{return}}var Be=`tsr-scroll-restoration-v1_3`,Ve=ze();function He(){try{return JSON.parse(Ve?.getItem(`tsr-scroll-restoration-v1_3`)||`{}`)}catch{return{}}}var Ue=He(),We=`data-scroll-restoration-id`,Ge=e=>e.state.__TSR_key||e.href;function Ke(e){let t=e.getAttribute(We);if(t)return`[${We}="${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 qe=!1,Je=`window`;function Ye(e){try{return typeof e==`function`?e():document.querySelector(e)}catch{}}function Xe(e){let t=new Set;for(let n of e){if(n===Je)continue;let e=Ye(n);e&&t.add(e)}return t}function Ze(e,t){let n=t??e.options.scrollRestoration,r=e._scroll;n&&(r.e=!0);let i=e.options.getScrollRestorationKey||Ge,a=new Set,o=e=>{let t=Ue[e]||={};for(let e of a)e===document?t[Je]={scrollX,scrollY}:e.isConnected&&(t[Ke(e)]={scrollX:e.scrollLeft,scrollY:e.scrollTop})};n&&!r.s&&(r.s=!0,qe=!1,history.scrollRestoration=`manual`,document.addEventListener(`scroll`,e=>{qe||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{Ve?.setItem(Be,JSON.stringify(Ue))}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=Ue[d];if(e){let t=Ue[u];for(let n in e){if(n===Je){if(s)continue}else{let e=Ye(n);if(!e||s&&o&&(l??=Xe(o),l.has(e)))continue}t||=Ue[u]={},t[n]??=e[n]}}}qe=!0;try{let e=t.toLocation.hash,i=t.toLocation.state.__hashScrollIntoViewOptions??!0,a=!1;if(s){!e&&o&&(l??=Xe(o));let t=e&&i&&c,s=r.e?Ue[u]:void 0;if(s)for(let e in s){let{scrollX:r,scrollY:i}=s[e];if(e===Je){if(t)continue;scrollTo({top:i,left:r,behavior:n}),a=!0}else{let t=Ye(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{qe=!1}}))}function Qe(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 $e(e){return e?e===`false`?!1:e===`true`?!0:e*0==0&&+e+``===e?+e:e:``}function et(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]=$e(r):Array.isArray(t)?t.push($e(r)):n[e]=[t,$e(r)]}return n}var tt=/^(?:\s|["[{\d-]|fa|nu|tr)/,nt=it(JSON.parse),rt=at(JSON.stringify,JSON.parse);function it(e){let t=e===JSON.parse;return n=>{n[0]===`?`&&(n=n.slice(1));let r=et(n);for(let n in r){let i=r[n];if(typeof i==`string`){if(t&&!tt.test(i))continue;try{r[n]=e(i)}catch{}}}return r}}function at(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&&!tt.test(r))return r;try{return t(r),e(r)}catch{}}return r}return e=>{let t=Qe(e,r);return t?`?${t}`:``}}var ot=`__root__`;function st(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 ct(e){return e instanceof Response&&!!e.options}function lt(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 ut=4,dt=5;function ft(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 pt(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 mt(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=T(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=pt(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=gt(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=gt(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=gt(r,dt);(r.pathless??=[]).push(e),r=e}let g=(t.path||!t.children)&&!t.isRoot;if(g&&u<l){let e=gt(r,ut);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 ht(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 gt(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 _t(e,t){let n=gt(),r=[];function i(e,t,n,a){let[o,s,c]=mt(!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(ht);t.masksTree=n,t.flatCache=lt(1e3)}function vt(e,t){e||=`/`;let n=t.flatCache.get(e);if(n!==void 0)return n;let r=St(e,t.masksTree);return t.flatCache.set(e,r),r}function yt(e,t,n,r,i){e||=`/`,r||=`/`;let a=t?`case\0${e}`:e,o=i.singleCache.get(a);return o||(o=gt(),mt(t,{from:e},1,o),i.singleCache.set(a,o)),St(r,o,n)}function bt(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=St(e,t.segmentTree,n)}catch(e){if(e instanceof URIError)a=null;else throw e}return a&&(a.branch=wt(a.route)),t.matchCache.set(r,a),a}function xt(e,t=!1){let n=gt(),r=[],i={},a={},o=0;function s(e,n,c,l){if(e.init(o),e.id in i&&De(),i[e.id]=e,o!==0&&e.path){let t=Ae(e.fullPath);(!a[t]||e.fullPath.endsWith(`/`))&&(a[t]=e)}o++;let[u,d,f]=mt(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(ht);return{processedTree:{segmentTree:n,singleCache:lt(1e3),matchCache:lt(1e3),flatCache:null,masksTree:null},routesById:i,routesByPath:a}}function St(e,t,n=!1){let r=e.split(`/`),i=Et(e,r,t,n);if(!i)return null;let[a]=Ct(e,r,i);return{route:i.node.route,rawParams:a}}function Ct(e,t,n){let r=Tt(n.node),i=n.node.data&&ft(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===ut)break;if(u.kind===dt){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 wt(e){let t=[e];for(;e.parentRoute;)e=e.parentRoute,t.push(e);return t.reverse(),t}function Tt(e){let t=Array(e.depth+1);do t[e.depth]=e,e=e.parent;while(e);return t}function Et(e,t,n,r){if(e===`/`&&n.index)return{node:n.index,skipped:0};let i=!T(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&&!At(l,n))continue;if(i.parse){if(!kt(e,t,n))continue;g=n.rawParams,h=n.extract}r&&i.route&&i.kind!==ut&&At(c,n)&&(c=n);let _=u===o;if(_&&(i.route&&(!a||i.kind===ut||i.kind===2)&&At(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&&(kt(e,t,n)||(r=!1)),r){if(!p&&!m&&!d&&Ot(f,o))return n;At(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+Dt(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+Dt(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+Dt(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+Dt(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 Dt(e,t){return 2**(e-t-1)}function Ot(e,t){return e===2**(t-1)-1}function kt(e,t,n){let r,i;try{[r,i]=Ct(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 At(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===ut)>(e.node.kind===ut)||t.node.kind===ut==(e.node.kind===ut)&&t.node.depth>e.node.depth)))}function jt(e,t,n){let r=je(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=Oe(`/${r}${e.pathname}`),e)};return n?{input:({url:e})=>Mt(n,s.input({url:e})),output:({url:e})=>s.output({url:Nt(n,e)})}:s}function Mt(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 Nt(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 Pt(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(()=>{Ee(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 Ft=`__TSR_index`,It=`popstate`,Lt=`beforeunload`,Rt=/^[\x00-\x20]*(?:[\\/][\t\n\r]*){2,}/;function zt(e){let t=Rt.exec(e);return t?`/`+e.slice(t[0].length):e}function Bt(e){return/[\x00-\x1f\x7f]/.test(e)&&(e=e.replace(/[\x00-\x1f\x7f]/g,e=>`
|
|
2
|
-
\r`.includes(e)?``:encodeURIComponent(e))),zt(e)}function Vt(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=Wt(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[Ft];i=Ht(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[Ft];i=Ht(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[Ft]!==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 Ht(e,t){let n=Gt();return{...t,key:n,__TSR_key:n,[Ft]:e}}function Ut(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=>Bt(e?.createHref?e.createHref(t):t),c=e?.parseLocation??(()=>Wt(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!t.history.state?.__TSR_key&&!t.history.state?.key){let e=Gt();t.history.replaceState({[Ft]: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=Wt(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[Ft]-l.state[Ft],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=Vt({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(Lt,x,{capture:!0}),t.removeEventListener(It,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(Lt,x,{capture:!0}),t.addEventListener(It,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 Wt(e,t){let n=Bt(e),r=n.indexOf(`#`),i=n.indexOf(`?`);if(!t){let e=Gt();t={[Ft]: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 Gt(){return(Math.random()+1).toString(36).slice(7)}function Kt(e,t){return e.protocol!==`http:`&&e.protocol!==`https:`||e.origin!==t||!!e.username||!!e.password}function qt(e){return e.pathname+e.search+e.hash}function Jt(e){return e.options.loader||e.options.beforeLoad||e.lazyFn||e.options.component?.preload||e.options.pendingComponent?.preload}function Yt(e,t){return{fromLocation:t,toLocation:e,pathChanged:t?.pathname!==e.pathname,hrefChanged:t?.href!==e.href,hashChanged:t?.hash!==e.hash}}function Xt({key:e,__TSR_key:t,__TSR_index:n,__hashScrollIntoViewOptions:r,...i}){return i}function Zt(e){return e.findIndex(e=>e.status===`error`||e.status===`notFound`||e._notFound)+1}function Qt(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 $t=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:Ut()),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!==`/`&&je(n)?jt(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=Pt(this.latestLocation,e),Ze(this)}},this.updateLatestLocation=()=>{this.latestLocation=this.parseLocation(this.history.location,this.latestLocation)},this.buildRouteTree=()=>{let e=xt(this.routeTree,this.options.caseSensitive);return this.options.routeMasks&&_t(this.options.routeMasks,e.processedTree),{...e,resolvePathCache:lt(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:we(e),external:!1,searchStr:o,search:pe(t?.search,i),hash:we(r.slice(1)),state:me(t?.state,a)}}let o=Mt(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:we(zt(o.pathname)),external:!!this.rewrite&&Kt(o,this.origin),searchStr:c,search:pe(t?.search,s),hash:we(o.hash.slice(1)),state:me(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=bt(Ae(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=Wt(n.href,{});n={...n,to:Mt(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=Ne(s[0]===`/`?``:n.unsafeRelative===`path`?a().pathname:n.from??o()[1],s,this.options.trailingSlash,this.resolvePathCache),l=this.routesByPath[Ae(c)],u=c.includes(`$`),d;if(l)d=l._branch??=wt(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??mt(!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??=an(n.params,e),!de(p))break;p===e&&(p=Object.assign(fe(),p));try{Object.assign(p,t(p))}catch{}}}p??=an(n.params,on(n.params,f)?o()[3]:sn);let m=e.leaveParams?c:zt(we(f?Le(c,f,p,this.pathParamsDecoder):c)),h=cn(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,rn(n.options.validateSearch,{...e,...t}))}catch{}}),t=e}return t},_=h.length?ln(h,g(),n):n.search===!0?g():typeof n.search==`function`?n.search(g()):n.search||sn,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:sn,S=`${m}${v}${b}`,C,w,ee=!1;if(this.rewrite){let e=new URL(S,this.origin),t=e.origin,n=Nt(this.rewrite,e);C=qt(e),Kt(n,t)?(w=n.href,ee=!0):w=zt(qt(n))}else C=Te(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=vt(r.pathname,this.processedTree);if(t){let i=Object.assign(fe(),t.rawParams),{from:a,params:o,...s}=t.route,c=an(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 en(this,r.publicHref,{replace:n.replace,ignoreBlocker:t});let i,a=Ae(this.latestLocation.href)===Ae(n.href)&&ge(Xt(n.state),Xt(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?xe(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 en(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 $n(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(Yt(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`)&&Jt(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(Se.test(n)||(r=xe(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:Kt(e,this.origin)||(n=qt(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=mn,this.preloadRoute=e=>er(this,e),this.matchRoute=(e,t)=>{let n={...e,to:e.to?Ne(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=yt(r.pathname,t?.caseSensitive??!1,t?.fuzzy??!1,a.pathname,this.processedTree);return!o||e.params&&!ge(o.rawParams,e.params,!0)?!1:t?.includeSearch??!0?ge(a.search,r.search,!0)?o.rawParams:!1:o.rawParams},this.getStoreConfig=t,e.pathParamsAllowedCharacters?.length&&(this.pathParamsDecoder=Pe(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??rt,parseSearch:e.parseSearch??nt,protocolAllowlist:e.protocolAllowlist??be}),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=mt(!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[`**`]:Ae(e.pathname))&&(this.options.notFoundRoute?a=[...a,this.options.notFoundRoute]:o=!0);let s=o?un(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=rn(i.options.validateSearch,{...n})??void 0;l={...n,...e},f={...r,...e}}catch(e){let r=e;if(e instanceof tn||(r=new tn(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=fe(),_=i._interpolation?Le(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{dn(i,d)}catch(e){if(x=Re(e)||ct(e)?e:new nn(e.message,{cause:e}),t?.throwOnError)throw x}let S=y?`stay`:`enter`,C;if(b)C={...b,cause:S,search:pe(y?y.search:b.search,l),_strictSearch:f,searchError:p};else{let e=Jt(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?pe(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?me(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`?pe(n.params,d):d,t?._controller&&(n.context={})}return c}matchRoutesLightweight(e){let t=T(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=T(a),c={...e.search};for(let e of a)try{Object.assign(c,rn(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{dn(t,e)}catch{}u=e}let d=[a,s.fullPath,c,u];return this.lightweightCache.set(e,[r,d]),d}};async function en(e,t,{replace:n,ignoreBlocker:r}){if(!Ce(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 tn=class extends Error{},nn=class extends Error{};function rn(e,t){if(e==null)return{};if(`~standard`in e){let n=e[`~standard`].validate(t);if(n instanceof Promise)throw new tn(`Async validation not supported`);if(n.issues)throw new tn(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 an(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 on(e,t){return typeof e==`function`?!0:!t||e===!1||e===null?!1:e===void 0||e===!0||t.some(t=>typeof t!=`string`&&!ue.call(e,t[1]))}var sn=Object.freeze({});function cn(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=rn(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 ln(e,t,n){let r=(t,i,a)=>{if(t>=e.length){if(!n.search)return{};if(n.search===!0)return i;let e=le(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 un(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 ot}function dn(e,t){let n=e.options.params?.parse??e.options.parseParams;n&&Object.assign(t,n(t))}function fn(e,t){return e.options[t]?.preload?.()}function pn(e,t){let n=fn(e,`component`),r=fn(e,`pendingComponent`);return t&&(r?r=r.then(t):t()),n&&r?Promise.all([n,r]).then(()=>{}):n??r}function mn(e,t,n){let r=()=>t===!1?void 0:t?fn(e,t):pn(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 hn(e){let t=e.findIndex(e=>e.status!==`success`||e._notFound)+1;return t&&t<e.length?e.slice(0,t):e}function gn(e,t,n){let r=e._tx;return t&&r?.[2]===n&&!r[3].some(e=>e.routeId===t)}var E=0,_n=1,vn=2,D=3,yn=[4];function bn(e){return typeof e[0]==`number`}function xn(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 Sn(e,t){return e.routesById[t.routeId]}function Cn(e,t,n){return ct(e)?[D,e]:Re(e)?(e.routeId||=n,[vn,e]):t?(typeof e?.then==`function`&&(e=Error(`A Promise was thrown`,{cause:e})),[_n,e]):[E,e]}function wn(e,t){let n=Cn(t,!0,e.id);if(n[0]!==_n)return n;try{e.options.onError?.(n[1])}catch(t){n=Cn(t,!0,e.id)}return n}function Tn(e,t,n,r,i){return i[0].signal.aborted?yn:Bn(e,t,n,wn(n,r),i)}async function En(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=Sn(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 On(e,r),[i,Tn(e,t,u,a,n)]}if(c.aborted)return[i,yn];let p=r.paramsError??r.searchError;if(p!==void 0)return On(e,r),[i,Tn(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{An(e,r,`beforeLoad`,n[0]);let a=m({...f,search:r.search,context:r.context,...e.options.additionalContext}),o=await(typeof a?.then==`function`?xn(a,c):a);if(c.aborted)return[i,yn];let s=Bn(e,t,u,Cn(o,!1,u.id),n);if(s[0]!==E)return On(e,r),[i,s];r.context={...r.context,...o}}catch(a){return On(e,r),[i,Tn(e,t,u,a,n)]}finally{r.status=h,An(e,r,!1,n[0])}}i()}function Dn(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 On(e,t){let n=t._flight;t._flight=void 0,Dn(e,t,n)?.abort()}function O(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=Dn(e,a,t);n&&i.push(n)}}for(let e of i)e.abort()}function kn(e){for(let t of e){let e=t._flight;e&&e[2]++}}function An(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 jn(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 Mn(e,t,n,r,i,a,o){let s=o[0],c=s.signal;if(c.aborted)return yn;if(!i)return[E,void 0];let l=n._flight;An(e,n,`loader`,s);try{if(!l){let s=new AbortController;l=[Promise.resolve().then(()=>i(jn(e,t,n,r,s,a,!!o[3]))).then(e=>Cn(e,!1,r.id),e=>Cn(e,!0,r.id)).then(t=>(t[0]!==E&&e._flights?.get(n.id)===l&&(e._flights.delete(n.id),l[2]||s.abort()),t[0]===_n&&l[2]?wn(r,t[1]):t)),s,1],(e._flights??=new Map).set(n.id,l)}return n._flight=l,n.abortController=l[1],Bn(e,t,r,await xn(l[0],c),o)}catch(t){if(t!==c||!c.aborted)throw t;return On(e,n),yn}finally{An(e,n,!1,s)}}function Nn(e,t,n){t[0]!==D&&(e.status=`success`,e.error=void 0,t[0]===E?(e.loaderData=t[1],e.invalid=!1,e.updatedAt=Date.now(),e.preload=n):e.invalid=!0)}function Pn(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&&On(e,r)}function Fn(e,t){return t[0]===_n||t[0]===vn?{...e,status:t[0]===_n?`error`:`notFound`,error:t[1],_flight:void 0}:e}function In(e,t,n,r,i,a,o){let s=t[1][n],c=Sn(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(jn(e,t,s,c,a[0],i,l))),a[0].signal.aborted&&(p=yn)),!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,On(e,s),p=Tn(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,Dn(e,s,t)?.abort(),n>=o&&(s.status=`pending`),S?.()}b||(s.isFetching=!1);let w=!p&&x?Mn(e,t,s,c,g,i,a).then(t=>(Nn(s,t,l),t[0]===E&&(m&&!a[0].signal.aborted&&Pn(e,s,u),n>=o&&(s.status=`pending`)),t)):Promise.resolve(p??[E,s.loaderData]),ee=(async()=>{try{let e=mn(c,void 0,C);e&&await xn(e,a[0].signal)}catch(r){if(!t[1].some((e,t)=>t<=n&&(e.status===`error`||e.status===`notFound`||e._notFound)))return[n,Tn(e,t,c,r,a)]}let r=await w;x&&r[0]===E&&s.status===`pending`&&!a[0].signal.aborted&&(s.status=`success`,S?.())})();if(r.push([n,w,ee]),!y)return w.then(e=>Fn(s,e));let te={...s,status:`pending`,preload:!1,_flight:v};s.invalid=!1,s.isFetching=`loader`;let ne=Mn(e,t,te,c,g,i,a).then(e=>(s.isFetching=!1,Nn(te,e,!1),e));return(t[2]??=[]).push([n,ne,ee,te]),ne.then(e=>Fn(te,e))}async function Ln(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=Sn(e,t[n]);try{let e=mn(i,!1);e&&await xn(e,r)}catch(e){if(e===r&&r.aborted)throw e}if(i.options.notFoundComponent)return n}return a?.routeId?o:i}function Rn(e,t){t[2]&&=(O(e,t[2].map(e=>e[3])),void 0)}async function zn(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]>=D)throw[a,t];!i&&t[0]!==E&&(i=[a,t],await Promise.all((n??[]).map(e=>{if(!(e[0]<=a))return e[1].then(t=>{if(t[0]===D)throw[e[0],t]})})))}})))}catch(e){return e}return t??i}function Bn(e,t,n,r,i,a){for(;r[0]===D;){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]?[D,t]:[D,t,a]}return[D,o,n]}catch(e){r=a?[_n,e]:wn(n,e),a=!0}}return r}async function Vn(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]===vn?Ln(e,o,t,r.signal):t[0],d=l<0?o.length:l;if((s?.[1][0]??0)>=D)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]!==E&&t[0]<D&&!(`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)>=D){let n=s[1];if(n[0]!==D||n[1].options.reloadDocument||n[2])return Rn(e,t),n;c=!0,s=[0,[_n,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===_n?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=Sn(e,u);try{await xn(i?Promise.resolve().then(()=>mn(m,l===_n?`errorComponent`:`notFoundComponent`)):Promise.all([mn(m),mn(m,`notFoundComponent`)]),r.signal)}catch(n){if(n===r.signal&&r.signal.aborted)return Rn(e,t),yn}i?c&&(r.abort(),await Promise.all([...n.map(e=>e[1]),...n.map(e=>e[2]),...(t[2]??[]).map(e=>e[1])]),Rn(e,t),O(e,o),p()):u.status=`success`}return t}async function Hn(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=Sn(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 xn(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 Un(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 Ln(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=In(e,i,t,u,f,r,l)},m=await En(e,i,r,c,p,l);if(m){if(r[4]=!0,c=m[0],m[1][0]===vn){let t=await Ln(e,n,m,a);m[2]=t,c=Math.min(c,t+1)}else m[1][0]>=D&&(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=Vn(e,i,u,r[0],zn(u,m,i[2]),r[7]);i[2]?.length&&(i[3]=zn(i[2],void 0,void 0,h.then(e=>bn(e)?0:hn(n).length,()=>0))),o=await h}catch(t){if(Rn(e,i),t===a&&a.aborted)return yn;throw t}return bn(o)?o:Hn(e,o,a,r[6]===n.length?r[6]:0)}function Wn(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=Sn(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(()=>Wn(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 Gn(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 Kn(e,t){let n=e._pending;if(!n)return;clearTimeout(n[3]);let r=n[2]-Date.now();if(!n[4]||r<=0||!hn(t[3]).some(e=>e.id===n[1]))return;let i;try{await xn(new Promise(e=>{i=setTimeout(e,r)}),t[0].signal)}catch{}clearTimeout(i)}function qn(e,t){e._committed=t,e.stores.setMatches(t)}function Jn(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=hn(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=Sn(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=Zt(n);qn(e,n),O(e,[...o.values(),...i].filter(e=>e._flight&&c.get(e.id)!==e),n),Qt(e,i,n,a,l,t)}async function Yn(e,t){let n=e._tx;for(;n&&n!==t;)t=n,await n[5],n=e._tx}function Xn(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 Zn(e,t,n,r,i){let a=n.map(e=>({...e}));kn(a);for(let t of r)On(e,a[t[0]]),a[t[0]]=t[3];let o=[t[2],a],s;try{s=await Vn(e,o,r,t[0],i)}catch(t){throw O(e,a),t}if(bn(s))O(e,a),s[0]===D&&e._tx===t&&e._committed===n&&await Xn(e,t,s);else if(await Hn(e,s,t[0].signal),e._tx!==t||e._committed!==n)O(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),On(e,n))}qn(e,a),O(e,n,a)}}async function Qn(e,t,n,r,i,a){let o=await Un(e,t[2],t[3],[t[0],t[1],e._committed,void 0,i,n,a,r]);if(bn(o)){let n=o[0]===D&&e._tx===t;if((!n||o[1].options.reloadDocument)&&Gn(e,t),O(e,t[3]),t[3]=[],!n)return;if(e._tx!==t){Gn(e,t);return}await Xn(e,t,o);return}let s=o[1];if(e._tx===t&&await Kn(e,t),e._tx!==t){Gn(e,t),O(e,s),Rn(e,o);return}let c=t[2],l=Yt(c,e.stores.resolvedLocation.get()),u=o[2];await e.startViewTransition(async()=>{if(e._tx===t&&await Kn(e,t),e._tx!==t){Gn(e,t),O(e,s),Rn(e,o);return}let n=await e.startTransition(()=>{Gn(e,t),Jn(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&&Zn(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)):Rn(e,o)})}async function $n(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=Yt(a,r);e.emit({type:`onBeforeNavigate`,...t}),u.signal.aborted||e.emit({type:`onBeforeLoad`,...t})}if(u.signal.aborted){await Yn(e,n);return}let f=i.href===a.href,p=u,m=e.matchRoutes(a,{_controller:u});kn(m);let h=l?c[1](m):void 0;if(h?p=l:l?.abort(),u.signal.aborted){O(e,m),await Yn(e,n);return}e._preflight=void 0;let g,_=()=>Qn(e,y,f,()=>Wn(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(()=>Yn(e,y))];if(e._tx=y,n){for(let t of e.stores.matches.get()){if(e._tx!==y)break;t.isFetching&&An(e,t,!1)}n[0].abort(),O(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))&&Wn(e,y),g?.(_()),await y[5]):(O(e,y[3]),y[3]=[],g?.(),await Yn(e,y))}async function er(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}),kn(a),o=(e._preloads??=new Map).set(i,a),s=await Un(e,n,a,[i,t,r,!0])}finally{o&&(o=o.delete(i),O(e,a)),i.abort()}if(!bn(s))return s[1];if(!o||s.length<3)return;n=s[2]}catch(e){Re(e)||console.error(e);return}}}var tr=`Error preloading route! ☝️`,nr=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=ot:this.parentRoute||De();let r=n?ot:t?.path;r&&r!==`/`&&(r=ke(r));let i=t?.id||r,a=n?ot:Oe((this.parentRoute.id===`__root__`?``:this.parentRoute.id)+`/`+(i??``));r===`__root__`&&(r=`/`);let o=a===`__root__`?`/`:r===void 0?this.parentRoute.fullPath:Oe(this.parentRoute.fullPath+`/`+r);this._path=r,this._id=a,this._fullPath=o,this._to=Ae(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=>st({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.`)}},rr=class extends nr{constructor(e){super(e)}},k=e(r(),1),ir=k.createContext(null);function ar(e){return k.useContext(ir)}function or(e,t){let n=e.stores.location,r=new Set,i,a,o=n=>{gn(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=k.createContext(void 0),cr=k.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,Sr(e))}}),vr=0,yr=0,A,br=0;function xr(e){try{++br,e()}finally{--br||Cr()}}function Sr(e){let t=e.depsTail,n=t===void 0?e.deps:t.nextDep;for(;n!==void 0;)n=mr(n,e)}function Cr(){if(!(br>0)){for(;vr<yr;){let e=dr[vr];dr[vr++]=void 0,e.notify()}vr=0,yr=0}}function wr(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 A!==void 0&&pr(i,A,fr),i._snapshot},subscribe(e){let t=ur(e),n={current:!1},r=Tr(()=>{i.get(),n.current?(A=void 0,t.next?.(i._snapshot)):n.current=!0});return{unsubscribe:()=>{r.stop()}}},_update(e){let a=A,o=t?.compare??Object.is;if(n)A=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{A=a,n&&(i.flags&=-5),Sr(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 A!==void 0&&pr(i,A,fr),i._snapshot}):i.set=function(e){if(i._update(e)){let e=i.subs;e!==void 0&&(hr(e),_r(e),Cr())}},i}function Tr(e){let t=()=>{let t=A;A=n,++fr,n.depsTail=void 0,n.flags=6;try{return e()}finally{A=t,n.flags&=-5,Sr(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,Sr(this)}};return t(),n}var Er=t((e=>{var t=r();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:n,a=t.useState,o=t.useEffect,s=t.useLayoutEffect,c=t.useDebugValue;function l(e,t){var n=t(),r=a({inst:{value:n,getSnapshot:t}}),i=r[0].inst,l=r[1];return s(function(){i.value=n,i.getSnapshot=t,u(i)&&l({inst:i})},[e,n,t]),o(function(){return u(i)&&l({inst:i}),e(function(){u(i)&&l({inst:i})})},[e]),c(n),n}function u(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!i(e,n)}catch{return!0}}function d(e,t){return t()}var f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?d:l;e.useSyncExternalStore=t.useSyncExternalStore===void 0?f:t.useSyncExternalStore})),Dr=t(((e,t)=>{t.exports=Er()})),Or=t((e=>{var t=r(),n=Dr();function i(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var a=typeof Object.is==`function`?Object.is:i,o=n.useSyncExternalStore,s=t.useRef,c=t.useEffect,l=t.useMemo,u=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var d=s(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=l(function(){function e(e){if(!o){if(o=!0,s=e,e=r(e),i!==void 0&&f.hasValue){var t=f.value;if(i(t,e))return c=t}return c=e}if(t=c,a(s,e))return t;var n=r(e);return i!==void 0&&i(t,n)?(s=e,t):(s=e,c=n)}var o=!1,s,c,l=n===void 0?null:n;return[function(){return e(t())},l===null?void 0:function(){return e(l())}]},[t,n,r,i]);var p=o(e,d[0],d[1]);return c(function(){f.hasValue=!0,f.value=p},[p]),u(p),p}})),kr=t(((e,t)=>{t.exports=Or()}))();function Ar(e,t){return e===t}function jr(e,t=e=>e,n){let r=n?.compare??Ar,i=(0,k.useCallback)(t=>{let{unsubscribe:n}=e.subscribe(t);return n},[e]),a=(0,k.useCallback)(()=>e.get(),[e]);return(0,kr.useSyncExternalStoreWithSelector)(i,a,a,t,r)}var Mr={};function Nr(e,t){let n=k.useRef();return r=>{let i=e?.select?e.select(r):r;return e?.structuralSharing??t.options.defaultStructuralSharing?n.current=me(n.current,i):i}}function Pr(e){let t=ar(),n=k.useContext(e.from?cr:sr),r=e.from??n,i=t.stores.getMatchStore(r),a=Nr(e,t),o=jr(i,e=>e?a(e):Mr);if(o!==Mr)return o;(e.shouldThrow??!0)&&De()}function Fr(e){return Pr({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function Ir(e){let{select:t,...n}=e;return Pr({...n,select:e=>t?t(e.loaderDeps):e.loaderDeps})}function Lr(e){return Pr({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 Rr(e){return Pr({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function zr(e){let t=ar();return k.useCallback(n=>t.navigate({...n,from:n.from??e?.from}),[e?.from,t])}function Br(e){return Pr({...e,select:t=>e.select?e.select(t.context):t.context})}var Vr=n();function Hr(...e){let t=k.useRef(e),n=t.current;return e.forEach((e,t)=>{ge(n[t],e,!1,!0)||(n[t]=e)}),t.current}function Ur(e,t){e.preloadRoute(t).catch(e=>{console.warn(e),console.warn(tr)})}function Wr(e,t){let n=typeof e==`string`&&xe(e);if(n)return t.has(n)?e:null}function Gr(e,t,n,r){let i=Me(e.pathname,r),a=Me(t.pathname,r);return(n?.exact?i!==a:!i.startsWith(a)||i.length!==a.length&&i[a.length]!==`/`)||(n?.includeSearch??!0)&&!ge(e.search,t.search,!n?.exact,n?.explicitUndefined)?!1:!n?.includeHash||e.hash===t.hash}function Kr(e,t,n){let r=ar(),i=k.useRef(null),a=k.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]=Hr(e.search,e.params,o),x=k.useContext(sr),S=(r.stores._linkScopes??={})[x]??=or(r,x),[C,w,ee]=k.useMemo(()=>{let t=Wr(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=ei(t,r,u),s=u||o&&!xe(o)?Gr(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]=k.useSyncExternalStore(S[1],w,ee||w),re=ne===void 0&&te,ie=u||te===void 0,ae=k.useRef(!1),oe=e.reloadDocument||re||ie?!1:c??r.options.defaultPreload,se=l??r.options.defaultPreloadDelay??0,ce=k.useCallback(e=>{let t=e?.isIntersecting;t??oe===`intent`?se?i.t??=setTimeout(()=>{i.t=void 0,Ur(r,C)},se):Ur(r,C):t===!1&&Qr(i)},[r,C,i,oe,se]);k.useEffect(()=>{if(!oe)return;oe===`render`&&!ae.current&&(ae.current=!0,Ur(r,C));let e=!0,t;return oe===`viewport`&&i.current&&typeof IntersectionObserver==`function`&&(t=new IntersectionObserver(t=>{e&&ce(t.pop())},{rootMargin:`100px`}),t.observe(i.current)),()=>{e=!1,t?.disconnect(),Qr(i)}},[r,C,oe,ce,i]);let T=Xr(e,n);if(T.ref=t?a:i,re)return T.href=re,T;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(),Qr(i),r.navigate({...e,_fromLocation:C._fromLocation}))},ue=()=>{oe===`intent`&&Ur(r,C)},de=()=>{oe===`intent`&&Qr(i)};return T.onClick=$r(f,le),T.onBlur=$r(p,de),T.onFocus=$r(m,ce),T.onMouseEnter=$r(h,ce),T.onMouseLeave=$r(g,de),T.onTouchStart=$r(_,ue),Zr(T,e,ne,te,ie,n)}var qr={},Jr={className:`active`},Yr=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 Xr(e,t){let n={};for(let r in e)Yr.has(r)||r===`type`&&t!==void 0||r===`disabled`&&t===`a`||(n[r]=e[r]);return n}function Zr(e,t,n,r,i,a){let{activeProps:o,inactiveProps:s,className:c,style:l,target:u}=t,d=le(n?o:s,{})??(n?Jr:qr);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 Qr=e=>{clearTimeout(e.t),e.t=void 0},$r=(e,t)=>e?n=>n.defaultPrevented||(e(n),n.defaultPrevented||t(n)):t;function ei(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||!Ce(i,t.protocolAllowlist))return i}var ti=k.memo(k.forwardRef((e,t)=>{let n=e._asChild||`a`,r=Kr(e,t,n),i=typeof e.children==`function`?e.children({isActive:r[`data-status`]===`active`}):e.children;return k.createElement(n,r,i)}),ni);function ni(e,t){let n=0;for(let r in t)if(n++,e[r]!==t[r]&&(!Yr.has(r)||!ge(e[r],t[r],!1,!0)))return!1;for(let t in e)n--;return n===0}var ri=class extends nr{constructor(e){super(e),this.useMatch=e=>Pr({...e,from:this.id}),this.useRouteContext=e=>Br({...e,from:this.id}),this.useSearch=e=>Rr({...e,from:this.id}),this.useParams=e=>Lr({...e,from:this.id}),this.useLoaderDeps=e=>Ir({...e,from:this.id}),this.useLoaderData=e=>Fr({...e,from:this.id}),this.useNavigate=()=>zr({from:this.fullPath}),this.Link=k.forwardRef((e,t)=>(0,Vr.jsx)(ti,{ref:t,from:this.fullPath,...e}))}};function ii(e){return new ri(e)}var ai=class extends rr{constructor(e){super(e),this.useMatch=e=>Pr({...e,from:this.id}),this.useRouteContext=e=>Br({...e,from:this.id}),this.useSearch=e=>Rr({...e,from:this.id}),this.useParams=e=>Lr({...e,from:this.id}),this.useLoaderDeps=e=>Ir({...e,from:this.id}),this.useLoaderData=e=>Fr({...e,from:this.id}),this.useNavigate=()=>zr({from:this.fullPath}),this.Link=k.forwardRef((e,t)=>(0,Vr.jsx)(ti,{ref:t,from:this.fullPath,...e}))}};function oi(e){return new ai(e)}var si=e=>({createMutableStore:wr,createReadonlyStore:wr,batch:xr}),ci=e=>new li(e),li=class extends $t{constructor(e){super(e,si)}},ui=`global`;function di(e,t,n){let r=new Uint8Array(5+n.length);return r[0]=e,new DataView(r.buffer).setUint32(1,t),r.set(n,5),r}function fi(e){if(e.length<5)throw Error(`terminal frame is too short`);return{kind:e[0],id:new DataView(e.buffer,e.byteOffset,e.byteLength).getUint32(1),data:e.subarray(5)}}function pi(e){return new Promise((t,n)=>{e.oncomplete=e.onsuccess=()=>t(e.result),e.onabort=e.onerror=()=>n(e.error)})}function mi(e,t){let n,r=()=>{if(n)return n;let r=indexedDB.open(e);return r.onupgradeneeded=()=>r.result.createObjectStore(t),n=pi(r),n.then(e=>{e.onclose=()=>n=void 0},()=>{n=void 0}),n};return(e,n)=>r().then(r=>n(r.transaction(t,e).objectStore(t)))}var hi;function gi(){return hi||=mi(`keyval-store`,`keyval`),hi}function _i(e,t=gi()){return t(`readonly`,t=>pi(t.get(e)))}function vi(e,t,n=gi()){return n(`readwrite`,n=>(n.put(t,e),pi(n.transaction)))}function yi(e,t=gi()){return t(`readwrite`,t=>(t.delete(e),pi(t.transaction)))}var bi=mi(`offsite`,`tokens`);function xi(e){return _i(e,bi)}function Si(e,t){return vi(e,t,bi)}function Ci(e){return yi(e,bi)}var wi=1e3,Ti=3e4,Ei=1e4,Di=1e4,Oi=3e3,ki=3e4,Ai=3e5,ji=[`sessions.send`,`sessions.rewind`,`sessions.fork`,`git.commit`,`git.push`,`git.pullRequest`,`git.createPullRequest`],Mi=new Set,j=new Map,Ni=0;function Pi(){window.setInterval(()=>{for(let e of j.keys())Hi(e)},Ei),document.addEventListener(`visibilitychange`,()=>{document.hidden||Fi()}),window.addEventListener(`online`,Fi)}function Fi(){for(let[e,t]of j)t.connected?Hi(e):t.timer!==void 0&&(window.clearTimeout(t.timer),t.timer=void 0,t.failures=0,Ui(e,t,0))}function Ii(e,t){if(j.has(e))return;let n={urls:t,url:t[0],socket:null,connected:!1,ping:null,timer:void 0,failures:0,pending:new Map};j.set(e,n),Ui(e,n,0)}function Li(e){let t=j.get(e);t!==void 0&&(j.delete(e),window.clearTimeout(t.timer),t.socket!==null&&(t.socket.onclose=null,t.socket.close()),qi(e,t))}function Ri(e){Mi.add(e)}function zi(e){return j.get(e)?.connected===!0}function Bi(e){let t=j.get(e);if(t===void 0)throw Error(`This machine is not connected`);return t.url}function M(e,t,n){let r=j.get(e);if(r===void 0||r.socket===null||!r.connected)return Promise.reject(Error(r===void 0?`That machine was removed`:`Not connected to ${new URL(r.url).host}; reconnecting`));Ni+=1;let i=Ni;r.socket.send(JSON.stringify({id:i,method:t,params:n}));let a=ji.includes(t)?Ai:ki;return new Promise((e,n)=>{let o=window.setTimeout(()=>{r.pending.delete(i),n(Error(`${new URL(r.url).host} did not answer ${t} within ${a/1e3} seconds`))},a);r.pending.set(i,{resolve:t=>{window.clearTimeout(o),e(t)},reject:e=>{window.clearTimeout(o),n(e)}})})}function Vi(e,t,n,r){let i=j.get(e);i!==void 0&&i.socket!==null&&i.connected&&i.socket.send(di(t,n,r))}async function Hi(e){let t=j.get(e);return t!==void 0&&(t.ping??=Ji(e,t).finally(()=>{t.ping=null}),await t.ping)}async function Ui(e,t,n){let r=t.urls[n%t.urls.length];t.url=r;let i=await Wi(e,r).catch(()=>void 0);if(j.get(e)!==t)return;if(i===`unpaired`){for(let t of Mi)t.unpaired?.(e);return}if(i===void 0){Gi(e,t,n);return}let a=i===null?``:`?${new URLSearchParams({ticket:i})}`,o=new WebSocket(`${r.replace(/^http/,`ws`)}/ws${a}`);o.binaryType=`arraybuffer`;let s=window.setTimeout(()=>o.close(),Oi);o.onopen=()=>{window.clearTimeout(s),t.connected=!0,t.failures=0;for(let t of Mi)t.open?.(e,r)},o.onmessage=n=>Yi(e,t,n.data),o.onclose=()=>{window.clearTimeout(s),t.connected?(qi(e,t),Ki(e,t,0)):Gi(e,t,n)},t.socket=o}async function Wi(e,t){let n=await xi(e),r=await fetch(`${t}/api/ticket`,{method:`POST`,headers:n===void 0?{}:{authorization:`Bearer ${n}`},signal:AbortSignal.timeout(Oi)});if(r.status===401)return`unpaired`;if(!r.ok)throw Error(await r.text());return(await r.json()).ticket}function Gi(e,t,n){if((n+1)%t.urls.length!==0)Ui(e,t,n+1);else{for(let t of Mi)t.close?.(e);Ki(e,t,n+1)}}function Ki(e,t,n){let r=Math.min(Ti,wi*2**t.failures)*(.8+Math.random()*.4);t.failures+=1,t.timer=window.setTimeout(()=>{t.timer=void 0,Ui(e,t,n)},r)}function qi(e,t){for(let e of t.pending.values())e.reject(Error(`Disconnected from ${new URL(t.url).host}`));t.pending.clear(),t.connected=!1;for(let t of Mi)t.close?.(e)}async function Ji(e,t){let n=t.socket;if(n===null||!t.connected)return!1;let r=await Promise.race([M(e,`ping`,void 0).then(()=>!0,()=>!1),new Promise(e=>window.setTimeout(()=>e(!1),Di))]);return r||t.socket!==n?r:(n.onclose=null,n.close(),qi(e,t),j.get(e)===t&&Ki(e,t,0),!1)}function Yi(e,t,n){if(n instanceof ArrayBuffer){let t=fi(new Uint8Array(n));for(let n of Mi)n.frame?.(e,t);return}let r=JSON.parse(String(n));if(r.type===`reply`)Xi(t,r);else if(r.type===`terminal`)for(let t of Mi)t.terminal?.(e,r.event);else for(let t of Mi)t.event?.(e,r)}function Xi(e,t){let n=e.pending.get(t.id);n!==void 0&&(e.pending.delete(t.id),`error`in t?n.reject(Error(t.error)):n.resolve(t.result))}function Zi(e,t,{signal:n,edges:r}={}){let i,a=null,o=r!=null&&r.includes(`leading`),s=r==null||r.includes(`trailing`),c=()=>{a!==null&&(e.apply(i,a),i=void 0,a=null)},l=()=>{s&&c(),p()},u=null,d=()=>{u!=null&&clearTimeout(u),u=setTimeout(()=>{u=null,l()},t)},f=()=>{u!==null&&(clearTimeout(u),u=null)},p=()=>{f(),i=void 0,a=null},m=()=>{c()},h=function(...e){if(n?.aborted)return;i=this,a=e;let t=u==null;d(),o&&t&&c()};return h.schedule=d,h.cancel=p,h.flush=m,n?.addEventListener(`abort`,p,{once:!0}),h}function Qi(e){if(!e||typeof e!=`object`)return!1;let t=Object.getPrototypeOf(e);return t!==null&&t!==Object.prototype&&Object.getPrototypeOf(t)!==null?!1:Object.prototype.toString.call(e)===`[object Object]`}function $i(e,t){return e===t||Number.isNaN(e)&&Number.isNaN(t)}function ea(e,t,n){return ta(e,t,void 0,void 0,void 0,void 0,n)}function ta(e,t,n,r,i,a,o){let s=o(e,t,n,r,i,a);if(s!==void 0)return s;if(typeof e==typeof t)switch(typeof e){case`bigint`:case`string`:case`boolean`:case`symbol`:case`undefined`:return e===t;case`number`:return e===t||Object.is(e,t);case`function`:return e===t;case`object`:return na(e,t,a,o)}return na(e,t,a,o)}function na(e,t,n,r){if(Object.is(e,t))return!0;let i=s(e),a=s(t);if(i===`[object Arguments]`&&(i=ae),a===`[object Arguments]`&&(a=ae),i!==a)return!1;switch(i){case se:return e.toString()===t.toString();case f:return $i(e.valueOf(),t.valueOf());case ee:case h:case u:return Object.is(e.valueOf(),t.valueOf());case ce:return e.source===t.source&&e.flags===t.flags;case _:return e===t}n??=new Map;let T=n.get(e),le=n.get(t);if(T!=null&&le!=null)return T===t;n.set(e,t),n.set(t,e);try{switch(i){case v:if(e.size!==t.size)return!1;for(let[i,a]of e.entries())if(!t.has(i)||!ta(a,t.get(i),i,e,t,n,r))return!1;return!0;case m:{if(e.size!==t.size)return!1;let i=Array.from(e.values()),a=Array.from(t.values());for(let o=0;o<i.length;o++){let s=i[o],c=a.findIndex(i=>ta(s,i,void 0,e,t,n,r));if(c===-1)return!1;a.splice(c,1)}return!0}case ne:case d:case c:case o:case oe:case p:case y:case te:case C:case b:case ie:case g:if(x(e)!==x(t)||e.length!==t.length)return!1;for(let i=0;i<e.length;i++)if(!ta(e[i],t[i],i,e,t,n,r))return!1;return!0;case w:return e.byteLength===t.byteLength&&na(new Uint8Array(e),new Uint8Array(t),n,r);case re:return e.byteLength!==t.byteLength||e.byteOffset!==t.byteOffset?!1:na(new Uint8Array(e),new Uint8Array(t),n,r);case S:return e.name===t.name&&e.message===t.message;case ae:{if(!(na(e.constructor,t.constructor,n,r)||Qi(e)&&Qi(t)))return!1;let i=[...Object.keys(e),...l(e)],a=[...Object.keys(t),...l(t)];if(i.length!==a.length)return!1;for(let a=0;a<i.length;a++){let o=i[a],s=e[o];if(!Object.hasOwn(t,o))return!1;let c=t[o];if(!ta(s,c,o,e,t,n,r))return!1}return!0}default:return!1}}finally{n.delete(e),n.delete(t)}}function ra(e,t){return ea(e,t,a)}var ia=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e))},o=t=e(r,i,a);return a},aa=(e=>e?ia(e):ia),oa=e=>e;function sa(e,t=oa){let n=k.useSyncExternalStore(e.subscribe,k.useCallback(()=>t(e.getState()),[e,t]),()=>t(e.getInitialState()));return k.useDebugValue(n),n}var ca=e=>{let t=aa(e),n=e=>sa(t,e);return Object.assign(n,t),n},la=(e=>e?ca(e):ca);function ua(e,t){let n;try{n=e()}catch{return}return{getItem:e=>{let r=e=>e===null?null:JSON.parse(e,t?.reviver),i=n.getItem(e)??null;return i instanceof Promise?i.then(r):r(i)},setItem:(e,r)=>n.setItem(e,JSON.stringify(r,t?.replacer)),removeItem:e=>n.removeItem(e)}}var da=e=>t=>{try{let n=e(t);return n instanceof Promise?n:{then(e){return da(e)(n)},catch(e){return this}}}catch(e){return{then(e){return this},catch(t){return da(t)(e)}}}},fa=(e,t)=>(n,r,i)=>{let a={storage:ua(()=>window.localStorage),partialize:e=>e,version:0,merge:(e,t)=>({...t,...e}),...t},o=!1,s=0,c=new Set,l=new Set,u=a.storage;if(!u)return e((...e)=>{console.warn(`[zustand persist middleware] Unable to update item '${a.name}', the given storage is currently unavailable.`),n(...e)},r,i);let d=()=>{let e=a.partialize({...r()});return u.setItem(a.name,{state:e,version:a.version})},f=i.setState;i.setState=(...e)=>(f(...e),d());let p=e((...e)=>(n(...e),d()),r,i);i.getInitialState=()=>p;let m,h=()=>{if(!u)return;let e=++s;o=!1,c.forEach(e=>e(r()??p));let t=a.onRehydrateStorage?.call(a,r()??p)||void 0;return da(u.getItem.bind(u))(a.name).then(e=>{if(e){if(typeof e.version==`number`&&e.version!==a.version){if(a.migrate){let t=a.migrate(e.state,e.version);return t instanceof Promise?t.then(e=>[!0,e]):[!0,t]}console.error(`State loaded from storage couldn't be migrated since no migrate function was provided`)}else return[!1,e.state]}return[!1,void 0]}).then(t=>{if(e!==s)return;let[i,o]=t;if(m=a.merge(o,r()??p),n(m,!0),i)return d()}).then(()=>{e===s&&(t?.(r(),void 0),m=r(),o=!0,l.forEach(e=>e(m)))}).catch(n=>{e===s&&t?.(void 0,n)})};return i.persist={setOptions:e=>{a={...a,...e},e.storage&&(u=e.storage)},clearStorage:()=>{++s,u?.removeItem(a.name)},getOptions:()=>a,rehydrate:()=>h(),hasHydrated:()=>o,onHydrate:e=>(c.add(e),()=>{c.delete(e)}),onFinishHydration:e=>(l.add(e),()=>{l.delete(e)})},a.skipHydration||h(),m||p},pa=`composerDrafts`,ma={text:``,images:[],files:[],settings:null},ha=mi(`offsite-drafts`,`drafts`),ga=mi(`offsite-draft-files`,`files`),_a=Zi(e=>void vi(pa,e,ha),300),va={getItem:async e=>await _i(e,ha)??null,setItem:(e,t)=>_a(t),removeItem:e=>yi(e,ha)},ya={drafts:{},stash:[]},N=la()(fa(()=>ya,{name:pa,storage:va,skipHydration:!0,version:1,migrate:()=>ya}));window.addEventListener(`pagehide`,_a.flush);function ba(){return N.persist.rehydrate()}function xa(e){return N(t=>t.drafts[e]??ma)}function Sa(e,t){let n=Ea(e),r=t(n),i=N.getState().stash;for(let e of n.files)!r.files.some(t=>t.id===e.id)&&!i.some(t=>t.files.some(t=>t.id===e.id))&&yi(e.id,ga);N.setState(t=>{let n={...t.drafts,[e]:r};return r.text===``&&r.images.length===0&&r.files.length===0&&r.settings===null&&delete n[e],{drafts:n}})}async function Ca(e){let t=crypto.randomUUID();return await vi(t,e,ga),t}async function wa(e){return await _i(e,ga)}function Ta(e){Sa(e,()=>ma)}function Ea(e){return N.getState().drafts[e]??ma}function Da(e){return N.getState().drafts[e]?.settings??null}function Oa(e,t){Sa(e,e=>({...e,settings:t}))}function ka(){return N(e=>e.stash)}function Aa(){return N.getState().stash}function ja(e){return e.text.trim()!==``||e.images.length>0||e.files.length>0}function Ma(e){let t=Ea(e);N.setState(e=>({stash:[{id:crypto.randomUUID(),createdAt:Date.now(),text:t.text,images:t.images,files:t.files},...e.stash]})),Sa(e,e=>({...e,text:``,images:[],files:[]}))}function Na(e,t,n){let r=N.getState().stash.find(e=>e.id===t);if(r===void 0)throw Error(`This stashed prompt no longer exists`);ja(Ea(e))&&Ma(e),N.setState(e=>({stash:e.stash.filter(e=>e.id!==t)}));let i=r.text.replace(/\[Image #(\d+)\]/g,(e,t)=>{let i=r.images.findIndex(e=>e.number===Number(t));return i===-1?e:`[Image #${n+i+1}]`});return Sa(e,e=>({...e,text:i,images:r.images.map((e,t)=>({...e,number:n+t+1})),files:r.files})),i}function Pa(e){let t=N.getState().stash.find(t=>t.id===e);if(t!==void 0){N.setState(t=>({stash:t.stash.filter(t=>t.id!==e)}));for(let e of t.files)yi(e.id,ga)}}function Fa(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function Ia(e,t=`|`){return e.map(e=>oo(e)).join(t)}function La(e,t){return typeof t==`bigint`?t.toString():t}var Ra=class{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;return e!==void 0&&(this._value=e(),this._getter=void 0),this._value}};function za(e){return new Ra(e)}function Ba(e){return e==null}function Va(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function Ha(e,t){let n=e/t,r=Math.round(n),i=4*2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}function Ua(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Wa(e){let t=Object.getOwnPropertyDescriptor(e,`shape`);return t?.get?t.get.raw:t?.value}function Ga(e){return Wa(e._zod.def)??e._zod.def.shape}function Ka(e,t,n){Object.defineProperty(e,t,{get(){let e=n();return Ua(this,t,e),e},enumerable:!0,configurable:!0})}function qa(e,t,n){t in e?Ua(e,t,n):e[t]=n}function Ja(e,t,n,r){let i=Ga(t);for(let a of n){let n=Object.getOwnPropertyDescriptor(i,a);n.enumerable&&(n.get?Ka(e,a,()=>{let e=t._zod.def.shape[a];return r?r(e,a):e}):qa(e,a,r?r(n.value,a):n.value))}}function Ya(e,t){for(let n of Reflect.ownKeys(t)){let r=Object.getOwnPropertyDescriptor(t,n);r.enumerable&&(r.get?Ka(e,n,()=>t[n]):qa(e,n,r.value))}}function P(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function Xa(e){return JSON.stringify(e)}function Za(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var Qa=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function $a(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var eo=za(()=>{if(R.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function to(e){if($a(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return $a(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function no(e){return to(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var ro=new Set([`string`,`number`,`symbol`]);function io(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function ao(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function F(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function oo(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function so(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}var co={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},lo={int64:[BigInt(`-9223372036854775808`),BigInt(`9223372036854775807`)],uint64:[BigInt(0),BigInt(`18446744073709551615`)]};function uo(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);let i={};return Ja(i,e,fo(e,t)),ao(e,P(n,{shape:i,checks:[]}))}function fo(e,t){let n=Ga(e),r=[];for(let e of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,e)?.enumerable)throw Error(`Unrecognized key: "${String(e)}"`);t[e]&&r.push(e)}return r}function po(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);let i=new Set(fo(e,t)),a={};return Ja(a,e,Reflect.ownKeys(Ga(e)).filter(e=>!i.has(e))),ao(e,P(n,{shape:a,checks:[]}))}function mo(e,t){if(!to(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=Ga(e);for(let e of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return ao(e,P(e._zod.def,{shape:ho(e,t)}))}function ho(e,t){let n={};return Ja(n,e,Reflect.ownKeys(Ga(e))),Ya(n,t),n}function go(e,t){if(!to(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return ao(e,P(e._zod.def,{shape:ho(e,t)}))}function _o(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);let n={};return Ja(n,e,Reflect.ownKeys(Ga(e))),Ja(n,t,Reflect.ownKeys(Ga(t))),ao(e,P(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function vo(e,t,n,r=`partial`){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${r}() cannot be used on object schemas containing refinements`);let a=n?new Set(fo(t,n)):void 0,o={};return Ja(o,t,Reflect.ownKeys(Ga(t)),e&&((t,n)=>a&&!a.has(n)?t:new e({type:`optional`,innerType:t}))),ao(t,P(t._zod.def,{shape:o,checks:[]}))}function yo(e,t,n){let r=n?new Set(fo(t,n)):void 0,i={};return Ja(i,t,Reflect.ownKeys(Ga(t)),(t,n)=>r&&!r.has(n)?t:new e({type:`nonoptional`,innerType:t})),ao(t,P(t._zod.def,{shape:i}))}function bo(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function xo(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function So(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function Co(e){return typeof e==`string`?e:e?.message}function wo(e){let t=[];for(let n of e??[]){let e=n._zod.def;if(!/_(length|size)$|_equals$/.test(e.check))break;let r=e.maximum??e.length??e.size;r>=0&&t.push([r,n])}return t}function To(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function Eo(e,t,n){var r;let i=e.inst?._zod?.traits;i?.has(`$ZodType`)&&(i.has(`$ZodCheck`)?(r=e).schema??(r.schema=e.inst):e.schema=e.inst);let a=e.schema===e.inst?void 0:e.schema?._zod.def?.error,o=e.message?e.message:Co(e.inst?._zod.def?.error?.(e))??Co(a?.(e))??Co(t?.error?.(e))??Co(n.customError?.(e))??Co(n.localeError?.(e))??`Invalid input`,s={};for(let t of Object.keys(e))t!==`inst`&&t!==`schema`&&t!==`continue`&&t!==`input`&&t!==`__proto__`&&(s[t]=e[t]);return s.path??=[],s.message=o,t?.reportInput&&(s.input=e.input),s}var Do=/[\uD800-\uDBFF]/;function Oo(e){let t=e.length;if(!Do.test(e))return t;let n=t;for(let r=0;r<t-1;r++)(e.charCodeAt(r)&64512)==55296&&(e.charCodeAt(r+1)&64512)==56320&&(n--,r++);return n}function ko(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function Ao(e){let t=typeof e;switch(t){case`number`:return Number.isNaN(e)?`nan`:`number`;case`object`:{if(e===null)return`null`;if(Array.isArray(e))return`array`;let t=e;if(t&&Object.getPrototypeOf(t)!==Object.prototype&&`constructor`in t&&t.constructor)return t.constructor.name}}return t}function jo(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}function Mo(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):Io(e,n,r.value)}}function No(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function Po(e,t,n){return No(e,t,n,!1)}function Fo(e,t){for(let n in e){let r=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return No(this,n,r(this))},set(e){No(this,n,e)}})}return t}function Io(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:No(this,t,n.bind(this))},set(e){No(this,t,e)}})}function Lo(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}var Ro,zo=!1,Bo={configurable:!0,get(){zo=!0}};function I(e,t,n){let r=Object.getPrototypeOf(e._zod);t in r&&Ro!==e._zod?Ro=void 0:(Ro=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,Bo);let e=zo;zo=!1;try{let r=n(this);return zo?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),zo||=e,r}catch(n){throw delete this[t],zo||=e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}}))}function Vo(e,t,n,r){let i=Lo(e,t);i&&Object.defineProperty(i,t,{configurable:!0,get(){let e={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,e),e.value=n(this),Object.defineProperty(this,t,e),e.value},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:e})}})}var Ho=`~constantCatch`;function Uo(e){let t=()=>e;return t[Ho]=!0,t}var Wo,Go={value:void 0,enumerable:!1},Ko=`captureStackTrace`in Error?Error:null;function qo(e){let t=Ko;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return Ko=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function L(e,t,n,r){let i={};function a(e){this.def=e,this.constr=d,this.traits=new Set}a.prototype=i;let o=n,s=o&&new WeakSet;function c(n,r){if(!n._zod){Go.value=new a(r);try{Object.defineProperty(n,"_zod",Go)}finally{Go.value=void 0}}else if(n._zod.traits.has(e))return;if(n._zod.traits.add(e),t(n,r),s){let e=Object.getPrototypeOf(n),t=n._zod.constr.prototype,r=e;for(;r&&r!==t;)r=Object.getPrototypeOf(r);let i=r??e;s.has(i)||(s.add(i),Mo(i,o))}let i=d.prototype;for(let e in i)Object.prototype.hasOwnProperty.call(i,e)&&(e in n||(n[e]=i[e].bind(n)))}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function d(e){let t=r?.Parent?qo(u):this;c(t,e);let n=t._zod.deferred;if(n){for(let e of n)e();t._zod.deferred=void 0}let i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:t=>r?.Parent&&t instanceof r.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var Jo=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},Yo=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(Wo=globalThis).__zod_globalConfig??(Wo.__zod_globalConfig={});var R=globalThis.__zod_globalConfig;function Xo(e){return e&&Object.assign(R,e),R}function Zo(){let e=this._zod;return e.message??=JSON.stringify(e.def,La,2),e.message}function Qo(e){this._zod.message=e}var $o={get:Zo,set:Qo,enumerable:!0,configurable:!0},es={value:void 0,enumerable:!1},ts=new WeakSet([Object.prototype,Error.prototype]),ns=L(`$ZodError`,(e,t)=>{e.name=`$ZodError`,es.value=t,Object.defineProperty(e,"issues",es),es.value=void 0,Object.defineProperty(e,"message",$o);let n=Object.getPrototypeOf(e);ts.has(n)||(ts.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let e=()=>this.message;return Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0})}}))});function rs(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t===`__proto__`?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function is(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?rs(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function as(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i],o=i===e.length-1;if(n===`_errors`){o&&r._errors.push(t(a)),i++;continue}Object.prototype.hasOwnProperty.call(r,n)||Object.defineProperty(r,n,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let s=r[n];o&&s._errors.push(t(a)),r=s,i++}}}};return r(e),n}function os(e){let t=[],n=e.map(e=>typeof e==`object`?e.key:e);for(let e of n)typeof e==`number`?t.push(`[${e}]`):typeof e==`symbol`?t.push(`[${JSON.stringify(String(e))}]`):/[^\w$]/.test(e)?t.push(`[${JSON.stringify(e)}]`):(t.length&&t.push(`.`),t.push(e));return t.join(``)}function ss(e){let t=[],n=[...e.issues].sort((e,t)=>(e.path??[]).length-(t.path??[]).length);for(let e of n)t.push(`✖ ${e.message}`),e.path?.length&&t.push(` → at ${os(e.path)}`);return t.join(`
|
|
2
|
+
\r`.includes(e)?``:encodeURIComponent(e))),zt(e)}function Vt(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=Wt(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[Ft];i=Ht(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[Ft];i=Ht(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[Ft]!==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 Ht(e,t){let n=Gt();return{...t,key:n,__TSR_key:n,[Ft]:e}}function Ut(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=>Bt(e?.createHref?e.createHref(t):t),c=e?.parseLocation??(()=>Wt(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!t.history.state?.__TSR_key&&!t.history.state?.key){let e=Gt();t.history.replaceState({[Ft]: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=Wt(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[Ft]-l.state[Ft],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=Vt({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(Lt,x,{capture:!0}),t.removeEventListener(It,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(Lt,x,{capture:!0}),t.addEventListener(It,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 Wt(e,t){let n=Bt(e),r=n.indexOf(`#`),i=n.indexOf(`?`);if(!t){let e=Gt();t={[Ft]: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 Gt(){return(Math.random()+1).toString(36).slice(7)}function Kt(e,t){return e.protocol!==`http:`&&e.protocol!==`https:`||e.origin!==t||!!e.username||!!e.password}function qt(e){return e.pathname+e.search+e.hash}function Jt(e){return e.options.loader||e.options.beforeLoad||e.lazyFn||e.options.component?.preload||e.options.pendingComponent?.preload}function Yt(e,t){return{fromLocation:t,toLocation:e,pathChanged:t?.pathname!==e.pathname,hrefChanged:t?.href!==e.href,hashChanged:t?.hash!==e.hash}}function Xt({key:e,__TSR_key:t,__TSR_index:n,__hashScrollIntoViewOptions:r,...i}){return i}function Zt(e){return e.findIndex(e=>e.status===`error`||e.status===`notFound`||e._notFound)+1}function Qt(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 $t=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:Ut()),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!==`/`&&je(n)?jt(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=Pt(this.latestLocation,e),Ze(this)}},this.updateLatestLocation=()=>{this.latestLocation=this.parseLocation(this.history.location,this.latestLocation)},this.buildRouteTree=()=>{let e=xt(this.routeTree,this.options.caseSensitive);return this.options.routeMasks&&_t(this.options.routeMasks,e.processedTree),{...e,resolvePathCache:lt(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:we(e),external:!1,searchStr:o,search:pe(t?.search,i),hash:we(r.slice(1)),state:me(t?.state,a)}}let o=Mt(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:we(zt(o.pathname)),external:!!this.rewrite&&Kt(o,this.origin),searchStr:c,search:pe(t?.search,s),hash:we(o.hash.slice(1)),state:me(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=bt(Ae(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=Wt(n.href,{});n={...n,to:Mt(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=Ne(s[0]===`/`?``:n.unsafeRelative===`path`?a().pathname:n.from??o()[1],s,this.options.trailingSlash,this.resolvePathCache),l=this.routesByPath[Ae(c)],u=c.includes(`$`),d;if(l)d=l._branch??=wt(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??mt(!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??=an(n.params,e),!de(p))break;p===e&&(p=Object.assign(fe(),p));try{Object.assign(p,t(p))}catch{}}}p??=an(n.params,on(n.params,f)?o()[3]:sn);let m=e.leaveParams?c:zt(we(f?Le(c,f,p,this.pathParamsDecoder):c)),h=cn(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,rn(n.options.validateSearch,{...e,...t}))}catch{}}),t=e}return t},_=h.length?ln(h,g(),n):n.search===!0?g():typeof n.search==`function`?n.search(g()):n.search||sn,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:sn,S=`${m}${v}${b}`,C,w,ee=!1;if(this.rewrite){let e=new URL(S,this.origin),t=e.origin,n=Nt(this.rewrite,e);C=qt(e),Kt(n,t)?(w=n.href,ee=!0):w=zt(qt(n))}else C=Te(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=vt(r.pathname,this.processedTree);if(t){let i=Object.assign(fe(),t.rawParams),{from:a,params:o,...s}=t.route,c=an(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 en(this,r.publicHref,{replace:n.replace,ignoreBlocker:t});let i,a=Ae(this.latestLocation.href)===Ae(n.href)&&ge(Xt(n.state),Xt(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?xe(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 en(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 $n(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(Yt(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`)&&Jt(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(Se.test(n)||(r=xe(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:Kt(e,this.origin)||(n=qt(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=mn,this.preloadRoute=e=>er(this,e),this.matchRoute=(e,t)=>{let n={...e,to:e.to?Ne(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=yt(r.pathname,t?.caseSensitive??!1,t?.fuzzy??!1,a.pathname,this.processedTree);return!o||e.params&&!ge(o.rawParams,e.params,!0)?!1:t?.includeSearch??!0?ge(a.search,r.search,!0)?o.rawParams:!1:o.rawParams},this.getStoreConfig=t,e.pathParamsAllowedCharacters?.length&&(this.pathParamsDecoder=Pe(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??rt,parseSearch:e.parseSearch??nt,protocolAllowlist:e.protocolAllowlist??be}),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=mt(!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[`**`]:Ae(e.pathname))&&(this.options.notFoundRoute?a=[...a,this.options.notFoundRoute]:o=!0);let s=o?un(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=rn(i.options.validateSearch,{...n})??void 0;l={...n,...e},f={...r,...e}}catch(e){let r=e;if(e instanceof tn||(r=new tn(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=fe(),_=i._interpolation?Le(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{dn(i,d)}catch(e){if(x=Re(e)||ct(e)?e:new nn(e.message,{cause:e}),t?.throwOnError)throw x}let S=y?`stay`:`enter`,C;if(b)C={...b,cause:S,search:pe(y?y.search:b.search,l),_strictSearch:f,searchError:p};else{let e=Jt(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?pe(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?me(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`?pe(n.params,d):d,t?._controller&&(n.context={})}return c}matchRoutesLightweight(e){let t=T(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=T(a),c={...e.search};for(let e of a)try{Object.assign(c,rn(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{dn(t,e)}catch{}u=e}let d=[a,s.fullPath,c,u];return this.lightweightCache.set(e,[r,d]),d}};async function en(e,t,{replace:n,ignoreBlocker:r}){if(!Ce(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 tn=class extends Error{},nn=class extends Error{};function rn(e,t){if(e==null)return{};if(`~standard`in e){let n=e[`~standard`].validate(t);if(n instanceof Promise)throw new tn(`Async validation not supported`);if(n.issues)throw new tn(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 an(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 on(e,t){return typeof e==`function`?!0:!t||e===!1||e===null?!1:e===void 0||e===!0||t.some(t=>typeof t!=`string`&&!ue.call(e,t[1]))}var sn=Object.freeze({});function cn(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=rn(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 ln(e,t,n){let r=(t,i,a)=>{if(t>=e.length){if(!n.search)return{};if(n.search===!0)return i;let e=le(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 un(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 ot}function dn(e,t){let n=e.options.params?.parse??e.options.parseParams;n&&Object.assign(t,n(t))}function fn(e,t){return e.options[t]?.preload?.()}function pn(e,t){let n=fn(e,`component`),r=fn(e,`pendingComponent`);return t&&(r?r=r.then(t):t()),n&&r?Promise.all([n,r]).then(()=>{}):n??r}function mn(e,t,n){let r=()=>t===!1?void 0:t?fn(e,t):pn(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 hn(e){let t=e.findIndex(e=>e.status!==`success`||e._notFound)+1;return t&&t<e.length?e.slice(0,t):e}function gn(e,t,n){let r=e._tx;return t&&r?.[2]===n&&!r[3].some(e=>e.routeId===t)}var E=0,_n=1,vn=2,D=3,yn=[4];function bn(e){return typeof e[0]==`number`}function xn(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 Sn(e,t){return e.routesById[t.routeId]}function Cn(e,t,n){return ct(e)?[D,e]:Re(e)?(e.routeId||=n,[vn,e]):t?(typeof e?.then==`function`&&(e=Error(`A Promise was thrown`,{cause:e})),[_n,e]):[E,e]}function wn(e,t){let n=Cn(t,!0,e.id);if(n[0]!==_n)return n;try{e.options.onError?.(n[1])}catch(t){n=Cn(t,!0,e.id)}return n}function Tn(e,t,n,r,i){return i[0].signal.aborted?yn:Bn(e,t,n,wn(n,r),i)}async function En(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=Sn(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 On(e,r),[i,Tn(e,t,u,a,n)]}if(c.aborted)return[i,yn];let p=r.paramsError??r.searchError;if(p!==void 0)return On(e,r),[i,Tn(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{An(e,r,`beforeLoad`,n[0]);let a=m({...f,search:r.search,context:r.context,...e.options.additionalContext}),o=await(typeof a?.then==`function`?xn(a,c):a);if(c.aborted)return[i,yn];let s=Bn(e,t,u,Cn(o,!1,u.id),n);if(s[0]!==E)return On(e,r),[i,s];r.context={...r.context,...o}}catch(a){return On(e,r),[i,Tn(e,t,u,a,n)]}finally{r.status=h,An(e,r,!1,n[0])}}i()}function Dn(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 On(e,t){let n=t._flight;t._flight=void 0,Dn(e,t,n)?.abort()}function O(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=Dn(e,a,t);n&&i.push(n)}}for(let e of i)e.abort()}function kn(e){for(let t of e){let e=t._flight;e&&e[2]++}}function An(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 jn(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 Mn(e,t,n,r,i,a,o){let s=o[0],c=s.signal;if(c.aborted)return yn;if(!i)return[E,void 0];let l=n._flight;An(e,n,`loader`,s);try{if(!l){let s=new AbortController;l=[Promise.resolve().then(()=>i(jn(e,t,n,r,s,a,!!o[3]))).then(e=>Cn(e,!1,r.id),e=>Cn(e,!0,r.id)).then(t=>(t[0]!==E&&e._flights?.get(n.id)===l&&(e._flights.delete(n.id),l[2]||s.abort()),t[0]===_n&&l[2]?wn(r,t[1]):t)),s,1],(e._flights??=new Map).set(n.id,l)}return n._flight=l,n.abortController=l[1],Bn(e,t,r,await xn(l[0],c),o)}catch(t){if(t!==c||!c.aborted)throw t;return On(e,n),yn}finally{An(e,n,!1,s)}}function Nn(e,t,n){t[0]!==D&&(e.status=`success`,e.error=void 0,t[0]===E?(e.loaderData=t[1],e.invalid=!1,e.updatedAt=Date.now(),e.preload=n):e.invalid=!0)}function Pn(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&&On(e,r)}function Fn(e,t){return t[0]===_n||t[0]===vn?{...e,status:t[0]===_n?`error`:`notFound`,error:t[1],_flight:void 0}:e}function In(e,t,n,r,i,a,o){let s=t[1][n],c=Sn(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(jn(e,t,s,c,a[0],i,l))),a[0].signal.aborted&&(p=yn)),!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,On(e,s),p=Tn(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,Dn(e,s,t)?.abort(),n>=o&&(s.status=`pending`),S?.()}b||(s.isFetching=!1);let w=!p&&x?Mn(e,t,s,c,g,i,a).then(t=>(Nn(s,t,l),t[0]===E&&(m&&!a[0].signal.aborted&&Pn(e,s,u),n>=o&&(s.status=`pending`)),t)):Promise.resolve(p??[E,s.loaderData]),ee=(async()=>{try{let e=mn(c,void 0,C);e&&await xn(e,a[0].signal)}catch(r){if(!t[1].some((e,t)=>t<=n&&(e.status===`error`||e.status===`notFound`||e._notFound)))return[n,Tn(e,t,c,r,a)]}let r=await w;x&&r[0]===E&&s.status===`pending`&&!a[0].signal.aborted&&(s.status=`success`,S?.())})();if(r.push([n,w,ee]),!y)return w.then(e=>Fn(s,e));let te={...s,status:`pending`,preload:!1,_flight:v};s.invalid=!1,s.isFetching=`loader`;let ne=Mn(e,t,te,c,g,i,a).then(e=>(s.isFetching=!1,Nn(te,e,!1),e));return(t[2]??=[]).push([n,ne,ee,te]),ne.then(e=>Fn(te,e))}async function Ln(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=Sn(e,t[n]);try{let e=mn(i,!1);e&&await xn(e,r)}catch(e){if(e===r&&r.aborted)throw e}if(i.options.notFoundComponent)return n}return a?.routeId?o:i}function Rn(e,t){t[2]&&=(O(e,t[2].map(e=>e[3])),void 0)}async function zn(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]>=D)throw[a,t];!i&&t[0]!==E&&(i=[a,t],await Promise.all((n??[]).map(e=>{if(!(e[0]<=a))return e[1].then(t=>{if(t[0]===D)throw[e[0],t]})})))}})))}catch(e){return e}return t??i}function Bn(e,t,n,r,i,a){for(;r[0]===D;){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]?[D,t]:[D,t,a]}return[D,o,n]}catch(e){r=a?[_n,e]:wn(n,e),a=!0}}return r}async function Vn(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]===vn?Ln(e,o,t,r.signal):t[0],d=l<0?o.length:l;if((s?.[1][0]??0)>=D)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]!==E&&t[0]<D&&!(`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)>=D){let n=s[1];if(n[0]!==D||n[1].options.reloadDocument||n[2])return Rn(e,t),n;c=!0,s=[0,[_n,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===_n?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=Sn(e,u);try{await xn(i?Promise.resolve().then(()=>mn(m,l===_n?`errorComponent`:`notFoundComponent`)):Promise.all([mn(m),mn(m,`notFoundComponent`)]),r.signal)}catch(n){if(n===r.signal&&r.signal.aborted)return Rn(e,t),yn}i?c&&(r.abort(),await Promise.all([...n.map(e=>e[1]),...n.map(e=>e[2]),...(t[2]??[]).map(e=>e[1])]),Rn(e,t),O(e,o),p()):u.status=`success`}return t}async function Hn(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=Sn(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 xn(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 Un(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 Ln(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=In(e,i,t,u,f,r,l)},m=await En(e,i,r,c,p,l);if(m){if(r[4]=!0,c=m[0],m[1][0]===vn){let t=await Ln(e,n,m,a);m[2]=t,c=Math.min(c,t+1)}else m[1][0]>=D&&(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=Vn(e,i,u,r[0],zn(u,m,i[2]),r[7]);i[2]?.length&&(i[3]=zn(i[2],void 0,void 0,h.then(e=>bn(e)?0:hn(n).length,()=>0))),o=await h}catch(t){if(Rn(e,i),t===a&&a.aborted)return yn;throw t}return bn(o)?o:Hn(e,o,a,r[6]===n.length?r[6]:0)}function Wn(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=Sn(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(()=>Wn(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 Gn(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 Kn(e,t){let n=e._pending;if(!n)return;clearTimeout(n[3]);let r=n[2]-Date.now();if(!n[4]||r<=0||!hn(t[3]).some(e=>e.id===n[1]))return;let i;try{await xn(new Promise(e=>{i=setTimeout(e,r)}),t[0].signal)}catch{}clearTimeout(i)}function qn(e,t){e._committed=t,e.stores.setMatches(t)}function Jn(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=hn(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=Sn(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=Zt(n);qn(e,n),O(e,[...o.values(),...i].filter(e=>e._flight&&c.get(e.id)!==e),n),Qt(e,i,n,a,l,t)}async function Yn(e,t){let n=e._tx;for(;n&&n!==t;)t=n,await n[5],n=e._tx}function Xn(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 Zn(e,t,n,r,i){let a=n.map(e=>({...e}));kn(a);for(let t of r)On(e,a[t[0]]),a[t[0]]=t[3];let o=[t[2],a],s;try{s=await Vn(e,o,r,t[0],i)}catch(t){throw O(e,a),t}if(bn(s))O(e,a),s[0]===D&&e._tx===t&&e._committed===n&&await Xn(e,t,s);else if(await Hn(e,s,t[0].signal),e._tx!==t||e._committed!==n)O(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),On(e,n))}qn(e,a),O(e,n,a)}}async function Qn(e,t,n,r,i,a){let o=await Un(e,t[2],t[3],[t[0],t[1],e._committed,void 0,i,n,a,r]);if(bn(o)){let n=o[0]===D&&e._tx===t;if((!n||o[1].options.reloadDocument)&&Gn(e,t),O(e,t[3]),t[3]=[],!n)return;if(e._tx!==t){Gn(e,t);return}await Xn(e,t,o);return}let s=o[1];if(e._tx===t&&await Kn(e,t),e._tx!==t){Gn(e,t),O(e,s),Rn(e,o);return}let c=t[2],l=Yt(c,e.stores.resolvedLocation.get()),u=o[2];await e.startViewTransition(async()=>{if(e._tx===t&&await Kn(e,t),e._tx!==t){Gn(e,t),O(e,s),Rn(e,o);return}let n=await e.startTransition(()=>{Gn(e,t),Jn(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&&Zn(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)):Rn(e,o)})}async function $n(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=Yt(a,r);e.emit({type:`onBeforeNavigate`,...t}),u.signal.aborted||e.emit({type:`onBeforeLoad`,...t})}if(u.signal.aborted){await Yn(e,n);return}let f=i.href===a.href,p=u,m=e.matchRoutes(a,{_controller:u});kn(m);let h=l?c[1](m):void 0;if(h?p=l:l?.abort(),u.signal.aborted){O(e,m),await Yn(e,n);return}e._preflight=void 0;let g,_=()=>Qn(e,y,f,()=>Wn(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(()=>Yn(e,y))];if(e._tx=y,n){for(let t of e.stores.matches.get()){if(e._tx!==y)break;t.isFetching&&An(e,t,!1)}n[0].abort(),O(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))&&Wn(e,y),g?.(_()),await y[5]):(O(e,y[3]),y[3]=[],g?.(),await Yn(e,y))}async function er(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}),kn(a),o=(e._preloads??=new Map).set(i,a),s=await Un(e,n,a,[i,t,r,!0])}finally{o&&(o=o.delete(i),O(e,a)),i.abort()}if(!bn(s))return s[1];if(!o||s.length<3)return;n=s[2]}catch(e){Re(e)||console.error(e);return}}}var tr=`Error preloading route! ☝️`,nr=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=ot:this.parentRoute||De();let r=n?ot:t?.path;r&&r!==`/`&&(r=ke(r));let i=t?.id||r,a=n?ot:Oe((this.parentRoute.id===`__root__`?``:this.parentRoute.id)+`/`+(i??``));r===`__root__`&&(r=`/`);let o=a===`__root__`?`/`:r===void 0?this.parentRoute.fullPath:Oe(this.parentRoute.fullPath+`/`+r);this._path=r,this._id=a,this._fullPath=o,this._to=Ae(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=>st({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.`)}},rr=class extends nr{constructor(e){super(e)}},k=e(r(),1),ir=k.createContext(null);function ar(e){return k.useContext(ir)}function or(e,t){let n=e.stores.location,r=new Set,i,a,o=n=>{gn(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=k.createContext(void 0),cr=k.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,Sr(e))}}),vr=0,yr=0,A,br=0;function xr(e){try{++br,e()}finally{--br||Cr()}}function Sr(e){let t=e.depsTail,n=t===void 0?e.deps:t.nextDep;for(;n!==void 0;)n=mr(n,e)}function Cr(){if(!(br>0)){for(;vr<yr;){let e=dr[vr];dr[vr++]=void 0,e.notify()}vr=0,yr=0}}function wr(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 A!==void 0&&pr(i,A,fr),i._snapshot},subscribe(e){let t=ur(e),n={current:!1},r=Tr(()=>{i.get(),n.current?(A=void 0,t.next?.(i._snapshot)):n.current=!0});return{unsubscribe:()=>{r.stop()}}},_update(e){let a=A,o=t?.compare??Object.is;if(n)A=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{A=a,n&&(i.flags&=-5),Sr(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 A!==void 0&&pr(i,A,fr),i._snapshot}):i.set=function(e){if(i._update(e)){let e=i.subs;e!==void 0&&(hr(e),_r(e),Cr())}},i}function Tr(e){let t=()=>{let t=A;A=n,++fr,n.depsTail=void 0,n.flags=6;try{return e()}finally{A=t,n.flags&=-5,Sr(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,Sr(this)}};return t(),n}var Er=t((e=>{var t=r();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:n,a=t.useState,o=t.useEffect,s=t.useLayoutEffect,c=t.useDebugValue;function l(e,t){var n=t(),r=a({inst:{value:n,getSnapshot:t}}),i=r[0].inst,l=r[1];return s(function(){i.value=n,i.getSnapshot=t,u(i)&&l({inst:i})},[e,n,t]),o(function(){return u(i)&&l({inst:i}),e(function(){u(i)&&l({inst:i})})},[e]),c(n),n}function u(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!i(e,n)}catch{return!0}}function d(e,t){return t()}var f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?d:l;e.useSyncExternalStore=t.useSyncExternalStore===void 0?f:t.useSyncExternalStore})),Dr=t(((e,t)=>{t.exports=Er()})),Or=t((e=>{var t=r(),n=Dr();function i(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var a=typeof Object.is==`function`?Object.is:i,o=n.useSyncExternalStore,s=t.useRef,c=t.useEffect,l=t.useMemo,u=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var d=s(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=l(function(){function e(e){if(!o){if(o=!0,s=e,e=r(e),i!==void 0&&f.hasValue){var t=f.value;if(i(t,e))return c=t}return c=e}if(t=c,a(s,e))return t;var n=r(e);return i!==void 0&&i(t,n)?(s=e,t):(s=e,c=n)}var o=!1,s,c,l=n===void 0?null:n;return[function(){return e(t())},l===null?void 0:function(){return e(l())}]},[t,n,r,i]);var p=o(e,d[0],d[1]);return c(function(){f.hasValue=!0,f.value=p},[p]),u(p),p}})),kr=t(((e,t)=>{t.exports=Or()}))();function Ar(e,t){return e===t}function jr(e,t=e=>e,n){let r=n?.compare??Ar,i=(0,k.useCallback)(t=>{let{unsubscribe:n}=e.subscribe(t);return n},[e]),a=(0,k.useCallback)(()=>e.get(),[e]);return(0,kr.useSyncExternalStoreWithSelector)(i,a,a,t,r)}var Mr={};function Nr(e,t){let n=k.useRef();return r=>{let i=e?.select?e.select(r):r;return e?.structuralSharing??t.options.defaultStructuralSharing?n.current=me(n.current,i):i}}function Pr(e){let t=ar(),n=k.useContext(e.from?cr:sr),r=e.from??n,i=t.stores.getMatchStore(r),a=Nr(e,t),o=jr(i,e=>e?a(e):Mr);if(o!==Mr)return o;(e.shouldThrow??!0)&&De()}function Fr(e){return Pr({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function Ir(e){let{select:t,...n}=e;return Pr({...n,select:e=>t?t(e.loaderDeps):e.loaderDeps})}function Lr(e){return Pr({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 Rr(e){return Pr({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function zr(e){let t=ar();return k.useCallback(n=>t.navigate({...n,from:n.from??e?.from}),[e?.from,t])}function Br(e){return Pr({...e,select:t=>e.select?e.select(t.context):t.context})}var Vr=n();function Hr(...e){let t=k.useRef(e),n=t.current;return e.forEach((e,t)=>{ge(n[t],e,!1,!0)||(n[t]=e)}),t.current}function Ur(e,t){e.preloadRoute(t).catch(e=>{console.warn(e),console.warn(tr)})}function Wr(e,t){let n=typeof e==`string`&&xe(e);if(n)return t.has(n)?e:null}function Gr(e,t,n,r){let i=Me(e.pathname,r),a=Me(t.pathname,r);return(n?.exact?i!==a:!i.startsWith(a)||i.length!==a.length&&i[a.length]!==`/`)||(n?.includeSearch??!0)&&!ge(e.search,t.search,!n?.exact,n?.explicitUndefined)?!1:!n?.includeHash||e.hash===t.hash}function Kr(e,t,n){let r=ar(),i=k.useRef(null),a=k.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]=Hr(e.search,e.params,o),x=k.useContext(sr),S=(r.stores._linkScopes??={})[x]??=or(r,x),[C,w,ee]=k.useMemo(()=>{let t=Wr(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=ei(t,r,u),s=u||o&&!xe(o)?Gr(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]=k.useSyncExternalStore(S[1],w,ee||w),re=ne===void 0&&te,ie=u||te===void 0,ae=k.useRef(!1),oe=e.reloadDocument||re||ie?!1:c??r.options.defaultPreload,se=l??r.options.defaultPreloadDelay??0,ce=k.useCallback(e=>{let t=e?.isIntersecting;t??oe===`intent`?se?i.t??=setTimeout(()=>{i.t=void 0,Ur(r,C)},se):Ur(r,C):t===!1&&Qr(i)},[r,C,i,oe,se]);k.useEffect(()=>{if(!oe)return;oe===`render`&&!ae.current&&(ae.current=!0,Ur(r,C));let e=!0,t;return oe===`viewport`&&i.current&&typeof IntersectionObserver==`function`&&(t=new IntersectionObserver(t=>{e&&ce(t.pop())},{rootMargin:`100px`}),t.observe(i.current)),()=>{e=!1,t?.disconnect(),Qr(i)}},[r,C,oe,ce,i]);let T=Xr(e,n);if(T.ref=t?a:i,re)return T.href=re,T;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(),Qr(i),r.navigate({...e,_fromLocation:C._fromLocation}))},ue=()=>{oe===`intent`&&Ur(r,C)},de=()=>{oe===`intent`&&Qr(i)};return T.onClick=$r(f,le),T.onBlur=$r(p,de),T.onFocus=$r(m,ce),T.onMouseEnter=$r(h,ce),T.onMouseLeave=$r(g,de),T.onTouchStart=$r(_,ue),Zr(T,e,ne,te,ie,n)}var qr={},Jr={className:`active`},Yr=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 Xr(e,t){let n={};for(let r in e)Yr.has(r)||r===`type`&&t!==void 0||r===`disabled`&&t===`a`||(n[r]=e[r]);return n}function Zr(e,t,n,r,i,a){let{activeProps:o,inactiveProps:s,className:c,style:l,target:u}=t,d=le(n?o:s,{})??(n?Jr:qr);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 Qr=e=>{clearTimeout(e.t),e.t=void 0},$r=(e,t)=>e?n=>n.defaultPrevented||(e(n),n.defaultPrevented||t(n)):t;function ei(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||!Ce(i,t.protocolAllowlist))return i}var ti=k.memo(k.forwardRef((e,t)=>{let n=e._asChild||`a`,r=Kr(e,t,n),i=typeof e.children==`function`?e.children({isActive:r[`data-status`]===`active`}):e.children;return k.createElement(n,r,i)}),ni);function ni(e,t){let n=0;for(let r in t)if(n++,e[r]!==t[r]&&(!Yr.has(r)||!ge(e[r],t[r],!1,!0)))return!1;for(let t in e)n--;return n===0}var ri=class extends nr{constructor(e){super(e),this.useMatch=e=>Pr({...e,from:this.id}),this.useRouteContext=e=>Br({...e,from:this.id}),this.useSearch=e=>Rr({...e,from:this.id}),this.useParams=e=>Lr({...e,from:this.id}),this.useLoaderDeps=e=>Ir({...e,from:this.id}),this.useLoaderData=e=>Fr({...e,from:this.id}),this.useNavigate=()=>zr({from:this.fullPath}),this.Link=k.forwardRef((e,t)=>(0,Vr.jsx)(ti,{ref:t,from:this.fullPath,...e}))}};function ii(e){return new ri(e)}var ai=class extends rr{constructor(e){super(e),this.useMatch=e=>Pr({...e,from:this.id}),this.useRouteContext=e=>Br({...e,from:this.id}),this.useSearch=e=>Rr({...e,from:this.id}),this.useParams=e=>Lr({...e,from:this.id}),this.useLoaderDeps=e=>Ir({...e,from:this.id}),this.useLoaderData=e=>Fr({...e,from:this.id}),this.useNavigate=()=>zr({from:this.fullPath}),this.Link=k.forwardRef((e,t)=>(0,Vr.jsx)(ti,{ref:t,from:this.fullPath,...e}))}};function oi(e){return new ai(e)}var si=e=>({createMutableStore:wr,createReadonlyStore:wr,batch:xr}),ci=e=>new li(e),li=class extends $t{constructor(e){super(e,si)}},ui=`global`;function di(e,t,n){let r=new Uint8Array(5+n.length);return r[0]=e,new DataView(r.buffer).setUint32(1,t),r.set(n,5),r}function fi(e){if(e.length<5)throw Error(`terminal frame is too short`);return{kind:e[0],id:new DataView(e.buffer,e.byteOffset,e.byteLength).getUint32(1),data:e.subarray(5)}}function pi(e){return new Promise((t,n)=>{e.oncomplete=e.onsuccess=()=>t(e.result),e.onabort=e.onerror=()=>n(e.error)})}function mi(e,t){let n,r=()=>{if(n)return n;let r=indexedDB.open(e);return r.onupgradeneeded=()=>r.result.createObjectStore(t),n=pi(r),n.then(e=>{e.onclose=()=>n=void 0},()=>{n=void 0}),n};return(e,n)=>r().then(r=>n(r.transaction(t,e).objectStore(t)))}var hi;function gi(){return hi||=mi(`keyval-store`,`keyval`),hi}function _i(e,t=gi()){return t(`readonly`,t=>pi(t.get(e)))}function vi(e,t,n=gi()){return n(`readwrite`,n=>(n.put(t,e),pi(n.transaction)))}function yi(e,t=gi()){return t(`readwrite`,t=>(t.delete(e),pi(t.transaction)))}var bi=mi(`offsite`,`tokens`);function xi(e){return _i(e,bi)}function Si(e,t){return vi(e,t,bi)}function Ci(e){return yi(e,bi)}var wi=1e3,Ti=3e4,Ei=1e4,Di=1e4,Oi=3e3,ki=3e4,Ai=3e5,ji=[`sessions.send`,`sessions.rewind`,`sessions.fork`,`git.commit`,`git.push`,`git.pullRequest`,`git.createPullRequest`],Mi=new Set,j=new Map,Ni=0;function Pi(){window.setInterval(()=>{for(let e of j.keys())Hi(e)},Ei),document.addEventListener(`visibilitychange`,()=>{document.hidden||Fi()}),window.addEventListener(`online`,Fi)}function Fi(){for(let[e,t]of j)t.connected?Hi(e):t.timer!==void 0&&(window.clearTimeout(t.timer),t.timer=void 0,t.failures=0,Ui(e,t,0))}function Ii(e,t){if(j.has(e))return;let n={urls:t,url:t[0],socket:null,connected:!1,ping:null,timer:void 0,failures:0,pending:new Map};j.set(e,n),Ui(e,n,0)}function Li(e){let t=j.get(e);t!==void 0&&(j.delete(e),window.clearTimeout(t.timer),t.socket!==null&&(t.socket.onclose=null,t.socket.close()),qi(e,t))}function Ri(e){Mi.add(e)}function zi(e){return j.get(e)?.connected===!0}function Bi(e){let t=j.get(e);if(t===void 0)throw Error(`This machine is not connected`);return t.url}function M(e,t,n){let r=j.get(e);if(r===void 0||r.socket===null||!r.connected)return Promise.reject(Error(r===void 0?`That machine was removed`:`Not connected to ${new URL(r.url).host}; reconnecting`));Ni+=1;let i=Ni;r.socket.send(JSON.stringify({id:i,method:t,params:n}));let a=ji.includes(t)?Ai:ki;return new Promise((e,n)=>{let o=window.setTimeout(()=>{r.pending.delete(i),n(Error(`${new URL(r.url).host} did not answer ${t} within ${a/1e3} seconds`))},a);r.pending.set(i,{resolve:t=>{window.clearTimeout(o),e(t)},reject:e=>{window.clearTimeout(o),n(e)}})})}function Vi(e,t,n,r){let i=j.get(e);i!==void 0&&i.socket!==null&&i.connected&&i.socket.send(di(t,n,r))}async function Hi(e){let t=j.get(e);return t!==void 0&&(t.ping??=Ji(e,t).finally(()=>{t.ping=null}),await t.ping)}async function Ui(e,t,n){let r=t.urls[n%t.urls.length];t.url=r;let i=await Wi(e,r).catch(()=>void 0);if(j.get(e)!==t)return;if(i===`unpaired`){for(let t of Mi)t.unpaired?.(e);return}if(i===void 0){Gi(e,t,n);return}let a=i===null?``:`?${new URLSearchParams({ticket:i})}`,o=new WebSocket(`${r.replace(/^http/,`ws`)}/ws${a}`);o.binaryType=`arraybuffer`;let s=window.setTimeout(()=>o.close(),Oi);o.onopen=()=>{if(window.clearTimeout(s),t.socket!==o)o.close();else{t.connected=!0,t.failures=0;for(let t of Mi)t.open?.(e,r)}},o.onmessage=n=>{t.socket===o&&Yi(e,t,n.data)},o.onclose=()=>{window.clearTimeout(s),t.socket===o&&(t.connected?(qi(e,t),Ki(e,t,0)):Gi(e,t,n))},t.socket=o}async function Wi(e,t){let n=await xi(e),r=await fetch(`${t}/api/ticket`,{method:`POST`,headers:n===void 0?{}:{authorization:`Bearer ${n}`},signal:AbortSignal.timeout(Oi)});if(r.status===401)return`unpaired`;if(!r.ok)throw Error(await r.text());return(await r.json()).ticket}function Gi(e,t,n){if((n+1)%t.urls.length!==0)Ui(e,t,n+1);else{for(let t of Mi)t.close?.(e);Ki(e,t,n+1)}}function Ki(e,t,n){let r=Math.min(Ti,wi*2**t.failures)*(.8+Math.random()*.4);t.failures+=1,t.timer=window.setTimeout(()=>{t.timer=void 0,Ui(e,t,n)},r)}function qi(e,t){for(let e of t.pending.values())e.reject(Error(`Disconnected from ${new URL(t.url).host}`));t.pending.clear(),t.connected=!1;for(let t of Mi)t.close?.(e)}async function Ji(e,t){let n=t.socket;if(n===null||!t.connected)return!1;let r=await Promise.race([M(e,`ping`,void 0).then(()=>!0,()=>!1),new Promise(e=>window.setTimeout(()=>e(!1),Di))]);return r||t.socket!==n||!t.connected?r:(n.onclose=null,n.close(),qi(e,t),j.get(e)===t&&Ki(e,t,0),!1)}function Yi(e,t,n){if(n instanceof ArrayBuffer){let t=fi(new Uint8Array(n));for(let n of Mi)n.frame?.(e,t);return}let r=JSON.parse(String(n));if(r.type===`reply`)Xi(t,r);else if(r.type===`terminal`)for(let t of Mi)t.terminal?.(e,r.event);else for(let t of Mi)t.event?.(e,r)}function Xi(e,t){let n=e.pending.get(t.id);n!==void 0&&(e.pending.delete(t.id),`error`in t?n.reject(Error(t.error)):n.resolve(t.result))}function Zi(e,t,{signal:n,edges:r}={}){let i,a=null,o=r!=null&&r.includes(`leading`),s=r==null||r.includes(`trailing`),c=()=>{a!==null&&(e.apply(i,a),i=void 0,a=null)},l=()=>{s&&c(),p()},u=null,d=()=>{u!=null&&clearTimeout(u),u=setTimeout(()=>{u=null,l()},t)},f=()=>{u!==null&&(clearTimeout(u),u=null)},p=()=>{f(),i=void 0,a=null},m=()=>{c()},h=function(...e){if(n?.aborted)return;i=this,a=e;let t=u==null;d(),o&&t&&c()};return h.schedule=d,h.cancel=p,h.flush=m,n?.addEventListener(`abort`,p,{once:!0}),h}function Qi(e){if(!e||typeof e!=`object`)return!1;let t=Object.getPrototypeOf(e);return t!==null&&t!==Object.prototype&&Object.getPrototypeOf(t)!==null?!1:Object.prototype.toString.call(e)===`[object Object]`}function $i(e,t){return e===t||Number.isNaN(e)&&Number.isNaN(t)}function ea(e,t,n){return ta(e,t,void 0,void 0,void 0,void 0,n)}function ta(e,t,n,r,i,a,o){let s=o(e,t,n,r,i,a);if(s!==void 0)return s;if(typeof e==typeof t)switch(typeof e){case`bigint`:case`string`:case`boolean`:case`symbol`:case`undefined`:return e===t;case`number`:return e===t||Object.is(e,t);case`function`:return e===t;case`object`:return na(e,t,a,o)}return na(e,t,a,o)}function na(e,t,n,r){if(Object.is(e,t))return!0;let i=s(e),a=s(t);if(i===`[object Arguments]`&&(i=ae),a===`[object Arguments]`&&(a=ae),i!==a)return!1;switch(i){case se:return e.toString()===t.toString();case f:return $i(e.valueOf(),t.valueOf());case ee:case h:case u:return Object.is(e.valueOf(),t.valueOf());case ce:return e.source===t.source&&e.flags===t.flags;case _:return e===t}n??=new Map;let T=n.get(e),le=n.get(t);if(T!=null&&le!=null)return T===t;n.set(e,t),n.set(t,e);try{switch(i){case v:if(e.size!==t.size)return!1;for(let[i,a]of e.entries())if(!t.has(i)||!ta(a,t.get(i),i,e,t,n,r))return!1;return!0;case m:{if(e.size!==t.size)return!1;let i=Array.from(e.values()),a=Array.from(t.values());for(let o=0;o<i.length;o++){let s=i[o],c=a.findIndex(i=>ta(s,i,void 0,e,t,n,r));if(c===-1)return!1;a.splice(c,1)}return!0}case ne:case d:case c:case o:case oe:case p:case y:case te:case C:case b:case ie:case g:if(x(e)!==x(t)||e.length!==t.length)return!1;for(let i=0;i<e.length;i++)if(!ta(e[i],t[i],i,e,t,n,r))return!1;return!0;case w:return e.byteLength===t.byteLength&&na(new Uint8Array(e),new Uint8Array(t),n,r);case re:return e.byteLength!==t.byteLength||e.byteOffset!==t.byteOffset?!1:na(new Uint8Array(e),new Uint8Array(t),n,r);case S:return e.name===t.name&&e.message===t.message;case ae:{if(!(na(e.constructor,t.constructor,n,r)||Qi(e)&&Qi(t)))return!1;let i=[...Object.keys(e),...l(e)],a=[...Object.keys(t),...l(t)];if(i.length!==a.length)return!1;for(let a=0;a<i.length;a++){let o=i[a],s=e[o];if(!Object.hasOwn(t,o))return!1;let c=t[o];if(!ta(s,c,o,e,t,n,r))return!1}return!0}default:return!1}}finally{n.delete(e),n.delete(t)}}function ra(e,t){return ea(e,t,a)}var ia=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e))},o=t=e(r,i,a);return a},aa=(e=>e?ia(e):ia),oa=e=>e;function sa(e,t=oa){let n=k.useSyncExternalStore(e.subscribe,k.useCallback(()=>t(e.getState()),[e,t]),()=>t(e.getInitialState()));return k.useDebugValue(n),n}var ca=e=>{let t=aa(e),n=e=>sa(t,e);return Object.assign(n,t),n},la=(e=>e?ca(e):ca);function ua(e,t){let n;try{n=e()}catch{return}return{getItem:e=>{let r=e=>e===null?null:JSON.parse(e,t?.reviver),i=n.getItem(e)??null;return i instanceof Promise?i.then(r):r(i)},setItem:(e,r)=>n.setItem(e,JSON.stringify(r,t?.replacer)),removeItem:e=>n.removeItem(e)}}var da=e=>t=>{try{let n=e(t);return n instanceof Promise?n:{then(e){return da(e)(n)},catch(e){return this}}}catch(e){return{then(e){return this},catch(t){return da(t)(e)}}}},fa=(e,t)=>(n,r,i)=>{let a={storage:ua(()=>window.localStorage),partialize:e=>e,version:0,merge:(e,t)=>({...t,...e}),...t},o=!1,s=0,c=new Set,l=new Set,u=a.storage;if(!u)return e((...e)=>{console.warn(`[zustand persist middleware] Unable to update item '${a.name}', the given storage is currently unavailable.`),n(...e)},r,i);let d=()=>{let e=a.partialize({...r()});return u.setItem(a.name,{state:e,version:a.version})},f=i.setState;i.setState=(...e)=>(f(...e),d());let p=e((...e)=>(n(...e),d()),r,i);i.getInitialState=()=>p;let m,h=()=>{if(!u)return;let e=++s;o=!1,c.forEach(e=>e(r()??p));let t=a.onRehydrateStorage?.call(a,r()??p)||void 0;return da(u.getItem.bind(u))(a.name).then(e=>{if(e){if(typeof e.version==`number`&&e.version!==a.version){if(a.migrate){let t=a.migrate(e.state,e.version);return t instanceof Promise?t.then(e=>[!0,e]):[!0,t]}console.error(`State loaded from storage couldn't be migrated since no migrate function was provided`)}else return[!1,e.state]}return[!1,void 0]}).then(t=>{if(e!==s)return;let[i,o]=t;if(m=a.merge(o,r()??p),n(m,!0),i)return d()}).then(()=>{e===s&&(t?.(r(),void 0),m=r(),o=!0,l.forEach(e=>e(m)))}).catch(n=>{e===s&&t?.(void 0,n)})};return i.persist={setOptions:e=>{a={...a,...e},e.storage&&(u=e.storage)},clearStorage:()=>{++s,u?.removeItem(a.name)},getOptions:()=>a,rehydrate:()=>h(),hasHydrated:()=>o,onHydrate:e=>(c.add(e),()=>{c.delete(e)}),onFinishHydration:e=>(l.add(e),()=>{l.delete(e)})},a.skipHydration||h(),m||p},pa=`composerDrafts`,ma={text:``,images:[],files:[],settings:null},ha=mi(`offsite-drafts`,`drafts`),ga=mi(`offsite-draft-files`,`files`),_a=Zi(e=>void vi(pa,e,ha),300),va={getItem:async e=>await _i(e,ha)??null,setItem:(e,t)=>_a(t),removeItem:e=>yi(e,ha)},ya={drafts:{},stash:[]},N=la()(fa(()=>ya,{name:pa,storage:va,skipHydration:!0,version:1,migrate:()=>ya}));window.addEventListener(`pagehide`,_a.flush);function ba(){return N.persist.rehydrate()}function xa(e){return N(t=>t.drafts[e]??ma)}function Sa(e,t){let n=Ea(e),r=t(n),i=N.getState().stash;for(let e of n.files)!r.files.some(t=>t.id===e.id)&&!i.some(t=>t.files.some(t=>t.id===e.id))&&yi(e.id,ga);N.setState(t=>{let n={...t.drafts,[e]:r};return r.text===``&&r.images.length===0&&r.files.length===0&&r.settings===null&&delete n[e],{drafts:n}})}async function Ca(e){let t=crypto.randomUUID();return await vi(t,e,ga),t}async function wa(e){return await _i(e,ga)}function Ta(e){Sa(e,()=>ma)}function Ea(e){return N.getState().drafts[e]??ma}function Da(e){return N.getState().drafts[e]?.settings??null}function Oa(e,t){Sa(e,e=>({...e,settings:t}))}function ka(){return N(e=>e.stash)}function Aa(){return N.getState().stash}function ja(e){return e.text.trim()!==``||e.images.length>0||e.files.length>0}function Ma(e){let t=Ea(e);N.setState(e=>({stash:[{id:crypto.randomUUID(),createdAt:Date.now(),text:t.text,images:t.images,files:t.files},...e.stash]})),Sa(e,e=>({...e,text:``,images:[],files:[]}))}function Na(e,t,n){let r=N.getState().stash.find(e=>e.id===t);if(r===void 0)throw Error(`This stashed prompt no longer exists`);ja(Ea(e))&&Ma(e),N.setState(e=>({stash:e.stash.filter(e=>e.id!==t)}));let i=r.text.replace(/\[Image #(\d+)\]/g,(e,t)=>{let i=r.images.findIndex(e=>e.number===Number(t));return i===-1?e:`[Image #${n+i+1}]`});return Sa(e,e=>({...e,text:i,images:r.images.map((e,t)=>({...e,number:n+t+1})),files:r.files})),i}function Pa(e){let t=N.getState().stash.find(t=>t.id===e);if(t!==void 0){N.setState(t=>({stash:t.stash.filter(t=>t.id!==e)}));for(let e of t.files)yi(e.id,ga)}}function Fa(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function Ia(e,t=`|`){return e.map(e=>oo(e)).join(t)}function La(e,t){return typeof t==`bigint`?t.toString():t}var Ra=class{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;return e!==void 0&&(this._value=e(),this._getter=void 0),this._value}};function za(e){return new Ra(e)}function Ba(e){return e==null}function Va(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function Ha(e,t){let n=e/t,r=Math.round(n),i=4*2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}function Ua(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Wa(e){let t=Object.getOwnPropertyDescriptor(e,`shape`);return t?.get?t.get.raw:t?.value}function Ga(e){return Wa(e._zod.def)??e._zod.def.shape}function Ka(e,t,n){Object.defineProperty(e,t,{get(){let e=n();return Ua(this,t,e),e},enumerable:!0,configurable:!0})}function qa(e,t,n){t in e?Ua(e,t,n):e[t]=n}function Ja(e,t,n,r){let i=Ga(t);for(let a of n){let n=Object.getOwnPropertyDescriptor(i,a);n.enumerable&&(n.get?Ka(e,a,()=>{let e=t._zod.def.shape[a];return r?r(e,a):e}):qa(e,a,r?r(n.value,a):n.value))}}function Ya(e,t){for(let n of Reflect.ownKeys(t)){let r=Object.getOwnPropertyDescriptor(t,n);r.enumerable&&(r.get?Ka(e,n,()=>t[n]):qa(e,n,r.value))}}function P(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function Xa(e){return JSON.stringify(e)}function Za(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var Qa=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function $a(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var eo=za(()=>{if(R.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function to(e){if($a(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return $a(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function no(e){return to(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var ro=new Set([`string`,`number`,`symbol`]);function io(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function ao(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function F(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function oo(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function so(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}var co={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},lo={int64:[BigInt(`-9223372036854775808`),BigInt(`9223372036854775807`)],uint64:[BigInt(0),BigInt(`18446744073709551615`)]};function uo(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);let i={};return Ja(i,e,fo(e,t)),ao(e,P(n,{shape:i,checks:[]}))}function fo(e,t){let n=Ga(e),r=[];for(let e of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,e)?.enumerable)throw Error(`Unrecognized key: "${String(e)}"`);t[e]&&r.push(e)}return r}function po(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);let i=new Set(fo(e,t)),a={};return Ja(a,e,Reflect.ownKeys(Ga(e)).filter(e=>!i.has(e))),ao(e,P(n,{shape:a,checks:[]}))}function mo(e,t){if(!to(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=Ga(e);for(let e of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return ao(e,P(e._zod.def,{shape:ho(e,t)}))}function ho(e,t){let n={};return Ja(n,e,Reflect.ownKeys(Ga(e))),Ya(n,t),n}function go(e,t){if(!to(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return ao(e,P(e._zod.def,{shape:ho(e,t)}))}function _o(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);let n={};return Ja(n,e,Reflect.ownKeys(Ga(e))),Ja(n,t,Reflect.ownKeys(Ga(t))),ao(e,P(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function vo(e,t,n,r=`partial`){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${r}() cannot be used on object schemas containing refinements`);let a=n?new Set(fo(t,n)):void 0,o={};return Ja(o,t,Reflect.ownKeys(Ga(t)),e&&((t,n)=>a&&!a.has(n)?t:new e({type:`optional`,innerType:t}))),ao(t,P(t._zod.def,{shape:o,checks:[]}))}function yo(e,t,n){let r=n?new Set(fo(t,n)):void 0,i={};return Ja(i,t,Reflect.ownKeys(Ga(t)),(t,n)=>r&&!r.has(n)?t:new e({type:`nonoptional`,innerType:t})),ao(t,P(t._zod.def,{shape:i}))}function bo(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function xo(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function So(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function Co(e){return typeof e==`string`?e:e?.message}function wo(e){let t=[];for(let n of e??[]){let e=n._zod.def;if(!/_(length|size)$|_equals$/.test(e.check))break;let r=e.maximum??e.length??e.size;r>=0&&t.push([r,n])}return t}function To(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function Eo(e,t,n){var r;let i=e.inst?._zod?.traits;i?.has(`$ZodType`)&&(i.has(`$ZodCheck`)?(r=e).schema??(r.schema=e.inst):e.schema=e.inst);let a=e.schema===e.inst?void 0:e.schema?._zod.def?.error,o=e.message?e.message:Co(e.inst?._zod.def?.error?.(e))??Co(a?.(e))??Co(t?.error?.(e))??Co(n.customError?.(e))??Co(n.localeError?.(e))??`Invalid input`,s={};for(let t of Object.keys(e))t!==`inst`&&t!==`schema`&&t!==`continue`&&t!==`input`&&t!==`__proto__`&&(s[t]=e[t]);return s.path??=[],s.message=o,t?.reportInput&&(s.input=e.input),s}var Do=/[\uD800-\uDBFF]/;function Oo(e){let t=e.length;if(!Do.test(e))return t;let n=t;for(let r=0;r<t-1;r++)(e.charCodeAt(r)&64512)==55296&&(e.charCodeAt(r+1)&64512)==56320&&(n--,r++);return n}function ko(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function Ao(e){let t=typeof e;switch(t){case`number`:return Number.isNaN(e)?`nan`:`number`;case`object`:{if(e===null)return`null`;if(Array.isArray(e))return`array`;let t=e;if(t&&Object.getPrototypeOf(t)!==Object.prototype&&`constructor`in t&&t.constructor)return t.constructor.name}}return t}function jo(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}function Mo(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):Io(e,n,r.value)}}function No(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function Po(e,t,n){return No(e,t,n,!1)}function Fo(e,t){for(let n in e){let r=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return No(this,n,r(this))},set(e){No(this,n,e)}})}return t}function Io(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:No(this,t,n.bind(this))},set(e){No(this,t,e)}})}function Lo(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}var Ro,zo=!1,Bo={configurable:!0,get(){zo=!0}};function I(e,t,n){let r=Object.getPrototypeOf(e._zod);t in r&&Ro!==e._zod?Ro=void 0:(Ro=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,Bo);let e=zo;zo=!1;try{let r=n(this);return zo?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),zo||=e,r}catch(n){throw delete this[t],zo||=e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}}))}function Vo(e,t,n,r){let i=Lo(e,t);i&&Object.defineProperty(i,t,{configurable:!0,get(){let e={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,e),e.value=n(this),Object.defineProperty(this,t,e),e.value},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:e})}})}var Ho=`~constantCatch`;function Uo(e){let t=()=>e;return t[Ho]=!0,t}var Wo,Go={value:void 0,enumerable:!1},Ko=`captureStackTrace`in Error?Error:null;function qo(e){let t=Ko;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return Ko=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function L(e,t,n,r){let i={};function a(e){this.def=e,this.constr=d,this.traits=new Set}a.prototype=i;let o=n,s=o&&new WeakSet;function c(n,r){if(!n._zod){Go.value=new a(r);try{Object.defineProperty(n,"_zod",Go)}finally{Go.value=void 0}}else if(n._zod.traits.has(e))return;if(n._zod.traits.add(e),t(n,r),s){let e=Object.getPrototypeOf(n),t=n._zod.constr.prototype,r=e;for(;r&&r!==t;)r=Object.getPrototypeOf(r);let i=r??e;s.has(i)||(s.add(i),Mo(i,o))}let i=d.prototype;for(let e in i)Object.prototype.hasOwnProperty.call(i,e)&&(e in n||(n[e]=i[e].bind(n)))}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function d(e){let t=r?.Parent?qo(u):this;c(t,e);let n=t._zod.deferred;if(n){for(let e of n)e();t._zod.deferred=void 0}let i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:t=>r?.Parent&&t instanceof r.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var Jo=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},Yo=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(Wo=globalThis).__zod_globalConfig??(Wo.__zod_globalConfig={});var R=globalThis.__zod_globalConfig;function Xo(e){return e&&Object.assign(R,e),R}function Zo(){let e=this._zod;return e.message??=JSON.stringify(e.def,La,2),e.message}function Qo(e){this._zod.message=e}var $o={get:Zo,set:Qo,enumerable:!0,configurable:!0},es={value:void 0,enumerable:!1},ts=new WeakSet([Object.prototype,Error.prototype]),ns=L(`$ZodError`,(e,t)=>{e.name=`$ZodError`,es.value=t,Object.defineProperty(e,"issues",es),es.value=void 0,Object.defineProperty(e,"message",$o);let n=Object.getPrototypeOf(e);ts.has(n)||(ts.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let e=()=>this.message;return Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0})}}))});function rs(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t===`__proto__`?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function is(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?rs(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function as(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i],o=i===e.length-1;if(n===`_errors`){o&&r._errors.push(t(a)),i++;continue}Object.prototype.hasOwnProperty.call(r,n)||Object.defineProperty(r,n,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let s=r[n];o&&s._errors.push(t(a)),r=s,i++}}}};return r(e),n}function os(e){let t=[],n=e.map(e=>typeof e==`object`?e.key:e);for(let e of n)typeof e==`number`?t.push(`[${e}]`):typeof e==`symbol`?t.push(`[${JSON.stringify(String(e))}]`):/[^\w$]/.test(e)?t.push(`[${JSON.stringify(e)}]`):(t.length&&t.push(`.`),t.push(e));return t.join(``)}function ss(e){let t=[],n=[...e.issues].sort((e,t)=>(e.path??[]).length-(t.path??[]).length);for(let e of n)t.push(`✖ ${e.message}`),e.path?.length&&t.push(` → at ${os(e.path)}`);return t.join(`
|
|
3
3
|
`)}function cs(e,t){return{callee:t?.callee??e,Err:t?.Err}}var ls=e=>{let t=(n,r,i,a)=>{let o=i?{...i,async:!1}:{async:!1},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new Jo;if(s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>Eo(e,o,Xo())));throw Qa(n,a?.callee??t),n}return s.value};return t},us=e=>{let t=async(n,r,i,a)=>{let o=i?{...i,async:!0}:{async:!0},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>Eo(e,o,Xo())));throw Qa(n,a?.callee??t),n}return s.value};return t},ds=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new Jo;return a.issues.length?fs(e,a.issues,i):{success:!0,data:a.value}};function fs(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(e=>Eo(e,n,Xo()))),t=void 0,n=void 0),r},set error(e){r=e,t=void 0,n=void 0}}}var ps=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?fs(e,a.issues,i):{success:!0,data:a.value}},ms=Symbol.for(`zod.compile.invalid`),hs=Symbol.for(`zod.compile.fallback`),gs=((e,t,n)=>{let r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==ms)return!0;if(r.definite===!0&&n===void 0)return!1}return _s(e,t,n)});function _s(e,t,n){let r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},i=e._zod.bag.fallbackRun,a;if(i?(r[hs]=!0,a=i({value:t,issues:[]},r)):a=e._zod.run({value:t,issues:[]},r),a instanceof Promise)throw new Jo;return a.issues.length===0}var vs=async(e,t,n)=>{let r=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},i=e._zod.run({value:t,issues:[]},r);return i instanceof Promise&&(i=await i),i.issues.length===0},ys=e=>{let t=ls(e),n=(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return t(e,r,o,cs(n,a))};return n},bs=e=>{let t=ls(e),n=(e,r,i,a)=>t(e,r,i,cs(n,a));return n},xs=e=>{let t=us(e),n=async(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return await t(e,r,o,cs(n,a))};return n},Ss=e=>{let t=us(e),n=async(e,r,i,a)=>await t(e,r,i,cs(n,a));return n},Cs=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return ds(e)(t,n,i)},ws=e=>(t,n,r)=>ds(e)(t,n,r),Ts=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return ps(e)(t,n,i)},Es=e=>async(t,n,r)=>ps(e)(t,n,r),Ds=/^[cC][0-9a-z]{6,}$/,Os=/^[0-9a-z]+$/,ks=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,As=/^[0-9a-vA-V]{20}$/,js=/^[A-Za-z0-9]{27}$/,Ms=/^[a-zA-Z0-9_-]{21}$/;function Ns(e){return RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var Ps=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Fs=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Is=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Ls=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Rs=`^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;function zs(){return new RegExp(Rs,`u`)}var Bs=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Vs=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Hs=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Us=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Ws=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Gs=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,Ks=/^https?$/,qs=/^\+[1-9]\d{6,14}$/,Js=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;function Ys(e){return RegExp(`^${e}$`)}var Xs=Ys(Js);function Zs(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Qs(e){return RegExp(`^${Zs(e)}$`)}function $s(e){let t=[`Z`];e.offset&&t.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let n=`${Zs({precision:e.precision,seconds:!0})}(?:${t.join(`|`)})`,r=e.local?`${n}|${Zs({precision:e.precision})}`:n;return RegExp(`^${Js}T(?:${r})$`)}var ec=/^[\s\S]{0,}$/,tc=/^-?\d+(?:\.\d+)?$/,nc=/^(?:true|false)$/i,rc=/^[^A-Z]*$/,ic=/^[^a-z]*$/,z=L(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),ac=e=>{let t=e.value;return!Ba(t)&&t.length!==void 0},oc={number:`number`,bigint:`bigint`,object:`date`},sc=L(`$ZodCheckLessThan`,(e,t)=>{z.init(e,t);let n=oc[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:oc[typeof r.value]??n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),cc=L(`$ZodCheckGreaterThan`,(e,t)=>{z.init(e,t);let n=oc[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:oc[typeof r.value]??n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),lc=L(`$ZodCheckMultipleOf`,(e,t)=>{z.init(e,t),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):Ha(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),uc=L(`$ZodCheckNumberFormat`,(e,t)=>{z.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=co[t.format];e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),dc=L(`$ZodCheckMaxLength`,(e,t)=>{var n;z.init(e,t),(n=e._zod.def).when??(n.when=ac),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>t.maximum?Oo(r):i)<=t.maximum)return;let a=ko(r);n.issues.push({origin:a,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),fc=L(`$ZodCheckMinLength`,(e,t)=>{var n;z.init(e,t),(n=e._zod.def).when??(n.when=ac),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>=t.minimum&&i<t.minimum*2?Oo(r):i)>=t.minimum)return;let a=ko(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),pc=L(`$ZodCheckLengthEquals`,(e,t)=>{var n;z.init(e,t),(n=e._zod.def).when??(n.when=ac),e._zod.check=n=>{let r=n.value,i=r.length,a=typeof r==`string`&&i>=t.length&&i<=t.length*2?Oo(r):i;if(a===t.length)return;let o=ko(r),s=a>t.length;n.issues.push({origin:o,...s?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),mc=L(`$ZodCheckStringFormat`,(e,t)=>{var n,r;z.init(e,t),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),hc=L(`$ZodCheckRegex`,(e,t)=>{mc.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),gc=L(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=rc,mc.init(e,t)}),_c=L(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=ic,mc.init(e,t)}),vc=L(`$ZodCheckIncludes`,(e,t)=>{z.init(e,t);let n=io(t.includes);t.pattern=new RegExp(typeof t.position==`number`?`^.{${t.position},}${n}`:n),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),yc=L(`$ZodCheckStartsWith`,(e,t)=>{z.init(e,t);let n=RegExp(`^${io(t.prefix)}.*`);t.pattern??=n,e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),bc=L(`$ZodCheckEndsWith`,(e,t)=>{z.init(e,t);let n=RegExp(`.*${io(t.suffix)}$`);t.pattern??=n,e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),xc=L(`$ZodCheckOverwrite`,(e,t)=>{z.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),Sc=class{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{--this.indent}}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
|
|
4
4
|
`).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.content??[``];return new e(...Object.keys(this.closed),`return function (${this.args.join(`, `)}) {\n${t.join(`
|
|
5
5
|
`)}\n};`)(...Object.values(this.closed))}},Cc={major:4,minor:6,patch:7},B=L(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Cc;let r=e._zod.def.checks,i=e._zod.traits.has(`$ZodCheck`)?[e,...r??[]]:r?.length?[...r]:[];for(let t of i)for(let n of t._zod.onattach)n(e);if(i.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(t,n,r)=>{if(t.memo)return t;let i=bo(t),a;for(let o of n){if(o._zod.def.when){if(xo(t)||!o._zod.def.when(t))continue}else if(i)continue;let n=t.issues.length,s=o._zod.check(t);if(s instanceof Promise&&r?.async===!1)throw new Jo;if(a||s instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await s,t.issues.length!==n&&(To(t.issues,n,e),i||=bo(t,n))});else{if(t.issues.length===n)continue;To(t.issues,n,e),i||=bo(t,n)}}return a?a.then(()=>t):t},n=(n,r,a)=>{if(bo(n))return n.aborted=!0,n;let o=t(r,i,a);if(o instanceof Promise){if(a.async===!1)throw new Jo;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(r,a)=>{if(a.skipChecks)return e._zod.parse(r,a);if(a.direction===`backward`){let t=e._zod.parse({value:r.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,r,a)):n(t,r,a)}let o=e._zod.parse(r,a);if(o instanceof Promise){if(a.async===!1)throw new Jo;return o.then(e=>t(e,i,a))}return t(o,i,a)}}},{get"~standard"(){return Po(this,`~standard`,Ec(this))},set"~standard"(e){No(this,`~standard`,e)}}),wc=(e,t)=>e.issues.length?{issues:e.issues.map(e=>Eo(e,t,Xo()))}:{value:e.value};async function Tc(e,t){let n={async:!0};return wc(await e._zod.run({value:t,issues:[]},n),n)}function Ec(e){return{validate:t=>{let n={async:!1};try{let r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return wc(r,n)}catch{}return Tc(e,t)},vendor:`zod`,version:1}}var Dc=L(`$ZodString`,(e,t)=>{B.init(e,t),e._zod.pattern=t.pattern??ec,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),V=L(`$ZodStringFormat`,(e,t)=>{mc.init(e,t),Dc.init(e,t)}),Oc=L(`$ZodGUID`,(e,t)=>{t.pattern??=Fs,V.init(e,t)}),kc=L(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=Is(e)}else t.pattern??=Is();V.init(e,t)}),Ac=L(`$ZodEmail`,(e,t)=>{t.pattern??=Ls,V.init(e,t)});function jc(e){try{return typeof URL<`u`&&typeof URL.canParse==`function`?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function Mc(e,t){return!(`normalize`in t)&&!(`hostname`in t)&&!(`protocol`in t)?jc(e)||2:Nc(e,t)}function Nc(e,t){if(!t.normalize&&t.protocol?.source===Ks.source&&!/^https?:\/\//i.test(e))return 1;try{if(typeof URL<`u`){let t=URL;if(typeof t.parse==`function`)return t.parse(e)??2}return new URL(e)}catch{return 2}}var Pc=/[\t\n\r]/g;function Fc(e){return e.replace(Pc,``)}function Ic(e,t){return t.lastIndex=0,t.test(e.hostname)}function Lc(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(`:`)?e.protocol.slice(0,-1):e.protocol)}var Rc=L(`$ZodURL`,(e,t)=>{V.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=Mc(r,t);if(i===1){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}if(i===2){n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort});return}if(i===!0){n.value=Fc(r);return}t.hostname&&!Ic(i,t.hostname)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort}),t.protocol&&!Lc(i,t.protocol)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort}),n.value=t.normalize?i.href:Fc(r);return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),zc=L(`$ZodEmoji`,(e,t)=>{t.pattern??=zs(),V.init(e,t)}),Bc=L(`$ZodNanoID`,(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??=t.length===void 0?Ms:Ns(t.length),V.init(e,t)}),Vc=L(`$ZodCUID`,(e,t)=>{t.pattern??=Ds,V.init(e,t)}),Hc=L(`$ZodCUID2`,(e,t)=>{t.pattern??=Os,V.init(e,t)}),Uc=L(`$ZodULID`,(e,t)=>{t.pattern??=ks,V.init(e,t)}),Wc=L(`$ZodXID`,(e,t)=>{t.pattern??=As,V.init(e,t)}),Gc=L(`$ZodKSUID`,(e,t)=>{t.pattern??=js,V.init(e,t)}),Kc=L(`$ZodISODateTime`,(e,t)=>{t.pattern??=$s(t),V.init(e,t)}),qc=L(`$ZodISODate`,(e,t)=>{t.pattern??=Xs,V.init(e,t)}),Jc=L(`$ZodISOTime`,(e,t)=>{t.pattern??=Qs(t),V.init(e,t)}),Yc=L(`$ZodISODuration`,(e,t)=>{t.pattern??=Ps,V.init(e,t)}),Xc=L(`$ZodIPv4`,(e,t)=>{t.pattern??=Bs,V.init(e,t)}),Zc=/^[0-9a-fA-F:.]+$/;function Qc(e){return Zc.test(e)?jc(`http://[${e}]`):!1}var $c=L(`$ZodIPv6`,(e,t)=>{t.pattern??=Vs,V.init(e,t),e._zod.check=n=>{Qc(n.value)||n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}),el=L(`$ZodCIDRv4`,(e,t)=>{t.pattern??=Hs,V.init(e,t)});function tl(e){let t=e.split(`/`);if(t.length!==2)return!1;let[n,r]=t;if(!r)return!1;let i=Number(r);return`${i}`!==r||i<0||i>128?!1:Qc(n)}var nl=L(`$ZodCIDRv6`,(e,t)=>{t.pattern??=Us,V.init(e,t),e._zod.check=n=>{tl(n.value)||n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}});function rl(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var il=/^[0-9a-zA-Z+/]*={0,2}$/,al=L(`$ZodBase64`,(e,t)=>{t.pattern??=il,V.init(e,t),e._zod.check=n=>{rl(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}}),ol=/^[A-Za-z0-9_-]*$/;function sl(e){if(!ol.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return rl(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var cl=L(`$ZodBase64URL`,(e,t)=>{t.pattern??=ol,V.init(e,t),e._zod.check=n=>{sl(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),ll=L(`$ZodE164`,(e,t)=>{t.pattern??=qs,V.init(e,t)});function ul(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}var dl=L(`$ZodJWT`,(e,t)=>{V.init(e,t),e._zod.check=n=>{ul(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),fl=L(`$ZodNumber`,(e,t)=>{B.init(e,t),e._zod.pattern=tc,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:String(i):void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),pl=L(`$ZodNumberFormat`,(e,t)=>{uc.init(e,t),fl.init(e,t)}),ml=L(`$ZodBoolean`,(e,t)=>{B.init(e,t),e._zod.pattern=nc,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),hl=L(`$ZodUnknown`,(e,t)=>{B.init(e,t),e._zod.parse=e=>e}),gl=L(`$ZodNever`,(e,t)=>{B.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function _l(e,t){let n=wo(e._zod.def.checks);if(!n.length)return;let r=Math.min(...n.map(e=>e[0])),i=e._zod.parse;e._zod.parse=(n,a)=>{let o=t(n.value);if(o>r&&!a?.skipChecks&&a?.direction!==`backward`){for(let[t,r]of wo(e._zod.def.checks))if(o>t&&r._zod.def.when(n)){let t=n.issues.length;return r._zod.check(n),n.issues[t].continue=!1,To(n.issues,t,e),n}}return i(n,a)}}var vl=e=>Array.isArray(e)?e.length:-1;function yl(e,t,n){e.issues.length&&t.issues.push(...So(n,e.issues)),t.value[n]=e.value}var bl=L(`$ZodArray`,(e,t)=>{B.init(e,t);let n=R.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({expected:`array`,code:`invalid_type`,input:a,inst:e}),r;r.value=n?n.alloc(e,r,Array(a.length),i):Array(a.length);let o=[],s=i?.abortEarly;for(let e=0;e<a.length;e++){let n=a[e],c=t.element._zod.run({value:n,issues:[]},i);if(c instanceof Promise)o.push(c.then(t=>yl(t,r,e)));else if(yl(c,r,e),s&&c.issues.length!==0&&bo(c))break}return o.length?Promise.all(o).then(()=>r):r},_l(e,vl)});function xl(e,t,n,r,i,a){let o=n in r,s=a===`optional`;if(o||!s||i!==`optional`){if(e.issues.length){if(i!==void 0&&s&&!o)return;t.issues.push(...So(n,e.issues))}!o&&i===void 0?e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]}):e.value===void 0?(o||i===`defaulted`&&!s)&&(t.value[n]=void 0):t.value[n]=e.value}}var Sl=[];function Cl(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:Sl,i=r.length?[...t,...r]:t;for(let t of i)if(!e.shape?.[t]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${String(t)}": expected a Zod schema`);let a=so(e.shape);return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(a)}}function wl(e,t,n,r,i,a,o){let s=[],c=i.keySet,l=i.catchall._zod,u=l.def.type,d=l.optin,f=l.optout,p=0;for(let i in t){if(o&&n.issues.length!==p){if(bo(n,p))break;p=n.issues.length}if(c.has(i))continue;if(i===`__proto__`){u===`never`&&s.push(i);continue}if(u===`never`){s.push(i);continue}let a=l.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>xl(e,n,i,t,d,f))):xl(a,n,i,t,d,f)}return s.length&&n.issues.push({code:`unrecognized_keys`,keys:s,input:t,inst:a,continue:!0}),e.length?Promise.all(e).then(()=>n):n}var Tl=L(`$ZodObject`,(e,t)=>{B.init(e,t);let n=Object.getOwnPropertyDescriptor(t,`shape`),r=n?.get?n.get.raw:t.shape??{};if(r){let e=()=>{let n={...r};return Object.defineProperty(t,"shape",{value:n}),e.raw=n,n};e.raw=r,Object.defineProperty(t,"shape",{get:e})}let i=za(()=>Cl(t));I(e,`propValues`,e=>{let t=e.def.shape,n={};for(let e in t){let r=t[e]._zod;if(r.values){Object.prototype.hasOwnProperty.call(n,e)||Ua(n,e,new Set);for(let t of r.values)n[e].add(t);r.optin!==void 0&&n[e].add(void 0)}}return n});let a=$a,o=t.catchall,s,c=R.memoizer;c?.attach(e),e._zod.parse=(t,n)=>{s??=i.value;let r=t.value;if(!a(r))return t.issues.push({expected:`object`,code:`invalid_type`,input:r,inst:e}),t;t.value=c?c.alloc(e,t,{},n):{};let l=[],u=s.shape,d=n?.abortEarly,f=t.issues.length;for(let e of s.allKeys){if(d&&t.issues.length!==f){if(bo(t,f))break;f=t.issues.length}if(e===`__proto__`)continue;let i=u[e],a=i._zod.optin,o=i._zod.optout,s=i._zod.run({value:r[e],issues:[]},n);s instanceof Promise?l.push(s.then(n=>xl(n,t,e,r,a,o))):xl(s,t,e,r,a,o)}return o?wl(l,r,t,n,i.value,e,d===!0):l.length?Promise.all(l).then(()=>t):t}}),El=L(`$ZodObjectJIT`,(e,t)=>{Tl.init(e,t);let n=e._zod.parse,r=za(()=>Cl(t)),i=R.memoizer,a=t=>{let n=r.value,a=n.symbolKeys,o=new Sc([`payload`,`ctx`],{shape:t,inst:e,memo:i,syms:a}),s=e=>`shape[${e}]._zod.run({ value: input[${e}], issues: [] }, ctx)`,c=(e,t)=>`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-COiEfhsA.js";import{a as t,i as n,n as r}from"./dist-D99rUXSZ.js";import{n as i,r as a,t as o}from"./TextWrapIcon-BRhMbXe9.js";import{t as s}from"./ChevronsDownUpIcon-BNVFd2te.js";import{I as c,M as l,N as u,g as d,in as f,t as p}from"./XIcon-hd7a6qPG.js";import{a as m,t as h}from"./button-CWFREsRn.js";import{An as g,Ft as _,G as v,Gn as y,N as b,P as x,W as S,Wn as C,at as w,cn as T,gt as E,ot as D,zt as O}from"./dist-Jliw2AH0.js";import{c as k,l as A,r as j}from"./utils-U6QfaJBO.js";function M(e,t){let n=0;for(let r=0;r<e.length;r++)n+=t(e[r],r);return n}var N=[[`path`,{d:`M18.2505 10.5H19.6403C21.4918 10.5 22.0421 10.7655 21.9975 12.0838C21.9237 14.2674 20.939 16.8047 17 17.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M5.94627 20.6145C2.57185 18.02 2.07468 14.3401 2.00143 10.5001C1.96979 8.8413 2.45126 8.5 4.65919 8.5H15.3408C17.5487 8.5 18.0302 8.8413 17.9986 10.5001C17.9253 14.3401 17.4281 18.02 14.0537 20.6145C13.0934 21.3528 12.2831 21.5 10.9194 21.5H9.08064C7.71686 21.5 6.90658 21.3528 5.94627 20.6145Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M11.3089 2.5C10.7622 2.83861 10.0012 4 10.0012 5.5M7.53971 4C7.53971 4 7 4.5 7 5.5M14.0012 4C13.7279 4.1693 13.5 5 13.5 5.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}]],P=[[`path`,{d:`M3.89124 3.89124C5.28249 2.5 7.52166 2.5 12 2.5C16.4783 2.5 18.7175 2.5 20.1088 3.89124C21.5 5.28249 21.5 7.52166 21.5 12C21.5 16.4783 21.5 18.7175 20.1088 20.1088C18.7175 21.5 16.4783 21.5 12 21.5C7.52166 21.5 5.28249 21.5 3.89124 20.1088C2.5 18.7175 2.5 16.4783 2.5 12C2.5 7.52166 2.5 5.28249 3.89124 3.89124Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M12 2.5V21.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`1`}]],F=[[`path`,{d:`M2.49219 15.5H21.4922`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M2.49219 8.5H21.4922`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M2.49219 12C2.49219 7.52166 2.49219 5.28249 3.88343 3.89124C5.27467 2.5 7.51384 2.5 11.9922 2.5C16.4705 2.5 18.7097 2.5 20.1009 3.89124C21.4922 5.28249 21.4922 7.52166 21.4922 12C21.4922 16.4783 21.4922 18.7175 20.1009 20.1088C18.7097 21.5 16.4705 21.5 11.9922 21.5C7.51384 21.5 5.27467 21.5 3.88343 20.1088C2.49219 18.7175 2.49219 16.4783 2.49219 12Z`,stroke:`currentColor`,strokeWidth:`1.5`,key:`2`}]],I=e(A(),1);function L(e){let t=(0,I.useRef)(e);return(0,I.useInsertionEffect)(()=>void(t.current=e)),(0,I.useCallback)((...e)=>t.current(...e),[])}var R=k(),z=(0,I.createContext)(void 0);function ee(){return(0,I.useContext)(z)}var B={position:`absolute`,top:0,bottom:0,textAlign:`center`,whiteSpace:`normal`,touchAction:`none`},V={display:`contents`};function H(){return null}function U({fileDiff:e,actions:t,renderCustomHeader:n,renderHeaderPrefix:r,renderHeaderFilenameSuffix:i,renderHeaderMetadata:a,renderAnnotation:o,renderGutterUtility:s,renderMergeConflictUtility:c,lineAnnotations:l,getHoveredLine:u,getInstance:d,getAnnotationSlotName:f=O}){let p=n?.(e),m=r?.(e),h=i?.(e),_=a?.(e);return(0,R.jsxs)(R.Fragment,{children:[p==null?(0,R.jsxs)(R.Fragment,{children:[m!=null&&(0,R.jsx)(`div`,{slot:`header-prefix`,children:m}),h!=null&&(0,R.jsx)(`div`,{slot:`header-filename-suffix`,children:h}),_!=null&&(0,R.jsx)(`div`,{slot:`header-metadata`,children:_})]}):(0,R.jsx)(`div`,{slot:g,children:p}),o!=null&&l?.map((t,n)=>(0,R.jsx)(`div`,{slot:f(t),children:o(t,e)},n)),t!=null&&c!=null&&d!=null&&t.map(t=>{if(t==null)return;let n=te(t,e);return(0,R.jsx)(`div`,{slot:n,style:V,children:c(t,d)},n)}),s!=null&&(0,R.jsx)(`div`,{slot:`gutter-utility-slot`,style:B,children:s(u)})]})}function te(e,t){let n=b(e,t);return n==null?void 0:x({hunkIndex:n.hunkIndex,lineIndex:n.lineIndex,conflictIndex:e.conflictIndex})}var ne=(0,I.createContext)(void 0);function re(e,t){return typeof window>`u`&&t!=null?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`template`,{shadowrootmode:`open`,dangerouslySetInnerHTML:{__html:t}}),e]}):(0,R.jsx)(R.Fragment,{children:e})}var ie=(0,I.createContext)(void 0);function W(){return(0,I.useContext)(ie)}function G(){let[e]=(0,I.useState)(()=>{let e=0,t;return{getSnapshot:()=>e,subscribe(e){return t=e,()=>{t=void 0}},forceUpdate(){e++,t?.()}}});return(0,I.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot),e.forceUpdate}function K(e,t){"use no memo";return e.current?.__getNextRenderData(t)}var q=typeof window>`u`?I.useEffect:I.useLayoutEffect;function J({fileDiff:e,oldFile:t,newFile:n,options:r,editorOptions:i,editStateKey:a,lineAnnotations:o,selectedLines:s,prerenderedHTML:c,metrics:l,hasGutterRenderUtility:u,hasCustomHeader:d,disableWorkerPool:f,edit:p,onEditChange:m,onEditComplete:h}){let g=W(),_=s!==void 0,b=(0,I.useContext)(ne),x=ee(),[C,w]=(0,I.useState)(),E=L(e=>m?.(e)),D=m==null?void 0:E,k=(0,I.useRef)(null),A=L(r=>{let i=h?.(r)??`reject`;return i===`accept`&&(k.current={fileDiff:{installed:r.fileDiff,stale:r.originalFileDiff},filePair:e==null?{fileDiff:r.fileDiff,installed:{oldFile:r.oldFile,newFile:r.newFile},stale:{oldFile:t??null,newFile:n??null}}:null,annotations:{installed:r.lineAnnotations,stale:r.originalLineAnnotations}}),i}),j=h==null?void 0:A,M=ae({acceptedCache:k,fileDiff:e,newFile:n,oldFile:t,parseDiffOptions:r?.parseDiffOptions}),N=(0,I.useRef)(null),P=G(),F=K(N,oe(k,M,o))??{fileDiff:M,lineAnnotations:o??y},R=(0,I.useRef)(null),z=(0,I.useRef)(null),B=L(()=>{if(x==null)throw Error(`FileDiff: EditContext is not attached`);return x(`file-diff`,i??{},a)}),V=L(e=>{if(e!=null){if(N.current!=null)throw Error(`useFileDiffInstance: An instance should not already exist when a node is created`);g==null?N.current=new v(Z({controlledSelection:_,hasCustomHeader:d,hasGutterRenderUtility:u,onEditChange:D,onEditComplete:j,options:r}),f?void 0:b,P):N.current=new S(Z({controlledSelection:_,hasCustomHeader:d,hasGutterRenderUtility:u,onEditChange:D,onEditComplete:j,options:r}),g,l,f?void 0:b,P),N.current.hydrate({fileDiff:M,fileContainer:e,lineAnnotations:o,prerenderedHTML:c})}else{if(N.current==null)throw Error(`useFileDiffInstance: A FileDiff instance should exist when unmounting`);z.current=null,N.current.cleanUp(),N.current=null,R.current=null}});q(()=>{let{current:e}=N;if(e==null)return;let t=Z({controlledSelection:_,hasCustomHeader:d,hasGutterRenderUtility:u,onEditChange:D,onEditComplete:j,options:r}),n=!T(e.options,t);if(e.setOptions(t),!p&&(z.current=null,R.current!=null)){let{current:e}=R;R.current=null,e()}let i=se(M,o,k);if(e.render({forceRender:n,fileDiff:i.fileDiff,lineAnnotations:i.lineAnnotations}),s!==void 0&&e.setSelectedLines(s),!p||R.current!=null)return;if(x==null)throw Error(`FileDiff: EditContext is not attached`);let a=()=>{N.current===e&&R.current==null&&e.__canAttachEditor()&&(R.current=Q(e,B),P())};if(e.__canAttachEditor()){z.current=null,a();return}let c=e.__prepareForEditing();if(c==null){z.current=null;return}if(z.current?.promise===c)return;let l={promise:c};z.current=l,c.then(()=>{z.current===l&&(a(),z.current=null)}).catch(e=>{z.current===l&&(z.current=null,w(e))})});let H=(0,I.useCallback)(()=>N.current?.getHoveredLine(),[]),U=(0,I.useCallback)(e=>N.current?.getAnnotationSlotName(e)??O(e),[]);if(C!=null)throw C;return{...F,ref:V,getHoveredLine:H,getAnnotationSlotName:U}}function ae({acceptedCache:e,fileDiff:t,newFile:n,oldFile:r,parseDiffOptions:i}){return(0,I.useMemo)(()=>{if(t!=null)return t;let{current:a}=e,o=a?.filePair;if(a!=null&&o!=null){if(Y(r,n,o.stale)||Y(r,n,o.installed))return o.fileDiff;a.filePair=null}return w(r??null,n??null,i)},[e,t,r,n,i])}function Y(e,t,n){return _(e??void 0,n.oldFile??void 0)&&_(t??void 0,n.newFile??void 0)}function oe(e,t,n){"use no memo";return X(t,n,e.current)}function X(e,t,n){return{fileDiff:n?.fileDiff!=null&&E(e,n.fileDiff.stale)?n.fileDiff.installed:e,lineAnnotations:n?.annotations!=null&&t===n.annotations.stale?n.annotations.installed:t}}function se(e,t,n){let{current:r}=n,i=X(e,t,r);return r==null||(r.fileDiff!=null&&!E(e,r.fileDiff.stale)&&(r.fileDiff=null),t!==r.annotations?.stale&&(r.annotations=null),r.fileDiff==null&&r.annotations==null&&r.filePair==null&&(n.current=null)),i}function Z({options:e,controlledSelection:t,hasCustomHeader:n,hasGutterRenderUtility:r,onEditChange:i,onEditComplete:a}){return{...e,controlledSelection:t,renderCustomHeader:n?H:e?.renderCustomHeader,renderGutterUtility:r?H:e?.renderGutterUtility,onEditChange:i,onEditComplete:a}}function Q(e,t){let n=t();try{return n.edit(e)}catch(e){throw n.cleanUp(),e}}function ce({fileDiff:e,options:t,editorOptions:n,editStateKey:r,metrics:i,lineAnnotations:a,selectedLines:o,className:s,style:c,prerenderedHTML:l,renderAnnotation:u,renderCustomHeader:d,renderHeaderPrefix:f,renderHeaderFilenameSuffix:p,renderHeaderMetadata:m,renderGutterUtility:h,disableWorkerPool:g=!1,edit:_=!1,onEditChange:v,onEditComplete:y}){let{ref:b,getHoveredLine:x,getAnnotationSlotName:S,fileDiff:w,lineAnnotations:T}=J({fileDiff:e,options:t,editorOptions:n,editStateKey:r,metrics:i,lineAnnotations:a,selectedLines:o,prerenderedHTML:l,hasGutterRenderUtility:h!=null,hasCustomHeader:d!=null,disableWorkerPool:g,edit:_,onEditChange:v,onEditComplete:y}),E=U({fileDiff:w,renderCustomHeader:d,renderHeaderPrefix:f,renderHeaderFilenameSuffix:p,renderHeaderMetadata:m,renderAnnotation:u,renderGutterUtility:h,lineAnnotations:T,getHoveredLine:x,getAnnotationSlotName:S});return(0,R.jsx)(C,{ref:b,className:s,style:c,children:re(E,l)})}var le=3e3,ue=`text-foreground hover:bg-accent aria-pressed:bg-accent inline-flex h-7 min-w-7 cursor-pointer items-center justify-center rounded-lg px-1.5 [&_svg]:opacity-80`,$=`text-muted-foreground hover:text-foreground aria-pressed:bg-background aria-pressed:text-foreground dark:aria-pressed:bg-input/72 inline-flex h-6 cursor-pointer items-center justify-center rounded-md px-2.5 aria-pressed:shadow-xs`;function de(e){let[g,_]=(0,I.useState)(null),[v,y]=(0,I.useState)(null),[b,x]=(0,I.useState)(0),S=(0,I.useRef)({patch:null,count:0}),C=u(e=>e.prefs.diff),w=c(),[T,E]=r(`diffFlipped`,[]);function O(e){l({...d().prefs,diff:{...C,...e}})}(0,I.useEffect)(()=>{let t=!0,n=!1;async function r(){if(!n){n=!0;try{let n=await f(e.machine,`git.diff`,{projectId:e.projectId});if(!t||(y(null),n===S.current.patch))return;S.current={patch:n,count:S.current.count+1},_(n.trim()===``?[]:D(n,`${e.projectId}:${S.current.count}`).flatMap(e=>e.files))}catch(e){t&&y(j(e))}finally{n=!1}}}function i(){document.hidden||r()}r();let a=window.setInterval(i,le);return window.addEventListener(`focus`,i),()=>{t=!1,window.clearInterval(a),window.removeEventListener(`focus`,i)}},[e.machine,e.projectId,e.running,b]);let k=g??[],A=M(k,e=>M(e.hunks,e=>e.additionLines)),L=M(k,e=>M(e.hunks,e=>e.deletionLines));return(0,R.jsxs)(`div`,{className:`bg-background flex h-full min-h-0 min-w-0 flex-col`,children:[(0,R.jsxs)(`div`,{className:`border-border/60 bg-background flex h-(--workspace-topbar-height) shrink-0 items-center justify-between gap-2 border-b pr-3 pl-3`,children:[(0,R.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[(0,R.jsx)(h,{size:`icon-sm`,variant:`ghost`,title:`Close`,"aria-label":`Close`,onClick:e.onClose,children:(0,R.jsx)(m,{icon:p,className:`size-4`})}),(0,R.jsx)(`span`,{className:`text-foreground min-w-0 truncate text-xs font-medium`,children:`Uncommitted changes`})]}),(0,R.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[k.length>0&&(0,R.jsxs)(`span`,{className:`text-2xs mr-1 inline-flex items-center gap-1 font-mono tabular-nums`,children:[(0,R.jsxs)(`span`,{className:`text-diff-addition`,children:[`+`,A]}),(0,R.jsxs)(`span`,{className:`text-diff-deletion`,children:[`-`,L]})]}),(0,R.jsx)(h,{size:`icon-sm`,variant:`ghost`,title:`Refresh diff`,"aria-label":`Refresh diff`,onClick:()=>x(b+1),children:(0,R.jsx)(m,{icon:i,className:`size-4`})}),k.length>0&&(0,R.jsx)(h,{size:`icon-sm`,variant:`ghost`,title:C.collapsed?`Expand all files`:`Collapse all files`,onClick:()=>{E([]),O({collapsed:!C.collapsed})},children:(0,R.jsx)(m,{icon:C.collapsed?n:s,className:`size-4`})}),(0,R.jsxs)(`div`,{className:`bg-input/40 flex shrink-0 items-center rounded-lg p-0.5`,children:[(0,R.jsx)(`button`,{className:$,"aria-pressed":!C.split,"aria-label":`Stacked diff view`,onClick:()=>O({split:!1}),children:(0,R.jsx)(m,{icon:F,className:`size-3.5`})}),(0,R.jsx)(`button`,{className:$,"aria-pressed":C.split,"aria-label":`Split diff view`,onClick:()=>O({split:!0}),children:(0,R.jsx)(m,{icon:P,className:`size-3.5`})})]}),(0,R.jsx)(`button`,{className:ue,"aria-pressed":C.wrap,title:C.wrap?`Disable line wrapping`:`Enable line wrapping`,onClick:()=>O({wrap:!C.wrap}),children:(0,R.jsx)(m,{icon:o,className:`size-3.5`})})]})]}),(0,R.jsxs)(`div`,{className:`diff-render-surface min-h-0 flex-1 overflow-y-auto [--code-background:var(--background)]`,children:[v!==null&&(0,R.jsx)(`p`,{className:`text-muted-foreground p-4 text-center text-xs`,children:v}),v===null&&g===null&&(0,R.jsx)(`p`,{className:`text-muted-foreground p-4 text-center text-xs`,children:`Loading…`}),v===null&&g?.length===0&&(0,R.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-3 p-6 text-center`,children:[(0,R.jsx)(m,{icon:N,className:`text-muted-foreground/40 size-8`}),(0,R.jsxs)(`div`,{className:`grid gap-1`,children:[(0,R.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`No uncommitted changes`}),(0,R.jsx)(`p`,{className:`text-muted-foreground/50 text-xs italic`,children:`If it works, don’t touch it.`})]})]}),v===null&&k.map(e=>{let n=C.collapsed!==T.includes(e.name);function r(){E(T.includes(e.name)?T.filter(t=>t!==e.name):[...T,e.name])}return(0,R.jsx)(`div`,{onClick:e=>{e.nativeEvent.composedPath().some(e=>e instanceof Element&&e.hasAttribute(`data-title`))&&r()},children:(0,R.jsx)(ce,{fileDiff:e,options:{theme:w,themeType:`dark`,unsafeCSS:`:host,
|
|
1
|
+
import{i as e}from"./rolldown-runtime-COiEfhsA.js";import{a as t,i as n,n as r}from"./dist-D99rUXSZ.js";import{n as i,r as a,t as o}from"./TextWrapIcon-BRhMbXe9.js";import{t as s}from"./ChevronsDownUpIcon-BNVFd2te.js";import{I as c,M as l,N as u,g as d,in as f,t as p}from"./XIcon-41gae75-.js";import{a as m,t as h}from"./button-CWFREsRn.js";import{An as g,Ft as _,G as v,Gn as y,N as b,P as x,W as S,Wn as C,at as w,cn as T,gt as E,ot as D,zt as O}from"./dist-Jliw2AH0.js";import{c as k,l as A,r as j}from"./utils-U6QfaJBO.js";function M(e,t){let n=0;for(let r=0;r<e.length;r++)n+=t(e[r],r);return n}var N=[[`path`,{d:`M18.2505 10.5H19.6403C21.4918 10.5 22.0421 10.7655 21.9975 12.0838C21.9237 14.2674 20.939 16.8047 17 17.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M5.94627 20.6145C2.57185 18.02 2.07468 14.3401 2.00143 10.5001C1.96979 8.8413 2.45126 8.5 4.65919 8.5H15.3408C17.5487 8.5 18.0302 8.8413 17.9986 10.5001C17.9253 14.3401 17.4281 18.02 14.0537 20.6145C13.0934 21.3528 12.2831 21.5 10.9194 21.5H9.08064C7.71686 21.5 6.90658 21.3528 5.94627 20.6145Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M11.3089 2.5C10.7622 2.83861 10.0012 4 10.0012 5.5M7.53971 4C7.53971 4 7 4.5 7 5.5M14.0012 4C13.7279 4.1693 13.5 5 13.5 5.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}]],P=[[`path`,{d:`M3.89124 3.89124C5.28249 2.5 7.52166 2.5 12 2.5C16.4783 2.5 18.7175 2.5 20.1088 3.89124C21.5 5.28249 21.5 7.52166 21.5 12C21.5 16.4783 21.5 18.7175 20.1088 20.1088C18.7175 21.5 16.4783 21.5 12 21.5C7.52166 21.5 5.28249 21.5 3.89124 20.1088C2.5 18.7175 2.5 16.4783 2.5 12C2.5 7.52166 2.5 5.28249 3.89124 3.89124Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M12 2.5V21.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`1`}]],F=[[`path`,{d:`M2.49219 15.5H21.4922`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M2.49219 8.5H21.4922`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M2.49219 12C2.49219 7.52166 2.49219 5.28249 3.88343 3.89124C5.27467 2.5 7.51384 2.5 11.9922 2.5C16.4705 2.5 18.7097 2.5 20.1009 3.89124C21.4922 5.28249 21.4922 7.52166 21.4922 12C21.4922 16.4783 21.4922 18.7175 20.1009 20.1088C18.7097 21.5 16.4705 21.5 11.9922 21.5C7.51384 21.5 5.27467 21.5 3.88343 20.1088C2.49219 18.7175 2.49219 16.4783 2.49219 12Z`,stroke:`currentColor`,strokeWidth:`1.5`,key:`2`}]],I=e(A(),1);function L(e){let t=(0,I.useRef)(e);return(0,I.useInsertionEffect)(()=>void(t.current=e)),(0,I.useCallback)((...e)=>t.current(...e),[])}var R=k(),z=(0,I.createContext)(void 0);function ee(){return(0,I.useContext)(z)}var B={position:`absolute`,top:0,bottom:0,textAlign:`center`,whiteSpace:`normal`,touchAction:`none`},V={display:`contents`};function H(){return null}function U({fileDiff:e,actions:t,renderCustomHeader:n,renderHeaderPrefix:r,renderHeaderFilenameSuffix:i,renderHeaderMetadata:a,renderAnnotation:o,renderGutterUtility:s,renderMergeConflictUtility:c,lineAnnotations:l,getHoveredLine:u,getInstance:d,getAnnotationSlotName:f=O}){let p=n?.(e),m=r?.(e),h=i?.(e),_=a?.(e);return(0,R.jsxs)(R.Fragment,{children:[p==null?(0,R.jsxs)(R.Fragment,{children:[m!=null&&(0,R.jsx)(`div`,{slot:`header-prefix`,children:m}),h!=null&&(0,R.jsx)(`div`,{slot:`header-filename-suffix`,children:h}),_!=null&&(0,R.jsx)(`div`,{slot:`header-metadata`,children:_})]}):(0,R.jsx)(`div`,{slot:g,children:p}),o!=null&&l?.map((t,n)=>(0,R.jsx)(`div`,{slot:f(t),children:o(t,e)},n)),t!=null&&c!=null&&d!=null&&t.map(t=>{if(t==null)return;let n=te(t,e);return(0,R.jsx)(`div`,{slot:n,style:V,children:c(t,d)},n)}),s!=null&&(0,R.jsx)(`div`,{slot:`gutter-utility-slot`,style:B,children:s(u)})]})}function te(e,t){let n=b(e,t);return n==null?void 0:x({hunkIndex:n.hunkIndex,lineIndex:n.lineIndex,conflictIndex:e.conflictIndex})}var ne=(0,I.createContext)(void 0);function re(e,t){return typeof window>`u`&&t!=null?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`template`,{shadowrootmode:`open`,dangerouslySetInnerHTML:{__html:t}}),e]}):(0,R.jsx)(R.Fragment,{children:e})}var ie=(0,I.createContext)(void 0);function W(){return(0,I.useContext)(ie)}function G(){let[e]=(0,I.useState)(()=>{let e=0,t;return{getSnapshot:()=>e,subscribe(e){return t=e,()=>{t=void 0}},forceUpdate(){e++,t?.()}}});return(0,I.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot),e.forceUpdate}function K(e,t){"use no memo";return e.current?.__getNextRenderData(t)}var q=typeof window>`u`?I.useEffect:I.useLayoutEffect;function J({fileDiff:e,oldFile:t,newFile:n,options:r,editorOptions:i,editStateKey:a,lineAnnotations:o,selectedLines:s,prerenderedHTML:c,metrics:l,hasGutterRenderUtility:u,hasCustomHeader:d,disableWorkerPool:f,edit:p,onEditChange:m,onEditComplete:h}){let g=W(),_=s!==void 0,b=(0,I.useContext)(ne),x=ee(),[C,w]=(0,I.useState)(),E=L(e=>m?.(e)),D=m==null?void 0:E,k=(0,I.useRef)(null),A=L(r=>{let i=h?.(r)??`reject`;return i===`accept`&&(k.current={fileDiff:{installed:r.fileDiff,stale:r.originalFileDiff},filePair:e==null?{fileDiff:r.fileDiff,installed:{oldFile:r.oldFile,newFile:r.newFile},stale:{oldFile:t??null,newFile:n??null}}:null,annotations:{installed:r.lineAnnotations,stale:r.originalLineAnnotations}}),i}),j=h==null?void 0:A,M=ae({acceptedCache:k,fileDiff:e,newFile:n,oldFile:t,parseDiffOptions:r?.parseDiffOptions}),N=(0,I.useRef)(null),P=G(),F=K(N,oe(k,M,o))??{fileDiff:M,lineAnnotations:o??y},R=(0,I.useRef)(null),z=(0,I.useRef)(null),B=L(()=>{if(x==null)throw Error(`FileDiff: EditContext is not attached`);return x(`file-diff`,i??{},a)}),V=L(e=>{if(e!=null){if(N.current!=null)throw Error(`useFileDiffInstance: An instance should not already exist when a node is created`);g==null?N.current=new v(Z({controlledSelection:_,hasCustomHeader:d,hasGutterRenderUtility:u,onEditChange:D,onEditComplete:j,options:r}),f?void 0:b,P):N.current=new S(Z({controlledSelection:_,hasCustomHeader:d,hasGutterRenderUtility:u,onEditChange:D,onEditComplete:j,options:r}),g,l,f?void 0:b,P),N.current.hydrate({fileDiff:M,fileContainer:e,lineAnnotations:o,prerenderedHTML:c})}else{if(N.current==null)throw Error(`useFileDiffInstance: A FileDiff instance should exist when unmounting`);z.current=null,N.current.cleanUp(),N.current=null,R.current=null}});q(()=>{let{current:e}=N;if(e==null)return;let t=Z({controlledSelection:_,hasCustomHeader:d,hasGutterRenderUtility:u,onEditChange:D,onEditComplete:j,options:r}),n=!T(e.options,t);if(e.setOptions(t),!p&&(z.current=null,R.current!=null)){let{current:e}=R;R.current=null,e()}let i=se(M,o,k);if(e.render({forceRender:n,fileDiff:i.fileDiff,lineAnnotations:i.lineAnnotations}),s!==void 0&&e.setSelectedLines(s),!p||R.current!=null)return;if(x==null)throw Error(`FileDiff: EditContext is not attached`);let a=()=>{N.current===e&&R.current==null&&e.__canAttachEditor()&&(R.current=Q(e,B),P())};if(e.__canAttachEditor()){z.current=null,a();return}let c=e.__prepareForEditing();if(c==null){z.current=null;return}if(z.current?.promise===c)return;let l={promise:c};z.current=l,c.then(()=>{z.current===l&&(a(),z.current=null)}).catch(e=>{z.current===l&&(z.current=null,w(e))})});let H=(0,I.useCallback)(()=>N.current?.getHoveredLine(),[]),U=(0,I.useCallback)(e=>N.current?.getAnnotationSlotName(e)??O(e),[]);if(C!=null)throw C;return{...F,ref:V,getHoveredLine:H,getAnnotationSlotName:U}}function ae({acceptedCache:e,fileDiff:t,newFile:n,oldFile:r,parseDiffOptions:i}){return(0,I.useMemo)(()=>{if(t!=null)return t;let{current:a}=e,o=a?.filePair;if(a!=null&&o!=null){if(Y(r,n,o.stale)||Y(r,n,o.installed))return o.fileDiff;a.filePair=null}return w(r??null,n??null,i)},[e,t,r,n,i])}function Y(e,t,n){return _(e??void 0,n.oldFile??void 0)&&_(t??void 0,n.newFile??void 0)}function oe(e,t,n){"use no memo";return X(t,n,e.current)}function X(e,t,n){return{fileDiff:n?.fileDiff!=null&&E(e,n.fileDiff.stale)?n.fileDiff.installed:e,lineAnnotations:n?.annotations!=null&&t===n.annotations.stale?n.annotations.installed:t}}function se(e,t,n){let{current:r}=n,i=X(e,t,r);return r==null||(r.fileDiff!=null&&!E(e,r.fileDiff.stale)&&(r.fileDiff=null),t!==r.annotations?.stale&&(r.annotations=null),r.fileDiff==null&&r.annotations==null&&r.filePair==null&&(n.current=null)),i}function Z({options:e,controlledSelection:t,hasCustomHeader:n,hasGutterRenderUtility:r,onEditChange:i,onEditComplete:a}){return{...e,controlledSelection:t,renderCustomHeader:n?H:e?.renderCustomHeader,renderGutterUtility:r?H:e?.renderGutterUtility,onEditChange:i,onEditComplete:a}}function Q(e,t){let n=t();try{return n.edit(e)}catch(e){throw n.cleanUp(),e}}function ce({fileDiff:e,options:t,editorOptions:n,editStateKey:r,metrics:i,lineAnnotations:a,selectedLines:o,className:s,style:c,prerenderedHTML:l,renderAnnotation:u,renderCustomHeader:d,renderHeaderPrefix:f,renderHeaderFilenameSuffix:p,renderHeaderMetadata:m,renderGutterUtility:h,disableWorkerPool:g=!1,edit:_=!1,onEditChange:v,onEditComplete:y}){let{ref:b,getHoveredLine:x,getAnnotationSlotName:S,fileDiff:w,lineAnnotations:T}=J({fileDiff:e,options:t,editorOptions:n,editStateKey:r,metrics:i,lineAnnotations:a,selectedLines:o,prerenderedHTML:l,hasGutterRenderUtility:h!=null,hasCustomHeader:d!=null,disableWorkerPool:g,edit:_,onEditChange:v,onEditComplete:y}),E=U({fileDiff:w,renderCustomHeader:d,renderHeaderPrefix:f,renderHeaderFilenameSuffix:p,renderHeaderMetadata:m,renderAnnotation:u,renderGutterUtility:h,lineAnnotations:T,getHoveredLine:x,getAnnotationSlotName:S});return(0,R.jsx)(C,{ref:b,className:s,style:c,children:re(E,l)})}var le=3e3,ue=`text-foreground hover:bg-accent aria-pressed:bg-accent inline-flex h-7 min-w-7 cursor-pointer items-center justify-center rounded-lg px-1.5 [&_svg]:opacity-80`,$=`text-muted-foreground hover:text-foreground aria-pressed:bg-background aria-pressed:text-foreground dark:aria-pressed:bg-input/72 inline-flex h-6 cursor-pointer items-center justify-center rounded-md px-2.5 aria-pressed:shadow-xs`;function de(e){let[g,_]=(0,I.useState)(null),[v,y]=(0,I.useState)(null),[b,x]=(0,I.useState)(0),S=(0,I.useRef)({patch:null,count:0}),C=u(e=>e.prefs.diff),w=c(),[T,E]=r(`diffFlipped`,[]);function O(e){l({...d().prefs,diff:{...C,...e}})}(0,I.useEffect)(()=>{let t=!0,n=!1;async function r(){if(!n){n=!0;try{let n=await f(e.machine,`git.diff`,{projectId:e.projectId});if(!t||(y(null),n===S.current.patch))return;S.current={patch:n,count:S.current.count+1},_(n.trim()===``?[]:D(n,`${e.projectId}:${S.current.count}`).flatMap(e=>e.files))}catch(e){t&&y(j(e))}finally{n=!1}}}function i(){document.hidden||r()}r();let a=window.setInterval(i,le);return window.addEventListener(`focus`,i),()=>{t=!1,window.clearInterval(a),window.removeEventListener(`focus`,i)}},[e.machine,e.projectId,e.running,b]);let k=g??[],A=M(k,e=>M(e.hunks,e=>e.additionLines)),L=M(k,e=>M(e.hunks,e=>e.deletionLines));return(0,R.jsxs)(`div`,{className:`bg-background flex h-full min-h-0 min-w-0 flex-col`,children:[(0,R.jsxs)(`div`,{className:`border-border/60 bg-background flex h-(--workspace-topbar-height) shrink-0 items-center justify-between gap-2 border-b pr-3 pl-3`,children:[(0,R.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[(0,R.jsx)(h,{size:`icon-sm`,variant:`ghost`,title:`Close`,"aria-label":`Close`,onClick:e.onClose,children:(0,R.jsx)(m,{icon:p,className:`size-4`})}),(0,R.jsx)(`span`,{className:`text-foreground min-w-0 truncate text-xs font-medium`,children:`Uncommitted changes`})]}),(0,R.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[k.length>0&&(0,R.jsxs)(`span`,{className:`text-2xs mr-1 inline-flex items-center gap-1 font-mono tabular-nums`,children:[(0,R.jsxs)(`span`,{className:`text-diff-addition`,children:[`+`,A]}),(0,R.jsxs)(`span`,{className:`text-diff-deletion`,children:[`-`,L]})]}),(0,R.jsx)(h,{size:`icon-sm`,variant:`ghost`,title:`Refresh diff`,"aria-label":`Refresh diff`,onClick:()=>x(b+1),children:(0,R.jsx)(m,{icon:i,className:`size-4`})}),k.length>0&&(0,R.jsx)(h,{size:`icon-sm`,variant:`ghost`,title:C.collapsed?`Expand all files`:`Collapse all files`,onClick:()=>{E([]),O({collapsed:!C.collapsed})},children:(0,R.jsx)(m,{icon:C.collapsed?n:s,className:`size-4`})}),(0,R.jsxs)(`div`,{className:`bg-input/40 flex shrink-0 items-center rounded-lg p-0.5`,children:[(0,R.jsx)(`button`,{className:$,"aria-pressed":!C.split,"aria-label":`Stacked diff view`,onClick:()=>O({split:!1}),children:(0,R.jsx)(m,{icon:F,className:`size-3.5`})}),(0,R.jsx)(`button`,{className:$,"aria-pressed":C.split,"aria-label":`Split diff view`,onClick:()=>O({split:!0}),children:(0,R.jsx)(m,{icon:P,className:`size-3.5`})})]}),(0,R.jsx)(`button`,{className:ue,"aria-pressed":C.wrap,title:C.wrap?`Disable line wrapping`:`Enable line wrapping`,onClick:()=>O({wrap:!C.wrap}),children:(0,R.jsx)(m,{icon:o,className:`size-3.5`})})]})]}),(0,R.jsxs)(`div`,{className:`diff-render-surface min-h-0 flex-1 overflow-y-auto [--code-background:var(--background)]`,children:[v!==null&&(0,R.jsx)(`p`,{className:`text-muted-foreground p-4 text-center text-xs`,children:v}),v===null&&g===null&&(0,R.jsx)(`p`,{className:`text-muted-foreground p-4 text-center text-xs`,children:`Loading…`}),v===null&&g?.length===0&&(0,R.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-3 p-6 text-center`,children:[(0,R.jsx)(m,{icon:N,className:`text-muted-foreground/40 size-8`}),(0,R.jsxs)(`div`,{className:`grid gap-1`,children:[(0,R.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`No uncommitted changes`}),(0,R.jsx)(`p`,{className:`text-muted-foreground/50 text-xs italic`,children:`If it works, don’t touch it.`})]})]}),v===null&&k.map(e=>{let n=C.collapsed!==T.includes(e.name);function r(){E(T.includes(e.name)?T.filter(t=>t!==e.name):[...T,e.name])}return(0,R.jsx)(`div`,{onClick:e=>{e.nativeEvent.composedPath().some(e=>e instanceof Element&&e.hasAttribute(`data-title`))&&r()},children:(0,R.jsx)(ce,{fileDiff:e,options:{theme:w,themeType:`dark`,unsafeCSS:`:host,
|
|
2
2
|
[data-diffs-header],
|
|
3
3
|
[data-diff],
|
|
4
4
|
[data-file],
|