neko-harness 0.3.1 → 0.3.3
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/README.md +3 -0
- package/dist/client/assets/index-Dja-p0ED.js +133 -0
- package/dist/client/assets/index-K81InyqT.css +2 -0
- package/dist/client/index.html +2 -2
- package/dist/gateway.js +1061 -350
- package/dist/neko.js +4090 -693
- package/package.json +1 -1
- package/dist/client/assets/index-BTHbU-2p.css +0 -2
- package/dist/client/assets/index-O88LHrzD.js +0 -83
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},c=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},l=(n,r,o)=>(o=n==null?{}:e(i(n)),c(r||!n||!n.__esModule||!a.call(n,`default`)?t(o,`default`,{value:n,enumerable:!0}):o,n));(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var u=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.for(`react.view_transition`),m=Symbol.iterator;function h(e){return typeof e!=`object`||!e?null:(e=m&&e[m]||e[`@@iterator`],typeof e==`function`?e:null)}var g={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},_=Object.assign,v={};function y(e,t,n){this.props=e,this.context=t,this.refs=v,this.updater=n||g}y.prototype.isReactComponent={},y.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},y.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function b(){}b.prototype=y.prototype;function x(e,t,n){this.props=e,this.context=t,this.refs=v,this.updater=n||g}var S=x.prototype=new b;S.constructor=x,_(S,y.prototype),S.isPureReactComponent=!0;var C=Array.isArray;function w(){}var T={H:null,A:null,T:null,S:null},ee=Object.prototype.hasOwnProperty;function E(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function te(e,t){return E(e.type,t,e.props)}function ne(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function D(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var re=/\/+/g;function ie(e,t){return typeof e==`object`&&e&&e.key!=null?D(``+e.key):t.toString(36)}function ae(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(w,w):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function O(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,O(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+ie(e,0):a,C(o)?(i=``,c!=null&&(i=c.replace(re,`$&/`)+`/`),O(o,r,i,``,function(e){return e})):o!=null&&(ne(o)&&(o=te(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(re,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(C(e))for(var u=0;u<e.length;u++)a=e[u],s=l+ie(a,u),c+=O(a,r,i,s,o);else if(u=h(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+ie(a,u++),c+=O(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return O(ae(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function oe(e,t,n){if(e==null)return e;var r=[],i=0;return O(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function se(e){if(e._status===-1){var t=e._result,n=t();n.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t,n.status===void 0&&(n.status=`fulfilled`,n.value=t))},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t,n.status===void 0&&(n.status=`rejected`,n.reason=t))}),e._status===-1&&(e._status=0,e._result=n)}if(e._status===1)return e._result.default;throw e._result}var ce=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)};function le(e){var t=T.T,n={};n.types=t===null?null:t.types,T.T=n;try{var r=e(),i=T.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(w,ce)}catch(e){ce(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),T.T=t}}function ue(e){var t=T.T;if(t!==null){var n=t.types;n===null?t.types=[e]:n.indexOf(e)===-1&&n.push(e)}else le(ue.bind(null,e))}var de={map:oe,forEach:function(e,t,n){oe(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return oe(e,function(){t++}),t},toArray:function(e){return oe(e,function(e){return e})||[]},only:function(e){if(!ne(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=de,e.Component=y,e.Fragment=r,e.Profiler=a,e.PureComponent=x,e.StrictMode=i,e.Suspense=l,e.ViewTransition=p,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=T,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return T.H.useMemoCache(e)}},e.addTransitionType=ue,e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=_({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!ee.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return E(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)ee.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return E(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=ne,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:se}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=le,e.unstable_useCacheRefresh=function(){return T.H.useCacheRefresh()},e.use=function(e){return T.H.use(e)},e.useActionState=function(e,t,n){return T.H.useActionState(e,t,n)},e.useCallback=function(e,t){return T.H.useCallback(e,t)},e.useContext=function(e){return T.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return T.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return T.H.useEffect(e,t)},e.useEffectEvent=function(e){return T.H.useEffectEvent(e)},e.useId=function(){return T.H.useId()},e.useImperativeHandle=function(e,t,n){return T.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return T.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return T.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return T.H.useMemo(e,t)},e.useOptimistic=function(e,t){return T.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return T.H.useReducer(e,t,n)},e.useRef=function(e){return T.H.useRef(e)},e.useState=function(e){return T.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return T.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return T.H.useTransition()},e.version=`19.3.0`})),d=o(((e,t)=>{t.exports=u()})),f=l(d(),1),p=f.useLayoutEffect;function m(e){return e[e.length-1]}function h(e,t){return typeof e==`function`?e(t):e}var g=Object.prototype.hasOwnProperty;function _(e){for(let t in e)if(g.call(e,t))return!0;return!1}var v=()=>Object.create(null),y=(e,t)=>b(e,t,!0);function b(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&&!(x(e)&&x(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&&m(a)!==`${o-1}`||c&&m(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`?b(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`?b(d,o,n,r):o,i&&=u===d&&(a[l]===f||g.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?v():{};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`?b(d,u,n,r):u),p[f]=o<l?d:u):p[f]=a[o];return p}function x(e){return!e||typeof e!=`object`?!1:(Object.getPrototypeOf(e)?.constructor??Object)===Object}function S(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&&!S(a,o,n,r))return!1}return!0}if(x(e)&&x(t)){if(n){for(let i in t)if((r||t[i]!==void 0)&&!S(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||!S(e[a],t[a],n,r)))return!1;return i===0}return!1}var C=/[\x00-\x1f\x7f"<>`{}]/g;function w(e){return e.replace(C,e=>`%`+e.charCodeAt(0).toString(16).toUpperCase().padStart(2,`0`))}function T(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 w(t)}var ee=[`http:`,`https:`,`mailto:`,`tel:`];function E(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 te=/^[\x00-\x20]*[\\/][\t\n\r]*[\\/]/;function ne(e,t){if(!e)return!1;if(te.test(e))return!0;let n=E(e);return n?!t.has(n):!1}function D(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+=T(e.slice(r,i.index))+i[0],r=n.lastIndex;t+=T(r?e.slice(r):e)}return t}function re(e){return/[\s\u0080-\uFFFF]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function ie(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 ae(){throw Error(`Invariant failed`)}function O(e){return e.replace(/\/{2,}/g,`/`)}function oe(e){return e===`/`?e:e.replace(/^\/+/,``)}function se(e){let t=e.length;return t>1&&e[t-1]===`/`?e.replace(/\/+$/,``):e}function ce(e){return se(oe(e))}function le(e,t){return e?.endsWith(`/`)&&e!==`/`&&e!==`${t}/`?e.slice(0,-1):e}function ue(e,t,n=`never`,r){if(t.includes(`//`)&&(t=O(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=O(e)),o=e.split(`/`);o.length>1&&m(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&&(m(o)===``?n===`never`&&o.pop():n===`always`&&o.push(``));let s=o.join(`/`),c=(i?O(s):s)||`/`;return a&&r&&r.set(a,c),c}function de(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 pe(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 me(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+pe(s,f,r)+(d||``)}}return o+a||`/`}function he(e){return e?.isNotFound===!0}function ge(){try{return sessionStorage}catch{return}}var _e=`tsr-scroll-restoration-v1_3`,ve=ge();function ye(){try{return JSON.parse(ve?.getItem(`tsr-scroll-restoration-v1_3`)||`{}`)}catch{return{}}}var k=ye(),A=`data-scroll-restoration-id`,be=e=>e.state.__TSR_key||e.href;function xe(e){let t=e.getAttribute(A);if(t)return`[${A}="${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 Se=!1,Ce=`window`;function we(e){try{return typeof e==`function`?e():document.querySelector(e)}catch{}}function Te(e){let t=new Set;for(let n of e){if(n===Ce)continue;let e=we(n);e&&t.add(e)}return t}function Ee(e,t){let n=t??e.options.scrollRestoration,r=e._scroll;n&&(r.e=!0);let i=e.options.getScrollRestorationKey||be,a=new Set,o=e=>{let t=k[e]||={};for(let e of a)e===document?t[Ce]={scrollX,scrollY}:e.isConnected&&(t[xe(e)]={scrollX:e.scrollLeft,scrollY:e.scrollTop})};n&&!r.s&&(r.s=!0,Se=!1,history.scrollRestoration=`manual`,document.addEventListener(`scroll`,e=>{Se||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(_e,JSON.stringify(k))}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=k[d];if(e){let t=k[u];for(let n in e){if(n===Ce){if(s)continue}else{let e=we(n);if(!e||s&&o&&(l??=Te(o),l.has(e)))continue}t||=k[u]={},t[n]??=e[n]}}}Se=!0;try{let e=t.toLocation.hash,i=t.toLocation.state.__hashScrollIntoViewOptions??!0,a=!1;if(s){!e&&o&&(l??=Te(o));let t=e&&i&&c,s=r.e?k[u]:void 0;if(s)for(let e in s){let{scrollX:r,scrollY:i}=s[e];if(e===Ce){if(t)continue;scrollTo({top:i,left:r,behavior:n}),a=!0}else{let t=we(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{Se=!1}}))}function De(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 Oe(e){return e?e===`false`?!1:e===`true`?!0:e*0==0&&+e+``===e?+e:e:``}function ke(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]=Oe(r):Array.isArray(t)?t.push(Oe(r)):n[e]=[t,Oe(r)]}return n}var Ae=/^(?:\s|["[{\d-]|fa|nu|tr)/,je=Ne(JSON.parse),Me=Pe(JSON.stringify,JSON.parse);function Ne(e){let t=e===JSON.parse;return n=>{n[0]===`?`&&(n=n.slice(1));let r=ke(n);for(let n in r){let i=r[n];if(typeof i==`string`){if(t&&!Ae.test(i))continue;try{r[n]=e(i)}catch{}}}return r}}function Pe(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&&!Ae.test(r))return r;try{return t(r),e(r)}catch{}}return r}return e=>{let t=De(e,r);return t?`?${t}`:``}}var Fe=`__root__`;function Ie(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 Le(e){return e instanceof Response&&!!e.options}function Re(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 ze=4,Be=5;function Ve(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 He(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 Ue(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,h=a?n-1:0;if(!r||s.includes(`$`)){p=a?.slice()??[];let e=m(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)],h=l)}for(;o<l;){let e=o,t=s.indexOf(`/`,e),n=t===-1?l:t,a=He(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=Ge(r);c=n,t.set(e,n)}}else{let t=a[0],m=a[2],g=a[3]??``;if(t===2&&(n=l,o=n+1),p&&h<n&&(h<e-1&&p.push(s.slice(h,e-1)),a[2]=`/`+m,t===2&&a[3]!==void 0&&u<l&&(a[3]=g.slice(0,-1)),p.push(a),h=n),!r)continue;let _=d&&!!(m||g);d||(m=m.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===m&&e.suffix===g);if(y)c=y;else{let e=Ge(r,t,_,m,g);c=e,v.push(e),v.length===2&&i?.push(v)}}r=c}p&&h<u&&p.push(s.slice(h,u));let g=p?.slice();if(!r)return g;if(f&&t.children&&!t.isRoot&&t.id&&t.id.charCodeAt(t.id.lastIndexOf(`/`)+1)===95){let e=Ge(r,Be);(r.pathless??=[]).push(e),r=e}let _=(t.path||!t.children)&&!t.isRoot;if(_&&u<l){let e=Ge(r,ze);r.index=e,r=e}return r.parse=f??null,r.priority=c?.params?.priority??0,r.route||(r.data=g,_&&(r.route=t)),[r,o,g]}function We(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 Ge(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 Ke(e,t){let n=Ge(),r=[];function i(e,t,n,a){let[o,s,c]=Ue(!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(We);t.masksTree=n,t.flatCache=Re(1e3)}function qe(e,t){e||=`/`;let n=t.flatCache.get(e);if(n!==void 0)return n;let r=Ze(e,t.masksTree);return t.flatCache.set(e,r),r}function Je(e,t,n,r,i){e||=`/`,r||=`/`;let a=t?`case\0${e}`:e,o=i.singleCache.get(a);return o||(o=Ge(),Ue(t,{from:e},1,o),i.singleCache.set(a,o)),Ze(r,o,n)}function Ye(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=Ze(e,t.segmentTree,n)}catch(e){if(e instanceof URIError)a=null;else throw e}return a&&(a.branch=$e(a.route)),t.matchCache.set(r,a),a}function Xe(e,t=!1){let n=Ge(),r=[],i={},a={},o=0;function s(e,n,c,l){if(e.init(o),e.id in i&&ae(),i[e.id]=e,o!==0&&e.path){let t=se(e.fullPath);(!a[t]||e.fullPath.endsWith(`/`))&&(a[t]=e)}o++;let[u,d,f]=Ue(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(We);return{processedTree:{segmentTree:n,singleCache:Re(1e3),matchCache:Re(1e3),flatCache:null,masksTree:null},routesById:i,routesByPath:a}}function Ze(e,t,n=!1){let r=e.split(`/`),i=tt(e,r,t,n);if(!i)return null;let[a]=Qe(e,r,i);return{route:i.node.route,rawParams:a}}function Qe(e,t,n){let r=et(n.node),i=n.node.data&&Ve(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===ze)break;if(u.kind===Be){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 $e(e){let t=[e];for(;e.parentRoute;)e=e.parentRoute,t.push(e);return t.reverse(),t}function et(e){let t=Array(e.depth+1);do t[e.depth]=e,e=e.parent;while(e);return t}function tt(e,t,n,r){if(e===`/`&&n.index)return{node:n.index,skipped:0};let i=!m(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(!it(e,t,n))continue;g=n.rawParams,h=n.extract}r&&i.route&&i.kind!==ze&&at(c,n)&&(c=n);let _=u===o;if(_&&(i.route&&(!a||i.kind===ze||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&&(it(e,t,n)||(r=!1)),r){if(!p&&!m&&!d&&rt(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+nt(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+nt(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+nt(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+nt(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 nt(e,t){return 2**(e-t-1)}function rt(e,t){return e===2**(t-1)-1}function it(e,t,n){let r,i;try{[r,i]=Qe(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===ze)>(e.node.kind===ze)||t.node.kind===ze==(e.node.kind===ze)&&t.node.depth>e.node.depth)))}function ot(e,t,n){let r=ce(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=O(`/${r}${e.pathname}`),e)};return n?{input:({url:e})=>st(n,s.input({url:e})),output:({url:e})=>s.output({url:ct(n,e)})}:s}function st(e,t){let n=e?.input?.({url:t});if(n){if(typeof n==`string`)return new URL(n);if(n instanceof URL)return n}return t}function ct(e,t){let n=e?.output?.({url:t});if(n){if(typeof n==`string`)return new URL(n);if(n instanceof URL)return n}return t}function lt(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(()=>{ie(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 ut=`__TSR_index`,dt=`popstate`,ft=`beforeunload`,pt=/^[\x00-\x20]*(?:[\\/][\t\n\r]*){2,}/;function mt(e){let t=pt.exec(e);return t?`/`+e.slice(t[0].length):e}function ht(e){return/[\x00-\x1f\x7f]/.test(e)&&(e=e.replace(/[\x00-\x1f\x7f]/g,e=>`
|
|
2
|
+
\r`.includes(e)?``:encodeURIComponent(e))),mt(e)}function gt(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=yt(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[ut];i=_t(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[ut];i=_t(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[ut]!==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 _t(e,t){let n=bt();return{...t,key:n,__TSR_key:n,[ut]:e}}function vt(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=>ht(e?.createHref?e.createHref(t):t),c=e?.parseLocation??(()=>yt(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!t.history.state?.__TSR_key&&!t.history.state?.key){let e=bt();t.history.replaceState({[ut]: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=yt(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[ut]-l.state[ut],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=gt({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(ft,x,{capture:!0}),t.removeEventListener(dt,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(ft,x,{capture:!0}),t.addEventListener(dt,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 yt(e,t){let n=ht(e),r=n.indexOf(`#`),i=n.indexOf(`?`);if(!t){let e=bt();t={[ut]: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 bt(){return(Math.random()+1).toString(36).slice(7)}function xt(e,t){return e.protocol!==`http:`&&e.protocol!==`https:`||e.origin!==t||!!e.username||!!e.password}function St(e){return e.pathname+e.search+e.hash}function Ct(e){return e.options.loader||e.options.beforeLoad||e.lazyFn||e.options.component?.preload||e.options.pendingComponent?.preload}function wt(e,t){return{fromLocation:t,toLocation:e,pathChanged:t?.pathname!==e.pathname,hrefChanged:t?.href!==e.href,hashChanged:t?.hash!==e.hash}}function Tt({key:e,__TSR_key:t,__TSR_index:n,__hashScrollIntoViewOptions:r,...i}){return i}function Et(e){return e.findIndex(e=>e.status===`error`||e.status===`notFound`||e._notFound)+1}function Dt(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 Ot=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:vt()),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!==`/`&&ce(n)?ot(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=lt(this.latestLocation,e),Ee(this)}},this.updateLatestLocation=()=>{this.latestLocation=this.parseLocation(this.history.location,this.latestLocation)},this.buildRouteTree=()=>{let e=Xe(this.routeTree,this.options.caseSensitive);return this.options.routeMasks&&Ke(this.options.routeMasks,e.processedTree),{...e,resolvePathCache:Re(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:D(e),external:!1,searchStr:o,search:y(t?.search,i),hash:D(r.slice(1)),state:b(t?.state,a)}}let o=st(this.rewrite,new URL(i,this.origin)),s=this.options.parseSearch(o.search),c=this.options.stringifySearch(s);return o.search=c,{href:o.href.replace(o.origin,``),publicHref:i,pathname:D(mt(o.pathname)),external:!!this.rewrite&&xt(o,this.origin),searchStr:c,search:y(t?.search,s),hash:D(o.hash.slice(1)),state:b(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=Ye(se(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=yt(n.href,{});n={...n,to:st(this.rewrite,new URL(e.pathname,this.origin)).pathname,search:this.options.parseSearch(e.search),hash:e.hash.slice(1)}}let r=e._fromLocation||this._pendingLocation||this.latestLocation,i,a=()=>(t=!0,r),o=()=>i??=this.matchRoutesLightweight(a()),s=n.to?`${n.to}`:`.`,c=ue(s[0]===`/`?``:n.unsafeRelative===`path`?a().pathname:n.from??o()[1],s,this.options.trailingSlash,this.resolvePathCache),l=this.routesByPath[se(c)],u=c.includes(`$`),d;if(l)d=l._branch??=$e(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??Ue(!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??=Nt(n.params,e),!_(p))break;p===e&&(p=Object.assign(v(),p));try{Object.assign(p,t(p))}catch{}}}p??=Nt(n.params,Pt(n.params,f)?o()[3]:Ft);let m=e.leaveParams?c:mt(D(f?me(c,f,p,this.pathParamsDecoder):c)),h=It(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,Mt(n.options.validateSearch,{...e,...t}))}catch{}}),t=e}return t},y=h.length?Lt(h,g(),n):n.search===!0?g():typeof n.search==`function`?n.search(g()):n.search||Ft,b=this.options.stringifySearch(y),x=n.hash===!0?a().hash:typeof n.hash==`function`?n.hash(a().hash):n.hash||void 0,S=x?`#${x}`:``,C=n.state?n.state===!0?a().state:typeof n.state==`function`?n.state(a().state):n.state:Ft,w=`${m}${b}${S}`,T,ee,E=!1;if(this.rewrite){let e=new URL(w,this.origin),t=e.origin,n=ct(this.rewrite,e);T=St(e),xt(n,t)?(ee=n.href,E=!0):ee=mt(St(n))}else T=re(w),ee=T;return{publicHref:ee,href:T,pathname:m,search:y,searchStr:b,state:C,hash:x??``,external:E,unmaskOnReload:n.unmaskOnReload}},r=n(e);if(e.mask)r.maskedLocation=n({from:e.from,...e.mask});else if(this.options.routeMasks){let t=qe(r.pathname,this.processedTree);if(t){let i=Object.assign(v(),t.rawParams),{from:a,params:o,...s}=t.route,c=Nt(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 kt(this,r.publicHref,{replace:n.replace,ignoreBlocker:t});let i,a=se(this.latestLocation.href)===se(n.href)&&S(Tt(n.state),Tt(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?E(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 kt(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 An(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(wt(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`)&&Ct(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(te.test(n)||(r=E(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:xt(e,this.origin)||(n=St(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=Ht,this.preloadRoute=e=>jn(this,e),this.matchRoute=(e,t)=>{let n={...e,to:e.to?ue(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=Je(r.pathname,t?.caseSensitive??!1,t?.fuzzy??!1,a.pathname,this.processedTree);return!o||e.params&&!S(o.rawParams,e.params,!0)?!1:t?.includeSearch??!0?S(a.search,r.search,!0)?o.rawParams:!1:o.rawParams},this.getStoreConfig=t,e.pathParamsAllowedCharacters?.length&&(this.pathParamsDecoder=de(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??Me,parseSearch:e.parseSearch??je,protocolAllowlist:e.protocolAllowlist??ee}),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=Ue(!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[`**`]:se(e.pathname))&&(this.options.notFoundRoute?a=[...a,this.options.notFoundRoute]:o=!0);let s=o?Rt(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=Mt(i.options.validateSearch,{...n})??void 0;l={...n,...e},f={...r,...e}}catch(e){let r=e;if(e instanceof At||(r=new At(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=v(),_=i._interpolation?me(i.fullPath,i._interpolation,r,this.pathParamsDecoder,g):i.fullPath,x=i.id+_+h,S=u(i,n),C=this._cache.get(x)??(S?.id===x?S:void 0);d=C?._strictParams??Object.assign(g,d);let w;if(!C)try{zt(i,d)}catch(e){if(w=he(e)||Le(e)?e:new jt(e.message,{cause:e}),t?.throwOnError)throw w}let T=S?`stay`:`enter`,ee;if(C)ee={...C,cause:T,search:y(S?S.search:C.search,l),_strictSearch:f,searchError:p};else{let e=Ct(i)?`pending`:`success`;ee={id:x,ssr:i.options.ssr,index:n,routeId:i.id,params:S?.params??d,_strictParams:d,pathname:_,updatedAt:Date.now(),search:S?y(S.search,l):l,_strictSearch:f,searchError:p,status:e,isFetching:!1,error:void 0,paramsError:w,context:{},abortController:t?._controller??new AbortController,cause:T,loaderDeps:S?b(S.loaderDeps,m):m,invalid:!1,preload:!1,staticData:i.options.staticData||{},fullPath:i.fullPath}}let E=s===i.id;ee._notFound&&!E&&(ee.error=void 0),ee._notFound=E,c[n]=ee}for(let e=0;e<c.length;e++){let n=c[e];n.params=n.cause===`stay`?y(n.params,d):d,t?._controller&&(n.context={})}return c}matchRoutesLightweight(e){let t=m(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=m(a),c={...e.search};for(let e of a)try{Object.assign(c,Mt(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{zt(t,e)}catch{}u=e}let d=[a,s.fullPath,c,u];return this.lightweightCache.set(e,[r,d]),d}};async function kt(e,t,{replace:n,ignoreBlocker:r}){if(!ne(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 At=class extends Error{},jt=class extends Error{};function Mt(e,t){if(e==null)return{};if(`~standard`in e){let n=e[`~standard`].validate(t);if(n instanceof Promise)throw new At(`Async validation not supported`);if(n.issues)throw new At(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 Nt(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 Pt(e,t){return typeof e==`function`?!0:!t||e===!1||e===null?!1:e===void 0||e===!0||t.some(t=>typeof t!=`string`&&!g.call(e,t[1]))}var Ft=Object.freeze({});function It(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=Mt(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 Lt(e,t,n){let r=(t,i,a)=>{if(t>=e.length){if(!n.search)return{};if(n.search===!0)return i;let e=h(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 Rt(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 Fe}function zt(e,t){let n=e.options.params?.parse??e.options.parseParams;n&&Object.assign(t,n(t))}function Bt(e,t){return e.options[t]?.preload?.()}function Vt(e,t){let n=Bt(e,`component`),r=Bt(e,`pendingComponent`);return t&&(r?r=r.then(t):t()),n&&r?Promise.all([n,r]).then(()=>{}):n??r}function Ht(e,t,n){let r=()=>t===!1?void 0:t?Bt(e,t):Vt(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 Ut(e){let t=e.findIndex(e=>e.status!==`success`||e._notFound)+1;return t&&t<e.length?e.slice(0,t):e}function Wt(e,t,n){let r=e._tx;return t&&r?.[2]===n&&!r[3].some(e=>e.routeId===t)}var Gt=0,Kt=1,qt=2,Jt=3,Yt=[4];function Xt(e){return typeof e[0]==`number`}function Zt(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 j(e,t){return e.routesById[t.routeId]}function Qt(e,t,n){return Le(e)?[Jt,e]:he(e)?(e.routeId||=n,[qt,e]):t?(typeof e?.then==`function`&&(e=Error(`A Promise was thrown`,{cause:e})),[Kt,e]):[Gt,e]}function $t(e,t){let n=Qt(t,!0,e.id);if(n[0]!==Kt)return n;try{e.options.onError?.(n[1])}catch(t){n=Qt(t,!0,e.id)}return n}function en(e,t,n,r,i){return i[0].signal.aborted?Yt:_n(e,t,n,$t(n,r),i)}async function tn(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=j(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 rn(e,r),[i,en(e,t,u,a,n)]}if(c.aborted)return[i,Yt];let p=r.paramsError??r.searchError;if(p!==void 0)return rn(e,r),[i,en(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{sn(e,r,`beforeLoad`,n[0]);let a=m({...f,search:r.search,context:r.context,...e.options.additionalContext}),o=await(typeof a?.then==`function`?Zt(a,c):a);if(c.aborted)return[i,Yt];let s=_n(e,t,u,Qt(o,!1,u.id),n);if(s[0]!==Gt)return rn(e,r),[i,s];r.context={...r.context,...o}}catch(a){return rn(e,r),[i,en(e,t,u,a,n)]}finally{r.status=h,sn(e,r,!1,n[0])}}i()}function nn(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 rn(e,t){let n=t._flight;t._flight=void 0,nn(e,t,n)?.abort()}function an(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=nn(e,a,t);n&&i.push(n)}}for(let e of i)e.abort()}function on(e){for(let t of e){let e=t._flight;e&&e[2]++}}function sn(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 cn(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 ln(e,t,n,r,i,a,o){let s=o[0],c=s.signal;if(c.aborted)return Yt;if(!i)return[Gt,void 0];let l=n._flight;sn(e,n,`loader`,s);try{if(!l){let s=new AbortController;l=[Promise.resolve().then(()=>i(cn(e,t,n,r,s,a,!!o[3]))).then(e=>Qt(e,!1,r.id),e=>Qt(e,!0,r.id)).then(t=>(t[0]!==Gt&&e._flights?.get(n.id)===l&&(e._flights.delete(n.id),l[2]||s.abort()),t[0]===Kt&&l[2]?$t(r,t[1]):t)),s,1],(e._flights??=new Map).set(n.id,l)}return n._flight=l,n.abortController=l[1],_n(e,t,r,await Zt(l[0],c),o)}catch(t){if(t!==c||!c.aborted)throw t;return rn(e,n),Yt}finally{sn(e,n,!1,s)}}function un(e,t,n){t[0]!==Jt&&(e.status=`success`,e.error=void 0,t[0]===Gt?(e.loaderData=t[1],e.invalid=!1,e.updatedAt=Date.now(),e.preload=n):e.invalid=!0)}function dn(e,t,n){let r=e._cache.get(t.id);if(r!==n||e._committed.some(e=>e.id===t.id&&e._flight===t._flight))return;let i={...t,_notFound:void 0,context:{}};i._flight&&i._flight[2]++,e._cache.set(t.id,i),r&&rn(e,r)}function fn(e,t){return t[0]===Kt||t[0]===qt?{...e,status:t[0]===Kt?`error`:`notFound`,error:t[1],_flight:void 0}:e}function pn(e,t,n,r,i,a,o){let s=t[1][n],c=j(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(cn(e,t,s,c,a[0],i,l))),a[0].signal.aborted&&(p=Yt)),!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,rn(e,s),p=en(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,nn(e,s,t)?.abort(),n>=o&&(s.status=`pending`),S?.()}b||(s.isFetching=!1);let w=!p&&x?ln(e,t,s,c,g,i,a).then(t=>(un(s,t,l),t[0]===Gt&&(m&&!a[0].signal.aborted&&dn(e,s,u),n>=o&&(s.status=`pending`)),t)):Promise.resolve(p??[Gt,s.loaderData]),T=(async()=>{try{let e=Ht(c,void 0,C);e&&await Zt(e,a[0].signal)}catch(r){if(!t[1].some((e,t)=>t<=n&&(e.status===`error`||e.status===`notFound`||e._notFound)))return[n,en(e,t,c,r,a)]}let r=await w;x&&r[0]===Gt&&s.status===`pending`&&!a[0].signal.aborted&&(s.status=`success`,S?.())})();if(r.push([n,w,T]),!y)return w.then(e=>fn(s,e));let ee={...s,status:`pending`,preload:!1,_flight:v};s.invalid=!1,s.isFetching=`loader`;let E=ln(e,t,ee,c,g,i,a).then(e=>(s.isFetching=!1,un(ee,e,!1),e));return(t[2]??=[]).push([n,E,T,ee]),E.then(e=>fn(ee,e))}async function mn(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=j(e,t[n]);try{let e=Ht(i,!1);e&&await Zt(e,r)}catch(e){if(e===r&&r.aborted)throw e}if(i.options.notFoundComponent)return n}return a?.routeId?o:i}function hn(e,t){t[2]&&=(an(e,t[2].map(e=>e[3])),void 0)}async function gn(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]>=Jt)throw[a,t];!i&&t[0]!==Gt&&(i=[a,t],await Promise.all((n??[]).map(e=>{if(!(e[0]<=a))return e[1].then(t=>{if(t[0]===Jt)throw[e[0],t]})})))}})))}catch(e){return e}return t??i}function _n(e,t,n,r,i,a){for(;r[0]===Jt;){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]?[Jt,t]:[Jt,t,a]}return[Jt,o,n]}catch(e){r=a?[Kt,e]:$t(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]===qt?mn(e,o,t,r.signal):t[0],d=l<0?o.length:l;if((s?.[1][0]??0)>=Jt)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]!==Gt&&t[0]<Jt&&!(`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)>=Jt){let n=s[1];if(n[0]!==Jt||n[1].options.reloadDocument||n[2])return hn(e,t),n;c=!0,s=[0,[Kt,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===Kt?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=j(e,u);try{await Zt(i?Promise.resolve().then(()=>Ht(m,l===Kt?`errorComponent`:`notFoundComponent`)):Promise.all([Ht(m),Ht(m,`notFoundComponent`)]),r.signal)}catch(n){if(n===r.signal&&r.signal.aborted)return hn(e,t),Yt}i?c&&(r.abort(),await Promise.all([...n.map(e=>e[1]),...n.map(e=>e[2]),...(t[2]??[]).map(e=>e[1])]),hn(e,t),an(e,o),p()):u.status=`success`}return t}async function yn(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=j(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 Zt(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 bn(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 mn(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=pn(e,i,t,u,f,r,l)},m=await tn(e,i,r,c,p,l);if(m){if(r[4]=!0,c=m[0],m[1][0]===qt){let t=await mn(e,n,m,a);m[2]=t,c=Math.min(c,t+1)}else m[1][0]>=Jt&&(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],gn(u,m,i[2]),r[7]);i[2]?.length&&(i[3]=gn(i[2],void 0,void 0,h.then(e=>Xt(e)?0:Ut(n).length,()=>0))),o=await h}catch(t){if(hn(e,i),t===a&&a.aborted)return Yt;throw t}return Xt(o)?o:yn(e,o,a,r[6]===n.length?r[6]:0)}function xn(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=j(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(()=>xn(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 Sn(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 Cn(e,t){let n=e._pending;if(!n)return;clearTimeout(n[3]);let r=n[2]-Date.now();if(!n[4]||r<=0||!Ut(t[3]).some(e=>e.id===n[1]))return;let i;try{await Zt(new Promise(e=>{i=setTimeout(e,r)}),t[0].signal)}catch{}clearTimeout(i)}function wn(e,t){e._committed=t,e.stores.setMatches(t)}function Tn(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=Ut(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=j(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=Et(n);wn(e,n),an(e,[...o.values(),...i].filter(e=>e._flight&&c.get(e.id)!==e),n),Dt(e,i,n,a,l,t)}async function En(e,t){let n=e._tx;for(;n&&n!==t;)t=n,await n[5],n=e._tx}function Dn(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 On(e,t,n,r,i){let a=n.map(e=>({...e}));on(a);for(let t of r)rn(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 an(e,a),t}if(Xt(s))an(e,a),s[0]===Jt&&e._tx===t&&e._committed===n&&await Dn(e,t,s);else if(await yn(e,s,t[0].signal),e._tx!==t||e._committed!==n)an(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),rn(e,n))}wn(e,a),an(e,n,a)}}async function kn(e,t,n,r,i,a){let o=await bn(e,t[2],t[3],[t[0],t[1],e._committed,void 0,i,n,a,r]);if(Xt(o)){let n=o[0]===Jt&&e._tx===t;if((!n||o[1].options.reloadDocument)&&Sn(e,t),an(e,t[3]),t[3]=[],!n)return;if(e._tx!==t){Sn(e,t);return}await Dn(e,t,o);return}let s=o[1];if(e._tx===t&&await Cn(e,t),e._tx!==t){Sn(e,t),an(e,s),hn(e,o);return}let c=t[2],l=wt(c,e.stores.resolvedLocation.get()),u=o[2];await e.startViewTransition(async()=>{if(e._tx===t&&await Cn(e,t),e._tx!==t){Sn(e,t),an(e,s),hn(e,o);return}let n=await e.startTransition(()=>{Sn(e,t),Tn(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&&On(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)):hn(e,o)})}async function An(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=wt(a,r);e.emit({type:`onBeforeNavigate`,...t}),u.signal.aborted||e.emit({type:`onBeforeLoad`,...t})}if(u.signal.aborted){await En(e,n);return}let f=i.href===a.href,p=u,m=e.matchRoutes(a,{_controller:u});on(m);let h=l?c[1](m):void 0;if(h?p=l:l?.abort(),u.signal.aborted){an(e,m),await En(e,n);return}e._preflight=void 0;let g,_=()=>kn(e,y,f,()=>xn(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(()=>En(e,y))];if(e._tx=y,n){for(let t of e.stores.matches.get()){if(e._tx!==y)break;t.isFetching&&sn(e,t,!1)}n[0].abort(),an(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))&&xn(e,y),g?.(_()),await y[5]):(an(e,y[3]),y[3]=[],g?.(),await En(e,y))}async function jn(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}),on(a),o=(e._preloads??=new Map).set(i,a),s=await bn(e,n,a,[i,t,r,!0])}finally{o&&(o=o.delete(i),an(e,a)),i.abort()}if(!Xt(s))return s[1];if(!o||s.length<3)return;n=s[2]}catch(e){he(e)||console.error(e);return}}}var Mn=`Error preloading route! ☝️`,Nn=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=Fe:this.parentRoute||ae();let r=n?Fe:t?.path;r&&r!==`/`&&(r=oe(r));let i=t?.id||r,a=n?Fe:O((this.parentRoute.id===`__root__`?``:this.parentRoute.id)+`/`+(i??``));r===`__root__`&&(r=`/`);let o=a===`__root__`?`/`:r===void 0?this.parentRoute.fullPath:O(this.parentRoute.fullPath+`/`+r);this._path=r,this._id=a,this._fullPath=o,this._to=se(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=>Ie({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.`)}},Pn=class extends Nn{constructor(e){super(e)}},Fn=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),M=o(((e,t)=>{t.exports=Fn()}))(),In=class extends f.Component{constructor(...e){super(...e),this.state={error:0},this.reset=()=>{this.setState({error:0})}}static getDerivedStateFromProps(e,t){let n=e.getResetKey();return t.error&&t.resetKey!==n?{resetKey:n,error:0}:{resetKey:n}}static getDerivedStateFromError(e){return{error:[e]}}componentDidCatch(e,t){this.props.onCatch?.(e,t)}render(){let e=this.state.error;return e?f.createElement(this.props.errorComponent??Ln,{error:e[0],reset:this.reset}):this.props.children}};function Ln({error:e}){let[t,n]=f.useState(!1);return(0,M.jsxs)(`div`,{style:{padding:`.5rem`,maxWidth:`100%`},children:[(0,M.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`.5rem`},children:[(0,M.jsx)(`strong`,{style:{fontSize:`1rem`},children:`Something went wrong!`}),(0,M.jsx)(`button`,{style:{appearance:`none`,fontSize:`.6em`,border:`1px solid currentColor`,padding:`.1rem .2rem`,fontWeight:`bold`,borderRadius:`.25rem`},onClick:()=>n(e=>!e),children:t?`Hide Error`:`Show Error`})]}),(0,M.jsx)(`div`,{style:{height:`.25rem`}}),t?(0,M.jsx)(`div`,{children:(0,M.jsx)(`pre`,{style:{fontSize:`.7em`,border:`1px solid red`,borderRadius:`.25rem`,padding:`.3rem`,color:`red`,overflow:`auto`},children:e?.message?(0,M.jsx)(`code`,{children:e.message}):null})}):null]})}var Rn=()=>!0,zn=()=>!1;function Bn({children:e,fallback:t=null}){return(0,M.jsx)(f.Fragment,{children:Vn()?e:t})}function Vn(e=!0){return f.useSyncExternalStore(Hn,Rn,e?zn:Rn)}function Hn(){return()=>{}}var Un=f.createContext(null);function Wn(e){return f.useContext(Un)}function Gn(e,t){let n=e.stores.location,r=new Set,i,a,o=n=>{Wt(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 Kn=f.createContext(void 0),qn=f.createContext(void 0);function Jn({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 Yn(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 Xn=[],Zn=0,{link:Qn,unlink:$n,propagate:er,checkDirty:tr,shallowPropagate:nr}=Jn({update(e){return e._update()},notify(e){Xn[ir++]=e,e.flags&=-3},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=17,cr(e))}}),rr=0,ir=0,ar,or=0;function sr(e){try{++or,e()}finally{--or||lr()}}function cr(e){let t=e.depsTail,n=t===void 0?e.deps:t.nextDep;for(;n!==void 0;)n=$n(n,e)}function lr(){if(!(or>0)){for(;rr<ir;){let e=Xn[rr];Xn[rr++]=void 0,e.notify()}rr=0,ir=0}}function ur(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 ar!==void 0&&Qn(i,ar,Zn),i._snapshot},subscribe(e){let t=Yn(e),n={current:!1},r=dr(()=>{i.get(),n.current?(ar=void 0,t.next?.(i._snapshot)):n.current=!0});return{unsubscribe:()=>{r.stop()}}},_update(e){let a=ar,o=t?.compare??Object.is;if(n)ar=i,++Zn,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{ar=a,n&&(i.flags&=-5),cr(i)}}};return n?(i.flags=17,i.get=function(){let e=i.flags;if(e&16||e&32&&tr(i.deps,i)){if(i._update()){let e=i.subs;e!==void 0&&nr(e)}}else e&32&&(i.flags=e&-33);return ar!==void 0&&Qn(i,ar,Zn),i._snapshot}):i.set=function(e){if(i._update(e)){let e=i.subs;e!==void 0&&(er(e),nr(e),lr())}},i}function dr(e){let t=()=>{let t=ar;ar=n,++Zn,n.depsTail=void 0,n.flags=6;try{return e()}finally{ar=t,n.flags&=-5,cr(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:6,notify(){let e=this.flags;e&16||e&32&&tr(this.deps,this)?t():this.flags=2},stop(){this.flags=0,this.depsTail=void 0,cr(this)}};return t(),n}var fr=o((e=>{var t=d();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?f:t.useSyncExternalStore})),pr=o(((e,t)=>{t.exports=fr()})),mr=o((e=>{var t=d(),n=pr();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),hr=o(((e,t)=>{t.exports=mr()}))();function gr(e,t){return e===t}function _r(e,t=e=>e,n){let r=n?.compare??gr,i=(0,f.useCallback)(t=>{let{unsubscribe:n}=e.subscribe(t);return n},[e]),a=(0,f.useCallback)(()=>e.get(),[e]);return(0,hr.useSyncExternalStoreWithSelector)(i,a,a,t,r)}var vr={};function yr(e,t){let n=f.useRef();return r=>{let i=e?.select?e.select(r):r;return e?.structuralSharing??t.options.defaultStructuralSharing?n.current=b(n.current,i):i}}function br(e){let t=Wn(),n=f.useContext(e.from?qn:Kn),r=e.from??n,i=t.stores.getMatchStore(r),a=yr(e,t),o=_r(i,e=>e?a(e):vr);if(o!==vr)return o;(e.shouldThrow??!0)&&ae()}function xr(e){return br({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function Sr(e){let{select:t,...n}=e;return br({...n,select:e=>t?t(e.loaderDeps):e.loaderDeps})}function Cr(e){return br({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 wr(e){return br({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function Tr(e){let t=Wn();return f.useCallback(n=>t.navigate({...n,from:n.from??e?.from}),[e?.from,t])}function Er(e){return br({...e,select:t=>e.select?e.select(t.context):t.context})}function Dr(...e){let t=f.useRef(e),n=t.current;return e.forEach((e,t)=>{S(n[t],e,!1,!0)||(n[t]=e)}),t.current}function Or(e,t){e.preloadRoute(t).catch(e=>{console.warn(e),console.warn(Mn)})}function kr(e,t){let n=typeof e==`string`&&E(e);if(n)return t.has(n)?e:null}function Ar(e,t,n,r){let i=le(e.pathname,r),a=le(t.pathname,r);return(n?.exact?i!==a:!i.startsWith(a)||i.length!==a.length&&i[a.length]!==`/`)||(n?.includeSearch??!0)&&!S(e.search,t.search,!n?.exact,n?.explicitUndefined)?!1:!n?.includeHash||e.hash===t.hash}function jr(e,t,n){let r=Wn(),i=f.useRef(null),a=f.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:p,onBlur:m,onFocus:h,onMouseEnter:g,onMouseLeave:_,onTouchStart:v}=e,[y,b,x]=Dr(e.search,e.params,o),S=f.useContext(Kn),C=(r.stores._linkScopes??={})[S]??=Gn(r,S),[w,T,ee]=f.useMemo(()=>{let t=kr(s,r.protocolAllowlist);if(t!==void 0){let n=[t??void 0];return[e,()=>n]}let n={...e},i,a,o,c=()=>{let e=C[0]();if(e!==i){n._fromLocation=e;let t=r.buildLocation(n),o=zr(t,r,u),s=u||o&&!E(o)?Ar(e,t,x,r.basepath):void 0;(!a||a[0]!==o||a[1]!==s)&&(a=[o,s]),i=e}return a};return[n,c,x?.includeHash&&(()=>{let e=c();return e[1]?o??=[e[0],!1]:e})]},[r,C,e.from,e.hash,e.href,s,y,b,e.state,e.mask,e.unsafeRelative,x,u]),[te,ne]=f.useSyncExternalStore(C[1],T,ee||T),D=ne===void 0&&te,re=u||te===void 0,ie=f.useRef(!1),ae=e.reloadDocument||D||re?!1:c??r.options.defaultPreload,O=l??r.options.defaultPreloadDelay??0,oe=f.useCallback(e=>{let t=e?.isIntersecting;t??ae===`intent`?O?i.t??=setTimeout(()=>{i.t=void 0,Or(r,w)},O):Or(r,w):t===!1&&Lr(i)},[r,w,i,ae,O]);f.useEffect(()=>{if(!ae)return;ae===`render`&&!ie.current&&(ie.current=!0,Or(r,w));let e=!0,t;return ae===`viewport`&&i.current&&typeof IntersectionObserver==`function`&&(t=new IntersectionObserver(t=>{e&&oe(t.pop())},{rootMargin:`100px`}),t.observe(i.current)),()=>{e=!1,t?.disconnect(),Lr(i)}},[r,w,ae,oe,i]);let se=Fr(e,n);if(se.ref=t?a:i,D)return se.href=D,se;let ce=t=>{let n=d??t.currentTarget.getAttribute(`target`);!re&&!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)&&!t.defaultPrevented&&(!n||n===`_self`)&&t.button===0&&(t.preventDefault(),Lr(i),r.navigate({...e,_fromLocation:w._fromLocation}))},le=()=>{ae===`intent`&&Or(r,w)},ue=()=>{ae===`intent`&&Lr(i)};return se.onClick=Rr(p,ce),se.onBlur=Rr(m,ue),se.onFocus=Rr(h,oe),se.onMouseEnter=Rr(g,oe),se.onMouseLeave=Rr(_,ue),se.onTouchStart=Rr(v,le),Ir(se,e,ne,te,re,n)}var Mr={},Nr={className:`active`},Pr=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 Fr(e,t){let n={};for(let r in e)Pr.has(r)||r===`type`&&t!==void 0||r===`disabled`&&t===`a`||(n[r]=e[r]);return n}function Ir(e,t,n,r,i,a){let{activeProps:o,inactiveProps:s,className:c,style:l,target:u}=t,d=h(n?o:s,{})??(n?Nr:Mr);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 Lr=e=>{clearTimeout(e.t),e.t=void 0},Rr=(e,t)=>e?n=>n.defaultPrevented||(e(n),n.defaultPrevented||t(n)):t;function zr(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||!ne(i,t.protocolAllowlist))return i}var Br=f.memo(f.forwardRef((e,t)=>{let n=e._asChild||`a`,r=jr(e,t,n),i=typeof e.children==`function`?e.children({isActive:r[`data-status`]===`active`}):e.children;return f.createElement(n,r,i)}),Vr);function Vr(e,t){let n=0;for(let r in t)if(n++,e[r]!==t[r]&&(!Pr.has(r)||!S(e[r],t[r],!1,!0)))return!1;for(let t in e)n--;return n===0}var Hr=class extends Nn{constructor(e){super(e),this.useMatch=e=>br({...e,from:this.id}),this.useRouteContext=e=>Er({...e,from:this.id}),this.useSearch=e=>wr({...e,from:this.id}),this.useParams=e=>Cr({...e,from:this.id}),this.useLoaderDeps=e=>Sr({...e,from:this.id}),this.useLoaderData=e=>xr({...e,from:this.id}),this.useNavigate=()=>Tr({from:this.fullPath}),this.Link=f.forwardRef((e,t)=>(0,M.jsx)(Br,{ref:t,from:this.fullPath,...e}))}};function Ur(e){return new Hr(e)}var Wr=class extends Pn{constructor(e){super(e),this.useMatch=e=>br({...e,from:this.id}),this.useRouteContext=e=>Er({...e,from:this.id}),this.useSearch=e=>wr({...e,from:this.id}),this.useParams=e=>Cr({...e,from:this.id}),this.useLoaderDeps=e=>Sr({...e,from:this.id}),this.useLoaderData=e=>xr({...e,from:this.id}),this.useNavigate=()=>Tr({from:this.fullPath}),this.Link=f.forwardRef((e,t)=>(0,M.jsx)(Br,{ref:t,from:this.fullPath,...e}))}};function Gr(e){return new Wr(e)}function Kr(e){let t=Wn(),n=`not-found-${_r(t.stores.location,e=>e.pathname)}-${_r(t.stores.status)}`;return(0,M.jsx)(In,{getResetKey:()=>n,onCatch:(t,n)=>{if(he(t))e.onCatch?.(t,n);else throw t},errorComponent:({error:t})=>{if(he(t))return e.fallback?.(t);throw t},children:e.children})}function qr(){return(0,M.jsx)(`p`,{children:`Not Found`})}function Jr(e,t,n){return t.options.notFoundComponent?(0,M.jsx)(t.options.notFoundComponent,{...n}):e.options.defaultNotFoundComponent?(0,M.jsx)(e.options.defaultNotFoundComponent,{...n}):(0,M.jsx)(qr,{})}function Yr(e,t){let n=t?.options.pendingComponent??e.options.defaultPendingComponent;return n?(0,M.jsx)(n,{}):null}var Xr=(e,t)=>e[0]===t[0]&&e[1]===t[1],Zr=(e,t,n)=>!t.isRoot||t.options.shellComponent||t.options.wrapInSuspense||n===!1||n===`data-only`||!e.ssr,Qr=f.memo(function({routeId:e}){let t=Wn();return $r(t,_r(t.stores.getMatchStore(e)))});function $r(e,t){let n=e.routesById[t.routeId],r=Yr(e,n),i=n.options.errorComponent??e.options.defaultErrorComponent,a=n.options.onCatch??e.options.defaultOnCatch,o=n.isRoot?n.options.notFoundComponent??e.options.notFoundRoute?.options.component:n.options.notFoundComponent,s=t.ssr===!1||t.ssr===`data-only`,c=Zr(e,n,t.ssr)&&(n.options.wrapInSuspense??r??(n.options.errorComponent?.preload||s)),l=(0,M.jsx)(ei,{match:t});s&&(l=(0,M.jsx)(Bn,{fallback:r,children:l})),o&&(l=(0,M.jsx)(Kr,{fallback:e=>{if(e.routeId??=t.routeId,e.routeId!==t.routeId)throw e;return f.createElement(o,e)},children:l})),i&&(l=(0,M.jsx)(In,{getResetKey:()=>t,errorComponent:i,onCatch:(e,n)=>{if(he(e))throw e.routeId??=t.routeId,e;a?.(e,n)},children:l})),c&&(l=(0,M.jsx)(f.Suspense,{fallback:r,children:l}));let u=n.isRoot&&n.options.shellComponent;return u?(0,M.jsx)(Kn.Provider,{value:t.routeId,children:(0,M.jsxs)(u,{children:[l,null]})}):(0,M.jsxs)(Kn.Provider,{value:t.routeId,children:[l,null]})}var ei=f.memo(function({match:e}){let t=Wn(),n=e.routeId,r=t.routesById[n],i=f.useMemo(()=>{let i=(r.options.remountDeps??t.options.defaultRemountDeps)?.({routeId:n,loaderDeps:e.loaderDeps,params:e._strictParams,search:e._strictSearch});return i?JSON.stringify(i):void 0},[n,e.loaderDeps,e._strictParams,e._strictSearch,r.options.remountDeps,t.options.defaultRemountDeps]),a=f.useMemo(()=>{let e=r.options.component??t.options.defaultComponent;return e?(0,M.jsx)(e,{},i):(0,M.jsx)(ti,{})},[i,r.options.component,t.options.defaultComponent]);if(e.status===`pending`){if(t.ssr&&!Zr(t,r,e.ssr))return a;if(t._tx)throw t._tx[5];return Yr(t,r)}if(e.status===`notFound`)return Jr(t,r,e.error);if(e.status===`error`)throw e.error;return a}),ti=f.memo(function(){let e=Wn(),t=f.useContext(Kn),n,r,i;{let a=e.stores.getMatchStore(t);[n,r]=_r(a,e=>[!!e._notFound,e.error],{compare:Xr}),i=_r(e.stores.ids,e=>e[e.indexOf(t)+1])}if(n)return Jr(e,e.routesById[t],r);if(!i)return null;let a=(0,M.jsx)(Qr,{routeId:i});return t===`__root__`?(0,M.jsx)(f.Suspense,{fallback:Yr(e),children:a}):a});function ni(e,t){let n=e[1];e.length=0,n?.(t)}function ri({t:e}){let t=Wn(),n=t._rendered??=[];return t.startTransition=(r,i)=>new Promise(a=>{ni(n,!1),n.push(i,a),e(t),f.startTransition(r)}),p(()=>{let e=t.history.subscribe(t.load);t.updateLatestLocation();let r=t.latestLocation,i=t.buildLocation({to:r.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});if(se(r.publicHref)!==se(i.publicHref))return t.commitLocation({...i,replace:!0,ignoreBlocker:!0}),e;let a=t.stores.resolvedLocation.get();return a?.href===r.href&&a.state.__TSR_key===r.state.__TSR_key?n.push(t.stores.matches.get(),e=>{e&&t.emit({type:`onRendered`,...wt(a,a)})}):t._tx||t.load({sync:!0}).catch(console.error),e},[t,t.history]),null}function ii(){let e=Wn(),t=e.routesById[Fe],n=Yr(e,t),r=(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(ri,{t:f.useState()[1]}),e.ssr?(0,M.jsx)(ai,{}):(0,M.jsx)(f.Suspense,{fallback:n,children:(0,M.jsx)(ai,{})})]});return e.options.InnerWrap?(0,M.jsx)(e.options.InnerWrap,{children:r}):r}function ai(){let e=Wn(),t=e._rendered,n=_r(e.stores.matches,e=>t[0]??e),r=n[0],i=r?.routeId;p(()=>{t[0]===n&&ni(t,!0)},[t,n]);let a=i?(0,M.jsx)(Qr,{routeId:i}):null;return e.options.disableGlobalCatchBoundary?a:(0,M.jsx)(In,{getResetKey:()=>r,onCatch:void 0,children:a})}var oi=e=>({createMutableStore:ur,createReadonlyStore:ur,batch:sr}),si=e=>new ci(e),ci=class extends Ot{constructor(e){super(e,oi)}};function li({router:e,children:t,...n}){_(n)&&e.update({...e.options,...n,context:{...e.options.context,...n.context}});let r=(0,M.jsx)(Un.Provider,{value:e,children:t});return e.options.Wrap?(0,M.jsx)(e.options.Wrap,{children:r}):r}function ui({router:e,...t}){return(0,M.jsx)(li,{router:e,...t,children:(0,M.jsx)(ii,{})})}var di=o((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,S||(S=!0,te());else{var t=n(l);t!==null&&re(x,t.startTime-e)}}}var S=!1,C=-1,w=5,T=-1;function ee(){return g?!0:!(e.unstable_now()-T<w)}function E(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&ee());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&re(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?te():S=!1}}}var te;if(typeof y==`function`)te=function(){y(E)};else if(typeof MessageChannel<`u`){var ne=new MessageChannel,D=ne.port2;ne.port1.onmessage=E,te=function(){D.postMessage(null)}}else te=function(){_(E,0)};function re(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,re(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,te()))),r},e.unstable_shouldYield=ee,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),fi=o(((e,t)=>{t.exports=di()})),pi=o((e=>{var t=d();function n(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function r(){}var i={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},a=Symbol.for(`react.portal`),o=Symbol.for(`react.recoverable`),s=Symbol.for(`react.optimistic_key`);function c(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:r==null?null:r===s?s:``+r,children:e,containerInfo:t,implementation:n}}var l=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function u(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,e.browser=function(e){return{$$typeof:o,_reason:e}},e.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(n(299));return c(e,t,null,r)},e.flushSync=function(e){var t=l.T,n=i.p;try{if(l.T=null,i.p=2,e)return e()}finally{l.T=t,i.p=n,i.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,i.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&i.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=u(n,t.crossOrigin),a=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?i.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:a,fetchPriority:o}):n===`script`&&i.d.X(e,{crossOrigin:r,integrity:a,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`){if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=u(t.as,t.crossOrigin);i.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0})}}else t??i.d.M(e)}},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=u(n,t.crossOrigin);i.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`){if(t){var n=u(t.as,t.crossOrigin);i.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0})}else i.d.m(e)}},e.requestFormReset=function(e){i.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return l.H.useFormState(e,t,n)},e.useFormStatus=function(){return l.H.useHostTransitionStatus()},e.version=`19.3.0`})),mi=o(((e,t)=>{function n(){if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE==`function`)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=pi()})),hi=o((e=>{var t=fi(),n=d(),r=mi();function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(e){for(var t=e,n=t;n&&!n.alternate;)t=n,t.flags&4098&&(e=t.return),n=t.return;for(;t.return;)t=t.return;return t.tag===3?e:null}function s(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function c(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(o(e)!==e)throw Error(i(188))}function u(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return l(a),e;if(s===r)return l(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,u=a.child;u;){if(u===n){c=!0,n=a,r=s;break}if(u===r){c=!0,r=a,n=s;break}u=u.sibling}if(!c){for(u=s.child;u;){if(u===n){c=!0,n=s,r=a;break}if(u===r){c=!0,r=s,n=a;break}u=u.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function f(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=f(e),t!==null)return t;e=e.sibling}return null}function p(e,t,n,r,i,a){for(;e!==null;){if((e.tag===5||e.tag===27||e.tag===6)&&n(e,r,i,a)||(e.tag!==22||e.memoizedState===null)&&(t||e.tag!==5&&e.tag!==27)&&p(e.child,t,n,r,i,a))return!0;e=e.sibling}return!1}function m(e){for(e=e.return;e!==null;){if(e.tag===3||e.tag===5||e.tag===27)return e;e=e.return}return null}function h(e){var t=!1;for(e=e.return;e!==null&&(e.tag===4&&(t=!0),e.tag!==3&&e.tag!==5&&e.tag!==27);)e=e.return;return t}function g(e){var t=[null,null],n=m(e);return n===null||_(t,e,n.child,{foundSelf:!1}),t}function _(e,t,n,r){for(;n!==null;){if(n===t)r.foundSelf=!0;else if(n.tag===5||n.tag===27||n.tag===6){if(r.foundSelf)return e[1]=n,!0;e[0]=n}else if((n.tag!==22||n.memoizedState===null)&&_(e,t,n.child,r))return!0;n=n.sibling}return!1}function v(e){switch(e.tag){case 5:case 27:case 6:return e.stateNode;case 3:return e.stateNode.containerInfo;default:throw Error(i(559))}}var y=null,b=null;function x(e,t,n){return e===n||e===t&&(y=e,!0)}function S(e,t,n){return e===n?(b=e,!1):e===t&&(b!==null&&(y=e),!0)}function C(e){if(e===null)return null;do e=e===null?null:e.return;while(e&&e.tag!==5&&e.tag!==27&&e.tag!==3);return e||null}function w(e,t,n){for(var r=0,i=e;i;i=n(i))r++;i=0;for(var a=t;a;a=n(a))i++;for(;0<r-i;)e=n(e),r--;for(;0<i-r;)t=n(t),i--;for(;r--;){if(e===t||t!==null&&e===t.alternate)return e;e=n(e),t=n(t)}return null}var T=Object.assign,ee=Symbol.for(`react.element`),E=Symbol.for(`react.transitional.element`),te=Symbol.for(`react.portal`),ne=Symbol.for(`react.fragment`),D=Symbol.for(`react.strict_mode`),re=Symbol.for(`react.profiler`),ie=Symbol.for(`react.consumer`),ae=Symbol.for(`react.context`),O=Symbol.for(`react.forward_ref`),oe=Symbol.for(`react.suspense`),se=Symbol.for(`react.suspense_list`),ce=Symbol.for(`react.memo`),le=Symbol.for(`react.lazy`),ue=Symbol.for(`react.activity`),de=Symbol.for(`react.legacy_hidden`),fe=Symbol.for(`react.memo_cache_sentinel`),pe=Symbol.for(`react.view_transition`),me=Symbol.for(`react.recoverable`),he=Symbol.iterator;function ge(e){return typeof e!=`object`||!e?null:(e=he&&e[he]||e[`@@iterator`],typeof e==`function`?e:null)}var _e=Symbol.for(`react.client.reference`);function ve(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===_e?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case ne:return`Fragment`;case re:return`Profiler`;case D:return`StrictMode`;case oe:return`Suspense`;case se:return`SuspenseList`;case ue:return`Activity`;case pe:return`ViewTransition`}if(typeof e==`object`)switch(e.$$typeof){case te:return`Portal`;case ae:return e.displayName||`Context`;case ie:return(e._context.displayName||`Context`)+`.Consumer`;case O:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case ce:return t=e.displayName||null,t===null?ve(e.type)||`Memo`:t;case le:t=e._payload,e=e._init;try{return ve(e(t))}catch{}}return null}var ye=Array.isArray,k=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,A=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,be={pending:!1,data:null,method:null,action:null},xe=[],Se=-1;function Ce(e){return{current:e}}function we(e){0>Se||(e.current=xe[Se],xe[Se]=null,Se--)}function Te(e,t){Se++,xe[Se]=e.current,e.current=t}var Ee=Ce(null),De=Ce(null),Oe=Ce(null),ke=Ce(null);function Ae(e,t){switch(Te(Oe,t),Te(De,e),Te(Ee,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?vp(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=vp(t),e=yp(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}we(Ee),Te(Ee,e)}function je(){we(Ee),we(De),we(Oe)}function Me(e){var t=e.memoizedState;t!==null&&(ph._currentValue=t.memoizedState,Te(ke,e)),t=Ee.current;var n=yp(t,e.type);t!==n&&(Te(De,e),Te(Ee,n))}function Ne(e){De.current===e&&(we(Ee),we(De)),ke.current===e&&(we(ke),ph._currentValue=be)}var Pe,Fe;function Ie(e){if(Pe===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);Pe=t&&t[1]||``,Fe=-1<e.stack.indexOf(`
|
|
3
|
+
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
|
|
4
|
+
`+Pe+e+Fe}var Le=!1;function Re(e,t){if(!e||Le)return``;Le=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}n=!1;try{var i=Object.getOwnPropertyDescriptor(e.prototype,`props`);Object.defineProperty(e.prototype,"props",{configurable:!0,set:function(){throw Error()}}),n=!0,new e}finally{n&&(i===void 0?delete e.prototype.props:Object.defineProperty(e.prototype,"props",i))}}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
|
|
5
|
+
`),l=s.split(`
|
|
6
|
+
`);for(i=r=0;r<c.length&&!c[r].includes(`DetermineComponentFrameRoot`);)r++;for(;i<l.length&&!l[i].includes(`DetermineComponentFrameRoot`);)i++;if(r===c.length||i===l.length)for(r=c.length-1,i=l.length-1;1<=r&&0<=i&&c[r]!==l[i];)i--;for(;1<=r&&0<=i;r--,i--)if(c[r]!==l[i]){if(r!==1||i!==1)do if(r--,i--,0>i||c[r]!==l[i]){var u=`
|
|
7
|
+
`+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(`<anonymous>`)&&(u=u.replace(`<anonymous>`,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{Le=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?Ie(n):``}function ze(e,t){switch(e.tag){case 26:case 27:case 5:return Ie(e.type);case 16:return Ie(`Lazy`);case 13:return e.child!==t&&t!==null?Ie(`Suspense Fallback`):Ie(`Suspense`);case 19:return Ie(`SuspenseList`);case 0:case 15:return Re(e.type,!1);case 11:return Re(e.type.render,!1);case 1:return Re(e.type,!0);case 31:return Ie(`Activity`);case 30:return Ie(`ViewTransition`);default:return``}}function Be(e){try{var t=``,n=null;do t+=ze(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
|
|
8
|
+
Error generating stack: `+e.message+`
|
|
9
|
+
`+e.stack}}var Ve=Object.prototype.hasOwnProperty,He=t.unstable_scheduleCallback,Ue=t.unstable_cancelCallback,We=t.unstable_shouldYield,Ge=t.unstable_requestPaint,Ke=t.unstable_now,qe=t.unstable_getCurrentPriorityLevel,Je=t.unstable_ImmediatePriority,Ye=t.unstable_UserBlockingPriority,Xe=t.unstable_NormalPriority,Ze=t.unstable_LowPriority,Qe=t.unstable_IdlePriority,$e=t.log,et=t.unstable_setDisableYieldValue,tt=null,nt=null;function rt(e){if(typeof $e==`function`&&et(e),nt&&typeof nt.setStrictMode==`function`)try{nt.setStrictMode(tt,e)}catch{}}var it=Math.clz32?Math.clz32:st,at=Math.log,ot=Math.LN2;function st(e){return e>>>=0,e===0?32:31-(at(e)/ot|0)|0}var ct=256,lt=262144,ut=4194304;function dt(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&-e;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function ft(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=dt(n))):i=dt(o):i=dt(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=dt(n))):i=dt(o)):i=dt(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function pt(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function mt(e,t){t&8&&(t|=t&32);var n=e.entangledLanes;if(n!==0)for(e=e.entanglements,n&=t;0<n;){var r=31-it(n),i=1<<r;t|=e[r],n&=~i}return t}function ht(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function gt(){var e=ut;return ut<<=1,!(ut&62914560)&&(ut=4194304),e}function _t(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function vt(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function yt(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0<n;){var u=31-it(n),d=1<<u;s[u]=0,c[u]=-1;var f=l[u];if(f!==null)for(l[u]=null,u=0;u<f.length;u++){var p=f[u];p!==null&&(p.lane&=-536870913)}n&=~d}r!==0&&bt(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function bt(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-it(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function xt(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-it(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function St(e,t){var n=t&-t;return n=n&42?1:Ct(n),(n&(e.suspendedLanes|t))===0?n:0}function Ct(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function wt(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function Tt(){var e=A.p;return e===0?(e=window.event,e===void 0?32:kh(e.type)):e}function Et(e,t){var n=A.p;try{return A.p=e,t()}finally{A.p=n}}var Dt=Math.random().toString(36).slice(2),Ot=`__reactFiber$`+Dt,kt=`__reactProps$`+Dt,At=`__reactContainer$`+Dt,jt=`__reactEvents$`+Dt,Mt=`__reactListeners$`+Dt,Nt=`__reactHandles$`+Dt,Pt=`__reactResources$`+Dt,Ft=`__reactMarker$`+Dt,It=`__reactLoad$`+Dt;function Lt(e){delete e[Ot],delete e[kt],delete e[Mt],delete e[Nt]}function Rt(e){var t;if(t=e[Ot])return t;for(var n=e.parentNode;n;){if(t=n[At]||n[Ot]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=vm(e);e!==null;){if(n=e[Ot])return n;e=vm(e)}return t}e=n,n=e.parentNode}return null}function zt(e){if(e=e[Ot]||e[At]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function Bt(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(i(33))}function Vt(e){var t=e[Pt];return t||=e[Pt]={hoistableStyles:new Map,hoistableScripts:new Map},t}function Ht(e){e[Ft]=!0}function Ut(e){e[It]=void 0}var Wt=new Set,Gt={};function Kt(e,t){qt(e,t),qt(e+`Capture`,t)}function qt(e,t){for(Gt[e]=t,e=0;e<t.length;e++)Wt.add(t[e])}var Jt=RegExp(`^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$`),Yt={},Xt={};function Zt(e){return Ve.call(Xt,e)?!0:Ve.call(Yt,e)?!1:Jt.test(e)?Xt[e]=!0:(Yt[e]=!0,!1)}var j=!1;function Qt(){var e=j;return j=!1,e}function $t(e,t,n){if(Zt(t)){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:e.removeAttribute(t);return;case`boolean`:var r=t.toLowerCase().slice(0,5);if(r!==`data-`&&r!==`aria-`){e.removeAttribute(t);return}}e.setAttribute(t,n)}}}function en(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(t);return}e.setAttribute(t,n)}}function tn(e,t,n,r){if(r===null)e.removeAttribute(n);else{switch(typeof r){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(n);return}e.setAttributeNS(t,n,r)}}function nn(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function rn(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function an(e,t,n){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&r!==void 0&&typeof r.get==`function`&&typeof r.set==`function`){var i=r.get,a=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){n=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(e){n=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function on(e){if(!e._valueTracker){var t=rn(e)?`checked`:`value`;e._valueTracker=an(e,t,``+e[t])}}function sn(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=rn(e)?e.checked?`true`:`false`:e.value),e=r,e!==n&&(t.setValue(e),!0)}var cn=/[\n"\\]/g;function ln(e){return e.replace(cn,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function un(e,t,n,r,i,a,o,s){e.name=``,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`?e.type=o:e.removeAttribute(`type`),t==null?o!==`submit`&&o!==`reset`||e.removeAttribute(`value`):o===`number`?(t===0&&e.value===``||e.value!=t)&&(e.value=``+nn(t)):e.value!==``+nn(t)&&(e.value=``+nn(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):fn(e,nn(n)):o===`number`&&e.value==t?fn(e,nn(e.value)):fn(e,nn(t)),i==null&&a!=null&&(e.defaultChecked=!!a),i!=null&&(e.checked=i&&typeof i!=`function`&&typeof i!=`symbol`),s!=null&&typeof s!=`function`&&typeof s!=`symbol`&&typeof s!=`boolean`?e.name=``+nn(s):e.removeAttribute(`name`)}function dn(e,t,n,r,i,a,o,s){if(a!=null&&typeof a!=`function`&&typeof a!=`symbol`&&typeof a!=`boolean`&&(e.type=a),t!=null||n!=null){if(!(a!==`submit`&&a!==`reset`||t!=null)){on(e);return}n=n==null?``:``+nn(n),t=t==null?n:``+nn(t),s||t===e.value||(e.value=t),e.defaultValue=t}r??=i,r=typeof r!=`function`&&typeof r!=`symbol`&&!!r,e.checked=s?e.checked:!!r,e.defaultChecked=!!r,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`&&(e.name=o),on(e)}function fn(e,t){e.defaultValue!==``+t&&(e.defaultValue=``+t)}function pn(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t[`$`+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty(`$`+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=``+nn(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function mn(e,t,n){t!=null&&(t=``+nn(t),t!==e.value&&(e.value=t),n==null)?e.defaultValue!==t&&(e.defaultValue=t):e.defaultValue=n==null?``:``+nn(n)}function hn(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(i(92));if(ye(r)){if(1<r.length)throw Error(i(93));r=r[0]}n=r}n??=``,t=n}n=nn(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),on(e)}function gn(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var _n=new Set(`animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp`.split(` `));function vn(e,t,n){var r=t.indexOf(`--`)===0;n==null||typeof n==`boolean`||n===``?r?e.setProperty(t,``):t===`float`?e.cssFloat=``:e[t]=``:r?e.setProperty(t,n):typeof n!=`number`||n===0||_n.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function yn(e,t,n){if(t!=null&&typeof t!=`object`)throw Error(i(62));if(e=e.style,n!=null){for(var r in n)!n.hasOwnProperty(r)||t!=null&&t.hasOwnProperty(r)||(r.indexOf(`--`)===0?e.setProperty(r,``):r===`float`?e.cssFloat=``:e[r]=``,j=!0);for(var a in t)r=t[a],t.hasOwnProperty(a)&&n[a]!==r&&(vn(e,a,r),j=!0)}else for(var o in t)t.hasOwnProperty(o)&&vn(e,o,t[o])}function bn(e){if(e.indexOf(`-`)===-1)return!1;switch(e){case`annotation-xml`:case`color-profile`:case`font-face`:case`font-face-src`:case`font-face-uri`:case`font-face-format`:case`font-face-name`:case`missing-glyph`:return!1;default:return!0}}var xn=new Map([[`acceptCharset`,`accept-charset`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`],[`crossOrigin`,`crossorigin`],[`accentHeight`,`accent-height`],[`alignmentBaseline`,`alignment-baseline`],[`arabicForm`,`arabic-form`],[`baselineShift`,`baseline-shift`],[`capHeight`,`cap-height`],[`clipPath`,`clip-path`],[`clipRule`,`clip-rule`],[`colorInterpolation`,`color-interpolation`],[`colorInterpolationFilters`,`color-interpolation-filters`],[`colorProfile`,`color-profile`],[`colorRendering`,`color-rendering`],[`dominantBaseline`,`dominant-baseline`],[`enableBackground`,`enable-background`],[`fillOpacity`,`fill-opacity`],[`fillRule`,`fill-rule`],[`floodColor`,`flood-color`],[`floodOpacity`,`flood-opacity`],[`fontFamily`,`font-family`],[`fontSize`,`font-size`],[`fontSizeAdjust`,`font-size-adjust`],[`fontStretch`,`font-stretch`],[`fontStyle`,`font-style`],[`fontVariant`,`font-variant`],[`fontWeight`,`font-weight`],[`glyphName`,`glyph-name`],[`glyphOrientationHorizontal`,`glyph-orientation-horizontal`],[`glyphOrientationVertical`,`glyph-orientation-vertical`],[`horizAdvX`,`horiz-adv-x`],[`horizOriginX`,`horiz-origin-x`],[`imageRendering`,`image-rendering`],[`letterSpacing`,`letter-spacing`],[`lightingColor`,`lighting-color`],[`markerEnd`,`marker-end`],[`markerMid`,`marker-mid`],[`markerStart`,`marker-start`],[`maskType`,`mask-type`],[`overlinePosition`,`overline-position`],[`overlineThickness`,`overline-thickness`],[`paintOrder`,`paint-order`],[`panose-1`,`panose-1`],[`pointerEvents`,`pointer-events`],[`renderingIntent`,`rendering-intent`],[`shapeRendering`,`shape-rendering`],[`stopColor`,`stop-color`],[`stopOpacity`,`stop-opacity`],[`strikethroughPosition`,`strikethrough-position`],[`strikethroughThickness`,`strikethrough-thickness`],[`strokeDasharray`,`stroke-dasharray`],[`strokeDashoffset`,`stroke-dashoffset`],[`strokeLinecap`,`stroke-linecap`],[`strokeLinejoin`,`stroke-linejoin`],[`strokeMiterlimit`,`stroke-miterlimit`],[`strokeOpacity`,`stroke-opacity`],[`strokeWidth`,`stroke-width`],[`textAnchor`,`text-anchor`],[`textDecoration`,`text-decoration`],[`textRendering`,`text-rendering`],[`transformOrigin`,`transform-origin`],[`underlinePosition`,`underline-position`],[`underlineThickness`,`underline-thickness`],[`unicodeBidi`,`unicode-bidi`],[`unicodeRange`,`unicode-range`],[`unitsPerEm`,`units-per-em`],[`vAlphabetic`,`v-alphabetic`],[`vHanging`,`v-hanging`],[`vIdeographic`,`v-ideographic`],[`vMathematical`,`v-mathematical`],[`vectorEffect`,`vector-effect`],[`vertAdvY`,`vert-adv-y`],[`vertOriginX`,`vert-origin-x`],[`vertOriginY`,`vert-origin-y`],[`wordSpacing`,`word-spacing`],[`writingMode`,`writing-mode`],[`xmlnsXlink`,`xmlns:xlink`],[`xHeight`,`x-height`]]),Sn=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Cn(e){return Sn.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function wn(){}var Tn=null;function En(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Dn=null,On=null;function kn(e){var t=zt(e);if(t&&(e=t.stateNode)){var n=e[kt]||null;a:switch(e=t.stateNode,t.type){case`input`:if(un(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name="`+ln(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var a=r[kt]||null;if(!a)throw Error(i(90));un(r,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name)}}for(t=0;t<n.length;t++)r=n[t],r.form===e.form&&sn(r)}break a;case`textarea`:mn(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&pn(e,!!n.multiple,t,!1)}}}var An=!1;function jn(e,t,n){if(An)return e(t,n);An=!0;try{return e(t)}finally{if(An=!1,(Dn!==null||On!==null)&&(Kd(),Dn&&(t=Dn,e=On,On=Dn=null,kn(t),e)))for(t=0;t<e.length;t++)kn(e[t])}}function Mn(e,t){var n=e.stateNode;if(n===null)return null;var r=n[kt]||null;if(r===null)return null;n=r[t];a:switch(t){case`onClick`:case`onClickCapture`:case`onDoubleClick`:case`onDoubleClickCapture`:case`onMouseDown`:case`onMouseDownCapture`:case`onMouseMove`:case`onMouseMoveCapture`:case`onMouseUp`:case`onMouseUpCapture`:case`onMouseEnter`:(r=!r.disabled)||(e=e.type,r=e!==`button`&&e!==`input`&&e!==`select`&&e!==`textarea`),e=!r;break a;default:e=!1}if(e)return null;if(n&&typeof n!=`function`)throw Error(i(231,t,typeof n));return n}var Nn=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0,Pn=!1;if(Nn)try{var Fn={};Object.defineProperty(Fn,"passive",{get:function(){Pn=!0}}),window.addEventListener(`test`,Fn,Fn),window.removeEventListener(`test`,Fn,Fn)}catch{Pn=!1}var M=null,In=null,Ln=null;function Rn(){if(Ln)return Ln;var e,t=In,n=t.length,r,i=`value`in M?M.value:M.textContent,a=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===i[a-r];r++);return Ln=i.slice(e,1<r?1-r:void 0)}function zn(e){var t=e.keyCode;return`charCode`in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function Bn(){return!0}function Vn(){return!1}function Hn(e){function t(t,n,r,i,a){for(var o in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=i,this.target=a,this.currentTarget=null,e)e.hasOwnProperty(o)&&(t=e[o],this[o]=t?t(i):i[o]);return this.isDefaultPrevented=(i.defaultPrevented==null?!1===i.returnValue:i.defaultPrevented)?Bn:Vn,this.isPropagationStopped=Vn,this}return T(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():typeof e.returnValue!=`unknown`&&(e.returnValue=!1),this.isDefaultPrevented=Bn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=Bn)},persist:function(){},isPersistent:Bn}),t}var Un={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Wn=Hn(Un),Gn=T({},Un,{view:0,detail:0}),Kn=Hn(Gn),qn,Jn,Yn,Xn=T({},Gn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:sr,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return`movementX`in e?e.movementX:(e!==Yn&&(Yn&&e.type===`mousemove`?(qn=e.screenX-Yn.screenX,Jn=e.screenY-Yn.screenY):Jn=qn=0,Yn=e),qn)},movementY:function(e){return`movementY`in e?e.movementY:Jn}}),Zn=Hn(Xn),Qn=Hn(T({},Xn,{dataTransfer:0})),$n=Hn(T({},Gn,{relatedTarget:0})),er=Hn(T({},Un,{animationName:0,elapsedTime:0,pseudoElement:0})),tr=Hn(T({},Un,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),nr=Hn(T({},Un,{data:0})),rr={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},ir={8:`Backspace`,9:`Tab`,12:`Clear`,13:`Enter`,16:`Shift`,17:`Control`,18:`Alt`,19:`Pause`,20:`CapsLock`,27:`Escape`,32:` `,33:`PageUp`,34:`PageDown`,35:`End`,36:`Home`,37:`ArrowLeft`,38:`ArrowUp`,39:`ArrowRight`,40:`ArrowDown`,45:`Insert`,46:`Delete`,112:`F1`,113:`F2`,114:`F3`,115:`F4`,116:`F5`,117:`F6`,118:`F7`,119:`F8`,120:`F9`,121:`F10`,122:`F11`,123:`F12`,144:`NumLock`,145:`ScrollLock`,224:`Meta`},ar={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function or(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=ar[e])?!!t[e]:!1}function sr(){return or}var cr=Hn(T({},Gn,{key:function(e){if(e.key){var t=rr[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=zn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?ir[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:sr,charCode:function(e){return e.type===`keypress`?zn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?zn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),lr=Hn(T({},Xn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),ur=Hn(T({},Un,{submitter:0})),dr=Hn(T({},Gn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:sr})),fr=Hn(T({},Un,{propertyName:0,elapsedTime:0,pseudoElement:0})),pr=Hn(T({},Xn,{deltaX:function(e){return`deltaX`in e?e.deltaX:`wheelDeltaX`in e?-e.wheelDeltaX:0},deltaY:function(e){return`deltaY`in e?e.deltaY:`wheelDeltaY`in e?-e.wheelDeltaY:`wheelDelta`in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0})),mr=Hn(T({},Un,{newState:0,oldState:0,source:0})),hr=[9,13,27,32],gr=Nn&&`CompositionEvent`in window,_r=null;Nn&&`documentMode`in document&&(_r=document.documentMode);var vr=Nn&&`TextEvent`in window&&!_r,yr=Nn&&(!gr||_r&&8<_r&&11>=_r),br=` `,xr=!1;function Sr(e,t){switch(e){case`keyup`:return hr.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function Cr(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var wr=!1;function Tr(e,t){switch(e){case`compositionend`:return Cr(t);case`keypress`:return t.which===32?(xr=!0,br):null;case`textInput`:return e=t.data,e===br&&xr?null:e;default:return null}}function Er(e,t){if(wr)return e===`compositionend`||!gr&&Sr(e,t)?(e=Rn(),Ln=In=M=null,wr=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case`compositionend`:return yr&&t.locale!==`ko`?null:t.data;default:return null}}var Dr={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Or(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!Dr[e.type]:t===`textarea`}function kr(e,t,n,r){Dn?On?On.push(r):On=[r]:Dn=r,t=rp(t,`onChange`),0<t.length&&(n=new Wn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var Ar=null,jr=null;function Mr(e){Yf(e,0)}function Nr(e){if(sn(Bt(e)))return e}function Pr(e,t){if(e===`change`)return t}var Fr=!1;if(Nn){var Ir;if(Nn){var Lr=`oninput`in document;if(!Lr){var Rr=document.createElement(`div`);Rr.setAttribute(`oninput`,`return;`),Lr=typeof Rr.oninput==`function`}Ir=Lr}else Ir=!1;Fr=Ir&&(!document.documentMode||9<document.documentMode)}function zr(){Ar&&(Ar.detachEvent(`onpropertychange`,Br),jr=Ar=null)}function Br(e){if(e.propertyName===`value`&&Nr(jr)){var t=[];kr(t,jr,e,En(e)),jn(Mr,t)}}function Vr(e,t,n){e===`focusin`?(zr(),Ar=t,jr=n,Ar.attachEvent(`onpropertychange`,Br)):e===`focusout`&&zr()}function Hr(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return Nr(jr)}function Ur(e,t){if(e===`click`)return Nr(t)}function Wr(e,t){if(e===`input`||e===`change`)return Nr(t)}function Gr(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var Kr=typeof Object.is==`function`?Object.is:Gr;function qr(e,t){if(Kr(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!Ve.call(t,i)||!Kr(e[i],t[i]))return!1}return!0}function Jr(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}function Yr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Xr(e,t){var n=Yr(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=Yr(n)}}function Zr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Zr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Qr(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Jr(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=Jr(e.document)}return t}function $r(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}var ei=Nn&&`documentMode`in document&&11>=document.documentMode,ti=null,ni=null,ri=null,ii=!1;function ai(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;ii||ti==null||ti!==Jr(r)||(r=ti,`selectionStart`in r&&$r(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),ri&&qr(ri,r)||(ri=r,r=rp(ni,`onSelect`),0<r.length&&(t=new Wn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=ti)))}function oi(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var si={animationend:oi(`Animation`,`AnimationEnd`),animationiteration:oi(`Animation`,`AnimationIteration`),animationstart:oi(`Animation`,`AnimationStart`),transitionrun:oi(`Transition`,`TransitionRun`),transitionstart:oi(`Transition`,`TransitionStart`),transitioncancel:oi(`Transition`,`TransitionCancel`),transitionend:oi(`Transition`,`TransitionEnd`)},ci={},li={};Nn&&(li=document.createElement(`div`).style,`AnimationEvent`in window||(delete si.animationend.animation,delete si.animationiteration.animation,delete si.animationstart.animation),`TransitionEvent`in window||delete si.transitionend.transition);function ui(e){if(ci[e])return ci[e];if(!si[e])return e;var t=si[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in li)return ci[e]=t[n];return e}var di=ui(`animationend`),pi=ui(`animationiteration`),hi=ui(`animationstart`),gi=ui(`transitionrun`),_i=ui(`transitionstart`),vi=ui(`transitioncancel`),yi=ui(`transitionend`),bi=new Map,xi=`abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error fullscreenChange fullscreenError gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel`.split(` `);xi.push(`scrollEnd`);function Si(e,t){bi.set(e,t),Kt(t,[e])}var Ci=0;function wi(e,t){if(e.name!=null&&e.name!==`auto`)return e.name;if(t.autoName!==null)return t.autoName;e=Dd.identifierPrefix;var n=Ci++;return e=`_`+e+`t_`+n.toString(32)+`_`,t.autoName=e}function Ti(e){if(e==null||typeof e==`string`)return e;var t=null,n=Fd;if(n!==null)for(var r=0;r<n.length;r++){var i=e[n[r]];if(i!=null){if(i===`none`)return`none`;t=t==null?i:t+(` `+i)}}return t??e.default}function Ei(e,t){return e=Ti(e),t=Ti(t),t==null?e===`auto`?null:e:t===`auto`?null:t}var Di=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},Oi=[],ki=0,Ai=0;function ji(){for(var e=ki,t=Ai=ki=0;t<e;){var n=Oi[t];Oi[t++]=null;var r=Oi[t];Oi[t++]=null;var i=Oi[t];Oi[t++]=null;var a=Oi[t];if(Oi[t++]=null,r!==null&&i!==null){var o=r.pending;o===null?i.next=i:(i.next=o.next,o.next=i),r.pending=i}a!==0&&Pi(n,i,a)}}function Mi(e,t,n,r){Oi[ki++]=e,Oi[ki++]=t,Oi[ki++]=n,Oi[ki++]=r,Ai|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function Ni(e,t,n,r){return Mi(e,t,n,r),Fi(e)}function N(e,t){return Mi(e,null,null,t),Fi(e)}function Pi(e,t,n){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n);for(var i=!1,a=e.return;a!==null;)a.childLanes|=n,r=a.alternate,r!==null&&(r.childLanes|=n),a.tag===22&&(e=a.stateNode,e===null||e._visibility&1||(i=!0)),e=a,a=a.return;return e.tag===3?(a=e.stateNode,i&&t!==null&&(i=31-it(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function Fi(e){if(50<Id)throw Id=0,Ld=null,Error(i(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Ii={};function Li(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ri(e,t,n,r){return new Li(e,t,n,r)}function zi(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Bi(e,t){var n=e.alternate;return n===null?(n=Ri(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&1206910976,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function Vi(e,t){e.flags&=1206910978;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function Hi(e,t,n,r,a,o){var s=0;if(r=e,typeof r==`function`)zi(r)&&(s=1);else if(typeof r==`string`)s=$m(e,n,Ee.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(r){case ue:return e=Ri(31,n,t,a),e.elementType=ue,e.lanes=o,e;case ne:return Ui(n.children,a,o,t);case D:s=8,a|=24;break;case re:return e=Ri(12,n,t,a|2),e.elementType=re,e.lanes=o,e;case oe:return e=Ri(13,n,t,a),e.elementType=oe,e.lanes=o,e;case se:return e=Ri(19,n,t,a),e.elementType=se,e.lanes=o,e;case de:case pe:return e=a|32,e=Ri(30,n,t,e),e.elementType=pe,e.lanes=o,e.stateNode={autoName:null,paired:null,clones:null,ref:null},e;default:if(typeof r==`object`&&r)switch(r.$$typeof){case ae:s=10;break a;case ie:s=9;break a;case O:s=11;break a;case ce:s=14;break a;case le:s=16,r=null;break a}s=29,n=Error(i(130,e===null?`null`:typeof e,``)),r=null}return t=Ri(s,n,t,a),t.elementType=e,t.type=r,t.lanes=o,t}function Ui(e,t,n,r){return e=Ri(7,e,r,t),e.lanes=n,e}function Wi(e,t,n){return e=Ri(6,e,null,t),e.lanes=n,e}function Gi(e){var t=Ri(18,null,null,0);return t.stateNode=e,t}function Ki(e,t,n){return t=Ri(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var qi=new WeakMap;function Ji(e,t){if(typeof e==`object`&&e){var n=qi.get(e);return n===void 0?(t={value:e,source:t,stack:Be(t)},qi.set(e,t),t):n}return{value:e,source:t,stack:Be(t)}}var Yi=[],Xi=0,Zi=null,Qi=0,$i=[],P=0,ea=null,ta=1,na=``;function ra(e,t){Yi[Xi++]=Qi,Yi[Xi++]=Zi,Zi=e,Qi=t}function ia(e,t,n){$i[P++]=ta,$i[P++]=na,$i[P++]=ea,ea=e;var r=ta;e=na;var i=32-it(r)-1;r&=~(1<<i),n+=1;var a=32-it(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,ta=1<<32-it(t)+i|n<<i|r,na=a+e}else ta=1<<a|n<<i|r,na=e}function aa(e){e.return!==null&&(ra(e,1),ia(e,1,0))}function oa(e){for(;e===Zi;)Zi=Yi[--Xi],Yi[Xi]=null,Qi=Yi[--Xi],Yi[Xi]=null;for(;e===ea;)ea=$i[--P],$i[P]=null,na=$i[--P],$i[P]=null,ta=$i[--P],$i[P]=null}function sa(e,t){$i[P++]=ta,$i[P++]=na,$i[P++]=ea,ta=t.id,na=t.overflow,ea=e}var F=null,I=null,ca=!1,la=null,L=!1,ua=Error(i(519));function da(e){throw _a(Ji(Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),ua}function fa(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[Ot]=e,t[kt]=r,n){case`dialog`:Xf(`cancel`,t),Xf(`close`,t);break;case`iframe`:case`object`:case`embed`:Xf(`load`,t);break;case`video`:case`audio`:for(n=0;n<qf.length;n++)Xf(qf[n],t);break;case`source`:Xf(`error`,t);break;case`img`:case`image`:case`link`:Xf(`error`,t),Xf(`load`,t);break;case`details`:Xf(`toggle`,t);break;case`input`:Xf(`invalid`,t),dn(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:Xf(`invalid`,t);break;case`textarea`:Xf(`invalid`,t),hn(t,r.value,r.defaultValue,r.children)}n=r.children,typeof n!=`string`&&typeof n!=`number`&&typeof n!=`bigint`||t.textContent===``+n||!0===r.suppressHydrationWarning||lp(t.textContent,n)?(r.popover!=null&&(Xf(`beforetoggle`,t),Xf(`toggle`,t)),r.onScroll!=null&&Xf(`scroll`,t),r.onScrollEnd!=null&&Xf(`scrollend`,t),r.onClick!=null&&(t.onclick=wn),t=!0):t=!1,t||da(e,!0)}function pa(e){for(F=e.return;F;)switch(F.tag){case 5:case 31:case 13:L=!1;return;case 27:case 3:L=!0;return;default:F=F.return}}function ma(e){if(e!==F)return!1;if(!ca)return pa(e),ca=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=n===`form`||n===`button`||xp(e.type,e.memoizedProps)),n=!n),n&&I&&da(e),pa(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));I=_m(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));I=_m(e)}else t===27?(t=I,Ap(e.type)?(e=gm,gm=null,I=e):I=t):I=F?hm(e.stateNode.nextSibling):null;return!0}function ha(){I=F=null,ca=!1}function ga(){var e=la;return e!==null&&(yd===null?yd=e:yd.push.apply(yd,e),la=null),e}function _a(e){la===null?la=[e]:la.push(e)}var va=Ce(null),ya=null,ba=null;function xa(e,t,n){Te(va,t._currentValue),t._currentValue=n}function Sa(e){e._currentValue=va.current,we(va)}function Ca(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function wa(e,t,n,r){var a=e.child;for(a!==null&&(a.return=e);a!==null;){var o=a.dependencies;if(o!==null){var s=a.child;o=o.firstContext;a:for(;o!==null;){var c=o;o=a;for(var l=0;l<t.length;l++)if(c.context===t[l]){o.lanes|=n,c=o.alternate,c!==null&&(c.lanes|=n),Ca(o.return,n,e),r||(s=null);break a}o=c.next}}else if(a.tag===18){if(s=a.return,s===null)throw Error(i(341));s.lanes|=n,o=s.alternate,o!==null&&(o.lanes|=n),Ca(s,n,e),s=null}else a.tag===13&&a.memoizedState!==null&&a.memoizedState.dehydrated===null?(a.lanes|=n,s=a.alternate,s!==null&&(s.lanes|=n),Ca(a.return,n,e),s=a.child,s=s===null?null:s.sibling):s=a.child;if(s!==null)s.return=a;else for(s=a;s!==null;){if(s===e){s=null;break}if(a=s.sibling,a!==null){a.return=s.return,s=a;break}s=s.return}a=s}}function R(e,t,n,r){e=null;for(var a=t,o=!1;a!==null;){if(!o){if(a.flags&524288)o=!0;else if(a.flags&262144)break}if(a.tag===10){var s=a.alternate;if(s===null)throw Error(i(387));if(s=s.memoizedProps,s!==null){var c=a.type;Kr(a.pendingProps.value,s.value)||(e===null?e=[c]:e.push(c))}}else if(a===ke.current){if(s=a.alternate,s===null)throw Error(i(387));s.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(e===null?e=[ph]:e.push(ph))}a=a.return}return e!==null&&wa(t,e,n,r),t.flags|=262144,e!==null}function Ta(e){for(e=e.firstContext;e!==null;){if(!Kr(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function z(e){ya=e,ba=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Ea(e){return B(ya,e)}function Da(e,t){return ya===null&&z(e),B(e,t)}function B(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},ba===null){if(e===null)throw Error(i(308));ba=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else ba=ba.next=t;return n}var Oa=typeof AbortController<`u`?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(t,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(e){return e()})}},ka=t.unstable_scheduleCallback,Aa=t.unstable_NormalPriority,ja={$$typeof:ae,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Ma(){return{controller:new Oa,data:new Map,refCount:0}}function Na(e){e.refCount--,e.refCount===0&&ka(Aa,function(){e.controller.abort()})}function Pa(e,t){if(e.pendingLanes&4194048){var n=e.transitionTypes;for(n===null&&(n=e.transitionTypes=[]),e=0;e<t.length;e++){var r=t[e];n.indexOf(r)===-1&&n.push(r)}}}var Fa=null;function Ia(e){var t=e.transitionTypes;return e.transitionTypes=null,t}var La=null,Ra=0,za=0,Ba=null;function Va(e,t){if(La===null){var n=La=[];Ra=0,za=Hf(),Ba={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return Ra++,t.then(Ha,Ha),t}function Ha(){if(--Ra===0&&(Fa=null,La!==null)){Ba!==null&&(Ba.status=`fulfilled`);var e=La;La=null,za=0,Ba=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function Ua(e,t){var n=[],r={status:`pending`,value:null,reason:null,then:function(e){n.push(e)}};return e.then(function(){r.status=`fulfilled`,r.value=t;for(var e=0;e<n.length;e++)(0,n[e])(t)},function(e){for(r.status=`rejected`,r.reason=e,e=0;e<n.length;e++)(0,n[e])(void 0)}),r}var Wa=k.S;k.S=function(e,t){if(Sd=Ke(),typeof t==`object`&&t&&typeof t.then==`function`&&Va(e,t),Fa!==null)for(var n=Of;n!==null;)Pa(n,Fa),n=n.next;if(n=e.types,n!==null){for(var r=Of;r!==null;)Pa(r,n),r=r.next;if(za!==0){r=Fa,r===null&&(r=Fa=[]);for(var i=0;i<n.length;i++){var a=n[i];r.indexOf(a)===-1&&r.push(a)}}}Wa!==null&&Wa(e,t)};var Ga=Ce(null);function Ka(){var e=Ga.current;return e===null?id.pooledCache:e}function qa(e,t){t===null?Te(Ga,Ga.current):Te(Ga,t.pool)}function Ja(){var e=Ka();return e===null?null:{parent:ja._currentValue,pool:e}}var Ya=Error(i(460)),Xa=Error(i(474)),Za=Error(i(542)),Qa={then:function(){}};function $a(e){return e=e.status,e===`fulfilled`||e===`rejected`}function eo(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(wn,wn),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,io(e),e===void 0&&!(`reason`in t)?Error(i(600)):e;default:if(typeof t.status==`string`)t.then(wn,wn);else{if(e=id,e!==null&&100<e.shellSuspendCounter)throw Error(i(482));e=t,e.status=`pending`,e.then(function(e){if(t.status===`pending`){var n=t;n.status=`fulfilled`,n.value=e}},function(e){if(t.status===`pending`){var n=t;n.status=`rejected`,n.reason=e}})}switch(t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,io(e),e}throw no=t,Ya}}function to(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(no=e,Ya):e}}var no=null;function ro(){if(no===null)throw Error(i(459));var e=no;return no=null,e}function io(e){if(e===Ya||e===Za)throw Error(i(483))}var ao=null,oo=0;function so(e){var t=oo;return oo+=1,ao===null&&(ao=[]),eo(ao,e,t)}function co(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function lo(e,t){throw t.$$typeof===ee?Error(i(525)):(e=Object.prototype.toString.call(t),Error(i(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e)))}function uo(e){function t(t,n){if(e){var r=t.deletions;r===null?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;r!==null;)t(n,r),r=r.sibling;return null}function r(e){for(var t=new Map;e!==null;)e.key===null?t.set(e.index,e):t.set(e.key,e),e=e.sibling;return t}function a(e,t){return e=Bi(e,t),e.index=0,e.sibling=null,e}function o(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=134217730,n):(r=r.index,r<n?(t.flags|=2,n):r)):(t.flags|=1048576,n)}function s(t){return e&&t.alternate===null&&(t.flags|=134217730),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=Wi(n,e.mode,r),t.return=e,t):(t=a(t,n),t.return=e,t)}function l(e,t,n,r){var i=n.type;return i===ne?(e=d(e,t,n.props.children,r,n.key),co(e,n),e):t!==null&&(t.elementType===i||typeof i==`object`&&i&&i.$$typeof===le&&to(i)===t.type)?(t=a(t,n.props),co(t,n),t.return=e,t):(t=Hi(n.type,n.key,n.props,null,e.mode,r),co(t,n),t.return=e,t)}function u(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=Ki(n,e.mode,r),t.return=e,t):(t=a(t,n.children||[]),t.return=e,t)}function d(e,t,n,r,i){return t===null||t.tag!==7?(t=Ui(n,e.mode,r,i),t.return=e,t):(t=a(t,n),t.return=e,t)}function f(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`||typeof t==`bigint`)return t=Wi(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case E:return n=Hi(t.type,t.key,t.props,null,e.mode,n),co(n,t),n.return=e,n;case te:return t=Ki(t,e.mode,n),t.return=e,t;case le:return t=to(t),f(e,t,n)}if(ye(t)||ge(t))return t=Ui(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,so(t),n);if(t.$$typeof===ae)return f(e,Da(e,t),n);lo(e,t)}return null}function p(e,t,n,r){var i=t===null?null:t.key;if(typeof n==`string`&&n!==``||typeof n==`number`||typeof n==`bigint`)return i===null?c(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case E:return n.key===i?l(e,t,n,r):null;case te:return n.key===i?u(e,t,n,r):null;case le:return n=to(n),p(e,t,n,r)}if(ye(n)||ge(n))return i===null?d(e,t,n,r,null):null;if(typeof n.then==`function`)return p(e,t,so(n),r);if(n.$$typeof===ae)return p(e,t,Da(e,n),r);lo(e,n)}return null}function m(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`||typeof r==`bigint`)return e=e.get(n)||null,c(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case E:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case te:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case le:return r=to(r),m(e,t,n,r,i)}if(ye(r)||ge(r))return e=e.get(n)||null,d(t,e,r,i,null);if(typeof r.then==`function`)return m(e,t,n,so(r),i);if(r.$$typeof===ae)return m(e,t,n,Da(t,r),i);lo(t,r)}return null}function h(i,a,s,c){for(var l=null,u=null,d=a,h=a=0,g=null;d!==null&&h<s.length;h++){d.index>h?(g=d,d=null):g=d.sibling;var _=p(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),ca&&ra(i,h),l;if(d===null){for(;h<s.length;h++)d=f(i,s[h],c),d!==null&&(a=o(d,a,h),u===null?l=d:u.sibling=d,u=d);return ca&&ra(i,h),l}for(d=r(d);h<s.length;h++)g=m(d,i,h,s[h],c),g!==null&&(e&&(_=g.alternate,_!==null&&d.delete(_.key===null?h:_.key)),a=o(g,a,h),u===null?l=g:u.sibling=g,u=g);return e&&d.forEach(function(e){return t(i,e)}),ca&&ra(i,h),l}function g(a,s,c,l){if(c==null)throw Error(i(151));for(var u=null,d=null,h=s,g=s=0,_=null,v=c.next();h!==null&&!v.done;g++,v=c.next()){h.index>g?(_=h,h=null):_=h.sibling;var y=p(a,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(a,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(a,h),ca&&ra(a,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return ca&&ra(a,g),u}for(h=r(h);!v.done;g++,v=c.next())v=m(h,a,g,v.value,l),v!==null&&(e&&(_=v.alternate,_!==null&&h.delete(_.key===null?g:_.key)),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(a,e)}),ca&&ra(a,g),u}function _(e,r,o,c){if(typeof o==`object`&&o&&o.type===ne&&o.key===null&&o.props.ref===void 0&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case E:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===ne){if(r.tag===7){n(e,r.sibling),c=a(r,o.props.children),co(c,o),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===le&&to(l)===r.type){n(e,r.sibling),c=a(r,o.props),co(c,o),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}o.type===ne?(c=Ui(o.props.children,e.mode,c,o.key),co(c,o),c.return=e,e=c):(c=Hi(o.type,o.key,o.props,null,e.mode,c),co(c,o),c.return=e,e=c)}return s(e);case te:a:{for(l=o.key;r!==null;){if(r.key===l){if(r.tag===4&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),c=a(r,o.children||[]),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}c=Ki(o,e.mode,c),c.return=e,e=c}return s(e);case le:return o=to(o),_(e,r,o,c)}if(ye(o))return h(e,r,o,c);if(ge(o)){if(l=ge(o),typeof l!=`function`)throw Error(i(150));return o=l.call(o),g(e,r,o,c)}if(typeof o.then==`function`)return _(e,r,so(o),c);if(o.$$typeof===ae)return _(e,r,Da(e,o),c);lo(e,o)}return typeof o==`string`&&o!==``||typeof o==`number`||typeof o==`bigint`?(o=``+o,r!==null&&r.tag===6?(n(e,r.sibling),c=a(r,o),c.return=e,e=c):(n(e,r),c=Wi(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{oo=0;var i=_(e,t,n,r);return ao=null,i}catch(t){if(t===Ya||t===Za)throw t;var a=Ri(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var fo=uo(!0),po=uo(!1),mo=!1;function ho(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function go(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function _o(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function vo(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,rd&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=Fi(e),Pi(e,null,n),t}return Mi(e,r,t,n),Fi(e)}function yo(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,xt(e,n)}}function bo(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n}else e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var xo=!1;function So(){if(xo){var e=Ba;if(e!==null)throw e}}function Co(e,t,n,r){xo=!1;var i=e.updateQueue;mo=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane&-536870913,p=f!==s.lane;if(p?(U&f)===f:(r&f)===f){f!==0&&f===za&&(xo=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var m=e,h=s;f=t;var g=n;switch(h.tag){case 1:if(m=h.payload,typeof m==`function`){d=m.call(g,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=h.payload,f=typeof m==`function`?m.call(g,d,f):m,f==null)break a;d=T({},d,f);break a;case 2:mo=!0}}f=s.callback,f!==null&&(e.flags|=64,p&&(e.flags|=8192),p=i.callbacks,p===null?i.callbacks=[f]:p.push(f))}else p={lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;p=s,s=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),pd|=o,e.lanes=o,e.memoizedState=d}}function wo(e,t){if(typeof e!=`function`)throw Error(i(191,e));e.call(t)}function To(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)wo(n[e],t)}var Eo=Ce(null),Do=Ce(0);function Oo(e,t){e=dd,Te(Do,e),Te(Eo,t),dd=e|t.baseLanes}function ko(){Te(Do,dd),Te(Eo,Eo.current)}function Ao(){dd=Do.current,we(Eo),we(Do)}var jo=Ce(null),Mo=null;function No(e){var t=e.alternate;Te(Ro,Ro.current&1),Te(jo,e),Mo===null&&(t===null||Eo.current!==null||t.memoizedState!==null)&&(Mo=e)}function Po(e){Te(Ro,Ro.current),Te(jo,e),Mo===null&&(Mo=e)}function Fo(e){e.tag===22?(Te(Ro,Ro.current),Te(jo,e),Mo===null&&(Mo=e)):Io()}function Io(){Te(Ro,Ro.current),Te(jo,jo.current)}function Lo(e){we(jo),Mo===e&&(Mo=null),we(Ro)}var Ro=Ce(0);function zo(e,t){Te(jo,jo.current),Te(Ro,t)}function Bo(e){we(Ro),we(jo),Mo===e&&(Mo=null)}function Vo(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||fm(n)||pm(n)))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==`independent`){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Ho=0,V=null,Uo=null,Wo=null,Go=!1,Ko=!1,qo=!1,Jo=0,Yo=0,Xo=null,Zo=0;function Qo(){throw Error(i(321))}function $o(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Kr(e[n],t[n]))return!1;return!0}function es(e,t,n,r,i,a){return Ho=a,V=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,k.H=e===null||e.memoizedState===null?_c:vc,qo=!1,a=n(r,i),qo=!1,Ko&&(a=ns(t,n,r,i)),ts(e),a}function ts(e){k.H=gc;var t=Uo!==null&&Uo.next!==null;if(Ho=0,Wo=Uo=V=null,Go=!1,Yo=0,Xo=null,t)throw Error(i(300));e===null||Fc||(e=e.dependencies,e!==null&&Ta(e)&&(Fc=!0))}function ns(e,t,n,r){V=e;var a=0;do{if(Ko&&(Xo=null),Yo=0,Ko=!1,25<=a)throw Error(i(301));if(a+=1,Wo=Uo=null,e.updateQueue!=null){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}k.H=yc,o=t(n,r)}while(Ko);return o}function rs(){var e=k.H,t=e.useState()[0];return t=typeof t.then==`function`?us(t):t,e=e.useState()[0],(Uo===null?null:Uo.memoizedState)!==e&&(V.flags|=1024),t}function is(){var e=Jo!==0;return Jo=0,e}function as(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function os(e){if(Go){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Go=!1}Ho=0,Wo=Uo=V=null,Ko=!1,Yo=Jo=0,Xo=null}function ss(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Wo===null?V.memoizedState=Wo=e:Wo=Wo.next=e,Wo}function cs(){if(Uo===null){var e=V.alternate;e=e===null?null:e.memoizedState}else e=Uo.next;var t=Wo===null?V.memoizedState:Wo.next;if(t!==null)Wo=t,Uo=e;else{if(e===null)throw V.alternate===null?Error(i(467)):Error(i(310));Uo=e,e={memoizedState:Uo.memoizedState,baseState:Uo.baseState,baseQueue:Uo.baseQueue,queue:Uo.queue,next:null},Wo===null?V.memoizedState=Wo=e:Wo=Wo.next=e}return Wo}function ls(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function us(e){var t=Yo;return Yo+=1,Xo===null&&(Xo=[]),e=eo(Xo,e,t),t=V,(Wo===null?t.memoizedState:Wo.next)===null&&(t=t.alternate,k.H=t===null||t.memoizedState===null?_c:vc),e}function ds(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return us(e);if(e.$$typeof===me)return;if(e.$$typeof===ae)return Ea(e)}throw Error(i(438,String(e)))}function fs(e){var t=null,n=V.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=V.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(e){return e.slice()}),index:0})))}if(t??={data:[],index:0},n===null&&(n=ls(),V.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),r=0;r<e;r++)n[r]=fe;return t.index++,n}function ps(e,t){return typeof t==`function`?t(e):t}function ms(e){return hs(cs(),Uo,e)}function hs(e,t,n){var r=e.queue;if(r===null)throw Error(i(311));r.lastRenderedReducer=n;var a=e.baseQueue,o=r.pending;if(o!==null){if(a!==null){var s=a.next;a.next=o.next,o.next=s}t.baseQueue=a=o,r.pending=null}if(o=e.baseState,a===null)e.memoizedState=o;else{t=a.next;var c=s=null,l=null,u=t,d=!1;do{var f=u.lane&-536870913;if(f===u.lane?(Ho&f)===f:(U&f)===f){var p=u.revertLane;if(p===0)l!==null&&(l=l.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),f===za&&(d=!0);else if((Ho&p)===p){u=u.next,p===za&&(d=!0);continue}else f={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=f,s=o):l=l.next=f,V.lanes|=p,pd|=p;f=u.action,qo&&n(o,f),o=u.hasEagerState?u.eagerState:n(o,f)}else p={lane:f,revertLane:u.revertLane,gesture:u.gesture,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=p,s=o):l=l.next=p,V.lanes|=f,pd|=f;u=u.next}while(u!==null&&u!==t);if(l===null?s=o:l.next=c,!Kr(o,e.memoizedState)&&(Fc=!0,d&&(n=Ba,n!==null)))throw n;e.memoizedState=o,e.baseState=s,e.baseQueue=l,r.lastRenderedState=o}return a===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function gs(e){var t=cs(),n=t.queue;if(n===null)throw Error(i(311));n.lastRenderedReducer=e;var r=n.dispatch,a=n.pending,o=t.memoizedState;if(a!==null){n.pending=null;var s=a=a.next;do o=e(o,s.action),s=s.next;while(s!==a);Kr(o,t.memoizedState)||(Fc=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function _s(e,t,n){var r=V,a=cs(),o=ca;if(o){if(n===void 0)throw Error(i(407));n=n()}else n=t();var s=!Kr((Uo||a).memoizedState,n);if(s&&(a.memoizedState=n,Fc=!0),a=a.queue,Hs(bs.bind(null,r,a,e),[e]),e=a.getSnapshot!==t||s||Wo!==null&&!!(Wo.memoizedState.tag&1),Ls(e?9:8,{destroy:void 0},ys.bind(null,r,a,n,t),null),e){if(r.flags|=2048,id===null)throw Error(i(349));o||Ho&127||vs(r,t,n)}return n}function vs(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=V.updateQueue,t===null?(t=ls(),V.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function ys(e,t,n,r){t.value=n,t.getSnapshot=r,xs(t)&&Ss(e)}function bs(e,t,n){return n(function(){xs(t)&&Ss(e)})}function xs(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Kr(e,n)}catch{return!0}}function Ss(e){var t=N(e,2);t!==null&&Vd(t,e,2)}function Cs(e){var t=ss();if(typeof e==`function`){var n=e;if(e=n(),qo){rt(!0);try{n()}finally{rt(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ps,lastRenderedState:e},t}function ws(e,t,n,r){return e.baseState=n,hs(e,Uo,typeof r==`function`?r:ps)}function Ts(e,t,n,r,a){if(pc(e))throw Error(i(485));if(e=t.action,e!==null){var o={payload:a,action:e,next:null,isTransition:!0,status:`pending`,value:null,reason:null,listeners:[],then:function(e){o.listeners.push(e)}};k.T===null?o.isTransition=!1:n(!0),r(o),n=t.pending,n===null?(o.next=t.pending=o,Es(t,o)):(o.next=n.next,t.pending=n.next=o)}}function Es(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var a=k.T,o={};o.types=a===null?null:a.types,k.T=o;try{var s=n(i,r),c=k.S;c!==null&&c(o,s),Ds(e,t,s)}catch(n){ks(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),k.T=a}}else try{a=n(i,r),Ds(e,t,a)}catch(n){ks(e,t,n)}}function Ds(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){Os(e,t,n)},function(n){return ks(e,t,n)}):Os(e,t,n)}function Os(e,t,n){t.status=`fulfilled`,t.value=n,As(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Es(e,n)))}function ks(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,As(t),t=t.next;while(t!==r)}e.action=null}function As(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function js(e,t){return t}function Ms(e,t){if(ca){var n=id.formState;if(n!==null){a:{var r=V;if(ca){if(I){b:{for(var i=I,a=L;i.nodeType!==8;)if(!a||(i=hm(i.nextSibling),i===null)){i=null;break b}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){I=hm(i.nextSibling),r=i.data===`F!`;break a}}da(r)}r=!1}r&&(t=n[0])}}return n=ss(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:js,lastRenderedState:t},n.queue=r,n=uc.bind(null,V,r),r.dispatch=n,r=Cs(!1),a=fc.bind(null,V,!1,r.queue),r=ss(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=Ts.bind(null,V,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function Ns(e){return Ps(cs(),Uo,e)}function Ps(e,t,n){if(t=hs(e,t,js)[0],e=ms(ps)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=us(t)}catch(e){throw e===Ya?Za:e}else r=t;t=cs();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(V.flags|=2048,Ls(9,{destroy:void 0},Fs.bind(null,i,n),null)),[r,a,e]}function Fs(e,t){e.action=t}function Is(e){var t=cs(),n=Uo;if(n!==null)return Ps(t,n,e);cs(),t=t.memoizedState,n=cs();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function Ls(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=V.updateQueue,t===null&&(t=ls(),V.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function Rs(){return cs().memoizedState}function zs(e,t,n,r){var i=ss();V.flags|=e,i.memoizedState=Ls(1|t,{destroy:void 0},n,r===void 0?null:r)}function Bs(e,t,n,r){var i=cs();r=r===void 0?null:r;var a=i.memoizedState.inst;Uo!==null&&r!==null&&$o(r,Uo.memoizedState.deps)?i.memoizedState=Ls(t,a,n,r):(V.flags|=e,i.memoizedState=Ls(1|t,a,n,r))}function Vs(e,t){zs(8390656,8,e,t)}function Hs(e,t){Bs(2048,8,e,t)}function Us(e){V.flags|=4;var t=V.updateQueue;if(t===null)t=ls(),V.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function Ws(e){var t=cs().memoizedState;return Us({ref:t,nextImpl:e}),function(){if(rd&2)throw Error(i(440));return t.impl.apply(void 0,arguments)}}function Gs(e,t){return Bs(4,2,e,t)}function Ks(e,t){return Bs(4,4,e,t)}function qs(e,t){if(typeof t==`function`){e=e();var n=t(e);return function(){typeof n==`function`?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Js(e,t,n){n=n==null?null:n.concat([e]),Bs(4,4,qs.bind(null,t,e),n)}function Ys(){}function Xs(e,t){var n=cs();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&$o(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function Zs(e,t){var n=cs();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&$o(t,r[1]))return r[0];if(r=e(),qo){rt(!0);try{e()}finally{rt(!1)}}return n.memoizedState=[r,t],r}function Qs(e,t,n){return n===void 0||Ho&1073741824&&!(U&261930)?e.memoizedState=t:(e.memoizedState=n,e=zd(),V.lanes|=e,pd|=e,n)}function $s(e,t,n,r){return Kr(n,t)?n:Eo.current===null?!(Ho&106)||Ho&1073741824&&!(U&261930)?(Fc=!0,e.memoizedState=n):(e=zd(),V.lanes|=e,pd|=e,t):(e=Qs(e,n,r),Kr(e,t)||(Fc=!0),e)}function ec(e,t,n,r,i){var a=A.p;A.p=a!==0&&8>a?a:8;var o=k.T,s={};s.types=o===null?null:o.types,k.T=s,fc(e,!1,t,n);try{var c=i(),l=k.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?dc(e,t,Ua(c,r),Rd(e)):dc(e,t,r,Rd(e))}catch(n){dc(e,t,{then:function(){},status:`rejected`,reason:n},Rd())}finally{A.p=a,o!==null&&s.types!==null&&(o.types=s.types),k.T=o}}function tc(){}function nc(e,t,n,r){if(e.tag!==5)throw Error(i(476));var a=rc(e).queue;ec(e,a,t,be,n===null?tc:function(){return ic(e),n(r)})}function rc(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:be,baseState:be,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ps,lastRenderedState:be},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ps,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function ic(e){var t=rc(e);t.next===null&&(t=e.alternate.memoizedState),dc(e,t.next.queue,{},Rd())}function ac(){return Ea(ph)}function oc(){return cs().memoizedState}function sc(){return cs().memoizedState}function cc(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=Rd();e=_o(n);var r=vo(t,e,n);r!==null&&(Vd(r,t,n),yo(r,t,n)),t={cache:Ma()},e.payload=t;return}t=t.return}}function lc(e,t,n){var r=Rd();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},pc(e)?mc(t,n):(n=Ni(e,t,n,r),n!==null&&(Vd(n,e,r),hc(n,t,r)))}function uc(e,t,n){dc(e,t,n,Rd())}function dc(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(pc(e))mc(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,Kr(s,o))return Mi(e,t,i,0),id===null&&ji(),!1}catch{}if(n=Ni(e,t,i,r),n!==null)return Vd(n,e,r),hc(n,t,r),!0}return!1}function fc(e,t,n,r){if(r={lane:2,revertLane:Hf(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},pc(e)){if(t)throw Error(i(479))}else t=Ni(e,n,r,2),t!==null&&Vd(t,e,2)}function pc(e){var t=e.alternate;return e===V||t!==null&&t===V}function mc(e,t){Ko=Go=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function hc(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,xt(e,n)}}var gc={readContext:Ea,use:ds,useCallback:Qo,useContext:Qo,useEffect:Qo,useImperativeHandle:Qo,useLayoutEffect:Qo,useInsertionEffect:Qo,useMemo:Qo,useReducer:Qo,useRef:Qo,useState:Qo,useDebugValue:Qo,useDeferredValue:Qo,useTransition:Qo,useSyncExternalStore:Qo,useId:Qo,useHostTransitionStatus:Qo,useFormState:Qo,useActionState:Qo,useOptimistic:Qo,useMemoCache:Qo,useCacheRefresh:Qo,useEffectEvent:Qo},_c={readContext:Ea,use:ds,useCallback:function(e,t){return ss().memoizedState=[e,t===void 0?null:t],e},useContext:Ea,useEffect:Vs,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),zs(4194308,4,qs.bind(null,t,e),n)},useLayoutEffect:function(e,t){return zs(4194308,4,e,t)},useInsertionEffect:function(e,t){zs(4,2,e,t)},useMemo:function(e,t){var n=ss();t=t===void 0?null:t;var r=e();if(qo){rt(!0);try{e()}finally{rt(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=ss();if(n!==void 0){var i=n(t);if(qo){rt(!0);try{n(t)}finally{rt(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=lc.bind(null,V,e),[r.memoizedState,e]},useRef:function(e){var t=ss();return e={current:e},t.memoizedState=e},useState:function(e){e=Cs(e);var t=e.queue,n=uc.bind(null,V,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:Ys,useDeferredValue:function(e,t){return Qs(ss(),e,t)},useTransition:function(){var e=Cs(!1);return e=ec.bind(null,V,e.queue,!0,!1),ss().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=V,a=ss();if(ca){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),id===null)throw Error(i(349));U&127||vs(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,Vs(bs.bind(null,r,o,e),[e]),r.flags|=2048,Ls(9,{destroy:void 0},ys.bind(null,r,o,n,t),null),n},useId:function(){var e=ss(),t=id.identifierPrefix;if(ca){var n=na,r=ta;n=(r&~(1<<32-it(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=Jo++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=Zo++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:ac,useFormState:Ms,useActionState:Ms,useOptimistic:function(e){var t=ss();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=fc.bind(null,V,!0,n),n.dispatch=t,[e,t]},useMemoCache:fs,useCacheRefresh:function(){return ss().memoizedState=cc.bind(null,V)},useEffectEvent:function(e){var t=ss(),n={impl:e};return t.memoizedState=n,function(){if(rd&2)throw Error(i(440));return n.impl.apply(void 0,arguments)}}},vc={readContext:Ea,use:ds,useCallback:Xs,useContext:Ea,useEffect:Hs,useImperativeHandle:Js,useInsertionEffect:Gs,useLayoutEffect:Ks,useMemo:Zs,useReducer:ms,useRef:Rs,useState:function(){return ms(ps)},useDebugValue:Ys,useDeferredValue:function(e,t){return $s(cs(),Uo.memoizedState,e,t)},useTransition:function(){var e=ms(ps)[0],t=cs().memoizedState;return[typeof e==`boolean`?e:us(e),t]},useSyncExternalStore:_s,useId:oc,useHostTransitionStatus:ac,useFormState:Ns,useActionState:Ns,useOptimistic:function(e,t){return ws(cs(),Uo,e,t)},useMemoCache:fs,useCacheRefresh:sc,useEffectEvent:Ws},yc={readContext:Ea,use:ds,useCallback:Xs,useContext:Ea,useEffect:Hs,useImperativeHandle:Js,useInsertionEffect:Gs,useLayoutEffect:Ks,useMemo:Zs,useReducer:gs,useRef:Rs,useState:function(){return gs(ps)},useDebugValue:Ys,useDeferredValue:function(e,t){var n=cs();return Uo===null?Qs(n,e,t):$s(n,Uo.memoizedState,e,t)},useTransition:function(){var e=gs(ps)[0],t=cs().memoizedState;return[typeof e==`boolean`?e:us(e),t]},useSyncExternalStore:_s,useId:oc,useHostTransitionStatus:ac,useFormState:Is,useActionState:Is,useOptimistic:function(e,t){var n=cs();return Uo===null?(n.baseState=e,[e,n.queue.dispatch]):ws(n,Uo,e,t)},useMemoCache:fs,useCacheRefresh:sc,useEffectEvent:Ws};function bc(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:T({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var xc={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Rd(),i=_o(r);i.payload=t,n!=null&&(i.callback=n),t=vo(e,i,r),t!==null&&(Vd(t,e,r),yo(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Rd(),i=_o(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=vo(e,i,r),t!==null&&(Vd(t,e,r),yo(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Rd(),r=_o(n);r.tag=2,t!=null&&(r.callback=t),t=vo(e,r,n),t!==null&&(Vd(t,e,n),yo(t,e,n))}};function Sc(e,t,n,r,i,a,o){return e=e.stateNode,typeof e.shouldComponentUpdate==`function`?e.shouldComponentUpdate(r,a,o):t.prototype&&t.prototype.isPureReactComponent?!qr(n,r)||!qr(i,a):!0}function Cc(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps==`function`&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps==`function`&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&xc.enqueueReplaceState(t,t.state,null)}function wc(e,t){var n=t;if(`ref`in t)for(var r in n={},t)r!==`ref`&&(n[r]=t[r]);if(e=e.defaultProps)for(var i in n===t&&(n=T({},n)),e)n[i]===void 0&&(n[i]=e[i]);return n}function Tc(e){Di(e)}function Ec(e){console.error(e)}function Dc(e){Di(e)}function Oc(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function kc(e,t,n){try{var r=e.onCaughtError;r(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(e){setTimeout(function(){throw e})}}function Ac(e,t,n){return n=_o(n),n.tag=3,n.payload={element:null},n.callback=function(){Oc(e,t)},n}function jc(e){return e=_o(e),e.tag=3,e}function Mc(e,t,n,r){var i=n.type.getDerivedStateFromError;if(typeof i==`function`){var a=r.value;e.payload=function(){return i(a)},e.callback=function(){kc(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){kc(t,n,r),typeof i!=`function`&&(Td===null?Td=new Set([this]):Td.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function Nc(e,t,n,r,a){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&R(t,n,a,!0),n=jo.current,n!==null){switch(n.tag){case 31:case 13:case 19:return Mo===null?$d():n.alternate===null&&fd===0&&(fd=3),n.flags&=-257,n.flags|=65536,n.lanes=a,r===Qa?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),Sf(e,r,a)),!1;case 22:return n.flags|=65536,r===Qa?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([r]):n.add(r)),Sf(e,r,a)),!1}throw Error(i(435,n.tag))}return Sf(e,r,a),$d(),!1}if(ca)return t=jo.current,t===null?(r!==ua&&(t=Error(i(423),{cause:r}),_a(Ji(t,n))),e=e.current.alternate,e.flags|=65536,a&=-a,e.lanes|=a,r=Ji(r,n),a=Ac(e.stateNode,r,a),bo(e,a),fd!==4&&(fd=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=a,r!==ua&&(e=Error(i(422),{cause:r}),_a(Ji(e,n)))),!1;var o=Error(i(520),{cause:r});if(o=Ji(o,n),vd===null?vd=[o]:vd.push(o),fd!==4&&(fd=2),t===null)return!0;r=Ji(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=a&-a,n.lanes|=e,e=Ac(n.stateNode,r,e),bo(n,e),!1;case 1:if(t=n.type,o=n.stateNode,!(n.flags&128)&&(typeof t.getDerivedStateFromError==`function`||o!==null&&typeof o.componentDidCatch==`function`&&(Td===null||!Td.has(o))))return n.flags|=65536,a&=-a,n.lanes|=a,a=jc(a),Mc(a,e,n,r),bo(n,a),!1;break;case 22:if(n.memoizedState!==null)return n.flags|=65536,!1}n=n.return}while(n!==null);return!1}var Pc=Error(i(461)),Fc=!1;function Ic(e,t,n,r){t.child=e===null?po(t,null,n,r):fo(t,e.child,n,r)}function Lc(e,t,n,r,i){n=n.render;var a=t.ref;if(`ref`in r){var o={};for(var s in r)s!==`ref`&&(o[s]=r[s])}else o=r;return z(t),r=es(e,t,n,o,a,i),s=is(),e!==null&&!Fc?(as(e,t,i),dl(e,t,i)):(ca&&s&&aa(t),t.flags|=1,Ic(e,t,r,i),t.child)}function Rc(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!zi(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,zc(e,t,a,r,i)):(e=Hi(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!fl(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?qr:n,n(o,r)&&e.ref===t.ref)return dl(e,t,i)}return t.flags|=1,e=Bi(a,r),e.ref=t.ref,e.return=t,t.child=e}function zc(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(qr(a,r)&&e.ref===t.ref){if(Fc=!1,t.pendingProps=r=a,fl(e,i))e.flags&131072&&(Fc=!0);else return t.lanes=e.lanes,dl(e,t,i)}}return qc(e,t,n,r,i)}function Bc(e,t,n,r){var i=r.children,a=e===null?null:e.memoizedState;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode===`hidden`){if(t.flags&128){if(a=a===null?n:a.baseLanes|n,e!==null){for(r=t.child=e.child,i=0;r!==null;)i=i|r.lanes|r.childLanes,r=r.sibling;r=i&~a}else r=0,t.child=null;return Hc(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&qa(t,a===null?null:a.cachePool),a===null?ko():Oo(t,a),Fo(t);else return r=t.lanes=536870912,Hc(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&qa(t,null),ko(),Io()):(qa(t,a.cachePool),Oo(t,a),Io(),t.memoizedState=null);return Ic(e,t,i,n),t.child}function Vc(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Hc(e,t,n,r,i){var a=Ka();return a=a===null?null:{parent:ja._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&qa(t,null),ko(),Fo(t),e!==null&&R(e,t,r,!0),t.childLanes=i,null}function Uc(e,t){return t=nl({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Wc(e,t,n){return fo(t,e.child,null,n),e=Uc(t,t.pendingProps),e.flags|=2,Lo(t),t.memoizedState=null,e}function Gc(e,t,n){var r=t.pendingProps,a=!!(t.flags&128);if(t.flags&=-129,e===null){if(ca){if(r.mode===`hidden`)return e=Uc(t,r),t.lanes=536870912,e.memoizedState={baseLanes:0,cachePool:null},Vc(null,e);if(Po(t),(e=I)?(e=dm(e,L),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:ea===null?null:{id:ta,overflow:na},retryLane:536870912,hydrationErrors:null},n=Gi(e),n.return=t,t.child=n,F=t,I=null)):e=null,e===null)throw da(t);return t.lanes=536870912,null}return Uc(t,r)}var o=e.memoizedState;if(o!==null){var s=o.dehydrated;if(Po(t),a){if(t.flags&256)t.flags&=-257,t=Wc(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(i(558))}else if(Fc||R(e,t,n,!1),a=(n&e.childLanes)!==0,Fc||a){if(Eo.current===null){if(r=id,r!==null&&(s=St(r,n),s!==0&&s!==o.retryLane))throw o.retryLane=s,N(e,s),Vd(r,e,s),Pc;$d()}t=Wc(e,t,n)}else e=o.treeContext,I=hm(s.nextSibling),F=t,ca=!0,la=null,L=!1,e!==null&&sa(t,e),t=Uc(t,r),t.flags|=134221824;return t}return e=Bi(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Kc(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!=`function`&&typeof n!=`object`)throw Error(i(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function qc(e,t,n,r,i){return z(t),n=es(e,t,n,r,void 0,i),r=is(),e!==null&&!Fc?(as(e,t,i),dl(e,t,i)):(ca&&r&&aa(t),t.flags|=1,Ic(e,t,n,i),t.child)}function Jc(e,t,n,r,i,a){return z(t),t.updateQueue=null,n=ns(t,r,n,i),ts(e),r=is(),e!==null&&!Fc?(as(e,t,a),dl(e,t,a)):(ca&&r&&aa(t),t.flags|=1,Ic(e,t,n,a),t.child)}function Yc(e,t,n,r,i){if(z(t),t.stateNode===null){var a=Ii,o=n.contextType;typeof o==`object`&&o&&(a=Ea(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=xc,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},ho(t),o=n.contextType,a.context=typeof o==`object`&&o?Ea(o):Ii,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(bc(t,n,o,r),a.state=t.memoizedState),typeof n.getDerivedStateFromProps==`function`||typeof a.getSnapshotBeforeUpdate==`function`||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(o=a.state,typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount(),o!==a.state&&xc.enqueueReplaceState(a,a.state,null),Co(t,r,a,i),So(),a.state=t.memoizedState),typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!0}else if(e===null){a=t.stateNode;var s=t.memoizedProps,c=wc(n,s);a.props=c;var l=a.context,u=n.contextType;o=Ii,typeof u==`object`&&u&&(o=Ea(u));var d=n.getDerivedStateFromProps;u=typeof d==`function`||typeof a.getSnapshotBeforeUpdate==`function`,s=t.pendingProps!==s,u||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(s||l!==o)&&Cc(t,a,r,o),mo=!1;var f=t.memoizedState;a.state=f,Co(t,r,a,i),So(),l=t.memoizedState,s||f!==l||mo?(typeof d==`function`&&(bc(t,n,d,r),l=t.memoizedState),(c=mo||Sc(t,n,c,r,f,l,o))?(u||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount==`function`&&(t.flags|=4194308)):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),a.props=r,a.state=l,a.context=o,r=c):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,go(e,t),o=t.memoizedProps,u=wc(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=Ii,typeof l==`object`&&l&&(c=Ea(l)),s=n.getDerivedStateFromProps,(l=typeof s==`function`||typeof a.getSnapshotBeforeUpdate==`function`)||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(o!==d||f!==c)&&Cc(t,a,r,c),mo=!1,f=t.memoizedState,a.state=f,Co(t,r,a,i),So();var p=t.memoizedState;o!==d||f!==p||mo||e!==null&&e.dependencies!==null&&Ta(e.dependencies)?(typeof s==`function`&&(bc(t,n,s,r),p=t.memoizedState),(u=mo||Sc(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&Ta(e.dependencies))?(l||typeof a.UNSAFE_componentWillUpdate!=`function`&&typeof a.componentWillUpdate!=`function`||(typeof a.componentWillUpdate==`function`&&a.componentWillUpdate(r,p,c),typeof a.UNSAFE_componentWillUpdate==`function`&&a.UNSAFE_componentWillUpdate(r,p,c)),typeof a.componentDidUpdate==`function`&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),a.props=r,a.state=p,a.context=c,r=u):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return a=r,Kc(e,t),r=!!(t.flags&128),a||r?(a=t.stateNode,n=r&&typeof n.getDerivedStateFromError!=`function`?null:a.render(),t.flags|=1,e!==null&&r?(t.child=fo(t,e.child,null,i),t.child=fo(t,null,n,i)):Ic(e,t,n,i),t.memoizedState=a.state,e=t.child):e=dl(e,t,i),e}function Xc(e,t,n,r){return ha(),t.flags|=256,Ic(e,t,n,r),t.child}var Zc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Qc(e){return{baseLanes:e,cachePool:Ja()}}function $c(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=gd),e}function el(e,t,n){var r=t.pendingProps,i=!1,a=!!(t.flags&128),o;if((o=a)||(o=e!==null&&e.memoizedState===null?!1:!!(Ro.current&2)),o&&(i=!0,t.flags&=-129),o=!!(t.flags&32),t.flags&=-33,e===null){if(ca){if(i?No(t):Io(),(e=I)?(e=dm(e,L),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:ea===null?null:{id:ta,overflow:na},retryLane:536870912,hydrationErrors:null},n=Gi(e),n.return=t,t.child=n,F=t,I=null)):e=null,e===null)throw da(t);return t.lanes=pm(e)?32:536870912,null}return a=r.children,r=r.fallback,i?(Io(),i=t.mode,a=nl({mode:`hidden`,children:a},i),r=Ui(r,i,n,null),a.return=t,r.return=t,a.sibling=r,t.child=a,r=t.child,r.memoizedState=Qc(n),r.childLanes=$c(e,o,n),t.memoizedState=Zc,Vc(null,r)):(No(t),tl(t,a))}var s=e.memoizedState;if(s!==null){var c=s.dehydrated;if(c!==null)return il(e,t,a,o,r,c,s,n)}return i?(Io(),i=r.fallback,a=t.mode,s=e.child,c=s.sibling,r=Bi(s,{mode:`hidden`,children:r.children}),r.subtreeFlags=s.subtreeFlags&1206910976,c===null?(i=Ui(i,a,n,null),i.flags|=2):i=Bi(c,i),i.return=t,r.return=t,r.sibling=i,t.child=r,Vc(null,r),r=t.child,i=e.child.memoizedState,i===null?i=Qc(n):(a=i.cachePool,a===null?a=Ja():(s=ja._currentValue,a=a.parent===s?a:{parent:s,pool:s}),i={baseLanes:i.baseLanes|n,cachePool:a}),r.memoizedState=i,r.childLanes=$c(e,o,n),t.memoizedState=Zc,Vc(e.child,r)):(No(t),n=e.child,e=n.sibling,n=Bi(n,{mode:`visible`,children:r.children}),n.return=t,n.sibling=null,e!==null&&(o=t.deletions,o===null?(t.deletions=[e],t.flags|=16):o.push(e)),t.child=n,t.memoizedState=null,n)}function tl(e,t){return t=nl({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function nl(e,t){return e=Ri(22,e,null,t),e.lanes=0,e}function rl(e,t,n){return fo(t,e.child,null,n),e=tl(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function il(e,t,n,r,a,o,s,c){if(n)return t.flags&256?(No(t),t.flags&=-257,rl(e,t,c)):t.memoizedState===null?(Io(),o=a.fallback,s=t.mode,a=nl({mode:`visible`,children:a.children},s),o=Ui(o,s,c,null),o.flags|=2,a.return=t,o.return=t,a.sibling=o,t.child=a,fo(t,e.child,null,c),a=t.child,a.memoizedState=Qc(c),a.childLanes=$c(e,r,c),t.memoizedState=Zc,Vc(null,a)):(Io(),t.child=e.child,t.flags|=128,null);if(No(t),pm(o)){if(r=o.nextSibling&&o.nextSibling.dataset,r)var l=r.dgst;return r=l,r!==``&&(a=Error(i(419)),a.stack=``,a.digest=r,_a({value:a,source:null,stack:null})),rl(e,t,c)}if(Fc||R(e,t,c,!1),r=(c&e.childLanes)!==0,Fc||r){if(Eo.current!==null)return rl(e,t,c);if(r=id,r!==null&&(a=St(r,c),a!==0&&a!==s.retryLane))throw s.retryLane=a,N(e,a),Vd(r,e,a),Pc;return fm(o)||$d(),rl(e,t,c)}return fm(o)?(t.flags|=192,t.child=e.child,null):(e=s.treeContext,I=hm(o.nextSibling),F=t,ca=!0,la=null,L=!1,e!==null&&sa(t,e),t=tl(t,a.children),t.flags|=134221824,t)}function al(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Ca(e.return,t,n)}function ol(e){for(var t=null;e!==null;){var n=e.alternate;n!==null&&Vo(n)===null&&(t=e),e=e.sibling}return t}function sl(e,t,n,r,i,a){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i,treeForkCount:a}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i,o.treeForkCount=a)}function cl(e){var t=e.child;for(e.child=null;t!==null;){var n=t.sibling;t.sibling=e.child,e.child=t,t=n}}function ll(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=Ro.current;if(t.flags&128)return zo(t,o),null;var s=!!(o&2);if(s?(o=o&1|2,t.flags|=128):o&=1,zo(t,o),i===`backwards`&&e!==null?(cl(e),Ic(e,t,r,n),cl(e)):Ic(e,t,r,n),r=ca?Qi:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&al(e,n,t);else if(e.tag===19)al(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(i){case`backwards`:n=ol(t.child),n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null,cl(t)),sl(t,!0,i,null,a,r);break;case`unstable_legacy-backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&Vo(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}sl(t,!0,n,null,a,r);break;case`together`:sl(t,!1,null,null,void 0,r);break;case`independent`:t.memoizedState=null;break;default:n=ol(t.child),n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),sl(t,!1,i,n,a,r)}return t.child}function ul(e,t,n){var r=t.pendingProps;return xa(t,t.type,r.value),Ic(e,t,r.children,n),t.child}function dl(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),pd|=t.lanes,(n&t.childLanes)===0){if(e!==null){if(R(e,t,n,!1),(n&t.childLanes)===0)return null}else return null}if(e!==null&&t.child!==e.child)throw Error(i(153));if(t.child!==null){for(e=t.child,n=Bi(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Bi(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function fl(e,t){return(e.lanes&t)!==0||(e=e.dependencies,!!(e!==null&&Ta(e)))}function pl(e,t,n){switch(t.tag){case 3:Ae(t,t.stateNode.containerInfo),xa(t,ja,e.memoizedState.cache),ha();break;case 27:case 5:Me(t);break;case 4:Ae(t,t.stateNode.containerInfo);break;case 10:xa(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Po(t),null;break;case 13:var r=t.memoizedState;if(r!==null){if(r.dehydrated!==null)return No(t),t.flags|=128,null;r=R(e,t,n,!1);var i=t.child.childLanes;return r||(n&i)!==0?el(e,t,n):(No(t),e=dl(e,t,n),e===null?null:e.sibling)}No(t);break;case 19:if(t.flags&128)return ll(e,t,n);if(i=!!(e.flags&128),r=(n&t.childLanes)!==0,r||=(R(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return ll(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),zo(t,Ro.current),r)break;return null;case 22:return t.lanes=0,Bc(e,t,n,t.pendingProps);case 24:xa(t,ja,e.memoizedState.cache)}return dl(e,t,n)}function ml(e,t,n){if(e!==null){if(e.memoizedProps!==t.pendingProps)Fc=!0;else{if(!fl(e,n)&&!(t.flags&128))return Fc=!1,pl(e,t,n);Fc=!!(e.flags&131072)}}else Fc=!1,ca&&t.flags&1048576&&ia(t,Qi,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=to(t.elementType),t.type=e,typeof e==`function`)zi(e)?(r=wc(e,r),t.tag=1,t=Yc(null,t,e,r,n)):(t.tag=0,t=qc(null,t,e,r,n));else{if(e!=null){var a=e.$$typeof;if(a===O){t.tag=11,t=Lc(null,t,e,r,n);break a}if(a===ce){t.tag=14,t=Rc(null,t,e,r,n);break a}if(a===ae){t.tag=10,t.type=e,t=ul(null,t,n);break a}}throw t=ve(e)||e,Error(i(306,t,``))}}return t;case 0:return qc(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,a=wc(r,t.pendingProps),Yc(e,t,r,a,n);case 3:a:{if(Ae(t,t.stateNode.containerInfo),e===null)throw Error(i(387));r=t.pendingProps;var o=t.memoizedState;a=o.element,go(e,t),Co(t,r,null,n);var s=t.memoizedState;if(r=s.cache,xa(t,ja,r),r!==o.cache&&wa(t,[ja],n,!0),So(),r=s.element,o.isDehydrated){if(o={element:r,isDehydrated:!1,cache:s.cache},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){t=Xc(e,t,r,n);break a}if(r!==a){a=Ji(Error(i(424)),t),_a(a),t=Xc(e,t,r,n);break a}switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName===`HTML`?e.ownerDocument.body:e}for(I=hm(e.firstChild),F=t,ca=!0,la=null,L=!0,n=po(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|134221824,n=n.sibling}else{if(ha(),r===a){t=dl(e,t,n);break a}Ic(e,t,r,n)}t=t.child}return t;case 26:return Kc(e,t),e===null?(n=zm(t.type,null,t.pendingProps,null))?t.memoizedState=n:ca||(t.stateNode=bp(t.type,t.pendingProps,Oe.current,t)):t.memoizedState=zm(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Me(t),e===null&&ca&&(r=t.stateNode=xm(t.type,t.pendingProps,Oe.current),F=t,L=!0,a=I,Ap(t.type)?(gm=a,I=hm(r.firstChild)):I=a),Ic(e,t,t.pendingProps.children,n),Kc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&ca&&((a=r=I)&&(r=lm(r,t.type,t.pendingProps,L),r===null?a=!1:(t.stateNode=r,F=t,I=hm(r.firstChild),L=!1,a=!0)),a||da(t)),Me(t),a=t.type,o=t.pendingProps,s=e===null?null:e.memoizedProps,r=o.children,xp(a,o)?r=null:s!==null&&xp(a,s)&&(t.flags|=32),t.memoizedState!==null&&(a=es(e,t,rs,null,null,n),ph._currentValue=a),Kc(e,t),Ic(e,t,r,n),t.child;case 6:return e===null&&ca&&((e=n=I)&&(n=um(n,t.pendingProps,L),n===null?e=!1:(t.stateNode=n,F=t,I=null,e=!0)),e||da(t)),null;case 13:return el(e,t,n);case 4:return Ae(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=fo(t,null,r,n):Ic(e,t,r,n),t.child;case 11:return Lc(e,t,t.type,t.pendingProps,n);case 7:return r=t.pendingProps,Kc(e,t),Ic(e,t,r,n),t.child;case 8:return Ic(e,t,t.pendingProps.children,n),t.child;case 12:return Ic(e,t,t.pendingProps.children,n),t.child;case 10:return ul(e,t,n);case 9:return a=t.type._context,r=t.pendingProps.children,z(t),a=Ea(a),r=r(a),t.flags|=1,Ic(e,t,r,n),t.child;case 14:return Rc(e,t,t.type,t.pendingProps,n);case 15:return zc(e,t,t.type,t.pendingProps,n);case 19:return ll(e,t,n);case 31:return Gc(e,t,n);case 22:return Bc(e,t,n,t.pendingProps);case 24:return z(t),r=Ea(ja),e===null?(a=Ka(),a===null&&(a=id,o=Ma(),a.pooledCache=o,o.refCount++,o!==null&&(a.pooledCacheLanes|=n),a=o),t.memoizedState={parent:r,cache:a},ho(t),xa(t,ja,a)):((e.lanes&n)!==0&&(go(e,t),Co(t,null,null,n),So()),a=e.memoizedState,o=t.memoizedState,a.parent===r?(r=o.cache,xa(t,ja,r),r!==a.cache&&wa(t,[ja],n,!0)):(a={parent:r,cache:r},t.memoizedState=a,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=a),xa(t,ja,r))),Ic(e,t,t.pendingProps.children,n),t.child;case 30:return t.stateNode===null&&(t.stateNode={autoName:null,paired:null,clones:null,ref:null}),r=t.pendingProps,r.name!=null&&r.name!==`auto`?t.flags|=e===null?18882560:18874368:ca&&aa(t),e!==null&&e.memoizedProps.name!==r.name?t.flags|=4194816:Kc(e,t),Ic(e,t,r.children,n),t.child;case 29:throw t.pendingProps}throw Error(i(156,t.tag))}function hl(e){e.flags|=4}function gl(e,t,n,r,i){var a;if((a=!!(e.mode&32))&&(a=n===null?eh(t,r):eh(t,r)&&(r.src!==n.src||r.srcSet!==n.srcSet)),a){if(e.flags|=16777216,(i&335544128)===i){if(e.stateNode.complete)e.flags|=8192;else if(Xd())e.flags|=8192;else throw no=Qa,Xa}}else e.flags&=-16777217}function _l(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!th(t)){if(Xd())e.flags|=8192;else throw no=Qa,Xa}}function vl(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:gt(),e.lanes|=t,_d|=t)}function yl(e,t){if(!ca)switch(e.tailMode){case`visible`:break;case`collapsed`:for(var n=e.tail,r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null;break;default:for(t=e.tail,n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null}}function H(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&1206910976,r|=i.flags&1206910976,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function bl(e,t,n){var r=t.pendingProps;switch(oa(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return H(t),null;case 1:return H(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),Sa(ja),je(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(ma(t)?hl(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,ga())),H(t),null;case 26:var a=t.type,o=t.memoizedState;return e===null?(hl(t),o===null?(H(t),gl(t,a,null,r,n)):(H(t),_l(t,o))):o?o===e.memoizedState?(H(t),t.flags&=-16777217):(hl(t),H(t),_l(t,o)):(e=e.memoizedProps,e!==r&&hl(t),H(t),gl(t,a,e,r,n)),null;case 27:if(Ne(t),n=Oe.current,a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&hl(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return H(t),t.subtreeFlags&=-33554433,null}e=Ee.current,ma(t)?fa(t,e):(e=xm(a,r,n),t.stateNode=e,hl(t))}return H(t),t.subtreeFlags&=-33554433,null;case 5:if(Ne(t),a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&hl(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return H(t),t.subtreeFlags&=-33554433,null}if(o=Ee.current,ma(t))fa(t,o);else{var s=_p(Oe.current);switch(o){case 1:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case 2:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;default:switch(a){case`svg`:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case`math`:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;case`script`:o=s.createElement(`div`),o.innerHTML=`<script><\/script>`,o=o.removeChild(o.firstChild);break;case`select`:o=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?o.multiple=!0:r.size&&(o.size=r.size);break;default:o=typeof r.is==`string`?s.createElement(a,{is:r.is}):s.createElement(a)}}o[Ot]=t,o[kt]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)o.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break a;for(;s.sibling===null;){if(s.return===null||s.return===t)break a;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=o;a:switch(W(o,a,r),a){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&hl(t)}}return H(t),t.subtreeFlags&=-33554433,gl(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&hl(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(i(166));if(e=Oe.current,ma(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=F,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[Ot]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||lp(e.nodeValue,n)),e||da(t,!0)}else e=_p(e).createTextNode(r),e[Ot]=t,t.stateNode=e}return H(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=ma(t),n!==null){if(e===null){if(!r)throw Error(i(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(557));e[Ot]=t}else ha(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;H(t),e=!1}else n=ga(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(Lo(t),t):(Lo(t),null);if(t.flags&128)throw Error(i(558))}return H(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=ma(t),r!==null&&r.dehydrated!==null){if(e===null){if(!a)throw Error(i(318));if(a=t.memoizedState,a=a===null?null:a.dehydrated,!a)throw Error(i(317));a[Ot]=t}else ha(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;H(t),a=!1}else a=ga(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(Lo(t),t):(Lo(t),null)}return Lo(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,a=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(a=r.alternate.memoizedState.cachePool.pool),o=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),o!==a&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),vl(t,t.updateQueue),H(t),null);case 4:return je(),e===null&&$f(t.stateNode.containerInfo),t.flags|=67108864,H(t),null;case 10:return Sa(t.type),H(t),null;case 19:if(Bo(t),r=t.memoizedState,r===null)return H(t),null;if(a=!!(t.flags&128),o=r.rendering,o===null){if(a)yl(r,!1);else{if(fd!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=Vo(e),o!==null){for(t.flags|=128,yl(r,!1),e=o.updateQueue,t.updateQueue=e,vl(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)Vi(n,e),n=n.sibling;return zo(t,Ro.current&1|2),ca&&ra(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&Ke()>Cd&&(t.flags|=128,a=!0,yl(r,!1),t.lanes=4194304)}}else{if(!a){if(e=Vo(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,vl(t,e),yl(r,!0),r.tail===null&&r.tailMode!==`collapsed`&&r.tailMode!==`visible`&&!o.alternate&&!ca)return H(t),null}else 2*Ke()-r.renderingStartTime>Cd&&n!==536870912&&(t.flags|=128,a=!0,yl(r,!1),t.lanes=4194304)}r.isBackwards?(o.sibling=t.child,t.child=o):(e=r.last,e===null?t.child=o:e.sibling=o,r.last=o)}if(r.tail!==null){e=r.tail;a:{for(n=e;n!==null;){if(n.alternate!==null){n=!1;break a}n=n.sibling}n=!0}return r.rendering=e,r.tail=e.sibling,r.renderingStartTime=Ke(),e.sibling=null,o=Ro.current,o=a?o&1|2:o&1,r.tailMode===`visible`||r.tailMode===`collapsed`||!n||ca?zo(t,o):(n=o,Te(jo,t),Te(Ro,n),Mo===null&&(Mo=t)),ca&&ra(t,r.treeForkCount),e}return H(t),null;case 22:case 23:return Lo(t),Ao(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(H(t),t.subtreeFlags&6&&(t.flags|=8192)):H(t),n=t.updateQueue,n!==null&&vl(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&we(Ga),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Sa(ja),H(t),null;case 25:return null;case 30:return t.flags|=33554432,H(t),null}throw Error(i(156,t.tag))}function xl(e,t){switch(oa(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Sa(ja),je(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Ne(t),null;case 31:if(t.memoizedState!==null){if(Lo(t),t.alternate===null)throw Error(i(340));ha()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Lo(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));ha()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Bo(t),e=t.flags,e&65536?(t.flags=e&-65537|128,e=t.memoizedState,e!==null&&(e.rendering=null,e.tail=null),t.flags|=4,t):null;case 4:return je(),null;case 10:return Sa(t.type),null;case 22:case 23:return Lo(t),Ao(),e!==null&&we(Ga),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Sa(ja),null;case 25:return null;default:return null}}function Sl(e,t){switch(oa(t),t.tag){case 3:Sa(ja),je();break;case 26:case 27:case 5:Ne(t);break;case 4:je();break;case 31:t.memoizedState!==null&&Lo(t);break;case 13:Lo(t);break;case 19:Bo(t);break;case 10:Sa(t.type);break;case 22:case 23:Lo(t),Ao(),e!==null&&we(Ga);break;case 24:Sa(ja)}}function Cl(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){xf(t,t.return,e)}}function wl(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){xf(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){xf(t,t.return,e)}}function Tl(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{To(t,n)}catch(t){xf(e,e.return,t)}}}function El(e,t,n){n.props=wc(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){xf(e,t,n)}}function Dl(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:var i=e.stateNode,a=wi(e.memoizedProps,i);(i.ref===null||i.ref.name!==a)&&(i.ref=Hp(a)),r=i.ref;break;case 7:if(e.stateNode===null){var o=new Up(e);p(e.child,!1,am,o,void 0,void 0),e.stateNode=o}r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){xf(e,t,n)}}function Ol(e,t){var n=e.ref,r=e.refCleanup;if(n!==null){if(typeof r==`function`)try{r()}catch(n){xf(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){xf(e,t,n)}else n.current=null}}function kl(e,t){if((e.tag===5||e.tag===27||e.tag===6)&&e.alternate===null&&t!==null)for(var n=0;n<t.length;n++)om(e.stateNode,t[n])}function Al(e){for(var t=e.return;t!==null&&(Nl(t)&&om(e.stateNode,t.stateNode),!Ml(t));)t=t.return}function jl(e){for(var t=e.return;t!==null&&(Nl(t)&&sm(e.stateNode,t.stateNode),!Ml(t));)t=t.return}function Ml(e){return e.tag===5||e.tag===3||e.tag===27}function Nl(e){return e&&e.tag===7&&e.stateNode!==null}function Pl(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){xf(e,e.return,t)}}function Fl(e,t,n){try{var r=e.stateNode;pp(r,e.type,n,t),r[kt]=t}catch(t){xf(e,e.return,t)}}function Il(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Ap(e.type)||e.tag===4}function Ll(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Il(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Ap(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Rl(e,t,n,r){var i=e.tag;if(i===5||i===6)i=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(i,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(i),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=wn)),kl(e,r),j=!0;else if(i!==4&&(i===27&&(kl(e,r),r=null,Ap(e.type)&&(n=e.stateNode,t=null)),e=e.child,e!==null))for(Rl(e,t,n,r),e=e.sibling;e!==null;)Rl(e,t,n,r),e=e.sibling}function zl(e,t,n,r){var i=e.tag;if(i===5||i===6)i=e.stateNode,t?n.insertBefore(i,t):n.appendChild(i),kl(e,r),j=!0;else if(i!==4&&(i===27&&(kl(e,r),r=null,Ap(e.type)&&(n=e.stateNode)),e=e.child,e!==null))for(zl(e,t,n,r),e=e.sibling;e!==null;)zl(e,t,n,r),e=e.sibling}function Bl(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);W(t,r,n),t[Ot]=e,t[kt]=n}catch(t){xf(e,e.return,t)}}var Vl=!1,Hl=null;function Ul(e){(e.tag===30||e.subtreeFlags&33554432)&&(Vl=!0)}var Wl=null;function Gl(){var e=Wl;return Wl=null,e}var Kl=0;function ql(e,t,n,r,i){return Kl=0,Jl(e.child,t,n,r,i)}function Jl(e,t,n,r,i){for(var a=!1;e!==null;){if(e.tag===5){var o=e.stateNode;if(r!==null){var s=Ip(o);r.push(s),s.view&&(a=!0)}else a||Ip(o).view&&(a=!0);Vl=!0,Np(o,Kl===0?t:t+`_`+Kl,n),Kl++}else(e.tag!==22||e.memoizedState===null)&&(e.tag===30&&i||Jl(e.child,t,n,r,i)&&(a=!0));e=e.sibling}return a}function Yl(e,t){for(;e!==null;)e.tag===5?Pp(e.stateNode,e.memoizedProps):(e.tag!==22||e.memoizedState===null)&&(e.tag===30&&t||Yl(e.child,t)),e=e.sibling}function Xl(e){if(e.subtreeFlags&18874368)for(e=e.child;e!==null;){if((e.tag!==22||e.memoizedState===null)&&(Xl(e),e.tag===30&&e.flags&18874368&&e.stateNode.paired)){var t=e.memoizedProps;if(t.name==null||t.name===`auto`)throw Error(i(544));var n=t.name;t=Ei(t.default,t.share),t!==`none`&&(ql(e,n,t,null,!1)||Yl(e.child,!1))}e=e.sibling}}function Zl(e,t){if(e.tag===30){var n=e.stateNode,r=e.memoizedProps,i=wi(r,n),a=Ei(r.default,n.paired?r.share:r.enter);a===`none`?Xl(e):ql(e,i,a,null,!1)?(Xl(e),n.paired||t||Bd(e,r.onEnter)):Yl(e.child,!1)}else if(e.subtreeFlags&33554432)for(e=e.child;e!==null;)Zl(e,t),e=e.sibling;else Xl(e)}function Ql(e){if(Hl!==null&&Hl.size!==0){var t=Hl;if(e.subtreeFlags&18874368)for(e=e.child;e!==null;){if(e.tag!==22||e.memoizedState===null){if(e.tag===30&&e.flags&18874368){var n=e.memoizedProps,r=n.name;if(r!=null&&r!==`auto`){var i=t.get(r);if(i!==void 0){var a=Ei(n.default,n.share);if(a!==`none`&&(ql(e,r,a,null,!1)?(a=e.stateNode,i.paired=a,a.paired=i,Bd(e,n.onShare)):Yl(e.child,!1)),t.delete(r),t.size===0)break}}}Ql(e)}e=e.sibling}}}function $l(e){if(e.tag===30){var t=e.memoizedProps,n=wi(t,e.stateNode),r=Hl===null?void 0:Hl.get(n),i=Ei(t.default,r===void 0?t.exit:t.share);i!==`none`&&(ql(e,n,i,null,!1)?r===void 0?Bd(e,t.onExit):(i=e.stateNode,r.paired=i,i.paired=r,Hl.delete(n),Bd(e,t.onShare)):Yl(e.child,!1)),Hl!==null&&Ql(e)}else if(e.subtreeFlags&33554432)for(e=e.child;e!==null;)$l(e),e=e.sibling;else Hl!==null&&Ql(e)}function eu(e){for(e=e.child;e!==null;){if(e.tag===30){var t=e.memoizedProps,n=wi(t,e.stateNode);t=Ei(t.default,t.update),e.flags&=-5,t!==`none`&&ql(e,n,t,e.memoizedState=[],!1)}else e.subtreeFlags&33554432&&eu(e);e=e.sibling}}function tu(e){if(e.subtreeFlags&18874368)for(e=e.child;e!==null;){if(e.tag!==22||e.memoizedState===null){if(e.tag===30&&e.flags&18874368){var t=e.stateNode;t.paired!==null&&(t.paired=null,Yl(e.child,!1))}tu(e)}e=e.sibling}}function nu(e){if(e.tag===30)e.stateNode.paired=null,Yl(e.child,!1),tu(e);else if(e.subtreeFlags&33554432)for(e=e.child;e!==null;)nu(e),e=e.sibling;else tu(e)}function ru(e){for(e=e.child;e!==null;)e.tag===30?Yl(e.child,!1):e.subtreeFlags&33554432&&ru(e),e=e.sibling}function iu(e,t,n,r,i,a,o){for(var s=!1;t!==null;){if(t.tag===5){var c=t.stateNode;if(a!==null&&Kl<a.length){var l=a[Kl],u=Ip(c);(l.view||u.view)&&(s=!0);var d;if(d=!(e.flags&4)){if(u.clip)d=!0;else{d=l.rect;var f=u.rect;d=d.y!==f.y||d.x!==f.x||d.height!==f.height||d.width!==f.width}}d&&(e.flags|=4),u.abs?u=!l.abs:(l=l.rect,u=u.rect,u=l.height!==u.height||l.width!==u.width),u&&(e.flags|=32)}else e.flags|=32;e.flags&4&&Np(c,Kl===0?n:n+`_`+Kl,i),s&&e.flags&4||(Wl===null&&(Wl=[]),Wl.push(c,Kl===0?r:r+`_`+Kl,t.memoizedProps)),Kl++}else(t.tag!==22||t.memoizedState===null)&&(t.tag===30&&o?e.flags|=t.flags&32:iu(e,t.child,n,r,i,a,o)&&(s=!0));t=t.sibling}return s}function au(e,t){for(e=e.child;e!==null;){if(e.tag===30){var n=e.memoizedProps,r=e.stateNode,i=wi(n,r),a=Ei(n.default,n.update);if(t){r=r.clones;var o=r===null?null:r.map(Lp)}else o=e.memoizedState,e.memoizedState=null;r=e;var s=e.child;Kl=0,i=iu(r,s,i,i,a,o,!1),e.flags&4&&i&&(t||Bd(e,n.onUpdate))}else e.subtreeFlags&33554432&&au(e,t);e=e.sibling}}var ou=!1,su=!1,cu=!1,lu=!1,uu=typeof WeakSet==`function`?WeakSet:Set,du=null,fu=!1,pu=!1,mu=!1,hu=!1;function gu(e,t,n){if(e=e.containerInfo,G=Sh,e=Qr(e),$r(e)){if(`selectionStart`in e)var r={start:e.selectionStart,end:e.selectionEnd};else a:{r=(r=e.ownerDocument)&&r.defaultView||window;var i=r.getSelection&&r.getSelection();if(i&&i.rangeCount!==0){r=i.anchorNode;var a=i.anchorOffset,o=i.focusNode;i=i.focusOffset;try{r.nodeType,o.nodeType}catch{r=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==r||a!==0&&f.nodeType!==3||(c=s+a),f!==o||i!==0&&f.nodeType!==3||(l=s+i),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===r&&++u===a&&(c=s),p===o&&++d===i&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}r=c===-1||l===-1?null:{start:c,end:l}}else r=null}r||={start:0,end:0}}else r=null;for(gp={focusedElem:e,selectionRange:r},Sh=!1,n=(n&335544064)===n,du=t,t=n?9270:1024;du!==null;){if(e=du,n&&(r=e.deletions,r!==null))for(a=0;a<r.length;a++)n&&$l(r[a]);if(e.alternate===null&&e.flags&2)n&&Ul(e),_u(n);else{if(e.tag===22){if(r=e.alternate,e.memoizedState!==null){r!==null&&r.memoizedState===null&&n&&$l(r),_u(n);continue}if(r!==null&&r.memoizedState!==null){n&&Ul(e),_u(n);continue}}r=e.child,(e.subtreeFlags&t)!==0&&r!==null?(r.return=e,du=r):(n&&eu(e),_u(n))}}Hl=null}function _u(e){for(;du!==null;){var t=du,n=e,r=t.alternate,a=t.flags;switch(t.tag){case 0:case 11:case 15:break;case 1:if(a&1024&&r!==null){n=void 0,a=r.memoizedProps,r=r.memoizedState;var o=t.stateNode;try{var s=wc(t.type,a);n=o.getSnapshotBeforeUpdate(s,r),o.__reactInternalSnapshotBeforeUpdate=n}catch(e){xf(t,t.return,e)}}break;case 3:if(a&1024){if(r=t.stateNode.containerInfo,n=r.nodeType,n===9)cm(r);else if(n===1)switch(r.nodeName){case`HEAD`:case`HTML`:case`BODY`:cm(r);break;default:r.textContent=``}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;case 30:n&&r!==null&&(n=wi(r.memoizedProps,r.stateNode),a=t.memoizedProps,a=Ei(a.default,a.update),a!==`none`&&ql(r,n,a,r.memoizedState=[],!0));break;default:if(a&1024)throw Error(i(163))}if(r=t.sibling,r!==null){r.return=t.return,du=r;break}du=t.return}}function vu(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:Ru(e,n),r&4&&Cl(5,n);break;case 1:if(Ru(e,n),r&4){if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){xf(n,n.return,e)}else{var i=wc(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){xf(n,n.return,e)}}}r&64&&Tl(n),r&512&&Dl(n,n.return);break;case 3:if(Ru(e,n),r&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{To(e,t)}catch(e){xf(n,n.return,e)}}break;case 27:t===null&&r&4&&Bl(n);case 26:case 5:Ru(e,n),t===null&&r&4&&Pl(n),r&512&&Dl(n,n.return);break;case 12:Ru(e,n);break;case 31:Ru(e,n),r&4&&Du(e,n);break;case 13:Ru(e,n),r&4&&Ou(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=Tf.bind(null,n),mm(e,n))));break;case 22:if(r=n.memoizedState!==null||ou,!r){var a=t!==null&&t.memoizedState!==null||su;t=ou,i=su,ou=r,(su=a)&&!i?(r=2,n.subtreeFlags&8772&&(r|=1),Bu(e,n,r)):Ru(e,n),ou=t,su=i}break;case 30:Ru(e,n),r&512&&Dl(n,n.return);break;case 7:r&512&&Dl(n,n.return);default:Ru(e,n)}}function yu(e,t){for(e=e.child;e!==null;)bu(e,t),e=e.sibling}function bu(e,t){switch(e.tag){case 5:case 26:try{var n=e.stateNode;if(t){var r=n.style;typeof r.setProperty==`function`?r.setProperty(`display`,`none`,`important`):r.display=`none`}else{var i=e.stateNode,a=e.memoizedProps.style,o=a!=null&&a.hasOwnProperty(`display`)?a.display:null;i.style.display=o==null||typeof o==`boolean`?``:(``+o).trim()}}catch(t){xf(e,e.return,t)}xu(e,t);break;case 6:try{e.stateNode.nodeValue=t?``:e.memoizedProps,j=!0}catch(t){xf(e,e.return,t)}break;case 18:try{var s=e.stateNode;t?Mp(s,!0):Mp(e.stateNode,!1)}catch(t){xf(e,e.return,t)}break;case 22:case 23:e.memoizedState===null&&yu(e,t);break;default:yu(e,t)}}function xu(e,t){if(e.subtreeFlags&67108864)for(e=e.child;e!==null;){a:{var n=e,r=t;switch(n.tag){case 4:bu(n,r);break a;case 22:n.memoizedState===null&&xu(n,r);break a;default:xu(n,r)}}e=e.sibling}}function Su(e){var t=e.alternate;t!==null&&(e.alternate=null,Su(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Lt(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var Cu=null,wu=!1;function Tu(e,t,n){for(n=n.child;n!==null;)Eu(e,t,n),n=n.sibling}function Eu(e,t,n){if(nt&&typeof nt.onCommitFiberUnmount==`function`)try{nt.onCommitFiberUnmount(tt,n)}catch{}switch(n.tag){case 26:su||Ol(n,t),Tu(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&!su&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:su||Ol(n,t),jl(n);var r=Cu,i=wu;Ap(n.type)&&(Cu=n.stateNode,wu=!1),Tu(e,t,n),Sm(n.stateNode,n.type,n.memoizedProps),Cu=r,wu=i;break;case 5:su||Ol(n,t),jl(n);case 6:if(n.tag===6&&jl(n),r=Cu,i=wu,Cu=null,Tu(e,t,n),Cu=r,wu=i,Cu!==null){if(wu)try{(Cu.nodeType===9?Cu.body:Cu.nodeName===`HTML`?Cu.ownerDocument.body:Cu).removeChild(n.stateNode),j=!0}catch(e){xf(n,t,e)}else try{Cu.removeChild(n.stateNode),j=!0}catch(e){xf(n,t,e)}}break;case 18:Cu!==null&&(wu?(e=Cu,jp(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),Jh(e)):jp(Cu,n.stateNode));break;case 4:r=Cu,i=wu,Cu=n.stateNode.containerInfo,wu=!0,Tu(e,t,n),Cu=r,wu=i;break;case 0:case 11:case 14:case 15:wl(2,n,t),su||wl(4,n,t),Tu(e,t,n);break;case 1:su||(Ol(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&El(n,t,r)),Tu(e,t,n);break;case 21:Tu(e,t,n);break;case 22:su=(r=su)||n.memoizedState!==null,Tu(e,t,n),su=r;break;case 30:Ol(n,t),Tu(e,t,n);break;case 7:su||Ol(n,t),Tu(e,t,n);break;default:Tu(e,t,n)}}function Du(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Jh(e)}catch(e){xf(t,t.return,e)}}}function Ou(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Jh(e)}catch(e){xf(t,t.return,e)}}function ku(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new uu),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new uu),t;default:throw Error(i(435,e.tag))}}function Au(e,t){var n=ku(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=Ef.bind(null,e,t);t.then(r,r)}})}function ju(e,t,n){var r=t.deletions;if(r!==null)for(var a=0;a<r.length;a++){var o=r[a],s=e,c=t,l=c;a:for(;l!==null;){switch(l.tag){case 27:if(Ap(l.type)){Cu=l.stateNode,wu=!1;break a}break;case 5:Cu=l.stateNode,wu=!1;break a;case 3:case 4:Cu=l.stateNode.containerInfo,wu=!0;break a}l=l.return}if(Cu===null)throw Error(i(160));Eu(s,c,o),Cu=null,wu=!1,s=o.alternate,s!==null&&(s.return=null),o.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Nu(t,e,n),t=t.sibling}var Mu=null;function Nu(e,t,n){var r=e.alternate,a=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(a&4&&(r=e.updateQueue,r=r===null?null:r.events,r!==null))for(var o=0;o<r.length;o++){var s=r[o];s.ref.impl=s.nextImpl}ju(t,e,n),Pu(e),a&4&&(wl(3,e,e.return),Cl(3,e),wl(5,e,e.return));break;case 1:ju(t,e,n),Pu(e),a&512&&(su||r===null||Ol(r,r.return)),a&64&&ou&&(e=e.updateQueue,e!==null&&(t=e.callbacks,t!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?t:n.concat(t))));break;case 26:if(o=Mu,ju(t,e,n),Pu(e),a&512&&(su||r===null||Ol(r,r.return)),a&4){if(a=r===null?null:r.memoizedState,n=e.memoizedState,r===null){if(n===null){if(e.stateNode===null){if(ou)e.stateNode=bp(e.type,e.memoizedProps,t.containerInfo,e);else{a:{t=e.type,n=e.memoizedProps,a=o.ownerDocument||o;b:switch(t){case`title`:r=a.getElementsByTagName(`title`)[0],(!r||r[Ft]||r[Ot]||r.namespaceURI===`http://www.w3.org/2000/svg`||r.hasAttribute(`itemprop`))&&(r=a.createElement(t),a.head.insertBefore(r,a.querySelector(`head > title`))),W(r,t,n),r[Ot]=e,Ht(r),t=r;break a;case`link`:if(o=Zm(`link`,`href`,a).get(t+(n.href||``))){for(s=0;s<o.length;s++)if(r=o[s],r.getAttribute(`href`)===(n.href==null||n.href===``?null:n.href)&&r.getAttribute(`rel`)===(n.rel==null?null:n.rel)&&r.getAttribute(`title`)===(n.title==null?null:n.title)&&r.getAttribute(`crossorigin`)===(n.crossOrigin==null?null:n.crossOrigin)){o.splice(s,1);break b}}r=a.createElement(t),W(r,t,n),a.head.appendChild(r);break;case`meta`:if(o=Zm(`meta`,`content`,a).get(t+(n.content||``))){for(s=0;s<o.length;s++)if(r=o[s],r.getAttribute(`content`)===(n.content==null?null:``+n.content)&&r.getAttribute(`name`)===(n.name==null?null:n.name)&&r.getAttribute(`property`)===(n.property==null?null:n.property)&&r.getAttribute(`http-equiv`)===(n.httpEquiv==null?null:n.httpEquiv)&&r.getAttribute(`charset`)===(n.charSet==null?null:n.charSet)){o.splice(s,1);break b}}r=a.createElement(t),W(r,t,n),a.head.appendChild(r);break;default:throw Error(i(468,t))}r[Ot]=e,Ht(r),t=r}e.stateNode=t}}else ou||Qm(o,e.type,e.stateNode)}else e.stateNode=Km(o,n,e.memoizedProps)}else a===n?n===null&&e.stateNode!==null&&Fl(e,e.memoizedProps,r.memoizedProps):(a===null?(t=r.stateNode,t===null||su||t.parentNode.removeChild(t)):a.count--,n===null?ou||Qm(o,e.type,e.stateNode):Km(o,n,e.memoizedProps))}break;case 27:ju(t,e,n),Pu(e),a&512&&(su||r===null||Ol(r,r.return)),r!==null&&a&4&&Fl(e,e.memoizedProps,r.memoizedProps);break;case 5:if(o=cu,cu=!1,ju(t,e,n),cu=o,Pu(e),a&512&&(su||r===null||Ol(r,r.return)),e.flags&32){t=e.stateNode;try{gn(t,``),j=!0}catch(t){xf(e,e.return,t)}}a&4&&e.stateNode!=null&&(t=e.memoizedProps,Fl(e,t,r===null?t:r.memoizedProps)),a&1024&&(lu=!0);break;case 6:if(ju(t,e,n),Pu(e),a&4){if(e.stateNode===null)throw Error(i(162));t=e.memoizedProps,n=e.stateNode;try{n.nodeValue=t,j=!0}catch(t){xf(e,e.return,t)}}break;case 3:if(j=!1,Xm=null,o=Mu,Mu=Em(t.containerInfo),ju(t,e,n),Mu=o,Pu(e),a&4&&r!==null&&r.memoizedState.isDehydrated)try{Jh(t.containerInfo)}catch(t){xf(e,e.return,t)}lu&&(lu=!1,Fu(e)),j=!1;break;case 4:a=cu,cu=ou,r=Qt(),o=Mu,Mu=Em(e.stateNode.containerInfo),ju(t,e,n),Pu(e),Mu=o,j&&pu&&(mu=!0),j=r,cu=a;break;case 12:ju(t,e,n),Pu(e);break;case 31:ju(t,e,n),Pu(e),a&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,Au(e,t)));break;case 13:ju(t,e,n),Pu(e),e.child.flags&8192&&e.memoizedState!==null!=(r!==null&&r.memoizedState!==null)&&(xd=Ke()),a&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,Au(e,t)));break;case 22:o=e.memoizedState!==null,s=r!==null&&r.memoizedState!==null;var c=ou,l=su,u=cu;ou=c||o,cu=u||o,su=l||s,ju(t,e,n),su=l,cu=u,ou=c,Pu(e),a&8192&&(t=e.stateNode,t._visibility=o?t._visibility&-2:t._visibility|1,!o||r===null||s||ou||su||(t=s||su,n=ou,r=su,ou=o||ou,su=t,zu(e,2),ou=n,su=r),!o&&cu||yu(e,o)),a&4&&(t=e.updateQueue,t!==null&&(n=t.retryQueue,n!==null&&(t.retryQueue=null,Au(e,n))));break;case 19:ju(t,e,n),Pu(e),a&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,Au(e,t)));break;case 30:a&512&&(su||r===null||Ol(r,r.return)),a=Qt(),o=pu,s=(n&335544064)===n,c=e.memoizedProps,pu=s&&Ei(c.default,c.update)!==`none`,ju(t,e,n),Pu(e),s&&r!==null&&j&&(e.flags|=4),pu=o,j=a;break;case 21:break;case 7:a&512&&(su||r===null||Ol(r,r.return)),r&&r.stateNode!==null&&(r.stateNode._fragmentFiber=e);default:ju(t,e,n),Pu(e)}}function Pu(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(Il(r)){n=r;break}r=r.return}r=null;for(var a=e.return;a!==null;){if(Nl(a)){var o=a.stateNode;r===null?r=[o]:r.push(o)}if(Ml(a))break;a=a.return}var s=r;if(n==null)throw Error(i(160));switch(n.tag){case 27:var c=n.stateNode;zl(e,Ll(e),c,s);break;case 5:var l=n.stateNode;n.flags&32&&(gn(l,``),n.flags&=-33),zl(e,Ll(e),l,s);break;case 3:case 4:var u=n.stateNode.containerInfo;Rl(e,Ll(e),u,s);break;default:throw Error(i(161))}}catch(t){xf(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Fu(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Fu(t),t.tag===5&&t.flags&1024&&(t=t.stateNode,Sh=!0,t.reset(),Sh=!1),e=e.sibling}}function Iu(e,t){if(t.subtreeFlags&9270)for(t=t.child;t!==null;)Lu(t,e),t=t.sibling;else au(t,!1)}function Lu(e,t){var n=e.alternate;if(n===null)Zl(e,!1);else switch(e.tag){case 3:if(hu=fu=!1,Gl(),Iu(t,e),!fu&&!mu){if(e=Wl,e!==null)for(var r=0;r<e.length;r+=3){n=e[r];var i=e[r+1];Pp(n,e[r+2]),n=n.ownerDocument.documentElement,n!==null&&n.animate({opacity:[0,0],pointerEvents:[`none`,`none`]},{duration:0,fill:`forwards`,pseudoElement:`::view-transition-group(`+i+`)`})}e=t.containerInfo,e=e.nodeType===9?e.documentElement:e.ownerDocument.documentElement,e!==null&&e.style.viewTransitionName===``&&(e.style.viewTransitionName=`none`,e.animate({opacity:[0,0],pointerEvents:[`none`,`none`]},{duration:0,fill:`forwards`,pseudoElement:`::view-transition-group(root)`}),e.animate({width:[0,0],height:[0,0]},{duration:0,fill:`forwards`,pseudoElement:`::view-transition`})),hu=!0}Wl=null;break;case 5:Iu(t,e);break;case 4:r=fu,fu=!1,Iu(t,e),fu&&(mu=!0),fu=r;break;case 22:e.memoizedState===null&&(n.memoizedState===null?Iu(t,e):Zl(e,!1));break;case 30:r=fu,i=Gl(),fu=!1,Iu(t,e),fu&&(e.flags|=4);var a=e.memoizedProps,o=e.stateNode;t=wi(a,o),o=wi(n.memoizedProps,o);var s=Ei(a.default,a.update);s===`none`?t=!1:(a=n.memoizedState,n.memoizedState=null,n=e.child,Kl=0,t=iu(e,n,t,o,s,a,!0),Kl!==(a===null?0:a.length)&&(e.flags|=32)),e.flags&4&&t?(Bd(e,e.memoizedProps.onUpdate),Wl=i):i!==null&&(i.push.apply(i,Wl),Wl=i),fu=e.flags&32?!0:r;break;default:Iu(t,e)}}function Ru(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)vu(e,t.alternate,t),t=t.sibling}function zu(e,t){for(e=e.child;e!==null;){var n=e,r=t;switch(n.tag){case 0:case 11:case 14:case 15:wl(4,n,n.return),zu(n,r);break;case 1:Ol(n,n.return);var i=n.stateNode;typeof i.componentWillUnmount==`function`&&El(n,n.return,i),zu(n,r);break;case 27:r&2&&Sm(n.stateNode,n.type,n.memoizedProps);case 5:Ol(n,n.return),n.tag!==5&&n.tag!==27||jl(n),zu(n,r);break;case 6:jl(n);break;case 26:Ol(n,n.return),i=n.stateNode,n.memoizedState!==null||i===null||su||i.parentNode.removeChild(i),zu(n,r);break;case 22:n.memoizedState===null&&zu(n,r);break;case 30:Ol(n,n.return),zu(n,r);break;case 7:Ol(n,n.return);default:zu(n,r)}e=e.sibling}}function Bu(e,t,n){for(n=t.subtreeFlags&8772?n:n&-2,t=t.child;t!==null;){var r=t.alternate,i=e,a=t,o=a.flags,s=!!(n&1);switch(a.tag){case 0:case 11:case 15:Bu(i,a,n),Cl(4,a);break;case 1:if(Bu(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){xf(r,r.return,e)}if(r=a,i=r.updateQueue,i!==null){var c=r.stateNode;try{var l=i.shared.hiddenCallbacks;if(l!==null)for(i.shared.hiddenCallbacks=null,i=0;i<l.length;i++)wo(l[i],c)}catch(e){xf(r,r.return,e)}}s&&o&64&&Tl(a),Dl(a,a.return);break;case 27:n&2&&Bl(a);case 5:a.tag!==5&&a.tag!==27||Al(a),Bu(i,a,n),s&&r===null&&o&4&&Pl(a),Dl(a,a.return);break;case 6:Al(a);break;case 26:c=a.stateNode,a.memoizedState!==null||c===null||ou||Qm(Em(c.ownerDocument),a.type,c),Bu(i,a,n),s&&r===null&&o&4&&Pl(a),Dl(a,a.return);break;case 12:Bu(i,a,n);break;case 31:Bu(i,a,n),s&&o&4&&Du(i,a);break;case 13:Bu(i,a,n),s&&o&4&&Ou(i,a);break;case 22:a.memoizedState===null&&Bu(i,a,n),Dl(a,a.return);break;case 30:Bu(i,a,n),Dl(a,a.return);break;case 7:Dl(a,a.return);default:Bu(i,a,n)}t=t.sibling}}function Vu(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&Na(n))}function Hu(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Na(e))}function Uu(e,t,n,r){var i=(n&335544064)===n;if(t.subtreeFlags&(i?10262:10256))for(t=t.child;t!==null;)Wu(e,t,n,r),t=t.sibling;else i&&ru(t)}function Wu(e,t,n,r){var i=(n&335544064)===n;i&&t.alternate===null&&t.return!==null&&t.return.alternate!==null&&nu(t);var a=t.flags;switch(t.tag){case 0:case 11:case 15:Uu(e,t,n,r),a&2048&&Cl(9,t);break;case 1:Uu(e,t,n,r);break;case 3:Uu(e,t,n,r),i&&hu&&(e=e.containerInfo,e=e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,e.style.viewTransitionName===`root`&&(e.style.viewTransitionName=``),e=e.ownerDocument.documentElement,e!==null&&e.style.viewTransitionName===`none`&&(e.style.viewTransitionName=``)),a&2048&&(a=null,t.alternate!==null&&(a=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==a&&(t.refCount++,a!=null&&Na(a)));break;case 12:if(a&2048){Uu(e,t,n,r),a=t.stateNode;try{var o=t.memoizedProps,s=o.id,c=o.onPostCommit;typeof c==`function`&&c(s,t.alternate===null?`mount`:`update`,a.passiveEffectDuration,-0)}catch(e){xf(t,t.return,e)}}else Uu(e,t,n,r);break;case 31:Uu(e,t,n,r);break;case 13:Uu(e,t,n,r);break;case 23:break;case 22:o=t.stateNode,s=t.alternate,t.memoizedState===null?(i&&s!==null&&s.memoizedState!==null&&nu(t),o._visibility&2?Uu(e,t,n,r):(o._visibility|=2,Gu(e,t,n,r,!!(t.subtreeFlags&10256)||!1))):(i&&s!==null&&s.memoizedState===null&&nu(s),o._visibility&2?Uu(e,t,n,r):Ku(e,t)),a&2048&&Vu(s,t);break;case 24:Uu(e,t,n,r),a&2048&&Hu(t.alternate,t);break;case 30:i&&(a=t.alternate,a!==null&&(Yl(a.child,!0),Yl(t.child,!0))),Uu(e,t,n,r);break;default:Uu(e,t,n,r)}}function Gu(e,t,n,r,i){for(i&&=!!(t.subtreeFlags&10256)||!1,t=t.child;t!==null;){var a=e,o=t,s=n,c=r,l=o.flags;switch(o.tag){case 0:case 11:case 15:Gu(a,o,s,c,i),Cl(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,Gu(a,o,s,c,i)):u._visibility&2?Gu(a,o,s,c,i):Ku(a,o),i&&l&2048&&Vu(o.alternate,o);break;case 24:Gu(a,o,s,c,i),i&&l&2048&&Hu(o.alternate,o);break;default:Gu(a,o,s,c,i)}t=t.sibling}}function Ku(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,r=t,i=r.flags;switch(r.tag){case 22:Ku(n,r),i&2048&&Vu(r.alternate,r);break;case 24:Ku(n,r),i&2048&&Hu(r.alternate,r);break;default:Ku(n,r)}t=t.sibling}}var qu=8192;function Ju(e,t,n){if(e.subtreeFlags&qu)for(e=e.child;e!==null;)Yu(e,t,n),e=e.sibling}function Yu(e,t,n){switch(e.tag){case 26:Ju(e,t,n),e.flags&qu&&(e.memoizedState===null?(e=e.stateNode,(t&335544128)===t&&rh(n,e)):ih(n,Mu,e.memoizedState,e.memoizedProps));break;case 5:Ju(e,t,n),e.flags&qu&&(e=e.stateNode,(t&335544128)===t&&rh(n,e));break;case 3:case 4:var r=Mu;Mu=Em(e.stateNode.containerInfo),Ju(e,t,n),Mu=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=qu,qu=16777216,Ju(e,t,n),qu=r):Ju(e,t,n));break;case 30:if((e.flags&qu)!==0&&(r=e.memoizedProps.name,r!=null&&r!==`auto`)){var i=e.stateNode;i.paired=null,Hl===null&&(Hl=new Map),Hl.set(r,i)}Ju(e,t,n);break;default:Ju(e,t,n)}}function Xu(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function Zu(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];du=r,ed(r,e)}Xu(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Qu(e),e=e.sibling}function Qu(e){switch(e.tag){case 0:case 11:case 15:Zu(e),e.flags&2048&&wl(9,e,e.return);break;case 3:Zu(e);break;case 12:Zu(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,$u(e)):Zu(e);break;default:Zu(e)}}function $u(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];du=r,ed(r,e)}Xu(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:wl(8,t,t.return),$u(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,$u(t));break;default:$u(t)}e=e.sibling}}function ed(e,t){for(;du!==null;){var n=du;switch(n.tag){case 0:case 11:case 15:wl(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var r=n.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:Na(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,du=r;else a:for(n=e;du!==null;){r=du;var i=r.sibling,a=r.return;if(Su(r),r===n){du=null;break a}if(i!==null){i.return=a,du=i;break a}du=a}}}var td={getCacheForType:function(e){var t=Ea(ja),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return Ea(ja).controller.signal}},nd=typeof WeakMap==`function`?WeakMap:Map,rd=0,id=null,ad=null,U=0,od=0,sd=null,cd=!1,ld=!1,ud=!1,dd=0,fd=0,pd=0,md=0,hd=0,gd=0,_d=0,vd=null,yd=null,bd=!1,xd=0,Sd=0,Cd=1/0,wd=null,Td=null,Ed=0,Dd=null,Od=null,kd=0,Ad=0,jd=null,Md=null,Nd=null,Pd=null,Fd=null,Id=0,Ld=null;function Rd(){return rd&2&&U!==0?U&-U:k.T===null?Tt():Hf()}function zd(){if(gd===0){if(!(U&536870912)||ca){var e=lt;lt<<=1,!(lt&3932160)&&(lt=262144),gd=e}else gd=536870912}return e=jo.current,e!==null&&(e.flags|=32),gd}function Bd(e,t){if(t!=null){var n=e.stateNode,r=n.ref;r===null&&(r=n.ref=Hp(wi(e.memoizedProps,n))),Pd===null&&(Pd=[]),Pd.push(t.bind(null,r))}}function Vd(e,t,n){(e===id&&(od===2||od===9)||e.cancelPendingCommit!==null)&&(Jd(e,0),Gd(e,U,gd,!1)),vt(e,n),(!(rd&2)||e!==id)&&(e===id&&(!(rd&2)&&(md|=n),fd===4&&Gd(e,U,gd,!1)),Pf(e))}function Hd(e,t,n){if(rd&6)throw Error(i(327));var r=!n&&!(t&127)&&(t&e.expiredLanes)===0||pt(e,t),a=r?nf(e,t):ef(e,t,!0),o=r;do{if(a===0){ld&&!r&&Gd(e,t,0,!1);break}if(n=e.current.alternate,o&&!Wd(n))a=ef(e,t,!1),o=!1;else{if(a===2){if(o=t,e.errorRecoveryDisabledLanes&o)var s=0;else s=e.pendingLanes&-536870913,s=s===0?s&536870912?536870912:0:s;if(s!==0){t=s;a:{var c=e;a=vd;var l=c.current.memoizedState.isDehydrated;if(l&&(Jd(c,s).flags|=256),s=ef(c,s,!1),s!==2&&s!==6){if(ud&&!l){c.errorRecoveryDisabledLanes|=o,md|=o,a=4;break a}o=yd,yd=a,o!==null&&(yd===null?yd=o:yd.push.apply(yd,o))}a=s}if(o=!1,a!==2)continue}}if(a===1){Jd(e,0),Gd(e,t,0,!0);break}a:{switch(r=e,o=a,o){case 0:case 1:throw Error(i(345));case 4:if((t&4194048)!==t&&(t&62914560)!==t)break;case 6:Gd(r,t,gd,!cd);break a;case 2:yd=null;break;case 3:case 5:break;default:throw Error(i(329))}if((t&62914560)===t&&(a=xd+300-Ke(),10<a)){if(Gd(r,t,gd,!cd),ft(r,0,!0)!==0)break a;kd=t,r.timeoutHandle=wp(Ud.bind(null,r,n,yd,wd,bd,t,gd,md,_d,cd,o,`Throttled`,-0,0),a);break a}Ud(r,n,yd,wd,bd,t,gd,md,_d,cd,o,null,-0,0)}break}}while(1);Pf(e)}function Ud(e,t,n,r,i,a,o,s,c,l,u,d,f,p){e.timeoutHandle=-1;var m=t.subtreeFlags,h=(a&335544064)===a;d=null,(h||m&8192||(m&16785408)==16785408)&&(d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:wn},Hl=null,Yu(t,a,d),h&&(m=d,h=e.containerInfo,h=(h.nodeType===9?h:h.ownerDocument).__reactViewTransition,h!=null&&(m.count++,m.waitingForViewTransition=!0,m=ch.bind(m),h.finished.then(m,m))),m=(a&62914560)===a?xd-Ke():(a&4194048)===a?Sd-Ke():0,m=oh(d,m),m!==null)?(kd=a,e.cancelPendingCommit=m(uf.bind(null,e,t,a,n,r,i,o,s,c,l,u,d,null,f,p)),Gd(e,a,o,!l)):uf(e,t,a,n,r,i,o,s,c,l,u,d)}function Wd(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!Kr(a(),i))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Gd(e,t,n,r){t=mt(e,t),t&=~hd,t&=~md,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-it(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&bt(e,n,t)}function Kd(){return rd&6?!0:(Ff(0,!1),!1)}function qd(){if(ad!==null){if(od===0)var e=ad.return;else e=ad,ba=ya=null,os(e),ao=null,oo=0,e=ad;for(;e!==null;)Sl(e.alternate,e),e=e.return;ad=null}}function Jd(e,t){var n=e.timeoutHandle;return n!==-1&&(e.timeoutHandle=-1,Tp(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),kd=0,qd(),id=e,ad=n=Bi(e.current,null),U=t,od=0,sd=null,cd=!1,ld=pt(e,t),ud=!1,_d=gd=hd=md=pd=fd=0,yd=vd=null,bd=!1,dd=mt(e,t),ji(),n}function Yd(e,t){V=null,k.H=gc,t===Ya||t===Za?(t=ro(),od=3):t===Xa?(t=ro(),od=4):od=t===Pc?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,sd=t,ad===null&&(fd=1,Oc(e,Ji(t,e.current)))}function Xd(){var e=jo.current;return e===null?!0:(U&4194048)===U?Mo===null:(U&62914560)===U||U&536870912?e===Mo:!1}function Zd(){var e=k.H;return k.H=gc,e===null?gc:e}function Qd(){var e=k.A;return k.A=td,e}function $d(){fd=4,cd||(U&4194048)!==U&&jo.current!==null||(ld=!0),!(pd&134217727)&&!(md&134217727)||id===null||Gd(id,U,gd,!1)}function ef(e,t,n){var r=rd;rd|=2;var i=Zd(),a=Qd();(id!==e||U!==t)&&(wd=null,Jd(e,t)),t=!1;var o=fd;a:do try{if(od!==0&&ad!==null){var s=ad,c=sd;switch(od){case 8:qd(),o=6;break a;case 3:case 2:case 9:case 6:jo.current===null&&(t=!0);var l=od;if(od=0,sd=null,sf(e,s,c,l),n&&ld){o=0;break a}break;default:l=od,od=0,sd=null,sf(e,s,c,l)}}tf(),o=fd;break}catch(t){Yd(e,t)}while(1);return t&&e.shellSuspendCounter++,ba=ya=null,rd=r,k.H=i,k.A=a,ad===null&&(id=null,U=0,ji()),o}function tf(){for(;ad!==null;)af(ad)}function nf(e,t){var n=rd;rd|=2;var r=Zd(),a=Qd();id!==e||U!==t?(wd=null,Cd=Ke()+500,Jd(e,t)):ld=pt(e,t);a:do try{if(od!==0&&ad!==null){t=ad;var o=sd;b:switch(od){case 1:od=0,sd=null,sf(e,t,o,1);break;case 2:case 9:if($a(o)){od=0,sd=null,of(t);break}t=function(){od!==2&&od!==9||id!==e||(od=7),Pf(e)},o.then(t,t);break a;case 3:od=7;break a;case 4:od=5;break a;case 7:$a(o)?(od=0,sd=null,of(t)):(od=0,sd=null,sf(e,t,o,7));break;case 5:var s=null;switch(ad.tag){case 26:s=ad.memoizedState;case 5:case 27:var c=ad;if(s?th(s):c.stateNode.complete){od=0,sd=null;var l=c.sibling;if(l!==null)ad=l;else{var u=c.return;u===null?ad=null:(ad=u,cf(u))}break b}}od=0,sd=null,sf(e,t,o,5);break;case 6:od=0,sd=null,sf(e,t,o,6);break;case 8:qd(),fd=6;break a;default:throw Error(i(462))}}rf();break}catch(t){Yd(e,t)}while(1);return ba=ya=null,k.H=r,k.A=a,rd=n,ad===null?(id=null,U=0,ji(),fd):0}function rf(){for(;ad!==null&&!We();)af(ad)}function af(e){var t=ml(e.alternate,e,dd);e.memoizedProps=e.pendingProps,t===null?cf(e):ad=t}function of(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=Jc(n,t,t.pendingProps,t.type,void 0,U);break;case 11:t=Jc(n,t,t.pendingProps,t.type.render,t.ref,U);break;case 5:os(t);var r=t;r===F&&(ca?(pa(r),r.tag===5&&r.stateNode!=null&&(I=r.stateNode)):(pa(r),ca=!0));default:Sl(n,t),t=ad=Vi(t,dd),t=ml(n,t,dd)}e.memoizedProps=e.pendingProps,t===null?cf(e):ad=t}function sf(e,t,n,r){ba=ya=null,os(t),ao=null,oo=0;var i=t.return;try{if(Nc(e,i,t,n,U)){fd=1,Oc(e,Ji(n,e.current)),ad=null;return}}catch(t){if(i!==null)throw ad=i,t;fd=1,Oc(e,Ji(n,e.current)),ad=null;return}t.flags&32768?(ca||r===1?e=!0:ld||U&536870912?e=!1:(cd=e=!0,(r===2||r===9||r===3||r===6)&&(r=jo.current,r!==null&&r.tag===13&&(r.flags|=16384))),lf(t,e)):cf(t)}function cf(e){var t=e;do{if(t.flags&32768){lf(t,cd);return}e=t.return;var n=bl(t.alternate,t,dd);if(n!==null){ad=n;return}if(t=t.sibling,t!==null){ad=t;return}ad=t=e}while(t!==null);fd===0&&(fd=5)}function lf(e,t){do{var n=xl(e.alternate,e);if(n!==null){n.flags&=32767,ad=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){ad=e;return}ad=e=n}while(e!==null);fd=6,ad=null}function uf(e,t,n,r,a,o,s,c,l,u,d,f){e.cancelPendingCommit=null;do vf();while(Ed!==0);if(rd&6)throw Error(i(327));if(t!==null){if(t===e.current)throw Error(i(177));e===id&&(ad=id=null,U=0),Od=t,Dd=e,kd=n,jd=a,Md=r,df(e,t,n,s,c,l,f)}}function df(e,t,n,r,i,a,o){var s=t.lanes|t.childLanes;if(Ad=s,s|=Ai,yt(e,n,s,r,i,a),Pd=null,(n&335544064)===n?(Fd=Ia(e),r=10262):(Fd=null,r=10256),(t.subtreeFlags&r)!==0||(t.flags&r)!==0?(e.callbackNode=null,e.callbackPriority=0,Df(Xe,function(){return yf(),null})):(e.callbackNode=null,e.callbackPriority=0),Vl=!1,r=!!(t.flags&13878),t.subtreeFlags&13878||r){r=k.T,k.T=null,i=A.p,A.p=2,a=rd,rd|=4;try{gu(e,t,n)}finally{rd=a,A.p=i,k.T=r}}Ed=1,Vl?Nd=Bp(o,e.containerInfo,Fd,mf,hf,pf,gf,yf,ff,null,null):(mf(),hf(),gf())}function ff(e){if(Ed!==0){var t=Dd.onRecoverableError;t(e,{componentStack:null})}}function pf(){Ed===3&&(Ed=0,Lu(Od,Dd),Ed=4)}function mf(){if(Ed===1){Ed=0;var e=Dd,t=Od,n=kd,r=!!(t.flags&13878);if(t.subtreeFlags&13878||r){r=k.T,k.T=null;var i=A.p;A.p=2;var a=rd;rd|=4;try{pu=mu=!1,Nu(t,e,n),n=gp;var o=Qr(e.containerInfo),s=n.focusedElem,c=n.selectionRange;if(o!==s&&s&&s.ownerDocument&&Zr(s.ownerDocument.documentElement,s)){if(c!==null&&$r(s)){var l=c.start,u=c.end;if(u===void 0&&(u=l),`selectionStart`in s)s.selectionStart=l,s.selectionEnd=Math.min(u,s.value.length);else{var d=s.ownerDocument||document,f=d&&d.defaultView||window;if(f.getSelection){var p=f.getSelection(),m=s.textContent.length,h=Math.min(c.start,m),g=c.end===void 0?h:Math.min(c.end,m);!p.extend&&h>g&&(o=g,g=h,h=o);var _=Xr(s,h),v=Xr(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;s<d.length;s++){var b=d[s];b.element.scrollLeft=b.left,b.element.scrollTop=b.top}}Sh=!!G,gp=G=null}finally{rd=a,A.p=i,k.T=r}}e.current=t,Ed=2}}function hf(){if(Ed===2){Ed=0;var e=Dd,t=Od,n=!!(t.flags&8772);if(t.subtreeFlags&8772||n){n=k.T,k.T=null;var r=A.p;A.p=2;var i=rd;rd|=4;try{vu(e,t.alternate,t)}finally{rd=i,A.p=r,k.T=n}}Ed=3}}function gf(){if(Ed===4||Ed===3){Ed=0;var e=Nd;Nd=null,Ge();var t=Dd,n=Od,r=kd,i=Md,a=(r&335544064)===r?10262:10256;if((n.subtreeFlags&a)!==0||(n.flags&a)!==0?Ed=5:(Ed=0,Od=Dd=null,_f(t,t.pendingLanes)),a=t.pendingLanes,a===0&&(Td=null),wt(r),n=n.stateNode,nt&&typeof nt.onCommitFiberRoot==`function`)try{nt.onCommitFiberRoot(tt,n,void 0,(n.current.flags&128)==128)}catch{}if(i!==null){n=k.T,a=A.p,A.p=2,k.T=null;try{for(var o=t.onRecoverableError,s=0;s<i.length;s++){var c=i[s];o(c.value,{componentStack:c.stack})}}finally{k.T=n,A.p=a}}if(i=Pd,o=Fd,Fd=null,i!==null&&(Pd=null,o===null&&(o=[]),e!==null))for(c=0;c<i.length;c++)n=(0,i[c])(o),n!==void 0&&e.finished.finally(n);kd&3&&vf(),Pf(t),a=t.pendingLanes,r&261930&&a&42?t===Ld?Id++:(Id=0,Ld=t):(Id=0,Ld=null),Ff(0,!1)}}function _f(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Na(t)))}function vf(){return Nd!==null&&(Nd.skipTransition(),Nd=null),mf(),hf(),gf(),yf()}function yf(){if(Ed!==5)return!1;var e=Dd,t=Ad;Ad=0;var n=wt(kd),r=k.T,a=A.p;try{A.p=32>n?32:n,k.T=null,n=jd,jd=null;var o=Dd,s=kd;if(Ed=0,Od=Dd=null,kd=0,rd&6)throw Error(i(331));var c=rd;if(rd|=4,Qu(o.current),Wu(o,o.current,s,n),rd=c,Ff(0,!1),nt&&typeof nt.onPostCommitFiberRoot==`function`)try{nt.onPostCommitFiberRoot(tt,o)}catch{}return!0}finally{A.p=a,k.T=r,_f(e,t)}}function bf(e,t,n){t=Ji(n,t),t=Ac(e.stateNode,t,2),e=vo(e,t,2),e!==null&&(vt(e,2),Pf(e))}function xf(e,t,n){if(e.tag===3)bf(e,e,n);else for(;t!==null;){if(t.tag===3){bf(t,e,n);break}if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(Td===null||!Td.has(r))){e=Ji(n,e),n=jc(2),r=vo(t,n,2),r!==null&&(Mc(n,r,t,e),vt(r,2),Pf(r));break}}t=t.return}}function Sf(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new nd;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(ud=!0,i.add(n),e=Cf.bind(null,e,t,n),t.then(e,e))}function Cf(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,id===e&&(U&n)===n&&(fd===4||fd===3&&(U&62914560)===U&&300>Ke()-xd?rd&2?hd|=n:Jd(e,0):hd|=n,_d===U&&(_d=0)),Pf(e)}function wf(e,t){t===0&&(t=gt()),e=N(e,t),e!==null&&(vt(e,t),Pf(e))}function Tf(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),wf(e,n)}function Ef(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(i(314))}r!==null&&r.delete(t),wf(e,n)}function Df(e,t){return He(e,t)}var Of=null,kf=null,Af=!1,jf=!1,Mf=!1,Nf=0;function Pf(e){e!==kf&&e.next===null&&(kf===null?Of=kf=e:kf=kf.next=e),jf=!0,Af||(Af=!0,Vf())}function Ff(e,t){if(!Mf&&jf){Mf=!0;do for(var n=!1,r=Of;r!==null;){if(!t){if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-it(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,Bf(r,a))}else a=U,a=ft(r,r===id?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||pt(r,a)||(n=!0,Bf(r,a))}r=r.next}while(n);Mf=!1}}function If(){Lf()}function Lf(){jf=Af=!1;var e=0;Nf!==0&&Cp()&&(e=Nf);for(var t=Ke(),n=null,r=Of;r!==null;){var i=r.next,a=Rf(r,t);a===0?(r.next=null,n===null?Of=i:n.next=i,i===null&&(kf=n)):(n=r,(e!==0||a&3)&&(jf=!0)),r=i}Ed!==0&&Ed!==5||Ff(e,!1),Nf!==0&&(Nf=0)}function Rf(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-it(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=ht(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=id,n=U,n=ft(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(od===2||od===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&Ue(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||pt(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&Ue(r),wt(n)){case 2:case 8:n=Ye;break;case 32:n=Xe;break;case 268435456:n=Qe;break;default:n=Xe}return r=zf.bind(null,e),n=He(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&Ue(r),e.callbackPriority=2,e.callbackNode=null,2}function zf(e,t){if(Ed!==0&&Ed!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(vf()&&e.callbackNode!==n)return null;var r=U;return r=ft(e,e===id?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(Hd(e,r,t),Rf(e,Ke()),e.callbackNode!=null&&e.callbackNode===n?zf.bind(null,e):null)}function Bf(e,t){if(vf())return null;Hd(e,t,!0)}function Vf(){Op(function(){rd&6?He(Je,If):Lf()})}function Hf(){if(Nf===0){var e=za;e===0&&(e=ct,ct<<=1,!(ct&261888)&&(ct=256)),Nf=e}return Nf}function Uf(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:Cn(e)}function Wf(e,t,n,r,i){if(t===`submit`&&n&&n.stateNode===i){var a=Uf((i[kt]||null).action),o=r.submitter;o&&(t=(t=o[kt]||null)?Uf(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new Wn(`action`,`action`,null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(Nf!==0){var e=new FormData(i,o);nc(n,{pending:!0,data:e,method:i.method,action:a},null,e)}}else typeof a==`function`&&(s.preventDefault(),e=new FormData(i,o),nc(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var Gf=0;Gf<xi.length;Gf++){var Kf=xi[Gf];Si(Kf.toLowerCase(),`on`+(Kf[0].toUpperCase()+Kf.slice(1)))}Si(di,`onAnimationEnd`),Si(pi,`onAnimationIteration`),Si(hi,`onAnimationStart`),Si(`dblclick`,`onDoubleClick`),Si(`focusin`,`onFocus`),Si(`focusout`,`onBlur`),Si(gi,`onTransitionRun`),Si(_i,`onTransitionStart`),Si(vi,`onTransitionCancel`),Si(yi,`onTransitionEnd`),qt(`onMouseEnter`,[`mouseout`,`mouseover`]),qt(`onMouseLeave`,[`mouseout`,`mouseover`]),qt(`onPointerEnter`,[`pointerout`,`pointerover`]),qt(`onPointerLeave`,[`pointerout`,`pointerover`]),Kt(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),Kt(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),Kt(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),Kt(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),Kt(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),Kt(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var qf=`abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting`.split(` `),Jf=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(qf));function Yf(e,t){t=!!(t&4);for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;a:{var a=void 0;if(t)for(var o=r.length-1;0<=o;o--){var s=r[o],c=s.instance,l=s.currentTarget;if(s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Di(e)}i.currentTarget=null,a=c}else for(o=0;o<r.length;o++){if(s=r[o],c=s.instance,l=s.currentTarget,s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Di(e)}i.currentTarget=null,a=c}}}}function Xf(e,t){var n=t[jt];n===void 0&&(n=t[jt]=new Set);var r=e+`__bubble`;n.has(r)||(ep(t,e,2,!1),n.add(r))}function Zf(e,t,n){var r=0;t&&(r|=4),ep(n,e,r,t)}var Qf=`_reactListening`+Math.random().toString(36).slice(2);function $f(e){if(!e[Qf]){e[Qf]=!0,Wt.forEach(function(t){t!==`selectionchange`&&(Jf.has(t)||Zf(t,!1,e),Zf(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Qf]||(t[Qf]=!0,Zf(`selectionchange`,!1,t))}}function ep(e,t,n,r){switch(kh(t)){case 2:var i=Ch;break;case 8:i=wh;break;default:i=Th}n=i.bind(null,t,n,e),i=void 0,!Pn||t!==`touchstart`&&t!==`touchmove`&&t!==`wheel`||(i=!0),r?i===void 0?e.addEventListener(t,n,!0):e.addEventListener(t,n,{capture:!0,passive:i}):i===void 0?e.addEventListener(t,n,!1):e.addEventListener(t,n,{passive:i})}function tp(e,t,n,r,i){var a=r;if(!(t&1)&&!(t&2)&&r!==null)a:for(;;){if(r===null)return;var s=r.tag;if(s===3||s===4){var c=r.stateNode.containerInfo;if(c===i)break;if(s===4)for(s=r.return;s!==null;){var l=s.tag;if((l===3||l===4)&&s.stateNode.containerInfo===i)return;s=s.return}for(;c!==null;){if(s=Rt(c),s===null)return;if(l=s.tag,l===5||l===6||l===26||l===27){r=a=s;continue a}c=c.parentNode}}r=r.return}jn(function(){var r=a,i=En(n),s=[];a:{var c=bi.get(e);if(c!==void 0){var l=Wn,u=e;switch(e){case`keypress`:if(zn(n)===0)break a;case`keydown`:case`keyup`:l=cr;break;case`focusin`:u=`focus`,l=$n;break;case`focusout`:u=`blur`,l=$n;break;case`beforeblur`:case`afterblur`:l=$n;break;case`click`:if(n.button===2)break a;case`auxclick`:case`dblclick`:case`mousedown`:case`mousemove`:case`mouseup`:case`mouseout`:case`mouseover`:case`contextmenu`:l=Zn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:l=Qn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:l=dr;break;case di:case pi:case hi:l=er;break;case yi:l=fr;break;case`scroll`:case`scrollend`:l=Kn;break;case`wheel`:l=pr;break;case`copy`:case`cut`:case`paste`:l=tr;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:l=lr;break;case`submit`:l=ur;break;case`toggle`:case`beforetoggle`:l=mr}var d=!!(t&4),f=!d&&(e===`scroll`||e===`scrollend`),p=d?c===null?null:c+`Capture`:c;d=[];for(var m=r,h;m!==null;){var g=m;if(h=g.stateNode,g=g.tag,g!==5&&g!==26&&g!==27||h===null||p===null||(g=Mn(m,p),g!=null&&d.push(np(m,g,h))),f)break;m=m.return}0<d.length&&(c=new l(c,u,null,n,i),s.push({event:c,listeners:d}))}}if(!(t&7)){a:{if(l=e===`mouseover`||e===`pointerover`,c=e===`mouseout`||e===`pointerout`,l&&n!==Tn&&(u=n.relatedTarget||n.fromElement)&&(Rt(u)||u[At]))break a;(c||l)&&(u=i.window===i?i:(l=i.ownerDocument)?l.defaultView||l.parentWindow:window,c?(l=n.relatedTarget||n.toElement,c=r,l=l?Rt(l):null,l!==null&&(f=o(l),d=l.tag,l!==f||d!==5&&d!==27&&d!==6)&&(l=null)):(c=null,l=r),c!==l&&(d=Zn,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=lr,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=c==null?u:Bt(c),h=l==null?u:Bt(l),u=new d(g,m+`leave`,c,n,i),u.target=f,u.relatedTarget=h,g=null,Rt(i)===r&&(d=new d(p,m+`enter`,l,n,i),d.target=h,d.relatedTarget=f,g=d),f=g,d=c&&l?w(c,l,ip):null,c!==null&&ap(s,u,c,d,!1),l!==null&&f!==null&&ap(s,f,l,d,!0)))}a:{if(c=r?Bt(r):window,l=c.nodeName&&c.nodeName.toLowerCase(),l===`select`||l===`input`&&c.type===`file`)var _=Pr;else if(Or(c)){if(Fr)_=Wr;else{_=Hr;var v=Vr}}else l=c.nodeName,!l||l.toLowerCase()!==`input`||c.type!==`checkbox`&&c.type!==`radio`?r&&bn(r.elementType)&&(_=Pr):_=Ur;if(_&&=_(e,r)){kr(s,_,n,i);break a}v&&v(e,c,r)}switch(v=r?Bt(r):window,e){case`focusin`:(Or(v)||v.contentEditable===`true`)&&(ti=v,ni=r,ri=null);break;case`focusout`:ri=ni=ti=null;break;case`mousedown`:ii=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:ii=!1,ai(s,n,i);break;case`selectionchange`:if(ei)break;case`keydown`:case`keyup`:ai(s,n,i)}var y;if(gr)b:{switch(e){case`compositionstart`:var b=`onCompositionStart`;break b;case`compositionend`:b=`onCompositionEnd`;break b;case`compositionupdate`:b=`onCompositionUpdate`;break b}b=void 0}else wr?Sr(e,n)&&(b=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(b=`onCompositionStart`);b&&(yr&&n.locale!==`ko`&&(wr||b!==`onCompositionStart`?b===`onCompositionEnd`&&wr&&(y=Rn()):(M=i,In=`value`in M?M.value:M.textContent,wr=!0)),v=rp(r,b),0<v.length&&(b=new nr(b,e,null,n,i),s.push({event:b,listeners:v}),y?b.data=y:(y=Cr(n),y!==null&&(b.data=y)))),(y=vr?Tr(e,n):Er(e,n))&&(b=rp(r,`onBeforeInput`),0<b.length&&(v=new nr(`onBeforeInput`,`beforeinput`,null,n,i),s.push({event:v,listeners:b}),v.data=y)),Wf(s,e,r,n,i)}Yf(s,t)})}function np(e,t,n){return{instance:e,listener:t,currentTarget:n}}function rp(e,t){for(var n=t+`Capture`,r=[];e!==null;){var i=e,a=i.stateNode;if(i=i.tag,i!==5&&i!==26&&i!==27||a===null||(i=Mn(e,n),i!=null&&r.unshift(np(e,i,a)),i=Mn(e,t),i!=null&&r.push(np(e,i,a))),e.tag===3)return r;e=e.return}return[]}function ip(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function ap(e,t,n,r,i){for(var a=t._reactName,o=[];n!==null&&n!==r;){var s=n,c=s.alternate,l=s.stateNode;if(s=s.tag,c!==null&&c===r)break;s!==5&&s!==26&&s!==27||l===null||(c=l,i?(l=Mn(n,a),l!=null&&o.unshift(np(n,l,c))):i||(l=Mn(n,a),l!=null&&o.push(np(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var op=/\r\n?/g,sp=/\u0000|\uFFFD/g;function cp(e){return(typeof e==`string`?e:``+e).replace(op,`
|
|
10
|
+
`).replace(sp,``)}function lp(e,t){return t=cp(t),cp(e)===t}function up(e,t,n,r,a,o){switch(n){case`children`:if(typeof r==`string`)t===`body`||t===`textarea`&&r===``||gn(e,r);else if(typeof r==`number`||typeof r==`bigint`)t!==`body`&&gn(e,``+r);else return;break;case`className`:en(e,`class`,r);break;case`tabIndex`:en(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:en(e,n,r);break;case`style`:yn(e,r,o);return;case`data`:if(t!==`object`){en(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)||r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Cn(r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')`);break}if(typeof o==`function`&&(n===`formAction`?(t!==`input`&&up(e,t,`name`,a.name,a,null),up(e,t,`formEncType`,a.formEncType,a,null),up(e,t,`formMethod`,a.formMethod,a,null),up(e,t,`formTarget`,a.formTarget,a,null)):(up(e,t,`encType`,a.encType,a,null),up(e,t,`method`,a.method,a,null),up(e,t,`target`,a.target,a,null))),r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Cn(r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=wn);return;case`onScroll`:r!=null&&Xf(`scroll`,e);return;case`onScrollEnd`:r!=null&&Xf(`scrollend`,e);return;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));o?.__html!==n&&(e.innerHTML=n)}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=Cn(r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`inert`:case`allowFullScreen`:case`async`:case`autoPlay`:case`controls`:case`credentialless`:case`default`:case`defer`:case`disabled`:case`disablePictureInPicture`:case`disableRemotePlayback`:case`formNoValidate`:case`hidden`:case`loop`:case`noModule`:case`noValidate`:case`open`:case`playsInline`:case`readOnly`:case`required`:case`reversed`:case`scoped`:case`seamless`:case`itemScope`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:Xf(`beforetoggle`,e),Xf(`toggle`,e),$t(e,`popover`,r);break;case`xlinkActuate`:tn(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:tn(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:tn(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:tn(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:tn(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:tn(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:tn(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:tn(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:tn(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:$t(e,`is`,r);break;case`innerText`:case`textContent`:return;default:if(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)n=xn.get(n)||n,$t(e,n,r);else return}j=!0}function dp(e,t,n,r,a,o){switch(n){case`style`:yn(e,r,o);return;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));o?.__html!==n&&(e.innerHTML=n)}}break;case`children`:if(typeof r==`string`)gn(e,r);else if(typeof r==`number`||typeof r==`bigint`)gn(e,``+r);else return;break;case`onScroll`:r!=null&&Xf(`scroll`,e);return;case`onScrollEnd`:r!=null&&Xf(`scrollend`,e);return;case`onClick`:r!=null&&(e.onclick=wn);return;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:return;case`innerText`:case`textContent`:return;default:if(!Gt.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(a=n.endsWith(`Capture`),o=n.slice(2,a?n.length-7:void 0),t=e[kt]||null,t=t==null?null:t[n],typeof t==`function`&&e.removeEventListener(o,t,a),typeof r==`function`)){typeof t!=`function`&&t!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(o,r,a);break a}j=!0,n in e?e[n]=r:!0===r?e.setAttribute(n,``):$t(e,n,r)}return}j=!0}function W(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:Xf(`error`,e),Xf(`load`,e);var r=!1,a=!1,o;for(o in n)if(n.hasOwnProperty(o)){var s=n[o];if(s!=null)switch(o){case`src`:r=!0;break;case`srcSet`:a=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:up(e,t,o,s,n,null)}}a&&up(e,t,`srcSet`,n.srcSet,n,null),r&&up(e,t,`src`,n.src,n,null);return;case`input`:Xf(`invalid`,e);var c=o=s=a=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case`name`:a=d;break;case`type`:s=d;break;case`checked`:l=d;break;case`defaultChecked`:u=d;break;case`value`:o=d;break;case`defaultValue`:c=d;break;case`children`:case`dangerouslySetInnerHTML`:if(d!=null)throw Error(i(137,t));break;default:up(e,t,r,d,n,null)}}dn(e,o,c,l,u,s,a,!1);return;case`select`:for(a in Xf(`invalid`,e),r=s=o=null,n)if(n.hasOwnProperty(a)&&(c=n[a],c!=null))switch(a){case`value`:o=c;break;case`defaultValue`:s=c;break;case`multiple`:r=c;default:up(e,t,a,c,n,null)}t=o,n=s,e.multiple=!!r,t==null?n!=null&&pn(e,!!r,n,!0):pn(e,!!r,t,!1);return;case`textarea`:for(s in Xf(`invalid`,e),o=a=r=null,n)if(n.hasOwnProperty(s)&&(c=n[s],c!=null))switch(s){case`value`:r=c;break;case`defaultValue`:a=c;break;case`children`:o=c;break;case`dangerouslySetInnerHTML`:if(c!=null)throw Error(i(91));break;default:up(e,t,s,c,n,null)}hn(e,r,a,o);return;case`option`:for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case`selected`:e.selected=r&&typeof r!=`function`&&typeof r!=`symbol`;break;default:up(e,t,l,r,n,null)}return;case`dialog`:Xf(`beforetoggle`,e),Xf(`toggle`,e),Xf(`cancel`,e),Xf(`close`,e);break;case`iframe`:case`object`:Xf(`load`,e);break;case`video`:case`audio`:for(r=0;r<qf.length;r++)Xf(qf[r],e);break;case`image`:Xf(`error`,e),Xf(`load`,e);break;case`details`:Xf(`toggle`,e);break;case`embed`:case`source`:case`link`:Xf(`error`,e),Xf(`load`,e);case`area`:case`base`:case`br`:case`col`:case`hr`:case`keygen`:case`meta`:case`param`:case`track`:case`wbr`:case`menuitem`:for(u in n)if(n.hasOwnProperty(u)&&(r=n[u],r!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:up(e,t,u,r,n,null)}return;default:if(bn(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&dp(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&up(e,t,c,r,n,null))}var fp={};function pp(e,t,n,r){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`input`:var a=null,o=null,s=null,c=null,l=null,u=null,d=null;for(m in n){var f=n[m];if(n.hasOwnProperty(m)&&f!=null)switch(m){case`checked`:break;case`value`:break;case`defaultValue`:l=f;default:r.hasOwnProperty(m)||up(e,t,m,null,r,f)}}for(var p in r){var m=r[p];if(f=n[p],r.hasOwnProperty(p)&&(m!=null||f!=null))switch(p){case`type`:m!==f&&(j=!0),o=m;break;case`name`:m!==f&&(j=!0),a=m;break;case`checked`:m!==f&&(j=!0),u=m;break;case`defaultChecked`:m!==f&&(j=!0),d=m;break;case`value`:m!==f&&(j=!0),s=m;break;case`defaultValue`:m!==f&&(j=!0),c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(i(137,t));break;default:m!==f&&up(e,t,p,m,r,f)}}un(e,s,c,l,u,d,o,a);return;case`select`:for(o in m=s=c=p=null,n)if(l=n[o],n.hasOwnProperty(o)&&l!=null)switch(o){case`value`:break;case`multiple`:m=l;default:r.hasOwnProperty(o)||up(e,t,o,null,r,l)}for(a in r)if(o=r[a],l=n[a],r.hasOwnProperty(a)&&(o!=null||l!=null))switch(a){case`value`:o!==l&&(j=!0),p=o;break;case`defaultValue`:o!==l&&(j=!0),c=o;break;case`multiple`:o!==l&&(j=!0),s=o;default:o!==l&&up(e,t,a,o,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?pn(e,!!n,n?[]:``,!1):pn(e,!!n,t,!0)):pn(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(a=n[c],n.hasOwnProperty(c)&&a!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:up(e,t,c,null,r,a)}for(s in r)if(a=r[s],o=n[s],r.hasOwnProperty(s)&&(a!=null||o!=null))switch(s){case`value`:a!==o&&(j=!0),p=a;break;case`defaultValue`:a!==o&&(j=!0),m=a;break;case`children`:break;case`dangerouslySetInnerHTML`:if(a!=null)throw Error(i(91));break;default:a!==o&&up(e,t,s,a,r,o)}mn(e,p,m);return;case`option`:for(var h in n)if(p=n[h],n.hasOwnProperty(h)&&p!=null&&!r.hasOwnProperty(h))switch(h){case`selected`:e.selected=!1;break;default:up(e,t,h,null,r,p)}for(l in r)if(p=r[l],m=n[l],r.hasOwnProperty(l)&&p!==m&&(p!=null||m!=null))switch(l){case`selected`:p!==m&&(j=!0),e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:up(e,t,l,p,r,m)}return;case`img`:case`link`:case`area`:case`base`:case`br`:case`col`:case`embed`:case`hr`:case`keygen`:case`meta`:case`param`:case`source`:case`track`:case`wbr`:case`menuitem`:for(var g in n)p=n[g],n.hasOwnProperty(g)&&p!=null&&!r.hasOwnProperty(g)&&up(e,t,g,null,r,p);for(u in r)if(p=r[u],m=n[u],r.hasOwnProperty(u)&&p!==m&&(p!=null||m!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:if(p!=null)throw Error(i(137,t));break;default:up(e,t,u,p,r,m)}return;default:if(bn(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&dp(e,t,_,void 0,r,p);for(d in r)p=r[d],m=n[d],!r.hasOwnProperty(d)||p===m||p===void 0&&m===void 0||dp(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&up(e,t,v,null,r,p);for(f in r)p=r[f],m=n[f],!r.hasOwnProperty(f)||p===m||p==null&&m==null||up(e,t,f,p,r,m)}function mp(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function hp(){if(typeof performance.getEntriesByType==`function`){for(var e=0,t=0,n=performance.getEntriesByType(`resource`),r=0;r<n.length;r++){var i=n[r],a=i.transferSize,o=i.initiatorType,s=i.duration;if(a&&s&&mp(o)){for(o=0,s=i.responseEnd,r+=1;r<n.length;r++){var c=n[r],l=c.startTime;if(l>s)break;var u=c.transferSize,d=c.initiatorType;u&&mp(d)&&(c=c.responseEnd,o+=u*(c<s?1:(s-l)/(c-l)))}if(--r,t+=8*(a+o)/(i.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e==`number`)?e:5}var G=null,gp=null;function _p(e){return e.nodeType===9?e:e.ownerDocument}function vp(e){switch(e){case`http://www.w3.org/2000/svg`:return 1;case`http://www.w3.org/1998/Math/MathML`:return 2;default:return 0}}function yp(e,t){if(e===0)switch(t){case`svg`:return 1;case`math`:return 2;default:return 0}return e===1&&t===`foreignObject`?0:e}function bp(e,t,n,r){return n=_p(n).createElement(e),n[Ot]=r,n[kt]=t,W(n,e,t),Ht(n),n}function xp(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.children==`bigint`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Sp=null;function Cp(){var e=window.event;return e&&e.type===`popstate`?e!==Sp&&(Sp=e,!0):(Sp=null,!1)}var wp=typeof setTimeout==`function`?setTimeout:void 0,Tp=typeof clearTimeout==`function`?clearTimeout:void 0,Ep=typeof Promise==`function`?Promise:void 0,Dp=typeof requestAnimationFrame==`function`?requestAnimationFrame:wp,Op=typeof queueMicrotask==`function`?queueMicrotask:Ep===void 0?wp:function(e){return Ep.resolve(null).then(e).catch(kp)};function kp(e){setTimeout(function(){throw e})}function Ap(e){return e===`head`}function jp(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8){if(n=i.data,n===`/$`||n===`/&`){if(r===0){e.removeChild(i),Jh(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)Cm(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,Cm(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[Ft]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&Cm(e.ownerDocument.body)}n=i}while(n);Jh(t)}function Mp(e,t){var n=e;e=0;do{var r=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display=`none`):(n.style.display=n._stashedDisplay||``,n.getAttribute(`style`)===``&&n.removeAttribute(`style`)):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=``):n.nodeValue=n._stashedText||``),r&&r.nodeType===8){if(n=r.data,n===`/$`){if(e===0)break;e--}else n!==`$`&&n!==`$?`&&n!==`$~`&&n!==`$!`||e++}n=r}while(n)}function Np(e,t,n){if(t=CSS.escape(t)===t?t:`r-`+btoa(t).replace(/=/g,``),e.style.viewTransitionName=t,n!=null&&(e.style.viewTransitionClass=n),n=getComputedStyle(e),n.display===`inline`){if(t=e.getClientRects(),t.length===1)var r=1;else for(var i=r=0;i<t.length;i++){var a=t[i];0<a.width&&0<a.height&&r++}r===1&&(e=e.style,e.display=t.length===1?`inline-block`:`block`,e.marginTop=`-`+n.paddingTop,e.marginBottom=`-`+n.paddingBottom)}}function Pp(e,t){e=e.style,t=t.style;var n=t==null?null:t.hasOwnProperty(`viewTransitionName`)?t.viewTransitionName:t.hasOwnProperty(`view-transition-name`)?t[`view-transition-name`]:null;e.viewTransitionName=n==null||typeof n==`boolean`?``:(``+n).trim(),n=t==null?null:t.hasOwnProperty(`viewTransitionClass`)?t.viewTransitionClass:t.hasOwnProperty(`view-transition-class`)?t[`view-transition-class`]:null,e.viewTransitionClass=n==null||typeof n==`boolean`?``:(``+n).trim(),e.display===`inline-block`&&(t==null?e.display=e.margin=``:(n=t.display,e.display=n==null||typeof n==`boolean`?``:n,n=t.margin,n==null?(n=t.hasOwnProperty(`marginTop`)?t.marginTop:t[`margin-top`],e.marginTop=n==null||typeof n==`boolean`?``:n,t=t.hasOwnProperty(`marginBottom`)?t.marginBottom:t[`margin-bottom`],e.marginBottom=t==null||typeof t==`boolean`?``:t):e.margin=n))}function Fp(e,t,n){return n=n.ownerDocument.defaultView,{rect:e,abs:t.position===`absolute`||t.position===`fixed`,clip:t.clipPath!==`none`||t.overflow!==`visible`||t.filter!==`none`||t.mask!==`none`||t.mask!==`none`||t.borderRadius!==`0px`,view:0<=e.bottom&&0<=e.right&&e.top<=n.innerHeight&&e.left<=n.innerWidth}}function Ip(e){return Fp(e.getBoundingClientRect(),getComputedStyle(e),e)}function Lp(e){var t=e.getBoundingClientRect();t=new DOMRect(t.x+2e4,t.y+2e4,t.width,t.height);var n=getComputedStyle(e);return Fp(t,n,e)}function Rp(e){return e.documentElement.clientHeight}function zp(e){this.addEventListener(`load`,e),this.addEventListener(`error`,e)}function Bp(e,t,n,r,i,a,o,s,c){var l=t.nodeType===9?t:t.ownerDocument;try{var u=l.startViewTransition({update:function(){var t=l.defaultView,n=t.navigation&&t.navigation.transition,o=l.fonts.status;r();var s=[];if(o===`loaded`&&(Rp(l),l.fonts.status===`loading`&&s.push(l.fonts.ready)),o=s.length,e!==null)for(var c=e.suspenseyImages,u=0,d=0;d<c.length;d++){var f=c[d];if(!f.complete){var p=f.getBoundingClientRect();if(0<p.bottom&&0<p.right&&p.top<t.innerHeight&&p.left<t.innerWidth){if(u+=nh(f),u>ah){s.length=o;break}f=new Promise(zp.bind(f)),s.push(f)}}}if(0<s.length)return t=Promise.race([Promise.all(s),new Promise(function(e){return setTimeout(e,500)})]).then(i,i),(n?Promise.allSettled([n.finished,t]):t).then(a,a);if(i(),n)return n.finished.then(a,a);a()},types:n});l.__reactViewTransition=u;var d=[];return u.ready.then(function(){for(var e=l.documentElement.getAnimations({subtree:!0}),t=0;t<e.length;t++){var n=e[t],r=n.effect,i=r.pseudoElement;if(i!=null&&i.startsWith(`::view-transition`)){d.push(n),n=r.getKeyframes();for(var a=i=void 0,s=!0,c=0;c<n.length;c++){var u=n[c],f=u.width;if(i===void 0)i=f;else if(i!==f){s=!1;break}if(f=u.height,a===void 0)a=f;else if(a!==f){s=!1;break}delete u.width,delete u.height,u.transform===`none`&&delete u.transform}s&&i!==void 0&&a!==void 0&&(r.setKeyframes(n),s=getComputedStyle(r.target,r.pseudoElement),s.width!==i||s.height!==a)&&(s=n[0],s.width=i,s.height=a,s=n[n.length-1],s.width=i,s.height=a,r.setKeyframes(n))}}o()},function(e){l.__reactViewTransition===u&&(l.__reactViewTransition=null);try{if(typeof e==`object`&&e)switch(e.name){case`InvalidStateError`:(e.message===`View transition was skipped because document visibility state is hidden.`||e.message===`Skipping view transition because document visibility state has become hidden.`||e.message===`Skipping view transition because viewport size changed.`||e.message===`Transition was aborted because of invalid state`)&&(e=null)}e!==null&&c(e)}finally{r(),i(),o()}}),u.finished.finally(function(){for(var e=0;e<d.length;e++)d[e].cancel();l.__reactViewTransition===u&&(l.__reactViewTransition=null),s()}),u}catch{return r(),i(),o(),null}}function Vp(e,t){this._scope=document.documentElement,this._selector=`::view-transition-`+e+`(`+t+`)`}Vp.prototype.animate=function(e,t){return t=typeof t==`number`?{duration:t}:T({},t),t.pseudoElement=this._selector,this._scope.animate(e,t)},Vp.prototype.getAnimations=function(){for(var e=this._scope,t=this._selector,n=e.getAnimations({subtree:!0}),r=[],i=0;i<n.length;i++){var a=n[i].effect;a!==null&&a.target===e&&a.pseudoElement===t&&r.push(n[i])}return r},Vp.prototype.getComputedStyle=function(){return getComputedStyle(this._scope,this._selector)};function Hp(e){return{name:e,group:new Vp(`group`,e),imagePair:new Vp(`image-pair`,e),old:new Vp(`old`,e),new:new Vp(`new`,e)}}function Up(e){this._fragmentFiber=e,this._observers=this._eventListeners=null}Up.prototype.addEventListener=function(e,t,n){var r=null,i=null;if(!(n!=null&&typeof n!=`boolean`&&(r=n.signal||null,r!==null&&r.aborted))){this._eventListeners===null&&(this._eventListeners=[]);var a=this._eventListeners;if(qp(a,e,t,n)===-1){var o=this,s=t;n!=null&&typeof n!=`boolean`&&!0===n.once&&(s=function(r){o.removeEventListener(e,t,n),typeof t==`function`?t.call(this,r):t.handleEvent(r)}),r!==null&&(i=o.removeEventListener.bind(o,e,t,n),r.addEventListener(`abort`,i,{once:!0}),i=r.removeEventListener.bind(r,`abort`,i)),r=Kp(n),a.push({type:e,listener:t,optionsOrUseCapture:n,attachedListener:s,cleanup:i}),p(this._fragmentFiber.child,!1,Wp,e,s,r)}this._eventListeners=a}};function Wp(e,t,n,r){return v(e).addEventListener(t,n,r),!1}Up.prototype.removeEventListener=function(e,t,n){var r=this._eventListeners;if(r!==null&&(t=qp(r,e,t,n),t!==-1)){var i=r[t];n=i.attachedListener;var a=i.cleanup;i=Kp(i.optionsOrUseCapture),p(this._fragmentFiber.child,!1,Gp,e,n,i),r.splice(t,1),a!==null&&a()}};function Gp(e,t,n,r){return v(e).removeEventListener(t,n,r),!1}function Kp(e){return e!=null&&typeof e!=`boolean`&&(!0===e.once||e.signal instanceof AbortSignal)?{capture:e.capture,passive:e.passive}:e}function K(e){return e==null?`c=0`:typeof e==`boolean`?`c=`+(e?`1`:`0`):`c=`+(e.capture?`1`:`0`)}function qp(e,t,n,r){if(e.length===0)return-1;r=K(r);for(var i=0;i<e.length;i++){var a=e[i];if(a.type===t&&a.listener===n&&K(a.optionsOrUseCapture)===r)return i}return-1}Up.prototype.dispatchEvent=function(e){var t=m(this._fragmentFiber);if(t===null)return!0;t=v(t);var n=this._eventListeners;if(n!==null&&0<n.length||!e.bubbles){var r=t.nodeType===9?t.createComment(``):document.createTextNode(``);if(n)for(var i=0;i<n.length;i++){var a=n[i];r.addEventListener(a.type,a.attachedListener,Kp(a.optionsOrUseCapture))}if(t.appendChild(r),e=r.dispatchEvent(e),n)for(i=0;i<n.length;i++)a=n[i],r.removeEventListener(a.type,a.attachedListener,Kp(a.optionsOrUseCapture));return t.removeChild(r),e}return t.dispatchEvent(e)},Up.prototype.focus=function(e){p(this._fragmentFiber.child,!0,Jp,e,void 0,void 0)};function Jp(e,t){return e.tag!==6&&(e=v(e),ym(e,t))}Up.prototype.focusLast=function(e){var t=[];p(this._fragmentFiber.child,!0,Yp,t,void 0,void 0);for(var n=t.length-1;0<=n&&!Jp(t[n],e);n--);};function Yp(e,t){return t.push(e),!1}Up.prototype.blur=function(){var e=m(this._fragmentFiber);e!==null&&(e=v(e),e=_p(e).activeElement,e!==null&&p(this._fragmentFiber.child,!1,Xp,e,void 0,void 0))};function Xp(e,t){return e.tag!==6&&(e=v(e),e===t||e.contains(t)?(t.blur(),!0):!1)}Up.prototype.observeUsing=function(e){this._observers===null&&(this._observers=new Set),this._observers.add(e),p(this._fragmentFiber.child,!1,Zp,e,void 0,void 0)};function Zp(e,t){return e.tag===6||(e=v(e),t.observe(e)),!1}Up.prototype.unobserveUsing=function(e){var t=this._observers;if(t!==null&&t.has(e)){t.delete(e),p(this._fragmentFiber.child,!1,Qp,e,void 0,void 0);for(var n=t=0;n<$p.length;n++){var r=$p[n];r.fragmentInstance===this&&r.observer===e?e.unobserve(r.instance):$p[t++]=r}$p.length=t}};function Qp(e,t){return e.tag===6||(e=v(e),t.unobserve(e)),!1}var $p=[],em=!1;function tm(e,t,n){$p.push({fragmentInstance:e,observer:t,instance:n}),em||(em=!0,bm(function(){em=!1;var e=$p;$p=[];for(var t=0;t<e.length;t++){var n=e[t];n.observer.unobserve(n.instance)}}))}Up.prototype.getClientRects=function(){var e=[];return p(this._fragmentFiber.child,!1,nm,e,void 0,void 0),e};function nm(e,t){if(e.tag===6){e=e.stateNode;var n=e.ownerDocument.createRange();n.selectNodeContents(e),t.push.apply(t,n.getClientRects())}else e=v(e),t.push.apply(t,e.getClientRects());return!1}Up.prototype.getRootNode=function(e){var t=m(this._fragmentFiber);return t===null?this:v(t).getRootNode(e)},Up.prototype.compareDocumentPosition=function(e){var t=m(this._fragmentFiber);if(t===null)return Node.DOCUMENT_POSITION_DISCONNECTED;var n=[];p(this._fragmentFiber.child,!1,Yp,n,void 0,void 0);var r=v(t);if(n.length===0){if(n=r,h(this._fragmentFiber)){a:{for(t=this._fragmentFiber.return;t!==null;){if(t.tag===4){t=t.stateNode.containerInfo;break a}if(t.tag===3||t.tag===5||t.tag===27)break;t=t.return}t=null}t!=null&&(n=t)}t=this._fragmentFiber;var i=r=n.compareDocumentPosition(e);return n===e?i=Node.DOCUMENT_POSITION_CONTAINS:r&Node.DOCUMENT_POSITION_CONTAINED_BY&&(n=g(t)[1],n===null?i=Node.DOCUMENT_POSITION_PRECEDING:(e=v(n).compareDocumentPosition(e),i=e===0||e&Node.DOCUMENT_POSITION_FOLLOWING?Node.DOCUMENT_POSITION_FOLLOWING:Node.DOCUMENT_POSITION_PRECEDING)),i|=Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC}t=v(n[0]),i=v(n[n.length-1]);var a=h(this._fragmentFiber)?t.parentElement:r;if(a==null)return Node.DOCUMENT_POSITION_DISCONNECTED;r=a.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_CONTAINED_BY,a=a.compareDocumentPosition(i)&Node.DOCUMENT_POSITION_CONTAINED_BY;var o=t.compareDocumentPosition(e),s=i.compareDocumentPosition(e),c=o&Node.DOCUMENT_POSITION_CONTAINED_BY||s&Node.DOCUMENT_POSITION_CONTAINED_BY;return s=r&&a&&o&Node.DOCUMENT_POSITION_FOLLOWING&&s&Node.DOCUMENT_POSITION_PRECEDING,t=r&&t===e||a&&i===e||c||s?Node.DOCUMENT_POSITION_CONTAINED_BY:!r&&t===e||!a&&i===e?Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:o,t&Node.DOCUMENT_POSITION_DISCONNECTED||t&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC||rm(t,this._fragmentFiber,n[0],n[n.length-1],e)?t:Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC};function rm(e,t,n,r,i){var a=Rt(i);if(e&Node.DOCUMENT_POSITION_CONTAINED_BY){if(n=!!a)a:{for(;a!==null;){if(a.tag===7&&(a===t||a.alternate===t)){n=!0;break a}a=a.return}n=!1}return n}if(e&Node.DOCUMENT_POSITION_CONTAINS){if(a===null)return a=i.ownerDocument,i===a||i===a.documentElement||i===a.body;a:{for(a=t,t=m(t);a!==null;){if(!(a.tag!==5&&a.tag!==3&&a.tag!==27||a!==t&&a.alternate!==t)){a=!0;break a}a=a.return}a=!1}return a}return e&Node.DOCUMENT_POSITION_PRECEDING?((t=!!a)&&!(t=a===n)&&(t=w(n,a,C),t===null?t=!1:(p(t,!0,x,a,n),a=y,y=null,t=a!==null)),t):e&Node.DOCUMENT_POSITION_FOLLOWING?((t=!!a)&&!(t=a===r)&&(t=w(r,a,C),t===null?t=!1:(p(t,!0,S,a,r),a=y,b=y=null,t=a!==null)),t):!1}function im(e,t){var n=e.ownerDocument.createRange();n.selectNodeContents(e),e=n.getBoundingClientRect(),window.scrollTo(window.scrollX+e.left,t?window.scrollY+e.top:window.scrollY+e.bottom-window.innerHeight)}Up.prototype.scrollIntoView=function(e){if(typeof e==`object`)throw Error(i(566));var t=[];p(this._fragmentFiber.child,!1,Yp,t,void 0,void 0);var n=!1!==e;if(t.length===0){var r=g(this._fragmentFiber);if(r=n?r[1]||r[0]||m(this._fragmentFiber):r[0]||r[1],r===null)return;if(r.tag===6){e=v(r),im(e,n);return}if(r=v(r),r.nodeType!==9){if(r.nodeType===11){n=`host`in r?r.host:null,n!==null&&n.scrollIntoView(e);return}r.scrollIntoView(e)}}for(r=n?t.length-1:0;r!==(n?-1:t.length);){var a=t[r];a.tag===6?(a=v(a),im(a,n)):v(a).scrollIntoView(e),r+=n?-1:1}};function am(e,t){return e=v(e),q(e,t),!1}function q(e,t){e.reactFragments??=new Set,e.reactFragments.add(t)}function om(e,t){var n=t._eventListeners;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];e.addEventListener(i.type,i.attachedListener,Kp(i.optionsOrUseCapture))}e.nodeType!==3&&(n=t._observers,n!==null&&n.forEach(function(n){for(var r=0,i=0;i<$p.length;i++){var a=$p[i];(a.fragmentInstance!==t||a.observer!==n||a.instance!==e)&&($p[r++]=a)}$p.length=r,n.observe(e)}),q(e,t))}function sm(e,t){var n=t._eventListeners;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];e.removeEventListener(i.type,i.attachedListener,Kp(i.optionsOrUseCapture))}e.nodeType!==3&&(n=t._observers,n!==null&&n.forEach(function(n){typeof n.rootMargin==`string`?tm(t,n,e):n.unobserve(e)}),e.reactFragments!=null&&e.reactFragments.delete(t))}function cm(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case`HTML`:case`HEAD`:case`BODY`:cm(n),Lt(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function lm(e,t,n,r){for(;e.nodeType===1;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!==`INPUT`||e.type!==`hidden`))break}else if(!r){if(t===`input`&&e.type===`hidden`){var a=i.name==null?null:``+i.name;if(i.type===`hidden`&&e.getAttribute(`name`)===a)return e}else return e}else if(!e[Ft])switch(t){case`meta`:if(!e.hasAttribute(`itemprop`))break;return e;case`link`:if(a=e.getAttribute(`rel`),a===`stylesheet`&&e.hasAttribute(`data-precedence`)||a!==i.rel||e.getAttribute(`href`)!==(i.href==null||i.href===``?null:i.href)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute(`title`)!==(i.title==null?null:i.title))break;return e;case`style`:if(e.hasAttribute(`data-precedence`))break;return e;case`script`:if(a=e.getAttribute(`src`),(a!==(i.src==null?null:i.src)||e.getAttribute(`type`)!==(i.type==null?null:i.type)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin))&&a&&e.hasAttribute(`async`)&&!e.hasAttribute(`itemprop`))break;return e;default:return e}if(e=hm(e.nextSibling),e===null)break}return null}function um(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=hm(e.nextSibling),e===null))return null;return e}function dm(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=hm(e.nextSibling),e===null))return null;return e}function fm(e){return e.data===`$?`||e.data===`$~`}function pm(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function mm(e,t){var n=e.ownerDocument;if(e.data===`$~`)e._reactRetry=t;else if(e.data!==`$?`||n.readyState!==`loading`)t();else{var r=function(){t(),n.removeEventListener(`DOMContentLoaded`,r)};n.addEventListener(`DOMContentLoaded`,r),e._reactRetry=r}}function hm(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t===`$`||t===`$!`||t===`$?`||t===`$~`||t===`&`||t===`F!`||t===`F`)break;if(t===`/$`||t===`/&`)return null}}return e}var gm=null;function _m(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return hm(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function vm(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`||n===`$~`||n===`&`){if(t===0)return e;t--}else n!==`/$`&&n!==`/&`||t++}e=e.previousSibling}return null}function ym(e,t){function n(){r=!0}if(e.ownerDocument.activeElement===e)return!0;var r=!1;try{e.ownerDocument.addEventListener(`focus`,n,!0),(e.focus||HTMLElement.prototype.focus).call(e,t)}finally{e.ownerDocument.removeEventListener(`focus`,n,!0)}return r}function bm(e){Dp(function(){Dp(function(t){return e(t)})})}function xm(e,t,n){switch(t=_p(n),e){case`html`:if(e=t.documentElement,!e)throw Error(i(452));return e;case`head`:if(e=t.head,!e)throw Error(i(453));return e;case`body`:if(e=t.body,!e)throw Error(i(454));return e;default:throw Error(i(451))}}function Sm(e,t,n){for(var r in n){var i=n[r];n.hasOwnProperty(r)&&i!=null&&up(e,t,r,null,fp,i)}n.dangerouslySetInnerHTML!=null&&(e.textContent=``),e.onclick===wn&&(e.onclick=null),Lt(e)}function Cm(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Lt(e)}var wm=new Map,Tm=new Set;function Em(e){if(typeof e.getRootNode==`function`){var t=e.getRootNode();if(t.nodeType===9||t.nodeType===11)return t}return e.nodeType===9?e:e.ownerDocument}var Dm=A.d;A.d={f:Om,r:km,D:Mm,C:Nm,L:Pm,m:Fm,X:Lm,S:Im,M:Rm};function Om(){var e=Dm.f(),t=Kd();return e||t}function km(e){var t=zt(e);t!==null&&t.tag===5&&t.type===`form`?ic(t):Dm.r(e)}var Am=typeof document>`u`?null:document;function jm(e,t,n){var r=Am;if(r&&typeof t==`string`&&t){var i=ln(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),Tm.has(i)||(Tm.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),W(t,`link`,e),Ht(t),r.head.appendChild(t)))}}function Mm(e){Dm.D(e),jm(`dns-prefetch`,e,null)}function Nm(e,t){Dm.C(e,t),jm(`preconnect`,e,t)}function Pm(e,t,n){Dm.L(e,t,n);var r=Am;if(r&&e&&t){var i=`link[rel="preload"][as="`+ln(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+ln(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+ln(n.imageSizes)+`"]`)):i+=`[href="`+ln(e)+`"]`;var a=i;switch(t){case`style`:a=Bm(e);break;case`script`:a=Wm(e)}if(!(wm.has(a)||(e=T({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),wm.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Vm(a))||t===`script`&&r.querySelector(Gm(a))))){var o=r.createElement(`link`);W(o,`link`,e),t===`style`&&(o[It]=!0,o.onload=o.onerror=function(){Ut(o)}),Ht(o),r.head.appendChild(o)}}}function Fm(e,t){Dm.m(e,t);var n=Am;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+ln(r)+`"][href="`+ln(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Wm(e)}if(!wm.has(a)&&(e=T({rel:`modulepreload`,href:e},t),wm.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Gm(a)))return}r=n.createElement(`link`),W(r,`link`,e),Ht(r),n.head.appendChild(r)}}}function Im(e,t,n){Dm.S(e,t,n);var r=Am;if(r&&e){var i=Vt(r).hoistableStyles,a=Bm(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Vm(a)))s.loading=5;else{e=T({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=wm.get(a))&&Jm(e,n);var c=o=r.createElement(`link`);Ht(c),W(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,qm(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Lm(e,t){Dm.X(e,t);var n=Am;if(n&&e){var r=Vt(n).hoistableScripts,i=Wm(e),a=r.get(i);a||(a=n.querySelector(Gm(i)),a||(e=T({src:e,async:!0},t),(t=wm.get(i))&&Ym(e,t),a=n.createElement(`script`),Ht(a),W(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Rm(e,t){Dm.M(e,t);var n=Am;if(n&&e){var r=Vt(n).hoistableScripts,i=Wm(e),a=r.get(i);a||(a=n.querySelector(Gm(i)),a||(e=T({src:e,async:!0,type:`module`},t),(t=wm.get(i))&&Ym(e,t),a=n.createElement(`script`),Ht(a),W(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function zm(e,t,n,r){var a=(a=Oe.current)?Em(a):null;if(!a)throw Error(i(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(n=Bm(n.href),t=Vt(a).hoistableStyles,r=t.get(n),r||(r={type:`style`,instance:null,count:0,state:null},t.set(n,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Bm(n.href);var o=Vt(a).hoistableStyles,s=o.get(e);if(s||(a=a.ownerDocument||a,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=a.querySelector(Vm(e)))?o._p||(s.instance=o,s.state.loading=5):(o=wm.get(e),o||(o={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},wm.set(e,o)),Um(a,e,o,s.state))),t&&r===null)throw Error(i(528,``));return s}if(t&&r!==null)throw Error(i(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(n=Wm(n),t=Vt(a).hoistableScripts,r=t.get(n),r||(r={type:`script`,instance:null,count:0,state:null},t.set(n,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(i(444,e))}}function Bm(e){return`href="`+ln(e)+`"`}function Vm(e){return`link[rel="stylesheet"][`+e+`]`}function Hm(e){return T({},e,{"data-precedence":e.precedence,precedence:null})}function Um(e,t,n,r){if(t=e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)){if(!0!==t[It]){r.loading=1;return}}else t=e.createElement(`link`),t[It]=!0,t.onload=t.onerror=Ut.bind(null,t),W(t,`link`,n),Ht(t),e.head.appendChild(t);r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2})}function Wm(e){return`[src="`+ln(e)+`"]`}function Gm(e){return`script[async]`+e}function Km(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+ln(n.href)+`"]`);if(r)return t.instance=r,Ht(r),r;var a=T({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),Ht(r),W(r,`style`,a),qm(r,n.precedence,e),t.instance=r;case`stylesheet`:a=Bm(n.href);var o=e.querySelector(Vm(a));if(o)return t.state.loading|=4,t.instance=o,Ht(o),o;r=Hm(n),(a=wm.get(a))&&Jm(r,a),o=(e.ownerDocument||e).createElement(`link`),Ht(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),W(o,`link`,r),t.state.loading|=4,qm(o,n.precedence,e),t.instance=o;case`script`:return o=Wm(n.src),(a=e.querySelector(Gm(o)))?(t.instance=a,Ht(a),a):(r=n,(a=wm.get(o))&&(r=T({},n),Ym(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),Ht(a),W(a,`link`,r),e.head.appendChild(a),t.instance=a);case`void`:return null;default:throw Error(i(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,qm(r,n.precedence,e));return t.instance}function qm(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o<r.length;o++){var s=r[o];if(s.dataset.precedence===t)a=s;else if(a!==i)break}a?a.parentNode.insertBefore(e,a.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function Jm(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function Ym(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var Xm=null;function Zm(e,t,n){if(Xm===null){var r=new Map,i=Xm=new Map;i.set(n,r)}else i=Xm,r=i.get(n),r||(r=new Map,i.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),i=0;i<n.length;i++){var a=n[i];if(!(a[Ft]||a[Ot]||e===`link`&&a.getAttribute(`rel`)===`stylesheet`)&&a.namespaceURI!==`http://www.w3.org/2000/svg`){var o=a.getAttribute(t)||``;o=e+o;var s=r.get(o);s?s.push(a):r.set(o,[a])}}return r}function Qm(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function $m(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function eh(e,t){return e===`img`&&t.src!=null&&t.src!==``&&t.onLoad==null&&t.loading!==`lazy`}function th(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function nh(e){return(e.width||100)*(e.height||100)*(typeof devicePixelRatio==`number`?devicePixelRatio:1)*.25}function rh(e,t){typeof t.decode==`function`&&(e.imgCount++,t.complete||(e.imgBytes+=nh(t),e.suspenseyImages.push(t)),e=lh.bind(e),t.decode().then(e,e))}function ih(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Bm(r.href),a=t.querySelector(Vm(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=ch.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,Ht(a);return}a=t.ownerDocument||t,r=Hm(r),(i=wm.get(i))&&Jm(r,i),a=a.createElement(`link`),Ht(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),W(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=ch.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var ah=0;function oh(e,t){return e.stylesheets&&e.count===0&&dh(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&dh(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&ah===0&&(ah=62500*hp());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&dh(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>ah?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function sh(e){if(e.count===0&&(e.imgCount===0||!e.waitingForImages)){if(e.stylesheets)dh(e,e.stylesheets);else if(e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}}}function ch(){this.count--,sh(this)}function lh(){this.imgCount--,sh(this)}var uh=null;function dh(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,uh=new Map,t.forEach(fh,e),uh=null,ch.call(e))}function fh(e,t){if(!(t.state.loading&4)){var n=uh.get(e);if(n)var r=n.get(null);else{n=new Map,uh.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a<i.length;a++){var o=i[a];(o.nodeName===`LINK`||o.getAttribute(`media`)!==`not all`)&&(n.set(o.dataset.precedence,o),r=o)}r&&n.set(null,r)}i=t.instance,o=i.getAttribute(`data-precedence`),a=n.get(o)||r,a===r&&n.set(null,i),n.set(o,i),this.count++,r=ch.bind(this),i.addEventListener(`load`,r),i.addEventListener(`error`,r),a?a.parentNode.insertBefore(i,a.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var ph={$$typeof:ae,Provider:null,Consumer:null,_currentValue:be,_currentValue2:be,_threadCount:0};function mh(e,t,n,r,i,a,o,s,c){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=_t(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=_t(0),this.hiddenUpdates=_t(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.transitionTypes=null,this.incompleteTransitions=new Map}function hh(e,t,n,r,i,a,o,s,c,l,u,d){return e=new mh(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=Ri(3,null,null,t),e.current=a,a.stateNode=e,t=Ma(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},ho(a),e}function gh(e){return e?(e=Ii,e):Ii}function _h(e,t,n,r,i,a){i=gh(i),r.context===null?r.context=i:r.pendingContext=i,r=_o(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=vo(e,r,t),n!==null&&(Vd(n,e,t),yo(n,e,t))}function vh(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function yh(e,t){vh(e,t),(e=e.alternate)&&vh(e,t)}function bh(e){if(e.tag===13||e.tag===31){var t=N(e,67108864);t!==null&&Vd(t,e,67108864),yh(e,67108864)}}function xh(e){if(e.tag===13||e.tag===31){var t=Rd();t=Ct(t);var n=N(e,t);n!==null&&Vd(n,e,t),yh(e,t)}}var Sh=!0;function Ch(e,t,n,r){var i=k.T;k.T=null;var a=A.p;try{A.p=2,Th(e,t,n,r)}finally{A.p=a,k.T=i}}function wh(e,t,n,r){var i=k.T;k.T=null;var a=A.p;try{A.p=8,Th(e,t,n,r)}finally{A.p=a,k.T=i}}function Th(e,t,n,r){if(Sh){var i=Eh(r);if(i===null)tp(e,t,r,Dh,n),Rh(e,r);else if(Bh(i,e,t,n,r))r.stopPropagation();else if(Rh(e,r),t&4&&-1<Lh.indexOf(e)){for(;i!==null;){var a=zt(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=dt(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-it(o);s.entanglements[1]|=c,o&=~c}Pf(a),!(rd&6)&&(Cd=Ke()+500,Ff(0,!1))}}break;case 31:case 13:s=N(a,2),s!==null&&Vd(s,a,2),Kd(),yh(a,2)}if(a=Eh(r),a===null&&tp(e,t,r,Dh,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else tp(e,t,r,null,n)}}function Eh(e){return e=En(e),Oh(e)}var Dh=null;function Oh(e){if(Dh=null,e=Rt(e),e!==null){var t=o(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=s(t),e!==null)return e;e=null}else if(n===31){if(e=c(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return Dh=e,null}function kh(e){switch(e){case`beforetoggle`:case`cancel`:case`click`:case`close`:case`contextmenu`:case`copy`:case`cut`:case`auxclick`:case`dblclick`:case`dragend`:case`dragstart`:case`drop`:case`focusin`:case`focusout`:case`input`:case`invalid`:case`keydown`:case`keypress`:case`keyup`:case`mousedown`:case`mouseup`:case`paste`:case`pause`:case`play`:case`pointercancel`:case`pointerdown`:case`pointerup`:case`ratechange`:case`reset`:case`seeked`:case`submit`:case`toggle`:case`touchcancel`:case`touchend`:case`touchstart`:case`volumechange`:case`change`:case`selectionchange`:case`textInput`:case`compositionstart`:case`compositionend`:case`compositionupdate`:case`beforeblur`:case`afterblur`:case`beforeinput`:case`blur`:case`fullscreenchange`:case`fullscreenerror`:case`focus`:case`hashchange`:case`popstate`:case`select`:case`selectstart`:return 2;case`drag`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`mousemove`:case`mouseout`:case`mouseover`:case`pointermove`:case`pointerout`:case`pointerover`:case`resize`:case`scroll`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 8;case`message`:switch(qe()){case Je:return 2;case Ye:return 8;case Xe:case Ze:return 32;case Qe:return 268435456;default:return 32}default:return 32}}var Ah=!1,jh=null,Mh=null,Nh=null,Ph=new Map,Fh=new Map,Ih=[],Lh=`mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset`.split(` `);function Rh(e,t){switch(e){case`focusin`:case`focusout`:jh=null;break;case`dragenter`:case`dragleave`:Mh=null;break;case`mouseover`:case`mouseout`:Nh=null;break;case`pointerover`:case`pointerout`:Ph.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:Fh.delete(t.pointerId)}}function zh(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=zt(t),t!==null&&bh(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Bh(e,t,n,r,i){switch(t){case`focusin`:return jh=zh(jh,e,t,n,r,i),!0;case`dragenter`:return Mh=zh(Mh,e,t,n,r,i),!0;case`mouseover`:return Nh=zh(Nh,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return Ph.set(a,zh(Ph.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,Fh.set(a,zh(Fh.get(a)||null,e,t,n,r,i)),!0}return!1}function Vh(e){var t=Rt(e.target);if(t!==null){var n=o(t);if(n!==null){if(t=n.tag,t===13){if(t=s(n),t!==null){e.blockedOn=t,Et(e.priority,function(){xh(n)});return}}else if(t===31){if(t=c(n),t!==null){e.blockedOn=t,Et(e.priority,function(){xh(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Hh(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Eh(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Tn=r,n.target.dispatchEvent(r),Tn=null}else return t=zt(n),t!==null&&bh(t),e.blockedOn=n,!1;t.shift()}return!0}function Uh(e,t,n){Hh(e)&&n.delete(t)}function Wh(){Ah=!1,jh!==null&&Hh(jh)&&(jh=null),Mh!==null&&Hh(Mh)&&(Mh=null),Nh!==null&&Hh(Nh)&&(Nh=null),Ph.forEach(Uh),Fh.forEach(Uh)}function Gh(e,n){e.blockedOn===n&&(e.blockedOn=null,Ah||(Ah=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Wh)))}var Kh=null;function qh(e){Kh!==e&&(Kh=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Kh===e&&(Kh=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],i=e[t+2];if(typeof r!=`function`){if(Oh(r||n)===null)continue;break}var a=zt(n);a!==null&&(e.splice(t,3),t-=3,nc(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Jh(e){function t(t){return Gh(t,e)}jh!==null&&Gh(jh,e),Mh!==null&&Gh(Mh,e),Nh!==null&&Gh(Nh,e),Ph.forEach(t),Fh.forEach(t);for(var n=0;n<Ih.length;n++){var r=Ih[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<Ih.length&&(n=Ih[0],n.blockedOn===null);)Vh(n),n.blockedOn===null&&Ih.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var i=n[r],a=n[r+1],o=i[kt]||null;if(typeof a==`function`)o||qh(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[kt]||null)s=o.formAction;else if(Oh(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),qh(n)}}}function Yh(){function e(e){e.canIntercept&&e.info===`react-transition`&&e.intercept({handler:function(){return new Promise(function(e){return i=e})},focusReset:`manual`,scroll:`manual`})}function t(){i!==null&&(i(),i=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var e=navigation.currentEntry;e&&e.url!=null&&navigation.navigate(e.url,{state:e.getState(),info:`react-transition`,history:`replace`})}}if(typeof navigation==`object`){var r=!1,i=null;return navigation.addEventListener(`navigate`,e),navigation.addEventListener(`navigatesuccess`,t),navigation.addEventListener(`navigateerror`,t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener(`navigate`,e),navigation.removeEventListener(`navigatesuccess`,t),navigation.removeEventListener(`navigateerror`,t),i!==null&&(i(),i=null)}}}function Xh(e){this._internalRoot=e}Zh.prototype.render=Xh.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(i(409));var n=t.current;_h(n,Rd(),e,t,null,null)},Zh.prototype.unmount=Xh.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;_h(e.current,2,null,e,null,null),Kd(),t[At]=null}};function Zh(e){this._internalRoot=e}Zh.prototype.unstable_scheduleHydration=function(e){if(e){var t=Tt();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Ih.length&&t!==0&&t<Ih[n].priority;n++);Ih.splice(n,0,e),n===0&&Vh(e)}};var Qh=n.version;if(Qh!==`19.3.0`)throw Error(i(527,Qh,`19.3.0`));A.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(i(188)):(e=Object.keys(e).join(`,`),Error(i(268,e)));return e=u(t),e=e===null?null:f(e),e=e===null?null:e.stateNode,e};var $h={bundleType:0,version:`19.3.0`,rendererPackageName:`react-dom`,currentDispatcherRef:k,reconcilerVersion:`19.3.0`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var eg=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!eg.isDisabled&&eg.supportsFiber)try{tt=eg.inject($h),nt=eg}catch{}}e.createRoot=function(e,t){if(!a(e))throw Error(i(299));var n=!1,r=``,o=Tc,s=Ec,c=Dc;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(o=t.onUncaughtError),t.onCaughtError!==void 0&&(s=t.onCaughtError),t.onRecoverableError!==void 0&&(c=t.onRecoverableError)),t=hh(e,1,!1,null,null,n,r,null,o,s,c,Yh),e[At]=t.current,$f(e),new Xh(t)}})),gi=o(((e,t)=>{function n(){if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE==`function`)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=hi()}))(),_i=`0.3.3`;function vi(e){return typeof e==`string`&&/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/.test(e)&&e.split(`.`).every(e=>Number.isSafeInteger(Number(e)))}function yi(e,t){if(!vi(e)||!vi(t))return!1;let n=e.split(`.`).map(Number),r=t.split(`.`).map(Number);for(let e=0;e<3;e++)if(n[e]!==r[e])return n[e]>r[e];return!1}function bi(e){let{gateway:t,frontend:n,installed:r,web:i}=e;if(t&&t.protocolVersion!==4)return`incompatible`;if(t&&(yi(t.installedVersion,t.runningVersion)||yi(r,t.runningVersion)||yi(n,t.runningVersion))||i&&(yi(i.installedVersion,i.runningVersion)||yi(t?.runningVersion,i.runningVersion)||yi(n,i.runningVersion)))return`restart-service`;if(i){if(yi(i.runningVersion,n))return`refresh-page`}else if(yi(r,n)||yi(t?.runningVersion,n))return`restart-tui`;return t?.checkState===`ok`&&yi(t.latestVersion,r)?`install`:`none`}var xi=class extends Error{constructor(){super(`Application protocol incompatible. Update neko, then restart its TUI/Web or serve.`),this.name=`ApplicationProtocolError`}};function Si(e){let t=``;for(let n of e)t+=String.fromCharCode(n);return btoa(t)}function Ci(e){return Uint8Array.from(atob(e),e=>e.charCodeAt(0))}async function wi(e,t){let n=await t.begin({name:e.name,mimeType:e.mimeType,size:e.bytes.length});try{for(let r=0;r<e.bytes.length;r+=262144)await t.append({id:n,offset:r,data:Si(e.bytes.subarray(r,r+262144))});return await t.finish(n),n}catch(e){throw await t.release(n).catch(()=>{}),e}}async function Ti(e){let t=[],n=0,r=0,i=``;do{let a=await e(n);if(!Number.isSafeInteger(a.total)||a.total<=0||a.total>20971520||n>0&&(a.total!==r||a.mimeType!==i))throw Error(`Invalid image size or format`);if(r=a.total,i=a.mimeType,a.data.length>349528)throw Error(`Image chunk is too large`);let o=Ci(a.data);if(o.length>262144||n+o.length>r||!o.length&&n<r)throw Error(`Incomplete image`);t.push(o),n+=o.length}while(n<r);let a=new Uint8Array(n),o=0;for(let e of t)a.set(e,o),o+=e.length;return{name:`Image`,mimeType:i,bytes:a}}function Ei(e){let t=/^\/compact(?:\s+([\s\S]*))?$/.exec(e.trim());return t?t[1]?.trim()??``:null}var Di=(e,t=`New session`)=>e.title||e.firstPromptPreview||t,Oi=e=>e.lastMessageAt??e.createdAt,ki=(e,t)=>Oi(t)-Oi(e)||Number(t.id)-Number(e.id),Ai=(e,t)=>t.lastUsedAt-e.lastUsedAt||Number(t.id)-Number(e.id),ji=(e,t)=>`${e.title} ${e.firstPromptPreview} ${e.id}`.toLocaleLowerCase().includes(t.trim().toLocaleLowerCase());function Mi(e,t,n=`en`){let r=Math.floor(Math.max(0,t-e)/6e4);if(r<1)return n===`zh`?`刚刚`:`now`;let i=Math.floor(r/60),a=Math.floor(i/24);if(a>=30)return new Date(e).toLocaleDateString(n===`zh`?`zh-CN`:`en-GB`);let o=a||i||r,s=a?[`天`,`d`]:i?[`小时`,`h`]:[`分钟`,`m`];return n===`zh`?`${o} ${s[0]}前`:`${o}${s[1]}`}var Ni=new Set([`superseded`,`upgrade_conflict`]),N=class extends Error{code;reason;retryable;details;constructor(e,t,n){super(`${e}${n?.reason?`/${n.reason}`:``}: ${t}`,{cause:n?.cause}),this.name=`ChordError`,this.code=e,this.reason=n?.reason,this.retryable=Ni.has(e),this.details=n?.details}},Pi=(e,t,n)=>new N(`invalid`,t,{reason:e,details:n}),Fi=(e,t)=>e instanceof N?e:new N(`unavailable`,`${t}: ${e instanceof Error?e.message:String(e)}`,{cause:e});async function Ii(e,t){let n=[];for(let t of e)try{await t()}catch(e){n.push(e)}if(n.length===1)throw n[0];if(n.length>1)throw AggregateError(n,t)}function Li(e,t){return t[e.length]?.(...e)??(()=>{throw Error(`Invalid Arguments`)})()}function Ri(e,t,n){return e>=t&&e<=n}function zi(e){return e===8205}function Bi(e){return Ri(e,55296,56319)}function Vi(e){return Ri(e,127462,127487)}function Hi(e){return Ri(e,65024,65039)}function Ui(e){return Ri(e,768,879)||Ri(e,6832,6911)||Ri(e,7616,7679)||Ri(e,65056,65071)}function Wi(e){return e>65535?2:1}function Gi(e,t){for(;t<e.length;){let n=e.codePointAt(t);if(Ui(n)||Hi(n))t+=Wi(n);else break}return t}function Ki(e,t){let n=e.codePointAt(t),r=t+Wi(n);for(r=Gi(e,r);r<e.length-1&&zi(e.codePointAt(r));){let t=e.codePointAt(r+1);r+=1+Wi(t),r=Gi(e,r)}return Vi(n)&&r<e.length&&Vi(e.codePointAt(r))&&(r+=Wi(e.codePointAt(r))),r}function qi(e){return e>=768&&(Bi(e)||Ui(e)||Hi(e)||zi(e))}function Ji(e){let t=0,n=0;for(;n<e.length;)n=Ki(e,n),t++;return t}function Yi(e,t){let n=0,r=0;for(;r<e.length;)if(r=Ki(e,r),++n>=t)return!0;return!1}function Xi(e,t){let n=0,r=0;for(;r<e.length;)if(r=Ki(e,r),++n>t)return!1;return!0}function Zi(e,t){if(t===0)return!0;if(e.length<t)return!1;let n=0;for(;;){if(qi(e.charCodeAt(n)))return Yi(e,t);if(++n>=t)return!0}}function Qi(e,t){if(e.length<=t)return!0;let n=0;for(;;){if(qi(e.charCodeAt(n)))return Xi(e,t);if(++n>t)return!1}}var $i=s({Counted:()=>wa,Entries:()=>Da,EntriesRegExp:()=>Ea,Every:()=>ba,EveryAll:()=>xa,GraphemeCount:()=>_a,HasPropertyKey:()=>z,IsArray:()=>P,IsBigInt:()=>ea,IsBoolean:()=>ta,IsClassInstance:()=>ha,IsConstructor:()=>na,IsDeepEqual:()=>Ma,IsEqual:()=>L,IsFunction:()=>ra,IsGreaterEqualThan:()=>pa,IsGreaterThan:()=>ua,IsInteger:()=>ia,IsLessEqualThan:()=>fa,IsLessThan:()=>da,IsMaxLength:()=>va,IsMinLength:()=>ya,IsMultipleOf:()=>ma,IsNull:()=>aa,IsNumber:()=>oa,IsObject:()=>F,IsObjectNotArray:()=>sa,IsString:()=>I,IsSymbol:()=>ca,IsUndefined:()=>la,IsUnsafePropertyKey:()=>Ta,IsValueLike:()=>ga,Keys:()=>B,ShiftLeft:()=>R,Some:()=>Sa,SomeAll:()=>Ca,Symbols:()=>Oa,Values:()=>ka});function P(e){return Array.isArray(e)}function ea(e){return L(typeof e,`bigint`)}function ta(e){return L(typeof e,`boolean`)}function na(e){if(la(e)||!ra(e))return!1;let t=Function.prototype.toString.call(e);return!!(/^class\s/.test(t)||/\[native code\]/.test(t))}function ra(e){return L(typeof e,`function`)}function ia(e){return Number.isInteger(e)}function aa(e){return L(e,null)}function oa(e){return Number.isFinite(e)}function sa(e){return F(e)&&!P(e)}function F(e){return L(typeof e,`object`)&&!aa(e)}function I(e){return L(typeof e,`string`)}function ca(e){return L(typeof e,`symbol`)}function la(e){return L(e,void 0)}function L(e,t){return e===t}function ua(e,t){return e>t}function da(e,t){return e<t}function fa(e,t){return e<=t}function pa(e,t){return e>=t}function ma(e,t){if(ea(e)||ea(t))return BigInt(e)%BigInt(t)===0n;if(!oa(e)||ia(e)&&1/t%1==0)return!0;let n=e%t;return Math.min(Math.abs(n),Math.abs(n-t),Math.abs(n+t))<1e-10}function ha(e){if(!F(e))return!1;let t=globalThis.Object.getPrototypeOf(e);return!aa(t)&&L(typeof t.constructor,`function`)&&!(L(t.constructor,globalThis.Object)||L(t.constructor.name,`Object`))}function ga(e){return ea(e)||ta(e)||aa(e)||oa(e)||I(e)||la(e)}function _a(e){return Ji(e)}function va(e,t){return Qi(e,t)}function ya(e,t){return Zi(e,t)}function ba(e,t,n){return e.every((e,r)=>r<t||n(e,r))}function xa(e,t,n){let r=!0;return e.forEach((e,i)=>{i>=t&&!n(e,i)&&(r=!1)}),r}function Sa(e,t){return e.some((e,n)=>t(e,n))}function Ca(e,t){let n=!1;return e.forEach((e,r)=>{t(e,r)&&(n=!0)}),n}function wa(e,t){return e.reduce((e,n,r)=>t(n,r)?++e:e,0)}function R(e,t,n){return L(e.length,0)?n():t(e[0],e.slice(1))}function Ta(e){return L(e,`__proto__`)||L(e,`constructor`)||L(e,`prototype`)}function z(e,t){return Ta(t)?Object.prototype.hasOwnProperty.call(e,t):t in e}function Ea(e){return B(e).map(t=>[RegExp(`^${t}$`),e[t]])}function Da(e){return Object.entries(e)}function B(e){return Object.getOwnPropertyNames(e)}function Oa(e){return Object.getOwnPropertySymbols(e)}function ka(e){return Object.values(e)}function Aa(e,t){if(!F(t))return!1;let n=B(e);return L(n.length,B(t).length)&&n.every(n=>Ma(e[n],t[n]))}function ja(e,t){return P(t)&&L(e.length,t.length)&&e.every((n,r)=>Ma(e[r],t[r]))}function Ma(e,t){return P(e)?ja(e,t):F(e)?Aa(e,t):L(e,t)}function Na(e){return e instanceof Boolean}function Pa(e){return e instanceof Number}function Fa(e){return e instanceof String}function Ia(e){return globalThis.ArrayBuffer.isView(e)}function La(e){return e instanceof globalThis.RegExp}function Ra(e){return e instanceof globalThis.Date}function za(e){return e instanceof globalThis.Set}function Ba(e){return e instanceof globalThis.Map}var Va=$i,Ha={immutableTypes:!1,maxErrors:8,maxInstantiationCount:128,useAcceleration:!0,exactOptionalPropertyTypes:!1,enumerableKind:!1,correctiveParse:!1,unionPrioritySort:!0};function Ua(){return Ha}function Wa(e){return z(e,`~refine`)&&P(e[`~refine`])&&ba(e[`~refine`],0,e=>F(e)&&z(e,`check`)&&z(e,`error`)&&ra(e.check)&&ra(e.error))}function Ga(e){return F(e)&&!P(e)}function Ka(e){return ta(e)}function qa(e){return Ga(e)||Ka(e)}function Ja(e){return z(e,`additionalItems`)&&qa(e.additionalItems)}function Ya(e){return z(e,`additionalProperties`)&&qa(e.additionalProperties)}function Xa(e){return z(e,`allOf`)&&P(e.allOf)&&e.allOf.every(e=>qa(e))}function Za(e){return z(e,`$anchor`)&&I(e.$anchor)}function Qa(e){return z(e,`anyOf`)&&P(e.anyOf)&&e.anyOf.every(e=>qa(e))}function $a(e){return z(e,`const`)}function eo(e){return z(e,`contains`)&&qa(e.contains)}function to(e){return z(e,`default`)}function no(e){return z(e,`dependencies`)&&F(e.dependencies)&&Object.values(e.dependencies).every(e=>qa(e)||P(e)&&e.every(e=>I(e)))}function ro(e){return z(e,`dependentRequired`)&&F(e.dependentRequired)&&Object.values(e.dependentRequired).every(e=>P(e)&&e.every(e=>I(e)))}function io(e){return z(e,`dependentSchemas`)&&F(e.dependentSchemas)&&Object.values(e.dependentSchemas).every(e=>qa(e))}function ao(e){return z(e,`$dynamicAnchor`)&&I(e.$dynamicAnchor)}function oo(e){return z(e,`$dynamicRef`)&&I(e.$dynamicRef)}function so(e){return z(e,`else`)&&qa(e.else)}function co(e){return z(e,`enum`)&&P(e.enum)}function lo(e){return z(e,`exclusiveMaximum`)&&(oa(e.exclusiveMaximum)||ea(e.exclusiveMaximum))}function uo(e){return z(e,`exclusiveMinimum`)&&(oa(e.exclusiveMinimum)||ea(e.exclusiveMinimum))}function fo(e){return z(e,`format`)&&I(e.format)}function po(e){return z(e,`$id`)&&I(e.$id)}function mo(e){return z(e,`if`)&&qa(e.if)}function ho(e){return z(e,`items`)&&(qa(e.items)||P(e.items)&&e.items.every(e=>qa(e)))}function go(e){return ho(e)&&P(e.items)}function _o(e){return z(e,`maximum`)&&(oa(e.maximum)||ea(e.maximum))}function vo(e){return z(e,`maxContains`)&&oa(e.maxContains)}function yo(e){return z(e,`maxItems`)&&oa(e.maxItems)}function bo(e){return z(e,`maxLength`)&&oa(e.maxLength)}function xo(e){return z(e,`maxProperties`)&&oa(e.maxProperties)}function So(e){return z(e,`minimum`)&&(oa(e.minimum)||ea(e.minimum))}function Co(e){return z(e,`minContains`)&&oa(e.minContains)}function wo(e){return z(e,`minItems`)&&oa(e.minItems)}function To(e){return z(e,`minLength`)&&oa(e.minLength)}function Eo(e){return z(e,`minProperties`)&&oa(e.minProperties)}function Do(e){return z(e,`multipleOf`)&&(oa(e.multipleOf)||ea(e.multipleOf))}function Oo(e){return z(e,`not`)&&qa(e.not)}function ko(e){return z(e,`oneOf`)&&P(e.oneOf)&&e.oneOf.every(e=>qa(e))}function Ao(e){return z(e,`pattern`)&&(I(e.pattern)||e.pattern instanceof RegExp)}function jo(e){return z(e,`patternProperties`)&&F(e.patternProperties)&&Object.values(e.patternProperties).every(e=>qa(e))}function Mo(e){return z(e,`prefixItems`)&&P(e.prefixItems)&&e.prefixItems.every(e=>qa(e))}function No(e){return z(e,`properties`)&&F(e.properties)&&Object.values(e.properties).every(e=>qa(e))}function Po(e){return z(e,`propertyNames`)&&(F(e.propertyNames)||qa(e.propertyNames))}function Fo(e){return z(e,`$recursiveAnchor`)&&ta(e.$recursiveAnchor)}function Io(e){return Fo(e)&&L(e.$recursiveAnchor,!0)}function Lo(e){return z(e,`$recursiveRef`)&&I(e.$recursiveRef)}function Ro(e){return z(e,`$ref`)&&I(e.$ref)}function zo(e){return z(e,`required`)&&P(e.required)&&e.required.every(e=>I(e))}function Bo(e){return z(e,`then`)&&qa(e.then)}function Vo(e){return z(e,`type`)&&(I(e.type)||P(e.type)&&e.type.every(e=>I(e)))}function Ho(e){return z(e,`uniqueItems`)&&ta(e.uniqueItems)}function V(e){return z(e,`unevaluatedItems`)&&qa(e.unevaluatedItems)}function Uo(e){return z(e,`unevaluatedProperties`)&&qa(e.unevaluatedProperties)}var Wo=class{constructor(){let e=new Set,t=new Set;this.stack=[{indices:e,keys:t}]}Push(){let e=new Set,t=new Set;return this.stack.push({indices:e,keys:t}),!0}Pop(){return this.stack.pop(),!0}AddIndex(e){return this.GetIndices().add(e),!0}AddKey(e){return this.GetKeys().add(e),!0}GetIndices(){return this.stack[this.stack.length-1].indices}GetKeys(){return this.stack[this.stack.length-1].keys}Merge(e){for(let t of e)t.GetIndices().forEach(e=>this.GetIndices().add(e)),t.GetKeys().forEach(e=>this.GetKeys().add(e));return!0}},Go=class extends Wo{constructor(){super(),this.errors=[]}AtCapacity(){return this.errors.length>=Ua().maxErrors}AddError(e){return this.AtCapacity()||this.errors.push(e),!1}GetErrors(){return this.errors}};function Ko(e,t,n,r){return ba(n[`~refine`],0,(e,t)=>e.check(r))}function qo(e,t,n,r,i,a){return xa(i[`~refine`],0,(e,i)=>e.check(a)||t.AddError({keyword:`~refine`,schemaPath:n,instancePath:r,params:{index:i,message:e.error(a)}}))}function Jo(e){return ho(e)&&P(e.items)}function Yo(e,t,n,r){return!Jo(n)||ba(r,0,(r,i)=>da(i,n.items.length)||dd(e,t,n.additionalItems,r)&&t.AddIndex(i))}function Xo(e,t,n,r,i,a){return!Jo(i)||ba(a,0,(a,o)=>{let s=`${n}/additionalItems`,c=`${r}/${o}`;return da(o,i.items.length)||pd(e,t,s,c,i.additionalItems,a)&&t.AddIndex(o)})}function Zo(e){return new RegExp(e,`u`)}function Qo(e){return`^${e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}$`}function $o(e){let t=[];return jo(e)&&t.push(...B(e.patternProperties)),No(e)&&t.push(...B(e.properties).map(Qo)),L(t.length,0)?`(?!)`:`(${t.join(`|`)})`}function es(e,t,n,r){let i=Zo($o(n));return ba(B(r),0,(a,o)=>i.test(a)||dd(e,t,n.additionalProperties,r[a])&&t.AddKey(a))}function ts(e,t,n,r,i,a){let o=Zo($o(i)),s=[];return xa(B(a),0,(c,l)=>{let u=`${n}/additionalProperties`,d=`${r}/${c}`,f=o.test(c)||pd(e,t,u,d,i.additionalProperties,a[c])&&t.AddKey(c);return f||s.push(c),f})||t.AddError({keyword:`additionalProperties`,schemaPath:n,instancePath:r,params:{additionalProperties:s}})}function ns(e,t,n,r){let i=n.allOf.reduce((t,n)=>{let i=new Wo;return fd(e,i,n,r)?[...t,i]:t},[]);return L(i.length,n.allOf.length)&&t.Merge(i)}function rs(e,t,n,r,i,a){let o=[],s=i.allOf.reduce((t,i,s)=>{let c=`${n}/allOf/${s}`,l=new Go,u=md(e,l,c,r,i,a);return u||o.push(l),u?[...t,l]:t},[]),c=L(s.length,i.allOf.length)&&t.Merge(s);return c||o.forEach(e=>e.GetErrors().forEach(e=>t.AddError(e))),c}function is(e,t,n,r){let i=n.anyOf.reduce((t,n)=>{let i=new Wo;return fd(e,i,n,r)?[...t,i]:t},[]);return ua(i.length,0)&&t.Merge(i)}function as(e,t,n,r,i,a){let o=[],s=i.anyOf.reduce((t,i,s)=>{let c=new Go,l=md(e,c,`${n}/anyOf/${s}`,r,i,a);return l||o.push(c),l?[...t,c]:t},[]),c=ua(s.length,0)&&t.Merge(s);return c||o.forEach(e=>e.GetErrors().forEach(e=>t.AddError(e))),c||t.AddError({keyword:`anyOf`,schemaPath:n,instancePath:r,params:{}})}function os(e,t,n,r){return n}function ss(e,t,n,r,i,a){return os(e,t,i,a)||t.AddError({keyword:`boolean`,schemaPath:n,instancePath:r,params:{}})}function cs(e,t,n,r){return ga(n.const)?L(r,n.const):Ma(r,n.const)}function ls(e,t,n,r,i,a){return cs(e,t,i,a)||t.AddError({keyword:`const`,schemaPath:n,instancePath:r,params:{allowedValue:i.const}})}function us(e){return!(Co(e)&&L(e.minContains,0))}function ds(e,t,n,r){return!us(n)||!L(r.length,0)&&Ca(r,(r,i)=>fd(e,t,n.contains,r)&&t.AddIndex(i))}function fs(e,t,n,r,i,a){return ds(e,t,i,a)||t.AddError({keyword:`contains`,schemaPath:n,instancePath:r,params:{minContains:1}})}function ps(e,t,n,r){let i=L(B(r).length,0),a=ba(Da(n.dependencies),0,([n,i])=>!z(r,n)||(P(i)?i.every(e=>z(r,e)):fd(e,t,i,r)));return i||a}function ms(e,t,n,r,i,a){let o=L(B(a).length,0),s=xa(Da(i.dependencies),0,([i,o])=>{let s=`${n}/dependencies/${i}`;return!z(a,i)||(P(o)?o.every(e=>z(a,e)||t.AddError({keyword:`dependencies`,schemaPath:n,instancePath:r,params:{property:i,dependencies:o}})):md(e,t,s,r,o,a))});return o||s}function hs(e,t,n,r){let i=L(B(r).length,0),a=ba(Da(n.dependentRequired),0,([e,t])=>!z(r,e)||t.every(e=>z(r,e)));return i||a}function gs(e,t,n,r,i,a){let o=L(B(a).length,0),s=xa(Da(i.dependentRequired),0,([e,i])=>!z(a,e)||xa(i,0,o=>z(a,o)||t.AddError({keyword:`dependentRequired`,schemaPath:n,instancePath:r,params:{property:e,dependencies:i}})));return o||s}function _s(e,t,n,r){let i=L(B(r).length,0),a=ba(Da(n.dependentSchemas),0,([n,i])=>!z(r,n)||fd(e,t,i,r));return i||a}function vs(e,t,n,r,i,a){let o=L(B(a).length,0),s=xa(Da(i.dependentSchemas),0,([i,o])=>{let s=`${n}/dependentSchemas/${i}`;return!z(a,i)||md(e,t,s,r,o,a)});return o||s}function ys(e,t,n,r){let i=e.DynamicRef(n)??!1;return qa(i)&&fd(e,t,i,r)}function bs(e,t,n,r,i,a){let o=e.DynamicRef(i)??!1;return qa(o)&&md(e,t,`#`,r,o,a)}function xs(e,t,n,r){return Sa(n.enum,e=>ga(e)?L(r,e):Ma(r,e))}function Ss(e,t,n,r,i,a){return xs(e,t,i,a)||t.AddError({keyword:`enum`,schemaPath:n,instancePath:r,params:{allowedValues:i.enum}})}function Cs(e,t,n,r){return da(r,n.exclusiveMaximum)}function ws(e,t,n,r,i,a){return Cs(e,t,i,a)||t.AddError({keyword:`exclusiveMaximum`,schemaPath:n,instancePath:r,params:{comparison:`<`,limit:i.exclusiveMaximum}})}function Ts(e,t,n,r){return ua(r,n.exclusiveMinimum)}function Es(e,t,n,r,i,a){return Ts(e,t,i,a)||t.AddError({keyword:`exclusiveMinimum`,schemaPath:n,instancePath:r,params:{comparison:`>`,limit:i.exclusiveMinimum}})}var Ds=[0,31,28,31,30,31,30,31,31,30,31,30,31],Os=/^(\d\d\d\d)-(\d\d)-(\d\d)$/;function ks(e){return e%4==0&&(e%100!=0||e%400==0)}function As(e){let t=Os.exec(e);if(!t)return!1;let n=+t[1],r=+t[2],i=+t[3];return r>=1&&r<=12&&i>=1&&i<=(r===2&&ks(n)?29:Ds[r])}var js=/^(\d\d):(\d\d):(\d\d)(?:\.\d+)?(?:([Zz])|([+-])(\d\d):(\d\d))?$/;function Ms(e,t=!0){let n=js.exec(e);if(!n||t&&!n[4]&&!n[5])return!1;let r=+n[1],i=+n[2],a=+n[3];if(r>23||i>59||a>60)return!1;if(n[5]){let e=+n[6],t=+n[7];if(e>23||t>59)return!1}if(a<60)return!0;let o=n[5]===`-`?-1:1,s=+(n[6]||0),c=+(n[7]||0);return((r*60+i-o*(s*60+c))%1440+1440)%1440==1439}function Ns(e){let t=e.split(/T/i);return t.length===2&&As(t[0])&&Ms(t[1])}var Ps=/^P((\d+Y(\d+M(\d+D)?)?|\d+M(\d+D)?|\d+D)(T(\d+H(\d+M(\d+S)?)?|\d+M(\d+S)?|\d+S))?|T(\d+H(\d+M(\d+S)?)?|\d+M(\d+S)?|\d+S)|\d+W)$/;function Fs(e){return Ps.test(e)}var Is=/^(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[^"\\]|\\[\x20-\x7e])*")@(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*|\[(?:IPv6:[a-f0-9:]+|(?:25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])(?:\.(?:25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3})\])$/i;function Ls(e){return Is.test(e)}var Rs=/^(?!-).*(?<!-)$/,zs=/^(?!..--)/,Bs=/^[a-zA-Z0-9-]*$/,Vs=/[^\p{ASCII}]/u,Hs=/[0-9]/,Us=/[\u{0660}-\u{0669}]/u,Ws=/[\u{06f0}-\u{06f9}]/u,Gs=/[\u{002e}\u{002c}\u{003a}\u{002f}]/u,Ks=/[\u{002d}\u{002b}]/u,qs=/\p{Mn}/u,Js=/\p{Mc}/u,Ys=/[\p{Mn}\p{Mc}\p{Me}]/u,Xs=/\p{L}/u,Zs=/\p{Nd}/u,Qs=/\p{Script=Greek}/u,$s=/\p{Script=Hebrew}/u,ec=/[\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Han}]/u,tc=/[\p{Script=Arabic}\p{Script=Syriac}\p{Script=Thaana}\p{Script=Mandaic}]/u,nc=/[\u{094d}\u{09cd}\u{0a4d}\u{0acd}\u{0b4d}\u{0bcd}\u{0c4d}\u{0ccd}\u{0d3b}\u{0d3c}\u{0d4d}\u{0dca}\u{1b44}\u{1baa}\u{1bab}\u{a9c0}\u{11046}\u{1107f}\u{110b9}\u{11133}\u{11134}\u{111c0}\u{11235}\u{1134d}\u{11442}\u{114c2}\u{115bf}\u{1163f}\u{116b6}\u{11c3f}\u{11d44}\u{11d45}]/u,rc=/[\u{0640}\u{07fa}\u{302e}\u{302f}\u{3031}\u{3032}\u{3033}\u{3034}\u{3035}\u{303b}]/u,ic=/[\u{00b7}\u{0375}\u{05f3}\u{05f4}\u{200c}\u{200d}\u{30fb}]/u,ac=/[\u{00df}\u{03c2}\u{06fd}\u{06fe}\u{0f0b}\u{3007}]/u,oc=new RegExp([Hs,Ws].map(e=>e.source).join(`|`),`u`),sc=new RegExp([Xs,Ks,Gs,Zs,qs,Js,ic,ac].map(e=>e.source).join(`|`),`u`);function cc(e){return Rs.test(e)&&zs.test(e)&&Bs.test(e)}var lc=36,uc=1,dc=26,fc=38,pc=700,mc=72,hc=128;function gc(){throw null}function _c(e){return e.toLowerCase().startsWith(`xn--`)}function vc(e,t,n){e=n?Math.floor(e/pc):e>>1,e+=Math.floor(e/t);let r=0;for(;e>455;)e=Math.floor(e/35),r+=lc;return r+Math.floor(36*e/(e+fc))}function yc(e){let t=[],n=hc,r=0,i=mc,a=e.lastIndexOf(`-`);if(a>0)for(let n=0;n<a;n++){let r=e.charCodeAt(n);r>=128&&gc(),t.push(r)}let o=a<0?0:a+1;for(;o<e.length;){let a=r,s=1,c=lc;for(;;){o>=e.length&&gc();let t=e.charCodeAt(o++),n;t>=97&&t<=122?n=t-97:t>=48&&t<=57?n=t-48+26:gc(),r+=n*s;let a=c<=i?uc:c>=i+dc?dc:c-i;if(n<a)break;s*=lc-a,c+=lc}let l=t.length+1;i=vc(r-a,l,a===0),n+=Math.floor(r/l),r%=l,t.splice(r,0,n),r++}return String.fromCodePoint(...t)}function bc(e){return e<26?String.fromCharCode(e+97):String.fromCharCode(e-26+48)}var xc=new RegExp(Vs.source,`gu`);function Sc(e){let t=e.replace(xc,``),n=t.length,r=n>0?[t,`-`]:[],i=Array.from(e,e=>e.codePointAt(0)),a=hc,o=0,s=mc,c=n;for(;c<i.length;){let e=1/0;for(let t of i)t>=a&&t<e&&(e=t);o+=(e-a)*(c+1),a=e;for(let e of i)if(e<a&&o++,e===a){let e=o;for(let t=lc;;t+=lc){let n=t<=s?uc:t>=s+dc?dc:t-s;if(e<n)break;let i=n+(e-n)%(lc-n);r.push(bc(i)),e=Math.floor((e-n)/(lc-n))}r.push(bc(e)),s=vc(o,c+1,c===n),o=0,c++}o++,a++}return r.join(``)}var Cc=/^(?:R|AL|AN|EN|ES|CS|ET|ON|BN|NSM)$/,wc=/^(?:L|EN|ES|CS|ET|ON|BN|NSM)$/,Tc=/^(?:R|AL|AN)$/;function Ec(e){if(_c(e))try{return Oc(yc(e.slice(4).toLowerCase()))}catch{return!1}return Oc(e)}function Dc(e){let t=String.fromCodePoint(e);return oc.test(t)?`EN`:Us.test(t)?`AN`:qs.test(t)?`NSM`:$s.test(t)?`R`:tc.test(t)?`AL`:Xs.test(t)?`L`:`ON`}function Oc(e){for(let t of e)if(Tc.test(Dc(t.codePointAt(0))))return!0;return!1}function kc(e){let t=!1,n=wc,r=!1,i=!1,a=!0;for(let o of e){let e=Dc(o.codePointAt(0));if(a){if(e!==`L`&&e!==`R`&&e!==`AL`)return!1;t=e===`R`||e===`AL`,n=t?Cc:wc,a=!1}if(!n.test(e))return!1;e===`EN`?r=!0:e===`AN`&&(i=!0)}return!(t&&r&&i)}function Ac(e){return Vs.test(e)&&Sc(e).length+4>63}function jc(e){return e[0]===`-`||e[e.length-1]===`-`||e.slice(2).join(``).startsWith(`--`)}function Mc(e){if(Ac(e)||Oc(e)&&!kc(e))return!1;let t=[...e],n=t.map(e=>e.codePointAt(0)),r=n.length;if(jc(t)||Ys.test(t[0]))return!1;let i=!1;for(let e=0;e<r;e++){let r=n[e],a=t[e];if(rc.test(a)||!sc.test(a))return!1;ec.test(a)&&(i=!0);let o=n[e-1],s=n[e+1];switch(r){case 183:if(o!==108||s!==108)return!1;break;case 885:if(!s||!Qs.test(t[e+1]))return!1;break;case 1523:case 1524:if(!o||!$s.test(t[e-1]))return!1;break;case 8204:if(!o||o<128&&!nc.test(t[e-1]))return!1;break;case 8205:if(!o||!nc.test(t[e-1]))return!1}}return!(e.includes(`・`)&&!i)}function Nc(e){if(!_c(e))return!1;try{let t=e.slice(4).toLowerCase();if(t.lastIndexOf(`-`)===0)return!1;let n=yc(t);return Vs.test(n)?Mc(n):!1}catch{return!1}}function Pc(e){return e.length>0&&e.length<=63}function Fc(e){return Pc(e)&&(Nc(e)||cc(e))}function Ic(e){return e.length===0||e.length>253||e.charCodeAt(e.length-1)===46?!1:e.split(`.`).every(e=>Fc(e))}function Lc(e){return e.length>0&&e.length<=63}function Rc(e){return Lc(e)&&(Nc(e)||Mc(e))}function zc(e){return e.replace(/[\uff01-\uff5e]/g,e=>String.fromCharCode(e.charCodeAt(0)-65248)).normalize(`NFC`).replace(/[\u00ad\u034f\u180b-\u180d\u200b\ufe00-\ufe0f\u{e0100}-\u{e01ef}]/gu,``).replace(/[\u002E\u3002\uFF0E\uFF61]/g,`.`)}function Bc(e){if(e.length===0||e.includes(` `))return!1;let t=zc(e);if(t.length>253)return!1;let n=t.split(`.`),r=n.some(e=>Ec(e));return n.every(e=>Rc(e)&&(!r||kc(e)))}function Vc(e){return Ic(e)}var Hc=/^(?:[A-Za-z0-9!#$%&'*+\/=?^_`{|}~\u{0080}-\u{10FFFF}-]+(?:\.[A-Za-z0-9!#$%&'*+\/=?^_`{|}~\u{0080}-\u{10FFFF}-]+)*|"(?:[^"\\]|\\.)*")@[\p{L}\p{N}](?:[\p{L}\p{N}-]{0,62})(?<!-)(?:\.[\p{L}\p{N}](?:[\p{L}\p{N}-]{0,62})(?<!-))*$/iu;function Uc(e){return Hc.test(e.normalize(`NFC`))}function Wc(e){return Bc(e)}var Gc=/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/;function Kc(e){return Gc.test(e)}var qc=/^(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:)?[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)$/i;function Jc(e){return qc.test(e)}var Yc=/[\x00-\x20\x7F\\]|%(?![0-9a-fA-F]{2})/,Xc=/^[a-zA-Z][a-zA-Z0-9+\-.]*\/\//;function Zc(e){return!Yc.test(e)&&!Xc.test(e)&&URL.canParse(e,`http://example.com`)}var Qc=2048,$c=/\[[vV][0-9a-fA-F]+\.[^\]]+\]/,el=/[\x00-\x20<>\^`{|}\\]/,tl=/%(?![0-9a-fA-F]{2})/;function nl(e){return e.length<Qc?e.replace($c,`[::1]`):e}function rl(e){return el.test(e)||tl.test(e)?!1:URL.canParse(nl(e))}var il=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i;function al(e){return il.test(e)}var ol=/^(?:\/(?:[^~/]|~0|~1)*)*$/;function sl(e){return ol.test(e)}function cl(e){try{return new RegExp(e,`u`),!0}catch{return!1}}var ll=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;function ul(e){return ll.test(e)}var dl=/^(?:[a-z][a-z0-9+\-.]*:(?:\/\/(?:(?:[-a-z0-9._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:[\da-f]{1,4}:){6}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|::(?:[\da-f]{1,4}:){5}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:[\da-f]{1,4})?::(?:[\da-f]{1,4}:){4}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,1}[\da-f]{1,4})?::(?:[\da-f]{1,4}:){3}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,2}[\da-f]{1,4})?::(?:[\da-f]{1,4}:){2}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,3}[\da-f]{1,4})?::[\da-f]{1,4}:(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,4}[\da-f]{1,4})?::(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,5}[\da-f]{1,4})?::[\da-f]{1,4}|(?:(?:[\da-f]{1,4}:){0,6}[\da-f]{1,4})?::)|v[0-9a-f]+\.[-a-z0-9._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)|(?:[-a-z0-9._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[-a-z0-9._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[-a-z0-9._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[-a-z0-9._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[-a-z0-9._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[-a-z0-9._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:\/\/(?:(?:[-a-z0-9._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:[\da-f]{1,4}:){6}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|::(?:[\da-f]{1,4}:){5}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:[\da-f]{1,4})?::(?:[\da-f]{1,4}:){4}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,1}[\da-f]{1,4})?::(?:[\da-f]{1,4}:){3}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,2}[\da-f]{1,4})?::(?:[\da-f]{1,4}:){2}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,3}[\da-f]{1,4})?::[\da-f]{1,4}:(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,4}[\da-f]{1,4})?::(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,5}[\da-f]{1,4})?::[\da-f]{1,4}|(?:(?:[\da-f]{1,4}:){0,6}[\da-f]{1,4})?::)|v[0-9a-f]+\.[-a-z0-9._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)|(?:[-a-z0-9._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[-a-z0-9._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[-a-z0-9._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[-a-z0-9._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[-a-z0-9._~!$&'()*+,;=@]|%[0-9a-f]{2})+(?:\/(?:[-a-z0-9._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?)(?:\?(?:[-a-z0-9._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[-a-z0-9._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function fl(e){return dl.test(e)}var pl=/^(?:(?:[^\x00-\x20"<>%\\^`{|}\x7f]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?:\.(?:[a-z0-9_]|%[0-9a-f]{2})+)*(?::[1-9]\d{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?:\.(?:[a-z0-9_]|%[0-9a-f]{2})+)*(?::[1-9]\d{0,3}|\*)?)*\})*$/i;function ml(e){return pl.test(e)}var hl=/^[a-z][a-z0-9+\-.]*:(?:\/\/(?:(?:[-a-z0-9._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:[\da-f]{1,4}:){6}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|::(?:[\da-f]{1,4}:){5}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:[\da-f]{1,4})?::(?:[\da-f]{1,4}:){4}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,1}[\da-f]{1,4})?::(?:[\da-f]{1,4}:){3}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,2}[\da-f]{1,4})?::(?:[\da-f]{1,4}:){2}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,3}[\da-f]{1,4})?::[\da-f]{1,4}:(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,4}[\da-f]{1,4})?::(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[\da-f]{1,4}:){0,5}[\da-f]{1,4})?::[\da-f]{1,4}|(?:(?:[\da-f]{1,4}:){0,6}[\da-f]{1,4})?::)|v[0-9a-f]+\.[-a-z0-9._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)|(?:[-a-z0-9._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[-a-z0-9._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[-a-z0-9._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[-a-z0-9._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[-a-z0-9._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[-a-z0-9._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[-a-z0-9._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[-a-z0-9._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function gl(e){return hl.test(e)}function _l(e){return URL.canParse(e)}var vl=/^[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i;function yl(e){return vl.test(e)}var H=new Map;function bl(){H.clear()}function xl(e,t){return H.get(e)?.(t)??!0}function Sl(){bl(),H.set(`date-time`,Ns),H.set(`date`,As),H.set(`duration`,Fs),H.set(`email`,Ls),H.set(`hostname`,Vc),H.set(`idn-email`,Uc),H.set(`idn-hostname`,Wc),H.set(`ipv4`,Kc),H.set(`ipv6`,Jc),H.set(`iri-reference`,Zc),H.set(`iri`,rl),H.set(`json-pointer-uri-fragment`,al),H.set(`json-pointer`,sl),H.set(`regex`,cl),H.set(`relative-json-pointer`,ul),H.set(`time`,Ms),H.set(`uri-reference`,fl),H.set(`uri-template`,ml),H.set(`uri`,gl),H.set(`url`,_l),H.set(`uuid`,yl)}Sl();function Cl(e,t,n,r){return xl(n.format,r)}function wl(e,t,n,r,i,a){return Cl(e,t,i,a)||t.AddError({keyword:`format`,schemaPath:n,instancePath:r,params:{format:i.format}})}function Tl(e,t,n,r){let i=!Bo(n)||n.then,a=!so(n)||n.else;return fd(e,t,n.if,r)?fd(e,t,i,r):fd(e,t,a,r)}function El(e,t,n,r,i,a){let o=!Bo(i)||i.then,s=!so(i)||i.else,c=new Go,l=md(e,c,`${n}/if`,r,i.if,a)?md(e,c,`${n}/then`,r,o,a)||t.AddError({keyword:`if`,schemaPath:n,instancePath:r,params:{failingKeyword:`then`}}):md(e,t,`${n}/else`,r,s,a)||t.AddError({keyword:`if`,schemaPath:n,instancePath:r,params:{failingKeyword:`else`}});return l&&t.Merge([c]),l}function Dl(e,t,n,r){return ba(n.items,0,(n,i)=>fa(r.length,i)||dd(e,t,n,r[i])&&t.AddIndex(i))}function Ol(e,t,n,r,i,a){return xa(i.items,0,(i,o)=>{let s=`${n}/items/${o}`,c=`${r}/${o}`;return fa(a.length,o)||pd(e,t,s,c,i,a[o])&&t.AddIndex(o)})}function kl(e,t,n,r){return ba(r,Mo(n)?n.prefixItems.length:0,(r,i)=>dd(e,t,n.items,r)&&t.AddIndex(i))}function Al(e,t,n,r,i,a){return xa(a,Mo(i)?i.prefixItems.length:0,(a,o)=>pd(e,t,`${n}/items`,`${r}/${o}`,i.items,a)&&t.AddIndex(o))}function jl(e,t,n,r){return go(n)?Dl(e,t,n,r):kl(e,t,n,r)}function Ml(e,t,n,r,i,a){return go(i)?Ol(e,t,n,r,i,a):Al(e,t,n,r,i,a)}function Nl(e){return eo(e)}function Pl(e,t,n,r){return!Nl(n)||fa(wa(r,r=>fd(e,t,n.contains,r)),n.maxContains)}function Fl(e,t,n,r,i,a){let o=Co(i)?i.minContains:1;return Pl(e,t,i,a)||t.AddError({keyword:`contains`,schemaPath:n,instancePath:r,params:{minContains:o,maxContains:i.maxContains}})}function Il(e,t,n,r){return fa(r,n.maximum)}function Ll(e,t,n,r,i,a){return Il(e,t,i,a)||t.AddError({keyword:`maximum`,schemaPath:n,instancePath:r,params:{comparison:`<=`,limit:i.maximum}})}function Rl(e,t,n,r){return fa(r.length,n.maxItems)}function zl(e,t,n,r,i,a){return Rl(e,t,i,a)||t.AddError({keyword:`maxItems`,schemaPath:n,instancePath:r,params:{limit:i.maxItems}})}function Bl(e,t,n,r){return va(r,n.maxLength)}function Vl(e,t,n,r,i,a){return Bl(e,t,i,a)||t.AddError({keyword:`maxLength`,schemaPath:n,instancePath:r,params:{limit:i.maxLength}})}function Hl(e,t,n,r){return fa(B(r).length,n.maxProperties)}function Ul(e,t,n,r,i,a){return Hl(e,t,i,a)||t.AddError({keyword:`maxProperties`,schemaPath:n,instancePath:r,params:{limit:i.maxProperties}})}function Wl(e){return eo(e)}function Gl(e,t,n,r){return!Wl(n)||pa(wa(r,(r,i)=>fd(e,t,n.contains,r)&&t.AddIndex(i)),n.minContains)}function Kl(e,t,n,r,i,a){return Gl(e,t,i,a)||t.AddError({keyword:`contains`,schemaPath:n,instancePath:r,params:{minContains:i.minContains}})}function ql(e,t,n,r){return pa(r,n.minimum)}function Jl(e,t,n,r,i,a){return ql(e,t,i,a)||t.AddError({keyword:`minimum`,schemaPath:n,instancePath:r,params:{comparison:`>=`,limit:i.minimum}})}function Yl(e,t,n,r){return pa(r.length,n.minItems)}function Xl(e,t,n,r,i,a){return Yl(e,t,i,a)||t.AddError({keyword:`minItems`,schemaPath:n,instancePath:r,params:{limit:i.minItems}})}function Zl(e,t,n,r){return ya(r,n.minLength)}function Ql(e,t,n,r,i,a){return Zl(e,t,i,a)||t.AddError({keyword:`minLength`,schemaPath:n,instancePath:r,params:{limit:i.minLength}})}function $l(e,t,n,r){return pa(B(r).length,n.minProperties)}function eu(e,t,n,r,i,a){return $l(e,t,i,a)||t.AddError({keyword:`minProperties`,schemaPath:n,instancePath:r,params:{limit:i.minProperties}})}function tu(e,t,n,r){return ma(r,n.multipleOf)}function nu(e,t,n,r,i,a){return tu(e,t,i,a)||t.AddError({keyword:`multipleOf`,schemaPath:n,instancePath:r,params:{multipleOf:i.multipleOf}})}function ru(e,t,n,r){let i=new Wo;return!fd(e,i,n.not,r)&&t.Merge([i])}function iu(e,t,n,r,i,a){return ru(e,t,i,a)||t.AddError({keyword:`not`,schemaPath:n,instancePath:r,params:{}})}function au(e,t,n,r){let i=n.oneOf.reduce((t,n)=>{let i=new Wo;return fd(e,i,n,r)?[...t,i]:t},[]);return L(i.length,1)&&t.Merge(i)}function ou(e,t,n,r,i,a){let o=[],s=[],c=i.oneOf.reduce((t,i,c)=>{let l=new Go,u=md(e,l,`${n}/oneOf/${c}`,r,i,a);return u&&s.push(c),u||o.push(l),u?[...t,l]:t},[]),l=L(c.length,1)&&t.Merge(c);return!l&&L(s.length,0)&&o.forEach(e=>e.GetErrors().forEach(e=>t.AddError(e))),l||t.AddError({keyword:`oneOf`,schemaPath:n,instancePath:r,params:{passingSchemas:s}})}function su(e,t,n,r){return(I(n.pattern)?Zo(n.pattern):n.pattern).test(r)}function cu(e,t,n,r,i,a){return su(e,t,i,a)||t.AddError({keyword:`pattern`,schemaPath:n,instancePath:r,params:{pattern:i.pattern}})}function lu(e,t,n,r){return ba(Da(n.patternProperties),0,([n,i])=>{let a=Zo(n);return ba(Da(r),0,([n,r])=>!a.test(n)||dd(e,t,i,r)&&t.AddKey(n))})}function uu(e,t,n,r,i,a){return xa(Da(i.patternProperties),0,([i,o])=>{let s=`${n}/patternProperties/${i}`,c=Zo(i);return xa(Da(a),0,([n,i])=>{let a=`${r}/${n}`;return!c.test(n)||pd(e,t,s,a,o,i)&&t.AddKey(n)})})}function du(e,t,n,r){return L(r.length,0)||ba(n.prefixItems,0,(n,i)=>fa(r.length,i)||dd(e,t,n,r[i])&&t.AddIndex(i))}function fu(e,t,n,r,i,a){return L(a.length,0)||xa(i.prefixItems,0,(i,o)=>{let s=`${n}/prefixItems/${o}`,c=`${r}/${o}`;return fa(a.length,o)||pd(e,t,s,c,i,a[o])&&t.AddIndex(o)})}function pu(e,t){return e.includes(t)||Ua().exactOptionalPropertyTypes}function mu(e,t){return la(e[t])}function hu(e,t,n,r){let i=zo(n)?n.required:[];return ba(Da(n.properties),0,([n,a])=>{let o=!z(r,n)||dd(e,t,a,r[n])&&t.AddKey(n);return pu(i,n)?o:mu(r,n)||o})}function gu(e,t,n,r,i,a){let o=zo(i)?i.required:[];return xa(Da(i.properties),0,([i,s])=>{let c=`${n}/properties/${i}`,l=`${r}/${i}`,u=()=>!z(a,i)||pd(e,t,c,l,s,a[i])&&t.AddKey(i);return pu(o,i)?u():mu(a,i)||u()})}function _u(e,t,n,r){return ba(B(r),0,(r,i)=>fd(e,t,n.propertyNames,r))}function vu(e,t,n,r,i,a){let o=[];return xa(B(a),0,(a,s)=>{let c=`${r}/${a}`,l=md(e,t,`${n}/propertyNames`,c,i.propertyNames,a);return l||o.push(a),l})||t.AddError({keyword:`propertyNames`,schemaPath:n,instancePath:r,params:{propertyNames:o}})}function yu(e,t,n,r){let i=e.RecursiveRef(n)??!1;return qa(i)&&fd(e,t,i,r)}function bu(e,t,n,r,i,a){let o=e.RecursiveRef(i)??!1;return qa(o)&&md(e,t,`#`,r,o,a)}function xu(e,t,n,r){let i=e.Ref(n)??!1,a=new Wo,o=qa(i)&&fd(e,a,i,r);return o&&t.Merge([a]),o}function Su(e,t,n,r,i,a){let o=e.Ref(i)??!1,s=new Go,c=qa(o)&&md(e,s,`#`,r,o,a);return c&&t.Merge([s]),c||s.GetErrors().forEach(e=>t.AddError(e)),c}function Cu(e,t,n,r){return ba(n.required,0,e=>z(r,e))}function wu(e,t,n,r,i,a){let o=[];return xa(i.required,0,e=>{let t=z(a,e);return t||o.push(e),t})||t.AddError({keyword:`required`,schemaPath:n,instancePath:r,params:{requiredProperties:o}})}function Tu(e,t,n,r,i){return L(n,`object`)?sa(i):L(n,`array`)?P(i):L(n,`boolean`)?ta(i):L(n,`integer`)?ia(i):L(n,`number`)?oa(i):L(n,`null`)?aa(i):L(n,`string`)?I(i):L(n,`bigint`)?ea(i):L(n,`constructor`)?na(i):L(n,`function`)?ra(i):L(n,`symbol`)?ca(i):L(n,`undefined`)?la(i):!L(n,`void`)||la(i)}function Eu(e,t,n,r,i){return Sa(n,n=>Tu(e,t,n,r,i))}function Du(e,t,n,r){return P(n.type)?Eu(e,t,n.type,n,r):Tu(e,t,n.type,n,r)}function Ou(e,t,n,r,i,a){return(P(i.type)?Eu(e,t,i.type,i,a):Tu(e,t,i.type,i,a))||t.AddError({keyword:`type`,schemaPath:n,instancePath:r,params:{type:i.type}})}function ku(e,t,n,r){let i=t.GetIndices();return ba(r,0,(r,a)=>(i.has(a)||fd(e,t,n.unevaluatedItems,r))&&t.AddIndex(a))}function Au(e,t,n,r,i,a){let o=t.GetIndices(),s=[];return xa(a,0,(a,c)=>{let l=new Go,u=(o.has(c)||md(e,l,n,r,i.unevaluatedItems,a))&&t.AddIndex(c);return u||s.push(c),u})||t.AddError({keyword:`unevaluatedItems`,schemaPath:n,instancePath:r,params:{unevaluatedItems:s}})}function ju(e,t,n,r){let i=t.GetKeys();return ba(Da(r),0,([r,a])=>i.has(r)||fd(e,t,n.unevaluatedProperties,a)&&t.AddKey(r))}function Mu(e,t,n,r,i,a){let o=t.GetKeys(),s=[];return xa(Da(a),0,([a,c])=>{let l=new Go,u=o.has(a)||md(e,l,n,r,i.unevaluatedProperties,c)&&t.AddKey(a);return u||s.push(a),u})||t.AddError({keyword:`unevaluatedProperties`,schemaPath:n,instancePath:r,params:{unevaluatedProperties:s}})}function Nu(){throw Error(`Unreachable`)}function Pu(e){let t=new Set,n=e;for(;n&&n!==Object.prototype;){for(let e of Reflect.ownKeys(n))e!==`constructor`&&typeof e!=`symbol`&&t.add(e);n=Object.getPrototypeOf(n)}return[...t]}function Fu(e){return typeof e==`number`}var Iu;(function(e){e[e.Array=0]=`Array`,e[e.BigInt=1]=`BigInt`,e[e.Boolean=2]=`Boolean`,e[e.Date=3]=`Date`,e[e.Constructor=4]=`Constructor`,e[e.Function=5]=`Function`,e[e.Null=6]=`Null`,e[e.Number=7]=`Number`,e[e.Object=8]=`Object`,e[e.RegExp=9]=`RegExp`,e[e.String=10]=`String`,e[e.Symbol=11]=`Symbol`,e[e.TypeArray=12]=`TypeArray`,e[e.Undefined=13]=`Undefined`})(Iu||={});var Lu=BigInt(`14695981039346656037`),[Ru,zu]=[BigInt(`1099511628211`),BigInt(`18446744073709551616`)],Bu=Array.from({length:256}).map((e,t)=>BigInt(t)),Vu=new Float64Array(1),Hu=new DataView(Vu.buffer),Uu=new Uint8Array(Vu.buffer);function Wu(e){Lu^=Bu[e],Lu=Lu*Ru%zu}function Gu(e){Wu(Iu.Array);for(let t of e)U(t)}function Ku(e){Wu(Iu.BigInt),Hu.setBigInt64(0,e);for(let e of Uu)Wu(e)}function qu(e){Wu(Iu.Boolean),Wu(+!!e)}function Ju(e){Wu(Iu.Constructor),U(e.toString())}function Yu(e){Wu(Iu.Date),U(e.getTime())}function Xu(e){Wu(Iu.Function),U(e.toString())}function Zu(e){Wu(Iu.Null)}function Qu(e){Wu(Iu.Number),Hu.setFloat64(0,e,!0);for(let e of Uu)Wu(e)}function $u(e){Wu(Iu.Object);for(let t of Pu(e).sort())U(t),U(e[t])}function ed(e){Wu(Iu.RegExp),nd(e.toString())}var td=new TextEncoder;function nd(e){Wu(Iu.String);for(let t of td.encode(e))Wu(t)}function rd(e){Wu(Iu.Symbol),U(e.toString())}function id(e){Wu(Iu.TypeArray);let t=new Uint8Array(e.buffer);for(let e=0;e<t.length;e++)Wu(t[e])}function ad(e){return Wu(Iu.Undefined)}function U(e){return Ia(e)?id(e):Ra(e)?Yu(e):La(e)?ed(e):Na(e)?qu(e.valueOf()):Fa(e)?nd(e.valueOf()):Pa(e)?Qu(e.valueOf()):Fu(e)?Qu(e):P(e)?Gu(e):ta(e)?qu(e):ea(e)?Ku(e):na(e)?Ju(e):aa(e)?Zu(e):F(e)?$u(e):I(e)?nd(e):ca(e)?rd(e):la(e)?ad(e):ra(e)?Xu(e):Nu()}function od(e){return Lu=BigInt(`14695981039346656037`),U(e),Lu}function sd(e){return od(e).toString(16).padStart(16,`0`)}function cd(e){return!L(e.uniqueItems,!1)}function ld(e,t,n,r){if(!cd(n))return!0;let i=new Set(r.map(sd)).size,a=r.length;return L(i,a)}function ud(e,t,n,r,i,a){if(!cd(i))return!0;let o=new Set,s=a.reduce((e,t,n)=>{let r=sd(t);return o.has(r)?[...e,n]:(o.add(r),e)},[]);return L(s.length,0)||t.AddError({keyword:`uniqueItems`,schemaPath:n,instancePath:r,params:{duplicateItems:s}})}function dd(e,t,n,r){return t.Push()&&fd(e,t,n,r)&&t.Pop()}function fd(e,t,n,r){e.Push(n);let i=Ka(n)?os(e,t,n,r):(!Vo(n)||Du(e,t,n,r))&&(!(F(r)&&!P(r))||(!zo(n)||Cu(e,t,n,r))&&(!Ya(n)||es(e,t,n,r))&&(!no(n)||ps(e,t,n,r))&&(!ro(n)||hs(e,t,n,r))&&(!io(n)||_s(e,t,n,r))&&(!jo(n)||lu(e,t,n,r))&&(!No(n)||hu(e,t,n,r))&&(!Po(n)||_u(e,t,n,r))&&(!Eo(n)||$l(e,t,n,r))&&(!xo(n)||Hl(e,t,n,r)))&&(!P(r)||(!Ja(n)||Yo(e,t,n,r))&&(!eo(n)||ds(e,t,n,r))&&(!ho(n)||jl(e,t,n,r))&&(!vo(n)||Pl(e,t,n,r))&&(!yo(n)||Rl(e,t,n,r))&&(!Co(n)||Gl(e,t,n,r))&&(!wo(n)||Yl(e,t,n,r))&&(!Mo(n)||du(e,t,n,r))&&(!Ho(n)||ld(e,t,n,r)))&&(!I(r)||(!bo(n)||Bl(e,t,n,r))&&(!To(n)||Zl(e,t,n,r))&&(!fo(n)||Cl(e,t,n,r))&&(!Ao(n)||su(e,t,n,r)))&&(!(oa(r)||ea(r))||(!lo(n)||Cs(e,t,n,r))&&(!uo(n)||Ts(e,t,n,r))&&(!_o(n)||Il(e,t,n,r))&&(!So(n)||ql(e,t,n,r))&&(!Do(n)||tu(e,t,n,r)))&&(!Ro(n)||xu(e,t,n,r))&&(!Lo(n)||yu(e,t,n,r))&&(!oo(n)||ys(e,t,n,r))&&(!$a(n)||cs(e,t,n,r))&&(!co(n)||xs(e,t,n,r))&&(!mo(n)||Tl(e,t,n,r))&&(!Oo(n)||ru(e,t,n,r))&&(!Xa(n)||ns(e,t,n,r))&&(!Qa(n)||is(e,t,n,r))&&(!ko(n)||au(e,t,n,r))&&(!V(n)||!P(r)||ku(e,t,n,r))&&(!Uo(n)||!F(r)||ju(e,t,n,r))&&(!Wa(n)||Ko(e,t,n,r));return e.Pop(n),i}function pd(e,t,n,r,i,a){return t.Push()&&md(e,t,n,r,i,a)&&t.Pop()}function md(e,t,n,r,i,a){if(t.AtCapacity())return!1;e.Push(i);let o=Ka(i)?ss(e,t,n,r,i,a):!!(+(!Vo(i)||Ou(e,t,n,r,i,a))&(!(F(a)&&!P(a))||!!(+(!zo(i)||wu(e,t,n,r,i,a))&(!Ya(i)||ts(e,t,n,r,i,a))&(!no(i)||ms(e,t,n,r,i,a))&(!ro(i)||gs(e,t,n,r,i,a))&(!io(i)||vs(e,t,n,r,i,a))&(!jo(i)||uu(e,t,n,r,i,a))&(!No(i)||gu(e,t,n,r,i,a))&(!Po(i)||vu(e,t,n,r,i,a))&(!Eo(i)||eu(e,t,n,r,i,a))&(!xo(i)||Ul(e,t,n,r,i,a))))&(!P(a)||!!(+(!Ja(i)||Xo(e,t,n,r,i,a))&(!eo(i)||fs(e,t,n,r,i,a))&(!ho(i)||Ml(e,t,n,r,i,a))&(!vo(i)||Fl(e,t,n,r,i,a))&(!yo(i)||zl(e,t,n,r,i,a))&(!Co(i)||Kl(e,t,n,r,i,a))&(!wo(i)||Xl(e,t,n,r,i,a))&(!Mo(i)||fu(e,t,n,r,i,a))&(!Ho(i)||ud(e,t,n,r,i,a))))&(!I(a)||!!(+(!bo(i)||Vl(e,t,n,r,i,a))&(!To(i)||Ql(e,t,n,r,i,a))&(!fo(i)||wl(e,t,n,r,i,a))&(!Ao(i)||cu(e,t,n,r,i,a))))&(!(oa(a)||ea(a))||!!(+(!lo(i)||ws(e,t,n,r,i,a))&(!uo(i)||Es(e,t,n,r,i,a))&(!_o(i)||Ll(e,t,n,r,i,a))&(!So(i)||Jl(e,t,n,r,i,a))&(!Do(i)||nu(e,t,n,r,i,a))))&(!Ro(i)||Su(e,t,n,r,i,a))&(!Lo(i)||bu(e,t,n,r,i,a))&(!oo(i)||bs(e,t,n,r,i,a))&(!$a(i)||ls(e,t,n,r,i,a))&(!co(i)||Ss(e,t,n,r,i,a))&(!mo(i)||El(e,t,n,r,i,a))&(!Oo(i)||iu(e,t,n,r,i,a))&(!Xa(i)||rs(e,t,n,r,i,a))&(!Qa(i)||as(e,t,n,r,i,a))&(!ko(i)||ou(e,t,n,r,i,a))&(!V(i)||!P(a)||Au(e,t,n,r,i,a))&(!Uo(i)||!F(a)||Mu(e,t,n,r,i,a)))&&(!Wa(i)||qo(e,t,n,r,i,a));return e.Pop(i),o}function hd(e,t){return F(t)&&!Ta(e)?t[e]:void 0}function gd(e,t){return e.reduce((e,t)=>hd(t,e),t)}function _d(e){if(L(e.length,0))return[];let t=e.split(`/`).map(e=>e.replace(/~1/g,`/`).replace(/~0/g,`~`));return t.length>0&&t[0]===``?t.slice(1):t}function vd(e,t){return gd(_d(t),e)}var yd=`https://json-schema.org`;function bd(e,t){if(F(e)&&ao(e)&&L(e.$dynamicAnchor,t))return e;if(F(e))for(let n of B(e)){let r=bd(e[n],t);if(r)return r}}function xd(e,t,n){if(L(e,n))return t.href;let r=Ga(e)&&po(e)?new URL(e.$id,t.href):t;if(P(e))for(let t of e){let e=xd(t,r,n);if(!la(e))return e}else if(F(e))for(let t of B(e)){let i=xd(e[t],r,n);if(!la(i))return i}}function Sd(e,t,n){if(L(e.$id,n.hash))return e;let r=new URL(n.href,t.href);if(L(t.pathname,r.pathname))return n.hash.startsWith(`#`)?Td(e,n):e}function Cd(e,t,n){let r=new URL(`#${e.$anchor}`,t.href),i=new URL(n.href,t.href);return L(r.href,i.href)?e:void 0}function wd(e,t,n){let r=new URL(`#${e.$dynamicAnchor}`,t.href),i=new URL(n.href,t.href);return L(r.href,i.href)?e:void 0}function Td(e,t){if(t.href.endsWith(`#`))return e;if(!t.hash.startsWith(`#`))return;let n=decodeURIComponent(t.hash.slice(1));if(n.startsWith(`/`))return vd(e,n)}function Ed(e,t,n){if(po(e)){let r=Sd(e,t,n);if(!la(r))return r}if(Za(e)){let r=Cd(e,t,n);if(!la(r))return r}if(ao(e)){let r=wd(e,t,n);if(!la(r))return r}return Td(e,n)}function Dd(e,t,n){return e.reduce((e,r)=>{let i=Ad(r,t,n);return la(i)?e:i},void 0)}function Od(e){return L(e,`const`)||L(e,`enum`)}function kd(e,t,n){return B(e).reduce((r,i)=>{if(Od(i))return r;let a=Ad(e[i],t,n);return la(a)?r:a},void 0)}function Ad(e,t,n){let r=Ga(e)&&po(e)?new URL(e.$id,t.href):t;if(Ga(e)){let t=Ed(e,r,n);if(!la(t))return t}if(P(e))return Dd(e,r,n);if(F(e))return kd(e,r,n)}function jd(e,t,n){return xd(e,new URL(t||`.`,yd),n)}function Md(e,t,n,r){let i=Vd(e,t,n,r,!1);return Ga(i)&&po(i)?i:void 0}function Nd(e){return e.href.split(`#`)[0]}function Pd(e,t){return z(e,t)?e[t]:void 0}function Fd(e,t,n){return Ad(e,t,n)}function Id(e,t,n){let r=Nd(n);if(L(r,Nd(t))||!z(e,r))return;let i=e[r],a=Ga(i)&&po(i)?new URL(i.$id,r):new URL(r);return L(n.hash,``)?i:Ad(i,a,n)}function Ld(e,t,n,r,i){if(!r.$ref.startsWith(`#`)||z(e,`$schema`))return;let a=jd(t,n,i);if(!(la(a)||L(a,n)))return{target:i,base:a,root:t}}function Rd(e,t,n){let r=e[t];if(Ga(r))return{target:n,base:t,root:r}}function zd(e,t,n,r,i){let a=i?Rd(e.context,r,n):void 0;return la(a)?Ld(e.root,e.lexicalSchema,e.referenceBase,t,n):a}function Bd(e,t,n,r,i,a){if(po(i))return;let o=Md(e,t,n,r);if(o&&!a.includes(o))return{target:i,resource:o}}function Vd(e,t,n,r,i=!0){let a=new URL(n||`.`,yd),o=i&&po(t)?new URL(t.$id,a):a,s=new URL(r,o.href);return Pd(e,r)??Fd(t,o,s)??Id(e,o,s)}function Hd(e,t,n,r,i,a){let o=new URL(n||`.`,yd),s=Vd(e,i.$dynamicRef.startsWith(`#`)?r:t,n,i.$dynamicRef,!1);if(la(s)){let e=new URL(i.$dynamicRef,o).hash;if(!e.startsWith(`#/`)&&e.startsWith(`#`)){let n=decodeURIComponent(e.slice(1));return a.find(e=>L(e.$dynamicAnchor,n))??bd(t,n)}}else return!Ga(s)||!ao(s)||new URL(i.$dynamicRef,o).hash.startsWith(`#/`)?s:a.find(e=>L(e.$dynamicAnchor,s.$dynamicAnchor))??s}function Ud(e,t){let n=e.inRetrievedFrame?e.lexicalSchema:e.root,r=t.$ref.startsWith(`#`)?e.lexicalSchema:n,i=Vd(e.context,r,e.referenceBase,t.$ref,!1);if(!i||!Ga(i))return{schema:i};let a=new URL(t.$ref,e.referenceBase).href.split(`#`)[0],o=!L(a,e.resourceBase);return{schema:i,retrievedResource:zd(e,t,i,a,o),resolvedResource:o?Bd(e.context,e.root,e.referenceBase,a,i,e.ids):void 0}}function Wd(e,t){let n=Io(e.lexicalSchema)?e.recursiveAnchors[0]:e.lexicalSchema;return Vd(e.context,n,e.lexicalBase,t.$recursiveRef,!1)}function Gd(e,t){return Hd(e.context,e.root,e.lexicalBase,e.lexicalSchema,t,e.dynamicAnchors)}var Kd=function(e,t,n,r){if(n===`a`&&!r)throw TypeError(`Private accessor was defined without a getter`);if(typeof t==`function`?e!==t||!r:!t.has(e))throw TypeError(`Cannot read private member from an object whose class did not declare it`);return n===`m`?r:n===`a`?r.call(e):r?r.value:t.get(e)},qd,Jd,Yd,Xd,Zd,Qd,$d,ef,tf,nf,rf,af,of,sf,cf,lf=class{constructor(e,t){qd.add(this),this.context=e,this.schema=t,this.ids=[],this.resourceIds=[],this.anchors=[],this.recursiveAnchors=[],this.dynamicAnchors=[],this.retrievedResources=new Map,this.retrievedFrames=[],this.resolvedResources=new Map,this.pendingResource=!0}LexicalBaseURL(){return Kd(this,qd,`m`,Xd).call(this,this.ids)}Push(e){if(!Ga(e))return;po(e)&&Kd(this,qd,`m`,af).call(this,e),Za(e)&&this.anchors.push(e),Io(e)&&this.recursiveAnchors.push(e),ao(e)&&this.dynamicAnchors.push(e);let t=this.retrievedResources.get(e);t&&this.retrievedFrames.push({schema:t.root,base:t.base,idDepth:this.ids.length,resourceDepth:this.resourceIds.length})}Pop(e){Ga(e)&&(po(e)&&Kd(this,qd,`m`,of).call(this,e),Za(e)&&this.anchors.pop(),Io(e)&&this.recursiveAnchors.pop(),ao(e)&&this.dynamicAnchors.pop(),this.retrievedResources.has(e)&&this.retrievedFrames.pop(),Kd(this,qd,`m`,cf).call(this,e))}Ref(e){let t=Ud(Kd(this,qd,`m`,Jd).call(this),e);return Kd(this,qd,`m`,Yd).call(this,t),t.schema}RecursiveRef(e){let t=Wd(Kd(this,qd,`m`,Jd).call(this),e);return t&&(this.pendingResource=!0),t}DynamicRef(e){let t=Gd(Kd(this,qd,`m`,Jd).call(this),e);return t&&(this.pendingResource=!0),t}};qd=new WeakSet,Jd=function(){return{context:this.context,root:this.schema,ids:this.ids,lexicalSchema:Kd(this,qd,`m`,$d).call(this),lexicalBase:this.LexicalBaseURL(),referenceBase:Kd(this,qd,`m`,Qd).call(this),resourceBase:Kd(this,qd,`m`,Zd).call(this),recursiveAnchors:this.recursiveAnchors,dynamicAnchors:this.dynamicAnchors,inRetrievedFrame:this.retrievedFrames.length>0}},Yd=function(e){la(e.schema)||(this.pendingResource=!0),la(e.resolvedResource)||Kd(this,qd,`m`,sf).call(this,e.resolvedResource.target,e.resolvedResource.resource),la(e.retrievedResource)||this.retrievedResources.set(e.retrievedResource.target,{base:e.retrievedResource.base,root:e.retrievedResource.root})},Xd=function(e){let t=this.retrievedFrames[this.retrievedFrames.length-1],n=t?new URL(t.base):new URL(yd);return(t?e.slice(t.idDepth):e).reduce((e,t)=>new URL(t.$id,e),n).href},Zd=function(){let e=this.retrievedFrames[this.retrievedFrames.length-1];return e?this.resourceIds.slice(e.resourceDepth).reduce((e,t)=>new URL(t.$id,e),new URL(e.base)).href:Kd(this,qd,`m`,Xd).call(this,this.resourceIds)},Qd=function(){if(this.retrievedFrames.length>0)return Kd(this,qd,`m`,Zd).call(this);let e=this.ids[this.ids.length-1];return e&&!/^[A-Za-z][A-Za-z0-9+.-]*:/.test(e.$id)?this.LexicalBaseURL():Kd(this,qd,`m`,Zd).call(this)},$d=function(){let e=this.retrievedFrames[this.retrievedFrames.length-1];return e?this.ids.length>e.idDepth?this.ids[this.ids.length-1]:e.schema:this.ids.length>0?this.ids[this.ids.length-1]:this.schema},ef=function(e){e.forEach(e=>Kd(this,qd,`m`,nf).call(this,e,!1))},tf=function(e){e.forEach(e=>Kd(this,qd,`m`,rf).call(this,e,!1))},nf=function e(t,n=!0){if(Ka(t))return;if(P(t))return Kd(this,qd,`m`,ef).call(this,t);if(!Ga(t))return;let r=t;if(n||!po(r)){!n&&ao(r)&&this.dynamicAnchors.push(r);for(let t of B(r))Kd(this,qd,`m`,e).call(this,r[t],!1)}},rf=function e(t,n=!0){if(Ka(t))return;if(P(t))return Kd(this,qd,`m`,tf).call(this,t);if(!Ga(t))return;let r=t;if(n||!po(r)){!n&&ao(r)&&this.dynamicAnchors.pop();for(let t of B(r))Kd(this,qd,`m`,e).call(this,r[t],!1)}},af=function(e){this.ids.push(e);let t=this.pendingResource;this.pendingResource=!1,t&&this.resourceIds.push(e),Kd(this,qd,`m`,nf).call(this,e,!0)},of=function(e){this.ids.pop(),this.resourceIds.length>0&&L(this.resourceIds[this.resourceIds.length-1],e)&&this.resourceIds.pop(),Kd(this,qd,`m`,rf).call(this,e,!0)},sf=function(e,t){Kd(this,qd,`m`,af).call(this,t),this.resolvedResources.set(e,t)},cf=function(e){if(!this.resolvedResources.has(e))return;let t=this.resolvedResources.get(e);Kd(this,qd,`m`,of).call(this,t),this.resolvedResources.delete(e)};function uf(e){switch(e.keyword){case`additionalProperties`:return`must not have additional properties`;case`anyOf`:return`must match a schema in anyOf`;case`boolean`:return`schema is false`;case`const`:return`must be equal to constant`;case`contains`:return`must contain at least 1 valid item`;case`dependencies`:return`must have properties ${e.params.dependencies.join(`, `)} when property ${e.params.property} is present`;case`dependentRequired`:return`must have properties ${e.params.dependencies.join(`, `)} when property ${e.params.property} is present`;case`enum`:return`must be equal to one of the allowed values`;case`exclusiveMaximum`:return`must be ${e.params.comparison} ${e.params.limit}`;case`exclusiveMinimum`:return`must be ${e.params.comparison} ${e.params.limit}`;case`format`:return`must match format "${e.params.format}"`;case`if`:return`must match "${e.params.failingKeyword}" schema`;case`maxItems`:return`must not have more than ${e.params.limit} items`;case`maxLength`:return`must not have more than ${e.params.limit} characters`;case`maxProperties`:return`must not have more than ${e.params.limit} properties`;case`maximum`:return`must be ${e.params.comparison} ${e.params.limit}`;case`minItems`:return`must not have fewer than ${e.params.limit} items`;case`minLength`:return`must not have fewer than ${e.params.limit} characters`;case`minProperties`:return`must not have fewer than ${e.params.limit} properties`;case`minimum`:return`must be ${e.params.comparison} ${e.params.limit}`;case`multipleOf`:return`must be multiple of ${e.params.multipleOf}`;case`not`:return`must not be valid`;case`oneOf`:return`must match exactly one schema in oneOf`;case`pattern`:return`must match pattern "${e.params.pattern}"`;case`propertyNames`:return`property names ${e.params.propertyNames.join(`, `)} are invalid`;case`required`:return`must have required properties ${e.params.requiredProperties.join(`, `)}`;case`type`:return typeof e.params.type==`string`?`must be ${e.params.type}`:`must be either ${e.params.type.join(` or `)}`;case`unevaluatedItems`:return`must not have unevaluated items`;case`unevaluatedProperties`:return`must not have unevaluated properties`;case`uniqueItems`:return`must not have duplicate items`;case`~refine`:return e.params.message;default:return`an unknown validation error occurred`}}var df=uf;function ff(){return df}var pf={assign:0,create:0,clone:0,discard:0,update:0};function mf(e){return Ua().immutableTypes?Object.freeze(e):e}function hf(e,t){return pf.assign+=1,mf({...e,...t})}function gf(e){return e}function _f(e){return z(e,`~kind`)||z(e,`~unsafe`)}function vf(e){let t={};for(let n of B(e)){if(Ta(n))continue;let r=Object.getOwnPropertyDescriptor(e,n);r.value=Ef(r.value),L(r.enumerable,!0)?t[n]=r.value:Object.defineProperty(t,n,r)}return t}function yf(e){let t={};for(let n of B(e))Ta(n)||(t[n]=Ef(e[n]));for(let n of Oa(e))t[n]=Ef(e[n]);return t}function bf(e){return ha(e)?gf(e):_f(e)?vf(e):yf(e)}function xf(e){return e.map(e=>Ef(e))}function Sf(e){return e.slice()}function Cf(e){return new RegExp(e.source,e.flags)}function wf(e){return new Map(Ef([...e.entries()]))}function Tf(e){return new Set(Ef([...e.values()]))}function Ef(e){return Ia(e)?Sf(e):La(e)?Cf(e):Ba(e)?wf(e):za(e)?Tf(e):P(e)?xf(e):F(e)?bf(e):e}function Df(e){return pf.clone+=1,Ef(e)}function Of(e,t){for(let n of Object.keys(t))Object.defineProperty(e,n,{configurable:!0,writable:!0,enumerable:!1,value:t[n]});return e}function kf(e,t){return{...e,...t}}function Af(e,t,n={}){pf.create+=1;let r=kf(t,n);return mf(Ua().enumerableKind?kf(r,e):Of(r,e))}function jf(e,t){pf.discard+=1;let n={};for(let r of B(e)){if(t.includes(r))continue;let i=Object.getOwnPropertyDescriptor(e,r);i.value=Df(i.value),Object.defineProperty(n,r,i)}return mf(n)}function Mf(e,t,n){pf.update+=1;let r=Ua(),i=Df(e);for(let e of Object.keys(t))Object.defineProperty(i,e,{configurable:!0,writable:!0,enumerable:r.enumerableKind,value:t[e]});for(let e of Object.keys(n))Object.defineProperty(i,e,{configurable:!0,enumerable:!0,writable:!0,value:n[e]});return mf(i)}function Nf(...e){let[t,n,r]=Li(e,{3:(e,t,n)=>[e,t,n],2:(e,t)=>[{},e,t]}),i=new lf(t,n),a=new Go,o=md(i,a,`#`,``,n,r),s=a.GetErrors(),c=ff();return[o,s.map(e=>({...e,message:c(e)}))]}function Pf(...e){let[t,n,r]=Li(e,{3:(e,t,n)=>[e,t,n],2:(e,t)=>[{},e,t]});return fd(new lf(t,n),new Wo,n,r)}function Ff(...e){let[t,n,r]=Li(e,{3:(e,t,n)=>[e,t,n],2:(e,t)=>[{},e,t]});return Pf(t,n,r)}function If(...e){let[t,n,r]=Li(e,{3:(e,t,n)=>[e,t,n],2:(e,t)=>[{},e,t]}),[i,a]=Nf(t,n,r);return a}function Lf(e,t){return F(e)&&z(e,`~kind`)&&L(e[`~kind`],t)}function Rf(e){return F(e)}function zf(e,t,n){return Af({"~kind":`Deferred`},{type:`deferred`,action:e,parameters:t,options:n},{})}function Bf(e){return Lf(e,`Deferred`)}function Vf(e){return Mf(e,{"~readonly":!0},{})}function Hf(e,t){return Mf(Vf(e),{},t)}function Uf(e,t,n,r){return Hf(Y(e,t,n),r)}function Wf(e){return Mf(e,{"~optional":!0},{})}function Gf(e,t){return Mf(Wf(e),{},t)}function Kf(e,t,n,r){return Gf(Y(e,t,n),r)}function qf(e,t){return Af({"~kind":`Array`},{type:`array`,items:e},t)}function Jf(e){return Lf(e,`Array`)}function Yf(e){return jf(e,[`~kind`,`type`,`items`])}function Xf(e,t,n={}){return Af({"~kind":`Constructor`},{type:`constructor`,parameters:e,instanceType:t},n)}function Zf(e){return Lf(e,`Constructor`)}function Qf(e){return jf(e,[`~kind`,`type`,`parameters`,`instanceType`])}function $f(e,t,n={}){return Af({"~kind":`Function`},{type:`function`,parameters:e,returnType:t},n)}function ep(e){return Lf(e,`Function`)}function tp(e){return jf(e,[`~kind`,`type`,`parameters`,`returnType`])}function np(e,t){return Af({"~kind":`Ref`},{$ref:e},t)}function rp(e){return Lf(e,`Ref`)}function ip(e,t){return Af({"~kind":`Generic`},{type:`generic`,parameters:e,expression:t})}function ap(e){return Lf(e,`Generic`)}function op(e){return Af({"~kind":`Any`},{},e)}function sp(e){return Lf(e,`Any`)}var cp=`(?!)`;function lp(e){return Af({"~kind":`Never`},{not:{}},e)}function up(e){return Lf(e,`Never`)}function dp(e,t={}){return Gf(e,t)}function W(e){return dp(e)}function fp(e){return Rf(e)&&z(e,`~optional`)}function pp(e){return B(e).filter(t=>!fp(e[t]))}function mp(e){return B(e)}function hp(e){return ka(e)}function G(e,t={}){let n=pp(e);return Af({"~kind":`Object`},{type:`object`,...n.length>0?{required:n}:{},properties:e},t)}function gp(e){return Lf(e,`Object`)}function _p(e){return jf(e,[`~kind`,`type`,`properties`,`required`])}function vp(e){return Af({"~kind":`Unknown`},{},e)}function yp(e){return Lf(e,`Unknown`)}function bp(e,t,n){return Af({"~kind":`Cyclic`},{$defs:B(e).reduce((t,n)=>({...t,[n]:Mf(e[n],{},{$id:n})}),{}),$ref:t},n)}function xp(e){return Lf(e,`Cyclic`)}function Sp(e){return sa(e)&&z(e,`~unsafe`)&&aa(e[`~unsafe`])}function Cp(e){return Lf(e,`Infer`)}function wp(e,t,n,r={}){return Af({"~kind":`Dependent`},{if:e,then:t,else:n},r)}function Tp(e){return Lf(e,`Dependent`)}function Ep(e){return jf(e,[`~kind`,`if`,`then`,`else`])}function Dp(e){return sa(e)}function Op(e){return B(e).filter(e=>isNaN(e)).reduce((t,n)=>[...t,e[n]],[])}function kp(e,t){return Af({"~kind":`Enum`},{enum:Dp(e)?Op(e):e},t)}function Ap(e){return Lf(e,`Enum`)}function jp(e,t={}){return Af({"~kind":`Intersect`},{allOf:e},t)}function Mp(e){return Lf(e,`Intersect`)}function Np(e){return jf(e,[`~kind`,`allOf`])}function Pp(e){return Rf(e)&&z(e,`~immutable`)}function Fp(e,t={}){return Hf(e,t)}function Ip(e){return Rf(e)&&z(e,`~readonly`)}var Lp=`-?(?:0|[1-9][0-9]*)n`;function Rp(e){return Af({"~kind":`BigInt`},{type:`bigint`},e)}function zp(e){return Lf(e,`BigInt`)}function Bp(e){return Af({"~kind":`Boolean`},{type:`boolean`},e)}function Vp(e){return Lf(e,`Boolean`)}var Hp=`-?(?:0|[1-9][0-9]*)`;function Up(e){return Af({"~kind":`Integer`},{type:`integer`},e)}function Wp(e){return Lf(e,`Integer`)}var Gp=class extends Error{constructor(e){super(`Invalid Literal value`),Object.defineProperty(this,"cause",{value:{value:e},writable:!1,configurable:!1,enumerable:!1})}};function Kp(e){return ea(e)?`bigint`:ta(e)?`boolean`:oa(e)?`number`:I(e)?`string`:(()=>{throw new Gp(e)})()}function K(e,t){return Af({"~kind":`Literal`},{type:Kp(e),const:e},t)}function qp(e){return ea(e)||ta(e)||oa(e)||I(e)}function Jp(e){return Xp(e)&&oa(e.const)}function Yp(e){return Xp(e)&&I(e.const)}function Xp(e){return Lf(e,`Literal`)}function Zp(e){return Af({"~kind":`Null`},{type:`null`},e)}function Qp(e){return Lf(e,`Null`)}var $p=`-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?`;function em(e){return Af({"~kind":`Number`},{type:`number`},e)}function tm(e){return Lf(e,`Number`)}function nm(e){return Af({"~kind":`Symbol`},{type:`symbol`},e)}function rm(e){return Lf(e,`Symbol`)}function im(e){return Af({"~kind":`String`},{type:`string`},e)}function am(e){return Lf(e,`String`)}function q(e,t={}){return Af({"~kind":`Union`},{anyOf:e},t)}function om(e){return Lf(e,`Union`)}function sm(e){return jf(e,[`~kind`,`anyOf`])}function cm(e){let t=Rg(e);return L(t.length,2)?t[0]:[]}function lm(e){return!0}function um(e){return R(e,(e,t)=>fm(e)?um(t):!1,()=>!0)}function dm(e){return!L(e.length,0)&&um(e)}function fm(e){return om(e)?dm(e.anyOf):Xp(e)?lm(e.const):!1}function pm(e){return dm(e)}function mm(e){return Af({"~kind":`TemplateLiteral`},{type:`string`,pattern:e},{})}function hm(e,t,n=[]){return R(e,(e,r)=>hm(r,t,[...n,`${e}${t}`]),()=>n)}function gm(e,t){return L(e.length,0)?[`${t}`]:hm(e,t)}function _m(e,t,n=[]){return R(t,(t,r)=>_m(e,r,[...n,...vm(e,t)]),()=>n)}function vm(e,t){return om(t)?_m(e,t.anyOf):Xp(t)?gm(e,t.const):Nu()}function ym(e,t){return R(t,(t,n)=>ym(vm(e,t),n),()=>e)}function bm(e){return e.map(e=>K(e))}function xm(e){return q(bm(ym([],e)))}function Sm(e){return L(e.length,0)?Nu():L(e.length,1)&&Xp(e[0])?e[0]:xm(e)}function Cm(e){let t=cm(e);return L(t.length,0)?im():pm(t)?Sm(t):mm(e)}function wm(e){let t=Cm(e);return a_(t)?im():t}function Tm(e,t){return Af({"~kind":`Record`},{type:`object`,patternProperties:{[e]:t}})}function Em(e){return Tm(Mh,e)}function Dm(e){return G({true:e,false:e})}function Om(e,t={}){let[n,r,i]=[e,e.length,!1];return Af({"~kind":`Tuple`},{type:`array`,additionalItems:i,items:n,minItems:r},t)}function km(e){return Lf(e,`Tuple`)}function Am(e){return jf(e,[`~kind`,`type`,`items`,`minItems`,`additionalItems`])}function jm(e){return jf(e,[`~readonly`])}function Mm(e,t){return Mf(jm(e),{},t)}function Nm(e,t,n,r){return Mm(Y(e,t,n),r)}function Pm(e,t={}){return Mm(e,t)}function Fm(e){return jf(e,[`~optional`])}function Im(e,t){return Mf(Fm(e),{},t)}function Lm(e,t,n,r){return Im(Y(e,t,n),r)}function Rm(e,t={}){return Im(e,t)}function zm(e){return e.reduceRight((e,t,n)=>({[n]:t,...e}),{})}function Bm(e){return G(zm(e.items))}function Vm(e){return gp(e)||km(e)}function Hm(e,t){return Ip(e)?!!Ip(t):!1}function Um(e,t){return fp(e)?!!fp(t):!1}function Wm(e,t){let n=Hm(e,t),r=Um(e,t),i=Pm(Rm(ch([e,t])));return n&&r?Fp(dp(i)):n&&!r?Fp(i):!n&&r?dp(i):i}function Gm(e,t,n){return n in e?n in t?Wm(e[n],t[n]):e[n]:n in t?t[n]:lp()}function Km(e,t){return[...new Set([...B(e),...B(t)])].reduce((n,r)=>({...n,[r]:Gm(e,t,r)}),{})}function qm(e){return gp(e)?e.properties:km(e)?zm(e.items):{}}function Jm(e,t){return G(Km(qm(e),qm(t)))}function Ym(e,t){let n=cy(e,t);return L(n,2)?e:L(n,3)||L(n,0)?t:lp()}function Xm(e,t){let n=Vm(e),r=Vm(t);return n&&r?Jm(e,t):n&&!r?e:!n&&r?t:Ym(e,t)}function Zm(e,t){return up(e)||sp(e)?e:yp(e)||up(t)||sp(t)?t:yp(t)?e:Xm(e,t)}function Qm(e,t){return om(e)||om(t)}function $m(e,t){let n=dh(e),r=dh(t);return Qm(n,r)?ch([n,r]):Zm(n,r)}function eh(e,t,n=[]){return R(t,(t,r)=>eh(e,r,[...n,$m(t,e)]),()=>L(n.length,0)?[e]:n)}function th(e,t,n=[]){return R(e,(e,r)=>th(r,t,[...n,...nh([e],t)]),()=>n)}function nh(e,t=[]){return R(e,(e,n)=>om(e)?nh(n,th(e.anyOf,t)):nh(n,eh(e,t)),()=>t)}function rh(e,t){return d_(sy({},e,t))?[]:[e]}function ih(e,t,n=[]){return R(e,(e,r)=>ih(r,t,[...n,...rh(e,t)]),()=>n)}function ah(e,t){let n=dh(e);return uh(ih(om(n)?n.anyOf:[n],t))}function oh(e,t,n){return uh([ch([e,t]),ah(n,e)])}function sh(e,t=[]){return R(e,(e,n)=>sh(n,[...t,K(e)]),()=>uh(t))}function ch(e){return uh(fy(nh(e)))}function lh(e){return dh(wm(e))}function uh(e){return fh(fy(e))}function dh(e){return Tp(e)?oh(e.if,e.then,e.else):Ap(e)?sh(e.enum):Mp(e)?ch(e.allOf):a_(e)?lh(e.pattern):om(e)?uh(e.anyOf):e}function fh(e){return L(e.length,1)?e[0]:L(e.length,0)?lp():q(e)}function ph(e,t){return Dh(sh(e),t)}function mh(e,t){return Tm(Ah,t)}function hh(e,t){return Dh(ch(e),t)}function gh(e,t){return I(e)||oa(e)?G({[e]:t}):L(e,!1)?G({false:t}):L(e,!0)?G({true:t}):G({})}function _h(e,t){return Tm(jh,t)}function vh(e,t){return z(e,`pattern`)&&(I(e.pattern)||e.pattern instanceof RegExp)?Tm(e.pattern.toString(),t):Tm(Mh,t)}function yh(e,t){return pm(cm(e))?Dh(lh(e),t):Tm(e,t)}function bh(e){return om(e)?xh(e.anyOf):[e]}function xh(e,t=[]){return R(e,(e,n)=>xh(n,[...t,...bh(e)]),()=>t)}function Sh(e){return e.some(e=>am(e)||tm(e)||Wp(e))}function Ch(e,t){return L(Sh(e),!0)?Tm(Mh,t):void 0}function wh(e,t){return e.reduce((e,n)=>Xp(n)&&(I(n.const)||oa(n.const))?{...e,[n.const]:t}:e,{})}function Th(e,t){return G(wh(e,t))}function Eh(e,t){let n=xh(e),r=Ch(n,t);return Rf(r)?r:Th(n,t)}function Dh(e,t){return sp(e)?Em(t):Vp(e)?Dm(t):Ap(e)?ph(e.enum,t):Wp(e)?mh(e,t):Mp(e)?hh(e.allOf,t):Xp(e)?gh(e.const,t):tm(e)?_h(e,t):om(e)?Eh(e.anyOf,t):am(e)?vh(e,t):a_(e)?yh(e.pattern,t):G({})}function Oh(e,t,n){return mC([e])?Mf(Dh(e,t),{},n):Nh(e,t,n)}function kh(e,t,n,r,i){return Oh(Y(e,t,n),Y(e,t,r),i)}var Ah=`^${Hp}$`,jh=`^${$p}$`,Mh=`^.*$`;function Nh(e,t,n={}){return zf(`Record`,[e,t],n)}function Ph(e,t,n={}){return Oh(e,t,n)}function Fh(e,t){return Tm(e,t)}function Ih(e){return L(e,Mh)?im():L(e,Ah)?Up():L(e,jh)?em():Cm(e)}function Lh(e){return B(e.patternProperties)[0]}function Rh(e){return Ih(Lh(e))}function zh(e){return e.patternProperties[Lh(e)]}function Bh(e){return Lf(e,`Record`)}function Vh(e){return Af({"~kind":`Rest`},{type:`rest`,items:e},{})}function Hh(e){return Lf(e,`Rest`)}function Uh(e){return Lf(e,`This`)}function Wh(e){return Af({"~kind":`Undefined`},{type:`undefined`},e)}function Gh(e){return Lf(e,`Undefined`)}function Kh(e){return Lf(e,`Void`)}function qh(e){return Rp()}function Jh(e){return im()}function Yh(e){return em()}function Xh(e){return Up()}function Zh(e){return lp()}function Qh(e){return K(e)}function $h(e){return e}function eg(e){return q(e[1])}function tg(e){return e.length===3?[...e[0],...e[2]]:e.length===1?[...e[0]]:[]}function ng(e){return[e[0],...e[1]]}function rg(e){return e}function ig(e){return e[1]}function ag(e){return L(e.length,2)}function og(e,t,n){return ag(e)?t(e[0],e[1]):n()}function sg(e,t){return L(t.indexOf(e),0)?[e,t.slice(e.length)]:[]}function cg(e,t){for(let n=0;n<e.length;n++){let r=sg(e[n],t);if(ag(r))return r}return[]}function lg(e,t){return Array.from({length:t-e+1},(t,n)=>String.fromCharCode(e+n))}var ug=[...lg(97,122),...lg(65,90)],dg=[`0`,...lg(49,57)],fg=`//`,pg=`/*`,mg=`*/`;function hg(e){let t=e.indexOf(mg);return L(t,-1)?``:e.slice(t+2)}function gg(e){let t=e.indexOf(`
|
|
11
|
+
`);return L(t,-1)?``:e.slice(t)}function _g(e){return e.replace(/^[ \t\r\f\v]+/,``)}function vg(e){let t=_g(e);return t.startsWith(pg)?vg(hg(t.slice(2))):t.startsWith(fg)?vg(gg(t.slice(2))):t}function yg(e){let t=e.trimStart();return t.startsWith(pg)?yg(hg(t.slice(2))):t.startsWith(fg)?yg(gg(t.slice(2))):t}[...dg];function bg(e,t){return cg([e],t)}function xg(e,t){return L(e,``)?[``,t]:e.startsWith(`
|
|
12
|
+
`)?bg(e,vg(t)):e.startsWith(` `)?bg(e,t):bg(e,yg(t))}[...ug,...dg],[...dg];function Sg(e){return L(e,``)?[]:[e.slice(0,1),e.slice(1)]}function Cg(e,t){return R(e,(e,n)=>t.startsWith(e)?!0:Cg(n,t),()=>!1)}function wg(e,t,n=``){return og(Sg(t),(r,i)=>Cg(e,t)?[n,t]:wg(e,i,`${n}${r}`),()=>[])}function Tg(e,t){return og(wg(e,t),(e,t)=>L(e,``)?[]:[e,t],()=>[])}var Eg=(e,t,n=()=>[])=>e.length===2?t(e):n(),Dg=e=>Eg(xg(`-?(?:0|[1-9][0-9]*)n`,e),([e,t])=>[qh(e),t]),Og=e=>Eg(xg(`.*`,e),([e,t])=>[Jh(e),t]),kg=e=>Eg(xg(`-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?`,e),([e,t])=>[Yh(e),t]),Ag=e=>Eg(xg(`-?(?:0|[1-9][0-9]*)`,e),([e,t])=>[Xh(e),t]),jg=e=>Eg(xg(`(?!)`,e),([e,t])=>[Zh(e),t]),Mg=e=>Eg(Tg([`-?(?:0|[1-9][0-9]*)n`,`.*`,`-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?`,`-?(?:0|[1-9][0-9]*)`,`(?!)`,`(`,`)`,`$`,`|`],e),([e,t])=>[Qh(e),t]),Ng=e=>Eg(Eg(Dg(e),([e,t])=>[e,t],()=>Eg(Og(e),([e,t])=>[e,t],()=>Eg(kg(e),([e,t])=>[e,t],()=>Eg(Ag(e),([e,t])=>[e,t],()=>Eg(jg(e),([e,t])=>[e,t],()=>Eg(Pg(e),([e,t])=>[e,t],()=>Eg(Mg(e),([e,t])=>[e,t],()=>[]))))))),([e,t])=>[$h(e),t]),Pg=e=>Eg(Eg(xg(`(`,e),([e,t])=>Eg(Lg(t),([t,n])=>Eg(xg(`)`,n),([n,r])=>[[e,t,n],r]))),([e,t])=>[eg(e),t]),Fg=e=>Eg(Eg(Eg(Ig(e),([e,t])=>Eg(xg(`|`,t),([t,n])=>Eg(Fg(n),([n,r])=>[[e,t,n],r]))),([e,t])=>[e,t],()=>Eg(Eg(Ig(e),([e,t])=>[[e],t]),([e,t])=>[e,t],()=>Eg([[],e],([e,t])=>[e,t],()=>[]))),([e,t])=>[tg(e),t]),Ig=e=>Eg(Eg(Ng(e),([e,t])=>Eg(Lg(t),([t,n])=>[[e,t],n])),([e,t])=>[ng(e),t]),Lg=e=>Eg(Eg(Fg(e),([e,t])=>[e,t],()=>Eg(Ig(e),([e,t])=>[e,t],()=>[])),([e,t])=>[rg(e),t]),Rg=e=>Eg(Eg(xg(`^`,e),([e,t])=>Eg(Lg(t),([t,n])=>Eg(xg(`$`,n),([n,r])=>[[e,t,n],r]))),([e,t])=>[ig(e),t]);function zg(e){return e.join(`|`)}function Bg(e){return e.slice(1,e.length-1)}function Vg(e,t,n){return Qg(t,`${n}${e}`)}function Hg(e,t){return Qg(e,`${t}${Lp}`)}function Ug(e,t){return Qg(e,`${t}${Hp}`)}function Wg(e,t){return Qg(e,`${t}${$p}`)}function Gg(e,t){return Zg(q([K(`false`),K(`true`)]),e,t)}function Kg(e,t){return Qg(e,`${t}.*`)}function qg(e,t,n){return Qg(t,`${n}${Bg(e)}`)}function Jg(e,t,n){return Zg(t_(e,{}),t,n)}function Yg(e,t,n){return Zg(sh(e),t,n)}function Xg(e,t,n,r=[]){return R(e,(e,i)=>Xg(i,t,n,[...r,Zg(e,[],``)]),()=>Qg(t,`${n}(${zg(r)})`))}function Zg(e,t,n){return Ap(e)?Yg(e.enum,t,n):Wp(e)?Ug(t,n):Xp(e)?Vg(e.const,t,n):zp(e)?Hg(t,n):Vp(e)?Gg(t,n):tm(e)?Wg(t,n):am(e)?Kg(t,n):a_(e)?qg(e.pattern,t,n):i_(e)?Jg(e.parameters[0],t,n):om(e)?Xg(e.anyOf,t,n):cp}function Qg(e,t){return R(e,(e,n)=>Zg(e,n,t),()=>t)}function $g(e){return`^${Qg(e,``)}$`}function e_(e){return mm($g(e))}function t_(e,t){return mC(e)?Mf(e_(e),{},t):r_(e,t)}function n_(e,t,n,r){return t_(_C(e,t,n),r)}function r_(e,t={}){return zf(`TemplateLiteral`,[e],t)}function i_(e){return Rf(e)&&z(e,`action`)&&L(e.action,`TemplateLiteral`)}function a_(e){return Lf(e,`TemplateLiteral`)}function o_(e){return Af({"~kind":`ExtendsUnion`},{inferred:e})}function s_(e){return F(e)&&z(e,`~kind`)&&z(e,`inferred`)&&L(e[`~kind`],`ExtendsUnion`)&&F(e.inferred)}function J(e){return Af({"~kind":`ExtendsTrue`},{inferred:e})}function c_(e){return F(e)&&z(e,`~kind`)&&z(e,`inferred`)&&L(e[`~kind`],`ExtendsTrue`)&&F(e.inferred)}function l_(){return Af({"~kind":`ExtendsFalse`},{})}function u_(e){return F(e)&&z(e,`~kind`)&&L(e[`~kind`],`ExtendsFalse`)}function d_(e){return s_(e)||c_(e)}function f_(e,t,n){return d_(e)?t(e.inferred):n()}function p_(e,t,n,r){return f_(jv(e,n,r),r=>J(hf(hf(e,r),{[t]:n})),()=>l_())}function m_(e,t){return J(e)}function h_(e,t,n,r,i){return f_(jv(e,t,n),e=>f_(jv(e,t,r),e=>J(e),()=>l_()),()=>f_(jv(e,t,i),e=>J(e),()=>l_()))}function g_(e,t,n){return jv(e,t,sh(n))}function __(e,t,n){return R(n,(n,r)=>f_(jv(e,t,n),e=>__(e,t,r),()=>l_()),()=>J(e))}function v_(e,t,n){return jv(e,t,lh(n))}function y_(e,t,n){return R(n,(n,r)=>f_(jv(e,t,n),e=>J(e),()=>y_(e,t,r)),()=>l_())}function b_(e,t,n){return sp(n)?m_(e,t):Tp(n)?h_(e,t,n.if,n.then,n.else):Ap(n)?g_(e,t,n.enum):Cp(n)?p_(e,n.name,t,n.extends):Mp(n)?__(e,t,n.allOf):a_(n)?v_(e,t,n.pattern):om(n)?y_(e,t,n.anyOf):yp(n)?J(e):l_()}function x_(e,t,n){return Cp(n)?b_(e,t,n):sp(n)||yp(n)?J(e):o_(e)}function S_(e,t){let n=Pp(e),r=Pp(t);return n&&r||!n&&r?!0:!(n&&!r)}function C_(e,t,n,r){return Jf(r)?S_(t,r)?jv(e,n,r.items):l_():b_(e,t,r)}function w_(e,t,n){return zp(n)?J(e):b_(e,t,n)}function T_(e,t,n){return Vp(n)?J(e):b_(e,t,n)}function E_(e,t,n,r,i){let a=Cp(r)?t:r,o=Cp(r)?r:t,s=fp(t),c=fp(r);return!s&&c?l_():f_(jv(e,a,o),e=>k_(e,n,i),()=>l_())}function D_(e,t,n,r){return R(r,(r,i)=>E_(e,t,n,r,i),()=>fp(t)?J(e):l_())}function O_(e,t,n){return R(t,(t,r)=>D_(e,t,r,n),()=>J(e))}function k_(e,t,n){return O_(e,t,n)}function A_(e,t,n){return Kh(n)?J(e):jv(e,t,n)}function j_(e,t,n,r){return sp(r)||yp(r)?J(e):Zf(r)?f_(k_(e,t,r.parameters),e=>A_(e,n,r.instanceType),()=>l_()):l_()}function M_(e,t,n,r,i){return f_(jv(e,t,i),()=>jv(e,n,i),()=>jv(e,r,i))}function N_(e,t,n){return jv(e,sh(t),n)}function P_(e,t,n,r){return sp(r)||yp(r)?J(e):ep(r)?f_(k_(e,t,r.parameters),e=>A_(e,n,r.returnType),()=>l_()):l_()}function F_(e,t,n){return Wp(n)||tm(n)?J(e):b_(e,t,n)}function I_(e,t,n){return jv(e,ch(t),n)}function L_(e,t,n){return t===n?J(e):l_()}function R_(e,t,n){return Xp(n)?L_(e,t,n.const):zp(n)?J(e):b_(e,K(t),n)}function z_(e,t,n){return Xp(n)?L_(e,t,n.const):Vp(n)?J(e):b_(e,K(t),n)}function B_(e,t,n){return Xp(n)?L_(e,t,n.const):tm(n)?J(e):b_(e,K(t),n)}function V_(e,t,n){return Xp(n)?L_(e,t,n.const):am(n)?J(e):b_(e,K(t),n)}function H_(e,t,n){return ea(t.const)?R_(e,t.const,n):ta(t.const)?z_(e,t.const,n):oa(t.const)?B_(e,t.const,n):I(t.const)?V_(e,t.const,n):Nu()}function U_(e,t,n){return Cp(n)?b_(e,t,n):J(e)}function W_(e,t,n){return Qp(n)?J(e):b_(e,t,n)}function G_(e,t,n){return tm(n)?J(e):b_(e,t,n)}function K_(e,t,n){return fp(t)?fp(n)?J(e):l_():J(e)}function q_(e,t,n){return Cp(n)&&up(n.extends)?l_():f_(jv(e,t,n),e=>K_(e,t,n),()=>l_())}function J_(e,t){return e.reduce((e,n)=>n in t&&d_(t[n])?{...e,...t[n].inferred}:Nu(),{})}function Y_(e,t,n){let r={};for(let i of B(n))r[i]=i in t?q_({},t[i],n[i]):fp(n[i])?Cp(n[i])?J(hf(e,{[n[i].name]:n[i].extends})):J(e):l_();let i=ka(r).every(e=>d_(e)),a=i?J_(B(r),r):{};return i?J(a):l_()}function X_(e,t,n){let r=Y_(e,t,n);return d_(r)?J(hf(e,r.inferred)):l_()}function Z_(e,t,n){return X_(e,t,n)}function Q_(e,t){return B(t).reduce((n,r)=>({...n,[r]:z(e,r)?om(n[r])?q([...n[r].anyOf,t[r]]):q([e[r],t[r]]):t[r]}),e)}function $_(e,t,n,r){return R(t,(t,i)=>f_(jv({},e[t],n),t=>$_(e,i,n,Q_(r,t)),()=>l_()),()=>J(r))}function ev(e,t,n,r){return $_(t,B(t),r,e)}function tv(e,t,n){return Bh(n)?ev(e,t,Lh(n),zh(n)):gp(n)?Z_(e,t,n.properties):b_(e,G(t),n)}function nv(e,t){return L(B(t).length,0)?J(e):l_()}function rv(e,t,n,r,i){return jv(e,n,i)}function iv(e,t,n,r){return Bh(r)?rv(e,Ih(t),n,Ih(Lh(r)),zh(r)):gp(r)?nv(e,r.properties):sp(r)||yp(r)?J(e):l_()}function av(e,t,n){return am(n)?J(e):b_(e,t,n)}function ov(e,t,n){return rm(n)?J(e):b_(e,t,n)}function sv(e,t,n){return jv(e,lh(t),n)}function cv(e,t){return Af({"~kind":`Inferrable`},{name:e,type:t},{})}function lv(e){return F(e)&&z(e,`~kind`)&&z(e,`name`)&&z(e,`type`)&&L(e[`~kind`],`Inferrable`)&&I(e.name)&&F(e.type)}function uv(e){return Hh(e)?Cp(e.items)?Jf(e.items.extends)?cv(e.items.name,e.items.extends.items):yp(e.items.extends)?cv(e.items.name,e.items.extends):void 0:Nu():void 0}function dv(e){return Cp(e)?cv(e.name,e.extends):void 0}function fv(e,t,n=[]){return R(e,(e,r)=>f_(jv({},e,t),()=>fv(r,t,[...n,e]),()=>void 0),()=>n)}function pv(e,t,n,r){let i=fv(n,r);return P(i)?J(hf(e,{[t]:Om(i)})):l_()}function mv(e,t,n,r){let i=fv(n,r);return P(i)?J(hf(e,{[t]:q(i)})):l_()}function hv(e){return[...e].reverse()}function gv(e,t){return t?hv(e):e}function _v(e){let t=e.length>0?e[0]:void 0;return Rf(Rf(t)?uv(t):void 0)}function vv(e,t,n,r,i,a){return f_(jv(e,n,i),e=>xv(e,t,r,a),()=>l_())}function yv(e,t,n,r,i){let a=uv(r);return lv(a)?pv(e,a.name,gv(n,t),a.type):R(n,(n,a)=>vv(e,t,n,a,r,i),()=>l_())}function bv(e,t,n,r){return R(r,(r,i)=>yv(e,t,n,r,i),()=>L(n.length,0)?J(e):l_())}function xv(e,t,n,r){return bv(e,t,n,r)}function Sv(e,t,n){let r=gC(e,pC([],[]),n),i=_v(r);return xv(e,i,gv(t,i),gv(r,i))}function Cv(e,t,n){let r=dv(n);return lv(r)?mv(e,r.name,t,r.type):R(t,(t,r)=>f_(jv(e,t,n),e=>Cv(e,r,n),()=>l_()),()=>J(e))}function wv(e,t,n){let r=gC(e,pC([],[]),t);return km(n)?Sv(e,r,n.items):Jf(n)?Cv(e,r,n.items):b_(e,Om(r),n)}function Tv(e,t,n){return Kh(n)||Gh(n)?J(e):b_(e,t,n)}function Ev(e,t,n){return R(n,(n,r)=>f_(jv(e,t,n),e=>J(e),()=>Ev(e,t,r)),()=>l_())}function Dv(e,t,n){return R(t,(t,r)=>f_(Ev(e,t,n),e=>Dv(e,r,n),()=>l_()),()=>J(e))}function Ov(e,t,n){let r=dv(n);return lv(r)?mv(e,r.name,t,r.type):om(n)?Dv(e,t,n.anyOf):Dv(e,t,[n])}function kv(e,t,n){return Cp(n)?b_(e,t,n):sp(n)||yp(n)?J(e):l_()}function Av(e,t,n){return Kh(n)?J(e):b_(e,t,n)}function jv(e,t,n){return sp(t)?x_(e,t,n):Jf(t)?C_(e,t,t.items,n):zp(t)?w_(e,t,n):Vp(t)?T_(e,t,n):Zf(t)?j_(e,t.parameters,t.instanceType,n):Tp(t)?M_(e,t.if,t.then,t.else,n):Ap(t)?N_(e,t.enum,n):ep(t)?P_(e,t.parameters,t.returnType,n):Wp(t)?F_(e,t,n):Mp(t)?I_(e,t.allOf,n):Xp(t)?H_(e,t,n):up(t)?U_(e,t,n):Qp(t)?W_(e,t,n):tm(t)?G_(e,t,n):gp(t)?tv(e,t.properties,n):Bh(t)?iv(e,Lh(t),zh(t),n):am(t)?av(e,t,n):rm(t)?ov(e,t,n):a_(t)?sv(e,t.pattern,n):km(t)?wv(e,t.items,n):Gh(t)?Tv(e,t,n):om(t)?Ov(e,t.anyOf,n):yp(t)?kv(e,t,n):Kh(t)?Av(e,t,n):l_()}function Mv(e,t){return ch([...e,G(t)])}function Nv(e,t,n){return mC(e)?Mf(Mv(e,t),{},n):Fv(e,t,n)}function Pv(e,t,n,r,i){return Nv(_C(e,t,n),hC(e,t,r),i)}function Fv(e,t,n={}){return zf(`Interface`,[e,t],n)}function Iv(e){return Rf(e)&&z(e,`action`)&&L(e.action,`Interface`)}function Lv(e,t,n){return e.includes(n)?!0:Bv([...e,n],t,t[n])}function Rv(e,t,n){return zv(e,t,hp(n))}function zv(e,t,n){return R(n,(n,r)=>Bv(e,t,n)?!0:zv(e,t,r),()=>!1)}function Bv(e,t,n){return rp(n)?Lv(e,t,n.$ref):Jf(n)?Bv(e,t,n.items):Zf(n)?zv(e,t,[...n.parameters,n.instanceType]):ep(n)?zv(e,t,[...n.parameters,n.returnType]):Iv(n)?Rv(e,t,n.parameters[1]):Mp(n)?zv(e,t,n.allOf):gp(n)?Rv(e,t,n.properties):om(n)?zv(e,t,n.anyOf):km(n)?zv(e,t,n.items):Bh(n)?Bv(e,t,zh(n)):!1}function Vv(e,t,n){return Bv(e,t,n)}function Hv(e,t){return t.reduce((t,n)=>Vv([n],e,e[n])?[...t,n]:t,[])}function Uv(e){return Hv(e,mp(e))}function Wv(e,t,n){return n.includes(t)?n:t in e?qv(e,e[t],[...n,t]):Nu()}function Gv(e,t,n){return Kv(e,hp(t),n)}function Kv(e,t,n){return t.reduce((t,n)=>qv(e,n,t),n)}function qv(e,t,n){return rp(t)?Wv(e,t.$ref,n):Jf(t)?qv(e,t.items,n):Zf(t)?Kv(e,[...t.parameters,t.instanceType],n):ep(t)?Kv(e,[...t.parameters,t.returnType],n):Iv(t)?Gv(e,t.parameters[1],n):Mp(t)?Kv(e,t.allOf,n):gp(t)?Gv(e,t.properties,n):om(t)?Kv(e,t.anyOf,n):km(t)?Kv(e,t.items,n):Bh(t)?qv(e,zh(t),n):n}function Jv(e,t,n){return qv(e,n,[t])}function Yv(e){return op()}function Xv(e){return B(e).reduce((t,n)=>({...t,[n]:Qv(e[n])}),{})}function Zv(e){return e.reduce((e,t)=>[...e,Qv(t)],[])}function Qv(e){return rp(e)?Yv(e.$ref):Jf(e)?qf(Qv(e.items),Yf(e)):Zf(e)?Xf(Zv(e.parameters),Qv(e.instanceType)):ep(e)?$f(Zv(e.parameters),Qv(e.returnType)):Mp(e)?jp(Zv(e.allOf)):gp(e)?G(Xv(e.properties)):Bh(e)?Ph(Rh(e),Qv(zh(e))):om(e)?q(Zv(e.anyOf)):km(e)?Om(Zv(e.items)):e}function $v(e,t){return t in e?Qv(e[t]):vp()}function ey(e){return $v(e.$defs,e.$ref)}function ty(e,t,n){let r=_C(e,pC([],[]),t),i=hC({},pC([],[]),n);return ch([...r,G(i)])}function ny(e,t){return B(e).filter(e=>t.includes(e)).reduce((t,n)=>{let r=e[n],i=Iv(r)?ty(e,r.parameters[0],r.parameters[1]):r;return{...t,[n]:i}},{})}function ry(e,t,n){return bp(ny(e,Jv(e,t,n)),t)}function iy(e,t){return t in e?rp(e[t])?iy(e,e[t].$ref):e[t]:lp()}function ay(e,t){return iy(e,t)}function oy(e){return xp(e)?ey(e):Sp(e)?vp():e}function sy(e,t,n){return jv(e,oy(t),oy(n))}function cy(e,t){let n=[sy({},e,t),sy({},t,e)];return d_(n[0])&&d_(n[1])?0:d_(n[0])&&u_(n[1])?2:u_(n[0])&&d_(n[1])?3:1}function ly(e,t,n=[],r=t){return R(t,(t,i)=>{let a=cy(e,t);return L(a,2)||L(a,0)?r:L(a,1)?ly(e,i,[...n,t],r):ly(e,i,n,r)},()=>[...n,e])}function uy(e,t,n){let r=dh(e);return sp(r)||yp(r)?[r]:up(r)?dy(t,n):gp(r)?dy(t,[...n,r]):dy(t,ly(r,n))}function dy(e,t=[]){return R(e,(e,n)=>uy(e,n,t),()=>t)}function fy(e){return xh(dy(e))}function py(e,t){return Mf(dh(e),{},t)}function my(e,t,n,r){return py(Y(e,t,n),r)}function hy(e,t=[]){return Bf(e)&&L(e.action,`Conditional`)?rp(e.parameters[0])?hy(e.parameters[2],hy(e.parameters[3],[...t,e.parameters[0].$ref])):hy(e.parameters[2],hy(e.parameters[3],t)):Bf(e)&&L(e.action,`Mapped`)&&Bf(e.parameters[1])&&L(e.parameters[1].action,`KeyOf`)&&rp(e.parameters[1].parameters[0])?[...t,e.parameters[1].parameters[0].$ref]:t}function gy(e,t){return e.reduce((e,n)=>[...e,t.includes(n.name)],[])}function _y(e,t,n=[]){return R(e,(e,r)=>R(t,(t,i)=>_y(r,i,[...n,[t,e]]),()=>n),()=>n)}function vy(e){return a_(e)?lh(e.pattern):Ap(e)?sh(e.enum):e}function yy(e){let t=vy(e);return om(t)?[...t.anyOf]:[t]}function by(e,t){return e.reduce((e,n)=>[...e,[...n,t]],[])}function xy(e,t){return t.reduce((t,n)=>[...t,...by(e,n)],[])}function Sy(e){return e.reduce((e,t)=>L(t[0],!0)?xy(e,yy(t[1])):xy(e,[t[1]]),[[]])}function Cy(e,t,n){let r=_y(t,gy(e,hy(n)));return Bf(n)&&L(n.action,`Conditional`)||Bf(n)&&L(n.action,`Mapped`)?Sy(r):[t]}function wy(){return[`(not-resolvable)`,lp()]}function Ty(){return[`(not-generic)`,lp()]}function Ey(e,t,n){return[e,ip(t,n)]}function Dy(e,t,n){return t in e?Oy(e,t,e[t],n):wy()}function Oy(e,t,n,r){return ap(n)?Ey(t,n.parameters,n.expression):rp(n)?Dy(e,n.$ref,r):Ty()}function ky(e,t,n){return Oy(e,`(anonymous)`,t,n)}function Ay(e,t,n){if(Cp(t)||qy(t)||d_(sy({},t,n)))return;let r={parameter:e,expect:n,actual:t};throw Error(`Argument for parameter ${e} does not satisfy constraint`,{cause:r})}function jy(e,t,n,r,i){let a=Y(e,t,i);return Ay(n,a,r),hf(e,{[n]:a})}function My(e,t,n,r,i){let a=Y(e,t,n.extends),o=Y(e,t,n.equals);return R(i,(i,o)=>Ny(jy(e,t,n.name,a,i),t,r,o),()=>Ny(jy(e,t,n.name,a,o),t,r,[]))}function Ny(e,t,n,r){return R(n,(n,i)=>My(e,t,n,i,r),()=>e)}function Py(e,t,n,r){return Ny(e,t,n,r)}var Fy=0,Iy=0;function Ly(){if(!da(Iy,Ua().maxInstantiationCount))throw Error(`Type instantiation is excessively deep and possibly infinite`)}function Ry(){Ly(),Iy++,Fy++}function zy(){Fy--,L(Fy,0)&&(Iy=0)}function By(e){return ua(e.callstack.length,0)?e.callstack[e.callstack.length-1]:``}function Vy(e,t){return L(By(e),t)}function Hy(e,t,n,r,i,a){Ry();try{let o=Py(e,t,r,a),s=Y(o,pC([...t.callstack,n.$ref],t.visited),i);return Y(o,pC([],[]),s)}finally{zy()}}function Uy(e,t,n,r,i,a){return a.reduce((a,o)=>{let s=Hy(e,t,n,r,i,o);return[...a,s]},[])}function Wy(e,t,n,r,i,a){let o=Uy(e,t,n,r,i,Cy(r,a,i));return L(o.length,1)?o[0]:uh(o)}function Gy(e,t,n,r){let i=_C(e,t,r),a=ky(e,n,r),o=a[0],s=a[1];return ap(s)?Vy(t,o)?Ky(np(o),i):Wy(e,t,np(o),s.parameters,s.expression,i):Ky(n,i)}function Ky(e,t){return Af({"~kind":`Call`},{type:`call`,target:e,arguments:t},{})}function qy(e){return Lf(e,`Call`)}function Jy(e){return jf(e,[`~immutable`])}function Yy(e,t){return Mf(Jy(e),{},t)}function Xy(e,t,n,r){return Yy(Y(e,t,n),r)}function Zy(e,t){return e(t)}function Qy(e,t){return I(t)?K(Zy(e,t)):K(t)}function $y(e,t){return tb(e,lh(t))}function eb(e,t){return q(t.map(t=>tb(e,t)))}function tb(e,t){return Xp(t)?Qy(e,t.const):a_(t)?$y(e,t.pattern):om(t)?eb(e,t.anyOf):t}function nb(e,t={}){return zf(`Capitalize`,[e],t)}function rb(e,t={}){return zf(`Lowercase`,[e],t)}function ib(e,t={}){return zf(`Uncapitalize`,[e],t)}function ab(e,t={}){return zf(`Uppercase`,[e],t)}var ob=e=>e[0].toUpperCase()+e.slice(1),sb=e=>e.toLowerCase(),cb=e=>e[0].toLowerCase()+e.slice(1),lb=e=>e.toUpperCase();function ub(e,t){return mC([e])?Mf(tb(ob,e),{},t):nb(e,t)}function db(e,t){return mC([e])?Mf(tb(sb,e),{},t):rb(e,t)}function fb(e,t){return mC([e])?Mf(tb(cb,e),{},t):ib(e,t)}function pb(e,t){return mC([e])?Mf(tb(lb,e),{},t):ab(e,t)}function mb(e,t,n,r){return ub(Y(e,t,n),r)}function hb(e,t,n,r){return db(Y(e,t,n),r)}function gb(e,t,n,r){return fb(Y(e,t,n),r)}function _b(e,t,n,r){return pb(Y(e,t,n),r)}function vb(e,t,n,r,i={}){return zf(`Conditional`,[e,t,n,r],i)}function yb(e,t,n,r,i,a){let o=sy(e,n,r);return s_(o)?q([Y(o.inferred,t,i),Y(e,t,a)]):c_(o)?Y(o.inferred,t,i):Y(e,t,a)}function bb(e,t,n,r,i,a,o){return mC([n,r])?Mf(yb(e,t,n,r,i,a),{},o):vb(n,r,i,a,o)}function xb(e,t,n,r,i,a,o){return bb(e,t,Y(e,t,n),Y(e,t,r),i,a,o)}function Sb(e,t={}){return zf(`ConstructorParameters`,[e],t)}function Cb(e){let t=Zf(e)?e.parameters:[];return Om(gC({},pC([],[]),t))}function wb(e,t){return mC([e])?Mf(Cb(e),{},t):Sb(e,t)}function Tb(e,t,n,r){return wb(Y(e,t,n),r)}function Eb(e,t,n={}){return zf(`Exclude`,[e,t],n)}function Db(e,t,n){return mC([e,t])?Mf(ah(e,t),{},n):Eb(e,t,n)}function Ob(e,t,n,r,i){return Db(Y(e,t,n),Y(e,t,r),i)}function kb(e,t,n={}){return zf(`Extract`,[e,t],n)}function Ab(e,t){return d_(sy({},e,t))?[e]:[]}function jb(e,t,n=[]){return R(e,(e,r)=>jb(r,t,[...n,...Ab(e,t)]),()=>n)}function Mb(e,t){let n=dh(e);return uh(jb(om(n)?n.anyOf:[n],t))}function Nb(e,t,n){return mC([e,t])?Mf(Mb(e,t),{},n):kb(e,t,n)}function Pb(e,t,n,r,i){return Nb(Y(e,t,n),Y(e,t,r),i)}function Fb(e,t,n={}){return zf(`Index`,[e,t],n)}function Ib(e,t){return Gb(ay(e,t))}function Lb(e,t,n){return Gb(oh(e,t,n))}function Rb(e,t){let n=B(e).filter(e=>!z(t,e)),r=B(t).filter(t=>!z(e,t)),i=B(e).filter(e=>z(t,e)),a=n.reduce((t,n)=>({...t,[n]:e[n]}),{}),o=r.reduce((e,n)=>({...e,[n]:t[n]}),{}),s=i.reduce((n,r)=>({...n,[r]:ch([e[r],t[r]])}),{});return hf(hf(a,o),s)}function zb(e){return e.reduce((e,t)=>Rb(e,Gb(t)),{})}function Bb(e){return e}function Vb(e){return Gb(Bm(Om(e)))}function Hb(e,t){return B(e).filter(e=>e in t).reduce((n,r)=>({...n,[r]:uh([e[r],t[r]])}),{})}function Ub(e,t){return R(e,(e,n)=>Ub(n,Hb(t,Gb(e))),()=>t)}function Wb(e){return R(e,(e,t)=>Ub(t,Gb(e)),()=>Nu())}function Gb(e){return xp(e)?Ib(e.$defs,e.$ref):Tp(e)?Lb(e.if,e.then,e.else):Mp(e)?zb(e.allOf):om(e)?Wb(e.anyOf):km(e)?Vb(e.items):gp(e)?Bb(e.properties):{}}function Kb(e){return G(Gb(e))}var qb=RegExp(`^(?:0|[1-9][0-9]*)$`);function Jb(e){let t=`${e}`;return qb.test(t)?parseInt(t):e}function Yb(e){return K(Jb(e))}function Xb(e){return e.map(e=>Zb(e))}function Zb(e){return Mp(e)?jp(Xb(e.allOf)):om(e)?q(Xb(e.anyOf)):Xp(e)?Yb(e.const):e}function Qb(e,t){return d_(sy({},Zb(t),em()))?e:Xp(t)&&L(t.const,`length`)?em():lp()}function $b(e,t){return ox(ay(e,t))}function ex(e,t,n){return ox(oh(e,t,n))}function tx(e){return ox(sh(e))}function nx(e){return ox(ch(e))}function rx(e){return[`${e}`]}function ix(e){return ox(lh(e))}function ax(e){return e.reduce((e,t)=>[...e,...ox(t)],[])}function ox(e){return xp(e)?$b(e.$defs,e.$ref):Tp(e)?ex(e.if,e.then,e.else):Ap(e)?tx(e.enum):Mp(e)?nx(e.allOf):Xp(e)?rx(e.const):a_(e)?ix(e.pattern):om(e)?ax(e.anyOf):[]}function sx(e){return ox(e)}function cx(e,t){return t.map(t=>lx(e,t))}function lx(e,t){return Jf(t)?qf(lx(e,t.items)):Zf(t)?Xf(cx(e,t.parameters),lx(e,t.instanceType)):ep(t)?$f(cx(e,t.parameters),lx(e,t.returnType)):km(t)?Om(cx(e,t.items)):om(t)?q(cx(e,t.anyOf)):Mp(t)?jp(cx(e,t.allOf)):Uh(t)?G(e):t}function ux(e,t){return lx(e,t)}function dx(e,t){return ux(e,t in e?e[t]:lp())}function fx(e,t){return t.reduce((t,n)=>[...t,dx(e,n)],[])}function px(e,t){return uh(fx(e,sx(t)))}var mx=new RegExp(Ah);function hx(e){return e.filter(e=>mx.test(e))}function gx(e){return uh(fx(e,hx(mp(e))))}function _x(e,t){return tm(t)?gx(e):px(e,t)}function vx(e){return K(Jb(e))}function yx(e){return e.map(e=>bx(e))}function bx(e){return Mp(e)?jp(yx(e.allOf)):om(e)?q(yx(e.anyOf)):Xp(e)?vx(e.const):e}function xx(e,t){return e.reduceRight((e,n,r)=>d_(sy({},K(r),t))?[n,...e]:e,[])}function Sx(e,t){return fh(xx(e,bx(t)))}function Cx(e){return fh(e)}function wx(e,t){return Xp(t)&&L(t.const,`length`)?K(e.length):tm(t)||Wp(t)?Cx(e):Sx(e,t)}function Tx(e,t){return Jf(e)?Qb(e.items,t):gp(e)?_x(e.properties,t):km(e)?wx(e.items,t):lp()}function Ex(e){return xp(e)||Tp(e)||Mp(e)||om(e)?Kb(e):e}function Dx(e,t,n){return mC([e,t])?Mf(Tx(Ex(e),t),{},n):Fb(e,t,n)}function Ox(e,t,n,r,i){return Dx(Y(e,t,n),Y(e,t,r),i)}function kx(e,t={}){return zf(`InstanceType`,[e],t)}function Ax(e){return Zf(e)?e.instanceType:lp()}function jx(e,t){return mC([e])?Mf(Ax(e),{},t):kx(e,t)}function Mx(e,t,n,r={}){return jx(Y(e,t,n),r)}function Nx(e,t={}){return zf(`KeyOf`,[e],t)}function Px(){return q([em(),im(),nm()])}function Fx(e){return em()}function Ix(e){return e.reduce((e,t)=>qp(t)?[...e,K(Jb(t))]:Nu(),[])}function Lx(e){return fh(Ix(B(e)))}function Rx(e){return Rh(e)}function zx(e){return fh(e.map((e,t)=>K(t)))}function Bx(e){return sp(e)?Px():Jf(e)?Fx(e.items):gp(e)?Lx(e.properties):Bh(e)?Rx(e):km(e)?zx(e.items):lp()}function Vx(e){return xp(e)||Tp(e)||Mp(e)||om(e)?Kb(e):e}function Hx(e,t){return mC([e])?Mf(Bx(Vx(e)),{},t):Nx(e,t)}function Ux(e,t,n,r){return Hx(Y(e,t,n),r)}function Wx(e,t,n,r,i={}){return zf(`Mapped`,[e,t,n,r],i)}function Gx(e){return Yx(lh(e))}function Kx(e){return e.reduce((e,t)=>[...e,...Yx(t)],[])}function qx(e){return Yx(sh(e))}function Jx(e){return oa(e)?[K(`${e}`)]:[K(e)]}function Yx(e){return Ap(e)?qx(e.enum):Xp(e)?Jx(e.const):a_(e)?Gx(e.pattern):om(e)?Kx(e.anyOf):[e]}function Xx(e){return Yx(e)}function Zx(e){return a_(e)?lh(e.pattern):e}function Qx(e,t,n,r,i,a){let o=hf(e,{[n.name]:r}),s=Zx(Y(o,t,i)),c=Y(o,t,a);return Jp(s)||Yp(s)?{[s.const]:c}:{}}function $x(e,t,n,r,i,a){return r.reduce((r,o)=>[...r,Qx(e,t,n,o,i,a)],[])}function eS(e){return e.reduce((e,t)=>[...e,G(t)],[])}function tS(e,t,n,r,i,a){return ch(eS($x(e,t,n,Xx(r),i,a)))}function nS(e,t,n,r,i,a,o){return mC([r])?Mf(tS(e,t,n,r,i,a),{},o):Wx(n,r,i,a,o)}function rS(e,t,n,r,i,a,o){return nS(e,t,n,Y(e,t,r),i,a,o)}function iS(e,t,n){let r=hf(e,t);return B(t).filter(e=>n.includes(e)).reduce((e,n)=>({...e,[n]:ry(r,n,t[n])}),{})}function aS(e,t,n){let r=hf(e,t);return B(t).filter(e=>!n.includes(e)).reduce((e,n)=>({...e,[n]:Y(r,pC([],[]),t[n])}),{})}function oS(e,t,n){let r=Uv(t),i=iS(e,t,r),a=aS(e,t,r);return Mf({...i,...a},{},n)}function sS(e,t,n,r){return oS(e,n,r)}function cS(e,t={}){return zf(`NonNullable`,[e],t)}function lS(e){return Db(e,q([Zp(),Wh()]),{})}function uS(e,t){return mC([e])?Mf(lS(e),{},t):cS(e,t)}function dS(e,t,n,r){return uS(Y(e,t,n),r)}function fS(e,t,n={}){return zf(`Omit`,[e,t],n)}function pS(e){let t=Kb(e);return gp(t)?t.properties:Nu()}function mS(e,t){return B(e).reduce((n,r)=>t.includes(r)?n:{...n,[r]:e[r]},{})}function hS(e,t){return G(mS(pS(e),sx(t)))}function gS(e,t,n){return mC([e,t])?Mf(hS(e,t),{},n):fS(e,t,n)}function _S(e,t,n,r,i){return gS(Y(e,t,n),Y(e,t,r),i)}function vS(e,t={}){return zf(`Parameters`,[e],t)}function yS(e){let t=ep(e)?e.parameters:[];return Om(gC({},pC([],[]),t))}function bS(e,t){return mC([e])?Mf(yS(e),{},t):vS(e,t)}function xS(e,t,n,r){return bS(Y(e,t,n),r)}function SS(e,t={}){return zf(`Partial`,[e],t)}function CS(e,t){let n=OS(ay(e,t));return bp(hf(e,{[t]:n}),t)}function wS(e,t,n){return OS(oh(e,t,n))}function TS(e){return OS(ch(e))}function ES(e){return q(e.map(e=>OS(e)))}function DS(e){return G(B(e).reduce((t,n)=>({...t,[n]:dp(e[n])}),{}))}function OS(e){return xp(e)?CS(e.$defs,e.$ref):Tp(e)?wS(e.if,e.then,e.else):Mp(e)?TS(e.allOf):om(e)?ES(e.anyOf):gp(e)?DS(e.properties):G({})}function kS(e,t){return mC([e])?Mf(OS(e),{},t):SS(e,t)}function AS(e,t,n,r){return kS(Y(e,t,n),r)}function jS(e,t,n={}){return zf(`Pick`,[e,t],n)}function MS(e,t){return B(e).reduce((n,r)=>t.includes(r)?hf(n,{[r]:e[r]}):n,{})}function NS(e,t){return G(MS(pS(e),sx(t)))}function PS(e,t,n){return mC([e,t])?Mf(NS(e,t),{},n):jS(e,t,n)}function FS(e,t,n,r,i){return PS(Y(e,t,n),Y(e,t,r),i)}function IS(e,t={}){return zf(`ReadonlyObject`,[e],t)}function LS(e){return TC(qf(e))}function RS(e,t){let n=WS(ay(e,t));return bp(hf(e,{[t]:n}),t)}function zS(e,t,n){return WS(oh(e,t,n))}function BS(e){return WS(ch(e))}function VS(e){return G(B(e).reduce((t,n)=>({...t,[n]:Fp(e[n])}),{}))}function HS(e){return TC(Om(e))}function US(e){return q(e.map(e=>WS(e)))}function WS(e){return Jf(e)?LS(e.items):xp(e)?RS(e.$defs,e.$ref):Tp(e)?zS(e.if,e.then,e.else):Mp(e)?BS(e.allOf):gp(e)?VS(e.properties):km(e)?HS(e.items):om(e)?US(e.anyOf):e}function GS(e,t){return mC([e])?Mf(WS(e),{},t):IS(e)}function KS(e,t,n,r){return GS(Y(e,t,n),r)}function qS(e,t,n,r){return t.visited.includes(r)?n:r in e?Y(e,pC(t.callstack,[...t.visited,r]),e[r]):n}function JS(e,t){let n=$S(ay(e,t));return bp(hf(e,{[t]:n}),t)}function YS(e,t,n){return $S(oh(e,t,n))}function XS(e){return $S(ch(e))}function ZS(e){return q(e.map(e=>$S(e)))}function QS(e){return G(B(e).reduce((t,n)=>({...t,[n]:Rm(e[n])}),{}))}function $S(e){return xp(e)?JS(e.$defs,e.$ref):Tp(e)?YS(e.if,e.then,e.else):Mp(e)?XS(e.allOf):om(e)?ZS(e.anyOf):gp(e)?QS(e.properties):G({})}function eC(e,t={}){return zf(`Required`,[e],t)}function tC(e,t){return mC([e])?Mf($S(e),{},t):eC(e,t)}function nC(e,t,n,r){return tC(Y(e,t,n),r)}function rC(e,t={}){return zf(`ReturnType`,[e],t)}function iC(e){return ep(e)?e.returnType:lp()}function aC(e,t){return mC([e])?Mf(iC(e),{},t):rC(e,t)}function oC(e,t,n,r={}){return aC(Y(e,t,n),r)}function sC(e,t){return zf(`With`,[e,t],{})}function cC(e,t){return lC(e,t)}function lC(e,t){return mC([e])?Mf(e,{},t):sC(e,t)}function uC(e,t,n,r){return lC(Y(e,t,n),r)}function dC(e){return Hh(e)?km(e.items)?fC(e.items.items):Cp(e.items)||rp(e.items)?[e]:[lp()]:[e]}function fC(e){return e.reduce((e,t)=>[...e,...dC(t)],[])}function pC(e,t){return{callstack:e,visited:t}}function mC(e){return R(e,(e,t)=>!rp(e)&&mC(t),()=>!0)}function hC(e,t,n){return B(n).reduce((r,i)=>({...r,[i]:Y(e,t,n[i])}),{})}function gC(e,t,n){return fC(_C(e,t,n))}function _C(e,t,n){return n.map(n=>Y(e,t,n))}function vC(e,t){let n=fp(e)?Gf(t,{}):t,r=Ip(e)?Hf(n,{}):n;return Pp(e)?CC(r,{}):r}function yC(e,t,n,r,i){return L(n,`AddImmutable`)?wC(e,t,r[0],i):L(n,`RemoveImmutable`)?Xy(e,t,r[0],i):L(n,`AddReadonly`)?Uf(e,t,r[0],i):L(n,`RemoveReadonly`)?Nm(e,t,r[0],i):L(n,`AddOptional`)?Kf(e,t,r[0],i):L(n,`RemoveOptional`)?Lm(e,t,r[0],i):L(n,`Capitalize`)?mb(e,t,r[0],i):L(n,`Conditional`)?xb(e,t,r[0],r[1],r[2],r[3],i):L(n,`ConstructorParameters`)?Tb(e,t,r[0],i):L(n,`Evaluate`)?my(e,t,r[0],i):L(n,`Exclude`)?Ob(e,t,r[0],r[1],i):L(n,`Extract`)?Pb(e,t,r[0],r[1],i):L(n,`Index`)?Ox(e,t,r[0],r[1],i):L(n,`InstanceType`)?Mx(e,t,r[0],i):L(n,`Interface`)?Pv(e,t,r[0],r[1],i):L(n,`KeyOf`)?Ux(e,t,r[0],i):L(n,`Lowercase`)?hb(e,t,r[0],i):L(n,`Mapped`)?rS(e,t,r[0],r[1],r[2],r[3],i):L(n,`Module`)?sS(e,t,r[0],i):L(n,`NonNullable`)?dS(e,t,r[0],i):L(n,`Pick`)?FS(e,t,r[0],r[1],i):L(n,`Parameters`)?xS(e,t,r[0],i):L(n,`Partial`)?AS(e,t,r[0],i):L(n,`Omit`)?_S(e,t,r[0],r[1],i):L(n,`ReadonlyObject`)?KS(e,t,r[0],i):L(n,`Record`)?kh(e,t,r[0],r[1],i):L(n,`Required`)?nC(e,t,r[0],i):L(n,`ReturnType`)?oC(e,t,r[0],i):L(n,`TemplateLiteral`)?n_(e,t,r[0],i):L(n,`Uncapitalize`)?gb(e,t,r[0],i):L(n,`Uppercase`)?_b(e,t,r[0],i):L(n,`With`)?uC(e,t,r[0],r[1]):zf(n,r,i)}function bC(e,t,n){return vC(n,rp(n)?qS(e,t,n,n.$ref):Jf(n)?qf(Y(e,t,n.items),Yf(n)):qy(n)?Gy(e,t,n.target,n.arguments):Zf(n)?Xf(_C(e,t,n.parameters),Y(e,t,n.instanceType),Qf(n)):ep(n)?$f(_C(e,t,n.parameters),Y(e,t,n.returnType),tp(n)):Tp(n)?wp(Y(e,t,n.if),Y(e,t,n.then),Y(e,t,n.else),Ep(n)):Mp(n)?jp(_C(e,t,n.allOf),Np(n)):gp(n)?G(hC(e,t,n.properties),_p(n)):Bh(n)?Fh(Lh(n),Y(e,t,zh(n))):Hh(n)?Vh(Y(e,t,n.items)):km(n)?Om(gC(e,t,n.items),Am(n)):om(n)?q(_C(e,t,n.anyOf),sm(n)):n)}function Y(e,t,n){return Bf(n)?yC(e,t,n.action,n.parameters,n.options):bC(e,t,n)}function xC(e,t){return Y(e,pC([],[]),t)}function SC(e){return Mf(e,{"~immutable":!0},{})}function CC(e,t){return Mf(SC(e),{},t)}function wC(e,t,n,r){return CC(Y(e,t,n),r)}function TC(e,t={}){return CC(e,t)}function EC(e,t={}){return py(e,t)}function DC(e,t){let n=cy(e,t);return L(n,3)?1:+!!L(n,1)}function OC(e,t,n=[]){return R(t,(r,i)=>L(DC(e,r),1)?OC(e,i,[...n,r]):[...n,e,...t],()=>[...n,e])}function kC(e,t=[]){return R(e,(e,n)=>kC(n,OC(e,t)),()=>t)}function AC(e){return kC(e)}function jC(e,t,n){return P(n)?n.map(n=>HC(e,t.items,n)):n}function MC(e,t,n){return HC({...e,...t.$defs},np(t.$ref),n)}function NC(e,t){let n=z(t,`unevaluatedProperties`)?{additionalProperties:t.unevaluatedProperties}:{},r=EC(xC(e,t));return gp(r)?cC(r,n):r}function PC(e,t,n){return HC(e,NC(e,t),n)}function FC(e){return z(e,`additionalProperties`)?e.additionalProperties:void 0}function IC(e,t,n){if(!F(n)||P(n))return n;let r=FC(t);for(let i of B(n))z(t.properties,i)?n[i]=HC(e,t.properties[i],n[i]):ta(r)&&L(r,!0)||Rf(r)&&Ff(e,r,n[i])?n[i]=HC(e,r,n[i]):delete n[i];return n}function LC(e,t,n){if(!F(n))return n;let r=FC(t),[i,a]=[new RegExp(Lh(t)),zh(t)];for(let t of B(n))i.test(t)?n[t]=HC(e,a,n[t]):ta(r)&&L(r,!0)||Rf(r)&&Ff(e,r,n[t])?n[t]=HC(e,r,n[t]):delete n[t];return n}function RC(e,t,n){return z(e,t.$ref)?HC(e,e[t.$ref],n):n}function zC(e,t,n){if(!P(n))return n;let r=Math.min(n.length,t.items.length);for(let i=0;i<r;i++)n[i]=HC(e,t.items[i],n[i]);return ua(n.length,r)?n.slice(0,r):n}function BC(e){return Df(e)}function VC(e,t,n){for(let r of t.anyOf){let t=HC(e,r,BC(n));if(Ff(e,r,t))return t}return n}function HC(e,t,n){return Jf(t)?jC(e,t,n):xp(t)?MC(e,t,n):Mp(t)?PC(e,t,n):gp(t)?IC(e,t,n):Bh(t)?LC(e,t,n):rp(t)?RC(e,t,n):km(t)?zC(e,t,n):om(t)?VC(e,t,n):n}function UC(e,t){for(let n of Va.Keys(e))Va.HasPropertyKey(t,n)||(t[n]=e[n]);return t}function WC(e){let t={};for(let n of Va.Keys(e))t[n]=qC(e[n]);return t}function GC(e){return KC(AC(e))}function KC(e){return e.map(e=>qC(e))}function qC(e){return UC(e,Jf(e)?qf(qC(e.items),Yf(e)):Mp(e)?jp(KC(e.allOf)):om(e)?q(GC(e.anyOf)):gp(e)?G(WC(e.properties)):Bh(e)?Ph(Rh(e),qC(zh(e))):km(e)?Om(KC(e.items)):e)}function JC(e){return qC(e)}function YC(...e){let[t,n,r]=Li(e,{3:(e,t,n)=>[e,t,n],2:(e,t)=>[{},e,t]});return HC(t,Ua().unionPrioritySort?JC(n):n,r)}BigInt(2**53-1),BigInt(-(2**53-1));function XC(e,t,n){if(!P(n))return n;for(let r=0;r<n.length;r++)n[r]=aw(e,t.items,n[r]);return n}function ZC(e,t,n){return aw({...e,...t.$defs},np(t.$ref),n)}function QC(e,t){return la(t)?ra(e.default)?e.default():BC(e.default):t}function $C(e,t,n){return aw(e,EC(xC(e,t)),n)}function ew(e,t,n){if(!F(n))return n;let r=B(t.properties);for(let i of r){let r=aw(e,t.properties[i],n[i]);(!la(r)||!fp(t.properties[i])&&z(t.properties[i],`default`))&&(n[i]=r)}if(!Ya(t)||ta(t.additionalProperties))return n;for(let i of B(n))r.includes(i)||(n[i]=aw(e,t.additionalProperties,n[i]));return n}function tw(e,t,n){if(!F(n))return n;let[r,i]=[new RegExp(Lh(t)),zh(t)];for(let t of B(n))r.test(t)&&to(i)&&(n[t]=aw(e,i,n[t]));if(!Ya(t))return n;for(let i of B(n))r.test(i)||(n[i]=aw(e,t.additionalProperties,n[i]));return n}function nw(e,t,n){return z(e,t.$ref)?aw(e,e[t.$ref],n):n}function rw(e,t,n){if(!P(n))return n;let[r,i]=[t.items,Math.max(t.items.length,n.length)];for(let t=0;t<i;t++)t<r.length&&(n[t]=aw(e,r[t],n[t]));return n}function iw(e,t,n){for(let r of t.anyOf){let t=aw(e,r,BC(n));if(Ff(e,r,t))return t}return n}function aw(e,t,n){let r=to(t)?QC(t,n):n;return Jf(t)?XC(e,t,r):xp(t)?ZC(e,t,r):Mp(t)?$C(e,t,r):gp(t)?ew(e,t,r):Bh(t)?tw(e,t,r):rp(t)?nw(e,t,r):km(t)?rw(e,t,r):om(t)?iw(e,t,r):r}function ow(...e){let[t,n,r]=Li(e,{3:(e,t,n)=>[e,t,n],2:(e,t)=>[{},e,t]});return aw(t,n,r)}q([G({type:K(`insert`),path:im(),value:vp()}),Object({type:K(`update`),path:im(),value:vp()}),G({type:K(`delete`),path:im()})]);var sw=e=>typeof e==`object`&&e?e:e===!1?{not:{}}:{};function cw(e){return typeof e!=`object`||!e?JSON.stringify(e)??`null`:Array.isArray(e)?`[${e.map(e=>cw(e)).join(`,`)}]`:`{${Object.keys(e).filter(t=>e[t]!==void 0).sort().map(t=>`${JSON.stringify(t)}:${cw(e[t])}`).join(`,`)}}`}function lw(e){let t=2166136261,n=1523705862;for(let r=0;r<e.length;r++){let i=e.charCodeAt(r);t=Math.imul(t^i,16777619),n=Math.imul(n^i,1540483477)^n>>>13}return(t>>>0).toString(16).padStart(8,`0`)+(n>>>0).toString(16).padStart(8,`0`)}function uw(e,t){return e===t||cw(e)===cw(t)}function dw(e,t,n,r){if(Ff(n,r))return;let i=[...If(n,r)].slice(0,3);throw Pi(e,`${t}: ${i.map(e=>`${e.instancePath||`/`} ${e.message}`).join(`; `)}`,i)}function fw(e,t,n){let r=YC(e,ow(e,BC(t??{})));return dw(`input`,n,e,r),r}function pw(e,t){return cw(mw(sw(e),t))}function mw(e,t){if(Array.isArray(t)){let n=e.items;return Array.isArray(n)?t.map((e,t)=>mw(sw(n[t]),e)):t.map(e=>mw(sw(n),e))}if(typeof t!=`object`||!t)return t;let n=sw(e.properties),r={};for(let[e,i]of Object.entries(t)){let t=sw(n[e]);`default`in t&&uw(t.default,i)||(r[e]=mw(t,i))}return r}var hw=[`minLength`,`maxLength`,`pattern`,`format`,`minimum`,`maximum`,`exclusiveMinimum`,`exclusiveMaximum`,`multipleOf`,`minItems`,`maxItems`,`uniqueItems`,`minProperties`,`maxProperties`],gw=e=>typeof e.type==`string`?[e.type]:Array.isArray(e.type)?e.type:void 0,_w=new Set([...hw,`type`,`properties`,`required`,`additionalProperties`,`patternProperties`,`items`,`additionalItems`,`const`,`enum`,`anyOf`,`parameters`,`returnType`]),vw=new Set([`title`,`description`,`default`,`examples`,`$id`,`$schema`,`$comment`,`readOnly`,`writeOnly`,`deprecated`]),yw=e=>Object.fromEntries(Object.entries(e).filter(([e])=>!vw.has(e)));function bw(e,t){let n=yw(sw(e)),r=yw(sw(t));if(Object.keys(r).length===0||uw(n,r))return!0;if(Object.keys(r).some(e=>!_w.has(e))||r.additionalProperties!==void 0&&typeof r.additionalProperties!=`boolean`)return!1;if(Array.isArray(n.anyOf))return n.anyOf.every(e=>bw(e,r));if(Array.isArray(r.anyOf))return r.anyOf.some(e=>bw(n,e));if(`const`in r)return`const`in n&&uw(n.const,r.const);if(Array.isArray(r.enum))return(`const`in n?[n.const]:Array.isArray(n.enum)?n.enum:void 0)?.every(e=>r.enum.some(t=>uw(t,e)))??!1;for(let e of hw)if(e in r&&!uw(n[e],r[e]))return!1;let i=gw(r),a=gw(n);return i===void 0||a===void 0||!a.every(e=>i.includes(e)||e===`integer`&&i.includes(`number`))?!1:`const`in n||Array.isArray(n.enum)?!0:a.includes(`object`)&&!xw(n,r)||a.includes(`array`)&&!Sw(n,r)?!1:!a.includes(`function`)||Cw(n,r)}function xw(e,t){let n=sw(e.properties),r=sw(t.properties),i=new Set(e.required??[]);for(let e of t.required??[])if(!i.has(e))return!1;for(let[t,i]of Object.entries(r))if(t in n){if(!bw(n[t],i))return!1}else if(typeof e.additionalProperties==`object`&&!bw(e.additionalProperties,i))return!1;if(t.additionalProperties===!1&&(e.additionalProperties!==!1||Object.keys(n).some(e=>!(e in r))))return!1;let a=sw(t.patternProperties);if(Object.keys(a).length>0){let t=sw(e.patternProperties);if(e.additionalProperties!==!1&&Object.keys(t).length===0)return!1;for(let[e,i]of Object.entries(a)){let a=new RegExp(e,`u`);for(let[e,t]of Object.entries(n))if(!(e in r)&&a.test(e)&&!bw(t,i))return!1;if(Object.keys(t).length>0&&(!(e in t)||!bw(t[e],i)))return!1}for(let e of Object.keys(t))if(!(e in a))return!1}return!0}function Sw(e,t){return Array.isArray(t.items)?!Array.isArray(e.items)||e.items.length!==t.items.length?!1:e.items.every((e,n)=>bw(e,t.items[n])):Array.isArray(e.items)?e.items.every(e=>bw(e,t.items)):bw(e.items,t.items)}function Cw(e,t){let n=e.parameters??[],r=t.parameters??[];return n.length>r.length||!n.every((e,t)=>bw(r[t],e))?!1:bw(e.returnType,t.returnType)}var ww=Symbol(`chord.member`),Tw=(e,t)=>({[ww]:`method`,args:e,result:t}),Ew=new Set([`kind`,`status`,`ready`,`shape`,`error`,`onShape`,`onStatus`,`release`,`then`,`contract`]);function Dw(e,t,n){if(Ew.has(e))throw TypeError(`member name is reserved: ${e}`);let r=t[ww];if(r===`method`){let e=t;return{kind:`method`,args:e.args,result:e.result}}if(r===`opaque`){if(n===`remote`)throw TypeError(`remote contracts cannot expose opaque members: ${e}`);return{kind:`opaque`,id:t.id}}return{kind:`state`,schema:t}}function Ow(e){return{...e,fingerprint:lw(cw(e.description))}}function kw(e,t){if(!e)throw TypeError(`contract name is empty`);if(!Number.isInteger(t)||t<1)throw TypeError(`contract version must be a positive integer`)}function Aw(e,t){kw(e,t.version);let n={};if(Object.keys(t.variants).length===0)throw TypeError(`remote contract ${e} has no variants`);for(let[r,i]of Object.entries(t.variants)){let t={};for(let[e,n]of Object.entries(i.state??{}))t[e]=Dw(e,n,`remote`);for(let[n,a]of Object.entries(i.methods??{})){if(n in t)throw TypeError(`member ${n} is both state and method in ${e}.${r}`);if(t[n]=Dw(n,a,`remote`),t[n].kind!==`method`)throw TypeError(`methods.${n} is not a method()`)}n[r]=t}let r={name:e,scope:`remote`,version:t.version,input:t.input,variants:n};return Ow({scope:`remote`,name:e,version:t.version,input:t.input,def:t,description:r})}function jw(e){let{name:t,scope:n,version:r,input:i}=e;if(typeof t!=`string`||n!==`remote`&&n!==`local`||!Number.isInteger(r))throw new N(`invalid`,`malformed contract token`,{reason:`token`});let a={name:t,version:r,input:i,description:e,fingerprint:lw(cw(e))};return n===`remote`?{...a,scope:n,def:{version:r,input:i,variants:{}}}:{...a,scope:n,def:{version:r,input:i}}}function Mw(e,t){if(e.name!==t.name||e.scope!==t.scope)return`different type`;if(!bw(t.input,e.input))return`input`;for(let[n,r]of Object.entries(t.variants)){let t=e.variants[n];if(t===void 0)return`variant ${n} missing`;for(let[e,i]of Object.entries(r)){let r=t[e];if(r===void 0||r.kind!==i.kind)return`${n}.${e} missing or of another kind`;if(r.kind===`method`&&i.kind===`method`){if(!bw(i.args,r.args))return`${n}.${e} arguments`;if(!bw(r.result,i.result))return`${n}.${e} result`}else if(r.kind===`state`&&i.kind===`state`){if(!bw(r.schema,i.schema))return`${n}.${e} state`}else if(r.kind===`opaque`&&i.kind===`opaque`&&r.id!==i.id)return`${n}.${e} opaque ${r.id} != ${i.id}`}}}function Nw(e,t,n){if(e.fingerprint===n.fingerprint)return;if(e.version===n.version){let t=Mw(e.description,n.description);if(t===void 0)return;throw new N(`contract_mismatch`,`${e.name}@${e.version} does not cover the consumer's description (${t}); forgotten version bump?`)}let r=t?.[n.version];if(r===void 0)throw new N(`contract_mismatch`,`${e.name}: provider version ${e.version}, consumer version ${n.version}, no accepts adapter`);return r}var Pw=Symbol(`chord.decl`),Fw=e=>typeof e==`object`&&e?e[Pw]:void 0,Iw=[],Lw=0,Rw=!1;function zw(e){Iw.push(e),Vw()}function Bw(e){Lw++;try{return e()}finally{Lw--,Vw()}}function Vw(){if(!(Rw||Lw>0)){Rw=!0;try{for(let e=Iw.shift();e!==void 0;e=Iw.shift())e()}finally{Rw=!1}}}var Hw=65536,Uw=4096,Ww=new WeakSet,Gw=(e,t)=>{Ww.has(e)||(e.length>=Uw?Ww.add(e):e.push(t))},Kw=e=>typeof e==`object`&&!!e,qw=(e,t,n)=>{e.length===0?Gw(n,[`r`,t]):Gw(n,[`s`,e,t])},Jw=(e,t)=>{if(e===t)return!0;if(!Kw(e)||!Kw(t)||Array.isArray(e)!==Array.isArray(t))return!1;if(Array.isArray(e)){let n=t;if(e.length!==n.length)return!1;for(let t=0;t<e.length;t++)if(!Jw(e[t],n[t]))return!1;return!0}let n=t,r=Object.keys(e);if(r.length!==Object.keys(n).length)return!1;for(let t of r)if(!Object.hasOwn(n,t)||!Jw(e[t],n[t]))return!1;return!0},Yw=(e,t)=>{if(e.length!==t.length)return;let n=new Map;for(let t=0;t<e.length;t++){let r=e[t],i=n.get(r);i===void 0?n.set(r,{indices:[t],used:0}):i.indices.push(t)}let r=Array(t.length);for(let e=0;e<t.length;e++){let i=n.get(t[e]);if(i===void 0||i.used===i.indices.length)return;r[e]=i.indices[i.used++]}return r},Xw=(e,t,n,r)=>{if(e===t)return;if(t.length>e.length&&t.slice(0,e.length)===e){Gw(r,[`a`,n,t.slice(e.length)]);return}let i=KD(e,t,Hw);i===0?Gw(r,[`s`,n,t]):(Gw(r,[`t`,n,e.length-i]),t.length>i&&Gw(r,[`a`,n,t.slice(i)]))},Zw=2e5,Qw=65536,$w=(e,t)=>e===t||Jw(e,t),eT=(e,t,n,r)=>{if(e.length===0||t.length===0)return[];if(e.length*t.length>r)return;let i=t.length+1,a=new Uint32Array((e.length+1)*i);for(let r=e.length-1;r>=0;r--)for(let o=t.length-1;o>=0;o--){let s=r*i+o;a[s]=n(e[r],t[o])?a[(r+1)*i+o+1]+1:Math.max(a[(r+1)*i+o],a[r*i+o+1])}let o=[],s=0,c=0;for(;s<e.length&&c<t.length;)n(e[s],t[c])&&a[s*i+c]===a[(s+1)*i+c+1]+1?o.push([s++,c++]):a[(s+1)*i+c]>=a[s*i+c+1]?s+=1:c+=1;return o},tT=(e,t)=>{if($w(e,t))return!0;if(!Kw(e)||!Kw(t)||Array.isArray(e)!==Array.isArray(t))return!1;if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.some((e,n)=>Kw(e)&&e===t[n]);let n=e,r=t;for(let e of Object.keys(n)){let t=n[e];if(Kw(t)&&Object.hasOwn(r,e)&&t===r[e])return!0}return!1},nT=(e,t)=>{let n=0,r=e.length;for(;n<r;){let i=n+r>>>1;e[i]<t?n=i+1:r=i}return n},rT=(e,t,n,r,i,a)=>{let o=n-t,s=a-i,c=[];if(s<o){let o=t;for(let t=i;t<a;t++){for(;o<n&&e[o]!==r[t];)o+=1;if(o===n)return;c.push([o++,t])}return c}if(o<s){let o=i;for(let i=t;i<n;i++){for(;o<a&&e[i]!==r[o];)o+=1;if(o===a)return;c.push([i,o++])}return c}},iT=(e,t,n,r)=>{let i=[],a=-1;for(let o=n;o<r;o++){let n=e.get(t[o]);if(n===void 0)continue;let r=n[nT(n,a+1)];r!==void 0&&(i.push([r,o]),a=r)}return i},aT=(e,t,n,r,i,a)=>{let o=new Map;for(let r=t;r<n;r++){let t=e[r],n=o.get(t);n===void 0?o.set(t,[r]):n.push(r)}let s=0;for(let e=i;e<a;e++)if(s+=o.get(r[e])?.length??0,s>Zw)return iT(o,r,i,a);if(s===0)return[];let c=[],l=[],u=[];for(let e=i;e<a;e++){let t=o.get(r[e]);if(t!==void 0)for(let n=t.length-1;n>=0;n--){let r=t[n],i=nT(u,r),a=c.length;c.push({before:r,after:e,previous:i===0?-1:l[i-1]}),l[i]=a,u[i]=r}}let d=[],f=l[l.length-1]??-1;for(;f>=0;){let e=c[f];d.push([e.before,e.after]),f=e.previous}return d.reverse(),d},oT=(e,t,n,r,i,a,o,s,c,l)=>{let u=i,d=o,f=c;for(let[i,a]of l){if(Ww.has(r))return;sT(e,t,n,r,u,i,d,a,f),f+=a-d,$w(e[i],t[a])||uT(e[i],t[a],[...n,f],r),f+=1,u=i+1,d=a+1}Ww.has(r)||sT(e,t,n,r,u,a,d,s,f)};function sT(e,t,n,r,i,a,o,s,c){if(Ww.has(r))return;for(;i<a&&o<s&&$w(e[i],t[o]);)i+=1,o+=1,c+=1;for(;i<a&&o<s&&$w(e[a-1],t[s-1]);)--a,--s;let l=a-i,u=s-o;if(l===0&&u===0)return;if(l===0||u===0){Gw(r,[`p`,n,c,l,t.slice(o,s)]);return}if(l===u){let u=[];for(let n=0;n<l;n++)$w(e[i+n],t[o+n])&&u.push([i+n,o+n]);if(u.length>0){oT(e,t,n,r,i,a,o,s,c,u);return}}let d=rT(e,i,a,t,o,s);if(d!==void 0&&d.length>0){oT(e,t,n,r,i,a,o,s,c,d);return}let f=aT(e,i,a,t,o,s);if(f.length>0){oT(e,t,n,r,i,a,o,s,c,f);return}let p=eT(e.slice(i,a),t.slice(o,s),tT,Qw);if(p!==void 0&&p.length>0){let l=p.map(([e,t])=>[i+e,o+t]);oT(e,t,n,r,i,a,o,s,c,l)}else l===1&&u===1?uT(e[i],t[o],[...n,c],r):Gw(r,[`p`,n,c,l,t.slice(o,s)])}var cT=(e,t,n,r)=>{if(!(e===t||Jw(e,t))){if(e.length===t.length&&e.length>1&&!$w(e[0],t[0])&&!$w(e[e.length-1],t[t.length-1])){let i=Yw(e,t);if(i!==void 0){Gw(r,[`m`,n,i]);return}}sT(e,t,n,r,0,e.length,0,t.length,0)}},lT=(e,t,n,r)=>{let i=Object.keys(e),a=Object.keys(t);if([...i,...a].some(e=>qD.has(e)))Jw(e,t)||qw(n,t,r);else{for(let i of a){if(Ww.has(r))return;Object.hasOwn(e,i)?uT(e[i],t[i],[...n,i],r):qw([...n,i],t[i],r)}for(let e of i){if(Ww.has(r))return;Object.hasOwn(t,e)||Gw(r,[`d`,[...n,e]])}}},uT=(e,t,n,r)=>{e===t||Ww.has(r)||(typeof e==`string`&&typeof t==`string`&&n.length>0?Xw(e,t,n,r):Array.isArray(e)&&Array.isArray(t)?cT(e,t,n,r):Kw(e)&&Kw(t)&&!Array.isArray(e)&&!Array.isArray(t)?lT(e,t,n,r):qw(n,t,r))},dT=e=>{if(e===null)return 4;if(typeof e==`string`)return e.length+2;if(typeof e==`number`)return String(e).length;if(typeof e==`boolean`)return e?4:5;if(Array.isArray(e)){let t=2;for(let n=0;n<e.length;n++)t+=dT(e[n])+(n===0?0:1);return t}let t=2,n=0;for(let r of Object.keys(e))t+=r.length+3+dT(e[r])+(n++===0?0:1);return t},fT=e=>{let t=2;for(let n=0;n<e.length;n++){let r=e[n];t+=(typeof r==`string`?r.length+2:String(r).length)+(n===0?0:1)}return t},pT=e=>{switch(e[0]){case`r`:return 6+dT(e[1]);case`s`:return 7+fT(e[1])+dT(e[2]);case`d`:return 6+fT(e[1]);case`a`:return 7+fT(e[1])+e[2].length+2;case`t`:return 7+fT(e[1])+String(e[2]).length;case`p`:return 10+fT(e[1])+String(e[2]).length+String(e[3]).length+dT(e[4]);case`m`:return 7+fT(e[1])+dT(e[2])}};function mT(e,t){let n=[];if(uT(e,t,[],n),Ww.has(n))return[[`r`,t]];if(n.length===0||n[0]?.[0]===`r`)return n;let r=2;for(let e of n)r+=pT(e)+1;if(r<65536)return n;let i=dT(t)+6;return r>=i?[[`r`,t]]:n}var hT={value:void 0,writable:!0,enumerable:!0,configurable:!0};function gT(e,t){return _T(e,void 0,t?.omitUndefinedProperties===!0)}function _T(e,t,n){if(e===null||typeof e==`string`||typeof e==`boolean`)return e;if(typeof e==`number`){if(Number.isFinite(e))return e;throw TypeError(`Value contains a non-finite number and is not strict JSON`)}if(typeof e!=`object`)throw TypeError(`Value contains a non-JSON ${typeof e}; expected strict JSON`);let r=t??new Set;if(r.has(e))throw TypeError(`Value contains cycles and is not strict JSON`);r.add(e);try{if(Array.isArray(e)){if(Object.getPrototypeOf(e)!==Array.prototype||Reflect.ownKeys(e).length!==e.length+1)throw TypeError(`Value must contain strict JSON dense plain arrays`);let t=Array(e.length);for(let i=0;i<e.length;i++){let a=Object.getOwnPropertyDescriptor(e,i);if(a===void 0||!a.enumerable||!(`value`in a))throw TypeError(`Value must contain strict JSON enumerable indexed data properties`);vT(t,String(i),_T(a.value,r,n))}return t}let t=Object.getPrototypeOf(e);if(t!==Object.prototype&&t!==null)throw TypeError(`Value must contain strict JSON plain objects or arrays`);let i=Object.create(t);for(let t of Reflect.ownKeys(e)){if(typeof t==`symbol`)throw TypeError(`Value contains a symbol key and is not strict JSON`);let a=Object.getOwnPropertyDescriptor(e,t);if(!a.enumerable||!(`value`in a))throw TypeError(`Value must contain strict JSON enumerable data properties`);a.value===void 0&&n||vT(i,t,_T(a.value,r,n))}return i}finally{r.delete(e)}}function vT(e,t,n){hT.value=n,Object.defineProperty(e,t,hT),hT.value=void 0}var yT={value:void 0,writable:!0,enumerable:!0,configurable:!0};function bT(e,t){let n=e,r=new WeakSet;for(let e of t){if(e[0]===`r`){n=e[1];continue}if(e[0]===`p`||e[0]===`m`){let t=xT(n,e[1],e[1].length,r);if(n=t.root,!Array.isArray(t.target))throw TypeError(`Trusted array operation target is not an array`);e[0]===`p`?TT(t.target,e[2],e[3],e[4]):ET(t.target,e[2]);continue}let t=e[1],i=xT(n,t,t.length-1,r);n=i.root;let a=t[t.length-1];switch(e[0]){case`s`:wT(i.target,a,e[2]);break;case`d`:if(Array.isArray(i.target)){if(typeof a!=`number`)throw TypeError(`Trusted array deletion key is not numeric`);TT(i.target,a,1,[])}else Reflect.deleteProperty(i.target,a);break;case`a`:{let t=CT(i.target,a);if(typeof t!=`string`)throw TypeError(`Trusted append target is not a string`);wT(i.target,a,`${t}${e[2]}`);break}case`t`:{let t=CT(i.target,a);if(typeof t!=`string`)throw TypeError(`Trusted truncate target is not a string`);wT(i.target,a,t.slice(e[2]));break}}}return n}function xT(e,t,n,r){if(!DT(e))throw TypeError(`Trusted operation root is not a container`);let i=e;r.has(e)||(i=ST(e),r.add(i));let a=i;for(let e=0;e<n;e++){let n=t[e],i=CT(a,n);if(!DT(i))throw TypeError(`Trusted operation path is not a container`);if(r.has(i)){a=i;continue}let o=ST(i);wT(a,n,o),r.add(o),a=o}return{root:i,target:a}}function ST(e){if(Array.isArray(e))return Array.from(e);let t=Object.create(Object.getPrototypeOf(e)===null?null:Object.prototype);for(let n of Object.keys(e))wT(t,n,e[n]);return t}function CT(e,t){return e[t]}function wT(e,t,n){yT.value=n,Object.defineProperty(e,t,yT),yT.value=void 0}function TT(e,t,n,r){let i=e.length,a=r.length-n;a>0?(e.length=i+a,e.copyWithin(t+r.length,t+n,i)):a<0&&(e.copyWithin(t+r.length,t+n,i),e.length=i+a);for(let n=0;n<r.length;n++)wT(e,t+n,r[n])}function ET(e,t){if(e.length!==t.length)throw TypeError(`Trusted permutation length mismatch`);let n=e.slice();for(let r=0;r<t.length;r++)e[r]=n[t[r]]}function DT(e){return typeof e==`object`&&!!e}var OT=Symbol(`chord.delta.overlay.node`),kT=new WeakMap,AT={},jT=new Set([`push`,`pop`,`shift`,`unshift`,`splice`,`reverse`,`sort`,`fill`,`copyWithin`]),MT=4096,NT=128,PT={value:void 0,writable:!0,enumerable:!0,configurable:!0},FT=class{#e;value;base;ops;constructor(e,t,n){this.#e=e,this.value=t,this.base=e.baseValue,this.ops=n,kT.set(this,e)}get baseRevision(){return this.#e.baseRevision}abort(){VD(this.#e)}},IT=class{#e;#t;#n=!1;constructor(e){this.#e=e}get state(){let e=this.#e?.root?.proxy;if(e===void 0)throw TypeError(`Cannot use a settled overlay`);return e}prepare(){if(this.#n)throw Error(`Change has already been settled`);let e=this.#e;$T(e),e.status.value=`prepared`;try{e.replacement||(e.ops=e.dirty.length===0?[]:fD(e));let t=zT(e);return this.#t=e.status,this.#n=!0,t}catch(t){throw e.status.value=`aborted`,UD(e),this.#n=!0,t}finally{this.#e=void 0}}abort(){this.#n?(this.#t?.value===`prepared`&&(this.#t.value=`aborted`),this.#t=void 0):(this.#n=!0,VD(this.#e),this.#e=void 0)}},LT=class{#e={};#t=new Set;#n;#r;#i=0;#a=256;constructor(e){this.#r=e,this.#n=new WeakRef(this)}get value(){return this.#r}get revision(){return this.#i}beginChange(){let e=VT(this.#n,this.#e,this.#i,this.#r,!1,this.#r);return this.#o(e),new IT(e)}prepareReplace(e){let t=VT(this.#n,this.#e,this.#i,e,!0,this.#r);t.status.value=`prepared`,this.#o(t);try{return zT(t)}catch(e){throw t.status.value=`aborted`,UD(t),e}}adopt(e){let t=kT.get(e);if(t?.owner!==this.#e)throw Error(`Prepared change belongs to a different tracker`);if(t.status.value===`consumed`)throw Error(`Prepared change has already been used`);if(t.status.value===`aborted`)throw Error(`Prepared change has been aborted`);if(t.status.value===`stale`)throw Error(`Prepared change is stale`);if(t.status.value!==`prepared`)throw Error(`Prepared change is not ready`);if(t.baseRevision!==this.#i)throw t.status.value=`stale`,UD(t),Error(`Prepared change is stale`);if(this.#r!==e.base)throw t.status.value=`stale`,Error(`Prepared change is stale`);this.#r=e.value,t.status.value=`consumed`,this.#i+=1,this.#c(t)}releaseContext(e){e.registryRef!==void 0&&this.#t.delete(e.registryRef),e.registryRef=void 0}#o(e){let t=new WeakRef(e);e.registryRef=t,this.#t.add(t),--this.#a,this.#a===0&&(this.#s(),this.#a=Math.max(256,this.#t.size))}#s(){for(let e of this.#t)e.deref()===void 0&&this.#t.delete(e)}#c(e){for(let t of this.#t){let n=t.deref();n!==void 0&&n!==e&&((n.status.value===`open`||n.status.value===`prepared`)&&(n.status.value=`stale`),HD(n))}this.#t.clear(),this.#a=256}replacementBase(e){return e.baseRevision===this.#i?this.#r:void 0}};function RT(e){return new LT(e)}function zT(e){let t=zD(e),n=e.baseValue,r=new FT(e,t.length===0?n:e.simpleObjectMaterialization?sD(e.root):BT(n,t),t);return e.nodes.length>4096?HD(e):UD(e),r}function BT(e,t){for(let n of t)if(n[0]===`p`||n[0]===`m`)return rO(e,t);return bT(e,t)}function VT(e,t,n,r,i,a){let o={owner:t,tracker:e,baseRevision:n,status:{value:`open`},root:void 0,bases:[],stored:[],dirty:[],nodes:[],rawNodes:new WeakMap,ops:void 0,replacement:i,replacementNoop:!1,baseValue:a,overlayReleased:!1,simpleObjectMaterialization:!1,registryRef:void 0};return o.root=WT(o,r,void 0),o}var HT={deleteProperty(e,t){return rE(XT(e),t)},defineProperty(e){throw $T(XT(e).context),TypeError(`Defining overlay properties is not supported`)},get(e,t){if(t===`then`){let t=e[OT];if(t===void 0||ZT(t.context))return}let n=XT(e);return t===OT?n:eE(n,t)},getOwnPropertyDescriptor(e,t){return oE(XT(e),t)},getPrototypeOf(e){let t=XT(e);return QT(t.context),Object.getPrototypeOf(X(t))},has(e,t){return iE(XT(e),t)},isExtensible(e){return QT(XT(e).context),!0},ownKeys(e){return aE(XT(e))},preventExtensions(e){throw $T(XT(e).context),TypeError(`Overlays cannot be made non-extensible`)},set(e,t,n){return nE(XT(e),t,n)},setPrototypeOf(e){throw $T(XT(e).context),TypeError(`Changing an overlay prototype is not supported`)}},UT=HT;function WT(e,t,n,r=0,i=``,a=void 0,o=!1){let s=e.rawNodes.get(t);if(s!==void 0)return s;let c=Array.isArray(t)?[]:{},l=e.bases.length,u=n?.baseIndex??-1;e.bases.push(t);let d={context:e,baseIndex:l,parentIndex:u,parentKind:r,parentKey:i,parentPlacement:o,target:c,proxy:c};return a!==void 0&&(d.parentSource=a),c[OT]=d,d.proxy=new Proxy(c,Array.isArray(t)?UT:HT),e.rawNodes.set(t,d),e.nodes.push(d),d}function X(e){return e.context.bases[e.baseIndex]}function GT(e){return e.parentIndex<0?void 0:e.context.nodes[e.parentIndex]}function KT(e,t){if(!WD(t))return t;let n=e.stored.length;return e.stored.push(t),{index:n}}function qT(e,t){return typeof t==`object`&&t?e.stored[t.index]:t}function JT(e,t,n){return WD(n)?typeof t==`object`&&t?(e.stored[t.index]=n,t):KT(e,n):(typeof t==`object`&&t&&(e.stored[t.index]=AT),n)}function YT(e,t){typeof t==`object`&&t&&(e.stored[t.index]=AT)}function XT(e){let t=e[OT];if(t===void 0)throw TypeError(`Cannot use a settled overlay`);return t}function ZT(e){return e.overlayReleased||e.status.value===`consumed`||e.status.value===`aborted`||e.status.value===`stale`}function QT(e){if(ZT(e))throw TypeError(`Cannot use a settled overlay`)}function $T(e){if(QT(e),e.status.value!==`open`)throw TypeError(`Prepared overlays are read-only`)}function eE(e,t){if(QT(e.context),Array.isArray(X(e))){let n=gE(e);if(t===`length`)return NE(n);if(jT.has(t))return XE[t];let r=FE(t);return r===void 0?Reflect.get(Array.prototype,t,e.proxy):tE(e,r)}if(typeof t==`symbol`)return Reflect.get(X(e),t,e.proxy);let n=String(t);if(!pE(e,n))return uE(e,n)||Object.hasOwn(X(e),n)?void 0:Reflect.get(X(e),t,e.proxy);let r=mE(e,n);return WD(r)?WT(e.context,r,e,0,n,void 0,sE(e,n)).proxy:r}function tE(e,t){let n=gE(e);if(t>=NE(n))return;let r=PE(n,t),i=r.start+r.step*n.locatedOffset,a=IE(e,r,i);return WD(a)?WT(e.context,a,e,r.kind===`base`?1:2,i,r.kind===`insert`?r.source:void 0,r.kind===`insert`||LE(n,r,i)).proxy:a}function nE(e,t,n){if($T(e.context),typeof t==`symbol`)throw TypeError(`Symbol writes are not supported`);if(Array.isArray(X(e))){if(t===`length`)return GE(e,KE(n)),!0;let r=FE(t);if(r===void 0)throw TypeError(`Only array indices and length can be written`);if(r>NE(gE(e)))throw TypeError(`Overlay arrays cannot contain holes`);return WE(e,r,oD(n)),!0}let r=String(t);if(n===void 0)return rE(e,r);let i=oD(n),a=mE(e,r),o=uE(e,r);return!o&&!WD(i)&&a===i||(cE(e,r,i),o&&Object.hasOwn(X(e),r)&&(e.readded===void 0&&(e.readded=new Set),e.readded.add(r)),fE(e,r),hE(e)),!0}function rE(e,t){if($T(e.context),typeof t==`symbol`)throw TypeError(`Symbol writes are not supported`);if(Array.isArray(X(e)))throw TypeError(`Overlay arrays cannot contain holes`);let n=String(t);return pE(e,n)&&(lE(e,n),e.readded?.delete(n),dE(e,n),hE(e)),!0}function iE(e,t){if(QT(e.context),Array.isArray(X(e))){if(t===`length`)return!0;let n=FE(t);return n===void 0?t in Array.prototype:n<NE(gE(e))}return typeof t==`symbol`?t in X(e):pE(e,String(t))}function aE(e){if(QT(e.context),Array.isArray(X(e))){let t=NE(gE(e)),n=Array(t+1);for(let e=0;e<t;e++)n[e]=String(e);return n[t]=`length`,n}let t=e.deleteKey===void 0&&e.deletes===void 0&&e.readded===void 0&&(e.writeKey===void 0||Object.hasOwn(X(e),e.writeKey));if(t&&e.writes!==void 0){for(let n of e.writes.keys())if(!Object.hasOwn(X(e),n)){t=!1;break}}if(t)return Object.keys(X(e));let n=Object.keys(X(e)).filter(t=>!uE(e,t)&&!e.readded?.has(t)),r=new Set(n);if(e.writeKey!==void 0&&!r.has(e.writeKey)&&(n.push(e.writeKey),r.add(e.writeKey)),e.writes!==void 0)for(let t of e.writes.keys())r.has(t)||(n.push(t),r.add(t));let i=[],a=[];for(let e of n){let t=FE(e);t===void 0?a.push(e):i.push(t)}return i.sort((e,t)=>e-t),[...i.map(String),...a]}function oE(e,t){if(QT(e.context),Array.isArray(X(e))){if(t===`length`){let t=NE(gE(e));return e.target.length=t,Reflect.getOwnPropertyDescriptor(e.target,`length`)}let n=FE(t);if(n===void 0||n>=NE(gE(e)))return}else if(typeof t==`symbol`||!pE(e,String(t)))return;return{configurable:!0,enumerable:!0,writable:e.context.status.value===`open`,value:eE(e,t)}}function sE(e,t){return e.writeKey===t||(e.writes?.has(t)??!1)}function cE(e,t,n){if(e.writes!==void 0){let r=e.writes.get(t);e.writes.set(t,r===void 0?KT(e.context,n):JT(e.context,r,n))}else e.writeKey===void 0||e.writeKey===t?(e.writeKey=t,e.writeValue=e.writeValue===void 0?KT(e.context,n):JT(e.context,e.writeValue,n)):(e.writes=new Map,e.writes.set(e.writeKey,e.writeValue),e.writes.set(t,KT(e.context,n)),e.writeKey=void 0,e.writeValue=void 0)}function lE(e,t){if(e.writeKey===t)e.writeKey=void 0,YT(e.context,e.writeValue),e.writeValue=void 0;else{let n=e.writes?.get(t);n!==void 0&&YT(e.context,n),e.writes?.delete(t)}}function uE(e,t){return e.deleteKey===t||(e.deletes?.has(t)??!1)}function dE(e,t){e.deletes===void 0?e.deleteKey===void 0||e.deleteKey===t?e.deleteKey=t:(e.deletes=new Set,e.deletes.add(e.deleteKey),e.deletes.add(t),e.deleteKey=void 0):e.deletes.add(t)}function fE(e,t){e.deleteKey===t?e.deleteKey=void 0:e.deletes?.delete(t)}function pE(e,t){return uE(e,t)?!1:sE(e,t)||Object.hasOwn(X(e),t)}function mE(e,t){if(e.writeKey===t)return qT(e.context,e.writeValue);let n=e.writes?.get(t);return n===void 0?X(e)[t]:qT(e.context,n)}function hE(e){if(!e.dirty){e.dirty=!0,e.context.dirty.push(e);for(let t=GT(e);t!==void 0;t=GT(t))t.subtreeDirty=!0}}function gE(e){if(e.array!==void 0)return e.array;let t=X(e),n={root:void 0,pieces:void 0,baseOverrides:void 0,insertOverrides:void 0,structural:!1,generation:0,plan:void 0,seed:2654435769,locatedOffset:0,baseLocations:void 0,insertLocations:void 0};return t.length>0&&(n.root=SE(n,{kind:`base`,start:0,length:t.length,step:1})),e.array=n,n}function _E(e){return e.baseOverrides===void 0&&(e.baseOverrides=new Map),e.baseOverrides}function vE(e){return e.insertOverrides===void 0&&(e.insertOverrides=new Map),e.insertOverrides}function yE(e){let t=e.seed;return t^=t<<13,t^=t>>>17,t^=t<<5,e.seed=t>>>0,e.seed}function bE(e){return e?.elements??0}function xE(e){e.elements=bE(e.left)+e.piece.length+bE(e.right)}function SE(e,t){return{piece:t,left:void 0,right:void 0,priority:yE(e),elements:t.length}}function CE(e,t){return e===void 0?t:t===void 0?e:e.priority>=t.priority?(e.right=CE(e.right,t),xE(e),e):(t.left=CE(e,t.left),xE(t),t)}function wE(e,t,n){if(t===void 0)return[void 0,void 0];let r=bE(t.left);if(n<r){let[r,i]=wE(e,t.left,n);return t.left=i,xE(t),[r,t]}let i=r+t.piece.length;if(n>i){let[r,a]=wE(e,t.right,n-i);return t.right=r,xE(t),[t,a]}if(n===r){let e=t.left;return t.left=void 0,xE(t),[e,t]}if(n===i){let e=t.right;return t.right=void 0,xE(t),[t,e]}let a=n-r,o={...t.piece,length:a},s={...t.piece,start:t.piece.start+t.piece.step*a,length:t.piece.length-a};return[CE(t.left,SE(e,o)),CE(SE(e,s),t.right)]}function TE(e){for(;e.left!==void 0;)e=e.left;return e}function EE(e){for(;e.right!==void 0;)e=e.right;return e}function DE(e,t){return e.kind!==t.kind||e.kind===`insert`&&e.source!==t.source?!1:e.length===1&&t.length===1?Math.abs(t.start-e.start)===1:e.step===t.step&&e.start+e.step*e.length===t.start}function OE(e,t,n){if(t===void 0)return n;if(n===void 0)return t;let r=EE(t).piece,i=TE(n).piece;if(!DE(r,i))return CE(t,n);let[a]=wE(e,t,bE(t)-r.length),[,o]=wE(e,n,i.length),s=r.length===1?i.start-r.start:r.step;return OE(e,OE(e,a,SE(e,r.kind===`base`?{kind:`base`,start:r.start,length:r.length+i.length,step:s}:{kind:`insert`,source:r.source,start:r.start,length:r.length+i.length,step:s})),o)}function kE(e,t){e!==void 0&&(kE(e.left,t),t.push(e.piece),kE(e.right,t))}function AE(e){return e.pieces===void 0&&(e.pieces=[],kE(e.root,e.pieces)),e.pieces}function jE(e,t){VE(t);let n;for(let r of t)n=CE(n,SE(e,r));return n}function ME(e,t){e.root=jE(e,t),e.pieces=void 0,e.baseLocations=void 0,e.insertLocations=void 0}function NE(e){return bE(e.root)}function PE(e,t){let n=e.root;for(;n!==void 0;){let r=bE(n.left);if(t<r)n=n.left;else if(t>=r+n.piece.length)t-=r+n.piece.length,n=n.right;else return e.locatedOffset=t-r,n.piece}throw RangeError(`Array overlay index is out of range`)}function FE(e){if(typeof e!=`string`||e.length===0||e.length>10)return;if(e===`0`)return 0;let t=e.charCodeAt(0);if(t<49||t>57)return;let n=t-48;for(let t=1;t<e.length;t++){let r=e.charCodeAt(t)-48;if(r<0||r>9||(n=n*10+r,n>=4294967295))return}return n}function IE(e,t,n){let r=gE(e);if(t.kind===`base`){let t=r.baseOverrides?.get(n);return t===void 0?X(e)[n]:qT(e.context,t)}let i=r.insertOverrides?.get(t.source),a=i?.has(n)?i.get(n):t.source.refs[n];return qT(e.context,a)}function LE(e,t,n){return t.kind===`base`?e.baseOverrides?.has(n)??!1:e.insertOverrides?.get(t.source)?.has(n)??!1}function RE(e,t){e.right===void 0?e.piece.length+=t:RE(e.right,t),xE(e)}function zE(e){e.pieces=void 0,e.baseLocations=void 0,e.insertLocations=void 0,e.plan=void 0}function BE(e,t,n,r){if(n===0&&r.length===0)return;let i=gE(e);if(n===0&&t===NE(i)&&r.length===1&&i.root!==void 0){let t=r[0],n=EE(i.root).piece;if(t.kind===`insert`&&n.kind===`insert`&&n.step===1&&n.start+n.length===n.source.refs.length){for(let e=0;e<t.length;e++)n.source.refs.push(t.source.refs[t.start+e]);RE(i.root,t.length),zE(i),i.structural=!0,i.generation+=1,hE(e);return}}let[a,o]=wE(i,i.root,t),[,s]=wE(i,o,n);i.root=OE(i,OE(i,a,jE(i,r)),s),zE(i),i.structural=!0,i.generation+=1,hE(e)}function VE(e){for(let t=1;t<e.length;){let n=e[t-1],r=e[t],i=n.kind===r.kind&&(n.kind===`base`||n.source===r.source);i&&n.length===1&&r.length===1&&Math.abs(r.start-n.start)===1?(n.step=r.start-n.start,n.length=2,e.splice(t,1)):i&&n.step===r.step&&n.start+n.step*n.length===r.start?(n.length+=r.length,e.splice(t,1)):t+=1}}function HE(e,t,n=0){if(t.length===n)return[];let r=[];for(let i=n;i<t.length;i++)r.push(KT(e.context,t[i]));return[{kind:`insert`,source:{refs:r},start:0,length:r.length,step:1}]}function UE(e,t,n=0){if(t.length===n)return[];let r=e.context.stored.length;try{for(let r=n;r<t.length;r++)t[r]=KT(e.context,oD(t[r]))}catch(t){throw e.context.stored.length=r,t}return[{kind:`insert`,source:{refs:t},start:n,length:t.length-n,step:1}]}function WE(e,t,n){let r=gE(e),i=NE(r);if(t===i){BE(e,i,0,HE(e,[n]));return}let a=PE(r,t),o=a.start+a.step*r.locatedOffset,s=IE(e,a,o);if(WD(n)||s!==n){if(a.kind===`base`){let t=r.baseOverrides?.get(o);!WD(n)&&n===X(e)[o]?(t!==void 0&&YT(e.context,t),r.baseOverrides?.delete(o)):t===void 0?_E(r).set(o,KT(e.context,n)):r.baseOverrides.set(o,JT(e.context,t,n))}else{let t=r.insertOverrides?.get(a.source),i=t?.get(o);!WD(n)&&n===qT(e.context,a.source.refs[o])?(i!==void 0&&YT(e.context,i),t?.delete(o),t?.size===0&&r.insertOverrides?.delete(a.source)):(t===void 0&&(t=new Map,vE(r).set(a.source,t)),i===void 0?t.set(o,KT(e.context,n)):t.set(o,JT(e.context,i,n)))}hE(e)}}function GE(e,t){let n=NE(gE(e));t!==n&&(t<n?BE(e,t,n-t,[]):BE(e,n,0,HE(e,Array.from({length:t-n},()=>null))))}function KE(e){let t=Number(e);if(!Number.isInteger(t)||t<0||t>=4294967296)throw RangeError(`Invalid array length`);return t}function qE(e){let t=Number(e);return Number.isNaN(t)||t===0?0:Number.isFinite(t)?Math.trunc(t):t}function JE(e,t){return e===-1/0?0:e<0?Math.max(t+e,0):Math.min(e,t)}function YE(e){if(!WD(e))return;let t=Reflect.get(e,OT);if(t!==void 0){if(!Array.isArray(X(t)))throw TypeError(`Array mutator called on incompatible receiver`);return $T(t.context),t}}var XE={push(...e){let t=YE(this);if(t===void 0)return Reflect.apply(Array.prototype.push,this,e);let n=NE(gE(t));return BE(t,n,0,UE(t,e)),n+e.length},pop(){let e=YE(this);if(e===void 0)return Reflect.apply(Array.prototype.pop,this,[]);let t=NE(gE(e));if(t===0)return;let n=tE(e,t-1);return BE(e,t-1,1,[]),n},shift(){let e=YE(this);if(e===void 0)return Reflect.apply(Array.prototype.shift,this,[]);if(NE(gE(e))===0)return;let t=tE(e,0);return BE(e,0,1,[]),t},unshift(...e){let t=YE(this);return t===void 0?Reflect.apply(Array.prototype.unshift,this,e):(BE(t,0,0,UE(t,e)),NE(gE(t)))},splice(...e){let t=YE(this);if(t===void 0)return Reflect.apply(Array.prototype.splice,this,e);let n=NE(gE(t)),r=e.length===0?0:JE(qE(e[0]),n),i=e.length===0?0:e.length===1?n-r:Math.min(Math.max(qE(e[1]),0),n-r),a=Array.from({length:i},(e,n)=>tE(t,r+n)),o=Math.min(2,e.length),s=Math.max(e.length-2,0);return BE(t,r,i,UE(t,e,o)),GE(t,n-i+s),a},reverse(){let e=YE(this);if(e===void 0)return Reflect.apply(Array.prototype.reverse,this,[]);let t=gE(e);if(NE(t)<2)return e.proxy;let n=[...AE(t)].reverse();for(let e of n)e.start+=e.step*(e.length-1),e.step=e.step===1?-1:1;return ME(t,n),t.structural=!0,t.generation+=1,t.plan=void 0,hE(e),e.proxy},sort(e){let t=YE(this);if(t===void 0)return Reflect.apply(Array.prototype.sort,this,[e]);if(e!==void 0&&typeof e!=`function`)throw TypeError(`Comparator must be a function`);let n=gE(t),r=[],i=[],a=[],o=Array(X(t).length),s=[];for(let e of AE(n))for(let n=0;n<e.length;n++){let c=e.start+e.step*n;if(e.kind===`base`)s.push(c),o[c]=$E(t,c,r,i);else{r.push(e.source),i.push(c);let n=-r.length;s.push(n),a.push($E(t,n,r,i))}}let c=new Map;for(let[e,r]of n.baseOverrides??[])c.set(e,qT(t.context,r));let l=new Map;for(let[e,r]of n.insertOverrides??[]){let n=new Map;for(let[e,i]of r)n.set(e,qT(t.context,i));l.set(e,n)}let u=n.generation;if(s.sort((t,n)=>{let r=t<0?a[-t-1]:o[t],i=n<0?a[-n-1]:o[n];if(typeof e==`function`)return Number(e(r,i));let s=String(r),c=String(i);return s<c?-1:+(s>c)}),c.size>0||l.size>0||(n.baseOverrides?.size??0)>0||(n.insertOverrides?.size??0)>0)for(let e of s)eD(t,e,r,i,c,l);let d=n.generation!==u,f=NE(n);return f>=s.length&&s.every((e,t)=>tD(n,t,e,r,i))||BE(t,0,Math.min(s.length,f),rD(s,r,i)),d&&nD(t),t.proxy},fill(e,t,n){let r=YE(this);if(r===void 0)return Reflect.apply(Array.prototype.fill,this,[e,t,n]);let i=NE(gE(r)),a=t===void 0?0:JE(qE(t),i),o=n===void 0?i:JE(qE(n),i);if(o<=a)return r.proxy;let s=Array.from({length:o-a},()=>oD(e));return BE(r,a,o-a,HE(r,s)),r.proxy},copyWithin(e,t,n){let r=YE(this);if(r===void 0)return Reflect.apply(Array.prototype.copyWithin,this,[e,t,n]);let i=NE(gE(r)),a=JE(qE(e),i),o=JE(qE(t),i),s=n===void 0?i:JE(qE(n),i),c=Math.min(Math.max(s-o,0),i-a);return BE(r,a,c,HE(r,Array.from({length:c},(e,t)=>oD(tE(r,o+t))))),r.proxy}};function ZE(e,t){return e<0?t[-e-1]:void 0}function QE(e,t){return e<0?t[-e-1]:e}function $E(e,t,n,r){let i=gE(e),a=ZE(t,n),o=QE(t,r),s=a===void 0?i.baseOverrides?.get(o):i.insertOverrides?.get(a)?.get(o),c=s===void 0?a===void 0?X(e)[o]:qT(e.context,a.refs[o]):qT(e.context,s);return WD(c)?WT(e.context,c,e,a===void 0?1:2,o,a,a!==void 0||(i.baseOverrides?.has(o)??!1)).proxy:c}function eD(e,t,n,r,i,a){let o=gE(e),s=ZE(t,n),c=QE(t,r);if(s===void 0){let t=o.baseOverrides?.get(c),n=i.get(c);n===void 0?(t!==void 0&&YT(e.context,t),o.baseOverrides?.delete(c)):t===void 0?_E(o).set(c,KT(e.context,n)):o.baseOverrides.set(c,JT(e.context,t,n));return}let l=o.insertOverrides?.get(s),u=l?.get(c),d=a.get(s)?.get(c);d===void 0?(u!==void 0&&YT(e.context,u),l?.delete(c),l?.size===0&&o.insertOverrides?.delete(s)):(l===void 0&&(l=new Map,vE(o).set(s,l)),u===void 0?l.set(c,KT(e.context,d)):l.set(c,JT(e.context,u,d)))}function tD(e,t,n,r,i){let a=PE(e,t),o=a.start+a.step*e.locatedOffset,s=ZE(n,r);return o===QE(n,i)&&(a.kind===`base`&&s===void 0||a.kind===`insert`&&a.source===s)}function nD(e){let t=gE(e),n=new Set,r=new Map,i=[],a=!1;for(let o of AE(t))for(let t=0;t<o.length;t++){let s=o.start+o.step*t,c;if(o.kind===`base`)c=n.has(s),n.add(s);else{let e=r.get(o.source);e===void 0&&(e=new Set,r.set(o.source,e)),c=e.has(s),e.add(s)}c?(a=!0,iD(i,HE(e,[uD(IE(e,o,s),e.context)])[0])):iD(i,aD(o,s))}a&&(ME(t,i),t.structural=!0,t.generation+=1,t.plan=void 0,hE(e))}function rD(e,t,n){let r=[];for(let i of e){let e=i<0?t[-i-1]:void 0,a=i<0?n[-i-1]:i,o=r.at(-1),s=o!==void 0&&(e===void 0&&o.kind===`base`||e!==void 0&&o.kind===`insert`&&o.source===e);if(o!==void 0&&s){if(o.length===1){let e=a-o.start;if(e===1||e===-1){o.step=e,o.length=2;continue}}else if(o.start+o.step*o.length===a){o.length+=1;continue}}r.push(e===void 0?{kind:`base`,start:a,length:1,step:1}:{kind:`insert`,source:e,start:a,length:1,step:1})}return r}function iD(e,t){let n=e.at(-1),r=n!==void 0&&n.kind===t.kind&&(n.kind===`base`||n.source===t.source);if(n!==void 0&&r&&n.length===1&&t.length===1){let e=t.start-n.start;if(e===1||e===-1){n.step=e,n.length=2;return}}n!==void 0&&r&&n.step===t.step&&n.start+n.step*n.length===t.start?n.length+=t.length:e.push(t)}function aD(e,t){return e.kind===`base`?{kind:`base`,start:t,length:1,step:1}:{kind:`insert`,source:e.source,start:t,length:1,step:1}}function oD(e){let t=WD(e)?Reflect.get(e,OT):void 0;return t===void 0?gT(e):lD(t)}function sD(e){if(QT(e.context),Array.isArray(X(e))){let t=gE(e),n=[];for(let r of AE(t))for(let t=0;t<r.length;t++){let i=r.start+r.step*t;n.push(cD(IE(e,r,i),e.context))}return n}let t=Object.create(Object.getPrototypeOf(X(e)));for(let n of aE(e))dD(t,n,cD(mE(e,n),e.context));return t}function cD(e,t){if(!WD(e))return e;let n=t.rawNodes.get(e);return n===void 0||!n.dirty&&!n.subtreeDirty?e:sD(n)}function lD(e){if(QT(e.context),Array.isArray(X(e))){let t=gE(e),n=[];for(let r of AE(t))for(let t=0;t<r.length;t++){let i=r.start+r.step*t;n.push(uD(IE(e,r,i),e.context))}return n}let t=Object.create(Object.getPrototypeOf(X(e)));for(let n of aE(e))dD(t,n,uD(mE(e,n),e.context));return t}function uD(e,t){if(!WD(e))return gT(e);let n=t.rawNodes.get(e);return n===void 0?gT(e):lD(n)}function dD(e,t,n){PT.value=n,Object.defineProperty(e,t,PT),PT.value=void 0}function fD(e){let t=pD(e);if(t!==void 0)return t;let n=[],r=new Map,i=new Map,a=new Map;for(let t of e.dirty)if(yD(t,a),Array.isArray(X(t))){let e=gE(t);if(!e.structural&&(e.baseOverrides?.size??0)>0){let n=a.get(t);n===void 0&&(n={indices:[],bits:void 0,length:X(t).length},a.set(t,n));for(let t of e.baseOverrides.keys())vD(n,t)}}let o=new Map;for(let[e,t]of a){let n=ID(e);if(n===void 0||n.some(e=>typeof e==`string`&&qD.has(e)))continue;let r=bD(t);r.length>0&&o.set(e,r)}for(let t of e.dirty){let e=ID(t);if(e===void 0||_D(t,e,o))continue;i.set(t,e),!Array.isArray(X(t))&&SD(t)&&r.set(t,e);let n=e.findIndex(e=>typeof e==`string`&&qD.has(e));if(n>=0){let i=t;for(let t=e.length;t>n;t--)i=GT(i);r.set(i,e.slice(0,n))}}for(let[e,t]of r)i.set(e,t);for(let e of o.keys()){let t=ID(e);t!==void 0&&!_D(e,t,o)&&i.set(e,t)}let s=0;for(let e of i.values())s=Math.max(s,e.length);let c=Array.from({length:s+1},()=>[]);for(let[e,t]of i)c[t.length].push(e);let l=new Set;for(let t of c)for(let a of t){let t=i.get(a);if(!(wD(a)||CD(a,l))){if(r.has(a))FD(n,t,sD(a)),l.add(a);else if(Array.isArray(X(a))?MD(a,t,n,o.get(a)):ED(a,t,n),n.length>MT)return mD=void 0,[[`r`,sD(e.root)]]}}return mD=void 0,n}function pD(e){let t=[];for(let n of e.dirty){if(Array.isArray(X(n))||SD(n)||wD(n))return;for(let e=GT(n);e!==void 0;e=GT(e))if(Array.isArray(X(e)))return;let e=ID(n);if(e!==void 0){for(let t of e)if(typeof t==`string`&&qD.has(t))return;if(t.push(n),t.length>NT)return}}for(let e=1;e<t.length;e++){let n=t[e],r=n.preparedPath.length,i=e;for(;i>0&&t[i-1].preparedPath.length>r;)t[i]=t[i-1],--i;t[i]=n}let n=[],r=!0;for(let i of t)if(ED(i,i.preparedPath,n)&&(r=!1),n.length>MT)return[[`r`,sD(e.root)]];return e.simpleObjectMaterialization=r,n}var mD,hD=0;function gD(e){let t=e;for(let e=GT(t);e!==void 0;e=GT(t)){if(Array.isArray(X(e))){let n=gE(e);if(t.parentKind!==1||n.structural)return!1;let r=t.parentKey,i=n.baseOverrides?.get(r);return(i===void 0?X(e)[r]:qT(e.context,i))===X(t)&&(mD=e,hD=r,!0)}t=e}return!1}function _D(e,t,n){for(let r=GT(e);r!==void 0;r=GT(r)){let e=n.get(r);if(e===void 0)continue;let i=ID(r);if(i===void 0||t.length<=i.length)continue;let a=!0;for(let e=0;e<i.length;e++)if(t[e]!==i[e]){a=!1;break}if(!a)continue;let o=t[i.length];if(typeof o==`number`&&xD(e,o))return!0}return!1}function vD(e,t){if(e.bits!==void 0)e.bits[t]=1;else if(e.indices.push(t),!(e.indices.length<256)){e.bits=new Uint8Array(e.length);for(let t of e.indices)e.bits[t]=1;e.indices.length=0}}function yD(e,t){if(!gD(e))return;let n=t.get(mD);n===void 0&&(n={indices:[],bits:void 0,length:X(mD).length},t.set(mD,n)),vD(n,hD)}function bD(e){if(e.bits===void 0)return[];let t=[],n=e.bits;for(let e=0;e<n.length;){for(;e<n.length&&n[e]===0;)e+=1;if(e===n.length)break;let r=e,i=e,a=0,o=0;for(;e<n.length;){if(n[e]!==0)a+=1,i=e,o=0;else if(++o>1)break;e+=1}let s=i-r+1;a>=256&&a*2>=s&&t.push({start:r,length:s})}return t}function xD(e,t){for(let n of e)if(t>=n.start&&t<n.start+n.length)return!0;return!1}function SD(e){if(e.writeKey!==void 0&&qD.has(e.writeKey)||e.deleteKey!==void 0&&qD.has(e.deleteKey))return!0;if(e.writes!==void 0){for(let t of e.writes.keys())if(qD.has(t))return!0}if(e.deletes!==void 0){for(let t of e.deletes)if(qD.has(t))return!0}return!1}function CD(e,t){for(let n=GT(e);n!==void 0;n=GT(n))if(t.has(n))return!0;return!1}function wD(e){for(let t=e;t!==void 0;t=GT(t))if(GT(t)!==void 0&&t.parentPlacement)return!0;return!1}function TD(e,t,n,r,i){let a=[...t,r],o=e.readded?.has(r)||!Object.hasOwn(X(e),r)?void 0:X(e)[r],s=cD(i,e.context),c=PD(n,a,o,s);return WD(o)&&WD(s)&&!c}function ED(e,t,n){if(e.readded!==void 0)for(let r of e.readded)Object.hasOwn(X(e),r)&&n.push([`d`,[...t,r]]);let r=!1;if(e.writeKey!==void 0&&(r=TD(e,t,n,e.writeKey,mE(e,e.writeKey))),e.writes!==void 0)for(let[i,a]of e.writes){if(n.length>MT)return r;TD(e,t,n,i,qT(e.context,a))&&(r=!0)}if(e.deleteKey!==void 0&&Object.hasOwn(X(e),e.deleteKey)&&n.push([`d`,[...t,e.deleteKey]]),e.deletes!==void 0)for(let i of e.deletes){if(n.length>MT)return r;Object.hasOwn(X(e),i)&&n.push([`d`,[...t,i]])}return r}function DD(e){let t=gE(e);if(t.plan!==void 0)return t.plan;let n=X(e),r=AE(t);return t.plan=OD(n.length,r)??kD(n.length,r),t.plan}function OD(e,t){let n=[];for(let e of t)if(e.kind===`base`&&e.length!==0){if(e.step!==1&&e.length>1||n.length>0&&e.start<=n[n.length-1])return;n.push(e.start,e.start+e.length-1)}let r=[],i=e;for(let e=n.length-2;e>=-2;e-=2){let t=e>=0?n[e+1]+1:0;i>t&&r.push(t,i-t),e>=0&&(i=n[e])}return{removeRuns:r,permutation:void 0,insertRuns:AD(t)}}function kD(e,t){let n=new Uint8Array(e),r=[];for(let e of t)if(e.kind===`base`)for(let t=0;t<e.length;t++){let i=e.start+e.step*t;n[i]=1,r.push(i)}let i=[];for(let t=e;t>0;){if(n[t-1]!==0){--t;continue}let e=t-1;for(;e>0&&n[e-1]===0;)--e;i.push(e,t-e),t=e}let a=[];for(let e=0;e<n.length;e++)n[e]!==0&&a.push(e);let o;if(r.some((e,t)=>e!==a[t])){let e=new Map(a.map((e,t)=>[e,t]));o=r.map(t=>e.get(t))}return{removeRuns:i,permutation:o,insertRuns:AD(t)}}function AD(e){let t=[],n=0;for(let r=0;r<e.length;){let i=e[r];if(i.kind===`base`){n+=i.length,r+=1;continue}let a=r;for(;r<e.length&&e[r].kind===`insert`;)n+=e[r].length,r+=1;t.push(n-jD(e,a,r),a,r)}return t}function jD(e,t,n){let r=0;for(let i=t;i<n;i++)r+=e[i].length;return r}function MD(e,t,n,r){let i=gE(e),a=X(e);if(r!==void 0)for(let i of r){if(n.length>MT)return;n.push([`p`,t,i.start,i.length,ND(e,i)])}if(i.structural){let r=DD(e);for(let e=0;e<r.removeRuns.length;e+=2){if(n.length>MT)return;n.push([`p`,t,r.removeRuns[e],r.removeRuns[e+1],[]])}r.permutation!==void 0&&n.push([`m`,t,r.permutation]);let a=AE(i);for(let i=0;i<r.insertRuns.length;i+=3){if(n.length>MT)return;let o=r.insertRuns[i],s=[];for(let t=r.insertRuns[i+1];t<r.insertRuns[i+2];t++){let n=a[t];for(let t=0;t<n.length;t++){let r=n.start+n.step*t;s.push(cD(IE(e,n,r),e.context))}}n.push([`p`,t,o,0,s])}}for(let[o,s]of i.baseOverrides??[]){if(n.length>MT)return;let c=RD(i,1,o,void 0);c===void 0||r!==void 0&&xD(r,c)||PD(n,[...t,c],a[o],cD(qT(e.context,s),e.context))}}function ND(e,t){let n=gE(e),r=[];for(let i=t.start;i<t.start+t.length;i++){let t=PE(n,i),a=t.start+t.step*n.locatedOffset;r.push(cD(IE(e,t,a),e.context))}return r}function PD(e,t,n,r){if(!WD(r)&&n===r||WD(n)&&WD(r)&&BD(n,r))return!1;if(typeof n==`string`&&typeof r==`string`){if(r.length>n.length&&r.slice(0,n.length)===n)return e.push([`a`,t,r.slice(n.length)]),!0;let i=KD(n,r,65536);if(i>0)return e.push([`t`,t,n.length-i]),r.length>i&&e.push([`a`,t,r.slice(i)]),!0}return e.push([`s`,t,r]),!0}function FD(e,t,n){t.length===0?e.push([`r`,n]):e.push([`s`,t,n])}function ID(e){if(e.preparedPath!==void 0)return e.preparedPath;let t=GT(e);if(t===void 0)return e.preparedPath=[],e.preparedPath;let n=ID(t);if(n===void 0)return;if(e.parentKind===0){let r=e.parentKey;return!pE(t,r)||mE(t,r)!==X(e)?void 0:(e.preparedPath=[...n,r],e.preparedPath)}let r=gE(t),i=RD(r,e.parentKind,e.parentKey,e.parentSource);if(i!==void 0&&IE(t,PE(r,i),e.parentKey)===X(e))return e.preparedPath=[...n,i],e.preparedPath}function LD(e){if(e.baseLocations!==void 0)return;e.baseLocations=[],e.insertLocations=new Map;let t=0;for(let n of AE(e)){let r=n.start+n.step*(n.length-1),i={piece:n,logicalStart:t,minimum:Math.min(n.start,r),maximum:Math.max(n.start,r)};if(n.kind===`base`)e.baseLocations.push(i);else{let t=e.insertLocations.get(n.source);t===void 0&&(t=[],e.insertLocations.set(n.source,t)),t.push(i)}t+=n.length}let n=(e,t)=>e.minimum-t.minimum;e.baseLocations.sort(n);for(let t of e.insertLocations.values())t.sort(n)}function RD(e,t,n,r){if(t===1&&!e.structural)return n;LD(e);let i=t===1?e.baseLocations:e.insertLocations.get(r);if(i===void 0)return;let a=0,o=i.length;for(;a<o;){let e=a+o>>>1;i[e].minimum<=n?a=e+1:o=e}let s=i[a-1];if(s===void 0||n>s.maximum)return;let c=(n-s.piece.start)/s.piece.step;return c>=0&&c<s.piece.length?s.logicalStart+c:void 0}function zD(e){if(e.ops!==void 0)return e.ops;if(QT(e),e.replacement){let t=e.tracker.deref()?.replacementBase(e);e.replacementNoop=t!==void 0&&BD(t,X(e.root)),e.ops=e.replacementNoop?[]:[[`r`,X(e.root)]]}else e.ops=fD(e);return e.ops}function BD(e,t){if(e===t)return!0;if(!WD(e)||!WD(t)||Array.isArray(e)!==Array.isArray(t))return!1;if(Array.isArray(e)){let n=t;if(e.length!==n.length)return!1;for(let t=0;t<e.length;t++)if(!BD(e[t],n[t]))return!1;return!0}let n=t,r=Object.keys(e);if(r.length!==Object.keys(n).length)return!1;for(let t of r)if(!Object.hasOwn(n,t)||!BD(e[t],n[t]))return!1;return!0}function VD(e){e.status.value!==`aborted`&&e.status.value!==`consumed`&&e.status.value!==`stale`&&(e.status.value=`aborted`,UD(e))}function HD(e){e.tracker.deref()?.releaseContext(e),mD?.context===e&&(mD=void 0),e.overlayReleased=!0,e.dirty.length=0,e.nodes.length=0,e.rawNodes=void 0,e.ops=void 0,e.root=void 0,e.bases=void 0,e.stored=void 0,e.baseValue=void 0}function UD(e){e.tracker.deref()?.releaseContext(e),mD?.context===e&&(mD=void 0);for(let t of e.nodes)Array.isArray(t.target)&&(t.target.length=0),Reflect.deleteProperty(t.target,OT),t.writes?.clear(),t.deletes?.clear(),t.readded?.clear(),t.array?.pieces!==void 0&&(t.array.pieces.length=0),t.array!==void 0&&(t.array.root=void 0,t.array.baseLocations=void 0,t.array.insertLocations=void 0),t.array?.baseOverrides?.clear(),t.array?.insertOverrides?.clear(),t.parentSource=void 0,t.target=AT,t.proxy=AT,t.writeKey=void 0,t.writeValue=void 0,t.writes=void 0,t.deleteKey=void 0,t.deletes=void 0,t.readded=void 0,t.array=void 0,t.subtreeDirty=void 0,t.preparedPath=void 0;e.dirty.length=0,e.nodes.length=0,e.rawNodes=void 0,e.ops=void 0,e.root=void 0,e.bases=void 0,e.stored=void 0,e.baseValue=void 0,e.overlayReleased=!0}function WD(e){return typeof e==`object`&&!!e}var GD=e=>typeof e==`object`&&!!e;function KD(e,t,n,r=64,i=8){if(e.length===0||t.length===0||n===0)return 0;let a=e.length>n?e.slice(e.length-n):e;for(let e of[Math.min(r,t.length),1]){let n=t.slice(0,e),r=0;for(let e=a.indexOf(n);e!==-1&&!(++r>i);e=a.indexOf(n,e+1)){let n=a.length-e;if(n<=t.length&&a.slice(e)===t.slice(0,n))return n}if(e===1)break}return 0}var qD=new Set([`__proto__`,`constructor`,`prototype`]),JD=class extends Error{segment;constructor(e){super(`unsafe path segment: ${String(e)}`),this.segment=e,this.name=`UnsafePathError`}};function YD(e){if(!Array.isArray(e)||e.length===0)throw TypeError(`op is not a tuple`);switch(e[0]){case`r`:if(e.length!==2)throw TypeError(`r arity`);return;case`s`:if(e.length!==3)throw TypeError(`s arity`);XD(e[1],!0);return;case`d`:if(e.length!==2)throw TypeError(`d arity`);XD(e[1],!0);return;case`a`:if(e.length!==3||typeof e[2]!=`string`)throw TypeError(`a shape`);XD(e[1],!0);return;case`t`:if(e.length!==3||!Number.isInteger(e[2])||e[2]<0)throw TypeError(`t shape`);XD(e[1],!0);return;case`p`:if(e.length!==5)throw TypeError(`p arity`);if(XD(e[1]),!Number.isInteger(e[2])||e[2]<0)throw TypeError(`p index`);if(!Number.isInteger(e[3])||e[3]<0)throw TypeError(`p remove`);if(!Array.isArray(e[4]))throw TypeError(`p items`);return;case`m`:if(e.length!==3)throw TypeError(`m arity`);XD(e[1]),ZD(e[2]);return;default:throw TypeError(`unknown op verb: ${String(e[0])}`)}}function XD(e,t=!1){if(!Array.isArray(e))throw TypeError(`path is not an array`);if(t&&e.length===0)throw TypeError(`path is empty`);$D(e)}function ZD(e){if(!Array.isArray(e))throw TypeError(`m permutation is not an array`);let t=new Uint8Array(e.length);for(let n of e){if(!Number.isInteger(n)||n<0||n>=e.length||t[n]!==0)throw TypeError(`m permutation is not a bijection`);t[n]=1}}function QD(e){if(!Array.isArray(e)||e.length===0)throw TypeError(`op is not a tuple`);let[t]=e,n=e=>{if(typeof e==`number`){if(!Number.isInteger(e)||e<0)throw TypeError(`bad path id`)}else{if(!Array.isArray(e))throw TypeError(`path is not an array`);$D(e)}};switch(t){case`r`:if(e.length!==2)throw TypeError(`r arity`);return;case`s`:if(e.length===3)n(e[1]);else if(e.length!==2)throw TypeError(`s arity`);return;case`d`:if(e.length===2)n(e[1]);else if(e.length!==1)throw TypeError(`d arity`);return;case`a`:if(e.length===3){if(n(e[1]),typeof e[2]!=`string`)throw TypeError(`a value`)}else if(e.length===2){if(typeof e[1]!=`string`)throw TypeError(`a value`)}else throw TypeError(`a arity`);return;case`t`:if(e.length===3){if(n(e[1]),!Number.isInteger(e[2])||e[2]<0)throw TypeError(`t count`)}else if(e.length===2){if(!Number.isInteger(e[1])||e[1]<0)throw TypeError(`t count`)}else throw TypeError(`t arity`);return;case`p`:{let[t,r,i]=e.length===5?[e[2],e[3],e[4]]:e.length===4?[e[1],e[2],e[3]]:[];if(i===void 0)throw TypeError(`p arity`);if(e.length===5&&n(e[1]),!Number.isInteger(t)||t<0)throw TypeError(`p index`);if(!Number.isInteger(r)||r<0)throw TypeError(`p remove`);if(!Array.isArray(i))throw TypeError(`p items`);return}case`m`:if(e.length===3)n(e[1]);else if(e.length!==2)throw TypeError(`m arity`);ZD(e[e.length-1]);return;case`#`:if(e.length!==3||!Number.isInteger(e[1])||e[1]<0||!Array.isArray(e[2]))throw TypeError(`# shape`);$D(e[2]);return;default:throw TypeError(`unknown op verb: ${String(t)}`)}}function $D(e){for(let t of e)if(typeof t==`string`){if(qD.has(t))throw new JD(t)}else if(!Number.isInteger(t)||t<0)throw new JD(t)}function eO(e,t){if(t>e.length)throw new JD(t)}var tO=class extends Error{path;constructor(e){super(`unresolvable path: ${JSON.stringify(e)}`),this.path=e,this.name=`PathError`}};function nO(e,t){let n=e;for(let e of t){if(YD(e),e[0]===`r`){n=e[1];continue}let t=e[1];if($D(t),e[0]===`p`){let r=t.length===0?n:cO(n,t);if(!Array.isArray(r))throw new tO(t);r.splice(e[2],e[3]);let i=1e4;for(let t=0;t<e[4].length;t+=i)r.splice(e[2]+t,0,...e[4].slice(t,t+i));continue}if(e[0]===`m`){let r=t.length===0?n:cO(n,t);if(!Array.isArray(r)||r.length!==e[2].length)throw new tO(t);let i=r.slice();for(let t=0;t<e[2].length;t++)r[t]=i[e[2][t]];continue}let r=cO(n,t.slice(0,-1)),i=t[t.length-1];if(Array.isArray(r)){if(typeof i!=`number`)throw new JD(i);eO(r,i)}let a=e=>{Object.defineProperty(r,i,{value:e,writable:!0,enumerable:!0,configurable:!0})},o=()=>Object.hasOwn(r,i)?r[i]:void 0;switch(e[0]){case`s`:a(e[2]);break;case`d`:if(Array.isArray(r)){if(typeof i!=`number`||i>=r.length)throw new tO(t);r.splice(i,1)}else delete r[i];break;case`a`:{let n=o();if(typeof n!=`string`)throw new tO(t);a(`${n}${e[2]}`);break}case`t`:{let n=o();if(typeof n!=`string`)throw new tO(t);a(n.slice(e[2]));break}}}return n}function rO(e,t){return iO(e,[t])}function iO(e,t){let n=e,r=new WeakSet;for(let e of t)for(let t of e)if(YD(t),t[0]===`r`)n=t[1];else{if(t[0]===`p`){let e=aO(n,t,r);if(e!==void 0){n=e;continue}}n=oO(n,t[0]===`p`||t[0]===`m`?t[1]:t[1].slice(0,-1),r),n=nO(n,[t])}return n}function aO(e,t,n){let[,r,i,a,o]=t;if(a!==0)return;let s=e;for(let e of r){if(!(typeof e==`string`?!qD.has(e)&&GD(s)&&!Array.isArray(s):Number.isInteger(e)&&e>=0&&Array.isArray(s))||!Object.hasOwn(s,e))return;s=s[e]}if(!Array.isArray(s)||n.has(s)||i!==s.length)return;let c=s.concat(o);if(n.add(c),r.length===0)return c;let l=r.slice(0,-1),u=oO(e,l,n);return Object.defineProperty(cO(u,l),r[r.length-1],{value:c,writable:!0,enumerable:!0,configurable:!0}),u}function oO(e,t,n){let r=e=>{if(Array.isArray(e))return e.slice();if(!GD(e))throw new tO(t);let n=Object.create(Object.getPrototypeOf(e)===null?null:Object.prototype);for(let t of Object.keys(e))Object.defineProperty(n,t,{value:e[t],writable:!0,enumerable:!0,configurable:!0});return n};if(!GD(e))throw new tO(t);let i;n.has(e)?i=e:(i=r(e),n.add(i));let a=i;for(let e of t){if(!Object.hasOwn(a,e))throw new tO(t);if(Array.isArray(a)&&typeof e!=`number`)throw new JD(e);let i=a[e];if(!GD(i))throw new tO(t);if(n.has(i)){a=i;continue}let o=r(i);Object.defineProperty(a,e,{value:o,writable:!0,enumerable:!0,configurable:!0}),n.add(o),a=o}return i}function sO(e,t){let n=e;for(let e of t){if(!GD(n))throw new tO(t);if(Array.isArray(n)&&typeof e!=`number`)throw new JD(e);if(!Object.hasOwn(n,e))throw new tO(t);n=n[e]}return n}function cO(e,t){let n=sO(e,t);if(!GD(n))throw new tO(t);return n}var lO=e=>JSON.stringify(e);function uO(){let e=new Set,t=new Map,n=0,r;return{encode(i){r=void 0;let a=[];for(let o of i){if(o[0]===`r`){a.push(o),e.clear(),t.clear(),n=0,r=void 0;continue}let i=o[1],s=lO(i);if(s===r){switch(o[0]){case`s`:a.push([`s`,o[2]]);break;case`d`:a.push([`d`]);break;case`a`:a.push([`a`,o[2]]);break;case`t`:a.push([`t`,o[2]]);break;case`p`:a.push([`p`,o[2],o[3],o[4]]);break;case`m`:a.push([`m`,o[2]])}continue}let c=i,l=t.get(s);if(l!==void 0)c=l;else if(e.has(s)){let e=n++;t.set(s,e),a.push([`#`,e,i]),c=e}else e.add(s);switch(o[0]){case`s`:a.push([`s`,c,o[2]]);break;case`d`:a.push([`d`,c]);break;case`a`:a.push([`a`,c,o[2]]);break;case`t`:a.push([`t`,c,o[2]]);break;case`p`:a.push([`p`,c,o[2],o[3],o[4]]);break;case`m`:a.push([`m`,c,o[2]])}r=s}return a}}}function dO(){let e=new Map;return{decode(t){let n,r=[];for(let i of t){if(QD(i),i[0]===`#`){$D(i[2]),e.set(i[1],i[2]);continue}if(i[0]===`r`){r.push(i),e.clear(),n=void 0;continue}let t=i[0]===`d`&&i.length===1||i[0]!==`d`&&i[0]!==`p`&&i.length===2||i[0]===`p`&&i.length===4,a;if(t){if(n===void 0)throw new tO([]);a=n}else{let t=i[1];if(typeof t==`number`){let n=e.get(t);if(n===void 0)throw new tO(t);a=n}else a=t;n=a}if(i[0]!==`p`&&i[0]!==`m`&&a.length===0)throw new tO(a);switch(i[0]){case`s`:r.push([`s`,a,t?i[1]:i[2]]);break;case`d`:r.push([`d`,a]);break;case`a`:r.push([`a`,a,t?i[1]:i[2]]);break;case`t`:r.push([`t`,a,t?i[1]:i[2]]);break;case`p`:{let[e,n,o]=t?[i[1],i[2],i[3]]:[i[2],i[3],i[4]];r.push([`p`,a,e,n,o]);break}case`m`:r.push([`m`,a,t?i[1]:i[2]])}}return r}}}var fO=0,pO=class{#e=new Set;#t=new Set;#n;constructor(e){this.#n=e}subscribe(e,t){return this.#e.add(e),this.#r(e,t),()=>this.#e.delete(e)}events(e,t){return this.#t.add(e),this.#r(e,{type:`snap`,value:t}),()=>this.#t.delete(e)}emit(e){let t=[...this.#t],n=[...this.#e];zw(()=>{for(let n of t)this.#t.has(n)&&this.#r(n,e);for(let t of n)this.#e.has(t)&&this.#r(t,e.value)})}#r(e,t){try{e(t)}catch(e){this.#n(e)}}},mO=class{key;seq=++fO;dependents=new Set;schemas=[];options;fanout;constructor(e,t){this.key=e,this.options=t,this.fanout=new pO(t.report)}subscribe(e){return this.fanout.subscribe(e,this.value)}events(e){return this.fanout.events(e,this.value)}validate(e){if(this.options.dev){for(let t of this.ownSchemas())dw(`state`,`state ${this.key}`,t,e);for(let t of this.schemas)dw(`state`,`state ${this.key}`,t,e)}}ownSchemas(){return[]}};function hO(e,t){let n=[];for(let r of e){if(r[0]===`r`||r[1].length===0)return[[`r`,t]];let e=r[1].slice(1);switch(r[0]){case`p`:n.push([`p`,e,r[2],r[3],r[4]]);break;case`m`:n.push([`m`,e,r[2]]);break;default:if(e.length===0)return[[`r`,t]];r[0]===`d`?n.push([`d`,e]):n.push([r[0],e,r[2]])}}return n}var gO=class extends mO{schema;#e;#t;constructor(e,t,n,r,i){super(e,i),dw(`state`,`initial value of state ${e}`,t,n),this.schema=t,this.#e=RT({v:n}),this.#t=r}ownSchemas(){return[this.schema]}get value(){return this.#e.value.v}change(e,t){this.#t(e);let n=this.#e.beginChange(),r;try{let e=n.state,i=t(e.v);if(i instanceof Promise)throw TypeError(`cell.change callbacks must be synchronous`);i!==void 0&&(i!==e.v&&dw(`state`,`state ${this.key}`,this.schema,i),e.v=i),r=n.prepare()}catch(e){throw n.abort(),e}this.#n(r,`ops`)}replace(e,t,n={}){this.#t(e);let r=this.value,i=n.diff??_O(r,t)?mT(r,t):void 0;this.#n(this.#e.prepareReplace({v:t}),`ops`,!0,i)}reset(e,t){this.schema=t,this.#n(this.#e.prepareReplace({v:e}),`reset`,!1)}#n(e,t,n=!0,r){if(e.ops.length===0&&t===`ops`){this.#e.adopt(e);return}let i=e.value.v,a;try{n&&this.validate(i),a=vO(this,i,n)}catch(t){throw e.abort(),t}Bw(()=>{this.#e.adopt(e);let n=r!==void 0&&r.length>0?r:hO(e.ops,i);this.fanout.emit(t===`reset`?{type:t,value:i}:{type:t,ops:n,value:i});for(let[e,t]of a)e.install(t)})}};function _O(e,t){if(e===null||t===null||typeof e!=`object`||typeof t!=`object`||e===t||Array.isArray(e)!==Array.isArray(t))return!1;for(let[n,r]of Object.entries(t))if(typeof r==`object`&&r&&e[n]===r)return!0;return!1}function vO(e,t,n=!0){let r=new Set,i=e=>{for(let t of e.dependents)r.has(t)||(r.add(t),i(t))};i(e);let a=new Map([[e,t]]),o=new Map;for(let e of[...r].sort((e,t)=>e.seq-t.seq)){let t=e.compute(e=>a.has(e)?a.get(e):e.value);n&&e.validate(t),a.set(e,t),o.set(e,t)}return o}var yO=e=>typeof e==`object`&&!!e&&typeof e.subscribe==`function`&&`value`in e,bO=class extends mO{sources;#e;#t;#n=[];constructor(e,t,n,r){super(e,r),this.sources=t.map(t=>{if(!yO(t))throw TypeError(`derive ${e}: sources must be readables`);return t}),this.#e=n,this.#t=void 0}get value(){return this.#t}attach(e){this.#t=e?.has(this)?e.get(this):this.compute(e=>e.value);for(let e of this.sources)e instanceof mO?e.dependents.add(this):this.#n.push(e.subscribe(()=>this.refresh()))}detach(){for(let e of this.sources)e instanceof mO&&e.dependents.delete(this);for(let e of this.#n.splice(0))e()}compute(e,t=this.#e){let n=t(...this.sources.map(e));if(n instanceof Promise)throw TypeError(`derive ${this.key}: fn must be synchronous`);return n}setFn(e){this.#e=e}refresh(){try{let e=this.compute(e=>e.value),t=vO(this,e);Bw(()=>{this.install(e);for(let[e,n]of t)e.install(n)})}catch(e){this.options.report(e)}}install(e){let t=this.#t;this.#t=e;let n=t===void 0||e===void 0?[[`r`,e??null]]:mT(t,e);n.length>0&&this.fanout.emit({type:`ops`,ops:n,value:e})}},xO=e=>e instanceof mO,SO=e=>new N(`not_ready`,`${e} is not ready`),CO=()=>{},wO=(e,t,n,r)=>({contract:e,factory:t,options:n,facet:r,stateVersion:n.state?.version??1}),TO=class{resource;constructor(e){this.resource=e}},EO=class{key;spec;deps;state=`closed`;#e;constructor(e,t,n){this.key=e,this.spec=t,this.deps=n}get value(){if(this.state===`unavailable`)throw new N(`unavailable`,`resource ${this.key} could not be restored`);if(this.state!==`open`)throw SO(`resource ${this.key}`);return this.#e}get exclusive(){return this.spec.exclusive===!0}async open(e,t){if(this.state!==`closed`)return;this.state=`opening`;let n;try{n=await this.spec.open({signal:e})}catch(e){throw this.state=`closed`,e}if(e.aborted)throw this.state=`closed`,await this.spec.close?.(n),new N(`aborted`,`resource ${this.key} opened after abort`);this.#e=n,this.state=`open`,t.push(this)}async close(e){if(this.state!==`open`)return;this.state=`closed`;let t=e.indexOf(this);t!==-1&&e.splice(t,1);let n=this.#e;this.#e=void 0,await this.spec.close?.(n)}markUnavailable(){this.state=`unavailable`,this.#e=void 0}},DO=class{#e;#t;constructor(e,t){this.#e=e,this.#t=t,OO.set(this,e)}get key(){return this.#e.key}get value(){if(this.#t.inFactory>0)throw SO(`resource ${this.key} (inside a factory)`);return this.#e.value}},OO=new WeakMap,kO=e=>e instanceof EO?e:typeof e==`object`&&e?OO.get(e):void 0,AO=class{cells=new Map;cellSchemas=new Map;holds=new Map;resources=new Map;listeners=new Map;tasks=new Map;derives=new Map;deriveFns=new Map;registrations=new Map},jO=class e{host;signal;rootId;epoch;principal;holder;#e=[];#t=!1;get closed(){return this.#t}check(e){if(this.host!==e)throw Pi(`foreign_ctx`,`ctx belongs to another host`);if(this.#t)throw new N(`aborted`,`ctx expired: its call already settled`,{reason:`expired`});if(this.signal.aborted)throw new N(`aborted`,`ctx aborted`,{cause:this.signal.reason})}constructor(e,t){this.host=e,this.signal=t.signal,this.rootId=t.rootId,this.epoch=t.epoch,this.principal=t.principal,this.holder=t.holder??!1}get(e,t,n){this.check(this.host);let r=this.host.acquire(e,t,{principal:this.principal,...n},`call`);return this.#e.push(r),r.proxy}child(t){return new e(this.host,{signal:AbortSignal.any([this.signal,t.callAbort.signal]),rootId:this.rootId,epoch:this.epoch,principal:this.host.principal})}close(){this.#t=!0;for(let e of this.#e.splice(0))e.release()}};async function MO(e,t){if(t.aborted)throw new N(`aborted`,`call aborted`,{cause:t.reason});let n=CO,r=new Promise((e,r)=>{n=()=>r(new N(`aborted`,`call aborted`,{cause:t.reason})),t.addEventListener(`abort`,n,{once:!0})});try{return await Promise.race([e,r])}finally{t.removeEventListener(`abort`,n)}}var NO=new Set([`contract`,`status`,`ready`,`kind`,`shape`,`error`,`onShape`,`onStatus`,`release`]);function PO(e,t,n,r){if(e.size===0)return;let i=[...e];zw(()=>{for(let e of i)try{e(t,n)}catch(e){r(e)}})}var FO=new WeakMap,IO=e=>typeof e==`object`&&e?FO.get(e):void 0,LO=class{#e;#t;#n=new Set;#r=new Set;#i;#a=CO;#o;constructor(e,t){this.#e=e,this.#t=t}get value(){return this.#s()?.value}subscribe(e){return this.#n.add(e),this.#o=this.value,this.#l(()=>e(this.#o)),this.bind(),()=>this.#c(this.#n,e)}events(e){return this.#r.add(e),this.#o=this.value,this.#l(()=>e({type:`snap`,value:this.#o})),this.bind(),()=>this.#c(this.#r,e)}bind(){let e=this.#n.size+this.#r.size>0?this.#s():void 0;if(e===this.#i||(this.#a(),this.#a=CO,this.#i=e,e===void 0))return;let t=!0;this.#a=e.events(e=>{let n=t;if(t=!1,n&&e.value===this.#o)return;this.#o=e.value;let r=n?{type:`reset`,value:e.value}:e,i=[...this.#r],a=[...this.#n];zw(()=>{for(let e of i)this.#r.has(e)&&this.#l(()=>e(r));for(let t of a)this.#n.has(t)&&this.#l(()=>t(e.value))})})}stop(){this.#n.clear(),this.#r.clear(),this.bind()}#s(){let e=this.#e.currentView();if(e===void 0||!this.#e.inVariant(e,this.#t))return;let t=e[this.#t];return xO(t)||HO(t)?t:void 0}#c(e,t){e.delete(t),this.bind()}#l(e){try{e()}catch(e){this.#e.record.host.report(e)}}},RO=class{record;contract;owner;address;proxy;ready;status;error;shapeListeners=new Set;goneListeners=new Set;readables=new Map;bindings=new Map;views=new WeakMap;callers=new Map;constructor(e,t,n){this.record=e,this.contract=t,this.owner=n,this.address=e.address,this.status=e.status===`live`?`live`:`loading`,this.ready=e.ready.then(()=>{if(this.status===`gone`)throw this.error;if(this.status===`released`)throw new N(`released`,`handle ${this.address} released`)}),this.ready.catch(CO),this.proxy=new Proxy(this,{get:(e,t)=>{if(NO.has(t)){let n=Reflect.get(e,t,e);return typeof n==`function`?n.bind(e):n}if(typeof t==`string`&&t!==`then`)return e.member(t)},has:(e,t)=>NO.has(t)||e.member(String(t))!==void 0}),FO.set(this.proxy,this)}get kind(){let e=this.currentView();return e===void 0?void 0:zO(e)}get shape(){let e=this.status===`live`?this.record.currentInstalled():void 0,t=e===void 0?void 0:this.#n(e);if(e!==void 0&&t!==void 0)return{kind:zO(t),members:Object.keys(t).filter(e=>e!==`kind`),contract:e.service.contract.fingerprint,epoch:e.epoch}}onShape(e){return this.shapeListeners.add(e),()=>this.shapeListeners.delete(e)}onStatus(e){return this.#e.add(e),()=>this.#e.delete(e)}#e=new Set;#t(){PO(this.#e,this.status,this.error,e=>this.record.host.report(e))}release(){this.status!==`released`&&this.status!==`gone`&&(this.status=`released`,this.#r(),this.#t(),this.record.release(this))}live(){this.status===`loading`&&(this.status=`live`,this.#t(),this.shapeChanged())}gone(e){if(this.status!==`released`&&this.status!==`gone`){this.status=`gone`,this.error=e,this.#r(),this.#t();for(let t of[...this.goneListeners])t(e)}}shapeChanged(){for(let e of this.readables.values())e.bind();let e=this.shape;if(e===void 0)return;let t=[...this.shapeListeners];zw(()=>{for(let n of t)try{n(e)}catch(e){this.record.host.report(e)}})}terminalError(){return this.status===`gone`?this.error:new N(`released`,`handle ${this.address} released`)}viewOf(e){let t=this.bindings.get(e.service);if(this.bindings.has(e.service)||(t=Nw(e.service.contract,e.service.options.accepts,this.contract),this.bindings.set(e.service,t)),t===void 0)return e.behavior;let n=this.views.get(e.behavior);return n===void 0&&(n=t(e.behavior),this.views.set(e.behavior,n)),n}currentView(){if(this.status!==`live`)return;let e=this.record.currentInstalled();return e===void 0?void 0:this.#n(e)}#n(e){try{return this.viewOf(e)}catch(e){this.record.host.report(e);return}}describe(e,t){let n=this.contract.description.variants;if(e!==void 0)return n[e]?.[t];for(let e of Object.values(n))if(e[t]!==void 0)return e[t]}inVariant(e,t){return this.contract.scope!==`remote`||this.describe(zO(e),t)!==void 0}member(e){let t=this.describe(void 0,e),n=this.currentView(),r=n?.[e];if(t?.kind===`method`||t===void 0&&typeof r==`function`)return this.caller(e);if(t?.kind===`state`||t===void 0&&(xO(r)||HO(r))){let t=this.readables.get(e);return t===void 0&&(t=new LO(this,e),this.readables.set(e,t)),t}if(n!==void 0&&this.inVariant(n,e))return r instanceof TO?r.resource.value:r}caller(e){let t=this.callers.get(e);return t===void 0&&(t=(t,n)=>{if(this.record.host.inFactory>0)throw new N(`not_ready`,`${this.address}.${e} called inside a factory`);if(n!==void 0&&!(n instanceof jO))return Promise.reject(Pi(`foreign_ctx`,`ctx must come from a Chord host`));if(n===void 0||n.holder){try{n?.check(this.record.host)}catch(e){return Promise.reject(e)}return this.record.host.root(n=>this.record.call(this,e,t,n),{signal:n?.signal})}return this.record.call(this,e,t,n)},this.callers.set(e,t)),t}#r(){for(let e of this.readables.values())e.stop()}},zO=e=>typeof e.kind==`string`?e.kind:void 0,BO=(e,t)=>e===t||e!==void 0&&t!==void 0&&String(e)===String(t),VO=class{host;address;typeName;input;principal;eager;status=`activating`;ready=Promise.resolve();service;stateVersion=0;minEpoch=0;decls=new AO;pending=new Set;behaviors=new Map;holds=new Set;leases=new Map;openOrder=[];callAbort=new AbortController;activationAbort=new AbortController;gate;deferredRuntime=!1;#e=new Map;#t=new Set;#n=new Map;#r=[];#i;#a;constructor(e,t){this.host=e,this.address=t.address,this.typeName=t.typeName,this.input=t.input,this.principal=t.principal,this.eager=t.eager}start(e){this.ready=this.#o(e).then(()=>{for(let e of this.holds)e.live();this.#d()},e=>{this.status===`activating`&&(this.status=`failed`),this.host.forget(this);let t=Fi(e,`activating ${this.address}`);for(let e of this.holds)e.gone(t);throw t}),this.ready.catch(CO)}async#o(e){await e?.catch(CO);let t=this.activationAbort.signal,n=()=>new N(`aborted`,`${this.address} abandoned`);if(t.aborted)throw n();let r=this.host.service(this.typeName);if(r===void 0)throw new N(`unavailable`,`${this.typeName} is not served`,{reason:`unknown_type`});this.service=r,this.stateVersion=r.stateVersion;let i=this.run(r,void 0);try{if(await this.open(i.created.resources,i.created.holds,t),t.aborted)throw n();this.host.checkRegistrations(this,i.decls),this.decls=i.decls;for(let[e,t]of this.host.retainedEpochs())t.get(this.typeName)===r&&this.behaviors.set(e,{epoch:e,service:r,behavior:i.behavior,decls:i.decls});let e=this.host.pendingEpoch();if(!this.behaviors.has(this.host.currentEpoch())&&(e===void 0||!this.behaviors.has(e)))throw new N(`superseded`,`${this.address}: code changed during activation`);for(let e of i.created.derives)e.attach();if(this.refreshSchemas(),this.deferredRuntime=!this.behaviors.has(this.host.currentEpoch()),this.deferredRuntime||(i.decls.registrations.size>0&&this.host.registriesChanged(this),this.startRuntime()),t.aborted)throw n();this.status=`live`}catch(e){this.callAbort.abort(e),this.stopListeners(),this.stopTasks();let t=this.decls.registrations.size>0&&!this.deferredRuntime;throw this.behaviors.clear(),this.decls=new AO,t&&this.host.registriesChanged(),await Promise.allSettled([...this.#t,...this.#r.splice(0)]),await this.unwind(i).catch(e=>this.host.report(e)),e}finally{this.pending.delete(i.decls)}}run(e,t){let n=new GO(this,t),r=e=>{this.pending.delete(e.decls),this.unwind(e).catch(e=>this.host.report(e))};this.pending.add(n.run(void 0).decls),this.host.inFactory++;let i;try{i=e.factory(this.input,this.principal,n)}catch(e){throw this.host.inFactory--,r(n.run(void 0)),e}this.host.inFactory--;let a=n.run(i);try{if(i instanceof Promise)throw Pi(`behavior`,`${this.typeName}: factories must be synchronous`);WO(e,a.behavior)}catch(e){throw r(a),e}return a}async open(e,t,n){let r=new Map,i=t=>{let a=r.get(t);return a===void 0&&(a=(async()=>{await Promise.all(t.deps.map(t=>t instanceof EO?e.includes(t)?i(t):void 0:t.ready)),await t.open(n,this.openOrder)})(),r.set(t,a)),a},a=(await Promise.allSettled([...e.map(i),...t.map(e=>e.ready)])).find(e=>e.status===`rejected`);if(a!==void 0)throw a.reason}async unwind(e){for(let t of e.created.derives)t.detach();await Ii([...[...e.created.resources].sort((e,t)=>this.openOrder.indexOf(t)-this.openOrder.indexOf(e)).map(e=>()=>e.close(this.openOrder)),...e.created.holds.map(e=>()=>e.release())],`${this.address}: cleanup failed`)}currentInstalled(){return this.behaviors.get(this.host.currentEpoch())??[...this.behaviors.values()].at(-1)}refreshSchemas(){let e=new Map;for(let t of this.behaviors.values())for(let[n,r]of UO(t.service,t.behavior))e.set(n,[...e.get(n)??[],...r]);for(let t of this.allDecls())for(let n of[...t.cells.values(),...t.derives.values()])n.schemas=e.get(n)??[]}allDecls(){let e=new Set([this.decls,...this.pending]);for(let t of this.behaviors.values())e.add(t.decls);return e}#s(e){return kO(e.source)??e.source}#c(e,t){let n=kO(t.source),r=n===void 0?t.source:n.value,i=t.select===void 0?r:t.select(r);if(typeof i?.subscribe!=`function`)throw Pi(`behavior`,`listener ${e}: source has no subscribe()`);return i}stageListeners(e){let t=new Map,n=new Set;try{for(let[r,i]of e.listeners){let e=this.#s(i),a=this.#e.get(r);if(a!==void 0&&a.origin===e&&BO(a.select,i.select)){n.add(r);continue}let o=this.#c(r,i),s={origin:e,select:i.select,unsubscribe:CO,buffer:[]};t.set(r,s),s.unsubscribe=o.subscribe(e=>{s.buffer===void 0?this.#l(r,e):s.buffer.push(e)})}}catch(e){for(let e of t.values())e.unsubscribe();throw e}return{activate:()=>{for(let[e,t]of this.#e)n.has(e)||(t.unsubscribe(),this.#e.delete(e));for(let[e,n]of t){this.#e.set(e,n);let t=n.buffer??[];n.buffer=void 0;for(let n of t)this.#l(e,n)}},discard:()=>{for(let e of t.values())e.unsubscribe()}}}startRuntime(){this.stageListeners(this.decls).activate(),this.startTasks()}startTasks(){for(let e of this.decls.tasks.keys())this.startTask(e,this.host.currentEpoch())}stopListeners(){for(let e of this.#e.values())e.unsubscribe();this.#e.clear()}startTask(e,t){let n=this.decls.tasks.get(e);if(n===void 0)return;let r=new AbortController,i=new jO(this.host,{signal:AbortSignal.any([r.signal,this.callAbort.signal]),rootId:`task:${this.address}:${e}`,epoch:t,principal:this.host.principal,holder:!0}),a=(async()=>{try{await n(i)}catch(e){i.signal.aborted||this.host.report(e)}finally{i.close(),this.#n.get(e)?.controller===r&&this.#n.delete(e)}})();this.#n.set(e,{controller:r,done:a})}stopTasks(){for(let e of this.#n.values())e.controller.abort(new N(`aborted`,`task stopped`)),this.#r.push(e.done);this.#n.clear()}#l(e,t){zw(()=>{if(this.gate!==void 0){this.gate.queue.push({key:e,event:t});return}let n=this.decls.listeners.get(e);n===void 0||this.status!==`live`&&this.status!==`activating`||this.host.root(e=>{this.lease(e);let r=e.child(this);return this.#u(async()=>{try{await n.fn(t,r)}finally{r.close()}})}).catch(e=>this.host.report(e))})}openGate(){let e=this.gate;this.gate=void 0;for(let{key:t,event:n}of e?.queue??[])this.#l(t,n)}admit(e){if(this.host.failed!==void 0)throw new N(`unavailable`,`${this.host.name} failed and admits no work`,{reason:`host_failed`});if(!this.host.hasEpoch(e.epoch))throw new N(`superseded`,`epoch ${e.epoch} is retired`);if(e.epoch<this.minEpoch)throw new N(`upgrade_conflict`,`${this.address} was upgraded in epoch ${this.minEpoch}`);if(this.gate!==void 0&&!this.gate.grandfathered.has(e.rootId))throw new N(`upgrade_conflict`,`${this.address} is being upgraded`)}lease(e){this.leases.has(e.rootId)||(this.leases.set(e.rootId,e.epoch),this.host.touch(e.rootId,this))}guard=e=>{if(this.host.inFactory>0)throw Pi(`read_only`,`cells cannot be written while a factory runs`);if(e instanceof jO&&e.check(this.host),e.signal.aborted)throw new N(`aborted`,`write with an aborted ctx`);if(this.status===`disposed`)throw new N(`gone`,`${this.address} is disposed`);e.rootId.startsWith(`task:`)||this.admit(e)};async call(e,t,n,r){if(r.check(this.host),e.status===`released`||e.status===`gone`)throw e.terminalError();if(e.status===`loading`&&await MO(e.ready,r.signal),e.status!==`live`||this.status!==`live`)throw e.status===`live`?new N(`gone`,`${this.address} is ${this.status}`):e.terminalError();this.admit(r);let i=this.behaviors.get(r.epoch);if(i===void 0)throw new N(`superseded`,`${this.address} has no behavior for epoch ${r.epoch}`);let a=e.viewOf(i),o=zO(a),s=e.describe(e.contract.scope===`remote`?o:``,t),c=a[t];if(typeof c!=`function`||e.contract.scope===`remote`&&s?.kind!==`method`)throw new N(`not_in_variant`,`${this.address}: ${t} is not a method of variant ${o??`(local)`}`);let l=a===i.behavior?i.service.contract.description.variants[o??``]?.[t]:s,u=e.contract.scope===`remote`&&l?.kind===`method`?l:void 0,d=e.contract.scope===`remote`&&s?.kind===`method`?s.args:void 0,f=d===void 0?n:YC(d,BC(n)),p=u?YC(u.args,BC(f)):f;u&&dw(`args`,`${this.address}.${t} args`,u.args,p),this.lease(r);let m=r.child(this),h;try{h=await this.#u(()=>c(p,m))}finally{m.close()}return u&&dw(`result`,`${this.address}.${t} result`,u.result,h),h}#u(e){let t=(async()=>e())();this.#t.add(t);let n=()=>{this.#t.delete(t),this.#t.size===0&&this.#d()};return t.then(n,n),t}rootEnded(e){this.leases.delete(e);let t=this.gate;t?.grandfathered.delete(e)&&t.grandfathered.size===0&&t.drained()}addHold(e){this.holds.add(e),this.#i!==void 0&&clearTimeout(this.#i),this.#i=void 0}release(e){this.holds.delete(e)&&this.#d()}#d(){if(this.holds.size>0||this.#t.size>0||this.#i!==void 0)return;if(this.status===`activating`){this.#f(this.dispose(!1));return}if(this.status!==`live`)return;let e=this.service?.options.linger??0;e<=0?this.#f(this.dispose(!1)):(this.#i=setTimeout(()=>{this.#i=void 0,this.holds.size===0&&this.#t.size===0&&this.status===`live`&&this.#f(this.dispose(!1))},e),this.#i.unref?.())}#f(e){e.catch(e=>this.host.report(e))}dispose(e,t){return this.#a??=this.#p(e,t),this.#a}async#p(e,t){let n=this.status===`activating`;this.status=`disposing`,this.host.forget(this),this.#i!==void 0&&clearTimeout(this.#i),this.#i=void 0;let r=t??new N(`gone`,`${this.address} was disposed`);if(e){for(let e of this.holds)e.gone(r);this.callAbort.abort(r)}this.activationAbort.abort(r),n&&await this.ready.catch(CO);for(let e of this.holds)e.gone(r);let i=this.allDecls();this.stopTasks(),this.stopListeners(),await Promise.allSettled([...this.#t]);let a=[...i].some(e=>e.registrations.size>0)&&!this.deferredRuntime;this.behaviors.clear(),this.decls=new AO,a&&this.host.registriesChanged();let o=new Set;for(let e of i){for(let t of e.derives.values())t.detach();for(let t of e.holds.values())o.add(t)}try{await Ii([()=>Promise.allSettled(this.#r.splice(0)),...[...this.openOrder].reverse().map(e=>()=>e.close(this.openOrder)),...[...o].map(e=>()=>e.release())],`${this.address}: disposal failed`)}finally{this.status=`disposed`}}},HO=e=>typeof e==`object`&&!!e&&typeof e.events==`function`&&typeof e.subscribe==`function`;function UO(e,t){let n=new Map,r=e.contract;if(r.scope!==`remote`)return n;let i=r.description.variants[zO(t)??``]??{};for(let[e,r]of Object.entries(i)){let i=t[e];r.kind===`state`&&xO(i)&&n.set(i,[...n.get(i)??[],r.schema])}return n}function WO(e,t){let n=e.contract,r=e=>{throw Pi(`behavior`,`${n.name}: ${e}`)};(typeof t!=`object`||!t)&&r(`factory must return an object`);let i;if(n.scope===`remote`){let e=t.kind;(typeof e!=`string`||n.description.variants[e]===void 0)&&r(`unknown variant ${String(e)}`),i=n.description.variants[e];for(let n of Object.keys(t))n!==`kind`&&i[n]===void 0&&r(`${n} is not in variant ${String(e)}`)}else i=n.description.variants[``]??{};for(let[e,n]of Object.entries(i)){let i=t[e];n.kind===`method`&&typeof i!=`function`&&r(`${e} must be a method`),n.kind===`state`&&!xO(i)&&!HO(i)&&r(`${e} must be a cell, a derivation or a held object's state member`),n.kind===`opaque`&&i===void 0&&r(`${e} is missing`)}}var GO=class{#e;#t;#n=new AO;#r={holds:[],resources:[],derives:[]};constructor(e,t){this.#e=e,this.#t=t}run(e){return{behavior:e,decls:this.#n,created:this.#r}}*#i(e,t,n,r){if(typeof n!=`object`||!n)throw TypeError(`${t} takes an object of named declarations`);for(let[i,a]of Object.entries(n)){if(e.has(i))throw Pi(`duplicate`,`${this.#e.typeName}: duplicate ${t} name ${i}`);if(r!==void 0&&Fw(a)!==r)throw TypeError(`${t}.${i} must be declared with ${r}()`);yield[i,a]}}state(e){let t={},n=this.#e.host;for(let[r,i]of this.#i(this.#n.cells,`state`,e,`cell`)){let e=this.#t?.cells.get(r)??new gO(r,i.schema,i.initial,this.#e.guard,{dev:n.dev,report:e=>n.report(e)});this.#n.cells.set(r,e),this.#n.cellSchemas.set(r,i.schema),t[r]=e}return t}get(e,t,n){let r=this.#e.host,i=this.#t!==void 0,a=r.addressOf(e,t,n?.principal??r.principal,n?.at,i),o=this.#n.holds.get(a);if(o!==void 0){if(o.contract.fingerprint!==e.fingerprint)throw Pi(`duplicate`,`${this.#e.typeName}: ${e.name} held twice with different contracts`);return o.proxy}let s=this.#t?.holds.get(a);if(s!==void 0&&s.contract.fingerprint===e.fingerprint&&s.status!==`gone`&&s.status!==`released`)return this.#n.holds.set(a,s),s.proxy;let c=r.acquire(e,t,n,`record`,this.#e,i);return this.#n.holds.set(a,c),this.#r.holds.push(c),c.proxy}resources(e){let t={};for(let[n,{spec:r}]of this.#i(this.#n.resources,`resources`,e,`resource`)){let e=(r.deps??[]).map(e=>{let t=IO(e)??kO(e);if(t===void 0)throw TypeError(`resource ${n}: deps must be handles or resources of this record`);return t}),i=this.#t?.resources.get(n),a=i!==void 0&&i.spec.rev===r.rev&&i.exclusive===(r.exclusive===!0)&&i.deps.length===e.length&&i.deps.every((t,n)=>t===e[n]),o=a?i:new EO(n,r,e);a||this.#r.resources.push(o),this.#n.resources.set(n,o),t[n]=new DO(o,this.#e.host)}return t}listen(e){for(let[t,n]of this.#i(this.#n.listeners,`listen`,e,`listener`))this.#n.listeners.set(t,n)}tasks(e){for(let[t,n]of this.#i(this.#n.tasks,`tasks`,e)){if(typeof n!=`function`)throw TypeError(`tasks.${t} must be a function`);this.#n.tasks.set(t,n)}}derive(e){let t={},n=this.#e.host;for(let[r,{sources:i,fn:a}]of this.#i(this.#n.derives,`derive`,e,`derivation`)){let e=this.#t?.derives.get(r),o;e!==void 0&&e.sources.length===i.length&&e.sources.every((e,t)=>e===i[t])?o=e:(o=new bO(r,i,a,{dev:n.dev,report:e=>n.report(e)}),this.#r.derives.push(o)),this.#n.derives.set(r,o),this.#n.deriveFns.set(r,a),t[r]=o}return t}expose(e){let t=kO(e);if(t===void 0||![...this.#n.resources.values()].includes(t))throw TypeError(`expose takes a resource declared by this record`);return new TO(t)}register(e,t){if(!this.#e.eager)throw Pi(`not_eager`,`${this.#e.typeName}: only eager records may register`);let n={};for(let[r,i]of Object.entries(t))n[`${e.name}\u0000${r}`]=i;for(let[t,r]of this.#i(this.#n.registrations,`register`,n))this.#n.registrations.set(t,{registry:e,key:t.slice(e.name.length+1),value:r})}},KO=()=>{};function qO(e){let{run:t,migrated:n,service:r,record:i}=e,a=UO(r,t.behavior);for(let[e,t]of n)for(let n of a.get(e)??[])dw(`state`,`${i.address}: migrated state ${e.key}`,n,t);let o=new Map(n),s=[...t.decls.derives].sort(([,e],[,t])=>e.seq-t.seq);for(let[e,n]of s){let r=n.compute(e=>o.has(e)?o.get(e):e.value,t.decls.deriveFns.get(e));for(let t of a.get(n)??[])dw(`state`,`${i.address}: derived ${e}`,t,r);o.set(n,r)}e.derived=o}function JO(e){let t=Fi(e,`reload`);return/^reload aborted/.test(t.message.replace(/^[^:]*: /,``))?t:new N(t.code,`reload aborted: ${t.message}`,{cause:t,reason:t.reason,details:t.details})}async function YO(e,t,n){let r=await XO(e,t,n);try{return await r.prepare(),r.commit()}finally{ZO(e)}}async function XO(e,t,n,r){if(e.reloading)throw new N(`unavailable`,`a reload is already running`,{reason:`reload_running`});e.reloading=!0;try{return new QO(e,await e.resolve(t),n,r)}catch(t){throw e.reloading=!1,JO(t)}}function ZO(e){e.reloading=!1,e.maybeRetire()}var QO=class{host;facets;options;epoch;candidates=new Map;abort=new AbortController;closed=[];services=new Map;changed=new Set;removed=new Set;tables=new Map;gated=[];rolledBack=!1;deferred=new Map;constructor(e,t,n,r){this.host=e,this.facets=t,this.options=n,this.epoch=r}async prepare(){try{await this.waitForRetirement(),this.load(),this.checkProviders(),await this.prepareAll(),this.host.gating=this.changed,await this.withDeadline(this.prepareAll(),`activations in flight did not finish`),this.checkHolds(),this.tables=this.host.buildTables(this.entries()),await this.gate(),this.#e(),this.#t()}catch(e){throw await this.rollback(),JO(e)}}summary(){let e=[...this.candidates.values()].filter(({record:e})=>e.status===`live`);return{epoch:this.host.pending?.id??this.host.current.id,previous:this.host.current.id,changed:[...this.changed],removed:[...this.removed],prepared:e.map(({record:e})=>e.address),gated:this.gated.map(({record:e})=>e.address)}}#e(){if(this.rolledBack)throw new N(`aborted`,`reload aborted while preparing`,{reason:`aborted`})}#t(){for(let e of this.candidates.values())e.record.status===`live`&&(e.staged=e.record.stageListeners(e.run.decls));for(let e of this.host.records.values())e.status===`live`&&e.deferredRuntime&&this.deferred.set(e,e.stageListeners(e.decls))}async waitForRetirement(){let e=this.host;if(e.previous!==void 0){if(e.previous.roots.size>0){let t;await new Promise(n=>{e.retired=n,t=setTimeout(n,this.options.retireDeadline??5e3)}),clearTimeout(t),e.retired=KO}e.retire()}}load(){let e=new Set([...this.facets.map(e=>e.name),...this.options.remove??[]]),t=this.host.current.services;this.services=new Map([...t].filter(([,t])=>!e.has(t.facet)));for(let e of this.facets)e.setup(this.host.facetApi(((t,n,r={})=>this.host.serveInto(this.services,wO(t,n,r,e.name)))));for(let[e,n]of this.services)t.get(e)!==n&&this.changed.add(e);for(let e of t.keys())this.services.has(e)||this.removed.add(e);this.host.pending={id:this.host.nextEpochId(this.epoch),services:this.services,tables:new Map,roots:new Map}}async withDeadline(e,t){let n=this.options.gateDeadline??5e3,r,i=new Promise((e,i)=>{r=setTimeout(()=>i(new N(`aborted`,`${t} within ${n} ms`,{reason:`deadline`})),n)});try{return await Promise.race([e,i])}finally{clearTimeout(r)}}checkProviders(){for(let e of this.changed){let t=this.services.get(e).contract,n=this.host.current.services.get(e)?.contract;if(n===void 0||n.version!==t.version)continue;let r=Mw(t.description,n.description);if(r!==void 0)throw new N(`contract_mismatch`,`${e}@${t.version} changed incompatibly without a version bump (${r})`)}let e=new Map(this.host.facets);for(let t of this.facets)e.set(t.name,t);for(let t of this.options.remove??[])e.delete(t);for(let t of e.values())for(let e of t.uses??[]){let t=this.services.get(e.name);t!==void 0&&this.changed.has(e.name)&&Nw(t.contract,t.options.accepts,e)}}async prepareAll(){for(;;){let e=[...this.host.records.values()].filter(e=>this.changed.has(e.typeName)&&!this.candidates.has(e)&&e.service!==this.services.get(e.typeName)&&(e.status===`live`||e.status===`activating`));if(e.length===0)return;await Promise.allSettled(e.map(e=>e.ready)),this.#e();for(let t of e)t.status===`live`&&t.service!==this.services.get(t.typeName)&&(await this.prepareRecord(t),this.#e())}}async prepareRecord(e){let t=this.services.get(e.typeName),n=e.run(t,e.decls),r={record:e,service:t,run:n,reasons:[],atGate:[],replaced:[],migrated:new Map,derived:new Map,staged:void 0};this.candidates.set(e,r);let i=t.stateVersion!==e.stateVersion;i&&r.reasons.push(`state version ${e.stateVersion} -> ${t.stateVersion}`);for(let[t,r]of n.decls.cells)if(!(e.decls.cells.get(t)!==r||uw(r.schema,n.decls.cellSchemas.get(t)))&&!i)throw Pi(`state`,`${e.address}: schema of state ${t} changed without a state-version bump`);for(let r of Object.keys(t.options.state?.migrate??{}))if(!n.decls.cells.has(r))throw Pi(`state`,`${e.address}: migrate for undeclared state ${r}`);let a=new Set;for(let e of n.created.resources)(e.exclusive||e.deps.some(e=>a.has(e)))&&a.add(e);for(let t of a){r.atGate.push(t);let n=e.decls.resources.get(t.key);t.exclusive&&n?.exclusive&&n.state===`open`&&r.replaced.push(n)}a.size>0&&r.reasons.push(`exclusive resource replaced`),r.reasons.length===0&&qO(r),await e.open(n.created.resources.filter(e=>!a.has(e)),n.created.holds,this.abort.signal)}checkHolds(){let e=new Set;for(let{record:t,run:n}of this.candidates.values())for(let r of t.decls.holds.values())[...n.decls.holds.values()].includes(r)||e.add(r);for(let t of this.host.records.values()){let n=this.services.get(t.typeName);if(n!==void 0&&this.changed.has(t.typeName))for(let r of t.holds)r!==this.host.eager.get(t.typeName)&&!e.has(r)&&r.owner!==`client`&&Nw(n.contract,n.options.accepts,r.contract)}}entries(){return this.host.liveDecls(!0).filter(([e])=>!this.removed.has(e.typeName)).map(([e,t])=>[e,this.candidates.get(e)?.run.decls??t])}async gate(){this.gated=[...this.candidates.values()].filter(e=>e.reasons.length>0&&e.record.status===`live`);let e=this.gated.map(({record:e})=>{let t=new Set(e.leases.keys());return new Promise(n=>{e.gate={grandfathered:t,queue:[],drained:n},e.stopTasks(),t.size===0&&n()})}),t=this.options.gateDeadline??5e3,n,r=await Promise.race([Promise.all(e).then(()=>!1),new Promise(e=>{n=setTimeout(()=>e(!0),t)})]);if(clearTimeout(n),r){let e=this.gated.flatMap(({record:e})=>[...e.gate?.grandfathered??[]]);throw new N(`aborted`,`gate deadline (${t} ms) missed; blocking roots: ${e.join(`, `)}`,{reason:`gate_deadline`,details:{blocking:e}})}this.#e();for(let e of this.gated){let{record:t}=e;for(let n of e.replaced)this.closed.push([t,n]),await n.close(t.openOrder);await t.open(e.atGate,[],this.abort.signal),this.#e()}for(let e of this.gated)this.migrate(e)}migrate(e){let{record:t,service:n,run:r}=e,i=n.options.state?.migrate??{},a=n.stateVersion!==t.stateVersion;for(let[n,o]of r.decls.cells){if(t.decls.cells.get(n)!==o)continue;let s=r.decls.cellSchemas.get(n),c=i[n],l;if(a&&c!==void 0)l=c(structuredClone(o.value),t.stateVersion);else if(!uw(o.schema,s))l=o.value;else continue;dw(`state`,`${t.address}: migrated state ${n}`,s,l),e.migrated.set(o,l)}qO(e)}async rollback(){if(this.rolledBack)return;this.rolledBack=!0,this.abort.abort(new N(`aborted`,`reload aborted`));let e=e=>this.host.report(e);for(let e of this.candidates.values())e.staged?.discard();for(let e of this.deferred.values())e.discard();for(let{record:t,run:n}of this.candidates.values())t.pending.delete(n.decls),await t.unwind(n).catch(e);for(let[t,n]of this.closed)n.state===`closed`&&await n.open(new AbortController().signal,t.openOrder).catch(r=>{n.markUnavailable(),e(new N(`unavailable`,`${t.address}: resource ${n.key} could not be restored`,{cause:r}))});for(let{record:e}of this.gated)if(e.gate!==void 0){e.openGate();for(let t of e.decls.tasks.keys())e.startTask(t,this.host.current.id)}let t=new N(`gone`,`reload aborted; type not served`);for(let n of[...this.host.records.values()])this.host.current.services.has(n.typeName)||await n.dispose(!0,t).catch(e);this.host.pending=void 0,this.host.gating=void 0}commit(e){try{return Bw(()=>{let t=this.#r();e?.();for(let e of this.#n.splice(0))e();return t})}catch(e){throw this.host.fail(e),JO(e)}}#n=[];#r(){let e=this.host,t=e.current,n=e.pending;e.pending=void 0,e.epochs.set(n.id,n),e.previous=t,e.current=n;let r=[];for(let i of[...e.records.values()]){if(this.removed.has(i.typeName))continue;let e=this.candidates.get(i);if(e===void 0){let e=i.behaviors.get(t.id);e!==void 0&&i.behaviors.set(n.id,{...e,epoch:n.id})}else i.status===`live`&&(this.install(e,n.id),r.push(i.address))}for(let{record:t,run:n,staged:r}of this.candidates.values())t.status!==`live`&&(r?.discard(),t.pending.delete(n.decls),t.unwind(n).catch(t=>e.report(t)));for(let[e,t]of this.deferred)e.status===`live`?(e.deferredRuntime=!1,t.activate(),this.#n.push(()=>e.startTasks())):t.discard();e.installTables(n,this.tables,!0);let i=new N(`gone`,`type no longer served`);for(let t of[...e.records.values()])this.removed.has(t.typeName)&&t.dispose(!0,i).catch(t=>e.report(t));for(let t of this.removed)e.eager.delete(t);for(let t of this.facets)e.facets.set(t.name,t);for(let t of this.options.remove??[])e.facets.delete(t);e.gating=void 0;for(let[t,n]of this.services)n.options.eager&&this.changed.has(t)&&e.eager.get(t)?.record?.status!==`live`&&this.#n.push(()=>e.startEager(n));return{epoch:n.id,previous:t.id,changed:[...this.changed],removed:[...this.removed],prepared:r,gated:this.gated.map(({record:e})=>e.address)}}install(e,t){let{record:n,run:r,service:i}=e,a=e.reasons.length>0;if(n.pending.delete(r.decls),n.stopTasks(),a){let e=new Set(r.decls.derives.values());for(let t of n.decls.derives.values())e.has(t)||t.detach()}if(n.decls=r.decls,n.service=i,n.stateVersion=i.stateVersion,n.behaviors.set(t,{epoch:t,service:i,behavior:r.behavior,decls:r.decls}),a){n.minEpoch=t;for(let e of[...n.behaviors.keys()])e!==t&&this.host.retireBehavior(n,e)}n.refreshSchemas();for(let[e,t]of r.decls.derives)t.setFn(r.decls.deriveFns.get(e));for(let[t,n]of r.decls.cells){let i=r.decls.cellSchemas.get(t);e.migrated.has(n)?n.reset(e.migrated.get(n),i):n.schema=i}let o=new Set(r.created.derives);for(let t of r.created.derives)t.attach(e.derived);for(let e of r.decls.derives.values())o.has(e)||e.refresh();e.staged?.activate(),this.#n.push(()=>n.startTasks()),n.openGate();let s=this.host.eager.get(n.typeName);if(s?.record===n&&s.contract.fingerprint!==i.contract.fingerprint){let e=new RO(n,i.contract,`host`);n.addHold(e),this.host.eager.set(n.typeName,e),s.release()}for(let e of[...n.holds]){if(e.owner===`client`)try{Nw(i.contract,i.options.accepts,e.contract)}catch(t){e.gone(new N(`upgrade_required`,`${n.typeName} changed; reload the web facets`,{cause:t})),n.release(e);continue}e.shapeChanged()}}};function $O(e){return e instanceof N?e.reason===void 0?{code:e.code,message:e.message}:{code:e.code,message:e.message,reason:e.reason}:{code:`unavailable`,message:e instanceof Error?e.message:String(e)}}var ek=e=>new N(e.code,e.message.replace(/^[a-z_]+(\/[a-z_]+)?: /,``),{reason:e.reason}),tk=Up({minimum:1}),nk=im({minLength:1}),rk=G({rootId:nk,epoch:Up({minimum:1})}),ik=G({code:im(),message:im(),reason:W(im())}),ak=Up({minimum:1}),ok=q([G({t:K(`hello`),name:nk,kind:q([K(`host`),K(`client`)]),epoch:Up({minimum:0})}),G({t:K(`hold`),id:tk,at:nk,token:G({name:nk,scope:im(),version:Up(),input:vp(),variants:Ph(im(),vp())}),input:vp(),principal:W(vp()),client:W(Bp())}),G({t:K(`release`),id:tk}),G({t:K(`shape`),id:tk,kind:W(im()),members:qf(im()),contract:im(),epoch:Up()}),G({t:K(`gone`),id:tk,error:ik}),G({t:K(`call`),id:tk,hold:tk,member:nk,args:vp(),root:W(rk)}),G({t:K(`result`),id:tk,value:W(vp()),error:W(ik)}),G({t:K(`cancel`),id:tk}),G({t:K(`sub`),id:tk,hold:tk,member:nk}),G({t:K(`unsub`),id:tk}),G({t:K(`state`),id:tk,snap:W(vp()),reset:W(vp()),ops:W(qf(qf(vp()))),error:W(ik)}),G({t:K(`ping`),n:Up()}),G({t:K(`pong`),n:Up()}),G({t:K(`bye`),reason:W(im())}),G({t:K(`root_end`),rootId:nk}),G({t:K(`invalidate`),pattern:Ph(im(),vp())}),G({t:K(`prepare`),reload:ak,epoch:Up({minimum:1}),plugins:qf(im()),options:G({remove:W(qf(im())),gateDeadline:W(em()),retireDeadline:W(em())})}),G({t:K(`vote`),reload:ak,error:W(ik),report:W(G({epoch:Up(),previous:Up(),changed:qf(im()),removed:qf(im()),prepared:qf(im()),gated:qf(im())}))}),G({t:K(`commit`),reload:ak}),G({t:K(`retire`),epoch:Up({minimum:1})}),G({t:K(`abort`),reload:ak})]),sk=e=>Ff(ok,e),ck=0,lk=(e,t)=>{let n;for(let r of Object.entries(e??{}))t?.startsWith(r[0])&&(n===void 0||r[0].length>n[0].length)&&(n=r);return[...n?.[1]??[]]};function uk(e,t,n){let r;return new Promise((i,a)=>{e.votes.set(t,{resolve:i,reject:a}),r=setTimeout(()=>{e.votes.delete(t),a(new N(`aborted`,`votes missing after ${n} ms`,{reason:`vote_deadline`}))},n)}).finally(()=>clearTimeout(r))}async function dk(e,t,n){let r=[...e.connections].filter(e=>e.role===`downstream`&&e.peer.kind===`host`&&e.open&&e.synced),i=e.peekNextEpoch(),a=await XO(e,t,n,i),o=++ck,s=n.voteDeadline??(n.gateDeadline??5e3)+(n.retireDeadline??5e3)+5e3,c=r.map(e=>{let t=e.name??`child`,r=uk(e,o,s);return e.send({t:`prepare`,reload:o,epoch:i,plugins:lk(n.remote,t),options:{remove:lk(n.remoteRemove,t),gateDeadline:n.gateDeadline,retireDeadline:n.retireDeadline}}),r.then(e=>[t,e],e=>{let n=JO(e);throw new N(n.code,`${t}: ${n.message}`,{cause:n,reason:n.reason})})}),l=!1;try{let t=await Promise.allSettled([a.prepare().then(()=>{l=!0}),...c]),s=t.find(e=>e.status===`rejected`);if(s!==void 0){for(let e of r)e.votes.delete(o),e.send({t:`abort`,reload:o});throw l&&await a.rollback(),s.reason}let u=a.commit(()=>{for(let e of r)e.send({t:`commit`,reload:o}),e.peerEpoch=i});e.rememberRemoteModules(n.remote,n.remoteRemove);let d={};for(let e of t.slice(1)){if(e.status!==`fulfilled`)continue;let[t,n]=e.value;n!==void 0&&(d[t]=n)}return{...u,children:d}}finally{ZO(e)}}async function fk(e,t){for(;;){let n=e.current.id;if(!t.open)return;if(t.peerEpoch===n){t.markSynced(n);return}let r=++ck,i=uk(t,r,3e4);t.send({t:`prepare`,reload:r,epoch:n,plugins:lk(e.remoteModules,t.name),options:{remove:lk(e.remoteRemoved,t.name)}}),await i,e.current.id===n?(t.send({t:`commit`,reload:r}),t.peerEpoch=n):t.send({t:`abort`,reload:r})}}var pk=class{#e;#t;constructor(e){this.#e=e}handle(e,t){if(t.t===`prepare`){if(this.#t!==void 0){let n=new N(`unavailable`,`a reload is already running`,{reason:`reload_running`});e.send({t:`vote`,reload:t.reload,error:$O(n)});return}let n={id:t.reload,reload:void 0,state:`loading`,cancelled:!1};this.#t=n,this.#r(n,e,t).catch(e=>this.#e.report(e));return}let n=this.#t;if(n!==void 0&&n.id===t.reload){if(t.t===`abort`)this.#n(n);else if(n.state===`prepared`){this.#t=void 0;try{n.reload?.commit()}finally{ZO(this.#e)}}}}parentLost(){this.#t!==void 0&&this.#n(this.#t)}#n(e){e.cancelled=!0,e.state===`prepared`?(this.#t=void 0,e.reload?.rollback().catch(e=>this.#e.report(e)).finally(()=>ZO(this.#e))):e.reload?.rollback().catch(e=>this.#e.report(e))}async#r(e,t,n){let r=()=>new N(`aborted`,`reload aborted by the server`,{reason:`aborted`});try{if(e.reload=await XO(this.#e,n.plugins,n.options,n.epoch),e.cancelled||(e.state=`preparing`,await e.reload.prepare(),e.cancelled))throw r();e.state=`prepared`,t.send({t:`vote`,reload:n.reload,report:e.reload.summary()})}catch(r){e.reload!==void 0&&(await e.reload.rollback().catch(e=>this.#e.report(e)),ZO(this.#e)),this.#t===e&&(this.#t=void 0),e.cancelled||t.send({t:`vote`,reload:n.reload,error:$O(r)})}}},mk=e=>new N(`unavailable`,e),hk=class{origin;frame;principal;client;generation;down;downId=0;closed=!1;calls=new Map;subs=new Map;#e=new Set;constructor(e,t,n,r){this.origin=e,this.frame=t,this.principal=n,this.client=r,this.generation=e.generation}get originId(){return this.frame.id}get current(){return!this.closed&&this.origin.open&&this.origin.generation===this.generation}ready(){return this.closed?Promise.reject(new N(`gone`,`relayed hold closed`)):this.down===void 0?new Promise((e,t)=>{this.#e.add({resolve:e,reject:t})}):Promise.resolve(this.down)}open(e){if(!this.closed){this.down=e,this.downId=e.nextId(),e.relayedHolds.set(this.downId,this),e.send({...this.frame,id:this.downId,principal:this.principal,...this.client?{client:!0}:{}});for(let[e,t]of this.subs)t.downId===void 0&&this.#t(e,t);for(let t of this.#e)t.resolve(e);this.#e.clear()}}subscribe(e,t){let n={member:t,downId:void 0};this.subs.set(e,n),this.origin.relaySubs.set(e,this),this.down!==void 0&&this.#t(e,n)}#t(e,t){let n=this.down;t.downId=n.nextId(),n.relayedSubs.set(t.downId,{relay:this,originSubId:e}),n.send({t:`sub`,id:t.downId,hold:this.downId,member:t.member})}unsubscribe(e,t=!0){let n=this.subs.get(e);n!==void 0&&(this.subs.delete(e),this.origin.relaySubs.delete(e),n.downId!==void 0&&this.down!==void 0&&(this.down.relayedSubs.delete(n.downId),t&&this.down.send({t:`unsub`,id:n.downId})))}close(e,t){if(!this.closed){this.closed=!0;for(let n of[...this.calls.values()])n.cancel(e,t.releaseDown);for(let e of[...this.subs.keys()])this.unsubscribe(e,t.releaseDown);this.origin.served.get(this.originId)?.kind===`relay`&&this.origin.served.delete(this.originId),this.down!==void 0&&(this.down.relayedHolds.delete(this.downId),t.releaseDown&&this.down.send({t:`release`,id:this.downId}));for(let t of this.#e)t.reject(e);this.#e.clear(),t.notify&&this.origin.send({t:`gone`,id:this.originId,error:$O(e)})}}},gk=class{relay;originId;downId;#e;#t=!1;constructor(e,t,n,r){this.relay=e,this.originId=t,this.downId=n,this.#e=r,e.calls.set(t,this),e.down?.relayedCalls.set(n,this)}finish(e,t){this.#t||(this.#t=!0,this.relay.calls.delete(this.originId),this.relay.down?.relayedCalls.delete(this.downId),e===void 0?this.#e.resolve(t):this.#e.reject(e))}cancel(e,t){this.#t||(t&&this.relay.down?.send({t:`cancel`,id:this.downId}),this.finish(e))}},_k=class{host;link;role;peer;principal;restamp;generation=0;peerEpoch;synced;fencedEpochs=new Set;#e=new Map;#t;#n=new Set;#r=1;#i=Date.now();#a;remotes=new Map;calls=new Map;subs=new Map;served=new Map;incoming=new Map;feeds=new Map;relaySubs=new Map;relayedHolds=new Map;relayedCalls=new Map;relayedSubs=new Map;votes=new Map;constructor(e,t,n){this.host=e,this.link=t,this.role=n.role,this.peer=n.peer,this.principal=n.principal,this.restamp=n.restamp,this.synced=this.role!==`downstream`||this.peer.kind!==`host`,t.onClose(e=>this.#x(e)),t.receive(e=>this.#s(e)),this.send({t:`hello`,name:e.name,kind:e.kind,epoch:e.current.id});let r=n.pingInterval??15e3,i=n.pingTimeout??45e3,a=0;this.#a=setInterval(()=>{Date.now()-this.#i>i?t.close(`ping timeout`):this.send({t:`ping`,n:++a})},r),this.#a.unref?.()}get open(){return!this.link.closed}get name(){return this.role===`upstream`?this.#t:this.peer.name}send(e){this.link.send(e)}nextId(){return this.#r++}whenSynced(){return this.open?this.synced?Promise.resolve():new Promise((e,t)=>this.#n.add({resolve:e,reject:t})):Promise.reject(mk(`link to ${this.name??`peer`} closed`))}markSynced(e){this.peerEpoch=e,this.synced=!0;for(let e of this.#n)e.resolve(void 0);this.#n.clear()}revoke(e){this.generation++;let t=new N(`gone`,`principal invalidated`);for(let e of[...this.served.values()])e.kind===`relay`&&e.relay.close(t,{releaseDown:!0,notify:!0});e===void 0?this.link.close(`principal invalidated`):this.principal=e}#o(e){this.host.report(new N(`invalid`,`link to ${this.name??`peer`}: ${e}`,{reason:`protocol`})),this.link.close(`protocol error: ${e}`)}hold(e){let t=this.nextId();this.remotes.set(t,e),e.bound(this,t);let n=e.principal;return this.send({t:`hold`,id:t,at:e.at,token:e.contract.description,input:e.input,...n===void 0?{}:{principal:n},...e.owner===`client`?{client:!0}:{}}),t}release(e){this.remotes.delete(e),this.send({t:`release`,id:e})}call(e,t,n,r,i){let a=this.nextId();return new Promise((o,s)=>{if(i.aborted){s(new N(`aborted`,`call aborted`));return}let c=()=>{this.calls.delete(a),this.send({t:`cancel`,id:a}),s(new N(`aborted`,`call aborted`,{cause:i.reason}))};i.addEventListener(`abort`,c,{once:!0});let l=()=>i.removeEventListener(`abort`,c);this.calls.set(a,{resolve:e=>{l(),o(e)},reject:e=>{l(),s(e)}});let u=r!==void 0&&this.host.kind===`host`;u&&this.host.rootSent(r.rootId,this),this.send({t:`call`,id:a,hold:e,member:t,args:n,...u?{root:r}:{}})})}sub(e,t,n){let r=this.nextId();return this.subs.set(r,n),this.send({t:`sub`,id:r,hold:e,member:t}),r}unsub(e){this.subs.delete(e)&&this.send({t:`unsub`,id:e})}#s(e){if(this.#i=Date.now(),!sk(e))this.#o(`malformed frame`);else try{this.#c(e)}catch(e){this.host.report(e)}}#c(e){switch(e.t){case`hello`:this.#l(e);return;case`ping`:this.send({t:`pong`,n:e.n});return;case`pong`:case`bye`:return;case`hold`:this.#f(e);return;case`release`:this.#p(e.id,!0);return;case`call`:this.#m(e);return;case`cancel`:this.incoming.get(e.id)?.abort(new N(`aborted`,`cancelled by caller`));return;case`sub`:this.#g(e);return;case`unsub`:this.#_(e.id);return;case`shape`:case`gone`:this.#v(e);return;case`result`:this.#y(e);return;case`state`:this.#b(e);return;case`root_end`:this.#e.delete(e.rootId),this.host.foreignRootEnded(e.rootId,this);return;case`invalidate`:case`prepare`:case`commit`:case`abort`:case`retire`:if(this.role!==`upstream`){this.#o(`${e.t} from a child`);return}e.t===`invalidate`?this.host.invalidatePrincipal(e.pattern).catch(e=>this.host.report(e)):e.t===`retire`?this.host.allowRetire(e.epoch):this.host.onReloadFrame(this,e);return;case`vote`:{if(this.role!==`downstream`||this.peer.kind!==`host`){this.#o(`vote from a non-participant`);return}let t=this.votes.get(e.reload);this.votes.delete(e.reload),e.error===void 0?t?.resolve(e.report):t?.reject(ek(e.error));return}}}#l(e){if(this.role===`upstream`){if(e.kind!==`host`){this.#o(`parent is not a host`);return}this.#t??=e.name}else e.kind!==this.peer.kind||this.peer.name!==void 0&&e.name!==this.peer.name?this.#o(`hello ${e.kind} ${e.name} does not match the accepted ${this.peer.kind} ${this.peer.name??``}`):this.peer.kind===`host`&&this.host.peerHello(this,e.epoch)}#u(e){return this.role===`downstream`?this.principal:e.principal??{host:this.#t??`parent`}}#d(e){return this.role===`downstream`?this.peer.kind===`client`:e.client===!0}#f(e){if(this.served.has(e.id)){this.#o(`duplicate hold id ${e.id}`);return}let t=this.#u(e),n=this.#d(e);if(e.at!==this.host.name){if(this.role===`upstream`){this.send({t:`gone`,id:e.id,error:$O(mk(`${this.host.name} does not relay`))});return}let r=new hk(this,e,t,n);this.served.set(e.id,{kind:`relay`,relay:r}),this.host.relay(r).catch(e=>r.close(e,{releaseDown:!0,notify:!0}));return}let r;try{let i=jw(e.token);if(i.scope!==`remote`)throw Pi(`token`,`${i.name} is local; only remote types cross links`);let a=this.host.acquire(i,e.input,{principal:t},n?`client`:`connection`);if(!(a instanceof RO))throw mk(`not a local handle`);r=a}catch(t){this.send({t:`gone`,id:e.id,error:$O(n?bk(t):t)});return}let i={kind:`local`,handle:r,principal:t,feeds:new Set};this.served.set(e.id,i);let a=()=>{let t=r.shape;t!==void 0&&this.served.get(e.id)===i&&this.send({t:`shape`,id:e.id,kind:t.kind,members:t.members,contract:t.contract,epoch:t.epoch})};r.onShape(a),r.goneListeners.add(t=>{this.served.get(e.id)===i&&(this.#p(e.id,!1),this.send({t:`gone`,id:e.id,error:$O(t)}))}),r.status===`live`&&a()}#p(e,t){let n=this.served.get(e);if(n!==void 0){if(this.served.delete(e),n.kind===`relay`)n.relay.close(new N(`released`,`relayed hold released`),{releaseDown:t,notify:!1});else{for(let e of n.feeds)this.#_(e);t&&n.handle.release()}}}#m(e){if(this.incoming.has(e.id)){this.#o(`duplicate call id ${e.id}`);return}let t=this.served.get(e.hold);if(t===void 0){this.send({t:`result`,id:e.id,error:$O(new N(`gone`,`unknown hold`))});return}let n=new AbortController;this.incoming.set(e.id,n);let r=this.peer.kind===`host`?this.#h(e.root):void 0,i={principal:t.kind===`local`?t.principal:t.relay.principal,signal:n.signal},a=t.kind===`local`?n=>t.handle.record.call(t.handle,e.member,e.args,n):r=>vk(t.relay,e,{rootId:r.rootId,epoch:r.epoch},n.signal,this.host);(r===void 0?this.host.root(a,i):this.host.joinRoot(r.rootId,r.epoch,a,{...i,from:this})).then(t=>this.send({t:`result`,id:e.id,value:t}),t=>this.send({t:`result`,id:e.id,error:$O(t)})).finally(()=>this.incoming.delete(e.id))}#h(e){if(e===void 0||this.role!==`downstream`||!this.fencedEpochs.has(e.epoch)||this.host.hasEpoch(e.epoch))return e;let t=this.#e.get(e.rootId);return t===void 0&&(t=this.host.current.id,this.#e.set(e.rootId,t)),{rootId:e.rootId,epoch:t}}#g(e){if(this.feeds.has(e.id)||this.relaySubs.has(e.id)){this.#o(`duplicate sub id ${e.id}`);return}let t=this.served.get(e.hold);if(t===void 0){this.send({t:`state`,id:e.id,error:$O(new N(`gone`,`unknown hold`))});return}if(t.kind===`relay`){t.relay.subscribe(e.id,e.member);return}let n=t.handle.member(e.member);if(n===void 0||typeof n.events!=`function`){this.send({t:`state`,id:e.id,error:$O(new N(`not_in_variant`,`${e.member} is not state`))});return}let r=uO(),i=n.events(n=>{if(n.type===`ops`)this.send({t:`state`,id:e.id,ops:r.encode(n.ops)});else if(n.value!==void 0){try{yk(t.handle,e.member,n.value)}catch(t){this.send({t:`state`,id:e.id,error:$O(t)});return}r=uO(),this.send(n.type===`snap`?{t:`state`,id:e.id,snap:n.value}:{t:`state`,id:e.id,reset:n.value})}});this.feeds.set(e.id,i),t.feeds.add(e.id)}#_(e){let t=this.feeds.get(e);t!==void 0&&(this.feeds.delete(e),t()),this.relaySubs.get(e)?.unsubscribe(e)}#v(e){let t=this.relayedHolds.get(e.id);if(t!==void 0){e.t===`gone`?t.close(ek(e.error),{releaseDown:!1,notify:!0}):t.closed||t.origin.send({...e,id:t.originId});return}let n=this.remotes.get(e.id);n!==void 0&&(e.t===`gone`?(this.remotes.delete(e.id),n.gone(ek(e.error))):n.shaped({kind:e.kind,members:e.members,contract:e.contract,epoch:e.epoch}))}#y(e){let t=this.relayedCalls.get(e.id);if(t!==void 0){t.finish(e.error===void 0?void 0:ek(e.error),e.value);return}let n=this.calls.get(e.id);this.calls.delete(e.id),e.error===void 0?n?.resolve(e.value):n?.reject(ek(e.error))}#b(e){let t=this.relayedSubs.get(e.id);t===void 0?this.subs.get(e.id)?.(e):t.relay.origin.send({...e,id:t.originSubId})}#x(e){this.#a!==void 0&&clearInterval(this.#a);let t=mk(`link to ${this.name??`peer`} closed: ${e}`);for(let e of[...this.served.keys()])this.#p(e,!0);for(let e of this.incoming.values())e.abort(t);this.incoming.clear();for(let e of this.calls.values())e.reject(t);this.calls.clear(),this.subs.clear();for(let e of this.votes.values())e.reject(t);this.votes.clear();for(let e of this.#n)e.reject(t);this.#n.clear();for(let e of[...this.relayedHolds.values()])e.close(t,{releaseDown:!1,notify:!0});this.relayedHolds.clear(),this.relayedCalls.clear(),this.relayedSubs.clear();for(let e of this.remotes.values())this.role===`upstream`?e.detached():e.gone(t);this.remotes.clear(),this.host.connectionClosed(this)}};async function vk(e,t,n,r,i){let a=()=>new N(`aborted`,`call cancelled`,{cause:r.reason});if(r.aborted)throw a();let o=()=>{},s=new Promise((e,t)=>{o=()=>t(a()),r.addEventListener(`abort`,o,{once:!0})});s.catch(()=>{});try{let o=await Promise.race([e.ready(),s]);if(e.closed)throw new N(`gone`,`relayed hold closed`);return await new Promise((s,c)=>{let l=new gk(e,t.id,o.nextId(),{resolve:s,reject:c});r.addEventListener(`abort`,()=>l.cancel(a(),!0),{once:!0}),i.rootSent(n.rootId,o),o.send({t:`call`,id:l.downId,hold:e.downId,member:t.member,args:t.args,root:n})})}finally{r.removeEventListener(`abort`,o)}}function yk(e,t,n){if(n===void 0)return;let r=e.record.currentInstalled();if(r===void 0)return;let i=e.currentView(),a=zO(i===void 0?r.behavior:i),o=i!==void 0&&i!==r.behavior?e.contract.description.variants[a??``]?.[t]:r.service.contract.description.variants[zO(r.behavior)??``]?.[t];o?.kind===`state`&&dw(`state`,`${e.address}.${t}`,o.schema,n)}function bk(e){return e instanceof N&&e.code===`contract_mismatch`?new N(`upgrade_required`,e.message,{cause:e}):e}var xk=()=>{},Sk=class{#e;#t;#n=new Set;#r=new Set;#i;#a=dO();#o;constructor(e,t){this.#e=e,this.#t=t}get value(){return this.#o}subscribe(e){return this.#n.add(e),this.#l(()=>e(this.#o)),this.bind(),()=>this.#c(this.#n,e)}events(e){return this.#r.add(e),this.#l(()=>e({type:`snap`,value:this.#o})),this.bind(),()=>this.#c(this.#r,e)}bind(){let e=this.#n.size+this.#r.size>0;e||(this.#o=void 0);let t=e?this.#e.binding:void 0;if(t!==void 0&&this.#i?.channel===t.channel||(this.#i!==void 0&&((this.#i.channel!==t?.channel||t===void 0)&&this.#i.channel.unsub(this.#i.id),this.#i=void 0),t===void 0))return;let n=t.channel;this.#a=dO();let r=n.sub(t.id,this.#t,e=>this.#s(e));this.#i={channel:n,id:r}}detach(){this.#i=void 0}stop(){this.#n.clear(),this.#r.clear(),this.bind()}#s(e){if(e.error!==void 0){this.#e.host.report(ek(e.error));return}let t;if(e.ops!==void 0||`snap`in e||`reset`in e){if(e.ops!==void 0){let n=this.#a.decode(e.ops);this.#o=rO(this.#o,n),t={type:`ops`,ops:n,value:this.#o}}else this.#a=dO(),this.#o=`snap`in e?e.snap:e.reset,t={type:`reset`,value:this.#o};for(let e of[...this.#r])this.#l(()=>e(t));for(let e of[...this.#n])this.#l(()=>e(this.#o))}}#c(e,t){e.delete(t),this.bind()}#l(e){try{e()}catch(e){this.#e.host.report(e)}}},Ck=class{record=void 0;host;contract;at;input;principal;owner;address;proxy;ready;status=`loading`;error;shape;binding;shapeListeners=new Set;#e=new Map;#t=new Map;#n;#r;constructor(e,t){this.host=e,this.contract=t.contract,this.at=t.at,this.input=t.input,this.principal=t.principal,this.owner=t.owner,this.address=t.address,this.ready=new Promise((e,t)=>{this.#n={resolve:e,reject:t}}),this.ready.catch(xk),this.#r=this.#c(),this.proxy=new Proxy(this,{get:(e,t)=>{if(NO.has(t)){let n=Reflect.get(e,t,e);return typeof n==`function`?n.bind(e):n}if(typeof t==`string`&&t!==`then`)return e.member(t)}}),FO.set(this.proxy,this)}get kind(){return this.shape?.kind}onShape(e){return this.shapeListeners.add(e),()=>this.shapeListeners.delete(e)}onStatus(e){return this.#i.add(e),()=>this.#i.delete(e)}#i=new Set;#a(){PO(this.#i,this.status,this.error,e=>this.host.report(e))}release(){if(this.status===`released`||this.status===`gone`)return;this.status=`released`,this.#a();let e=new N(`released`,`handle ${this.address} released`);this.#n?.reject(e),this.#r.reject(e);for(let e of this.#e.values())e.stop();this.binding!==void 0&&this.binding.channel.release(this.binding.id),this.binding=void 0,this.host.forgetRemote(this)}bound(e,t){this.binding={channel:e,id:t}}shaped(e){if(this.status===`released`||this.status===`gone`)return;this.shape=e;let t=this.status===`loading`;this.status=`live`,t&&this.#a(),t&&(this.#n?.resolve(),this.#n=void 0,this.#r.resolve());for(let e of this.#e.values())e.bind();for(let t of[...this.shapeListeners])try{t(e)}catch(e){this.host.report(e)}}gone(e){if(this.status!==`released`&&this.status!==`gone`){this.status=`gone`,this.error=e,this.#a(),this.binding=void 0,this.#n?.reject(e),this.#r.reject(e);for(let e of this.#e.values())e.stop();this.host.forgetRemote(this)}}detached(){if(this.status!==`released`&&this.status!==`gone`){this.binding=void 0;for(let e of this.#e.values())e.detach();this.status===`live`&&(this.status=`loading`,this.#r=this.#c(),this.#a())}}member(e){let t=Object.values(this.contract.description.variants).map(t=>t[e]).find(e=>e!==void 0);if(t?.kind===`method`)return this.#o(e);if(t?.kind===`state`){let t=this.#e.get(e);return t===void 0&&(t=new Sk(this,e),this.#e.set(e,t)),t}}#o(e){let t=this.#t.get(e);return t===void 0&&(t=(t,n)=>{if(this.host.inFactory>0)throw new N(`not_ready`,`${this.address}.${e} called inside a factory`);if(n instanceof jO)try{n.check(n.host)}catch(e){return Promise.reject(e)}return n===void 0||n instanceof jO&&n.holder?this.host.root(n=>this.#s(e,t,n),{signal:n?.signal}):this.#s(e,t,n)},this.#t.set(e,t)),t}async#s(e,t,n){for(;;){if(this.status===`released`||this.status===`gone`)throw this.status===`gone`?this.error:new N(`released`,`handle ${this.address} released`);this.status===`loading`&&await MO(this.#r.promise,n.signal);let r=this.binding;if(r===void 0)continue;let i=this.shape?.kind;if(i===void 0||this.contract.description.variants[i]?.[e]?.kind!==`method`)throw new N(`not_in_variant`,`${this.address}: ${e} is not a method of variant ${i}`);let a=this.contract.description.variants[i]?.[e],o=a?.kind===`method`?YC(a.args,BC(t)):t;return r.channel.call(r.id,e,o,{rootId:n.rootId,epoch:n.epoch},n.signal)}}#c(){let e=xk,t=xk,n=new Promise((n,r)=>{e=n,t=r});return n.catch(xk),{promise:n,resolve:e,reject:t}}},wk=Object.freeze({host:!0}),Tk=e=>typeof e==`object`&&!(e instanceof URL),Ek=new Map;function Dk(e={}){return new Ok(e)}var Ok=class{name;dev;principal=wk;inFactory=0;failed;records=new Map;epochs=new Map;facets=new Map;eager=new Map;kind;connections=new Set;upstream;remotes=new Set;#e=new Map;#t=new pk(this);remoteModules={};remoteRemoved={};#n=0;#r=new Map;#i=new Set;#a=Math.random().toString(36).slice(2,8);#o=new Map;current;previous;pending;gating;reloading=!1;retired=()=>{};#s;#c;#l;#u=new Map;#d=new Map;#f=new Map;#p=new Map;#m=1;#h=0;constructor(e){this.name=e.name??`host`,this.dev=e.dev??!1,this.#s=e.principalKey??cw,this.#c=e.onError??(e=>console.error(`chord:`,e)),this.#l=e.loader,this.current={id:this.#m,services:new Map,tables:new Map,roots:new Map},this.epochs.set(this.current.id,this.current),this.kind=e.kind??`host`,e.upstream!==void 0&&this.connect(e.upstream,e.upstreamOptions)}get epoch(){return this.current.id}get previousEpoch(){return this.previous?.id}nextEpochId(e){if(e!==void 0&&e<=this.current.id)throw Error(`epoch ${e} is not newer than ${this.current.id}`);return this.#m=e??this.#m+1,this.#m}report(e){this.#c(e)}serve=((e,t,n={})=>{if(this.reloading)throw Error(`host.serve during a reload; serve from a facet passed to reload()`);this.serveInto(this.current.services,wO(e,t,n,``)),n.eager&&this.startEager(this.current.services.get(e.name))});install(e,t={}){if(this.reloading)throw Error(`host.install during a reload`);if(this.facets.has(e.name))throw Error(`facet ${e.name} is already installed; use reload()`);let n=[];e.setup(this.facetApi(((t,r,i={})=>{let a=wO(t,r,i,e.name);this.serveInto(this.current.services,a),n.push(a)}))),this.facets.set(e.name,e);let r=n.filter(e=>e.options.eager).map(e=>this.startEager(e));return t.awaitEager===!1?Promise.resolve():this.#g(r)}async load(e,t={}){let n=await this.resolve(e);await Promise.all(n.map(e=>this.install(e,t)))}ready(){return this.#g(this.eager.values())}#g(e){let t=Promise.all([...e].map(e=>e.ready)).then(()=>{});return t.catch(()=>{}),t}async resolve(e){let t=e.filter(e=>!Tk(e));if(t.length>0&&this.#l===void 0)throw Error(`loading modules needs createHost({ loader }), e.g. nodeLoader from @earendil-works/chord/node`);let n=t.length>0&&this.#l!==void 0?await this.#l(t):[];return e.map(e=>Tk(e)?e:n.shift())}facetApi(e){return{serve:e,name:this.name,root:(e,t)=>this.root(e,t),registry:e=>this.registry(e)}}serveInto(e,t){if(e.has(t.contract.name))throw Error(`${t.contract.name} is already served`);e.set(t.contract.name,t)}startEager(e){let t=e.options.eager,n=typeof t==`object`?t.input:{},r=this.acquire(e.contract,n,void 0,`host`);return this.eager.set(e.contract.name,r),r.ready.catch(e=>this.report(e)),r}currentEpoch(){return this.current.id}hasEpoch(e){return this.epochs.has(e)}*retainedEpochs(){for(let[e,t]of this.epochs)yield[e,t.services];this.pending!==void 0&&(yield[this.pending.id,this.pending.services])}pendingEpoch(){return this.pending?.id}service(e){return this.current.services.get(e)??this.pending?.services.get(e)}addressOf(e,t,n,r,i=!1){if(r!==void 0&&r!==this.name)return Mk(r,e,t,n===this.principal?void 0:n);let a=this.#v(e.name,i);if(a===void 0)throw Nk(e.name,this.name);let o=fw(a.contract.input,t,`${e.name} input`);return this.#_(a,o,n)}#_(e,t,n){let r=n===this.principal?`host`:`p:${this.#s(n)}`;return`${e.contract.name}\u0000${pw(e.contract.input,t)}\u0000${r}`}acquire(e,t,n,r,i,a=!1){if(n?.at!==void 0&&n.at!==this.name)return this.#x(e,t,n,r);let o=this.#v(e.name,a);if(o===void 0)throw Nk(e.name,this.name);Nw(o.contract,o.options.accepts,e);let s=n?.principal??this.principal,c=fw(o.contract.input,t,`${e.name} input`),l=this.#_(o,c,s),u=this.records.get(l);if(i!==void 0&&u!==void 0&&(u===i||Pk(u,i)))throw Pi(`cycle`,`${i.address} -> ${l} would create a hold cycle`);if(u===void 0){if(this.gating?.has(e.name))throw new N(`upgrade_conflict`,`${e.name} is being upgraded; retry`,{reason:`gate`});let t=this.#u.get(l);t?.status===`disposed`&&this.#u.delete(l),u=new VO(this,{address:l,typeName:e.name,input:c,principal:s,eager:o.options.eager!==void 0&&o.options.eager!==!1&&s===this.principal}),this.records.set(l,u),u.start(t?.status===`disposing`?t.dispose(!1):void 0)}let d=new RO(u,e,r);return u.addHold(d),d}forget(e){this.records.get(e.address)===e&&this.records.delete(e.address),e.status===`disposing`&&this.#u.set(e.address,e)}touch(e,t){let n=this.#d.get(e);n===void 0&&(n=new Set,this.#d.set(e,n)),n.add(t)}async root(e,t={}){let n=`${this.name}#${this.#a}:${++this.#h}`;return this.#i.add(n),this.joinRoot(n,t.epoch??this.current.id,e,t)}async joinRoot(e,t,n,r={}){let i=this.epochs.get(t);if(i===void 0)throw this.#i.delete(e),new N(`superseded`,`epoch ${t} is not retained by ${this.name}`);if(r.from!==void 0&&!this.#i.has(e)){let t=this.#r.get(e);t===void 0&&(t=new Set,this.#r.set(e,t)),t.add(r.from)}i.roots.set(e,(i.roots.get(e)??0)+1);let a=new jO(this,{signal:r.signal??new AbortController().signal,rootId:e,epoch:i.id,principal:r.principal??this.principal});try{return await n(a)}finally{a.close();let t=(i.roots.get(e)??1)-1;t>0?i.roots.set(e,t):(i.roots.delete(e),this.#r.has(e)||this.endRoot(e),this.maybeRetire())}}rootSent(e,t){let n=this.#o.get(e);n===void 0&&(n=new Set,this.#o.set(e,n)),n.add(t)}endRoot(e){this.#i.delete(e),this.#r.delete(e);for(let t of this.#d.get(e)??[])t.rootEnded(e);this.#d.delete(e);for(let t of this.#o.get(e)??[])t.send({t:`root_end`,rootId:e});this.#o.delete(e)}foreignRootEnded(e,t){let n=this.#r.get(e);n===void 0||!n.delete(t)||n.size>0||([...this.epochs.values()].some(t=>t.roots.has(e))?this.#r.delete(e):this.endRoot(e))}maybeRetire(){let e=this.previous;e===void 0||e.roots.size>0||this.kind!==`client`&&this.upstream!==void 0&&e.id>this.#n||this.retire()}allowRetire(e){this.#n=Math.max(this.#n,e),this.maybeRetire()}retire(){let e=this.previous;if(e!==void 0){this.previous=void 0,this.epochs.delete(e.id);for(let t of[...this.records.values()])this.retireBehavior(t,e.id);for(let t of this.connections)t.role===`downstream`&&t.peer?.kind===`host`&&t.send({t:`retire`,epoch:e.id});this.retired()}}retireBehavior(e,t){let n=e.behaviors.get(t);if(e.behaviors.delete(t),n===void 0||n.decls===e.decls)return;let r=e.allDecls(),i=e=>new Set([...r].flatMap(t=>[...e(t)])),a=i(e=>e.holds.values()),o=i(e=>e.resources.values()),s=i(e=>e.derives.values());for(let e of n.decls.derives.values())s.has(e)||e.detach();let c=[...n.decls.resources.values()].filter(e=>!o.has(e)).sort((t,n)=>e.openOrder.indexOf(n)-e.openOrder.indexOf(t)),l=[...n.decls.holds.values()].filter(e=>!a.has(e));e.refreshSchemas(),Ii([...c.map(t=>()=>t.close(e.openOrder)),...l.map(e=>()=>e.release())],`${e.address}: retiring epoch ${t} failed`).catch(e=>this.report(e))}registry(e){let t=t=>{let n=t===void 0?this.current:this.epochs.get(t.epoch);if(n===void 0)throw new N(`superseded`,`epoch ${t?.epoch} is retired`);return n.tables.get(e.name)??Ek};return{table:t,get:(e,n)=>t(n).get(e),subscribe:n=>{let r=this.#p.get(e.name);r===void 0&&(r=new Set,this.#p.set(e.name,r));let i=n;return r.add(i),i(t(),this.current.id),()=>r.delete(i)}}}buildTables(e){let t=new Map;for(let[n,r]of e)for(let{registry:e,key:i,value:a}of r.registrations.values()){let r=t.get(e.name);r===void 0&&(r=new Map,t.set(e.name,r));let o=r.get(i);if(o!==void 0&&o.record!==n&&e.conflict===`error`)throw Pi(`registry_conflict`,`${e.name}: ${i} registered by ${o.record.address} and ${n.address}`);r.set(i,{value:a,record:n});let s=this.#f.get(e.name);s===void 0&&(s=new Map,this.#f.set(e.name,s)),s.has(i)||s.set(i,s.size)}let n=new Map;for(let[e,r]of t){let t=this.#f.get(e),i=[...r].sort(([e],[n])=>t.get(e)-t.get(n));n.set(e,new Map(i.map(([e,t])=>[e,t.value])))}return n}#v(e,t){return(t?this.pending?.services.get(e):void 0)??this.service(e)}liveDecls(e=!1){return[...this.records.values()].filter(t=>t.status===`live`&&(e||!t.deferredRuntime)).map(e=>[e,e.decls])}checkRegistrations(e,t){t.registrations.size!==0&&this.buildTables([...this.liveDecls().filter(([t])=>t!==e),[e,t]])}registriesChanged(e){let t=this.liveDecls().filter(([t])=>t!==e);e!==void 0&&t.push([e,e.decls]),this.installTables(this.current,this.buildTables(t))}fail(e){this.failed??=e,this.report(e)}installTables(e,t,n=!1){let r=e.tables;if(e.tables=t,e===this.current)for(let[i,a]of this.#p){let o=t.get(i)??Ek;if(!n&&Ak(r.get(i)??Ek,o))continue;let s=[...a];zw(()=>{for(let t of s)try{t(o,e.id)}catch(e){this.report(e)}})}}get(e,t,n){return this.acquire(e,t,n,`external`).proxy}async invalidatePrincipal(e){let t=typeof e==`function`?e:t=>jk(e,t),n=new N(`gone`,`principal invalidated`);for(let e of[...this.connections])e.role===`downstream`&&t(e.principal)&&e.revoke(e.restamp?.(e.principal));if(typeof e!=`function`)for(let t of this.connections)t.role===`downstream`&&t.peer.kind===`host`&&t.send({t:`invalidate`,pattern:e});await kk([...this.records.values()].filter(e=>e.principal!==this.principal&&t(e.principal)),n,`invalidatePrincipal: disposal failed`)}accept(e,t){let n=t.kind??`client`;if(n===`host`&&t.name===void 0)throw TypeError(`accepting a host link needs its name`);this.#y(e,{...t,role:`downstream`,principal:t.principal,peer:{kind:n,name:n===`host`?t.name:void 0}})}connect(e,t={}){this.upstream?.open&&this.upstream.link.close(`replaced`);let n=this.#y(e,{...t,role:`upstream`,principal:void 0,peer:{kind:`host`,name:void 0}});this.upstream=n;for(let e of this.remotes)e.binding===void 0&&n.hold(e)}#y(e,t){let n=new _k(this,e,t);return this.connections.add(n),n}route(e,t){this.#e.set(e,t)}peerHello(e,t){t===this.current.id?e.markSynced(t):t>this.current.id?(this.report(new N(`invalid`,`${e.name} runs epoch ${t}, ahead of ${this.current.id}`)),e.link.close(`epoch ahead of parent`)):(e.peerEpoch=t,e.fencedEpochs.add(t),fk(this,e).catch(t=>{this.report(t),e.link.close(`reconciliation failed`)}))}connectionClosed(e){this.connections.delete(e);for(let[t,n]of[...this.#r])n.has(e)&&this.foreignRootEnded(t,e);for(let t of this.#o.values())t.delete(e);this.upstream===e&&(this.upstream=void 0,this.#t.parentLost())}forgetRemote(e){this.remotes.delete(e)}#b(e){return[...this.connections].find(t=>t.role===`downstream`&&t.peer.kind===`host`&&t.peer.name===e)}#x(e,t,n,r){let i=n.at;if(e.scope!==`remote`)throw Pi(`local`,`${e.name} is local and cannot be reached at ${i}`);let a=n.principal===void 0||n.principal===this.principal?void 0:n.principal,o=new Ck(this,{contract:e,at:i,input:t,principal:a,owner:r,address:Mk(i,e,t,a)});this.remotes.add(o);let s=e=>{e.then(e=>{o.status===`loading`&&o.binding===void 0&&e.hold(o)},e=>o.gone(e))},c=this.#b(i);if(this.upstream!==void 0)this.upstream.hold(o);else if(c!==void 0)s(c.whenSynced().then(()=>c));else{let e=this.#S(i);e===void 0?o.gone(new N(`unavailable`,`no route to ${i}`)):s(this.#C(e,i,a??this.principal))}return o}#S(e){let t;for(let n of this.#e)e.startsWith(n[0])&&(t===void 0||n[0].length>t[0].length)&&(t=n);return t?.[1]}async#C(e,t,n,r=()=>!0){let i=()=>new N(`forbidden`,`${t} refused for this principal`),a=()=>new N(`gone`,`principal invalidated while resolving`);if(!await e.authorize(n,t))throw i();if(!r())throw a();let o=await e.resolve(t);if(!r())throw a();if(!await e.authorize(n,t))throw i();if(!r())throw a();let s=[...this.connections].find(e=>e.link===o);if(s??=this.#y(o,{role:`downstream`,principal:e.principal?.(t)??{host:t},peer:{kind:`host`,name:t}}),await s.whenSynced(),!r())throw a();return s}async relay(e){let t=e.frame.at,n=this.#S(t);if(n===void 0)throw this.#b(t)===void 0?new N(`unavailable`,`no route to ${t}`):new N(`forbidden`,`no route authorizes ${t}`);let r=await this.#C(n,t,e.principal,()=>e.current);e.current&&e.open(r)}reload(e,t={}){return this.kind!==`client`&&this.upstream!==void 0?Promise.reject(new N(`unavailable`,`reloads are coordinated by the server`,{reason:`not_coordinator`})):[...this.connections].some(e=>e.role===`downstream`&&e.peer.kind===`host`)||t.remote!==void 0||t.remoteRemove!==void 0?dk(this,e,t):YO(this,e,t)}onReloadFrame(e,t){this.#t.handle(e,t)}rememberRemoteModules(e,t){for(let n of new Set([...Object.keys(e??{}),...Object.keys(t??{})])){let r=e?.[n]??[],i=t?.[n]??[];this.remoteModules[n]=[...new Set([...this.remoteModules[n]??[],...r])].filter(e=>!i.includes(e)),this.remoteRemoved[n]=[...new Set([...this.remoteRemoved[n]??[],...i])].filter(e=>!r.includes(e))}}peekNextEpoch(){return this.#m+1}async close(){this.eager.clear();let e=new N(`gone`,`host ${this.name} closed`);try{await kk([...this.records.values()],e,`host close: disposal failed`)}finally{for(let e of[...this.connections])e.link.close(`host closed`)}}};async function kk(e,t,n){let r=new Set(e),i=e=>{let t=new Set;for(let n of e.allDecls())for(let e of n.holds.values())e.record!==void 0&&t.add(e.record);return t},a=new Map(e.map(e=>[e,i(e)])),o=[];for(;r.size>0;){let e=new Set;for(let t of r)for(let n of a.get(t)??[])e.add(n);let n=[...r].filter(t=>!e.has(t));n.length===0&&(n=[...r]);for(let e of n)r.delete(e);let i=await Promise.allSettled(n.map(e=>e.dispose(!0,t)));for(let e of i)e.status===`rejected`&&o.push(e.reason)}if(o.length===1)throw o[0];if(o.length>1)throw AggregateError(o,n)}function Ak(e,t){if(e.size!==t.size)return!1;let n=[...e.keys()];return[...t].every(([t,r],i)=>n[i]===t&&e.get(t)===r)}var jk=(e,t)=>typeof t==`object`&&!!t&&Object.entries(e).every(([e,n])=>uw(t[e],n)),Mk=(e,t,n,r)=>`@${e}\u0000${t.name}\u0000${cw(n)}\u0000${r===void 0?`host`:cw(r)}`,Nk=(e,t)=>new N(`unavailable`,`${e} is not served by ${t}`,{reason:`unknown_type`});function Pk(e,t){let n=new Set,r=[e];for(;r.length>0;){let e=r.pop();if(e===t)return!0;if(!n.has(e)){n.add(e);for(let t of e.allDecls())for(let e of t.holds.values())e.record!==void 0&&r.push(e.record)}}return!1}var Fk=class{#e;#t=[];#n=new Set;#r=!1;get closed(){return this.#r}send(e){this.#r||this.transmit(e)}receive(e){this.#e=e;for(let t of this.#t.splice(0))e(t)}onClose(e){this.#r?e(`closed`):this.#n.add(e)}close(e=`closed`){if(!this.#r){try{this.transmit({t:`bye`,reason:e})}catch{}this.ended(e)}}deliver(e){this.#r||(e.t===`bye`?this.ended(e.reason??`peer closed`):this.#e===void 0?this.#t.push(e):this.#e(e))}ended(e){if(!this.#r){this.#r=!0,this.#t=[];try{this.shutdown()}finally{for(let t of this.#n)t(e);this.#n.clear()}}}};function Ik(e){let t=JSON.parse(e);if(typeof t!=`object`||!t||typeof t.t!=`string`)throw TypeError(`not a frame`);return t}var Lk=1,Rk=class extends Fk{#e;#t=[];constructor(e){super(),this.#e=e,e.addEventListener(`open`,()=>{for(let t of this.#t.splice(0))e.send(t)}),e.addEventListener(`message`,e=>{try{this.deliver(Ik(typeof e.data==`string`?e.data:String(e.data)))}catch{this.close(`protocol error`)}}),e.addEventListener(`close`,()=>this.ended(`socket closed`))}transmit(e){let t=JSON.stringify(e);this.#e.readyState===Lk?this.#e.send(t):this.#t.push(t)}shutdown(){this.#t=[],this.#e.readyState<=Lk&&this.#e.close(1e3)}},zk=e=>new Rk(e),Bk=(e,t)=>[e,t];function Vk(e,t){let n=Object.fromEntries(Object.entries(t.variants).map(([e,t])=>[e,{...t,methods:Object.fromEntries(Object.entries(t.methods??{}).map(([e,[t,n]])=>[e,Tw(t,n)]))}]));return Aw(e,{...t,variants:n})}var Z=im(),Hk=em(),Uk=Bp(),Q=Zp(),$=Up({minimum:0,maximum:2**53-1}),Wk=q([Z,Q]),Gk=kp([`pending`,`running`,`done`]),Kk=kp([`project`,`user`,`builtin`]),qk=kp([`off`,`minimal`,`low`,`medium`,`high`,`xhigh`,`max`]),Jk=G({provider:Z,modelId:Z}),Yk=G({model:W(Jk),thinkingLevel:W(qk)},{additionalProperties:!1}),Xk=G({input:Hk,output:Hk,cacheRead:Hk,cacheWrite:Hk,cost:Hk}),Zk=G({name:Z,mimeType:Z,width:$,height:$,bytes:$,entryId:$,contentIndex:$}),Qk=G({name:Z,location:Z,body:Z,args:Z}),$k=G({callId:Z,name:Z,summary:Z,detail:Wk,phase:Gk,output:Wk,diff:Wk,diffAdded:q([Hk,Q]),diffRemoved:q([Hk,Q]),diffTruncated:W(Uk)}),eA=G({parentId:$,agentId:W(Z),round:W($),runnerId:W($),inputEntryId:W($),answerEntryId:W($),roundUsage:W(q([Xk,Q])),taskId:$,callId:Z,childId:$,role:kp([`explore`,`plan`,`coder`]),title:Z,createdAt:Hk,startedAt:q([Hk,Q]),endedAt:q([Hk,Q]),status:kp([`queued`,`running`,`completed`,`failed`,`cancelled`]),report:Wk,approvalCount:W($),historyThrough:W($),historyUsage:W(Xk)}),tA=G({agentId:Z,parentId:$,childId:$,role:kp([`explore`,`plan`,`coder`]),title:Z,status:kp([`idle`,`queued`,`running`]),activeRoundId:q([$,Q]),lastRoundId:$,lastReport:W(Wk),roundCount:$,taskTitle:Z,approvalCount:$,createdAt:Hk,historyThrough:W($),historyUsage:W(Xk)}),nA=G({jobId:Z,title:Z,command:Z,cwd:Z,status:kp([`running`,`exited`,`failed`,`stopped`,`lost`]),startedAt:Hk,endedAt:q([Hk,Q]),exitCode:q([Hk,Q]),reason:W(kp([`timeout`,`spawn-error`,`restart`,`aborted`])),timeoutSeconds:W(Hk),outputBytes:$}),rA=G({job:nA,text:Z,offset:$,truncated:Uk,dropped:$}),iA=G({historyBefore:W(q([$,Q])),agents:W(qf(tA)),jobs:W(qf(nA)),rounds:W(qf(eA)),subagents:W(qf(eA)),taskUsage:W(Xk),model:Z,agent:G({model:q([Jk,Q]),thinkingLevel:q([qk,Q])}),cwd:Z,busy:Uk,status:Wk,usage:Xk,contextUsage:W(G({tokens:q([Hk,Q]),window:Hk,percent:q([Hk,Q])})),compaction:W(G({failure:W(G({taskId:$,reason:kp([`manual`,`threshold`,`overflow`]),error:Z})),active:qf(G({taskId:$,reason:kp([`manual`,`threshold`,`overflow`]),blocking:Uk,attempt:$,retry:W(G({at:Hk,error:Z}))})),latest:q([Q,G({taskId:$,phase:kp([`summarizing`,`waiting-to-apply`,`applied`,`nothing`,`skipped`,`cancelled`,`failed`]),at:Hk})])})),items:qf(q([G({type:K(`user`),order:W(Hk),key:Z,id:$,text:Z,images:W(qf(Zk)),skill:W(Qk),defaultImagePrompt:W(G({version:Up({minimum:1}),text:Z}))}),G({type:K(`assistant`),order:W(Hk),key:Z,id:$,thinking:Z,text:Z,stopReason:Wk,errorMessage:Wk,note:Wk}),G({type:K(`tool`),order:W(Hk),key:Z,images:W(qf(Zk)),callId:Z,name:Z,summary:Z,detail:Wk,phase:Gk,isError:Uk,output:Wk,result:Wk,durationMs:q([Hk,Q]),note:Wk,diff:Wk,diffAdded:q([Hk,Q]),diffRemoved:q([Hk,Q]),diffTruncated:W(Uk)}),G({type:K(`system`),order:W(Hk),key:Z,id:$,text:Z,jobId:W(Z)})])),streaming:q([Q,G({thinking:Z,text:Z,toolCalls:qf($k)})])}),aA=G({workspaceRoot:Z,lastUsedAt:Hk,title:Z,firstPromptPreview:Z,createdAt:Hk,lastMessageAt:q([Hk,Q]),model:q([Jk,Q]),status:kp([`idle`,`running`,`error`]),id:Z}),oA=G({revision:$,sessions:qf(aA)}),sA=G({path:Z,createdAt:Hk}),cA=G({revision:$,workspaces:qf(sA)}),lA=G({savedConfigured:Uk,environmentConfigured:Uk,source:kp([`saved`,`environment`,`runtime`,`keyless`,`none`])}),uA=G({revision:$,statuses:G({deepseek:lA,tavily:lA})}),dA=G({sessionId:Z,attachmentId:Z}),fA=G({sessionId:Z,attachmentId:Z},{additionalProperties:!1}),pA=Vk(`neko.session-directory`,{version:1,input:G({},{additionalProperties:!1}),variants:{ready:{state:{state:oA}}}}),mA=Vk(`neko.session-management`,{version:1,input:G({},{additionalProperties:!1}),variants:{ready:{methods:{create:Bk(G({...Yk.properties,cwd:W(Z)},{additionalProperties:!1}),aA),archive:Bk(Z,Q),attach:Bk(Z,dA),detach:Bk(Q,Q),fork:Bk(Z,aA)}}}}),hA=G({maxWidth:W($),maxHeight:W($),maxBytes:W($),jpegQuality:W($)}),gA=G({maxRequestBytes:W($),images:W(G({resize:W(hA),maxPerMessage:W($),maxPerRequest:W($)}))}),_A=G({provider:Z,modelId:Z,name:Z,contextWindow:Hk,input:qf(Z),inputLimits:W(gA),reasoning:Uk,supportedThinkingLevels:qf(qk),thinkingLevelAdjustments:G({off:qk,minimal:qk,low:qk,medium:qk,high:qk,xhigh:qk,max:qk})}),vA=Vk(`neko.models`,{version:1,input:G({},{additionalProperties:!1}),variants:{ready:{methods:{list:Bk(Q,qf(_A))}}}}),yA=G({data:Z,total:$,mimeType:Z}),bA=Vk(`neko.subagent`,{version:1,input:G({sessionId:Z,attachmentId:Z,taskId:W($),agentId:W(Z)}),variants:{ready:{state:{revision:$},methods:{chunk:Bk(G({kind:kp([`view`,`history`]),before:W($),token:W($),offset:$}),G({token:$,data:Z,next:q([$,Q])})),getImage:Bk(G({entryId:$,contentIndex:$,offset:$}),yA),decideApproval:Bk(G({id:$,version:Z,decision:kp([`allowed`,`denied`])}),kp([`pending`,`allowed`,`denied`,`cancelled`])),stop:Bk(q([Q,G({taskId:$})]),Q)}}}}),xA=Vk(`neko.chat`,{version:1,input:fA,variants:{ready:{state:{view:iA},methods:{submit:Bk(G({content:Z,images:W(qf(Z,{maxItems:4})),requestId:W(Z),whenBusy:W(kp([`steer`,`followUp`]))},{additionalProperties:!1}),Q),abort:Bk(Q,Q),usage:Bk(Q,Xk),skills:Bk(Q,qf(G({name:Z,description:Z,location:Z,level:Kk}))),jobOutput:Bk(G({jobId:Z,since:W($)},{additionalProperties:!1}),rA),jobStop:Bk(G({jobId:Z},{additionalProperties:!1}),nA),configure:Bk(Yk,Q),compact:Bk(G({instructions:W(Z)},{additionalProperties:!1}),Q),importImage:Bk(Z,G({id:Z,name:Z})),draftImage:Bk(G({id:Z,offset:$},{additionalProperties:!1}),yA),beginImage:Bk(G({name:Z,mimeType:Z,size:Up({minimum:1,maximum:20971520})},{additionalProperties:!1}),Z),appendImage:Bk(G({id:Z,offset:$,data:im({maxLength:35e4})},{additionalProperties:!1}),Q),finishImage:Bk(Z,Q),releaseImage:Bk(Z,Q),getImage:Bk(G({entryId:$,contentIndex:$,offset:$},{additionalProperties:!1}),yA)}}}}),SA=G({path:Z,query:W(Z),showHidden:W(Uk),cursor:W(Z)},{additionalProperties:!1}),CA=G({path:Z,parent:Wk,entries:qf(G({name:Z,path:Z,error:W(Z)})),next:Wk}),wA=Vk(`neko.workspaces`,{version:1,input:G({},{additionalProperties:!1}),variants:{ready:{state:{state:cA},methods:{add:Bk(G({path:Z},{additionalProperties:!1}),sA),browse:Bk(SA,CA)}}}}),TA=kp([`deepseek`,`tavily`]),EA=Vk(`neko.credentials`,{version:1,input:G({},{additionalProperties:!1}),variants:{ready:{state:{state:uA},methods:{save:Bk(G({provider:TA,key:im({minLength:1,maxLength:8192})},{additionalProperties:!1}),Q),remove:Bk(G({provider:TA},{additionalProperties:!1}),Q)}}}}),DA=G({entries:qf(G({name:Z,path:Z,kind:kp([`file`,`directory`])}),{maxItems:100}),limited:Uk,incomplete:Uk}),OA=Vk(`neko.workspace-files`,{version:1,input:G({},{additionalProperties:!1}),variants:{ready:{methods:{search:Bk(G({workspaceRoot:Z,query:Z},{additionalProperties:!1}),DA)}}}}),kA=G({name:Z,description:Z,category:Z,source:Z,license:Z,version:Z,sha256:Z,sizeBytes:$,uploadedAt:Z,installed:G({project:Uk,user:Uk,builtin:Uk}),activeLevel:q([Kk,Q])}),AA=G({body:Z,files:qf(Z)}),jA=kp([`user`,`project`]),MA=G({name:Z,scope:jA,path:Z,shadowedBy:W(jA)}),NA=Vk(`neko.skill-market`,{version:1,input:G({},{additionalProperties:!1}),variants:{ready:{methods:{list:Bk(G({query:W(Z),workspaceRoot:W(Z)},{additionalProperties:!1}),qf(kA)),detail:Bk(G({name:Z,workspaceRoot:W(Z)},{additionalProperties:!1}),kA),preview:Bk(G({name:Z},{additionalProperties:!1}),AA),install:Bk(G({name:Z,scope:jA,workspaceRoot:W(Z),overwrite:W(Uk)},{additionalProperties:!1}),MA),uninstall:Bk(G({name:Z,scope:jA,workspaceRoot:W(Z)},{additionalProperties:!1}),Q)}}}}),PA=G({runningVersion:Z,installedVersion:Wk,protocolVersion:Up({minimum:1}),latestVersion:Wk,checkedAt:q([$,Q]),checkState:kp([`unknown`,`checking`,`ok`,`failed`,`development`])}),FA=Vk(`neko.application-info`,{version:1,input:G({}),variants:{ready:{state:{info:PA},methods:{check:Bk(Q,PA)}}}}),IA=16777216,LA=e=>new TextEncoder().encode(e).byteLength;function RA(e,t=IA){let n=0,r=0,i=!1,a;return a=zk({get readyState(){return e.readyState},send(n){if(LA(n)+e.bufferedAmount>t)throw e.close(1009,`byte limit`),Error(`Link pending byte limit exceeded`);e.send(n)},close:(t,n)=>e.close(t,n),addEventListener(o,s){o===`message`?e.addEventListener(`message`,e=>{let n=LA(String(e.data));i||(r+=n),n>t||r>t?a.close(`frame limit exceeded`):s(e)}):e.addEventListener(o,()=>{o===`open`&&(n=0);try{s()}catch{a.close(`socket error`)}})}}),e.addEventListener(`error`,()=>a.close(`socket error`)),{get closed(){return a.closed},send(r){if(a.closed)return;if(e.readyState>1){a.close(`socket closed`);return}let i=LA(JSON.stringify(r));if(i>t||i+e.bufferedAmount+n>t)throw a.close(`pending byte limit exceeded`),Error(`Link byte limit exceeded`);e.readyState===0&&(n+=i),a.send(r)},receive(e){i=!0,r=0,a.receive(e)},onClose:e=>a.onClose(e),close:e=>a.close(e)}}function zA(e,t){let n,r=!1,i=0,a=[];return e.receive(o=>{if(!r){if(o.t!==`hello`||o.name!==t){e.close(`serverId mismatch`);return}r=!0}if(n)n(o);else{if(i+=LA(JSON.stringify(o)),i>16777216){e.close(`receive queue limit exceeded`),a.length=0;return}a.push(o)}}),{get closed(){return e.closed},send:t=>e.send(t),receive(t){n=t,i=0;for(let n of a.splice(0)){if(e.closed)break;t(n)}},onClose:t=>e.onClose(t),close:t=>e.close(t)}}function BA(e){let t,n,r,i,a=()=>(n||(n=e(),i=n.onStatus((e,n)=>{if(e===`gone`){r=String(n??`Subagent unavailable`);for(let e of s)e(t)}})),n),o=()=>{i?.(),i=void 0,n?.release(),n=void 0},s=new Set,c,l=0,u=0,d=!1;async function f(e,t,n=()=>!0){let r,i=0,o=[];for(;;){if(!n())throw Error(`Transcript subscription closed`);let s=await a().chunk({kind:e,before:t,token:r,offset:i});if(!n())throw Error(`Transcript subscription closed`);if(o.push(s.data),r=s.token,s.next===null)return JSON.parse(o.join(``));i=s.next}}let p=async()=>{if(d||!s.size||!u)return;d=!0;let e=l,n=0;try{do{n=u;try{let n=await f(`view`,void 0,()=>l===e&&s.size>0);if(l!==e)return;r=void 0,t=n;for(let e of s)e(t)}catch(i){if(l!==e)return;if(u===n){r=String(i);for(let e of s)e(t)}}}while(u!==n)}finally{d=!1,l!==e&&s.size&&p()}};return{get error(){return r},view:{get value(){return t},subscribe(e){return s.add(e),e(t),c||=a().revision.subscribe(e=>{u=e??0,p()}),()=>{s.delete(e),s.size||(l++,c?.(),c=void 0,o())}}},history:async e=>{let t=l;try{return await f(`history`,e.before,()=>t===l)}finally{s.size||o()}},getImage:async(e,t)=>{try{return await a().getImage(e,t)}finally{s.size||o()}},decideApproval:async(e,t)=>{try{return await a().decideApproval(e,t)}finally{s.size||o()}},stop:async(e,t)=>{try{return await a().stop(e,t)}finally{s.size||o()}}}}var VA=class{#e=new Map;#t;#n;constructor(e,t){this.#t=e,this.#n=t}get pending(){return[...this.#e.values()].flatMap(({service:e,title:t})=>(e.view.value?.approvals??[]).filter(e=>e.status===`pending`).map(n=>({item:n,title:t,service:e}))).sort((e,t)=>e.item.createdAt-t.item.createdAt||e.item.id-t.item.id)}get error(){return[...this.#e.values()].find(({service:e})=>e.error)?.service.error}update(e){let t=e.filter(e=>e.approvalCount&&e.historyThrough===void 0);for(let[e,n]of this.#e)t.some(t=>(t.agentId??t.taskId)===e)||(this.#e.delete(e),n.stop());for(let e of t){let t=e.agentId??e.taskId;if(this.#e.has(t))continue;let n=this.#t(t),r={service:n,title:e.title,stop:()=>{}};this.#e.set(t,r),r.stop=n.view.subscribe(()=>this.#n())}this.#n()}close(){for(let e of this.#e.values())e.stop();this.#e.clear(),this.#n()}};function HA(e,t){return new Promise((n,r)=>{let i=()=>{},a=!1,o=(e,o)=>{a||(a=!0,clearTimeout(c),i(),t?.removeEventListener(`abort`,s),e?r(e):n(o))},s=()=>o(t?.reason??Error(`Cancelled`)),c=setTimeout(()=>o(Error(`Timed out waiting for first snapshot`)),5e3);i=e.subscribe(e=>{e!==void 0&&o(void 0,e)}),a&&i(),t?.addEventListener(`abort`,s,{once:!0}),t?.aborted&&s()})}var UA=`This gateway does not support background jobs. Restart the gateway to enable them.`;function WA(e){let t=()=>e.view.value?.jobs!==void 0,n=()=>{if(!t())throw Error(UA)};return{get supported(){return t()},list:()=>e.view.value?.jobs??[],async output(t,r){return n(),e.jobOutput({jobId:t,...r===void 0?{}:{since:r}})},async stop(t){return n(),e.jobStop({jobId:t})}}}function GA(e,t){let n=Dk({kind:`client`,upstream:zA(e,t),onError:()=>{}}),r=e=>n.get(e,{},{at:t}),i=r(FA),a=[i.info.subscribe(()=>{})],o,s=!1;function c(){let e=r(pA),t=r(mA),n=r(vA),i=r(wA),o=r(OA),s=r(EA),c=r(NA);return a.push(e.state.subscribe(()=>{}),i.state.subscribe(()=>{}),s.state.subscribe(()=>{})),{directory:e,management:t,models:n,workspaces:i,workspaceFiles:o,credentials:s,skillMarket:c}}let l=()=>{if(!s)throw Error(`Gateway protocol not checked`);return o||=c(),o},u,d,f,p=!1,m,h={application:i,subagent(e){if(!d)throw Error(`No active session`);let r={...d,...typeof e==`string`?{agentId:e}:{taskId:e}};return BA(()=>n.get(bA,r,{at:t}))},host:n,link:e,get directory(){return l().directory},get management(){return l().management},get models(){return l().models},get workspaces(){return l().workspaces},get workspaceFiles(){return l().workspaceFiles},get credentials(){return l().credentials},get skillMarket(){return l().skillMarket},get attachment(){return d},async ready(e){if(await KA(i.ready,e),(await HA(i.info,e)).protocolVersion!==4)throw new xi;s=!0;let{directory:t,management:n,models:r,workspaces:a,credentials:o,workspaceFiles:c,skillMarket:u}=l();await KA(Promise.all([t.ready,n.ready,r.ready,a.ready,o.ready,c.ready,u.ready]),e),await Promise.all([HA(t.state,e),HA(a.state,e),HA(o.state,e)])},async attach(e,r){let i=await h.management.attach(e,r);if(u?.status===`live`&&u.view.value!==void 0&&d?.attachmentId===i.attachmentId)return u;f?.(),u?.release(),d=i;let a=n.get(xA,i,{at:t});u=a,f=a.view.subscribe(()=>{});try{if(await KA(a.ready,r?.signal),await HA(a.view,r?.signal),a!==u)throw Error(`Attachment changed`);return a}catch(e){throw a.release(),a===u&&(f?.(),f=void 0,u=void 0,d=void 0),e}},async detach(){f?.(),f=void 0,u?.release(),u=void 0,d=void 0,p||await h.management.detach(null)},async close(){return m||(p=!0,m=(async()=>{f?.(),u?.release();for(let e of a)e();await n.close()})(),m)}};return e.onClose(()=>{h.close().catch(()=>{})}),h}function KA(e,t){let n,r=()=>{};return Promise.race([e,new Promise((e,i)=>{n=setTimeout(()=>i(Error(`Gateway readiness timed out`)),5e3),r=()=>i(t?.reason??Error(`Cancelled`)),t?.addEventListener(`abort`,r,{once:!0}),t?.aborted&&r()})]).finally(()=>{clearTimeout(n),t?.removeEventListener(`abort`,r)})}function qA(e,t){return e.filter(e=>e.workspaceRoot===t).sort(ki)}var JA=class{subagent(e){if(!this.ready||!this.#t)throw Error(`会话未就绪`);return this.#t.subagent(e)}#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=[];#u;#d;#f=[];#p;#m;#h=0;#g=0;#_=0;#v=!1;#y=!1;#b=!1;#x=!1;#S=!1;constructor(e){this.#e=e,this.#u=e.workspaceRoot,this.#d=e.preferredSession}get currentSessionId(){return this.#d}get workspaceRoot(){return this.#u}get ready(){return this.#y&&!this.#x&&this.#c!==void 0}get managementReady(){return this.#y&&!this.#x}async saveCredential(e,t){if(!this.#y||!this.#o)throw Error(`网关未连接`);await this.#o.save({provider:e,key:t})}async removeCredential(e){if(!this.#y||!this.#o)throw Error(`网关未连接`);await this.#o.remove({provider:e})}async start(){this.#e.events.onPhase(`connecting`),this.#e.events.onWorkspace(this.#u);try{await this.#j()}catch(e){this.#C(e),e instanceof xi?(this.#b=!0,this.#e.events.onPhase(`error`),await this.#P()):this.#M()}}#C(e){this.#e.events.onError(e instanceof xi?`版本不兼容,请运行 neko update 后重新启动本地 neko。`:e instanceof Error?e.message:String(e))}#w(e){if(this.#v||e!==this.#g)throw Error(`连接已变化,请重试`)}async#T(e){if(!this.managementReady)throw Error(`操作进行中或网关未连接,请稍后重试`);this.#x=!0,this.#e.events.onOperation(!0);let t=this.#g;try{await e(t)}finally{this.#x=!1,this.#e.events.onOperation(!1),t===this.#g&&this.#k()}}async selectWorkspace(e){await this.#T(async t=>{if(!this.#r?.state.value?.workspaces.some(t=>t.path===e))throw Error(`工作区不存在`);await this.#E(e,void 0,t)})}async addWorkspace(e){await this.#T(async t=>{let n=await this.#r.add({path:e});this.#w(t),await this.#E(n.path,void 0,t)})}async browse(e){if(!this.#y||!this.#r)throw Error(`网关未连接`);return this.#r.browse(e)}async attachTo(e){await this.#T(async t=>{if(!this.#l.find(t=>t.id===e&&t.workspaceRoot===this.#u))throw Error(`会话不属于当前工作区或已归档`);await this.#D(e,t)})}async createSession(){await this.#T(async e=>{let t=await this.#n.create({cwd:this.#u});this.#w(e),await this.#D(t.id,e)})}async archiveSession(e){await this.#T(async t=>{await this.#n.archive(e),this.#w(t),this.#l=this.#l.filter(t=>t.id!==e),this.#d===e&&await this.#E(this.#u,void 0,t)})}async#E(e,t,n){let r=qA(this.#l,e).sort(Ai),i=r.find(e=>e.id===t)??r[0];try{i?await this.#D(i.id,n):await this.#O(n),this.#w(n),this.#u=e,this.#e.events.onWorkspace(e)}catch(e){throw n===this.#g&&(this.#N(),this.#d=void 0,this.#e.events.onSessionChange(null)),e}}async#D(e,t){if(this.#d===e&&this.#c)return;let n=this.#t;this.#N();let r=this.#_;this.#d=void 0,this.#e.events.onSessionChange(null);let i=await n.attach(e);this.#w(t),this.#c=i,this.#d=e,this.#e.events.onSessionChange(e);let a=e=>{e&&t===this.#g&&r===this.#_&&this.#e.events.onView(e)};i.view.value&&a(i.view.value),this.#p=i.view.subscribe(a)}async#O(e){this.#N(),this.#d=void 0,this.#e.events.onSessionChange(null),await this.#t.detach(),this.#w(e)}#k(){this.managementReady&&this.#d&&!this.#l.some(e=>e.id===this.#d)&&this.#T(e=>this.#E(this.#u,void 0,e)).catch(e=>this.#C(e))}async configure(e){if(!this.ready)throw Error(`会话未就绪`);await this.#c.configure(e)}async submit(e,t=[],n=crypto.randomUUID(),r){if(r!==void 0&&r!==this.#d)throw Error(`会话已切换,草稿已保留`);if(!this.ready)throw Error(`会话未就绪`);let i=this.#c,a=[];try{for(let e of t)a.push(await wi(e,{begin:e=>i.beginImage(e),append:e=>i.appendImage(e),finish:e=>i.finishImage(e),release:e=>i.releaseImage(e)}));await i.submit({content:e,requestId:n,images:a})}finally{for(let e of a)await i.releaseImage(e).catch(()=>{})}}async searchFiles(e,t,n){if(!this.managementReady||!this.#i||t!==this.#u)throw Error(`工作区未就绪`);return this.#t.host.root(n=>this.#i.search({workspaceRoot:t,query:e},n),{signal:n})}async workspaceImage(e,t,n){if(!this.ready||t!==this.#d)throw Error(`会话已切换,草稿已保留`);let r=this.#c;return this.#t.host.root(async t=>{let n=await r.importImage(e,t);try{return{...await Ti(e=>r.draftImage({id:n.id,offset:e},t)),name:n.name}}finally{await r.releaseImage(n.id).catch(()=>{})}},{signal:n})}async compact(e,t){if(t!==void 0&&t!==this.#d)throw Error(`会话已切换,草稿已保留`);if(!this.ready)throw Error(`会话未就绪`);await this.#c.compact({instructions:e})}#A(e){if(!this.ready||e!==this.#d)throw Error(`会话已切换`);return WA(this.#c)}async jobOutput(e,t,n){return this.#A(e).output(t,n)}async jobStop(e,t){return this.#A(e).stop(t)}async image(e,t,n){if(n!==void 0&&n!==this.#d)throw Error(`会话已切换,草稿已保留`);if(!this.ready)throw Error(`会话未就绪`);let r=this.#c;return Ti(n=>r.getImage({entryId:e,contentIndex:t,offset:n}))}abort(){this.ready&&this.#c.abort(null).catch(e=>this.#C(e))}async listSkills(e,t){if(!this.ready||e!==this.#d)throw Error(`会话未就绪`);return this.#t.host.root(e=>this.#c.skills(null,e),{signal:t})}async listModels(){return this.#a?.list(null)??[]}marketList(e){return this.#s?this.#s.list({...e?{query:e}:{},workspaceRoot:this.#u}):Promise.reject(Error(`网关未连接`))}marketDetail(e){return this.#s?this.#s.detail({name:e,workspaceRoot:this.#u}):Promise.reject(Error(`网关未连接`))}marketPreview(e){return this.#s?this.#s.preview({name:e}):Promise.reject(Error(`网关未连接`))}marketInstall(e,t,n){return this.#s?this.#s.install({name:e,scope:t,workspaceRoot:this.#u,...n?{overwrite:n}:{}}):Promise.reject(Error(`网关未连接`))}async marketUninstall(e,t){if(!this.#s)return Promise.reject(Error(`网关未连接`));await this.#s.uninstall({name:e,scope:t,workspaceRoot:this.#u})}async#j(){let e=++this.#g,t=this.#e.discover?await this.#e.discover():{gatewayWs:this.#e.url,serverId:this.#e.serverId};this.#w(e);let n=GA(RA(new WebSocket(t.gatewayWs)),t.serverId);this.#t=n,n.link.onClose(()=>{n===this.#t&&this.#M()});try{await n.ready()}catch(e){throw e instanceof xi&&(this.#b=!0,this.#m&&=(clearTimeout(this.#m),void 0),this.#e.events.onPhase(`error`)),e}this.#w(e),this.#f.push(n.application.info.subscribe(t=>{e===this.#g&&this.#e.events.onUpdates?.(t??null)})),this.#e.events.onUpdates?.(n.application.info.value??null),this.#n=n.management,this.#r=n.workspaces,this.#i=n.workspaceFiles,this.#a=n.models,this.#o=n.credentials,this.#s=n.skillMarket,this.#f.push(this.#o.state.subscribe(t=>{e===this.#g&&this.#e.events.onCredentials?.(t??null)})),this.#o.state.value&&this.#e.events.onCredentials?.(this.#o.state.value);let r=n.directory,i=t=>{t&&e===this.#g&&(this.#l=t.sessions,this.#e.events.onDirectory(t),this.#k())};this.#f.push(r.state.subscribe(i)),this.#f.push(this.#r.state.subscribe(t=>{t&&e===this.#g&&this.#e.events.onWorkspaces(t)})),this.#S||=(await this.#r.add({path:this.#u}),this.#w(e),!0);let a=r.state.value,o=this.#r.state.value;if(!a||!o)throw Error(`工作区目录不可用,请重连`);i(a),this.#e.events.onWorkspaces(o),await this.#E(this.#u,this.#d,e),this.#w(e),this.#y=!0,this.#h=0,this.#e.events.onPhase(`ready`),this.#a.list(null).then(t=>{e===this.#g&&this.#e.events.onModels(t)}).catch(()=>{})}async checkUpdates(){if(!this.#t)throw Error(`网关未连接`);return this.#t.application.check(null)}#M(){if(this.#v||this.#b||this.#m)return;++this.#g,this.#y=!1,this.#N(),this.#e.events.onPhase(`reconnecting`),this.#e.events.onUpdates?.(null);let e=Math.min((this.#e.retryBaseMs??800)*++this.#h,this.#e.retryMaxMs??8e3);this.#m=setTimeout(()=>{this.#m=void 0,this.#P().then(()=>{if(!this.#v)return this.#j()}).catch(e=>{this.#C(e),e instanceof xi?(this.#e.events.onPhase(`error`),this.#P()):this.#M()})},e)}#N(){++this.#_,this.#p?.(),this.#p=void 0,this.#c?.release(),this.#c=void 0,this.#e.events.onView(null)}async#P(){for(let e of this.#f.splice(0))e();this.#N(),this.#n=void 0,this.#r=void 0,this.#i=void 0,this.#o=void 0,this.#e.events.onCredentials?.(null),this.#a=void 0;let e=this.#t;this.#t=void 0,await e?.close().catch(()=>{})}dispose(){this.#v=!0,++this.#g,this.#y=!1,clearTimeout(this.#m),this.#P()}},YA={phase:`connecting`,updates:null,webInfo:null,credentials:null,workspaceRoot:``,workspaces:[],operating:!1,sessions:[],models:[],currentSessionId:null,view:null,notice:null},XA=new Set;function ZA(e){YA=e;for(let e of XA)e()}function QA(e){return XA.add(e),()=>{XA.delete(e)}}function $A(){return(0,f.useSyncExternalStore)(QA,()=>YA)}function ej(){return YA}var tj={setUpdates(e){ZA({...YA,updates:e})},setWebInfo(e){ZA({...YA,webInfo:e})},setCredentials(e){e&&YA.credentials&&e.revision<YA.credentials.revision||ZA({...YA,credentials:e})},setWorkspace(e){ZA({...YA,workspaceRoot:e})},setWorkspaces(e){ZA({...YA,workspaces:e})},setOperation(e){ZA({...YA,operating:e})},setPhase(e){ZA({...YA,phase:e})},setDirectory(e){ZA({...YA,sessions:e})},setModels(e){ZA({...YA,models:e})},setSession(e){ZA({...YA,currentSessionId:e})},setView(e){ZA({...YA,view:e})},notice(e){ZA({...YA,notice:e})},clearNotice(){YA.notice!==null&&ZA({...YA,notice:null})}},nj=`neko.upgrade-draft.v1`;function rj(e=sessionStorage){try{let t=JSON.parse(e.getItem(nj)??`null`);if(t?.version===1&&typeof t.serverId==`string`&&typeof t.workspace==`string`&&(typeof t.session==`string`||t.session===null)&&typeof t.text==`string`&&typeof t.requestId==`string`)return t}catch{}return null}function ij(e,t=sessionStorage){if(t.setItem(nj,JSON.stringify(e)),t.getItem(nj)!==JSON.stringify(e))throw Error(`Draft not saved`)}function aj(){sessionStorage.removeItem(nj)}var oj=0;async function sj(){let e=++oj,t=await fetch(`/api/info`,{cache:`no-store`,signal:AbortSignal.timeout(5e3)});if(!t.ok)throw Error(`GET /api/info 失败(${t.status})`);let n=await t.json();if(n.protocolCompatible===!1)throw new xi;if(typeof n.gatewayWs!=`string`||typeof n.serverId!=`string`||typeof n.webVersion!=`string`||typeof n.workspaceRoot!=`string`||n.installedVersion!==null&&typeof n.installedVersion!=`string`)throw Error(`无效的网关信息`);return e===oj&&tj.setWebInfo({serverId:n.serverId,webVersion:n.webVersion,installedVersion:n.installedVersion}),n}var cj;function lj(){(async()=>{let e;try{e=await sj()}catch(e){tj.setPhase(`error`),tj.notice({level:`error`,text:e instanceof xi?`版本不兼容,请运行 neko update 后重新启动本地 neko。`:`获取网关信息失败:${e instanceof Error?e.message:String(e)}`});return}let t=rj(),n=t?.serverId===e.serverId?t:null;cj=new JA({url:e.gatewayWs,serverId:e.serverId,workspaceRoot:n?.workspace??e.workspaceRoot,preferredSession:n?.session??void 0,discover:sj,events:{onPhase:tj.setPhase,onUpdates:tj.setUpdates,onCredentials:tj.setCredentials,onWorkspaces:e=>tj.setWorkspaces(e.workspaces),onWorkspace:tj.setWorkspace,onOperation:tj.setOperation,onError:e=>tj.notice({level:`error`,text:e}),onDirectory:e=>tj.setDirectory(e.sessions),onModels:tj.setModels,onSessionChange:tj.setSession,onView:tj.setView}}),await cj.start();let r=()=>{document.visibilityState===`visible`&&sj().catch(()=>{})},i=setInterval(r,3e4);document.addEventListener(`visibilitychange`,r),window.addEventListener(`pagehide`,()=>{clearInterval(i),document.removeEventListener(`visibilitychange`,r)},{once:!0}),n?.text&&cj.currentSessionId!==n.session&&tj.notice({level:`info`,text:`原会话不可用,升级草稿保留在关于与更新中`})})()}function uj(){tj.notice({level:`error`,text:`网关连接未就绪,请稍候或刷新页面。`})}var dj={subagent(e){return fj().subagent(e)},jobOutput(e,t,n){return fj().jobOutput(e,t,n)},jobStop(e,t){return fj().jobStop(e,t)},checkUpdates(){return fj().checkUpdates()},saveCredential(e,t){return fj().saveCredential(e,t)},removeCredential(e){return fj().removeCredential(e)},configure(e,t){let n=fj();return n.currentSessionId!==t||!n.ready?Promise.reject(Error(`会话已变化,请重试`)):n.configure(e)},submit(e,t=[],n,r){return fj().submit(e,t,n,r)},searchFiles(e,t,n){return fj().searchFiles(e,t,n)},workspaceImage(e,t,n){return fj().workspaceImage(e,t,n)},compact(e,t){return fj().compact(e,t)},listSkills(e,t){return fj().listSkills(e,t)},marketList(e){return fj().marketList(e)},marketDetail(e){return fj().marketDetail(e)},marketPreview(e){return fj().marketPreview(e)},marketInstall(e,t,n){return fj().marketInstall(e,t,n)},marketUninstall(e,t){return fj().marketUninstall(e,t)},image(e,t,n){return fj().image(e,t,n)},abort(){cj?.ready===!0?cj.abort():uj()},selectSession(e){return fj().attachTo(e)},selectWorkspace(e){return fj().selectWorkspace(e)},addWorkspace(e){return fj().addWorkspace(e)},browse(e){return fj().browse(e)},createSession(){return fj().createSession()},configureModel(e){cj===void 0?uj():cj.configure({model:e}).catch(e=>{tj.notice({level:`error`,text:e instanceof Error?e.message:String(e)})})},archiveSession(e){return fj().archiveSession(e)}};function fj(){if(!cj)throw Error(`网关尚未连接`);return cj}function pj(e){tj.notice({level:`error`,text:e instanceof Error?e.message:String(e)})}function mj(e,t){let n=e.slice(0,t),r=/(?:^|\s|[([{])(@(?:"[^"\n]*"?|[^\s"@]*))$/.exec(n);if(!r?.[1])return null;let i=r[1];return{start:t-i.length,end:t,query:i.slice(1).replace(/^"|"$/g,``)}}function hj(e,t=!1){let n=t&&!e.endsWith(`/`)?`${e}/`:e;return`@${/\s/.test(n)?`"${n}"`:n}`}function gj(e,t,n,r){let i=hj(n,r),a=r?``:` `;return{text:e.slice(0,t.start)+i+a+e.slice(t.end),cursor:t.start+i.length+a.length-(r&&i.endsWith(`"`)?1:0)}}function _j(e){return e.skill===void 0?e.text:e.skill.args===``?`/skill:${e.skill.name}`:`/skill:${e.skill.name} ${e.skill.args}`}function vj(e){return e.phase===`done`?e.isError?`error`:`ok`:e.phase}function yj(e){return(e.phase===`done`?e.result:e.output)??``}function bj(e){let t=e.width>0&&e.height>0?` · ${e.width}×${e.height}`:``;return`${e.name} · ${e.mimeType}${t}`}function xj(e){return e<1e3?`${Math.round(e)}ms`:`${(e/1e3).toFixed(1)}s`}function Sj(e){return e.replace(/\s+/g,` `).trim()}function Cj(e){let t=[];for(let n of e){if(n.type!==`user`||n.subagentRoundId!==void 0)continue;let e=_j(n).trim();e!==``&&t.at(-1)!==e&&t.push(e)}return t.reverse().slice(0,100)}var wj=e=>/^\/[^\s]*$/.test(e);function Tj(e,t){let n=wj(e)?e:`/`;return[{key:`compact`,label:`/compact`,description:`压缩上下文(可附加要求)`},...t.map(e=>({key:`skill:${e.name}`,label:`/skill:${e.name}`,description:e.description,...e.level===`builtin`?{badge:`内置`}:{}}))].filter(e=>e.label.startsWith(n))}function Ej(e,t,n,r,i){if(n.shiftKey||n.altKey||n.ctrlKey||n.metaKey||n.key!==`ArrowUp`&&n.key!==`ArrowDown`||i.start!==i.end)return null;let a=e!==null&&e.entries[e.index]===r?e:null;if(n.key===`ArrowUp`){if(i.start!==0)return null;let e=a?.entries??t,n=(a?.index??-1)+1,o=e[n];return o===void 0?null:{browse:{index:n,draft:a?.draft??r,entries:e},text:o,caret:`start`}}if(a===null||i.start!==r.length)return null;let o=a.index-1;return o<0?{browse:null,text:a.draft,caret:`end`}:{browse:{...a,index:o},text:a.entries[o]??``,caret:`end`}}function Dj(){return typeof window<`u`}function Oj(e){return jj(e)?(e.nodeName||``).toLowerCase():`#document`}function kj(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Aj(e){return((jj(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function jj(e){return Dj()?e instanceof Node||e instanceof kj(e).Node:!1}function Mj(e){return Dj()?e instanceof Element||e instanceof kj(e).Element:!1}function Nj(e){return Dj()?e instanceof HTMLElement||e instanceof kj(e).HTMLElement:!1}function Pj(e){return!Dj()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof kj(e).ShadowRoot}function Fj(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=Kj(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function Ij(e){return/^(table|td|th)$/.test(Oj(e))}function Lj(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var Rj=/transform|translate|scale|rotate|perspective|filter/,zj=/paint|layout|strict|content/,Bj=e=>!!e&&e!==`none`,Vj;function Hj(e){let t=Mj(e)?Kj(e):e;return Bj(t.transform)||Bj(t.translate)||Bj(t.scale)||Bj(t.rotate)||Bj(t.perspective)||!Wj()&&(Bj(t.backdropFilter)||Bj(t.filter))||Rj.test(t.willChange||``)||zj.test(t.contain||``)}function Uj(e){let t=Jj(e);for(;Nj(t)&&!Gj(t);){if(Hj(t))return t;if(Lj(t))return null;t=Jj(t)}return null}function Wj(){return Vj??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),Vj}function Gj(e){return/^(html|body|#document)$/.test(Oj(e))}function Kj(e){return kj(e).getComputedStyle(e)}function qj(e){return Mj(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Jj(e){if(Oj(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Pj(e)&&e.host||Aj(e);return Pj(t)?t.host:t}function Yj(e){let t=Jj(e);return Gj(t)?(e.ownerDocument||e).body:Nj(t)&&Fj(t)?t:Yj(t)}function Xj(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Yj(e),i=r===e.ownerDocument?.body,a=kj(r);if(i){let e=Zj(a);return t.concat(a,a.visualViewport||[],Fj(r)?r:[],e&&n?Xj(e):[])}return t.concat(r,Xj(r,[],n))}function Zj(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}var Qj=Math.min,$j=Math.max,eM=Math.round,tM=Math.floor,nM=e=>({x:e,y:e}),rM={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function iM(e,t,n){return $j(e,Qj(t,n))}function aM(e,t){return typeof e==`function`?e(t):e}function oM(e){return e.split(`-`)[0]}function sM(e){return e.split(`-`)[1]}function cM(e){return e===`x`?`y`:`x`}function lM(e){return e===`y`?`height`:`width`}function uM(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function dM(e){return cM(uM(e))}function fM(e,t,n){n===void 0&&(n=!1);let r=sM(e),i=dM(e),a=lM(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=xM(o)),[o,xM(o)]}function pM(e){let t=xM(e);return[mM(e),t,mM(t)]}function mM(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var hM=[`left`,`right`],gM=[`right`,`left`],_M=[`top`,`bottom`],vM=[`bottom`,`top`];function yM(e,t,n){switch(e){case`top`:case`bottom`:return n?t?gM:hM:t?hM:gM;case`left`:case`right`:return t?_M:vM;default:return[]}}function bM(e,t,n,r){let i=sM(e),a=yM(oM(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(mM)))),a}function xM(e){let t=oM(e);return rM[t]+e.slice(t.length)}function SM(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function CM(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:SM(e)}function wM(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}var TM=[`input:not([inert]):not([inert] *)`,`select:not([inert]):not([inert] *)`,`textarea:not([inert]):not([inert] *)`,`a[href]:not([inert]):not([inert] *)`,`area[href]:not([inert]):not([inert] *)`,`button:not([inert]):not([inert] *)`,`[tabindex]:not(slot):not([inert]):not([inert] *)`,`audio[controls]:not([inert]):not([inert] *)`,`video[controls]:not([inert]):not([inert] *)`,`[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)`,`details>summary:first-of-type:not([inert]):not([inert] *)`,`details:not([inert]):not([inert] *)`].join(`,`),EM=typeof Element>`u`,DM=EM?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,OM=!EM&&Element.prototype.getRootNode?function(e){return e?.getRootNode?.call(e)}:function(e){return e?.ownerDocument},kM=function(e,t){t===void 0&&(t=!0);var n=e?.getAttribute?.call(e,`inert`);return n===``||n===`true`||t&&e&&(typeof e.closest==`function`?e.closest(`[inert]`):kM(e.parentNode))},AM=function(e){var t=e?.getAttribute?.call(e,`contenteditable`);return t===``||t===`true`},jM=function(e,t,n){if(kM(e))return[];var r=Array.prototype.slice.apply(e.querySelectorAll(TM));return t&&DM.call(e,TM)&&r.unshift(e),r=r.filter(n),r},MM=function(e,t,n){for(var r=[],i=Array.from(e);i.length;){var a=i.shift();if(!kM(a,!1)){if(a.tagName===`SLOT`){var o=a.assignedElements(),s=MM(o.length?o:a.children,!0,n);n.flatten?r.push.apply(r,s):r.push({scopeParent:a,candidates:s})}else{DM.call(a,TM)&&n.filter(a)&&(t||!e.includes(a))&&r.push(a);var c=a.shadowRoot||typeof n.getShadowRoot==`function`&&n.getShadowRoot(a),l=!kM(c,!1)&&(!n.shadowRootFilter||n.shadowRootFilter(a));if(c&&l){var u=MM(c===!0?a.children:c.children,!0,n);n.flatten?r.push.apply(r,u):r.push({scopeParent:a,candidates:u})}else i.unshift.apply(i,a.children)}}}return r},NM=function(e){return!isNaN(parseInt(e.getAttribute(`tabindex`),10))},PM=function(e){if(!e)throw Error(`No node provided`);return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||AM(e))&&!NM(e)?0:e.tabIndex},FM=function(e,t){var n=PM(e);return n<0&&t&&!NM(e)?0:n},IM=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},LM=function(e){return e.tagName===`INPUT`},RM=function(e){return LM(e)&&e.type===`hidden`},zM=function(e){return e.tagName===`DETAILS`&&Array.prototype.slice.apply(e.children).some(function(e){return e.tagName===`SUMMARY`})},BM=function(e,t){for(var n=0;n<e.length;n++)if(e[n].checked&&e[n].form===t)return e[n]},VM=function(e){if(!e.name)return!0;var t=e.form||OM(e),n=function(e){return t.querySelectorAll(`input[type="radio"][name="`+e+`"]`)},r;if(typeof window<`u`&&window.CSS!==void 0&&typeof window.CSS.escape==`function`)r=n(window.CSS.escape(e.name));else try{r=n(e.name)}catch(e){return console.error(`Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s`,e.message),!1}var i=BM(r,e.form);return!i||i===e},HM=function(e){return LM(e)&&e.type===`radio`},UM=function(e){return HM(e)&&!VM(e)},WM=function(e){var t=e&&OM(e),n=t?.host,r=!1;if(t&&t!==e){var i,a,o;for(r=!!((i=n)!=null&&(a=i.ownerDocument)!=null&&a.contains(n)||e!=null&&(o=e.ownerDocument)!=null&&o.contains(e));!r&&n;){var s,c;t=OM(n),n=t?.host,r=!!((s=n)!=null&&(c=s.ownerDocument)!=null&&c.contains(n))}}return r},GM=function(e){var t=e.getBoundingClientRect(),n=t.width,r=t.height;return n===0&&r===0},KM=function(e,t){var n=t.displayCheck,r=t.getShadowRoot;if(n===`full-native`&&`checkVisibility`in e)return!e.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});var i=getComputedStyle(e).visibility;if(i===`hidden`||i===`collapse`)return!0;var a=DM.call(e,`details>summary:first-of-type`)?e.parentElement:e;if(DM.call(a,`details:not([open]) *`))return!0;if(!n||n===`full`||n===`full-native`||n===`legacy-full`){if(typeof r==`function`){for(var o=e;e;){var s=e.parentElement,c=OM(e);if(s&&!s.shadowRoot&&r(s)===!0)return GM(e);e=e.assignedSlot?e.assignedSlot:!s&&c!==e.ownerDocument?c.host:s}e=o}if(WM(e))return!e.getClientRects().length;if(n!==`legacy-full`)return!0}else if(n===`non-zero-area`)return GM(e);return!1},qM=function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var t=e.parentElement;t;){if(t.tagName===`FIELDSET`&&t.disabled){for(var n=0;n<t.children.length;n++){var r=t.children.item(n);if(r.tagName===`LEGEND`)return DM.call(t,`fieldset[disabled] *`)?!0:!r.contains(e)}return!0}t=t.parentElement}return!1},JM=function(e,t){return!(t.disabled||RM(t)||KM(t,e)||zM(t)||qM(t))},YM=function(e,t){return!(UM(t)||PM(t)<0||!JM(e,t))},XM=function(e){var t=parseInt(e.getAttribute(`tabindex`),10);return!!(isNaN(t)||t>=0)},ZM=function(e){var t=[],n=[];return e.forEach(function(e,r){var i=!!e.scopeParent,a=i?e.scopeParent:e,o=FM(a,i),s=i?ZM(e.candidates):a;o===0?i?t.push.apply(t,s):t.push(a):n.push({documentOrder:r,tabIndex:o,item:e,isScope:i,content:s})}),n.sort(IM).reduce(function(e,t){return t.isScope?e.push.apply(e,t.content):e.push(t.content),e},[]).concat(t)},QM=function(e,t){return t||={},ZM(t.getShadowRoot?MM([e],t.includeContainer,{filter:YM.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:XM}):jM(e,t.includeContainer,YM.bind(null,t)))};function $M(){return/apple/i.test(navigator.vendor)}function eN(e){let t=e.activeElement;for(;((n=t)==null||(n=n.shadowRoot)==null?void 0:n.activeElement)!=null;){var n;t=t.shadowRoot.activeElement}return t}function tN(e,t){if(!e||!t)return!1;let n=t.getRootNode==null?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&Pj(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function nN(e){return e?.ownerDocument||document}var rN=typeof document<`u`?f.useLayoutEffect:function(){},iN={...f}.useInsertionEffect||(e=>e());function aN(e){let t=f.useRef(()=>{});return iN(()=>{t.current=e}),f.useCallback(function(){var e=[...arguments];return t.current==null?void 0:t.current(...e)},[])}var oN=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver==`function`&&ResizeObserver.toString().includes(`[native code]`)?`full`:`none`});function sN(e,t){let n=QM(e,oN()),r=n.length;if(r===0)return;let i=eN(nN(e)),a=n.indexOf(i);return n[a===-1?t===1?0:r-1:a+t]}function cN(e){return sN(nN(e).body,1)||e}function lN(e){return sN(nN(e).body,-1)||e}function uN(e,t){let n=t||e.currentTarget,r=e.relatedTarget;return!r||!tN(n,r)}function dN(e){QM(e,oN()).forEach(e=>{e.dataset.tabindex=e.getAttribute(`tabindex`)||``,e.setAttribute(`tabindex`,`-1`)})}function fN(e){e.querySelectorAll(`[data-tabindex]`).forEach(e=>{let t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute(`tabindex`,t):e.removeAttribute(`tabindex`)})}var pN=l(mi(),1);function mN(e,t,n){let{reference:r,floating:i}=e,a=uM(t),o=dM(t),s=lM(o),c=oM(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}let m=sM(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function hN(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=aM(t,e),p=CM(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=wM(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=wM(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var gN=50,_N=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:hN},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=mN(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<gN&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=mN(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},vN=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=aM(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=oM(r),_=uM(o),v=oM(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[xM(o)]:pM(o)),x=p!==`none`;!d&&x&&b.push(...bM(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=fM(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(u!==`alignment`||_===uM(t)||T.every(e=>uM(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=uM(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o}if(r!==n)return{reset:{placement:n}}}return{}}}},yN=new Set([`left`,`top`]);async function bN(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=oM(n),s=sM(n),c=uM(n)===`y`,l=yN.has(o)?-1:1,u=a&&c?-1:1,d=aM(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var xN=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await bN(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},SN=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=aM(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=uM(i),p=cM(f),m=u[p],h=u[f],g=(e,t)=>iM(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}},CN=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){let{placement:n,rects:r,platform:i,elements:a}=t,{apply:o=()=>{},...s}=aM(e,t),c=await i.detectOverflow(t,s),l=oM(n),u=sM(n),d=uM(n)===`y`,{width:f,height:p}=r.floating,m,h;l===`top`||l===`bottom`?(m=l,h=u===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(h=l,m=u===`end`?`top`:`bottom`);let g=p-c.top-c.bottom,_=f-c.left-c.right,v=Qj(p-c[m],g),y=Qj(f-c[h],_),b=t.middlewareData.shift,x=!b,S=v,C=y;b!=null&&b.enabled.x&&(C=_),b!=null&&b.enabled.y&&(S=g),x&&!u&&(d?C=f-2*$j(c.left,c.right):S=p-2*$j(c.top,c.bottom)),await o({...t,availableWidth:C,availableHeight:S});let w=await i.getDimensions(a.floating);return f!==w.width||p!==w.height?{reset:{rects:!0}}:{}}}};function wN(e){let t=Kj(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=Nj(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=eM(n)!==a||eM(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function TN(e){return Mj(e)?e:e.contextElement}function EN(e){let t=TN(e);if(!Nj(t))return nM(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=wN(t),o=(a?eM(n.width):n.width)/r,s=(a?eM(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var DN=nM(0);function ON(e){let t=kj(e);return!Wj()||!t.visualViewport?DN:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function kN(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===kj(e)}function AN(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=TN(e),o=nM(1);t&&(r?Mj(r)&&(o=EN(r)):o=EN(e));let s=kN(a,n,r)?ON(a):nM(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a&&r){let e=kj(a),t=Mj(r)?kj(r):r,n=e,i=Zj(n);for(;i&&t!==n;){let e=EN(i),t=i.getBoundingClientRect(),r=Kj(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=kj(i),i=Zj(n)}}return wM({width:u,height:d,x:c,y:l})}function jN(e,t){let n=qj(e).scrollLeft;return t?t.left+n:AN(Aj(e)).left+n}function MN(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-jN(e,n),y:n.top+t.scrollTop}}function NN(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=Aj(r),s=t?Lj(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=nM(1),u=nM(0),d=Nj(r);if((d||!a)&&((Oj(r)!==`body`||Fj(o))&&(c=qj(r)),d)){let e=AN(r);l=EN(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?MN(o,c):nM(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function PN(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function FN(e){let t=qj(e),n=e.ownerDocument.body,r=$j(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=$j(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+jN(e),o=-t.scrollTop;return Kj(n).direction===`rtl`&&(a+=$j(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var IN=25;function LN(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=kj(e),a=Aj(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!Wj()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(jN(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=IN&&(s-=o)}return{width:s,height:c,x:l,y:u}}function RN(e,t){let n=AN(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=EN(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function zN(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=LN(e,n,t);else if(t===`document`)r=FN(Aj(e));else if(Mj(t))r=RN(t,n);else{let n=ON(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return wM(r)}function BN(e,t){let n=t.get(e);if(n)return n;let r=Xj(e,[],!1).filter(e=>Mj(e)&&Oj(e)!==`body`),i=null,a=Kj(e).position===`fixed`,o=a?Jj(e):e;for(;Mj(o)&&!Gj(o);){let e=Kj(o),t=Hj(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=Jj(o)}return t.set(e,r),r}function VN(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?Lj(t)?[]:BN(t,this._c):[].concat(n),r],o=zN(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=zN(t,a[e],i);s=$j(n.top,s),c=Qj(n.right,c),l=Qj(n.bottom,l),u=$j(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function HN(e){let{width:t,height:n}=wN(e);return{width:t,height:n}}function UN(e,t,n){let r=Nj(t),i=Aj(t),a=n===`fixed`,o=AN(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=nM(0);if((r||!a)&&((Oj(t)!==`body`||Fj(i))&&(s=qj(t)),r)){let e=AN(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=jN(i));let l=i&&!r&&!a?MN(i,s):nM(0);return{x:o.left+s.scrollLeft-c.x-l.x,y:o.top+s.scrollTop-c.y-l.y,width:o.width,height:o.height}}function WN(e){return Kj(e).position===`static`}function GN(e,t){if(!Nj(e)||Kj(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return Aj(e)===n&&(n=n.ownerDocument.body),n}function KN(e,t){let n=kj(e);if(Lj(e))return n;if(!Nj(e)){let t=Jj(e);for(;t&&!Gj(t);){if(Mj(t)&&!WN(t))return t;t=Jj(t)}return n}let r=GN(e,t);for(;r&&Ij(r)&&WN(r);)r=GN(r,t);return r&&Gj(r)&&WN(r)&&!Hj(r)?n:r||Uj(e)||n}var qN=async function(e){let t=this.getOffsetParent||KN,n=this.getDimensions,r=await n(e.floating);return{reference:UN(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function JN(e){return Kj(e).direction===`rtl`}var YN={convertOffsetParentRelativeRectToViewportRelativeRect:NN,getDocumentElement:Aj,getClippingRect:VN,getOffsetParent:KN,getElementRects:qN,getClientRects:PN,getDimensions:HN,getScale:EN,isElement:Mj,isRTL:JN};function XN(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function ZN(e,t,n){let r=null,i,a=Aj(e);function o(){var e;clearTimeout(i),(e=r)==null||e.disconnect(),r=null}function s(n,c){n===void 0&&(n=!1),c===void 0&&(c=1),o();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(n||t(),!f||!p)return;let m=tM(d),h=tM(a.clientWidth-(u+f)),g=tM(a.clientHeight-(d+p)),_=tM(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:$j(0,Qj(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!XN(l,e.getBoundingClientRect()))return s();if(n!==c){if(!y)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}y=!1}try{r=new IntersectionObserver(b,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(b,v)}r.observe(e)}let c=kj(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function QN(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=TN(e),u=i||a?[...l?Xj(l):[],...t?Xj(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?ZN(l,n,a):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?AN(e):null;c&&g();function g(){let t=AN(e);h&&!XN(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var $N=xN,eP=SN,tP=vN,nP=CN,rP=(e,t,n)=>{let r=new Map,i=n??{},a={...YN,...i.platform,_c:r};return _N(e,t,{...i,platform:a})},iP=typeof document<`u`?f.useLayoutEffect:function(){};function aP(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!aP(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!aP(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function oP(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function sP(e,t){let n=oP(e);return Math.round(t*n)/n}function cP(e){let t=f.useRef(e);return iP(()=>{t.current=e}),t}function lP(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=f.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,m]=f.useState(r);aP(p,r)||m(r);let[h,g]=f.useState(null),[_,v]=f.useState(null),y=f.useCallback(e=>{e!==C.current&&(C.current=e,g(e))},[]),b=f.useCallback(e=>{e!==w.current&&(w.current=e,v(e))},[]),x=a||h,S=o||_,C=f.useRef(null),w=f.useRef(null),T=f.useRef(u),ee=c!=null,E=cP(c),te=cP(i),ne=cP(l),D=f.useCallback(()=>{if(!C.current||!w.current)return;let e={placement:t,strategy:n,middleware:p};te.current&&(e.platform=te.current),rP(C.current,w.current,e).then(e=>{let t={...e,isPositioned:ne.current!==!1};re.current&&!aP(T.current,t)&&(T.current=t,pN.flushSync(()=>{d(t)}))})},[p,t,n,te,ne]);iP(()=>{l===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let re=f.useRef(!1);iP(()=>(re.current=!0,()=>{re.current=!1}),[]),iP(()=>{if(x&&(C.current=x),S&&(w.current=S),x&&S){if(E.current)return E.current(x,S,D);D()}},[x,S,D,E,ee]);let ie=f.useMemo(()=>({reference:C,floating:w,setReference:y,setFloating:b}),[y,b]),ae=f.useMemo(()=>({reference:x,floating:S}),[x,S]),O=f.useMemo(()=>{let e={position:n,left:0,top:0};if(!ae.floating)return e;let t=sP(ae.floating,u.x),r=sP(ae.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...oP(ae.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,ae.floating,u.x,u.y]);return f.useMemo(()=>({...u,update:D,refs:ie,elements:ae,floatingStyles:O}),[u,D,ie,ae,O])}var uP=(e,t)=>{let n=$N(e);return{name:n.name,fn:n.fn,options:[e,t]}},dP=(e,t)=>{let n=eP(e);return{name:n.name,fn:n.fn,options:[e,t]}},fP=(e,t)=>{let n=tP(e);return{name:n.name,fn:n.fn,options:[e,t]}},pP=(e,t)=>{let n=nP(e);return{name:n.name,fn:n.fn,options:[e,t]}},mP=`ArrowLeft`,hP=`ArrowRight`,gP=`ArrowUp`,_P=`ArrowDown`,vP=[mP,hP],yP=[gP,_P];[...vP,...yP];var bP={...f},xP=!1,SP=0,CP=()=>`floating-ui-`+Math.random().toString(36).slice(2,6)+SP++;function wP(){let[e,t]=f.useState(()=>xP?CP():void 0);return rN(()=>{e??t(CP())},[]),f.useEffect(()=>{xP=!0},[]),e}var TP=bP.useId||wP;function EP(){let e=new Map;return{emit(t,n){var r;(r=e.get(t))==null||r.forEach(e=>e(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){var r;(r=e.get(t))==null||r.delete(n)}}}var DP=f.createContext(null),OP=f.createContext(null),kP=()=>f.useContext(DP)?.id||null,AP=()=>f.useContext(OP);function jP(e){return`data-floating-ui-`+e}var MP={border:0,clip:`rect(0 0 0 0)`,height:`1px`,margin:`-1px`,overflow:`hidden`,padding:0,position:`fixed`,whiteSpace:`nowrap`,width:`1px`,top:0,left:0},NP=f.forwardRef(function(e,t){let[n,r]=f.useState();rN(()=>{$M()&&r(`button`)},[]);let i={ref:t,tabIndex:0,role:n,"aria-hidden":!n||void 0,[jP(`focus-guard`)]:``,style:MP};return(0,M.jsx)(`span`,{...e,...i})}),PP={clipPath:`inset(50%)`,position:`fixed`,top:0,left:0},FP=f.createContext(null),IP=jP(`portal`);function LP(e){e===void 0&&(e={});let{id:t,root:n}=e,r=TP(),i=zP(),[a,o]=f.useState(null),s=f.useRef(null);return rN(()=>()=>{a?.remove(),queueMicrotask(()=>{s.current=null})},[a]),rN(()=>{if(!r||s.current)return;let e=t?document.getElementById(t):null;if(!e)return;let n=document.createElement(`div`);n.id=r,n.setAttribute(IP,``),e.appendChild(n),s.current=n,o(n)},[t,r]),rN(()=>{if(n===null||!r||s.current)return;let e=n||i?.portalNode;e&&!jj(e)&&(e=e.current),e||=document.body;let a=null;t&&(a=document.createElement(`div`),a.id=t,e.appendChild(a));let c=document.createElement(`div`);c.id=r,c.setAttribute(IP,``),e=a||e,e.appendChild(c),s.current=c,o(c)},[t,n,r,i]),a}function RP(e){let{children:t,id:n,root:r,preserveTabOrder:i=!0}=e,a=LP({id:n,root:r}),[o,s]=f.useState(null),c=f.useRef(null),l=f.useRef(null),u=f.useRef(null),d=f.useRef(null),p=o?.modal,m=o?.open,h=!!o&&!o.modal&&o.open&&i&&!!(r||a);return f.useEffect(()=>{if(!a||!i||p)return;function e(e){a&&uN(e)&&(e.type===`focusin`?fN:dN)(a)}return a.addEventListener(`focusin`,e,!0),a.addEventListener(`focusout`,e,!0),()=>{a.removeEventListener(`focusin`,e,!0),a.removeEventListener(`focusout`,e,!0)}},[a,i,p]),f.useEffect(()=>{a&&(m||fN(a))},[m,a]),(0,M.jsxs)(FP.Provider,{value:f.useMemo(()=>({preserveTabOrder:i,beforeOutsideRef:c,afterOutsideRef:l,beforeInsideRef:u,afterInsideRef:d,portalNode:a,setFocusManagerState:s}),[i,a]),children:[h&&a&&(0,M.jsx)(NP,{"data-type":`outside`,ref:c,onFocus:e=>{if(uN(e,a)){var t;(t=u.current)==null||t.focus()}else lN(o?o.domReference:null)?.focus()}}),h&&a&&(0,M.jsx)(`span`,{"aria-owns":a.id,style:PP}),a&&pN.createPortal(t,a),h&&a&&(0,M.jsx)(NP,{"data-type":`outside`,ref:l,onFocus:e=>{if(uN(e,a)){var t;(t=d.current)==null||t.focus()}else cN(o?o.domReference:null)?.focus(),o!=null&&o.closeOnFocusOut&&o?.onOpenChange(!1,e.nativeEvent,`focus-out`)}})]})}var zP=()=>f.useContext(FP);function BP(e){let{open:t=!1,onOpenChange:n,elements:r}=e,i=TP(),a=f.useRef({}),[o]=f.useState(()=>EP()),s=kP()!=null,[c,l]=f.useState(r.reference),u=aN((e,t,r)=>{a.current.openEvent=e?t:void 0,o.emit(`openchange`,{open:e,event:t,reason:r,nested:s}),n?.(e,t,r)}),d=f.useMemo(()=>({setPositionReference:l}),[]),p=f.useMemo(()=>({reference:c||r.reference||null,floating:r.floating||null,domReference:r.reference}),[c,r.reference,r.floating]);return f.useMemo(()=>({dataRef:a,open:t,onOpenChange:u,elements:p,events:o,floatingId:i,refs:d}),[t,u,p,o,i,d])}function VP(e){let{elements:t,...n}=e===void 0?{}:e,{nodeId:r}=n,i=BP({...n,elements:{reference:t?.reference??null,floating:t?.floating??null}}),a=n.rootContext||i,o=a.elements,[s,c]=f.useState(null),[l,u]=f.useState(null),d=o?.domReference||s,p=f.useRef(null),m=AP();rN(()=>{d&&(p.current=d)},[d]);let h=lP({...n,elements:{...o,...l&&{reference:l}}}),g=f.useCallback(e=>{let t=Mj(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>e.getClientRects(),contextElement:e}:e;u(t),h.refs.setReference(t)},[h.refs]),_=f.useCallback(e=>{(Mj(e)||e===null)&&(p.current=e,c(e)),(Mj(h.refs.reference.current)||h.refs.reference.current===null||e!==null&&!Mj(e))&&h.refs.setReference(e)},[h.refs]),v=f.useMemo(()=>({...h.refs,setReference:_,setPositionReference:g,domReference:p}),[h.refs,_,g]),y=f.useMemo(()=>({...h.elements,domReference:d}),[h.elements,d]),b=f.useMemo(()=>({...h,...a,refs:v,elements:y,nodeId:r}),[h,v,y,r,a]);return rN(()=>{a.dataRef.current.floatingContext=b;let e=m?.nodesRef.current.find(e=>e.id===r);e&&(e.context=b)}),f.useMemo(()=>({...h,context:b,refs:v,elements:y}),[h,v,y,b])}function HP({anchor:e,id:t,title:n,items:r,selected:i,onSelect:a,onAccept:o,message:s,onRetry:c}){let{refs:l,floatingStyles:u,isPositioned:d}=VP({elements:{reference:e.current},placement:`top-start`,whileElementsMounted:QN,middleware:[uP(8),fP(),dP({padding:12}),pP({padding:12,apply({availableHeight:e,availableWidth:t,rects:n,elements:r}){Object.assign(r.floating.style,{maxHeight:`${Math.max(0,Math.min(320,e))}px`,width:`${Math.min(n.reference.width,t)}px`})}})]});return(0,f.useEffect)(()=>{document.getElementById(`${t}-${i}`)?.scrollIntoView({block:`nearest`})},[t,i]),(0,M.jsx)(RP,{children:(0,M.jsxs)(`div`,{ref:l.setFloating,style:{...u,visibility:d?`visible`:`hidden`},className:`z-50 overflow-y-auto rounded-xl border border-sakura-200 bg-base p-1.5 shadow-soft`,children:[(0,M.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-x-3 gap-y-1 px-3 py-2 text-xs text-ink-500`,children:[(0,M.jsx)(`span`,{children:n}),(0,M.jsx)(`span`,{children:`↑↓ 选择 · Enter / Tab 确认 · Esc 关闭`})]}),(0,M.jsx)(`div`,{id:t,role:`listbox`,tabIndex:-1,"aria-label":n,children:r.map((e,n)=>(0,M.jsxs)(`button`,{type:`button`,role:`option`,id:`${t}-${n}`,"aria-selected":n===i,tabIndex:-1,title:e.description,onMouseDown:e=>e.preventDefault(),onPointerMove:e=>{e.pointerType===`mouse`&&(e.movementX!==0||e.movementY!==0)&&a(n)},onClick:()=>o(n),className:`block w-full rounded-lg px-3 py-2 text-left ${n===i?`bg-sakura-100`:``}`,children:[(0,M.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,M.jsx)(`span`,{className:`truncate text-sm text-ink-900`,children:e.label}),e.badge&&(0,M.jsx)(`span`,{className:`shrink-0 rounded-md bg-ink-100 px-1.5 py-0.5 text-xs text-ink-600`,children:e.badge})]}),(0,M.jsx)(`span`,{className:`block truncate text-xs text-ink-500`,children:e.description})]},e.key))}),s&&(0,M.jsx)(`output`,{className:`block break-words px-3 py-2 text-sm text-ink-500`,children:s}),c&&(0,M.jsx)(`button`,{type:`button`,className:`px-3 py-2 text-sm text-ink-900 underline`,onMouseDown:e=>e.preventDefault(),onClick:c,children:`重试文件查询`})]})})}function UP(e,t,n,r,i){let[a,o]=(0,f.useState)(null),[s,c]=(0,f.useState)({entries:[],limited:!1,incomplete:!1}),[l,u]=(0,f.useState)(``),[d,p]=(0,f.useState)(0),[m,h]=(0,f.useState)(!1),g=(0,f.useRef)(0),_=(0,f.useId)(),v=()=>{g.current++,o(null),c({entries:[],limited:!1,incomplete:!1}),p(0)},y=()=>{let t=e.current;if(!t||!r)return v();let n=mj(t.value,t.selectionStart);if(!n)return v();a&&n.start===a.start&&n.end===a.end&&n.query===a.query||(g.current++,c({entries:[],limited:!1,incomplete:!1}),u(`正在查找文件…`),h(!1),o(n),p(0))};(0,f.useEffect)(()=>{if(!a||!r){o(null);return}let e=new AbortController,t=++g.current,i=setTimeout(()=>{dj.searchFiles(a.query,n,e.signal).then(n=>{e.signal.aborted||t!==g.current||(c(n),u(n.incomplete?`文件索引未完整,请输入子目录缩小范围`:n.entries.length?n.limited?`结果较多,请继续输入路径缩小范围`:``:`没有匹配的文件或目录`))}).catch(n=>{!e.signal.aborted&&t===g.current&&(h(!0),u(n instanceof Error?`查询失败:${n.message}`:`查询失败,请重试`))})},120);return()=>{clearTimeout(i),e.abort()}},[a,n,r]);let b=e=>{a&&(i(e,a),v())};return{refresh:y,close:v,keyDown:e=>{if(!a||e.nativeEvent.isComposing)return!1;if(e.key===`Escape`||e.key===`Tab`&&(e.shiftKey||!s.entries.length))return v(),e.key===`Escape`&&e.preventDefault(),e.key===`Escape`;if(e.key===`ArrowDown`||e.key===`ArrowUp`)return e.preventDefault(),p(t=>Math.max(0,Math.min(s.entries.length-1,t+(e.key===`ArrowDown`?1:-1)))),!0;if((e.key===`Enter`||e.key===`Tab`)&&!e.shiftKey){e.preventDefault();let t=s.entries[d];return t&&b(t),!0}return!1},panel:a&&r?(0,M.jsx)(HP,{anchor:t,id:_,title:`工作区文件`,selected:d,onSelect:p,onAccept:e=>{let t=s.entries[e];t&&b(t)},items:s.entries.map(e=>({key:e.path,label:`${e.kind===`directory`?`▸`:`▤`} ${e.name}${e.kind===`directory`?`/`:``}`,description:e.path})),message:l,onRetry:m?()=>{g.current++,h(!1),u(`正在查找文件…`),o(e=>e?{...e}:null)}:void 0}):null,open:!!a,controls:a?_:void 0,active:a&&s.entries[d]?`${_}-${d}`:void 0}}var WP=`(max-width: 768px)`;function GP({name:e,size:t=18,className:n}){return(0,M.jsx)(`svg`,{width:t,height:t,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:e===`more`?3:1.6,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,className:n,children:(0,M.jsx)(`path`,{d:{folder:`M3 6h6l2 2h10v11H3z`,plus:`M12 5v14M5 12h14`,chevron:`m8 10 4 4 4-4`,panel:`M3 4h18v16H3zM9 4v16`,search:`M20 20l-5-5M17 10a7 7 0 1 1-14 0 7 7 0 0 1 14 0`,more:`M5 12h.01M12 12h.01M19 12h.01`,chat:`M4 4h16v12H9l-5 4z`,close:`m6 6 12 12M6 18 18 6`,settings:`M12 3v3M12 18v3M3 12h3M18 12h3M5.6 5.6l2.1 2.1M16.3 16.3l2.1 2.1M5.6 18.4l2.1-2.1M16.3 7.7l2.1-2.1M17 12a5 5 0 1 1-10 0 5 5 0 0 1 10 0`,archive:`M3 4h18v4H3zM5 8v12h14V8M10 12h4`,up:`m5 12 7-7 7 7M12 5v14`,bolt:`M13 2 4 14h6l-1 8 9-12h-6l1-8z`,check:`M5 12.5l4.5 4.5L19 7.5`,clock:`M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18ZM12 7v5l3 2`,spinner:`M21 12a9 9 0 1 1-9-9`,store:`M4 9.5 5.6 4.5h12.8L20 9.5M4 9.5V20h16V9.5M4 9.5h16M9.5 20v-5.5h5V20`,info:`M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18ZM12 12v4M12 8h.01`,key:`M12.7 11.3 21 3m-4.2 1.8 3 3M8 19a4 4 0 1 0 0-8 4 4 0 0 0 0 8Z`,download:`M12 4v10m0 0-4-4m4 4 4-4M5 20h14`,copy:`M9 9h11v11H9zM5 15H4V4h11v1`,trash:`M4.5 7h15M9.5 7V4.5h5V7m-7.5 0 .8 13h8.4l.8-13`,eye:`M2.5 12S6 6 12 6s9.5 6 9.5 6-3.5 6-9.5 6-9.5-6-9.5-6Zm9.5 2.4a2.4 2.4 0 1 0 0-4.8 2.4 2.4 0 0 0 0 4.8Z`,sparkles:`M12 4l1.8 4.7L18.5 10.5l-4.7 1.8L12 17l-1.8-4.7L5.5 10.5l4.7-1.8zM18.5 3l.8 2 2 .8-2 .8-.8 2-.8-2-2-.8 2-.8zM5 16l.7 1.8 1.8.7-1.8.7L5 21l-.7-1.8-1.8-.7 1.8-.7z`}[e]})})}function KP(){let[e,t]=(0,f.useState)(()=>window.matchMedia(WP).matches);return(0,f.useEffect)(()=>{let e=window.matchMedia(WP),n=()=>t(e.matches);return e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}var qP=0,JP=``;function YP(e){let t=(0,f.useRef)(null),n=(0,f.useId)();return(0,f.useEffect)(()=>{let e=document.activeElement,n=t.current;return qP===0&&(JP=document.body.style.overflow),qP+=1,document.body.style.overflow=`hidden`,n.showModal(),()=>{n.close(),--qP,qP===0&&(document.body.style.overflow=JP),e?.isConnected&&e.focus()}},[]),(0,pN.createPortal)((0,M.jsxs)(`dialog`,{ref:t,className:`chrome dialog ${e.drawer?`drawer`:``}`,"aria-labelledby":n,onCancel:t=>{t.preventDefault(),e.locked||e.onClose()},onKeyDown:e=>{if(e.key!==`Tab`)return;let t=[...e.currentTarget.querySelectorAll(`button:not(:disabled), input:not(:disabled), a[href], [tabindex='0']`)].filter(e=>e.getClientRects().length>0),n=t[0],r=t.at(-1);e.shiftKey&&document.activeElement===n?(e.preventDefault(),r?.focus()):!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),n?.focus())},children:[(0,M.jsxs)(`div`,{className:`dialog-heading`,children:[(0,M.jsx)(`h2`,{id:n,children:e.title}),(0,M.jsx)(`button`,{type:`button`,className:`icon-btn`,"aria-label":`关闭`,title:`关闭`,disabled:e.locked,onClick:e.onClose,children:(0,M.jsx)(GP,{name:`close`})})]}),e.children]}),document.body)}function XP(e){let t=(0,f.useRef)(null),n=(0,f.useRef)(e.onClose);n.current=e.onClose;let[r,i]=(0,f.useState)({left:8,top:8});return(0,f.useLayoutEffect)(()=>{let r=t.current,a=()=>{let t=e.anchor.getBoundingClientRect(),n=t.bottom+4+r.offsetHeight>window.innerHeight?Math.max(8,t.top-r.offsetHeight-4):t.bottom+4;i({left:Math.max(8,Math.min(t.left,window.innerWidth-r.offsetWidth-8)),top:n})};a(),r.querySelector(`button:not(:disabled), input, a`)?.focus();let o=t=>{!r.contains(t.target)&&!e.anchor.contains(t.target)&&n.current()};return document.addEventListener(`pointerdown`,o),window.addEventListener(`resize`,a),()=>{document.removeEventListener(`pointerdown`,o),window.removeEventListener(`resize`,a),e.anchor.isConnected&&e.anchor.focus()}},[e.anchor]),(0,pN.createPortal)((0,M.jsx)(`div`,{ref:t,className:`chrome popover`,role:`dialog`,"aria-label":e.label,style:r,onKeyDown:t=>{if(t.key===`Escape`&&(t.preventDefault(),t.stopPropagation(),e.onClose()),t.key===`Tab`){e.onClose();return}if(t.key!==`ArrowDown`&&t.key!==`ArrowUp`)return;t.preventDefault();let n=[...t.currentTarget.querySelectorAll(`button:not(:disabled), a`)];n[(n.indexOf(document.activeElement)+(t.key===`ArrowDown`?1:-1)+n.length)%n.length]?.focus()},children:e.children}),e.anchor.closest(`dialog`)??document.body)}var ZP=e=>e.split(/[\\/]/).filter(Boolean).at(-1)??e;function QP(e){return(0,M.jsx)(`button`,{type:`button`,className:`icon-btn focus-neko rounded hover:bg-black/5`,"aria-label":e.label,title:e.label,onClick:e.onClick,children:(0,M.jsx)(GP,{name:`close`,size:14})})}function $P(e){let{models:t,currentSessionId:n,view:r,phase:i,operating:a}=$A(),[o,s]=(0,f.useState)(null),c=t.find(t=>t.provider===e.current?.provider&&t.modelId===e.current?.modelId);o&&o.id!==n&&s(null);let l=c?.name??e.fallbackLabel;return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(`button`,{type:`button`,disabled:!c||i!==`ready`||a,onClick:()=>n&&s({id:n}),className:`focus-neko min-w-0 truncate rounded-full px-2 py-1 text-left text-xs text-ink-500 hover:bg-sakura-50`,"aria-label":`模型与思考强度:${l} ${r?.agent.thinkingLevel??``}`,children:[l,` · `,r?.agent.thinkingLevel??`off`,` ▾`]}),o&&o.id===n&&c&&(0,M.jsx)(eF,{session:o.id,current:c,level:r?.agent.thinkingLevel??`off`,onClose:()=>s(e=>e===o?null:e)},o.id)]})}function eF(e){let{models:t}=$A(),[n,r]=(0,f.useState)(e.current),[i,a]=(0,f.useState)(e.level),[o,s]=(0,f.useState)(!1),c=(0,f.useRef)(!1),[l,u]=(0,f.useState)(``);async function d(){if(!c.current){c.current=!0,s(!0),u(``);try{await dj.configure({model:{provider:n.provider,modelId:n.modelId},thinkingLevel:i},e.session),e.onClose()}catch{u(`配置失败,请重试。`)}finally{c.current=!1,s(!1)}}}return(0,M.jsx)(YP,{title:`模型与思考强度`,onClose:e.onClose,children:(0,M.jsxs)(`div`,{className:`space-y-5 p-5`,children:[(0,M.jsx)(`fieldset`,{className:`space-y-2`,"aria-label":`模型`,children:t.map(e=>(0,M.jsxs)(`button`,{type:`button`,disabled:o,"aria-pressed":e===n,onClick:()=>{r(e),a(e.thinkingLevelAdjustments[i])},className:`focus-neko block w-full rounded-xl border px-4 py-3 text-left text-sm ${e===n?`border-sakura-300 bg-sakura-50 text-sakura-800`:`border-sakura-200 bg-surface text-ink-700`}`,children:[e.name,e===n?` ✓`:``,(0,M.jsx)(`span`,{className:`mt-1 block text-xs text-ink-500`,children:e.input.includes(`image`)?`支持图片`:`仅文本`})]},`${e.provider}/${e.modelId}`))}),(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`p`,{className:`mb-2 text-sm text-ink-600`,children:`思考强度`}),(0,M.jsx)(`fieldset`,{className:`flex flex-wrap gap-2`,"aria-label":`思考强度`,children:n.supportedThinkingLevels.map(e=>(0,M.jsx)(`button`,{type:`button`,disabled:o,"aria-pressed":i===e,onClick:()=>a(e),className:`focus-neko rounded-full border px-4 py-2 text-sm ${e===i?`border-tianyi-300 bg-tianyi-50 text-tianyi-800`:`border-sakura-200`}`,children:e},e))})]}),(0,M.jsx)(`p`,{className:`text-xs text-ink-500`,children:`仅当前会话,从下一次请求生效。`}),l&&(0,M.jsx)(`p`,{role:`alert`,className:`text-sm text-sakura-800`,children:l}),(0,M.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,M.jsx)(`button`,{type:`button`,onClick:e.onClose,className:`btn-outline rounded-full px-4 py-2 text-sm`,children:`取消`}),(0,M.jsx)(`button`,{type:`button`,disabled:o,onClick:()=>void d(),className:`btn-primary rounded-full px-5 py-2 text-sm`,children:o?`应用中…`:`应用`})]})]})})}var tF=new Map,nF=new Set,rF=new Set;function iF(){let e=ej(),t=e.currentSessionId,n=t??`none:${e.workspaceRoot}`,r=tF.get(n);if(rF.size||e.operating)tj.notice({level:`info`,text:`发送中,请稍后刷新`});else if([...tF.values()].some(e=>e.files.length))tj.notice({level:`info`,text:`先发送或移除附件,再刷新`});else if(!e.webInfo)tj.notice({level:`error`,text:`连接未就绪,请稍后重试`});else if([...tF.entries()].some(([e,t])=>e!==n&&t.text.trim()))tj.notice({level:`info`,text:`其他会话有草稿,请先发送或清空`});else{try{ij({version:1,serverId:e.webInfo.serverId,workspace:e.workspaceRoot,session:t,text:r?.text??``,requestId:r?.requestId??crypto.randomUUID()})}catch{tj.notice({level:`error`,text:`草稿保存失败,请先复制文字`});return}window.location.reload()}}var aF=e=>(nF.add(e),()=>{nF.delete(e)});function oF(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function sF(e){return`$${e.toFixed(e>=1?2:4)}`}function cF(e){let{currentSessionId:t,workspaceRoot:n}=$A();return(0,M.jsx)(uF,{sessionId:t??`none:${n}`,...e},t??`none:${n}`)}function lF({file:e}){let[t,n]=(0,f.useState)(``);return(0,f.useEffect)(()=>{let t=URL.createObjectURL(e);return n(t),()=>URL.revokeObjectURL(t)},[e]),(0,M.jsx)(`img`,{src:t||void 0,alt:e.name,className:`h-16 w-20 rounded-lg object-cover`})}function uF(e){let{credentials:t,view:n,models:r,workspaceRoot:i,phase:a,operating:o}=$A(),s=n?.compaction?.active??[];tF.has(e.sessionId)||tF.set(e.sessionId,{text:``,files:[],requestId:crypto.randomUUID()}),(0,f.useEffect)(()=>{let t=rj(),n=ej();if(t&&t.serverId===n.webInfo?.serverId&&t.workspace===i&&(t.session??`none:${i}`)===e.sessionId){tF.set(e.sessionId,{text:t.text,files:[],requestId:t.requestId}),aj();for(let e of nF)e()}},[e.sessionId,i]);let c=(0,f.useSyncExternalStore)(aF,()=>tF.get(e.sessionId)),[l,u]=(0,f.useState)(!1),[d,p]=(0,f.useState)(``),[m,h]=(0,f.useState)(!1),[g,_]=(0,f.useState)([]),[v,y]=(0,f.useState)(0),[b,x]=(0,f.useState)(``),S=(0,f.useId)(),[C,w]=(0,f.useState)(!1),T=(0,f.useRef)(null),ee=(0,f.useRef)(null),E=(0,f.useRef)(null),te=(0,f.useRef)(c);te.current=c;let ne=(0,f.useRef)(!1),D=(0,f.useMemo)(()=>Cj(n?.items??[]),[n?.items]),re=(0,f.useRef)(null),ie=(0,f.useRef)(null);(0,f.useLayoutEffect)(()=>{let e=T.current;if(!ie.current||!e)return;let t=ie.current===`start`?0:e.value.length;ie.current=null,e.setSelectionRange(t,t),e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,160)}px`});let ae=e=>{let t=e.currentTarget,n=Ej(re.current,D,e,t.value,{start:t.selectionStart,end:t.selectionEnd});return n?(re.current=n.browse,ie.current=n.caret,h(!1),oe({text:n.text}),!0):!1},O=t=>{te.current=t,tF.set(e.sessionId,t);for(let e of nF)e()},oe=e=>O({...te.current,...e,requestId:crypto.randomUUID()}),se=n?.agent.model?.provider===`deepseek`&&t?.statuses.deepseek.source===`none`,ce=r.find(e=>e.provider===n?.agent.model?.provider&&e.modelId===n?.agent.model?.modelId),le=c.files.length>0&&ce!==void 0&&!ce.input.includes(`image`),ue=e=>{let t=e.map(e=>({id:crypto.randomUUID(),file:e,processing:!0,error:[`image/png`,`image/jpeg`,`image/webp`].includes(e.type)?e.size>20971520?`单图不能超过 20 MiB`:void 0:`仅支持 PNG、JPEG、WebP`}));oe({files:[...te.current.files,...t]});for(let e of t)de(e)},de=async t=>{let n=t.error;if(!n)try{(await createImageBitmap(t.file)).close()}catch{n=`无法解码图片,请重新选择`}let r=tF.get(e.sessionId);if(!r?.files.some(e=>e.id===t.id))return;let i={...r,files:r.files.map(e=>e.id===t.id?{...e,error:n,processing:!1}:e)};O(i)},fe=(0,f.useRef)(null),pe=(0,f.useRef)(!1);(0,f.useEffect)(()=>()=>{pe.current||fe.current?.abort()},[]),(0,f.useEffect)(()=>{if(_([]),y(0),!m)return;if(e.sessionId.startsWith(`none:`)){x(`新建会话后可选择工作区技能`);return}if(a!==`ready`||o){x(`等待会话连接…`);return}let t=new AbortController;return x(`正在加载技能…`),dj.listSkills(e.sessionId,t.signal).then(e=>{t.signal.aborted||(_(e),x(e.length?``:`当前工作区暂无可用技能`))}).catch(()=>{t.signal.aborted||x(`技能加载失败,请关闭菜单后重试`)}),()=>t.abort()},[e.sessionId,a,o,m]);let me=UP(T,ee,i,a===`ready`&&!o,(t,n)=>{let r=te.current;if(t.kind===`file`&&/\.(png|jpe?g|webp)$/i.test(t.path)){if(fe.current)return;let a=new AbortController;fe.current=a,p(`正在读取图片…`),(async()=>{let o=e.sessionId;if(o.startsWith(`none:`)){pe.current=!0,await dj.createSession();let e=ej();if(e.workspaceRoot!==i||!e.currentSessionId)throw Error(`工作区已切换`);o=e.currentSessionId,tF.set(o,r);for(let e of nF)e()}let s=await dj.workspaceImage(t.path,o,a.signal);if(a.signal.aborted||ej().currentSessionId!==o||ej().workspaceRoot!==i)return;let c=tF.get(o)??r,l={id:crypto.randomUUID(),file:new File([new Uint8Array(s.bytes)],s.name,{type:s.mimeType})},u=c.text===r.text?r.text.slice(0,n.start)+r.text.slice(n.end):c.text;tF.set(o,{...c,text:u,files:[...c.files,l],requestId:crypto.randomUUID()});for(let e of nF)e();p(``)})().catch(e=>{if(!a.signal.aborted){let t=e instanceof Error?e.message:`图片读取失败,请重试`;p(t),pe.current&&tj.notice({level:`error`,text:t})}}).finally(()=>{fe.current===a&&(fe.current=null)});return}let a=gj(r.text,n,t.path,t.kind===`directory`),o=T.current;if(o){o.focus(),o.setSelectionRange(n.start,n.end);let e=a.text.slice(n.start,a.text.length-(r.text.length-n.end));document.execCommand(`insertText`,!1,e)?oe({text:o.value}):oe({text:a.text}),requestAnimationFrame(()=>{o.setSelectionRange(a.cursor,a.cursor),t.kind===`directory`&&me.refresh()})}}),he=n?.contextUsage,ge=n?.compaction?.latest,_e=ge&&![`summarizing`,`waiting-to-apply`].includes(ge.phase)?ge.at+(ge.phase===`failed`?1e4:5e3):null,[ve,ye]=(0,f.useState)(_e!==null&&_e<=Date.now());(0,f.useEffect)(()=>{if(ye(_e!==null&&_e<=Date.now()),_e===null||_e<=Date.now())return;let e=setTimeout(()=>ye(!0),_e-Date.now());return()=>clearTimeout(e)},[_e]);let k=s.length?s.some(e=>e.retry)?`压缩重试中`:s.some(e=>e.blocking)?`等待上下文压缩`:`正在压缩上下文`:n?.compaction?.failure?`压缩失败:${n.compaction.failure.error}`:ge&&!ve?{applied:`上下文已压缩`,nothing:`当前无需压缩`,skipped:`已跳过过期摘要`,cancelled:`压缩已取消`,failed:`压缩失败,可重试`,summarizing:`正在压缩上下文`,"waiting-to-apply":`等待应用压缩摘要`}[ge.phase]:null,A=!s.length&&(!!n?.compaction?.failure||ge?.phase===`failed`),be=n?.taskUsage??n?.usage??null,xe=async t=>{if(ne.current||e.disabled)return;ne.current=!0,u(!0),rF.add(e.sessionId),p(``);let n=te.current;tF.set(e.sessionId,n);try{await dj.compact(t,e.sessionId),te.current===n&&tF.get(e.sessionId)===n&&Ei(n.text)!==null&&O({...n,text:``,requestId:crypto.randomUUID()}),h(!1)}catch(e){p(e instanceof Error?e.message:`压缩失败,请重试`)}finally{ne.current=!1,u(!1),rF.delete(e.sessionId)}},Se=async()=>{let t=Ei(te.current.text);if(t!==null){await xe(t);return}let n=te.current;if(tF.set(e.sessionId,n),!(ne.current||e.disabled||e.busy||se||le||!n.text.trim()&&!n.files.length)){if(n.files.length>4||n.files.reduce((e,t)=>e+t.file.size,0)>41943040)p(`每条消息最多 4 张图片,总大小不超过 40 MiB`);else if(!n.files.some(e=>e.processing)){if(n.files.some(e=>e.error))p(`请先移除不支持的附件`);else{ne.current=!0,u(!0),rF.add(e.sessionId),p(``);try{let t=[];for(let e of n.files)t.push({name:e.file.name,mimeType:e.file.type,bytes:new Uint8Array(await e.file.arrayBuffer())});let r=e.sessionId;if(r.startsWith(`none:`)){await dj.createSession();let e=ej();if(e.workspaceRoot!==i||!e.currentSessionId)throw Error(`工作区已切换,草稿已保留`);r=e.currentSessionId,tF.set(r,n);for(let e of nF)e()}if(await dj.submit(n.text.trim(),t,n.requestId,r),r!==e.sessionId){tF.set(r,{text:``,files:[],requestId:crypto.randomUUID()});for(let e of nF)e()}let a=tF.get(e.sessionId);a&&O({text:a.text===n.text?``:a.text,files:a.files.filter(e=>!n.files.some(t=>t.id===e.id)),requestId:crypto.randomUUID()})}catch(t){let n=t instanceof Error?t.message:`发送失败,请重试`;p(n),ej().currentSessionId!==e.sessionId&&tj.notice({level:`error`,text:n})}finally{ne.current=!1,u(!1),rF.delete(e.sessionId)}}}}},Ce=Tj(c.text,g),we=Math.min(v,Math.max(0,Ce.length-1)),Te=(e=we)=>{let t=Ce[e];t&&(oe({text:`${t.label} `}),h(!1),T.current?.focus())},Ee=e.busy||s.some(e=>e.reason===`manual`||e.blocking);return(0,M.jsx)(`section`,{"aria-label":`消息输入`,className:`relative shrink-0 px-3 pt-1 pb-3 sm:px-4 sm:pb-4`,onDragOver:e=>{e.dataTransfer.types.includes(`Files`)&&(e.preventDefault(),w(!0))},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||w(!1)},onDrop:e=>{e.preventDefault(),w(!1),ue(Array.from(e.dataTransfer.files))},children:(0,M.jsxs)(`div`,{className:`chat-column`,children:[(0,M.jsxs)(`div`,{ref:ee,className:`composer-card ${Ee?`is-busy`:``} ${C?`ring-2 ring-sakura-300`:``}`,children:[(0,M.jsxs)(`div`,{className:`flex flex-col gap-1 px-4 pt-2.5 empty:pt-0`,children:[C&&(0,M.jsx)(`p`,{className:`text-sm text-sakura-700`,children:`松开以添加图片,不会自动发送`}),se&&(0,M.jsxs)(`p`,{className:`text-sm text-sakura-700`,children:[`尚未配置 DeepSeek Key。`,(0,M.jsx)(Br,{to:`/settings`,className:`focus-neko underline`,children:`前往设置`})]}),le&&(0,M.jsx)(`p`,{className:`text-sm text-sakura-700`,children:`当前模型不支持图片,请切换模型或移除附件。`}),!ce?.input.includes(`image`)&&n?.items.some(e=>e.type===`user`&&e.images?.length)&&(0,M.jsx)(`p`,{className:`text-xs text-ink-500`,children:`当前模型无法查看历史原图,仍可使用已有文字分析。`}),d&&(0,M.jsx)(`p`,{role:`alert`,className:`break-words text-sm text-sakura-700`,children:d})]}),!!c.files.length&&(0,M.jsx)(`ul`,{className:`flex max-h-40 flex-wrap gap-2 overflow-y-auto px-4 pt-2.5`,children:c.files.map(e=>(0,M.jsxs)(`li`,{className:`relative w-28 rounded-xl border border-sakura-200 bg-base p-2`,children:[(0,M.jsx)(lF,{file:e.file}),(0,M.jsx)(`span`,{className:`block truncate text-xs`,title:e.file.name,children:e.file.name}),e.processing&&(0,M.jsx)(`span`,{className:`text-xs text-ink-500`,children:`检查图片…`}),e.error&&(0,M.jsx)(`span`,{className:`text-xs text-sakura-700`,children:e.error}),(0,M.jsx)(`button`,{type:`button`,"aria-label":`移除 ${e.file.name}`,className:`focus-neko absolute right-0 top-0 rounded-full bg-base px-1`,onClick:()=>oe({files:te.current.files.filter(t=>t.id!==e.id)}),children:`×`})]},e.id))}),(0,M.jsx)(`textarea`,{ref:T,disabled:e.disabled,value:c.text,rows:1,placeholder:`输入消息,@ 引用文件,/ 命令`,"aria-label":`消息输入`,"aria-autocomplete":`list`,"aria-controls":me.controls??(m?S:void 0),"aria-activedescendant":me.active??(m&&Ce.length?`${S}-${we}`:void 0),onClick:e=>{me.refresh(),h(wj(e.currentTarget.value))},onBlur:()=>{me.close(),h(!1)},onCompositionStart:()=>{me.close(),h(!1)},onCompositionEnd:e=>{me.refresh(),h(wj(e.currentTarget.value))},className:`max-h-40 min-h-10 min-w-0 w-full resize-none bg-transparent px-4 py-2 text-base text-ink-900 focus:outline-none`,onChange:e=>{re.current=null,oe({text:e.target.value}),y(0),h(!e.nativeEvent.isComposing&&wj(e.target.value)),e.nativeEvent.isComposing||me.refresh(),e.target.style.height=`auto`,e.target.style.height=`${Math.min(e.target.scrollHeight,160)}px`},onPaste:e=>{let t=Array.from(e.clipboardData.files);t.length&&(e.preventDefault(),ue(t))},onKeyDown:e=>{e.nativeEvent.isComposing||me.keyDown(e)||(e.key===`Escape`&&m?(e.preventDefault(),h(!1)):m&&(e.key===`ArrowDown`||e.key===`ArrowUp`)?(e.preventDefault(),y(Math.max(0,Math.min(Ce.length-1,we+(e.key===`ArrowDown`?1:-1))))):m&&e.key===`Tab`?!e.shiftKey&&Ce.length?(e.preventDefault(),Te()):h(!1):(e.key===`ArrowUp`||e.key===`ArrowDown`)&&!m&&ae(e)?e.preventDefault():e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),m&&Ce.length?Te():(h(!1),Se())))}}),(0,M.jsxs)(`div`,{className:`composer-toolbar flex flex-wrap items-center gap-x-1 gap-y-1 border-t border-sakura-100 px-2 py-1.5`,children:[(0,M.jsx)(`input`,{ref:E,type:`file`,accept:`image/png,image/jpeg,image/webp`,multiple:!0,hidden:!0,onChange:e=>{ue(Array.from(e.target.files??[])),e.target.value=``}}),(0,M.jsx)(`button`,{type:`button`,"aria-label":`添加图片`,title:`添加图片(最多 4 张)`,disabled:e.disabled,onClick:()=>E.current?.click(),className:`focus-neko inline-flex h-10 w-10 shrink-0 items-center justify-center rounded-full text-ink-600 hover:bg-sakura-50`,children:(0,M.jsx)(GP,{name:`plus`})}),(0,M.jsx)(`button`,{type:`button`,"aria-label":`输入操作菜单`,"aria-expanded":m,className:`focus-neko inline-flex h-10 w-10 shrink-0 items-center justify-center rounded-full text-ink-500 hover:bg-sakura-50`,onClick:()=>{me.close(),h(!m),T.current?.focus()},children:(0,M.jsx)(GP,{name:`more`})}),(0,M.jsx)(`div`,{className:`min-w-0 max-w-64 [&>button]:max-w-full`,children:(0,M.jsx)($P,{current:n?.agent.model??null,fallbackLabel:n?.model??`…`})}),he&&he.window>0&&(0,M.jsxs)(`span`,{className:`shrink-0 rounded-full bg-tianyi-50 px-2 py-1 font-mono text-xs ${he.percent!==null&&he.percent>90?`text-sakura-700 font-semibold`:`text-ink-600`}`,title:he.tokens===null?`暂无有效用量;首次回答或压缩后的新回答完成后更新`:`最近一次成功回答的上下文用量:${he.tokens} / ${he.window} tokens;非会话累计用量`,children:[`Ctx `,he.percent===null?`?`:`${he.percent.toFixed(1)}%`,`/`,oF(he.window)]}),(0,M.jsx)(`output`,{"aria-live":`polite`,"aria-atomic":`true`,className:`contents`,children:k&&(0,M.jsx)(`span`,{className:`max-w-full whitespace-nowrap rounded-full border px-2 py-1 text-xs ${A?`border-sakura-300 bg-sakura-50 text-sakura-700`:`border-tianyi-200 bg-tianyi-50 text-ink-600`}`,title:ge?.phase===`nothing`&&!s.length?`保留近期上下文,暂无可压缩的旧内容;默认保留最近约 20,000 tokens`:void 0,children:k})}),(0,M.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[e.busy&&e.status!==null&&(0,M.jsxs)(`span`,{className:`inline-flex min-w-0 max-w-64 items-center gap-1.5 text-xs font-medium text-sakura-700`,title:e.status,children:[(0,M.jsxs)(`span`,{className:`dots shrink-0`,"aria-hidden":!0,children:[(0,M.jsx)(`span`,{}),(0,M.jsx)(`span`,{}),(0,M.jsx)(`span`,{})]}),(0,M.jsx)(`span`,{className:`truncate`,children:e.status.replace(/\.\.\.$/,``)})]}),be!==null&&(0,M.jsxs)(`button`,{type:`button`,className:`telemetry focus-neko shrink-0 rounded-full px-1.5 py-1 font-mono text-xs text-ink-500`,"aria-label":`任务总用量:输入 ${be.input},输出 ${be.output},缓存读 ${be.cacheRead},成本 ${sF(be.cost)}`,children:[`↑`,oF(be.input),` ↓`,oF(be.output),(0,M.jsxs)(`span`,{className:`telemetry-detail`,"aria-hidden":!0,children:[`输入 `,be.input,` · 输出 `,be.output,` · 缓存读 `,be.cacheRead,` · `,sF(be.cost)]})]}),(0,M.jsx)(`button`,{type:`button`,disabled:l||e.disabled||!c.text.trim()&&!c.files.length||Ei(c.text)===null&&(e.busy||se||le||c.files.some(e=>!!e.error||e.processing)),onClick:()=>void Se(),className:`btn-primary focus-neko h-10 shrink-0 rounded-full px-3 text-sm disabled:opacity-50`,children:l?`处理中`:`发送`}),Ee&&(0,M.jsx)(`button`,{type:`button`,onClick:()=>dj.abort(),className:`btn-stop focus-neko h-10 rounded-full px-2 text-sm`,title:`中止当前会话运行及可中止任务`,children:`停止`})]})]})]}),me.panel,m&&!me.open&&(0,M.jsx)(HP,{anchor:ee,id:S,title:`输入命令`,items:Ce,selected:we,onSelect:y,message:b||(Ce.length?void 0:`没有匹配的命令或技能`),onAccept:Te})]})})}var dF=[{key:`credentials`,label:`密钥`,icon:`key`,to:`/settings`},{key:`about`,label:`关于与更新`,icon:`info`,to:`/about`}];function fF({active:e,children:t}){return(0,M.jsxs)(`div`,{className:`flex min-h-dvh flex-col bg-base sm:flex-row`,children:[(0,M.jsxs)(`nav`,{"aria-label":`设置菜单`,className:`flex shrink-0 items-center gap-1 overflow-x-auto border-b border-sakura-100 px-4 py-2.5 sm:w-48 sm:flex-col sm:items-stretch sm:gap-1 sm:border-r sm:border-b-0 sm:px-3 sm:py-5`,children:[(0,M.jsx)(Br,{to:`/`,className:`focus-neko mr-2 inline-flex shrink-0 items-center rounded-lg px-2 py-1.5 text-sm text-sakura-700 sm:mr-0 sm:mb-3`,children:`← 返回聊天`}),(0,M.jsx)(`span`,{className:`hidden px-2 pb-1 text-xs font-medium text-ink-400 sm:block`,children:`设置`}),dF.map(t=>(0,M.jsxs)(Br,{to:t.to,"aria-current":e===t.key?`page`:void 0,className:`focus-neko inline-flex shrink-0 items-center gap-2 rounded-xl px-3 py-2 text-sm ${e===t.key?`bg-sakura-100 font-semibold text-sakura-800`:`text-ink-600 hover:bg-ink-100`}`,children:[(0,M.jsx)(GP,{name:t.icon,size:15}),t.label]},t.key))]}),(0,M.jsx)(`div`,{className:`min-w-0 flex-1`,children:t})]})}async function pF(){let e;try{await navigator.clipboard.writeText(`neko update`),e=`已复制 neko update,在运行 neko 的电脑上执行`}catch{e=`请复制命令:neko update`}return tj.notice({level:`info`,text:e}),e}function mF(){let{updates:e,webInfo:t}=$A();return bi({gateway:e,frontend:_i,installed:t?.installedVersion??null,web:t?{runningVersion:t.webVersion,installedVersion:t.installedVersion}:void 0})}function hF(){let e=mF(),[t,n]=(0,f.useState)(null);return e===`none`||t===e?null:(0,M.jsxs)(`output`,{className:`flex min-w-0 flex-wrap items-center justify-end gap-x-3 gap-y-1 border-b border-sakura-100 bg-sakura-50 px-4 py-1.5 text-xs text-ink-700`,children:[(0,M.jsx)(`span`,{children:e===`install`?`发现新版本 · 运行 neko update`:e===`refresh-page`?`页面已更新`:e===`incompatible`?`版本不兼容 · 更新并重启 neko`:`已升级 · 请重新启动本地 neko`}),e===`install`?(0,M.jsx)(`button`,{type:`button`,className:`focus-neko rounded px-2 py-1 text-sakura-700`,onClick:()=>void pF(),children:`复制命令`}):e===`refresh-page`?(0,M.jsx)(`button`,{type:`button`,className:`focus-neko rounded px-2 py-1 text-sakura-700`,onClick:iF,children:`刷新`}):(0,M.jsx)(Br,{to:`/about`,className:`focus-neko rounded px-2 py-1 text-sakura-700`,children:`查看步骤`}),(0,M.jsx)(QP,{label:`关闭更新提示`,onClick:()=>n(e)})]})}function gF(){let{updates:e,webInfo:t,phase:n}=$A(),r=mF(),[i,a]=(0,f.useState)(!1),[o,s]=(0,f.useState)(``),c=rj();async function l(){if(!i){a(!0),s(``);try{let e=await dj.checkUpdates();s(e.checkState===`ok`?`检查完成`:e.checkState===`development`?`开发版本不检查发布更新`:`检查失败,请重试`)}catch{s(`检查失败,请重试`)}finally{a(!1)}}}return(0,M.jsxs)(fF,{active:`about`,children:[(0,M.jsxs)(`div`,{className:`mx-auto w-full max-w-4xl px-5 pt-6 pb-3`,children:[(0,M.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-2`,children:[(0,M.jsx)(`h1`,{className:`text-xl font-bold text-ink-900`,children:`关于与更新`}),(0,M.jsx)(`span`,{className:`ml-auto text-xs text-ink-500`,children:n===`ready`?`已连接`:`连接中…`})]}),(0,M.jsx)(`p`,{className:`mt-1 text-sm text-ink-500`,children:`查看 neko 系统版本状态及软件更新。`})]}),(0,M.jsxs)(`main`,{className:`mx-auto flex w-full max-w-4xl flex-col gap-5 px-5 pb-8`,children:[(0,M.jsxs)(`section`,{className:`rounded-2xl border border-sakura-200 bg-surface p-5 shadow-soft`,children:[(0,M.jsx)(`h2`,{className:`mb-4 text-base font-bold text-ink-900`,children:`版本状态`}),(0,M.jsxs)(`div`,{className:`flex flex-col divide-y divide-sakura-100`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between py-3`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`span`,{className:`text-sm font-medium text-ink-800`,children:`当前版本`}),(0,M.jsx)(`span`,{className:`ml-3 font-mono text-sm text-ink-600`,children:_i})]}),(0,M.jsx)(`div`,{children:i?(0,M.jsx)(`span`,{className:`rounded-full bg-ink-100 px-2.5 py-0.5 text-xs text-ink-600`,children:`检查中…`}):r===`incompatible`?(0,M.jsx)(`span`,{className:`rounded-full bg-sakura-100 px-2.5 py-0.5 text-xs font-semibold text-sakura-800`,children:`协议不兼容`}):r===`install`?(0,M.jsx)(`span`,{className:`rounded-full bg-sakura-100 px-2.5 py-0.5 text-xs font-semibold text-sakura-800`,children:`发现新版本`}):r===`restart-service`?(0,M.jsx)(`span`,{className:`rounded-full bg-tianyi-100 px-2.5 py-0.5 text-xs font-semibold text-tianyi-800`,children:`已就绪 · 待重启`}):r===`refresh-page`?(0,M.jsx)(`span`,{className:`rounded-full bg-tianyi-100 px-2.5 py-0.5 text-xs font-semibold text-tianyi-800`,children:`页面待更新`}):e?.checkState===`development`?(0,M.jsx)(`span`,{className:`rounded-full bg-ink-100 px-2.5 py-0.5 text-xs text-ink-600`,children:`开发版本`}):e?.checkState===`failed`?(0,M.jsx)(`span`,{className:`rounded-full bg-sakura-100 px-2.5 py-0.5 text-xs text-sakura-800`,children:`检查失败`}):(0,M.jsx)(`span`,{className:`rounded-full bg-tianyi-50 px-2.5 py-0.5 text-xs font-medium text-tianyi-800`,children:`已是最新`})})]}),r===`install`&&e?.latestVersion&&(0,M.jsxs)(`div`,{className:`mt-1 flex items-center justify-between rounded-xl bg-sakura-50/60 px-3 py-3`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`span`,{className:`text-sm font-semibold text-sakura-800`,children:`最新稳定版`}),(0,M.jsx)(`span`,{className:`ml-3 font-mono text-sm text-sakura-900`,children:e.latestVersion})]}),(0,M.jsx)(`span`,{className:`text-xs text-sakura-700`,children:`可运行 neko update 升级`})]}),r===`restart-service`&&(0,M.jsxs)(`div`,{className:`mt-1 flex items-center justify-between rounded-xl bg-tianyi-50/60 px-3 py-3`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`span`,{className:`text-sm font-semibold text-tianyi-800`,children:`已安装新版本`}),(0,M.jsx)(`span`,{className:`ml-3 font-mono text-sm text-tianyi-900`,children:e?.installedVersion??t?.installedVersion??`新版本`})]}),(0,M.jsx)(`span`,{className:`text-xs text-tianyi-700`,children:`重启 neko 进程后生效`})]}),r===`refresh-page`&&(0,M.jsxs)(`div`,{className:`mt-1 flex items-center justify-between rounded-xl bg-tianyi-50/60 px-3 py-3`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`span`,{className:`text-sm font-semibold text-tianyi-800`,children:`静态服务已更新`}),(0,M.jsx)(`span`,{className:`ml-3 font-mono text-sm text-tianyi-900`,children:t?.webVersion??`新版本`})]}),(0,M.jsx)(`span`,{className:`text-xs text-tianyi-700`,children:`刷新页面后生效`})]})]}),(0,M.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-3`,children:[(0,M.jsx)(`button`,{type:`button`,className:`focus-neko rounded-full bg-sakura-100 px-4 py-1.5 text-sm font-semibold text-sakura-800 disabled:opacity-50`,disabled:i,onClick:()=>void l(),children:i?`检查中…`:`检查更新`}),r===`install`?(0,M.jsx)(`button`,{type:`button`,className:`focus-neko rounded-full bg-sakura-100 px-4 py-1.5 text-sm font-semibold text-sakura-800`,onClick:()=>void pF().then(s),children:`复制 neko update`}):(0,M.jsx)(`button`,{type:`button`,className:`focus-neko rounded-full border border-sakura-200 bg-surface px-4 py-1.5 text-sm text-ink-600 hover:bg-sakura-50`,onClick:()=>void pF().then(s),children:`复制 neko update`}),r===`refresh-page`&&(0,M.jsx)(`button`,{type:`button`,className:`focus-neko rounded-full bg-tianyi-100 px-4 py-1.5 text-sm font-semibold text-tianyi-800`,onClick:iF,children:`刷新页面`})]}),o&&(0,M.jsx)(`output`,{className:`mt-3 block text-xs text-tianyi-800`,children:o})]}),(0,M.jsxs)(`section`,{className:`rounded-2xl border border-sakura-200 bg-surface p-5 shadow-soft`,children:[(0,M.jsx)(`h2`,{className:`mb-2 text-base font-bold text-ink-900`,children:`升级说明`}),(0,M.jsxs)(`p`,{className:`text-sm text-ink-600`,children:[`在终端运行`,` `,(0,M.jsx)(`code`,{className:`select-all rounded bg-ink-100 px-1.5 py-0.5 font-mono text-xs text-ink-800`,children:`neko update`}),`,完成后重启 neko 即可生效。`]}),c?.text&&(0,M.jsxs)(`details`,{className:`mt-4 border-t border-sakura-100 pt-3 text-sm`,children:[(0,M.jsx)(`summary`,{className:`focus-neko cursor-pointer font-medium text-ink-700`,children:`升级前保留的草稿`}),(0,M.jsx)(`p`,{className:`mt-2 max-h-48 overflow-y-auto whitespace-pre-wrap break-words rounded-xl bg-ink-50 p-3 font-mono text-xs text-ink-600 select-text`,children:c.text})]})]})]})]})}var _F={pending:`等待审批`,allowed:`已允许本次`,denied:`已拒绝`,cancelled:`已取消`},vF=e=>[...e].map(e=>{let t=e.charCodeAt(0);return t<32&&t!==9&&t!==10||t>=127&&t<=159||t>=8234&&t<=8238||t>=8294&&t<=8297?`\\u${t.toString(16).padStart(4,`0`)}`:e}).join(``);function yF({item:e,title:t,decide:n}){let[r,i]=(0,f.useState)(!1),[a,o]=(0,f.useState)(``),s=(0,f.useRef)(!1),c=async t=>{if(!(s.current||e.status!==`pending`)){s.current=!0,i(!0),o(``);try{await n(t)}catch(e){o(String(e))}finally{s.current=!1,i(!1)}}};return(0,M.jsxs)(`section`,{"aria-label":`Bash 审批`,className:`min-w-0 rounded-xl border border-sakura-200 bg-surface p-3 text-sm`,children:[(0,M.jsxs)(`output`,{className:`block font-medium text-sakura-800`,children:[t,` · Bash · `,_F[e.status]]}),(0,M.jsxs)(`p`,{className:`break-all text-xs text-ink-500`,children:[vF(e.cwd),` · 超时:`,e.timeout??`默认`]}),(0,M.jsx)(`textarea`,{readOnly:!0,rows:Math.min(6,Math.max(1,e.command.split(`
|
|
13
|
+
`).length)),"aria-label":`完整命令`,value:vF(e.command),className:`focus-neko my-2 w-full resize-y whitespace-pre-wrap break-all rounded-lg bg-base p-2 font-mono text-xs`}),e.status===`pending`&&(0,M.jsxs)(`div`,{className:`flex gap-2`,children:[(0,M.jsx)(`button`,{type:`button`,disabled:r,className:`focus-neko rounded-lg bg-tianyi-100 px-3 py-1 text-tianyi-800 disabled:opacity-50`,onClick:()=>void c(`allowed`),children:`允许本次`}),(0,M.jsx)(`button`,{type:`button`,disabled:r,className:`focus-neko rounded-lg border border-sakura-300 px-3 py-1 disabled:opacity-50`,onClick:()=>void c(`denied`),children:`拒绝`})]}),a&&(0,M.jsx)(`p`,{role:`alert`,className:`break-all text-xs text-sakura-800`,children:a})]})}function bF(){let{phase:e,operating:t,currentSessionId:n,view:r}=$A(),[,i]=(0,f.useState)(0),a=(0,f.useRef)(null),[o,s]=(0,f.useState)(null),c=e===`ready`&&!t&&r!==null;if((0,f.useEffect)(()=>{if(!c||!n)return;let e=!0,t=new VA(e=>dj.subagent(e),()=>{e&&i(e=>e+1)});return a.current=t,s(t),()=>{e=!1,a.current=null,t.close(),s(null)}},[c,n]),(0,f.useEffect)(()=>{c&&o===a.current&&o?.update(r?.subagents??[])},[o,c,r?.subagents]),!c||!o)return null;let l=o.pending;return!l.length&&!o.error?null:(0,M.jsxs)(`section`,{"aria-label":`待审批命令`,className:`max-h-[40dvh] shrink-0 space-y-2 overflow-auto px-3 py-2`,children:[l.map(({item:e,title:t,service:n})=>(0,M.jsx)(yF,{item:e,title:t,decide:t=>n.decideApproval({id:e.id,version:e.version,decision:t})},`${e.id}:${e.version}`)),o.error&&(0,M.jsx)(`p`,{role:`alert`,className:`text-sm text-sakura-800`,children:o.error})]})}function xF(e){let t=Math.max(0,Math.floor(e/1e3));if(t<60)return`${t}s`;let n=Math.floor(t/60);if(t<3600)return`${n}m ${t%60}s`;let r=Math.floor(t/3600);return t<86400?`${r}h ${n%60}m`:`${Math.floor(t/86400)}d ${r%24}h`}var SF=e=>e.split(`
|
|
14
|
+
`).map(e=>e.trim()).find(Boolean)??``;function CF(e){return e.title.trim()||SF(e.command)||`(empty command)`}function wF(e,t){return e.status===`running`?xF(t-e.startedAt):e.reason===`timeout`?`timeout`:e.exitCode===null?e.reason===`restart`?`restart`:xF((e.endedAt??t)-e.startedAt):`exit ${e.exitCode}`}var TF=e=>Number.parseInt(e.replace(/^\D+/,``),10)||0;function EF(e,t){let n=[...e].sort((e,t)=>t.startedAt-e.startedAt||TF(t.jobId)-TF(e.jobId)).map(e=>{let n=e.status===`running`;return{job:e,label:CF(e),running:n,statusText:e.status,meta:wF(e,t),durationMs:Math.max(0,(e.endedAt??t)-e.startedAt)}});return{rows:n,running:n.filter(e=>e.running).length}}function DF(e){let t=e.split(`
|
|
15
|
+
`),n=t[0]??``,r=t[1]?.startsWith(`Command: `)?t[1].slice(9):void 0,i=t.findIndex((e,t)=>t>0&&e.startsWith(`Last output (`)),a=i<0?void 0:t.slice(i+1).join(`
|
|
16
|
+
`);return{head:n,command:r,output:a===``?void 0:a}}var OF=262144,kF=class{#e=``;#t=0;#n;#r;constructor(e=OF){this.#r=e}get text(){return this.#e}get dropped(){return this.#t}get offset(){return this.#n}apply(e,t=e=>e){if(this.#n===void 0?this.#t=e.dropped:e.truncated&&(this.#t+=e.dropped),this.#n=e.offset,this.#e+=t(e.text),this.#e.length>this.#r){let e=this.#e.length-this.#r;this.#e=this.#e.slice(e),this.#t+=e}}},AF={running:`运行中`,exited:`已退出`,failed:`失败`,stopped:`已停止`,lost:`已丢失`};function jF(e,t){let n=AF[e.status];return e.status===`running`?`${n} · ${xF(t-e.startedAt)}`:e.reason===`timeout`?`${n} · 超时`:e.reason===`spawn-error`?`${n} · 无法启动`:e.exitCode===null?e.reason===`restart`?`${n} · 网关重启`:`${n} · ${xF((e.endedAt??t)-e.startedAt)}`:`${n} · 退出码 ${e.exitCode}`}var MF=/\u001b(?:\[[0-?]*[ -/]*[@-~]|\][^\u0007\u001b]*(?:\u0007|\u001b\\)|[@-Z\\-_])/g,NF=/[\u0000-\u0008\u000b-\u001f\u007f]/g;function PF(e){return e.replace(MF,``).replace(/\r\n?/g,`
|
|
17
|
+
`).replace(NF,``)}function FF(e,t=24){return e.scrollHeight-e.scrollTop-e.clientHeight<=t}var IF=1e3,LF=e=>e instanceof Error?e.message:String(e);function RF({sessionId:e,job:t}){let n=t.jobId,r=(0,f.useRef)(new kF),[,i]=(0,f.useState)(0),[a,o]=(0,f.useState)(``),[s,c]=(0,f.useState)(!0),[l,u]=(0,f.useState)(!1),d=(0,f.useRef)(!0),p=(0,f.useRef)(null),m=t.status===`running`,h=(0,f.useRef)(m);h.current=m;let[g,_]=(0,f.useState)(Date.now);(0,f.useEffect)(()=>{if(!m)return;let e=setInterval(()=>_(Date.now()),IF);return()=>clearInterval(e)},[m]),(0,f.useEffect)(()=>{let t=!1,a,s=async()=>{let c=h.current;try{let l=await dj.jobOutput(e,n,r.current.offset);if(t)return;r.current.apply(l,PF),o(``),i(e=>e+1),c&&(a=setTimeout(()=>void s(),IF))}catch(e){t||o(LF(e))}};return s(),()=>{t=!0,clearTimeout(a)}},[e,n]),(0,f.useLayoutEffect)(()=>{let e=p.current;e&&d.current&&(e.scrollTop=e.scrollHeight)});let v=(0,f.useCallback)(()=>{let e=p.current;e&&(d.current=!0,c(!0),e.scrollTop=e.scrollHeight)},[]),y=()=>{l||(u(!0),dj.jobStop(e,n).catch(e=>o(LF(e))).finally(()=>u(!1)))},b=r.current.text;return(0,M.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,M.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-1 border-b border-sakura-100 p-3 text-xs`,children:[(0,M.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,M.jsx)(`span`,{className:`font-medium text-ink-800`,children:jF(t,g)}),m&&(0,M.jsx)(`button`,{type:`button`,disabled:l,className:`focus-neko rounded-lg border border-sakura-300 px-2 py-0.5 disabled:opacity-50`,onClick:y,children:l?`正在停止…`:`停止任务`})]}),(0,M.jsx)(`code`,{className:`max-h-20 overflow-auto whitespace-pre-wrap break-all text-ink-700`,children:t.command}),(0,M.jsx)(`span`,{className:`break-all text-ink-500`,children:t.cwd})]}),a&&(0,M.jsx)(`p`,{role:`alert`,className:`shrink-0 p-3 text-sm text-sakura-800`,children:a}),(0,M.jsxs)(`div`,{className:`relative min-h-0 flex-1`,children:[(0,M.jsxs)(`div`,{ref:p,"data-testid":`job-output`,className:`h-full overflow-y-auto overflow-x-hidden p-3`,onScroll:e=>{let t=FF(e.currentTarget);d.current=t,c(t)},children:[r.current.dropped>0&&(0,M.jsxs)(`p`,{className:`mb-2 text-xs text-sakura-800`,children:[`… 已省略更早的 `,r.current.dropped,` 字节输出`]}),b===``?(0,M.jsx)(`p`,{className:`text-xs text-ink-500`,children:r.current.offset===void 0?`读取中…`:`暂无输出`}):(0,M.jsx)(`pre`,{className:`whitespace-pre-wrap break-words font-mono text-xs text-ink-800`,children:b})]}),!s&&(0,M.jsx)(`button`,{type:`button`,onClick:v,className:`focus-neko discrete-in absolute right-3 bottom-3 rounded-full border border-sakura-300 bg-surface px-3.5 py-1 text-xs font-medium text-sakura-800 hover:bg-sakura-50`,children:`回到底部 ↓`})]})]})}function zF({sessionId:e,jobs:t,open:n,onClose:r}){let[i,a]=(0,f.useState)(null),[o,s]=(0,f.useState)(Date.now),c=(0,f.useRef)(null),l=(0,f.useRef)(null),[u,d]=(0,f.useState)(()=>window.matchMedia(`(max-width: 1023px)`).matches);(0,f.useEffect)(()=>{let e=window.matchMedia(`(max-width: 1023px)`),t=()=>d(e.matches);return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]);let p=EF(t,o);(0,f.useEffect)(()=>{if(!n||p.running===0)return;let e=setInterval(()=>s(Date.now()),IF);return()=>clearInterval(e)},[n,p.running]),(0,f.useEffect)(()=>{if(!n)return;let e=document.activeElement,t=u&&l.current?.parentElement?[...l.current.parentElement.children].filter(e=>e instanceof HTMLElement&&e!==l.current):[],r=t.map(e=>e.inert);return t.forEach(e=>{e.inert=!0}),c.current?.focus(),()=>{t.forEach((e,t)=>{e.inert=r[t]}),e?.isConnected&&e.focus()}},[n,u]);let m=p.rows.find(e=>e.job.jobId===i)??p.rows[0];return(0,M.jsxs)(`aside`,{ref:l,role:u?`dialog`:`complementary`,"aria-modal":u&&n?!0:void 0,"aria-label":`后台任务`,className:`${n?`flex`:`hidden`} fixed inset-0 z-30 min-w-0 flex-col border-l border-sakura-200 bg-base lg:static lg:z-auto lg:w-[min(42vw,40rem)] lg:shrink-0`,onKeyDown:e=>{if(e.currentTarget.contains(e.target)){if(e.key===`Tab`&&window.innerWidth<1024){let t=[...e.currentTarget.querySelectorAll(`button:not([disabled]),a[href],summary,[tabindex='0']`)].filter(e=>e.getClientRects().length>0),n=t[0],r=t.at(-1);e.shiftKey&&document.activeElement===n?(e.preventDefault(),r?.focus()):!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),n?.focus())}e.key===`Escape`&&(e.stopPropagation(),r())}},children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between border-b border-sakura-200 px-4 py-1.5`,children:[(0,M.jsx)(`strong`,{className:`text-sm text-ink-800`,children:`后台任务`}),(0,M.jsx)(`button`,{ref:c,type:`button`,className:`focus-neko rounded-lg px-2 py-1 text-sm text-ink-600 hover:bg-sakura-50`,onClick:r,children:`关闭`})]}),p.rows.length===0?(0,M.jsx)(`p`,{className:`p-4 text-sm text-ink-500`,children:`这个会话还没有后台任务。`}):(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`div`,{className:`max-h-44 shrink-0 overflow-auto border-b border-sakura-100 p-2`,children:p.rows.map(e=>(0,M.jsxs)(`button`,{type:`button`,"aria-pressed":m?.job.jobId===e.job.jobId,className:`focus-neko flex w-full min-w-0 items-center gap-2 rounded-lg px-2 py-1.5 text-left text-sm ${m?.job.jobId===e.job.jobId?`bg-tianyi-100`:`hover:bg-sakura-50`}`,onClick:()=>a(e.job.jobId),children:[(0,M.jsxs)(`span`,{className:`min-w-0 flex-1 truncate`,children:[(0,M.jsx)(`span`,{className:`text-tianyi-700`,children:e.job.jobId}),` · `,e.label]}),(0,M.jsx)(`span`,{className:`shrink-0 text-xs text-ink-500`,children:jF(e.job,o)})]},e.job.jobId))}),n&&m&&(0,M.jsx)(RF,{sessionId:e,job:m.job},`${e}:${m.job.jobId}`)]})]})}function BF(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var VF=BF();function HF(e){VF=e}var UF={exec:()=>null};function WF(e){let t=[];return n=>{let r=Math.max(0,Math.min(3,n-1)),i=t[r];return i||(i=e(r),t[r]=i),i}}function GF(e,t=``){let n=typeof e==`string`?e:e.source,r={replace:(e,t)=>{let i=typeof t==`string`?t:t.source;return i=i.replace(qF.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var KF=((e=``)=>{try{return!!RegExp(`(?<=1)(?<!1)`+e)}catch{return!1}})(),qF={codeRemoveIndent:/^(?: {0,3}\t| {1,4})/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,endingSpaceTabChar:/[ \t]$/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,leadingSpaceTab:/^[ \t]+/,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,numericCharacterReference:/&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));/g,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:WF(e=>RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:WF(e=>RegExp(`^ {0,${e}}((?:-[ ]*){3,}|(?:_[ ]*){3,}|(?:\\*[ ]*){3,})(?:\\n+|$)`)),fencesBeginRegex:WF(e=>RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:WF(e=>RegExp(`^ {0,${e}}#`)),htmlBeginRegex:WF(e=>RegExp(`^ {0,${e}}(?:</?(?:${cI})(?: +|$|/?>)|<(?:script|pre|style|textarea|!--))`,`i`)),blockquoteBeginRegex:WF(e=>RegExp(`^ {0,${e}}>`))},JF=/^(?:[ \t]*(?:\n|$))+/,YF=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,XF=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,ZF=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,QF=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,$F=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,eI=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |fences|blockquote|heading|hr|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,tI=GF(eI).replace(/bull/g,$F).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,``).getRegex(),nI=GF(eI).replace(/bull/g,$F).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),rI=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,iI=/^[^\n]+/,aI=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,oI=GF(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,aI).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),sI=GF(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,$F).getRegex(),cI=`address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul`,lI=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,uI=GF(`^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][a-z0-9-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][a-z0-9-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))`,`i`).replace(`comment`,lI).replace(`tag`,cI).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),dI=e=>GF(rI).replace(`hr`,ZF).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,e).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,cI).getRegex(),fI=dI(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),pI=dI(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),mI={blockquote:GF(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,pI).getRegex(),code:YF,def:oI,fences:XF,heading:QF,hr:ZF,html:uI,lheading:tI,list:sI,newline:JF,paragraph:fI,table:UF,text:iI},hI=GF(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,ZF).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`blockquote`,` {0,3}>`).replace(`code`,`(?: {4}| {0,3} )[^\\n]`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,cI).getRegex(),gI={...mI,lheading:nI,table:hI,paragraph:GF(rI).replace(`hr`,ZF).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,hI).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,cI).getRegex()},_I={...mI,html:GF(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,lI).replace(/tag/g,`(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b`).getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:UF,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:GF(rI).replace(`hr`,ZF).replace(`heading`,` *#{1,6} *[^
|
|
18
|
+
]`).replace(`lheading`,tI).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},vI=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,yI=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,bI=/^( {2,}|\\)\n(?!\s*$)[ \t]*/,xI=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,SI=/[\p{P}\p{S}]/u,CI=/[\s\p{P}\p{S}]/u,wI=/[^\s\p{P}\p{S}]/u,TI=GF(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,CI).getRegex(),EI=/[\p{Pi}\p{Ps}"']/u,DI=/(?!~)[\p{P}\p{S}]/u,OI=/(?!~)[\s\p{P}\p{S}]/u,kI=/(?:[^\s\p{P}\p{S}]|~)/u,AI=GF(/link|precode-code|html/,`g`).replace(`link`,/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace(`precode-`,KF?"(?<!`)()":"(^^|[^`])").replace(`code`,/(?<b>`+)[^`]+\k<b>(?!`)/).replace(`html`,/<(?! )[^<>]*?>/).getRegex(),jI=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,MI=GF(jI,`u`).replace(/punct/g,SI).getRegex(),NI=GF(jI,`u`).replace(/punct/g,DI).getRegex(),PI=GF(/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,`u`).replace(/openQuote/g,EI).replace(/punct/g,SI).getRegex(),FI=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,II=GF(FI,`gu`).replace(/notPunctSpace/g,wI).replace(/punctSpace/g,CI).replace(/punct/g,SI).getRegex(),LI=GF(FI,`gu`).replace(/notPunctSpace/g,kI).replace(/punctSpace/g,OI).replace(/punct/g,DI).getRegex(),RI=GF(`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,wI).replace(/punctSpace/g,CI).replace(/punct/g,SI).getRegex(),zI=GF(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,wI).replace(/punctSpace/g,CI).replace(/punct/g,SI).getRegex(),BI=GF(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,wI).replace(/punctSpace/g,CI).replace(/punct/g,SI).getRegex(),VI=GF(/^~~?(?:((?!~)punct)|[^\s~])/,`u`).replace(/punct/g,SI).getRegex(),HI=GF(`^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,wI).replace(/punctSpace/g,CI).replace(/punct/g,SI).getRegex(),UI=GF(/\\(punct)/,`gu`).replace(/punct/g,SI).getRegex(),WI=GF(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace(`scheme`,/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace(`email`,/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),GI=GF(lI).replace(`(?:-->|$)`,`-->`).getRegex(),KI=GF(`^comment|^</[a-zA-Z][a-zA-Z0-9-]*\\s*>|^<[a-zA-Z][a-zA-Z0-9-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>`).replace(`comment`,GI).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),qI=/\[(?:\\[\s\S]|[^\[\]\\])*\]/,JI=GF(/(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/).replace(`brackets`,qI).getRegex(),YI=GF(/^!?\[(label)\]\([ \t\n]*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?[ \t\n]*\)/).replace(`label`,JI).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),XI=GF(/^!?\[(label)\]\[(ref)\]/).replace(`label`,JI).replace(`ref`,aI).getRegex(),ZI=GF(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,aI).getRegex(),QI=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\]){1,999}/,$I=GF(/(?:[^\[\]\\`]*(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\]))){0,999}?[^\[\]\\`]*?/).replace(`brackets`,qI).getRegex(),eL=GF(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,GF(/^!?\[(label)\]\[(ref)\]/).replace(`label`,$I).replace(`ref`,QI).getRegex()).replace(`nolink`,GF(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,QI).getRegex()).getRegex(),tL=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,nL=GF(/(?:mailto:email|xmpp:email(?:\/[A-Za-z0-9@.]+)?)/).replace(/email/g,/[A-Za-z0-9._+-]+@[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(),rL={_backpedal:UF,anyPunctuation:UI,autolink:WI,blockSkip:AI,br:bI,code:yI,del:UF,delLDelim:UF,delRDelim:UF,emStrongLDelim:MI,emStrongRDelimAst:II,emStrongRDelimUnd:zI,escape:vI,link:YI,nolink:ZI,punctuation:TI,reflink:XI,reflinkSearch:eL,tag:KI,text:xI,url:UF},iL={...rL,emStrongLDelim:PI,emStrongRDelimAst:RI,emStrongRDelimUnd:BI,link:GF(/^!?\[(label)\]\((.*?)\)/).replace(`label`,JI).getRegex(),reflink:GF(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,JI).getRegex()},aL={...rL,emStrongRDelimAst:LI,emStrongLDelim:NI,delLDelim:VI,delRDelim:HI,url:GF(/^emailProtocol|^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace(`emailProtocol`,nL).replace(`protocol`,tL).replace(`email`,/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:GF(/^(?:[^a-zA-Z0-9](?=emailProtocol)|(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9](?=emailProtocol)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))))/).replace(`protocol`,tL).replace(/emailProtocol/g,/(?:mailto|xmpp):/).getRegex()},oL={...aL,br:GF(bI).replace(`{2,}`,`*`).getRegex(),text:GF(aL.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},sL={normal:mI,gfm:gI,pedantic:_I},cL={normal:rL,gfm:aL,breaks:oL,pedantic:iL},lL={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`},uL=e=>lL[e];function dL(e,t){if(t){if(qF.escapeTest.test(e))return e.replace(qF.escapeReplace,uL)}else if(qF.escapeTestNoEncode.test(e))return e.replace(qF.escapeReplaceNoEncode,uL);return e}function fL(e){return e.replace(qF.numericCharacterReference,(e,t,n)=>{let r=t===void 0?Number.parseInt(n,16):Number.parseInt(t,10);return r===0||r>1114111||r>=55296&&r<=57343?`�`:String.fromCodePoint(r)})}function pL(e){try{e=encodeURI(e).replace(qF.percentDecode,`%`)}catch{return null}return e}function mL(e,t){let n=e.replace(qF.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(qF.splitPipe),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),t){if(n.length>t)n.splice(t);else for(;n.length<t;)n.push(``)}for(;r<n.length;r++)n[r]=n[r].trim().replace(qF.slashPipe,`|`);return n}function hL(e,t,n){let r=e.length;if(r===0)return``;let i=0;for(;i<r;){let a=e.charAt(r-i-1);if(a===t&&!n)i++;else if(a!==t&&n)i++;else break}return e.slice(0,r-i)}function gL(e){let t=e.split(`
|
|
19
|
+
`),n=t.length-1;for(;n>=0&&qF.blankLine.test(t[n]);)n--;return t.length-n<=2?e:t.slice(0,n+1).join(`
|
|
20
|
+
`)}function _L(e){return e.trim().toLowerCase().toUpperCase().toLowerCase()}function vL(e,t){if(e.indexOf(t[0])===-1&&e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]===`\\`)r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}function yL(e,t=0){let n=t,r=``;for(let t of e)if(t===` `){let e=4-n%4;r+=` `.repeat(e),n+=e}else r+=t,n++;return r}function bL(e,t,n,r,i){let a=t.href,o=t.title||null,s=e[1].replace(i.other.outputLinkReplace,`$1`),c=e[0].charAt(0)===`!`;r.state.inLink=!0;let l=r.state.linkEmitted,u=r.state.inRawBlock;r.state.linkEmitted=!1;let d=r.inlineTokens(s),f=r.state.linkEmitted;if(r.state.linkEmitted=l,r.state.inLink=!1,!c){if(f){r.state.inRawBlock=u;return}r.state.linkEmitted=!0}return{type:c?`image`:`link`,raw:n,href:a,title:o,text:s,tokens:d}}function xL(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
|
|
21
|
+
`).map(e=>{let t=e.match(n.other.beginningSpace);if(t===null)return e;let[r]=t;return e.slice(Math.min(r.length,i.length))}).join(`
|
|
22
|
+
`)}function SL(e,t,n,r){if(!t.includes(`<`))return!1;for(let i=0;i<t.length;i++){if(t[i]===`\\`){i++;continue}if(t[i]==="`"){let e=r.inline.code.exec(t.slice(i));if(e){i+=e[0].length-1;continue}}if(t[i]!==`<`)continue;let a=e.slice(n+i),o=r.inline.tag.exec(a)||r.inline.autolink.exec(a);if(o){if(o[0].length>t.length-i)return!0;i+=o[0].length-1}}return!1}var CL=class{options;rules;lexer;constructor(e){this.options=e||VF}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:`space`,raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let e=this.options.pedantic?t[0]:gL(t[0]);return{type:`code`,raw:e,codeBlockStyle:`indented`,text:e.replace(this.rules.other.codeRemoveIndent,``)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=xL(e,t[3]||``,this.rules);return{type:`code`,raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,`$1`):t[2],text:n}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(this.rules.other.endingHash.test(e)){let t=hL(e,`#`);(this.options.pedantic||!t||this.rules.other.endingSpaceTabChar.test(t))&&(e=t.trim())}return{type:`heading`,raw:hL(t[0],`
|
|
23
|
+
`),depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:`hr`,raw:hL(t[0],`
|
|
24
|
+
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=hL(t[0],`
|
|
25
|
+
`).split(`
|
|
26
|
+
`),n=``,r=``,i=[];for(;e.length>0;){let t=!1,a=[],o=0;for(;o<e.length;o++)if(this.rules.other.blockquoteStart.test(e[o]))a.push(e[o]),t=!0;else if(!t)a.push(e[o]);else break;e=e.slice(o);let s=a.join(`
|
|
27
|
+
`),c=s.replace(this.rules.other.blockquoteSetextReplace,`
|
|
28
|
+
$1`).replace(this.rules.other.blockquoteSetextReplace2,``);n=n?`${n}
|
|
29
|
+
${s}`:s,r=r?`${r}
|
|
30
|
+
${c}`:c;let l=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(c,i,!0),this.lexer.state.top=l,e.length===0)break;let u=i.at(-1);if(u?.type===`code`)break;if(u?.type===`blockquote`){let t=u,a=e.join(`
|
|
31
|
+
`),o=t.raw+`
|
|
32
|
+
`+a.replace(this.rules.other.blockquoteSetextReplace2,``),s=this.blockquote(o);i[i.length-1]=s;let c=o.substring(s.raw.length).replace(/^\n/,``),l=c?c.split(`
|
|
33
|
+
`).length:0,d=l?e.slice(0,-l):e;d.length>0&&(n=`${n}
|
|
34
|
+
${d.join(`
|
|
35
|
+
`)}`),r=r.substring(0,r.length-t.text.length)+s.text;break}if(u?.type===`list`){let t=u,a=t.raw+`
|
|
36
|
+
`+e.join(`
|
|
37
|
+
`),o=this.list(a);i[i.length-1]=o,n=n.substring(0,n.length-u.raw.length)+o.raw,r=r.substring(0,r.length-t.raw.length)+o.raw,e=a.substring(i.at(-1).raw.length).split(`
|
|
38
|
+
`)}}return{type:`blockquote`,raw:n,tokens:i,text:r}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),r=n.length>1,i={type:`list`,raw:``,ordered:r,start:r?+n.slice(0,-1):``,loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:`[*+-]`);let a=this.rules.other.listItemRegex(n),o=!1;for(;e;){let n=!1,r=``,s=``;if(!(t=a.exec(e))||this.rules.block.hr.test(e))break;r=t[0],e=e.substring(r.length);let c=t[2].split(`
|
|
39
|
+
`,1)[0],l=t[1].length,u=this.options.pedantic?yL(c,l):c.replace(this.rules.other.leadingSpaceTab,e=>yL(e,l)),d=e.split(`
|
|
40
|
+
`,1)[0],f=!u.trim(),p=0;if(this.options.pedantic?(p=2,s=u.trimStart()):f?p=l+1:(p=u.search(this.rules.other.nonSpaceChar),p=p>4?1:p,s=u.slice(p),p+=l),f&&this.rules.other.blankLine.test(d)&&(r+=d+`
|
|
41
|
+
`,e=e.substring(d.length+1),n=!0),!n){let t=this.rules.other.nextBulletRegex(p),n=this.rules.other.hrRegex(p),i=this.rules.other.fencesBeginRegex(p),a=this.rules.other.headingBeginRegex(p),o=this.rules.other.htmlBeginRegex(p),c=this.rules.other.blockquoteBeginRegex(p);for(;e;){let l=e.split(`
|
|
42
|
+
`,1)[0],m;if(d=l,this.options.pedantic?(d=d.replace(this.rules.other.listReplaceNesting,` `),m=d):m=d.replace(this.rules.other.leadingSpaceTab,e=>e.replace(this.rules.other.tabCharGlobal,` `)),i.test(d)||a.test(d)||o.test(d)||c.test(d)||t.test(d)||n.test(d))break;if(m.search(this.rules.other.nonSpaceChar)>=p||!d.trim())s+=`
|
|
43
|
+
`+m.slice(p);else{if(f||u.replace(this.rules.other.tabCharGlobal,` `).search(this.rules.other.nonSpaceChar)>=4||i.test(u)||a.test(u)||n.test(u))break;s+=`
|
|
44
|
+
`+d}f=!d.trim(),r+=l+`
|
|
45
|
+
`,e=e.substring(l.length+1),u=m.slice(p)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(r)&&(o=!0)),i.items.push({type:`list_item`,raw:r,task:!!this.options.gfm&&this.rules.other.listIsTask.test(s),loose:!1,text:s,tokens:[]}),i.raw+=r}let s=i.items.at(-1);if(s)s.raw=s.raw.trimEnd(),s.text=s.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let e of i.items)if(this.lexer.state.top=!1,e.tokens=this.lexer.blockTokens(e.text,[]),!i.loose){let t=e.tokens.filter(e=>e.type===`space`);i.loose=t.length>0&&t.some(e=>this.rules.other.anyLine.test(e.raw))}for(let e of i.items){let t=e.tokens[0];if(e.task&&(t?.type===`text`||t?.type===`paragraph`)){e.text=e.text.replace(this.rules.other.listReplaceTask,``),t.raw=t.raw.replace(this.rules.other.listReplaceTask,``),t.text=t.text.replace(this.rules.other.listReplaceTask,``);for(let e=this.lexer.inlineQueue.length-1;e>=0;e--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[e].src)){this.lexer.inlineQueue[e].src=this.lexer.inlineQueue[e].src.replace(this.rules.other.listReplaceTask,``);break}let n=this.rules.other.listTaskCheckbox.exec(e.raw);if(n){let t={type:`checkbox`,raw:n[0]+` `,checked:n[0]!==`[ ]`};e.checked=t.checked,i.loose?e.tokens[0]&&[`paragraph`,`text`].includes(e.tokens[0].type)&&`tokens`in e.tokens[0]&&e.tokens[0].tokens?(e.tokens[0].raw=t.raw+e.tokens[0].raw,e.tokens[0].text=t.raw+e.tokens[0].text,e.tokens[0].tokens.unshift(t)):e.tokens.unshift({type:`paragraph`,raw:t.raw,text:t.raw,tokens:[t]}):e.tokens.unshift(t)}}else e.task&&=!1}if(i.loose)for(let e of i.items){e.loose=!0;for(let t of e.tokens)t.type===`text`&&(t.type=`paragraph`)}return i}}html(e){let t=this.rules.block.html.exec(e);if(t){let e=gL(t[0]);return{type:`html`,block:!0,raw:e,pre:t[1]===`pre`||t[1]===`script`||t[1]===`style`,text:e}}}def(e){let t=this.rules.block.def.exec(e);if(t){if(!this.rules.other.startAngleBracket.test(t[2])&&vL(t[2],`()`)!==-1)return;let e=_L(t[1]).replace(this.rules.other.multipleSpaceGlobal,` `),n=t[2]?t[2].replace(this.rules.other.hrefBrackets,`$1`).replace(this.rules.inline.anyPunctuation,`$1`):``,r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,`$1`):t[3];return{type:`def`,tag:e,raw:hL(t[0],`
|
|
46
|
+
`),href:n,title:r}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=mL(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,``).split(`|`),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,``).split(`
|
|
47
|
+
`):[],a={type:`table`,raw:hL(t[0],`
|
|
48
|
+
`),header:[],align:[],rows:[]};if(n.length===r.length){for(let e of r)this.rules.other.tableAlignRight.test(e)?a.align.push(`right`):this.rules.other.tableAlignCenter.test(e)?a.align.push(`center`):this.rules.other.tableAlignLeft.test(e)?a.align.push(`left`):a.align.push(null);for(let e=0;e<n.length;e++)a.header.push({text:n[e],tokens:this.lexer.inline(n[e]),header:!0,align:a.align[e]});for(let e of i)a.rows.push(mL(e,a.header.length).map((e,t)=>({text:e,tokens:this.lexer.inline(e),header:!1,align:a.align[t]})));return a}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t){let e=t[1].trim();return{type:`heading`,raw:hL(t[0],`
|
|
49
|
+
`),depth:t[2].charAt(0)===`=`?1:2,text:e,tokens:this.lexer.inline(e)}}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let e=t[1].charAt(t[1].length-1)===`
|
|
50
|
+
`?t[1].slice(0,-1):t[1];return{type:`paragraph`,raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:`text`,raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:`escape`,raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:`html`,raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){if(this.lexer.state.linkParenPossible===!1)return;let t=this.rules.inline.link.exec(e);if(t){let n=t[0].charAt(0)===`!`?2:1;if(!this.options.pedantic&&SL(e,t[1],n,this.rules))return;let r=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(r)){if(!this.rules.other.endAngleBracket.test(r))return;let e=hL(r.slice(0,-1),`\\`);if((r.length-e.length)%2==0)return}else{let e=vL(t[2],`()`);if(e===-2)return;if(e>-1){let n=(t[0].indexOf(`!`)===0?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=``}}let i=t[2],a=``;if(this.options.pedantic){let e=this.rules.other.pedanticHrefTitle.exec(i);e&&(i=e[1],a=e[3])}else a=t[3]?t[3].slice(1,-1):``;return i=i.trim(),this.rules.other.startAngleBracket.test(i)&&(i=this.options.pedantic&&!this.rules.other.endAngleBracket.test(r)?i.slice(1):i.slice(1,-1)),bL(t,{href:i&&i.replace(this.rules.inline.anyPunctuation,`$1`),title:a&&a.replace(this.rules.inline.anyPunctuation,`$1`)},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let r=n[0].charAt(0)===`!`?2:1;if(!this.options.pedantic&&SL(e,n[1],r,this.rules))return;let i=t[_L((n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal,` `))];if(!i){let e=n[0].charAt(0);return{type:`text`,raw:e,text:e}}return bL(n,i,n[0],this.lexer,this.rules)}}emStrong(e,t,n=``){let r=this.rules.inline.emStrongLDelim.exec(e);if(!(!r||!r[1]&&!r[2]&&!r[3]&&!r[4]||r[4]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[3])||!n||this.rules.inline.punctuation.exec(n))){let i=[...r[0]].length-1,a,o,s=i,c=0,l=r[0][0],u=n===l,d=l===`*`?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(d.lastIndex=0,t=t.slice(-1*e.length+i);(r=d.exec(t))!==null;){if(a=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!a)continue;if(o=[...a].length,r[3]||r[4]){s+=o;continue}if(r[5]||r[6]){if(i%3&&!((i+o)%3)){c+=o;continue}if(u)break}if(s-=o,s>0)continue;o=Math.min(o,o+s+c);let t=[...r[0]][0].length,n=e.slice(0,i+r.index+t+o);if(Math.min(i,o)%2){let e=n.slice(1,-1);return{type:`em`,raw:n,text:e,tokens:this.lexer.inlineTokens(e)}}let l=n.slice(2,-2);return{type:`strong`,raw:n,text:l,tokens:this.lexer.inlineTokens(l)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal,` `),n=this.rules.other.nonSpaceChar.test(e),r=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return n&&r&&(e=e.substring(1,e.length-1)),{type:`codespan`,raw:t[0],text:e}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:`br`,raw:t[0]}}del(e,t,n=``){let r=this.rules.inline.delLDelim.exec(e);if(r&&(!r[1]||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=this.rules.inline.delRDelim;for(s.lastIndex=0,t=t.slice(-1*e.length+n);(r=s.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i||(a=[...i].length,a!==n))continue;if(r[3]||r[4]){o+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o);let t=[...r[0]][0].length,s=e.slice(0,n+r.index+t+a),c=s.slice(n,-n);return{type:`del`,raw:s,text:c,tokens:this.lexer.inlineTokens(c)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let e,n;return t[2]===`@`?(e=t[1],n=`mailto:`+e):(e=t[1],n=e),{type:`link`,raw:t[0],text:e,href:n,autolink:!0,tokens:[{type:`text`,raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if(t[2]===`@`)e=t[0],n=`mailto:`+e;else{let r;do r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??``;while(r!==t[0]);e=t[0],n=t[1]===`www.`?`http://`+t[0]:t[0]}return{type:`link`,raw:t[0],text:e,href:n,autolink:!0,tokens:[{type:`text`,raw:e,text:e}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let e=this.lexer.state.inRawBlock;return{type:`text`,raw:t[0],text:e?t[0]:fL(t[0]),escaped:e}}}},wL=class e{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||VF,this.options.tokenizer=this.options.tokenizer||new CL,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,linkEmitted:!1,linkParenPossible:!0,top:!0};let t={other:qF,block:sL.normal,inline:cL.normal};this.options.pedantic?(t.block=sL.pedantic,t.inline=cL.pedantic):this.options.gfm&&(t.block=sL.gfm,t.inline=this.options.breaks?cL.breaks:cL.gfm),this.tokenizer.rules=t}static get rules(){return{block:sL,inline:cL}}static lex(t,n){return new e(n).lex(t)}static lexInline(t,n){return new e(n).inlineTokens(t)}lex(e){e=e.replace(qF.carriageReturn,`
|
|
51
|
+
`),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let t=this.inlineQueue[e];this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(qF.tabCharGlobal,` `).replace(qF.spaceLine,``));let r=1/0;for(;e;){if(e.length<r)r=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}let i;if(this.options.extensions?.block?.some(n=>(i=n.call({lexer:this},e,t))?(e=e.substring(i.raw.length),t.push(i),!0):!1))continue;if(i=this.tokenizer.space(e)){e=e.substring(i.raw.length);let n=t.at(-1);i.raw.length===1&&n!==void 0?n.raw+=`
|
|
52
|
+
`:t.push(i);continue}if(i=this.tokenizer.code(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
|
|
53
|
+
`)?``:`
|
|
54
|
+
`)+i.raw,n.text+=`
|
|
55
|
+
`+i.text,this.inlineQueue.at(-1).src=n.text):t.push(i);continue}if((i=this.tokenizer.fences(e))||(i=this.tokenizer.heading(e))||(i=this.tokenizer.hr(e))||(i=this.tokenizer.blockquote(e))||(i=this.tokenizer.list(e))||(i=this.tokenizer.html(e))){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.def(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
|
|
56
|
+
`)?``:`
|
|
57
|
+
`)+i.raw,n.text+=`
|
|
58
|
+
`+i.raw,this.inlineQueue.at(-1).src=n.text):this.tokens.links[i.tag]||(this.tokens.links[i.tag]={href:i.href,title:i.title},t.push(i));continue}if((i=this.tokenizer.table(e))||(i=this.tokenizer.lheading(e))){e=e.substring(i.raw.length),t.push(i);continue}let a=e;if(this.options.extensions?.startBlock){let t=1/0,n=e.slice(1),r;this.options.extensions.startBlock.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(a=e.substring(0,t+1))}if(this.state.top&&(i=this.tokenizer.paragraph(a))){let r=t.at(-1);n&&r?.type===`paragraph`?(r.raw+=(r.raw.endsWith(`
|
|
59
|
+
`)?``:`
|
|
60
|
+
`)+i.raw,r.text+=`
|
|
61
|
+
`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=r.text):t.push(i),n=a.length!==e.length,e=e.substring(i.raw.length)}else if(i=this.tokenizer.text(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`text`?(n.raw+=(n.raw.endsWith(`
|
|
62
|
+
`)?``:`
|
|
63
|
+
`)+i.raw,n.text+=`
|
|
64
|
+
`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(i)}else if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}linkInText(e){if(!e.includes(`[`))return!1;let t=this.tokenizer.rules.inline.link;for(let n of e.matchAll(this.tokenizer.rules.inline.blockSkip))if(t.test(n[0])&&e.charAt(n.index-1)!==`!`)return!0;for(let t of e.matchAll(this.tokenizer.rules.inline.reflinkSearch)){let e=t[0],n=e.lastIndexOf(`[`);if(e.charAt(0)!==`!`&&Object.hasOwn(this.tokens.links,_L(e.slice(n+1,-1)))&&!(n>1&&this.linkInText(e.slice(1,n-1))))return!0}return!1}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let n=this.state.linkParenPossible;this.state.linkParenPossible=n&&e.includes(`)`);try{return this.#e(e,t)}finally{this.state.linkParenPossible=n}}#e(e,t){let n=e;if(this.tokens.links&&e.includes(`[`)){let e=this.tokenizer.rules.inline.reflinkSearch,t=n=>{let r=n.lastIndexOf(`[`);if(!Object.hasOwn(this.tokens.links,_L(n.slice(r+1,-1))))return n;if(r>1&&n.charAt(0)!==`!`){let i=n.slice(1,r-1);if(this.linkInText(i))return`[`+i.replace(e,t)+`][`+`a`.repeat(n.length-r-2)+`]`}return`[`+`a`.repeat(n.length-2)+`]`};n=n.replace(e,t)}n=n.replace(this.tokenizer.rules.inline.anyPunctuation,e=>`+`.repeat(e.length)),n=n.replace(this.tokenizer.rules.inline.blockSkip,(e,t,n)=>{let r=n?n.length:0;return e.slice(0,r)+`[`+`a`.repeat(e.length-r-2)+`]`}),n=this.options.hooks?.emStrongMask?.call({lexer:this},n)??n;let r=!1,i=``,a=1/0;for(;e;){if(e.length<a)a=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}r||(i=``),r=!1;let o;if(this.options.extensions?.inline?.some(n=>(o=n.call({lexer:this},e,t))?(e=e.substring(o.raw.length),t.push(o),!0):!1))continue;if((o=this.tokenizer.escape(e))||(o=this.tokenizer.tag(e))||(o=this.tokenizer.link(e))){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(o.raw.length);let n=t.at(-1);o.type===`text`&&n?.type===`text`?(n.raw+=o.raw,n.text+=o.text):t.push(o);continue}if((o=this.tokenizer.emStrong(e,n,i))||(o=this.tokenizer.codespan(e))||(o=this.tokenizer.br(e))||(o=this.tokenizer.del(e,n,i))||(o=this.tokenizer.autolink(e))||!this.state.inLink&&(o=this.tokenizer.url(e))){e=e.substring(o.raw.length),t.push(o);continue}let s=e;if(this.options.extensions?.startInline){let t=1/0,n=e.slice(1),r;this.options.extensions.startInline.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(s=e.substring(0,t+1))}if(o=this.tokenizer.inlineText(s)){e=e.substring(o.raw.length),o.raw.slice(-1)!==`_`&&(i=o.raw.slice(-1)),r=!0;let n=t.at(-1);n?.type===`text`?(n.raw+=o.raw,n.text+=o.text):t.push(o)}else if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return t}infiniteLoopError(e){let t=`Infinite loop on byte: `+e;if(this.options.silent)console.error(t);else throw Error(t)}},TL=class{options;parser;constructor(e){this.options=e||VF}space(e){return``}code({text:e,lang:t,escaped:n}){let r=(t||``).match(qF.notSpaceStart)?.[0],i=e?e.replace(qF.endingNewline,``)+`
|
|
65
|
+
`:``;return r?`<pre><code class="language-`+dL(r)+`">`+(n?i:dL(i,!0))+`</code></pre>
|
|
66
|
+
`:`<pre><code>`+(n?i:dL(i,!0))+`</code></pre>
|
|
67
|
+
`}blockquote({tokens:e}){return`<blockquote>
|
|
68
|
+
${this.parser.parse(e)}</blockquote>
|
|
69
|
+
`}html({text:e}){return e}def(e){return``}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
|
|
70
|
+
`}hr(e){return`<hr>
|
|
71
|
+
`}list(e){let t=e.ordered,n=e.start,r=``;for(let t=0;t<e.items.length;t++){let n=e.items[t];r+=this.listitem(n)}let i=t?`ol`:`ul`,a=t&&n!==1?` start="`+n+`"`:``;return`<`+i+a+`>
|
|
72
|
+
`+r+`</`+i+`>
|
|
73
|
+
`}listitem(e){return`<li>${this.parser.parse(e.tokens)}</li>
|
|
74
|
+
`}checkbox({checked:e}){return`<input `+(e?`checked="" `:``)+`disabled="" type="checkbox"> `}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
|
|
75
|
+
`}table(e){let t=``,n=``;for(let t=0;t<e.header.length;t++)n+=this.tablecell(e.header[t]);t+=this.tablerow({text:n});let r=``;for(let t=0;t<e.rows.length;t++){let i=e.rows[t];n=``;for(let e=0;e<i.length;e++)n+=this.tablecell(i[e]);r+=this.tablerow({text:n})}return r&&=`<tbody>${r}</tbody>`,`<table>
|
|
76
|
+
<thead>
|
|
77
|
+
`+t+`</thead>
|
|
78
|
+
`+r+`</table>
|
|
79
|
+
`}tablerow({text:e}){return`<tr>
|
|
80
|
+
${e}</tr>
|
|
81
|
+
`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?`th`:`td`;return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
|
|
82
|
+
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${dL(e,!0)}</code>`}br(e){return`<br>`}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,text:n,tokens:r,autolink:i}){let a=i?dL(n,!0):this.parser.parseInline(r),o=pL(e);if(o===null)return a;e=dL(o,i);let s=`<a href="`+e+`"`;return t&&(s+=` title="`+dL(t)+`"`),s+=`>`+a+`</a>`,s}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=pL(e);if(i===null)return dL(n);e=i;let a=`<img src="${dL(e)}" alt="${dL(n)}"`;return t&&(a+=` title="${dL(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:dL(e.text)}},EL=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return``+e}image({text:e}){return``+e}br(){return``}checkbox({raw:e}){return e}},DL=class e{options;renderer;textRenderer;constructor(e){this.options=e||VF,this.options.renderer=this.options.renderer||new TL,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new EL}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e){this.renderer.parser=this;let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(this.options.extensions?.renderers?.[r.type]){let e=r,n=this.options.extensions.renderers[e.type].call({parser:this},e);if(n!==!1||![`space`,`hr`,`heading`,`code`,`table`,`blockquote`,`list`,`checkbox`,`html`,`def`,`paragraph`,`text`].includes(e.type)){t+=n||``;continue}}let i=r;switch(i.type){case`space`:t+=this.renderer.space(i);break;case`hr`:t+=this.renderer.hr(i);break;case`heading`:t+=this.renderer.heading(i);break;case`code`:t+=this.renderer.code(i);break;case`table`:t+=this.renderer.table(i);break;case`blockquote`:t+=this.renderer.blockquote(i);break;case`list`:t+=this.renderer.list(i);break;case`checkbox`:t+=this.renderer.checkbox(i);break;case`html`:t+=this.renderer.html(i);break;case`def`:t+=this.renderer.def(i);break;case`paragraph`:t+=this.renderer.paragraph(i);break;case`text`:t+=this.renderer.text(i);break;default:{let e=`Token with "`+i.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=this.options.extensions.renderers[i.type].call({parser:this},i);if(e!==!1||![`escape`,`html`,`link`,`image`,`checkbox`,`strong`,`em`,`codespan`,`br`,`del`,`text`].includes(i.type)){n+=e||``;continue}}let a=i;switch(a.type){case`escape`:n+=t.text(a);break;case`html`:n+=t.html(a);break;case`link`:n+=t.link(a);break;case`image`:n+=t.image(a);break;case`checkbox`:n+=t.checkbox(a);break;case`strong`:n+=t.strong(a);break;case`em`:n+=t.em(a);break;case`codespan`:n+=t.codespan(a);break;case`br`:n+=t.br(a);break;case`del`:n+=t.del(a);break;case`text`:n+=t.text(a);break;default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}},OL=class{options;block;constructor(e){this.options=e||VF}static passThroughHooks=new Set([`preprocess`,`postprocess`,`processAllTokens`,`emStrongMask`]);static passThroughHooksRespectAsync=new Set([`preprocess`,`postprocess`,`processAllTokens`]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?wL.lex:wL.lexInline}provideParser(e=this.block){return e?DL.parse:DL.parseInline}},kL=class{defaults=BF();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=DL;Renderer=TL;TextRenderer=EL;Lexer=wL;Tokenizer=CL;Hooks=OL;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(n=n.concat(t.call(this,r)),r.type){case`table`:{let e=r;for(let r of e.header)n=n.concat(this.walkTokens(r.tokens,t));for(let r of e.rows)for(let e of r)n=n.concat(this.walkTokens(e.tokens,t));break}case`list`:{let e=r;n=n.concat(this.walkTokens(e.items,t));break}default:{let e=r;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach(r=>{let i=e[r].flat(1/0);n=n.concat(this.walkTokens(i,t))}):e.tokens&&(n=n.concat(this.walkTokens(e.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw Error(`extension name required`);if(`renderer`in e){let n=t.renderers[e.name];n?t.renderers[e.name]=function(...t){let r=e.renderer.apply(this,t);return r===!1&&(r=n.apply(this,t)),r}:t.renderers[e.name]=e.renderer}if(`tokenizer`in e){if(!e.level||e.level!==`block`&&e.level!==`inline`)throw Error(`extension level must be 'block' or 'inline'`);let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&(e.level===`block`?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:e.level===`inline`&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}`childTokens`in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),n.extensions=t),e.renderer){let t=this.defaults.renderer||new TL(this.defaults);for(let n in e.renderer){if(!(n in t))throw Error(`renderer '${n}' does not exist`);if([`options`,`parser`].includes(n))continue;let r=n,i=e.renderer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n||``}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new CL(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw Error(`tokenizer '${n}' does not exist`);if([`options`,`rules`,`lexer`].includes(n))continue;let r=n,i=e.tokenizer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new OL;for(let n in e.hooks){if(!(n in t))throw Error(`hook '${n}' does not exist`);if([`options`,`block`].includes(n))continue;let r=n,i=e.hooks[r],a=t[r];t[r]=OL.passThroughHooks.has(n)?e=>{if(this.defaults.async&&OL.passThroughHooksRespectAsync.has(n))return(async()=>{let n=await i.call(t,e);return a.call(t,n)})();let r=i.call(t,e);return a.call(t,r)}:(...e)=>{if(this.defaults.async)return(async()=>{let n=await i.apply(t,e);return n===!1&&(n=await a.apply(t,e)),n})();let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return wL.lex(e,t??this.defaults)}parser(e,t){return DL.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},a=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return a(Error(`marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise.`));if(typeof t>`u`||t===null)return a(Error(`marked(): input parameter is undefined or null`));if(typeof t!=`string`)return a(Error(`marked(): input parameter is of type `+Object.prototype.toString.call(t)+`, string expected`));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let n=i.hooks?await i.hooks.preprocess(t):t,r=await(i.hooks?await i.hooks.provideLexer(e):e?wL.lex:wL.lexInline)(n,i),a=i.hooks?await i.hooks.processAllTokens(r):r;i.walkTokens&&await Promise.all(this.walkTokens(a,i.walkTokens));let o=await(i.hooks?await i.hooks.provideParser(e):e?DL.parse:DL.parseInline)(a,i);return i.hooks?await i.hooks.postprocess(o):o})().catch(a);try{i.hooks&&(t=i.hooks.preprocess(t));let n=(i.hooks?i.hooks.provideLexer(e):e?wL.lex:wL.lexInline)(t,i);i.hooks&&(n=i.hooks.processAllTokens(n)),i.walkTokens&&this.walkTokens(n,i.walkTokens);let r=(i.hooks?i.hooks.provideParser(e):e?DL.parse:DL.parseInline)(n,i);return i.hooks&&(r=i.hooks.postprocess(r)),r}catch(e){return a(e)}}}onError(e,t){return n=>{if(n.message+=`
|
|
83
|
+
Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+dL(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}},AL=new kL;function jL(e,t){return AL.parse(e,t)}jL.options=jL.setOptions=function(e){return AL.setOptions(e),jL.defaults=AL.defaults,HF(jL.defaults),jL},jL.getDefaults=BF,jL.defaults=VF;function ML(...e){return AL.use(...e),jL.defaults=AL.defaults,HF(jL.defaults),jL}jL.use=ML,jL.walkTokens=function(e,t){return AL.walkTokens(e,t)},jL.parseInline=AL.parseInline,jL.Parser=DL,jL.parser=DL.parse,jL.Renderer=TL,jL.TextRenderer=EL,jL.Lexer=wL,jL.lexer=wL.lex,jL.Tokenizer=CL,jL.Hooks=OL,jL.parse=jL,jL.options,jL.setOptions,jL.walkTokens,jL.parseInline,DL.parse,wL.lex;var NL=/^image\/(png|jpeg|webp|gif)$/i,PL=/^(https?:|mailto:)/i,FL=49152,IL=`default-src 'none'; img-src data:; style-src 'unsafe-inline'`,LL=`
|
|
84
|
+
:root{color-scheme:light dark;--bg:#fff;--fg:#1f2328;--muted:#656d76;--border:#d0d7de;--user:#eef4ff;--code:#f6f8fa}
|
|
85
|
+
@media(prefers-color-scheme:dark){:root{--bg:#0d1117;--fg:#e6edf3;--muted:#8b949e;--border:#30363d;--user:#16243a;--code:#161b22}}
|
|
86
|
+
body{margin:0;background:var(--bg);color:var(--fg);font:15px/1.6 system-ui,-apple-system,"Segoe UI",sans-serif}
|
|
87
|
+
main{max-width:860px;margin:0 auto;padding:24px 16px 64px}
|
|
88
|
+
h1{font-size:1.5rem;margin:0 0 4px}
|
|
89
|
+
.meta{color:var(--muted);font-size:.85rem;margin:0 0 24px}
|
|
90
|
+
.msg{margin:16px 0;padding:12px 16px;border:1px solid var(--border);border-radius:12px}
|
|
91
|
+
.msg.user{background:var(--user)}
|
|
92
|
+
.role{font-size:.75rem;font-weight:600;letter-spacing:.04em;text-transform:uppercase;color:var(--muted);margin-bottom:6px}
|
|
93
|
+
.text{white-space:pre-wrap;overflow-wrap:anywhere}
|
|
94
|
+
.system{text-align:center;color:var(--muted);font-size:.85rem;margin:16px 0}
|
|
95
|
+
.md>:first-child{margin-top:0}.md>:last-child{margin-bottom:0}
|
|
96
|
+
.md pre,pre{background:var(--code);border-radius:8px;padding:10px 12px;overflow:auto;font-size:.85rem;white-space:pre-wrap;overflow-wrap:anywhere}
|
|
97
|
+
.md code{background:var(--code);border-radius:4px;padding:1px 4px}.md pre code{background:none;padding:0}
|
|
98
|
+
.md table{border-collapse:collapse}.md th,.md td{border:1px solid var(--border);padding:4px 8px}
|
|
99
|
+
.md blockquote{margin:0;padding-left:12px;border-left:3px solid var(--border);color:var(--muted)}
|
|
100
|
+
details{margin:8px 0}summary{cursor:pointer;color:var(--muted)}
|
|
101
|
+
details.tool{border:1px solid var(--border);border-radius:8px;padding:6px 12px;margin:12px 0}
|
|
102
|
+
details.tool.error>summary .status{color:#cf222e}
|
|
103
|
+
.label{font-size:.75rem;color:var(--muted);margin-top:8px}
|
|
104
|
+
.note{color:var(--muted);font-style:italic;margin-top:6px}
|
|
105
|
+
figure{margin:8px 0}img{max-width:100%;height:auto;border-radius:8px}figcaption,.placeholder{color:var(--muted);font-size:.8rem}
|
|
106
|
+
`,RL=e=>e.replaceAll(`&`,`&`).replaceAll(`<`,`<`).replaceAll(`>`,`>`).replaceAll(`"`,`"`).replaceAll(`'`,`'`),zL=new kL({gfm:!0,breaks:!0,renderer:{html:({text:e})=>RL(e),link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n);if(!PL.test(e.trim()))return r;let i=t?` title="${RL(t)}"`:``;return`<a href="${RL(e)}"${i} rel="noopener noreferrer" target="_blank">${r}</a>`},image({href:e,text:t}){let n=`[image: ${RL(t||e)}]`;return PL.test(e.trim())?`<a href="${RL(e)}" rel="noopener noreferrer" target="_blank">${n}</a>`:n}}});async function BL(e,t){let n=new Map,r=0,i=0;for(let a of e)if(a.type===`user`||a.type===`tool`)for(let e of a.images??[]){let a=null;if(t===void 0)a=`not embedded`;else if(r+e.bytes>33554432)a=`over the embedding size limit`;else try{let i=await t(e);if(!NL.test(i.mimeType))a=`unsupported image type`;else if(r+i.bytes.length>33554432)a=`over the embedding size limit`;else{r+=i.bytes.length;let t=[];for(let e=0;e<i.bytes.length;e+=FL)t.push(Si(i.bytes.subarray(e,e+FL)));n.set(`${e.entryId}:${e.contentIndex}`,{src:`data:${i.mimeType.toLowerCase()};base64,${t.join(``)}`})}}catch{a=`image unavailable`}a!==null&&(n.set(`${e.entryId}:${e.contentIndex}`,{reason:a}),i++)}return{embedded:n,skipped:i}}function VL(e,t){return(e??[]).map(e=>{let n=t.get(`${e.entryId}:${e.contentIndex}`),r=RL(bj(e));return n!==void 0&&`src`in n?`<figure><img src="${n.src}" alt="${RL(e.name)}"><figcaption>${r}</figcaption></figure>`:`<p class="placeholder">[image: ${r}${n!==void 0&&`reason`in n?` — ${n.reason}`:``}]</p>`}).join(``)}async function HL(e,t){let{embedded:n,skipped:r}=await BL(e.items,t.loadImage),i=RL(Sj(e.title)||`neko-session`),a=[];for(let r of e.items)if(r.type===`system`)a.push(`<div class="system">${RL(Sj(r.text))}</div>`);else if(r.type===`user`){let e=_j(r);a.push(`<section class="msg user"><div class="role">User</div>${e===``?``:`<div class="text">${RL(e)}</div>`}${VL(r.images,n)}</section>`)}else if(r.type===`assistant`){let e=t.includeThinking&&r.thinking.trim()!==``?`<details class="thinking"><summary>Thinking</summary><div class="text">${RL(r.thinking.trim())}</div></details>`:``,n=r.text.trim()===``?``:`<div class="md">${zL.parse(r.text.trim(),{async:!1})}</div>`,i=r.note===null?``:`<div class="note">${RL(Sj(r.note))}</div>`;a.push(`<section class="msg assistant"><div class="role">Assistant</div>${e}${n}${i}</section>`)}else{let e=vj(r),t=yj(r),i=[`<b>Tool</b> ${RL(r.name)}`,r.summary===``?``:`<span class="args">${RL(Sj(r.summary))}</span>`,e===`ok`?``:`<span class="status">[${e}]</span>`,r.durationMs===null?``:`<span class="duration">(${xj(r.durationMs)})</span>`].filter(Boolean).join(` `);a.push(`<details class="tool ${e}"><summary>${i}</summary>${r.detail===null||r.detail===``?``:`<pre>${RL(r.detail)}</pre>`}${t===``?``:`<div class="label">${e===`running`?`Output so far`:`Result`}</div><pre>${RL(t)}</pre>`}${r.note===null?``:`<div class="note">${RL(Sj(r.note))}</div>`}${VL(r.images,n)}</details>`)}return{content:`<!doctype html>
|
|
107
|
+
<html lang="en">
|
|
108
|
+
<head>
|
|
109
|
+
<meta charset="utf-8">
|
|
110
|
+
<meta http-equiv="Content-Security-Policy" content="${IL}">
|
|
111
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
112
|
+
<title>${i}</title>
|
|
113
|
+
<style>${LL}</style>
|
|
114
|
+
</head>
|
|
115
|
+
<body>
|
|
116
|
+
<main>
|
|
117
|
+
<h1>${i}</h1>
|
|
118
|
+
<p class="meta">${RL(Sj(e.model))} · ${RL(Sj(e.cwd))} · ${RL(e.exportedAt.toISOString())}</p>
|
|
119
|
+
${a.join(`
|
|
120
|
+
`)}
|
|
121
|
+
</main>
|
|
122
|
+
</body>
|
|
123
|
+
</html>
|
|
124
|
+
`,skippedImages:r}}var UL={markdown:`md`,html:`html`,json:`json`},WL={markdown:`text/markdown;charset=utf-8`,html:`text/html;charset=utf-8`,json:`application/json;charset=utf-8`},GL=60;function KL(e){return e.type===`user`?_j(e):e.type===`assistant`?e.text.trim():``}function qL(e,t,n){let r=e.replace(/[\\/:*?"<>|\u0000-\u001f\u007f]/g,`-`).replace(/\s+/g,` `).replace(/-{2,}/g,`-`),i=Array.from(r).slice(0,GL).join(``).replace(/^[\s.-]+|[\s.-]+$/g,``)||`neko-session`,a=(e,t=2)=>String(e).padStart(t,`0`);return`${i}-${`${a(n.getFullYear(),4)}${a(n.getMonth()+1)}${a(n.getDate())}-${a(n.getHours())}${a(n.getMinutes())}${a(n.getSeconds())}`}.${UL[t]}`}async function JL(e,t,n){if(t.items.length===0)throw Error(`Nothing to export yet - start a conversation first`);let r=UL[e],i=WL[e];if(e===`html`){let{content:e,skippedImages:a}=await HL(t,n);return{content:e,mimeType:i,extension:r,skippedImages:a}}return{content:e===`markdown`?ZL(t,n):$L(t,n),mimeType:i,extension:r,skippedImages:0}}function YL(e){let t=0;for(let n of e.matchAll(/`+/g))t=Math.max(t,n[0].length);let n="`".repeat(Math.max(3,t+1));return`${n}\n${e}\n${n}`}var XL=e=>e.replaceAll(`&`,`&`).replaceAll(`<`,`<`).replaceAll(`>`,`>`);function ZL(e,t){let n=[`# ${Sj(e.title)||`neko-session`}`,``,`- **Model:** ${Sj(e.model)}`,`- **Workspace:** ${Sj(e.cwd)}`,`- **Exported:** ${e.exportedAt.toISOString()}`,``],r=null,i=e=>{r!==e&&(r=e,n.push(`---`,``,e===`user`?`## User`:`## Assistant`,``))};for(let a of e.items)if(a.type===`system`)r=null,n.push(`---`,``,`*${XL(Sj(a.text))}*`,``);else if(a.type===`user`){i(`user`);let e=_j(a);e!==``&&n.push(e,``);for(let e of a.images??[])n.push(`> [image] ${XL(bj(e))}`,``)}else a.type===`assistant`?(i(`assistant`),t.includeThinking&&a.thinking.trim()!==``&&n.push(`<details>`,`<summary>Thinking</summary>`,``,a.thinking.trim(),``,`</details>`,``),a.text.trim()!==``&&n.push(a.text.trim(),``),a.note!==null&&n.push(`> ${XL(Sj(a.note))}`,``)):(i(`assistant`),n.push(...QL(a)));return`${n.join(`
|
|
125
|
+
`).trimEnd()}\n`}function QL(e){let t=vj(e),n=[`<details>`,`<summary>${XL([`Tool: ${e.name}`,e.summary===``?``:`· ${Sj(e.summary)}`,t===`ok`?``:`[${t}]`,e.durationMs===null?``:`(${xj(e.durationMs)})`].filter(Boolean).join(` `))}</summary>`,``];e.detail!==null&&e.detail!==``&&n.push(YL(e.detail),``);let r=yj(e);r!==``&&n.push(t===`running`?`Output so far:`:`Result:`,``,YL(r),``),e.note!==null&&n.push(`> ${XL(Sj(e.note))}`,``);for(let t of e.images??[])n.push(`> [image] ${XL(bj(t))}`,``);return n.push(`</details>`,``),n}function $L(e,t){let n=e.items.map(e=>{switch(e.type){case`user`:return{type:`user`,text:_j(e),images:(e.images??[]).map(({name:e,mimeType:t,width:n,height:r,bytes:i})=>({name:e,mimeType:t,width:n,height:r,bytes:i}))};case`assistant`:return{type:`assistant`,text:e.text,...t.includeThinking&&e.thinking.trim()!==``?{thinking:e.thinking}:{},stopReason:e.stopReason,note:e.note};case`tool`:return{type:`tool`,name:e.name,summary:e.summary,detail:e.detail,status:e.phase,isError:e.isError,result:yj(e),durationMs:e.durationMs,note:e.note,images:(e.images??[]).map(({name:e,mimeType:t,width:n,height:r,bytes:i})=>({name:e,mimeType:t,width:n,height:r,bytes:i}))};default:return{type:`system`,text:e.text}}});return`${JSON.stringify({format:`neko-conversation`,version:1,session:{id:e.sessionId,title:e.title,model:e.model,cwd:e.cwd,exportedAt:e.exportedAt.toISOString()},items:n},null,2)}\n`}async function eR(e){if(navigator.clipboard?.writeText)try{await navigator.clipboard.writeText(e);return}catch{}let t=document.activeElement,n=document.getSelection(),r=n?Array.from({length:n.rangeCount},(e,t)=>n.getRangeAt(t)):[],i=document.createElement(`textarea`);i.value=e,i.setAttribute(`readonly`,``),i.style.cssText=`position:fixed;top:0;left:-9999px;opacity:0`,document.body.append(i),i.select();let a=!1;try{a=document.execCommand(`copy`)}finally{if(i.remove(),n){n.removeAllRanges();for(let e of r)n.addRange(e)}t?.focus?.()}if(!a)throw Error(`Clipboard unavailable`)}var tR=1500,nR={idle:``,copied:`已复制`,failed:`复制失败`};function rR({text:e,label:t=`复制`}){let[n,r]=(0,f.useState)(`idle`),i=(0,f.useRef)(void 0);if((0,f.useEffect)(()=>()=>clearTimeout(i.current),[]),e===``)return null;let a=e=>{r(e),clearTimeout(i.current),i.current=setTimeout(()=>r(`idle`),tR)};return(0,M.jsxs)(`span`,{className:`copy-row`,"data-state":n,children:[(0,M.jsx)(`button`,{type:`button`,className:`copy-btn focus-neko`,"aria-label":t,title:t,onClick:()=>{eR(e).then(()=>a(`copied`),()=>a(`failed`))},children:(0,M.jsx)(GP,{name:n===`copied`?`check`:`copy`,size:15})}),(0,M.jsx)(`output`,{className:`copy-status`,"aria-live":`polite`,children:nR[n]})]})}var iR=(0,f.createContext)(null);function aR({image:e}){let{currentSessionId:t,phase:n}=$A(),r=(0,f.useContext)(iR),[i,a]=(0,f.useState)(``),[o,s]=(0,f.useState)(``),[c,l]=(0,f.useState)(!1),[u,d]=(0,f.useState)(0),p=(0,f.useRef)(null);return(0,f.useEffect)(()=>{if(!t)return;a(``);let i=!1,o=``,c=!1,l=new IntersectionObserver(l=>{!c&&l.some(e=>e.isIntersecting)&&n===`ready`&&(c=!0,(r?r(e.entryId,e.contentIndex):dj.image(e.entryId,e.contentIndex,t)).then(e=>{i||(o=URL.createObjectURL(new Blob([e.bytes],{type:e.mimeType})),a(o),s(``))}).catch(()=>{i||s(`图片加载失败,点击重试`)}))});return p.current&&l.observe(p.current),()=>{i=!0,l.disconnect(),o&&URL.revokeObjectURL(o)}},[t,n,e.entryId,e.contentIndex,u,r]),(0,M.jsxs)(`div`,{ref:p,className:`max-w-full`,children:[(0,M.jsx)(`button`,{type:`button`,"aria-label":`查看图片 ${e.name}`,className:`focus-neko max-w-full rounded-xl border border-sakura-200 p-1`,onClick:()=>{o?(s(``),d(u+1)):i&&l(!0)},children:i?(0,M.jsx)(`img`,{src:i,alt:e.name,className:`max-h-40 max-w-full rounded-lg object-contain`}):(0,M.jsx)(`span`,{className:`text-sm`,children:o||`加载图片…`})}),c&&i&&(0,M.jsxs)(YP,{title:e.name,onClose:()=>l(!1),children:[(0,M.jsx)(`div`,{className:`min-h-0 overflow-auto bg-surface p-3 sm:p-4`,children:(0,M.jsx)(`img`,{src:i,alt:e.name,className:`max-h-[65dvh] w-full rounded-lg object-contain`})}),(0,M.jsx)(`div`,{className:`flex shrink-0 justify-end border-t border-sakura-200 bg-surface px-4 py-3`,children:(0,M.jsxs)(`a`,{href:i,download:e.name,className:`btn-primary focus-neko inline-flex min-h-10 items-center gap-2 rounded-full px-5 py-2 text-sm font-medium no-underline`,children:[(0,M.jsx)(`svg`,{"aria-hidden":`true`,width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,children:(0,M.jsx)(`path`,{d:`M12 3v12m-5-5 5 5 5-5M4 16v4h16v-4`})}),`保存图片`]})})]})]})}function oR({images:e}){return(0,M.jsx)(`div`,{className:`my-2 flex flex-wrap gap-2`,children:e.map(e=>(0,M.jsx)(aR,{image:e},`${e.entryId}:${e.contentIndex}`))})}function sR({text:e,jobId:t,job:n}){let{head:r,command:i,output:a}=DF(e),o=a===void 0?void 0:PF(a),s=(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(`span`,{className:`font-medium text-tianyi-700`,children:[`后台任务 `,t]}),(0,M.jsx)(`span`,{className:`min-w-0 break-words text-ink-700`,children:r.replace(/^\[|\]$/g,``)}),n&&(0,M.jsxs)(`span`,{className:`rounded-full bg-ink-100 px-2 text-ink-600`,children:[`当前:`,jF(n,Date.now())]})]});return(0,M.jsx)(`div`,{className:`chat-row anim-other`,"data-job-report":t,children:(0,M.jsx)(`div`,{className:`min-w-0 rounded-xl border border-sakura-200 bg-surface px-3 py-2 text-xs`,children:o===void 0?(0,M.jsx)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:s}):(0,M.jsxs)(`details`,{children:[(0,M.jsx)(`summary`,{className:`focus-neko flex cursor-pointer flex-wrap items-center gap-x-2 gap-y-1`,children:s}),i!==void 0&&(0,M.jsxs)(`code`,{className:`mt-2 block whitespace-pre-wrap break-all text-ink-600`,children:[`$ `,i]}),(0,M.jsx)(`pre`,{className:`mt-1 max-h-72 overflow-auto whitespace-pre-wrap break-words font-mono text-ink-800`,children:o})]})})})}function cR(e,t){this.v=e,this.k=t}function lR(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function uR(e){if(Array.isArray(e))return e}function dR(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function fR(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
126
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function pR(e,t){return uR(e)||dR(e,t)||mR(e,t)||fR()}function mR(e,t){if(e){if(typeof e==`string`)return lR(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?lR(e,t):void 0}}function hR(e){var t,n;function r(t,n){try{var a=e[t](n),o=a.value,s=o instanceof cR;Promise.resolve(s?o.v:o).then(function(n){if(s){var c=t===`return`&&o.k?t:`next`;if(!o.k||n.done)return r(c,n);n=e[c](n).value}i(!!a.done,n)},function(e){r(`throw`,e)})}catch(e){i(2,e)}}function i(e,i){e===2?t.reject(i):t.resolve({value:i,done:e}),(t=t.next)?r(t.key,t.arg):n=null}this._invoke=function(e,i){return new Promise(function(a,o){var s={key:e,arg:i,resolve:a,reject:o,next:null};n?n=n.next=s:(t=n=s,r(e,i))})},typeof e.return!=`function`&&(this.return=void 0)}hR.prototype[typeof Symbol==`function`&&Symbol.asyncIterator||`@@asyncIterator`]=function(){return this},hR.prototype.next=function(e){return this._invoke(`next`,e)},hR.prototype.throw=function(e){return this._invoke(`throw`,e)},hR.prototype.return=function(e){return this._invoke(`return`,e)};var gR=Object.entries,_R=Object.setPrototypeOf,vR=Object.isFrozen,yR=Object.getPrototypeOf,bR=Object.getOwnPropertyDescriptor,xR=Object.freeze,SR=Object.seal,CR=Object.create,wR=typeof Reflect<`u`&&Reflect,TR=wR.apply,ER=wR.construct;xR||=function(e){return e},SR||=function(e){return e},TR||=function(e,t){var n=[...arguments].slice(2);return e.apply(t,n)},ER||=function(e){return new e(...[...arguments].slice(1))};var DR=qR(Array.prototype.forEach);Array.prototype.indexOf;var OR=qR(Array.prototype.lastIndexOf),kR=qR(Array.prototype.pop),AR=qR(Array.prototype.push);Array.prototype.slice;var jR=qR(Array.prototype.splice),MR=Array.isArray,NR=qR(String.prototype.toLowerCase),PR=qR(String.prototype.toString),FR=qR(String.prototype.match),IR=qR(String.prototype.replace),LR=qR(String.prototype.indexOf),RR=qR(String.prototype.trim),zR=qR(Number.prototype.toString),BR=qR(Boolean.prototype.toString),VR=typeof BigInt>`u`?null:qR(BigInt.prototype.toString),HR=typeof Symbol>`u`?null:qR(Symbol.prototype.toString),UR=qR(Object.prototype.hasOwnProperty),WR=qR(Object.prototype.toString),GR=qR(RegExp.prototype.test),KR=JR(TypeError);function qR(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);var n=[...arguments].slice(1);return TR(e,t,n)}}function JR(e){return function(){return ER(e,[...arguments])}}function YR(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:NR;if(_R&&_R(e,null),!MR(t))return e;let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&(vR(t)||(t[r]=e),i=e)}e[i]=!0}return e}function XR(e){for(let t=0;t<e.length;t++)UR(e,t)||(e[t]=null);return e}function ZR(e){let t=CR(null);for(let r of gR(e)){var n=pR(r,2);let i=n[0],a=n[1];UR(e,i)&&(t[i]=MR(a)?XR(a):a&&typeof a==`object`&&a.constructor===Object?ZR(a):a)}return t}function QR(e){switch(typeof e){case`string`:return e;case`number`:return zR(e);case`boolean`:return BR(e);case`bigint`:return VR?VR(e):`0`;case`symbol`:return HR?HR(e):`Symbol()`;case`undefined`:return WR(e);case`function`:case`object`:{if(e===null)return WR(e);let t=e,n=$R(t,`toString`);if(typeof n==`function`){let e=n(t);return typeof e==`string`?e:WR(e)}return WR(e)}default:return WR(e)}}function $R(e,t){for(;e!==null;){let n=bR(e,t);if(n){if(n.get)return qR(n.get);if(typeof n.value==`function`)return qR(n.value)}e=yR(e)}function n(){return null}return n}function ez(e){try{return GR(e,``),!0}catch{return!1}}var tz=xR(`a.abbr.acronym.address.area.article.aside.audio.b.bdi.bdo.big.blink.blockquote.body.br.button.canvas.caption.center.cite.code.col.colgroup.content.data.datalist.dd.decorator.del.details.dfn.dialog.dir.div.dl.dt.element.em.fieldset.figcaption.figure.font.footer.form.h1.h2.h3.h4.h5.h6.head.header.hgroup.hr.html.i.img.input.ins.kbd.label.legend.li.main.map.mark.marquee.menu.menuitem.meter.nav.nobr.ol.optgroup.option.output.p.picture.pre.progress.q.rp.rt.ruby.s.samp.search.section.select.shadow.slot.small.source.spacer.span.strike.strong.style.sub.summary.sup.table.tbody.td.template.textarea.tfoot.th.thead.time.tr.track.tt.u.ul.var.video.wbr`.split(`.`)),nz=xR(`svg.a.altglyph.altglyphdef.altglyphitem.animatecolor.animatemotion.animatetransform.circle.clippath.defs.desc.ellipse.enterkeyhint.exportparts.filter.font.g.glyph.glyphref.hkern.image.inputmode.line.lineargradient.marker.mask.metadata.mpath.part.path.pattern.polygon.polyline.radialgradient.rect.stop.style.switch.symbol.text.textpath.title.tref.tspan.view.vkern`.split(`.`)),rz=xR([`feBlend`,`feColorMatrix`,`feComponentTransfer`,`feComposite`,`feConvolveMatrix`,`feDiffuseLighting`,`feDisplacementMap`,`feDistantLight`,`feDropShadow`,`feFlood`,`feFuncA`,`feFuncB`,`feFuncG`,`feFuncR`,`feGaussianBlur`,`feImage`,`feMerge`,`feMergeNode`,`feMorphology`,`feOffset`,`fePointLight`,`feSpecularLighting`,`feSpotLight`,`feTile`,`feTurbulence`]),iz=xR([`animate`,`color-profile`,`cursor`,`discard`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`foreignobject`,`hatch`,`hatchpath`,`mesh`,`meshgradient`,`meshpatch`,`meshrow`,`missing-glyph`,`script`,`set`,`solidcolor`,`unknown`,`use`]),az=xR(`math.menclose.merror.mfenced.mfrac.mglyph.mi.mlabeledtr.mmultiscripts.mn.mo.mover.mpadded.mphantom.mroot.mrow.ms.mspace.msqrt.mstyle.msub.msup.msubsup.mtable.mtd.mtext.mtr.munder.munderover.mprescripts`.split(`.`)),oz=xR([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),sz=xR([`#text`]),cz=xR(`accept.action.align.alt.autocapitalize.autocomplete.autopictureinpicture.autoplay.background.bgcolor.border.capture.cellpadding.cellspacing.checked.cite.class.clear.color.cols.colspan.command.commandfor.controls.controlslist.coords.crossorigin.datetime.decoding.default.dir.disabled.disablepictureinpicture.disableremoteplayback.download.draggable.enctype.enterkeyhint.exportparts.face.for.headers.height.hidden.high.href.hreflang.id.inert.inputmode.integrity.ismap.kind.label.lang.list.loading.loop.low.max.maxlength.media.method.min.minlength.multiple.muted.name.nonce.noshade.novalidate.nowrap.open.optimum.part.pattern.placeholder.playsinline.popover.popovertarget.popovertargetaction.poster.preload.pubdate.radiogroup.readonly.rel.required.rev.reversed.role.rows.rowspan.spellcheck.scope.selected.shape.size.sizes.slot.span.srclang.start.src.srcset.step.style.summary.tabindex.title.translate.type.usemap.valign.value.width.wrap.xmlns`.split(`.`)),lz=xR(`accent-height.accumulate.additive.alignment-baseline.amplitude.ascent.attributename.attributetype.azimuth.basefrequency.baseline-shift.begin.bias.by.class.clip.clippathunits.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.cx.cy.d.dx.dy.diffuseconstant.direction.display.divisor.dominant-baseline.dur.edgemode.elevation.end.exponent.fill.fill-opacity.fill-rule.filter.filterunits.flood-color.flood-opacity.font-family.font-size.font-size-adjust.font-stretch.font-style.font-variant.font-weight.fx.fy.g1.g2.glyph-name.glyphref.gradientunits.gradienttransform.height.href.id.image-rendering.in.in2.intercept.k.k1.k2.k3.k4.kerning.keypoints.keysplines.keytimes.lang.lengthadjust.letter-spacing.kernelmatrix.kernelunitlength.lighting-color.local.marker-end.marker-mid.marker-start.markerheight.markerunits.markerwidth.maskcontentunits.maskunits.max.mask.mask-type.media.method.mode.min.name.numoctaves.offset.operator.opacity.order.orient.orientation.origin.overflow.paint-order.path.pathlength.patterncontentunits.patterntransform.patternunits.pointer-events.points.preservealpha.preserveaspectratio.primitiveunits.r.rx.ry.radius.refx.refy.repeatcount.repeatdur.restart.result.rotate.scale.seed.shape-rendering.slope.specularconstant.specularexponent.spreadmethod.startoffset.stddeviation.stitchtiles.stop-color.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke.stroke-width.style.surfacescale.systemlanguage.tabindex.tablevalues.targetx.targety.transform.transform-origin.text-anchor.text-decoration.text-orientation.text-rendering.textlength.type.u1.u2.unicode.values.vector-effect.viewbox.visibility.version.vert-adv-y.vert-origin-x.vert-origin-y.width.word-spacing.wrap.writing-mode.xchannelselector.ychannelselector.x.x1.x2.xmlns.y.y1.y2.z.zoomandpan`.split(`.`)),uz=xR(`accent.accentunder.align.bevelled.close.columnalign.columnlines.columnspacing.columnspan.denomalign.depth.dir.display.displaystyle.encoding.fence.frame.height.href.id.largeop.length.linethickness.lquote.lspace.mathbackground.mathcolor.mathsize.mathvariant.maxsize.minsize.movablelimits.notation.numalign.open.rowalign.rowlines.rowspacing.rowspan.rspace.rquote.scriptlevel.scriptminsize.scriptsizemultiplier.selection.separator.separators.stretchy.subscriptshift.supscriptshift.symmetric.voffset.width.xmlns`.split(`.`)),dz=xR([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),fz=SR(/{{[\w\W]*|^[\w\W]*}}/g),pz=SR(/<%[\w\W]*|^[\w\W]*%>/g),mz=SR(/\${[\w\W]*/g),hz=SR(/^data-[\-\w.\u00B7-\uFFFF]+$/),gz=SR(/^aria-[\-\w]+$/),_z=SR(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),vz=SR(/^(?:\w+script|data):/i),yz=SR(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),bz=SR(/^html$/i),xz=SR(/^[a-z][.\w]*(-[.\w]+)+$/i),Sz=SR(/<[/\w!]/g),Cz=SR(/<[/\w]/g),wz=SR(/<\/no(script|embed|frames)/i),Tz=SR(/\/>/i),Ez={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},Dz=[`style`,`script`,`xmp`,`iframe`,`noembed`,`noframes`,`plaintext`,`noscript`],Oz=xR(YR({},Dz)),kz=function(){let e={};return DR(Dz,t=>{e[t]=SR(RegExp(`</`+t+`(?=[\\t\\n\\f\\r />])`,`i`))}),xR(e)}(),Az=function(){return typeof window>`u`?null:window},jz=function(e,t){if(typeof e!=`object`||typeof e.createPolicy!=`function`)return null;let n=null,r=`data-tt-policy-suffix`;t&&t.hasAttribute(r)&&(n=t.getAttribute(r));let i=`dompurify`+(n?`#`+n:``);try{return e.createPolicy(i,{createHTML(e){return e},createScriptURL(e){return e}})}catch{return console.warn(`TrustedTypes policy `+i+` could not be created.`),null}},Mz=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},Nz=function(e,t,n,r){return UR(e,t)&&MR(e[t])?YR(r.base?ZR(r.base):{},e[t],r.transform):n},Pz=function(e,t,n){let r=UR(e,t)?e[t]:void 0;return r&&typeof r==`object`?ZR(r):n()};function Fz(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Az(),t=e=>Fz(e);if(t.version=`3.4.16`,t.removed=[],!e||!e.document||e.document.nodeType!==Ez.document||!e.Element)return t.isSupported=!1,t;let n=e.document,r=n,i=r.currentScript;e.DocumentFragment;let a=e.HTMLTemplateElement,o=e.Node,s=e.Element,c=e.NodeFilter;e.NamedNodeMap===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;let l=e.DOMParser,u=e.trustedTypes,d=s.prototype,f=$R(d,`cloneNode`),p=$R(d,`remove`),m=$R(d,`removeAttributeNode`),h=$R(d,`nextSibling`),g=$R(d,`childNodes`),_=$R(d,`parentNode`),v=$R(d,`shadowRoot`),y=$R(d,`attributes`),b=o&&o.prototype?$R(o.prototype,`nodeType`):null,x=o&&o.prototype?$R(o.prototype,`nodeName`):null,S=o&&o.prototype?$R(o.prototype,`ownerDocument`):null,C=function(e){return b?b(e):e.nodeType},w=function(e){return x?x(e):e.nodeName};if(typeof a==`function`){let e=n.createElement(`template`);e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let T,ee=``,E,te=!1,ne=0,D=function(){if(ne>0)throw KR(`A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.`)},re=function(e){D(),ne++;try{return T.createHTML(e)}finally{ne--}},ie=function(e){D(),ne++;try{return T.createScriptURL(e)}finally{ne--}},ae=function(){return te||=(E=jz(u,i),!0),E},O=n,oe=O.implementation,se=O.createNodeIterator,ce=O.createDocumentFragment,le=O.getElementsByTagName,ue=r.importNode,de=Mz();t.isSupported=typeof gR==`function`&&typeof _==`function`&&oe&&oe.createHTMLDocument!==void 0;let fe=fz,pe=pz,me=mz,he=hz,ge=gz,_e=vz,ve=yz,ye=xz,k=_z,A=null,be=YR({},[...tz,...nz,...rz,...az,...sz]),xe=null,Se=YR({},[...cz,...lz,...uz,...dz]),Ce=Object.seal(CR(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),we=null,Te=null,Ee=Object.seal(CR(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),De=!0,Oe=!0,ke=!1,Ae=!0,je=!1,Me=!0,Ne=!1,Pe=!1,Fe=null,Ie=null,Le=!1,Re=!1,ze=!1,Be=!1,Ve=!0,He=!1,Ue=`user-content-`,We=!0,Ge=!1,Ke={},qe=null,Je=YR({},`annotation-xml.audio.colgroup.desc.foreignobject.head.iframe.math.mi.mn.mo.ms.mtext.noembed.noframes.noscript.plaintext.script.selectedcontent.style.svg.template.thead.title.video.xmp`.split(`.`)),Ye=null,Xe=YR({},[`audio`,`video`,`img`,`source`,`image`,`track`]),Ze=null,Qe=YR({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),$e=`http://www.w3.org/1998/Math/MathML`,et=`http://www.w3.org/2000/svg`,tt=`http://www.w3.org/1999/xhtml`,nt=tt,rt=!1,it=null,at=YR({},[$e,et,tt],PR),ot=xR([`mi`,`mo`,`mn`,`ms`,`mtext`]),st=YR({},ot),ct=xR([`annotation-xml`]),lt=YR({},ct),ut=YR({},[`title`,`style`,`font`,`a`,`script`]),dt=null,ft=[`application/xhtml+xml`,`text/html`],pt=null,mt=null,ht=n.createElement(`form`),gt=function(e){return e instanceof RegExp||e instanceof Function},_t=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(mt&&mt===e)return;(!e||typeof e!=`object`)&&(e={}),e=ZR(e),dt=ft.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,pt=dt===`application/xhtml+xml`?PR:NR,A=Nz(e,`ALLOWED_TAGS`,be,{transform:pt}),xe=Nz(e,`ALLOWED_ATTR`,Se,{transform:pt}),it=Nz(e,`ALLOWED_NAMESPACES`,at,{transform:PR}),Ze=Nz(e,`ADD_URI_SAFE_ATTR`,Qe,{transform:pt,base:Qe}),Ye=Nz(e,`ADD_DATA_URI_TAGS`,Xe,{transform:pt,base:Xe}),qe=Nz(e,`FORBID_CONTENTS`,Je,{transform:pt}),we=Nz(e,`FORBID_TAGS`,ZR({}),{transform:pt}),Te=Nz(e,`FORBID_ATTR`,ZR({}),{transform:pt}),Ke=UR(e,`USE_PROFILES`)?e.USE_PROFILES&&typeof e.USE_PROFILES==`object`?ZR(e.USE_PROFILES):e.USE_PROFILES:!1,De=e.ALLOW_ARIA_ATTR!==!1,Oe=e.ALLOW_DATA_ATTR!==!1,ke=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Ae=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,je=e.SAFE_FOR_TEMPLATES||!1,Me=e.SAFE_FOR_XML!==!1,Ne=e.WHOLE_DOCUMENT||!1,Re=e.RETURN_DOM||!1,ze=e.RETURN_DOM_FRAGMENT||!1,Be=e.RETURN_TRUSTED_TYPE||!1,Le=e.FORCE_BODY||!1,Ve=e.SANITIZE_DOM!==!1,He=e.SANITIZE_NAMED_PROPS||!1,We=e.KEEP_CONTENT!==!1,Ge=e.IN_PLACE||!1,k=ez(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:_z,nt=typeof e.NAMESPACE==`string`?e.NAMESPACE:tt,st=Pz(e,`MATHML_TEXT_INTEGRATION_POINTS`,()=>YR({},ot)),lt=Pz(e,`HTML_INTEGRATION_POINTS`,()=>YR({},ct));let t=Pz(e,`CUSTOM_ELEMENT_HANDLING`,()=>CR(null));if(Ce=CR(null),UR(t,`tagNameCheck`)&>(t.tagNameCheck)&&(Ce.tagNameCheck=t.tagNameCheck),UR(t,`attributeNameCheck`)&>(t.attributeNameCheck)&&(Ce.attributeNameCheck=t.attributeNameCheck),UR(t,`allowCustomizedBuiltInElements`)&&typeof t.allowCustomizedBuiltInElements==`boolean`&&(Ce.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),SR(Ce),je&&(Oe=!1),ze&&(Re=!0),Ke&&(A=YR({},sz),xe=CR(null),Ke.html===!0&&(YR(A,tz),YR(xe,cz)),Ke.svg===!0&&(YR(A,nz),YR(xe,lz),YR(xe,dz)),Ke.svgFilters===!0&&(YR(A,rz),YR(xe,lz),YR(xe,dz)),Ke.mathMl===!0&&(YR(A,az),YR(xe,uz),YR(xe,dz))),Ee.tagCheck=null,Ee.attributeCheck=null,UR(e,`ADD_TAGS`)&&(typeof e.ADD_TAGS==`function`?Ee.tagCheck=e.ADD_TAGS:MR(e.ADD_TAGS)&&(A===be&&(A=ZR(A)),YR(A,e.ADD_TAGS,pt))),UR(e,`ADD_ATTR`)&&(typeof e.ADD_ATTR==`function`?Ee.attributeCheck=e.ADD_ATTR:MR(e.ADD_ATTR)&&(xe===Se&&(xe=ZR(xe)),YR(xe,e.ADD_ATTR,pt))),UR(e,`ADD_FORBID_CONTENTS`)&&MR(e.ADD_FORBID_CONTENTS)&&(qe===Je&&(qe=ZR(qe)),YR(qe,e.ADD_FORBID_CONTENTS,pt)),We&&(A[`#text`]=!0),Ne&&YR(A,[`html`,`head`,`body`]),A.table&&(YR(A,[`tbody`]),delete we.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw KR(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw KR(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);let t=T;T=e.TRUSTED_TYPES_POLICY;try{ee=re(``)}catch(e){throw T=t,e}}else e.TRUSTED_TYPES_POLICY===null?(T=void 0,ee=``):(T===void 0&&(T=ae()),T&&typeof ee==`string`&&(ee=re(``)));xR&&xR(e),mt=e},vt=YR({},[...nz,...rz,...iz]),yt=YR({},[...az,...oz]),bt=function(e,t,n){return t.namespaceURI===tt?e===`svg`:t.namespaceURI===$e?e===`svg`&&(n===`annotation-xml`||st[n]):!!vt[e]},xt=function(e,t,n){return t.namespaceURI===tt?e===`math`:t.namespaceURI===et?e===`math`&<[n]:!!yt[e]},St=function(e,t,n){return t.namespaceURI===et&&!lt[n]||t.namespaceURI===$e&&!st[n]?!1:!yt[e]&&(ut[e]||!vt[e])},Ct=function(e){let t=_(e);(!t||!t.tagName)&&(t={namespaceURI:nt,tagName:`template`});let n=NR(e.tagName),r=NR(t.tagName);return it[e.namespaceURI]?e.namespaceURI===et?bt(n,t,r):e.namespaceURI===$e?xt(n,t,r):e.namespaceURI===tt?St(n,t,r):!!(dt===`application/xhtml+xml`&&it[e.namespaceURI]):!1},wt=function(e){AR(t.removed,{element:e});try{_(e).removeChild(e)}catch{if(p(e),!_(e))throw KR(`a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place`)}},Tt=function(e,t,n){try{m(e,t)}catch{try{e.removeAttribute(n)}catch{}}},Et=function(e){kt(e);let t=g(e);if(t){let e=[];DR(t,t=>{AR(e,t)}),DR(e,e=>{try{p(e)}catch{}})}let n=y(e);if(n)for(let t=n.length-1;t>=0;--t){let r=n[t],i=r&&r.name;typeof i==`string`&&Tt(e,r,i)}},Dt=function(e,n,r){if(!r)try{r=n.getAttributeNode(e)}catch{r=null}AR(t.removed,{attribute:r||null,from:n});try{r?m(n,r):n.removeAttribute(e)}catch{try{n.removeAttribute(e)}catch{}}if(e===`is`){if(Re||ze)try{wt(n)}catch{}else try{n.setAttribute(e,``)}catch{}}},Ot=function(e){let t=y(e);if(t)for(let n=t.length-1;n>=0;--n){let r=t[n],i=r&&r.name;typeof i!=`string`||xe[pt(i)]||Tt(e,r,i)}},kt=function(e){let t=[e];for(;t.length>0;){let e=t.pop();C(e)===Ez.element&&Ot(e);let n=g(e);if(n)for(let e=n.length-1;e>=0;--e)t.push(n[e])}},At=function(e,t){return Me?e===`patchsrc`||e===`for`&&t!==`label`&&t!==`output`:!1},jt=function(e){if(!Me)return;let t=[e];for(;t.length>0;){let e=t.pop(),n=C(e);if(n===Ez.processingInstruction||n===Ez.comment&&GR(Cz,e.data)){try{p(e)}catch{}continue}if(n===Ez.element){let t=e,n=pt(w(e));try{t.hasAttribute&&t.hasAttribute(`patchsrc`)&&t.removeAttribute(`patchsrc`),t.hasAttribute&&t.hasAttribute(`for`)&&At(`for`,n)&&t.removeAttribute(`for`)}catch{}}let r=g(e);if(r)for(let e=r.length-1;e>=0;--e)t.push(r[e])}},Mt=function(e){let t=null,r=null;if(Le)e=`<remove></remove>`+e;else{let t=FR(e,/^[\r\n\t ]+/);r=t&&t[0]}dt===`application/xhtml+xml`&&nt===tt&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=T?re(e):e;if(nt===tt)try{t=new l().parseFromString(i,dt)}catch{}if(!t||!t.documentElement){t=oe.createDocument(nt,`template`,null);try{t.documentElement.innerHTML=rt?ee:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),nt===tt?le.call(t,Ne?`html`:`body`)[0]:Ne?t.documentElement:a},Nt=function(e){let t=S?S(e):e.ownerDocument;return se.call(t||e,e,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},Pt=function(e){return e=IR(e,fe,` `),e=IR(e,pe,` `),e=IR(e,me,` `),e},Ft=function(e){e.normalize();let t=S?S(e):e.ownerDocument,n=se.call(t||e,e,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null),r=n.nextNode();for(;r;)r.data=Pt(r.data),r=n.nextNode();let i=e.querySelectorAll?.call(e,`template`);i&&DR(i,e=>{Lt(e.content)&&Ft(e.content)})},It=function(e){let t=x?x(e):null;return typeof t!=`string`||pt(t)!==`form`?!1:typeof e.nodeName!=`string`||typeof e.textContent!=`string`||typeof e.removeChild!=`function`||e.attributes!==y(e)||typeof e.removeAttribute!=`function`||typeof e.removeAttributeNode!=`function`||typeof e.getAttributeNode!=`function`||typeof e.setAttribute!=`function`||typeof e.namespaceURI!=`string`||typeof e.insertBefore!=`function`||typeof e.hasChildNodes!=`function`||e.nodeType!==b(e)||e.childNodes!==g(e)},Lt=function(e){if(!b||typeof e!=`object`||!e)return!1;try{return b(e)===Ez.documentFragment}catch{return!1}},Rt=function(e){if(!b||typeof e!=`object`||!e)return!1;try{return typeof b(e)==`number`}catch{return!1}};function zt(e,n,r){e.length!==0&&DR(e,e=>{e.call(t,n,r,mt)})}let Bt=function(e,t){return!!(Me&&e.hasChildNodes()&&!Rt(e.firstElementChild)&&GR(Sz,e.textContent)&&GR(Sz,e.innerHTML)||Me&&e.namespaceURI===tt&&Oz[t]&&(Rt(e.firstElementChild)||typeof e.textContent==`string`&&GR(kz[t],e.textContent))||e.nodeType===Ez.processingInstruction||Me&&e.nodeType===Ez.comment&&GR(Cz,e.data))},Vt=function(e,t){return e instanceof RegExp?GR(e,t):e instanceof Function&&!!e(t,...[...arguments].slice(2))},Ht=function(e,t,n){if(!we[t]&&Jt(t)&&Vt(Ce.tagNameCheck,t))return!1;if(We&&!qe[t]){let t=_(e),r=g(e);if(r&&t){let i=r.length;for(let a=i-1;a>=0;--a){let i=e===n?f(r[a],!0):r[a];t.insertBefore(i,h(e))}}}return wt(e),!0},Ut=function(e,t,n,r){return e.length===0?t:t===n||t===r?ZR(t):t},Wt=function(e,t){return e===t||_(e)!==null?!1:(Ge&&kt(e),!0)},Gt=function(e,n){if(zt(de.beforeSanitizeElements,e,null),Wt(e,n))return!0;if(It(e))return wt(e),!0;let r=pt(w(e));if(A=Ut(de.uponSanitizeElement,A,be,Fe),zt(de.uponSanitizeElement,e,{tagName:r,allowedTags:A}),Wt(e,n))return!0;if(Bt(e,r))return wt(e),!0;if(we[r]||!(Ee.tagCheck instanceof Function&&Ee.tagCheck(r))&&!A[r]){let t=Ht(e,r,n);return t===!1&&(zt(de.afterSanitizeElements,e,null),Wt(e,n))?!0:t}if(C(e)===Ez.element&&!Ct(e)||(r===`noscript`||r===`noembed`||r===`noframes`)&&GR(wz,e.innerHTML))return wt(e),!0;if(je&&e.nodeType===Ez.text){let n=Pt(e.textContent);e.textContent!==n&&(AR(t.removed,{element:e.cloneNode()}),e.textContent=n)}return zt(de.afterSanitizeElements,e,null),Wt(e,n)},Kt=function(e,t,r){if(Te[t]||At(t,e)||Ve&&(t===`id`||t===`name`)&&(r in n||r in ht))return!1;let i=xe[t]||Ee.attributeCheck instanceof Function&&Ee.attributeCheck(t,e);return Oe&&GR(he,t)||De&&GR(ge,t)?!0:i?Ze[t]||GR(k,IR(r,ve,``))||(t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&LR(r,`data:`)===0&&Ye[e]||ke&&!GR(_e,IR(r,ve,``))?!0:!r:Jt(e)&&Vt(Ce.tagNameCheck,e)&&Vt(Ce.attributeNameCheck,t,e)||t===`is`&&Ce.allowCustomizedBuiltInElements&&Vt(Ce.tagNameCheck,r)},qt=YR({},[`annotation-xml`,`color-profile`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`missing-glyph`]),Jt=function(e){return!qt[NR(e)]&&GR(ye,e)},Yt=function(e,t,n,r){if(T&&typeof u==`object`&&typeof u.getAttributeType==`function`&&!n)switch(u.getAttributeType(e,t)){case`TrustedHTML`:return re(r);case`TrustedScriptURL`:return ie(r)}return r},Xt=function(e,t,n,r){try{return n?e.setAttributeNS(n,t,r):e.setAttribute(t,r),!It(e)||(wt(e),!1)}catch{return Dt(t,e),!1}},Zt=function(e,n){if(zt(de.beforeSanitizeAttributes,e,null),Wt(e,n))return;let r=e.attributes;if(!r||It(e))return;xe=Ut(de.uponSanitizeAttribute,xe,Se,Ie);let i={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:xe,forceKeepAttr:void 0},a=r.length,o=pt(e.nodeName);for(;a--;){let n=r[a],s=n.name,c=n.namespaceURI,l=n.value,u=pt(s),d=l,f=s===`value`?d:RR(d),p=!1;i.attrName=u,i.attrValue=f,i.keepAttr=!0,i.forceKeepAttr=void 0,zt(de.uponSanitizeAttribute,e,i),f=i.attrValue,He&&(u===`id`||u===`name`)&&LR(f,Ue)!==0&&(Dt(s,e,n),f=Ue+f,p=!0),Me&&GR(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,f)||u===`attributename`&&FR(f,`href`)?Dt(s,e,n):i.forceKeepAttr||(i.keepAttr?!Ae&&GR(Tz,f)?Dt(s,e,n):(je&&(f=Pt(f)),Kt(o,u,f)?(f=Yt(o,u,c,f),f!==d&&Xt(e,s,c,f)&&p&&kR(t.removed)):Dt(s,e,n)):Dt(s,e,n))}zt(de.afterSanitizeAttributes,e,null),Wt(e,n)},j=function(e){let t=null,n=Nt(e);for(zt(de.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)if(zt(de.uponSanitizeShadowNode,t,null),Gt(t,e),Zt(t,e),Lt(t.content)&&j(t.content),C(t)===Ez.element){let e=v(t);Lt(e)&&(Qt(e),j(e))}zt(de.afterSanitizeShadowDOM,e,null)},Qt=function(e){let t=[{node:e,shadow:null}];for(;t.length>0;){let e=t.pop();if(e.shadow){j(e.shadow);continue}let n=e.node,r=C(n)===Ez.element,i=g(n);if(i)for(let e=i.length-1;e>=0;--e)t.push({node:i[e],shadow:null});if(r){let e=x?x(n):null;if(typeof e==`string`&&pt(e)===`template`){let e=n.content;Lt(e)&&t.push({node:e,shadow:null})}}if(r){let e=v(n);Lt(e)&&t.push({node:null,shadow:e},{node:e,shadow:null})}}};return t.sanitize=function(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=null,a=null,o=null,s=null;if(rt=!e,rt&&(e=`<!-->`),typeof e!=`string`&&!Rt(e)&&(e=QR(e),typeof e!=`string`))throw KR(`dirty is not a string, aborting`);if(!t.isSupported)return e;Pe?(A=Fe,xe=Ie):_t(n),(de.uponSanitizeElement.length>0||de.uponSanitizeAttribute.length>0)&&(A=ZR(A)),de.uponSanitizeAttribute.length>0&&(xe=ZR(xe)),t.removed=[];let c=Ge&&typeof e!=`string`&&Rt(e);if(c){jt(e);let t=w(e);if(typeof t==`string`){let n=pt(t);if(!A[n]||we[n])throw Et(e),KR(`root node is forbidden and cannot be sanitized in-place`)}if(It(e))throw Et(e),KR(`root node is clobbered and cannot be sanitized in-place`);try{Qt(e)}catch(t){throw Et(e),t}}else if(Rt(e))i=Mt(`<!---->`),a=i.ownerDocument.importNode(e,!0),a.nodeType===Ez.element&&a.nodeName===`BODY`||a.nodeName===`HTML`?i=a:i.appendChild(a),Qt(i);else{if(!Re&&!je&&!Ne&&e.indexOf(`<`)===-1)return T&&Be?re(e):e;if(i=Mt(e),!i)return Re?null:Be?ee:``}i&&Le&&wt(i.firstChild);let l=c?e:i;try{let e=Nt(l);for(;o=e.nextNode();)Gt(o,l),Zt(o,l),Lt(o.content)&&j(o.content)}catch(n){throw c&&(Et(e),DR(t.removed,e=>{e.element&&kt(e.element)})),n}if(c){let n=!1;if(DR(t.removed,t=>{t.element&&(t.element===e&&(n=!0),kt(t.element))}),n)throw KR(`a node selected for removal could not be safely returned; refusing to sanitize in place`);return je&&Ft(e),e}if(Re){if(je&&Ft(i),ze)for(s=ce.call(i.ownerDocument);i.firstChild;)s.appendChild(i.firstChild);else s=i;return(xe.shadowroot||xe.shadowrootmode)&&(s=ue.call(r,s,!0)),s}let u=Ne?i.outerHTML:i.innerHTML;return Ne&&A[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&GR(bz,i.ownerDocument.doctype.name)&&(u=`<!DOCTYPE `+i.ownerDocument.doctype.name+`>
|
|
127
|
+
`+u),je&&(u=Pt(u)),T&&Be?re(u):u},t.setConfig=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};_t(e),Pe=!0,Fe=A,Ie=xe},t.clearConfig=function(){mt=null,Pe=!1,Fe=null,Ie=null,T=E,ee=``},t.isValidAttribute=function(e,t,n){mt||_t({});let r=pt(e),i=pt(t);return Kt(r,i,n)},t.addHook=function(e,t){typeof t==`function`&&UR(de,e)&&AR(de[e],t)},t.removeHook=function(e,t){if(UR(de,e)){if(t!==void 0){let n=OR(de[e],t);return n===-1?void 0:jR(de[e],n,1)[0]}return kR(de[e])}},t.removeHooks=function(e){UR(de,e)&&(de[e]=[])},t.removeAllHooks=function(){de=Mz()},t}var Iz=Fz(),Lz=l(o(((e,t)=>{function n(e){return e instanceof Map?e.clear=e.delete=e.set=function(){throw Error(`map is read-only`)}:e instanceof Set&&(e.add=e.clear=e.delete=function(){throw Error(`set is read-only`)}),Object.freeze(e),Object.getOwnPropertyNames(e).forEach(t=>{let r=e[t],i=typeof r;(i===`object`||i===`function`)&&!Object.isFrozen(r)&&n(r)}),e}var r=class{constructor(e){e.data===void 0&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}};function i(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`)}function a(e,...t){let n=Object.create(null);for(let t in e)n[t]=e[t];return t.forEach(function(e){for(let t in e)n[t]=e[t]}),n}var o=`</span>`,s=e=>!!e.scope,c=(e,{prefix:t})=>{if(e.startsWith(`language:`))return e.replace(`language:`,`language-`);if(e.includes(`.`)){let n=e.split(`.`);return[`${t}${n.shift()}`,...n.map((e,t)=>`${e}${`_`.repeat(t+1)}`)].join(` `)}return`${t}${e}`},l=class{constructor(e,t){this.buffer=``,this.classPrefix=t.classPrefix,e.walk(this)}addText(e){this.buffer+=i(e)}openNode(e){if(!s(e))return;let t=c(e.scope,{prefix:this.classPrefix});this.span(t)}closeNode(e){s(e)&&(this.buffer+=o)}value(){return this.buffer}span(e){this.buffer+=`<span class="${e}">`}},u=(e={})=>{let t={children:[]};return Object.assign(t,e),t},d=class e{constructor(){this.rootNode=u(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(e){this.top.children.push(e)}openNode(e){let t=u({scope:e});this.add(t),this.stack.push(t)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(e){return this.constructor._walk(e,this.rootNode)}static _walk(e,t){return typeof t==`string`?e.addText(t):t.children&&(e.openNode(t),t.children.forEach(t=>this._walk(e,t)),e.closeNode(t)),e}static _collapse(t){typeof t!=`string`&&t.children&&(t.children.every(e=>typeof e==`string`)?t.children=[t.children.join(``)]:t.children.forEach(t=>{e._collapse(t)}))}},f=class extends d{constructor(e){super(),this.options=e}addText(e){e!==``&&this.add(e)}startScope(e){this.openNode(e)}endScope(){this.closeNode()}__addSublanguage(e,t){let n=e.root;t&&(n.scope=`language:${t}`),this.add(n)}toHTML(){return new l(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}};function p(e){return e?typeof e==`string`?e:e.source:null}function m(e){return _(`(?=`,e,`)`)}function h(e){return _(`(?:`,e,`)*`)}function g(e){return _(`(?:`,e,`)?`)}function _(...e){return e.map(e=>p(e)).join(``)}function v(e){let t=e[e.length-1];return typeof t==`object`&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function y(...e){return`(`+(v(e).capture?``:`?:`)+e.map(e=>p(e)).join(`|`)+`)`}function b(e){return RegExp(e.toString()+`|`).exec(``).length-1}function x(e,t){let n=e&&e.exec(t);return n&&n.index===0}var S=new RegExp(y(/\[(?:[^\\\]]|\\.)*\]/,/\(\?<(?![=!])[^>]+>/,/\(\?'[^']+'/,/\(\??/,/\\([1-9][0-9]*)/,/\\./));function C(e,{joinWith:t}){let n=0;return e.map(e=>{n+=1;let t=n,r=p(e),i=``;for(;r.length>0;){let e=S.exec(r);if(!e){i+=r;break}i+=r.substring(0,e.index),r=r.substring(e.index+e[0].length),e[0][0]===`\\`&&e[1]?i+=`\\`+String(Number(e[1])+t):(i+=e[0],(e[0]===`(`||/^\(\?[<']/.test(e[0]))&&n++)}return i}).map(e=>`(${e})`).join(t)}var w=/\b\B/,T=`[a-zA-Z]\\w*`,ee=`[a-zA-Z_]\\w*`,E=`\\b\\d+(\\.\\d+)?`,te=`(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)`,ne=`\\b(0b[01]+)`,D=`!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~`,re=(e={})=>{let t=/^#![ ]*\//;return e.binary&&(e.begin=_(t,/.*\b/,e.binary,/\b.*/)),a({scope:`meta`,begin:t,end:/$/,relevance:0,"on:begin":(e,t)=>{e.index!==0&&t.ignoreMatch()}},e)},ie={begin:`\\\\[\\s\\S]`,relevance:0},ae={scope:`string`,begin:`'`,end:`'`,illegal:`\\n`,contains:[ie]},O={scope:`string`,begin:`"`,end:`"`,illegal:`\\n`,contains:[ie]},oe={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},se=function(e,t,n={}){let r=a({scope:`comment`,begin:e,end:t,contains:[]},n);r.contains.push({scope:`doctag`,begin:`[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)`,end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});let i=y(`I`,`a`,`is`,`so`,`us`,`to`,`at`,`if`,`in`,`it`,`on`,/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return r.contains.push({begin:_(/[ ]+/,`(`,i,/[.]?[:]?([.][ ]|[ ])/,`){3}`)}),r},ce=se(`//`,`$`),le=se(`/\\*`,`\\*/`),ue=se(`#`,`$`),de=Object.freeze({__proto__:null,APOS_STRING_MODE:ae,BACKSLASH_ESCAPE:ie,BINARY_NUMBER_MODE:{scope:`number`,begin:ne,relevance:0},BINARY_NUMBER_RE:ne,COMMENT:se,C_BLOCK_COMMENT_MODE:le,C_LINE_COMMENT_MODE:ce,C_NUMBER_MODE:{scope:`number`,begin:te,relevance:0},C_NUMBER_RE:te,END_SAME_AS_BEGIN:function(e){return Object.assign(e,{"on:begin":(e,t)=>{t.data._beginMatch=e[1]},"on:end":(e,t)=>{t.data._beginMatch!==e[1]&&t.ignoreMatch()}})},HASH_COMMENT_MODE:ue,IDENT_RE:T,MATCH_NOTHING_RE:w,METHOD_GUARD:{begin:`\\.\\s*[a-zA-Z_]\\w*`,relevance:0},NUMBER_MODE:{scope:`number`,begin:E,relevance:0},NUMBER_RE:E,PHRASAL_WORDS_MODE:oe,QUOTE_STRING_MODE:O,REGEXP_MODE:{scope:`regexp`,begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[ie,{begin:/\[/,end:/\]/,relevance:0,contains:[ie]}]},RE_STARTERS_RE:D,SHEBANG:re,TITLE_MODE:{scope:`title`,begin:T,relevance:0},UNDERSCORE_IDENT_RE:ee,UNDERSCORE_TITLE_MODE:{scope:`title`,begin:ee,relevance:0}});function fe(e,t){e.input[e.index-1]===`.`&&t.ignoreMatch()}function pe(e,t){e.className!==void 0&&(e.scope=e.className,delete e.className)}function me(e,t){t&&e.beginKeywords&&(e.begin=`\\b(`+e.beginKeywords.split(` `).join(`|`)+`)(?!\\.)(?=\\b|\\s)`,e.__beforeBegin=fe,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords,e.relevance===void 0&&(e.relevance=0))}function he(e,t){Array.isArray(e.illegal)&&(e.illegal=y(...e.illegal))}function ge(e,t){if(e.match){if(e.begin||e.end)throw Error(`begin & end are not supported with match`);e.begin=e.match,delete e.match}}function _e(e,t){e.relevance===void 0&&(e.relevance=1)}var ve=(e,t)=>{if(!e.beforeMatch)return;if(e.starts)throw Error(`beforeMatch cannot be used with starts`);let n=Object.assign({},e);Object.keys(e).forEach(t=>{delete e[t]}),e.keywords=n.keywords,e.begin=_(n.beforeMatch,m(n.begin)),e.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},e.relevance=0,delete n.beforeMatch},ye=[`of`,`and`,`for`,`in`,`not`,`or`,`if`,`then`,`parent`,`list`,`value`],k=`keyword`;function A(e,t,n=k){let r=Object.create(null);return typeof e==`string`?i(n,e.split(` `)):Array.isArray(e)?i(n,e):Object.keys(e).forEach(function(n){Object.assign(r,A(e[n],t,n))}),r;function i(e,n){t&&(n=n.map(e=>e.toLowerCase())),n.forEach(function(t){let n=t.split(`|`);r[n[0]]=[e,be(n[0],n[1])]})}}function be(e,t){return t?Number(t):+!xe(e)}function xe(e){return ye.includes(e.toLowerCase())}var Se={},Ce=e=>{console.error(e)},we=(e,...t)=>{console.log(`WARN: ${e}`,...t)},Te=(e,t)=>{Se[`${e}/${t}`]||(console.log(`Deprecated as of ${e}. ${t}`),Se[`${e}/${t}`]=!0)},Ee=Error();function De(e,t,{key:n}){let r=0,i=e[n],a={},o={};for(let e=1;e<=t.length;e++)o[e+r]=i[e],a[e+r]=!0,r+=b(t[e-1]);e[n]=o,e[n]._emit=a,e[n]._multi=!0}function Oe(e){if(Array.isArray(e.begin)){if(e.skip||e.excludeBegin||e.returnBegin)throw Ce(`skip, excludeBegin, returnBegin not compatible with beginScope: {}`),Ee;if(typeof e.beginScope!=`object`||e.beginScope===null)throw Ce(`beginScope must be object`),Ee;De(e,e.begin,{key:`beginScope`}),e.begin=C(e.begin,{joinWith:``})}}function ke(e){if(Array.isArray(e.end)){if(e.skip||e.excludeEnd||e.returnEnd)throw Ce(`skip, excludeEnd, returnEnd not compatible with endScope: {}`),Ee;if(typeof e.endScope!=`object`||e.endScope===null)throw Ce(`endScope must be object`),Ee;De(e,e.end,{key:`endScope`}),e.end=C(e.end,{joinWith:``})}}function Ae(e){e.scope&&typeof e.scope==`object`&&e.scope!==null&&(e.beginScope=e.scope,delete e.scope)}function je(e){Ae(e),typeof e.beginScope==`string`&&(e.beginScope={_wrap:e.beginScope}),typeof e.endScope==`string`&&(e.endScope={_wrap:e.endScope}),Oe(e),ke(e)}function Me(e){function t(t,n){return new RegExp(p(t),`m`+(e.case_insensitive?`i`:``)+(e.unicodeRegex?`u`:``)+(n?`g`:``))}class n{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(e,t){t.position=this.position++,this.matchIndexes[this.matchAt]=t,this.regexes.push([t,e]),this.matchAt+=b(e)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);let e=this.regexes.map(e=>e[1]);this.matcherRe=t(C(e,{joinWith:`|`}),!0),this.lastIndex=0}exec(e){this.matcherRe.lastIndex=this.lastIndex;let t=this.matcherRe.exec(e);if(!t)return null;let n=t.findIndex((e,t)=>t>0&&e!==void 0),r=this.matchIndexes[n];return t.splice(0,n),Object.assign(t,r)}}class r{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(e){if(this.multiRegexes[e])return this.multiRegexes[e];let t=new n;return this.rules.slice(e).forEach(([e,n])=>t.addRule(e,n)),t.compile(),this.multiRegexes[e]=t,t}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(e,t){this.rules.push([e,t]),t.type===`begin`&&this.count++}exec(e){let t=this.getMatcher(this.regexIndex);t.lastIndex=this.lastIndex;let n=t.exec(e);if(this.resumingScanAtSamePosition()&&!(n&&n.index===this.lastIndex)){let t=this.getMatcher(0);t.lastIndex=this.lastIndex+1,n=t.exec(e)}return n&&(this.regexIndex+=n.position+1,this.regexIndex===this.count&&this.considerAll()),n}}function i(e){let t=new r;return e.contains.forEach(e=>t.addRule(e.begin,{rule:e,type:`begin`})),e.terminatorEnd&&t.addRule(e.terminatorEnd,{type:`end`}),e.illegal&&t.addRule(e.illegal,{type:`illegal`}),t}function o(n,r){let a=n;if(n.isCompiled)return a;[pe,ge,je,ve].forEach(e=>e(n,r)),e.compilerExtensions.forEach(e=>e(n,r)),n.__beforeBegin=null,[me,he,_e].forEach(e=>e(n,r)),n.isCompiled=!0;let s=null;return typeof n.keywords==`object`&&n.keywords.$pattern&&(n.keywords=Object.assign({},n.keywords),s=n.keywords.$pattern,delete n.keywords.$pattern),s||=/\w+/,n.keywords&&=A(n.keywords,e.case_insensitive),a.keywordPatternRe=t(s,!0),r&&(n.begin||=/\B|\b/,a.beginRe=t(a.begin),!n.end&&!n.endsWithParent&&(n.end=/\B|\b/),n.end&&(a.endRe=t(a.end)),a.terminatorEnd=p(a.end)||``,n.endsWithParent&&r.terminatorEnd&&(a.terminatorEnd+=(n.end?`|`:``)+r.terminatorEnd)),n.illegal&&(a.illegalRe=t(n.illegal)),n.contains||=[],n.contains=[].concat(...n.contains.map(function(e){return Pe(e===`self`?n:e)})),n.contains.forEach(function(e){o(e,a)}),n.starts&&o(n.starts,r),a.matcher=i(a),a}if(e.compilerExtensions||=[],e.contains&&e.contains.includes(`self`))throw Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return e.classNameAliases=a(e.classNameAliases||{}),o(e)}function Ne(e){return e?e.endsWithParent||Ne(e.starts):!1}function Pe(e){return e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map(function(t){return a(e,{variants:null},t)})),e.cachedVariants?e.cachedVariants:Ne(e)?a(e,{starts:e.starts?a(e.starts):null}):Object.isFrozen(e)?a(e):e}var Fe=`11.12.0`,Ie=class extends Error{constructor(e,t){super(e),this.name=`HTMLInjectionError`,this.html=t}},Le=i,Re=a,ze=Symbol(`nomatch`),Be=7,Ve=function(e){let t=Object.create(null),i=Object.create(null),a=[],o=!0,s=`Could not find the language '{}', did you forget to load/include a language module?`,c={disableAutodetect:!0,name:`Plain text`,contains:[]},l={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:`hljs-`,cssSelector:`pre code`,languages:null,__emitter:f};function u(e){return l.noHighlightRe.test(e)}function d(e){let t=e.className+` `;t+=e.parentNode?e.parentNode.className:``;let n=l.languageDetectRe.exec(t);if(n){let t=ae(n[1]);return t||(we(s.replace(`{}`,n[1])),we(`Falling back to no-highlight mode for this block.`,e)),t?n[1]:`no-highlight`}return t.split(/\s+/).find(e=>u(e)||ae(e))}function p(e,t,n){let r=``,i=``;typeof t==`object`?(r=e,n=t.ignoreIllegals,i=t.language):(Te(`10.7.0`,`highlight(lang, code, ...args) has been deprecated.`),Te(`10.7.0`,`Please use highlight(code, options) instead.
|
|
128
|
+
https://github.com/highlightjs/highlight.js/issues/2277`),i=e,r=t),n===void 0&&(n=!0);let a={code:r,language:i};ue(`before:highlight`,a);let o=a.result?a.result:v(a.language,a.code,n);return o.code=a.code,ue(`after:highlight`,o),o}function v(e,n,i,a){let c=Object.create(null);function u(e,t){return e.keywords[t]}function d(){if(!D.keywords){ie.addText(O);return}let e=0;D.keywordPatternRe.lastIndex=0;let t=D.keywordPatternRe.exec(O),n=``;for(;t;){n+=O.substring(e,t.index);let r=E.case_insensitive?t[0].toLowerCase():t[0],i=u(D,r);if(i){let[e,a]=i;if(ie.addText(n),n=``,c[r]=(c[r]||0)+1,c[r]<=Be&&(oe+=a),e.startsWith(`_`))n+=t[0];else{let n=E.classNameAliases[e]||e;m(t[0],n)}}else n+=t[0];e=D.keywordPatternRe.lastIndex,t=D.keywordPatternRe.exec(O)}n+=O.substring(e),ie.addText(n)}function f(){if(O===``)return;let e=null;if(typeof D.subLanguage==`string`){if(!t[D.subLanguage]){ie.addText(O);return}e=v(D.subLanguage,O,!0,re[D.subLanguage]),re[D.subLanguage]=e._top}else e=S(O,D.subLanguage.length?D.subLanguage:null);D.relevance>0&&(oe+=e.relevance),ie.__addSublanguage(e._emitter,e.language)}function p(){D.subLanguage==null?d():f(),O=``}function m(e,t){e!==``&&(ie.startScope(t),ie.addText(e),ie.endScope())}function h(e,t){let n=1,r=t.length-1;for(;n<=r;){if(!e._emit[n]){n++;continue}let r=E.classNameAliases[e[n]]||e[n],i=t[n];r?m(i,r):(O=i,d(),O=``),n++}}function g(e,t){return e.scope&&typeof e.scope==`string`&&ie.openNode(E.classNameAliases[e.scope]||e.scope),e.beginScope&&(e.beginScope._wrap?(m(O,E.classNameAliases[e.beginScope._wrap]||e.beginScope._wrap),O=``):e.beginScope._multi&&(h(e.beginScope,t),O=``)),D=Object.create(e,{parent:{value:D}}),D}function _(e,t,n){let i=x(e.endRe,n);if(i){if(e[`on:end`]){let n=new r(e);e[`on:end`](t,n),n.isMatchIgnored&&(i=!1)}if(i){for(;e.endsParent&&e.parent;)e=e.parent;return e}}if(e.endsWithParent)return _(e.parent,t,n)}function y(e){return D.matcher.regexIndex===0?(O+=e[0],1):(le=!0,0)}function b(e){let t=e[0],n=e.rule,i=new r(n),a=[n.__beforeBegin,n[`on:begin`]];for(let n of a)if(n&&(n(e,i),i.isMatchIgnored))return y(t);return n.skip?O+=t:(n.excludeBegin&&(O+=t),p(),!n.returnBegin&&!n.excludeBegin&&(O=t)),g(n,e),n.returnBegin?0:t.length}function C(e){let t=e[0],r=n.substring(e.index),i=_(D,e,r);if(!i)return ze;let a=D;D.endScope&&D.endScope._wrap?(p(),m(t,D.endScope._wrap)):D.endScope&&D.endScope._multi?(p(),h(D.endScope,e)):a.skip?O+=t:(a.returnEnd||a.excludeEnd||(O+=t),p(),a.excludeEnd&&(O=t));do D.scope&&ie.closeNode(),!D.skip&&!D.subLanguage&&(oe+=D.relevance),D=D.parent;while(D!==i.parent);return i.starts&&g(i.starts,e),a.returnEnd?0:t.length}function w(){let e=[];for(let t=D;t!==E;t=t.parent)t.scope&&e.unshift(t.scope);e.forEach(e=>ie.openNode(e))}let T={};function ee(t,r){let a=r&&r[0];if(O+=t,a==null)return p(),0;if(T.type===`begin`&&r.type===`end`&&T.index===r.index&&a===``){if(O+=n.slice(r.index,r.index+1),!o){let t=Error(`0 width match regex (${e})`);throw t.languageName=e,t.badRule=T.rule,t}return 1}if(T=r,r.type===`begin`)return b(r);if(r.type===`illegal`&&!i){let e=Error(`Illegal lexeme "`+a+`" for mode "`+(D.scope||`<unnamed>`)+`"`);throw e.mode=D,e}if(r.type===`end`){let e=C(r);if(e!==ze)return e}if(r.type===`illegal`&&a===``)return r.index===n.length||(O+=`
|
|
129
|
+
`),1;if(ce>1e5&&ce>r.index*3)throw Error(`potential infinite loop, way more iterations than matches`);return O+=a,a.length}let E=ae(e);if(!E)throw Ce(s.replace(`{}`,e)),Error(`Unknown language: "`+e+`"`);let te=Me(E),ne=``,D=a||te,re={},ie=new l.__emitter(l);w();let O=``,oe=0,se=0,ce=0,le=!1;try{if(E.__emitTokens)E.__emitTokens(n,ie);else{for(D.matcher.considerAll();;){ce++,le?le=!1:D.matcher.considerAll(),D.matcher.lastIndex=se;let e=D.matcher.exec(n);if(!e)break;let t=ee(n.substring(se,e.index),e);se=e.index+t}ee(n.substring(se))}return ie.finalize(),ne=ie.toHTML(),{language:e,value:ne,relevance:oe,illegal:!1,_emitter:ie,_top:D}}catch(t){if(t.message&&t.message.includes(`Illegal`))return{language:e,value:Le(n),illegal:!0,relevance:0,_illegalBy:{message:t.message,index:se,context:n.slice(se-100,se+100),mode:t.mode,resultSoFar:ne},_emitter:ie};if(o)return{language:e,value:Le(n),illegal:!1,relevance:0,errorRaised:t,_emitter:ie,_top:D};throw t}}function b(e){let t={value:Le(e),illegal:!1,relevance:0,_top:c,_emitter:new l.__emitter(l)};return t._emitter.addText(e),t}function S(e,n){n=n||l.languages||Object.keys(t);let r=b(e),i=n.filter(ae).filter(oe).map(t=>v(t,e,!1));i.unshift(r);let[a,o]=i.sort((e,t)=>{if(e.relevance!==t.relevance)return t.relevance-e.relevance;if(e.language&&t.language){if(ae(e.language).supersetOf===t.language)return 1;if(ae(t.language).supersetOf===e.language)return-1}return 0}),s=a;return s.secondBest=o,s}function C(e,t,n){let r=t&&i[t]||n;e.classList.add(`hljs`),e.classList.add(`language-${r}`)}function w(e){let t=null,n=d(e);if(u(n))return;if(ue(`before:highlightElement`,{el:e,language:n}),e.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",e);return}if(e.children.length>0&&(l.ignoreUnescapedHTML||(console.warn(`One of your code blocks includes unescaped HTML. This is a potentially serious security risk.`),console.warn(`https://github.com/highlightjs/highlight.js/wiki/security`),console.warn(`The element with unescaped HTML:`),console.warn(e)),l.throwUnescapedHTML))throw new Ie(`One of your code blocks includes unescaped HTML.`,e.innerHTML);t=e;let r=t.textContent,i=n?p(r,{language:n,ignoreIllegals:!0}):S(r);e.innerHTML=i.value,e.dataset.highlighted=`yes`,C(e,n,i.language),e.result={language:i.language,re:i.relevance,relevance:i.relevance},i.secondBest&&(e.secondBest={language:i.secondBest.language,relevance:i.secondBest.relevance}),ue(`after:highlightElement`,{el:e,result:i,text:r})}function T(e){l=Re(l,e)}let ee=()=>{ne(),Te(`10.6.0`,`initHighlighting() deprecated. Use highlightAll() now.`)};function E(){ne(),Te(`10.6.0`,`initHighlightingOnLoad() deprecated. Use highlightAll() now.`)}let te=!1;function ne(){function e(){ne()}document.readyState===`loading`?(te||window.addEventListener(`DOMContentLoaded`,e,!1),te=!0):document.querySelectorAll(l.cssSelector).forEach(w)}function D(n,r){let i=null;try{i=r(e)}catch(e){if(Ce(`Language definition for '{}' could not be registered.`.replace(`{}`,n)),o)Ce(e);else throw e;i=c}i.name||(i.name=n),t[n]=i,i.rawDefinition=r.bind(null,e),i.aliases&&O(i.aliases,{languageName:n})}function re(e){delete t[e];for(let t of Object.keys(i))i[t]===e&&delete i[t]}function ie(){return Object.keys(t)}function ae(e){return e=(e||``).toLowerCase(),t[e]||t[i[e]]}function O(e,{languageName:t}){typeof e==`string`&&(e=[e]),e.forEach(e=>{i[e.toLowerCase()]=t})}function oe(e){let t=ae(e);return t&&!t.disableAutodetect}function se(e){e[`before:highlightBlock`]&&!e[`before:highlightElement`]&&(e[`before:highlightElement`]=t=>{e[`before:highlightBlock`](Object.assign({block:t.el},t))}),e[`after:highlightBlock`]&&!e[`after:highlightElement`]&&(e[`after:highlightElement`]=t=>{e[`after:highlightBlock`](Object.assign({block:t.el},t))})}function ce(e){se(e),a.push(e)}function le(e){let t=a.indexOf(e);t!==-1&&a.splice(t,1)}function ue(e,t){let n=e;a.forEach(function(e){e[n]&&e[n](t)})}function fe(e){return Te(`10.7.0`,`highlightBlock will be removed entirely in v12.0`),Te(`10.7.0`,`Please use highlightElement now.`),w(e)}Object.assign(e,{highlight:p,highlightAuto:S,highlightAll:ne,highlightElement:w,highlightBlock:fe,configure:T,initHighlighting:ee,initHighlightingOnLoad:E,registerLanguage:D,unregisterLanguage:re,listLanguages:ie,getLanguage:ae,registerAliases:O,autoDetection:oe,inherit:Re,addPlugin:ce,removePlugin:le}),e.debugMode=function(){o=!1},e.safeMode=function(){o=!0},e.versionString=Fe,e.regex={concat:_,lookahead:m,either:y,optional:g,anyNumberOfTimes:h};for(let e in de)typeof de[e]==`object`&&n(de[e]);return Object.assign(e,de),e},He=Ve({});He.newInstance=()=>Ve({}),t.exports=He,He.HighlightJS=He,He.default=He}))()).default;function Rz(e){let t=e.regex,n={},r={begin:/\$\{/,end:/\}/,contains:[`self`,{begin:/:-/,contains:[n]}]};Object.assign(n,{className:`variable`,variants:[{begin:t.concat(/\$[\w\d#@][\w\d_]*/,`(?![\\w\\d])(?![$])`)},r]});let i={className:`subst`,begin:/\$\(/,end:/\)/,contains:[e.BACKSLASH_ESCAPE]},a=e.inherit(e.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:`comment`}}),o={begin:/<<-?\s*(?=\w+)/,starts:{contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:`string`})]}},s={className:`string`,begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,n,i]};i.contains.push(s);let c={match:/\\"/},l={className:`string`,begin:/'/,end:/'/},u={match:/\\'/},d={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:`number`},e.NUMBER_MODE,n]},f=e.SHEBANG({binary:`(${[`fish`,`bash`,`zsh`,`sh`,`csh`,`ksh`,`tcsh`,`dash`,`scsh`].join(`|`)})`,relevance:10}),p={className:`function`,begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[e.inherit(e.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},m=[`if`,`then`,`else`,`elif`,`fi`,`time`,`for`,`while`,`until`,`in`,`do`,`done`,`case`,`esac`,`coproc`,`function`,`select`],h=[`true`,`false`],g={match:/(\/[a-z._-]+)+/},_=[`break`,`cd`,`continue`,`eval`,`exec`,`exit`,`export`,`getopts`,`hash`,`pwd`,`readonly`,`return`,`shift`,`test`,`times`,`trap`,`umask`,`unset`],v=[`alias`,`bind`,`builtin`,`caller`,`command`,`declare`,`echo`,`enable`,`help`,`let`,`local`,`logout`,`mapfile`,`printf`,`read`,`readarray`,`source`,`sudo`,`type`,`typeset`,`ulimit`,`unalias`],y=`autoload.bg.bindkey.bye.cap.chdir.clone.comparguments.compcall.compctl.compdescribe.compfiles.compgroups.compquote.comptags.comptry.compvalues.dirs.disable.disown.echotc.echoti.emulate.fc.fg.float.functions.getcap.getln.history.integer.jobs.kill.limit.log.noglob.popd.print.pushd.pushln.rehash.sched.setcap.setopt.stat.suspend.ttyctl.unfunction.unhash.unlimit.unsetopt.vared.wait.whence.where.which.zcompile.zformat.zftp.zle.zmodload.zparseopts.zprof.zpty.zregexparse.zsocket.zstyle.ztcp`.split(`.`),b=`chcon.chgrp.chown.chmod.cp.dd.df.dir.dircolors.ln.ls.mkdir.mkfifo.mknod.mktemp.mv.realpath.rm.rmdir.shred.sync.touch.truncate.vdir.b2sum.base32.base64.cat.cksum.comm.csplit.cut.expand.fmt.fold.head.join.md5sum.nl.numfmt.od.paste.ptx.pr.sha1sum.sha224sum.sha256sum.sha384sum.sha512sum.shuf.sort.split.sum.tac.tail.tr.tsort.unexpand.uniq.wc.arch.basename.chroot.date.dirname.du.echo.env.expr.factor.groups.hostid.id.link.logname.nice.nohup.nproc.pathchk.pinky.printenv.printf.pwd.readlink.runcon.seq.sleep.stat.stdbuf.stty.tee.test.timeout.tty.uname.unlink.uptime.users.who.whoami.yes`.split(`.`);return{name:`Bash`,aliases:[`sh`,`zsh`],keywords:{$pattern:/\b[a-z][a-z0-9._-]+\b/,keyword:m,literal:h,built_in:[..._,...v,`set`,`shopt`,...y,...b]},contains:[f,e.SHEBANG(),p,d,a,o,g,s,c,l,u,n]}}function zz(e){let t=e.regex;return{name:`Diff`,aliases:[`patch`],contains:[{className:`meta`,relevance:10,match:t.either(/^@@ +-\d+,\d+ +\+\d+,\d+ +@@/,/^@@ +-\d+ +\+\d+,\d+ +@@/,/^@@ +-\d+,\d+ +\+\d+ +@@/,/^@@ +-\d+ +\+\d+ +@@/,/^\*\*\* +\d+,\d+ +\*\*\*\*$/,/^--- +\d+,\d+ +----$/)},{className:`comment`,variants:[{begin:t.either(/Index: /,/^index/,/={3,}/,/^-{3}/,/^\*{3} /,/^\+{3}/,/^diff --git/),end:/$/},{match:/^\*{15}$/}]},{className:`addition`,begin:/^\+/,end:/$/},{className:`deletion`,begin:/^-/,end:/$/},{className:`addition`,begin:/^!/,end:/$/}]}}var Bz=`[A-Za-z$_][0-9A-Za-z$_]*`,Vz=`as.in.of.if.for.while.finally.var.new.function.do.return.void.else.break.catch.instanceof.with.throw.case.default.try.switch.continue.typeof.delete.let.yield.const.class.debugger.async.await.static.import.from.export.extends.using`.split(`.`),Hz=[`true`,`false`,`null`,`undefined`,`NaN`,`Infinity`],Uz=`Object.Function.Boolean.Symbol.Math.Date.Number.BigInt.String.RegExp.Array.Float32Array.Float64Array.Int8Array.Uint8Array.Uint8ClampedArray.Int16Array.Int32Array.Uint16Array.Uint32Array.BigInt64Array.BigUint64Array.Set.Map.WeakSet.WeakMap.ArrayBuffer.SharedArrayBuffer.Atomics.DataView.JSON.Promise.Generator.GeneratorFunction.AsyncFunction.Reflect.Proxy.Intl.WebAssembly`.split(`.`),Wz=[`Error`,`EvalError`,`InternalError`,`RangeError`,`ReferenceError`,`SyntaxError`,`TypeError`,`URIError`],Gz=[`setInterval`,`setTimeout`,`clearInterval`,`clearTimeout`,`require`,`exports`,`eval`,`isFinite`,`isNaN`,`parseFloat`,`parseInt`,`decodeURI`,`decodeURIComponent`,`encodeURI`,`encodeURIComponent`,`escape`,`unescape`],Kz=[`arguments`,`this`,`super`,`console`,`window`,`document`,`localStorage`,`sessionStorage`,`module`,`self`,`global`],qz=[].concat(Gz,Uz,Wz);function Jz(e){let t=e.regex,n=(e,{after:t})=>{let n=`</`+e[0].slice(1);return e.input.indexOf(n,t)!==-1},r=Bz,i={begin:`<>`,end:`</>`},a=/<[A-Za-z0-9\\._:-]+\s*\/>/,o={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(e,t)=>{let r=e[0].length+e.index,i=e.input[r];if(i===`<`||i===`,`){t.ignoreMatch();return}i===`>`&&(n(e,{after:r})||t.ignoreMatch());let a,o=e.input.substring(r);((a=o.match(/^\s*=/))||(a=o.match(/^\s+extends\s+/))&&a.index===0)&&t.ignoreMatch()}},s={$pattern:Bz,keyword:Vz,literal:Hz,built_in:qz,"variable.language":Kz},c=`[0-9](_?[0-9])*`,l=`\\.(${c})`,u=`0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*`,d={className:`number`,variants:[{begin:`(\\b(${u})((${l})|\\.)?|(${l}))[eE][+-]?(${c})\\b`},{begin:`\\b(${u})\\b((${l})\\b|\\.)?|(${l})\\b`},{begin:`\\b(0|[1-9](_?[0-9])*)n\\b`},{begin:`\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b`},{begin:`\\b0[bB][0-1](_?[0-1])*n?\\b`},{begin:`\\b0[oO][0-7](_?[0-7])*n?\\b`},{begin:`\\b0[0-7]+n?\\b`}],relevance:0},f={className:`subst`,begin:`\\$\\{`,end:`\\}`,keywords:s,contains:[]},p={begin:".?html`",end:``,starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,f],subLanguage:`xml`}},m={begin:".?css`",end:``,starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,f],subLanguage:`css`}},h={begin:".?gql`",end:``,starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,f],subLanguage:`graphql`}},g={className:`string`,begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,f]},_={className:`comment`,variants:[e.COMMENT(/\/\*\*(?!\/)/,`\\*/`,{relevance:0,contains:[{begin:`(?=@[A-Za-z]+)`,relevance:0,contains:[{className:`doctag`,begin:`@[A-Za-z]+`},{className:`type`,begin:`\\{`,end:`\\}`,excludeEnd:!0,excludeBegin:!0,relevance:0},{className:`variable`,begin:r+`(?=\\s*(-)|$)`,endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},v=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,h,g,{match:/\$\d+/},d];f.contains=v.concat({begin:/\{/,end:/\}/,keywords:s,contains:[`self`].concat(v)});let y=[].concat(_,f.contains),b=y.concat([{begin:/(\s*)\(/,end:/\)/,keywords:s,contains:[`self`].concat(y)}]),x={className:`params`,begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:s,contains:b},S={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,t.concat(r,`(`,t.concat(/\./,r),`)*`)],scope:{1:`keyword`,3:`title.class`,5:`keyword`,7:`title.class.inherited`}},{match:[/class/,/\s+/,r],scope:{1:`keyword`,3:`title.class`}}]},C={relevance:0,match:t.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:`title.class`,keywords:{_:[...Uz,...Wz]}},w={label:`use_strict`,className:`meta`,relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},T={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:`keyword`,3:`title.function`},label:`func.def`,contains:[x],illegal:/%/},ee={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:`variable.constant`};function E(e){return t.concat(`(?!`,e.join(`|`),`)`)}let te={match:t.concat(/\b/,E([...Gz,`super`,`import`,`await`].map(e=>`${e}\\s*\\(`)),r,t.lookahead(/\s*\(/)),className:`title.function`,relevance:0},ne={begin:t.concat(/\./,t.lookahead(t.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:`prototype`,className:`property`,relevance:0},D={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:`keyword`,3:`title.function`},contains:[{begin:/\(\)/},x]},re=`(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|`+e.UNDERSCORE_IDENT_RE+`)\\s*=>`,ie={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(re)],keywords:`async`,className:{1:`keyword`,3:`title.function`},contains:[x]};return{name:`JavaScript`,aliases:[`js`,`jsx`,`mjs`,`cjs`],keywords:s,exports:{PARAMS_CONTAINS:b,CLASS_REFERENCE:C},illegal:/#(?![$_A-Za-z])/,contains:[e.SHEBANG({label:`shebang`,binary:`node`,relevance:5}),w,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,h,g,_,{match:/\$\d+/},d,C,{scope:`attr`,match:r+t.lookahead(`:`),relevance:0},ie,{begin:`(`+e.RE_STARTERS_RE+`|\\b(case|return|throw)\\b)\\s*`,keywords:`return throw case`,relevance:0,contains:[_,e.REGEXP_MODE,{className:`function`,begin:re,returnBegin:!0,end:`\\s*=>`,contains:[{className:`params`,variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:s,contains:b}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:i.begin,end:i.end},{match:a},{begin:o.begin,"on:begin":o.isTrulyOpeningTag,end:o.end}],subLanguage:`xml`,contains:[{begin:o.begin,end:o.end,skip:!0,contains:[`self`]}]}]},T,{beginKeywords:`while if switch catch for`},{begin:`\\b(?!function)`+e.UNDERSCORE_IDENT_RE+`\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{`,returnBegin:!0,label:`func.def`,contains:[x,e.inherit(e.TITLE_MODE,{begin:r,className:`title.function`})]},{match:/\.\.\./,relevance:0},ne,{match:`\\$`+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:`title.function`},contains:[x]},te,ee,S,D,{match:/\$[(.]/}]}}var Yz={scope:`number`,match:`([-+]?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)|NaN|[-+]?Infinity`,relevance:0};function Xz(e){let t={className:`attr`,begin:/(("(\\.|[^\\"\r\n])*")|('(\\.|[^\\'\r\n])*'))(?=\s*:)/,relevance:1.01},n={match:/[{}[\],:]/,className:`punctuation`,relevance:0},r=[`true`,`false`,`null`],i={scope:`literal`,beginKeywords:r.join(` `)};return{name:`JSON`,aliases:[`jsonc`,`json5`],keywords:{literal:r},contains:[t,n,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,i,Yz,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE],illegal:`\\S`}}function Zz(e){let t=e.regex,n={begin:/<\/?[A-Za-z_]/,end:`>`,subLanguage:`xml`,relevance:0},r={match:/^ {0,3}([-*_])[ \t]*(?:\1[ \t]*){2,}$/},i={className:`code`,variants:[{begin:"(`{3,})[^`](.|\\n)*?\\1`*[ ]*"},{begin:`(~{3,})[^~](.|\\n)*?\\1~*[ ]*`},{begin:"```",end:"```+[ ]*$"},{begin:`~~~`,end:`~~~+[ ]*$`},{begin:"`.+?`"},{begin:`(?=^( {4}|\\t))`,contains:[{begin:`^( {4}|\\t)`,end:`(\\n)$`}],relevance:0}]},a={className:`bullet`,begin:`^[ ]*([*+-]|(\\d+\\.))(?=\\s+)`,end:`\\s+`,excludeEnd:!0},o={begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:`symbol`,begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:`link`,begin:/:\s*/,end:/$/,excludeBegin:!0}]},s={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:t.concat(/\[.+?\]\(/,/[A-Za-z][A-Za-z0-9+.-]*/,/:\/\/.*?\)/),relevance:2},{begin:/\[.+?\]\([./?&#].*?\)/,relevance:1},{begin:/\[.*?\]\(.*?\)/,relevance:0}],returnBegin:!0,contains:[{match:/\[(?=\])/},{className:`string`,relevance:0,begin:`\\[`,end:`\\]`,excludeBegin:!0,returnEnd:!0},{className:`link`,relevance:0,begin:`\\]\\(`,end:`\\)`,excludeBegin:!0,excludeEnd:!0},{className:`symbol`,relevance:0,begin:`\\]\\[`,end:`\\]`,excludeBegin:!0,excludeEnd:!0}]},c={className:`strong`,contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},l={className:`emphasis`,contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},u=e.inherit(c,{contains:[]}),d=e.inherit(l,{contains:[]});c.contains.push(d),l.contains.push(u);let f=[n,s];return[c,l,u,d].forEach(e=>{e.contains=e.contains.concat(f)}),f=f.concat(c,l),{name:`Markdown`,aliases:[`md`,`mkdown`,`mkd`],contains:[{className:`section`,variants:[{begin:`^#{1,6}`,end:`$`,contains:f},{begin:`(?=^.+?\\n[=-]{2,}$)`,contains:[{begin:`^[=-]*$`},{begin:`^`,end:`\\n`,contains:f}]}]},n,a,r,c,l,{className:`quote`,begin:`^>\\s+`,contains:f,end:`$`},i,s,o,{scope:`literal`,match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function Qz(e){let t=e.regex,n=/[\p{XID_Start}_]\p{XID_Continue}*/u,r=`and.as.assert.async.await.break.case.class.continue.def.del.elif.else.except.finally.for.from.global.if.import.in.is.lambda.lazy.match.nonlocal|10.not.or.pass.raise.return.try.while.with.yield`.split(`.`),i={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:r,built_in:`__import__.abs.aiter.all.anext.any.ascii.bin.bool.breakpoint.bytearray.bytes.callable.chr.classmethod.compile.complex.delattr.dict.dir.divmod.enumerate.eval.exec.filter.float.format.frozendict.frozenset.getattr.globals.hasattr.hash.help.hex.id.input.int.isinstance.issubclass.iter.len.list.locals.map.max.memoryview.min.next.object.oct.open.ord.pow.print.property.range.repr.reversed.round.sentinel.set.setattr.slice.sorted.staticmethod.str.sum.super.tuple.type.vars.zip`.split(`.`),literal:[`__debug__`,`Ellipsis`,`False`,`None`,`NotImplemented`,`True`],type:[`Any`,`Callable`,`Coroutine`,`Dict`,`List`,`Literal`,`Generic`,`Optional`,`Sequence`,`Set`,`Tuple`,`Type`,`Union`]},a={className:`meta`,begin:/^(>>>|\.\.\.) /},o={className:`subst`,begin:/\{/,end:/\}/,keywords:i,illegal:/#/},s={begin:/\{\{/,relevance:0},c={className:`string`,contains:[e.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,a],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,a],relevance:10},{begin:/([fFtT][rR]|[rR][fFtT]|[fFtT])'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,a,s,o]},{begin:/([fFtT][rR]|[rR][fFtT]|[fFtT])"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,a,s,o]},{begin:/([uU]|[rR])'/,end:/'/,relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,end:/"/},{begin:/([fFtT][rR]|[rR][fFtT]|[fFtT])'/,end:/'/,contains:[e.BACKSLASH_ESCAPE,s,o]},{begin:/([fFtT][rR]|[rR][fFtT]|[fFtT])"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,s,o]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},l=`[0-9](_?[0-9])*`,u=`(\\b(${l}))?\\.(${l})|\\b(${l})\\.`,d=`\\b|${r.join(`|`)}`,f={className:`number`,relevance:0,variants:[{begin:`(\\b(${l})|(${u}))[eE][+-]?(${l})[jJ]?(?=${d})`},{begin:`(${u})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${d})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${d})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${d})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${d})`},{begin:`\\b(${l})[jJ](?=${d})`}]},p={className:`comment`,begin:t.lookahead(/# type:/),end:/$/,keywords:i,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},m={className:`params`,variants:[{className:``,begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:i,contains:[`self`,a,f,c,e.HASH_COMMENT_MODE]}]};return o.contains=[c,f,a],{name:`Python`,aliases:[`py`,`gyp`,`ipython`],unicodeRegex:!0,keywords:i,illegal:/(<\/|\?)|=>/,contains:[a,f,{scope:`variable.language`,match:/\bself\b/},{beginKeywords:`if`,relevance:0},{match:/\bor\b/,scope:`keyword`},c,p,e.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,n],scope:{1:`keyword`,3:`title.function`},contains:[m]},{variants:[{match:[/\bclass/,/\s+/,n,/\s*/,/\(\s*/,n,/\s*\)/]},{match:[/\bclass/,/\s+/,n]}],scope:{1:`keyword`,3:`title.class`,6:`title.class.inherited`}},{className:`meta`,begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[f,m,c]}]}}var $z=`[A-Za-z$_][0-9A-Za-z$_]*`,eB=`as.in.of.if.for.while.finally.var.new.function.do.return.void.else.break.catch.instanceof.with.throw.case.default.try.switch.continue.typeof.delete.let.yield.const.class.debugger.async.await.static.import.from.export.extends.using`.split(`.`),tB=[`true`,`false`,`null`,`undefined`,`NaN`,`Infinity`],nB=`Object.Function.Boolean.Symbol.Math.Date.Number.BigInt.String.RegExp.Array.Float32Array.Float64Array.Int8Array.Uint8Array.Uint8ClampedArray.Int16Array.Int32Array.Uint16Array.Uint32Array.BigInt64Array.BigUint64Array.Set.Map.WeakSet.WeakMap.ArrayBuffer.SharedArrayBuffer.Atomics.DataView.JSON.Promise.Generator.GeneratorFunction.AsyncFunction.Reflect.Proxy.Intl.WebAssembly`.split(`.`),rB=[`Error`,`EvalError`,`InternalError`,`RangeError`,`ReferenceError`,`SyntaxError`,`TypeError`,`URIError`],iB=[`setInterval`,`setTimeout`,`clearInterval`,`clearTimeout`,`require`,`exports`,`eval`,`isFinite`,`isNaN`,`parseFloat`,`parseInt`,`decodeURI`,`decodeURIComponent`,`encodeURI`,`encodeURIComponent`,`escape`,`unescape`],aB=[`arguments`,`this`,`super`,`console`,`window`,`document`,`localStorage`,`sessionStorage`,`module`,`self`,`global`],oB=[].concat(iB,nB,rB);function sB(e){let t=e.regex,n=(e,{after:t})=>{let n=`</`+e[0].slice(1);return e.input.indexOf(n,t)!==-1},r=$z,i={begin:`<>`,end:`</>`},a=/<[A-Za-z0-9\\._:-]+\s*\/>/,o={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(e,t)=>{let r=e[0].length+e.index,i=e.input[r];if(i===`<`||i===`,`){t.ignoreMatch();return}i===`>`&&(n(e,{after:r})||t.ignoreMatch());let a,o=e.input.substring(r);((a=o.match(/^\s*=/))||(a=o.match(/^\s+extends\s+/))&&a.index===0)&&t.ignoreMatch()}},s={$pattern:$z,keyword:eB,literal:tB,built_in:oB,"variable.language":aB},c=`[0-9](_?[0-9])*`,l=`\\.(${c})`,u=`0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*`,d={className:`number`,variants:[{begin:`(\\b(${u})((${l})|\\.)?|(${l}))[eE][+-]?(${c})\\b`},{begin:`\\b(${u})\\b((${l})\\b|\\.)?|(${l})\\b`},{begin:`\\b(0|[1-9](_?[0-9])*)n\\b`},{begin:`\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b`},{begin:`\\b0[bB][0-1](_?[0-1])*n?\\b`},{begin:`\\b0[oO][0-7](_?[0-7])*n?\\b`},{begin:`\\b0[0-7]+n?\\b`}],relevance:0},f={className:`subst`,begin:`\\$\\{`,end:`\\}`,keywords:s,contains:[]},p={begin:".?html`",end:``,starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,f],subLanguage:`xml`}},m={begin:".?css`",end:``,starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,f],subLanguage:`css`}},h={begin:".?gql`",end:``,starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,f],subLanguage:`graphql`}},g={className:`string`,begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,f]},_={className:`comment`,variants:[e.COMMENT(/\/\*\*(?!\/)/,`\\*/`,{relevance:0,contains:[{begin:`(?=@[A-Za-z]+)`,relevance:0,contains:[{className:`doctag`,begin:`@[A-Za-z]+`},{className:`type`,begin:`\\{`,end:`\\}`,excludeEnd:!0,excludeBegin:!0,relevance:0},{className:`variable`,begin:r+`(?=\\s*(-)|$)`,endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},v=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,h,g,{match:/\$\d+/},d];f.contains=v.concat({begin:/\{/,end:/\}/,keywords:s,contains:[`self`].concat(v)});let y=[].concat(_,f.contains),b=y.concat([{begin:/(\s*)\(/,end:/\)/,keywords:s,contains:[`self`].concat(y)}]),x={className:`params`,begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:s,contains:b},S={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,t.concat(r,`(`,t.concat(/\./,r),`)*`)],scope:{1:`keyword`,3:`title.class`,5:`keyword`,7:`title.class.inherited`}},{match:[/class/,/\s+/,r],scope:{1:`keyword`,3:`title.class`}}]},C={relevance:0,match:t.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:`title.class`,keywords:{_:[...nB,...rB]}},w={label:`use_strict`,className:`meta`,relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},T={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:`keyword`,3:`title.function`},label:`func.def`,contains:[x],illegal:/%/},ee={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:`variable.constant`};function E(e){return t.concat(`(?!`,e.join(`|`),`)`)}let te={match:t.concat(/\b/,E([...iB,`super`,`import`,`await`].map(e=>`${e}\\s*\\(`)),r,t.lookahead(/\s*\(/)),className:`title.function`,relevance:0},ne={begin:t.concat(/\./,t.lookahead(t.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:`prototype`,className:`property`,relevance:0},D={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:`keyword`,3:`title.function`},contains:[{begin:/\(\)/},x]},re=`(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|`+e.UNDERSCORE_IDENT_RE+`)\\s*=>`,ie={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(re)],keywords:`async`,className:{1:`keyword`,3:`title.function`},contains:[x]};return{name:`JavaScript`,aliases:[`js`,`jsx`,`mjs`,`cjs`],keywords:s,exports:{PARAMS_CONTAINS:b,CLASS_REFERENCE:C},illegal:/#(?![$_A-Za-z])/,contains:[e.SHEBANG({label:`shebang`,binary:`node`,relevance:5}),w,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,h,g,_,{match:/\$\d+/},d,C,{scope:`attr`,match:r+t.lookahead(`:`),relevance:0},ie,{begin:`(`+e.RE_STARTERS_RE+`|\\b(case|return|throw)\\b)\\s*`,keywords:`return throw case`,relevance:0,contains:[_,e.REGEXP_MODE,{className:`function`,begin:re,returnBegin:!0,end:`\\s*=>`,contains:[{className:`params`,variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:s,contains:b}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:i.begin,end:i.end},{match:a},{begin:o.begin,"on:begin":o.isTrulyOpeningTag,end:o.end}],subLanguage:`xml`,contains:[{begin:o.begin,end:o.end,skip:!0,contains:[`self`]}]}]},T,{beginKeywords:`while if switch catch for`},{begin:`\\b(?!function)`+e.UNDERSCORE_IDENT_RE+`\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{`,returnBegin:!0,label:`func.def`,contains:[x,e.inherit(e.TITLE_MODE,{begin:r,className:`title.function`})]},{match:/\.\.\./,relevance:0},ne,{match:`\\$`+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:`title.function`},contains:[x]},te,ee,S,D,{match:/\$[(.]/}]}}function cB(e){let t=e.regex,n=sB(e),r=$z,i=[`any`,`void`,`number`,`boolean`,`string`,`object`,`never`,`symbol`,`bigint`,`unknown`],a={begin:[/namespace/,/\s+/,e.IDENT_RE],beginScope:{1:`keyword`,3:`title.class`}},o={beginKeywords:`interface`,end:/\{/,excludeEnd:!0,keywords:{keyword:`interface extends`,built_in:i},contains:[n.exports.CLASS_REFERENCE]},s={className:`meta`,relevance:10,begin:/^\s*['"]use strict['"]/},c={$pattern:$z,keyword:eB.concat([`type`,`interface`,`public`,`private`,`protected`,`implements`,`declare`,`abstract`,`readonly`,`enum`,`override`,`satisfies`]),literal:tB,built_in:oB.concat(i),"variable.language":aB},l={className:`meta`,begin:`@`+r},u=(e,t,n)=>{let r=e.contains.findIndex(e=>e.label===t);if(r===-1)throw Error(`can not find mode to replace`);e.contains.splice(r,1,n)};Object.assign(n.keywords,c),n.exports.PARAMS_CONTAINS.push(l);let d=n.contains.find(e=>e.scope===`attr`),f=Object.assign({},d,{match:t.concat(r,t.lookahead(/\s*\?:/))});n.exports.PARAMS_CONTAINS.push([n.exports.CLASS_REFERENCE,d,f]),n.contains=n.contains.concat([l,a,o,f]),u(n,`shebang`,e.SHEBANG()),u(n,`use_strict`,s);let p=n.contains.find(e=>e.label===`func.def`);return p.relevance=0,Object.assign(n,{name:`TypeScript`,aliases:[`ts`,`tsx`,`mts`,`cts`]}),n}function lB(e){let t=`true false yes no null`,n=`[\\w#;/?:@&=+$,.~*'()[\\]]+`,r={className:`attr`,variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},i={className:`template-variable`,variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},a={className:`string`,relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:`char.escape`,relevance:0}]},o={className:`string`,relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[e.BACKSLASH_ESCAPE,i]},s=e.inherit(o,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),c={className:`number`,begin:`\\b[0-9]{4}(-[0-9][0-9]){0,2}([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?(\\.[0-9]*)?([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?\\b`},l={end:`,`,endsWithParent:!0,excludeEnd:!0,keywords:t,relevance:0},u={begin:/\{/,end:/\}/,contains:[l],illegal:`\\n`,relevance:0},d={begin:`\\[`,end:`\\]`,contains:[l],illegal:`\\n`,relevance:0},f=[r,{className:`meta`,begin:`^---\\s*$`,relevance:10},{className:`string`,begin:`[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*`},{begin:`<%[%=-]?`,end:`[%-]?%>`,subLanguage:`ruby`,excludeBegin:!0,excludeEnd:!0,relevance:0},{className:`type`,begin:`!\\w+!`+n},{className:`type`,begin:`!<`+n+`>`},{className:`type`,begin:`!`+n},{className:`type`,begin:`!!`+n},{className:`meta`,begin:`&`+e.UNDERSCORE_IDENT_RE+`$`},{className:`meta`,begin:`\\*`+e.UNDERSCORE_IDENT_RE+`$`},{className:`bullet`,begin:`-(?=[ ]|$)`,relevance:0},e.HASH_COMMENT_MODE,{beginKeywords:t,keywords:{literal:t}},c,{className:`number`,begin:e.C_NUMBER_RE+`\\b`,relevance:0},u,d,a,o],p=[...f];return p.pop(),p.push(s),l.contains=p,{name:`YAML`,case_insensitive:!0,aliases:[`yml`],contains:f}}Lz.registerLanguage(`bash`,Rz),Lz.registerLanguage(`diff`,zz),Lz.registerLanguage(`javascript`,Jz),Lz.registerLanguage(`json`,Xz),Lz.registerLanguage(`markdown`,Zz),Lz.registerLanguage(`python`,Qz),Lz.registerLanguage(`typescript`,cB),Lz.registerLanguage(`yaml`,lB);var uB={shell:`bash`};function dB(e){if(e===void 0)return!1;let t=uB[e.trim().toLowerCase()]??e.trim().toLowerCase();return t!==``&&Lz.getLanguage(t)!==void 0}function fB(e,t){let n=t===void 0?``:uB[t.trim().toLowerCase()]??t.trim().toLowerCase();if(n!==``&&Lz.getLanguage(n)!==void 0)try{return Lz.highlight(e,{language:n}).value}catch{}return pB(e)}function pB(e){return e.replaceAll(`&`,`&`).replaceAll(`<`,`<`).replaceAll(`>`,`>`).replaceAll(`"`,`"`)}jL.use({renderer:{code({text:e,lang:t}){return`<pre><code class="${dB(t)?`hljs language-${t??``}`:`hljs`}">${fB(e,t)}</code></pre>`}}});function mB({text:e}){let t=(0,f.useMemo)(()=>{let t=jL.parse(e,{async:!1,gfm:!0,breaks:!0});return Iz.sanitize(t,{USE_PROFILES:{html:!0}})},[e]);return(0,M.jsx)(`div`,{className:`md`,dangerouslySetInnerHTML:{__html:t}})}function hB({invocation:e}){let[t,n]=(0,f.useState)(!1);return(0,M.jsxs)(`div`,{className:`overflow-hidden rounded-card border border-sakura-200 bg-surface text-left shadow-soft`,children:[(0,M.jsxs)(`button`,{type:`button`,onClick:()=>n(!t),"aria-expanded":t,className:`focus-neko flex w-full items-center gap-2 px-3 py-2`,children:[(0,M.jsx)(`span`,{className:`text-sakura-500`,children:(0,M.jsx)(GP,{name:`sparkles`,size:14})}),(0,M.jsxs)(`span`,{className:`shrink-0 font-mono text-sm font-semibold text-sakura-800`,children:[`skill:`,e.name]}),(0,M.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-xs text-ink-600`,title:e.location,children:e.location}),(0,M.jsx)(`span`,{"aria-hidden":!0,className:`shrink-0 text-ink-400`,children:t?`▾`:`▸`})]}),t&&(0,M.jsx)(`div`,{className:`border-t border-sakura-100 px-3 py-2`,children:(0,M.jsx)(`pre`,{className:`max-h-48 overflow-auto whitespace-pre-wrap rounded-lg bg-ink-50 p-2 font-mono text-xs text-ink-700`,children:e.body.trim()})})]})}function gB({text:e}){let[t,n]=(0,f.useState)(!1);return e.trim()===``?null:(0,M.jsxs)(`div`,{className:`rounded-xl border border-dashed border-sakura-300 bg-sakura-50/70`,children:[(0,M.jsxs)(`button`,{type:`button`,onClick:()=>{n(!t)},className:`focus-neko flex w-full items-center gap-1.5 px-3 py-1.5 text-left text-xs text-ink-600 italic`,children:[(0,M.jsx)(`span`,{"aria-hidden":!0,children:t?`▾`:`▸`}),`思考过程…`]}),t&&(0,M.jsx)(`div`,{className:`px-3 pb-2 text-sm whitespace-pre-wrap text-ink-600 italic`,children:e})]})}function _B(e,t=`edit`){if(t===`write`)return e.startsWith(`+ `)?{prefix:`+`,lineNum:``,content:e.slice(2)}:null;let n=e.match(/^([+\- ])( *\d+) (.*)$/),r=n?.[1];return r!==`+`&&r!==`-`&&r!==` `?null:{prefix:r,lineNum:n?.[2]??``,content:n?.[3]??``}}function vB(e,t){if(e===`write`){let e=t.trim();return e===``?null:e}if(e===`edit`){let e=(t.match(/^(.*) \(\d+ edits\)$/)?.[1]??``).trim();return e===``?null:e}return null}function yB(e){if(e==null)return;let t=e.split(`/`).pop()??``,n=t.lastIndexOf(`.`);if(n<=0)return;let r=t.slice(n+1).trim().toLowerCase();return dB(r)?r:void 0}function bB(e,t,n=`edit`){let r=e.split(`
|
|
130
|
+
`),i=r.map(e=>_B(e,n)),a=[],o=[],s=[],c=[];for(let e=0;e<i.length;e++){let t=i[e];t==null?(s.push(-1),c.push(-1)):(t.prefix===`-`?s.push(-1):(s.push(a.length),a.push(t.content)),t.prefix===`+`?c.push(-1):(c.push(o.length),o.push(t.content)))}let l=t!==void 0&&dB(t)?t:void 0;if(l!==void 0)try{return{kind:`highlighted`,rows:xB(r,i,s,c,SB(Lz.highlight(a.join(`
|
|
131
|
+
`),{language:l}).value),SB(Lz.highlight(o.join(`
|
|
132
|
+
`),{language:l}).value))}}catch{}return{kind:`plain`,rows:xB(r,i,s,c,a.map(pB),o.map(pB))}}function xB(e,t,n,r,i,a){return t.map((t,o)=>{if(t===null)return{kind:`context`,gutter:``,html:pB(e[o]??``)};let s=`${t.prefix}${t.lineNum}`;if(t.prefix===`-`)return{kind:`removed`,gutter:s,html:a[r[o]??-1]??``};let c=i[n[o]??-1]??``;return t.prefix===`+`?{kind:`added`,gutter:s,html:c}:{kind:`context`,gutter:s,html:c}})}function SB(e){let t=[],n=[],r=/<span class="([^"]*)">|<\/span>|\n/g,i=``,a=0;for(let o of e.matchAll(r)){let r=o.index;i+=e.slice(a,r),a=r+o[0].length,o[0]===`
|
|
133
|
+
`?(t.push(i+n.map(()=>`</span>`).join(``)),i=n.map(e=>`<span class="${e}">`).join(``)):o[1]===void 0?(n.pop(),i+=o[0]):(n.push(o[1]),i+=o[0])}return t.push(i+e.slice(a)),t}var CB={pending:{label:`待执行`,icon:`clock`,spin:!1,className:`border-ink-200 bg-ink-100 text-ink-600`},running:{label:`运行中`,icon:`spinner`,spin:!0,className:`border-tianyi-300 bg-tianyi-100 text-tianyi-900`},doneOk:{label:`完成`,icon:`check`,spin:!1,className:`border-ink-200 bg-ink-50 text-ink-600`},doneError:{label:`失败`,icon:`close`,spin:!1,className:`border-2 border-sakura-500 bg-sakura-100 text-sakura-900 font-semibold`}};function wB(e){let[t,n]=(0,f.useState)(!1),r=e.phase===`done`?e.isError?CB.doneError:CB.doneOk:CB[e.phase],i=e.phase===`done`&&e.durationMs!==void 0&&e.durationMs!==null?` · ${(e.durationMs/1e3).toFixed(1)}s`:``,a=(0,f.useMemo)(()=>{if(!t||e.diff==null)return null;let n=yB(vB(e.name,e.summary));return bB(e.diff,n,e.name===`write`?`write`:`edit`).rows.map(e=>({...e,html:Iz.sanitize(e.html,{USE_PROFILES:{html:!0}})}))},[t,e.diff,e.name,e.summary]),o=e.diffAdded??null,s=e.diffRemoved??null,c=o!==null&&s!==null?o>0&&s>0?`(+${o}/-${s})`:o>0?`(+${o})`:s>0?`(-${s})`:null:null,l=e.detail!==null&&!(e.name===`write`&&e.diff!=null&&!e.diffTruncated),u=l||e.output!=null||e.result!=null||e.note!=null||e.diff!=null;return(0,M.jsxs)(`div`,{className:`overflow-hidden rounded-card border border-tianyi-200 bg-surface shadow-soft`,children:[(0,M.jsxs)(`button`,{type:`button`,"aria-expanded":u?t:void 0,onClick:()=>{u&&n(!t)},className:`focus-neko flex w-full items-center gap-2 px-3 py-2 text-left`,children:[(0,M.jsx)(`span`,{className:`text-tianyi-500`,children:(0,M.jsx)(GP,{name:`bolt`,size:14})}),(0,M.jsx)(`span`,{className:`font-mono text-sm font-semibold text-tianyi-800`,children:e.name}),(0,M.jsxs)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-xs text-ink-600`,children:[e.summary,c!==null&&(0,M.jsxs)(`span`,{className:`text-ink-400`,children:[` `,c]})]}),(0,M.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 rounded-full border px-2 py-0.5 text-xs font-medium ${r.className}`,children:[(0,M.jsx)(GP,{name:r.icon,size:12,className:r.spin?`animate-spin`:void 0}),r.label,i]}),u&&(0,M.jsx)(`span`,{"aria-hidden":!0,className:`shrink-0 text-ink-400`,children:t?`▾`:`▸`})]}),t&&(0,M.jsxs)(`div`,{className:`space-y-2 border-t border-tianyi-100 px-3 py-2`,children:[a!==null&&(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`div`,{className:`mb-1 text-xs font-medium text-tianyi-700`,children:`代码变更`}),e.diffTruncated&&(0,M.jsx)(`div`,{className:`mb-1 text-xs text-ink-600`,children:`代码变更预览已截断,可在下方查看完整写入内容。`}),(0,M.jsx)(`div`,{className:`max-h-48 overflow-auto rounded-lg bg-ink-50 p-2 font-mono text-xs text-ink-700`,children:a.map((e,t)=>(0,M.jsxs)(`div`,{className:`whitespace-pre ${e.kind===`added`?`diff-line-add`:e.kind===`removed`?`diff-line-del`:``}`,children:[(0,M.jsx)(`span`,{className:`diff-gutter`,children:e.gutter}),(0,M.jsx)(`span`,{dangerouslySetInnerHTML:{__html:e.html}})]},t))})]}),l&&(0,M.jsxs)(`div`,{children:[e.name===`write`&&e.diffTruncated&&(0,M.jsx)(`div`,{className:`mb-1 text-xs font-medium text-tianyi-700`,children:`完整写入内容`}),(0,M.jsx)(`pre`,{className:`max-h-48 overflow-auto rounded-lg bg-ink-50 p-2 font-mono text-xs text-ink-700`,children:e.detail})]}),e.output!=null&&e.output!==``&&(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`div`,{className:`mb-1 text-xs font-medium text-tianyi-700`,children:`输出`}),(0,M.jsx)(`pre`,{className:`max-h-48 overflow-auto rounded-lg bg-tianyi-50 p-2 font-mono text-xs text-ink-700`,children:e.output})]}),e.result!=null&&e.result!==``&&(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`div`,{className:`mb-1 text-xs font-medium ${e.isError?`text-sakura-800`:`text-ink-600`}`,children:e.isError?`错误输出`:`结果`}),(0,M.jsx)(`pre`,{className:`max-h-48 overflow-auto rounded-lg p-2 font-mono text-xs ${e.isError?`bg-sakura-50 text-sakura-900`:`bg-ink-50 text-ink-700`}`,children:e.result})]}),e.note!=null&&(0,M.jsx)(`div`,{className:`text-xs italic text-ink-500`,children:e.note})]})]})}var TB=48;function EB(){let e=`var(--color-sakura-200)`,t=`var(--color-sakura-300)`,n=`var(--color-tianyi-800)`;return(0,M.jsxs)(`svg`,{width:`132`,height:`112`,viewBox:`0 0 132 112`,fill:`none`,"aria-hidden":`true`,children:[(0,M.jsx)(`title`,{children:`neko 小猫`}),(0,M.jsx)(`path`,{d:`M30 46 L24 14 L54 30 Z`,fill:e,stroke:t,strokeWidth:`2.5`,strokeLinejoin:`round`}),(0,M.jsx)(`path`,{d:`M102 46 L108 14 L78 30 Z`,fill:e,stroke:t,strokeWidth:`2.5`,strokeLinejoin:`round`}),(0,M.jsx)(`path`,{d:`M32 39 L29 23 L46 32 Z`,fill:t,opacity:`0.55`}),(0,M.jsx)(`path`,{d:`M100 39 L103 23 L86 32 Z`,fill:t,opacity:`0.55`}),(0,M.jsx)(`ellipse`,{cx:`66`,cy:`66`,rx:`44`,ry:`38`,fill:`var(--color-surface)`,stroke:e,strokeWidth:`2.5`}),(0,M.jsx)(`circle`,{cx:`50`,cy:`62`,r:`5`,fill:n}),(0,M.jsx)(`circle`,{cx:`82`,cy:`62`,r:`5`,fill:n}),(0,M.jsx)(`circle`,{cx:`51.8`,cy:`60`,r:`1.6`,fill:`var(--color-surface)`}),(0,M.jsx)(`circle`,{cx:`83.8`,cy:`60`,r:`1.6`,fill:`var(--color-surface)`}),(0,M.jsx)(`ellipse`,{cx:`40`,cy:`74`,rx:`6.5`,ry:`3.6`,fill:t,opacity:`0.65`}),(0,M.jsx)(`ellipse`,{cx:`92`,cy:`74`,rx:`6.5`,ry:`3.6`,fill:t,opacity:`0.65`}),(0,M.jsx)(`path`,{d:`M62 71 q4 4.5 4 1 q0 -3.5 4 -1`,stroke:`var(--color-sakura-800)`,strokeWidth:`2`,fill:`none`,strokeLinecap:`round`}),(0,M.jsx)(`path`,{d:`M18 64 L32 66 M19 72 L32 70`,stroke:e,strokeWidth:`2`,strokeLinecap:`round`}),(0,M.jsx)(`path`,{d:`M114 64 L100 66 M113 72 L100 70`,stroke:e,strokeWidth:`2`,strokeLinecap:`round`})]})}function DB({text:e,images:t,skill:n,defaultImagePrompt:r,copy:i}){return n===void 0?(0,M.jsxs)(`div`,{className:`chat-row anim-user flex flex-col items-end`,children:[(0,M.jsxs)(`div`,{className:`bubble-user chat-bubble px-4 py-2.5 whitespace-pre-wrap${r?` [&>div]:mt-0`:``}`,children:[e,r&&(0,M.jsxs)(`details`,{className:`min-w-0 text-sm`,children:[(0,M.jsx)(`summary`,{className:`cursor-pointer min-h-8 py-1 text-ink-500 focus-visible:outline-2 focus-visible:outline-sakura-500`,children:`默认图片提示`}),(0,M.jsx)(`p`,{className:`pt-2 whitespace-pre-wrap break-words`,children:r.text})]}),t&&(0,M.jsx)(oR,{images:t})]}),(0,M.jsx)(rR,{text:i})]}):(0,M.jsxs)(`div`,{className:`chat-row anim-user flex flex-col items-end`,children:[(0,M.jsxs)(`div`,{className:`chat-bubble flex min-w-0 flex-col items-stretch gap-1.5`,children:[(0,M.jsx)(hB,{invocation:n}),n.args!==``&&(0,M.jsx)(`div`,{className:`bubble-user px-4 py-2.5 whitespace-pre-wrap`,children:n.args})]}),(0,M.jsx)(rR,{text:i})]})}function OB({thinking:e,text:t}){return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(gB,{text:e}),t.trim()!==``&&(0,M.jsx)(mB,{text:t})]})}function kB({item:e}){return e.text.trim()===``&&e.thinking.trim()===``&&e.note===null?null:(0,M.jsxs)(`div`,{className:`chat-row anim-other flex flex-col items-start`,children:[(0,M.jsxs)(`div`,{className:`bubble-assistant space-y-1.5 px-4 py-2.5`,children:[(0,M.jsx)(OB,{thinking:e.thinking,text:e.text}),e.note!==null&&(0,M.jsxs)(`div`,{className:`text-xs text-sakura-800 italic`,children:[`⚠ `,e.note]})]}),(0,M.jsx)(rR,{text:KL(e),label:`复制回答`})]})}function AB({text:e}){return(0,M.jsx)(`div`,{className:`chat-row anim-other flex justify-center`,children:(0,M.jsx)(`span`,{className:`rounded-full bg-ink-100 px-3 py-1 text-xs text-ink-600`,children:e})})}function jB({item:e}){return(0,M.jsxs)(`div`,{className:`chat-row anim-other`,children:[(0,M.jsx)(wB,{name:e.name,summary:e.summary,detail:e.detail,phase:e.phase,isError:e.isError,output:e.output,result:e.result,durationMs:e.durationMs,note:e.note,diff:e.diff,diffAdded:e.diffAdded,diffRemoved:e.diffRemoved,diffTruncated:e.diffTruncated}),e.images&&(0,M.jsx)(oR,{images:e.images})]})}function MB({streaming:e,busy:t}){let n=e.text.trim()!==``||e.thinking.trim()!==``;return(0,M.jsxs)(M.Fragment,{children:[n&&(0,M.jsx)(`div`,{className:`chat-row stream-block flex justify-start`,children:(0,M.jsxs)(`div`,{className:`bubble-assistant space-y-1.5 px-4 py-2.5`,children:[(0,M.jsx)(OB,{thinking:e.thinking,text:e.text}),t&&(0,M.jsx)(`span`,{className:`stream-caret`,"aria-hidden":!0})]})}),e.toolCalls.map(e=>(0,M.jsx)(`div`,{className:`chat-row anim-other`,children:(0,M.jsx)(wB,{name:e.name,summary:e.summary,detail:e.detail,phase:e.phase,output:e.output,diff:e.diff,diffAdded:e.diffAdded,diffRemoved:e.diffRemoved,diffTruncated:e.diffTruncated})},`st${e.callId}`))]})}function NB({view:e,busy:t,onSubagent:n,emptyLabel:r,onLoadEarlier:i,tray:a,focusEntry:o}){let s=(0,f.useRef)(null),c=(0,f.useRef)(``),l=(0,f.useRef)(!0),u=(0,f.useRef)(!1),[d,p]=(0,f.useState)(!1),m=e?.items??[],h=e?.streaming??null,g=e=>{let t=s.current;t!==null&&t.scrollTo({top:t.scrollHeight,behavior:e?`smooth`:`auto`})};return(0,f.useEffect)(()=>{if(!l.current)return;let e=s.current;e!==null&&e.scrollTo({top:e.scrollHeight})}),(0,f.useEffect)(()=>{if(!o||!m.some(e=>e.type===`user`&&e.id===o.id))return;let e=`${o.id}:${o.nonce}`;if(c.current===e)return;let t=s.current,n=t?.querySelector(`[data-entry-id="${o.id}"]`);t&&n&&(c.current=e,l.current=!1,t.scrollTop+=n.getBoundingClientRect().top-t.getBoundingClientRect().top,p(!0))},[o,m]),(0,M.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,M.jsx)(`div`,{ref:s,onScroll:()=>{let e=s.current;if(e===null)return;let t=e.scrollHeight-e.scrollTop-e.clientHeight<TB;if(l.current=t,p(!t),e.scrollTop<=24&&i&&!u.current){u.current=!0,l.current=!1;let t=e.scrollTop,n=e.scrollHeight;i().finally(()=>{requestAnimationFrame(()=>{s.current===e&&(e.scrollTop=t+e.scrollHeight-n),u.current=!1})})}},className:`min-h-0 flex-1 overflow-y-auto`,children:(0,M.jsxs)(`div`,{className:`chat-column flex flex-col gap-3 px-4 py-5`,children:[m.length===0&&h===null&&(r?(0,M.jsx)(`p`,{className:`p-4 text-sm text-ink-500`,children:r}):(0,M.jsxs)(`div`,{className:`mt-[14vh] flex flex-col items-center gap-4 text-center`,children:[(0,M.jsx)(`div`,{className:`welcome-cat`,children:(0,M.jsx)(EB,{})}),(0,M.jsxs)(`div`,{className:`text-4xl font-extrabold tracking-tight`,children:[(0,M.jsx)(`span`,{className:`logo-gradient`,children:`neko`}),(0,M.jsx)(`span`,{className:`text-tianyi-600`,children:`.`}),(0,M.jsx)(`span`,{className:`logo-gradient`,children:`harness`})]}),(0,M.jsx)(`p`,{className:`max-w-sm text-sm text-ink-600`,children:`输入消息开始吧 ✦`})]})),m.map(t=>{switch(t.type){case`user`:{let n=e?.rounds?.find(e=>e.inputEntryId===t.id||e.taskId===t.subagentRoundId);return(0,M.jsxs)(`div`,{"data-entry-id":t.id,children:[n&&(0,M.jsxs)(`details`,{className:`chat-row border-t border-sakura-200 pt-2 text-xs text-ink-500`,children:[(0,M.jsxs)(`summary`,{className:`cursor-pointer`,children:[`任务 `,n.round??``,` · `,n.title,` ·`,` `,{queued:`排队中`,running:`运行中`,completed:`已完成`,failed:`失败`,cancelled:`已停止`}[n.status]]}),(0,M.jsx)(`p`,{className:`pt-1`,children:n.roundUsage?`本轮 ↑${n.roundUsage.input} ↓${n.roundUsage.output} · 缓存 ${n.roundUsage.cacheRead}/${n.roundUsage.cacheWrite} · $${n.roundUsage.cost.toFixed(4)}`:`本轮用量未记录`})]}),(0,M.jsx)(DB,{text:t.text,copy:KL(t),images:t.images,skill:t.skill,defaultImagePrompt:t.defaultImagePrompt})]},t.key)}case`assistant`:return(0,M.jsx)(kB,{item:t},t.key);case`tool`:{let r=e?.subagents?.find(e=>e.callId===t.callId);return r&&n?(0,M.jsxs)(`button`,{type:`button`,onClick:()=>n(r.taskId),className:`focus-neko rounded-2xl border border-sakura-200 bg-surface p-4 text-left`,children:[(0,M.jsx)(`span`,{className:`text-tianyi-700`,children:r.role}),` · `,r.title,(0,M.jsxs)(`span`,{className:`block text-xs text-ink-500`,children:[r.status===`completed`?`已完成`:r.status===`cancelled`?`已停止`:r.status===`failed`?`失败`:r.status===`queued`?`排队中`:`运行中`,` `,r.approvalCount?`· 待审批 ${r.approvalCount}`:`· 查看完整过程`]})]},t.key):(0,M.jsxs)(`div`,{children:[(0,M.jsx)(jB,{item:t}),e?.approvals?.filter(e=>e.callId===t.callId&&e.status!==`pending`).map(e=>(0,M.jsxs)(`p`,{className:`chat-row text-xs text-ink-500`,children:[`审批 ·`,` `,{allowed:`已允许本次`,denied:`已拒绝`,cancelled:`已取消`}[e.status]]},e.id))]},t.key)}case`system`:return t.jobId===void 0?(0,M.jsx)(AB,{text:t.text},t.key):(0,M.jsx)(sR,{text:t.text,jobId:t.jobId,job:e?.jobs?.find(e=>e.jobId===t.jobId)},t.key);default:return null}}),h!==null&&(0,M.jsx)(MB,{streaming:h,busy:t})]})}),(d||a)&&(0,M.jsxs)(`div`,{className:`discrete-in flex shrink-0 items-center justify-center gap-2 border-t border-sakura-100 bg-base/70 py-1.5`,children:[a,d&&(0,M.jsx)(`button`,{type:`button`,onClick:()=>{l.current=!0,p(!1),g(!0)},className:`focus-neko rounded-full border border-sakura-300 bg-surface px-3.5 py-1 text-xs font-medium text-sakura-800 hover:bg-sakura-50`,children:`回到底部 ↓`})]})]})}var PB=Date.now(),FB=new Set,IB,LB=()=>{PB=Date.now();for(let e of FB)e()},RB=e=>(FB.add(e),FB.size===1&&(LB(),IB=setInterval(LB,6e4),window.addEventListener(`focus`,LB)),()=>{FB.delete(e),FB.size||(clearInterval(IB),window.removeEventListener(`focus`,LB))}),zB=()=>(0,f.useSyncExternalStore)(RB,()=>PB);function BB(e){let t=/^([A-Za-z]:)[\\/]/.exec(e)?.[1];if(t!==void 0){let n=`${t}\\`,r=e.slice(n.length).split(/[\\/]+/).filter(Boolean);return{root:`/`,rootLabel:`此电脑`,crumbs:[{label:t,path:n},...r.map((e,t)=>({label:e,path:n+r.slice(0,t+1).join(`\\`)}))]}}let n=e.split(`/`).filter(Boolean);return{root:`/`,rootLabel:`/`,crumbs:n.map((e,t)=>({label:e,path:`/${n.slice(0,t+1).join(`/`)}`}))}}function VB({initialPath:e,onClose:t}){let[n,r]=(0,f.useState)(e),[i,a]=(0,f.useState)(e),[o,s]=(0,f.useState)(``),[c,l]=(0,f.useState)(!1),[u,d]=(0,f.useState)(null),[p,m]=(0,f.useState)(!0),[h,g]=(0,f.useState)(!1),[_,v]=(0,f.useState)(``),[y,b]=(0,f.useState)(0),x=(0,f.useRef)(0),S=(0,f.useRef)(null),C=(0,f.useRef)(!1);(0,f.useEffect)(()=>{let e=++x.current;return m(!0),v(``),d(null),dj.browse({path:n,query:o,showHidden:c}).then(t=>{e===x.current&&(d(t),a(e=>e===n?t.path:e),m(!1))},t=>{e===x.current&&(v(String(t)),m(!1))}),()=>{++x.current}},[n,o,c,y]);let w=e=>{S.current?.focus(),r(e),a(e),s(``),b(e=>e+1)},T=async()=>{if(!u?.next||p)return;let e=++x.current;m(!0),v(``);try{let t=await dj.browse({path:n,query:o,showHidden:c,cursor:u.next});e===x.current&&d({...t,entries:[...u.entries,...t.entries]})}catch(t){e===x.current&&v(String(t))}finally{e===x.current&&m(!1)}},ee=async()=>{if(!(!u||p||C.current)){C.current=!0,g(!0),v(``);try{await dj.addWorkspace(u.path),t()}catch(e){v(String(e))}finally{C.current=!1,g(!1)}}},{root:E,rootLabel:te,crumbs:ne}=BB(u?.path??n);return(0,M.jsxs)(YP,{title:`添加工作区`,onClose:t,locked:h,children:[(0,M.jsxs)(`div`,{className:`picker-controls`,children:[(0,M.jsx)(`p`,{className:`text-ink-500`,children:`选择 Harness 所在电脑上的文件夹`}),(0,M.jsxs)(`nav`,{className:`breadcrumbs`,"aria-label":`目录路径`,children:[(0,M.jsx)(`button`,{type:`button`,disabled:h,onClick:()=>w(E),children:te}),ne.map(e=>(0,M.jsxs)(`button`,{type:`button`,disabled:h,onClick:()=>w(e.path),children:[e.label,` /`]},e.path))]}),(0,M.jsxs)(`form`,{className:`path-form`,onSubmit:e=>{e.preventDefault(),w(i)},children:[(0,M.jsx)(`input`,{ref:S,"aria-label":`完整目录路径`,value:i,disabled:h,onChange:e=>a(e.target.value)}),(0,M.jsx)(`button`,{className:`btn-outline`,type:`submit`,disabled:h,children:`前往`})]}),(0,M.jsxs)(`div`,{className:`filter-row`,children:[(0,M.jsx)(`input`,{"aria-label":`筛选文件夹`,placeholder:`筛选文件夹…`,value:o,disabled:h,onChange:e=>s(e.target.value)}),(0,M.jsxs)(`label`,{children:[(0,M.jsx)(`input`,{type:`checkbox`,checked:c,disabled:h,onChange:e=>l(e.target.checked)}),`隐藏目录`]})]})]}),(0,M.jsxs)(`fieldset`,{className:`folder-list`,"aria-label":`文件夹列表`,"aria-busy":p,onKeyDown:e=>{if(e.key!==`ArrowDown`&&e.key!==`ArrowUp`)return;e.preventDefault();let t=[...e.currentTarget.querySelectorAll(`button:not(:disabled)`)];t[(t.indexOf(document.activeElement)+(e.key===`ArrowDown`?1:-1)+t.length)%t.length]?.focus()},children:[_&&(0,M.jsxs)(`div`,{role:`alert`,className:`error-text`,children:[_,(0,M.jsx)(`button`,{type:`button`,className:`btn-outline`,disabled:h,onClick:()=>b(e=>e+1),children:`重试`})]}),u?.parent&&(0,M.jsxs)(`button`,{type:`button`,className:`chrome-row`,disabled:h||p,onClick:()=>w(u.parent),children:[(0,M.jsx)(GP,{name:`up`}),`上级目录`]}),u?.entries.map(e=>(0,M.jsxs)(`button`,{type:`button`,className:`chrome-row`,disabled:h||p||!!e.error,title:e.error??e.path,onClick:()=>w(e.path),children:[(0,M.jsx)(GP,{name:`folder`}),(0,M.jsx)(`span`,{className:`truncate min-w-0`,children:e.name}),e.error&&(0,M.jsx)(`span`,{className:`text-ink-500`,children:`不可访问`})]},e.path)),p&&(0,M.jsx)(`output`,{className:`empty-text`,children:`正在读取目录…`}),!p&&u?.entries.length===0&&(0,M.jsx)(`p`,{className:`empty-text`,children:`没有匹配的子文件夹,可选择当前目录`}),u?.next&&(0,M.jsx)(`button`,{type:`button`,className:`btn-outline`,disabled:p||h,onClick:()=>void T(),children:`加载更多`})]}),(0,M.jsxs)(`div`,{className:`picker-footer`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`strong`,{children:ZP(u?.path??n)}),(0,M.jsx)(`p`,{className:`path-text`,children:u?.path??n})]}),(0,M.jsxs)(`div`,{className:`actions`,children:[(0,M.jsx)(`button`,{type:`button`,className:`btn-outline`,disabled:h,onClick:t,children:`取消`}),(0,M.jsx)(`button`,{type:`button`,className:`btn-primary px-3 py-1.5`,disabled:!u||p||h||!!_,onClick:()=>void ee(),children:h?`正在添加…`:`选择文件夹`})]})]})]})}function HB({open:e,onClose:t}){let n=$A(),r=zB(),i=KP(),[a,o]=(0,f.useState)(null),s=n.sessions.find(e=>e.id===a?.id),[c,l]=(0,f.useState)(!1),[u,d]=(0,f.useState)(null),[p,m]=(0,f.useState)(``),[h,g]=(0,f.useState)(``),_=n.phase!==`ready`||n.operating,v=qA(n.sessions,n.workspaceRoot).filter(e=>ji(e,h)),y=e=>{e.then(()=>{i&&t()}).catch(pj)};if(!e)return null;let b=(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(`div`,{className:`sidebar-top`,children:[(0,M.jsxs)(`div`,{className:`workspace-heading`,children:[(0,M.jsxs)(`button`,{type:`button`,className:`workspace-trigger`,"aria-label":`切换工作区`,"aria-expanded":a!==null&&!a.id,disabled:_,onClick:e=>o({anchor:e.currentTarget}),children:[(0,M.jsx)(`span`,{className:`workspace-mark`,children:(0,M.jsx)(GP,{name:`folder`})}),(0,M.jsx)(`span`,{className:`truncate min-w-0`,children:ZP(n.workspaceRoot)||`工作区`}),(0,M.jsx)(GP,{name:`chevron`})]}),!i&&(0,M.jsx)(`button`,{type:`button`,className:`icon-btn`,"aria-label":`收起侧栏`,title:`收起侧栏`,onClick:t,children:(0,M.jsx)(GP,{name:`panel`})})]}),(0,M.jsxs)(`button`,{type:`button`,className:`chrome-row font-medium`,disabled:_,onClick:()=>y(dj.createSession()),children:[(0,M.jsx)(GP,{name:`plus`}),`新建会话`]}),(0,M.jsxs)(`div`,{className:`search-box`,children:[(0,M.jsx)(GP,{name:`search`}),(0,M.jsx)(`input`,{"aria-label":`搜索当前工作区会话`,placeholder:`搜索会话…`,value:h,onChange:e=>g(e.target.value)})]})]}),(0,M.jsxs)(`div`,{className:`section-label`,children:[`会话 `,(0,M.jsx)(`span`,{children:v.length})]}),(0,M.jsxs)(`div`,{className:`session-scroll`,children:[(0,M.jsx)(`ul`,{className:`session-list`,children:v.map(e=>(0,M.jsxs)(`li`,{className:`session-row ${e.id===n.currentSessionId?`is-active`:``}`,children:[(0,M.jsxs)(`button`,{type:`button`,className:`chrome-row session-select`,disabled:_,"aria-current":e.id===n.currentSessionId?`page`:void 0,"aria-describedby":`session-tip-${e.id}`,onClick:()=>y(dj.selectSession(e.id)),children:[(0,M.jsx)(GP,{name:`chat`}),(0,M.jsxs)(`span`,{className:`session-copy`,children:[(0,M.jsx)(`span`,{className:`truncate min-w-0`,children:Di(e,`新会话`)}),(0,M.jsxs)(`span`,{className:`session-meta`,children:[(0,M.jsx)(`time`,{dateTime:new Date(Oi(e)).toISOString(),children:Mi(Oi(e),r,`zh`)}),e.status===`running`?` · 运行中`:e.status===`error`?` · 出错`:``]}),(0,M.jsxs)(`span`,{className:`session-tooltip`,role:`tooltip`,id:`session-tip-${e.id}`,children:[Di(e,`新会话`),(0,M.jsx)(`br`,{}),new Date(Oi(e)).toLocaleString(`zh-CN`)]})]})]}),(0,M.jsx)(`button`,{type:`button`,className:`icon-btn row-more`,disabled:_,"aria-label":`${Di(e,`新会话`)}的操作`,title:`会话操作`,onClick:t=>o({anchor:t.currentTarget,id:e.id}),children:(0,M.jsx)(GP,{name:`more`})})]},e.id))}),v.length===0&&(0,M.jsx)(`div`,{className:`empty-text`,children:n.phase===`ready`?h?`没有匹配的会话`:`此工作区暂无会话`:`等待网关连接…`})]}),(0,M.jsxs)(`div`,{className:`sidebar-bottom`,children:[(0,M.jsx)(`span`,{className:`path-text`,title:n.workspaceRoot,children:n.workspaceRoot}),(0,M.jsxs)(Br,{to:`/skills`,className:`chrome-row`,onClick:()=>{i&&t()},children:[(0,M.jsx)(GP,{name:`store`}),`技能市场`]}),(0,M.jsxs)(Br,{to:`/settings`,className:`chrome-row`,onClick:()=>{i&&t()},children:[(0,M.jsx)(GP,{name:`settings`}),`设置`]})]})]});return(0,M.jsxs)(M.Fragment,{children:[i?(0,M.jsx)(YP,{title:`工作区与会话`,drawer:!0,onClose:t,children:b}):(0,M.jsx)(`aside`,{className:`chrome sidebar`,"aria-label":`工作区与会话`,children:b}),a&&(0,M.jsx)(XP,{anchor:a.anchor,label:a.id?`会话操作`:`选择工作区`,onClose:()=>o(null),children:a.id?(0,M.jsxs)(M.Fragment,{children:[s&&(0,M.jsxs)(`div`,{className:`session-details`,children:[(0,M.jsx)(`strong`,{children:Di(s,`新会话`)}),(0,M.jsx)(`small`,{children:new Date(Oi(s)).toLocaleString(`zh-CN`)})]}),(0,M.jsxs)(`button`,{type:`button`,className:`chrome-row`,onClick:()=>{d(a.id),m(``),o(null)},children:[(0,M.jsx)(GP,{name:`archive`}),`归档会话`]})]}):(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`div`,{className:`section-label`,children:`工作区`}),(0,M.jsx)(`div`,{className:`workspace-options`,children:n.workspaces.map(e=>(0,M.jsxs)(`button`,{type:`button`,className:`workspace-option ${e.path===n.workspaceRoot?`is-active`:``}`,title:e.path,onClick:()=>{o(null),g(``),y(dj.selectWorkspace(e.path))},children:[(0,M.jsx)(GP,{name:`folder`}),(0,M.jsxs)(`span`,{children:[(0,M.jsx)(`strong`,{children:ZP(e.path)}),(0,M.jsx)(`small`,{children:e.path})]}),e.path===n.workspaceRoot&&(0,M.jsx)(`span`,{role:`img`,"aria-label":`当前工作区`,children:`✓`})]},e.path))}),(0,M.jsxs)(`button`,{type:`button`,className:`chrome-row add-workspace`,onClick:()=>{o(null),l(!0)},children:[(0,M.jsx)(GP,{name:`plus`}),`添加工作区`]})]})}),c&&(0,M.jsx)(VB,{initialPath:n.workspaceRoot,onClose:()=>l(!1)}),u&&(0,M.jsx)(YP,{title:`归档会话`,locked:n.operating,onClose:()=>d(null),children:(0,M.jsxs)(`div`,{className:`confirm-body`,children:[(0,M.jsxs)(`p`,{children:[`归档“`,Di(n.sessions.find(e=>e.id===u)??{title:``,firstPromptPreview:``},`新会话`),`”?会话将从列表中隐藏,工作区和文件仍会保留。`]}),p&&(0,M.jsx)(`p`,{role:`alert`,className:`error-text`,children:p}),(0,M.jsxs)(`div`,{className:`actions`,children:[(0,M.jsx)(`button`,{type:`button`,className:`btn-outline`,disabled:n.operating,onClick:()=>d(null),children:`取消`}),(0,M.jsx)(`button`,{type:`button`,className:`btn-primary`,disabled:n.operating,onClick:()=>{dj.archiveSession(u).then(()=>d(null)).catch(e=>m(String(e)))},children:`确认归档`})]})]})})]})}function UB(e,t){let n=new Map(e.map(e=>[e.key,e]));for(let e of t){let t=n.get(e.key);(t?.type!==`tool`||e.type!==`tool`||t.phase!==`done`||e.phase===`done`)&&n.set(e.key,e)}return[...n.values()].sort((e,t)=>(e.order??0)-(t.order??0))}var WB={idle:`空闲`,queued:`排队中`,running:`运行中`,completed:`已完成`,failed:`失败`,cancelled:`已停止`};function GB({entry:e,active:t,target:n}){let{phase:r,operating:i,view:a}=$A(),[o,s]=(0,f.useState)(null),[c,l]=(0,f.useState)(``),[u,d]=(0,f.useState)([]),[p,m]=(0,f.useState)(),[h,g]=(0,f.useState)(!1),[,_]=(0,f.useState)(Date.now);(0,f.useEffect)(()=>{if(!t||e.activeRoundId===null)return;let n=setInterval(()=>_(Date.now()),1e3);return()=>clearInterval(n)},[t,e.activeRoundId]);let v=r===`ready`&&!i&&a!==null,y=(0,f.useMemo)(()=>v&&t?dj.subagent(e.agentId):null,[v,t,e.agentId]),b=(0,f.useRef)(0);(0,f.useEffect)(()=>{let e=++b.current;if(g(!1),m(void 0),!y)return;let t=y.view.subscribe(t=>{e===b.current&&y.error&&l(y.error),e===b.current&&t&&(s(e=>(e?.items.length&&!t.items.some(t=>e.items.some(e=>e.key===t.key))&&m(t.historyBefore),{...t,items:UB(e?.items??[],t.items)})),m(e=>e===void 0?t.historyBefore:e),y.error||l(``))});return()=>{b.current++,t()}},[y]);let x=(0,f.useMemo)(()=>y?(e,t)=>Ti(n=>y.getImage({entryId:e,contentIndex:t,offset:n})):null,[y]),S=(0,f.useMemo)(()=>o?{...o,items:UB(u,o.items)}:null,[o,u]),C=(0,f.useCallback)(async()=>{if(!y||h||p==null)return;let e=b.current;g(!0);try{let t=await y.history(p==null?{}:{before:p});if(e!==b.current)return;d(e=>UB(e,t.items)),m(t.next)}catch(t){e===b.current&&l(String(t))}finally{e===b.current&&g(!1)}},[y,h,p]),w=n?o?.rounds?.find(e=>e.taskId===n.taskId)?.inputEntryId:void 0,T=o?.rounds?.find(t=>t.taskId===(e.activeRoundId??e.lastRoundId));return(0,f.useEffect)(()=>{t&&w!==void 0&&S&&!S.items.some(e=>e.type===`user`&&e.id===w)&&p!=null&&!h&&C()},[t,w,S,p,h,C]),(0,M.jsxs)(`div`,{className:`${t?`flex`:`hidden`} min-h-0 flex-1 flex-col`,children:[(0,M.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 border-b border-sakura-100 p-3 text-xs`,children:[(0,M.jsxs)(`span`,{children:[e.historyThrough===void 0?``:`历史 · `,WB[e.status]]}),o&&(0,M.jsxs)(`span`,{title:`子智能体累计用量`,children:[`↑`,o.usage.input,` ↓`,o.usage.output,` · $`,o.usage.cost.toFixed(4)]}),T&&(0,M.jsxs)(`span`,{title:`当前或最近任务耗时`,children:[Math.max(0,Math.round(((T.endedAt??Date.now())-T.createdAt)/1e3)),`s`]}),e.historyThrough===void 0&&(e.status===`running`||e.status===`queued`)&&(0,M.jsx)(`button`,{type:`button`,className:`focus-neko rounded-lg border border-sakura-300 px-2 leading-[14px]`,onClick:()=>{y?.stop({taskId:e.activeRoundId}).catch(e=>l(String(e)))},children:`停止此任务`})]}),c&&(0,M.jsx)(`p`,{role:`alert`,className:`p-3 text-sm text-sakura-800`,children:c}),(0,M.jsx)(iR.Provider,{value:x,children:(0,M.jsx)(NB,{view:S,focusEntry:w!==void 0&&n?{id:w,nonce:n.nonce}:void 0,onLoadEarlier:t&&p!=null?C:void 0,busy:o?.busy??!1,emptyLabel:e.status===`queued`?`任务排队中…`:`暂无内容`})})]})}function KB({entries:e,selected:t,open:n,onSelect:r,onClose:i,approval:a,target:o}){let[s,c]=(0,f.useState)([]),l=(0,f.useRef)(null),u=(0,f.useRef)(null),[d,p]=(0,f.useState)(()=>window.matchMedia(`(max-width: 1023px)`).matches);return(0,f.useEffect)(()=>{let e=window.matchMedia(`(max-width: 1023px)`),t=()=>p(e.matches);return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]),(0,f.useEffect)(()=>{t!==null&&c(e=>e.includes(t)?e:[...e,t])},[t]),(0,f.useEffect)(()=>{if(!n)return;let e=document.activeElement,t=d&&u.current?.parentElement?[...u.current.parentElement.children].filter(e=>e instanceof HTMLElement&&e!==u.current):[],r=t.map(e=>e.inert);return t.forEach(e=>{e.inert=!0}),l.current?.focus(),()=>{t.forEach((e,t)=>{e.inert=r[t]}),e?.isConnected&&e.focus()}},[n,d]),(0,M.jsxs)(`aside`,{ref:u,role:d?`dialog`:`complementary`,"aria-modal":d&&n?!0:void 0,"aria-label":`子智能体`,className:`${n?`flex`:`hidden`} fixed inset-0 z-30 min-w-0 flex-col border-l border-sakura-200 bg-base lg:static lg:z-auto lg:w-[min(42vw,40rem)] lg:shrink-0`,onKeyDown:e=>{if(e.currentTarget.contains(e.target)){if(e.key===`Tab`&&window.innerWidth<1024){let t=[...e.currentTarget.querySelectorAll(`button:not([disabled]),a[href],summary,[tabindex='0']`)].filter(e=>e.getClientRects().length>0),n=t[0],r=t.at(-1);e.shiftKey&&document.activeElement===n?(e.preventDefault(),r?.focus()):!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),n?.focus())}e.key===`Escape`&&(e.stopPropagation(),i())}},children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between border-b border-sakura-200 px-4 py-1.5`,children:[(0,M.jsx)(`strong`,{className:`text-sm text-ink-800`,children:`子智能体`}),(0,M.jsx)(`button`,{ref:l,type:`button`,className:`focus-neko rounded-lg px-2 py-1 text-sm text-ink-600 hover:bg-sakura-50`,onClick:i,children:`关闭`})]}),(0,M.jsx)(`div`,{className:`max-h-44 shrink-0 overflow-auto border-b border-sakura-100 p-2`,children:e.map(e=>(0,M.jsxs)(`button`,{type:`button`,"aria-pressed":t===e.agentId,className:`focus-neko flex w-full min-w-0 items-center gap-2 rounded-lg px-2 py-1.5 text-left text-sm ${t===e.agentId?`bg-tianyi-100`:`hover:bg-sakura-50`}`,onClick:()=>r(e.agentId),children:[(0,M.jsxs)(`span`,{className:`min-w-0 truncate`,children:[(0,M.jsx)(`span`,{className:`text-tianyi-700`,children:e.role}),` · `,e.title]}),(0,M.jsxs)(`span`,{className:`shrink-0 text-xs text-ink-500`,children:[e.roundCount,` 轮`]})]},e.agentId))}),s.map(r=>{let i=e.find(e=>e.agentId===r);return i?(0,M.jsx)(GB,{entry:i,active:n&&r===t,target:r===t?o:void 0},r):null}),a]})}var qB=class extends Error{constructor(){super(`会话已切换,导出已取消`),this.name=`ExportCancelledError`}};async function JB(e){let{snapshot:t}=e,n=e.now??new Date,r=!1,i=await JL(e.format,{...t,exportedAt:n},{includeThinking:e.includeThinking,loadImage:n=>e.currentSessionId()===t.sessionId?e.readImage(n,t.sessionId):(r=!0,Promise.reject(new qB))});if(r)throw new qB;return{...i,fileName:qL(t.title,e.format,n)}}function YB(e){let t=e.skippedImages>0?`,${e.skippedImages} 张图片未能内嵌`:``;return`已导出 ${e.fileName}${t}`}function XB(e,t,n){let r=URL.createObjectURL(new Blob([t],{type:n})),i=document.createElement(`a`);i.href=r,i.download=e,i.hidden=!0,document.body.append(i);try{i.click()}finally{i.remove(),setTimeout(()=>URL.revokeObjectURL(r),0)}}var ZB=[{format:`markdown`,label:`Markdown (.md)`},{format:`html`,label:`HTML (.html)`},{format:`json`,label:`JSON (.json)`}];function QB(){let{view:e,currentSessionId:t,sessions:n}=$A(),[r,i]=(0,f.useState)(null),[a,o]=(0,f.useState)(!1),[s,c]=(0,f.useState)(!1),l=(0,f.useRef)(!1),u=e===null||t===null||e.items.length===0,d=s?`导出中…`:u?`当前会话还没有内容可导出`:`导出会话`,p=async r=>{if(l.current||e===null||t===null)return;l.current=!0,c(!0),i(null);let o=n.find(e=>e.id===t);try{let n=await JB({format:r,includeThinking:a,snapshot:{sessionId:t,title:o?Di(o,`新会话`):`新会话`,model:e.model,cwd:e.cwd,items:e.items},currentSessionId:()=>ej().currentSessionId,readImage:(e,t)=>dj.image(e.entryId,e.contentIndex,t)});XB(n.fileName,n.content,n.mimeType),tj.notice({level:`info`,text:YB(n)})}catch(e){tj.notice({level:`error`,text:e instanceof qB?e.message:`导出失败:${e instanceof Error?e.message:String(e)}`})}finally{l.current=!1,c(!1)}};return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(`button`,{type:`button`,className:`icon-btn export-btn`,"aria-label":`导出会话`,"aria-haspopup":`dialog`,"aria-expanded":r!==null,"aria-disabled":s||void 0,disabled:u&&!s,title:d,onClick:e=>{s||i(r===null?e.currentTarget:null)},children:[(0,M.jsx)(GP,{name:`download`}),(0,M.jsx)(`span`,{className:`export-label`,children:s?`导出中…`:`导出`})]}),r&&(0,M.jsxs)(XP,{anchor:r,label:`导出会话`,onClose:()=>i(null),children:[(0,M.jsx)(`div`,{className:`section-label`,children:`导出格式`}),ZB.map(({format:e,label:t})=>(0,M.jsxs)(`button`,{type:`button`,className:`chrome-row`,onClick:()=>void p(e),children:[(0,M.jsx)(GP,{name:`download`}),t]},e)),(0,M.jsxs)(`button`,{type:`button`,role:`switch`,"aria-checked":a,className:`chrome-row export-option`,onClick:()=>o(!a),children:[(0,M.jsx)(`span`,{className:`export-check`,"aria-hidden":`true`,children:a?`✓`:``}),`包含思考过程`]})]})]})}var $B={ready:`已连接`,connecting:`连接中…`,reconnecting:`重连中…`,error:`连接失败`};function eV(e){let{workspaceRoot:t,currentSessionId:n,operating:r,sessions:i,view:a}=$A(),o=a?.jobs,s=o?.filter(e=>e.status===`running`).length??0,c=i.find(e=>e.id===n);return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(`header`,{className:`chrome topbar`,children:[(0,M.jsx)(`button`,{type:`button`,className:`icon-btn`,"aria-label":`切换侧栏`,title:`切换侧栏`,"aria-expanded":e.sidebarOpen,onClick:e.onToggleSessions,children:(0,M.jsx)(GP,{name:`panel`})}),(0,M.jsxs)(`span`,{className:`topbar-path`,title:t,children:[(0,M.jsx)(GP,{name:`folder`}),(0,M.jsx)(`span`,{className:`truncate min-w-0`,children:ZP(t)||`工作区`})]}),(0,M.jsx)(`span`,{className:`text-ink-500`,children:`/`}),(0,M.jsx)(`span`,{className:`truncate min-w-0`,title:c?Di(c,`新会话`):void 0,children:c?Di(c,`新会话`):`新会话`}),(0,M.jsx)(`output`,{className:`conn-status ${e.conn===`ready`?`is-connected`:e.conn===`error`?`is-error`:``}`,children:r?`切换中…`:$B[e.conn]}),o!==void 0&&o.length>0&&e.onToggleJobs&&(0,M.jsxs)(`button`,{type:`button`,className:`focus-neko shrink-0 whitespace-nowrap rounded-full border border-sakura-300 px-2.5 py-0.5 text-xs text-sakura-800 hover:bg-sakura-50`,"aria-expanded":e.jobsOpen,title:`后台任务`,onClick:e.onToggleJobs,children:[`任务`,s>0?` · ${s} 运行中`:` ${o.length}`]}),(0,M.jsx)(QB,{})]}),(0,M.jsx)(hF,{})]})}var tV=8e3;function nV(){let{view:e,phase:t,notice:n,operating:r,workspaceRoot:i,currentSessionId:a}=$A(),o=KP();(0,f.useEffect)(()=>{if(n?.level!==`info`)return;let e=setTimeout(tj.clearNotice,tV);return()=>clearTimeout(e)},[n]);let s=(0,f.useRef)(0),[c,l]=(0,f.useState)(()=>window.matchMedia(`(max-width: 1023px)`).matches);(0,f.useEffect)(()=>{let e=window.matchMedia(`(max-width: 1023px)`),t=()=>l(e.matches);return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]);let[u,d]=(0,f.useState)({}),p=e?.agents;(0,f.useEffect)(()=>{a&&p?.length&&d(e=>({...e,[a]:{open:e[a]?.open??!0,...e[a]?.target?{target:e[a].target}:{},selected:e[a]?.selected??p[0].agentId,entries:p}}))},[p,a]);let[m,h]=(0,f.useState)(null),g=m!==null&&m===a,_=(e,t)=>{if(!a)return;h(null);let n=++s.current;d(r=>({...r,[a]:{open:!0,selected:e,entries:p??[],...t===void 0?{}:{target:{taskId:t,nonce:n}}}}))},v=t=>{let n=e?.subagents?.find(e=>e.taskId===t);n?.agentId&&_(n.agentId,t)},[y,b]=(0,f.useState)(()=>!window.matchMedia(WP).matches);(0,f.useEffect)(()=>{b(!o)},[o]);let x=c&&!!u[a??``]?.open,S=e?.busy??!1,C=e?.status??null;return(0,M.jsxs)(`div`,{className:`flex h-dvh`,children:[(0,M.jsx)(`a`,{href:`#main-content`,className:`skip-link`,children:`跳到主内容`}),(0,M.jsx)(HB,{open:y,onClose:()=>b(!1)}),(0,M.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,M.jsx)(eV,{sidebarOpen:y,conn:t,onToggleSessions:()=>b(!y),jobsOpen:g,onToggleJobs:()=>{!g&&a&&d(e=>e[a]?{...e,[a]:{...e[a],open:!1}}:e),h(g?null:a??null)}}),n!==null&&(0,M.jsxs)(`div`,{className:`discrete-in flex items-center gap-2 border-b py-1 pr-2 pl-9 text-xs ${n.level===`error`?`border-sakura-300 bg-sakura-100 text-sakura-900`:`border-tianyi-200 bg-tianyi-50 text-tianyi-900`}`,role:`alert`,children:[(0,M.jsx)(`span`,{className:`min-w-0 flex-1 text-center`,children:n.text}),(0,M.jsx)(QP,{label:`关闭提示`,onClick:tj.clearNotice})]}),(0,M.jsxs)(`main`,{id:`main-content`,tabIndex:-1,className:`flex min-h-0 flex-1 flex-col focus:outline-none`,children:[!a&&t===`ready`&&!r?(0,M.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 px-6 text-center`,children:[(0,M.jsx)(`h1`,{className:`text-xl font-semibold text-ink-900`,children:ZP(i)}),(0,M.jsx)(`p`,{className:`text-sm text-ink-600`,children:`在这个工作区开始新的会话`}),(0,M.jsx)(`button`,{type:`button`,className:`btn-primary focus-neko rounded-xl px-4 py-2`,onClick:()=>{dj.createSession().catch(pj)},children:`新建会话`})]}):(0,M.jsx)(NB,{view:e,busy:S,onSubagent:v,tray:(p?.length??0)>0?(0,M.jsxs)(`button`,{type:`button`,className:`focus-neko rounded-full border border-sakura-300 bg-surface px-3.5 py-1 text-xs font-medium text-sakura-800 hover:bg-sakura-50`,onClick:()=>_(u[a??``]?.selected??p[0].agentId),children:[`子智能体 · `,p.length,` 个`,p.some(e=>e.approvalCount)?` · 待审批 ${p.reduce((e,t)=>e+(t.approvalCount??0),0)}`:``,p.some(e=>e.historyThrough===void 0&&e.status===`running`)?` · ${p.filter(e=>e.historyThrough===void 0&&e.status===`running`).length} 运行中`:``]}):void 0}),!x&&(0,M.jsx)(bF,{}),(0,M.jsx)(cF,{disabled:t!==`ready`||r,busy:S,status:C})]})]}),Object.entries(u).map(([e,t])=>(0,M.jsx)(KB,{entries:e===a?p??t.entries:t.entries,approval:x&&e===a?(0,M.jsx)(bF,{}):void 0,selected:t.selected,open:e===a&&t.open,onSelect:_,target:t.target,onClose:()=>d(n=>({...n,[e]:{...t,open:!1}}))},e)),a&&e?.jobs!==void 0&&(0,M.jsx)(zF,{sessionId:a,jobs:e.jobs,open:g,onClose:()=>h(null)},a)]})}var rV=[{id:`deepseek`,envVar:`DEEPSEEK_API_KEY`,signupUrl:`https://platform.deepseek.com/api_keys`,keyless:!1},{id:`tavily`,envVar:`TAVILY_API_KEY`,signupUrl:`https://app.tavily.com`,keyless:!0}],iV={saved:`使用已保存密钥`,environment:`使用环境变量`,runtime:`使用运行时配置`,keyless:`keyless(限流)`,none:`尚未配置`},aV={deepseek:`DeepSeek`,tavily:`Tavily`};function oV(e){let{spec:t,status:n,ready:r}=e,i=aV[t.id]??t.id,[a,o]=(0,f.useState)(``),[s,c]=(0,f.useState)(!1),l=(0,f.useRef)(!1),[u,d]=(0,f.useState)(``);async function p(e){if(!l.current){l.current=!0,c(!0),d(``);try{e?await dj.removeCredential(t.id):await dj.saveCredential(t.id,a),o(``),d(e?`已移除保存的密钥`:`已保存,下次请求生效`)}catch{d(`操作失败,请检查连接后重试。`)}finally{l.current=!1,c(!1)}}}let m=s||!r||!n;return(0,M.jsxs)(`section`,{className:`rounded-2xl border border-sakura-200 bg-surface p-5 shadow-soft`,children:[(0,M.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center justify-between gap-2`,children:[(0,M.jsx)(`h2`,{className:`text-base font-bold text-ink-900`,children:i}),(0,M.jsx)(`span`,{className:`rounded-full bg-tianyi-50 px-3 py-1 text-xs text-tianyi-800`,children:n?iV[n.source]:`读取中…`})]}),(0,M.jsxs)(`p`,{className:`mb-3 text-xs text-ink-500`,children:[`环境变量:`,n?n.environmentConfigured?`已配置`:`未配置`:`读取中…`,t.keyless?` · 未配置时以 keyless 限流模式运行`:``]}),(0,M.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),p(!1)},children:[(0,M.jsxs)(`label`,{className:`sr-only`,htmlFor:`${t.id}-key`,children:[i,` API Key`]}),(0,M.jsx)(`input`,{id:`${t.id}-key`,type:`password`,autoComplete:`off`,spellCheck:!1,value:a,maxLength:4096,disabled:m,onChange:e=>o(e.target.value),placeholder:n?.savedConfigured?`输入新密钥以替换`:`粘贴你的 API Key`,className:`focus-neko w-full min-w-0 rounded-xl border border-sakura-200 bg-base px-3 py-2.5 text-sm`}),(0,M.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-3`,children:[(0,M.jsx)(`button`,{type:`submit`,disabled:m||!a.trim(),className:`focus-neko rounded-full bg-sakura-100 px-4 py-1.5 text-sm font-semibold text-sakura-800 disabled:opacity-50`,children:s?`处理中…`:`保存密钥`}),n?.savedConfigured&&(0,M.jsx)(`button`,{type:`button`,disabled:m,onClick:()=>void p(!0),className:`focus-neko rounded-full px-3 py-1.5 text-sm text-ink-500 disabled:opacity-50`,children:`移除已保存密钥`}),(0,M.jsxs)(`a`,{href:t.signupUrl,target:`_blank`,rel:`noreferrer`,className:`focus-neko ml-auto inline-block rounded text-xs text-sakura-700`,children:[`获取 `,i,` API Key ↗`]})]})]}),(0,M.jsx)(`output`,{className:`mt-2 block min-h-4 text-xs text-tianyi-800`,children:u})]})}function sV(){let{credentials:e,phase:t}=$A(),n=t===`ready`&&e!==null;return(0,M.jsxs)(fF,{active:`credentials`,children:[(0,M.jsxs)(`div`,{className:`mx-auto w-full max-w-4xl px-5 pt-6 pb-3`,children:[(0,M.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-2`,children:[(0,M.jsx)(`h1`,{className:`text-xl font-bold text-ink-900`,children:`密钥`}),(0,M.jsx)(`span`,{className:`ml-auto text-xs text-ink-500`,children:t===`ready`?`已连接`:`连接中…`})]}),(0,M.jsx)(`p`,{className:`mt-1 text-sm text-ink-500`,children:`管理 API Key,保存值优先于环境变量,所有工作区共用。`})]}),(0,M.jsx)(`main`,{className:`mx-auto w-full max-w-4xl px-5 pb-8`,children:(0,M.jsx)(`div`,{className:`flex flex-col gap-4`,children:rV.map(t=>(0,M.jsx)(oV,{spec:t,status:e?.statuses[t.id],ready:n},t.id))})})]})}var cV={documents:`文档处理`,development:`开发工作流`,frontend:`前端 / UI`,research:`研究检索`,skills:`技能生态`,automation:`自动化`,database:`数据库`,writing:`写作`,uncategorized:`未分类`},lV=e=>e>=1048576?`${(e/1024/1024).toFixed(1)}MB`:`${Math.max(1,Math.round(e/1024))}KB`,uV=e=>e===``?``:e.slice(0,10),dV=e=>e instanceof N?e.reason??null:null;function fV(e,t){let n=new Map;for(let r of e){let e=t===`category`?cV[r.category]??r.category:r.source,i=n.get(e)??[];i.push(r),n.set(e,i)}return[...n.entries()].sort((e,t)=>t[1].length-e[1].length||e[0].localeCompare(t[0]))}function pV({skill:e}){return(0,M.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1.5 text-xs`,children:[e.installed.project&&(0,M.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-sakura-100 px-2 py-0.5 text-sakura-800`,children:[(0,M.jsx)(`span`,{className:`inline-block h-1.5 w-1.5 rounded-full bg-sakura-500`}),`项目级`,e.activeLevel===`project`?`·生效`:``]}),e.installed.user&&(0,M.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-sakura-100 px-2 py-0.5 text-sakura-800`,children:[(0,M.jsx)(`span`,{className:`inline-block h-1.5 w-1.5 rounded-full bg-sakura-500`}),`用户级`,e.activeLevel===`user`?`·生效`:``]}),e.installed.builtin&&(0,M.jsx)(`span`,{className:`rounded-full bg-ink-100 px-2 py-0.5 text-ink-600`,children:`内置`})]})}function mV({confirm:e,onClose:t}){let[n,r]=(0,f.useState)(!1);return(0,M.jsx)(hV,{children:(0,M.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center p-4`,children:[(0,M.jsx)(`button`,{type:`button`,"aria-label":`取消`,onClick:t,className:`absolute inset-0 bg-ink-900/20`}),(0,M.jsxs)(`div`,{role:`alertdialog`,"aria-modal":`true`,"aria-label":e.title,className:`relative w-full max-w-sm rounded-card border border-sakura-200 bg-surface p-5 shadow-lift`,children:[(0,M.jsx)(`h3`,{className:`text-base font-bold text-ink-900`,children:e.title}),(0,M.jsx)(`p`,{className:`mt-2 text-sm text-ink-600`,children:e.body}),(0,M.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,M.jsx)(`button`,{type:`button`,onClick:t,className:`focus-neko rounded-full px-4 py-1.5 text-sm text-ink-500`,children:`取消`}),(0,M.jsx)(`button`,{type:`button`,disabled:n,className:`focus-neko rounded-full px-4 py-1.5 text-sm font-semibold disabled:opacity-50 ${e.danger?`bg-sakura-100 text-sakura-800`:`bg-tianyi-100 text-tianyi-800`}`,onClick:()=>{r(!0),e.action().finally(()=>{r(!1),t()})},children:n?`处理中…`:e.confirmLabel})]})]})]})})}function hV({children:e}){return(0,pN.createPortal)(e,document.body)}function gV({name:e,onClose:t,onChanged:n}){let[r,i]=(0,f.useState)(null),[a,o]=(0,f.useState)(null),[s,c]=(0,f.useState)(`about`),[l,u]=(0,f.useState)(null),[d,p]=(0,f.useState)(null),[m,h]=(0,f.useState)(null),[g,_]=(0,f.useState)(``),[v,y]=(0,f.useState)(null);(0,f.useEffect)(()=>{let t=!1;return i(null),o(null),u(null),c(`about`),_(``),dj.marketDetail(e).then(e=>{t||i(e)}).catch(e=>{t||o(e instanceof Error?e.message:String(e))}),()=>{t=!0}},[e]),(0,f.useEffect)(()=>{if(s!==`preview`||l!==null||d!==null)return;let t=!1;return dj.marketPreview(e).then(e=>{t||u(e)}).catch(e=>{t||p(e instanceof Error?e.message:String(e))}),()=>{t=!0}},[s,e,l,d]);let b=async(t,r)=>{h(t),_(``);try{let a=await dj.marketInstall(e,t,r);_(a.shadowedBy===`project`?`已安装到用户级,但项目级同名技能优先,此安装暂不生效。下次发送消息时生效。`:`安装完成,下次发送消息时生效。`),n();let o=await dj.marketDetail(e);i(o)}catch(n){dV(n)===`skill_exists`&&!r?y({title:`覆盖已安装技能`,body:`${t===`user`?`用户级`:`项目级`}已存在 ${e}。以市场版本覆盖?本地改动将丢失。`,confirmLabel:`覆盖安装`,action:()=>b(t,!0)}):_(`操作失败:${n instanceof Error?n.message:String(n)}`)}finally{h(null)}},x=t=>{if(r===null)return;let n=t===`user`?r.installed.user:r.installed.project,i=t===`user`&&r.installed.project;n?y({title:`覆盖已安装技能`,body:`${t===`user`?`用户级`:`项目级`}已存在 ${e}。以市场版本 ${r.version} 覆盖?本地改动将丢失。`,confirmLabel:`覆盖安装`,action:()=>b(t,!0)}):i?y({title:`安装后暂不生效`,body:`项目级已存在同名 ${e},项目级优先。仍要安装到用户级吗?`,confirmLabel:`仍安装`,action:()=>b(t,!1)}):b(t,!1)},S=t=>{y({title:`卸载技能`,body:`删除${t===`user`?`用户级`:`项目级`}的 ${e}?此操作不可撤销。`,confirmLabel:`卸载`,danger:!0,action:async()=>{h(t),_(``);try{await dj.marketUninstall(e,t),_(`已卸载,下次发送消息时生效。`),n(),i(await dj.marketDetail(e))}catch(e){_(`操作失败:${e instanceof Error?e.message:String(e)}`)}finally{h(null)}}})};return(0,M.jsxs)(hV,{children:[(0,M.jsx)(`button`,{type:`button`,"aria-label":`关闭详情`,onClick:t,className:`fixed inset-0 z-40 bg-ink-900/10`}),(0,M.jsxs)(`aside`,{role:`dialog`,"aria-label":`技能详情 ${e}`,className:`fixed inset-0 z-50 flex flex-col bg-base sm:inset-y-0 sm:left-auto sm:right-0 sm:w-[26rem] sm:border-l sm:border-sakura-200 sm:shadow-lift`,children:[(0,M.jsxs)(`header`,{className:`flex items-center justify-between gap-2 border-b border-sakura-100 px-4 py-3`,children:[(0,M.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,M.jsx)(`span`,{className:`text-sakura-500`,children:(0,M.jsx)(GP,{name:`sparkles`,size:16})}),(0,M.jsx)(`h2`,{className:`truncate text-lg font-bold text-ink-900`,children:e}),r&&(0,M.jsx)(`span`,{className:`shrink-0 text-xs text-ink-400`,children:r.version})]}),(0,M.jsx)(`button`,{type:`button`,onClick:t,"aria-label":`关闭详情`,className:`focus-neko rounded-lg p-1 text-ink-500 hover:bg-ink-100`,children:(0,M.jsx)(GP,{name:`close`,size:16})})]}),(0,M.jsx)(`div`,{className:`flex gap-1 border-b border-sakura-100 px-4 py-2`,children:[`about`,`preview`].map(e=>(0,M.jsx)(`button`,{type:`button`,onClick:()=>c(e),className:`focus-neko rounded-full px-3 py-1 text-sm ${s===e?`bg-tianyi-100 font-semibold text-tianyi-800`:`text-ink-500`}`,children:e===`about`?`说明`:`预览`},e))}),(0,M.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-3`,children:[a!==null&&(0,M.jsxs)(`p`,{className:`text-sm text-sakura-800`,children:[`加载失败:`,a]}),r===null&&a===null&&(0,M.jsx)(`p`,{className:`text-sm text-ink-500`,children:`加载中…`}),r!==null&&s===`about`&&(0,M.jsxs)(`div`,{className:`space-y-3`,children:[(0,M.jsx)(`p`,{className:`text-sm text-ink-700`,children:r.description}),(0,M.jsx)(`dl`,{className:`space-y-1.5 text-xs text-ink-600`,children:[[`分类`,cV[r.category]??r.category],[`来源`,r.source],[`大小`,lV(r.sizeBytes)],[`SHA-256`,`${r.sha256.slice(0,12)}…`],[`上传于`,uV(r.uploadedAt)],...r.license===``?[]:[[`许可证`,r.license]]].map(([e,t])=>(0,M.jsxs)(`div`,{className:`flex gap-2`,children:[(0,M.jsx)(`dt`,{className:`w-14 shrink-0 text-ink-400`,children:e}),(0,M.jsx)(`dd`,{className:`min-w-0 font-mono`,children:t})]},e))}),(0,M.jsxs)(`div`,{className:`rounded-xl bg-ink-50 px-3 py-2 text-xs text-ink-600`,children:[(0,M.jsx)(pV,{skill:r}),!r.installed.project&&!r.installed.user&&!r.installed.builtin&&`尚未安装`]})]}),r!==null&&s===`preview`&&(0,M.jsxs)(`div`,{children:[l===null&&d===null&&(0,M.jsx)(`p`,{className:`text-sm text-ink-500`,children:`下载并解开预览…`}),d!==null&&(0,M.jsxs)(`p`,{className:`text-sm text-sakura-800`,children:[`预览失败:`,d]}),l!==null&&(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(mB,{text:l.body}),(0,M.jsx)(`h3`,{className:`mb-1 mt-4 text-xs font-medium text-ink-400`,children:`包内文件`}),(0,M.jsx)(`ul`,{className:`space-y-0.5 font-mono text-xs text-ink-600`,children:l.files.map(e=>(0,M.jsx)(`li`,{children:e},e))})]})]})]}),r!==null&&(0,M.jsxs)(`footer`,{className:`space-y-2 border-t border-sakura-100 px-4 py-3`,children:[g!==``&&(0,M.jsx)(`output`,{className:`block text-xs text-tianyi-800`,children:g}),r.installed.builtin&&!r.installed.user&&!r.installed.project?(0,M.jsx)(`p`,{className:`text-xs text-ink-500`,children:`内置技能随 neko 分发,无需安装,也不支持卸载。`}):(0,M.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:[`user`,`project`].map(e=>{let t=e===`user`?r.installed.user:r.installed.project,n=e===`user`?`用户级`:`项目级`;return t?(0,M.jsxs)(`button`,{type:`button`,disabled:m!==null,onClick:()=>S(e),className:`focus-neko inline-flex items-center gap-1.5 rounded-full border border-ink-200 px-3 py-1.5 text-sm text-ink-600 disabled:opacity-50`,children:[(0,M.jsx)(GP,{name:`trash`,size:14}),m===e?`处理中…`:`卸载${n}`]},e):(0,M.jsxs)(`button`,{type:`button`,disabled:m!==null,onClick:()=>x(e),className:`focus-neko inline-flex items-center gap-1.5 rounded-full bg-tianyi-100 px-3 py-1.5 text-sm font-semibold text-tianyi-800 disabled:opacity-50`,children:[(0,M.jsx)(GP,{name:`download`,size:14}),m===e?`安装中…`:`安装到${n}`]},e)})})]})]}),v&&(0,M.jsx)(mV,{confirm:v,onClose:()=>y(null)})]})}function _V(){let{phase:e}=$A(),[t,n]=(0,f.useState)([]),[r,i]=(0,f.useState)(!0),[a,o]=(0,f.useState)(null),[s,c]=(0,f.useState)(``),[l,u]=(0,f.useState)(`category`),[d,p]=(0,f.useState)(null),m=(0,f.useRef)(0),h=()=>{let e=++m.current;i(!0),o(null),dj.marketList().then(t=>{e===m.current&&n(t)}).catch(t=>{e===m.current&&o(t instanceof Error?t.message:String(t))}).finally(()=>{e===m.current&&i(!1)})};(0,f.useEffect)(()=>{e===`ready`&&h()},[e]);let g=(0,f.useMemo)(()=>{let e=s.trim().toLowerCase();return e===``?t:t.filter(t=>t.name.toLowerCase().includes(e)||t.description.toLowerCase().includes(e))},[t,s]),_=(0,f.useMemo)(()=>fV(g,l),[g,l]);return(0,M.jsxs)(`div`,{className:`flex min-h-dvh flex-col bg-base`,children:[(0,M.jsx)(`header`,{className:`sticky top-0 z-10 border-b border-sakura-100 bg-surface/90 px-4 py-3 backdrop-blur-md sm:px-6`,children:(0,M.jsxs)(`div`,{className:`mx-auto flex w-full max-w-7xl flex-wrap items-center gap-3`,children:[(0,M.jsx)(Br,{to:`/`,className:`focus-neko inline-flex shrink-0 items-center gap-1 rounded-lg px-2 py-1 text-sm font-medium text-sakura-700 hover:bg-sakura-50`,children:`← 返回聊天`}),(0,M.jsx)(`span`,{className:`text-ink-300`,children:`/`}),(0,M.jsx)(`h1`,{className:`text-base font-bold text-ink-900 sm:text-lg`,children:`技能市场`}),(0,M.jsxs)(`div`,{className:`ml-auto flex flex-wrap items-center gap-2 sm:gap-3`,children:[(0,M.jsx)(`div`,{className:`flex rounded-full border border-sakura-200 p-0.5 text-xs`,children:[`category`,`source`].map(e=>(0,M.jsx)(`button`,{type:`button`,onClick:()=>u(e),className:`focus-neko rounded-full px-3 py-1 ${l===e?`bg-sakura-100 font-semibold text-sakura-800`:`text-ink-500 hover:text-ink-800`}`,children:e===`category`?`按分类`:`按来源`},e))}),(0,M.jsxs)(`label`,{className:`relative`,children:[(0,M.jsx)(`span`,{className:`sr-only`,children:`搜索技能`}),(0,M.jsx)(`span`,{className:`pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 text-ink-400`,children:(0,M.jsx)(GP,{name:`search`,size:14})}),(0,M.jsx)(`input`,{value:s,onChange:e=>c(e.target.value),placeholder:`搜索技能…`,className:`focus-neko w-36 rounded-full border border-sakura-200 bg-surface py-1.5 pl-8 pr-3 text-sm sm:w-56`})]}),(0,M.jsx)(`span`,{className:`text-xs text-ink-400`,children:e===`ready`?`已连接`:`连接中…`})]})]})}),(0,M.jsxs)(`main`,{className:`mx-auto w-full max-w-7xl flex-1 px-4 py-6 sm:px-6`,children:[r&&(0,M.jsx)(`p`,{className:`py-16 text-center text-sm text-ink-500`,children:e===`ready`?`加载市场目录…`:`等待网关连接…`}),a!==null&&(0,M.jsxs)(`div`,{className:`mx-auto max-w-md rounded-card border border-sakura-200 bg-surface p-6 text-center shadow-soft`,children:[(0,M.jsx)(`p`,{className:`text-sm text-ink-700`,children:`市场目录加载失败,请检查网络后重试。`}),(0,M.jsx)(`p`,{className:`mt-1 break-all font-mono text-xs text-ink-400`,children:a}),(0,M.jsx)(`button`,{type:`button`,onClick:h,className:`focus-neko mt-4 rounded-full bg-sakura-100 px-4 py-1.5 text-sm font-semibold text-sakura-800`,children:`重试`})]}),!r&&a===null&&g.length===0&&(0,M.jsx)(`p`,{className:`py-16 text-center text-sm text-ink-500`,children:"没有匹配的技能。反复出现的需求可以用 `/skill:skill-creator` 自己造一个。"}),_.map(([e,t])=>(0,M.jsxs)(`section`,{className:`mb-7`,children:[(0,M.jsxs)(`h2`,{className:`mb-2.5 flex items-baseline gap-2 text-lg font-bold text-ink-900`,children:[e,(0,M.jsx)(`span`,{className:`text-xs font-normal text-ink-400`,children:t.length})]}),(0,M.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4`,children:t.map(e=>(0,M.jsxs)(`button`,{type:`button`,onClick:()=>p(e.name),className:`focus-neko rounded-2xl border border-sakura-200 bg-surface p-4 text-left shadow-soft transition-shadow hover:shadow-lift`,children:[(0,M.jsxs)(`div`,{className:`mb-1 flex items-center justify-between gap-2`,children:[(0,M.jsx)(`span`,{className:`truncate text-base font-bold text-ink-900`,children:e.name}),(0,M.jsx)(pV,{skill:e})]}),(0,M.jsx)(`p`,{className:`mb-2.5 line-clamp-2 min-h-10 text-sm text-ink-500`,children:e.description}),(0,M.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-ink-400`,children:[(0,M.jsx)(`span`,{className:`rounded-full bg-tianyi-50 px-2 py-0.5 text-tianyi-800`,children:e.source}),(0,M.jsx)(`span`,{className:`font-mono`,children:e.version}),(0,M.jsx)(`span`,{children:lV(e.sizeBytes)})]})]},e.name))})]},e))]}),d!==null&&(0,M.jsx)(gV,{name:d,onClose:()=>p(null),onChanged:()=>h()})]})}var vV=Gr({component:()=>(0,M.jsx)(ti,{})}),yV=Ur({getParentRoute:()=>vV,path:`/`,component:nV}),bV=Ur({getParentRoute:()=>vV,path:`/settings`,component:sV}),xV=Ur({getParentRoute:()=>vV,path:`/skills`,component:_V}),SV=Ur({getParentRoute:()=>vV,path:`/about`,component:gF}),CV=si({routeTree:vV.addChildren([yV,bV,xV,SV])});lj();var wV=document.getElementById(`root`);wV!==null&&(0,gi.createRoot)(wV).render((0,M.jsx)(f.StrictMode,{children:(0,M.jsx)(ui,{router:CV})}));
|