@pasko70/pibo 1.4.6 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/dist/apps/chat/chat-settings-routes.js +24 -1
  2. package/dist/apps/chat/data/project-service.js +13 -3
  3. package/dist/apps/chat/telemetry-retention-service.js +69 -0
  4. package/dist/apps/chat/web-app.js +18 -8
  5. package/dist/apps/chat-ui/assets/{dist-DWA7BIr3.js → dist-B9sopUkn.js} +1 -1
  6. package/dist/apps/chat-ui/assets/{dist-Bns-O5iY.js → dist-BDQhMN_4.js} +1 -1
  7. package/dist/apps/chat-ui/assets/{dist-CVcI9eYD.js → dist-BEStK5um.js} +1 -1
  8. package/dist/apps/chat-ui/assets/{dist-B6kzRv2_.js → dist-BiBY_4CK.js} +1 -1
  9. package/dist/apps/chat-ui/assets/{dist-DvPgMX-r.js → dist-C2OyzisT.js} +1 -1
  10. package/dist/apps/chat-ui/assets/{dist-D9K0kHT0.js → dist-C9stINOY.js} +1 -1
  11. package/dist/apps/chat-ui/assets/{dist-DqaKPP5Y.js → dist-CQKLsKIo.js} +1 -1
  12. package/dist/apps/chat-ui/assets/{dist-D4CEl91a.js → dist-CtSZyFkJ.js} +1 -1
  13. package/dist/apps/chat-ui/assets/{dist-Dj3uUYqF.js → dist-DPLEwPsG.js} +1 -1
  14. package/dist/apps/chat-ui/assets/{dist-CqkKCn6l.js → dist-DRTq4wrN.js} +1 -1
  15. package/dist/apps/chat-ui/assets/{dist-DuM9PL5k.js → dist-F2W_jRom.js} +1 -1
  16. package/dist/apps/chat-ui/assets/index-D_60RTKn.css +1 -0
  17. package/dist/apps/chat-ui/assets/index-iaNLOwJ-.js +157 -0
  18. package/dist/apps/chat-ui/index.html +2 -2
  19. package/dist/apps/chat-vscode-web/assets/{index-CjOC7zYy.js → index-lA76A7Pc.js} +1 -1
  20. package/dist/apps/chat-vscode-web/index.html +1 -1
  21. package/dist/apps/vscode-artifacts/latest.vsix +0 -0
  22. package/dist/apps/vscode-artifacts/{pibo-vscode-ext-1.4.6.vsix → pibo-vscode-ext-1.5.0.vsix} +0 -0
  23. package/dist/core/runtime-telemetry.js +11 -3
  24. package/dist/core/session-router.js +7 -1
  25. package/dist/core/telemetry-retention-settings.js +34 -0
  26. package/dist/core/user-settings.js +11 -0
  27. package/dist/data/telemetry.js +11 -0
  28. package/package.json +1 -1
  29. package/dist/apps/chat-ui/assets/index-B-qaya1G.css +0 -1
  30. package/dist/apps/chat-ui/assets/index-Baxj7Erc.js +0 -166
@@ -0,0 +1,157 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dist-BiBY_4CK.js","assets/dist-SVPsM5Oi.js","assets/dist-tGfufz3b.js","assets/dist-C5YJOwhH.js","assets/dist-CKM5j-iy.js","assets/rolldown-runtime-S-ySWqyJ.js","assets/dist-BEStK5um.js","assets/dist-B9sopUkn.js","assets/dist-DPLEwPsG.js","assets/dist--55mTWk3.js","assets/dist-BDQhMN_4.js","assets/dist-BZ39rB1W.js","assets/dist-C5oXtFSP.js","assets/dist-C2OyzisT.js","assets/dist-C9stINOY.js","assets/dist-CtSZyFkJ.js","assets/dist-DRTq4wrN.js","assets/dist-CUp9us2q.js","assets/dist-DSKQpPaz.js","assets/dist-CZ9T4Cly.js","assets/dist-Zqt9kNG9.js","assets/dist-BsedZGJo.js","assets/dockerfile-CUaqzcqp.js","assets/simple-mode-CL04yRVp.js","assets/factor-C2tAxNob.js","assets/nsis-SMDwKltR.js","assets/pug-Bo3wfL-f.js","assets/javascript-DSlzRUd8.js","assets/dist-F2W_jRom.js","assets/dist-CQKLsKIo.js"])))=>i.map(i=>d[i]);
2
+ import{n as e,r as t,t as n}from"./rolldown-runtime-S-ySWqyJ.js";import{$ as r,A as i,At as a,Ct as o,Dt as s,E as c,Et as l,G as u,J as d,K as f,L as p,Mt as m,Nt as h,O as g,Ot as _,P as v,Pt as y,Q as b,S as x,St as S,T as C,Tt as w,W as T,X as E,Y as D,Z as O,_t as k,a as A,at as j,bt as M,c as N,ct as P,dt as ee,et as te,f as ne,ft as F,g as re,gt as I,ht as ie,it as ae,j as oe,jt as se,kt as ce,l as le,lt as ue,mt as de,n as fe,nt as pe,o as me,ot as he,pt as ge,q as _e,rt as ve,st as ye,t as be,tt as xe,ut as Se,v as Ce,vt as we,w as Te,wt as Ee,x as De,xt as Oe,yt as ke}from"./dist-SVPsM5Oi.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var Ae=n((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.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.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`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},T=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 D(e,t){return E(e.type,t,e.props)}function O(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function k(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var A=/\/+/g;function j(e,t){return typeof e==`object`&&e&&e.key!=null?k(``+e.key):t.toString(36)}function M(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(C,C):(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 N(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,N(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+j(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(A,`$&/`)+`/`),N(o,r,i,``,function(e){return e})):o!=null&&(O(o)&&(o=D(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(A,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u<e.length;u++)a=e[u],s=l+j(a,u),c+=N(a,r,i,s,o);else if(u=m(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+j(a,u++),c+=N(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return N(M(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 P(e,t,n){if(e==null)return e;var r=[],i=0;return N(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function ee(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t)},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var te=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)},ne={map:P,forEach:function(e,t,n){P(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return P(e,function(){t++}),t},toArray:function(e){return P(e,function(e){return e})||[]},only:function(e){if(!O(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=ne,e.Component=v,e.Fragment=r,e.Profiler=a,e.PureComponent=b,e.StrictMode=i,e.Suspense=l,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=w,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return w.H.useMemoCache(e)}},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=g({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!T.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)T.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=O,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:ee}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=w.T,n={};w.T=n;try{var r=e(),i=w.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(C,te)}catch(e){te(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),w.T=t}},e.unstable_useCacheRefresh=function(){return w.H.useCacheRefresh()},e.use=function(e){return w.H.use(e)},e.useActionState=function(e,t,n){return w.H.useActionState(e,t,n)},e.useCallback=function(e,t){return w.H.useCallback(e,t)},e.useContext=function(e){return w.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return w.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return w.H.useEffect(e,t)},e.useEffectEvent=function(e){return w.H.useEffectEvent(e)},e.useId=function(){return w.H.useId()},e.useImperativeHandle=function(e,t,n){return w.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return w.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return w.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return w.H.useMemo(e,t)},e.useOptimistic=function(e,t){return w.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return w.H.useReducer(e,t,n)},e.useRef=function(e){return w.H.useRef(e)},e.useState=function(e){return w.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return w.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return w.H.useTransition()},e.version=`19.2.5`})),je=n(((e,t)=>{t.exports=Ae()})),Me=n((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,O());else{var t=n(l);t!==null&&j(x,t.startTime-e)}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){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&&E());){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&&j(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function j(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,j(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),Ne=n(((e,t)=>{t.exports=Me()})),Pe=n((e=>{var t=je();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`);function o(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}var s=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function c(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.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 o(e,t,null,r)},e.flushSync=function(e){var t=s.T,n=i.p;try{if(s.T=null,i.p=2,e)return e()}finally{s.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=c(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=c(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})}}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=c(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=c(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})}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 s.H.useFormState(e,t,n)},e.useFormStatus=function(){return s.H.useHostTransitionStatus()},e.version=`19.2.5`})),Fe=n(((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=Pe()})),Ie=n((e=>{var t=Ne(),n=je(),r=Fe();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){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n: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 d(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=d(e),t!==null)return t;e=e.sibling}return null}var f=Object.assign,p=Symbol.for(`react.element`),m=Symbol.for(`react.transitional.element`),h=Symbol.for(`react.portal`),g=Symbol.for(`react.fragment`),_=Symbol.for(`react.strict_mode`),v=Symbol.for(`react.profiler`),y=Symbol.for(`react.consumer`),b=Symbol.for(`react.context`),x=Symbol.for(`react.forward_ref`),S=Symbol.for(`react.suspense`),C=Symbol.for(`react.suspense_list`),w=Symbol.for(`react.memo`),T=Symbol.for(`react.lazy`),E=Symbol.for(`react.activity`),D=Symbol.for(`react.memo_cache_sentinel`),O=Symbol.iterator;function k(e){return typeof e!=`object`||!e?null:(e=O&&e[O]||e[`@@iterator`],typeof e==`function`?e:null)}var A=Symbol.for(`react.client.reference`);function j(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===A?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case g:return`Fragment`;case v:return`Profiler`;case _:return`StrictMode`;case S:return`Suspense`;case C:return`SuspenseList`;case E:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case h:return`Portal`;case b:return e.displayName||`Context`;case y:return(e._context.displayName||`Context`)+`.Consumer`;case x:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case w:return t=e.displayName||null,t===null?j(e.type)||`Memo`:t;case T:t=e._payload,e=e._init;try{return j(e(t))}catch{}}return null}var M=Array.isArray,N=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,P=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ee={pending:!1,data:null,method:null,action:null},te=[],ne=-1;function F(e){return{current:e}}function re(e){0>ne||(e.current=te[ne],te[ne]=null,ne--)}function I(e,t){ne++,te[ne]=e.current,e.current=t}var ie=F(null),ae=F(null),oe=F(null),se=F(null);function ce(e,t){switch(I(oe,t),I(ae,e),I(ie,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?$d(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=$d(t),e=ef(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}re(ie),I(ie,e)}function le(){re(ie),re(ae),re(oe)}function ue(e){e.memoizedState!==null&&I(se,e);var t=ie.current,n=ef(t,e.type);t!==n&&(I(ae,e),I(ie,n))}function de(e){ae.current===e&&(re(ie),re(ae)),se.current===e&&(re(se),up._currentValue=ee)}var fe,pe;function me(e){if(fe===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);fe=t&&t[1]||``,pe=-1<e.stack.indexOf(`
3
+ at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
4
+ `+fe+e+pe}var he=!1;function ge(e,t){if(!e||he)return``;he=!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}e.call(n.prototype)}}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{he=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?me(n):``}function _e(e,t){switch(e.tag){case 26:case 27:case 5:return me(e.type);case 16:return me(`Lazy`);case 13:return e.child!==t&&t!==null?me(`Suspense Fallback`):me(`Suspense`);case 19:return me(`SuspenseList`);case 0:case 15:return ge(e.type,!1);case 11:return ge(e.type.render,!1);case 1:return ge(e.type,!0);case 31:return me(`Activity`);default:return``}}function ve(e){try{var t=``,n=null;do t+=_e(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
8
+ Error generating stack: `+e.message+`
9
+ `+e.stack}}var ye=Object.prototype.hasOwnProperty,be=t.unstable_scheduleCallback,xe=t.unstable_cancelCallback,Se=t.unstable_shouldYield,Ce=t.unstable_requestPaint,we=t.unstable_now,Te=t.unstable_getCurrentPriorityLevel,Ee=t.unstable_ImmediatePriority,De=t.unstable_UserBlockingPriority,Oe=t.unstable_NormalPriority,ke=t.unstable_LowPriority,Ae=t.unstable_IdlePriority,Me=t.log,Pe=t.unstable_setDisableYieldValue,Ie=null,Le=null;function Re(e){if(typeof Me==`function`&&Pe(e),Le&&typeof Le.setStrictMode==`function`)try{Le.setStrictMode(Ie,e)}catch{}}var ze=Math.clz32?Math.clz32:He,Be=Math.log,Ve=Math.LN2;function He(e){return e>>>=0,e===0?32:31-(Be(e)/Ve|0)|0}var Ue=256,We=262144,Ge=4194304;function Ke(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&261888;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 qe(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=Ke(n))):i=Ke(o):i=Ke(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=Ke(n))):i=Ke(o)):i=Ke(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 Je(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Ye(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 Xe(){var e=Ge;return Ge<<=1,!(Ge&62914560)&&(Ge=4194304),e}function Ze(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Qe(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function $e(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-ze(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&&et(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function et(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-ze(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function tt(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-ze(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function nt(e,t){var n=t&-t;return n=n&42?1:rt(n),(n&(e.suspendedLanes|t))===0?n:0}function rt(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 it(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function at(){var e=P.p;return e===0?(e=window.event,e===void 0?32:Ep(e.type)):e}function ot(e,t){var n=P.p;try{return P.p=e,t()}finally{P.p=n}}var st=Math.random().toString(36).slice(2),ct=`__reactFiber$`+st,lt=`__reactProps$`+st,ut=`__reactContainer$`+st,dt=`__reactEvents$`+st,ft=`__reactListeners$`+st,pt=`__reactHandles$`+st,mt=`__reactResources$`+st,ht=`__reactMarker$`+st;function gt(e){delete e[ct],delete e[lt],delete e[dt],delete e[ft],delete e[pt]}function _t(e){var t=e[ct];if(t)return t;for(var n=e.parentNode;n;){if(t=n[ut]||n[ct]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Cf(e);e!==null;){if(n=e[ct])return n;e=Cf(e)}return t}e=n,n=e.parentNode}return null}function vt(e){if(e=e[ct]||e[ut]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function yt(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(i(33))}function bt(e){var t=e[mt];return t||=e[mt]={hoistableStyles:new Map,hoistableScripts:new Map},t}function xt(e){e[ht]=!0}var St=new Set,Ct={};function wt(e,t){Tt(e,t),Tt(e+`Capture`,t)}function Tt(e,t){for(Ct[e]=t,e=0;e<t.length;e++)St.add(t[e])}var Et=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]*$`),Dt={},Ot={};function kt(e){return ye.call(Ot,e)?!0:ye.call(Dt,e)?!1:Et.test(e)?Ot[e]=!0:(Dt[e]=!0,!1)}function At(e,t,n){if(kt(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 jt(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 Mt(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 Nt(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function Pt(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function Ft(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 It(e){if(!e._valueTracker){var t=Pt(e)?`checked`:`value`;e._valueTracker=Ft(e,t,``+e[t])}}function Lt(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=Pt(e)?e.checked?`true`:`false`:e.value),e=r,e===n?!1:(t.setValue(e),!0)}function Rt(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}var zt=/[\n"\\]/g;function Bt(e){return e.replace(zt,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function Vt(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=``+Nt(t)):e.value!==``+Nt(t)&&(e.value=``+Nt(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):Ut(e,o,Nt(n)):Ut(e,o,Nt(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=``+Nt(s):e.removeAttribute(`name`)}function Ht(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)){It(e);return}n=n==null?``:``+Nt(n),t=t==null?n:``+Nt(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),It(e)}function Ut(e,t,n){t===`number`&&Rt(e.ownerDocument)===e||e.defaultValue===``+n||(e.defaultValue=``+n)}function Wt(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=``+Nt(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 Gt(e,t,n){if(t!=null&&(t=``+Nt(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n==null?``:``+Nt(n)}function Kt(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(i(92));if(M(r)){if(1<r.length)throw Error(i(93));r=r[0]}n=r}n??=``,t=n}n=Nt(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),It(e)}function qt(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Jt=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 L(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||Jt.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function R(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]=``);for(var a in t)r=t[a],t.hasOwnProperty(a)&&n[a]!==r&&L(e,a,r)}else for(var o in t)t.hasOwnProperty(o)&&L(e,o,t[o])}function Yt(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 Xt=new Map([[`acceptCharset`,`accept-charset`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`],[`crossOrigin`,`crossorigin`],[`accentHeight`,`accent-height`],[`alignmentBaseline`,`alignment-baseline`],[`arabicForm`,`arabic-form`],[`baselineShift`,`baseline-shift`],[`capHeight`,`cap-height`],[`clipPath`,`clip-path`],[`clipRule`,`clip-rule`],[`colorInterpolation`,`color-interpolation`],[`colorInterpolationFilters`,`color-interpolation-filters`],[`colorProfile`,`color-profile`],[`colorRendering`,`color-rendering`],[`dominantBaseline`,`dominant-baseline`],[`enableBackground`,`enable-background`],[`fillOpacity`,`fill-opacity`],[`fillRule`,`fill-rule`],[`floodColor`,`flood-color`],[`floodOpacity`,`flood-opacity`],[`fontFamily`,`font-family`],[`fontSize`,`font-size`],[`fontSizeAdjust`,`font-size-adjust`],[`fontStretch`,`font-stretch`],[`fontStyle`,`font-style`],[`fontVariant`,`font-variant`],[`fontWeight`,`font-weight`],[`glyphName`,`glyph-name`],[`glyphOrientationHorizontal`,`glyph-orientation-horizontal`],[`glyphOrientationVertical`,`glyph-orientation-vertical`],[`horizAdvX`,`horiz-adv-x`],[`horizOriginX`,`horiz-origin-x`],[`imageRendering`,`image-rendering`],[`letterSpacing`,`letter-spacing`],[`lightingColor`,`lighting-color`],[`markerEnd`,`marker-end`],[`markerMid`,`marker-mid`],[`markerStart`,`marker-start`],[`overlinePosition`,`overline-position`],[`overlineThickness`,`overline-thickness`],[`paintOrder`,`paint-order`],[`panose-1`,`panose-1`],[`pointerEvents`,`pointer-events`],[`renderingIntent`,`rendering-intent`],[`shapeRendering`,`shape-rendering`],[`stopColor`,`stop-color`],[`stopOpacity`,`stop-opacity`],[`strikethroughPosition`,`strikethrough-position`],[`strikethroughThickness`,`strikethrough-thickness`],[`strokeDasharray`,`stroke-dasharray`],[`strokeDashoffset`,`stroke-dashoffset`],[`strokeLinecap`,`stroke-linecap`],[`strokeLinejoin`,`stroke-linejoin`],[`strokeMiterlimit`,`stroke-miterlimit`],[`strokeOpacity`,`stroke-opacity`],[`strokeWidth`,`stroke-width`],[`textAnchor`,`text-anchor`],[`textDecoration`,`text-decoration`],[`textRendering`,`text-rendering`],[`transformOrigin`,`transform-origin`],[`underlinePosition`,`underline-position`],[`underlineThickness`,`underline-thickness`],[`unicodeBidi`,`unicode-bidi`],[`unicodeRange`,`unicode-range`],[`unitsPerEm`,`units-per-em`],[`vAlphabetic`,`v-alphabetic`],[`vHanging`,`v-hanging`],[`vIdeographic`,`v-ideographic`],[`vMathematical`,`v-mathematical`],[`vectorEffect`,`vector-effect`],[`vertAdvY`,`vert-adv-y`],[`vertOriginX`,`vert-origin-x`],[`vertOriginY`,`vert-origin-y`],[`wordSpacing`,`word-spacing`],[`writingMode`,`writing-mode`],[`xmlnsXlink`,`xmlns:xlink`],[`xHeight`,`x-height`]]),Zt=/^[\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 Qt(e){return Zt.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function $t(){}var en=null;function tn(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var nn=null,rn=null;function an(e){var t=vt(e);if(t&&(e=t.stateNode)){var n=e[lt]||null;a:switch(e=t.stateNode,t.type){case`input`:if(Vt(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="`+Bt(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var a=r[lt]||null;if(!a)throw Error(i(90));Vt(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&&Lt(r)}break a;case`textarea`:Gt(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&Wt(e,!!n.multiple,t,!1)}}}var on=!1;function sn(e,t,n){if(on)return e(t,n);on=!0;try{return e(t)}finally{if(on=!1,(nn!==null||rn!==null)&&(ku(),nn&&(t=nn,e=rn,rn=nn=null,an(t),e)))for(t=0;t<e.length;t++)an(e[t])}}function cn(e,t){var n=e.stateNode;if(n===null)return null;var r=n[lt]||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 ln=!(typeof window>`u`||window.document===void 0||window.document.createElement===void 0),un=!1;if(ln)try{var dn={};Object.defineProperty(dn,`passive`,{get:function(){un=!0}}),window.addEventListener(`test`,dn,dn),window.removeEventListener(`test`,dn,dn)}catch{un=!1}var fn=null,pn=null,mn=null;function hn(){if(mn)return mn;var e,t=pn,n=t.length,r,i=`value`in fn?fn.value:fn.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 mn=i.slice(e,1<r?1-r:void 0)}function gn(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 _n(){return!0}function vn(){return!1}function yn(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)?_n:vn,this.isPropagationStopped=vn,this}return f(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=_n)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=_n)},persist:function(){},isPersistent:_n}),t}var bn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},xn=yn(bn),Sn=f({},bn,{view:0,detail:0}),Cn=yn(Sn),wn,Tn,En,Dn=f({},Sn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Rn,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!==En&&(En&&e.type===`mousemove`?(wn=e.screenX-En.screenX,Tn=e.screenY-En.screenY):Tn=wn=0,En=e),wn)},movementY:function(e){return`movementY`in e?e.movementY:Tn}}),On=yn(Dn),kn=yn(f({},Dn,{dataTransfer:0})),An=yn(f({},Sn,{relatedTarget:0})),jn=yn(f({},bn,{animationName:0,elapsedTime:0,pseudoElement:0})),Mn=yn(f({},bn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),Nn=yn(f({},bn,{data:0})),Pn={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},Fn={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`},In={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function Ln(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=In[e])?!!t[e]:!1}function Rn(){return Ln}var zn=yn(f({},Sn,{key:function(e){if(e.key){var t=Pn[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=gn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?Fn[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Rn,charCode:function(e){return e.type===`keypress`?gn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?gn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),Bn=yn(f({},Dn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Vn=yn(f({},Sn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Rn})),Hn=yn(f({},bn,{propertyName:0,elapsedTime:0,pseudoElement:0})),Un=yn(f({},Dn,{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})),Wn=yn(f({},bn,{newState:0,oldState:0})),Gn=[9,13,27,32],Kn=ln&&`CompositionEvent`in window,qn=null;ln&&`documentMode`in document&&(qn=document.documentMode);var Jn=ln&&`TextEvent`in window&&!qn,Yn=ln&&(!Kn||qn&&8<qn&&11>=qn),Xn=` `,Zn=!1;function Qn(e,t){switch(e){case`keyup`:return Gn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function $n(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var er=!1;function tr(e,t){switch(e){case`compositionend`:return $n(t);case`keypress`:return t.which===32?(Zn=!0,Xn):null;case`textInput`:return e=t.data,e===Xn&&Zn?null:e;default:return null}}function nr(e,t){if(er)return e===`compositionend`||!Kn&&Qn(e,t)?(e=hn(),mn=pn=fn=null,er=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case`compositionend`:return Yn&&t.locale!==`ko`?null:t.data;default:return null}}var rr={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 ir(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!rr[e.type]:t===`textarea`}function ar(e,t,n,r){nn?rn?rn.push(r):rn=[r]:nn=r,t=Ld(t,`onChange`),0<t.length&&(n=new xn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var or=null,sr=null;function cr(e){kd(e,0)}function lr(e){if(Lt(yt(e)))return e}function ur(e,t){if(e===`change`)return t}var dr=!1;if(ln){var fr;if(ln){var pr=`oninput`in document;if(!pr){var mr=document.createElement(`div`);mr.setAttribute(`oninput`,`return;`),pr=typeof mr.oninput==`function`}fr=pr}else fr=!1;dr=fr&&(!document.documentMode||9<document.documentMode)}function hr(){or&&(or.detachEvent(`onpropertychange`,gr),sr=or=null)}function gr(e){if(e.propertyName===`value`&&lr(sr)){var t=[];ar(t,sr,e,tn(e)),sn(cr,t)}}function _r(e,t,n){e===`focusin`?(hr(),or=t,sr=n,or.attachEvent(`onpropertychange`,gr)):e===`focusout`&&hr()}function vr(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return lr(sr)}function yr(e,t){if(e===`click`)return lr(t)}function br(e,t){if(e===`input`||e===`change`)return lr(t)}function xr(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var Sr=typeof Object.is==`function`?Object.is:xr;function Cr(e,t){if(Sr(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(!ye.call(t,i)||!Sr(e[i],t[i]))return!1}return!0}function wr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Tr(e,t){var n=wr(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=wr(n)}}function Er(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Er(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Dr(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Rt(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=Rt(e.document)}return t}function Or(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 kr=ln&&`documentMode`in document&&11>=document.documentMode,Ar=null,jr=null,Mr=null,Nr=!1;function Pr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Nr||Ar==null||Ar!==Rt(r)||(r=Ar,`selectionStart`in r&&Or(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}),Mr&&Cr(Mr,r)||(Mr=r,r=Ld(jr,`onSelect`),0<r.length&&(t=new xn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=Ar)))}function Fr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var Ir={animationend:Fr(`Animation`,`AnimationEnd`),animationiteration:Fr(`Animation`,`AnimationIteration`),animationstart:Fr(`Animation`,`AnimationStart`),transitionrun:Fr(`Transition`,`TransitionRun`),transitionstart:Fr(`Transition`,`TransitionStart`),transitioncancel:Fr(`Transition`,`TransitionCancel`),transitionend:Fr(`Transition`,`TransitionEnd`)},Lr={},Rr={};ln&&(Rr=document.createElement(`div`).style,`AnimationEvent`in window||(delete Ir.animationend.animation,delete Ir.animationiteration.animation,delete Ir.animationstart.animation),`TransitionEvent`in window||delete Ir.transitionend.transition);function zr(e){if(Lr[e])return Lr[e];if(!Ir[e])return e;var t=Ir[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Rr)return Lr[e]=t[n];return e}var Br=zr(`animationend`),Vr=zr(`animationiteration`),Hr=zr(`animationstart`),Ur=zr(`transitionrun`),Wr=zr(`transitionstart`),Gr=zr(`transitioncancel`),Kr=zr(`transitionend`),qr=new Map,Jr=`abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error 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(` `);Jr.push(`scrollEnd`);function Yr(e,t){qr.set(e,t),wt(t,[e])}var Xr=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)},Zr=[],Qr=0,$r=0;function ei(){for(var e=Qr,t=$r=Qr=0;t<e;){var n=Zr[t];Zr[t++]=null;var r=Zr[t];Zr[t++]=null;var i=Zr[t];Zr[t++]=null;var a=Zr[t];if(Zr[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&&ii(n,i,a)}}function ti(e,t,n,r){Zr[Qr++]=e,Zr[Qr++]=t,Zr[Qr++]=n,Zr[Qr++]=r,$r|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function ni(e,t,n,r){return ti(e,t,n,r),ai(e)}function ri(e,t){return ti(e,null,null,t),ai(e)}function ii(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-ze(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function ai(e){if(50<bu)throw bu=0,xu=null,Error(i(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var oi={};function si(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 ci(e,t,n,r){return new si(e,t,n,r)}function li(e){return e=e.prototype,!(!e||!e.isReactComponent)}function ui(e,t){var n=e.alternate;return n===null?(n=ci(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&65011712,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 di(e,t){e.flags&=65011714;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 fi(e,t,n,r,a,o){var s=0;if(r=e,typeof e==`function`)li(e)&&(s=1);else if(typeof e==`string`)s=tp(e,n,ie.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(e){case E:return e=ci(31,n,t,a),e.elementType=E,e.lanes=o,e;case g:return pi(n.children,a,o,t);case _:s=8,a|=24;break;case v:return e=ci(12,n,t,a|2),e.elementType=v,e.lanes=o,e;case S:return e=ci(13,n,t,a),e.elementType=S,e.lanes=o,e;case C:return e=ci(19,n,t,a),e.elementType=C,e.lanes=o,e;default:if(typeof e==`object`&&e)switch(e.$$typeof){case b:s=10;break a;case y:s=9;break a;case x:s=11;break a;case w:s=14;break a;case T:s=16,r=null;break a}s=29,n=Error(i(130,e===null?`null`:typeof e,``)),r=null}return t=ci(s,n,t,a),t.elementType=e,t.type=r,t.lanes=o,t}function pi(e,t,n,r){return e=ci(7,e,r,t),e.lanes=n,e}function mi(e,t,n){return e=ci(6,e,null,t),e.lanes=n,e}function hi(e){var t=ci(18,null,null,0);return t.stateNode=e,t}function gi(e,t,n){return t=ci(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var _i=new WeakMap;function vi(e,t){if(typeof e==`object`&&e){var n=_i.get(e);return n===void 0?(t={value:e,source:t,stack:ve(t)},_i.set(e,t),t):n}return{value:e,source:t,stack:ve(t)}}var yi=[],bi=0,xi=null,Si=0,Ci=[],wi=0,Ti=null,Ei=1,Di=``;function Oi(e,t){yi[bi++]=Si,yi[bi++]=xi,xi=e,Si=t}function ki(e,t,n){Ci[wi++]=Ei,Ci[wi++]=Di,Ci[wi++]=Ti,Ti=e;var r=Ei;e=Di;var i=32-ze(r)-1;r&=~(1<<i),n+=1;var a=32-ze(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,Ei=1<<32-ze(t)+i|n<<i|r,Di=a+e}else Ei=1<<a|n<<i|r,Di=e}function Ai(e){e.return!==null&&(Oi(e,1),ki(e,1,0))}function ji(e){for(;e===xi;)xi=yi[--bi],yi[bi]=null,Si=yi[--bi],yi[bi]=null;for(;e===Ti;)Ti=Ci[--wi],Ci[wi]=null,Di=Ci[--wi],Ci[wi]=null,Ei=Ci[--wi],Ci[wi]=null}function Mi(e,t){Ci[wi++]=Ei,Ci[wi++]=Di,Ci[wi++]=Ti,Ei=t.id,Di=t.overflow,Ti=e}var Ni=null,Pi=null,Fi=!1,Ii=null,Li=!1,Ri=Error(i(519));function zi(e){throw Gi(vi(Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),Ri}function Bi(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[ct]=e,t[lt]=r,n){case`dialog`:Ad(`cancel`,t),Ad(`close`,t);break;case`iframe`:case`object`:case`embed`:Ad(`load`,t);break;case`video`:case`audio`:for(n=0;n<Dd.length;n++)Ad(Dd[n],t);break;case`source`:Ad(`error`,t);break;case`img`:case`image`:case`link`:Ad(`error`,t),Ad(`load`,t);break;case`details`:Ad(`toggle`,t);break;case`input`:Ad(`invalid`,t),Ht(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:Ad(`invalid`,t);break;case`textarea`:Ad(`invalid`,t),Kt(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||Ud(t.textContent,n)?(r.popover!=null&&(Ad(`beforetoggle`,t),Ad(`toggle`,t)),r.onScroll!=null&&Ad(`scroll`,t),r.onScrollEnd!=null&&Ad(`scrollend`,t),r.onClick!=null&&(t.onclick=$t),t=!0):t=!1,t||zi(e,!0)}function Vi(e){for(Ni=e.return;Ni;)switch(Ni.tag){case 5:case 31:case 13:Li=!1;return;case 27:case 3:Li=!0;return;default:Ni=Ni.return}}function Hi(e){if(e!==Ni)return!1;if(!Fi)return Vi(e),Fi=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!==`form`&&n!==`button`)||tf(e.type,e.memoizedProps)),n=!n),n&&Pi&&zi(e),Vi(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Pi=Sf(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Pi=Sf(e)}else t===27?(t=Pi,uf(e.type)?(e=xf,xf=null,Pi=e):Pi=t):Pi=Ni?bf(e.stateNode.nextSibling):null;return!0}function Ui(){Pi=Ni=null,Fi=!1}function Wi(){var e=Ii;return e!==null&&(ou===null?ou=e:ou.push.apply(ou,e),Ii=null),e}function Gi(e){Ii===null?Ii=[e]:Ii.push(e)}var Ki=F(null),qi=null,Ji=null;function Yi(e,t,n){I(Ki,t._currentValue),t._currentValue=n}function Xi(e){e._currentValue=Ki.current,re(Ki)}function Zi(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 Qi(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),Zi(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),Zi(s,n,e),s=null}else 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 $i(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;Sr(a.pendingProps.value,s.value)||(e===null?e=[c]:e.push(c))}}else if(a===se.current){if(s=a.alternate,s===null)throw Error(i(387));s.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(e===null?e=[up]:e.push(up))}a=a.return}e!==null&&Qi(t,e,n,r),t.flags|=262144}function ea(e){for(e=e.firstContext;e!==null;){if(!Sr(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function ta(e){qi=e,Ji=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function na(e){return ia(qi,e)}function ra(e,t){return qi===null&&ta(e),ia(e,t)}function ia(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Ji===null){if(e===null)throw Error(i(308));Ji=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Ji=Ji.next=t;return n}var aa=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()})}},oa=t.unstable_scheduleCallback,sa=t.unstable_NormalPriority,ca={$$typeof:b,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function la(){return{controller:new aa,data:new Map,refCount:0}}function ua(e){e.refCount--,e.refCount===0&&oa(sa,function(){e.controller.abort()})}var da=null,fa=0,pa=0,ma=null;function ha(e,t){if(da===null){var n=da=[];fa=0,pa=xd(),ma={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return fa++,t.then(ga,ga),t}function ga(){if(--fa===0&&da!==null){ma!==null&&(ma.status=`fulfilled`);var e=da;da=null,pa=0,ma=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function _a(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 va=N.S;N.S=function(e,t){lu=we(),typeof t==`object`&&t&&typeof t.then==`function`&&ha(e,t),va!==null&&va(e,t)};var ya=F(null);function ba(){var e=ya.current;return e===null?Gl.pooledCache:e}function xa(e,t){t===null?I(ya,ya.current):I(ya,t.pool)}function Sa(){var e=ba();return e===null?null:{parent:ca._currentValue,pool:e}}var Ca=Error(i(460)),wa=Error(i(474)),Ta=Error(i(542)),Ea={then:function(){}};function Da(e){return e=e.status,e===`fulfilled`||e===`rejected`}function Oa(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then($t,$t),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,Ma(e),e;default:if(typeof t.status==`string`)t.then($t,$t);else{if(e=Gl,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,Ma(e),e}throw Aa=t,Ca}}function ka(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(Aa=e,Ca):e}}var Aa=null;function ja(){if(Aa===null)throw Error(i(459));var e=Aa;return Aa=null,e}function Ma(e){if(e===Ca||e===Ta)throw Error(i(483))}var Na=null,Pa=0;function Fa(e){var t=Pa;return Pa+=1,Na===null&&(Na=[]),Oa(Na,e,t)}function Ia(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function La(e,t){throw t.$$typeof===p?Error(i(525)):(e=Object.prototype.toString.call(t),Error(i(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e)))}function Ra(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=ui(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|=67108866,n):(r=r.index,r<n?(t.flags|=67108866,n):r)):(t.flags|=1048576,n)}function s(t){return e&&t.alternate===null&&(t.flags|=67108866),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=mi(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===g?d(e,t,n.props.children,r,n.key):t!==null&&(t.elementType===i||typeof i==`object`&&i&&i.$$typeof===T&&ka(i)===t.type)?(t=a(t,n.props),Ia(t,n),t.return=e,t):(t=fi(n.type,n.key,n.props,null,e.mode,r),Ia(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=gi(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=pi(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=mi(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case m:return n=fi(t.type,t.key,t.props,null,e.mode,n),Ia(n,t),n.return=e,n;case h:return t=gi(t,e.mode,n),t.return=e,t;case T:return t=ka(t),f(e,t,n)}if(M(t)||k(t))return t=pi(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,Fa(t),n);if(t.$$typeof===b)return f(e,ra(e,t),n);La(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 m:return n.key===i?l(e,t,n,r):null;case h:return n.key===i?u(e,t,n,r):null;case T:return n=ka(n),p(e,t,n,r)}if(M(n)||k(n))return i===null?d(e,t,n,r,null):null;if(typeof n.then==`function`)return p(e,t,Fa(n),r);if(n.$$typeof===b)return p(e,t,ra(e,n),r);La(e,n)}return null}function _(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 m:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case h:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case T:return r=ka(r),_(e,t,n,r,i)}if(M(r)||k(r))return e=e.get(n)||null,d(t,e,r,i,null);if(typeof r.then==`function`)return _(e,t,n,Fa(r),i);if(r.$$typeof===b)return _(e,t,n,ra(t,r),i);La(t,r)}return null}function v(i,a,s,c){for(var l=null,u=null,d=a,m=a=0,h=null;d!==null&&m<s.length;m++){d.index>m?(h=d,d=null):h=d.sibling;var g=p(i,d,s[m],c);if(g===null){d===null&&(d=h);break}e&&d&&g.alternate===null&&t(i,d),a=o(g,a,m),u===null?l=g:u.sibling=g,u=g,d=h}if(m===s.length)return n(i,d),Fi&&Oi(i,m),l;if(d===null){for(;m<s.length;m++)d=f(i,s[m],c),d!==null&&(a=o(d,a,m),u===null?l=d:u.sibling=d,u=d);return Fi&&Oi(i,m),l}for(d=r(d);m<s.length;m++)h=_(d,i,m,s[m],c),h!==null&&(e&&h.alternate!==null&&d.delete(h.key===null?m:h.key),a=o(h,a,m),u===null?l=h:u.sibling=h,u=h);return e&&d.forEach(function(e){return t(i,e)}),Fi&&Oi(i,m),l}function y(a,s,c,l){if(c==null)throw Error(i(151));for(var u=null,d=null,m=s,h=s=0,g=null,v=c.next();m!==null&&!v.done;h++,v=c.next()){m.index>h?(g=m,m=null):g=m.sibling;var y=p(a,m,v.value,l);if(y===null){m===null&&(m=g);break}e&&m&&y.alternate===null&&t(a,m),s=o(y,s,h),d===null?u=y:d.sibling=y,d=y,m=g}if(v.done)return n(a,m),Fi&&Oi(a,h),u;if(m===null){for(;!v.done;h++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,h),d===null?u=v:d.sibling=v,d=v);return Fi&&Oi(a,h),u}for(m=r(m);!v.done;h++,v=c.next())v=_(m,a,h,v.value,l),v!==null&&(e&&v.alternate!==null&&m.delete(v.key===null?h:v.key),s=o(v,s,h),d===null?u=v:d.sibling=v,d=v);return e&&m.forEach(function(e){return t(a,e)}),Fi&&Oi(a,h),u}function x(e,r,o,c){if(typeof o==`object`&&o&&o.type===g&&o.key===null&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case m:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===g){if(r.tag===7){n(e,r.sibling),c=a(r,o.props.children),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===T&&ka(l)===r.type){n(e,r.sibling),c=a(r,o.props),Ia(c,o),c.return=e,e=c;break a}n(e,r);break}else t(e,r);r=r.sibling}o.type===g?(c=pi(o.props.children,e.mode,c,o.key),c.return=e,e=c):(c=fi(o.type,o.key,o.props,null,e.mode,c),Ia(c,o),c.return=e,e=c)}return s(e);case h: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}else{n(e,r);break}else t(e,r);r=r.sibling}c=gi(o,e.mode,c),c.return=e,e=c}return s(e);case T:return o=ka(o),x(e,r,o,c)}if(M(o))return v(e,r,o,c);if(k(o)){if(l=k(o),typeof l!=`function`)throw Error(i(150));return o=l.call(o),y(e,r,o,c)}if(typeof o.then==`function`)return x(e,r,Fa(o),c);if(o.$$typeof===b)return x(e,r,ra(e,o),c);La(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=mi(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{Pa=0;var i=x(e,t,n,r);return Na=null,i}catch(t){if(t===Ca||t===Ta)throw t;var a=ci(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var za=Ra(!0),Ba=Ra(!1),Va=!1;function Ha(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Ua(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 Wa(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Ga(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Wl&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=ai(e),ii(e,null,n),t}return ti(e,r,t,n),ai(e)}function Ka(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,tt(e,n)}}function qa(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;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Ja=!1;function Ya(){if(Ja){var e=ma;if(e!==null)throw e}}function Xa(e,t,n,r){Ja=!1;var i=e.updateQueue;Va=!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 p=s.lane&-536870913,m=p!==s.lane;if(m?(ql&p)===p:(r&p)===p){p!==0&&p===pa&&(Ja=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var h=e,g=s;p=t;var _=n;switch(g.tag){case 1:if(h=g.payload,typeof h==`function`){d=h.call(_,d,p);break a}d=h;break a;case 3:h.flags=h.flags&-65537|128;case 0:if(h=g.payload,p=typeof h==`function`?h.call(_,d,p):h,p==null)break a;d=f({},d,p);break a;case 2:Va=!0}}p=s.callback,p!==null&&(e.flags|=64,m&&(e.flags|=8192),m=i.callbacks,m===null?i.callbacks=[p]:m.push(p))}else m={lane:p,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=m,c=d):u=u.next=m,o|=p;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;m=s,s=m.next,m.next=null,i.lastBaseUpdate=m,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),eu|=o,e.lanes=o,e.memoizedState=d}}function Za(e,t){if(typeof e!=`function`)throw Error(i(191,e));e.call(t)}function Qa(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)Za(n[e],t)}var $a=F(null),eo=F(0);function to(e,t){e=Ql,I(eo,e),I($a,t),Ql=e|t.baseLanes}function no(){I(eo,Ql),I($a,$a.current)}function ro(){Ql=eo.current,re($a),re(eo)}var io=F(null),ao=null;function oo(e){var t=e.alternate;I(fo,fo.current&1),I(io,e),ao===null&&(t===null||$a.current!==null||t.memoizedState!==null)&&(ao=e)}function so(e){I(fo,fo.current),I(io,e),ao===null&&(ao=e)}function co(e){e.tag===22?(I(fo,fo.current),I(io,e),ao===null&&(ao=e)):lo(e)}function lo(){I(fo,fo.current),I(io,io.current)}function uo(e){re(io),ao===e&&(ao=null),re(fo)}var fo=F(0);function po(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||_f(n)||vf(n)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder===`forwards`||t.memoizedProps.revealOrder===`backwards`||t.memoizedProps.revealOrder===`unstable_legacy-backwards`||t.memoizedProps.revealOrder===`together`)){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 mo=0,ho=null,go=null,_o=null,vo=!1,yo=!1,bo=!1,xo=0,So=0,Co=null,z=0;function wo(){throw Error(i(321))}function To(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Sr(e[n],t[n]))return!1;return!0}function Eo(e,t,n,r,i,a){return mo=a,ho=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,N.H=e===null||e.memoizedState===null?Us:Ws,bo=!1,a=n(r,i),bo=!1,yo&&(a=Oo(t,n,r,i)),Do(e),a}function Do(e){N.H=Hs;var t=go!==null&&go.next!==null;if(mo=0,_o=go=ho=null,vo=!1,So=0,Co=null,t)throw Error(i(300));e===null||oc||(e=e.dependencies,e!==null&&ea(e)&&(oc=!0))}function Oo(e,t,n,r){ho=e;var a=0;do{if(yo&&(Co=null),So=0,yo=!1,25<=a)throw Error(i(301));if(a+=1,_o=go=null,e.updateQueue!=null){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}N.H=Gs,o=t(n,r)}while(yo);return o}function ko(){var e=N.H,t=e.useState()[0];return t=typeof t.then==`function`?Io(t):t,e=e.useState()[0],(go===null?null:go.memoizedState)!==e&&(ho.flags|=1024),t}function Ao(){var e=xo!==0;return xo=0,e}function jo(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function Mo(e){if(vo){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}vo=!1}mo=0,_o=go=ho=null,yo=!1,So=xo=0,Co=null}function No(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return _o===null?ho.memoizedState=_o=e:_o=_o.next=e,_o}function Po(){if(go===null){var e=ho.alternate;e=e===null?null:e.memoizedState}else e=go.next;var t=_o===null?ho.memoizedState:_o.next;if(t!==null)_o=t,go=e;else{if(e===null)throw ho.alternate===null?Error(i(467)):Error(i(310));go=e,e={memoizedState:go.memoizedState,baseState:go.baseState,baseQueue:go.baseQueue,queue:go.queue,next:null},_o===null?ho.memoizedState=_o=e:_o=_o.next=e}return _o}function Fo(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Io(e){var t=So;return So+=1,Co===null&&(Co=[]),e=Oa(Co,e,t),t=ho,(_o===null?t.memoizedState:_o.next)===null&&(t=t.alternate,N.H=t===null||t.memoizedState===null?Us:Ws),e}function Lo(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return Io(e);if(e.$$typeof===b)return na(e)}throw Error(i(438,String(e)))}function Ro(e){var t=null,n=ho.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=ho.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=Fo(),ho.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]=D;return t.index++,n}function zo(e,t){return typeof t==`function`?t(e):t}function Bo(e){return Vo(Po(),go,e)}function Vo(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?(mo&f)===f:(ql&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===pa&&(d=!0);else if((mo&p)===p){u=u.next,p===pa&&(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,ho.lanes|=p,eu|=p;f=u.action,bo&&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,ho.lanes|=f,eu|=f;u=u.next}while(u!==null&&u!==t);if(l===null?s=o:l.next=c,!Sr(o,e.memoizedState)&&(oc=!0,d&&(n=ma,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 Ho(e){var t=Po(),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);Sr(o,t.memoizedState)||(oc=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function Uo(e,t,n){var r=ho,a=Po(),o=Fi;if(o){if(n===void 0)throw Error(i(407));n=n()}else n=t();var s=!Sr((go||a).memoizedState,n);if(s&&(a.memoizedState=n,oc=!0),a=a.queue,ms(Ko.bind(null,r,a,e),[e]),a.getSnapshot!==t||s||_o!==null&&_o.memoizedState.tag&1){if(r.flags|=2048,ls(9,{destroy:void 0},Go.bind(null,r,a,n,t),null),Gl===null)throw Error(i(349));o||mo&127||Wo(r,t,n)}return n}function Wo(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=ho.updateQueue,t===null?(t=Fo(),ho.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Go(e,t,n,r){t.value=n,t.getSnapshot=r,qo(t)&&Jo(e)}function Ko(e,t,n){return n(function(){qo(t)&&Jo(e)})}function qo(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Sr(e,n)}catch{return!0}}function Jo(e){var t=ri(e,2);t!==null&&wu(t,e,2)}function Yo(e){var t=No();if(typeof e==`function`){var n=e;if(e=n(),bo){Re(!0);try{n()}finally{Re(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:zo,lastRenderedState:e},t}function Xo(e,t,n,r){return e.baseState=n,Vo(e,go,typeof r==`function`?r:zo)}function Zo(e,t,n,r,a){if(zs(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)}};N.T===null?o.isTransition=!1:n(!0),r(o),n=t.pending,n===null?(o.next=t.pending=o,Qo(t,o)):(o.next=n.next,t.pending=n.next=o)}}function Qo(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var a=N.T,o={};N.T=o;try{var s=n(i,r),c=N.S;c!==null&&c(o,s),$o(e,t,s)}catch(n){ts(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),N.T=a}}else try{a=n(i,r),$o(e,t,a)}catch(n){ts(e,t,n)}}function $o(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){es(e,t,n)},function(n){return ts(e,t,n)}):es(e,t,n)}function es(e,t,n){t.status=`fulfilled`,t.value=n,ns(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Qo(e,n)))}function ts(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,ns(t),t=t.next;while(t!==r)}e.action=null}function ns(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function rs(e,t){return t}function is(e,t){if(Fi){var n=Gl.formState;if(n!==null){a:{var r=ho;if(Fi){if(Pi){b:{for(var i=Pi,a=Li;i.nodeType!==8;){if(!a){i=null;break b}if(i=bf(i.nextSibling),i===null){i=null;break b}}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){Pi=bf(i.nextSibling),r=i.data===`F!`;break a}}zi(r)}r=!1}r&&(t=n[0])}}return n=No(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:rs,lastRenderedState:t},n.queue=r,n=Is.bind(null,ho,r),r.dispatch=n,r=Yo(!1),a=Rs.bind(null,ho,!1,r.queue),r=No(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=Zo.bind(null,ho,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function as(e){return os(Po(),go,e)}function os(e,t,n){if(t=Vo(e,t,rs)[0],e=Bo(zo)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=Io(t)}catch(e){throw e===Ca?Ta:e}else r=t;t=Po();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(ho.flags|=2048,ls(9,{destroy:void 0},ss.bind(null,i,n),null)),[r,a,e]}function ss(e,t){e.action=t}function cs(e){var t=Po(),n=go;if(n!==null)return os(t,n,e);Po(),t=t.memoizedState,n=Po();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=ho.updateQueue,t===null&&(t=Fo(),ho.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 us(){return Po().memoizedState}function ds(e,t,n,r){var i=No();ho.flags|=e,i.memoizedState=ls(1|t,{destroy:void 0},n,r===void 0?null:r)}function fs(e,t,n,r){var i=Po();r=r===void 0?null:r;var a=i.memoizedState.inst;go!==null&&r!==null&&To(r,go.memoizedState.deps)?i.memoizedState=ls(t,a,n,r):(ho.flags|=e,i.memoizedState=ls(1|t,a,n,r))}function ps(e,t){ds(8390656,8,e,t)}function ms(e,t){fs(2048,8,e,t)}function hs(e){ho.flags|=4;var t=ho.updateQueue;if(t===null)t=Fo(),ho.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function gs(e){var t=Po().memoizedState;return hs({ref:t,nextImpl:e}),function(){if(Wl&2)throw Error(i(440));return t.impl.apply(void 0,arguments)}}function _s(e,t){return fs(4,2,e,t)}function vs(e,t){return fs(4,4,e,t)}function ys(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 bs(e,t,n){n=n==null?null:n.concat([e]),fs(4,4,ys.bind(null,t,e),n)}function xs(){}function Ss(e,t){var n=Po();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&To(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function Cs(e,t){var n=Po();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&To(t,r[1]))return r[0];if(r=e(),bo){Re(!0);try{e()}finally{Re(!1)}}return n.memoizedState=[r,t],r}function ws(e,t,n){return n===void 0||mo&1073741824&&!(ql&261930)?e.memoizedState=t:(e.memoizedState=n,e=Cu(),ho.lanes|=e,eu|=e,n)}function Ts(e,t,n,r){return Sr(n,t)?n:$a.current===null?!(mo&42)||mo&1073741824&&!(ql&261930)?(oc=!0,e.memoizedState=n):(e=Cu(),ho.lanes|=e,eu|=e,t):(e=ws(e,n,r),Sr(e,t)||(oc=!0),e)}function Es(e,t,n,r,i){var a=P.p;P.p=a!==0&&8>a?a:8;var o=N.T,s={};N.T=s,Rs(e,!1,t,n);try{var c=i(),l=N.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?Ls(e,t,_a(c,r),Su(e)):Ls(e,t,r,Su(e))}catch(n){Ls(e,t,{then:function(){},status:`rejected`,reason:n},Su())}finally{P.p=a,o!==null&&s.types!==null&&(o.types=s.types),N.T=o}}function Ds(){}function Os(e,t,n,r){if(e.tag!==5)throw Error(i(476));var a=ks(e).queue;Es(e,a,t,ee,n===null?Ds:function(){return As(e),n(r)})}function ks(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:ee,baseState:ee,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:zo,lastRenderedState:ee},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:zo,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function As(e){var t=ks(e);t.next===null&&(t=e.alternate.memoizedState),Ls(e,t.next.queue,{},Su())}function js(){return na(up)}function Ms(){return Po().memoizedState}function Ns(){return Po().memoizedState}function Ps(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=Su();e=Wa(n);var r=Ga(t,e,n);r!==null&&(wu(r,t,n),Ka(r,t,n)),t={cache:la()},e.payload=t;return}t=t.return}}function Fs(e,t,n){var r=Su();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},zs(e)?Bs(t,n):(n=ni(e,t,n,r),n!==null&&(wu(n,e,r),Vs(n,t,r)))}function Is(e,t,n){Ls(e,t,n,Su())}function Ls(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(zs(e))Bs(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,Sr(s,o))return ti(e,t,i,0),Gl===null&&ei(),!1}catch{}if(n=ni(e,t,i,r),n!==null)return wu(n,e,r),Vs(n,t,r),!0}return!1}function Rs(e,t,n,r){if(r={lane:2,revertLane:xd(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},zs(e)){if(t)throw Error(i(479))}else t=ni(e,n,r,2),t!==null&&wu(t,e,2)}function zs(e){var t=e.alternate;return e===ho||t!==null&&t===ho}function Bs(e,t){yo=vo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Vs(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,tt(e,n)}}var Hs={readContext:na,use:Lo,useCallback:wo,useContext:wo,useEffect:wo,useImperativeHandle:wo,useLayoutEffect:wo,useInsertionEffect:wo,useMemo:wo,useReducer:wo,useRef:wo,useState:wo,useDebugValue:wo,useDeferredValue:wo,useTransition:wo,useSyncExternalStore:wo,useId:wo,useHostTransitionStatus:wo,useFormState:wo,useActionState:wo,useOptimistic:wo,useMemoCache:wo,useCacheRefresh:wo};Hs.useEffectEvent=wo;var Us={readContext:na,use:Lo,useCallback:function(e,t){return No().memoizedState=[e,t===void 0?null:t],e},useContext:na,useEffect:ps,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),ds(4194308,4,ys.bind(null,t,e),n)},useLayoutEffect:function(e,t){return ds(4194308,4,e,t)},useInsertionEffect:function(e,t){ds(4,2,e,t)},useMemo:function(e,t){var n=No();t=t===void 0?null:t;var r=e();if(bo){Re(!0);try{e()}finally{Re(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=No();if(n!==void 0){var i=n(t);if(bo){Re(!0);try{n(t)}finally{Re(!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=Fs.bind(null,ho,e),[r.memoizedState,e]},useRef:function(e){var t=No();return e={current:e},t.memoizedState=e},useState:function(e){e=Yo(e);var t=e.queue,n=Is.bind(null,ho,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:xs,useDeferredValue:function(e,t){return ws(No(),e,t)},useTransition:function(){var e=Yo(!1);return e=Es.bind(null,ho,e.queue,!0,!1),No().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=ho,a=No();if(Fi){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),Gl===null)throw Error(i(349));ql&127||Wo(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,ps(Ko.bind(null,r,o,e),[e]),r.flags|=2048,ls(9,{destroy:void 0},Go.bind(null,r,o,n,t),null),n},useId:function(){var e=No(),t=Gl.identifierPrefix;if(Fi){var n=Di,r=Ei;n=(r&~(1<<32-ze(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=xo++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=z++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:js,useFormState:is,useActionState:is,useOptimistic:function(e){var t=No();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=Rs.bind(null,ho,!0,n),n.dispatch=t,[e,t]},useMemoCache:Ro,useCacheRefresh:function(){return No().memoizedState=Ps.bind(null,ho)},useEffectEvent:function(e){var t=No(),n={impl:e};return t.memoizedState=n,function(){if(Wl&2)throw Error(i(440));return n.impl.apply(void 0,arguments)}}},Ws={readContext:na,use:Lo,useCallback:Ss,useContext:na,useEffect:ms,useImperativeHandle:bs,useInsertionEffect:_s,useLayoutEffect:vs,useMemo:Cs,useReducer:Bo,useRef:us,useState:function(){return Bo(zo)},useDebugValue:xs,useDeferredValue:function(e,t){return Ts(Po(),go.memoizedState,e,t)},useTransition:function(){var e=Bo(zo)[0],t=Po().memoizedState;return[typeof e==`boolean`?e:Io(e),t]},useSyncExternalStore:Uo,useId:Ms,useHostTransitionStatus:js,useFormState:as,useActionState:as,useOptimistic:function(e,t){return Xo(Po(),go,e,t)},useMemoCache:Ro,useCacheRefresh:Ns};Ws.useEffectEvent=gs;var Gs={readContext:na,use:Lo,useCallback:Ss,useContext:na,useEffect:ms,useImperativeHandle:bs,useInsertionEffect:_s,useLayoutEffect:vs,useMemo:Cs,useReducer:Ho,useRef:us,useState:function(){return Ho(zo)},useDebugValue:xs,useDeferredValue:function(e,t){var n=Po();return go===null?ws(n,e,t):Ts(n,go.memoizedState,e,t)},useTransition:function(){var e=Ho(zo)[0],t=Po().memoizedState;return[typeof e==`boolean`?e:Io(e),t]},useSyncExternalStore:Uo,useId:Ms,useHostTransitionStatus:js,useFormState:cs,useActionState:cs,useOptimistic:function(e,t){var n=Po();return go===null?(n.baseState=e,[e,n.queue.dispatch]):Xo(n,go,e,t)},useMemoCache:Ro,useCacheRefresh:Ns};Gs.useEffectEvent=gs;function Ks(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:f({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var qs={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Su(),i=Wa(r);i.payload=t,n!=null&&(i.callback=n),t=Ga(e,i,r),t!==null&&(wu(t,e,r),Ka(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Su(),i=Wa(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=Ga(e,i,r),t!==null&&(wu(t,e,r),Ka(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Su(),r=Wa(n);r.tag=2,t!=null&&(r.callback=t),t=Ga(e,r,n),t!==null&&(wu(t,e,n),Ka(t,e,n))}};function Js(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?!Cr(n,r)||!Cr(i,a):!0}function Ys(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&&qs.enqueueReplaceState(t,t.state,null)}function Xs(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=f({},n)),e)n[i]===void 0&&(n[i]=e[i]);return n}function B(e){Xr(e)}function Zs(e){console.error(e)}function Qs(e){Xr(e)}function $s(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function ec(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 tc(e,t,n){return n=Wa(n),n.tag=3,n.payload={element:null},n.callback=function(){$s(e,t)},n}function nc(e){return e=Wa(e),e.tag=3,e}function rc(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(){ec(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){ec(t,n,r),typeof i!=`function`&&(fu===null?fu=new Set([this]):fu.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function ic(e,t,n,r,a){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&$i(t,n,a,!0),n=io.current,n!==null){switch(n.tag){case 31:case 13:return ao===null?Iu():n.alternate===null&&$l===0&&($l=3),n.flags&=-257,n.flags|=65536,n.lanes=a,r===Ea?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),td(e,r,a)),!1;case 22:return n.flags|=65536,r===Ea?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)),td(e,r,a)),!1}throw Error(i(435,n.tag))}return td(e,r,a),Iu(),!1}if(Fi)return t=io.current,t===null?(r!==Ri&&(t=Error(i(423),{cause:r}),Gi(vi(t,n))),e=e.current.alternate,e.flags|=65536,a&=-a,e.lanes|=a,r=vi(r,n),a=tc(e.stateNode,r,a),qa(e,a),$l!==4&&($l=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=a,r!==Ri&&(e=Error(i(422),{cause:r}),Gi(vi(e,n)))),!1;var o=Error(i(520),{cause:r});if(o=vi(o,n),au===null?au=[o]:au.push(o),$l!==4&&($l=2),t===null)return!0;r=vi(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=a&-a,n.lanes|=e,e=tc(n.stateNode,r,e),qa(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`&&(fu===null||!fu.has(o))))return n.flags|=65536,a&=-a,n.lanes|=a,a=nc(a),rc(a,e,n,r),qa(n,a),!1}n=n.return}while(n!==null);return!1}var ac=Error(i(461)),oc=!1;function sc(e,t,n,r){t.child=e===null?Ba(t,null,n,r):za(t,e.child,n,r)}function cc(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 ta(t),r=Eo(e,t,n,o,a,i),s=Ao(),e!==null&&!oc?(jo(e,t,i),Mc(e,t,i)):(Fi&&s&&Ai(t),t.flags|=1,sc(e,t,r,i),t.child)}function lc(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!li(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,uc(e,t,a,r,i)):(e=fi(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!Nc(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?Cr:n,n(o,r)&&e.ref===t.ref)return Mc(e,t,i)}return t.flags|=1,e=ui(a,r),e.ref=t.ref,e.return=t,t.child=e}function uc(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(Cr(a,r)&&e.ref===t.ref)if(oc=!1,t.pendingProps=r=a,Nc(e,i))e.flags&131072&&(oc=!0);else return t.lanes=e.lanes,Mc(e,t,i)}return vc(e,t,n,r,i)}function dc(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 pc(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&xa(t,a===null?null:a.cachePool),a===null?no():to(t,a),co(t);else return r=t.lanes=536870912,pc(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&xa(t,null),no(),lo(t)):(xa(t,a.cachePool),to(t,a),lo(t),t.memoizedState=null);return sc(e,t,i,n),t.child}function fc(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function pc(e,t,n,r,i){var a=ba();return a=a===null?null:{parent:ca._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&xa(t,null),no(),co(t),e!==null&&$i(e,t,r,!0),t.childLanes=i,null}function mc(e,t){return t=Dc({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function hc(e,t,n){return za(t,e.child,null,n),e=mc(t,t.pendingProps),e.flags|=2,uo(t),t.memoizedState=null,e}function gc(e,t,n){var r=t.pendingProps,a=(t.flags&128)!=0;if(t.flags&=-129,e===null){if(Fi){if(r.mode===`hidden`)return e=mc(t,r),t.lanes=536870912,fc(null,e);if(so(t),(e=Pi)?(e=gf(e,Li),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Ti===null?null:{id:Ei,overflow:Di},retryLane:536870912,hydrationErrors:null},n=hi(e),n.return=t,t.child=n,Ni=t,Pi=null)):e=null,e===null)throw zi(t);return t.lanes=536870912,null}return mc(t,r)}var o=e.memoizedState;if(o!==null){var s=o.dehydrated;if(so(t),a)if(t.flags&256)t.flags&=-257,t=hc(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(i(558));else if(oc||$i(e,t,n,!1),a=(n&e.childLanes)!==0,oc||a){if(r=Gl,r!==null&&(s=nt(r,n),s!==0&&s!==o.retryLane))throw o.retryLane=s,ri(e,s),wu(r,e,s),ac;Iu(),t=hc(e,t,n)}else e=o.treeContext,Pi=bf(s.nextSibling),Ni=t,Fi=!0,Ii=null,Li=!1,e!==null&&Mi(t,e),t=mc(t,r),t.flags|=4096;return t}return e=ui(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function _c(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 vc(e,t,n,r,i){return ta(t),n=Eo(e,t,n,r,void 0,i),r=Ao(),e!==null&&!oc?(jo(e,t,i),Mc(e,t,i)):(Fi&&r&&Ai(t),t.flags|=1,sc(e,t,n,i),t.child)}function yc(e,t,n,r,i,a){return ta(t),t.updateQueue=null,n=Oo(t,r,n,i),Do(e),r=Ao(),e!==null&&!oc?(jo(e,t,a),Mc(e,t,a)):(Fi&&r&&Ai(t),t.flags|=1,sc(e,t,n,a),t.child)}function bc(e,t,n,r,i){if(ta(t),t.stateNode===null){var a=oi,o=n.contextType;typeof o==`object`&&o&&(a=na(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=qs,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},Ha(t),o=n.contextType,a.context=typeof o==`object`&&o?na(o):oi,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(Ks(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&&qs.enqueueReplaceState(a,a.state,null),Xa(t,r,a,i),Ya(),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=Xs(n,s);a.props=c;var l=a.context,u=n.contextType;o=oi,typeof u==`object`&&u&&(o=na(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)&&Ys(t,a,r,o),Va=!1;var f=t.memoizedState;a.state=f,Xa(t,r,a,i),Ya(),l=t.memoizedState,s||f!==l||Va?(typeof d==`function`&&(Ks(t,n,d,r),l=t.memoizedState),(c=Va||Js(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,Ua(e,t),o=t.memoizedProps,u=Xs(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=oi,typeof l==`object`&&l&&(c=na(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)&&Ys(t,a,r,c),Va=!1,f=t.memoizedState,a.state=f,Xa(t,r,a,i),Ya();var p=t.memoizedState;o!==d||f!==p||Va||e!==null&&e.dependencies!==null&&ea(e.dependencies)?(typeof s==`function`&&(Ks(t,n,s,r),p=t.memoizedState),(u=Va||Js(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&ea(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,_c(e,t),r=(t.flags&128)!=0,a||r?(a=t.stateNode,n=r&&typeof n.getDerivedStateFromError!=`function`?null:a.render(),t.flags|=1,e!==null&&r?(t.child=za(t,e.child,null,i),t.child=za(t,null,n,i)):sc(e,t,n,i),t.memoizedState=a.state,e=t.child):e=Mc(e,t,i),e}function xc(e,t,n,r){return Ui(),t.flags|=256,sc(e,t,n,r),t.child}var Sc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Cc(e){return{baseLanes:e,cachePool:Sa()}}function wc(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=ru),e}function Tc(e,t,n){var r=t.pendingProps,a=!1,o=(t.flags&128)!=0,s;if((s=o)||(s=e!==null&&e.memoizedState===null?!1:(fo.current&2)!=0),s&&(a=!0,t.flags&=-129),s=(t.flags&32)!=0,t.flags&=-33,e===null){if(Fi){if(a?oo(t):lo(t),(e=Pi)?(e=gf(e,Li),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Ti===null?null:{id:Ei,overflow:Di},retryLane:536870912,hydrationErrors:null},n=hi(e),n.return=t,t.child=n,Ni=t,Pi=null)):e=null,e===null)throw zi(t);return vf(e)?t.lanes=32:t.lanes=536870912,null}var c=r.children;return r=r.fallback,a?(lo(t),a=t.mode,c=Dc({mode:`hidden`,children:c},a),r=pi(r,a,n,null),c.return=t,r.return=t,c.sibling=r,t.child=c,r=t.child,r.memoizedState=Cc(n),r.childLanes=wc(e,s,n),t.memoizedState=Sc,fc(null,r)):(oo(t),Ec(t,c))}var l=e.memoizedState;if(l!==null&&(c=l.dehydrated,c!==null)){if(o)t.flags&256?(oo(t),t.flags&=-257,t=Oc(e,t,n)):t.memoizedState===null?(lo(t),c=r.fallback,a=t.mode,r=Dc({mode:`visible`,children:r.children},a),c=pi(c,a,n,null),c.flags|=2,r.return=t,c.return=t,r.sibling=c,t.child=r,za(t,e.child,null,n),r=t.child,r.memoizedState=Cc(n),r.childLanes=wc(e,s,n),t.memoizedState=Sc,t=fc(null,r)):(lo(t),t.child=e.child,t.flags|=128,t=null);else if(oo(t),vf(c)){if(s=c.nextSibling&&c.nextSibling.dataset,s)var u=s.dgst;s=u,r=Error(i(419)),r.stack=``,r.digest=s,Gi({value:r,source:null,stack:null}),t=Oc(e,t,n)}else if(oc||$i(e,t,n,!1),s=(n&e.childLanes)!==0,oc||s){if(s=Gl,s!==null&&(r=nt(s,n),r!==0&&r!==l.retryLane))throw l.retryLane=r,ri(e,r),wu(s,e,r),ac;_f(c)||Iu(),t=Oc(e,t,n)}else _f(c)?(t.flags|=192,t.child=e.child,t=null):(e=l.treeContext,Pi=bf(c.nextSibling),Ni=t,Fi=!0,Ii=null,Li=!1,e!==null&&Mi(t,e),t=Ec(t,r.children),t.flags|=4096);return t}return a?(lo(t),c=r.fallback,a=t.mode,l=e.child,u=l.sibling,r=ui(l,{mode:`hidden`,children:r.children}),r.subtreeFlags=l.subtreeFlags&65011712,u===null?(c=pi(c,a,n,null),c.flags|=2):c=ui(u,c),c.return=t,r.return=t,r.sibling=c,t.child=r,fc(null,r),r=t.child,c=e.child.memoizedState,c===null?c=Cc(n):(a=c.cachePool,a===null?a=Sa():(l=ca._currentValue,a=a.parent===l?a:{parent:l,pool:l}),c={baseLanes:c.baseLanes|n,cachePool:a}),r.memoizedState=c,r.childLanes=wc(e,s,n),t.memoizedState=Sc,fc(e.child,r)):(oo(t),n=e.child,e=n.sibling,n=ui(n,{mode:`visible`,children:r.children}),n.return=t,n.sibling=null,e!==null&&(s=t.deletions,s===null?(t.deletions=[e],t.flags|=16):s.push(e)),t.child=n,t.memoizedState=null,n)}function Ec(e,t){return t=Dc({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function Dc(e,t){return e=ci(22,e,null,t),e.lanes=0,e}function Oc(e,t,n){return za(t,e.child,null,n),e=Ec(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function kc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Zi(e.return,t,n)}function Ac(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 jc(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=fo.current,s=(o&2)!=0;if(s?(o=o&1|2,t.flags|=128):o&=1,I(fo,o),sc(e,t,r,n),r=Fi?Si:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&kc(e,n,t);else if(e.tag===19)kc(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`forwards`:for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&po(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),Ac(t,!1,i,n,a,r);break;case`backwards`:case`unstable_legacy-backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&po(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}Ac(t,!0,n,null,a,r);break;case`together`:Ac(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function Mc(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),eu|=t.lanes,(n&t.childLanes)===0)if(e!==null){if($i(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=ui(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=ui(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Nc(e,t){return(e.lanes&t)===0?(e=e.dependencies,!!(e!==null&&ea(e))):!0}function Pc(e,t,n){switch(t.tag){case 3:ce(t,t.stateNode.containerInfo),Yi(t,ca,e.memoizedState.cache),Ui();break;case 27:case 5:ue(t);break;case 4:ce(t,t.stateNode.containerInfo);break;case 10:Yi(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,so(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(oo(t),e=Mc(e,t,n),e===null?null:e.sibling):Tc(e,t,n):(oo(t),t.flags|=128,null);oo(t);break;case 19:var i=(e.flags&128)!=0;if(r=(n&t.childLanes)!==0,r||=($i(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return jc(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),I(fo,fo.current),r)break;return null;case 22:return t.lanes=0,dc(e,t,n,t.pendingProps);case 24:Yi(t,ca,e.memoizedState.cache)}return Mc(e,t,n)}function Fc(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)oc=!0;else{if(!Nc(e,n)&&!(t.flags&128))return oc=!1,Pc(e,t,n);oc=!!(e.flags&131072)}else oc=!1,Fi&&t.flags&1048576&&ki(t,Si,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=ka(t.elementType),t.type=e,typeof e==`function`)li(e)?(r=Xs(e,r),t.tag=1,t=bc(null,t,e,r,n)):(t.tag=0,t=vc(null,t,e,r,n));else{if(e!=null){var a=e.$$typeof;if(a===x){t.tag=11,t=cc(null,t,e,r,n);break a}else if(a===w){t.tag=14,t=lc(null,t,e,r,n);break a}}throw t=j(e)||e,Error(i(306,t,``))}}return t;case 0:return vc(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,a=Xs(r,t.pendingProps),bc(e,t,r,a,n);case 3:a:{if(ce(t,t.stateNode.containerInfo),e===null)throw Error(i(387));r=t.pendingProps;var o=t.memoizedState;a=o.element,Ua(e,t),Xa(t,r,null,n);var s=t.memoizedState;if(r=s.cache,Yi(t,ca,r),r!==o.cache&&Qi(t,[ca],n,!0),Ya(),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}else if(r!==a){a=vi(Error(i(424)),t),Gi(a),t=xc(e,t,r,n);break a}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName===`HTML`?e.ownerDocument.body:e}for(Pi=bf(e.firstChild),Ni=t,Fi=!0,Ii=null,Li=!0,n=Ba(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Ui(),r===a){t=Mc(e,t,n);break a}sc(e,t,r,n)}t=t.child}return t;case 26:return _c(e,t),e===null?(n=Vf(t.type,null,t.pendingProps,null))?t.memoizedState=n:Fi||(n=t.type,e=t.pendingProps,r=Qd(oe.current).createElement(n),r[ct]=t,r[lt]=e,Kd(r,n,e),xt(r),t.stateNode=r):t.memoizedState=Vf(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return ue(t),e===null&&Fi&&(r=t.stateNode=wf(t.type,t.pendingProps,oe.current),Ni=t,Li=!0,a=Pi,uf(t.type)?(xf=a,Pi=bf(r.firstChild)):Pi=a),sc(e,t,t.pendingProps.children,n),_c(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Fi&&((a=r=Pi)&&(r=mf(r,t.type,t.pendingProps,Li),r===null?a=!1:(t.stateNode=r,Ni=t,Pi=bf(r.firstChild),Li=!1,a=!0)),a||zi(t)),ue(t),a=t.type,o=t.pendingProps,s=e===null?null:e.memoizedProps,r=o.children,tf(a,o)?r=null:s!==null&&tf(a,s)&&(t.flags|=32),t.memoizedState!==null&&(a=Eo(e,t,ko,null,null,n),up._currentValue=a),_c(e,t),sc(e,t,r,n),t.child;case 6:return e===null&&Fi&&((e=n=Pi)&&(n=hf(n,t.pendingProps,Li),n===null?e=!1:(t.stateNode=n,Ni=t,Pi=null,e=!0)),e||zi(t)),null;case 13:return Tc(e,t,n);case 4:return ce(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=za(t,null,r,n):sc(e,t,r,n),t.child;case 11:return cc(e,t,t.type,t.pendingProps,n);case 7:return sc(e,t,t.pendingProps,n),t.child;case 8:return sc(e,t,t.pendingProps.children,n),t.child;case 12:return sc(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,Yi(t,t.type,r.value),sc(e,t,r.children,n),t.child;case 9:return a=t.type._context,r=t.pendingProps.children,ta(t),a=na(a),r=r(a),t.flags|=1,sc(e,t,r,n),t.child;case 14:return lc(e,t,t.type,t.pendingProps,n);case 15:return uc(e,t,t.type,t.pendingProps,n);case 19:return jc(e,t,n);case 31:return gc(e,t,n);case 22:return dc(e,t,n,t.pendingProps);case 24:return ta(t),r=na(ca),e===null?(a=ba(),a===null&&(a=Gl,o=la(),a.pooledCache=o,o.refCount++,o!==null&&(a.pooledCacheLanes|=n),a=o),t.memoizedState={parent:r,cache:a},Ha(t),Yi(t,ca,a)):((e.lanes&n)!==0&&(Ua(e,t),Xa(t,null,null,n),Ya()),a=e.memoizedState,o=t.memoizedState,a.parent===r?(r=o.cache,Yi(t,ca,r),r!==a.cache&&Qi(t,[ca],n,!0)):(a={parent:r,cache:r},t.memoizedState=a,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=a),Yi(t,ca,r))),sc(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(i(156,t.tag))}function Ic(e){e.flags|=4}function Lc(e,t,n,r,i){if((t=(e.mode&32)!=0)&&(t=!1),t){if(e.flags|=16777216,(i&335544128)===i)if(e.stateNode.complete)e.flags|=8192;else if(Nu())e.flags|=8192;else throw Aa=Ea,wa}else e.flags&=-16777217}function Rc(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!np(t))if(Nu())e.flags|=8192;else throw Aa=Ea,wa}function zc(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:Xe(),e.lanes|=t,iu|=t)}function Bc(e,t){if(!Fi)switch(e.tailMode){case`hidden`:t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case`collapsed`:n=e.tail;for(var 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}}function Vc(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&65011712,r|=i.flags&65011712,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 Hc(e,t,n){var r=t.pendingProps;switch(ji(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Vc(t),null;case 1:return Vc(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),Xi(ca),le(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Hi(t)?Ic(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Wi())),Vc(t),null;case 26:var a=t.type,o=t.memoizedState;return e===null?(Ic(t),o===null?(Vc(t),Lc(t,a,null,r,n)):(Vc(t),Rc(t,o))):o?o===e.memoizedState?(Vc(t),t.flags&=-16777217):(Ic(t),Vc(t),Rc(t,o)):(e=e.memoizedProps,e!==r&&Ic(t),Vc(t),Lc(t,a,e,r,n)),null;case 27:if(de(t),n=oe.current,a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Ic(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return Vc(t),null}e=ie.current,Hi(t)?Bi(t,e):(e=wf(a,r,n),t.stateNode=e,Ic(t))}return Vc(t),null;case 5:if(de(t),a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Ic(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return Vc(t),null}if(o=ie.current,Hi(t))Bi(t,o);else{var s=Qd(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[ct]=t,o[lt]=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(Kd(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&&Ic(t)}}return Vc(t),Lc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Ic(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(i(166));if(e=oe.current,Hi(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=Ni,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[ct]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||Ud(e.nodeValue,n)),e||zi(t,!0)}else e=Qd(e).createTextNode(r),e[ct]=t,t.stateNode=e}return Vc(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=Hi(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[ct]=t}else Ui(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Vc(t),e=!1}else n=Wi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(uo(t),t):(uo(t),null);if(t.flags&128)throw Error(i(558))}return Vc(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=Hi(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[ct]=t}else Ui(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Vc(t),a=!1}else a=Wi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(uo(t),t):(uo(t),null)}return uo(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,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),zc(t,t.updateQueue),Vc(t),null);case 4:return le(),e===null&&Nd(t.stateNode.containerInfo),Vc(t),null;case 10:return Xi(t.type),Vc(t),null;case 19:if(re(fo),r=t.memoizedState,r===null)return Vc(t),null;if(a=(t.flags&128)!=0,o=r.rendering,o===null)if(a)Bc(r,!1);else{if($l!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=po(e),o!==null){for(t.flags|=128,Bc(r,!1),e=o.updateQueue,t.updateQueue=e,zc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)di(n,e),n=n.sibling;return I(fo,fo.current&1|2),Fi&&Oi(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&we()>uu&&(t.flags|=128,a=!0,Bc(r,!1),t.lanes=4194304)}else{if(!a)if(e=po(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,zc(t,e),Bc(r,!0),r.tail===null&&r.tailMode===`hidden`&&!o.alternate&&!Fi)return Vc(t),null}else 2*we()-r.renderingStartTime>uu&&n!==536870912&&(t.flags|=128,a=!0,Bc(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)}return r.tail===null?(Vc(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=we(),e.sibling=null,n=fo.current,I(fo,a?n&1|2:n&1),Fi&&Oi(t,r.treeForkCount),e);case 22:case 23:return uo(t),ro(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(Vc(t),t.subtreeFlags&6&&(t.flags|=8192)):Vc(t),n=t.updateQueue,n!==null&&zc(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&&re(ya),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Xi(ca),Vc(t),null;case 25:return null;case 30:return null}throw Error(i(156,t.tag))}function Uc(e,t){switch(ji(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Xi(ca),le(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return de(t),null;case 31:if(t.memoizedState!==null){if(uo(t),t.alternate===null)throw Error(i(340));Ui()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(uo(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));Ui()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return re(fo),null;case 4:return le(),null;case 10:return Xi(t.type),null;case 22:case 23:return uo(t),ro(),e!==null&&re(ya),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Xi(ca),null;case 25:return null;default:return null}}function Wc(e,t){switch(ji(t),t.tag){case 3:Xi(ca),le();break;case 26:case 27:case 5:de(t);break;case 4:le();break;case 31:t.memoizedState!==null&&uo(t);break;case 13:uo(t);break;case 19:re(fo);break;case 10:Xi(t.type);break;case 22:case 23:uo(t),ro(),e!==null&&re(ya);break;case 24:Xi(ca)}}function Gc(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){ed(t,t.return,e)}}function Kc(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){ed(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){ed(t,t.return,e)}}function qc(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Qa(t,n)}catch(t){ed(e,e.return,t)}}}function Jc(e,t,n){n.props=Xs(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){ed(e,t,n)}}function Yc(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:r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){ed(e,t,n)}}function Xc(e,t){var n=e.ref,r=e.refCleanup;if(n!==null)if(typeof r==`function`)try{r()}catch(n){ed(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){ed(e,t,n)}else n.current=null}function Zc(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){ed(e,e.return,t)}}function Qc(e,t,n){try{var r=e.stateNode;qd(r,e.type,n,t),r[lt]=t}catch(t){ed(e,e.return,t)}}function $c(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&uf(e.type)||e.tag===4}function el(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||$c(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&&uf(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 tl(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=$t));else if(r!==4&&(r===27&&uf(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(tl(e,t,n),e=e.sibling;e!==null;)tl(e,t,n),e=e.sibling}function nl(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(r===27&&uf(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(nl(e,t,n),e=e.sibling;e!==null;)nl(e,t,n),e=e.sibling}function rl(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);Kd(t,r,n),t[ct]=e,t[lt]=n}catch(t){ed(e,e.return,t)}}var il=!1,al=!1,ol=!1,sl=typeof WeakSet==`function`?WeakSet:Set,cl=null;function ll(e,t){if(e=e.containerInfo,Xd=yp,e=Dr(e),Or(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var a=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||a!==0&&f.nodeType!==3||(c=s+a),f!==o||r!==0&&f.nodeType!==3||(l=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===a&&(c=s),p===o&&++d===r&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(Zd={focusedElem:e,selectionRange:n},yp=!1,cl=t;cl!==null;)if(t=cl,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,cl=e;else for(;cl!==null;){switch(t=cl,o=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e===null?null:e.events,e!==null))for(n=0;n<e.length;n++)a=e[n],a.ref.impl=a.nextImpl;break;case 11:case 15:break;case 1:if(e&1024&&o!==null){e=void 0,n=t,a=o.memoizedProps,o=o.memoizedState,r=n.stateNode;try{var h=Xs(n.type,a);e=r.getSnapshotBeforeUpdate(h,o),r.__reactInternalSnapshotBeforeUpdate=e}catch(e){ed(n,n.return,e)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)pf(e);else if(n===1)switch(e.nodeName){case`HEAD`:case`HTML`:case`BODY`:pf(e);break;default:e.textContent=``}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if(e&1024)throw Error(i(163))}if(e=t.sibling,e!==null){e.return=t.return,cl=e;break}cl=t.return}}function ul(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:Tl(e,n),r&4&&Gc(5,n);break;case 1:if(Tl(e,n),r&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){ed(n,n.return,e)}else{var i=Xs(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){ed(n,n.return,e)}}r&64&&qc(n),r&512&&Yc(n,n.return);break;case 3:if(Tl(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{Qa(e,t)}catch(e){ed(n,n.return,e)}}break;case 27:t===null&&r&4&&rl(n);case 26:case 5:Tl(e,n),t===null&&r&4&&Zc(n),r&512&&Yc(n,n.return);break;case 12:Tl(e,n);break;case 31:Tl(e,n),r&4&&gl(e,n);break;case 13:Tl(e,n),r&4&&_l(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=id.bind(null,n),yf(e,n))));break;case 22:if(r=n.memoizedState!==null||il,!r){t=t!==null&&t.memoizedState!==null||al,i=il;var a=al;il=r,(al=t)&&!a?Dl(e,n,(n.subtreeFlags&8772)!=0):Tl(e,n),il=i,al=a}break;case 30:break;default:Tl(e,n)}}function dl(e){var t=e.alternate;t!==null&&(e.alternate=null,dl(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&gt(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 fl=null,pl=!1;function ml(e,t,n){for(n=n.child;n!==null;)hl(e,t,n),n=n.sibling}function hl(e,t,n){if(Le&&typeof Le.onCommitFiberUnmount==`function`)try{Le.onCommitFiberUnmount(Ie,n)}catch{}switch(n.tag){case 26:al||Xc(n,t),ml(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:al||Xc(n,t);var r=fl,i=pl;uf(n.type)&&(fl=n.stateNode,pl=!1),ml(e,t,n),Tf(n.stateNode),fl=r,pl=i;break;case 5:al||Xc(n,t);case 6:if(r=fl,i=pl,fl=null,ml(e,t,n),fl=r,pl=i,fl!==null)if(pl)try{(fl.nodeType===9?fl.body:fl.nodeName===`HTML`?fl.ownerDocument.body:fl).removeChild(n.stateNode)}catch(e){ed(n,t,e)}else try{fl.removeChild(n.stateNode)}catch(e){ed(n,t,e)}break;case 18:fl!==null&&(pl?(e=fl,df(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),Up(e)):df(fl,n.stateNode));break;case 4:r=fl,i=pl,fl=n.stateNode.containerInfo,pl=!0,ml(e,t,n),fl=r,pl=i;break;case 0:case 11:case 14:case 15:Kc(2,n,t),al||Kc(4,n,t),ml(e,t,n);break;case 1:al||(Xc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&Jc(n,t,r)),ml(e,t,n);break;case 21:ml(e,t,n);break;case 22:al=(r=al)||n.memoizedState!==null,ml(e,t,n),al=r;break;default:ml(e,t,n)}}function gl(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Up(e)}catch(e){ed(t,t.return,e)}}}function _l(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Up(e)}catch(e){ed(t,t.return,e)}}function vl(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new sl),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new sl),t;default:throw Error(i(435,e.tag))}}function yl(e,t){var n=vl(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=ad.bind(null,e,t);t.then(r,r)}})}function bl(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var a=n[r],o=e,s=t,c=s;a:for(;c!==null;){switch(c.tag){case 27:if(uf(c.type)){fl=c.stateNode,pl=!1;break a}break;case 5:fl=c.stateNode,pl=!1;break a;case 3:case 4:fl=c.stateNode.containerInfo,pl=!0;break a}c=c.return}if(fl===null)throw Error(i(160));hl(o,s,a),fl=null,pl=!1,o=a.alternate,o!==null&&(o.return=null),a.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Sl(t,e),t=t.sibling}var xl=null;function Sl(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:bl(t,e),Cl(e),r&4&&(Kc(3,e,e.return),Gc(3,e),Kc(5,e,e.return));break;case 1:bl(t,e),Cl(e),r&512&&(al||n===null||Xc(n,n.return)),r&64&&il&&(e=e.updateQueue,e!==null&&(r=e.callbacks,r!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?r:n.concat(r))));break;case 26:var a=xl;if(bl(t,e),Cl(e),r&512&&(al||n===null||Xc(n,n.return)),r&4){var o=n===null?null:n.memoizedState;if(r=e.memoizedState,n===null)if(r===null)if(e.stateNode===null){a:{r=e.type,n=e.memoizedProps,a=a.ownerDocument||a;b:switch(r){case`title`:o=a.getElementsByTagName(`title`)[0],(!o||o[ht]||o[ct]||o.namespaceURI===`http://www.w3.org/2000/svg`||o.hasAttribute(`itemprop`))&&(o=a.createElement(r),a.head.insertBefore(o,a.querySelector(`head > title`))),Kd(o,r,n),o[ct]=e,xt(o),r=o;break a;case`link`:var s=$f(`link`,`href`,a).get(r+(n.href||``));if(s){for(var c=0;c<s.length;c++)if(o=s[c],o.getAttribute(`href`)===(n.href==null||n.href===``?null:n.href)&&o.getAttribute(`rel`)===(n.rel==null?null:n.rel)&&o.getAttribute(`title`)===(n.title==null?null:n.title)&&o.getAttribute(`crossorigin`)===(n.crossOrigin==null?null:n.crossOrigin)){s.splice(c,1);break b}}o=a.createElement(r),Kd(o,r,n),a.head.appendChild(o);break;case`meta`:if(s=$f(`meta`,`content`,a).get(r+(n.content||``))){for(c=0;c<s.length;c++)if(o=s[c],o.getAttribute(`content`)===(n.content==null?null:``+n.content)&&o.getAttribute(`name`)===(n.name==null?null:n.name)&&o.getAttribute(`property`)===(n.property==null?null:n.property)&&o.getAttribute(`http-equiv`)===(n.httpEquiv==null?null:n.httpEquiv)&&o.getAttribute(`charset`)===(n.charSet==null?null:n.charSet)){s.splice(c,1);break b}}o=a.createElement(r),Kd(o,r,n),a.head.appendChild(o);break;default:throw Error(i(468,r))}o[ct]=e,xt(o),r=o}e.stateNode=r}else ep(a,e.type,e.stateNode);else e.stateNode=Jf(a,r,e.memoizedProps);else o===r?r===null&&e.stateNode!==null&&Qc(e,e.memoizedProps,n.memoizedProps):(o===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):o.count--,r===null?ep(a,e.type,e.stateNode):Jf(a,r,e.memoizedProps))}break;case 27:bl(t,e),Cl(e),r&512&&(al||n===null||Xc(n,n.return)),n!==null&&r&4&&Qc(e,e.memoizedProps,n.memoizedProps);break;case 5:if(bl(t,e),Cl(e),r&512&&(al||n===null||Xc(n,n.return)),e.flags&32){a=e.stateNode;try{qt(a,``)}catch(t){ed(e,e.return,t)}}r&4&&e.stateNode!=null&&(a=e.memoizedProps,Qc(e,a,n===null?a:n.memoizedProps)),r&1024&&(ol=!0);break;case 6:if(bl(t,e),Cl(e),r&4){if(e.stateNode===null)throw Error(i(162));r=e.memoizedProps,n=e.stateNode;try{n.nodeValue=r}catch(t){ed(e,e.return,t)}}break;case 3:if(Qf=null,a=xl,xl=Of(t.containerInfo),bl(t,e),xl=a,Cl(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Up(t.containerInfo)}catch(t){ed(e,e.return,t)}ol&&(ol=!1,wl(e));break;case 4:r=xl,xl=Of(e.stateNode.containerInfo),bl(t,e),Cl(e),xl=r;break;case 12:bl(t,e),Cl(e);break;case 31:bl(t,e),Cl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,yl(e,r)));break;case 13:bl(t,e),Cl(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(cu=we()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,yl(e,r)));break;case 22:a=e.memoizedState!==null;var l=n!==null&&n.memoizedState!==null,u=il,d=al;if(il=u||a,al=d||l,bl(t,e),al=d,il=u,Cl(e),r&8192)a:for(t=e.stateNode,t._visibility=a?t._visibility&-2:t._visibility|1,a&&(n===null||l||il||al||El(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){l=n=t;try{if(o=l.stateNode,a)s=o.style,typeof s.setProperty==`function`?s.setProperty(`display`,`none`,`important`):s.display=`none`;else{c=l.stateNode;var f=l.memoizedProps.style,p=f!=null&&f.hasOwnProperty(`display`)?f.display:null;c.style.display=p==null||typeof p==`boolean`?``:(``+p).trim()}}catch(e){ed(l,l.return,e)}}}else if(t.tag===6){if(n===null){l=t;try{l.stateNode.nodeValue=a?``:l.memoizedProps}catch(e){ed(l,l.return,e)}}}else if(t.tag===18){if(n===null){l=t;try{var m=l.stateNode;a?ff(m,!0):ff(l.stateNode,!1)}catch(e){ed(l,l.return,e)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break a;for(;t.sibling===null;){if(t.return===null||t.return===e)break a;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}r&4&&(r=e.updateQueue,r!==null&&(n=r.retryQueue,n!==null&&(r.retryQueue=null,yl(e,n))));break;case 19:bl(t,e),Cl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,yl(e,r)));break;case 30:break;case 21:break;default:bl(t,e),Cl(e)}}function Cl(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if($c(r)){n=r;break}r=r.return}if(n==null)throw Error(i(160));switch(n.tag){case 27:var a=n.stateNode;nl(e,el(e),a);break;case 5:var o=n.stateNode;n.flags&32&&(qt(o,``),n.flags&=-33),nl(e,el(e),o);break;case 3:case 4:var s=n.stateNode.containerInfo;tl(e,el(e),s);break;default:throw Error(i(161))}}catch(t){ed(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function wl(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;wl(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Tl(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)ul(e,t.alternate,t),t=t.sibling}function El(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Kc(4,t,t.return),El(t);break;case 1:Xc(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount==`function`&&Jc(t,t.return,n),El(t);break;case 27:Tf(t.stateNode);case 26:case 5:Xc(t,t.return),El(t);break;case 22:t.memoizedState===null&&El(t);break;case 30:El(t);break;default:El(t)}e=e.sibling}}function Dl(e,t,n){for(n&&=(t.subtreeFlags&8772)!=0,t=t.child;t!==null;){var r=t.alternate,i=e,a=t,o=a.flags;switch(a.tag){case 0:case 11:case 15:Dl(i,a,n),Gc(4,a);break;case 1:if(Dl(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){ed(r,r.return,e)}if(r=a,i=r.updateQueue,i!==null){var s=r.stateNode;try{var c=i.shared.hiddenCallbacks;if(c!==null)for(i.shared.hiddenCallbacks=null,i=0;i<c.length;i++)Za(c[i],s)}catch(e){ed(r,r.return,e)}}n&&o&64&&qc(a),Yc(a,a.return);break;case 27:rl(a);case 26:case 5:Dl(i,a,n),n&&r===null&&o&4&&Zc(a),Yc(a,a.return);break;case 12:Dl(i,a,n);break;case 31:Dl(i,a,n),n&&o&4&&gl(i,a);break;case 13:Dl(i,a,n),n&&o&4&&_l(i,a);break;case 22:a.memoizedState===null&&Dl(i,a,n),Yc(a,a.return);break;case 30:break;default:Dl(i,a,n)}t=t.sibling}}function Ol(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&&ua(n))}function kl(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&ua(e))}function Al(e,t,n,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)jl(e,t,n,r),t=t.sibling}function jl(e,t,n,r){var i=t.flags;switch(t.tag){case 0:case 11:case 15:Al(e,t,n,r),i&2048&&Gc(9,t);break;case 1:Al(e,t,n,r);break;case 3:Al(e,t,n,r),i&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&ua(e)));break;case 12:if(i&2048){Al(e,t,n,r),e=t.stateNode;try{var a=t.memoizedProps,o=a.id,s=a.onPostCommit;typeof s==`function`&&s(o,t.alternate===null?`mount`:`update`,e.passiveEffectDuration,-0)}catch(e){ed(t,t.return,e)}}else Al(e,t,n,r);break;case 31:Al(e,t,n,r);break;case 13:Al(e,t,n,r);break;case 23:break;case 22:a=t.stateNode,o=t.alternate,t.memoizedState===null?a._visibility&2?Al(e,t,n,r):(a._visibility|=2,Ml(e,t,n,r,(t.subtreeFlags&10256)!=0||!1)):a._visibility&2?Al(e,t,n,r):Nl(e,t),i&2048&&Ol(o,t);break;case 24:Al(e,t,n,r),i&2048&&kl(t.alternate,t);break;default:Al(e,t,n,r)}}function Ml(e,t,n,r,i){for(i&&=(t.subtreeFlags&10256)!=0||!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:Ml(a,o,s,c,i),Gc(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,Ml(a,o,s,c,i)):u._visibility&2?Ml(a,o,s,c,i):Nl(a,o),i&&l&2048&&Ol(o.alternate,o);break;case 24:Ml(a,o,s,c,i),i&&l&2048&&kl(o.alternate,o);break;default:Ml(a,o,s,c,i)}t=t.sibling}}function Nl(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:Nl(n,r),i&2048&&Ol(r.alternate,r);break;case 24:Nl(n,r),i&2048&&kl(r.alternate,r);break;default:Nl(n,r)}t=t.sibling}}var Pl=8192;function Fl(e,t,n){if(e.subtreeFlags&Pl)for(e=e.child;e!==null;)Il(e,t,n),e=e.sibling}function Il(e,t,n){switch(e.tag){case 26:Fl(e,t,n),e.flags&Pl&&e.memoizedState!==null&&rp(n,xl,e.memoizedState,e.memoizedProps);break;case 5:Fl(e,t,n);break;case 3:case 4:var r=xl;xl=Of(e.stateNode.containerInfo),Fl(e,t,n),xl=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=Pl,Pl=16777216,Fl(e,t,n),Pl=r):Fl(e,t,n));break;default:Fl(e,t,n)}}function Ll(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 Rl(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];cl=r,Vl(r,e)}Ll(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)zl(e),e=e.sibling}function zl(e){switch(e.tag){case 0:case 11:case 15:Rl(e),e.flags&2048&&Kc(9,e,e.return);break;case 3:Rl(e);break;case 12:Rl(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Bl(e)):Rl(e);break;default:Rl(e)}}function Bl(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];cl=r,Vl(r,e)}Ll(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Kc(8,t,t.return),Bl(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Bl(t));break;default:Bl(t)}e=e.sibling}}function Vl(e,t){for(;cl!==null;){var n=cl;switch(n.tag){case 0:case 11:case 15:Kc(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:ua(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,cl=r;else a:for(n=e;cl!==null;){r=cl;var i=r.sibling,a=r.return;if(dl(r),r===n){cl=null;break a}if(i!==null){i.return=a,cl=i;break a}cl=a}}}var Hl={getCacheForType:function(e){var t=na(ca),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return na(ca).controller.signal}},Ul=typeof WeakMap==`function`?WeakMap:Map,Wl=0,Gl=null,Kl=null,ql=0,Jl=0,Yl=null,Xl=!1,Zl=!1,V=!1,Ql=0,$l=0,eu=0,tu=0,nu=0,ru=0,iu=0,au=null,ou=null,su=!1,cu=0,lu=0,uu=1/0,du=null,fu=null,pu=0,mu=null,hu=null,gu=0,_u=0,vu=null,yu=null,bu=0,xu=null;function Su(){return Wl&2&&ql!==0?ql&-ql:N.T===null?at():xd()}function Cu(){if(ru===0)if(!(ql&536870912)||Fi){var e=We;We<<=1,!(We&3932160)&&(We=262144),ru=e}else ru=536870912;return e=io.current,e!==null&&(e.flags|=32),ru}function wu(e,t,n){(e===Gl&&(Jl===2||Jl===9)||e.cancelPendingCommit!==null)&&(ju(e,0),Ou(e,ql,ru,!1)),Qe(e,n),(!(Wl&2)||e!==Gl)&&(e===Gl&&(!(Wl&2)&&(tu|=n),$l===4&&Ou(e,ql,ru,!1)),pd(e))}function Tu(e,t,n){if(Wl&6)throw Error(i(327));var r=!n&&(t&127)==0&&(t&e.expiredLanes)===0||Je(e,t),a=r?zu(e,t):Lu(e,t,!0),o=r;do{if(a===0){Zl&&!r&&Ou(e,t,0,!1);break}else{if(n=e.current.alternate,o&&!Du(n)){a=Lu(e,t,!1),o=!1;continue}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=au;var l=c.current.memoizedState.isDehydrated;if(l&&(ju(c,s).flags|=256),s=Lu(c,s,!1),s!==2){if(V&&!l){c.errorRecoveryDisabledLanes|=o,tu|=o,a=4;break a}o=ou,ou=a,o!==null&&(ou===null?ou=o:ou.push.apply(ou,o))}a=s}if(o=!1,a!==2)continue}}if(a===1){ju(e,0),Ou(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)break;case 6:Ou(r,t,ru,!Xl);break a;case 2:ou=null;break;case 3:case 5:break;default:throw Error(i(329))}if((t&62914560)===t&&(a=cu+300-we(),10<a)){if(Ou(r,t,ru,!Xl),qe(r,0,!0)!==0)break a;gu=t,r.timeoutHandle=af(Eu.bind(null,r,n,ou,du,su,t,ru,tu,iu,Xl,o,`Throttled`,-0,0),a);break a}Eu(r,n,ou,du,su,t,ru,tu,iu,Xl,o,null,-0,0)}}break}while(1);pd(e)}function Eu(e,t,n,r,i,a,o,s,c,l,u,d,f,p){if(e.timeoutHandle=-1,d=t.subtreeFlags,d&8192||(d&16785408)==16785408){d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:$t},Il(t,a,d);var m=(a&62914560)===a?cu-we():(a&4194048)===a?lu-we():0;if(m=ap(d,m),m!==null){gu=a,e.cancelPendingCommit=m(Ku.bind(null,e,t,a,n,r,i,o,s,c,u,d,null,f,p)),Ou(e,a,o,!l);return}}Ku(e,t,a,n,r,i,o,s,c)}function Du(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(!Sr(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 Ou(e,t,n,r){t&=~nu,t&=~tu,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-ze(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&et(e,n,t)}function ku(){return Wl&6?!0:(md(0,!1),!1)}function Au(){if(Kl!==null){if(Jl===0)var e=Kl.return;else e=Kl,Ji=qi=null,Mo(e),Na=null,Pa=0,e=Kl;for(;e!==null;)Wc(e.alternate,e),e=e.return;Kl=null}}function ju(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,of(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),gu=0,Au(),Gl=e,Kl=n=ui(e.current,null),ql=t,Jl=0,Yl=null,Xl=!1,Zl=Je(e,t),V=!1,iu=ru=nu=tu=eu=$l=0,ou=au=null,su=!1,t&8&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var i=31-ze(r),a=1<<i;t|=e[i],r&=~a}return Ql=t,ei(),n}function Mu(e,t){ho=null,N.H=Hs,t===Ca||t===Ta?(t=ja(),Jl=3):t===wa?(t=ja(),Jl=4):Jl=t===ac?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,Yl=t,Kl===null&&($l=1,$s(e,vi(t,e.current)))}function Nu(){var e=io.current;return e===null?!0:(ql&4194048)===ql?ao===null:(ql&62914560)===ql||ql&536870912?e===ao:!1}function Pu(){var e=N.H;return N.H=Hs,e===null?Hs:e}function Fu(){var e=N.A;return N.A=Hl,e}function Iu(){$l=4,Xl||(ql&4194048)!==ql&&io.current!==null||(Zl=!0),!(eu&134217727)&&!(tu&134217727)||Gl===null||Ou(Gl,ql,ru,!1)}function Lu(e,t,n){var r=Wl;Wl|=2;var i=Pu(),a=Fu();(Gl!==e||ql!==t)&&(du=null,ju(e,t)),t=!1;var o=$l;a:do try{if(Jl!==0&&Kl!==null){var s=Kl,c=Yl;switch(Jl){case 8:Au(),o=6;break a;case 3:case 2:case 9:case 6:io.current===null&&(t=!0);var l=Jl;if(Jl=0,Yl=null,Uu(e,s,c,l),n&&Zl){o=0;break a}break;default:l=Jl,Jl=0,Yl=null,Uu(e,s,c,l)}}Ru(),o=$l;break}catch(t){Mu(e,t)}while(1);return t&&e.shellSuspendCounter++,Ji=qi=null,Wl=r,N.H=i,N.A=a,Kl===null&&(Gl=null,ql=0,ei()),o}function Ru(){for(;Kl!==null;)Vu(Kl)}function zu(e,t){var n=Wl;Wl|=2;var r=Pu(),a=Fu();Gl!==e||ql!==t?(du=null,uu=we()+500,ju(e,t)):Zl=Je(e,t);a:do try{if(Jl!==0&&Kl!==null){t=Kl;var o=Yl;b:switch(Jl){case 1:Jl=0,Yl=null,Uu(e,t,o,1);break;case 2:case 9:if(Da(o)){Jl=0,Yl=null,Hu(t);break}t=function(){Jl!==2&&Jl!==9||Gl!==e||(Jl=7),pd(e)},o.then(t,t);break a;case 3:Jl=7;break a;case 4:Jl=5;break a;case 7:Da(o)?(Jl=0,Yl=null,Hu(t)):(Jl=0,Yl=null,Uu(e,t,o,7));break;case 5:var s=null;switch(Kl.tag){case 26:s=Kl.memoizedState;case 5:case 27:var c=Kl;if(s?np(s):c.stateNode.complete){Jl=0,Yl=null;var l=c.sibling;if(l!==null)Kl=l;else{var u=c.return;u===null?Kl=null:(Kl=u,Wu(u))}break b}}Jl=0,Yl=null,Uu(e,t,o,5);break;case 6:Jl=0,Yl=null,Uu(e,t,o,6);break;case 8:Au(),$l=6;break a;default:throw Error(i(462))}}Bu();break}catch(t){Mu(e,t)}while(1);return Ji=qi=null,N.H=r,N.A=a,Wl=n,Kl===null?(Gl=null,ql=0,ei(),$l):0}function Bu(){for(;Kl!==null&&!Se();)Vu(Kl)}function Vu(e){var t=Fc(e.alternate,e,Ql);e.memoizedProps=e.pendingProps,t===null?Wu(e):Kl=t}function Hu(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=yc(n,t,t.pendingProps,t.type,void 0,ql);break;case 11:t=yc(n,t,t.pendingProps,t.type.render,t.ref,ql);break;case 5:Mo(t);default:Wc(n,t),t=Kl=di(t,Ql),t=Fc(n,t,Ql)}e.memoizedProps=e.pendingProps,t===null?Wu(e):Kl=t}function Uu(e,t,n,r){Ji=qi=null,Mo(t),Na=null,Pa=0;var i=t.return;try{if(ic(e,i,t,n,ql)){$l=1,$s(e,vi(n,e.current)),Kl=null;return}}catch(t){if(i!==null)throw Kl=i,t;$l=1,$s(e,vi(n,e.current)),Kl=null;return}t.flags&32768?(Fi||r===1?e=!0:Zl||ql&536870912?e=!1:(Xl=e=!0,(r===2||r===9||r===3||r===6)&&(r=io.current,r!==null&&r.tag===13&&(r.flags|=16384))),Gu(t,e)):Wu(t)}function Wu(e){var t=e;do{if(t.flags&32768){Gu(t,Xl);return}e=t.return;var n=Hc(t.alternate,t,Ql);if(n!==null){Kl=n;return}if(t=t.sibling,t!==null){Kl=t;return}Kl=t=e}while(t!==null);$l===0&&($l=5)}function Gu(e,t){do{var n=Uc(e.alternate,e);if(n!==null){n.flags&=32767,Kl=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Kl=e;return}Kl=e=n}while(e!==null);$l=6,Kl=null}function Ku(e,t,n,r,a,o,s,c,l){e.cancelPendingCommit=null;do Zu();while(pu!==0);if(Wl&6)throw Error(i(327));if(t!==null){if(t===e.current)throw Error(i(177));if(o=t.lanes|t.childLanes,o|=$r,$e(e,n,o,s,c,l),e===Gl&&(Kl=Gl=null,ql=0),hu=t,mu=e,gu=n,_u=o,vu=a,yu=r,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,od(Oe,function(){return Qu(),null})):(e.callbackNode=null,e.callbackPriority=0),r=(t.flags&13878)!=0,t.subtreeFlags&13878||r){r=N.T,N.T=null,a=P.p,P.p=2,s=Wl,Wl|=4;try{ll(e,t,n)}finally{Wl=s,P.p=a,N.T=r}}pu=1,qu(),Ju(),Yu()}}function qu(){if(pu===1){pu=0;var e=mu,t=hu,n=(t.flags&13878)!=0;if(t.subtreeFlags&13878||n){n=N.T,N.T=null;var r=P.p;P.p=2;var i=Wl;Wl|=4;try{Sl(t,e);var a=Zd,o=Dr(e.containerInfo),s=a.focusedElem,c=a.selectionRange;if(o!==s&&s&&s.ownerDocument&&Er(s.ownerDocument.documentElement,s)){if(c!==null&&Or(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 _=Tr(s,h),v=Tr(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}}yp=!!Xd,Zd=Xd=null}finally{Wl=i,P.p=r,N.T=n}}e.current=t,pu=2}}function Ju(){if(pu===2){pu=0;var e=mu,t=hu,n=(t.flags&8772)!=0;if(t.subtreeFlags&8772||n){n=N.T,N.T=null;var r=P.p;P.p=2;var i=Wl;Wl|=4;try{ul(e,t.alternate,t)}finally{Wl=i,P.p=r,N.T=n}}pu=3}}function Yu(){if(pu===4||pu===3){pu=0,Ce();var e=mu,t=hu,n=gu,r=yu;t.subtreeFlags&10256||t.flags&10256?pu=5:(pu=0,hu=mu=null,Xu(e,e.pendingLanes));var i=e.pendingLanes;if(i===0&&(fu=null),it(n),t=t.stateNode,Le&&typeof Le.onCommitFiberRoot==`function`)try{Le.onCommitFiberRoot(Ie,t,void 0,(t.current.flags&128)==128)}catch{}if(r!==null){t=N.T,i=P.p,P.p=2,N.T=null;try{for(var a=e.onRecoverableError,o=0;o<r.length;o++){var s=r[o];a(s.value,{componentStack:s.stack})}}finally{N.T=t,P.p=i}}gu&3&&Zu(),pd(e),i=e.pendingLanes,n&261930&&i&42?e===xu?bu++:(bu=0,xu=e):bu=0,md(0,!1)}}function Xu(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,ua(t)))}function Zu(){return qu(),Ju(),Yu(),Qu()}function Qu(){if(pu!==5)return!1;var e=mu,t=_u;_u=0;var n=it(gu),r=N.T,a=P.p;try{P.p=32>n?32:n,N.T=null,n=vu,vu=null;var o=mu,s=gu;if(pu=0,hu=mu=null,gu=0,Wl&6)throw Error(i(331));var c=Wl;if(Wl|=4,zl(o.current),jl(o,o.current,s,n),Wl=c,md(0,!1),Le&&typeof Le.onPostCommitFiberRoot==`function`)try{Le.onPostCommitFiberRoot(Ie,o)}catch{}return!0}finally{P.p=a,N.T=r,Xu(e,t)}}function $u(e,t,n){t=vi(n,t),t=tc(e.stateNode,t,2),e=Ga(e,t,2),e!==null&&(Qe(e,2),pd(e))}function ed(e,t,n){if(e.tag===3)$u(e,e,n);else for(;t!==null;){if(t.tag===3){$u(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(fu===null||!fu.has(r))){e=vi(n,e),n=nc(2),r=Ga(t,n,2),r!==null&&(rc(n,r,t,e),Qe(r,2),pd(r));break}}t=t.return}}function td(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Ul;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)||(V=!0,i.add(n),e=nd.bind(null,e,t,n),t.then(e,e))}function nd(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Gl===e&&(ql&n)===n&&($l===4||$l===3&&(ql&62914560)===ql&&300>we()-cu?!(Wl&2)&&ju(e,0):nu|=n,iu===ql&&(iu=0)),pd(e)}function rd(e,t){t===0&&(t=Xe()),e=ri(e,t),e!==null&&(Qe(e,t),pd(e))}function id(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),rd(e,n)}function ad(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),rd(e,n)}function od(e,t){return be(e,t)}var sd=null,cd=null,ld=!1,ud=!1,dd=!1,fd=0;function pd(e){e!==cd&&e.next===null&&(cd===null?sd=cd=e:cd=cd.next=e),ud=!0,ld||(ld=!0,bd())}function md(e,t){if(!dd&&ud){dd=!0;do for(var n=!1,r=sd;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-ze(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,yd(r,a))}else a=ql,a=qe(r,r===Gl?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||Je(r,a)||(n=!0,yd(r,a));r=r.next}while(n);dd=!1}}function hd(){gd()}function gd(){ud=ld=!1;var e=0;fd!==0&&rf()&&(e=fd);for(var t=we(),n=null,r=sd;r!==null;){var i=r.next,a=_d(r,t);a===0?(r.next=null,n===null?sd=i:n.next=i,i===null&&(cd=n)):(n=r,(e!==0||a&3)&&(ud=!0)),r=i}pu!==0&&pu!==5||md(e,!1),fd!==0&&(fd=0)}function _d(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-ze(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=Ye(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=Gl,n=ql,n=qe(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(Jl===2||Jl===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&xe(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||Je(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&xe(r),it(n)){case 2:case 8:n=De;break;case 32:n=Oe;break;case 268435456:n=Ae;break;default:n=Oe}return r=vd.bind(null,e),n=be(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&xe(r),e.callbackPriority=2,e.callbackNode=null,2}function vd(e,t){if(pu!==0&&pu!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(Zu()&&e.callbackNode!==n)return null;var r=ql;return r=qe(e,e===Gl?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(Tu(e,r,t),_d(e,we()),e.callbackNode!=null&&e.callbackNode===n?vd.bind(null,e):null)}function yd(e,t){if(Zu())return null;Tu(e,t,!0)}function bd(){cf(function(){Wl&6?be(Ee,hd):gd()})}function xd(){if(fd===0){var e=pa;e===0&&(e=Ue,Ue<<=1,!(Ue&261888)&&(Ue=256)),fd=e}return fd}function Sd(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:Qt(``+e)}function Cd(e,t){var n=t.ownerDocument.createElement(`input`);return n.name=t.name,n.value=t.value,e.id&&n.setAttribute(`form`,e.id),t.parentNode.insertBefore(n,t),e=new FormData(e),n.parentNode.removeChild(n),e}function wd(e,t,n,r,i){if(t===`submit`&&n&&n.stateNode===i){var a=Sd((i[lt]||null).action),o=r.submitter;o&&(t=(t=o[lt]||null)?Sd(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new xn(`action`,`action`,null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(fd!==0){var e=o?Cd(i,o):new FormData(i);Os(n,{pending:!0,data:e,method:i.method,action:a},null,e)}}else typeof a==`function`&&(s.preventDefault(),e=o?Cd(i,o):new FormData(i),Os(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var Td=0;Td<Jr.length;Td++){var Ed=Jr[Td];Yr(Ed.toLowerCase(),`on`+(Ed[0].toUpperCase()+Ed.slice(1)))}Yr(Br,`onAnimationEnd`),Yr(Vr,`onAnimationIteration`),Yr(Hr,`onAnimationStart`),Yr(`dblclick`,`onDoubleClick`),Yr(`focusin`,`onFocus`),Yr(`focusout`,`onBlur`),Yr(Ur,`onTransitionRun`),Yr(Wr,`onTransitionStart`),Yr(Gr,`onTransitionCancel`),Yr(Kr,`onTransitionEnd`),Tt(`onMouseEnter`,[`mouseout`,`mouseover`]),Tt(`onMouseLeave`,[`mouseout`,`mouseover`]),Tt(`onPointerEnter`,[`pointerout`,`pointerover`]),Tt(`onPointerLeave`,[`pointerout`,`pointerover`]),wt(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),wt(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),wt(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),wt(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),wt(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),wt(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var Dd=`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(` `),Od=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(Dd));function kd(e,t){t=(t&4)!=0;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){Xr(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){Xr(e)}i.currentTarget=null,a=c}}}}function Ad(e,t){var n=t[dt];n===void 0&&(n=t[dt]=new Set);var r=e+`__bubble`;n.has(r)||(Pd(t,e,2,!1),n.add(r))}function jd(e,t,n){var r=0;t&&(r|=4),Pd(n,e,r,t)}var Md=`_reactListening`+Math.random().toString(36).slice(2);function Nd(e){if(!e[Md]){e[Md]=!0,St.forEach(function(t){t!==`selectionchange`&&(Od.has(t)||jd(t,!1,e),jd(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Md]||(t[Md]=!0,jd(`selectionchange`,!1,t))}}function Pd(e,t,n,r){switch(Ep(t)){case 2:var i=bp;break;case 8:i=xp;break;default:i=Sp}n=i.bind(null,t,n,e),i=void 0,!un||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 Fd(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=_t(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}sn(function(){var r=a,i=tn(n),s=[];a:{var c=qr.get(e);if(c!==void 0){var l=xn,u=e;switch(e){case`keypress`:if(gn(n)===0)break a;case`keydown`:case`keyup`:l=zn;break;case`focusin`:u=`focus`,l=An;break;case`focusout`:u=`blur`,l=An;break;case`beforeblur`:case`afterblur`:l=An;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=On;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:l=kn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:l=Vn;break;case Br:case Vr:case Hr:l=jn;break;case Kr:l=Hn;break;case`scroll`:case`scrollend`:l=Cn;break;case`wheel`:l=Un;break;case`copy`:case`cut`:case`paste`:l=Mn;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:l=Bn;break;case`toggle`:case`beforetoggle`:l=Wn}var d=(t&4)!=0,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=cn(m,p),g!=null&&d.push(Id(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(c=e===`mouseover`||e===`pointerover`,l=e===`mouseout`||e===`pointerout`,c&&n!==en&&(u=n.relatedTarget||n.fromElement)&&(_t(u)||u[ut]))break a;if((l||c)&&(c=i.window===i?i:(c=i.ownerDocument)?c.defaultView||c.parentWindow:window,l?(u=n.relatedTarget||n.toElement,l=r,u=u?_t(u):null,u!==null&&(f=o(u),d=u.tag,u!==f||d!==5&&d!==27&&d!==6)&&(u=null)):(l=null,u=r),l!==u)){if(d=On,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=Bn,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=l==null?c:yt(l),h=u==null?c:yt(u),c=new d(g,m+`leave`,l,n,i),c.target=f,c.relatedTarget=h,g=null,_t(i)===r&&(d=new d(p,m+`enter`,u,n,i),d.target=h,d.relatedTarget=f,g=d),f=g,l&&u)b:{for(d=Rd,p=l,m=u,h=0,g=p;g;g=d(g))h++;g=0;for(var _=m;_;_=d(_))g++;for(;0<h-g;)p=d(p),h--;for(;0<g-h;)m=d(m),g--;for(;h--;){if(p===m||m!==null&&p===m.alternate){d=p;break b}p=d(p),m=d(m)}d=null}else d=null;l!==null&&zd(s,c,l,d,!1),u!==null&&f!==null&&zd(s,f,u,d,!0)}}a:{if(c=r?yt(r):window,l=c.nodeName&&c.nodeName.toLowerCase(),l===`select`||l===`input`&&c.type===`file`)var v=ur;else if(ir(c))if(dr)v=br;else{v=vr;var y=_r}else l=c.nodeName,!l||l.toLowerCase()!==`input`||c.type!==`checkbox`&&c.type!==`radio`?r&&Yt(r.elementType)&&(v=ur):v=yr;if(v&&=v(e,r)){ar(s,v,n,i);break a}y&&y(e,c,r),e===`focusout`&&r&&c.type===`number`&&r.memoizedProps.value!=null&&Ut(c,`number`,c.value)}switch(y=r?yt(r):window,e){case`focusin`:(ir(y)||y.contentEditable===`true`)&&(Ar=y,jr=r,Mr=null);break;case`focusout`:Mr=jr=Ar=null;break;case`mousedown`:Nr=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:Nr=!1,Pr(s,n,i);break;case`selectionchange`:if(kr)break;case`keydown`:case`keyup`:Pr(s,n,i)}var b;if(Kn)b:{switch(e){case`compositionstart`:var x=`onCompositionStart`;break b;case`compositionend`:x=`onCompositionEnd`;break b;case`compositionupdate`:x=`onCompositionUpdate`;break b}x=void 0}else er?Qn(e,n)&&(x=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(x=`onCompositionStart`);x&&(Yn&&n.locale!==`ko`&&(er||x!==`onCompositionStart`?x===`onCompositionEnd`&&er&&(b=hn()):(fn=i,pn=`value`in fn?fn.value:fn.textContent,er=!0)),y=Ld(r,x),0<y.length&&(x=new Nn(x,e,null,n,i),s.push({event:x,listeners:y}),b?x.data=b:(b=$n(n),b!==null&&(x.data=b)))),(b=Jn?tr(e,n):nr(e,n))&&(x=Ld(r,`onBeforeInput`),0<x.length&&(y=new Nn(`onBeforeInput`,`beforeinput`,null,n,i),s.push({event:y,listeners:x}),y.data=b)),wd(s,e,r,n,i)}kd(s,t)})}function Id(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Ld(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=cn(e,n),i!=null&&r.unshift(Id(e,i,a)),i=cn(e,t),i!=null&&r.push(Id(e,i,a))),e.tag===3)return r;e=e.return}return[]}function Rd(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function zd(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=cn(n,a),l!=null&&o.unshift(Id(n,l,c))):i||(l=cn(n,a),l!=null&&o.push(Id(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var Bd=/\r\n?/g,Vd=/\u0000|\uFFFD/g;function Hd(e){return(typeof e==`string`?e:``+e).replace(Bd,`
10
+ `).replace(Vd,``)}function Ud(e,t){return t=Hd(t),Hd(e)===t}function Wd(e,t,n,r,a,o){switch(n){case`children`:typeof r==`string`?t===`body`||t===`textarea`&&r===``||qt(e,r):(typeof r==`number`||typeof r==`bigint`)&&t!==`body`&&qt(e,``+r);break;case`className`:jt(e,`class`,r);break;case`tabIndex`:jt(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:jt(e,n,r);break;case`style`:R(e,r,o);break;case`data`:if(t!==`object`){jt(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)){e.removeAttribute(n);break}if(r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Qt(``+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}else typeof o==`function`&&(n===`formAction`?(t!==`input`&&Wd(e,t,`name`,a.name,a,null),Wd(e,t,`formEncType`,a.formEncType,a,null),Wd(e,t,`formMethod`,a.formMethod,a,null),Wd(e,t,`formTarget`,a.formTarget,a,null)):(Wd(e,t,`encType`,a.encType,a,null),Wd(e,t,`method`,a.method,a,null),Wd(e,t,`target`,a.target,a,null)));if(r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Qt(``+r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=$t);break;case`onScroll`:r!=null&&Ad(`scroll`,e);break;case`onScrollEnd`:r!=null&&Ad(`scrollend`,e);break;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));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=Qt(``+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`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`:Ad(`beforetoggle`,e),Ad(`toggle`,e),At(e,`popover`,r);break;case`xlinkActuate`:Mt(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:Mt(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:Mt(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:Mt(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:Mt(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:Mt(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:Mt(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:Mt(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:Mt(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:At(e,`is`,r);break;case`innerText`:case`textContent`:break;default:(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)&&(n=Xt.get(n)||n,At(e,n,r))}}function Gd(e,t,n,r,a,o){switch(n){case`style`:R(e,r,o);break;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));e.innerHTML=n}}break;case`children`:typeof r==`string`?qt(e,r):(typeof r==`number`||typeof r==`bigint`)&&qt(e,``+r);break;case`onScroll`:r!=null&&Ad(`scroll`,e);break;case`onScrollEnd`:r!=null&&Ad(`scrollend`,e);break;case`onClick`:r!=null&&(e.onclick=$t);break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:break;case`innerText`:case`textContent`:break;default:if(!Ct.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(a=n.endsWith(`Capture`),t=n.slice(2,a?n.length-7:void 0),o=e[lt]||null,o=o==null?null:o[n],typeof o==`function`&&e.removeEventListener(t,o,a),typeof r==`function`)){typeof o!=`function`&&o!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,r,a);break a}n in e?e[n]=r:!0===r?e.setAttribute(n,``):At(e,n,r)}}}function Kd(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:Ad(`error`,e),Ad(`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:Wd(e,t,o,s,n,null)}}a&&Wd(e,t,`srcSet`,n.srcSet,n,null),r&&Wd(e,t,`src`,n.src,n,null);return;case`input`:Ad(`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:Wd(e,t,r,d,n,null)}}Ht(e,o,c,l,u,s,a,!1);return;case`select`:for(a in Ad(`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:Wd(e,t,a,c,n,null)}t=o,n=s,e.multiple=!!r,t==null?n!=null&&Wt(e,!!r,n,!0):Wt(e,!!r,t,!1);return;case`textarea`:for(s in Ad(`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:Wd(e,t,s,c,n,null)}Kt(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:Wd(e,t,l,r,n,null)}return;case`dialog`:Ad(`beforetoggle`,e),Ad(`toggle`,e),Ad(`cancel`,e),Ad(`close`,e);break;case`iframe`:case`object`:Ad(`load`,e);break;case`video`:case`audio`:for(r=0;r<Dd.length;r++)Ad(Dd[r],e);break;case`image`:Ad(`error`,e),Ad(`load`,e);break;case`details`:Ad(`toggle`,e);break;case`embed`:case`source`:case`link`:Ad(`error`,e),Ad(`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:Wd(e,t,u,r,n,null)}return;default:if(Yt(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&Gd(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&Wd(e,t,c,r,n,null))}function qd(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)||Wd(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`:o=m;break;case`name`:a=m;break;case`checked`:u=m;break;case`defaultChecked`:d=m;break;case`value`:s=m;break;case`defaultValue`:c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(i(137,t));break;default:m!==f&&Wd(e,t,p,m,r,f)}}Vt(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)||Wd(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`:p=o;break;case`defaultValue`:c=o;break;case`multiple`:s=o;default:o!==l&&Wd(e,t,a,o,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?Wt(e,!!n,n?[]:``,!1):Wt(e,!!n,t,!0)):Wt(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:Wd(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`:p=a;break;case`defaultValue`:m=a;break;case`children`:break;case`dangerouslySetInnerHTML`:if(a!=null)throw Error(i(91));break;default:a!==o&&Wd(e,t,s,a,r,o)}Gt(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:Wd(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`:e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:Wd(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)&&Wd(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:Wd(e,t,u,p,r,m)}return;default:if(Yt(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&Gd(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||Gd(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&Wd(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||Wd(e,t,f,p,r,m)}function Jd(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function Yd(){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&&Jd(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&&Jd(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 Xd=null,Zd=null;function Qd(e){return e.nodeType===9?e:e.ownerDocument}function $d(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 ef(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 tf(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 nf=null;function rf(){var e=window.event;return e&&e.type===`popstate`?e===nf?!1:(nf=e,!0):(nf=null,!1)}var af=typeof setTimeout==`function`?setTimeout:void 0,of=typeof clearTimeout==`function`?clearTimeout:void 0,sf=typeof Promise==`function`?Promise:void 0,cf=typeof queueMicrotask==`function`?queueMicrotask:sf===void 0?af:function(e){return sf.resolve(null).then(e).catch(lf)};function lf(e){setTimeout(function(){throw e})}function uf(e){return e===`head`}function df(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),Up(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)Tf(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,Tf(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[ht]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&Tf(e.ownerDocument.body);n=i}while(n);Up(t)}function ff(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 pf(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`:pf(n),gt(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function mf(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[ht])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=bf(e.nextSibling),e===null)break}return null}function hf(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=bf(e.nextSibling),e===null))return null;return e}function gf(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=bf(e.nextSibling),e===null))return null;return e}function _f(e){return e.data===`$?`||e.data===`$~`}function vf(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function yf(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 bf(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 xf=null;function Sf(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return bf(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function Cf(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 wf(e,t,n){switch(t=Qd(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 Tf(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);gt(e)}var Ef=new Map,Df=new Set;function Of(e){return typeof e.getRootNode==`function`?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var kf=P.d;P.d={f:Af,r:jf,D:Pf,C:Ff,L:If,m:Lf,X:zf,S:Rf,M:Bf};function Af(){var e=kf.f(),t=ku();return e||t}function jf(e){var t=vt(e);t!==null&&t.tag===5&&t.type===`form`?As(t):kf.r(e)}var Mf=typeof document>`u`?null:document;function Nf(e,t,n){var r=Mf;if(r&&typeof t==`string`&&t){var i=Bt(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),Df.has(i)||(Df.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Kd(t,`link`,e),xt(t),r.head.appendChild(t)))}}function Pf(e){kf.D(e),Nf(`dns-prefetch`,e,null)}function Ff(e,t){kf.C(e,t),Nf(`preconnect`,e,t)}function If(e,t,n){kf.L(e,t,n);var r=Mf;if(r&&e&&t){var i=`link[rel="preload"][as="`+Bt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Bt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Bt(n.imageSizes)+`"]`)):i+=`[href="`+Bt(e)+`"]`;var a=i;switch(t){case`style`:a=Hf(e);break;case`script`:a=Kf(e)}Ef.has(a)||(e=f({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),Ef.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Uf(a))||t===`script`&&r.querySelector(qf(a))||(t=r.createElement(`link`),Kd(t,`link`,e),xt(t),r.head.appendChild(t)))}}function Lf(e,t){kf.m(e,t);var n=Mf;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Bt(r)+`"][href="`+Bt(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Kf(e)}if(!Ef.has(a)&&(e=f({rel:`modulepreload`,href:e},t),Ef.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(qf(a)))return}r=n.createElement(`link`),Kd(r,`link`,e),xt(r),n.head.appendChild(r)}}}function Rf(e,t,n){kf.S(e,t,n);var r=Mf;if(r&&e){var i=bt(r).hoistableStyles,a=Hf(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Uf(a)))s.loading=5;else{e=f({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=Ef.get(a))&&Xf(e,n);var c=o=r.createElement(`link`);xt(c),Kd(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,Yf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function zf(e,t){kf.X(e,t);var n=Mf;if(n&&e){var r=bt(n).hoistableScripts,i=Kf(e),a=r.get(i);a||(a=n.querySelector(qf(i)),a||(e=f({src:e,async:!0},t),(t=Ef.get(i))&&Zf(e,t),a=n.createElement(`script`),xt(a),Kd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Bf(e,t){kf.M(e,t);var n=Mf;if(n&&e){var r=bt(n).hoistableScripts,i=Kf(e),a=r.get(i);a||(a=n.querySelector(qf(i)),a||(e=f({src:e,async:!0,type:`module`},t),(t=Ef.get(i))&&Zf(e,t),a=n.createElement(`script`),xt(a),Kd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Vf(e,t,n,r){var a=(a=oe.current)?Of(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`?(t=Hf(n.href),n=bt(a).hoistableStyles,r=n.get(t),r||(r={type:`style`,instance:null,count:0,state:null},n.set(t,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=Hf(n.href);var o=bt(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(Uf(e)))&&!o._p&&(s.instance=o,s.state.loading=5),Ef.has(e)||(n={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},Ef.set(e,n),o||Gf(a,e,n,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`?(t=Kf(n),n=bt(a).hoistableScripts,r=n.get(t),r||(r={type:`script`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(i(444,e))}}function Hf(e){return`href="`+Bt(e)+`"`}function Uf(e){return`link[rel="stylesheet"][`+e+`]`}function Wf(e){return f({},e,{"data-precedence":e.precedence,precedence:null})}function Gf(e,t,n,r){e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)?r.loading=1:(t=e.createElement(`link`),r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2}),Kd(t,`link`,n),xt(t),e.head.appendChild(t))}function Kf(e){return`[src="`+Bt(e)+`"]`}function qf(e){return`script[async]`+e}function Jf(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Bt(n.href)+`"]`);if(r)return t.instance=r,xt(r),r;var a=f({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),xt(r),Kd(r,`style`,a),Yf(r,n.precedence,e),t.instance=r;case`stylesheet`:a=Hf(n.href);var o=e.querySelector(Uf(a));if(o)return t.state.loading|=4,t.instance=o,xt(o),o;r=Wf(n),(a=Ef.get(a))&&Xf(r,a),o=(e.ownerDocument||e).createElement(`link`),xt(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),Kd(o,`link`,r),t.state.loading|=4,Yf(o,n.precedence,e),t.instance=o;case`script`:return o=Kf(n.src),(a=e.querySelector(qf(o)))?(t.instance=a,xt(a),a):(r=n,(a=Ef.get(o))&&(r=f({},n),Zf(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),xt(a),Kd(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,Yf(r,n.precedence,e));return t.instance}function Yf(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 Xf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function Zf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var Qf=null;function $f(e,t,n){if(Qf===null){var r=new Map,i=Qf=new Map;i.set(n,r)}else i=Qf,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[ht]||a[ct]||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 ep(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function tp(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 np(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function rp(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=Hf(r.href),a=t.querySelector(Uf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=op.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,xt(a);return}a=t.ownerDocument||t,r=Wf(r),(i=Ef.get(i))&&Xf(r,i),a=a.createElement(`link`),xt(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Kd(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=op.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var ip=0;function ap(e,t){return e.stylesheets&&e.count===0&&cp(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&cp(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&ip===0&&(ip=62500*Yd());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&cp(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>ip?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function op(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)cp(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var sp=null;function cp(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,sp=new Map,t.forEach(lp,e),sp=null,op.call(e))}function lp(e,t){if(!(t.state.loading&4)){var n=sp.get(e);if(n)var r=n.get(null);else{n=new Map,sp.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=op.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 up={$$typeof:b,Provider:null,Consumer:null,_currentValue:ee,_currentValue2:ee,_threadCount:0};function dp(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=Ze(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ze(0),this.hiddenUpdates=Ze(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.incompleteTransitions=new Map}function fp(e,t,n,r,i,a,o,s,c,l,u,d){return e=new dp(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=ci(3,null,null,t),e.current=a,a.stateNode=e,t=la(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},Ha(a),e}function pp(e){return e?(e=oi,e):oi}function mp(e,t,n,r,i,a){i=pp(i),r.context===null?r.context=i:r.pendingContext=i,r=Wa(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=Ga(e,r,t),n!==null&&(wu(n,e,t),Ka(n,e,t))}function hp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function gp(e,t){hp(e,t),(e=e.alternate)&&hp(e,t)}function _p(e){if(e.tag===13||e.tag===31){var t=ri(e,67108864);t!==null&&wu(t,e,67108864),gp(e,67108864)}}function vp(e){if(e.tag===13||e.tag===31){var t=Su();t=rt(t);var n=ri(e,t);n!==null&&wu(n,e,t),gp(e,t)}}var yp=!0;function bp(e,t,n,r){var i=N.T;N.T=null;var a=P.p;try{P.p=2,Sp(e,t,n,r)}finally{P.p=a,N.T=i}}function xp(e,t,n,r){var i=N.T;N.T=null;var a=P.p;try{P.p=8,Sp(e,t,n,r)}finally{P.p=a,N.T=i}}function Sp(e,t,n,r){if(yp){var i=Cp(r);if(i===null)Fd(e,t,r,wp,n),Pp(e,r);else if(Ip(i,e,t,n,r))r.stopPropagation();else if(Pp(e,r),t&4&&-1<Np.indexOf(e)){for(;i!==null;){var a=vt(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=Ke(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-ze(o);s.entanglements[1]|=c,o&=~c}pd(a),!(Wl&6)&&(uu=we()+500,md(0,!1))}}break;case 31:case 13:s=ri(a,2),s!==null&&wu(s,a,2),ku(),gp(a,2)}if(a=Cp(r),a===null&&Fd(e,t,r,wp,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else Fd(e,t,r,null,n)}}function Cp(e){return e=tn(e),Tp(e)}var wp=null;function Tp(e){if(wp=null,e=_t(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 wp=e,null}function Ep(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`resize`: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`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`scroll`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 8;case`message`:switch(Te()){case Ee:return 2;case De:return 8;case Oe:case ke:return 32;case Ae:return 268435456;default:return 32}default:return 32}}var Dp=!1,Op=null,kp=null,Ap=null,jp=new Map,Mp=new Map,H=[],Np=`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 Pp(e,t){switch(e){case`focusin`:case`focusout`:Op=null;break;case`dragenter`:case`dragleave`:kp=null;break;case`mouseover`:case`mouseout`:Ap=null;break;case`pointerover`:case`pointerout`:jp.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:Mp.delete(t.pointerId)}}function Fp(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=vt(t),t!==null&&_p(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Ip(e,t,n,r,i){switch(t){case`focusin`:return Op=Fp(Op,e,t,n,r,i),!0;case`dragenter`:return kp=Fp(kp,e,t,n,r,i),!0;case`mouseover`:return Ap=Fp(Ap,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return jp.set(a,Fp(jp.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,Mp.set(a,Fp(Mp.get(a)||null,e,t,n,r,i)),!0}return!1}function Lp(e){var t=_t(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,ot(e.priority,function(){vp(n)});return}}else if(t===31){if(t=c(n),t!==null){e.blockedOn=t,ot(e.priority,function(){vp(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 Rp(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Cp(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);en=r,n.target.dispatchEvent(r),en=null}else return t=vt(n),t!==null&&_p(t),e.blockedOn=n,!1;t.shift()}return!0}function zp(e,t,n){Rp(e)&&n.delete(t)}function Bp(){Dp=!1,Op!==null&&Rp(Op)&&(Op=null),kp!==null&&Rp(kp)&&(kp=null),Ap!==null&&Rp(Ap)&&(Ap=null),jp.forEach(zp),Mp.forEach(zp)}function Vp(e,n){e.blockedOn===n&&(e.blockedOn=null,Dp||(Dp=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Bp)))}var U=null;function Hp(e){U!==e&&(U=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){U===e&&(U=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(Tp(r||n)===null)continue;break}var a=vt(n);a!==null&&(e.splice(t,3),t-=3,Os(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Up(e){function t(t){return Vp(t,e)}Op!==null&&Vp(Op,e),kp!==null&&Vp(kp,e),Ap!==null&&Vp(Ap,e),jp.forEach(t),Mp.forEach(t);for(var n=0;n<H.length;n++){var r=H[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<H.length&&(n=H[0],n.blockedOn===null);)Lp(n),n.blockedOn===null&&H.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[lt]||null;if(typeof a==`function`)o||Hp(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[lt]||null)s=o.formAction;else if(Tp(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Hp(n)}}}function Wp(){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 Gp(e){this._internalRoot=e}Kp.prototype.render=Gp.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(i(409));var n=t.current;mp(n,Su(),e,t,null,null)},Kp.prototype.unmount=Gp.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;mp(e.current,2,null,e,null,null),ku(),t[ut]=null}};function Kp(e){this._internalRoot=e}Kp.prototype.unstable_scheduleHydration=function(e){if(e){var t=at();e={blockedOn:null,target:e,priority:t};for(var n=0;n<H.length&&t!==0&&t<H[n].priority;n++);H.splice(n,0,e),n===0&&Lp(e)}};var qp=n.version;if(qp!==`19.2.5`)throw Error(i(527,qp,`19.2.5`));P.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:d(e),e=e===null?null:e.stateNode,e};var Jp={bundleType:0,version:`19.2.5`,rendererPackageName:`react-dom`,currentDispatcherRef:N,reconcilerVersion:`19.2.5`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var Yp=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Yp.isDisabled&&Yp.supportsFiber)try{Ie=Yp.inject(Jp),Le=Yp}catch{}}e.createRoot=function(e,t){if(!a(e))throw Error(i(299));var n=!1,r=``,o=B,s=Zs,c=Qs;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=fp(e,1,!1,null,null,n,r,null,o,s,c,Wp),e[ut]=t.current,Nd(e),new Gp(t)}})),Le=n(((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=Ie()})),Re=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},ze=new class extends Re{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},Be={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Ve=new class{#e=Be;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function He(e){setTimeout(e,0)}var Ue=typeof window>`u`||`Deno`in globalThis;function We(){}function Ge(e,t){return typeof e==`function`?e(t):e}function Ke(e){return typeof e==`number`&&e>=0&&e!==1/0}function qe(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Je(e,t){return typeof e==`function`?e(t):e}function Ye(e,t){return typeof e==`function`?e(t):e}function Xe(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==Qe(o,t.options))return!1}else if(!et(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function Ze(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if($e(t.options.mutationKey)!==$e(a))return!1}else if(!et(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function Qe(e,t){return(t?.queryKeyHashFn||$e)(e)}function $e(e){return JSON.stringify(e,(e,t)=>at(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function et(e,t){return e===t?!0:typeof e==typeof t&&e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(t).every(n=>et(e[n],t[n])):!1}var tt=Object.prototype.hasOwnProperty;function nt(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=it(e)&&it(t);if(!r&&!(at(e)&&at(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:tt.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=nt(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function rt(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function it(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function at(e){if(!ot(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!ot(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function ot(e){return Object.prototype.toString.call(e)===`[object Object]`}function st(e){return new Promise(t=>{Ve.setTimeout(t,e)})}function ct(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:nt(e,t)}function lt(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function ut(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var dt=Symbol();function ft(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===dt?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function pt(e,t){return typeof e==`function`?e(...t):!!e}function mt(e,t,n){let r=!1,i;return Object.defineProperty(e,`signal`,{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var ht=(()=>{let e=()=>Ue;return{isServer(){return e()},setIsServer(t){e=t}}})();function gt(){let e,t,n=new Promise((n,r)=>{e=n,t=r});n.status=`pending`,n.catch(()=>{});function r(e){Object.assign(n,e),delete n.resolve,delete n.reject}return n.resolve=t=>{r({status:`fulfilled`,value:t}),e(t)},n.reject=e=>{r({status:`rejected`,reason:e}),t(e)},n}var _t=He;function vt(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=_t,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var yt=vt(),bt=new class extends Re{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function xt(e){return Math.min(1e3*2**e,3e4)}function St(e){return(e??`online`)===`online`?bt.isOnline():!0}var Ct=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function wt(e){let t=!1,n=0,r,i=gt(),a=()=>i.status!==`pending`,o=t=>{if(!a()){let n=new Ct(t);f(n),e.onCancel?.(n)}},s=()=>{t=!0},c=()=>{t=!1},l=()=>ze.isFocused()&&(e.networkMode===`always`||bt.isOnline())&&e.canRun(),u=()=>St(e.networkMode)&&e.canRun(),d=e=>{a()||(r?.(),i.resolve(e))},f=e=>{a()||(r?.(),i.reject(e))},p=()=>new Promise(t=>{r=e=>{(a()||l())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,a()||e.onContinue?.()}),m=()=>{if(a())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(d).catch(r=>{if(a())return;let i=e.retry??(ht.isServer()?0:3),o=e.retryDelay??xt,s=typeof o==`function`?o(n,r):o,c=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!c){f(r);return}n++,e.onFail?.(n,r),st(s).then(()=>l()?void 0:p()).then(()=>{t?f(r):m()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(r?.(),i),cancelRetry:s,continueRetry:c,canStart:u,start:()=>(u()?m():p().then(m),i)}}var Tt=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Ke(this.gcTime)&&(this.#e=Ve.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(ht.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&(Ve.clearTimeout(this.#e),this.#e=void 0)}};function Et(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{mt(e,()=>t.signal,()=>n=!0)},u=ft(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=await u((()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})()),{maxPages:o}=t.options,s=i?ut:lt;return{pages:s(e.pages,a,o),pageParams:s(e.pageParams,r,o)}};if(i&&a.length){let e=i===`backward`,t=e?Ot:Dt,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:Dt(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.options.persister?t.fetchFn=()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=l}}}function Dt(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function Ot(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var kt=class extends Tt{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=Mt(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=Mt(this.options);e.data!==void 0&&(this.setState(jt(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=ct(this.state.data,e,this.options);return this.#l({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#l({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(We).catch(We):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>Ye(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===dt||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>Je(e.options.staleTime,this)===`static`):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!qe(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#a&&(this.#s||this.#c()?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}#c(){return this.state.fetchStatus===`paused`&&this.state.status===`pending`}invalidate(){this.state.isInvalidated||this.#l({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,`signal`,{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=ft(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?Et(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#l({type:`fetch`,meta:a.fetchOptions?.meta}),this.#a=wt({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof Ct&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#l({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#l({type:`pause`})},onContinue:()=>{this.#l({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await this.#a.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof Ct){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#l({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#l(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...At(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...jt(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),yt.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function At(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:St(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function jt(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function Mt(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var Nt=class extends Re{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=gt(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),Ft(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return It(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return It(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof Ye(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!rt(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&Lt(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||Ye(this.options.enabled,this.#t)!==Ye(t.enabled,this.#t)||Je(this.options.staleTime,this.#t)!==Je(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||Ye(this.options.enabled,this.#t)!==Ye(t.enabled,this.#t)||i!==this.#p)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return zt(this,n)&&(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),n===`promise`&&(this.trackProp(`data`),!this.options.experimental_prefetchInRender&&this.#o.status===`pending`&&this.#o.reject(Error(`experimental_prefetchInRender feature flag is not enabled`))),Reflect.get(e,n))})}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(We)),t}#g(){this.#b();let e=Je(this.options.staleTime,this.#t);if(ht.isServer()||this.#r.isStale||!Ke(e))return;let t=qe(this.#r.dataUpdatedAt,e)+1;this.#d=Ve.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#p=e,!(ht.isServer()||Ye(this.options.enabled,this.#t)===!1||!Ke(this.#p)||this.#p===0)&&(this.#f=Ve.setInterval(()=>{(this.options.refetchIntervalInBackground||ze.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d!==void 0&&(Ve.clearTimeout(this.#d),this.#d=void 0)}#x(){this.#f!==void 0&&(Ve.clearInterval(this.#f),this.#f=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&Ft(e,t),o=i&&Lt(e,n,t,r);(a||o)&&(l={...l,...At(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#u?.state.data,this.#u):t.placeholderData,e!==void 0&&(m=`success`,d=ct(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h)if(i&&d===a?.data&&t.select===this.#c)d=this.#l;else try{this.#c=t.select,d=t.select(d),d=ct(i?.data,d,t),this.#l=d,this.#s=null}catch(e){this.#s=e}this.#s&&(f=this.#s,d=this.#l,p=Date.now(),m=`error`);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,b=d!==void 0,x={status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:v,isInitialLoading:y,isLoading:y,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!b,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:v&&b,isStale:Rt(e,t),refetch:this.refetch,promise:this.#o,isEnabled:Ye(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=x.data!==void 0,r=x.status===`error`&&!t,i=e=>{r?e.reject(x.error):t&&e.resolve(x.data)},a=()=>{i(this.#o=x.promise=gt())},o=this.#o;switch(o.status){case`pending`:e.queryHash===n.queryHash&&i(o);break;case`fulfilled`:(r||x.data!==o.value)&&a();break;case`rejected`:(!r||x.error!==o.reason)&&a();break}}return x}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#u=this.#t),!rt(t,e)&&(this.#r=t,this.#C({listeners:(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#m.size)return!0;let r=new Set(n??this.#m);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})()}))}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#C(e){yt.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function Pt(e,t){return Ye(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&Ye(t.retryOnMount,e)===!1)}function Ft(e,t){return Pt(e,t)||e.state.data!==void 0&&It(e,t,t.refetchOnMount)}function It(e,t,n){if(Ye(t.enabled,e)!==!1&&Je(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&Rt(e,t)}return!1}function Lt(e,t,n,r){return(e!==t||Ye(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&Rt(e,n)}function Rt(e,t){return Ye(t.enabled,e)!==!1&&e.isStaleByTime(Je(t.staleTime,e))}function zt(e,t){return!rt(e.getCurrentResult(),t)}var Bt=class extends Tt{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||Vt(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=wt({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});let r=this.state.status===`pending`,i=!this.#r.canStart();try{if(r)t();else{this.#i({type:`pending`,variables:e,isPaused:i}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:i})}let a=await this.#r.start();return await this.#n.config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),this.#i({type:`success`,data:a}),a}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),yt.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Vt(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Ht=class extends Re{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){let r=new Bt({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=Ut(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=Ut(e);if(typeof t==`string`){let n=this.#t.get(t);if(n)if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=Ut(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}else return!0}runNext(e){let t=Ut(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){yt.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>Ze(t,e))}findAll(e={}){return this.getAll().filter(t=>Ze(e,t))}notify(e){yt.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return yt.batch(()=>Promise.all(e.map(e=>e.continue().catch(We))))}};function Ut(e){return e.options.scope?.id}var Wt=class extends Re{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),rt(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&$e(t.mutationKey)!==$e(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??Vt();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){yt.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}},Gt=class extends Re{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??Qe(r,t),a=this.get(i);return a||(a=new kt({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){yt.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>Xe(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>Xe(e,t)):t}notify(e){yt.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){yt.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){yt.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Kt=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Gt,this.#t=e.mutationCache||new Ht,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=ze.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=bt.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(Je(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=Ge(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return yt.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;yt.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return yt.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=yt.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(We).catch(We)}invalidateQueries(e,t={}){return yt.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=yt.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(We)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(We)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(Je(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(We).catch(We)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(We).catch(We)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return bt.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set($e(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{et(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set($e(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{et(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=Qe(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===dt&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},qt=n((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})),Jt=n(((e,t)=>{t.exports=qt()})),L=t(je(),1),R=Jt(),Yt=L.createContext(void 0),Xt=e=>{let t=L.useContext(Yt);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},Zt=({client:e,children:t})=>(L.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,R.jsx)(Yt.Provider,{value:e,children:t})),Qt=L.createContext(!1),$t=()=>L.useContext(Qt);Qt.Provider;function en(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var tn=L.createContext(en()),nn=()=>L.useContext(tn),rn=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?pt(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},an=e=>{L.useEffect(()=>{e.clearReset()},[e])},on=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||pt(n,[e.error,r])),sn=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},cn=(e,t)=>e.isLoading&&e.isFetching&&!t,ln=(e,t)=>e?.suspense&&t.isPending,un=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function dn(e,t,n){let r=$t(),i=nn(),a=Xt(n),o=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(o);let s=a.getQueryCache().get(o.queryHash);o._optimisticResults=r?`isRestoring`:`optimistic`,sn(o),rn(o,i,s),an(i);let c=!a.getQueryCache().get(o.queryHash),[l]=L.useState(()=>new t(a,o)),u=l.getOptimisticResult(o),d=!r&&e.subscribed!==!1;if(L.useSyncExternalStore(L.useCallback(e=>{let t=d?l.subscribe(yt.batchCalls(e)):We;return l.updateResult(),t},[l,d]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),L.useEffect(()=>{l.setOptions(o)},[o,l]),ln(o,u))throw un(o,l,i);if(on({result:u,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw u.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(o,u),o.experimental_prefetchInRender&&!ht.isServer()&&cn(u,r)&&(c?un(o,l,i):s?.promise)?.catch(We).finally(()=>{l.updateResult()}),o.notifyOnChangeProps?u:l.trackResult(u)}function fn(e,t){return dn(e,Nt,t)}function pn(e,t){let n=Xt(t),[r]=L.useState(()=>new Wt(n,e));L.useEffect(()=>{r.setOptions(e)},[r,e]);let i=L.useSyncExternalStore(L.useCallback(e=>r.subscribe(yt.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=L.useCallback((e,t)=>{r.mutate(e,t).catch(We)},[r]);if(i.error&&pt(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}var mn=typeof window<`u`?L.useLayoutEffect:L.useEffect;function hn(e){let t=L.useRef({value:e,prev:null}),n=t.current.value;return e!==n&&(t.current={value:e,prev:n}),t.current.prev}function gn(e,t,n={},r={}){L.useEffect(()=>{if(!e.current||r.disabled||typeof IntersectionObserver!=`function`)return;let i=new IntersectionObserver(([e])=>{t(e)},n);return i.observe(e.current),()=>{i.disconnect()}},[t,n,r.disabled,e])}function _n(e){let t=L.useRef(null);return L.useImperativeHandle(e,()=>t.current,[]),t}function vn(e){return e[e.length-1]}function yn(e){return typeof e==`function`}function bn(e,t){return yn(e)?e(t):e}var xn=Object.prototype.hasOwnProperty,Sn=Object.prototype.propertyIsEnumerable;function Cn(e){for(let t in e)if(xn.call(e,t))return!0;return!1}var wn=()=>Object.create(null),Tn=(e,t)=>En(e,t,wn);function En(e,t,n=()=>({}),r=0){if(e===t)return e;if(r>500)return t;let i=t,a=An(e)&&An(i);if(!a&&!(On(e)&&On(i)))return i;let o=a?e:Dn(e);if(!o)return i;let s=a?i:Dn(i);if(!s)return i;let c=o.length,l=s.length,u=a?Array(l):n(),d=0;for(let t=0;t<l;t++){let o=a?t:s[t],l=e[o],f=i[o];if(l===f){u[o]=l,(a?t<c:xn.call(e,o))&&d++;continue}if(l===null||f===null||typeof l!=`object`||typeof f!=`object`){u[o]=f;continue}let p=En(l,f,n,r+1);u[o]=p,p===l&&d++}return c===l&&d===c?e:u}function Dn(e){let t=Object.getOwnPropertyNames(e);for(let n of t)if(!Sn.call(e,n))return!1;let n=Object.getOwnPropertySymbols(e);if(n.length===0)return t;let r=t;for(let t of n){if(!Sn.call(e,t))return!1;r.push(t)}return r}function On(e){if(!kn(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!kn(n)||!n.hasOwnProperty(`isPrototypeOf`))}function kn(e){return Object.prototype.toString.call(e)===`[object Object]`}function An(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function jn(e,t,n){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let r=0,i=e.length;r<i;r++)if(!jn(e[r],t[r],n))return!1;return!0}if(On(e)&&On(t)){let r=n?.ignoreUndefined??!0;if(n?.partial){for(let i in t)if((!r||t[i]!==void 0)&&!jn(e[i],t[i],n))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++;let a=0;for(let o in t)if((!r||t[o]!==void 0)&&(a++,a>i||!jn(e[o],t[o],n)))return!1;return i===a}return!1}function Mn(e){let t,n,r=new Promise((e,r)=>{t=e,n=r});return r.status=`pending`,r.resolve=n=>{r.status=`resolved`,r.value=n,t(n),e?.(n)},r.reject=e=>{r.status=`rejected`,n(e)},r}function Nn(e){return!!(e&&typeof e==`object`&&typeof e.then==`function`)}function Pn(e){return e.replace(/[\x00-\x1f\x7f]/g,``)}function Fn(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 Pn(t)}var In=[`http:`,`https:`,`mailto:`,`tel:`];function Ln(e,t){if(!e)return!1;try{let n=new URL(e);return!t.has(n.protocol)}catch{return!1}}function Rn(e){if(!e||!/[%\\\x00-\x1f\x7f]/.test(e)&&!e.startsWith(`//`))return{path:e,handledProtocolRelativeURL:!1};let t=/%25|%5C/gi,n=0,r=``,i;for(;(i=t.exec(e))!==null;)r+=Fn(e.slice(n,i.index))+i[0],n=t.lastIndex;r+=Fn(n?e.slice(n):e);let a=!1;return r.startsWith(`//`)&&(a=!0,r=`/`+r.replace(/^\/+/,``)),{path:r,handledProtocolRelativeURL:a}}function zn(e){return/\s|[^\u0000-\u007F]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function Bn(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 Vn(){throw Error(`Invariant failed`)}function Hn(e){let t=new Map,n,r,i=e=>{e.next&&(e.prev?(e.prev.next=e.next,e.next.prev=e.prev,e.next=void 0,r&&(r.next=e,e.prev=r)):(e.next.prev=void 0,n=e.next,e.next=void 0,r&&(e.prev=r,r.next=e)),r=e)};return{get(e){let n=t.get(e);if(n)return i(n),n.value},set(a,o){if(t.size>=e&&n){let e=n;t.delete(e.key),e.next&&(n=e.next,e.next.prev=void 0),e===r&&(r=void 0)}let s=t.get(a);if(s)s.value=o,i(s);else{let e={key:a,value:o,prev:r};r&&(r.next=e),r=e,n||=e,t.set(a,e)}},clear(){t.clear(),n=void 0,r=void 0}}}var Un=4,Wn=5;function Gn(e){let t=e.indexOf(`{`);if(t===-1)return null;let n=e.indexOf(`}`,t);return n===-1||t+1>=e.length?null:[t,n]}function Kn(e,t,n=new Uint16Array(6)){let r=e.indexOf(`/`,t),i=r===-1?e.length:r,a=e.substring(t,i);if(!a||!a.includes(`$`))return n[0]=0,n[1]=t,n[2]=t,n[3]=i,n[4]=i,n[5]=i,n;if(a===`$`){let r=e.length;return n[0]=2,n[1]=t,n[2]=t,n[3]=r,n[4]=r,n[5]=r,n}if(a.charCodeAt(0)===36)return n[0]=1,n[1]=t,n[2]=t+1,n[3]=i,n[4]=i,n[5]=i,n;let o=Gn(a);if(o){let[r,s]=o,c=a.charCodeAt(r+1);if(c===45){if(r+2<a.length&&a.charCodeAt(r+2)===36){let e=r+3,a=s;if(e<a)return n[0]=3,n[1]=t+r,n[2]=t+e,n[3]=t+a,n[4]=t+s+1,n[5]=i,n}}else if(c===36){let a=r+1,o=r+2;return o===s?(n[0]=2,n[1]=t+r,n[2]=t+a,n[3]=t+o,n[4]=t+s+1,n[5]=e.length,n):(n[0]=1,n[1]=t+r,n[2]=t+o,n[3]=t+s,n[4]=t+s+1,n[5]=i,n)}}return n[0]=0,n[1]=t,n[2]=t,n[3]=i,n[4]=i,n[5]=i,n}function qn(e,t,n,r,i,a,o){o?.(n);let s=r;{let r=n.fullPath??n.from,o=r.length,c=n.options?.caseSensitive??e,l=n.options?.params?.parse??n.options?.parseParams;for(;s<o;){let e=Kn(r,s,t),o,u=s,d=e[5];switch(s=d+1,a++,e[0]){case 0:{let t=r.substring(e[2],e[3]);if(c){let e=i.static?.get(t);if(e)o=e;else{i.static??=new Map;let e=Xn(n.fullPath??n.from);e.parent=i,e.depth=a,o=e,i.static.set(t,e)}}else{let e=t.toLowerCase(),r=i.staticInsensitive?.get(e);if(r)o=r;else{i.staticInsensitive??=new Map;let t=Xn(n.fullPath??n.from);t.parent=i,t.depth=a,o=t,i.staticInsensitive.set(e,t)}}break}case 1:{let t=r.substring(u,e[1]),s=r.substring(e[4],d),f=c&&!!(t||s),p=t?f?t:t.toLowerCase():void 0,m=s?f?s:s.toLowerCase():void 0,h=!l&&i.dynamic?.find(e=>!e.parse&&e.caseSensitive===f&&e.prefix===p&&e.suffix===m);if(h)o=h;else{let e=Zn(1,n.fullPath??n.from,f,p,m);o=e,e.depth=a,e.parent=i,i.dynamic??=[],i.dynamic.push(e)}break}case 3:{let t=r.substring(u,e[1]),s=r.substring(e[4],d),f=c&&!!(t||s),p=t?f?t:t.toLowerCase():void 0,m=s?f?s:s.toLowerCase():void 0,h=!l&&i.optional?.find(e=>!e.parse&&e.caseSensitive===f&&e.prefix===p&&e.suffix===m);if(h)o=h;else{let e=Zn(3,n.fullPath??n.from,f,p,m);o=e,e.parent=i,e.depth=a,i.optional??=[],i.optional.push(e)}break}case 2:{let t=r.substring(u,e[1]),s=r.substring(e[4],d),l=c&&!!(t||s),f=t?l?t:t.toLowerCase():void 0,p=s?l?s:s.toLowerCase():void 0,m=Zn(2,n.fullPath??n.from,l,f,p);o=m,m.parent=i,m.depth=a,i.wildcard??=[],i.wildcard.push(m)}}i=o}if(l&&n.children&&!n.isRoot&&n.id&&n.id.charCodeAt(n.id.lastIndexOf(`/`)+1)===95){let e=Xn(n.fullPath??n.from);e.kind=Wn,e.parent=i,a++,e.depth=a,i.pathless??=[],i.pathless.push(e),i=e}let u=(n.path||!n.children)&&!n.isRoot;if(u&&r.endsWith(`/`)){let e=Xn(n.fullPath??n.from);e.kind=Un,e.parent=i,a++,e.depth=a,i.index=e,i=e}i.parse=l??null,u&&!i.route&&(i.route=n,i.fullPath=n.fullPath??n.from)}if(n.children)for(let r of n.children)qn(e,t,r,s,i,a,o)}function Jn(e,t){if(e.parse&&!t.parse)return-1;if(!e.parse&&t.parse)return 1;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 Yn(e){if(e.pathless)for(let t of e.pathless)Yn(t);if(e.static)for(let t of e.static.values())Yn(t);if(e.staticInsensitive)for(let t of e.staticInsensitive.values())Yn(t);if(e.dynamic?.length){e.dynamic.sort(Jn);for(let t of e.dynamic)Yn(t)}if(e.optional?.length){e.optional.sort(Jn);for(let t of e.optional)Yn(t)}if(e.wildcard?.length){e.wildcard.sort(Jn);for(let t of e.wildcard)Yn(t)}}function Xn(e){return{kind:0,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:e,parent:null,parse:null}}function Zn(e,t,n,r,i){return{kind:e,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:t,parent:null,parse:null,caseSensitive:n,prefix:r,suffix:i}}function Qn(e,t){let n=Xn(`/`),r=new Uint16Array(6);for(let t of e)qn(!1,r,t,1,n,0);Yn(n),t.masksTree=n,t.flatCache=Hn(1e3)}function $n(e,t){e||=`/`;let n=t.flatCache.get(e);if(n)return n;let r=ir(e,t.masksTree);return t.flatCache.set(e,r),r}function er(e,t,n,r,i){e||=`/`,r||=`/`;let a=t?`case\0${e}`:e,o=i.singleCache.get(a);return o||(o=Xn(`/`),qn(t,new Uint16Array(6),{from:e},1,o,0),i.singleCache.set(a,o)),ir(r,o,n)}function tr(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=ir(e,t.segmentTree,n)}catch(e){if(e instanceof URIError)a=null;else throw e}return a&&(a.branch=or(a.route)),t.matchCache.set(r,a),a}function nr(e){return e===`/`?e:e.replace(/\/{1,}$/,``)}function rr(e,t=!1,n){let r=Xn(e.fullPath),i=new Uint16Array(6),a={},o={},s=0;return qn(t,i,e,1,r,0,e=>{if(n?.(e,s),e.id in a&&Vn(),a[e.id]=e,s!==0&&e.path){let t=nr(e.fullPath);(!o[t]||e.fullPath.endsWith(`/`))&&(o[t]=e)}s++}),Yn(r),{processedTree:{segmentTree:r,singleCache:Hn(1e3),matchCache:Hn(1e3),flatCache:null,masksTree:null},routesById:a,routesByPath:o}}function ir(e,t,n=!1){let r=e.split(`/`),i=cr(e,r,t,n);if(!i)return null;let[a]=ar(e,r,i);return{route:i.node.route,rawParams:a}}function ar(e,t,n){let r=sr(n.node),i=null,a=Object.create(null),o=n.extract?.part??0,s=n.extract?.node??0,c=n.extract?.path??0,l=n.extract?.segment??0;for(;s<r.length;o++,s++,c++,l++){let u=r[s];if(u.kind===Un)break;if(u.kind===Wn){l--,o--,c--;continue}let d=t[o],f=c;if(d&&(c+=d.length),u.kind===1){i??=n.node.fullPath.split(`/`);let e=i[l],t=u.prefix?.length??0;if(e.charCodeAt(t)===123){let n=u.suffix?.length??0,r=e.substring(t+2,e.length-n-1),i=d.substring(t,d.length-n);a[r]=decodeURIComponent(i)}else{let t=e.substring(1);a[t]=decodeURIComponent(d)}}else if(u.kind===3){if(n.skipped&1<<s){o--,c=f-1;continue}i??=n.node.fullPath.split(`/`);let e=i[l],t=u.prefix?.length??0,r=u.suffix?.length??0,p=e.substring(t+3,e.length-r-1),m=u.suffix||u.prefix?d.substring(t,d.length-r):d;m&&(a[p]=decodeURIComponent(m))}else if(u.kind===2){let t=u,n=e.substring(f+(t.prefix?.length??0),e.length-(t.suffix?.length??0)),r=decodeURIComponent(n);a[`*`]=r,a._splat=r;break}}return n.rawParams&&Object.assign(a,n.rawParams),[a,{part:o,node:s,path:c,segment:l}]}function or(e){let t=[e];for(;e.parentRoute;)e=e.parentRoute,t.push(e);return t.reverse(),t}function sr(e){let t=Array(e.depth+1);do t[e.depth]=e,e=e.parent;while(e);return t}function cr(e,t,n,r){if(e===`/`&&n.index)return{node:n.index,skipped:0};let i=!vn(t),a=i&&e!==`/`,o=t.length-+!!i,s=[{node:n,index:1,skipped:0,depth:1,statics:0,dynamics:0,optionals:0}],c=null,l=null;for(;s.length;){let n=s.pop(),{node:i,index:u,skipped:d,depth:f,statics:p,dynamics:m,optionals:h}=n,{extract:g,rawParams:_}=n;if(i.kind===2&&i.route&&!fr(l,n))continue;if(i.parse){if(!dr(e,t,n))continue;_=n.rawParams,g=n.extract}r&&i.route&&i.kind!==Un&&fr(c,n)&&(c=n);let v=u===o;if(v&&(i.route&&(!a||i.kind===Un||i.kind===2)&&fr(l,n)&&(l=n),!i.optional&&!i.wildcard&&!i.index&&!i.pathless))continue;let y=v?void 0:t[u],b;if(v&&i.index){let n={node:i.index,index:u,skipped:d,depth:f+1,statics:p,dynamics:m,optionals:h,extract:g,rawParams:_},r=!0;if(i.index.parse&&(dr(e,t,n)||(r=!1)),r){if(!m&&!h&&!d&&ur(p,o))return n;fr(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&&(v||!(n.caseSensitive?y:b??=y.toLowerCase()).startsWith(r)))){if(a){if(v)continue;let e=t.slice(u).join(`/`).slice(-a.length);if((n.caseSensitive?e:e.toLowerCase())!==a)continue}s.push({node:n,index:o,skipped:d,depth:f+1,statics:p,dynamics:m,optionals:h,extract:g,rawParams:_})}}if(i.optional){let e=d|1<<f,t=f+1;for(let n=i.optional.length-1;n>=0;n--){let r=i.optional[n];s.push({node:r,index:u,skipped:e,depth:t,statics:p,dynamics:m,optionals:h,extract:g,rawParams:_})}if(!v)for(let e=i.optional.length-1;e>=0;e--){let n=i.optional[e],{prefix:r,suffix:a}=n;if(r||a){let e=n.caseSensitive?y:b??=y.toLowerCase();if(r&&!e.startsWith(r)||a&&!e.endsWith(a))continue}s.push({node:n,index:u+1,skipped:d,depth:t,statics:p,dynamics:m,optionals:h+lr(o,u),extract:g,rawParams:_})}}if(!v&&i.dynamic&&y)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?y:b??=y.toLowerCase();if(n&&!e.startsWith(n)||r&&!e.endsWith(r))continue}s.push({node:t,index:u+1,skipped:d,depth:f+1,statics:p,dynamics:m+lr(o,u),optionals:h,extract:g,rawParams:_})}if(!v&&i.staticInsensitive){let e=i.staticInsensitive.get(b??=y.toLowerCase());e&&s.push({node:e,index:u+1,skipped:d,depth:f+1,statics:p+lr(o,u),dynamics:m,optionals:h,extract:g,rawParams:_})}if(!v&&i.static){let e=i.static.get(y);e&&s.push({node:e,index:u+1,skipped:d,depth:f+1,statics:p+lr(o,u),dynamics:m,optionals:h,extract:g,rawParams:_})}if(i.pathless){let e=f+1;for(let t=i.pathless.length-1;t>=0;t--){let n=i.pathless[t];s.push({node:n,index:u,skipped:d,depth:e,statics:p,dynamics:m,optionals:h,extract:g,rawParams:_})}}}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 lr(e,t){return 2**(e-t-1)}function ur(e,t){return e===2**(t-1)-1}function dr(e,t,n){let r,i;try{[r,i]=ar(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 fr(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===Un)>(e.node.kind===Un)||t.node.kind===Un==(e.node.kind===Un)&&t.depth>e.depth))):!0}function pr(e){return mr(e.filter(e=>e!==void 0).join(`/`))}function mr(e){return e.replace(/\/{2,}/g,`/`)}function hr(e){return e===`/`?e:e.replace(/^\/{1,}/,``)}function gr(e){let t=e.length;return t>1&&e[t-1]===`/`?e.replace(/\/{1,}$/,``):e}function _r(e){return gr(hr(e))}function vr(e,t){return e?.endsWith(`/`)&&e!==`/`&&e!==`${t}/`?e.slice(0,-1):e}function yr(e,t,n){return vr(e,n)===vr(t,n)}function br({base:e,to:t,trailingSlash:n=`never`,cache:r}){let i=t.startsWith(`/`),a=!i&&t===`.`,o;if(r){o=i?t:a?e:e+`\0`+t;let n=r.get(o);if(n)return n}let s;if(a)s=e.split(`/`);else if(i)s=t.split(`/`);else{for(s=e.split(`/`);s.length>1&&vn(s)===``;)s.pop();let n=t.split(`/`);for(let e=0,t=n.length;e<t;e++){let r=n[e];r===``?e?e===t-1&&s.push(r):s=[r]:r===`..`?s.pop():r===`.`||s.push(r)}}s.length>1&&(vn(s)===``?n===`never`&&s.pop():n===`always`&&s.push(``));let c=mr(s.join(`/`))||`/`;return o&&r&&r.set(o,c),c}function xr(e){let t=new Map(e.map(e=>[encodeURIComponent(e),e])),n=Array.from(t.keys()).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).join(`|`),r=new RegExp(n,`g`);return e=>e.replace(r,e=>t.get(e)??e)}function Sr(e,t,n){let r=t[e];return typeof r==`string`?e===`_splat`?/^[a-zA-Z0-9\-._~!/]*$/.test(r)?r:r.split(`/`).map(e=>wr(e,n)).join(`/`):wr(r,n):r}function Cr({path:e,params:t,decoder:n,...r}){let i=!1,a=Object.create(null);if(!e||e===`/`)return{interpolatedPath:`/`,usedParams:a,isMissingParams:i};if(!e.includes(`$`))return{interpolatedPath:e,usedParams:a,isMissingParams:i};let o=e.length,s=0,c,l=``;for(;s<o;){let r=s;c=Kn(e,r,c);let o=c[5];if(s=o+1,r===o)continue;let u=c[0];if(u===0){l+=`/`+e.substring(r,o);continue}if(u===2){let s=t._splat;a._splat=s,a[`*`]=s;let u=e.substring(r,c[1]),d=e.substring(c[4],o);if(!s){i=!0,(u||d)&&(l+=`/`+u+d);continue}let f=Sr(`_splat`,t,n);l+=`/`+u+f+d;continue}if(u===1){let s=e.substring(c[2],c[3]);!i&&!(s in t)&&(i=!0),a[s]=t[s];let u=e.substring(r,c[1]),d=e.substring(c[4],o),f=Sr(s,t,n)??`undefined`;l+=`/`+u+f+d;continue}if(u===3){let i=e.substring(c[2],c[3]),s=t[i];if(s==null)continue;a[i]=s;let u=e.substring(r,c[1]),d=e.substring(c[4],o),f=Sr(i,t,n)??``;l+=`/`+u+f+d;continue}}return e.endsWith(`/`)&&(l+=`/`),{usedParams:a,interpolatedPath:l||`/`,isMissingParams:i}}function wr(e,t){let n=encodeURIComponent(e);return t?.(n)??n}function Tr(e){return e?.isNotFound===!0}function Er(){try{return typeof window<`u`&&typeof window.sessionStorage==`object`?window.sessionStorage:void 0}catch{return}}var Dr=`tsr-scroll-restoration-v1_3`;function Or(){let e=Er();if(!e)return null;let t={};try{let n=JSON.parse(e.getItem(`tsr-scroll-restoration-v1_3`)||`{}`);On(n)&&(t=n)}catch{}return{get state(){return t},set:e=>{t=bn(e,t)||t},persist:()=>{try{e.setItem(Dr,JSON.stringify(t))}catch{}}}}var kr=Or(),Ar=e=>e.state.__TSR_key||e.href;function jr(e){let t=[],n;for(;n=e.parentNode;)t.push(`${e.tagName}:nth-child(${Array.prototype.indexOf.call(n.children,e)+1})`),e=n;return`${t.reverse().join(` > `)}`.toLowerCase()}var Mr=!1,Nr=`window`,Pr=`data-scroll-restoration-id`;function Fr(e,t){if(!kr)return;let n=kr;if((t??e.options.scrollRestoration??!1)&&(e.isScrollRestoring=!0),e.isScrollRestorationSetup||!n)return;e.isScrollRestorationSetup=!0,Mr=!1;let r=e.options.getScrollRestorationKey||Ar,i=new Map;window.history.scrollRestoration=`manual`;let a=t=>{if(!(Mr||!e.isScrollRestoring))if(t.target===document||t.target===window)i.set(Nr,{scrollX:window.scrollX||0,scrollY:window.scrollY||0});else{let e=t.target;i.set(e,{scrollX:e.scrollLeft||0,scrollY:e.scrollTop||0})}},o=t=>{if(!e.isScrollRestoring||!t||i.size===0||!n)return;let r=n.state[t]||={};for(let[e,t]of i){let n;if(e===Nr)n=Nr;else if(e.isConnected){let t=e.getAttribute(Pr);n=t?`[${Pr}="${t}"]`:jr(e)}n&&(r[n]=t)}};document.addEventListener(`scroll`,a,!0),e.subscribe(`onBeforeLoad`,e=>{o(e.fromLocation?r(e.fromLocation):void 0),i.clear()}),window.addEventListener(`pagehide`,()=>{o(r(e.stores.resolvedLocation.get()??e.stores.location.get())),n.persist()}),e.subscribe(`onRendered`,t=>{let a=r(t.toLocation),o=e.options.scrollRestorationBehavior,s=e.options.scrollToTopSelectors;if(i.clear(),!e.resetNextScroll){e.resetNextScroll=!0;return}if(!(typeof e.options.scrollRestoration==`function`&&!e.options.scrollRestoration({location:e.latestLocation}))){Mr=!0;try{let t=e.isScrollRestoring?n.state[a]:void 0,r=!1;if(t)for(let e in t){let n=t[e];if(!On(n))continue;let{scrollX:i,scrollY:a}=n;if(!(!Number.isFinite(i)||!Number.isFinite(a))){if(e===Nr)window.scrollTo({top:a,left:i,behavior:o}),r=!0;else if(e){let t;try{t=document.querySelector(e)}catch{continue}t&&(t.scrollLeft=i,t.scrollTop=a,r=!0)}}}if(!r){let t=e.history.location.hash.slice(1);if(t){let e=window.history.state?.__hashScrollIntoViewOptions??!0;if(e){let n=document.getElementById(t);n&&n.scrollIntoView(e)}}else{let e={top:0,left:0,behavior:o};if(window.scrollTo(e),s)for(let t of s){if(t===Nr)continue;let n=typeof t==`function`?t():document.querySelector(t);n&&n.scrollTo(e)}}}}finally{Mr=!1}e.isScrollRestoring&&n.set(e=>(e[a]||={},e))}})}function Ir(e,t=String){let n=new URLSearchParams;for(let r in e){let i=e[r];i!==void 0&&n.set(r,t(i))}return n.toString()}function Lr(e){return e?e===`false`?!1:e===`true`?!0:e*0==0&&+e+``===e?+e:e:``}function Rr(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]=Lr(r):Array.isArray(t)?t.push(Lr(r)):n[e]=[t,Lr(r)]}return n}var zr=Vr(JSON.parse),Br=Hr(JSON.stringify,JSON.parse);function Vr(e){return t=>{t[0]===`?`&&(t=t.substring(1));let n=Rr(t);for(let t in n){let r=n[t];if(typeof r==`string`)try{n[t]=e(r)}catch{}}return n}}function Hr(e,t){let n=typeof t==`function`;function r(r){if(typeof r==`object`&&r)try{return e(r)}catch{}else if(n&&typeof r==`string`)try{return t(r),e(r)}catch{}return r}return e=>{let t=Ir(e,r);return t?`?${t}`:``}}var Ur=`__root__`;function Wr(e){if(e.statusCode=e.statusCode||e.code||307,!e._builtLocation&&!e.reloadDocument&&typeof e.href==`string`)try{new URL(e.href),e.reloadDocument=!0}catch{}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 Gr(e){return e instanceof Response&&!!e.options}function Kr(e){return{input:({url:t})=>{for(let n of e)t=Jr(n,t);return t},output:({url:t})=>{for(let n=e.length-1;n>=0;n--)t=Yr(e[n],t);return t}}}function qr(e){let t=_r(e.basepath),n=`/${t}`,r=`${n}/`,i=e.caseSensitive?n:n.toLowerCase(),a=e.caseSensitive?r:r.toLowerCase();return{input:({url:t})=>{let r=e.caseSensitive?t.pathname:t.pathname.toLowerCase();return r===i?t.pathname=`/`:r.startsWith(a)&&(t.pathname=t.pathname.slice(n.length)),t},output:({url:e})=>(e.pathname=pr([`/`,t,e.pathname]),e)}}function Jr(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 Yr(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 Xr(e,t){let{createMutableStore:n,createReadonlyStore:r,batch:i,init:a}=t,o=new Map,s=new Map,c=new Map,l=n(e.status),u=n(e.loadedAt),d=n(e.isLoading),f=n(e.isTransitioning),p=n(e.location),m=n(e.resolvedLocation),h=n(e.statusCode),g=n(e.redirect),_=n([]),v=n([]),y=n([]),b=r(()=>Zr(o,_.get())),x=r(()=>Zr(s,v.get())),S=r(()=>Zr(c,y.get())),C=r(()=>_.get()[0]),w=r(()=>_.get().some(e=>o.get(e)?.get().status===`pending`)),T=r(()=>({locationHref:p.get().href,resolvedLocationHref:m.get()?.href,status:l.get()})),E=r(()=>({status:l.get(),loadedAt:u.get(),isLoading:d.get(),isTransitioning:f.get(),matches:b.get(),location:p.get(),resolvedLocation:m.get(),statusCode:h.get(),redirect:g.get()})),D=Hn(64);function O(e){let t=D.get(e);return t||(t=r(()=>{let t=_.get();for(let n of t){let t=o.get(n);if(t&&t.routeId===e)return t.get()}}),D.set(e,t)),t}let k={status:l,loadedAt:u,isLoading:d,isTransitioning:f,location:p,resolvedLocation:m,statusCode:h,redirect:g,matchesId:_,pendingIds:v,cachedIds:y,matches:b,pendingMatches:x,cachedMatches:S,firstId:C,hasPending:w,matchRouteDeps:T,matchStores:o,pendingMatchStores:s,cachedMatchStores:c,__store:E,getRouteMatchStore:O,setMatches:A,setPending:j,setCached:M};A(e.matches),a?.(k);function A(e){Qr(e,o,_,n,i)}function j(e){Qr(e,s,v,n,i)}function M(e){Qr(e,c,y,n,i)}return k}function Zr(e,t){let n=[];for(let r of t){let t=e.get(r);t&&n.push(t.get())}return n}function Qr(e,t,n,r,i){let a=e.map(e=>e.id),o=new Set(a);i(()=>{for(let e of t.keys())o.has(e)||t.delete(e);for(let n of e){let e=t.get(n.id);if(!e){let e=r(n);e.routeId=n.routeId,t.set(n.id,e);continue}e.routeId=n.routeId,e.get()!==n&&e.set(n)}Bn(n.get(),a)||n.set(a)})}var $r=e=>{if(!e.rendered)return e.rendered=!0,e.onReady?.()},ei=e=>e.stores.matchesId.get().some(t=>e.stores.matchStores.get(t)?.get()._forcePending),ti=(e,t)=>!!(e.preload&&!e.router.stores.matchStores.has(t)),ni=(e,t,n=!0)=>{let r={...e.router.options.context??{}},i=n?t:t-1;for(let t=0;t<=i;t++){let n=e.matches[t];if(!n)continue;let i=e.router.getMatch(n.id);i&&Object.assign(r,i.__routeContext,i.__beforeLoadContext)}return r},ri=(e,t)=>{if(!e.matches.length)return;let n=t.routeId,r=e.matches.findIndex(t=>t.routeId===e.router.routeTree.id),i=r>=0?r:0,a=n?e.matches.findIndex(e=>e.routeId===n):e.firstBadMatchIndex??e.matches.length-1;a<0&&(a=i);for(let t=a;t>=0;t--){let n=e.matches[t];if(e.router.looseRoutesById[n.routeId].options.notFoundComponent)return t}return n?a:i},ii=(e,t,n)=>{if(!(!Gr(n)&&!Tr(n)))throw Gr(n)&&n.redirectHandled&&!n.options.reloadDocument?n:(t&&(t._nonReactive.beforeLoadPromise?.resolve(),t._nonReactive.loaderPromise?.resolve(),t._nonReactive.beforeLoadPromise=void 0,t._nonReactive.loaderPromise=void 0,t._nonReactive.error=n,e.updateMatch(t.id,r=>({...r,status:Gr(n)?`redirected`:Tr(n)?`notFound`:r.status===`pending`?`success`:r.status,context:ni(e,t.index),isFetching:!1,error:n})),Tr(n)&&!n.routeId&&(n.routeId=t.routeId),t._nonReactive.loadPromise?.resolve()),Gr(n)&&(e.rendered=!0,n.options._fromLocation=e.location,n.redirectHandled=!0,n=e.router.resolveRedirect(n)),n)},ai=(e,t)=>{let n=e.router.getMatch(t);return!!(!n||n._nonReactive.dehydrated)},oi=(e,t,n)=>{let r=ni(e,n);e.updateMatch(t,e=>({...e,context:r}))},si=(e,t,n,r)=>{let{id:i,routeId:a}=e.matches[t],o=e.router.looseRoutesById[a];if(n instanceof Promise)throw n;n.routerCode=r,e.firstBadMatchIndex??=t,ii(e,e.router.getMatch(i),n);try{o.options.onError?.(n)}catch(t){n=t,ii(e,e.router.getMatch(i),n)}e.updateMatch(i,e=>(e._nonReactive.beforeLoadPromise?.resolve(),e._nonReactive.beforeLoadPromise=void 0,e._nonReactive.loadPromise?.resolve(),{...e,error:n,status:`error`,isFetching:!1,updatedAt:Date.now(),abortController:new AbortController})),!e.preload&&!Gr(n)&&!Tr(n)&&(e.serialError??=n)},ci=(e,t,n,r)=>{if(r._nonReactive.pendingTimeout!==void 0)return;let i=n.options.pendingMs??e.router.options.defaultPendingMs;if(e.onReady&&!ti(e,t)&&(n.options.loader||n.options.beforeLoad||yi(n))&&typeof i==`number`&&i!==1/0&&(n.options.pendingComponent??e.router.options?.defaultPendingComponent)){let t=setTimeout(()=>{$r(e)},i);r._nonReactive.pendingTimeout=t}},li=(e,t,n)=>{let r=e.router.getMatch(t);if(!r._nonReactive.beforeLoadPromise&&!r._nonReactive.loaderPromise)return;ci(e,t,n,r);let i=()=>{let n=e.router.getMatch(t);n.preload&&(n.status===`redirected`||n.status===`notFound`)&&ii(e,n,n.error)};return r._nonReactive.beforeLoadPromise?r._nonReactive.beforeLoadPromise.then(i):i()},ui=(e,t,n,r)=>{let i=e.router.getMatch(t),a=i._nonReactive.loadPromise;i._nonReactive.loadPromise=Mn(()=>{a?.resolve(),a=void 0});let{paramsError:o,searchError:s}=i;o&&si(e,n,o,`PARSE_PARAMS`),s&&si(e,n,s,`VALIDATE_SEARCH`),ci(e,t,r,i);let c=new AbortController,l=!1,u=()=>{l||(l=!0,e.updateMatch(t,e=>({...e,isFetching:`beforeLoad`,fetchCount:e.fetchCount+1,abortController:c})))},d=()=>{i._nonReactive.beforeLoadPromise?.resolve(),i._nonReactive.beforeLoadPromise=void 0,e.updateMatch(t,e=>({...e,isFetching:!1}))};if(!r.options.beforeLoad){e.router.batch(()=>{u(),d()});return}i._nonReactive.beforeLoadPromise=Mn();let f={...ni(e,n,!1),...i.__routeContext},{search:p,params:m,cause:h}=i,g=ti(e,t),_={search:p,abortController:c,params:m,preload:g,context:f,location:e.location,navigate:t=>e.router.navigate({...t,_fromLocation:e.location}),buildLocation:e.router.buildLocation,cause:g?`preload`:h,matches:e.matches,routeId:r.id,...e.router.options.additionalContext},v=r=>{if(r===void 0){e.router.batch(()=>{u(),d()});return}(Gr(r)||Tr(r))&&(u(),si(e,n,r,`BEFORE_LOAD`)),e.router.batch(()=>{u(),e.updateMatch(t,e=>({...e,__beforeLoadContext:r})),d()})},y;try{if(y=r.options.beforeLoad(_),Nn(y))return u(),y.catch(t=>{si(e,n,t,`BEFORE_LOAD`)}).then(v)}catch(t){u(),si(e,n,t,`BEFORE_LOAD`)}v(y)},di=(e,t)=>{let{id:n,routeId:r}=e.matches[t],i=e.router.looseRoutesById[r],a=()=>s(),o=()=>ui(e,n,t,i),s=()=>{if(ai(e,n))return;let t=li(e,n,i);return Nn(t)?t.then(o):o()};return a()},fi=(e,t,n)=>{let r=e.router.getMatch(t);if(!r||!n.options.head&&!n.options.scripts&&!n.options.headers)return;let i={ssr:e.router.options.ssr,matches:e.matches,match:r,params:r.params,loaderData:r.loaderData};return Promise.all([n.options.head?.(i),n.options.scripts?.(i),n.options.headers?.(i)]).then(([e,t,n])=>({meta:e?.meta,links:e?.links,headScripts:e?.scripts,headers:n,scripts:t,styles:e?.styles}))},pi=(e,t,n,r,i)=>{let a=t[r-1],{params:o,loaderDeps:s,abortController:c,cause:l}=e.router.getMatch(n),u=ni(e,r),d=ti(e,n);return{params:o,deps:s,preload:!!d,parentMatchPromise:a,abortController:c,context:u,location:e.location,navigate:t=>e.router.navigate({...t,_fromLocation:e.location}),cause:d?`preload`:l,route:i,...e.router.options.additionalContext}},mi=async(e,t,n,r,i)=>{try{let a=e.router.getMatch(n);try{vi(i);let o=i.options.loader,s=typeof o==`function`?o:o?.handler,c=s?.(pi(e,t,n,r,i)),l=!!s&&Nn(c);if((l||i._lazyPromise||i._componentsPromise||i.options.head||i.options.scripts||i.options.headers||a._nonReactive.minPendingPromise)&&e.updateMatch(n,e=>({...e,isFetching:`loader`})),s){let t=l?await c:c;ii(e,e.router.getMatch(n),t),t!==void 0&&e.updateMatch(n,e=>({...e,loaderData:t}))}i._lazyPromise&&await i._lazyPromise;let u=a._nonReactive.minPendingPromise;u&&await u,i._componentsPromise&&await i._componentsPromise,e.updateMatch(n,t=>({...t,error:void 0,context:ni(e,r),status:`success`,isFetching:!1,updatedAt:Date.now()}))}catch(t){let o=t;if(o?.name===`AbortError`){if(a.abortController.signal.aborted){a._nonReactive.loaderPromise?.resolve(),a._nonReactive.loaderPromise=void 0;return}e.updateMatch(n,t=>({...t,status:t.status===`pending`?`success`:t.status,isFetching:!1,context:ni(e,r)}));return}let s=a._nonReactive.minPendingPromise;s&&await s,Tr(t)&&await i.options.notFoundComponent?.preload?.(),ii(e,e.router.getMatch(n),t);try{i.options.onError?.(t)}catch(t){o=t,ii(e,e.router.getMatch(n),t)}!Gr(o)&&!Tr(o)&&await vi(i,[`errorComponent`]),e.updateMatch(n,t=>({...t,error:o,context:ni(e,r),status:`error`,isFetching:!1}))}}catch(t){let r=e.router.getMatch(n);r&&(r._nonReactive.loaderPromise=void 0),ii(e,r,t)}},hi=async(e,t,n)=>{async function r(r,a,c,l,d){let f=Date.now()-a.updatedAt,p=r?d.options.preloadStaleTime??e.router.options.defaultPreloadStaleTime??3e4:d.options.staleTime??e.router.options.defaultStaleTime??0,m=d.options.shouldReload,h=typeof m==`function`?m(pi(e,t,i,n,d)):m,{status:g,invalid:_}=l,v=f>=p&&(!!e.forceStaleReload||l.cause===`enter`||c!==void 0&&c!==l.id);o=g===`success`&&(_||(h??v)),r&&d.options.preload===!1||(o&&!e.sync&&u?(s=!0,(async()=>{try{await mi(e,t,i,n,d);let r=e.router.getMatch(i);r._nonReactive.loaderPromise?.resolve(),r._nonReactive.loadPromise?.resolve(),r._nonReactive.loaderPromise=void 0,r._nonReactive.loadPromise=void 0}catch(t){Gr(t)&&await e.router.navigate(t.options)}})()):g!==`success`||o?await mi(e,t,i,n,d):oi(e,i,n))}let{id:i,routeId:a}=e.matches[n],o=!1,s=!1,c=e.router.looseRoutesById[a],l=c.options.loader,u=((typeof l==`function`?void 0:l?.staleReloadMode)??e.router.options.defaultStaleReloadMode)!==`blocking`;if(ai(e,i)){if(!e.router.getMatch(i))return e.matches[n];oi(e,i,n)}else{let t=e.router.getMatch(i),o=e.router.stores.matchesId.get()[n],s=(o&&e.router.stores.matchStores.get(o)||null)?.routeId===a?o:e.router.stores.matches.get().find(e=>e.routeId===a)?.id,l=ti(e,i);if(t._nonReactive.loaderPromise){if(t.status===`success`&&!e.sync&&!t.preload&&u)return t;await t._nonReactive.loaderPromise;let n=e.router.getMatch(i),a=n._nonReactive.error||n.error;a&&ii(e,n,a),n.status===`pending`&&await r(l,t,s,n,c)}else{let n=l&&!e.router.stores.matchStores.has(i),a=e.router.getMatch(i);a._nonReactive.loaderPromise=Mn(),n!==a.preload&&e.updateMatch(i,e=>({...e,preload:n})),await r(l,t,s,a,c)}}let d=e.router.getMatch(i);s||(d._nonReactive.loaderPromise?.resolve(),d._nonReactive.loadPromise?.resolve(),d._nonReactive.loadPromise=void 0),clearTimeout(d._nonReactive.pendingTimeout),d._nonReactive.pendingTimeout=void 0,s||(d._nonReactive.loaderPromise=void 0),d._nonReactive.dehydrated=void 0;let f=s?d.isFetching:!1;return f!==d.isFetching||d.invalid!==!1?(e.updateMatch(i,e=>({...e,isFetching:f,invalid:!1})),e.router.getMatch(i)):d};async function gi(e){let t=e,n=[];ei(t.router)&&$r(t);let r;for(let e=0;e<t.matches.length;e++){try{let n=di(t,e);Nn(n)&&await n}catch(e){if(Gr(e))throw e;if(Tr(e))r=e;else if(!t.preload)throw e;break}if(t.serialError||t.firstBadMatchIndex!=null)break}let i=t.firstBadMatchIndex??t.matches.length,a=r&&!t.preload?ri(t,r):void 0,o=r&&t.preload?0:a===void 0?i:Math.min(a+1,i),s,c;for(let e=0;e<o;e++)n.push(hi(t,n,e));try{await Promise.all(n)}catch{let e=await Promise.allSettled(n);for(let t of e){if(t.status!==`rejected`)continue;let e=t.reason;if(Gr(e))throw e;Tr(e)?s??=e:c??=e}if(c!==void 0)throw c}let l=s??(r&&!t.preload?r:void 0),u=t.firstBadMatchIndex===void 0?t.matches.length-1:t.firstBadMatchIndex;if(!l&&r&&t.preload)return t.matches;if(l){let e=ri(t,l);e===void 0&&Vn();let n=t.matches[e],r=t.router.looseRoutesById[n.routeId],i=t.router.options?.defaultNotFoundComponent;!r.options.notFoundComponent&&i&&(r.options.notFoundComponent=i),l.routeId=n.routeId;let a=n.routeId===t.router.routeTree.id;t.updateMatch(n.id,e=>({...e,...a?{status:`success`,globalNotFound:!0,error:void 0}:{status:`notFound`,error:l},isFetching:!1})),u=e,await vi(r,[`notFoundComponent`])}else if(!t.preload){let e=t.matches[0];e.globalNotFound||t.router.getMatch(e.id)?.globalNotFound&&t.updateMatch(e.id,e=>({...e,globalNotFound:!1,error:void 0}))}if(t.serialError&&t.firstBadMatchIndex!==void 0){let e=t.router.looseRoutesById[t.matches[t.firstBadMatchIndex].routeId];await vi(e,[`errorComponent`])}for(let e=0;e<=u;e++){let{id:n,routeId:r}=t.matches[e],i=t.router.looseRoutesById[r];try{let e=fi(t,n,i);if(e){let r=await e;t.updateMatch(n,e=>({...e,...r}))}}catch(e){console.error(`Error executing head for route ${r}:`,e)}}let d=$r(t);if(Nn(d)&&await d,l)throw l;if(t.serialError&&!t.preload&&!t.onReady)throw t.serialError;return t.matches}function _i(e,t){let n=t.map(t=>e.options[t]?.preload?.()).filter(Boolean);if(n.length!==0)return Promise.all(n)}function vi(e,t=bi){!e._lazyLoaded&&e._lazyPromise===void 0&&(e.lazyFn?e._lazyPromise=e.lazyFn().then(t=>{let{id:n,...r}=t.options;Object.assign(e.options,r),e._lazyLoaded=!0,e._lazyPromise=void 0}):e._lazyLoaded=!0);let n=()=>e._componentsLoaded?void 0:t===bi?(()=>{if(e._componentsPromise===void 0){let t=_i(e,bi);t?e._componentsPromise=t.then(()=>{e._componentsLoaded=!0,e._componentsPromise=void 0}):e._componentsLoaded=!0}return e._componentsPromise})():_i(e,t);return e._lazyPromise?e._lazyPromise.then(n):n()}function yi(e){for(let t of bi)if(e.options[t]?.preload)return!0;return!1}var bi=[`component`,`errorComponent`,`pendingComponent`,`notFoundComponent`],xi=`__TSR_index`,Si=`popstate`,Ci=`beforeunload`;function wi(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({task:n,navigateOpts:r,...i})=>{if(r?.ignoreBlocker??!1){n();return}let a=e.getBlockers?.()??[],o=i.type===`PUSH`||i.type===`REPLACE`;if(typeof document<`u`&&a.length&&o)for(let n of a){let r=Oi(i.path,i.state);if(await n.blockerFn({currentLocation:t,nextLocation:r,action:i.type})){e.onBlocked?.();return}}n()};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[xi];i=Ti(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[xi];i=Ti(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),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[xi]!==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}}function Ti(e,t){t||={};let n=ki();return{...t,key:n,__TSR_key:n,[xi]:e}}function Ei(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=e?.createHref??(e=>e),c=e?.parseLocation??(()=>Oi(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!t.history.state?.__TSR_key&&!t.history.state?.key){let e=ki();t.history.replaceState({[xi]:0,key:e,__TSR_key:e},``)}let l=c(),u,d=!1,f=!1,p=!1,m=!1,h=()=>l,g,_,v=()=>{g&&(C._ignoreSubscribers=!0,(g.isPush?t.history.pushState:t.history.replaceState)(g.state,``,g.href),C._ignoreSubscribers=!1,g=void 0,_=void 0,u=void 0)},y=(e,t,n)=>{let r=s(t);_||(u=l),l=Oi(t,n),g={href:r,state:n,isPush:g?.isPush||e===`push`},_||=Promise.resolve().then(()=>v())},b=e=>{l=c(),C.notify({type:e})},x=async()=>{if(f){f=!1;return}let e=c(),n=e.state[xi]-l.state[xi],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 n=a();if(typeof document<`u`&&n.length){for(let r of n)if(await r.blockerFn({currentLocation:l,nextLocation:e,action:s})){f=!0,t.history.go(1),C.notify(u);return}}}l=c(),C.notify(u)},S=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){t=!0;break}if(typeof n==`function`&&n()===!0){t=!0;break}}if(t)return e.preventDefault(),e.returnValue=``},C=wi({getLocation:h,getLength:()=>t.history.length,pushState:(e,t)=>y(`push`,e,t),replaceState:(e,t)=>y(`replace`,e,t),back:e=>(e&&(p=!0),m=!0,t.history.back()),forward:e=>{e&&(p=!0),m=!0,t.history.forward()},go:e=>{d=!0,t.history.go(e)},createHref:e=>s(e),flush:v,destroy:()=>{t.history.pushState=n,t.history.replaceState=r,t.removeEventListener(Ci,S,{capture:!0}),t.removeEventListener(Si,x)},onBlocked:()=>{u&&l!==u&&(l=u)},getBlockers:a,setBlockers:o,notifyOnIndexChange:!1});return t.addEventListener(Ci,S,{capture:!0}),t.addEventListener(Si,x),t.history.pushState=function(...e){let r=n.apply(t.history,e);return C._ignoreSubscribers||b(`PUSH`),r},t.history.replaceState=function(...e){let n=r.apply(t.history,e);return C._ignoreSubscribers||b(`REPLACE`),n},C}function Di(e){let t=e.replace(/[\x00-\x1f\x7f]/g,``);return t.startsWith(`//`)&&(t=`/`+t.replace(/^\/+/,``)),t}function Oi(e,t){let n=Di(e),r=n.indexOf(`#`),i=n.indexOf(`?`),a=ki();return{href:n,pathname:n.substring(0,r>0?i>0?Math.min(r,i):r:i>0?i:n.length),hash:r>-1?n.substring(r):``,search:i>-1?n.slice(i,r===-1?void 0:r):``,state:t||{[xi]:0,key:a,__TSR_key:a}}}function ki(){return(Math.random()+1).toString(36).substring(7)}function Ai(e,t){let n=t,r=e;return{fromLocation:n,toLocation:r,pathChanged:n?.pathname!==r.pathname,hrefChanged:n?.href!==r.href,hashChanged:n?.hash!==r.hash}}var ji=class{constructor(e,t){this.tempLocationKey=`${Math.round(Math.random()*1e7)}`,this.resetNextScroll=!0,this.shouldViewTransition=void 0,this.isViewTransitionTypesSupported=void 0,this.subscribers=new Set,this.isScrollRestoring=!1,this.isScrollRestorationSetup=!1,this.routeBranchCache=new WeakMap,this.startTransition=e=>e(),this.update=e=>{let t=this.options,n=this.basepath??t?.basepath??`/`,r=this.basepath===void 0,i=t?.rewrite;if(this.options={...t,...e},this.isServer=this.options.isServer??typeof document>`u`,this.protocolAllowlist=new Set(this.options.protocolAllowlist),this.options.pathParamsAllowedCharacters&&(this.pathParamsDecoder=xr(this.options.pathParamsAllowedCharacters)),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.options.history?this.history=this.options.history:this.history=Ei()),this.origin=this.options.origin,this.origin||(window?.origin&&window.origin!==`null`?this.origin=window.origin:this.origin=`http://localhost`),this.history&&this.updateLatestLocation(),this.options.routeTree!==this.routeTree){this.routeTree=this.options.routeTree;let e;this.resolvePathCache=Hn(1e3),e=this.buildRouteTree(),this.setRoutes(e)}if(!this.stores&&this.latestLocation){let e=this.getStoreConfig(this);this.batch=e.batch,this.stores=Xr(Pi(this.latestLocation),e),Fr(this)}let a=!1,o=this.options.basepath??`/`,s=this.options.rewrite;if(r||n!==o||i!==s){this.basepath=o;let e=[],t=_r(o);t&&t!==`/`&&e.push(qr({basepath:o})),s&&e.push(s),this.rewrite=e.length===0?void 0:e.length===1?e[0]:Kr(e),this.history&&this.updateLatestLocation(),a=!0}a&&this.stores&&this.stores.location.set(this.latestLocation),typeof window<`u`&&`CSS`in window&&typeof window.CSS?.supports==`function`&&(this.isViewTransitionTypesSupported=window.CSS.supports(`selector(:active-view-transition-type(a)`))},this.updateLatestLocation=()=>{this.latestLocation=this.parseLocation(this.history.location,this.latestLocation)},this.buildRouteTree=()=>{let e=rr(this.routeTree,this.options.caseSensitive,(e,t)=>{e.init({originalIndex:t})});return this.options.routeMasks&&Qn(this.options.routeMasks,e.processedTree),e},this.subscribe=(e,t)=>{let n={eventType:e,fn:t};return this.subscribers.add(n),()=>{this.subscribers.delete(n)}},this.emit=e=>{this.subscribers.forEach(t=>{t.eventType===e.type&&t.fn(e)})},this.parseLocation=(e,t)=>{let n=({pathname:e,search:n,hash:r,href:i,state: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:Rn(e).path,external:!1,searchStr:o,search:Tn(t?.search,i),hash:Rn(r.slice(1)).path,state:En(t?.state,a)}}let o=new URL(i,this.origin),s=Jr(this.rewrite,o),c=this.options.parseSearch(s.search),l=this.options.stringifySearch(c);return s.search=l,{href:s.href.replace(s.origin,``),publicHref:i,pathname:Rn(s.pathname).path,external:!!this.rewrite&&s.origin!==this.origin,searchStr:l,search:Tn(t?.search,c),hash:Rn(s.hash.slice(1)).path,state:En(t?.state,a)}},r=n(e),{__tempLocation:i,__tempKey:a}=r.state;if(i&&(!a||a===this.tempLocationKey)){let e=n(i);return e.state.key=r.state.key,e.state.__TSR_key=r.state.__TSR_key,delete e.state.__tempLocation,{...e,maskedLocation:r}}return r},this.resolvePathWithBase=(e,t)=>br({base:e,to:t.includes(`//`)?mr(t):t,trailingSlash:this.options.trailingSlash,cache:this.resolvePathCache}),this.matchRoutes=(e,t,n)=>typeof e==`string`?this.matchRoutesInternal({pathname:e,search:t},n):this.matchRoutesInternal(e,t),this.getMatchedRoutes=e=>Ii({pathname:e,routesById:this.routesById,processedTree:this.processedTree}),this.cancelMatch=e=>{let t=this.getMatch(e);t&&(t.abortController.abort(),clearTimeout(t._nonReactive.pendingTimeout),t._nonReactive.pendingTimeout=void 0)},this.cancelMatches=()=>{this.stores.pendingIds.get().forEach(e=>{this.cancelMatch(e)}),this.stores.matchesId.get().forEach(e=>{if(this.stores.pendingMatchStores.has(e))return;let t=this.stores.matchStores.get(e)?.get();t&&(t.status===`pending`||t.isFetching===`loader`)&&this.cancelMatch(e)})},this.buildLocation=e=>{let t=(t={})=>{let n=t._fromLocation||this.pendingBuiltLocation||this.latestLocation,r=this.matchRoutesLightweight(n);t.from;let i=t.unsafeRelative===`path`?n.pathname:t.from??r.fullPath,a=t.to?`${t.to}`:void 0,o=r.search,s=Object.assign(Object.create(null),r.params),c=a?.charCodeAt(0)===47?`/`:this.resolvePathWithBase(i,`.`),l=a?this.resolvePathWithBase(c,a):c,u=t.params===!1||t.params===null?Object.create(null):(t.params??!0)===!0?s:Object.assign(s,bn(t.params,s)),d=this.routesByPath[gr(l)],f;if(d)f=this.getRouteBranch(d);else if(l.includes(`$`))f=[];else{let e=this.getMatchedRoutes(l);f=e.matchedRoutes,this.options.notFoundRoute&&(!e.foundRoute||e.foundRoute.path!==`/`&&e.routeParams[`**`])&&(f=[...f,this.options.notFoundRoute])}if(f.length&&Cn(u))for(let e of f){let t=e.options.params?.stringify??e.options.stringifyParams;if(t)try{Object.assign(u,t(u))}catch{}}let p=e.leaveParams?l:Rn(Cr({path:l,params:u,decoder:this.pathParamsDecoder,server:this.isServer}).interpolatedPath).path,m=o;if(e._includeValidateSearch&&this.options.search?.strict){let e={};f.forEach(t=>{if(t.options.validateSearch)try{Object.assign(e,Fi(t.options.validateSearch,{...e,...m}))}catch{}}),m=e}m=Li({search:m,dest:t,destRoutes:f,_includeValidateSearch:e._includeValidateSearch}),m=Tn(o,m);let h=this.options.stringifySearch(m),g=t.hash===!0?n.hash:t.hash?bn(t.hash,n.hash):void 0,_=g?`#${g}`:``,v=t.state===!0?n.state:t.state?bn(t.state,n.state):{};v=En(n.state,v);let y=`${p}${h}${_}`,b,x,S=!1;if(this.rewrite){let e=new URL(y,this.origin),t=Yr(this.rewrite,e);b=e.href.replace(e.origin,``),t.origin===this.origin?x=t.pathname+t.search+t.hash:(x=t.href,S=!0)}else b=zn(y),x=b;return{publicHref:x,href:b,pathname:p,search:m,searchStr:h,state:v,hash:g??``,external:S,unmaskOnReload:t.unmaskOnReload}},n=(n={},r)=>{let i=t(n),a=r?t(r):void 0;if(!a){let n=Object.create(null);if(this.options.routeMasks){let o=$n(i.pathname,this.processedTree);if(o){Object.assign(n,o.rawParams);let{from:i,params:s,...c}=o.route,l=s===!1||s===null?Object.create(null):(s??!0)===!0?n:Object.assign(n,bn(s,n));r={from:e.from,...c,params:l},a=t(r)}}}return a&&(i.maskedLocation=a),i};return e.mask?n(e,{from:e.from,...e.mask}):n(e)},this.commitLocation=async({viewTransition:e,ignoreBlocker:t,...n})=>{let r=()=>{let e=[`key`,`__TSR_key`,`__TSR_index`,`__hashScrollIntoViewOptions`];e.forEach(e=>{n.state[e]=this.latestLocation.state[e]});let t=jn(n.state,this.latestLocation.state);return e.forEach(e=>{delete n.state[e]}),t},i=gr(this.latestLocation.href)===gr(n.href),a=this.commitLocationPromise;if(this.commitLocationPromise=Mn(()=>{a?.resolve(),a=void 0}),i&&r())this.load();else{let{maskedLocation:r,hashScrollIntoView:i,...a}=n;r&&(a={...r,state:{...r.state,__tempKey:void 0,__tempLocation:{...a,search:a.searchStr,state:{...a.state,__tempKey:void 0,__tempLocation:void 0,__TSR_key:void 0,key:void 0}}}},(a.unmaskOnReload??this.options.unmaskOnReload??!1)&&(a.state.__tempKey=this.tempLocationKey)),a.state.__hashScrollIntoViewOptions=i??this.options.defaultHashScrollIntoView??!0,this.shouldViewTransition=e,this.history[n.replace?`replace`:`push`](a.publicHref,a.state,{ignoreBlocker:t})}return this.resetNextScroll=n.resetScroll??!0,this.history.subscribers.size||this.load(),this.commitLocationPromise},this.buildAndCommitLocation=({replace:e,resetScroll:t,hashScrollIntoView:n,viewTransition:r,ignoreBlocker:i,href:a,...o}={})=>{if(a){let t=this.history.location.state.__TSR_index,n=Oi(a,{__TSR_index:e?t:t+1}),r=new URL(n.pathname,this.origin);o.to=Jr(this.rewrite,r).pathname,o.search=this.options.parseSearch(n.search),o.hash=n.hash.slice(1)}let s=this.buildLocation({...o,_includeValidateSearch:!0});this.pendingBuiltLocation=s;let c=this.commitLocation({...s,viewTransition:r,replace:e,resetScroll:t,hashScrollIntoView:n,ignoreBlocker:i});return Promise.resolve().then(()=>{this.pendingBuiltLocation===s&&(this.pendingBuiltLocation=void 0)}),c},this.navigate=async({to:e,reloadDocument:t,href:n,publicHref:r,...i})=>{let a=!1;if(n)try{new URL(`${n}`),a=!0}catch{}if(a&&!t&&(t=!0),t){if(e!==void 0||!n){let t=this.buildLocation({to:e,...i});n??=t.publicHref,r??=t.publicHref}let t=!a&&r?r:n;if(Ln(t,this.protocolAllowlist))return Promise.resolve();if(!i.ignoreBlocker){let e=this.history.getBlockers?.()??[];for(let t of e)if(t?.blockerFn&&await t.blockerFn({currentLocation:this.latestLocation,nextLocation:this.latestLocation,action:`PUSH`}))return Promise.resolve()}return i.replace?window.location.replace(t):window.location.href=t,Promise.resolve()}return this.buildAndCommitLocation({...i,href:n,to:e,_isNavigate:!0})},this.beforeLoad=()=>{this.cancelMatches(),this.updateLatestLocation();let e=this.matchRoutes(this.latestLocation),t=this.stores.cachedMatches.get().filter(t=>!e.some(e=>e.id===t.id));this.batch(()=>{this.stores.status.set(`pending`),this.stores.statusCode.set(200),this.stores.isLoading.set(!0),this.stores.location.set(this.latestLocation),this.stores.setPending(e),this.stores.setCached(t)})},this.load=async e=>{let t,n,r,i=this.stores.resolvedLocation.get()??this.stores.location.get();for(r=new Promise(a=>{this.startTransition(async()=>{try{this.beforeLoad();let t=this.latestLocation,n=Ai(t,this.stores.resolvedLocation.get());this.stores.redirect.get()||this.emit({type:`onBeforeNavigate`,...n}),this.emit({type:`onBeforeLoad`,...n}),await gi({router:this,sync:e?.sync,forceStaleReload:i.href===t.href,matches:this.stores.pendingMatches.get(),location:t,updateMatch:this.updateMatch,onReady:async()=>{this.startTransition(()=>{this.startViewTransition(async()=>{let e=null,t=null,n=null,r=null;this.batch(()=>{let i=this.stores.pendingMatches.get(),a=i.length,o=this.stores.matches.get();e=a?o.filter(e=>!this.stores.pendingMatchStores.has(e.id)):null;let s=new Set;for(let e of this.stores.pendingMatchStores.values())e.routeId&&s.add(e.routeId);let c=new Set;for(let e of this.stores.matchStores.values())e.routeId&&c.add(e.routeId);t=a?o.filter(e=>!s.has(e.routeId)):null,n=a?i.filter(e=>!c.has(e.routeId)):null,r=a?i.filter(e=>c.has(e.routeId)):o,this.stores.isLoading.set(!1),this.stores.loadedAt.set(Date.now()),a&&(this.stores.setMatches(i),this.stores.setPending([]),this.stores.setCached([...this.stores.cachedMatches.get(),...e.filter(e=>e.status!==`error`&&e.status!==`notFound`&&e.status!==`redirected`)]),this.clearExpiredCache())});for(let[e,i]of[[t,`onLeave`],[n,`onEnter`],[r,`onStay`]])if(e)for(let t of e)this.looseRoutesById[t.routeId].options[i]?.(t)})})}})}catch(e){Gr(e)?(t=e,this.navigate({...t.options,replace:!0,ignoreBlocker:!0})):Tr(e)&&(n=e);let r=t?t.status:n?404:this.stores.matches.get().some(e=>e.status===`error`)?500:200;this.batch(()=>{this.stores.statusCode.set(r),this.stores.redirect.set(t)})}this.latestLoadPromise===r&&(this.commitLocationPromise?.resolve(),this.latestLoadPromise=void 0,this.commitLocationPromise=void 0),a()})}),this.latestLoadPromise=r,await r;this.latestLoadPromise&&r!==this.latestLoadPromise;)await this.latestLoadPromise;let a;this.hasNotFoundMatch()?a=404:this.stores.matches.get().some(e=>e.status===`error`)&&(a=500),a!==void 0&&this.stores.statusCode.set(a)},this.startViewTransition=e=>{let t=this.shouldViewTransition??this.options.defaultViewTransition;if(this.shouldViewTransition=void 0,t&&typeof document<`u`&&`startViewTransition`in document&&typeof document.startViewTransition==`function`){let n;if(typeof t==`object`&&this.isViewTransitionTypesSupported){let r=this.latestLocation,i=this.stores.resolvedLocation.get(),a=typeof t.types==`function`?t.types(Ai(r,i)):t.types;if(a===!1){e();return}n={update:e,types:a}}else n=e;document.startViewTransition(n)}else e()},this.updateMatch=(e,t)=>{this.startTransition(()=>{let n=this.stores.pendingMatchStores.get(e);if(n){n.set(t);return}let r=this.stores.matchStores.get(e);if(r){r.set(t);return}let i=this.stores.cachedMatchStores.get(e);if(i){let n=t(i.get());n.status===`redirected`?this.stores.cachedMatchStores.delete(e)&&this.stores.cachedIds.set(t=>t.filter(t=>t!==e)):i.set(n)}})},this.getMatch=e=>this.stores.cachedMatchStores.get(e)?.get()??this.stores.pendingMatchStores.get(e)?.get()??this.stores.matchStores.get(e)?.get(),this.invalidate=e=>{let t=t=>e?.filter?.(t)??!0?{...t,invalid:!0,...e?.forcePending||t.status===`error`||t.status===`notFound`?{status:`pending`,error:void 0}:void 0}:t;return this.batch(()=>{this.stores.setMatches(this.stores.matches.get().map(t)),this.stores.setCached(this.stores.cachedMatches.get().map(t)),this.stores.setPending(this.stores.pendingMatches.get().map(t))}),this.shouldViewTransition=!1,this.load({sync:e?.sync})},this.getParsedLocationHref=e=>e.publicHref||`/`,this.resolveRedirect=e=>{let t=e.headers.get(`Location`);if(!e.options.href||e.options._builtLocation){let t=e.options._builtLocation??this.buildLocation(e.options),n=this.getParsedLocationHref(t);e.options.href=n,e.headers.set(`Location`,n)}else if(t)try{let n=new URL(t);if(this.origin&&n.origin===this.origin){let t=n.pathname+n.search+n.hash;e.options.href=t,e.headers.set(`Location`,t)}}catch{}if(e.options.href&&!e.options._builtLocation&&Ln(e.options.href,this.protocolAllowlist))throw Error(`Redirect blocked: unsafe protocol`);return e.headers.get(`Location`)||e.headers.set(`Location`,e.options.href),e},this.clearCache=e=>{let t=e?.filter;t===void 0?this.stores.setCached([]):this.stores.setCached(this.stores.cachedMatches.get().filter(e=>!t(e)))},this.clearExpiredCache=()=>{let e=Date.now();this.clearCache({filter:t=>{let n=this.looseRoutesById[t.routeId];if(!n.options.loader)return!0;let r=(t.preload?n.options.preloadGcTime??this.options.defaultPreloadGcTime:n.options.gcTime??this.options.defaultGcTime)??300*1e3;return t.status===`error`?!0:e-t.updatedAt>=r}})},this.loadRouteChunk=vi,this.preloadRoute=async e=>{let t=e._builtLocation??this.buildLocation(e),n=this.matchRoutes(t,{throwOnError:!0,preload:!0,dest:e}),r=new Set([...this.stores.matchesId.get(),...this.stores.pendingIds.get()]),i=new Set([...r,...this.stores.cachedIds.get()]),a=n.filter(e=>!i.has(e.id));if(a.length){let e=this.stores.cachedMatches.get();this.stores.setCached([...e,...a])}try{return n=await gi({router:this,matches:n,location:t,preload:!0,updateMatch:(e,t)=>{r.has(e)?n=n.map(n=>n.id===e?t(n):n):this.updateMatch(e,t)}}),n}catch(e){if(Gr(e))return e.options.reloadDocument?void 0:await this.preloadRoute({...e.options,_fromLocation:t});Tr(e)||console.error(e);return}},this.matchRoute=(e,t)=>{let n={...e,to:e.to?this.resolvePathWithBase(e.from||``,e.to):void 0,params:e.params||{},leaveParams:!0},r=this.buildLocation(n);if(t?.pending&&this.stores.status.get()!==`pending`)return!1;let i=(t?.pending===void 0?!this.stores.isLoading.get():t.pending)?this.latestLocation:this.stores.resolvedLocation.get()||this.stores.location.get(),a=er(r.pathname,t?.caseSensitive??!1,t?.fuzzy??!1,i.pathname,this.processedTree);return!a||e.params&&!jn(a.rawParams,e.params,{partial:!0})?!1:t?.includeSearch??!0?jn(i.search,r.search,{partial:!0})?a.rawParams:!1:a.rawParams},this.hasNotFoundMatch=()=>this.stores.matches.get().some(e=>e.status===`notFound`||e.globalNotFound),this.getStoreConfig=t,this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...e,caseSensitive:e.caseSensitive??!1,notFoundMode:e.notFoundMode??`fuzzy`,stringifySearch:e.stringifySearch??Br,parseSearch:e.parseSearch??zr,protocolAllowlist:e.protocolAllowlist??In}),typeof document<`u`&&(self.__TSR_ROUTER__=this)}isShell(){return!!this.options.isShell}isPrerendering(){return!!this.options.isPrerendering}get state(){return this.stores.__store.get()}setRoutes({routesById:e,routesByPath:t,processedTree:n}){this.routesById=e,this.routesByPath=t,this.processedTree=n;let r=this.options.notFoundRoute;r&&(r.init({originalIndex:99999999999}),this.routesById[r.id]=r)}getRouteBranch(e){let t=this.routeBranchCache.get(e);return t||(t=or(e),this.routeBranchCache.set(e,t)),t}get looseRoutesById(){return this.routesById}getParentContext(e){return e?.id?e.context??this.options.context??void 0:this.options.context??void 0}matchRoutesInternal(e,t){let n=this.getMatchedRoutes(e.pathname),{foundRoute:r,routeParams:i}=n,{matchedRoutes:a}=n,o=!1;(r?r.path!==`/`&&i[`**`]:gr(e.pathname))&&(this.options.notFoundRoute?a=[...a,this.options.notFoundRoute]:o=!0);let s=o?zi(this.options.notFoundMode,a):void 0,c=Array(a.length),l=new Map;for(let e of this.stores.matchStores.values())e.routeId&&l.set(e.routeId,e.get());for(let n=0;n<a.length;n++){let r=a[n],o=c[n-1],u,d,f;{let n=o?.search??e.search,i=o?._strictSearch??void 0;try{let e=Fi(r.options.validateSearch,{...n})??void 0;u={...n,...e},d={...i,...e},f=void 0}catch(e){let r=e;if(e instanceof Mi||(r=new Mi(e.message,{cause:e})),t?.throwOnError)throw r;u=n,d={},f=r}}let p=r.options.loaderDeps?.({search:u})??``,m=p?JSON.stringify(p):``,{interpolatedPath:h,usedParams:g}=Cr({path:r.fullPath,params:i,decoder:this.pathParamsDecoder,server:this.isServer}),_=r.id+h+m,v=this.getMatch(_),y=l.get(r.id),b=v?._strictParams??g,x;if(!v)try{Bi(r,b)}catch(e){if(x=Tr(e)||Gr(e)?e:new Ni(e.message,{cause:e}),t?.throwOnError)throw x}Object.assign(i,b);let S=y?`stay`:`enter`,C;if(v)C={...v,cause:S,params:y?.params??i,_strictParams:b,search:Tn(y?y.search:v.search,u),_strictSearch:d};else{let e=r.options.loader||r.options.beforeLoad||r.lazyFn||yi(r)?`pending`:`success`;C={id:_,ssr:r.options.ssr,index:n,routeId:r.id,params:y?.params??i,_strictParams:b,pathname:h,updatedAt:Date.now(),search:y?Tn(y.search,u):u,_strictSearch:d,searchError:void 0,status:e,isFetching:!1,error:void 0,paramsError:x,__routeContext:void 0,_nonReactive:{loadPromise:Mn()},__beforeLoadContext:void 0,context:{},abortController:new AbortController,fetchCount:0,cause:S,loaderDeps:y?En(y.loaderDeps,p):p,invalid:!1,preload:!1,links:void 0,scripts:void 0,headScripts:void 0,meta:void 0,staticData:r.options.staticData||{},fullPath:r.fullPath}}t?.preload||(C.globalNotFound=s===r.id),C.searchError=f;let w=this.getParentContext(o);C.context={...w,...C.__routeContext,...C.__beforeLoadContext},c[n]=C}for(let t=0;t<c.length;t++){let n=c[t],r=this.looseRoutesById[n.routeId],a=this.getMatch(n.id),o=l.get(n.routeId);if(n.params=o?Tn(o.params,i):i,!a){let i=c[t-1],a=this.getParentContext(i);if(r.options.context){let t={deps:n.loaderDeps,params:n.params,context:a??{},location:e,navigate:t=>this.navigate({...t,_fromLocation:e}),buildLocation:this.buildLocation,cause:n.cause,abortController:n.abortController,preload:!!n.preload,matches:c,routeId:r.id};n.__routeContext=r.options.context(t)??void 0}n.context={...a,...n.__routeContext,...n.__beforeLoadContext}}}return c}matchRoutesLightweight(e){let{matchedRoutes:t,routeParams:n}=this.getMatchedRoutes(e.pathname),r=vn(t),i={...e.search};for(let e of t)try{Object.assign(i,Fi(e.options.validateSearch,i))}catch{}let a=vn(this.stores.matchesId.get()),o=a&&this.stores.matchStores.get(a)?.get(),s=o&&o.routeId===r.id&&o.pathname===e.pathname,c;if(s)c=o.params;else{let e=Object.assign(Object.create(null),n);for(let n of t)try{Bi(n,e)}catch{}c=e}return{matchedRoutes:t,fullPath:r.fullPath,search:i,params:c}}},Mi=class extends Error{},Ni=class extends Error{};function Pi(e){return{loadedAt:0,isLoading:!1,isTransitioning:!1,status:`idle`,resolvedLocation:void 0,location:e,matches:[],statusCode:200}}function Fi(e,t){if(e==null)return{};if(`~standard`in e){let n=e[`~standard`].validate(t);if(n instanceof Promise)throw new Mi(`Async validation not supported`);if(n.issues)throw new Mi(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 Ii({pathname:e,routesById:t,processedTree:n}){let r=Object.create(null),i=gr(e),a,o=tr(i,n,!0);return o&&(a=o.route,Object.assign(r,o.rawParams)),{matchedRoutes:o?.branch||[t.__root__],routeParams:r,foundRoute:a}}function Li({search:e,dest:t,destRoutes:n,_includeValidateSearch:r}){return Ri(n)(e,t,r??!1)}function Ri(e){let t={dest:null,_includeValidateSearch:!1,middlewares:[]};for(let n of e)`search`in n.options?n.options.search?.middlewares&&t.middlewares.push(...n.options.search.middlewares):(n.options.preSearchFilters||n.options.postSearchFilters)&&t.middlewares.push(({search:e,next:t})=>{let r=e;`preSearchFilters`in n.options&&n.options.preSearchFilters&&(r=n.options.preSearchFilters.reduce((e,t)=>t(e),e));let i=t(r);return`postSearchFilters`in n.options&&n.options.postSearchFilters?n.options.postSearchFilters.reduce((e,t)=>t(e),i):i}),n.options.validateSearch&&t.middlewares.push(({search:e,next:r})=>{let i=r(e);if(!t._includeValidateSearch)return i;try{return{...i,...Fi(n.options.validateSearch,i)??void 0}}catch{return i}});t.middlewares.push(({search:e})=>{let n=t.dest;return n.search?n.search===!0?e:bn(n.search,e):{}});let n=(e,t,r)=>{if(e>=r.length)return t;let i=r[e];return i({search:t,next:t=>n(e+1,t,r)})};return function(e,r,i){return t.dest=r,t._includeValidateSearch=i,n(0,e,t.middlewares)}}function zi(e,t){if(e!==`root`)for(let e=t.length-1;e>=0;e--){let n=t[e];if(n.children)return n.id}return Ur}function Bi(e,t){let n=e.options.params?.parse??e.options.parseParams;if(n){let e=n(t);if(e===!1)throw Error(`Route params.parse returned false for a matched route`);Object.assign(t,e)}}var Vi=`Error preloading route! ☝️`,Hi=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.originalIndex;let t=this.options,n=!t?.path&&!t?.id;this.parentRoute=this.options.getParentRoute?.(),n?this._path=Ur:this.parentRoute||Vn();let r=n?Ur:t?.path;r&&r!==`/`&&(r=hr(r));let i=t?.id||r,a=n?Ur:pr([this.parentRoute.id===`__root__`?``:this.parentRoute.id,i]);r===`__root__`&&(r=`/`),a!==`__root__`&&(a=pr([`/`,a]));let o=a===`__root__`?`/`:pr([this.parentRoute.fullPath,r]);this._path=r,this._id=a,this._fullPath=o,this._to=gr(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=>Wr({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.`)}},Ui=class extends Hi{constructor(e){super(e)}};function Wi(e){if(typeof document<`u`&&document.querySelector){let t=e.stores.location.get(),n=t.state.__hashScrollIntoViewOptions??!0;if(n&&t.hash!==``){let e=document.getElementById(t.hash);e&&e.scrollIntoView(n)}}}function Gi(e){let t=e.errorComponent??qi;return(0,R.jsx)(Ki,{getResetKey:e.getResetKey,onCatch:e.onCatch,children:({error:n,reset:r})=>n?L.createElement(t,{error:n,reset:r}):e.children})}var Ki=class extends L.Component{constructor(...e){super(...e),this.state={error:null}}static getDerivedStateFromProps(e,t){let n=e.getResetKey();return t.error&&t.resetKey!==n?{resetKey:n,error:null}:{resetKey:n}}static getDerivedStateFromError(e){return{error:e}}reset(){this.setState({error:null})}componentDidCatch(e,t){this.props.onCatch&&this.props.onCatch(e,t)}render(){return this.props.children({error:this.state.error,reset:()=>{this.reset()}})}};function qi({error:e}){let[t,n]=L.useState(!1);return(0,R.jsxs)(`div`,{style:{padding:`.5rem`,maxWidth:`100%`},children:[(0,R.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`.5rem`},children:[(0,R.jsx)(`strong`,{style:{fontSize:`1rem`},children:`Something went wrong!`}),(0,R.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,R.jsx)(`div`,{style:{height:`.25rem`}}),t?(0,R.jsx)(`div`,{children:(0,R.jsx)(`pre`,{style:{fontSize:`.7em`,border:`1px solid red`,borderRadius:`.25rem`,padding:`.3rem`,color:`red`,overflow:`auto`},children:e.message?(0,R.jsx)(`code`,{children:e.message}):null})}):null]})}function Ji({children:e,fallback:t=null}){return Yi()?(0,R.jsx)(L.Fragment,{children:e}):(0,R.jsx)(L.Fragment,{children:t})}function Yi(){return L.useSyncExternalStore(Xi,()=>!0,()=>!1)}function Xi(){return()=>{}}var Zi=L.createContext(null);function Qi(e){return L.useContext(Zi)}var $i=L.createContext(void 0),ea=L.createContext(void 0),ta=(e=>(e[e.None=0]=`None`,e[e.Mutable=1]=`Mutable`,e[e.Watching=2]=`Watching`,e[e.RecursedCheck=4]=`RecursedCheck`,e[e.Recursed=8]=`Recursed`,e[e.Dirty=16]=`Dirty`,e[e.Pending=32]=`Pending`,e))(ta||{});function na({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;continue}for(;r!==void 0;)if(e=r.value,r=r.prev,e!==void 0){n=e.nextSub;continue top}break}while(!0)}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(!0)}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 ra(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 ia=[],aa=0,{link:oa,unlink:sa,propagate:ca,checkDirty:la,shallowPropagate:ua}=na({update(e){return e._update()},notify(e){ia[fa++]=e,e.flags&=~ta.Watching},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=ta.Mutable|ta.Dirty,ga(e))}}),da=0,fa=0,pa,ma=0;function ha(e){try{++ma,e()}finally{--ma||_a()}}function ga(e){let t=e.depsTail,n=t===void 0?e.deps:t.nextDep;for(;n!==void 0;)n=sa(n,e)}function _a(){if(!(ma>0)){for(;da<fa;){let e=ia[da];ia[da++]=void 0,e.notify()}da=0,fa=0}}function va(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?ta.None:ta.Mutable,get(){return pa!==void 0&&oa(i,pa,aa),i._snapshot},subscribe(e){let t=ra(e),n={current:!1},r=ya(()=>{i.get(),n.current?t.next?.(i._snapshot):n.current=!0});return{unsubscribe:()=>{r.stop()}}},_update(e){let a=pa,o=t?.compare??Object.is;if(n)pa=i,++aa,i.depsTail=void 0;else if(e===void 0)return!1;n&&(i.flags=ta.Mutable|ta.RecursedCheck);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{pa=a,n&&(i.flags&=~ta.RecursedCheck),ga(i)}}};return n?(i.flags=ta.Mutable|ta.Dirty,i.get=function(){let e=i.flags;if(e&ta.Dirty||e&ta.Pending&&la(i.deps,i)){if(i._update()){let e=i.subs;e!==void 0&&ua(e)}}else e&ta.Pending&&(i.flags=e&~ta.Pending);return pa!==void 0&&oa(i,pa,aa),i._snapshot}):i.set=function(e){if(i._update(e)){let e=i.subs;e!==void 0&&(ca(e),ua(e),_a())}},i}function ya(e){let t=()=>{let t=pa;pa=n,++aa,n.depsTail=void 0,n.flags=ta.Watching|ta.RecursedCheck;try{return e()}finally{pa=t,n.flags&=~ta.RecursedCheck,ga(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:ta.Watching|ta.RecursedCheck,notify(){let e=this.flags;e&ta.Dirty||e&ta.Pending&&la(this.deps,this)?t():this.flags=ta.Watching},stop(){this.flags=ta.None,this.depsTail=void 0,ga(this)}};return t(),n}var ba=n((e=>{var t=je();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 d=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?d:t.useSyncExternalStore})),xa=n(((e,t)=>{t.exports=ba()})),Sa=n((e=>{var t=je(),n=xa();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}})),Ca=n(((e,t)=>{t.exports=Sa()}))();function wa(e,t){return e===t}function Ta(e,t,n=wa){let r=(0,L.useCallback)(t=>{if(!e)return()=>{};let{unsubscribe:n}=e.subscribe(t);return n},[e]),i=(0,L.useCallback)(()=>e?.get(),[e]);return(0,Ca.useSyncExternalStoreWithSelector)(r,i,i,t,n)}var Ea={get:()=>void 0,subscribe:()=>({unsubscribe:()=>{}})};function Da(e){let t=Qi(),n=L.useContext(e.from?ea:$i),r=e.from??n,i=r?e.from?t.stores.getRouteMatchStore(r):t.stores.matchStores.get(r):void 0,a=L.useRef(void 0);return Ta(i??Ea,n=>{if((e.shouldThrow??!0)&&!n&&Vn(),n===void 0)return;let r=e.select?e.select(n):n;if(e.structuralSharing??t.options.defaultStructuralSharing){let e=En(a.current,r);return a.current=e,e}return r})}function Oa(e){return Da({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function ka(e){let{select:t,...n}=e;return Da({...n,select:e=>t?t(e.loaderDeps):e.loaderDeps})}function Aa(e){return Da({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 ja(e){return Da({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function Ma(e){let t=Qi();return L.useCallback(n=>t.navigate({...n,from:n.from??e?.from}),[e?.from,t])}function Na(e){return Da({...e,select:t=>e.select?e.select(t.context):t.context})}var Pa=t(Fe(),1);function Fa(e,t){let n=Qi(),r=_n(t),{activeProps:i,inactiveProps:a,activeOptions:o,to:s,preload:c,preloadDelay:l,preloadIntentProximity:u,hashScrollIntoView:d,replace:f,startTransition:p,resetScroll:m,viewTransition:h,children:g,target:_,disabled:v,style:y,className:b,onClick:x,onBlur:S,onFocus:C,onMouseEnter:w,onMouseLeave:T,onTouchStart:E,ignoreBlocker:D,params:O,search:k,hash:A,state:j,mask:M,reloadDocument:N,unsafeRelative:P,from:ee,_fromLocation:te,...ne}=e,F=Yi(),re=L.useMemo(()=>e,[n,e.from,e._fromLocation,e.hash,e.to,e.search,e.params,e.state,e.mask,e.unsafeRelative]),I=Ta(n.stores.location,e=>e,(e,t)=>e.href===t.href),ie=L.useMemo(()=>{let e={_fromLocation:I,...re};return n.buildLocation(e)},[n,I,re]),ae=ie.maskedLocation?ie.maskedLocation.publicHref:ie.publicHref,oe=ie.maskedLocation?ie.maskedLocation.external:ie.external,se=L.useMemo(()=>Wa(ae,oe,n.history,v),[v,oe,ae,n.history]),ce=L.useMemo(()=>{if(se?.external)return Ln(se.href,n.protocolAllowlist)?void 0:se.href;if(!Ga(s)&&!(typeof s!=`string`||s.indexOf(`:`)===-1))try{return new URL(s),Ln(s,n.protocolAllowlist)?void 0:s}catch{}},[s,se,n.protocolAllowlist]),le=L.useMemo(()=>{if(ce)return!1;if(o?.exact){if(!yr(I.pathname,ie.pathname,n.basepath))return!1}else{let e=vr(I.pathname,n.basepath),t=vr(ie.pathname,n.basepath);if(!(e.startsWith(t)&&(e.length===t.length||e[t.length]===`/`)))return!1}return(o?.includeSearch??!0)&&!jn(I.search,ie.search,{partial:!o?.exact,ignoreUndefined:!o?.explicitUndefined})?!1:o?.includeHash?F&&I.hash===ie.hash:!0},[o?.exact,o?.explicitUndefined,o?.includeHash,o?.includeSearch,I,ce,F,ie.hash,ie.pathname,ie.search,n.basepath]),ue=le?bn(i,{})??La:Ia,de=le?Ia:bn(a,{})??Ia,fe=[b,ue.className,de.className].filter(Boolean).join(` `),pe=(y||ue.style||de.style)&&{...y,...ue.style,...de.style},[me,he]=L.useState(!1),ge=L.useRef(!1),_e=e.reloadDocument||ce?!1:c??n.options.defaultPreload,ve=l??n.options.defaultPreloadDelay??0,ye=L.useCallback(()=>{n.preloadRoute({...re,_builtLocation:ie}).catch(e=>{console.warn(e),console.warn(Vi)})},[n,re,ie]);gn(r,L.useCallback(e=>{e?.isIntersecting&&ye()},[ye]),Ha,{disabled:!!v||_e!==`viewport`}),L.useEffect(()=>{ge.current||!v&&_e===`render`&&(ye(),ge.current=!0)},[v,ye,_e]);let be=e=>{let t=e.currentTarget.getAttribute(`target`),r=_===void 0?t:_;if(!v&&!qa(e)&&!e.defaultPrevented&&(!r||r===`_self`)&&e.button===0){e.preventDefault(),(0,Pa.flushSync)(()=>{he(!0)});let t=n.subscribe(`onResolved`,()=>{t(),he(!1)});n.navigate({...re,replace:f,resetScroll:m,hashScrollIntoView:d,startTransition:p,viewTransition:h,ignoreBlocker:D})}};if(ce)return{...ne,ref:r,href:ce,...g&&{children:g},..._&&{target:_},...v&&{disabled:v},...y&&{style:y},...b&&{className:b},...x&&{onClick:x},...S&&{onBlur:S},...C&&{onFocus:C},...w&&{onMouseEnter:w},...T&&{onMouseLeave:T},...E&&{onTouchStart:E}};let xe=e=>{if(v||_e!==`intent`)return;if(!ve){ye();return}let t=e.currentTarget;if(Va.has(t))return;let n=setTimeout(()=>{Va.delete(t),ye()},ve);Va.set(t,n)},Se=e=>{v||_e!==`intent`||ye()},Ce=e=>{if(v||!_e||!ve)return;let t=e.currentTarget,n=Va.get(t);n&&(clearTimeout(n),Va.delete(t))};return{...ne,...ue,...de,href:se?.href,ref:r,onClick:Ua([x,be]),onBlur:Ua([S,Ce]),onFocus:Ua([C,xe]),onMouseEnter:Ua([w,xe]),onMouseLeave:Ua([T,Ce]),onTouchStart:Ua([E,Se]),disabled:!!v,target:_,...pe&&{style:pe},...fe&&{className:fe},...v&&Ra,...le&&za,...F&&me&&Ba}}var Ia={},La={className:`active`},Ra={role:`link`,"aria-disabled":!0},za={"data-status":`active`,"aria-current":`page`},Ba={"data-transitioning":`transitioning`},Va=new WeakMap,Ha={rootMargin:`100px`},Ua=e=>t=>{for(let n of e)if(n){if(t.defaultPrevented)return;n(t)}};function Wa(e,t,n,r){if(!r)return t?{href:e,external:!0}:{href:n.createHref(e)||`/`,external:!1}}function Ga(e){if(typeof e!=`string`)return!1;let t=e.charCodeAt(0);return t===47?e.charCodeAt(1)!==47:t===46}var Ka=L.forwardRef((e,t)=>{let{_asChild:n,...r}=e,{type:i,...a}=Fa(r,t),o=typeof r.children==`function`?r.children({isActive:a[`data-status`]===`active`}):r.children;if(!n){let{disabled:e,...t}=a;return L.createElement(`a`,t,o)}return L.createElement(n,a,o)});function qa(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}var Ja=class extends Hi{constructor(e){super(e),this.useMatch=e=>Da({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>Na({...e,from:this.id}),this.useSearch=e=>ja({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>Aa({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>ka({...e,from:this.id}),this.useLoaderData=e=>Oa({...e,from:this.id}),this.useNavigate=()=>Ma({from:this.fullPath}),this.Link=L.forwardRef((e,t)=>(0,R.jsx)(Ka,{ref:t,from:this.fullPath,...e}))}};function Ya(e){return new Ja(e)}var Xa=class extends Ui{constructor(e){super(e),this.useMatch=e=>Da({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>Na({...e,from:this.id}),this.useSearch=e=>ja({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>Aa({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>ka({...e,from:this.id}),this.useLoaderData=e=>Oa({...e,from:this.id}),this.useNavigate=()=>Ma({from:this.fullPath}),this.Link=L.forwardRef((e,t)=>(0,R.jsx)(Ka,{ref:t,from:this.fullPath,...e}))}};function Za(e){return new Xa(e)}function Qa(e){let t=Qi(),n=`not-found-${Ta(t.stores.location,e=>e.pathname)}-${Ta(t.stores.status,e=>e)}`;return(0,R.jsx)(Gi,{getResetKey:()=>n,onCatch:(t,n)=>{if(Tr(t))e.onCatch?.(t,n);else throw t},errorComponent:({error:t})=>{if(Tr(t))return e.fallback?.(t);throw t},children:e.children})}function $a(){return(0,R.jsx)(`p`,{children:`Not Found`})}function eo(e){return(0,R.jsx)(R.Fragment,{children:e.children})}function to(e,t,n){return t.options.notFoundComponent?(0,R.jsx)(t.options.notFoundComponent,{...n}):e.options.defaultNotFoundComponent?(0,R.jsx)(e.options.defaultNotFoundComponent,{...n}):(0,R.jsx)($a,{})}var no=L.memo(function({matchId:e}){let t=Qi(),n=t.stores.matchStores.get(e);n||Vn();let r=Ta(t.stores.loadedAt,e=>e),i=Ta(n,e=>e);return(0,R.jsx)(ro,{router:t,matchId:e,resetKey:r,matchState:L.useMemo(()=>{let e=i.routeId,n=t.routesById[e].parentRoute?.id;return{routeId:e,ssr:i.ssr,_displayPending:i._displayPending,parentRouteId:n}},[i._displayPending,i.routeId,i.ssr,t.routesById])})});function ro({router:e,matchId:t,resetKey:n,matchState:r}){let i=e.routesById[r.routeId],a=i.options.pendingComponent??e.options.defaultPendingComponent,o=a?(0,R.jsx)(a,{}):null,s=i.options.errorComponent??e.options.defaultErrorComponent,c=i.options.onCatch??e.options.defaultOnCatch,l=i.isRoot?i.options.notFoundComponent??e.options.notFoundRoute?.options.component:i.options.notFoundComponent,u=r.ssr===!1||r.ssr===`data-only`,d=(!i.isRoot||i.options.wrapInSuspense||u)&&(i.options.wrapInSuspense??a??(i.options.errorComponent?.preload||u))?L.Suspense:eo,f=s?Gi:eo,p=l?Qa:eo;return(0,R.jsxs)(i.isRoot?i.options.shellComponent??eo:eo,{children:[(0,R.jsx)($i.Provider,{value:t,children:(0,R.jsx)(d,{fallback:o,children:(0,R.jsx)(f,{getResetKey:()=>n,errorComponent:s||qi,onCatch:(e,t)=>{if(Tr(e))throw e.routeId??=r.routeId,e;c?.(e,t)},children:(0,R.jsx)(p,{fallback:e=>{if(e.routeId??=r.routeId,!l||e.routeId&&e.routeId!==r.routeId||!e.routeId&&!i.isRoot)throw e;return L.createElement(l,e)},children:u||r._displayPending?(0,R.jsx)(Ji,{fallback:o,children:(0,R.jsx)(ao,{matchId:t})}):(0,R.jsx)(ao,{matchId:t})})})})}),r.parentRouteId===`__root__`?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(io,{resetKey:n}),(e.options.scrollRestoration,null)]}):null]})}function io({resetKey:e}){let t=Qi(),n=L.useRef(void 0);return mn(()=>{let e=t.latestLocation.href;(n.current===void 0||n.current!==e)&&(t.emit({type:`onRendered`,...Ai(t.stores.location.get(),t.stores.resolvedLocation.get())}),n.current=e)},[t.latestLocation.state.__TSR_key,e,t]),null}var ao=L.memo(function({matchId:e}){let t=Qi(),n=(e,n)=>t.getMatch(e.id)?._nonReactive[n]??e._nonReactive[n],r=t.stores.matchStores.get(e);r||Vn();let i=Ta(r,e=>e),a=i.routeId,o=t.routesById[a],s=L.useMemo(()=>{let e=(t.routesById[a].options.remountDeps??t.options.defaultRemountDeps)?.({routeId:a,loaderDeps:i.loaderDeps,params:i._strictParams,search:i._strictSearch});return e?JSON.stringify(e):void 0},[a,i.loaderDeps,i._strictParams,i._strictSearch,t.options.defaultRemountDeps,t.routesById]),c=L.useMemo(()=>{let e=o.options.component??t.options.defaultComponent;return e?(0,R.jsx)(e,{},s):(0,R.jsx)(oo,{})},[s,o.options.component,t.options.defaultComponent]);if(i._displayPending)throw n(i,`displayPendingPromise`);if(i._forcePending)throw n(i,`minPendingPromise`);if(i.status===`pending`){let e=o.options.pendingMinMs??t.options.defaultPendingMinMs;if(e){let n=t.getMatch(i.id);if(n&&!n._nonReactive.minPendingPromise){let t=Mn();n._nonReactive.minPendingPromise=t,setTimeout(()=>{t.resolve(),n._nonReactive.minPendingPromise=void 0},e)}}throw n(i,`loadPromise`)}if(i.status===`notFound`)return Tr(i.error)||Vn(),to(t,o,i.error);if(i.status===`redirected`)throw Gr(i.error)||Vn(),n(i,`loadPromise`);if(i.status===`error`)throw i.error;return c}),oo=L.memo(function(){let e=Qi(),t=L.useContext($i),n,r=!1,i;{let a=t?e.stores.matchStores.get(t):void 0;[n,r]=Ta(a,e=>[e?.routeId,e?.globalNotFound??!1]),i=Ta(e.stores.matchesId,e=>e[e.findIndex(e=>e===t)+1])}let a=n?e.routesById[n]:void 0,o=e.options.defaultPendingComponent?(0,R.jsx)(e.options.defaultPendingComponent,{}):null;if(r)return a||Vn(),to(e,a,void 0);if(!i)return null;let s=(0,R.jsx)(no,{matchId:i});return n===`__root__`?(0,R.jsx)(L.Suspense,{fallback:o,children:s}):s});function so(){let e=Qi(),t=L.useRef({router:e,mounted:!1}),[n,r]=L.useState(!1),i=Ta(e.stores.isLoading,e=>e),a=Ta(e.stores.hasPending,e=>e),o=hn(i),s=i||n||a,c=hn(s),l=i||a,u=hn(l);return e.startTransition=e=>{r(!0),L.startTransition(()=>{e(),r(!1)})},L.useEffect(()=>{let t=e.history.subscribe(e.load),n=e.buildLocation({to:e.latestLocation.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});return gr(e.latestLocation.publicHref)!==gr(n.publicHref)&&e.commitLocation({...n,replace:!0}),()=>{t()}},[e,e.history]),mn(()=>{typeof window<`u`&&e.ssr||t.current.router===e&&t.current.mounted||(t.current={router:e,mounted:!0},(async()=>{try{await e.load()}catch(e){console.error(e)}})())},[e]),mn(()=>{o&&!i&&e.emit({type:`onLoad`,...Ai(e.stores.location.get(),e.stores.resolvedLocation.get())})},[o,e,i]),mn(()=>{u&&!l&&e.emit({type:`onBeforeRouteMount`,...Ai(e.stores.location.get(),e.stores.resolvedLocation.get())})},[l,u,e]),mn(()=>{if(c&&!s){let t=Ai(e.stores.location.get(),e.stores.resolvedLocation.get());e.emit({type:`onResolved`,...t}),ha(()=>{e.stores.status.set(`idle`),e.stores.resolvedLocation.set(e.stores.location.get())}),t.hrefChanged&&Wi(e)}},[s,c,e]),null}function co(){let e=Qi(),t=e.routesById.__root__.options.pendingComponent??e.options.defaultPendingComponent,n=t?(0,R.jsx)(t,{}):null,r=(0,R.jsxs)(typeof document<`u`&&e.ssr?eo:L.Suspense,{fallback:n,children:[(0,R.jsx)(so,{}),(0,R.jsx)(lo,{})]});return e.options.InnerWrap?(0,R.jsx)(e.options.InnerWrap,{children:r}):r}function lo(){let e=Qi(),t=Ta(e.stores.firstId,e=>e),n=Ta(e.stores.loadedAt,e=>e),r=t?(0,R.jsx)(no,{matchId:t}):null;return(0,R.jsx)($i.Provider,{value:t,children:e.options.disableGlobalCatchBoundary?r:(0,R.jsx)(Gi,{getResetKey:()=>n,errorComponent:qi,onCatch:void 0,children:r})})}var uo=e=>({createMutableStore:va,createReadonlyStore:va,batch:ha}),fo=e=>new po(e),po=class extends ji{constructor(e){super(e,uo)}};function mo({router:e,children:t,...n}){Cn(n)&&e.update({...e.options,...n,context:{...e.options.context,...n.context}});let r=(0,R.jsx)(Zi.Provider,{value:e,children:t});return e.options.Wrap?(0,R.jsx)(e.options.Wrap,{children:r}):r}function ho({router:e,...t}){return(0,R.jsx)(mo,{router:e,...t,children:(0,R.jsx)(co,{})})}function go(e){let t=Qi({warn:e?.router===void 0}),n=e?.router||t,r=(0,L.useRef)(void 0);return Ta(n.stores.__store,t=>{if(e?.select){if(e.structuralSharing??n.options.defaultStructuralSharing){let n=En(r.current,e.select(t));return r.current=n,n}return e.select(t)}return t})}var _o=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),vo=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),yo=e=>{let t=vo(e);return t.charAt(0).toUpperCase()+t.slice(1)},bo=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),xo=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0},So={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},Co=(0,L.forwardRef)(({color:e=`currentColor`,size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>(0,L.createElement)(`svg`,{ref:c,...So,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:bo(`lucide`,i),...!a&&!xo(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,L.createElement)(e,t)),...Array.isArray(a)?a:[a]])),z=(e,t)=>{let n=(0,L.forwardRef)(({className:n,...r},i)=>(0,L.createElement)(Co,{ref:i,iconNode:t,className:bo(`lucide-${_o(yo(e))}`,`lucide-${e}`,n),...r}));return n.displayName=yo(e),n},wo=z(`activity`,[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]),To=z(`archive-restore`,[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h2`,key:`tvwodi`}],[`path`,{d:`M20 8v11a2 2 0 0 1-2 2h-2`,key:`1gkqxj`}],[`path`,{d:`m9 15 3-3 3 3`,key:`1pd0qc`}],[`path`,{d:`M12 12v9`,key:`192myk`}]]),Eo=z(`archive`,[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8`,key:`1s80jp`}],[`path`,{d:`M10 12h4`,key:`a56b0p`}]]),Do=z(`arrow-down-to-line`,[[`path`,{d:`M12 17V3`,key:`1cwfxf`}],[`path`,{d:`m6 11 6 6 6-6`,key:`12ii2o`}],[`path`,{d:`M19 21H5`,key:`150jfl`}]]),Oo=z(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),ko=z(`bell`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326`,key:`11g9vi`}]]),Ao=z(`bolt`,[[`path`,{d:`M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z`,key:`yt0hxn`}],[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}]]),jo=z(`book-a`,[[`path`,{d:`M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20`,key:`k3hazp`}],[`path`,{d:`m8 13 4-7 4 7`,key:`4rari8`}],[`path`,{d:`M9.1 11h5.7`,key:`1gkovt`}]]),Mo=z(`book-open-text`,[[`path`,{d:`M12 7v14`,key:`1akyts`}],[`path`,{d:`M16 12h2`,key:`7q9ll5`}],[`path`,{d:`M16 8h2`,key:`msurwy`}],[`path`,{d:`M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z`,key:`ruj8y`}],[`path`,{d:`M6 12h2`,key:`32wvfc`}],[`path`,{d:`M6 8h2`,key:`30oboj`}]]),No=z(`bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),Po=z(`braces`,[[`path`,{d:`M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1`,key:`ezmyqa`}],[`path`,{d:`M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1`,key:`e1hn23`}]]),Fo=z(`brain`,[[`path`,{d:`M12 18V5`,key:`adv99a`}],[`path`,{d:`M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4`,key:`1e3is1`}],[`path`,{d:`M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5`,key:`1gqd8o`}],[`path`,{d:`M17.997 5.125a4 4 0 0 1 2.526 5.77`,key:`iwvgf7`}],[`path`,{d:`M18 18a4 4 0 0 0 2-7.464`,key:`efp6ie`}],[`path`,{d:`M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517`,key:`1gq6am`}],[`path`,{d:`M6 18a4 4 0 0 1-2-7.464`,key:`k1g0md`}],[`path`,{d:`M6.003 5.125a4 4 0 0 0-2.526 5.77`,key:`q97ue3`}]]),Io=z(`bug`,[[`path`,{d:`M12 20v-9`,key:`1qisl0`}],[`path`,{d:`M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z`,key:`uouzyp`}],[`path`,{d:`M14.12 3.88 16 2`,key:`qol33r`}],[`path`,{d:`M21 21a4 4 0 0 0-3.81-4`,key:`1b0z45`}],[`path`,{d:`M21 5a4 4 0 0 1-3.55 3.97`,key:`5cxbf6`}],[`path`,{d:`M22 13h-4`,key:`1jl80f`}],[`path`,{d:`M3 21a4 4 0 0 1 3.81-4`,key:`1fjd4g`}],[`path`,{d:`M3 5a4 4 0 0 0 3.55 3.97`,key:`1d7oge`}],[`path`,{d:`M6 13H2`,key:`82j7cp`}],[`path`,{d:`m8 2 1.88 1.88`,key:`fmnt4t`}],[`path`,{d:`M9 7.13V6a3 3 0 1 1 6 0v1.13`,key:`1vgav8`}]]),Lo=z(`calendar-clock`,[[`path`,{d:`M16 14v2.2l1.6 1`,key:`fo4ql5`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`path`,{d:`M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5`,key:`1osxxc`}],[`path`,{d:`M3 10h5`,key:`r794hk`}],[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`circle`,{cx:`16`,cy:`16`,r:`6`,key:`qoo3c4`}]]),Ro=z(`check-check`,[[`path`,{d:`M18 6 7 17l-5-5`,key:`116fxf`}],[`path`,{d:`m22 10-7.5 7.5L13 16`,key:`ke71qq`}]]),zo=z(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),Bo=z(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),Vo=z(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),Ho=z(`chevrons-down-up`,[[`path`,{d:`m7 20 5-5 5 5`,key:`13a0gw`}],[`path`,{d:`m7 4 5 5 5-5`,key:`1kwcof`}]]),Uo=z(`chevrons-down`,[[`path`,{d:`m7 6 5 5 5-5`,key:`1lc07p`}],[`path`,{d:`m7 13 5 5 5-5`,key:`1d48rs`}]]),Wo=z(`chevrons-up-down`,[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]),Go=z(`chevrons-up`,[[`path`,{d:`m17 11-5-5-5 5`,key:`e8nh98`}],[`path`,{d:`m17 18-5-5-5 5`,key:`2avn1x`}]]),Ko=z(`circle-alert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),qo=z(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Jo=z(`circle-check-big`,[[`path`,{d:`M21.801 10A10 10 0 1 1 17 3.335`,key:`yps3ct`}],[`path`,{d:`m9 11 3 3L22 4`,key:`1pflzl`}]]),Yo=z(`circle-x`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),Xo=z(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),Zo=z(`clock-3`,[[`path`,{d:`M12 6v6h4`,key:`135r8i`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),Qo=z(`copy-plus`,[[`line`,{x1:`15`,x2:`15`,y1:`12`,y2:`18`,key:`1p7wdc`}],[`line`,{x1:`12`,x2:`18`,y1:`15`,y2:`15`,key:`1nscbv`}],[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),$o=z(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),es=z(`cpu`,[[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M17 20v2`,key:`1rnc9c`}],[`path`,{d:`M17 2v2`,key:`11trls`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M2 17h2`,key:`7oei6x`}],[`path`,{d:`M2 7h2`,key:`asdhe0`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`M20 17h2`,key:`1fpfkl`}],[`path`,{d:`M20 7h2`,key:`1o8tra`}],[`path`,{d:`M7 20v2`,key:`4gnj0m`}],[`path`,{d:`M7 2v2`,key:`1i4yhu`}],[`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`,key:`1vbyd7`}],[`rect`,{x:`8`,y:`8`,width:`8`,height:`8`,rx:`1`,key:`z9xiuo`}]]),ts=z(`database`,[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 21 19V5`,key:`1wlel7`}],[`path`,{d:`M3 12A9 3 0 0 0 21 12`,key:`mv7ke4`}]]),ns=z(`ellipsis-vertical`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]]),rs=z(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),is=z(`eye-off`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),as=z(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),os=z(`file-plus-2`,[[`path`,{d:`M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4`,key:`1pf5j1`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`M3 15h6`,key:`4e2qda`}],[`path`,{d:`M6 12v6`,key:`1u72j0`}]]),ss=z(`file-text`,[[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`,key:`1rqfz7`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),cs=z(`files`,[[`path`,{d:`M15 2a2 2 0 0 1 1.414.586l4 4A2 2 0 0 1 21 8v7a2 2 0 0 1-2 2h-8a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2z`,key:`1vo8kb`}],[`path`,{d:`M15 2v4a2 2 0 0 0 2 2h4`,key:`sud9ri`}],[`path`,{d:`M5 7a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 1.732-1`,key:`l4dndm`}]]),ls=z(`folder-plus`,[[`path`,{d:`M12 10v6`,key:`1bos4e`}],[`path`,{d:`M9 13h6`,key:`1uhe8q`}],[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),us=z(`folder`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),ds=z(`gauge`,[[`path`,{d:`m12 14 4-4`,key:`9kzdfg`}],[`path`,{d:`M3.34 19a10 10 0 1 1 17.32 0`,key:`19p75a`}]]),fs=z(`git-branch`,[[`line`,{x1:`6`,x2:`6`,y1:`3`,y2:`15`,key:`17qcm7`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}],[`path`,{d:`M18 9a9 9 0 0 1-9 9`,key:`n2h4wq`}]]),ps=z(`hammer`,[[`path`,{d:`m15 12-9.373 9.373a1 1 0 0 1-3.001-3L12 9`,key:`1hayfq`}],[`path`,{d:`m18 15 4-4`,key:`16gjal`}],[`path`,{d:`m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172v-.344a2 2 0 0 0-.586-1.414l-1.657-1.657A6 6 0 0 0 12.516 3H9l1.243 1.243A6 6 0 0 1 12 8.485V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5`,key:`15ts47`}]]),ms=z(`hash`,[[`line`,{x1:`4`,x2:`20`,y1:`9`,y2:`9`,key:`4lhtct`}],[`line`,{x1:`4`,x2:`20`,y1:`15`,y2:`15`,key:`vyu0kd`}],[`line`,{x1:`10`,x2:`8`,y1:`3`,y2:`21`,key:`1ggp8o`}],[`line`,{x1:`16`,x2:`14`,y1:`3`,y2:`21`,key:`weycgp`}]]),hs=z(`history`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]),gs=z(`key`,[[`path`,{d:`m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4`,key:`g0fldk`}],[`path`,{d:`m21 2-9.6 9.6`,key:`1j0ho8`}],[`circle`,{cx:`7.5`,cy:`15.5`,r:`5.5`,key:`yqb3hr`}]]),_s=z(`keyboard`,[[`path`,{d:`M10 8h.01`,key:`1r9ogq`}],[`path`,{d:`M12 12h.01`,key:`1mp3jc`}],[`path`,{d:`M14 8h.01`,key:`1primd`}],[`path`,{d:`M16 12h.01`,key:`1l6xoz`}],[`path`,{d:`M18 8h.01`,key:`emo2bl`}],[`path`,{d:`M6 8h.01`,key:`x9i8wu`}],[`path`,{d:`M7 16h10`,key:`wp8him`}],[`path`,{d:`M8 12h.01`,key:`czm47f`}],[`rect`,{width:`20`,height:`16`,x:`2`,y:`4`,rx:`2`,key:`18n3k1`}]]),vs=z(`layers`,[[`path`,{d:`M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z`,key:`zw3jo`}],[`path`,{d:`M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12`,key:`1wduqc`}],[`path`,{d:`M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17`,key:`kqbvx6`}]]),ys=z(`lightbulb`,[[`path`,{d:`M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5`,key:`1gvzjb`}],[`path`,{d:`M9 18h6`,key:`x1upvd`}],[`path`,{d:`M10 22h4`,key:`ceow96`}]]),bs=z(`list-checks`,[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`path`,{d:`m3 7 2 2 4-4`,key:`1obspn`}]]),xs=z(`list`,[[`path`,{d:`M3 5h.01`,key:`18ugdj`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M3 19h.01`,key:`noohij`}],[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M8 12h13`,key:`1za7za`}],[`path`,{d:`M8 19h13`,key:`m83p4d`}]]),Ss=z(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),Cs=z(`log-out`,[[`path`,{d:`m16 17 5-5-5-5`,key:`1bji2h`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}]]),ws=z(`lock`,[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`,key:`fwvmzm`}]]),Ts=z(`menu`,[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]),Es=z(`message-square-plus`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M12 8v6`,key:`1ib9pf`}],[`path`,{d:`M9 11h6`,key:`1fldmi`}]]),Ds=z(`message-square`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]),Os=z(`pause`,[[`rect`,{x:`14`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`kaeet6`}],[`rect`,{x:`5`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`1wsw3u`}]]),ks=z(`pen-line`,[[`path`,{d:`M13 21h8`,key:`1jsn5i`}],[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}]]),As=z(`play`,[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]),js=z(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),Ms=z(`power-off`,[[`path`,{d:`M18.36 6.64A9 9 0 0 1 20.77 15`,key:`dxknvb`}],[`path`,{d:`M6.16 6.16a9 9 0 1 0 12.68 12.68`,key:`1x7qb5`}],[`path`,{d:`M12 2v4`,key:`3427ic`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),Ns=z(`power`,[[`path`,{d:`M12 2v10`,key:`mnfbl`}],[`path`,{d:`M18.4 6.6a9 9 0 1 1-12.77.04`,key:`obofu9`}]]),Ps=z(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),Fs=z(`route`,[[`circle`,{cx:`6`,cy:`19`,r:`3`,key:`1kj8tv`}],[`path`,{d:`M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15`,key:`1d8sl`}],[`circle`,{cx:`18`,cy:`5`,r:`3`,key:`gq8acd`}]]),Is=z(`rows-3`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M21 9H3`,key:`1338ky`}],[`path`,{d:`M21 15H3`,key:`9uk58r`}]]),Ls=z(`save`,[[`path`,{d:`M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z`,key:`1c8476`}],[`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`,key:`1ydtos`}],[`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`,key:`t51u73`}]]),Rs=z(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),zs=z(`send-horizontal`,[[`path`,{d:`M3.714 3.048a.498.498 0 0 0-.683.627l2.843 7.627a2 2 0 0 1 0 1.396l-2.842 7.627a.498.498 0 0 0 .682.627l18-8.5a.5.5 0 0 0 0-.904z`,key:`117uat`}],[`path`,{d:`M6 12h16`,key:`s4cdu5`}]]),Bs=z(`server`,[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]),Vs=z(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),Hs=z(`shield-check`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Us=z(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),Ws=z(`trash-2`,[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]),Gs=z(`triangle-alert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),Ks=z(`user-round`,[[`circle`,{cx:`12`,cy:`8`,r:`5`,key:`1hypcn`}],[`path`,{d:`M20 21a8 8 0 0 0-16 0`,key:`rfgkzh`}]]),qs=z(`user`,[[`path`,{d:`M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2`,key:`975kel`}],[`circle`,{cx:`12`,cy:`7`,r:`4`,key:`17ys0d`}]]),Js=z(`wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]),Ys=z(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),Xs=Le();async function B(e,t){let n=await fetch(e,t),r=await n.json().catch(()=>void 0);if(!n.ok){let e=r&&typeof r==`object`&&`error`in r?String(r.error):`Request failed`,t=Error(e);throw t.status=n.status,t.data=r,t}return r}async function Zs(e,t=!1,n,r=!1){let i=_c(e,t,n);return r&&i.set(`markRead`,`true`),B(`/api/chat/bootstrap${i.size?`?${i.toString()}`:``}`).then(yc)}async function Qs(e,t=!1,n){let r=_c(e,t,n);return B(`/api/chat/navigation${r.size?`?${r.toString()}`:``}`).then(vc)}async function $s(e={}){let t=new URLSearchParams;return e.projectId&&t.set(`projectId`,e.projectId),e.piboSessionId&&t.set(`piboSessionId`,e.piboSessionId),e.includeArchived&&t.set(`includeArchived`,`true`),B(`/api/chat/projects/bootstrap${t.size?`?${t.toString()}`:``}`)}async function ec(e){return B(`/api/chat/projects`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(e)})}async function tc(e,t){return B(`/api/chat/projects/${encodeURIComponent(e)}`,{method:`PATCH`,headers:{"content-type":`application/json`},body:JSON.stringify(t)})}async function nc(e,t){return B(`/api/chat/projects/${encodeURIComponent(e)}`,{method:`DELETE`,headers:{"content-type":`application/json`},body:JSON.stringify(t)})}async function rc(e,t={}){return B(`/api/chat/projects/${encodeURIComponent(e)}/sessions`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(t)})}async function ic(e,t){return B(`/api/chat/project-sessions/${encodeURIComponent(e)}`,{method:`PATCH`,headers:{"content-type":`application/json`},body:JSON.stringify(t)})}async function ac(e,t,n){return B(`/api/chat/projects/message`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({piboSessionId:e,text:t,...n?{clientTxnId:n}:{}})})}async function oc(e){let t=new URLSearchParams;return e.roomId&&t.set(`roomId`,e.roomId),e.piboSessionId&&t.set(`piboSessionId`,e.piboSessionId),e.archived&&t.set(`archived`,`true`),e.cursor&&t.set(`cursor`,e.cursor),e.limit&&t.set(`limit`,String(e.limit)),B(`/api/chat/sessions${t.size?`?${t.toString()}`:``}`)}async function sc(e,t){return B(`/api/chat/sessions`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({...e?{profile:e}:{},...t?{roomId:t}:{}})})}async function cc(e){return B(`/api/chat/sessions/${encodeURIComponent(e)}/read`,{method:`POST`,headers:{"content-type":`application/json`},body:`{}`})}async function lc(e){return B(`/api/chat/rooms/${encodeURIComponent(e)}/read`,{method:`POST`,headers:{"content-type":`application/json`},body:`{}`})}async function uc(e){return B(`/api/chat/rooms`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(e)})}async function dc(e,t){return B(`/api/chat/rooms/${encodeURIComponent(e)}`,{method:`PATCH`,headers:{"content-type":`application/json`},body:JSON.stringify(t)})}async function fc(e,t){return B(`/api/chat/rooms/${encodeURIComponent(e)}`,{method:`DELETE`,headers:{"content-type":`application/json`},body:JSON.stringify({confirmName:t})})}async function pc(e,t){return B(`/api/chat/sessions/${encodeURIComponent(e)}`,{method:`PATCH`,headers:{"content-type":`application/json`},body:JSON.stringify(t)})}async function mc(e,t){return B(`/api/chat/sessions/${encodeURIComponent(e)}`,{method:`DELETE`,headers:{"content-type":`application/json`},body:JSON.stringify({confirmText:t})})}async function hc(e,t,n,r,i=[],a=[]){return B(`/api/chat/message`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({piboSessionId:e,text:t,clientTxnId:n,...r?{roomId:r}:{},...i.length?{webAnnotationIds:i}:{},...a.length?{fileAttachmentPaths:a}:{}})})}async function gc(e,t,n){return B(`/api/chat/action`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({piboSessionId:e,action:t,params:n})})}function _c(e,t=!1,n){let r=new URLSearchParams;return e&&r.set(`piboSessionId`,e),t&&r.set(`includeArchived`,`true`),n&&r.set(`roomId`,n),r}function vc(e){if(!e.session)throw Error(`Invalid navigation response.`);let t=e.sessions??[],n=e.selectedPiboSessionId??e.session.id??t[0]?.piboSessionId??``;return{identity:e.identity??{userId:``},session:e.session,runtimeStatus:e.runtimeStatus,room:e.room,selectedRoomId:e.selectedRoomId??``,selectedPiboSessionId:n,rooms:e.rooms??[],sessions:t}}function yc(e){return{...vc(e),agents:e.agents??[],customAgents:e.customAgents??[],modelDefaults:e.modelDefaults,modelCatalog:e.modelCatalog?{providers:(e.modelCatalog.providers??[]).map(e=>({...e,models:e.models??[]}))}:e.modelCatalog,agentCatalog:e.agentCatalog?{...e.agentCatalog,piboTools:e.agentCatalog.piboTools??[],piPackages:(e.agentCatalog.piPackages??[]).map(e=>({...e,enabled:e.enabled!==!1})),userSkills:e.agentCatalog.userSkills??[]}:e.agentCatalog,capabilities:{actions:e.capabilities?.actions??[]}}}var bc=[`terminal`,`workflow`],xc=`terminal`;function Sc(e){return typeof e==`string`&&bc.includes(e)}function Cc(e){return Sc(e)?e:void 0}function wc(e,t){let n=e.startsWith(`/apps/chat`)?e.slice(10)||`/`:e,r=typeof t.piboSessionId==`string`&&t.piboSessionId.trim()?t.piboSessionId.trim():void 0,i=n.split(`/`).filter(Boolean).map(e=>decodeURIComponent(e)),a=Cc(t.view);return i[0]===`context`?{area:`context`,...r?{piboSessionId:r}:{}}:i[0]===`workflows`&&i[1]===`drafts`&&i[2]?{area:`workflows`,draftId:i[2]}:i[0]===`workflows`&&i[1]===`view`&&i[2]&&i[3]?{area:`workflows`,viewWorkflowId:i[2],viewWorkflowVersion:i[3]}:i[0]===`workflows`?{area:`workflows`}:i[0]===`agents`?{area:`agents`}:i[0]===`cron`?{area:`cron`}:i[0]===`ralph`?{area:`ralph`}:i[0]===`settings`?{area:`settings`,panel:Dc(i[1])}:i[0]===`projects`&&i[1]&&i[2]===`sessions`&&i[3]?{area:`projects`,projectId:i[1],piboSessionId:i[3],sessionViewId:a}:i[0]===`projects`&&i[1]?{area:`projects`,projectId:i[1],sessionViewId:a}:i[0]===`projects`?{area:`projects`,sessionViewId:a}:i[0]===`rooms`&&i[1]&&i[2]===`sessions`&&i[3]?{area:`sessions`,roomId:i[1],piboSessionId:i[3],sessionViewId:a}:i[0]===`rooms`&&i[1]?{area:`sessions`,roomId:i[1],sessionViewId:a}:i[0]===`sessions`&&i[1]?{area:`sessions`,piboSessionId:i[1],sessionViewId:a}:{area:`sessions`,sessionViewId:a}}function Tc(e,t,n){let r={view:n};return e.area===`projects`?e.projectId&&e.piboSessionId?{to:`/projects/$projectId/sessions/$piboSessionId`,params:{projectId:e.projectId,piboSessionId:e.piboSessionId},search:r,replace:t}:e.projectId?{to:`/projects/$projectId`,params:{projectId:e.projectId},search:r,replace:t}:{to:`/projects`,search:r,replace:t}:e.area===`workflows`?e.draftId?{to:`/workflows/drafts/$draftId`,params:{draftId:e.draftId},replace:t}:{to:`/workflows`,replace:t}:e.area===`agents`?{to:`/agents`,replace:t}:e.area===`cron`?{to:`/cron`,replace:t}:e.area===`ralph`?{to:`/ralph`,replace:t}:e.area===`context`?{to:`/context`,search:e.piboSessionId?{piboSessionId:e.piboSessionId}:{},replace:t}:e.area===`settings`?{to:Oc(e.panel),replace:t}:e.roomId&&e.piboSessionId?{to:`/rooms/$roomId/sessions/$piboSessionId`,params:{roomId:e.roomId,piboSessionId:e.piboSessionId},search:r,replace:t}:e.roomId?{to:`/rooms/$roomId`,params:{roomId:e.roomId},search:r,replace:t}:e.piboSessionId?{to:`/sessions/$piboSessionId`,params:{piboSessionId:e.piboSessionId},search:r,replace:t}:{to:`/`,search:r,replace:t}}function Ec(e,t,n,r){e(Tc(t,n,r))}function Dc(e){return e===`shortcuts`?`shortcuts`:e===`maintenance`?`maintenance`:e===`pi-packages`?`pi-packages`:e===`skills`?`skills`:e===`providers`?`providers`:`general`}function Oc(e){return e===`shortcuts`?`/settings/shortcuts`:e===`maintenance`?`/settings/maintenance`:e===`pi-packages`?`/settings/pi-packages`:e===`skills`?`/settings/skills`:e===`providers`?`/settings/providers`:`/settings`}var kc=/filename\*=UTF-8''([^;]+)|filename="?([^";]+)"?/i;async function Ac(e){let t=new FormData;for(let n of e)t.append(`files`,n,n.name);let n=await fetch(`/api/chat/upload`,{method:`POST`,body:t});if(!n.ok){let e=await n.json().catch(()=>void 0),t=e&&typeof e==`object`&&`error`in e?String(e.error):`Upload failed`;throw Error(t)}return n.json()}async function jc(e,t={}){let n=new URLSearchParams({path:e});t.piboSessionId&&n.set(`piboSessionId`,t.piboSessionId),t.roomId&&n.set(`roomId`,t.roomId);let r=await fetch(`/api/chat/download?${n.toString()}`);if(!r.ok){let e=await r.json().catch(()=>void 0),t=e&&typeof e==`object`&&`error`in e?String(e.error):`Download failed`;throw Error(t)}let i=await r.blob(),a=URL.createObjectURL(i),o=document.createElement(`a`);o.href=a,o.download=Mc(r.headers.get(`content-disposition`)),document.body.append(o),o.click(),o.remove(),URL.revokeObjectURL(a)}function Mc(e){let t=e?.match(kc),n=t?.[1];return n?decodeURIComponent(n):t?.[2]??`download`}async function Nc(e,t){let n=new URLSearchParams({piboSessionId:e}),r=await fetch(`/api/chat/trace/summary?${n.toString()}`,{headers:t?{"if-none-match":Lc(t)}:void 0});if(r.status===304)return{notModified:!0,version:Rc(r.headers.get(`etag`))??t};let i=await r.json().catch(()=>void 0);if(!r.ok){let e=i&&typeof i==`object`&&`error`in i?String(i.error):`Request failed`,t=Error(e);throw t.status=r.status,t.data=i,t}return{summary:i,notModified:!1,version:Rc(r.headers.get(`etag`))??i.version}}async function Pc(e,t={}){let n=new URLSearchParams({piboSessionId:e});t.includeRawEvents&&n.set(`includeRawEvents`,`true`),t.rawEventsLimit&&n.set(`rawEventsLimit`,String(t.rawEventsLimit)),t.pageSize&&n.set(`pageSize`,String(t.pageSize)),t.beforeSequence===void 0?t.eventLimit&&n.set(`eventLimit`,String(t.eventLimit)):n.set(`beforeSequence`,String(t.beforeSequence));let r=await fetch(`/api/chat/trace?${n.toString()}`,{headers:t.knownVersion?{"if-none-match":Lc(t.knownVersion)}:void 0});if(r.status===304)return{notModified:!0,version:Rc(r.headers.get(`etag`))??t.knownVersion};let i=await r.json().catch(()=>void 0);if(!r.ok){let e=i&&typeof i==`object`&&`error`in i?String(i.error):`Request failed`,t=Error(e);throw t.status=r.status,t.data=i,t}return{trace:i,notModified:!1,version:Rc(r.headers.get(`etag`))??i.version}}async function Fc(e){return B(`/api/chat/signals/tree/${encodeURIComponent(e)}`)}function Ic(e,t){let n=new URLSearchParams({rootPiboSessionId:e}),r=new EventSource(`/api/chat/signals/events?${n.toString()}`);return r.addEventListener(`signal_snapshot`,e=>t.onSnapshot?.(JSON.parse(e.data))),r.addEventListener(`signal_patch`,e=>t.onPatch?.(JSON.parse(e.data))),r.onerror=e=>t.onError?.(e),()=>r.close()}function Lc(e){return`"${e}"`}function Rc(e){if(!e)return;let t=e.trim();return t.startsWith(`W/`)?Rc(t.slice(2)):t.startsWith(`"`)&&t.endsWith(`"`)?t.slice(1,-1):t}var zc={transcript:0,"event-log":1,live:2},Bc={"user.message":0,"execution.command":1,"execution.compaction":1,"agent.turn":2,"model.reasoning":3,"tool.call":4,"agent.delegation":4,"agent.async":5,"tool.result":6,"yielded.run":7,"assistant.message":8,error:9};function Vc(e,t){return{sourceRank:zc[`event-log`],turnSeq:e??2**53-1,eventSequence:e,phaseRank:Bc[t]}}function Hc(e,t,n){let r=e??2**53-1,i=t??2**53-1;return{sourceRank:zc.live,turnSeq:r,streamId:r,streamFrameIndex:i,phaseRank:Bc[n]}}function Uc(e){let[t,n]=e.split(`:`);if(t===void 0||n===void 0)return;let r=Number(t),i=Number(n);if(!(!Number.isInteger(r)||r<0)&&!(!Number.isInteger(i)||i<0))return{streamId:r,frameIndex:i}}function Wc(e,t){if(e)return{...e,contentPartIndex:(e.contentPartIndex??0)+.1,phaseRank:Bc[t]}}function Gc(e,t){return!e&&!t?0:e?t?e.sourceRank-t.sourceRank||e.turnSeq-t.turnSeq||(e.transcriptIndex??2**53-1)-(t.transcriptIndex??2**53-1)||(e.eventSequence??2**53-1)-(t.eventSequence??2**53-1)||(e.streamId??2**53-1)-(t.streamId??2**53-1)||(e.streamFrameIndex??2**53-1)-(t.streamFrameIndex??2**53-1)||(e.contentPartIndex??0)-(t.contentPartIndex??0)||e.phaseRank-t.phaseRank:-1:1}function Kc(e){try{let t=JSON.parse(e.data);if(typeof t.type!=`string`)return;let n=e.lastEventId?Uc(e.lastEventId):void 0;return{...t,...e.lastEventId?{streamFrameId:e.lastEventId}:{},...n?{streamId:n.streamId,streamFrameIndex:n.frameIndex}:{}}}catch{return}}function qc(e,t,n){let r=e.get(t);r?.streamId!==void 0&&r.streamId>=n||e.set(t,{streamId:n,frameIndex:2**53-1,cursor:Yc(n),exact:!1,...r?.liveReplayId===void 0?{}:{liveReplayId:r.liveReplayId}})}function Jc(e,t,n){let r=e.get(t),i=typeof n.liveReplayId==`number`&&Number.isFinite(n.liveReplayId)?Math.max(r?.liveReplayId??0,n.liveReplayId):r?.liveReplayId;if(n.streamId===void 0||n.streamFrameIndex===void 0){i!==void 0&&i!==r?.liveReplayId&&e.set(t,{...r??{exact:!1},liveReplayId:i});return}if(r&&(r.streamId!==void 0&&r.streamId>n.streamId||r.streamId===n.streamId&&r.exact&&r.frameIndex!==void 0&&r.frameIndex>=n.streamFrameIndex)){i!==void 0&&i!==r.liveReplayId&&e.set(t,{...r,liveReplayId:i});return}e.set(t,{streamId:n.streamId,frameIndex:n.streamFrameIndex,cursor:n.streamFrameId??`${n.streamId}:${n.streamFrameIndex}`,exact:!0,...i===void 0?{}:{liveReplayId:i}})}function Yc(e){return`${e}:999999`}function Xc(e){if(e.type===`RUN_FINISHED`||e.type===`TEXT_MESSAGE_END`)return 300;if(e.type===`RUN_ERROR`)return 0}function Zc(e){return e.type===`RUN_STARTED`||e.type===`RUN_FINISHED`||e.type===`RUN_ERROR`||e.type===`TEXT_MESSAGE_END`}function Qc(e){return e.type===`TEXT_MESSAGE_CONTENT`||e.type===`REASONING_MESSAGE_CONTENT`||e.type===`TOOL_CALL_START`||e.type===`TOOL_CALL_ARGS`||e.type===`TOOL_CALL_RESULT`||e.type===`RUN_ERROR`||e.type===`RAW_EVENT`}function $c(e,t,n){if(n.type===`RUN_STARTED`||n.type===`RUN_FINISHED`||n.type===`RUN_ERROR`){e.delete(t);return}let r=nl(n);r&&e.get(t)?.delete(r)}function el(e,t,n){let r=tl(n);if(!r)return!1;let i=e.get(t);return i||(i=new Set,e.set(t,i)),i.has(r)?!1:(i.add(r),!0)}function tl(e){if(e.type===`TEXT_MESSAGE_CONTENT`||e.type===`REASONING_MESSAGE_CONTENT`)return`${e.type}:${e.messageId}`}function nl(e){if(e.type===`TEXT_MESSAGE_START`)return`TEXT_MESSAGE_CONTENT:${e.messageId}`;if(e.type===`REASONING_MESSAGE_START`)return`REASONING_MESSAGE_CONTENT:${e.messageId}`}function rl(e){if(e.type===`RUN_ERROR`)return`error`;if(e.type===`RUN_FINISHED`||e.type===`TEXT_MESSAGE_END`)return`idle`;if(e.type===`RUN_STARTED`||e.type===`TEXT_MESSAGE_START`||e.type===`TEXT_MESSAGE_CONTENT`||e.type===`REASONING_MESSAGE_START`||e.type===`REASONING_MESSAGE_CONTENT`||e.type===`TOOL_CALL_START`||e.type===`TOOL_CALL_ARGS`||e.type===`AGENT_DELEGATION`)return`running`}async function il(e){return B(`/api/context-files`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(e)})}async function al(){return(await B(`/api/context-files`)).files}async function ol(e){return(await B(`/api/context-files/${encodeURIComponent(e)}`)).file}async function sl(e){return(await B(`/api/context-files`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(e)})).file}async function cl(e,t={}){return(await B(`/api/context-files/${encodeURIComponent(e)}/link-from-plugin`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(t)})).file}async function ll(e,t){return(await B(`/api/context-files/${encodeURIComponent(e)}`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify(t)})).file}async function ul(e,t){return(await B(`/api/context-files/${encodeURIComponent(e)}`,{method:`PATCH`,headers:{"content-type":`application/json`},body:JSON.stringify(t)})).file}async function dl(e,t){await B(`/api/context-files/${encodeURIComponent(e)}`,{method:`DELETE`,headers:{"content-type":`application/json`},body:JSON.stringify({deleteFile:t})})}async function fl(e){return B(`/api/context-files/${encodeURIComponent(e)}/revisions`)}async function pl(e,t=`source`,n=`working`){let r=new URLSearchParams({base:t,target:n});return B(`/api/context-files/${encodeURIComponent(e)}/diff?${r.toString()}`)}async function ml(e){return(await B(`/api/context-files/${encodeURIComponent(e)}/reset-to-source`,{method:`POST`,headers:{"content-type":`application/json`},body:`{}`})).file}async function hl(e){return(await B(`/api/context-files/${encodeURIComponent(e)}/adopt-source`,{method:`POST`,headers:{"content-type":`application/json`},body:`{}`})).file}async function gl(e,t){return(await B(`/api/context-files/${encodeURIComponent(e)}/restore-revision`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({revisionId:t})})).file}var _l=t(n(((e,t)=>{var n=function(e){var t=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,n=0,r={},i={manual:e.Prism&&e.Prism.manual,disableWorkerMessageHandler:e.Prism&&e.Prism.disableWorkerMessageHandler,util:{encode:function e(t){return t instanceof a?new a(t.type,e(t.content),t.alias):Array.isArray(t)?t.map(e):t.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/\u00a0/g,` `)},type:function(e){return Object.prototype.toString.call(e).slice(8,-1)},objId:function(e){return e.__id||Object.defineProperty(e,`__id`,{value:++n}),e.__id},clone:function e(t,n){n||={};var r,a;switch(i.util.type(t)){case`Object`:if(a=i.util.objId(t),n[a])return n[a];for(var o in r={},n[a]=r,t)t.hasOwnProperty(o)&&(r[o]=e(t[o],n));return r;case`Array`:return a=i.util.objId(t),n[a]?n[a]:(r=[],n[a]=r,t.forEach(function(t,i){r[i]=e(t,n)}),r);default:return t}},getLanguage:function(e){for(;e;){var n=t.exec(e.className);if(n)return n[1].toLowerCase();e=e.parentElement}return`none`},setLanguage:function(e,n){e.className=e.className.replace(RegExp(t,`gi`),``),e.classList.add(`language-`+n)},currentScript:function(){if(typeof document>`u`)return null;if(document.currentScript&&document.currentScript.tagName===`SCRIPT`)return document.currentScript;try{throw Error()}catch(r){var e=(/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(r.stack)||[])[1];if(e){var t=document.getElementsByTagName(`script`);for(var n in t)if(t[n].src==e)return t[n]}return null}},isActive:function(e,t,n){for(var r=`no-`+t;e;){var i=e.classList;if(i.contains(t))return!0;if(i.contains(r))return!1;e=e.parentElement}return!!n}},languages:{plain:r,plaintext:r,text:r,txt:r,extend:function(e,t){var n=i.util.clone(i.languages[e]);for(var r in t)n[r]=t[r];return n},insertBefore:function(e,t,n,r){r||=i.languages;var a=r[e],o={};for(var s in a)if(a.hasOwnProperty(s)){if(s==t)for(var c in n)n.hasOwnProperty(c)&&(o[c]=n[c]);n.hasOwnProperty(s)||(o[s]=a[s])}var l=r[e];return r[e]=o,i.languages.DFS(i.languages,function(t,n){n===l&&t!=e&&(this[t]=o)}),o},DFS:function e(t,n,r,a){a||={};var o=i.util.objId;for(var s in t)if(t.hasOwnProperty(s)){n.call(t,s,t[s],r||s);var c=t[s],l=i.util.type(c);l===`Object`&&!a[o(c)]?(a[o(c)]=!0,e(c,n,null,a)):l===`Array`&&!a[o(c)]&&(a[o(c)]=!0,e(c,n,s,a))}}},plugins:{},highlightAll:function(e,t){i.highlightAllUnder(document,e,t)},highlightAllUnder:function(e,t,n){var r={callback:n,container:e,selector:`code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code`};i.hooks.run(`before-highlightall`,r),r.elements=Array.prototype.slice.apply(r.container.querySelectorAll(r.selector)),i.hooks.run(`before-all-elements-highlight`,r);for(var a=0,o;o=r.elements[a++];)i.highlightElement(o,t===!0,r.callback)},highlightElement:function(t,n,r){var a=i.util.getLanguage(t),o=i.languages[a];i.util.setLanguage(t,a);var s=t.parentElement;s&&s.nodeName.toLowerCase()===`pre`&&i.util.setLanguage(s,a);var c={element:t,language:a,grammar:o,code:t.textContent};function l(e){c.highlightedCode=e,i.hooks.run(`before-insert`,c),c.element.innerHTML=c.highlightedCode,i.hooks.run(`after-highlight`,c),i.hooks.run(`complete`,c),r&&r.call(c.element)}if(i.hooks.run(`before-sanity-check`,c),s=c.element.parentElement,s&&s.nodeName.toLowerCase()===`pre`&&!s.hasAttribute(`tabindex`)&&s.setAttribute(`tabindex`,`0`),!c.code){i.hooks.run(`complete`,c),r&&r.call(c.element);return}if(i.hooks.run(`before-highlight`,c),!c.grammar){l(i.util.encode(c.code));return}if(n&&e.Worker){var u=new Worker(i.filename);u.onmessage=function(e){l(e.data)},u.postMessage(JSON.stringify({language:c.language,code:c.code,immediateClose:!0}))}else l(i.highlight(c.code,c.grammar,c.language))},highlight:function(e,t,n){var r={code:e,grammar:t,language:n};if(i.hooks.run(`before-tokenize`,r),!r.grammar)throw Error(`The language "`+r.language+`" has no grammar.`);return r.tokens=i.tokenize(r.code,r.grammar),i.hooks.run(`after-tokenize`,r),a.stringify(i.util.encode(r.tokens),r.language)},tokenize:function(e,t){var n=t.rest;if(n){for(var r in n)t[r]=n[r];delete t.rest}var i=new c;return l(i,i.head,e),s(e,i,t,i.head,0),d(i)},hooks:{all:{},add:function(e,t){var n=i.hooks.all;n[e]=n[e]||[],n[e].push(t)},run:function(e,t){var n=i.hooks.all[e];if(!(!n||!n.length))for(var r=0,a;a=n[r++];)a(t)}},Token:a};e.Prism=i;function a(e,t,n,r){this.type=e,this.content=t,this.alias=n,this.length=(r||``).length|0}a.stringify=function e(t,n){if(typeof t==`string`)return t;if(Array.isArray(t)){var r=``;return t.forEach(function(t){r+=e(t,n)}),r}var a={type:t.type,content:e(t.content,n),tag:`span`,classes:[`token`,t.type],attributes:{},language:n},o=t.alias;o&&(Array.isArray(o)?Array.prototype.push.apply(a.classes,o):a.classes.push(o)),i.hooks.run(`wrap`,a);var s=``;for(var c in a.attributes)s+=` `+c+`="`+(a.attributes[c]||``).replace(/"/g,`&quot;`)+`"`;return`<`+a.tag+` class="`+a.classes.join(` `)+`"`+s+`>`+a.content+`</`+a.tag+`>`};function o(e,t,n,r){e.lastIndex=t;var i=e.exec(n);if(i&&r&&i[1]){var a=i[1].length;i.index+=a,i[0]=i[0].slice(a)}return i}function s(e,t,n,r,c,d){for(var f in n)if(!(!n.hasOwnProperty(f)||!n[f])){var p=n[f];p=Array.isArray(p)?p:[p];for(var m=0;m<p.length;++m){if(d&&d.cause==f+`,`+m)return;var h=p[m],g=h.inside,_=!!h.lookbehind,v=!!h.greedy,y=h.alias;if(v&&!h.pattern.global){var b=h.pattern.toString().match(/[imsuy]*$/)[0];h.pattern=RegExp(h.pattern.source,b+`g`)}for(var x=h.pattern||h,S=r.next,C=c;S!==t.tail&&!(d&&C>=d.reach);C+=S.value.length,S=S.next){var w=S.value;if(t.length>e.length)return;if(!(w instanceof a)){var T=1,E;if(v){if(E=o(x,C,e,_),!E||E.index>=e.length)break;var D=E.index,O=E.index+E[0].length,k=C;for(k+=S.value.length;D>=k;)S=S.next,k+=S.value.length;if(k-=S.value.length,C=k,S.value instanceof a)continue;for(var A=S;A!==t.tail&&(k<O||typeof A.value==`string`);A=A.next)T++,k+=A.value.length;T--,w=e.slice(C,k),E.index-=C}else if(E=o(x,0,w,_),!E)continue;var D=E.index,j=E[0],M=w.slice(0,D),N=w.slice(D+j.length),P=C+w.length;d&&P>d.reach&&(d.reach=P);var ee=S.prev;M&&(ee=l(t,ee,M),C+=M.length),u(t,ee,T);var te=new a(f,g?i.tokenize(j,g):j,y,j);if(S=l(t,ee,te),N&&l(t,S,N),T>1){var ne={cause:f+`,`+m,reach:P};s(e,t,n,S.prev,C,ne),d&&ne.reach>d.reach&&(d.reach=ne.reach)}}}}}}function c(){var e={value:null,prev:null,next:null},t={value:null,prev:e,next:null};e.next=t,this.head=e,this.tail=t,this.length=0}function l(e,t,n){var r=t.next,i={value:n,prev:t,next:r};return t.next=i,r.prev=i,e.length++,i}function u(e,t,n){for(var r=t.next,i=0;i<n&&r!==e.tail;i++)r=r.next;t.next=r,r.prev=t,e.length-=i}function d(e){for(var t=[],n=e.head.next;n!==e.tail;)t.push(n.value),n=n.next;return t}if(!e.document)return e.addEventListener&&(i.disableWorkerMessageHandler||e.addEventListener(`message`,function(t){var n=JSON.parse(t.data),r=n.language,a=n.code,o=n.immediateClose;e.postMessage(i.highlight(a,i.languages[r],r)),o&&e.close()},!1)),i;var f=i.util.currentScript();f&&(i.filename=f.src,f.hasAttribute(`data-manual`)&&(i.manual=!0));function p(){i.manual||i.highlightAll()}if(!i.manual){var m=document.readyState;m===`loading`||m===`interactive`&&f&&f.defer?document.addEventListener(`DOMContentLoaded`,p):window.requestAnimationFrame?window.requestAnimationFrame(p):window.setTimeout(p,16)}return i}(typeof window<`u`?window:typeof WorkerGlobalScope<`u`&&self instanceof WorkerGlobalScope?self:{});t!==void 0&&t.exports&&(t.exports=n),typeof global<`u`&&(global.Prism=n),n.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:`attr-equals`},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:`named-entity`},/&#x?[\da-f]{1,8};/i]},n.languages.markup.tag.inside[`attr-value`].inside.entity=n.languages.markup.entity,n.languages.markup.doctype.inside[`internal-subset`].inside=n.languages.markup,n.hooks.add(`wrap`,function(e){e.type===`entity`&&(e.attributes.title=e.content.replace(/&amp;/,`&`))}),Object.defineProperty(n.languages.markup.tag,`addInlined`,{value:function(e,t){var r={};r[`language-`+t]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:n.languages[t]},r.cdata=/^<!\[CDATA\[|\]\]>$/i;var i={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:r}};i[`language-`+t]={pattern:/[\s\S]+/,inside:n.languages[t]};var a={};a[e]={pattern:RegExp(`(<__[^>]*>)(?:<!\\[CDATA\\[(?:[^\\]]|\\](?!\\]>))*\\]\\]>|(?!<!\\[CDATA\\[)[\\s\\S])*?(?=<\\/__>)`.replace(/__/g,function(){return e}),`i`),lookbehind:!0,greedy:!0,inside:i},n.languages.insertBefore(`markup`,`cdata`,a)}}),Object.defineProperty(n.languages.markup.tag,`addAttribute`,{value:function(e,t){n.languages.markup.tag.inside[`special-attr`].push({pattern:RegExp(`(^|["'\\s])(?:`+e+`)\\s*=\\s*(?:"[^"]*"|'[^']*'|[^\\s'">=]+(?=[\\s>]))`,`i`),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[t,`language-`+t],inside:n.languages[t]},punctuation:[{pattern:/^=/,alias:`attr-equals`},/"|'/]}}}})}}),n.languages.html=n.languages.markup,n.languages.mathml=n.languages.markup,n.languages.svg=n.languages.markup,n.languages.xml=n.languages.extend(`markup`,{}),n.languages.ssml=n.languages.xml,n.languages.atom=n.languages.xml,n.languages.rss=n.languages.xml,(function(e){var t=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;e.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp(`@[\\w-](?:[^;{\\s"']|\\s+(?!\\s)|`+t.source+`)*?(?:;|(?=\\s*\\{))`),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:`selector`},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp(`\\burl\\((?:`+t.source+`|(?:[^\\\\\\r\\n()"']|\\\\[\\s\\S])*)\\)`,`i`),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp(`^`+t.source+`$`),alias:`url`}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+t.source+`)*(?=\\s*\\{)`),lookbehind:!0},string:{pattern:t,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},e.languages.css.atrule.inside.rest=e.languages.css;var n=e.languages.markup;n&&(n.tag.addInlined(`style`,`css`),n.tag.addAttribute(`style`,`css`))})(n),n.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/},n.languages.javascript=n.languages.extend(`clike`,{"class-name":[n.languages.clike[`class-name`],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(`(^|[^\\w$])(?:NaN|Infinity|0[bB][01]+(?:_[01]+)*n?|0[oO][0-7]+(?:_[0-7]+)*n?|0[xX][\\dA-Fa-f]+(?:_[\\dA-Fa-f]+)*n?|\\d+(?:_\\d+)*n|(?:\\d+(?:_\\d+)*(?:\\.(?:\\d+(?:_\\d+)*)?)?|\\.\\d+(?:_\\d+)*)(?:[Ee][+-]?\\d+(?:_\\d+)*)?)(?![\\w$])`),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),n.languages.javascript[`class-name`][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,n.languages.insertBefore(`javascript`,`keyword`,{regex:{pattern:RegExp(`((?:^|[^$\\w\\xA0-\\uFFFF."'\\])\\s]|\\b(?:return|yield))\\s*)\\/(?:(?:\\[(?:[^\\]\\\\\\r\\n]|\\\\.)*\\]|\\\\.|[^/\\\\\\[\\r\\n])+\\/[dgimyus]{0,7}|(?:\\[(?:[^[\\]\\\\\\r\\n]|\\\\.|\\[(?:[^[\\]\\\\\\r\\n]|\\\\.|\\[(?:[^[\\]\\\\\\r\\n]|\\\\.)*\\])*\\])*\\]|\\\\.|[^/\\\\\\[\\r\\n])+\\/[dgimyus]{0,7}v[dgimyus]{0,7})(?=(?:\\s|\\/\\*(?:[^*]|\\*(?!\\/))*\\*\\/)*(?:$|[\\r\\n,.;:})\\]]|\\/\\/))`),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:`language-regex`,inside:n.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:`function`},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:n.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:n.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:n.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:n.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),n.languages.insertBefore(`javascript`,`string`,{hashbang:{pattern:/^#!.*/,greedy:!0,alias:`comment`},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:`string`},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:`punctuation`},rest:n.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:`property`}}),n.languages.insertBefore(`javascript`,`operator`,{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:`property`}}),n.languages.markup&&(n.languages.markup.tag.addInlined(`script`,`javascript`),n.languages.markup.tag.addAttribute(`on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)`,`javascript`)),n.languages.js=n.languages.javascript,(function(){if(n===void 0||typeof document>`u`)return;Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector);var e=`Loading…`,t=function(e,t){return`✖ Error `+e+` while fetching file: `+t},r=`✖ Error: File does not exist or is empty`,i={js:`javascript`,py:`python`,rb:`ruby`,ps1:`powershell`,psm1:`powershell`,sh:`bash`,bat:`batch`,h:`c`,tex:`latex`},a=`data-src-status`,o=`loading`,s=`loaded`,c=`failed`,l=`pre[data-src]:not([`+a+`="`+s+`"]):not([`+a+`="`+o+`"])`;function u(e,n,i){var a=new XMLHttpRequest;a.open(`GET`,e,!0),a.onreadystatechange=function(){a.readyState==4&&(a.status<400&&a.responseText?n(a.responseText):a.status>=400?i(t(a.status,a.statusText)):i(r))},a.send(null)}function d(e){var t=/^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(e||``);if(t){var n=Number(t[1]),r=t[2],i=t[3];return r?i?[n,Number(i)]:[n,void 0]:[n,n]}}n.hooks.add(`before-highlightall`,function(e){e.selector+=`, `+l}),n.hooks.add(`before-sanity-check`,function(t){var r=t.element;if(r.matches(l)){t.code=``,r.setAttribute(a,o);var f=r.appendChild(document.createElement(`CODE`));f.textContent=e;var p=r.getAttribute(`data-src`),m=t.language;if(m===`none`){var h=(/\.(\w+)$/.exec(p)||[,`none`])[1];m=i[h]||h}n.util.setLanguage(f,m),n.util.setLanguage(r,m);var g=n.plugins.autoloader;g&&g.loadLanguages(m),u(p,function(e){r.setAttribute(a,s);var t=d(r.getAttribute(`data-range`));if(t){var i=e.split(/\r\n?|\n/g),o=t[0],c=t[1]==null?i.length:t[1];o<0&&(o+=i.length),o=Math.max(0,Math.min(o-1,i.length)),c<0&&(c+=i.length),c=Math.max(0,Math.min(c,i.length)),e=i.slice(o,c).join(`
11
+ `),r.hasAttribute(`data-start`)||r.setAttribute(`data-start`,String(o+1))}f.textContent=e,n.highlightElement(f)},function(e){r.setAttribute(a,c),f.textContent=e})}}),n.plugins.fileHighlight={highlight:function(e){for(var t=(e||document).querySelectorAll(l),r=0,i;i=t[r++];)n.highlightElement(i)}};var f=!1;n.fileHighlight=function(){f||=(console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."),!0),n.plugins.fileHighlight.highlight.apply(this,arguments)}})()}))(),1);function vl(e){return typeof e==`object`&&!!e&&`languages`in e}var yl=globalThis,bl=vl(yl.Prism)?yl.Prism:_l.default;yl.Prism=bl,typeof window<`u`&&(window.Prism=bl);var xl=Object.defineProperty,Sl=(e,t,n)=>t in e?xl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Cl=(e,t,n)=>Sl(e,typeof t==`symbol`?t:t+``,n),wl=class e{constructor(e=new Map){this.map=e}clone(){return new e(new Map(this.map))}increment(e){let t=this.map.get(e)??0;this.map.set(e,t+1)}decrement(e,t){let n=this.map.get(e);n!==void 0&&(--n,this.map.set(e,n),n===0&&t())}},Tl=class{constructor(){Cl(this,`map`,new Map)}getOrCreate(e){let t=this.map.get(e);return t===void 0&&(t=new Set,this.map.set(e,t)),t}get(e){return this.map.get(e)}use(e,t){let n=this.get(e);n!==void 0&&t(n)}delete(e){return this.map.delete(e)}};function El(e,t){return t(e),e}function Dl(){}var Ol=`cell`;function kl(e,t){return e===t}var Al=new Map,jl,Ml=class{constructor(e={}){Cl(this,`subscriptions`,new Tl),Cl(this,`singletonSubscriptions`,new Map),Cl(this,`graph`,new Tl),Cl(this,`state`,new Map),Cl(this,`distinctNodes`,new Map),Cl(this,`executionMaps`,new Map),Cl(this,`definitionRegistry`,new Set),Cl(this,`combinedCells`,[]);for(let t of Object.getOwnPropertySymbols(e))this.state.set(t,e[t])}cellInstance(e,t=!0,n=Symbol()){return this.state.has(n)||this.state.set(n,e),t!==!1&&!this.distinctNodes.has(n)&&this.distinctNodes.set(n,t===!0?kl:t),n}signalInstance(e=!0,t=Symbol()){return e!==!1&&this.distinctNodes.set(t,e===!0?kl:e),t}sub(e,t){this.register(e);let n=this.subscriptions.getOrCreate(e);return n.add(t),()=>n.delete(t)}singletonSub(e,t){return this.register(e),t===void 0?this.singletonSubscriptions.delete(e):this.singletonSubscriptions.set(e,t),()=>this.singletonSubscriptions.delete(e)}resetSingletonSubs(){this.singletonSubscriptions.clear()}subMultiple(e,t){let n=this.signalInstance();return this.connect({map:e=>(...t)=>{e(t)},sink:n,sources:e}),this.sub(n,t)}pubIn(e){var t;let n=Reflect.ownKeys(e),r=this.getExecutionMap(n),i=r.refCount.clone(),a=r.participatingNodes.slice(),o=new Map(this.state),s=e=>{this.graph.use(e,t=>{for(let{sources:n,sink:r}of t)n.has(e)&&i.decrement(r,()=>{a.splice(a.indexOf(r),1),s(r)})})};for(;;){let n=a.shift();if(n===void 0)break;let i=n,c=!1,l=e=>{let t=this.distinctNodes.get(i);if(t!=null&&t(o.get(i),e)){c=!1;return}c=!0,o.set(i,e),this.state.has(i)&&this.state.set(i,e)};if(Object.prototype.hasOwnProperty.call(e,i)?l(e[i]):r.projections.use(i,e=>{for(let t of e){let e=[...Array.from(t.sources),...Array.from(t.pulls)].map(e=>o.get(e));t.map(l)(...e)}}),c){let e=o.get(i);this.inContext(()=>{this.subscriptions.use(i,t=>{for(let n of t)n(e)})}),(t=this.singletonSubscriptions.get(i))==null||t(e)}else s(i)}}connect({sources:e,pulls:t=[],map:n,sink:r}){let i={map:n,pulls:new Set(t),sink:this.register(r),sources:new Set(e)};for(let n of[...e,...t])this.register(n),this.graph.getOrCreate(n).add(i);this.executionMaps.clear()}pub(e,t){this.pubIn({[e]:t})}pipe(e,...t){return this.combineOperators(...t)(e)}transformer(...e){return t=>El(this.signalInstance(),n=>(this.link(this.pipe(n,...e),t),n))}link(e,t){this.connect({map:e=>t=>{e(t)},sink:t,sources:[e]})}combine(...e){return El(this.signalInstance(),t=>{this.connect({map:e=>(...t)=>{e(t)},sink:t,sources:e})})}combineCells(...e){let t=this.combinedCells.find(t=>e.length===t.sources.length&&e.every((e,n)=>e===t.sources[n]));if(t)return t.cell;let n=this.cellInstance(e.map(e=>this.getValue(e)),!0);return this.connect({map:e=>(...t)=>{e(t)},sink:n,sources:e}),this.combinedCells.push({sources:e,cell:n}),n}getValue(e){return this.register(e),this.state.get(e)}getValues(e){return e.map(e=>this.getValue(e))}register(e){let t=Al.get(e);return t===void 0||this.definitionRegistry.has(e)?e:(this.definitionRegistry.add(e),El(t.type===Ol?this.cellInstance(t.initial,t.distinct,e):this.signalInstance(t.distinct,e),e=>{this.inContext(()=>{t.init(this,e)})}))}inContext(e){let t=jl;jl=this;let n=e();return jl=t,n}changeWith(e,t,n){this.connect({sources:[t],pulls:[e],sink:e,map:e=>(t,r)=>{e(n(r,t))}})}calculateExecutionMap(e){let t=[],n=new Set,r=new Tl,i=new wl,a=new Tl,o=(e,s=0)=>{i.increment(e),!n.has(e)&&(this.register(e),r.use(e,e=>{s=Math.max(...Array.from(e).map(e=>t.indexOf(e)))+1}),this.graph.use(e,t=>{for(let n of t)n.sources.has(e)?(a.getOrCreate(n.sink).add(n),o(n.sink,s)):r.getOrCreate(n.sink).add(e)}),n.add(e),t.splice(s,0,e))};return e.forEach(o),{participatingNodes:t,pendingPulls:r,projections:a,refCount:i}}getExecutionMap(e){let t=e;if(e.length===1){t=e[0];let n=this.executionMaps.get(t);if(n!==void 0)return n}else for(let[t,n]of this.executionMaps.entries())if(Array.isArray(t)&&t.length===e.length&&t.every(t=>e.includes(t)))return n;let n=this.calculateExecutionMap(e);return this.executionMaps.set(t,n),n}combineOperators(...e){return t=>{for(let n of e)t=n(t,this);return t}}};function Nl(e,t=Dl,n=!0){return El(Symbol(),r=>{Al.set(r,{type:Ol,distinct:n,initial:e,init:t})})}function Pl(e=Dl,t=!1){return El(Symbol(),n=>{Al.set(n,{type:`signal`,distinct:t,init:e})})}function Fl(e=Dl){return El(Symbol(),t=>{Al.set(t,{type:`signal`,distinct:!1,init:e})})}var Il=L.createContext(null);function Ll(){let e=L.useContext(Il);if(e===null)throw Error(`useRealm must be used within a RealmContextProvider`);return e}function Rl(e){let t=Ll();t.register(e);let n=L.useCallback(n=>t.sub(e,n),[t,e]);return L.useSyncExternalStore(n,()=>t.getValue(e),()=>t.getValue(e))}function zl(...e){let t=Ll();return Rl(L.useMemo(()=>t.combineCells.apply(t,e),[t,...e]))}function Bl(e){let t=Ll();return t.register(e),L.useCallback(n=>{t.pub(e,n)},[t,e])}function Vl(e){return(t,n)=>{let r=n.signalInstance();return n.connect({map:t=>n=>{t(e(n))},sink:r,sources:[t]}),r}}function Hl(...e){return(t,n)=>{let r=n.signalInstance();return n.connect({map:e=>(...t)=>{e(t)},pulls:e,sink:r,sources:[t]}),r}}function Ul(e){return(t,n)=>{let r=n.signalInstance();return n.connect({map:t=>n=>{e(n)&&t(n)},sink:r,sources:[t]}),r}}function Wl(e,t){return(n,r)=>{let i=r.signalInstance();return r.connect({map:n=>r=>{n(t=e(t,r))},sink:i,sources:[n]}),i}}function Gl(e,t){return t(e),e}function Kl(){}function ql(e){return function(t){return{init:n=>e.init?.call(e,n,t),postInit:n=>e.postInit?.call(e,n,t),update:n=>e.update?.call(e,n,t)}}}function Jl({children:e,plugins:t}){let n=L.useMemo(()=>Gl(new Ml,e=>{var n,r;for(let r of t)(n=r.init)==null||n.call(r,e);for(let n of t)(r=n.postInit)==null||r.call(n,e)}),[]);return L.useEffect(()=>{var e;for(let r of t)(e=r.update)==null||e.call(r,n)}),L.createElement(Il.Provider,{value:n},e)}var Yl=(0,L.createContext)(null);function Xl(e,t){let n=null;return e!=null&&(n=e[1]),{getTheme:function(){return t??(n==null?null:n.getTheme())}}}function Zl(){let e=(0,L.useContext)(Yl);return e??function(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(8),e}function V(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}var Ql=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0,$l=Ql&&`documentMode`in document?document.documentMode:null,eu=Ql&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),tu=Ql&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),nu=!(!Ql||!(`InputEvent`in window)||$l)&&`getTargetRanges`in new window.InputEvent(`input`),ru=Ql&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),iu=Ql&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,au=Ql&&/Android/.test(navigator.userAgent),ou=Ql&&/^(?=.*Chrome).*/i.test(navigator.userAgent),su=Ql&&au&&ou,cu=Ql&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!ou;function lu(...e){let t=[];for(let n of e)if(n&&typeof n==`string`)for(let[e]of n.matchAll(/\S+/g))t.push(e);return t}var uu=1,du=3,fu=9,pu=11,mu=0,hu=1,gu=2,_u=0,vu=1,yu=2,bu=1,xu=2,Su=3,Cu=4,wu=5,Tu=6,Eu=ru||iu||cu?`\xA0`:`​`,Du=`
12
+
13
+ `,Ou=tu?`\xA0`:Eu,ku={bold:1,capitalize:1024,code:16,highlight:128,italic:2,lowercase:256,strikethrough:4,subscript:32,superscript:64,underline:8,uppercase:512},Au={directionless:1,unmergeable:2},ju={center:xu,end:Tu,justify:Cu,left:bu,right:Su,start:wu},Mu={[xu]:`center`,[Tu]:`end`,[Cu]:`justify`,[bu]:`left`,[Su]:`right`,[wu]:`start`},Nu={normal:0,segmented:2,token:1},Pu={[_u]:`normal`,[yu]:`segmented`,[vu]:`token`},Fu=`$config`;function Iu(e,t,n,r,i,a){let o=e.getFirstChild();for(;o!==null;){let e=o.__key;o.__parent===t&&(G(o)&&Iu(o,e,n,r,i,a),n.has(e)||a.delete(e),i.push(e)),o=o.getNextSibling()}}var Lu=100,Ru=!1,zu=0;function Bu(e){zu=e.timeStamp}function Vu(e,t,n){let r=e.nodeName===`BR`,i=t.__lexicalLineBreak;return i&&(e===i||r&&e.previousSibling===i)||r&&kh(e,n)!==void 0}function Hu(e,t,n){let r=gg(cg(n)),i=null,a=null;r!==null&&r.anchorNode===e&&(i=r.anchorOffset,a=r.focusOffset);let o=e.nodeValue;o!==null&&Hh(t,o,i,a,!1)}function Uu(e,t,n){if(U(e)){let t=e.anchor.getNode();if(t.is(n)&&e.format!==t.getFormat())return!1}return vh(t)&&n.isAttached()}function Wu(e,t,n,r){for(let i=e;i&&!Mg(i);i=ig(i)){let e=kh(i,t);if(e!==void 0){let t=Dh(e,n);if(t)return Hm(t)||!yg(i)?void 0:[i,t]}else if(i===r)return[r,Ph(n)]}}function Gu(e,t,n){Ru=!0;let r=performance.now()-zu>Lu;try{Lm(e,(()=>{let i=W()||function(e){return e.getEditorState().read((()=>{let e=W();return e===null?null:e.clone()}))}(e),a=new Map,o=e.getRootElement(),s=e._editorState,c=e._blockCursorElement,l=!1,u=``;for(let n=0;n<t.length;n++){let d=t[n],f=d.type,p=d.target,m=Wu(p,e,s,o);if(!m)continue;let[h,g]=m;if(f===`characterData`)r&&H(g)&&vh(p)&&Uu(i,p,g)&&Hu(p,g,e);else if(f===`childList`){l=!0;let t=d.addedNodes;for(let n=0;n<t.length;n++){let r=t[n],i=Oh(r),a=r.parentNode;if(a!=null&&r!==c&&i===null&&!Vu(r,a,e)){if(tu){let e=(yg(r)?r.innerText:null)||r.nodeValue;e&&(u+=e)}a.removeChild(r)}}let n=d.removedNodes,r=n.length;if(r>0){let t=0;for(let i=0;i<r;i++){let r=n[i];(Vu(r,p,e)||c===r)&&(p.appendChild(r),t++)}r!==t&&a.set(h,g)}}}if(a.size>0)for(let[t,n]of a)n.reconcileObservedMutation(t,e);let d=n.takeRecords();if(d.length>0){for(let t=0;t<d.length;t++){let n=d[t],r=n.addedNodes,i=n.target;for(let t=0;t<r.length;t++){let n=r[t],a=n.parentNode;a==null||n.nodeName!==`BR`||Vu(n,i,e)||a.removeChild(n)}}n.takeRecords()}i!==null&&(l&&Fh(i),tu&&eg(e)&&i.insertRawText(u))}))}finally{Ru=!1}}function Ku(e){let t=e._observer;t!==null&&Gu(e,t.takeRecords(),t)}function qu(e){(function(e){zu===0&&cg(e).addEventListener(`textInput`,Bu,!0)})(e),e._observer=new MutationObserver(((t,n)=>{Gu(e,t,n)}))}function Ju(e){let t=new Map,n=new Set;for(let r=typeof e==`function`?e:e.replace;r.prototype&&r.prototype.getType!==void 0;r=Object.getPrototypeOf(r)){let{ownNodeConfig:e}=Pg(r);if(e&&e.stateConfigs)for(let r of e.stateConfigs){let e;`stateConfig`in r?(e=r.stateConfig,r.flat&&n.add(e.key)):e=r,t.set(e.key,e)}}return{flatKeys:n,sharedConfigMap:t}}var Yu=class e{constructor(e,t,n=void 0,r=new Map,i=void 0){this.node=e,this.sharedNodeState=t,this.unknownState=n,this.knownState=r;let{sharedConfigMap:a}=this.sharedNodeState,o=i===void 0?function(e,t,n){let r=n.size;if(t)for(let i in t){let t=e.get(i);t&&n.has(t)||r++}return r}(a,n,r):i;this.size=o}getValue(e){let t=this.knownState.get(e);if(t!==void 0)return t;this.sharedNodeState.sharedConfigMap.set(e.key,e);let n=e.defaultValue;if(this.unknownState&&e.key in this.unknownState){let t=this.unknownState[e.key];t!==void 0&&(n=e.parse(t)),this.updateFromKnown(e,n)}return n}getInternalState(){return[this.unknownState,this.knownState]}toJSON(){let e={...this.unknownState},t={};for(let[t,n]of this.knownState)t.isEqual(n,t.defaultValue)?delete e[t.key]:e[t.key]=t.unparse(n);for(let n of this.sharedNodeState.flatKeys)n in e&&(t[n]=e[n],delete e[n]);return Qu(e)&&(t.$=e),t}getWritable(t){if(this.node===t)return this;let{sharedNodeState:n,unknownState:r}=this,i=new Map(this.knownState);return new e(t,n,function(e,t,n){let r;if(n)for(let[i,a]of Object.entries(n)){let n=e.get(i);n?t.has(n)||t.set(n,n.parse(a)):(r||={},r[i]=a)}return r}(n.sharedConfigMap,i,r),i,this.size)}updateFromKnown(e,t){let n=e.key;this.sharedNodeState.sharedConfigMap.set(n,e);let{knownState:r,unknownState:i}=this;r.has(e)||i&&n in i||(i&&(delete i[n],this.unknownState=Qu(i)),this.size++),r.set(e,t)}updateFromUnknown(e,t){let n=this.sharedNodeState.sharedConfigMap.get(e);n?this.updateFromKnown(n,n.parse(t)):(this.unknownState=this.unknownState||{},e in this.unknownState||this.size++,this.unknownState[e]=t)}updateFromJSON(e){let{knownState:t}=this;for(let e of t.keys())t.set(e,e.defaultValue);if(this.size=t.size,this.unknownState=void 0,e)for(let[t,n]of Object.entries(e))this.updateFromUnknown(t,n)}};function Xu(e){let t=e.getWritable(),n=t.__state?t.__state.getWritable(t):new Yu(t,Zu(t));return t.__state=n,n}function Zu(e){return e.__state?e.__state.sharedNodeState:sh(Eg(),e.getType()).sharedNodeState}function Qu(e){if(e)for(let t in e)return e}function $u(e,t,n){for(let[r,i]of t.knownState){if(e.has(r.key))continue;e.add(r.key);let t=n?n.getValue(r):r.defaultValue;if(t!==i&&!r.isEqual(t,i))return!0}return!1}function ed(e,t,n){let{unknownState:r}=t,i=n?n.unknownState:void 0;if(r){for(let[t,n]of Object.entries(r))if(!e.has(t)&&(e.add(t),n!==(i?i[t]:void 0)))return!0}return!1}function td(e,t){let n=e.__state;return n&&n.node===e?n.getWritable(t):n}function nd(e,t){let n=e.__mode,r=e.__format,i=e.__style,a=t.__mode,o=t.__format,s=t.__style,c=e.__state,l=t.__state;return(n===null||n===a)&&(r===null||r===o)&&(i===null||i===s)&&(e.__state===null||c===l||function(e,t){if(e===t)return!0;if(e&&t&&e.size!==t.size)return!1;let n=new Set;return!(e&&$u(n,e,t)||t&&$u(n,t,e)||e&&ed(n,e,t)||t&&ed(n,t,e))}(c,l))}function rd(e,t){let n=e.mergeWithSibling(t),r=Tm()._normalizedNodes;return r.add(e.__key),r.add(t.__key),n}function id(e){let t,n,r=e;if(r.__text!==``||!r.isSimpleText()||r.isUnmergeable()){for(;(t=r.getPreviousSibling())!==null&&H(t)&&t.isSimpleText()&&!t.isUnmergeable();){if(t.__text!==``){if(nd(t,r)){r=rd(t,r);break}break}t.remove()}for(;(n=r.getNextSibling())!==null&&H(n)&&n.isSimpleText()&&!n.isUnmergeable();){if(n.__text!==``){if(nd(r,n)){r=rd(r,n);break}break}n.remove()}}else r.remove()}function ad(e){return od(e.anchor),od(e.focus),e}function od(e){for(;e.type===`element`;){let t=e.getNode(),n=e.offset,r,i;if(n===t.getChildrenSize()?(r=t.getChildAtIndex(n-1),i=!0):(r=t.getChildAtIndex(n),i=!1),H(r)){e.set(r.__key,i?r.getTextContentSize():0,`text`,!0);break}if(!G(r))break;e.set(r.__key,i?r.getChildrenSize():0,`element`,!0)}}var sd,cd,ld,ud,dd,fd,pd,md,hd,gd,_d=``,vd=null,yd=``,bd=``,xd=!1,Sd=!1;function Cd(e,t){let n=pd.get(e);if(t!==null){let n=Bd(e);n.parentNode===t&&t.removeChild(n)}if(md.has(e)||cd._keyToDOMMap.delete(e),G(n)){let e=Fd(n,pd);wd(e,0,e.length-1,null)}n!==void 0&&Zh(gd,ld,ud,n,`destroyed`)}function wd(e,t,n,r){let i=t;for(;i<=n;++i){let t=e[i];t!==void 0&&Cd(t,r)}}function Td(e,t){e.setProperty(`text-align`,t)}var Ed=`40px`;function Dd(e,t){let n=sd.theme.indent;if(typeof n==`string`){let r=e.classList.contains(n);t>0&&!r?e.classList.add(n):t<1&&r&&e.classList.remove(n)}let r=getComputedStyle(e).getPropertyValue(`--lexical-indent-base-value`)||Ed;e.style.setProperty(`padding-inline-start`,t===0?``:`calc(${t} * ${r})`)}function Od(e,t){let n=e.style;t===0?Td(n,``):t===bu?Td(n,`left`):t===xu?Td(n,`center`):t===Su?Td(n,`right`):t===Cu?Td(n,`justify`):t===wu?Td(n,`start`):t===Tu&&Td(n,`end`)}function kd(e,t){let n=function(e){let t=e.__dir;if(t!==null)return t;if(Wm(e))return null;let n=e.getParentOrThrow();return Wm(n)&&n.__dir===null?`auto`:null}(t);n===null?e.removeAttribute(`dir`):e.dir=n}function Ad(e,t){let n=md.get(e);n===void 0&&V(60);let r=n.createDOM(sd,cd);if(function(e,t,n){let r=n._keyToDOMMap;(function(e,t,n){let r=`__lexicalKey_${t._key}`;e[r]=n})(t,n,e),r.set(e,t)}(e,r,cd),H(n)?r.setAttribute(`data-lexical-text`,`true`):Hm(n)&&r.setAttribute(`data-lexical-decorator`,`true`),G(n)){let e=n.__indent,t=n.__size;if(kd(r,n),e!==0&&Dd(r,e),t!==0){let e=t-1;jd(Fd(n,md),n,0,e,n.getDOMSlot(r))}let i=n.__format;i!==0&&Od(r,i),n.isInline()||Nd(null,n,r),ng(n)&&(_d+=Du,bd+=Du)}else{let t=n.getTextContent();if(Hm(n)){let t=n.decorate(cd,sd);t!==null&&Ld(e,t),r.contentEditable=`false`}_d+=t,bd+=t}return t!==null&&t.insertChild(r),Zh(gd,ld,ud,n,`created`),r}function jd(e,t,n,r,i){let a=_d;_d=``;let o=n;for(;o<=r;++o){Ad(e[o],i);let t=md.get(e[o]);t!==null&&H(t)&&(vd===null&&(vd=t.getFormat()),yd===``&&(yd=t.getStyle()))}ng(t)&&(_d+=Du),i.element.__lexicalTextContent=_d,_d=a+_d}function Md(e,t){if(e){let n=e.__last;if(n){let e=t.get(n);if(e)return hp(e)?`line-break`:Hm(e)&&e.isInline()?`decorator`:null}return`empty`}return null}function Nd(e,t,n){let r=Md(e,pd),i=Md(t,md);r!==i&&t.getDOMSlot(n).setManagedLineBreak(i)}function Pd(e,t,n){var r;vd=null,yd=``,function(e,t,n){let r=_d,i=e.__size,a=t.__size;_d=``;let o=n.element;if(i===1&&a===1){let n=e.__first,r=t.__first;if(n===r)Id(n,o);else{let e=Bd(n),t=Ad(r,null);try{o.replaceChild(t,e)}catch(i){if(typeof i==`object`&&i){let a=`${i.toString()} Parent: ${o.tagName}, new child: {tag: ${t.tagName} key: ${r}}, old child: {tag: ${e.tagName}, key: ${n}}.`;throw Error(a)}throw i}Cd(n,null)}let i=md.get(r);H(i)&&(vd===null&&(vd=i.getFormat()),yd===``&&(yd=i.getStyle()))}else{let r=Fd(e,pd),s=Fd(t,md);if(r.length!==i&&V(227),s.length!==a&&V(228),i===0)a!==0&&jd(s,t,0,a-1,n);else if(a===0){if(i!==0){let e=n.after==null&&n.before==null&&n.element.__lexicalLineBreak==null;wd(r,0,i-1,e?null:o),e&&(o.textContent=``)}}else (function(e,t,n,r,i,a){let o=r-1,s=i-1,c,l,u=a.getFirstChild(),d=0,f=0;for(;d<=o&&f<=s;){let e=t[d],r=n[f];if(e===r)u=Rd(Id(r,a.element)),d++,f++;else{c===void 0&&(c=new Set(t)),l===void 0&&(l=new Set(n));let i=l.has(e),o=c.has(r);if(i)if(o){let e=rg(cd,r);e===u?u=Rd(Id(r,a.element)):(a.withBefore(u).insertChild(e),Id(r,a.element)),d++,f++}else Ad(r,a.withBefore(u)),f++;else u=Rd(Bd(e)),Cd(e,a.element),d++}let i=md.get(r);i!==null&&H(i)&&(vd===null&&(vd=i.getFormat()),yd===``&&(yd=i.getStyle()))}let p=d>o,m=f>s;if(p&&!m){let t=n[s+1],r=t===void 0?null:cd.getElementByKey(t);jd(n,e,f,s,a.withBefore(r))}else m&&!p&&wd(t,d,o,a.element)})(t,r,s,i,a,n)}ng(t)&&(_d+=Du),o.__lexicalTextContent=_d,_d=r+_d}(e,t,t.getDOMSlot(n)),r=t,vd==null||vd===r.__textFormat||Sd||r.setTextFormat(vd),function(e){yd===``||yd===e.__textStyle||Sd||e.setTextStyle(yd)}(t)}function Fd(e,t){let n=[],r=e.__first;for(;r!==null;){let e=t.get(r);e===void 0&&V(101),n.push(r),r=e.__next}return n}function Id(e,t){let n=pd.get(e),r=md.get(e);n!==void 0&&r!==void 0||V(61);let i=xd||fd.has(e)||dd.has(e),a=rg(cd,e);if(n===r&&!i){if(G(n)){let e=a.__lexicalTextContent;e!==void 0&&(_d+=e,bd+=e)}else{let e=n.getTextContent();bd+=e,_d+=e}return a}if(n!==r&&i&&Zh(gd,ld,ud,r,`updated`),r.updateDOM(n,a,sd)){let n=Ad(e,null);return t===null&&V(62),t.replaceChild(n,a),Cd(e,null),n}if(G(n)&&G(r)){let e=r.__indent;(xd||e!==n.__indent)&&Dd(a,e);let t=r.__format;if((xd||t!==n.__format)&&Od(a,t),i&&(Pd(n,r,a),Wm(r)||r.isInline()||Nd(n,r,a)),ng(r)&&(_d+=Du,bd+=Du),(xd||r.__dir!==n.__dir)&&(kd(a,r),Wm(r)&&!xd))for(let e of r.getChildren())G(e)&&kd(rg(cd,e.getKey()),e)}else{let t=r.getTextContent();if(Hm(r)){let t=r.decorate(cd,sd);t!==null&&Ld(e,t)}_d+=t,bd+=t}if(!Sd&&Wm(r)&&r.__cachedText!==bd){let e=r.getWritable();e.__cachedText=bd,r=e}return a}function Ld(e,t){let n=cd._pendingDecorators,r=cd._decorators;if(n===null){if(r[e]===t)return;n=jh(cd)}n[e]=t}function Rd(e){let t=e.nextSibling;return t!==null&&t===cd._blockCursorElement&&(t=t.nextSibling),t}function zd(e,t,n,r,i,a){_d=``,bd=``,xd=r===gu,cd=n,sd=n._config,ld=n._nodes,ud=cd._listeners.mutation,dd=i,fd=a,pd=e._nodeMap,md=t._nodeMap,Sd=t._readOnly,hd=new Map(n._keyToDOMMap);let o=new Map;return gd=o,Id(`root`,null),cd=void 0,ld=void 0,dd=void 0,fd=void 0,pd=void 0,md=void 0,sd=void 0,hd=void 0,gd=void 0,o}function Bd(e){let t=hd.get(e);return t===void 0&&V(75,e),t}function Vd(e){return{type:e}}var Hd=Vd(`SELECTION_CHANGE_COMMAND`),Ud=Vd(`SELECTION_INSERT_CLIPBOARD_NODES_COMMAND`),Wd=Vd(`CLICK_COMMAND`),Gd=Vd(`DELETE_CHARACTER_COMMAND`),Kd=Vd(`INSERT_LINE_BREAK_COMMAND`),qd=Vd(`INSERT_PARAGRAPH_COMMAND`),Jd=Vd(`CONTROLLED_TEXT_INSERTION_COMMAND`),Yd=Vd(`PASTE_COMMAND`),Xd=Vd(`REMOVE_TEXT_COMMAND`),Zd=Vd(`DELETE_WORD_COMMAND`),Qd=Vd(`DELETE_LINE_COMMAND`),$d=Vd(`FORMAT_TEXT_COMMAND`),ef=Vd(`UNDO_COMMAND`),tf=Vd(`REDO_COMMAND`),nf=Vd(`KEYDOWN_COMMAND`),rf=Vd(`KEY_ARROW_RIGHT_COMMAND`),af=Vd(`MOVE_TO_END`),of=Vd(`KEY_ARROW_LEFT_COMMAND`),sf=Vd(`MOVE_TO_START`),cf=Vd(`KEY_ARROW_UP_COMMAND`),lf=Vd(`KEY_ARROW_DOWN_COMMAND`),uf=Vd(`KEY_ENTER_COMMAND`),df=Vd(`KEY_SPACE_COMMAND`),ff=Vd(`KEY_BACKSPACE_COMMAND`),pf=Vd(`KEY_ESCAPE_COMMAND`),mf=Vd(`KEY_DELETE_COMMAND`),hf=Vd(`KEY_TAB_COMMAND`),gf=Vd(`INSERT_TAB_COMMAND`),_f=Vd(`INDENT_CONTENT_COMMAND`),vf=Vd(`OUTDENT_CONTENT_COMMAND`),yf=Vd(`DROP_COMMAND`),bf=Vd(`FORMAT_ELEMENT_COMMAND`),xf=Vd(`DRAGSTART_COMMAND`),Sf=Vd(`DRAGOVER_COMMAND`),Cf=Vd(`DRAGEND_COMMAND`),wf=Vd(`COPY_COMMAND`),Tf=Vd(`CUT_COMMAND`),Ef=Vd(`SELECT_ALL_COMMAND`),Df=Vd(`CLEAR_EDITOR_COMMAND`),Of=Vd(`CLEAR_HISTORY_COMMAND`),kf=Vd(`CAN_REDO_COMMAND`),Af=Vd(`CAN_UNDO_COMMAND`),jf=Vd(`FOCUS_COMMAND`),Mf=Vd(`BLUR_COMMAND`),Nf=Vd(`KEY_MODIFIER_COMMAND`),Pf=Object.freeze({}),Ff=30,If=[[`keydown`,function(e,t){if(Lf=e.timeStamp,Rf=e.key,!t.isComposing()&&!tg(t,nf,e)&&e.key!=null){if(Kf&&Jh(e))return Lm(t,(()=>{np(t,qf)})),Kf=!1,void(qf=``);if(function(e){return Gh(e,`ArrowRight`,{shiftKey:`any`})}(e))tg(t,rf,e);else if(function(e){return Gh(e,`ArrowRight`,Kh)}(e))tg(t,af,e);else if(function(e){return Gh(e,`ArrowLeft`,{shiftKey:`any`})}(e))tg(t,of,e);else if(function(e){return Gh(e,`ArrowLeft`,Kh)}(e))tg(t,sf,e);else if(function(e){return Gh(e,`ArrowUp`,{altKey:`any`,shiftKey:`any`})}(e))tg(t,cf,e);else if(function(e){return Gh(e,`ArrowDown`,{altKey:`any`,shiftKey:`any`})}(e))tg(t,lf,e);else if(function(e){return Gh(e,`Enter`,{altKey:`any`,ctrlKey:`any`,metaKey:`any`,shiftKey:!0})}(e))Wf=!0,tg(t,uf,e);else if(function(e){return e.key===` `}(e))tg(t,df,e);else if(function(e){return eu&&Gh(e,`o`,{ctrlKey:!0})}(e))e.preventDefault(),Wf=!0,tg(t,Kd,!0);else if(function(e){return Gh(e,`Enter`,{altKey:`any`,ctrlKey:`any`,metaKey:`any`})}(e))Wf=!1,tg(t,uf,e);else if(function(e){return Gh(e,`Backspace`,{shiftKey:`any`})||eu&&Gh(e,`h`,{ctrlKey:!0})}(e))Jh(e)?tg(t,ff,e):(e.preventDefault(),tg(t,Gd,!0));else if(function(e){return e.key===`Escape`}(e))tg(t,pf,e);else if(function(e){return Gh(e,`Delete`,{})||eu&&Gh(e,`d`,{ctrlKey:!0})}(e))(function(e){return e.key===`Delete`})(e)?tg(t,mf,e):(e.preventDefault(),tg(t,Gd,!1));else if(function(e){return Gh(e,`Backspace`,qh)}(e))e.preventDefault(),tg(t,Zd,!0);else if(function(e){return Gh(e,`Delete`,qh)}(e))e.preventDefault(),tg(t,Zd,!1);else if(function(e){return eu&&Gh(e,`Backspace`,{metaKey:!0})}(e))e.preventDefault(),tg(t,Qd,!0);else if(function(e){return eu&&(Gh(e,`Delete`,{metaKey:!0})||Gh(e,`k`,{ctrlKey:!0}))}(e))e.preventDefault(),tg(t,Qd,!1);else if(function(e){return Gh(e,`b`,Kh)}(e))e.preventDefault(),tg(t,$d,`bold`);else if(function(e){return Gh(e,`u`,Kh)}(e))e.preventDefault(),tg(t,$d,`underline`);else if(function(e){return Gh(e,`i`,Kh)}(e))e.preventDefault(),tg(t,$d,`italic`);else if(function(e){return Gh(e,`Tab`,{shiftKey:`any`})}(e))tg(t,hf,e);else if(function(e){return Gh(e,`z`,Kh)}(e))e.preventDefault(),tg(t,ef,void 0);else if(function(e){return eu?Gh(e,`z`,{metaKey:!0,shiftKey:!0}):Gh(e,`y`,{ctrlKey:!0})||Gh(e,`z`,{ctrlKey:!0,shiftKey:!0})}(e))e.preventDefault(),tg(t,tf,void 0);else{let n=t._editorState._selection;n===null||U(n)?Yh(e)&&(e.preventDefault(),tg(t,Ef,e)):function(e){return Gh(e,`c`,Kh)}(e)?(e.preventDefault(),tg(t,wf,e)):function(e){return Gh(e,`x`,Kh)}(e)?(e.preventDefault(),tg(t,Tf,e)):Yh(e)&&(e.preventDefault(),tg(t,Ef,e))}(function(e){return e.ctrlKey||e.shiftKey||e.altKey||e.metaKey})(e)&&tg(t,Nf,e)}}],[`pointerdown`,function(e,t){let n=e.target,r=e.pointerType;bg(n)&&r!==`touch`&&r!==`pen`&&e.button===0&&Lm(t,(()=>{uh(n)||(Uf=!0)}))}],[`compositionstart`,function(e,t){Lm(t,(()=>{let n=W();if(U(n)&&!t.isComposing()){let r=n.anchor,i=n.anchor.getNode();Th(r.key),(e.timeStamp<Lf+Ff||r.type===`element`||!n.isCollapsed()||i.getFormat()!==n.format||H(i)&&i.getStyle()!==n.style)&&tg(t,Jd,Ou)}}))}],[`compositionend`,function(e,t){tu?Gf=!0:iu||!ru&&!cu?Lm(t,(()=>{np(t,e.data)})):(Kf=!0,qf=e.data)}],[`input`,function(e,t){e.stopPropagation(),Lm(t,(()=>{if(yg(e.target)&&uh(e.target))return;let n=W(),r=e.data,i=tp(e);if(r!=null&&U(n)&&Xf(n,i,r,e.timeStamp,!1)){Gf&&=(np(t,r),!1);let i=n.anchor.getNode(),a=gg(cg(t));if(a===null)return;let o=n.isBackward(),s=o?n.anchor.offset:n.focus.offset,c=o?n.focus.offset:n.anchor.offset;nu&&!n.isCollapsed()&&H(i)&&a.anchorNode!==null&&i.getTextContent().slice(0,s)+r+i.getTextContent().slice(s+c)===Bh(a.anchorNode)||tg(t,Jd,r);let l=r.length;tu&&l>1&&e.inputType===`insertCompositionText`&&!t.isComposing()&&(n.anchor.offset-=l),ru||iu||cu||!t.isComposing()||(Lf=0,Th(null))}else Vh(!1,t,r===null?void 0:r),Gf&&=(np(t,r||void 0),!1);(function(){Sm(),Ku(Tm())})()}),{event:e}),Bf=null}],[`click`,function(e,t){Lm(t,(()=>{let n=W(),r=gg(cg(t)),i=im();if(r){if(U(n)){let t=n.anchor,a=t.getNode();if(t.type===`element`&&t.offset===0&&n.isCollapsed()&&!Wm(a)&&Nh().getChildrenSize()===1&&a.getTopLevelElementOrThrow().isEmpty()&&i!==null&&n.is(i))r.removeAllRanges(),n.dirty=!0;else if(e.detail===3&&!n.isCollapsed()&&a!==n.focus.getNode()){let e=function(e,t){let n=e;for(;n!==Nh()&&n!=null;){if(t(n))return n;n=n.getParent()}return null}(a,(e=>G(e)&&!e.isInline()));G(e)&&e.select(0)}}else if(e.pointerType===`touch`||e.pointerType===`pen`){let n=r.anchorNode;(yg(n)||vh(n))&&Fh(rm(i,r,t,e))}}tg(t,Wd,e)}))}],[`cut`,Pf],[`copy`,Pf],[`dragstart`,Pf],[`dragover`,Pf],[`dragend`,Pf],[`paste`,Pf],[`focus`,Pf],[`blur`,Pf],[`drop`,Pf]];nu&&If.push([`beforeinput`,(e,t)=>function(e,t){let n=e.inputType,r=tp(e);n===`deleteCompositionText`||tu&&eg(t)||n!==`insertCompositionText`&&Lm(t,(()=>{let i=W();if(n===`deleteContentBackward`){if(i===null){let e=im();if(!U(e))return;Fh(e.clone())}if(U(i)){let n=i.anchor.key===i.focus.key;if(a=e.timeStamp,Rf===`MediaLast`&&a<Lf+Ff&&t.isComposing()&&n){if(Th(null),Lf=0,setTimeout((()=>{Lm(t,(()=>{Th(null)}))}),Ff),U(i)){let e=i.anchor.getNode();e.markDirty(),H(e)||V(142),ep(i,e)}}else{Th(null),e.preventDefault();let r=i.anchor.getNode(),a=r.getTextContent(),o=r.canInsertTextAfter(),s=i.anchor.offset===0&&i.focus.offset===a.length,c=su&&n&&!s&&o;if(c&&i.isCollapsed()&&(c=!Hm($h(i.anchor,!0))),!c){tg(t,Gd,!0);let e=W();su&&U(e)&&e.isCollapsed()&&(Jf=e,setTimeout((()=>Jf=null)))}}return}}var a;if(!U(i))return;let o=e.data;Bf!==null&&Vh(!1,t,Bf),i.dirty&&Bf===null||!i.isCollapsed()||Wm(i.anchor.getNode())||r===null||i.applyDOMRange(r),Bf=null;let s=i.anchor,c=i.focus,l=s.getNode(),u=c.getNode();if(n!==`insertText`&&n!==`insertTranspose`)switch(e.preventDefault(),n){case`insertFromYank`:case`insertFromDrop`:case`insertReplacementText`:tg(t,Jd,e);break;case`insertFromComposition`:Th(null),tg(t,Jd,e);break;case`insertLineBreak`:Th(null),tg(t,Kd,!1);break;case`insertParagraph`:Th(null),Wf&&!iu?(Wf=!1,tg(t,Kd,!1)):tg(t,qd,void 0);break;case`insertFromPaste`:case`insertFromPasteAsQuotation`:tg(t,Yd,e);break;case`deleteByComposition`:(function(e,t){return e!==t||G(e)||G(t)||!gh(e)||!gh(t)})(l,u)&&tg(t,Xd,e);break;case`deleteByDrag`:case`deleteByCut`:tg(t,Xd,e);break;case`deleteContent`:tg(t,Gd,!1);break;case`deleteWordBackward`:tg(t,Zd,!0);break;case`deleteWordForward`:tg(t,Zd,!1);break;case`deleteHardLineBackward`:case`deleteSoftLineBackward`:tg(t,Qd,!0);break;case`deleteContentForward`:case`deleteHardLineForward`:case`deleteSoftLineForward`:tg(t,Qd,!1);break;case`formatStrikeThrough`:tg(t,$d,`strikethrough`);break;case`formatBold`:tg(t,$d,`bold`);break;case`formatItalic`:tg(t,$d,`italic`);break;case`formatUnderline`:tg(t,$d,`underline`);break;case`historyUndo`:tg(t,ef,void 0);break;case`historyRedo`:tg(t,tf,void 0)}else{if(o===`
14
+ `)e.preventDefault(),tg(t,Kd,!1);else if(o===Du)e.preventDefault(),tg(t,qd,void 0);else if(o==null&&e.dataTransfer){let t=e.dataTransfer.getData(`text/plain`);e.preventDefault(),i.insertRawText(t)}else o!=null&&Xf(i,r,o,e.timeStamp,!0)?(e.preventDefault(),tg(t,Jd,o)):Bf=o;zf=e.timeStamp}}))}(e,t)]);var Lf=0,Rf=null,zf=0,Bf=null,Vf=new WeakMap,Hf=!1,Uf=!1,Wf=!1,Gf=!1,Kf=!1,qf=``,Jf=null,Yf=[0,``,0,`root`,0];function Xf(e,t,n,r,i){let a=e.anchor,o=e.focus,s=a.getNode(),c=Tm(),l=gg(cg(c)),u=l===null?null:l.anchorNode,d=a.key,f=c.getElementByKey(d),p=n.length;return d!==o.key||!H(s)||(!i&&(!nu||zf<r+50)||s.isDirty()&&p<2||Lh(n))&&a.offset!==o.offset&&!s.isComposing()||_h(s)||s.isDirty()&&p>1||(i||!nu)&&f!==null&&!s.isComposing()&&u!==yh(f)||l!==null&&t!==null&&(!t.collapsed||t.startContainer!==l.anchorNode||t.startOffset!==l.anchorOffset)||s.getFormat()!==e.format||s.getStyle()!==e.style||function(e,t){if(t.isSegmented())return!0;if(!e.isCollapsed())return!1;let n=e.anchor.offset,r=t.getParentOrThrow(),i=gh(t);return n===0?!t.canInsertTextBefore()||!r.canInsertTextBefore()&&!t.isComposing()||i||function(e){let t=e.getPreviousSibling();return(H(t)||G(t)&&t.isInline())&&!t.canInsertTextAfter()}(t):n===t.getTextContentSize()&&(!t.canInsertTextAfter()||!r.canInsertTextAfter()&&!t.isComposing()||i)}(e,s)}function Zf(e,t){return vh(e)&&e.nodeValue!==null&&t!==0&&t!==e.nodeValue.length}function Qf(e,t,n){let{anchorNode:r,anchorOffset:i,focusNode:a,focusOffset:o}=e;Hf&&(Hf=!1,Zf(r,i)&&Zf(a,o)&&!Jf)||Lm(t,(()=>{if(!n)return void Fh(null);if(!fh(t,r,a))return;let s=W();if(Jf&&U(s)&&s.isCollapsed()){let e=s.anchor,t=Jf.anchor;(e.key===t.key&&e.offset===t.offset+1||e.offset===1&&t.getNode().is(e.getNode().getPreviousSibling()))&&(s=Jf.clone(),Fh(s))}if(Jf=null,U(s)){let n=s.anchor,r=n.getNode();if(s.isCollapsed()){e.type===`Range`&&e.anchorNode===e.focusNode&&(s.dirty=!0);let i=cg(t).event,a=i?i.timeStamp:performance.now(),[o,c,l,u,d]=Yf,f=Nh(),p=!1===t.isComposing()&&f.getTextContent()===``;if(a<d+200&&n.offset===l&&n.key===u)$f(s,o,c);else if(n.type===`text`)H(r)||V(141),ep(s,r);else if(n.type===`element`&&!p){G(r)||V(259);let e=n.getNode();e.isEmpty()?function(e,t){$f(e,t.getTextFormat(),t.getTextStyle())}(s,e):$f(s,0,``)}}else{let e=n.key,t=s.focus.key,r=s.getNodes(),a=r.length,c=s.isBackward(),l=c?o:i,u=c?i:o,d=c?t:e,f=c?e:t,p=2047,m=!1;for(let e=0;e<a;e++){let t=r[e],n=t.getTextContentSize();if(H(t)&&n!==0&&!(e===0&&t.__key===d&&l===n||e===a-1&&t.__key===f&&u===0)&&(m=!0,p&=t.getFormat(),p===0))break}s.format=m?p:0}}tg(t,Hd,void 0)}))}function $f(e,t,n){e.format===t&&e.style===n||(e.format=t,e.style=n,e.dirty=!0)}function ep(e,t){$f(e,t.getFormat(),t.getStyle())}function tp(e){if(!e.getTargetRanges)return null;let t=e.getTargetRanges();return t.length===0?null:t[0]}function np(e,t){let n=e._compositionKey;if(Th(null),n!==null&&t!=null){if(t===``){let t=Dh(n),r=yh(e.getElementByKey(n));r!==null&&r.nodeValue!==null&&H(t)&&Hh(t,r.nodeValue,null,null,!0);return}if(t[t.length-1]===`
15
+ `){let t=W();if(U(t)){let n=t.focus;t.anchor.set(n.key,n.offset,n.type),tg(e,uf,null);return}}}Vh(!0,e,t)}function rp(e){let t=e.__lexicalEventHandles;return t===void 0&&(t=[],e.__lexicalEventHandles=t),t}var ip=new Map;function ap(e){let t=_g(e.target);if(t===null)return;let n=mh(t.anchorNode);if(n===null)return;Uf&&(Uf=!1,Lm(n,(()=>{let r=im(),i=t.anchorNode;(yg(i)||vh(i))&&Fh(rm(r,t,n,e))})));let r=Rh(n),i=r[r.length-1],a=i._key,o=ip.get(a),s=o||i;s!==n&&Qf(t,s,!1),Qf(t,n,!0),n===i?o&&ip.delete(a):ip.set(a,n)}function op(e){e._lexicalHandled=!0}function sp(e){return!0===e._lexicalHandled}function cp(e){let t=e.ownerDocument,n=Vf.get(t);if(n===void 0)return;let r=n-1;r>=0||V(164),Vf.set(t,r),r===0&&t.removeEventListener(`selectionchange`,ap);let i=hh(e);ph(i)?(function(e){if(e._parentEditor!==null){let t=Rh(e),n=t[t.length-1]._key;ip.get(n)===e&&ip.delete(n)}else ip.delete(e._key)}(i),e.__lexicalEditor=null):i&&V(198);let a=rp(e);for(let e=0;e<a.length;e++)a[e]();e.__lexicalEventHandles=[]}function lp(e,t,n){Sm();let r=e.__key,i=e.getParent();if(i===null)return;let a=function(e){let t=W();if(!U(t)||!G(e))return t;let{anchor:n,focus:r}=t,i=n.getNode(),a=r.getNode();return og(i,e)&&n.set(e.__key,0,`element`),og(a,e)&&r.set(e.__key,0,`element`),t}(e),o=!1;if(U(a)&&t){let t=a.anchor,n=a.focus;t.key===r&&(sm(t,e,i,e.getPreviousSibling(),e.getNextSibling()),o=!0),n.key===r&&(sm(n,e,i,e.getPreviousSibling(),e.getNextSibling()),o=!0)}else Up(a)&&t&&e.isSelected()&&e.selectPrevious();if(U(a)&&t&&!o){let t=e.getIndexWithinParent();Ch(e),am(a,i,t,-1)}else Ch(e);n||ug(i)||i.canBeEmpty()||!i.isEmpty()||lp(i,t),t&&a&&Wm(i)&&i.isEmpty()&&i.selectEnd()}function up(e){return e}var dp=class{static getType(){let{ownNodeType:e}=Pg(this);return e===void 0&&V(64,this.name),e}static clone(e){V(65,this.name)}$config(){return{}}config(e,t){let n=t.extends||Object.getPrototypeOf(this.constructor);return Object.assign(t,{extends:n,type:e}),{[e]:t}}afterCloneFrom(e){this.__key===e.__key?(this.__parent=e.__parent,this.__next=e.__next,this.__prev=e.__prev,this.__state=e.__state):e.__state&&(this.__state=e.__state.getWritable(this))}constructor(e){this.__type=this.constructor.getType(),this.__parent=null,this.__prev=null,this.__next=null,Object.defineProperty(this,`__state`,{configurable:!0,enumerable:!1,value:void 0,writable:!0}),Sh(this,e)}getType(){return this.__type}isInline(){V(137,this.constructor.name)}isAttached(){let e=this.__key;for(;e!==null;){if(e===`root`)return!0;let t=Dh(e);if(t===null)break;e=t.__parent}return!1}isSelected(e){let t=e||W();if(t==null)return!1;let n=t.getNodes().some((e=>e.__key===this.__key));if(H(this))return n;if(U(t)&&t.anchor.type===`element`&&t.focus.type===`element`){if(t.isCollapsed())return!1;let e=this.getParent();if(Hm(this)&&this.isInline()&&e){let n=t.isBackward()?t.focus:t.anchor;if(e.is(n.getNode())&&n.offset===e.getChildrenSize()&&this.is(e.getLastChild()))return!1}}return n}getKey(){return this.__key}getIndexWithinParent(){let e=this.getParent();if(e===null)return-1;let t=e.getFirstChild(),n=0;for(;t!==null;){if(this.is(t))return n;n++,t=t.getNextSibling()}return-1}getParent(){let e=this.getLatest().__parent;return e===null?null:Dh(e)}getParentOrThrow(){let e=this.getParent();return e===null&&V(66,this.__key),e}getTopLevelElement(){let e=this;for(;e!==null;){let t=e.getParent();if(ug(t))return G(e)||e===this&&Hm(e)||V(194),e;e=t}return null}getTopLevelElementOrThrow(){let e=this.getTopLevelElement();return e===null&&V(67,this.__key),e}getParents(){let e=[],t=this.getParent();for(;t!==null;)e.push(t),t=t.getParent();return e}getParentKeys(){let e=[],t=this.getParent();for(;t!==null;)e.push(t.__key),t=t.getParent();return e}getPreviousSibling(){let e=this.getLatest().__prev;return e===null?null:Dh(e)}getPreviousSiblings(){let e=[],t=this.getParent();if(t===null)return e;let n=t.getFirstChild();for(;n!==null&&!n.is(this);)e.push(n),n=n.getNextSibling();return e}getNextSibling(){let e=this.getLatest().__next;return e===null?null:Dh(e)}getNextSiblings(){let e=[],t=this.getNextSibling();for(;t!==null;)e.push(t),t=t.getNextSibling();return e}getCommonAncestor(e){let t=G(this)?this:this.getParent(),n=G(e)?e:e.getParent(),r=t&&n?c_(t,n):null;return r?r.commonAncestor:null}is(e){return e!=null&&this.__key===e.__key}isBefore(e){let t=c_(this,e);return t!==null&&(t.type===`descendant`||(t.type===`branch`?a_(t)===-1:(t.type!==`same`&&t.type!==`ancestor`&&V(279),!1)))}isParentOf(e){let t=c_(this,e);return t!==null&&t.type===`ancestor`}getNodesBetween(e){let t=this.isBefore(e),n=[],r=new Set,i=this;for(;i!==null;){let a=i.__key;if(r.has(a)||(r.add(a),n.push(i)),i===e)break;let o=G(i)?t?i.getFirstChild():i.getLastChild():null;if(o!==null){i=o;continue}let s=t?i.getNextSibling():i.getPreviousSibling();if(s!==null){i=s;continue}let c=i.getParentOrThrow();if(r.has(c.__key)||n.push(c),c===e)break;let l=null,u=c;do{if(u===null&&V(68),l=t?u.getNextSibling():u.getPreviousSibling(),u=u.getParent(),u===null)break;l!==null||r.has(u.__key)||n.push(u)}while(l===null);i=l}return t||n.reverse(),n}isDirty(){let e=Tm()._dirtyLeaves;return e!==null&&e.has(this.__key)}getLatest(){let e=Dh(this.__key);return e===null&&V(113),e}getWritable(){Sm();let e=wm(),t=Tm(),n=e._nodeMap,r=this.__key,i=this.getLatest(),a=t._cloneNotNeeded,o=W();if(o!==null&&o.setCachedNodes(null),a.has(r))return wh(i),i;let s=Ag(i);return a.add(r),wh(s),n.set(r,s),s}getTextContent(){return``}getTextContentSize(){return this.getTextContent().length}createDOM(e,t){V(70)}updateDOM(e,t,n){V(71)}exportDOM(e){return{element:this.createDOM(e._config,e)}}exportJSON(){let e=this.__state?this.__state.toJSON():void 0;return{type:this.__type,version:1,...e}}static importJSON(e){V(18,this.name)}updateFromJSON(e){return function(e,t){let n=e.getWritable(),r=t.$,i=r;for(let e of Zu(n).flatKeys)e in t&&(i!==void 0&&i!==r||(i={...r}),i[e]=t[e]);return(n.__state||i)&&Xu(e).updateFromJSON(i),n}(this,e)}static transform(){return null}remove(e){lp(this,!0,e)}replace(e,t){Sm();let n=W();n!==null&&(n=n.clone()),pg(this,e);let r=this.getLatest(),i=this.__key,a=e.__key,o=e.getWritable(),s=this.getParentOrThrow().getWritable(),c=s.__size;Ch(o);let l=r.getPreviousSibling(),u=r.getNextSibling(),d=r.__prev,f=r.__next,p=r.__parent;if(lp(r,!1,!0),l===null?s.__first=a:l.getWritable().__next=a,o.__prev=d,u===null?s.__last=a:u.getWritable().__prev=a,o.__next=f,o.__parent=p,s.__size=c,t&&(G(this)&&G(o)||V(139),this.getChildren().forEach((e=>{o.append(e)}))),U(n)){Fh(n);let e=n.anchor,t=n.focus;e.key===i&&Bp(e,o),t.key===i&&Bp(t,o)}return Eh()===i&&Th(a),o}insertAfter(e,t=!0){Sm(),pg(this,e);let n=this.getWritable(),r=e.getWritable(),i=r.getParent(),a=W(),o=!1,s=!1;if(i!==null){let t=e.getIndexWithinParent();if(Ch(r),U(a)){let e=i.__key,n=a.anchor,r=a.focus;o=n.type===`element`&&n.key===e&&n.offset===t+1,s=r.type===`element`&&r.key===e&&r.offset===t+1}}let c=this.getNextSibling(),l=this.getParentOrThrow().getWritable(),u=r.__key,d=n.__next;if(c===null?l.__last=u:c.getWritable().__prev=u,l.__size++,n.__next=u,r.__next=d,r.__prev=n.__key,r.__parent=n.__parent,t&&U(a)){let e=this.getIndexWithinParent();am(a,l,e+1);let t=l.__key;o&&a.anchor.set(t,e+2,`element`),s&&a.focus.set(t,e+2,`element`)}return e}insertBefore(e,t=!0){Sm(),pg(this,e);let n=this.getWritable(),r=e.getWritable(),i=r.__key;Ch(r);let a=this.getPreviousSibling(),o=this.getParentOrThrow().getWritable(),s=n.__prev,c=this.getIndexWithinParent();a===null?o.__first=i:a.getWritable().__next=i,o.__size++,n.__prev=i,r.__prev=s,r.__next=n.__key,r.__parent=n.__parent;let l=W();return t&&U(l)&&am(l,this.getParentOrThrow(),c),e}isParentRequired(){return!1}createParentElementNode(){return $m()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(e,t){Sm();let n=this.getPreviousSibling(),r=this.getParentOrThrow();if(n===null)return r.select(0,0);if(G(n))return n.select();if(!H(n)){let e=n.getIndexWithinParent()+1;return r.select(e,e)}return n.select(e,t)}selectNext(e,t){Sm();let n=this.getNextSibling(),r=this.getParentOrThrow();if(n===null)return r.select();if(G(n))return n.select(0,0);if(!H(n)){let e=n.getIndexWithinParent();return r.select(e,e)}return n.select(e,t)}markDirty(){this.getWritable()}reconcileObservedMutation(e,t){this.markDirty()}},fp=class e extends dp{static getType(){return`linebreak`}static clone(t){return new e(t.__key)}constructor(e){super(e)}getTextContent(){return`
16
+ `}createDOM(){return document.createElement(`br`)}updateDOM(){return!1}isInline(){return!0}static importDOM(){return{br:e=>function(e){let t=e.parentElement;if(t!==null&&Cg(t)){let n=t.firstChild;if(n===e||n.nextSibling===e&&gp(n)){let n=t.lastChild;if(n===e||n.previousSibling===e&&gp(n))return!0}}return!1}(e)||function(e){let t=e.parentElement;if(t!==null&&Cg(t)){let n=t.firstChild;if(n===e||n.nextSibling===e&&gp(n))return!1;let r=t.lastChild;if(r===e||r.previousSibling===e&&gp(r))return!0}return!1}(e)?null:{conversion:pp,priority:0}}}static importJSON(e){return mp().updateFromJSON(e)}};function pp(e){return{node:mp()}}function mp(){return fg(new fp)}function hp(e){return e instanceof fp}function gp(e){return vh(e)&&/^( |\t|\r?\n)+$/.test(e.textContent||``)}function _p(e,t){return 16&t?`code`:t&128?`mark`:32&t?`sub`:64&t?`sup`:null}function vp(e,t){return 1&t?`strong`:2&t?`em`:`span`}function yp(e,t,n,r,i){let a=r.classList,o=Xh(i,`base`);o!==void 0&&a.add(...o),o=Xh(i,`underlineStrikethrough`);let s=!1,c=t&8&&t&4;o!==void 0&&(n&8&&n&4?(s=!0,c||a.add(...o)):c&&a.remove(...o));for(let e in ku){let r=ku[e];if(o=Xh(i,e),o!==void 0)if(n&r){if(s&&(e===`underline`||e===`strikethrough`)){t&r&&a.remove(...o);continue}t&r&&(!c||e!==`underline`)&&e!==`strikethrough`||a.add(...o)}else t&r&&a.remove(...o)}}function bp(e,t,n){let r=t.firstChild,i=n.isComposing(),a=e+(i?Eu:``);if(r==null)t.textContent=a;else{let e=r.nodeValue;if(e!==a)if(i||tu){let[t,n,i]=function(e,t){let n=e.length,r=t.length,i=0,a=0;for(;i<n&&i<r&&e[i]===t[i];)i++;for(;a+i<n&&a+i<r&&e[n-a-1]===t[r-a-1];)a++;return[i,n-i-a,t.slice(i,r-a)]}(e,a);n!==0&&r.deleteData(t,n),r.insertData(t,i)}else r.nodeValue=a}}function xp(e,t,n,r,i,a){bp(i,e,t);let o=a.theme.text;o!==void 0&&yp(0,0,r,e,o)}function Sp(e,t){let n=document.createElement(t);return n.appendChild(e),n}var Cp=class e extends dp{static getType(){return`text`}static clone(t){return new e(t.__text,t.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__text=e.__text,this.__format=e.__format,this.__style=e.__style,this.__mode=e.__mode,this.__detail=e.__detail}constructor(e=``,t){super(t),this.__text=e,this.__format=0,this.__style=``,this.__mode=0,this.__detail=0}getFormat(){return this.getLatest().__format}getDetail(){return this.getLatest().__detail}getMode(){return Pu[this.getLatest().__mode]}getStyle(){return this.getLatest().__style}isToken(){return this.getLatest().__mode===1}isComposing(){return this.__key===Eh()}isSegmented(){return this.getLatest().__mode===2}isDirectionless(){return!!(1&this.getLatest().__detail)}isUnmergeable(){return!!(2&this.getLatest().__detail)}hasFormat(e){let t=ku[e];return!!(this.getFormat()&t)}isSimpleText(){return this.__type===`text`&&this.__mode===0}getTextContent(){return this.getLatest().__text}getFormatFlags(e,t){return bh(this.getLatest().__format,e,t)}canHaveFormat(){return!0}isInline(){return!0}createDOM(e,t){let n=this.__format,r=_p(0,n),i=vp(0,n),a=r===null?i:r,o=document.createElement(a),s=o;this.hasFormat(`code`)&&o.setAttribute(`spellcheck`,`false`),r!==null&&(s=document.createElement(i),o.appendChild(s)),xp(s,this,0,n,this.__text,e);let c=this.__style;return c!==``&&(o.style.cssText=c),o}updateDOM(e,t,n){let r=this.__text,i=e.__format,a=this.__format,o=_p(0,i),s=_p(0,a),c=vp(0,i),l=vp(0,a);if((o===null?c:o)!==(s===null?l:s))return!0;if(o===s&&c!==l){let e=t.firstChild;e??V(48);let i=document.createElement(l);return xp(i,this,0,a,r,n),t.replaceChild(i,e),!1}let u=t;s!==null&&o!==null&&(u=t.firstChild,u??V(49)),bp(r,u,this);let d=n.theme.text;d!==void 0&&i!==a&&yp(0,i,a,u,d);let f=e.__style,p=this.__style;return f!==p&&(t.style.cssText=p),!1}static importDOM(){return{"#text":()=>({conversion:Op,priority:0}),b:()=>({conversion:Tp,priority:0}),code:()=>({conversion:jp,priority:0}),em:()=>({conversion:jp,priority:0}),i:()=>({conversion:jp,priority:0}),mark:()=>({conversion:jp,priority:0}),s:()=>({conversion:jp,priority:0}),span:()=>({conversion:wp,priority:0}),strong:()=>({conversion:jp,priority:0}),sub:()=>({conversion:jp,priority:0}),sup:()=>({conversion:jp,priority:0}),u:()=>({conversion:jp,priority:0})}}static importJSON(e){return Mp().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setTextContent(e.text).setFormat(e.format).setDetail(e.detail).setMode(e.mode).setStyle(e.style)}exportDOM(e){let{element:t}=super.exportDOM(e);return yg(t)||V(132),t.style.whiteSpace=`pre-wrap`,this.hasFormat(`lowercase`)?t.style.textTransform=`lowercase`:this.hasFormat(`uppercase`)?t.style.textTransform=`uppercase`:this.hasFormat(`capitalize`)&&(t.style.textTransform=`capitalize`),this.hasFormat(`bold`)&&(t=Sp(t,`b`)),this.hasFormat(`italic`)&&(t=Sp(t,`i`)),this.hasFormat(`strikethrough`)&&(t=Sp(t,`s`)),this.hasFormat(`underline`)&&(t=Sp(t,`u`)),{element:t}}exportJSON(){return{detail:this.getDetail(),format:this.getFormat(),mode:this.getMode(),style:this.getStyle(),text:this.getTextContent(),...super.exportJSON()}}selectionTransform(e,t){}setFormat(e){let t=this.getWritable();return t.__format=typeof e==`string`?ku[e]:e,t}setDetail(e){let t=this.getWritable();return t.__detail=typeof e==`string`?Au[e]:e,t}setStyle(e){let t=this.getWritable();return t.__style=e,t}toggleFormat(e){let t=bh(this.getFormat(),e,null);return this.setFormat(t)}toggleDirectionless(){let e=this.getWritable();return e.__detail^=1,e}toggleUnmergeable(){let e=this.getWritable();return e.__detail^=2,e}setMode(e){let t=Nu[e];if(this.__mode===t)return this;let n=this.getWritable();return n.__mode=t,n}setTextContent(e){if(this.__text===e)return this;let t=this.getWritable();return t.__text=e,t}select(e,t){Sm();let n=e,r=t,i=W(),a=this.getTextContent(),o=this.__key;if(typeof a==`string`){let e=a.length;n===void 0&&(n=e),r===void 0&&(r=e)}else n=0,r=0;if(!U(i))return em(o,n,o,r,`text`,`text`);{let e=Eh();e!==i.anchor.key&&e!==i.focus.key||Th(o),i.setTextNodeRange(this,n,this,r)}return i}selectStart(){return this.select(0,0)}selectEnd(){let e=this.getTextContentSize();return this.select(e,e)}spliceText(e,t,n,r){let i=this.getWritable(),a=i.__text,o=n.length,s=e;s<0&&(s=o+s,s<0&&(s=0));let c=W();if(r&&U(c)){let t=e+o;c.setTextNodeRange(i,t,i,t)}return i.__text=a.slice(0,s)+n+a.slice(s+t),i}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...e){Sm();let t=this.getLatest(),n=t.getTextContent();if(n===``)return[];let r=t.__key,i=Eh(),a=n.length;e.sort(((e,t)=>e-t)),e.push(a);let o=[],s=e.length;for(let t=0,r=0;t<a&&r<=s;r++){let i=e[r];i>t&&(o.push(n.slice(t,i)),t=i)}let c=o.length;if(c===1)return[t];let l=o[0],u=t.getParent(),d,f=t.getFormat(),p=t.getStyle(),m=t.__detail,h=!1,g=null,_=null,v=W();if(U(v)){let[e,t]=v.isBackward()?[v.focus,v.anchor]:[v.anchor,v.focus];e.type===`text`&&e.key===r&&(g=e),t.type===`text`&&t.key===r&&(_=t)}t.isSegmented()?(d=Mp(l),d.__format=f,d.__style=p,d.__detail=m,d.__state=td(t,d),h=!0):d=t.setTextContent(l);let y=[d];for(let e=1;e<c;e++){let n=Mp(o[e]);n.__format=f,n.__style=p,n.__detail=m,n.__state=td(t,n);let a=n.__key;i===r&&Th(a),y.push(n)}let b=g?g.offset:null,x=_?_.offset:null,S=0;for(let e of y){if(!g&&!_)break;let t=S+e.getTextContentSize();if(g!==null&&b!==null&&b<=t&&b>=S&&(g.set(e.getKey(),b-S,`text`),b<t&&(g=null)),_!==null&&x!==null&&x<=t&&x>=S){_.set(e.getKey(),x-S,`text`);break}S=t}if(u!==null){(function(e){let t=e.getPreviousSibling(),n=e.getNextSibling();t!==null&&wh(t),n!==null&&wh(n)})(this);let e=u.getWritable(),t=this.getIndexWithinParent();h?(e.splice(t,0,y),this.remove()):e.splice(t,1,y),U(v)&&am(v,u,t,c-1)}return y}mergeWithSibling(e){let t=e===this.getPreviousSibling();t||e===this.getNextSibling()||V(50);let n=this.__key,r=e.__key,i=this.__text,a=i.length;Eh()===r&&Th(n);let o=W();if(U(o)){let i=o.anchor,s=o.focus;i!==null&&i.key===r&&cm(i,t,n,e,a),s!==null&&s.key===r&&cm(s,t,n,e,a)}let s=e.__text,c=t?s+i:i+s;this.setTextContent(c);let l=this.getWritable();return e.remove(),l}isTextEntity(){return!1}};function wp(e){return{forChild:Np(e.style),node:null}}function Tp(e){let t=e,n=t.style.fontWeight===`normal`;return{forChild:Np(t.style,n?void 0:`bold`),node:null}}var Ep=new WeakMap;function Dp(e){if(!yg(e))return!1;if(e.nodeName===`PRE`)return!0;let t=e.style.whiteSpace;return typeof t==`string`&&t.startsWith(`pre`)}function Op(e){let t=e;e.parentElement===null&&V(129);let n=t.textContent||``;if(function(e){let t,n=e.parentNode,r=[e];for(;n!==null&&(t=Ep.get(n))===void 0&&!Dp(n);)r.push(n),n=n.parentNode;let i=t===void 0?n:t;for(let e=0;e<r.length;e++)Ep.set(r[e],i);return i}(t)!==null){let e=n.split(/(\r?\n|\t)/),t=[],r=e.length;for(let n=0;n<r;n++){let r=e[n];r===`
17
+ `||r===`\r
18
+ `?t.push(mp()):r===` `?t.push(Fp()):r!==``&&t.push(Mp(r))}return{node:t}}if(n=n.replace(/\r/g,``).replace(/[ \t\n]+/g,` `),n===``)return{node:null};if(n[0]===` `){let e=t,r=!0;for(;e!==null&&(e=kp(e,!1))!==null;){let t=e.textContent||``;if(t.length>0){/[ \t\n]$/.test(t)&&(n=n.slice(1)),r=!1;break}}r&&(n=n.slice(1))}if(n[n.length-1]===` `){let e=t,r=!0;for(;e!==null&&(e=kp(e,!0))!==null;)if((e.textContent||``).replace(/^( |\t|\r?\n)+/,``).length>0){r=!1;break}r&&(n=n.slice(0,n.length-1))}return n===``?{node:null}:{node:Mp(n)}}function kp(e,t){let n=e;for(;;){let e;for(;(e=t?n.nextSibling:n.previousSibling)===null;){let e=n.parentElement;if(e===null)return null;n=e}if(n=e,yg(n)){let e=n.style.display;if(e===``&&!Sg(n)||e!==``&&!e.startsWith(`inline`))return null}let r=n;for(;(r=t?n.firstChild:n.lastChild)!==null;)n=r;if(vh(n))return n;if(n.nodeName===`BR`)return null}}var Ap={code:`code`,em:`italic`,i:`italic`,mark:`highlight`,s:`strikethrough`,strong:`bold`,sub:`subscript`,sup:`superscript`,u:`underline`};function jp(e){let t=Ap[e.nodeName.toLowerCase()];return t===void 0?{node:null}:{forChild:Np(e.style,t),node:null}}function Mp(e=``){return fg(new Cp(e))}function H(e){return e instanceof Cp}function Np(e,t){let n=e.fontWeight,r=e.textDecoration.split(` `),i=n===`700`||n===`bold`,a=r.includes(`line-through`),o=e.fontStyle===`italic`,s=r.includes(`underline`),c=e.verticalAlign;return e=>H(e)?(i&&!e.hasFormat(`bold`)&&e.toggleFormat(`bold`),a&&!e.hasFormat(`strikethrough`)&&e.toggleFormat(`strikethrough`),o&&!e.hasFormat(`italic`)&&e.toggleFormat(`italic`),s&&!e.hasFormat(`underline`)&&e.toggleFormat(`underline`),c!==`sub`||e.hasFormat(`subscript`)||e.toggleFormat(`subscript`),c!==`super`||e.hasFormat(`superscript`)||e.toggleFormat(`superscript`),t&&!e.hasFormat(t)&&e.toggleFormat(t),e):e}var Pp=class e extends Cp{static getType(){return`tab`}static clone(t){return new e(t.__key)}constructor(e){super(` `,e),this.__detail=2}static importDOM(){return null}createDOM(e){let t=super.createDOM(e),n=Xh(e.theme,`tab`);return n!==void 0&&t.classList.add(...n),t}static importJSON(e){return Fp().updateFromJSON(e)}setTextContent(e){return e!==` `&&e!==``&&V(126),super.setTextContent(` `)}spliceText(e,t,n,r){return n===``&&t===0||n===` `&&t===1||V(286),this}setDetail(e){return e!==2&&V(127),this}setMode(e){return e!==`normal`&&V(128),this}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}};function Fp(){return fg(new Pp)}function Ip(e){return e instanceof Pp}var Lp=class{constructor(e,t,n){this._selection=null,this.key=e,this.offset=t,this.type=n}is(e){return this.key===e.key&&this.offset===e.offset&&this.type===e.type}isBefore(e){return this.key===e.key?this.offset<e.offset:i_(v_(l_(this,`next`)),v_(l_(e,`next`)))<0}getNode(){let e=Dh(this.key);return e===null&&V(20),e}set(e,t,n,r){let i=this._selection,a=this.key;r&&this.key===e&&this.offset===t&&this.type===n||(this.key=e,this.offset=t,this.type=n,xm()||(Eh()===a&&Th(e),i!==null&&(i.setCachedNodes(null),i.dirty=!0)))}};function Rp(e,t,n){return new Lp(e,t,n)}function zp(e,t){let n=t.__key,r=e.offset,i=`element`;if(H(t)){i=`text`;let e=t.getTextContentSize();r>e&&(r=e)}else if(!G(t)){let e=t.getNextSibling();if(H(e))n=e.__key,r=0,i=`text`;else{let e=t.getParent();e&&(n=e.__key,r=t.getIndexWithinParent()+1)}}e.set(n,r,i)}function Bp(e,t){if(G(t)){let n=t.getLastDescendant();G(n)||H(n)?zp(e,n):zp(e,t)}else zp(e,t)}var Vp=class e{constructor(e){this._cachedNodes=null,this._nodes=e,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){if(!Up(e))return!1;let t=this._nodes,n=e._nodes;return t.size===n.size&&Array.from(t).every((e=>n.has(e)))}isCollapsed(){return!1}isBackward(){return!1}getStartEndPoints(){return null}add(e){this.dirty=!0,this._nodes.add(e),this._cachedNodes=null}delete(e){this.dirty=!0,this._nodes.delete(e),this._cachedNodes=null}clear(){this.dirty=!0,this._nodes.clear(),this._cachedNodes=null}has(e){return this._nodes.has(e)}clone(){return new e(new Set(this._nodes))}extract(){return this.getNodes()}insertRawText(e){}insertText(){}insertNodes(e){let t=this.getNodes(),n=t.length,r=t[n-1],i;if(H(r))i=r.select();else{let e=r.getIndexWithinParent()+1;i=r.getParentOrThrow().select(e,e)}i.insertNodes(e);for(let e=0;e<n;e++)t[e].remove()}getNodes(){let e=this._cachedNodes;if(e!==null)return e;let t=this._nodes,n=[];for(let e of t){let t=Dh(e);t!==null&&n.push(t)}return xm()||(this._cachedNodes=n),n}getTextContent(){let e=this.getNodes(),t=``;for(let n=0;n<e.length;n++)t+=e[n].getTextContent();return t}deleteNodes(){let e=this.getNodes();if((W()||im())===this&&e[0]){let t=Jg(e[0],`next`);d_(n_(t,t))}for(let t of e)t.remove()}};function U(e){return e instanceof Hp}var Hp=class e{constructor(e,t,n,r){this.anchor=e,this.focus=t,e._selection=this,t._selection=this,this._cachedNodes=null,this.format=n,this.style=r,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){return!!U(e)&&this.anchor.is(e.anchor)&&this.focus.is(e.focus)&&this.format===e.format&&this.style===e.style}isCollapsed(){return this.anchor.is(this.focus)}getNodes(){let e=this._cachedNodes;if(e!==null)return e;let t=function(e){let t=[],[n,r]=e.getTextSlices();n&&t.push(n.caret.origin);let i=new Set,a=new Set;for(let n of e)if(Kg(n)){let{origin:e}=n;t.length===0?i.add(e):(a.add(e),t.push(e))}else{let{origin:e}=n;G(e)&&a.has(e)||t.push(e)}if(r&&t.push(r.caret.origin),Gg(e.focus)&&G(e.focus.origin)&&e.focus.getNodeAtCaret()===null)for(let n=Qg(e.focus.origin,`previous`);Kg(n)&&i.has(n.origin)&&!n.origin.isEmpty()&&n.origin.is(t[t.length-1]);n=$g(n))i.delete(n.origin),t.pop();for(;t.length>1;){let e=t[t.length-1];if(!G(e)||a.has(e)||e.isEmpty()||i.has(e))break;t.pop()}if(t.length===0&&e.isCollapsed()){let n=v_(e.anchor),r=v_(e.anchor.getFlipped()),i=e=>Wg(e)?e.origin:e.getNodeAtCaret(),a=i(n)||i(r)||(e.anchor.getNodeAtCaret()?n.origin:r.origin);t.push(a)}return t}(x_(p_(this),`next`));return xm()||(this._cachedNodes=t),t}setTextNodeRange(e,t,n,r){this.anchor.set(e.__key,t,`text`),this.focus.set(n.__key,r,`text`)}getTextContent(){let e=this.getNodes();if(e.length===0)return``;let t=e[0],n=e[e.length-1],r=this.anchor,i=this.focus,a=r.isBefore(i),[o,s]=Gp(this),c=``,l=!0;for(let u=0;u<e.length;u++){let d=e[u];if(G(d)&&!d.isInline())l||(c+=`
19
+ `),l=!d.isEmpty();else if(l=!1,H(d)){let e=d.getTextContent();d===t?d===n?r.type===`element`&&i.type===`element`&&i.offset!==r.offset||(e=o<s?e.slice(o,s):e.slice(s,o)):e=a?e.slice(o):e.slice(s):d===n&&(e=a?e.slice(0,s):e.slice(0,o)),c+=e}else !Hm(d)&&!hp(d)||d===n&&this.isCollapsed()||(c+=d.getTextContent())}return c}applyDOMRange(e){let t=Tm(),n=t.getEditorState()._selection,r=Qp(e.startContainer,e.startOffset,e.endContainer,e.endOffset,t,n);if(r===null)return;let[i,a]=r;this.anchor.set(i.key,i.offset,i.type,!0),this.focus.set(a.key,a.offset,a.type,!0),ad(this)}clone(){let t=this.anchor,n=this.focus;return new e(Rp(t.key,t.offset,t.type),Rp(n.key,n.offset,n.type),this.format,this.style)}toggleFormat(e){this.format=bh(this.format,e,null),this.dirty=!0}setFormat(e){this.format=e,this.dirty=!0}setStyle(e){this.style=e,this.dirty=!0}hasFormat(e){let t=ku[e];return!!(this.format&t)}insertRawText(e){let t=e.split(/(\r?\n|\t)/),n=[],r=t.length;for(let e=0;e<r;e++){let r=t[e];r===`
20
+ `||r===`\r
21
+ `?n.push(mp()):r===` `?n.push(Fp()):n.push(Mp(r))}this.insertNodes(n)}insertText(e){let t=this.anchor,n=this.focus,r=this.format,i=this.style,a=t,o=n;!this.isCollapsed()&&n.isBefore(t)&&(a=n,o=t),a.type===`element`&&function(e,t,n,r){let i=e.getNode(),a=i.getChildAtIndex(e.offset),o=Mp();if(o.setFormat(n),o.setStyle(r),eh(a))a.splice(0,0,[o]);else{let e=Wm(i)?$m().append(o):o;a===null?i.append(e):a.insertBefore(e)}e.is(t)&&t.set(o.__key,0,`text`),e.set(o.__key,0,`text`)}(a,o,r,i),o.type===`element`&&u_(o,v_(l_(o,`next`)));let s=a.offset,c=o.offset,l=this.getNodes(),u=l.length,d=l[0];H(d)||V(26);let f=d.getTextContent().length,p=d.getParentOrThrow(),m=l[u-1];if(u===1&&o.type===`element`&&(c=f,o.set(a.key,c,`text`)),this.isCollapsed()&&s===f&&(_h(d)||!d.canInsertTextAfter()||!p.canInsertTextAfter()&&d.getNextSibling()===null)){let t=d.getNextSibling();if(H(t)&&t.canInsertTextBefore()&&!_h(t)||(t=Mp(),t.setFormat(r),t.setStyle(i),p.canInsertTextAfter()?d.insertAfter(t):p.insertAfter(t)),t.select(0,0),d=t,e!==``)return void this.insertText(e)}else if(this.isCollapsed()&&s===0&&(_h(d)||!d.canInsertTextBefore()||!p.canInsertTextBefore()&&d.getPreviousSibling()===null)){let t=d.getPreviousSibling();if(H(t)&&!_h(t)||(t=Mp(),t.setFormat(r),p.canInsertTextBefore()?d.insertBefore(t):p.insertBefore(t)),t.select(),d=t,e!==``)return void this.insertText(e)}else if(d.isSegmented()&&s!==f){let e=Mp(d.getTextContent());e.setFormat(r),d.replace(e),d=e}else if(!this.isCollapsed()&&e!==``){let t=m.getParent();if(!p.canInsertTextBefore()||!p.canInsertTextAfter()||G(t)&&(!t.canInsertTextBefore()||!t.canInsertTextAfter()))return this.insertText(``),Zp(this.anchor,this.focus,null),void this.insertText(e)}if(u===1){if(gh(d)){let t=Mp(e);t.select(),d.replace(t);return}let t=d.getFormat(),n=d.getStyle();if(s!==c||t===r&&n===i){if(Ip(d)){let t=Mp(e);t.setFormat(r),t.setStyle(i),t.select(),d.replace(t);return}}else{if(d.getTextContent()!==``){let t=Mp(e);if(t.setFormat(r),t.setStyle(i),t.select(),s===0)d.insertBefore(t,!1);else{let[e]=d.splitText(s);e.insertAfter(t,!1)}t.isComposing()&&this.anchor.type===`text`&&(this.anchor.offset-=e.length);return}d.setFormat(r),d.setStyle(i)}let a=c-s;d=d.spliceText(s,a,e,!0),d.getTextContent()===``?d.remove():this.anchor.type===`text`&&(d.isComposing()?this.anchor.offset-=e.length:(this.format=t,this.style=n))}else{let t=new Set([...d.getParentKeys(),...m.getParentKeys()]),n=G(d)?d:d.getParentOrThrow(),r=G(m)?m:m.getParentOrThrow(),i=m;if(!n.is(r)&&r.isInline())do i=r,r=r.getParentOrThrow();while(r.isInline());if(o.type===`text`&&(c!==0||m.getTextContent()===``)||o.type===`element`&&m.getIndexWithinParent()<c)if(H(m)&&!gh(m)&&c!==m.getTextContentSize()){if(m.isSegmented()){let e=Mp(m.getTextContent());m.replace(e),m=e}Wm(o.getNode())||o.type!==`text`||(m=m.spliceText(0,c,``)),t.add(m.__key)}else{let e=m.getParentOrThrow();e.canBeEmpty()||e.getChildrenSize()!==1?m.remove():e.remove()}else t.add(m.__key);let a=r.getChildren(),p=new Set(l),h=n.is(r),g=n.isInline()&&d.getNextSibling()===null?n:d;for(let e=a.length-1;e>=0;e--){let t=a[e];if(t.is(d)||G(t)&&t.isParentOf(d))break;t.isAttached()&&(!p.has(t)||t.is(i)?h||g.insertAfter(t,!1):t.remove())}if(!h){let e=r,n=null;for(;e!==null;){let r=e.getChildren(),i=r.length;(i===0||r[i-1].is(n))&&(t.delete(e.__key),n=e),e=e.getParent()}}if(gh(d))if(s===f)d.select();else{let t=Mp(e);t.select(),d.replace(t)}else d=d.spliceText(s,f-s,e,!0),d.getTextContent()===``?d.remove():d.isComposing()&&this.anchor.type===`text`&&(this.anchor.offset-=e.length);for(let e=1;e<u;e++){let n=l[e],r=n.__key;t.has(r)||n.remove()}}}removeText(){let e=W()===this;f_(this,__(p_(this))),e&&W()!==this&&Fh(this)}formatText(e,t=null){if(this.isCollapsed())return this.toggleFormat(e),void Th(null);let n=this.getNodes(),r=[];for(let e of n)H(e)&&r.push(e);let i=t=>{n.forEach((n=>{if(G(n)){let r=n.getFormatFlags(e,t);n.setTextFormat(r)}}))},a=r.length;if(a===0)return this.toggleFormat(e),Th(null),void i(t);let o=this.anchor,s=this.focus,c=this.isBackward(),l=c?s:o,u=c?o:s,d=0,f=r[0],p=l.type===`element`?0:l.offset;if(l.type===`text`&&p===f.getTextContentSize()&&(d=1,f=r[1],p=0),f==null)return;let m=f.getFormatFlags(e,t);i(m);let h=a-1,g=r[h],_=u.type===`text`?u.offset:g.getTextContentSize();if(f.is(g)){if(p===_)return;if(_h(f)||p===0&&_===f.getTextContentSize())f.setFormat(m);else{let e=f.splitText(p,_),t=p===0?e[0]:e[1];t.setFormat(m),l.type===`text`&&l.set(t.__key,0,`text`),u.type===`text`&&u.set(t.__key,_-p,`text`)}this.format=m;return}p===0||_h(f)||([,f]=f.splitText(p),p=0),f.setFormat(m);let v=g.getFormatFlags(e,m);_>0&&(_===g.getTextContentSize()||_h(g)||([g]=g.splitText(_)),g.setFormat(v));for(let t=d+1;t<h;t++){let n=r[t],i=n.getFormatFlags(e,v);n.setFormat(i)}l.type===`text`&&l.set(f.__key,p,`text`),u.type===`text`&&u.set(g.__key,_,`text`),this.format=m|v}insertNodes(e){if(e.length===0)return;if(this.isCollapsed()||this.removeText(),this.anchor.key===`root`){this.insertParagraph();let t=W();return U(t)||V(134),t.insertNodes(e)}let t=(this.isBackward()?this.focus:this.anchor).getNode(),n=Tg(t,wg),r=e[e.length-1];if(G(n)&&`__language`in n){if(`__language`in e[0])this.insertText(e[0].getTextContent());else{let t=fm(this);n.splice(t,0,e),r.selectEnd()}return}if(!e.some((e=>(G(e)||Hm(e))&&!e.isInline()))){G(n)||V(211,t.constructor.name,t.getType());let i=fm(this);n.splice(i,0,e),r.selectEnd();return}let i=function(e){let t=$m(),n=null;for(let r=0;r<e.length;r++){let i=e[r],a=hp(i);if(a||Hm(i)&&i.isInline()||G(i)&&i.isInline()||H(i)||i.isParentRequired()){if(n===null&&(n=i.createParentElementNode(),t.append(n),a))continue;n!==null&&n.append(i)}else t.append(i),n=null}return t}(e),a=i.getLastDescendant(),o=i.getChildren(),s=!G(n)||!n.isEmpty()?this.insertParagraph():null,c=o[o.length-1],l=o[0];var u;G(u=l)&&wg(u)&&!u.isEmpty()&&G(n)&&(!n.isEmpty()||n.canMergeWhenEmpty())&&(G(n)||V(211,t.constructor.name,t.getType()),n.append(...l.getChildren()),l=o[1]),l&&(n===null&&V(212,t.constructor.name,t.getType()),function(e,t,n){let r=t.getParentOrThrow().getLastChild(),i=t,a=[t];for(;i!==r;)i.getNextSibling()||V(140),i=i.getNextSibling(),a.push(i);let o=e;for(let e of a)o=o.insertAfter(e)}(n,l));let d=Tg(a,wg);s&&G(d)&&(s.canMergeWhenEmpty()||wg(c))&&(d.append(...s.getChildren()),s.remove()),G(n)&&n.isEmpty()&&n.remove(),a.selectEnd();let f=G(n)?n.getLastChild():null;hp(f)&&d!==n&&f.remove()}insertParagraph(){if(this.anchor.key===`root`){let e=$m();return Nh().splice(this.anchor.offset,0,[e]),e.select(),e}let e=fm(this),t=Tg(this.anchor.getNode(),wg);G(t)||V(213);let n=t.getChildAtIndex(e),r=n?[n,...n.getNextSiblings()]:[],i=t.insertNewAfter(this,!1);return i?(i.append(...r),i.selectStart(),i):null}insertLineBreak(e){let t=mp();if(this.insertNodes([t]),e){let e=t.getParentOrThrow(),n=t.getIndexWithinParent();e.select(n,n)}}extract(){let e=this.getNodes(),t=e.length,n=t-1,r=this.anchor,i=this.focus,a=e[0],o=e[n],[s,c]=Gp(this);if(t===0)return[];if(t===1){if(H(a)&&!this.isCollapsed()){let e=s>c?c:s,t=s>c?s:c,n=a.splitText(e,t),r=e===0?n[0]:n[1];return r==null?[]:[r]}return[a]}let l=r.isBefore(i);if(H(a)){let t=l?s:c;t===a.getTextContentSize()?e.shift():t!==0&&([,a]=a.splitText(t),e[0]=a)}if(H(o)){let t=o.getTextContent().length,r=l?c:s;r===0?e.pop():r!==t&&([o]=o.splitText(r),e[n]=o)}return e}modify(e,t,n){if(mm(this,e,t,n))return;let r=e===`move`,i=Tm(),a=gg(cg(i));if(!a)return;let o=i._blockCursorElement,s=i._rootElement,c=this.focus.getNode();if(s===null||o===null||!G(c)||c.isInline()||c.canBeEmpty()||hg(o,i,s),this.dirty){let e=rg(i,this.anchor.key),t=rg(i,this.focus.key);this.anchor.type===`text`&&(e=yh(e)),this.focus.type===`text`&&(t=yh(t)),e&&t&&lm(a,e,this.anchor.offset,t,this.focus.offset)}if(function(e,t,n,r){e.modify(t,n,r)}(a,e,t?`backward`:`forward`,n),a.rangeCount>0){let e=a.getRangeAt(0),n=this.anchor.getNode(),i=Wm(n)?n:lg(n);if(this.applyDOMRange(e),this.dirty=!0,!r){let n=this.getNodes(),r=[],o=!1;for(let e=0;e<n.length;e++){let t=n[e];og(t,i)?r.push(t):o=!0}if(o&&r.length>0)if(t){let e=r[0];G(e)?e.selectStart():e.getParentOrThrow().selectStart()}else{let e=r[r.length-1];G(e)?e.selectEnd():e.getParentOrThrow().selectEnd()}a.anchorNode===e.startContainer&&a.anchorOffset===e.startOffset||function(e){let t=e.focus,n=e.anchor,r=n.key,i=n.offset,a=n.type;n.set(t.key,t.offset,t.type,!0),t.set(r,i,a,!0)}(this)}}n===`lineboundary`&&mm(this,e,t,n,`decorators`)}forwardDeletion(e,t,n){if(!n&&(e.type===`element`&&G(t)&&e.offset===t.getChildrenSize()||e.type===`text`&&e.offset===t.getTextContentSize())){let e=t.getParent(),n=t.getNextSibling()||(e===null?null:e.getNextSibling());if(G(n)&&n.isShadowRoot())return!0}return!1}deleteCharacter(e){let t=this.isCollapsed();if(this.isCollapsed()){let t=this.anchor,n=t.getNode();if(this.forwardDeletion(t,n,e))return;let r=e_(l_(t,e?`previous`:`next`));if(r.getTextSlices().every((e=>e===null||e.distance===0))){let e={type:`initial`};for(let t of r.iterNodeCarets(`shadowRoot`))if(Kg(t)){if(!t.origin.isInline()){if(t.origin.isShadowRoot()){if(e.type===`merge-block`)break;if(G(r.anchor.origin)&&r.anchor.origin.isEmpty()){let e=v_(t);f_(this,n_(e,e)),r.anchor.origin.remove()}return}e.type!==`merge-next-block`&&e.type!==`merge-block`||(e={block:e.block,caret:t,type:`merge-block`})}}else{if(e.type===`merge-block`)break;if(Gg(t)){if(G(t.origin)){if(t.origin.isInline()){if(!t.origin.isParentOf(r.anchor.origin))break}else e={block:t.origin,type:`merge-next-block`};continue}if(Hm(t.origin)){if(!t.origin.isIsolated())if(e.type===`merge-next-block`&&(t.origin.isKeyboardSelectable()||!t.origin.isInline())&&G(r.anchor.origin)&&r.anchor.origin.isEmpty()){r.anchor.origin.remove();let e=nm();e.add(t.origin.getKey()),Fh(e)}else t.origin.remove();return}break}}if(e.type===`merge-block`){let{caret:t,block:n}=e;return f_(this,n_(!t.origin.isEmpty()&&n.isEmpty()?m_(Jg(n,t.direction)):r.anchor,t)),this.removeText()}}let i=this.focus;if(this.modify(`extend`,e,`character`),this.isCollapsed()){if(e&&t.offset===0&&Kp(this,t.getNode()))return}else{let r=i.type===`text`?i.getNode():null;if(n=t.type===`text`?t.getNode():null,r!==null&&r.isSegmented()){let t=i.offset,a=r.getTextContentSize();if(r.is(n)||e&&t!==a||!e&&t!==0)return void Jp(r,e,t)}else if(n!==null&&n.isSegmented()){let i=t.offset,a=n.getTextContentSize();if(n.is(r)||e&&i!==0||!e&&i!==a)return void Jp(n,e,i)}(function(e,t){let n=e.anchor,r=e.focus,i=n.getNode();if(i===r.getNode()&&n.type===`text`&&r.type===`text`){let e=n.offset,a=r.offset,o=e<a,s=o?e:a,c=o?a:e,l=c-1;s!==l&&(function(e){return!(Lh(e)||qp(e))})(i.getTextContent().slice(s,c))&&(t?r.set(r.key,l,r.type):n.set(n.key,l,n.type))}})(this,e)}}if(this.removeText(),e&&!t&&this.isCollapsed()&&this.anchor.type===`element`&&this.anchor.offset===0){let e=this.anchor.getNode();e.isEmpty()&&Wm(e.getParent())&&e.getPreviousSibling()===null&&Kp(this,e)}}deleteLine(e){this.isCollapsed()&&this.modify(`extend`,e,`lineboundary`),this.isCollapsed()?this.deleteCharacter(e):this.removeText()}deleteWord(e){if(this.isCollapsed()){let t=this.anchor,n=t.getNode();if(this.forwardDeletion(t,n,e))return;this.modify(`extend`,e,`word`)}this.removeText()}isBackward(){return this.focus.isBefore(this.anchor)}getStartEndPoints(){return[this.anchor,this.focus]}};function Up(e){return e instanceof Vp}function Wp(e){let t=e.offset;if(e.type===`text`)return t;let n=e.getNode();return t===n.getChildrenSize()?n.getTextContent().length:0}function Gp(e){let t=e.getStartEndPoints();if(t===null)return[0,0];let[n,r]=t;return n.type===`element`&&r.type===`element`&&n.key===r.key&&n.offset===r.offset?[0,0]:[Wp(n),Wp(r)]}function Kp(e,t){for(let n=t;n;n=n.getParent()){if(G(n)){if(n.collapseAtStart(e))return!0;if(ug(n))break}if(n.getPreviousSibling())break}return!1}var qp=(()=>{try{let e=RegExp(`\\p{Emoji}`,`u`),t=e.test.bind(e);if(t(`❤️`)&&t(`#️⃣`)&&t(`👍`))return t}catch{}return()=>!1})();function Jp(e,t,n){let r=e,i=r.getTextContent().split(/(?=\s)/g),a=i.length,o=0,s=0;for(let e=0;e<a;e++){let r=e===a-1;if(s=o,o+=i[e].length,t&&o===n||o>n||r){i.splice(e,1),r&&(s=void 0);break}}let c=i.join(``).trim();c===``?r.remove():(r.setTextContent(c),r.select(s,s))}function Yp(e,t,n,r){let i,a=t;if(yg(e)){let o=!1,s=e.childNodes,c=s.length,l=r._blockCursorElement;a===c&&(o=!0,a=c-1);let u=s[a],d=!1;if(u===l)u=s[a+1],d=!0;else if(l!==null){let n=l.parentNode;e===n&&t>Array.prototype.indexOf.call(n.children,l)&&a--}if(i=Ih(u),H(i))a=Xg(i,o?`next`:`previous`);else{let s=Ih(e);if(s===null)return null;if(G(s)){let c=r.getElementByKey(s.getKey());c===null&&V(214);let l=s.getDOMSlot(c);[s,a]=l.resolveChildIndex(s,c,e,t),G(s)||V(215),o&&a>=s.getChildrenSize()&&(a=Math.max(0,s.getChildrenSize()-1));let u=s.getChildAtIndex(a);if(G(u)&&function(e,t,n){let r=e.getParent();return n===null||r===null||!r.canBeEmpty()||r!==n.getNode()}(u,0,n)){let e=o?u.getLastDescendant():u.getFirstDescendant();e===null?s=u:(u=e,s=G(u)?u:u.getParentOrThrow()),a=0}H(u)?(i=u,s=null,a=Xg(u,o?`next`:`previous`)):u!==s&&o&&!d&&(G(s)||V(216),a=Math.min(s.getChildrenSize(),a+1))}else{let n=s.getIndexWithinParent();a=t===0&&Hm(s)&&Ih(e)===s?n:n+1,s=s.getParentOrThrow()}if(G(s))return Rp(s.__key,a,`element`)}}else i=Ih(e);return H(i)?Rp(i.__key,Xg(i,a,`clamp`),`text`):null}function Xp(e,t,n){let r=e.offset,i=e.getNode();if(r===0){let r=i.getPreviousSibling(),a=i.getParent();if(t){if((n||!t)&&r===null&&G(a)&&a.isInline()){let t=a.getPreviousSibling();H(t)&&e.set(t.__key,t.getTextContent().length,`text`)}}else G(r)&&!n&&r.isInline()?e.set(r.__key,r.getChildrenSize(),`element`):H(r)&&e.set(r.__key,r.getTextContent().length,`text`)}else if(r===i.getTextContent().length){let r=i.getNextSibling(),a=i.getParent();if(t&&G(r)&&r.isInline())e.set(r.__key,0,`element`);else if((n||t)&&r===null&&G(a)&&a.isInline()&&!a.canInsertTextAfter()){let t=a.getNextSibling();H(t)&&e.set(t.__key,0,`text`)}}}function Zp(e,t,n){if(e.type===`text`&&t.type===`text`){let r=e.isBefore(t),i=e.is(t);Xp(e,r,i),Xp(t,!r,i),i&&t.set(e.key,e.offset,e.type);let a=Tm();if(a.isComposing()&&a._compositionKey!==e.key&&U(n)){let r=n.anchor,i=n.focus;e.set(r.key,r.offset,r.type,!0),t.set(i.key,i.offset,i.type,!0)}}}function Qp(e,t,n,r,i,a){if(e===null||n===null||!fh(i,e,n))return null;let o=Yp(e,t,U(a)?a.anchor:null,i);if(o===null)return null;let s=Yp(n,r,U(a)?a.focus:null,i);if(s===null)return null;if(o.type===`element`&&s.type===`element`){let t=Ih(e),r=Ih(n);if(Hm(t)&&Hm(r))return null}return Zp(o,s,a),[o,s]}function $p(e){return G(e)&&!e.isInline()}function em(e,t,n,r,i,a){let o=wm(),s=new Hp(Rp(e,t,i),Rp(n,r,a),0,``);return s.dirty=!0,o._selection=s,s}function tm(){return new Hp(Rp(`root`,0,`element`),Rp(`root`,0,`element`),0,``)}function nm(){return new Vp(new Set)}function rm(e,t,n,r){let i=n._window;if(i===null)return null;let a=r||i.event,o=a?a.type:void 0,s=o===`selectionchange`,c=!Ru&&(s||o===`beforeinput`||o===`compositionstart`||o===`compositionend`||o===`click`&&a&&a.detail===3||o===`drop`||o===void 0),l,u,d,f;if(U(e)&&!c)return e.clone();if(t===null)return null;if(l=t.anchorNode,u=t.focusNode,d=t.anchorOffset,f=t.focusOffset,s&&U(e)&&!fh(n,l,u))return e.clone();let p=Qp(l,d,u,f,n,e);if(p===null)return null;let[m,h]=p;return new Hp(m,h,U(e)?e.format:0,U(e)?e.style:``)}function W(){return wm()._selection}function im(){return Tm()._editorState._selection}function am(e,t,n,r=1){let i=e.anchor,a=e.focus,o=i.getNode(),s=a.getNode();if(!t.is(o)&&!t.is(s))return;let c=t.__key;if(e.isCollapsed()){let t=i.offset;if(n<=t&&r>0||n<t&&r<0){let n=Math.max(0,t+r);i.set(c,n,`element`),a.set(c,n,`element`),om(e)}}else{let o=e.isBackward(),s=o?a:i,l=s.getNode(),u=o?i:a,d=u.getNode();if(t.is(l)){let e=s.offset;(n<=e&&r>0||n<e&&r<0)&&s.set(c,Math.max(0,e+r),`element`)}if(t.is(d)){let e=u.offset;(n<=e&&r>0||n<e&&r<0)&&u.set(c,Math.max(0,e+r),`element`)}}om(e)}function om(e){let t=e.anchor,n=t.offset,r=e.focus,i=r.offset,a=t.getNode(),o=r.getNode();if(e.isCollapsed()){if(!G(a))return;let e=a.getChildrenSize(),i=n>=e,o=i?a.getChildAtIndex(e-1):a.getChildAtIndex(n);if(H(o)){let e=0;i&&(e=o.getTextContentSize()),t.set(o.__key,e,`text`),r.set(o.__key,e,`text`)}}else{if(G(a)){let e=a.getChildrenSize(),r=n>=e,i=r?a.getChildAtIndex(e-1):a.getChildAtIndex(n);if(H(i)){let e=0;r&&(e=i.getTextContentSize()),t.set(i.__key,e,`text`)}}if(G(o)){let e=o.getChildrenSize(),t=i>=e,n=t?o.getChildAtIndex(e-1):o.getChildAtIndex(i);if(H(n)){let e=0;t&&(e=n.getTextContentSize()),r.set(n.__key,e,`text`)}}}}function sm(e,t,n,r,i){let a=null,o=0,s=null;r===null?i!==null&&(a=i.__key,H(i)?s=`text`:G(i)&&(s=`element`)):(a=r.__key,H(r)?(o=r.getTextContentSize(),s=`text`):G(r)&&(o=r.getChildrenSize(),s=`element`)),a!==null&&s!==null?e.set(a,o,s):(o=t.getIndexWithinParent(),o===-1&&(o=n.getChildrenSize()),e.set(n.__key,o,`element`))}function cm(e,t,n,r,i){e.type===`text`?e.set(n,e.offset+(t?0:i),`text`):e.offset>r.getIndexWithinParent()&&e.set(e.key,e.offset-1,`element`)}function lm(e,t,n,r,i){try{e.setBaseAndExtent(t,n,r,i)}catch{}}function um(e,t,n,r,i,a,o){let s=r.anchorNode,c=r.focusNode,l=r.anchorOffset,u=r.focusOffset,d=document.activeElement;if(i.has(`collaboration`)&&d!==a||d!==null&&dh(d))return;if(!U(t))return void(e!==null&&fh(n,s,c)&&r.removeAllRanges());let f=t.anchor,p=t.focus,m=f.key,h=p.key,g=rg(n,m),_=rg(n,h),v=f.offset,y=p.offset,b=t.format,x=t.style,S=t.isCollapsed(),C=g,w=_,T=!1;if(f.type===`text`){C=yh(g);let e=f.getNode();T=e.getFormat()!==b||e.getStyle()!==x}else U(e)&&e.anchor.type===`text`&&(T=!0);var E,D,O,k,A;if((p.type===`text`&&(w=yh(_)),C!==null&&w!==null)&&(S&&(e===null||T||U(e)&&(e.format!==b||e.style!==x))&&(E=b,D=x,O=v,k=m,A=performance.now(),Yf=[E,D,O,k,A]),l!==v||u!==y||s!==C||c!==w||r.type===`Range`&&S||(d!==null&&a.contains(d)||a.focus({preventScroll:!0}),f.type===`element`))){if(lm(r,C,v,w,y),!i.has(`skip-scroll-into-view`)&&t.isCollapsed()&&a!==null&&a===document.activeElement){let e=U(t)&&t.anchor.type===`element`?C.childNodes[v]||null:r.rangeCount>0?r.getRangeAt(0):null;if(e!==null){let t;if(e instanceof Text){let n=document.createRange();n.selectNode(e),t=n.getBoundingClientRect()}else t=e.getBoundingClientRect();(function(e,t,n){let r=ag(n),i=sg(r);if(r===null||i===null)return;let{top:a,bottom:o}=t,s=0,c=0,l=n;for(;l!==null;){let t=l===r.body;if(t)s=0,c=cg(e).innerHeight;else{let e=l.getBoundingClientRect();s=e.top,c=e.bottom}let n=0;if(a<s?n=-(s-a):o>c&&(n=o-c),n!==0)if(t)i.scrollBy(0,n);else{let e=l.scrollTop;l.scrollTop+=n;let t=l.scrollTop-e;a-=t,o-=t}if(t)break;l=ig(l)}})(n,t,a)}}Hf=!0}}function dm(e){let t=W()||im();t===null&&(t=Nh().selectEnd()),t.insertNodes(e)}function fm(e){let t=e;e.isCollapsed()||t.removeText();let n=W();U(n)&&(t=n),U(t)||V(161);let r=t.anchor,i=r.getNode(),a=r.offset;for(;!wg(i);){let e=i;if([i,a]=pm(i,a),e.is(i))break}return a}function pm(e,t){let n=e.getParent();if(!n){let e=$m();return Nh().append(e),e.select(),[Nh(),0]}if(H(e)){let r=e.splitText(t);if(r.length===0)return[n,e.getIndexWithinParent()];let i=t===0?0:1;return[n,r[0].getIndexWithinParent()+i]}if(!G(e)||t===0)return[n,e.getIndexWithinParent()];let r=e.getChildAtIndex(t);if(r){let n=new Hp(Rp(e.__key,t,`element`),Rp(e.__key,t,`element`),0,``),i=e.insertNewAfter(n);i&&i.append(r,...r.getNextSiblings())}return[n,e.getIndexWithinParent()+1]}function mm(e,t,n,r,i=`decorators-and-blocks`){if(t===`move`&&r===`character`&&!e.isCollapsed()){let[t,r]=n===e.isBackward()?[e.focus,e.anchor]:[e.anchor,e.focus];return r.set(t.key,t.offset,t.type),!0}let a=l_(e.focus,n?`previous`:`next`),o=r===`lineboundary`,s=t===`move`,c=a,l=i===`decorators-and-blocks`;if(!y_(c)){for(let e of c){l=!1;let{origin:t}=e;if(!Hm(t)||t.isIsolated()||(c=e,!o||!t.isInline()))break}if(l)for(let e of e_(a).iterNodeCarets(t===`extend`?`shadowRoot`:`root`)){if(Kg(e))e.origin.isInline()||(c=e);else{if(G(e.origin))continue;Hm(e.origin)&&!e.origin.isInline()&&(c=e)}break}}if(c===a)return!1;if(s&&!o&&Hm(c.origin)&&c.origin.isKeyboardSelectable()){let e=nm();return e.add(c.origin.getKey()),Fh(e),!0}return c=v_(c),s&&u_(e.anchor,c),u_(e.focus,c),l||!o}var hm=null,gm=null,_m=!1,vm=!1,ym=0,bm={characterData:!0,childList:!0,subtree:!0};function xm(){return _m||hm!==null&&hm._readOnly}function Sm(){_m&&V(13)}function Cm(){ym>99&&V(14)}function wm(){return hm===null&&V(195,Em()),hm}function Tm(){return gm===null&&V(196,Em()),gm}function Em(){let e=0,t=new Set,n=rh.version;if(typeof window<`u`)for(let r of document.querySelectorAll(`[contenteditable]`)){let i=hh(r);if(ph(i))e++;else if(i){let e=String(i.constructor.version||`<0.17.1`);e===n&&(e+=` (separately built, likely a bundler configuration issue)`),t.add(e)}}let r=` Detected on the page: ${e} compatible editor(s) with version ${n}`;return t.size&&(r+=` and incompatible editors with versions ${Array.from(t).join(`, `)}`),r}function Dm(){return gm}function Om(e,t,n){let r=t.__type,i=sh(e,r),a=n.get(r);a===void 0&&(a=Array.from(i.transforms),n.set(r,a));let o=a.length;for(let e=0;e<o&&(a[e](t),t.isAttached());e++);}function km(e,t){return e!==void 0&&e.__key!==t&&e.isAttached()}function Am(e,t){if(!t)return;let n=e._updateTags,r=t;Array.isArray(t)||(r=[t]);for(let e of r)n.add(e)}function eee(e){return jm(e,Tm()._nodes)}function jm(e,t){let n=e.type,r=t.get(n);r===void 0&&V(17,n);let i=r.klass;e.type!==i.getType()&&V(18,i.name);let a=i.importJSON(e),o=e.children;if(G(a)&&Array.isArray(o))for(let e=0;e<o.length;e++){let n=jm(o[e],t);a.append(n)}return a}function Mm(e,t,n){let r=hm,i=_m,a=gm;hm=t,_m=!0,gm=e;try{return n()}finally{hm=r,_m=i,gm=a}}function Nm(e,t){let n=e._pendingEditorState,r=e._rootElement,i=e._headless||r===null;if(n===null)return;let a=e._editorState,o=a._selection,s=n._selection,c=e._dirtyType!==mu,l=hm,u=_m,d=gm,f=e._updating,p=e._observer,m=null;if(e._pendingEditorState=null,e._editorState=n,!i&&c&&p!==null){gm=e,hm=n,_m=!1,e._updating=!0;try{let t=e._dirtyType,r=e._dirtyElements,i=e._dirtyLeaves;p.disconnect(),m=zd(a,n,e,t,r,i)}catch(t){if(t instanceof Error&&e._onError(t),vm)throw t;th(e,null,r,n),qu(e),e._dirtyType=gu,vm=!0,Nm(e,a),vm=!1;return}finally{p.observe(r,bm),e._updating=f,hm=l,_m=u,gm=d}}n._readOnly||=!0;let h=e._dirtyLeaves,g=e._dirtyElements,_=e._normalizedNodes,v=e._updateTags,y=e._deferred;c&&(e._dirtyType=mu,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements=new Map,e._normalizedNodes=new Set,e._updateTags=new Set),function(e,t){let n=e._decorators,r=e._pendingDecorators||n,i=t._nodeMap,a;for(a in r)i.has(a)||(r===n&&(r=jh(e)),delete r[a])}(e,n);let b=i?null:gg(cg(e));if(e._editable&&b!==null&&(c||s===null||s.dirty)&&r!==null&&!v.has(`skip-dom-selection`)){gm=e,hm=n;try{if(p!==null&&p.disconnect(),c||s===null||s.dirty){let t=e._blockCursorElement;t!==null&&hg(t,e,r),um(o,s,e,b,v,r)}(function(e,t,n){let r=e._blockCursorElement;if(U(n)&&n.isCollapsed()&&n.anchor.type===`element`&&t.contains(document.activeElement)){let i=n.anchor,a=i.getNode(),o=i.offset,s=!1,c=null;if(o===a.getChildrenSize())mg(a.getChildAtIndex(o-1))&&(s=!0);else{let t=a.getChildAtIndex(o);if(t!==null&&mg(t)){let n=t.getPreviousSibling();(n===null||mg(n))&&(s=!0,c=e.getElementByKey(t.__key))}}if(s){let n=e.getElementByKey(a.__key);r===null&&(e._blockCursorElement=r=function(e){let t=e.theme,n=document.createElement(`div`);n.contentEditable=`false`,n.setAttribute(`data-lexical-cursor`,`true`);let r=t.blockCursor;return r!==void 0&&(typeof r==`string`&&(r=t.blockCursor=lu(r)),r!==void 0&&n.classList.add(...r)),n}(e._config)),t.style.caretColor=`transparent`,c===null?n.appendChild(r):n.insertBefore(r,c);return}}r!==null&&hg(r,e,t)})(e,r,s)}finally{p!==null&&p.observe(r,bm),gm=d,hm=l}}m!==null&&function(e,t,n,r,i){let a=Array.from(e._listeners.mutation),o=a.length;for(let e=0;e<o;e++){let[o,s]=a[e];for(let e of s){let a=t.get(e);a!==void 0&&o(a,{dirtyLeaves:r,prevEditorState:i,updateTags:n})}}}(e,m,v,h,a),U(s)||s===null||o!==null&&o.is(s)||e.dispatchCommand(Hd,void 0);let x=e._pendingDecorators;x!==null&&(e._decorators=x,e._pendingDecorators=null,Pm(`decorator`,e,!0,x)),function(e,t,n){let r=Mh(t),i=Mh(n);r!==i&&Pm(`textcontent`,e,!0,i)}(e,t||a,n),Pm(`update`,e,!0,{dirtyElements:g,dirtyLeaves:h,editorState:n,mutatedNodes:m,normalizedNodes:_,prevEditorState:t||a,tags:v}),function(e,t){if(e._deferred=[],t.length!==0){let n=e._updating;e._updating=!0;try{for(let e=0;e<t.length;e++)t[e]()}finally{e._updating=n}}}(e,y),function(e){let t=e._updates;if(t.length!==0){let n=t.shift();if(n){let[t,r]=n;Im(e,t,r)}}}(e)}function Pm(e,t,n,...r){let i=t._updating;t._updating=n;try{let n=Array.from(t._listeners[e]);for(let e=0;e<n.length;e++)n[e].apply(null,r)}finally{t._updating=i}}function Fm(e,t){let n=e._updates,r=t||!1;for(;n.length!==0;){let t=n.shift();if(t){let[n,i]=t,a=e._pendingEditorState,o;i!==void 0&&(o=i.onUpdate,i.skipTransforms&&(r=!0),i.discrete&&(a===null&&V(191),a._flushSync=!0),o&&e._deferred.push(o),Am(e,i.tag)),a==null?Im(e,n,i):n()}}return r}function Im(e,t,n){let r=e._updateTags,i,a=!1,o=!1;n!==void 0&&(i=n.onUpdate,Am(e,n.tag),a=n.skipTransforms||!1,o=n.discrete||!1),i&&e._deferred.push(i);let s=e._editorState,c=e._pendingEditorState,l=!1;(c===null||c._readOnly)&&(c=e._pendingEditorState=Gm(c||s),l=!0),c._flushSync=o;let u=hm,d=_m,f=gm,p=e._updating;hm=c,_m=!1,e._updating=!0,gm=e;let m=e._headless||e.getRootElement()===null;ah(null);try{l&&(m?s._selection!==null&&(c._selection=s._selection.clone()):c._selection=function(e,t){let n=e.getEditorState()._selection,r=gg(cg(e));return U(n)||n==null?rm(n,r,e,t):n.clone()}(e,n&&n.event||null));let r=e._compositionKey;t(),a=Fm(e,a),function(e,t){let n=t.getEditorState()._selection,r=e._selection;if(U(r)){let e=r.anchor,t=r.focus,i;if(e.type===`text`&&(i=e.getNode(),i.selectionTransform(n,r)),t.type===`text`){let e=t.getNode();i!==e&&e.selectionTransform(n,r)}}}(c,e),e._dirtyType!==mu&&(a?function(e,t){let n=t._dirtyLeaves,r=e._nodeMap;for(let e of n){let t=r.get(e);H(t)&&t.isAttached()&&t.isSimpleText()&&!t.isUnmergeable()&&id(t)}}(c,e):function(e,t){let n=t._dirtyLeaves,r=t._dirtyElements,i=e._nodeMap,a=Eh(),o=new Map,s=n,c=s.size,l=r,u=l.size;for(;c>0||u>0;){if(c>0){t._dirtyLeaves=new Set;for(let e of s){let r=i.get(e);H(r)&&r.isAttached()&&r.isSimpleText()&&!r.isUnmergeable()&&id(r),r!==void 0&&km(r,a)&&Om(t,r,o),n.add(e)}if(s=t._dirtyLeaves,c=s.size,c>0){ym++;continue}}t._dirtyLeaves=new Set,t._dirtyElements=new Map,l.delete(`root`)&&l.set(`root`,!0);for(let e of l){let n=e[0],s=e[1];if(r.set(n,s),!s)continue;let c=i.get(n);c!==void 0&&km(c,a)&&Om(t,c,o)}s=t._dirtyLeaves,c=s.size,l=t._dirtyElements,u=l.size,ym++}t._dirtyLeaves=n,t._dirtyElements=r}(c,e),Fm(e),function(e,t,n,r){let i=e._nodeMap,a=t._nodeMap,o=[];for(let[e]of r){let t=a.get(e);t!==void 0&&(t.isAttached()||(G(t)&&Iu(t,e,i,a,o,r),i.has(e)||r.delete(e),o.push(e)))}for(let e of o)a.delete(e);for(let e of n){let t=a.get(e);t===void 0||t.isAttached()||(i.has(e)||n.delete(e),a.delete(e))}}(s,c,e._dirtyLeaves,e._dirtyElements)),r!==e._compositionKey&&(c._flushSync=!0);let i=c._selection;if(U(i)){let e=c._nodeMap,t=i.anchor.key,n=i.focus.key;e.get(t)!==void 0&&e.get(n)!==void 0||V(19)}else Up(i)&&i._nodes.size===0&&(c._selection=null)}catch(t){t instanceof Error&&e._onError(t),e._pendingEditorState=s,e._dirtyType=gu,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements.clear(),Nm(e);return}finally{hm=u,_m=d,gm=f,e._updating=p,ym=0}e._dirtyType!==mu||e._deferred.length>0||function(e,t){let n=t.getEditorState()._selection,r=e._selection;if(r!==null){if(r.dirty||!r.is(n))return!0}else if(n!==null)return!0;return!1}(c,e)?c._flushSync?(c._flushSync=!1,Nm(e)):l&&lh((()=>{Nm(e)})):(c._flushSync=!1,l&&(r.clear(),e._deferred=[],e._pendingEditorState=null))}function Lm(e,t,n){gm===e&&n===void 0?t():Im(e,t,n)}var tee=class e{constructor(e,t,n){this.element=e,this.before=t||null,this.after=n||null}withBefore(t){return new e(this.element,t,this.after)}withAfter(t){return new e(this.element,this.before,t)}withElement(t){return this.element===t?this:new e(t,this.before,this.after)}insertChild(e){let t=this.before||this.getManagedLineBreak();return t!==null&&t.parentElement!==this.element&&V(222),this.element.insertBefore(e,t),this}removeChild(e){return e.parentElement!==this.element&&V(223),this.element.removeChild(e),this}replaceChild(e,t){return t.parentElement!==this.element&&V(224),this.element.replaceChild(e,t),this}getFirstChild(){let e=this.after?this.after.nextSibling:this.element.firstChild;return e===this.before||e===this.getManagedLineBreak()?null:e}getManagedLineBreak(){return this.element.__lexicalLineBreak||null}setManagedLineBreak(e){if(e===null)this.removeManagedLineBreak();else{let t=e===`decorator`&&(iu||ru);this.insertManagedLineBreak(t)}}removeManagedLineBreak(){let e=this.getManagedLineBreak();if(e){let t=this.element,n=e.nodeName===`IMG`?e.nextSibling:null;n&&t.removeChild(n),t.removeChild(e),t.__lexicalLineBreak=void 0}}insertManagedLineBreak(e){let t=this.getManagedLineBreak();if(t){if(e===(t.nodeName===`IMG`))return;this.removeManagedLineBreak()}let n=this.element,r=this.before,i=document.createElement(`br`);if(n.insertBefore(i,r),e){let e=document.createElement(`img`);e.setAttribute(`data-lexical-linebreak`,`true`),e.style.cssText=`display: inline !important; border: 0px !important; margin: 0px !important;`,e.alt=``,n.insertBefore(e,i),n.__lexicalLineBreak=e}else n.__lexicalLineBreak=i}getFirstChildOffset(){let e=0;for(let t=this.after;t!==null;t=t.previousSibling)e++;return e}resolveChildIndex(e,t,n,r){if(n===this.element){let t=this.getFirstChildOffset();return[e,Math.min(t+e.getChildrenSize(),Math.max(t,r))]}let i=Rm(t,n);i.push(r);let a=Rm(t,this.element),o=e.getIndexWithinParent();for(let e=0;e<a.length;e++){let t=i[e],n=a[e];if(t===void 0||t<n)break;if(t>n){o+=1;break}}return[e.getParentOrThrow(),o]}};function Rm(e,t){let n=[],r=t;for(;r!==e&&r!==null;r=r.parentNode){let e=0;for(let t=r.previousSibling;t!==null;t=t.previousSibling)e++;n.push(e)}return r!==e&&V(225),n.reverse()}var zm=class extends dp{constructor(e){super(e),this.__first=null,this.__last=null,this.__size=0,this.__format=0,this.__style=``,this.__indent=0,this.__dir=null,this.__textFormat=0,this.__textStyle=``}afterCloneFrom(e){super.afterCloneFrom(e),this.__key===e.__key&&(this.__first=e.__first,this.__last=e.__last,this.__size=e.__size),this.__indent=e.__indent,this.__format=e.__format,this.__style=e.__style,this.__dir=e.__dir,this.__textFormat=e.__textFormat,this.__textStyle=e.__textStyle}getFormat(){return this.getLatest().__format}getFormatType(){return Mu[this.getFormat()]||``}getStyle(){return this.getLatest().__style}getIndent(){return this.getLatest().__indent}getChildren(){let e=[],t=this.getFirstChild();for(;t!==null;)e.push(t),t=t.getNextSibling();return e}getChildrenKeys(){let e=[],t=this.getFirstChild();for(;t!==null;)e.push(t.__key),t=t.getNextSibling();return e}getChildrenSize(){return this.getLatest().__size}isEmpty(){return this.getChildrenSize()===0}isDirty(){let e=Tm()._dirtyElements;return e!==null&&e.has(this.__key)}isLastChild(){let e=this.getLatest(),t=this.getParentOrThrow().getLastChild();return t!==null&&t.is(e)}getAllTextNodes(){let e=[],t=this.getFirstChild();for(;t!==null;){if(H(t)&&e.push(t),G(t)){let n=t.getAllTextNodes();e.push(...n)}t=t.getNextSibling()}return e}getFirstDescendant(){let e=this.getFirstChild();for(;G(e);){let t=e.getFirstChild();if(t===null)break;e=t}return e}getLastDescendant(){let e=this.getLastChild();for(;G(e);){let t=e.getLastChild();if(t===null)break;e=t}return e}getDescendantByIndex(e){let t=this.getChildren(),n=t.length;if(e>=n){let e=t[n-1];return G(e)&&e.getLastDescendant()||e||null}let r=t[e];return G(r)&&r.getFirstDescendant()||r||null}getFirstChild(){let e=this.getLatest().__first;return e===null?null:Dh(e)}getFirstChildOrThrow(){let e=this.getFirstChild();return e===null&&V(45,this.__key),e}getLastChild(){let e=this.getLatest().__last;return e===null?null:Dh(e)}getLastChildOrThrow(){let e=this.getLastChild();return e===null&&V(96,this.__key),e}getChildAtIndex(e){let t=this.getChildrenSize(),n,r;if(e<t/2){for(n=this.getFirstChild(),r=0;n!==null&&r<=e;){if(r===e)return n;n=n.getNextSibling(),r++}return null}for(n=this.getLastChild(),r=t-1;n!==null&&r>=e;){if(r===e)return n;n=n.getPreviousSibling(),r--}return null}getTextContent(){let e=``,t=this.getChildren(),n=t.length;for(let r=0;r<n;r++){let i=t[r];e+=i.getTextContent(),G(i)&&r!==n-1&&!i.isInline()&&(e+=Du)}return e}getTextContentSize(){let e=0,t=this.getChildren(),n=t.length;for(let r=0;r<n;r++){let i=t[r];e+=i.getTextContentSize(),G(i)&&r!==n-1&&!i.isInline()&&(e+=2)}return e}getDirection(){return this.getLatest().__dir}getTextFormat(){return this.getLatest().__textFormat}hasFormat(e){if(e!==``){let t=ju[e];return!!(this.getFormat()&t)}return!1}hasTextFormat(e){let t=ku[e];return!!(this.getTextFormat()&t)}getFormatFlags(e,t){return bh(this.getLatest().__textFormat,e,t)}getTextStyle(){return this.getLatest().__textStyle}select(e,t){Sm();let n=W(),r=e,i=t,a=this.getChildrenSize();if(!this.canBeEmpty()){if(e===0&&t===0){let e=this.getFirstChild();if(H(e)||G(e))return e.select(0,0)}else if(!(e!==void 0&&e!==a||t!==void 0&&t!==a)){let e=this.getLastChild();if(H(e)||G(e))return e.select()}}r===void 0&&(r=a),i===void 0&&(i=a);let o=this.__key;return U(n)?(n.anchor.set(o,r,`element`),n.focus.set(o,i,`element`),n.dirty=!0,n):em(o,r,o,i,`element`,`element`)}selectStart(){let e=this.getFirstDescendant();return e?e.selectStart():this.select()}selectEnd(){let e=this.getLastDescendant();return e?e.selectEnd():this.select()}clear(){let e=this.getWritable();return this.getChildren().forEach((e=>e.remove())),e}append(...e){return this.splice(this.getChildrenSize(),0,e)}setDirection(e){let t=this.getWritable();return t.__dir=e,t}setFormat(e){return this.getWritable().__format=e===``?0:ju[e],this}setStyle(e){return this.getWritable().__style=e||``,this}setTextFormat(e){let t=this.getWritable();return t.__textFormat=e,t}setTextStyle(e){let t=this.getWritable();return t.__textStyle=e,t}setIndent(e){return this.getWritable().__indent=e,this}splice(e,t,n){let r=n.length,i=this.getChildrenSize(),a=this.getWritable();e+t<=i||V(226,String(e),String(t),String(i));let o=a.__key,s=[],c=[],l=this.getChildAtIndex(e+t),u=null,d=i-t+r;if(e!==0)if(e===i)u=this.getLastChild();else{let t=this.getChildAtIndex(e);t!==null&&(u=t.getPreviousSibling())}if(t>0){let e=u===null?this.getFirstChild():u.getNextSibling();for(let n=0;n<t;n++){e===null&&V(100);let t=e.getNextSibling(),n=e.__key;Ch(e.getWritable()),c.push(n),e=t}}let f=u;for(let e=0;e<r;e++){let t=n[e];f!==null&&t.is(f)&&(u=f=f.getPreviousSibling());let r=t.getWritable();r.__parent===o&&d--,Ch(r);let i=t.__key;if(f===null)a.__first=i,r.__prev=null;else{let e=f.getWritable();e.__next=i,r.__prev=e.__key}t.__key===o&&V(76),r.__parent=o,s.push(i),f=t}if(e+t===i)f!==null&&(f.getWritable().__next=null,a.__last=f.__key);else if(l!==null){let e=l.getWritable();if(f!==null){let t=f.getWritable();e.__prev=f.__key,t.__next=l.__key}else e.__prev=null}if(a.__size=d,c.length){let e=W();if(U(e)){let t=new Set(c),n=new Set(s),{anchor:r,focus:i}=e;Bm(r,t,n)&&sm(r,r.getNode(),this,u,l),Bm(i,t,n)&&sm(i,i.getNode(),this,u,l),d!==0||this.canBeEmpty()||ug(this)||this.remove()}}return a}getDOMSlot(e){return new tee(e)}exportDOM(e){let{element:t}=super.exportDOM(e);if(yg(t)){let e=this.getIndent();e>0&&(t.style.paddingInlineStart=40*e+`px`);let n=this.getDirection();n&&(t.dir=n)}return{element:t}}exportJSON(){let e={children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),...super.exportJSON()},t=this.getTextFormat(),n=this.getTextStyle();return t!==0&&(e.textFormat=t),n!==``&&(e.textStyle=n),e}updateFromJSON(e){return super.updateFromJSON(e).setFormat(e.format).setIndent(e.indent).setDirection(e.direction).setTextFormat(e.textFormat||0).setTextStyle(e.textStyle||``)}insertNewAfter(e,t){return null}canIndent(){return!0}collapseAtStart(e){return!1}excludeFromCopy(e){return!1}canReplaceWith(e){return!0}canInsertAfter(e){return!0}canBeEmpty(){return!0}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}isInline(){return!1}isShadowRoot(){return!1}canMergeWith(e){return!1}extractWithChild(e,t,n){return!1}canMergeWhenEmpty(){return!1}reconcileObservedMutation(e,t){let n=this.getDOMSlot(e),r=n.getFirstChild();for(let e=this.getFirstChild();e;e=e.getNextSibling()){let i=t.getElementByKey(e.getKey());i!==null&&(r==null?(n.insertChild(i),r=i):r!==i&&n.replaceChild(i,r),r=r.nextSibling)}}};function G(e){return e instanceof zm}function Bm(e,t,n){let r=e.getNode();for(;r;){let e=r.__key;if(t.has(e)&&!n.has(e))return!0;r=r.getParent()}return!1}var Vm=class extends dp{decorate(e,t){V(47)}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}};function Hm(e){return e instanceof Vm}var Um=class e extends zm{static getType(){return`root`}static clone(){return new e}constructor(){super(`root`),this.__cachedText=null}getTopLevelElementOrThrow(){V(51)}getTextContent(){let e=this.__cachedText;return!xm()&&Tm()._dirtyType!==mu||e===null?super.getTextContent():e}remove(){V(52)}replace(e){V(53)}insertBefore(e){V(54)}insertAfter(e){V(55)}updateDOM(e,t){return!1}splice(e,t,n){for(let e of n)G(e)||Hm(e)||V(282);return super.splice(e,t,n)}static importJSON(e){return Nh().updateFromJSON(e)}collapseAtStart(){return!0}};function Wm(e){return e instanceof Um}function Gm(e){return new Jm(new Map(e._nodeMap))}function Km(){return new Jm(new Map([[`root`,new Um]]))}function qm(e){let t=e.exportJSON(),n=e.constructor;if(t.type!==n.getType()&&V(130,n.name),G(e)){let r=t.children;Array.isArray(r)||V(59,n.name);let i=e.getChildren();for(let e=0;e<i.length;e++){let t=qm(i[e]);r.push(t)}}return t}var Jm=class e{constructor(e,t){this._nodeMap=e,this._selection=t||null,this._flushSync=!1,this._readOnly=!1}isEmpty(){return this._nodeMap.size===1&&this._selection===null}read(e,t){return Mm(t&&t.editor||null,this,e)}clone(t){let n=new e(this._nodeMap,t===void 0?this._selection:t);return n._readOnly=!0,n}toJSON(){return Mm(null,this,(()=>({root:qm(Nh())})))}},Ym=`history-push`,Xm=`history-merge`,Zm=class extends zm{static getType(){return`artificial`}createDOM(e){return document.createElement(`div`)}},Qm=class e extends zm{static getType(){return`paragraph`}static clone(t){return new e(t.__key)}createDOM(e){let t=document.createElement(`p`),n=Xh(e.theme,`paragraph`);return n!==void 0&&t.classList.add(...n),t}updateDOM(e,t,n){return!1}static importDOM(){return{p:e=>({conversion:nee,priority:0})}}exportDOM(e){let{element:t}=super.exportDOM(e);if(yg(t)){this.isEmpty()&&t.append(document.createElement(`br`));let e=this.getFormatType();e&&(t.style.textAlign=e)}return{element:t}}static importJSON(e){return $m().updateFromJSON(e)}exportJSON(){return{...super.exportJSON(),textFormat:this.getTextFormat(),textStyle:this.getTextStyle()}}insertNewAfter(e,t){let n=$m();n.setTextFormat(e.format),n.setTextStyle(e.style);let r=this.getDirection();return n.setDirection(r),n.setFormat(this.getFormatType()),n.setStyle(this.getStyle()),this.insertAfter(n,t),n}collapseAtStart(){let e=this.getChildren();if(e.length===0||H(e[0])&&e[0].getTextContent().trim()===``){if(this.getNextSibling()!==null)return this.selectNext(),this.remove(),!0;if(this.getPreviousSibling()!==null)return this.selectPrevious(),this.remove(),!0}return!1}};function nee(e){let t=$m();return e.style&&(t.setFormat(e.style.textAlign),jg(e,t)),{node:t}}function $m(){return fg(new Qm)}function eh(e){return e instanceof Qm}function th(e,t,n,r){let i=e._keyToDOMMap;i.clear(),e._editorState=Km(),e._pendingEditorState=r,e._compositionKey=null,e._dirtyType=mu,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements.clear(),e._normalizedNodes=new Set,e._updateTags=new Set,e._updates=[],e._blockCursorElement=null;let a=e._observer;a!==null&&(a.disconnect(),e._observer=null),t!==null&&(t.textContent=``),n!==null&&(n.textContent=``,i.set(`root`,n))}function nh(e){let t=e||{},n=Dm(),r=t.theme||{},i=e===void 0?n:t.parentEditor||null,a=t.disableEvents||!1,o=Km(),s=t.namespace||(i===null?zh():i._config.namespace),c=t.editorState,l=[Um,Cp,fp,Pp,Qm,Zm,...t.nodes||[]],{onError:u,html:d}=t,f=t.editable===void 0||t.editable,p;if(e===void 0&&n!==null)p=n._nodes;else{p=new Map;for(let e=0;e<l.length;e++){let t=l[e],n=null,r=null;if(typeof t!=`function`){let e=t;t=e.replace,n=e.with,r=e.withKlass||null}let{ownNodeConfig:i}=Pg(t),a=t.getType(),o=t.transform(),s=new Set;i&&i.$transform&&s.add(i.$transform),o!==null&&s.add(o),p.set(a,{exportDOM:d&&d.export?d.export.get(t):void 0,klass:t,replace:n,replaceWithKlass:r,sharedNodeState:Ju(l[e]),transforms:s})}}let m=new rh(o,i,p,{disableEvents:a,namespace:s,theme:r},u||console.error,function(e,t){let n=new Map,r=new Set,i=e=>{Object.keys(e).forEach((t=>{let r=n.get(t);r===void 0&&(r=[],n.set(t,r)),r.push(e[t])}))};return e.forEach((e=>{let t=e.klass.importDOM;if(t==null||r.has(t))return;r.add(t);let n=t.call(e.klass);n!==null&&i(n)})),t&&i(t),n}(p,d?d.import:void 0),f,e);return c!==void 0&&(m._pendingEditorState=c,m._dirtyType=gu),m}var rh=class{constructor(e,t,n,r,i,a,o,s){this._createEditorArgs=s,this._parentEditor=t,this._rootElement=null,this._editorState=e,this._pendingEditorState=null,this._compositionKey=null,this._deferred=[],this._keyToDOMMap=new Map,this._updates=[],this._updating=!1,this._listeners={decorator:new Set,editable:new Set,mutation:new Map,root:new Set,textcontent:new Set,update:new Set},this._commands=new Map,this._config=r,this._nodes=n,this._decorators={},this._pendingDecorators=null,this._dirtyType=mu,this._cloneNotNeeded=new Set,this._dirtyLeaves=new Set,this._dirtyElements=new Map,this._normalizedNodes=new Set,this._updateTags=new Set,this._observer=null,this._key=zh(),this._onError=i,this._htmlConversions=a,this._editable=o,this._headless=t!==null&&t._headless,this._window=null,this._blockCursorElement=null}isComposing(){return this._compositionKey!=null}registerUpdateListener(e){let t=this._listeners.update;return t.add(e),()=>{t.delete(e)}}registerEditableListener(e){let t=this._listeners.editable;return t.add(e),()=>{t.delete(e)}}registerDecoratorListener(e){let t=this._listeners.decorator;return t.add(e),()=>{t.delete(e)}}registerTextContentListener(e){let t=this._listeners.textcontent;return t.add(e),()=>{t.delete(e)}}registerRootListener(e){let t=this._listeners.root;return e(this._rootElement,null),t.add(e),()=>{e(null,this._rootElement),t.delete(e)}}registerCommand(e,t,n){n===void 0&&V(35);let r=this._commands;r.has(e)||r.set(e,[new Set,new Set,new Set,new Set,new Set]);let i=r.get(e);i===void 0&&V(36,String(e));let a=i[n];return a.add(t),()=>{a.delete(t),i.every((e=>e.size===0))&&r.delete(e)}}registerMutationListener(e,t,n){let r=this.resolveRegisteredNodeAfterReplacements(this.getRegisteredNode(e)).klass,i=this._listeners.mutation,a=i.get(t);a===void 0&&(a=new Set,i.set(t,a)),a.add(r);let o=n&&n.skipInitialization;return o!==void 0&&o||this.initializeMutationListener(t,r),()=>{a.delete(r),a.size===0&&i.delete(t)}}getRegisteredNode(e){let t=this._nodes.get(e.getType());return t===void 0&&V(37,e.name),t}resolveRegisteredNodeAfterReplacements(e){for(;e.replaceWithKlass;)e=this.getRegisteredNode(e.replaceWithKlass);return e}initializeMutationListener(e,t){let n=this._editorState,r=kg(n).get(t.getType());if(!r)return;let i=new Map;for(let e of r.keys())i.set(e,`created`);i.size>0&&e(i,{dirtyLeaves:new Set,prevEditorState:n,updateTags:new Set([`registerMutationListener`])})}registerNodeTransformToKlass(e,t){let n=this.getRegisteredNode(e);return n.transforms.add(t),n}registerNodeTransform(e,t){let n=this.registerNodeTransformToKlass(e,t),r=[n],i=n.replaceWithKlass;if(i!=null){let e=this.registerNodeTransformToKlass(i,t);r.push(e)}return function(e,t){let n=kg(e.getEditorState()),r=[];for(let e of t){let t=n.get(e);t&&r.push(t)}r.length!==0&&e.update((()=>{for(let e of r)for(let t of e.keys()){let e=Dh(t);e&&e.markDirty()}}),e._pendingEditorState===null?{tag:Xm}:void 0)}(this,r.map((e=>e.klass.getType()))),()=>{r.forEach((e=>e.transforms.delete(t)))}}hasNode(e){return this._nodes.has(e.getType())}hasNodes(e){return e.every(this.hasNode.bind(this))}dispatchCommand(e,t){return tg(this,e,t)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(e){let t=this._rootElement;if(e!==t){let n=Xh(this._config.theme,`root`),r=this._pendingEditorState||this._editorState;if(this._rootElement=e,th(this,t,e,r),t!==null&&(this._config.disableEvents||cp(t),n!=null&&t.classList.remove(...n)),e!==null){let t=sg(e),r=e.style;r.userSelect=`text`,r.whiteSpace=`pre-wrap`,r.wordBreak=`break-word`,e.setAttribute(`data-lexical-editor`,`true`),this._window=t,this._dirtyType=gu,qu(this),this._updateTags.add(Xm),Nm(this),this._config.disableEvents||function(e,t){let n=e.ownerDocument,r=Vf.get(n);(r===void 0||r<1)&&n.addEventListener(`selectionchange`,ap),Vf.set(n,(r||0)+1),e.__lexicalEditor=t;let i=rp(e);for(let n=0;n<If.length;n++){let[r,a]=If[n],o=typeof a==`function`?e=>{sp(e)||(op(e),(t.isEditable()||r===`click`)&&a(e,t))}:e=>{if(sp(e))return;op(e);let n=t.isEditable();switch(r){case`cut`:return n&&tg(t,Tf,e);case`copy`:return tg(t,wf,e);case`paste`:return n&&tg(t,Yd,e);case`dragstart`:return n&&tg(t,xf,e);case`dragover`:return n&&tg(t,Sf,e);case`dragend`:return n&&tg(t,Cf,e);case`focus`:return n&&tg(t,jf,e);case`blur`:return n&&tg(t,Mf,e);case`drop`:return n&&tg(t,yf,e)}};e.addEventListener(r,o),i.push((()=>{e.removeEventListener(r,o)}))}}(e,this),n!=null&&e.classList.add(...n)}else this._window=null,this._updateTags.add(Xm),Nm(this);Pm(`root`,this,!1,e,t)}}getElementByKey(e){return this._keyToDOMMap.get(e)||null}getEditorState(){return this._editorState}setEditorState(e,t){e.isEmpty()&&V(38);let n=e;n._readOnly&&(n=Gm(e),n._selection=e._selection?e._selection.clone():null),Ku(this);let r=this._pendingEditorState,i=this._updateTags,a=t===void 0?null:t.tag;r===null||r.isEmpty()||(a!=null&&i.add(a),Nm(this)),this._pendingEditorState=n,this._dirtyType=gu,this._dirtyElements.set(`root`,!1),this._compositionKey=null,a!=null&&i.add(a),this._updating||Nm(this)}parseEditorState(e,t){return function(e,t,n){let r=Km(),i=hm,a=_m,o=gm,s=t._dirtyElements,c=t._dirtyLeaves,l=t._cloneNotNeeded,u=t._dirtyType;t._dirtyElements=new Map,t._dirtyLeaves=new Set,t._cloneNotNeeded=new Set,t._dirtyType=0,hm=r,_m=!1,gm=t,ah(null);try{let i=t._nodes;jm(e.root,i),n&&n(),r._readOnly=!0}catch(e){e instanceof Error&&t._onError(e)}finally{t._dirtyElements=s,t._dirtyLeaves=c,t._cloneNotNeeded=l,t._dirtyType=u,hm=i,_m=a,gm=o}return r}(typeof e==`string`?JSON.parse(e):e,this,t)}read(e){return Nm(this),this.getEditorState().read(e,{editor:this})}update(e,t){(function(e,t,n){e._updating?e._updates.push([t,n]):Im(e,t,n)})(this,e,t)}focus(e,t={}){let n=this._rootElement;n!==null&&(n.setAttribute(`autocapitalize`,`off`),Lm(this,(()=>{let r=W(),i=Nh();r===null?i.getChildrenSize()!==0&&(t.defaultSelection===`rootStart`?i.selectStart():i.selectEnd()):r.dirty||Fh(r.clone()),oee(`focus`),see((()=>{n.removeAttribute(`autocapitalize`),e&&e()}))})),this._pendingEditorState===null&&n.removeAttribute(`autocapitalize`))}blur(){let e=this._rootElement;e!==null&&e.blur();let t=gg(this._window);t!==null&&t.removeAllRanges()}isEditable(){return this._editable}setEditable(e){this._editable!==e&&(this._editable=e,Pm(`editable`,this,!0,e))}toJSON(){return{editorState:this._editorState.toJSON()}}};rh.version=`0.35.0+prod.esm`;var ih=null;function ah(e){ih=e}var oh=1;function sh(e,t){let n=ch(e,t);return n===void 0&&V(30,t),n}function ch(e,t){return e._nodes.get(t)}var lh=typeof queueMicrotask==`function`?queueMicrotask:e=>{Promise.resolve().then(e)};function uh(e){return Hm(Ah(e))}function dh(e){let t=document.activeElement;if(!yg(t))return!1;let n=t.nodeName;return Hm(Ah(e))&&(n===`INPUT`||n===`TEXTAREA`||t.contentEditable===`true`&&hh(t)==null)}function fh(e,t,n){let r=e.getRootElement();try{return r!==null&&r.contains(t)&&r.contains(n)&&t!==null&&!dh(t)&&mh(t)===e}catch{return!1}}function ph(e){return e instanceof rh}function mh(e){let t=e;for(;t!=null;){let e=hh(t);if(ph(e))return e;t=ig(t)}return null}function hh(e){return e?e.__lexicalEditor:null}function gh(e){return Ip(e)||e.isToken()}function _h(e){return gh(e)||e.isSegmented()}function vh(e){return bg(e)&&e.nodeType===du}function ree(e){return bg(e)&&e.nodeType===fu}function yh(e){let t=e;for(;t!=null;){if(vh(t))return t;t=t.firstChild}return null}function bh(e,t,n){let r=ku[t];if(n!==null&&(e&r)==(n&r))return e;let i=e^r;return t===`subscript`?i&=~ku.superscript:t===`superscript`?i&=~ku.subscript:t===`lowercase`?(i&=~ku.uppercase,i&=~ku.capitalize):t===`uppercase`?(i&=~ku.lowercase,i&=~ku.capitalize):t===`capitalize`&&(i&=~ku.lowercase,i&=~ku.uppercase),i}function xh(e){return H(e)||hp(e)||Hm(e)}function Sh(e,t){let n=function(){let e=ih;return ih=null,e}();if((t||=n&&n.__key)!=null)return void(e.__key=t);Sm(),Cm();let r=Tm(),i=wm(),a=``+ oh++;i._nodeMap.set(a,e),G(e)?r._dirtyElements.set(a,!0):r._dirtyLeaves.add(a),r._cloneNotNeeded.add(a),r._dirtyType=hu,e.__key=a}function Ch(e){let t=e.getParent();if(t!==null){let n=e.getWritable(),r=t.getWritable(),i=e.getPreviousSibling(),a=e.getNextSibling(),o=a===null?null:a.__key,s=i===null?null:i.__key,c=i===null?null:i.getWritable(),l=a===null?null:a.getWritable();i===null&&(r.__first=o),a===null&&(r.__last=s),c!==null&&(c.__next=o),l!==null&&(l.__prev=s),n.__prev=null,n.__next=null,n.__parent=null,r.__size--}}function wh(e){Cm();let t=e.getLatest(),n=t.__parent,r=wm(),i=Tm(),a=r._nodeMap,o=i._dirtyElements;n!==null&&function(e,t,n){let r=e;for(;r!==null;){if(n.has(r))return;let e=t.get(r);if(e===void 0)break;n.set(r,!1),r=e.__parent}}(n,a,o);let s=t.__key;i._dirtyType=hu,G(e)?o.set(s,!0):i._dirtyLeaves.add(s)}function Th(e){Sm();let t=Tm(),n=t._compositionKey;if(e!==n){if(t._compositionKey=e,n!==null){let e=Dh(n);e!==null&&e.getWritable()}if(e!==null){let t=Dh(e);t!==null&&t.getWritable()}}}function Eh(){return xm()?null:Tm()._compositionKey}function Dh(e,t){let n=(t||wm())._nodeMap.get(e);return n===void 0?null:n}function Oh(e,t){let n=kh(e,Tm());return n===void 0?null:Dh(n,t)}function kh(e,t){return e[`__lexicalKey_${t._key}`]}function Ah(e,t){let n=e;for(;n!=null;){let e=Oh(n,t);if(e!==null)return e;n=ig(n)}return null}function jh(e){let t=e._decorators,n=Object.assign({},t);return e._pendingDecorators=n,n}function Mh(e){return e.read((()=>Nh().getTextContent()))}function Nh(){return Ph(wm())}function Ph(e){return e._nodeMap.get(`root`)}function Fh(e){Sm();let t=wm();e!==null&&(e.dirty=!0,e.setCachedNodes(null)),t._selection=e}function Ih(e){let t=Tm(),n=function(e,t){let n=e;for(;n!=null;){let e=kh(n,t);if(e!==void 0)return e;n=ig(n)}return null}(e,t);return n===null?e===t.getRootElement()?Dh(`root`):null:Dh(n)}function Lh(e){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(e)}function Rh(e){let t=[],n=e;for(;n!==null;)t.push(n),n=n._parentEditor;return t}function zh(){return Math.random().toString(36).replace(/[^a-z]+/g,``).substring(0,5)}function Bh(e){return vh(e)?e.nodeValue:null}function Vh(e,t,n){let r=gg(cg(t));if(r===null)return;let i=r.anchorNode,{anchorOffset:a,focusOffset:o}=r;if(i!==null){let t=Bh(i),r=Ah(i);if(t!==null&&H(r)){if(t===Eu&&n){let e=n.length;t=n,a=e,o=e}t!==null&&Hh(r,t,a,o,e)}}}function Hh(e,t,n,r,i){let a=e;if(a.isAttached()&&(i||!a.isDirty())){let o=a.isComposing(),s=t;(o||i)&&t[t.length-1]===Eu&&(s=t.slice(0,-1));let c=a.getTextContent();if(i||s!==c){if(s===``){if(Th(null),ru||iu||cu)a.remove();else{let e=Tm();setTimeout((()=>{e.update((()=>{a.isAttached()&&a.remove()}))}),20)}return}let t=a.getParent(),i=im(),c=a.getTextContentSize(),l=Eh(),u=a.getKey();if(a.isToken()||l!==null&&u===l&&!o||U(i)&&(t!==null&&!t.canInsertTextBefore()&&i.anchor.offset===0||i.anchor.key===e.__key&&i.anchor.offset===0&&!a.canInsertTextBefore()&&!o||i.focus.key===e.__key&&i.focus.offset===c&&!a.canInsertTextAfter()&&!o))return void a.markDirty();let d=W();if(!U(d)||n===null||r===null)return void Uh(a,s,d);if(d.setTextNodeRange(a,n,a,r),a.isSegmented()){let e=Mp(a.getTextContent());a.replace(e),a=e}Uh(a,s,d)}}}function Uh(e,t,n){if(e.setTextContent(t),U(n)){let t=e.getKey();for(let r of[`anchor`,`focus`]){let i=n[r];i.type===`text`&&i.key===t&&(i.offset=Xg(e,i.offset,`clamp`))}}}function Wh(e,t,n){let r=t[n]||!1;return r===`any`||r===e[n]}function iee(e,t){return Wh(e,t,`altKey`)&&Wh(e,t,`ctrlKey`)&&Wh(e,t,`shiftKey`)&&Wh(e,t,`metaKey`)}function Gh(e,t,n){return iee(e,n)&&e.key.toLowerCase()===t.toLowerCase()}var Kh={ctrlKey:!eu,metaKey:eu},qh={altKey:eu,ctrlKey:!eu};function Jh(e){return e.key===`Backspace`}function Yh(e){return Gh(e,`a`,Kh)}function aee(e){let t=Nh();if(U(e)){let t=e.anchor,n=e.focus,r=t.getNode().getTopLevelElementOrThrow().getParentOrThrow();return t.set(r.getKey(),0,`element`),n.set(r.getKey(),r.getChildrenSize(),`element`),ad(e),e}{let e=t.select(0,t.getChildrenSize());return Fh(ad(e)),e}}function Xh(e,t){e.__lexicalClassNameCache===void 0&&(e.__lexicalClassNameCache={});let n=e.__lexicalClassNameCache,r=n[t];if(r!==void 0)return r;let i=e[t];if(typeof i==`string`){let e=lu(i);return n[t]=e,e}return i}function Zh(e,t,n,r,i){if(n.size===0)return;let a=r.__type,o=r.__key,s=t.get(a);s===void 0&&V(33,a);let c=s.klass,l=e.get(c);l===void 0&&(l=new Map,e.set(c,l));let u=l.get(o),d=u===`destroyed`&&i===`created`;(u===void 0||d)&&l.set(o,d?`updated`:i)}function Qh(e,t,n){let r=e.getParent(),i=n,a=e;return r!==null&&(t&&n===0?(i=a.getIndexWithinParent(),a=r):t||n!==a.getChildrenSize()||(i=a.getIndexWithinParent()+1,a=r)),a.getChildAtIndex(t?i-1:i)}function $h(e,t){let n=e.offset;if(e.type===`element`)return Qh(e.getNode(),t,n);{let r=e.getNode();if(t&&n===0||!t&&n===r.getTextContentSize()){let e=t?r.getPreviousSibling():r.getNextSibling();return e===null?Qh(r.getParentOrThrow(),t,r.getIndexWithinParent()+ +!t):e}}return null}function eg(e){let t=cg(e).event,n=t&&t.inputType;return n===`insertFromPaste`||n===`insertFromPasteAsQuotation`}function tg(e,t,n){return function(e,t,n){let r=Rh(e);for(let i=4;i>=0;i--)for(let a=0;a<r.length;a++){let o=r[a],s=o._commands.get(t);if(s!==void 0){let t=s[i];if(t!==void 0){let r=Array.from(t),i=r.length,a=!1;if(Lm(o,(()=>{for(let t=0;t<i;t++)if(r[t](n,e))return void(a=!0)})),a)return a}}}return!1}(e,t,n)}function ng(e){return!Wm(e)&&!e.isLastChild()&&!e.isInline()}function rg(e,t){let n=e._keyToDOMMap.get(t);return n===void 0&&V(75,t),n}function ig(e){let t=e.assignedSlot||e.parentElement;return xg(t)?t.host:t}function ag(e){return ree(e)?e:yg(e)?e.ownerDocument:null}function oee(e){Sm(),Tm()._updateTags.add(e)}function see(e){Sm(),Tm()._deferred.push(e)}function og(e,t){let n=e.getParent();for(;n!==null;){if(n.is(t))return!0;n=n.getParent()}return!1}function sg(e){let t=ag(e);return t?t.defaultView:null}function cg(e){let t=e._window;return t===null&&V(78),t}function lg(e){let t=e.getParentOrThrow();for(;t!==null;){if(ug(t))return t;t=t.getParentOrThrow()}return t}function ug(e){return Wm(e)||G(e)&&e.isShadowRoot()}function dg(e){let t=e.constructor.clone(e);return Sh(t,null),t.afterCloneFrom(e),t}function fg(e){let t=Tm(),n=e.getType(),r=ch(t,n);r===void 0&&V(200,e.constructor.name,n);let{replace:i,replaceWithKlass:a}=r;if(i!==null){let t=i(e),r=t.constructor;return a===null?t instanceof e.constructor&&r!==e.constructor||V(202,r.name,r.getType(),e.constructor.name,n):t instanceof a||V(201,a.name,a.getType(),r.name,r.getType(),e.constructor.name,n),t.__key===e.__key&&V(203,e.constructor.name,n,r.name,r.getType()),t}return e}function pg(e,t){!Wm(e.getParent())||G(t)||Hm(t)||V(99)}function cee(e){let t=Dh(e);return t===null&&V(63,e),t}function mg(e){return(Hm(e)||G(e)&&!e.canBeEmpty())&&!e.isInline()}function hg(e,t,n){n.style.removeProperty(`caret-color`),t._blockCursorElement=null;let r=e.parentElement;r!==null&&r.removeChild(e)}function gg(e){return Ql?(e||window).getSelection():null}function _g(e){let t=sg(e);return t?t.getSelection():null}function vg(e){return yg(e)&&e.tagName===`A`}function yg(e){return bg(e)&&e.nodeType===uu}function bg(e){return typeof e==`object`&&!!e&&`nodeType`in e&&typeof e.nodeType==`number`}function xg(e){return bg(e)&&e.nodeType===pu}function Sg(e){let t=new RegExp(/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|mark|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var|#text)$/,`i`);return e.nodeName.match(t)!==null}function Cg(e){let t=new RegExp(/^(address|article|aside|blockquote|canvas|dd|div|dl|dt|fieldset|figcaption|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hr|li|main|nav|noscript|ol|p|pre|section|table|td|tfoot|ul|video)$/,`i`);return e.nodeName.match(t)!==null}function wg(e){if(Hm(e)&&!e.isInline())return!0;if(!G(e)||ug(e))return!1;let t=e.getFirstChild(),n=t===null||hp(t)||H(t)||t.isInline();return!e.isInline()&&!1!==e.canBeEmpty()&&n}function Tg(e,t){let n=e;for(;n!==null&&n.getParent()!==null&&!t(n);)n=n.getParentOrThrow();return t(n)?n:null}function Eg(){return Tm()}var Dg=new WeakMap,Og=new Map;function kg(e){if(!e._readOnly&&e.isEmpty())return Og;e._readOnly||V(192);let t=Dg.get(e);return t||(t=function(e){let t=new Map;for(let[n,r]of e._nodeMap){let e=r.__type,i=t.get(e);i||(i=new Map,t.set(e,i)),i.set(n,r)}return t}(e),Dg.set(e,t)),t}function Ag(e){let t=e.constructor.clone(e);return t.afterCloneFrom(e),t}function jg(e,t){let n=parseInt(e.style.paddingInlineStart,10)||0,r=Math.round(n/40);t.setIndent(r)}function Mg(e){return!0===e.__lexicalUnmanaged}function Ng(e,t){return function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}(e,t)&&e[t]!==dp[t]}function Pg(e){let t=Fu in e.prototype?e.prototype[Fu]():void 0,n=function(e){return e===Vm||e===zm||e===dp}(e),r=!n&&Ng(e,`getType`)?e.getType():void 0,i,a=r;if(t)if(r)i=t[r];else for(let[e,n]of Object.entries(t))a=e,i=n;if(!n&&a&&(Ng(e,`getType`)||(e.getType=()=>a),Ng(e,`clone`)||(e.clone=t=>(ah(t),new e)),Ng(e,`importJSON`)||(e.importJSON=i&&i.$importJSON||(t=>new e().updateFromJSON(t))),!Ng(e,`importDOM`)&&i)){let{importDOM:t}=i;t&&(e.importDOM=()=>t)}return{ownNodeConfig:i,ownNodeType:a}}function Fg(e){let t=Eg();return Sm(),new(t.resolveRegisteredNodeAfterReplacements(t.getRegisteredNode(e))).klass}var Ig={next:`previous`,previous:`next`},Lg=class{constructor(e){this.origin=e}[Symbol.iterator](){return r_({hasNext:Gg,initial:this.getAdjacentCaret(),map:e=>e,step:e=>e.getAdjacentCaret()})}getAdjacentCaret(){return Jg(this.getNodeAtCaret(),this.direction)}getSiblingCaret(){return Jg(this.origin,this.direction)}remove(){let e=this.getNodeAtCaret();return e&&e.remove(),this}replaceOrInsert(e,t){let n=this.getNodeAtCaret();return e.is(this.origin)||e.is(n)||(n===null?this.insert(e):n.replace(e,t)),this}splice(e,t,n=`next`){let r=n===this.direction?t:Array.from(t).reverse(),i=this,a=this.getParentAtCaret(),o=new Map;for(let t=i.getAdjacentCaret();t!==null&&o.size<e;t=t.getAdjacentCaret()){let e=t.origin.getWritable();o.set(e.getKey(),e)}for(let e of r){if(o.size>0){let t=i.getNodeAtCaret();if(t){if(o.delete(t.getKey()),o.delete(e.getKey()),!(t.is(e)||i.origin.is(e))){let n=e.getParent();n&&n.is(a)&&e.remove(),t.replace(e)}}else t===null&&V(263,Array.from(o).join(` `))}else i.insert(e);i=Jg(e,this.direction)}for(let e of o.values())e.remove();return this}},Rg=class e extends Lg{type=`child`;getLatest(){let e=this.origin.getLatest();return e===this.origin?this:Qg(e,this.direction)}getParentCaret(e=`root`){return Jg(Vg(this.getParentAtCaret(),e),this.direction)}getFlipped(){let e=Bg(this.direction);return Jg(this.getNodeAtCaret(),e)||Qg(this.origin,e)}getParentAtCaret(){return this.origin}getChildCaret(){return this}isSameNodeCaret(t){return t instanceof e&&this.direction===t.direction&&this.origin.is(t.origin)}isSamePointCaret(e){return this.isSameNodeCaret(e)}},zg={root:Wm,shadowRoot:ug};function Bg(e){return Ig[e]}function Vg(e,t=`root`){return zg[t](e)?null:e}var Hg=class e extends Lg{type=`sibling`;getLatest(){let e=this.origin.getLatest();return e===this.origin?this:Jg(e,this.direction)}getSiblingCaret(){return this}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return G(this.origin)?Qg(this.origin,this.direction):null}getParentCaret(e=`root`){return Jg(Vg(this.getParentAtCaret(),e),this.direction)}getFlipped(){let e=Bg(this.direction);return Jg(this.getNodeAtCaret(),e)||Qg(this.origin.getParentOrThrow(),e)}isSamePointCaret(t){return t instanceof e&&this.direction===t.direction&&this.origin.is(t.origin)}isSameNodeCaret(t){return(t instanceof e||t instanceof Ug)&&this.direction===t.direction&&this.origin.is(t.origin)}},Ug=class e extends Lg{type=`text`;constructor(e,t){super(e),this.offset=t}getLatest(){let e=this.origin.getLatest();return e===this.origin?this:Yg(e,this.direction,this.offset)}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return null}getParentCaret(e=`root`){return Jg(Vg(this.getParentAtCaret(),e),this.direction)}getFlipped(){return Yg(this.origin,Bg(this.direction),this.offset)}isSamePointCaret(t){return t instanceof e&&this.direction===t.direction&&this.origin.is(t.origin)&&this.offset===t.offset}isSameNodeCaret(t){return(t instanceof Hg||t instanceof e)&&this.direction===t.direction&&this.origin.is(t.origin)}getSiblingCaret(){return Jg(this.origin,this.direction)}};function Wg(e){return e instanceof Ug}function Gg(e){return e instanceof Hg}function Kg(e){return e instanceof Rg}var qg={next:class extends Ug{direction=`next`;getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends Ug{direction=`previous`;getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},lee={next:class extends Hg{direction=`next`;getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends Hg{direction=`previous`;getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},uee={next:class extends Rg{direction=`next`;getNodeAtCaret(){return this.origin.getFirstChild()}insert(e){return this.origin.splice(0,0,[e]),this}},previous:class extends Rg{direction=`previous`;getNodeAtCaret(){return this.origin.getLastChild()}insert(e){return this.origin.splice(this.origin.getChildrenSize(),0,[e]),this}}};function Jg(e,t){return e?new lee[t](e):null}function Yg(e,t,n){return e?new qg[t](e,Xg(e,n)):null}function Xg(e,t,n=`error`){let r=e.getTextContentSize(),i=t===`next`?r:t===`previous`?0:t;return(i<0||i>r)&&(n!==`clamp`&&function(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);n.search=r.toString(),console.warn(`Minified Lexical warning #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(284,String(t),String(r),e.getKey()),i=i<0?0:r),i}function Zg(e,t){return new pee(e,t)}function Qg(e,t){return G(e)?new uee[t](e):null}function dee(e){return e&&e.getChildCaret()||e}function $g(e){return e&&dee(e.getAdjacentCaret())}var fee=class e{type=`node-caret-range`;constructor(e,t,n){this.anchor=e,this.focus=t,this.direction=n}getLatest(){let t=this.anchor.getLatest(),n=this.focus.getLatest();return t===this.anchor&&n===this.focus?this:new e(t,n,this.direction)}isCollapsed(){return this.anchor.isSamePointCaret(this.focus)}getTextSlices(){let e=e=>{let t=this[e].getLatest();return Wg(t)?function(e,t){let{direction:n,origin:r}=e;return Zg(e,Xg(r,t===`focus`?Bg(n):n)-e.offset)}(t,e):null},t=e(`anchor`),n=e(`focus`);if(t&&n){let{caret:e}=t,{caret:r}=n;if(e.isSameNodeCaret(r))return[Zg(e,r.offset-e.offset),null]}return[t,n]}iterNodeCarets(e=`root`){let t=Wg(this.anchor)?this.anchor.getSiblingCaret():this.anchor.getLatest(),n=this.focus.getLatest(),r=Wg(n),i=t=>t.isSameNodeCaret(n)?null:$g(t)||t.getParentCaret(e);return r_({hasNext:e=>e!==null&&!(r&&n.isSameNodeCaret(e)),initial:t.isSameNodeCaret(n)?null:i(t),map:e=>e,step:i})}[Symbol.iterator](){return this.iterNodeCarets(`root`)}},pee=class{type=`slice`;constructor(e,t){this.caret=e,this.distance=t}getSliceIndices(){let{distance:e,caret:{offset:t}}=this,n=t+e;return n<t?[n,t]:[t,n]}getTextContent(){let[e,t]=this.getSliceIndices();return this.caret.origin.getTextContent().slice(e,t)}getTextContentSize(){return Math.abs(this.distance)}removeTextSlice(){let{caret:{origin:e,direction:t}}=this,[n,r]=this.getSliceIndices(),i=e.getTextContent();return Yg(e.setTextContent(i.slice(0,n)+i.slice(r)),t,n)}};function e_(e){return n_(e,Jg(Nh(),e.direction))}function t_(e){return n_(e,e)}function n_(e,t){return e.direction!==t.direction&&V(265),new fee(e,t,e.direction)}function r_(e){let{initial:t,hasNext:n,step:r,map:i}=e,a=t;return{[Symbol.iterator](){return this},next(){if(!n(a))return{done:!0,value:void 0};let e={done:!1,value:i(a)};return a=r(a),e}}}function i_(e,t){let n=c_(e.origin,t.origin);switch(n===null&&V(275,e.origin.getKey(),t.origin.getKey()),n.type){case`same`:{let n=e.type===`text`,r=t.type===`text`;return n&&r?function(e,t){return Math.sign(e-t)}(e.offset,t.offset):e.type===t.type?0:n?-1:r?1:e.type===`child`?-1:1}case`ancestor`:return e.type===`child`?-1:1;case`descendant`:return t.type===`child`?1:-1;case`branch`:return a_(n)}}function a_(e){let{a:t,b:n}=e,r=t.__key,i=n.__key,a=t,o=n;for(;a&&o;a=a.getNextSibling(),o=o.getNextSibling()){if(a.__key===i)return-1;if(o.__key===r)return 1}return a===null?1:-1}function o_(e,t){return t.is(e)}function s_(e){return G(e)?[e.getLatest(),null]:[e.getParent(),e.getLatest()]}function c_(e,t){if(e.is(t))return{commonAncestor:e,type:`same`};let n=new Map;for(let[t,r]=s_(e);t;r=t,t=t.getParent())n.set(t,r);for(let[r,i]=s_(t);r;i=r,r=r.getParent()){let a=n.get(r);if(a!==void 0)return a===null?(o_(e,r)||V(276),{commonAncestor:r,type:`ancestor`}):i===null?(o_(t,r)||V(277),{commonAncestor:r,type:`descendant`}):((G(a)||o_(e,a))&&(G(i)||o_(t,i))&&r.is(a.getParent())&&r.is(i.getParent())||V(278),{a,b:i,commonAncestor:r,type:`branch`})}return null}function l_(e,t){let{type:n,key:r,offset:i}=e,a=cee(e.key);return n===`text`?(H(a)||V(266,a.getType(),r),Yg(a,t,i)):(G(a)||V(267,a.getType(),r),mee(a,e.offset,t))}function u_(e,t){let{origin:n,direction:r}=t,i=r===`next`;Wg(t)?e.set(n.getKey(),t.offset,`text`):Gg(t)?H(n)?e.set(n.getKey(),Xg(n,r),`text`):e.set(n.getParentOrThrow().getKey(),n.getIndexWithinParent()+ +!!i,`element`):(Kg(t)&&G(n)||V(268),e.set(n.getKey(),i?0:n.getChildrenSize(),`element`))}function d_(e){let t=W(),n=U(t)?t:tm();return f_(n,e),Fh(n),n}function f_(e,t){u_(e.anchor,t.anchor),u_(e.focus,t.focus)}function p_(e){let{anchor:t,focus:n}=e,r=l_(t,`next`),i=l_(n,`next`),a=i_(r,i)<=0?`next`:`previous`;return n_(b_(r,a),b_(i,a))}function m_(e){let{direction:t,origin:n}=e,r=Jg(n,Bg(t)).getNodeAtCaret();return r?Jg(r,t):Qg(n.getParentOrThrow(),t)}function h_(e,t=`root`){let n=[e];for(let r=Kg(e)?e.getParentCaret(t):e.getSiblingCaret();r!==null;r=r.getParentCaret(t))n.push(m_(r));return n}function g_(e){return!!e&&e.origin.isAttached()}function __(e,t=`removeEmptySlices`){if(e.isCollapsed())return e;let n=`root`,r=`next`,i=t,a=x_(e,r),o=h_(a.anchor,n),s=h_(a.focus.getFlipped(),n),c=new Set,l=[];for(let e of a.iterNodeCarets(n))if(Kg(e))c.add(e.origin.getKey());else if(Gg(e)){let{origin:t}=e;G(t)&&!c.has(t.getKey())||l.push(t)}for(let e of l)e.remove();for(let e of a.getTextSlices()){if(!e)continue;let{origin:t}=e.caret,n=t.getTextContentSize(),a=m_(Jg(t,r)),c=t.getMode();if(Math.abs(e.distance)===n&&i===`removeEmptySlices`||c===`token`&&e.distance!==0)a.remove();else if(e.distance!==0){i=`removeEmptySlices`;let t=e.removeTextSlice(),n=e.caret.origin;if(c===`segmented`){let e=t.origin,n=Mp(e.getTextContent()).setStyle(e.getStyle()).setFormat(e.getFormat());a.replaceOrInsert(n),t=Yg(n,r,t.offset)}n.is(o[0].origin)&&(o[0]=t),n.is(s[0].origin)&&(s[0]=t.getFlipped())}}let u,d;for(let e of o)if(g_(e)){u=v_(e);break}for(let e of s)if(g_(e)){d=v_(e);break}let f=function(e,t,n){if(!e||!t)return null;let r=e.getParentAtCaret(),i=t.getParentAtCaret();if(!r||!i)return null;let a=r.getParents().reverse();a.push(r);let o=i.getParents().reverse();o.push(i);let s=Math.min(a.length,o.length),c;for(c=0;c<s&&a[c]===o[c];c++);let l=(e,t)=>{let n;for(let r=c;r<e.length;r++){let i=e[r];if(ug(i))return;!n&&t(i)&&(n=i)}return n},u=l(a,wg),d=u&&l(o,(e=>n.has(e.getKey())&&wg(e)));return u&&d?[u,d]:null}(u,d,c);if(f){let[e,t]=f;Qg(e,`previous`).splice(0,t.getChildren()),t.remove()}let p=[u,d,...o,...s].find(g_);if(p)return t_(b_(v_(p),e.direction));V(269,JSON.stringify(o.map((e=>e.origin.__key))))}function v_(e){let t=function(e){let t=e;for(;Kg(t);){let e=$g(t);if(!Kg(e))break;t=e}return t}(e.getLatest()),{direction:n}=t;if(H(t.origin))return Wg(t)?t:Yg(t.origin,n,n);let r=t.getAdjacentCaret();return Gg(r)&&H(r.origin)?Yg(r.origin,n,Bg(n)):t}function y_(e){return Wg(e)&&e.offset!==Xg(e.origin,e.direction)}function b_(e,t){return e.direction===t?e:e.getFlipped()}function x_(e,t){return e.direction===t?e:n_(b_(e.focus,t),b_(e.anchor,t))}function mee(e,t,n){let r=Qg(e,`next`);for(let e=0;e<t;e++){let e=r.getAdjacentCaret();if(e===null)break;r=e}return b_(r,n)}function hee(e){let{origin:t,offset:n,direction:r}=e;if(n===Xg(t,r))return e.getSiblingCaret();if(n===Xg(t,Bg(r)))return m_(e.getSiblingCaret());let[i]=t.splitText(n);return H(i)||V(281),b_(Jg(i,`next`),r)}function gee(e,t){return!0}function _ee(e,{$copyElementNode:t=dg,$splitTextPointCaretNext:n=hee,rootMode:r=`shadowRoot`,$shouldSplit:i=gee}={}){if(Wg(e))return n(e);let a=e.getParentCaret(r);if(a){let{origin:n}=a;if(Kg(e)&&(!n.canBeEmpty()||!i(n,`first`)))return m_(a);let r=function(e){let t=[];for(let n=e.getAdjacentCaret();n;n=n.getAdjacentCaret())t.push(n.origin);return t}(e);(r.length>0||n.canBeEmpty()&&i(n,`last`))&&a.insert(t(n).splice(0,0,r))}return a}function vee(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}var S_=new Map;function C_(e){let t={};if(!e)return t;let n=e.split(`;`);for(let e of n)if(e!==``){let[n,r]=e.split(/:([^]+)/);n&&r&&(t[n.trim()]=r.trim())}return t}function w_(e){let t=S_.get(e);return t===void 0&&(t=C_(e),S_.set(e,t)),t}function T_(e){let t=Eg().getElementByKey(e.getKey());if(t===null)return null;let n=t.ownerDocument.defaultView;return n===null?null:n.getComputedStyle(t)}function E_(e){return T_(Wm(e)?e:e.getParentOrThrow())}function D_(e){let t=E_(e);return t!==null&&t.direction===`rtl`}function O_(e,t){let n=e.getStartEndPoints();if(t.isSelected(e)&&!_h(t)&&n!==null){let[r,i]=n,a=e.isBackward(),o=r.getNode(),s=i.getNode(),c=t.is(o),l=t.is(s);if(c||l){let[n,r]=Gp(e),i=o.is(s),c=t.is(a?s:o),l=t.is(a?o:s),u,d=0;i?(d=n>r?r:n,u=n>r?n:r):c?(d=a?r:n,u=void 0):l&&(d=0,u=a?n:r),t.__text=t.__text.slice(d,u)}}return t}function k_(e){if(e.type===`text`)return e.offset===e.getNode().getTextContentSize();let t=e.getNode();return G(t)||vee(177),e.offset===t.getChildrenSize()}function yee(e){let t=e.getStyle(),n=C_(t);S_.set(t,n)}function bee(e,t){let n=e.getFormatType(),r=e.getIndent();n!==t.getFormatType()&&t.setFormat(n),r!==t.getIndent()&&t.setIndent(r)}function xee(e,t,n=bee){if(e===null)return;let r=e.getStartEndPoints(),i=new Map,a=null;if(r){let[e,t]=r;a=tm(),a.anchor.set(e.key,e.offset,e.type),a.focus.set(t.key,t.offset,t.type);let n=F_(e.getNode(),wg),o=F_(t.getNode(),wg);G(n)&&i.set(n.getKey(),n),G(o)&&i.set(o.getKey(),o)}for(let t of e.getNodes())if(G(t)&&wg(t))i.set(t.getKey(),t);else if(r===null){let e=F_(t,wg);G(e)&&i.set(e.getKey(),e)}for(let[e,r]of i){let i=t();n(r,i),r.replace(i,!0),a&&(e===a.anchor.key&&a.anchor.set(i.getKey(),a.anchor.offset,a.anchor.type),e===a.focus.key&&a.focus.set(i.getKey(),a.focus.offset,a.focus.type))}a&&e.is(W())&&Fh(a)}function A_(e){let t=j_(e);return t!==null&&t.writingMode===`vertical-rl`}function j_(e){let t=e.anchor.getNode();return G(t)?T_(t):E_(t)}function M_(e,t){let n=A_(e)?!t:t;N_(e)&&(n=!n);let r=l_(e.focus,n?`previous`:`next`);if(y_(r))return!1;for(let e of e_(r)){if(Kg(e))return!e.origin.isInline();if(!G(e.origin)){if(Hm(e.origin))return!0;break}}return!1}function See(e,t,n,r){e.modify(t?`extend`:`move`,n,r)}function N_(e){let t=j_(e);return t!==null&&t.direction===`rtl`}function P_(e,t,n){let r=N_(e),i;i=A_(e)||r?!n:n,See(e,t,i,`character`)}function F_(e,t){let n=e;for(;n!==null&&n.getParent()!==null&&!t(n);)n=n.getParentOrThrow();return t(n)?n:null}function I_(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}var L_=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0,Cee=L_&&`documentMode`in document?document.documentMode:null;L_&&/Mac|iPod|iPhone|iPad/.test(navigator.platform);var wee=L_&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent);!(!L_||!(`InputEvent`in window)||Cee)&&`getTargetRanges`in new window.InputEvent(`input`),L_&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),L_&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&window.MSStream,L_&&/Android/.test(navigator.userAgent),L_&&/^(?=.*Chrome).*/i.test(navigator.userAgent),L_&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent);function R_(...e){let t=[];for(let n of e)if(n&&typeof n==`string`)for(let[e]of n.matchAll(/\S+/g))t.push(e);return t}function z_(...e){return()=>{for(let t=e.length-1;t>=0;t--)e[t]();e.length=0}}var Tee=L_,Eee=wee;function B_(e,...t){let n=R_(...t);n.length>0&&e.classList.add(...n)}function V_(e,...t){let n=R_(...t);n.length>0&&e.classList.remove(...n)}function Dee(e){return e?e.getAdjacentCaret():null}function H_(e,t){let n=e;for(;n!=null;){if(n instanceof t)return n;n=n.getParent()}return null}function U_(e){let t=W_(e,(e=>G(e)&&!e.isInline()));return G(t)||I_(4,e.__key),t}var W_=(e,t)=>{let n=e;for(;n!==Nh()&&n!=null;){if(t(n))return n;n=n.getParent()}return null};function G_(e){let t=W()||im(),n;if(U(t))n=l_(t.focus,`next`);else{if(t!=null){let e=t.getNodes(),r=e[e.length-1];r&&(n=Jg(r,`next`))}n||=Qg(Nh(),`previous`).getFlipped().insert($m())}let r=Oee(e,n),i=$g(r);return d_(t_(Kg(i)?v_(i):r)),e.getLatest()}function Oee(e,t,n){let r=b_(t,`next`);for(let e=r;e;e=_ee(e,n))r=e;return Wg(r)&&I_(283),r.insert(e.isInline()?$m().append(e):e),b_(Jg(e.getLatest(),`next`),t.direction)}function kee(e,t){let n=t();return e.replace(n),n.append(e),n}function K_(e,t){return e!==null&&Object.getPrototypeOf(e).constructor.name===t.name}function Aee(e,t){let n=[];for(let r=0;r<e.length;r++){let i=t(e[r]);i!==null&&n.push(i)}return n}var q_=!(Eee||!Tee)&&void 0;function jee(e){let t=1;if(function(){if(q_===void 0){let e=document.createElement(`div`);e.style.cssText=`position: absolute; opacity: 0; width: 100px; left: -1000px;`,document.body.appendChild(e);let t=e.getBoundingClientRect();e.style.setProperty(`zoom`,`2`),q_=e.getBoundingClientRect().width===t.width,document.body.removeChild(e)}return q_}())for(;e;)t*=Number(window.getComputedStyle(e).getPropertyValue(`zoom`)),e=e.parentElement;return t}var J_=0,Y_=1,X_=2,Z_=0,Mee=1,Q_=2,Nee=3,Pee=4;function Fee(e,t,n,r,i){if(e===null||n.size===0&&r.size===0&&!i)return Z_;let a=t._selection,o=e._selection;if(i)return Mee;if(!(U(a)&&U(o)&&o.isCollapsed()&&a.isCollapsed()))return Z_;let s=function(e,t,n){let r=e._nodeMap,i=[];for(let e of t){let t=r.get(e);t!==void 0&&i.push(t)}for(let[e,t]of n){if(!t)continue;let n=r.get(e);n===void 0||Wm(n)||i.push(n)}return i}(t,n,r);if(s.length===0)return Z_;if(s.length>1){let n=t._nodeMap,r=n.get(a.anchor.key),i=n.get(o.anchor.key);return r&&i&&!e._nodeMap.has(r.__key)&&H(r)&&r.__text.length===1&&a.anchor.offset===1?Q_:Z_}let c=s[0],l=e._nodeMap.get(c.__key);if(!H(l)||!H(c)||l.__mode!==c.__mode)return Z_;let u=l.__text,d=c.__text;if(u===d)return Z_;let f=a.anchor,p=o.anchor;if(f.key!==p.key||f.type!==`text`)return Z_;let m=f.offset,h=p.offset,g=d.length-u.length;return g===1&&h===m-1?Q_:g===-1&&h===m+1?Nee:g===-1&&h===m?Pee:Z_}function Iee(e,t){let n=Date.now(),r=Z_;return(i,a,o,s,c,l)=>{let u=Date.now();if(l.has(`historic`))return r=Z_,n=u,X_;let d=Fee(i,a,s,c,e.isComposing()),f=(()=>{let f=o===null||o.editor===e,p=l.has(Ym);if(!p&&f&&l.has(`history-merge`))return J_;if(i===null)return Y_;let m=a._selection;return s.size>0||c.size>0?!1===p&&d!==Z_&&d===r&&u<n+t&&f||s.size===1&&function(e,t,n){let r=t._nodeMap.get(e),i=n._nodeMap.get(e),a=t._selection,o=n._selection;return!(U(a)&&U(o)&&a.anchor.type===`element`&&a.focus.type===`element`&&o.anchor.type===`text`&&o.focus.type===`text`||!H(r)||!H(i)||r.__parent!==i.__parent)&&JSON.stringify(t.read((()=>r.exportJSON())))===JSON.stringify(n.read((()=>i.exportJSON())))}(Array.from(s)[0],i,a)?J_:Y_:m===null?X_:J_})();return n=u,r=d,f}}function $_(e){e.undoStack=[],e.redoStack=[],e.current=null}function Lee(e,t,n){let r=Iee(e,n);return z_(e.registerCommand(ef,(()=>(function(e,t){let n=t.redoStack,r=t.undoStack;if(r.length!==0){let i=t.current,a=r.pop();i!==null&&(n.push(i),e.dispatchCommand(kf,!0)),r.length===0&&e.dispatchCommand(Af,!1),t.current=a||null,a&&a.editor.setEditorState(a.editorState,{tag:`historic`})}}(e,t),!0)),0),e.registerCommand(tf,(()=>(function(e,t){let n=t.redoStack,r=t.undoStack;if(n.length!==0){let i=t.current;i!==null&&(r.push(i),e.dispatchCommand(Af,!0));let a=n.pop();n.length===0&&e.dispatchCommand(kf,!1),t.current=a||null,a&&a.editor.setEditorState(a.editorState,{tag:`historic`})}}(e,t),!0)),0),e.registerCommand(Df,(()=>($_(t),!1)),0),e.registerCommand(Of,(()=>($_(t),e.dispatchCommand(kf,!1),e.dispatchCommand(Af,!1),!0)),0),e.registerUpdateListener((({editorState:n,prevEditorState:i,dirtyLeaves:a,dirtyElements:o,tags:s})=>{let c=t.current,l=t.redoStack,u=t.undoStack,d=c===null?null:c.editorState;if(c!==null&&n===d)return;let f=r(i,n,c,a,o,s);if(f===Y_)l.length!==0&&(t.redoStack=[],e.dispatchCommand(kf,!1)),c!==null&&(u.push({...c}),e.dispatchCommand(Af,!0));else if(f===X_)return;t.current={editor:e,editorState:n}})))}function ev(){return{current:null,redoStack:[],undoStack:[]}}function tv({delay:e,externalHistoryState:t}){let[n]=Zl();return function(e,t,n=1e3){let r=(0,L.useMemo)((()=>t||ev()),[t]);(0,L.useEffect)((()=>Lee(e,r,n)),[n,e,r])}(n,t,e),null}function Ree(e,t){let n=t.body?t.body.childNodes:[],r=[],i=[];for(let t=0;t<n.length;t++){let a=n[t];if(!rv.has(a.nodeName)){let t=iv(a,e,i,!1);t!==null&&(r=r.concat(t))}}return function(e){for(let t of e)t.getNextSibling()instanceof Zm&&t.insertAfter(mp());for(let t of e){let e=t.getChildren();for(let n of e)t.insertBefore(n);t.remove()}}(i),r}function zee(e,t){if(typeof document>`u`||typeof window>`u`&&global.window===void 0)throw Error(`To use $generateHtmlFromNodes in headless mode please initialize a headless browser implementation such as JSDom before calling this function.`);let n=document.createElement(`div`),r=Nh().getChildren();for(let i=0;i<r.length;i++)nv(e,r[i],n,t);return n.innerHTML}function nv(e,t,n,r=null){let i=r===null||t.isSelected(r),a=G(t)&&t.excludeFromCopy(`html`),o=t;if(r!==null){let e=Ag(t);e=H(e)&&r!==null?O_(r,e):e,o=e}let s=G(o)?o.getChildren():[],c=ch(e,o.getType()),l;l=c&&c.exportDOM!==void 0?c.exportDOM(e,o):o.exportDOM(e);let{element:u,after:d}=l;if(!u)return!1;let f=document.createDocumentFragment();for(let n=0;n<s.length;n++){let a=s[n],o=nv(e,a,f,r);!i&&G(t)&&o&&t.extractWithChild(a,r,`html`)&&(i=!0)}if(i&&!a){if((yg(u)||xg(u))&&u.append(f),n.append(u),d){let e=d.call(o,u);e&&(xg(u)?u.replaceChildren(e):u.replaceWith(e))}}else n.append(f);return i}var rv=new Set([`STYLE`,`SCRIPT`]);function iv(e,t,n,r,i=new Map,a){let o=[];if(rv.has(e.nodeName))return o;let s=null,c=function(e,t){let{nodeName:n}=e,r=t._htmlConversions.get(n.toLowerCase()),i=null;if(r!==void 0)for(let t of r){let n=t(e);n!==null&&(i===null||(i.priority||0)<=(n.priority||0))&&(i=n)}return i===null?null:i.conversion}(e,t),l=c?c(e):null,u=null;if(l!==null){u=l.after;let t=l.node;if(s=Array.isArray(t)?t[t.length-1]:t,s!==null){for(let[,e]of i)if(s=e(s,a),!s)break;s&&o.push(...Array.isArray(t)?t:[s])}l.forChild!=null&&i.set(e.nodeName,l.forChild)}let d=e.childNodes,f=[],p=(s==null||!ug(s))&&(s!=null&&$p(s)||r);for(let e=0;e<d.length;e++)f.push(...iv(d[e],t,n,p,new Map(i),s));return u!=null&&(f=u(f)),Cg(e)&&(f=Bee(e,f,p?()=>{let e=new Zm;return n.push(e),e}:$m)),s==null?f.length>0?o=o.concat(f):Cg(e)&&function(e){return e.nextSibling==null||e.previousSibling==null?!1:Sg(e.nextSibling)&&Sg(e.previousSibling)}(e)&&(o=o.concat(mp())):G(s)&&s.append(...f),o}function Bee(e,t,n){let r=e.style.textAlign,i=[],a=[];for(let e=0;e<t.length;e++){let o=t[e];if($p(o))r&&!o.getFormat()&&o.setFormat(r),i.push(o);else if(a.push(o),e===t.length-1||e<t.length-1&&$p(t[e+1])){let e=n();e.setFormat(r),e.append(...a),i.push(e),a=[]}}return i}function av(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function Vee(e,t=W()){return t??av(166),U(t)&&t.isCollapsed()||t.getNodes().length===0?``:zee(e,t)}function Hee(e,t=W()){return t??av(166),U(t)&&t.isCollapsed()||t.getNodes().length===0?null:JSON.stringify(Uee(e,t))}function ov(e,t,n){let r=e.getData(`application/x-lexical-editor`);if(r)try{let e=JSON.parse(r);if(e.namespace===n._config.namespace&&Array.isArray(e.nodes))return sv(n,Wee(e.nodes),t)}catch{}let i=e.getData(`text/html`),a=e.getData(`text/plain`);if(i&&a!==i)try{return sv(n,Ree(n,new DOMParser().parseFromString(function(e){return window.trustedTypes&&window.trustedTypes.createPolicy?window.trustedTypes.createPolicy(`lexical`,{createHTML:e=>e}).createHTML(e):e}(i),`text/html`)),t)}catch{}let o=a||e.getData(`text/uri-list`);if(o!=null)if(U(t)){let e=o.split(/(\r?\n|\t)/);e[e.length-1]===``&&e.pop();for(let t=0;t<e.length;t++){let n=W();if(U(n)){let r=e[t];r===`
22
+ `||r===`\r
23
+ `?n.insertParagraph():r===` `?n.insertNodes([Fp()]):n.insertText(r)}}}else t.insertRawText(o)}function sv(e,t,n){e.dispatchCommand(Ud,{nodes:t,selection:n})||(n.insertNodes(t),function(e){if(U(e)&&e.isCollapsed()){let t=e.anchor,n=null,r=l_(t,`previous`);if(r)if(Wg(r))n=r.origin;else{let e=n_(r,Qg(Nh(),`next`).getFlipped());for(let t of e){if(H(t.origin)){n=t.origin;break}if(G(t.origin)&&!t.origin.isInline())break}}if(n&&H(n)){let t=n.getFormat(),r=n.getStyle();e.format===t&&e.style===r||(e.format=t,e.style=r,e.dirty=!0)}}}(n))}function cv(e,t,n,r=[]){let i=t===null||n.isSelected(t),a=G(n)&&n.excludeFromCopy(`html`),o=n;if(t!==null){let e=Ag(n);e=H(e)&&t!==null?O_(t,e):e,o=e}let s=G(o)?o.getChildren():[],c=function(e){let t=e.exportJSON(),n=e.constructor;if(t.type!==n.getType()&&av(58,n.name),G(e)){let e=t.children;Array.isArray(e)||av(59,n.name)}return t}(o);if(H(o)){let e=o.__text;e.length>0?c.text=e:i=!1}for(let r=0;r<s.length;r++){let a=s[r],o=cv(e,t,a,c.children);!i&&G(n)&&o&&n.extractWithChild(a,t,`clone`)&&(i=!0)}if(i&&!a)r.push(c);else if(Array.isArray(c.children))for(let e=0;e<c.children.length;e++){let t=c.children[e];r.push(t)}return i}function Uee(e,t){let n=[],r=Nh().getChildren();for(let i=0;i<r.length;i++)cv(e,t,r[i],n);return{namespace:e._config.namespace,nodes:n}}function Wee(e){let t=[];for(let n=0;n<e.length;n++){let r=e[n],i=eee(r);H(i)&&yee(i),t.push(i)}return t}var lv=null;async function uv(e,t,n){if(lv!==null)return!1;if(t!==null)return new Promise(((r,i)=>{e.update((()=>{r(dv(e,t,n))}))}));let r=e.getRootElement(),i=e._window||window,a=window.document,o=gg(i);if(r===null||o===null)return!1;let s=a.createElement(`span`);s.style.cssText=`position: fixed; top: -1000px;`,s.append(a.createTextNode(`#`)),r.append(s);let c=new Range;return c.setStart(s,0),c.setEnd(s,1),o.removeAllRanges(),o.addRange(c),new Promise(((t,r)=>{let i=e.registerCommand(wf,(r=>(K_(r,ClipboardEvent)&&(i(),lv!==null&&(window.clearTimeout(lv),lv=null),t(dv(e,r,n))),!0)),4);lv=window.setTimeout((()=>{i(),lv=null,t(!1)}),50),a.execCommand(`copy`),s.remove()}))}function dv(e,t,n){if(n===void 0){let t=gg(e._window);if(!t)return!1;let r=t.anchorNode,i=t.focusNode;if(r!==null&&i!==null&&!fh(e,r,i))return!1;let a=W();if(a===null)return!1;n=Kee(a)}t.preventDefault();let r=t.clipboardData;return r!==null&&(qee(r,n),!0)}var Gee=[[`text/html`,Vee],[`application/x-lexical-editor`,Hee]];function Kee(e=W()){let t={"text/plain":e?e.getTextContent():``};if(e){let n=Eg();for(let[r,i]of Gee){let a=i(n,e);a!==null&&(t[r]=a)}}return t}function qee(e,t){for(let n in t){let r=t[n];r!==void 0&&e.setData(n,r)}}function fv(e,t){if(document.caretRangeFromPoint!==void 0){let n=document.caretRangeFromPoint(e,t);return n===null?null:{node:n.startContainer,offset:n.startOffset}}if(document.caretPositionFromPoint!==`undefined`){let n=document.caretPositionFromPoint(e,t);return n===null?null:{node:n.offsetNode,offset:n.offset}}return null}var pv=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0,Jee=pv&&`documentMode`in document?document.documentMode:null,Yee=!(!pv||!(`InputEvent`in window)||Jee)&&`getTargetRanges`in new window.InputEvent(`input`),Xee=pv&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),mv=pv&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Zee=pv&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Qee=pv&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!Zee,hv=Vd(`DRAG_DROP_PASTE_FILE`),gv=class e extends zm{static getType(){return`quote`}static clone(t){return new e(t.__key)}createDOM(e){let t=document.createElement(`blockquote`);return B_(t,e.theme.quote),t}updateDOM(e,t){return!1}static importDOM(){return{blockquote:e=>({conversion:$ee,priority:0})}}exportDOM(e){let{element:t}=super.exportDOM(e);if(yg(t)){this.isEmpty()&&t.append(document.createElement(`br`));let e=this.getFormatType();e&&(t.style.textAlign=e);let n=this.getDirection();n&&(t.dir=n)}return{element:t}}static importJSON(e){return _v().updateFromJSON(e)}insertNewAfter(e,t){let n=$m(),r=this.getDirection();return n.setDirection(r),this.insertAfter(n,t),n}collapseAtStart(){let e=$m();return this.getChildren().forEach((t=>e.append(t))),this.replace(e),!0}canMergeWhenEmpty(){return!0}};function _v(){return fg(new gv)}function vv(e){return e instanceof gv}var yv=class e extends zm{static getType(){return`heading`}static clone(t){return new e(t.__tag,t.__key)}constructor(e,t){super(t),this.__tag=e}getTag(){return this.__tag}setTag(e){let t=this.getWritable();return this.__tag=e,t}createDOM(e){let t=this.__tag,n=document.createElement(t),r=e.theme.heading;if(r!==void 0){let e=r[t];B_(n,e)}return n}updateDOM(e,t,n){return e.__tag!==this.__tag}static importDOM(){return{h1:e=>({conversion:xv,priority:0}),h2:e=>({conversion:xv,priority:0}),h3:e=>({conversion:xv,priority:0}),h4:e=>({conversion:xv,priority:0}),h5:e=>({conversion:xv,priority:0}),h6:e=>({conversion:xv,priority:0}),p:e=>{let t=e.firstChild;return t!==null&&bv(t)?{conversion:()=>({node:null}),priority:3}:null},span:e=>bv(e)?{conversion:e=>({node:Sv(`h1`)}),priority:3}:null}}exportDOM(e){let{element:t}=super.exportDOM(e);if(yg(t)){this.isEmpty()&&t.append(document.createElement(`br`));let e=this.getFormatType();e&&(t.style.textAlign=e);let n=this.getDirection();n&&(t.dir=n)}return{element:t}}static importJSON(e){return Sv(e.tag).updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setTag(e.tag)}exportJSON(){return{...super.exportJSON(),tag:this.getTag()}}insertNewAfter(e,t=!0){let n=e?e.anchor.offset:0,r=this.getLastDescendant(),i=!r||e&&e.anchor.key===r.getKey()&&n===r.getTextContentSize()||!e?$m():Sv(this.getTag()),a=this.getDirection();if(i.setDirection(a),this.insertAfter(i,t),n===0&&!this.isEmpty()&&e){let e=$m();e.select(),this.replace(e,!0)}return i}collapseAtStart(){let e=this.isEmpty()?$m():Sv(this.getTag());return this.getChildren().forEach((t=>e.append(t))),this.replace(e),!0}extractWithChild(){return!0}};function bv(e){return e.nodeName.toLowerCase()===`span`&&e.style.fontSize===`26pt`}function xv(e){let t=e.nodeName.toLowerCase(),n=null;return t!==`h1`&&t!==`h2`&&t!==`h3`&&t!==`h4`&&t!==`h5`&&t!==`h6`||(n=Sv(t),e.style!==null&&(jg(e,n),n.setFormat(e.style.textAlign))),{node:n}}function $ee(e){let t=_v();return e.style!==null&&(t.setFormat(e.style.textAlign),jg(e,t)),{node:t}}function Sv(e=`h1`){return fg(new yv(e))}function Cv(e){return e instanceof yv}function wv(e){let t=null;if(K_(e,DragEvent)?t=e.dataTransfer:K_(e,ClipboardEvent)&&(t=e.clipboardData),t===null)return[!1,[],!1];let n=t.types,r=n.includes(`Files`),i=n.includes(`text/html`)||n.includes(`text/plain`);return[r,Array.from(t.files),i]}function Tv(e){let t=W();if(!U(t))return!1;let n=new Set,r=t.getNodes();for(let t=0;t<r.length;t++){let i=r[t],a=i.getKey();if(n.has(a))continue;let o=W_(i,(e=>G(e)&&!e.isInline()));if(o===null)continue;let s=o.getKey();o.canIndent()&&!n.has(s)&&(n.add(s),e(o))}return n.size>0}function Ev(e){return Hm(Ah(e))}function Dv(e){for(let t of[`lowercase`,`uppercase`,`capitalize`])e.hasFormat(t)&&e.toggleFormat(t)}function ete(e){return z_(e.registerCommand(Wd,(e=>{let t=W();return!!Up(t)&&(t.clear(),!0)}),0),e.registerCommand(Gd,(e=>{let t=W();return U(t)?(t.deleteCharacter(e),!0):!!Up(t)&&(t.deleteNodes(),!0)}),0),e.registerCommand(Zd,(e=>{let t=W();return!!U(t)&&(t.deleteWord(e),!0)}),0),e.registerCommand(Qd,(e=>{let t=W();return!!U(t)&&(t.deleteLine(e),!0)}),0),e.registerCommand(Jd,(t=>{let n=W();if(typeof t==`string`)n!==null&&n.insertText(t);else{if(n===null)return!1;let r=t.dataTransfer;if(r!=null)ov(r,n,e);else if(U(n)){let e=t.data;return e&&n.insertText(e),!0}}return!0}),0),e.registerCommand(Xd,(()=>{let e=W();return!!U(e)&&(e.removeText(),!0)}),0),e.registerCommand($d,(e=>{let t=W();return!!U(t)&&(t.formatText(e),!0)}),0),e.registerCommand(bf,(e=>{let t=W();if(!U(t)&&!Up(t))return!1;let n=t.getNodes();for(let t of n){let n=W_(t,(e=>G(e)&&!e.isInline()));n!==null&&n.setFormat(e)}return!0}),0),e.registerCommand(Kd,(e=>{let t=W();return!!U(t)&&(t.insertLineBreak(e),!0)}),0),e.registerCommand(qd,(()=>{let e=W();return!!U(e)&&(e.insertParagraph(),!0)}),0),e.registerCommand(gf,(()=>(dm([Fp()]),!0)),0),e.registerCommand(_f,(()=>Tv((e=>{let t=e.getIndent();e.setIndent(t+1)}))),0),e.registerCommand(vf,(()=>Tv((e=>{let t=e.getIndent();t>0&&e.setIndent(Math.max(0,t-1))}))),0),e.registerCommand(cf,(e=>{let t=W();if(Up(t)){let e=t.getNodes();if(e.length>0)return e[0].selectPrevious(),!0}else if(U(t)){let n=$h(t.focus,!0);if(!e.shiftKey&&Hm(n)&&!n.isIsolated()&&!n.isInline())return n.selectPrevious(),e.preventDefault(),!0}return!1}),0),e.registerCommand(lf,(e=>{let t=W();if(Up(t)){let e=t.getNodes();if(e.length>0)return e[0].selectNext(0,0),!0}else if(U(t)){if(function(e){let t=e.focus;return t.key===`root`&&t.offset===Nh().getChildrenSize()}(t))return e.preventDefault(),!0;let n=$h(t.focus,!1);if(!e.shiftKey&&Hm(n)&&!n.isIsolated()&&!n.isInline())return n.selectNext(),e.preventDefault(),!0}return!1}),0),e.registerCommand(of,(e=>{let t=W();if(Up(t)){let n=t.getNodes();if(n.length>0)return e.preventDefault(),D_(n[0])?n[0].selectNext(0,0):n[0].selectPrevious(),!0}if(!U(t))return!1;if(M_(t,!0)){let n=e.shiftKey;return e.preventDefault(),P_(t,n,!0),!0}return!1}),0),e.registerCommand(rf,(e=>{let t=W();if(Up(t)){let n=t.getNodes();if(n.length>0)return e.preventDefault(),D_(n[0])?n[0].selectPrevious():n[0].selectNext(0,0),!0}if(!U(t))return!1;let n=e.shiftKey;return!!M_(t,!1)&&(e.preventDefault(),P_(t,n,!1),!0)}),0),e.registerCommand(ff,(t=>{if(Ev(t.target))return!1;let n=W();if(U(n)){if(function(e){if(!e.isCollapsed())return!1;let{anchor:t}=e;if(t.offset!==0)return!1;let n=t.getNode();if(Wm(n))return!1;let r=U_(n);return r.getIndent()>0&&(r.is(n)||n.is(r.getFirstDescendant()))}(n))return t.preventDefault(),e.dispatchCommand(vf,void 0);if(mv&&navigator.language===`ko-KR`)return!1}else if(!Up(n))return!1;return t.preventDefault(),e.dispatchCommand(Gd,!0)}),0),e.registerCommand(mf,(t=>{if(Ev(t.target))return!1;let n=W();return!(!U(n)&&!Up(n))&&(t.preventDefault(),e.dispatchCommand(Gd,!1))}),0),e.registerCommand(uf,(t=>{let n=W();if(!U(n))return!1;if(Dv(n),t!==null){if((mv||Xee||Qee)&&Yee)return!1;if(t.preventDefault(),t.shiftKey)return e.dispatchCommand(Kd,!1)}return e.dispatchCommand(qd,void 0)}),0),e.registerCommand(pf,(()=>!!U(W())&&(e.blur(),!0)),0),e.registerCommand(yf,(t=>{let[,n]=wv(t);if(n.length>0){let r=fv(t.clientX,t.clientY);if(r!==null){let{offset:t,node:i}=r,a=Ah(i);if(a!==null){let e=tm();if(H(a))e.anchor.set(a.getKey(),t,`text`),e.focus.set(a.getKey(),t,`text`);else{let t=a.getParentOrThrow().getKey(),n=a.getIndexWithinParent()+1;e.anchor.set(t,n,`element`),e.focus.set(t,n,`element`)}Fh(ad(e))}e.dispatchCommand(hv,n)}return t.preventDefault(),!0}return!!U(W())}),0),e.registerCommand(xf,(e=>{let[t]=wv(e),n=W();return!(t&&!U(n))}),0),e.registerCommand(Sf,(e=>{let[t]=wv(e),n=W();if(t&&!U(n))return!1;let r=fv(e.clientX,e.clientY);return r!==null&&Hm(Ah(r.node))&&e.preventDefault(),!0}),0),e.registerCommand(Ef,(()=>(aee(),!0)),0),e.registerCommand(wf,(t=>(uv(e,K_(t,ClipboardEvent)?t:null),!0)),0),e.registerCommand(Tf,(t=>(async function(e,t){await uv(t,K_(e,ClipboardEvent)?e:null),t.update((()=>{let e=W();U(e)?e.removeText():Up(e)&&e.getNodes().forEach((e=>e.remove()))}))}(t,e),!0)),0),e.registerCommand(Yd,(t=>{let[,n,r]=wv(t);return n.length>0&&!r?(e.dispatchCommand(hv,n),!0):bg(t.target)&&dh(t.target)?!1:W()!==null&&(function(e,t){e.preventDefault(),t.update((()=>{let n=W(),r=K_(e,InputEvent)||K_(e,KeyboardEvent)?null:e.clipboardData;r!=null&&n!==null&&ov(r,n,t)}),{tag:`paste`})}(t,e),!0)}),0),e.registerCommand(df,(e=>{let t=W();return U(t)&&Dv(t),!1}),0),e.registerCommand(hf,(e=>{let t=W();return U(t)&&Dv(t),!1}),0))}function Ov(e,t,n,r){let i=e.length,a=0,o;if(t=t<0?-t>i?0:i+t:t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);a<r.length;)o=r.slice(a,a+1e4),o.unshift(t,0),e.splice(...o),a+=1e4,t+=1e4}function kv(e,t){return e.length>0?(Ov(e,e.length,0,t),e):t}var Av=zv(/[A-Za-z]/),jv=zv(/[\dA-Za-z]/),tte=zv(/[#-'*+\--9=?A-Z^-~]/);function Mv(e){return e!==null&&(e<32||e===127)}var Nv=zv(/\d/),nte=zv(/[\dA-Fa-f]/),rte=zv(/[!-/:-@[-`{-~]/);function Pv(e){return e!==null&&e<-2}function Fv(e){return e!==null&&(e<0||e===32)}function Iv(e){return e===-2||e===-1||e===32}var Lv=zv(/\p{P}|\p{S}/u),Rv=zv(/\s/);function zv(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function Bv(e){if(e===null||Fv(e)||Rv(e))return 1;if(Lv(e))return 2}function Vv(e,t,n){let r=[],i=-1;for(;++i<e.length;){let a=e[i].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}function Hv(e){let t=(e||{}).singleTilde,n={name:`strikethrough`,tokenize:i,resolveAll:r};return t??=!0,{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}};function r(e,t){let n=-1;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`strikethroughSequenceTemporary`&&e[n][1]._close){let r=n;for(;r--;)if(e[r][0]===`exit`&&e[r][1].type===`strikethroughSequenceTemporary`&&e[r][1]._open&&e[n][1].end.offset-e[n][1].start.offset===e[r][1].end.offset-e[r][1].start.offset){e[n][1].type=`strikethroughSequence`,e[r][1].type=`strikethroughSequence`;let i={type:`strikethrough`,start:Object.assign({},e[r][1].start),end:Object.assign({},e[n][1].end)},a={type:`strikethroughText`,start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},o=[[`enter`,i,t],[`enter`,e[r][1],t],[`exit`,e[r][1],t],[`enter`,a,t]],s=t.parser.constructs.insideSpan.null;s&&Ov(o,o.length,0,Vv(s,e.slice(r+1,n),t)),Ov(o,o.length,0,[[`exit`,a,t],[`enter`,e[n][1],t],[`exit`,e[n][1],t],[`exit`,i,t]]),Ov(e,r-1,n-r+3,o),n=r+o.length-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`strikethroughSequenceTemporary`&&(e[n][1].type=`data`);return e}function i(e,n,r){let i=this.previous,a=this.events,o=0;return s;function s(t){return i===126&&a[a.length-1][1].type!==`characterEscape`?r(t):(e.enter(`strikethroughSequenceTemporary`),c(t))}function c(a){let s=Bv(i);if(a===126)return o>1?r(a):(e.consume(a),o++,c);if(o<2&&!t)return r(a);let l=e.exit(`strikethroughSequenceTemporary`),u=Bv(a);return l._open=!u||u===2&&!!s,l._close=!s||s===2&&!!u,n(a)}}}var ite=[`autolink`,`destinationLiteral`,`destinationRaw`,`reference`,`titleQuote`,`titleApostrophe`];Gv.peek=ste;function Uv(){return{canContainEols:[`delete`],enter:{strikethrough:ate},exit:{strikethrough:ote}}}function Wv(){return{unsafe:[{character:`~`,inConstruct:`phrasing`,notInConstruct:ite}],handlers:{delete:Gv}}}function ate(e){this.enter({type:`delete`,children:[]},e)}function ote(e){this.exit(e)}function Gv(e,t,n,r){let i=n.createTracker(r),a=n.enter(`strikethrough`),o=i.move(`~~`);return o+=n.containerPhrasing(e,{...i.current(),before:o,after:`~`}),o+=i.move(`~~`),a(),o}function ste(){return`~`}Kv.peek=pte;var cte=[`autolink`,`destinationLiteral`,`destinationRaw`,`reference`,`titleQuote`,`titleApostrophe`],lte={canContainEols:[`highlight`],enter:{highlight:ute},exit:{highlight:dte}};function ute(e){this.enter({type:`highlight`,children:[]},e)}function dte(e){this.exit(e)}var fte={unsafe:[{character:`=`,inConstruct:`phrasing`,notInConstruct:cte}],handlers:{highlight:Kv}};function Kv(e,t,n,r){let i=n.createTracker(r),a=n.enter(`highlight`),o=i.move(`==`);return o+=i.move(n.containerPhrasing(e,{before:o,after:`=`,...i.current()})),o+=i.move(`==`),a(),o}function pte(){return`=`}function qv(e,t){let n=String(e);if(typeof t!=`string`)throw TypeError(`Expected character`);let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}var mte=`AElig.AMP.Aacute.Acirc.Agrave.Aring.Atilde.Auml.COPY.Ccedil.ETH.Eacute.Ecirc.Egrave.Euml.GT.Iacute.Icirc.Igrave.Iuml.LT.Ntilde.Oacute.Ocirc.Ograve.Oslash.Otilde.Ouml.QUOT.REG.THORN.Uacute.Ucirc.Ugrave.Uuml.Yacute.aacute.acirc.acute.aelig.agrave.amp.aring.atilde.auml.brvbar.ccedil.cedil.cent.copy.curren.deg.divide.eacute.ecirc.egrave.eth.euml.frac12.frac14.frac34.gt.iacute.icirc.iexcl.igrave.iquest.iuml.laquo.lt.macr.micro.middot.nbsp.not.ntilde.oacute.ocirc.ograve.ordf.ordm.oslash.otilde.ouml.para.plusmn.pound.quot.raquo.reg.sect.shy.sup1.sup2.sup3.szlig.thorn.times.uacute.ucirc.ugrave.uml.uuml.yacute.yen.yuml`.split(`.`),Jv={0:`�`,128:`€`,130:`‚`,131:`ƒ`,132:`„`,133:`…`,134:`†`,135:`‡`,136:`ˆ`,137:`‰`,138:`Š`,139:`‹`,140:`Œ`,142:`Ž`,145:`‘`,146:`’`,147:`“`,148:`”`,149:`•`,150:`–`,151:`—`,152:`˜`,153:`™`,154:`š`,155:`›`,156:`œ`,158:`ž`,159:`Ÿ`};function Yv(e){let t=typeof e==`string`?e.charCodeAt(0):e;return t>=48&&t<=57}function hte(e){let t=typeof e==`string`?e.charCodeAt(0):e;return t>=97&&t<=102||t>=65&&t<=70||t>=48&&t<=57}function gte(e){let t=typeof e==`string`?e.charCodeAt(0):e;return t>=97&&t<=122||t>=65&&t<=90}function Xv(e){return gte(e)||Yv(e)}var Zv=document.createElement(`i`);function Qv(e){let t=`&`+e+`;`;Zv.innerHTML=t;let n=Zv.textContent;return n.charCodeAt(n.length-1)===59&&e!==`semi`||n===t?!1:n}var $v=[``,`Named character references must be terminated by a semicolon`,`Numeric character references must be terminated by a semicolon`,`Named character references cannot be empty`,`Numeric character references cannot be empty`,`Named character references must be known`,`Numeric character references cannot be disallowed`,`Numeric character references cannot be outside the permissible Unicode range`];function ey(e,t){let n=t||{},r=typeof n.additional==`string`?n.additional.charCodeAt(0):n.additional,i=[],a=0,o=-1,s=``,c,l;n.position&&(`start`in n.position||`indent`in n.position?(l=n.position.indent,c=n.position.start):c=n.position);let u=(c?c.line:0)||1,d=(c?c.column:0)||1,f=m(),p;for(a--;++a<=e.length;)if(p===10&&(d=(l?l[o]:0)||1),p=e.charCodeAt(a),p===38){let t=e.charCodeAt(a+1);if(t===9||t===10||t===12||t===32||t===38||t===60||Number.isNaN(t)||r&&t===r){s+=String.fromCharCode(p),d++;continue}let o=a+1,c=o,l=o,u;if(t===35){l=++c;let t=e.charCodeAt(l);t===88||t===120?(u=`hexadecimal`,l=++c):u=`decimal`}else u=`named`;let _=``,v=``,y=``,b=u===`named`?Xv:u===`decimal`?Yv:hte;for(l--;++l<=e.length;){let t=e.charCodeAt(l);if(!b(t))break;y+=String.fromCharCode(t),u===`named`&&mte.includes(y)&&(_=y,v=Qv(y))}let x=e.charCodeAt(l)===59;if(x){l++;let e=u===`named`?Qv(y):!1;e&&(_=y,v=e)}let S=1+l-o,C=``;if(!(!x&&n.nonTerminated===!1))if(!y)u!==`named`&&h(4,S);else if(u===`named`){if(x&&!v)h(5,1);else if(_!==y&&(l=c+_.length,S=1+l-c,x=!1),!x){let t=_?1:3;if(n.attribute){let n=e.charCodeAt(l);n===61?(h(t,S),v=``):Xv(n)?v=``:h(t,S)}else h(t,S)}C=v}else{x||h(2,S);let e=Number.parseInt(y,u===`hexadecimal`?16:10);if(ty(e))h(7,S),C=`�`;else if(e in Jv)h(6,S),C=Jv[e];else{let t=``;ny(e)&&h(6,S),e>65535&&(e-=65536,t+=String.fromCharCode(e>>>10|55296),e=56320|e&1023),C=t+String.fromCharCode(e)}}if(C){g(),f=m(),a=l-1,d+=l-o+1,i.push(C);let t=m();t.offset++,n.reference&&n.reference.call(n.referenceContext||void 0,C,{start:f,end:t},e.slice(o-1,l)),f=t}else y=e.slice(o-1,l),s+=y,d+=y.length,a=l-1}else p===10&&(u++,o++,d=0),Number.isNaN(p)?g():(s+=String.fromCharCode(p),d++);return i.join(``);function m(){return{line:u,column:d,offset:a+((c?c.offset:0)||0)}}function h(e,t){let r;n.warning&&(r=m(),r.column+=t,r.offset+=t,n.warning.call(n.warningContext||void 0,$v[e],r,e))}function g(){s&&=(i.push(s),n.text&&n.text.call(n.textContext||void 0,s,{start:f,end:m()}),``)}}function ty(e){return e>=55296&&e<=57343||e>1114111}function ny(e){return e>=1&&e<=8||e===11||e>=13&&e<=31||e>=127&&e<=159||e>=64976&&e<=65007||(e&65535)==65535||(e&65535)==65534}var ry=/["&'<>`]/g,iy=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,ay=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,oy=/[|\\{}()[\]^$+*?.]/g,sy=new WeakMap;function cy(e,t){if(e=e.replace(t.subset?ly(t.subset):ry,r),t.subset||t.escapeOnly)return e;return e.replace(iy,n).replace(ay,r);function n(e,n,r){return t.format((e.charCodeAt(0)-55296)*1024+e.charCodeAt(1)-56320+65536,r.charCodeAt(n+2),t)}function r(e,n,r){return t.format(e.charCodeAt(0),r.charCodeAt(n+1),t)}}function ly(e){let t=sy.get(e);return t||(t=uy(e),sy.set(e,t)),t}function uy(e){let t=[],n=-1;for(;++n<e.length;)t.push(e[n].replace(oy,`\\$&`));return RegExp(`(?:`+t.join(`|`)+`)`,`g`)}function dy(e){return`&#x`+e.toString(16).toUpperCase()+`;`}function fy(e,t){return cy(e,Object.assign({format:dy},t))}function py(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?hy(e.position):`start`in e||`end`in e?hy(e):`line`in e||`column`in e?my(e):``}function my(e){return gy(e&&e.line)+`:`+gy(e&&e.column)}function hy(e){return my(e&&e.start)+`-`+my(e&&e.end)}function gy(e){return e&&typeof e==`number`?e:1}var _y=class extends Error{constructor(e,t,n){super(),typeof t==`string`&&(n=t,t=void 0);let r=``,i={},a=!1;if(t&&(i=`line`in t&&`column`in t||`start`in t&&`end`in t?{place:t}:`type`in t?{ancestors:[t],place:t.position}:{...t}),typeof e==`string`?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof n==`string`){let e=n.indexOf(`:`);e===-1?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){let e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}let o=i.place&&`start`in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file=``,this.message=r,this.line=o?o.line:void 0,this.name=py(i.place)||`1:1`,this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack==`string`?i.cause.stack:``,this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};_y.prototype.file=``,_y.prototype.name=``,_y.prototype.reason=``,_y.prototype.message=``,_y.prototype.stack=``,_y.prototype.column=void 0,_y.prototype.line=void 0,_y.prototype.ancestors=void 0,_y.prototype.cause=void 0,_y.prototype.fatal=void 0,_y.prototype.place=void 0,_y.prototype.ruleId=void 0,_y.prototype.source=void 0;var vy=` `;function _te(){return{canContainEols:[`mdxJsxTextElement`],enter:{mdxJsxFlowTag:r,mdxJsxFlowTagClosingMarker:i,mdxJsxFlowTagAttribute:d,mdxJsxFlowTagExpressionAttribute:f,mdxJsxFlowTagAttributeValueLiteral:e,mdxJsxFlowTagAttributeValueExpression:e,mdxJsxFlowTagSelfClosingMarker:o,mdxJsxTextTag:r,mdxJsxTextTagClosingMarker:i,mdxJsxTextTagAttribute:d,mdxJsxTextTagExpressionAttribute:f,mdxJsxTextTagAttributeValueLiteral:e,mdxJsxTextTagAttributeValueExpression:e,mdxJsxTextTagSelfClosingMarker:o},exit:{mdxJsxFlowTagClosingMarker:s,mdxJsxFlowTagNamePrimary:c,mdxJsxFlowTagNameMember:l,mdxJsxFlowTagNameLocal:u,mdxJsxFlowTagExpressionAttribute:p,mdxJsxFlowTagExpressionAttributeValue:n,mdxJsxFlowTagAttributeNamePrimary:m,mdxJsxFlowTagAttributeNameLocal:h,mdxJsxFlowTagAttributeValueLiteral:g,mdxJsxFlowTagAttributeValueLiteralValue:n,mdxJsxFlowTagAttributeValueExpression:_,mdxJsxFlowTagAttributeValueExpressionValue:n,mdxJsxFlowTagSelfClosingMarker:v,mdxJsxFlowTag:y,mdxJsxTextTagClosingMarker:s,mdxJsxTextTagNamePrimary:c,mdxJsxTextTagNameMember:l,mdxJsxTextTagNameLocal:u,mdxJsxTextTagExpressionAttribute:p,mdxJsxTextTagExpressionAttributeValue:n,mdxJsxTextTagAttributeNamePrimary:m,mdxJsxTextTagAttributeNameLocal:h,mdxJsxTextTagAttributeValueLiteral:g,mdxJsxTextTagAttributeValueLiteralValue:n,mdxJsxTextTagAttributeValueExpression:_,mdxJsxTextTagAttributeValueExpressionValue:n,mdxJsxTextTagSelfClosingMarker:v,mdxJsxTextTag:y}};function e(){this.buffer()}function t(e){return{line:e.line,column:e.column,offset:e.offset}}function n(e){this.config.enter.data.call(this,e),this.config.exit.data.call(this,e)}function r(e){let t={name:void 0,attributes:[],close:!1,selfClosing:!1,start:e.start,end:e.end};this.data.mdxJsxTagStack||(this.data.mdxJsxTagStack=[]),this.data.mdxJsxTag=t,this.buffer()}function i(e){if(this.data.mdxJsxTagStack.length===0)throw new _y("Unexpected closing slash `/` in tag, expected an open tag first",{start:e.start,end:e.end},`mdast-util-mdx-jsx:unexpected-closing-slash`)}function a(e){if(this.data.mdxJsxTag.close)throw new _y(`Unexpected attribute in closing tag, expected the end of the tag`,{start:e.start,end:e.end},`mdast-util-mdx-jsx:unexpected-attribute`)}function o(e){if(this.data.mdxJsxTag.close)throw new _y("Unexpected self-closing slash `/` in closing tag, expected the end of the tag",{start:e.start,end:e.end},`mdast-util-mdx-jsx:unexpected-self-closing-slash`)}function s(){let e=this.data.mdxJsxTag;e.close=!0}function c(e){let t=this.data.mdxJsxTag;t.name=this.sliceSerialize(e)}function l(e){let t=this.data.mdxJsxTag;t.name+=`.`+this.sliceSerialize(e)}function u(e){let t=this.data.mdxJsxTag;t.name+=`:`+this.sliceSerialize(e)}function d(e){let n=this.data.mdxJsxTag;a.call(this,e),n.attributes.push({type:`mdxJsxAttribute`,name:``,value:null,position:{start:t(e.start),end:void 0}})}function f(e){let n=this.data.mdxJsxTag;a.call(this,e),n.attributes.push({type:`mdxJsxExpressionAttribute`,value:``,position:{start:t(e.start),end:void 0}}),this.buffer()}function p(e){let n=this.data.mdxJsxTag,r=n.attributes[n.attributes.length-1];r.type;let i=e.estree;r.value=this.resume(),r.position,r.position.end=t(e.end),i&&(r.data={estree:i})}function m(e){let n=this.data.mdxJsxTag,r=n.attributes[n.attributes.length-1];r.type,r.name=this.sliceSerialize(e),r.position,r.position.end=t(e.end)}function h(e){let n=this.data.mdxJsxTag,r=n.attributes[n.attributes.length-1];r.type,r.name+=`:`+this.sliceSerialize(e),r.position,r.position.end=t(e.end)}function g(e){let n=this.data.mdxJsxTag,r=n.attributes[n.attributes.length-1];r.value=ey(this.resume(),{nonTerminated:!1}),r.position,r.position.end=t(e.end)}function _(e){let n=this.data.mdxJsxTag,r=n.attributes[n.attributes.length-1];r.type;let i={type:`mdxJsxAttributeValueExpression`,value:this.resume()},a=e.estree;a&&(i.data={estree:a}),r.value=i,r.position,r.position.end=t(e.end)}function v(){let e=this.data.mdxJsxTag;e.selfClosing=!0}function y(e){let t=this.data.mdxJsxTag,n=this.data.mdxJsxTagStack,r=n[n.length-1];if(t.close&&r.name!==t.name)throw new _y("Unexpected closing tag `"+S(t)+"`, expected corresponding closing tag for `"+S(r)+"` ("+py(r)+`)`,{start:e.start,end:e.end},`mdast-util-mdx-jsx:end-tag-mismatch`);this.resume(),t.close?n.pop():this.enter({type:e.type===`mdxJsxTextTag`?`mdxJsxTextElement`:`mdxJsxFlowElement`,name:t.name||null,attributes:t.attributes,children:[]},e,b),t.selfClosing||t.close?this.exit(e,x):n.push(t)}function b(e,t){let n=this.data.mdxJsxTagStack,r=n[n.length-1],i=e?" before the end of `"+e.type+"`":``,a=e?{start:e.start,end:e.end}:void 0;throw new _y("Expected a closing tag for `"+S(r)+"` ("+py({start:t.start,end:t.end})+`)`+i,a,`mdast-util-mdx-jsx:end-tag-mismatch`)}function x(e,t){let n=this.data.mdxJsxTag;throw new _y("Expected the closing tag `"+S(n)+"` either after the end of `"+t.type+"` ("+py(t.end)+") or another opening tag after the start of `"+t.type+"` ("+py(t.start)+`)`,{start:e.start,end:e.end},`mdast-util-mdx-jsx:end-tag-mismatch`)}function S(e){return`<`+(e.close?`/`:``)+(e.name||``)+`>`}}function vte(e){let t=e||{},n=t.quote||`"`,r=t.quoteSmart||!1,i=t.tightSelfClosing||!1,a=t.printWidth||1/0,o=n===`"`?`'`:`"`;if(n!==`"`&&n!==`'`)throw Error("Cannot serialize attribute values with `"+n+"` for `options.quote`, expected `\"`, or `'`");return s.peek=bte,{handlers:{mdxJsxFlowElement:s,mdxJsxTextElement:s},unsafe:[{character:`<`,inConstruct:[`phrasing`]},{atBreak:!0,character:`<`}],fences:!0,resourceLink:!0};function s(e,t,s,c){let l=e.type===`mdxJsxFlowElement`,u=e.name?!e.children||e.children.length===0:!1,d=by(yy(s)),f=s.createTracker(c),p=s.createTracker(c),m=[],h=(l?d:``)+`<`+(e.name||``),g=s.enter(e.type);if(f.move(h),p.move(h),e.attributes&&e.attributes.length>0){if(!e.name)throw Error(`Cannot serialize fragment w/ attributes`);let t=-1;for(;++t<e.attributes.length;){let i=e.attributes[t],a;if(i.type===`mdxJsxExpressionAttribute`)a=`{`+(i.value||``)+`}`;else{if(!i.name)throw Error(`Cannot serialize attribute w/o name`);let e=i.value,t=i.name,s=``;if(e!=null)if(typeof e==`object`)s=`{`+(e.value||``)+`}`;else{let t=r&&qv(e,n)>qv(e,o)?o:n;s=t+fy(e,{subset:[t]})+t}a=t+(s?`=`:``)+s}m.push(a)}}let _=!1,v=m.join(` `);l&&(/\r?\n|\r/.test(v)||f.current().now.column+v.length+(u?i?2:3:1)>a)&&(_=!0);let y=f,b=h;if(_){y=p;let e=-1;for(;++e<m.length;)m[e]=d+vy+m[e];b+=y.move(`
24
+ `+m.join(`
25
+ `)+`
26
+ `+d)}else v&&(b+=y.move(` `+v));return u&&(b+=y.move((i||_?``:` `)+`/`)),b+=y.move(`>`),e.children&&e.children.length>0&&(e.type===`mdxJsxTextElement`?b+=y.move(s.containerPhrasing(e,{...y.current(),before:`>`,after:`<`})):(y.shift(2),b+=y.move(`
27
+ `),b+=y.move(yte(e,s,y.current())),b+=y.move(`
28
+ `))),u||(b+=y.move((l?d:``)+`</`+(e.name||``)+`>`)),g(),b}}function yte(e,t,n){let r=t.indexStack,i=e.children,a=t.createTracker(n),o=by(yy(t)),s=[],c=-1;for(r.push(-1);++c<i.length;){let n=i[c];r[r.length-1]=c;let l={before:`
29
+ `,after:`
30
+ `,...a.current()},u=t.handle(n,e,t,l),d=n.type===`mdxJsxFlowElement`?u:t.indentLines(u,function(e,t,n){return(n?``:o)+e});s.push(a.move(d)),n.type!==`list`&&(t.bulletLastUsed=void 0),c<i.length-1&&s.push(a.move(`
31
+
32
+ `))}return r.pop(),s.join(``)}function yy(e){let t=0,n=e.stack.length;for(;--n>-1;){let r=e.stack[n];if(r===`blockquote`||r===`listItem`)break;r===`mdxJsxFlowElement`&&t++}return t}function by(e){return vy.repeat(e)}function bte(){return`<`}var xy=Object.prototype.hasOwnProperty;function Sy(e,t,n){for(n of e.keys())if(Cy(n,t))return n}function Cy(e,t){var n,r,i;if(e===t)return!0;if(e&&t&&(n=e.constructor)===t.constructor){if(n===Date)return e.getTime()===t.getTime();if(n===RegExp)return e.toString()===t.toString();if(n===Array){if((r=e.length)===t.length)for(;r--&&Cy(e[r],t[r]););return r===-1}if(n===Set){if(e.size!==t.size)return!1;for(r of e)if(i=r,i&&typeof i==`object`&&(i=Sy(t,i),!i)||!t.has(i))return!1;return!0}if(n===Map){if(e.size!==t.size)return!1;for(r of e)if(i=r[0],i&&typeof i==`object`&&(i=Sy(t,i),!i)||!Cy(r[1],t.get(i)))return!1;return!0}if(n===ArrayBuffer)e=new Uint8Array(e),t=new Uint8Array(t);else if(n===DataView){if((r=e.byteLength)===t.byteLength)for(;r--&&e.getInt8(r)===t.getInt8(r););return r===-1}if(ArrayBuffer.isView(e)){if((r=e.byteLength)===t.byteLength)for(;r--&&e[r]===t[r];);return r===-1}if(!n||typeof e==`object`){for(n in r=0,e)if(xy.call(e,n)&&++r&&!xy.call(t,n)||!(n in t)||!Cy(e[n],t[n]))return!1;return Object.keys(t).length===r}}return e!==e&&t!==t}var wy,Ty,Ey,Dy,Oy=!0;typeof process<`u`&&({FORCE_COLOR:wy,NODE_DISABLE_COLORS:Ty,NO_COLOR:Ey,TERM:Dy}={},Oy=process.stdout&&process.stdout.isTTY);var ky={enabled:!Ty&&Ey==null&&Dy!==`dumb`&&(wy!=null&&wy!==`0`||Oy),reset:jy(0,0),bold:jy(1,22),dim:jy(2,22),italic:jy(3,23),underline:jy(4,24),inverse:jy(7,27),hidden:jy(8,28),strikethrough:jy(9,29),black:jy(30,39),red:jy(31,39),green:jy(32,39),yellow:jy(33,39),blue:jy(34,39),magenta:jy(35,39),cyan:jy(36,39),white:jy(37,39),gray:jy(90,39),grey:jy(90,39),bgBlack:jy(40,49),bgRed:jy(41,49),bgGreen:jy(42,49),bgYellow:jy(43,49),bgBlue:jy(44,49),bgMagenta:jy(45,49),bgCyan:jy(46,49),bgWhite:jy(47,49)};function Ay(e,t){let n=0,r,i=``,a=``;for(;n<e.length;n++)r=e[n],i+=r.open,a+=r.close,~t.indexOf(r.close)&&(t=t.replace(r.rgx,r.close+r.open));return i+t+a}function xte(e,t){let n={has:e,keys:t};return n.reset=ky.reset.bind(n),n.bold=ky.bold.bind(n),n.dim=ky.dim.bind(n),n.italic=ky.italic.bind(n),n.underline=ky.underline.bind(n),n.inverse=ky.inverse.bind(n),n.hidden=ky.hidden.bind(n),n.strikethrough=ky.strikethrough.bind(n),n.black=ky.black.bind(n),n.red=ky.red.bind(n),n.green=ky.green.bind(n),n.yellow=ky.yellow.bind(n),n.blue=ky.blue.bind(n),n.magenta=ky.magenta.bind(n),n.cyan=ky.cyan.bind(n),n.white=ky.white.bind(n),n.gray=ky.gray.bind(n),n.grey=ky.grey.bind(n),n.bgBlack=ky.bgBlack.bind(n),n.bgRed=ky.bgRed.bind(n),n.bgGreen=ky.bgGreen.bind(n),n.bgYellow=ky.bgYellow.bind(n),n.bgBlue=ky.bgBlue.bind(n),n.bgMagenta=ky.bgMagenta.bind(n),n.bgCyan=ky.bgCyan.bind(n),n.bgWhite=ky.bgWhite.bind(n),n}function jy(e,t){let n={open:`\x1b[${e}m`,close:`\x1b[${t}m`,rgx:RegExp(`\\x1b\\[${t}m`,`g`)};return function(t){return this!==void 0&&this.has!==void 0?(~this.has.indexOf(e)||(this.has.push(e),this.keys.push(n)),t===void 0?this:ky.enabled?Ay(this.keys,t+``):t+``):t===void 0?xte([e],[n]):ky.enabled?Ay([n],t+``):t+``}}function My(){}My.prototype={diff:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=n.callback;typeof n==`function`&&(r=n,n={}),this.options=n;var i=this;function a(e){return r?(setTimeout(function(){r(void 0,e)},0),!0):e}e=this.castInput(e),t=this.castInput(t),e=this.removeEmpty(this.tokenize(e)),t=this.removeEmpty(this.tokenize(t));var o=t.length,s=e.length,c=1,l=o+s;n.maxEditLength&&(l=Math.min(l,n.maxEditLength));var u=n.timeout??1/0,d=Date.now()+u,f=[{oldPos:-1,lastComponent:void 0}],p=this.extractCommon(f[0],t,e,0);if(f[0].oldPos+1>=s&&p+1>=o)return a([{value:this.join(t),count:t.length}]);var m=-1/0,h=1/0;function g(){for(var n=Math.max(m,-c);n<=Math.min(h,c);n+=2){var r=void 0,l=f[n-1],u=f[n+1];l&&(f[n-1]=void 0);var d=!1;if(u){var g=u.oldPos-n;d=u&&0<=g&&g<o}var _=l&&l.oldPos+1<s;if(!d&&!_){f[n]=void 0;continue}if(r=!_||d&&l.oldPos+1<u.oldPos?i.addToPath(u,!0,void 0,0):i.addToPath(l,void 0,!0,1),p=i.extractCommon(r,t,e,n),r.oldPos+1>=s&&p+1>=o)return a(Ste(i,r.lastComponent,t,e,i.useLongestToken));f[n]=r,r.oldPos+1>=s&&(h=Math.min(h,n-1)),p+1>=o&&(m=Math.max(m,n+1))}c++}if(r)(function e(){setTimeout(function(){if(c>l||Date.now()>d)return r();g()||e()},0)})();else for(;c<=l&&Date.now()<=d;){var _=g();if(_)return _}},addToPath:function(e,t,n,r){var i=e.lastComponent;return i&&i.added===t&&i.removed===n?{oldPos:e.oldPos+r,lastComponent:{count:i.count+1,added:t,removed:n,previousComponent:i.previousComponent}}:{oldPos:e.oldPos+r,lastComponent:{count:1,added:t,removed:n,previousComponent:i}}},extractCommon:function(e,t,n,r){for(var i=t.length,a=n.length,o=e.oldPos,s=o-r,c=0;s+1<i&&o+1<a&&this.equals(t[s+1],n[o+1]);)s++,o++,c++;return c&&(e.lastComponent={count:c,previousComponent:e.lastComponent}),e.oldPos=o,s},equals:function(e,t){return this.options.comparator?this.options.comparator(e,t):e===t||this.options.ignoreCase&&e.toLowerCase()===t.toLowerCase()},removeEmpty:function(e){for(var t=[],n=0;n<e.length;n++)e[n]&&t.push(e[n]);return t},castInput:function(e){return e},tokenize:function(e){return e.split(``)},join:function(e){return e.join(``)}};function Ste(e,t,n,r,i){for(var a=[],o;t;)a.push(t),o=t.previousComponent,delete t.previousComponent,t=o;a.reverse();for(var s=0,c=a.length,l=0,u=0;s<c;s++){var d=a[s];if(!d.removed){if(!d.added&&i){var f=n.slice(l,l+d.count);f=f.map(function(e,t){var n=r[u+t];return n.length>e.length?n:e}),d.value=e.join(f)}else d.value=e.join(n.slice(l,l+d.count));l+=d.count,d.added||(u+=d.count)}else if(d.value=e.join(r.slice(u,u+d.count)),u+=d.count,s&&a[s-1].added){var p=a[s-1];a[s-1]=a[s],a[s]=p}}var m=a[c-1];return c>1&&typeof m.value==`string`&&(m.added||m.removed)&&e.equals(``,m.value)&&(a[c-2].value+=m.value,a.pop()),a}var Cte=new My;function wte(e,t,n){return Cte.diff(e,t,n)}var Ny=/^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/,Py=/\S/,Fy=new My;Fy.equals=function(e,t){return this.options.ignoreCase&&(e=e.toLowerCase(),t=t.toLowerCase()),e===t||this.options.ignoreWhitespace&&!Py.test(e)&&!Py.test(t)},Fy.tokenize=function(e){for(var t=e.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/),n=0;n<t.length-1;n++)!t[n+1]&&t[n+2]&&Ny.test(t[n])&&Ny.test(t[n+2])&&(t[n]+=t[n+2],t.splice(n+1,2),n--);return t};var Iy=new My;Iy.tokenize=function(e){this.options.stripTrailingCr&&(e=e.replace(/\r\n/g,`
33
+ `));var t=[],n=e.split(/(\n|\r\n)/);n[n.length-1]||n.pop();for(var r=0;r<n.length;r++){var i=n[r];r%2&&!this.options.newlineIsToken?t[t.length-1]+=i:(this.options.ignoreWhitespace&&(i=i.trim()),t.push(i))}return t};function Tte(e,t,n){return Iy.diff(e,t,n)}var Ete=new My;Ete.tokenize=function(e){return e.split(/(\S.+?[.!?])(?=\s+|$)/)};var Dte=new My;Dte.tokenize=function(e){return e.split(/([{}:;,]|\s+)/)};function Ly(e){"@babel/helpers - typeof";return Ly=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},Ly(e)}var Ote=Object.prototype.toString,Ry=new My;Ry.useLongestToken=!0,Ry.tokenize=Iy.tokenize,Ry.castInput=function(e){var t=this.options,n=t.undefinedReplacement,r=t.stringifyReplacer,i=r===void 0?function(e,t){return t===void 0?n:t}:r;return typeof e==`string`?e:JSON.stringify(zy(e,null,null,i),i,` `)},Ry.equals=function(e,t){return My.prototype.equals.call(Ry,e.replace(/,([\r\n])/g,`$1`),t.replace(/,([\r\n])/g,`$1`))};function zy(e,t,n,r,i){t||=[],n||=[],r&&(e=r(i,e));var a;for(a=0;a<t.length;a+=1)if(t[a]===e)return n[a];var o;if(Ote.call(e)===`[object Array]`){for(t.push(e),o=Array(e.length),n.push(o),a=0;a<e.length;a+=1)o[a]=zy(e[a],t,n,r,i);return t.pop(),n.pop(),o}if(e&&e.toJSON&&(e=e.toJSON()),Ly(e)===`object`&&e!==null){t.push(e),o={},n.push(o);var s=[],c;for(c in e)e.hasOwnProperty(c)&&s.push(c);for(s.sort(),a=0;a<s.length;a+=1)c=s[a],o[c]=zy(e[c],t,n,r,c);t.pop(),n.pop()}else o=e;return o}var By=new My;By.tokenize=function(e){return e.slice()},By.join=By.removeEmpty=function(e){return e};function Vy(e,t,n){return By.diff(e,t,n)}var Hy={"--":ky.red,"··":ky.grey,"++":ky.green},Uy=ky.dim().italic,Wy=ky.dim(`→`),Gy=ky.dim(`·`),Ky=ky.dim(`↵`),qy=(e,t)=>Hy[e](e+Yy(t))+`
34
+ `,Jy=(e,t)=>ky.dim(`L`+String(e).padStart(t,`0`)+` `),Yy=e=>e.replace(/[ ]/g,Gy).replace(/\t/g,Wy).replace(/(\r?\n)/g,Ky);function Xy(e,t,n){let r=e.removed?`--`:e.added?`++`:`··`,i=e.value.replace(/\r?\n$/,``).split(`
35
+ `),a=0,o,s=``;for(e.added?s+=Hy[r]().underline(Uy(`Expected:`))+`
36
+ `:e.removed&&(s+=Hy[r]().underline(Uy(`Actual:`))+`
37
+ `);a<i.length;a++)o=i[a],o!=null&&(t&&(s+=Jy(t+a,n)),s+=qy(r,o||`
38
+ `));return s}function Zy(e,t){let n=Vy(e,t),r=0,i=0,a=0,o,s,c,l,u,d=qy(`··`,`[`);for(;r<n.length;r++)for(c=(o=n[r]).removed?`--`:o.added?`++`:`··`,o.added?d+=Hy[c]().underline(Uy(`Expected:`))+`
39
+ `:o.removed&&(d+=Hy[c]().underline(Uy(`Actual:`))+`
40
+ `),i=0;i<o.value.length;i++)for(l=o.value[i]&&typeof o.value[i]==`object`,s=rb(o.value[i]).split(/\r?\n/g),a=0;a<s.length;)u=` `+s[a++]+(l?``:`,`),l&&a===s.length&&i+1<o.value.length&&(u+=`,`),d+=qy(c,u);return d+qy(`··`,`]`)}function Qy(e,t,n=0){let r=0,i,a=``,o=Tte(e,t),s=String(t.split(/\r?\n/g).length-n).length;for(;r<o.length;r++)a+=Xy(i=o[r],n,s),n&&!i.removed&&(n+=i.count);return a}function $y(e,t){let n=wte(e,t),r=0,i=``,a,o=e.length,s=t.length,c=Yy(e),l=Yy(t);if(a=n[r],o!==s&&a.removed&&n[r+1]){let i=a.count-n[r+1].count;i==0||(i>0?(t=` `.repeat(i)+t,l=` `.repeat(i)+l,s+=i):i<0&&(e=` `.repeat(-i)+e,c=` `.repeat(-i)+c,o+=-i))}if(i+=eb(c,l,o,s),o===s)for(a=` `;r<o;r++)a+=e[r]===t[r]?` `:`^`;else for(a=` `;r<n.length;r++)a+=(n[r].added||n[r].removed?`^`:` `).repeat(Math.max(n[r].count,0)),r+1<n.length&&(n[r].added&&n[r+1].removed||n[r].removed&&n[r+1].added)&&(n[r+1].count-=n[r].count);return i+ky.red(a)}function eb(e,t,n=String(e).length,r=String(t).length){let i=4,a=Math.max(n,r),o=typeof e,s=typeof t;if(o!==s){i=2;let c=i+a-n,l=i+a-r;e+=` `.repeat(c)+ky.dim(`[${o}]`),t+=` `.repeat(l)+ky.dim(`[${s}]`),n+=c+o.length+2,r+=l+s.length+2,a=Math.max(n,r)}return Hy[`++`](`++`+t+` `.repeat(i+a-r)+Uy(`(Expected)`))+`
41
+ `+Hy[`--`](`--`+e+` `.repeat(i+a-n)+Uy(`(Actual)`))+`
42
+ `}function tb(e,t){var n,r=0,i,a=Array.isArray(e),o=[],s=a?Array(e.length):{};if(a)for(r=0;r<s.length;r++)i=e[r],!i||typeof i!=`object`?s[r]=i:s[r]=tb(i,t[r]);else{for(n in t)o.push(n);for(;r<o.length;r++)Object.prototype.hasOwnProperty.call(e,n=o[r])&&(!(i=e[n])||typeof i!=`object`?s[n]=i:s[n]=tb(i,t[n]));for(n in e)s.hasOwnProperty(n)||(s[n]=e[n])}return s}function nb(){var e=new Set;return function(t,n){return n===void 0?`[__VOID__]`:typeof n==`number`&&n!==n?`[__NAN__]`:typeof n==`bigint`?n.toString():!n||typeof n!=`object`?n:e.has(n)?`[Circular]`:(e.add(n),n)}}function rb(e){return JSON.stringify(e,nb(),2).replace(/"\[__NAN__\]"/g,`NaN`).replace(/"\[__VOID__\]"/g,`undefined`)}function ib(e,t){if(Array.isArray(t)&&Array.isArray(e))return Zy(e,t);if(t instanceof RegExp)return $y(``+e,``+t);let n=e&&typeof e==`object`,r=t&&typeof t==`object`;return n&&r&&(e=tb(e,t)),r&&(t=rb(t)),n&&(e=rb(e)),t&&typeof t==`object`&&(e=rb(tb(e,t)),t=rb(t)),n=typeof e==`string`,r=typeof t==`string`,n&&/\r?\n/.test(e)?Qy(e,``+t):r&&/\r?\n/.test(t)?Qy(``+e,t):n&&r?$y(e,t):eb(e,t)}function ab(e){e=e.replace(/\r?\n/g,`
43
+ `);let t=e.match(/^[ \t]*(?=\S)/gm),n=0,r=1/0,i=(t||[]).length;for(;n<i;n++)r=Math.min(r,t[n].length);return i&&r?e.replace(RegExp(`^[ \\t]{${r}}`,`gm`),``):e}var ob=class extends Error{constructor(e={}){super(e.message),this.name=`Assertion`,this.code=`ERR_ASSERTION`,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.details=e.details||!1,this.generated=!!e.generated,this.operator=e.operator,this.expects=e.expects,this.actual=e.actual}};function sb(e,t,n,r,i,a,o){if(e)return;let s=o||a;throw o instanceof Error?o:new ob({actual:t,expects:n,operator:r,message:s,details:i&&i(t,n),generated:!o})}function cb(e,t){sb(!!e,!1,!0,`ok`,!1,`Expected value to be truthy`,t)}function lb(e,t,n){sb(e===t,e,t,`is`,ib,`Expected values to be strictly equal:`,n)}function ub(e,t){sb(!e,!0,!1,`not`,!1,`Expected value to be falsey`,t)}ub.ok=ub,lb.not=function(e,t,n){sb(e!==t,e,t,`is.not`,!1,`Expected values not to be strictly equal`,n)},ub.equal=function(e,t,n){sb(!Cy(e,t),e,t,`not.equal`,!1,`Expected values not to be deeply equal`,n)},ub.type=function(e,t,n){let r=typeof e;sb(r!==t,r,t,`not.type`,!1,`Expected "${r}" not to be "${t}"`,n)},ub.instance=function(e,t,n){let r="`"+(t.name||t.constructor.name)+"`";sb(!(e instanceof t),e,t,`not.instance`,!1,`Expected value not to be an instance of ${r}`,n)},ub.snapshot=function(e,t,n){e=ab(e),t=ab(t),sb(e!==t,e,t,`not.snapshot`,!1,`Expected value not to match snapshot`,n)},ub.fixture=function(e,t,n){e=ab(e),t=ab(t),sb(e!==t,e,t,`not.fixture`,!1,`Expected value not to match fixture`,n)},ub.match=function(e,t,n){typeof t==`string`?sb(!e.includes(t),e,t,`not.match`,!1,`Expected value not to include "${t}" substring`,n):sb(!t.test(e),e,t,`not.match`,!1,`Expected value not to match \`${String(t)}\` pattern`,n)},ub.throws=function(e,t,n){!n&&typeof t==`string`&&(n=t,t=null);try{e()}catch(e){typeof t==`function`?sb(!t(e),!0,!1,`not.throws`,!1,`Expected function not to throw matching exception`,n):t instanceof RegExp?sb(!t.test(e.message),!0,!1,`not.throws`,!1,`Expected function not to throw exception matching \`${String(t)}\` pattern`,n):t||sb(!1,!0,!1,`not.throws`,!1,`Expected function not to throw`,n)}};var db={carriageReturn:-5,lineFeed:-4,carriageReturnLineFeed:-3,horizontalTab:-2,virtualSpace:-1,eof:null,nul:0,soh:1,stx:2,etx:3,eot:4,enq:5,ack:6,bel:7,bs:8,ht:9,lf:10,vt:11,ff:12,cr:13,so:14,si:15,dle:16,dc1:17,dc2:18,dc3:19,dc4:20,nak:21,syn:22,etb:23,can:24,em:25,sub:26,esc:27,fs:28,gs:29,rs:30,us:31,space:32,exclamationMark:33,quotationMark:34,numberSign:35,dollarSign:36,percentSign:37,ampersand:38,apostrophe:39,leftParenthesis:40,rightParenthesis:41,asterisk:42,plusSign:43,comma:44,dash:45,dot:46,slash:47,digit0:48,digit1:49,digit2:50,digit3:51,digit4:52,digit5:53,digit6:54,digit7:55,digit8:56,digit9:57,colon:58,semicolon:59,lessThan:60,equalsTo:61,greaterThan:62,questionMark:63,atSign:64,uppercaseA:65,uppercaseB:66,uppercaseC:67,uppercaseD:68,uppercaseE:69,uppercaseF:70,uppercaseG:71,uppercaseH:72,uppercaseI:73,uppercaseJ:74,uppercaseK:75,uppercaseL:76,uppercaseM:77,uppercaseN:78,uppercaseO:79,uppercaseP:80,uppercaseQ:81,uppercaseR:82,uppercaseS:83,uppercaseT:84,uppercaseU:85,uppercaseV:86,uppercaseW:87,uppercaseX:88,uppercaseY:89,uppercaseZ:90,leftSquareBracket:91,backslash:92,rightSquareBracket:93,caret:94,underscore:95,graveAccent:96,lowercaseA:97,lowercaseB:98,lowercaseC:99,lowercaseD:100,lowercaseE:101,lowercaseF:102,lowercaseG:103,lowercaseH:104,lowercaseI:105,lowercaseJ:106,lowercaseK:107,lowercaseL:108,lowercaseM:109,lowercaseN:110,lowercaseO:111,lowercaseP:112,lowercaseQ:113,lowercaseR:114,lowercaseS:115,lowercaseT:116,lowercaseU:117,lowercaseV:118,lowercaseW:119,lowercaseX:120,lowercaseY:121,lowercaseZ:122,leftCurlyBrace:123,verticalBar:124,rightCurlyBrace:125,tilde:126,del:127,byteOrderMarker:65279,replacementCharacter:65533},fb={attentionSideAfter:2,attentionSideBefore:1,atxHeadingOpeningFenceSizeMax:6,autolinkDomainSizeMax:63,autolinkSchemeSizeMax:32,cdataOpeningString:`CDATA[`,characterGroupPunctuation:2,characterGroupWhitespace:1,characterReferenceDecimalSizeMax:7,characterReferenceHexadecimalSizeMax:6,characterReferenceNamedSizeMax:31,codeFencedSequenceSizeMin:3,contentTypeContent:`content`,contentTypeDocument:`document`,contentTypeFlow:`flow`,contentTypeString:`string`,contentTypeText:`text`,hardBreakPrefixSizeMin:2,htmlBasic:6,htmlCdata:5,htmlComment:2,htmlComplete:7,htmlDeclaration:4,htmlInstruction:3,htmlRawSizeMax:8,htmlRaw:1,linkResourceDestinationBalanceMax:32,linkReferenceSizeMax:999,listItemValueSizeMax:10,numericBaseDecimal:10,numericBaseHexadecimal:16,tabSize:4,thematicBreakMarkerCountMin:3,v8MaxSafeChunkSize:1e4},pb={data:`data`,whitespace:`whitespace`,lineEnding:`lineEnding`,lineEndingBlank:`lineEndingBlank`,linePrefix:`linePrefix`,lineSuffix:`lineSuffix`,atxHeading:`atxHeading`,atxHeadingSequence:`atxHeadingSequence`,atxHeadingText:`atxHeadingText`,autolink:`autolink`,autolinkEmail:`autolinkEmail`,autolinkMarker:`autolinkMarker`,autolinkProtocol:`autolinkProtocol`,characterEscape:`characterEscape`,characterEscapeValue:`characterEscapeValue`,characterReference:`characterReference`,characterReferenceMarker:`characterReferenceMarker`,characterReferenceMarkerNumeric:`characterReferenceMarkerNumeric`,characterReferenceMarkerHexadecimal:`characterReferenceMarkerHexadecimal`,characterReferenceValue:`characterReferenceValue`,codeFenced:`codeFenced`,codeFencedFence:`codeFencedFence`,codeFencedFenceSequence:`codeFencedFenceSequence`,codeFencedFenceInfo:`codeFencedFenceInfo`,codeFencedFenceMeta:`codeFencedFenceMeta`,codeFlowValue:`codeFlowValue`,codeIndented:`codeIndented`,codeText:`codeText`,codeTextData:`codeTextData`,codeTextPadding:`codeTextPadding`,codeTextSequence:`codeTextSequence`,content:`content`,definition:`definition`,definitionDestination:`definitionDestination`,definitionDestinationLiteral:`definitionDestinationLiteral`,definitionDestinationLiteralMarker:`definitionDestinationLiteralMarker`,definitionDestinationRaw:`definitionDestinationRaw`,definitionDestinationString:`definitionDestinationString`,definitionLabel:`definitionLabel`,definitionLabelMarker:`definitionLabelMarker`,definitionLabelString:`definitionLabelString`,definitionMarker:`definitionMarker`,definitionTitle:`definitionTitle`,definitionTitleMarker:`definitionTitleMarker`,definitionTitleString:`definitionTitleString`,emphasis:`emphasis`,emphasisSequence:`emphasisSequence`,emphasisText:`emphasisText`,escapeMarker:`escapeMarker`,hardBreakEscape:`hardBreakEscape`,hardBreakTrailing:`hardBreakTrailing`,htmlFlow:`htmlFlow`,htmlFlowData:`htmlFlowData`,htmlText:`htmlText`,htmlTextData:`htmlTextData`,image:`image`,label:`label`,labelText:`labelText`,labelLink:`labelLink`,labelImage:`labelImage`,labelMarker:`labelMarker`,labelImageMarker:`labelImageMarker`,labelEnd:`labelEnd`,link:`link`,paragraph:`paragraph`,reference:`reference`,referenceMarker:`referenceMarker`,referenceString:`referenceString`,resource:`resource`,resourceDestination:`resourceDestination`,resourceDestinationLiteral:`resourceDestinationLiteral`,resourceDestinationLiteralMarker:`resourceDestinationLiteralMarker`,resourceDestinationRaw:`resourceDestinationRaw`,resourceDestinationString:`resourceDestinationString`,resourceMarker:`resourceMarker`,resourceTitle:`resourceTitle`,resourceTitleMarker:`resourceTitleMarker`,resourceTitleString:`resourceTitleString`,setextHeading:`setextHeading`,setextHeadingText:`setextHeadingText`,setextHeadingLine:`setextHeadingLine`,setextHeadingLineSequence:`setextHeadingLineSequence`,strong:`strong`,strongSequence:`strongSequence`,strongText:`strongText`,thematicBreak:`thematicBreak`,thematicBreakSequence:`thematicBreakSequence`,blockQuote:`blockQuote`,blockQuotePrefix:`blockQuotePrefix`,blockQuoteMarker:`blockQuoteMarker`,blockQuotePrefixWhitespace:`blockQuotePrefixWhitespace`,listOrdered:`listOrdered`,listUnordered:`listUnordered`,listItemIndent:`listItemIndent`,listItemMarker:`listItemMarker`,listItemPrefix:`listItemPrefix`,listItemPrefixWhitespace:`listItemPrefixWhitespace`,listItemValue:`listItemValue`,chunkDocument:`chunkDocument`,chunkContent:`chunkContent`,chunkFlow:`chunkFlow`,chunkText:`chunkText`,chunkString:`chunkString`},mb=`highlightSequenceTemporary`,hb=`highlightSequence`,gb=`highlight`,_b=`highlightText`;function vb(){let e={name:`highlight`,tokenize:n,resolveAll:t};return{text:{[db.equalsTo]:e},insideSpan:{null:[e]},attentionMarkers:{null:[db.equalsTo]}};function t(e,t){let n=-1;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===mb&&e[n][1]._close){let r=n;for(;r--;)if(e[r][0]===`exit`&&e[r][1].type===mb&&e[r][1]._open&&e[n][1].end.offset-e[n][1].start.offset===e[r][1].end.offset-e[r][1].start.offset){e[n][1].type=hb,e[r][1].type=hb;let i={type:gb,start:Object.assign({},e[r][1].start),end:Object.assign({},e[n][1].end)},a={type:_b,start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},o=[[`enter`,i,t],[`enter`,e[r][1],t],[`exit`,e[r][1],t],[`enter`,a,t]],s=t.parser.constructs.insideSpan.null;s&&Ov(o,o.length,0,Vv(s,e.slice(r+1,n),t)),Ov(o,o.length,0,[[`exit`,a,t],[`enter`,e[n][1],t],[`exit`,e[n][1],t],[`exit`,i,t]]),Ov(e,r-1,n-r+3,o),n=r+o.length-2;break}}for(n=-1;++n<e.length;)e[n][1].type===mb&&(e[n][1].type=pb.data);return e}function n(e,t,n){let r=this.previous,i=this.events,a=0;return o;function o(t){return cb(t===db.equalsTo,"expected `=`"),r===db.equalsTo&&i[i.length-1][1].type!==pb.characterEscape?n(t):(e.enter(mb),s(t))}function s(i){let o=Bv(r);if(i===db.equalsTo)return a>1?n(i):(e.consume(i),a++,s);if(a<2)return n(i);let c=e.exit(mb),l=Bv(i);return c._open=!l||l===fb.attentionSideAfter&&!!o,c._close=!o||o===fb.attentionSideAfter&&!!l,t(i)}}}var yb=/[$_\p{ID_Start}]/u,bb=/[$_\u{200C}\u{200D}\p{ID_Continue}]/u,xb=/[-$_\u{200C}\u{200D}\p{ID_Continue}]/u,Sb=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Cb=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,wb={};function Tb(e){return e?yb.test(String.fromCodePoint(e)):!1}function Eb(e,t){let n=(t||wb).jsx?xb:bb;return e?n.test(String.fromCodePoint(e)):!1}function Db(e,t){return((t||wb).jsx?Cb:Sb).test(e)}function Ob(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return Iv(r)?(e.enter(n),s(r)):t(r)}function s(r){return Iv(r)&&a++<i?(e.consume(r),s):(e.exit(n),t(r))}}function kb(e){return e}var Ab={}.hasOwnProperty,jb=Symbol(`continue`),Mb=Symbol(`exit`),Nb=Symbol(`skip`);function Pb(e,t){let n,r;typeof t==`function`?n=t:t&&typeof t==`object`&&(t.enter&&(n=t.enter),t.leave&&(r=t.leave)),i(e,void 0,void 0,[])();function i(e,t,a,o){return Ib(e)&&(s.displayName=`node (`+kb(e.type)+`)`),s;function s(){let s=n?Fb(n(e,t,a,o)):[];if(s[0]===Mb)return s;if(s[0]!==Nb){let t;for(t in e)if(Ab.call(e,t)&&e[t]&&typeof e[t]==`object`&&t!==`data`&&t!==`position`){let n=o.concat(e),r=e[t];if(Array.isArray(r)){let e=r,a=0;for(;a>-1&&a<e.length;){let r=e[a];if(Ib(r)){let e=i(r,t,a,n)();if(e[0]===Mb)return e;a=typeof e[1]==`number`?e[1]:a+1}else a++}}else if(Ib(r)){let e=i(r,t,void 0,n)();if(e[0]===Mb)return e}}}return r?Fb(r(e,t,a,o)):s}}}function Fb(e){return Array.isArray(e)?e:typeof e==`number`?[jb,e]:[e]}function Ib(e){return!!(e&&typeof e==`object`&&`type`in e&&typeof e.type==`string`&&e.type.length>0)}function Lb(e,t){let n=t.prefix||``,r=t.suffix||``,i=Object.assign({},t.acornOptions),a=[],o=[],s=i.onComment,c=i.onToken,l=!1,u,d,f=Object.assign({},i,{onComment:a,preserveParens:!0});c&&(f.onToken=o);let p=zb(e,t.tokenTypes),m=p.value,h=n+m+r,g=t.expression&&Rb(m);if(g&&!t.allowEmpty)throw new _y(`Unexpected empty expression`,{place:v(0),ruleId:`unexpected-empty-expression`,source:`micromark-extension-mdx-expression`});try{u=t.expression&&!g?t.acorn.parseExpressionAt(h,0,f):t.acorn.parse(h,f)}catch(e){let t=e,r=v(t.pos);t.message=String(t.message).replace(/ \(\d+:\d+\)$/,``),t.pos=r.offset,t.loc={line:r.line,column:r.column-1},d=t,l=t.raisedAt>=n.length+m.length||t.message===`Unterminated comment`}if(u&&t.expression&&!g)if(Rb(h.slice(u.end,h.length-r.length)))u={type:`Program`,start:0,end:n.length+m.length,body:[{type:`ExpressionStatement`,expression:u,start:0,end:n.length+m.length}],sourceType:`module`,comments:[]};else{let e=v(u.end),t=Error(`Unexpected content after expression`);t.pos=e.offset,t.loc={line:e.line,column:e.column-1},d=t,u=void 0}if(u){if(u.comments=a,Pb(u,function(e,t,n,r){let i=r[r.length-1],a=t;e.type===`ParenthesizedExpression`&&i&&a&&(typeof n==`number`&&(i=i[a],a=n),i[a]=e.expression),_(e)}),Array.isArray(s))s.push(...a);else if(typeof s==`function`)for(let e of a)s(e.type===`Block`,e.value,e.start,e.end,e.loc.start,e.loc.end);for(let e of o)e.end<=n.length||e.start-n.length>=m.length||(_(e),Array.isArray(c)?c.push(e):c(e))}return{estree:u,error:d,swallow:l};function _(e){let t=v(e.start),n=v(e.end);e.start=t.offset,e.end=n.offset,e.loc={start:{line:t.line,column:t.column-1,offset:t.offset},end:{line:n.line,column:n.column-1,offset:n.offset}},e.range=[e.start,e.end]}function v(e){let r=e-n.length;r<0?r=0:r>m.length&&(r=m.length);let i=Bb(p.stops,r);return i||={line:t.start.line,column:t.start.column,offset:t.start.offset},i}}function Rb(e){return/^\s*$/.test(e.replace(/\/\*[\s\S]*?\*\//g,``).replace(/\/\/[^\r\n]*(\r\n|\n|\r)/g,``))}function zb(e,t){let n={value:``,stops:[]},r=-1;for(;++r<e.length;){let i=e[r];if(i[0]===`enter`){let e=i[1].type;if(e===`lineEnding`||t.includes(e)){let e=i[2].sliceStream(i[1]);for(;e.length>0&&e[0]===-1;)e.shift();let t=Vb(e);n.stops.push([n.value.length,i[1].start]),n.value+=t,n.stops.push([n.value.length,i[1].end])}}}return n}function Bb(e,t){let n=0;for(;n<e.length&&e[n][0]<=t;)n+=1;if(n===0)return;let[r,i]=e[n-1],a=t-r;return{line:i.line,column:i.column+a,offset:i.offset+a}}function Vb(e){let t=-1,n=[],r;for(;++t<e.length;){let i=e[t],a;if(typeof i==`string`)a=i;else switch(i){case-5:a=`\r`;break;case-4:a=`
44
+ `;break;case-3:a=`\r
45
+ `;break;case-2:a=` `;break;case-1:if(r)continue;a=` `;break;default:a=String.fromCharCode(i)}r=i===-2,n.push(a)}return n.join(``)}function Hb(e){let t=e||{},n=t.loc||{},r=t.range||[void 0,void 0],i=Ub(n.start,r[0]||t.start),a=Ub(n.end,r[1]||t.end);if(i&&a)return{start:i,end:a}}function Ub(e,t){if(e&&typeof e==`object`){let n=`line`in e?Wb(e.line):void 0,r=`column`in e?Wb(e.column):void 0;if(n&&r!==void 0)return{line:n,column:r+1,offset:Wb(t)}}}function Wb(e){return typeof e==`number`&&e>-1?e:void 0}var Gb=2,Kb=`https://github.com/micromark/micromark-extension-mdx-expression/tree/main/packages/micromark-extension-mdx-expression`,qb=`#unexpected-end-of-file-in-expression-expected-a-corresponding-closing-brace-for-`,Jb=`#unexpected-lazy-line-in-expression-in-container-expected-line-to-be-prefixed`,Yb=`#unexpected-type-in-code-expected-an-object-spread-spread`,Xb=`#unexpected-extra-content-in-spread-only-a-single-spread-is-supported`,Zb=`#could-not-parse-expression-with-acorn`;function Qb(e,t,n,r,i,a,o,s,c,l,u){let d=this,f=this.events.length+3,p=0,m,h;return g;function g(t){return e.enter(n),e.enter(r),e.consume(t),e.exit(r),m=d.now(),_}function _(u){if(u===null){if(h)throw h;let e=new _y("Unexpected end of file in expression, expected a corresponding closing brace for `{`",{place:d.now(),ruleId:`unexpected-eof`,source:`micromark-extension-mdx-expression`});throw e.url=Kb+qb,e}if(Pv(u))return e.enter(`lineEnding`),e.consume(u),e.exit(`lineEnding`),y;if(u===125&&p===0){let p=a?$b.call(d,a,o,i,f,m,l||!1,c||!1):{type:`ok`,estree:void 0};if(p.type===`ok`){e.enter(r),e.consume(u),e.exit(r);let i=e.exit(n);return s&&p.estree&&Object.assign(i,{estree:p.estree}),t}return h=p.message,e.enter(i),e.consume(u),v}return e.enter(i),v(u)}function v(t){return t===125&&p===0||t===null||Pv(t)?(e.exit(i),_(t)):(t===123&&!a?p+=1:t===125&&--p,e.consume(t),v)}function y(t){let n=d.now();if(n.line!==m.line&&!u&&d.parser.lazy[n.line]){let e=new _y("Unexpected lazy line in expression in container, expected line to be prefixed with `>` when in a block quote, whitespace when in a list, etc",{place:d.now(),ruleId:`unexpected-lazy`,source:`micromark-extension-mdx-expression`});throw e.url=Kb+Jb,e}return Iv(t)?Ob(e,_,`linePrefix`,Gb+1)(t):_(t)}}function $b(e,t,n,r,i,a,o){let s=Lb(this.events.slice(r),{acorn:e,tokenTypes:[n],acornOptions:t,start:i,expression:!0,allowEmpty:a,prefix:o?`({`:``,suffix:o?`})`:``}),c=s.estree;if(o&&c){let e=c.body[0];if(e.type!==`ExpressionStatement`||e.expression.type!==`ObjectExpression`){let t=Hb(e),n=new _y("Unexpected `"+e.type+"` in code: expected an object spread (`{...spread}`)",{place:t.start,ruleId:`non-spread`,source:`micromark-extension-mdx-expression`});throw n.url=Kb+Yb,n}if(e.expression.properties[1]){let t=new _y(`Unexpected extra content in spread: only a single spread is supported`,{place:Hb(e.expression.properties[1]).start,ruleId:`spread-extra`,source:`micromark-extension-mdx-expression`});throw t.url=Kb+Xb,t}if(e.expression.properties[0]&&e.expression.properties[0].type!==`SpreadElement`){let t=Hb(e.expression.properties[0]),n=new _y("Unexpected `"+e.expression.properties[0].type+"` in code: only spread elements are supported",{place:t.start,ruleId:`non-spread`,source:`micromark-extension-mdx-expression`});throw n.url=Kb+Yb,n}}if(s.error){let e=new _y(`Could not parse expression with acorn`,{cause:s.error,place:{line:s.error.loc.line,column:s.error.loc.column+1,offset:s.error.pos},ruleId:`acorn`,source:`micromark-extension-mdx-expression`});return e.url=Kb+Zb,{type:`nok`,message:e}}return{type:`ok`,estree:c}}var ex=`https://github.com/micromark/micromark-extension-mdx-jsx`;function tx(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D,O,k,A,j){let M=this,N,P;return ee;function ee(t){return e.enter(s),e.enter(c),e.consume(t),e.exit(c),te}function te(e){return Fv(e)?n(e):(N=ne,Ce(e))}function ne(t){if(t===47)return e.enter(l),e.consume(t),e.exit(l),N=F,Ce;if(t===62)return Se(t);if(t!==null&&t>=0&&Tb(t))return e.enter(d),e.enter(f),e.consume(t),re;Ee(t,`before name`,"a character that can start a name, such as a letter, `$`, or `_`"+(t===33?" (note: to create a comment in MDX, use `{/* text */}`)":``))}function F(t){if(t===62)return Se(t);if(t!==null&&t>=0&&Tb(t))return e.enter(d),e.enter(f),e.consume(t),re;Ee(t,`before name`,"a character that can start a name, such as a letter, `$`, or `_`"+(t===42||t===47?` (note: JS comments in JSX tags are not supported in MDX)`:``))}function re(t){if(t!==null&&t>=0&&Eb(t,{jsx:!0}))return e.consume(t),re;if(t===46||t===47||t===58||t===62||t===123||Fv(t)||Rv(t))return e.exit(f),N=I,Ce(t);Ee(t,`in name`,"a name character such as letters, digits, `$`, or `_`; whitespace before attributes; or the end of the tag"+(t===64?" (note: to create a link in MDX, use `[text](url)`)":``))}function I(t){if(t===46)return e.enter(p),e.consume(t),e.exit(p),N=ie,Ce;if(t===58)return e.enter(h),e.consume(t),e.exit(h),N=se,Ce;if(t===47||t===62||t===123||t!==null&&t>=0&&Tb(t))return e.exit(d),ue(t);Ee(t,`after name`,"a character that can start an attribute name, such as a letter, `$`, or `_`; whitespace before attributes; or the end of the tag")}function ie(t){if(t!==null&&t>=0&&Tb(t))return e.enter(m),e.consume(t),ae;Ee(t,`before member name`,"a character that can start an attribute name, such as a letter, `$`, or `_`; whitespace before attributes; or the end of the tag")}function ae(t){if(t!==null&&t>=0&&Eb(t,{jsx:!0}))return e.consume(t),ae;if(t===46||t===47||t===62||t===123||Fv(t)||Rv(t))return e.exit(m),N=oe,Ce(t);Ee(t,`in member name`,"a name character such as letters, digits, `$`, or `_`; whitespace before attributes; or the end of the tag"+(t===64?" (note: to create a link in MDX, use `[text](url)`)":``))}function oe(t){if(t===46)return e.enter(p),e.consume(t),e.exit(p),N=ie,Ce;if(t===47||t===62||t===123||t!==null&&t>=0&&Tb(t))return e.exit(d),ue(t);Ee(t,`after member name`,"a character that can start an attribute name, such as a letter, `$`, or `_`; whitespace before attributes; or the end of the tag")}function se(t){if(t!==null&&t>=0&&Tb(t))return e.enter(g),e.consume(t),ce;Ee(t,`before local name`,"a character that can start a name, such as a letter, `$`, or `_`"+(t===43||t!==null&&t>46&&t<58?" (note: to create a link in MDX, use `[text](url)`)":``))}function ce(t){if(t!==null&&t>=0&&Eb(t,{jsx:!0}))return e.consume(t),ce;if(t===47||t===62||t===123||Fv(t)||Rv(t))return e.exit(g),N=le,Ce(t);Ee(t,`in local name`,"a name character such as letters, digits, `$`, or `_`; whitespace before attributes; or the end of the tag")}function le(t){if(t===47||t===62||t===123||t!==null&&t>=0&&Tb(t))return e.exit(d),ue(t);Ee(t,`after local name`,"a character that can start an attribute name, such as a letter, `$`, or `_`; whitespace before attributes; or the end of the tag")}function ue(t){if(t===47)return e.enter(u),e.consume(t),e.exit(u),N=xe,Ce;if(t===62)return Se(t);if(t===123)return Qb.call(M,e,de,_,v,y,r,i,a,!0,!1,o)(t);if(t!==null&&t>=0&&Tb(t))return e.enter(b),e.enter(x),e.enter(S),e.consume(t),fe;Ee(t,`before attribute name`,"a character that can start an attribute name, such as a letter, `$`, or `_`; whitespace before attributes; or the end of the tag")}function de(e){return N=ue,Ce(e)}function fe(t){if(t!==null&&t>=0&&Eb(t,{jsx:!0}))return e.consume(t),fe;if(t===47||t===58||t===61||t===62||t===123||Fv(t)||Rv(t))return e.exit(S),N=pe,Ce(t);Ee(t,`in attribute name`,"an attribute name character such as letters, digits, `$`, or `_`; `=` to initialize a value; whitespace before attributes; or the end of the tag")}function pe(t){if(t===58)return e.enter(C),e.consume(t),e.exit(C),N=me,Ce;if(t===61)return e.exit(x),e.enter(T),e.consume(t),e.exit(T),N=_e,Ce;if(t===47||t===62||t===123||Fv(t)||Rv(t)||t!==null&&t>=0&&Tb(t))return e.exit(x),e.exit(b),N=ue,Ce(t);Ee(t,`after attribute name`,"a character that can start an attribute name, such as a letter, `$`, or `_`; `=` to initialize a value; or the end of the tag")}function me(t){if(t!==null&&t>=0&&Tb(t))return e.enter(w),e.consume(t),he;Ee(t,`before local attribute name`,"a character that can start an attribute name, such as a letter, `$`, or `_`; `=` to initialize a value; or the end of the tag")}function he(t){if(t!==null&&t>=0&&Eb(t,{jsx:!0}))return e.consume(t),he;if(t===47||t===61||t===62||t===123||Fv(t)||Rv(t))return e.exit(w),e.exit(x),N=ge,Ce(t);Ee(t,`in local attribute name`,"an attribute name character such as letters, digits, `$`, or `_`; `=` to initialize a value; whitespace before attributes; or the end of the tag")}function ge(t){if(t===61)return e.enter(T),e.consume(t),e.exit(T),N=_e,Ce;if(t===47||t===62||t===123||t!==null&&t>=0&&Tb(t))return e.exit(b),ue(t);Ee(t,`after local attribute name`,"a character that can start an attribute name, such as a letter, `$`, or `_`; `=` to initialize a value; or the end of the tag")}function _e(t){if(t===34||t===39)return e.enter(E),e.enter(D),e.consume(t),e.exit(D),P=t,ye;if(t===123)return Qb.call(M,e,ve,k,A,j,r,i,a,!1,!1,o)(t);Ee(t,`before attribute value`,"a character that can start an attribute value, such as `\"`, `'`, or `{`"+(t===60?" (note: to use an element or fragment as a prop value in MDX, use `{<element />}`)":``))}function ve(t){return e.exit(b),N=ue,Ce(t)}function ye(t){return t===null&&Ee(t,`in attribute value`,"a corresponding closing quote `"+String.fromCodePoint(P)+"`"),t===P?(e.enter(D),e.consume(t),e.exit(D),e.exit(E),e.exit(b),P=void 0,N=ue,Ce):Pv(t)?(N=ye,Ce(t)):(e.enter(O),be(t))}function be(t){return t===null||t===P||Pv(t)?(e.exit(O),ye(t)):(e.consume(t),be)}function xe(e){if(e===62)return Se(e);Ee(e,`after self-closing slash`,"`>` to end the tag"+(e===42||e===47?` (note: JS comments in JSX tags are not supported in MDX)`:``))}function Se(n){return e.enter(c),e.consume(n),e.exit(c),e.exit(s),t}function Ce(t){return Pv(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),Te):Iv(t)||Rv(t)?(e.enter(`esWhitespace`),we(t)):N(t)}function we(t){return Pv(t)?(e.exit(`esWhitespace`),Ce(t)):Iv(t)||Rv(t)?(e.consume(t),we):(e.exit(`esWhitespace`),N(t))}function Te(e){if(!o&&M.parser.lazy[M.now().line]){let e=new _y("Unexpected lazy line in container, expected line to be prefixed with `>` when in a block quote, whitespace when in a list, etc",M.now(),`micromark-extension-mdx-jsx:unexpected-lazy`);throw e.url=ex+`#unexpected-lazy-line-in-container-expected-line-to-be`,e}return Ce(e)}function Ee(e,t,n){let r=new _y(`Unexpected `+(e===null?`end of file`:"character `"+(e===96?"` ` `":String.fromCodePoint(e))+"` ("+nx(e)+`)`)+` `+t+`, expected `+n,M.now(),`micromark-extension-mdx-jsx:unexpected-`+(e===null?`eof`:`character`));throw r.url=ex+(e===null?`#unexpected-end-of-file-at-expected-expect`:`#unexpected-character-at-expected-expect`),r}}function nx(e){return`U+`+e.toString(16).toUpperCase().padStart(4,`0`)}function rx(e,t){return{name:`mdxJsxTextTag`,tokenize:n};function n(n,r,i){return tx.call(this,n,r,i,e,t.acornOptions,t.addResult,!0,`mdxJsxTextTag`,`mdxJsxTextTagMarker`,`mdxJsxTextTagClosingMarker`,`mdxJsxTextTagSelfClosingMarker`,`mdxJsxTextTagName`,`mdxJsxTextTagNamePrimary`,`mdxJsxTextTagNameMemberMarker`,`mdxJsxTextTagNameMember`,`mdxJsxTextTagNamePrefixMarker`,`mdxJsxTextTagNameLocal`,`mdxJsxTextTagExpressionAttribute`,`mdxJsxTextTagExpressionAttributeMarker`,`mdxJsxTextTagExpressionAttributeValue`,`mdxJsxTextTagAttribute`,`mdxJsxTextTagAttributeName`,`mdxJsxTextTagAttributeNamePrimary`,`mdxJsxTextTagAttributeNamePrefixMarker`,`mdxJsxTextTagAttributeNameLocal`,`mdxJsxTextTagAttributeInitializerMarker`,`mdxJsxTextTagAttributeValueLiteral`,`mdxJsxTextTagAttributeValueLiteralMarker`,`mdxJsxTextTagAttributeValueLiteralValue`,`mdxJsxTextTagAttributeValueExpression`,`mdxJsxTextTagAttributeValueExpressionMarker`,`mdxJsxTextTagAttributeValueExpressionValue`)}}function ix(e,t){return{concrete:!0,name:`mdxJsxFlowTag`,tokenize:n};function n(n,r,i){let a=this;return o;function o(e){return s(e)}function s(r){return tx.call(a,n,c,i,e,t.acornOptions,t.addResult,!1,`mdxJsxFlowTag`,`mdxJsxFlowTagMarker`,`mdxJsxFlowTagClosingMarker`,`mdxJsxFlowTagSelfClosingMarker`,`mdxJsxFlowTagName`,`mdxJsxFlowTagNamePrimary`,`mdxJsxFlowTagNameMemberMarker`,`mdxJsxFlowTagNameMember`,`mdxJsxFlowTagNamePrefixMarker`,`mdxJsxFlowTagNameLocal`,`mdxJsxFlowTagExpressionAttribute`,`mdxJsxFlowTagExpressionAttributeMarker`,`mdxJsxFlowTagExpressionAttributeValue`,`mdxJsxFlowTagAttribute`,`mdxJsxFlowTagAttributeName`,`mdxJsxFlowTagAttributeNamePrimary`,`mdxJsxFlowTagAttributeNamePrefixMarker`,`mdxJsxFlowTagAttributeNameLocal`,`mdxJsxFlowTagAttributeInitializerMarker`,`mdxJsxFlowTagAttributeValueLiteral`,`mdxJsxFlowTagAttributeValueLiteralMarker`,`mdxJsxFlowTagAttributeValueLiteralValue`,`mdxJsxFlowTagAttributeValueExpression`,`mdxJsxFlowTagAttributeValueExpressionMarker`,`mdxJsxFlowTagAttributeValueExpressionValue`)(r)}function c(e){return Iv(e)?Ob(n,l,`whitespace`)(e):l(e)}function l(e){let t=a.parser.constructs.flow[123],s=Array.isArray(t)?t:t?[t]:[],c;for(let e of s)if(e.name===`mdxFlowExpression`){c=e;break}return e===60?o(e):e===123&&c?n.attempt(c,l,i)(e):e===null||Pv(e)?r(e):i(e)}}}function ax(e){let t=e||{},n=t.acorn,r;if(n){if(!n.parse||!n.parseExpressionAt)throw Error("Expected a proper `acorn` instance passed in as `options.acorn`");r=Object.assign({ecmaVersion:2024,sourceType:`module`},t.acornOptions,{locations:!0})}else if(t.acornOptions||t.addResult)throw Error("Expected an `acorn` instance passed in as `options.acorn`");return{flow:{60:ix(n||void 0,{acornOptions:r,addResult:t.addResult||void 0})},text:{60:rx(n||void 0,{acornOptions:r,addResult:t.addResult||void 0})}}}function ox(){return{disable:{null:[`autolink`,`codeIndented`,`htmlFlow`,`htmlText`]}}}var sx={}.hasOwnProperty;function cx(e,t){let n=t||{};function r(t,...n){let i=r.invalid,a=r.handlers;if(t&&sx.call(t,e)){let n=String(t[e]);i=sx.call(a,n)?a[n]:r.unknown}if(i)return i.call(this,t,...n)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}var lx={}.hasOwnProperty;function ux(e,t){let n=-1,r;if(t.extensions)for(;++n<t.extensions.length;)ux(e,t.extensions[n]);for(r in t)if(lx.call(t,r))switch(r){case`extensions`:break;case`unsafe`:dx(e[r],t[r]);break;case`join`:dx(e[r],t[r]);break;case`handlers`:fx(e[r],t[r]);break;default:e.options[r]=t[r]}return e}function dx(e,t){t&&e.push(...t)}function fx(e,t){t&&Object.assign(e,t)}function px(e,t,n,r){let i=n.enter(`blockquote`),a=n.createTracker(r);a.move(`> `),a.shift(2);let o=n.indentLines(n.containerFlow(e,a.current()),kte);return i(),o}function kte(e,t,n){return`>`+(n?``:` `)+e}function mx(e,t){return hx(e,t.inConstruct,!0)&&!hx(e,t.notInConstruct,!1)}function hx(e,t,n){if(typeof t==`string`&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function gx(e,t,n,r){let i=-1;for(;++i<n.unsafe.length;)if(n.unsafe[i].character===`
46
+ `&&mx(n.stack,n.unsafe[i]))return/[ \t]/.test(r.before)?``:` `;return`\\
47
+ `}function Ate(e,t){let n=String(e),r=n.indexOf(t),i=r,a=0,o=0;if(typeof t!=`string`)throw TypeError(`Expected substring`);for(;r!==-1;)r===i?++a>o&&(o=a):a=1,i=r+t.length,r=n.indexOf(t,i);return o}function _x(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function jte(e){let t=e.options.fence||"`";if(t!=="`"&&t!==`~`)throw Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function Mte(e,t,n,r){let i=jte(n),a=e.value||``,o=i==="`"?`GraveAccent`:`Tilde`;if(_x(e,n)){let e=n.enter(`codeIndented`),t=n.indentLines(a,Nte);return e(),t}let s=n.createTracker(r),c=i.repeat(Math.max(Ate(a,i)+1,3)),l=n.enter(`codeFenced`),u=s.move(c);if(e.lang){let t=n.enter(`codeFencedLang${o}`);u+=s.move(n.safe(e.lang,{before:u,after:` `,encode:["`"],...s.current()})),t()}if(e.lang&&e.meta){let t=n.enter(`codeFencedMeta${o}`);u+=s.move(` `),u+=s.move(n.safe(e.meta,{before:u,after:`
48
+ `,encode:["`"],...s.current()})),t()}return u+=s.move(`
49
+ `),a&&(u+=s.move(a+`
50
+ `)),u+=s.move(c),l(),u}function Nte(e,t,n){return(n?``:` `)+e}function vx(e){let t=e.options.quote||`"`;if(t!==`"`&&t!==`'`)throw Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function Pte(e,t,n,r){let i=vx(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.enter(`definition`),s=n.enter(`label`),c=n.createTracker(r),l=c.move(`[`);return l+=c.move(n.safe(n.associationId(e),{before:l,after:`]`,...c.current()})),l+=c.move(`]: `),s(),!e.url||/[\0- \u007F]/.test(e.url)?(s=n.enter(`destinationLiteral`),l+=c.move(`<`),l+=c.move(n.safe(e.url,{before:l,after:`>`,...c.current()})),l+=c.move(`>`)):(s=n.enter(`destinationRaw`),l+=c.move(n.safe(e.url,{before:l,after:e.title?` `:`
51
+ `,...c.current()}))),s(),e.title&&(s=n.enter(`title${a}`),l+=c.move(` `+i),l+=c.move(n.safe(e.title,{before:l,after:i,...c.current()})),l+=c.move(i),s()),o(),l}function Fte(e){let t=e.options.emphasis||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function yx(e){return`&#x`+e.toString(16).toUpperCase()+`;`}function bx(e,t,n){let r=Bv(e),i=Bv(t);return r===void 0?i===void 0?n===`_`?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}xx.peek=Ite;function xx(e,t,n,r){let i=Fte(n),a=n.enter(`emphasis`),o=n.createTracker(r),s=o.move(i),c=o.move(n.containerPhrasing(e,{after:i,before:s,...o.current()})),l=c.charCodeAt(0),u=bx(r.before.charCodeAt(r.before.length-1),l,i);u.inside&&(c=yx(l)+c.slice(1));let d=c.charCodeAt(c.length-1),f=bx(r.after.charCodeAt(0),d,i);f.inside&&(c=c.slice(0,-1)+yx(d));let p=o.move(i);return a(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},s+c+p}function Ite(e,t,n){return n.options.emphasis||`*`}var Sx=(function(e){if(e==null)return Bte;if(typeof e==`function`)return Cx(e);if(typeof e==`object`)return Array.isArray(e)?Lte(e):Rte(e);if(typeof e==`string`)return zte(e);throw Error(`Expected function, string, or object as test`)});function Lte(e){let t=[],n=-1;for(;++n<e.length;)t[n]=Sx(e[n]);return Cx(r);function r(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1}}function Rte(e){let t=e;return Cx(n);function n(n){let r=n,i;for(i in e)if(r[i]!==t[i])return!1;return!0}}function zte(e){return Cx(t);function t(t){return t&&t.type===e}}function Cx(e){return t;function t(t,n,r){return!!(Vte(t)&&e.call(this,t,typeof n==`number`?n:void 0,r||void 0))}}function Bte(){return!0}function Vte(e){return typeof e==`object`&&!!e&&`type`in e}function Hte(e){return e}var wx=[];function Tx(e,t,n,r){let i;typeof t==`function`&&typeof n!=`function`?(r=n,n=t):i=t;let a=Sx(i),o=r?-1:1;s(e,void 0,[])();function s(e,i,c){let l=e&&typeof e==`object`?e:{};if(typeof l.type==`string`){let t=typeof l.tagName==`string`?l.tagName:typeof l.name==`string`?l.name:void 0;Object.defineProperty(u,`name`,{value:`node (`+Hte(e.type+(t?`<`+t+`>`:``))+`)`})}return u;function u(){let l=wx,u,d,f;if((!t||a(e,i,c[c.length-1]||void 0))&&(l=Ute(n(e,c)),l[0]===!1))return l;if(`children`in e&&e.children){let t=e;if(t.children&&l[0]!==`skip`)for(d=(r?t.children.length:-1)+o,f=c.concat(t);d>-1&&d<t.children.length;){let e=t.children[d];if(u=s(e,d,f)(),u[0]===!1)return u;d=typeof u[1]==`number`?u[1]:d+o}}return l}}}function Ute(e){return Array.isArray(e)?e:typeof e==`number`?[!0,e]:e==null?wx:[e]}function Ex(e,t,n,r){let i,a,o;typeof t==`function`&&typeof n!=`function`?(a=void 0,o=t,i=n):(a=t,o=n,i=r),Tx(e,a,s,i);function s(e,t){let n=t[t.length-1],r=n?n.children.indexOf(e):void 0;return o(e,r,n)}}var Wte={};function Dx(e,t){let n=t||Wte;return Ox(e,typeof n.includeImageAlt==`boolean`?n.includeImageAlt:!0,typeof n.includeHtml==`boolean`?n.includeHtml:!0)}function Ox(e,t,n){if(Gte(e)){if(`value`in e)return e.type===`html`&&!n?``:e.value;if(t&&`alt`in e&&e.alt)return e.alt;if(`children`in e)return kx(e.children,t,n)}return Array.isArray(e)?kx(e,t,n):``}function kx(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=Ox(e[i],t,n);return r.join(``)}function Gte(e){return!!(e&&typeof e==`object`)}function Ax(e,t){let n=!1;return Ex(e,function(e){if(`value`in e&&/\r?\n|\r/.test(e.value)||e.type===`break`)return n=!0,!1}),!!((!e.depth||e.depth<3)&&Dx(e)&&(t.options.setext||n))}function Kte(e,t,n,r){let i=Math.max(Math.min(6,e.depth||1),1),a=n.createTracker(r);if(Ax(e,n)){let t=n.enter(`headingSetext`),r=n.enter(`phrasing`),o=n.containerPhrasing(e,{...a.current(),before:`
52
+ `,after:`
53
+ `});return r(),t(),o+`
54
+ `+(i===1?`=`:`-`).repeat(o.length-(Math.max(o.lastIndexOf(`\r`),o.lastIndexOf(`
55
+ `))+1))}let o=`#`.repeat(i),s=n.enter(`headingAtx`),c=n.enter(`phrasing`);a.move(o+` `);let l=n.containerPhrasing(e,{before:`# `,after:`
56
+ `,...a.current()});return/^[\t ]/.test(l)&&(l=yx(l.charCodeAt(0))+l.slice(1)),l=l?o+` `+l:o,n.options.closeAtx&&(l+=` `+o),c(),s(),l}jx.peek=qte;function jx(e){return e.value||``}function qte(){return`<`}Mx.peek=Jte;function Mx(e,t,n,r){let i=vx(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.enter(`image`),s=n.enter(`label`),c=n.createTracker(r),l=c.move(`![`);return l+=c.move(n.safe(e.alt,{before:l,after:`]`,...c.current()})),l+=c.move(`](`),s(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(s=n.enter(`destinationLiteral`),l+=c.move(`<`),l+=c.move(n.safe(e.url,{before:l,after:`>`,...c.current()})),l+=c.move(`>`)):(s=n.enter(`destinationRaw`),l+=c.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...c.current()}))),s(),e.title&&(s=n.enter(`title${a}`),l+=c.move(` `+i),l+=c.move(n.safe(e.title,{before:l,after:i,...c.current()})),l+=c.move(i),s()),l+=c.move(`)`),o(),l}function Jte(){return`!`}Nx.peek=Yte;function Nx(e,t,n,r){let i=e.referenceType,a=n.enter(`imageReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`![`),l=n.safe(e.alt,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=[],o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function Yte(){return`!`}Px.peek=Xte;function Px(e,t,n){let r=e.value||``,i="`",a=-1;for(;RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=` `+r+` `);++a<n.unsafe.length;){let e=n.unsafe[a],t=n.compilePattern(e),i;if(e.atBreak)for(;i=t.exec(r);){let e=i.index;r.charCodeAt(e)===10&&r.charCodeAt(e-1)===13&&e--,r=r.slice(0,e)+` `+r.slice(i.index+1)}}return i+r+i}function Xte(){return"`"}function Fx(e,t){let n=Dx(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type===`text`&&(n===e.url||`mailto:`+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}Ix.peek=Zte;function Ix(e,t,n,r){let i=vx(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.createTracker(r),s,c;if(Fx(e,n)){let t=n.stack;n.stack=[],s=n.enter(`autolink`);let r=o.move(`<`);return r+=o.move(n.containerPhrasing(e,{before:r,after:`>`,...o.current()})),r+=o.move(`>`),s(),n.stack=t,r}s=n.enter(`link`),c=n.enter(`label`);let l=o.move(`[`);return l+=o.move(n.containerPhrasing(e,{before:l,after:`](`,...o.current()})),l+=o.move(`](`),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter(`destinationLiteral`),l+=o.move(`<`),l+=o.move(n.safe(e.url,{before:l,after:`>`,...o.current()})),l+=o.move(`>`)):(c=n.enter(`destinationRaw`),l+=o.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...o.current()}))),c(),e.title&&(c=n.enter(`title${a}`),l+=o.move(` `+i),l+=o.move(n.safe(e.title,{before:l,after:i,...o.current()})),l+=o.move(i),c()),l+=o.move(`)`),s(),l}function Zte(e,t,n){return Fx(e,n)?`<`:`[`}Lx.peek=Qte;function Lx(e,t,n,r){let i=e.referenceType,a=n.enter(`linkReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`[`),l=n.containerPhrasing(e,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=[],o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function Qte(){return`[`}function Rx(e){let t=e.options.bullet||`*`;if(t!==`*`&&t!==`+`&&t!==`-`)throw Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function $te(e){let t=Rx(e),n=e.options.bulletOther;if(!n)return t===`*`?`-`:`*`;if(n!==`*`&&n!==`+`&&n!==`-`)throw Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function ene(e){let t=e.options.bulletOrdered||`.`;if(t!==`.`&&t!==`)`)throw Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function zx(e){let t=e.options.rule||`*`;if(t!==`*`&&t!==`-`&&t!==`_`)throw Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function tne(e,t,n,r){let i=n.enter(`list`),a=n.bulletCurrent,o=e.ordered?ene(n):Rx(n),s=e.ordered?o===`.`?`)`:`.`:$te(n),c=t&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!e.ordered){let t=e.children?e.children[0]:void 0;if((o===`*`||o===`-`)&&t&&(!t.children||!t.children[0])&&n.stack[n.stack.length-1]===`list`&&n.stack[n.stack.length-2]===`listItem`&&n.stack[n.stack.length-3]===`list`&&n.stack[n.stack.length-4]===`listItem`&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(c=!0),zx(n)===o&&t){let t=-1;for(;++t<e.children.length;){let n=e.children[t];if(n&&n.type===`listItem`&&n.children&&n.children[0]&&n.children[0].type===`thematicBreak`){c=!0;break}}}}c&&(o=s),n.bulletCurrent=o;let l=n.containerFlow(e,r);return n.bulletLastUsed=o,n.bulletCurrent=a,i(),l}function nne(e){let t=e.options.listItemIndent||`one`;if(t!==`tab`&&t!==`one`&&t!==`mixed`)throw Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function rne(e,t,n,r){let i=nne(n),a=n.bulletCurrent||Rx(n);t&&t.type===`list`&&t.ordered&&(a=(typeof t.start==`number`&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+a);let o=a.length+1;(i===`tab`||i===`mixed`&&(t&&t.type===`list`&&t.spread||e.spread))&&(o=Math.ceil(o/4)*4);let s=n.createTracker(r);s.move(a+` `.repeat(o-a.length)),s.shift(o);let c=n.enter(`listItem`),l=n.indentLines(n.containerFlow(e,s.current()),u);return c(),l;function u(e,t,n){return t?(n?``:` `.repeat(o))+e:(n?a:a+` `.repeat(o-a.length))+e}}function ine(e,t,n,r){let i=n.enter(`paragraph`),a=n.enter(`phrasing`),o=n.containerPhrasing(e,r);return a(),i(),o}var ane=Sx([`break`,`delete`,`emphasis`,`footnote`,`footnoteReference`,`image`,`imageReference`,`inlineCode`,`inlineMath`,`link`,`linkReference`,`mdxJsxTextElement`,`mdxTextExpression`,`strong`,`text`,`textDirective`]);function one(e,t,n,r){return(e.children.some(function(e){return ane(e)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function sne(e){let t=e.options.strong||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}Bx.peek=cne;function Bx(e,t,n,r){let i=sne(n),a=n.enter(`strong`),o=n.createTracker(r),s=o.move(i+i),c=o.move(n.containerPhrasing(e,{after:i,before:s,...o.current()})),l=c.charCodeAt(0),u=bx(r.before.charCodeAt(r.before.length-1),l,i);u.inside&&(c=yx(l)+c.slice(1));let d=c.charCodeAt(c.length-1),f=bx(r.after.charCodeAt(0),d,i);f.inside&&(c=c.slice(0,-1)+yx(d));let p=o.move(i+i);return a(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},s+c+p}function cne(e,t,n){return n.options.strong||`*`}function lne(e,t,n,r){return n.safe(e.value,r)}function une(e){let t=e.options.ruleRepetition||3;if(t<3)throw Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function dne(e,t,n){let r=(zx(n)+(n.options.ruleSpaces?` `:``)).repeat(une(n));return n.options.ruleSpaces?r.slice(0,-1):r}var Vx={blockquote:px,break:gx,code:Mte,definition:Pte,emphasis:xx,hardBreak:gx,heading:Kte,html:jx,image:Mx,imageReference:Nx,inlineCode:Px,link:Ix,linkReference:Lx,list:tne,listItem:rne,paragraph:ine,root:one,strong:Bx,text:lne,thematicBreak:dne},fne=[pne];function pne(e,t,n,r){if(t.type===`code`&&_x(t,r)&&(e.type===`list`||e.type===t.type&&_x(e,r)))return!1;if(`spread`in n&&typeof n.spread==`boolean`)return e.type===`paragraph`&&(e.type===t.type||t.type===`definition`||t.type===`heading`&&Ax(t,r))?void 0:+!!n.spread}var Hx=[`autolink`,`destinationLiteral`,`destinationRaw`,`reference`,`titleQuote`,`titleApostrophe`],mne=[{character:` `,after:`[\\r\\n]`,inConstruct:`phrasing`},{character:` `,before:`[\\r\\n]`,inConstruct:`phrasing`},{character:` `,inConstruct:[`codeFencedLangGraveAccent`,`codeFencedLangTilde`]},{character:`\r`,inConstruct:[`codeFencedLangGraveAccent`,`codeFencedLangTilde`,`codeFencedMetaGraveAccent`,`codeFencedMetaTilde`,`destinationLiteral`,`headingAtx`]},{character:`
57
+ `,inConstruct:[`codeFencedLangGraveAccent`,`codeFencedLangTilde`,`codeFencedMetaGraveAccent`,`codeFencedMetaTilde`,`destinationLiteral`,`headingAtx`]},{character:` `,after:`[\\r\\n]`,inConstruct:`phrasing`},{character:` `,before:`[\\r\\n]`,inConstruct:`phrasing`},{character:` `,inConstruct:[`codeFencedLangGraveAccent`,`codeFencedLangTilde`]},{character:`!`,after:`\\[`,inConstruct:`phrasing`,notInConstruct:Hx},{character:`"`,inConstruct:`titleQuote`},{atBreak:!0,character:`#`},{character:`#`,inConstruct:`headingAtx`,after:`(?:[\r
58
+ ]|$)`},{character:`&`,after:`[#A-Za-z]`,inConstruct:`phrasing`},{character:`'`,inConstruct:`titleApostrophe`},{character:`(`,inConstruct:`destinationRaw`},{before:`\\]`,character:`(`,inConstruct:`phrasing`,notInConstruct:Hx},{atBreak:!0,before:`\\d+`,character:`)`},{character:`)`,inConstruct:`destinationRaw`},{atBreak:!0,character:`*`,after:`(?:[ \r
59
+ *])`},{character:`*`,inConstruct:`phrasing`,notInConstruct:Hx},{atBreak:!0,character:`+`,after:`(?:[ \r
60
+ ])`},{atBreak:!0,character:`-`,after:`(?:[ \r
61
+ -])`},{atBreak:!0,before:`\\d+`,character:`.`,after:`(?:[ \r
62
+ ]|$)`},{atBreak:!0,character:`<`,after:`[!/?A-Za-z]`},{character:`<`,after:`[!/?A-Za-z]`,inConstruct:`phrasing`,notInConstruct:Hx},{character:`<`,inConstruct:`destinationLiteral`},{atBreak:!0,character:`=`},{atBreak:!0,character:`>`},{character:`>`,inConstruct:`destinationLiteral`},{atBreak:!0,character:`[`},{character:`[`,inConstruct:`phrasing`,notInConstruct:Hx},{character:`[`,inConstruct:[`label`,`reference`]},{character:`\\`,after:`[\\r\\n]`,inConstruct:`phrasing`},{character:`]`,inConstruct:[`label`,`reference`]},{atBreak:!0,character:`_`},{character:`_`,inConstruct:`phrasing`,notInConstruct:Hx},{atBreak:!0,character:"`"},{character:"`",inConstruct:[`codeFencedLangGraveAccent`,`codeFencedMetaGraveAccent`]},{character:"`",inConstruct:`phrasing`,notInConstruct:Hx},{atBreak:!0,character:`~`}];function Ux(e,t){let n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)==65535||(n&65535)==65534||n>1114111?`�`:String.fromCodePoint(n)}var hne=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Wx(e){return e.replace(hne,gne)}function gne(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){let e=n.charCodeAt(1),t=e===120||e===88;return Ux(n.slice(t?2:1),t?16:10)}return Qv(n)||e}function _ne(e){return e.label||!e.identifier?e.label||``:Wx(e.identifier)}function vne(e){if(!e._compiled){let t=(e.atBreak?`[\\r\\n][\\t ]*`:``)+(e.before?`(?:`+e.before+`)`:``);e._compiled=RegExp((t?`(`+t+`)`:``)+(/[|\\{}()[\]^$+*?.-]/.test(e.character)?`\\`:``)+e.character+(e.after?`(?:`+e.after+`)`:``),`g`)}return e._compiled}function yne(e,t,n){let r=t.indexStack,i=e.children||[],a=[],o=-1,s=n.before,c;r.push(-1);let l=t.createTracker(n);for(;++o<i.length;){let u=i[o],d;if(r[r.length-1]=o,o+1<i.length){let n=t.handle.handlers[i[o+1].type];n&&n.peek&&(n=n.peek),d=n?n(i[o+1],e,t,{before:``,after:``,...l.current()}).charAt(0):``}else d=n.after;a.length>0&&(s===`\r`||s===`
63
+ `)&&u.type===`html`&&(a[a.length-1]=a[a.length-1].replace(/(\r?\n|\r)$/,` `),s=` `,l=t.createTracker(n),l.move(a.join(``)));let f=t.handle(u,e,t,{...l.current(),after:d,before:s});c&&c===f.slice(0,1)&&(f=yx(c.charCodeAt(0))+f.slice(1));let p=t.attentionEncodeSurroundingInfo;t.attentionEncodeSurroundingInfo=void 0,c=void 0,p&&(a.length>0&&p.before&&s===a[a.length-1].slice(-1)&&(a[a.length-1]=a[a.length-1].slice(0,-1)+yx(s.charCodeAt(0))),p.after&&(c=d)),l.move(f),a.push(f),s=f.slice(-1)}return r.pop(),a.join(``)}function bne(e,t,n){let r=t.indexStack,i=e.children||[],a=t.createTracker(n),o=[],s=-1;for(r.push(-1);++s<i.length;){let n=i[s];r[r.length-1]=s,o.push(a.move(t.handle(n,e,t,{before:`
64
+ `,after:`
65
+ `,...a.current()}))),n.type!==`list`&&(t.bulletLastUsed=void 0),s<i.length-1&&o.push(a.move(xne(n,i[s+1],e,t)))}return r.pop(),o.join(``)}function xne(e,t,n,r){let i=r.join.length;for(;i--;){let a=r.join[i](e,t,n,r);if(a===!0||a===1)break;if(typeof a==`number`)return`
66
+ `.repeat(1+a);if(a===!1)return`
67
+
68
+ <!---->
69
+
70
+ `}return`
71
+
72
+ `}var Sne=/\r?\n|\r/g;function Cne(e,t){let n=[],r=0,i=0,a;for(;a=Sne.exec(e);)o(e.slice(r,a.index)),n.push(a[0]),r=a.index+a[0].length,i++;return o(e.slice(r)),n.join(``);function o(e){n.push(t(e,i,!e))}}function wne(e,t,n){let r=(n.before||``)+(t||``)+(n.after||``),i=[],a=[],o={},s=-1;for(;++s<e.unsafe.length;){let t=e.unsafe[s];if(!mx(e.stack,t))continue;let n=e.compilePattern(t),a;for(;a=n.exec(r);){let e=`before`in t||!!t.atBreak,n=`after`in t,r=a.index+(e?a[1].length:0);i.includes(r)?(o[r].before&&!e&&(o[r].before=!1),o[r].after&&!n&&(o[r].after=!1)):(i.push(r),o[r]={before:e,after:n})}}i.sort(Tne);let c=n.before?n.before.length:0,l=r.length-(n.after?n.after.length:0);for(s=-1;++s<i.length;){let e=i[s];e<c||e>=l||e+1<l&&i[s+1]===e+1&&o[e].after&&!o[e+1].before&&!o[e+1].after||i[s-1]===e-1&&o[e].before&&!o[e-1].before&&!o[e-1].after||(c!==e&&a.push(Gx(r.slice(c,e),`\\`)),c=e,/[!-/:-@[-`{-~]/.test(r.charAt(e))&&(!n.encode||!n.encode.includes(r.charAt(e)))?a.push(`\\`):(a.push(yx(r.charCodeAt(e))),c++))}return a.push(Gx(r.slice(c,l),n.after)),a.join(``)}function Tne(e,t){return e-t}function Gx(e,t){let n=/\\(?=[!-/:-@[-`{-~])/g,r=[],i=[],a=e+t,o=-1,s=0,c;for(;c=n.exec(a);)r.push(c.index);for(;++o<r.length;)s!==r[o]&&i.push(e.slice(s,r[o])),i.push(`\\`),s=r[o];return i.push(e.slice(s)),i.join(``)}function Ene(e){let t=e||{},n=t.now||{},r=t.lineShift||0,i=n.line||1,a=n.column||1;return{move:c,current:o,shift:s};function o(){return{now:{line:i,column:a},lineShift:r}}function s(e){r+=e}function c(e){let t=e||``,n=t.split(/\r?\n|\r/g),o=n[n.length-1];return i+=n.length-1,a=n.length===1?a+o.length:1+o.length+r,t}}function Kx(e,t){let n=t||{},r={associationId:_ne,containerPhrasing:Ane,containerFlow:jne,createTracker:Ene,compilePattern:vne,enter:a,handlers:{...Vx},handle:void 0,indentLines:Cne,indexStack:[],join:[...fne],options:{},safe:Mne,stack:[],unsafe:[...mne]};ux(r,n),r.options.tightDefinitions&&r.join.push(kne),r.handle=cx(`type`,{invalid:Dne,unknown:One,handlers:r.handlers});let i=r.handle(e,void 0,r,{before:`
73
+ `,after:`
74
+ `,now:{line:1,column:1},lineShift:0});return i&&i.charCodeAt(i.length-1)!==10&&i.charCodeAt(i.length-1)!==13&&(i+=`
75
+ `),i;function a(e){return r.stack.push(e),t;function t(){r.stack.pop()}}}function Dne(e){throw Error("Cannot handle value `"+e+"`, expected node")}function One(e){throw Error("Cannot handle unknown node `"+e.type+"`")}function kne(e,t){if(e.type===`definition`&&e.type===t.type)return 0}function Ane(e,t){return yne(e,this,t)}function jne(e,t){return bne(e,this,t)}function Mne(e,t){return wne(this,e,t)}var Nne=[`mdxJsxTextElement`,`mdxJsxFlowElement`];function qx(e){return Nne.includes(e.type)&&Pne.includes(e.name)}var Pne=`a.abbr.address.area.article.aside.audio.b.base.bdi.bdo.blockquote.body.br.button.canvas.caption.cite.code.col.colgroup.data.datalist.dd.del.details.dfn.dialog.div.dl.dt.em.embed.fieldset.figcaption.figure.footer.form.h1.h2.h3.h4.h5.h6.head.header.hgroup.hr.html.i.iframe.input.ins.kbd.label.legend.li.link.main.map.mark.meta.meter.nav.noscript.object.ol.optgroup.option.output.p.param.picture.pre.progress.q.rp.rt.ruby.s.samp.script.section.select.small.source.span.strong.style.sub.summary.sup.table.tbody.td.template.textarea.tfoot.th.thead.time.title.tr.track.u.ul.var.video.wbr`.split(`.`);function Fne(e,t){let n=Jx(e),r=Jx(t);return Ine({...n,...r})}function Jx(e){let t={};return e.split(`;`).filter(e=>e.trim()!==``).forEach(e=>{let[n,r]=e.split(`:`).map(e=>e.trim());t[n]=r}),t}function Ine(e){return Object.entries(e).map(([e,t])=>`${e}: ${t}`).join(`; `)}function Lne(e){return e.children instanceof Array}function Yx({root:e,visitors:t,jsxComponentDescriptors:n,jsxIsAvailable:r,addImportStatements:i=!0}){let a=null,o=new Set,s=new Map;t=t.sort((e,t)=>(t.priority??0)-(e.priority??0)),d(e,null);function c(e,t){o.add(e),t&&s.set(e,{...t})}function l(e,n){if(a===null)return a=n,a;if(!Lne(e))throw Error(`Attempting to append children to a non-parent`);let r=e.children,i=r.at(-1);if(i){let e=t.find(e=>e.shouldJoin?.call(e,i,n));if(e){let t=e.join(i,n);return r.splice(r.length-1,1,t),t}}return r.push(n),n}function u(e,t){e.getChildren().forEach(e=>{d(e,t)})}function d(e,n,r=null){var i;let a=t.find((t,n)=>r?.has(n)?!1:t.testLexicalNode?.call(t,e));if(!a)throw Error(`no lexical visitor found for ${e.getType()}`,{cause:e});(i=a.visitLexicalNode)==null||i.call(a,{lexicalNode:e,mdastParent:n,actions:{addAndStepInto(t,r={},i=!0){let a={type:t,...r,...i?{children:[]}:{}};l(n,a),G(e)&&i&&u(e,a)},appendToParent:l,visitChildren:u,visit:d,registerReferredComponent:c,nextVisitor(){d(e,n,(r??new Set).add(t.indexOf(a)))}}})}if(a===null)throw Error(`traversal ended with no root element`);let f=new Map,p=new Map;for(let e of o){let t=n.find(t=>t.name===e)??s.get(e)??n.find(e=>e.name===`*`);if(!t)throw Error(`Component ${e} is used but not imported`);if(t.source)if(t.defaultExport)p.set(e,t.source);else{let{source:n}=t,r=f.get(n);r?r.push(e):f.set(n,[e])}}if(!i){for(let[e,t]of f.entries()){let n=t.filter(e=>s.has(e));n.length>0?f.set(e,n):f.delete(e)}for(let e of p.keys())s.has(e)||p.delete(e)}let m=Array.from(f).map(([e,t])=>({type:`mdxjsEsm`,value:`import { ${t.join(`, `)} } from '${e}'`}));m.push(...Array.from(p).map(([e,t])=>({type:`mdxjsEsm`,value:`import ${e} from '${t}'`})));let h=a,g=h.children.find(e=>e.type===`yaml`);return g?h.children.splice(h.children.indexOf(g)+1,0,...m):h.children.unshift(...m),eS(h,[]),Xx(h),r||Zx(h),h}function Xx(e){if(`children`in e&&e.children.length>0){if(qx(e)&&e.children.length===1){let t=e.children[0];t.type===`mdxJsxTextElement`&&t.name===`span`&&(t.attributes.forEach(t=>{if(t.type===`mdxJsxAttribute`){let n=e.attributes.find(e=>e.type===`mdxJsxAttribute`&&e.name===t.name);if(n)if(t.name===`className`){let e=new Set([...n.value.split(` `),...t.value.split(` `)]);n.value=Array.from(e).join(` `)}else t.name===`style`&&(n.value=Fne(n.value,t.value));else e.attributes.push(t)}}),e.children=t.children)}e.children.forEach(e=>{Xx(e)})}}function Zx(e){if(Object.hasOwn(e,`children`)){let t=e,n=[];t.children.forEach(e=>{e.type===`mdxJsxTextElement`&&e.name===`u`?n.push({type:`html`,value:`<u>`},...e.children,{type:`html`,value:`</u>`}):(n.push(e),Zx(e))}),t.children=n}}var Qx=/\s+$/,$x=/^\s+/;function eS(e,t){if(e.type===`strong`||e.type===`emphasis`){let n=e.children.at(-1);if(n?.type===`text`){let r=Qx.exec(n.value);if(r){n.value=n.value.replace(Qx,``);let i=t.at(-1);i&&(i.children.splice(i.children.indexOf(e)+1,0,{type:`text`,value:r[0]}),eS(i,t.slice(0,-1)))}}let r=e.children.at(0);if(r?.type===`text`){let n=$x.exec(r.value);if(n){r.value=r.value.replace($x,``);let i=t.at(-1);i&&(i.children.splice(i.children.indexOf(e),0,{type:`text`,value:n[0]}),eS(i,t.slice(0,-1)))}}}if(`children`in e&&e.children.length>0){let n=e;n.children.forEach(e=>{eS(e,[...t,n])})}}function Rne({root:e,toMarkdownOptions:t,toMarkdownExtensions:n,visitors:r,jsxComponentDescriptors:i,jsxIsAvailable:a}){return Kx(Yx({root:e,visitors:r,jsxComponentDescriptors:i,jsxIsAvailable:a}),{extensions:n,...t})+`
76
+ `}var tS={}.hasOwnProperty;function nS(e){let t={},n=-1;for(;++n<e.length;)zne(t,e[n]);return t}function zne(e,t){let n;for(n in t){let r=(tS.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],a;if(i)for(a in i){tS.call(r,a)||(r[a]=[]);let e=i[a];Bne(r[a],Array.isArray(e)?e:e?[e]:[])}}}function Bne(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add===`after`?e:r).push(t[n]);Ov(e,0,0,r)}function rS(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}function iS(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let a=e.charCodeAt(n),o=``;if(a===37&&jv(e.charCodeAt(n+1))&&jv(e.charCodeAt(n+2)))i=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(o=String.fromCharCode(a));else if(a>55295&&a<57344){let t=e.charCodeAt(n+1);a<56320&&t>56319&&t<57344?(o=String.fromCharCode(a,t),i=1):o=`�`}else o=String.fromCharCode(a);o&&=(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,``),i&&=(n+=i,0)}return t.join(``)+e.slice(r)}var Vne={tokenize:Hne};function Hne(e){let t=e.attempt(this.parser.constructs.contentInitial,r,i),n;return t;function r(n){if(n===null){e.consume(n);return}return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),Ob(e,t,`linePrefix`)}function i(t){return e.enter(`paragraph`),a(t)}function a(t){let r=e.enter(`chunkText`,{contentType:`text`,previous:n});return n&&(n.next=r),n=r,o(t)}function o(t){if(t===null){e.exit(`chunkText`),e.exit(`paragraph`),e.consume(t);return}return Pv(t)?(e.consume(t),e.exit(`chunkText`),a):(e.consume(t),o)}}var Une={tokenize:oS},aS={tokenize:sS};function oS(e){let t=this,n=[],r=0,i,a,o;return s;function s(i){if(r<n.length){let a=n[r];return t.containerState=a[1],e.attempt(a[0].continuation,c,l)(i)}return l(i)}function c(e){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&v();let n=t.events.length,a=n,o;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){o=t.events[a][1].end;break}_(r);let s=n;for(;s<t.events.length;)t.events[s][1].end={...o},s++;return Ov(t.events,a+1,0,t.events.slice(n)),t.events.length=s,l(e)}return s(e)}function l(a){if(r===n.length){if(!i)return f(a);if(i.currentConstruct&&i.currentConstruct.concrete)return m(a);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(aS,u,d)(a)}function u(e){return i&&v(),_(r),f(e)}function d(e){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,m(e)}function f(n){return t.containerState={},e.attempt(aS,p,m)(n)}function p(e){return r++,n.push([t.currentConstruct,t.containerState]),f(e)}function m(n){if(n===null){i&&v(),_(0),e.consume(n);return}return i||=t.parser.flow(t.now()),e.enter(`chunkFlow`,{_tokenizer:i,contentType:`flow`,previous:a}),h(n)}function h(n){if(n===null){g(e.exit(`chunkFlow`),!0),_(0),e.consume(n);return}return Pv(n)?(e.consume(n),g(e.exit(`chunkFlow`)),r=0,t.interrupt=void 0,s):(e.consume(n),h)}function g(e,n){let s=t.sliceStream(e);if(n&&s.push(null),e.previous=a,a&&(a.next=e),a=e,i.defineSkip(e.start),i.write(s),t.parser.lazy[e.start.line]){let e=i.events.length;for(;e--;)if(i.events[e][1].start.offset<o&&(!i.events[e][1].end||i.events[e][1].end.offset>o))return;let n=t.events.length,a=n,s,c;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){if(s){c=t.events[a][1].end;break}s=!0}for(_(r),e=n;e<t.events.length;)t.events[e][1].end={...c},e++;Ov(t.events,a+1,0,t.events.slice(n)),t.events.length=e}}function _(r){let i=n.length;for(;i-- >r;){let r=n[i];t.containerState=r[1],r[0].exit.call(t,e)}n.length=r}function v(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function sS(e,t,n){return Ob(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}var cS={name:`attention`,resolveAll:lS,tokenize:uS};function lS(e,t){let n=-1,r,i,a,o,s,c,l,u;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`attentionSequence`&&e[n][1]._close){for(r=n;r--;)if(e[r][0]===`exit`&&e[r][1].type===`attentionSequence`&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;let d={...e[r][1].end},f={...e[n][1].start};dS(d,-c),dS(f,c),o={type:c>1?`strongSequence`:`emphasisSequence`,start:d,end:{...e[r][1].end}},s={type:c>1?`strongSequence`:`emphasisSequence`,start:{...e[n][1].start},end:f},a={type:c>1?`strongText`:`emphasisText`,start:{...e[r][1].end},end:{...e[n][1].start}},i={type:c>1?`strong`:`emphasis`,start:{...o.start},end:{...s.end}},e[r][1].end={...o.start},e[n][1].start={...s.end},l=[],e[r][1].end.offset-e[r][1].start.offset&&(l=kv(l,[[`enter`,e[r][1],t],[`exit`,e[r][1],t]])),l=kv(l,[[`enter`,i,t],[`enter`,o,t],[`exit`,o,t],[`enter`,a,t]]),l=kv(l,Vv(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),l=kv(l,[[`exit`,a,t],[`enter`,s,t],[`exit`,s,t],[`exit`,i,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,l=kv(l,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])):u=0,Ov(e,r-1,n-r+3,l),n=r+l.length-u-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`attentionSequence`&&(e[n][1].type=`data`);return e}function uS(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=Bv(r),a;return o;function o(t){return a=t,e.enter(`attentionSequence`),s(t)}function s(o){if(o===a)return e.consume(o),s;let c=e.exit(`attentionSequence`),l=Bv(o),u=!l||l===2&&i||n.includes(o),d=!i||i===2&&l||n.includes(r);return c._open=!!(a===42?u:u&&(i||!d)),c._close=!!(a===42?d:d&&(l||!u)),t(o)}}function dS(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var fS={name:`autolink`,tokenize:pS};function pS(e,t,n){let r=0;return i;function i(t){return e.enter(`autolink`),e.enter(`autolinkMarker`),e.consume(t),e.exit(`autolinkMarker`),e.enter(`autolinkProtocol`),a}function a(t){return Av(t)?(e.consume(t),o):t===64?n(t):l(t)}function o(e){return e===43||e===45||e===46||jv(e)?(r=1,s(e)):l(e)}function s(t){return t===58?(e.consume(t),r=0,c):(t===43||t===45||t===46||jv(t))&&r++<32?(e.consume(t),s):(r=0,l(t))}function c(r){return r===62?(e.exit(`autolinkProtocol`),e.enter(`autolinkMarker`),e.consume(r),e.exit(`autolinkMarker`),e.exit(`autolink`),t):r===null||r===32||r===60||Mv(r)?n(r):(e.consume(r),c)}function l(t){return t===64?(e.consume(t),u):tte(t)?(e.consume(t),l):n(t)}function u(e){return jv(e)?d(e):n(e)}function d(n){return n===46?(e.consume(n),r=0,u):n===62?(e.exit(`autolinkProtocol`).type=`autolinkEmail`,e.enter(`autolinkMarker`),e.consume(n),e.exit(`autolinkMarker`),e.exit(`autolink`),t):f(n)}function f(t){if((t===45||jv(t))&&r++<63){let n=t===45?f:d;return e.consume(t),n}return n(t)}}var mS={partial:!0,tokenize:hS};function hS(e,t,n){return r;function r(t){return Iv(t)?Ob(e,i,`linePrefix`)(t):i(t)}function i(e){return e===null||Pv(e)?t(e):n(e)}}var gS={continuation:{tokenize:vS},exit:yS,name:`blockQuote`,tokenize:_S};function _S(e,t,n){let r=this;return i;function i(t){if(t===62){let n=r.containerState;return n.open||=(e.enter(`blockQuote`,{_container:!0}),!0),e.enter(`blockQuotePrefix`),e.enter(`blockQuoteMarker`),e.consume(t),e.exit(`blockQuoteMarker`),a}return n(t)}function a(n){return Iv(n)?(e.enter(`blockQuotePrefixWhitespace`),e.consume(n),e.exit(`blockQuotePrefixWhitespace`),e.exit(`blockQuotePrefix`),t):(e.exit(`blockQuotePrefix`),t(n))}}function vS(e,t,n){let r=this;return i;function i(t){return Iv(t)?Ob(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):a(t)}function a(r){return e.attempt(gS,t,n)(r)}}function yS(e){e.exit(`blockQuote`)}var bS={name:`characterEscape`,tokenize:xS};function xS(e,t,n){return r;function r(t){return e.enter(`characterEscape`),e.enter(`escapeMarker`),e.consume(t),e.exit(`escapeMarker`),i}function i(r){return rte(r)?(e.enter(`characterEscapeValue`),e.consume(r),e.exit(`characterEscapeValue`),e.exit(`characterEscape`),t):n(r)}}var SS={name:`characterReference`,tokenize:CS};function CS(e,t,n){let r=this,i=0,a,o;return s;function s(t){return e.enter(`characterReference`),e.enter(`characterReferenceMarker`),e.consume(t),e.exit(`characterReferenceMarker`),c}function c(t){return t===35?(e.enter(`characterReferenceMarkerNumeric`),e.consume(t),e.exit(`characterReferenceMarkerNumeric`),l):(e.enter(`characterReferenceValue`),a=31,o=jv,u(t))}function l(t){return t===88||t===120?(e.enter(`characterReferenceMarkerHexadecimal`),e.consume(t),e.exit(`characterReferenceMarkerHexadecimal`),e.enter(`characterReferenceValue`),a=6,o=nte,u):(e.enter(`characterReferenceValue`),a=7,o=Nv,u(t))}function u(s){if(s===59&&i){let i=e.exit(`characterReferenceValue`);return o===jv&&!Qv(r.sliceSerialize(i))?n(s):(e.enter(`characterReferenceMarker`),e.consume(s),e.exit(`characterReferenceMarker`),e.exit(`characterReference`),t)}return o(s)&&i++<a?(e.consume(s),u):n(s)}}var wS={partial:!0,tokenize:DS},TS={concrete:!0,name:`codeFenced`,tokenize:ES};function ES(e,t,n){let r=this,i={partial:!0,tokenize:x},a=0,o=0,s;return c;function c(e){return l(e)}function l(t){let n=r.events[r.events.length-1];return a=n&&n[1].type===`linePrefix`?n[2].sliceSerialize(n[1],!0).length:0,s=t,e.enter(`codeFenced`),e.enter(`codeFencedFence`),e.enter(`codeFencedFenceSequence`),u(t)}function u(t){return t===s?(o++,e.consume(t),u):o<3?n(t):(e.exit(`codeFencedFenceSequence`),Iv(t)?Ob(e,d,`whitespace`)(t):d(t))}function d(n){return n===null||Pv(n)?(e.exit(`codeFencedFence`),r.interrupt?t(n):e.check(wS,h,b)(n)):(e.enter(`codeFencedFenceInfo`),e.enter(`chunkString`,{contentType:`string`}),f(n))}function f(t){return t===null||Pv(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),d(t)):Iv(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),Ob(e,p,`whitespace`)(t)):t===96&&t===s?n(t):(e.consume(t),f)}function p(t){return t===null||Pv(t)?d(t):(e.enter(`codeFencedFenceMeta`),e.enter(`chunkString`,{contentType:`string`}),m(t))}function m(t){return t===null||Pv(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceMeta`),d(t)):t===96&&t===s?n(t):(e.consume(t),m)}function h(t){return e.attempt(i,b,g)(t)}function g(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),_}function _(t){return a>0&&Iv(t)?Ob(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||Pv(t)?e.check(wS,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||Pv(t)?(e.exit(`codeFlowValue`),v(t)):(e.consume(t),y)}function b(n){return e.exit(`codeFenced`),t(n)}function x(e,t,n){let i=0;return a;function a(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c}function c(t){return e.enter(`codeFencedFence`),Iv(t)?Ob(e,l,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):l(t)}function l(t){return t===s?(e.enter(`codeFencedFenceSequence`),u(t)):n(t)}function u(t){return t===s?(i++,e.consume(t),u):i>=o?(e.exit(`codeFencedFenceSequence`),Iv(t)?Ob(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||Pv(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}function DS(e,t,n){let r=this;return i;function i(t){return t===null?n(t):(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}var OS={name:`codeIndented`,tokenize:AS},kS={partial:!0,tokenize:jS};function AS(e,t,n){let r=this;return i;function i(t){return e.enter(`codeIndented`),Ob(e,a,`linePrefix`,5)(t)}function a(e){let t=r.events[r.events.length-1];return t&&t[1].type===`linePrefix`&&t[2].sliceSerialize(t[1],!0).length>=4?o(e):n(e)}function o(t){return t===null?c(t):Pv(t)?e.attempt(kS,o,c)(t):(e.enter(`codeFlowValue`),s(t))}function s(t){return t===null||Pv(t)?(e.exit(`codeFlowValue`),o(t)):(e.consume(t),s)}function c(n){return e.exit(`codeIndented`),t(n)}}function jS(e,t,n){let r=this;return i;function i(t){return r.parser.lazy[r.now().line]?n(t):Pv(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),i):Ob(e,a,`linePrefix`,5)(t)}function a(e){let a=r.events[r.events.length-1];return a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(e):Pv(e)?i(e):n(e)}}var MS={name:`codeText`,previous:PS,resolve:NS,tokenize:FS};function NS(e){let t=e.length-4,n=3,r,i;if((e[n][1].type===`lineEnding`||e[n][1].type===`space`)&&(e[t][1].type===`lineEnding`||e[t][1].type===`space`)){for(r=n;++r<t;)if(e[r][1].type===`codeTextData`){e[n][1].type=`codeTextPadding`,e[t][1].type=`codeTextPadding`,n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!==`lineEnding`&&(i=r):(r===t||e[r][1].type===`lineEnding`)&&(e[i][1].type=`codeTextData`,r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function PS(e){return e!==96||this.events[this.events.length-1][1].type===`characterEscape`}function FS(e,t,n){let r=0,i,a;return o;function o(t){return e.enter(`codeText`),e.enter(`codeTextSequence`),s(t)}function s(t){return t===96?(e.consume(t),r++,s):(e.exit(`codeTextSequence`),c(t))}function c(t){return t===null?n(t):t===32?(e.enter(`space`),e.consume(t),e.exit(`space`),c):t===96?(a=e.enter(`codeTextSequence`),i=0,u(t)):Pv(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c):(e.enter(`codeTextData`),l(t))}function l(t){return t===null||t===32||t===96||Pv(t)?(e.exit(`codeTextData`),c(t)):(e.consume(t),l)}function u(n){return n===96?(e.consume(n),i++,u):i===r?(e.exit(`codeTextSequence`),e.exit(`codeText`),t(n)):(a.type=`codeTextData`,l(n))}}var IS=class{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){let n=t??1/0;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){let r=t||0;this.setCursor(Math.trunc(e));let i=this.right.splice(this.right.length-r,1/0);return n&&LS(this.left,n),i.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),LS(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),LS(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){let t=this.left.splice(e,1/0);LS(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);LS(this.left,t.reverse())}}};function LS(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function RS(e){let t={},n=-1,r,i,a,o,s,c,l,u=new IS(e);for(;++n<u.length;){for(;n in t;)n=t[n];if(r=u.get(n),n&&r[1].type===`chunkFlow`&&u.get(n-1)[1].type===`listItemPrefix`&&(c=r[1]._tokenizer.events,a=0,a<c.length&&c[a][1].type===`lineEndingBlank`&&(a+=2),a<c.length&&c[a][1].type===`content`))for(;++a<c.length&&c[a][1].type!==`content`;)c[a][1].type===`chunkText`&&(c[a][1]._isInFirstContentOfListItem=!0,a++);if(r[0]===`enter`)r[1].contentType&&(Object.assign(t,zS(u,n)),n=t[n],l=!0);else if(r[1]._container){for(a=n,i=void 0;a--;)if(o=u.get(a),o[1].type===`lineEnding`||o[1].type===`lineEndingBlank`)o[0]===`enter`&&(i&&(u.get(i)[1].type=`lineEndingBlank`),o[1].type=`lineEnding`,i=a);else if(!(o[1].type===`linePrefix`||o[1].type===`listItemIndent`))break;i&&(r[1].end={...u.get(i)[1].start},s=u.slice(i,n),s.unshift(r),u.splice(i,n-i+1,s))}}return Ov(e,0,1/0,u.slice(0)),!l}function zS(e,t){let n=e.get(t)[1],r=e.get(t)[2],i=t-1,a=[],o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));let s=o.events,c=[],l={},u,d,f=-1,p=n,m=0,h=0,g=[h];for(;p;){for(;e.get(++i)[1]!==p;);a.push(i),p._tokenizer||(u=r.sliceStream(p),p.next||u.push(null),d&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=n;++f<s.length;)s[f][0]===`exit`&&s[f-1][0]===`enter`&&s[f][1].type===s[f-1][1].type&&s[f][1].start.line!==s[f][1].end.line&&(h=f+1,g.push(h),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):g.pop(),f=g.length;f--;){let t=s.slice(g[f],g[f+1]),n=a.pop();c.push([n,n+t.length-1]),e.splice(n,2,t)}for(c.reverse(),f=-1;++f<c.length;)l[m+c[f][0]]=m+c[f][1],m+=c[f][1]-c[f][0]-1;return l}var BS={resolve:HS,tokenize:US},VS={partial:!0,tokenize:WS};function HS(e){return RS(e),e}function US(e,t){let n;return r;function r(t){return e.enter(`content`),n=e.enter(`chunkContent`,{contentType:`content`}),i(t)}function i(t){return t===null?a(t):Pv(t)?e.check(VS,o,a)(t):(e.consume(t),i)}function a(n){return e.exit(`chunkContent`),e.exit(`content`),t(n)}function o(t){return e.consume(t),e.exit(`chunkContent`),n.next=e.enter(`chunkContent`,{contentType:`content`,previous:n}),n=n.next,i}}function WS(e,t,n){let r=this;return i;function i(t){return e.exit(`chunkContent`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),Ob(e,a,`linePrefix`)}function a(i){if(i===null||Pv(i))return n(i);let a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes(`codeIndented`)&&a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}function GS(e,t,n,r,i,a,o,s,c){let l=c||1/0,u=0;return d;function d(t){return t===60?(e.enter(r),e.enter(i),e.enter(a),e.consume(t),e.exit(a),f):t===null||t===32||t===41||Mv(t)?n(t):(e.enter(r),e.enter(o),e.enter(s),e.enter(`chunkString`,{contentType:`string`}),h(t))}function f(n){return n===62?(e.enter(a),e.consume(n),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(s),e.enter(`chunkString`,{contentType:`string`}),p(n))}function p(t){return t===62?(e.exit(`chunkString`),e.exit(s),f(t)):t===null||t===60||Pv(t)?n(t):(e.consume(t),t===92?m:p)}function m(t){return t===60||t===62||t===92?(e.consume(t),p):p(t)}function h(i){return!u&&(i===null||i===41||Fv(i))?(e.exit(`chunkString`),e.exit(s),e.exit(o),e.exit(r),t(i)):u<l&&i===40?(e.consume(i),u++,h):i===41?(e.consume(i),u--,h):i===null||i===32||i===40||Mv(i)?n(i):(e.consume(i),i===92?g:h)}function g(t){return t===40||t===41||t===92?(e.consume(t),h):h(t)}}function KS(e,t,n,r,i,a){let o=this,s=0,c;return l;function l(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),e.enter(a),u}function u(l){return s>999||l===null||l===91||l===93&&!c||l===94&&!s&&`_hiddenFootnoteSupport`in o.parser.constructs?n(l):l===93?(e.exit(a),e.enter(i),e.consume(l),e.exit(i),e.exit(r),t):Pv(l)?(e.enter(`lineEnding`),e.consume(l),e.exit(`lineEnding`),u):(e.enter(`chunkString`,{contentType:`string`}),d(l))}function d(t){return t===null||t===91||t===93||Pv(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!Iv(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function qS(e,t,n,r,i,a){let o;return s;function s(t){return t===34||t===39||t===40?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),o=t===40?41:t,c):n(t)}function c(n){return n===o?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),l(n))}function l(t){return t===o?(e.exit(a),c(o)):t===null?n(t):Pv(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),Ob(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||Pv(t)?(e.exit(`chunkString`),l(t)):(e.consume(t),t===92?d:u)}function d(t){return t===o||t===92?(e.consume(t),u):u(t)}}function JS(e,t){let n;return r;function r(i){return Pv(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):Iv(i)?Ob(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var YS={name:`definition`,tokenize:ZS},XS={partial:!0,tokenize:QS};function ZS(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return KS.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=rS(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),c):n(t)}function c(t){return Fv(t)?JS(e,l)(t):l(t)}function l(t){return GS(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(XS,d,d)(t)}function d(t){return Iv(t)?Ob(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||Pv(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function QS(e,t,n){return r;function r(t){return Fv(t)?JS(e,i)(t):n(t)}function i(t){return qS(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return Iv(t)?Ob(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||Pv(e)?t(e):n(e)}}var $S={name:`hardBreakEscape`,tokenize:eC};function eC(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return Pv(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}var tC={name:`headingAtx`,resolve:nC,tokenize:rC};function nC(e,t){let n=e.length-2,r=3,i,a;return e[r][1].type===`whitespace`&&(r+=2),n-2>r&&e[n][1].type===`whitespace`&&(n-=2),e[n][1].type===`atxHeadingSequence`&&(r===n-1||n-4>r&&e[n-2][1].type===`whitespace`)&&(n-=r+1===n?2:4),n>r&&(i={type:`atxHeadingText`,start:e[r][1].start,end:e[n][1].end},a={type:`chunkText`,start:e[r][1].start,end:e[n][1].end,contentType:`text`},Ov(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])),e}function rC(e,t,n){let r=0;return i;function i(t){return e.enter(`atxHeading`),a(t)}function a(t){return e.enter(`atxHeadingSequence`),o(t)}function o(t){return t===35&&r++<6?(e.consume(t),o):t===null||Fv(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||Pv(n)?(e.exit(`atxHeading`),t(n)):Iv(n)?Ob(e,s,`whitespace`)(n):(e.enter(`atxHeadingText`),l(n))}function c(t){return t===35?(e.consume(t),c):(e.exit(`atxHeadingSequence`),s(t))}function l(t){return t===null||t===35||Fv(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var iC=`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.h1.h2.h3.h4.h5.h6.head.header.hr.html.iframe.legend.li.link.main.menu.menuitem.nav.noframes.ol.optgroup.option.p.param.search.section.summary.table.tbody.td.tfoot.th.thead.title.tr.track.ul`.split(`.`),aC=[`pre`,`script`,`style`,`textarea`],oC={concrete:!0,name:`htmlFlow`,resolveTo:lC,tokenize:uC},sC={partial:!0,tokenize:fC},cC={partial:!0,tokenize:dC};function lC(e){let t=e.length;for(;t--&&!(e[t][0]===`enter`&&e[t][1].type===`htmlFlow`););return t>1&&e[t-2][1].type===`linePrefix`&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function uC(e,t,n){let r=this,i,a,o,s,c;return l;function l(e){return u(e)}function u(t){return e.enter(`htmlFlow`),e.enter(`htmlFlowData`),e.consume(t),d}function d(s){return s===33?(e.consume(s),f):s===47?(e.consume(s),a=!0,h):s===63?(e.consume(s),i=3,r.interrupt?t:te):Av(s)?(e.consume(s),o=String.fromCharCode(s),g):n(s)}function f(a){return a===45?(e.consume(a),i=2,p):a===91?(e.consume(a),i=5,s=0,m):Av(a)?(e.consume(a),i=4,r.interrupt?t:te):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:te):n(i)}function m(i){return i===`CDATA[`.charCodeAt(s++)?(e.consume(i),s===6?r.interrupt?t:O:m):n(i)}function h(t){return Av(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||Fv(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&aC.includes(l)?(i=1,r.interrupt?t(s):O(s)):iC.includes(o.toLowerCase())?(i=6,c?(e.consume(s),_):r.interrupt?t(s):O(s)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(s):a?v(s):y(s))}return s===45||jv(s)?(e.consume(s),o+=String.fromCharCode(s),g):n(s)}function _(i){return i===62?(e.consume(i),r.interrupt?t:O):n(i)}function v(t){return Iv(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||Av(t)?(e.consume(t),b):Iv(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||jv(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):Iv(t)?(e.consume(t),x):y(t)}function S(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),c=t,C):Iv(t)?(e.consume(t),S):w(t)}function C(t){return t===c?(e.consume(t),c=null,T):t===null||Pv(t)?n(t):(e.consume(t),C)}function w(t){return t===null||t===34||t===39||t===47||t===60||t===61||t===62||t===96||Fv(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||Iv(e)?y(e):n(e)}function E(t){return t===62?(e.consume(t),D):n(t)}function D(t){return t===null||Pv(t)?O(t):Iv(t)?(e.consume(t),D):n(t)}function O(t){return t===45&&i===2?(e.consume(t),M):t===60&&i===1?(e.consume(t),N):t===62&&i===4?(e.consume(t),ne):t===63&&i===3?(e.consume(t),te):t===93&&i===5?(e.consume(t),ee):Pv(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(sC,F,k)(t)):t===null||Pv(t)?(e.exit(`htmlFlowData`),k(t)):(e.consume(t),O)}function k(t){return e.check(cC,A,F)(t)}function A(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),j}function j(t){return t===null||Pv(t)?k(t):(e.enter(`htmlFlowData`),O(t))}function M(t){return t===45?(e.consume(t),te):O(t)}function N(t){return t===47?(e.consume(t),o=``,P):O(t)}function P(t){if(t===62){let n=o.toLowerCase();return aC.includes(n)?(e.consume(t),ne):O(t)}return Av(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),P):O(t)}function ee(t){return t===93?(e.consume(t),te):O(t)}function te(t){return t===62?(e.consume(t),ne):t===45&&i===2?(e.consume(t),te):O(t)}function ne(t){return t===null||Pv(t)?(e.exit(`htmlFlowData`),F(t)):(e.consume(t),ne)}function F(n){return e.exit(`htmlFlow`),t(n)}}function dC(e,t,n){let r=this;return i;function i(t){return Pv(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a):n(t)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}function fC(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(mS,t,n)}}var pC={name:`htmlText`,tokenize:mC};function mC(e,t,n){let r=this,i,a,o;return s;function s(t){return e.enter(`htmlText`),e.enter(`htmlTextData`),e.consume(t),c}function c(t){return t===33?(e.consume(t),l):t===47?(e.consume(t),x):t===63?(e.consume(t),y):Av(t)?(e.consume(t),w):n(t)}function l(t){return t===45?(e.consume(t),u):t===91?(e.consume(t),a=0,m):Av(t)?(e.consume(t),v):n(t)}function u(t){return t===45?(e.consume(t),p):n(t)}function d(t){return t===null?n(t):t===45?(e.consume(t),f):Pv(t)?(o=d,N(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?M(e):e===45?f(e):d(e)}function m(t){return t===`CDATA[`.charCodeAt(a++)?(e.consume(t),a===6?h:m):n(t)}function h(t){return t===null?n(t):t===93?(e.consume(t),g):Pv(t)?(o=h,N(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?M(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?M(t):Pv(t)?(o=v,N(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):Pv(t)?(o=y,N(t)):(e.consume(t),y)}function b(e){return e===62?M(e):y(e)}function x(t){return Av(t)?(e.consume(t),S):n(t)}function S(t){return t===45||jv(t)?(e.consume(t),S):C(t)}function C(t){return Pv(t)?(o=C,N(t)):Iv(t)?(e.consume(t),C):M(t)}function w(t){return t===45||jv(t)?(e.consume(t),w):t===47||t===62||Fv(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),M):t===58||t===95||Av(t)?(e.consume(t),E):Pv(t)?(o=T,N(t)):Iv(t)?(e.consume(t),T):M(t)}function E(t){return t===45||t===46||t===58||t===95||jv(t)?(e.consume(t),E):D(t)}function D(t){return t===61?(e.consume(t),O):Pv(t)?(o=D,N(t)):Iv(t)?(e.consume(t),D):T(t)}function O(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),i=t,k):Pv(t)?(o=O,N(t)):Iv(t)?(e.consume(t),O):(e.consume(t),A)}function k(t){return t===i?(e.consume(t),i=void 0,j):t===null?n(t):Pv(t)?(o=k,N(t)):(e.consume(t),k)}function A(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||Fv(t)?T(t):(e.consume(t),A)}function j(e){return e===47||e===62||Fv(e)?T(e):n(e)}function M(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function N(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),P}function P(t){return Iv(t)?Ob(e,ee,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):ee(t)}function ee(t){return e.enter(`htmlTextData`),o(t)}}var hC={name:`labelEnd`,resolveAll:yC,resolveTo:bC,tokenize:xC},gC={tokenize:SC},_C={tokenize:CC},vC={tokenize:wC};function yC(e){let t=-1,n=[];for(;++t<e.length;){let r=e[t][1];if(n.push(e[t]),r.type===`labelImage`||r.type===`labelLink`||r.type===`labelEnd`){let e=r.type===`labelImage`?4:2;r.type=`data`,t+=e}}return e.length!==n.length&&Ov(e,0,e.length,n),e}function bC(e,t){let n=e.length,r=0,i,a,o,s;for(;n--;)if(i=e[n][1],a){if(i.type===`link`||i.type===`labelLink`&&i._inactive)break;e[n][0]===`enter`&&i.type===`labelLink`&&(i._inactive=!0)}else if(o){if(e[n][0]===`enter`&&(i.type===`labelImage`||i.type===`labelLink`)&&!i._balanced&&(a=n,i.type!==`labelLink`)){r=2;break}}else i.type===`labelEnd`&&(o=n);let c={type:e[a][1].type===`labelLink`?`link`:`image`,start:{...e[a][1].start},end:{...e[e.length-1][1].end}},l={type:`label`,start:{...e[a][1].start},end:{...e[o][1].end}},u={type:`labelText`,start:{...e[a+r+2][1].end},end:{...e[o-2][1].start}};return s=[[`enter`,c,t],[`enter`,l,t]],s=kv(s,e.slice(a+1,a+r+3)),s=kv(s,[[`enter`,u,t]]),s=kv(s,Vv(t.parser.constructs.insideSpan.null,e.slice(a+r+4,o-3),t)),s=kv(s,[[`exit`,u,t],e[o-2],e[o-1],[`exit`,l,t]]),s=kv(s,e.slice(o+1)),s=kv(s,[[`exit`,c,t]]),Ov(e,a,e.length,s),e}function xC(e,t,n){let r=this,i=r.events.length,a,o;for(;i--;)if((r.events[i][1].type===`labelImage`||r.events[i][1].type===`labelLink`)&&!r.events[i][1]._balanced){a=r.events[i][1];break}return s;function s(t){return a?a._inactive?d(t):(o=r.parser.defined.includes(rS(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter(`labelEnd`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelEnd`),c):n(t)}function c(t){return t===40?e.attempt(gC,u,o?u:d)(t):t===91?e.attempt(_C,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(vC,u,d)(t)}function u(e){return t(e)}function d(e){return a._balanced=!0,n(e)}}function SC(e,t,n){return r;function r(t){return e.enter(`resource`),e.enter(`resourceMarker`),e.consume(t),e.exit(`resourceMarker`),i}function i(t){return Fv(t)?JS(e,a)(t):a(t)}function a(t){return t===41?u(t):GS(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return Fv(t)?JS(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?qS(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return Fv(t)?JS(e,u)(t):u(t)}function u(r){return r===41?(e.enter(`resourceMarker`),e.consume(r),e.exit(`resourceMarker`),e.exit(`resource`),t):n(r)}}function CC(e,t,n){let r=this;return i;function i(t){return KS.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(rS(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function wC(e,t,n){return r;function r(t){return e.enter(`reference`),e.enter(`referenceMarker`),e.consume(t),e.exit(`referenceMarker`),i}function i(r){return r===93?(e.enter(`referenceMarker`),e.consume(r),e.exit(`referenceMarker`),e.exit(`reference`),t):n(r)}}var TC={name:`labelStartImage`,resolveAll:hC.resolveAll,tokenize:EC};function EC(e,t,n){let r=this;return i;function i(t){return e.enter(`labelImage`),e.enter(`labelImageMarker`),e.consume(t),e.exit(`labelImageMarker`),a}function a(t){return t===91?(e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelImage`),o):n(t)}function o(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var DC={name:`labelStartLink`,resolveAll:hC.resolveAll,tokenize:OC};function OC(e,t,n){let r=this;return i;function i(t){return e.enter(`labelLink`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelLink`),a}function a(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var kC={name:`lineEnding`,tokenize:AC};function AC(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),Ob(e,t,`linePrefix`)}}var jC={name:`thematicBreak`,tokenize:MC};function MC(e,t,n){let r=0,i;return a;function a(t){return e.enter(`thematicBreak`),o(t)}function o(e){return i=e,s(e)}function s(a){return a===i?(e.enter(`thematicBreakSequence`),c(a)):r>=3&&(a===null||Pv(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),Iv(t)?Ob(e,s,`whitespace`)(t):s(t))}}var NC={continuation:{tokenize:LC},exit:zC,name:`list`,tokenize:IC},PC={partial:!0,tokenize:BC},FC={partial:!0,tokenize:RC};function IC(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type===`linePrefix`?i[2].sliceSerialize(i[1],!0).length:0,o=0;return s;function s(t){let i=r.containerState.type||(t===42||t===43||t===45?`listUnordered`:`listOrdered`);if(i===`listUnordered`?!r.containerState.marker||t===r.containerState.marker:Nv(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),i===`listUnordered`)return e.enter(`listItemPrefix`),t===42||t===45?e.check(jC,n,l)(t):l(t);if(!r.interrupt||t===49)return e.enter(`listItemPrefix`),e.enter(`listItemValue`),c(t)}return n(t)}function c(t){return Nv(t)&&++o<10?(e.consume(t),c):(!r.interrupt||o<2)&&(r.containerState.marker?t===r.containerState.marker:t===41||t===46)?(e.exit(`listItemValue`),l(t)):n(t)}function l(t){return e.enter(`listItemMarker`),e.consume(t),e.exit(`listItemMarker`),r.containerState.marker=r.containerState.marker||t,e.check(mS,r.interrupt?n:u,e.attempt(PC,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return Iv(t)?(e.enter(`listItemPrefixWhitespace`),e.consume(t),e.exit(`listItemPrefixWhitespace`),f):n(t)}function f(n){return r.containerState.size=a+r.sliceSerialize(e.exit(`listItemPrefix`),!0).length,t(n)}}function LC(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(mS,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Ob(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!Iv(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(FC,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,Ob(e,e.attempt(NC,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function RC(e,t,n){let r=this;return Ob(e,i,`listItemIndent`,r.containerState.size+1);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`listItemIndent`&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)}}function zC(e){e.exit(this.containerState.type)}function BC(e,t,n){let r=this;return Ob(e,i,`listItemPrefixWhitespace`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:5);function i(e){let i=r.events[r.events.length-1];return!Iv(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var VC={name:`setextUnderline`,resolveTo:HC,tokenize:UC};function HC(e,t){let n=e.length,r,i,a;for(;n--;)if(e[n][0]===`enter`){if(e[n][1].type===`content`){r=n;break}e[n][1].type===`paragraph`&&(i=n)}else e[n][1].type===`content`&&e.splice(n,1),!a&&e[n][1].type===`definition`&&(a=n);let o={type:`setextHeading`,start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type=`setextHeadingText`,a?(e.splice(i,0,[`enter`,o,t]),e.splice(a+1,0,[`exit`,e[r][1],t]),e[r][1].end={...e[a][1].end}):e[r][1]=o,e.push([`exit`,o,t]),e}function UC(e,t,n){let r=this,i;return a;function a(t){let a=r.events.length,s;for(;a--;)if(r.events[a][1].type!==`lineEnding`&&r.events[a][1].type!==`linePrefix`&&r.events[a][1].type!==`content`){s=r.events[a][1].type===`paragraph`;break}return!r.parser.lazy[r.now().line]&&(r.interrupt||s)?(e.enter(`setextHeadingLine`),i=t,o(t)):n(t)}function o(t){return e.enter(`setextHeadingLineSequence`),s(t)}function s(t){return t===i?(e.consume(t),s):(e.exit(`setextHeadingLineSequence`),Iv(t)?Ob(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||Pv(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var WC={tokenize:GC};function GC(e){let t=this,n=e.attempt(mS,r,e.attempt(this.parser.constructs.flowInitial,i,Ob(e,e.attempt(this.parser.constructs.flow,i,e.attempt(BS,i)),`linePrefix`)));return n;function r(r){if(r===null){e.consume(r);return}return e.enter(`lineEndingBlank`),e.consume(r),e.exit(`lineEndingBlank`),t.currentConstruct=void 0,n}function i(r){if(r===null){e.consume(r);return}return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),t.currentConstruct=void 0,n}}var KC={resolveAll:XC()},qC=YC(`string`),JC=YC(`text`);function YC(e){return{resolveAll:XC(e===`text`?ZC:void 0),tokenize:t};function t(t){let n=this,r=this.parser.constructs[e],i=t.attempt(r,a,o);return a;function a(e){return c(e)?i(e):o(e)}function o(e){if(e===null){t.consume(e);return}return t.enter(`data`),t.consume(e),s}function s(e){return c(e)?(t.exit(`data`),i(e)):(t.consume(e),s)}function c(e){if(e===null)return!0;let t=r[e],i=-1;if(t)for(;++i<t.length;){let e=t[i];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}}}function XC(e){return t;function t(t,n){let r=-1,i;for(;++r<=t.length;)i===void 0?t[r]&&t[r][1].type===`data`&&(i=r,r++):(!t[r]||t[r][1].type!==`data`)&&(r!==i+2&&(t[i][1].end=t[r-1][1].end,t.splice(i+2,r-i-2),r=i+2),i=void 0);return e?e(t,n):t}}function ZC(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type===`lineEnding`)&&e[n-1][1].type===`data`){let r=e[n-1][1],i=t.sliceStream(r),a=i.length,o=-1,s=0,c;for(;a--;){let e=i[a];if(typeof e==`string`){for(o=e.length;e.charCodeAt(o-1)===32;)s++,o--;if(o)break;o=-1}else if(e===-2)c=!0,s++;else if(e!==-1){a++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(s=0),s){let i={type:n===e.length||c||s<2?`lineSuffix`:`hardBreakTrailing`,start:{_bufferIndex:a?o:r.start._bufferIndex+o,_index:r.start._index+a,line:r.end.line,column:r.end.column-s,offset:r.end.offset-s},end:{...r.end}};r.end={...i.start},r.start.offset===r.end.offset?Object.assign(r,i):(e.splice(n,0,[`enter`,i,t],[`exit`,i,t]),n+=2)}n++}return e}var QC=e({attentionMarkers:()=>ow,contentInitial:()=>ew,disable:()=>sw,document:()=>$C,flow:()=>nw,flowInitial:()=>tw,insideSpan:()=>aw,string:()=>rw,text:()=>iw}),$C={42:NC,43:NC,45:NC,48:NC,49:NC,50:NC,51:NC,52:NC,53:NC,54:NC,55:NC,56:NC,57:NC,62:gS},ew={91:YS},tw={[-2]:OS,[-1]:OS,32:OS},nw={35:tC,42:jC,45:[VC,jC],60:oC,61:VC,95:jC,96:TS,126:TS},rw={38:SS,92:bS},iw={[-5]:kC,[-4]:kC,[-3]:kC,33:TC,38:SS,42:cS,60:[fS,pC],91:DC,92:[$S,bS],93:hC,95:cS,96:MS},aw={null:[cS,KC]},ow={null:[42,95]},sw={null:[]};function cw(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},i={},a=[],o=[],s=[],c={attempt:C(x),check:C(S),consume:v,enter:y,exit:b,interrupt:C(S,{interrupt:!0})},l={code:null,containerState:{},defineSkip:h,events:[],now:m,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:d},u=t.tokenize.call(l,c);return t.resolveAll&&a.push(t),l;function d(e){return o=kv(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=Vv(a,l.events,l),l.events):[]}function f(e,t){return uw(p(e),t)}function p(e){return lw(o,e)}function m(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:a}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:a}}function h(e){i[e.line]=e.column,E()}function g(){let e;for(;r._index<o.length;){let t=o[r._index];if(typeof t==`string`)for(e=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===e&&r._bufferIndex<t.length;)_(t.charCodeAt(r._bufferIndex));else _(t)}}function _(e){u=u(e)}function v(e){Pv(e)?(r.line++,r.column=1,r.offset+=e===-3?2:1,E()):e!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),l.previous=e}function y(e,t){let n=t||{};return n.type=e,n.start=m(),l.events.push([`enter`,n,l]),s.push(n),n}function b(e){let t=s.pop();return t.end=m(),l.events.push([`exit`,t,l]),t}function x(e,t){w(e,t.from)}function S(e,t){t.restore()}function C(e,t){return n;function n(n,r,i){let a,o,s,u;return Array.isArray(n)?f(n):`tokenize`in n?f([n]):d(n);function d(e){return t;function t(t){let n=t!==null&&e[t],r=t!==null&&e.null;return f([...Array.isArray(n)?n:n?[n]:[],...Array.isArray(r)?r:r?[r]:[]])(t)}}function f(e){return a=e,o=0,e.length===0?i:p(e[o])}function p(e){return n;function n(n){return u=T(),s=e,e.partial||(l.currentConstruct=e),e.name&&l.parser.constructs.disable.null.includes(e.name)?h(n):e.tokenize.call(t?Object.assign(Object.create(l),t):l,c,m,h)(n)}}function m(t){return e(s,u),r}function h(e){return u.restore(),++o<a.length?p(a[o]):i}}}function w(e,t){e.resolveAll&&!a.includes(e)&&a.push(e),e.resolve&&Ov(l.events,t,l.events.length-t,e.resolve(l.events.slice(t),l)),e.resolveTo&&(l.events=e.resolveTo(l.events,l))}function T(){let e=m(),t=l.previous,n=l.currentConstruct,i=l.events.length,a=Array.from(s);return{from:i,restore:o};function o(){r=e,l.previous=t,l.currentConstruct=n,l.events.length=i,s=a,E()}}function E(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function lw(e,t){let n=t.start._index,r=t.start._bufferIndex,i=t.end._index,a=t.end._bufferIndex,o;if(n===i)o=[e[n].slice(r,a)];else{if(o=e.slice(n,i),r>-1){let e=o[0];typeof e==`string`?o[0]=e.slice(r):o.shift()}a>0&&o.push(e[i].slice(0,a))}return o}function uw(e,t){let n=-1,r=[],i;for(;++n<e.length;){let a=e[n],o;if(typeof a==`string`)o=a;else switch(a){case-5:o=`\r`;break;case-4:o=`
77
+ `;break;case-3:o=`\r
78
+ `;break;case-2:o=t?` `:` `;break;case-1:if(!t&&i)continue;o=` `;break;default:o=String.fromCharCode(a)}i=a===-2,r.push(o)}return r.join(``)}function dw(e){let t={constructs:nS([QC,...(e||{}).extensions||[]]),content:n(Vne),defined:[],document:n(Une),flow:n(WC),lazy:{},string:n(qC),text:n(JC)};return t;function n(e){return n;function n(n){return cw(t,e,n)}}}function fw(e){for(;!RS(e););return e}var pw=/[\0\t\n\r]/g;function mw(){let e=1,t=``,n=!0,r;return i;function i(i,a,o){let s=[],c,l,u,d,f;for(i=t+(typeof i==`string`?i.toString():new TextDecoder(a||void 0).decode(i)),u=0,t=``,n&&=(i.charCodeAt(0)===65279&&u++,void 0);u<i.length;){if(pw.lastIndex=u,c=pw.exec(i),d=c&&c.index!==void 0?c.index:i.length,f=i.charCodeAt(d),!c){t=i.slice(u);break}if(f===10&&u===d&&r)s.push(-3),r=void 0;else switch(r&&=(s.push(-5),void 0),u<d&&(s.push(i.slice(u,d)),e+=d-u),f){case 0:s.push(65533),e++;break;case 9:for(l=Math.ceil(e/4)*4,s.push(-2);e++<l;)s.push(-1);break;case 10:s.push(-4),e=1;break;default:r=!0,e=1}u=d+1}return o&&(r&&s.push(-5),t&&s.push(t),s.push(null)),s}}var hw={}.hasOwnProperty;function gw(e,t,n){return t&&typeof t==`object`&&(n=t,t=void 0),_w(n)(fw(dw(n).document().write(mw()(e,t,!0))))}function _w(e){let t={transforms:[],canContainEols:[`emphasis`,`fragment`,`heading`,`paragraph`,`strong`],enter:{autolink:a(ve),autolinkProtocol:T,autolinkEmail:T,atxHeading:a(me),blockQuote:a(le),characterEscape:T,characterReference:T,codeFenced:a(ue),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:a(ue,o),codeText:a(de,o),codeTextData:T,data:T,codeFlowValue:T,definition:a(fe),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:a(pe),hardBreakEscape:a(he),hardBreakTrailing:a(he),htmlFlow:a(ge,o),htmlFlowData:T,htmlText:a(ge,o),htmlTextData:T,image:a(_e),label:o,link:a(ve),listItem:a(be),listItemValue:f,listOrdered:a(ye,d),listUnordered:a(ye),paragraph:a(xe),reference:re,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:a(me),strong:a(Se),thematicBreak:a(we)},exit:{atxHeading:c(),atxHeadingSequence:x,autolink:c(),autolinkEmail:ce,autolinkProtocol:se,blockQuote:c(),characterEscapeValue:E,characterReferenceMarkerHexadecimal:ie,characterReferenceMarkerNumeric:ie,characterReferenceValue:ae,characterReference:oe,codeFenced:c(g),codeFencedFence:h,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:E,codeIndented:c(_),codeText:c(j),codeTextData:E,data:E,definition:c(),definitionDestinationString:b,definitionLabelString:v,definitionTitleString:y,emphasis:c(),hardBreakEscape:c(O),hardBreakTrailing:c(O),htmlFlow:c(k),htmlFlowData:E,htmlText:c(A),htmlTextData:E,image:c(N),label:ee,labelText:P,lineEnding:D,link:c(M),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:I,resourceDestinationString:te,resourceTitleString:ne,resource:F,setextHeading:c(w),setextHeadingLineSequence:C,setextHeadingText:S,strong:c(),thematicBreak:c()}};yw(t,(e||{}).mdastExtensions||[]);let n={};return r;function r(e){let r={type:`root`,children:[]},a={stack:[r],tokenStack:[],config:t,enter:s,exit:l,buffer:o,resume:u,data:n},c=[],d=-1;for(;++d<e.length;)(e[d][1].type===`listOrdered`||e[d][1].type===`listUnordered`)&&(e[d][0]===`enter`?c.push(d):d=i(e,c.pop(),d));for(d=-1;++d<e.length;){let n=t[e[d][0]];hw.call(n,e[d][1].type)&&n[e[d][1].type].call(Object.assign({sliceSerialize:e[d][2].sliceSerialize},a),e[d][1])}if(a.tokenStack.length>0){let e=a.tokenStack[a.tokenStack.length-1];(e[1]||xw).call(a,void 0,e[0])}for(r.position={start:vw(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:vw(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},d=-1;++d<t.transforms.length;)r=t.transforms[d](r)||r;return r}function i(e,t,n){let r=t-1,i=-1,a=!1,o,s,c,l;for(;++r<=n;){let t=e[r];switch(t[1].type){case`listUnordered`:case`listOrdered`:case`blockQuote`:t[0]===`enter`?i++:i--,l=void 0;break;case`lineEndingBlank`:t[0]===`enter`&&(o&&!l&&!i&&!c&&(c=r),l=void 0);break;case`linePrefix`:case`listItemValue`:case`listItemMarker`:case`listItemPrefix`:case`listItemPrefixWhitespace`:break;default:l=void 0}if(!i&&t[0]===`enter`&&t[1].type===`listItemPrefix`||i===-1&&t[0]===`exit`&&(t[1].type===`listUnordered`||t[1].type===`listOrdered`)){if(o){let i=r;for(s=void 0;i--;){let t=e[i];if(t[1].type===`lineEnding`||t[1].type===`lineEndingBlank`){if(t[0]===`exit`)continue;s&&(e[s][1].type=`lineEndingBlank`,a=!0),t[1].type=`lineEnding`,s=i}else if(!(t[1].type===`linePrefix`||t[1].type===`blockQuotePrefix`||t[1].type===`blockQuotePrefixWhitespace`||t[1].type===`blockQuoteMarker`||t[1].type===`listItemIndent`))break}c&&(!s||c<s)&&(o._spread=!0),o.end=Object.assign({},s?e[s][1].start:t[1].end),e.splice(s||r,0,[`exit`,o,t[2]]),r++,n++}if(t[1].type===`listItemPrefix`){let i={type:`listItem`,_spread:!1,start:Object.assign({},t[1].start),end:void 0};o=i,e.splice(r,0,[`enter`,i,t[2]]),r++,n++,c=void 0,l=!0}}}return e[t][1]._spread=a,n}function a(e,t){return n;function n(n){s.call(this,e(n),n),t&&t.call(this,n)}}function o(){this.stack.push({type:`fragment`,children:[]})}function s(e,t,n){this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([t,n||void 0]),e.position={start:vw(t.start),end:void 0}}function c(e){return t;function t(t){e&&e.call(this,t),l.call(this,t)}}function l(e,t){let n=this.stack.pop(),r=this.tokenStack.pop();if(r)r[0].type!==e.type&&(t?t.call(this,e,r[0]):(r[1]||xw).call(this,e,r[0]));else throw Error("Cannot close `"+e.type+"` ("+py({start:e.start,end:e.end})+`): it’s not open`);n.position.end=vw(e.end)}function u(){return Dx(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function f(e){if(this.data.expectingFirstListItemValue){let t=this.stack[this.stack.length-2];t.start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0}}function p(){let e=this.resume(),t=this.stack[this.stack.length-1];t.lang=e}function m(){let e=this.resume(),t=this.stack[this.stack.length-1];t.meta=e}function h(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function g(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,``),this.data.flowCodeInside=void 0}function _(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/(\r?\n|\r)$/g,``)}function v(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=rS(this.sliceSerialize(e)).toLowerCase()}function y(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function b(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function x(e){let t=this.stack[this.stack.length-1];t.depth||=this.sliceSerialize(e).length}function S(){this.data.setextHeadingSlurpLineEnding=!0}function C(e){let t=this.stack[this.stack.length-1];t.depth=this.sliceSerialize(e).codePointAt(0)===61?1:2}function w(){this.data.setextHeadingSlurpLineEnding=void 0}function T(e){let t=this.stack[this.stack.length-1].children,n=t[t.length-1];(!n||n.type!==`text`)&&(n=Ce(),n.position={start:vw(e.start),end:void 0},t.push(n)),this.stack.push(n)}function E(e){let t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=vw(e.end)}function D(e){let n=this.stack[this.stack.length-1];if(this.data.atHardBreak){let t=n.children[n.children.length-1];t.position.end=vw(e.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(n.type)&&(T.call(this,e),E.call(this,e))}function O(){this.data.atHardBreak=!0}function k(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function A(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function j(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function M(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function N(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function P(e){let t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=Wx(t),n.identifier=rS(t).toLowerCase()}function ee(){let e=this.stack[this.stack.length-1],t=this.resume(),n=this.stack[this.stack.length-1];this.data.inReference=!0,n.type===`link`?n.children=e.children:n.alt=t}function te(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function ne(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function F(){this.data.inReference=void 0}function re(){this.data.referenceType=`collapsed`}function I(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=rS(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType=`full`}function ie(e){this.data.characterReferenceType=e.type}function ae(e){let t=this.sliceSerialize(e),n=this.data.characterReferenceType,r;n?(r=Ux(t,n===`characterReferenceMarkerNumeric`?10:16),this.data.characterReferenceType=void 0):r=Qv(t);let i=this.stack[this.stack.length-1];i.value+=r}function oe(e){let t=this.stack.pop();t.position.end=vw(e.end)}function se(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=this.sliceSerialize(e)}function ce(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=`mailto:`+this.sliceSerialize(e)}function le(){return{type:`blockquote`,children:[]}}function ue(){return{type:`code`,lang:null,meta:null,value:``}}function de(){return{type:`inlineCode`,value:``}}function fe(){return{type:`definition`,identifier:``,label:null,title:null,url:``}}function pe(){return{type:`emphasis`,children:[]}}function me(){return{type:`heading`,depth:0,children:[]}}function he(){return{type:`break`}}function ge(){return{type:`html`,value:``}}function _e(){return{type:`image`,title:null,url:``,alt:null}}function ve(){return{type:`link`,title:null,url:``,children:[]}}function ye(e){return{type:`list`,ordered:e.type===`listOrdered`,start:null,spread:e._spread,children:[]}}function be(e){return{type:`listItem`,spread:e._spread,checked:null,children:[]}}function xe(){return{type:`paragraph`,children:[]}}function Se(){return{type:`strong`,children:[]}}function Ce(){return{type:`text`,value:``}}function we(){return{type:`thematicBreak`}}}function vw(e){return{line:e.line,column:e.column,offset:e.offset}}function yw(e,t){let n=-1;for(;++n<t.length;){let r=t[n];Array.isArray(r)?yw(e,r):bw(e,r)}}function bw(e,t){let n;for(n in t)if(hw.call(t,n))switch(n){case`canContainEols`:{let r=t[n];r&&e[n].push(...r);break}case`transforms`:{let r=t[n];r&&e[n].push(...r);break}case`enter`:case`exit`:{let r=t[n];r&&Object.assign(e[n],r);break}}}function xw(e,t){throw Error(e?"Cannot close `"+e.type+"` ("+py({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+py({start:t.start,end:t.end})+`) is open`:"Cannot close document, a token (`"+t.type+"`, "+py({start:t.start,end:t.end})+`) is still open`)}function Sw(e){return e.children instanceof Array}var Cw=class extends Error{constructor(e,t){super(e),this.name=`MarkdownParseError`,this.cause=t}},ww=class extends Error{constructor(e){super(e),this.name=`UnrecognizedMarkdownConstructError`}};function Tw(e){let t=new Map;return e.type===`root`?(e.children.filter(e=>e.type===`mdxjsEsm`).filter(e=>e.value.startsWith(`import `)).forEach(e=>{(e.data?.estree?.body??[]).forEach(e=>{e.type===`ImportDeclaration`&&e.specifiers.forEach(n=>{t.set(n.local.name,{source:`${e.source.value}`,defaultExport:n.type===`ImportDefaultSpecifier`})})})}),{importDeclarations:Object.fromEntries(t.entries())}):{importDeclarations:{}}}function Ew({root:e,markdown:t,visitors:n,syntaxExtensions:r,mdastExtensions:i,...a}){let o;try{o=gw(t,{extensions:r,mdastExtensions:i})}catch(e){throw e instanceof Error?new Cw(`Error parsing markdown: ${e.message}`,e):new Cw(`Error parsing markdown: ${e}`,e)}o.children.length===0&&o.children.push({type:`paragraph`,children:[]}),o.children.at(-1)?.type!==`paragraph`&&o.children.push({type:`paragraph`,children:[]}),Dw({root:e,mdastRoot:o,visitors:n,...a})}function Dw({root:e,mdastRoot:t,visitors:n,...r}){let i=new WeakMap,a=new WeakMap,o=Tw(t);n=n.sort((e,t)=>(t.priority??0)-(e.priority??0));function s(e,t){if(!Sw(e))throw Error(`Attempting to visit children of a non-parent`);e.children.forEach(n=>{c(n,t,e)})}function c(e,t,l,u=null){let d=n.find((t,n)=>u?.has(n)?!1:typeof t.testNode==`string`?t.testNode===e.type:t.testNode(e,r));if(!d)try{throw new ww(`Unsupported markdown syntax: ${Kx(e)}`)}catch{throw new ww(`Parsing of the following markdown structure failed: ${JSON.stringify({type:e.type,name:`name`in e?e.name:`N/A`})}`)}d.visitNode({mdastNode:e,lexicalParent:t,mdastParent:l,descriptors:r,metaData:o,actions:{visitChildren:s,nextVisitor(){c(e,t,l,(u??new Set).add(n.indexOf(d)))},addAndStepInto(n){t.append(n),Sw(e)&&s(e,n)},addFormatting(t,n){n||Sw(e)&&(n=e),n&&i.set(n,t|(i.get(l)??0))},removeFormatting(t,n){n||Sw(e)&&(n=e),n&&i.set(n,t^(i.get(l)??0))},getParentFormatting(){return i.get(l)??0},addStyle(t,n){n||Sw(e)&&(n=e),n&&a.set(n,t)},getParentStyle(){return a.get(l)??``}}})}c(t,e,null)}var Ow=Object.defineProperty,kw=(e,t,n)=>t in e?Ow(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Aw=(e,t,n)=>(kw(e,typeof t==`symbol`?t:t+``,n),n),jw=`generic-html`,Mw=class e extends zm{constructor(e,t,n,r){super(r),Aw(this,`__tag`),Aw(this,`__nodeType`),Aw(this,`__attributes`),this.__tag=e,this.__nodeType=t,this.__attributes=n}static getType(){return jw}static clone(t){return new e(t.__tag,t.__nodeType,t.__attributes,t.__key)}getTag(){return this.__tag}getNodeType(){return this.__nodeType}getAttributes(){return this.__attributes}updateAttributes(e){let t=this.getWritable();t.__attributes=e}getStyle(){return this.__attributes.find(e=>e.name===`style`)?.value}createDOM(){let e=this.__tag,t=document.createElement(e);return this.__attributes.forEach(e=>{t.setAttribute(e.name,e.value)}),t}updateDOM(){return!1}static importDOM(){return{}}exportDOM(e){let{element:t}=super.exportDOM(e);return{element:t}}static importJSON(e){let t=Nw(e.tag,e.mdxType,e.attributes);return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t}exportJSON(){return{...super.exportJSON(),tag:this.getTag(),attributes:this.__attributes,mdxType:this.__nodeType,type:jw,version:1}}extractWithChild(){return!0}isInline(){return this.__nodeType===`mdxJsxTextElement`}};function Nw(e,t,n){return fg(new Mw(e,t,n))}function Wne(e){return e instanceof Mw}var Gne={testLexicalNode:Wne,visitLexicalNode({actions:e,lexicalNode:t}){e.addAndStepInto(`mdxJsxTextElement`,{name:t.getTag(),type:t.getNodeType(),attributes:t.getAttributes()})},priority:-100},Kne={testLexicalNode:hp,visitLexicalNode:({mdastParent:e,actions:t})=>{t.appendToParent(e,{type:`text`,value:`
79
+ `})}},qne={testLexicalNode:eh,visitLexicalNode:({actions:e})=>{e.addAndStepInto(`paragraph`)}},Jne={testLexicalNode:Wm,visitLexicalNode:({actions:e})=>{e.addAndStepInto(`root`)}};function Pw(e){return e.type===`text`}var Yne=[`u`,`span`,`sub`,`sup`],Xne={shouldJoin:(e,t)=>{if([`text`,`emphasis`,`strong`,`highlight`].includes(e.type))return e.type===t.type;if(e.type===`mdxJsxTextElement`&&t.type===`mdxJsxTextElement`&&Yne.includes(t.name)){let n=t;return e.name===n.name&&JSON.stringify(e.attributes)===JSON.stringify(n.attributes)}return!1},join(e,t){return Pw(e)&&Pw(t)?{type:`text`,value:e.value+t.value}:{...e,children:[...e.children,...t.children]}},testLexicalNode:H,visitLexicalNode:({lexicalNode:e,mdastParent:t,actions:n})=>{let r=e.getPreviousSibling(),i=H(r)?r.getFormat():0,a=e.getTextContent(),o=e.getFormat(),s=e.getStyle(),c=t;if(s&&(c=n.appendToParent(c,{type:`mdxJsxTextElement`,name:`span`,children:[],attributes:[{type:`mdxJsxAttribute`,name:`style`,value:s}]})),i&o&8&&(c=n.appendToParent(c,{type:`mdxJsxTextElement`,name:`u`,children:[],attributes:[]})),i&o&64&&(c=n.appendToParent(c,{type:`mdxJsxTextElement`,name:`sup`,children:[],attributes:[]})),i&o&32&&(c=n.appendToParent(c,{type:`mdxJsxTextElement`,name:`sub`,children:[],attributes:[]})),i&o&2&&(c=n.appendToParent(c,{type:`emphasis`,children:[]})),i&o&1&&(c=n.appendToParent(c,{type:`strong`,children:[]})),i&o&4&&(c=n.appendToParent(c,{type:`delete`,children:[]})),i&o&128&&(c=n.appendToParent(c,{type:`highlight`,children:[]})),o&8&&!(i&8)&&(c=n.appendToParent(c,{type:`mdxJsxTextElement`,name:`u`,children:[],attributes:[]})),o&64&&!(i&64)&&(c=n.appendToParent(c,{type:`mdxJsxTextElement`,name:`sup`,children:[],attributes:[]})),o&32&&!(i&32)&&(c=n.appendToParent(c,{type:`mdxJsxTextElement`,name:`sub`,children:[],attributes:[]})),o&2&&!(i&2)&&(c=n.appendToParent(c,{type:`emphasis`,children:[]})),o&1&&!(i&1)&&(c=n.appendToParent(c,{type:`strong`,children:[]})),o&4&&!(i&4)&&(c=n.appendToParent(c,{type:`delete`,children:[]})),o&128&&!(i&128)&&(c=n.appendToParent(c,{type:`highlight`,children:[]})),o&16){n.appendToParent(c,{type:`inlineCode`,value:a});return}n.appendToParent(c,{type:`text`,value:a})}},Zne={testNode:`break`,visitNode:function({lexicalParent:e}){e.append(mp())}};function Fw(e,t){return[{testNode:t=>t.type===`mdxJsxTextElement`&&t.name===e,visitNode({actions:e,mdastNode:n,lexicalParent:r}){e.addFormatting(t),e.visitChildren(n,r)}},{testNode:t=>t.type===`html`&&t.value===`<${e}>`,visitNode({actions:e,mdastParent:n}){e.addFormatting(t,n)}},{testNode:t=>t.type===`html`&&t.value===`</${e}>`,visitNode({actions:e,mdastParent:n}){e.removeFormatting(t,n)}}]}var Qne={testNode:`delete`,visitNode({mdastNode:e,actions:t,lexicalParent:n}){t.addFormatting(4),t.visitChildren(e,n)}},$ne={testNode:`highlight`,visitNode({mdastNode:e,actions:t,lexicalParent:n}){t.addFormatting(128),t.visitChildren(e,n)}},ere={testNode:`inlineCode`,visitNode({mdastNode:e,actions:t}){t.addAndStepInto(Mp(e.value).setFormat(t.getParentFormatting()|16))}},tre=[{testNode:`emphasis`,visitNode({mdastNode:e,actions:t,lexicalParent:n}){t.addFormatting(2),t.visitChildren(e,n)}},{testNode:`strong`,visitNode({mdastNode:e,actions:t,lexicalParent:n}){t.addFormatting(1),t.visitChildren(e,n)}},...Fw(`u`,8),...Fw(`code`,16),ere,Qne,$ne,...Fw(`sup`,64),...Fw(`sub`,32)],nre={testNode:qx,visitNode:function({mdastNode:e,actions:t,lexicalParent:n}){e.name===`span`&&e.attributes.length===1&&e.attributes[0].type===`mdxJsxAttribute`&&e.attributes[0].name===`style`?(t.addStyle(e.attributes[0].value,e),t.visitChildren(e,n)):t.addAndStepInto(Nw(e.name,e.type,e.attributes))},priority:-100},rre=[`listitem`,`admonition`],ire={testNode:`paragraph`,visitNode:function({mdastNode:e,lexicalParent:t,actions:n}){rre.includes(t.getType())?n.visitChildren(e,t):n.addAndStepInto($m())}},are={testNode:`root`,visitNode({actions:e,mdastNode:t,lexicalParent:n}){e.visitChildren(t,n)}},ore={testNode:`text`,visitNode({mdastNode:e,actions:t}){let n=Mp(e.value);n.setFormat(t.getParentFormatting());let r=t.getParentStyle();r!==``&&n.setStyle(r),t.addAndStepInto(n)}},sre=()=>L.createElement(tv,{externalHistoryState:Rl(mre)});function cre(e){return{canContainEols:[`comment`],enter:{comment(e){this.buffer()}},exit:{comment(e){this.resume()}}}}var Iw=(e,t,n)=>{return r;function r(t){return e.enter(`comment`),e.consume(t),i}function i(t){return t===db.exclamationMark?(e.consume(t),a):n(t)}function a(t){return t===db.dash?(e.consume(t),o):n(t)}function o(t){return t===db.dash?(e.consume(t),s):n(t)}function s(t){return t===db.greaterThan?n(t):Pv(t)?u(t):(e.enter(pb.data),t===db.dash?(e.consume(t),c):l(t))}function c(e){return e===db.greaterThan?n(e):l(e)}function l(t){return t===db.eof?n(t):t===db.dash?(e.consume(t),f):Pv(t)?(e.exit(pb.data),u(t)):(e.consume(t),l)}function u(t){return e.enter(pb.lineEnding),e.consume(t),e.exit(pb.lineEnding),Ob(e,d,pb.linePrefix)}function d(t){return Pv(t)?u(t):(e.enter(pb.data),l(t))}function f(t){return t===db.dash?(e.consume(t),p):l(t)}function p(n){return n===db.greaterThan?(e.exit(pb.data),e.enter(`commentEnd`),e.consume(n),e.exit(`commentEnd`),e.exit(`comment`),t(n)):n===db.dash?(e.consume(n),p):l(n)}},lre={flow:{60:{tokenize:Iw,concrete:!0}},text:{60:{tokenize:Iw}}},Lw={bold:`_bold_1tncs_10`,italic:`_italic_1tncs_14`,underline:`_underline_1tncs_18`,strikethrough:`_strikethrough_1tncs_34`,underlineStrikethrough:`_underlineStrikethrough_1tncs_38`,subscript:`_subscript_1tncs_42`,superscript:`_superscript_1tncs_47`,code:`_code_1tncs_52`,nestedListItem:`_nestedListItem_1tncs_59`,listitem:`_listitem_1tncs_69`,listItemChecked:`_listItemChecked_1tncs_73`,listItemUnchecked:`_listItemUnchecked_1tncs_74`,admonitionDanger:`_admonitionDanger_1tncs_151`,admonitionInfo:`_admonitionInfo_1tncs_152`,admonitionNote:`_admonitionNote_1tncs_153`,admonitionTip:`_admonitionTip_1tncs_154`,admonitionCaution:`_admonitionCaution_1tncs_155`,mdxExpression:`_mdxExpression_1tncs_188`},Rw={text:{bold:Lw.bold,italic:Lw.italic,underline:Lw.underline,code:Lw.code,strikethrough:Lw.strikethrough,subscript:Lw.subscript,superscript:Lw.superscript,underlineStrikethrough:Lw.underlineStrikethrough},list:{listitem:Lw.listitem,listitemChecked:Lw.listItemChecked,listitemUnchecked:Lw.listItemUnchecked,nested:{listitem:Lw.nestedListItem}},admonition:{danger:Lw.admonitionDanger,info:Lw.admonitionInfo,note:Lw.admonitionNote,tip:Lw.admonitionTip,caution:Lw.admonitionCaution}},zw=Vd(`NESTED_EDITOR_UPDATED_COMMAND`),Bw=Nl(null),Vw=Nl(null),Hw=Nl(``),Uw=Nl(!0),Ww=Nl(!1,e=>{e.sub(e.pipe(Ww,Hl(Bw)),([e,t])=>{t?.setEditable(!e)})}),Gw=Nl(``),Kw=Nl(!1),qw=Nl(!1),Jw=Nl(0),Yw=Nl(null),Xw=Pl(e=>{e.link(e.pipe(Yw,Ul(e=>e!==null)),Xw)}),Zw=Pl(e=>{e.sub(e.pipe(Zw,Hl(Vw)),([e,t])=>{t?.dispatchCommand($d,e)})}),Qw=Nl(null,e=>{e.sub(e.pipe(Qw,Hl(Vw)),([t,n])=>{if(!t||!n)return;let r=t.anchor.getNode(),i=r.getKey()===`root`?r:W_(r,e=>{let t=e.getParent();return t!==null&&ug(t)});i??=r.getTopLevelElementOrThrow();let a=i.getKey();if(n.getElementByKey(a)!==null){let t=Cv(i)?i.getTag():i.getType();e.pub(KT,t)}})}),$w=Nl(``),eT=Nl(``),tT=Nl(!1),nT=Pl(e=>{e.link(eT,nT),e.sub($w,t=>{e.pubIn({[tT]:!0,[eT]:t})})}),rT=Pl(e=>{e.link(e.pipe(nT,Hl(CT),Ul(([,e])=>!e),Vl(([e])=>e)),rT)},!0),iT=Nl([]),aT=Nl([]),oT=Nl([]),sT=Nl([]),cT=Nl([]),lT=Nl([]),uT=Nl({}),dT=Nl(!1),fT=Nl([]),pT=Nl([]),mT=Nl([]),hT=Nl(null),ure=Nl(null),gT=Nl(null),_T=MT(aT),vT=MT(iT),yT=MT(oT),bT=MT(sT),xT=MT(cT),ST=MT(lT),CT=Nl(!1),wT=Pl(e=>{e.sub(e.pipe(wT,Hl(eT,Bw,qw),Ul(([e,t])=>e.trim()!==t.trim())),([t,,n,r])=>{e.pub(CT,!0),n?.update(()=>{Nh().clear(),IT(e,Nh(),t),r?n.focus():Fh(null)},{onUpdate:()=>{e.pub(CT,!1)}})})}),TT=Pl(e=>{e.sub(e.pipe(TT,Hl(Vw,qw)),([t,n,r])=>{n?.update(()=>{let i=W();if(i!==null){let n={children:[],append(e){this.children.push(e)},getType(){return i.getNodes()[0].getType()}};IT(e,n,t),dm(n.children)}r?n.focus():Fh(null)})})});function ET(){return Wl((e,[t,n])=>(e.forEach(e=>{if(!e)throw Error(`You have a subscription that does not return a teardown`);e()}),n?t.map(e=>e(n)):[]),[])}var dre=Nl(null),DT=Nl([],e=>{e.pipe(e.combine(DT,Vw),ET())}),OT=Nl([],e=>{e.pipe(e.combine(OT,Bw),ET())}),kT=Nl(null,Kl,(e,t)=>!!(e&&t&&e.editorRef===t.editorRef)),AT=Pl(),jT=Nl(e=>{throw Error(`No icon component for ${e}`)});function MT(e,t){return Pl((n,r)=>{n.changeWith(e,r,(e,t)=>{Array.isArray(t)||(t=[t]);let n=e;for(let r of t)e.includes(r)||(n=[...n,r]);return n}),t?.(n,r)})}function NT(e){let t=W();U(t)&&e.pubIn({[Qw]:t,[Jw]:t.format})}var PT=MT(OT,(e,t)=>{e.pub(t,[t=>t.registerCommand(Hd,(t,n)=>(e.pubIn({[Vw]:n,[qw]:!0}),n._parentEditor===null&&n.getEditorState().read(()=>{e.pub(kT,{rootNode:Nh(),editorType:`lexical`,editorRef:n})}),NT(e),!1),4),t=>t.registerUpdateListener(({dirtyElements:n,dirtyLeaves:r,editorState:i})=>{if(e.getValue(Yw)!==null||n.size===0&&r.size===0)return;let a;i.read(()=>{Nh().getLastChild()instanceof Vm&&t.update(()=>{Nh().append($m())},{discrete:!0}),a=Rne({root:Nh(),visitors:e.getValue(cT),jsxComponentDescriptors:e.getValue(fT),toMarkdownExtensions:e.getValue(lT),toMarkdownOptions:e.getValue(uT),jsxIsAvailable:e.getValue(dT)})}),e.pub(eT,a.trim()),e.pub(tT,!1)}),t=>t.registerCommand(jf,()=>(e.pub(qw,!0),!1),4)])}),FT=MT(DT,(e,t)=>{e.pub(t,[t=>t.registerUpdateListener(({editorState:t})=>{t.read(()=>{NT(e)})}),t=>t.registerCommand(Mf,t=>{let n=e.getValue(Bw);return n&&(n.getRootElement()?.contains(t.relatedTarget)||e.pubIn({[qw]:!1,[AT]:t})),!1},4)])});function IT(e,t,n){try{Ew({root:t,visitors:e.getValue(iT),mdastExtensions:e.getValue(sT),markdown:n,syntaxExtensions:e.getValue(oT),jsxComponentDescriptors:e.getValue(fT),directiveDescriptors:e.getValue(pT),codeBlockEditorDescriptors:e.getValue(mT)}),e.pub(Yw,null)}catch(t){if(t instanceof Cw||t instanceof ww)e.pubIn({[eT]:n,[Yw]:{error:t.message,source:n}});else throw t}}var LT=Nl([]),RT=MT(LT),zT=Nl([]),fre=MT(zT),BT=Nl([]),pre=MT(BT),VT=Nl([]);MT(VT);var HT=MT(Nl([])),UT=Nl([]),WT=MT(UT),GT=Nl(!1,e=>{e.link(e.pipe(Vw,Vl(e=>[`td`,`th`].includes((e?.getRootElement()?.parentNode)?.nodeName.toLowerCase()??``))),GT)}),mre=Nl(ev()),KT=Nl(``);Pl();var qT=Pl(e=>{e.sub(e.pipe(qT,Hl(Vw)),([e,t])=>{t?.update(()=>{let n=W();U(n)&&(xee(n,e),setTimeout(()=>{t.focus()}))})})}),JT=Pl(e=>{e.sub(e.pipe(JT,Hl(Vw)),([e,t])=>{t?.focus(()=>{t.getEditorState().read(()=>{U(W())&&(t.update(()=>{let t=e();t.isInline()?(dm([t]),ug(t.getParentOrThrow())&&kee(t,$m).selectEnd()):G_(t),setTimeout(()=>{`select`in t&&typeof t.select==`function`&&t.select()})}),setTimeout(()=>{t.dispatchCommand(zw,void 0)}))})},{defaultSelection:`rootEnd`})})}),YT=Nl(`rich-text`,e=>{function t(){return Wl((e,t)=>({current:e.next,next:t}),{current:`rich-text`,next:`rich-text`})}e.sub(e.pipe(YT,t(),Hl(XT)),([{current:t},n])=>{(t===`source`||t===`diff`)&&e.pub(wT,n)}),e.sub(e.pipe(YT,t(),Ul(e=>e.current===`rich-text`),Hl(Vw)),([,e])=>{e?.dispatchCommand(zw,void 0)})}),XT=Nl(``,e=>{e.link(eT,XT),e.link(XT,nT)},!0),ZT=Nl([]),QT=MT(ZT),$T=Nl(()=>{throw Error(`No translation function provided`)}),eE=Nl(Rw),hre=ql({init(e,t){let n=t?.initialMarkdown??``;e.register(PT),e.register(FT),e.register(nT),e.register(XT),e.pubIn({[$w]:t?.trim?n.trim():n,[jT]:t?.iconComponentFor,[vT]:[are,ire,ore,Zne,...tre],[_T]:[Qm,Cp,Mw],[xT]:[Jne,qne,Xne,Kne,Gne],[Hw]:t?.contentEditableClassName,[Uw]:t?.spellCheck,[uT]:t?.toMarkdownOptions,[Kw]:t?.autoFocus,[Gw]:t?.placeholder,[Ww]:t?.readOnly,[$T]:t?.translation,[bT]:[Uv(),lte],[yT]:[Hv(),vb()],[ST]:[vte(),Wv(),fte],[eE]:t?.lexicalTheme??Rw}),e.singletonSub(Xw,t?.onError),e.singletonSub(rT,n=>{t?.onChange(n,e.getValue(tT))}),e.singletonSub(AT,t?.onBlur),t?.suppressHtmlProcessing||e.pubIn({[bT]:[_te(),cre()],[yT]:[ax(),ox(),lre],[vT]:nre}),t?.suppressSharedHistory||e.pub(RT,sre)},postInit(e,t){let n=nh({editable:t?.readOnly!==!0,namespace:t?.lexicalEditorNamespace??`MDXEditor`,nodes:[...e.getValue(aT),...t?.additionalLexicalNodes??[]],onError:e=>{throw e},theme:e.getValue(eE)});t?.editorState!==null&&n.update(()=>{let r=t?.initialMarkdown.trim()??``;IT(e,Nh(),r);let i=t?.autoFocus;if(i){if(i===!0){setTimeout(()=>{n.focus(Kl,{defaultSelection:`rootStart`})});return}setTimeout(()=>{n.focus(Kl,{defaultSelection:i.defaultSelection??`rootStart`})})}}),e.pub(Bw,n),e.pub(Vw,n)},update(e,t){e.pubIn({[Hw]:t?.contentEditableClassName,[Uw]:t?.spellCheck,[uT]:t?.toMarkdownOptions,[Kw]:t?.autoFocus,[Gw]:t?.placeholder,[Ww]:t?.readOnly}),e.singletonSub(rT,n=>{t?.onChange(n,e.getValue(tT))}),e.singletonSub(AT,t?.onBlur),e.singletonSub(Xw,t?.onError)}});function tE(){return Rl($T)}function gre(){return Nh().getTextContent()}function _re(e,t=!0){if(e)return!1;let n=gre();return t&&(n=n.trim()),n===``}function vre(e){if(!_re(e,!1))return!1;let t=Nh().getChildren(),n=t.length;if(n>1)return!1;for(let e=0;e<n;e++){let n=t[e];if(Hm(n))return!1;if(G(n)){if(!eh(n)||n.__indent!==0)return!1;let t=n.getChildren(),r=t.length;for(let n=0;n<r;n++){let n=t[e];if(!H(n))return!1}}}return!0}function nE(e){return()=>vre(e)}var rE=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0?L.useLayoutEffect:L.useEffect;function yre({editor:e,ariaActiveDescendant:t,ariaAutoComplete:n,ariaControls:r,ariaDescribedBy:i,ariaErrorMessage:a,ariaExpanded:o,ariaInvalid:s,ariaLabel:c,ariaLabelledBy:l,ariaMultiline:u,ariaOwns:d,ariaRequired:f,autoCapitalize:p,className:m,id:h,role:g=`textbox`,spellCheck:_=!0,style:v,tabIndex:y,"data-testid":b,...x},S){let[C,w]=(0,L.useState)(e.isEditable()),T=(0,L.useCallback)((t=>{t&&t.ownerDocument&&t.ownerDocument.defaultView?e.setRootElement(t):e.setRootElement(null)}),[e]),E=(0,L.useMemo)((()=>function(...e){return t=>{e.forEach((e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)}))}}(S,T)),[T,S]);return rE((()=>(w(e.isEditable()),e.registerEditableListener((e=>{w(e)})))),[e]),(0,R.jsx)(`div`,{"aria-activedescendant":C?t:void 0,"aria-autocomplete":C?n:`none`,"aria-controls":C?r:void 0,"aria-describedby":i,...a==null?{}:{"aria-errormessage":a},"aria-expanded":C&&g===`combobox`?!!o:void 0,...s==null?{}:{"aria-invalid":s},"aria-label":c,"aria-labelledby":l,"aria-multiline":u,"aria-owns":C?d:void 0,"aria-readonly":!C||void 0,"aria-required":f,autoCapitalize:p,className:m,contentEditable:C,"data-testid":b,id:h,ref:E,role:g,spellCheck:_,style:v,tabIndex:y,...x})}var bre=(0,L.forwardRef)(yre);function iE(e){return e.getEditorState().read(nE(e.isComposing()))}var aE=(0,L.forwardRef)(xre);function xre(e,t){let{placeholder:n,...r}=e,[i]=Zl();return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(bre,{editor:i,...r,ref:t}),n!=null&&(0,R.jsx)(Sre,{editor:i,content:n})]})}function Sre({content:e,editor:t}){let n=function(e){let[t,n]=(0,L.useState)((()=>iE(e)));return rE((()=>{function t(){n(iE(e))}return t(),z_(e.registerUpdateListener((()=>{t()})),e.registerEditableListener((()=>{t()})))}),[e]),t}(t),[r,i]=(0,L.useState)(t.isEditable());if((0,L.useLayoutEffect)((()=>(i(t.isEditable()),t.registerEditableListener((e=>{i(e)})))),[t]),!n)return null;let a=null;return typeof e==`function`?a=e(r):e!==null&&(a=e),a===null?null:(0,R.jsx)(`div`,{"aria-hidden":!0,children:a})}function oE(e,t){return oE=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},oE(e,t)}var sE={error:null},Cre=function(e){var t,n;function r(){for(var t,n=arguments.length,r=Array(n),i=0;i<n;i++)r[i]=arguments[i];return(t=e.call.apply(e,[this].concat(r))||this).state=sE,t.resetErrorBoundary=function(){for(var e,n=arguments.length,r=Array(n),i=0;i<n;i++)r[i]=arguments[i];t.props.onReset==null||(e=t.props).onReset.apply(e,r),t.reset()},t}n=e,(t=r).prototype=Object.create(n.prototype),t.prototype.constructor=t,oE(t,n),r.getDerivedStateFromError=function(e){return{error:e}};var i=r.prototype;return i.reset=function(){this.setState(sE)},i.componentDidCatch=function(e,t){var n,r;(n=(r=this.props).onError)==null||n.call(r,e,t)},i.componentDidUpdate=function(e,t){var n,r,i,a,o=this.state.error,s=this.props.resetKeys;o!==null&&t.error!==null&&((i=e.resetKeys)===void 0&&(i=[]),(a=s)===void 0&&(a=[]),i.length!==a.length||i.some((function(e,t){return!Object.is(e,a[t])})))&&((n=(r=this.props).onResetKeysChange)==null||n.call(r,e.resetKeys,s),this.reset())},i.render=function(){var e=this.state.error,t=this.props,n=t.fallbackRender,r=t.FallbackComponent,i=t.fallback;if(e!==null){var a={error:e,resetErrorBoundary:this.resetErrorBoundary};if(L.isValidElement(i))return i;if(typeof n==`function`)return n(a);if(r)return L.createElement(r,a);throw Error(`react-error-boundary requires either a fallback, fallbackRender, or FallbackComponent prop`)}return this.props.children},r}(L.Component);function cE({children:e,onError:t}){return(0,R.jsx)(Cre,{fallback:(0,R.jsx)(`div`,{style:{border:`1px solid #f00`,color:`#f00`,padding:`8px`},children:`An error was thrown.`}),onError:t,children:e})}var wre=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0?L.useLayoutEffect:L.useEffect;function Tre(e){return{initialValueFn:()=>e.isEditable(),subscribe:t=>e.registerEditableListener(t)}}function Ere(){return function(e){let[t]=Zl(),n=(0,L.useMemo)((()=>e(t)),[t,e]),[r,i]=(0,L.useState)((()=>n.initialValueFn())),a=(0,L.useRef)(r);return wre((()=>{let{initialValueFn:e,subscribe:t}=n,r=e();return a.current!==r&&(a.current=r,i(r)),t((e=>{a.current=e,i(e)}))}),[n,e]),r}(Tre)}function Dre(e){let t=window.location.origin,n=n=>{if(n.origin!==t)return;let r=e.getRootElement();if(document.activeElement!==r)return;let i=n.data;if(typeof i==`string`){let t;try{t=JSON.parse(i)}catch{return}if(t&&t.protocol===`nuanria_messaging`&&t.type===`request`){let r=t.payload;if(r&&r.functionId===`makeChanges`){let t=r.args;if(t){let[r,i,a,o,s,c]=t;e.update((()=>{let e=W();if(U(e)){let t=e.anchor,c=t.getNode(),l=0,u=0;if(H(c)&&r>=0&&i>=0&&(l=r,u=r+i,e.setTextNodeRange(c,l,c,u)),l===u&&a===``||(e.insertRawText(a),c=t.getNode()),H(c)){l=o,u=o+s;let t=c.getTextContentSize();l=l>t?t:l,u=u>t?t:u,e.setTextNodeRange(c,l,c,u)}n.stopImmediatePropagation()}}))}}}}};return window.addEventListener(`message`,n,!0),()=>{window.removeEventListener(`message`,n,!0)}}var lE=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0?L.useLayoutEffect:L.useEffect;function uE(e){return e.getEditorState().read(nE(e.isComposing()))}function dE({contentEditable:e,placeholder:t=null,ErrorBoundary:n}){let[r]=Zl(),i=function(e,t){let[n,r]=(0,L.useState)((()=>e.getDecorators()));return lE((()=>e.registerDecoratorListener((e=>{(0,Pa.flushSync)((()=>{r(e)}))}))),[e]),(0,L.useEffect)((()=>{r(e.getDecorators())}),[e]),(0,L.useMemo)((()=>{let r=[],i=Object.keys(n);for(let a=0;a<i.length;a++){let o=i[a],s=(0,R.jsx)(t,{onError:t=>e._onError(t),children:(0,R.jsx)(L.Suspense,{fallback:null,children:n[o]})}),c=e.getElementByKey(o);c!==null&&r.push((0,Pa.createPortal)(s,c,o))}return r}),[t,n,e])}(r,n);return function(e){lE((()=>z_(ete(e),Dre(e))),[e])}(r),(0,R.jsxs)(R.Fragment,{children:[e,(0,R.jsx)(Ore,{content:t}),i]})}function Ore({content:e}){let[t]=Zl(),n=function(e){let[t,n]=(0,L.useState)((()=>uE(e)));return lE((()=>{function t(){n(uE(e))}return t(),z_(e.registerUpdateListener((()=>{t()})),e.registerEditableListener((()=>{t()})))}),[e]),t}(t),r=Ere();return n?typeof e==`function`?e(r):e:null}var kre=n(((e,t)=>{(function(){var e={}.hasOwnProperty;function n(){for(var e=``,t=0;t<arguments.length;t++){var n=arguments[t];n&&(e=i(e,r(n)))}return e}function r(t){if(typeof t==`string`||typeof t==`number`)return t;if(typeof t!=`object`)return``;if(Array.isArray(t))return n.apply(null,t);if(t.toString!==Object.prototype.toString&&!t.toString.toString().includes(`[native code]`))return t.toString();var r=``;for(var a in t)e.call(t,a)&&t[a]&&(r=i(r,a));return r}function i(e,t){return t?e?e+` `+t:e+t:e}t!==void 0&&t.exports?(n.default=n,t.exports=n):typeof define==`function`&&typeof define.amd==`object`&&define.amd?define(`classnames`,[],function(){return n}):window.classNames=n})()})),Are={undo:L.createElement(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},L.createElement(`path`,{d:`M7.202 18.5V17H14.3788C15.4224 17 16.3205 16.6554 17.073 15.9663C17.8257 15.2773 18.202 14.4263 18.202 13.4135C18.202 12.4007 17.8257 11.5512 17.073 10.8652C16.3205 10.1794 15.4224 9.8365 14.3788 9.8365H7.35775L10.1402 12.6193L9.0865 13.673L4.5 9.0865L9.0865 4.5L10.1402 5.55375L7.35775 8.3365H14.3788C15.8416 8.3365 17.0945 8.82467 18.1375 9.801C19.1805 10.7773 19.702 11.9815 19.702 13.4135C19.702 14.8455 19.1805 16.0513 18.1375 17.0308C17.0945 18.0103 15.8416 18.5 14.3788 18.5H7.202Z`,fill:`currentColor`})),redo:L.createElement(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},L.createElement(`path`,{d:`M9.6211 18.5C8.15827 18.5 6.90535 18.0103 5.86235 17.0308C4.81935 16.0513 4.29785 14.8455 4.29785 13.4135C4.29785 11.9815 4.81935 10.7773 5.86235 9.801C6.90535 8.82467 8.15827 8.3365 9.6211 8.3365H16.6421L13.8596 5.55375L14.9134 4.5L19.4999 9.0865L14.9134 13.673L13.8596 12.6193L16.6421 9.8365H9.6211C8.57744 9.8365 7.67935 10.1794 6.92685 10.8652C6.17418 11.5512 5.79785 12.4007 5.79785 13.4135C5.79785 14.4263 6.17418 15.2773 6.92685 15.9663C7.67935 16.6554 8.57744 17 9.6211 17H16.7979V18.5H9.6211Z`,fill:`currentColor`})),format_bold:L.createElement(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},L.createElement(`path`,{d:`M7.33838 18.625V5.375H12.1999C13.219 5.375 14.1405 5.69233 14.9644 6.327C15.788 6.9615 16.1999 7.816 16.1999 8.8905C16.1999 9.63783 16.0194 10.2471 15.6584 10.7182C15.2975 11.1894 14.9088 11.5314 14.4921 11.7442C15.005 11.9211 15.4947 12.2708 15.9614 12.7933C16.428 13.3158 16.6614 14.0193 16.6614 14.9038C16.6614 16.1819 16.1902 17.1217 15.2479 17.723C14.3055 18.3243 13.3562 18.625 12.3999 18.625H7.33838ZM9.48838 16.6328H12.3191C13.1063 16.6328 13.6627 16.4142 13.9884 15.977C14.314 15.5398 14.4769 15.1206 14.4769 14.7192C14.4769 14.3179 14.314 13.8987 13.9884 13.4615C13.6627 13.0243 13.0909 12.8058 12.2729 12.8058H9.48838V16.6328ZM9.48838 10.875H12.0826C12.6903 10.875 13.172 10.7013 13.5279 10.3538C13.8835 10.0064 14.0614 9.59042 14.0614 9.10575C14.0614 8.59042 13.8733 8.16925 13.4971 7.84225C13.1208 7.51542 12.6595 7.352 12.1134 7.352H9.48838V10.875Z`,fill:`currentColor`})),format_italic:L.createElement(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},L.createElement(`path`,{d:`M5.39404 18.625V16.8173H9.21129L12.4518 7.18275H8.63454V5.375H17.7883V7.18275H14.2785L11.0383 16.8173H14.5478V18.625H5.39404Z`,fill:`currentColor`})),format_underlined:L.createElement(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},L.createElement(`path`,{d:`M5.34619 22.125V20.625H18.6537V22.125H5.34619ZM11.9999 18.5287C10.4448 18.5287 9.23102 18.0566 8.35869 17.1125C7.48619 16.1683 7.04994 14.9032 7.04994 13.3172V5.41345H8.90369V13.4095C8.90369 14.4198 9.17228 15.2295 9.70944 15.8385C10.2466 16.4475 11.0101 16.752 11.9999 16.752C12.9898 16.752 13.7533 16.4475 14.2904 15.8385C14.8276 15.2295 15.0962 14.4198 15.0962 13.4095V5.41345H16.9499V13.3172C16.9499 14.9032 16.5137 16.1683 15.6412 17.1125C14.7689 18.0566 13.5551 18.5287 11.9999 18.5287Z`,fill:`currentColor`})),format_highlight:L.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,strokeLinecap:`round`,strokeLinejoin:`round`},L.createElement(`path`,{d:`m9 11-6 6v3h9l3-3`}),L.createElement(`path`,{d:`m22 12-4.6 4.6a2 2 0 0 1-2.8 0l-5.2-5.2a2 2 0 0 1 0-2.8L14 4`})),code:L.createElement(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},L.createElement(`path`,{d:`M7.99994 17.6537L2.34619 11.9999L7.99994 6.34619L9.06919 7.41544L4.46919 12.0154L9.05369 16.5999L7.99994 17.6537ZM15.9999 17.6537L14.9307 16.5844L19.5307 11.9844L14.9462 7.39994L15.9999 6.34619L21.6537 11.9999L15.9999 17.6537Z`,fill:`currentColor`})),strikeThrough:L.createElement(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},L.createElement(`path`,{d:`M12.15 19.6923C10.9732 19.6923 9.9315 19.359 9.025 18.6923C8.11867 18.0256 7.45525 17.1128 7.03475 15.9538L8.6385 15.2635C8.91667 16.0444 9.3545 16.6867 9.952 17.1905C10.5493 17.6944 11.2923 17.9463 12.1808 17.9463C12.9578 17.9463 13.6744 17.7508 14.3307 17.3598C14.9872 16.9686 15.3155 16.3487 15.3155 15.5C15.3155 15.123 15.2555 14.7968 15.1355 14.5213C15.0157 14.2456 14.8462 13.9885 14.627 13.75H16.677C16.7987 13.9705 16.8932 14.2256 16.9605 14.5153C17.0278 14.8051 17.0615 15.1334 17.0615 15.5C17.0615 16.8372 16.5747 17.8702 15.601 18.599C14.6272 19.3279 13.4768 19.6923 12.15 19.6923ZM2.25 11.75V10.25H21.75V11.75H2.25ZM12.05 4.19629C13.0475 4.19629 13.9123 4.42704 14.6443 4.88854C15.3763 5.35004 15.9673 6.05896 16.4173 7.01529L14.823 7.73079C14.6218 7.26029 14.2978 6.84462 13.851 6.48379C13.4042 6.12279 12.8141 5.94229 12.0808 5.94229C11.2244 5.94229 10.5392 6.16221 10.025 6.60204C9.51083 7.04171 9.264 7.59104 9.2845 8.25004H7.5385C7.50133 7.16421 7.89783 6.21712 8.728 5.40879C9.558 4.60046 10.6653 4.19629 12.05 4.19629Z`,fill:`currentColor`})),superscript:L.createElement(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},L.createElement(`path`,{d:`M16.6924 8V6.2115C16.6924 5.95383 16.7786 5.73875 16.9511 5.56625C17.1235 5.39392 17.3385 5.30775 17.5961 5.30775H19.5001V4.38475H16.6924V3.5H19.4809C19.7385 3.5 19.9536 3.58625 20.1261 3.75875C20.2985 3.93108 20.3846 4.14617 20.3846 4.404V5.2885C20.3846 5.54617 20.2985 5.76125 20.1261 5.93375C19.9536 6.10608 19.7385 6.19225 19.4809 6.19225H17.5771V7.1155H20.3846V8H16.6924ZM4.44238 18.5L8.84638 11.6287L4.77713 5.30775H6.74438L9.95963 10.404H10.0214L13.2501 5.30775H15.2329L11.1194 11.6287L15.5579 18.5H13.5751L10.0214 12.9308H9.95963L6.42513 18.5H4.44238Z`,fill:`currentColor`})),subscript:L.createElement(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},L.createElement(`path`,{d:`M16.6924 20.5V18.7115C16.6924 18.4538 16.7786 18.2387 16.9511 18.0662C17.1235 17.8939 17.3385 17.8077 17.5961 17.8077H19.5001V16.8845H16.6924V16H19.4809C19.7385 16 19.9536 16.0863 20.1261 16.2587C20.2985 16.4311 20.3846 16.6461 20.3846 16.9038V17.7885C20.3846 18.0462 20.2985 18.2612 20.1261 18.4337C19.9536 18.6061 19.7385 18.6923 19.4809 18.6923H17.5771V19.6152H20.3846V20.5H16.6924ZM4.44238 18.6923L8.84638 11.8212L4.77713 5.5H6.74438L9.95963 10.5962H10.0214L13.2501 5.5H15.2329L11.1194 11.8212L15.5579 18.6923H13.5751L10.0214 13.123H9.95963L6.42513 18.6923H4.44238Z`,fill:`currentColor`})),format_list_bulleted:L.createElement(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},L.createElement(`path`,{d:`M9.30775 18.75V17.25H20.5V18.75H9.30775ZM9.30775 12.75V11.25H20.5V12.75H9.30775ZM9.30775 6.75005V5.25005H20.5V6.75005H9.30775ZM5.1635 19.6635C4.706 19.6635 4.31442 19.5006 3.98875 19.1748C3.66292 18.8491 3.5 18.4575 3.5 18C3.5 17.5425 3.66292 17.151 3.98875 16.8253C4.31442 16.4995 4.706 16.3365 5.1635 16.3365C5.621 16.3365 6.01258 16.4995 6.33825 16.8253C6.66408 17.151 6.827 17.5425 6.827 18C6.827 18.4575 6.66408 18.8491 6.33825 19.1748C6.01258 19.5006 5.621 19.6635 5.1635 19.6635ZM5.1635 13.6635C4.706 13.6635 4.31442 13.5006 3.98875 13.1748C3.66292 12.8491 3.5 12.4575 3.5 12C3.5 11.5425 3.66292 11.151 3.98875 10.8253C4.31442 10.4995 4.706 10.3365 5.1635 10.3365C5.621 10.3365 6.01258 10.4995 6.33825 10.8253C6.66408 11.151 6.827 11.5425 6.827 12C6.827 12.4575 6.66408 12.8491 6.33825 13.1748C6.01258 13.5006 5.621 13.6635 5.1635 13.6635ZM5.1635 7.66355C4.706 7.66355 4.31442 7.50063 3.98875 7.1748C3.66292 6.84913 3.5 6.45755 3.5 6.00005C3.5 5.54255 3.66292 5.15096 3.98875 4.8253C4.31442 4.49946 4.706 4.33655 5.1635 4.33655C5.621 4.33655 6.01258 4.49946 6.33825 4.8253C6.66408 5.15096 6.827 5.54255 6.827 6.00005C6.827 6.45755 6.66408 6.84913 6.33825 7.1748C6.01258 7.50063 5.621 7.66355 5.1635 7.66355Z`,fill:`currentColor`})),format_list_numbered:L.createElement(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},L.createElement(`path`,{d:`M3.5 21.5V20.3078H6V19.25H4.5V18.0577H6V17H3.5V15.8077H6.34625C6.58592 15.8077 6.78683 15.8888 6.949 16.051C7.11117 16.2132 7.19225 16.4141 7.19225 16.6538V17.8462C7.19225 18.0859 7.11117 18.2868 6.949 18.449C6.78683 18.6112 6.58592 18.6923 6.34625 18.6923C6.58592 18.6923 6.78683 18.7733 6.949 18.9355C7.11117 19.0977 7.19225 19.2987 7.19225 19.5385V20.6538C7.19225 20.8936 7.11117 21.0946 6.949 21.2568C6.78683 21.4189 6.58592 21.5 6.34625 21.5H3.5ZM3.5 14.8463V12.25C3.5 12.0103 3.58108 11.8093 3.74325 11.647C3.90542 11.4848 4.10642 11.4038 4.34625 11.4038H6V10.3462H3.5V9.15375H6.34625C6.58592 9.15375 6.78683 9.23483 6.949 9.397C7.11117 9.55933 7.19225 9.76033 7.19225 10V11.75C7.19225 11.9897 7.11117 12.1907 6.949 12.353C6.78683 12.5152 6.58592 12.5963 6.34625 12.5963H4.69225V13.6538H7.19225V14.8463H3.5ZM5 8.19225V3.69225H3.5V2.5H6.19225V8.19225H5ZM9.30775 18.75V17.25H20.5V18.75H9.30775ZM9.30775 12.75V11.25H20.5V12.75H9.30775ZM9.30775 6.75V5.25H20.5V6.75H9.30775Z`,fill:`currentColor`})),format_list_checked:L.createElement(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},L.createElement(`path`,{d:`M5.69425 18.452L2.5 15.2578L3.54425 14.2135L5.66925 16.3385L9.91925 12.0885L10.9635 13.1578L5.69425 18.452ZM5.69425 10.8365L2.5 7.64227L3.54425 6.59802L5.66925 8.72302L9.91925 4.47302L10.9635 5.54227L5.69425 10.8365ZM13.0095 16.5578V15.0578H21.5095V16.5578H13.0095ZM13.0095 8.94227V7.44227H21.5095V8.94227H13.0095Z`,fill:`currentColor`})),link:L.createElement(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},L.createElement(`path`,{d:`M10.8077 16.5385H7.0385C5.78283 16.5385 4.7125 16.096 3.8275 15.211C2.9425 14.3262 2.5 13.256 2.5 12.0005C2.5 10.745 2.9425 9.67471 3.8275 8.78955C4.7125 7.90421 5.78283 7.46155 7.0385 7.46155H10.8077V8.96155H7.0385C6.19867 8.96155 5.48233 9.25805 4.8895 9.85105C4.2965 10.444 4 11.1604 4 12C4 12.8397 4.2965 13.556 4.8895 14.149C5.48233 14.742 6.19867 15.0385 7.0385 15.0385H10.8077V16.5385ZM8.25 12.75V11.25H15.75V12.75H8.25ZM13.1923 16.5385V15.0385H16.9615C17.8013 15.0385 18.5177 14.742 19.1105 14.149C19.7035 13.556 20 12.8397 20 12C20 11.1604 19.7035 10.444 19.1105 9.85105C18.5177 9.25805 17.8013 8.96155 16.9615 8.96155H13.1923V7.46155H16.9615C18.2172 7.46155 19.2875 7.90405 20.1725 8.78905C21.0575 9.67388 21.5 10.744 21.5 11.9995C21.5 13.255 21.0575 14.3254 20.1725 15.2105C19.2875 16.0959 18.2172 16.5385 16.9615 16.5385H13.1923Z`,fill:`currentColor`})),add_photo:L.createElement(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},L.createElement(`path`,{d:`M5.11537 20.5C4.6182 20.5 4.19262 20.323 3.83862 19.969C3.48462 19.615 3.30762 19.1894 3.30762 18.6922V5.30773C3.30762 4.81056 3.48462 4.38498 3.83862 4.03098C4.19262 3.67698 4.6182 3.49998 5.11537 3.49998H13.8076V4.99998H5.11537C5.02553 4.99998 4.95178 5.02881 4.89412 5.08648C4.83645 5.14415 4.80762 5.2179 4.80762 5.30773V18.6922C4.80762 18.7821 4.83645 18.8558 4.89412 18.9135C4.95178 18.9711 5.02553 19 5.11537 19H18.4999C18.5895 19 18.6633 18.9711 18.7211 18.9135C18.7788 18.8558 18.8076 18.7821 18.8076 18.6922V9.99998H20.3076V18.6922C20.3076 19.1894 20.1306 19.615 19.7766 19.969C19.4226 20.323 18.997 20.5 18.4999 20.5H5.11537ZM17.1921 8.61523V6.61523H15.1921V5.11548H17.1921V3.11548H18.6921V5.11548H20.6921V6.61523H18.6921V8.61523H17.1921ZM6.55762 16.75H17.1344L13.8459 12.3655L11.0384 16.0192L9.03837 13.4615L6.55762 16.75Z`,fill:`currentColor`})),table:L.createElement(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},L.createElement(`path`,{d:`M3.5 18.6923V5.30775C3.5 4.81058 3.677 4.385 4.031 4.031C4.385 3.677 4.81058 3.5 5.30775 3.5H18.6923C19.1894 3.5 19.615 3.677 19.969 4.031C20.323 4.385 20.5 4.81058 20.5 5.30775V18.6923C20.5 19.1894 20.323 19.615 19.969 19.969C19.615 20.323 19.1894 20.5 18.6923 20.5H5.30775C4.81058 20.5 4.385 20.323 4.031 19.969C3.677 19.615 3.5 19.1894 3.5 18.6923ZM5 9.077H19V5.30775C19 5.21792 18.9712 5.14417 18.9135 5.0865C18.8558 5.02883 18.7821 5 18.6923 5H5.30775C5.21792 5 5.14417 5.02883 5.0865 5.0865C5.02883 5.14417 5 5.21792 5 5.30775V9.077ZM10.1615 14.0385H13.8385V10.577H10.1615V14.0385ZM10.1615 19H13.8385V15.5385H10.1615V19ZM5 14.0385H8.6615V10.577H5V14.0385ZM15.3385 14.0385H19V10.577H15.3385V14.0385ZM5.30775 19H8.6615V15.5385H5V18.6923C5 18.7821 5.02883 18.8558 5.0865 18.9135C5.14417 18.9712 5.21792 19 5.30775 19ZM15.3385 19H18.6923C18.7821 19 18.8558 18.9712 18.9135 18.9135C18.9712 18.8558 19 18.7821 19 18.6923V15.5385H15.3385V19Z`,fill:`currentColor`})),horizontal_rule:L.createElement(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},L.createElement(`path`,{d:`M4.5 12.75V11.25H19.5V12.75H4.5Z`,fill:`currentColor`})),frontmatter:L.createElement(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},L.createElement(`path`,{d:`M4.5 8.75V7.25H8.5V8.75H4.5Z`,fill:`currentColor`}),L.createElement(`path`,{d:`M4.5 14.75V13.25H8.5V14.75H4.5Z`,fill:`currentColor`}),L.createElement(`path`,{d:`M9.5 8.75V7.25H13.5V8.75H9.5Z`,fill:`currentColor`}),L.createElement(`path`,{d:`M9.5 14.75V13.25H13.5V14.75H9.5Z`,fill:`currentColor`}),L.createElement(`path`,{d:`M14.5 8.75V7.25H18.5V8.75H14.5Z`,fill:`currentColor`}),L.createElement(`path`,{d:`M14.5 14.75V13.25H18.5V14.75H14.5Z`,fill:`currentColor`})),frame_source:L.createElement(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},L.createElement(`path`,{d:`M8.6 15.2443L5.35575 12L8.6 8.75575L9.64425 9.825L7.46925 12L9.64425 14.175L8.6 15.2443ZM15.4 15.2443L14.3558 14.175L16.5307 12L14.3558 9.825L15.4 8.75575L18.6443 12L15.4 15.2443ZM5.30775 20.5C4.80258 20.5 4.375 20.325 4.025 19.975C3.675 19.625 3.5 19.1974 3.5 18.6923V15H5V18.6923C5 18.7692 5.03208 18.8398 5.09625 18.9038C5.16025 18.9679 5.23075 19 5.30775 19H9V20.5H5.30775ZM15 20.5V19H18.6923C18.7692 19 18.8398 18.9679 18.9038 18.9038C18.9679 18.8398 19 18.7692 19 18.6923V15H20.5V18.6923C20.5 19.1974 20.325 19.625 19.975 19.975C19.625 20.325 19.1974 20.5 18.6923 20.5H15ZM3.5 9V5.30775C3.5 4.80258 3.675 4.375 4.025 4.025C4.375 3.675 4.80258 3.5 5.30775 3.5H9V5H5.30775C5.23075 5 5.16025 5.03208 5.09625 5.09625C5.03208 5.16025 5 5.23075 5 5.30775V9H3.5ZM19 9V5.30775C19 5.23075 18.9679 5.16025 18.9038 5.09625C18.8398 5.03208 18.7692 5 18.6923 5H15V3.5H18.6923C19.1974 3.5 19.625 3.675 19.975 4.025C20.325 4.375 20.5 4.80258 20.5 5.30775V9H19Z`,fill:`currentColor`})),arrow_drop_down:L.createElement(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},L.createElement(`path`,{d:`M11.9999 14.6537L7.59619 10.25H16.4037L11.9999 14.6537Z`,fill:`currentColor`})),admonition:L.createElement(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},L.createElement(`path`,{d:`M12.0001 21.4C11.7654 21.4 11.5385 21.3548 11.3193 21.2645C11.1002 21.174 10.9002 21.0435 10.7193 20.873L3.1271 13.2807C2.9566 13.0999 2.8261 12.8999 2.7356 12.6807C2.64526 12.4616 2.6001 12.2346 2.6001 12C2.6001 11.7653 2.64526 11.5358 2.7356 11.3115C2.8261 11.0871 2.9566 10.8897 3.1271 10.7192L10.7193 3.12698C10.9002 2.94614 11.1002 2.81314 11.3193 2.72798C11.5385 2.64264 11.7654 2.59998 12.0001 2.59998C12.2348 2.59998 12.4643 2.64264 12.6886 2.72798C12.9129 2.81314 13.1103 2.94614 13.2808 3.12698L20.8731 10.7192C21.0539 10.8897 21.1869 11.0871 21.2721 11.3115C21.3574 11.5358 21.4001 11.7653 21.4001 12C21.4001 12.2346 21.3574 12.4616 21.2721 12.6807C21.1869 12.8999 21.0539 13.0999 20.8731 13.2807L13.2808 20.873C13.1103 21.0435 12.9129 21.174 12.6886 21.2645C12.4643 21.3548 12.2348 21.4 12.0001 21.4ZM12.2213 19.8037L19.8039 12.2212C19.8552 12.1699 19.8808 12.0961 19.8808 12C19.8808 11.9038 19.8552 11.8301 19.8039 11.7787L12.2213 4.19623C12.17 4.14489 12.0963 4.11923 12.0001 4.11923C11.9039 4.11923 11.8302 4.14489 11.7788 4.19623L4.19635 11.7787C4.14501 11.8301 4.11935 11.9038 4.11935 12C4.11935 12.0961 4.14501 12.1699 4.19635 12.2212L11.7788 19.8037C11.8302 19.8551 11.9039 19.8807 12.0001 19.8807C12.0963 19.8807 12.17 19.8551 12.2213 19.8037ZM11.2501 13.0865H12.7501V7.47123H11.2501V13.0865ZM12.0001 15.702C12.2258 15.702 12.4168 15.6237 12.5731 15.4672C12.7296 15.3109 12.8078 15.1199 12.8078 14.8942C12.8078 14.6686 12.7296 14.4776 12.5731 14.3212C12.4168 14.1647 12.2258 14.0865 12.0001 14.0865C11.7744 14.0865 11.5834 14.1647 11.4271 14.3212C11.2706 14.4776 11.1923 14.6686 11.1923 14.8942C11.1923 15.1199 11.2706 15.3109 11.4271 15.4672C11.5834 15.6237 11.7744 15.702 12.0001 15.702Z`,fill:`currentColor`})),sandpack:L.createElement(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},L.createElement(`path`,{d:`M12.9999 22.5C12.4947 22.5 12.0671 22.325 11.7171 21.975C11.3671 21.625 11.1921 21.1974 11.1921 20.6922V7.30775C11.1921 6.80258 11.3671 6.375 11.7171 6.025C12.0671 5.675 12.4947 5.5 12.9999 5.5H16.3844C16.8895 5.5 17.3171 5.675 17.6671 6.025C18.0171 6.375 18.1921 6.80258 18.1921 7.30775V20.6922C18.1921 21.1974 18.0171 21.625 17.6671 21.975C17.3171 22.325 16.8895 22.5 16.3844 22.5H12.9999ZM12.6921 7.30775V20.6922C12.6921 20.7692 12.7242 20.8398 12.7884 20.9038C12.8524 20.9679 12.9229 21 12.9999 21H16.3844C16.4614 21 16.5319 20.9679 16.5959 20.9038C16.66 20.8398 16.6921 20.7692 16.6921 20.6922V7.30775C16.6921 7.23075 16.66 7.16025 16.5959 7.09625C16.5319 7.03208 16.4614 7 16.3844 7H12.9999C12.9229 7 12.8524 7.03208 12.7884 7.09625C12.7242 7.16025 12.6921 7.23075 12.6921 7.30775ZM6.61537 18.5C6.1102 18.5 5.68262 18.325 5.33262 17.975C4.98262 17.625 4.80762 17.1974 4.80762 16.6923V3.30775C4.80762 2.80258 4.98262 2.375 5.33262 2.025C5.68262 1.675 6.1102 1.5 6.61537 1.5H9.99987C10.505 1.5 10.9326 1.675 11.2826 2.025C11.6326 2.375 11.8076 2.80258 11.8076 3.30775V16.6923C11.8076 17.1974 11.6326 17.625 11.2826 17.975C10.9326 18.325 10.505 18.5 9.99987 18.5H6.61537ZM6.30762 3.30775V16.6923C6.30762 16.7692 6.3397 16.8398 6.40387 16.9038C6.46787 16.9679 6.53837 17 6.61537 17H9.99987C10.0769 17 10.1474 16.9679 10.2114 16.9038C10.2755 16.8398 10.3076 16.7692 10.3076 16.6923V3.30775C10.3076 3.23075 10.2755 3.16025 10.2114 3.09625C10.1474 3.03208 10.0769 3 9.99987 3H6.61537C6.53837 3 6.46787 3.03208 6.40387 3.09625C6.3397 3.16025 6.30762 3.23075 6.30762 3.30775Z`,fill:`currentColor`})),rich_text:L.createElement(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},L.createElement(`path`,{d:`M5.30775 20.5C4.80258 20.5 4.375 20.325 4.025 19.975C3.675 19.625 3.5 19.1974 3.5 18.6923V5.30775C3.5 4.80258 3.675 4.375 4.025 4.025C4.375 3.675 4.80258 3.5 5.30775 3.5H18.6923C19.1974 3.5 19.625 3.675 19.975 4.025C20.325 4.375 20.5 4.80258 20.5 5.30775V18.6923C20.5 19.1974 20.325 19.625 19.975 19.975C19.625 20.325 19.1974 20.5 18.6923 20.5H5.30775ZM5.30775 19H18.6923C18.7692 19 18.8398 18.9679 18.9038 18.9038C18.9679 18.8398 19 18.7692 19 18.6923V5.30775C19 5.23075 18.9679 5.16025 18.9038 5.09625C18.8398 5.03208 18.7692 5 18.6923 5H5.30775C5.23075 5 5.16025 5.03208 5.09625 5.09625C5.03208 5.16025 5 5.23075 5 5.30775V18.6923C5 18.7692 5.03208 18.8398 5.09625 18.9038C5.16025 18.9679 5.23075 19 5.30775 19ZM6.75 17H17.3268L14 12.3655L11.2308 16.0192L9 13.4615L6.75 17Z`,fill:`currentColor`}),L.createElement(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M6 12V6.5H9.1925C9.5925 6.5 9.9425 6.65 10.2425 6.95C10.5425 7.25 10.6925 7.6 10.6925 8V8.6925C10.6925 9.03733 10.605 9.32675 10.43 9.56075C10.255 9.79458 10.0168 9.97817 9.7155 10.1115L10.6155 12H9.404L8.504 10.1925H7.1925V12H6ZM9.1925 9H7.1925V7.6925H9.1925C9.26933 7.6925 9.33983 7.7245 9.404 7.7885C9.468 7.85267 9.5 7.92317 9.5 8V8.6925C9.5 8.76933 9.468 8.83983 9.404 8.904C9.33983 8.968 9.26933 9 9.1925 9Z`,fill:`currentColor`}),L.createElement(`path`,{d:`M12.5 7H17.5V8.25H12.5V7Z`,fill:`currentColor`}),L.createElement(`path`,{d:`M12.5 9.25H17.5V10.5H12.5V9.25Z`,fill:`currentColor`})),difference:L.createElement(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},L.createElement(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M5.30775 20.5C4.80258 20.5 4.375 20.325 4.025 19.975C3.675 19.625 3.5 19.1974 3.5 18.6923V5.30775C3.5 4.80258 3.675 4.375 4.025 4.025C4.375 3.675 4.80258 3.5 5.30775 3.5H18.6923C19.1974 3.5 19.625 3.675 19.975 4.025C20.325 4.375 20.5 4.80258 20.5 5.30775V18.6923C20.5 19.1974 20.325 19.625 19.975 19.975C19.625 20.325 19.1974 20.5 18.6923 20.5H5.30775ZM18.6923 19H5.30775C5.23075 19 5.16025 18.9679 5.09625 18.9038C5.03208 18.8398 5 18.7692 5 18.6923V5.30775C5 5.23075 5.03208 5.16025 5.09625 5.09625C5.16025 5.03208 5.23075 5 5.30775 5H18.6923C18.7692 5 18.8398 5.03208 18.9038 5.09625C18.9679 5.16025 19 5.23075 19 5.30775V18.6923C19 18.7692 18.9679 18.8398 18.9038 18.9038C18.8398 18.9679 18.7692 19 18.6923 19Z`,fill:`currentColor`}),L.createElement(`rect`,{x:`9`,y:`10`,width:`5.5`,height:`1.5`,fill:`currentColor`}),L.createElement(`rect`,{x:`9`,y:`15`,width:`5.5`,height:`1.5`,fill:`currentColor`}),L.createElement(`rect`,{x:`11`,y:`8`,width:`1.5`,height:`5.5`,fill:`currentColor`})),markdown:L.createElement(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},L.createElement(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M5.30775 20.5C4.80258 20.5 4.375 20.325 4.025 19.975C3.675 19.625 3.5 19.1974 3.5 18.6923V5.30775C3.5 4.80258 3.675 4.375 4.025 4.025C4.375 3.675 4.80258 3.5 5.30775 3.5H18.6923C19.1974 3.5 19.625 3.675 19.975 4.025C20.325 4.375 20.5 4.80258 20.5 5.30775V18.6923C20.5 19.1974 20.325 19.625 19.975 19.975C19.625 20.325 19.1974 20.5 18.6923 20.5H5.30775ZM18.6923 19H5.30775C5.23075 19 5.16025 18.9679 5.09625 18.9038C5.03208 18.8398 5 18.7692 5 18.6923V5.30775C5 5.23075 5.03208 5.16025 5.09625 5.09625C5.16025 5.03208 5.23075 5 5.30775 5H18.6923C18.7692 5 18.8398 5.03208 18.9038 5.09625C18.9679 5.16025 19 5.23075 19 5.30775V18.6923C19 18.7692 18.9679 18.8398 18.9038 18.9038C18.8398 18.9679 18.7692 19 18.6923 19Z`,fill:`currentColor`}),L.createElement(`path`,{d:`M13 15H11.5V11L9.5 14L7.5 11V15H6V8H7.5L9.5 11L11.5 8H13V15Z`,fill:`currentColor`}),L.createElement(`path`,{d:`M15.9921 15.5833L13.2886 12.8797L14.0546 12.1137L15.4504 13.5016V7.99597L16.5336 7.99993V13.5016L17.9296 12.1137L18.6954 12.8797L15.9921 15.5833Z`,fill:`currentColor`})),open_in_new:L.createElement(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},L.createElement(`path`,{d:`M5.30775 20.5C4.80258 20.5 4.375 20.325 4.025 19.975C3.675 19.625 3.5 19.1974 3.5 18.6923V5.30775C3.5 4.80258 3.675 4.375 4.025 4.025C4.375 3.675 4.80258 3.5 5.30775 3.5H11.6152V5H5.30775C5.23075 5 5.16025 5.03208 5.09625 5.09625C5.03208 5.16025 5 5.23075 5 5.30775V18.6923C5 18.7692 5.03208 18.8398 5.09625 18.9038C5.16025 18.9679 5.23075 19 5.30775 19H18.6923C18.7692 19 18.8398 18.9679 18.9038 18.9038C18.9679 18.8398 19 18.7692 19 18.6923V12.3848H20.5V18.6923C20.5 19.1974 20.325 19.625 19.975 19.975C19.625 20.325 19.1974 20.5 18.6923 20.5H5.30775ZM9.71925 15.3345L8.6655 14.2808L17.9462 5H14V3.5H20.5V10H19V6.05375L9.71925 15.3345Z`,fill:`currentColor`})),link_off:L.createElement(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},L.createElement(`path`,{d:`M18.8843 16.1038L17.7498 14.9385C18.4228 14.7552 18.9661 14.3946 19.3796 13.8568C19.7931 13.319 19.9998 12.7 19.9998 12C19.9998 11.1604 19.705 10.444 19.1153 9.85105C18.5255 9.25805 17.8139 8.96155 16.9806 8.96155H13.1728V7.46155H16.9806C18.2293 7.46155 19.2947 7.90422 20.1768 8.78955C21.0588 9.67472 21.4998 10.7449 21.4998 12C21.4998 12.8859 21.262 13.6951 20.7863 14.4278C20.3107 15.1606 19.6767 15.7193 18.8843 16.1038ZM15.5806 12.75L14.0806 11.25H15.7306V12.75H15.5806ZM20.1461 22.2538L1.74609 3.8538L2.79984 2.80005L21.1998 21.2L20.1461 22.2538ZM10.8268 16.5386H7.03834C5.78318 16.5386 4.71301 16.0959 3.82784 15.2105C2.94251 14.3254 2.49984 13.2552 2.49984 12C2.49984 10.8885 2.85784 9.91322 3.57384 9.07405C4.28984 8.23505 5.18826 7.72838 6.26909 7.55405H6.49984L7.90759 8.96155H7.03834C6.19851 8.96155 5.48218 9.25805 4.88934 9.85105C4.29634 10.444 3.99984 11.1604 3.99984 12C3.99984 12.8397 4.29634 13.556 4.88934 14.149C5.48218 14.742 6.19851 15.0385 7.03834 15.0385H10.8268V16.5386ZM8.26909 12.75V11.25H10.2113L11.6863 12.75H8.26909Z`,fill:`currentColor`})),edit:L.createElement(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},L.createElement(`path`,{d:`M5 19H6.2615L16.498 8.7635L15.2365 7.502L5 17.7385V19ZM3.5 20.5V17.1155L16.6905 3.93075C16.8417 3.79342 17.0086 3.68733 17.1913 3.6125C17.3741 3.5375 17.5658 3.5 17.7663 3.5C17.9668 3.5 18.1609 3.53558 18.3488 3.60675C18.5367 3.67792 18.7032 3.79108 18.848 3.94625L20.0693 5.18275C20.2244 5.32758 20.335 5.49425 20.401 5.68275C20.467 5.87125 20.5 6.05975 20.5 6.24825C20.5 6.44942 20.4657 6.64133 20.397 6.824C20.3283 7.00683 20.2191 7.17383 20.0693 7.325L6.8845 20.5H3.5ZM15.8562 8.14375L15.2365 7.502L16.498 8.7635L15.8562 8.14375Z`,fill:`currentColor`})),content_copy:L.createElement(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},L.createElement(`path`,{d:`M9.05775 17.5C8.55258 17.5 8.125 17.325 7.775 16.975C7.425 16.625 7.25 16.1974 7.25 15.6923V4.30775C7.25 3.80258 7.425 3.375 7.775 3.025C8.125 2.675 8.55258 2.5 9.05775 2.5H17.4423C17.9474 2.5 18.375 2.675 18.725 3.025C19.075 3.375 19.25 3.80258 19.25 4.30775V15.6923C19.25 16.1974 19.075 16.625 18.725 16.975C18.375 17.325 17.9474 17.5 17.4423 17.5H9.05775ZM9.05775 16H17.4423C17.5192 16 17.5898 15.9679 17.6538 15.9038C17.7179 15.8398 17.75 15.7692 17.75 15.6923V4.30775C17.75 4.23075 17.7179 4.16025 17.6538 4.09625C17.5898 4.03208 17.5192 4 17.4423 4H9.05775C8.98075 4 8.91025 4.03208 8.84625 4.09625C8.78208 4.16025 8.75 4.23075 8.75 4.30775V15.6923C8.75 15.7692 8.78208 15.8398 8.84625 15.9038C8.91025 15.9679 8.98075 16 9.05775 16ZM5.55775 21C5.05258 21 4.625 20.825 4.275 20.475C3.925 20.125 3.75 19.6974 3.75 19.1923V6.30775H5.25V19.1923C5.25 19.2693 5.28208 19.3398 5.34625 19.4038C5.41025 19.4679 5.48075 19.5 5.55775 19.5H15.4423V21H5.55775Z`,fill:`currentColor`})),more_horiz:L.createElement(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},L.createElement(`path`,{d:`M6.23096 13.5C5.81846 13.5 5.46537 13.3531 5.17171 13.0592C4.87787 12.7656 4.73096 12.4125 4.73096 12C4.73096 11.5875 4.87787 11.2344 5.17171 10.9408C5.46537 10.6469 5.81846 10.5 6.23096 10.5C6.64346 10.5 6.99662 10.6469 7.29046 10.9408C7.58412 11.2344 7.73096 11.5875 7.73096 12C7.73096 12.4125 7.58412 12.7656 7.29046 13.0592C6.99662 13.3531 6.64346 13.5 6.23096 13.5ZM12.0002 13.5C11.5877 13.5 11.2346 13.3531 10.941 13.0592C10.6471 12.7656 10.5002 12.4125 10.5002 12C10.5002 11.5875 10.6471 11.2344 10.941 10.9408C11.2346 10.6469 11.5877 10.5 12.0002 10.5C12.4127 10.5 12.7658 10.6469 13.0595 10.9408C13.3533 11.2344 13.5002 11.5875 13.5002 12C13.5002 12.4125 13.3533 12.7656 13.0595 13.0592C12.7658 13.3531 12.4127 13.5 12.0002 13.5ZM17.7695 13.5C17.357 13.5 17.0038 13.3531 16.71 13.0592C16.4163 12.7656 16.2695 12.4125 16.2695 12C16.2695 11.5875 16.4163 11.2344 16.71 10.9408C17.0038 10.6469 17.357 10.5 17.7695 10.5C18.182 10.5 18.535 10.6469 18.8287 10.9408C19.1225 11.2344 19.2695 11.5875 19.2695 12C19.2695 12.4125 19.1225 12.7656 18.8287 13.0592C18.535 13.3531 18.182 13.5 17.7695 13.5Z`,fill:`currentColor`})),more_vert:L.createElement(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},L.createElement(`path`,{d:`M12 19.2692C11.5875 19.2692 11.2344 19.1223 10.9408 18.8285C10.6469 18.5348 10.5 18.1817 10.5 17.7692C10.5 17.3567 10.6469 17.0035 10.9408 16.7097C11.2344 16.416 11.5875 16.2692 12 16.2692C12.4125 16.2692 12.7656 16.416 13.0592 16.7097C13.3531 17.0035 13.5 17.3567 13.5 17.7692C13.5 18.1817 13.3531 18.5348 13.0592 18.8285C12.7656 19.1223 12.4125 19.2692 12 19.2692ZM12 13.5C11.5875 13.5 11.2344 13.353 10.9408 13.0592C10.6469 12.7655 10.5 12.4125 10.5 12C10.5 11.5875 10.6469 11.2344 10.9408 10.9407C11.2344 10.6469 11.5875 10.5 12 10.5C12.4125 10.5 12.7656 10.6469 13.0592 10.9407C13.3531 11.2344 13.5 11.5875 13.5 12C13.5 12.4125 13.3531 12.7655 13.0592 13.0592C12.7656 13.353 12.4125 13.5 12 13.5ZM12 7.73071C11.5875 7.73071 11.2344 7.58388 10.9408 7.29021C10.6469 6.99638 10.5 6.64321 10.5 6.23071C10.5 5.81821 10.6469 5.46513 10.9408 5.17146C11.2344 4.87763 11.5875 4.73071 12 4.73071C12.4125 4.73071 12.7656 4.87763 13.0592 5.17146C13.3531 5.46513 13.5 5.81821 13.5 6.23071C13.5 6.64321 13.3531 6.99638 13.0592 7.29021C12.7656 7.58388 12.4125 7.73071 12 7.73071Z`,fill:`currentColor`})),close:L.createElement(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},L.createElement(`path`,{d:`M6.39994 18.6538L5.34619 17.6L10.9462 12L5.34619 6.4L6.39994 5.34625L11.9999 10.9463L17.5999 5.34625L18.6537 6.4L13.0537 12L18.6537 17.6L17.5999 18.6538L11.9999 13.0538L6.39994 18.6538Z`,fill:`currentColor`})),settings:L.createElement(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},L.createElement(`path`,{d:`M9.69225 21.5L9.3115 18.4538C9.04367 18.3641 8.769 18.2385 8.4875 18.077C8.20617 17.9153 7.95459 17.7422 7.73275 17.5577L4.9115 18.75L2.604 14.75L5.04425 12.9058C5.02125 12.7571 5.00492 12.6077 4.99525 12.4578C4.98559 12.3078 4.98075 12.1583 4.98075 12.0095C4.98075 11.8673 4.98559 11.7228 4.99525 11.576C5.00492 11.4292 5.02125 11.2686 5.04425 11.0943L2.604 9.25L4.9115 5.26925L7.723 6.452C7.96417 6.261 8.22159 6.08633 8.49525 5.928C8.76892 5.76967 9.03784 5.64242 9.302 5.54625L9.69225 2.5H14.3078L14.6885 5.55575C14.9885 5.66475 15.2599 5.792 15.5028 5.9375C15.7458 6.083 15.991 6.2545 16.2385 6.452L19.0885 5.26925L21.396 9.25L18.9173 11.123C18.9531 11.2845 18.9727 11.4355 18.976 11.576C18.9792 11.7163 18.9808 11.8577 18.9808 12C18.9808 12.1358 18.9775 12.274 18.971 12.4145C18.9647 12.5548 18.9417 12.7154 18.902 12.8963L21.3615 14.75L19.0538 18.75L16.2385 17.548C15.991 17.7455 15.7384 17.9202 15.4808 18.072C15.2231 18.224 14.959 18.3481 14.6885 18.4443L14.3078 21.5H9.69225ZM11 20H12.9655L13.325 17.3212C13.8353 17.1879 14.3017 16.9985 14.724 16.753C15.1465 16.5073 15.5539 16.1916 15.9463 15.8057L18.4308 16.85L19.4155 15.15L17.2463 13.5155C17.3296 13.2565 17.3863 13.0026 17.4163 12.7537C17.4464 12.5051 17.4615 12.2538 17.4615 12C17.4615 11.7397 17.4464 11.4884 17.4163 11.2463C17.3863 11.0039 17.3296 10.7564 17.2463 10.5038L19.4345 8.85L18.45 7.15L15.9365 8.2095C15.6018 7.85183 15.2009 7.53583 14.7338 7.2615C14.2664 6.98717 13.7937 6.79292 13.3155 6.67875L13 4H11.0155L10.6845 6.66925C10.1743 6.78975 9.70325 6.97433 9.27125 7.223C8.83909 7.47183 8.42684 7.79233 8.0345 8.1845L5.55 7.15L4.5655 8.85L6.725 10.4595C6.64167 10.6968 6.58334 10.9437 6.55 11.2C6.51667 11.4563 6.5 11.7262 6.5 12.0095C6.5 12.2698 6.51667 12.525 6.55 12.775C6.58334 13.025 6.6385 13.2718 6.7155 13.5155L4.5655 15.15L5.55 16.85L8.025 15.8C8.4045 16.1897 8.81025 16.5089 9.24225 16.7578C9.67442 17.0064 10.152 17.1974 10.675 17.3307L11 20ZM12.0115 15C12.8435 15 13.5515 14.708 14.1355 14.124C14.7195 13.54 15.0115 12.832 15.0115 12C15.0115 11.168 14.7195 10.46 14.1355 9.876C13.5515 9.292 12.8435 9 12.0115 9C11.1692 9 10.4586 9.292 9.87975 9.876C9.30092 10.46 9.0115 11.168 9.0115 12C9.0115 12.832 9.30092 13.54 9.87975 14.124C10.4586 14.708 11.1692 15 12.0115 15Z`,fill:`currentColor`})),delete_big:L.createElement(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},L.createElement(`path`,{d:`M7.30775 20.5C6.80908 20.5 6.38308 20.3234 6.02975 19.9702C5.67658 19.6169 5.5 19.1909 5.5 18.6922V5.99998H4.5V4.49998H9V3.61548H15V4.49998H19.5V5.99998H18.5V18.6922C18.5 19.1974 18.325 19.625 17.975 19.975C17.625 20.325 17.1974 20.5 16.6923 20.5H7.30775ZM17 5.99998H7V18.6922C7 18.7821 7.02883 18.8558 7.0865 18.9135C7.14417 18.9711 7.21792 19 7.30775 19H16.6923C16.7692 19 16.8398 18.9679 16.9038 18.9037C16.9679 18.8397 17 18.7692 17 18.6922V5.99998ZM9.404 17H10.9037V7.99998H9.404V17ZM13.0962 17H14.596V7.99998H13.0962V17Z`,fill:`currentColor`})),delete_small:L.createElement(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},L.createElement(`path`,{d:`M7.30775 20.5C6.80908 20.5 6.38308 20.3234 6.02975 19.9702C5.67658 19.6169 5.5 19.1909 5.5 18.6922V5.99998H4.5V4.49998H9V3.61548H15V4.49998H19.5V5.99998H18.5V18.6922C18.5 19.1974 18.325 19.625 17.975 19.975C17.625 20.325 17.1974 20.5 16.6923 20.5H7.30775ZM17 5.99998H7V18.6922C7 18.7821 7.02883 18.8558 7.0865 18.9135C7.14417 18.9711 7.21792 19 7.30775 19H16.6923C16.7692 19 16.8398 18.9679 16.9038 18.9037C16.9679 18.8397 17 18.7692 17 18.6922V5.99998ZM9.404 17H10.9037V7.99998H9.404V17ZM13.0962 17H14.596V7.99998H13.0962V17Z`,fill:`currentColor`})),format_align_center:L.createElement(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},L.createElement(`path`,{d:`M3.5 20.5V19H20.5V20.5H3.5ZM7.5 16.625V15.125H16.5V16.625H7.5ZM3.5 12.75V11.25H20.5V12.75H3.5ZM7.5 8.875V7.375H16.5V8.875H7.5ZM3.5 5V3.5H20.5V5H3.5Z`,fill:`currentColor`})),format_align_left:L.createElement(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},L.createElement(`path`,{d:`M3.5 20.5V19H20.5V20.5H3.5ZM3.5 16.625V15.125H14.5V16.625H3.5ZM3.5 12.75V11.25H20.5V12.75H3.5ZM3.5 8.875V7.375H14.5V8.875H3.5ZM3.5 5V3.5H20.5V5H3.5Z`,fill:`currentColor`})),format_align_right:L.createElement(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},L.createElement(`path`,{d:`M3.5 5V3.5H20.5V5H3.5ZM9.5 8.875V7.375H20.5V8.875H9.5ZM3.5 12.75V11.25H20.5V12.75H3.5ZM9.5 16.625V15.125H20.5V16.625H9.5ZM3.5 20.5V19H20.5V20.5H3.5Z`,fill:`currentColor`})),add_row:L.createElement(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},L.createElement(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M4.025 10.2077C4.375 9.85775 4.80258 9.68275 5.30775 9.68275H6.5V11.1827H5.30775C5.21792 11.1827 5.14417 11.2116 5.0865 11.2693C5.02883 11.3269 5 11.4007 5 11.4905V16.1923C5 16.2821 5.02883 16.3558 5.0865 16.4135C5.14417 16.4712 5.21792 16.5 5.30775 16.5H18.6923C18.7821 16.5 18.8558 16.4712 18.9135 16.4135C18.9712 16.3558 19 16.2821 19 16.1923V11.4905C19 11.4007 18.9712 11.3269 18.9135 11.2693C18.8558 11.2116 18.7821 11.1827 18.6923 11.1827H17.6923V9.68275H18.6923C19.1974 9.68275 19.625 9.85775 19.975 10.2077C20.325 10.5577 20.5 10.9853 20.5 11.4905V16.1923C20.5 16.6974 20.325 17.125 19.975 17.475C19.625 17.825 19.1974 18 18.6923 18H5.30775C4.80258 18 4.375 17.825 4.025 17.475C3.675 17.125 3.5 16.6974 3.5 16.1923V11.4905C3.5 10.9853 3.675 10.5577 4.025 10.2077Z`,fill:`currentColor`}),L.createElement(`path`,{d:`M11.3848 9.68275V7.5H12.8848V9.68275H15V11.1827H12.8848V13.2307H11.3848V11.1827H9.26925V9.68275H11.3848Z`,fill:`currentColor`})),add_column:L.createElement(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},L.createElement(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M9.70775 4.025C9.35775 4.375 9.18275 4.80258 9.18275 5.30775V6.5H10.6827V5.30775C10.6827 5.21792 10.7116 5.14417 10.7693 5.0865C10.8269 5.02883 10.9007 5 10.9905 5H15.6923C15.7821 5 15.8558 5.02883 15.9135 5.0865C15.9712 5.14417 16 5.21792 16 5.30775V18.6923C16 18.7821 15.9712 18.8558 15.9135 18.9135C15.8558 18.9712 15.7821 19 15.6923 19H10.9905C10.9007 19 10.8269 18.9712 10.7693 18.9135C10.7116 18.8558 10.6827 18.7821 10.6827 18.6923V17.6923H9.18275V18.6923C9.18275 19.1974 9.35775 19.625 9.70775 19.975C10.0577 20.325 10.4853 20.5 10.9905 20.5H15.6923C16.1974 20.5 16.625 20.325 16.975 19.975C17.325 19.625 17.5 19.1974 17.5 18.6923V5.30775C17.5 4.80258 17.325 4.375 16.975 4.025C16.625 3.675 16.1974 3.5 15.6923 3.5H10.9905C10.4853 3.5 10.0577 3.675 9.70775 4.025Z`,fill:`currentColor`}),L.createElement(`path`,{d:`M9.18275 11.3848H7V12.8848H9.18275V15H10.6827V12.8848H12.7307V11.3848H10.6827V9.26925H9.18275V11.3848Z`,fill:`currentColor`})),insert_col_left:L.createElement(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},L.createElement(`path`,{d:`M13.0001 20.1152H8.67713H8.75388H8.69238H13.0001ZM7.19238 19.8075C7.19238 20.3127 7.36738 20.7402 7.71738 21.0902C8.06738 21.4402 8.49497 21.6152 9.00013 21.6152H12.6924C13.1975 21.6152 13.6251 21.4402 13.9751 21.0902C14.3251 20.7402 14.5001 20.3127 14.5001 19.8075V10.423H13.0001V19.8075C13.0001 19.8973 12.9713 19.9711 12.9136 20.0287C12.856 20.0864 12.7822 20.1152 12.6924 20.1152H9.00013C8.9103 20.1152 8.83655 20.0864 8.77888 20.0287C8.72122 19.9711 8.69238 19.8973 8.69238 19.8075V4.69223C8.26422 4.74357 7.90722 4.93299 7.62138 5.26048C7.33538 5.58798 7.19238 5.97548 7.19238 6.42298V19.8075ZM13.0001 2.49998V4.61523H10.8846V6.11523H13.0001V8.23073H14.5001V6.11523H16.6154V4.61523H14.5001V2.49998H13.0001Z`,fill:`currentColor`})),insert_row_above:L.createElement(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},L.createElement(`path`,{d:`M20.1152 9.99987V14.3229V14.2461V14.3076V9.99987ZM19.8075 15.8076C20.3127 15.8076 20.7402 15.6326 21.0902 15.2826C21.4402 14.9326 21.6152 14.505 21.6152 13.9999V10.3076C21.6152 9.80245 21.4402 9.37487 21.0902 9.02487C20.7402 8.67487 20.3127 8.49987 19.8075 8.49987H10.423V9.99987H19.8075C19.8973 9.99987 19.9711 10.0287 20.0287 10.0864C20.0864 10.144 20.1152 10.2178 20.1152 10.3076V13.9999C20.1152 14.0897 20.0864 14.1635 20.0287 14.2211C19.9711 14.2788 19.8973 14.3076 19.8075 14.3076H4.69223C4.74357 14.7358 4.93299 15.0928 5.26048 15.3786C5.58798 15.6646 5.97548 15.8076 6.42298 15.8076H19.8075ZM2.49998 9.99987H4.61523V12.1154H6.11523V9.99987H8.23073V8.49987H6.11523V6.38462H4.61523V8.49987H2.49998V9.99987Z`,fill:`currentColor`})),insert_row_below:L.createElement(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},L.createElement(`path`,{d:`M20.1152 14.1924V9.86939V9.94614V9.88464V14.1924ZM19.8075 8.38464C20.3127 8.38464 20.7402 8.55964 21.0902 8.90964C21.4402 9.25964 21.6152 9.68723 21.6152 10.1924V13.8846C21.6152 14.3898 21.4402 14.8174 21.0902 15.1674C20.7402 15.5174 20.3127 15.6924 19.8075 15.6924H10.423V14.1924H19.8075C19.8973 14.1924 19.9711 14.1636 20.0287 14.1059C20.0864 14.0482 20.1152 13.9745 20.1152 13.8846V10.1924C20.1152 10.1026 20.0864 10.0288 20.0287 9.97114C19.9711 9.91348 19.8973 9.88464 19.8075 9.88464H4.69223C4.74357 9.45648 4.93299 9.09948 5.26048 8.81364C5.58798 8.52764 5.97548 8.38464 6.42298 8.38464H19.8075ZM2.49998 14.1924H4.61523V12.0769H6.11523V14.1924H8.23073V15.6924H6.11523V17.8076H4.61523V15.6924H2.49998V14.1924Z`,fill:`currentColor`})),insert_col_right:L.createElement(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},L.createElement(`path`,{d:`M10.8075 20.1152H15.1305H15.0537H15.1152H10.8075ZM16.6152 19.8075C16.6152 20.3127 16.4402 20.7402 16.0902 21.0902C15.7402 21.4402 15.3127 21.6152 14.8075 21.6152H11.1152C10.6101 21.6152 10.1825 21.4402 9.83248 21.0902C9.48248 20.7402 9.30748 20.3127 9.30748 19.8075V10.423H10.8075V19.8075C10.8075 19.8973 10.8363 19.9711 10.894 20.0287C10.9517 20.0864 11.0254 20.1152 11.1152 20.1152H14.8075C14.8973 20.1152 14.9711 20.0864 15.0287 20.0287C15.0864 19.9711 15.1152 19.8973 15.1152 19.8075V4.69223C15.5434 4.74357 15.9004 4.93299 16.1862 5.26048C16.4722 5.58798 16.6152 5.97548 16.6152 6.42298V19.8075ZM10.8075 2.49998V4.61523H12.923V6.11523H10.8075V8.23073H9.30748V6.11523H7.19223V4.61523H9.30748V2.49998H10.8075Z`,fill:`currentColor`})),check:L.createElement(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},L.createElement(`path`,{d:`M9.54983 17.6537L4.21533 12.3192L5.28433 11.25L9.54983 15.5155L18.7153 6.34998L19.7843 7.41923L9.54983 17.6537Z`,fill:`currentColor`}))},fE={editorRoot:`_editorRoot_1e2ox_53`,editorWrapper:`_editorWrapper_1e2ox_155`,toolbarRoot:`_toolbarRoot_1e2ox_162`,readOnlyToolbarRoot:`_readOnlyToolbarRoot_1e2ox_189`,toolbarToggleItem:`_toolbarToggleItem_1e2ox_208`,toolbarGroupOfGroups:`_toolbarGroupOfGroups_1e2ox_219`,toolbarToggleSingleGroup:`_toolbarToggleSingleGroup_1e2ox_224`,toolbarButton:`_toolbarButton_1e2ox_239`,activeToolbarButton:`_activeToolbarButton_1e2ox_275`,toolbarButtonDropdownContainer:`_toolbarButtonDropdownContainer_1e2ox_286`,selectContainer:`_selectContainer_1e2ox_288`,selectItem:`_selectItem_1e2ox_301`,toolbarButtonSelectTrigger:`_toolbarButtonSelectTrigger_1e2ox_307`,selectTrigger:`_selectTrigger_1e2ox_308`,selectDropdownArrow:`_selectDropdownArrow_1e2ox_374`,contentEditable:`_contentEditable_1e2ox_380`,codeMirrorWrapper:`_codeMirrorWrapper_1e2ox_392`,sandPackWrapper:`_sandPackWrapper_1e2ox_401`,codeMirrorToolbar:`_codeMirrorToolbar_1e2ox_409`,propertyPanelTitle:`_propertyPanelTitle_1e2ox_431`,propertyEditorTable:`_propertyEditorTable_1e2ox_439`,iconButton:`_iconButton_1e2ox_457`,readOnlyColumnCell:`_readOnlyColumnCell_1e2ox_462`,buttonsFooter:`_buttonsFooter_1e2ox_475`,propertyEditorInput:`_propertyEditorInput_1e2ox_481`,primaryButton:`_primaryButton_1e2ox_507`,secondaryButton:`_secondaryButton_1e2ox_508`,smallButton:`_smallButton_1e2ox_523`,dialogForm:`_dialogForm_1e2ox_535`,linkDialogEditForm:`_linkDialogEditForm_1e2ox_541`,linkDialogInputContainer:`_linkDialogInputContainer_1e2ox_549`,linkDialogInputWrapper:`_linkDialogInputWrapper_1e2ox_555`,linkDialogInput:`_linkDialogInput_1e2ox_549`,linkDialogAnchor:`_linkDialogAnchor_1e2ox_587`,linkDialogPopoverContent:`_linkDialogPopoverContent_1e2ox_601`,tableColumnEditorPopoverContent:`_tableColumnEditorPopoverContent_1e2ox_602`,dialogContent:`_dialogContent_1e2ox_603`,largeDialogContent:`_largeDialogContent_1e2ox_615`,dialogTitle:`_dialogTitle_1e2ox_625`,dialogCloseButton:`_dialogCloseButton_1e2ox_631`,popoverContent:`_popoverContent_1e2ox_638`,popoverArrow:`_popoverArrow_1e2ox_650`,linkDialogPreviewAnchor:`_linkDialogPreviewAnchor_1e2ox_654`,tooltipTrigger:`_tooltipTrigger_1e2ox_677`,tooltipContent:`_tooltipContent_1e2ox_681`,actionButton:`_actionButton_1e2ox_695`,primaryActionButton:`_primaryActionButton_1e2ox_702`,tableEditor:`_tableEditor_1e2ox_714`,toolCell:`_toolCell_1e2ox_725`,tableColumnEditorTrigger:`_tableColumnEditorTrigger_1e2ox_744`,addRowButton:`_addRowButton_1e2ox_746`,addColumnButton:`_addColumnButton_1e2ox_747`,tableColumnEditorToolbar:`_tableColumnEditorToolbar_1e2ox_789`,toggleGroupRoot:`_toggleGroupRoot_1e2ox_802`,tableToolsColumn:`_tableToolsColumn_1e2ox_820`,leftAlignedCell:`_leftAlignedCell_1e2ox_829`,rightAlignedCell:`_rightAlignedCell_1e2ox_833`,centeredCell:`_centeredCell_1e2ox_837`,dialogOverlay:`_dialogOverlay_1e2ox_870`,focusedImage:`_focusedImage_1e2ox_916`,imageWrapper:`_imageWrapper_1e2ox_920`,editImageToolbar:`_editImageToolbar_1e2ox_933`,editImageButton:`_editImageButton_1e2ox_937`,inlineEditor:`_inlineEditor_1e2ox_943`,blockEditor:`_blockEditor_1e2ox_952`,nestedEditor:`_nestedEditor_1e2ox_961`,genericComponentName:`_genericComponentName_1e2ox_980`,diffSourceToggleWrapper:`_diffSourceToggleWrapper_1e2ox_986`,ggDiffSourceToggle:`_ggDiffSourceToggle_1e2ox_994`,diffSourceToggle:`_diffSourceToggle_1e2ox_986`,selectWithLabel:`_selectWithLabel_1e2ox_1012`,toolbarTitleMode:`_toolbarTitleMode_1e2ox_1027`,imageControlWrapperResizing:`_imageControlWrapperResizing_1e2ox_1032`,imageResizer:`_imageResizer_1e2ox_1036`,imageResizerN:`_imageResizerN_1e2ox_1045`,imageResizerNe:`_imageResizerNe_1e2ox_1051`,imageResizerE:`_imageResizerE_1e2ox_1057`,imageResizerSe:`_imageResizerSe_1e2ox_1063`,imageResizerS:`_imageResizerS_1e2ox_1063`,imageResizerSw:`_imageResizerSw_1e2ox_1075`,imageResizerW:`_imageResizerW_1e2ox_1081`,imageResizerNw:`_imageResizerNw_1e2ox_1087`,imagePlaceholder:`_imagePlaceholder_1e2ox_1093`,imageDimensionsContainer:`_imageDimensionsContainer_1e2ox_1101`,placeholder:`_placeholder_1e2ox_1106`,rootContentEditableWrapper:`_rootContentEditableWrapper_1e2ox_1119`,downshiftInputWrapper:`_downshiftInputWrapper_1e2ox_1129`,downshiftInput:`_downshiftInput_1e2ox_1129`,downshiftAutocompleteContainer:`_downshiftAutocompleteContainer_1e2ox_1160`,textInput:`_textInput_1e2ox_1206`,multiFieldForm:`_multiFieldForm_1e2ox_1214`,formField:`_formField_1e2ox_1220`,markdownParseError:`_markdownParseError_1e2ox_1231`,popupContainer:`_popupContainer_1e2ox_1240`,inputSizer:`_inputSizer_1e2ox_1245`},jre=new Set([`http:`,`https:`,`mailto:`,`sms:`,`tel:`]),pE=class e extends zm{static getType(){return`link`}static clone(t){return new e(t.__url,{rel:t.__rel,target:t.__target,title:t.__title},t.__key)}constructor(e=``,t={},n){super(n);let{target:r=null,rel:i=null,title:a=null}=t;this.__url=e,this.__target=r,this.__rel=i,this.__title=a}createDOM(e){let t=document.createElement(`a`);return this.updateLinkDOM(null,t,e),B_(t,e.theme.link),t}updateLinkDOM(e,t,n){if(vg(t)){e&&e.__url===this.__url||(t.href=this.sanitizeUrl(this.__url));for(let n of[`target`,`rel`,`title`]){let r=`__${n}`,i=this[r];e&&e[r]===i||(i?t[n]=i:t.removeAttribute(n))}}}updateDOM(e,t,n){return this.updateLinkDOM(e,t,n),!1}static importDOM(){return{a:e=>({conversion:Mre,priority:1})}}static importJSON(e){return mE().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setURL(e.url).setRel(e.rel||null).setTarget(e.target||null).setTitle(e.title||null)}sanitizeUrl(e){e=CE(e);try{let t=new URL(CE(e));if(!jre.has(t.protocol))return`about:blank`}catch{return e}return e}exportJSON(){return{...super.exportJSON(),rel:this.getRel(),target:this.getTarget(),title:this.getTitle(),url:this.getURL()}}getURL(){return this.getLatest().__url}setURL(e){let t=this.getWritable();return t.__url=e,t}getTarget(){return this.getLatest().__target}setTarget(e){let t=this.getWritable();return t.__target=e,t}getRel(){return this.getLatest().__rel}setRel(e){let t=this.getWritable();return t.__rel=e,t}getTitle(){return this.getLatest().__title}setTitle(e){let t=this.getWritable();return t.__title=e,t}insertNewAfter(e,t=!0){let n=mE(this.__url,{rel:this.__rel,target:this.__target,title:this.__title});return this.insertAfter(n,t),n}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}canBeEmpty(){return!1}isInline(){return!0}extractWithChild(e,t,n){if(!U(t))return!1;let r=t.anchor.getNode(),i=t.focus.getNode();return this.isParentOf(r)&&this.isParentOf(i)&&t.getTextContent().length>0}isEmailURI(){return this.__url.startsWith(`mailto:`)}isWebSiteURI(){return this.__url.startsWith(`https://`)||this.__url.startsWith(`http://`)}};function Mre(e){let t=null;if(vg(e)){let n=e.textContent;(n!==null&&n!==``||e.children.length>0)&&(t=mE(e.getAttribute(`href`)||``,{rel:e.getAttribute(`rel`),target:e.getAttribute(`target`),title:e.getAttribute(`title`)}))}return{node:t}}function mE(e=``,t){return fg(new pE(e,t))}function hE(e){return e instanceof pE}var gE=class e extends pE{constructor(e=``,t={},n){super(e,t,n),this.__isUnlinked=t.isUnlinked!==void 0&&t.isUnlinked!==null&&t.isUnlinked}static getType(){return`autolink`}static clone(t){return new e(t.__url,{isUnlinked:t.__isUnlinked,rel:t.__rel,target:t.__target,title:t.__title},t.__key)}getIsUnlinked(){return this.__isUnlinked}setIsUnlinked(e){let t=this.getWritable();return t.__isUnlinked=e,t}createDOM(e){return this.__isUnlinked?document.createElement(`span`):super.createDOM(e)}updateDOM(e,t,n){return super.updateDOM(e,t,n)||e.__isUnlinked!==this.__isUnlinked}static importJSON(e){return _E().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setIsUnlinked(e.isUnlinked||!1)}static importDOM(){return null}exportJSON(){return{...super.exportJSON(),isUnlinked:this.__isUnlinked}}insertNewAfter(e,t=!0){let n=this.getParentOrThrow().insertNewAfter(e,t);if(G(n)){let e=_E(this.__url,{isUnlinked:this.__isUnlinked,rel:this.__rel,target:this.__target,title:this.__title});return n.append(e),e}return null}};function _E(e=``,t){return fg(new gE(e,t))}function vE(e){return e instanceof gE}var yE=Vd(`TOGGLE_LINK_COMMAND`);function bE(e,t){if(e.type===`element`){let n=e.getNode();return G(n)||function(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(252),n.getChildren()[e.offset+t]||null}return null}function xE(e,t={}){let{target:n,title:r}=t,i=t.rel===void 0?`noreferrer`:t.rel,a=W();if(a===null||!U(a)&&!Up(a))return;if(Up(a)){let t=a.getNodes();if(t.length===0)return;t.forEach((t=>{if(e===null){let e=W_(t,(e=>!vE(e)&&hE(e)));e&&(e.insertBefore(t),e.getChildren().length===0&&e.remove())}else{let r=W_(t,(e=>!vE(e)&&hE(e)));if(r)r.setURL(e),n!==void 0&&r.setTarget(n),i!==void 0&&r.setRel(i);else{let r=mE(e,{rel:i,target:n});t.insertBefore(r),r.append(t)}}}));return}let o=a.extract();if(e===null)return void o.forEach((e=>{let t=W_(e,(e=>!vE(e)&&hE(e)));if(t){let e=t.getChildren();for(let n=0;n<e.length;n++)t.insertBefore(e[n]);t.remove()}}));let s=new Set,c=t=>{s.has(t.getKey())||(s.add(t.getKey()),t.setURL(e),n!==void 0&&t.setTarget(n),i!==void 0&&t.setRel(i),r!==void 0&&t.setTitle(r))};if(o.length===1){let e=SE(o[0],hE);if(e!==null)return c(e)}(function(e){let t=W();if(!U(t))return e();let n=ad(t),r=n.isBackward(),i=bE(n.anchor,r?-1:0),a=bE(n.focus,r?0:-1);if(e(),i||a){let e=W();if(U(e)){let t=e.clone();if(i){let e=i.getParent();e&&t.anchor.set(e.getKey(),i.getIndexWithinParent()+ +!!r,`element`)}if(a){let e=a.getParent();e&&t.focus.set(e.getKey(),a.getIndexWithinParent()+ +!r,`element`)}Fh(ad(t))}}})((()=>{let t=null;for(let a of o){if(!a.isAttached())continue;let o=SE(a,hE);if(o){c(o);continue}if(G(a)){if(!a.isInline())continue;if(hE(a)){if(!(vE(a)||t!==null&&t.getParentOrThrow().isParentOf(a))){c(a),t=a;continue}for(let e of a.getChildren())a.insertBefore(e);a.remove();continue}}let s=a.getPreviousSibling();hE(s)&&s.is(t)?s.append(a):(t=mE(e,{rel:i,target:n,title:r}),a.insertAfter(t),t.append(a))}}))}function SE(e,t){let n=e;for(;n!==null&&n.getParent()!==null&&!t(n);)n=n.getParentOrThrow();return t(n)?n:null}var Nre=/^\+?[0-9\s()-]{5,}$/;function CE(e){return e.match(/^[a-z][a-z0-9+.-]*:/i)||e.match(/^[/#.]/)?e:e.includes(`@`)?`mailto:${e}`:Nre.test(e)?`tel:${e}`:`https://${e}`}function wE(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function TE(e){let t=1,n=e.getParent();for(;n!=null;){if(zE(n)){let e=n.getParent();if(WE(e)){t++,n=e.getParent();continue}wE(40)}return t}return t}function EE(e){let t=e.getParent();WE(t)||wE(40);let n=t;for(;n!==null;)n=n.getParent(),WE(n)&&(t=n);return t}function DE(e){let t=[],n=e.getChildren().filter(zE);for(let e=0;e<n.length;e++){let r=n[e],i=r.getFirstChild();WE(i)?t=t.concat(DE(i)):t.push(r)}return t}function OE(e){return zE(e)&&WE(e.getFirstChild())}function kE(e){return RE().append(e)}function AE(e,t){return zE(e)&&(t.length===0||t.length===1&&e.is(t[0])&&e.getChildrenSize()===0)}function jE(e){let t=W();if(t!==null){let n=t.getNodes();if(U(t)){let r=t.getStartEndPoints();r===null&&wE(143);let[i]=r,a=i.getNode(),o=a.getParent();if(ug(a)){let e=a.getFirstChild();if(e)n=e.selectStart().getNodes();else{let e=$m();a.append(e),n=e.select().getNodes()}}else if(AE(a,n)){let t=UE(e);if(ug(o)){a.replace(t);let e=RE();G(a)&&(e.setFormat(a.getFormatType()),e.setIndent(a.getIndent())),t.append(e)}else if(zE(a)){let e=a.getParentOrThrow();ME(t,e.getChildren()),e.replace(t)}return}}let r=new Set;for(let t=0;t<n.length;t++){let i=n[t];if(G(i)&&i.isEmpty()&&!zE(i)&&!r.has(i.getKey())){NE(i,e);continue}let a=xh(i)?i.getParent():zE(i)&&i.isEmpty()?i:null;for(;a!=null;){let t=a.getKey();if(WE(a)){if(!r.has(t)){let n=UE(e);ME(n,a.getChildren()),a.replace(n),r.add(t)}break}{let n=a.getParent();if(ug(n)&&!r.has(t)){r.add(t),NE(a,e);break}a=n}}}}}function ME(e,t){e.splice(e.getChildrenSize(),0,t)}function NE(e,t){if(WE(e))return e;let n=e.getPreviousSibling(),r=e.getNextSibling(),i=RE(),a;if(ME(i,e.getChildren()),WE(n)&&t===n.getListType())n.append(i),WE(r)&&t===r.getListType()&&(ME(n,r.getChildren()),r.remove()),a=n;else if(WE(r)&&t===r.getListType())r.getFirstChildOrThrow().insertBefore(i),a=r;else{let n=UE(t);n.append(i),e.replace(n),a=n}return i.setFormat(e.getFormatType()),i.setIndent(e.getIndent()),e.remove(),a}function PE(e,t){let n=e.getLastChild(),r=t.getFirstChild();n&&r&&OE(n)&&OE(r)&&(PE(n.getFirstChild(),r.getFirstChild()),r.remove());let i=t.getChildren();i.length>0&&e.append(...i),t.remove()}function Pre(){let e=W();if(U(e)){let t=new Set,n=e.getNodes(),r=e.anchor.getNode();if(AE(r,n))t.add(EE(r));else for(let e=0;e<n.length;e++){let r=n[e];if(xh(r)){let e=H_(r,LE);e!=null&&t.add(EE(e))}}for(let n of t){let t=n,r=DE(n);for(let n of r){let r=$m().setTextStyle(e.style).setTextFormat(e.format);ME(r,n.getChildren()),t.insertAfter(r),t=r,n.__key===e.anchor.key&&u_(e.anchor,v_(Qg(r,`next`))),n.__key===e.focus.key&&u_(e.focus,v_(Qg(r,`next`))),n.remove()}n.remove()}}}function FE(e){let t=e.getListType()!==`check`,n=e.getStart();for(let r of e.getChildren())zE(r)&&(r.getValue()!==n&&r.setValue(n),t&&r.getLatest().__checked!=null&&r.setChecked(void 0),WE(r.getFirstChild())||n++)}function Fre(e){let t=new Set;if(OE(e)||t.has(e.getKey()))return;let n=e.getParent(),r=e.getNextSibling(),i=e.getPreviousSibling();if(OE(r)&&OE(i)){let n=i.getFirstChild();if(WE(n)){n.append(e);let i=r.getFirstChild();WE(i)&&(ME(n,i.getChildren()),r.remove(),t.add(r.getKey()))}}else if(OE(r)){let t=r.getFirstChild();if(WE(t)){let n=t.getFirstChild();n!==null&&n.insertBefore(e)}}else if(OE(i)){let t=i.getFirstChild();WE(t)&&t.append(e)}else if(WE(n)){let t=RE().setTextFormat(e.getTextFormat()).setTextStyle(e.getTextStyle()),a=UE(n.getListType()).setTextFormat(n.getTextFormat()).setTextStyle(n.getTextStyle());t.append(a),a.append(e),i?i.insertAfter(t):r?r.insertBefore(t):n.append(t)}}function Ire(e){if(OE(e))return;let t=e.getParent(),n=t?t.getParent():void 0;if(WE(n?n.getParent():void 0)&&zE(n)&&WE(t)){let r=t?t.getFirstChild():void 0,i=t?t.getLastChild():void 0;if(e.is(r))n.insertBefore(e),t.isEmpty()&&n.remove();else if(e.is(i))n.insertAfter(e),t.isEmpty()&&n.remove();else{let r=t.getListType(),i=RE(),a=UE(r);i.append(a),e.getPreviousSiblings().forEach((e=>a.append(e)));let o=RE(),s=UE(r);o.append(s),ME(s,e.getNextSiblings()),n.insertBefore(i),n.insertAfter(o),n.replace(e)}}}function Lre(){let e=W();if(!U(e)||!e.isCollapsed())return!1;let t=e.anchor.getNode();if(!zE(t)||t.getChildrenSize()!==0)return!1;let n=EE(t),r=t.getParent();WE(r)||wE(40);let i=r.getParent(),a;if(ug(i))a=$m(),n.insertAfter(a);else{if(!zE(i))return!1;a=RE(),i.insertAfter(a)}a.setTextStyle(e.style).setTextFormat(e.format).select();let o=t.getNextSiblings();if(o.length>0){let e=UE(r.getListType());if(zE(a)){let t=RE();t.append(e),a.insertAfter(t)}else a.insertAfter(e);e.append(...o)}return function(e){let t=e;for(;t.getNextSibling()==null&&t.getPreviousSibling()==null;){let e=t.getParent();if(e==null||!zE(e)&&!WE(e))break;t=e}t.remove()}(t),!0}function IE(...e){let t=[];for(let n of e)if(n&&typeof n==`string`)for(let[e]of n.matchAll(/\S+/g))t.push(e);return t}var LE=class extends zm{$config(){return this.config(`listitem`,{$transform:e=>{if(e.__checked==null)return;let t=e.getParent();WE(t)&&t.getListType()!==`check`&&e.getChecked()!=null&&e.setChecked(void 0)},extends:zm,importDOM:up({li:()=>({conversion:Rre,priority:0})})})}constructor(e=1,t=void 0,n){super(n),this.__value=e===void 0?1:e,this.__checked=t}afterCloneFrom(e){super.afterCloneFrom(e),this.__value=e.__value,this.__checked=e.__checked}createDOM(e){let t=document.createElement(`li`);return this.updateListItemDOM(null,t,e),t}updateListItemDOM(e,t,n){let r=this.getParent();WE(r)&&r.getListType()===`check`&&function(e,t,n,r){WE(t.getFirstChild())?(e.removeAttribute(`role`),e.removeAttribute(`tabIndex`),e.removeAttribute(`aria-checked`)):(e.setAttribute(`role`,`checkbox`),e.setAttribute(`tabIndex`,`-1`),n&&t.__checked===n.__checked||e.setAttribute(`aria-checked`,t.getChecked()?`true`:`false`))}(t,this,e),t.value=this.__value,function(e,t,n){let r=[],i=[],a=t.list,o=a?a.listitem:void 0,s;if(a&&a.nested&&(s=a.nested.listitem),o!==void 0&&r.push(...IE(o)),a){let e=n.getParent(),t=WE(e)&&e.getListType()===`check`,o=n.getChecked();t&&!o||i.push(a.listitemUnchecked),t&&o||i.push(a.listitemChecked),t&&r.push(o?a.listitemChecked:a.listitemUnchecked)}if(s!==void 0){let e=IE(s);n.getChildren().some((e=>WE(e)))?r.push(...e):i.push(...e)}i.length>0&&V_(e,...i),r.length>0&&B_(e,...r)}(t,n.theme,this);let i=e?e.__style:``,a=this.__style;i!==a&&(a===``?t.removeAttribute(`style`):t.style.cssText=a),function(e,t,n){let r=w_(t.__textStyle);for(let t in r)e.style.setProperty(`--listitem-marker-${t}`,r[t]);if(n)for(let t in w_(n.__textStyle))t in r||e.style.removeProperty(`--listitem-marker-${t}`)}(t,this,e)}updateDOM(e,t,n){let r=t;return this.updateListItemDOM(e,r,n),!1}updateFromJSON(e){return super.updateFromJSON(e).setValue(e.value).setChecked(e.checked)}exportDOM(e){let t=this.createDOM(e._config),n=this.getFormatType();n&&(t.style.textAlign=n);let r=this.getDirection();return r&&(t.dir=r),{element:t}}exportJSON(){return{...super.exportJSON(),checked:this.getChecked(),value:this.getValue()}}append(...e){for(let t=0;t<e.length;t++){let n=e[t];if(G(n)&&this.canMergeWith(n)){let e=n.getChildren();this.append(...e),n.remove()}else super.append(n)}return this}replace(e,t){if(zE(e))return super.replace(e);this.setIndent(0);let n=this.getParentOrThrow();if(!WE(n))return e;if(n.__first===this.getKey())n.insertBefore(e);else if(n.__last===this.getKey())n.insertAfter(e);else{let t=UE(n.getListType()),r=this.getNextSibling();for(;r;){let e=r;r=r.getNextSibling(),t.append(e)}n.insertAfter(e),e.insertAfter(t)}return t&&(G(e)||wE(139),this.getChildren().forEach((t=>{e.append(t)}))),this.remove(),n.getChildrenSize()===0&&n.remove(),e}insertAfter(e,t=!0){let n=this.getParentOrThrow();if(WE(n)||wE(39),zE(e))return super.insertAfter(e,t);let r=this.getNextSiblings();if(n.insertAfter(e,t),r.length!==0){let i=UE(n.getListType());r.forEach((e=>i.append(e))),e.insertAfter(i,t)}return e}remove(e){let t=this.getPreviousSibling(),n=this.getNextSibling();super.remove(e),t&&n&&OE(t)&&OE(n)&&(PE(t.getFirstChild(),n.getFirstChild()),n.remove())}insertNewAfter(e,t=!0){let n=RE().updateFromJSON(this.exportJSON()).setChecked(!this.getChecked()&&void 0);return this.insertAfter(n,t),n}collapseAtStart(e){let t=$m();this.getChildren().forEach((e=>t.append(e)));let n=this.getParentOrThrow(),r=n.getParentOrThrow(),i=zE(r);if(n.getChildrenSize()===1)if(i)n.remove(),r.select();else{n.insertBefore(t),n.remove();let r=e.anchor,i=e.focus,a=t.getKey();r.type===`element`&&r.getNode().is(this)&&r.set(a,r.offset,`element`),i.type===`element`&&i.getNode().is(this)&&i.set(a,i.offset,`element`)}else n.insertBefore(t),this.remove();return!0}getValue(){return this.getLatest().__value}setValue(e){let t=this.getWritable();return t.__value=e,t}getChecked(){let e=this.getLatest(),t,n=this.getParent();return WE(n)&&(t=n.getListType()),t===`check`?!!e.__checked:void 0}setChecked(e){let t=this.getWritable();return t.__checked=e,t}toggleChecked(){let e=this.getWritable();return e.setChecked(!e.__checked)}getIndent(){let e=this.getParent();if(e===null||!this.isAttached())return this.getLatest().__indent;let t=e.getParentOrThrow(),n=0;for(;zE(t);)t=t.getParentOrThrow().getParentOrThrow(),n++;return n}setIndent(e){typeof e!=`number`&&wE(117),(e=Math.floor(e))>=0||wE(199);let t=this.getIndent();for(;t!==e;)t<e?(Fre(this),t++):(Ire(this),t--);return this}canInsertAfter(e){return zE(e)}canReplaceWith(e){return zE(e)}canMergeWith(e){return zE(e)||eh(e)}extractWithChild(e,t){if(!U(t))return!1;let n=t.anchor.getNode(),r=t.focus.getNode();return this.isParentOf(n)&&this.isParentOf(r)&&this.getTextContent().length===t.getTextContent().length}isParentRequired(){return!0}createParentElementNode(){return UE(`bullet`)}canMergeWhenEmpty(){return!0}};function Rre(e){if(e.classList.contains(`task-list-item`)){for(let t of e.children)if(t.tagName===`INPUT`)return zre(t)}let t=e.getAttribute(`aria-checked`);return{node:RE(t===`true`||t!==`false`&&void 0)}}function zre(e){return e.getAttribute(`type`)===`checkbox`?{node:RE(e.hasAttribute(`checked`))}:{node:null}}function RE(e){return fg(new LE(void 0,e))}function zE(e){return e instanceof LE}var BE=class extends zm{$config(){return this.config(`list`,{$transform:e=>{(function(e){let t=e.getNextSibling();WE(t)&&e.getListType()===t.getListType()&&PE(e,t)})(e),FE(e)},extends:zm,importDOM:up({ol:()=>({conversion:HE,priority:0}),ul:()=>({conversion:HE,priority:0})})})}constructor(e=`number`,t=1,n){super(n);let r=Vre[e]||e;this.__listType=r,this.__tag=r===`number`?`ol`:`ul`,this.__start=t}afterCloneFrom(e){super.afterCloneFrom(e),this.__listType=e.__listType,this.__tag=e.__tag,this.__start=e.__start}getTag(){return this.getLatest().__tag}setListType(e){let t=this.getWritable();return t.__listType=e,t.__tag=e===`number`?`ol`:`ul`,t}getListType(){return this.getLatest().__listType}getStart(){return this.getLatest().__start}setStart(e){let t=this.getWritable();return t.__start=e,t}createDOM(e,t){let n=this.__tag,r=document.createElement(n);return this.__start!==1&&r.setAttribute(`start`,String(this.__start)),r.__lexicalListType=this.__listType,VE(r,e.theme,this),r}updateDOM(e,t,n){return e.__tag!==this.__tag||(VE(t,n.theme,this),!1)}updateFromJSON(e){return super.updateFromJSON(e).setListType(e.listType).setStart(e.start)}exportDOM(e){let t=this.createDOM(e._config,e);return yg(t)&&(this.__start!==1&&t.setAttribute(`start`,String(this.__start)),this.__listType===`check`&&t.setAttribute(`__lexicalListType`,`check`)),{element:t}}exportJSON(){return{...super.exportJSON(),listType:this.getListType(),start:this.getStart(),tag:this.getTag()}}canBeEmpty(){return!1}canIndent(){return!1}splice(e,t,n){let r=n;for(let e=0;e<n.length;e++){let t=n[e];zE(t)||(r===n&&(r=[...n]),r[e]=RE().append(!G(t)||WE(t)||t.isInline()?t:Mp(t.getTextContent())))}return super.splice(e,t,r)}extractWithChild(e){return zE(e)}};function VE(e,t,n){let r=[],i=[],a=t.list;if(a!==void 0){let e=a[`${n.__tag}Depth`]||[],t=TE(n)-1,o=t%e.length,s=e[o],c=a[n.__tag],l,u=a.nested,d=a.checklist;if(u!==void 0&&u.list&&(l=u.list),c!==void 0&&r.push(c),d!==void 0&&n.__listType===`check`&&r.push(d),s!==void 0){r.push(...IE(s));for(let t=0;t<e.length;t++)t!==o&&i.push(n.__tag+t)}if(l!==void 0){let e=IE(l);t>1?r.push(...e):i.push(...e)}}i.length>0&&V_(e,...i),r.length>0&&B_(e,...r)}function Bre(e){let t=[];for(let n=0;n<e.length;n++){let r=e[n];if(zE(r)){t.push(r);let e=r.getChildren();e.length>1&&e.forEach((e=>{WE(e)&&t.push(kE(e))}))}else t.push(kE(r))}return t}function HE(e){let t=e.nodeName.toLowerCase(),n=null;return t===`ol`?n=UE(`number`,e.start):t===`ul`&&(n=function(e){if(e.getAttribute(`__lexicallisttype`)===`check`||e.classList.contains(`contains-task-list`))return!0;for(let t of e.childNodes)if(yg(t)&&t.hasAttribute(`aria-checked`))return!0;return!1}(e)?UE(`check`):UE(`bullet`)),{after:Bre,node:n}}var Vre={ol:`number`,ul:`bullet`};function UE(e=`number`,t=1){return fg(new BE(e,t))}function WE(e){return e instanceof BE}var GE=Vd(`INSERT_CHECK_LIST_COMMAND`);function Hre(e){return z_(e.registerCommand(GE,(()=>(jE(`check`),!0)),1),e.registerCommand(lf,(t=>XE(t,e,!1)),1),e.registerCommand(cf,(t=>XE(t,e,!0)),1),e.registerCommand(pf,(()=>YE()==null?!1:(e.getRootElement()?.focus(),!0)),1),e.registerCommand(df,(t=>{let n=YE();return!(n==null||!e.isEditable())&&(e.update((()=>{let e=Ah(n);zE(e)&&(t.preventDefault(),e.toggleChecked())})),!0)}),1),e.registerCommand(of,(t=>e.getEditorState().read((()=>{let n=W();if(U(n)&&n.isCollapsed()){let{anchor:r}=n,i=r.type===`element`;if(i||r.offset===0){let n=r.getNode(),a=W_(n,(e=>G(e)&&!e.isInline()));if(zE(a)){let r=a.getParent();if(WE(r)&&r.getListType()===`check`&&(i||a.getFirstDescendant()===n)){let n=e.getElementByKey(a.__key);if(n!=null&&document.activeElement!==n)return n.focus(),t.preventDefault(),!0}}}}return!1}))),1),e.registerRootListener(((e,t)=>{e!==null&&(e.addEventListener(`click`,qE),e.addEventListener(`pointerdown`,JE)),t!==null&&(t.removeEventListener(`click`,qE),t.removeEventListener(`pointerdown`,JE))})))}function KE(e,t){let n=e.target;if(!yg(n))return;let r=n.firstChild;if(yg(r)&&(r.tagName===`UL`||r.tagName===`OL`))return;let i=n.parentNode;if(!i||i.__lexicalListType!==`check`)return;let a=n.getBoundingClientRect(),o=jee(n),s=e.clientX/o,c=window.getComputedStyle?window.getComputedStyle(n,`::before`):{width:`0px`},l=parseFloat(c.width),u=e.pointerType===`touch`?32:0;(n.dir===`rtl`?s<a.right+u&&s>a.right-l-u:s>a.left-u&&s<a.left+l+u)&&t()}function qE(e){KE(e,(()=>{if(yg(e.target)){let t=e.target,n=mh(t);n!=null&&n.isEditable()&&n.update((()=>{let e=Ah(t);zE(e)&&(t.focus(),e.toggleChecked())}))}}))}function JE(e){KE(e,(()=>{e.preventDefault()}))}function YE(){let e=document.activeElement;return yg(e)&&e.tagName===`LI`&&e.parentNode!=null&&e.parentNode.__lexicalListType===`check`?e:null}function XE(e,t,n){let r=YE();return r!=null&&t.update((()=>{let i=Ah(r);if(!zE(i))return;let a=function(e,t){let n=t?e.getPreviousSibling():e.getNextSibling(),r=e;for(;n==null&&zE(r);)r=r.getParentOrThrow().getParent(),r!=null&&(n=t?r.getPreviousSibling():r.getNextSibling());for(;zE(n);){let e=t?n.getLastChild():n.getFirstChild();if(!WE(e))return n;n=t?e.getLastChild():e.getFirstChild()}return null}(i,n);if(a!=null){a.selectStart();let n=t.getElementByKey(a.__key);n!=null&&(e.preventDefault(),setTimeout((()=>{n.focus()}),0))}})),!1}var Ure=Vd(`UPDATE_LIST_START_COMMAND`),ZE=Vd(`INSERT_UNORDERED_LIST_COMMAND`),QE=Vd(`INSERT_ORDERED_LIST_COMMAND`),$E=Vd(`REMOVE_LIST_COMMAND`);function Wre(e){return z_(e.registerCommand(QE,(()=>(jE(`number`),!0)),1),e.registerCommand(Ure,(e=>{let{listNodeKey:t,newStart:n}=e,r=Dh(t);return!!WE(r)&&(r.getListType()===`number`&&(r.setStart(n),FE(r)),!0)}),1),e.registerCommand(ZE,(()=>(jE(`bullet`),!0)),1),e.registerCommand($E,(()=>(Pre(),!0)),1),e.registerCommand(qd,(()=>Lre()),1),e.registerNodeTransform(LE,(e=>{let t=e.getFirstChild();if(t){if(H(t)){let n=t.getStyle(),r=t.getFormat();e.getTextStyle()!==n&&e.setTextStyle(n),e.getTextFormat()!==r&&e.setTextFormat(r)}}else{let t=W();U(t)&&(t.style!==e.getTextStyle()||t.format!==e.getTextFormat())&&t.isCollapsed()&&e.is(t.anchor.getNode())&&e.setTextStyle(t.style).setTextFormat(t.format)}})),e.registerNodeTransform(Cp,(e=>{let t=e.getParent();if(zE(t)&&e.is(t.getFirstChild())){let n=e.getStyle(),r=e.getFormat();n===t.getTextStyle()&&r===t.getTextFormat()||t.setTextStyle(n).setTextFormat(r)}})))}function Gre(e){let t=e=>{let t=e.getParent();if(WE(e.getFirstChild())||!WE(t))return;let n=W_(e,(e=>zE(e)&&WE(e.getParent())&&zE(e.getPreviousSibling())));if(n===null&&e.getIndent()>0)e.setIndent(0);else if(zE(n)){let r=n.getPreviousSibling();if(zE(r)){let n=function(e){let t=e,n=t.getFirstChild();for(;WE(n);){let e=n.getLastChild();if(!zE(e))break;t=e,n=t.getFirstChild()}return t}(r).getParent();if(WE(n)){let r=TE(n);r+1<TE(t)&&e.setIndent(r)}}}};return e.registerNodeTransform(BE,(e=>{let n=[e];for(;n.length>0;){let e=n.shift();if(WE(e)){for(let r of e.getChildren())if(zE(r)){t(r);let e=r.getFirstChild();WE(e)&&n.push(e)}}}}))}function Kre(e){try{let t=e.anchor,n=e.focus,r=e.anchor.getNode(),i=e.focus.getNode();return r===i?r:e.isBackward()?k_(n)?r:i:k_(t)?r:i}catch{return null}}var qre=[`transform`,`perspective`,`filter`,`backdrop-filter`,`contain`,`container-type`],Jre=[`layout`,`paint`,`strict`,`content`];function Yre(e){let t=e?.parentElement;for(;t;){let e=window.getComputedStyle(t),n=e.willChange.split(`,`).map(e=>e.trim()).some(e=>qre.includes(e));if(e.transform!==`none`||e.perspective!==`none`||e.filter!==`none`||e.backdropFilter!==`none`||Jre.includes(e.contain)||e.containerType!==`normal`||e.contentVisibility===`auto`||n)return t;t=t.parentElement}return null}function eD(e){let t=W(),n=window.getSelection(),r=document.activeElement,i=e.getRootElement();if(t!==null&&n!==null&&i!==null&&i.contains(n.anchorNode)&&e.isEditable()){let e=n.getRangeAt(0),t;if(n.isCollapsed){let e=n.anchorNode;e?.nodeType==3&&(e=e.parentNode),t=e.getBoundingClientRect(),t.width=0}else if(n.anchorNode===i){let e=i;for(;e.firstElementChild!=null;)e=e.firstElementChild;t=e.getBoundingClientRect()}else t=e.getBoundingClientRect();let r=Yre(i);if(r){let e=r.getBoundingClientRect();return{top:Math.round(t.top-e.top),left:Math.round(t.left-e.left),width:Math.round(t.width),height:Math.round(t.height)}}return{top:Math.round(t.top),left:Math.round(t.left),width:Math.round(t.width),height:Math.round(t.height)}}else if(r?.className!==`link-input`)return null;return null}function Xre(e,t){let n=``;return e.getEditorState().read(()=>{let e=W();if(!e||!U(e)||e.isCollapsed())return;let t=e.getNodes();if(t.length===0)return;let r=new Set;t.forEach(e=>{let t=e;for(;t;){if(Cv(t)||zE(t)||t.getType()===`paragraph`||t.getType()===`quote`){G(t)&&r.add(t);break}t=t.getParent()}});let i=r.size>0?Array.from(r):t;function a(e){if(Cv(e)){let t=parseInt(e.getTag().replace(`h`,``)),n=e.getChildren().map(e=>a(e)).join(``);return`#`.repeat(t)+` `+n+`
80
+
81
+ `}else if(zE(e)){let t=e.getParent();return(t&&WE(t)&&t.getListType()===`number`?`1. `:`- `)+e.getChildren().map(e=>a(e)).join(``)+`
82
+ `}else if(WE(e))return e.getChildren().map(e=>a(e)).join(``)+`
83
+ `;else if(H(e)){let t=e.getTextContent(),n=e.getFormat();return n&16?`\`${t}\``:(n&1&&(t=`**${t}**`),n&2&&(t=`*${t}*`),n&4&&(t=`~~${t}~~`),t)}else if(hE(e)){let t=e.getURL(),n=e.getTitle(),r=e.getChildren().map(e=>a(e)).join(``);return n?`[${r}](${t} "${n}")`:`[${r}](${t})`}else if(G(e))return e.getChildren().map(e=>a(e)).join(``);return e.getTextContent()}n=i.map(e=>a(e)).join(``)}),n.trim()}var tD=t(kre(),1),Zre=({children:e})=>{let t=Rl(Bw),n=L.useMemo(()=>[t,Xl(null,Rw)],[t]);return L.createElement(Yl.Provider,{value:n},e)},Qre=()=>{let e=tE(),t=Bl(gT),n=Bl(dre),r=e=>{n(e),t(e?{current:e}:null)},[i,a,o,s,c,l,u]=zl(Hw,Uw,LT,zT,VT,Gw,BT);return L.createElement(L.Fragment,null,s.map((e,t)=>L.createElement(e,{key:t})),L.createElement(nD,{wrappers:c},L.createElement(`div`,{className:(0,tD.default)(fE.rootContentEditableWrapper,`mdxeditor-root-contenteditable`)},L.createElement(dE,{contentEditable:L.createElement(`div`,{ref:r},L.createElement(aE,{className:(0,tD.default)(fE.contentEditable,i),ariaLabel:e(`contentArea.editableMarkdown`,`editable markdown`),spellCheck:a})),placeholder:L.createElement(`div`,{className:(0,tD.default)(fE.contentEditable,fE.placeholder,i)},L.createElement(`p`,null,l)),ErrorBoundary:cE}))),o.map((e,t)=>L.createElement(e,{key:t})),u.map((e,t)=>L.createElement(e,{key:t})))},$re={listItemIndent:`one`},eie=e=>Are[e];function tie(e,t,n={}){let r=t;for(let[e,t]of Object.entries(n))r=r.replaceAll(`{{${e}}}`,String(t));return r}var nD=({wrappers:e,children:t})=>{if(e.length===0)return L.createElement(L.Fragment,null,t);let n=e[0];return L.createElement(n,null,L.createElement(nD,{wrappers:e.slice(1)},t))},nie=({children:e,className:t,overlayContainer:n})=>{let r=L.useRef(null),i=L.useRef(null),a=Bl(hT),o=Bl(ure);return L.useEffect(()=>{let e=document.createElement(`div`);return e.classList.add(`mdxeditor-popup-container`,fE.editorRoot,fE.popupContainer,...(t??``).trim().split(` `).filter(Boolean)),(n??document.body).appendChild(e),r.current=e,a(r),o(i),()=>{e.remove()}},[t,r,n,a,o]),L.createElement(`div`,{className:(0,tD.default)(`mdxeditor`,fE.editorRoot,fE.editorWrapper,t),ref:i},e)},rie=({mdxRef:e})=>{let t=Ll();return L.useImperativeHandle(e,()=>({getMarkdown:()=>{let e=t.getValue(YT);return e===`source`||e===`diff`?t.getValue(XT):t.getValue(eT)},setMarkdown:e=>{t.pub(wT,e)},insertMarkdown:e=>{t.pub(TT,e)},focus:(e,n)=>{var r;(r=t.getValue(Bw))==null||r.focus(e,n)},getContentEditableHTML:()=>t.getValue(gT)?.current.innerHTML??``,getSelectionMarkdown:()=>{let e=t.getValue(YT);if(e===`source`||e===`diff`)return``;let n=t.getValue(Vw);return n?(t.getValue(cT),t.getValue(lT),t.getValue(uT),t.getValue(fT),t.getValue(dT),Xre(n)):``}}),[t]),null},iie=L.forwardRef((e,t)=>L.createElement(Jl,{plugins:[hre({contentEditableClassName:e.contentEditableClassName??``,spellCheck:e.spellCheck??!0,initialMarkdown:e.markdown,onChange:e.onChange??Kl,onBlur:e.onBlur??Kl,toMarkdownOptions:e.toMarkdownOptions??$re,autoFocus:e.autoFocus??!1,placeholder:e.placeholder??``,readOnly:!!e.readOnly,iconComponentFor:e.iconComponentFor??eie,suppressHtmlProcessing:e.suppressHtmlProcessing??!1,onError:e.onError??Kl,translation:e.translation??tie,trim:e.trim??!0,lexicalTheme:e.lexicalTheme,...`editorState`in e?{editorState:e.editorState}:{},suppressSharedHistory:e.suppressSharedHistory??!1,additionalLexicalNodes:e.additionalLexicalNodes??[],lexicalEditorNamespace:e.lexicalEditorNamespace??`MDXEditor`}),...e.plugins??[]]},L.createElement(nie,{className:e.className,overlayContainer:e.overlayContainer},L.createElement(Zre,null,L.createElement(Qre,null))),L.createElement(rie,{mdxRef:t}))),rD=typeof window<`u`&&window.document.createElement!==void 0&&(()=>{let e=navigator.userAgentData?.platform;return e?/mac/i.test(e):/Mac|iPod|iPhone|iPad/.test(navigator.userAgent)})();function aie(e,t){return rD?e:t}var oie={testLexicalNode:Cv,visitLexicalNode:({lexicalNode:e,actions:t})=>{let n=parseInt(e.getTag()[1],10);t.addAndStepInto(`heading`,{depth:n})}},sie={testNode:`heading`,visitNode:function({mdastNode:e,actions:t}){t.addAndStepInto(Sv(`h${e.depth}`))}},cie=[`Digit0`,`Digit1`,`Digit2`,`Digit3`,`Digit4`,`Digit5`,`Digit6`],iD=[1,2,3,4,5,6],lie={Digit1:1,Digit2:2,Digit3:3,Digit4:4,Digit5:5,Digit6:6},aD=Nl(iD,e=>{e.pub(PT,t=>t.registerCommand(nf,n=>{let{code:r,ctrlKey:i,metaKey:a,altKey:o}=n;return cie.includes(r)&&aie(a,i)&&o?(n.preventDefault(),t.update(()=>{if(r===`Digit0`)e.pub(qT,()=>$m());else{let t=e.getValue(aD),n=lie[r];t.includes(n)&&e.pub(qT,()=>Sv(`h${n}`))}}),!0):!1},1))}),uie=ql({init(e){e.pubIn({[QT]:`headings`,[vT]:sie,[_T]:yv,[xT]:oie})},update(e,t){e.pub(aD,t?.allowedHeadingLevels??iD)}});function oD(e,t){return e.getEditorState().read((()=>{let e=Dh(t);return e!==null&&e.isSelected()}))}function die(e){let[t]=Zl(),[n,r]=(0,L.useState)((()=>oD(t,e)));return(0,L.useEffect)((()=>{let n=!0,i=t.registerUpdateListener((()=>{n&&r(oD(t,e))}));return()=>{n=!1,i()}}),[t,e]),[n,(0,L.useCallback)((n=>{t.update((()=>{let t=W();Up(t)||(t=nm(),Fh(t)),Up(t)&&(n?t.add(e):t.delete(e))}))}),[t,e]),(0,L.useCallback)((()=>{t.update((()=>{let e=W();Up(e)&&e.clear()}))}),[t])]}var sD=Vd(`INSERT_HORIZONTAL_RULE_COMMAND`);function fie({nodeKey:e}){let[t]=Zl(),[n,r,i]=die(e);return(0,L.useEffect)((()=>z_(t.registerCommand(Wd,(a=>{let o=t.getElementByKey(e);return a.target===o&&(a.shiftKey||i(),r(!n),!0)}),1))),[i,t,n,e,r]),(0,L.useEffect)((()=>{let r=t.getElementByKey(e),i=t._config.theme.hrSelected??`selected`;r!==null&&(n?B_(r,i):V_(r,i))}),[t,n,e]),null}var cD=class e extends Vm{static getType(){return`horizontalrule`}static clone(t){return new e(t.__key)}static importJSON(e){return lD().updateFromJSON(e)}static importDOM(){return{hr:()=>({conversion:pie,priority:0})}}exportDOM(){return{element:document.createElement(`hr`)}}createDOM(e){let t=document.createElement(`hr`);return B_(t,e.theme.hr),t}getTextContent(){return`
84
+ `}isInline(){return!1}updateDOM(){return!1}decorate(){return(0,R.jsx)(fie,{nodeKey:this.__key})}};function pie(){return{node:lD()}}function lD(){return fg(new cD)}function uD(e){return e instanceof cD}function mie(){let[e]=Zl();return(0,L.useEffect)((()=>e.registerCommand(sD,(e=>{let t=W();return U(t)?(t.focus.getNode()!==null&&G_(lD()),!0):!1}),0)),[e]),null}var hie={testLexicalNode:uD,visitLexicalNode({actions:e}){e.addAndStepInto(`thematicBreak`)}},gie={testNode:`thematicBreak`,visitNode({actions:e}){e.addAndStepInto(lD())}},dD=Fl(e=>{e.sub(e.pipe(dD,Hl(Vw)),([,e])=>{e?.dispatchCommand(sD,void 0)})}),_ie=ql({init(e){e.pubIn({[QT]:`thematicBreak`,[vT]:gie,[_T]:cD,[xT]:hie,[RT]:mie})}}),vie={testNode:`list`,visitNode:function({mdastNode:e,lexicalParent:t,actions:n}){let r=UE(e.children.some(e=>typeof e.checked==`boolean`)?`check`:e.ordered?`number`:`bullet`);if(zE(t)){let e=RE();e.append(r),t.insertAfter(e)}else t.append(r);n.visitChildren(e,r)}},yie={testNode:`listItem`,visitNode({mdastNode:e,actions:t,lexicalParent:n}){let r=n.getListType()===`check`?e.checked??!1:void 0;t.addAndStepInto(RE(r))}},bie={testLexicalNode:WE,visitLexicalNode:({lexicalNode:e,actions:t})=>{t.addAndStepInto(`list`,{ordered:e.getListType()===`number`,spread:!1})}},xie={testLexicalNode:zE,visitLexicalNode:({lexicalNode:e,mdastParent:t,actions:n})=>{let r=e.getChildren(),i=r[0];if(r.length===1&&WE(i)){let r=t.children.at(-1);r?n.visitChildren(e,r):n.visitChildren(i,t)}else{let r=e.getParent(),i=n.appendToParent(t,{type:`listItem`,checked:r.getListType()===`check`?!!e.getChecked():void 0,spread:!1,children:[]}),a=null;for(let t of e.getChildren())H(t)||hp(t)||t.isInline()&&(G(t)||Hm(t))?(a??=n.appendToParent(i,{type:`paragraph`,children:[]}),n.visit(t,a)):(a=null,n.visit(t,i))}}};function Sie(e,t){return z_(e.registerCommand(hf,(t=>{let n=W();if(!U(n))return!1;t.preventDefault();let r=function(e){if(Aee(e.getNodes(),(e=>$p(e)&&e.canIndent()?e:null)).length>0)return!0;let t=e.anchor,n=e.focus,r=n.isBefore(t)?n:t,i=U_(r.getNode());if(i.canIndent()){let e=i.getKey(),t=tm();if(t.anchor.set(e,0,`element`),t.focus.set(e,0,`element`),t=ad(t),t.anchor.is(r))return!0}return!1}(n)?t.shiftKey?vf:_f:gf;return e.dispatchCommand(r,void 0)}),0),e.registerCommand(_f,(()=>{if(t==null)return!1;let e=W();if(!U(e))return!1;let n=e.getNodes().map((e=>U_(e).getIndent()));return Math.max(...n)+1>=t}),4))}function fD({maxIndent:e}){let[t]=Zl();return(0,L.useEffect)((()=>Sie(t,e)),[t,e]),null}function pD(){let[e]=Zl();return(0,L.useEffect)((()=>Hre(e)),[e]),null}function mD({hasStrictIndent:e=!1}){let[t]=Zl();return(0,L.useEffect)((()=>{if(!t.hasNodes([BE,LE]))throw Error(`ListPlugin: ListNode and/or ListItemNode not registered on editor`)}),[t]),(0,L.useEffect)((()=>{if(e)return Gre(t)}),[t,e]),function(e){(0,L.useEffect)((()=>Wre(e)),[e])}(t),null}var Cie={name:`tasklistCheck`,tokenize:wie};function hD(){return{text:{91:Cie}}}function wie(e,t,n){let r=this;return i;function i(t){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(t):(e.enter(`taskListCheck`),e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),a)}function a(t){return Fv(t)?(e.enter(`taskListCheckValueUnchecked`),e.consume(t),e.exit(`taskListCheckValueUnchecked`),o):t===88||t===120?(e.enter(`taskListCheckValueChecked`),e.consume(t),e.exit(`taskListCheckValueChecked`),o):n(t)}function o(t){return t===93?(e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),e.exit(`taskListCheck`),s):n(t)}function s(r){return Pv(r)?t(r):Iv(r)?e.check({tokenize:Tie},t,n)(r):n(r)}}function Tie(e,t,n){return Ob(e,r,`whitespace`);function r(e){return e===null?n(e):t(e)}}function gD(){return{exit:{taskListCheckValueChecked:vD,taskListCheckValueUnchecked:vD,paragraph:Eie}}}function _D(){return{unsafe:[{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{listItem:Die}}}function vD(e){let t=this.stack[this.stack.length-2];t.type,t.checked=e.type===`taskListCheckValueChecked`}function Eie(e){let t=this.stack[this.stack.length-2];if(t&&t.type===`listItem`&&typeof t.checked==`boolean`){let e=this.stack[this.stack.length-1];e.type;let n=e.children[0];if(n&&n.type===`text`){let r=t.children,i=-1,a;for(;++i<r.length;){let e=r[i];if(e.type===`paragraph`){a=e;break}}a===e&&(n.value=n.value.slice(1),n.value.length===0?e.children.shift():e.position&&n.position&&typeof n.position.start.offset==`number`&&(n.position.start.column++,n.position.start.offset++,e.position.start=Object.assign({},n.position.start)))}}this.exit(e)}function Die(e,t,n,r){let i=e.children[0],a=typeof e.checked==`boolean`&&i&&i.type===`paragraph`,o=`[`+(e.checked?`x`:` `)+`] `,s=n.createTracker(r);a&&s.move(o);let c=Vx.listItem(e,t,n,{...r,...s.current()});return a&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,l)),c;function l(e){return e+o}}var Oie=new Map([[`number`,QE],[`bullet`,ZE],[`check`,GE],[``,$E]]),yD=Nl(``,e=>{e.sub(e.pipe(Qw,Hl(Vw)),([t,n])=>{if(!t||!n)return;let r=t.anchor.getNode(),i=r.getKey()===`root`?r:W_(r,e=>{let t=e.getParent();return t!==null&&ug(t)});i??=r.getTopLevelElementOrThrow();let a=i.getKey();if(n.getElementByKey(a)!==null)if(WE(i)){let t=H_(r,BE),n=t?t.getListType():i.getListType();e.pub(yD,n)}else e.pub(yD,``)})}),bD=Pl(e=>{e.sub(e.pipe(bD,Hl(Vw)),([e,t])=>{t?.dispatchCommand(Oie.get(e),void 0)})}),kie=ql({init(e){var t;(t=e.getValue(Bw))==null||t.registerCommand(_f,()=>!jie(7),4),e.pubIn({[QT]:`lists`,[bT]:gD(),[yT]:hD(),[vT]:[vie,yie],[_T]:[LE,BE],[xT]:[bie,xie],[ST]:_D(),[RT]:[fD,mD,pD],[HT]:[fD,mD,pD]})}});function Aie(e){let t=e.getNodes();return t.length===0?new Set([e.anchor.getNode().getParentOrThrow(),e.focus.getNode().getParentOrThrow()]):new Set(t.map(e=>G(e)?e:e.getParentOrThrow()))}function jie(e){let t=W();if(!U(t))return!1;let n=Aie(t),r=0;for(let e of n)if(WE(e))r=Math.max(TE(e)+1,r);else if(zE(e)){let t=e.getParent();if(t?.getChildren().length===1){let e=t.getParent();if(zE(e)&&e.getChildren().length===1)return!1}if(!WE(t))throw Error(`ListMaxIndentLevelPlugin: A ListItemNode must have a ListNode for a parent.`);r=Math.max(TE(t)+1,r)}return r<=e}function Mie(e){return e.length}function Nie(e,t){let n=t||{},r=(n.align||[]).concat(),i=n.stringLength||Mie,a=[],o=[],s=[],c=[],l=0,u=-1;for(;++u<e.length;){let t=[],r=[],a=-1;for(e[u].length>l&&(l=e[u].length);++a<e[u].length;){let o=Pie(e[u][a]);if(n.alignDelimiters!==!1){let e=i(o);r[a]=e,(c[a]===void 0||e>c[a])&&(c[a]=e)}t.push(o)}o[u]=t,s[u]=r}let d=-1;if(typeof r==`object`&&`length`in r)for(;++d<l;)a[d]=xD(r[d]);else{let e=xD(r);for(;++d<l;)a[d]=e}d=-1;let f=[],p=[];for(;++d<l;){let e=a[d],t=``,r=``;e===99?(t=`:`,r=`:`):e===108?t=`:`:e===114&&(r=`:`);let i=n.alignDelimiters===!1?1:Math.max(1,c[d]-t.length-r.length),o=t+`-`.repeat(i)+r;n.alignDelimiters!==!1&&(i=t.length+i+r.length,i>c[d]&&(c[d]=i),p[d]=i),f[d]=o}o.splice(1,0,f),s.splice(1,0,p),u=-1;let m=[];for(;++u<o.length;){let e=o[u],t=s[u];d=-1;let r=[];for(;++d<l;){let i=e[d]||``,o=``,s=``;if(n.alignDelimiters!==!1){let e=c[d]-(t[d]||0),n=a[d];n===114?o=` `.repeat(e):n===99?e%2?(o=` `.repeat(e/2+.5),s=` `.repeat(e/2-.5)):(o=` `.repeat(e/2),s=o):s=` `.repeat(e)}n.delimiterStart!==!1&&!d&&r.push(`|`),n.padding!==!1&&!(n.alignDelimiters===!1&&i===``)&&(n.delimiterStart!==!1||d)&&r.push(` `),n.alignDelimiters!==!1&&r.push(o),r.push(i),n.alignDelimiters!==!1&&r.push(s),n.padding!==!1&&r.push(` `),(n.delimiterEnd!==!1||d!==l-1)&&r.push(`|`)}m.push(n.delimiterEnd===!1?r.join(``).replace(/ +$/,``):r.join(``))}return m.join(`
85
+ `)}function Pie(e){return e==null?``:String(e)}function xD(e){let t=typeof e==`string`?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function SD(){return{enter:{table:Fie,tableData:wD,tableHeader:wD,tableRow:Lie},exit:{codeText:Rie,table:Iie,tableData:CD,tableHeader:CD,tableRow:CD}}}function Fie(e){let t=e._align;this.enter({type:`table`,align:t.map(function(e){return e===`none`?null:e}),children:[]},e),this.data.inTable=!0}function Iie(e){this.exit(e),this.data.inTable=void 0}function Lie(e){this.enter({type:`tableRow`,children:[]},e)}function CD(e){this.exit(e)}function wD(e){this.enter({type:`tableCell`,children:[]},e)}function Rie(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,zie));let n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function zie(e,t){return t===`|`?t:e}function TD(e){let t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,a=n?` `:`|`;return{unsafe:[{character:`\r`,inConstruct:`tableCell`},{character:`
86
+ `,inConstruct:`tableCell`},{atBreak:!0,character:`|`,after:`[ :-]`},{character:`|`,inConstruct:`tableCell`},{atBreak:!0,character:`:`,after:`-`},{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{inlineCode:f,table:o,tableCell:c,tableRow:s}};function o(e,t,n,r){return l(u(e,n,r),e.align)}function s(e,t,n,r){let i=l([d(e,n,r)]);return i.slice(0,i.indexOf(`
87
+ `))}function c(e,t,n,r){let i=n.enter(`tableCell`),o=n.enter(`phrasing`),s=n.containerPhrasing(e,{...r,before:a,after:a});return o(),i(),s}function l(e,t){return Nie(e,{align:t,alignDelimiters:r,padding:n,stringLength:i})}function u(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`table`);for(;++i<r.length;)a[i]=d(r[i],t,n);return o(),a}function d(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`tableRow`);for(;++i<r.length;)a[i]=c(r[i],e,t,n);return o(),a}function f(e,t,n){let r=Vx.inlineCode(e,t,n);return n.stack.includes(`tableCell`)&&(r=r.replace(/\|/g,`\\$&`)),r}}var Bie=class{constructor(){this.map=[]}add(e,t,n){Vie(this,e,t,n)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),this.map.length===0)return;let t=this.map.length,n=[];for(;t>0;)--t,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0}};function Vie(e,t,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=n,e.map[i][2].push(...r);return}i+=1}e.map.push([t,n,r])}}function Hie(e,t){let n=!1,r=[];for(;t<e.length;){let i=e[t];if(n){if(i[0]===`enter`)i[1].type===`tableContent`&&r.push(e[t+1][1].type===`tableDelimiterMarker`?`left`:`none`);else if(i[1].type===`tableContent`){if(e[t-1][1].type===`tableDelimiterMarker`){let e=r.length-1;r[e]=r[e]===`left`?`center`:`right`}}else if(i[1].type===`tableDelimiterRow`)break}else i[0]===`enter`&&i[1].type===`tableDelimiterRow`&&(n=!0);t+=1}return r}function ED(){return{flow:{null:{name:`table`,tokenize:Uie,resolveAll:Wie}}}}function Uie(e,t,n){let r=this,i=0,a=0,o;return s;function s(e){let t=r.events.length-1;for(;t>-1;){let e=r.events[t][1].type;if(e===`lineEnding`||e===`linePrefix`)t--;else break}let i=t>-1?r.events[t][1].type:null,a=i===`tableHead`||i===`tableRow`?S:c;return a===S&&r.parser.lazy[r.now().line]?n(e):a(e)}function c(t){return e.enter(`tableHead`),e.enter(`tableRow`),l(t)}function l(e){return e===124?u(e):(o=!0,a+=1,u(e))}function u(t){return t===null?n(t):Pv(t)?a>1?(a=0,r.interrupt=!0,e.exit(`tableRow`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),p):n(t):Iv(t)?Ob(e,u,`whitespace`)(t):(a+=1,o&&(o=!1,i+=1),t===124?(e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),o=!0,u):(e.enter(`data`),d(t)))}function d(t){return t===null||t===124||Fv(t)?(e.exit(`data`),u(t)):(e.consume(t),t===92?f:d)}function f(t){return t===92||t===124?(e.consume(t),d):d(t)}function p(t){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(t):(e.enter(`tableDelimiterRow`),o=!1,Iv(t)?Ob(e,m,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):m(t))}function m(t){return t===45||t===58?g(t):t===124?(o=!0,e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),h):x(t)}function h(t){return Iv(t)?Ob(e,g,`whitespace`)(t):g(t)}function g(t){return t===58?(a+=1,o=!0,e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),_):t===45?(a+=1,_(t)):t===null||Pv(t)?b(t):x(t)}function _(t){return t===45?(e.enter(`tableDelimiterFiller`),v(t)):x(t)}function v(t){return t===45?(e.consume(t),v):t===58?(o=!0,e.exit(`tableDelimiterFiller`),e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),y):(e.exit(`tableDelimiterFiller`),y(t))}function y(t){return Iv(t)?Ob(e,b,`whitespace`)(t):b(t)}function b(n){return n===124?m(n):n===null||Pv(n)?!o||i!==a?x(n):(e.exit(`tableDelimiterRow`),e.exit(`tableHead`),t(n)):x(n)}function x(e){return n(e)}function S(t){return e.enter(`tableRow`),C(t)}function C(n){return n===124?(e.enter(`tableCellDivider`),e.consume(n),e.exit(`tableCellDivider`),C):n===null||Pv(n)?(e.exit(`tableRow`),t(n)):Iv(n)?Ob(e,C,`whitespace`)(n):(e.enter(`data`),w(n))}function w(t){return t===null||t===124||Fv(t)?(e.exit(`data`),C(t)):(e.consume(t),t===92?T:w)}function T(t){return t===92||t===124?(e.consume(t),w):w(t)}}function Wie(e,t){let n=-1,r=!0,i=0,a=[0,0,0,0],o=[0,0,0,0],s=!1,c=0,l,u,d,f=new Bie;for(;++n<e.length;){let p=e[n],m=p[1];p[0]===`enter`?m.type===`tableHead`?(s=!1,c!==0&&(OD(f,t,c,l,u),u=void 0,c=0),l={type:`table`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,l,t]])):m.type===`tableRow`||m.type===`tableDelimiterRow`?(r=!0,d=void 0,a=[0,0,0,0],o=[0,n+1,0,0],s&&(s=!1,u={type:`tableBody`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,u,t]])),i=m.type===`tableDelimiterRow`?2:u?3:1):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)?(r=!1,o[2]===0&&(a[1]!==0&&(o[0]=o[1],d=DD(f,t,a,i,void 0,d),a=[0,0,0,0]),o[2]=n)):m.type===`tableCellDivider`&&(r?r=!1:(a[1]!==0&&(o[0]=o[1],d=DD(f,t,a,i,void 0,d)),a=o,o=[a[1],n,0,0])):m.type===`tableHead`?(s=!0,c=n):m.type===`tableRow`||m.type===`tableDelimiterRow`?(c=n,a[1]===0?o[1]!==0&&(d=DD(f,t,o,i,n,d)):(o[0]=o[1],d=DD(f,t,a,i,n,d)),i=0):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)&&(o[3]=n)}for(c!==0&&OD(f,t,c,l,u),f.consume(t.events),n=-1;++n<t.events.length;){let e=t.events[n];e[0]===`enter`&&e[1].type===`table`&&(e[1]._align=Hie(t.events,n))}return e}function DD(e,t,n,r,i,a){let o=r===1?`tableHeader`:r===2?`tableDelimiter`:`tableData`;n[0]!==0&&(a.end=Object.assign({},kD(t.events,n[0])),e.add(n[0],0,[[`exit`,a,t]]));let s=kD(t.events,n[1]);if(a={type:o,start:Object.assign({},s),end:Object.assign({},s)},e.add(n[1],0,[[`enter`,a,t]]),n[2]!==0){let i=kD(t.events,n[2]),a=kD(t.events,n[3]),o={type:`tableContent`,start:Object.assign({},i),end:Object.assign({},a)};if(e.add(n[2],0,[[`enter`,o,t]]),r!==2){let r=t.events[n[2]],i=t.events[n[3]];if(r[1].end=Object.assign({},i[1].end),r[1].type=`chunkText`,r[1].contentType=`text`,n[3]>n[2]+1){let t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[[`exit`,o,t]])}return i!==void 0&&(a.end=Object.assign({},kD(t.events,i)),e.add(i,0,[[`exit`,a,t]]),a=void 0),a}function OD(e,t,n,r,i){let a=[],o=kD(t.events,n);i&&(i.end=Object.assign({},o),a.push([`exit`,i,t])),r.end=Object.assign({},o),a.push([`exit`,r,t]),e.add(n+1,0,a)}function kD(e,t){let n=e[t],r=n[0]===`enter`?`start`:`end`;return n[1][r]}var AD=[[`Cat`,`rgb(125, 50, 0)`],[`Dog`,`rgb(100, 0, 0)`],[`Rabbit`,`rgb(150, 0, 0)`],[`Frog`,`rgb(200, 0, 0)`],[`Fox`,`rgb(200, 75, 0)`],[`Hedgehog`,`rgb(0, 75, 0)`],[`Pigeon`,`rgb(0, 125, 0)`],[`Squirrel`,`rgb(75, 100, 0)`],[`Bear`,`rgb(125, 100, 0)`],[`Tiger`,`rgb(0, 0, 150)`],[`Leopard`,`rgb(0, 0, 200)`],[`Zebra`,`rgb(0, 0, 250)`],[`Wolf`,`rgb(0, 100, 150)`],[`Owl`,`rgb(0, 100, 100)`],[`Gull`,`rgb(100, 0, 100)`],[`Squid`,`rgb(150, 0, 150)`]],jD=AD[Math.floor(Math.random()*AD.length)],Gie=(0,L.createContext)({clientID:0,color:jD[1],isCollabActive:!1,name:jD[0],yjsDocMap:new Map});function Kie(e,t){let n=(0,L.useContext)(Gie);return e!=null&&(n.name=e),t!=null&&(n.color=t),n}function MD(e){let t=new Set,{ownNodeConfig:n}=Pg(e),r=e.transform();if(n){let e=n.$transform;e&&t.add(e)}return r&&t.add(r),t}function qie({initialEditor:e,children:t,initialNodes:n,initialTheme:r,skipCollabChecks:i,skipEditableListener:a}){let o=(0,L.useRef)(!1),s=(0,L.useContext)(Yl);s??function(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(9);let[c,{getTheme:l}]=s,u=(0,L.useMemo)((()=>{let t=r||l()||void 0,i=Xl(s,t);t!==void 0&&(e._config.theme=t),e._parentEditor=e._parentEditor||c;let a=e._createEditorArgs,o=a&&a.namespace;if(n){o||(e._config.namespace=c._config.namespace);for(let t of n){let n=null,r=null;if(typeof t!=`function`){let e=t;t=e.replace,n=e.with,r=e.withKlass||null}let i=ch(e,t.getType());e._nodes.set(t.getType(),{exportDOM:i?i.exportDOM:void 0,klass:t,replace:n,replaceWithKlass:r,sharedNodeState:Ju(t),transforms:MD(t)})}}else if(a&&a.nodes)o||(e._config.namespace=c._config.namespace);else{let t=e._nodes=new Map(c._nodes);o||(e._config.namespace=c._config.namespace);for(let[n,r]of t)e._nodes.set(n,{exportDOM:r.exportDOM,klass:r.klass,replace:r.replace,replaceWithKlass:r.replaceWithKlass,sharedNodeState:Ju(r.klass),transforms:MD(r.klass)})}return[e,i]}),[]),{isCollabActive:d,yjsDocMap:f}=Kie(),p=i||o.current||f.has(e.getKey());return(0,L.useEffect)((()=>{p&&(o.current=!0)}),[p]),(0,L.useEffect)((()=>{if(!a){let t=t=>e.setEditable(t);return t(c.isEditable()),c.registerEditableListener(t)}}),[e,c,a]),(0,R.jsx)(Yl.Provider,{value:u,children:!d||p?t:null})}typeof window<`u`&&window.document&&window.document.createElement;function ND(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r.defaultPrevented)return t?.(r)}}function PD(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function FD(...e){return t=>{let n=!1,r=e.map(e=>{let r=PD(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():PD(e[t],null)}}}}function ID(...e){return L.useCallback(FD(...e),e)}function LD(e,t=[]){let n=[];function r(t,r){let i=L.createContext(r),a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=L.useMemo(()=>o,Object.values(o));return(0,R.jsx)(s.Provider,{value:c,children:r})};o.displayName=t+`Provider`;function s(n,o){let s=o?.[e]?.[a]||i,c=L.useContext(s);if(c)return c;if(r!==void 0)return r;throw Error(`\`${n}\` must be used within \`${t}\``)}return[o,s]}let i=()=>{let t=n.map(e=>L.createContext(e));return function(n){let r=n?.[e]||t;return L.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,Jie(i,...t)]}function Jie(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return L.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}function RD(e){let t=Yie(e),n=L.forwardRef((e,n)=>{let{children:r,...i}=e,a=L.Children.toArray(r),o=a.find(BD);if(o){let e=o.props.children,r=a.map(t=>t===o?L.Children.count(e)>1?L.Children.only(null):L.isValidElement(e)?e.props.children:null:t);return(0,R.jsx)(t,{...i,ref:n,children:L.isValidElement(e)?L.cloneElement(e,void 0,r):null})}return(0,R.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function Yie(e){let t=L.forwardRef((e,t)=>{let{children:n,...r}=e;if(L.isValidElement(n)){let e=Qie(n),i=Zie(r,n.props);return n.type!==L.Fragment&&(i.ref=t?FD(t,e):e),L.cloneElement(n,i)}return L.Children.count(n)>1?L.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var zD=Symbol(`radix.slottable`);function Xie(e){let t=({children:e})=>(0,R.jsx)(R.Fragment,{children:e});return t.displayName=`${e}.Slottable`,t.__radixId=zD,t}function BD(e){return L.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===zD}function Zie(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function Qie(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var VD=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=RD(`Primitive.${t}`),r=L.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,R.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function $ie(e,t){e&&Pa.flushSync(()=>e.dispatchEvent(t))}function HD(e){let t=L.useRef(e);return L.useEffect(()=>{t.current=e}),L.useMemo(()=>(...e)=>t.current?.(...e),[])}function eae(e,t=globalThis?.document){let n=HD(e);L.useEffect(()=>{let e=e=>{e.key===`Escape`&&n(e)};return t.addEventListener(`keydown`,e,{capture:!0}),()=>t.removeEventListener(`keydown`,e,{capture:!0})},[n,t])}var tae=`DismissableLayer`,UD=`dismissableLayer.update`,nae=`dismissableLayer.pointerDownOutside`,rae=`dismissableLayer.focusOutside`,WD,GD=L.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),KD=L.forwardRef((e,t)=>{let{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:a,onInteractOutside:o,onDismiss:s,...c}=e,l=L.useContext(GD),[u,d]=L.useState(null),f=u?.ownerDocument??globalThis?.document,[,p]=L.useState({}),m=ID(t,e=>d(e)),h=Array.from(l.layers),[g]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),_=h.indexOf(g),v=u?h.indexOf(u):-1,y=l.layersWithOutsidePointerEventsDisabled.size>0,b=v>=_,x=JD(e=>{let t=e.target,n=[...l.branches].some(e=>e.contains(t));!b||n||(i?.(e),o?.(e),e.defaultPrevented||s?.())},f),S=YD(e=>{let t=e.target;[...l.branches].some(e=>e.contains(t))||(a?.(e),o?.(e),e.defaultPrevented||s?.())},f);return eae(e=>{v===l.layers.size-1&&(r?.(e),!e.defaultPrevented&&s&&(e.preventDefault(),s()))},f),L.useEffect(()=>{if(u)return n&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(WD=f.body.style.pointerEvents,f.body.style.pointerEvents=`none`),l.layersWithOutsidePointerEventsDisabled.add(u)),l.layers.add(u),XD(),()=>{n&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=WD)}},[u,f,n,l]),L.useEffect(()=>()=>{u&&(l.layers.delete(u),l.layersWithOutsidePointerEventsDisabled.delete(u),XD())},[u,l]),L.useEffect(()=>{let e=()=>p({});return document.addEventListener(UD,e),()=>document.removeEventListener(UD,e)},[]),(0,R.jsx)(VD.div,{...c,ref:m,style:{pointerEvents:y?b?`auto`:`none`:void 0,...e.style},onFocusCapture:ND(e.onFocusCapture,S.onFocusCapture),onBlurCapture:ND(e.onBlurCapture,S.onBlurCapture),onPointerDownCapture:ND(e.onPointerDownCapture,x.onPointerDownCapture)})});KD.displayName=tae;var iae=`DismissableLayerBranch`,qD=L.forwardRef((e,t)=>{let n=L.useContext(GD),r=L.useRef(null),i=ID(t,r);return L.useEffect(()=>{let e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),(0,R.jsx)(VD.div,{...e,ref:i})});qD.displayName=iae;function JD(e,t=globalThis?.document){let n=HD(e),r=L.useRef(!1),i=L.useRef(()=>{});return L.useEffect(()=>{let e=e=>{if(e.target&&!r.current){let r=function(){ZD(nae,n,a,{discrete:!0})},a={originalEvent:e};e.pointerType===`touch`?(t.removeEventListener(`click`,i.current),i.current=r,t.addEventListener(`click`,i.current,{once:!0})):r()}else t.removeEventListener(`click`,i.current);r.current=!1},a=window.setTimeout(()=>{t.addEventListener(`pointerdown`,e)},0);return()=>{window.clearTimeout(a),t.removeEventListener(`pointerdown`,e),t.removeEventListener(`click`,i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function YD(e,t=globalThis?.document){let n=HD(e),r=L.useRef(!1);return L.useEffect(()=>{let e=e=>{e.target&&!r.current&&ZD(rae,n,{originalEvent:e},{discrete:!1})};return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function XD(){let e=new CustomEvent(UD);document.dispatchEvent(e)}function ZD(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?$ie(i,a):i.dispatchEvent(a)}var QD=0;function $D(){L.useEffect(()=>{let e=document.querySelectorAll(`[data-radix-focus-guard]`);return document.body.insertAdjacentElement(`afterbegin`,e[0]??eO()),document.body.insertAdjacentElement(`beforeend`,e[1]??eO()),QD++,()=>{QD===1&&document.querySelectorAll(`[data-radix-focus-guard]`).forEach(e=>e.remove()),QD--}},[])}function eO(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}var tO=`focusScope.autoFocusOnMount`,nO=`focusScope.autoFocusOnUnmount`,rO={bubbles:!1,cancelable:!0},aae=`FocusScope`,iO=L.forwardRef((e,t)=>{let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=L.useState(null),l=HD(i),u=HD(a),d=L.useRef(null),f=ID(t,e=>c(e)),p=L.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;L.useEffect(()=>{if(r){let e=function(e){if(p.paused||!s)return;let t=e.target;s.contains(t)?d.current=t:lO(d.current,{select:!0})},t=function(e){if(p.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||lO(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&lO(s)};document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,s,p.paused]),L.useEffect(()=>{if(s){uO.add(p);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(tO,rO);s.addEventListener(tO,l),s.dispatchEvent(t),t.defaultPrevented||(oae(cae(aO(s)),{select:!0}),document.activeElement===e&&lO(s))}return()=>{s.removeEventListener(tO,l),setTimeout(()=>{let t=new CustomEvent(nO,rO);s.addEventListener(nO,u),s.dispatchEvent(t),t.defaultPrevented||lO(e??document.body,{select:!0}),s.removeEventListener(nO,u),uO.remove(p)},0)}}},[s,l,u,p]);let m=L.useCallback(e=>{if(!n&&!r||p.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=sae(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&lO(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&lO(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,p.paused]);return(0,R.jsx)(VD.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})});iO.displayName=aae;function oae(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(lO(r,{select:t}),document.activeElement!==n)return}function sae(e){let t=aO(e);return[oO(t,e),oO(t.reverse(),e)]}function aO(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function oO(e,t){for(let n of e)if(!sO(n,{upTo:t}))return n}function sO(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}function cO(e){return e instanceof HTMLInputElement&&`select`in e}function lO(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&cO(e)&&t&&e.select()}}var uO=dO();function dO(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=fO(e,t),e.unshift(t)},remove(t){e=fO(e,t),e[0]?.resume()}}}function fO(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function cae(e){return e.filter(e=>e.tagName!==`A`)}var pO=globalThis?.document?L.useLayoutEffect:()=>{},lae=L.useId||(()=>void 0),uae=0;function mO(e){let[t,n]=L.useState(lae());return pO(()=>{e||n(e=>e??String(uae++))},[e]),e||(t?`radix-${t}`:``)}var dae=[`top`,`right`,`bottom`,`left`],hO=Math.min,gO=Math.max,_O=Math.round,vO=Math.floor,yO=e=>({x:e,y:e}),fae={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function bO(e,t,n){return gO(e,hO(t,n))}function xO(e,t){return typeof e==`function`?e(t):e}function SO(e){return e.split(`-`)[0]}function CO(e){return e.split(`-`)[1]}function wO(e){return e===`x`?`y`:`x`}function TO(e){return e===`y`?`height`:`width`}function EO(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function DO(e){return wO(EO(e))}function pae(e,t,n){n===void 0&&(n=!1);let r=CO(e),i=DO(e),a=TO(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=FO(o)),[o,FO(o)]}function mae(e){let t=FO(e);return[OO(e),t,OO(t)]}function OO(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var kO=[`left`,`right`],AO=[`right`,`left`],jO=[`top`,`bottom`],MO=[`bottom`,`top`];function NO(e,t,n){switch(e){case`top`:case`bottom`:return n?t?AO:kO:t?kO:AO;case`left`:case`right`:return t?jO:MO;default:return[]}}function PO(e,t,n,r){let i=CO(e),a=NO(SO(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(OO)))),a}function FO(e){let t=SO(e);return fae[t]+e.slice(t.length)}function IO(e){return{top:0,right:0,bottom:0,left:0,...e}}function LO(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:IO(e)}function RO(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function zO(e,t,n){let{reference:r,floating:i}=e,a=EO(t),o=DO(t),s=TO(o),c=SO(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(CO(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}async function BO(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}=xO(t,e),p=LO(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=RO(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=RO(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 VO=50,HO=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:BO},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=zO(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<VO&&(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}=zO(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},UO=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=xO(e,t)||{};if(l==null)return{};let d=LO(u),f={x:n,y:r},p=DO(i),m=TO(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=hO(d[_],T),D=hO(d[v],T),O=E,k=C-h[m]-D,A=C/2-h[m]/2+w,j=bO(O,A,k),M=!c.arrow&&CO(i)!=null&&A!==j&&a.reference[m]/2-(A<O?E:D)-h[m]/2<0,N=M?A<O?A-O:A-k:0;return{[p]:f[p]+N,data:{[p]:j,centerOffset:A-j-N,...M&&{alignmentOffset:N}},reset:M}}}),WO=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}=xO(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=SO(r),_=EO(o),v=SO(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[FO(o)]:mae(o)),x=p!==`none`;!d&&x&&b.push(...PO(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=pae(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`&&_!==EO(t))||T.every(e=>EO(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=EO(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function GO(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function KO(e){return dae.some(t=>e[t]>=0)}var qO=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=xO(e,t);switch(i){case`referenceHidden`:{let e=GO(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:KO(e)}}}case`escaped`:{let e=GO(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:KO(e)}}}default:return{}}}}},JO=new Set([`left`,`top`]);async function YO(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=SO(n),s=CO(n),c=EO(n)===`y`,l=JO.has(o)?-1:1,u=a&&c?-1:1,d=xO(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 XO=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 YO(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}}}}},ZO=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}=xO(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=EO(SO(i)),p=wO(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=bO(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=bO(n,h,r)}let g=c.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}}}}},QO=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=xO(e,t),u={x:n,y:r},d=EO(i),f=wO(d),p=u[f],m=u[d],h=xO(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=JO.has(SO(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},$O=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=xO(e,t),u=await o.detectOverflow(t,l),d=SO(i),f=CO(i),p=EO(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=hO(h-u[g],v),x=hO(m-u[_],y),S=!t.middlewareData.shift,C=b,w=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(w=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=v),S&&!f){let e=gO(u.left,0),t=gO(u.right,0),n=gO(u.top,0),r=gO(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:gO(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:gO(u.top,u.bottom))}await c({...t,availableWidth:w,availableHeight:C});let T=await o.getDimensions(s.floating);return m!==T.width||h!==T.height?{reset:{rects:!0}}:{}}}};function ek(){return typeof window<`u`}function tk(e){return ik(e)?(e.nodeName||``).toLowerCase():`#document`}function nk(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function rk(e){return((ik(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function ik(e){return ek()?e instanceof Node||e instanceof nk(e).Node:!1}function ak(e){return ek()?e instanceof Element||e instanceof nk(e).Element:!1}function ok(e){return ek()?e instanceof HTMLElement||e instanceof nk(e).HTMLElement:!1}function sk(e){return!ek()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof nk(e).ShadowRoot}function ck(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=hk(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function hae(e){return/^(table|td|th)$/.test(tk(e))}function lk(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var gae=/transform|translate|scale|rotate|perspective|filter/,_ae=/paint|layout|strict|content/,uk=e=>!!e&&e!==`none`,dk;function fk(e){let t=ak(e)?hk(e):e;return uk(t.transform)||uk(t.translate)||uk(t.scale)||uk(t.rotate)||uk(t.perspective)||!pk()&&(uk(t.backdropFilter)||uk(t.filter))||gae.test(t.willChange||``)||_ae.test(t.contain||``)}function vae(e){let t=_k(e);for(;ok(t)&&!mk(t);){if(fk(t))return t;if(lk(t))return null;t=_k(t)}return null}function pk(){return dk??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),dk}function mk(e){return/^(html|body|#document)$/.test(tk(e))}function hk(e){return nk(e).getComputedStyle(e)}function gk(e){return ak(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function _k(e){if(tk(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||sk(e)&&e.host||rk(e);return sk(t)?t.host:t}function vk(e){let t=_k(e);return mk(t)?e.ownerDocument?e.ownerDocument.body:e.body:ok(t)&&ck(t)?t:vk(t)}function yk(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=vk(e),i=r===e.ownerDocument?.body,a=nk(r);if(i){let e=bk(a);return t.concat(a,a.visualViewport||[],ck(r)?r:[],e&&n?yk(e):[])}else return t.concat(r,yk(r,[],n))}function bk(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function xk(e){let t=hk(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=ok(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=_O(n)!==a||_O(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Sk(e){return ak(e)?e:e.contextElement}function Ck(e){let t=Sk(e);if(!ok(t))return yO(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=xk(t),o=(a?_O(n.width):n.width)/r,s=(a?_O(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var yae=yO(0);function wk(e){let t=nk(e);return!pk()||!t.visualViewport?yae:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function bae(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==nk(e)?!1:t}function Tk(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=Sk(e),o=yO(1);t&&(r?ak(r)&&(o=Ck(r)):o=Ck(e));let s=bae(a,n,r)?wk(a):yO(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=nk(a),t=r&&ak(r)?nk(r):r,n=e,i=bk(n);for(;i&&r&&t!==n;){let e=Ck(i),t=i.getBoundingClientRect(),r=hk(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=nk(i),i=bk(n)}}return RO({width:u,height:d,x:c,y:l})}function Ek(e,t){let n=gk(e).scrollLeft;return t?t.left+n:Tk(rk(e)).left+n}function Dk(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-Ek(e,n),y:n.top+t.scrollTop}}function xae(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=rk(r),s=t?lk(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=yO(1),u=yO(0),d=ok(r);if((d||!d&&!a)&&((tk(r)!==`body`||ck(o))&&(c=gk(r)),d)){let e=Tk(r);l=Ck(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Dk(o,c):yO(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 Sae(e){return Array.from(e.getClientRects())}function Cae(e){let t=rk(e),n=gk(e),r=e.ownerDocument.body,i=gO(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=gO(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+Ek(e),s=-n.scrollTop;return hk(r).direction===`rtl`&&(o+=gO(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var Ok=25;function wae(e,t){let n=nk(e),r=rk(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=pk();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=Ek(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=Ok&&(a-=o)}else l<=Ok&&(a+=l);return{width:a,height:o,x:s,y:c}}function Tae(e,t){let n=Tk(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=ok(e)?Ck(e):yO(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function kk(e,t,n){let r;if(t===`viewport`)r=wae(e,n);else if(t===`document`)r=Cae(rk(e));else if(ak(t))r=Tae(t,n);else{let n=wk(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return RO(r)}function Ak(e,t){let n=_k(e);return n===t||!ak(n)||mk(n)?!1:hk(n).position===`fixed`||Ak(n,t)}function Eae(e,t){let n=t.get(e);if(n)return n;let r=yk(e,[],!1).filter(e=>ak(e)&&tk(e)!==`body`),i=null,a=hk(e).position===`fixed`,o=a?_k(e):e;for(;ak(o)&&!mk(o);){let t=hk(o),n=fk(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||ck(o)&&!n&&Ak(e,o))?r=r.filter(e=>e!==o):i=t,o=_k(o)}return t.set(e,r),r}function Dae(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?lk(t)?[]:Eae(t,this._c):[].concat(n),r],o=kk(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=kk(t,a[e],i);s=gO(n.top,s),c=hO(n.right,c),l=hO(n.bottom,l),u=gO(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function Oae(e){let{width:t,height:n}=xk(e);return{width:t,height:n}}function kae(e,t,n){let r=ok(t),i=rk(t),a=n===`fixed`,o=Tk(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=yO(0);function l(){c.x=Ek(i)}if(r||!r&&!a)if((tk(t)!==`body`||ck(i))&&(s=gk(t)),r){let e=Tk(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l();a&&!r&&i&&l();let u=i&&!r&&!a?Dk(i,s):yO(0);return{x:o.left+s.scrollLeft-c.x-u.x,y:o.top+s.scrollTop-c.y-u.y,width:o.width,height:o.height}}function jk(e){return hk(e).position===`static`}function Mk(e,t){if(!ok(e)||hk(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return rk(e)===n&&(n=n.ownerDocument.body),n}function Nk(e,t){let n=nk(e);if(lk(e))return n;if(!ok(e)){let t=_k(e);for(;t&&!mk(t);){if(ak(t)&&!jk(t))return t;t=_k(t)}return n}let r=Mk(e,t);for(;r&&hae(r)&&jk(r);)r=Mk(r,t);return r&&mk(r)&&jk(r)&&!fk(r)?n:r||vae(e)||n}var Aae=async function(e){let t=this.getOffsetParent||Nk,n=this.getDimensions,r=await n(e.floating);return{reference:kae(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function jae(e){return hk(e).direction===`rtl`}var Mae={convertOffsetParentRelativeRectToViewportRelativeRect:xae,getDocumentElement:rk,getClippingRect:Dae,getOffsetParent:Nk,getElementRects:Aae,getClientRects:Sae,getDimensions:Oae,getScale:Ck,isElement:ak,isRTL:jae};function Pk(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Nae(e,t){let n=null,r,i=rk(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=vO(d),h=vO(i.clientWidth-(u+f)),g=vO(i.clientHeight-(d+p)),_=vO(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:gO(0,hO(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(n!==c){if(!y)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!Pk(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function Pae(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=Sk(e),u=i||a?[...l?yk(l):[],...t?yk(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?Nae(l,n):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?Tk(e):null;c&&g();function g(){let t=Tk(e);h&&!Pk(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 Fae=XO,Iae=ZO,Lae=WO,Rae=$O,zae=qO,Fk=UO,Bae=QO,Vae=(e,t,n)=>{let r=new Map,i={platform:Mae,...n},a={...i.platform,_c:r};return HO(e,t,{...i,platform:a})},Ik=typeof document<`u`?L.useLayoutEffect:function(){};function Lk(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(!Lk(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)&&!Lk(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function Rk(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function zk(e,t){let n=Rk(e);return Math.round(t*n)/n}function Bk(e){let t=L.useRef(e);return Ik(()=>{t.current=e}),t}function Hae(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]=L.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=L.useState(r);Lk(f,r)||p(r);let[m,h]=L.useState(null),[g,_]=L.useState(null),v=L.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=L.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=L.useRef(null),C=L.useRef(null),w=L.useRef(u),T=c!=null,E=Bk(c),D=Bk(i),O=Bk(l),k=L.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),Vae(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};A.current&&!Lk(w.current,t)&&(w.current=t,Pa.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);Ik(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let A=L.useRef(!1);Ik(()=>(A.current=!0,()=>{A.current=!1}),[]),Ik(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(E.current)return E.current(b,x,k);k()}},[b,x,k,E,T]);let j=L.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),M=L.useMemo(()=>({reference:b,floating:x}),[b,x]),N=L.useMemo(()=>{let e={position:n,left:0,top:0};if(!M.floating)return e;let t=zk(M.floating,u.x),r=zk(M.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...Rk(M.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,M.floating,u.x,u.y]);return L.useMemo(()=>({...u,update:k,refs:j,elements:M,floatingStyles:N}),[u,k,j,M,N])}var Vk=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:Fk({element:r.current,padding:i}).fn(n):r?Fk({element:r,padding:i}).fn(n):{}}}},Hk=(e,t)=>{let n=Fae(e);return{name:n.name,fn:n.fn,options:[e,t]}},Uk=(e,t)=>{let n=Iae(e);return{name:n.name,fn:n.fn,options:[e,t]}},Wk=(e,t)=>({fn:Bae(e).fn,options:[e,t]}),Gk=(e,t)=>{let n=Lae(e);return{name:n.name,fn:n.fn,options:[e,t]}},Kk=(e,t)=>{let n=Rae(e);return{name:n.name,fn:n.fn,options:[e,t]}},qk=(e,t)=>{let n=zae(e);return{name:n.name,fn:n.fn,options:[e,t]}},Jk=(e,t)=>{let n=Vk(e);return{name:n.name,fn:n.fn,options:[e,t]}},Yk=`Arrow`,Xk=L.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,R.jsx)(VD.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,R.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});Xk.displayName=Yk;var Zk=Xk;function Qk(e){let[t,n]=L.useState(void 0);return pO(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}else n(void 0)},[e]),t}var $k=`Popper`,[eA,tA]=LD($k),[nA,rA]=eA($k),iA=e=>{let{__scopePopper:t,children:n}=e,[r,i]=L.useState(null);return(0,R.jsx)(nA,{scope:t,anchor:r,onAnchorChange:i,children:n})};iA.displayName=$k;var aA=`PopperAnchor`,oA=L.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,a=rA(aA,n),o=L.useRef(null),s=ID(t,o),c=L.useRef(null);return L.useEffect(()=>{let e=c.current;c.current=r?.current||o.current,e!==c.current&&a.onAnchorChange(c.current)}),r?null:(0,R.jsx)(VD.div,{...i,ref:s})});oA.displayName=aA;var sA=`PopperContent`,[cA,lA]=eA(sA),uA=L.forwardRef((e,t)=>{let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:u=0,sticky:d=`partial`,hideWhenDetached:f=!1,updatePositionStrategy:p=`optimized`,onPlaced:m,...h}=e,g=rA(sA,n),[_,v]=L.useState(null),y=ID(t,e=>v(e)),[b,x]=L.useState(null),S=Qk(b),C=S?.width??0,w=S?.height??0,T=r+(a===`center`?``:`-`+a),E=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},D=Array.isArray(l)?l:[l],O=D.length>0,k={padding:E,boundary:D.filter(mA),altBoundary:O},{refs:A,floatingStyles:j,placement:M,isPositioned:N,middlewareData:P}=Hae({strategy:`fixed`,placement:T,whileElementsMounted:(...e)=>Pae(...e,{animationFrame:p===`always`}),elements:{reference:g.anchor},middleware:[Hk({mainAxis:i+w,alignmentAxis:o}),c&&Uk({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?Wk():void 0,...k}),c&&Gk({...k}),Kk({...k,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)}}),b&&Jk({element:b,padding:s}),hA({arrowWidth:C,arrowHeight:w}),f&&qk({strategy:`referenceHidden`,...k})]}),[ee,te]=gA(M),ne=HD(m);pO(()=>{N&&ne?.()},[N,ne]);let F=P.arrow?.x,re=P.arrow?.y,I=P.arrow?.centerOffset!==0,[ie,ae]=L.useState();return pO(()=>{_&&ae(window.getComputedStyle(_).zIndex)},[_]),(0,R.jsx)(`div`,{ref:A.setFloating,"data-radix-popper-content-wrapper":``,style:{...j,transform:N?j.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:ie,"--radix-popper-transform-origin":[P.transformOrigin?.x,P.transformOrigin?.y].join(` `),...P.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,R.jsx)(cA,{scope:n,placedSide:ee,onArrowChange:x,arrowX:F,arrowY:re,shouldHideArrow:I,children:(0,R.jsx)(VD.div,{"data-side":ee,"data-align":te,...h,ref:y,style:{...h.style,animation:N?void 0:`none`}})})})});uA.displayName=sA;var dA=`PopperArrow`,fA={top:`bottom`,right:`left`,bottom:`top`,left:`right`},pA=L.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=lA(dA,n),a=fA[i.placedSide];return(0,R.jsx)(`span`,{ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:(0,R.jsx)(Zk,{...r,ref:t,style:{...r.style,display:`block`}})})});pA.displayName=dA;function mA(e){return e!==null}var hA=e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=gA(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}});function gA(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var _A=iA,vA=oA,yA=uA,bA=pA,xA=`Portal`,SA=L.forwardRef((e,t)=>{let{container:n,...r}=e,[i,a]=L.useState(!1);pO(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?Pa.createPortal((0,R.jsx)(VD.div,{...r,ref:t}),o):null});SA.displayName=xA;function CA(e,t){return L.useReducer((e,n)=>t[e][n]??e,e)}var wA=e=>{let{present:t,children:n}=e,r=TA(t),i=typeof n==`function`?n({present:r.isPresent}):L.Children.only(n),a=ID(r.ref,DA(i));return typeof n==`function`||r.isPresent?L.cloneElement(i,{ref:a}):null};wA.displayName=`Presence`;function TA(e){let[t,n]=L.useState(),r=L.useRef(null),i=L.useRef(e),a=L.useRef(`none`),[o,s]=CA(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return L.useEffect(()=>{let e=EA(r.current);a.current=o===`mounted`?e:`none`},[o]),pO(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,o=EA(t);e?s(`MOUNT`):o===`none`||t?.display===`none`?s(`UNMOUNT`):s(n&&r!==o?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,s]),pO(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=a=>{let o=EA(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(s(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},c=e=>{e.target===t&&(a.current=EA(r.current))};return t.addEventListener(`animationstart`,c),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,c),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}else s(`ANIMATION_END`)},[t,s]),{isPresent:[`mounted`,`unmountSuspended`].includes(o),ref:L.useCallback(e=>{r.current=e?getComputedStyle(e):null,n(e)},[])}}function EA(e){return e?.animationName||`none`}function DA(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var OA=L.useInsertionEffect||pO;function kA({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){let[i,a,o]=AA({defaultProp:t,onChange:n}),s=e!==void 0,c=s?e:i;{let t=L.useRef(e!==void 0);L.useEffect(()=>{let e=t.current;e!==s&&console.warn(`${r} is changing from ${e?`controlled`:`uncontrolled`} to ${s?`controlled`:`uncontrolled`}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),t.current=s},[s,r])}return[c,L.useCallback(t=>{if(s){let n=jA(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}function AA({defaultProp:e,onChange:t}){let[n,r]=L.useState(e),i=L.useRef(n),a=L.useRef(t);return OA(()=>{a.current=t},[t]),L.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}function jA(e){return typeof e==`function`}var MA=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},NA=new WeakMap,PA=new WeakMap,FA={},IA=0,LA=function(e){return e&&(e.host||LA(e.parentNode))},RA=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=LA(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},zA=function(e,t,n,r){var i=RA(t,Array.isArray(e)?e:[e]);FA[n]||(FA[n]=new WeakMap);var a=FA[n],o=[],s=new Set,c=new Set(i),l=function(e){!e||s.has(e)||(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){!e||c.has(e)||Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(NA.get(e)||0)+1,l=(a.get(e)||0)+1;NA.set(e,c),a.set(e,l),o.push(e),c===1&&i&&PA.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),IA++,function(){o.forEach(function(e){var t=NA.get(e)-1,i=a.get(e)-1;NA.set(e,t),a.set(e,i),t||(PA.has(e)||e.removeAttribute(r),PA.delete(e)),i||e.removeAttribute(n)}),IA--,IA||(NA=new WeakMap,NA=new WeakMap,PA=new WeakMap,FA={})}},BA=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||MA(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),zA(r,i,n,`aria-hidden`)):function(){return null}},VA=function(){return VA=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},VA.apply(this,arguments)};function HA(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function UA(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var WA=`right-scroll-bar-position`,GA=`width-before-scroll-bar`,KA=`with-scroll-bars-hidden`,qA=`--removed-body-scroll-bar-size`;function JA(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function YA(e,t){var n=(0,L.useState)(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(e){var t=n.value;t!==e&&(n.value=e,n.callback(e,t))}}}})[0];return n.callback=t,n.facade}var XA=typeof window<`u`?L.useLayoutEffect:L.useEffect,ZA=new WeakMap;function QA(e,t){var n=YA(t||null,function(t){return e.forEach(function(e){return JA(e,t)})});return XA(function(){var t=ZA.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||JA(e,null)}),i.forEach(function(e){r.has(e)||JA(e,a)})}ZA.set(n,e)},[e]),n}function $A(e){return e}function ej(e,t){t===void 0&&(t=$A);var n=[],r=!1;return{read:function(){if(r)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var i=t(e,r);return n.push(i),function(){n=n.filter(function(e){return e!==i})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var i=n;n=[],i.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},o=function(){return Promise.resolve().then(a)};o(),n={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),n}}}}}function tj(e){e===void 0&&(e={});var t=ej(null);return t.options=VA({async:!0,ssr:!1},e),t}var nj=function(e){var t=e.sideCar,n=HA(e,[`sideCar`]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error(`Sidecar medium not found`);return L.createElement(r,VA({},n))};nj.isSideCarExport=!0;function rj(e,t){return e.useMedium(t),nj}var ij=tj(),aj=function(){},oj=L.forwardRef(function(e,t){var n=L.useRef(null),r=L.useState({onScrollCapture:aj,onWheelCapture:aj,onTouchMoveCapture:aj}),i=r[0],a=r[1],o=e.forwardProps,s=e.children,c=e.className,l=e.removeScrollBar,u=e.enabled,d=e.shards,f=e.sideCar,p=e.noRelative,m=e.noIsolation,h=e.inert,g=e.allowPinchZoom,_=e.as,v=_===void 0?`div`:_,y=e.gapMode,b=HA(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),x=f,S=QA([n,t]),C=VA(VA({},b),i);return L.createElement(L.Fragment,null,u&&L.createElement(x,{sideCar:ij,removeScrollBar:l,shards:d,noRelative:p,noIsolation:m,inert:h,setCallbacks:a,allowPinchZoom:!!g,lockRef:n,gapMode:y}),o?L.cloneElement(L.Children.only(s),VA(VA({},C),{ref:S})):L.createElement(v,VA({},C,{className:c,ref:S}),s))});oj.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},oj.classNames={fullWidth:GA,zeroRight:WA};var sj,cj=function(){if(sj)return sj;if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function lj(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=cj();return t&&e.setAttribute(`nonce`,t),e}function uj(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function dj(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var fj=function(){var e=0,t=null;return{add:function(n){e==0&&(t=lj())&&(uj(t,n),dj(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},pj=function(){var e=fj();return function(t,n){L.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},mj=function(){var e=pj();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},Uae={left:0,top:0,right:0,gap:0},hj=function(e){return parseInt(e||``,10)||0},Wae=function(e){var t=window.getComputedStyle(document.body),n=t[e===`padding`?`paddingLeft`:`marginLeft`],r=t[e===`padding`?`paddingTop`:`marginTop`],i=t[e===`padding`?`paddingRight`:`marginRight`];return[hj(n),hj(r),hj(i)]},Gae=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return Uae;var t=Wae(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},Kae=mj(),gj=`data-scroll-locked`,qae=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
88
+ .${KA} {
89
+ overflow: hidden ${r};
90
+ padding-right: ${s}px ${r};
91
+ }
92
+ body[${gj}] {
93
+ overflow: hidden ${r};
94
+ overscroll-behavior: contain;
95
+ ${[t&&`position: relative ${r};`,n===`margin`&&`
96
+ padding-left: ${i}px;
97
+ padding-top: ${a}px;
98
+ padding-right: ${o}px;
99
+ margin-left:0;
100
+ margin-top:0;
101
+ margin-right: ${s}px ${r};
102
+ `,n===`padding`&&`padding-right: ${s}px ${r};`].filter(Boolean).join(``)}
103
+ }
104
+
105
+ .${WA} {
106
+ right: ${s}px ${r};
107
+ }
108
+
109
+ .${GA} {
110
+ margin-right: ${s}px ${r};
111
+ }
112
+
113
+ .${WA} .${WA} {
114
+ right: 0 ${r};
115
+ }
116
+
117
+ .${GA} .${GA} {
118
+ margin-right: 0 ${r};
119
+ }
120
+
121
+ body[${gj}] {
122
+ ${qA}: ${s}px;
123
+ }
124
+ `},_j=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},Jae=function(){L.useEffect(function(){return document.body.setAttribute(gj,(_j()+1).toString()),function(){var e=_j()-1;e<=0?document.body.removeAttribute(gj):document.body.setAttribute(gj,e.toString())}},[])},Yae=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;Jae();var a=L.useMemo(function(){return Gae(i)},[i]);return L.createElement(Kae,{styles:qae(a,!t,i,n?``:`!important`)})},vj=!1;if(typeof window<`u`)try{var yj=Object.defineProperty({},`passive`,{get:function(){return vj=!0,!0}});window.addEventListener(`test`,yj,yj),window.removeEventListener(`test`,yj,yj)}catch{vj=!1}var bj=vj?{passive:!1}:!1,Xae=function(e){return e.tagName===`TEXTAREA`},xj=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!Xae(e)&&n[t]===`visible`)},Zae=function(e){return xj(e,`overflowY`)},Qae=function(e){return xj(e,`overflowX`)},Sj=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),Cj(e,r)){var i=wj(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},$ae=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},eoe=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},Cj=function(e,t){return e===`v`?Zae(t):Qae(t)},wj=function(e,t){return e===`v`?$ae(t):eoe(t)},toe=function(e,t){return e===`h`&&t===`rtl`?-1:1},noe=function(e,t,n,r,i){var a=toe(e,window.getComputedStyle(t).direction),o=a*r,s=n.target,c=t.contains(s),l=!1,u=o>0,d=0,f=0;do{if(!s)break;var p=wj(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&Cj(e,s)&&(d+=h,f+=m);var g=s.parentNode;s=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(u&&(i&&Math.abs(d)<1||!i&&o>d)||!u&&(i&&Math.abs(f)<1||!i&&-o>f))&&(l=!0),l},Tj=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Ej=function(e){return[e.deltaX,e.deltaY]},Dj=function(e){return e&&`current`in e?e.current:e},roe=function(e,t){return e[0]===t[0]&&e[1]===t[1]},ioe=function(e){return`
125
+ .block-interactivity-${e} {pointer-events: none;}
126
+ .allow-interactivity-${e} {pointer-events: all;}
127
+ `},aoe=0,Oj=[];function ooe(e){var t=L.useRef([]),n=L.useRef([0,0]),r=L.useRef(),i=L.useState(aoe++)[0],a=L.useState(mj)[0],o=L.useRef(e);L.useEffect(function(){o.current=e},[e]),L.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=UA([e.lockRef.current],(e.shards||[]).map(Dj),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=L.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=Tj(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=Sj(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=Sj(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return noe(h,t,e,h===`h`?s:c,!0)},[]),c=L.useCallback(function(e){var n=e;if(!(!Oj.length||Oj[Oj.length-1]!==a)){var r=`deltaY`in n?Ej(n):Tj(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&roe(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(Dj).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=L.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:soe(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=L.useCallback(function(e){n.current=Tj(e),r.current=void 0},[]),d=L.useCallback(function(t){l(t.type,Ej(t),t.target,s(t,e.lockRef.current))},[]),f=L.useCallback(function(t){l(t.type,Tj(t),t.target,s(t,e.lockRef.current))},[]);L.useEffect(function(){return Oj.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,bj),document.addEventListener(`touchmove`,c,bj),document.addEventListener(`touchstart`,u,bj),function(){Oj=Oj.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,bj),document.removeEventListener(`touchmove`,c,bj),document.removeEventListener(`touchstart`,u,bj)}},[]);var p=e.removeScrollBar,m=e.inert;return L.createElement(L.Fragment,null,m?L.createElement(a,{styles:ioe(i)}):null,p?L.createElement(Yae,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function soe(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var coe=rj(ij,ooe),kj=L.forwardRef(function(e,t){return L.createElement(oj,VA({},e,{ref:t,sideCar:coe}))});kj.classNames=oj.classNames;var Aj=`Popover`,[jj,loe]=LD(Aj,[tA]),Mj=tA(),[uoe,Nj]=jj(Aj),Pj=e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=Mj(t),c=L.useRef(null),[l,u]=L.useState(!1),[d,f]=kA({prop:r,defaultProp:i??!1,onChange:a,caller:Aj});return(0,R.jsx)(_A,{...s,children:(0,R.jsx)(uoe,{scope:t,contentId:mO(),triggerRef:c,open:d,onOpenChange:f,onOpenToggle:L.useCallback(()=>f(e=>!e),[f]),hasCustomAnchor:l,onCustomAnchorAdd:L.useCallback(()=>u(!0),[]),onCustomAnchorRemove:L.useCallback(()=>u(!1),[]),modal:o,children:n})})};Pj.displayName=Aj;var Fj=`PopoverAnchor`,Ij=L.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=Nj(Fj,n),a=Mj(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return L.useEffect(()=>(o(),()=>s()),[o,s]),(0,R.jsx)(vA,{...a,...r,ref:t})});Ij.displayName=Fj;var Lj=`PopoverTrigger`,Rj=L.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=Nj(Lj,n),a=Mj(n),o=ID(t,i.triggerRef),s=(0,R.jsx)(VD.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.contentId,"data-state":Kj(i.open),...r,ref:o,onClick:ND(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,R.jsx)(vA,{asChild:!0,...a,children:s})});Rj.displayName=Lj;var zj=`PopoverPortal`,[doe,foe]=jj(zj,{forceMount:void 0}),Bj=e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=Nj(zj,t);return(0,R.jsx)(doe,{scope:t,forceMount:n,children:(0,R.jsx)(wA,{present:n||a.open,children:(0,R.jsx)(SA,{asChild:!0,container:i,children:r})})})};Bj.displayName=zj;var Vj=`PopoverContent`,Hj=L.forwardRef((e,t)=>{let n=foe(Vj,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=Nj(Vj,e.__scopePopover);return(0,R.jsx)(wA,{present:r||a.open,children:a.modal?(0,R.jsx)(moe,{...i,ref:t}):(0,R.jsx)(hoe,{...i,ref:t})})});Hj.displayName=Vj;var poe=RD(`PopoverContent.RemoveScroll`),moe=L.forwardRef((e,t)=>{let n=Nj(Vj,e.__scopePopover),r=L.useRef(null),i=ID(t,r),a=L.useRef(!1);return L.useEffect(()=>{let e=r.current;if(e)return BA(e)},[]),(0,R.jsx)(kj,{as:poe,allowPinchZoom:!0,children:(0,R.jsx)(Uj,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ND(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:ND(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;a.current=t.button===2||n},{checkForDefaultPrevented:!1}),onFocusOutside:ND(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),hoe=L.forwardRef((e,t)=>{let n=Nj(Vj,e.__scopePopover),r=L.useRef(!1),i=L.useRef(!1);return(0,R.jsx)(Uj,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),Uj=L.forwardRef((e,t)=>{let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,...d}=e,f=Nj(Vj,n),p=Mj(n);return $D(),(0,R.jsx)(iO,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,R.jsx)(KD,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),children:(0,R.jsx)(yA,{"data-state":Kj(f.open),role:`dialog`,id:f.contentId,...p,...d,ref:t,style:{...d.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})}),Wj=`PopoverClose`,goe=L.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=Nj(Wj,n);return(0,R.jsx)(VD.button,{type:`button`,...r,ref:t,onClick:ND(e.onClick,()=>i.onOpenChange(!1))})});goe.displayName=Wj;var _oe=`PopoverArrow`,Gj=L.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=Mj(n);return(0,R.jsx)(bA,{...i,...r,ref:t})});Gj.displayName=_oe;function Kj(e){return e?`open`:`closed`}var qj=Pj,voe=Ij,Jj=Bj,yoe=Hj,Yj=Gj;function Xj(e){let t=e+`CollectionProvider`,[n,r]=LD(t),[i,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=e=>{let{scope:t,children:n}=e,r=L.useRef(null),a=L.useRef(new Map).current;return(0,R.jsx)(i,{scope:t,itemMap:a,collectionRef:r,children:n})};o.displayName=t;let s=e+`CollectionSlot`,c=RD(s),l=L.forwardRef((e,t)=>{let{scope:n,children:r}=e;return(0,R.jsx)(c,{ref:ID(t,a(s,n).collectionRef),children:r})});l.displayName=s;let u=e+`CollectionItemSlot`,d=`data-radix-collection-item`,f=RD(u),p=L.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=L.useRef(null),s=ID(t,o),c=a(u,n);return L.useEffect(()=>(c.itemMap.set(o,{ref:o,...i}),()=>void c.itemMap.delete(o))),(0,R.jsx)(f,{[d]:``,ref:s,children:r})});p.displayName=u;function m(t){let n=a(e+`CollectionConsumer`,t);return L.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${d}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return[{Provider:o,Slot:l,ItemSlot:p},m,r]}var boe=L.createContext(void 0);function Zj(e){let t=L.useContext(boe);return e||t||`ltr`}var Qj=`rovingFocusGroup.onEntryFocus`,xoe={bubbles:!1,cancelable:!0},$j=`RovingFocusGroup`,[eM,tM,Soe]=Xj($j),[Coe,nM]=LD($j,[Soe]),[woe,Toe]=Coe($j),rM=L.forwardRef((e,t)=>(0,R.jsx)(eM.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,R.jsx)(eM.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,R.jsx)(Eoe,{...e,ref:t})})}));rM.displayName=$j;var Eoe=L.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:u=!1,...d}=e,f=L.useRef(null),p=ID(t,f),m=Zj(a),[h,g]=kA({prop:o,defaultProp:s??null,onChange:c,caller:$j}),[_,v]=L.useState(!1),y=HD(l),b=tM(n),x=L.useRef(!1),[S,C]=L.useState(0);return L.useEffect(()=>{let e=f.current;if(e)return e.addEventListener(Qj,y),()=>e.removeEventListener(Qj,y)},[y]),(0,R.jsx)(woe,{scope:n,orientation:r,dir:m,loop:i,currentTabStopId:h,onItemFocus:L.useCallback(e=>g(e),[g]),onItemShiftTab:L.useCallback(()=>v(!0),[]),onFocusableItemAdd:L.useCallback(()=>C(e=>e+1),[]),onFocusableItemRemove:L.useCallback(()=>C(e=>e-1),[]),children:(0,R.jsx)(VD.div,{tabIndex:_||S===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:`none`,...e.style},onMouseDown:ND(e.onMouseDown,()=>{x.current=!0}),onFocus:ND(e.onFocus,e=>{let t=!x.current;if(e.target===e.currentTarget&&t&&!_){let t=new CustomEvent(Qj,xoe);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=b().filter(e=>e.focusable);oM([e.find(e=>e.active),e.find(e=>e.id===h),...e].filter(Boolean).map(e=>e.ref.current),u)}}x.current=!1}),onBlur:ND(e.onBlur,()=>v(!1))})})}),iM=`RovingFocusGroupItem`,aM=L.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=mO(),l=a||c,u=Toe(iM,n),d=u.currentTabStopId===l,f=tM(n),{onFocusableItemAdd:p,onFocusableItemRemove:m,currentTabStopId:h}=u;return L.useEffect(()=>{if(r)return p(),()=>m()},[r,p,m]),(0,R.jsx)(eM.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,R.jsx)(VD.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:ND(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:ND(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:ND(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=koe(e,u.orientation,u.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=f().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=u.loop?Aoe(n,r+1):n.slice(r+1)}setTimeout(()=>oM(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:h!=null}):o})})});aM.displayName=iM;var Doe={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function Ooe(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}function koe(e,t,n){let r=Ooe(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return Doe[r]}function oM(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function Aoe(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var sM=rM,cM=aM,joe=`Separator`,lM=`horizontal`,Moe=[`horizontal`,`vertical`],uM=L.forwardRef((e,t)=>{let{decorative:n,orientation:r=lM,...i}=e,a=Noe(r)?r:lM,o=n?{role:`none`}:{"aria-orientation":a===`vertical`?a:void 0,role:`separator`};return(0,R.jsx)(VD.div,{"data-orientation":a,...o,...i,ref:t})});uM.displayName=joe;function Noe(e){return Moe.includes(e)}var Poe=uM,dM=`Toggle`,fM=L.forwardRef((e,t)=>{let{pressed:n,defaultPressed:r,onPressedChange:i,...a}=e,[o,s]=kA({prop:n,onChange:i,defaultProp:r??!1,caller:dM});return(0,R.jsx)(VD.button,{type:`button`,"aria-pressed":o,"data-state":o?`on`:`off`,"data-disabled":e.disabled?``:void 0,...a,ref:t,onClick:ND(e.onClick,()=>{e.disabled||s(!o)})})});fM.displayName=dM;var pM=`ToggleGroup`,[mM,hM]=LD(pM,[nM]),gM=nM(),_M=L.forwardRef((e,t)=>{let{type:n,...r}=e;if(n===`single`)return(0,R.jsx)(Foe,{...r,ref:t});if(n===`multiple`)return(0,R.jsx)(Ioe,{...r,ref:t});throw Error(`Missing prop \`type\` expected on \`${pM}\``)});_M.displayName=pM;var[vM,yM]=mM(pM),Foe=L.forwardRef((e,t)=>{let{value:n,defaultValue:r,onValueChange:i=()=>{},...a}=e,[o,s]=kA({prop:n,defaultProp:r??``,onChange:i,caller:pM});return(0,R.jsx)(vM,{scope:e.__scopeToggleGroup,type:`single`,value:L.useMemo(()=>o?[o]:[],[o]),onItemActivate:s,onItemDeactivate:L.useCallback(()=>s(``),[s]),children:(0,R.jsx)(bM,{...a,ref:t})})}),Ioe=L.forwardRef((e,t)=>{let{value:n,defaultValue:r,onValueChange:i=()=>{},...a}=e,[o,s]=kA({prop:n,defaultProp:r??[],onChange:i,caller:pM}),c=L.useCallback(e=>s((t=[])=>[...t,e]),[s]),l=L.useCallback(e=>s((t=[])=>t.filter(t=>t!==e)),[s]);return(0,R.jsx)(vM,{scope:e.__scopeToggleGroup,type:`multiple`,value:o,onItemActivate:c,onItemDeactivate:l,children:(0,R.jsx)(bM,{...a,ref:t})})});_M.displayName=pM;var[Loe,Roe]=mM(pM),bM=L.forwardRef((e,t)=>{let{__scopeToggleGroup:n,disabled:r=!1,rovingFocus:i=!0,orientation:a,dir:o,loop:s=!0,...c}=e,l=gM(n),u=Zj(o),d={role:`group`,dir:u,...c};return(0,R.jsx)(Loe,{scope:n,rovingFocus:i,disabled:r,children:i?(0,R.jsx)(sM,{asChild:!0,...l,orientation:a,dir:u,loop:s,children:(0,R.jsx)(VD.div,{...d,ref:t})}):(0,R.jsx)(VD.div,{...d,ref:t})})}),xM=`ToggleGroupItem`,SM=L.forwardRef((e,t)=>{let n=yM(xM,e.__scopeToggleGroup),r=Roe(xM,e.__scopeToggleGroup),i=gM(e.__scopeToggleGroup),a=n.value.includes(e.value),o=r.disabled||e.disabled,s={...e,pressed:a,disabled:o},c=L.useRef(null);return r.rovingFocus?(0,R.jsx)(cM,{asChild:!0,...i,focusable:!o,active:a,ref:c,children:(0,R.jsx)(CM,{...s,ref:t})}):(0,R.jsx)(CM,{...s,ref:t})});SM.displayName=xM;var CM=L.forwardRef((e,t)=>{let{__scopeToggleGroup:n,value:r,...i}=e,a=yM(xM,n),o={role:`radio`,"aria-checked":e.pressed,"aria-pressed":void 0};return(0,R.jsx)(fM,{...a.type===`single`?o:void 0,...i,ref:t,onPressedChange:e=>{e?a.onItemActivate(r):a.onItemDeactivate(r)}})}),zoe=_M,Boe=SM,wM=`Toolbar`,[Voe,Hoe]=LD(wM,[nM,hM]),TM=nM(),EM=hM(),[Uoe,DM]=Voe(wM),OM=L.forwardRef((e,t)=>{let{__scopeToolbar:n,orientation:r=`horizontal`,dir:i,loop:a=!0,...o}=e,s=TM(n),c=Zj(i);return(0,R.jsx)(Uoe,{scope:n,orientation:r,dir:c,children:(0,R.jsx)(sM,{asChild:!0,...s,orientation:r,dir:c,loop:a,children:(0,R.jsx)(VD.div,{role:`toolbar`,"aria-orientation":r,dir:c,...o,ref:t})})})});OM.displayName=wM;var kM=`ToolbarSeparator`,AM=L.forwardRef((e,t)=>{let{__scopeToolbar:n,...r}=e,i=DM(kM,n);return(0,R.jsx)(Poe,{orientation:i.orientation===`horizontal`?`vertical`:`horizontal`,...r,ref:t})});AM.displayName=kM;var Woe=`ToolbarButton`,jM=L.forwardRef((e,t)=>{let{__scopeToolbar:n,...r}=e,i=TM(n);return(0,R.jsx)(cM,{asChild:!0,...i,focusable:!e.disabled,children:(0,R.jsx)(VD.button,{type:`button`,...r,ref:t})})});jM.displayName=Woe;var Goe=`ToolbarLink`,Koe=L.forwardRef((e,t)=>{let{__scopeToolbar:n,...r}=e,i=TM(n);return(0,R.jsx)(cM,{asChild:!0,...i,focusable:!0,children:(0,R.jsx)(VD.a,{...r,ref:t,onKeyDown:ND(e.onKeyDown,e=>{e.key===` `&&e.currentTarget.click()})})})});Koe.displayName=Goe;var MM=`ToolbarToggleGroup`,NM=L.forwardRef((e,t)=>{let{__scopeToolbar:n,...r}=e,i=DM(MM,n),a=EM(n);return(0,R.jsx)(zoe,{"data-orientation":i.orientation,dir:i.dir,...a,...r,ref:t,rovingFocus:!1})});NM.displayName=MM;var qoe=`ToolbarToggleItem`,PM=L.forwardRef((e,t)=>{let{__scopeToolbar:n,...r}=e,i=EM(n);return(0,R.jsx)(jM,{asChild:!0,__scopeToolbar:e.__scopeToolbar,children:(0,R.jsx)(Boe,{...i,...r,ref:t})})});PM.displayName=qoe;var FM=OM,Joe=AM,IM=jM,LM=NM,RM=PM;function zM(e,t){return e===null||e===t?!1:e.dataset.editorDialog!==void 0||e.dataset.toolbarItem!==void 0||e.dataset.editorDropdown?!0:zM(e.parentElement,t)}function Yoe(){let e=[...Array(256).keys()].map(e=>e.toString(16).padStart(2,`0`)),t=crypto.getRandomValues(new Uint8Array(16));return t[6]=t[6]&15|64,t[8]=t[8]&63|128,[...t.entries()].map(([t,n])=>[4,6,8,10].includes(t)?`-${e[n]}`:e[n]).join(``)}var BM=e=>e===0?`th`:`td`,VM={center:fE.centeredCell,left:fE.leftAlignedCell,right:fE.rightAlignedCell},Xoe=({mdastNode:e,parentEditor:t,lexicalTable:n})=>{let[r,i]=L.useState(null),[a,o]=zl(jT,Ww),s=L.useMemo(()=>e=>(e.__cacheKey??=Yoe(),e.__cacheKey),[]),c=L.useCallback(e=>{let r=n.getColCount();if(e===null){i(null);return}let[a,o]=e;if(a>r-1&&(a=0,o++),a<0&&(a=r-1,--o),o>n.getRowCount()-1){i(null),t.update(()=>{if(n.getLatest().getNextSibling())n.getLatest().selectNext();else{let e=$m();n.insertAfter(e),e.select()}});return}if(o<0){i(null),t.update(()=>{n.getLatest().selectPrevious()});return}i([a,o])},[n,t]);L.useEffect(()=>{n.focusEmitter.subscribe(c)},[n,c]);let l=L.useCallback(e=>{e.preventDefault(),t.update(()=>{n.addRowToBottom(),i([0,n.getRowCount()])})},[t,n]),u=L.useCallback(e=>{e.preventDefault(),t.update(()=>{n.addColumnToRight(),i([n.getColCount(),0])})},[t,n]),[d,f]=L.useState([-1,-1]),p=L.useCallback(e=>{let t=e.target;for(;t&&![`TH`,`TD`].includes(t.tagName);){if(t===e.currentTarget)return;t=t.parentElement}if(t===null)return;let n=t.parentElement;f([n.parentElement.tagName===`TFOOT`?-1:Array.from(n.children).indexOf(t),t.tagName===`TH`?-1:Array.from(n.parentElement.children).indexOf(n)])},[]),m=tE();return L.createElement(`table`,{className:fE.tableEditor,onMouseOver:p,onMouseLeave:()=>{f([-1,-1])}},L.createElement(`colgroup`,null,o?null:L.createElement(`col`,null),Array.from({length:e.children[0].children.length},(t,n)=>{let r=VM[(e.align??[])[n]??`left`];return L.createElement(`col`,{key:n,className:r})}),o?null:L.createElement(`col`,null)),o||L.createElement(`thead`,null,L.createElement(`tr`,null,L.createElement(`th`,{className:fE.tableToolsColumn}),Array.from({length:e.children[0].children.length},(r,i)=>L.createElement(`th`,{key:i,"data-tool-cell":!0},L.createElement($oe,{setActiveCellWithBoundaries:c,parentEditor:t,colIndex:i,highlightedCoordinates:d,lexicalTable:n,align:(e.align??[])[i]}))),L.createElement(`th`,{className:fE.tableToolsColumn,"data-tool-cell":!0},L.createElement(`button`,{className:fE.iconButton,type:`button`,title:m(`table.deleteTable`,`Delete table`),onClick:e=>{e.preventDefault(),t.update(()=>{n.selectNext(),n.remove()})}},a(`delete_small`))))),L.createElement(`tbody`,null,e.children.map((i,l)=>{let f=BM(l);return L.createElement(`tr`,{key:l},o||L.createElement(f,{className:fE.toolCell,"data-tool-cell":!0},L.createElement(HM,{setActiveCellWithBoundaries:c,parentEditor:t,rowIndex:l,highlightedCoordinates:d,lexicalTable:n})),i.children.map((i,a)=>L.createElement(Zoe,{align:e.align?.[a],key:s(i),contents:i.children,setActiveCell:c,rowIndex:l,colIndex:a,lexicalTable:n,parentEditor:t,activeCell:o?[-1,-1]:r})),o||l===0&&L.createElement(`th`,{rowSpan:n.getRowCount(),"data-tool-cell":!0},L.createElement(`button`,{type:`button`,className:fE.addColumnButton,onClick:u},a(`add_column`))))})),o||L.createElement(`tfoot`,null,L.createElement(`tr`,null,L.createElement(`th`,null),L.createElement(`th`,{colSpan:n.getColCount(),"data-tool-cell":!0},L.createElement(`button`,{type:`button`,className:fE.addRowButton,onClick:l},a(`add_row`))),L.createElement(`th`,null))))},Zoe=({align:e,...t})=>{let{activeCell:n,setActiveCell:r}=t,i=!!(n&&n[0]===t.colIndex&&n[1]===t.rowIndex),a=VM[e??`left`],o=BM(t.rowIndex);return L.createElement(o,{className:a,"data-active":i,onClick:()=>{r([t.colIndex,t.rowIndex])}},L.createElement(Qoe,{...t,focus:i}))},Qoe=({focus:e,setActiveCell:t,parentEditor:n,lexicalTable:r,contents:i,colIndex:a,rowIndex:o})=>{let[s,c,l,u,d,f,p,m,h]=zl(iT,cT,aT,fT,pT,mT,dT,Bw,UT),[g]=L.useState(()=>{let e=nh({nodes:l,theme:Rw,namespace:`TableCellEditor`});return e.update(()=>{Dw({root:Nh(),mdastRoot:{type:`root`,children:[{type:`paragraph`,children:i}]},visitors:s,jsxComponentDescriptors:u,directiveDescriptors:d,codeBlockEditorDescriptors:f})}),e}),_=L.useCallback(e=>{g.getEditorState().read(()=>{let e=Yx({root:Nh(),jsxComponentDescriptors:u,visitors:c,jsxIsAvailable:p});n.update(()=>{r.updateCellContents(a,o,e.children[0].children)},{discrete:!0}),n.dispatchCommand(zw,void 0)}),t(e)},[a,g,c,u,p,r,n,o,t]);return L.useEffect(()=>z_(g.registerCommand(hf,e=>(e.preventDefault(),_(e.shiftKey?[a-1,o]:[a+1,o]),!0),4),g.registerCommand(jf,()=>(t([a,o]),!1),1),g.registerCommand(uf,e=>(e?.preventDefault(),_(e?.shiftKey?[a,o-1]:[a,o+1]),!0),4),g.registerCommand(Mf,e=>{let t=e.relatedTarget;return zM(t,m.getRootElement())?!1:(_(null),!0)},0),g.registerCommand(zw,()=>(_(null),!0),0)),[a,g,m,o,_,t]),L.useEffect(()=>{e&&g.focus()},[e,g]),L.createElement(qie,{initialEditor:g},L.createElement(dE,{contentEditable:L.createElement(aE,null),placeholder:L.createElement(`div`,null),ErrorBoundary:cE}),h.map((e,t)=>L.createElement(e,{key:t})),L.createElement(tv,null))},$oe=({parentEditor:e,highlightedCoordinates:t,align:n,lexicalTable:r,colIndex:i,setActiveCellWithBoundaries:a})=>{let[o,s]=zl(hT,jT),c=L.useCallback(t=>{e.update(()=>{r.insertColumnAt(t)}),a([t,0])},[e,r,a]),l=L.useCallback(t=>{e.update(()=>{r.deleteColumnAt(t)})},[e,r]),u=L.useCallback((t,n)=>{e.update(()=>{r.setColumnAlign(t,n)})},[e,r]),d=tE();return L.createElement(qj,null,L.createElement(Rj,{className:fE.tableColumnEditorTrigger,"data-active":t[0]===i+1,title:d(`table.columnMenu`,`Column menu`)},s(`more_horiz`)),L.createElement(Jj,{container:o?.current},L.createElement(Hj,{className:(0,tD.default)(fE.tableColumnEditorPopoverContent),onOpenAutoFocus:e=>{e.preventDefault()},sideOffset:5,side:`top`},L.createElement(FM,{className:fE.tableColumnEditorToolbar},L.createElement(LM,{className:fE.toggleGroupRoot,onValueChange:e=>{u(i,e)},value:n??`left`,type:`single`,"aria-label":d(`table.textAlignment`,`Text alignment`)},L.createElement(RM,{value:`left`,title:d(`table.alignLeft`,`Align left`)},s(`format_align_left`)),L.createElement(RM,{value:`center`,title:d(`table.alignCenter`,`Align center`)},s(`format_align_center`)),L.createElement(RM,{value:`right`,title:d(`table.alignRight`,`Align right`)},s(`format_align_right`))),L.createElement(Joe,null),L.createElement(IM,{onClick:c.bind(null,i),title:d(`table.insertColumnLeft`,`Insert a column to the left of this one`)},s(`insert_col_left`)),L.createElement(IM,{onClick:c.bind(null,i+1),title:d(`table.insertColumnRight`,`Insert a column to the right of this one`)},s(`insert_col_right`)),L.createElement(IM,{onClick:l.bind(null,i),title:d(`table.deleteColumn`,`Delete this column`)},s(`delete_small`))),L.createElement(Yj,{className:fE.popoverArrow}))))},HM=({parentEditor:e,highlightedCoordinates:t,lexicalTable:n,rowIndex:r,setActiveCellWithBoundaries:i})=>{let[a,o]=zl(hT,jT),s=L.useCallback(t=>{e.update(()=>{n.insertRowAt(t)}),i([0,t])},[e,n,i]),c=L.useCallback(t=>{e.update(()=>{n.deleteRowAt(t)})},[e,n]),l=tE();return L.createElement(qj,null,L.createElement(Rj,{className:fE.tableColumnEditorTrigger,"data-active":t[1]===r,title:l(`table.rowMenu`,`Row menu`)},o(`more_horiz`)),L.createElement(Jj,{container:a?.current},L.createElement(Hj,{className:(0,tD.default)(fE.tableColumnEditorPopoverContent),onOpenAutoFocus:e=>{e.preventDefault()},sideOffset:5,side:`bottom`},L.createElement(FM,{className:fE.tableColumnEditorToolbar},L.createElement(IM,{onClick:s.bind(null,r),title:l(`table.insertRowAbove`,`Insert a row above this one`)},o(`insert_row_above`)),L.createElement(IM,{onClick:s.bind(null,r+1),title:l(`table.insertRowBelow`,`Insert a row below this one`)},o(`insert_row_below`)),L.createElement(IM,{onClick:c.bind(null,r),title:l(`table.deleteRow`,`Delete this row`)},o(`delete_small`))),L.createElement(Yj,{className:fE.popoverArrow}))))},UM=Object.defineProperty,WM=(e,t,n)=>t in e?UM(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,GM=(e,t,n)=>(WM(e,typeof t==`symbol`?t:t+``,n),n),KM={type:`tableCell`,children:[]};function qM(){let e=Kl;return{publish:t=>{e(t)},subscribe:t=>{e=t}}}var JM=class e extends Vm{constructor(e,t){super(t),GM(this,`__mdastNode`),GM(this,`focusEmitter`,qM()),this.__mdastNode=e??{type:`table`,children:[]}}static getType(){return`table`}static clone(t){return new e(structuredClone(t.__mdastNode),t.__key)}static importJSON(e){return XM(e.mdastNode)}static importDOM(){return{table:()=>({conversion:ZM,priority:3})}}exportJSON(){return{mdastNode:structuredClone(this.__mdastNode),type:`table`,version:1}}getMdastNode(){return this.__mdastNode}getRowCount(){return this.__mdastNode.children.length}getColCount(){return this.__mdastNode.children[0]?.children.length||0}createDOM(){return document.createElement(`div`)}updateDOM(){return!1}updateCellContents(e,t,n){let r=this.getWritable().__mdastNode,i=r.children[t],a=i.children,o=a[e],s=Array.from(a),c={...o,children:n},l={...i,children:s};s[e]=c,r.children[t]=l}insertColumnAt(e){let t=this.getWritable().__mdastNode;for(let n=0;n<t.children.length;n++){let r=t.children[n],i=r.children,a=Array.from(i),o={...r,children:a};a.splice(e,0,structuredClone(KM)),t.children[n]=o}t.align&&t.align.length>0&&t.align.splice(e,0,`left`)}deleteColumnAt(e){let t=this.getWritable().__mdastNode;for(let n=0;n<t.children.length;n++){let r=t.children[n],i=r.children,a=Array.from(i),o={...r,children:a};a.splice(e,1),t.children[n]=o}}insertRowAt(e){let t=this.getWritable().__mdastNode,n={type:`tableRow`,children:Array.from({length:this.getColCount()},()=>structuredClone(KM))};t.children.splice(e,0,n)}deleteRowAt(e){this.getRowCount()===1?(this.selectNext(),this.remove()):this.getWritable().__mdastNode.children.splice(e,1)}addRowToBottom(){this.insertRowAt(this.getRowCount())}addColumnToRight(){this.insertColumnAt(this.getColCount())}setColumnAlign(e,t){let n=this.getWritable().__mdastNode;n.align??=[],n.align[e]=t}decorate(e){return L.createElement(Xoe,{lexicalTable:this,mdastNode:this.__mdastNode,parentEditor:e})}select(e){this.focusEmitter.publish(e??[0,0])}isInline(){return!1}};function YM(e){return e instanceof JM}function XM(e){return new JM(e)}function ZM(e){let t=e.querySelectorAll(`tr`);return{node:new JM({type:`table`,children:Array.from(t).map(e=>({type:`tableRow`,children:Array.from(e.querySelectorAll(`td, th`)).map(e=>({type:`tableCell`,children:[{type:`text`,value:e.textContent}]}))}))})}}var QM={testLexicalNode:YM,visitLexicalNode({actions:e,mdastParent:t,lexicalNode:n}){e.appendToParent(t,n.getMdastNode())}},$M={testNode:`table`,visitNode({mdastNode:e,lexicalParent:t}){t.append(XM(e))}};function eN(e=1,t=1){let n={type:`table`,children:[]};for(let r=0;r<e;r++){let e={type:`tableRow`,children:[]};for(let n=0;n<t;n++)e.children.push({type:`tableCell`,children:[]});n.children.push(e)}return n}var tN=Pl(e=>{e.link(e.pipe(tN,Vl(({rows:e,columns:t})=>()=>XM(eN(e,t)))),JT)}),nN=ql({init(e,t){e.pubIn({[bT]:SD(),[yT]:ED(),[vT]:$M,[_T]:JM,[xT]:QM,[ST]:TD({tableCellPadding:t?.tableCellPadding??!0,tablePipeAlign:t?.tablePipeAlign??!0})})}}),rN={testNode:`link`,visitNode({mdastNode:e,actions:t}){t.addAndStepInto(mE(e.url,{title:e.title}))}},iN={testLexicalNode:hE,visitLexicalNode:({lexicalNode:e,actions:t})=>{t.addAndStepInto(`link`,{url:e.getURL(),title:e.getTitle()})}};function aN({validateUrl:e,attributes:t}){let[n]=Zl();return(0,L.useEffect)((()=>{if(!n.hasNodes([pE]))throw Error(`LinkPlugin: LinkNode not registered on editor`);return z_(n.registerCommand(yE,(n=>{if(n===null)return xE(n),!0;if(typeof n==`string`)return!(e!==void 0&&!e(n))&&(xE(n,t),!0);{let{url:e,target:r,rel:i,title:a}=n;return xE(e,{...t,rel:i,target:r,title:a}),!0}}),1),e===void 0?()=>{}:n.registerCommand(Yd,(r=>{let i=W();if(!U(i)||i.isCollapsed()||!K_(r,ClipboardEvent)||r.clipboardData===null)return!1;let a=r.clipboardData.getData(`text`);return!!e(a)&&!i.getNodes().some((e=>G(e)))&&(n.dispatchCommand(yE,{...t,url:a}),r.preventDefault(),!0)}),1))}),[n,e,t]),null}function oN(e,t=(e=>e)){return n=>{let r=e.exec(n);return r===null?null:{index:r.index,length:r[0].length,text:r[0],url:t(r[0])}}}function sN(e,t){for(let n=0;n<t.length;n++){let r=t[n](e);if(r)return r}return null}var cN=/[.,;\s]/;function lN(e){return cN.test(e)}function uN(e){return lN(e[e.length-1])}function dN(e){return lN(e[0])}function fN(e){let t=e.getPreviousSibling();return G(t)&&(t=t.getLastDescendant()),t===null||hp(t)||H(t)&&uN(t.getTextContent())}function pN(e){let t=e.getNextSibling();return G(t)&&(t=t.getFirstDescendant()),t===null||hp(t)||H(t)&&dN(t.getTextContent())}function mN(e,t,n,r){return(e>0?lN(n[e-1]):fN(r[0]))?t<n.length?lN(n[t]):pN(r[r.length-1]):!1}function hN(e,t,n){let r=[],i=[],a=[],o=0,s=0,c=[...e];for(;c.length>0;){let e=c[0],l=e.getTextContent().length,u=s;s+l<=t?(r.push(e),o+=l):u>=n?a.push(e):i.push(e),s+=l,c.shift()}return[o,r,i,a]}function gN(e,t,n,r){let i=_E(r.url,r.attributes);if(e.length===1){let a,o=e[0];t===0?[a,o]=o.splitText(n):[,a,o]=o.splitText(t,n);let s=Mp(r.text);return s.setFormat(a.getFormat()),s.setDetail(a.getDetail()),s.setStyle(a.getStyle()),i.append(s),a.replace(i),o}if(e.length>1){let r=e[0],a,o=r.getTextContent().length;t===0?a=r:[,a]=r.splitText(t);let s=[],c;for(let t=1;t<e.length;t++){let r=e[t],i=r.getTextContent().length,a=o;if(a<n)if(o+i<=n)s.push(r);else{let[e,t]=r.splitText(n-a);s.push(e),c=t}o+=i}let l=W(),u=l?l.getNodes().find(H):void 0,d=Mp(a.getTextContent());return d.setFormat(a.getFormat()),d.setDetail(a.getDetail()),d.setStyle(a.getStyle()),i.append(d,...s),u&&u===a&&(U(l)?d.select(l.anchor.offset,l.focus.offset):Up(l)&&d.select(0,d.getTextContent().length)),a.replace(i),c}}function _N(e,t,n){let r=e.getChildren(),i=r.length;for(let t=0;t<i;t++){let i=r[t];if(!H(i)||!i.isSimpleText())return vN(e),void n(null,e.getURL())}let a=e.getTextContent(),o=sN(a,t);if(o===null||o.text!==a||!fN(e)||!pN(e))return vN(e),void n(null,e.getURL());let s=e.getURL();if(s!==o.url&&(e.setURL(o.url),n(o.url,s)),o.attributes){let t=e.getRel();t!==o.attributes.rel&&(e.setRel(o.attributes.rel||null),n(o.attributes.rel||null,t));let r=e.getTarget();r!==o.attributes.target&&(e.setTarget(o.attributes.target||null),n(o.attributes.target||null,r))}}function vN(e){let t=e.getChildren();for(let n=t.length-1;n>=0;n--)e.insertAfter(t[n]);return e.remove(),t.map((e=>e.getLatest()))}function yN(e,t,n){(0,L.useEffect)((()=>{e.hasNodes([gE])||function(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(77);let r=(e,t)=>{n&&n(e,t)};return z_(e.registerNodeTransform(Cp,(e=>{let n=e.getParentOrThrow(),i=e.getPreviousSibling();vE(n)&&!n.getIsUnlinked()?_N(n,t,r):hE(n)||(e.isSimpleText()&&(dN(e.getTextContent())||!vE(i))&&(function(e,t,n){let r=[...e],i=r.map((e=>e.getTextContent())).join(``),a,o=i,s=0;for(;(a=sN(o,t))&&a!==null;){let e=a.index,t=e+a.length;if(mN(s+e,s+t,i,r)){let[i,,o,c]=hN(r,s+e,s+t),l=gN(o,s+e-i,s+t-i,a);r=l?[l,...c]:c,n(a.url,null),s=0}else s+=t;o=o.substring(t)}})(function(e){let t=[e],n=e.getNextSibling();for(;n!==null&&H(n)&&n.isSimpleText()&&(t.push(n),!/[\s]/.test(n.getTextContent()));)n=n.getNextSibling();return t}(e),t,r),(function(e,t,n){let r=e.getPreviousSibling(),i=e.getNextSibling(),a=e.getTextContent();var o;!vE(r)||r.getIsUnlinked()||dN(a)&&(o=a,!(r.isEmailURI()?/^\.[a-zA-Z]{2,}/.test(o):/^\.[a-zA-Z0-9]{1,}/.test(o)))||(r.append(e),_N(r,t,n),n(null,r.getURL())),!vE(i)||i.getIsUnlinked()||uN(a)||(vN(i),_N(i,t,n),n(null,i.getURL()))})(e,t,r))})),e.registerCommand(yE,(e=>{let t=W();return e!==null||!U(t)||t.extract().forEach((e=>{let t=e.getParent();vE(t)&&(t.setIsUnlinked(!t.getIsUnlinked()),t.markDirty())})),!1}),1))}),[e,t,n])}function bN({matchers:e,onChange:t}){let[n]=Zl();return yN(n,e,t),null}var xN=[oN(/((https?:\/\/(www\.)?)|(www\.))[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/,e=>e.startsWith(`http`)?e:`https://${e}`),oN(/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))/,e=>`mailto:${e}`)],SN=()=>L.createElement(bN,{matchers:xN}),CN=Nl(!1),wN=ql({init(e,t){let n=!!t?.disableAutoLink,r=t?.validateUrl?{validateUrl:t.validateUrl}:{},i=()=>L.createElement(L.Fragment,null,L.createElement(aN,{...r}),n?null:L.createElement(SN,null));e.pubIn({[QT]:`link`,[vT]:rN,[_T]:[pE,gE],[xT]:iN,[CN]:n,[HT]:i,[WT]:i,[RT]:i})}}),TN=e=>e.type===`checkbox`,EN=e=>e instanceof Date,DN=e=>e==null,ON=e=>typeof e==`object`,kN=e=>!DN(e)&&!Array.isArray(e)&&ON(e)&&!EN(e),AN=e=>kN(e)&&e.target?TN(e.target)?e.target.checked:e.target.value:e,jN=(e,t)=>t.split(`.`).some((t,n,r)=>!isNaN(Number(t))&&e.has(r.slice(0,n).join(`.`))),MN=e=>{let t=e.constructor&&e.constructor.prototype;return kN(t)&&t.hasOwnProperty(`isPrototypeOf`)},NN=typeof window<`u`&&window.HTMLElement!==void 0&&typeof document<`u`;function PN(e){if(e instanceof Date)return new Date(e);let t=typeof FileList<`u`&&e instanceof FileList;if(NN&&(e instanceof Blob||t))return e;let n=Array.isArray(e);if(!n&&!(kN(e)&&MN(e)))return e;let r=n?[]:Object.create(Object.getPrototypeOf(e));for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&(r[t]=PN(e[t]));return r}var FN=e=>/^\w*$/.test(e),IN=e=>e===void 0,LN=e=>Array.isArray(e)?e.filter(Boolean):[],RN=e=>LN(e.replace(/["|']|\]/g,``).split(/\.|\[/)),K=(e,t,n)=>{if(!t||!kN(e))return n;let r=(FN(t)?[t]:RN(t)).reduce((e,t)=>DN(e)?void 0:e[t],e);return IN(r)||r===e?IN(e[t])?n:e[t]:r},zN=e=>typeof e==`boolean`,BN=e=>typeof e==`function`,VN=(e,t,n)=>{let r=-1,i=FN(t)?[t]:RN(t),a=i.length,o=a-1;for(;++r<a;){let t=i[r],a=n;if(r!==o){let n=e[t];a=kN(n)||Array.isArray(n)?n:isNaN(+i[r+1])?{}:[]}if(t===`__proto__`||t===`constructor`||t===`prototype`)return;e[t]=a,e=e[t]}},HN={BLUR:`blur`,FOCUS_OUT:`focusout`,CHANGE:`change`,SUBMIT:`submit`,TRIGGER:`trigger`,VALID:`valid`},UN={onBlur:`onBlur`,onChange:`onChange`,onSubmit:`onSubmit`,onTouched:`onTouched`,all:`all`},WN={max:`max`,min:`min`,maxLength:`maxLength`,minLength:`minLength`,pattern:`pattern`,required:`required`,validate:`validate`},GN=`form`,KN=`root`,qN=L.createContext(null);qN.displayName=`HookFormControlContext`;var JN=()=>L.useContext(qN),YN=(e,t,n,r=!0)=>{let i={defaultValues:t._defaultValues};for(let a in e)Object.defineProperty(i,a,{get:()=>{let i=a;return t._proxyFormState[i]!==UN.all&&(t._proxyFormState[i]=!r||UN.all),n&&(n[i]=!0),e[i]}});return i},XN=typeof window<`u`?L.useLayoutEffect:L.useEffect;function ZN(e){let t=JN(),{control:n=t,disabled:r,name:i,exact:a}=e||{},[o,s]=L.useState(n._formState),c=L.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return XN(()=>n._subscribe({name:i,formState:c.current,exact:a,callback:e=>{!r&&s({...n._formState,...e})}}),[i,r,a]),L.useEffect(()=>{c.current.isValid&&n._setValid(!0)},[n]),L.useMemo(()=>YN(o,n,c.current,!1),[o,n])}var QN=e=>typeof e==`string`,$N=(e,t,n,r,i)=>QN(e)?(r&&t.watch.add(e),K(n,e,i)):Array.isArray(e)?e.map(e=>(r&&t.watch.add(e),K(n,e))):(r&&(t.watchAll=!0),n),eP=e=>DN(e)||!ON(e);function tP(e,t,n=new WeakSet){if(e===t)return!0;if(eP(e)||eP(t))return Object.is(e,t);if(EN(e)&&EN(t))return Object.is(e.getTime(),t.getTime());let r=Object.keys(e),i=Object.keys(t);if(r.length!==i.length)return!1;if(n.has(e)||n.has(t))return!0;n.add(e),n.add(t);for(let i of r){let r=e[i];if(!(i in t))return!1;if(i!==`ref`){let e=t[i];if(EN(r)&&EN(e)||(kN(r)||Array.isArray(r))&&(kN(e)||Array.isArray(e))?!tP(r,e,n):!Object.is(r,e))return!1}}return!0}function nP(e){let t=JN(),{control:n=t,name:r,defaultValue:i,disabled:a,exact:o,compute:s}=e||{},c=L.useRef(i),l=L.useRef(s),u=L.useRef(void 0),d=L.useRef(n),f=L.useRef(r);l.current=s;let[p,m]=L.useState(()=>{let e=n._getWatch(r,c.current);return l.current?l.current(e):e}),h=L.useCallback(e=>{let t=$N(r,n._names,e||n._formValues,!1,c.current);return l.current?l.current(t):t},[n._formValues,n._names,r]),g=L.useCallback(e=>{if(!a){let t=$N(r,n._names,e||n._formValues,!1,c.current);if(l.current){let e=l.current(t);tP(e,u.current)||(m(e),u.current=e)}else m(t)}},[n._formValues,n._names,a,r]);XN(()=>((d.current!==n||!tP(f.current,r))&&(d.current=n,f.current=r,g()),n._subscribe({name:r,formState:{values:!0},exact:o,callback:e=>{g(e.values)}})),[n,o,r,g]),L.useEffect(()=>n._removeUnmounted());let _=d.current!==n,v=f.current,y=L.useMemo(()=>{if(a)return null;let e=!_&&!tP(v,r);return _||e?h():null},[a,_,r,v,h]);return y===null?p:y}function rP(e){let t=JN(),{name:n,disabled:r,control:i=t,shouldUnregister:a,defaultValue:o,exact:s=!0}=e,c=jN(i._names.array,n),l=nP({control:i,name:n,defaultValue:L.useMemo(()=>K(i._formValues,n,K(i._defaultValues,n,o)),[i,n,o]),exact:s}),u=ZN({control:i,name:n,exact:s}),d=L.useRef(e),f=L.useRef(i.register(n,{...e.rules,value:l,...zN(e.disabled)?{disabled:e.disabled}:{}}));d.current=e;let p=L.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!K(u.errors,n)},isDirty:{enumerable:!0,get:()=>!!K(u.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!K(u.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!K(u.validatingFields,n)},error:{enumerable:!0,get:()=>K(u.errors,n)}}),[u,n]),m=L.useCallback(e=>f.current.onChange({target:{value:AN(e),name:n},type:HN.CHANGE}),[n]),h=L.useCallback(()=>f.current.onBlur({target:{value:K(i._formValues,n),name:n},type:HN.BLUR}),[n,i._formValues]),g=L.useCallback(e=>{let t=K(i._fields,n);t&&t._f&&e&&(t._f.ref={focus:()=>BN(e.focus)&&e.focus(),select:()=>BN(e.select)&&e.select(),setCustomValidity:t=>BN(e.setCustomValidity)&&e.setCustomValidity(t),reportValidity:()=>BN(e.reportValidity)&&e.reportValidity()})},[i._fields,n]),_=L.useMemo(()=>({name:n,value:l,...zN(r)||u.disabled?{disabled:u.disabled||r}:{},onChange:m,onBlur:h,ref:g}),[n,r,u.disabled,m,h,g,l]);return L.useEffect(()=>{let e=i._options.shouldUnregister||a;i.register(n,{...d.current.rules,...zN(d.current.disabled)?{disabled:d.current.disabled}:{}});let t=(e,t)=>{let n=K(i._fields,e);n&&n._f&&(n._f.mount=t)};if(t(n,!0),e){let e=PN(K(i._options.defaultValues,n,d.current.defaultValue));VN(i._defaultValues,n,e),IN(K(i._formValues,n))&&VN(i._formValues,n,e)}return!c&&i.register(n),()=>{(c?e&&!i._state.action:e)?i.unregister(n):t(n,!1)}},[n,i,c,a]),L.useEffect(()=>{i._setDisabledField({disabled:r,name:n})},[r,n,i]),L.useMemo(()=>({field:_,formState:u,fieldState:p}),[_,u,p])}var iP=e=>e.render(rP(e)),aP=L.createContext(null);aP.displayName=`HookFormContext`;var oP=(e,t,n,r,i)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:i||!0}}:{},sP=e=>Array.isArray(e)?e:[e],cP=()=>{let e=[];return{get observers(){return e},next:t=>{for(let n of e)n.next&&n.next(t)},subscribe:t=>(e.push(t),{unsubscribe:()=>{e=e.filter(e=>e!==t)}}),unsubscribe:()=>{e=[]}}};function lP(e,t){let n={};for(let r in e)if(e.hasOwnProperty(r)){let i=e[r],a=t[r];if(i&&kN(i)&&a){let e=lP(i,a);kN(e)&&(n[r]=e)}else e[r]&&(n[r]=a)}return n}var uP=e=>kN(e)&&!Object.keys(e).length,dP=e=>e.type===`file`,fP=e=>{if(!NN)return!1;let t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},pP=e=>e.type===`select-multiple`,mP=e=>e.type===`radio`,hP=e=>mP(e)||TN(e),gP=e=>fP(e)&&e.isConnected;function _P(e,t){let n=t.slice(0,-1).length,r=0;for(;r<n;){if(DN(e)){e=void 0;break}e=e[t[r]],r++}return e}function vP(e){for(let t in e)if(e.hasOwnProperty(t)&&!IN(e[t]))return!1;return!0}function yP(e,t){if(QN(t)&&Object.prototype.hasOwnProperty.call(e,t))return delete e[t],e;let n=Array.isArray(t)?t:FN(t)?[t]:RN(t),r=n.length===1?e:_P(e,n),i=n.length-1,a=n[i];return r&&delete r[a],i!==0&&(kN(r)&&uP(r)||Array.isArray(r)&&vP(r))&&yP(e,n.slice(0,-1)),e}var bP=e=>{for(let t in e)if(BN(e[t]))return!0;return!1};function xP(e){return Array.isArray(e)||kN(e)&&!bP(e)}function SP(e,t={}){for(let n in e){let r=e[n];xP(r)?(t[n]=Array.isArray(r)?[]:{},SP(r,t[n])):IN(r)||(t[n]=!0)}return t}function CP(e,t,n){n||=SP(t);for(let r in e){let i=e[r];if(xP(i))IN(t)||eP(n[r])?n[r]=SP(i,Array.isArray(i)?[]:{}):CP(i,DN(t)?{}:t[r],n[r]);else{let e=t[r];n[r]=!tP(i,e)}}return n}var wP={value:!1,isValid:!1},TP={value:!0,isValid:!0},EP=e=>{if(Array.isArray(e)){if(e.length>1){let t=e.filter(e=>e&&e.checked&&!e.disabled).map(e=>e.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!IN(e[0].attributes.value)?IN(e[0].value)||e[0].value===``?TP:{value:e[0].value,isValid:!0}:TP:wP}return wP},DP=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>IN(e)?e:t?e===``?NaN:e&&+e:n&&QN(e)?new Date(e):r?r(e):e,OP={isValid:!1,value:null},kP=e=>Array.isArray(e)?e.reduce((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e,OP):OP;function AP(e){let t=e.ref;return dP(t)?t.files:mP(t)?kP(e.refs).value:pP(t)?[...t.selectedOptions].map(({value:e})=>e):TN(t)?EP(e.refs).value:DP(IN(t.value)?e.ref.value:t.value,e)}var jP=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,MP=(e,t,n,r)=>{let i={};for(let n of e){let e=K(t,n);e&&VN(i,n,e._f)}return{criteriaMode:n,names:[...e],fields:i,shouldUseNativeValidation:r}},NP=e=>e instanceof RegExp,PP=e=>IN(e)?e:NP(e)?e.source:kN(e)?NP(e.value)?e.value.source:e.value:e,FP=e=>({isOnSubmit:!e||e===UN.onSubmit,isOnBlur:e===UN.onBlur,isOnChange:e===UN.onChange,isOnAll:e===UN.all,isOnTouch:e===UN.onTouched}),IP=`AsyncFunction`,LP=e=>!!e&&!!e.validate&&!!(BN(e.validate)&&e.validate.constructor.name===IP||kN(e.validate)&&Object.values(e.validate).find(e=>e.constructor.name===IP)),RP=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),zP=(e,t,n)=>!n&&(t.watchAll||t.watch.has(e)||[...t.watch].some(t=>e.startsWith(t)&&/^\.\w+/.test(e.slice(t.length)))),BP=(e,t,n,r)=>{for(let i of n||Object.keys(e)){let n=K(e,i);if(n){let{_f:e,...a}=n;if(e){if(e.refs&&e.refs[0]&&t(e.refs[0],i)&&!r||e.ref&&t(e.ref,e.name)&&!r)return!0;if(BP(a,t))break}else if(kN(a)&&BP(a,t))break}}};function VP(e,t,n){let r=K(e,n);if(r||FN(n))return{error:r,name:n};let i=n.split(`.`);for(;i.length;){let r=i.join(`.`),a=K(t,r),o=K(e,r);if(a&&!Array.isArray(a)&&n!==r)return{name:n};if(o&&o.type)return{name:r,error:o};if(o&&o.root&&o.root.type)return{name:`${r}.root`,error:o.root};i.pop()}return{name:n}}var HP=(e,t,n,r)=>{n(e);let{name:i,...a}=e;return uP(a)||Object.keys(a).length>=Object.keys(t).length||Object.keys(a).find(e=>t[e]===(!r||UN.all))},UP=(e,t,n)=>!e||!t||e===t||sP(e).some(e=>e&&(n?e===t:e.startsWith(t)||t.startsWith(e))),WP=(e,t,n,r,i)=>i.isOnAll?!1:!n&&i.isOnTouch?!(t||e):(n?r.isOnBlur:i.isOnBlur)?!e:(n?r.isOnChange:i.isOnChange)?e:!0,GP=(e,t)=>!LN(K(e,t)).length&&yP(e,t),KP=(e,t,n)=>{let r=sP(K(e,n));return VN(r,KN,t[n]),VN(e,n,r),e};function qP(e,t,n=`validate`){if(QN(e)||Array.isArray(e)&&e.every(QN)||zN(e)&&!e)return{type:n,message:QN(e)?e:``,ref:t}}var JP=e=>kN(e)&&!NP(e)?e:{value:e,message:``},YP=async(e,t,n,r,i,a)=>{let{ref:o,refs:s,required:c,maxLength:l,minLength:u,min:d,max:f,pattern:p,validate:m,name:h,valueAsNumber:g,mount:_}=e._f,v=K(n,h);if(!_||t.has(h))return{};let y=s?s[0]:o,b=e=>{i&&y.reportValidity&&(y.setCustomValidity(zN(e)?``:e||``),y.reportValidity())},x={},S=mP(o),C=TN(o),w=S||C,T=(g||dP(o))&&IN(o.value)&&IN(v)||fP(o)&&o.value===``||v===``||Array.isArray(v)&&!v.length||g&&typeof v==`number`&&isNaN(v),E=oP.bind(null,h,r,x),D=(e,t,n,r=WN.maxLength,i=WN.minLength)=>{let a=e?t:n;x[h]={type:e?r:i,message:a,ref:o,...E(e?r:i,a)}};if(a?!Array.isArray(v)||!v.length:c&&(!w&&(T||DN(v))||zN(v)&&!v||C&&!EP(s).isValid||S&&!kP(s).isValid)){let{value:e,message:t}=QN(c)?{value:!!c,message:c}:JP(c);if(e&&(x[h]={type:WN.required,message:t,ref:y,...E(WN.required,t)},!r))return b(t),x}if(!T&&(!DN(d)||!DN(f))){let e,t,n=JP(f),i=JP(d);if(!DN(v)&&!isNaN(v)){let r=o.valueAsNumber||v&&+v;DN(n.value)||(e=r>n.value),DN(i.value)||(t=r<i.value)}else{let r=o.valueAsDate||new Date(v),a=e=>new Date(new Date().toDateString()+` `+e),s=o.type==`time`,c=o.type==`week`;QN(n.value)&&v&&(e=s?a(v)>a(n.value):c?v>n.value:r>new Date(n.value)),QN(i.value)&&v&&(t=s?a(v)<a(i.value):c?v<i.value:r<new Date(i.value))}if((e||t)&&(D(!!e,n.message,i.message,WN.max,WN.min),!r))return b(x[h].message),x}if((l||u)&&!T&&(QN(v)||a&&Array.isArray(v))){let e=JP(l),t=JP(u),n=!DN(e.value)&&v.length>+e.value,i=!DN(t.value)&&v.length<+t.value;if((n||i)&&(D(n,e.message,t.message),!r))return b(x[h].message),x}if(p&&!T&&QN(v)){let{value:e,message:t}=JP(p);if(NP(e)&&!v.match(e)&&(x[h]={type:WN.pattern,message:t,ref:o,...E(WN.pattern,t)},!r))return b(t),x}if(m){if(BN(m)){let e=qP(await m(v,n),y);if(e&&(x[h]={...e,...E(WN.validate,e.message)},!r))return b(e.message),x}else if(kN(m)){let e={};for(let t in m){if(!uP(e)&&!r)break;let i=qP(await m[t](v,n),y,t);i&&(e={...i,...E(t,i.message)},b(i.message),r&&(x[h]=e))}if(!uP(e)&&(x[h]={ref:y,...e},!r))return x}}return b(!0),x},XP={mode:UN.onSubmit,reValidateMode:UN.onChange,shouldFocusError:!0};function ZP(e={}){let t={...XP,...e},n={submitCount:0,isDirty:!1,isReady:!1,isLoading:BN(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},r={},i=(kN(t.defaultValues)||kN(t.values))&&PN(t.defaultValues||t.values)||{},a=t.shouldUnregister?{}:PN(i),o={action:!1,mount:!1,watch:!1,keepIsValid:!1},s={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set,registerName:new Set},c,l=0,u={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},d={...u},f={...d},p={array:cP(),state:cP()},m=t.criteriaMode===UN.all,h=e=>t=>{clearTimeout(l),l=setTimeout(e,t)},g=async e=>{if(!o.keepIsValid&&!t.disabled&&(d.isValid||f.isValid||e)){let e;t.resolver?(e=uP((await T()).errors),_()):e=await O({fields:r,onlyCheckValid:!0,eventType:HN.VALID}),e!==n.isValid&&p.state.next({isValid:e})}},_=(e,r)=>{!t.disabled&&(d.isValidating||d.validatingFields||f.isValidating||f.validatingFields)&&((e||Array.from(s.mount)).forEach(e=>{e&&(r?VN(n.validatingFields,e,r):yP(n.validatingFields,e))}),p.state.next({validatingFields:n.validatingFields,isValidating:!uP(n.validatingFields)}))},v=e=>{let t=CP(i,a),r=jP(e);VN(n.dirtyFields,r,K(t,r))},y=(e,i=[],s,c,l=!0,u=!0)=>{if(c&&s&&!t.disabled){if(o.action=!0,u&&Array.isArray(K(r,e))){let t=s(K(r,e),c.argA,c.argB);l&&VN(r,e,t)}if(u&&Array.isArray(K(n.errors,e))){let t=s(K(n.errors,e),c.argA,c.argB);l&&VN(n.errors,e,t),GP(n.errors,e)}if((d.touchedFields||f.touchedFields)&&u&&Array.isArray(K(n.touchedFields,e))){let t=s(K(n.touchedFields,e),c.argA,c.argB);l&&VN(n.touchedFields,e,t)}(d.dirtyFields||f.dirtyFields)&&v(e),p.state.next({name:e,isDirty:A(e,i),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else VN(a,e,i)},b=(e,t)=>{VN(n.errors,e,t),p.state.next({errors:n.errors})},x=e=>{n.errors=e,p.state.next({errors:n.errors,isValid:!1})},S=(e,t,n,s)=>{let c=K(r,e);if(c){let r=K(a,e,IN(n)?K(i,e):n);IN(r)||s&&s.defaultChecked||t?VN(a,e,t?r:AP(c._f)):N(e,r),o.mount&&!o.action&&g()}},C=(e,r,a,o,s)=>{let c=!1,l=!1,u={name:e};if(!t.disabled){if(!a||o){(d.isDirty||f.isDirty)&&(l=n.isDirty,n.isDirty=u.isDirty=A(),c=l!==u.isDirty);let t=tP(K(i,e),r);l=!!K(n.dirtyFields,e),t?yP(n.dirtyFields,e):VN(n.dirtyFields,e,!0),u.dirtyFields=n.dirtyFields,c||=(d.dirtyFields||f.dirtyFields)&&l!==!t}if(a){let t=K(n.touchedFields,e);t||(VN(n.touchedFields,e,a),u.touchedFields=n.touchedFields,c||=(d.touchedFields||f.touchedFields)&&t!==a)}c&&s&&p.state.next(u)}return c?u:{}},w=(e,r,i,a)=>{let o=K(n.errors,e),s=(d.isValid||f.isValid)&&zN(r)&&n.isValid!==r;if(t.delayError&&i?(c=h(()=>b(e,i)),c(t.delayError)):(clearTimeout(l),c=null,i?VN(n.errors,e,i):yP(n.errors,e)),(i?!tP(o,i):o)||!uP(a)||s){let t={...a,...s&&zN(r)?{isValid:r}:{},errors:n.errors,name:e};n={...n,...t},p.state.next(t)}},T=async e=>(_(e,!0),await t.resolver(a,t.context,MP(e||s.mount,r,t.criteriaMode,t.shouldUseNativeValidation))),E=async e=>{let{errors:t}=await T(e);if(_(e),e)for(let r of e){let e=K(t,r);e?VN(n.errors,r,e):yP(n.errors,r)}else n.errors=t;return t},D=async({name:t,eventType:r})=>{if(e.validate){let i=await e.validate({formValues:a,formState:n,name:t,eventType:r});if(kN(i))for(let e in i)i[e]&&oe(`${GN}.${e}`,{message:QN(i.message)?i.message:``,type:WN.validate});else QN(i)||!i?oe(GN,{message:i||``,type:WN.validate}):ae(GN);return i}return!0},O=async({fields:r,onlyCheckValid:i,name:o,eventType:c,context:l={valid:!0,runRootValidation:!1}})=>{if(e.validate&&(l.runRootValidation=!0,!await D({name:o,eventType:c})&&(l.valid=!1,i)))return l.valid;for(let o in r){let u=r[o];if(u){let{_f:r,...f}=u;if(r){let o=s.array.has(r.name),c=u._f&&LP(u._f);c&&d.validatingFields&&_([r.name],!0);let f=await YP(u,s.disabled,a,m,t.shouldUseNativeValidation&&!i,o);if(c&&d.validatingFields&&_([r.name]),f[r.name]&&(l.valid=!1,i)||(!i&&(K(f,r.name)?o?KP(n.errors,f,r.name):VN(n.errors,r.name,f[r.name]):yP(n.errors,r.name)),e.shouldUseNativeValidation&&f[r.name]))break}!uP(f)&&await O({context:l,onlyCheckValid:i,fields:f,name:o,eventType:c})}}return l.valid},k=()=>{for(let e of s.unMount){let t=K(r,e);t&&(t._f.refs?t._f.refs.every(e=>!gP(e)):!gP(t._f.ref))&&ue(e)}s.unMount=new Set},A=(e,n)=>!t.disabled&&(e&&n&&VN(a,e,n),!tP(I(),i)),j=(e,t,n)=>$N(e,s,{...o.mount?a:IN(t)?i:QN(e)?{[e]:t}:t},n,t),M=e=>LN(K(o.mount?a:i,e,t.shouldUnregister?K(i,e,[]):[])),N=(e,t,n={})=>{let i=K(r,e),o=t;if(i){let n=i._f;n&&(!n.disabled&&VN(a,e,DP(t,n)),o=fP(n.ref)&&DN(t)?``:t,pP(n.ref)?[...n.ref.options].forEach(e=>e.selected=o.includes(e.value)):n.refs?TN(n.ref)?n.refs.forEach(e=>{(!e.defaultChecked||!e.disabled)&&(Array.isArray(o)?e.checked=!!o.find(t=>t===e.value):e.checked=o===e.value||!!o)}):n.refs.forEach(e=>e.checked=e.value===o):dP(n.ref)?n.ref.value=``:(n.ref.value=o,n.ref.type||p.state.next({name:e,values:PN(a)})))}(n.shouldDirty||n.shouldTouch)&&C(e,o,n.shouldTouch,n.shouldDirty,!0),n.shouldValidate&&re(e)},P=(e,t,n)=>{for(let i in t){if(!t.hasOwnProperty(i))return;let a=t[i],o=e+`.`+i,c=K(r,o);(s.array.has(e)||kN(a)||c&&!c._f)&&!EN(a)?P(o,a,n):N(o,a,n)}},ee=(e,t,i={})=>{let c=K(r,e),l=s.array.has(e),u=PN(t),d=tP(K(a,e),u);if(VN(a,e,u),l)p.array.next({name:e,values:PN(a)}),i.shouldDirty&&(v(e),p.state.next({name:e,dirtyFields:n.dirtyFields,isDirty:A(e,u)}));else{let t=Array.isArray(u)&&!u.length||uP(u);!c||c._f||DN(u)||t?N(e,u,i):P(e,u,i)}d||(zP(e,s)?p.state.next({...n,name:e,values:PN(a)}):p.state.next({name:o.mount?e:void 0,values:PN(a)}))},te=e=>{let t=BN(e)?e(a):e;tP(a,t)||(a={...a,...t},p.state.next({...n,values:a}))},ne=async i=>{o.mount=!0;let l=i.target,u=l.name,h=!0,v=K(r,u),y=e=>{h=Number.isNaN(e)||EN(e)&&isNaN(e.getTime())||tP(e,K(a,u,e))},b=FP(t.mode),x=FP(t.reValidateMode);if(v){let o,S,E=l.type?AP(v._f):AN(i),k=i.type===HN.BLUR||i.type===HN.FOCUS_OUT,A=!RP(v._f)&&!e.validate&&!t.resolver&&!K(n.errors,u)&&!v._f.deps||WP(k,K(n.touchedFields,u),n.isSubmitted,x,b),j=zP(u,s,k);VN(a,u,E),k?(!l||!l.readOnly)&&(v._f.onBlur&&v._f.onBlur(i),c&&c(0)):v._f.onChange&&v._f.onChange(i);let M=C(u,E,k),N=!uP(M)||j;if(!k&&p.state.next({name:u,type:i.type,values:PN(a)}),A)return(d.isValid||f.isValid)&&(t.mode===`onBlur`?k&&g():k||g()),N&&p.state.next({name:u,...j?{}:M});if(!t.resolver&&e.validate&&await D({name:u,eventType:i.type}),!k&&j&&p.state.next({...n}),t.resolver){let{errors:e}=await T([u]);if(_([u]),y(E),h){let t=VP(n.errors,r,u),i=VP(e,r,t.name||u);o=i.error,u=i.name,S=uP(e)}}else _([u],!0),o=(await YP(v,s.disabled,a,m,t.shouldUseNativeValidation))[u],_([u]),y(E),h&&(o?S=!1:(d.isValid||f.isValid)&&(S=await O({fields:r,onlyCheckValid:!0,name:u,eventType:i.type})));h&&(v._f.deps&&(!Array.isArray(v._f.deps)||v._f.deps.length>0)&&re(v._f.deps),w(u,S,o,M))}},F=(e,t)=>{if(K(n.errors,t)&&e.focus)return e.focus(),1},re=async(e,i={})=>{let a,o,c=sP(e);if(t.resolver){let t=await E(IN(e)?e:c);a=uP(t),o=e?!c.some(e=>K(t,e)):a}else e?(o=(await Promise.all(c.map(async e=>{let t=K(r,e);return await O({fields:t&&t._f?{[e]:t}:t,eventType:HN.TRIGGER})}))).every(Boolean),!(!o&&!n.isValid)&&g()):o=a=await O({fields:r,name:e,eventType:HN.TRIGGER});return p.state.next({...!QN(e)||(d.isValid||f.isValid)&&a!==n.isValid?{}:{name:e},...t.resolver||!e?{isValid:a}:{},errors:n.errors}),i.shouldFocus&&!o&&BP(r,F,e?c:s.mount),o},I=(e,t)=>{let r={...o.mount?a:i};return t&&(r=lP(t.dirtyFields?n.dirtyFields:n.touchedFields,r)),IN(e)?r:QN(e)?K(r,e):e.map(e=>K(r,e))},ie=(e,t)=>({invalid:!!K((t||n).errors,e),isDirty:!!K((t||n).dirtyFields,e),error:K((t||n).errors,e),isValidating:!!K(n.validatingFields,e),isTouched:!!K((t||n).touchedFields,e)}),ae=e=>{let t=e?sP(e):void 0;t?.forEach(e=>yP(n.errors,e)),t?t.forEach(e=>{p.state.next({name:e,errors:n.errors})}):p.state.next({errors:{}})},oe=(e,t,i)=>{let a=(K(r,e,{_f:{}})._f||{}).ref,{ref:o,message:s,type:c,...l}=K(n.errors,e)||{};VN(n.errors,e,{...l,...t,ref:a}),p.state.next({name:e,errors:n.errors,isValid:!1}),i&&i.shouldFocus&&a&&a.focus&&a.focus()},se=(e,t)=>BN(e)?p.state.subscribe({next:n=>`values`in n&&e(n.values||j(void 0,t),n)}):j(e,t,!0),ce=e=>p.state.subscribe({next:t=>{if(UP(e.name,t.name,e.exact)&&HP(t,e.formState||d,be,e.reRenderRoot)){let r={...a};e.callback({values:r,...n,...t,defaultValues:i})}}}).unsubscribe,le=e=>(o.mount=!0,f={...f,...e.formState},ce({...e,formState:{...u,...e.formState}})),ue=(e,o={})=>{for(let c of e?sP(e):s.mount)s.mount.delete(c),s.array.delete(c),o.keepValue||(yP(r,c),yP(a,c)),!o.keepError&&yP(n.errors,c),!o.keepDirty&&yP(n.dirtyFields,c),!o.keepTouched&&yP(n.touchedFields,c),!o.keepIsValidating&&yP(n.validatingFields,c),!t.shouldUnregister&&!o.keepDefaultValue&&yP(i,c);p.state.next({values:PN(a)}),p.state.next({...n,...o.keepDirty?{isDirty:A()}:{}}),!o.keepIsValid&&g()},de=({disabled:e,name:t})=>{if(zN(e)&&o.mount||e||s.disabled.has(t)){let n=s.disabled.has(t)!==!!e;e?s.disabled.add(t):s.disabled.delete(t),n&&o.mount&&!o.action&&g()}},fe=(e,n={})=>{let a=K(r,e),c=zN(n.disabled)||zN(t.disabled),l=!s.registerName.has(e)&&a&&a._f&&!a._f.mount;return VN(r,e,{...a||{},_f:{...a&&a._f?a._f:{ref:{name:e}},name:e,mount:!0,...n}}),s.mount.add(e),a&&!l?de({disabled:zN(n.disabled)?n.disabled:t.disabled,name:e}):S(e,!0,n.value),{...c?{disabled:n.disabled||t.disabled}:{},...t.progressive?{required:!!n.required,min:PP(n.min),max:PP(n.max),minLength:PP(n.minLength),maxLength:PP(n.maxLength),pattern:PP(n.pattern)}:{},name:e,onChange:ne,onBlur:ne,ref:c=>{if(c){s.registerName.add(e),fe(e,n),s.registerName.delete(e),a=K(r,e);let t=IN(c.value)&&c.querySelectorAll&&c.querySelectorAll(`input,select,textarea`)[0]||c,o=hP(t),l=a._f.refs||[];if(o?l.find(e=>e===t):t===a._f.ref)return;VN(r,e,{_f:{...a._f,...o?{refs:[...l.filter(gP),t,...Array.isArray(K(i,e))?[{}]:[]],ref:{type:t.type,name:e}}:{ref:t}}}),S(e,!1,void 0,t)}else a=K(r,e,{}),a._f&&(a._f.mount=!1),(t.shouldUnregister||n.shouldUnregister)&&!(jN(s.array,e)&&o.action)&&s.unMount.add(e)}}},pe=()=>t.shouldFocusError&&BP(r,F,s.mount),me=e=>{zN(e)&&(p.state.next({disabled:e}),BP(r,(t,n)=>{let i=K(r,n);i&&(t.disabled=i._f.disabled||e,Array.isArray(i._f.refs)&&i._f.refs.forEach(t=>{t.disabled=i._f.disabled||e}))},0,!1))},he=(e,i)=>async o=>{let c;o&&(o.preventDefault&&o.preventDefault(),o.persist&&o.persist());let l=PN(a);if(p.state.next({isSubmitting:!0}),t.resolver){let{errors:e,values:t}=await T();_(),n.errors=e,l=PN(t)}else await O({fields:r,eventType:HN.SUBMIT});if(s.disabled.size)for(let e of s.disabled)yP(l,e);if(yP(n.errors,KN),uP(n.errors)){p.state.next({errors:{}});try{await e(l,o)}catch(e){c=e}}else i&&await i({...n.errors},o),pe(),setTimeout(pe);if(p.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:uP(n.errors)&&!c,submitCount:n.submitCount+1,errors:n.errors}),c)throw c},ge=(e,t={})=>{K(r,e)&&(IN(t.defaultValue)?ee(e,PN(K(i,e))):(ee(e,t.defaultValue),VN(i,e,PN(t.defaultValue))),t.keepTouched||yP(n.touchedFields,e),t.keepDirty||(yP(n.dirtyFields,e),n.isDirty=t.defaultValue?A(e,PN(K(i,e))):A()),t.keepError||(yP(n.errors,e),d.isValid&&g()),p.state.next({...n}))},_e=(e,c={})=>{let l=e?PN(e):i,u=PN(l),f=uP(e),m=f?i:u;if(c.keepDefaultValues||(i=l),!c.keepValues){if(c.keepDirtyValues){let e=new Set([...s.mount,...Object.keys(CP(i,a))]);for(let t of Array.from(e)){let e=K(n.dirtyFields,t),r=K(a,t),i=K(m,t);e&&!IN(r)?VN(m,t,r):!e&&!IN(i)&&ee(t,i)}}else{if(NN&&IN(e))for(let e of s.mount){let t=K(r,e);if(t&&t._f){let e=Array.isArray(t._f.refs)?t._f.refs[0]:t._f.ref;if(fP(e)){let t=e.closest(`form`);if(t){t.reset();break}}}}if(c.keepFieldsRef)for(let e of s.mount)ee(e,K(m,e));else r={}}a=t.shouldUnregister?c.keepDefaultValues?PN(i):{}:PN(m),p.array.next({values:{...m}}),p.state.next({values:{...m}})}s={mount:c.keepDirtyValues?s.mount:new Set,unMount:new Set,array:new Set,registerName:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:``},o.mount=!d.isValid||!!c.keepIsValid||!!c.keepDirtyValues||!t.shouldUnregister&&!uP(m),o.watch=!!t.shouldUnregister,o.keepIsValid=!!c.keepIsValid,o.action=!1,c.keepErrors||(n.errors={}),p.state.next({submitCount:c.keepSubmitCount?n.submitCount:0,isDirty:f?!1:c.keepDirty?n.isDirty:!!(c.keepDefaultValues&&!tP(e,i)),isSubmitted:c.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:f?{}:c.keepDirtyValues?c.keepDefaultValues&&a?CP(i,a):n.dirtyFields:c.keepDefaultValues&&e?CP(i,e):c.keepDirty?n.dirtyFields:{},touchedFields:c.keepTouched?n.touchedFields:{},errors:c.keepErrors?n.errors:{},isSubmitSuccessful:c.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:i})},ve=(e,n)=>_e(BN(e)?e(a):e,{...t.resetOptions,...n}),ye=(e,t={})=>{let n=K(r,e),i=n&&n._f;if(i){let e=i.refs?i.refs[0]:i.ref;e.focus&&setTimeout(()=>{e.focus(),t.shouldSelect&&BN(e.select)&&e.select()})}},be=e=>{n={...n,...e}},xe={control:{register:fe,unregister:ue,getFieldState:ie,handleSubmit:he,setError:oe,_subscribe:ce,_runSchema:T,_updateIsValidating:_,_focusError:pe,_getWatch:j,_getDirty:A,_setValid:g,_setFieldArray:y,_setDisabledField:de,_setErrors:x,_getFieldArray:M,_reset:_e,_resetDefaultValues:()=>BN(t.defaultValues)&&t.defaultValues().then(e=>{ve(e,t.resetOptions),p.state.next({isLoading:!1})}),_removeUnmounted:k,_disableForm:me,_subjects:p,_proxyFormState:d,get _fields(){return r},get _formValues(){return a},get _state(){return o},set _state(e){o=e},get _defaultValues(){return i},get _names(){return s},set _names(e){s=e},get _formState(){return n},get _options(){return t},set _options(e){t={...t,...e}}},subscribe:le,trigger:re,register:fe,handleSubmit:he,watch:se,setValue:ee,setValues:te,getValues:I,reset:ve,resetField:ge,clearErrors:ae,unregister:ue,setError:oe,setFocus:ye,getFieldState:ie};return{...xe,formControl:xe}}function QP(e={}){let t=L.useRef(void 0),n=L.useRef(void 0),[r,i]=L.useState({isDirty:!1,isValidating:!1,isLoading:BN(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,isReady:!1,defaultValues:BN(e.defaultValues)?void 0:e.defaultValues});if(!t.current)if(e.formControl)t.current={...e.formControl,formState:r},e.defaultValues&&!BN(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{let{formControl:n,...i}=ZP(e);t.current={...i,formState:r}}let a=t.current.control;return a._options=e,XN(()=>{let e=a._subscribe({formState:a._proxyFormState,callback:()=>i({...a._formState}),reRenderRoot:!0});return i(e=>({...e,isReady:!0})),a._formState.isReady=!0,e},[a]),L.useEffect(()=>a._disableForm(e.disabled),[a,e.disabled]),L.useEffect(()=>{e.mode&&(a._options.mode=e.mode),e.reValidateMode&&(a._options.reValidateMode=e.reValidateMode)},[a,e.mode,e.reValidateMode]),L.useEffect(()=>{e.errors&&(a._setErrors(e.errors),a._focusError())},[a,e.errors]),L.useEffect(()=>{e.shouldUnregister&&a._subjects.state.next({values:a._getWatch()})},[a,e.shouldUnregister]),L.useEffect(()=>{if(a._proxyFormState.isDirty){let e=a._getDirty();e!==r.isDirty&&a._subjects.state.next({isDirty:e})}},[a,r.isDirty]),L.useEffect(()=>{e.values&&!tP(e.values,n.current)?(a._reset(e.values,{keepFieldsRef:!0,...a._options.resetOptions}),a._options.resetOptions?.keepIsValid||a._setValid(),n.current=e.values,i(e=>({...e}))):a._resetDefaultValues()},[a,e.values]),L.useEffect(()=>{a._state.mount||(a._setValid(),a._state.mount=!0),a._state.watch&&(a._state.watch=!1,a._subjects.state.next({...a._formState})),a._removeUnmounted()}),t.current.formState=L.useMemo(()=>YN(r,a),[a,r]),t.current}function $P(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function q(){return q=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},q.apply(null,arguments)}var eF=n(((e,t)=>{t.exports=`SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED`})),tF=n(((e,t)=>{var n=eF();function r(){}function i(){}i.resetWarningCache=r,t.exports=function(){function e(e,t,r,i,a,o){if(o!==n){var s=Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name=`Invariant Violation`,s}}e.isRequired=e;function t(){return e}var a={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:i,resetWarningCache:r};return a.PropTypes=a,a}})),nF=n(((e,t)=>{t.exports=tF()()})),rF=n((e=>{if(typeof Symbol==`function`&&Symbol.for){var t=Symbol.for;t(`react.element`),t(`react.portal`),t(`react.fragment`),t(`react.strict_mode`),t(`react.profiler`),t(`react.provider`),t(`react.context`),t(`react.forward_ref`),t(`react.suspense`),t(`react.suspense_list`),t(`react.memo`),t(`react.lazy`),t(`react.block`),t(`react.server.block`),t(`react.fundamental`),t(`react.debug_trace_mode`),t(`react.legacy_hidden`)}})),iF=n(((e,t)=>{t.exports=rF()})),aF=e=>typeof e==`object`&&!!e&&e.nodeType===1,oF=(e,t)=>(!t||e!==`hidden`)&&e!==`visible`&&e!==`clip`,sF=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){let n=getComputedStyle(e,null);return oF(n.overflowY,t)||oF(n.overflowX,t)||(e=>{let t=(e=>{if(!e.ownerDocument||!e.ownerDocument.defaultView)return null;try{return e.ownerDocument.defaultView.frameElement}catch{return null}})(e);return!!t&&(t.clientHeight<e.scrollHeight||t.clientWidth<e.scrollWidth)})(e)}return!1},cF=(e,t,n,r,i,a,o,s)=>a<e&&o>t||a>e&&o<t?0:a<=e&&s<=n||o>=t&&s>=n?a-e-r:o>t&&s<n||a<e&&s>n?o-t+i:0,lF=e=>e.parentElement??(e.getRootNode().host||null),uF=(e,t)=>{if(typeof document>`u`)return[];let{scrollMode:n,block:r,inline:i,boundary:a,skipOverflowHiddenElements:o}=t,s=typeof a==`function`?a:e=>e!==a;if(!aF(e))throw TypeError(`Invalid target`);let c=document.scrollingElement||document.documentElement,l=[],u=e;for(;aF(u)&&s(u);){if(u=lF(u),u===c){l.push(u);break}u!=null&&u===document.body&&sF(u)&&!sF(document.documentElement)||u!=null&&sF(u,o)&&l.push(u)}let d=window.visualViewport?.width??innerWidth,f=window.visualViewport?.height??innerHeight,p=window.scrollX??pageXOffset,m=window.scrollY??pageYOffset,{height:h,width:g,top:_,right:v,bottom:y,left:b}=e.getBoundingClientRect(),x=r===`start`||r===`nearest`?_:r===`end`?y:_+h/2,S=i===`center`?b+g/2:i===`end`?v:b,C=[];for(let e=0;e<l.length;e++){let t=l[e],{height:a,width:o,top:s,right:u,bottom:w,left:T}=t.getBoundingClientRect();if(n===`if-needed`&&_>=0&&b>=0&&y<=f&&v<=d&&_>=s&&y<=w&&b>=T&&v<=u)return C;let E=getComputedStyle(t),D=parseInt(E.borderLeftWidth,10),O=parseInt(E.borderTopWidth,10),k=parseInt(E.borderRightWidth,10),A=parseInt(E.borderBottomWidth,10),j=0,M=0,N=`offsetWidth`in t?t.offsetWidth-t.clientWidth-D-k:0,P=`offsetHeight`in t?t.offsetHeight-t.clientHeight-O-A:0,ee=`offsetWidth`in t?t.offsetWidth===0?0:o/t.offsetWidth:0,te=`offsetHeight`in t?t.offsetHeight===0?0:a/t.offsetHeight:0;if(c===t)j=r===`start`?x:r===`end`?x-f:r===`nearest`?cF(m,m+f,f,O,A,m+x,m+x+h,h):x-f/2,M=i===`start`?S:i===`center`?S-d/2:i===`end`?S-d:cF(p,p+d,d,D,k,p+S,p+S+g,g),j=Math.max(0,j+m),M=Math.max(0,M+p);else{j=r===`start`?x-s-O:r===`end`?x-w+A+P:r===`nearest`?cF(s,w,a,O,A+P,x,x+h,h):x-(s+a/2)+P/2,M=i===`start`?S-T-D:i===`center`?S-(T+o/2)+N/2:i===`end`?S-u+k+N:cF(T,u,o,D,k+N,S,S+g,g);let{scrollLeft:e,scrollTop:n}=t;j=Math.max(0,Math.min(n+j/te,t.scrollHeight-a/te+P)),M=Math.max(0,Math.min(e+M/ee,t.scrollWidth-o/ee+N)),x+=n-j,S+=e-M}C.push({el:t,top:j,left:M})}return C},J=t(nF());iF();var dF=0;function fF(){}function pF(e,t){e&&uF(e,{boundary:t,block:`nearest`,scrollMode:`if-needed`}).forEach(function(e){var t=e.el,n=e.top,r=e.left;t.scrollTop=n,t.scrollLeft=r})}function mF(e,t,n){return e===t||t instanceof n.Node&&e.contains&&e.contains(t)}function hF(e,t){var n;function r(){n&&clearTimeout(n)}function i(){var i=[...arguments];r(),n=setTimeout(function(){n=null,e.apply(void 0,i)},t)}return i.cancel=r,i}function gF(){var e=[...arguments];return function(t){var n=[...arguments].slice(1);return e.some(function(e){return e&&e.apply(void 0,[t].concat(n)),t.preventDownshiftDefault||t.hasOwnProperty(`nativeEvent`)&&t.nativeEvent.preventDownshiftDefault})}}function _F(){var e=[...arguments];return function(t){e.forEach(function(e){typeof e==`function`?e(t):e&&(e.current=t)})}}function vF(){return String(dF++)}function yF(e){var t=e.isOpen,n=e.resultCount,r=e.previousResultCount;return t?n?n===r?``:n+` result`+(n===1?` is`:`s are`)+` available, use up and down arrow keys to navigate. Press Enter key to select.`:`No results are available.`:``}function bF(e,t){return Object.keys(e).reduce(function(n,r){return n[r]=xF(t,r)?t[r]:e[r],n},{})}function xF(e,t){return e[t]!==void 0}function SF(e){var t=e.key,n=e.keyCode;return n>=37&&n<=40&&t.indexOf(`Arrow`)!==0?`Arrow`+t:t}function CF(e,t,n,r,i){if(i===void 0&&(i=!0),n===0)return-1;var a=n-1;(typeof t!=`number`||t<0||t>=n)&&(t=e>0?-1:a+1);var o=t+e;o<0?o=i?a:0:o>a&&(o=i?0:a);var s=wF(e,o,n,r,i);return s===-1?t>=n?-1:t:s}function wF(e,t,n,r,i){var a=r(t);if(!a||!a.hasAttribute(`disabled`))return t;if(e>0){for(var o=t+1;o<n;o++)if(!r(o).hasAttribute(`disabled`))return o}else for(var s=t-1;s>=0;s--)if(!r(s).hasAttribute(`disabled`))return s;return i?e>0?wF(1,0,n,r,!1):wF(-1,n-1,n,r,!1):-1}function TF(e,t,n,r){return r===void 0&&(r=!0),t.some(function(t){return t&&(mF(t,e,n)||r&&mF(t,n.document.activeElement,n))})}var EF=hF(function(e){OF(e).textContent=``},500);function DF(e,t){var n=OF(t);e&&(n.textContent=e,EF(t))}function OF(e){e===void 0&&(e=document);var t=e.getElementById(`a11y-status-message`);return t||(t=e.createElement(`div`),t.setAttribute(`id`,`a11y-status-message`),t.setAttribute(`role`,`status`),t.setAttribute(`aria-live`,`polite`),t.setAttribute(`aria-relevant`,`additions text`),Object.assign(t.style,{border:`0`,clip:`rect(0 0 0 0)`,height:`1px`,margin:`-1px`,overflow:`hidden`,padding:`0`,position:`absolute`,width:`1px`}),e.body.appendChild(t),t)}var kF=[`isInitialMount`,`highlightedIndex`,`items`,`environment`],AF={highlightedIndex:-1,isOpen:!1,selectedItem:null,inputValue:``};function jF(e,t,n){var r=e.props,i=e.type,a={};Object.keys(t).forEach(function(r){MF(r,e,t,n),n[r]!==t[r]&&(a[r]=n[r])}),r.onStateChange&&Object.keys(a).length&&r.onStateChange(q({type:i},a))}function MF(e,t,n,r){var i=t.props,a=t.type,o=`on`+VF(e)+`Change`;i[o]&&r[e]!==void 0&&r[e]!==n[e]&&i[o](q({type:a},r))}function NF(e,t){return t.changes}function PF(e){var t=e.selectedItem,n=e.itemToString;return t?n(t)+` has been selected.`:``}var FF=hF(function(e,t){DF(e(),t)},200),IF=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0?L.useLayoutEffect:L.useEffect;function LF(e){var t=e.id,n=t===void 0?`downshift-`+vF():t,r=e.labelId,i=e.menuId,a=e.getItemId,o=e.toggleButtonId,s=e.inputId;return(0,L.useRef)({labelId:r||n+`-label`,menuId:i||n+`-menu`,getItemId:a||function(e){return n+`-item-`+e},toggleButtonId:o||n+`-toggle-button`,inputId:s||n+`-input`}).current}function RF(e,t,n,r){var i,a;if(e===void 0){if(t===void 0)throw Error(r);i=n[t],a=t}else a=t===void 0?n.indexOf(e):t,i=e;return[i,a]}function zF(e){return e?String(e):``}function BF(e){return/^\S{1}$/.test(e)}function VF(e){return``+e.slice(0,1).toUpperCase()+e.slice(1)}function HF(e){var t=(0,L.useRef)(e);return t.current=e,t}function UF(e,t,n){var r=(0,L.useRef)(),i=(0,L.useRef)(),a=(0,L.useReducer)((0,L.useCallback)(function(t,n){i.current=n,t=bF(t,n.props);var r=e(t,n);return n.props.stateReducer(t,q({},n,{changes:r}))},[e]),t),o=a[0],s=a[1],c=HF(n),l=(0,L.useCallback)(function(e){return s(q({props:c.current},e))},[c]),u=i.current;return(0,L.useEffect)(function(){u&&r.current&&r.current!==o&&jF(u,bF(r.current,u.props),o),r.current=o},[o,n,u]),[o,l]}function WF(e,t,n){var r=UF(e,t,n),i=r[0],a=r[1];return[bF(i,n),a]}var GF={itemToString:zF,stateReducer:NF,getA11ySelectionMessage:PF,scrollIntoView:pF,environment:typeof window>`u`?{}:window};function KF(e,t,n){n===void 0&&(n=AF);var r=e[`default`+VF(t)];return r===void 0?n[t]:r}function qF(e,t,n){n===void 0&&(n=AF);var r=e[t];if(r!==void 0)return r;var i=e[`initial`+VF(t)];return i===void 0?KF(e,t,n):i}function JF(e){var t=qF(e,`selectedItem`),n=qF(e,`isOpen`),r=qF(e,`highlightedIndex`),i=qF(e,`inputValue`);return{highlightedIndex:r<0&&t&&n?e.items.indexOf(t):r,isOpen:n,selectedItem:t,inputValue:i}}function YF(e,t,n){var r=e.items,i=e.initialHighlightedIndex,a=e.defaultHighlightedIndex,o=t.selectedItem,s=t.highlightedIndex;return r.length===0?-1:i!==void 0&&s===i?i:a===void 0?o?r.indexOf(o):n===0?-1:n<0?r.length-1:0:a}function XF(e,t,n,r){var i=(0,L.useRef)({isMouseDown:!1,isTouchMove:!1});return(0,L.useEffect)(function(){if(n?.addEventListener!=null){var a=function(){i.current.isMouseDown=!0},o=function(a){i.current.isMouseDown=!1,e&&!TF(a.target,t.map(function(e){return e.current}),n)&&r()},s=function(){i.current.isTouchMove=!1},c=function(){i.current.isTouchMove=!0},l=function(a){e&&!i.current.isTouchMove&&!TF(a.target,t.map(function(e){return e.current}),n,!1)&&r()};return n.addEventListener(`mousedown`,a),n.addEventListener(`mouseup`,o),n.addEventListener(`touchstart`,s),n.addEventListener(`touchmove`,c),n.addEventListener(`touchend`,l),function(){n.removeEventListener(`mousedown`,a),n.removeEventListener(`mouseup`,o),n.removeEventListener(`touchstart`,s),n.removeEventListener(`touchmove`,c),n.removeEventListener(`touchend`,l)}}},[e,n]),i}var ZF=function(){return fF};function QF(e,t,n){var r=n.isInitialMount,i=n.highlightedIndex,a=n.items,o=n.environment,s=$P(n,kF);(0,L.useEffect)(function(){r||FF(function(){return e(q({highlightedIndex:i,highlightedItem:a[i],resultCount:a.length},s))},o.document)},t)}function $F(e){var t=e.highlightedIndex,n=e.isOpen,r=e.itemRefs,i=e.getItemNodeFromIndex,a=e.menuElement,o=e.scrollIntoView,s=(0,L.useRef)(!0);return IF(function(){t<0||!n||!Object.keys(r.current).length||(s.current===!1?s.current=!0:o(i(t),a))},[t]),s}var eI=fF;function tI(e,t,n){return n===void 0&&(n=!0),q({isOpen:!1,highlightedIndex:-1},e.items?.length&&t>=0&&q({selectedItem:e.items[t],isOpen:KF(e,`isOpen`),highlightedIndex:KF(e,`highlightedIndex`)},n&&{inputValue:e.itemToString(e.items[t])}))}function nI(e,t,n){var r=t.type,i=t.props,a;switch(r){case n.ItemMouseMove:a={highlightedIndex:t.disabled?-1:t.index};break;case n.MenuMouseLeave:a={highlightedIndex:-1};break;case n.ToggleButtonClick:case n.FunctionToggleMenu:a={isOpen:!e.isOpen,highlightedIndex:e.isOpen?-1:YF(i,e,0)};break;case n.FunctionOpenMenu:a={isOpen:!0,highlightedIndex:YF(i,e,0)};break;case n.FunctionCloseMenu:a={isOpen:!1};break;case n.FunctionSetHighlightedIndex:a={highlightedIndex:t.highlightedIndex};break;case n.FunctionSetInputValue:a={inputValue:t.inputValue};break;case n.FunctionReset:a={highlightedIndex:KF(i,`highlightedIndex`),isOpen:KF(i,`isOpen`),selectedItem:KF(i,`selectedItem`),inputValue:KF(i,`inputValue`)};break;default:throw Error(`Reducer called without proper action type.`)}return q({},e,a)}function rI(e){for(var t=e.keysSoFar,n=e.highlightedIndex,r=e.items,i=e.itemToString,a=e.getItemNodeFromIndex,o=t.toLowerCase(),s=0;s<r.length;s++){var c=(s+n+ +(t.length<2))%r.length,l=r[c];if(l!==void 0&&i(l).toLowerCase().startsWith(o)&&!a(c)?.hasAttribute(`disabled`))return c}return n}J.default.array.isRequired,J.default.func,J.default.func,J.default.func,J.default.number,J.default.number,J.default.number,J.default.bool,J.default.bool,J.default.bool,J.default.any,J.default.any,J.default.any,J.default.string,J.default.string,J.default.string,J.default.func,J.default.string,J.default.func,J.default.func,J.default.func,J.default.func,J.default.func,J.default.shape({addEventListener:J.default.func,removeEventListener:J.default.func,document:J.default.shape({getElementById:J.default.func,activeElement:J.default.any,body:J.default.any})});function iI(e){var t=e.isOpen,n=e.resultCount,r=e.previousResultCount;return t?n?n===r?``:`${n} result${n===1?` is`:`s are`} available, use up and down arrow keys to navigate. Press Enter or Space Bar keys to select.`:`No results are available.`:``}var aI=VA(VA({},GF),{getA11yStatusMessage:iI}),oI=fF,sI=0,cI=1,lI=2,uI=3,dI=4,fI=5,pI=6,mI=7,hI=8,gI=9,_I=10,vI=11,yI=12,bI=13,xI=14,SI=15,CI=16,wI=17,TI=18,EI=19,DI=20,OI=21,kI=Object.freeze({__proto__:null,ToggleButtonClick:sI,ToggleButtonKeyDownArrowDown:cI,ToggleButtonKeyDownArrowUp:lI,ToggleButtonKeyDownCharacter:uI,ToggleButtonKeyDownEscape:dI,ToggleButtonKeyDownHome:fI,ToggleButtonKeyDownEnd:pI,ToggleButtonKeyDownEnter:mI,ToggleButtonKeyDownSpaceButton:hI,ToggleButtonKeyDownPageUp:gI,ToggleButtonKeyDownPageDown:_I,ToggleButtonBlur:vI,MenuMouseLeave:yI,ItemMouseMove:bI,ItemClick:xI,FunctionToggleMenu:SI,FunctionOpenMenu:CI,FunctionCloseMenu:wI,FunctionSetHighlightedIndex:TI,FunctionSelectItem:EI,FunctionSetInputValue:DI,FunctionReset:OI});function AI(e,t){var n=t.type,r=t.props,i=t.altKey,a;switch(n){case xI:a={isOpen:KF(r,`isOpen`),highlightedIndex:KF(r,`highlightedIndex`),selectedItem:r.items[t.index]};break;case uI:var o=t.key,s=``+e.inputValue+o;a={inputValue:s,highlightedIndex:rI({keysSoFar:s,highlightedIndex:!e.isOpen&&e.selectedItem?r.items.indexOf(e.selectedItem):e.highlightedIndex,items:r.items,itemToString:r.itemToString,getItemNodeFromIndex:t.getItemNodeFromIndex}),isOpen:!0};break;case cI:a={highlightedIndex:e.isOpen?CF(1,e.highlightedIndex,r.items.length,t.getItemNodeFromIndex,!1):i&&e.selectedItem==null?-1:YF(r,e,1),isOpen:!0};break;case lI:a=e.isOpen&&i?tI(r,e.highlightedIndex,!1):{highlightedIndex:e.isOpen?CF(-1,e.highlightedIndex,r.items.length,t.getItemNodeFromIndex,!1):YF(r,e,-1),isOpen:!0};break;case mI:case hI:a=tI(r,e.highlightedIndex,!1);break;case fI:a={highlightedIndex:wF(1,0,r.items.length,t.getItemNodeFromIndex,!1),isOpen:!0};break;case pI:a={highlightedIndex:wF(-1,r.items.length-1,r.items.length,t.getItemNodeFromIndex,!1),isOpen:!0};break;case gI:a={highlightedIndex:CF(-10,e.highlightedIndex,r.items.length,t.getItemNodeFromIndex,!1)};break;case _I:a={highlightedIndex:CF(10,e.highlightedIndex,r.items.length,t.getItemNodeFromIndex,!1)};break;case dI:a={isOpen:!1,highlightedIndex:-1};break;case vI:a=q({isOpen:!1,highlightedIndex:-1},e.highlightedIndex>=0&&r.items?.length&&{selectedItem:r.items[e.highlightedIndex]});break;case EI:a={selectedItem:t.selectedItem};break;default:return nI(e,t,kI)}return q({},e,a)}var jI=[`onMouseLeave`,`refKey`,`onKeyDown`,`onBlur`,`ref`],MI=[`onBlur`,`onClick`,`onPress`,`onKeyDown`,`refKey`,`ref`],ese=[`item`,`index`,`onMouseMove`,`onClick`,`onPress`,`refKey`,`ref`,`disabled`];NI.stateChangeTypes=kI;function NI(e){e===void 0&&(e={}),oI(e,NI);var t=q({},aI,e),n=t.items,r=t.scrollIntoView,i=t.environment,a=t.itemToString,o=t.getA11ySelectionMessage,s=t.getA11yStatusMessage,c=WF(AI,JF(t),t),l=c[0],u=c[1],d=l.isOpen,f=l.highlightedIndex,p=l.selectedItem,m=l.inputValue,h=(0,L.useRef)(null),g=(0,L.useRef)(null),_=(0,L.useRef)({}),v=(0,L.useRef)(null),y=LF(t),b=(0,L.useRef)(),x=(0,L.useRef)(!0),S=HF({state:l,props:t}),C=(0,L.useCallback)(function(e){return _.current[y.getItemId(e)]},[y]);QF(s,[d,f,m,n],q({isInitialMount:x.current,previousResultCount:b.current,items:n,environment:i,itemToString:a},l)),QF(o,[p],q({isInitialMount:x.current,previousResultCount:b.current,items:n,environment:i,itemToString:a},l));var w=$F({menuElement:g.current,highlightedIndex:f,isOpen:d,itemRefs:_,scrollIntoView:r,getItemNodeFromIndex:C});(0,L.useEffect)(function(){return v.current=hF(function(e){e({type:DI,inputValue:``})},500),function(){v.current.cancel()}},[]),(0,L.useEffect)(function(){m&&v.current(u)},[u,m]),eI({isInitialMount:x.current,props:t,state:l}),(0,L.useEffect)(function(){x.current||(b.current=n.length)});var T=XF(d,[g,h],i,function(){u({type:vI})}),E=ZF(`getMenuProps`,`getToggleButtonProps`);(0,L.useEffect)(function(){return x.current=!1,function(){x.current=!0}},[]),(0,L.useEffect)(function(){d||(_.current={})},[d]);var D=(0,L.useMemo)(function(){return{ArrowDown:function(e){e.preventDefault(),u({type:cI,getItemNodeFromIndex:C,altKey:e.altKey})},ArrowUp:function(e){e.preventDefault(),u({type:lI,getItemNodeFromIndex:C,altKey:e.altKey})},Home:function(e){e.preventDefault(),u({type:fI,getItemNodeFromIndex:C})},End:function(e){e.preventDefault(),u({type:pI,getItemNodeFromIndex:C})},Escape:function(){S.current.state.isOpen&&u({type:dI})},Enter:function(e){e.preventDefault(),u({type:S.current.state.isOpen?mI:sI})},PageUp:function(e){S.current.state.isOpen&&(e.preventDefault(),u({type:gI,getItemNodeFromIndex:C}))},PageDown:function(e){S.current.state.isOpen&&(e.preventDefault(),u({type:_I,getItemNodeFromIndex:C}))}," ":function(e){e.preventDefault();var t=S.current.state;if(!t.isOpen){u({type:sI});return}t.inputValue?u({type:uI,key:` `,getItemNodeFromIndex:C}):u({type:hI})}}},[u,C,S]),O=(0,L.useCallback)(function(){u({type:SI})},[u]),k=(0,L.useCallback)(function(){u({type:wI})},[u]),A=(0,L.useCallback)(function(){u({type:CI})},[u]),j=(0,L.useCallback)(function(e){u({type:TI,highlightedIndex:e})},[u]),M=(0,L.useCallback)(function(e){u({type:EI,selectedItem:e})},[u]),N=(0,L.useCallback)(function(){u({type:OI})},[u]),P=(0,L.useCallback)(function(e){u({type:DI,inputValue:e})},[u]),ee=(0,L.useCallback)(function(e){return q({id:y.labelId,htmlFor:y.toggleButtonId},e)},[y]),te=(0,L.useCallback)(function(e,t){var n,r=e===void 0?{}:e,i=r.onMouseLeave,a=r.refKey,o=a===void 0?`ref`:a;r.onKeyDown,r.onBlur;var s=r.ref,c=$P(r,jI),l=(t===void 0?{}:t).suppressRefError;return E(`getMenuProps`,l===void 0?!1:l,o,g),q((n={},n[o]=_F(s,function(e){g.current=e}),n.id=y.menuId,n.role=`listbox`,n[`aria-labelledby`]=c&&c[`aria-label`]?void 0:``+y.labelId,n.onMouseLeave=gF(i,function(){u({type:yI})}),n),c)},[u,E,y]);return{getToggleButtonProps:(0,L.useCallback)(function(e,t){var n,r=e===void 0?{}:e,i=r.onBlur,a=r.onClick;r.onPress;var o=r.onKeyDown,s=r.refKey,c=s===void 0?`ref`:s,l=r.ref,d=$P(r,MI),f=(t===void 0?{}:t).suppressRefError,p=f===void 0?!1:f,m=S.current.state,g=function(){u({type:sI})},_=function(){m.isOpen&&!T.current.isMouseDown&&u({type:vI})},v=function(e){var t=SF(e);t&&D[t]?D[t](e):BF(t)&&u({type:uI,key:t,getItemNodeFromIndex:C})},b=q((n={},n[c]=_F(l,function(e){h.current=e}),n[`aria-activedescendant`]=m.isOpen&&m.highlightedIndex>-1?y.getItemId(m.highlightedIndex):``,n[`aria-controls`]=y.menuId,n[`aria-expanded`]=S.current.state.isOpen,n[`aria-haspopup`]=`listbox`,n[`aria-labelledby`]=d&&d[`aria-label`]?void 0:``+y.labelId,n.id=y.toggleButtonId,n.role=`combobox`,n.tabIndex=0,n.onBlur=gF(i,_),n),d);return d.disabled||(b.onClick=gF(a,g),b.onKeyDown=gF(o,v)),E(`getToggleButtonProps`,p,c,h),b},[S,y,E,u,T,D,C]),getLabelProps:ee,getMenuProps:te,getItemProps:(0,L.useCallback)(function(e){var t,n=e===void 0?{}:e,r=n.item,i=n.index,a=n.onMouseMove,o=n.onClick;n.onPress;var s=n.refKey,c=s===void 0?`ref`:s,l=n.ref,d=n.disabled,f=$P(n,ese),m=S.current,h=m.state,g=m.props,v=RF(r,i,g.items,`Pass either item or index to getItemProps!`),b=v[0],x=v[1],C=function(){x!==h.highlightedIndex&&(w.current=!1,u({type:bI,index:x,disabled:d}))},T=function(){u({type:xI,index:x})},E=q((t={disabled:d,role:`option`,"aria-selected":``+(b===p),id:y.getItemId(x)},t[c]=_F(l,function(e){e&&(_.current[y.getItemId(x)]=e)}),t),f);return d||(E.onClick=gF(o,T)),E.onMouseMove=gF(a,C),E},[S,p,y,w,u]),toggleMenu:O,openMenu:A,closeMenu:k,setHighlightedIndex:j,selectItem:M,reset:N,setInputValue:P,highlightedIndex:f,isOpen:d,selectedItem:p,inputValue:m}}var PI=0,FI=1,II=2,LI=3,RI=4,zI=5,BI=6,VI=7,HI=8,UI=9,WI=10,GI=11,KI=12,qI=13,JI=14,YI=15,XI=16,ZI=17,QI=18,$I=19,eL=20,tL=21,nL=22,rL=Object.freeze({__proto__:null,InputKeyDownArrowDown:PI,InputKeyDownArrowUp:FI,InputKeyDownEscape:II,InputKeyDownHome:LI,InputKeyDownEnd:RI,InputKeyDownPageUp:zI,InputKeyDownPageDown:BI,InputKeyDownEnter:VI,InputChange:HI,InputBlur:UI,InputFocus:WI,MenuMouseLeave:GI,ItemMouseMove:KI,ItemClick:qI,ToggleButtonClick:JI,FunctionToggleMenu:YI,FunctionOpenMenu:XI,FunctionCloseMenu:ZI,FunctionSetHighlightedIndex:QI,FunctionSelectItem:$I,FunctionSetInputValue:eL,FunctionReset:tL,ControlledPropUpdatedSelectedItem:nL});function tse(e){var t=JF(e),n=t.selectedItem,r=t.inputValue;return r===``&&n&&e.defaultInputValue===void 0&&e.initialInputValue===void 0&&e.inputValue===void 0&&(r=e.itemToString(n)),q({},t,{inputValue:r})}J.default.array.isRequired,J.default.func,J.default.func,J.default.func,J.default.func,J.default.number,J.default.number,J.default.number,J.default.bool,J.default.bool,J.default.bool,J.default.any,J.default.any,J.default.any,J.default.string,J.default.string,J.default.string,J.default.string,J.default.string,J.default.string,J.default.func,J.default.string,J.default.string,J.default.func,J.default.func,J.default.func,J.default.func,J.default.func,J.default.func,J.default.shape({addEventListener:J.default.func,removeEventListener:J.default.func,document:J.default.shape({getElementById:J.default.func,activeElement:J.default.any,body:J.default.any})});function nse(e,t,n){var r=(0,L.useRef)(),i=UF(e,t,n),a=i[0],o=i[1];return(0,L.useEffect)(function(){xF(n,`selectedItem`)&&(n.selectedItemChanged(r.current,n.selectedItem)&&o({type:nL,inputValue:n.itemToString(n.selectedItem)}),r.current=a.selectedItem===r.current?n.selectedItem:a.selectedItem)},[a.selectedItem,n.selectedItem]),[bF(a,n),o]}var rse=fF,ise=q({},GF,{selectedItemChanged:function(e,t){return e!==t},getA11yStatusMessage:yF});function ase(e,t){var n=t.type,r=t.props,i=t.altKey,a;switch(n){case qI:a={isOpen:KF(r,`isOpen`),highlightedIndex:KF(r,`highlightedIndex`),selectedItem:r.items[t.index],inputValue:r.itemToString(r.items[t.index])};break;case PI:a=e.isOpen?{highlightedIndex:CF(1,e.highlightedIndex,r.items.length,t.getItemNodeFromIndex,!0)}:{highlightedIndex:i&&e.selectedItem==null?-1:YF(r,e,1,t.getItemNodeFromIndex),isOpen:r.items.length>=0};break;case FI:a=e.isOpen?i?tI(r,e.highlightedIndex):{highlightedIndex:CF(-1,e.highlightedIndex,r.items.length,t.getItemNodeFromIndex,!0)}:{highlightedIndex:YF(r,e,-1,t.getItemNodeFromIndex),isOpen:r.items.length>=0};break;case VI:a=tI(r,e.highlightedIndex);break;case II:a=q({isOpen:!1,highlightedIndex:-1},!e.isOpen&&{selectedItem:null,inputValue:``});break;case zI:a={highlightedIndex:CF(-10,e.highlightedIndex,r.items.length,t.getItemNodeFromIndex,!1)};break;case BI:a={highlightedIndex:CF(10,e.highlightedIndex,r.items.length,t.getItemNodeFromIndex,!1)};break;case LI:a={highlightedIndex:wF(1,0,r.items.length,t.getItemNodeFromIndex,!1)};break;case RI:a={highlightedIndex:wF(-1,r.items.length-1,r.items.length,t.getItemNodeFromIndex,!1)};break;case UI:a=q({isOpen:!1,highlightedIndex:-1},e.highlightedIndex>=0&&r.items?.length&&t.selectItem&&{selectedItem:r.items[e.highlightedIndex],inputValue:r.itemToString(r.items[e.highlightedIndex])});break;case HI:a={isOpen:!0,highlightedIndex:KF(r,`highlightedIndex`),inputValue:t.inputValue};break;case WI:a={isOpen:!0,highlightedIndex:YF(r,e,0)};break;case $I:a={selectedItem:t.selectedItem,inputValue:r.itemToString(t.selectedItem)};break;case nL:a={inputValue:t.inputValue};break;default:return nI(e,t,rL)}return q({},e,a)}var ose=[`onMouseLeave`,`refKey`,`ref`],sse=[`item`,`index`,`refKey`,`ref`,`onMouseMove`,`onMouseDown`,`onClick`,`onPress`,`disabled`],cse=[`onClick`,`onPress`,`refKey`,`ref`],lse=[`onKeyDown`,`onChange`,`onInput`,`onFocus`,`onBlur`,`onChangeText`,`refKey`,`ref`];iL.stateChangeTypes=rL;function iL(e){e===void 0&&(e={}),rse(e,iL);var t=q({},ise,e),n=t.initialIsOpen,r=t.defaultIsOpen,i=t.items,a=t.scrollIntoView,o=t.environment,s=t.getA11yStatusMessage,c=t.getA11ySelectionMessage,l=t.itemToString,u=nse(ase,tse(t),t),d=u[0],f=u[1],p=d.isOpen,m=d.highlightedIndex,h=d.selectedItem,g=d.inputValue,_=(0,L.useRef)(null),v=(0,L.useRef)({}),y=(0,L.useRef)(null),b=(0,L.useRef)(null),x=(0,L.useRef)(!0),S=LF(t),C=(0,L.useRef)(),w=HF({state:d,props:t}),T=(0,L.useCallback)(function(e){return v.current[S.getItemId(e)]},[S]);QF(s,[p,m,g,i],q({isInitialMount:x.current,previousResultCount:C.current,items:i,environment:o,itemToString:l},d)),QF(c,[h],q({isInitialMount:x.current,previousResultCount:C.current,items:i,environment:o,itemToString:l},d));var E=$F({menuElement:_.current,highlightedIndex:m,isOpen:p,itemRefs:v,scrollIntoView:a,getItemNodeFromIndex:T});eI({isInitialMount:x.current,props:t,state:d}),(0,L.useEffect)(function(){(n||r||p)&&y.current&&y.current.focus()},[]),(0,L.useEffect)(function(){x.current||(C.current=i.length)});var D=XF(p,[y,_,b],o,function(){f({type:UI,selectItem:!1})}),O=ZF(`getInputProps`,`getMenuProps`);(0,L.useEffect)(function(){return x.current=!1,function(){x.current=!0}},[]),(0,L.useEffect)(function(){if(!p)v.current={};else if(o.document?.activeElement!==y.current){var e;y==null||(e=y.current)==null||e.focus()}},[p,o]);var k=(0,L.useMemo)(function(){return{ArrowDown:function(e){e.preventDefault(),f({type:PI,altKey:e.altKey,getItemNodeFromIndex:T})},ArrowUp:function(e){e.preventDefault(),f({type:FI,altKey:e.altKey,getItemNodeFromIndex:T})},Home:function(e){w.current.state.isOpen&&(e.preventDefault(),f({type:LI,getItemNodeFromIndex:T}))},End:function(e){w.current.state.isOpen&&(e.preventDefault(),f({type:RI,getItemNodeFromIndex:T}))},Escape:function(e){var t=w.current.state;(t.isOpen||t.inputValue||t.selectedItem||t.highlightedIndex>-1)&&(e.preventDefault(),f({type:II}))},Enter:function(e){!w.current.state.isOpen||e.which===229||(e.preventDefault(),f({type:VI,getItemNodeFromIndex:T}))},PageUp:function(e){w.current.state.isOpen&&(e.preventDefault(),f({type:zI,getItemNodeFromIndex:T}))},PageDown:function(e){w.current.state.isOpen&&(e.preventDefault(),f({type:BI,getItemNodeFromIndex:T}))}}},[f,w,T]),A=(0,L.useCallback)(function(e){return q({id:S.labelId,htmlFor:S.inputId},e)},[S]),j=(0,L.useCallback)(function(e,t){var n,r=e===void 0?{}:e,i=r.onMouseLeave,a=r.refKey,o=a===void 0?`ref`:a,s=r.ref,c=$P(r,ose),l=(t===void 0?{}:t).suppressRefError;return O(`getMenuProps`,l===void 0?!1:l,o,_),q((n={},n[o]=_F(s,function(e){_.current=e}),n.id=S.menuId,n.role=`listbox`,n[`aria-labelledby`]=c&&c[`aria-label`]?void 0:``+S.labelId,n.onMouseLeave=gF(i,function(){f({type:GI})}),n),c)},[f,O,S]),M=(0,L.useCallback)(function(e){var t,n,r=e===void 0?{}:e,i=r.item,a=r.index,o=r.refKey,s=o===void 0?`ref`:o,c=r.ref,l=r.onMouseMove,u=r.onMouseDown,d=r.onClick;r.onPress;var p=r.disabled,m=$P(r,sse),h=w.current,g=h.props,_=h.state,y=RF(i,a,g.items,`Pass either item or index to getItemProps!`)[1],b=`onClick`,x=d;return q((t={},t[s]=_F(c,function(e){e&&(v.current[S.getItemId(y)]=e)}),t.disabled=p,t.role=`option`,t[`aria-selected`]=``+(y===_.highlightedIndex),t.id=S.getItemId(y),t),!p&&(n={},n[b]=gF(x,function(){f({type:qI,index:y})}),n),{onMouseMove:gF(l,function(){y!==_.highlightedIndex&&(E.current=!1,f({type:KI,index:y,disabled:p}))}),onMouseDown:gF(u,function(e){return e.preventDefault()})},m)},[f,w,E,S]),N=(0,L.useCallback)(function(e){var t,n=e===void 0?{}:e,r=n.onClick;n.onPress;var i=n.refKey,a=i===void 0?`ref`:i,o=n.ref,s=$P(n,cse),c=w.current.state;return q((t={},t[a]=_F(o,function(e){b.current=e}),t[`aria-controls`]=S.menuId,t[`aria-expanded`]=c.isOpen,t.id=S.toggleButtonId,t.tabIndex=-1,t),!s.disabled&&q({},{onClick:gF(r,function(){f({type:JI})})}),s)},[f,w,S]),P=(0,L.useCallback)(function(e,t){var n,r=e===void 0?{}:e,i=r.onKeyDown,a=r.onChange,s=r.onInput,c=r.onFocus,l=r.onBlur;r.onChangeText;var u=r.refKey,d=u===void 0?`ref`:u,p=r.ref,m=$P(r,lse),h=(t===void 0?{}:t).suppressRefError;O(`getInputProps`,h===void 0?!1:h,d,y);var g=w.current.state,_=function(e){var t=SF(e);t&&k[t]&&k[t](e)},v=function(e){f({type:HI,inputValue:e.target.value})},b=function(e){g.isOpen&&!D.current.isMouseDown&&f({type:UI,selectItem:!(e.relatedTarget===null&&o.document.activeElement!==o.document.body)})},x=function(){g.isOpen||f({type:WI})},C=`onChange`,T={};if(!m.disabled){var E;T=(E={},E[C]=gF(a,s,v),E.onKeyDown=gF(i,_),E.onBlur=gF(l,b),E.onFocus=gF(c,x),E)}return q((n={},n[d]=_F(p,function(e){y.current=e}),n[`aria-activedescendant`]=g.isOpen&&g.highlightedIndex>-1?S.getItemId(g.highlightedIndex):``,n[`aria-autocomplete`]=`list`,n[`aria-controls`]=S.menuId,n[`aria-expanded`]=g.isOpen,n[`aria-labelledby`]=m&&m[`aria-label`]?void 0:``+S.labelId,n.autoComplete=`off`,n.id=S.inputId,n.role=`combobox`,n.value=g.inputValue,n),T,m)},[O,w,S,k,f,D,o]),ee=(0,L.useCallback)(function(){f({type:YI})},[f]),te=(0,L.useCallback)(function(){f({type:ZI})},[f]),ne=(0,L.useCallback)(function(){f({type:XI})},[f]),F=(0,L.useCallback)(function(e){f({type:QI,highlightedIndex:e})},[f]),re=(0,L.useCallback)(function(e){f({type:$I,selectedItem:e})},[f]);return{getItemProps:M,getLabelProps:A,getMenuProps:j,getInputProps:P,getToggleButtonProps:N,toggleMenu:ee,openMenu:ne,closeMenu:te,setHighlightedIndex:F,setInputValue:(0,L.useCallback)(function(e){f({type:eL,inputValue:e})},[f]),selectItem:re,reset:(0,L.useCallback)(function(){f({type:tL})},[f]),highlightedIndex:m,isOpen:p,selectedItem:h,inputValue:g}}var aL={activeIndex:-1,selectedItems:[]};function oL(e,t){return qF(e,t,aL)}function sL(e,t){return KF(e,t,aL)}function use(e){return{activeIndex:oL(e,`activeIndex`),selectedItems:oL(e,`selectedItems`)}}function cL(e){if(e.shiftKey||e.metaKey||e.ctrlKey||e.altKey)return!1;var t=e.target;return!(t instanceof HTMLInputElement&&t.value!==``&&(t.selectionStart!==0||t.selectionEnd!==0))}function dse(e){var t=e.removedSelectedItem,n=e.itemToString;return n(t)+` has been removed.`}J.default.array,J.default.array,J.default.array,J.default.func,J.default.func,J.default.func,J.default.number,J.default.number,J.default.number,J.default.func,J.default.func,J.default.string,J.default.string,J.default.shape({addEventListener:J.default.func,removeEventListener:J.default.func,document:J.default.shape({getElementById:J.default.func,activeElement:J.default.any,body:J.default.any})});var fse={itemToString:GF.itemToString,stateReducer:GF.stateReducer,environment:GF.environment,getA11yRemovalMessage:dse,keyNavigationNext:`ArrowRight`,keyNavigationPrevious:`ArrowLeft`},pse=fF,lL=0,uL=1,dL=2,fL=3,pL=4,mL=5,hL=6,gL=7,_L=8,vL=9,yL=10,bL=11,xL=12,mse=Object.freeze({__proto__:null,SelectedItemClick:lL,SelectedItemKeyDownDelete:uL,SelectedItemKeyDownBackspace:dL,SelectedItemKeyDownNavigationNext:fL,SelectedItemKeyDownNavigationPrevious:pL,DropdownKeyDownNavigationPrevious:mL,DropdownKeyDownBackspace:hL,DropdownClick:gL,FunctionAddSelectedItem:_L,FunctionRemoveSelectedItem:vL,FunctionSetSelectedItems:yL,FunctionSetActiveIndex:bL,FunctionReset:xL});function hse(e,t){var n=t.type,r=t.index,i=t.props,a=t.selectedItem,o=e.activeIndex,s=e.selectedItems,c;switch(n){case lL:c={activeIndex:r};break;case pL:c={activeIndex:o-1<0?0:o-1};break;case fL:c={activeIndex:o+1>=s.length?-1:o+1};break;case dL:case uL:if(o<0)break;var l=o;s.length===1?l=-1:o===s.length-1&&(l=s.length-2),c=q({selectedItems:[].concat(s.slice(0,o),s.slice(o+1))},{activeIndex:l});break;case mL:c={activeIndex:s.length-1};break;case hL:c={selectedItems:s.slice(0,s.length-1)};break;case _L:c={selectedItems:[].concat(s,[a])};break;case gL:c={activeIndex:-1};break;case vL:var u=o,d=s.indexOf(a);if(d<0)break;s.length===1?u=-1:d===s.length-1&&(u=s.length-2),c={selectedItems:[].concat(s.slice(0,d),s.slice(d+1)),activeIndex:u};break;case yL:c={selectedItems:t.selectedItems};break;case bL:c={activeIndex:t.activeIndex};break;case xL:c={activeIndex:sL(i,`activeIndex`),selectedItems:sL(i,`selectedItems`)};break;default:throw Error(`Reducer called without proper action type.`)}return q({},e,c)}var gse=[`refKey`,`ref`,`onClick`,`onKeyDown`,`selectedItem`,`index`],_se=[`refKey`,`ref`,`onKeyDown`,`onClick`,`preventKeyAction`];SL.stateChangeTypes=mse;function SL(e){e===void 0&&(e={}),pse(e,SL);var t=q({},fse,e),n=t.getA11yRemovalMessage,r=t.itemToString,i=t.environment,a=t.keyNavigationNext,o=t.keyNavigationPrevious,s=WF(hse,use(t),t),c=s[0],l=s[1],u=c.activeIndex,d=c.selectedItems,f=(0,L.useRef)(!0),p=(0,L.useRef)(null),m=(0,L.useRef)(d),h=(0,L.useRef)();h.current=[];var g=HF({state:c,props:t});(0,L.useEffect)(function(){if(!f.current){if(d.length<m.current.length){var e=m.current.find(function(e){return d.indexOf(e)<0});DF(n({itemToString:r,resultCount:d.length,removedSelectedItem:e,activeIndex:u,activeSelectedItem:d[u]}),i.document)}m.current=d}},[d.length]),(0,L.useEffect)(function(){f.current||(u===-1&&p.current?p.current.focus():h.current[u]&&h.current[u].focus())},[u]),eI({isInitialMount:f.current,props:t,state:c});var _=ZF(`getDropdownProps`);(0,L.useEffect)(function(){return f.current=!1,function(){f.current=!0}},[]);var v=(0,L.useMemo)(function(){var e;return e={},e[o]=function(){l({type:pL})},e[a]=function(){l({type:fL})},e.Delete=function(){l({type:uL})},e.Backspace=function(){l({type:dL})},e},[l,a,o]),y=(0,L.useMemo)(function(){var e;return e={},e[o]=function(e){cL(e)&&l({type:mL})},e.Backspace=function(e){cL(e)&&l({type:hL})},e},[l,o]);return{getSelectedItemProps:(0,L.useCallback)(function(e){var t,n=e===void 0?{}:e,r=n.refKey,i=r===void 0?`ref`:r,a=n.ref,o=n.onClick,s=n.onKeyDown,c=n.selectedItem,u=n.index,d=$P(n,gse),f=g.current.state,p=RF(c,u,f.selectedItems,`Pass either item or index to getSelectedItemProps!`)[1],m=p>-1&&p===f.activeIndex;return q((t={},t[i]=_F(a,function(e){e&&h.current.push(e)}),t.tabIndex=m?0:-1,t.onClick=gF(o,function(){l({type:lL,index:p})}),t.onKeyDown=gF(s,function(e){var t=SF(e);t&&v[t]&&v[t](e)}),t),d)},[l,g,v]),getDropdownProps:(0,L.useCallback)(function(e,t){var n,r=e===void 0?{}:e,i=r.refKey,a=i===void 0?`ref`:i,o=r.ref,s=r.onKeyDown,c=r.onClick,u=r.preventKeyAction,d=u===void 0?!1:u,f=$P(r,_se),m=(t===void 0?{}:t).suppressRefError;return _(`getDropdownProps`,m===void 0?!1:m,a,p),q((n={},n[a]=_F(o,function(e){e&&(p.current=e)}),n),!d&&{onKeyDown:gF(s,function(e){var t=SF(e);t&&y[t]&&y[t](e)}),onClick:gF(c,function(){l({type:gL})})},f)},[l,y,_]),addSelectedItem:(0,L.useCallback)(function(e){l({type:_L,selectedItem:e})},[l]),removeSelectedItem:(0,L.useCallback)(function(e){l({type:vL,selectedItem:e})},[l]),setSelectedItems:(0,L.useCallback)(function(e){l({type:yL,selectedItems:e})},[l]),setActiveIndex:(0,L.useCallback)(function(e){l({type:bL,activeIndex:e})},[l]),reset:(0,L.useCallback)(function(){l({type:xL})},[l]),selectedItems:d,activeIndex:u}}var CL=20,vse=e=>e.suggestions.length>0?L.createElement(yse,{...e}):L.createElement(`input`,{className:fE.textInput,size:40,autoFocus:!0,...e.register(e.inputName)}),yse=({autofocus:e,suggestions:t,control:n,inputName:r,placeholder:i,initialInputValue:a,setValue:o})=>{let[s,c]=L.useState(t.slice(0,CL)),l=Rl(jT),u=t.length>0,{isOpen:d,getToggleButtonProps:f,getMenuProps:p,getInputProps:m,highlightedIndex:h,getItemProps:g,selectedItem:_}=iL({initialInputValue:a,onInputValueChange({inputValue:e=``}){o(r,e),e=e.toLowerCase()||``;let n=[];for(let r of t)if(r.toLowerCase().includes(e)&&(n.push(r),n.length>=CL))break;c(n)},items:s,itemToString(e){return e??``}}),v=d&&s.length>0;return L.createElement(`div`,{className:fE.downshiftAutocompleteContainer},L.createElement(`div`,{"data-visible-dropdown":v,className:fE.downshiftInputWrapper},L.createElement(iP,{name:r,control:n,render:({field:t})=>{let n=m();return L.createElement(`input`,{...n,name:t.name,placeholder:i,className:fE.downshiftInput,size:30,"data-editor-dialog":!0,autoFocus:e})}}),u&&L.createElement(`button`,{"aria-label":`toggle menu`,type:`button`,...f()},l(`arrow_drop_down`))),L.createElement(`div`,{className:fE.downshiftAutocompleteContainer},L.createElement(`ul`,{...p(),"data-visible":v},s.map((e,t)=>L.createElement(`li`,{"data-selected":_===e,"data-highlighted":h===t,key:`${e}${t}`,...g({item:e,index:t})},e)))))};function bse(e){if(typeof e!=`string`)throw TypeError(`Expected a string`);return e.replace(/[|\\{}()[\]^$+*?.]/g,`\\$&`).replace(/-/g,`\\x2d`)}var xse={testNode:`blockquote`,visitNode({actions:e}){e.addAndStepInto(_v())}},Sse={testLexicalNode:vv,visitLexicalNode:({actions:e})=>{e.addAndStepInto(`blockquote`)}},Cse=ql({init(e){e.pubIn({[QT]:`quote`,[vT]:xse,[_T]:gv,[xT]:Sse})}});function wL(){let e=Kl;return{publish:()=>{e()},subscribe:t=>{e=t}}}var wse=Object.defineProperty,Tse=(e,t,n)=>t in e?wse(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,TL=(e,t,n)=>(Tse(e,typeof t==`symbol`?t:t+``,n),n),EL=class e extends Vm{constructor(e,t,n,r){super(r),TL(this,`__code`),TL(this,`__meta`),TL(this,`__language`),TL(this,`__focusEmitter`,wL()),TL(this,`setCode`,e=>{e!==this.__code&&(this.getWritable().__code=e)}),TL(this,`setMeta`,e=>{e!==this.__meta&&(this.getWritable().__meta=e)}),TL(this,`setLanguage`,e=>{e!==this.__language&&(this.getWritable().__language=e)}),TL(this,`select`,()=>{this.__focusEmitter.publish()}),this.__code=e,this.__meta=n,this.__language=t}static getType(){return`codeblock`}static clone(t){return new e(t.__code,t.__language,t.__meta,t.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__code=e.__code,this.__meta=e.__meta,this.__language=e.__language,this.__focusEmitter=wL()}static importJSON(e){let{code:t,meta:n,language:r}=e;return kL({code:t,language:r,meta:n})}static importDOM(){return{pre:()=>({conversion:kse,priority:3})}}exportJSON(){return{code:this.getCode(),language:this.getLanguage(),meta:this.getMeta(),type:`codeblock`,version:1}}createDOM(e,t){return document.createElement(`div`)}updateDOM(){return!1}getCode(){return this.__code}getMeta(){return this.__meta}getLanguage(){return this.__language}decorate(e){return L.createElement(Dse,{parentEditor:e,code:this.getCode(),meta:this.getMeta(),language:this.getLanguage(),codeBlockNode:this,nodeKey:this.getKey(),focusEmitter:this.__focusEmitter})}isInline(){return!1}},DL=L.createContext(null),Ese=({parentEditor:e,lexicalNode:t,children:n})=>{let r=L.useMemo(()=>({lexicalNode:t,parentEditor:e,setCode:n=>{e.update(()=>{t.setCode(n),setTimeout(()=>{e.dispatchCommand(zw,void 0)},0)})},setLanguage:n=>{e.update(()=>{t.setLanguage(n)})},setMeta:n=>{e.update(()=>{t.setMeta(n)})}}),[t,e]);return L.createElement(DL.Provider,{value:r},n)};function OL(){let e=L.useContext(DL);if(!e)throw Error(`useCodeBlockEditor must be used within a CodeBlockEditor`);return e}var Dse=e=>{let t=Rl(mT),n=Rl(AL),r=t.sort((e,t)=>t.priority-e.priority).find(t=>t.match(e.language||``,e.meta||``));if(r??=t.find(t=>t.match(n||``,e.meta||``)),!r)throw Error(`No CodeBlockEditor registered for language=${e.language} meta=${e.meta}`);let i=r.Editor,{codeBlockNode:a,parentEditor:o,...s}=e;return L.createElement(Ese,{parentEditor:e.parentEditor,lexicalNode:e.codeBlockNode},L.createElement(i,{...s}))};function kL(e){let{code:t=``,language:n=``,meta:r=``}=e;return new EL(t,n,r)}function Ose(e){return e instanceof EL}function kse(e){let t=e,n=t.textContent,r=e.getAttribute(`class`)??``,i=e.getAttribute(`data-language`)??``,a=/language-(\w+)/.exec(r);return{node:kL({code:n,language:a?a[1]:i,meta:t.getAttribute(`data-meta`)??``})}}var Ase={testLexicalNode:Ose,visitLexicalNode:({lexicalNode:e,actions:t})=>{t.addAndStepInto(`code`,{value:e.getCode(),lang:e.getLanguage(),meta:e.getMeta()})}},jse={testNode:(e,{codeBlockEditorDescriptors:t})=>e.type===`code`?t.find(t=>t.match(e.lang,e.meta))!==void 0:!1,visitNode({mdastNode:e,actions:t}){t.addAndStepInto(kL({code:e.value,language:e.lang??``,meta:e.meta??``}))}},AL=Nl(``),jL=Pl(e=>{e.link(e.pipe(jL,Hl(AL),Vl(([e,t])=>()=>kL({language:t,...e}))),JT)}),Mse=MT(mT),Nse=ql({update(e,t){e.pub(AL,t?.defaultCodeBlockLanguage??``)},init(e,t){e.pubIn({[QT]:`codeblock`,[mT]:t?.codeBlockEditorDescriptors??[],[vT]:jse,[_T]:EL,[xT]:Ase})}}),Pse=`modulepreload`,Fse=function(e){return`/apps/chat/`+e},ML={},Y=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}r=o(t.map(t=>{if(t=Fse(t,n),t in ML)return;ML[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:Pse,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},NL=class{constructor(e,t,n,r){this.state=e,this.pos=t,this.explicit=n,this.view=r,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=oe(this.state).resolveInner(this.pos,-1);for(;t&&e.indexOf(t.name)<0;)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}matchBefore(e){let t=this.state.doc.lineAt(this.pos),n=Math.max(t.from,this.pos-250),r=t.text.slice(n-t.from,this.pos-t.from),i=r.search(RL(e,!1));return i<0?null:{from:n+i,to:this.pos,text:r.slice(i)}}get aborted(){return this.abortListeners==null}addEventListener(e,t,n){e==`abort`&&this.abortListeners&&(this.abortListeners.push(t),n&&n.onDocChange&&(this.abortOnDocChange=!0))}};function PL(e){let t=Object.keys(e).join(``),n=/\w/.test(t);return n&&(t=t.replace(/\w/g,``)),`[${n?`\\w`:``}${t.replace(/[^\w\s]/g,`\\$&`)}]`}function Ise(e){let t=Object.create(null),n=Object.create(null);for(let{label:r}of e){t[r[0]]=!0;for(let e=1;e<r.length;e++)n[r[e]]=!0}let r=PL(t)+PL(n)+`*$`;return[RegExp(`^`+r),new RegExp(r)]}function FL(e){let t=e.map(e=>typeof e==`string`?{label:e}:e),[n,r]=t.every(e=>/^\w+$/.test(e.label))?[/\w*$/,/\w+$/]:Ise(t);return e=>{let i=e.matchBefore(r);return i||e.explicit?{from:i?i.from:e.pos,options:t,validFor:n}:null}}function Lse(e,t){return n=>{for(let t=oe(n.state).resolveInner(n.pos,-1);t;t=t.parent){if(e.indexOf(t.name)>-1)return null;if(t.type.isTop)break}return t(n)}}var IL=class{constructor(e,t,n,r){this.completion=e,this.source=t,this.match=n,this.score=r}};function LL(e){return e.selection.main.from}function RL(e,t){let{source:n}=e,r=t&&n[0]!=`^`,i=n[n.length-1]!=`$`;return!r&&!i?e:RegExp(`${r?`^`:``}(?:${n})${i?`$`:``}`,e.flags??(e.ignoreCase?`i`:``))}var zL=ge.define();function Rse(e,t,n,r){let{main:i}=e.selection,a=n-i.from,o=r-i.from;return{...e.changeByRange(s=>{if(s!=i&&n!=r&&e.sliceDoc(s.from+a,s.from+o)!=e.sliceDoc(n,r))return{range:s};let c=e.toText(t);return{changes:{from:s.from+a,to:r==i.from?s.to:s.from+o,insert:c},range:k.cursor(s.from+a+c.length)}}),scrollIntoView:!0,userEvent:`input.complete`}}var BL=new WeakMap;function zse(e){if(!Array.isArray(e))return e;let t=BL.get(e);return t||BL.set(e,t=FL(e)),t}var VL=w.define(),HL=w.define(),Bse=class{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let t=0;t<e.length;){let n=ce(e,t),r=a(n);this.chars.push(n);let i=e.slice(t,t+r),o=i.toUpperCase();this.folded.push(ce(o==i?i.toLowerCase():o,0)),t+=r}this.astral=e.length!=this.chars.length}ret(e,t){return this.score=e,this.matched=t,this}match(e){if(this.pattern.length==0)return this.ret(-100,[]);if(e.length<this.pattern.length)return null;let{chars:t,folded:n,any:r,precise:i,byWord:o}=this;if(t.length==1){let r=ce(e,0),i=a(r),o=i==e.length?0:-100;if(r!=t[0])if(r==n[0])o+=-200;else return null;return this.ret(o,[0,i])}let s=e.indexOf(this.pattern);if(s==0)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let c=t.length,l=0;if(s<0){for(let i=0,o=Math.min(e.length,200);i<o&&l<c;){let o=ce(e,i);(o==t[l]||o==n[l])&&(r[l++]=i),i+=a(o)}if(l<c)return null}let u=0,d=0,f=!1,p=0,m=-1,h=-1,g=/[a-z]/.test(e),_=!0;for(let r=0,l=Math.min(e.length,200),v=0;r<l&&d<c;){let l=ce(e,r);s<0&&(u<c&&l==t[u]&&(i[u++]=r),p<c&&(l==t[p]||l==n[p]?(p==0&&(m=r),h=r+1,p++):p=0));let b,x=l<255?l>=48&&l<=57||l>=97&&l<=122?2:+(l>=65&&l<=90):(b=y(l))==b.toLowerCase()?b==b.toUpperCase()?0:2:1;(!r||x==1&&g||v==0&&x!=0)&&(t[d]==l||n[d]==l&&(f=!0)?o[d++]=r:o.length&&(_=!1)),v=x,r+=a(l)}return d==c&&o[0]==0&&_?this.result(-100+(f?-200:0),o,e):p==c&&m==0?this.ret(-200-e.length+(h==e.length?0:-100),[0,h]):s>-1?this.ret(-700-e.length,[s,s+this.pattern.length]):p==c?this.ret(-900-e.length,[m,h]):d==c?this.result(-100+(f?-200:0)+-700+(_?0:-1100),o,e):t.length==2?null:this.result((r[0]?-700:0)+-200+-1100,r,e)}result(e,t,n){let r=[],i=0;for(let e of t){let t=e+(this.astral?a(ce(n,e)):1);i&&r[i-1]==e?r[i-1]=t:(r[i++]=e,r[i++]=t)}return this.ret(e-n.length,r)}},Vse=class{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length<this.pattern.length)return null;let t=e.slice(0,this.pattern.length),n=t==this.pattern?0:t.toLowerCase()==this.folded?-200:null;return n==null?null:(this.matched=[0,t.length],this.score=n+(e.length==this.pattern.length?0:-100),this)}},UL=ke.define({combine(e){return se(e,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>``,optionClass:()=>``,aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:Hse,filterStrict:!1,compareCompletions:(e,t)=>(e.sortText||e.label).localeCompare(t.sortText||t.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,t)=>e&&t,closeOnBlur:(e,t)=>e&&t,icons:(e,t)=>e&&t,tooltipClass:(e,t)=>n=>WL(e(n),t(n)),optionClass:(e,t)=>n=>WL(e(n),t(n)),addToOptions:(e,t)=>e.concat(t),filterStrict:(e,t)=>e||t})}});function WL(e,t){return e?t?e+` `+t:e:t}function Hse(e,t,n,r,i,a){let o=e.textDirection==u.RTL,s=o,c=!1,l=`top`,d,f,p=t.left-i.left,m=i.right-t.right,h=r.right-r.left,g=r.bottom-r.top;if(s&&p<Math.min(h,m)?s=!1:!s&&m<Math.min(h,p)&&(s=!0),h<=(s?p:m))d=Math.max(i.top,Math.min(n.top,i.bottom-g))-t.top,f=Math.min(400,s?p:m);else{c=!0,f=Math.min(400,(o?t.right:i.right-t.left)-30);let e=i.bottom-t.bottom;e>=g||e>t.top?d=n.bottom-t.top:(l=`bottom`,d=t.bottom-n.top)}let _=(t.bottom-t.top)/a.offsetHeight,v=(t.right-t.left)/a.offsetWidth;return{style:`${l}: ${d/_}px; max-width: ${f/v}px`,class:`cm-completionInfo-`+(c?o?`left-narrow`:`right-narrow`:s?`left`:`right`)}}var GL=w.define();function Use(e){let t=e.addToOptions.slice();return e.icons&&t.push({render(e){let t=document.createElement(`div`);return t.classList.add(`cm-completionIcon`),e.type&&t.classList.add(...e.type.split(/\s+/g).map(e=>`cm-completionIcon-`+e)),t.setAttribute(`aria-hidden`,`true`),t},position:20}),t.push({render(e,t,n,r){let i=document.createElement(`span`);i.className=`cm-completionLabel`;let a=e.displayLabel||e.label,o=0;for(let e=0;e<r.length;){let t=r[e++],n=r[e++];t>o&&i.appendChild(document.createTextNode(a.slice(o,t)));let s=i.appendChild(document.createElement(`span`));s.appendChild(document.createTextNode(a.slice(t,n))),s.className=`cm-completionMatchedText`,o=n}return o<a.length&&i.appendChild(document.createTextNode(a.slice(o))),i},position:50},{render(e){if(!e.detail)return null;let t=document.createElement(`span`);return t.className=`cm-completionDetail`,t.textContent=e.detail,t},position:80}),t.sort((e,t)=>e.position-t.position).map(e=>e.render)}function KL(e,t,n){if(e<=n)return{from:0,to:e};if(t<0&&(t=0),t<=e>>1){let e=Math.floor(t/n);return{from:e*n,to:(e+1)*n}}let r=Math.floor((e-t)/n);return{from:e-(r+1)*n,to:e-r*n}}var Wse=class{constructor(e,t,n){this.view=e,this.stateField=t,this.applyCompletion=n,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:e=>this.placeInfo(e),key:this},this.space=null,this.currentClass=``;let r=e.state.field(t),{options:i,selected:a}=r.open,o=e.state.facet(UL);this.optionContent=Use(o),this.optionClass=o.optionClass,this.tooltipClass=o.tooltipClass,this.range=KL(i.length,a,o.maxRenderedOptions),this.dom=document.createElement(`div`),this.dom.className=`cm-tooltip-autocomplete`,this.updateTooltipClass(e.state),this.dom.addEventListener(`mousedown`,n=>{let{options:r}=e.state.field(t).open;for(let t=n.target,i;t&&t!=this.dom;t=t.parentNode)if(t.nodeName==`LI`&&(i=/-(\d+)$/.exec(t.id))&&+i[1]<r.length){this.applyCompletion(e,r[+i[1]]),n.preventDefault();return}if(n.target==this.list){let t=this.list.classList.contains(`cm-completionListIncompleteTop`)&&n.clientY<this.list.firstChild.getBoundingClientRect().top?this.range.from-1:this.list.classList.contains(`cm-completionListIncompleteBottom`)&&n.clientY>this.list.lastChild.getBoundingClientRect().bottom?this.range.to:null;t!=null&&(e.dispatch({effects:GL.of(t)}),n.preventDefault())}}),this.dom.addEventListener(`focusout`,t=>{let n=e.state.field(this.stateField,!1);n&&n.tooltip&&e.state.facet(UL).closeOnBlur&&t.relatedTarget!=e.contentDOM&&e.dispatch({effects:HL.of(null)})}),this.showOptions(i,r.id)}mount(){this.updateSel()}showOptions(e,t){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,t,this.range)),this.list.addEventListener(`scroll`,()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){let t=e.state.field(this.stateField),n=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),t!=n){let{options:r,selected:i,disabled:a}=t.open;(!n.open||n.open.options!=r)&&(this.range=KL(r.length,i,e.state.facet(UL).maxRenderedOptions),this.showOptions(r,t.id)),this.updateSel(),a!=n.open?.disabled&&this.dom.classList.toggle(`cm-tooltip-autocomplete-disabled`,!!a)}}updateTooltipClass(e){let t=this.tooltipClass(e);if(t!=this.currentClass){for(let e of this.currentClass.split(` `))e&&this.dom.classList.remove(e);for(let e of t.split(` `))e&&this.dom.classList.add(e);this.currentClass=t}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),t=e.open;(t.selected>-1&&t.selected<this.range.from||t.selected>=this.range.to)&&(this.range=KL(t.options.length,t.selected,this.view.state.facet(UL).maxRenderedOptions),this.showOptions(t.options,e.id));let n=this.updateSelectedOption(t.selected);if(n){this.destroyInfo();let{completion:r}=t.options[t.selected],{info:i}=r;if(!i)return;let a=typeof i==`string`?document.createTextNode(i):i(r);if(!a)return;`then`in a?a.then(t=>{t&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(t,r)}).catch(e=>he(this.view.state,e,`completion info`)):(this.addInfoPane(a,r),n.setAttribute(`aria-describedby`,this.info.id))}}addInfoPane(e,t){this.destroyInfo();let n=this.info=document.createElement(`div`);if(n.className=`cm-tooltip cm-completionInfo`,n.id=`cm-completionInfo-`+Math.floor(Math.random()*65535).toString(16),e.nodeType!=null)n.appendChild(e),this.infoDestroy=null;else{let{dom:t,destroy:r}=e;n.appendChild(t),this.infoDestroy=r||null}this.dom.appendChild(n),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let t=null;for(let n=this.list.firstChild,r=this.range.from;n;n=n.nextSibling,r++)n.nodeName!=`LI`||!n.id?r--:r==e?n.hasAttribute(`aria-selected`)||(n.setAttribute(`aria-selected`,`true`),t=n):n.hasAttribute(`aria-selected`)&&(n.removeAttribute(`aria-selected`),n.removeAttribute(`aria-describedby`));return t&&Kse(this.list,t),t}measureInfo(){let e=this.dom.querySelector(`[aria-selected]`);if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect(),n=this.info.getBoundingClientRect(),r=e.getBoundingClientRect(),i=this.space;if(!i){let e=this.dom.ownerDocument.documentElement;i={left:0,top:0,right:e.clientWidth,bottom:e.clientHeight}}return r.top>Math.min(i.bottom,t.bottom)-10||r.bottom<Math.max(i.top,t.top)+10?null:this.view.state.facet(UL).positionInfo(this.view,t,r,n,i,this.dom)}placeInfo(e){this.info&&(e?(e.style&&(this.info.style.cssText=e.style),this.info.className=`cm-tooltip cm-completionInfo `+(e.class||``)):this.info.style.cssText=`top: -1e6px`)}createListBox(e,t,n){let r=document.createElement(`ul`);r.id=t,r.setAttribute(`role`,`listbox`),r.setAttribute(`aria-expanded`,`true`),r.setAttribute(`aria-label`,this.view.state.phrase(`Completions`)),r.addEventListener(`mousedown`,e=>{e.target==r&&e.preventDefault()});let i=null;for(let a=n.from;a<n.to;a++){let{completion:o,match:s}=e[a],{section:c}=o;if(c){let e=typeof c==`string`?c:c.name;if(e!=i&&(a>n.from||n.from==0))if(i=e,typeof c!=`string`&&c.header)r.appendChild(c.header(c));else{let t=r.appendChild(document.createElement(`completion-section`));t.textContent=e}}let l=r.appendChild(document.createElement(`li`));l.id=t+`-`+a,l.setAttribute(`role`,`option`);let u=this.optionClass(o);u&&(l.className=u);for(let e of this.optionContent){let t=e(o,this.view.state,this.view,s);t&&l.appendChild(t)}}return n.from&&r.classList.add(`cm-completionListIncompleteTop`),n.to<e.length&&r.classList.add(`cm-completionListIncompleteBottom`),r}destroyInfo(){this.info&&=(this.infoDestroy&&this.infoDestroy(),this.info.remove(),null)}destroy(){this.destroyInfo()}};function Gse(e,t){return n=>new Wse(n,e,t)}function Kse(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),i=n.height/e.offsetHeight;r.top<n.top?e.scrollTop-=(n.top-r.top)/i:r.bottom>n.bottom&&(e.scrollTop+=(r.bottom-n.bottom)/i)}function qL(e){return(e.boost||0)*100+(e.apply?10:0)+(e.info?5:0)+ +!!e.type}function qse(e,t){let n=[],r=null,i=null,a=e=>{n.push(e);let{section:t}=e.completion;if(t){r||=[];let e=typeof t==`string`?t:t.name;r.some(t=>t.name==e)||r.push(typeof t==`string`?{name:e}:t)}},o=t.facet(UL);for(let r of e)if(r.hasResult()){let e=r.result.getMatch;if(r.result.filter===!1)for(let t of r.result.options)a(new IL(t,r.source,e?e(t):[],1e9-n.length));else{let n=t.sliceDoc(r.from,r.to),s,c=o.filterStrict?new Vse(n):new Bse(n);for(let t of r.result.options)if(s=c.match(t.label)){let n=t.displayLabel?e?e(t,s.matched):[]:s.matched,o=s.score+(t.boost||0);if(a(new IL(t,r.source,n,o)),typeof t.section==`object`&&t.section.rank===`dynamic`){let{name:e}=t.section;i||=Object.create(null),i[e]=Math.max(o,i[e]||-1e9)}}}}if(r){let e=Object.create(null),t=0,a=(e,t)=>(e.rank===`dynamic`&&t.rank===`dynamic`?i[t.name]-i[e.name]:0)||(typeof e.rank==`number`?e.rank:1e9)-(typeof t.rank==`number`?t.rank:1e9)||(e.name<t.name?-1:1);for(let n of r.sort(a))t-=1e5,e[n.name]=t;for(let t of n){let{section:n}=t.completion;n&&(t.score+=e[typeof n==`string`?n:n.name])}}let s=[],c=null,l=o.compareCompletions;for(let e of n.sort((e,t)=>t.score-e.score||l(e.completion,t.completion))){let t=e.completion;!c||c.label!=t.label||c.detail!=t.detail||c.type!=null&&t.type!=null&&c.type!=t.type||c.apply!=t.apply||c.boost!=t.boost?s.push(e):qL(e.completion)>qL(c)&&(s[s.length-1]=e),c=e.completion}return s}var Jse=class e{constructor(e,t,n,r,i,a){this.options=e,this.attrs=t,this.tooltip=n,this.timestamp=r,this.selected=i,this.disabled=a}setSelected(t,n){return t==this.selected||t>=this.options.length?this:new e(this.options,JL(n,t),this.tooltip,this.timestamp,t,this.disabled)}static build(t,n,r,i,a,o){if(i&&!o&&t.some(e=>e.isPending))return i.setDisabled();let s=qse(t,n);if(!s.length)return i&&t.some(e=>e.isPending)?i.setDisabled():null;let c=n.facet(UL).selectOnOpen?0:-1;if(i&&i.selected!=c&&i.selected!=-1){let e=i.options[i.selected].completion;for(let t=0;t<s.length;t++)if(s[t].completion==e){c=t;break}}return new e(s,JL(r,c),{pos:t.reduce((e,t)=>t.hasResult()?Math.min(e,t.from):e,1e8),create:tce,above:a.aboveCursor},i?i.timestamp:Date.now(),c,!1)}map(t){return new e(this.options,this.attrs,{...this.tooltip,pos:t.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new e(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}},Yse=class e{constructor(e,t,n){this.active=e,this.id=t,this.open=n}static start(){return new e($se,`cm-ac-`+Math.floor(Math.random()*2e6).toString(36),null)}update(t){let{state:n}=t,r=n.facet(UL),i=(r.override||n.languageDataAt(`autocomplete`,LL(n)).map(zse)).map(e=>(this.active.find(t=>t.source==e)||new XL(e,+!!this.active.some(e=>e.state!=0))).update(t,r));i.length==this.active.length&&i.every((e,t)=>e==this.active[t])&&(i=this.active);let a=this.open,o=t.effects.some(e=>e.is(QL));a&&t.docChanged&&(a=a.map(t.changes)),t.selection||i.some(e=>e.hasResult()&&t.changes.touchesRange(e.from,e.to))||!Xse(i,this.active)||o?a=Jse.build(i,n,this.id,a,r,o):a&&a.disabled&&!i.some(e=>e.isPending)&&(a=null),!a&&i.every(e=>!e.isPending)&&i.some(e=>e.hasResult())&&(i=i.map(e=>e.hasResult()?new XL(e.source,0):e));for(let e of t.effects)e.is(GL)&&(a&&=a.setSelected(e.value,this.id));return i==this.active&&a==this.open?this:new e(i,this.id,a)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?Zse:Qse}};function Xse(e,t){if(e==t)return!0;for(let n=0,r=0;;){for(;n<e.length&&!e[n].hasResult();)n++;for(;r<t.length&&!t[r].hasResult();)r++;let i=n==e.length,a=r==t.length;if(i||a)return i==a;if(e[n++].result!=t[r++].result)return!1}}var Zse={"aria-autocomplete":`list`},Qse={};function JL(e,t){let n={"aria-autocomplete":`list`,"aria-haspopup":`listbox`,"aria-controls":e};return t>-1&&(n[`aria-activedescendant`]=e+`-`+t),n}var $se=[];function YL(e,t){if(e.isUserEvent(`input.complete`)){let n=e.annotation(zL);if(n&&t.activateOnCompletion(n))return 12}let n=e.isUserEvent(`input.type`);return n&&t.activateOnTyping?5:n?1:e.isUserEvent(`delete.backward`)?2:e.selection?8:e.docChanged?16:0}var XL=class e{constructor(e,t,n=!1){this.source=e,this.state=t,this.explicit=n}hasResult(){return!1}get isPending(){return this.state==1}update(t,n){let r=YL(t,n),i=this;(r&8||r&16&&this.touches(t))&&(i=new e(i.source,0)),r&4&&i.state==0&&(i=new e(this.source,1)),i=i.updateFor(t,r);for(let n of t.effects)if(n.is(VL))i=new e(i.source,1,n.value);else if(n.is(HL))i=new e(i.source,0);else if(n.is(QL))for(let e of n.value)e.source==i.source&&(i=e);return i}updateFor(e,t){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(LL(e.state))}},ZL=class e extends XL{constructor(e,t,n,r,i,a){super(e,3,t),this.limit=n,this.result=r,this.from=i,this.to=a}hasResult(){return!0}updateFor(t,n){if(!(n&3))return this.map(t.changes);let r=this.result;r.map&&!t.changes.empty&&(r=r.map(r,t.changes));let i=t.changes.mapPos(this.from),a=t.changes.mapPos(this.to,1),o=LL(t.state);if(o>a||!r||n&2&&(LL(t.startState)==this.from||o<this.limit))return new XL(this.source,n&4?1:0);let s=t.changes.mapPos(this.limit);return ece(r.validFor,t.state,i,a)?new e(this.source,this.explicit,s,r,i,a):r.update&&(r=r.update(r,i,a,new NL(t.state,o,!1)))?new e(this.source,this.explicit,s,r,r.from,r.to??LL(t.state)):new XL(this.source,1,this.explicit)}map(t){return t.empty?this:(this.result.map?this.result.map(this.result,t):this.result)?new e(this.source,this.explicit,t.mapPos(this.limit),this.result,t.mapPos(this.from),t.mapPos(this.to,1)):new XL(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}};function ece(e,t,n,r){if(!e)return!1;let i=t.sliceDoc(n,r);return typeof e==`function`?e(i,n,r,t):RL(e,!0).test(i)}var QL=w.define({map(e,t){return e.map(e=>e.map(t))}}),$L=l.define({create(){return Yse.start()},update(e,t){return e.update(t)},provide:e=>[ee.from(e,e=>e.tooltip),f.contentAttributes.from(e,e=>e.attrs)]});function eR(e,t){let n=t.completion.apply||t.completion.label,r=e.state.field($L).active.find(e=>e.source==t.source);return r instanceof ZL?(typeof n==`string`?e.dispatch({...Rse(e.state,n,r.from,r.to),annotations:zL.of(t.completion)}):n(e,t.completion,r.from,r.to),!0):!1}var tce=Gse($L,eR);function tR(e,t=`option`){return n=>{let i=n.state.field($L,!1);if(!i||!i.open||i.open.disabled||Date.now()-i.open.timestamp<n.state.facet(UL).interactionDelay)return!1;let a=1,o;t==`page`&&(o=r(n,i.open.tooltip))&&(a=Math.max(2,Math.floor(o.dom.offsetHeight/o.dom.querySelector(`li`).offsetHeight)-1));let{length:s}=i.open.options,c=i.open.selected>-1?i.open.selected+a*(e?1:-1):e?0:s-1;return c<0?c=t==`page`?0:s-1:c>=s&&(c=t==`page`?s-1:0),n.dispatch({effects:GL.of(c)}),!0}}var nce=e=>{let t=e.state.field($L,!1);return e.state.readOnly||!t||!t.open||t.open.selected<0||t.open.disabled||Date.now()-t.open.timestamp<e.state.facet(UL).interactionDelay?!1:eR(e,t.open.options[t.open.selected])},nR=e=>e.state.field($L,!1)?(e.dispatch({effects:VL.of(!0)}),!0):!1,rce=e=>{let t=e.state.field($L,!1);return!t||!t.active.some(e=>e.state!=0)?!1:(e.dispatch({effects:HL.of(null)}),!0)},ice=class{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}},ace=50,oce=1e3,sce=_e.fromClass(class{constructor(e){this.view=e,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let t of e.state.field($L).active)t.isPending&&this.startQuery(t)}update(e){let t=e.state.field($L),n=e.state.facet(UL);if(!e.selectionSet&&!e.docChanged&&e.startState.field($L)==t)return;let r=e.transactions.some(e=>{let t=YL(e,n);return t&8||(e.selection||e.docChanged)&&!(t&3)});for(let t=0;t<this.running.length;t++){let n=this.running[t];if(r||n.context.abortOnDocChange&&e.docChanged||n.updates.length+e.transactions.length>ace&&Date.now()-n.time>oce){for(let e of n.context.abortListeners)try{e()}catch(e){he(this.view.state,e)}n.context.abortListeners=null,this.running.splice(t--,1)}else n.updates.push(...e.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),e.transactions.some(e=>e.effects.some(e=>e.is(VL)))&&(this.pendingStart=!0);let i=this.pendingStart?50:n.activateOnTypingDelay;if(this.debounceUpdate=t.active.some(e=>e.isPending&&!this.running.some(t=>t.active.source==e.source))?setTimeout(()=>this.startUpdate(),i):-1,this.composing!=0)for(let t of e.transactions)t.isUserEvent(`input.type`)?this.composing=2:this.composing==2&&t.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:e}=this.view,t=e.field($L);for(let e of t.active)e.isPending&&!this.running.some(t=>t.active.source==e.source)&&this.startQuery(e);this.running.length&&t.open&&t.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(UL).updateSyncTime))}startQuery(e){let{state:t}=this.view,n=new NL(t,LL(t),e.explicit,this.view),r=new ice(e,n);this.running.push(r),Promise.resolve(e.source(n)).then(e=>{r.context.aborted||(r.done=e||null,this.scheduleAccept())},e=>{this.view.dispatch({effects:HL.of(null)}),he(this.view.state,e)})}scheduleAccept(){this.running.every(e=>e.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(UL).updateSyncTime))}accept(){this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],t=this.view.state.facet(UL),n=this.view.state.field($L);for(let r=0;r<this.running.length;r++){let i=this.running[r];if(i.done===void 0)continue;if(this.running.splice(r--,1),i.done){let n=LL(i.updates.length?i.updates[0].startState:this.view.state),r=Math.min(n,i.done.from+ +!i.active.explicit),a=new ZL(i.active.source,i.active.explicit,r,i.done,i.done.from,i.done.to??n);for(let e of i.updates)a=a.update(e,t);if(a.hasResult()){e.push(a);continue}}let a=n.active.find(e=>e.source==i.active.source);if(a&&a.isPending)if(i.done==null){let n=new XL(i.active.source,0);for(let e of i.updates)n=n.update(e,t);n.isPending||e.push(n)}else this.startQuery(a)}(e.length||n.open&&n.open.disabled)&&this.view.dispatch({effects:QL.of(e)})}},{eventHandlers:{blur(e){let t=this.view.state.field($L,!1);if(t&&t.tooltip&&this.view.state.facet(UL).closeOnBlur){let n=t.open&&r(this.view,t.open.tooltip);(!n||!n.dom.contains(e.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:HL.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:VL.of(!1)}),20),this.composing=0}}}),cce=typeof navigator==`object`&&/Win/.test(navigator.platform),lce=Oe.highest(f.domEventHandlers({keydown(e,t){let n=t.state.field($L,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||e.key.length>1||e.ctrlKey&&!(cce&&e.altKey)||e.metaKey)return!1;let r=n.open.options[n.open.selected],i=n.active.find(e=>e.source==r.source),a=r.completion.commitCharacters||i.result.commitCharacters;return a&&a.indexOf(e.key)>-1&&eR(t,r),!1}})),rR=f.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:`monospace`,whiteSpace:`nowrap`,overflow:`hidden auto`,maxWidth_fallback:`700px`,maxWidth:`min(700px, 95vw)`,minWidth:`250px`,maxHeight:`10em`,height:`100%`,listStyle:`none`,margin:0,padding:0,"& > li, & > completion-section":{padding:`1px 3px`,lineHeight:1.2},"& > li":{overflowX:`hidden`,textOverflow:`ellipsis`,cursor:`pointer`},"& > completion-section":{display:`list-item`,borderBottom:`1px solid silver`,paddingLeft:`0.5em`,opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:`#17c`,color:`white`},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:`#777`},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:`#347`,color:`white`},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:`#444`},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:`"···"`,opacity:.5,display:`block`,textAlign:`center`},".cm-tooltip.cm-completionInfo":{position:`absolute`,padding:`3px 9px`,width:`max-content`,maxWidth:`400px`,boxSizing:`border-box`,whiteSpace:`pre-line`},".cm-completionInfo.cm-completionInfo-left":{right:`100%`},".cm-completionInfo.cm-completionInfo-right":{left:`100%`},".cm-completionInfo.cm-completionInfo-left-narrow":{right:`30px`},".cm-completionInfo.cm-completionInfo-right-narrow":{left:`30px`},"&light .cm-snippetField":{backgroundColor:`#00000022`},"&dark .cm-snippetField":{backgroundColor:`#ffffff22`},".cm-snippetFieldPosition":{verticalAlign:`text-top`,width:0,height:`1.15em`,display:`inline-block`,margin:`0 -0.7px -.7em`,borderLeft:`1.4px dotted #888`},".cm-completionMatchedText":{textDecoration:`underline`},".cm-completionDetail":{marginLeft:`0.5em`,fontStyle:`italic`},".cm-completionIcon":{fontSize:`90%`,width:`.8em`,display:`inline-block`,textAlign:`center`,paddingRight:`.6em`,opacity:`0.6`,boxSizing:`content-box`},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:`'ƒ'`}},".cm-completionIcon-class":{"&:after":{content:`'○'`}},".cm-completionIcon-interface":{"&:after":{content:`'◌'`}},".cm-completionIcon-variable":{"&:after":{content:`'𝑥'`}},".cm-completionIcon-constant":{"&:after":{content:`'𝐶'`}},".cm-completionIcon-type":{"&:after":{content:`'𝑡'`}},".cm-completionIcon-enum":{"&:after":{content:`'∪'`}},".cm-completionIcon-property":{"&:after":{content:`'□'`}},".cm-completionIcon-keyword":{"&:after":{content:`'🔑︎'`}},".cm-completionIcon-namespace":{"&:after":{content:`'▢'`}},".cm-completionIcon-text":{"&:after":{content:`'abc'`,fontSize:`50%`,verticalAlign:`middle`}}}),uce=class{constructor(e,t,n,r){this.field=e,this.line=t,this.from=n,this.to=r}},dce=class e{constructor(e,t,n){this.field=e,this.from=t,this.to=n}map(t){let n=t.mapPos(this.from,-1,M.TrackDel),r=t.mapPos(this.to,1,M.TrackDel);return n==null||r==null?null:new e(this.field,n,r)}},fce=class e{constructor(e,t){this.lines=e,this.fieldPositions=t}instantiate(e,t){let n=[],r=[t],i=e.doc.lineAt(t),a=/^\s*/.exec(i.text)[0];for(let i of this.lines){if(n.length){let n=a,o=/^\t*/.exec(i)[0].length;for(let t=0;t<o;t++)n+=e.facet(c);r.push(t+n.length-o),i=n+i.slice(o)}n.push(i),t+=i.length+1}return{text:n,ranges:this.fieldPositions.map(e=>new dce(e.field,r[e.line]+e.from,r[e.line]+e.to))}}static parse(t){let n=[],r=[],i=[],a;for(let e of t.split(/\r\n?|\n/)){for(;a=/[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(e);){let t=a[1]?+a[1]:null,o=a[2]||a[3]||``,s=-1,c=o.replace(/\\[{}]/g,e=>e[1]);for(let e=0;e<n.length;e++)(t==null?c&&n[e].name==c:n[e].seq==t)&&(s=e);if(s<0){let e=0;for(;e<n.length&&(t==null||n[e].seq!=null&&n[e].seq<t);)e++;n.splice(e,0,{seq:t,name:c}),s=e;for(let e of i)e.field>=s&&e.field++}for(let e of i)if(e.line==r.length&&e.from>a.index){let t=a[2]?3+(a[1]||``).length:2;e.from-=t,e.to-=t}i.push(new uce(s,r.length,a.index,a.index+c.length)),e=e.slice(0,a.index)+o+e.slice(a.index+a[0].length)}e=e.replace(/\\([{}])/g,(e,t,n)=>{for(let e of i)e.line==r.length&&e.from>n&&(e.from--,e.to--);return t}),r.push(e)}return new e(r,i)}},pce=T.widget({widget:new class extends d{toDOM(){let e=document.createElement(`span`);return e.className=`cm-snippetFieldPosition`,e}ignoreEvent(){return!1}}}),mce=T.mark({class:`cm-snippetField`}),iR=class e{constructor(e,t){this.ranges=e,this.active=t,this.deco=T.set(e.map(e=>(e.from==e.to?pce:mce).range(e.from,e.to)),!0)}map(t){let n=[];for(let e of this.ranges){let r=e.map(t);if(!r)return null;n.push(r)}return new e(n,this.active)}selectionInsideField(e){return e.ranges.every(e=>this.ranges.some(t=>t.field==this.active&&t.from<=e.from&&t.to>=e.to))}},aR=w.define({map(e,t){return e&&e.map(t)}}),hce=w.define(),oR=l.define({create(){return null},update(e,t){for(let n of t.effects){if(n.is(aR))return n.value;if(n.is(hce)&&e)return new iR(e.ranges,n.value)}return e&&t.docChanged&&(e=e.map(t.changes)),e&&t.selection&&!e.selectionInsideField(t.selection)&&(e=null),e},provide:e=>f.decorations.from(e,e=>e?e.deco:T.none)});function sR(e,t){return k.create(e.filter(e=>e.field==t).map(e=>k.range(e.from,e.to)))}function gce(e){let t=fce.parse(e);return(e,n,r,i)=>{let{text:a,ranges:o}=t.instantiate(e.state,r),{main:c}=e.state.selection,l={changes:{from:r,to:i==c.from?c.to:i,insert:s.of(a)},scrollIntoView:!0,annotations:n?[zL.of(n),_.userEvent.of(`input.complete`)]:void 0};if(o.length&&(l.selection=sR(o,0)),o.some(e=>e.field>0)){let t=new iR(o,0),n=l.effects=[aR.of(t)];e.state.field(oR,!1)===void 0&&n.push(w.appendConfig.of([oR,vce,bce,rR]))}e.dispatch(e.state.update(l))}}function cR(e){return({state:t,dispatch:n})=>{let r=t.field(oR,!1);if(!r||e<0&&r.active==0)return!1;let i=r.active+e,a=e>0&&!r.ranges.some(t=>t.field==i+e);return n(t.update({selection:sR(r.ranges,i),effects:aR.of(a?null:new iR(r.ranges,i)),scrollIntoView:!0})),!0}}var _ce=[{key:`Tab`,run:cR(1),shift:cR(-1)},{key:`Escape`,run:({state:e,dispatch:t})=>e.field(oR,!1)?(t(e.update({effects:aR.of(null)})),!0):!1}],lR=ke.define({combine(e){return e.length?e[0]:_ce}}),vce=Oe.highest(ae.compute([lR],e=>e.facet(lR)));function yce(e,t){return{...t,apply:gce(e)}}var bce=f.domEventHandlers({mousedown(e,t){let n=t.state.field(oR,!1),r;if(!n||(r=t.posAtCoords({x:e.clientX,y:e.clientY}))==null)return!1;let i=n.ranges.find(e=>e.from<=r&&e.to>=r);return!i||i.field==n.active?!1:(t.dispatch({selection:sR(n.ranges,i.field),effects:aR.of(n.ranges.some(e=>e.field>i.field)?new iR(n.ranges,i.field):null),scrollIntoView:!0}),!0)}}),uR={brackets:[`(`,`[`,`{`,`'`,`"`],before:`)]}:;>`,stringPrefixes:[]},dR=w.define({map(e,t){return t.mapPos(e,-1,M.TrackAfter)??void 0}}),fR=new class extends Ee{};fR.startSide=1,fR.endSide=-1;var pR=l.define({create(){return S.empty},update(e,t){if(e=e.map(t.changes),t.selection){let n=t.state.doc.lineAt(t.selection.main.head);e=e.update({filter:e=>e>=n.from&&e<=n.to})}for(let n of t.effects)n.is(dR)&&(e=e.update({add:[fR.range(n.value,n.value+1)]}));return e}});function xce(){return[Cce,pR]}var mR=`()[]{}<>«»»«[]{}`;function hR(e){for(let t=0;t<16;t+=2)if(mR.charCodeAt(t)==e)return mR.charAt(t+1);return y(e<128?e:e+1)}function gR(e,t){return e.languageDataAt(`closeBrackets`,t)[0]||uR}var Sce=typeof navigator==`object`&&/Android\b/.test(navigator.userAgent),Cce=f.inputHandler.of((e,t,n,r)=>{if((Sce?e.composing:e.compositionStarted)||e.state.readOnly)return!1;let i=e.state.selection.main;if(r.length>2||r.length==2&&a(ce(r,0))==1||t!=i.from||n!=i.to)return!1;let o=Tce(e.state,r);return o?(e.dispatch(o),!0):!1}),wce=[{key:`Backspace`,run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=gR(e,e.selection.main.head).brackets||uR.brackets,r=null,i=e.changeByRange(t=>{if(t.empty){let r=Ece(e.doc,t.head);for(let i of n)if(i==r&&vR(e.doc,t.head)==hR(ce(i,0)))return{changes:{from:t.head-i.length,to:t.head+i.length},range:k.cursor(t.head-i.length)}}return{range:r=t}});return r||t(e.update(i,{scrollIntoView:!0,userEvent:`delete.backward`})),!r}}];function Tce(e,t){let n=gR(e,e.selection.main.head),r=n.brackets||uR.brackets;for(let i of r){let a=hR(ce(i,0));if(t==i)return a==i?kce(e,i,r.indexOf(i+i+i)>-1,n):Dce(e,i,a,n.before||uR.before);if(t==a&&_R(e,e.selection.main.from))return Oce(e,i,a)}return null}function _R(e,t){let n=!1;return e.field(pR).between(0,e.doc.length,e=>{e==t&&(n=!0)}),n}function vR(e,t){let n=e.sliceString(t,t+2);return n.slice(0,a(ce(n,0)))}function Ece(e,t){let n=e.sliceString(t-2,t);return a(ce(n,0))==n.length?n:n.slice(1)}function Dce(e,t,n,r){let i=null,a=e.changeByRange(a=>{if(!a.empty)return{changes:[{insert:t,from:a.from},{insert:n,from:a.to}],effects:dR.of(a.to+t.length),range:k.range(a.anchor+t.length,a.head+t.length)};let o=vR(e.doc,a.head);return!o||/\s/.test(o)||r.indexOf(o)>-1?{changes:{insert:t+n,from:a.head},effects:dR.of(a.head+t.length),range:k.cursor(a.head+t.length)}:{range:i=a}});return i?null:e.update(a,{scrollIntoView:!0,userEvent:`input.type`})}function Oce(e,t,n){let r=null,i=e.changeByRange(t=>t.empty&&vR(e.doc,t.head)==n?{changes:{from:t.head,to:t.head+n.length,insert:n},range:k.cursor(t.head+n.length)}:r={range:t});return r?null:e.update(i,{scrollIntoView:!0,userEvent:`input.type`})}function kce(e,t,n,r){let i=r.stringPrefixes||uR.stringPrefixes,a=null,o=e.changeByRange(r=>{if(!r.empty)return{changes:[{insert:t,from:r.from},{insert:t,from:r.to}],effects:dR.of(r.to+t.length),range:k.range(r.anchor+t.length,r.head+t.length)};let o=r.head,s=vR(e.doc,o),c;if(s==t){if(yR(e,o))return{changes:{insert:t+t,from:o},effects:dR.of(o+t.length),range:k.cursor(o+t.length)};if(_R(e,o)){let r=n&&e.sliceDoc(o,o+t.length*3)==t+t+t?t+t+t:t;return{changes:{from:o,to:o+r.length,insert:r},range:k.cursor(o+r.length)}}}else if(n&&e.sliceDoc(o-2*t.length,o)==t+t&&(c=bR(e,o-2*t.length,i))>-1&&yR(e,c))return{changes:{insert:t+t+t+t,from:o},effects:dR.of(o+t.length),range:k.cursor(o+t.length)};else if(e.charCategorizer(o)(s)!=I.Word&&bR(e,o,i)>-1&&!Ace(e,o,t,i))return{changes:{insert:t+t,from:o},effects:dR.of(o+t.length),range:k.cursor(o+t.length)};return{range:a=r}});return a?null:e.update(o,{scrollIntoView:!0,userEvent:`input.type`})}function yR(e,t){let n=oe(e).resolveInner(t+1);return n.parent&&n.from==t}function Ace(e,t,n,r){let i=oe(e).resolveInner(t,-1),a=r.reduce((e,t)=>Math.max(e,t.length),0);for(let o=0;o<5;o++){let o=e.sliceDoc(i.from,Math.min(i.to,i.from+n.length+a)),s=o.indexOf(n);if(!s||s>-1&&r.indexOf(o.slice(0,s))>-1){let t=i.firstChild;for(;t&&t.from==i.from&&t.to-t.from>n.length+s;){if(e.sliceDoc(t.to-n.length,t.to)==n)return!1;t=t.firstChild}return!0}let c=i.to==t&&i.parent;if(!c)break;i=c}return!1}function bR(e,t,n){let r=e.charCategorizer(t);if(r(e.sliceDoc(t-1,t))!=I.Word)return t;for(let i of n){let n=t-i.length;if(e.sliceDoc(n,t)==i&&r(e.sliceDoc(n-1,n))!=I.Word)return n}return-1}function jce(e={}){return[lce,$L,UL.of(e),sce,Mce,rR]}var xR=[{key:`Ctrl-Space`,run:nR},{mac:"Alt-`",run:nR},{mac:`Alt-i`,run:nR},{key:`Escape`,run:rce},{key:`ArrowDown`,run:tR(!0)},{key:`ArrowUp`,run:tR(!1)},{key:`PageDown`,run:tR(!0,`page`)},{key:`PageUp`,run:tR(!1,`page`)},{key:`Enter`,run:nce}],Mce=Oe.highest(ae.computeN([UL],e=>e.facet(UL).defaultKeymap?[xR]:[])),Nce=e=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),r=CR(e.state,n.from);return r.line?Pce(e):r.block?Ice(e):!1};function SR(e,t){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let i=e(t,n);return i?(r(n.update(i)),!0):!1}}var Pce=SR(zce,0),Fce=SR(TR,0),Ice=SR((e,t)=>TR(e,t,Rce(t)),0);function CR(e,t){let n=e.languageDataAt(`commentTokens`,t,1);return n.length?n[0]:{}}var wR=50;function Lce(e,{open:t,close:n},r,i){let a=e.sliceDoc(r-wR,r),o=e.sliceDoc(i,i+wR),s=/\s*$/.exec(a)[0].length,c=/^\s*/.exec(o)[0].length,l=a.length-s;if(a.slice(l-t.length,l)==t&&o.slice(c,c+n.length)==n)return{open:{pos:r-s,margin:s&&1},close:{pos:i+c,margin:c&&1}};let u,d;i-r<=2*wR?u=d=e.sliceDoc(r,i):(u=e.sliceDoc(r,r+wR),d=e.sliceDoc(i-wR,i));let f=/^\s*/.exec(u)[0].length,p=/\s*$/.exec(d)[0].length,m=d.length-p-n.length;return u.slice(f,f+t.length)==t&&d.slice(m,m+n.length)==n?{open:{pos:r+f+t.length,margin:+!!/\s/.test(u.charAt(f+t.length))},close:{pos:i-p-n.length,margin:+!!/\s/.test(d.charAt(m-1))}}:null}function Rce(e){let t=[];for(let n of e.selection.ranges){let r=e.doc.lineAt(n.from),i=n.to<=r.to?r:e.doc.lineAt(n.to);i.from>r.from&&i.from==n.to&&(i=n.to==r.to+1?r:e.doc.lineAt(n.to-1));let a=t.length-1;a>=0&&t[a].to>r.from?t[a].to=i.to:t.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:i.to})}return t}function TR(e,t,n=t.selection.ranges){let r=n.map(e=>CR(t,e.from).block);if(!r.every(e=>e))return null;let i=n.map((e,n)=>Lce(t,r[n],e.from,e.to));if(e!=2&&!i.every(e=>e))return{changes:t.changes(n.map((e,t)=>i[t]?[]:[{from:e.from,insert:r[t].open+` `},{from:e.to,insert:` `+r[t].close}]))};if(e!=1&&i.some(e=>e)){let e=[];for(let t=0,n;t<i.length;t++)if(n=i[t]){let i=r[t],{open:a,close:o}=n;e.push({from:a.pos-i.open.length,to:a.pos+a.margin},{from:o.pos-o.margin,to:o.pos+i.close.length})}return{changes:e}}return null}function zce(e,t,n=t.selection.ranges){let r=[],i=-1;ranges:for(let{from:e,to:a}of n){let n=r.length,o=1e9,s;for(let n=e;n<=a;){let c=t.doc.lineAt(n);if(s==null&&(s=CR(t,c.from).line,!s))continue ranges;if(c.from>i&&(e==a||a>c.from)){i=c.from;let e=/^\s*/.exec(c.text)[0].length,t=e==c.length,n=c.text.slice(e,e+s.length)==s?e:-1;e<c.text.length&&e<o&&(o=e),r.push({line:c,comment:n,token:s,indent:e,empty:t,single:!1})}n=c.to+1}if(o<1e9)for(let e=n;e<r.length;e++)r[e].indent<r[e].line.text.length&&(r[e].indent=o);r.length==n+1&&(r[n].single=!0)}if(e!=2&&r.some(e=>e.comment<0&&(!e.empty||e.single))){let e=[];for(let{line:t,token:n,indent:i,empty:a,single:o}of r)(o||!a)&&e.push({from:t.from+i,insert:n+` `});let n=t.changes(e);return{changes:n,selection:t.selection.map(n,1)}}else if(e!=1&&r.some(e=>e.comment>=0)){let e=[];for(let{line:t,comment:n,token:i}of r)if(n>=0){let r=t.from+n,a=r+i.length;t.text[a-t.from]==` `&&a++,e.push({from:r,to:a})}return{changes:e}}return null}var ER=ge.define(),Bce=ge.define(),Vce=ke.define(),DR=ke.define({combine(e){return se(e,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(n,r)=>e(n,r)||t(n,r)})}}),OR=l.define({create(){return zR.empty},update(e,t){let n=t.state.facet(DR),r=t.annotation(ER);if(r){let i=NR.fromTransaction(t,r.selection),a=r.side,o=a==0?e.undone:e.done;return o=i?PR(o,o.length,n.minDepth,i):LR(o,t.startState.selection),new zR(a==0?r.rest:o,a==0?o:r.rest)}let i=t.annotation(Bce);if((i==`full`||i==`before`)&&(e=e.isolate()),t.annotation(_.addToHistory)===!1)return t.changes.empty?e:e.addMapping(t.changes.desc);let a=NR.fromTransaction(t),o=t.annotation(_.time),s=t.annotation(_.userEvent);return a?e=e.addChanges(a,o,s,n,t):t.selection&&(e=e.addSelection(t.startState.selection,o,s,n.newGroupDelay)),(i==`full`||i==`after`)&&(e=e.isolate()),e},toJSON(e){return{done:e.done.map(e=>e.toJSON()),undone:e.undone.map(e=>e.toJSON())}},fromJSON(e){return new zR(e.done.map(NR.fromJSON),e.undone.map(NR.fromJSON))}});function kR(e={}){return[OR,DR.of(e),f.domEventHandlers({beforeinput(e,t){let n=e.inputType==`historyUndo`?jR:e.inputType==`historyRedo`?MR:null;return n?(e.preventDefault(),n(t)):!1}})]}function AR(e,t){return function({state:n,dispatch:r}){if(!t&&n.readOnly)return!1;let i=n.field(OR,!1);if(!i)return!1;let a=i.pop(e,n,t);return a?(r(a),!0):!1}}var jR=AR(0,!1),MR=AR(1,!1),Hce=AR(0,!0),Uce=AR(1,!0),NR=class e{constructor(e,t,n,r,i){this.changes=e,this.effects=t,this.mapped=n,this.startSelection=r,this.selectionsAfter=i}setSelAfter(t){return new e(this.changes,this.effects,this.mapped,this.startSelection,t)}toJSON(){return{changes:this.changes?.toJSON(),mapped:this.mapped?.toJSON(),startSelection:this.startSelection?.toJSON(),selectionsAfter:this.selectionsAfter.map(e=>e.toJSON())}}static fromJSON(t){return new e(t.changes&&ie.fromJSON(t.changes),[],t.mapped&&de.fromJSON(t.mapped),t.startSelection&&k.fromJSON(t.startSelection),t.selectionsAfter.map(k.fromJSON))}static fromTransaction(t,n){let r=IR;for(let e of t.startState.facet(Vce)){let n=e(t);n.length&&(r=r.concat(n))}return!r.length&&t.changes.empty?null:new e(t.changes.invert(t.startState.doc),r,void 0,n||t.startState.selection,IR)}static selection(t){return new e(void 0,IR,void 0,void 0,t)}};function PR(e,t,n,r){let i=t+1>n+20?t-n-1:0,a=e.slice(i,t);return a.push(r),a}function Wce(e,t){let n=[],r=!1;return e.iterChangedRanges((e,t)=>n.push(e,t)),t.iterChangedRanges((e,t,i,a)=>{for(let e=0;e<n.length;){let t=n[e++],o=n[e++];a>=t&&i<=o&&(r=!0)}}),r}function Gce(e,t){return e.ranges.length==t.ranges.length&&e.ranges.filter((e,n)=>e.empty!=t.ranges[n].empty).length===0}function FR(e,t){return e.length?t.length?e.concat(t):e:t}var IR=[],Kce=200;function LR(e,t){if(e.length){let n=e[e.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-Kce));return r.length&&r[r.length-1].eq(t)?e:(r.push(t),PR(e,e.length-1,1e9,n.setSelAfter(r)))}else return[NR.selection([t])]}function qce(e){let t=e[e.length-1],n=e.slice();return n[e.length-1]=t.setSelAfter(t.selectionsAfter.slice(0,t.selectionsAfter.length-1)),n}function RR(e,t){if(!e.length)return e;let n=e.length,r=IR;for(;n;){let i=Jce(e[n-1],t,r);if(i.changes&&!i.changes.empty||i.effects.length){let t=e.slice(0,n);return t[n-1]=i,t}else t=i.mapped,n--,r=i.selectionsAfter}return r.length?[NR.selection(r)]:IR}function Jce(e,t,n){let r=FR(e.selectionsAfter.length?e.selectionsAfter.map(e=>e.map(t)):IR,n);if(!e.changes)return NR.selection(r);let i=e.changes.map(t),a=t.mapDesc(e.changes,!0),o=e.mapped?e.mapped.composeDesc(a):a;return new NR(i,w.mapEffects(e.effects,t),o,e.startSelection.map(a),r)}var Yce=/^(input\.type|delete)($|\.)/,zR=class e{constructor(e,t,n=0,r=void 0){this.done=e,this.undone=t,this.prevTime=n,this.prevUserEvent=r}isolate(){return this.prevTime?new e(this.done,this.undone):this}addChanges(t,n,r,i,a){let o=this.done,s=o[o.length-1];return o=s&&s.changes&&!s.changes.empty&&t.changes&&(!r||Yce.test(r))&&(!s.selectionsAfter.length&&n-this.prevTime<i.newGroupDelay&&i.joinToEvent(a,Wce(s.changes,t.changes))||r==`input.type.compose`)?PR(o,o.length-1,i.minDepth,new NR(t.changes.compose(s.changes),FR(w.mapEffects(t.effects,s.changes),s.effects),s.mapped,s.startSelection,IR)):PR(o,o.length,i.minDepth,t),new e(o,IR,n,r)}addSelection(t,n,r,i){let a=this.done.length?this.done[this.done.length-1].selectionsAfter:IR;return a.length>0&&n-this.prevTime<i&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&Gce(a[a.length-1],t)?this:new e(LR(this.done,t),this.undone,n,r)}addMapping(t){return new e(RR(this.done,t),RR(this.undone,t),this.prevTime,this.prevUserEvent)}pop(e,t,n){let r=e==0?this.done:this.undone;if(r.length==0)return null;let i=r[r.length-1],a=i.selectionsAfter[0]||(i.startSelection?i.startSelection.map(i.changes.invertedDesc,1):t.selection);if(n&&i.selectionsAfter.length)return t.update({selection:i.selectionsAfter[i.selectionsAfter.length-1],annotations:ER.of({side:e,rest:qce(r),selection:a}),userEvent:e==0?`select.undo`:`select.redo`,scrollIntoView:!0});if(i.changes){let n=r.length==1?IR:r.slice(0,r.length-1);return i.mapped&&(n=RR(n,i.mapped)),t.update({changes:i.changes,selection:i.startSelection,effects:i.effects,annotations:ER.of({side:e,rest:n,selection:a}),filter:!1,userEvent:e==0?`undo`:`redo`,scrollIntoView:!0})}else return null}};zR.empty=new zR(IR,IR);var BR=[{key:`Mod-z`,run:jR,preventDefault:!0},{key:`Mod-y`,mac:`Mod-Shift-z`,run:MR,preventDefault:!0},{linux:`Ctrl-Shift-z`,run:MR,preventDefault:!0},{key:`Mod-u`,run:Hce,preventDefault:!0},{key:`Alt-u`,mac:`Mod-Shift-u`,run:Uce,preventDefault:!0}];function VR(e,t){return k.create(e.ranges.map(t),e.mainIndex)}function HR(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:`select`})}function UR({state:e,dispatch:t},n){let r=VR(e.selection,n);return r.eq(e.selection,!0)?!1:(t(HR(e,r)),!0)}function WR(e,t){return k.cursor(t?e.to:e.from)}function GR(e,t){return UR(e,n=>n.empty?e.moveByChar(n,t):WR(n,t))}function KR(e){return e.textDirectionAt(e.state.selection.main.head)==u.LTR}var qR=e=>GR(e,!KR(e)),JR=e=>GR(e,KR(e));function YR(e,t){return UR(e,n=>n.empty?e.moveByGroup(n,t):WR(n,t))}var Xce=e=>YR(e,!KR(e)),Zce=e=>YR(e,KR(e));typeof Intl<`u`&&Intl.Segmenter;function Qce(e,t,n){if(t.type.prop(n))return!0;let r=t.to-t.from;return r&&(r>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}function XR(e,t,n){let r=oe(e).resolveInner(t.head),i=n?p.closedBy:p.openedBy;for(let a=t.head;;){let t=n?r.childAfter(a):r.childBefore(a);if(!t)break;Qce(e,t,i)?r=t:a=n?t.to:t.from}let a=r.type.prop(i),o,s;return s=a&&(o=n?g(e,r.from,1):g(e,r.to,-1))&&o.matched?n?o.end.to:o.end.from:n?r.to:r.from,k.cursor(s,n?-1:1)}var $ce=e=>UR(e,t=>XR(e.state,t,!KR(e))),ele=e=>UR(e,t=>XR(e.state,t,KR(e)));function ZR(e,t){return UR(e,n=>{if(!n.empty)return WR(n,t);let r=e.moveVertically(n,t);return r.head==n.head?e.moveToLineBoundary(n,t):r})}var QR=e=>ZR(e,!1),$R=e=>ZR(e,!0);function ez(e){let t=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,n=0,r=0,i;if(t){for(let t of e.state.facet(f.scrollMargins)){let i=t(e);i?.top&&(n=Math.max(i?.top,n)),i?.bottom&&(r=Math.max(i?.bottom,r))}i=e.scrollDOM.clientHeight-n-r}else i=(e.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:n,marginBottom:r,selfScroll:t,height:Math.max(e.defaultLineHeight,i-5)}}function tz(e,t){let n=ez(e),{state:r}=e,i=VR(r.selection,r=>r.empty?e.moveVertically(r,t,n.height):WR(r,t));if(i.eq(r.selection))return!1;let a;if(n.selfScroll){let t=e.coordsAtPos(r.selection.main.head),o=e.scrollDOM.getBoundingClientRect(),s=o.top+n.marginTop,c=o.bottom-n.marginBottom;t&&t.top>s&&t.bottom<c&&(a=f.scrollIntoView(i.main.head,{y:`start`,yMargin:t.top-s}))}return e.dispatch(HR(r,i),{effects:a}),!0}var nz=e=>tz(e,!1),rz=e=>tz(e,!0);function iz(e,t,n){let r=e.lineBlockAt(t.head),i=e.moveToLineBoundary(t,n);if(i.head==t.head&&i.head!=(n?r.to:r.from)&&(i=e.moveToLineBoundary(t,n,!1)),!n&&i.head==r.from&&r.length){let n=/^\s*/.exec(e.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;n&&t.head!=r.from+n&&(i=k.cursor(r.from+n))}return i}var tle=e=>UR(e,t=>iz(e,t,!0)),nle=e=>UR(e,t=>iz(e,t,!1)),rle=e=>UR(e,t=>iz(e,t,!KR(e))),ile=e=>UR(e,t=>iz(e,t,KR(e))),ale=e=>UR(e,t=>k.cursor(e.lineBlockAt(t.head).from,1)),ole=e=>UR(e,t=>k.cursor(e.lineBlockAt(t.head).to,-1));function sle(e,t,n){let r=!1,i=VR(e.selection,t=>{let i=g(e,t.head,-1)||g(e,t.head,1)||t.head>0&&g(e,t.head-1,1)||t.head<e.doc.length&&g(e,t.head+1,-1);if(!i||!i.end)return t;r=!0;let a=i.start.from==t.head?i.end.to:i.end.from;return n?k.range(t.anchor,a):k.cursor(a)});return r?(t(HR(e,i)),!0):!1}var cle=({state:e,dispatch:t})=>sle(e,t,!1);function az(e,t){let n=VR(e.state.selection,e=>{let n=t(e);return k.range(e.anchor,n.head,n.goalColumn,n.bidiLevel||void 0,n.assoc)});return n.eq(e.state.selection)?!1:(e.dispatch(HR(e.state,n)),!0)}function oz(e,t){return az(e,n=>e.moveByChar(n,t))}var sz=e=>oz(e,!KR(e)),cz=e=>oz(e,KR(e));function lz(e,t){return az(e,n=>e.moveByGroup(n,t))}var lle=e=>lz(e,!KR(e)),ule=e=>lz(e,KR(e)),dle=e=>az(e,t=>XR(e.state,t,!KR(e))),fle=e=>az(e,t=>XR(e.state,t,KR(e)));function uz(e,t){return az(e,n=>e.moveVertically(n,t))}var dz=e=>uz(e,!1),fz=e=>uz(e,!0);function pz(e,t){return az(e,n=>e.moveVertically(n,t,ez(e).height))}var mz=e=>pz(e,!1),hz=e=>pz(e,!0),ple=e=>az(e,t=>iz(e,t,!0)),mle=e=>az(e,t=>iz(e,t,!1)),hle=e=>az(e,t=>iz(e,t,!KR(e))),gle=e=>az(e,t=>iz(e,t,KR(e))),_le=e=>az(e,t=>k.cursor(e.lineBlockAt(t.head).from)),vle=e=>az(e,t=>k.cursor(e.lineBlockAt(t.head).to)),gz=({state:e,dispatch:t})=>(t(HR(e,{anchor:0})),!0),_z=({state:e,dispatch:t})=>(t(HR(e,{anchor:e.doc.length})),!0),vz=({state:e,dispatch:t})=>(t(HR(e,{anchor:e.selection.main.anchor,head:0})),!0),yz=({state:e,dispatch:t})=>(t(HR(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),yle=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:`select`})),!0),ble=({state:e,dispatch:t})=>{let n=Oz(e).map(({from:t,to:n})=>k.range(t,Math.min(n+1,e.doc.length)));return t(e.update({selection:k.create(n),userEvent:`select`})),!0},xle=({state:e,dispatch:t})=>{let n=VR(e.selection,t=>{let n=oe(e),r=n.resolveStack(t.from,1);if(t.empty){let e=n.resolveStack(t.from,-1);e.node.from>=r.node.from&&e.node.to<=r.node.to&&(r=e)}for(let e=r;e;e=e.next){let{node:n}=e;if((n.from<t.from&&n.to>=t.to||n.to>t.to&&n.from<=t.from)&&e.next)return k.range(n.to,n.from)}return t});return n.eq(e.selection)?!1:(t(HR(e,n)),!0)};function bz(e,t){let{state:n}=e,r=n.selection,i=n.selection.ranges.slice();for(let r of n.selection.ranges){let a=n.doc.lineAt(r.head);if(t?a.to<e.state.doc.length:a.from>0)for(let n=r;;){let r=e.moveVertically(n,t);if(r.head<a.from||r.head>a.to){i.some(e=>e.head==r.head)||i.push(r);break}else if(r.head==n.head)break;else n=r}}return i.length==r.ranges.length?!1:(e.dispatch(HR(n,k.create(i,i.length-1))),!0)}var Sle=e=>bz(e,!1),Cle=e=>bz(e,!0),wle=({state:e,dispatch:t})=>{let n=e.selection,r=null;return n.ranges.length>1?r=k.create([n.main]):n.main.empty||(r=k.create([k.cursor(n.main.head)])),r?(t(HR(e,r)),!0):!1};function xz(e,t){if(e.state.readOnly)return!1;let n=`delete.selection`,{state:r}=e,i=r.changeByRange(r=>{let{from:i,to:a}=r;if(i==a){let o=t(r);o<i?(n=`delete.backward`,o=Sz(e,o,!1)):o>i&&(n=`delete.forward`,o=Sz(e,o,!0)),i=Math.min(i,o),a=Math.max(a,o)}else i=Sz(e,i,!1),a=Sz(e,a,!0);return i==a?{range:r}:{changes:{from:i,to:a},range:k.cursor(i,i<r.head?-1:1)}});return i.changes.empty?!1:(e.dispatch(r.update(i,{scrollIntoView:!0,userEvent:n,effects:n==`delete.selection`?f.announce.of(r.phrase(`Selection deleted`)):void 0})),!0)}function Sz(e,t,n){if(e instanceof f)for(let r of e.state.facet(f.atomicRanges).map(t=>t(e)))r.between(t,t,(e,r)=>{e<t&&r>t&&(t=n?r:e)});return t}var Cz=(e,t,n)=>xz(e,r=>{let i=r.from,{state:a}=e,o=a.doc.lineAt(i),s,c;if(n&&!t&&i>o.from&&i<o.from+200&&!/[^ \t]/.test(s=o.text.slice(0,i-o.from))){if(s[s.length-1]==` `)return i-1;let e=m(s,a.tabSize)%De(a)||De(a);for(let t=0;t<e&&s[s.length-1-t]==` `;t++)i--;c=i}else c=h(o.text,i-o.from,t,t)+o.from,c==i&&o.number!=(t?a.doc.lines:1)?c+=t?1:-1:!t&&/[\ufe00-\ufe0f]/.test(o.text.slice(c-o.from,i-o.from))&&(c=h(o.text,c-o.from,!1,!1)+o.from);return c}),wz=e=>Cz(e,!1,!0),Tz=e=>Cz(e,!0,!1),Ez=(e,t)=>xz(e,n=>{let r=n.head,{state:i}=e,a=i.doc.lineAt(r),o=i.charCategorizer(r);for(let e=null;;){if(r==(t?a.to:a.from)){r==n.head&&a.number!=(t?i.doc.lines:1)&&(r+=t?1:-1);break}let s=h(a.text,r-a.from,t)+a.from,c=a.text.slice(Math.min(r,s)-a.from,Math.max(r,s)-a.from),l=o(c);if(e!=null&&l!=e)break;(c!=` `||r!=n.head)&&(e=l),r=s}return r}),Dz=e=>Ez(e,!1),Tle=e=>Ez(e,!0),Ele=e=>xz(e,t=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),Dle=e=>xz(e,t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),Ole=e=>xz(e,t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),kle=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(e=>({changes:{from:e.from,to:e.to,insert:s.of([``,``])},range:k.cursor(e.from)}));return t(e.update(n,{scrollIntoView:!0,userEvent:`input`})),!0},Ale=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(t=>{if(!t.empty||t.from==0||t.from==e.doc.length)return{range:t};let n=t.from,r=e.doc.lineAt(n),i=n==r.from?n-1:h(r.text,n-r.from,!1)+r.from,a=n==r.to?n+1:h(r.text,n-r.from,!0)+r.from;return{changes:{from:i,to:a,insert:e.doc.slice(n,a).append(e.doc.slice(i,n))},range:k.cursor(a)}});return n.changes.empty?!1:(t(e.update(n,{scrollIntoView:!0,userEvent:`move.character`})),!0)};function Oz(e){let t=[],n=-1;for(let r of e.selection.ranges){let i=e.doc.lineAt(r.from),a=e.doc.lineAt(r.to);if(!r.empty&&r.to==a.from&&(a=e.doc.lineAt(r.to-1)),n>=i.number){let e=t[t.length-1];e.to=a.to,e.ranges.push(r)}else t.push({from:i.from,to:a.to,ranges:[r]});n=a.number+1}return t}function kz(e,t,n){if(e.readOnly)return!1;let r=[],i=[];for(let t of Oz(e)){if(n?t.to==e.doc.length:t.from==0)continue;let a=e.doc.lineAt(n?t.to+1:t.from-1),o=a.length+1;if(n){r.push({from:t.to,to:a.to},{from:t.from,insert:a.text+e.lineBreak});for(let n of t.ranges)i.push(k.range(Math.min(e.doc.length,n.anchor+o),Math.min(e.doc.length,n.head+o)))}else{r.push({from:a.from,to:t.from},{from:t.to,insert:e.lineBreak+a.text});for(let e of t.ranges)i.push(k.range(e.anchor-o,e.head-o))}}return r.length?(t(e.update({changes:r,scrollIntoView:!0,selection:k.create(i,e.selection.mainIndex),userEvent:`move.line`})),!0):!1}var jle=({state:e,dispatch:t})=>kz(e,t,!1),Mle=({state:e,dispatch:t})=>kz(e,t,!0);function Az(e,t,n){if(e.readOnly)return!1;let r=[];for(let t of Oz(e))n?r.push({from:t.from,insert:e.doc.slice(t.from,t.to)+e.lineBreak}):r.push({from:t.to,insert:e.lineBreak+e.doc.slice(t.from,t.to)});let i=e.changes(r);return t(e.update({changes:i,selection:e.selection.map(i,n?1:-1),scrollIntoView:!0,userEvent:`input.copyline`})),!0}var Nle=({state:e,dispatch:t})=>Az(e,t,!1),Ple=({state:e,dispatch:t})=>Az(e,t,!0),Fle=e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(Oz(t).map(({from:e,to:n})=>(e>0?e--:n<t.doc.length&&n++,{from:e,to:n}))),r=VR(t.selection,t=>{let n;if(e.lineWrapping){let r=e.lineBlockAt(t.head),i=e.coordsAtPos(t.head,t.assoc||1);i&&(n=r.bottom+e.documentTop-i.bottom+e.defaultLineHeight/2)}return e.moveVertically(t,!0,n)}).map(n);return e.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:`delete.line`}),!0};function Ile(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n=oe(e).resolveInner(t),r=n.childBefore(t),i=n.childAfter(t),a;return r&&i&&r.to<=t&&i.from>=t&&(a=r.type.prop(p.closedBy))&&a.indexOf(i.name)>-1&&e.doc.lineAt(r.to).from==e.doc.lineAt(i.from).from&&!/\S/.test(e.sliceDoc(r.to,i.from))?{from:r.to,to:i.from}:null}var jz=Mz(!1),Lle=Mz(!0);function Mz(e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let r=t.changeByRange(n=>{let{from:r,to:i}=n,a=t.doc.lineAt(r),o=!e&&r==i&&Ile(t,r);e&&(r=i=(i<=a.to?a:t.doc.lineAt(i)).to);let c=new fe(t,{simulateBreak:r,simulateDoubleBreak:!!o}),l=x(c,r);for(l??=m(/^\s*/.exec(t.doc.lineAt(r).text)[0],t.tabSize);i<a.to&&/\s/.test(a.text[i-a.from]);)i++;o?{from:r,to:i}=o:r>a.from&&r<a.from+100&&!/\S/.test(a.text.slice(0,r))&&(r=a.from);let u=[``,C(t,l)];return o&&u.push(C(t,c.lineIndent(a.from,-1))),{changes:{from:r,to:i,insert:s.of(u)},range:k.cursor(r+1+u[1].length)}});return n(t.update(r,{scrollIntoView:!0,userEvent:`input`})),!0}}function Nz(e,t){let n=-1;return e.changeByRange(r=>{let i=[];for(let a=r.from;a<=r.to;){let o=e.doc.lineAt(a);o.number>n&&(r.empty||r.to>o.from)&&(t(o,i,r),n=o.number),a=o.to+1}let a=e.changes(i);return{changes:i,range:k.range(a.mapPos(r.anchor,1),a.mapPos(r.head,1))}})}var Rle=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),r=new fe(e,{overrideIndentation:e=>n[e]??-1}),i=Nz(e,(t,i,a)=>{let o=x(r,t.from);if(o==null)return;/\S/.test(t.text)||(o=0);let s=/^\s*/.exec(t.text)[0],c=C(e,o);(s!=c||a.from<t.from+s.length)&&(n[t.from]=o,i.push({from:t.from,to:t.from+s.length,insert:c}))});return i.changes.empty||t(e.update(i,{userEvent:`indent`})),!0},Pz=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(Nz(e,(t,n)=>{n.push({from:t.from,insert:e.facet(c)})}),{userEvent:`input.indent`})),!0),Fz=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(Nz(e,(t,n)=>{let r=/^\s*/.exec(t.text)[0];if(!r)return;let i=m(r,e.tabSize),a=0,o=C(e,Math.max(0,i-De(e)));for(;a<r.length&&a<o.length&&r.charCodeAt(a)==o.charCodeAt(a);)a++;n.push({from:t.from+a,to:t.from+r.length,insert:o.slice(a)})}),{userEvent:`delete.dedent`})),!0),zle=e=>(e.setTabFocusMode(),!0),Ble=[{key:`Ctrl-b`,run:qR,shift:sz,preventDefault:!0},{key:`Ctrl-f`,run:JR,shift:cz},{key:`Ctrl-p`,run:QR,shift:dz},{key:`Ctrl-n`,run:$R,shift:fz},{key:`Ctrl-a`,run:ale,shift:_le},{key:`Ctrl-e`,run:ole,shift:vle},{key:`Ctrl-d`,run:Tz},{key:`Ctrl-h`,run:wz},{key:`Ctrl-k`,run:Ele},{key:`Ctrl-Alt-h`,run:Dz},{key:`Ctrl-o`,run:kle},{key:`Ctrl-t`,run:Ale},{key:`Ctrl-v`,run:rz}],Vle=[{key:`ArrowLeft`,run:qR,shift:sz,preventDefault:!0},{key:`Mod-ArrowLeft`,mac:`Alt-ArrowLeft`,run:Xce,shift:lle,preventDefault:!0},{mac:`Cmd-ArrowLeft`,run:rle,shift:hle,preventDefault:!0},{key:`ArrowRight`,run:JR,shift:cz,preventDefault:!0},{key:`Mod-ArrowRight`,mac:`Alt-ArrowRight`,run:Zce,shift:ule,preventDefault:!0},{mac:`Cmd-ArrowRight`,run:ile,shift:gle,preventDefault:!0},{key:`ArrowUp`,run:QR,shift:dz,preventDefault:!0},{mac:`Cmd-ArrowUp`,run:gz,shift:vz},{mac:`Ctrl-ArrowUp`,run:nz,shift:mz},{key:`ArrowDown`,run:$R,shift:fz,preventDefault:!0},{mac:`Cmd-ArrowDown`,run:_z,shift:yz},{mac:`Ctrl-ArrowDown`,run:rz,shift:hz},{key:`PageUp`,run:nz,shift:mz},{key:`PageDown`,run:rz,shift:hz},{key:`Home`,run:nle,shift:mle,preventDefault:!0},{key:`Mod-Home`,run:gz,shift:vz},{key:`End`,run:tle,shift:ple,preventDefault:!0},{key:`Mod-End`,run:_z,shift:yz},{key:`Enter`,run:jz,shift:jz},{key:`Mod-a`,run:yle},{key:`Backspace`,run:wz,shift:wz,preventDefault:!0},{key:`Delete`,run:Tz,preventDefault:!0},{key:`Mod-Backspace`,mac:`Alt-Backspace`,run:Dz,preventDefault:!0},{key:`Mod-Delete`,mac:`Alt-Delete`,run:Tle,preventDefault:!0},{mac:`Mod-Backspace`,run:Dle,preventDefault:!0},{mac:`Mod-Delete`,run:Ole,preventDefault:!0}].concat(Ble.map(e=>({mac:e.key,run:e.run,shift:e.shift}))),Iz=[{key:`Alt-ArrowLeft`,mac:`Ctrl-ArrowLeft`,run:$ce,shift:dle},{key:`Alt-ArrowRight`,mac:`Ctrl-ArrowRight`,run:ele,shift:fle},{key:`Alt-ArrowUp`,run:jle},{key:`Shift-Alt-ArrowUp`,run:Nle},{key:`Alt-ArrowDown`,run:Mle},{key:`Shift-Alt-ArrowDown`,run:Ple},{key:`Mod-Alt-ArrowUp`,run:Sle},{key:`Mod-Alt-ArrowDown`,run:Cle},{key:`Escape`,run:wle},{key:`Mod-Enter`,run:Lle},{key:`Alt-l`,mac:`Ctrl-l`,run:ble},{key:`Mod-i`,run:xle,preventDefault:!0},{key:`Mod-[`,run:Fz},{key:`Mod-]`,run:Pz},{key:`Mod-Alt-\\`,run:Rle},{key:`Shift-Mod-k`,run:Fle},{key:`Shift-Mod-\\`,run:cle},{key:`Mod-/`,run:Nce},{key:`Alt-A`,run:Fce},{key:`Ctrl-m`,mac:`Shift-Alt-m`,run:zle}].concat(Vle),Hle={key:`Tab`,run:Pz,shift:Fz};function Ule(e,t,n,r){let i=Rl(Vw),a=Bl(kT),o=L.useRef(null),{lexicalNode:s}=OL(),c=L.useRef(!1),l=L.useRef(!1),u=L.useCallback(()=>{a({editorType:t,rootNode:s,editorRef:o.current})},[t,s,a]),d=L.useCallback(t=>{if(t.key===`ArrowDown`){let t=o.current?.getCodemirror()?.state;t&&t.doc.length===t.selection.ranges[0].to&&(c.current?(i?.update(()=>{var t;let n=Dh(e);n.getNextSibling()?((t=o.current?.getCodemirror())==null||t.contentDOM.blur(),n.selectNext()):n.insertAfter($m())}),c.current=!1):c.current=!0)}else if(t.key===`ArrowUp`){let t=o.current?.getCodemirror()?.state;t&&t.selection.ranges[0].from===0&&(l.current?(i?.update(()=>{var t;let n=Dh(e);n.getPreviousSibling()&&((t=o.current?.getCodemirror())==null||t.contentDOM.blur(),n.selectPrevious())}),l.current=!1):l.current=!0)}else t.key===`Enter`?t.stopPropagation():(t.key===`Backspace`||t.key===`Delete`)&&(o.current?.getCodemirror()?.state)?.doc.length===0&&i?.update(()=>{Dh(e).remove()})},[i,e]);return L.useEffect(()=>{let e=o.current;return setTimeout(()=>{var t,n;(t=e?.getCodemirror())==null||t.contentDOM.addEventListener(`focus`,u),(n=e?.getCodemirror())==null||n.contentDOM.addEventListener(`keydown`,d)},300),()=>{var t,n;(t=e?.getCodemirror())==null||t.contentDOM.removeEventListener(`focus`,u),(n=e?.getCodemirror())==null||n.contentDOM.removeEventListener(`keydown`,d)}},[o,u,d,n]),L.useEffect(()=>{r.subscribe(()=>{var e;(e=o.current?.getCodemirror())==null||e.focus(),u()})},[r,o,e,u]),o}function X(e){return new me(N.define(e))}function Lz(e){return Y(()=>import(`./dist-BiBY_4CK.js`).then(t=>t.sql({dialect:t[e]})),__vite__mapDeps([0,1,2]))}var Wle=[A.of({name:`C`,extensions:[`c`,`h`,`ino`],load(){return Y(()=>import(`./dist-C5YJOwhH.js`).then(e=>e.cpp()),__vite__mapDeps([3,1,2]))}}),A.of({name:`C++`,alias:[`cpp`],extensions:[`cpp`,`c++`,`cc`,`cxx`,`hpp`,`h++`,`hh`,`hxx`],load(){return Y(()=>import(`./dist-C5YJOwhH.js`).then(e=>e.cpp()),__vite__mapDeps([3,1,2]))}}),A.of({name:`CQL`,alias:[`cassandra`],extensions:[`cql`],load(){return Lz(`Cassandra`)}}),A.of({name:`CSS`,extensions:[`css`],load(){return Y(()=>import(`./dist-CKM5j-iy.js`).then(e=>e.i).then(e=>e.css()),__vite__mapDeps([4,5,1,2]))}}),A.of({name:`Go`,extensions:[`go`],load(){return Y(()=>import(`./dist-BEStK5um.js`).then(e=>e.go()),__vite__mapDeps([6,1,2]))}}),A.of({name:`HTML`,alias:[`xhtml`],extensions:[`html`,`htm`,`handlebars`,`hbs`],load(){return Y(()=>import(`./dist-B9sopUkn.js`).then(e=>e.html()),__vite__mapDeps([7,4,5,1,2,8]))}}),A.of({name:`Java`,extensions:[`java`],load(){return Y(()=>import(`./dist--55mTWk3.js`).then(e=>e.java()),__vite__mapDeps([9,1,2]))}}),A.of({name:`JavaScript`,alias:[`ecmascript`,`js`,`node`],extensions:[`js`,`mjs`,`cjs`],load(){return Y(()=>import(`./dist-DPLEwPsG.js`).then(e=>e.t).then(e=>e.javascript()),__vite__mapDeps([8,5,1,2]))}}),A.of({name:`Jinja`,extensions:[`j2`,`jinja`,`jinja2`],load(){return Y(()=>import(`./dist-BDQhMN_4.js`).then(e=>e.jinja()),__vite__mapDeps([10,7,4,5,1,2,8]))}}),A.of({name:`JSON`,alias:[`json5`],extensions:[`json`,`map`],load(){return Y(()=>import(`./dist-BZ39rB1W.js`).then(e=>e.json()),__vite__mapDeps([11,1,2]))}}),A.of({name:`JSX`,extensions:[`jsx`],load(){return Y(()=>import(`./dist-DPLEwPsG.js`).then(e=>e.t).then(e=>e.javascript({jsx:!0})),__vite__mapDeps([8,5,1,2]))}}),A.of({name:`LESS`,extensions:[`less`],load(){return Y(()=>import(`./dist-C5oXtFSP.js`).then(e=>e.less()),__vite__mapDeps([12,4,5,1,2]))}}),A.of({name:`Liquid`,extensions:[`liquid`],load(){return Y(()=>import(`./dist-C2OyzisT.js`).then(e=>e.liquid()),__vite__mapDeps([13,7,4,5,1,2,8]))}}),A.of({name:`MariaDB SQL`,load(){return Lz(`MariaSQL`)}}),A.of({name:`Markdown`,extensions:[`md`,`markdown`,`mkd`],load(){return Y(()=>import(`./dist-C9stINOY.js`).then(e=>e.markdown()),__vite__mapDeps([14,7,4,5,1,2,8]))}}),A.of({name:`MS SQL`,load(){return Lz(`MSSQL`)}}),A.of({name:`MySQL`,load(){return Lz(`MySQL`)}}),A.of({name:`PHP`,extensions:[`php`,`php3`,`php4`,`php5`,`php7`,`phtml`],load(){return Y(()=>import(`./dist-CtSZyFkJ.js`).then(e=>e.php()),__vite__mapDeps([15,7,4,5,1,2,8]))}}),A.of({name:`PLSQL`,extensions:[`pls`],load(){return Lz(`PLSQL`)}}),A.of({name:`PostgreSQL`,load(){return Lz(`PostgreSQL`)}}),A.of({name:`Python`,extensions:[`BUILD`,`bzl`,`py`,`pyw`],filename:/^(BUCK|BUILD)$/,load(){return Y(()=>import(`./dist-DRTq4wrN.js`).then(e=>e.python()),__vite__mapDeps([16,1,2]))}}),A.of({name:`Rust`,extensions:[`rs`],load(){return Y(()=>import(`./dist-CUp9us2q.js`).then(e=>e.rust()),__vite__mapDeps([17,1,2]))}}),A.of({name:`Sass`,extensions:[`sass`],load(){return Y(()=>import(`./dist-DSKQpPaz.js`).then(e=>e.sass({indented:!0})),__vite__mapDeps([18,4,5,1,2]))}}),A.of({name:`SCSS`,extensions:[`scss`],load(){return Y(()=>import(`./dist-DSKQpPaz.js`).then(e=>e.sass()),__vite__mapDeps([18,4,5,1,2]))}}),A.of({name:`SQL`,extensions:[`sql`],load(){return Lz(`StandardSQL`)}}),A.of({name:`SQLite`,load(){return Lz(`SQLite`)}}),A.of({name:`TSX`,extensions:[`tsx`],load(){return Y(()=>import(`./dist-DPLEwPsG.js`).then(e=>e.t).then(e=>e.javascript({jsx:!0,typescript:!0})),__vite__mapDeps([8,5,1,2]))}}),A.of({name:`TypeScript`,alias:[`ts`],extensions:[`ts`,`mts`,`cts`],load(){return Y(()=>import(`./dist-DPLEwPsG.js`).then(e=>e.t).then(e=>e.javascript({typescript:!0})),__vite__mapDeps([8,5,1,2]))}}),A.of({name:`WebAssembly`,extensions:[`wat`,`wast`],load(){return Y(()=>import(`./dist-CZ9T4Cly.js`).then(e=>e.wast()),__vite__mapDeps([19,1,2]))}}),A.of({name:`XML`,alias:[`rss`,`wsdl`,`xsd`],extensions:[`xml`,`xsl`,`xsd`,`svg`],load(){return Y(()=>import(`./dist-Zqt9kNG9.js`).then(e=>e.xml()),__vite__mapDeps([20,1,2]))}}),A.of({name:`YAML`,alias:[`yml`],extensions:[`yaml`,`yml`],load(){return Y(()=>import(`./dist-BsedZGJo.js`).then(e=>e.yaml()),__vite__mapDeps([21,1,2]))}}),A.of({name:`APL`,extensions:[`dyalog`,`apl`],load(){return Y(()=>import(`./apl-BxEMbctQ.js`).then(e=>X(e.apl)),[])}}),A.of({name:`PGP`,alias:[`asciiarmor`],extensions:[`asc`,`pgp`,`sig`],load(){return Y(()=>import(`./asciiarmor-eFjeGRuZ.js`).then(e=>X(e.asciiArmor)),[])}}),A.of({name:`ASN.1`,extensions:[`asn`,`asn1`],load(){return Y(()=>import(`./asn1-Cfx-0pt9.js`).then(e=>X(e.asn1({}))),[])}}),A.of({name:`Asterisk`,filename:/^extensions\.conf$/i,load(){return Y(()=>import(`./asterisk-B5BHTsBr.js`).then(e=>X(e.asterisk)),[])}}),A.of({name:`Brainfuck`,extensions:[`b`,`bf`],load(){return Y(()=>import(`./brainfuck-CAA2xofr.js`).then(e=>X(e.brainfuck)),[])}}),A.of({name:`Cobol`,extensions:[`cob`,`cpy`],load(){return Y(()=>import(`./cobol-BfgHZgup.js`).then(e=>X(e.cobol)),[])}}),A.of({name:`C#`,alias:[`csharp`,`cs`],extensions:[`cs`],load(){return Y(()=>import(`./clike-BoDCOLzN.js`).then(e=>X(e.csharp)),[])}}),A.of({name:`Clojure`,extensions:[`clj`,`cljc`,`cljx`],load(){return Y(()=>import(`./clojure-kVFSWX0o.js`).then(e=>X(e.clojure)),[])}}),A.of({name:`ClojureScript`,extensions:[`cljs`],load(){return Y(()=>import(`./clojure-kVFSWX0o.js`).then(e=>X(e.clojure)),[])}}),A.of({name:`Closure Stylesheets (GSS)`,extensions:[`gss`],load(){return Y(()=>import(`./css-BqOeyZOV.js`).then(e=>X(e.gss)),[])}}),A.of({name:`CMake`,extensions:[`cmake`,`cmake.in`],filename:/^CMakeLists\.txt$/,load(){return Y(()=>import(`./cmake-BUPAhezI.js`).then(e=>X(e.cmake)),[])}}),A.of({name:`CoffeeScript`,alias:[`coffee`,`coffee-script`],extensions:[`coffee`],load(){return Y(()=>import(`./coffeescript-G1Pe_1AZ.js`).then(e=>X(e.coffeeScript)),[])}}),A.of({name:`Common Lisp`,alias:[`lisp`],extensions:[`cl`,`lisp`,`el`],load(){return Y(()=>import(`./commonlisp-B3N0CjHn.js`).then(e=>X(e.commonLisp)),[])}}),A.of({name:`Cypher`,extensions:[`cyp`,`cypher`],load(){return Y(()=>import(`./cypher-KjIKv-wW.js`).then(e=>X(e.cypher)),[])}}),A.of({name:`Cython`,extensions:[`pyx`,`pxd`,`pxi`],load(){return Y(()=>import(`./python-C2_X1GpX.js`).then(e=>X(e.cython)),[])}}),A.of({name:`Crystal`,extensions:[`cr`],load(){return Y(()=>import(`./crystal-C15ndaGM.js`).then(e=>X(e.crystal)),[])}}),A.of({name:`D`,extensions:[`d`],load(){return Y(()=>import(`./d-BlT5AEC-.js`).then(e=>X(e.d)),[])}}),A.of({name:`Dart`,extensions:[`dart`],load(){return Y(()=>import(`./clike-BoDCOLzN.js`).then(e=>X(e.dart)),[])}}),A.of({name:`diff`,extensions:[`diff`,`patch`],load(){return Y(()=>import(`./diff-oF98tbqj.js`).then(e=>X(e.diff)),[])}}),A.of({name:`Dockerfile`,filename:/^Dockerfile$/,load(){return Y(()=>import(`./dockerfile-CUaqzcqp.js`).then(e=>X(e.dockerFile)),__vite__mapDeps([22,23]))}}),A.of({name:`DTD`,extensions:[`dtd`],load(){return Y(()=>import(`./dtd-VCA9yr61.js`).then(e=>X(e.dtd)),[])}}),A.of({name:`Dylan`,extensions:[`dylan`,`dyl`,`intr`],load(){return Y(()=>import(`./dylan-O-V5Dw5W.js`).then(e=>X(e.dylan)),[])}}),A.of({name:`EBNF`,load(){return Y(()=>import(`./ebnf-SPmdBkvT.js`).then(e=>X(e.ebnf)),[])}}),A.of({name:`ECL`,extensions:[`ecl`],load(){return Y(()=>import(`./ecl-ChfCttfI.js`).then(e=>X(e.ecl)),[])}}),A.of({name:`edn`,extensions:[`edn`],load(){return Y(()=>import(`./clojure-kVFSWX0o.js`).then(e=>X(e.clojure)),[])}}),A.of({name:`Eiffel`,extensions:[`e`],load(){return Y(()=>import(`./eiffel-cB9EbjeN.js`).then(e=>X(e.eiffel)),[])}}),A.of({name:`Elm`,extensions:[`elm`],load(){return Y(()=>import(`./elm-BTiVflBU.js`).then(e=>X(e.elm)),[])}}),A.of({name:`Erlang`,extensions:[`erl`],load(){return Y(()=>import(`./erlang-egf0TXFm.js`).then(e=>X(e.erlang)),[])}}),A.of({name:`Esper`,load(){return Y(()=>import(`./sql-D_dieYbr.js`).then(e=>X(e.esper)),[])}}),A.of({name:`Factor`,extensions:[`factor`],load(){return Y(()=>import(`./factor-C2tAxNob.js`).then(e=>X(e.factor)),__vite__mapDeps([24,23]))}}),A.of({name:`FCL`,load(){return Y(()=>import(`./fcl-BiCjh1tj.js`).then(e=>X(e.fcl)),[])}}),A.of({name:`Forth`,extensions:[`forth`,`fth`,`4th`],load(){return Y(()=>import(`./forth-C4kDGW6u.js`).then(e=>X(e.forth)),[])}}),A.of({name:`Fortran`,extensions:[`f`,`for`,`f77`,`f90`,`f95`],load(){return Y(()=>import(`./fortran-DzkLaPnd.js`).then(e=>X(e.fortran)),[])}}),A.of({name:`F#`,alias:[`fsharp`],extensions:[`fs`],load(){return Y(()=>import(`./mllike-wTFlPWXS.js`).then(e=>X(e.fSharp)),[])}}),A.of({name:`Gas`,extensions:[`s`],load(){return Y(()=>import(`./gas-DMOxskQF.js`).then(e=>X(e.gas)),[])}}),A.of({name:`Gherkin`,extensions:[`feature`],load(){return Y(()=>import(`./gherkin-BPxBpp-k.js`).then(e=>X(e.gherkin)),[])}}),A.of({name:`Groovy`,extensions:[`groovy`,`gradle`],filename:/^Jenkinsfile$/,load(){return Y(()=>import(`./groovy-CkEnc0ZY.js`).then(e=>X(e.groovy)),[])}}),A.of({name:`Haskell`,extensions:[`hs`],load(){return Y(()=>import(`./haskell-Dadpo9-w.js`).then(e=>X(e.haskell)),[])}}),A.of({name:`Haxe`,extensions:[`hx`],load(){return Y(()=>import(`./haxe-CDNZL9MW.js`).then(e=>X(e.haxe)),[])}}),A.of({name:`HXML`,extensions:[`hxml`],load(){return Y(()=>import(`./haxe-CDNZL9MW.js`).then(e=>X(e.hxml)),[])}}),A.of({name:`HTTP`,load(){return Y(()=>import(`./http-jy9Zxxt3.js`).then(e=>X(e.http)),[])}}),A.of({name:`IDL`,extensions:[`pro`],load(){return Y(()=>import(`./idl-CGSB6iiy.js`).then(e=>X(e.idl)),[])}}),A.of({name:`JSON-LD`,alias:[`jsonld`],extensions:[`jsonld`],load(){return Y(()=>import(`./javascript-DSlzRUd8.js`).then(e=>X(e.jsonld)),[])}}),A.of({name:`Julia`,extensions:[`jl`],load(){return Y(()=>import(`./julia-DTiF9v6R.js`).then(e=>X(e.julia)),[])}}),A.of({name:`Kotlin`,extensions:[`kt`,`kts`],load(){return Y(()=>import(`./clike-BoDCOLzN.js`).then(e=>X(e.kotlin)),[])}}),A.of({name:`LiveScript`,alias:[`ls`],extensions:[`ls`],load(){return Y(()=>import(`./livescript-Ci8Xxna6.js`).then(e=>X(e.liveScript)),[])}}),A.of({name:`Lua`,extensions:[`lua`],load(){return Y(()=>import(`./lua-eVxIrt9t.js`).then(e=>X(e.lua)),[])}}),A.of({name:`mIRC`,extensions:[`mrc`],load(){return Y(()=>import(`./mirc-CtHu9S1B.js`).then(e=>X(e.mirc)),[])}}),A.of({name:`Mathematica`,extensions:[`m`,`nb`,`wl`,`wls`],load(){return Y(()=>import(`./mathematica-Da3grj36.js`).then(e=>X(e.mathematica)),[])}}),A.of({name:`Modelica`,extensions:[`mo`],load(){return Y(()=>import(`./modelica-cKbQ0UXu.js`).then(e=>X(e.modelica)),[])}}),A.of({name:`MUMPS`,extensions:[`mps`],load(){return Y(()=>import(`./mumps-CKBHkOQq.js`).then(e=>X(e.mumps)),[])}}),A.of({name:`Mbox`,extensions:[`mbox`],load(){return Y(()=>import(`./mbox-BWBMSafM.js`).then(e=>X(e.mbox)),[])}}),A.of({name:`Nginx`,filename:/nginx.*\.conf$/i,load(){return Y(()=>import(`./nginx-B00AiQel.js`).then(e=>X(e.nginx)),[])}}),A.of({name:`NSIS`,extensions:[`nsh`,`nsi`],load(){return Y(()=>import(`./nsis-SMDwKltR.js`).then(e=>X(e.nsis)),__vite__mapDeps([25,23]))}}),A.of({name:`NTriples`,extensions:[`nt`,`nq`],load(){return Y(()=>import(`./ntriples-B_36EBV0.js`).then(e=>X(e.ntriples)),[])}}),A.of({name:`Objective-C`,alias:[`objective-c`,`objc`],extensions:[`m`],load(){return Y(()=>import(`./clike-BoDCOLzN.js`).then(e=>X(e.objectiveC)),[])}}),A.of({name:`Objective-C++`,alias:[`objective-c++`,`objc++`],extensions:[`mm`],load(){return Y(()=>import(`./clike-BoDCOLzN.js`).then(e=>X(e.objectiveCpp)),[])}}),A.of({name:`OCaml`,extensions:[`ml`,`mli`,`mll`,`mly`],load(){return Y(()=>import(`./mllike-wTFlPWXS.js`).then(e=>X(e.oCaml)),[])}}),A.of({name:`Octave`,extensions:[`m`],load(){return Y(()=>import(`./octave-BXPjzAif.js`).then(e=>X(e.octave)),[])}}),A.of({name:`Oz`,extensions:[`oz`],load(){return Y(()=>import(`./oz-Dedpat1M.js`).then(e=>X(e.oz)),[])}}),A.of({name:`Pascal`,extensions:[`p`,`pas`],load(){return Y(()=>import(`./pascal-CMcUg72K.js`).then(e=>X(e.pascal)),[])}}),A.of({name:`Perl`,extensions:[`pl`,`pm`],load(){return Y(()=>import(`./perl-DoVTbnzt.js`).then(e=>X(e.perl)),[])}}),A.of({name:`Pig`,extensions:[`pig`],load(){return Y(()=>import(`./pig-CULXT1YV.js`).then(e=>X(e.pig)),[])}}),A.of({name:`PowerShell`,extensions:[`ps1`,`psd1`,`psm1`],load(){return Y(()=>import(`./powershell-Cv5Uhf6b.js`).then(e=>X(e.powerShell)),[])}}),A.of({name:`Properties files`,alias:[`ini`,`properties`],extensions:[`properties`,`ini`,`in`],load(){return Y(()=>import(`./properties-CQ1C2P-M.js`).then(e=>X(e.properties)),[])}}),A.of({name:`ProtoBuf`,extensions:[`proto`],load(){return Y(()=>import(`./protobuf-SRlvzrl6.js`).then(e=>X(e.protobuf)),[])}}),A.of({name:`Pug`,alias:[`jade`],extensions:[`pug`,`jade`],load(){return Y(()=>import(`./pug-Bo3wfL-f.js`).then(e=>X(e.pug)),__vite__mapDeps([26,27]))}}),A.of({name:`Puppet`,extensions:[`pp`],load(){return Y(()=>import(`./puppet-ClSqCGj6.js`).then(e=>X(e.puppet)),[])}}),A.of({name:`Q`,extensions:[`q`],load(){return Y(()=>import(`./q-B_6Gdyzl.js`).then(e=>X(e.q)),[])}}),A.of({name:`R`,alias:[`rscript`],extensions:[`r`,`R`],load(){return Y(()=>import(`./r-BD07NGED.js`).then(e=>X(e.r)),[])}}),A.of({name:`RPM Changes`,load(){return Y(()=>import(`./rpm-CRu5Z2Jl.js`).then(e=>X(e.rpmChanges)),[])}}),A.of({name:`RPM Spec`,extensions:[`spec`],load(){return Y(()=>import(`./rpm-CRu5Z2Jl.js`).then(e=>X(e.rpmSpec)),[])}}),A.of({name:`Ruby`,alias:[`jruby`,`macruby`,`rake`,`rb`,`rbx`],extensions:[`rb`],filename:/^(Gemfile|Rakefile)$/,load(){return Y(()=>import(`./ruby-dZPnOz8h.js`).then(e=>X(e.ruby)),[])}}),A.of({name:`SAS`,extensions:[`sas`],load(){return Y(()=>import(`./sas-S2t8_sDI.js`).then(e=>X(e.sas)),[])}}),A.of({name:`Scala`,extensions:[`scala`],load(){return Y(()=>import(`./clike-BoDCOLzN.js`).then(e=>X(e.scala)),[])}}),A.of({name:`Scheme`,extensions:[`scm`,`ss`],load(){return Y(()=>import(`./scheme-WcyFWLW2.js`).then(e=>X(e.scheme)),[])}}),A.of({name:`Shell`,alias:[`bash`,`sh`,`zsh`],extensions:[`sh`,`ksh`,`bash`],filename:/^PKGBUILD$/,load(){return Y(()=>import(`./shell-DUelnYSh.js`).then(e=>X(e.shell)),[])}}),A.of({name:`Sieve`,extensions:[`siv`,`sieve`],load(){return Y(()=>import(`./sieve-jDjlVhNh.js`).then(e=>X(e.sieve)),[])}}),A.of({name:`Smalltalk`,extensions:[`st`],load(){return Y(()=>import(`./smalltalk-ddWDYy10.js`).then(e=>X(e.smalltalk)),[])}}),A.of({name:`Solr`,load(){return Y(()=>import(`./solr-C7rQhLuW.js`).then(e=>X(e.solr)),[])}}),A.of({name:`SML`,extensions:[`sml`,`sig`,`fun`,`smackspec`],load(){return Y(()=>import(`./mllike-wTFlPWXS.js`).then(e=>X(e.sml)),[])}}),A.of({name:`SPARQL`,alias:[`sparul`],extensions:[`rq`,`sparql`],load(){return Y(()=>import(`./sparql--fPCCgVd.js`).then(e=>X(e.sparql)),[])}}),A.of({name:`Spreadsheet`,alias:[`excel`,`formula`],load(){return Y(()=>import(`./spreadsheet-DjthqD5G.js`).then(e=>X(e.spreadsheet)),[])}}),A.of({name:`Squirrel`,extensions:[`nut`],load(){return Y(()=>import(`./clike-BoDCOLzN.js`).then(e=>X(e.squirrel)),[])}}),A.of({name:`Stylus`,extensions:[`styl`],load(){return Y(()=>import(`./stylus-DxF70RNr.js`).then(e=>X(e.stylus)),[])}}),A.of({name:`Swift`,extensions:[`swift`],load(){return Y(()=>import(`./swift-T0hDoOb-.js`).then(e=>X(e.swift)),[])}}),A.of({name:`sTeX`,load(){return Y(()=>import(`./stex-rHcFYcA0.js`).then(e=>X(e.stex)),[])}}),A.of({name:`LaTeX`,alias:[`tex`],extensions:[`text`,`ltx`,`tex`],load(){return Y(()=>import(`./stex-rHcFYcA0.js`).then(e=>X(e.stex)),[])}}),A.of({name:`SystemVerilog`,extensions:[`v`,`sv`,`svh`],load(){return Y(()=>import(`./verilog-BJOO83gk.js`).then(e=>X(e.verilog)),[])}}),A.of({name:`Tcl`,extensions:[`tcl`],load(){return Y(()=>import(`./tcl-Dlzy1mPk.js`).then(e=>X(e.tcl)),[])}}),A.of({name:`Textile`,extensions:[`textile`],load(){return Y(()=>import(`./textile-Dy5rFZe5.js`).then(e=>X(e.textile)),[])}}),A.of({name:`TiddlyWiki`,load(){return Y(()=>import(`./tiddlywiki-DQP1OymS.js`).then(e=>X(e.tiddlyWiki)),[])}}),A.of({name:`Tiki wiki`,load(){return Y(()=>import(`./tiki-0vOj3DB2.js`).then(e=>X(e.tiki)),[])}}),A.of({name:`TOML`,extensions:[`toml`],load(){return Y(()=>import(`./toml-DEltN0lI.js`).then(e=>X(e.toml)),[])}}),A.of({name:`Troff`,extensions:[`1`,`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`],load(){return Y(()=>import(`./troff-CRbBpEqY.js`).then(e=>X(e.troff)),[])}}),A.of({name:`TTCN`,extensions:[`ttcn`,`ttcn3`,`ttcnpp`],load(){return Y(()=>import(`./ttcn-M5q1nLKg.js`).then(e=>X(e.ttcn)),[])}}),A.of({name:`TTCN_CFG`,extensions:[`cfg`],load(){return Y(()=>import(`./ttcn-cfg-Rmw9NWq9.js`).then(e=>X(e.ttcnCfg)),[])}}),A.of({name:`Turtle`,extensions:[`ttl`],load(){return Y(()=>import(`./turtle-BCDWhJK0.js`).then(e=>X(e.turtle)),[])}}),A.of({name:`Web IDL`,extensions:[`webidl`],load(){return Y(()=>import(`./webidl-Ddy6hbV6.js`).then(e=>X(e.webIDL)),[])}}),A.of({name:`VB.NET`,extensions:[`vb`],load(){return Y(()=>import(`./vb-QQ7LGlOz.js`).then(e=>X(e.vb)),[])}}),A.of({name:`VBScript`,extensions:[`vbs`],load(){return Y(()=>import(`./vbscript-BiSEdUzz.js`).then(e=>X(e.vbScript)),[])}}),A.of({name:`Velocity`,extensions:[`vtl`],load(){return Y(()=>import(`./velocity-CzMg5_6w.js`).then(e=>X(e.velocity)),[])}}),A.of({name:`Verilog`,extensions:[`v`],load(){return Y(()=>import(`./verilog-BJOO83gk.js`).then(e=>X(e.verilog)),[])}}),A.of({name:`VHDL`,extensions:[`vhd`,`vhdl`],load(){return Y(()=>import(`./vhdl-ed4zAZAA.js`).then(e=>X(e.vhdl)),[])}}),A.of({name:`XQuery`,extensions:[`xy`,`xquery`,`xq`,`xqm`,`xqy`],load(){return Y(()=>import(`./xquery-Bw1zwhh6.js`).then(e=>X(e.xQuery)),[])}}),A.of({name:`Yacas`,extensions:[`ys`],load(){return Y(()=>import(`./yacas-DZdTXy3s.js`).then(e=>X(e.yacas)),[])}}),A.of({name:`Z80`,extensions:[`z80`],load(){return Y(()=>import(`./z80-DMG02_YV.js`).then(e=>X(e.z80)),[])}}),A.of({name:`MscGen`,extensions:[`mscgen`,`mscin`,`msc`],load(){return Y(()=>import(`./mscgen-C5pXQCMK.js`).then(e=>X(e.mscgen)),[])}}),A.of({name:`Xù`,extensions:[`xu`],load(){return Y(()=>import(`./mscgen-C5pXQCMK.js`).then(e=>X(e.xu)),[])}}),A.of({name:`MsGenny`,extensions:[`msgenny`],load(){return Y(()=>import(`./mscgen-C5pXQCMK.js`).then(e=>X(e.msgenny)),[])}}),A.of({name:`Vue`,extensions:[`vue`],load(){return Y(()=>import(`./dist-F2W_jRom.js`).then(e=>e.vue()),__vite__mapDeps([28,7,4,5,1,2,8]))}}),A.of({name:`Angular Template`,load(){return Y(()=>import(`./dist-CQKLsKIo.js`).then(e=>e.angular()),__vite__mapDeps([29,7,4,5,1,2,8]))}})],Rz=`#2e3440`,zz=`#3b4252`,Bz=`#434c5e`,Vz=`#4c566a`,Hz=`#e5e9f0`,Uz=`#eceff4`,Wz=`#8fbcbb`,Gz=`#88c0d0`,Gle=`#81a1c1`,Kz=`#5e81ac`,Kle=`#bf616a`,qz=`#d08770`,Jz=`#ebcb8b`,Yz=`#a3be8c`,qle=`#b48ead`,Xz=`#d30102`,Zz=Uz,Qz=Zz,Jle=`#ffffff`,$z=zz,Yle=Zz,eB=zz,Xle=[f.theme({"&":{color:Rz,backgroundColor:Jle},".cm-content":{caretColor:eB},".cm-cursor, .cm-dropCursor":{borderLeftColor:eB},"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:Yle},".cm-panels":{backgroundColor:Zz,color:Vz},".cm-panels.cm-panels-top":{borderBottom:`2px solid black`},".cm-panels.cm-panels-bottom":{borderTop:`2px solid black`},".cm-searchMatch":{backgroundColor:`#72a1ff59`,outline:`1px solid ${Vz}`},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:Hz},".cm-activeLine":{backgroundColor:Qz},".cm-selectionMatch":{backgroundColor:Hz},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{outline:`1px solid ${Vz}`},"&.cm-focused .cm-matchingBracket":{backgroundColor:Uz},".cm-gutters":{backgroundColor:Uz,color:Rz,border:`none`},".cm-activeLineGutter":{backgroundColor:Qz},".cm-foldPlaceholder":{backgroundColor:`transparent`,border:`none`,color:`#ddd`},".cm-tooltip":{border:`none`,backgroundColor:$z},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:`transparent`,borderBottomColor:`transparent`},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:$z,borderBottomColor:$z},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:Qz,color:Vz}}},{dark:!1}),i(be.define([{tag:v.keyword,color:Kz},{tag:[v.name,v.deleted,v.character,v.propertyName,v.macroName],color:qz},{tag:[v.variableName],color:qz},{tag:[v.function(v.variableName)],color:Kz},{tag:[v.labelName],color:Gle},{tag:[v.color,v.constant(v.name),v.standard(v.name)],color:Kz},{tag:[v.definition(v.name),v.separator],color:Yz},{tag:[v.brace],color:Wz},{tag:[v.annotation],color:Xz},{tag:[v.number,v.changed,v.annotation,v.modifier,v.self,v.namespace],color:Gz},{tag:[v.typeName,v.className],color:Jz},{tag:[v.operator,v.operatorKeyword],color:Yz},{tag:[v.tagName],color:qle},{tag:[v.squareBracket],color:Kle},{tag:[v.angleBracket],color:qz},{tag:[v.attributeName],color:Jz},{tag:[v.regexp],color:Kz},{tag:[v.quote],color:zz},{tag:[v.string],color:qz},{tag:v.link,color:Wz,textDecoration:`underline`,textUnderlinePosition:`under`},{tag:[v.url,v.escape,v.special(v.string)],color:qz},{tag:[v.meta],color:Gz},{tag:[v.comment],color:Bz,fontStyle:`italic`},{tag:v.strong,fontWeight:`bold`,color:Kz},{tag:v.emphasis,fontStyle:`italic`,color:Kz},{tag:v.strikethrough,textDecoration:`line-through`},{tag:v.heading,fontWeight:`bold`,color:Kz},{tag:v.special(v.heading1),fontWeight:`bold`,color:Kz},{tag:v.heading1,fontWeight:`bold`,color:Kz},{tag:[v.heading2,v.heading3,v.heading4],fontWeight:`bold`,color:Kz},{tag:[v.heading5,v.heading6],color:Kz},{tag:[v.atom,v.bool,v.special(v.variableName)],color:qz},{tag:[v.processingInstruction,v.inserted],color:Wz},{tag:[v.contentSeparator],color:Jz},{tag:v.invalid,color:Bz,borderBottom:`1px dotted ${Xz}`}]))],tB=typeof String.prototype.normalize==`function`?e=>e.normalize(`NFKD`):e=>e,nB=class{constructor(e,t,n=0,r=e.length,i,a){this.test=a,this.value={from:0,to:0,precise:!1},this.done=!1,this.matches=[],this.buffer=``,this.bufferPos=0,this.iter=e.iterRange(n,r),this.bufferStart=n,this.normalize=i?e=>i(tB(e)):tB,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return ce(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=y(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=a(e);let r=this.normalize(t);if(r.length)for(let e=0,i=n,a=!0;;e++){let n=r.charCodeAt(e),o=this.match(n,i,a,this.bufferPos+this.bufferStart,e==r.length-1);if(o)return this.value=o,this;if(e==r.length-1)break;a&&e<t.length&&t.charCodeAt(e)==n?i++:a=!1}}}match(e,t,n,r,i){let a=null;for(let t=0;t<this.matches.length;){let n=this.matches[t],o=!1;this.query.charCodeAt(n.index)==e&&(n.index==this.query.length-1?a={from:n.from,to:r,precise:i&&n.precise}:(n.index++,o=!0)),o?t++:this.matches.splice(t,1)}return this.query.charCodeAt(0)==e&&(this.query.length==1?a={from:t,to:r,precise:n&&i}:this.matches.push({from:t,index:1,precise:n})),a&&this.test&&!this.test(a.from,a.to,this.buffer,this.bufferStart)&&(a=null),a}};typeof Symbol<`u`&&(nB.prototype[Symbol.iterator]=function(){return this});var rB={from:-1,to:-1,match:/.*/.exec(``),precise:!0},iB=`gm`+(/x/.unicode==null?``:`u`),aB=class{constructor(e,t,n,r=0,i=e.length){if(this.text=e,this.to=i,this.curLine=``,this.done=!1,this.value=rB,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new cB(e,t,n,r,i);this.re=new RegExp(t,iB+(n?.ignoreCase?`i`:``)),this.test=n?.test,this.iter=e.iter();let a=e.lineAt(r);this.curLineStart=a.from,this.matchPos=lB(e,r),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine=``:(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine=``:this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let n=this.curLineStart+t.index,r=n+t[0].length;if(this.matchPos=lB(this.text,r+ +(n==r)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(n<r||n>this.value.to)&&(!this.test||this.test(n,r,t)))return this.value={from:n,to:r,precise:!0,match:t},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),e=0;else return this.done=!0,this}}},oB=new WeakMap,sB=class e{constructor(e,t){this.from=e,this.text=t}get to(){return this.from+this.text.length}static get(t,n,r){let i=oB.get(t);if(!i||i.from>=r||i.to<=n){let i=new e(n,t.sliceString(n,r));return oB.set(t,i),i}if(i.from==n&&i.to==r)return i;let{text:a,from:o}=i;return o>n&&(a=t.sliceString(n,o)+a,o=n),i.to<r&&(a+=t.sliceString(i.to,r)),oB.set(t,new e(o,a)),new e(n,a.slice(n-o,r-o))}},cB=class{constructor(e,t,n,r,i){this.text=e,this.to=i,this.done=!1,this.value=rB,this.matchPos=lB(e,r),this.re=new RegExp(t,iB+(n?.ignoreCase?`i`:``)),this.test=n?.test,this.flat=sB.get(e,r,this.chunkEnd(r+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let e=this.flat.from+t.index,n=e+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(e,n,t)))return this.value={from:e,to:n,precise:!0,match:t},this.matchPos=lB(this.text,n+ +(e==n)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=sB.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}};typeof Symbol<`u`&&(aB.prototype[Symbol.iterator]=cB.prototype[Symbol.iterator]=function(){return this});function Zle(e){try{return new RegExp(e,iB),!0}catch{return!1}}function lB(e,t){if(t>=e.length)return t;let n=e.lineAt(t),r;for(;t<n.to&&(r=n.text.charCodeAt(t-n.from))>=56320&&r<57344;)t++;return t}var Qle=e=>{let{state:t}=e,n=String(t.doc.lineAt(e.state.selection.main.head).number),{close:r,result:i}=ue(e,{label:t.phrase(`Go to line`),input:{type:`text`,name:`line`,value:n},focus:!0,submitLabel:t.phrase(`go`)});return i.then(n=>{let i=n&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(n.elements.line.value);if(!i){e.dispatch({effects:r});return}let a=t.doc.lineAt(t.selection.main.head),[,o,s,c,l]=i,u=c?+c.slice(1):0,d=s?+s:a.number;if(s&&l){let e=d/100;o&&(e=e*(o==`-`?-1:1)+a.number/t.doc.lines),d=Math.round(t.doc.lines*e)}else s&&o&&(d=d*(o==`-`?-1:1)+a.number);let p=t.doc.line(Math.max(1,Math.min(t.doc.lines,d))),m=k.cursor(p.from+Math.max(0,Math.min(u,p.length)));e.dispatch({effects:[r,f.scrollIntoView(m.from,{y:`center`})],selection:m})}),!0},$le={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},uB=ke.define({combine(e){return se(e,$le,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function eue(e){let t=[aue,iue];return e&&t.push(uB.of(e)),t}var tue=T.mark({class:`cm-selectionMatch`}),nue=T.mark({class:`cm-selectionMatch cm-selectionMatch-main`});function dB(e,t,n,r){return(n==0||e(t.sliceDoc(n-1,n))!=I.Word)&&(r==t.doc.length||e(t.sliceDoc(r,r+1))!=I.Word)}function rue(e,t,n,r){return e(t.sliceDoc(n,n+1))==I.Word&&e(t.sliceDoc(r-1,r))==I.Word}var iue=_e.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.selectionSet||e.docChanged||e.viewportChanged)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=e.state.facet(uB),{state:n}=e,r=n.selection;if(r.ranges.length>1)return T.none;let i=r.main,a,o=null;if(i.empty){if(!t.highlightWordAroundCursor)return T.none;let e=n.wordAt(i.head);if(!e)return T.none;o=n.charCategorizer(i.head),a=n.sliceDoc(e.from,e.to)}else{let e=i.to-i.from;if(e<t.minSelectionLength||e>200)return T.none;if(t.wholeWords){if(a=n.sliceDoc(i.from,i.to),o=n.charCategorizer(i.head),!(dB(o,n,i.from,i.to)&&rue(o,n,i.from,i.to)))return T.none}else if(a=n.sliceDoc(i.from,i.to),!a)return T.none}let s=[];for(let r of e.visibleRanges){let e=new nB(n.doc,a,r.from,r.to);for(;!e.next().done;){let{from:r,to:a}=e.value;if((!o||dB(o,n,r,a))&&(i.empty&&r<=i.from&&a>=i.to?s.push(nue.range(r,a)):(r>=i.to||a<=i.from)&&s.push(tue.range(r,a)),s.length>t.maxMatches))return T.none}}return T.set(s)}},{decorations:e=>e.decorations}),aue=f.baseTheme({".cm-selectionMatch":{backgroundColor:`#99ff7780`},".cm-searchMatch .cm-selectionMatch":{backgroundColor:`transparent`}}),oue=({state:e,dispatch:t})=>{let{selection:n}=e,r=k.create(n.ranges.map(t=>e.wordAt(t.head)||k.cursor(t.head)),n.mainIndex);return r.eq(n)?!1:(t(e.update({selection:r})),!0)};function sue(e,t){let{main:n,ranges:r}=e.selection,i=e.wordAt(n.head),a=i&&i.from==n.from&&i.to==n.to;for(let n=!1,i=new nB(e.doc,t,r[r.length-1].to);;)if(i.next(),i.done){if(n)return null;i=new nB(e.doc,t,0,Math.max(0,r[r.length-1].from-1)),n=!0}else{if(n&&r.some(e=>e.from==i.value.from))continue;if(a){let t=e.wordAt(i.value.from);if(!t||t.from!=i.value.from||t.to!=i.value.to)continue}return i.value}}var cue=({state:e,dispatch:t})=>{let{ranges:n}=e.selection;if(n.some(e=>e.from===e.to))return oue({state:e,dispatch:t});let r=e.sliceDoc(n[0].from,n[0].to);if(e.selection.ranges.some(t=>e.sliceDoc(t.from,t.to)!=r))return!1;let i=sue(e,r);return i?(t(e.update({selection:e.selection.addRange(k.range(i.from,i.to),!1),effects:f.scrollIntoView(i.to)})),!0):!1},fB=ke.define({combine(e){return se(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new Sue(e),scrollToMatch:e=>f.scrollIntoView(e)})}}),pB=class{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||``,this.valid=!!this.search&&(!this.regexp||Zle(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord,this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(e,t)=>t==`n`?`
128
+ `:t==`r`?`\r`:t==`t`?` `:`\\`)}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new mue(this):new due(this)}getCursor(e,t=0,n){let r=e.doc?e:we.create({doc:e});return n??=r.doc.length,this.regexp?gB(this,r,t,n):hB(this,r,t,n)}},mB=class{constructor(e){this.spec=e}};function lue(e,t,n){return(r,i,a,o)=>n&&!n(r,i,a,o)?!1:e(r>=o&&i<=o+a.length?a.slice(r-o,i-o):t.doc.sliceString(r,i),t,r,i)}function hB(e,t,n,r){let i;return e.wholeWord&&(i=uue(t.doc,t.charCategorizer(t.selection.main.head))),e.test&&(i=lue(e.test,t,i)),new nB(t.doc,e.unquoted,n,r,e.caseSensitive?void 0:e=>e.toLowerCase(),i)}function uue(e,t){return(n,r,i,a)=>((a>n||a+i.length<r)&&(a=Math.max(0,n-2),i=e.sliceString(a,Math.min(e.length,r+2))),(t(_B(i,n-a))!=I.Word||t(vB(i,n-a))!=I.Word)&&(t(vB(i,r-a))!=I.Word||t(_B(i,r-a))!=I.Word))}var due=class extends mB{constructor(e){super(e)}nextMatch(e,t,n){let r=hB(this.spec,e,n,e.doc.length).nextOverlapping();if(r.done){let n=Math.min(e.doc.length,t+this.spec.unquoted.length);r=hB(this.spec,e,0,n).nextOverlapping()}return r.done||r.value.from==t&&r.value.to==n?null:r.value}prevMatchInRange(e,t,n){for(let r=n;;){let n=Math.max(t,r-1e4-this.spec.unquoted.length),i=hB(this.spec,e,n,r),a=null;for(;!i.nextOverlapping().done;)a=i.value;if(a)return a;if(n==t)return null;r-=1e4}}prevMatch(e,t,n){let r=this.prevMatchInRange(e,0,t);return r||=this.prevMatchInRange(e,Math.max(0,n-this.spec.unquoted.length),e.doc.length),r&&(r.from!=t||r.to!=n)?r:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let n=hB(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let i=hB(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}};function fue(e,t,n){return(r,i,a)=>(!n||n(r,i,a))&&e(a[0],t,r,i)}function gB(e,t,n,r){let i;return e.wholeWord&&(i=pue(t.charCategorizer(t.selection.main.head))),e.test&&(i=fue(e.test,t,i)),new aB(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:i},n,r)}function _B(e,t){return e.slice(h(e,t,!1),t)}function vB(e,t){return e.slice(t,h(e,t))}function pue(e){return(t,n,r)=>!r[0].length||(e(_B(r.input,r.index))!=I.Word||e(vB(r.input,r.index))!=I.Word)&&(e(vB(r.input,r.index+r[0].length))!=I.Word||e(_B(r.input,r.index+r[0].length))!=I.Word)}var mue=class extends mB{nextMatch(e,t,n){let r=gB(this.spec,e,n,e.doc.length).next();return r.done&&(r=gB(this.spec,e,0,t).next()),r.done?null:r.value}prevMatchInRange(e,t,n){for(let r=1;;r++){let i=Math.max(t,n-r*1e4),a=gB(this.spec,e,i,n),o=null;for(;!a.next().done;)o=a.value;if(o&&(i==t||o.from>i+10))return o;if(i==t)return null}}prevMatch(e,t,n){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,n)=>{if(n==`&`)return e.match[0];if(n==`$`)return`$`;for(let t=n.length;t>0;t--){let r=+n.slice(0,t);if(r>0&&r<e.match.length)return e.match[r]+n.slice(t)}return t})}matchAll(e,t){let n=gB(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let i=gB(this.spec,e,Math.max(0,t-250),Math.min(n+250,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}},yB=w.define(),bB=w.define(),xB=l.define({create(e){return new SB(OB(e).create(),null)},update(e,t){for(let n of t.effects)n.is(yB)?e=new SB(n.value.create(),e.panel):n.is(bB)&&(e=new SB(e.query,n.value?DB:null));return e},provide:e=>Se.from(e,e=>e.panel)}),SB=class{constructor(e,t){this.query=e,this.panel=t}},hue=T.mark({class:`cm-searchMatch`}),gue=T.mark({class:`cm-searchMatch cm-searchMatch-selected`}),_ue=_e.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(xB))}update(e){let t=e.state.field(xB);(t!=e.startState.field(xB)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:e,panel:t}){if(!t||!e.spec.valid)return T.none;let{view:n}=this,r=new o;for(let t=0,i=n.visibleRanges,a=i.length;t<a;t++){let{from:o,to:s}=i[t];for(;t<a-1&&s>i[t+1].from-500;)s=i[++t].to;e.highlight(n.state,o,s,(e,t)=>{let i=n.state.selection.ranges.some(n=>n.from==e&&n.to==t);r.add(e,t,i?gue:hue)})}return r.finish()}},{decorations:e=>e.decorations});function CB(e){return t=>{let n=t.state.field(xB,!1);return n&&n.query.spec.valid?e(t,n):jB(t)}}var wB=CB((e,{query:t})=>{let{to:n}=e.state.selection.main,r=t.nextMatch(e.state,n,n);if(!r)return!1;let i=k.single(r.from,r.to),a=e.state.facet(fB);return e.dispatch({selection:i,effects:[IB(e,r),a.scrollToMatch(i.main,e)],userEvent:`select.search`}),AB(e),!0}),TB=CB((e,{query:t})=>{let{state:n}=e,{from:r}=n.selection.main,i=t.prevMatch(n,r,r);if(!i)return!1;let a=k.single(i.from,i.to),o=e.state.facet(fB);return e.dispatch({selection:a,effects:[IB(e,i),o.scrollToMatch(a.main,e)],userEvent:`select.search`}),AB(e),!0}),vue=CB((e,{query:t})=>{let n=t.matchAll(e.state,1e3);return!n||!n.length?!1:(e.dispatch({selection:k.create(n.map(e=>k.range(e.from,e.to))),userEvent:`select.search.matches`}),!0)}),yue=({state:e,dispatch:t})=>{let n=e.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:r,to:i}=n.main,a=[],o=0;for(let t=new nB(e.doc,e.sliceDoc(r,i));!t.next().done;){if(a.length>1e3)return!1;t.value.from==r&&(o=a.length),a.push(k.range(t.value.from,t.value.to))}return t(e.update({selection:k.create(a,o),userEvent:`select.search.matches`})),!0},EB=CB((e,{query:t})=>{let{state:n}=e,{from:r,to:i}=n.selection.main;if(n.readOnly)return!1;let a=t.nextMatch(n,r,r);if(!a)return!1;let o=a,s=[],c,l,u=[];o.precise?o.from==r&&o.to==i&&(l=n.toText(t.getReplacement(o)),s.push({from:o.from,to:o.to,insert:l}),u.push(f.announce.of(n.phrase(`replaced match on line $`,n.doc.lineAt(r).number)+`.`))):o=t.nextMatch(n,o.from,o.to);let d=e.state.changes(s);return o&&(c=k.single(o.from,o.to).map(d),u.push(IB(e,o)),u.push(n.facet(fB).scrollToMatch(c.main,e))),e.dispatch({changes:d,selection:c,effects:u,userEvent:`input.replace`}),!0}),bue=CB((e,{query:t})=>{if(e.state.readOnly)return!1;let n=[];for(let r of t.matchAll(e.state,1e9)){let{from:e,to:i,precise:a}=r;a&&n.push({from:e,to:i,insert:t.getReplacement(r)})}if(!n.length)return!1;let r=e.state.phrase(`replaced $ matches`,n.length)+`.`;return e.dispatch({changes:n,effects:f.announce.of(r),userEvent:`input.replace.all`}),!0});function DB(e){return e.state.facet(fB).createPanel(e)}function OB(e,t){let n=e.selection.main,r=n.empty||n.to>n.from+100?``:e.sliceDoc(n.from,n.to);if(t&&!r)return t;let i=e.facet(fB);return new pB({search:t?.literal??i.literal?r:r.replace(/\n/g,`\\n`),caseSensitive:t?.caseSensitive??i.caseSensitive,literal:t?.literal??i.literal,regexp:t?.regexp??i.regexp,wholeWord:t?.wholeWord??i.wholeWord})}function kB(e){let t=b(e,DB);return t&&t.dom.querySelector(`[main-field]`)}function AB(e){let t=kB(e);t&&t==e.root.activeElement&&t.select()}var jB=e=>{let t=e.state.field(xB,!1);if(t&&t.panel){let n=kB(e);if(n&&n!=e.root.activeElement){let r=OB(e.state,t.query.spec);r.valid&&e.dispatch({effects:yB.of(r)}),n.focus(),n.select()}}else e.dispatch({effects:[bB.of(!0),t?yB.of(OB(e.state,t.query.spec)):w.appendConfig.of(RB)]});return!0},MB=e=>{let t=e.state.field(xB,!1);if(!t||!t.panel)return!1;let n=b(e,DB);return n&&n.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:bB.of(!1)}),!0},xue=[{key:`Mod-f`,run:jB,scope:`editor search-panel`},{key:`F3`,run:wB,shift:TB,scope:`editor search-panel`,preventDefault:!0},{key:`Mod-g`,run:wB,shift:TB,scope:`editor search-panel`,preventDefault:!0},{key:`Escape`,run:MB,scope:`editor search-panel`},{key:`Mod-Shift-l`,run:yue},{key:`Mod-Alt-g`,run:Qle},{key:`Mod-d`,run:cue,preventDefault:!0}],Sue=class{constructor(e){this.view=e;let t=this.query=e.state.field(xB).query.spec;this.commit=this.commit.bind(this),this.searchField=F(`input`,{value:t.search,placeholder:NB(e,`Find`),"aria-label":NB(e,`Find`),class:`cm-textfield`,name:`search`,form:``,"main-field":`true`,onchange:this.commit,onkeyup:this.commit}),this.replaceField=F(`input`,{value:t.replace,placeholder:NB(e,`Replace`),"aria-label":NB(e,`Replace`),class:`cm-textfield`,name:`replace`,form:``,onchange:this.commit,onkeyup:this.commit}),this.caseField=F(`input`,{type:`checkbox`,name:`case`,form:``,checked:t.caseSensitive,onchange:this.commit}),this.reField=F(`input`,{type:`checkbox`,name:`re`,form:``,checked:t.regexp,onchange:this.commit}),this.wordField=F(`input`,{type:`checkbox`,name:`word`,form:``,checked:t.wholeWord,onchange:this.commit});function n(e,t,n){return F(`button`,{class:`cm-button`,name:e,onclick:t,type:`button`},n)}this.dom=F(`div`,{onkeydown:e=>this.keydown(e),class:`cm-search`},[this.searchField,n(`next`,()=>wB(e),[NB(e,`next`)]),n(`prev`,()=>TB(e),[NB(e,`previous`)]),n(`select`,()=>vue(e),[NB(e,`all`)]),F(`label`,null,[this.caseField,NB(e,`match case`)]),F(`label`,null,[this.reField,NB(e,`regexp`)]),F(`label`,null,[this.wordField,NB(e,`by word`)]),...e.state.readOnly?[]:[F(`br`),this.replaceField,n(`replace`,()=>EB(e),[NB(e,`replace`)]),n(`replaceAll`,()=>bue(e),[NB(e,`replace all`)])],F(`button`,{name:`close`,onclick:()=>MB(e),"aria-label":NB(e,`close`),type:`button`},[`×`])])}commit(){let e=new pB({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:yB.of(e)}))}keydown(e){P(this.view,e,`search-panel`)?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?TB:wB)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),EB(this.view))}update(e){for(let t of e.transactions)for(let e of t.effects)e.is(yB)&&!e.value.eq(this.query)&&this.setQuery(e.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(fB).top}};function NB(e,t){return e.state.phrase(t)}var PB=30,FB=/[\s\.,:;?!]/;function IB(e,{from:t,to:n}){let r=e.state.doc.lineAt(t),i=e.state.doc.lineAt(n).to,a=Math.max(r.from,t-PB),o=Math.min(i,n+PB),s=e.state.sliceDoc(a,o);if(a!=r.from){for(let e=0;e<PB;e++)if(!FB.test(s[e+1])&&FB.test(s[e])){s=s.slice(e);break}}if(o!=i){for(let e=s.length-1;e>s.length-PB;e--)if(!FB.test(s[e-1])&&FB.test(s[e])){s=s.slice(0,e);break}}return f.announce.of(`${e.state.phrase(`current match`)}. ${s} ${e.state.phrase(`on line`)} ${r.number}.`)}var LB=f.baseTheme({".cm-panel.cm-search":{padding:`2px 6px 4px`,position:`relative`,"& [name=close]":{position:`absolute`,top:`0`,right:`4px`,backgroundColor:`inherit`,border:`none`,font:`inherit`,padding:0,margin:0},"& input, & button, & label":{margin:`.2em .6em .2em 0`},"& input[type=checkbox]":{marginRight:`.2em`},"& label":{fontSize:`80%`,whiteSpace:`pre`}},"&light .cm-searchMatch":{backgroundColor:`#ffff0054`},"&dark .cm-searchMatch":{backgroundColor:`#00ffff8a`},"&light .cm-searchMatch-selected":{backgroundColor:`#ff6a0054`},"&dark .cm-searchMatch-selected":{backgroundColor:`#ff00ff8a`}}),RB=[xB,Oe.low(_ue),LB],zB=class{constructor(e,t,n){this.from=e,this.to=t,this.diagnostic=n}},BB=class e{constructor(e,t,n){this.diagnostics=e,this.panel=t,this.selected=n}static init(t,n,r){let i=r.facet(eV).markerFilter;i&&(t=i(t,r));let a=t.slice().sort((e,t)=>e.from-t.from||e.to-t.to),s=new o,c=[],l=0,u=r.doc.iter(),d=0,f=r.doc.length;for(let e=0;;){let t=e==a.length?null:a[e];if(!t&&!c.length)break;let n,r;if(c.length)n=l,r=c.reduce((e,t)=>Math.min(e,t.to),t&&t.from>n?t.from:1e8);else{if(n=t.from,n>f)break;r=t.to,c.push(t),e++}for(;e<a.length;){let t=a[e];if(t.from==n&&(t.to>t.from||t.to==n))c.push(t),e++,r=Math.min(t.to,r);else{r=Math.min(t.from,r);break}}r=Math.min(r,f);let i=!1;if(c.some(e=>e.from==n&&(e.to==r||r==f))&&(i=n==r,!i&&r-n<10)){let e=n-(d+u.value.length);e>0&&(u.next(e),d=n);for(let e=n;;){if(e>=r){i=!0;break}if(!u.lineBreak&&d+u.value.length>e)break;e=d+u.value.length,d+=u.value.length,u.next()}}let o=dV(c);if(i)s.add(n,n,T.widget({widget:new iV(o),diagnostics:c.slice()}));else{let e=c.reduce((e,t)=>t.markClass?e+` `+t.markClass:e,``);s.add(n,r,T.mark({class:`cm-lintRange cm-lintRange-`+o+e,diagnostics:c.slice(),inclusiveEnd:c.some(e=>e.to>r)}))}if(l=r,l==f)break;for(let e=0;e<c.length;e++)c[e].to<=l&&c.splice(e--,1)}let p=s.finish();return new e(p,n,VB(p))}};function VB(e,t=null,n=0){let r=null;return e.between(n,1e9,(e,n,{spec:i})=>{if(!(t&&i.diagnostics.indexOf(t)<0))if(!r)r=new zB(e,n,t||i.diagnostics[0]);else if(i.diagnostics.indexOf(r.diagnostic)<0)return!1;else r=new zB(r.from,n,r.diagnostic)}),r}function HB(e,t){let n=t.pos,r=t.end||n,i=e.state.facet(eV).hideOn(e,n,r);if(i!=null)return i;let a=e.startState.doc.lineAt(t.pos);return!!(e.effects.some(e=>e.is(WB))||e.changes.touchesRange(a.from,Math.max(a.to,r)))}function UB(e,t){return e.field(qB,!1)?t:t.concat(w.appendConfig.of(fV))}var WB=w.define(),GB=w.define(),KB=w.define(),qB=l.define({create(){return new BB(T.none,null,null)},update(e,t){if(t.docChanged&&e.diagnostics.size){let n=e.diagnostics.map(t.changes),r=null,i=e.panel;if(e.selected){let i=t.changes.mapPos(e.selected.from,1);r=VB(n,e.selected.diagnostic,i)||VB(n,null,i)}!n.size&&i&&t.state.facet(eV).autoPanel&&(i=null),e=new BB(n,i,r)}for(let n of t.effects)if(n.is(WB)){let r=t.state.facet(eV).autoPanel?n.value.length?oV.open:null:e.panel;e=BB.init(n.value,r,t.state)}else n.is(GB)?e=new BB(e.diagnostics,n.value?oV.open:null,e.selected):n.is(KB)&&(e=new BB(e.diagnostics,e.panel,n.value));return e},provide:e=>[Se.from(e,e=>e.panel),f.decorations.from(e,e=>e.diagnostics)]}),JB=T.mark({class:`cm-lintRange cm-lintRange-active`});function YB(e,t,n){let{diagnostics:r}=e.state.field(qB),i,a=-1,o=-1;r.between(t-+(n<0),t+ +(n>0),(e,r,{spec:s})=>{if(t>=e&&t<=r&&(e==r||(t>e||n>0)&&(t<r||n<0)))return i=s.diagnostics,a=e,o=r,!1});let s=e.state.facet(eV).tooltipFilter;return i&&s&&(i=s(i,e.state)),i?{pos:a,end:o,above:e.state.doc.lineAt(a).to<o,create(){return{dom:XB(e,i)}}}:null}function XB(e,t){return F(`ul`,{class:`cm-tooltip-lint`},t.map(t=>rV(e,t,!1)))}var ZB=e=>{let t=e.state.field(qB,!1);(!t||!t.panel)&&e.dispatch({effects:UB(e.state,[GB.of(!0)])});let n=b(e,oV.open);return n&&n.dom.querySelector(`.cm-panel-lint ul`).focus(),!0},QB=e=>{let t=e.state.field(qB,!1);return!t||!t.panel?!1:(e.dispatch({effects:GB.of(!1)}),!0)},$B=[{key:`Mod-Shift-m`,run:ZB,preventDefault:!0},{key:`F8`,run:e=>{let t=e.state.field(qB,!1);if(!t)return!1;let n=e.state.selection.main,r=VB(t.diagnostics,null,n.to+1);return!r&&(r=VB(t.diagnostics,null,0),!r||r.from==n.from&&r.to==n.to)?!1:(e.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0}),!0)}}],eV=ke.define({combine(e){return{sources:e.map(e=>e.source).filter(e=>e!=null),...se(e.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:tV,tooltipFilter:tV,needsRefresh:(e,t)=>e?t?n=>e(n)||t(n):e:t,hideOn:(e,t)=>e?t?(n,r,i)=>e(n,r,i)||t(n,r,i):e:t,autoPanel:(e,t)=>e||t})}}});function tV(e,t){return e?t?(n,r)=>t(e(n,r),r):e:t}function nV(e){let t=[];if(e)actions:for(let{name:n}of e){for(let e=0;e<n.length;e++){let r=n[e];if(/[a-zA-Z]/.test(r)&&!t.some(e=>e.toLowerCase()==r.toLowerCase())){t.push(r);continue actions}}t.push(``)}return t}function rV(e,t,n){let r=n?nV(t.actions):[];return F(`li`,{class:`cm-diagnostic cm-diagnostic-`+t.severity},F(`span`,{class:`cm-diagnosticText`},t.renderMessage?t.renderMessage(e):t.message),t.actions?.map((n,i)=>{let a=!1,o=r=>{if(r.preventDefault(),a)return;a=!0;let i=VB(e.state.field(qB).diagnostics,t);i&&n.apply(e,i.from,i.to)},{name:s}=n,c=r[i]?s.indexOf(r[i]):-1,l=c<0?s:[s.slice(0,c),F(`u`,s.slice(c,c+1)),s.slice(c+1)];return F(`button`,{type:`button`,class:`cm-diagnosticAction`+(n.markClass?` `+n.markClass:``),onclick:o,onmousedown:o,"aria-label":` Action: ${s}${c<0?``:` (access key "${r[i]})"`}.`},l)}),t.source&&F(`div`,{class:`cm-diagnosticSource`},t.source))}var iV=class extends d{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return F(`span`,{class:`cm-lintPoint cm-lintPoint-`+this.sev})}},aV=class{constructor(e,t){this.diagnostic=t,this.id=`item_`+Math.floor(Math.random()*4294967295).toString(16),this.dom=rV(e,t,!0),this.dom.id=this.id,this.dom.setAttribute(`role`,`option`)}},oV=class e{constructor(e){this.view=e,this.items=[];let t=t=>{if(!(t.ctrlKey||t.altKey||t.metaKey)){if(t.keyCode==27)QB(this.view),this.view.focus();else if(t.keyCode==38||t.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(t.keyCode==40||t.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(t.keyCode==36)this.moveSelection(0);else if(t.keyCode==35)this.moveSelection(this.items.length-1);else if(t.keyCode==13)this.view.focus();else if(t.keyCode>=65&&t.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:n}=this.items[this.selectedIndex],r=nV(n.actions);for(let i=0;i<r.length;i++)if(r[i].toUpperCase().charCodeAt(0)==t.keyCode){let t=VB(this.view.state.field(qB).diagnostics,n);t&&n.actions[i].apply(e,t.from,t.to)}}else return;t.preventDefault()}},n=e=>{for(let t=0;t<this.items.length;t++)this.items[t].dom.contains(e.target)&&this.moveSelection(t)};this.list=F(`ul`,{tabIndex:0,role:`listbox`,"aria-label":this.view.state.phrase(`Diagnostics`),onkeydown:t,onclick:n}),this.dom=F(`div`,{class:`cm-panel-lint`},this.list,F(`button`,{type:`button`,name:`close`,"aria-label":this.view.state.phrase(`close`),onclick:()=>QB(this.view)},`×`)),this.update()}get selectedIndex(){let e=this.view.state.field(qB).selected;if(!e)return-1;for(let t=0;t<this.items.length;t++)if(this.items[t].diagnostic==e.diagnostic)return t;return-1}update(){let{diagnostics:e,selected:t}=this.view.state.field(qB),n=0,r=!1,i=null,a=new Set;for(e.between(0,this.view.state.doc.length,(e,o,{spec:s})=>{for(let e of s.diagnostics){if(a.has(e))continue;a.add(e);let o=-1,s;for(let t=n;t<this.items.length;t++)if(this.items[t].diagnostic==e){o=t;break}o<0?(s=new aV(this.view,e),this.items.splice(n,0,s),r=!0):(s=this.items[o],o>n&&(this.items.splice(n,o-n),r=!0)),t&&s.diagnostic==t.diagnostic?s.dom.hasAttribute(`aria-selected`)||(s.dom.setAttribute(`aria-selected`,`true`),i=s):s.dom.hasAttribute(`aria-selected`)&&s.dom.removeAttribute(`aria-selected`),n++}});n<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0);)r=!0,this.items.pop();this.items.length==0&&(this.items.push(new aV(this.view,{from:-1,to:-1,severity:`info`,message:this.view.state.phrase(`No diagnostics`)})),r=!0),i?(this.list.setAttribute(`aria-activedescendant`,i.id),this.view.requestMeasure({key:this,read:()=>({sel:i.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:e,panel:t})=>{let n=t.height/this.list.offsetHeight;e.top<t.top?this.list.scrollTop-=(t.top-e.top)/n:e.bottom>t.bottom&&(this.list.scrollTop+=(e.bottom-t.bottom)/n)}})):this.selectedIndex<0&&this.list.removeAttribute(`aria-activedescendant`),r&&this.sync()}sync(){let e=this.list.firstChild;function t(){let t=e;e=t.nextSibling,t.remove()}for(let n of this.items)if(n.dom.parentNode==this.list){for(;e!=n.dom;)t();e=n.dom.nextSibling}else this.list.insertBefore(n.dom,e);for(;e;)t()}moveSelection(e){if(this.selectedIndex<0)return;let t=VB(this.view.state.field(qB).diagnostics,this.items[e].diagnostic);t&&this.view.dispatch({selection:{anchor:t.from,head:t.to},scrollIntoView:!0,effects:KB.of(t)})}static open(t){return new e(t)}};function sV(e,t=`viewBox="0 0 40 40"`){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${t}>${encodeURIComponent(e)}</svg>')`}function cV(e){return sV(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${e}" fill="none" stroke-width=".7"/>`,`width="6" height="3"`)}var lV=f.baseTheme({".cm-diagnostic":{padding:`3px 6px 3px 8px`,marginLeft:`-1px`,display:`block`,whiteSpace:`pre-wrap`},".cm-diagnostic-error":{borderLeft:`5px solid #d11`},".cm-diagnostic-warning":{borderLeft:`5px solid orange`},".cm-diagnostic-info":{borderLeft:`5px solid #999`},".cm-diagnostic-hint":{borderLeft:`5px solid #66d`},".cm-diagnosticAction":{font:`inherit`,border:`none`,padding:`2px 4px`,backgroundColor:`#444`,color:`white`,borderRadius:`3px`,marginLeft:`8px`,cursor:`pointer`},".cm-diagnosticSource":{fontSize:`70%`,opacity:.7},".cm-lintRange":{backgroundPosition:`left bottom`,backgroundRepeat:`repeat-x`,paddingBottom:`0.7px`},".cm-lintRange-error":{backgroundImage:cV(`#d11`)},".cm-lintRange-warning":{backgroundImage:cV(`orange`)},".cm-lintRange-info":{backgroundImage:cV(`#999`)},".cm-lintRange-hint":{backgroundImage:cV(`#66d`)},".cm-lintRange-active":{backgroundColor:`#ffdd9980`},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:`relative`,"&:after":{content:`""`,position:`absolute`,bottom:0,left:`-2px`,borderLeft:`3px solid transparent`,borderRight:`3px solid transparent`,borderBottom:`4px solid #d11`}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:`orange`}},".cm-lintPoint-info":{"&:after":{borderBottomColor:`#999`}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:`#66d`}},".cm-panel.cm-panel-lint":{position:`relative`,"& ul":{maxHeight:`100px`,overflowY:`auto`,"& [aria-selected]":{backgroundColor:`#ddd`,"& u":{textDecoration:`underline`}},"&:focus [aria-selected]":{background_fallback:`#bdf`,backgroundColor:`Highlight`,color_fallback:`white`,color:`HighlightText`},"& u":{textDecoration:`none`},padding:0,margin:0},"& [name=close]":{position:`absolute`,top:`0`,right:`2px`,background:`inherit`,border:`none`,font:`inherit`,padding:0,margin:0}},"&dark .cm-lintRange-active":{backgroundColor:`#86714a80`},"&dark .cm-panel.cm-panel-lint ul":{"& [aria-selected]":{backgroundColor:`#2e343e`}}});function uV(e){return e==`error`?4:e==`warning`?3:e==`info`?2:1}function dV(e){let t=`hint`,n=1;for(let r of e){let e=uV(r.severity);e>n&&(n=e,t=r.severity)}return t}var fV=[qB,f.decorations.compute([qB],e=>{let{selected:t,panel:n}=e.field(qB);return!t||!n||t.from==t.to?T.none:T.set([JB.range(t.from,t.to)])}),ve(YB,{hideOn:HB}),lV],pV=[j(),xe(),pe(),kR(),re(),E(),O(),we.allowMultipleSelections.of(!0),Te(),i(ne,{fallback:!0}),le(),xce(),jce(),ye(),D(),te(),eue(),ae.of([...wce,...Iz,...xue,...BR,...Ce,...xR,...$B])];pe(),kR(),E(),i(ne,{fallback:!0}),ae.of([...Iz,...BR]);function mV(e,[t,n]){return Math.min(n,Math.max(t,e))}function hV(e){let t=L.useRef({value:e,previous:e});return L.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var gV=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),_V=`VisuallyHidden`,vV=L.forwardRef((e,t)=>(0,R.jsx)(VD.span,{...e,ref:t,style:{...gV,...e.style}}));vV.displayName=_V;var yV=vV,bV=[` `,`Enter`,`ArrowUp`,`ArrowDown`],xV=[` `,`Enter`],SV=`Select`,[CV,wV,TV]=Xj(SV),[EV,Cue]=LD(SV,[TV,tA]),DV=tA(),[OV,kV]=EV(SV),[AV,jV]=EV(SV),MV=e=>{let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:c,dir:l,name:u,autoComplete:d,disabled:f,required:p,form:m}=e,h=DV(t),[g,_]=L.useState(null),[v,y]=L.useState(null),[b,x]=L.useState(!1),S=Zj(l),[C,w]=kA({prop:r,defaultProp:i??!1,onChange:a,caller:SV}),[T,E]=kA({prop:o,defaultProp:s,onChange:c,caller:SV}),D=L.useRef(null),O=g?m||!!g.closest(`form`):!0,[k,A]=L.useState(new Set),j=Array.from(k).map(e=>e.props.value).join(`;`);return(0,R.jsx)(_A,{...h,children:(0,R.jsxs)(OV,{required:p,scope:t,trigger:g,onTriggerChange:_,valueNode:v,onValueNodeChange:y,valueNodeHasChildren:b,onValueNodeHasChildrenChange:x,contentId:mO(),value:T,onValueChange:E,open:C,onOpenChange:w,dir:S,triggerPointerDownPosRef:D,disabled:f,children:[(0,R.jsx)(CV.Provider,{scope:t,children:(0,R.jsx)(AV,{scope:e.__scopeSelect,onNativeOptionAdd:L.useCallback(e=>{A(t=>new Set(t).add(e))},[]),onNativeOptionRemove:L.useCallback(e=>{A(t=>{let n=new Set(t);return n.delete(e),n})},[]),children:n})}),O?(0,R.jsxs)(DH,{"aria-hidden":!0,required:p,tabIndex:-1,name:u,autoComplete:d,value:T,onChange:e=>E(e.target.value),disabled:f,form:m,children:[T===void 0?(0,R.jsx)(`option`,{value:``}):null,Array.from(k)]},j):null]})})};MV.displayName=SV;var NV=`SelectTrigger`,PV=L.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...i}=e,a=DV(n),o=kV(NV,n),s=o.disabled||r,c=ID(t,o.onTriggerChange),l=wV(n),u=L.useRef(`touch`),[d,f,p]=kH(e=>{let t=l().filter(e=>!e.disabled),n=AH(t,e,t.find(e=>e.value===o.value));n!==void 0&&o.onValueChange(n.value)}),m=e=>{s||(o.onOpenChange(!0),p()),e&&(o.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,R.jsx)(vA,{asChild:!0,...a,children:(0,R.jsx)(VD.button,{type:`button`,role:`combobox`,"aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":`none`,dir:o.dir,"data-state":o.open?`open`:`closed`,disabled:s,"data-disabled":s?``:void 0,"data-placeholder":OH(o.value)?``:void 0,...i,ref:c,onClick:ND(i.onClick,e=>{e.currentTarget.focus(),u.current!==`mouse`&&m(e)}),onPointerDown:ND(i.onPointerDown,e=>{u.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(m(e),e.preventDefault())}),onKeyDown:ND(i.onKeyDown,e=>{let t=d.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&f(e.key),!(t&&e.key===` `)&&bV.includes(e.key)&&(m(),e.preventDefault())})})})});PV.displayName=NV;var FV=`SelectValue`,IV=L.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,children:a,placeholder:o=``,...s}=e,c=kV(FV,n),{onValueNodeHasChildrenChange:l}=c,u=a!==void 0,d=ID(t,c.onValueNodeChange);return pO(()=>{l(u)},[l,u]),(0,R.jsx)(VD.span,{...s,ref:d,style:{pointerEvents:`none`},children:OH(c.value)?(0,R.jsx)(R.Fragment,{children:o}):a})});IV.displayName=FV;var LV=`SelectIcon`,RV=L.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,R.jsx)(VD.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})});RV.displayName=LV;var zV=`SelectPortal`,BV=e=>(0,R.jsx)(SA,{asChild:!0,...e});BV.displayName=zV;var VV=`SelectContent`,HV=L.forwardRef((e,t)=>{let n=kV(VV,e.__scopeSelect),[r,i]=L.useState();if(pO(()=>{i(new DocumentFragment)},[]),!n.open){let t=r;return t?Pa.createPortal((0,R.jsx)(WV,{scope:e.__scopeSelect,children:(0,R.jsx)(CV.Slot,{scope:e.__scopeSelect,children:(0,R.jsx)(`div`,{children:e.children})})}),t):null}return(0,R.jsx)(JV,{...e,ref:t})});HV.displayName=VV;var UV=10,[WV,GV]=EV(VV),KV=`SelectContentImpl`,qV=RD(`SelectContent.RemoveScroll`),JV=L.forwardRef((e,t)=>{let{__scopeSelect:n,position:r=`item-aligned`,onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:o,side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g,..._}=e,v=kV(VV,n),[y,b]=L.useState(null),[x,S]=L.useState(null),C=ID(t,e=>b(e)),[w,T]=L.useState(null),[E,D]=L.useState(null),O=wV(n),[k,A]=L.useState(!1),j=L.useRef(!1);L.useEffect(()=>{if(y)return BA(y)},[y]),$D();let M=L.useCallback(e=>{let[t,...n]=O().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&x&&(x.scrollTop=0),n===r&&x&&(x.scrollTop=x.scrollHeight),n?.focus(),document.activeElement!==i))return},[O,x]),N=L.useCallback(()=>M([w,y]),[M,w,y]);L.useEffect(()=>{k&&N()},[k,N]);let{onOpenChange:P,triggerPointerDownPosRef:ee}=v;L.useEffect(()=>{if(y){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(ee.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(ee.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():y.contains(n.target)||P(!1),document.removeEventListener(`pointermove`,t),ee.current=null};return ee.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[y,P,ee]),L.useEffect(()=>{let e=()=>P(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[P]);let[te,ne]=kH(e=>{let t=O().filter(e=>!e.disabled),n=AH(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current.focus())}),F=L.useCallback((e,t,n)=>{let r=!j.current&&!n;(v.value!==void 0&&v.value===t||r)&&(T(e),r&&(j.current=!0))},[v.value]),re=L.useCallback(()=>y?.focus(),[y]),I=L.useCallback((e,t,n)=>{let r=!j.current&&!n;(v.value!==void 0&&v.value===t||r)&&D(e)},[v.value]),ie=r===`popper`?QV:XV,ae=ie===QV?{side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g}:{};return(0,R.jsx)(WV,{scope:n,content:y,viewport:x,onViewportChange:S,itemRefCallback:F,selectedItem:w,onItemLeave:re,itemTextRefCallback:I,focusSelectedItem:N,selectedItemText:E,position:r,isPositioned:k,searchRef:te,children:(0,R.jsx)(kj,{as:qV,allowPinchZoom:!0,children:(0,R.jsx)(iO,{asChild:!0,trapped:v.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:ND(i,e=>{v.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,R.jsx)(KD,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:(0,R.jsx)(ie,{role:`listbox`,id:v.contentId,"data-state":v.open?`open`:`closed`,dir:v.dir,onContextMenu:e=>e.preventDefault(),..._,...ae,onPlaced:()=>A(!0),ref:C,style:{display:`flex`,flexDirection:`column`,outline:`none`,..._.style},onKeyDown:ND(_.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&ne(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=O().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>M(t)),e.preventDefault()}})})})})})})});JV.displayName=KV;var YV=`SelectItemAlignedPosition`,XV=L.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:r,...i}=e,a=kV(VV,n),o=GV(VV,n),[s,c]=L.useState(null),[l,u]=L.useState(null),d=ID(t,e=>u(e)),f=wV(n),p=L.useRef(!1),m=L.useRef(!0),{viewport:h,selectedItem:g,selectedItemText:_,focusSelectedItem:v}=o,y=L.useCallback(()=>{if(a.trigger&&a.valueNode&&s&&l&&h&&g&&_){let e=a.trigger.getBoundingClientRect(),t=l.getBoundingClientRect(),n=a.valueNode.getBoundingClientRect(),i=_.getBoundingClientRect();if(a.dir!==`rtl`){let r=i.left-t.left,a=n.left-r,o=e.left-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-UV,d=mV(a,[UV,Math.max(UV,u-l)]);s.style.minWidth=c+`px`,s.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-UV,d=mV(a,[UV,Math.max(UV,u-l)]);s.style.minWidth=c+`px`,s.style.right=d+`px`}let o=f(),c=window.innerHeight-UV*2,u=h.scrollHeight,d=window.getComputedStyle(l),m=parseInt(d.borderTopWidth,10),v=parseInt(d.paddingTop,10),y=parseInt(d.borderBottomWidth,10),b=parseInt(d.paddingBottom,10),x=m+v+u+b+y,S=Math.min(g.offsetHeight*5,x),C=window.getComputedStyle(h),w=parseInt(C.paddingTop,10),T=parseInt(C.paddingBottom,10),E=e.top+e.height/2-UV,D=c-E,O=g.offsetHeight/2,k=g.offsetTop+O,A=m+v+k,j=x-A;if(A<=E){let e=o.length>0&&g===o[o.length-1].ref.current;s.style.bottom=`0px`;let t=l.clientHeight-h.offsetTop-h.offsetHeight,n=A+Math.max(D,O+(e?T:0)+t+y);s.style.height=n+`px`}else{let e=o.length>0&&g===o[0].ref.current;s.style.top=`0px`;let t=Math.max(E,m+h.offsetTop+(e?w:0)+O)+j;s.style.height=t+`px`,h.scrollTop=A-E+h.offsetTop}s.style.margin=`${UV}px 0`,s.style.minHeight=S+`px`,s.style.maxHeight=c+`px`,r?.(),requestAnimationFrame(()=>p.current=!0)}},[f,a.trigger,a.valueNode,s,l,h,g,_,a.dir,r]);pO(()=>y(),[y]);let[b,x]=L.useState();return pO(()=>{l&&x(window.getComputedStyle(l).zIndex)},[l]),(0,R.jsx)($V,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:p,onScrollButtonChange:L.useCallback(e=>{e&&m.current===!0&&(y(),v?.(),m.current=!1)},[y,v]),children:(0,R.jsx)(`div`,{ref:c,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:b},children:(0,R.jsx)(VD.div,{...i,ref:d,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})});XV.displayName=YV;var ZV=`SelectPopperPosition`,QV=L.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=UV,...a}=e,o=DV(n);return(0,R.jsx)(yA,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.style,"--radix-select-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-select-content-available-width":`var(--radix-popper-available-width)`,"--radix-select-content-available-height":`var(--radix-popper-available-height)`,"--radix-select-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-select-trigger-height":`var(--radix-popper-anchor-height)`}})});QV.displayName=ZV;var[$V,eH]=EV(VV,{}),tH=`SelectViewport`,nH=L.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...i}=e,a=GV(tH,n),o=eH(tH,n),s=ID(t,a.onViewportChange),c=L.useRef(0);return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`},nonce:r}),(0,R.jsx)(CV.Slot,{scope:n,children:(0,R.jsx)(VD.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:s,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:ND(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=o;if(r?.current&&n){let e=Math.abs(c.current-t.scrollTop);if(e>0){let r=window.innerHeight-UV*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}c.current=t.scrollTop})})})]})});nH.displayName=tH;var rH=`SelectGroup`,[iH,aH]=EV(rH),oH=L.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=mO();return(0,R.jsx)(iH,{scope:n,id:i,children:(0,R.jsx)(VD.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})});oH.displayName=rH;var sH=`SelectLabel`,cH=L.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=aH(sH,n);return(0,R.jsx)(VD.div,{id:i.id,...r,ref:t})});cH.displayName=sH;var lH=`SelectItem`,[uH,dH]=EV(lH),fH=L.forwardRef((e,t)=>{let{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...o}=e,s=kV(lH,n),c=GV(lH,n),l=s.value===r,[u,d]=L.useState(a??``),[f,p]=L.useState(!1),m=ID(t,e=>c.itemRefCallback?.(e,r,i)),h=mO(),g=L.useRef(`touch`),_=()=>{i||(s.onValueChange(r),s.onOpenChange(!1))};if(r===``)throw Error(`A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.`);return(0,R.jsx)(uH,{scope:n,value:r,disabled:i,textId:h,isSelected:l,onItemTextChange:L.useCallback(e=>{d(t=>t||(e?.textContent??``).trim())},[]),children:(0,R.jsx)(CV.ItemSlot,{scope:n,value:r,disabled:i,textValue:u,children:(0,R.jsx)(VD.div,{role:`option`,"aria-labelledby":h,"data-highlighted":f?``:void 0,"aria-selected":l&&f,"data-state":l?`checked`:`unchecked`,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,tabIndex:i?void 0:-1,...o,ref:m,onFocus:ND(o.onFocus,()=>p(!0)),onBlur:ND(o.onBlur,()=>p(!1)),onClick:ND(o.onClick,()=>{g.current!==`mouse`&&_()}),onPointerUp:ND(o.onPointerUp,()=>{g.current===`mouse`&&_()}),onPointerDown:ND(o.onPointerDown,e=>{g.current=e.pointerType}),onPointerMove:ND(o.onPointerMove,e=>{g.current=e.pointerType,i?c.onItemLeave?.():g.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:ND(o.onPointerLeave,e=>{e.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:ND(o.onKeyDown,e=>{c.searchRef?.current!==``&&e.key===` `||(xV.includes(e.key)&&_(),e.key===` `&&e.preventDefault())})})})})});fH.displayName=lH;var pH=`SelectItemText`,mH=L.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,...a}=e,o=kV(pH,n),s=GV(pH,n),c=dH(pH,n),l=jV(pH,n),[u,d]=L.useState(null),f=ID(t,e=>d(e),c.onItemTextChange,e=>s.itemTextRefCallback?.(e,c.value,c.disabled)),p=u?.textContent,m=L.useMemo(()=>(0,R.jsx)(`option`,{value:c.value,disabled:c.disabled,children:p},c.value),[c.disabled,c.value,p]),{onNativeOptionAdd:h,onNativeOptionRemove:g}=l;return pO(()=>(h(m),()=>g(m)),[h,g,m]),(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(VD.span,{id:c.textId,...a,ref:f}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren?Pa.createPortal(a.children,o.valueNode):null]})});mH.displayName=pH;var hH=`SelectItemIndicator`,gH=L.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return dH(hH,n).isSelected?(0,R.jsx)(VD.span,{"aria-hidden":!0,...r,ref:t}):null});gH.displayName=hH;var _H=`SelectScrollUpButton`,vH=L.forwardRef((e,t)=>{let n=GV(_H,e.__scopeSelect),r=eH(_H,e.__scopeSelect),[i,a]=L.useState(!1),o=ID(t,r.onScrollButtonChange);return pO(()=>{if(n.viewport&&n.isPositioned){let e=function(){a(t.scrollTop>0)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,R.jsx)(xH,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});vH.displayName=_H;var yH=`SelectScrollDownButton`,bH=L.forwardRef((e,t)=>{let n=GV(yH,e.__scopeSelect),r=eH(yH,e.__scopeSelect),[i,a]=L.useState(!1),o=ID(t,r.onScrollButtonChange);return pO(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight;a(Math.ceil(t.scrollTop)<e)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,R.jsx)(xH,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});bH.displayName=yH;var xH=L.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=GV(`SelectScrollButton`,n),o=L.useRef(null),s=wV(n),c=L.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return L.useEffect(()=>()=>c(),[c]),pO(()=>{s().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[s]),(0,R.jsx)(VD.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:ND(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:ND(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:ND(i.onPointerLeave,()=>{c()})})}),SH=`SelectSeparator`,CH=L.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,R.jsx)(VD.div,{"aria-hidden":!0,...r,ref:t})});CH.displayName=SH;var wH=`SelectArrow`,TH=L.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=DV(n),a=kV(wH,n),o=GV(wH,n);return a.open&&o.position===`popper`?(0,R.jsx)(bA,{...i,...r,ref:t}):null});TH.displayName=wH;var EH=`SelectBubbleInput`,DH=L.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{let i=L.useRef(null),a=ID(r,i),o=hV(t);return L.useEffect(()=>{let e=i.current;if(!e)return;let n=window.HTMLSelectElement.prototype,r=Object.getOwnPropertyDescriptor(n,`value`).set;if(o!==t&&r){let n=new Event(`change`,{bubbles:!0});r.call(e,t),e.dispatchEvent(n)}},[o,t]),(0,R.jsx)(VD.select,{...n,style:{...gV,...n.style},ref:a,defaultValue:t})});DH.displayName=EH;function OH(e){return e===``||e===void 0}function kH(e){let t=HD(e),n=L.useRef(``),r=L.useRef(0),i=L.useCallback(e=>{let i=n.current+e;t(i),(function e(t){n.current=t,window.clearTimeout(r.current),t!==``&&(r.current=window.setTimeout(()=>e(``),1e3))})(i)},[t]),a=L.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return L.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function AH(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=jH(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function jH(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var MH=MV,NH=PV,PH=IV,FH=RV,IH=BV,LH=HV,RH=nH,zH=fH,BH=mH,VH=CH,[HH,wue]=LD(`Tooltip`,[tA]),UH=tA(),WH=`TooltipProvider`,GH=700,KH=`tooltip.open`,[qH,JH]=HH(WH),YH=e=>{let{__scopeTooltip:t,delayDuration:n=GH,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=L.useRef(!0),s=L.useRef(!1),c=L.useRef(0);return L.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,R.jsx)(qH,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:L.useCallback(()=>{window.clearTimeout(c.current),o.current=!1},[]),onClose:L.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:s,onPointerInTransitChange:L.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};YH.displayName=WH;var XH=`Tooltip`,[ZH,QH]=HH(XH),$H=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=JH(XH,e.__scopeTooltip),l=UH(t),[u,d]=L.useState(null),f=mO(),p=L.useRef(0),m=o??c.disableHoverableContent,h=s??c.delayDuration,g=L.useRef(!1),[_,v]=kA({prop:r,defaultProp:i??!1,onChange:e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(KH))):c.onClose(),a?.(e)},caller:XH}),y=L.useMemo(()=>_?g.current?`delayed-open`:`instant-open`:`closed`,[_]),b=L.useCallback(()=>{window.clearTimeout(p.current),p.current=0,g.current=!1,v(!0)},[v]),x=L.useCallback(()=>{window.clearTimeout(p.current),p.current=0,v(!1)},[v]),S=L.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{g.current=!0,v(!0),p.current=0},h)},[h,v]);return L.useEffect(()=>()=>{p.current&&=(window.clearTimeout(p.current),0)},[]),(0,R.jsx)(_A,{...l,children:(0,R.jsx)(ZH,{scope:t,contentId:f,open:_,stateAttribute:y,trigger:u,onTriggerChange:d,onTriggerEnter:L.useCallback(()=>{c.isOpenDelayedRef.current?S():b()},[c.isOpenDelayedRef,S,b]),onTriggerLeave:L.useCallback(()=>{m?x():(window.clearTimeout(p.current),p.current=0)},[x,m]),onOpen:b,onClose:x,disableHoverableContent:m,children:n})})};$H.displayName=XH;var eU=`TooltipTrigger`,tU=L.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=QH(eU,n),a=JH(eU,n),o=UH(n),s=ID(t,L.useRef(null),i.onTriggerChange),c=L.useRef(!1),l=L.useRef(!1),u=L.useCallback(()=>c.current=!1,[]);return L.useEffect(()=>()=>document.removeEventListener(`pointerup`,u),[u]),(0,R.jsx)(vA,{asChild:!0,...o,children:(0,R.jsx)(VD.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:s,onPointerMove:ND(e.onPointerMove,e=>{e.pointerType!==`touch`&&!l.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),l.current=!0)}),onPointerLeave:ND(e.onPointerLeave,()=>{i.onTriggerLeave(),l.current=!1}),onPointerDown:ND(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener(`pointerup`,u,{once:!0})}),onFocus:ND(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:ND(e.onBlur,i.onClose),onClick:ND(e.onClick,i.onClose)})})});tU.displayName=eU;var nU=`TooltipPortal`,[rU,iU]=HH(nU,{forceMount:void 0}),aU=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=QH(nU,t);return(0,R.jsx)(rU,{scope:t,forceMount:n,children:(0,R.jsx)(wA,{present:n||a.open,children:(0,R.jsx)(SA,{asChild:!0,container:i,children:r})})})};aU.displayName=nU;var oU=`TooltipContent`,sU=L.forwardRef((e,t)=>{let n=iU(oU,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=QH(oU,e.__scopeTooltip);return(0,R.jsx)(wA,{present:r||o.open,children:o.disableHoverableContent?(0,R.jsx)(fU,{side:i,...a,ref:t}):(0,R.jsx)(cU,{side:i,...a,ref:t})})}),cU=L.forwardRef((e,t)=>{let n=QH(oU,e.__scopeTooltip),r=JH(oU,e.__scopeTooltip),i=L.useRef(null),a=ID(t,i),[o,s]=L.useState(null),{trigger:c,onClose:l}=n,u=i.current,{onPointerInTransitChange:d}=r,f=L.useCallback(()=>{s(null),d(!1)},[d]),p=L.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=gU(r,hU(r,n.getBoundingClientRect())),a=_U(t.getBoundingClientRect());s(yU([...i,...a])),d(!0)},[d]);return L.useEffect(()=>()=>f(),[f]),L.useEffect(()=>{if(c&&u){let e=e=>p(e,u),t=e=>p(e,c);return c.addEventListener(`pointerleave`,e),u.addEventListener(`pointerleave`,t),()=>{c.removeEventListener(`pointerleave`,e),u.removeEventListener(`pointerleave`,t)}}},[c,u,p,f]),L.useEffect(()=>{if(o){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||u?.contains(t),i=!vU(n,o);r?f():i&&(f(),l())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,f]),(0,R.jsx)(fU,{...e,ref:a})}),[lU,uU]=HH(XH,{isInside:!1}),dU=Xie(`TooltipContent`),fU=L.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,c=QH(oU,n),l=UH(n),{onClose:u}=c;return L.useEffect(()=>(document.addEventListener(KH,u),()=>document.removeEventListener(KH,u)),[u]),L.useEffect(()=>{if(c.trigger){let e=e=>{e.target?.contains(c.trigger)&&u()};return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[c.trigger,u]),(0,R.jsx)(KD,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:u,children:(0,R.jsxs)(yA,{"data-state":c.stateAttribute,...l,...s,ref:t,style:{...s.style,"--radix-tooltip-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-tooltip-content-available-width":`var(--radix-popper-available-width)`,"--radix-tooltip-content-available-height":`var(--radix-popper-available-height)`,"--radix-tooltip-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-tooltip-trigger-height":`var(--radix-popper-anchor-height)`},children:[(0,R.jsx)(dU,{children:r}),(0,R.jsx)(lU,{scope:n,isInside:!0,children:(0,R.jsx)(yV,{id:c.contentId,role:`tooltip`,children:i||r})})]})})});sU.displayName=oU;var pU=`TooltipArrow`,mU=L.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=UH(n);return uU(pU,n).isInside?null:(0,R.jsx)(bA,{...i,...r,ref:t})});mU.displayName=pU;function hU(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}function gU(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function _U(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function vU(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function yU(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:+(e.y>t.y)),bU(t)}function bU(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var xU=YH,SU=$H,CU=tU,wU=aU,TU=sU,EU=mU,DU=L.forwardRef(({title:e,children:t},n)=>{let r=Rl(hT);return L.createElement(xU,{delayDuration:100},L.createElement(SU,null,L.createElement(CU,{ref:n,asChild:!0},L.createElement(`span`,{className:fE.tooltipTrigger},t)),L.createElement(wU,{container:r?.current},L.createElement(TU,{className:(0,tD.default)(fE.tooltipContent),sideOffset:10},e))))}),OU=L.forwardRef(({children:e,className:t,...n},r)=>L.createElement(zH,{...n,ref:r,className:(0,tD.default)(t,fE.selectItem)},L.createElement(BH,null,e))),kU=({title:e,placeholder:t,className:n})=>{let[r,i]=zl(Ww,jT);return L.createElement(DU,{title:e},L.createElement(NH,{"aria-label":t,className:(0,tD.default)(fE.selectTrigger,n),"data-toolbar-item":!0,disabled:r},L.createElement(PH,{placeholder:t}),L.createElement(FH,{className:fE.selectDropdownArrow},i(`arrow_drop_down`))))},AU=({children:e,className:t=fE.selectContainer})=>{let n=Rl(hT);return L.createElement(IH,{container:n?.current},L.createElement(LH,{className:(0,tD.default)(t,`mdxeditor-select-content`),onCloseAutoFocus:e=>{e.preventDefault()},position:`popper`},L.createElement(RH,{"data-editor-dropdown":!0,style:{maxHeight:`var(--radix-select-content-available-height)`}},e)))},jU=e=>L.createElement(MH,{value:e.value||``,onValueChange:e.onChange,disabled:e.disabled},L.createElement(kU,{title:e.triggerTitle,placeholder:e.placeholder}),L.createElement(AU,null,e.items.map((e,t)=>e===`separator`?L.createElement(VH,{key:t}):L.createElement(OU,{key:t,value:e.value},e.label)))),MU=({language:e,nodeKey:t,code:n,focusEmitter:r})=>{let i=tE(),{parentEditor:a,lexicalNode:o}=OL(),[s,c,l,u,d]=zl(Ww,RU,zU,jT,IU),p=Ule(t,`codeblock`,e,r),{setCode:m}=OL(),h=L.useRef(null),g=L.useRef(null),{value:_,items:v}=L.useMemo(()=>FU(d,e),[d,e]),y=L.useRef(m);return y.current=m,p.current={getCodemirror:()=>h.current},L.useEffect(()=>{let t=g.current;return(async()=>{let r=[...c,pV,Xle,j(),ae.of([Hle]),f.lineWrapping,f.updateListener.of(({state:e})=>{y.current(e.doc.toString())}),f.domEventHandlers({focus:()=>{a.update(()=>{Fh(null)})}})];if(s&&r.push(we.readOnly.of(!0)),e!==``){let t=d.keyMap[e]??e,n=d.supportMap[t];if(n)r.push(n.extension);else if(l){let t=Wle.find(t=>t.name===e||t.alias.includes(e)||t.extensions.includes(e));if(t)try{let e=await t.load();r.push(e.extension)}catch{console.warn(`failed to load language support for`,e)}}}t.innerHTML=``,h.current=new f({parent:t,state:we.create({doc:n,extensions:r})}),t.addEventListener(`keydown`,NU)})(),()=>{var e;(e=h.current)==null||e.destroy(),h.current=null,t.removeEventListener(`keydown`,NU)}},[s,e,...c]),L.createElement(`div`,{className:fE.codeMirrorWrapper},L.createElement(`div`,{className:fE.codeMirrorToolbar},L.createElement(jU,{disabled:s,value:_,onChange:e=>{a.update(()=>{o.setLanguage(e===`__EMPTY_VALUE__`?``:e),setTimeout(()=>{a.update(()=>{o.getLatest().select()})})})},triggerTitle:i(`codeBlock.selectLanguage`,`Select code block language`),placeholder:i(`codeBlock.inlineLanguage`,`Language`),items:v}),L.createElement(`button`,{className:fE.iconButton,type:`button`,disabled:s,title:i(`codeblock.delete`,`Delete code block`),onClick:e=>{e.preventDefault(),a.update(()=>{o.remove()})}},u(`delete_small`))),L.createElement(`div`,{ref:g}))};function NU(e){e.stopPropagation()}function PU(e){let t=[],n={},r={};if(Array.isArray(e))for(let i of e){let e=i.alias?.[0]??i.name.toLowerCase(),a=e||`__EMPTY_VALUE__`;if(t.push({value:a,label:i.name}),n[e]=a,i.alias)for(let e of i.alias)n[e]=a;if(i.extensions)for(let e of i.extensions)n[e]=a;n[i.name.toLowerCase()]=a,i.support&&(r[a]=i.support)}else{let r={};for(let[i,a]of Object.entries(e))a in r||(r[a]=i,t.push({value:i||`__EMPTY_VALUE__`,label:a})),n[i]=r[a]||`__EMPTY_VALUE__`}return{items:t,keyMap:n,supportMap:r}}function FU(e,t){let n=e.keyMap[t]??t;return!n||e.items.some(e=>e.value===n)?{value:n,items:e.items}:{value:n,items:[...e.items,{value:n,label:t}]}}var IU=Nl(PU({js:`JavaScript`,ts:`TypeScript`,tsx:`TypeScript (React)`,jsx:`JavaScript (React)`,css:`CSS`})),LU=Pl(e=>{e.link(e.pipe(LU,Vl(({language:e,code:t})=>({code:t,language:e,meta:``}))),jL)}),RU=Nl([]),zU=Nl(!0),BU=ql({update(e,t){e.pubIn({[IU]:PU(t?.codeBlockLanguages??{}),[RU]:t?.codeMirrorExtensions??[],[zU]:t?.autoLoadLanguageSupport??!0})},init(e,t){let n=PU(t?.codeBlockLanguages??{});e.pubIn({[IU]:n,[RU]:t?.codeMirrorExtensions??[],[Mse]:VU(),[zU]:t?.autoLoadLanguageSupport??!0})}});function VU(e){return{match(e,t){return!t},priority:1,Editor:MU}}function HU({url:e,title:t,text:n,onSubmit:r,onCancel:i,linkAutocompleteSuggestions:a,showLinkTitleField:o,showAnchorTextField:s}){let{register:c,handleSubmit:l,control:u,setValue:d,reset:f}=QP({values:{url:e,title:t,text:n}}),p=tE();return L.createElement(`form`,{onSubmit:e=>{l(r)(e),e.stopPropagation(),e.preventDefault()},onReset:e=>{e.stopPropagation(),i()},onKeyDown:e=>{e.key===`Escape`&&(e.stopPropagation(),i())},className:(0,tD.default)(fE.multiFieldForm,fE.linkDialogEditForm)},L.createElement(`div`,{className:fE.formField},L.createElement(`label`,{htmlFor:`link-url`},p(`createLink.url`,`URL`)),L.createElement(vse,{register:c,initialInputValue:e,inputName:`url`,suggestions:a,setValue:d,control:u,placeholder:p(`createLink.urlPlaceholder`,`Select or paste an URL`),autofocus:!0})),s?L.createElement(`div`,{className:fE.formField},L.createElement(`label`,{htmlFor:`link-text`,title:p(`createLink.textTooltip`,`The text to be displayed for the link`)},p(`createLink.text`,`Anchor text`)),L.createElement(`input`,{id:`link-text`,className:fE.textInput,size:40,...c(`text`)})):null,o?L.createElement(`div`,{className:fE.formField},L.createElement(`label`,{htmlFor:`link-title`,title:p(`createLink.titleTooltip`,`The link's title attribute, shown on hover`)},p(`createLink.title`,`Link title`)),L.createElement(`input`,{id:`link-title`,className:fE.textInput,size:40,...c(`title`)})):null,L.createElement(`div`,{style:{display:`flex`,justifyContent:`flex-end`,gap:`var(--spacing-2)`}},L.createElement(`button`,{type:`submit`,title:p(`createLink.saveTooltip`,`Set URL`),"aria-label":p(`createLink.saveTooltip`,`Set URL`),className:(0,tD.default)(fE.primaryButton)},p(`dialogControls.save`,`Save`)),L.createElement(`button`,{type:`reset`,title:p(`createLink.cancelTooltip`,`Cancel change`),"aria-label":p(`createLink.cancelTooltip`,`Cancel change`),className:(0,tD.default)(fE.secondaryButton)},p(`dialogControls.cancel`,`Cancel`))))}var UU=()=>{let[e,t,n,r,i,a,o]=zl(hT,Vw,jT,qU,$U,eW,rW),s=Bl(KU),c=Bl(JU),l=Bl(YU),u=Bl(XU),d=Bl(ZU);L.useEffect(()=>{let e=()=>{t?.getEditorState().read(()=>{s(!0)})};return window.addEventListener(`resize`,e),window.addEventListener(`scroll`,e),()=>{window.removeEventListener(`resize`,e),window.removeEventListener(`scroll`,e)}},[t,s]);let[f,p]=L.useState(!1),m=tE();if(r.type===`inactive`)return null;let h=r.rectangle,g=r.type===`preview`&&r.url.startsWith(`http`);return L.createElement(qj,{open:!0},L.createElement(voe,{"data-visible":r.type===`edit`,className:fE.linkDialogAnchor,style:{top:`${h.top}px`,left:`${h.left}px`,width:`${h.width}px`,height:`${h.height}px`}}),L.createElement(Jj,{container:e?.current},L.createElement(yoe,{className:(0,tD.default)(fE.linkDialogPopoverContent),sideOffset:5,onOpenAutoFocus:e=>{e.preventDefault()},key:r.linkNodeKey},r.type===`edit`&&L.createElement(HU,{url:r.url,title:r.title,text:r.text,onSubmit:c,onCancel:l.bind(null),linkAutocompleteSuggestions:i,showLinkTitleField:o,showAnchorTextField:r.withAnchorText}),r.type===`preview`&&L.createElement(L.Fragment,null,L.createElement(`a`,{className:fE.linkDialogPreviewAnchor,href:r.url,...g?{target:`_blank`,rel:`noreferrer`}:{},onClick:e=>{a!==null&&(e.preventDefault(),a(r.url))},title:g?m(`linkPreview.open`,`Open {{url}} in new window`,{url:r.url}):r.url},L.createElement(`span`,null,r.url),g&&n(`open_in_new`)),L.createElement(WU,{onClick:()=>{u()},title:m(`linkPreview.edit`,`Edit link URL`),"aria-label":m(`linkPreview.edit`,`Edit link URL`)},n(`edit`)),L.createElement(xU,null,L.createElement(SU,{open:f},L.createElement(CU,{asChild:!0},L.createElement(WU,{title:m(`linkPreview.copyToClipboard`,`Copy to clipboard`),"aria-label":m(`linkPreview.copyToClipboard`,`Copy to clipboard`),onClick:()=>{window.navigator.clipboard.writeText(r.url).then(()=>{p(!0),setTimeout(()=>{p(!1)},1e3)})}},n(f?`check`:`content_copy`))),L.createElement(wU,{container:e?.current},L.createElement(TU,{className:(0,tD.default)(fE.tooltipContent),sideOffset:5},m(`linkPreview.copied`,`Copied!`),L.createElement(EU,null))))),L.createElement(WU,{title:m(`linkPreview.remove`,`Remove link`),"aria-label":m(`linkPreview.remove`,`Remove link`),onClick:()=>{d()}},n(`link_off`))),L.createElement(Yj,{className:fE.popoverArrow}))))},WU=L.forwardRef(({className:e,...t},n)=>L.createElement(`button`,{className:(0,tD.default)(fE.actionButton,e),ref:n,...t}));function GU(e){if(!e)return null;let t=Kre(e);if(t===null)return null;let n=t.getParent();return hE(n)?n:hE(t)?t:null}var KU=Pl(),qU=Nl({type:`inactive`},e=>{e.pub(FT,t=>t.registerCommand(pf,()=>e.getValue(qU).type===`preview`?(e.pub(qU,{type:`inactive`}),!0):!1,1)),e.sub(e.pipe(YT),t=>{t!==`rich-text`&&e.pub(qU,{type:`inactive`})}),e.pub(FT,t=>t.registerCommand(nf,t=>t.key===`k`&&(rD?t.metaKey:t.ctrlKey)&&!e.getValue(Ww)&&U(W())?(e.pub(QU),t.stopPropagation(),t.preventDefault(),!0):!1,3)),e.sub(e.pipe(XU,Hl(qU,Vw)),([,t,n])=>{if(t.type===`preview`)setTimeout(()=>{n?.getEditorState().read(()=>{let n=Dh(t.linkNodeKey),r=hE(n)?n.getTextContent().length>0&&n.getChildrenSize()<=1:!1,i=r&&n?n.getTextContent():``;e.pub(qU,{type:`edit`,initialUrl:t.url,url:t.url,title:t.title,text:i,withAnchorText:r,linkNodeKey:t.linkNodeKey,rectangle:t.rectangle})})});else throw Error(`Cannot switch to edit mode when not in preview mode`)}),e.sub(e.pipe(JU,Hl(Vw,qU,Qw)),([t,n,r,i])=>{let a=t.text?.trim()??``,o=t.url?.trim()??``,s=t.title?.trim()??``;if(o!==``){if(i?.isCollapsed()){let e=a||s||o;n?.update(()=>{let t=GU(i);if(!t){let t=mE(o,{title:s});t.append(Mp(e)),dm([t]),t.select()}else if(vE(t)){let e=mE(o,{title:s});e.append(Mp(a)),t.replace(e),e.select()}else t.setURL(o),t.setTitle(s),nW(t.getFirstChild(),a)},{discrete:!0})}else n?.update(()=>{nW(i?.anchor.getNode(),a)}),n?.dispatchCommand(yE,{url:o,title:s});e.pub(qU,{type:`preview`,linkNodeKey:r.linkNodeKey,rectangle:r.rectangle,title:s,url:o})}else r.type===`edit`&&r.initialUrl!==``&&n?.dispatchCommand(yE,null),e.pub(qU,{type:`inactive`})}),e.link(e.pipe(YU,Hl(qU,Vw),Vl(([,e,t])=>{if(e.type===`edit`)return t?.focus(),e.initialUrl===``?{type:`inactive`}:{type:`preview`,url:e.initialUrl,linkNodeKey:e.linkNodeKey,rectangle:e.rectangle};throw Error(`Cannot cancel edit when not in edit mode`)})),qU),e.link(e.pipe(e.combine(Qw,KU),Hl(Vw,qU,Ww),Vl(([[e],t,n,r])=>{if(U(e)&&t&&!r){let n=GU(e);if(!e.isCollapsed())return{type:`inactive`};if(n){let e=eD(t);return e?{type:`preview`,url:n.getURL(),linkNodeKey:n.getKey(),title:n.getTitle(),rectangle:e}:{type:`inactive`}}else return{type:`inactive`}}else return{type:`inactive`}})),qU)}),JU=Pl(),YU=Fl();Fl();var XU=Fl(),ZU=Fl(e=>{e.sub(e.pipe(ZU,Hl(Vw)),([,e])=>{e?.dispatchCommand(yE,null)})}),QU=Fl(e=>{e.sub(e.pipe(QU,Hl(Qw,Vw),Ul(([,e])=>U(e))),([,t,n])=>{n?.focus(()=>{setTimeout(()=>{n.getEditorState().read(()=>{let r=GU(t),i=eD(n),a=r?.getURL()??``,o=r?.getURL()??``,s=r?.getTitle()??``,c=r?.getKey()??``,l=r?r.getTextContent().length>0&&r.getChildrenSize()<=1:!!t?.isCollapsed(),u=l&&r?r.getTextContent():``;e.pub(qU,{type:`edit`,initialUrl:a,url:o,title:s,text:u,withAnchorText:l,linkNodeKey:c,rectangle:i})})})})})}),$U=Nl([]),eW=Nl(null),tW=Nl(null,e=>{e.pub(FT,t=>{function n(n){let[r,i]=e.getValues([Ww,tW]);!r||i===null||t.update(()=>{let e=Ah(n.target);if(e!==null){let t=W_(e,e=>e instanceof pE);t!==null&&i(n,t,t.getURL())}})}return t.registerRootListener((e,t)=>{e&&e.addEventListener(`click`,n),t&&t.removeEventListener(`click`,n)})})});function nW(e,t){H(e)&&t&&(e.setTextContent(t),e.selectStart())}var rW=Nl(!0),iW=ql({init(e,t){e.pub(RT,t?.LinkDialog??UU),e.pub(eW,t?.onClickLinkCallback??null),e.pub(tW,t?.onReadOnlyClickLinkCallback??null),e.pub(rW,t?.showLinkTitleField??!0)},update(e,t={}){e.pub($U,t.linkAutocompleteSuggestions??[])}});function aW(e,t){return L.forwardRef((n,r)=>{let i=(0,tD.default)(t.className,n.className);return L.createElement(e,{...t,...n,className:i,ref:r})})}function oW(e){return({title:t,children:n,...r})=>L.createElement(e,{"aria-label":t,...r},L.createElement(DU,{title:t},n))}var sW=({readOnly:e,children:t,className:n})=>L.createElement(FM,{className:(0,tD.default)(`mdxeditor-toolbar`,fE.toolbarRoot,{[fE.readOnlyToolbarRoot]:e},n),...e?{tabIndex:-1}:{}},t),cW=oW(aW(IM,{className:fE.toolbarButton,"data-toolbar-item":!0})),lW=aW(RM,{className:fE.toolbarToggleItem,"data-toolbar-item":!0});aW(LM,{type:`single`,className:fE.toolbarToggleSingleGroup});var uW=L.forwardRef(({on:e,title:t,children:n,disabled:r,...i},a)=>L.createElement(LM,{type:`single`,className:fE.toolbarToggleSingleGroup,...i,value:e?`on`:`off`,ref:a},L.createElement(lW,{"aria-label":t,value:`on`,disabled:r},L.createElement(DU,{title:t},n)))),dW=({items:e})=>L.createElement(`div`,{className:fE.toolbarGroupOfGroups},e.map((e,t)=>L.createElement(uW,{key:t,title:e.title,on:e.active,onValueChange:t=>{e.onChange(t===`on`)},disabled:e.disabled},e.contents))),fW=({value:e,onChange:t,className:n,ggClassName:r,items:i,disabled:a})=>{let o=tE();return L.createElement(`div`,{className:(0,tD.default)(fE.toolbarGroupOfGroups,r)},L.createElement(LM,{"aria-label":o(`toolbar.toggleGroup`,`toggle group`),type:`single`,className:(0,tD.default)(fE.toolbarToggleSingleGroup,n),onValueChange:t,value:e||``,disabled:a,onFocus:e=>{e.preventDefault()}},i.map((e,t)=>L.createElement(lW,{key:t,"aria-label":e.title,value:e.value},L.createElement(DU,{title:e.title},e.contents)))))},pW=Nl(()=>null),mW=Nl(``),hW=()=>"This is an empty toolbar. Pass `{toolbarContents: () => { return <>toolbar components</> }}` to the toolbarPlugin to customize it.",gW=ql({init(e,t){let n=t?.toolbarPosition===`bottom`?pre:fre;e.pubIn({[pW]:t?.toolbarContents??hW,[mW]:t?.toolbarClassName??``,[n]:()=>{let[e,t,n]=zl(pW,Ww,mW);return L.createElement(sW,{className:n,readOnly:t},e())}})},update(e,t){e.pub(pW,t?.toolbarContents??hW),e.pub(mW,t?.toolbarClassName??``)}});Prism.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/},Prism.languages.javascript=Prism.languages.extend(`clike`,{"class-name":[Prism.languages.clike[`class-name`],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(`(^|[^\\w$])(?:NaN|Infinity|0[bB][01]+(?:_[01]+)*n?|0[oO][0-7]+(?:_[0-7]+)*n?|0[xX][\\dA-Fa-f]+(?:_[\\dA-Fa-f]+)*n?|\\d+(?:_\\d+)*n|(?:\\d+(?:_\\d+)*(?:\\.(?:\\d+(?:_\\d+)*)?)?|\\.\\d+(?:_\\d+)*)(?:[Ee][+-]?\\d+(?:_\\d+)*)?)(?![\\w$])`),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),Prism.languages.javascript[`class-name`][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,Prism.languages.insertBefore(`javascript`,`keyword`,{regex:{pattern:RegExp(`((?:^|[^$\\w\\xA0-\\uFFFF."'\\])\\s]|\\b(?:return|yield))\\s*)\\/(?:(?:\\[(?:[^\\]\\\\\\r\\n]|\\\\.)*\\]|\\\\.|[^/\\\\\\[\\r\\n])+\\/[dgimyus]{0,7}|(?:\\[(?:[^[\\]\\\\\\r\\n]|\\\\.|\\[(?:[^[\\]\\\\\\r\\n]|\\\\.|\\[(?:[^[\\]\\\\\\r\\n]|\\\\.)*\\])*\\])*\\]|\\\\.|[^/\\\\\\[\\r\\n])+\\/[dgimyus]{0,7}v[dgimyus]{0,7})(?=(?:\\s|\\/\\*(?:[^*]|\\*(?!\\/))*\\*\\/)*(?:$|[\\r\\n,.;:})\\]]|\\/\\/))`),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:`language-regex`,inside:Prism.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:`function`},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:Prism.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),Prism.languages.insertBefore(`javascript`,`string`,{hashbang:{pattern:/^#!.*/,greedy:!0,alias:`comment`},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:`string`},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:`punctuation`},rest:Prism.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:`property`}}),Prism.languages.insertBefore(`javascript`,`operator`,{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:`property`}}),Prism.languages.markup&&(Prism.languages.markup.tag.addInlined(`script`,`javascript`),Prism.languages.markup.tag.addAttribute(`on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)`,`javascript`)),Prism.languages.js=Prism.languages.javascript,Prism.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:`attr-equals`},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:`named-entity`},/&#x?[\da-f]{1,8};/i]},Prism.languages.markup.tag.inside[`attr-value`].inside.entity=Prism.languages.markup.entity,Prism.languages.markup.doctype.inside[`internal-subset`].inside=Prism.languages.markup,Prism.hooks.add(`wrap`,function(e){e.type===`entity`&&(e.attributes.title=e.content.replace(/&amp;/,`&`))}),Object.defineProperty(Prism.languages.markup.tag,`addInlined`,{value:function(e,t){var n={};n[`language-`+t]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:Prism.languages[t]},n.cdata=/^<!\[CDATA\[|\]\]>$/i;var r={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:n}};r[`language-`+t]={pattern:/[\s\S]+/,inside:Prism.languages[t]};var i={};i[e]={pattern:RegExp(`(<__[^>]*>)(?:<!\\[CDATA\\[(?:[^\\]]|\\](?!\\]>))*\\]\\]>|(?!<!\\[CDATA\\[)[\\s\\S])*?(?=<\\/__>)`.replace(/__/g,function(){return e}),`i`),lookbehind:!0,greedy:!0,inside:r},Prism.languages.insertBefore(`markup`,`cdata`,i)}}),Object.defineProperty(Prism.languages.markup.tag,`addAttribute`,{value:function(e,t){Prism.languages.markup.tag.inside[`special-attr`].push({pattern:RegExp(`(^|["'\\s])(?:`+e+`)\\s*=\\s*(?:"[^"]*"|'[^']*'|[^\\s'">=]+(?=[\\s>]))`,`i`),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[t,`language-`+t],inside:Prism.languages[t]},punctuation:[{pattern:/^=/,alias:`attr-equals`},/"|'/]}}}})}}),Prism.languages.html=Prism.languages.markup,Prism.languages.mathml=Prism.languages.markup,Prism.languages.svg=Prism.languages.markup,Prism.languages.xml=Prism.languages.extend(`markup`,{}),Prism.languages.ssml=Prism.languages.xml,Prism.languages.atom=Prism.languages.xml,Prism.languages.rss=Prism.languages.xml,(function(e){var t=`(?:\\\\.|[^\\\\\\n\\r]|(?:\\n|\\r\\n?)(?![\\r\\n]))`;function n(e){return e=e.replace(/<inner>/g,function(){return t}),RegExp(`((?:^|[^\\\\])(?:\\\\{2})*)(?:`+e+`)`)}var r="(?:\\\\.|``(?:[^`\\r\\n]|`(?!`))+``|`[^`\\r\\n]+`|[^\\\\|\\r\\n`])+",i=`\\|?__(?:\\|__)+\\|?(?:(?:\\n|\\r\\n?)|(?![\\s\\S]))`.replace(/__/g,function(){return r}),a=`\\|?[ \\t]*:?-{3,}:?[ \\t]*(?:\\|[ \\t]*:?-{3,}:?[ \\t]*)+\\|?(?:\\n|\\r\\n?)`;e.languages.markdown=e.languages.extend(`markup`,{}),e.languages.insertBefore(`markdown`,`prolog`,{"front-matter-block":{pattern:/(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,lookbehind:!0,greedy:!0,inside:{punctuation:/^---|---$/,"front-matter":{pattern:/\S+(?:\s+\S+)*/,alias:[`yaml`,`language-yaml`],inside:e.languages.yaml}}},blockquote:{pattern:/^>(?:[\t ]*>)*/m,alias:`punctuation`},table:{pattern:RegExp(`^`+i+a+`(?:`+i+`)*`,`m`),inside:{"table-data-rows":{pattern:RegExp(`^(`+i+a+`)(?:`+i+`)*$`),lookbehind:!0,inside:{"table-data":{pattern:RegExp(r),inside:e.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp(`^(`+i+`)`+a+`$`),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp(`^`+i+`$`),inside:{"table-header":{pattern:RegExp(r),alias:`important`,inside:e.languages.markdown},punctuation:/\|/}}}},code:[{pattern:/((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,lookbehind:!0,alias:`keyword`},{pattern:/^```[\s\S]*?^```$/m,greedy:!0,inside:{"code-block":{pattern:/^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,lookbehind:!0},"code-language":{pattern:/^(```).+/,lookbehind:!0},punctuation:/```/}}],title:[{pattern:/\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,alias:`important`,inside:{punctuation:/==+$|--+$/}},{pattern:/(^\s*)#.+/m,lookbehind:!0,alias:`important`,inside:{punctuation:/^#+|#+$/}}],hr:{pattern:/(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,lookbehind:!0,alias:`punctuation`},list:{pattern:/(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,lookbehind:!0,alias:`punctuation`},"url-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,inside:{variable:{pattern:/^(!?\[)[^\]]+/,lookbehind:!0},string:/(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,punctuation:/^[\[\]!:]|[<>]/},alias:`url`},bold:{pattern:n(`\\b__(?:(?!_)<inner>|_(?:(?!_)<inner>)+_)+__\\b|\\*\\*(?:(?!\\*)<inner>|\\*(?:(?!\\*)<inner>)+\\*)+\\*\\*`),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:n(`\\b_(?:(?!_)<inner>|__(?:(?!_)<inner>)+__)+_\\b|\\*(?:(?!\\*)<inner>|\\*\\*(?:(?!\\*)<inner>)+\\*\\*)+\\*`),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:n(`(~~?)(?:(?!~)<inner>)+\\2`),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^~~?)[\s\S]+(?=\1$)/,lookbehind:!0,inside:{}},punctuation:/~~?/}},"code-snippet":{pattern:/(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,lookbehind:!0,greedy:!0,alias:[`code`,`keyword`]},url:{pattern:n(`!?\\[(?:(?!\\])<inner>)+\\](?:\\([^\\s)]+(?:[\\t ]+"(?:\\\\.|[^"\\\\])*")?\\)|[ \\t]?\\[(?:(?!\\])<inner>)+\\])`),lookbehind:!0,greedy:!0,inside:{operator:/^!/,content:{pattern:/(^\[)[^\]]+(?=\])/,lookbehind:!0,inside:{}},variable:{pattern:/(^\][ \t]?\[)[^\]]+(?=\]$)/,lookbehind:!0},url:{pattern:/(^\]\()[^\s)]+/,lookbehind:!0},string:{pattern:/(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,lookbehind:!0}}}}),[`url`,`bold`,`italic`,`strike`].forEach(function(t){[`url`,`bold`,`italic`,`strike`,`code-snippet`].forEach(function(n){t!==n&&(e.languages.markdown[t].inside.content.inside[n]=e.languages.markdown[n])})}),e.hooks.add(`after-tokenize`,function(e){if(e.language!==`markdown`&&e.language!==`md`)return;function t(e){if(!(!e||typeof e==`string`))for(var n=0,r=e.length;n<r;n++){var i=e[n];if(i.type!==`code`){t(i.content);continue}var a=i.content[1],o=i.content[3];if(a&&o&&a.type===`code-language`&&o.type===`code-block`&&typeof a.content==`string`){var s=a.content.replace(/\b#/g,`sharp`).replace(/\b\+\+/g,`pp`);s=(/[a-z][\w-]*/i.exec(s)||[``])[0].toLowerCase();var c=`language-`+s;o.alias?typeof o.alias==`string`?o.alias=[o.alias,c]:o.alias.push(c):o.alias=[c]}}}t(e.tokens)}),e.hooks.add(`wrap`,function(t){if(t.type===`code-block`){for(var n=``,r=0,i=t.classes.length;r<i;r++){var a=t.classes[r],o=/language-(.+)/.exec(a);if(o){n=o[1];break}}var s=e.languages[n];if(s)t.content=e.highlight(l(t.content),s,n);else if(n&&n!==`none`&&e.plugins.autoloader){var c=`md-`+new Date().valueOf()+`-`+Math.floor(Math.random()*0x2386f26fc10000);t.attributes.id=c,e.plugins.autoloader.loadLanguages(n,function(){var t=document.getElementById(c);t&&(t.innerHTML=e.highlight(t.textContent,e.languages[n],n))})}}});var o=RegExp(e.languages.markup.tag.pattern.source,`gi`),s={amp:`&`,lt:`<`,gt:`>`,quot:`"`},c=String.fromCodePoint||String.fromCharCode;function l(e){var t=e.replace(o,``);return t=t.replace(/&(\w{1,8}|#x?[\da-f]{1,8});/gi,function(e,t){return t=t.toLowerCase(),t[0]===`#`?c(t[1]===`x`?parseInt(t.slice(2),16):Number(t.slice(1))):s[t]||e}),t}e.languages.md=e.languages.markdown})(Prism),Prism.languages.c=Prism.languages.extend(`clike`,{comment:{pattern:/\/\/(?:[^\r\n\\]|\\(?:\r\n?|\n|(?![\r\n])))*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},string:{pattern:/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},"class-name":{pattern:/(\b(?:enum|struct)\s+(?:__attribute__\s*\(\([\s\S]*?\)\)\s*)?)\w+|\b[a-z]\w*_t\b/,lookbehind:!0},keyword:/\b(?:_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic|_Imaginary|_Noreturn|_Static_assert|_Thread_local|__attribute__|asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|inline|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|typeof|union|unsigned|void|volatile|while)\b/,function:/\b[a-z_]\w*(?=\s*\()/i,number:/(?:\b0x(?:[\da-f]+(?:\.[\da-f]*)?|\.[\da-f]+)(?:p[+-]?\d+)?|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)[ful]{0,4}/i,operator:/>>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?/}),Prism.languages.insertBefore(`c`,`string`,{char:{pattern:/'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n]){0,32}'/,greedy:!0}}),Prism.languages.insertBefore(`c`,`string`,{macro:{pattern:/(^[\t ]*)#\s*[a-z](?:[^\r\n\\/]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|\\(?:\r\n|[\s\S]))*/im,lookbehind:!0,greedy:!0,alias:`property`,inside:{string:[{pattern:/^(#\s*include\s*)<[^>]+>/,lookbehind:!0},Prism.languages.c.string],char:Prism.languages.c.char,comment:Prism.languages.c.comment,"macro-name":[{pattern:/(^#\s*define\s+)\w+\b(?!\()/i,lookbehind:!0},{pattern:/(^#\s*define\s+)\w+\b(?=\()/i,lookbehind:!0,alias:`function`}],directive:{pattern:/^(#\s*)[a-z]+/,lookbehind:!0,alias:`keyword`},"directive-hash":/^#/,punctuation:/##|\\(?=[\r\n])/,expression:{pattern:/\S[\s\S]*/,inside:Prism.languages.c}}}}),Prism.languages.insertBefore(`c`,`function`,{constant:/\b(?:EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|__DATE__|__FILE__|__LINE__|__TIMESTAMP__|__TIME__|__func__|stderr|stdin|stdout)\b/}),delete Prism.languages.c.boolean,(function(e){var t=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;e.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp(`@[\\w-](?:[^;{\\s"']|\\s+(?!\\s)|`+t.source+`)*?(?:;|(?=\\s*\\{))`),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:`selector`},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp(`\\burl\\((?:`+t.source+`|(?:[^\\\\\\r\\n()"']|\\\\[\\s\\S])*)\\)`,`i`),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp(`^`+t.source+`$`),alias:`url`}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+t.source+`)*(?=\\s*\\{)`),lookbehind:!0},string:{pattern:t,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},e.languages.css.atrule.inside.rest=e.languages.css;var n=e.languages.markup;n&&(n.tag.addInlined(`style`,`css`),n.tag.addAttribute(`style`,`css`))})(Prism),Prism.languages.objectivec=Prism.languages.extend(`c`,{string:{pattern:/@?"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},keyword:/\b(?:asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|in|inline|int|long|register|return|self|short|signed|sizeof|static|struct|super|switch|typedef|typeof|union|unsigned|void|volatile|while)\b|(?:@interface|@end|@implementation|@protocol|@class|@public|@protected|@private|@property|@try|@catch|@finally|@throw|@synthesize|@dynamic|@selector)\b/,operator:/-[->]?|\+\+?|!=?|<<?=?|>>?=?|==?|&&?|\|\|?|[~^%?*\/@]/}),delete Prism.languages.objectivec[`class-name`],Prism.languages.objc=Prism.languages.objectivec,Prism.languages.sql={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,lookbehind:!0},variable:[{pattern:/@(["'`])(?:\\[\s\S]|(?!\1)[^\\])+\1/,greedy:!0},/@[\w.$]+/],string:{pattern:/(^|[^@\\])("|')(?:\\[\s\S]|(?!\2)[^\\]|\2\2)*\2/,greedy:!0,lookbehind:!0},identifier:{pattern:/(^|[^@\\])`(?:\\[\s\S]|[^`\\]|``)*`/,greedy:!0,lookbehind:!0,inside:{punctuation:/^`|`$/}},function:/\b(?:AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE)(?=\s*\()/i,keyword:/\b(?:ACTION|ADD|AFTER|ALGORITHM|ALL|ALTER|ANALYZE|ANY|APPLY|AS|ASC|AUTHORIZATION|AUTO_INCREMENT|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADED?|CASE|CHAIN|CHAR(?:ACTER|SET)?|CHECK(?:POINT)?|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMNS?|COMMENT|COMMIT(?:TED)?|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS(?:TABLE)?|CONTINUE|CONVERT|CREATE|CROSS|CURRENT(?:_DATE|_TIME|_TIMESTAMP|_USER)?|CURSOR|CYCLE|DATA(?:BASES?)?|DATE(?:TIME)?|DAY|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DELIMITERS?|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE|DROP|DUMMY|DUMP(?:FILE)?|DUPLICATE|ELSE(?:IF)?|ENABLE|ENCLOSED|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPED?|EXCEPT|EXEC(?:UTE)?|EXISTS|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR(?: EACH ROW)?|FORCE|FOREIGN|FREETEXT(?:TABLE)?|FROM|FULL|FUNCTION|GEOMETRY(?:COLLECTION)?|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|HOUR|IDENTITY(?:COL|_INSERT)?|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTERVAL|INTO|INVOKER|ISOLATION|ITERATE|JOIN|KEYS?|KILL|LANGUAGE|LAST|LEAVE|LEFT|LEVEL|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONG(?:BLOB|TEXT)|LOOP|MATCH(?:ED)?|MEDIUM(?:BLOB|INT|TEXT)|MERGE|MIDDLEINT|MINUTE|MODE|MODIFIES|MODIFY|MONTH|MULTI(?:LINESTRING|POINT|POLYGON)|NATIONAL|NATURAL|NCHAR|NEXT|NO|NONCLUSTERED|NULLIF|NUMERIC|OFF?|OFFSETS?|ON|OPEN(?:DATASOURCE|QUERY|ROWSET)?|OPTIMIZE|OPTION(?:ALLY)?|ORDER|OUT(?:ER|FILE)?|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREPARE|PREV|PRIMARY|PRINT|PRIVILEGES|PROC(?:EDURE)?|PUBLIC|PURGE|QUICK|RAISERROR|READS?|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEAT(?:ABLE)?|REPLACE|REPLICATION|REQUIRE|RESIGNAL|RESTORE|RESTRICT|RETURN(?:ING|S)?|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROW(?:COUNT|GUIDCOL|S)?|RTREE|RULE|SAVE(?:POINT)?|SCHEMA|SECOND|SELECT|SERIAL(?:IZABLE)?|SESSION(?:_USER)?|SET(?:USER)?|SHARE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|SQL|START(?:ING)?|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLES?|TABLESPACE|TEMP(?:ORARY|TABLE)?|TERMINATED|TEXT(?:SIZE)?|THEN|TIME(?:STAMP)?|TINY(?:BLOB|INT|TEXT)|TOP?|TRAN(?:SACTIONS?)?|TRIGGER|TRUNCATE|TSEQUAL|TYPES?|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNIQUE|UNLOCK|UNPIVOT|UNSIGNED|UPDATE(?:TEXT)?|USAGE|USE|USER|USING|VALUES?|VAR(?:BINARY|CHAR|CHARACTER|YING)|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH(?: ROLLUP|IN)?|WORK|WRITE(?:TEXT)?|YEAR)\b/i,boolean:/\b(?:FALSE|NULL|TRUE)\b/i,number:/\b0x[\da-f]+\b|\b\d+(?:\.\d*)?|\B\.\d+\b/i,operator:/[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|DIV|ILIKE|IN|IS|LIKE|NOT|OR|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,punctuation:/[;[\]()`,.]/},(function(e){var t=e.languages.powershell={comment:[{pattern:/(^|[^`])<#[\s\S]*?#>/,lookbehind:!0},{pattern:/(^|[^`])#.*/,lookbehind:!0}],string:[{pattern:/"(?:`[\s\S]|[^`"])*"/,greedy:!0,inside:null},{pattern:/'(?:[^']|'')*'/,greedy:!0}],namespace:/\[[a-z](?:\[(?:\[[^\]]*\]|[^\[\]])*\]|[^\[\]])*\]/i,boolean:/\$(?:false|true)\b/i,variable:/\$\w+\b/,function:[/\b(?:Add|Approve|Assert|Backup|Block|Checkpoint|Clear|Close|Compare|Complete|Compress|Confirm|Connect|Convert|ConvertFrom|ConvertTo|Copy|Debug|Deny|Disable|Disconnect|Dismount|Edit|Enable|Enter|Exit|Expand|Export|Find|ForEach|Format|Get|Grant|Group|Hide|Import|Initialize|Install|Invoke|Join|Limit|Lock|Measure|Merge|Move|New|Open|Optimize|Out|Ping|Pop|Protect|Publish|Push|Read|Receive|Redo|Register|Remove|Rename|Repair|Request|Reset|Resize|Resolve|Restart|Restore|Resume|Revoke|Save|Search|Select|Send|Set|Show|Skip|Sort|Split|Start|Step|Stop|Submit|Suspend|Switch|Sync|Tee|Test|Trace|Unblock|Undo|Uninstall|Unlock|Unprotect|Unpublish|Unregister|Update|Use|Wait|Watch|Where|Write)-[a-z]+\b/i,/\b(?:ac|cat|chdir|clc|cli|clp|clv|compare|copy|cp|cpi|cpp|cvpa|dbp|del|diff|dir|ebp|echo|epal|epcsv|epsn|erase|fc|fl|ft|fw|gal|gbp|gc|gci|gcs|gdr|gi|gl|gm|gp|gps|group|gsv|gu|gv|gwmi|iex|ii|ipal|ipcsv|ipsn|irm|iwmi|iwr|kill|lp|ls|measure|mi|mount|move|mp|mv|nal|ndr|ni|nv|ogv|popd|ps|pushd|pwd|rbp|rd|rdr|ren|ri|rm|rmdir|rni|rnp|rp|rv|rvpa|rwmi|sal|saps|sasv|sbp|sc|select|set|shcm|si|sl|sleep|sls|sort|sp|spps|spsv|start|sv|swmi|tee|trcm|type|write)\b/i],keyword:/\b(?:Begin|Break|Catch|Class|Continue|Data|Define|Do|DynamicParam|Else|ElseIf|End|Exit|Filter|Finally|For|ForEach|From|Function|If|InlineScript|Parallel|Param|Process|Return|Sequence|Switch|Throw|Trap|Try|Until|Using|Var|While|Workflow)\b/i,operator:{pattern:/(^|\W)(?:!|-(?:b?(?:and|x?or)|as|(?:Not)?(?:Contains|In|Like|Match)|eq|ge|gt|is(?:Not)?|Join|le|lt|ne|not|Replace|sh[lr])\b|-[-=]?|\+[+=]?|[*\/%]=?)/i,lookbehind:!0},punctuation:/[|{}[\];(),.]/};t.string[0].inside={function:{pattern:/(^|[^`])\$\((?:\$\([^\r\n()]*\)|(?!\$\()[^\r\n)])*\)/,lookbehind:!0,inside:t},boolean:t.boolean,variable:t.variable}})(Prism),Prism.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0,greedy:!0},"string-interpolation":{pattern:/(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,lookbehind:!0,inside:{"format-spec":{pattern:/(:)[^:(){}]+(?=\}$)/,lookbehind:!0},"conversion-option":{pattern:/![sra](?=[:}]$)/,alias:`punctuation`},rest:null}},string:/[\s\S]+/}},"triple-quoted-string":{pattern:/(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,greedy:!0,alias:`string`},string:{pattern:/(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},decorator:{pattern:/(^[\t ]*)@\w+(?:\.\w+)*/m,lookbehind:!0,alias:[`annotation`,`punctuation`],inside:{punctuation:/\./}},keyword:/\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:False|None|True)\b/,number:/\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,operator:/[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/},Prism.languages.python[`string-interpolation`].inside.interpolation.inside.rest=Prism.languages.python,Prism.languages.py=Prism.languages.python,(function(e){for(var t=`\\/\\*(?:[^*/]|\\*(?!\\/)|\\/(?!\\*)|<self>)*\\*\\/`,n=0;n<2;n++)t=t.replace(/<self>/g,function(){return t});t=t.replace(/<self>/g,function(){return`[^\\s\\S]`}),e.languages.rust={comment:[{pattern:RegExp(`(^|[^\\\\])`+t),lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/b?"(?:\\[\s\S]|[^\\"])*"|b?r(#*)"(?:[^"]|"(?!\1))*"\1/,greedy:!0},char:{pattern:/b?'(?:\\(?:x[0-7][\da-fA-F]|u\{(?:[\da-fA-F]_*){1,6}\}|.)|[^\\\r\n\t'])'/,greedy:!0},attribute:{pattern:/#!?\[(?:[^\[\]"]|"(?:\\[\s\S]|[^\\"])*")*\]/,greedy:!0,alias:`attr-name`,inside:{string:null}},"closure-params":{pattern:/([=(,:]\s*|\bmove\s*)\|[^|]*\||\|[^|]*\|(?=\s*(?:\{|->))/,lookbehind:!0,greedy:!0,inside:{"closure-punctuation":{pattern:/^\||\|$/,alias:`punctuation`},rest:null}},"lifetime-annotation":{pattern:/'\w+/,alias:`symbol`},"fragment-specifier":{pattern:/(\$\w+:)[a-z]+/,lookbehind:!0,alias:`punctuation`},variable:/\$\w+/,"function-definition":{pattern:/(\bfn\s+)\w+/,lookbehind:!0,alias:`function`},"type-definition":{pattern:/(\b(?:enum|struct|trait|type|union)\s+)\w+/,lookbehind:!0,alias:`class-name`},"module-declaration":[{pattern:/(\b(?:crate|mod)\s+)[a-z][a-z_\d]*/,lookbehind:!0,alias:`namespace`},{pattern:/(\b(?:crate|self|super)\s*)::\s*[a-z][a-z_\d]*\b(?:\s*::(?:\s*[a-z][a-z_\d]*\s*::)*)?/,lookbehind:!0,alias:`namespace`,inside:{punctuation:/::/}}],keyword:[/\b(?:Self|abstract|as|async|await|become|box|break|const|continue|crate|do|dyn|else|enum|extern|final|fn|for|if|impl|in|let|loop|macro|match|mod|move|mut|override|priv|pub|ref|return|self|static|struct|super|trait|try|type|typeof|union|unsafe|unsized|use|virtual|where|while|yield)\b/,/\b(?:bool|char|f(?:32|64)|[ui](?:8|16|32|64|128|size)|str)\b/],function:/\b[a-z_]\w*(?=\s*(?:::\s*<|\())/,macro:{pattern:/\b\w+!/,alias:`property`},constant:/\b[A-Z_][A-Z_\d]+\b/,"class-name":/\b[A-Z]\w*\b/,namespace:{pattern:/(?:\b[a-z][a-z_\d]*\s*::\s*)*\b[a-z][a-z_\d]*\s*::(?!\s*<)/,inside:{punctuation:/::/}},number:/\b(?:0x[\dA-Fa-f](?:_?[\dA-Fa-f])*|0o[0-7](?:_?[0-7])*|0b[01](?:_?[01])*|(?:(?:\d(?:_?\d)*)?\.)?\d(?:_?\d)*(?:[Ee][+-]?\d+)?)(?:_?(?:f32|f64|[iu](?:8|16|32|64|size)?))?\b/,boolean:/\b(?:false|true)\b/,punctuation:/->|\.\.=|\.{1,3}|::|[{}[\];(),:]/,operator:/[-+*\/%!^]=?|=[=>]?|&[&=]?|\|[|=]?|<<?=?|>>?=?|[@?]/},e.languages.rust[`closure-params`].inside.rest=e.languages.rust,e.languages.rust.attribute.inside.string=e.languages.rust.string})(Prism),Prism.languages.swift={comment:{pattern:/(^|[^\\:])(?:\/\/.*|\/\*(?:[^/*]|\/(?!\*)|\*(?!\/)|\/\*(?:[^*]|\*(?!\/))*\*\/)*\*\/)/,lookbehind:!0,greedy:!0},"string-literal":[{pattern:RegExp(`(^|[^"#])(?:"(?:\\\\(?:\\((?:[^()]|\\([^()]*\\))*\\)|\\r\\n|[^(])|[^\\\\\\r\\n"])*"|"""(?:\\\\(?:\\((?:[^()]|\\([^()]*\\))*\\)|[^(])|[^\\\\"]|"(?!""))*""")(?!["#])`),lookbehind:!0,greedy:!0,inside:{interpolation:{pattern:/(\\\()(?:[^()]|\([^()]*\))*(?=\))/,lookbehind:!0,inside:null},"interpolation-punctuation":{pattern:/^\)|\\\($/,alias:`punctuation`},punctuation:/\\(?=[\r\n])/,string:/[\s\S]+/}},{pattern:RegExp(`(^|[^"#])(#+)(?:"(?:\\\\(?:#+\\((?:[^()]|\\([^()]*\\))*\\)|\\r\\n|[^#])|[^\\\\\\r\\n])*?"|"""(?:\\\\(?:#+\\((?:[^()]|\\([^()]*\\))*\\)|[^#])|[^\\\\])*?""")\\2`),lookbehind:!0,greedy:!0,inside:{interpolation:{pattern:/(\\#+\()(?:[^()]|\([^()]*\))*(?=\))/,lookbehind:!0,inside:null},"interpolation-punctuation":{pattern:/^\)|\\#+\($/,alias:`punctuation`},string:/[\s\S]+/}}],directive:{pattern:RegExp(`#(?:(?:elseif|if)\\b(?:[ ]*(?:![ \\t]*)?(?:\\b\\w+\\b(?:[ \\t]*\\((?:[^()]|\\([^()]*\\))*\\))?|\\((?:[^()]|\\([^()]*\\))*\\))(?:[ \\t]*(?:&&|\\|\\|))?)+|(?:else|endif)\\b)`),alias:`property`,inside:{"directive-name":/^#\w+/,boolean:/\b(?:false|true)\b/,number:/\b\d+(?:\.\d+)*\b/,operator:/!|&&|\|\||[<>]=?/,punctuation:/[(),]/}},literal:{pattern:/#(?:colorLiteral|column|dsohandle|file(?:ID|Literal|Path)?|function|imageLiteral|line)\b/,alias:`constant`},"other-directive":{pattern:/#\w+\b/,alias:`property`},attribute:{pattern:/@\w+/,alias:`atrule`},"function-definition":{pattern:/(\bfunc\s+)\w+/,lookbehind:!0,alias:`function`},label:{pattern:/\b(break|continue)\s+\w+|\b[a-zA-Z_]\w*(?=\s*:\s*(?:for|repeat|while)\b)/,lookbehind:!0,alias:`important`},keyword:/\b(?:Any|Protocol|Self|Type|actor|as|assignment|associatedtype|associativity|async|await|break|case|catch|class|continue|convenience|default|defer|deinit|didSet|do|dynamic|else|enum|extension|fallthrough|fileprivate|final|for|func|get|guard|higherThan|if|import|in|indirect|infix|init|inout|internal|is|isolated|lazy|left|let|lowerThan|mutating|none|nonisolated|nonmutating|open|operator|optional|override|postfix|precedencegroup|prefix|private|protocol|public|repeat|required|rethrows|return|right|safe|self|set|some|static|struct|subscript|super|switch|throw|throws|try|typealias|unowned|unsafe|var|weak|where|while|willSet)\b/,boolean:/\b(?:false|true)\b/,nil:{pattern:/\bnil\b/,alias:`constant`},"short-argument":/\$\d+\b/,omit:{pattern:/\b_\b/,alias:`keyword`},number:/\b(?:[\d_]+(?:\.[\de_]+)?|0x[a-f0-9_]+(?:\.[a-f0-9p_]+)?|0b[01_]+|0o[0-7_]+)\b/i,"class-name":/\b[A-Z](?:[A-Z_\d]*[a-z]\w*)?\b/,function:/\b[a-z_]\w*(?=\s*\()/i,constant:/\b(?:[A-Z_]{2,}|k[A-Z][A-Za-z_]+)\b/,operator:/[-+*/%=!<>&|^~?]+|\.[.\-+*/%=!<>&|^~?]+/,punctuation:/[{}[\]();,.:\\]/},Prism.languages.swift[`string-literal`].forEach(function(e){e.inside.interpolation.inside=Prism.languages.swift}),(function(e){e.languages.typescript=e.languages.extend(`javascript`,{"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,lookbehind:!0,greedy:!0,inside:null},builtin:/\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/}),e.languages.typescript.keyword.push(/\b(?:abstract|declare|is|keyof|readonly|require)\b/,/\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,/\btype\b(?=\s*(?:[\{*]|$))/),delete e.languages.typescript.parameter,delete e.languages.typescript[`literal-property`];var t=e.languages.extend(`typescript`,{});delete t[`class-name`],e.languages.typescript[`class-name`].inside=t,e.languages.insertBefore(`typescript`,`function`,{decorator:{pattern:/@[$\w\xA0-\uFFFF]+/,inside:{at:{pattern:/^@/,alias:`operator`},function:/^[\s\S]+/}},"generic-function":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,greedy:!0,inside:{function:/^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,generic:{pattern:/<[\s\S]+/,alias:`class-name`,inside:t}}}}),e.languages.ts=e.languages.typescript})(Prism),(function(e){var t=/\b(?:abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|exports|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|module|native|new|non-sealed|null|open|opens|package|permits|private|protected|provides|public|record(?!\s*[(){}[\]<>=%~.:,;?+\-*/&|^])|requires|return|sealed|short|static|strictfp|super|switch|synchronized|this|throw|throws|to|transient|transitive|try|uses|var|void|volatile|while|with|yield)\b/,n=`(?:[a-z]\\w*\\s*\\.\\s*)*(?:[A-Z]\\w*\\s*\\.\\s*)*`,r={pattern:RegExp(`(^|[^\\w.])`+n+`[A-Z](?:[\\d_A-Z]*[a-z]\\w*)?\\b`),lookbehind:!0,inside:{namespace:{pattern:/^[a-z]\w*(?:\s*\.\s*[a-z]\w*)*(?:\s*\.)?/,inside:{punctuation:/\./}},punctuation:/\./}};e.languages.java=e.languages.extend(`clike`,{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"/,lookbehind:!0,greedy:!0},"class-name":[r,{pattern:RegExp(`(^|[^\\w.])`+n+`[A-Z]\\w*(?=\\s+\\w+\\s*[;,=()]|\\s*(?:\\[[\\s,]*\\]\\s*)?::\\s*new\\b)`),lookbehind:!0,inside:r.inside},{pattern:RegExp(`(\\b(?:class|enum|extends|implements|instanceof|interface|new|record|throws)\\s+)`+n+`[A-Z]\\w*\\b`),lookbehind:!0,inside:r.inside}],keyword:t,function:[e.languages.clike.function,{pattern:/(::\s*)[a-z_]\w*/,lookbehind:!0}],number:/\b0b[01][01_]*L?\b|\b0x(?:\.[\da-f_p+-]+|[\da-f_]+(?:\.[\da-f_p+-]+)?)\b|(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?\d[\d_]*)?[dfl]?/i,operator:{pattern:/(^|[^.])(?:<<=?|>>>?=?|->|--|\+\+|&&|\|\||::|[?:~]|[-+*/%&|^!=<>]=?)/m,lookbehind:!0},constant:/\b[A-Z][A-Z_\d]+\b/}),e.languages.insertBefore(`java`,`string`,{"triple-quoted-string":{pattern:/"""[ \t]*[\r\n](?:(?:"|"")?(?:\\.|[^"\\]))*"""/,greedy:!0,alias:`string`},char:{pattern:/'(?:\\.|[^'\\\r\n]){1,6}'/,greedy:!0}}),e.languages.insertBefore(`java`,`class-name`,{annotation:{pattern:/(^|[^.])@\w+(?:\s*\.\s*\w+)*/,lookbehind:!0,alias:`punctuation`},generics:{pattern:/<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&))*>)*>)*>)*>/,inside:{"class-name":r,keyword:t,punctuation:/[<>(),.:]/,operator:/[?&|]/}},import:[{pattern:RegExp(`(\\bimport\\s+)`+n+`(?:[A-Z]\\w*|\\*)(?=\\s*;)`),lookbehind:!0,inside:{namespace:r.inside.namespace,punctuation:/\./,operator:/\*/,"class-name":/\w+/}},{pattern:RegExp(`(\\bimport\\s+static\\s+)`+n+`(?:\\w+|\\*)(?=\\s*;)`),lookbehind:!0,alias:`static`,inside:{namespace:r.inside.namespace,static:/\b\w+$/,punctuation:/\./,operator:/\*/,"class-name":/\w+/}}],namespace:{pattern:RegExp(`(\\b(?:exports|import(?:\\s+static)?|module|open|opens|package|provides|requires|to|transitive|uses|with)\\s+)(?!<keyword>)[a-z]\\w*(?:\\.[a-z]\\w*)*\\.?`.replace(/<keyword>/g,function(){return t.source})),lookbehind:!0,inside:{punctuation:/\./}}})})(Prism),(function(e){var t=/\b(?:alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|char8_t|class|co_await|co_return|co_yield|compl|concept|const|const_cast|consteval|constexpr|constinit|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|final|float|for|friend|goto|if|import|inline|int|int16_t|int32_t|int64_t|int8_t|long|module|mutable|namespace|new|noexcept|nullptr|operator|override|private|protected|public|register|reinterpret_cast|requires|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|uint16_t|uint32_t|uint64_t|uint8_t|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/,n=`\\b(?!<keyword>)\\w+(?:\\s*\\.\\s*\\w+)*\\b`.replace(/<keyword>/g,function(){return t.source});e.languages.cpp=e.languages.extend(`c`,{"class-name":[{pattern:RegExp(`(\\b(?:class|concept|enum|struct|typename)\\s+)(?!<keyword>)\\w+`.replace(/<keyword>/g,function(){return t.source})),lookbehind:!0},/\b[A-Z]\w*(?=\s*::\s*\w+\s*\()/,/\b[A-Z_]\w*(?=\s*::\s*~\w+\s*\()/i,/\b\w+(?=\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>\s*::\s*\w+\s*\()/],keyword:t,number:{pattern:/(?:\b0b[01']+|\b0x(?:[\da-f']+(?:\.[\da-f']*)?|\.[\da-f']+)(?:p[+-]?[\d']+)?|(?:\b[\d']+(?:\.[\d']*)?|\B\.[\d']+)(?:e[+-]?[\d']+)?)[ful]{0,4}/i,greedy:!0},operator:/>>=?|<<=?|->|--|\+\+|&&|\|\||[?:~]|<=>|[-+*/%&|^!=<>]=?|\b(?:and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/,boolean:/\b(?:false|true)\b/}),e.languages.insertBefore(`cpp`,`string`,{module:{pattern:RegExp(`(\\b(?:import|module)\\s+)(?:"(?:\\\\(?:\\r\\n|[\\s\\S])|[^"\\\\\\r\\n])*"|<[^<>\\r\\n]*>|`+`<mod-name>(?:\\s*:\\s*<mod-name>)?|:\\s*<mod-name>`.replace(/<mod-name>/g,function(){return n})+`)`),lookbehind:!0,greedy:!0,inside:{string:/^[<"][\s\S]+/,operator:/:/,punctuation:/\./}},"raw-string":{pattern:/R"([^()\\ ]{0,16})\([\s\S]*?\)\1"/,alias:`string`,greedy:!0}}),e.languages.insertBefore(`cpp`,`keyword`,{"generic-function":{pattern:/\b(?!operator\b)[a-z_]\w*\s*<(?:[^<>]|<[^<>]*>)*>(?=\s*\()/i,inside:{function:/^\w+/,generic:{pattern:/<[\s\S]+/,alias:`class-name`,inside:e.languages.cpp}}}}),e.languages.insertBefore(`cpp`,`operator`,{"double-colon":{pattern:/::/,alias:`punctuation`}}),e.languages.insertBefore(`cpp`,`class-name`,{"base-clause":{pattern:/(\b(?:class|struct)\s+\w+\s*:\s*)[^;{}"'\s]+(?:\s+[^;{}"'\s]+)*(?=\s*[;{])/,lookbehind:!0,greedy:!0,inside:e.languages.extend(`cpp`,{})}}),e.languages.insertBefore(`inside`,`double-colon`,{"class-name":/\b[a-z_]\w*\b(?!\s*::)/i},e.languages.cpp[`base-clause`])})(Prism);function _W(e,t){for(let n of e.childNodes){if(yg(n)&&n.tagName===t)return!0;_W(n,t)}return!1}var vW=`data-language`,yW=`data-highlight-language`,bW=`data-theme`,xW=class e extends zm{static getType(){return`code`}static clone(t){return new e(t.__language,t.__key)}constructor(e,t){super(t),this.__language=e||void 0,this.__isSyntaxHighlightSupported=!1,this.__theme=void 0}afterCloneFrom(e){super.afterCloneFrom(e),this.__language=e.__language,this.__theme=e.__theme,this.__isSyntaxHighlightSupported=e.__isSyntaxHighlightSupported}createDOM(e){let t=document.createElement(`code`);B_(t,e.theme.code),t.setAttribute(`spellcheck`,`false`);let n=this.getLanguage();n&&(t.setAttribute(vW,n),this.getIsSyntaxHighlightSupported()&&t.setAttribute(yW,n));let r=this.getTheme();r&&t.setAttribute(bW,r);let i=this.getStyle();return i&&t.setAttribute(`style`,i),t}updateDOM(e,t,n){let r=this.__language,i=e.__language;r?r!==i&&t.setAttribute(vW,r):i&&t.removeAttribute(vW);let a=this.__isSyntaxHighlightSupported;e.__isSyntaxHighlightSupported&&i?a&&r?r!==i&&t.setAttribute(yW,r):t.removeAttribute(yW):a&&r&&t.setAttribute(yW,r);let o=this.__theme,s=e.__theme;o?o!==s&&t.setAttribute(bW,o):s&&t.removeAttribute(bW);let c=this.__style,l=e.__style;return c?c!==l&&t.setAttribute(`style`,c):l&&t.removeAttribute(`style`),!1}exportDOM(e){let t=document.createElement(`pre`);B_(t,e._config.theme.code),t.setAttribute(`spellcheck`,`false`);let n=this.getLanguage();n&&(t.setAttribute(vW,n),this.getIsSyntaxHighlightSupported()&&t.setAttribute(yW,n));let r=this.getTheme();r&&t.setAttribute(bW,r);let i=this.getStyle();return i&&t.setAttribute(`style`,i),{element:t}}static importDOM(){return{code:e=>e.textContent!=null&&(/\r?\n/.test(e.textContent)||_W(e,`BR`))?{conversion:wW,priority:1}:null,div:()=>({conversion:TW,priority:1}),pre:()=>({conversion:wW,priority:0}),table:e=>kW(e)?{conversion:EW,priority:3}:null,td:e=>{let t=e,n=t.closest(`table`);return t.classList.contains(`js-file-line`)||n&&kW(n)?{conversion:DW,priority:3}:null},tr:e=>{let t=e.closest(`table`);return t&&kW(t)?{conversion:DW,priority:3}:null}}}static importJSON(e){return SW().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setLanguage(e.language).setTheme(e.theme)}exportJSON(){return{...super.exportJSON(),language:this.getLanguage(),theme:this.getTheme()}}insertNewAfter(e,t=!0){let n=this.getChildren(),r=n.length;if(r>=2&&n[r-1].getTextContent()===`
129
+ `&&n[r-2].getTextContent()===`
130
+ `&&e.isCollapsed()&&e.anchor.key===this.__key&&e.anchor.offset===r){n[r-1].remove(),n[r-2].remove();let e=$m();return this.insertAfter(e,t),e}let{anchor:i,focus:a}=e,o=(i.isBefore(a)?i:a).getNode();if(H(o)){let e=FW(o),t=[];for(;;)if(Ip(e))t.push(Fp()),e=e.getNextSibling();else{if(!NW(e))break;{let n=0,r=e.getTextContent(),i=e.getTextContentSize();for(;n<i&&r[n]===` `;)n++;if(n!==0&&t.push(MW(` `.repeat(n))),n!==i)break;e=e.getNextSibling()}}let n=o.splitText(i.offset)[0],r=i.offset===0?0:1,a=n.getIndexWithinParent()+r,s=o.getParentOrThrow(),c=[mp(),...t];s.splice(a,0,c);let l=t[t.length-1];l?l.select():i.offset===0?n.selectPrevious():n.getNextSibling().selectNext(0,0)}if(CW(o)){let{offset:t}=e.anchor;o.splice(t,0,[mp()]),o.select(t+1,t+1)}return null}canIndent(){return!1}collapseAtStart(){let e=$m();return this.getChildren().forEach((t=>e.append(t))),this.replace(e),!0}setLanguage(e){let t=this.getWritable();return t.__language=e||void 0,t}getLanguage(){return this.getLatest().__language}setIsSyntaxHighlightSupported(e){let t=this.getWritable();return t.__isSyntaxHighlightSupported=e,t}getIsSyntaxHighlightSupported(){return this.getLatest().__isSyntaxHighlightSupported}setTheme(e){let t=this.getWritable();return t.__theme=e||void 0,t}getTheme(){return this.getLatest().__theme}};function SW(e,t){return Fg(xW).setLanguage(e).setTheme(t)}function CW(e){return e instanceof xW}function wW(e){return{node:SW(e.getAttribute(vW))}}function TW(e){let t=e,n=OW(t);return n||function(e){let t=e.parentElement;for(;t!==null;){if(OW(t))return!0;t=t.parentElement}return!1}(t)?{node:n?SW():null}:{node:null}}function EW(){return{node:SW()}}function DW(){return{node:null}}function OW(e){return e.style.fontFamily.match(`monospace`)!==null}function kW(e){return e.classList.contains(`js-file-line-container`)}var AW=class e extends Cp{constructor(e=``,t,n){super(e,n),this.__highlightType=t}static getType(){return`code-highlight`}static clone(t){return new e(t.__text,t.__highlightType||void 0,t.__key)}getHighlightType(){return this.getLatest().__highlightType}setHighlightType(e){let t=this.getWritable();return t.__highlightType=e||void 0,t}canHaveFormat(){return!1}createDOM(e){let t=super.createDOM(e);return B_(t,jW(e.theme,this.__highlightType)),t}updateDOM(e,t,n){let r=super.updateDOM(e,t,n),i=jW(n.theme,e.__highlightType),a=jW(n.theme,this.__highlightType);return i!==a&&(i&&V_(t,i),a&&B_(t,a)),r}static importJSON(e){return MW().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setHighlightType(e.highlightType)}exportJSON(){return{...super.exportJSON(),highlightType:this.getHighlightType()}}setFormat(e){return this}isParentRequired(){return!0}createParentElementNode(){return SW()}};function jW(e,t){return t&&e&&e.codeHighlight&&e.codeHighlight[t]}function MW(e=``,t){return fg(new AW(e,t))}function NW(e){return e instanceof AW}function PW(e,t){let n=e;for(let r=Jg(e,t);r&&(NW(r.origin)||Ip(r.origin));r=Dee(r))n=r.origin;return n}function FW(e){return PW(e,`previous`)}(function(e){e.languages.diff={coord:[/^(?:\*{3}|-{3}|\+{3}).*$/m,/^@@.*@@$/m,/^\d.*$/m]};var t={"deleted-sign":`-`,"deleted-arrow":`<`,"inserted-sign":`+`,"inserted-arrow":`>`,unchanged:` `,diff:`!`};Object.keys(t).forEach((function(n){var r=t[n],i=[];/^\w+$/.test(n)||i.push(/\w+/.exec(n)[0]),n===`diff`&&i.push(`bold`),e.languages.diff[n]={pattern:RegExp(`^(?:[`+r+`].*(?:\r
131
+ ?|
132
+ |(?![\\s\\S])))+`,`m`),alias:i,inside:{line:{pattern:/(.)(?=[\s\S]).*(?:\r\n?|\n)?/,lookbehind:!0},prefix:{pattern:/[\s\S]/,alias:/\w+/.exec(n)[0]}}}})),Object.defineProperty(e.languages.diff,`PREFIXES`,{value:t})})(Prism),globalThis.Prism||window.Prism;function IW(e,t){let n={};for(let r of e){let e=t(r);e&&(n[e]?n[e].push(r):n[e]=[r])}return n}function LW(e){let t=IW(e,(e=>e.type));return{element:t.element||[],multilineElement:t[`multiline-element`]||[],textFormat:t[`text-format`]||[],textMatch:t[`text-match`]||[]}}var RW=/[!-/:-@[-`{-~\s]/;function zW(e){return H(e)&&!e.hasFormat(`code`)}function BW(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function VW(e,t,n){let r=n.length;for(let i=t;i>=r;i--){let t=i-r;if(HW(e,t,n,0,r)&&e[t+r]!==` `)return t}return-1}function HW(e,t,n,r,i){for(let a=0;a<i;a++)if(e[t+a]!==n[r+a])return!1;return!0}function UW(e,t=bG){let n=LW(t),r=IW(n.textFormat,(({tag:e})=>e[e.length-1])),i=IW(n.textMatch,(({trigger:e})=>e));for(let n of t){let t=n.type;if(t===`element`||t===`text-match`||t===`multiline-element`){let t=n.dependencies;for(let n of t)e.hasNode(n)||BW(173,n.getType())}}let a=(e,t,a)=>{(function(e,t,n,r){if(!ug(e.getParent())||e.getFirstChild()!==t)return!1;let i=t.getTextContent();if(i[n-1]!==` `)return!1;for(let{regExp:a,replace:o}of r){let r=i.match(a);if(r&&r[0].length===(r[0].endsWith(` `)?n:n-1)){let i=t.getNextSiblings(),[a,s]=t.splitText(n);if(!1!==o(e,s?[s,...i]:i,r,!1))return a.remove(),!0}}return!1})(e,t,a,n.element)||function(e,t,n,r){if(!ug(e.getParent())||e.getFirstChild()!==t)return!1;let i=t.getTextContent();if(i[n-1]!==` `)return!1;for(let{regExpStart:a,replace:o,regExpEnd:s}of r){if(s&&!(`optional`in s)||s&&`optional`in s&&!s.optional)continue;let r=i.match(a);if(r&&r[0].length===(r[0].endsWith(` `)?n:n-1)){let i=t.getNextSiblings(),[a,s]=t.splitText(n);if(!1!==o(e,s?[s,...i]:i,r,null,null,!1))return a.remove(),!0}}return!1}(e,t,a,n.multilineElement)||function(e,t,n){let r=e.getTextContent(),i=n[r[t-1]];if(i==null)return!1;t<r.length&&(r=r.slice(0,t));for(let t of i){if(!t.replace||!t.regExp)continue;let n=r.match(t.regExp);if(n===null)continue;let i=n.index||0,a=i+n[0].length,o;return i===0?[o]=e.splitText(a):[,o]=e.splitText(i,a),o.selectNext(0,0),t.replace(o,n),!0}return!1}(t,a,i)||function(e,t,n){let r=e.getTextContent(),i=t-1,a=r[i],o=n[a];if(!o)return!1;for(let t of o){let{tag:n}=t,o=n.length,s=i-o+1;if(o>1&&!HW(r,s,n,0,o)||r[s-1]===` `)continue;let c=r[i+1];if(!1===t.intraword&&c&&!RW.test(c))continue;let l=e,u=l,d=VW(r,s,n),f=u;for(;d<0&&(f=f.getPreviousSibling())&&!hp(f);)if(H(f)){if(f.hasFormat(`code`))continue;let e=f.getTextContent();u=f,d=VW(e,e.length,n)}if(d<0||u===l&&d+o===s)continue;let p=u.getTextContent();if(d>0&&p[d-1]===a)continue;let m=p[d-1];if(!1===t.intraword&&m&&!RW.test(m))continue;let h=l.getTextContent(),g=h.slice(0,s)+h.slice(i+1);l.setTextContent(g);let _=u===l?g:p;u.setTextContent(_.slice(0,d)+_.slice(d+o));let v=W(),y=tm();Fh(y);let b=i-o*(u===l?2:1)+1;y.anchor.set(u.__key,d,`text`),y.focus.set(l.__key,b,`text`);for(let e of t.format)y.hasFormat(e)||y.formatText(e);y.anchor.set(y.focus.key,y.focus.offset,y.focus.type);for(let e of t.format)y.hasFormat(e)&&y.toggleFormat(e);return U(v)&&(y.format=v.format),!0}}(t,a,r)};return e.registerUpdateListener((({tags:t,dirtyLeaves:n,editorState:r,prevEditorState:i})=>{if(t.has(`collaboration`)||t.has(`historic`)||e.isComposing())return;let o=r.read(W),s=i.read(W);if(!U(s)||!U(o)||!o.isCollapsed()||o.is(s))return;let c=o.anchor.key,l=o.anchor.offset,u=r._nodeMap.get(c);!H(u)||!n.has(c)||l!==1&&l>s.anchor.offset+1||e.update((()=>{if(!zW(u))return;let e=u.getParent();e===null||CW(e)||a(e,u,o.anchor.offset)}))}))}var WW=/^(\s*)(\d{1,})\.\s/,GW=/^(\s*)[-*+]\s/,KW=/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,qW=/^(#{1,6})\s/,JW=/^>\s/,YW=/^[ \t]*```([\w-]+)?/,XW=/[ \t]*```$/,ZW=e=>(t,n,r,i)=>{let a=e(r);a.append(...n),t.replace(a),i||a.select(0,0)},QW=e=>(t,n,r,i)=>{let a=t.getPreviousSibling(),o=t.getNextSibling(),s=RE(e===`check`?r[3]===`x`:void 0);if(WE(o)&&o.getListType()===e){let e=o.getFirstChild();e===null?o.append(s):e.insertBefore(s),t.remove()}else if(WE(a)&&a.getListType()===e)a.append(s),t.remove();else{let n=UE(e,e===`number`?Number(r[2]):void 0);n.append(s),t.replace(n)}s.append(...n),i||s.select(0,0);let c=function(e){let t=e.match(/\t/g),n=e.match(/ /g),r=0;return t&&(r+=t.length),n&&(r+=Math.floor(n.length/4)),r}(r[1]);c&&s.setIndent(c)},$W=(e,t,n)=>{let r=[],i=e.getChildren(),a=0;for(let o of i)if(zE(o)){if(o.getChildrenSize()===1){let e=o.getFirstChild();if(WE(e)){r.push($W(e,t,n+1));continue}}let i=` `.repeat(4*n),s=e.getListType(),c=s===`number`?`${e.getStart()+a}. `:s===`check`?`- [${o.getChecked()?`x`:` `}] `:`- `;r.push(i+c+t(o)),a++}return r.join(`
133
+ `)},eG={dependencies:[yv],export:(e,t)=>{if(!Cv(e))return null;let n=Number(e.getTag().slice(1));return`#`.repeat(n)+` `+t(e)},regExp:qW,replace:ZW((e=>Sv(`h`+e[1].length))),type:`element`},tG={dependencies:[gv],export:(e,t)=>{if(!vv(e))return null;let n=t(e).split(`
134
+ `),r=[];for(let e of n)r.push(`> `+e);return r.join(`
135
+ `)},regExp:JW,replace:(e,t,n,r)=>{if(r){let n=e.getPreviousSibling();if(vv(n))return n.splice(n.getChildrenSize(),0,[mp(),...t]),void e.remove()}let i=_v();i.append(...t),e.replace(i),r||i.select(0,0)},type:`element`},nG={dependencies:[xW],export:e=>{if(!CW(e))return null;let t=e.getTextContent();return"```"+(e.getLanguage()||``)+(t?`
136
+ `+t:``)+"\n```"},regExpEnd:{optional:!0,regExp:XW},regExpStart:YW,replace:(e,t,n,r,i,a)=>{let o,s;if(!t&&i){if(i.length===1)r?(o=SW(),s=n[1]+i[0]):(o=SW(n[1]),s=i[0].startsWith(` `)?i[0].slice(1):i[0]);else{if(o=SW(n[1]),i[0].trim().length===0)for(;i.length>0&&!i[0].length;)i.shift();else i[0]=i[0].startsWith(` `)?i[0].slice(1):i[0];for(;i.length>0&&!i[i.length-1].length;)i.pop();s=i.join(`
137
+ `)}let t=Mp(s);o.append(t),e.append(o)}else t&&ZW((e=>SW(e?e[1]:void 0)))(e,t,n,a)},type:`multiline-element`},rG={dependencies:[BE,LE],export:(e,t)=>WE(e)?$W(e,t,0):null,regExp:GW,replace:QW(`bullet`),type:`element`},iG={dependencies:[BE,LE],export:(e,t)=>WE(e)?$W(e,t,0):null,regExp:KW,replace:QW(`check`),type:`element`},aG={dependencies:[BE,LE],export:(e,t)=>WE(e)?$W(e,t,0):null,regExp:WW,replace:QW(`number`),type:`element`},oG={format:[`code`],tag:"`",type:`text-format`},sG={format:[`highlight`],tag:`==`,type:`text-format`},cG={format:[`bold`,`italic`],tag:`***`,type:`text-format`},lG={format:[`bold`,`italic`],intraword:!1,tag:`___`,type:`text-format`},uG={format:[`bold`],tag:`**`,type:`text-format`},dG={format:[`bold`],intraword:!1,tag:`__`,type:`text-format`},fG={format:[`strikethrough`],tag:`~~`,type:`text-format`},pG={format:[`italic`],tag:`*`,type:`text-format`},mG={format:[`italic`],intraword:!1,tag:`_`,type:`text-format`},hG={dependencies:[pE],export:(e,t,n)=>{if(!hE(e)||vE(e))return null;let r=e.getTitle(),i=t(e);return r?`[${i}](${e.getURL()} "${r}")`:`[${i}](${e.getURL()})`},importRegExp:/(?:\[(.*?)\])(?:\((?:([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?)\))/,regExp:/(?:\[(.*?)\])(?:\((?:([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?)\))$/,replace:(e,t)=>{let[,n,r,i]=t,a=mE(r,{title:i}),o=n.split(`[`).length-1,s=n.split(`]`).length-1,c=n,l=``;if(o<s)return;if(o>s){let e=n.split(`[`);l=`[`+e[0],c=e.slice(1).join(`[`)}let u=Mp(c);return u.setFormat(e.getFormat()),a.append(u),e.replace(a),l&&a.insertBefore(Mp(l)),u},trigger:`)`,type:`text-match`},gG=[eG,tG,rG,aG],_G=[nG],vG=[oG,cG,lG,uG,dG,sG,pG,mG,fG],yG=[hG],bG=[...gG,..._G,...vG,...yG],xG=[{dependencies:[cD],export:e=>uD(e)?`***`:null,regExp:/^(---|\*\*\*|___)\s?$/,replace:(e,t,n,r)=>{let i=lD();r||e.getNextSibling()!=null?e.replace(i):e.insertBefore(i),i.selectNext()},type:`element`},...bG];function SG({transformers:e=xG}){let[t]=Zl();return(0,L.useEffect)((()=>UW(t,e)),[t,e]),null}var CG=ql({init(e){let t=e.getValue(ZT),n=DG(t,t.includes(`headings`)?e.getValue(aD):[]),r=n.filter(e=>!EG.has(e));e.pubIn({[RT]:()=>L.createElement(SG,{transformers:n}),[HT]:()=>L.createElement(SG,{transformers:n}),[WT]:()=>L.createElement(SG,{transformers:r})})}}),wG=e=>(t,n,r)=>{let i=e(r);i.append(...n),t.replace(i),i.select(0,0)},TG={dependencies:[cD],export:e=>uD(e)?`***`:null,regExp:/^(---|\*\*\*|___)\s?$/,replace:(e,t,n,r)=>{let i=lD();r||e.getNextSibling()!=null?e.replace(i):e.insertBefore(i),i.selectNext()},type:`element`},EG=new Set([aG,rG,iG]);function DG(e,t){let n=[cG,lG,uG,dG,oG,pG,mG];if(e.includes(`headings`)){let e=Math.min(...t),r=Math.max(...t),i=RegExp(`^(#{${e},${r}})\\s`),a={dependencies:[yv],export:(e,t)=>{if(!Cv(e))return null;let n=Number(e.getTag().slice(1));return`#`.repeat(n)+` `+t(e)},regExp:i,replace:wG(e=>Sv(`h${e[1].length}`)),type:`element`};n.push(a)}if(e.includes(`thematicBreak`)&&n.push(TG),e.includes(`quote`)&&n.push(tG),e.includes(`link`)&&n.push(hG),e.includes(`lists`)&&n.push(aG,rG,iG),e.includes(`codeblock`)){let e={...nG,dependencies:[EL],replace:(e,t,n)=>{let r=kL({code:``,language:n[1]??``,meta:``});e.selectPrevious(),e.replace(r),setTimeout(()=>{r.select()},80)}};n.push(e)}return n}var OG=()=>{let e=Bl(qT),t=Rl(KT),n=Rl(ZT),r=n.includes(`quote`),i=n.includes(`headings`),a=tE();if(!r&&!i)return null;let o=[{label:a(`toolbar.blockTypes.paragraph`,`Paragraph`),value:`paragraph`}];if(r&&o.push({label:a(`toolbar.blockTypes.quote`,`Quote`),value:`quote`}),i){let e=Rl(aD);o.push(...e.map(e=>({label:a(`toolbar.blockTypes.heading`,`Heading {{level}}`,{level:e}),value:`h${e}`})))}return L.createElement(jU,{value:t,onChange:t=>{switch(t){case`quote`:e(()=>_v());break;case`paragraph`:e(()=>$m());break;case``:break;default:if(t.startsWith(`h`))e(()=>Sv(t));else throw Error(`Unknown block type: ${t}`)}},triggerTitle:a(`toolbar.blockTypeSelect.selectBlockTypeTooltip`,`Select block type`),placeholder:a(`toolbar.blockTypeSelect.placeholder`,`Block type`),items:o})},kG=({format:e,addTitle:t,removeTitle:n,icon:r,formatName:i})=>{let[a,o]=zl(Jw,jT),s=Bl(Zw),c=(a&e)!==0;return L.createElement(uW,{title:c?n:t,on:c,onValueChange:()=>{s(i)}},o(r))},AG=({options:e})=>{let t=tE(),n=e===void 0;return L.createElement(`div`,{className:fE.toolbarGroupOfGroups},n||e.includes(`Bold`)?L.createElement(kG,{format:1,addTitle:t(`toolbar.bold`,`Bold`),removeTitle:t(`toolbar.removeBold`,`Remove bold`),icon:`format_bold`,formatName:`bold`}):null,n||e.includes(`Italic`)?L.createElement(kG,{format:2,addTitle:t(`toolbar.italic`,`Italic`),removeTitle:t(`toolbar.removeItalic`,`Remove italic`),icon:`format_italic`,formatName:`italic`}):null,n||e.includes(`Underline`)?L.createElement(kG,{format:8,addTitle:t(`toolbar.underline`,`Underline`),removeTitle:t(`toolbar.removeUnderline`,`Remove underline`),icon:`format_underlined`,formatName:`underline`}):null)},jG=()=>{let[e,t]=zl(Jw,jT),n=Bl(Zw),r=tE(),i=(e&16)!=0,a=i?r(`toolbar.removeInlineCode`,`Remove code format`):r(`toolbar.inlineCode`,`Inline code format`);return L.createElement(dW,{items:[{title:a,contents:t(`code`),active:i,onChange:n.bind(null,`code`)}]})},MG=()=>{let e=Bl(QU),t=Rl(jT),n=tE();return L.createElement(cW,{"aria-label":n(`toolbar.link`,`Create link`),title:n(`toolbar.link`,`Create link`),onClick:t=>{e()}},t(`link`))},NG=()=>{let e=Bl(jL),t=Rl(jT),n=tE();return L.createElement(cW,{title:n(`toolbar.codeBlock`,`Insert Code Block`),onClick:()=>{e({})}},t(`frame_source`))},PG=()=>{let e=Rl(jT),t=Bl(tN),n=tE(),r=Rl(GT);return L.createElement(cW,{title:n(`toolbar.table`,`Insert Table`),onClick:()=>{t({rows:3,columns:3})},...r?{"aria-disabled":!0,"data-disabled":!0,disabled:!0}:{}},e(`table`))},FG=()=>{let e=Bl(dD),t=Rl(jT),n=tE();return L.createElement(cW,{title:n(`toolbar.thematicBreak`,`Insert thematic break`),onClick:()=>{e()}},t(`horizontal_rule`))},IG={bullet:`format_list_bulleted`,number:`format_list_numbered`,check:`format_list_checked`},LG=({options:e=[`bullet`,`number`,`check`]})=>{let[t,n,r]=zl(yD,jT,GT),i=Bl(bD),a=tE(),o={bullet:a(`toolbar.bulletedList`,`Bulleted list`),number:a(`toolbar.numberedList`,`Numbered list`),check:a(`toolbar.checkList`,`Check list`)},s=e.map(e=>({value:e,title:o[e],contents:n(IG[e])}));return L.createElement(fW,{value:t||``,items:s,onChange:i,disabled:r})},RG=()=>{let[e,t]=zl(jT,Vw),[n,r]=L.useState(!1),[i,a]=L.useState(!1),o=tE();return L.useEffect(()=>{if(t)return z_(t.registerCommand(Af,e=>(r(e),!1),4),t.registerCommand(kf,e=>(a(e),!1),4))},[t]),L.createElement(dW,{items:[{title:o(`toolbar.undo`,`Undo {{shortcut}}`,{shortcut:rD?`⌘Z`:`Ctrl+Z`}),disabled:!n,contents:e(`undo`),active:!1,onChange:()=>t?.dispatchCommand(ef,void 0)},{title:o(`toolbar.redo`,`Redo {{shortcut}}`,{shortcut:rD?`⌘Y`:`Ctrl+Y`}),disabled:!i,contents:e(`redo`),active:!1,onChange:()=>t?.dispatchCommand(tf,void 0)}]})},zG=900,BG={txt:`Text`,text:`Text`,plaintext:`Plain Text`,md:`Markdown`,ts:`TypeScript`,tsx:`TSX`,js:`JavaScript`,json:`JSON`,css:`CSS`,bash:`Bash`,sh:`Shell`,shell:`Shell`,yaml:`YAML`,yml:`YAML`,toml:`TOML`,cron:`Cron`},VG=(0,L.memo)((0,L.forwardRef)(function({documentKey:e,initialMarkdown:t,onPersist:n,onSaveStateChange:r,readOnly:i=!1},a){let o=(0,L.useRef)(null),s=(0,L.useRef)(e),c=(0,L.useRef)(t),l=(0,L.useRef)(t),u=(0,L.useRef)(null),d=(0,L.useRef)(null),f=(0,L.useRef)(!0),[p,m]=(0,L.useState)(`rich`),[h,g]=(0,L.useState)(t),_=(0,L.useCallback)(()=>{d.current!==null&&(window.clearTimeout(d.current),d.current=null)},[]),v=(0,L.useCallback)(async()=>{if(i){r(`saved`);return}u.current&&await u.current;let e=c.current;if(e===l.current){r(`saved`);return}r(`saving`);let t=(async()=>{await n(e),l.current=e})();u.current=t;try{if(await t,c.current===l.current){r(`saved`);return}await v()}catch{throw r(`error`),Error(`Autosave failed`)}finally{u.current===t&&(u.current=null)}},[n,r,i]),y=(0,L.useCallback)(()=>{i||(_(),d.current=window.setTimeout(()=>{d.current=null,v()},zG))},[_,v,i]),b=(0,L.useCallback)(e=>{if(f.current){f.current=!1,c.current=e,l.current=e,g(e),r(`saved`);return}if(c.current=e,i){r(`saved`);return}r(`idle`),y()},[r,i,y]),x=(0,L.useMemo)(()=>[uie(),kie(),Cse(),_ie(),wN(),iW(),nN(),Nse({defaultCodeBlockLanguage:`txt`,codeBlockEditorDescriptors:[{priority:-10,match:()=>!0,Editor:MU}]}),BU({codeBlockLanguages:BG}),CG(),gW({toolbarContents:()=>(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(RG,{}),(0,R.jsx)(AG,{}),(0,R.jsx)(jG,{}),(0,R.jsx)(OG,{}),(0,R.jsx)(LG,{}),(0,R.jsx)(MG,{}),(0,R.jsx)(PG,{}),(0,R.jsx)(FG,{}),(0,R.jsx)(NG,{})]})})],[]);return(0,L.useImperativeHandle)(a,()=>({flushSave:async()=>{_(),await v()},getMarkdown:()=>c.current})),(0,L.useEffect)(()=>()=>_(),[_]),(0,L.useEffect)(()=>{let n=s.current!==e,i=t!==l.current;!n&&!i||(s.current=e,_(),u.current=null,c.current=t,l.current=t,f.current=!0,g(t),m(`rich`),r(`saved`))},[e,t,r,_]),p===`plain`||i?(0,R.jsxs)(`div`,{className:`context-files-plain-fallback`,children:[(0,R.jsx)(`p`,{className:`context-files-plain-fallback__notice`,children:i?`This document is read-only. Create a managed copy to edit it.`:`The rich editor could not safely load this document. You are editing raw markdown.`}),(0,R.jsx)(`textarea`,{className:`context-files-plain-fallback__textarea`,value:i?t:h,readOnly:i,onChange:e=>{if(i)return;let t=e.currentTarget.value;g(t),c.current=t,r(`idle`),y()},spellCheck:!1})]}):(0,R.jsx)(iie,{ref:o,markdown:t,onChange:b,onError:e=>{console.error(`MDXEditor error`,e),g(c.current),m(`plain`)},contentEditableClassName:`context-files-mdx-content`,readOnly:i,plugins:x},e)}));function HG({agentProfiles:e,selectedFileKey:t}){let n=(0,L.useMemo)(()=>[...new Set(e)].sort((e,t)=>e.localeCompare(t)),[e]),r=(0,L.useRef)(null),i=(0,L.useRef)(`saved`),[a,o]=(0,L.useState)([]),[s,c]=(0,L.useState)(null),[l,u]=(0,L.useState)(null),[d,f]=(0,L.useState)([]),[p,m]=(0,L.useState)(null),[h,g]=(0,L.useState)(`saved`),[_,v]=(0,L.useState)(null),[y,b]=(0,L.useState)(null),[x,S]=(0,L.useState)(!0),[C,w]=(0,L.useState)(!1),[T,E]=(0,L.useState)(``),[D,O]=(0,L.useState)(`global`),[k,A]=(0,L.useState)(``),[j,M]=(0,L.useState)(``);(0,L.useEffect)(()=>{i.current=h},[h]);let N=(0,L.useCallback)(async e=>{if(u(e),c(e.key),v(null),b(null),!e.managed){f([]),m(null);return}let[t,n]=await Promise.all([fl(e.key),e.sourceRef?pl(e.key).catch(()=>null):Promise.resolve(null)]);f(t.revisions),m(n)},[]),P=(0,L.useCallback)(async()=>{let e=await al();o(e),c(t=>t??e[0]?.key??null)},[]),ee=(0,L.useCallback)(async e=>{await N(await ol(e))},[N]);(0,L.useEffect)(()=>{P().catch(e=>b(e instanceof Error?e.message:String(e))).finally(()=>S(!1))},[P]),(0,L.useEffect)(()=>{if(!s){u(null);return}ee(s).catch(e=>b(e instanceof Error?e.message:String(e)))},[s,ee]),(0,L.useEffect)(()=>{let e=new EventSource(`/api/context-files/events`);return e.addEventListener(`pibo-product`,e=>{let t=tK(e);if(!t?.type.startsWith(`context-file.`))return;P().catch(e=>b(e instanceof Error?e.message:String(e)));let n=t.payload?.key;if(!(!n||n!==s)&&t.source!==`web`){if(i.current===`idle`||i.current===`saving`){v(`This file changed on disk while you had local edits. Review before saving again.`);return}ee(n).catch(e=>b(e instanceof Error?e.message:String(e)))}}),e.onerror=()=>{b(`Live context-file updates disconnected.`)},()=>e.close()},[ee,P,s]);let te=(0,L.useMemo)(()=>a.find(e=>e.key===s)??null,[a,s]);(0,L.useEffect)(()=>{M(l?.agentProfileName??``)},[l?.agentProfileName,l?.key]),(0,L.useEffect)(()=>{D!==`agent`||k||n.length===0||A(n[0])},[n,k,D]);let ne=(0,L.useCallback)(async e=>{try{await r.current?.flushSave(),await ee(e)}catch(e){b(e instanceof Error?e.message:String(e))}},[ee]);(0,L.useEffect)(()=>{if(!t||t===s)return;let e=!1;return(async()=>{try{await r.current?.flushSave(),e||c(t)}catch(t){e||b(t instanceof Error?t.message:String(t))}})(),()=>{e=!0}},[t,s]);let F=(0,L.useCallback)(async()=>{try{let e=await sl({label:T.trim()||void 0,scope:D,agentProfileName:D===`agent`?k.trim():void 0,markdown:``});E(``),A(``),await N(e),await P(),b(null)}catch(e){b(e instanceof Error?e.message:String(e))}},[k,T,D,N,P]),re=(0,L.useCallback)(async e=>{if(l)try{await N(await ll(l.key,{markdown:e,expectedVersion:l.version})),await P(),v(null),b(null)}catch(e){if(nK(e)){await N(e.data.file),v(`This file changed on disk before your save completed. Reload the latest version and retry.`);return}throw b(e instanceof Error?e.message:String(e)),e}},[l,N,P]),I=(0,L.useCallback)(async()=>{s&&(await ee(s),await P())},[ee,P,s]),ie=(0,L.useCallback)(async()=>{if(te?.removable)try{await dl(te.key,!0),c(null),u(null),await P(),b(null)}catch(e){b(e instanceof Error?e.message:String(e))}},[P,te]),ae=(0,L.useCallback)(async e=>{if(l?.managed){w(!0);try{await N(await ul(l.key,{scope:e,agentProfileName:e===`agent`&&j.trim()||void 0})),await P(),b(null)}catch(e){b(e instanceof Error?e.message:String(e))}finally{w(!1)}}},[l,N,j,P]),oe=(0,L.useCallback)(e=>{M(e),!(!l?.managed||!e||l.scope===`agent`&&e===(l.agentProfileName??``))&&(w(!0),ul(l.key,{scope:`agent`,agentProfileName:e}).then(async e=>{await N(e),await P(),b(null)}).catch(e=>b(e instanceof Error?e.message:String(e))).finally(()=>w(!1)))},[l,N,P]),se=(0,L.useCallback)(async()=>{if(!(!te||te.source!==`plugin`)){w(!0);try{let e=await cl(te.key);await P(),await N(e),b(null)}catch(e){b(e instanceof Error?e.message:String(e))}finally{w(!1)}}},[N,P,te]),ce=(0,L.useCallback)(async()=>{if(!(!l?.managed||!l.sourceRef)){w(!0);try{let e=await ml(l.key);await P(),await N(e)}catch(e){b(e instanceof Error?e.message:String(e))}finally{w(!1)}}},[l,N,P]),le=(0,L.useCallback)(async()=>{if(!(!l?.managed||l.linkState!==`linked-stale`)){w(!0);try{let e=await hl(l.key);await P(),await N(e)}catch(e){b(e instanceof Error?e.message:String(e))}finally{w(!1)}}},[l,N,P]),ue=(0,L.useCallback)(async e=>{if(l?.managed){w(!0);try{let t=await gl(l.key,e);await P(),await N(t)}catch(e){b(e instanceof Error?e.message:String(e))}finally{w(!1)}}},[l,N,P]);return(0,R.jsxs)(`div`,{className:`context-files-view grid h-full min-h-0 grid-cols-[minmax(0,1fr)_300px] max-[1120px]:grid-cols-[minmax(0,1fr)_260px] max-[900px]:flex max-[900px]:flex-col max-[900px]:overflow-auto`,children:[(0,R.jsxs)(`main`,{className:`flex min-h-0 flex-col bg-[#101d22] max-[900px]:min-h-[70vh] max-[900px]:shrink-0`,children:[(0,R.jsxs)(`div`,{className:`flex h-14 items-center justify-between gap-3 border-b border-slate-800 bg-[#151f24] px-4 max-[640px]:h-auto max-[640px]:flex-wrap max-[640px]:py-3`,children:[(0,R.jsxs)(`div`,{className:`min-w-0`,children:[(0,R.jsx)(`div`,{className:`text-[10px] font-bold uppercase tracking-[0.14em] text-[#11a4d4]`,children:te?ZG(te):`Context File`}),(0,R.jsx)(`h2`,{className:`truncate text-base font-semibold text-slate-100`,children:l?.label||l?.key||`No file selected`}),l?(0,R.jsx)(`div`,{className:`truncate font-mono text-[11px] text-slate-500`,children:l.path}):null]}),(0,R.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,R.jsxs)(`span`,{className:`inline-flex h-8 items-center gap-1.5 border px-2.5 text-xs ${JG(h)}`,children:[(0,R.jsx)(Ls,{size:14}),qG(h)]}),(0,R.jsx)(`button`,{className:`inline-flex h-8 w-8 items-center justify-center border border-slate-700 text-slate-400 hover:border-[#11a4d4] hover:text-[#7dd3fc]`,type:`button`,title:`Reload`,onClick:()=>void I(),children:(0,R.jsx)(Ps,{size:15})}),(0,R.jsx)(`button`,{className:`inline-flex h-8 w-8 items-center justify-center border border-slate-700 text-slate-400 hover:border-red-500 hover:text-red-300 disabled:cursor-not-allowed disabled:opacity-45`,type:`button`,title:`Remove managed file`,disabled:!te?.removable,onClick:()=>void ie(),children:(0,R.jsx)(Ws,{size:15})})]})]}),(0,R.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 p-4 max-[640px]:p-3`,children:[y?(0,R.jsx)(UG,{tone:`error`,text:y}):null,_?(0,R.jsx)(UG,{tone:`warning`,text:_}):null,l?(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 border border-slate-800 bg-[#151f24] px-3 py-2 text-xs text-slate-400`,children:[(0,R.jsxs)(`div`,{children:[`State: `,(0,R.jsx)(`span`,{className:`text-slate-100`,children:$G(l.linkState)})]}),l.sourceRef?(0,R.jsx)(`div`,{className:`min-w-0 break-all font-mono text-[11px] text-slate-500`,children:l.sourceRef}):null,l.sourceHash?(0,R.jsx)(`div`,{className:`min-w-0 break-all font-mono text-[11px] text-slate-500`,children:l.sourceHash}):null]}):null,l?.source===`plugin`?(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 border border-slate-800 bg-[#151f24] p-3 text-xs text-slate-400`,children:[(0,R.jsx)(`div`,{children:`Plugin context files are immutable in Pibo. Create a managed copy before editing.`}),(0,R.jsx)(`button`,{className:`inline-flex min-h-8 items-center justify-center border border-[#11a4d4] bg-[#11a4d4]/10 px-3 py-1 text-xs uppercase tracking-wider text-[#7dd3fc] disabled:opacity-45`,type:`button`,disabled:C,onClick:()=>void se(),children:`Create Managed Copy`})]}):null,l?.managed?(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 border border-slate-800 bg-[#151f24] p-3 text-xs text-slate-400`,children:[(0,R.jsxs)(`div`,{className:`flex gap-1`,children:[(0,R.jsx)(`button`,{type:`button`,className:`inline-flex h-8 items-center justify-center border px-3 uppercase tracking-wider ${l.scope===`global`?`border-[#11a4d4] bg-[#11a4d4]/10 text-[#7dd3fc]`:`border-slate-700 text-slate-400 hover:border-slate-600 hover:text-slate-300`}`,onClick:()=>void ae(`global`),disabled:C,children:`Global`}),(0,R.jsx)(`button`,{type:`button`,className:`inline-flex h-8 items-center justify-center border px-3 uppercase tracking-wider ${l.scope===`agent`?`border-[#11a4d4] bg-[#11a4d4]/10 text-[#7dd3fc]`:`border-slate-700 text-slate-400 hover:border-slate-600 hover:text-slate-300`}`,onClick:()=>void ae(`agent`),disabled:C||!j.trim(),children:`Agent`})]}),(0,R.jsx)(YG,{value:j,options:XG(n,j),placeholder:`Select agent`,disabled:C,onChange:oe,compact:!0}),l.sourceRef?(0,R.jsx)(`button`,{className:`inline-flex h-8 items-center justify-center border border-[#11a4d4] bg-[#11a4d4]/10 px-3 uppercase tracking-wider text-[#7dd3fc] disabled:opacity-45`,type:`button`,disabled:C,onClick:()=>void ce(),children:`Reset To Source`}):null,l.linkState===`linked-stale`?(0,R.jsx)(`button`,{className:`inline-flex h-8 items-center justify-center border border-amber-400/70 bg-amber-400/10 px-3 uppercase tracking-wider text-amber-100 disabled:opacity-45`,type:`button`,disabled:C,onClick:()=>void le(),children:`Adopt Source`}):null]}):null,l?.exists?(0,R.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto border border-slate-800 bg-[#151f24]`,children:(0,R.jsx)(VG,{ref:r,documentKey:`${l.key}:${l.version??l.updatedAt??``}`,initialMarkdown:l.markdown,onPersist:re,onSaveStateChange:g,readOnly:!l.editable})}):(0,R.jsxs)(`div`,{className:`flex items-center gap-2 border border-dashed border-slate-700 bg-[#151f24] px-4 py-5 text-sm text-slate-400`,children:[(0,R.jsx)(Gs,{size:18}),l?`The selected file is missing on disk.`:`Select or create a context file.`]})]})]}),(0,R.jsxs)(`aside`,{className:`min-h-0 overflow-auto border-l border-slate-800 bg-[#1a262b] max-[900px]:order-first max-[900px]:shrink-0 max-[900px]:border-l-0 max-[900px]:border-b max-[900px]:overflow-visible`,children:[(0,R.jsxs)(`div`,{className:`border-b border-slate-800 px-4 py-3`,children:[(0,R.jsx)(`div`,{className:`text-[10px] font-bold uppercase tracking-[0.14em] text-[#11a4d4]`,children:`Context`}),(0,R.jsx)(`h1`,{className:`mt-1 text-sm font-semibold text-slate-100`,children:`Context Files`})]}),(0,R.jsxs)(`div`,{className:`space-y-3 p-3`,children:[(0,R.jsxs)(`section`,{className:`space-y-2 border border-slate-800 bg-[#151f24] p-3 max-[640px]:overflow-hidden`,children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap gap-1`,children:[(0,R.jsxs)(`button`,{className:`inline-flex h-8 items-center justify-center gap-1.5 border px-3 text-xs uppercase tracking-wider ${D===`global`?`border-[#11a4d4] bg-[#11a4d4]/10 text-[#7dd3fc]`:`border-slate-700 text-slate-400 hover:border-slate-600 hover:text-slate-300`}`,type:`button`,onClick:()=>O(`global`),children:[(0,R.jsx)(os,{size:14}),`Global`]}),(0,R.jsxs)(`button`,{className:`inline-flex h-8 items-center justify-center gap-1.5 border px-3 text-xs uppercase tracking-wider ${D===`agent`?`border-[#11a4d4] bg-[#11a4d4]/10 text-[#7dd3fc]`:`border-slate-700 text-slate-400 hover:border-slate-600 hover:text-slate-300`}`,type:`button`,onClick:()=>O(`agent`),children:[(0,R.jsx)(cs,{size:14}),`Agent`]})]}),(0,R.jsx)(`input`,{className:`h-9 w-full border border-slate-700 bg-[#0e1116] px-3 text-sm text-slate-200 outline-none placeholder:text-slate-500 focus:border-[#11a4d4]`,value:T,onChange:e=>E(e.currentTarget.value),placeholder:`Context file name`}),D===`agent`?(0,R.jsx)(YG,{value:k,options:n,placeholder:`Select agent`,onChange:A}):null,(0,R.jsx)(`button`,{className:`inline-flex h-9 w-full items-center justify-center border border-[#11a4d4] bg-[#11a4d4] px-3 text-sm font-medium text-white disabled:cursor-not-allowed disabled:opacity-45`,type:`button`,disabled:!T.trim()||D===`agent`&&!k.trim(),onClick:()=>void F(),children:`Create File`})]}),(0,R.jsxs)(`section`,{className:`space-y-2`,"aria-label":`Context files`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2 px-1 text-[10px] font-bold uppercase tracking-wider text-slate-500`,children:[(0,R.jsx)(cs,{size:13}),(0,R.jsxs)(`span`,{children:[a.length,` Files`]})]}),x?(0,R.jsx)(`div`,{className:`border border-dashed border-slate-700 px-3 py-4 text-xs text-slate-500`,children:`Loading`}):null,(0,R.jsx)(`div`,{className:`space-y-1`,children:a.map(e=>(0,R.jsxs)(`button`,{type:`button`,className:`block w-full border px-3 py-2 text-left ${e.key===s?`border-[#11a4d4] bg-[#101d22]`:`border-transparent text-slate-300 hover:border-slate-700 hover:bg-[#101d22]`}`,onClick:()=>void ne(e.key),children:[(0,R.jsx)(`div`,{className:`truncate text-sm font-medium text-slate-100`,children:e.label||e.key}),(0,R.jsx)(`div`,{className:`mt-0.5 overflow-hidden text-ellipsis whitespace-nowrap font-mono text-[11px] text-slate-500 max-[640px]:whitespace-normal max-[640px]:break-all`,children:e.path}),(0,R.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-1.5`,children:[(0,R.jsx)(`span`,{className:`inline-flex border px-1.5 py-0.5 text-[10px] uppercase tracking-wider ${QG(e)}`,children:ZG(e)}),(0,R.jsx)(`span`,{className:`inline-flex border px-1.5 py-0.5 text-[10px] uppercase tracking-wider ${eK(e.linkState)}`,children:$G(e.linkState)}),e.exists?null:(0,R.jsx)(`span`,{className:`inline-flex border border-amber-400/70 px-1.5 py-0.5 text-[10px] uppercase tracking-wider text-amber-200`,children:`Missing`})]})]},e.key))}),!x&&a.length===0?(0,R.jsx)(`div`,{className:`border border-dashed border-slate-700 px-3 py-4 text-xs text-slate-500`,children:`No context files registered`}):null]}),l?.managed?(0,R.jsxs)(`section`,{className:`space-y-2`,"aria-label":`Selected context file history`,children:[(0,R.jsx)(`div`,{className:`px-1 text-[10px] font-bold uppercase tracking-wider text-slate-500`,children:`File Details`}),(0,R.jsx)(WG,{title:`Revision History`,meta:`${d.length} revisions`,children:(0,R.jsx)(GG,{revisions:d,actionBusy:C,onRestore:ue})}),p?(0,R.jsx)(WG,{title:`Source Diff`,meta:`${p.chunks.length} chunks`,children:(0,R.jsx)(KG,{diff:p})}):null]}):null]})]})]})}function UG({tone:e,text:t}){return(0,R.jsx)(`div`,{className:`border px-3 py-2 text-sm ${e===`error`?`border-red-500/80 bg-red-500/10 text-red-200`:`border-amber-400/80 bg-amber-400/10 text-amber-100`}`,children:t})}function WG({title:e,meta:t,children:n}){return(0,R.jsxs)(`details`,{className:`group border border-slate-800 bg-[#151f24]`,children:[(0,R.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center justify-between gap-2 px-3 py-2 text-xs text-slate-400 hover:text-slate-200`,children:[(0,R.jsx)(`span`,{className:`font-bold uppercase tracking-wider text-slate-300`,children:e}),(0,R.jsxs)(`span`,{className:`flex items-center gap-2 text-[10px] uppercase tracking-wider text-slate-500`,children:[t?(0,R.jsx)(`span`,{children:t}):null,(0,R.jsx)(`span`,{"aria-hidden":`true`,children:`▾`})]})]}),(0,R.jsx)(`div`,{className:`max-h-[34vh] overflow-auto border-t border-slate-800 p-2`,children:n})]})}function GG({revisions:e,actionBusy:t,onRestore:n}){return e.length===0?(0,R.jsx)(`div`,{className:`border border-dashed border-slate-700 px-3 py-4 text-xs text-slate-500`,children:`No revisions recorded yet.`}):(0,R.jsx)(`div`,{className:`space-y-2`,children:e.map(e=>(0,R.jsxs)(`div`,{className:`space-y-2 border border-slate-800 bg-[#101d22] px-3 py-2 text-xs text-slate-400`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsxs)(`div`,{className:`font-medium text-slate-100`,children:[e.kind,` `,e.active?`(active)`:``]}),(0,R.jsx)(`div`,{className:`break-words`,children:e.note??e.id}),(0,R.jsx)(`div`,{className:`break-all font-mono text-[11px] text-slate-500`,children:e.createdAt})]}),e.active?null:(0,R.jsx)(`button`,{className:`inline-flex h-8 items-center justify-center border border-slate-700 px-3 text-[11px] uppercase tracking-wider text-slate-300 hover:border-[#11a4d4] hover:text-[#7dd3fc] disabled:opacity-45`,type:`button`,disabled:t,onClick:()=>n(e.id),children:`Restore`})]},e.id))})}function KG({diff:e}){return(0,R.jsx)(`div`,{className:`space-y-1`,children:e.chunks.map((e,t)=>(0,R.jsx)(`pre`,{className:`overflow-auto border px-3 py-2 text-xs ${e.type===`add`?`border-emerald-500/60 bg-emerald-500/10 text-emerald-100`:e.type===`remove`?`border-red-500/60 bg-red-500/10 text-red-100`:`border-slate-800 bg-[#101d22] text-slate-300`}`,children:e.lines.map(t=>`${e.type===`add`?`+`:e.type===`remove`?`-`:` `} ${t}`).join(`
138
+ `)},`${e.type}-${t}`))})}function qG(e){return e===`saving`?`Saving`:e===`saved`?`Saved`:e===`error`?`Error`:`Unsaved`}function JG(e){return e===`saving`?`border-orange-400/80 bg-orange-400/10 text-orange-100`:e===`saved`?`border-emerald-500/80 bg-emerald-500/10 text-emerald-100`:e===`error`?`border-red-500/80 bg-red-500/10 text-red-200`:`border-amber-400/80 bg-amber-400/10 text-amber-100`}function YG({value:e,options:t,placeholder:n,disabled:r=!1,onChange:i,compact:a=!1}){return(0,R.jsxs)(`div`,{className:`relative ${a?`min-w-[16rem] flex-1 max-[640px]:min-w-full`:``}`,children:[(0,R.jsxs)(`select`,{className:`w-full appearance-none border border-slate-700 bg-[#0e1116] pr-9 text-slate-200 outline-none focus:border-[#11a4d4] disabled:cursor-not-allowed disabled:opacity-60 ${a?`h-8 px-3 text-xs`:`h-9 px-3 text-sm`}`,value:e,disabled:r||t.length===0,onChange:e=>i(e.currentTarget.value),children:[e?null:(0,R.jsx)(`option`,{value:``,children:n}),t.length===0?(0,R.jsx)(`option`,{value:``,children:n}):null,t.map(e=>(0,R.jsx)(`option`,{value:e,children:e},e))]}),(0,R.jsx)(`span`,{className:`pointer-events-none absolute inset-y-0 right-3 inline-flex items-center text-slate-500`,children:(0,R.jsx)(Bo,{size:14})})]})}function XG(e,t){return!t||e.includes(t)?e:[t,...e]}function ZG(e){return e.source===`plugin`?`Plugin Global`:e.scope===`agent`?e.agentProfileName?`Agent ${e.agentProfileName}`:`Agent Local`:`Global`}function QG(e){return e.source===`plugin`?`border-cyan-500/70 text-cyan-200`:e.scope===`agent`?`border-fuchsia-500/70 text-fuchsia-200`:`border-[#11a4d4]/80 text-[#7dd3fc]`}function $G(e){return e===`plugin-only`?`Plugin Only`:e===`linked-clean`?`Linked Clean`:e===`linked-dirty`?`Linked Dirty`:e===`linked-stale`?`Linked Stale`:e===`orphaned`?`Orphaned`:`Managed Unlinked`}function eK(e){return e===`plugin-only`?`border-cyan-500/70 text-cyan-200`:e===`linked-clean`?`border-emerald-500/70 text-emerald-200`:e===`linked-dirty`?`border-orange-400/70 text-orange-100`:e===`linked-stale`?`border-amber-400/70 text-amber-100`:e===`orphaned`?`border-red-500/70 text-red-200`:`border-slate-600 text-slate-300`}function tK(e){try{let t=JSON.parse(e.data);return t&&typeof t.type==`string`?t:void 0}catch{return}}function nK(e){return typeof e==`object`&&!!e&&`status`in e&&e.status===409&&`data`in e&&typeof e.data==`object`&&e.data?.file!==void 0}async function rK(){return(await B(`/api/chat/base-prompt`)).basePrompt}async function iK(e){return(await B(`/api/chat/base-prompt`,{method:`PATCH`,headers:{"content-type":`application/json`},body:JSON.stringify({mode:e})})).basePrompt}async function aK(e){return(await B(`/api/chat/base-prompt/custom`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify({markdown:e})})).basePrompt}async function oK(){return(await B(`/api/chat/compaction-prompt`)).compactionPrompt}async function sK(e){return(await B(`/api/chat/compaction-prompt`,{method:`PATCH`,headers:{"content-type":`application/json`},body:JSON.stringify({mode:e})})).compactionPrompt}async function cK(e){return(await B(`/api/chat/compaction-prompt/custom`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify({markdown:e})})).compactionPrompt}async function lK(e){return(await B(`/api/chat/model-defaults`,{method:`PATCH`,headers:{"content-type":`application/json`},body:JSON.stringify(e)})).modelDefaults}async function uK(){return(await B(`/api/chat/user-settings`)).userSettings}async function dK(e){return(await B(`/api/chat/user-settings`,{method:`PATCH`,headers:{"content-type":`application/json`},body:JSON.stringify(e)})).userSettings}async function fK(e){return(await B(`/api/chat/telemetry-retention/prune`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(e)})).telemetryRetention}function pK(){let[e,t]=(0,L.useState)(null),[n,r]=(0,L.useState)(`library`),[i,a]=(0,L.useState)(``),[o,s]=(0,L.useState)(`saved`),[c,l]=(0,L.useState)(!0),[u,d]=(0,L.useState)(!1),[f,p]=(0,L.useState)(null),m=(0,L.useCallback)(async()=>{l(!0);try{let e=await rK();t(e),r(e.effectiveMode),a(e.custom.exists?e.custom.markdown:e.library.markdown),s(`saved`),p(null)}catch(e){p(e instanceof Error?e.message:String(e))}finally{l(!1)}},[]);(0,L.useEffect)(()=>{m()},[m]);let h=(0,L.useMemo)(()=>e?n===`library`?e.library.markdown:i:``,[i,e,n]),g=(0,L.useCallback)(async e=>{d(!0);try{let n=await iK(e);t(n),r(e),a(n.custom.exists?n.custom.markdown:n.library.markdown),s(`saved`),p(null)}catch(e){p(e instanceof Error?e.message:String(e))}finally{d(!1)}},[]),_=(0,L.useCallback)(async()=>{d(!0),s(`saving`);try{let e=await aK(i);t(e),r(`custom`),a(e.custom.markdown),s(`saved`),p(null)}catch(e){s(`error`),p(e instanceof Error?e.message:String(e))}finally{d(!1)}},[i]),v=e?.effectiveMode===`custom`;return(0,R.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col bg-[#101d22]`,children:[(0,R.jsxs)(`div`,{className:`flex h-14 items-center justify-between gap-3 border-b border-slate-800 bg-[#151f24] px-4`,children:[(0,R.jsxs)(`div`,{className:`min-w-0`,children:[(0,R.jsx)(`div`,{className:`text-[10px] font-bold uppercase tracking-[0.14em] text-[#11a4d4]`,children:`Base Prompt`}),(0,R.jsx)(`h2`,{className:`truncate text-base font-semibold text-slate-100`,children:e?.effectiveMode===`custom`?`Custom Base Prompt`:`Library Base Prompt`}),(0,R.jsx)(`div`,{className:`truncate font-mono text-[11px] text-slate-500`,children:e?e.effectiveMode===`custom`?e.custom.path:e.library.path:`loading`})]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsxs)(`span`,{className:`inline-flex h-8 items-center gap-1.5 border px-2.5 text-xs ${v?`border-[#11a4d4] bg-[#11a4d4]/10 text-[#7dd3fc]`:`border-slate-700 bg-[#101d22] text-slate-300`}`,children:[(0,R.jsx)(Mo,{size:14}),`Active: `,e?.effectiveMode??`library`]}),(0,R.jsx)(`button`,{type:`button`,title:`Reload`,onClick:()=>void m(),className:`inline-flex h-8 w-8 items-center justify-center border border-slate-700 text-slate-400 hover:border-[#11a4d4] hover:text-[#7dd3fc]`,children:(0,R.jsx)(Ps,{size:15})})]})]}),(0,R.jsxs)(`div`,{className:`grid min-h-0 flex-1 grid-cols-[250px_minmax(0,1fr)] max-[980px]:grid-cols-1`,children:[(0,R.jsxs)(`aside`,{className:`border-r border-slate-800 bg-[#151f24] p-3 max-[980px]:border-b max-[980px]:border-r-0`,children:[(0,R.jsx)(`div`,{className:`mb-3 text-[10px] font-bold uppercase tracking-wider text-slate-500`,children:`Source`}),(0,R.jsxs)(`button`,{type:`button`,onClick:()=>r(`library`),className:`mb-2 w-full border p-2 text-left ${n===`library`?`border-[#11a4d4] bg-[#11a4d4]/10`:`border-slate-800 bg-[#101d22] hover:border-slate-700`}`,children:[(0,R.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[(0,R.jsx)(`span`,{className:`block text-sm text-slate-200`,children:`Library`}),v?null:(0,R.jsx)(`span`,{className:`font-mono text-[10px] uppercase tracking-wider text-[#7dd3fc]`,children:`Active`})]}),(0,R.jsx)(`span`,{className:`block truncate font-mono text-[10px] text-slate-500`,children:`read-only`})]}),(0,R.jsxs)(`button`,{type:`button`,onClick:()=>r(`custom`),className:`mb-4 w-full border p-2 text-left ${n===`custom`?`border-[#11a4d4] bg-[#11a4d4]/10`:`border-slate-800 bg-[#101d22] hover:border-slate-700`}`,children:[(0,R.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[(0,R.jsx)(`span`,{className:`block text-sm text-slate-200`,children:`Custom`}),v?(0,R.jsx)(`span`,{className:`font-mono text-[10px] uppercase tracking-wider text-[#7dd3fc]`,children:`Active`}):null]}),(0,R.jsx)(`span`,{className:`block truncate font-mono text-[10px] text-slate-500`,children:e?.custom.exists?`editable`:`not-created`})]}),(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsx)(mK,{checked:v,disabled:u||!e,onToggle:()=>void g(v?`library`:`custom`)}),(0,R.jsxs)(`button`,{type:`button`,disabled:u||n!==`custom`,onClick:()=>void _(),className:`inline-flex h-8 w-full items-center justify-center gap-2 border border-slate-700 bg-[#101d22] px-3 text-xs uppercase tracking-wider text-slate-300 hover:border-[#11a4d4] hover:text-[#7dd3fc] disabled:cursor-not-allowed disabled:opacity-45`,children:[(0,R.jsx)(Ls,{size:14}),o===`saving`?`Saving`:`Save Custom`]})]})]}),(0,R.jsxs)(`main`,{className:`flex min-h-0 flex-col gap-3 p-4`,children:[f?(0,R.jsx)(`div`,{className:`border border-red-500/50 bg-red-500/10 px-3 py-2 text-sm text-red-200`,children:f}):null,c?(0,R.jsx)(`div`,{className:`border border-slate-800 bg-[#151f24] p-4 text-sm text-slate-400`,children:`Loading base prompt...`}):(0,R.jsx)(`textarea`,{value:h,readOnly:n===`library`,onChange:e=>{a(e.target.value),s(`idle`)},spellCheck:!1,className:`min-h-0 flex-1 resize-none border border-slate-800 bg-[#0e1116] p-4 font-mono text-xs leading-5 text-slate-200 outline-none focus:border-[#11a4d4] read-only:text-slate-400`})]})]})]})}function mK({checked:e,disabled:t,onToggle:n}){return(0,R.jsxs)(`button`,{type:`button`,disabled:t,"aria-pressed":e,onClick:n,className:`flex w-full items-center gap-2 border border-slate-800 bg-[#101d22] p-2 text-left text-sm text-slate-300 hover:border-slate-700 hover:text-slate-100 disabled:cursor-not-allowed disabled:opacity-60`,children:[(0,R.jsx)(hK,{checked:e,disabled:t}),(0,R.jsxs)(`span`,{className:`min-w-0`,children:[(0,R.jsx)(`span`,{className:`block truncate`,children:`Use custom base prompt`}),(0,R.jsx)(`span`,{className:`block truncate font-mono text-[10px] text-slate-500`,children:e?`custom active`:`library active`})]})]})}function hK({checked:e,disabled:t}){return(0,R.jsx)(`span`,{className:`inline-flex h-4 w-4 shrink-0 items-center justify-center rounded-sm border ${e?`border-[#11a4d4] bg-[#11a4d4]/10 text-[#11a4d4]`:`border-slate-600 text-transparent`} ${t?`opacity-70`:``}`,children:e?(0,R.jsx)(zo,{size:12}):null})}function gK(){let[e,t]=(0,L.useState)(null),[n,r]=(0,L.useState)(`library`),[i,a]=(0,L.useState)(``),[o,s]=(0,L.useState)(`saved`),[c,l]=(0,L.useState)(!0),[u,d]=(0,L.useState)(!1),[f,p]=(0,L.useState)(null),m=(0,L.useCallback)(async()=>{l(!0);try{let e=await oK();t(e),r(e.effectiveMode),a(e.custom.exists?e.custom.markdown:e.library.markdown),s(`saved`),p(null)}catch(e){p(e instanceof Error?e.message:String(e))}finally{l(!1)}},[]);(0,L.useEffect)(()=>{m()},[m]);let h=(0,L.useMemo)(()=>e?n===`library`?e.library.markdown:i:``,[i,e,n]),g=(0,L.useCallback)(async e=>{d(!0);try{let n=await sK(e);t(n),r(e),a(n.custom.exists?n.custom.markdown:n.library.markdown),s(`saved`),p(null)}catch(e){p(e instanceof Error?e.message:String(e))}finally{d(!1)}},[]),_=(0,L.useCallback)(async()=>{d(!0),s(`saving`);try{let e=await cK(i);t(e),r(`custom`),a(e.custom.markdown),s(`saved`),p(null)}catch(e){s(`error`),p(e instanceof Error?e.message:String(e))}finally{d(!1)}},[i]),v=e?.effectiveMode===`custom`;return(0,R.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col bg-[#101d22]`,children:[(0,R.jsxs)(`div`,{className:`flex h-14 items-center justify-between gap-3 border-b border-slate-800 bg-[#151f24] px-4`,children:[(0,R.jsxs)(`div`,{className:`min-w-0`,children:[(0,R.jsx)(`div`,{className:`text-[10px] font-bold uppercase tracking-[0.14em] text-[#11a4d4]`,children:`Compaction Prompt`}),(0,R.jsx)(`h2`,{className:`truncate text-base font-semibold text-slate-100`,children:e?.effectiveMode===`custom`?`Custom Compaction Prompt`:`Library Compaction Prompt`}),(0,R.jsx)(`div`,{className:`truncate font-mono text-[11px] text-slate-500`,children:e?e.effectiveMode===`custom`?e.custom.path:e.library.path:`loading`})]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsxs)(`span`,{className:`inline-flex h-8 items-center gap-1.5 border px-2.5 text-xs ${v?`border-[#11a4d4] bg-[#11a4d4]/10 text-[#7dd3fc]`:`border-slate-700 bg-[#101d22] text-slate-300`}`,children:[(0,R.jsx)(Fo,{size:14}),`Active: `,e?.effectiveMode??`library`]}),(0,R.jsx)(`button`,{type:`button`,title:`Reload`,onClick:()=>void m(),className:`inline-flex h-8 w-8 items-center justify-center border border-slate-700 text-slate-400 hover:border-[#11a4d4] hover:text-[#7dd3fc]`,children:(0,R.jsx)(Ps,{size:15})})]})]}),(0,R.jsxs)(`div`,{className:`grid min-h-0 flex-1 grid-cols-[250px_minmax(0,1fr)] max-[980px]:grid-cols-1`,children:[(0,R.jsxs)(`aside`,{className:`border-r border-slate-800 bg-[#151f24] p-3 max-[980px]:border-b max-[980px]:border-r-0`,children:[(0,R.jsx)(`div`,{className:`mb-3 text-[10px] font-bold uppercase tracking-wider text-slate-500`,children:`Source`}),(0,R.jsxs)(`button`,{type:`button`,onClick:()=>r(`library`),className:`mb-2 w-full border p-2 text-left ${n===`library`?`border-[#11a4d4] bg-[#11a4d4]/10`:`border-slate-800 bg-[#101d22] hover:border-slate-700`}`,children:[(0,R.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[(0,R.jsx)(`span`,{className:`block text-sm text-slate-200`,children:`Library`}),v?null:(0,R.jsx)(`span`,{className:`font-mono text-[10px] uppercase tracking-wider text-[#7dd3fc]`,children:`Active`})]}),(0,R.jsx)(`span`,{className:`block truncate font-mono text-[10px] text-slate-500`,children:`read-only`})]}),(0,R.jsxs)(`button`,{type:`button`,onClick:()=>r(`custom`),className:`mb-4 w-full border p-2 text-left ${n===`custom`?`border-[#11a4d4] bg-[#11a4d4]/10`:`border-slate-800 bg-[#101d22] hover:border-slate-700`}`,children:[(0,R.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[(0,R.jsx)(`span`,{className:`block text-sm text-slate-200`,children:`Custom`}),v?(0,R.jsx)(`span`,{className:`font-mono text-[10px] uppercase tracking-wider text-[#7dd3fc]`,children:`Active`}):null]}),(0,R.jsx)(`span`,{className:`block truncate font-mono text-[10px] text-slate-500`,children:e?.custom.exists?`editable`:`not-created`})]}),(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsx)(_K,{checked:v,disabled:u||!e,onToggle:()=>void g(v?`library`:`custom`)}),(0,R.jsxs)(`button`,{type:`button`,disabled:u||n!==`custom`,onClick:()=>void _(),className:`inline-flex h-8 w-full items-center justify-center gap-2 border border-slate-700 bg-[#101d22] px-3 text-xs uppercase tracking-wider text-slate-300 hover:border-[#11a4d4] hover:text-[#7dd3fc] disabled:cursor-not-allowed disabled:opacity-45`,children:[(0,R.jsx)(Ls,{size:14}),o===`saving`?`Saving`:`Save Custom`]})]})]}),(0,R.jsxs)(`main`,{className:`flex min-h-0 flex-col gap-3 p-4`,children:[f?(0,R.jsx)(`div`,{className:`border border-red-500/50 bg-red-500/10 px-3 py-2 text-sm text-red-200`,children:f}):null,c?(0,R.jsx)(`div`,{className:`border border-slate-800 bg-[#151f24] p-4 text-sm text-slate-400`,children:`Loading compaction prompt...`}):(0,R.jsx)(`textarea`,{value:h,readOnly:n===`library`,onChange:e=>{a(e.target.value),s(`idle`)},spellCheck:!1,className:`min-h-0 flex-1 resize-none border border-slate-800 bg-[#0e1116] p-4 font-mono text-xs leading-5 text-slate-200 outline-none focus:border-[#11a4d4] read-only:text-slate-400`})]})]})]})}function _K({checked:e,disabled:t,onToggle:n}){return(0,R.jsxs)(`button`,{type:`button`,disabled:t,"aria-pressed":e,onClick:n,className:`flex w-full items-center gap-2 border border-slate-800 bg-[#101d22] p-2 text-left text-sm text-slate-300 hover:border-slate-700 hover:text-slate-100 disabled:cursor-not-allowed disabled:opacity-60`,children:[(0,R.jsx)(vK,{checked:e,disabled:t}),(0,R.jsxs)(`span`,{className:`min-w-0`,children:[(0,R.jsx)(`span`,{className:`block truncate`,children:`Use custom compaction prompt`}),(0,R.jsx)(`span`,{className:`block truncate font-mono text-[10px] text-slate-500`,children:e?`custom active`:`library active`})]})]})}function vK({checked:e,disabled:t}){return(0,R.jsx)(`span`,{className:`inline-flex h-4 w-4 shrink-0 items-center justify-center rounded-sm border ${e?`border-[#11a4d4] bg-[#11a4d4]/10 text-[#11a4d4]`:`border-slate-600 text-transparent`} ${t?`opacity-70`:``}`,children:e?(0,R.jsx)(zo,{size:12}):null})}function yK(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var bK=/[ \t\n\f\r]/g;function xK(e){return typeof e==`object`?e.type===`text`?SK(e.value):!1:SK(e)}function SK(e){return e.replace(bK,``)===``}var CK=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};CK.prototype.normal={},CK.prototype.property={},CK.prototype.space=void 0;function wK(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new CK(n,r,t)}function TK(e){return e.toLowerCase()}var EK=class{constructor(e,t){this.attribute=t,this.property=e}};EK.prototype.attribute=``,EK.prototype.booleanish=!1,EK.prototype.boolean=!1,EK.prototype.commaOrSpaceSeparated=!1,EK.prototype.commaSeparated=!1,EK.prototype.defined=!1,EK.prototype.mustUseProperty=!1,EK.prototype.number=!1,EK.prototype.overloadedBoolean=!1,EK.prototype.property=``,EK.prototype.spaceSeparated=!1,EK.prototype.space=void 0;var DK=e({boolean:()=>kK,booleanish:()=>AK,commaOrSpaceSeparated:()=>PK,commaSeparated:()=>NK,number:()=>Z,overloadedBoolean:()=>jK,spaceSeparated:()=>MK}),OK=0,kK=FK(),AK=FK(),jK=FK(),Z=FK(),MK=FK(),NK=FK(),PK=FK();function FK(){return 2**++OK}var IK=Object.keys(DK),LK=class extends EK{constructor(e,t,n,r){let i=-1;if(super(e,t),RK(this,`space`,r),typeof n==`number`)for(;++i<IK.length;){let e=IK[i];RK(this,IK[i],(n&DK[e])===DK[e])}}};LK.prototype.defined=!0;function RK(e,t,n){n&&(e[t]=n)}function zK(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new LK(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[TK(r)]=r,n[TK(a.attribute)]=r}return new CK(t,n,e.space)}var BK=zK({properties:{ariaActiveDescendant:null,ariaAtomic:AK,ariaAutoComplete:null,ariaBusy:AK,ariaChecked:AK,ariaColCount:Z,ariaColIndex:Z,ariaColSpan:Z,ariaControls:MK,ariaCurrent:null,ariaDescribedBy:MK,ariaDetails:null,ariaDisabled:AK,ariaDropEffect:MK,ariaErrorMessage:null,ariaExpanded:AK,ariaFlowTo:MK,ariaGrabbed:AK,ariaHasPopup:null,ariaHidden:AK,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:MK,ariaLevel:Z,ariaLive:null,ariaModal:AK,ariaMultiLine:AK,ariaMultiSelectable:AK,ariaOrientation:null,ariaOwns:MK,ariaPlaceholder:null,ariaPosInSet:Z,ariaPressed:AK,ariaReadOnly:AK,ariaRelevant:null,ariaRequired:AK,ariaRoleDescription:MK,ariaRowCount:Z,ariaRowIndex:Z,ariaRowSpan:Z,ariaSelected:AK,ariaSetSize:Z,ariaSort:null,ariaValueMax:Z,ariaValueMin:Z,ariaValueNow:Z,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function VK(e,t){return t in e?e[t]:t}function HK(e,t){return VK(e,t.toLowerCase())}var UK=zK({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:NK,acceptCharset:MK,accessKey:MK,action:null,allow:null,allowFullScreen:kK,allowPaymentRequest:kK,allowUserMedia:kK,alt:null,as:null,async:kK,autoCapitalize:null,autoComplete:MK,autoFocus:kK,autoPlay:kK,blocking:MK,capture:null,charSet:null,checked:kK,cite:null,className:MK,cols:Z,colSpan:null,content:null,contentEditable:AK,controls:kK,controlsList:MK,coords:Z|NK,crossOrigin:null,data:null,dateTime:null,decoding:null,default:kK,defer:kK,dir:null,dirName:null,disabled:kK,download:jK,draggable:AK,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:kK,formTarget:null,headers:MK,height:Z,hidden:jK,high:Z,href:null,hrefLang:null,htmlFor:MK,httpEquiv:MK,id:null,imageSizes:null,imageSrcSet:null,inert:kK,inputMode:null,integrity:null,is:null,isMap:kK,itemId:null,itemProp:MK,itemRef:MK,itemScope:kK,itemType:MK,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:kK,low:Z,manifest:null,max:null,maxLength:Z,media:null,method:null,min:null,minLength:Z,multiple:kK,muted:kK,name:null,nonce:null,noModule:kK,noValidate:kK,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:kK,optimum:Z,pattern:null,ping:MK,placeholder:null,playsInline:kK,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:kK,referrerPolicy:null,rel:MK,required:kK,reversed:kK,rows:Z,rowSpan:Z,sandbox:MK,scope:null,scoped:kK,seamless:kK,selected:kK,shadowRootClonable:kK,shadowRootDelegatesFocus:kK,shadowRootMode:null,shape:null,size:Z,sizes:null,slot:null,span:Z,spellCheck:AK,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Z,step:null,style:null,tabIndex:Z,target:null,title:null,translate:null,type:null,typeMustMatch:kK,useMap:null,value:AK,width:Z,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:MK,axis:null,background:null,bgColor:null,border:Z,borderColor:null,bottomMargin:Z,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:kK,declare:kK,event:null,face:null,frame:null,frameBorder:null,hSpace:Z,leftMargin:Z,link:null,longDesc:null,lowSrc:null,marginHeight:Z,marginWidth:Z,noResize:kK,noHref:kK,noShade:kK,noWrap:kK,object:null,profile:null,prompt:null,rev:null,rightMargin:Z,rules:null,scheme:null,scrolling:AK,standby:null,summary:null,text:null,topMargin:Z,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Z,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:kK,disableRemotePlayback:kK,prefix:null,property:null,results:Z,security:null,unselectable:null},space:`html`,transform:HK}),WK=zK({attributes:{accentHeight:`accent-height`,alignmentBaseline:`alignment-baseline`,arabicForm:`arabic-form`,baselineShift:`baseline-shift`,capHeight:`cap-height`,className:`class`,clipPath:`clip-path`,clipRule:`clip-rule`,colorInterpolation:`color-interpolation`,colorInterpolationFilters:`color-interpolation-filters`,colorProfile:`color-profile`,colorRendering:`color-rendering`,crossOrigin:`crossorigin`,dataType:`datatype`,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`,hrefLang:`hreflang`,horizAdvX:`horiz-adv-x`,horizOriginX:`horiz-origin-x`,horizOriginY:`horiz-origin-y`,imageRendering:`image-rendering`,letterSpacing:`letter-spacing`,lightingColor:`lighting-color`,markerEnd:`marker-end`,markerMid:`marker-mid`,markerStart:`marker-start`,navDown:`nav-down`,navDownLeft:`nav-down-left`,navDownRight:`nav-down-right`,navLeft:`nav-left`,navNext:`nav-next`,navPrev:`nav-prev`,navRight:`nav-right`,navUp:`nav-up`,navUpLeft:`nav-up-left`,navUpRight:`nav-up-right`,onAbort:`onabort`,onActivate:`onactivate`,onAfterPrint:`onafterprint`,onBeforePrint:`onbeforeprint`,onBegin:`onbegin`,onCancel:`oncancel`,onCanPlay:`oncanplay`,onCanPlayThrough:`oncanplaythrough`,onChange:`onchange`,onClick:`onclick`,onClose:`onclose`,onCopy:`oncopy`,onCueChange:`oncuechange`,onCut:`oncut`,onDblClick:`ondblclick`,onDrag:`ondrag`,onDragEnd:`ondragend`,onDragEnter:`ondragenter`,onDragExit:`ondragexit`,onDragLeave:`ondragleave`,onDragOver:`ondragover`,onDragStart:`ondragstart`,onDrop:`ondrop`,onDurationChange:`ondurationchange`,onEmptied:`onemptied`,onEnd:`onend`,onEnded:`onended`,onError:`onerror`,onFocus:`onfocus`,onFocusIn:`onfocusin`,onFocusOut:`onfocusout`,onHashChange:`onhashchange`,onInput:`oninput`,onInvalid:`oninvalid`,onKeyDown:`onkeydown`,onKeyPress:`onkeypress`,onKeyUp:`onkeyup`,onLoad:`onload`,onLoadedData:`onloadeddata`,onLoadedMetadata:`onloadedmetadata`,onLoadStart:`onloadstart`,onMessage:`onmessage`,onMouseDown:`onmousedown`,onMouseEnter:`onmouseenter`,onMouseLeave:`onmouseleave`,onMouseMove:`onmousemove`,onMouseOut:`onmouseout`,onMouseOver:`onmouseover`,onMouseUp:`onmouseup`,onMouseWheel:`onmousewheel`,onOffline:`onoffline`,onOnline:`ononline`,onPageHide:`onpagehide`,onPageShow:`onpageshow`,onPaste:`onpaste`,onPause:`onpause`,onPlay:`onplay`,onPlaying:`onplaying`,onPopState:`onpopstate`,onProgress:`onprogress`,onRateChange:`onratechange`,onRepeat:`onrepeat`,onReset:`onreset`,onResize:`onresize`,onScroll:`onscroll`,onSeeked:`onseeked`,onSeeking:`onseeking`,onSelect:`onselect`,onShow:`onshow`,onStalled:`onstalled`,onStorage:`onstorage`,onSubmit:`onsubmit`,onSuspend:`onsuspend`,onTimeUpdate:`ontimeupdate`,onToggle:`ontoggle`,onUnload:`onunload`,onVolumeChange:`onvolumechange`,onWaiting:`onwaiting`,onZoom:`onzoom`,overlinePosition:`overline-position`,overlineThickness:`overline-thickness`,paintOrder:`paint-order`,panose1:`panose-1`,pointerEvents:`pointer-events`,referrerPolicy:`referrerpolicy`,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`,tabIndex:`tabindex`,textAnchor:`text-anchor`,textDecoration:`text-decoration`,textRendering:`text-rendering`,transformOrigin:`transform-origin`,typeOf:`typeof`,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`,xHeight:`x-height`,playbackOrder:`playbackorder`,timelineBegin:`timelinebegin`},properties:{about:PK,accentHeight:Z,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Z,amplitude:Z,arabicForm:null,ascent:Z,attributeName:null,attributeType:null,azimuth:Z,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Z,by:null,calcMode:null,capHeight:Z,className:MK,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Z,diffuseConstant:Z,direction:null,display:null,dur:null,divisor:Z,dominantBaseline:null,download:kK,dx:null,dy:null,edgeMode:null,editable:null,elevation:Z,enableBackground:null,end:null,event:null,exponent:Z,externalResourcesRequired:null,fill:null,fillOpacity:Z,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:NK,g2:NK,glyphName:NK,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Z,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Z,horizOriginX:Z,horizOriginY:Z,id:null,ideographic:Z,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Z,k:Z,k1:Z,k2:Z,k3:Z,k4:Z,kernelMatrix:PK,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Z,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Z,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Z,overlineThickness:Z,paintOrder:null,panose1:null,path:null,pathLength:Z,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:MK,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Z,pointsAtY:Z,pointsAtZ:Z,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:PK,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:PK,rev:PK,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:PK,requiredFeatures:PK,requiredFonts:PK,requiredFormats:PK,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Z,specularExponent:Z,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Z,strikethroughThickness:Z,string:null,stroke:null,strokeDashArray:PK,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Z,strokeOpacity:Z,strokeWidth:null,style:null,surfaceScale:Z,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:PK,tabIndex:Z,tableValues:null,target:null,targetX:Z,targetY:Z,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:PK,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Z,underlineThickness:Z,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Z,values:null,vAlphabetic:Z,vMathematical:Z,vectorEffect:null,vHanging:Z,vIdeographic:Z,version:null,vertAdvY:Z,vertOriginX:Z,vertOriginY:Z,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Z,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:VK}),GK=zK({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:`xlink`,transform(e,t){return`xlink:`+t.slice(5).toLowerCase()}}),KK=zK({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:HK}),qK=zK({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),JK={classId:`classID`,dataType:`datatype`,itemId:`itemID`,strokeDashArray:`strokeDasharray`,strokeDashOffset:`strokeDashoffset`,strokeLineCap:`strokeLinecap`,strokeLineJoin:`strokeLinejoin`,strokeMiterLimit:`strokeMiterlimit`,typeOf:`typeof`,xLinkActuate:`xlinkActuate`,xLinkArcRole:`xlinkArcrole`,xLinkHref:`xlinkHref`,xLinkRole:`xlinkRole`,xLinkShow:`xlinkShow`,xLinkTitle:`xlinkTitle`,xLinkType:`xlinkType`,xmlnsXLink:`xmlnsXlink`},YK=/[A-Z]/g,XK=/-[a-z]/g,ZK=/^data[-\w.:]+$/i;function QK(e,t){let n=TK(t),r=t,i=EK;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&ZK.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(XK,eq);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!XK.test(e)){let n=e.replace(YK,$K);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=LK}return new i(r,t)}function $K(e){return`-`+e.toLowerCase()}function eq(e){return e.charAt(1).toUpperCase()}var tq=wK([BK,UK,GK,KK,qK],`html`),nq=wK([BK,WK,GK,KK,qK],`svg`);function rq(e){return e.join(` `).trim()}var iq=n(((e,t)=>{var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,l=/^\s+|\s+$/g,u=`
139
+ `,d=`/`,f=`*`,p=``,m=`comment`,h=`declaration`;function g(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var l=1,g=1;function v(e){var t=e.match(r);t&&(l+=t.length);var n=e.lastIndexOf(u);g=~n?e.length-n:g+e.length}function y(){var e={line:l,column:g};return function(t){return t.position=new b(e),C(),t}}function b(e){this.start=e,this.end={line:l,column:g},this.source=t.source}b.prototype.content=e;function x(n){var r=Error(t.source+`:`+l+`:`+g+`: `+n);if(r.reason=n,r.filename=t.source,r.line=l,r.column=g,r.source=e,!t.silent)throw r}function S(t){var n=t.exec(e);if(n){var r=n[0];return v(r),e=e.slice(r.length),n}}function C(){S(i)}function w(e){var t;for(e||=[];t=T();)t!==!1&&e.push(t);return e}function T(){var t=y();if(!(d!=e.charAt(0)||f!=e.charAt(1))){for(var n=2;p!=e.charAt(n)&&(f!=e.charAt(n)||d!=e.charAt(n+1));)++n;if(n+=2,p===e.charAt(n-1))return x(`End of comment missing`);var r=e.slice(2,n-2);return g+=2,v(r),e=e.slice(n),g+=2,t({type:m,comment:r})}}function E(){var e=y(),t=S(a);if(t){if(T(),!S(o))return x(`property missing ':'`);var r=S(s),i=e({type:h,property:_(t[0].replace(n,p)),value:r?_(r[0].replace(n,p)):p});return S(c),i}}function D(){var e=[];w(e);for(var t;t=E();)t!==!1&&(e.push(t),w(e));return e}return C(),D()}function _(e){return e?e.replace(l,p):p}t.exports=g})),aq=n((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,`__esModule`,{value:!0}),e.default=r;var n=t(iq());function r(e,t){let r=null;if(!e||typeof e!=`string`)return r;let i=(0,n.default)(e),a=typeof t==`function`;return i.forEach(e=>{if(e.type!==`declaration`)return;let{property:n,value:i}=e;a?t(n,i,e):i&&(r||={},r[n]=i)}),r}})),oq=n((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,r=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,o=function(e){return!e||r.test(e)||t.test(e)},s=function(e,t){return t.toUpperCase()},c=function(e,t){return`${t}-`};e.camelCase=function(e,t){return t===void 0&&(t={}),o(e)?e:(e=e.toLowerCase(),e=t.reactCompat?e.replace(a,c):e.replace(i,c),e.replace(n,s))}})),sq=n(((e,t)=>{var n=(e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(aq()),r=oq();function i(e,t){var i={};return!e||typeof e!=`string`||(0,n.default)(e,function(e,n){e&&n&&(i[(0,r.camelCase)(e,t)]=n)}),i}i.default=i,t.exports=i})),cq=uq(`end`),lq=uq(`start`);function uq(e){return t;function t(t){let n=t&&t.position&&t.position[e]||{};if(typeof n.line==`number`&&n.line>0&&typeof n.column==`number`&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset==`number`&&n.offset>-1?n.offset:void 0}}}function dq(e){let t=lq(e),n=cq(e);if(t&&n)return{start:t,end:n}}var fq=t(sq(),1),pq={}.hasOwnProperty,mq=new Map,hq=/[A-Z]/g,gq=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),_q=new Set([`td`,`th`]),vq=`https://github.com/syntax-tree/hast-util-to-jsx-runtime`;function yq(e,t){if(!t||t.Fragment===void 0)throw TypeError("Expected `Fragment` in options");let n=t.filePath||void 0,r;if(t.development){if(typeof t.jsxDEV!=`function`)throw TypeError("Expected `jsxDEV` in options when `development: true`");r=Aq(n,t.jsxDEV)}else{if(typeof t.jsx!=`function`)throw TypeError("Expected `jsx` in production options");if(typeof t.jsxs!=`function`)throw TypeError("Expected `jsxs` in production options");r=kq(n,t.jsx,t.jsxs)}let i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||`react`,evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space===`svg`?nq:tq,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=bq(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function bq(e,t,n){if(t.type===`element`)return xq(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return Sq(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return wq(e,t,n);if(t.type===`mdxjsEsm`)return Cq(e,t);if(t.type===`root`)return Tq(e,t,n);if(t.type===`text`)return Eq(e,t)}function xq(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=nq,e.schema=i),e.ancestors.push(t);let a=Iq(e,t.tagName,!1),o=jq(e,t),s=Nq(e,t);return gq.has(t.tagName)&&(s=s.filter(function(e){return typeof e==`string`?!xK(e):!0})),Dq(e,o,a,t),Oq(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function Sq(e,t){if(t.data&&t.data.estree&&e.evaluater){let n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}Lq(e,t.position)}function Cq(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Lq(e,t.position)}function wq(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=nq,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:Iq(e,t.name,!0),o=Mq(e,t),s=Nq(e,t);return Dq(e,o,a,t),Oq(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function Tq(e,t,n){let r={};return Oq(r,Nq(e,t)),e.create(t,e.Fragment,r,n)}function Eq(e,t){return t.value}function Dq(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Oq(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function kq(e,t,n){return r;function r(e,r,i,a){let o=Array.isArray(i.children)?n:t;return a?o(r,i,a):o(r,i)}}function Aq(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=lq(n);return t(r,i,a,o,{columnNumber:s?s.column-1:void 0,fileName:e,lineNumber:s?s.line:void 0},void 0)}}function jq(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&pq.call(t.properties,i)){let a=Pq(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&_q.has(t.tagName)?r=o:n[i]=o}}if(r){let t=n.style||={};t[e.stylePropertyNameCase===`css`?`text-align`:`textAlign`]=r}return n}function Mq(e,t){let n={};for(let r of t.attributes)if(r.type===`mdxJsxExpressionAttribute`)if(r.data&&r.data.estree&&e.evaluater){let t=r.data.estree.body[0];t.type;let i=t.expression;i.type;let a=i.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else Lq(e,t.position);else{let i=r.name,a;if(r.value&&typeof r.value==`object`)if(r.value.data&&r.value.data.estree&&e.evaluater){let t=r.value.data.estree.body[0];t.type,a=e.evaluater.evaluateExpression(t.expression)}else Lq(e,t.position);else a=r.value===null?!0:r.value;n[i]=a}return n}function Nq(e,t){let n=[],r=-1,i=e.passKeys?new Map:mq;for(;++r<t.children.length;){let a=t.children[r],o;if(e.passKeys){let e=a.type===`element`?a.tagName:a.type===`mdxJsxFlowElement`||a.type===`mdxJsxTextElement`?a.name:void 0;if(e){let t=i.get(e)||0;o=e+`-`+t,i.set(e,t+1)}}let s=bq(e,a,o);s!==void 0&&n.push(s)}return n}function Pq(e,t,n){let r=QK(e.schema,t);if(!(n==null||typeof n==`number`&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?yK(n):rq(n)),r.property===`style`){let t=typeof n==`object`?n:Fq(e,String(n));return e.stylePropertyNameCase===`css`&&(t=Rq(t)),[`style`,t]}return[e.elementAttributeNameCase===`react`&&r.space?JK[r.property]||r.property:r.attribute,n]}}function Fq(e,t){try{return(0,fq.default)(t,{reactCompat:!0})}catch(t){if(e.ignoreInvalidStyle)return{};let n=t,r=new _y("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:n,ruleId:`style`,source:`hast-util-to-jsx-runtime`});throw r.file=e.filePath||void 0,r.url=vq+`#cannot-parse-style-attribute`,r}}function Iq(e,t,n){let r;if(!n)r={type:`Literal`,value:t};else if(t.includes(`.`)){let e=t.split(`.`),n=-1,i;for(;++n<e.length;){let t=Db(e[n])?{type:`Identifier`,name:e[n]}:{type:`Literal`,value:e[n]};i=i?{type:`MemberExpression`,object:i,property:t,computed:!!(n&&t.type===`Literal`),optional:!1}:t}r=i}else r=Db(t)&&!/^[a-z]/.test(t)?{type:`Identifier`,name:t}:{type:`Literal`,value:t};if(r.type===`Literal`){let t=r.value;return pq.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);Lq(e)}function Lq(e,t){let n=new _y("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:`mdx-estree`,source:`hast-util-to-jsx-runtime`});throw n.file=e.filePath||void 0,n.url=vq+`#cannot-handle-mdx-estrees-without-createevaluater`,n}function Rq(e){let t={},n;for(n in e)pq.call(e,n)&&(t[zq(n)]=e[n]);return t}function zq(e){let t=e.replace(hq,Bq);return t.slice(0,3)===`ms-`&&(t=`-`+t),t}function Bq(e){return`-`+e.toLowerCase()}var Vq={action:[`form`],cite:[`blockquote`,`del`,`ins`,`q`],data:[`object`],formAction:[`button`,`input`],href:[`a`,`area`,`base`,`link`],icon:[`menuitem`],itemId:null,manifest:[`html`],ping:[`a`,`area`],poster:[`video`],src:[`audio`,`embed`,`iframe`,`img`,`input`,`script`,`source`,`track`,`video`]};function Hq(e){let t=this;t.parser=n;function n(n){return gw(n,{...t.data(`settings`),...e,extensions:t.data(`micromarkExtensions`)||[],mdastExtensions:t.data(`fromMarkdownExtensions`)||[]})}}function Uq(e,t){let n={type:`element`,tagName:`blockquote`,properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function Wq(e,t){let n={type:`element`,tagName:`br`,properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:`text`,value:`
140
+ `}]}function Gq(e,t){let n=t.value?t.value+`
141
+ `:``,r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=[`language-`+i[0]]);let a={type:`element`,tagName:`code`,properties:r,children:[{type:`text`,value:n}]};return t.meta&&(a.data={meta:t.meta}),e.patch(t,a),a=e.applyData(t,a),a={type:`element`,tagName:`pre`,properties:{},children:[a]},e.patch(t,a),a}function Kq(e,t){let n={type:`element`,tagName:`del`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function qq(e,t){let n={type:`element`,tagName:`em`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Jq(e,t){let n=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,r=String(t.identifier).toUpperCase(),i=iS(r.toLowerCase()),a=e.footnoteOrder.indexOf(r),o,s=e.footnoteCounts.get(r);s===void 0?(s=0,e.footnoteOrder.push(r),o=e.footnoteOrder.length):o=a+1,s+=1,e.footnoteCounts.set(r,s);let c={type:`element`,tagName:`a`,properties:{href:`#`+n+`fn-`+i,id:n+`fnref-`+i+(s>1?`-`+s:``),dataFootnoteRef:!0,ariaDescribedBy:[`footnote-label`]},children:[{type:`text`,value:String(o)}]};e.patch(t,c);let l={type:`element`,tagName:`sup`,properties:{},children:[c]};return e.patch(t,l),e.applyData(t,l)}function Yq(e,t){let n={type:`element`,tagName:`h`+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Xq(e,t){if(e.options.allowDangerousHtml){let n={type:`raw`,value:t.value};return e.patch(t,n),e.applyData(t,n)}}function Zq(e,t){let n=t.referenceType,r=`]`;if(n===`collapsed`?r+=`[]`:n===`full`&&(r+=`[`+(t.label||t.identifier)+`]`),t.type===`imageReference`)return[{type:`text`,value:`![`+t.alt+r}];let i=e.all(t),a=i[0];a&&a.type===`text`?a.value=`[`+a.value:i.unshift({type:`text`,value:`[`});let o=i[i.length-1];return o&&o.type===`text`?o.value+=r:i.push({type:`text`,value:r}),i}function Qq(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Zq(e,t);let i={src:iS(r.url||``),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`img`,properties:i,children:[]};return e.patch(t,a),e.applyData(t,a)}function $q(e,t){let n={src:iS(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`img`,properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function eJ(e,t){let n={type:`text`,value:t.value.replace(/\r?\n|\r/g,` `)};e.patch(t,n);let r={type:`element`,tagName:`code`,properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function tJ(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Zq(e,t);let i={href:iS(r.url||``)};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`a`,properties:i,children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function nJ(e,t){let n={href:iS(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`a`,properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function rJ(e,t,n){let r=e.all(t),i=n?iJ(n):aJ(t),a={},o=[];if(typeof t.checked==`boolean`){let e=r[0],n;e&&e.type===`element`&&e.tagName===`p`?n=e:(n={type:`element`,tagName:`p`,properties:{},children:[]},r.unshift(n)),n.children.length>0&&n.children.unshift({type:`text`,value:` `}),n.children.unshift({type:`element`,tagName:`input`,properties:{type:`checkbox`,checked:t.checked,disabled:!0},children:[]}),a.className=[`task-list-item`]}let s=-1;for(;++s<r.length;){let e=r[s];(i||s!==0||e.type!==`element`||e.tagName!==`p`)&&o.push({type:`text`,value:`
142
+ `}),e.type===`element`&&e.tagName===`p`&&!i?o.push(...e.children):o.push(e)}let c=r[r.length-1];c&&(i||c.type!==`element`||c.tagName!==`p`)&&o.push({type:`text`,value:`
143
+ `});let l={type:`element`,tagName:`li`,properties:a,children:o};return e.patch(t,l),e.applyData(t,l)}function iJ(e){let t=!1;if(e.type===`list`){t=e.spread||!1;let n=e.children,r=-1;for(;!t&&++r<n.length;)t=aJ(n[r])}return t}function aJ(e){return e.spread??e.children.length>1}function oJ(e,t){let n={},r=e.all(t),i=-1;for(typeof t.start==`number`&&t.start!==1&&(n.start=t.start);++i<r.length;){let e=r[i];if(e.type===`element`&&e.tagName===`li`&&e.properties&&Array.isArray(e.properties.className)&&e.properties.className.includes(`task-list-item`)){n.className=[`contains-task-list`];break}}let a={type:`element`,tagName:t.ordered?`ol`:`ul`,properties:n,children:e.wrap(r,!0)};return e.patch(t,a),e.applyData(t,a)}function sJ(e,t){let n={type:`element`,tagName:`p`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function cJ(e,t){let n={type:`root`,children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function lJ(e,t){let n={type:`element`,tagName:`strong`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function uJ(e,t){let n=e.all(t),r=n.shift(),i=[];if(r){let n={type:`element`,tagName:`thead`,properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],n),i.push(n)}if(n.length>0){let r={type:`element`,tagName:`tbody`,properties:{},children:e.wrap(n,!0)},a=lq(t.children[1]),o=cq(t.children[t.children.length-1]);a&&o&&(r.position={start:a,end:o}),i.push(r)}let a={type:`element`,tagName:`table`,properties:{},children:e.wrap(i,!0)};return e.patch(t,a),e.applyData(t,a)}function dJ(e,t,n){let r=n?n.children:void 0,i=(r?r.indexOf(t):1)===0?`th`:`td`,a=n&&n.type===`table`?n.align:void 0,o=a?a.length:t.children.length,s=-1,c=[];for(;++s<o;){let n=t.children[s],r={},o=a?a[s]:void 0;o&&(r.align=o);let l={type:`element`,tagName:i,properties:r,children:[]};n&&(l.children=e.all(n),e.patch(n,l),l=e.applyData(n,l)),c.push(l)}let l={type:`element`,tagName:`tr`,properties:{},children:e.wrap(c,!0)};return e.patch(t,l),e.applyData(t,l)}function fJ(e,t){let n={type:`element`,tagName:`td`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}var pJ=9,mJ=32;function hJ(e){let t=String(e),n=/\r?\n|\r/g,r=n.exec(t),i=0,a=[];for(;r;)a.push(gJ(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return a.push(gJ(t.slice(i),i>0,!1)),a.join(``)}function gJ(e,t,n){let r=0,i=e.length;if(t){let t=e.codePointAt(r);for(;t===pJ||t===mJ;)r++,t=e.codePointAt(r)}if(n){let t=e.codePointAt(i-1);for(;t===pJ||t===mJ;)i--,t=e.codePointAt(i-1)}return i>r?e.slice(r,i):``}function _J(e,t){let n={type:`text`,value:hJ(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function vJ(e,t){let n={type:`element`,tagName:`hr`,properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}var yJ={blockquote:Uq,break:Wq,code:Gq,delete:Kq,emphasis:qq,footnoteReference:Jq,heading:Yq,html:Xq,imageReference:Qq,image:$q,inlineCode:eJ,linkReference:tJ,link:nJ,listItem:rJ,list:oJ,paragraph:sJ,root:cJ,strong:lJ,table:uJ,tableCell:fJ,tableRow:dJ,text:_J,thematicBreak:vJ,toml:bJ,yaml:bJ,definition:bJ,footnoteDefinition:bJ};function bJ(){}var xJ=typeof self==`object`?self:globalThis,SJ=(e,t)=>{let n=(t,n)=>(e.set(n,t),t),r=i=>{if(e.has(i))return e.get(i);let[a,o]=t[i];switch(a){case 0:case-1:return n(o,i);case 1:{let e=n([],i);for(let t of o)e.push(r(t));return e}case 2:{let e=n({},i);for(let[t,n]of o)e[r(t)]=r(n);return e}case 3:return n(new Date(o),i);case 4:{let{source:e,flags:t}=o;return n(new RegExp(e,t),i)}case 5:{let e=n(new Map,i);for(let[t,n]of o)e.set(r(t),r(n));return e}case 6:{let e=n(new Set,i);for(let t of o)e.add(r(t));return e}case 7:{let{name:e,message:t}=o;return n(new xJ[e](t),i)}case 8:return n(BigInt(o),i);case`BigInt`:return n(Object(BigInt(o)),i);case`ArrayBuffer`:return n(new Uint8Array(o).buffer,o);case`DataView`:{let{buffer:e}=new Uint8Array(o);return n(new DataView(e),o)}}return n(new xJ[a](o),i)};return r},CJ=e=>SJ(new Map,e)(0),wJ=``,{toString:TJ}={},{keys:EJ}=Object,DJ=e=>{let t=typeof e;if(t!==`object`||!e)return[0,t];let n=TJ.call(e).slice(8,-1);switch(n){case`Array`:return[1,wJ];case`Object`:return[2,wJ];case`Date`:return[3,wJ];case`RegExp`:return[4,wJ];case`Map`:return[5,wJ];case`Set`:return[6,wJ];case`DataView`:return[1,n]}return n.includes(`Array`)?[1,n]:n.includes(`Error`)?[7,n]:[2,n]},OJ=([e,t])=>e===0&&(t===`function`||t===`symbol`),kJ=(e,t,n,r)=>{let i=(e,t)=>{let i=r.push(e)-1;return n.set(t,i),i},a=r=>{if(n.has(r))return n.get(r);let[o,s]=DJ(r);switch(o){case 0:{let t=r;switch(s){case`bigint`:o=8,t=r.toString();break;case`function`:case`symbol`:if(e)throw TypeError(`unable to serialize `+s);t=null;break;case`undefined`:return i([-1],r)}return i([o,t],r)}case 1:{if(s){let e=r;return s===`DataView`?e=new Uint8Array(r.buffer):s===`ArrayBuffer`&&(e=new Uint8Array(r)),i([s,[...e]],r)}let e=[],t=i([o,e],r);for(let t of r)e.push(a(t));return t}case 2:{if(s)switch(s){case`BigInt`:return i([s,r.toString()],r);case`Boolean`:case`Number`:case`String`:return i([s,r.valueOf()],r)}if(t&&`toJSON`in r)return a(r.toJSON());let n=[],c=i([o,n],r);for(let t of EJ(r))(e||!OJ(DJ(r[t])))&&n.push([a(t),a(r[t])]);return c}case 3:return i([o,r.toISOString()],r);case 4:{let{source:e,flags:t}=r;return i([o,{source:e,flags:t}],r)}case 5:{let t=[],n=i([o,t],r);for(let[n,i]of r)(e||!(OJ(DJ(n))||OJ(DJ(i))))&&t.push([a(n),a(i)]);return n}case 6:{let t=[],n=i([o,t],r);for(let n of r)(e||!OJ(DJ(n)))&&t.push(a(n));return n}}let{message:c}=r;return i([o,{name:s,message:c}],r)};return a},AJ=(e,{json:t,lossy:n}={})=>{let r=[];return kJ(!(t||n),!!t,new Map,r)(e),r},jJ=typeof structuredClone==`function`?(e,t)=>t&&(`json`in t||`lossy`in t)?CJ(AJ(e,t)):structuredClone(e):(e,t)=>CJ(AJ(e,t));function MJ(e,t){let n=[{type:`text`,value:`↩`}];return t>1&&n.push({type:`element`,tagName:`sup`,properties:{},children:[{type:`text`,value:String(t)}]}),n}function NJ(e,t){return`Back to reference `+(e+1)+(t>1?`-`+t:``)}function PJ(e){let t=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,n=e.options.footnoteBackContent||MJ,r=e.options.footnoteBackLabel||NJ,i=e.options.footnoteLabel||`Footnotes`,a=e.options.footnoteLabelTagName||`h2`,o=e.options.footnoteLabelProperties||{className:[`sr-only`]},s=[],c=-1;for(;++c<e.footnoteOrder.length;){let i=e.footnoteById.get(e.footnoteOrder[c]);if(!i)continue;let a=e.all(i),o=String(i.identifier).toUpperCase(),l=iS(o.toLowerCase()),u=0,d=[],f=e.footnoteCounts.get(o);for(;f!==void 0&&++u<=f;){d.length>0&&d.push({type:`text`,value:` `});let e=typeof n==`string`?n:n(c,u);typeof e==`string`&&(e={type:`text`,value:e}),d.push({type:`element`,tagName:`a`,properties:{href:`#`+t+`fnref-`+l+(u>1?`-`+u:``),dataFootnoteBackref:``,ariaLabel:typeof r==`string`?r:r(c,u),className:[`data-footnote-backref`]},children:Array.isArray(e)?e:[e]})}let p=a[a.length-1];if(p&&p.type===`element`&&p.tagName===`p`){let e=p.children[p.children.length-1];e&&e.type===`text`?e.value+=` `:p.children.push({type:`text`,value:` `}),p.children.push(...d)}else a.push(...d);let m={type:`element`,tagName:`li`,properties:{id:t+`fn-`+l},children:e.wrap(a,!0)};e.patch(i,m),s.push(m)}if(s.length!==0)return{type:`element`,tagName:`section`,properties:{dataFootnotes:!0,className:[`footnotes`]},children:[{type:`element`,tagName:a,properties:{...jJ(o),id:`footnote-label`},children:[{type:`text`,value:i}]},{type:`text`,value:`
144
+ `},{type:`element`,tagName:`ol`,properties:{},children:e.wrap(s,!0)},{type:`text`,value:`
145
+ `}]}}var FJ={}.hasOwnProperty,IJ={};function LJ(e,t){let n=t||IJ,r=new Map,i=new Map,a={all:s,applyData:zJ,definitionById:r,footnoteById:i,footnoteCounts:new Map,footnoteOrder:[],handlers:{...yJ,...n.handlers},one:o,options:n,patch:RJ,wrap:VJ};return Ex(e,function(e){if(e.type===`definition`||e.type===`footnoteDefinition`){let t=e.type===`definition`?r:i,n=String(e.identifier).toUpperCase();t.has(n)||t.set(n,e)}}),a;function o(e,t){let n=e.type,r=a.handlers[n];if(FJ.call(a.handlers,n)&&r)return r(a,e,t);if(a.options.passThrough&&a.options.passThrough.includes(n)){if(`children`in e){let{children:t,...n}=e,r=jJ(n);return r.children=a.all(e),r}return jJ(e)}return(a.options.unknownHandler||BJ)(a,e,t)}function s(e){let t=[];if(`children`in e){let n=e.children,r=-1;for(;++r<n.length;){let i=a.one(n[r],e);if(i){if(r&&n[r-1].type===`break`&&(!Array.isArray(i)&&i.type===`text`&&(i.value=HJ(i.value)),!Array.isArray(i)&&i.type===`element`)){let e=i.children[0];e&&e.type===`text`&&(e.value=HJ(e.value))}Array.isArray(i)?t.push(...i):t.push(i)}}}return t}}function RJ(e,t){e.position&&(t.position=dq(e))}function zJ(e,t){let n=t;if(e&&e.data){let t=e.data.hName,r=e.data.hChildren,i=e.data.hProperties;typeof t==`string`&&(n.type===`element`?n.tagName=t:n={type:`element`,tagName:t,properties:{},children:`children`in n?n.children:[n]}),n.type===`element`&&i&&Object.assign(n.properties,jJ(i)),`children`in n&&n.children&&r!=null&&(n.children=r)}return n}function BJ(e,t){let n=t.data||{},r=`value`in t&&!(FJ.call(n,`hProperties`)||FJ.call(n,`hChildren`))?{type:`text`,value:t.value}:{type:`element`,tagName:`div`,properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function VJ(e,t){let n=[],r=-1;for(t&&n.push({type:`text`,value:`
146
+ `});++r<e.length;)r&&n.push({type:`text`,value:`
147
+ `}),n.push(e[r]);return t&&e.length>0&&n.push({type:`text`,value:`
148
+ `}),n}function HJ(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function UJ(e,t){let n=LJ(e,t),r=n.one(e,void 0),i=PJ(n),a=Array.isArray(r)?{type:`root`,children:r}:r||{type:`root`,children:[]};return i&&(`children`in a,a.children.push({type:`text`,value:`
149
+ `},i)),a}function WJ(e,t){return e&&`run`in e?async function(n,r){let i=UJ(n,{file:r,...t});await e.run(i,r)}:function(n,r){return UJ(n,{file:r,...e||t})}}function GJ(e){if(e)throw e}var KJ=n(((e,t)=>{var n=Object.prototype.hasOwnProperty,r=Object.prototype.toString,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=function(e){return typeof Array.isArray==`function`?Array.isArray(e):r.call(e)===`[object Array]`},s=function(e){if(!e||r.call(e)!==`[object Object]`)return!1;var t=n.call(e,`constructor`),i=e.constructor&&e.constructor.prototype&&n.call(e.constructor.prototype,`isPrototypeOf`);if(e.constructor&&!t&&!i)return!1;for(var a in e);return a===void 0||n.call(e,a)},c=function(e,t){i&&t.name===`__proto__`?i(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},l=function(e,t){if(t===`__proto__`){if(!n.call(e,t))return;if(a)return a(e,t).value}return e[t]};t.exports=function e(){var t,n,r,i,a,u,d=arguments[0],f=1,p=arguments.length,m=!1;for(typeof d==`boolean`&&(m=d,d=arguments[1]||{},f=2),(d==null||typeof d!=`object`&&typeof d!=`function`)&&(d={});f<p;++f)if(t=arguments[f],t!=null)for(n in t)r=l(d,n),i=l(t,n),d!==i&&(m&&i&&(s(i)||(a=o(i)))?(a?(a=!1,u=r&&o(r)?r:[]):u=r&&s(r)?r:{},c(d,{name:n,newValue:e(m,u,i)})):i!==void 0&&c(d,{name:n,newValue:i}));return d}}));function qJ(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function JJ(){let e=[],t={run:n,use:r};return t;function n(...t){let n=-1,r=t.pop();if(typeof r!=`function`)throw TypeError(`Expected function as last argument, not `+r);i(null,...t);function i(a,...o){let s=e[++n],c=-1;if(a){r(a);return}for(;++c<t.length;)(o[c]===null||o[c]===void 0)&&(o[c]=t[c]);t=o,s?YJ(s,i)(...o):r(null,...o)}}function r(n){if(typeof n!=`function`)throw TypeError("Expected `middelware` to be a function, not "+n);return e.push(n),t}}function YJ(e,t){let n;return r;function r(...t){let r=e.length>t.length,o;r&&t.push(i);try{o=e.apply(this,t)}catch(e){let t=e;if(r&&n)throw t;return i(t)}r||(o&&o.then&&typeof o.then==`function`?o.then(a,i):o instanceof Error?i(o):a(o))}function i(e,...r){n||(n=!0,t(e,...r))}function a(e){i(null,e)}}var XJ={basename:ZJ,dirname:QJ,extname:$J,join:eY,sep:`/`};function ZJ(e,t){if(t!==void 0&&typeof t!=`string`)throw TypeError(`"ext" argument must be a string`);rY(e);let n=0,r=-1,i=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else r<0&&(a=!0,r=i+1);return r<0?``:e.slice(n,r)}if(t===e)return``;let o=-1,s=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else o<0&&(a=!0,o=i+1),s>-1&&(e.codePointAt(i)===t.codePointAt(s--)?s<0&&(r=i):(s=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function QJ(e){if(rY(e),e.length===0)return`.`;let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||=!0;return t<0?e.codePointAt(0)===47?`/`:`.`:t===1&&e.codePointAt(0)===47?`//`:e.slice(0,t)}function $J(e){rY(e);let t=e.length,n=-1,r=0,i=-1,a=0,o;for(;t--;){let s=e.codePointAt(t);if(s===47){if(o){r=t+1;break}continue}n<0&&(o=!0,n=t+1),s===46?i<0?i=t:a!==1&&(a=1):i>-1&&(a=-1)}return i<0||n<0||a===0||a===1&&i===n-1&&i===r+1?``:e.slice(i,n)}function eY(...e){let t=-1,n;for(;++t<e.length;)rY(e[t]),e[t]&&(n=n===void 0?e[t]:n+`/`+e[t]);return n===void 0?`.`:tY(n)}function tY(e){rY(e);let t=e.codePointAt(0)===47,n=nY(e,!t);return n.length===0&&!t&&(n=`.`),n.length>0&&e.codePointAt(e.length-1)===47&&(n+=`/`),t?`/`+n:n}function nY(e,t){let n=``,r=0,i=-1,a=0,o=-1,s,c;for(;++o<=e.length;){if(o<e.length)s=e.codePointAt(o);else if(s===47)break;else s=47;if(s===47){if(!(i===o-1||a===1))if(i!==o-1&&a===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf(`/`),c!==n.length-1){c<0?(n=``,r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf(`/`)),i=o,a=0;continue}}else if(n.length>0){n=``,r=0,i=o,a=0;continue}}t&&(n=n.length>0?n+`/..`:`..`,r=2)}else n.length>0?n+=`/`+e.slice(i+1,o):n=e.slice(i+1,o),r=o-i-1;i=o,a=0}else s===46&&a>-1?a++:a=-1}return n}function rY(e){if(typeof e!=`string`)throw TypeError(`Path must be a string. Received `+JSON.stringify(e))}var iY={cwd:aY};function aY(){return`/`}function oY(e){return!!(typeof e==`object`&&e&&`href`in e&&e.href&&`protocol`in e&&e.protocol&&e.auth===void 0)}function sY(e){if(typeof e==`string`)e=new URL(e);else if(!oY(e)){let t=TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code=`ERR_INVALID_ARG_TYPE`,t}if(e.protocol!==`file:`){let e=TypeError(`The URL must be of scheme file`);throw e.code=`ERR_INVALID_URL_SCHEME`,e}return cY(e)}function cY(e){if(e.hostname!==``){let e=TypeError(`File URL host must be "localhost" or empty on darwin`);throw e.code=`ERR_INVALID_FILE_URL_HOST`,e}let t=e.pathname,n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){let e=t.codePointAt(n+2);if(e===70||e===102){let e=TypeError(`File URL path must not include encoded / characters`);throw e.code=`ERR_INVALID_FILE_URL_PATH`,e}}return decodeURIComponent(t)}var lY=[`history`,`path`,`basename`,`stem`,`extname`,`dirname`],uY=class{constructor(e){let t;t=e?oY(e)?{path:e}:typeof e==`string`||mY(e)?{value:e}:e:{},this.cwd=`cwd`in t?``:iY.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<lY.length;){let e=lY[n];e in t&&t[e]!==void 0&&t[e]!==null&&(this[e]=e===`history`?[...t[e]]:t[e])}let r;for(r in t)lY.includes(r)||(this[r]=t[r])}get basename(){return typeof this.path==`string`?XJ.basename(this.path):void 0}set basename(e){fY(e,`basename`),dY(e,`basename`),this.path=XJ.join(this.dirname||``,e)}get dirname(){return typeof this.path==`string`?XJ.dirname(this.path):void 0}set dirname(e){pY(this.basename,`dirname`),this.path=XJ.join(e||``,this.basename)}get extname(){return typeof this.path==`string`?XJ.extname(this.path):void 0}set extname(e){if(dY(e,`extname`),pY(this.dirname,`extname`),e){if(e.codePointAt(0)!==46)throw Error("`extname` must start with `.`");if(e.includes(`.`,1))throw Error("`extname` cannot contain multiple dots")}this.path=XJ.join(this.dirname,this.stem+(e||``))}get path(){return this.history[this.history.length-1]}set path(e){oY(e)&&(e=sY(e)),fY(e,`path`),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path==`string`?XJ.basename(this.path,this.extname):void 0}set stem(e){fY(e,`stem`),dY(e,`stem`),this.path=XJ.join(this.dirname||``,e+(this.extname||``))}fail(e,t,n){let r=this.message(e,t,n);throw r.fatal=!0,r}info(e,t,n){let r=this.message(e,t,n);return r.fatal=void 0,r}message(e,t,n){let r=new _y(e,t,n);return this.path&&(r.name=this.path+`:`+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(e){return this.value===void 0?``:typeof this.value==`string`?this.value:new TextDecoder(e||void 0).decode(this.value)}};function dY(e,t){if(e&&e.includes(XJ.sep))throw Error("`"+t+"` cannot be a path: did not expect `"+XJ.sep+"`")}function fY(e,t){if(!e)throw Error("`"+t+"` cannot be empty")}function pY(e,t){if(!e)throw Error("Setting `"+t+"` requires `path` to be set too")}function mY(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var hY=(function(e){let t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r}),gY=t(KJ(),1),_Y={}.hasOwnProperty,vY=new class e extends hY{constructor(){super(`copy`),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=JJ()}copy(){let t=new e,n=-1;for(;++n<this.attachers.length;){let e=this.attachers[n];t.use(...e)}return t.data((0,gY.default)(!0,{},this.namespace)),t}data(e,t){return typeof e==`string`?arguments.length===2?(xY(`data`,this.frozen),this.namespace[e]=t,this):_Y.call(this.namespace,e)&&this.namespace[e]||void 0:e?(xY(`data`,this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;let e=this;for(;++this.freezeIndex<this.attachers.length;){let[t,...n]=this.attachers[this.freezeIndex];if(n[0]===!1)continue;n[0]===!0&&(n[0]=void 0);let r=t.call(e,...n);typeof r==`function`&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=1/0,this}parse(e){this.freeze();let t=wY(e),n=this.parser||this.Parser;return yY(`parse`,n),n(String(t),t)}process(e,t){let n=this;return this.freeze(),yY(`process`,this.parser||this.Parser),bY(`process`,this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,i){let a=wY(e),o=n.parse(a);n.run(o,a,function(e,t,r){if(e||!t||!r)return s(e);let i=t,a=n.stringify(i,r);EY(a)?r.value=a:r.result=a,s(e,r)});function s(e,n){e||!n?i(e):r?r(n):t(void 0,n)}}}processSync(e){let t=!1,n;return this.freeze(),yY(`processSync`,this.parser||this.Parser),bY(`processSync`,this.compiler||this.Compiler),this.process(e,r),CY(`processSync`,`process`,t),n;function r(e,r){t=!0,GJ(e),n=r}}run(e,t,n){SY(e),this.freeze();let r=this.transformers;return!n&&typeof t==`function`&&(n=t,t=void 0),n?i(void 0,n):new Promise(i);function i(i,a){let o=wY(t);r.run(e,o,s);function s(t,r,o){let s=r||e;t?a(t):i?i(s):n(void 0,s,o)}}}runSync(e,t){let n=!1,r;return this.run(e,t,i),CY(`runSync`,`run`,n),r;function i(e,t){GJ(e),r=t,n=!0}}stringify(e,t){this.freeze();let n=wY(t),r=this.compiler||this.Compiler;return bY(`stringify`,r),SY(e),r(e,n)}use(e,...t){let n=this.attachers,r=this.namespace;if(xY(`use`,this.frozen),e!=null)if(typeof e==`function`)s(e,t);else if(typeof e==`object`)Array.isArray(e)?o(e):a(e);else throw TypeError("Expected usable value, not `"+e+"`");return this;function i(e){if(typeof e==`function`)s(e,[]);else if(typeof e==`object`)if(Array.isArray(e)){let[t,...n]=e;s(t,n)}else a(e);else throw TypeError("Expected usable value, not `"+e+"`")}function a(e){if(!(`plugins`in e)&&!(`settings`in e))throw Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");o(e.plugins),e.settings&&(r.settings=(0,gY.default)(!0,r.settings,e.settings))}function o(e){let t=-1;if(e!=null)if(Array.isArray(e))for(;++t<e.length;){let n=e[t];i(n)}else throw TypeError("Expected a list of plugins, not `"+e+"`")}function s(e,t){let r=-1,i=-1;for(;++r<n.length;)if(n[r][0]===e){i=r;break}if(i===-1)n.push([e,...t]);else if(t.length>0){let[r,...a]=t,o=n[i][1];qJ(o)&&qJ(r)&&(r=(0,gY.default)(!0,o,r)),n[i]=[e,r,...a]}}}}().freeze();function yY(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `parser`")}function bY(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `compiler`")}function xY(e,t){if(t)throw Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function SY(e){if(!qJ(e)||typeof e.type!=`string`)throw TypeError("Expected node, got `"+e+"`")}function CY(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function wY(e){return TY(e)?e:new uY(e)}function TY(e){return!!(e&&typeof e==`object`&&`message`in e&&`messages`in e)}function EY(e){return typeof e==`string`||DY(e)}function DY(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var OY=[],kY={allowDangerousHtml:!0},AY=/^(https?|ircs?|mailto|xmpp)$/i,jY=[{from:`astPlugins`,id:`remove-buggy-html-in-markdown-parser`},{from:`allowDangerousHtml`,id:`remove-buggy-html-in-markdown-parser`},{from:`allowNode`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`allowElement`},{from:`allowedTypes`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`allowedElements`},{from:`className`,id:`remove-classname`},{from:`disallowedTypes`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`disallowedElements`},{from:`escapeHtml`,id:`remove-buggy-html-in-markdown-parser`},{from:`includeElementIndex`,id:`#remove-includeelementindex`},{from:`includeNodeIndex`,id:`change-includenodeindex-to-includeelementindex`},{from:`linkTarget`,id:`remove-linktarget`},{from:`plugins`,id:`change-plugins-to-remarkplugins`,to:`remarkPlugins`},{from:`rawSourcePos`,id:`#remove-rawsourcepos`},{from:`renderers`,id:`change-renderers-to-components`,to:`components`},{from:`source`,id:`change-source-to-children`,to:`children`},{from:`sourcePos`,id:`#remove-sourcepos`},{from:`transformImageUri`,id:`#add-urltransform`,to:`urlTransform`},{from:`transformLinkUri`,id:`#add-urltransform`,to:`urlTransform`}];function MY(e){let t=NY(e),n=PY(e);return FY(t.runSync(t.parse(n),n),e)}function NY(e){let t=e.rehypePlugins||OY,n=e.remarkPlugins||OY,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...kY}:kY;return vY().use(Hq).use(n).use(WJ,r).use(t)}function PY(e){let t=e.children||``,n=new uY;return typeof t==`string`?n.value=t:``+t,n}function FY(e,t){let n=t.allowedElements,r=t.allowElement,i=t.components,a=t.disallowedElements,o=t.skipHtml,s=t.unwrapDisallowed,c=t.urlTransform||IY;for(let e of jY)Object.hasOwn(t,e.from)&&``+e.from+(e.to?"use `"+e.to+"` instead":`remove it`)+e.id;return Ex(e,l),yq(e,{Fragment:R.Fragment,components:i,ignoreInvalidStyle:!0,jsx:R.jsx,jsxs:R.jsxs,passKeys:!0,passNode:!0});function l(e,t,i){if(e.type===`raw`&&i&&typeof t==`number`)return o?i.children.splice(t,1):i.children[t]={type:`text`,value:e.value},t;if(e.type===`element`){let t;for(t in Vq)if(Object.hasOwn(Vq,t)&&Object.hasOwn(e.properties,t)){let n=e.properties[t],r=Vq[t];(r===null||r.includes(e.tagName))&&(e.properties[t]=c(String(n||``),t,e))}}if(e.type===`element`){let o=n?!n.includes(e.tagName):a?a.includes(e.tagName):!1;if(!o&&r&&typeof t==`number`&&(o=!r(e,t,i)),o&&i&&typeof t==`number`)return s&&e.children?i.children.splice(t,1,...e.children):i.children.splice(t,1),t}}}function IY(e){let t=e.indexOf(`:`),n=e.indexOf(`?`),r=e.indexOf(`#`),i=e.indexOf(`/`);return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||AY.test(e.slice(0,t))?e:``}function LY(e,t,n){let r=Sx((n||{}).ignore||[]),i=RY(t),a=-1;for(;++a<i.length;)Tx(e,`text`,o);function o(e,t){let n=-1,i;for(;++n<t.length;){let e=t[n],a=i?i.children:void 0;if(r(e,a?a.indexOf(e):void 0,i))return;i=e}if(i)return s(e,t)}function s(e,t){let n=t[t.length-1],r=i[a][0],o=i[a][1],s=0,c=n.children.indexOf(e),l=!1,u=[];r.lastIndex=0;let d=r.exec(e.value);for(;d;){let n=d.index,i={index:d.index,input:d.input,stack:[...t,e]},a=o(...d,i);if(typeof a==`string`&&(a=a.length>0?{type:`text`,value:a}:void 0),a===!1?r.lastIndex=n+1:(s!==n&&u.push({type:`text`,value:e.value.slice(s,n)}),Array.isArray(a)?u.push(...a):a&&u.push(a),s=n+d[0].length,l=!0),!r.global)break;d=r.exec(e.value)}return l?(s<e.value.length&&u.push({type:`text`,value:e.value.slice(s)}),n.children.splice(c,1,...u)):u=[e],c+u.length}}function RY(e){let t=[];if(!Array.isArray(e))throw TypeError(`Expected find and replace tuple or list of tuples`);let n=!e[0]||Array.isArray(e[0])?e:[e],r=-1;for(;++r<n.length;){let e=n[r];t.push([zY(e[0]),BY(e[1])])}return t}function zY(e){return typeof e==`string`?new RegExp(bse(e),`g`):e}function BY(e){return typeof e==`function`?e:function(){return e}}var VY=`phrasing`,HY=[`autolink`,`link`,`image`,`label`];function UY(){return{transforms:[ZY],enter:{literalAutolink:GY,literalAutolinkEmail:KY,literalAutolinkHttp:KY,literalAutolinkWww:KY},exit:{literalAutolink:XY,literalAutolinkEmail:YY,literalAutolinkHttp:qY,literalAutolinkWww:JY}}}function WY(){return{unsafe:[{character:`@`,before:`[+\\-.\\w]`,after:`[\\-.\\w]`,inConstruct:VY,notInConstruct:HY},{character:`.`,before:`[Ww]`,after:`[\\-.\\w]`,inConstruct:VY,notInConstruct:HY},{character:`:`,before:`[ps]`,after:`\\/`,inConstruct:VY,notInConstruct:HY}]}}function GY(e){this.enter({type:`link`,title:null,url:``,children:[]},e)}function KY(e){this.config.enter.autolinkProtocol.call(this,e)}function qY(e){this.config.exit.autolinkProtocol.call(this,e)}function JY(e){this.config.exit.data.call(this,e);let t=this.stack[this.stack.length-1];t.type,t.url=`http://`+this.sliceSerialize(e)}function YY(e){this.config.exit.autolinkEmail.call(this,e)}function XY(e){this.exit(e)}function ZY(e){LY(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,QY],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,$Y]],{ignore:[`link`,`linkReference`]})}function QY(e,t,n,r,i){let a=``;if(!nX(i)||(/^w/i.test(t)&&(n=t+n,t=``,a=`http://`),!eX(n)))return!1;let o=tX(n+r);if(!o[0])return!1;let s={type:`link`,title:null,url:a+t+o[0],children:[{type:`text`,value:t+o[0]}]};return o[1]?[s,{type:`text`,value:o[1]}]:s}function $Y(e,t,n,r){return!nX(r,!0)||/[-\d_]$/.test(n)?!1:{type:`link`,title:null,url:`mailto:`+t+`@`+n,children:[{type:`text`,value:t+`@`+n}]}}function eX(e){let t=e.split(`.`);return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function tX(e){let t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(`)`),i=qv(e,`(`),a=qv(e,`)`);for(;r!==-1&&i>a;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(`)`),a++;return[e,n]}function nX(e,t){let n=e.input.charCodeAt(e.index-1);return(e.index===0||Rv(n)||Lv(n))&&(!t||n!==47)}fX.peek=dX;function rX(){this.buffer()}function iX(e){this.enter({type:`footnoteReference`,identifier:``,label:``},e)}function aX(){this.buffer()}function oX(e){this.enter({type:`footnoteDefinition`,identifier:``,label:``,children:[]},e)}function sX(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=rS(this.sliceSerialize(e)).toLowerCase(),n.label=t}function cX(e){this.exit(e)}function lX(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=rS(this.sliceSerialize(e)).toLowerCase(),n.label=t}function uX(e){this.exit(e)}function dX(){return`[`}function fX(e,t,n,r){let i=n.createTracker(r),a=i.move(`[^`),o=n.enter(`footnoteReference`),s=n.enter(`reference`);return a+=i.move(n.safe(n.associationId(e),{after:`]`,before:a})),s(),o(),a+=i.move(`]`),a}function pX(){return{enter:{gfmFootnoteCallString:rX,gfmFootnoteCall:iX,gfmFootnoteDefinitionLabelString:aX,gfmFootnoteDefinition:oX},exit:{gfmFootnoteCallString:sX,gfmFootnoteCall:cX,gfmFootnoteDefinitionLabelString:lX,gfmFootnoteDefinition:uX}}}function mX(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:fX},unsafe:[{character:`[`,inConstruct:[`label`,`phrasing`,`reference`]}]};function n(e,n,r,i){let a=r.createTracker(i),o=a.move(`[^`),s=r.enter(`footnoteDefinition`),c=r.enter(`label`);return o+=a.move(r.safe(r.associationId(e),{before:o,after:`]`})),c(),o+=a.move(`]:`),e.children&&e.children.length>0&&(a.shift(4),o+=a.move((t?`
150
+ `:` `)+r.indentLines(r.containerFlow(e,a.current()),t?gX:hX))),s(),o}}function hX(e,t,n){return t===0?e:gX(e,t,n)}function gX(e,t,n){return(n?``:` `)+e}function _X(){return[UY(),pX(),Uv(),SD(),gD()]}function vX(e){return{extensions:[WY(),mX(e),Wv(),TD(e),_D()]}}var yX={tokenize:NX,partial:!0},bX={tokenize:PX,partial:!0},xX={tokenize:FX,partial:!0},SX={tokenize:IX,partial:!0},CX={tokenize:LX,partial:!0},wX={name:`wwwAutolink`,tokenize:jX,previous:RX},TX={name:`protocolAutolink`,tokenize:MX,previous:zX},EX={name:`emailAutolink`,tokenize:AX,previous:BX},DX={};function OX(){return{text:DX}}for(var kX=48;kX<123;)DX[kX]=EX,kX++,kX===58?kX=65:kX===91&&(kX=97);DX[43]=EX,DX[45]=EX,DX[46]=EX,DX[95]=EX,DX[72]=[EX,TX],DX[104]=[EX,TX],DX[87]=[EX,wX],DX[119]=[EX,wX];function AX(e,t,n){let r=this,i,a;return o;function o(t){return!VX(t)||!BX.call(r,r.previous)||HX(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkEmail`),s(t))}function s(t){return VX(t)?(e.consume(t),s):t===64?(e.consume(t),c):n(t)}function c(t){return t===46?e.check(CX,u,l)(t):t===45||t===95||jv(t)?(a=!0,e.consume(t),c):u(t)}function l(t){return e.consume(t),i=!0,c}function u(o){return a&&i&&Av(r.previous)?(e.exit(`literalAutolinkEmail`),e.exit(`literalAutolink`),t(o)):n(o)}}function jX(e,t,n){let r=this;return i;function i(t){return t!==87&&t!==119||!RX.call(r,r.previous)||HX(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkWww`),e.check(yX,e.attempt(bX,e.attempt(xX,a),n),n)(t))}function a(n){return e.exit(`literalAutolinkWww`),e.exit(`literalAutolink`),t(n)}}function MX(e,t,n){let r=this,i=``,a=!1;return o;function o(t){return(t===72||t===104)&&zX.call(r,r.previous)&&!HX(r.events)?(e.enter(`literalAutolink`),e.enter(`literalAutolinkHttp`),i+=String.fromCodePoint(t),e.consume(t),s):n(t)}function s(t){if(Av(t)&&i.length<5)return i+=String.fromCodePoint(t),e.consume(t),s;if(t===58){let n=i.toLowerCase();if(n===`http`||n===`https`)return e.consume(t),c}return n(t)}function c(t){return t===47?(e.consume(t),a?l:(a=!0,c)):n(t)}function l(t){return t===null||Mv(t)||Fv(t)||Rv(t)||Lv(t)?n(t):e.attempt(bX,e.attempt(xX,u),n)(t)}function u(n){return e.exit(`literalAutolinkHttp`),e.exit(`literalAutolink`),t(n)}}function NX(e,t,n){let r=0;return i;function i(t){return(t===87||t===119)&&r<3?(r++,e.consume(t),i):t===46&&r===3?(e.consume(t),a):n(t)}function a(e){return e===null?n(e):t(e)}}function PX(e,t,n){let r,i,a;return o;function o(t){return t===46||t===95?e.check(SX,c,s)(t):t===null||Fv(t)||Rv(t)||t!==45&&Lv(t)?c(t):(a=!0,e.consume(t),o)}function s(t){return t===95?r=!0:(i=r,r=void 0),e.consume(t),o}function c(e){return i||r||!a?n(e):t(e)}}function FX(e,t){let n=0,r=0;return i;function i(o){return o===40?(n++,e.consume(o),i):o===41&&r<n?a(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?e.check(SX,t,a)(o):o===null||Fv(o)||Rv(o)?t(o):(e.consume(o),i)}function a(t){return t===41&&r++,e.consume(t),i}}function IX(e,t,n){return r;function r(o){return o===33||o===34||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===63||o===95||o===126?(e.consume(o),r):o===38?(e.consume(o),a):o===93?(e.consume(o),i):o===60||o===null||Fv(o)||Rv(o)?t(o):n(o)}function i(e){return e===null||e===40||e===91||Fv(e)||Rv(e)?t(e):r(e)}function a(e){return Av(e)?o(e):n(e)}function o(t){return t===59?(e.consume(t),r):Av(t)?(e.consume(t),o):n(t)}}function LX(e,t,n){return r;function r(t){return e.consume(t),i}function i(e){return jv(e)?n(e):t(e)}}function RX(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Fv(e)}function zX(e){return!Av(e)}function BX(e){return!(e===47||VX(e))}function VX(e){return e===43||e===45||e===46||e===95||jv(e)}function HX(e){let t=e.length,n=!1;for(;t--;){let r=e[t][1];if((r.type===`labelLink`||r.type===`labelImage`)&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}var UX={tokenize:ZX,partial:!0};function WX(){return{document:{91:{name:`gfmFootnoteDefinition`,tokenize:JX,continuation:{tokenize:YX},exit:XX}},text:{91:{name:`gfmFootnoteCall`,tokenize:qX},93:{name:`gfmPotentialFootnoteCall`,add:`after`,tokenize:GX,resolveTo:KX}}}}function GX(e,t,n){let r=this,i=r.events.length,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),o;for(;i--;){let e=r.events[i][1];if(e.type===`labelImage`){o=e;break}if(e.type===`gfmFootnoteCall`||e.type===`labelLink`||e.type===`label`||e.type===`image`||e.type===`link`)break}return s;function s(i){if(!o||!o._balanced)return n(i);let s=rS(r.sliceSerialize({start:o.end,end:r.now()}));return s.codePointAt(0)!==94||!a.includes(s.slice(1))?n(i):(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(i),e.exit(`gfmFootnoteCallLabelMarker`),t(i))}}function KX(e,t){let n=e.length;for(;n--;)if(e[n][1].type===`labelImage`&&e[n][0]===`enter`){e[n][1];break}e[n+1][1].type=`data`,e[n+3][1].type=`gfmFootnoteCallLabelMarker`;let r={type:`gfmFootnoteCall`,start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:`gfmFootnoteCallMarker`,start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;let a={type:`gfmFootnoteCallString`,start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:`chunkString`,contentType:`string`,start:Object.assign({},a.start),end:Object.assign({},a.end)},s=[e[n+1],e[n+2],[`enter`,r,t],e[n+3],e[n+4],[`enter`,i,t],[`exit`,i,t],[`enter`,a,t],[`enter`,o,t],[`exit`,o,t],[`exit`,a,t],e[e.length-2],e[e.length-1],[`exit`,r,t]];return e.splice(n,e.length-n+1,...s),e}function qX(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a=0,o;return s;function s(t){return e.enter(`gfmFootnoteCall`),e.enter(`gfmFootnoteCallLabelMarker`),e.consume(t),e.exit(`gfmFootnoteCallLabelMarker`),c}function c(t){return t===94?(e.enter(`gfmFootnoteCallMarker`),e.consume(t),e.exit(`gfmFootnoteCallMarker`),e.enter(`gfmFootnoteCallString`),e.enter(`chunkString`).contentType=`string`,l):n(t)}function l(s){if(a>999||s===93&&!o||s===null||s===91||Fv(s))return n(s);if(s===93){e.exit(`chunkString`);let a=e.exit(`gfmFootnoteCallString`);return i.includes(rS(r.sliceSerialize(a)))?(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(s),e.exit(`gfmFootnoteCallLabelMarker`),e.exit(`gfmFootnoteCall`),t):n(s)}return Fv(s)||(o=!0),a++,e.consume(s),s===92?u:l}function u(t){return t===91||t===92||t===93?(e.consume(t),a++,l):l(t)}}function JX(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a,o=0,s;return c;function c(t){return e.enter(`gfmFootnoteDefinition`)._container=!0,e.enter(`gfmFootnoteDefinitionLabel`),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),l}function l(t){return t===94?(e.enter(`gfmFootnoteDefinitionMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionMarker`),e.enter(`gfmFootnoteDefinitionLabelString`),e.enter(`chunkString`).contentType=`string`,u):n(t)}function u(t){if(o>999||t===93&&!s||t===null||t===91||Fv(t))return n(t);if(t===93){e.exit(`chunkString`);let n=e.exit(`gfmFootnoteDefinitionLabelString`);return a=rS(r.sliceSerialize(n)),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),e.exit(`gfmFootnoteDefinitionLabel`),f}return Fv(t)||(s=!0),o++,e.consume(t),t===92?d:u}function d(t){return t===91||t===92||t===93?(e.consume(t),o++,u):u(t)}function f(t){return t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),i.includes(a)||i.push(a),Ob(e,p,`gfmFootnoteDefinitionWhitespace`)):n(t)}function p(e){return t(e)}}function YX(e,t,n){return e.check(mS,t,e.attempt(UX,t,n))}function XX(e){e.exit(`gfmFootnoteDefinition`)}function ZX(e,t,n){let r=this;return Ob(e,i,`gfmFootnoteDefinitionIndent`,5);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`gfmFootnoteDefinitionIndent`&&i[2].sliceSerialize(i[1],!0).length===4?t(e):n(e)}}function QX(e){return nS([OX(),WX(),Hv(e),ED(),hD()])}var $X={};function eZ(e){let t=this,n=e||$X,r=t.data(),i=r.micromarkExtensions||=[],a=r.fromMarkdownExtensions||=[],o=r.toMarkdownExtensions||=[];i.push(QX(n)),a.push(_X()),o.push(vX(n))}var tZ;function nZ(){if(tZ!==void 0)return tZ;let e=bZ();if(!e)return tZ=!1,tZ;try{let t=new URL(e.location.href).searchParams.get(`debugStreaming`);tZ=t===null?e.localStorage.getItem(`pibo.chat.debugStreaming`)===`1`:t!==`0`&&t!==`false`}catch{tZ=!1}return tZ}function rZ(e,t){gZ(e,e=>{e.liveOpenCount+=1,e.lastReadyState=t})}function iZ(e,t){gZ(e,e=>{e.liveErrorCount+=1,e.lastReadyState=t})}function aZ(e,t,n,r){gZ(e,e=>{let i=SZ();e.eventCount+=1,e.eventTypeCounts[t.type]=(e.eventTypeCounts[t.type]??0)+1,e.lastEventAt=i,e.firstEventAt??=i,e.lastReadyState=r;let a=n||t.streamFrameId;if(a){e.lastEventId=a;let t=hZ(a);t===`durable`?e.lastDurableCursor=a:t===`transient`&&(e.lastTransientLiveId=a)}t.type===`TEXT_MESSAGE_CONTENT`&&typeof t.delta==`string`?(e.firstTextDeltaAt??=i,e.textDeltaCount+=1,e.textDeltaBytes+=xZ(t.delta)):t.type===`REASONING_MESSAGE_CONTENT`&&typeof t.delta==`string`&&(e.firstReasoningDeltaAt??=i,e.reasoningDeltaCount+=1,e.reasoningDeltaBytes+=xZ(t.delta))})}function oZ(e,t,n,r){gZ(e,e=>{if(e.firstEnqueueAt??=SZ(),e.enqueueCount+=1,r&&(e.enqueueFlushImmediateCount+=1),e.pendingEventCount=n,t.streamFrameId){let n=hZ(t.streamFrameId);n===`durable`?e.lastDurableCursor=t.streamFrameId:n===`transient`&&(e.lastTransientLiveId=t.streamFrameId)}})}function sZ(e,t,n){gZ(e,e=>{let r=SZ();e.firstFlushAt??=r,e.firstOverlayUpdateAt??=r,e.flushCount+=1,e.flushedEventCount+=t,e.pendingEventCount=0,e.overlayUpdateCount+=1,e.overlayEventCount=n,e.lastFlushAt=r})}function cZ(e,t){gZ(e,e=>{let n=CZ(t);e.liveTraceComputeCount+=1,e.liveTraceComputeDurationMsLast=n,e.liveTraceComputeDurationMsTotal+=n,e.liveTraceComputeDurationMsMax=Math.max(e.liveTraceComputeDurationMsMax??0,n)})}function lZ(e,t){_Z(n=>{let r=CZ(t);n.markdownRenderCount+=1,n.markdownRenderDurationMsLast=r,n.markdownRenderDurationMsTotal+=r,n.markdownRenderDurationMsMax=Math.max(n.markdownRenderDurationMsMax??0,r),e===`plain`?(n.markdownRenderPlainCount+=1,n.markdownRenderPlainDurationMsTotal+=r,n.markdownRenderPlainDurationMsMax=Math.max(n.markdownRenderPlainDurationMsMax??0,r)):e===`gfm-fast`?(n.markdownRenderGfmFastCount+=1,n.markdownRenderGfmFastDurationMsTotal+=r,n.markdownRenderGfmFastDurationMsMax=Math.max(n.markdownRenderGfmFastDurationMsMax??0,r)):(n.markdownRenderFullCount+=1,n.markdownRenderFullDurationMsTotal+=r,n.markdownRenderFullDurationMsMax=Math.max(n.markdownRenderFullDurationMsMax??0,r),e===`gfm`?(n.markdownRenderGfmCount+=1,n.markdownRenderGfmDurationMsTotal+=r,n.markdownRenderGfmDurationMsMax=Math.max(n.markdownRenderGfmDurationMsMax??0,r)):(n.markdownRenderCommonMarkCount+=1,n.markdownRenderCommonMarkDurationMsTotal+=r,n.markdownRenderCommonMarkDurationMsMax=Math.max(n.markdownRenderCommonMarkDurationMsMax??0,r)))})}function uZ(e,t){gZ(e,e=>{e.traceRefreshScheduledCount+=1,e.lastTraceRefreshScheduledAt=SZ(),e.lastTraceRefreshDelayMs=t})}function dZ(e){let t=wZ();return gZ(e,e=>{e.traceRefreshStartedCount+=1}),t}function fZ(e,t,n){gZ(e,e=>{if(n?e.traceRefreshFailedCount+=1:e.traceRefreshCompletedCount+=1,t===void 0)return;let r=Math.max(0,wZ()-t);e.traceRefreshDurationMsLast=Math.round(r),e.traceRefreshDurationMsTotal+=r,e.traceRefreshDurationMsMax=Math.max(e.traceRefreshDurationMsMax??0,r)})}function pZ(e,t){gZ(e,e=>{t.traceBaseUpdated&&(e.traceBaseUpdateCount+=1),e.overlayEventCount=t.overlayEventCount,t.traceBaseOutputLength!==void 0&&(e.traceBaseOutputLength=t.traceBaseOutputLength),t.currentOutputLength!==void 0&&(e.currentOutputLength=t.currentOutputLength)})}function mZ(e){let t=bZ();if(!t?.__piboStreamingBenchmarkShouldDropOverlayEvent)return!1;try{return!!t.__piboStreamingBenchmarkShouldDropOverlayEvent(e)}catch{return!1}}function hZ(e){return e?/^live:\d+$/.test(e)?`transient`:/^\d+:\d+$/.test(e)?`durable`:`other`:`missing`}function gZ(e,t){_Z(n=>{n.sessionIds.includes(e)||n.sessionIds.push(e),n.selectedPiboSessionId=e,t(n)})}function _Z(e){let t=vZ();t&&(e(t),t.updatedAt=SZ())}function vZ(){if(!nZ())return;let e=bZ();if(e)return e.__piboStreamingDebugReset||=()=>(e.__piboStreamingDebug=yZ(),e.__piboStreamingDebug),e.__piboStreamingDebug??=yZ(),e.__piboStreamingDebug}function yZ(){let e=SZ();return{enabled:!0,startedAt:e,updatedAt:e,sessionIds:[],liveOpenCount:0,liveErrorCount:0,eventCount:0,eventTypeCounts:{},textDeltaCount:0,textDeltaBytes:0,reasoningDeltaCount:0,reasoningDeltaBytes:0,enqueueCount:0,enqueueFlushImmediateCount:0,pendingEventCount:0,flushCount:0,flushedEventCount:0,overlayUpdateCount:0,overlayEventCount:0,liveTraceComputeCount:0,liveTraceComputeDurationMsTotal:0,markdownRenderCount:0,markdownRenderPlainCount:0,markdownRenderFullCount:0,markdownRenderCommonMarkCount:0,markdownRenderGfmCount:0,markdownRenderGfmFastCount:0,markdownRenderDurationMsTotal:0,markdownRenderPlainDurationMsTotal:0,markdownRenderFullDurationMsTotal:0,markdownRenderCommonMarkDurationMsTotal:0,markdownRenderGfmDurationMsTotal:0,markdownRenderGfmFastDurationMsTotal:0,traceRefreshScheduledCount:0,traceRefreshStartedCount:0,traceRefreshCompletedCount:0,traceRefreshFailedCount:0,traceRefreshDurationMsTotal:0,traceBaseUpdateCount:0}}function bZ(){return typeof window>`u`?void 0:window}function xZ(e){return typeof TextEncoder<`u`?new TextEncoder().encode(e).byteLength:e.length}function SZ(){return new Date().toISOString()}function CZ(e){return Math.max(0,Math.round(e*1e3)/1e3)}function wZ(){return typeof performance>`u`?Date.now():performance.now()}(function(e){var t=`\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b`,n={pattern:/(^(["']?)\w+\2)[ \t]+\S.*/,lookbehind:!0,alias:`punctuation`,inside:null},r={bash:n,environment:{pattern:RegExp(`\\$`+t),alias:`constant`},variable:[{pattern:/\$?\(\([\s\S]+?\)\)/,greedy:!0,inside:{variable:[{pattern:/(^\$\(\([\s\S]+)\)\)/,lookbehind:!0},/^\$\(\(/],number:/\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,operator:/--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,punctuation:/\(\(?|\)\)?|,|;/}},{pattern:/\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,greedy:!0,inside:{variable:/^\$\(|^`|\)$|`$/}},{pattern:/\$\{[^}]+\}/,greedy:!0,inside:{operator:/:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,punctuation:/[\[\]]/,environment:{pattern:RegExp(`(\\{)`+t),lookbehind:!0,alias:`constant`}}},/\$(?:\w+|[#?*!@$])/],entity:/\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/};e.languages.bash={shebang:{pattern:/^#!\s*\/.*/,alias:`important`},comment:{pattern:/(^|[^"{\\$])#.*/,lookbehind:!0},"function-name":[{pattern:/(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,lookbehind:!0,alias:`function`},{pattern:/\b[\w-]+(?=\s*\(\s*\)\s*\{)/,alias:`function`}],"for-or-select":{pattern:/(\b(?:for|select)\s+)\w+(?=\s+in\s)/,alias:`variable`,lookbehind:!0},"assign-left":{pattern:/(^|[\s;|&]|[<>]\()\w+(?:\.\w+)*(?=\+?=)/,inside:{environment:{pattern:RegExp(`(^|[\\s;|&]|[<>]\\()`+t),lookbehind:!0,alias:`constant`}},alias:`variable`,lookbehind:!0},parameter:{pattern:/(^|\s)-{1,2}(?:\w+:[+-]?)?\w+(?:\.\w+)*(?=[=\s]|$)/,alias:`variable`,lookbehind:!0},string:[{pattern:/((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,lookbehind:!0,greedy:!0,inside:r},{pattern:/((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,lookbehind:!0,greedy:!0,inside:{bash:n}},{pattern:/(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,lookbehind:!0,greedy:!0,inside:r},{pattern:/(^|[^$\\])'[^']*'/,lookbehind:!0,greedy:!0},{pattern:/\$'(?:[^'\\]|\\[\s\S])*'/,greedy:!0,inside:{entity:r.entity}}],environment:{pattern:RegExp(`\\$?`+t),alias:`constant`},variable:r.variable,function:{pattern:/(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cargo|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|java|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|node|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|sysctl|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,lookbehind:!0},keyword:{pattern:/(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,lookbehind:!0},builtin:{pattern:/(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|let|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|set|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,lookbehind:!0,alias:`class-name`},boolean:{pattern:/(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,lookbehind:!0},"file-descriptor":{pattern:/\B&\d\b/,alias:`important`},operator:{pattern:/\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,inside:{"file-descriptor":{pattern:/^\d/,alias:`important`}}},punctuation:/\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,number:{pattern:/(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,lookbehind:!0}},n.inside=e.languages.bash;for(var i=[`comment`,`function-name`,`for-or-select`,`assign-left`,`parameter`,`string`,`environment`,`function`,`keyword`,`builtin`,`boolean`,`file-descriptor`,`operator`,`punctuation`,`number`],a=r.variable[1].inside,o=0;o<i.length;o++)a[i[o]]=e.languages.bash[i[o]];e.languages.sh=e.languages.bash,e.languages.shell=e.languages.bash})(Prism),Prism.languages.json={property:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,lookbehind:!0,greedy:!0},string:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,lookbehind:!0,greedy:!0},comment:{pattern:/\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},number:/-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,punctuation:/[{}[\],]/,operator:/:/,boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:`keyword`}},Prism.languages.webmanifest=Prism.languages.json,(function(e){var t=/[*&][^\s[\]{},]+/,n=/!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/,r=`(?:`+n.source+`(?:[ ]+`+t.source+`)?|`+t.source+`(?:[ ]+`+n.source+`)?)`,i=`(?:[^\\s\\x00-\\x08\\x0e-\\x1f!"#%&'*,\\-:>?@[\\]\`{|}\\x7f-\\x84\\x86-\\x9f\\ud800-\\udfff\\ufffe\\uffff]|[?:-]<PLAIN>)(?:[ \\t]*(?:(?![#:])<PLAIN>|:<PLAIN>))*`.replace(/<PLAIN>/g,function(){return`[^\\s\\x00-\\x08\\x0e-\\x1f,[\\]{}\\x7f-\\x84\\x86-\\x9f\\ud800-\\udfff\\ufffe\\uffff]`}),a=`"(?:[^"\\\\\\r\\n]|\\\\.)*"|'(?:[^'\\\\\\r\\n]|\\\\.)*'`;function o(e,t){t=(t||``).replace(/m/g,``)+`m`;var n=`([:\\-,[{]\\s*(?:\\s<<prop>>[ \\t]+)?)(?:<<value>>)(?=[ \\t]*(?:$|,|\\]|\\}|(?:[\\r\\n]\\s*)?#))`.replace(/<<prop>>/g,function(){return r}).replace(/<<value>>/g,function(){return e});return RegExp(n,t)}e.languages.yaml={scalar:{pattern:RegExp(`([\\-:]\\s*(?:\\s<<prop>>[ \\t]+)?[|>])[ \\t]*(?:((?:\\r?\\n|\\r)[ \\t]+)\\S[^\\r\\n]*(?:\\2[^\\r\\n]+)*)`.replace(/<<prop>>/g,function(){return r})),lookbehind:!0,alias:`string`},comment:/#.*/,key:{pattern:RegExp(`((?:^|[:\\-,[{\\r\\n?])[ \\t]*(?:<<prop>>[ \\t]+)?)<<key>>(?=\\s*:\\s)`.replace(/<<prop>>/g,function(){return r}).replace(/<<key>>/g,function(){return`(?:`+i+`|`+a+`)`})),lookbehind:!0,greedy:!0,alias:`atrule`},directive:{pattern:/(^[ \t]*)%.+/m,lookbehind:!0,alias:`important`},datetime:{pattern:o(`\\d{4}-\\d\\d?-\\d\\d?(?:[tT]|[ \\t]+)\\d\\d?:\\d{2}:\\d{2}(?:\\.\\d*)?(?:[ \\t]*(?:Z|[-+]\\d\\d?(?::\\d{2})?))?|\\d{4}-\\d{2}-\\d{2}|\\d\\d?:\\d{2}(?::\\d{2}(?:\\.\\d*)?)?`),lookbehind:!0,alias:`number`},boolean:{pattern:o(`false|true`,`i`),lookbehind:!0,alias:`important`},null:{pattern:o(`null|~`,`i`),lookbehind:!0,alias:`important`},string:{pattern:o(a),lookbehind:!0,greedy:!0},number:{pattern:o(`[+-]?(?:0x[\\da-f]+|0o[0-7]+|(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:e[+-]?\\d+)?|\\.inf|\\.nan)`,`i`),lookbehind:!0},tag:n,important:t,punctuation:/---|[:[\]{}\-,|>?]|\.\.\./},e.languages.yml=e.languages.yaml})(Prism);var TZ=[`p`,`br`,`strong`,`em`,`a`,`ul`,`ol`,`li`,`blockquote`,`code`,`pre`,`h1`,`h2`,`h3`,`h4`,`hr`,`table`,`thead`,`tbody`,`tr`,`th`,`td`,`input`,`del`],EZ=[eZ],DZ=[],OZ=/[\n\r\\`*_\[\]<>]|~~/,kZ=/^\s*(?:#{1,6}\s|[-+>]|(?:\d+[.)]))\s/,AZ=/^\s*-{3,}\s*$/,jZ=/\b(?:https?:\/\/|www\.)|\S+@\S+\.\S+/i,MZ=/^\s*[-+*]\s+\[[ xX]\]\s/m,NZ=/(^|\n)\s*\|?.+\|.+\n\s*\|?\s*:?-{3,}:?\s*(?:\|\s*:?-{3,}:?\s*)+\|?\s*(?:\n|$)/;function PZ(e){return e.length>0&&!OZ.test(e)&&!kZ.test(e)&&!AZ.test(e)&&!(FZ(e)&&jZ.test(e))}function FZ(e){return e.includes(`://`)||e.includes(`www.`)||e.includes(`@`)}function IZ(e){let t=LZ(e);return t?t.openerEnd>=e.length?e.slice(0,t.openerStart):`${e}\``:e}function LZ(e){let t=0;for(;t<e.length;){let n=e.indexOf("`",t);if(n===-1)return;if(BZ(e,n)){t=n+1;continue}if(zZ(e,n)!==1)return;let r=RZ(e,n+1);if(r===-1)return{openerStart:n,openerEnd:n+1};t=r+1}}function RZ(e,t){for(;t<e.length;){let n=e.indexOf("`",t);if(n===-1)return-1;let r=zZ(e,n);if(r===1)return n;t=n+r}return-1}function zZ(e,t){let n=t;for(;n<e.length&&e[n]==="`";)n+=1;return n-t}function BZ(e,t){let n=0,r=t-1;for(;r>=0&&e[r]===`\\`;)n+=1,--r;return n%2==1}function VZ(e){return e.includes(`~~`)||e.includes(`[`)&&MZ.test(e)||e.includes(`|`)&&NZ.test(e)||FZ(e)&&jZ.test(e)}var HZ=/[\n\r\\`*_\[\]<>]/,UZ=/^\s*[-+*]\s+\[([ xX])\]\s+(.+?)\s*$/,WZ=/[\n\r\\<>|~]/,GZ=/[\n\r\\\[\]<>|~]/,KZ=/[\s\[\]()`<>]/;function qZ(e){if(!e.includes(`~~`)||HZ.test(e)||kZ.test(e)||AZ.test(e)||FZ(e)&&jZ.test(e)||e.includes(`[`)&&MZ.test(e)||e.includes(`|`)&&NZ.test(e))return;let t=[],n=0,r=0;for(;n<e.length;){let i=e.indexOf(`~~`,n);if(i===-1){t.push(e.slice(n));break}let a=e.indexOf(`~~`,i+2);if(a===-1||a===i+2)return;let o=e.slice(n,i);o&&t.push(o);let s=e.slice(i+2,a);if(s.includes(`~`))return;t.push((0,R.jsx)(`del`,{"data-pibo-component":`MarkdownRenderer`,"data-pibo-markdown-node":`del`,children:s},`del-${r}`)),r+=1,n=a+2}return r>0?(0,R.jsx)(`p`,{"data-pibo-component":`MarkdownRenderer`,"data-pibo-markdown-node":`p`,children:t}):void 0}function JZ(e){if(!e||KZ.test(e))return;let t=IY(e);if(t){if(t.startsWith(`/`)||t.startsWith(`#`))return t;try{let e=new URL(t);return e.protocol===`http:`||e.protocol===`https:`||e.protocol===`mailto:`?t:void 0}catch{return}}}function YZ(e,t){if(!e||GZ.test(e))return;let n=[],r=0,i=0,a=0,o=0;for(;r<e.length;){let s=e.indexOf(`**`,r),c=e.indexOf(`_`,r),l=e.indexOf("`",r),u=s===-1?1/0:s,d=c===-1?1/0:c,f=Math.min(u,d,l===-1?1/0:l);if(f===1/0){let t=e.slice(r);if(t.includes(`*`)||t.includes(`_`)||t.includes("`")||FZ(t)&&jZ.test(t))return;t&&n.push(t);break}let p=e.slice(r,f);if(p.includes(`*`)||p.includes(`_`)||p.includes("`")||FZ(p)&&jZ.test(p))return;if(p&&n.push(p),f===u){let a=e.indexOf(`**`,f+2);if(a===-1||a===f+2)return;let o=e.slice(f+2,a);if(o.includes(`*`)||o.includes("`")||o.includes(`[`)||o.includes(`]`))return;if(o.includes(`_`)){if(!o.startsWith(`_`)||!o.endsWith(`_`)||o.length<=2)return;let e=o.slice(1,-1);if(e.includes(`*`)||e.includes(`_`)||e.includes("`")||e.includes(`[`)||e.includes(`]`))return;n.push((0,R.jsx)(`strong`,{"data-pibo-component":`MarkdownRenderer`,"data-pibo-markdown-node":`strong`,children:(0,R.jsx)(`em`,{"data-pibo-component":`MarkdownRenderer`,"data-pibo-markdown-node":`em`,children:e})},`link-${t}-strong-${i}`))}else n.push((0,R.jsx)(`strong`,{"data-pibo-component":`MarkdownRenderer`,"data-pibo-markdown-node":`strong`,children:o},`link-${t}-strong-${i}`));i+=1,r=a+2}else if(f===d){if(e[f+1]===`_`)return;let i=e.indexOf(`_`,f+1);if(i===-1||i===f+1)return;let o=e.slice(f+1,i);if(o.includes(`**`)){if(!o.startsWith(`**`)||!o.endsWith(`**`)||o.length<=4)return;let e=o.slice(2,-2);if(e.includes(`*`)||e.includes(`_`)||e.includes("`")||e.includes(`[`)||e.includes(`]`))return;n.push((0,R.jsx)(`em`,{"data-pibo-component":`MarkdownRenderer`,"data-pibo-markdown-node":`em`,children:(0,R.jsx)(`strong`,{"data-pibo-component":`MarkdownRenderer`,"data-pibo-markdown-node":`strong`,children:e})},`link-${t}-em-${a}`))}else{if(o.includes(`*`)||o.includes(`_`)||o.includes("`")||o.includes(`[`)||o.includes(`]`))return;n.push((0,R.jsx)(`em`,{"data-pibo-component":`MarkdownRenderer`,"data-pibo-markdown-node":`em`,children:o},`link-${t}-em-${a}`))}a+=1,r=i+1}else{if(e[f+1]==="`")return;let i=e.indexOf("`",f+1);if(i===-1||i===f+1)return;let a=e.slice(f+1,i);if(a.includes("`")||a.includes(`[`)||a.includes(`]`)||a.startsWith(` `)||a.endsWith(` `))return;n.push((0,R.jsx)(`code`,{"data-pibo-component":`MarkdownRenderer`,"data-pibo-markdown-node":`code`,children:a},`link-${t}-code-${o}`)),o+=1,r=i+1}}return n.length>0?n:void 0}function XZ(e){let t=[],n=0,r=0,i=0,a=0;for(;n<e.length;){let o=e.indexOf(`**`,n),s=e.indexOf("`",n),c=e.indexOf(`[`,n),l=o===-1?1/0:o,u=s===-1?1/0:s,d=Math.min(l,u,c===-1?1/0:c);if(d===1/0){let r=e.slice(n);if(r.includes(`*`)||r.includes(`_`)||r.includes("`")||r.includes(`[`)||r.includes(`]`)||FZ(r)&&jZ.test(r))return;r&&t.push(r);break}let f=e.slice(n,d);if(f.includes(`*`)||f.includes(`_`)||f.includes("`")||f.includes(`[`)||f.includes(`]`)||FZ(f)&&jZ.test(f))return;if(f&&t.push(f),d===l){let i=e.indexOf(`**`,d+2);if(i===-1||i===d+2)return;let a=e.slice(d+2,i);if(a.includes(`*`)||a.includes(`_`)||a.includes("`")||a.includes(`[`)||a.includes(`]`))return;t.push((0,R.jsx)(`strong`,{"data-pibo-component":`MarkdownRenderer`,"data-pibo-markdown-node":`strong`,children:a},`strong-${r}`)),r+=1,n=i+2}else if(d===u){if(e[d+1]==="`")return;let r=e.indexOf("`",d+1);if(r===-1||r===d+1)return;let a=e.slice(d+1,r);if(a.includes(`_`)||a.includes("`")||a.includes(`[`)||a.includes(`]`)||a.startsWith(` `)||a.endsWith(` `))return;t.push((0,R.jsx)(`code`,{"data-pibo-component":`MarkdownRenderer`,"data-pibo-markdown-node":`code`,children:a},`code-${i}`)),i+=1,n=r+1}else{let r=e.indexOf(`](`,d+1);if(r===-1||r===d+1)return;let i=e.indexOf(`)`,r+2);if(i===-1||i===r+2)return;let o=YZ(e.slice(d+1,r),a),s=JZ(e.slice(r+2,i));if(!s||!o)return;t.push((0,R.jsx)(`a`,{href:s,target:`_blank`,rel:`noreferrer`,"data-pibo-component":`MarkdownRenderer`,"data-pibo-markdown-node":`a`,children:o},`link-${a}`)),a+=1,n=i+1}}return t.length>0?t:void 0}function ZZ(e){let t=UZ.exec(e);if(!t)return;let n=t[2];if(!n||WZ.test(n))return;let r=XZ(n);if(r)return(0,R.jsx)(`ul`,{className:`contains-task-list`,"data-pibo-component":`MarkdownRenderer`,"data-pibo-markdown-node":`ul`,children:(0,R.jsxs)(`li`,{className:`task-list-item`,"data-pibo-component":`MarkdownRenderer`,"data-pibo-markdown-node":`li`,children:[(0,R.jsx)(`input`,{type:`checkbox`,checked:t[1].toLowerCase()===`x`,readOnly:!0,disabled:!0,"data-pibo-component":`MarkdownRenderer`,"data-pibo-markdown-node":`input`}),r]})})}var QZ={p({children:e,node:t,...n}){return(0,R.jsx)(`p`,{"data-pibo-component":`MarkdownRenderer`,"data-pibo-markdown-node":`p`,...n,children:e})},ul({children:e,node:t,...n}){return(0,R.jsx)(`ul`,{"data-pibo-component":`MarkdownRenderer`,"data-pibo-markdown-node":`ul`,...n,children:e})},ol({children:e,node:t,...n}){return(0,R.jsx)(`ol`,{"data-pibo-component":`MarkdownRenderer`,"data-pibo-markdown-node":`ol`,...n,children:e})},li({children:e,node:t,...n}){return(0,R.jsx)(`li`,{"data-pibo-component":`MarkdownRenderer`,"data-pibo-markdown-node":`li`,...n,children:e})},blockquote({children:e,node:t,...n}){return(0,R.jsx)(`blockquote`,{"data-pibo-component":`MarkdownRenderer`,"data-pibo-markdown-node":`blockquote`,...n,children:e})},pre({children:e,node:t,...n}){return(0,R.jsx)(`pre`,{"data-pibo-component":`MarkdownRenderer`,"data-pibo-markdown-node":`pre`,...n,children:e})},a({href:e,children:t}){return(0,R.jsx)(`a`,{href:e,target:`_blank`,rel:`noreferrer`,"data-pibo-component":`MarkdownRenderer`,"data-pibo-markdown-node":`a`,children:t})},code({className:e,children:t,node:n,...r}){let i=$Z(e),a=String(t).replace(/\n$/,``);if(!i)return(0,R.jsx)(`code`,{className:e,"data-pibo-component":`MarkdownRenderer`,"data-pibo-markdown-node":`code`,...r,children:t});let o=bl.languages[i];return o?(0,R.jsx)(`code`,{className:`language-${i}`,"data-pibo-component":`MarkdownRenderer`,"data-pibo-markdown-node":`code`,dangerouslySetInnerHTML:{__html:bl.highlight(a,o,i)},...r}):(0,R.jsx)(`code`,{className:e,"data-pibo-component":`MarkdownRenderer`,"data-pibo-markdown-node":`code`,...r,children:t})},th({children:e,node:t,...n}){return(0,R.jsx)(`th`,{"data-pibo-component":`MarkdownRenderer`,"data-pibo-markdown-node":`th`,...n,children:e})},td({children:e,node:t,...n}){return(0,R.jsx)(`td`,{"data-pibo-component":`MarkdownRenderer`,"data-pibo-markdown-node":`td`,...n,children:e})},input({checked:e,node:t,...n}){return(0,R.jsx)(`input`,{type:`checkbox`,checked:!!e,readOnly:!0,disabled:!0,"data-pibo-component":`MarkdownRenderer`,"data-pibo-markdown-node":`input`,...n})}};function $Z(e){let t=/language-(\S+)/.exec(e??``);if(!t)return;let n=t[1].toLowerCase();return n===`sh`||n===`shell`?`bash`:n===`js`?`javascript`:n===`ts`?`typescript`:n===`md`?`markdown`:n===`yml`?`yaml`:n}function eQ(e,t){t!==void 0&&lZ(e,(typeof performance>`u`?Date.now():performance.now())-t)}var tQ=(e,t,n)=>{if(n.tagName!==`a`||t!==`href`)return``;let r=IY(e);if(!r)return``;if(r.startsWith(`/`)||r.startsWith(`#`))return r;try{let e=new URL(r);return e.protocol===`http:`||e.protocol===`https:`||e.protocol===`mailto:`?r:``}catch{return``}},nQ=(0,L.memo)(function({children:e,streaming:t=!1}){let n=nZ()?typeof performance>`u`?Date.now():performance.now():void 0,r=t?IZ(e):e,i=`commonmark`,a;if(PZ(r))i=`plain`,a=(0,R.jsx)(`p`,{"data-pibo-component":`MarkdownRenderer`,"data-pibo-markdown-node":`p`,children:r});else{let e=VZ(r),t=e?qZ(r)??ZZ(r):void 0;t?(i=`gfm-fast`,a=t):(i=e?`gfm`:`commonmark`,a=MY({allowedElements:TZ,children:r,components:QZ,remarkPlugins:e?EZ:DZ,skipHtml:!0,urlTransform:tQ}))}return eQ(i,n),a});function rQ({tools:e}){return(0,R.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col bg-[#101d22]`,children:[(0,R.jsxs)(`div`,{className:`flex h-14 items-center justify-between gap-3 border-b border-slate-800 bg-[#151f24] px-4`,children:[(0,R.jsxs)(`div`,{className:`min-w-0`,children:[(0,R.jsx)(`div`,{className:`text-[10px] font-bold uppercase tracking-[0.14em] text-[#11a4d4]`,children:`Context`}),(0,R.jsx)(`h2`,{className:`truncate text-base font-semibold text-slate-100`,children:`Pibo Tools`}),(0,R.jsx)(`div`,{className:`truncate font-mono text-[11px] text-slate-500`,children:`Installed tool hints injected into agent context`})]}),(0,R.jsxs)(`span`,{className:`inline-flex h-8 items-center gap-1.5 border border-slate-700 bg-[#101d22] px-2.5 text-xs text-slate-300`,children:[(0,R.jsx)(Js,{size:14,className:`text-[#11a4d4]`}),e.length,` installed`]})]}),(0,R.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto p-4`,children:e.length===0?(0,R.jsx)(`div`,{className:`border border-dashed border-slate-700 bg-[#151f24] px-4 py-5 text-sm text-slate-500`,children:`No curated Pibo Tools are currently installed.`}):(0,R.jsxs)(`div`,{className:`grid gap-3`,children:[(0,R.jsx)(`div`,{className:`border border-slate-800 bg-[#151f24] px-4 py-3 text-sm text-slate-400`,children:`These are the short hints injected into agent context for installed curated CLI tools. The CLI remains the source of truth for the full workflow.`}),e.map(e=>(0,R.jsxs)(`section`,{className:`border border-slate-800 bg-[#151f24]`,children:[(0,R.jsxs)(`div`,{className:`border-b border-slate-800 px-4 py-3`,children:[(0,R.jsx)(`div`,{className:`text-[10px] font-bold uppercase tracking-[0.14em] text-[#11a4d4]`,children:`Installed Tool`}),(0,R.jsx)(`h3`,{className:`truncate text-sm font-semibold text-slate-100`,children:e.name}),(0,R.jsx)(`p`,{className:`mt-1 text-xs text-slate-500`,children:e.description})]}),(0,R.jsx)(`div`,{className:`px-4 py-4`,children:(0,R.jsx)(`div`,{className:`model-response-markdown text-sm`,children:(0,R.jsx)(nQ,{children:e.snippet})})})]},e.name))]})})]})}async function iQ(e){return(await B(`/api/chat/context-build?${new URLSearchParams({piboSessionId:e.piboSessionId}).toString()}`)).snapshot}async function aQ(e){return B(`/api/chat/agents`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(e)})}async function oQ(e,t){return B(`/api/chat/agents/${encodeURIComponent(e)}`,{method:`PATCH`,headers:{"content-type":`application/json`},body:JSON.stringify(t)})}async function sQ(e,t){return B(`/api/chat/agents/${encodeURIComponent(e)}`,{method:`DELETE`,headers:{"content-type":`application/json`},body:JSON.stringify({confirmName:t})})}async function cQ(e,t){return B(`/api/chat/mcp-servers/${encodeURIComponent(e)}/description`,{method:`PATCH`,headers:{"content-type":`application/json`},body:JSON.stringify({description:t})})}async function lQ(e){return(await B(`/api/chat/pi-packages`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({source:e})})).package}async function uQ(e,t){return(await B(`/api/chat/pi-packages/${encodeURIComponent(e)}`,{method:`PATCH`,headers:{"content-type":`application/json`},body:JSON.stringify(t)})).package}async function dQ(e){return(await B(`/api/chat/pi-packages/${encodeURIComponent(e)}`,{method:`DELETE`,headers:{"content-type":`application/json`},body:`{}`})).removedPackage}async function fQ(e){return B(`/api/chat/user-skills/${encodeURIComponent(e)}`)}async function pQ(e){return(await B(`/api/chat/user-skills`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(e)})).skill}async function mQ(e,t){return(await B(`/api/chat/user-skills/${encodeURIComponent(e)}`,{method:`PATCH`,headers:{"content-type":`application/json`},body:JSON.stringify(t)})).skill}async function hQ(e){return B(`/api/chat/user-skills/${encodeURIComponent(e)}`,{method:`DELETE`,headers:{"content-type":`application/json`},body:`{}`})}async function gQ(e){return(await B(`/api/chat/user-skills/install`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({url:e})})).skill}function _Q({servers:e,selectedServerName:t,onServerSaved:n}){let[r,i]=(0,L.useState)({}),[a,o]=(0,L.useState)(null),[s,c]=(0,L.useState)(null),l=(0,L.useMemo)(()=>t?[...e].sort((e,n)=>e.name===t?-1:n.name===t?1:e.name.localeCompare(n.name)):e,[t,e]);(0,L.useEffect)(()=>{i(t=>{let n={...t};for(let t of e)t.name in n||(n[t.name]=t.description??``);return n})},[e]);let u=async e=>{if(!e.editable)return;let t=(r[e.name]??``).trim();if(!t){c(`MCP tool context is required.`);return}o(e.name);try{let r=await cQ(e.name,t);i(t=>({...t,[e.name]:r.server.description??``})),n(r.server),c(null)}catch(e){c(e instanceof Error?e.message:String(e))}finally{o(null)}};return(0,R.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col bg-[#101d22]`,children:[(0,R.jsxs)(`div`,{className:`flex h-14 items-center justify-between gap-3 border-b border-slate-800 bg-[#151f24] px-4`,children:[(0,R.jsxs)(`div`,{className:`min-w-0`,children:[(0,R.jsx)(`div`,{className:`text-[10px] font-bold uppercase tracking-[0.14em] text-[#11a4d4]`,children:`Context`}),(0,R.jsx)(`h2`,{className:`truncate text-base font-semibold text-slate-100`,children:`MCP Tools`}),(0,R.jsx)(`div`,{className:`truncate font-mono text-[11px] text-slate-500`,children:`MCP server hints injected into agent context`})]}),(0,R.jsxs)(`span`,{className:`inline-flex h-8 items-center gap-1.5 border border-slate-700 bg-[#101d22] px-2.5 text-xs text-slate-300`,children:[(0,R.jsx)(Bs,{size:14,className:`text-[#11a4d4]`}),e.length,` configured`]})]}),(0,R.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto p-4`,children:[s?(0,R.jsx)(`div`,{className:`mb-3 border border-red-500/60 bg-red-500/10 px-3 py-2 text-sm text-red-200`,children:s}):null,l.length===0?(0,R.jsx)(`div`,{className:`border border-dashed border-slate-700 bg-[#151f24] px-4 py-5 text-sm text-slate-500`,children:`No MCP servers are configured.`}):(0,R.jsxs)(`div`,{className:`grid gap-3`,children:[(0,R.jsx)(`div`,{className:`border border-slate-800 bg-[#151f24] px-4 py-3 text-sm text-slate-400`,children:`These short descriptions become the model-visible MCP context. Configure the server itself through the MCP CLI.`}),l.map(e=>{let n=r[e.name]??e.description??``,o=n.trim()!==(e.description??``);return(0,R.jsxs)(`section`,{className:`border bg-[#151f24] ${e.name===t?`border-[#11a4d4]`:e.hasDescription?`border-slate-800`:`border-[#f59e0b]/60`}`,children:[(0,R.jsx)(`div`,{className:`border-b border-slate-800 px-4 py-3`,children:(0,R.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,R.jsxs)(`div`,{className:`min-w-0`,children:[(0,R.jsx)(`div`,{className:`text-[10px] font-bold uppercase tracking-[0.14em] text-[#11a4d4]`,children:`MCP Tool Context`}),(0,R.jsx)(`h3`,{className:`truncate text-sm font-semibold text-slate-100`,children:e.name}),(0,R.jsxs)(`div`,{className:`mt-1 font-mono text-[10px] text-slate-500`,children:[e.transport,e.descriptionSource?` / ${e.descriptionSource}`:``]})]}),e.hasDescription?null:(0,R.jsxs)(`div`,{className:`inline-flex items-center gap-1.5 border border-[#f59e0b]/60 bg-[#f59e0b]/10 px-2 py-1 text-xs text-amber-100`,children:[(0,R.jsx)(Gs,{size:13}),`Missing`]})]})}),(0,R.jsxs)(`div`,{className:`grid gap-2 px-4 py-4`,children:[(0,R.jsx)(`textarea`,{value:n,maxLength:480,disabled:!e.editable,onChange:t=>i(n=>({...n,[e.name]:t.target.value})),className:`min-h-[92px] min-w-0 resize-y border border-slate-700 bg-[#0e1116] px-3 py-2 text-sm text-slate-200 outline-none focus:border-[#11a4d4] disabled:opacity-60`,placeholder:`Short agent-facing MCP context`}),(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,R.jsx)(`div`,{className:`text-xs text-slate-500`,children:e.editable?`Stored as Pibo MCP metadata.`:`Registry-provided context is read-only.`}),(0,R.jsx)(`button`,{type:`button`,disabled:!e.editable||a===e.name||!o||!n.trim(),onClick:()=>void u(e),title:`Save MCP Tool Context`,"aria-label":`Save MCP Tool Context`,className:`h-8 w-8 inline-flex items-center justify-center border border-[#11a4d4] bg-[#11a4d4]/10 text-[#11a4d4] disabled:opacity-50`,children:(0,R.jsx)(Ls,{size:14})})]})]})]},e.name)})]})]})]})}var vQ={},yQ=(0,L.createContext)(vQ),bQ=(e,t)=>q({},e,t),xQ=()=>(0,L.useContext)(yQ),SQ=(0,L.createContext)(()=>{});SQ.displayName=`JVR.DispatchShowTools`;function CQ(){return(0,L.useReducer)(bQ,vQ)}function wQ(){return(0,L.useContext)(SQ)}var TQ=e=>{var{initial:t,dispatch:n,children:r}=e;return(0,R.jsx)(yQ.Provider,{value:t,children:(0,R.jsx)(SQ.Provider,{value:n,children:r})})};TQ.displayName=`JVR.ShowTools`;var EQ={},DQ=(0,L.createContext)(EQ),OQ=(e,t)=>q({},e,t),kQ=()=>(0,L.useContext)(DQ),AQ=(0,L.createContext)(()=>{});AQ.displayName=`JVR.DispatchExpands`;function jQ(){return(0,L.useReducer)(OQ,EQ)}function MQ(){return(0,L.useContext)(AQ)}var NQ=e=>{var{initial:t,dispatch:n,children:r}=e;return(0,R.jsx)(DQ.Provider,{value:t,children:(0,R.jsx)(AQ.Provider,{value:n,children:r})})};NQ.displayName=`JVR.Expands`;var PQ={Str:{as:`span`,"data-type":`string`,style:{color:`var(--w-rjv-type-string-color, #cb4b16)`},className:`w-rjv-type`,children:`string`},Url:{as:`a`,style:{color:`var(--w-rjv-type-url-color, #0969da)`},"data-type":`url`,className:`w-rjv-type`,children:`url`},Undefined:{style:{color:`var(--w-rjv-type-undefined-color, #586e75)`},as:`span`,"data-type":`undefined`,className:`w-rjv-type`,children:`undefined`},Null:{style:{color:`var(--w-rjv-type-null-color, #d33682)`},as:`span`,"data-type":`null`,className:`w-rjv-type`,children:`null`},Map:{style:{color:`var(--w-rjv-type-map-color, #268bd2)`,marginRight:3},as:`span`,"data-type":`map`,className:`w-rjv-type`,children:`Map`},Nan:{style:{color:`var(--w-rjv-type-nan-color, #859900)`},as:`span`,"data-type":`nan`,className:`w-rjv-type`,children:`NaN`},Bigint:{style:{color:`var(--w-rjv-type-bigint-color, #268bd2)`},as:`span`,"data-type":`bigint`,className:`w-rjv-type`,children:`bigint`},Int:{style:{color:`var(--w-rjv-type-int-color, #268bd2)`},as:`span`,"data-type":`int`,className:`w-rjv-type`,children:`int`},Set:{style:{color:`var(--w-rjv-type-set-color, #268bd2)`,marginRight:3},as:`span`,"data-type":`set`,className:`w-rjv-type`,children:`Set`},Float:{style:{color:`var(--w-rjv-type-float-color, #859900)`},as:`span`,"data-type":`float`,className:`w-rjv-type`,children:`float`},True:{style:{color:`var(--w-rjv-type-boolean-color, #2aa198)`},as:`span`,"data-type":`bool`,className:`w-rjv-type`,children:`bool`},False:{style:{color:`var(--w-rjv-type-boolean-color, #2aa198)`},as:`span`,"data-type":`bool`,className:`w-rjv-type`,children:`bool`},Date:{style:{color:`var(--w-rjv-type-date-color, #268bd2)`},as:`span`,"data-type":`date`,className:`w-rjv-type`,children:`date`}},FQ=(0,L.createContext)(PQ),IQ=(e,t)=>q({},e,t),LQ=()=>(0,L.useContext)(FQ),RQ=(0,L.createContext)(()=>{});RQ.displayName=`JVR.DispatchTypes`;function zQ(){return(0,L.useReducer)(IQ,PQ)}function BQ(){return(0,L.useContext)(RQ)}function VQ(e){var{initial:t,dispatch:n,children:r}=e;return(0,R.jsx)(FQ.Provider,{value:t,children:(0,R.jsx)(RQ.Provider,{value:n,children:r})})}VQ.displayName=`JVR.Types`;var HQ=[`style`];function UQ(e){var{style:t}=e,n=$P(e,HQ);return(0,R.jsx)(`svg`,q({viewBox:`0 0 24 24`,fill:`var(--w-rjv-arrow-color, currentColor)`,style:q({cursor:`pointer`,height:`1em`,width:`1em`,userSelect:`none`,display:`inline-flex`},t)},n,{children:(0,R.jsx)(`path`,{d:`M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z`})}))}UQ.displayName=`JVR.TriangleArrow`;var WQ={Arrow:{as:`span`,className:`w-rjv-arrow`,style:{transform:`rotate(0deg)`,transition:`all 0.3s`},children:(0,R.jsx)(UQ,{})},Colon:{as:`span`,style:{color:`var(--w-rjv-colon-color, var(--w-rjv-color))`,marginLeft:0,marginRight:2},className:`w-rjv-colon`,children:`:`},Quote:{as:`span`,style:{color:`var(--w-rjv-quotes-color, #236a7c)`},className:`w-rjv-quotes`,children:`"`},ValueQuote:{as:`span`,style:{color:`var(--w-rjv-quotes-string-color, #cb4b16)`},className:`w-rjv-quotes`,children:`"`},BracketsLeft:{as:`span`,style:{color:`var(--w-rjv-brackets-color, #236a7c)`},className:`w-rjv-brackets-start`,children:`[`},BracketsRight:{as:`span`,style:{color:`var(--w-rjv-brackets-color, #236a7c)`},className:`w-rjv-brackets-end`,children:`]`},BraceLeft:{as:`span`,style:{color:`var(--w-rjv-curlybraces-color, #236a7c)`},className:`w-rjv-curlybraces-start`,children:`{`},BraceRight:{as:`span`,style:{color:`var(--w-rjv-curlybraces-color, #236a7c)`},className:`w-rjv-curlybraces-end`,children:`}`}},GQ=(0,L.createContext)(WQ),KQ=(e,t)=>q({},e,t),qQ=()=>(0,L.useContext)(GQ),JQ=(0,L.createContext)(()=>{});JQ.displayName=`JVR.DispatchSymbols`;function YQ(){return(0,L.useReducer)(KQ,WQ)}function XQ(){return(0,L.useContext)(JQ)}var ZQ=e=>{var{initial:t,dispatch:n,children:r}=e;return(0,R.jsx)(GQ.Provider,{value:t,children:(0,R.jsx)(JQ.Provider,{value:n,children:r})})};ZQ.displayName=`JVR.Symbols`;var QQ={Copied:{className:`w-rjv-copied`,style:{height:`1em`,width:`1em`,cursor:`pointer`,verticalAlign:`middle`,marginLeft:5}},CountInfo:{as:`span`,className:`w-rjv-object-size`,style:{color:`var(--w-rjv-info-color, #0000004d)`,paddingLeft:8,fontStyle:`italic`}},CountInfoExtra:{as:`span`,className:`w-rjv-object-extra`,style:{paddingLeft:8}},Ellipsis:{as:`span`,style:{cursor:`pointer`,color:`var(--w-rjv-ellipsis-color, #cb4b16)`,userSelect:`none`},className:`w-rjv-ellipsis`,children:`...`},Row:{as:`div`,className:`w-rjv-line`},KeyName:{as:`span`,className:`w-rjv-object-key`}},$Q=(0,L.createContext)(QQ),e$=(e,t)=>q({},e,t),t$=()=>(0,L.useContext)($Q),n$=(0,L.createContext)(()=>{});n$.displayName=`JVR.DispatchSection`;function r$(){return(0,L.useReducer)(e$,QQ)}function i$(){return(0,L.useContext)(n$)}var a$=e=>{var{initial:t,dispatch:n,children:r}=e;return(0,R.jsx)($Q.Provider,{value:t,children:(0,R.jsx)(n$.Provider,{value:n,children:r})})};a$.displayName=`JVR.Section`;var o$={objectSortKeys:!1,indentWidth:15},s$=(0,L.createContext)(o$);s$.displayName=`JVR.Context`;var c$=(0,L.createContext)(()=>{});c$.displayName=`JVR.DispatchContext`;function l$(e,t){return q({},e,t)}var u$=()=>(0,L.useContext)(s$),d$=e=>{var{children:t,initialState:n,initialTypes:r}=e,[i,a]=(0,L.useReducer)(l$,Object.assign({},o$,n)),[o,s]=CQ(),[c,l]=jQ(),[u,d]=zQ(),[f,p]=YQ(),[m,h]=r$();return(0,L.useEffect)(()=>a(q({},n)),[n]),(0,R.jsx)(s$.Provider,{value:i,children:(0,R.jsx)(c$.Provider,{value:a,children:(0,R.jsx)(TQ,{initial:o,dispatch:s,children:(0,R.jsx)(NQ,{initial:c,dispatch:l,children:(0,R.jsx)(VQ,{initial:q({},u,r),dispatch:d,children:(0,R.jsx)(ZQ,{initial:f,dispatch:p,children:(0,R.jsx)(a$,{initial:m,dispatch:h,children:t})})})})})})})};d$.displayName=`JVR.Provider`;function f$(e){if(e==null)throw TypeError(`Cannot destructure `+e)}var p$=[`isNumber`,`value`,`parentValue`,`keyName`,`keys`],m$=[`as`,`render`],h$=[`as`,`render`],g$=[`as`,`render`],_$=[`as`,`style`,`render`],v$=[`as`,`render`],y$=[`as`,`render`],b$=[`as`,`render`],x$=[`as`,`render`],S$=e=>{var{Quote:t={}}=qQ(),{isNumber:n,value:r,parentValue:i,keyName:a,keys:o}=e,s=$P(e,p$);if(n)return null;var{as:c,render:l}=t,u=$P(t,m$),d=c||`span`,f=q({},s,u);return typeof f.children==`string`&&(f.children=f.children.trim()||void 0),l&&typeof l==`function`&&l(f,{value:r,parentValue:i,keyName:a,keys:o||(a?[a]:[])})||(0,R.jsx)(d,q({},f))};S$.displayName=`JVR.Quote`;var C$=e=>{var{ValueQuote:t={}}=qQ(),n=q({},(f$(e),e)),{as:r,render:i}=t,a=$P(t,h$),o=r||`span`,s=q({},n,a);return i&&typeof i==`function`&&i(s,{})||(0,R.jsx)(o,q({},s))};C$.displayName=`JVR.ValueQuote`;var w$=e=>{var{value:t,parentValue:n,keyName:r,keys:i}=e,{Colon:a={}}=qQ(),{as:o,render:s}=a,c=$P(a,g$),l=o||`span`;return s&&typeof s==`function`&&s(c,{value:t,parentValue:n,keyName:r,keys:i||(r?[r]:[])})||(0,R.jsx)(l,q({},c))};w$.displayName=`JVR.Colon`;var T$=e=>{var{Arrow:t={}}=qQ(),n=kQ(),{expandKey:r,style:i,value:a,parentValue:o,keyName:s,keys:c}=e,l=!!n[r],{as:u,style:d,render:f}=t,p=$P(t,_$),m=u||`span`,h=f&&typeof f==`function`,g=q({},p,{"data-expanded":l,style:q({},d,i)});return h&&f(g,{value:a,parentValue:o,keyName:s,keys:c||(s?[s]:[])})||(0,R.jsx)(m,q({},p,{style:q({},d,i)}))};T$.displayName=`JVR.Arrow`;var E$=e=>{var{isBrackets:t,value:n,parentValue:r,keyName:i,keys:a}=e,{BracketsLeft:o={},BraceLeft:s={}}=qQ(),c={value:n,parentValue:r,keyName:i,keys:a||(i?[i]:[])};if(t){var{as:l,render:u}=o,d=$P(o,v$),f=l||`span`;return u&&typeof u==`function`&&u(d,c)||(0,R.jsx)(f,q({},d))}var{as:p,render:m}=s,h=$P(s,y$),g=p||`span`;return m&&typeof m==`function`&&m(h,c)||(0,R.jsx)(g,q({},h))};E$.displayName=`JVR.BracketsOpen`;var D$=e=>{var{isBrackets:t,isVisiable:n,value:r,parentValue:i,keyName:a,keys:o}=e,s={value:r,parentValue:i,keyName:a,keys:o||(a?[a]:[])};if(!n)return null;var{BracketsRight:c={},BraceRight:l={}}=qQ();if(t){var{as:u,render:d}=c,f=$P(c,b$),p=u||`span`;return d&&typeof d==`function`&&d(f,s)||(0,R.jsx)(p,q({},f))}var{as:m,render:h}=l,g=$P(l,x$),_=m||`span`;return h&&typeof h==`function`&&h(g,s)||(0,R.jsx)(_,q({},g))};D$.displayName=`JVR.BracketsClose`;var O$=e=>{var{keyName:t,value:n,expandKey:r,parentValue:i,level:a,keys:o=[]}=e,s=kQ(),{collapsed:c,shouldExpandNodeInitially:l}=u$(),u=typeof c==`boolean`?c:typeof c==`number`?a>c:!1,d=s[r]??(l?!1:u),f=l&&l(!d,{value:n,keys:o,level:a,keyName:t,parentValue:i});if(l&&c===!1){if(s[r]===void 0&&!f)return null}else if(s[r]===void 0&&f)return null;var p=Object.keys(n).length;if(d||p===0)return null;var m={paddingLeft:4},h={keyName:t,value:n,keys:o,parentValue:i},g=Array.isArray(n),_=n instanceof Set;return(0,R.jsx)(`div`,{style:m,children:(0,R.jsx)(D$,q({isBrackets:g||_},h,{isVisiable:!0}))})};O$.displayName=`JVR.NestedClose`;var k$=[`as`,`render`],A$=[`as`,`render`],j$=[`as`,`render`],M$=[`as`,`render`],N$=[`as`,`render`],Tue=[`as`,`render`],Eue=[`as`,`render`],Due=[`as`,`render`],Oue=[`as`,`render`],kue=[`as`,`render`],Aue=[`as`,`render`],jue=[`as`,`render`],Mue=[`as`,`render`],P$=e=>{if(e===void 0)return`0n`;if(typeof e==`string`)try{e=BigInt(e)}catch{return`0n`}return e?e.toString()+`n`:`0n`},F$=e=>{var{value:t,keyName:n}=e,{Set:r={},displayDataTypes:i}=LQ();if(!(t instanceof Set)||!i)return null;var{as:a,render:o}=r,s=$P(r,k$);return o&&typeof o==`function`&&o(s,{type:`type`,value:t,keyName:n})||(0,R.jsx)(a||`span`,q({},s))};F$.displayName=`JVR.SetComp`;var I$=e=>{var{value:t,keyName:n}=e,{Map:r={},displayDataTypes:i}=LQ();if(!(t instanceof Map)||!i)return null;var{as:a,render:o}=r,s=$P(r,A$);return o&&typeof o==`function`&&o(s,{type:`type`,value:t,keyName:n})||(0,R.jsx)(a||`span`,q({},s))};I$.displayName=`JVR.MapComp`;var L$={opacity:.75,paddingRight:4},R$=e=>{var{children:t=``,keyName:n,keys:r}=e,{Str:i={},displayDataTypes:a}=LQ(),{shortenTextAfterLength:o=30,stringEllipsis:s=`...`}=u$(),{as:c,render:l}=i,u=$P(i,j$),d=t,[f,p]=(0,L.useState)(o&&d.length>o);(0,L.useEffect)(()=>p(o&&d.length>o),[o]);var m=c||`span`,h=q({},L$,i.style||{});o>0&&(u.style=q({},u.style,{cursor:d.length<=o?`initial`:`pointer`}),d.length>o&&(u.onClick=()=>{p(!f)}));var g=f?``+d.slice(0,o)+s:d,_=l&&typeof l==`function`,v=_&&l(q({},u,{style:h}),{type:`type`,value:t,keyName:n,keys:r}),y=f?`w-rjv-value w-rjv-value-short`:`w-rjv-value`,b=_&&l(q({},u,{children:g,className:y}),{type:`value`,value:t,keyName:n,keys:r});return(0,R.jsxs)(L.Fragment,{children:[a&&(v||(0,R.jsx)(m,q({},u,{style:h}))),b||(0,R.jsxs)(L.Fragment,{children:[(0,R.jsx)(C$,{}),(0,R.jsx)(m,q({},u,{className:y,children:g})),(0,R.jsx)(C$,{})]})]})};R$.displayName=`JVR.TypeString`;var z$=e=>{var{children:t,keyName:n,keys:r}=e,{True:i={},displayDataTypes:a}=LQ(),{as:o,render:s}=i,c=$P(i,M$),l=o||`span`,u=q({},L$,i.style||{}),d=s&&typeof s==`function`,f=d&&s(q({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),p=d&&s(q({},c,{children:t,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,R.jsxs)(L.Fragment,{children:[a&&(f||(0,R.jsx)(l,q({},c,{style:u}))),p||(0,R.jsx)(l,q({},c,{className:`w-rjv-value`,children:t?.toString()}))]})};z$.displayName=`JVR.TypeTrue`;var B$=e=>{var{children:t,keyName:n,keys:r}=e,{False:i={},displayDataTypes:a}=LQ(),{as:o,render:s}=i,c=$P(i,N$),l=o||`span`,u=q({},L$,i.style||{}),d=s&&typeof s==`function`,f=d&&s(q({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),p=d&&s(q({},c,{children:t,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,R.jsxs)(L.Fragment,{children:[a&&(f||(0,R.jsx)(l,q({},c,{style:u}))),p||(0,R.jsx)(l,q({},c,{className:`w-rjv-value`,children:t?.toString()}))]})};B$.displayName=`JVR.TypeFalse`;var V$=e=>{var{children:t,keyName:n,keys:r}=e,{Float:i={},displayDataTypes:a}=LQ(),{as:o,render:s}=i,c=$P(i,Tue),l=o||`span`,u=q({},L$,i.style||{}),d=s&&typeof s==`function`,f=d&&s(q({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),p=d&&s(q({},c,{children:t,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,R.jsxs)(L.Fragment,{children:[a&&(f||(0,R.jsx)(l,q({},c,{style:u}))),p||(0,R.jsx)(l,q({},c,{className:`w-rjv-value`,children:t?.toString()}))]})};V$.displayName=`JVR.TypeFloat`;var H$=e=>{var{children:t,keyName:n,keys:r}=e,{Int:i={},displayDataTypes:a}=LQ(),{as:o,render:s}=i,c=$P(i,Eue),l=o||`span`,u=q({},L$,i.style||{}),d=s&&typeof s==`function`,f=d&&s(q({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),p=d&&s(q({},c,{children:t,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,R.jsxs)(L.Fragment,{children:[a&&(f||(0,R.jsx)(l,q({},c,{style:u}))),p||(0,R.jsx)(l,q({},c,{className:`w-rjv-value`,children:t?.toString()}))]})};H$.displayName=`JVR.TypeInt`;var U$=e=>{var{children:t,keyName:n,keys:r}=e,{Bigint:i={},displayDataTypes:a}=LQ(),{as:o,render:s}=i,c=$P(i,Due),l=o||`span`,u=q({},L$,i.style||{}),d=s&&typeof s==`function`,f=d&&s(q({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),p=d&&s(q({},c,{children:t,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,R.jsxs)(L.Fragment,{children:[a&&(f||(0,R.jsx)(l,q({},c,{style:u}))),p||(0,R.jsx)(l,q({},c,{className:`w-rjv-value`,children:P$(t?.toString())}))]})};U$.displayName=`JVR.TypeFloat`;var W$=e=>{var{children:t,keyName:n,keys:r}=e,{Url:i={},displayDataTypes:a}=LQ(),{as:o,render:s}=i,c=$P(i,Oue),l=o||`span`,u=q({},L$,i.style),d=s&&typeof s==`function`,f=d&&s(q({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),p=d&&s(q({},c,{children:t?.href,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,R.jsxs)(L.Fragment,{children:[a&&(f||(0,R.jsx)(l,q({},c,{style:u}))),p||(0,R.jsxs)(`a`,q({href:t?.href,target:`_blank`},c,{className:`w-rjv-value`,children:[(0,R.jsx)(C$,{}),t?.href,(0,R.jsx)(C$,{})]}))]})};W$.displayName=`JVR.TypeUrl`;var G$=e=>{var{children:t,keyName:n,keys:r}=e,{Date:i={},displayDataTypes:a}=LQ(),{as:o,render:s}=i,c=$P(i,kue),l=o||`span`,u=q({},L$,i.style||{}),d=s&&typeof s==`function`,f=d&&s(q({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),p=t instanceof Date?t.toLocaleString():t,m=d&&s(q({},c,{children:p,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,R.jsxs)(L.Fragment,{children:[a&&(f||(0,R.jsx)(l,q({},c,{style:u}))),m||(0,R.jsx)(l,q({},c,{className:`w-rjv-value`,children:p}))]})};G$.displayName=`JVR.TypeDate`;var K$=e=>{var{children:t,keyName:n,keys:r}=e,{Undefined:i={},displayDataTypes:a}=LQ(),{as:o,render:s}=i,c=$P(i,Aue),l=o||`span`,u=q({},L$,i.style||{}),d=s&&typeof s==`function`,f=d&&s(q({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),p=d&&s(q({},c,{children:t,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,R.jsxs)(L.Fragment,{children:[a&&(f||(0,R.jsx)(l,q({},c,{style:u}))),p||(0,R.jsx)(l,q({},c,{className:`w-rjv-value`,children:`undefined`}))]})};K$.displayName=`JVR.TypeUndefined`;var q$=e=>{var{children:t,keyName:n,keys:r}=e,{Null:i={},displayDataTypes:a}=LQ(),{as:o,render:s}=i,c=$P(i,jue),l=o||`span`,u=q({},L$,i.style||{}),d=s&&typeof s==`function`,f=d&&s(q({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),p=d&&s(q({},c,{children:t,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,R.jsxs)(L.Fragment,{children:[a&&(f||(0,R.jsx)(l,q({},c,{style:u}))),p||(0,R.jsx)(l,q({},c,{className:`w-rjv-value`,children:`null`}))]})};q$.displayName=`JVR.TypeNull`;var J$=e=>{var{children:t,keyName:n,keys:r}=e,{Nan:i={},displayDataTypes:a}=LQ(),{as:o,render:s}=i,c=$P(i,Mue),l=o||`span`,u=q({},L$,i.style||{}),d=s&&typeof s==`function`,f=d&&s(q({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),p=d&&s(q({},c,{children:t?.toString(),className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,R.jsxs)(L.Fragment,{children:[a&&(f||(0,R.jsx)(l,q({},c,{style:u}))),p||(0,R.jsx)(l,q({},c,{className:`w-rjv-value`,children:`NaN`}))]})};J$.displayName=`JVR.TypeNan`;var Nue=e=>Number(e)===e&&e%1!=0||isNaN(e),Y$=e=>{var{value:t,keyName:n,keys:r}=e,i={keyName:n,keys:r};return t instanceof URL?(0,R.jsx)(W$,q({},i,{children:t})):typeof t==`string`?(0,R.jsx)(R$,q({},i,{children:t})):t===!0?(0,R.jsx)(z$,q({},i,{children:t})):t===!1?(0,R.jsx)(B$,q({},i,{children:t})):t===null?(0,R.jsx)(q$,q({},i,{children:t})):t===void 0?(0,R.jsx)(K$,q({},i,{children:t})):t instanceof Date?(0,R.jsx)(G$,q({},i,{children:t})):typeof t==`number`&&isNaN(t)?(0,R.jsx)(J$,q({},i,{children:t})):typeof t==`number`&&Nue(t)?(0,R.jsx)(V$,q({},i,{children:t})):typeof t==`bigint`?(0,R.jsx)(U$,q({},i,{children:t})):typeof t==`number`?(0,R.jsx)(H$,q({},i,{children:t})):null};Y$.displayName=`JVR.Value`;function X$(e,t,n){var r=XQ(),i=q({},e,t,{className:[e.className,t.className].filter(Boolean).join(` `),style:q({},e.style,t.style),children:t.children||e.children});(0,L.useEffect)(()=>r({[n]:i}),[t])}function Z$(e,t,n){var r=BQ(),i=q({},e,t,{className:[e.className,t.className].filter(Boolean).join(` `),style:q({},e.style,t.style),children:t.children||e.children});(0,L.useEffect)(()=>r({[n]:i}),[t])}function Q$(e,t,n){var r=i$(),i=q({},e,t,{className:[e.className,t.className].filter(Boolean).join(` `),style:q({},e.style,t.style),children:t.children||e.children});(0,L.useEffect)(()=>r({[n]:i}),[t])}var Pue=[`as`,`render`],$$=e=>{var{KeyName:t={}}=t$();return Q$(t,e,`KeyName`),null};$$.displayName=`JVR.KeyName`;var e1=e=>{var{children:t,value:n,parentValue:r,keyName:i,keys:a}=e,o={color:typeof t==`number`?`var(--w-rjv-key-number, #268bd2)`:`var(--w-rjv-key-string, #002b36)`},{KeyName:s={}}=t$(),{as:c,render:l}=s,u=$P(s,Pue);u.style=q({},u.style,o);var d=c||`span`;return l&&typeof l==`function`&&l(q({},u,{children:t}),{value:n,parentValue:r,keyName:i,keys:a||(i?[i]:[])})||(0,R.jsx)(d,q({},u,{children:t}))};e1.displayName=`JVR.KeyNameComp`;var Fue=[`children`,`value`,`parentValue`,`keyName`,`keys`],Iue=[`as`,`render`,`children`],t1=e=>{var{Row:t={}}=t$();return Q$(t,e,`Row`),null};t1.displayName=`JVR.Row`;var n1=e=>{var{children:t,value:n,parentValue:r,keyName:i,keys:a}=e,o=$P(e,Fue),{Row:s={}}=t$(),{as:c,render:l}=s,u=$P(s,Iue),d=c||`div`;return l&&typeof l==`function`&&l(q({},o,u,{children:t}),{value:n,keyName:i,parentValue:r,keys:a})||(0,R.jsx)(d,q({},o,u,{children:t}))};n1.displayName=`JVR.RowComp`;function Lue(e){var t=(0,L.useRef)();return(0,L.useEffect)(()=>{t.current=e}),t.current}function Rue(e){var{value:t,highlightUpdates:n,highlightContainer:r}=e,i=Lue(t),a=(0,L.useMemo)(()=>{if(!n||i===void 0)return!1;if(typeof t!=typeof i)return!0;if(typeof t==`number`)return isNaN(t)&&isNaN(i)?!1:t!==i;if(Array.isArray(t)!==Array.isArray(i))return!0;if(typeof t==`object`||typeof t==`function`)return!1;if(t!==i)return!0},[n,t]);(0,L.useEffect)(()=>{r&&r.current&&a&&`animate`in r.current&&r.current.animate([{backgroundColor:`var(--w-rjv-update-color, #ebcb8b)`},{backgroundColor:``}],{duration:1e3,easing:`ease-in`})},[a,t,r])}var zue=[`keyName`,`value`,`parentValue`,`expandKey`,`keys`,`beforeCopy`],Bue=[`as`,`render`],r1=e=>{var{keyName:t,value:n,parentValue:r,expandKey:i,keys:a,beforeCopy:o}=e,s=$P(e,zue),{onCopied:c,enableClipboard:l,beforeCopy:u}=u$(),d=xQ()[i],[f,p]=(0,L.useState)(!1),{Copied:m={}}=t$(),h=m?.beforeCopy;if(l===!1||!d)return null;var g={style:{display:`inline-flex`},fill:f?`var(--w-rjv-copied-success-color, #28a745)`:`var(--w-rjv-copied-color, currentColor)`,onClick:e=>{e.stopPropagation();var s=``;s=typeof n==`number`&&n===1/0?`Infinity`:typeof n==`number`&&isNaN(n)?`NaN`:typeof n==`bigint`?P$(n):n instanceof Date?n.toLocaleString():JSON.stringify(n,(e,t)=>typeof t==`bigint`?P$(t):t,2);var l=o||h||u;l&&typeof l==`function`&&(s=l(s,t,n,r,i,a)),c&&c(s,n),p(!0),(navigator.clipboard||{writeText(e){return new Promise((t,n)=>{var r=document.createElement(`textarea`);r.style.position=`absolute`,r.style.opacity=`0`,r.style.left=`-99999999px`,r.value=e,document.body.appendChild(r),r.select(),document.execCommand(`copy`)?t():n(),r.remove()})}}).writeText(s).then(()=>{var e=setTimeout(()=>{p(!1),clearTimeout(e)},3e3)}).catch(e=>{})}},{render:_}=m,v=$P(m,Bue),y=q({},v,s,g,{style:q({},v.style,s.style,g.style)});return _&&typeof _==`function`&&_(q({},y,{"data-copied":f}),{value:n,keyName:t,keys:a,parentValue:r})||(f?(0,R.jsx)(`svg`,q({viewBox:`0 0 32 36`},y,{children:(0,R.jsx)(`path`,{d:`M27.5,33 L2.5,33 L2.5,12.5 L27.5,12.5 L27.5,15.2249049 C29.1403264,13.8627542 29.9736597,13.1778155 30,13.1700887 C30,11.9705278 30,10.0804982 30,7.5 C30,6.1 28.9,5 27.5,5 L20,5 C20,2.2 17.8,0 15,0 C12.2,0 10,2.2 10,5 L2.5,5 C1.1,5 0,6.1 0,7.5 L0,33 C0,34.4 1.1,36 2.5,36 L27.5,36 C28.9,36 30,34.4 30,33 L30,26.1114493 L27.5,28.4926435 L27.5,33 Z M7.5,7.5 L10,7.5 C10,7.5 12.5,6.4 12.5,5 C12.5,3.6 13.6,2.5 15,2.5 C16.4,2.5 17.5,3.6 17.5,5 C17.5,6.4 18.8,7.5 20,7.5 L22.5,7.5 C22.5,7.5 25,8.6 25,10 L5,10 C5,8.5 6.1,7.5 7.5,7.5 Z M5,27.5 L10,27.5 L10,25 L5,25 L5,27.5 Z M28.5589286,16 L32,19.6 L21.0160714,30.5382252 L13.5303571,24.2571429 L17.1303571,20.6571429 L21.0160714,24.5428571 L28.5589286,16 Z M17.5,15 L5,15 L5,17.5 L17.5,17.5 L17.5,15 Z M10,20 L5,20 L5,22.5 L10,22.5 L10,20 Z`})})):(0,R.jsx)(`svg`,q({viewBox:`0 0 32 36`},y,{children:(0,R.jsx)(`path`,{d:`M27.5,33 L2.5,33 L2.5,12.5 L27.5,12.5 L27.5,20 L30,20 L30,7.5 C30,6.1 28.9,5 27.5,5 L20,5 C20,2.2 17.8,0 15,0 C12.2,0 10,2.2 10,5 L2.5,5 C1.1,5 0,6.1 0,7.5 L0,33 C0,34.4 1.1,36 2.5,36 L27.5,36 C28.9,36 30,34.4 30,33 L30,29 L27.5,29 L27.5,33 Z M7.5,7.5 L10,7.5 C10,7.5 12.5,6.4 12.5,5 C12.5,3.6 13.6,2.5 15,2.5 C16.4,2.5 17.5,3.6 17.5,5 C17.5,6.4 18.8,7.5 20,7.5 L22.5,7.5 C22.5,7.5 25,8.6 25,10 L5,10 C5,8.5 6.1,7.5 7.5,7.5 Z M5,27.5 L10,27.5 L10,25 L5,25 L5,27.5 Z M22.5,21.5 L22.5,16.5 L12.5,24 L22.5,31.5 L22.5,26.5 L32,26.5 L32,21.5 L22.5,21.5 Z M17.5,15 L5,15 L5,17.5 L17.5,17.5 L17.5,15 Z M10,20 L5,20 L5,22.5 L10,22.5 L10,20 Z`})})))};r1.displayName=`JVR.Copied`;function i1(){var e=(0,L.useRef)(null);return e.current===null&&(e.current=`custom-id-`+Math.random().toString(36).substr(2,9)),e.current}var a1=e=>{var{keyName:t,value:n,expandKey:r=``,level:i,keys:a=[],parentValue:o}=e,s=kQ(),{objectSortKeys:c,indentWidth:l,collapsed:u,shouldExpandNodeInitially:d}=u$(),f=typeof u==`boolean`?u:typeof u==`number`?i>u:!1,p=s[r]??(d?!1:f),m=d&&d(!p,{value:n,keys:a,level:i,keyName:t,parentValue:o});if(d&&u===!1){if(s[r]===void 0&&!m)return null}else if(s[r]===void 0&&m)return null;if(p)return null;var h=Array.isArray(n)?Object.entries(n).map(e=>[Number(e[0]),e[1]]):Object.entries(n);return c&&(h=c===!0?h.sort((e,t)=>{var[n]=e,[r]=t;return typeof n==`string`&&typeof r==`string`?n.localeCompare(r):0}):h.sort((e,t)=>{var[n,r]=e,[i,a]=t;return typeof n==`string`&&typeof i==`string`?c(n,i,r,a):0})),(0,R.jsx)(`div`,{className:`w-rjv-wrap`,style:{borderLeft:`var(--w-rjv-border-left-width, 1px) var(--w-rjv-line-style, solid) var(--w-rjv-line-color, #ebebeb)`,paddingLeft:l,marginLeft:6},children:h.map((e,t)=>{var[r,o]=e;return(0,R.jsx)(s1,{parentValue:n,keyName:r,keys:[...a,r],value:o,level:i},t)})})};a1.displayName=`JVR.KeyValues`;var o1=e=>{var{keyName:t,parentValue:n,keys:r,value:i}=e,{highlightUpdates:a}=u$(),o=typeof t==`number`,s=(0,L.useRef)(null);Rue({value:i,highlightUpdates:a,highlightContainer:s});var c={keyName:t,value:i,keys:r,parentValue:n};return(0,R.jsxs)(L.Fragment,{children:[(0,R.jsxs)(`span`,{ref:s,children:[(0,R.jsx)(S$,q({isNumber:o,"data-placement":`left`},c)),(0,R.jsx)(e1,q({},c,{children:t})),(0,R.jsx)(S$,q({isNumber:o,"data-placement":`right`},c))]}),(0,R.jsx)(w$,q({},c))]})};o1.displayName=`JVR.KayName`;var s1=e=>{var{keyName:t,value:n,parentValue:r,level:i=0,keys:a=[]}=e,o=wQ(),s=i1(),c=Array.isArray(n),l=n instanceof Set,u=n instanceof Map,d=n instanceof Date,f=n instanceof URL;return n&&typeof n==`object`&&!c&&!l&&!u&&!d&&!f||c||l||u?(0,R.jsx)(h1,{keyName:t,value:l?Array.from(n):u?Object.fromEntries(n):n,parentValue:r,initialValue:n,keys:a,level:i+1}):(0,R.jsxs)(n1,q({className:`w-rjv-line`,value:n,keyName:t,keys:a,parentValue:r},{onMouseEnter:()=>o({[s]:!0}),onMouseLeave:()=>o({[s]:!1})},{children:[(0,R.jsx)(o1,{keyName:t,value:n,keys:a,parentValue:r}),(0,R.jsx)(Y$,{keyName:t,value:n,keys:a}),(0,R.jsx)(r1,{keyName:t,value:n,keys:a,parentValue:r,expandKey:s})]}))};s1.displayName=`JVR.KeyValuesItem`;var Vue=[`value`,`keyName`],Hue=[`as`,`render`],c1=e=>{var{CountInfoExtra:t={}}=t$();return Q$(t,e,`CountInfoExtra`),null};c1.displayName=`JVR.CountInfoExtra`;var l1=e=>{var{value:t={},keyName:n}=e,r=$P(e,Vue),{CountInfoExtra:i={}}=t$(),{as:a,render:o}=i,s=$P(i,Hue);if(!o&&!s.children)return null;var c=a||`span`,l=o&&typeof o==`function`,u=q({},s,r);return l&&o(u,{value:t,keyName:n})||(0,R.jsx)(c,q({},u))};l1.displayName=`JVR.CountInfoExtraComps`;var Uue=[`value`,`keyName`],Wue=[`as`,`render`],u1=e=>{var{CountInfo:t={}}=t$();return Q$(t,e,`CountInfo`),null};u1.displayName=`JVR.CountInfo`;var d1=e=>{var{value:t={},keyName:n}=e,r=$P(e,Uue),{displayObjectSize:i}=u$(),{CountInfo:a={}}=t$();if(!i)return null;var{as:o,render:s}=a,c=$P(a,Wue),l=o||`span`;c.style=q({},c.style,e.style);var u=Object.keys(t).length;c.children||=u+` item`+(u===1?``:`s`);var d=q({},c,r);return s&&typeof s==`function`&&s(q({},d,{"data-length":u}),{value:t,keyName:n})||(0,R.jsx)(l,q({},d))};d1.displayName=`JVR.CountInfoComp`;var Gue=[`as`,`render`],f1=e=>{var{Ellipsis:t={}}=t$();return Q$(t,e,`Ellipsis`),null};f1.displayName=`JVR.Ellipsis`;var p1=e=>{var{isExpanded:t,value:n,keyName:r}=e,{Ellipsis:i={}}=t$(),{as:a,render:o}=i,s=$P(i,Gue),c=a||`span`;return o&&typeof o==`function`&&o(q({},s,{"data-expanded":t}),{value:n,keyName:r})||(!t||typeof n==`object`&&Object.keys(n).length==0?null:(0,R.jsx)(c,q({},s)))};p1.displayName=`JVR.EllipsisComp`;var m1=e=>{var{keyName:t,expandKey:n,keys:r=[],initialValue:i,value:a,parentValue:o,level:s}=e,c=kQ(),l=MQ(),{onExpand:u,collapsed:d,shouldExpandNodeInitially:f}=u$(),p=typeof d==`boolean`?d:typeof d==`number`?s>d:!1,m=c[n]??(f?!1:p),h=f&&f(!m,{value:a,keys:r,level:s,keyName:t,parentValue:o});c[n]===void 0&&f&&(m=!h);var g=()=>{var e={expand:!m,value:a,keyid:n,keyName:t};u&&u(e),l({[n]:e.expand})},_={display:`inline-flex`,alignItems:`center`},v={transform:`rotate(`+(m?`-90`:`0`)+`deg)`,transition:`all 0.3s`},y=Object.keys(a).length,b=typeof a==`object`,x=Array.isArray(a),S=a instanceof Set,C=y!==0&&(x||S||b),w={style:_};C&&(w.onClick=g);var T={keyName:t,value:a,keys:r,parentValue:o};return(0,R.jsxs)(`span`,q({},w,{children:[C&&(0,R.jsx)(T$,q({style:v,expandKey:n},T)),(t||typeof t==`number`)&&(0,R.jsx)(o1,q({},T)),(0,R.jsx)(F$,{value:i,keyName:t}),(0,R.jsx)(I$,{value:i,keyName:t}),(0,R.jsx)(E$,q({isBrackets:x||S},T)),(0,R.jsx)(p1,{keyName:t,value:a,isExpanded:m}),(0,R.jsx)(D$,q({isVisiable:m||!C,isBrackets:x||S},T)),(0,R.jsx)(d1,{value:a,keyName:t}),(0,R.jsx)(l1,{value:a,keyName:t}),(0,R.jsx)(r1,{keyName:t,value:a,expandKey:n,parentValue:o,keys:r})]}))};m1.displayName=`JVR.NestedOpen`;var Kue=[`className`,`children`,`parentValue`,`keyid`,`level`,`value`,`initialValue`,`keys`,`keyName`],h1=(0,L.forwardRef)((e,t)=>{var{className:n=``,parentValue:r,level:i=1,value:a,initialValue:o,keys:s,keyName:c}=e,l=$P(e,Kue),u=wQ(),d=i1();return(0,R.jsxs)(`div`,q({className:[n,`w-rjv-inner`].filter(Boolean).join(` `),ref:t},l,{onMouseEnter:()=>u({[d]:!0}),onMouseLeave:()=>u({[d]:!1})},{children:[(0,R.jsx)(m1,{expandKey:d,value:a,level:i,keys:s,parentValue:r,keyName:c,initialValue:o}),(0,R.jsx)(a1,{expandKey:d,value:a,level:i,keys:s,parentValue:r,keyName:c}),(0,R.jsx)(O$,{expandKey:d,value:a,level:i,keys:s,parentValue:r,keyName:c})]}))});h1.displayName=`JVR.Container`;var g1=e=>{var{BraceLeft:t={}}=qQ();return X$(t,e,`BraceLeft`),null};g1.displayName=`JVR.BraceLeft`;var _1=e=>{var{BraceRight:t={}}=qQ();return X$(t,e,`BraceRight`),null};_1.displayName=`JVR.BraceRight`;var v1=e=>{var{BracketsLeft:t={}}=qQ();return X$(t,e,`BracketsLeft`),null};v1.displayName=`JVR.BracketsLeft`;var y1=e=>{var{BracketsRight:t={}}=qQ();return X$(t,e,`BracketsRight`),null};y1.displayName=`JVR.BracketsRight`;var b1=e=>{var{Arrow:t={}}=qQ();return X$(t,e,`Arrow`),null};b1.displayName=`JVR.Arrow`;var x1=e=>{var{Colon:t={}}=qQ();return X$(t,e,`Colon`),null};x1.displayName=`JVR.Colon`;var S1=e=>{var{Quote:t={}}=qQ();return X$(t,e,`Quote`),null};S1.displayName=`JVR.Quote`;var C1=e=>{var{ValueQuote:t={}}=qQ();return X$(t,e,`ValueQuote`),null};C1.displayName=`JVR.ValueQuote`;var w1=e=>{var{Bigint:t={}}=LQ();return Z$(t,e,`Bigint`),null};w1.displayName=`JVR.Bigint`;var T1=e=>{var{Date:t={}}=LQ();return Z$(t,e,`Date`),null};T1.displayName=`JVR.Date`;var E1=e=>{var{False:t={}}=LQ();return Z$(t,e,`False`),null};E1.displayName=`JVR.False`;var D1=e=>{var{Float:t={}}=LQ();return Z$(t,e,`Float`),null};D1.displayName=`JVR.Float`;var O1=e=>{var{Int:t={}}=LQ();return Z$(t,e,`Int`),null};O1.displayName=`JVR.Int`;var k1=e=>{var{Map:t={}}=LQ();return Z$(t,e,`Map`),null};k1.displayName=`JVR.Map`;var A1=e=>{var{Nan:t={}}=LQ();return Z$(t,e,`Nan`),null};A1.displayName=`JVR.Nan`;var j1=e=>{var{Null:t={}}=LQ();return Z$(t,e,`Null`),null};j1.displayName=`JVR.Null`;var M1=e=>{var{Set:t={}}=LQ();return Z$(t,e,`Set`),null};M1.displayName=`JVR.Set`;var N1=e=>{var{Str:t={}}=LQ();return Z$(t,e,`Str`),null};N1.displayName=`JVR.StringText`;var P1=e=>{var{True:t={}}=LQ();return Z$(t,e,`True`),null};P1.displayName=`JVR.True`;var F1=e=>{var{Undefined:t={}}=LQ();return Z$(t,e,`Undefined`),null};F1.displayName=`JVR.Undefined`;var I1=e=>{var{Url:t={}}=LQ();return Z$(t,e,`Url`),null};I1.displayName=`JVR.Url`;var L1=e=>{var{Copied:t={}}=t$();return Q$(t,e,`Copied`),null};L1.displayName=`JVR.Copied`;var que=[`className`,`style`,`value`,`children`,`collapsed`,`shouldExpandNodeInitially`,`indentWidth`,`displayObjectSize`,`shortenTextAfterLength`,`stringEllipsis`,`highlightUpdates`,`enableClipboard`,`displayDataTypes`,`objectSortKeys`,`onExpand`,`onCopied`,`beforeCopy`],R1=(0,L.forwardRef)((e,t)=>{var{className:n=``,style:r,value:i,children:a,collapsed:o=!1,shouldExpandNodeInitially:s,indentWidth:c=15,displayObjectSize:l=!0,shortenTextAfterLength:u=30,stringEllipsis:d,highlightUpdates:f=!0,enableClipboard:p=!0,displayDataTypes:m=!0,objectSortKeys:h=!1,onExpand:g,onCopied:_,beforeCopy:v}=e,y=$P(e,que),b=q({lineHeight:1.4,fontFamily:`var(--w-rjv-font-family, Menlo, monospace)`,color:`var(--w-rjv-color, #002b36)`,backgroundColor:`var(--w-rjv-background-color, #00000000)`,fontSize:13},r),x=[`w-json-view-container`,`w-rjv`,n].filter(Boolean).join(` `);return(0,R.jsxs)(d$,{initialState:{value:i,objectSortKeys:h,indentWidth:c,shouldExpandNodeInitially:o===!1?s:void 0,displayObjectSize:l,collapsed:o,enableClipboard:p,shortenTextAfterLength:u,stringEllipsis:d,highlightUpdates:f,onCopied:_,onExpand:g,beforeCopy:v},initialTypes:{displayDataTypes:m},children:[(0,R.jsx)(h1,q({value:i},y,{ref:t,className:x,style:b})),a]})});R1.Bigint=w1,R1.Date=T1,R1.False=E1,R1.Float=D1,R1.Int=O1,R1.Map=k1,R1.Nan=A1,R1.Null=j1,R1.Set=M1,R1.String=N1,R1.True=P1,R1.Undefined=F1,R1.Url=I1,R1.ValueQuote=C1,R1.Arrow=b1,R1.Colon=x1,R1.Quote=S1,R1.Ellipsis=f1,R1.BraceLeft=g1,R1.BraceRight=_1,R1.BracketsLeft=v1,R1.BracketsRight=y1,R1.Copied=L1,R1.CountInfo=u1,R1.CountInfoExtra=c1,R1.KeyName=$$,R1.Row=t1,R1.displayName=`JVR.JsonView`;var Jue={"--w-rjv-font-family":`monospace`,"--w-rjv-color":`#9cdcfe`,"--w-rjv-key-string":`#9cdcfe`,"--w-rjv-background-color":`#1e1e1e`,"--w-rjv-line-color":`#36334280`,"--w-rjv-arrow-color":`#838383`,"--w-rjv-edit-color":`var(--w-rjv-color)`,"--w-rjv-info-color":`#9c9c9c7a`,"--w-rjv-update-color":`#9cdcfe`,"--w-rjv-copied-color":`#9cdcfe`,"--w-rjv-copied-success-color":`#28a745`,"--w-rjv-curlybraces-color":`#d4d4d4`,"--w-rjv-colon-color":`#d4d4d4`,"--w-rjv-brackets-color":`#d4d4d4`,"--w-rjv-quotes-color":`var(--w-rjv-key-string)`,"--w-rjv-quotes-string-color":`var(--w-rjv-type-string-color)`,"--w-rjv-type-string-color":`#ce9178`,"--w-rjv-type-int-color":`#b5cea8`,"--w-rjv-type-float-color":`#b5cea8`,"--w-rjv-type-bigint-color":`#b5cea8`,"--w-rjv-type-boolean-color":`#569cd6`,"--w-rjv-type-date-color":`#b5cea8`,"--w-rjv-type-url-color":`#3b89cf`,"--w-rjv-type-null-color":`#569cd6`,"--w-rjv-type-nan-color":`#859900`,"--w-rjv-type-undefined-color":`#569cd6`};function z1({value:e,defaultExpandLevel:t=1,className:n=``,maxHeight:r=`24rem`,showControls:i=!0}){let a=Yue(e),[o,s]=(0,L.useState)(t),[c,l]=(0,L.useState)(0),u=(0,L.useCallback)(()=>{s(!1),l(e=>e+1)},[]),d=(0,L.useCallback)(()=>{s(t),l(e=>e+1)},[t]);return a?(0,R.jsxs)(`div`,{className:`min-w-0 max-w-full ${n}`,children:[i?(0,R.jsxs)(`div`,{className:`flex items-center gap-1 mb-1`,children:[(0,R.jsxs)(`button`,{type:`button`,onClick:u,className:`flex items-center gap-1 px-1.5 py-0.5 text-[10px] font-medium text-slate-400 hover:text-slate-200 bg-slate-800/50 hover:bg-slate-700/60 rounded-sm transition-colors`,children:[(0,R.jsx)(Wo,{size:10}),`Expand`]}),(0,R.jsxs)(`button`,{type:`button`,onClick:d,className:`flex items-center gap-1 px-1.5 py-0.5 text-[10px] font-medium text-slate-400 hover:text-slate-200 bg-slate-800/50 hover:bg-slate-700/60 rounded-sm transition-colors`,children:[(0,R.jsx)(Ho,{size:10}),`Collapse`]})]}):null,(0,R.jsx)(`div`,{className:`min-w-0 max-w-full overflow-auto rounded-sm text-xs`,style:{maxHeight:r},children:(0,R.jsx)(R1,{value:a,style:{...Jue,background:`transparent`,fontSize:`12px`,fontFamily:`ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace`},collapsed:o,displayDataTypes:!1,displayObjectSize:!1,enableClipboard:!0,shortenTextAfterLength:120},c)})]}):(0,R.jsx)(`pre`,{className:`max-w-full overflow-auto whitespace-pre-wrap break-words font-mono text-xs text-slate-300 ${n}`,style:{maxHeight:r},children:typeof e==`string`?e:JSON.stringify(e,null,2)})}function Yue(e){if(typeof e==`object`&&e)return e;if(typeof e!=`string`)return null;let t=e.trim();if(!t.startsWith(`{`)&&!t.startsWith(`[`))return null;try{let e=JSON.parse(t);return typeof e==`object`&&e?e:null}catch{return null}}function Xue({piboSessionId:e}){let[t,n]=(0,L.useState)(null),[r,i]=(0,L.useState)(()=>new Set),[a,o]=(0,L.useState)(!1),[s,c]=(0,L.useState)(null),[l,u]=(0,L.useState)(null),d=(0,L.useCallback)(async()=>{if(!e){n(null),i(new Set),c(null),o(!1);return}o(!0);try{n(await iQ({piboSessionId:e})),i(new Set),c(null)}catch(e){c(e instanceof Error?e.message:String(e))}finally{o(!1)}},[e]);(0,L.useEffect)(()=>{d()},[d]);let f=(0,L.useMemo)(()=>t?U1(t.nodes):[],[t]),p=()=>i(new Set(f)),m=()=>i(new Set),h=e=>{i(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},g=async e=>{await navigator.clipboard.writeText(W1(e)),u(e.id),window.setTimeout(()=>u(t=>t===e.id?null:t),1200)};return(0,R.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col bg-[#101d22]`,children:[(0,R.jsxs)(`div`,{className:`flex min-h-14 flex-wrap items-center justify-between gap-3 border-b border-slate-800 bg-[#151f24] px-4 py-3`,children:[(0,R.jsxs)(`div`,{className:`min-w-0`,children:[(0,R.jsx)(`div`,{className:`text-[10px] font-bold uppercase tracking-[0.14em] text-[#11a4d4]`,children:`Context`}),(0,R.jsx)(`h2`,{className:`truncate text-base font-semibold text-slate-100`,children:`Build Context`}),(0,R.jsx)(`div`,{className:`truncate font-mono text-[11px] text-slate-500`,children:t?`${t.profileName} · ${t.piboSessionId??`session`} · ${t.generatedAt}`:e?`session ${e}`:`no session selected`})]}),(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 max-[640px]:w-full`,children:[t?(0,R.jsx)(Zue,{snapshot:t}):null,(0,R.jsx)(B1,{label:`Refresh`,disabled:a||!e,onClick:()=>void d(),children:(0,R.jsx)(Ps,{size:14,className:a?`animate-spin`:void 0})}),(0,R.jsx)(B1,{label:`Expand all`,disabled:!t,onClick:p,children:(0,R.jsx)(Uo,{size:14})}),(0,R.jsx)(B1,{label:`Collapse all`,disabled:!t,onClick:m,children:(0,R.jsx)(Go,{size:14})})]})]}),(0,R.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto p-4`,children:e?a&&!t?(0,R.jsxs)(`div`,{className:`flex items-center gap-2 border border-slate-800 bg-[#151f24] px-4 py-5 text-sm text-slate-400`,children:[(0,R.jsx)(Ss,{size:16,className:`animate-spin text-[#11a4d4]`}),` Loading build context snapshot`]}):s?(0,R.jsxs)(`div`,{className:`grid gap-3 border border-red-500/60 bg-red-500/10 px-4 py-4 text-sm text-red-100`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2 font-semibold`,children:[(0,R.jsx)(Gs,{size:16}),` Build Context failed`]}),(0,R.jsx)(`div`,{className:`font-mono text-xs text-red-200/90`,children:s}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>void d(),className:`w-fit border border-red-400/70 px-3 py-1.5 text-xs text-red-100 hover:bg-red-500/10`,children:`Retry`})]}):t?(0,R.jsxs)(`div`,{className:`grid gap-3`,children:[(0,R.jsx)(`div`,{className:`border border-slate-800 bg-[#151f24] px-4 py-3 text-sm text-slate-400`,children:`Read-only startup context snapshot. Token counts are approximate estimates per contribution; no duplicate final prompt block is rendered.`}),(0,R.jsx)(`div`,{className:`grid min-w-0 gap-2`,children:t.nodes.map(e=>(0,R.jsx)(V1,{node:e,depth:0,expanded:r,copiedNodeId:l,onToggle:h,onCopy:e=>void g(e)},e.id))})]}):(0,R.jsx)(`div`,{className:`border border-dashed border-slate-700 bg-[#151f24] px-4 py-5 text-sm text-slate-500`,children:`No snapshot loaded.`}):(0,R.jsxs)(`div`,{className:`grid gap-3 border border-dashed border-slate-700 bg-[#151f24] px-4 py-5 text-sm text-slate-400`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2 font-semibold text-slate-200`,children:[(0,R.jsx)(Gs,{size:16,className:`text-[#f59e0b]`}),` No session selected`]}),(0,R.jsxs)(`div`,{children:[`Select `,(0,R.jsx)(`span`,{className:`font-mono text-slate-200`,children:`View Context`}),` from a session action menu to inspect that session's agent, workspace, and runtime context.`]})]})})]})}function B1({label:e,disabled:t,onClick:n,children:r}){return(0,R.jsxs)(`button`,{type:`button`,disabled:t,onClick:n,title:e,"aria-label":e,className:`inline-flex h-8 items-center gap-1.5 border border-slate-700 bg-[#101d22] px-2.5 text-xs text-slate-300 hover:border-[#11a4d4] hover:text-[#11a4d4] disabled:opacity-50`,children:[r,(0,R.jsx)(`span`,{className:`max-[640px]:hidden`,children:e})]})}function Zue({snapshot:e}){let t=e.summary.errors>0||e.summary.warnings>0;return(0,R.jsxs)(`span`,{className:`inline-flex h-8 items-center gap-1.5 border px-2.5 text-xs ${t?`border-[#f59e0b]/60 bg-[#f59e0b]/10 text-amber-100`:`border-slate-700 bg-[#101d22] text-slate-300`}`,children:[t?(0,R.jsx)(Gs,{size:14}):(0,R.jsx)(qo,{size:14,className:`text-[#0bda57]`}),(0,R.jsxs)(`span`,{className:`font-mono`,children:[e.summary.totalNodes,` nodes · ~`,K1(e.summary.estimatedTokens),` · `,e.summary.warnings,`w · `,e.summary.errors,`e`]})]})}function V1({node:e,depth:t,expanded:n,copiedNodeId:r,onToggle:i,onCopy:a}){let o=n.has(e.id),s=!!e.children?.length,c=!!(e.hydratedText||e.schemaJson!==void 0||e.payloadJson!==void 0||e.notes?.length),l=s||c;return(0,R.jsxs)(`section`,{className:`${ide(e)} bg-[#1a262b]`,style:{marginLeft:t?Math.min(t*12,72):0},children:[(0,R.jsxs)(`div`,{className:`grid w-full grid-cols-[minmax(0,1fr)_auto] items-center gap-2 border-b border-slate-800 bg-[#151f24] px-3 py-2`,children:[(0,R.jsxs)(`button`,{type:`button`,disabled:!l,onClick:()=>l&&i(e.id),className:`grid min-w-0 grid-cols-[18px_minmax(0,1fr)] items-center gap-2 text-left disabled:cursor-default`,children:[(0,R.jsx)(`span`,{className:`text-slate-500`,children:l?o?(0,R.jsx)(Bo,{size:15}):(0,R.jsx)(Vo,{size:15}):(0,R.jsx)(`span`,{className:`block h-3 w-3`})}),(0,R.jsxs)(`div`,{className:`min-w-0`,children:[(0,R.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-1.5`,children:[(0,R.jsx)(tde,{node:e}),(0,R.jsxs)(`span`,{className:`font-mono text-[10px] text-slate-500`,children:[`#`,e.order+1]}),(0,R.jsx)(`span`,{className:`truncate text-xs font-bold uppercase tracking-[0.12em] text-slate-200`,children:e.title}),(0,R.jsx)(nde,{node:e})]}),(0,R.jsxs)(`div`,{className:`mt-1 flex min-w-0 flex-wrap items-center gap-x-2 gap-y-0.5 font-mono text-[10px] text-slate-500`,children:[(0,R.jsx)(`span`,{children:e.source}),e.state?(0,R.jsx)(`span`,{children:e.state}):null,e.path?(0,R.jsx)(`span`,{className:`max-w-[420px] truncate max-[640px]:max-w-[220px]`,children:e.path}):null,e.key?(0,R.jsx)(`span`,{children:e.key}):null,e.provider?(0,R.jsx)(`span`,{children:e.provider}):null,e.bytes===void 0?null:(0,R.jsx)(`span`,{children:ade(e.bytes)}),e.estimatedTokens===void 0?null:(0,R.jsxs)(`span`,{children:[`~`,K1(e.estimatedTokens)]}),s&&e.estimatedSubtreeTokens!==void 0?(0,R.jsxs)(`span`,{children:[`Σ ~`,K1(e.estimatedSubtreeTokens)]}):null,s?(0,R.jsxs)(`span`,{children:[e.children.length,` children`]}):null]})]})]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-1`,children:[e.redacted?(0,R.jsx)(Hs,{size:14,className:`text-[#0bda57]`,"aria-label":`Redacted`}):null,(0,R.jsx)(`button`,{type:`button`,title:`Copy section`,"aria-label":`Copy section`,onClick:()=>a(e),className:`inline-flex h-7 w-7 items-center justify-center border border-slate-700 bg-[#101d22] text-slate-400 hover:border-[#11a4d4] hover:text-[#11a4d4]`,children:r===e.id?(0,R.jsx)(qo,{size:13,className:`text-[#0bda57]`}):(0,R.jsx)($o,{size:13})})]})]}),o?(0,R.jsxs)(`div`,{className:`grid gap-2 border-t border-slate-900/60 bg-[#101d22]/35 p-2`,children:[e.metadata&&Object.keys(e.metadata).length?(0,R.jsx)($ue,{metadata:e.metadata}):null,e.notes?.length?(0,R.jsx)(ede,{notes:e.notes,approximate:e.approximate}):null,(0,R.jsx)(Que,{node:e}),e.children?.length?(0,R.jsx)(`div`,{className:`grid gap-2 border-l border-slate-700/70 pl-2`,children:e.children.map(e=>(0,R.jsx)(V1,{node:e,depth:t+1,expanded:n,copiedNodeId:r,onToggle:i,onCopy:a},e.id))}):null]}):null]})}function Que({node:e}){return(0,R.jsxs)(R.Fragment,{children:[e.hydratedText?(0,R.jsx)(`pre`,{className:`max-h-[48vh] overflow-auto whitespace-pre-wrap break-words border border-slate-800 bg-[#0e1116] p-3 font-mono text-[12px] leading-relaxed text-slate-200`,children:e.hydratedText}):null,e.schemaJson===void 0?null:(0,R.jsx)(H1,{title:`Schema`,value:e.schemaJson}),e.payloadJson===void 0?null:(0,R.jsx)(H1,{title:`Provider Payload`,value:e.payloadJson})]})}function H1({title:e,value:t}){return(0,R.jsxs)(`div`,{className:`border border-slate-800 bg-[#0e1116]`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-1.5 border-b border-slate-800 px-3 py-2 text-[10px] font-bold uppercase tracking-[0.12em] text-slate-400`,children:[(0,R.jsx)(Po,{size:13}),e]}),(0,R.jsx)(z1,{value:t,defaultExpandLevel:1,showControls:!1,maxHeight:`48vh`,className:`text-xs`})]})}function $ue({metadata:e}){return(0,R.jsx)(`div`,{className:`grid gap-1 border border-slate-800 bg-[#151f24] p-2 sm:grid-cols-2 xl:grid-cols-3`,children:Object.entries(e).map(([e,t])=>(0,R.jsxs)(`div`,{className:`min-w-0 font-mono text-[10px] text-slate-500`,children:[(0,R.jsx)(`span`,{className:`text-slate-400`,children:e}),`: `,(0,R.jsx)(`span`,{className:`break-all text-slate-300`,children:ode(t)})]},e))})}function ede({notes:e,approximate:t}){return(0,R.jsx)(`div`,{className:`border px-3 py-2 text-xs ${t?`border-[#f59e0b]/50 bg-[#f59e0b]/10 text-amber-100`:`border-slate-800 bg-[#151f24] text-slate-400`}`,children:e.map((e,t)=>(0,R.jsx)(`div`,{children:e},t))})}function tde({node:e}){return e.kind.includes(`tool`)?(0,R.jsx)(Js,{size:13,className:`text-[#a855f7]`}):e.kind.includes(`diagnostic`)||e.state===`warning`||e.state===`error`?(0,R.jsx)(Gs,{size:13,className:e.state===`error`?`text-red-400`:`text-[#f59e0b]`}):e.schemaJson!==void 0||e.payloadJson!==void 0?(0,R.jsx)(Po,{size:13,className:`text-[#11a4d4]`}):(0,R.jsx)(ss,{size:13,className:`text-[#11a4d4]`})}function nde({node:e}){let t=[...new Set([...e.badges??[],...e.approximate?[`APPROX`]:[]])];return t.length?(0,R.jsx)(R.Fragment,{children:t.map(e=>(0,R.jsx)(`span`,{className:rde(e),children:e},e))}):null}function rde(e){return e.includes(`ERROR`)?`border border-red-500/60 bg-red-500/10 px-1.5 py-0.5 font-mono text-[9px] text-red-200`:e.includes(`WARNING`)||e.includes(`APPROX`)||e.includes(`SKIPPED`)||e.includes(`DISABLED`)?`border border-[#f59e0b]/60 bg-[#f59e0b]/10 px-1.5 py-0.5 font-mono text-[9px] text-amber-100`:e.includes(`ACTIVE`)||e.includes(`OK`)?`border border-[#0bda57]/50 bg-[#0bda57]/10 px-1.5 py-0.5 font-mono text-[9px] text-emerald-200`:`border border-slate-700 bg-[#101d22] px-1.5 py-0.5 font-mono text-[9px] text-slate-300`}function ide(e){return e.state===`error`?`border border-red-500/60`:e.state===`warning`||e.approximate?`border border-[#f59e0b]/50`:e.kind.includes(`tool`)?`border border-[#a855f7]/35`:`border border-slate-800`}function U1(e){return e.flatMap(e=>[e.id,...U1(e.children??[])])}function W1(e,t=0){let n=` `.repeat(t),r=[`${n}- ${e.title} (${e.source}${e.state?`/${e.state}`:``})`];e.path&&r.push(`${n} path: ${e.path}`),e.key&&r.push(`${n} key: ${e.key}`),e.provider&&r.push(`${n} provider: ${e.provider}`),e.estimatedTokens!==void 0&&r.push(`${n} estimatedTokens: ${e.estimatedTokens}`),e.estimatedSubtreeTokens!==void 0&&r.push(`${n} estimatedSubtreeTokens: ${e.estimatedSubtreeTokens}`),e.notes?.length&&r.push(...e.notes.map(e=>`${n} note: ${e}`)),e.hydratedText&&r.push(`${n} content:\n${G1(e.hydratedText,`${n} `)}`),e.schemaJson!==void 0&&r.push(`${n} schema:\n${G1(JSON.stringify(e.schemaJson,null,2),`${n} `)}`),e.payloadJson!==void 0&&r.push(`${n} payload:\n${G1(JSON.stringify(e.payloadJson,null,2),`${n} `)}`);for(let n of e.children??[])r.push(W1(n,t+1));return r.join(`
151
+ `)}function G1(e,t){return e.split(`
152
+ `).map(e=>`${t}${e}`).join(`
153
+ `)}function ade(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KiB`:`${(e/(1024*1024)).toFixed(1)} MiB`}function K1(e){return`${e.toLocaleString()} tokens`}function ode(e){return e==null?`null`:typeof e==`string`||typeof e==`number`||typeof e==`boolean`?String(e):JSON.stringify(e)}function sde({activePanel:e,onSelect:t,toolCount:n,mcpServerCount:r}){return(0,R.jsx)(`div`,{className:`p-2`,children:(0,R.jsxs)(`div`,{className:`mb-4`,children:[(0,R.jsx)(`div`,{className:`px-1 pb-1 text-[10px] font-bold uppercase tracking-wider text-slate-500`,children:`Context`}),(0,R.jsxs)(`button`,{type:`button`,onClick:()=>t(`context-files`),className:`mb-1 flex w-full items-center gap-2 border p-2 text-left ${e===`context-files`?`border-[#11a4d4] bg-[#11a4d4]/10`:`border-slate-800 bg-[#151f24] hover:border-slate-700`}`,children:[(0,R.jsx)(vs,{size:13,className:`text-[#11a4d4]`}),(0,R.jsxs)(`div`,{className:`min-w-0`,children:[(0,R.jsx)(`span`,{className:`block truncate text-sm text-slate-200`,children:`Context Files`}),(0,R.jsx)(`span`,{className:`block truncate font-mono text-[10px] text-slate-500`,children:`managed-editor`})]})]}),(0,R.jsxs)(`button`,{type:`button`,onClick:()=>t(`base-prompt`),className:`mb-1 flex w-full items-center gap-2 border p-2 text-left ${e===`base-prompt`?`border-[#11a4d4] bg-[#11a4d4]/10`:`border-slate-800 bg-[#151f24] hover:border-slate-700`}`,children:[(0,R.jsx)(Mo,{size:13,className:`text-[#11a4d4]`}),(0,R.jsxs)(`div`,{className:`min-w-0`,children:[(0,R.jsx)(`span`,{className:`block truncate text-sm text-slate-200`,children:`Base Prompt`}),(0,R.jsx)(`span`,{className:`block truncate font-mono text-[10px] text-slate-500`,children:`system-prompt`})]})]}),(0,R.jsxs)(`button`,{type:`button`,onClick:()=>t(`compaction-prompt`),className:`mb-1 flex w-full items-center gap-2 border p-2 text-left ${e===`compaction-prompt`?`border-[#11a4d4] bg-[#11a4d4]/10`:`border-slate-800 bg-[#151f24] hover:border-slate-700`}`,children:[(0,R.jsx)(Fo,{size:13,className:`text-[#11a4d4]`}),(0,R.jsxs)(`div`,{className:`min-w-0`,children:[(0,R.jsx)(`span`,{className:`block truncate text-sm text-slate-200`,children:`Compaction Prompt`}),(0,R.jsx)(`span`,{className:`block truncate font-mono text-[10px] text-slate-500`,children:`summary-prompt`})]})]}),(0,R.jsxs)(`button`,{type:`button`,onClick:()=>t(`pibo-tools`),className:`mb-1 flex w-full items-center gap-2 border p-2 text-left ${e===`pibo-tools`?`border-[#11a4d4] bg-[#11a4d4]/10`:`border-slate-800 bg-[#151f24] hover:border-slate-700`}`,children:[(0,R.jsx)(Js,{size:13,className:`text-[#11a4d4]`}),(0,R.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,R.jsx)(`span`,{className:`block truncate text-sm text-slate-200`,children:`Pibo Tools`}),(0,R.jsx)(`span`,{className:`block truncate font-mono text-[10px] text-slate-500`,children:`installed-tool-context`})]}),(0,R.jsx)(`span`,{className:`inline-flex min-w-6 items-center justify-center border border-slate-700 bg-[#101d22] px-1.5 py-0.5 text-[10px] font-mono text-slate-400`,children:n})]}),(0,R.jsxs)(`button`,{type:`button`,onClick:()=>t(`mcp-tools`),className:`mb-1 flex w-full items-center gap-2 border p-2 text-left ${e===`mcp-tools`?`border-[#11a4d4] bg-[#11a4d4]/10`:`border-slate-800 bg-[#151f24] hover:border-slate-700`}`,children:[(0,R.jsx)(Bs,{size:13,className:`text-[#11a4d4]`}),(0,R.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,R.jsx)(`span`,{className:`block truncate text-sm text-slate-200`,children:`MCP Tools`}),(0,R.jsx)(`span`,{className:`block truncate font-mono text-[10px] text-slate-500`,children:`mcp-context`})]}),(0,R.jsx)(`span`,{className:`inline-flex min-w-6 items-center justify-center border border-slate-700 bg-[#101d22] px-1.5 py-0.5 text-[10px] font-mono text-slate-400`,children:r})]}),(0,R.jsxs)(`button`,{type:`button`,onClick:()=>t(`build-context`),className:`flex w-full items-center gap-2 border p-2 text-left ${e===`build-context`?`border-[#11a4d4] bg-[#11a4d4]/10`:`border-slate-800 bg-[#151f24] hover:border-slate-700`}`,children:[(0,R.jsx)(Io,{size:13,className:`text-[#11a4d4]`}),(0,R.jsxs)(`div`,{className:`min-w-0`,children:[(0,R.jsx)(`span`,{className:`block truncate text-sm text-slate-200`,children:`Build Context`}),(0,R.jsx)(`span`,{className:`block truncate font-mono text-[10px] text-slate-500`,children:`runtime-snapshot`})]})]})]})})}async function cde(){return B(`/api/chat/cron/status`)}async function lde(e=!0){let t=new URLSearchParams;return e&&t.set(`includeDisabled`,`true`),B(`/api/chat/cron/jobs${t.size?`?${t.toString()}`:``}`)}async function ude(e){return B(`/api/chat/cron/jobs`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(e)})}async function q1(e,t){return B(`/api/chat/cron/jobs/${encodeURIComponent(e)}`,{method:`PATCH`,headers:{"content-type":`application/json`},body:JSON.stringify(t)})}async function dde(e){return B(`/api/chat/cron/jobs/${encodeURIComponent(e)}`,{method:`DELETE`,headers:{"content-type":`application/json`},body:`{}`})}async function fde(e){return B(`/api/chat/cron/jobs/${encodeURIComponent(e)}/run`,{method:`POST`,headers:{"content-type":`application/json`},body:`{}`})}async function J1(e,t=100){let n=new URLSearchParams({limit:String(t)});return e&&n.set(`jobId`,e),B(`/api/chat/cron/runs?${n.toString()}`)}var pde=[{kind:`in`,title:`Einmal später`,description:`z.B. in 20 Minuten`},{kind:`at`,title:`Einmal am Datum`,description:`Datepicker + Uhrzeit`},{kind:`daily`,title:`Täglich`,description:`Cron aus Uhrzeit`},{kind:`weekly`,title:`Wöchentlich`,description:`Wochentage wählen`},{kind:`monthly`,title:`Monatlich`,description:`Tag im Monat`},{kind:`every`,title:`Intervall`,description:`*/n Cron-Rhythmus`},{kind:`cron`,title:`Cron direkt`,description:`5 Felder manuell`}],mde=[{value:1,short:`Mo`,label:`Montag`},{value:2,short:`Di`,label:`Dienstag`},{value:3,short:`Mi`,label:`Mittwoch`},{value:4,short:`Do`,label:`Donnerstag`},{value:5,short:`Fr`,label:`Freitag`},{value:6,short:`Sa`,label:`Samstag`},{value:0,short:`So`,label:`Sonntag`}];function hde({bootstrap:e,mobileSidebarOpen:t=!1,onCloseMobileSidebar:n}){let r=(0,L.useMemo)(()=>Cde(e.rooms),[e.rooms]),i=(0,L.useMemo)(()=>wde(e.agents,e.customAgents),[e.agents,e.customAgents]),a=i[0]?.name??`base`,[o,s]=(0,L.useState)([]),[c,l]=(0,L.useState)([]),[u,d]=(0,L.useState)(null),[f,p]=(0,L.useState)(null),[m,h]=(0,L.useState)(()=>i0(a,r)),[g,_]=(0,L.useState)(!0),[v,y]=(0,L.useState)(!1),[b,x]=(0,L.useState)(null),S=o.find(e=>e.id===f)??null,C=f?c.filter(e=>e.jobId===f):c,w=(0,L.useMemo)(()=>Sde(m),[m]),T=S?Tde(S):!1,E=async(e=f)=>{_(!0);try{let[t,n,r]=await Promise.all([cde(),lde(!0),J1(e??void 0,100)]);d(t.status),s(n.jobs),l(r.runs),x(null)}catch(e){x(h0(e))}finally{_(!1)}};(0,L.useEffect)(()=>{E(null)},[]);let D=()=>{p(null),h(i0(a,r))},O=async e=>{p(e.id),h(a0(e,a,r)),n?.();try{l((await J1(e.id,100)).runs)}catch(e){x(h0(e))}},k=async()=>{y(!0);try{let e=bde(m),t=S?await q1(S.id,e):await ude(e);p(t.job.id),h(a0(t.job,a,r)),await E(t.job.id),x(null)}catch(e){x(h0(e))}finally{y(!1)}},A=async()=>{if(!(!S||!window.confirm(`Delete cron job "${S.name}"?`))){y(!0);try{await dde(S.id),D(),await E(null)}catch(e){x(h0(e))}finally{y(!1)}}},j=async()=>{if(S){y(!0);try{await fde(S.id),await E(S.id)}catch(e){x(h0(e))}finally{y(!1)}}},M=async()=>{if(!(!S||!T)){y(!0);try{let e=await q1(S.id,{enabled:!S.enabled});h(a0(e.job,a,r)),await E(e.job.id),x(null)}catch(e){x(h0(e))}finally{y(!1)}}};return(0,R.jsxs)(`div`,{className:`min-h-0 grid grid-cols-[340px_minmax(0,1fr)] max-[980px]:grid-cols-1 h-full overflow-hidden`,children:[(0,R.jsx)(`div`,{className:`fixed inset-0 z-30 bg-black/60 min-[981px]:hidden transition-opacity duration-200 ${t?`opacity-100 pointer-events-auto`:`opacity-0 pointer-events-none`}`,onClick:n}),(0,R.jsxs)(`aside`,{className:`min-h-0 overflow-auto bg-[#1a262b] border-r border-slate-800 max-[980px]:fixed max-[980px]:left-0 max-[980px]:top-0 max-[980px]:bottom-0 max-[980px]:z-40 max-[980px]:w-[280px] max-[980px]:transition-transform max-[980px]:duration-200 ${t?`max-[980px]:translate-x-0`:`max-[980px]:-translate-x-full`}`,children:[(0,R.jsxs)(`div`,{className:`h-11 px-3 border-b border-slate-800 flex items-center justify-between text-xs font-bold uppercase tracking-wider max-[980px]:h-auto max-[980px]:py-2`,children:[(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,R.jsx)(Lo,{size:14}),` Cron Jobs`]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,R.jsx)(`button`,{type:`button`,onClick:()=>void E(),title:`Refresh`,"aria-label":`Refresh`,className:`p-1 border border-slate-700 rounded-sm text-slate-400 hover:border-[#11a4d4] hover:text-[#11a4d4]`,children:(0,R.jsx)(Ps,{size:13})}),(0,R.jsx)(`button`,{type:`button`,onClick:D,title:`New Cron Job`,"aria-label":`New Cron Job`,className:`p-1 border border-slate-700 rounded-sm text-slate-400 hover:border-[#11a4d4] hover:text-[#11a4d4]`,children:(0,R.jsx)(js,{size:13})}),(0,R.jsx)(`button`,{type:`button`,onClick:n,title:`Close sidebar`,"aria-label":`Close sidebar`,className:`min-[981px]:hidden p-1 border border-slate-700 rounded-sm text-slate-400 hover:border-[#11a4d4] hover:text-[#11a4d4]`,children:(0,R.jsx)(Ys,{size:13})})]})]}),(0,R.jsxs)(`div`,{className:`p-3 space-y-3`,children:[(0,R.jsxs)(`div`,{className:`grid grid-cols-3 gap-2 text-center text-[11px]`,children:[(0,R.jsx)(r0,{label:`Jobs`,value:u?.jobs??o.length}),(0,R.jsx)(r0,{label:`Running`,value:u?.running??0}),(0,R.jsx)(r0,{label:`Next`,value:u?.nextRunAt?f0(u.nextRunAt):`-`})]}),g&&o.length===0?(0,R.jsxs)(`div`,{className:`text-sm text-slate-400 flex items-center gap-2`,children:[(0,R.jsx)(Ss,{size:14,className:`animate-spin`}),` Loading cron jobs…`]}):null,o.length===0&&!g?(0,R.jsx)(`div`,{className:`px-2 py-3 text-xs text-slate-500 border border-dashed border-slate-700 rounded-sm`,children:`No cron jobs yet.`}):null,(0,R.jsx)(`div`,{className:`space-y-2`,children:o.map(e=>(0,R.jsxs)(`button`,{type:`button`,onClick:()=>void O(e),className:`w-full text-left rounded-sm border px-3 py-2 ${f===e.id?`border-[#11a4d4] bg-[#11a4d4]/10`:`border-slate-800 hover:border-slate-700 hover:bg-slate-900/40`}`,children:[(0,R.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,R.jsxs)(`div`,{className:`min-w-0`,children:[(0,R.jsx)(`div`,{className:`truncate text-sm font-medium text-slate-100`,children:e.name}),(0,R.jsx)(`div`,{className:`truncate text-[11px] text-slate-500`,children:Ede(e)})]}),(0,R.jsx)(`span`,{className:`shrink-0 text-[10px] px-1.5 py-0.5 rounded-sm border ${e.enabled?`border-emerald-500/40 text-emerald-300`:`border-slate-600 text-slate-500`}`,children:e.enabled?`on`:`off`})]}),(0,R.jsxs)(`div`,{className:`mt-1 text-[11px] text-slate-500`,children:[`Next: `,e.state.nextRunAt?f0(e.state.nextRunAt):`-`]})]},e.id))})]})]}),(0,R.jsx)(`main`,{className:`min-h-0 overflow-auto`,children:(0,R.jsxs)(`div`,{className:`max-w-5xl mx-auto p-5 space-y-5`,children:[(0,R.jsxs)(`div`,{className:`flex items-start justify-between gap-3 flex-wrap`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{className:`text-xs uppercase tracking-[0.16em] text-[#11a4d4] font-bold`,children:`Scheduled Pibo Sessions`}),(0,R.jsx)(`h1`,{className:`text-2xl font-bold text-slate-100`,children:S?S.name:`New cron job`}),(0,R.jsx)(`p`,{className:`text-sm text-slate-400`,children:`Each run creates a visible Pibo Session in the selected Shared Chat or Room.`})]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[T?(0,R.jsxs)(`button`,{type:`button`,onClick:()=>void M(),disabled:v,className:`h-9 px-3 inline-flex items-center gap-2 rounded-sm border disabled:opacity-50 ${S?.enabled?`border-amber-500/50 text-amber-300 hover:border-amber-400`:`border-emerald-500/50 text-emerald-300 hover:border-emerald-400`}`,children:[S?.enabled?(0,R.jsx)(Os,{size:14}):(0,R.jsx)(As,{size:14}),` `,S?.enabled?`Stop`:`Resume`]}):null,S?(0,R.jsxs)(`button`,{type:`button`,onClick:()=>void j(),disabled:v,className:`h-9 px-3 inline-flex items-center gap-2 rounded-sm border border-slate-700 text-slate-300 hover:border-[#11a4d4] hover:text-[#11a4d4] disabled:opacity-50`,children:[(0,R.jsx)(As,{size:14}),` Run now`]}):null,(0,R.jsxs)(`button`,{type:`button`,onClick:()=>void k(),disabled:v,className:`h-9 px-3 inline-flex items-center gap-2 rounded-sm border border-[#11a4d4] bg-[#11a4d4]/10 text-[#11a4d4] disabled:opacity-50`,children:[v?(0,R.jsx)(Ss,{size:14,className:`animate-spin`}):(0,R.jsx)(Ls,{size:14}),` Save`]}),S?(0,R.jsxs)(`button`,{type:`button`,onClick:()=>void A(),disabled:v,className:`h-9 px-3 inline-flex items-center gap-2 rounded-sm border border-red-500/40 text-red-300 hover:border-red-400 disabled:opacity-50`,children:[(0,R.jsx)(Ws,{size:14}),` Delete`]}):null]})]}),b?(0,R.jsx)(_de,{message:b}):null,(0,R.jsxs)(`section`,{className:`grid grid-cols-2 gap-4 max-[980px]:grid-cols-1`,children:[(0,R.jsxs)(Z1,{title:`Job`,children:[(0,R.jsx)(Q1,{label:`Name`,children:(0,R.jsx)(`input`,{value:m.name,onChange:e=>h({...m,name:e.target.value}),className:Y1,placeholder:`Daily standup summary`})}),(0,R.jsx)(Q1,{label:`Description`,children:(0,R.jsx)(`input`,{value:m.description,onChange:e=>h({...m,description:e.target.value}),className:Y1,placeholder:`Optional`})}),(0,R.jsx)(Q1,{label:`Agent`,children:(0,R.jsx)(`select`,{value:m.profile,onChange:e=>h({...m,profile:e.target.value}),className:Y1,children:i.map(e=>(0,R.jsx)(`option`,{value:e.name,children:e.name},e.name))})}),(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsx)(`div`,{className:`text-[11px] font-bold uppercase tracking-wider text-slate-500`,children:`Target`}),(0,R.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,R.jsx)($1,{name:`target-kind`,checked:m.targetKind===`default-chat`,title:`Shared Chat`,description:`Runs in the shared default chat`,onChange:()=>h({...m,targetKind:`default-chat`})}),(0,R.jsx)($1,{name:`target-kind`,checked:m.targetKind===`room`,title:`Room`,description:`Uses the room workspace`,onChange:()=>h({...m,targetKind:`room`})})]})]}),m.targetKind===`room`?(0,R.jsx)(Q1,{label:`Room`,children:(0,R.jsx)(`select`,{value:m.roomId,onChange:e=>h({...m,roomId:e.target.value}),className:Y1,children:r.map(e=>(0,R.jsxs)(`option`,{value:e.id,disabled:e.archived,children:[e.label,e.archived?` (archived)`:``]},e.id))})}):null,(0,R.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 pt-1`,children:[(0,R.jsx)(e0,{checked:m.enabled,label:`Enabled`,onChange:e=>h({...m,enabled:e})}),(0,R.jsx)(e0,{checked:m.deleteAfterRun,label:`Delete one-shot after success`,onChange:e=>h({...m,deleteAfterRun:e})})]})]}),(0,R.jsxs)(Z1,{title:`Schedule Builder`,children:[(0,R.jsx)(`div`,{className:`grid grid-cols-2 gap-2 max-[720px]:grid-cols-1`,children:pde.map(e=>(0,R.jsx)($1,{name:`schedule-kind`,checked:m.scheduleKind===e.kind,title:e.title,description:e.description,onChange:()=>h({...m,scheduleKind:e.kind})},e.kind))}),(0,R.jsxs)(`div`,{className:`rounded-sm border border-slate-800 bg-[#101d22] p-3 space-y-3`,children:[m.scheduleKind===`in`?(0,R.jsx)(t0,{label:`Run after`,amount:m.inAmount,unit:m.inUnit,onAmount:e=>h({...m,inAmount:e}),onUnit:e=>h({...m,inUnit:e})}):null,m.scheduleKind===`at`?(0,R.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,R.jsx)(Q1,{label:`Date`,children:(0,R.jsx)(`input`,{type:`date`,value:m.atDate,onChange:e=>h({...m,atDate:e.target.value}),className:Y1})}),(0,R.jsx)(Q1,{label:`Time`,children:(0,R.jsx)(`input`,{type:`time`,value:m.atTime,onChange:e=>h({...m,atTime:e.target.value}),className:Y1})})]}):null,m.scheduleKind===`every`?(0,R.jsx)(t0,{label:`Every`,amount:m.everyAmount,unit:m.everyUnit,onAmount:e=>h({...m,everyAmount:e}),onUnit:e=>h({...m,everyUnit:e})}):null,m.scheduleKind===`daily`?(0,R.jsx)(Q1,{label:`Time`,children:(0,R.jsx)(`input`,{type:`time`,value:m.dailyTime,onChange:e=>h({...m,dailyTime:e.target.value}),className:Y1})}):null,m.scheduleKind===`weekly`?(0,R.jsxs)(`div`,{className:`space-y-3`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{className:`mb-1 text-[11px] font-bold uppercase tracking-wider text-slate-500`,children:`Weekdays`}),(0,R.jsx)(`div`,{className:`grid grid-cols-7 gap-1 max-[720px]:grid-cols-4`,children:mde.map(e=>(0,R.jsx)(gde,{checked:m.weeklyDays.includes(e.value),label:e.short,title:e.label,onChange:t=>h({...m,weeklyDays:Dde(m.weeklyDays,e.value,t)})},e.value))})]}),(0,R.jsx)(Q1,{label:`Time`,children:(0,R.jsx)(`input`,{type:`time`,value:m.time,onChange:e=>h({...m,time:e.target.value}),className:Y1})})]}):null,m.scheduleKind===`monthly`?(0,R.jsxs)(`div`,{className:`grid grid-cols-[120px_minmax(0,1fr)] gap-3 max-[720px]:grid-cols-1`,children:[(0,R.jsx)(Q1,{label:`Day`,children:(0,R.jsx)(`select`,{value:m.monthlyDay,onChange:e=>h({...m,monthlyDay:e.target.value}),className:Y1,children:Array.from({length:31},(e,t)=>String(t+1)).map(e=>(0,R.jsx)(`option`,{value:e,children:e},e))})}),(0,R.jsx)(Q1,{label:`Time`,children:(0,R.jsx)(`input`,{type:`time`,value:m.time,onChange:e=>h({...m,time:e.target.value}),className:Y1})})]}):null,m.scheduleKind===`cron`?(0,R.jsx)(Q1,{label:`5-field cron expression`,children:(0,R.jsx)(`input`,{value:m.cronExpr,onChange:e=>h({...m,cronExpr:e.target.value}),className:`${Y1} font-mono`,placeholder:`0 8 * * 1-5`})}):null,(0,R.jsx)(Q1,{label:`Timezone`,children:(0,R.jsx)(`input`,{value:m.tz,onChange:e=>h({...m,tz:e.target.value}),className:Y1,placeholder:`optional, e.g. Europe/Berlin`})})]}),(0,R.jsxs)(`div`,{className:`rounded-sm border px-3 py-2 ${w.kind===`error`?`border-red-500/40 bg-red-500/10`:`border-[#11a4d4]/30 bg-[#11a4d4]/10`}`,children:[(0,R.jsx)(`div`,{className:`text-[11px] font-bold uppercase tracking-wider text-slate-500`,children:`Generated schedule`}),(0,R.jsx)(`div`,{className:`mt-1 font-mono text-sm text-slate-100`,children:w.value}),(0,R.jsx)(`div`,{className:`mt-1 text-xs text-slate-500`,children:w.description})]}),(0,R.jsxs)(`div`,{className:`text-xs text-slate-500`,children:[`Agents use the CLI for the same result, e.g. `,(0,R.jsxs)(`code`,{className:`text-slate-300`,children:[`pibo cron add --cron "`,w.kind===`cron`?w.value:`0 8 * * *`,`" --prompt "..." --default-chat`]}),`.`]})]})]}),(0,R.jsx)(Z1,{title:`Prompt / Task`,children:(0,R.jsx)(`textarea`,{value:m.prompt,onChange:e=>h({...m,prompt:e.target.value}),className:`${Y1} min-h-40 resize-y leading-relaxed`,placeholder:`What should the agent do on each run?`})}),(0,R.jsx)(Z1,{title:S?`Recent runs`:`Recent runs will appear after saving`,children:C.length===0?(0,R.jsx)(`div`,{className:`text-sm text-slate-500`,children:`No runs yet.`}):(0,R.jsx)(`div`,{className:`overflow-auto`,children:(0,R.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,R.jsx)(`thead`,{className:`text-[10px] uppercase tracking-wider text-slate-500`,children:(0,R.jsxs)(`tr`,{children:[(0,R.jsx)(`th`,{className:`text-left py-2`,children:`Status`}),(0,R.jsx)(`th`,{className:`text-left py-2`,children:`Started`}),(0,R.jsx)(`th`,{className:`text-left py-2`,children:`Session`}),(0,R.jsx)(`th`,{className:`text-left py-2`,children:`Error`})]})}),(0,R.jsx)(`tbody`,{children:C.map(e=>(0,R.jsxs)(`tr`,{className:`border-t border-slate-800`,children:[(0,R.jsx)(`td`,{className:`py-2`,children:(0,R.jsx)(vde,{status:e.status})}),(0,R.jsx)(`td`,{className:`py-2 text-slate-400`,children:f0(e.startedAt??e.createdAt)}),(0,R.jsx)(`td`,{className:`py-2`,children:e.piboSessionId?(0,R.jsxs)(`a`,{className:`text-[#11a4d4] hover:underline`,href:`/apps/chat/sessions/${encodeURIComponent(e.piboSessionId)}`,children:[e.piboSessionId.slice(0,10),`…`]}):(0,R.jsx)(`span`,{className:`text-slate-600`,children:`-`})}),(0,R.jsx)(`td`,{className:`py-2 text-red-300`,children:e.error??``})]},e.id))})]})})})]})})]})}var Y1=`w-full rounded-sm border border-slate-700 bg-[#101d22] px-3 py-2 text-sm text-slate-200 outline-none focus:border-[#11a4d4] disabled:opacity-50`,X1=`sr-only peer`;function Z1({title:e,children:t}){return(0,R.jsxs)(`section`,{className:`rounded-sm border border-slate-800 bg-[#152126] p-4 space-y-3`,children:[(0,R.jsx)(`h2`,{className:`text-xs font-bold uppercase tracking-wider text-slate-400`,children:e}),t]})}function Q1({label:e,children:t}){return(0,R.jsxs)(`label`,{className:`block space-y-1`,children:[(0,R.jsx)(`span`,{className:`text-[11px] font-bold uppercase tracking-wider text-slate-500`,children:e}),t]})}function $1({name:e,checked:t,title:n,description:r,onChange:i}){return(0,R.jsxs)(`label`,{className:`block cursor-pointer`,children:[(0,R.jsx)(`input`,{type:`radio`,name:e,checked:t,onChange:i,className:X1}),(0,R.jsxs)(`span`,{className:`block rounded-sm border border-slate-700 bg-[#101d22] px-3 py-2 text-sm text-slate-300 peer-checked:border-[#11a4d4] peer-checked:bg-[#11a4d4]/10 peer-checked:text-slate-100 hover:border-slate-500`,children:[(0,R.jsxs)(`span`,{className:`flex items-center gap-2 font-medium`,children:[(0,R.jsx)(`span`,{className:`h-3 w-3 rounded-full border ${t?`border-[#11a4d4] bg-[#11a4d4]`:`border-slate-500`}`}),n]}),(0,R.jsx)(`span`,{className:`mt-0.5 block text-[11px] text-slate-500`,children:r})]})]})}function e0({checked:e,label:t,onChange:n}){return(0,R.jsxs)(`label`,{className:`flex items-center gap-2 rounded-sm border border-slate-800 bg-[#101d22] px-3 py-2 text-sm text-slate-300`,children:[(0,R.jsx)(`input`,{type:`checkbox`,checked:e,onChange:e=>n(e.target.checked),className:`h-4 w-4 accent-[#11a4d4]`}),(0,R.jsx)(`span`,{children:t})]})}function t0({label:e,amount:t,unit:n,onAmount:r,onUnit:i}){return(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsx)(`div`,{className:`text-[11px] font-bold uppercase tracking-wider text-slate-500`,children:e}),(0,R.jsxs)(`div`,{className:`grid grid-cols-[110px_minmax(0,1fr)] gap-2 max-[720px]:grid-cols-1`,children:[(0,R.jsx)(`input`,{type:`number`,min:`1`,step:`1`,value:t,onChange:e=>r(e.target.value),className:Y1}),(0,R.jsxs)(`div`,{className:`grid grid-cols-3 gap-2`,children:[(0,R.jsx)(n0,{name:`${e}-unit`,checked:n===`minutes`,label:`Minutes`,onChange:()=>i(`minutes`)}),(0,R.jsx)(n0,{name:`${e}-unit`,checked:n===`hours`,label:`Hours`,onChange:()=>i(`hours`)}),(0,R.jsx)(n0,{name:`${e}-unit`,checked:n===`days`,label:`Days`,onChange:()=>i(`days`)})]})]})]})}function n0({name:e,checked:t,label:n,onChange:r}){return(0,R.jsxs)(`label`,{className:`cursor-pointer`,children:[(0,R.jsx)(`input`,{type:`radio`,name:e,checked:t,onChange:r,className:X1}),(0,R.jsx)(`span`,{className:`block rounded-sm border border-slate-700 bg-[#101d22] px-2 py-2 text-center text-xs text-slate-400 peer-checked:border-[#11a4d4] peer-checked:text-[#11a4d4] hover:border-slate-500`,children:n})]})}function gde({checked:e,label:t,title:n,onChange:r}){return(0,R.jsxs)(`label`,{title:n,className:`cursor-pointer`,children:[(0,R.jsx)(`input`,{type:`checkbox`,checked:e,onChange:e=>r(e.target.checked),className:`sr-only peer`}),(0,R.jsx)(`span`,{className:`block rounded-sm border border-slate-700 bg-[#101d22] px-2 py-2 text-center text-xs font-semibold text-slate-400 peer-checked:border-[#11a4d4] peer-checked:bg-[#11a4d4]/10 peer-checked:text-[#11a4d4] hover:border-slate-500`,children:t})]})}function r0({label:e,value:t}){return(0,R.jsxs)(`div`,{className:`rounded-sm border border-slate-800 bg-[#101d22] px-2 py-2`,children:[(0,R.jsx)(`div`,{className:`text-slate-100 font-semibold truncate`,children:t}),(0,R.jsx)(`div`,{className:`text-[10px] uppercase tracking-wider text-slate-500`,children:e})]})}function _de({message:e}){return(0,R.jsxs)(`div`,{className:`rounded-sm border border-red-500/40 bg-red-500/10 px-3 py-2 text-sm text-red-100 flex items-start gap-2`,children:[(0,R.jsx)(Gs,{size:16,className:`mt-0.5 text-red-300`}),` `,(0,R.jsx)(`span`,{children:e})]})}function vde({status:e}){return(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-sm border px-1.5 py-0.5 text-[11px] ${e===`ok`?`border-emerald-500/40 text-emerald-300`:e===`error`?`border-red-500/40 text-red-300`:e===`running`?`border-[#11a4d4]/50 text-[#11a4d4]`:`border-slate-600 text-slate-400`}`,children:[e===`running`?(0,R.jsx)(Ss,{size:11,className:`animate-spin`}):null,e]})}function i0(e,t){let n=new Date(Date.now()+60*6e4);return{name:``,description:``,enabled:!0,targetKind:`default-chat`,roomId:t.find(e=>!e.archived)?.id??``,profile:e,prompt:``,scheduleKind:`daily`,inAmount:`20`,inUnit:`minutes`,atDate:p0(n),atTime:m0(n),everyAmount:`1`,everyUnit:`hours`,dailyTime:`08:00`,weeklyDays:[1,3,5],monthlyDay:`1`,time:`08:00`,cronExpr:`0 8 * * *`,tz:``,deleteAfterRun:!1}}function a0(e,t,n){let r=i0(t,n);if(r.name=e.name,r.description=e.description??``,r.enabled=e.enabled,r.targetKind=e.target.kind,r.roomId=e.target.kind===`room`?e.target.roomId:r.roomId,r.profile=e.profile,r.prompt=e.prompt,r.deleteAfterRun=!!e.deleteAfterRun,e.scheduleUi)yde(r,e.scheduleUi);else if(e.schedule.kind===`cron`)s0(r,e.schedule.expr),r.tz=e.schedule.tz??``;else if(e.schedule.kind===`every`){r.scheduleKind=`every`;let t=kde(e.schedule.everyMs);r.everyAmount=String(t.amount),r.everyUnit=t.unit}else{r.scheduleKind=`at`;let t=new Date(e.schedule.at);r.atDate=p0(t),r.atTime=m0(t)}return r}function yde(e,t){switch(e.tz=`tz`in t?t.tz??``:``,t.preset){case`in`:e.scheduleKind=`in`,e.inAmount=String(t.amount),e.inUnit=t.unit;break;case`at`:{let[n,r=`08:00`]=t.localDateTime.split(`T`);e.scheduleKind=`at`,e.atDate=n||e.atDate,e.atTime=r.slice(0,5);break}case`every`:e.scheduleKind=`every`,e.everyAmount=String(t.amount),e.everyUnit=t.unit;break;case`daily`:e.scheduleKind=`daily`,e.dailyTime=t.time;break;case`weekly`:e.scheduleKind=`weekly`,e.weeklyDays=t.weekdays,e.time=t.time;break;case`monthly`:e.scheduleKind=`monthly`,e.monthlyDay=String(t.dayOfMonth),e.time=t.time;break;case`advanced`:s0(e,t.expr);break}}function bde(e){let t=e.targetKind===`room`?{kind:`room`,roomId:e.roomId}:{kind:`default-chat`};return{name:e.name.trim()||void 0,description:e.description.trim()||void 0,enabled:e.enabled,target:t,profile:e.profile,prompt:e.prompt,schedule:xde(e),deleteAfterRun:e.deleteAfterRun}}function xde(e){let t=e.tz.trim()||void 0;switch(e.scheduleKind){case`in`:return{kind:`in`,value:c0(e.inAmount,e.inUnit)};case`at`:return{kind:`at`,value:`${e.atDate}T${e.atTime}`,tz:t};case`every`:return{kind:`cron`,expr:o0(e),tz:t};case`daily`:return{kind:`daily`,time:e.dailyTime,tz:t};case`weekly`:return{kind:`weekly`,weekdays:e.weeklyDays.join(`,`),time:e.time,tz:t};case`monthly`:return{kind:`monthly`,dayOfMonth:Number(e.monthlyDay),time:e.time,tz:t};case`cron`:return{kind:`cron`,expr:e.cronExpr.trim(),tz:t}}}function Sde(e){try{return e.scheduleKind===`in`?{kind:`one-shot`,value:c0(e.inAmount,e.inUnit),description:`One-shot schedule; the backend stores an absolute run time, not a recurring cron expression.`}:e.scheduleKind===`at`?{kind:`one-shot`,value:`${e.atDate}T${e.atTime}`,description:`One-shot schedule selected with native date and time pickers.`}:{kind:`cron`,value:o0(e),description:`This is the cron expression generated from the controls above.`}}catch(e){return{kind:`error`,value:`Invalid schedule`,description:h0(e)}}}function o0(e){if(e.scheduleKind===`cron`)return e.cronExpr.trim();if(e.scheduleKind===`daily`){let{hour:t,minute:n}=u0(e.dailyTime);return`${n} ${t} * * *`}if(e.scheduleKind===`weekly`){let{hour:t,minute:n}=u0(e.time);if(e.weeklyDays.length===0)throw Error(`Select at least one weekday`);return`${n} ${t} * * ${e.weeklyDays.join(`,`)}`}if(e.scheduleKind===`monthly`){let{hour:t,minute:n}=u0(e.time),r=Number(e.monthlyDay);if(!Number.isInteger(r)||r<1||r>31)throw Error(`Monthly day must be between 1 and 31`);return`${n} ${t} ${r} * *`}if(e.scheduleKind===`every`){let t=l0(e.everyAmount);if(e.everyUnit===`minutes`){if(t>59)throw Error(`Minute intervals must be between 1 and 59 for cron`);return t===1?`* * * * *`:`*/${t} * * * *`}if(e.everyUnit===`hours`){if(t>23)throw Error(`Hour intervals must be between 1 and 23 for cron`);return t===1?`0 * * * *`:`0 */${t} * * *`}if(t>31)throw Error(`Day intervals must be between 1 and 31 for cron`);return t===1?`0 8 * * *`:`0 8 */${t} * *`}throw Error(`This schedule type is not recurring`)}function s0(e,t){let n=t.trim().split(/\s+/);if(n.length!==5){e.scheduleKind=`cron`,e.cronExpr=t;return}let[r,i,a,o,s]=n;if(r===`*`&&i===`*`&&a===`*`&&o===`*`&&s===`*`){e.scheduleKind=`every`,e.everyAmount=`1`,e.everyUnit=`minutes`;return}let c=r.match(/^\*\/(\d+)$/);if(c&&i===`*`&&a===`*`&&o===`*`&&s===`*`){e.scheduleKind=`every`,e.everyAmount=c[1],e.everyUnit=`minutes`;return}if(r===`0`&&i===`*`&&a===`*`&&o===`*`&&s===`*`){e.scheduleKind=`every`,e.everyAmount=`1`,e.everyUnit=`hours`;return}let l=i.match(/^\*\/(\d+)$/);if(r===`0`&&l&&a===`*`&&o===`*`&&s===`*`){e.scheduleKind=`every`,e.everyAmount=l[1],e.everyUnit=`hours`;return}if(d0(r,0,59)&&d0(i,0,23)&&o===`*`){let t=`${i.padStart(2,`0`)}:${r.padStart(2,`0`)}`;if(a===`*`&&s===`*`){e.scheduleKind=`daily`,e.dailyTime=t;return}if(a===`*`&&s!==`*`){e.scheduleKind=`weekly`,e.weeklyDays=s.split(`,`).map(Number).filter(e=>Number.isInteger(e)&&e>=0&&e<=6),e.time=t;return}if(s===`*`&&d0(a,1,31)){e.scheduleKind=`monthly`,e.monthlyDay=a,e.time=t;return}}e.scheduleKind=`cron`,e.cronExpr=t}function Cde(e){let t=[],n=(e,r=``)=>{let i=r?`${r} / ${e.name}`:e.name;t.push({id:e.id,label:i,archived:typeof e.metadata.chatRoomArchivedAt==`string`});for(let t of e.children??[])n(t,i)};for(let t of e)n(t);return t}function wde(e,t){let n=new Map;for(let t of e)n.set(t.name,{name:t.name,description:t.description});for(let e of t)e.archivedAt||n.set(e.profileName,{name:e.profileName,description:e.description});return[...n.values()]}function Tde(e){return e.schedule.kind===`every`||e.schedule.kind===`cron`?!0:e.scheduleUi?.preset===`every`||e.scheduleUi?.preset===`daily`||e.scheduleUi?.preset===`weekly`||e.scheduleUi?.preset===`monthly`||e.scheduleUi?.preset===`advanced`}function Ede(e){let t=e.scheduleUi;if(t)switch(t.preset){case`in`:return`in ${t.amount} ${t.unit}`;case`at`:return`at ${t.localDateTime}`;case`every`:return`every ${t.amount} ${t.unit}`;case`daily`:return`daily at ${t.time}`;case`weekly`:return`weekly ${t.weekdays.join(`,`)} at ${t.time}`;case`monthly`:return`monthly day ${t.dayOfMonth} at ${t.time}`;case`advanced`:return`cron ${t.expr}`}return e.schedule.kind===`at`?`at ${e.schedule.at}`:e.schedule.kind===`every`?`every ${Ode(e.schedule.everyMs)}`:`cron ${e.schedule.expr}`}function Dde(e,t,n){let r=n?[...e,t]:e.filter(e=>e!==t);return[...new Set(r)].sort((e,t)=>e-t)}function c0(e,t){return`${l0(e)}${Ade(t)}`}function l0(e){let t=Number(e);if(!Number.isInteger(t)||t<1)throw Error(`Amount must be a positive integer`);return t}function u0(e){let t=e.match(/^(\d{2}):(\d{2})$/);if(!t)throw Error(`Time must use HH:MM`);return{hour:String(Number(t[1])),minute:String(Number(t[2]))}}function d0(e,t,n){let r=Number(e);return Number.isInteger(r)&&r>=t&&r<=n}function f0(e){return new Date(e).toLocaleString(void 0,{month:`short`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`})}function p0(e){let t=e=>String(e).padStart(2,`0`);return`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}`}function m0(e){let t=e=>String(e).padStart(2,`0`);return`${t(e.getHours())}:${t(e.getMinutes())}`}function Ode(e){let t=6e4,n=60*t,r=24*n;return e%r===0?`${e/r}d`:e%n===0?`${e/n}h`:`${Math.round(e/t)}m`}function kde(e){let t=6e4,n=60*t,r=24*n;return e%r===0?{amount:e/r,unit:`days`}:e%n===0?{amount:e/n,unit:`hours`}:{amount:Math.round(e/t),unit:`minutes`}}function Ade(e){return e===`minutes`?`m`:e===`hours`?`h`:`d`}function h0(e){return e instanceof Error?e.message:String(e)}async function jde(){return B(`/api/chat/ralph/status`)}async function Mde(){return B(`/api/chat/ralph/conditions`)}async function Nde(){return B(`/api/chat/ralph/templates`)}async function Pde(e=!0){return B(`/api/chat/ralph/jobs${e?`?includeDisabled=true`:``}`)}async function Fde(e){return B(`/api/chat/ralph/jobs`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(e)})}async function Ide(e,t){return B(`/api/chat/ralph/jobs/${encodeURIComponent(e)}`,{method:`PATCH`,headers:{"content-type":`application/json`},body:JSON.stringify(t)})}async function Lde(e){return B(`/api/chat/ralph/jobs/${encodeURIComponent(e)}`,{method:`DELETE`,headers:{"content-type":`application/json`},body:JSON.stringify({})})}async function Rde(e){return B(`/api/chat/ralph/jobs/${encodeURIComponent(e)}/start`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({})})}async function zde(e){return B(`/api/chat/ralph/jobs/${encodeURIComponent(e)}/stop`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({})})}async function Bde(e){return B(`/api/chat/ralph/jobs/${encodeURIComponent(e)}/cancel`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({})})}async function g0(e,t=100){let n=new URLSearchParams;return e&&n.set(`jobId`,e),n.set(`limit`,String(t)),B(`/api/chat/ralph/runs?${n.toString()}`)}var _0=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`],v0=`w-full rounded-sm border border-slate-700 bg-[#101d22] px-3 py-2 text-sm text-slate-200 outline-none focus:border-[#11a4d4] disabled:opacity-50`,Vde=`sr-only peer`;function Hde({bootstrap:e,mobileSidebarOpen:t=!1,onCloseMobileSidebar:n}){let r=e.rooms??[],i=(0,L.useMemo)(()=>efe(e.agents,e.customAgents),[e.agents,e.customAgents]),a=i[0]?.name??`default`,[o,s]=(0,L.useState)([]),[c,l]=(0,L.useState)([]),[u,d]=(0,L.useState)(null),[f,p]=(0,L.useState)([]),[m,h]=(0,L.useState)([]),[g,_]=(0,L.useState)(``),[v,y]=(0,L.useState)(null),[b,x]=(0,L.useState)(()=>C0(a,r[0]?.id)),[S,C]=(0,L.useState)(!1),[w,T]=(0,L.useState)(!1),[E,D]=(0,L.useState)(null),O=o.find(e=>e.id===v)??null,k=(0,L.useMemo)(()=>r.find(e=>e.id===b.roomId)?.name??b.roomId,[r,b.roomId]),A=async(e=v)=>{C(!0),D(null);try{let[t,n,r,i,a]=await Promise.all([jde(),Pde(!0),g0(e??void 0,100),Mde(),Nde()]);d(t.status),s(n.jobs),l(r.runs),p(i.conditions),h(a.templates)}catch(e){D(e instanceof Error?e.message:String(e))}finally{C(!1)}};(0,L.useEffect)(()=>{A(null);let e=window.setInterval(()=>void A(v),5e3);return()=>window.clearInterval(e)},[v]);let j=async e=>{y(e.id),_(``),x(w0(e,a,r[0]?.id)),n?.(),l((await g0(e.id,100)).runs)},M=()=>{y(null),_(``),x(C0(a,r[0]?.id)),l([]),n?.()},N=e=>{if(_(e),!e){x(C0(a,r[0]?.id));return}let t=m.find(t=>t.id===e);t&&(y(null),l([]),x(Zde(t,a,r[0]?.id)))},P=async()=>{T(!0),D(null);try{let e=Qde(b),t=O?await Ide(O.id,e):await Fde(e);y(t.job.id),x(w0(t.job,a,r[0]?.id)),await A(t.job.id)}catch(e){D(e instanceof Error?e.message:String(e))}finally{T(!1)}},ee=async()=>{if(!(!O||!window.confirm(`Delete Ralph job "${O.name}"?`))){T(!0);try{await Lde(O.id),M(),await A(null)}catch(e){D(e instanceof Error?e.message:String(e))}finally{T(!1)}}},te=async e=>{if(O){T(!0);try{e===`start`&&await Rde(O.id),e===`stop`&&await zde(O.id),e===`cancel`&&await Bde(O.id),await A(O.id)}catch(e){D(e instanceof Error?e.message:String(e))}finally{T(!1)}}};return(0,R.jsxs)(`div`,{className:`min-h-0 grid grid-cols-[340px_minmax(0,1fr)] max-[980px]:grid-cols-1 h-full overflow-hidden`,children:[(0,R.jsx)(`div`,{className:`fixed inset-0 z-30 bg-black/60 min-[981px]:hidden transition-opacity duration-200 ${t?`opacity-100 pointer-events-auto`:`opacity-0 pointer-events-none`}`,onClick:n}),(0,R.jsxs)(`aside`,{className:`min-h-0 overflow-auto bg-[#1a262b] border-r border-slate-800 max-[980px]:fixed max-[980px]:left-0 max-[980px]:top-0 max-[980px]:bottom-0 max-[980px]:z-40 max-[980px]:w-[280px] max-[980px]:transition-transform max-[980px]:duration-200 ${t?`max-[980px]:translate-x-0`:`max-[980px]:-translate-x-full`}`,children:[(0,R.jsxs)(`div`,{className:`h-11 px-3 border-b border-slate-800 flex items-center justify-between text-xs font-bold uppercase tracking-wider max-[980px]:h-auto max-[980px]:py-2`,children:[(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,R.jsx)(No,{size:14}),` Ralph Jobs`]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,R.jsx)(`button`,{type:`button`,onClick:()=>void A(),title:`Refresh`,"aria-label":`Refresh`,className:`p-1 border border-slate-700 rounded-sm text-slate-400 hover:border-[#11a4d4] hover:text-[#11a4d4]`,children:(0,R.jsx)(Ps,{size:13})}),(0,R.jsx)(`button`,{type:`button`,onClick:M,title:`New Ralph Job`,"aria-label":`New Ralph Job`,className:`p-1 border border-slate-700 rounded-sm text-slate-400 hover:border-[#11a4d4] hover:text-[#11a4d4]`,children:(0,R.jsx)(js,{size:13})}),(0,R.jsx)(`button`,{type:`button`,onClick:n,title:`Close sidebar`,"aria-label":`Close sidebar`,className:`min-[981px]:hidden p-1 border border-slate-700 rounded-sm text-slate-400 hover:border-[#11a4d4] hover:text-[#11a4d4]`,children:(0,R.jsx)(Ys,{size:13})})]})]}),(0,R.jsxs)(`div`,{className:`p-3 space-y-3`,children:[(0,R.jsxs)(`div`,{className:`grid grid-cols-3 gap-2 text-center text-[11px]`,children:[(0,R.jsx)(S0,{label:`Jobs`,value:u?.jobs??o.length}),(0,R.jsx)(S0,{label:`Running`,value:u?.running??0}),(0,R.jsx)(S0,{label:`Templates`,value:m.length||`-`})]}),S&&o.length===0?(0,R.jsxs)(`div`,{className:`text-sm text-slate-400 flex items-center gap-2`,children:[(0,R.jsx)(Ss,{size:14,className:`animate-spin`}),` Loading Ralph jobs…`]}):null,o.length===0&&!S?(0,R.jsx)(`div`,{className:`px-2 py-3 text-xs text-slate-500 border border-dashed border-slate-700 rounded-sm`,children:`No Ralph jobs yet.`}):null,(0,R.jsx)(`div`,{className:`space-y-2`,children:o.map(e=>(0,R.jsxs)(`button`,{type:`button`,onClick:()=>void j(e),className:`w-full text-left rounded-sm border px-3 py-2 ${v===e.id?`border-[#11a4d4] bg-[#11a4d4]/10`:`border-slate-800 hover:border-slate-700 hover:bg-slate-900/40`}`,children:[(0,R.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,R.jsxs)(`div`,{className:`min-w-0`,children:[(0,R.jsx)(`div`,{className:`truncate text-sm font-medium text-slate-100`,children:e.name}),(0,R.jsxs)(`div`,{className:`truncate text-[11px] text-slate-500`,children:[e.state.completedIterations??0,e.maxIterations?`/${e.maxIterations}`:``,` iterations · `,e.state.lastStatus??`new`]})]}),(0,R.jsx)(Yde,{job:e})]}),(0,R.jsx)(`div`,{className:`mt-1 truncate font-mono text-[11px] text-slate-500`,children:tfe(e)})]},e.id))})]})]}),(0,R.jsx)(`main`,{className:`min-h-0 overflow-auto`,children:(0,R.jsxs)(`div`,{className:`max-w-5xl mx-auto p-5 space-y-5`,children:[(0,R.jsxs)(`div`,{className:`flex items-start justify-between gap-3 flex-wrap`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{className:`text-xs uppercase tracking-[0.16em] text-[#11a4d4] font-bold`,children:`Continuous Pibo Sessions`}),(0,R.jsx)(`h1`,{className:`text-2xl font-bold text-slate-100`,children:O?O.name:`New Ralph job`}),(0,R.jsx)(`p`,{className:`text-sm text-slate-400`,children:`Ralph starts fresh agent sessions with the same task until a stop condition is satisfied.`})]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[O?(0,R.jsxs)(`button`,{type:`button`,onClick:()=>void te(`start`),disabled:w,className:`h-9 px-3 inline-flex items-center gap-2 rounded-sm border border-emerald-500/50 text-emerald-300 hover:border-emerald-400 disabled:opacity-50`,children:[(0,R.jsx)(As,{size:14}),` Start`]}):null,O?(0,R.jsxs)(`button`,{type:`button`,onClick:()=>void te(`stop`),disabled:w,className:`h-9 px-3 inline-flex items-center gap-2 rounded-sm border border-amber-500/50 text-amber-300 hover:border-amber-400 disabled:opacity-50`,children:[(0,R.jsx)(Us,{size:14}),` Stop`]}):null,O?(0,R.jsxs)(`button`,{type:`button`,onClick:()=>void te(`cancel`),disabled:w,className:`h-9 px-3 inline-flex items-center gap-2 rounded-sm border border-orange-500/50 text-orange-300 hover:border-orange-400 disabled:opacity-50`,children:[(0,R.jsx)(Yo,{size:14}),` Cancel`]}):null,(0,R.jsxs)(`button`,{type:`button`,onClick:()=>void P(),disabled:w,className:`h-9 px-3 inline-flex items-center gap-2 rounded-sm border border-[#11a4d4] bg-[#11a4d4]/10 text-[#11a4d4] disabled:opacity-50`,children:[w?(0,R.jsx)(Ss,{size:14,className:`animate-spin`}):(0,R.jsx)(Ls,{size:14}),` Save`]}),O?(0,R.jsxs)(`button`,{type:`button`,onClick:()=>void ee(),disabled:w,className:`h-9 px-3 inline-flex items-center gap-2 rounded-sm border border-red-500/40 text-red-300 hover:border-red-400 disabled:opacity-50`,children:[(0,R.jsx)(Ws,{size:14}),` Delete`]}):null]})]}),E?(0,R.jsx)(Ude,{message:E}):null,(0,R.jsxs)(`section`,{className:`grid grid-cols-[minmax(0,1fr)_minmax(280px,360px)] gap-4 max-[980px]:grid-cols-1`,children:[(0,R.jsxs)(y0,{title:`Job`,children:[(0,R.jsx)(b0,{label:`Template`,children:(0,R.jsxs)(`select`,{className:v0,value:g,onChange:e=>N(e.target.value),children:[(0,R.jsx)(`option`,{value:``,children:`Blank job`}),m.map(e=>(0,R.jsx)(`option`,{value:e.id,children:e.name},e.id))]})}),g?(0,R.jsx)(`div`,{className:`rounded-sm border border-[#11a4d4]/30 bg-[#11a4d4]/10 px-3 py-2 text-xs text-slate-400`,children:m.find(e=>e.id===g)?.description}):null,(0,R.jsx)(b0,{label:`Name`,children:(0,R.jsx)(`input`,{className:v0,value:b.name,onChange:e=>x({...b,name:e.target.value}),placeholder:`Ralph PRD loop`})}),(0,R.jsx)(b0,{label:`Description`,children:(0,R.jsx)(`input`,{className:v0,value:b.description,onChange:e=>x({...b,description:e.target.value}),placeholder:`Optional`})}),(0,R.jsx)(b0,{label:`Agent`,children:(0,R.jsxs)(`select`,{className:v0,value:b.profile,onChange:e=>x({...b,profile:e.target.value}),children:[i.map(e=>(0,R.jsx)(`option`,{value:e.name,children:e.label},e.name)),b.profile&&!i.some(e=>e.name===b.profile)?(0,R.jsxs)(`option`,{value:b.profile,children:[b.profile,` (missing)`]}):null]})}),(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsx)(`div`,{className:`text-[11px] font-bold uppercase tracking-wider text-slate-500`,children:`Target`}),(0,R.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,R.jsx)(x0,{name:`ralph-target-kind`,checked:b.targetKind===`default-chat`,title:`Shared Chat`,description:`Runs in the shared default chat`,onChange:()=>x({...b,targetKind:`default-chat`})}),(0,R.jsx)(x0,{name:`ralph-target-kind`,checked:b.targetKind===`room`,title:`Room`,description:`Uses a room workspace`,onChange:()=>x({...b,targetKind:`room`})})]})]}),b.targetKind===`room`?(0,R.jsx)(b0,{label:`Room`,children:(0,R.jsx)(`select`,{className:v0,value:b.roomId,onChange:e=>x({...b,roomId:e.target.value}),children:r.map(e=>(0,R.jsx)(`option`,{value:e.id,children:e.name},e.id))})}):null,(0,R.jsx)(b0,{label:`Max Iterations`,children:(0,R.jsx)(`input`,{className:v0,type:`number`,min:`1`,value:b.maxIterations,onChange:e=>x({...b,maxIterations:e.target.value}),placeholder:`Unlimited`})}),(0,R.jsxs)(`div`,{className:`rounded-sm border border-slate-800 bg-[#101d22] px-3 py-2 text-xs text-slate-500`,children:[`Target: `,(0,R.jsx)(`span`,{className:`text-slate-300`,children:b.targetKind===`room`?k:`Shared Chat`})]})]}),(0,R.jsxs)(y0,{title:`Runtime`,children:[(0,R.jsx)(Gde,{modelCatalog:e.modelCatalog,model:b.modelOverride,thinking:b.thinkingLevel,fastMode:b.fastMode,disabled:w,onModelChange:e=>x({...b,modelOverride:e}),onThinkingChange:e=>x({...b,thinkingLevel:e}),onFastModeChange:e=>x({...b,fastMode:e})}),(0,R.jsxs)(`div`,{className:`rounded-sm border border-[#11a4d4]/30 bg-[#11a4d4]/10 px-3 py-2`,children:[(0,R.jsx)(`div`,{className:`text-[11px] font-bold uppercase tracking-wider text-slate-500`,children:`Default stop marker`}),(0,R.jsx)(`div`,{className:`mt-1 font-mono text-xs text-slate-200`,children:`<promise>COMPLETE</promise>`}),(0,R.jsx)(`div`,{className:`mt-1 text-xs text-slate-500`,children:`When a final answer contains this marker, Ralph stops after that run.`})]})]})]}),(0,R.jsx)(Wde,{conditions:f,value:b.stopPolicyText,onChange:e=>x({...b,stopPolicyText:e})}),(0,R.jsx)(y0,{title:`Task / Prompt`,children:(0,R.jsx)(`textarea`,{className:`${v0} min-h-56 resize-y font-mono leading-relaxed`,value:b.prompt,onChange:e=>x({...b,prompt:e.target.value}),placeholder:`What should Ralph do on each iteration?`})}),(0,R.jsx)(y0,{title:O?`Recent runs`:`Recent runs will appear after saving`,children:c.length===0?(0,R.jsx)(`div`,{className:`text-sm text-slate-500`,children:`No runs yet.`}):(0,R.jsx)(`div`,{className:`overflow-auto`,children:(0,R.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,R.jsx)(`thead`,{className:`text-[10px] uppercase tracking-wider text-slate-500`,children:(0,R.jsxs)(`tr`,{children:[(0,R.jsx)(`th`,{className:`text-left py-2`,children:`Status`}),(0,R.jsx)(`th`,{className:`text-left py-2`,children:`Started`}),(0,R.jsx)(`th`,{className:`text-left py-2`,children:`Session`}),(0,R.jsx)(`th`,{className:`text-left py-2`,children:`Stop`}),(0,R.jsx)(`th`,{className:`text-left py-2`,children:`Error`})]})}),(0,R.jsx)(`tbody`,{children:c.map(e=>(0,R.jsxs)(`tr`,{className:`border-t border-slate-800`,children:[(0,R.jsx)(`td`,{className:`py-2`,children:(0,R.jsx)(Xde,{status:e.status})}),(0,R.jsx)(`td`,{className:`py-2 text-slate-400`,children:nfe(e.startedAt??e.createdAt)}),(0,R.jsx)(`td`,{className:`py-2`,children:e.piboSessionId?(0,R.jsxs)(`a`,{className:`text-[#11a4d4] hover:underline`,href:`/apps/chat/sessions/${encodeURIComponent(e.piboSessionId)}`,children:[e.piboSessionId.slice(0,10),`…`]}):(0,R.jsx)(`span`,{className:`text-slate-600`,children:`-`})}),(0,R.jsx)(`td`,{className:`py-2 text-slate-400`,children:O?.state.lastRunId===e.id&&O.state.lastStopEvaluation?O.state.lastStopEvaluation.finalAction:``}),(0,R.jsx)(`td`,{className:`py-2 text-red-300`,children:e.error??``})]},e.id))})]})})})]})})]})}function y0({title:e,children:t}){return(0,R.jsxs)(`section`,{className:`rounded-sm border border-slate-800 bg-[#152126] p-4 space-y-3`,children:[(0,R.jsx)(`h2`,{className:`text-xs font-bold uppercase tracking-wider text-slate-400`,children:e}),t]})}function b0({label:e,children:t}){return(0,R.jsxs)(`label`,{className:`block space-y-1`,children:[(0,R.jsx)(`span`,{className:`text-[11px] font-bold uppercase tracking-wider text-slate-500`,children:e}),t]})}function x0({name:e,checked:t,title:n,description:r,onChange:i}){return(0,R.jsxs)(`label`,{className:`block cursor-pointer`,children:[(0,R.jsx)(`input`,{type:`radio`,name:e,checked:t,onChange:i,className:Vde}),(0,R.jsxs)(`span`,{className:`block rounded-sm border border-slate-700 bg-[#101d22] px-3 py-2 text-sm text-slate-300 peer-checked:border-[#11a4d4] peer-checked:bg-[#11a4d4]/10 peer-checked:text-slate-100 hover:border-slate-500`,children:[(0,R.jsxs)(`span`,{className:`flex items-center gap-2 font-medium`,children:[(0,R.jsx)(`span`,{className:`h-3 w-3 rounded-full border ${t?`border-[#11a4d4] bg-[#11a4d4]`:`border-slate-500`}`}),n]}),(0,R.jsx)(`span`,{className:`mt-0.5 block text-[11px] text-slate-500`,children:r})]})]})}function S0({label:e,value:t}){return(0,R.jsxs)(`div`,{className:`rounded-sm border border-slate-800 bg-[#101d22] px-2 py-2`,children:[(0,R.jsx)(`div`,{className:`text-slate-100 font-semibold truncate`,children:t}),(0,R.jsx)(`div`,{className:`text-[10px] uppercase tracking-wider text-slate-500`,children:e})]})}function Ude({message:e}){return(0,R.jsxs)(`div`,{className:`rounded-sm border border-red-500/40 bg-red-500/10 px-3 py-2 text-sm text-red-100 flex items-start gap-2`,children:[(0,R.jsx)(Gs,{size:16,className:`mt-0.5 text-red-300`}),` `,(0,R.jsx)(`span`,{children:e})]})}function Wde({conditions:e,value:t,onChange:n}){let r=e[0]?{mode:`any`,conditions:[{id:e[0].type.split(`.`).pop()??`condition`,type:e[0].type,options:e[0].defaultOptions??{}}]}:{mode:`any`,conditions:[]};return(0,R.jsxs)(y0,{title:`Stop Conditions`,children:[(0,R.jsx)(`div`,{className:`text-xs text-slate-500`,children:`Optional JSON policy. Empty uses the default max-iterations and promise-complete behavior.`}),(0,R.jsx)(`div`,{className:`grid gap-2 md:grid-cols-2 xl:grid-cols-3`,children:e.map(e=>(0,R.jsxs)(`div`,{className:`rounded-sm border border-slate-800 bg-[#101d22] p-3 text-xs`,children:[(0,R.jsx)(`div`,{className:`font-medium text-slate-200`,children:e.name}),(0,R.jsx)(`div`,{className:`mt-1 truncate font-mono text-[11px] text-[#11a4d4]`,children:e.type}),(0,R.jsxs)(`div`,{className:`mt-1 text-slate-600`,children:[e.phases.join(`, `),e.pluginName?` · ${e.pluginName}`:``]}),e.description?(0,R.jsx)(`div`,{className:`mt-2 text-slate-500`,children:e.description}):null]},e.type))}),(0,R.jsx)(`textarea`,{className:`${v0} min-h-32 resize-y font-mono leading-relaxed`,value:t,onChange:e=>n(e.target.value),placeholder:JSON.stringify(r,null,2)}),(0,R.jsxs)(`div`,{className:`text-xs text-slate-600`,children:[`Registered conditions: `,e.length||`none`]})]})}function Gde({modelCatalog:e,model:t,thinking:n,fastMode:r,disabled:i,onModelChange:a,onThinkingChange:o,onFastModeChange:s}){return(0,R.jsxs)(`div`,{className:`grid gap-3`,children:[(0,R.jsx)(Kde,{catalog:e,value:t,disabled:i,onChange:a}),(0,R.jsx)(qde,{value:n,disabled:i,onChange:o}),(0,R.jsx)(Jde,{value:r,disabled:i,onChange:s})]})}function Kde({catalog:e,value:t,disabled:n,onChange:r}){let[i,a]=(0,L.useState)(t?.provider??``),[o,s]=(0,L.useState)(t?.id??``),c=e?.providers??[],l=c.find(e=>e.id===i),u=l?.models.find(e=>e.id===o),d=!!i&&!l,f=!!(i&&o&&l&&!u);return(0,L.useEffect)(()=>{a(t?.provider??``),s(t?.id??``)},[t?.provider,t?.id]),(0,R.jsxs)(`div`,{className:`grid gap-2`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,R.jsx)(`span`,{className:`text-[11px] font-bold uppercase tracking-wider text-slate-500`,children:`Model`}),(0,R.jsx)(`button`,{type:`button`,disabled:n||!i&&!o,onClick:()=>{a(``),s(``),r(void 0)},className:`text-[10px] uppercase tracking-wider text-slate-500 hover:text-slate-300 disabled:opacity-50`,children:`Unset`})]}),(0,R.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,R.jsxs)(`select`,{value:i,disabled:n,onChange:e=>{let t=e.target.value;a(t),s(``),t||r(void 0)},className:v0,children:[(0,R.jsx)(`option`,{value:``,children:`Default`}),c.map(e=>(0,R.jsx)(`option`,{value:e.id,children:e.label},e.id)),d?(0,R.jsxs)(`option`,{value:i,children:[i,` (missing)`]}):null]}),(0,R.jsxs)(`select`,{value:o,disabled:n||!i,onChange:e=>{let t=e.target.value;s(t),i&&t&&r({provider:i,id:t})},className:v0,children:[(0,R.jsx)(`option`,{value:``,children:i?`Select model`:`Default`}),l?.models.map(e=>(0,R.jsx)(`option`,{value:e.id,children:e.label},e.id)),f?(0,R.jsxs)(`option`,{value:o,children:[o,` (missing)`]}):null]})]}),i&&l?(0,R.jsx)(`div`,{className:`text-xs text-slate-600`,children:l.authConfigured?`Provider auth configured.`:`Provider auth missing.`}):null]})}function qde({value:e,disabled:t,onChange:n}){return(0,R.jsxs)(`div`,{className:`grid gap-2`,children:[(0,R.jsx)(`div`,{className:`text-[11px] font-bold uppercase tracking-wider text-slate-500`,children:`Thinking`}),(0,R.jsxs)(`select`,{value:e??``,disabled:t,onChange:e=>n(e.target.value?e.target.value:void 0),className:v0,children:[(0,R.jsx)(`option`,{value:``,children:`Default`}),_0.map(e=>(0,R.jsx)(`option`,{value:e,children:e},e))]}),(0,R.jsx)(`div`,{className:`text-xs text-slate-600`,children:`Per-run thinking level.`})]})}function Jde({value:e,disabled:t,onChange:n}){return(0,R.jsxs)(`div`,{className:`grid gap-2`,children:[(0,R.jsx)(`div`,{className:`text-[11px] font-bold uppercase tracking-wider text-slate-500`,children:`Fast Mode`}),(0,R.jsxs)(`select`,{value:e===void 0?``:e?`fast`:`normal`,disabled:t,onChange:e=>{let t=e.target.value;n(t===``?void 0:t===`fast`)},className:v0,children:[(0,R.jsx)(`option`,{value:``,children:`Default`}),(0,R.jsx)(`option`,{value:`fast`,children:`Fast on`}),(0,R.jsx)(`option`,{value:`normal`,children:`Fast off`})]}),(0,R.jsx)(`div`,{className:`text-xs text-slate-600`,children:`Overrides default fast mode.`})]})}function Yde({job:e}){let t=!!e.state.runningAt,n=e.enabled&&!t,r=t?`border-[#11a4d4]/50 text-[#11a4d4]`:n?`border-emerald-500/40 text-emerald-300`:`border-slate-600 text-slate-400`,i=t?`active`:e.enabled?`on`:`off`;return(0,R.jsxs)(`span`,{className:`shrink-0 inline-flex items-center gap-1 rounded-sm border px-1.5 py-0.5 text-[10px] ${r}`,children:[t?(0,R.jsx)(Ss,{size:10,className:`animate-spin`}):null,i]})}function Xde({status:e}){return(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-sm border px-1.5 py-0.5 text-[11px] ${e===`ok`?`border-emerald-500/40 text-emerald-300`:e===`error`?`border-red-500/40 text-red-300`:e===`running`?`border-[#11a4d4]/50 text-[#11a4d4]`:e===`cancelled`?`border-orange-500/50 text-orange-300`:`border-slate-600 text-slate-400`}`,children:[e===`running`?(0,R.jsx)(Ss,{size:11,className:`animate-spin`}):null,e]})}function C0(e,t){return{name:``,description:``,profile:e,prompt:``,maxIterations:``,stopPolicyText:``,targetKind:t?`room`:`default-chat`,roomId:t??``}}function Zde(e,t,n){return{...C0(t,n),name:e.job.name,description:e.job.description??``,prompt:e.job.prompt,maxIterations:e.job.maxIterations?String(e.job.maxIterations):``,stopPolicyText:e.job.stopPolicy?JSON.stringify(e.job.stopPolicy,null,2):``}}function w0(e,t,n){return{name:e.name,description:e.description??``,profile:e.profile||t,prompt:e.prompt,maxIterations:e.maxIterations?String(e.maxIterations):``,targetKind:e.target.kind,roomId:e.target.kind===`room`?e.target.roomId:n??``,modelOverride:e.modelOverride,thinkingLevel:e.thinkingLevel,fastMode:e.fastMode,stopPolicyText:e.stopPolicy?JSON.stringify(e.stopPolicy,null,2):``}}function Qde(e){return{name:e.name.trim()||void 0,description:e.description.trim()||void 0,profile:e.profile,prompt:e.prompt,maxIterations:e.maxIterations.trim()?Number(e.maxIterations):null,stopPolicy:$de(e.stopPolicyText),modelOverride:e.modelOverride??null,thinkingLevel:e.thinkingLevel??null,fastMode:e.fastMode??null,target:e.targetKind===`room`?{kind:`room`,roomId:e.roomId}:{kind:`default-chat`}}}function $de(e){let t=e.trim();return t?JSON.parse(t):null}function efe(e,t){let n=new Map;for(let t of e)n.set(t.name,{name:t.name,label:t.name,description:t.description});for(let e of t)e.archivedAt||n.set(e.profileName,{name:e.profileName,label:e.displayName===e.profileName?e.profileName:`${e.displayName} (${e.profileName})`,description:e.description});return[...n.values()]}function tfe(e){let t=[e.modelOverride?`${e.modelOverride.provider}/${e.modelOverride.id}`:void 0,e.thinkingLevel?`thinking ${e.thinkingLevel}`:void 0,e.fastMode===void 0?void 0:e.fastMode?`fast on`:`fast off`].filter(Boolean);return t.length?t.join(` · `):`default runtime`}function nfe(e){return new Date(e).toLocaleString(void 0,{month:`short`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`})}function T0(e,t=`new-agent`){return{displayName:t,description:``,nativeTools:[],skills:F0(e,`pi-agent-harness`)?[`pi-agent-harness`]:[],contextFiles:[],subagents:[],mcpServers:[],piPackages:[],mainModel:void 0,subagentModel:void 0,thinkingLevel:void 0,mainThinkingLevel:void 0,subagentThinkingLevel:void 0,fast:!1,mainFast:!1,subagentFast:!1,builtinTools:`default`,builtinToolNames:[...j0],autoContextFiles:!0,runControl:!1,brokenContextFiles:[],hardPinnedModel:void 0,source:`custom`}}function rfe(e){let t=new Set([...e].map(e=>e.trim()).filter(Boolean)),n=`new-agent`;if(!t.has(n))return n;for(let e=1;;e+=1){let r=`${n}-${e}`;if(!t.has(r))return r}}function E0(e){return{id:e.id,profileName:e.profileName,displayName:e.displayName,description:e.description??``,nativeTools:e.nativeTools,skills:e.skills,contextFiles:e.contextFiles,subagents:e.subagents,mcpServers:e.mcpServers,piPackages:e.piPackages??[],mainModel:e.mainModel,subagentModel:e.subagentModel,thinkingLevel:e.thinkingLevel,mainThinkingLevel:e.mainThinkingLevel,subagentThinkingLevel:e.subagentThinkingLevel,fast:e.fast??!1,mainFast:e.mainFast??!1,subagentFast:e.subagentFast??!1,builtinTools:e.builtinTools,builtinToolNames:A0(e.builtinToolNames,e.builtinTools),autoContextFiles:e.autoContextFiles??!0,runControl:e.runControl,brokenContextFiles:e.brokenContextFiles??[],archivedAt:e.archivedAt,hardPinnedModel:void 0,source:`custom`}}function D0(e,t){return{displayName:e.name,description:e.description??``,nativeTools:e.nativeTools??[],skills:e.skills??(F0(t,`pi-agent-harness`)?[`pi-agent-harness`]:[]),contextFiles:e.contextFiles??[],subagents:e.subagents??[],mcpServers:e.mcpServers??[],piPackages:e.piPackages??[],mainModel:e.mainModel??e.model,subagentModel:e.subagentModel??e.model,thinkingLevel:e.thinkingLevel,mainThinkingLevel:e.mainThinkingLevel??e.thinkingLevel,subagentThinkingLevel:e.subagentThinkingLevel??e.thinkingLevel,fast:e.fast??!1,mainFast:e.mainFast??e.fast??!1,subagentFast:e.subagentFast??e.fast??!1,builtinTools:e.builtinTools??`default`,builtinToolNames:A0(e.builtinToolNames,e.builtinTools),autoContextFiles:e.autoContextFiles??!0,runControl:e.runControl??!1,brokenContextFiles:[],hardPinnedModel:e.model,profileName:e.name,source:`profile`}}function ife(e,t){return{...D0(e,t),displayName:`${e.name}-copy`,id:void 0,hardPinnedModel:void 0,profileName:void 0,source:`custom`}}function O0(e){return{...E0(e),displayName:`${e.profileName}-copy`,id:void 0,profileName:void 0,archivedAt:void 0,source:`custom`}}function afe(e,t){let n=new Map;for(let t of e)n.set(t.name,t.name);for(let e of t)n.set(e.profileName,e.displayName);return[...n.entries()].map(([e,t])=>({value:e,label:t}))}function ofe(e){return e.trim()?e.length>120?`Agent name is too long.`:/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/.test(e)?null:`Use lowercase kebab-case only, for example test-agent.`:`Agent name is required.`}function k0(e,t){return e.includes(t)?e.filter(e=>e!==t):[...e,t]}function A0(e,t=`default`){if(t===`disabled`)return[];let n=new Set(e??j0);return j0.filter(e=>n.has(e))}var sfe=new Set([`apply_patch`,`codex_image_generation`,`web_search`,`view_image`]),j0=[`read`,`bash`,`edit`,`write`],cfe={read:`Read workspace files.`,bash:`Run shell commands.`,edit:`Edit existing files.`,write:`Create or overwrite files.`};function lfe(e,t){let n=new Set(t),r=new Map;for(let t of e){let e=t.pluginId??(sfe.has(t.name)?`pibo.codex-compat`:void 0),i=t.pluginName??(e===`pibo.codex-compat`?`Codex Compat`:void 0),a=!e||e===`pibo.core`,o=M0(r,a?`builtin`:`plugin:${e}`,{title:a?`Built-in Tools`:P0(e,i),description:a?`Built-in Pibo tool catalog`:e??`plugin`,kind:a?`builtin`:`plugin`});o.items.push(t),n.has(t.name)&&(o.selectedCount+=1),o.totalCount+=1}return N0(r,[`builtin`,`plugin`])}function ufe(e,t){let n=new Set(t),r=new Map;for(let t of e){let e=t.kind,i=M0(r,e===`plugin`?`plugin:${t.pluginId??t.name}`:e,{title:ffe(t),description:pfe(t),kind:t.kind});i.items.push(t),n.has(t.name)&&(i.selectedCount+=1),i.totalCount+=1}return N0(r,[`builtin`,`plugin`,`user`])}function dfe(e,t){let n=new Set(t),r=new Map;for(let t of e){let e=t.pluginId===`pibo.core`,i=!t.pluginId,a=M0(r,e?`builtin`:i?`custom`:`plugin:${t.pluginId}`,{title:e?`Built-in Context Files`:i?`Custom`:P0(t.pluginId,t.pluginName),description:e?`Pibo built-in context file catalog`:i?`Loose context files without a plugin namespace`:t.pluginId??`plugin`,kind:e?`builtin`:i?`custom`:`plugin`});a.items.push(t),n.has(t.key)&&(a.selectedCount+=1),a.totalCount+=1}return N0(r,[`builtin`,`custom`,`plugin`])}function M0(e,t,n){let r=e.get(t);if(r)return r;let i={key:t,title:n.title,description:n.description,kind:n.kind,items:[],selectedCount:0,totalCount:0,defaultOpen:!1};return e.set(t,i),i}function N0(e,t){let n=new Map(t.map((e,t)=>[e,t]));return[...e.values()].sort((e,r)=>{let i=n.get(e.kind)??t.length,a=n.get(r.kind)??t.length;return i===a?e.title.localeCompare(r.title):i-a}).map(e=>({...e,defaultOpen:!1}))}function P0(e,t){return e===`pibo.codex-compat`?`Codex Compat`:t||(e?(e.split(`.`).filter(Boolean).at(-1)??e).split(`-`).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `):`Plugin`)}function ffe(e){return e.kind===`builtin`?`Built-in Skills`:e.kind===`user`?`User Skills`:P0(e.pluginId,e.pluginName)}function pfe(e){return e.kind===`builtin`?`Pibo-owned built-in skill catalog`:e.kind===`user`?`User-managed skills`:e.pluginId??`plugin`}function mfe(e){return e.kind===`builtin`?`built-in skill`:e.kind===`user`?`user skill`:e.pluginName??e.pluginId??`plugin skill`}function F0(e,t){return e?.skills.some(e=>e.kind===`builtin`&&e.name===t)??!1}function hfe(e){let t=e.source??`plugin`,n=e.scope??`global`;return e.pluginId===`pibo.core`?`built-in global`:t===`plugin`?`plugin global`:n===`agent`?e.agentProfileName?`agent ${e.agentProfileName}`:`agent local`:`managed global`}function I0(e,t){return e.includes(t.id)||e.includes(t.name)}function gfe(e,t){return I0(e,t)?e.filter(e=>e!==t.id&&e!==t.name):[...e,t.id]}function _fe(e){return e.enabled&&e.installStatus===`installed`}function L0(e){let t=e.resourceTypes.length?e.resourceTypes.join(` + `):`resources pending`,n=e.version?`v${e.version}`:e.installStatus,r=e.diagnostics.some(e=>e.type===`error`)?` / needs attention`:``;return`${t} / ${n} / ${e.enabled?`enabled`:`disabled`}${r}`}function R0(){return`Agent Designer API unavailable. Restart the Pibo web gateway after pulling/building the latest backend.`}function vfe(e){return e.toLowerCase().includes(`not found`)||e.includes(`404`)}function z0({title:e,children:t}){return(0,R.jsxs)(`div`,{className:`border border-slate-700 bg-[#1a262b] rounded-sm p-4`,children:[(0,R.jsx)(`div`,{className:`text-xs font-bold uppercase tracking-wider text-slate-400 mb-3`,children:e}),(0,R.jsx)(`div`,{className:`grid gap-3`,children:t})]})}function yfe({title:e,children:t}){return(0,R.jsx)(z0,{title:e,children:(0,R.jsx)(`div`,{className:`grid grid-cols-2 max-[1100px]:grid-cols-1 gap-2`,children:t})})}function B0({groups:e,empty:t,renderItem:n}){return e.length===0?(0,R.jsx)(R.Fragment,{children:t}):(0,R.jsx)(`div`,{className:`grid gap-2`,children:e.map(e=>(0,R.jsx)(bfe,{group:e,renderItem:n},e.key))})}function bfe({group:e,renderItem:t}){let[n,r]=(0,L.useState)(e.defaultOpen),i=e.items.slice(0,100),a=e.items.length-i.length,o=e.kind===`custom`||e.kind===`user`?`border-[#f59e0b]/70 text-amber-100 bg-[#f59e0b]/10`:`border-[#11a4d4]/70 text-sky-100 bg-[#11a4d4]/10`;return(0,R.jsxs)(`div`,{className:`border rounded-sm ${n?`border-slate-700 bg-[#101d22]`:`border-slate-800 bg-[#151f24] hover:border-slate-700`}`,children:[(0,R.jsxs)(`button`,{type:`button`,onClick:()=>r(e=>!e),className:`flex w-full items-center gap-2 p-2 text-left`,children:[(0,R.jsx)(`span`,{className:`h-6 w-6 shrink-0 inline-flex items-center justify-center border rounded-sm ${o}`,children:n?(0,R.jsx)(Bo,{size:14}):(0,R.jsx)(Vo,{size:14})}),(0,R.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,R.jsx)(`span`,{className:`block truncate text-sm font-medium text-slate-100`,children:e.title}),(0,R.jsx)(`span`,{className:`block truncate font-mono text-[10px] text-slate-500`,children:e.description})]}),(0,R.jsxs)(`span`,{className:`shrink-0 text-right font-mono text-sm font-semibold tabular-nums`,"aria-label":`${e.selectedCount} of ${e.totalCount} selected`,children:[(0,R.jsx)(`span`,{className:`text-[#11a4d4]`,children:e.selectedCount}),(0,R.jsxs)(`span`,{className:`text-slate-500`,children:[`/`,e.totalCount]})]})]}),n?(0,R.jsxs)(`div`,{className:`border-t border-slate-800 p-2`,children:[(0,R.jsx)(`div`,{className:`grid grid-cols-2 max-[1100px]:grid-cols-1 gap-2`,children:i.map(t)}),a>0?(0,R.jsxs)(`div`,{className:`mt-2 text-xs text-slate-500`,children:[`Showing first `,100,` of `,e.items.length,` items. Use Context to manage the full catalog.`]}):null]}):null]})}function V0({checked:e,disabled:t,title:n,description:r,meta:i,metaClass:a,actionLabel:o,actionIcon:s,actionDisabled:c,onAction:l,onToggle:u}){return(0,R.jsxs)(`button`,{type:`button`,onClick:()=>{t||u()},"aria-disabled":t,className:`min-w-0 border rounded-sm p-2 text-left grid grid-cols-[18px_1fr] gap-2 ${t&&!l?`opacity-60`:``} ${e?`border-[#11a4d4] bg-[#11a4d4]/10`:`border-slate-800 bg-[#151f24] hover:border-slate-700`}`,children:[(0,R.jsx)(G0,{checked:e,className:`mt-0.5`}),(0,R.jsxs)(`span`,{className:`min-w-0`,children:[(0,R.jsxs)(`span`,{className:`flex items-start justify-between gap-2`,children:[(0,R.jsx)(`span`,{className:`min-w-0 flex-1`,children:(0,R.jsx)(`span`,{className:`block text-sm truncate text-slate-200`,children:n})}),o&&l?(0,R.jsx)(`span`,{className:`shrink-0`,children:(0,R.jsxs)(`span`,{role:`button`,tabIndex:0,onClick:e=>{e.preventDefault(),e.stopPropagation(),c||l()},onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&!c&&(e.preventDefault(),e.stopPropagation(),l())},className:`inline-flex h-6 items-center justify-center gap-1 border px-1.5 text-[10px] uppercase tracking-wider ${c?`border-slate-800 text-slate-600`:`border-[#11a4d4]/70 text-[#7dd3fc] hover:border-[#11a4d4] hover:text-sky-100`}`,children:[s,o]})}):null]}),r?(0,R.jsx)(`span`,{className:`block text-xs text-slate-500 truncate`,children:r}):null,i?(0,R.jsx)(`span`,{className:`block font-mono text-[10px] mt-1 ${a??`text-slate-600`}`,children:i}):null]})]})}function xfe({pkg:e,selected:t,readOnly:n,expanded:r,busy:i,onToggleSelected:a,onToggleExpanded:o,onToggleEnabled:s,onUnregister:c}){let l=e.diagnostics.some(e=>e.type===`error`),u=!n&&(e.enabled||t);return(0,R.jsxs)(`div`,{className:`border rounded-sm ${t?`border-[#11a4d4] bg-[#11a4d4]/10`:`border-slate-800 bg-[#151f24]`} ${e.enabled?``:`opacity-75`}`,children:[(0,R.jsxs)(`div`,{className:`grid grid-cols-[1fr_auto] gap-2 p-2`,children:[(0,R.jsxs)(`button`,{type:`button`,disabled:!u,onClick:a,className:`min-w-0 grid grid-cols-[18px_1fr] gap-2 text-left disabled:cursor-not-allowed`,children:[(0,R.jsx)(G0,{checked:t,disabled:!u,className:`mt-0.5`}),(0,R.jsxs)(`span`,{className:`min-w-0`,children:[(0,R.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(`span`,{className:`min-w-0 truncate text-sm text-slate-200`,children:e.name}),(0,R.jsx)(`span`,{className:`shrink-0 border px-1.5 py-0.5 font-mono text-[10px] uppercase tracking-wider ${e.enabled?`border-[#11a4d4]/60 text-[#7dd3fc]`:`border-slate-700 text-slate-500`}`,children:e.enabled?`enabled`:`disabled`})]}),(0,R.jsx)(`span`,{className:`block text-xs text-slate-500 truncate`,children:e.description??e.source}),(0,R.jsx)(`span`,{className:`block font-mono text-[10px] mt-1 ${l?`text-[#f59e0b]`:`text-[#11a4d4]`}`,children:L0(e)})]})]}),(0,R.jsxs)(`div`,{className:`flex items-start gap-1`,children:[(0,R.jsx)(`button`,{type:`button`,onClick:o,title:r?`Hide Details`:`Show Details`,"aria-label":r?`Hide Details`:`Show Details`,className:`h-7 w-7 inline-flex items-center justify-center border border-slate-700 rounded-sm text-slate-400 hover:border-[#11a4d4] hover:text-[#11a4d4]`,children:r?(0,R.jsx)(Bo,{size:13}):(0,R.jsx)(Vo,{size:13})}),s?(0,R.jsx)(`button`,{type:`button`,disabled:i,onClick:s,title:e.enabled?`Disable Package`:`Enable Package`,"aria-label":e.enabled?`Disable Package`:`Enable Package`,className:`h-7 w-7 inline-flex items-center justify-center border border-slate-700 rounded-sm text-slate-400 hover:border-[#11a4d4] hover:text-[#11a4d4] disabled:opacity-50`,children:e.enabled?(0,R.jsx)(Ms,{size:13}):(0,R.jsx)(Ns,{size:13})}):null,c?(0,R.jsx)(`button`,{type:`button`,disabled:i,onClick:c,title:`Unregister Package`,"aria-label":`Unregister Package`,className:`h-7 w-7 inline-flex items-center justify-center border border-slate-700 rounded-sm text-slate-400 hover:border-red-400 hover:text-red-300 disabled:opacity-50`,children:(0,R.jsx)(Ws,{size:13})}):null]})]}),r?(0,R.jsx)(H0,{pkg:e}):null]})}function H0({pkg:e}){return(0,R.jsxs)(`div`,{className:`border-t border-slate-800 p-3 grid gap-3 text-xs text-slate-300`,children:[(0,R.jsx)(Sfe,{rows:[[`Source`,e.source],[`Install`,e.installSpec],[`Version`,e.version],[`Added`,e.addedAt],[`Updated`,e.updatedAt]]}),e.repositoryUrl?(0,R.jsxs)(`a`,{href:e.repositoryUrl,target:`_blank`,rel:`noreferrer`,className:`inline-flex w-fit items-center gap-1 text-[#7dd3fc] hover:text-sky-100`,children:[(0,R.jsx)(rs,{size:12}),`Source repository`]}):null,(0,R.jsx)(U0,{title:`Extensions`,values:e.extensionPaths}),(0,R.jsx)(U0,{title:`Skills`,values:e.skillNames}),(0,R.jsx)(U0,{title:`Prompts`,values:e.promptNames}),(0,R.jsx)(U0,{title:`Themes`,values:e.themeNames}),(0,R.jsx)(U0,{title:`Tools`,values:e.discoveredToolNames}),e.diagnostics.length?(0,R.jsxs)(`div`,{className:`grid gap-1`,children:[(0,R.jsx)(`div`,{className:`text-[10px] font-bold uppercase tracking-wider text-slate-500`,children:`Diagnostics`}),e.diagnostics.map((e,t)=>(0,R.jsxs)(`div`,{className:`border px-2 py-1 rounded-sm ${e.type===`error`?`border-red-500/50 text-red-200 bg-red-500/10`:e.type===`warning`?`border-[#f59e0b]/50 text-amber-100 bg-[#f59e0b]/10`:`border-slate-700 text-slate-400 bg-[#0e1116]`}`,children:[(0,R.jsx)(`span`,{className:`font-mono uppercase text-[10px] mr-2`,children:e.type}),e.message]},`${e.type}:${t}`))]}):null]})}function Sfe({rows:e}){let t=e.filter(([,e])=>e);return t.length===0?null:(0,R.jsx)(`div`,{className:`grid gap-1`,children:t.map(([e,t])=>(0,R.jsxs)(`div`,{className:`grid grid-cols-[84px_minmax(0,1fr)] gap-2`,children:[(0,R.jsx)(`span`,{className:`font-mono text-[10px] uppercase tracking-wider text-slate-500`,children:e}),(0,R.jsx)(`span`,{className:`min-w-0 break-all font-mono text-[11px] text-slate-300`,children:t})]},e))})}function U0({title:e,values:t}){return t?.length?(0,R.jsxs)(`div`,{className:`grid gap-1`,children:[(0,R.jsx)(`div`,{className:`text-[10px] font-bold uppercase tracking-wider text-slate-500`,children:e}),(0,R.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:t.map(e=>(0,R.jsx)(`span`,{className:`max-w-full break-all border border-slate-700 bg-[#0e1116] px-2 py-1 font-mono text-[11px] text-slate-300 rounded-sm`,children:e},e))})]}):null}function W0({checked:e,disabled:t,title:n,onToggle:r}){return(0,R.jsxs)(`button`,{type:`button`,disabled:t,"aria-pressed":e,onClick:r,className:`inline-flex w-fit items-center gap-2 text-left text-sm text-slate-300 hover:text-slate-100 disabled:opacity-60`,children:[(0,R.jsx)(G0,{checked:e,disabled:t}),(0,R.jsx)(`span`,{children:n})]})}function G0({checked:e,disabled:t,className:n=``}){return(0,R.jsx)(`span`,{className:`h-4 w-4 shrink-0 border rounded-sm inline-flex items-center justify-center ${e?`border-[#11a4d4] text-[#11a4d4] bg-[#11a4d4]/10`:`border-slate-600 text-transparent`} ${t?`opacity-70`:``} ${n}`,children:e?(0,R.jsx)(zo,{size:12}):null})}function K0({message:e=`Agent Designer API unavailable`}){return(0,R.jsx)(`div`,{className:`text-xs text-amber-100 border border-dashed border-[#f59e0b]/50 bg-[#f59e0b]/10 rounded-sm p-3`,children:e})}function q0({title:e,modelTitle:t,model:n,thinking:r,fast:i,modelCatalog:a,readOnly:o,modelHint:s,configuredProvidersOnly:c=!1,onModelChange:l,onThinkingChange:u,onFastChange:d}){return(0,R.jsxs)(`div`,{className:`grid gap-2 border border-slate-800 rounded-sm p-3`,children:[(0,R.jsx)(`div`,{className:`text-[10px] font-bold uppercase tracking-wider text-slate-500`,children:e}),(0,R.jsxs)(`div`,{className:`grid gap-3 lg:grid-cols-[minmax(0,1fr)_minmax(150px,190px)_auto] lg:items-start`,children:[(0,R.jsx)(wfe,{title:t,catalog:a,value:n,allowUnset:!0,readOnly:o,hint:s,emptyProviderLabel:`Default`,configuredProvidersOnly:c,onChange:l}),(0,R.jsx)(Cfe,{title:`Thinking`,value:r,readOnly:o,reserveHintSpace:!0,onChange:u}),(0,R.jsxs)(`div`,{className:`grid gap-2 pb-1`,children:[(0,R.jsx)(`div`,{className:`text-[11px] uppercase tracking-wider text-slate-500`,children:`Fast`}),(0,R.jsx)(`div`,{className:`h-4`,"aria-hidden":`true`}),(0,R.jsxs)(`button`,{type:`button`,disabled:o,onClick:()=>d(!i),className:`inline-flex h-9 w-fit items-center gap-2 text-left text-sm text-slate-300 hover:text-slate-100 disabled:opacity-60`,children:[(0,R.jsx)(G0,{checked:i===!0,disabled:o}),(0,R.jsx)(`span`,{children:i?`Fast on`:`Fast off`})]})]})]})]})}function Cfe({title:e,value:t,readOnly:n,hint:r,reserveHintSpace:i=!1,onChange:a}){return(0,R.jsxs)(`div`,{className:`grid gap-2`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,R.jsx)(`div`,{className:`text-[11px] uppercase tracking-wider text-slate-500`,children:e}),(0,R.jsx)(`button`,{type:`button`,disabled:n||!t,onClick:()=>a(void 0),className:`text-[10px] uppercase tracking-wider text-slate-500 hover:text-slate-300 disabled:opacity-50`,children:`Unset`})]}),r?(0,R.jsx)(`div`,{className:`text-xs text-slate-500`,children:r}):i?(0,R.jsx)(`div`,{className:`h-4`,"aria-hidden":`true`}):null,(0,R.jsxs)(`select`,{value:t??``,disabled:n,onChange:e=>a(e.target.value?e.target.value:void 0),className:`min-w-0 bg-[#0e1116] border border-slate-700 rounded-sm px-3 py-2 text-sm outline-none focus:border-[#11a4d4] disabled:opacity-60`,children:[(0,R.jsx)(`option`,{value:``,children:`Default`}),_0.map(e=>(0,R.jsx)(`option`,{value:e,children:e},e))]})]})}function wfe({title:e,catalog:t,value:n,allowUnset:r,readOnly:i,hint:a,emptyProviderLabel:o=`Select provider`,configuredProvidersOnly:s=!1,onChange:c}){let[l,u]=(0,L.useState)(n?.provider??``),[d,f]=(0,L.useState)(n?.id??``),p=t?.providers??[],m=p.filter(e=>!s||e.authConfigured),h=m.find(e=>e.id===l),g=s?p.find(e=>e.id===l&&!e.authConfigured):void 0,_=!!l&&!h,v=_?g?`${g.label} (not configured)`:`${l} (unknown provider)`:``,y=h?.models.find(e=>e.id===d),b=!!(l&&d&&h&&!y),x=h?.models??[],S=h?.authConfigured;return(0,L.useEffect)(()=>{u(n?.provider??``),f(n?.id??``)},[n?.id,n?.provider]),(0,R.jsxs)(`div`,{className:`grid gap-2`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,R.jsx)(`div`,{className:`text-[11px] uppercase tracking-wider text-slate-500`,children:e}),r?(0,R.jsx)(`button`,{type:`button`,disabled:i||!l&&!d,onClick:()=>{u(``),f(``),c(void 0)},className:`text-[10px] uppercase tracking-wider text-slate-500 hover:text-slate-300 disabled:opacity-50`,children:`Unset`}):null]}),a?(0,R.jsx)(`div`,{className:`text-xs text-slate-500`,children:a}):null,m.length===0?(0,R.jsx)(`div`,{className:`text-xs text-slate-500 border border-dashed border-slate-700 rounded-sm p-3`,children:p.length===0?`Model catalog unavailable.`:`No configured providers. Configure a provider under Settings > Providers.`}):null,(0,R.jsxs)(`div`,{className:`grid grid-cols-2 max-[1100px]:grid-cols-1 gap-2`,children:[(0,R.jsxs)(`select`,{value:l,disabled:i,onChange:e=>{let t=e.target.value;u(t),f(``),t||c(void 0)},className:`min-w-0 bg-[#0e1116] border border-slate-700 rounded-sm px-3 py-2 text-sm outline-none focus:border-[#11a4d4] disabled:opacity-60`,children:[(0,R.jsx)(`option`,{value:``,children:o}),m.map(e=>(0,R.jsx)(`option`,{value:e.id,children:e.label},e.id)),_?(0,R.jsx)(`option`,{value:l,children:v}):null]}),(0,R.jsxs)(`select`,{value:d,disabled:i,onChange:e=>{let t=e.target.value;f(t),t?c({provider:l,id:t}):l&&c(void 0)},className:`min-w-0 bg-[#0e1116] border border-slate-700 rounded-sm px-3 py-2 text-sm outline-none focus:border-[#11a4d4] disabled:opacity-60`,children:[(0,R.jsx)(`option`,{value:``,children:l?`Select model`:`Select provider first`}),x.map(e=>(0,R.jsx)(`option`,{value:e.id,children:e.label},e.id)),b?(0,R.jsx)(`option`,{value:d,children:`${d} (unknown model)`}):null]})]}),l?(0,R.jsx)(`div`,{className:`text-xs text-slate-500`,children:_?g?`Stored provider is no longer configured.`:`Stored provider is no longer present in the catalog.`:S?`Provider auth configured.`:`Provider auth missing.`}):null,b?(0,R.jsx)(`div`,{className:`text-xs text-amber-100`,children:`Stored model is no longer present in the catalog.`}):null]})}function Tfe({agents:e,initialCustomAgents:t,initialCatalog:n,modelCatalog:r,onSelect:i,onCreateSession:a,onEditContextFile:o,onEditMcpServer:s,onAgentsChanged:c,creatingSession:l}){let[u,d]=(0,L.useState)(n??null),[f,p]=(0,L.useState)(t),[m,h]=(0,L.useState)(()=>T0(n)),[g,_]=(0,L.useState)(!1),[v,y]=(0,L.useState)(!1),[b,x]=(0,L.useState)(!1),S=(0,L.useRef)(new Set),[C,w]=(0,L.useState)(()=>localStorage.getItem(`pibo.chat.showArchivedAgents`)===`true`),[T,E]=(0,L.useState)(``),[D,O]=(0,L.useState)(null),[k,A]=(0,L.useState)(``),[j,M]=(0,L.useState)(`agent`),N=!!u,P=(0,L.useCallback)(async()=>{x(!0);try{let e=await al(),t=new Set(e.map(e=>e.key));d(t=>t&&{...t,contextFiles:e}),p(e=>e.map(e=>({...e,brokenContextFiles:(e.brokenContextFiles??[]).filter(e=>!t.has(e))}))),h(e=>({...e,brokenContextFiles:(e.brokenContextFiles??[]).filter(e=>!t.has(e))})),c(),O(null)}catch(e){O(e instanceof Error?e.message:String(e))}finally{x(!1)}},[c]);(0,L.useEffect)(()=>p(t),[t]),(0,L.useEffect)(()=>{n&&d(n)},[n]),(0,L.useEffect)(()=>{let e=m.brokenContextFiles??[];if(!e.length||b)return;let t=e.slice().sort().join(`
154
+ `);S.current.has(t)||(S.current.add(t),P())},[m.brokenContextFiles,P,b]);let ee=(0,L.useMemo)(()=>new Set(f.map(e=>e.profileName)),[f]),te=(0,L.useMemo)(()=>e.filter(e=>!ee.has(e.name)),[e,ee]),ne=(0,L.useMemo)(()=>f.filter(e=>!e.archivedAt),[f]),F=(0,L.useMemo)(()=>f.filter(e=>e.archivedAt),[f]),re=(0,L.useMemo)(()=>afe(e,ne),[e,ne]),I=!!m.archivedAt,ie=g&&m.source===`custom`&&!m.id,ae=m.source===`profile`||I,oe=ae?null:ofe(m.displayName),se=m.profileName??(oe?`new custom profile`:m.displayName),ce=(0,L.useMemo)(()=>u?.contextFiles.filter(e=>(e.scope??`global`)===`agent`?e.agentProfileName===se||m.contextFiles.includes(e.key):!0)??[],[u,m.contextFiles,se]),le=(0,L.useMemo)(()=>lfe(u?.nativeTools??[],m.nativeTools),[u?.nativeTools,m.nativeTools]),ue=(0,L.useMemo)(()=>ufe(u?.skills??[],m.skills),[u?.skills,m.skills]),de=(0,L.useMemo)(()=>dfe(ce,m.contextFiles),[ce,m.contextFiles]),fe=()=>{let t=[...e.map(e=>e.name),...f.flatMap(e=>[e.profileName,e.displayName]),...ie?[m.displayName]:[]];h(T0(u??void 0,rfe(t))),_(!0),O(null)},pe=async()=>{if(!ae){if(oe){O(oe);return}if(!N){O(R0());return}y(!0);try{let e={displayName:m.displayName.trim(),description:(m.description??``).trim()||void 0,nativeTools:m.nativeTools,skills:m.skills,contextFiles:m.contextFiles,subagents:m.subagents.filter(e=>e.name.trim()&&e.targetProfile.trim()),mcpServers:m.mcpServers,piPackages:m.piPackages,mainModel:m.mainModel,subagentModel:m.subagentModel,thinkingLevel:m.thinkingLevel??null,mainThinkingLevel:m.mainThinkingLevel??null,subagentThinkingLevel:m.subagentThinkingLevel??null,fast:m.fast,mainFast:m.mainFast,subagentFast:m.subagentFast,builtinTools:m.builtinTools,builtinToolNames:m.builtinToolNames,autoContextFiles:m.autoContextFiles,runControl:m.runControl},t=m.id?await oQ(m.id,e):await aQ(e);p(e=>{let n=e.filter(e=>e.id!==t.agent.id);return[t.agent,...n]}),h(E0(t.agent)),_(!1),i(t.agent.profileName),c(),O(null)}catch(e){let t=e instanceof Error?e.message:String(e);O(vfe(t)?R0():t)}finally{y(!1)}}},me=async e=>{if(!(!m.id||m.source!==`custom`)){y(!0);try{let t=await oQ(m.id,{archived:e});e&&(w(!0),localStorage.setItem(`pibo.chat.showArchivedAgents`,`true`)),p(e=>e.map(e=>e.id===t.agent.id?t.agent:e)),h(E0(t.agent)),E(``),c(),O(null)}catch(e){O(e instanceof Error?e.message:String(e))}finally{y(!1)}}},he=async()=>{if(!(ae||!N||!k.trim())){if(oe){O(oe);return}y(!0);try{let e=(await il({label:k.trim(),scope:j,agentProfileName:j===`agent`?se:void 0,markdown:``})).file;d(t=>t&&{...t,contextFiles:[...t.contextFiles,e]}),h(t=>({...t,contextFiles:t.contextFiles.includes(e.key)?t.contextFiles:[...t.contextFiles,e.key]})),A(``),O(null)}catch(e){O(e instanceof Error?e.message:String(e))}finally{y(!1)}}},ge=async()=>{if(!(!m.id||!m.profileName||!I)){y(!0);try{await sQ(m.id,T),p(e=>e.filter(e=>e.id!==m.id)),h(T0(u??void 0)),_(!1),E(``),c(),O(null)}catch(e){O(e instanceof Error?e.message:String(e))}finally{y(!1)}}};return(0,R.jsxs)(`div`,{className:`h-full min-h-0 overflow-hidden grid grid-cols-[300px_minmax(0,1fr)] max-[920px]:grid-cols-1`,children:[(0,R.jsxs)(`aside`,{className:`border-r border-slate-800 bg-[#1a262b] min-h-0 overflow-auto`,children:[(0,R.jsxs)(`div`,{className:`h-11 px-3 border-b border-slate-800 flex items-center justify-between text-xs font-bold uppercase tracking-wider`,children:[(0,R.jsx)(`span`,{children:`Agents`}),(0,R.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,R.jsx)(`button`,{type:`button`,onClick:fe,title:`New Agent`,"aria-label":`New Agent`,className:`p-1 border border-slate-700 rounded-sm text-slate-400 hover:border-[#11a4d4] hover:text-[#11a4d4]`,children:(0,R.jsx)(js,{size:13})}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>{let e=!C;w(e),localStorage.setItem(`pibo.chat.showArchivedAgents`,String(e))},title:C?`Hide Archived Agents`:`Show Archived Agents`,"aria-label":C?`Hide Archived Agents`:`Show Archived Agents`,className:`p-1 border rounded-sm hover:border-[#11a4d4] hover:text-[#11a4d4] ${C?`border-[#11a4d4] text-[#11a4d4]`:`border-slate-700 text-slate-400`}`,children:C?(0,R.jsx)(To,{size:13}):(0,R.jsx)(Eo,{size:13})}),(0,R.jsx)(`button`,{type:`button`,onClick:c,title:`Refresh`,"aria-label":`Refresh`,className:`p-1 border border-slate-700 rounded-sm text-slate-400 hover:border-[#11a4d4] hover:text-[#11a4d4]`,children:(0,R.jsx)(Ps,{size:13})})]})]}),(0,R.jsxs)(`div`,{className:`p-2`,children:[(0,R.jsxs)(J0,{title:`Custom Agents`,children:[ie?(0,R.jsx)(Y0,{title:m.displayName||`new-agent`,subtitle:`unsaved custom agent`,selected:!0,onSelect:()=>{},onCreateSession:()=>{},createSessionDisabled:!0},`unsaved-agent-draft`):null,ne.map(e=>(0,R.jsx)(Y0,{title:e.displayName,subtitle:e.profileName,selected:m.source===`custom`&&m.id===e.id,onSelect:()=>{_(!1),h(E0(e)),i(e.profileName)},onCopy:()=>{h(O0(e)),_(!0)},onCreateSession:()=>{i(e.profileName),a(e.profileName)},createSessionDisabled:l},e.id)),ne.length===0&&!ie?(0,R.jsx)(`div`,{className:`px-2 py-3 text-xs text-slate-500 border border-dashed border-slate-700 rounded-sm`,children:`No custom agents`}):null]}),C?(0,R.jsxs)(J0,{title:`Archived Custom Agents`,children:[F.map(e=>(0,R.jsx)(Y0,{title:e.displayName,subtitle:e.profileName,selected:m.source===`custom`&&m.id===e.id,onSelect:()=>{_(!1),h(E0(e))},onCopy:()=>{h(O0(e)),_(!0)},onCreateSession:()=>{},createSessionDisabled:!0},e.id)),F.length===0?(0,R.jsx)(`div`,{className:`px-2 py-3 text-xs text-slate-500 border border-dashed border-slate-700 rounded-sm`,children:`No archived agents`}):null]}):null,(0,R.jsx)(J0,{title:`Read-only Profiles`,children:te.map(e=>(0,R.jsx)(Y0,{title:e.name,subtitle:e.aliases.join(`, `)||`plugin`,selected:m.source===`profile`&&m.profileName===e.name,onSelect:()=>{_(!1),h(D0(e,u??void 0)),i(e.name)},onCopy:()=>{h(ife(e,u??void 0)),_(!0)},onCreateSession:()=>{i(e.name),a(e.name)},createSessionDisabled:l},e.name))})]})]}),(0,R.jsxs)(`section`,{className:`min-h-0 overflow-auto p-5`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-3 mb-4`,children:[(0,R.jsxs)(`div`,{className:`min-w-0`,children:[(0,R.jsx)(`h1`,{className:`text-sm font-bold uppercase tracking-wider`,children:`Agent Designer`}),(0,R.jsx)(`div`,{className:`font-mono text-[11px] text-slate-500 truncate`,children:se}),(0,R.jsx)(`div`,{className:`text-[11px] uppercase tracking-wider text-slate-500`,children:m.source===`profile`?`read-only plugin profile`:I?`archived custom agent`:`custom agent`})]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(`button`,{type:`button`,onClick:()=>{m.profileName&&(i(m.profileName),a(m.profileName))},disabled:!m.profileName||l||I,title:`New Session With Agent`,"aria-label":`New Session With Agent`,className:`h-8 w-8 inline-flex items-center justify-center border border-slate-700 rounded-sm text-slate-400 hover:border-[#11a4d4] hover:text-[#11a4d4] disabled:opacity-50`,children:(0,R.jsx)(Es,{size:14})}),m.source===`custom`&&m.id?(0,R.jsx)(`button`,{type:`button`,onClick:()=>void me(!I),disabled:v,title:I?`Restore Agent`:`Archive Agent`,"aria-label":I?`Restore Agent`:`Archive Agent`,className:`h-8 w-8 inline-flex items-center justify-center border border-slate-700 rounded-sm text-slate-400 hover:border-[#11a4d4] hover:text-[#11a4d4] disabled:opacity-50`,children:I?(0,R.jsx)(To,{size:14}):(0,R.jsx)(Eo,{size:14})}):null,(0,R.jsx)(`button`,{type:`button`,onClick:()=>void pe(),disabled:ae||!N||v||!!oe,title:`Save Agent`,"aria-label":`Save Agent`,className:`h-8 w-8 inline-flex items-center justify-center border border-[#11a4d4] rounded-sm text-[#11a4d4] bg-[#11a4d4]/10 disabled:opacity-50`,children:(0,R.jsx)(Ls,{size:14})})]})]}),N?null:(0,R.jsx)(`div`,{className:`mb-3 border border-[#f59e0b]/60 bg-[#f59e0b]/10 text-amber-100 px-3 py-2 text-sm rounded-sm`,children:R0()}),m.source===`profile`?(0,R.jsx)(`div`,{className:`mb-3 border border-slate-700 bg-[#151f24] text-slate-300 px-3 py-2 text-sm rounded-sm`,children:`This profile is registered by a plugin. Copy it to create an editable custom agent.`}):null,I?(0,R.jsx)(`div`,{className:`mb-3 border border-[#f59e0b]/60 bg-[#f59e0b]/10 text-amber-100 px-3 py-2 text-sm rounded-sm`,children:`This agent is archived. Restore it before editing or starting new sessions.`}):null,D?(0,R.jsx)(`div`,{className:`mb-3 border border-red-500/60 bg-red-500/10 text-red-200 px-3 py-2 text-sm rounded-sm`,children:D}):null,(0,R.jsxs)(`div`,{className:`grid gap-4`,children:[(0,R.jsxs)(z0,{title:`Basics`,children:[(0,R.jsx)(`input`,{value:m.displayName,disabled:ae,onChange:e=>h(t=>({...t,displayName:e.target.value})),className:`min-w-0 bg-[#0e1116] border rounded-sm px-3 py-2 text-sm outline-none focus:border-[#11a4d4] disabled:opacity-60 ${oe?`border-[#f59e0b]`:`border-slate-700`}`,placeholder:`agent-name`}),oe?(0,R.jsx)(`div`,{className:`text-xs text-amber-100`,children:oe}):null,(0,R.jsx)(`textarea`,{value:m.description,disabled:ae,onChange:e=>h(t=>({...t,description:e.target.value})),className:`min-h-[72px] bg-[#0e1116] border border-slate-700 rounded-sm px-3 py-2 text-sm outline-none focus:border-[#11a4d4] disabled:opacity-60`,placeholder:`Description`}),m.source===`profile`&&m.hardPinnedModel?(0,R.jsxs)(`div`,{className:`border border-slate-700 bg-[#151f24] text-slate-300 px-3 py-2 text-xs rounded-sm`,children:[`This plugin profile hard-pins `,(0,R.jsx)(`span`,{className:`font-mono`,children:Afe(m.hardPinnedModel)}),`. Main-agent and subagent defaults do not apply.`]}):null,(0,R.jsx)(q0,{title:`Main Agent`,modelTitle:`Main Agent Model`,model:m.mainModel,thinking:m.mainThinkingLevel,fast:m.mainFast??!1,modelCatalog:r,readOnly:ae,modelHint:`Unset to use the settings default.`,onModelChange:e=>h(t=>({...t,mainModel:e})),onThinkingChange:e=>h(t=>({...t,mainThinkingLevel:e})),onFastChange:e=>h(t=>({...t,mainFast:e}))}),(0,R.jsx)(q0,{title:`Subagent`,modelTitle:`Subagent Model`,model:m.subagentModel,thinking:m.subagentThinkingLevel,fast:m.subagentFast??!1,modelCatalog:r,readOnly:ae,modelHint:`Unset to use the settings default.`,onModelChange:e=>h(t=>({...t,subagentModel:e})),onThinkingChange:e=>h(t=>({...t,subagentThinkingLevel:e})),onFastChange:e=>h(t=>({...t,subagentFast:e}))}),(0,R.jsx)(W0,{disabled:ae,checked:m.autoContextFiles,title:`Load AGENTS.md / CLAUDE.md`,onToggle:()=>h(e=>({...e,autoContextFiles:!e.autoContextFiles}))}),(0,R.jsx)(Dfe,{draft:m,setDraft:h,readOnly:ae})]}),(0,R.jsx)(z0,{title:`Tools`,children:(0,R.jsx)(B0,{groups:le,empty:u?(0,R.jsx)(K0,{message:`No native tools registered`}):(0,R.jsx)(K0,{}),renderItem:e=>(0,R.jsx)(V0,{disabled:ae,checked:m.nativeTools.includes(e.name),title:e.name,description:e.description,meta:e.yieldable?`yieldable`:`direct only`,onToggle:()=>h(t=>({...t,nativeTools:k0(t.nativeTools,e.name)}))},e.name)})}),(0,R.jsx)(z0,{title:`Skills`,children:(0,R.jsx)(B0,{groups:ue,empty:u?(0,R.jsx)(K0,{message:`No skills registered`}):(0,R.jsx)(K0,{}),renderItem:e=>(0,R.jsx)(V0,{disabled:ae,checked:m.skills.includes(e.name),title:e.name,description:e.path,meta:mfe(e),metaClass:e.kind===`user`?`text-amber-200`:`text-[#11a4d4]`,onToggle:()=>h(t=>({...t,skills:k0(t.skills,e.name)}))},e.name)})}),(0,R.jsx)(yfe,{title:`Packages`,children:(0,R.jsx)(V0,{disabled:ae,checked:m.runControl,title:`pibo-run-control`,description:`Expose pibo_run_* as one package for yielded native tools and subagents.`,meta:`package`,onToggle:()=>h(e=>({...e,runControl:!e.runControl}))})}),(0,R.jsx)(Efe,{packages:u?.piPackages,draft:m,setDraft:h,readOnly:ae}),(0,R.jsxs)(z0,{title:`Context Files`,children:[m.brokenContextFiles?.length?(0,R.jsxs)(`div`,{className:`border border-red-500/60 bg-red-500/10 rounded-sm p-3 space-y-2`,children:[(0,R.jsxs)(`div`,{className:`flex items-start gap-2 text-red-100`,children:[(0,R.jsx)(Gs,{size:14,className:`mt-0.5 shrink-0`}),(0,R.jsxs)(`div`,{className:`space-y-1`,children:[(0,R.jsx)(`div`,{className:`text-sm font-medium`,children:`This agent references missing or unregistered context files.`}),(0,R.jsx)(`div`,{className:`text-xs text-red-200/90`,children:`Re-check context files before removing links that may still exist on disk.`})]})]}),(0,R.jsxs)(`button`,{type:`button`,disabled:b,onClick:()=>void P(),className:`inline-flex w-fit items-center gap-2 border border-red-500/50 rounded-sm px-2 py-1 text-xs font-medium text-red-100 hover:border-red-300 hover:text-white disabled:opacity-50`,title:`Re-check Context Files`,children:[(0,R.jsx)(Ps,{size:12,className:b?`animate-spin`:void 0}),b?`Re-checking...`:`Re-check context files`]}),(0,R.jsx)(`div`,{className:`grid gap-2`,children:m.brokenContextFiles.map(e=>(0,R.jsxs)(`div`,{className:`flex items-center gap-2 border border-red-500/40 bg-[#2a1417] rounded-sm px-3 py-2`,children:[(0,R.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,R.jsx)(`div`,{className:`truncate text-sm text-red-100`,children:e}),(0,R.jsx)(`div`,{className:`text-[11px] uppercase tracking-wider text-red-300/80`,children:`Broken link`})]}),(0,R.jsx)(`button`,{type:`button`,disabled:ae,onClick:()=>h(t=>({...t,contextFiles:t.contextFiles.filter(t=>t!==e),brokenContextFiles:(t.brokenContextFiles??[]).filter(t=>t!==e)})),className:`h-8 w-8 inline-flex items-center justify-center border border-red-500/60 rounded-sm text-red-200 hover:border-red-400 hover:text-red-100 disabled:opacity-50`,title:`Remove Broken Context File`,"aria-label":`Remove Broken Context File`,children:(0,R.jsx)(Ys,{size:14})})]},e))})]}):null,(0,R.jsxs)(`div`,{className:`grid grid-cols-[1fr_auto] gap-2`,children:[(0,R.jsx)(`input`,{value:k,disabled:ae,onChange:e=>A(e.target.value),className:`min-w-0 bg-[#0e1116] border border-slate-700 rounded-sm px-3 py-2 text-sm outline-none focus:border-[#11a4d4] disabled:opacity-60`,placeholder:`New context file`}),(0,R.jsx)(`button`,{type:`button`,disabled:ae||v||!k.trim()||!!oe,onClick:()=>void he(),title:`Create Context File`,"aria-label":`Create Context File`,className:`h-9 w-9 inline-flex items-center justify-center border border-[#11a4d4] rounded-sm text-[#11a4d4] bg-[#11a4d4]/10 disabled:opacity-50`,children:(0,R.jsx)(js,{size:14})})]}),(0,R.jsxs)(`div`,{className:`inline-flex w-fit gap-1 border border-slate-800 bg-[#0e1116] rounded-sm p-1`,children:[(0,R.jsx)(`button`,{type:`button`,disabled:ae,onClick:()=>M(`agent`),className:`px-2 py-1 text-xs rounded-sm ${j===`agent`?`bg-[#11a4d4]/20 text-sky-100`:`text-slate-500 hover:text-slate-300`}`,children:`Agent`}),(0,R.jsx)(`button`,{type:`button`,disabled:ae,onClick:()=>M(`global`),className:`px-2 py-1 text-xs rounded-sm ${j===`global`?`bg-[#11a4d4]/20 text-sky-100`:`text-slate-500 hover:text-slate-300`}`,children:`Global`})]}),(0,R.jsx)(B0,{groups:de,empty:u?(0,R.jsx)(K0,{message:`No context files registered`}):(0,R.jsx)(K0,{}),renderItem:e=>(0,R.jsx)(V0,{disabled:ae,checked:m.contextFiles.includes(e.key),title:e.label??e.key,description:e.path,meta:hfe(e),metaClass:`text-[#11a4d4]`,actionLabel:`Edit`,actionIcon:(0,R.jsx)(ks,{size:12}),onAction:()=>o(e.key),onToggle:()=>h(t=>({...t,contextFiles:k0(t.contextFiles,e.key)}))},e.key)})]}),(0,R.jsx)(Ofe,{draft:m,setDraft:h,profileOptions:re,readOnly:ae}),(0,R.jsx)(kfe,{servers:u?.mcpServers,draft:m,setDraft:h,readOnly:ae,onEditServer:s}),I&&m.profileName?(0,R.jsxs)(z0,{title:`Delete Agent`,children:[(0,R.jsxs)(`div`,{className:`border border-red-500/60 bg-red-500/10 text-red-100 rounded-sm p-3 text-sm`,children:[`Permanently deleting this agent also deletes all Chat sessions that use profile `,(0,R.jsx)(`span`,{className:`font-mono`,children:m.profileName}),`.`]}),(0,R.jsx)(`input`,{value:T,onChange:e=>E(e.target.value),className:`min-w-0 bg-[#0e1116] border border-slate-700 rounded-sm px-3 py-2 text-sm outline-none focus:border-red-500`,placeholder:m.profileName}),(0,R.jsxs)(`button`,{type:`button`,onClick:()=>void ge(),disabled:v||T!==m.profileName,className:`h-8 w-fit inline-flex items-center gap-2 border border-red-500 rounded-sm px-3 text-red-200 bg-red-500/10 disabled:opacity-50`,children:[(0,R.jsx)(Ws,{size:14}),`Delete permanently`]})]}):null]})]})]})}function J0({title:e,children:t}){return(0,R.jsxs)(`div`,{className:`mb-4`,children:[(0,R.jsx)(`div`,{className:`px-1 pb-1 text-[10px] font-bold uppercase tracking-wider text-slate-500`,children:e}),t]})}function Y0({title:e,subtitle:t,selected:n,onSelect:r,onCopy:i,onCreateSession:a,createSessionDisabled:o}){return(0,R.jsx)(`div`,{className:`mb-1 border rounded-sm ${n?`border-[#11a4d4] bg-[#11a4d4]/10`:`border-transparent hover:border-slate-700`}`,children:(0,R.jsxs)(`div`,{className:`grid grid-cols-[1fr_auto_auto] items-center gap-1 p-1`,children:[(0,R.jsxs)(`button`,{type:`button`,onClick:r,className:`min-w-0 text-left px-1 py-1`,children:[(0,R.jsx)(`span`,{className:`block text-sm truncate text-slate-200`,children:e}),(0,R.jsx)(`span`,{className:`block text-[10px] font-mono truncate text-slate-500`,children:t})]}),i?(0,R.jsx)(`button`,{type:`button`,onClick:i,title:`Copy To Custom Agent`,"aria-label":`Copy To Custom Agent`,className:`h-7 w-7 inline-flex items-center justify-center border border-slate-700 rounded-sm text-slate-400 hover:border-[#11a4d4] hover:text-[#11a4d4]`,children:(0,R.jsx)(Qo,{size:13})}):(0,R.jsx)(`span`,{className:`h-7 w-7`}),(0,R.jsx)(`button`,{type:`button`,onClick:a,disabled:o,title:`New Session With Profile`,"aria-label":`New Session With Profile`,className:`h-7 w-7 inline-flex items-center justify-center border border-slate-700 rounded-sm text-slate-400 hover:border-[#11a4d4] hover:text-[#11a4d4] disabled:opacity-50`,children:(0,R.jsx)(Es,{size:13})})]})})}function Efe({packages:e,draft:t,setDraft:n,readOnly:r}){let[i,a]=(0,L.useState)(()=>new Set),o=e??[],s=o.filter(_fe),c=s.filter(e=>I0(t.piPackages,e)).length,l=e=>{a(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})};return(0,R.jsxs)(z0,{title:`Pi Packages`,children:[(0,R.jsxs)(`div`,{className:`font-mono text-[10px] uppercase tracking-wider text-slate-500`,children:[s.length,` available / `,c,` selected / `,o.length,` registered`]}),e?s.length?(0,R.jsx)(`div`,{className:`grid gap-2`,children:s.map(e=>(0,R.jsx)(xfe,{pkg:e,selected:I0(t.piPackages,e),readOnly:r,expanded:i.has(e.id),busy:!1,onToggleSelected:()=>{r||n(t=>({...t,piPackages:gfe(t.piPackages,e)}))},onToggleExpanded:()=>l(e.id)},e.id))}):(0,R.jsx)(K0,{message:`No installed and enabled Pi packages available. Manage Pi Packages in Settings.`}):(0,R.jsx)(K0,{})]})}function Dfe({draft:e,setDraft:t,readOnly:n}){let r=A0(e.builtinToolNames,e.builtinTools),[i,a]=(0,L.useState)(r.length!==j0.length),o=e=>{t(t=>{let n=k0(A0(t.builtinToolNames,t.builtinTools),e);return{...t,builtinTools:n.length===0?`disabled`:`default`,builtinToolNames:n}})};return(0,R.jsxs)(`div`,{className:`border rounded-sm ${i?`border-slate-700 bg-[#101d22]`:`border-slate-800 bg-[#151f24] hover:border-slate-700`}`,children:[(0,R.jsxs)(`button`,{type:`button`,onClick:()=>a(e=>!e),className:`flex w-full items-center gap-2 p-2 text-left`,children:[(0,R.jsx)(`span`,{className:`h-6 w-6 shrink-0 inline-flex items-center justify-center border rounded-sm border-[#11a4d4]/70 text-sky-100 bg-[#11a4d4]/10`,children:i?(0,R.jsx)(Bo,{size:14}):(0,R.jsx)(Vo,{size:14})}),(0,R.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,R.jsx)(`span`,{className:`block truncate text-sm font-medium text-slate-100`,children:`Pi Built-in Tools`}),(0,R.jsx)(`span`,{className:`block truncate font-mono text-[10px] text-slate-500`,children:`basic model tools`})]}),(0,R.jsxs)(`span`,{className:`shrink-0 text-right font-mono text-sm font-semibold tabular-nums`,"aria-label":`${r.length} of ${j0.length} enabled`,children:[(0,R.jsx)(`span`,{className:`text-[#11a4d4]`,children:r.length}),(0,R.jsxs)(`span`,{className:`text-slate-500`,children:[`/`,j0.length]})]})]}),i?(0,R.jsx)(`div`,{className:`border-t border-slate-800 p-2`,children:(0,R.jsx)(`div`,{className:`grid grid-cols-2 max-[1100px]:grid-cols-1 gap-2`,children:j0.map(e=>(0,R.jsx)(V0,{disabled:n,checked:r.includes(e),title:e,description:cfe[e],meta:`built-in`,onToggle:()=>o(e)},e))})}):null]})}function Ofe({draft:e,setDraft:t,profileOptions:n,readOnly:r}){let i=(e,n)=>{t(t=>({...t,subagents:t.subagents.map((t,r)=>r===e?{...t,...n}:t)}))};return(0,R.jsxs)(z0,{title:`Subagents`,children:[(0,R.jsx)(`div`,{className:`flex justify-end`,children:(0,R.jsx)(`button`,{type:`button`,disabled:r,onClick:()=>t(e=>({...e,subagents:[...e.subagents,{name:`helper`,targetProfile:n[0]?.value??`base`,maxDepth:3}]})),className:`h-7 w-7 inline-flex items-center justify-center border border-slate-700 rounded-sm text-slate-400 hover:border-[#11a4d4] hover:text-[#11a4d4] disabled:opacity-50`,title:`Add Subagent`,"aria-label":`Add Subagent`,children:(0,R.jsx)(js,{size:13})})}),(0,R.jsxs)(`div`,{className:`grid gap-2`,children:[e.subagents.map((e,a)=>(0,R.jsxs)(`div`,{className:`grid grid-cols-[1fr_1fr_80px_auto] max-[1100px]:grid-cols-1 gap-2 border border-slate-800 bg-[#151f24] p-2 rounded-sm`,children:[(0,R.jsx)(`input`,{value:e.name,disabled:r,onChange:e=>i(a,{name:e.target.value}),className:`min-w-0 bg-[#0e1116] border border-slate-700 rounded-sm px-2 py-1 text-sm outline-none focus:border-[#11a4d4] disabled:opacity-60`,placeholder:`name`}),(0,R.jsx)(`select`,{value:e.targetProfile,disabled:r,onChange:e=>i(a,{targetProfile:e.target.value}),className:`min-w-0 bg-[#0e1116] border border-slate-700 rounded-sm px-2 py-1 text-sm outline-none focus:border-[#11a4d4] disabled:opacity-60`,children:n.map(e=>(0,R.jsx)(`option`,{value:e.value,children:e.label},e.value))}),(0,R.jsx)(`input`,{type:`number`,min:1,disabled:r,value:e.maxDepth??3,onChange:e=>i(a,{maxDepth:Number(e.target.value)||1}),className:`bg-[#0e1116] border border-slate-700 rounded-sm px-2 py-1 text-sm outline-none focus:border-[#11a4d4] disabled:opacity-60`}),(0,R.jsx)(`button`,{type:`button`,disabled:r,onClick:()=>t(e=>({...e,subagents:e.subagents.filter((e,t)=>t!==a)})),className:`h-8 w-8 inline-flex items-center justify-center border border-slate-700 rounded-sm text-slate-400 hover:border-red-500 hover:text-red-300 disabled:opacity-50`,title:`Remove Subagent`,"aria-label":`Remove Subagent`,children:(0,R.jsx)(Ys,{size:14})})]},a)),e.subagents.length===0?(0,R.jsx)(`div`,{className:`text-xs text-slate-500 border border-dashed border-slate-700 rounded-sm p-3`,children:`No subagents configured`}):null]})]})}function kfe({servers:e,draft:t,setDraft:n,readOnly:r,onEditServer:i}){return(0,R.jsx)(z0,{title:`MCP Servers`,children:(0,R.jsxs)(`div`,{className:`grid grid-cols-2 max-[1100px]:grid-cols-1 gap-2`,children:[e?e.map(e=>{let a=r||!e.hasDescription;return(0,R.jsxs)(`div`,{className:`border rounded-sm bg-[#151f24] p-2 ${t.mcpServers.includes(e.name)?`border-[#11a4d4]`:e.hasDescription?`border-slate-800`:`border-[#f59e0b]/60`}`,children:[(0,R.jsxs)(`button`,{type:`button`,disabled:a,onClick:()=>n(t=>({...t,mcpServers:k0(t.mcpServers,e.name)})),className:`grid w-full min-w-0 grid-cols-[18px_1fr] gap-2 text-left disabled:opacity-60`,children:[(0,R.jsx)(G0,{checked:t.mcpServers.includes(e.name),disabled:a,className:`mt-0.5`}),(0,R.jsxs)(`span`,{className:`min-w-0`,children:[(0,R.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(Bs,{size:13,className:`text-[#11a4d4]`}),(0,R.jsx)(`span`,{className:`block text-sm truncate text-slate-200`,children:e.name})]}),(0,R.jsxs)(`span`,{className:`block font-mono text-[10px] mt-1 text-slate-600`,children:[e.transport,e.descriptionSource?` / ${e.descriptionSource}`:``]})]})]}),e.hasDescription?(0,R.jsx)(`div`,{className:`mt-2 text-xs text-slate-400`,children:e.description}):(0,R.jsxs)(`div`,{className:`mt-2 flex items-center gap-2 text-xs text-amber-100`,children:[(0,R.jsx)(Gs,{size:13}),`Missing agent description`]}),(0,R.jsx)(`div`,{className:`mt-2 flex justify-end`,children:(0,R.jsxs)(`button`,{type:`button`,onClick:()=>i(e.name),title:`Edit MCP Tool Context`,"aria-label":`Edit MCP Tool Context`,className:`inline-flex h-6 items-center justify-center gap-1 border border-[#11a4d4]/70 px-1.5 text-[10px] uppercase tracking-wider text-[#7dd3fc] hover:border-[#11a4d4] hover:text-sky-100`,children:[(0,R.jsx)(ks,{size:12}),`Edit`]})})]},e.name)}):(0,R.jsx)(K0,{}),e&&e.length===0?(0,R.jsx)(`div`,{className:`text-xs text-slate-500 border border-dashed border-slate-700 rounded-sm p-3`,children:`No MCP servers configured`}):null]})})}function Afe(e){return`${e.provider}/${e.id}`}var X0=`pibo.chat.lastSelection`,Z0=`pibo.chat.sessionView`,Q0=`pibo.chat.composerDraft.`,$0=`pibo.chat.composerHistory`,e2=`pibo.chat.showThinking`,t2=`pibo.chat.expandThinking`,n2=`pibo.chat.showRawEvents`,r2=`pibo.chat.showArchived`,i2=`pibo.chat.showArchivedRooms`,a2=`pibo.chat.newSessionProfile`,o2=100;function s2(){try{let e=localStorage.getItem(X0);if(!e)return{};let t=JSON.parse(e);if(!b2(t))return{};let n=b2(t.sessionsByRoom)?Object.fromEntries(Object.entries(t.sessionsByRoom).filter(e=>typeof e[0]==`string`&&typeof e[1]==`string`&&!!e[1])):void 0;return{roomId:typeof t.roomId==`string`&&t.roomId?t.roomId:void 0,piboSessionId:typeof t.piboSessionId==`string`&&t.piboSessionId?t.piboSessionId:void 0,...n&&Object.keys(n).length?{sessionsByRoom:n}:{}}}catch{return{}}}function jfe(e){try{let t={...s2().sessionsByRoom??{},...e.sessionsByRoom??{}};e.roomId&&e.piboSessionId&&(t[e.roomId]=e.piboSessionId),localStorage.setItem(X0,JSON.stringify({roomId:e.roomId,piboSessionId:e.piboSessionId,...Object.keys(t).length?{sessionsByRoom:t}:{}}))}catch{}}function c2(e){try{let t=s2();if(!t.sessionsByRoom?.[e])return;let{[e]:n,...r}=t.sessionsByRoom;localStorage.setItem(X0,JSON.stringify({roomId:t.roomId,piboSessionId:t.piboSessionId,...Object.keys(r).length?{sessionsByRoom:r}:{}}))}catch{}}function l2(e){try{return localStorage.getItem(Q0+e)??``}catch{return``}}function u2(e,t){try{let n=Q0+e;t?localStorage.setItem(n,t):localStorage.removeItem(n)}catch{}}function d2(){try{let e=localStorage.getItem($0);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t.filter(e=>typeof e==`string`&&e.trim().length>0).slice(-o2):[]}catch{return[]}}function Mfe(e){let t=e.trim();if(!t)return;let n=d2();if(n.at(-1)!==t)try{localStorage.setItem($0,JSON.stringify([...n,t].slice(-o2)))}catch{}}function f2(){try{return localStorage.getItem(Z0)===`terminal`?`terminal`:xc}catch{return xc}}function Nfe(e){try{localStorage.setItem(Z0,e)}catch{}}function Pfe(){return v2(e2,!0)}function p2(e){y2(e2,e)}function Ffe(){return v2(t2,!0)}function m2(e){y2(t2,e)}function Ife(){return v2(n2,!1)}function h2(e){y2(n2,e)}function Lfe(){return v2(r2,!1)}function Rfe(e){y2(r2,e)}function zfe(){return v2(i2,!1)}function g2(e){y2(i2,e)}function Bfe(){try{return localStorage.getItem(a2)??``}catch{return``}}function _2(e){try{localStorage.setItem(a2,e)}catch{}}function Vfe(){try{localStorage.removeItem(X0)}catch{}}function v2(e,t){try{let n=localStorage.getItem(e);return n===`true`?!0:n===`false`?!1:t}catch{return t}}function y2(e,t){try{localStorage.setItem(e,String(t))}catch{}}function b2(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function x2(e){if(navigator.clipboard?.writeText)return navigator.clipboard.writeText(e);let t=document.createElement(`textarea`);t.value=e,t.style.position=`fixed`,t.style.opacity=`0`,document.body.appendChild(t),t.select();try{return document.execCommand(`copy`),Promise.resolve()}finally{document.body.removeChild(t)}}function S2(e,t){return e.length>t?`${e.slice(0,Math.max(0,t-1))}…`:e}function Hfe({sessionId:e,disabled:t=!1,commands:n,skills:r,value:i,focusSignal:a,selectedWebAnnotations:o,selectedUploadAttachments:s,onValueChange:c,onCommand:l,onDetachWebAnnotation:u,onClearWebAnnotations:d,onAttachUploadedFiles:f,onDetachUploadAttachment:p,onClearUploadAttachments:m,onSend:h}){let g=(0,L.useRef)(null),_=(0,L.useRef)(null),v=(0,L.useRef)(null),y=(0,L.useRef)(null),b=(0,L.useRef)(null),x=(0,L.useRef)(null),S=(0,L.useRef)(null),[C,w]=(0,L.useState)(0),[T,E]=(0,L.useState)(0),[D,O]=(0,L.useState)(0),[k,A]=(0,L.useState)([]),[j,M]=(0,L.useState)(!1),[N,P]=(0,L.useState)(null),[ee,te]=(0,L.useState)(null),ne=(0,L.useMemo)(()=>{for(let e=D-1;e>=0;e--){let t=i[e];if(t===` `||t===`
155
+ `||t===` `)break;if(t===`$`){if(e>0&&i[e-1]===`\\`)continue;return{query:i.slice(e+1,D).toLowerCase(),startPos:e,endPos:D}}}return null},[i,D]),F=i.trim().startsWith(`/`)?i.trim().split(/\s+/)[0]:null,re=ne?C2(ne.startPos,i.slice(ne.startPos,D)):null,I=F?w2(F):null,ie=(0,L.useMemo)(()=>ne?r.filter(e=>e.name.toLowerCase().startsWith(ne.query)):[],[ne,r]),ae=(0,L.useMemo)(()=>F?n.filter(e=>e.slash.startsWith(F)):[],[F,n]),oe=re&&k.includes(re)?[]:ie,se=I&&k.includes(I)?[]:ae,ce=(0,L.useCallback)(e=>{e&&A(t=>t.includes(e)?t:[...t,e])},[]),le=(0,L.useCallback)(()=>{let e=[ie.length?re:null,ae.length?I:null].filter(e=>!!e);e.length&&A(t=>{let n=new Set(t);for(let t of e)n.add(t);return n.size===t.length?t:[...n]})},[I,ae.length,ie.length,re]);(0,L.useEffect)(()=>{let e=[re,I].filter(e=>!!e);A(t=>t.filter(t=>e.includes(t)))},[I,re]),(0,L.useEffect)(()=>{!se.length||C<se.length||w(0)},[C,se.length]),(0,L.useEffect)(()=>{!oe.length||T<oe.length||E(0)},[T,oe.length]),(0,L.useEffect)(()=>{let e=requestAnimationFrame(()=>b.current?.scrollIntoView({block:`nearest`}));return()=>cancelAnimationFrame(e)},[C,se.length]),(0,L.useEffect)(()=>{let e=requestAnimationFrame(()=>x.current?.scrollIntoView({block:`nearest`}));return()=>cancelAnimationFrame(e)},[T,oe.length]),(0,L.useEffect)(()=>{S.current=null},[e]),(0,L.useEffect)(()=>{if(!ee)return;let e=requestAnimationFrame(()=>y.current?.focus());return()=>{cancelAnimationFrame(e),URL.revokeObjectURL(ee.previewUrl)}},[ee]),(0,L.useEffect)(()=>{if(a<=0)return;let e=_.current;if(!e)return;let t=e.value.length;e.focus(),e.setSelectionRange(t,t),O(t)},[a]),(0,L.useEffect)(()=>{if(!se.length&&!oe.length)return;let e=e=>{let t=e.target;t instanceof Node&&(g.current?.contains(t)||le())};return document.addEventListener(`pointerdown`,e,!0),()=>document.removeEventListener(`pointerdown`,e,!0)},[le,se.length,oe.length]),(0,L.useLayoutEffect)(()=>{Jfe(_.current)},[i]);let ue=e=>{if(!ne||!_.current)return;let t=i.slice(0,ne.startPos),n=i.slice(ne.endPos);c(t+`$`+e+n),ce(C2(ne.startPos,`$${e}`));let r=ne.startPos+1+e.length;O(r),requestAnimationFrame(()=>{_.current?.setSelectionRange(r,r),O(r)})},de=e=>{c(e),requestAnimationFrame(()=>{let e=_.current;if(!e)return;let t=e.value.length;e.setSelectionRange(t,t),O(t)})},fe=e=>{let t=S.current;if(!t){if(e===`next`||i!==``)return!1;let t=d2();if(!t.length)return!1;let n=e===`previous`?t.length-1:0;return S.current={entries:t,index:n,draft:i},de(t[n]),!0}if(e===`previous`){let e=Math.max(0,t.index-1);return S.current={...t,index:e},de(t.entries[e]),!0}let n=t.index+1;return n>=t.entries.length?(S.current=null,de(t.draft),!0):(S.current={...t,index:n},de(t.entries[n]),!0)},pe=()=>{t||j||v.current?.click()},me=()=>{te(null)},he=e=>{if(t||j)return;let n=Ufe(e.clipboardData);if(!n.length)return;e.preventDefault(),le(),P(null);let r=n[0];te(e=>(e&&URL.revokeObjectURL(e.previewUrl),{file:r,previewUrl:URL.createObjectURL(r)}))},ge=async()=>{if(!ee||j)return;let e=ee.file;te(null),await _e([e])},_e=async e=>{if(e.length){M(!0),P({message:`Uploading ${e.length} file${e.length===1?``:`s`}...`,error:!1});try{f((await Ac(e)).files),P(null)}catch(e){P({message:e instanceof Error?e.message:String(e),error:!0})}finally{M(!1)}}},ve=async()=>{if(t)return;let e=i.trim();if(e){if(oe.length){ue(oe[Math.min(T,oe.length-1)].name);return}if(se.length&&!n.some(t=>t.slash===e.split(/\s+/)[0])){let e=se[Math.min(C,se.length-1)].slash;c(e),ce(w2(e));return}if(S.current=null,Mfe(e),c(``),e.split(/\s+/)[0]===`/upload`){pe();return}e.startsWith(`/`)&&await l(e)||await h(e)}};return(0,R.jsxs)(`div`,{ref:g,"data-pibo-debug":`composer`,"data-pibo-session-id":e??void 0,"data-pibo-state":t?`disabled`:i?`non-empty`:`empty`,className:`relative p-3 bg-[#151f24] border-t border-slate-800 max-[980px]:p-2`,children:[(0,R.jsx)(`input`,{ref:v,type:`file`,multiple:!0,className:`hidden`,onChange:e=>{let t=Array.from(e.target.files??[]);e.target.value=``,_e(t)}}),N?(0,R.jsxs)(`div`,{className:`mb-2 flex items-center gap-2 rounded-sm border px-3 py-2 text-xs ${N.error?`border-red-900 bg-red-950/40 text-red-200`:N.copyText?`border-green-900/60 bg-green-950/30 text-green-300`:`border-slate-700 bg-[#0e1116] text-slate-300`}`,children:[(0,R.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:N.message}),N.copyText?(0,R.jsx)(`button`,{type:`button`,onClick:()=>void x2(N.copyText),title:`Copy uploaded file path`,"aria-label":`Copy uploaded file path`,className:`shrink-0 rounded-sm p-0.5 text-slate-400 hover:bg-slate-800 hover:text-[#11a4d4]`,children:(0,R.jsx)($o,{size:13})}):null,(0,R.jsx)(`button`,{type:`button`,onClick:()=>P(null),title:`Hide upload status`,"aria-label":`Hide upload status`,className:`shrink-0 rounded-sm p-0.5 text-slate-500 hover:bg-slate-800 hover:text-slate-200`,children:(0,R.jsx)(Ys,{size:13})})]}):null,ee?(0,R.jsx)(`div`,{className:`fixed inset-0 z-50 grid place-items-center bg-black/60 px-4`,role:`dialog`,"aria-modal":`true`,"aria-label":`Upload pasted image`,onKeyDown:e=>{e.key===`Escape`&&me()},children:(0,R.jsxs)(`div`,{className:`w-full max-w-md rounded-sm border border-slate-700 bg-[#151f24] shadow-2xl`,children:[(0,R.jsxs)(`div`,{className:`flex items-start justify-between gap-3 border-b border-slate-800 px-4 py-3`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{className:`text-sm font-semibold text-slate-100`,children:`Pasted image detected`}),(0,R.jsx)(`div`,{className:`mt-1 text-xs text-slate-400`,children:`Upload this clipboard image to ~/.pibo/uploads?`})]}),(0,R.jsx)(`button`,{type:`button`,onClick:me,className:`rounded-sm p-1 text-slate-500 hover:bg-slate-800 hover:text-slate-200`,"aria-label":`Cancel pasted image upload`,children:(0,R.jsx)(Ys,{size:14})})]}),(0,R.jsxs)(`div`,{className:`space-y-3 px-4 py-4`,children:[(0,R.jsx)(`img`,{src:ee.previewUrl,alt:`Pasted clipboard image preview`,className:`max-h-64 w-full rounded-sm border border-slate-800 bg-[#0e1116] object-contain`}),(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-3 text-xs text-slate-400`,children:[(0,R.jsx)(`span`,{className:`min-w-0 truncate font-mono`,children:ee.file.name}),(0,R.jsx)(`span`,{className:`shrink-0 font-mono`,children:qfe(ee.file.size)})]})]}),(0,R.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-slate-800 px-4 py-3`,children:[(0,R.jsx)(`button`,{type:`button`,onClick:me,className:`h-8 rounded-sm border border-slate-700 px-3 text-xs text-slate-300 hover:border-slate-500 hover:text-slate-100`,children:`Cancel`}),(0,R.jsx)(`button`,{ref:y,type:`button`,onClick:()=>void ge(),disabled:j,className:`h-8 rounded-sm bg-[#11a4d4] px-3 text-xs font-medium text-white disabled:opacity-50`,children:`Upload image`})]})]})}):null,oe.length?(0,R.jsx)(`div`,{className:`absolute left-3 bottom-full mb-2 w-[min(520px,calc(100%-24px))] max-h-72 overflow-auto bg-[#0e1116] border border-emerald-500 rounded-sm shadow-xl`,children:oe.map((e,t)=>(0,R.jsxs)(`button`,{ref:t===T?x:null,type:`button`,onClick:()=>ue(e.name),className:`w-full grid grid-cols-[120px_1fr] gap-2 px-3 py-2 text-left border-b border-slate-800 ${t===T?`bg-emerald-500/15`:``}`,children:[(0,R.jsxs)(`span`,{className:`font-mono text-emerald-400`,children:[`$`,e.name]}),(0,R.jsx)(`span`,{className:`text-xs text-slate-400`,children:e.description??e.path??``})]},e.name))}):null,s.length?(0,R.jsxs)(`div`,{className:`mb-2 rounded-sm border border-slate-800 bg-[#0e1116] px-2.5 py-1.5`,"data-pibo-debug":`composer-upload-attachments`,"data-upload-attachment-count":s.length,children:[(0,R.jsxs)(`div`,{className:`mb-1.5 flex items-center justify-between gap-2`,children:[(0,R.jsx)(`div`,{className:`text-[11px] font-bold uppercase tracking-wider text-[#11a4d4]`,children:`Attached uploads`}),(0,R.jsx)(`button`,{type:`button`,onClick:m,className:`text-[11px] text-slate-500 hover:text-[#11a4d4]`,children:`Clear`})]}),(0,R.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:s.map(e=>(0,R.jsxs)(`div`,{title:e.path,className:`inline-flex max-w-80 items-center gap-1 rounded-sm border border-emerald-500/45 bg-emerald-500/10 px-2 py-1 text-left text-[11px] text-slate-200`,"data-pibo-debug":`composer-upload-attachment-chip`,"data-upload-path":e.path,children:[(0,R.jsx)(`span`,{className:`min-w-0 truncate`,children:S2(e.name||e.path,100)}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>void x2(e.path),title:`Copy uploaded file path`,"aria-label":`Copy uploaded file path`,className:`shrink-0 rounded-sm p-0.5 text-emerald-300 hover:bg-slate-800 hover:text-[#11a4d4]`,children:(0,R.jsx)($o,{size:11})}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>p(e.id),title:`Detach ${e.name||e.path}`,"aria-label":`Detach ${e.name||e.path}`,className:`shrink-0 rounded-sm p-0.5 text-emerald-300 hover:bg-slate-800 hover:text-slate-100`,children:(0,R.jsx)(Ys,{size:11})})]},e.id))})]}):null,o.length?(0,R.jsxs)(`div`,{className:`mb-2 rounded-sm border border-slate-800 bg-[#0e1116] px-3 py-2`,"data-pibo-debug":`composer-web-annotations`,"data-web-annotation-count":o.length,children:[(0,R.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2`,children:[(0,R.jsx)(`div`,{className:`text-[11px] font-bold uppercase tracking-wider text-[#11a4d4]`,children:`Attached web annotations`}),(0,R.jsx)(`button`,{type:`button`,onClick:d,className:`text-[11px] text-slate-500 hover:text-[#11a4d4]`,children:`Clear`})]}),(0,R.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:o.map(e=>(0,R.jsxs)(`button`,{type:`button`,onClick:()=>u(e.id),title:`Detach ${e.id}`,className:`inline-flex max-w-72 items-center gap-1 rounded-sm border border-[#11a4d4]/50 bg-[#11a4d4]/10 px-2 py-1 text-left text-[11px] text-slate-200`,"data-pibo-debug":`composer-web-annotation-chip`,"data-web-annotation-id":e.id,children:[(0,R.jsx)(`span`,{className:`min-w-0 truncate`,children:S2(e.primaryTarget||e.label||e.note||e.id,100)}),(0,R.jsx)(Ys,{size:11,className:`shrink-0 text-[#11a4d4]`})]},e.id))})]}):null,se.length?(0,R.jsx)(`div`,{className:`absolute left-3 bottom-full mb-2 w-[min(520px,calc(100%-24px))] max-h-72 overflow-auto bg-[#0e1116] border border-[#11a4d4] rounded-sm shadow-xl`,children:se.map((e,t)=>(0,R.jsxs)(`button`,{ref:t===C?b:null,type:`button`,onClick:()=>{c(e.slash),ce(w2(e.slash)),w(t)},className:`w-full grid grid-cols-[120px_1fr] gap-2 px-3 py-2 text-left border-b border-slate-800 ${t===C?`bg-[#11a4d4]/15`:``}`,children:[(0,R.jsx)(`span`,{className:`font-mono text-[#11a4d4]`,children:e.slash}),(0,R.jsx)(`span`,{className:`text-xs text-slate-400`,children:e.description})]},e.slash))}):null,(0,R.jsxs)(`div`,{className:`grid grid-cols-[1fr_auto] items-end gap-2`,children:[(0,R.jsx)(`textarea`,{ref:_,"data-pibo-debug":`composer-input`,"data-pibo-session-id":e??void 0,"data-pibo-state":t?`disabled`:i?`non-empty`:`empty`,rows:1,value:i,disabled:t,onChange:e=>{S.current=null,c(e.target.value),O(e.target.selectionStart)},onKeyDown:e=>{if(e.key===`Escape`&&(oe.length||se.length)){e.preventDefault(),e.stopPropagation(),le();return}if(oe.length&&(e.key===`ArrowDown`||e.key===`ArrowUp`)){e.preventDefault(),E(t=>e.key===`ArrowDown`?(t+1)%oe.length:(t-1+oe.length)%oe.length);return}if(se.length&&(e.key===`ArrowDown`||e.key===`ArrowUp`)){e.preventDefault(),w(t=>e.key===`ArrowDown`?(t+1)%se.length:(t-1+se.length)%se.length);return}if((e.key===`ArrowUp`||e.key===`ArrowDown`)&&!e.altKey&&!e.ctrlKey&&!e.metaKey&&fe(e.key===`ArrowUp`?`previous`:`next`)){e.preventDefault();return}e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),ve())},onPaste:he,placeholder:t?`Select a session to message`:`Send Message (/ for commands or $ for skills)`,className:`h-10 min-h-10 resize-none overflow-hidden bg-[#0e1116] border border-slate-700 rounded-sm px-3 py-2 text-sm leading-5 outline-none focus:border-[#11a4d4] disabled:opacity-50 [scrollbar-gutter:stable]`}),(0,R.jsx)(`button`,{type:`button`,disabled:t||j,onClick:()=>void ve(),title:`Send message`,"aria-label":`Send message`,className:`h-10 w-10 self-end inline-flex items-center justify-center bg-[#11a4d4] rounded-sm text-white disabled:opacity-50`,children:(0,R.jsx)(zs,{size:16})})]})]})}function C2(e,t){return`skill:${e}:${t}`}function w2(e){return`command:${e}`}function Ufe(e){let t=Array.from(e.items).filter(e=>e.kind===`file`&&e.type.startsWith(`image/`)).map(e=>e.getAsFile()).filter(e=>!!e);return(t.length?t:Array.from(e.files).filter(e=>e.type.startsWith(`image/`))).map(Wfe)}function Wfe(e){return e.name&&e.name!==`image.png`?e:new File([e],Gfe(e.type),{type:e.type||`image/png`,lastModified:Date.now()})}function Gfe(e){let t=Kfe(e),n=new Date;return`screenshot-${[n.getFullYear(),T2(n.getMonth()+1),T2(n.getDate()),`-`,T2(n.getHours()),T2(n.getMinutes()),T2(n.getSeconds())].join(``)}${t}`}function Kfe(e){switch(e){case`image/jpeg`:return`.jpg`;case`image/gif`:return`.gif`;case`image/webp`:return`.webp`;case`image/svg+xml`:return`.svg`;default:return`.png`}}function T2(e){return String(e).padStart(2,`0`)}function qfe(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KiB`:`${(e/(1024*1024)).toFixed(1)} MiB`}function Jfe(e){if(!e)return;if(!e.value.includes(`
156
+ `)&&e.value.length<80){e.style.height=``,e.style.overflowY=`hidden`;return}let t=window.getComputedStyle(e),n=E2(t.lineHeight,20),r=E2(t.borderTopWidth)+E2(t.borderBottomWidth),i=n*5+E2(t.paddingTop)+E2(t.paddingBottom);e.style.height=`auto`;let a=e.scrollHeight,o=a>i;e.style.height=`${Math.min(a,i)+r}px`,e.style.overflowY=o?`auto`:`hidden`,o&&e.selectionStart===e.value.length&&e.selectionEnd===e.value.length&&(e.scrollTop=a)}function E2(e,t=0){let n=Number.parseFloat(e);return Number.isFinite(n)?n:t}async function Yfe(e,t={}){let n=new URLSearchParams({piboSessionId:e});return t.status&&n.set(`status`,t.status),t.limit&&n.set(`limit`,String(t.limit)),t.scope&&n.set(`scope`,t.scope),B(`/api/web-annotations?${n.toString()}`)}async function Xfe(e,t){return B(`/api/web-annotations/${encodeURIComponent(e)}`,{method:`PATCH`,headers:{"content-type":`application/json`},body:JSON.stringify(O2(t))})}async function Zfe(e){let t=new URLSearchParams;return e?.trim()&&t.set(`cdpUrl`,e.trim()),B(`/api/web-annotations/targets${t.size?`?${t.toString()}`:``}`)}async function D2(e){return B(`/api/web-annotations/bindings`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(O2(e))})}async function Qfe(e,t){return B(`/api/web-annotations/bindings/${encodeURIComponent(e)}/inject`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(O2(t))})}function O2(e){return Object.fromEntries(Object.entries(e).filter(([,e])=>e!==void 0&&e!==``))}var k2=`pibo.chat.webAnnotations.cdpUrl`,A2=`pibo.chat.webAnnotations.selected.`,$fe=`pibo.chat.webAnnotations.overlay.`,j2=`pibo.chat.webAnnotations.panelCollapsed`,M2=`pibo.chat.shortcuts.webAnnotationsToggle`,N2=`Alt+Shift+A`;function epe(){try{return localStorage.getItem(k2)??``}catch{return``}}function tpe(e){try{e.trim()?localStorage.setItem(k2,e.trim()):localStorage.removeItem(k2)}catch{}}function P2(){try{return localStorage.getItem(M2)||`Alt+Shift+A`}catch{return N2}}function F2(e){let t=L2(e)||`Alt+Shift+A`;try{localStorage.setItem(M2,t)}catch{}}function I2(e){window.__piboWebAnnotations?.setShortcut?.(e);try{window.dispatchEvent(new CustomEvent(`pibo:web-annotation-shortcut-changed`,{detail:{shortcut:e}}))}catch{}}function L2(e){return e.replace(/[\u0000-\u001f\u007f]/g,``).trim().slice(0,80)}function R2(e){try{return B2(localStorage.getItem(z2(e)))}catch{return null}}function z2(e){return $fe+e}function B2(e){if(!e)return null;try{return V2(JSON.parse(e))}catch{return null}}function V2(e){if(!e||typeof e!=`object`)return null;let t=e,n=typeof t.piboSessionId==`string`?t.piboSessionId.trim():``;return n?{bindingId:typeof t.bindingId==`string`?t.bindingId:void 0,piboSessionId:n,installed:t.installed!==!1,active:t.active===!0,toolbarExpanded:t.toolbarExpanded===!0,mode:typeof t.mode==`string`?t.mode:void 0,reason:typeof t.reason==`string`?t.reason:void 0,updatedAt:typeof t.updatedAt==`string`?t.updatedAt:void 0}:null}function npe(e){try{let t=localStorage.getItem(A2+e);if(!t)return[];let n=JSON.parse(t);return Array.isArray(n)?n.filter(e=>typeof e==`string`&&!!e.trim()).slice(0,5):[]}catch{return[]}}function H2(e,t){try{let n=A2+e,r=[...new Set(t.filter(e=>e.trim()))].slice(0,5);r.length?localStorage.setItem(n,JSON.stringify(r)):localStorage.removeItem(n)}catch{}}function rpe(){try{return localStorage.getItem(j2)===`true`}catch{return!1}}function ipe(e){try{localStorage.setItem(j2,String(e))}catch{}}function ape({piboSessionId:e,annotations:t,selectedIds:n,loading:r,error:i,collapsed:a,onRefresh:o,onToggle:s,onClear:c,onCollapse:l,onClose:u}){return e?(0,R.jsxs)(`section`,{className:`border-t border-slate-800 bg-[#101d22] px-3 py-2 sm:px-4`,"data-pibo-debug":`web-annotations-session-panel`,"data-pibo-session-id":e,children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,R.jsxs)(`div`,{className:`min-w-0`,children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,R.jsx)(`div`,{className:`text-[11px] font-bold uppercase tracking-wider text-[#11a4d4]`,children:`Web annotations`}),(0,R.jsx)(`span`,{className:`rounded-sm border border-slate-700 px-1.5 py-0.5 text-[10px] text-slate-400`,children:t.length}),n.length?(0,R.jsxs)(`span`,{className:`rounded-sm border border-[#11a4d4]/50 px-1.5 py-0.5 text-[10px] text-[#11a4d4]`,children:[n.length,` attached`]}):null]}),a?null:(0,R.jsx)(`div`,{className:`text-[11px] text-slate-500`,children:`Global annotation list. Selected attachments are remembered per session.`})]}),(0,R.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-1`,children:[(0,R.jsx)(`button`,{type:`button`,onClick:o,disabled:r,title:`Refresh annotations`,"aria-label":`Refresh annotations`,className:`inline-flex h-8 w-8 items-center justify-center rounded-sm border border-slate-700 text-slate-300 hover:border-[#11a4d4] hover:text-[#11a4d4] disabled:opacity-50 sm:h-7 sm:w-7`,"data-pibo-debug":`web-annotations-refresh`,children:(0,R.jsx)(Ps,{size:12,className:r?`animate-spin`:void 0})}),(0,R.jsx)(`button`,{type:`button`,onClick:c,disabled:r||!t.length,title:`Clear visible annotations`,"aria-label":`Clear visible annotations`,className:`inline-flex h-8 w-8 items-center justify-center rounded-sm border border-slate-700 text-slate-300 hover:border-red-500 hover:text-red-300 disabled:opacity-50 sm:h-7 sm:w-7`,children:(0,R.jsx)(Ws,{size:12})}),(0,R.jsx)(`button`,{type:`button`,onClick:l,title:a?`Expand annotations panel`:`Collapse annotations panel`,"aria-label":a?`Expand annotations panel`:`Collapse annotations panel`,className:`inline-flex h-8 w-8 items-center justify-center rounded-sm border border-slate-700 text-slate-300 hover:border-[#11a4d4] hover:text-[#11a4d4] sm:h-7 sm:w-7`,children:a?(0,R.jsx)(Go,{size:12}):(0,R.jsx)(Uo,{size:12})}),(0,R.jsx)(`button`,{type:`button`,onClick:u,title:`Hide annotations panel`,"aria-label":`Hide annotations panel`,className:`inline-flex h-8 w-8 items-center justify-center rounded-sm border border-slate-700 text-slate-300 hover:border-[#11a4d4] hover:text-[#11a4d4] sm:h-7 sm:w-7`,children:(0,R.jsx)(Ys,{size:12})})]})]}),a?null:i?(0,R.jsx)(`div`,{className:`rounded-sm border border-red-900 bg-red-950/40 px-3 py-2 text-xs text-red-200`,"data-pibo-debug":`web-annotations-error`,children:q2(i,220)}):r&&!t.length?(0,R.jsx)(`div`,{className:`rounded-sm border border-slate-800 bg-[#0e1116] px-3 py-2 text-xs text-slate-400`,"data-pibo-debug":`web-annotations-loading`,children:`Loading annotations…`}):t.length?(0,R.jsx)(`div`,{className:`mt-2 grid max-h-[min(40svh,18rem)] grid-cols-1 gap-2 overflow-y-auto pr-1 sm:max-h-56 sm:grid-cols-[repeat(auto-fill,minmax(16rem,1fr))]`,"data-pibo-debug":`web-annotations-list`,children:t.map(e=>{let t=n.includes(e.id);return(0,R.jsxs)(`div`,{"data-pibo-debug":`web-annotation-chip`,"data-web-annotation-id":e.id,"data-web-annotation-session-id":e.piboSessionId,"data-web-annotation-selected":t?`true`:`false`,className:`min-w-0 rounded-sm border px-3 py-2 text-xs ${t?`border-[#11a4d4] bg-[#11a4d4]/10`:`border-slate-800 bg-[#0e1116]`}`,children:[(0,R.jsxs)(`div`,{className:`mb-1 flex items-center justify-between gap-2`,children:[(0,R.jsxs)(`span`,{className:`min-w-0 truncate font-mono text-[11px] text-slate-500`,children:[e.status,` · `,e.targetKind]}),(0,R.jsxs)(`button`,{type:`button`,onClick:()=>s(e.id),className:`inline-flex h-8 shrink-0 items-center gap-1 rounded-sm border px-2 text-[11px] sm:h-6 sm:px-1.5 ${t?`border-[#11a4d4] text-[#11a4d4]`:`border-slate-700 text-slate-300 hover:border-[#11a4d4] hover:text-[#11a4d4]`}`,children:[t?(0,R.jsx)(Ys,{size:11}):(0,R.jsx)(js,{size:11}),` `,t?`Detach`:`Attach`]})]}),(0,R.jsx)(`div`,{className:`truncate text-slate-200`,title:e.primaryTarget||e.label||e.selector||e.id,children:q2(e.primaryTarget||e.label||e.selector||e.id,120)}),e.piboContext?(0,R.jsx)(`div`,{className:`truncate font-mono text-[11px] text-[#11a4d4]`,title:e.piboContext,children:q2(e.piboContext,140)}):null,(0,R.jsx)(`div`,{className:`truncate font-mono text-[11px] text-slate-500`,title:e.url,children:K2(e.url)}),(0,R.jsx)(`div`,{className:`mt-1 line-clamp-2 text-slate-400`,title:e.note,children:q2(e.note,180)}),(0,R.jsx)(`div`,{className:`mt-1 text-[11px] text-slate-600`,children:upe(e.createdAt)})]},e.id)})}):(0,R.jsx)(`div`,{className:`rounded-sm border border-slate-800 bg-[#0e1116] px-3 py-2 text-xs text-slate-500`,"data-pibo-debug":`web-annotations-empty`,children:`No open annotations for this session.`})]}):null}function ope({piboSessionId:e,piboRoomId:t,disabled:n,panelVisible:r,onShowPanel:i,onHidePanel:a,onError:o}){let[s,c]=(0,L.useState)(!1),[l,u]=(0,L.useState)(``),[d,f]=(0,L.useState)(()=>epe()),[p,m]=(0,L.useState)([]),[h,g]=(0,L.useState)(`idle`),[_,v]=(0,L.useState)(!1),[y,b]=(0,L.useState)(null);(0,L.useEffect)(()=>{n&&c(!1)},[n]),(0,L.useEffect)(()=>{tpe(d)},[d]);let x=async()=>{if(e){g(`loading`),b(null);try{m((await Zfe(d)).targets.filter(e=>e.type===`page`||e.attachable)),g(`loaded`)}catch(e){let t=W2(e,`CDP unavailable`);m([]),g(`error`),b({kind:`error`,message:t}),o(t)}}},S=async n=>{if(!e)throw Error(`No active session context`);return Qfe(n.binding.id,U2({piboSessionId:e,piboRoomId:t,cdpUrl:d,annotationShortcut:P2()}))},C=async()=>{if(!(!e||_)){i(),v(!0),b({kind:`info`,message:`Injecting annotation overlay into this Pibo page…`});try{let n=await D2({piboSessionId:e,piboRoomId:t,url:window.location.href,title:document.title,sameOrigin:!0,annotationShortcut:P2()});if(!n.overlay)throw Error(`Overlay config missing from same-origin binding response`);await lpe(n.overlay),b({kind:`success`,message:`Annotation overlay is ready on this Pibo page. Open the overlay controls or use the shortcut to start annotating.`}),o(null)}catch(e){let t=W2(e,`Current-page annotation failed`);b({kind:`error`,message:t}),o(t)}finally{v(!1)}}},w=async()=>{if(!e||_)return;i();let n=l.trim();if(!n){b({kind:`error`,message:`URL is required`});return}if(cpe(n)){let e=`That looks like a CDP endpoint. Put it in CDP URL, and put the page you want to annotate in Annotate URL.`;b({kind:`error`,message:e}),o(e);return}v(!0),b({kind:`info`,message:`Opening target and injecting overlay…`});try{let r=await D2(U2({piboSessionId:e,piboRoomId:t,url:n,cdpUrl:d})),i=await S(r);b({kind:`success`,message:`Annotation overlay injected for ${G2(i.target??r.target,i.binding.url)}`}),u(``),o(null)}catch(e){let t=W2(e,`Annotation failed`);b({kind:`error`,message:t}),o(t)}finally{v(!1)}},T=async n=>{if(!(!e||_)){i(),v(!0),b({kind:`info`,message:`Binding selected target and injecting overlay…`});try{let r=await S(await D2(U2({piboSessionId:e,piboRoomId:t,targetId:n.id,cdpUrl:d})));b({kind:`success`,message:`Annotation overlay injected for ${G2(r.target??n,r.binding.url)}`}),o(null)}catch(e){let t=W2(e,n.attachable?`Target annotation failed`:`Target not attachable`);b({kind:`error`,message:t}),o(t)}finally{v(!1)}}};return(0,R.jsxs)(`div`,{className:`relative`,"data-pibo-debug":`web-annotations-entry`,"data-pibo-session-id":e??void 0,children:[(0,R.jsx)(spe,{onClick:()=>{n||(c(e=>!e),r||i())},title:n?`Select an active session to annotate a web page`:r?`Web Annotations`:`Show Web Annotations`,ariaLabel:`Web Annotations`,active:s||r,children:(0,R.jsx)(jo,{size:14})}),s&&!n?(0,R.jsxs)(`div`,{className:`fixed inset-x-2 bottom-3 z-40 max-h-[calc(100svh-1.5rem)] overflow-y-auto rounded-sm border border-slate-700 bg-[#0e1116] p-3 text-sm shadow-xl sm:absolute sm:inset-auto sm:right-0 sm:top-full sm:bottom-auto sm:mt-2 sm:w-[min(420px,calc(100vw-24px))] sm:max-h-[calc(100svh-5rem)]`,role:`dialog`,"aria-label":`Web Annotations`,children:[(0,R.jsxs)(`div`,{className:`mb-2 flex items-start justify-between gap-3`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{className:`text-xs font-bold uppercase tracking-wider text-[#11a4d4]`,children:`Web Annotations`}),(0,R.jsx)(`div`,{className:`mt-1 text-xs text-slate-500`,children:`Start an inactive overlay for this Pibo page, or bind a CDP target for external pages.`})]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,R.jsx)(`button`,{type:`button`,onClick:r?a:i,className:`rounded-sm p-1 text-slate-500 hover:bg-slate-800 hover:text-slate-200`,"aria-label":r?`Hide annotation list`:`Show annotation list`,title:r?`Hide annotation list`:`Show annotation list`,children:(0,R.jsx)(Is,{size:14})}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>c(!1),className:`rounded-sm p-1 text-slate-500 hover:bg-slate-800 hover:text-slate-200`,"aria-label":`Close Web Annotations panel`,children:(0,R.jsx)(Ys,{size:14})})]})]}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>void C(),disabled:_,className:`mb-3 h-10 w-full rounded-sm bg-emerald-600 px-3 text-xs font-medium text-white hover:bg-emerald-500 disabled:opacity-50 sm:h-9`,"data-pibo-debug":`web-annotations-current-page`,children:`Annotate this Pibo page`}),(0,R.jsx)(`label`,{className:`mb-2 block text-[11px] font-bold uppercase tracking-wider text-slate-500`,htmlFor:`web-annotation-url`,children:`Annotate URL via CDP`}),(0,R.jsxs)(`div`,{className:`grid grid-cols-1 gap-2 sm:grid-cols-[1fr_auto]`,children:[(0,R.jsx)(`input`,{id:`web-annotation-url`,value:l,onChange:e=>u(e.target.value),onKeyDown:e=>{e.key===`Enter`&&w()},placeholder:`http://localhost:5173`,disabled:_,className:`h-10 min-w-0 rounded-sm border border-slate-700 bg-[#151f24] px-2 text-base text-slate-100 outline-none focus:border-[#11a4d4] disabled:opacity-60 sm:h-9 sm:text-xs`}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>void w(),disabled:_||!l.trim(),className:`h-10 rounded-sm bg-[#11a4d4] px-3 text-xs font-medium text-white disabled:opacity-50 sm:h-9`,children:`Annotate`})]}),(0,R.jsx)(`label`,{className:`mt-3 mb-1 block text-[11px] font-bold uppercase tracking-wider text-slate-500`,htmlFor:`web-annotation-cdp-url`,children:`CDP URL (optional)`}),(0,R.jsx)(`input`,{id:`web-annotation-cdp-url`,value:d,onChange:e=>f(e.target.value),placeholder:`Use gateway default`,disabled:_,className:`h-10 w-full rounded-sm border border-slate-800 bg-[#151f24] px-2 font-mono text-base text-slate-300 outline-none focus:border-[#11a4d4] disabled:opacity-60 sm:h-8 sm:text-[11px]`}),(0,R.jsxs)(`div`,{className:`mt-3 flex items-center justify-between gap-2`,children:[(0,R.jsx)(`div`,{className:`text-[11px] font-bold uppercase tracking-wider text-slate-500`,children:`Existing targets`}),(0,R.jsxs)(`button`,{type:`button`,onClick:()=>void x(),disabled:_||h===`loading`,className:`inline-flex h-7 items-center gap-1 rounded-sm border border-slate-700 px-2 text-[11px] text-slate-300 hover:border-[#11a4d4] hover:text-[#11a4d4] disabled:opacity-50`,children:[(0,R.jsx)(Ps,{size:12,className:h===`loading`?`animate-spin`:void 0}),` Refresh`]})]}),(0,R.jsxs)(`div`,{className:`mt-2 max-h-[min(34svh,14rem)] overflow-auto rounded-sm border border-slate-800 sm:max-h-56`,children:[h===`idle`?(0,R.jsx)(`div`,{className:`px-3 py-3 text-xs text-slate-500`,children:`Refresh to list reachable browser targets.`}):null,h===`loading`?(0,R.jsx)(`div`,{className:`px-3 py-3 text-xs text-slate-400`,children:`Loading targets…`}):null,h===`loaded`&&!p.length?(0,R.jsx)(`div`,{className:`px-3 py-3 text-xs text-slate-500`,children:`No attachable browser targets found.`}):null,p.map(e=>(0,R.jsxs)(`div`,{className:`grid grid-cols-1 gap-2 border-b border-slate-800 px-3 py-2 last:border-b-0 sm:grid-cols-[1fr_auto]`,children:[(0,R.jsxs)(`div`,{className:`min-w-0`,children:[(0,R.jsx)(`div`,{className:`truncate text-xs text-slate-200`,title:e.title||e.url,children:q2(e.title||`Untitled target`,120)}),(0,R.jsx)(`div`,{className:`truncate font-mono text-[11px] text-slate-500`,title:e.url,children:q2(e.url||e.id,160)})]}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>void T(e),disabled:_||!e.attachable,title:e.attachable?`Attach selected target`:`Target is not attachable`,className:`h-9 rounded-sm border border-slate-700 px-2 text-[11px] text-slate-300 hover:border-[#11a4d4] hover:text-[#11a4d4] disabled:opacity-40 sm:h-8`,children:`Attach`})]},e.id))]}),y?(0,R.jsx)(`div`,{className:`mt-2 rounded-sm border px-2 py-2 text-xs ${y.kind===`error`?`border-red-900 bg-red-950/40 text-red-200`:y.kind===`success`?`border-emerald-900/60 bg-emerald-950/30 text-emerald-300`:`border-slate-700 bg-[#151f24] text-slate-300`}`,children:y.message}):null]}):null]})}function spe({title:e,ariaLabel:t,active:n,onClick:r,children:i}){return(0,R.jsx)(`button`,{type:`button`,onClick:r,title:e,"aria-label":t,className:`h-8 w-8 inline-flex items-center justify-center border rounded-sm transition-colors ${n?`border-[#11a4d4] bg-[#11a4d4]/10 text-[#11a4d4]`:`border-slate-700 text-slate-400 hover:border-[#11a4d4] hover:text-[#11a4d4]`}`,children:i})}function U2(e){return Object.fromEntries(Object.entries(e).filter(([,e])=>e&&e.trim()))}function cpe(e){try{let t=new URL(e);return t.port===`56663`||t.pathname.startsWith(`/json/`)}catch{return!1}}function lpe(e){return new Promise((t,n)=>{let r=window;try{r.__piboWebAnnotations?.remove?.(),r.__piboWebAnnotationConfig=e;let i=document.createElement(`script`);i.src=`/apps/web-annotations/overlay.js?ts=${Date.now()}`,i.async=!0,i.onload=()=>t(),i.onerror=()=>n(Error(`Could not load Web Annotation overlay script`)),document.head.appendChild(i)}catch(e){n(e)}})}function W2(e,t){let n=dpe(e);return!n||n===`undefined`?t:/target.*not found|selected cdp target/i.test(n)?`Target not found: ${n}`:/inject|overlay|evaluation/i.test(n)?`Injection failed: ${n}`:/cdp endpoint.*is unreachable|failed to fetch|fetch failed|chrome target discovery|cdp unavailable|econnrefused|connect/i.test(n)?`CDP unavailable: ${n}`:`${t}: ${n}`}function G2(e,t){let n=e?.url||t||e?.title||`target`;return K2(e?.title||n)}function K2(e){try{let t=new URL(e);return`${t.host}${t.pathname===`/`?``:t.pathname}`}catch{return q2(e,80)}}function q2(e,t){return e.length>t?`${e.slice(0,Math.max(0,t-1))}…`:e}function upe(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString(void 0,{dateStyle:`short`,timeStyle:`short`})}function dpe(e){return e instanceof Error?e.message:String(e)}function fpe(e){return!!e.workflowRunId||e.state===`workflow`||e.workflowId!==`simple-chat`}function ppe(e,t){return{workflowId:e.workflowId,state:hpe(e,t),...e.workflowRunId?{workflowRunId:e.workflowRunId}:{}}}function mpe({summary:e}){return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`span`,{className:`text-slate-600`,children:`·`}),(0,R.jsxs)(`span`,{className:`min-w-0 max-w-52 truncate rounded border border-[#11a4d4]/35 bg-[#11a4d4]/10 px-1.5 py-0.5 text-[10px] uppercase tracking-wide text-[#11a4d4]`,title:e.workflowId,children:[`workflow `,e.workflowId]}),(0,R.jsxs)(`span`,{className:gpe(e.state),children:[`state `,e.state]}),e.workflowRunId?(0,R.jsxs)(`span`,{className:`min-w-0 max-w-40 truncate rounded border border-slate-700 bg-slate-900/40 px-1.5 py-0.5 text-[10px] text-slate-400`,title:e.workflowRunId,children:[`run `,_pe(e.workflowRunId)]}):null]})}function hpe(e,t){return e.archived?`archived`:e.state&&e.state!==`workflow`?e.state.replace(/_/g,` `):t===`running`?`running`:t===`error`?`failed`:e.state?e.state.replace(/_/g,` `):e.workflowRunId?`workflow`:e.kind}function gpe(e,t=!1){let n=e.toLowerCase(),r=`shrink-0 rounded border px-1.5 py-0.5 text-[10px] uppercase tracking-wide`;return t?`${r} border-slate-700 text-slate-500`:n.includes(`failed`)||n.includes(`error`)?`${r} border-red-500/40 text-red-300 bg-red-500/10`:n.includes(`waiting`)?`${r} border-amber-500/40 text-amber-300 bg-amber-500/10`:n.includes(`complete`)||n.includes(`done`)?`${r} border-emerald-500/40 text-emerald-300 bg-emerald-500/10`:`${r} border-[#11a4d4]/40 text-[#11a4d4] bg-[#11a4d4]/10`}function _pe(e){return e.length>18?`${e.slice(0,10)}…${e.slice(-6)}`:e}function vpe({title:e,roomLabel:t,headerPiboSessionId:n,piboSessionId:r,piboRoomId:i,webAnnotationsDisabled:a,webAnnotationsPanelRendered:o,workflowHeader:s,sessionViewId:c,sessionViews:l,currentSessionView:u,allowedSessionViewIds:d,extraViewTabs:f,activeViewId:p,showRawEvents:m,showThinking:h,expandThinking:g,onShowWebAnnotationsPanel:_,onHideWebAnnotationsPanel:v,onSelectSessionView:y,onToggleRawEvents:b,onToggleThinking:x,onToggleExpandThinking:S,onError:C}){let[w,T]=(0,L.useState)(null),E=(0,L.useRef)(void 0),D=w===n,O=p??c,k=(0,L.useMemo)(()=>d?new Set(d):null,[d]);(0,L.useEffect)(()=>()=>{E.current&&window.clearTimeout(E.current)},[]);let A=()=>{n&&(x2(n).catch(()=>void 0),T(n),E.current&&window.clearTimeout(E.current),E.current=window.setTimeout(()=>T(null),900))};return(0,R.jsxs)(`div`,{className:`h-14 px-4 bg-[#151f24] border-b border-slate-800 flex items-center justify-between max-[980px]:h-auto max-[980px]:flex-wrap max-[980px]:py-2 max-[980px]:gap-2`,children:[(0,R.jsxs)(`div`,{className:`min-w-0`,children:[(0,R.jsx)(`h1`,{className:`text-base font-semibold truncate`,children:e}),(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 font-mono text-[11px] text-slate-500`,children:[(0,R.jsx)(`span`,{className:`truncate`,children:t}),n?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`span`,{className:`text-slate-600`,children:`·`}),(0,R.jsx)(`button`,{type:`button`,onMouseDown:e=>e.preventDefault(),onClick:()=>void A(),title:D?`Copied Pibo session ID`:`Copy Pibo session ID`,"aria-label":D?`Copied Pibo session ID`:`Copy Pibo session ID`,className:`min-w-0 max-w-48 truncate rounded-sm px-1 font-mono underline-offset-2 transition-colors duration-150 focus:outline-none focus:ring-1 focus:ring-[#11a4d4] ${D?`bg-emerald-500/15 text-emerald-300 ring-1 ring-emerald-400/50`:`text-slate-400 hover:text-[#11a4d4] hover:underline`}`,children:n})]}):null,s?(0,R.jsx)(mpe,{summary:s}):null]})]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(ope,{piboSessionId:r,piboRoomId:i,disabled:a,panelVisible:o,onShowPanel:_,onHidePanel:v,onError:C}),(0,R.jsxs)(`div`,{className:`flex items-center rounded-sm border border-slate-700 bg-[#0e1116] p-0.5`,children:[l.map(e=>{let t=!!(k&&!k.has(e.id));return(0,R.jsx)(`button`,{type:`button`,onClick:()=>{t||y(e.id)},disabled:t,title:t?`Project session routing uses the ${u.label} view for this session kind.`:e.description??e.label,"aria-label":t?`${e.label} view unavailable for this Project session kind`:`Switch to ${e.label} view`,className:`min-w-20 px-2.5 py-1 text-[11px] font-bold tracking-wide max-[980px]:min-w-0 max-[980px]:px-1.5 disabled:cursor-not-allowed disabled:text-slate-600 ${O===e.id?`bg-[#11a4d4]/10 text-[#11a4d4]`:`text-slate-400 hover:text-[#11a4d4] disabled:hover:text-slate-600`}`,children:e.label},e.id)}),f?.map(e=>(0,R.jsx)(`button`,{type:`button`,onClick:()=>{e.disabled||e.onSelect()},disabled:e.disabled,title:e.description??e.label,"aria-label":e.disabled?`${e.label} view unavailable`:`Switch to ${e.label} view`,className:`min-w-20 px-2.5 py-1 text-[11px] font-bold tracking-wide max-[980px]:min-w-0 max-[980px]:px-1.5 disabled:cursor-not-allowed disabled:text-slate-600 ${e.active??O===e.id?`bg-[#11a4d4]/10 text-[#11a4d4]`:`text-slate-400 hover:text-[#11a4d4] disabled:hover:text-slate-600`}`,children:e.label},e.id))]}),(0,R.jsx)(J2,{onClick:b,title:m?`Hide Raw Events`:`Show Raw Events`,ariaLabel:m?`Hide Raw Events`:`Show Raw Events`,active:m,children:(0,R.jsx)(Io,{size:14})}),(0,R.jsx)(J2,{onClick:x,title:h?`Hide Thinking`:`Show Thinking`,ariaLabel:h?`Hide Thinking`:`Show Thinking`,active:h,children:h?(0,R.jsx)(Fo,{size:14}):(0,R.jsx)(is,{size:14})}),h?(0,R.jsx)(J2,{onClick:S,title:g?`Collapse Thinking`:`Expand Thinking`,ariaLabel:g?`Collapse Thinking`:`Expand Thinking`,active:g,children:g?(0,R.jsx)(Uo,{size:14}):(0,R.jsx)(Go,{size:14})}):null]})]})}function J2({title:e,ariaLabel:t,active:n,onClick:r,children:i}){return(0,R.jsx)(`button`,{type:`button`,onClick:r,title:e,"aria-label":t,className:`h-8 w-8 inline-flex items-center justify-center border rounded-sm transition-colors ${n?`border-[#11a4d4] bg-[#11a4d4]/10 text-[#11a4d4]`:`border-slate-700 text-slate-400 hover:border-[#11a4d4] hover:text-[#11a4d4]`}`,children:i})}function ype(e){let t=[];for(let n of e){let e=t[t.length-1];if(e&&bpe(e,n)){e.count+=1,e.createdAt=n.createdAt,e.payload={...Z2(e.payload)?e.payload:{},text:`${Y2(e.payload)}${Y2(n.payload)}`};continue}t.push({...n,count:1})}return t}function bpe(e,t){if(e.type!==t.type||e.type!==`assistant_delta`&&e.type!==`thinking_delta`&&e.type!==`TEXT_MESSAGE_CONTENT`&&e.type!==`REASONING_MESSAGE_CONTENT`)return!1;let n=Z2(e.payload)?e.payload:{},r=Z2(t.payload)?t.payload:{};return X2(n)===X2(r)}function Y2(e){return Z2(e)?typeof e.text==`string`?e.text:typeof e.delta==`string`?e.delta:``:``}function X2(e){return e.eventId??e.messageId}function Z2(e){return!!e&&typeof e==`object`&&!Array.isArray(e)}function xpe({traceView:e,eventLimit:t,isFetching:n,visible:r,onLoadOlder:i}){let a=(0,L.useMemo)(()=>r?ype(e?.rawEvents??[]):[],[e?.rawEvents,r]);return r?(0,R.jsxs)(`aside`,{className:`min-h-0 overflow-auto bg-[#0e1116] border-l border-slate-800 max-[980px]:hidden`,children:[(0,R.jsx)(`div`,{className:`h-11 px-3 border-b border-slate-800 flex items-center text-xs font-bold uppercase tracking-wider`,children:`Raw Events`}),(0,R.jsxs)(`div`,{className:`p-3 flex flex-col gap-2`,children:[e&&a.length>=t?(0,R.jsx)(`button`,{type:`button`,onClick:i,disabled:n,className:`mb-1 rounded-sm border border-slate-700 px-2 py-1 text-xs text-slate-400 hover:border-[#11a4d4] hover:text-[#11a4d4] disabled:opacity-60`,children:n?`Loading raw events…`:`Load older raw events (${a.length})`}):null,a.slice(-t).reverse().map(e=>(0,R.jsxs)(`div`,{className:`border-l-2 border-[#11a4d4] bg-[#151f24] p-2`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-2 text-[#11a4d4] font-mono text-[11px] mb-1`,children:[(0,R.jsx)(`span`,{children:e.type}),e.count>1?(0,R.jsxs)(`span`,{className:`text-slate-500`,children:[`x`,e.count]}):null]}),(0,R.jsx)(z1,{value:e.payload,showControls:!1})]},e.id))]})]}):null}function Spe({traceView:e,eventLimit:t,isFetching:n,onLoadOlder:r}){if(!e?.hasOlderEvents)return null;let i=Math.min(e.eventLimit??t,e.eventCount??t),a=e.eventCount??`many`;return(0,R.jsx)(`div`,{className:`border-b border-slate-800 bg-[#101d22] px-4 py-2 text-center`,children:(0,R.jsx)(`button`,{type:`button`,onClick:r,disabled:n,className:`rounded-sm border border-slate-700 px-3 py-1 text-xs text-slate-400 hover:border-[#11a4d4] hover:text-[#11a4d4] disabled:opacity-60`,children:n?`Loading history…`:`Load older trace history (${i} of ${a} events)`})})}function Cpe({selectedPiboSessionId:e,selectedRoomId:t,fallbackRoomId:n,sessionViewId:r,loadingTrace:i,traceError:a,showRawEvents:o,currentTraceView:s,traceEventLimit:c,rawEventLimit:l,tracePageFetching:u,onLoadOlderTracePage:d,onLoadMoreRawEvents:f,headerProps:p,projectSessionCreatePanel:m,workflowStartPanel:h,projectModulePanel:g,currentSessionView:_,sessionViewProps:v,webAnnotationsPanelRendered:y,webAnnotationsPanelProps:b,composerProps:x}){return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`main`,{"data-pibo-debug":`chat-shell`,"data-pibo-session-id":e??void 0,"data-pibo-room-id":t??n??void 0,"data-pibo-view-id":r,"data-pibo-state":i?`loading`:a?`error`:e?`ready`:`empty`,className:`min-h-0 flex flex-col`,children:[(0,R.jsx)(vpe,{...p}),m?(0,R.jsx)(`div`,{className:`border-b border-slate-800 bg-[#101d22] px-4 py-3`,children:m}):null,h?(0,R.jsx)(`div`,{className:`border-b border-slate-800 bg-[#101d22] px-4 py-3`,children:h}):null,(0,R.jsx)(Spe,{traceView:s,eventLimit:c,isFetching:u,onLoadOlder:()=>d(s?.nextBeforeSequence)}),g||(a&&!s?(0,R.jsx)(`div`,{className:`min-h-0 flex-1 p-4 text-sm text-red-200`,children:a}):_.render(v)),y?(0,R.jsx)(ape,{...b}):null,(0,R.jsx)(Hfe,{...x})]}),(0,R.jsx)(xpe,{traceView:s,eventLimit:l,isFetching:u,visible:o,onLoadOlder:f})]})}var wpe=5e3,Tpe=50,Q2=new Map;function Epe(e){let t=Q2.get(e);return t||(t={snapshots:[],pending:null,pendingTimer:null},Q2.set(e,t)),t}function $2(){try{return localStorage.getItem(`pibo.chat.traceDebug`)===`true`}catch{return!1}}function Dpe(e){let t=0;for(let n of e)for(let e=0;e<n.length;e++){let r=n.charCodeAt(e);t=(t<<5)-t+r,t|=0}return t.toString(36)}function e4(e){if(!e.pending)return;let t=e.pending;if(t.layers.length===0){e.pending=null;return}let n=e.snapshots.at(-1);n&&n.trigger===t.trigger&&n.traceVersion===t.traceVersion&&JSON.stringify(n.layers.map(e=>e.ids))===JSON.stringify(t.layers.map(e=>e.ids))||(e.snapshots.push(t),e.snapshots.length>wpe&&e.snapshots.shift()),e.pending=null}function Ope(e){if(!$2())return;let t=Epe(e.piboSessionId);if(t.pendingTimer&&=(clearTimeout(t.pendingTimer),null),(!t.pending||t.pending.trigger!==e.trigger||t.pending.piboSessionId!==e.piboSessionId)&&(e4(t),t.pending={timestamp:Date.now(),piboSessionId:e.piboSessionId,trigger:e.trigger,layers:[],expansionOverrides:e.expansionOverrides,traceVersion:e.traceVersion,latestStreamId:e.latestStreamId,lastRawEventId:e.lastRawEventId}),e.layer){let n=t.pending.layers.findIndex(t=>t.kind===e.layer.kind);n>=0?t.pending.layers[n]=e.layer:t.pending.layers.push(e.layer)}e.expansionOverrides!==void 0&&(t.pending.expansionOverrides=e.expansionOverrides),t.pendingTimer=setTimeout(()=>{e4(t),t.pendingTimer=null},Tpe)}function kpe(e,t,n,r){let i=r4(n);Ope({piboSessionId:e,trigger:t,layer:{kind:`backendNodes`,ids:i.map(e=>e.id),digest:Dpe(i.map(e=>e.id)),meta:i.map(e=>({id:e.id,type:e.type,orderKey:JSON.stringify(e.orderKey),parentId:e.parentId}))},...r})}function t4(e){let t=Q2.get(e);return t?(e4(t),t.snapshots):[]}function n4(e){if(e){let t=t4(e);return JSON.stringify({piboSessionId:e,snapshots:t},null,2)}let t={};for(let[e,n]of Q2)e4(n),t[e]=n.snapshots;return JSON.stringify(t,null,2)}function Ape(e){e?Q2.delete(e):Q2.clear()}function r4(e){return e.flatMap(e=>[e,...r4(e.children??[])])}typeof window<`u`&&(window.__piboTraceSnapshots={exportAsJson:e=>{let t=n4(e),n=new Blob([t],{type:`application/json`}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=`trace-snapshots-${e??`all`}-${Date.now()}.json`,i.click(),URL.revokeObjectURL(r)},getSnapshots:t4,clearSnapshots:Ape,exportSnapshots:n4});function i4(e){let t=!1,n=e.map(e=>e.children.length?(t=!0,{...e,children:i4(e.children)}):e);return jpe(n)?t?n:[...e]:[...n].sort(a4)}function jpe(e){for(let t=1;t<e.length;t+=1)if(a4(e[t-1],e[t])>0)return!1;return!0}function a4(e,t){let n=Mpe(e,t);if(n!==0)return n;let r=Npe(e.startedAt,t.startedAt);if(r!==0)return r;let i=Gc(e.orderKey,t.orderKey);return i===0?e.id.localeCompare(t.id):i}function Mpe(e,t){if(!e.eventId||e.eventId!==t.eventId)return 0;let n=e.orderKey?.phaseRank,r=t.orderKey?.phaseRank;return n===void 0||r===void 0?0:n-r}function Npe(e,t){return!e&&!t?0:e?t?e.localeCompare(t):-1:1}function o4(e){let t=[],n=[...e].reverse();for(;n.length;){let e=n.pop();if(e){t.push(e);for(let t=e.children.length-1;t>=0;--t)n.push(e.children[t])}}return t}function Ppe(e,t,n,r){if(!s4(t))return;let i=r.get(e)?.filter(e=>e.metadata?.subagentToolName===t)??[],a=Ipe(n);return a?i.find(e=>e.metadata?.threadKey===a)?.id:i.length===1?i[0].id:void 0}function s4(e){return e.startsWith(`pibo_subagent_`)}function Fpe(e){return e.slice(14)}function Ipe(e){let t=`args`in e&&e.args&&typeof e.args==`object`&&!Array.isArray(e.args)?e.args:void 0,n=t&&`threadKey`in t?t.threadKey:void 0;return typeof n==`string`&&n.trim()?n.trim():void 0}function c4(e,t,n,r){let i=Rpe(e,t,n,r);if(!i)return;let a=e.children.find(e=>e.id===i.id);if(a){zpe(a,i),a.runId=i.runId??a.runId;return}e.children.push(i)}function Lpe(e){let t=new Map;for(let n of o4(e)){let e=u4(n.output);if(!e)continue;let r=f4(e.runId);r&&t.set(r,{snapshot:e,completedAt:f4(e.completedAt)??f4(e.updatedAt)??n.completedAt})}for(let n of o4(e)){if(n.type!==`agent.async`||!n.runId)continue;let e=t.get(n.runId);if(!e)continue;let r=f4(e.snapshot.status);r!==`completed`&&r!==`cancelled`&&r!==`failed`||(n.status=r===`failed`?`error`:`done`,n.completedAt=e.completedAt??n.completedAt,n.output=e.snapshot,r===`failed`&&(n.error=f4(e.snapshot.summary)??n.error))}}function Rpe(e,t,n,r){if(!l4(e))return;let i=u4(e.output),a=p4(e.input)?e.input:{},o=f4(i?.toolName)??f4(a.toolName)??r?.title;if(!o||!s4(o))return;let s=f4(r?.summary)??Fpe(o),c=f4(i?.runId),l=f4(i?.status),u=a.arguments,d=f4(i?.completionPolicy)??f4(a.completionPolicy);return{id:`${e.id}:async-agent`,parentId:e.id,piboSessionId:t,eventId:e.eventId,toolCallId:e.toolCallId,runId:c,type:`agent.async`,title:s,status:Bpe(e,l),startedAt:r?.startedAt??n??e.startedAt,completedAt:l===`completed`||l===`cancelled`?e.completedAt:void 0,summary:`Started by ${e.title}`,input:{startedBy:e.title,startToolCallId:e.toolCallId,toolName:o,subagentName:s,runId:c,completionPolicy:d,arguments:u,threadKey:p4(r?.input)?r.input.threadKey:void 0},output:i,error:e.error,linkedPiboSessionId:r?.linkedPiboSessionId??e.linkedPiboSessionId,source:e.source,stableKey:c?`async-agent:${c}`:`${e.stableKey??e.id}:async-agent`,orderKey:Wc(e.orderKey,`agent.async`),children:[]}}function l4(e){return e.type===`tool.call`&&e.title===`pibo_run_start`}function zpe(e,t){e.status=t.status,e.summary=t.summary??e.summary,e.input=t.input??e.input,e.output=t.output??e.output,e.error=t.error??e.error,e.completedAt=t.completedAt??e.completedAt,e.linkedPiboSessionId=t.linkedPiboSessionId??e.linkedPiboSessionId}function u4(e){if(p4(e)){if(d4(e))return e;if(p4(e.details)&&d4(e.details))return e.details}}function d4(e){return typeof e.runId==`string`&&typeof e.toolName==`string`}function f4(e){return typeof e==`string`?e:void 0}function Bpe(e,t){return e.status===`error`||t===`failed`?`error`:t===`completed`||t===`cancelled`?`done`:`running`}function p4(e){return!!e&&typeof e==`object`&&!Array.isArray(e)}function Vpe(e){let t=(e??``).trim();if(!t.startsWith(`<pibo_run_notification>`)||!t.endsWith(`</pibo_run_notification>`))return;let n=t.slice(23,t.length-24).trim();try{let e=JSON.parse(n);return!e||typeof e!=`object`||Array.isArray(e)?void 0:e}catch{return}}function Hpe(e){let t=Upe(e.notification),n=t.length===1?t[0]:void 0,r=h4(e.notification.failed),i=h4(e.notification.running);return{id:e.id,entryId:e.entryId,piboSessionId:e.piboSessionId,eventId:e.eventId,runId:typeof n?.runId==`string`?n.runId:void 0,type:`yielded.run`,title:`Run Notification`,status:r>0?`error`:i>0?`running`:`done`,startedAt:e.startedAt,summary:Wpe(e.notification),output:e.notification,source:e.source,stableKey:e.stableKey??e.id,orderKey:e.orderKey,children:[]}}function Upe(e){return[...m4(e.completed),...m4(e.failed),...m4(e.cancelled),...m4(e.running)]}function m4(e){return Array.isArray(e)?e.filter(Gpe):[]}function h4(e){return Array.isArray(e)?e.length:0}function Wpe(e){let t=[[h4(e.completed),`completed`],[h4(e.failed),`failed`],[h4(e.cancelled),`cancelled`],[h4(e.running),`running`]].filter(([e])=>Number(e)>0).map(([e,t])=>`${e} ${t}`);return t.length?t.join(`, `):`No yielded run updates`}function Gpe(e){return!!e&&typeof e==`object`&&!Array.isArray(e)}function Kpe(e,t,n,r,i,a,o,s,c){let l=r.payload;if(o&&ome(l)&&!sme(l,s)||o&&cme(l,c))return;if(l.type===`assistant_delta`){nme(e,t,l,c,r.createdAt,r.eventSequence,r.streamId,r.streamFrameIndex);return}if(l.type===`thinking_delta`){rme(e,t,l,c,r.createdAt,r.eventSequence,r.streamId,r.streamFrameIndex);return}if(l.type===`assistant_message`){let i=qpe(n,l,r.createdAt,r.eventSequence,r.streamId,r.streamFrameIndex),a=t.get(i.id);if(a){_4(a,i),v4(t,a);return}v4(t,i),e.push(i),t.set(i.id,i);return}let u=tme(n,l,i,a,c,r.createdAt,r.eventSequence,r.streamId,r.streamFrameIndex);if(u){if(u.type===`agent.turn`&&u.eventId){let e=[...t.values()].find(e=>e.type===`agent.turn`&&e.eventId===u.eventId);if(e){e.status=u.status,e.completedAt=u.completedAt??e.completedAt;return}}if(u.type===`assistant.message`){let e=t.get(u.id);if(e){_4(e,u),v4(t,e);return}v4(t,u)}if(u.type===`execution.compaction`){let t=ume(e);if(t){dme(t,u);return}}if(u.type===`model.reasoning`){let e=t.get(u.id);if(e){ime(e,u);return}}if(u.toolCallId){let e=[...t.values()].find(e=>e.toolCallId===u.toolCallId&&(e.type===`tool.call`||e.type===`agent.delegation`));if(e){if(l4(e)&&u.type===`agent.delegation`){c4(e,n,r.createdAt,u);return}lme(e,u),c4(e,n,r.createdAt);return}}if(!(u.eventId&&t.has(u.id))){Jpe(u,t),c4(u,n,r.createdAt),e.push(u);for(let e of o4([u]))t.set(e.id,e)}}}function qpe(e,t,n,r,i,a){let o=typeof t.eventId==`string`?t.eventId:void 0,s=w4(t);return{id:s?C4(s):`event:${t.type}:${D4(t)}`,piboSessionId:e,eventId:o,parentId:o?S4(o):void 0,type:`assistant.message`,title:`Agent Message`,status:`done`,startedAt:n,summary:t.text,output:t.text,source:`event-log`,stableKey:s?`assistant:${s}`:x4(t),orderKey:y4(r,t.type,i,a),children:[]}}function Jpe(e,t){if(e.type!==`execution.command`||e.parentId&&t.has(e.parentId))return;let n=[...t.values()].filter(n=>{if(n.type!==`agent.turn`||!n.startedAt||!e.startedAt||n.startedAt>e.startedAt)return!1;let r=Ype(n,t);return r===void 0||e.startedAt<=r}).sort(a4).at(-1);n&&(e.parentId=n.id)}function Ype(e,t){return e.completedAt?e.completedAt:[...t.values()].filter(t=>t.type===`error`&&t.eventId!==void 0&&t.eventId===e.eventId&&t.startedAt!==void 0).sort(a4).at(0)?.startedAt}function Xpe(e){return e.some(e=>{let t=e.payload.type;return t!==`assistant_delta`&&t!==`thinking_delta`})}function Zpe(e){if(e.type===`assistant_delta`){if(e.text.length===0)return;let t=w4(e);return t?C4(t):void 0}if(e.type===`thinking_delta`){if(e.text.length===0)return;let t=E4(e);return t?T4(t):void 0}}function Qpe(e,t){let n=t.payload;if(n.type!==`message_queued`||n.source!==`user`)return!1;let r=typeof n.eventId==`string`?n.eventId:t.eventId,i=typeof n.text==`string`?n.text:void 0;return e.some(e=>e.type!==`user.message`||e.source!==`transcript`?!1:r&&(e.entryId===r||e.stableKey===`entry:${r}`)?!0:!!(i&&$pe(e)===i))}function $pe(e){if(typeof e.output==`string`)return e.output;if(typeof e.summary==`string`)return e.summary}function g4(e){if(e.streamId!==void 0){let t=e.payload;return e.streamFrameIndex===void 0?`stream:${e.streamId}:${t.type}`:`stream:${e.streamId}:${e.streamFrameIndex}:${t.type}`}return e.eventSequence===void 0?`id:${e.id}`:`sequence:${e.piboSessionId??``}:${e.eventSequence}`}function eme(e,t){let n=t;for(let t of e)t.streamId!==void 0&&(n=n===void 0?t.streamId:Math.max(n,t.streamId));return n}function tme(e,t,n,r,i,a,o,s,c){let l=`eventId`in t&&typeof t.eventId==`string`?t.eventId:void 0,u=`event:${t.type}:${l??D4(t)}`,d=l?S4(l):void 0,f={id:u,piboSessionId:e,eventId:l,startedAt:a,source:`event-log`,stableKey:x4(t),orderKey:y4(o,t.type,s,c),children:[]};switch(t.type){case`message_queued`:{let n=Vpe(t.text);return t.source===`service`&&n?Hpe({id:u,piboSessionId:e,eventId:l,startedAt:a,source:`event-log`,stableKey:l?`run-notification:${l}`:u,orderKey:y4(o,t.type,s,c),notification:n}):{...f,type:`user.message`,title:`User Message`,status:`done`,summary:t.text,output:t.text}}case`message_started`:case`message_finished`:return t.source===`service`?void 0:{...f,id:l?S4(l):u,type:`agent.turn`,title:`Agent Turn`,status:t.type===`message_finished`||i!==`running`?`done`:`running`,completedAt:t.type===`message_finished`?a:void 0,stableKey:l?`turn:${l}`:f.stableKey};case`thinking_finished`:{if(!fme(t.text))return;let e=E4(t);return{...f,id:e?T4(e):u,parentId:d,type:`model.reasoning`,title:`Thinking`,status:`done`,summary:t.text,output:t.text,stableKey:e?`reasoning:${e}`:f.stableKey}}case`assistant_message`:{let e=w4(t);return{...f,id:e?C4(e):u,parentId:d,type:`assistant.message`,title:`Agent Message`,status:`done`,summary:t.text,output:t.text,stableKey:e?`assistant:${e}`:f.stableKey}}case`tool_call`:case`tool_execution_started`:case`tool_execution_updated`:case`tool_execution_finished`:{let o=s4(t.toolName),s=r.get(t.toolCallId)??(o?Ppe(e,t.toolName,t,n):void 0);return{...f,id:`tool:${t.toolCallId}`,parentId:d,toolCallId:t.toolCallId,type:o?`agent.delegation`:`tool.call`,title:t.toolName,status:t.type===`tool_execution_finished`?t.isError?`error`:`done`:i===`running`&&(t.type===`tool_execution_started`||t.type===`tool_execution_updated`)?`running`:`done`,completedAt:t.type===`tool_execution_finished`?a:void 0,input:`args`in t?t.args:void 0,output:t.type===`tool_execution_finished`?t.result:t.type===`tool_execution_updated`?t.partialResult:void 0,error:t.type===`tool_execution_finished`&&t.isError?pme(t.result):void 0,linkedPiboSessionId:s,stableKey:`tool:${t.toolCallId}`,children:[]}}case`subagent_session`:return{...f,id:t.toolCallId?`tool:${t.toolCallId}`:u,eventId:l,toolCallId:t.toolCallId,type:`agent.delegation`,title:t.toolName,status:i===`running`?`running`:`done`,summary:t.subagentName,input:{subagentName:t.subagentName,threadKey:t.threadKey},linkedPiboSessionId:t.childPiboSessionId,stableKey:t.toolCallId?`tool:${t.toolCallId}`:`subagent:${t.childPiboSessionId}`,children:[]};case`execution_result`:return ame(t.action)?void 0:{...f,type:`execution.command`,title:t.action,status:`done`,input:{action:t.action},output:t.result};case`compaction_start`:return{...f,id:`event:compaction:${o??s??D4(t)}`,type:`execution.compaction`,title:`compact`,status:`running`,summary:`Compacting`,input:{reason:t.reason},stableKey:`compaction:active`};case`compaction_end`:return{...f,id:`event:compaction:end:${o??s??D4(t)}`,type:`execution.compaction`,title:`compact`,status:t.errorMessage?`error`:`done`,completedAt:a,summary:t.aborted?`Compaction skipped`:t.errorMessage?`Compaction failed`:`Compacted`,input:{reason:t.reason},output:t.result,error:t.errorMessage,stableKey:`compaction:active`};case`session_error`:return{...f,type:`error`,title:`Session Error`,status:`error`,summary:t.errorDetails?.userMessage,input:t.errorDetails,error:t.error,output:t.error};default:return}}function nme(e,t,n,r,i,a,o,s){if(n.text.length===0)return;let c=w4(n),l=c?C4(c):`event:assistant_delta:${D4(n)}`,u=t.get(l);if(u){let e=`${typeof u.output==`string`?u.output:``}${n.text}`;u.status=r===`running`?`running`:`done`,u.summary=e,u.output=e;return}let d={id:l,parentId:n.eventId?S4(n.eventId):void 0,piboSessionId:n.piboSessionId,eventId:n.eventId,type:`assistant.message`,title:`Agent Message`,status:r===`running`?`running`:`done`,startedAt:i,summary:n.text,output:n.text,source:`event-log`,stableKey:c?`assistant:${c}`:l,orderKey:y4(a,n.type,o,s),children:[]};e.push(d),t.set(d.id,d)}function _4(e,t){e.status=t.status,e.summary=t.summary??e.summary,e.output=t.output??e.output,e.error=t.error??e.error,e.completedAt=t.completedAt??e.completedAt}function rme(e,t,n,r,i,a,o,s){if(n.text.length===0)return;let c=E4(n),l=c?T4(c):`event:thinking_delta:${D4(n)}`,u=t.get(l);if(u){let e=`${typeof u.output==`string`?u.output:``}${n.text}`;u.status=r===`running`?`running`:`done`,u.summary=e,u.output=e;return}let d={id:l,parentId:n.eventId?S4(n.eventId):void 0,piboSessionId:n.piboSessionId,eventId:n.eventId,type:`model.reasoning`,title:`Thinking`,status:r===`running`?`running`:`done`,startedAt:i,summary:n.text,output:n.text,source:`event-log`,stableKey:c?`reasoning:${c}`:l,orderKey:y4(a,n.type,o,s),children:[]};e.push(d),t.set(d.id,d)}function ime(e,t){e.status=t.status,e.summary=t.summary??e.summary,e.output=t.output??e.output,e.completedAt=t.completedAt??e.completedAt}function v4(e,t){if(!t.parentId||t.status!==`done`)return;let n=e.get(t.parentId);!n||n.type!==`agent.turn`||(n.status=`done`,n.completedAt=t.completedAt??t.startedAt??n.completedAt)}function ame(e){return e===`session.fork`||e===`session.clone`||e===`session.switch`}function ome(e){return e.type===`message_queued`||e.type===`message_started`||e.type===`message_finished`||e.type===`assistant_delta`||e.type===`assistant_message`||e.type===`thinking_started`||e.type===`thinking_delta`||e.type===`thinking_finished`}function sme(e,t){let n=`eventId`in e&&typeof e.eventId==`string`?e.eventId:void 0;return!!(n&&t.has(n))}function cme(e,t){return t!==`running`&&e.type===`tool_call`}function y4(e,t,n,r){return e===void 0&&(n!==void 0||r!==void 0)?Hc(n,r,b4(t)):Vc(e,b4(t))}function b4(e){switch(e){case`message_queued`:return`user.message`;case`message_started`:case`message_finished`:return`agent.turn`;case`thinking_started`:case`thinking_delta`:case`thinking_finished`:return`model.reasoning`;case`tool_call`:case`tool_execution_started`:case`tool_execution_updated`:case`tool_execution_finished`:case`subagent_session`:return`tool.call`;case`assistant_delta`:case`assistant_message`:return`assistant.message`;case`execution_result`:return`execution.command`;case`compaction_start`:case`compaction_end`:return`execution.compaction`;case`session_error`:return`error`;default:return`execution.command`}}function x4(e){let t=`eventId`in e&&typeof e.eventId==`string`?e.eventId:void 0;if(e.type===`tool_call`||e.type===`tool_execution_started`||e.type===`tool_execution_updated`||e.type===`tool_execution_finished`||e.type===`subagent_session`&&e.toolCallId)return`tool:${e.toolCallId}`;if(t&&(e.type===`message_started`||e.type===`message_finished`))return`turn:${t}`;if(e.type===`thinking_started`||e.type===`thinking_delta`||e.type===`thinking_finished`){let t=E4(e);if(t)return`reasoning:${t}`}if(e.type===`assistant_delta`||e.type===`assistant_message`){let t=w4(e);if(t)return`assistant:${t}`}return`event:${e.type}:${t??D4(e)}`}function S4(e){return`event:message:${e}`}function C4(e){return`event:assistant:${e}`}function w4(e){if(!e.eventId)return;let t=typeof e.assistantIndex==`number`?e.assistantIndex:e.contentIndex;return typeof t==`number`?`${e.eventId}:assistant:${t}`:e.eventId}function T4(e){return`event:thinking:${e}`}function E4(e){if(!e.eventId)return;let t=typeof e.thinkingIndex==`number`?e.thinkingIndex:e.contentIndex;return typeof t==`number`?`${e.eventId}:thinking:${t}`:e.eventId}function lme(e,t){e.status=t.status,e.summary=t.summary??e.summary,e.input=t.input??e.input,e.output=t.output??e.output,e.error=t.error??e.error,e.completedAt=t.completedAt??e.completedAt,e.linkedPiboSessionId=t.linkedPiboSessionId??e.linkedPiboSessionId}function ume(e){return o4([...e]).reverse().find(e=>e.type===`execution.compaction`&&e.status===`running`)}function dme(e,t){e.status=t.status,e.summary=t.summary??e.summary,e.input=t.input??e.input,e.output=t.output??e.output,e.error=t.error??e.error,e.completedAt=t.completedAt??e.completedAt}function fme(e){return typeof e==`string`&&e.trim().length>0}function pme(e){if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}function D4(e){return mme(new TextEncoder().encode(JSON.stringify(e))).slice(0,48)}function mme(e){let t=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_`,n=``,r=0;for(;r+2<e.length;r+=3){let i=e[r]<<16|e[r+1]<<8|e[r+2];n+=t[i>>18&63]+t[i>>12&63]+t[i>>6&63]+t[i&63]}if(r<e.length){let i=e[r],a=r+1<e.length?e[r+1]:0,o=i<<16|a<<8;n+=t[o>>18&63]+t[o>>12&63],r+1<e.length&&(n+=t[o>>6&63])}return n}function hme(e){let t=new Map;for(let n of e)t.set(n.id,n);let n=[];for(let r of e){if(!r.parentId){n.push(r);continue}let e=t.get(r.parentId);e?e.children.push(r):n.push(r)}return i4(n)}function gme(e,t,n){return t.map(t=>O4(e,t,n))}function O4(e,t,n){let r=e.get(t.id);if(t.children.length===0){let e=r!==void 0&&r.children.length===0;return r&&e&&(n&&!n.has(t.id)||k4(r,t))?r:e?{...t,children:r.children}:{...t,children:[]}}let i=t.children.map(t=>O4(e,t,n)),a=r!==void 0&&r.children.length===i.length&&r.children.every((e,t)=>e===i[t]);return r&&a&&(n&&!n.has(t.id)||k4(r,t))?r:a?{...t,children:r?.children??i}:{...t,children:i}}function k4(e,t){return e.id===t.id&&e.parentId===t.parentId&&e.entryId===t.entryId&&e.piboSessionId===t.piboSessionId&&e.eventId===t.eventId&&e.toolCallId===t.toolCallId&&e.runId===t.runId&&e.type===t.type&&e.title===t.title&&e.status===t.status&&e.startedAt===t.startedAt&&e.completedAt===t.completedAt&&e.durationMs===t.durationMs&&e.summary===t.summary&&e.input===t.input&&e.output===t.output&&e.error===t.error&&e.linkedPiboSessionId===t.linkedPiboSessionId&&e.source===t.source&&e.stableKey===t.stableKey&&_me(e.orderKey,t.orderKey)}function _me(e,t){return e===t?!0:!e||!t?!1:e.sourceRank===t.sourceRank&&e.turnSeq===t.turnSeq&&e.transcriptIndex===t.transcriptIndex&&e.contentPartIndex===t.contentPartIndex&&e.eventSequence===t.eventSequence&&e.streamId===t.streamId&&e.streamFrameIndex===t.streamFrameIndex&&e.phaseRank===t.phaseRank}function vme(e,t,n){if(!t.length)return e;let r=new Set(e.rawEvents.map(e=>g4(e))),i=[];for(let e of t){let t=g4(e);r.has(t)||(r.add(t),i.push(e))}if(!i.length)return e;let a=o4(e.nodes),o=[],s=new Map,c=new Map;for(let e of a){c.set(e.id,e);let t={...e,children:[]};o.push(t),s.set(t.id,t)}let l=new Map,u=new Map,d=new Set,f=[],p=new Set;for(let t of i){if(Qpe(o,t))continue;f.push(t);let r=Zpe(t.payload);p&&r?p.add(r):p=void 0,Kpe(o,s,e.piboSessionId,t,l,u,!1,d,n)}if(!f.length)return e;let m=hme(o);Xpe(f)&&Lpe(m);let h=gme(c,m,p);return{...e,rawEvents:e.rawEvents.length?[...e.rawEvents,...f]:f,nodes:h,latestStreamId:eme(f,e.latestStreamId)}}function A4(e){let t=new Map;if(M4(e.nodes,t),!t.size)return e;let{nodes:n,changed:r}=N4(e.nodes,t);return r?{...e,nodes:n}:e}function yme(e){return e.some(j4)}function bme(e){let t=new Map;return F4(e,e=>{if(e.type!==`user.message`||!e.entryId)return;let n=I4(e),r=t.get(n);r?r.push(e.entryId):t.set(n,[e.entryId])}),t}function xme(e,t){if(!t.size)return;let n=new Map;F4(e,e=>{if(e.type!==`user.message`||e.entryId)return;let r=I4(e),i=t.get(r);if(!i?.length)return;let a=n.get(r)??0,o=i[a];o&&(e.entryId=o,n.set(r,a+1))})}function j4(e){let t=e.payload;return!!(t&&typeof t==`object`&&!Array.isArray(t)&&`type`in t&&t.type===`message_queued`&&`source`in t&&t.source===`user`&&`text`in t&&typeof t.text==`string`)}function M4(e,t){for(let n of e){if(n.type===`user.message`&&!P4(n)){let e=I4(n);e&&t.set(e,(t.get(e)??0)+1)}M4(n.children,t)}}function N4(e,t){let n=!1,r=[];for(let i of e){if(P4(i)){let e=I4(i),r=e?t.get(e)??0:0;if(r>0){t.set(e,r-1),n=!0;continue}}let e=N4(i.children,t);n||=e.changed,r.push(e.changed?{...i,children:e.nodes}:i)}return{nodes:n?r:e,changed:n}}function P4(e){return e.type===`user.message`?e.source===`event-log`&&e.id.startsWith(`event:message_queued:`)?!0:[e.id,e.stableKey,e.eventId].filter(e=>typeof e==`string`).some(e=>e.startsWith(`optimistic:user-message:`)||e.includes(`:optimistic:user-message:`)):!1}function F4(e,t){for(let n of e)t(n),F4(n.children,t)}function I4(e){return typeof e.output==`string`?e.output:typeof e.summary==`string`?e.summary:``}function Sme({selectedPiboSessionId:e,reconciledBaseTraceView:t,liveTraceOverlay:n,selectedSessionStatus:r,persistedUserMessageIndexForBaseTrace:i,now:a}){if(!e||t?.piboSessionId!==e)return{traceView:null};let o=n?.piboSessionId===e?n.events:[];if(!o.length)return{traceView:t};let s=a?.(),c=vme(t,o,r??`idle`),l=yme(o);return l&&xme(c.nodes,i),{traceView:l?A4(c):c,liveTraceComputeDurationMs:s!==void 0&&a?a()-s:void 0}}function L4(e,t){for(let n of e)t(n),L4(n.children,t)}function Cme(e){return typeof e.output==`string`?e.output:typeof e.summary==`string`?e.summary:``}function R4(e){if(!e)return;let t=0;return L4(e.nodes,e=>{e.type===`assistant.message`&&(t+=Cme(e).length)}),t}function wme({selectedPiboSessionId:e,baseTraceView:t,liveTraceOverlay:n,selectedSessionStatus:r}){let i=(0,L.useMemo)(()=>t?A4(t):null,[t]),a=(0,L.useMemo)(()=>i?bme(i.nodes):new Map,[i]),o=(0,L.useMemo)(()=>Sme({selectedPiboSessionId:e,reconciledBaseTraceView:i,liveTraceOverlay:n,selectedSessionStatus:r,persistedUserMessageIndexForBaseTrace:a,now:nZ()?()=>performance.now():void 0}),[n,e,r,i,a]),s=o.traceView;return(0,L.useEffect)(()=>{!e||!s?.piboSessionId||!nZ()||(pZ(s.piboSessionId,{overlayEventCount:n?.piboSessionId===s.piboSessionId?n.events.length:0,traceBaseOutputLength:R4(t),currentOutputLength:R4(s)}),o.liveTraceComputeDurationMs!==void 0&&cZ(s.piboSessionId,o.liveTraceComputeDurationMs))},[t,o.liveTraceComputeDurationMs,s,n,e]),(0,L.useEffect)(()=>{let e=()=>{!s?.piboSessionId||!$2()||kpe(s.piboSessionId,`tab:${document.visibilityState}`,s.nodes,{traceVersion:s.version,latestStreamId:s.latestStreamId,lastRawEventId:s.rawEvents.at(-1)?.id})};return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[s]),s}var z4=1e4,B4=30*6e4,V4=2e3;function Tme(e,t=!1,n){return[`chat`,`bootstrap`,e??``,t?`archived`:`active`,n??``]}function Eme(e=!1,t,n){return[`chat`,`sessions`,e?`archived`:`active`,t??``,n??``]}function Dme(e){return[`chat`,`trace-summary`,e]}function Ome(e,t=!1,n,r=t?60:120){return[`chat`,`session-page`,e,t?`archived`:`active`,n??``,r]}function H4(e,t={}){let n=t.pageSize??t.eventLimit??2e3;return[`chat`,`trace-page`,e,t.includeRawEvents?`raw`:`compact`,t.rawEventsLimit??80,n,t.beforeSequence===void 0?`tail`:String(t.beforeSequence)]}function U4(e){return[`chat`,`trace-summary`,e]}function W4(e){return[`chat`,`trace-page`,e]}function kme(e,t){if(!e||e.piboSessionId!==t.piboSessionId)return e;let n=t.latestStreamId,r=Ame(t),i=G4(t.nodes),a=e.events.filter(e=>{if(n!==void 0&&e.streamId!==void 0&&e.streamId<=n||j4(e)&&i.has(e.payload.text))return!1;let t=q4(e);return!t||!r.has(t)});return a.length?{...e,events:a}:null}function G4(e){let t=new Set;for(let n of e){if(n.type===`user.message`&&n.source===`transcript`){let e=jme(n);e&&t.add(e)}for(let e of G4(n.children))t.add(e)}return t}function Ame(e){let t=new Set;for(let n of e.rawEvents){let e=q4(n);e&&t.add(e)}return K4(e.nodes,t),t}function K4(e,t){for(let n of e){if(n.type===`user.message`){let e=n.id.startsWith(`event:message_queued:`)?n.id.slice(21):void 0;e&&t.add(`${n.piboSessionId}:message_queued:${e}`),n.source===`transcript`&&n.entryId&&t.add(`${n.piboSessionId}:message_queued:${n.entryId}`)}n.eventId&&n.type===`assistant.message`&&(t.add(`${n.piboSessionId}:assistant_delta:${n.eventId}`),t.add(`${n.piboSessionId}:assistant_message:${n.eventId}`)),n.eventId&&n.type===`model.reasoning`&&(t.add(`${n.piboSessionId}:thinking_delta:${n.eventId}`),t.add(`${n.piboSessionId}:thinking_finished:${n.eventId}`)),K4(n.children,t)}}function q4(e){let t=e.payload;if(!t||typeof t!=`object`||Array.isArray(t))return;let n=`eventId`in t&&typeof t.eventId==`string`?t.eventId:e.eventId,r=`piboSessionId`in t&&typeof t.piboSessionId==`string`?t.piboSessionId:e.piboSessionId;if(!(!n||!r))return`${r}:${e.type}:${n}`}function jme(e){return typeof e.output==`string`?e.output:e.output&&typeof e.output==`object`&&`text`in e.output&&typeof e.output.text==`string`?e.output.text:``}function Mme(e,t){if(e.piboSessionId!==t.piboSessionId)return e;let n=new Set,r=[...t.nodes,...e.nodes].filter(e=>n.has(e.id)?!1:(n.add(e.id),!0)),i=new Set,a=[...t.rawEvents,...e.rawEvents].filter(e=>{let t=e.id||`${e.eventSequence??``}:${e.type}:${e.createdAt}`;return i.has(t)?!1:(i.add(t),!0)});return{...e,version:e.version,nodes:r,rawEvents:a,firstEventSequence:t.firstEventSequence??e.firstEventSequence,nextBeforeSequence:t.nextBeforeSequence,hasOlderEvents:t.hasOlderEvents,eventLimit:(e.eventLimit??0)+(t.eventLimit??t.pageSize??0)}}function Nme({selectedPiboSessionId:e,showRawEvents:t,setLiveTraceOverlay:n}){let r=Xt(),[i,a]=(0,L.useState)(V4),[o,s]=(0,L.useState)(80),[c,l]=(0,L.useState)(null),u=(0,L.useMemo)(()=>e?Dme(e):null,[e]),d=(0,L.useMemo)(()=>e?H4(e,{includeRawEvents:t,rawEventsLimit:o,pageSize:V4}):null,[o,e,t]),f=fn({queryKey:u??[`chat`,`trace-summary`,`idle`],queryFn:async()=>{if(!e||!u)throw Error(`Session is required`);let t=r.getQueryData(u),n=await Nc(e,t?.version);if(n.notModified&&t)return t;if(!n.summary)throw Error(`Trace summary response missing payload.`);return n.summary},enabled:!!e,staleTime:z4,gcTime:B4,refetchOnWindowFocus:!1,retry:1}),p=fn({queryKey:d??[`chat`,`trace-page`,`idle`,`compact`,o,2e3,`tail`],queryFn:async()=>{if(!e||!d)throw Error(`Session is required`);let n=r.getQueryData(d),i=await Pc(e,{includeRawEvents:t,rawEventsLimit:o,pageSize:V4,knownVersion:n?.version});if(i.notModified&&n)return n;if(!i.trace)throw Error(`Trace page response missing payload.`);return i.trace},enabled:!!e,staleTime:z4,gcTime:B4,refetchOnWindowFocus:!1,retry:1});(0,L.useEffect)(()=>{a(V4),s(80),l(null),n(null)},[e,n]),(0,L.useEffect)(()=>{let t=p.data;!t||t.piboSessionId!==e||(nZ()&&pZ(t.piboSessionId,{overlayEventCount:0,traceBaseOutputLength:R4(t),traceBaseUpdated:!0}),(0,L.startTransition)(()=>{l(t),n(e=>kme(e,t))}))},[e,n,p.data]);let m=(0,L.useCallback)(async n=>{if(!e||!n)return;let i=H4(e,{includeRawEvents:t,rawEventsLimit:o,pageSize:V4,beforeSequence:n}),s=await r.fetchQuery({queryKey:i,queryFn:async()=>{let a=r.getQueryData(i),s=await Pc(e,{includeRawEvents:t,rawEventsLimit:o,pageSize:V4,beforeSequence:n,knownVersion:a?.version});if(s.notModified&&a)return a;if(!s.trace)throw Error(`Trace page response missing payload.`);return s.trace},staleTime:z4,gcTime:B4});(0,L.startTransition)(()=>{l(e=>e?Mme(e,s):s),a(e=>e+(s.pageSize??2e3))})},[r,o,e,t]),h=(0,L.useCallback)(()=>{s(e=>e+80)},[]);return{baseTraceView:c,traceEventLimit:i,rawEventLimit:o,traceSummaryQuery:f,tracePageQuery:p,tracePageReady:!!d,loadOlderTracePage:m,loadMoreRawEvents:h}}function Pme(e){let t=e.currentEvents,n,r,i=()=>(r??=new Set(t.map(X4)),r),a=e=>{n??=t.slice(),n.push(e),t=n};for(let o of e.streamEvents){let s=Lme(o,e.piboSessionId,e.nextSequence,e.now??(()=>new Date().toISOString()));if(!s)continue;if(Fme(s)){t=Ime(t,s),n=t,r=void 0;continue}let c=X4(s),l=i();l.has(c)||(l.add(c),a(s))}return t}function Fme(e){return e.type===`assistant_message`||e.type===`thinking_finished`||e.type===`tool_execution_finished`}function Ime(e,t){return t.type===`assistant_message`?[...Y4(e,t,`assistant_delta`),t]:t.type===`thinking_finished`?[...Y4(e,t,`thinking_delta`),t]:t.type===`tool_execution_finished`?[...Y4(e,t,`tool_execution_updated`),t]:e}function Lme(e,t,n,r){if(e.type===`RAW_EVENT`&&$4(e.event)&&typeof e.event.type==`string`){let i=e.event;return J4(e,t,e.event.type,i,n,r)}if(e.type===`TEXT_MESSAGE_CONTENT`&&typeof e.delta==`string`)return J4(e,t,`assistant_delta`,{type:`assistant_delta`,piboSessionId:t,eventId:typeof e.runId==`string`?e.runId:void 0,...Q4(typeof e.messageId==`string`?e.messageId:void 0,`assistant`),text:e.delta},n,r);if(e.type===`REASONING_MESSAGE_CONTENT`&&typeof e.delta==`string`)return J4(e,t,`thinking_delta`,{type:`thinking_delta`,piboSessionId:t,eventId:typeof e.runId==`string`?e.runId:void 0,...Q4(typeof e.messageId==`string`?e.messageId:void 0,`thinking`),text:e.delta},n,r);if(e.type===`TOOL_CALL_START`&&typeof e.toolCallId==`string`&&typeof e.toolName==`string`)return J4(e,t,`tool_execution_started`,{type:`tool_execution_started`,piboSessionId:t,eventId:typeof e.runId==`string`?e.runId:void 0,toolCallId:e.toolCallId,toolName:e.toolName,args:e.args},n,r);if(e.type===`TOOL_CALL_ARGS`&&typeof e.toolCallId==`string`&&typeof e.toolName==`string`){let i=typeof e.runId==`string`?e.runId:void 0,a=e.sourceEventType===`tool_execution_updated`?`tool_execution_updated`:`tool_call`;return J4(e,t,a,a===`tool_execution_updated`?{type:`tool_execution_updated`,piboSessionId:t,eventId:i,toolCallId:e.toolCallId,toolName:e.toolName,args:e.args,partialResult:e.partialResult}:{type:`tool_call`,piboSessionId:t,eventId:i,toolCallId:e.toolCallId,toolName:e.toolName,args:e.args,argsComplete:!!e.argsComplete},n,r)}if(e.type===`TOOL_CALL_RESULT`&&typeof e.toolCallId==`string`&&typeof e.toolName==`string`)return J4(e,t,`tool_execution_finished`,{type:`tool_execution_finished`,piboSessionId:t,eventId:typeof e.runId==`string`?e.runId:void 0,toolCallId:e.toolCallId,toolName:e.toolName,result:e.result,isError:!!e.isError},n,r);if(e.type===`RUN_ERROR`&&typeof e.message==`string`)return J4(e,t,`session_error`,{type:`session_error`,piboSessionId:t,eventId:typeof e.runId==`string`?e.runId:void 0,error:e.message,errorDetails:e.errorDetails},n,r)}function J4(e,t,n,r,i,a){let o=typeof e.streamFrameId==`string`?e.streamFrameId:void 0,s=typeof e.streamFrameIndex==`number`?e.streamFrameIndex:void 0,c=typeof e.liveReplayId==`number`&&Number.isFinite(e.liveReplayId)?e.liveReplayId:void 0,l=i();return{id:typeof e.streamId==`number`?`stream:${e.streamId}:${s??`raw`}:${n}`:c===void 0?o?`stream:${o}:${n}`:`live:${l}:${n}`:`live-replay:${c}:${n}`,piboSessionId:t,eventSequence:l,streamId:typeof e.streamId==`number`?e.streamId:void 0,streamFrameIndex:s,eventId:typeof r.eventId==`string`?r.eventId:void 0,type:n,createdAt:a(),payload:r}}function Y4(e,t,n){let r=Z4(t);return e.filter(e=>e.type!==n||Z4(e)!==r)}function X4(e){return e.streamId===void 0?`${e.id}:${e.type}`:e.streamFrameIndex===void 0?`stream:${e.streamId}:${e.id}:${e.type}`:`stream:${e.streamId}:${e.streamFrameIndex}:${e.type}`}function Z4(e){let t=$4(e.payload)?e.payload:{},n=typeof t.piboSessionId==`string`?t.piboSessionId:e.piboSessionId??``,r=typeof t.eventId==`string`?t.eventId:e.eventId??``;if(typeof t.toolCallId==`string`)return`${n}:${r}:tool:${t.toolCallId}`;let i=typeof t.assistantIndex==`number`?t.assistantIndex:void 0,a=typeof t.thinkingIndex==`number`?t.thinkingIndex:void 0,o=typeof t.contentIndex==`number`?t.contentIndex:0;return`${n}:${r}:${i??a??o}`}function Q4(e,t){let n=e?.match(RegExp(`:${t}:(\\d+)$`));if(!n)return{};let r=Number(n[1]);return Number.isInteger(r)?t===`assistant`?{assistantIndex:r}:{thinkingIndex:r}:{}}function $4(e){return!!e&&typeof e==`object`&&!Array.isArray(e)}var Rme=500,zme=1e4,Bme=45e3,Vme=100;function Hme({selectedPiboSessionId:e,tracePageData:t,currentTraceView:n,liveEventSeqRef:r,selectedSessionStatus:i,tracePageReady:a,setLiveTraceOverlay:o,onRefreshTrace:s,onRefreshBootstrap:c,onError:l}){let u=(0,L.useRef)(new Map),d=(0,L.useRef)(void 0),f=(0,L.useRef)(void 0),p=(0,L.useRef)(new Map),m=(0,L.useRef)(new Map),h=(0,L.useRef)(null),g=(0,L.useRef)(void 0),_=(0,L.useRef)(0),[v,y]=(0,L.useState)(0);(0,L.useEffect)(()=>{let n=t;if(!n||n.piboSessionId!==e)return;let i=n.rawEvents.map(e=>e.eventSequence??0).reduce((e,t)=>Math.max(e,t),0);r.current=Math.max(r.current,i+1),n.latestStreamId!==void 0&&qc(m.current,n.piboSessionId,n.latestStreamId)},[r,e,t]);let b=(0,L.useCallback)(e=>{let t=u.current.get(e);t?.length&&(o(n=>{let i=Pme({currentEvents:n?.piboSessionId===e?n.events:[],streamEvents:t,piboSessionId:e,nextSequence:()=>r.current++});return sZ(e,t.length,i.length),{piboSessionId:e,events:i}}),u.current.delete(e))},[]),x=(0,L.useCallback)(()=>{if(!(d.current!==void 0||f.current!==void 0||!e)){if(document.hidden){f.current=setTimeout(()=>{f.current=void 0,b(e)},Vme);return}d.current=requestAnimationFrame(()=>{d.current=void 0,b(e)})}},[b,e]),S=(0,L.useCallback)((t,n,r=!1)=>{$c(p.current,t,n);let i=r||el(p.current,t,n),a=u.current.get(t)??[];a.push(n),u.current.set(t,a),oZ(t,n,a.length,i),i||t!==e?b(t):x()},[b,x,e]);(0,L.useEffect)(()=>()=>{d.current!==void 0&&cancelAnimationFrame(d.current),f.current!==void 0&&clearTimeout(f.current),g.current!==void 0&&clearTimeout(g.current)},[]);let C=(0,L.useCallback)((e,t)=>{Jc(m.current,e,t)},[]),w=(0,L.useCallback)((e=0)=>{if(g.current!==void 0){if(e>0)return;clearTimeout(g.current)}g.current=setTimeout(()=>{g.current=void 0,y(e=>e+1)},e)},[]),T=(0,L.useCallback)(()=>{if(!e)return;b(e),s().catch(e=>l(e3(e))),c().catch(e=>l(e3(e)));let t=h.current;(!t||t.piboSessionId!==e||t.events.readyState===2||Date.now()-t.lastActivityAt>Bme)&&w()},[b,l,c,s,w,e]);(0,L.useEffect)(()=>{if(!e||!a||!n||n.piboSessionId!==e)return;let t=new URLSearchParams({piboSessionId:e});t.set(`mode`,`live`);let r=m.current.get(e),i=r?.cursor??(n.latestStreamId===void 0?void 0:Yc(n.latestStreamId));i!==void 0&&t.set(`since`,i),r?.liveReplayId!==void 0&&t.set(`liveSince`,String(r.liveReplayId));let o=new EventSource(`/api/chat/events?${t.toString()}`),u=Date.now();h.current={piboSessionId:e,events:o,openedAt:u,lastActivityAt:u};let d=!1,f,p,v=!1,y=!1,x=(t,n=!1)=>{if(f){if(!n)return;clearTimeout(f)}uZ(e,t),f=setTimeout(()=>{f=void 0,s().catch(e=>l(e3(e)))},t)},T=()=>{if(v){y=!0;return}v=!0,c().catch(e=>l(e3(e))).finally(()=>{v=!1,y&&(y=!1,E(250,!0))})},E=(e,t=!1)=>{if(p){if(!t)return;clearTimeout(p)}p=setTimeout(()=>{p=void 0,T()},e)},D=()=>{E(900,!0)};return o.onopen=()=>{_.current=0,g.current!==void 0&&(clearTimeout(g.current),g.current=void 0),rZ(e,o.readyState);let t=h.current;t?.events===o&&(t.lastActivityAt=Date.now())},o.onerror=()=>{if(d)return;iZ(e,o.readyState);let t=h.current;t?.events===o&&(t.lastErrorAt=Date.now());let n=_.current++;w(Math.min(zme,Rme*2**n))},o.addEventListener(`pibo`,t=>{if(d)return;let n=Kc(t);if(!n)return;let r=n.piboSessionId||e,i=h.current;if(i?.events===o&&(i.lastActivityAt=Date.now()),C(r,n),aZ(r,n,t.lastEventId,o.readyState),r===e&&n.type===`ready`&&n.liveReplay?.missed&&x(0,!0),mZ(n))return;let a=n.type!==`TEXT_MESSAGE_CONTENT`&&n.type!==`REASONING_MESSAGE_CONTENT`;r===e&&Qc(n)&&S(r,n,a);let s=Xc(n);r===e&&s!==void 0?x(s,!0):r===e&&n.type!==`ready`&&n.type!==`RAW_EVENT`&&x(1500,!0),Zc(n)&&(n.type===`RUN_FINISHED`||n.type===`RUN_ERROR`||n.type===`TEXT_MESSAGE_END`?D():E(r===e?0:150))}),()=>{d=!0,f&&clearTimeout(f),p&&clearTimeout(p),b(e),h.current?.events===o&&(h.current=null),o.close()}},[n?.piboSessionId,S,b,l,c,s,C,w,v,e,a]),(0,L.useEffect)(()=>{n?.piboSessionId&&b(n.piboSessionId)},[n?.piboSessionId,b]),(0,L.useEffect)(()=>{let e=()=>T(),t=()=>{document.hidden||T()};return window.addEventListener(`focus`,e),window.addEventListener(`online`,e),window.addEventListener(`pageshow`,e),document.addEventListener(`visibilitychange`,t),()=>{window.removeEventListener(`focus`,e),window.removeEventListener(`online`,e),window.removeEventListener(`pageshow`,e),document.removeEventListener(`visibilitychange`,t)}},[T]),(0,L.useEffect)(()=>{if(!e||i!==`running`)return;let t=window.setInterval(()=>{b(e),s().catch(e=>l(e3(e)))},1e3);return()=>window.clearInterval(t)},[b,l,s,e,i])}function e3(e){return e instanceof Error?e.message:String(e)}var Ume=10;function Wme(e,t,n,r){if(!t||!n.length)return e;let i=e[t]??[],a=new Set(i.map(e=>e.path)),o=n.filter(e=>e.path&&!a.has(e.path)).map(e=>({...e,id:r()}));return o.length?{...e,[t]:[...i,...o].slice(0,Ume)}:e}function Gme(e,t,n){if(!t)return e;let r=e[t]??[],i=r.filter(e=>e.id!==n);return i.length===r.length?e:{...e,[t]:i}}function Kme(e,t){return!t||!e[t]?.length?e:{...e,[t]:[]}}function qme(e,t){let[n,r]=(0,L.useState)({});return{selectedUploadAttachments:(0,L.useMemo)(()=>e?n[e]??[]:[],[e,n]),attachUploadedFiles:(0,L.useCallback)(n=>{r(r=>Wme(r,e,n,t))},[t,e]),detachUploadAttachment:(0,L.useCallback)(t=>{r(n=>Gme(n,e,t))},[e]),clearSelectedUploadAttachments:(0,L.useCallback)(()=>{r(t=>Kme(t,e))},[e])}}function Jme({selectedPiboSessionId:e,onError:t,formatError:n}){let[r,i]=(0,L.useState)([]),[a,o]=(0,L.useState)(!1),[s,c]=(0,L.useState)(()=>e?R2(e):null),[l,u]=(0,L.useState)(()=>rpe()),[d,f]=(0,L.useState)(!1),p=!!(e&&s?.piboSessionId===e&&s.installed),m=!!e&&(a||p),h=fn({queryKey:[`web-annotations`,`app`,e],queryFn:async()=>{if(!e)throw Error(`Session is required`);return Yfe(e,{limit:100,scope:`app`})},enabled:!!e&&(m||r.length>0),staleTime:1e3,refetchOnWindowFocus:m,refetchInterval:m?5e3:!1,retry:1}),g=h.refetch,_=(0,L.useMemo)(()=>(h.data?.annotations??[]).filter(e=>e.status!==`resolved`&&e.status!==`dismissed`),[h.data?.annotations]),v=(0,L.useMemo)(()=>r.map(e=>_.find(t=>t.id===e)).filter(e=>!!e),[r,_]);(0,L.useEffect)(()=>{i(e?npe(e):[]),c(e?R2(e):null)},[e]),(0,L.useEffect)(()=>{if(!e)return;let t=t=>{!t||t.piboSessionId!==e||(c(e=>t.installed?t:e?.installed&&e.bindingId&&t.bindingId&&e.bindingId!==t.bindingId?e:t),t.installed?g():o(!1))},n=e=>t(V2(e.detail)),r=n=>{n.key===z2(e)&&t(B2(n.newValue))},i=()=>t(R2(e));return window.addEventListener(`pibo:web-annotation-overlay-state`,n),window.addEventListener(`storage`,r),window.addEventListener(`focus`,i),document.addEventListener(`visibilitychange`,i),i(),()=>{window.removeEventListener(`pibo:web-annotation-overlay-state`,n),window.removeEventListener(`storage`,r),window.removeEventListener(`focus`,i),document.removeEventListener(`visibilitychange`,i)}},[g,e]),(0,L.useEffect)(()=>{if(!h.data)return;if(!_.length){i(t=>(t.length&&e&&H2(e,[]),t.length?[]:t));return}let t=new Set(_.map(e=>e.id));i(n=>{let r=n.filter(e=>t.has(e));return r.length!==n.length&&e&&H2(e,r),r.length===n.length?n:r})},[e,_,h.data]),(0,L.useEffect)(()=>{let e=()=>{o(!0),g()};return window.addEventListener(`pibo:web-annotation-saved`,e),()=>window.removeEventListener(`pibo:web-annotation-saved`,e)},[g]);let y=(0,L.useCallback)(t=>{i(n=>{let r=t(n);return e&&H2(e,r),r})},[e]),b=(0,L.useCallback)(e=>{y(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e].slice(0,5))},[y]),x=(0,L.useCallback)(()=>y(()=>[]),[y]);return{selectedWebAnnotationIds:r,selectedWebAnnotations:v,visibleWebAnnotations:_,webAnnotationsPanelCollapsed:l,webAnnotationsPanelRendered:m,webAnnotationsPanelVisible:a,webAnnotationsQuery:h,clearingWebAnnotations:d,setWebAnnotationsPanelVisible:o,toggleWebAnnotationAttachment:b,detachWebAnnotationAttachment:(0,L.useCallback)(e=>{y(t=>t.filter(t=>t!==e))},[y]),clearSelectedWebAnnotationAttachments:x,toggleWebAnnotationsPanelCollapsed:(0,L.useCallback)(()=>{u(e=>{let t=!e;return ipe(t),t})},[]),clearVisibleWebAnnotations:(0,L.useCallback)(async()=>{if(!(!_.length||d)&&window.confirm(`Dismiss ${_.length} visible web annotations? This keeps sent messages but clears the annotation list.`)){f(!0);try{await Promise.all(_.map(e=>Xfe(e.id,{piboSessionId:e.piboSessionId,status:`dismissed`,summary:`Cleared from Chat Web UI`}))),x(),await g()}catch(e){t(n(e,`Could not clear web annotations`))}finally{f(!1)}}},[d,x,n,t,g,_])}}function t3(e){return e.session?.profile??e.agents[0]?.name??e.customAgents[0]?.profileName??``}function Yme(e){return e?.identity??{userId:`user`}}function n3(e,t){let n=Zme(e,t);return n?Xme(n):void 0}function r3(e,t){for(let n of e){if(n.piboSessionId===t)return n;let e=r3(n.children,t);if(e)return e}}function i3(e,t,n=[]){for(let r of e){let e=[...n,r];if(r.piboSessionId===t)return e;let i=i3(r.children,t,e);if(i.length)return i}return[]}function a3(){let e=globalThis.crypto?.randomUUID?.()??Math.random().toString(36).slice(2);return`web-${Date.now().toString(36)}-${e}`}function Xme(e){return`${e.provider}/${e.id}`}function Zme(e,t){if(t.activeModel)return t.activeModel;let n=e.agents.find(e=>e.name===t.profile);if(n?.model)return n.model;let r=e.customAgents.find(e=>e.profileName===t.profile),i=n??r;return t.parentId?i?.subagentModel??e.modelDefaults?.subagent:i?.mainModel??e.modelDefaults?.main}function Qme(e,t){return t?{sessionBreadcrumbs:rhe(e,t),originSession:the(e,t),derivedSessions:nhe(e,t)}:{sessionBreadcrumbs:[],originSession:void 0,derivedSessions:[]}}function $me(e){let t=e.selectedPiboSessionId?r3(e.bootstrap.sessions,e.selectedPiboSessionId):void 0,n=she(e.currentTraceView);return ohe(e.selectedSessionActiveModel,e.bootstrap.runtimeStatus?.thinkingLevel??n.level??ihe(e.bootstrap,e.selectedSessionProfile,!!t?.parentId),e.bootstrap.runtimeStatus?.fastMode??n.fast??ahe(e.bootstrap,e.selectedSessionProfile,!!t?.parentId)??!1)}function ehe(e){return{traceView:e.currentTraceView,selectedTrace:null,isLoading:e.isLoading,showThinking:e.showThinking,expandThinking:e.expandThinking,sessionAgentProfile:e.selectedSessionProfile,sessionActiveModel:e.sessionActiveModelBadge,selectedSessionStatus:e.selectedSessionStatus,selectedSessionSignal:e.selectedSessionSignal,workflowProjectSession:e.workflowProjectSession,workflowLifecycleEvents:e.workflowLifecycleEvents,sessionNodes:e.sessionNodes,sessionBreadcrumbs:e.sessionLinks.sessionBreadcrumbs,originSession:e.sessionLinks.originSession,derivedSessions:e.sessionLinks.derivedSessions,agentProfiles:e.agentProfiles,sessionProfileChangeDisabled:e.sessionProfileChangeDisabled,onSessionAgentProfileChange:e.onSessionAgentProfileChange,onFork:e.onFork,onOpenSession:e.onOpenSession,onThinkingLevelChange:e.onThinkingLevelChange,onModelChanged:async()=>{await e.onRefreshBootstrap(),await e.onRefreshTrace()},onRefreshBootstrap:e.onRefreshBootstrap,onError:e.onError}}function the(e,t){let n=r3(e,t);if(!n?.originId)return;let r=r3(e,n.originId);return{piboSessionId:n.originId,label:r?s3(r,0):n.originId}}function nhe(e,t){return r3(e,t)?.derivedSessions.map(e=>({piboSessionId:e.piboSessionId,label:lhe(e),profile:e.profile,status:e.status}))??[]}function rhe(e,t){return i3(e,t).map((e,t)=>({piboSessionId:e.piboSessionId,label:s3(e,t)}))}function ihe(e,t,n=!1){let r=e.agents.find(e=>e.name===t),i=e.customAgents.find(e=>e.profileName===t),a=r??i;return n?a?.subagentThinkingLevel??a?.thinkingLevel??e.modelDefaults?.subagentThinking??e.modelDefaults?.thinking:a?.mainThinkingLevel??a?.thinkingLevel??e.modelDefaults?.mainThinking??e.modelDefaults?.thinking}function ahe(e,t,n=!1){let r=e.agents.find(e=>e.name===t),i=e.customAgents.find(e=>e.profileName===t),a=r??i;return n?a?.subagentFast??a?.fast??e.modelDefaults?.subagentFast??e.modelDefaults?.fast:a?.mainFast??a?.fast??e.modelDefaults?.mainFast??e.modelDefaults?.fast}function ohe(e,t,n){if(e)return[e,t,n?`fast`:void 0].filter(Boolean).join(` `)}function she(e){let t={};if(!e)return t;for(let n of o3(e.nodes)){if(n.type!==`execution.command`||n.title!==`thinking`&&n.title!==`fast_mode`)continue;let e=n.output&&typeof n.output==`object`?n.output:void 0;t={level:(typeof e?.level==`string`&&che(e.level)?e.level:void 0)??t.level,fast:n.title===`fast_mode`?e?.mode===`fast`:t.fast}}return t}function o3(e){return e.flatMap(e=>[e,...o3(e.children)])}function che(e){return _0.includes(e)}function s3(e,t){return t?e.subagentName&&e.subagentName!==e.profile?`${e.subagentName} (${e.profile})`:e.profile||e.subagentName||e.title:e.profile||e.title}function lhe(e){return e.subagentName&&e.subagentName!==e.profile?`${e.subagentName} (${e.profile})`:e.title||e.profile||e.subagentName||`Untitled Session`}function uhe({piboSessionId:e,text:t,selectedWebAnnotations:n,selectedUploadAttachments:r,eventSequence:i,now:a,clientTxnId:o}){let s=n.map(e=>e.id),c=r.map(e=>e.path);return{text:t,webAnnotationIds:s,fileAttachmentPaths:c,clientTxnId:o,optimisticEvent:{id:o,piboSessionId:e,eventSequence:i,eventId:o,type:`message_queued`,createdAt:a,payload:{type:`message_queued`,piboSessionId:e,eventId:o,clientTxnId:o,queuedMessages:1,text:t,...c.length?{fileAttachmentPaths:c}:{},source:`user`}}}}function dhe(e,t,n){return{piboSessionId:t,events:[...e?.piboSessionId===t?e.events:[],n]}}function c3(e){return e instanceof Error?e.message:String(e)}function l3({bootstrap:e,selectedPiboSessionId:t,selectedRoomId:n,selectedRoomArchived:r,selectedSessionProfile:i,selectedSessionActiveModel:a,selectedSessionStatus:o,selectedSessionSignal:s,workflowProjectSession:c,workflowLifecycleEvents:l,projectSessionCreatePanel:u,workflowStartPanel:d,projectModulePanel:f,extraViewTabs:p,activeViewId:m,sessionViewId:h,sessionViews:g,currentSessionView:_,allowedSessionViewIds:v,creatingSession:y,showRawEvents:b,showThinking:x,expandThinking:S,commands:C,skills:w,composerText:T,composerFocusSignal:E,onComposerTextChange:D,onToggleRawEvents:O,onToggleThinking:k,onToggleExpandThinking:A,onSessionAgentProfileChange:j,onFork:M,onOpenSession:N,onSelectSessionView:P,onCommand:ee,onThinkingLevelChange:te,onRefreshTrace:ne,onRefreshBootstrap:F,onSend:re,onError:I}){let ie=(0,L.useRef)(0),[ae,oe]=(0,L.useState)(null),{baseTraceView:se,traceEventLimit:ce,rawEventLimit:le,traceSummaryQuery:ue,tracePageQuery:de,tracePageReady:fe,loadOlderTracePage:pe,loadMoreRawEvents:me}=Nme({selectedPiboSessionId:t,showRawEvents:b,setLiveTraceOverlay:oe}),{selectedWebAnnotationIds:he,selectedWebAnnotations:ge,visibleWebAnnotations:_e,webAnnotationsPanelCollapsed:ve,webAnnotationsPanelRendered:ye,webAnnotationsPanelVisible:be,webAnnotationsQuery:xe,clearingWebAnnotations:Se,setWebAnnotationsPanelVisible:Ce,toggleWebAnnotationAttachment:we,detachWebAnnotationAttachment:Te,clearSelectedWebAnnotationAttachments:Ee,toggleWebAnnotationsPanelCollapsed:De,clearVisibleWebAnnotations:Oe}=Jme({selectedPiboSessionId:t,onError:I,formatError:W2}),{selectedUploadAttachments:ke,attachUploadedFiles:Ae,detachUploadAttachment:je,clearSelectedUploadAttachments:Me}=qme(t,(0,L.useCallback)(()=>`upload-${a3()}`,[])),Ne=wme({selectedPiboSessionId:t,baseTraceView:se,liveTraceOverlay:ae,selectedSessionStatus:o});Hme({selectedPiboSessionId:t,tracePageData:de.data,currentTraceView:Ne,liveEventSeqRef:ie,selectedSessionStatus:o,tracePageReady:fe,setLiveTraceOverlay:oe,onRefreshTrace:ne,onRefreshBootstrap:F,onError:I});let Pe=$me({bootstrap:e,selectedPiboSessionId:t,selectedSessionProfile:i,selectedSessionActiveModel:a,currentTraceView:Ne}),Fe=(0,L.useMemo)(()=>Qme(e.sessions,t),[e.sessions,t]),Ie=!!t&&de.isFetching&&!Ne,Le=de.error?c3(de.error):ue.error?c3(ue.error):null,Re=Ne?.piboSessionId??t??``,ze=c&&fpe(c)?ppe(c,o):null,Be=e=>{for(let n of[750,2e3,5e3,1e4])window.setTimeout(()=>{t===e&&de.refetch().catch(e=>I(c3(e)))},n)},Ve=async e=>{if(!t)return;let n=uhe({piboSessionId:t,text:e,selectedWebAnnotations:ge,selectedUploadAttachments:ke,eventSequence:ie.current++,now:new Date().toISOString(),clientTxnId:a3()});oe(e=>dhe(e,t,n.optimisticEvent)),await re(n.text,n.webAnnotationIds,n.fileAttachmentPaths,n.clientTxnId),Ee(),Me(),await Promise.all([de.refetch(),xe.refetch()]),Be(t)},He=ehe({currentTraceView:Ne,isLoading:Ie,showThinking:x,expandThinking:S,selectedSessionProfile:i,sessionActiveModelBadge:Pe,selectedSessionStatus:o,selectedSessionSignal:s,workflowProjectSession:c,workflowLifecycleEvents:l,sessionNodes:e.sessions,sessionLinks:Fe,agentProfiles:e.agents,sessionProfileChangeDisabled:y||r,onSessionAgentProfileChange:j,onFork:M,onOpenSession:N,onThinkingLevelChange:te,onRefreshTrace:ne,onRefreshBootstrap:F,onError:I});return(0,R.jsx)(Cpe,{selectedPiboSessionId:t,selectedRoomId:n,fallbackRoomId:e.selectedRoomId??void 0,sessionViewId:h,loadingTrace:Ie,traceError:Le,showRawEvents:b,currentTraceView:Ne,traceEventLimit:ce,rawEventLimit:le,tracePageFetching:de.isFetching,onLoadOlderTracePage:e=>void pe(e),onLoadMoreRawEvents:me,headerProps:{title:Ne?.title??t??e.room?.name??n,roomLabel:e.room?.name??n??`Room`,headerPiboSessionId:Re,piboSessionId:t,piboRoomId:n??e.selectedRoomId??void 0,webAnnotationsDisabled:!t||r,webAnnotationsPanelRendered:ye,workflowHeader:ze,sessionViewId:h,sessionViews:g,currentSessionView:_,allowedSessionViewIds:v,extraViewTabs:p,activeViewId:m,showRawEvents:b,showThinking:x,expandThinking:S,onShowWebAnnotationsPanel:()=>Ce(!0),onHideWebAnnotationsPanel:()=>Ce(!1),onSelectSessionView:P,onToggleRawEvents:O,onToggleThinking:k,onToggleExpandThinking:A,onError:I},projectSessionCreatePanel:u,workflowStartPanel:d,projectModulePanel:f,currentSessionView:_,sessionViewProps:He,webAnnotationsPanelRendered:ye,webAnnotationsPanelProps:{piboSessionId:t,annotations:_e,selectedIds:he,loading:xe.isLoading||xe.isFetching||Se,error:xe.error?c3(xe.error):null,collapsed:ve,onRefresh:()=>void xe.refetch(),onToggle:we,onClear:()=>void Oe(),onCollapse:De,onClose:()=>Ce(!1)},composerProps:{sessionId:t,disabled:!t||r,commands:C,skills:w,value:T,focusSignal:E,selectedWebAnnotations:ge,selectedUploadAttachments:ke,onValueChange:D,onCommand:ee,onDetachWebAnnotation:Te,onClearWebAnnotations:Ee,onAttachUploadedFiles:Ae,onDetachUploadAttachment:je,onClearUploadAttachments:Me,onSend:Ve}})}var u3=3e3;function fhe(e){return`${e.name||`Untitled Room`}\n${e.id}`}function phe(e){return`${d3(e)}\n${e.piboSessionId}`}function d3(e){return typeof e.title==`string`&&e.title?e.title:`Untitled Session`}function mhe(e,t){let n=`session-signal h-2 w-2 rounded-full`;return e.status===`error`?{className:`${n} session-signal-error`,title:(e.unreadCount??0)>0?`Run failed`:`Run failed (read)`}:e.status===`running`?{className:`${n} session-signal-running`,title:`Runtime is working`}:(e.unreadCount??0)>0||hhe(e,t)?{className:`${n} session-signal-unread`,title:`New completed assistant message`}:{className:`${n} session-signal-idle`,title:`Idle`}}function hhe(e,t){if(!e.lastActivityAt)return!1;let n=Date.parse(e.lastActivityAt);return Number.isFinite(n)&&t-n<u3}function ghe(e,t){let n,r=e=>{if(e.status!==`running`&&e.status!==`error`&&(e.unreadCount??0)===0&&e.lastActivityAt){let r=Date.parse(e.lastActivityAt);if(Number.isFinite(r)){let e=u3-(t-r);e>0&&(n=n===void 0?e:Math.min(n,e))}}for(let t of e.children)r(t)};for(let t of e)r(t);return n===void 0?void 0:n+50}function f3(e,t){return e.some(e=>e.piboSessionId===t||f3(e.children,t))}function p3(e,t=!0){let n=[],r=[];for(let i of e){if(i.archived){t&&r.push(i);continue}let e=p3(i.children,t);n.push({...i,children:e.active}),t&&r.push(...e.archived)}return{active:n,archived:r}}function _he(e,t,n){if(e.length<=t)return e;let r=e.slice(0,t);if(!n)return r;let i=e.find(e=>e.piboSessionId===n||f3(e.children,n));return!i||r.some(e=>e.piboSessionId===i.piboSessionId)?r:[...r,i]}function m3(e){for(let t of e){if(_3(t))return t;let e=m3(t.children??[]);if(e)return e}}function h3(e,t){for(let n of e){if(n.id===t)return n;let e=h3(n.children??[],t);if(e)return e}}function vhe(e){return e.reduce((e,t)=>e+(t.unreadCount??0),0)}function g3(e){let t=[],n=[];for(let r of e){if(_3(r)){let e=g3(r.children??[]);t.push(...e.active),n.push(...e.archived);continue}if(v3(r)){n.push(r);continue}let e=g3(r.children??[]);t.push({...r,children:e.active}),n.push(...e.archived)}return{active:t,archived:n}}function _3(e){return e.metadata.default===!0}function v3(e){return typeof e.metadata.chatRoomArchivedAt==`string`}function yhe(e){return e.topic&&e.workspace?`${e.topic} | ${e.workspace}`:e.topic?e.topic:e.workspace?e.workspace:e.type}function y3({node:e,signalNow:t,selectedPiboSessionId:n,selectedSessionPathIds:r,onSelect:i,onRename:a,onArchive:o,onDelete:s,onViewContext:c,depth:l=0,loadingPiboSessionId:u,autoRename:d=!1,onAutoRenameConsumed:f,showWorkflowSessionKindMarkers:p=!1}){let m=d3(e),h=phe(e),[g,_]=(0,L.useState)(!1),[v,y]=(0,L.useState)(m),b=(0,L.useRef)(null),x=e.children.length>0,S=n!==null&&e.piboSessionId!==n&&r.has(e.piboSessionId),[C,w]=(0,L.useState)(S),[T,E]=(0,L.useState)(!1),D=(0,L.useRef)(null);(0,L.useEffect)(()=>{if(!T)return;let e=e=>{D.current&&!D.current.contains(e.target)&&E(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[T]),(0,L.useEffect)(()=>{g||y(m)},[g,m]),(0,L.useEffect)(()=>{d&&(y(m===`Untitled Session`?``:m),_(!0),f?.())},[d,m,f]),(0,L.useLayoutEffect)(()=>{g&&(b.current?.focus(),b.current?.select())},[g]),(0,L.useEffect)(()=>{S&&w(!0)},[S]);let O=()=>{let t=v.trim();a(e.piboSessionId,t||null),_(!1)},k=mhe(e,t),A=u===e.piboSessionId,j=p?bhe(e.workflowSessionKind):null,M=j?.Icon;return(0,R.jsxs)(`div`,{children:[(0,R.jsxs)(`div`,{"data-pibo-component":`SessionNode`,"data-pibo-debug":`session-row`,"data-pibo-session-id":e.piboSessionId,"data-pibo-title":m,"data-pibo-selected":e.piboSessionId===n?`true`:`false`,"data-pibo-state":A?`loading`:e.status??`idle`,"data-pibo-archived":e.archived?`true`:`false`,"data-pibo-unread-count":e.unreadCount??0,className:`group w-full grid grid-cols-[1fr_auto] gap-1 items-center mb-1 border rounded-sm ${e.piboSessionId===n?`border-[#11a4d4] bg-[#11a4d4]/10`:`border-transparent`}`,style:{paddingLeft:8+l*14},title:h,children:[g?(0,R.jsxs)(`form`,{className:`min-w-0 grid grid-cols-[1fr_auto_auto] gap-1 py-1 pr-1`,onSubmit:e=>{e.preventDefault(),O()},children:[(0,R.jsx)(`input`,{ref:b,value:v,onChange:e=>y(e.target.value),onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),_(!1),y(m))},autoFocus:!0,className:`min-w-0 bg-[#0e1116] border border-slate-700 rounded-sm px-2 py-1 text-sm outline-none focus:border-[#11a4d4]`}),(0,R.jsx)(`button`,{type:`submit`,title:`Save Session Title`,"aria-label":`Save Session Title`,className:`h-7 w-7 inline-flex items-center justify-center border border-slate-700 rounded-sm text-slate-400 hover:border-[#11a4d4] hover:text-[#11a4d4]`,children:(0,R.jsx)(zo,{size:13})}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>{_(!1),y(m)},title:`Cancel Rename`,"aria-label":`Cancel Rename`,className:`h-7 w-7 inline-flex items-center justify-center border border-slate-700 rounded-sm text-slate-400 hover:border-[#11a4d4] hover:text-[#11a4d4]`,children:(0,R.jsx)(Ys,{size:13})})]}):(0,R.jsxs)(`div`,{className:`min-w-0 grid grid-cols-[1fr_auto] gap-2 items-center py-1 pr-1`,children:[(0,R.jsx)(`button`,{type:`button`,onClick:()=>{if(x&&e.piboSessionId===n){w(e=>!e);return}i(e.piboSessionId)},"aria-label":j?`${j.ariaLabel}: ${m}`:`Open session ${m}`,className:`min-w-0 text-left px-1 py-1 grid grid-cols-[minmax(0,1fr)_auto] gap-2 items-center`,children:(0,R.jsxs)(`span`,{className:`min-w-0`,children:[(0,R.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[j&&M?(0,R.jsx)(`span`,{className:`h-4 w-4 shrink-0 inline-flex items-center justify-center rounded-sm border ${j.className}`,title:j.ariaLabel,"aria-label":j.ariaLabel,children:(0,R.jsx)(M,{size:11,"aria-hidden":`true`})}):null,(0,R.jsx)(`span`,{className:`block min-w-0 truncate text-sm ${e.archived?`text-slate-500`:`text-slate-200`}`,children:m})]}),(0,R.jsxs)(`span`,{className:`mt-0.5 flex min-w-0 items-center gap-1.5`,children:[j?(0,R.jsx)(`span`,{className:`shrink-0 rounded-sm border px-1 py-0.5 text-[9px] font-bold uppercase tracking-wide ${j.className}`,title:j.ariaLabel,children:j.label}):null,(0,R.jsx)(`span`,{className:`min-w-0 truncate font-mono text-[10px] text-slate-500`,children:e.piboSessionId})]})]})}),(0,R.jsxs)(`span`,{className:`grid grid-rows-[16px_16px] place-items-center gap-0.5`,children:[A?(0,R.jsx)(Ss,{size:13,className:`text-[#11a4d4] animate-spin`,"aria-label":`Loading session`}):(0,R.jsx)(`span`,{className:k.className,title:k.title,"aria-label":k.title}),x?(0,R.jsx)(`button`,{type:`button`,onClick:()=>w(e=>!e),"aria-expanded":C,title:C?`Collapse Subsessions`:`Expand Subsessions`,"aria-label":C?`Collapse Subsessions`:`Expand Subsessions`,className:`h-4 w-4 inline-flex items-center justify-center rounded-sm transition-colors ${C?`text-[#0bda57]`:`text-slate-600 hover:text-[#11a4d4]`}`,children:(0,R.jsx)(vs,{size:13})}):(0,R.jsx)(`span`,{className:`h-4 w-4`})]})]}),g?null:(0,R.jsx)(`div`,{className:`flex items-center gap-1 pr-1 opacity-0 group-hover:opacity-100 group-focus-within:opacity-100 transition-opacity max-[980px]:opacity-100`,children:(0,R.jsxs)(`div`,{className:`relative`,ref:D,children:[(0,R.jsx)(`button`,{type:`button`,onClick:()=>E(e=>!e),title:`Session actions`,"aria-label":`Session actions`,className:`h-7 w-7 max-[980px]:h-9 max-[980px]:w-9 inline-flex items-center justify-center border border-slate-700 rounded-sm text-slate-400 hover:border-[#11a4d4] hover:text-[#11a4d4]`,children:(0,R.jsx)(ns,{size:24,className:`w-3.5 h-3.5 max-[980px]:w-5 max-[980px]:h-5`})}),T&&(0,R.jsx)(`div`,{className:`absolute right-0 top-full z-50 mt-1 w-48 bg-[#1a262b] border border-slate-700 rounded-sm shadow-lg py-1`,children:e.archived?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`button`,{type:`button`,onClick:()=>{E(!1),o(e.piboSessionId,!1)},className:`w-full text-left px-3 py-2.5 text-sm text-slate-300 hover:bg-[#11a4d4]/10 hover:text-[#11a4d4] flex items-center gap-2`,children:[(0,R.jsx)(To,{size:16}),` Restore Session`]}),(0,R.jsxs)(`button`,{type:`button`,onClick:()=>{E(!1),c(e.piboSessionId)},className:`w-full text-left px-3 py-2.5 text-sm text-slate-300 hover:bg-[#11a4d4]/10 hover:text-[#11a4d4] flex items-center gap-2`,children:[(0,R.jsx)(Io,{size:16}),` View Context`]}),(0,R.jsxs)(`button`,{type:`button`,onClick:()=>{E(!1),s(e)},className:`w-full text-left px-3 py-2.5 text-sm text-red-300 hover:bg-red-500/10 flex items-center gap-2`,children:[(0,R.jsx)(Ws,{size:16}),` Delete Session`]})]}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`button`,{type:`button`,onClick:()=>{E(!1),_(!0)},className:`w-full text-left px-3 py-2.5 text-sm text-slate-300 hover:bg-[#11a4d4]/10 hover:text-[#11a4d4] flex items-center gap-2`,children:[(0,R.jsx)(ks,{size:16}),` Rename Session`]}),(0,R.jsxs)(`button`,{type:`button`,onClick:()=>{E(!1),o(e.piboSessionId,!0)},className:`w-full text-left px-3 py-2.5 text-sm text-slate-300 hover:bg-[#11a4d4]/10 hover:text-[#11a4d4] flex items-center gap-2`,children:[(0,R.jsx)(Eo,{size:16}),` Archive Session`]}),(0,R.jsxs)(`button`,{type:`button`,onClick:()=>{E(!1),c(e.piboSessionId)},className:`w-full text-left px-3 py-2.5 text-sm text-slate-300 hover:bg-[#11a4d4]/10 hover:text-[#11a4d4] flex items-center gap-2`,children:[(0,R.jsx)(Io,{size:16}),` View Context`]})]})})]})})]}),C?e.children.map(e=>(0,R.jsx)(y3,{node:e,signalNow:t,selectedPiboSessionId:n,selectedSessionPathIds:r,onSelect:i,onRename:a,onArchive:o,onDelete:s,onViewContext:c,depth:l+1,loadingPiboSessionId:u,showWorkflowSessionKindMarkers:p},e.piboSessionId)):null]})}function bhe(e){switch(e){case`main_workflow`:return{label:`main workflow`,ariaLabel:`Main workflow session`,className:`border-[#11a4d4]/40 bg-[#11a4d4]/10 text-[#11a4d4]`,Icon:vs};case`nested_workflow`:return{label:`nested workflow`,ariaLabel:`Nested workflow session`,className:`border-violet-400/40 bg-violet-500/10 text-violet-300`,Icon:$o};case`agent_node`:return{label:`agent node`,ariaLabel:`Workflow agent node session`,className:`border-emerald-400/40 bg-emerald-500/10 text-emerald-300`,Icon:Ks};case`subagent`:return{label:`subagent`,ariaLabel:`Subagent session`,className:`border-amber-400/40 bg-amber-500/10 text-amber-300`,Icon:qs};default:return null}}var xhe=`240px 0px`,b3=192,x3=4,S3=8;function She(e){return e>99?`99+`:String(e)}function Che({count:e}){return!e||e<=0?null:(0,R.jsx)(`span`,{className:`min-w-5 h-5 px-1.5 inline-flex items-center justify-center rounded-full bg-[#38bdf8] text-[#0e1116] text-[10px] font-bold tabular-nums leading-none`,"aria-label":`${e} unread messages`,title:`${e} unread messages`,children:She(e)})}function whe({bootstrap:e,selectedRoomId:t,selectedPiboSessionId:n,showArchivedRooms:r,onToggleArchivedRooms:i,creatingRoom:a,onCreateRoom:o,onSelectRoom:s,onUpdateRoom:c,onArchiveRoom:l,onReadAllRoom:u,onDeleteRoom:d,newSessionProfile:f,onNewSessionProfileChange:p,selectedRoomArchived:m,creatingSession:h,onCreateSession:g,showArchived:_,onToggleArchivedSessions:v,loadingArchivedSessions:y,visibleActiveSessions:b,visibleArchivedSessions:x,totalActiveSessionCount:S,totalArchivedSessionCount:C,hasMoreActiveSessions:w,hasMoreArchivedSessions:T,loadingActiveSessions:E,sessionListScrollRef:D,onLoadMoreSessions:O,signalNow:k,selectedSessionPathIds:A,onSelectSession:j,onRenameSession:M,onArchiveSession:N,onDeleteSession:P,onViewContext:ee,loadingPiboSessionId:te,autoRenameSessionId:ne,onAutoRenameConsumed:F}){let re=!!(e.selectedRoomId||e.room||e.rooms.length),I=e.agents,ie=m3(e.rooms),ae=g3(e.rooms);return(0,R.jsxs)(`div`,{"data-pibo-debug":`session-list`,"data-pibo-room-id":t??e.selectedRoomId??void 0,"data-pibo-selected-session-id":n??void 0,"data-pibo-state":_?`archived-visible`:`active-only`,className:`min-h-0 flex-1 overflow-hidden p-2 flex flex-col gap-3`,children:[re?(0,R.jsxs)(R.Fragment,{children:[ie?(0,R.jsxs)(`div`,{className:`shrink-0`,children:[(0,R.jsx)(`div`,{className:`px-1 pb-1 text-[10px] font-bold uppercase tracking-wider text-slate-500`,children:`Shared Chat`}),(0,R.jsx)(w3,{room:ie,selectedRoomId:t,onSelect:e=>void s(e),onUpdate:(e,t)=>void c(e,t),onArchive:(e,t)=>void l(e,t),onReadAll:e=>void u(e),onDelete:d})]}):null,(0,R.jsxs)(`div`,{className:`min-h-0 flex-1 basis-0 overflow-hidden flex flex-col`,children:[(0,R.jsxs)(`div`,{className:`shrink-0 flex items-center justify-between gap-2 px-1 pb-1`,children:[(0,R.jsx)(`div`,{className:`text-[10px] font-bold uppercase tracking-wider text-slate-500`,children:`Rooms`}),(0,R.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,R.jsx)(`button`,{type:`button`,onClick:()=>void o(),disabled:a,title:`New Room`,"aria-label":`New Room`,className:`h-6 w-6 max-[980px]:h-8 max-[980px]:w-8 inline-flex items-center justify-center border border-slate-700 rounded-sm text-slate-400 hover:border-[#11a4d4] hover:text-[#11a4d4] disabled:opacity-50`,children:(0,R.jsx)(js,{size:14})}),(0,R.jsx)(`button`,{type:`button`,onClick:i,title:r?`Hide Archived Rooms`:`Show Archived Rooms`,"aria-label":r?`Hide Archived Rooms`:`Show Archived Rooms`,className:`h-6 w-6 max-[980px]:h-8 max-[980px]:w-8 inline-flex items-center justify-center border rounded-sm hover:border-[#11a4d4] hover:text-[#11a4d4] ${r?`border-[#11a4d4] text-[#11a4d4]`:`border-slate-700 text-slate-400`}`,children:r?(0,R.jsx)(To,{size:14}):(0,R.jsx)(Eo,{size:14})})]})]}),(0,R.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto pr-1`,children:[ae.active.map(e=>(0,R.jsx)(w3,{room:e,selectedRoomId:t,onSelect:e=>void s(e),onUpdate:(e,t)=>void c(e,t),onArchive:(e,t)=>void l(e,t),onReadAll:e=>void u(e),onDelete:d},e.id)),ae.active.length===0?(0,R.jsx)(`div`,{className:`px-2 py-3 text-xs text-slate-500 border border-dashed border-slate-700 rounded-sm`,children:`No rooms`}):null,r?(0,R.jsxs)(`div`,{className:`mt-3`,children:[(0,R.jsx)(`div`,{className:`px-1 pb-1 text-[10px] font-bold uppercase tracking-wider text-slate-500`,children:`Archived Rooms`}),ae.archived.length?(0,R.jsx)(The,{rooms:ae.archived,selectedRoomId:t,onSelect:e=>void s(e),onUpdate:(e,t)=>void c(e,t),onArchive:(e,t)=>void l(e,t),onReadAll:e=>void u(e),onDelete:d}):(0,R.jsx)(`div`,{className:`px-2 py-3 text-xs text-slate-500 border border-dashed border-slate-700 rounded-sm`,children:`No archived rooms`})]}):null]})]})]}):null,(0,R.jsxs)(`div`,{className:`min-h-0 flex-1 basis-0 overflow-hidden flex flex-col border-t border-slate-700/80 pt-3`,children:[(0,R.jsxs)(`div`,{className:`shrink-0 flex items-center justify-between gap-2 px-1 pb-1`,children:[(0,R.jsx)(`div`,{className:`text-[10px] font-bold uppercase tracking-wider text-slate-500`,children:`Sessions`}),(0,R.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,R.jsx)(`select`,{value:f,onChange:e=>p(e.target.value),disabled:!I.length||m,title:`Agent for new sessions`,"aria-label":`Agent for new sessions`,className:`h-6 w-28 max-[980px]:h-8 max-[980px]:w-32 max-[980px]:text-sm rounded-sm border border-slate-700 bg-[#101d22] px-1.5 text-[11px] font-medium normal-case tracking-normal text-slate-300 outline-none hover:border-[#11a4d4] focus:border-[#11a4d4] disabled:opacity-50`,children:I.map(e=>(0,R.jsx)(`option`,{value:e.name,title:e.description??e.name,children:e.name},e.name))}),(0,R.jsx)(`button`,{"data-pibo-debug":`new-session-button`,"data-pibo-room-id":t??e.selectedRoomId??void 0,"data-pibo-state":h?`creating`:m?`archived-disabled`:`ready`,type:`button`,onClick:()=>void g(),disabled:h||m,title:`New Session`,"aria-label":`New Session`,className:`h-6 w-6 max-[980px]:h-8 max-[980px]:w-8 inline-flex items-center justify-center border border-slate-700 rounded-sm text-slate-400 hover:border-[#11a4d4] hover:text-[#11a4d4] disabled:opacity-50`,children:(0,R.jsx)(js,{size:14})}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>void v(),disabled:y,title:_?`Hide Archived Sessions`:`Show Archived Sessions`,"aria-label":_?`Hide Archived Sessions`:`Show Archived Sessions`,className:`h-6 w-6 max-[980px]:h-8 max-[980px]:w-8 inline-flex items-center justify-center border rounded-sm hover:border-[#11a4d4] hover:text-[#11a4d4] disabled:opacity-70 ${_?`border-[#11a4d4] text-[#11a4d4]`:`border-slate-700 text-slate-400`}`,children:y?(0,R.jsx)(Ss,{size:14,className:`animate-spin`}):_?(0,R.jsx)(To,{size:14}):(0,R.jsx)(Eo,{size:14})})]})]}),(0,R.jsxs)(`div`,{ref:D,className:`min-h-0 flex-1 overflow-y-auto pr-1`,children:[b.map(e=>(0,R.jsx)(y3,{node:e,signalNow:k,selectedPiboSessionId:n,selectedSessionPathIds:A,onSelect:e=>void j(e),onRename:(e,t)=>void M(e,t),onArchive:(e,t)=>void N(e,t),onDelete:P,onViewContext:ee,loadingPiboSessionId:te,autoRename:ne===e.piboSessionId,onAutoRenameConsumed:()=>F()},e.piboSessionId)),S===0?(0,R.jsx)(`div`,{className:`px-2 py-3 text-xs text-slate-500 border border-dashed border-slate-700 rounded-sm`,children:`No active sessions`}):null,w?(0,R.jsx)(C3,{debugName:`active-session-load-more`,loading:E,rootRef:D,onLoadMore:()=>O(!1),children:E?`Loading active sessions…`:`Load more active sessions (${b.length} of ${S})`}):null,_?(0,R.jsxs)(`div`,{className:`mt-3`,children:[(0,R.jsxs)(`div`,{className:`px-1 pb-1 text-[10px] font-bold uppercase tracking-wider text-slate-500 flex items-center gap-1.5`,children:[(0,R.jsx)(`span`,{children:`Archived Sessions`}),y?(0,R.jsx)(Ss,{size:12,className:`text-[#11a4d4] animate-spin`,"aria-label":`Loading archived sessions`}):null]}),y?(0,R.jsxs)(`div`,{className:`px-2 py-3 text-xs text-slate-500 border border-dashed border-slate-700 rounded-sm flex items-center gap-2`,children:[(0,R.jsx)(Ss,{size:13,className:`text-[#11a4d4] animate-spin`}),` Loading archived sessions`]}):C?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(Ehe,{sessions:x,signalNow:k,selectedPiboSessionId:n,selectedSessionPathIds:A,onSelect:e=>void j(e),onRename:(e,t)=>void M(e,t),onArchive:(e,t)=>void N(e,t),onDelete:P,onViewContext:ee,loadingPiboSessionId:te,autoRenameSessionId:ne,onAutoRenameConsumed:()=>F()}),T?(0,R.jsx)(C3,{debugName:`archived-session-load-more`,loading:y,rootRef:D,onLoadMore:()=>O(!0),children:y?`Loading archived sessions…`:`Load more archived sessions (${x.length} of ${C})`}):null]}):(0,R.jsx)(`div`,{className:`px-2 py-3 text-xs text-slate-500 border border-dashed border-slate-700 rounded-sm`,children:`No archived sessions`})]}):null]})]})]})}function The({rooms:e,selectedRoomId:t,onSelect:n,onUpdate:r,onArchive:i,onReadAll:a,onDelete:o}){return(0,R.jsx)(`div`,{children:e.map(e=>(0,R.jsx)(w3,{room:e,selectedRoomId:t,onSelect:n,onUpdate:r,onArchive:i,onReadAll:a,onDelete:o},e.id))})}function C3({children:e,debugName:t,loading:n,rootRef:r,onLoadMore:i}){let a=(0,L.useRef)(null),o=(0,L.useRef)(i),s=(0,L.useRef)(!1);(0,L.useEffect)(()=>{o.current=i},[i]),(0,L.useEffect)(()=>{n||(s.current=!1)},[n]);let c=(0,L.useCallback)(()=>{s.current||n||(s.current=!0,Promise.resolve(o.current()).finally(()=>{s.current=!1}))},[n]);return(0,L.useEffect)(()=>{if(n||typeof IntersectionObserver>`u`)return;let e=a.current;if(!e)return;let t=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&c()},{root:r.current,rootMargin:xhe,threshold:0});return t.observe(e),()=>t.disconnect()},[n,r,c]),(0,R.jsx)(`button`,{ref:a,"data-pibo-debug":t,type:`button`,onClick:c,disabled:n,className:`mt-2 w-full px-2 py-2 text-[11px] text-slate-400 border border-dashed border-slate-700 rounded-sm hover:border-[#11a4d4] hover:text-[#11a4d4] disabled:opacity-60`,children:e})}function Ehe({sessions:e,signalNow:t,selectedPiboSessionId:n,selectedSessionPathIds:r,onSelect:i,onRename:a,onArchive:o,onDelete:s,onViewContext:c,loadingPiboSessionId:l,autoRenameSessionId:u,onAutoRenameConsumed:d}){return(0,R.jsx)(`div`,{children:e.map(e=>(0,R.jsx)(y3,{node:e,signalNow:t,selectedPiboSessionId:n,selectedSessionPathIds:r,onSelect:i,onRename:a,onArchive:o,onDelete:s,onViewContext:c,loadingPiboSessionId:l,autoRename:u===e.piboSessionId,onAutoRenameConsumed:d},e.piboSessionId))})}function w3({room:e,selectedRoomId:t,onSelect:n,onUpdate:r,onArchive:i,onReadAll:a,onDelete:o,depth:s=0}){let[c,l]=(0,L.useState)(!1),[u,d]=(0,L.useState)(e.name),[f,p]=(0,L.useState)(e.topic??``),[m,h]=(0,L.useState)(e.workspace??``),g=_3(e),_=v3(e),[v,y]=(0,L.useState)(!1),[b,x]=(0,L.useState)(null),S=(0,L.useRef)(null),C=(0,L.useRef)(null),w=fhe(e),T=()=>{x2(e.id).catch(()=>void 0)},E=(0,L.useCallback)(()=>{let e=S.current;if(!e)return;let t=e.getBoundingClientRect(),n=C.current?.offsetWidth??b3,r=_?144:192,i=C.current?.offsetHeight??r,a=Math.max(S3,window.innerWidth-n-S3),o=Math.min(Math.max(S3,t.right-n),a),s=t.bottom+x3,c=s+i<=window.innerHeight-S3?s:Math.max(S3,t.top-x3-i);x(e=>e?.top===c&&e.left===o?e:{top:c,left:o})},[_]);(0,L.useEffect)(()=>{if(!v){x(null);return}E();let e=()=>E();return window.addEventListener(`resize`,e),window.addEventListener(`scroll`,e,!0),()=>{window.removeEventListener(`resize`,e),window.removeEventListener(`scroll`,e,!0)}},[v,E]),(0,L.useLayoutEffect)(()=>{v&&b&&E()},[v,b,E]),(0,L.useEffect)(()=>{if(!v)return;let e=e=>{let t=e.target;S.current?.contains(t)||C.current?.contains(t)||y(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[v]),(0,L.useEffect)(()=>{c||(d(e.name),p(e.topic??``),h(e.workspace??``))},[c,e.name,e.topic,e.workspace]);let D=()=>{let t=u.trim();t&&(r(e.id,{name:t,topic:f.trim()||null,workspace:m.trim()||null}),l(!1))};return(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{className:`group mb-1 border rounded-sm ${g?e.id===t?`border-[#0bda57] bg-[#0bda57]/10`:`border-[#0bda57]/50 bg-[#0bda57]/5`:e.id===t?`border-[#11a4d4] bg-[#11a4d4]/10`:_?`border-[#f59e0b]/40 bg-[#f59e0b]/5`:`border-transparent`}`,style:{marginLeft:s*12},title:w,children:c&&!g?(0,R.jsxs)(`form`,{className:`grid gap-1 p-1`,onSubmit:e=>{e.preventDefault(),D()},children:[(0,R.jsx)(`input`,{value:u,onChange:e=>d(e.target.value),className:`min-w-0 bg-[#0e1116] border border-slate-700 rounded-sm px-2 py-1 text-sm outline-none focus:border-[#11a4d4]`,autoFocus:!0}),(0,R.jsx)(`input`,{value:f,onChange:e=>p(e.target.value),placeholder:`Topic`,className:`min-w-0 bg-[#0e1116] border border-slate-700 rounded-sm px-2 py-1 text-xs outline-none focus:border-[#11a4d4]`}),(0,R.jsx)(`input`,{value:m,onChange:e=>h(e.target.value),placeholder:`Workspace (/absolute/path)`,className:`min-w-0 bg-[#0e1116] border border-slate-700 rounded-sm px-2 py-1 text-xs font-mono outline-none focus:border-[#11a4d4]`}),(0,R.jsxs)(`div`,{className:`flex justify-end gap-1`,children:[(0,R.jsx)(`button`,{type:`submit`,className:`h-7 w-7 inline-flex items-center justify-center border border-slate-700 rounded-sm text-slate-400 hover:border-[#11a4d4] hover:text-[#11a4d4]`,children:(0,R.jsx)(zo,{size:13})}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>l(!1),className:`h-7 w-7 inline-flex items-center justify-center border border-slate-700 rounded-sm text-slate-400 hover:border-[#11a4d4] hover:text-[#11a4d4]`,children:(0,R.jsx)(Ys,{size:13})})]})]}):(0,R.jsxs)(`div`,{className:`grid grid-cols-[1fr_auto] items-center gap-1 py-1 pr-1`,children:[(0,R.jsxs)(`button`,{type:`button`,onClick:()=>n(e.id),className:`min-w-0 text-left px-2 py-1 grid grid-cols-[auto_minmax(0,1fr)_auto] gap-2 items-center`,children:[(0,R.jsx)(`span`,{className:`h-6 w-6 inline-flex items-center justify-center rounded-sm ${g?`bg-[#0bda57]/15 text-[#0bda57]`:_?`bg-[#f59e0b]/15 text-[#f59e0b]`:`bg-[#151f24] text-slate-500`}`,children:g?(0,R.jsx)(ws,{size:13}):_?(0,R.jsx)(Eo,{size:13}):(0,R.jsx)(ls,{size:13})}),(0,R.jsxs)(`span`,{className:`min-w-0`,children:[(0,R.jsx)(`span`,{className:`block text-sm truncate ${_?`text-slate-500`:`text-slate-200`}`,children:e.name}),(0,R.jsx)(`span`,{className:`block text-[10px] font-mono truncate text-slate-500`,children:g?`shared default room`:_?`archived`:yhe(e)})]}),(0,R.jsx)(Che,{count:e.unreadCount})]}),(0,R.jsx)(`div`,{className:`flex items-center gap-1 pr-1 opacity-0 group-hover:opacity-100 group-focus-within:opacity-100 transition-opacity max-[980px]:opacity-100`,children:g?(0,R.jsx)(`span`,{title:`Shared Chat is locked`,"aria-label":`Shared Chat is locked`,className:`h-7 w-7 max-[980px]:h-9 max-[980px]:w-9 inline-flex items-center justify-center border border-[#0bda57]/50 rounded-sm text-[#0bda57]`,children:(0,R.jsx)(ws,{size:24,className:`w-3.5 h-3.5 max-[980px]:w-5 max-[980px]:h-5`})}):(0,R.jsxs)(`div`,{className:`relative`,children:[(0,R.jsx)(`button`,{ref:S,type:`button`,onClick:()=>y(e=>!e),title:`Room actions`,"aria-label":`Room actions`,className:`h-7 w-7 max-[980px]:h-9 max-[980px]:w-9 inline-flex items-center justify-center border border-slate-700 rounded-sm text-slate-400 hover:border-[#11a4d4] hover:text-[#11a4d4]`,children:(0,R.jsx)(ns,{size:24,className:`w-3.5 h-3.5 max-[980px]:w-5 max-[980px]:h-5`})}),v&&b?(0,Pa.createPortal)((0,R.jsx)(`div`,{ref:C,className:`fixed z-[1000] bg-[#1a262b] border border-slate-700 rounded-sm shadow-lg py-1`,style:{top:b.top,left:b.left,width:b3},children:_?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`button`,{type:`button`,onClick:()=>{T(),y(!1)},className:`w-full text-left px-3 py-2.5 text-sm text-slate-300 hover:bg-[#11a4d4]/10 hover:text-[#11a4d4] flex items-center gap-2`,children:[(0,R.jsx)($o,{size:16}),` Copy Room ID`]}),(0,R.jsxs)(`button`,{type:`button`,onClick:()=>{y(!1),i(e.id,!1)},className:`w-full text-left px-3 py-2.5 text-sm text-slate-300 hover:bg-[#11a4d4]/10 hover:text-[#11a4d4] flex items-center gap-2`,children:[(0,R.jsx)(To,{size:16}),` Restore Room`]}),(0,R.jsxs)(`button`,{type:`button`,onClick:()=>{y(!1),o(e)},className:`w-full text-left px-3 py-2.5 text-sm text-red-300 hover:bg-red-500/10 flex items-center gap-2`,children:[(0,R.jsx)(Ws,{size:16}),` Delete Room`]})]}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`button`,{type:`button`,onClick:()=>{T(),y(!1)},className:`w-full text-left px-3 py-2.5 text-sm text-slate-300 hover:bg-[#11a4d4]/10 hover:text-[#11a4d4] flex items-center gap-2`,children:[(0,R.jsx)($o,{size:16}),` Copy Room ID`]}),(0,R.jsxs)(`button`,{type:`button`,onClick:()=>{y(!1),l(!0)},className:`w-full text-left px-3 py-2.5 text-sm text-slate-300 hover:bg-[#11a4d4]/10 hover:text-[#11a4d4] flex items-center gap-2`,children:[(0,R.jsx)(ks,{size:16}),` Edit Room`]}),(0,R.jsxs)(`button`,{type:`button`,onClick:()=>{y(!1),a(e.id)},className:`w-full text-left px-3 py-2.5 text-sm text-slate-300 hover:bg-[#11a4d4]/10 hover:text-[#11a4d4] flex items-center gap-2`,children:[(0,R.jsx)(Ro,{size:16}),` Read All`]}),(0,R.jsxs)(`button`,{type:`button`,onClick:()=>{y(!1),i(e.id,!0)},className:`w-full text-left px-3 py-2.5 text-sm text-slate-300 hover:bg-[#11a4d4]/10 hover:text-[#11a4d4] flex items-center gap-2`,children:[(0,R.jsx)(Eo,{size:16}),` Archive Room`]})]})}),document.body):null]})})]})}),(e.children??[]).map(e=>(0,R.jsx)(w3,{room:e,selectedRoomId:t,onSelect:n,onUpdate:r,onArchive:i,onReadAll:a,onDelete:o,depth:s+1},e.id))]})}var T3=0,E3=1,D3=2,O3=4;function Dhe(e){return()=>e}function Ohe(e){e()}function k3(e,t){return n=>e(t(n))}function khe(e,t){return()=>e(t)}function Ahe(e,t){return n=>e(t,n)}function A3(e){return e!==void 0}function jhe(...e){return()=>{e.map(Ohe)}}function j3(){}function M3(e,t){return t(e),e}function Mhe(e,t){return t(e)}function N3(...e){return e}function P3(e,t){return e(E3,t)}function F3(e,t){e(T3,t)}function I3(e){e(D3)}function L3(e){return e(O3)}function R3(e,t){return P3(e,Ahe(t,T3))}function z3(e,t){let n=e(E3,e=>{n(),t(e)});return n}function B3(e){let t,n;return r=>i=>{t=i,n&&clearTimeout(n),n=setTimeout(()=>{r(t)},e)}}function V3(e,t){return e===t}function H3(e=V3){let t;return n=>r=>{e(t,r)||(t=r,n(r))}}function U3(e){return t=>n=>{e(n)&&t(n)}}function W3(e){return t=>k3(t,e)}function G3(e){return t=>()=>{t(e)}}function Q(e,...t){let n=Nhe(...t);return((t,r)=>{switch(t){case D3:I3(e);return;case E3:return P3(e,n(r))}})}function K3(e,t){return n=>r=>{n(t=e(t,r))}}function q3(e){return t=>n=>{e>0?e--:t(n)}}function J3(e){let t=null,n;return r=>i=>{t=i,!n&&(n=setTimeout(()=>{n=void 0,r(t)},e))}}function Y3(...e){let t=Array(e.length),n=0,r=null,i=2**e.length-1;return e.forEach((e,a)=>{let o=2**a;P3(e,e=>{let s=n;n|=o,t[a]=e,s!==i&&n===i&&r&&(r(),r=null)})}),e=>a=>{let o=()=>{e([a].concat(t))};n===i?o():r=o}}function Nhe(...e){return t=>e.reduceRight(Mhe,t)}function Phe(e){let t,n,r=()=>t?.();return function(i,a){switch(i){case E3:return a?n===a?void 0:(r(),n=a,t=P3(e,a),t):(r(),j3);case D3:r(),n=null;return}}}function $(e){let t=e,n=Z3();return((e,r)=>{switch(e){case T3:t=r;break;case E3:r(t);break;case O3:return t}return n(e,r)})}function X3(e,t){return M3($(t),t=>R3(e,t))}function Z3(){let e=[];return((t,n)=>{switch(t){case T3:e.slice().forEach(e=>{e(n)});return;case D3:e.splice(0,e.length);return;case E3:return e.push(n),()=>{let t=e.indexOf(n);t>-1&&e.splice(t,1)}}})}function Q3(e){return M3(Z3(),t=>R3(e,t))}function $3(e,t=[],{singleton:n}={singleton:!0}){return{constructor:e,dependencies:t,id:Fhe(),singleton:n}}var Fhe=()=>Symbol();function Ihe(e){let t=new Map,n=({constructor:e,dependencies:r,id:i,singleton:a})=>{if(a&&t.has(i))return t.get(i);let o=e(r.map(e=>n(e)));return a&&t.set(i,o),o};return n(e)}function e6(...e){let t=Z3(),n=Array(e.length),r=0,i=2**e.length-1;return e.forEach((e,a)=>{let o=2**a;P3(e,e=>{n[a]=e,r|=o,r===i&&F3(t,n)})}),function(e,a){switch(e){case D3:I3(t);return;case E3:return r===i&&a(n),P3(t,a)}}}function t6(e,t=V3){return Q(e,H3(t))}function n6(...e){return function(t,n){switch(t){case D3:return;case E3:return jhe(...e.map(e=>P3(e,n)))}}}var r6={DEBUG:0,INFO:1,WARN:2,ERROR:3},Lhe={[r6.DEBUG]:`debug`,[r6.ERROR]:`error`,[r6.INFO]:`log`,[r6.WARN]:`warn`},Rhe=()=>typeof globalThis>`u`?window:globalThis,i6=$3(()=>{let e=$(r6.ERROR);return{log:$((t,n,r=r6.INFO)=>{r>=(Rhe().VIRTUOSO_LOG_LEVEL??L3(e))&&console[Lhe[r]](`%creact-virtuoso: %c%s %o`,`color: #0253b3; font-weight: bold`,`color: initial`,t,n)}),logLevel:e}},[],{singleton:!0});function a6(e,t,n){return o6(e,t,n).callbackRef}function o6(e,t,n){let r=L.useRef(null),i=e=>{},a=L.useMemo(()=>typeof ResizeObserver<`u`?new ResizeObserver(t=>{let r=()=>{let n=t[0].target;n.offsetParent!==null&&e(n)};n?r():requestAnimationFrame(r)}):null,[e,n]);return i=e=>{e&&t?(a?.observe(e),r.current=e):(r.current&&a?.unobserve(r.current),r.current=null)},{callbackRef:i,ref:r}}function s6(e,t,n,r,i,a,o,s,c){return o6(L.useCallback(n=>{let c=zhe(n.children,t,s?`offsetWidth`:`offsetHeight`,i),l=n.parentElement;for(;l.dataset.virtuosoScroller===void 0;)l=l.parentElement;let u=l.lastElementChild.dataset.viewportType===`window`,d;u&&(d=l.ownerDocument.defaultView);let f=o?s?o.scrollLeft:o.scrollTop:u?s?d.scrollX||d.document.documentElement.scrollLeft:d.scrollY||d.document.documentElement.scrollTop:s?l.scrollLeft:l.scrollTop,p=o?s?o.scrollWidth:o.scrollHeight:u?s?d.document.documentElement.scrollWidth:d.document.documentElement.scrollHeight:s?l.scrollWidth:l.scrollHeight,m=o?s?o.offsetWidth:o.offsetHeight:u?s?d.innerWidth:d.innerHeight:s?l.offsetWidth:l.offsetHeight;r({scrollHeight:p,scrollTop:Math.max(f,0),viewportHeight:m}),a?.(s?c6(`column-gap`,getComputedStyle(n).columnGap,i):c6(`row-gap`,getComputedStyle(n).rowGap,i)),c!==null&&e(c)},[e,t,i,a,o,r,s]),n,c)}function zhe(e,t,n,r){let i=e.length;if(i===0)return null;let a=[];for(let o=0;o<i;o++){let i=e.item(o);if(i.dataset.index===void 0)continue;let s=parseInt(i.dataset.index),c=parseFloat(i.dataset.knownSize),l=t(i,n);if(l===0&&r(`Zero-sized element, this should not happen`,{child:i},r6.ERROR),l===c)continue;let u=a[a.length-1];a.length===0||u.size!==l||u.endIndex!==s-1?a.push({endIndex:s,size:l,startIndex:s}):a[a.length-1].endIndex++}return a}function c6(e,t,n){return t!==`normal`&&t?.endsWith(`px`)!==!0&&n(`${e} was not resolved to pixel value correctly`,t,r6.WARN),t===`normal`?0:parseInt(t??`0`,10)}function l6(e,t,n){let r=L.useRef(null),i=L.useCallback(n=>{if(!n?.offsetParent)return;let i=n.getBoundingClientRect(),a=i.width,s,c;if(t){let e=t.getBoundingClientRect(),n=i.top-e.top;c=e.height-Math.max(0,n),s=n+t.scrollTop}else{let e=o.current.ownerDocument.defaultView;c=e.innerHeight-Math.max(0,i.top),s=i.top+e.scrollY}r.current={listHeight:i.height,offsetTop:s,visibleHeight:c,visibleWidth:a},e(r.current)},[e,t]),{callbackRef:a,ref:o}=o6(i,!0,n),s=L.useCallback(()=>{i(o.current)},[i,o]);return L.useEffect(()=>{if(t){t.addEventListener(`scroll`,s);let e=new ResizeObserver(()=>{requestAnimationFrame(s)});return e.observe(t),()=>{t.removeEventListener(`scroll`,s),e.unobserve(t)}}let e=o.current?.ownerDocument.defaultView;return e?.addEventListener(`scroll`,s),e?.addEventListener(`resize`,s),()=>{e?.removeEventListener(`scroll`,s),e?.removeEventListener(`resize`,s)}},[s,t,o]),a}var u6=$3(()=>{let e=Z3(),t=Z3(),n=$(0),r=Z3(),i=$(0),a=Z3(),o=Z3(),s=$(0),c=$(0),l=$(0),u=$(0),d=Z3(),f=Z3(),p=$(!1),m=$(!1),h=$(!1);return R3(Q(e,W3(({scrollTop:e})=>e)),t),R3(Q(e,W3(({scrollHeight:e})=>e)),o),R3(t,i),{deviation:n,fixedFooterHeight:l,fixedHeaderHeight:c,footerHeight:u,headerHeight:s,horizontalDirection:m,scrollBy:f,scrollContainerState:e,scrollHeight:o,scrollingInProgress:p,scrollTo:d,scrollTop:t,skipAnimationFrameInResizeObserver:h,smoothScrollTargetReached:r,statefulScrollTop:i,viewportHeight:a}},[],{singleton:!0}),d6={lvl:0};function f6(e,t){let n=e.length;if(n===0)return[];let{index:r,value:i}=t(e[0]),a=[];for(let o=1;o<n;o++){let{index:n,value:s}=t(e[o]);a.push({end:n-1,start:r,value:i}),r=n,i=s}return a.push({end:1/0,start:r,value:i}),a}function p6(e){return e===d6}function m6(e,t){if(!p6(e))return t===e.k?e.v:t<e.k?m6(e.l,t):m6(e.r,t)}function h6(e,t,n=`k`){if(p6(e))return[-1/0,void 0];if(Number(e[n])===t)return[e.k,e.v];if(Number(e[n])<t){let r=h6(e.r,t,n);return r[0]===-1/0?[e.k,e.v]:r}return h6(e.l,t,n)}function g6(e,t,n){return p6(e)?D6(t,n,1):t===e.k?C6(e,{k:t,v:n}):t<e.k?O6(C6(e,{l:g6(e.l,t,n)})):O6(C6(e,{r:g6(e.r,t,n)}))}function _6(){return d6}function v6(e,t,n){if(p6(e))return[];let r=h6(e,t)[0];return Bhe(x6(e,r,n))}function y6(e,t){if(p6(e))return d6;let{k:n,l:r,r:i}=e;if(t===n){if(p6(r))return i;if(p6(i))return r;let[t,n]=E6(r);return S6(C6(e,{k:t,l:w6(r),v:n}))}return S6(t<n?C6(e,{l:y6(r,t)}):C6(e,{r:y6(i,t)}))}function b6(e){return p6(e)?[]:[...b6(e.l),{k:e.k,v:e.v},...b6(e.r)]}function x6(e,t,n){if(p6(e))return[];let{k:r,l:i,r:a,v:o}=e,s=[];return r>t&&(s=s.concat(x6(i,t,n))),r>=t&&r<=n&&s.push({k:r,v:o}),r<=n&&(s=s.concat(x6(a,t,n))),s}function S6(e){let{l:t,lvl:n,r}=e;if(r.lvl>=n-1&&t.lvl>=n-1)return e;if(n>r.lvl+1){if(T6(t))return k6(C6(e,{lvl:n-1}));if(!p6(t)&&!p6(t.r))return C6(t.r,{l:C6(t,{r:t.r.l}),lvl:n,r:C6(e,{l:t.r.r,lvl:n-1})});throw Error(`Unexpected empty nodes`)}if(T6(e))return A6(C6(e,{lvl:n-1}));if(!p6(r)&&!p6(r.l)){let t=r.l,i=T6(t)?r.lvl-1:r.lvl;return C6(t,{l:C6(e,{lvl:n-1,r:t.l}),lvl:t.lvl+1,r:A6(C6(r,{l:t.r,lvl:i}))})}throw Error(`Unexpected empty nodes`)}function C6(e,t){return D6(t.k===void 0?e.k:t.k,t.v===void 0?e.v:t.v,t.lvl===void 0?e.lvl:t.lvl,t.l===void 0?e.l:t.l,t.r===void 0?e.r:t.r)}function w6(e){return p6(e.r)?e.l:S6(C6(e,{r:w6(e.r)}))}function T6(e){return p6(e)||e.lvl>e.r.lvl}function E6(e){return p6(e.r)?[e.k,e.v]:E6(e.r)}function D6(e,t,n,r=d6,i=d6){return{k:e,l:r,lvl:n,r:i,v:t}}function O6(e){return A6(k6(e))}function k6(e){let{l:t}=e;return!p6(t)&&t.lvl===e.lvl?C6(t,{r:C6(e,{l:t.r})}):e}function A6(e){let{lvl:t,r:n}=e;return!p6(n)&&!p6(n.r)&&n.lvl===t&&n.r.lvl===t?C6(n,{l:C6(e,{r:n.l}),lvl:t+1}):e}function Bhe(e){return f6(e,({k:e,v:t})=>({index:e,value:t}))}function j6(e,t){return!!(e&&e.startIndex===t.startIndex&&e.endIndex===t.endIndex)}function M6(e,t){return!!(e&&e[0]===t[0]&&e[1]===t[1])}var N6=$3(()=>({recalcInProgress:$(!1)}),[],{singleton:!0});function P6(e,t,n){return e[F6(e,t,n)]}function F6(e,t,n,r=0){let i=e.length-1;for(;r<=i;){let a=Math.floor((r+i)/2),o=e[a],s=n(o,t);if(s===0)return a;if(s===-1){if(i-r<2)return a-1;i=a-1}else{if(i===r)return a;r=a+1}}throw Error(`Failed binary finding record in array - ${e.join(`,`)}, searched for ${t}`)}function Vhe(e,t,n,r){let i=F6(e,t,r),a=F6(e,n,r,i);return e.slice(i,a+1)}function I6(e,t){return Math.round(e.getBoundingClientRect()[t])}function L6(e){return!p6(e.groupOffsetTree)}function R6({index:e},t){return t===e?0:t<e?-1:1}function Hhe(){return{groupIndices:[],groupOffsetTree:_6(),lastIndex:0,lastOffset:0,lastSize:0,offsetTree:[],sizeTree:_6()}}function Uhe(e,t){let n=p6(e)?0:1/0;for(let r of t){let{endIndex:t,size:i,startIndex:a}=r;if(n=Math.min(n,a),p6(e)){e=g6(e,0,i);continue}let o=v6(e,a-1,t+1);if(o.some(Xhe(r)))continue;let s=!1,c=!1;for(let{end:n,start:r,value:a}of o)s?(t>=r||i===a)&&(e=y6(e,r)):(c=a!==i,s=!0),n>t&&t>=r&&a!==i&&(e=g6(e,t+1,a));c&&(e=g6(e,a,i))}return[e,n]}function Whe(e){return typeof e.groupIndex<`u`}function Ghe({offset:e},t){return t===e?0:t<e?-1:1}function z6(e,t,n){if(t.length===0)return 0;let{index:r,offset:i,size:a}=P6(t,e,R6),o=e-r,s=a*o+(o-1)*n+i;return s>0?s+n:s}function B6(e,t){if(!L6(t))return e;let n=0;for(;t.groupIndices[n]<=e+n;)n++;return e+n}function V6(e,t,n){if(Whe(e))return t.groupIndices[e.groupIndex]+1;let r=B6(e.index===`LAST`?n:e.index,t);return r=Math.max(0,r,Math.min(n,r)),r}function Khe(e,t,n,r=0){return r>0&&(t=Math.max(t,P6(e,r,R6).offset)),f6(Vhe(e,t,n,Ghe),Yhe)}function qhe(e,[t,n,r,i]){t.length>0&&r(`received item sizes`,t,r6.DEBUG);let a=e.sizeTree,o=a,s=0;if(n.length>0&&p6(a)&&t.length===2){let e=t[0].size,r=t[1].size;o=n.reduce((t,n)=>g6(g6(t,n,e),n+1,r),o)}else [o,s]=Uhe(o,t);if(o===a)return e;let{lastIndex:c,lastOffset:l,lastSize:u,offsetTree:d}=U6(e.offsetTree,s,o,i);return{groupIndices:n,groupOffsetTree:n.reduce((e,t)=>g6(e,t,z6(t,d,i)),_6()),lastIndex:c,lastOffset:l,lastSize:u,offsetTree:d,sizeTree:o}}function Jhe(e){return b6(e).map(({k:e,v:t},n,r)=>{let i=r[n+1];return{endIndex:i===void 0?1/0:i.k-1,size:t,startIndex:e}})}function H6(e,t){let n=0,r=0;for(;n<e;)n+=t[r+1]-t[r]-1,r++;return r-(n===e?0:1)}function U6(e,t,n,r){let i=e,a=0,o=0,s=0,c=0;if(t!==0){c=F6(i,t-1,R6),s=i[c].offset;let e=h6(n,t-1);a=e[0],o=e[1],i.length&&i[c].size===h6(n,t)[1]&&--c,i=i.slice(0,c+1)}else i=[];for(let{start:e,value:c}of v6(n,t,1/0)){let t=e-a,n=t*o+s+t*r;i.push({index:e,offset:n,size:c}),a=e,s=n,o=c}return{lastIndex:a,lastOffset:s,lastSize:o,offsetTree:i}}function Yhe(e){return{index:e.index,value:e}}function Xhe(e){let{endIndex:t,size:n,startIndex:r}=e;return e=>e.start===r&&(e.end===t||e.end===1/0)&&e.value===n}var Zhe={offsetHeight:`height`,offsetWidth:`width`},W6=$3(([{log:e},{recalcInProgress:t}])=>{let n=Z3(),r=Z3(),i=X3(r,0),a=Z3(),o=Z3(),s=$(0),c=$([]),l=$(void 0),u=$(void 0),d=$(void 0),f=$(void 0),p=$((e,t)=>I6(e,Zhe[t])),m=$(void 0),h=$(0),g=Hhe(),_=X3(Q(n,Y3(c,e,h),K3(qhe,g),H3()),g),v=X3(Q(c,H3(),K3((e,t)=>({current:t,prev:e.current}),{current:[],prev:[]}),W3(({prev:e})=>e)),[]);R3(Q(c,U3(e=>e.length>0),Y3(_,h),W3(([e,t,n])=>{let r=e.reduce((e,r,i)=>g6(e,r,z6(r,t.offsetTree,n)||i),_6());return{...t,groupIndices:e,groupOffsetTree:r}})),_),R3(Q(r,Y3(_),U3(([e,{lastIndex:t}])=>e<t),W3(([e,{lastIndex:t,lastSize:n}])=>[{endIndex:t,size:n,startIndex:e}])),n),R3(l,u);let y=X3(Q(l,W3(e=>e===void 0)),!0);R3(Q(u,U3(e=>e!==void 0&&p6(L3(_).sizeTree)),W3(e=>{let t=L3(d),n=L3(c).length>0;return t!==void 0&&t!==0?n?[{endIndex:0,size:t,startIndex:0},{endIndex:1,size:e,startIndex:1}]:[]:[{endIndex:0,size:e,startIndex:0}]})),n),R3(Q(f,U3(e=>e!==void 0&&e.length>0&&p6(L3(_).sizeTree)),W3(e=>{let t=[],n=e[0],r=0;for(let i=1;i<e.length;i++){let a=e[i];a!==n&&(t.push({endIndex:i-1,size:n,startIndex:r}),n=a,r=i)}return t.push({endIndex:e.length-1,size:n,startIndex:r}),t})),n),R3(Q(c,Y3(d,u),U3(([,e,t])=>e!==void 0&&t!==void 0),W3(([e,t,n])=>{let r=[];for(let i=0;i<e.length;i++){let a=e[i],o=e[i+1];r.push({startIndex:a,endIndex:a,size:t}),o!==void 0&&r.push({startIndex:a+1,endIndex:o-1,size:n})}return r})),n);let b=Q3(Q(n,Y3(_),K3(({sizes:e},[t,n])=>({changed:n!==e,sizes:n}),{changed:!1,sizes:g}),W3(e=>e.changed)));P3(Q(s,K3((e,t)=>({diff:e.prev-t,prev:t}),{diff:0,prev:0}),W3(e=>e.diff)),e=>{let{groupIndices:n}=L3(_);if(e>0)F3(t,!0),F3(a,e+H6(e,n));else if(e<0){let t=L3(v);t.length>0&&(e-=H6(-e,t)),F3(o,e)}}),P3(Q(s,Y3(e)),([e,t])=>{e<0&&t("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:s},r6.ERROR)});let x=Q3(a);R3(Q(a,Y3(_),W3(([e,t])=>{let n=t.groupIndices.length>0,r=[],i=t.lastSize;if(n){let n=m6(t.sizeTree,0),a=0,o=0;for(;a<e;){let e=t.groupIndices[o],s=t.groupIndices.length===o+1?1/0:t.groupIndices[o+1]-e-1;r.push({endIndex:e,size:n,startIndex:e}),r.push({endIndex:e+1+s-1,size:i,startIndex:e+1}),o++,a+=s+1}let s=b6(t.sizeTree);return a!==e&&s.shift(),s.reduce((t,{k:n,v:r})=>{let i=t.ranges;return t.prevSize!==0&&(i=[...t.ranges,{endIndex:n+e-1,size:t.prevSize,startIndex:t.prevIndex}]),{prevIndex:n+e,prevSize:r,ranges:i}},{prevIndex:e,prevSize:0,ranges:r}).ranges}return b6(t.sizeTree).reduce((t,{k:n,v:r})=>({prevIndex:n+e,prevSize:r,ranges:[...t.ranges,{endIndex:n+e-1,size:t.prevSize,startIndex:t.prevIndex}]}),{prevIndex:0,prevSize:i,ranges:[]}).ranges})),n);let S=Q3(Q(o,Y3(_,h),W3(([e,{offsetTree:t},n])=>z6(-e,t,n))));return R3(Q(o,Y3(_,h),W3(([e,t,n])=>{if(t.groupIndices.length>0){if(p6(t.sizeTree))return t;let r=_6(),i=L3(v),a=0,o=0,s=0;for(;a<-e;){s=i[o];let e=i[o+1]-s-1;o++,a+=e+1}if(r=b6(t.sizeTree).reduce((t,{k:n,v:r})=>g6(t,Math.max(0,n+e),r),r),a!==-e){let n=m6(t.sizeTree,s);r=g6(r,0,n);let i=h6(t.sizeTree,-e+1)[1];r=g6(r,1,i)}return{...t,sizeTree:r,...U6(t.offsetTree,0,r,n)}}let r=b6(t.sizeTree).reduce((t,{k:n,v:r})=>g6(t,Math.max(0,n+e),r),_6());return{...t,sizeTree:r,...U6(t.offsetTree,0,r,n)}})),_),{beforeUnshiftWith:x,data:m,defaultItemSize:u,firstItemIndex:s,fixedItemSize:l,fixedGroupSize:d,gap:h,groupIndices:c,heightEstimates:f,itemSize:p,listRefresh:b,shiftWith:o,shiftWithOffset:S,sizeRanges:n,sizes:_,statefulTotalCount:i,totalCount:r,trackItemSizes:y,unshiftWith:a}},N3(i6,N6),{singleton:!0});function Qhe(e){return e.reduce((e,t)=>(e.groupIndices.push(e.totalCount),e.totalCount+=t+1,e),{groupIndices:[],totalCount:0})}var G6=$3(([{groupIndices:e,sizes:t,totalCount:n},{headerHeight:r,scrollTop:i}])=>{let a=Z3(),o=Z3(),s=Q3(Q(a,W3(Qhe)));return R3(Q(s,W3(e=>e.totalCount)),n),R3(Q(s,W3(e=>e.groupIndices)),e),R3(Q(e6(i,t,r),U3(([e,t])=>L6(t)),W3(([e,t,n])=>h6(t.groupOffsetTree,Math.max(e-n,0),`v`)[0]),H3(),W3(e=>[e])),o),{groupCounts:a,topItemsIndexes:o}},N3(W6,u6)),K6=$3(([{log:e}])=>{let t=$(!1),n=Q3(Q(t,U3(e=>e),H3()));return P3(t,t=>{t&&L3(e)(`props updated`,{},r6.DEBUG)}),{didMount:n,propsReady:t}},N3(i6),{singleton:!0}),$he=typeof document<`u`&&`scrollBehavior`in document.documentElement.style;function q6(e){let t=typeof e==`number`?{index:e}:e;return t.align||=`start`,(!t.behavior||!$he)&&(t.behavior=`auto`),t.offset===void 0&&(t.offset=0),t}var J6=$3(([{gap:e,listRefresh:t,sizes:n,totalCount:r},{fixedFooterHeight:i,fixedHeaderHeight:a,footerHeight:o,headerHeight:s,scrollingInProgress:c,scrollTo:l,smoothScrollTargetReached:u,viewportHeight:d},{log:f}])=>{let p=Z3(),m=Z3(),h=$(0),g=null,_=null,v=null;function y(){g!==null&&(g(),g=null),v!==null&&(v(),v=null),_&&=(clearTimeout(_),null),F3(c,!1)}return R3(Q(p,Y3(n,d,r,h,s,o,f),Y3(e,a,i),W3(([[e,n,r,i,a,o,s,l],d,f,h])=>{let b=q6(e),{align:x,behavior:S,offset:C}=b,w=i-1,T=V6(b,n,w),E=z6(T,n.offsetTree,d)+o;x===`end`?(E+=f+h6(n.sizeTree,T)[1]-r+h,T===w&&(E+=s)):x===`center`?E+=(f+h6(n.sizeTree,T)[1]-r+h)/2:E-=a,C!==void 0&&C!==0&&(E+=C);let D=t=>{y(),t?(l(`retrying to scroll to`,{location:e},r6.DEBUG),F3(p,e)):(F3(m,!0),l(`list did not change, scroll successful`,{},r6.DEBUG))};if(y(),S===`smooth`){let e=!1;v=P3(t,t=>{e||=t}),g=z3(u,()=>{D(e)})}else g=z3(Q(t,ege(150)),D);return _=setTimeout(()=>{y()},1200),F3(c,!0),l(`scrolling from index to`,{behavior:S,index:T,top:E},r6.DEBUG),{behavior:S,top:E}})),l),{scrollTargetReached:m,scrollToIndex:p,topListHeight:h}},N3(W6,u6,i6),{singleton:!0});function ege(e){return t=>{let n=setTimeout(()=>{t(!1)},e);return e=>{e&&(t(!0),clearTimeout(n))}}}function Y6(e,t){e===0?t():requestAnimationFrame(()=>{Y6(e-1,t)})}function X6(e,t){let n=t-1;return typeof e==`number`?e:e.index===`LAST`?n:e.index}var Z6=$3(([{defaultItemSize:e,listRefresh:t,sizes:n},{scrollTop:r},{scrollTargetReached:i,scrollToIndex:a},{didMount:o}])=>{let s=$(!0),c=$(0),l=$(!0);return R3(Q(o,Y3(c),U3(([e,t])=>t!==0),G3(!1)),s),R3(Q(o,Y3(c),U3(([e,t])=>t!==0),G3(!1)),l),P3(Q(e6(t,o),Y3(s,n,e,l),U3(([[,e],t,{sizeTree:n},r,i])=>e&&(!p6(n)||A3(r))&&!t&&!i),Y3(c)),([,e])=>{z3(i,()=>{F3(l,!0)}),Y6(4,()=>{z3(r,()=>{F3(s,!0)}),F3(a,e)})}),{initialItemFinalLocationReached:l,initialTopMostItemIndex:c,scrolledToInitialItem:s}},N3(W6,u6,J6,K6),{singleton:!0});function Q6(e,t){return Math.abs(e-t)<1.01}var $6=`up`,e8=`down`,tge=`none`,nge={atBottom:!1,notAtBottomBecause:`NOT_SHOWING_LAST_ITEM`,state:{offsetBottom:0,scrollHeight:0,scrollTop:0,viewportHeight:0}},rge=0,t8=$3(([{footerHeight:e,headerHeight:t,scrollBy:n,scrollContainerState:r,scrollTop:i,viewportHeight:a}])=>{let o=$(!1),s=$(!0),c=Z3(),l=Z3(),u=$(4),d=$(rge),f=X3(Q(n6(Q(t6(i),q3(1),G3(!0)),Q(t6(i),q3(1),G3(!1),B3(100))),H3()),!1),p=X3(Q(n6(Q(n,G3(!0)),Q(n,G3(!1),B3(200))),H3()),!1);R3(Q(e6(t6(i),t6(d)),W3(([e,t])=>e<=t),H3()),s),R3(Q(s,J3(50)),l);let m=Q3(Q(e6(r,t6(a),t6(t),t6(e),t6(u)),K3((e,[{scrollHeight:t,scrollTop:n},r,i,a,o])=>{let s=n+r-t>-o,c={scrollHeight:t,scrollTop:n,viewportHeight:r};if(s){let t,r;return n>e.state.scrollTop?(t=`SCROLLED_DOWN`,r=e.state.scrollTop-n):(t=`SIZE_DECREASED`,r=e.state.scrollTop-n||e.scrollTopDelta),{atBottom:!0,atBottomBecause:t,scrollTopDelta:r,state:c}}let l;return l=c.scrollHeight>e.state.scrollHeight?`SIZE_INCREASED`:r<e.state.viewportHeight?`VIEWPORT_HEIGHT_DECREASING`:n<e.state.scrollTop?`SCROLLING_UPWARDS`:`NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM`,{atBottom:!1,notAtBottomBecause:l,state:c}},nge),H3((e,t)=>e!==void 0&&e.atBottom===t.atBottom))),h=X3(Q(r,K3((e,{scrollHeight:t,scrollTop:n,viewportHeight:r})=>{if(!Q6(e.scrollHeight,t)){let i=t-(n+r)<1;return e.scrollTop!==n&&i?{changed:!0,jump:e.scrollTop-n,scrollHeight:t,scrollTop:n}:{changed:!0,jump:0,scrollHeight:t,scrollTop:n}}return{changed:!1,jump:0,scrollHeight:t,scrollTop:n}},{changed:!1,jump:0,scrollHeight:0,scrollTop:0}),U3(e=>e.changed),W3(e=>e.jump)),0);R3(Q(m,W3(e=>e.atBottom)),o),R3(Q(o,J3(50)),c);let g=$(e8);R3(Q(r,W3(({scrollTop:e})=>e),H3(),K3((e,t)=>L3(p)?{direction:e.direction,prevScrollTop:t}:{direction:t<e.prevScrollTop?$6:e8,prevScrollTop:t},{direction:e8,prevScrollTop:0}),W3(e=>e.direction)),g),R3(Q(r,J3(50),G3(tge)),g);let _=$(0);return R3(Q(f,U3(e=>!e),G3(0)),_),R3(Q(i,J3(100),Y3(f),U3(([e,t])=>t),K3(([e,t],[n])=>[t,n],[0,0]),W3(([e,t])=>t-e)),_),{atBottomState:m,atBottomStateChange:c,atBottomThreshold:u,atTopStateChange:l,atTopThreshold:d,isAtBottom:o,isAtTop:s,isScrolling:f,lastJumpDueToItemResize:h,scrollDirection:g,scrollVelocity:_}},N3(u6)),n8=`top`,r8=`bottom`,i8=`none`;function a8(e,t,n){return typeof e==`number`?n===$6&&t===n8||n===e8&&t===r8?e:0:n===$6?t===n8?e.main:e.reverse:t===r8?e.main:e.reverse}function o8(e,t){return typeof e==`number`?e:e[t]??0}var s8=$3(([{deviation:e,fixedHeaderHeight:t,headerHeight:n,scrollTop:r,viewportHeight:i}])=>{let a=Z3(),o=$(0),s=$(0),c=$(0);return{increaseViewportBy:s,listBoundary:a,overscan:c,topListHeight:o,visibleRange:X3(Q(e6(t6(r),t6(i),t6(n),t6(a,M6),t6(c),t6(o),t6(t),t6(e),t6(s)),W3(([e,t,n,[r,i],a,o,s,c,l])=>{let u=e-c,d=o+s,f=Math.max(n-u,0),p=i8,m=o8(l,n8),h=o8(l,r8);return r-=c,r+=n+s,i+=n+s,i-=c,r>e+d-m&&(p=$6),i<e-f+t+h&&(p=e8),p===i8?null:[Math.max(u-n-a8(a,n8,p)-m,0),u-f-s+t+a8(a,r8,p)+h]}),U3(e=>e!==null),H3(M6)),[0,0])}},N3(u6),{singleton:!0});function ige(e,t,n){if(L6(t)){let r=B6(e,t);return[{index:h6(t.groupOffsetTree,r)[0],offset:0,size:0},{data:n?.[0],index:r,offset:0,size:0}]}return[{data:n?.[0],index:e,offset:0,size:0}]}var c8={bottom:0,firstItemIndex:0,items:[],offsetBottom:0,offsetTop:0,top:0,topItems:[],topListHeight:0,totalCount:0};function l8(e,t,n,r,i,a){let{lastIndex:o,lastOffset:s,lastSize:c}=i,l=0,u=0;if(e.length>0){l=e[0].offset;let t=e[e.length-1];u=t.offset+t.size}let d=n-o,f=s+d*c+(d-1)*r,p=l,m=f-u;return{bottom:u,firstItemIndex:a,items:d8(e,i,a),offsetBottom:m,offsetTop:l,top:p,topItems:d8(t,i,a),topListHeight:t.reduce((e,t)=>t.size+e,0),totalCount:n}}function u8(e,t,n,r,i,a){let o=0;if(n.groupIndices.length>0)for(let t of n.groupIndices){if(t-o>=e)break;o++}let s=e+o,c=X6(t,s);return l8(Array.from({length:s}).map((e,t)=>({data:a[t+c],index:t+c,offset:0,size:0})),[],s,i,n,r)}function d8(e,t,n){if(e.length===0)return[];if(!L6(t))return e.map(e=>({...e,index:e.index+n,originalIndex:e.index}));let r=e[0].index,i=e[e.length-1].index,a=[],o=v6(t.groupOffsetTree,r,i),s,c=0;for(let r of e){(!s||s.end<r.index)&&(s=o.shift(),c=t.groupIndices.indexOf(s.start));let e;e=r.index===s.start?{index:c,type:`group`}:{groupIndex:c,index:r.index-(c+1)+n},a.push({...e,data:r.data,offset:r.offset,originalIndex:r.index,size:r.size})}return a}function f8(e,t){return e===void 0?0:typeof e==`number`?e:e[t]??0}var p8=$3(([{data:e,firstItemIndex:t,gap:n,sizes:r,totalCount:i},a,{listBoundary:o,topListHeight:s,visibleRange:c},{initialTopMostItemIndex:l,scrolledToInitialItem:u},{topListHeight:d},f,{didMount:p},{recalcInProgress:m}])=>{let h=$([]),g=$(0),_=Z3(),v=$(0);R3(a.topItemsIndexes,h);let y=X3(Q(e6(p,m,t6(c,M6),t6(i),t6(r),t6(l),u,t6(h),t6(t),t6(n),t6(v),e),U3(([e,t,,n,,,,,,,,r])=>{let i=r!==void 0&&r.length!==n;return e&&!t&&!i}),W3(([,,[e,t],n,r,i,a,o,s,c,l,u])=>{let d=r,{offsetTree:f,sizeTree:p}=d,m=L3(g);if(n===0)return{...c8,totalCount:n};if(e===0&&t===0)return m===0?{...c8,totalCount:n}:u8(m,i,r,s,c,u||[]);if(p6(p))return m>0?null:l8(ige(X6(i,n),d,u),[],n,c,d,s);let h=[];if(o.length>0){let e=o[0],t=o[o.length-1],n=0;for(let r of v6(p,e,t)){let i=r.value,a=Math.max(r.start,e),o=Math.min(r.end,t);for(let e=a;e<=o;e++)h.push({data:u?.[e],index:e,offset:n,size:i}),n+=i}}if(!a)return l8([],h,n,c,d,s);let _=o.length>0?o[o.length-1]+1:0,v=Khe(f,e,t,_);if(v.length===0)return null;let y=n-1,b=M3([],n=>{for(let r of v){let i=r.value,a=i.offset,o=r.start,s=i.size;if(i.offset<e){o+=Math.floor((e-i.offset+c)/(s+c));let t=o-r.start;a+=t*s+t*c}o<_&&(a+=(_-o)*s,o=_);let l=Math.min(r.end,y);for(let e=o;e<=l&&!(a>=t);e++)n.push({data:u?.[e],index:e,offset:a,size:s}),a+=s+c}}),x=f8(l,n8),S=f8(l,r8);if(b.length>0&&(x>0||S>0)){let e=b[0],t=b[b.length-1];if(x>0&&e.index>_){let t=Math.min(x,e.index-_),n=[],r=e.offset;for(let i=e.index-1;i>=e.index-t;i--){let t=v6(p,i,i)[0]?.value??e.size;r-=t+c,n.unshift({data:u?.[i],index:i,offset:r,size:t})}b.unshift(...n)}if(S>0&&t.index<y){let e=Math.min(S,y-t.index),n=t.offset+t.size+c;for(let r=t.index+1;r<=t.index+e;r++){let e=v6(p,r,r)[0]?.value??t.size;b.push({data:u?.[r],index:r,offset:n,size:e}),n+=e+c}}}return l8(b,h,n,c,d,s)}),U3(e=>e!==null),H3()),c8);R3(Q(e,U3(A3),W3(e=>e?.length)),i),R3(Q(y,W3(e=>e.topListHeight)),d),R3(d,s),R3(Q(y,W3(e=>[e.top,e.bottom])),o),R3(Q(y,W3(e=>e.items)),_);let b=Q3(Q(y,U3(({items:e})=>e.length>0),Y3(i,e),U3(([{items:e},t])=>e[e.length-1].originalIndex===t-1),W3(([,e,t])=>[e-1,t]),H3(M6),W3(([e])=>e))),x=Q3(Q(y,J3(200),U3(({items:e,topItems:t})=>e.length>0&&e[0].originalIndex===t.length),W3(({items:e})=>e[0].index),H3()));return{endReached:b,initialItemCount:g,itemsRendered:_,listState:y,minOverscanItemCount:v,rangeChanged:Q3(Q(y,U3(({items:e})=>e.length>0),W3(({items:e})=>{let t=0,n=e.length-1;for(;e[t].type===`group`&&t<n;)t++;for(;e[n].type===`group`&&n>t;)n--;return{endIndex:e[n].index,startIndex:e[t].index}}),H3(j6))),startReached:x,topItemsIndexes:h,...f}},N3(W6,G6,s8,Z6,J6,t8,K6,N6),{singleton:!0}),m8=$3(([{fixedFooterHeight:e,fixedHeaderHeight:t,footerHeight:n,headerHeight:r},{listState:i}])=>{let a=Z3(),o=X3(Q(e6(n,e,r,t,i),W3(([e,t,n,r,i])=>e+t+n+r+i.offsetBottom+i.bottom)),0);return R3(t6(o),a),{totalListHeight:o,totalListHeightChanged:a}},N3(u6,p8),{singleton:!0}),age=$3(([{viewportHeight:e},{totalListHeight:t}])=>{let n=$(!1);return{alignToBottom:n,paddingTopAddition:X3(Q(e6(n,e,t),U3(([e])=>e),W3(([,e,t])=>Math.max(0,e-t)),J3(0),H3()),0)}},N3(u6,m8),{singleton:!0}),h8=$3(()=>({context:$(null)})),oge=({itemBottom:e,itemTop:t,locationParams:{align:n,behavior:r,...i},viewportBottom:a,viewportTop:o})=>t<o?{...i,align:n??`start`,...r===void 0?{}:{behavior:r}}:e>a?{...i,align:n??`end`,...r===void 0?{}:{behavior:r}}:null,g8=$3(([{gap:e,sizes:t,totalCount:n},{fixedFooterHeight:r,fixedHeaderHeight:i,headerHeight:a,scrollingInProgress:o,scrollTop:s,viewportHeight:c},{scrollToIndex:l}])=>{let u=Z3();return R3(Q(u,Y3(t,c,n,a,i,r,s),Y3(e),W3(([[e,t,n,r,i,a,s,c],l])=>{let{calculateViewLocation:u=oge,done:d,...f}=e,p=V6(e,t,r-1),m=z6(p,t.offsetTree,l)+i+a,h=m+h6(t.sizeTree,p)[1],g=c+a,_=u({itemBottom:h,itemTop:m,locationParams:f,viewportBottom:c+n-s,viewportTop:g});return _===null?d?.():d&&z3(Q(o,U3(e=>!e),q3(L3(o)?1:2)),d),_}),U3(e=>e!==null)),l),{scrollIntoView:u}},N3(W6,u6,J6,p8,i6),{singleton:!0});function _8(e){return e===!1?!1:e===`smooth`?`smooth`:`auto`}var sge=(e,t)=>typeof e==`function`?_8(e(t)):t&&_8(e),cge=$3(([{listRefresh:e,totalCount:t,fixedItemSize:n,data:r},{atBottomState:i,isAtBottom:a},{scrollToIndex:o},{scrolledToInitialItem:s},{didMount:c,propsReady:l},{log:u},{scrollingInProgress:d},{context:f},{scrollIntoView:p}])=>{let m=$(!1),h=Z3(),g=null;function _(e){F3(o,{align:`end`,behavior:e,index:`LAST`})}P3(Q(e6(Q(t6(t),q3(1)),c),Y3(t6(m),a,s,d),W3(([[e,t],n,r,i,a])=>{let o=t&&i,s=`auto`;return o&&(s=sge(n,r||a),o&&=s!==!1),{followOutputBehavior:s,shouldFollow:o,totalCount:e}}),U3(({shouldFollow:e})=>e)),({followOutputBehavior:t,totalCount:r})=>{g!==null&&(g(),g=null),L3(n)===void 0?g=z3(e,()=>{L3(u)(`following output to `,{totalCount:r},r6.DEBUG),_(t),g=null}):requestAnimationFrame(()=>{L3(u)(`following output to `,{totalCount:r},r6.DEBUG),_(t)})});function v(e){let t=z3(i,t=>{e&&!t.atBottom&&t.notAtBottomBecause===`SIZE_INCREASED`&&g===null&&(L3(u)(`scrolling to bottom due to increased size`,{},r6.DEBUG),_(`auto`))});setTimeout(t,100)}P3(Q(e6(t6(m),t,l),U3(([e,,t])=>e!==!1&&t),K3(({value:e},[,t])=>({refreshed:e===t,value:t}),{refreshed:!1,value:0}),U3(({refreshed:e})=>e),Y3(m,t)),([,e])=>{L3(s)&&v(e!==!1)}),P3(h,()=>{v(L3(m)!==!1)}),P3(e6(t6(m),i),([e,t])=>{e!==!1&&!t.atBottom&&t.notAtBottomBecause===`VIEWPORT_HEIGHT_DECREASING`&&_(`auto`)});let y=$(null),b=Z3();return R3(n6(Q(t6(r),W3(e=>e?.length??0)),Q(t6(t))),b),P3(Q(e6(Q(b,q3(1)),c),Y3(t6(y),s,d,f),W3(([[e,t],n,r,i,a])=>t&&r&&n?.({context:a,totalCount:e,scrollingInProgress:i})),U3(e=>!!e),J3(0)),t=>{g!==null&&(g(),g=null),L3(n)===void 0?g=z3(e,()=>{L3(u)(`scrolling into view`,{}),F3(p,t),g=null}):requestAnimationFrame(()=>{L3(u)(`scrolling into view`,{}),F3(p,t)})}),{autoscrollToBottom:h,followOutput:m,scrollIntoViewOnChange:y}},N3(W6,t8,J6,Z6,K6,i6,u6,h8,g8)),lge=$3(([{data:e,firstItemIndex:t,gap:n,sizes:r},{initialTopMostItemIndex:i},{initialItemCount:a,listState:o},{didMount:s}])=>(R3(Q(s,Y3(a),U3(([,e])=>e!==0),Y3(i,r,t,n,e),W3(([[,e],t,n,r,i,a=[]])=>u8(e,t,n,r,i,a))),o),{}),N3(W6,Z6,p8,K6),{singleton:!0}),uge=$3(([{didMount:e},{scrollTo:t},{listState:n}])=>{let r=$(0);return P3(Q(e,Y3(r),U3(([,e])=>e!==0),W3(([,e])=>({top:e}))),e=>{z3(Q(n,q3(1),U3(e=>e.items.length>1)),()=>{requestAnimationFrame(()=>{F3(t,e)})})}),{initialScrollTop:r}},N3(K6,u6,p8),{singleton:!0}),v8=$3(([{scrollVelocity:e}])=>{let t=$(!1),n=Z3(),r=$(!1);return R3(Q(e,Y3(r,t,n),U3(([e,t])=>t!==!1&&t!==void 0),W3(([e,t,n,r])=>{let{enter:i,exit:a}=t;if(n){if(a(e,r))return!1}else if(i(e,r))return!0;return n}),H3()),t),P3(Q(e6(t,e,n),Y3(r)),([[e,t,n],r])=>{e&&r!==!1&&r!==void 0&&r.change&&r.change(t,n)}),{isSeeking:t,scrollSeekConfiguration:r,scrollSeekRangeChanged:n,scrollVelocity:e}},N3(t8),{singleton:!0}),y8=$3(([{scrollContainerState:e,scrollTo:t}])=>{let n=Z3(),r=Z3(),i=Z3(),a=$(!1),o=$(void 0);return R3(Q(e6(n,r),W3(([{scrollTop:e,viewportHeight:t},{offsetTop:n,listHeight:r}])=>({scrollHeight:r,scrollTop:Math.max(0,e-n),viewportHeight:t}))),e),R3(Q(t,Y3(r),W3(([e,{offsetTop:t}])=>({...e,top:e.top+t}))),i),{customScrollParent:o,useWindowScroll:a,windowScrollContainerState:n,windowScrollTo:i,windowViewportRect:r}},N3(u6)),dge=$3(([{sizeRanges:e,sizes:t},{headerHeight:n,scrollTop:r},{initialTopMostItemIndex:i},{didMount:a},{useWindowScroll:o,windowScrollContainerState:s,windowViewportRect:c}])=>{let l=Z3(),u=$(void 0),d=$(null),f=$(null);return R3(s,d),R3(c,f),P3(Q(l,Y3(t,r,o,d,f,n)),([e,t,n,r,i,a,o])=>{let s=Jhe(t.sizeTree);r&&i!==null&&a!==null&&(n=i.scrollTop-a.offsetTop),n-=o,e({ranges:s,scrollTop:n})}),R3(Q(u,U3(A3),W3(fge)),i),R3(Q(a,Y3(u),U3(([,e])=>e!==void 0),H3(),W3(([,e])=>e.ranges)),e),{getState:l,restoreStateFrom:u}},N3(W6,u6,Z6,K6,y8));function fge(e){return{align:`start`,index:0,offset:e.scrollTop}}var pge=$3(([{topItemsIndexes:e}])=>{let t=$(0);return R3(Q(t,U3(e=>e>=0),W3(e=>Array.from({length:e}).map((e,t)=>t))),e),{topItemCount:t}},N3(p8));function b8(e){let t=!1,n;return(()=>(t||(t=!0,n=e()),n))}var mge=b8(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),x8=$3(([{data:e,defaultItemSize:t,firstItemIndex:n,fixedItemSize:r,fixedGroupSize:i,gap:a,groupIndices:o,heightEstimates:s,itemSize:c,sizeRanges:l,sizes:u,statefulTotalCount:d,totalCount:f,trackItemSizes:p},{initialItemFinalLocationReached:m,initialTopMostItemIndex:h,scrolledToInitialItem:g},_,v,y,b,{scrollToIndex:x},S,{topItemCount:C},{groupCounts:w},T])=>{let{listState:E,minOverscanItemCount:D,topItemsIndexes:O,rangeChanged:k,...A}=b;return R3(k,T.scrollSeekRangeChanged),R3(Q(T.windowViewportRect,W3(e=>e.visibleHeight)),_.viewportHeight),{data:e,defaultItemHeight:t,firstItemIndex:n,fixedItemHeight:r,fixedGroupHeight:i,gap:a,groupCounts:w,heightEstimates:s,initialItemFinalLocationReached:m,initialTopMostItemIndex:h,scrolledToInitialItem:g,sizeRanges:l,topItemCount:C,topItemsIndexes:O,totalCount:f,...y,groupIndices:o,itemSize:c,listState:E,minOverscanItemCount:D,scrollToIndex:x,statefulTotalCount:d,trackItemSizes:p,rangeChanged:k,...A,...T,..._,sizes:u,...v}},N3(W6,Z6,u6,dge,cge,p8,J6,$3(([{deviation:e,scrollBy:t,scrollingInProgress:n,scrollTop:r},{isAtBottom:i,isScrolling:a,lastJumpDueToItemResize:o,scrollDirection:s},{listState:c},{beforeUnshiftWith:l,gap:u,shiftWithOffset:d,sizes:f},{log:p},{recalcInProgress:m}])=>{let h=Q3(Q(c,Y3(o),K3(([,e,t,n],[{bottom:r,items:i,offsetBottom:a,totalCount:o},s])=>{let c=r+a,l=0;return t===o&&e.length>0&&i.length>0&&(i[0].originalIndex===0&&e[0].originalIndex===0||(l=c-n,l!==0&&(l+=s))),[l,i,o,c]},[0,[],0,0]),U3(([e])=>e!==0),Y3(r,s,n,i,p,m),U3(([,e,t,n,,,r])=>!r&&!n&&e!==0&&t===$6),W3(([[e],,,,,t])=>(t(`Upward scrolling compensation`,{amount:e},r6.DEBUG),e))));function g(n){n>0?(F3(t,{behavior:`auto`,top:-n}),F3(e,0)):(F3(e,0),F3(t,{behavior:`auto`,top:-n}))}return P3(Q(h,Y3(e,a)),([t,n,r])=>{r&&mge()?F3(e,n-t):g(-t)}),P3(Q(e6(X3(a,!1),e,m),U3(([e,t,n])=>!e&&!n&&t!==0),W3(([e,t])=>t),J3(1)),g),R3(Q(d,W3(e=>({top:-e}))),t),P3(Q(l,Y3(f,u),W3(([e,{groupIndices:t,lastSize:n,sizeTree:r},i])=>{function a(e){return e*(n+i)}if(t.length===0)return a(e);let o=0,s=m6(r,0),c=0,l=0;for(;c<e;){c++,o+=s;let n=t.length===l+1?1/0:t[l+1]-t[l]-1;c+n>e&&(o-=s,n=e-c+1),c+=n,o+=a(n),l++}return o})),n=>{F3(e,n),requestAnimationFrame(()=>{F3(t,{top:n}),requestAnimationFrame(()=>{F3(e,0),F3(m,!1)})})}),{deviation:e}},N3(u6,t8,p8,W6,i6,N6)),pge,G6,$3(([e,t,n,r,i,a,o,s,c,l,u])=>({...e,...t,...n,...r,...i,...a,...o,...s,...c,...l,...u}),N3(s8,lge,K6,v8,m8,uge,age,y8,g8,i6,h8))));function hge(e,t){let n={},r={},i=0,a=e.length;for(;i<a;)r[e[i]]=1,i+=1;for(let e in t)Object.hasOwn(r,e)||(n[e]=t[e]);return n}var S8=typeof document<`u`?L.useLayoutEffect:L.useEffect;function C8(e,t,n){let r=Object.keys(t.required||{}),i=Object.keys(t.optional||{}),a=Object.keys(t.methods||{}),o=Object.keys(t.events||{}),s=L.createContext({});function c(e,n){e.propsReady!==void 0&&F3(e.propsReady,!1);for(let i of r){let r=e[t.required[i]];F3(r,n[i])}for(let r of i)if(r in n){let i=e[t.optional[r]];F3(i,n[r])}e.propsReady!==void 0&&F3(e.propsReady,!0)}function l(e){return a.reduce((n,r)=>(n[r]=n=>{let i=e[t.methods[r]];F3(i,n)},n),{})}function u(e){return o.reduce((n,r)=>(n[r]=Phe(e[t.events[r]]),n),{})}return{Component:L.forwardRef(function(t,a){let{children:d,...f}=t,[p]=L.useState(()=>M3(Ihe(e),e=>{c(e,f)})),[m]=L.useState(khe(u,p));S8(()=>{for(let e of o)e in f&&P3(m[e],f[e]);return()=>{Object.values(m).map(I3)}},[f,m,p]),S8(()=>{c(p,f)}),L.useImperativeHandle(a,Dhe(l(p)));let h=n;return(0,R.jsx)(s.Provider,{value:p,children:n===void 0?d:(0,R.jsx)(h,{...hge([...r,...i,...o],f),children:d})})}),useEmitter:(e,t)=>{let n=L.useContext(s)[e];S8(()=>P3(n,t),[t,n])},useEmitterValue:e=>{let t=L.useContext(s)[e],n=L.useCallback(e=>P3(t,e),[t]);return L.useSyncExternalStore(n,()=>L3(t),()=>L3(t))},usePublisher:e=>{let t=L.useContext(s);return L.useCallback(n=>{F3(t[e],n)},[t,e])}}}var w8=L.createContext(void 0),T8=L.createContext(void 0),E8=`-webkit-sticky`,D8=`sticky`,O8=b8(()=>{if(typeof document>`u`)return D8;let e=document.createElement(`div`);return e.style.position=E8,e.style.position===E8?E8:D8}),k8=typeof document<`u`?L.useLayoutEffect:L.useEffect;function A8(e){return`self`in e}function gge(e){return`body`in e}function j8(e,t,n,r=j3,i,a){let o=L.useRef(null),s=L.useRef(null),c=L.useRef(null),l=L.useCallback(n=>{let r,i,o,l=n.target;if(gge(l)||A8(l)){let e=A8(l)?l:l.defaultView;o=a===!0?e.scrollX:e.scrollY,r=a===!0?e.document.documentElement.scrollWidth:e.document.documentElement.scrollHeight,i=a===!0?e.innerWidth:e.innerHeight}else o=a===!0?l.scrollLeft:l.scrollTop,r=a===!0?l.scrollWidth:l.scrollHeight,i=a===!0?l.offsetWidth:l.offsetHeight;let u=()=>{e({scrollHeight:r,scrollTop:Math.max(o,0),viewportHeight:i})};n.suppressFlushSync===!0?u():Pa.flushSync(u),s.current!==null&&(o===s.current||o<=0||o===r-i)&&(s.current=null,t(!0),c.current&&=(clearTimeout(c.current),null))},[e,t,a]);L.useEffect(()=>{let e=i||o.current;return r(i||o.current),l({suppressFlushSync:!0,target:e}),e.addEventListener(`scroll`,l,{passive:!0}),()=>{r(null),e.removeEventListener(`scroll`,l)}},[o,l,n,r,i]);function u(n){let r=o.current;if(!r||(a===!0?`offsetWidth`in r&&r.offsetWidth===0:`offsetHeight`in r&&r.offsetHeight===0))return;let i=n.behavior===`smooth`,l,u,d;A8(r)?(u=Math.max(I6(r.document.documentElement,a===!0?`width`:`height`),a===!0?r.document.documentElement.scrollWidth:r.document.documentElement.scrollHeight),l=a===!0?r.innerWidth:r.innerHeight,d=a===!0?window.scrollX:window.scrollY):(u=r[a===!0?`scrollWidth`:`scrollHeight`],l=I6(r,a===!0?`width`:`height`),d=r[a===!0?`scrollLeft`:`scrollTop`]);let f=u-l;if(n.top=Math.ceil(Math.max(Math.min(f,n.top),0)),Q6(l,u)||n.top===d){e({scrollHeight:u,scrollTop:d,viewportHeight:l}),i&&t(!0);return}i?(s.current=n.top,c.current&&clearTimeout(c.current),c.current=setTimeout(()=>{c.current=null,s.current=null,t(!0)},1e3)):s.current=null,a===!0&&(n={...n.behavior===void 0?{}:{behavior:n.behavior},left:n.top}),r.scrollTo(n)}function d(e){a===!0&&(e={...e.behavior===void 0?{}:{behavior:e.behavior},...e.top===void 0?{}:{left:e.top}}),o.current.scrollBy(e)}return{scrollByCallback:d,scrollerRef:o,scrollToCallback:u}}function M8(e){return e}var _ge=$3(([e,t])=>({...e,...t}),N3(x8,$3(()=>{let e=$(e=>`Item ${e}`),t=$(e=>`Group ${e}`),n=$({}),r=$(M8),i=$(`div`),a=$(j3),o=(e,t=null)=>X3(Q(n,W3(t=>t[e]),H3()),t);return{components:n,computeItemKey:r,EmptyPlaceholder:o(`EmptyPlaceholder`),FooterComponent:o(`Footer`),GroupComponent:o(`Group`,`div`),groupContent:t,HeaderComponent:o(`Header`),HeaderFooterTag:i,ItemComponent:o(`Item`,`div`),itemContent:e,ListComponent:o(`List`,`div`),ScrollerComponent:o(`Scroller`,`div`),scrollerRef:a,ScrollSeekPlaceholder:o(`ScrollSeekPlaceholder`),TopItemListComponent:o(`TopItemList`)}}))),vge=({height:e})=>(0,R.jsx)(`div`,{style:{height:e}}),yge={overflowAnchor:`none`,position:O8(),zIndex:1},N8={overflowAnchor:`none`},bge={...N8,display:`inline-block`,height:`100%`},P8=L.memo(function({showTopList:e=!1}){let t=H8(`listState`),n=U8(`sizeRanges`),r=H8(`useWindowScroll`),i=H8(`customScrollParent`),a=U8(`windowScrollContainerState`),o=U8(`scrollContainerState`),s=i||r?a:o,c=H8(`itemContent`),l=H8(`context`),u=H8(`groupContent`),d=H8(`trackItemSizes`),f=H8(`itemSize`),p=H8(`log`),m=U8(`gap`),h=H8(`horizontalDirection`),{callbackRef:g}=s6(n,f,d,e?j3:s,p,m,i,h,H8(`skipAnimationFrameInResizeObserver`)),[_,v]=L.useState(0);V8(`deviation`,e=>{_!==e&&v(e)});let y=H8(`EmptyPlaceholder`),b=H8(`ScrollSeekPlaceholder`)??vge,x=H8(`ListComponent`),S=H8(`ItemComponent`),C=H8(`GroupComponent`),w=H8(`computeItemKey`),T=H8(`isSeeking`),E=H8(`groupIndices`).length>0,D=H8(`alignToBottom`),O=H8(`initialItemFinalLocationReached`),k=e?{}:{boxSizing:`border-box`,...h?{display:`inline-block`,height:`100%`,marginLeft:_===0?D?`auto`:0:_,paddingLeft:t.offsetTop,paddingRight:t.offsetBottom,whiteSpace:`nowrap`}:{marginTop:_===0?D?`auto`:0:_,paddingBottom:t.offsetBottom,paddingTop:t.offsetTop},...O?{}:{visibility:`hidden`}};return!e&&t.totalCount===0&&y!=null?(0,R.jsx)(y,{...L8(y,l)}):(0,R.jsx)(x,{...L8(x,l),"data-testid":e?`virtuoso-top-item-list`:`virtuoso-item-list`,ref:g,style:k,children:(e?t.topItems:t.items).map(e=>{let n=e.originalIndex,r=w(n+t.firstItemIndex,e.data,l);return T?(0,L.createElement)(b,{...L8(b,l),height:e.size,index:e.index,key:r,type:e.type||`item`,...e.type===`group`?{}:{groupIndex:e.groupIndex}}):e.type===`group`?(0,L.createElement)(C,{...L8(C,l),"data-index":n,"data-item-index":e.index,"data-known-size":e.size,key:r,style:yge},u(e.index,l)):(0,L.createElement)(S,{...L8(S,l),...R8(S,e.data),"data-index":n,"data-item-group-index":e.groupIndex,"data-item-index":e.index,"data-known-size":e.size,key:r,style:h?bge:N8},E?c(e.index,e.groupIndex,e.data,l):c(e.index,e.data,l))})})}),xge={height:`100%`,outline:`none`,overflowY:`auto`,position:`relative`,WebkitOverflowScrolling:`touch`},Sge={outline:`none`,overflowX:`auto`,position:`relative`},F8=e=>({height:`100%`,position:`absolute`,top:0,width:`100%`,...e?{display:`flex`,flexDirection:`column`}:void 0}),I8=(e,t,n=0)=>({...F8(e),position:t?`relative`:`absolute`,top:t?-n:0}),Cge={position:O8(),top:0,width:`100%`,zIndex:1};function L8(e,t){if(typeof e!=`string`)return{context:t}}function R8(e,t){return{item:typeof e==`string`?void 0:t}}var wge=L.memo(function(){let e=H8(`HeaderComponent`),t=U8(`headerHeight`),n=H8(`HeaderFooterTag`),r=a6(L.useMemo(()=>e=>{t(I6(e,`height`))},[t]),!0,H8(`skipAnimationFrameInResizeObserver`)),i=H8(`context`);return e==null?null:(0,R.jsx)(n,{ref:r,children:(0,R.jsx)(e,{...L8(e,i)})})}),Tge=L.memo(function(){let e=H8(`FooterComponent`),t=U8(`footerHeight`),n=H8(`HeaderFooterTag`),r=a6(L.useMemo(()=>e=>{t(I6(e,`height`))},[t]),!0,H8(`skipAnimationFrameInResizeObserver`)),i=H8(`context`);return e==null?null:(0,R.jsx)(n,{ref:r,children:(0,R.jsx)(e,{...L8(e,i)})})});function z8({useEmitter:e,useEmitterValue:t,usePublisher:n}){return L.memo(function({children:r,style:i,context:a,...o}){let s=n(`scrollContainerState`),c=t(`ScrollerComponent`),l=n(`smoothScrollTargetReached`),u=t(`scrollerRef`),d=t(`horizontalDirection`)||!1,{scrollByCallback:f,scrollerRef:p,scrollToCallback:m}=j8(s,l,c,u,void 0,d);return e(`scrollTo`,m),e(`scrollBy`,f),(0,R.jsx)(c,{"data-testid":`virtuoso-scroller`,"data-virtuoso-scroller":!0,ref:p,style:{...d?Sge:xge,...i},tabIndex:0,...o,...L8(c,a),children:r})})}function B8({useEmitter:e,useEmitterValue:t,usePublisher:n}){return L.memo(function({children:r,style:i,context:a,...o}){let s=n(`windowScrollContainerState`),c=t(`ScrollerComponent`),l=n(`smoothScrollTargetReached`),u=t(`totalListHeight`),d=t(`deviation`),f=t(`customScrollParent`),p=L.useRef(null),{scrollByCallback:m,scrollerRef:h,scrollToCallback:g}=j8(s,l,c,t(`scrollerRef`),f);return k8(()=>(h.current=f||p.current?.ownerDocument.defaultView,()=>{h.current=null}),[h,f]),e(`windowScrollTo`,g),e(`scrollBy`,m),(0,R.jsx)(c,{ref:p,"data-virtuoso-scroller":!0,style:{position:`relative`,...i,...u===0?void 0:{height:u+d}},...o,...L8(c,a),children:r})})}var Ege=({children:e})=>{let t=L.useContext(w8),n=U8(`viewportHeight`),r=U8(`fixedItemHeight`),i=H8(`alignToBottom`),a=H8(`horizontalDirection`),o=a6(L.useMemo(()=>k3(n,e=>I6(e,a?`width`:`height`)),[n,a]),!0,H8(`skipAnimationFrameInResizeObserver`));return L.useEffect(()=>{t&&(n(t.viewportHeight),r(t.itemHeight))},[t,n,r]),(0,R.jsx)(`div`,{"data-viewport-type":`element`,ref:o,style:F8(i),children:e})},Dge=({children:e})=>{let t=L.useContext(w8),n=U8(`windowViewportRect`),r=U8(`fixedItemHeight`),i=H8(`customScrollParent`),a=H8(`useWindowScroll`),o=H8(`topListHeight`),s=l6(n,i,H8(`skipAnimationFrameInResizeObserver`)),c=H8(`alignToBottom`);return L.useEffect(()=>{t&&(r(t.itemHeight),n({listHeight:0,offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:100}))},[t,n,r]),(0,R.jsx)(`div`,{"data-viewport-type":`window`,ref:s,style:I8(c,a,o),children:e})},Oge=({children:e})=>{let t=H8(`TopItemListComponent`)??`div`,n=H8(`headerHeight`);return(0,R.jsx)(t,{style:{...Cge,marginTop:`${n}px`},...L8(t,H8(`context`)),children:e})},{Component:kge,useEmitter:V8,useEmitterValue:H8,usePublisher:U8}=C8(_ge,{optional:{restoreStateFrom:`restoreStateFrom`,context:`context`,followOutput:`followOutput`,scrollIntoViewOnChange:`scrollIntoViewOnChange`,itemContent:`itemContent`,groupContent:`groupContent`,overscan:`overscan`,increaseViewportBy:`increaseViewportBy`,minOverscanItemCount:`minOverscanItemCount`,totalCount:`totalCount`,groupCounts:`groupCounts`,topItemCount:`topItemCount`,firstItemIndex:`firstItemIndex`,initialTopMostItemIndex:`initialTopMostItemIndex`,components:`components`,atBottomThreshold:`atBottomThreshold`,atTopThreshold:`atTopThreshold`,computeItemKey:`computeItemKey`,defaultItemHeight:`defaultItemHeight`,fixedGroupHeight:`fixedGroupHeight`,fixedItemHeight:`fixedItemHeight`,heightEstimates:`heightEstimates`,itemSize:`itemSize`,scrollSeekConfiguration:`scrollSeekConfiguration`,headerFooterTag:`HeaderFooterTag`,data:`data`,initialItemCount:`initialItemCount`,initialScrollTop:`initialScrollTop`,alignToBottom:`alignToBottom`,useWindowScroll:`useWindowScroll`,customScrollParent:`customScrollParent`,scrollerRef:`scrollerRef`,logLevel:`logLevel`,horizontalDirection:`horizontalDirection`,skipAnimationFrameInResizeObserver:`skipAnimationFrameInResizeObserver`},methods:{scrollToIndex:`scrollToIndex`,scrollIntoView:`scrollIntoView`,scrollTo:`scrollTo`,scrollBy:`scrollBy`,autoscrollToBottom:`autoscrollToBottom`,getState:`getState`},events:{isScrolling:`isScrolling`,endReached:`endReached`,startReached:`startReached`,rangeChanged:`rangeChanged`,atBottomStateChange:`atBottomStateChange`,atTopStateChange:`atTopStateChange`,totalListHeightChanged:`totalListHeightChanged`,itemsRendered:`itemsRendered`,groupIndices:`groupIndices`}},L.memo(function(e){let t=H8(`useWindowScroll`),n=H8(`topItemsIndexes`).length>0,r=H8(`customScrollParent`),i=H8(`context`);return(0,R.jsxs)(r||t?jge:Age,{...e,context:i,children:[n&&(0,R.jsx)(Oge,{children:(0,R.jsx)(P8,{showTopList:!0})}),(0,R.jsxs)(r||t?Dge:Ege,{children:[(0,R.jsx)(wge,{}),(0,R.jsx)(P8,{}),(0,R.jsx)(Tge,{})]})]})})),Age=z8({useEmitter:V8,useEmitterValue:H8,usePublisher:U8}),jge=B8({useEmitter:V8,useEmitterValue:H8,usePublisher:U8}),Mge=kge,Nge=$3(([e,t])=>({...e,...t}),N3(x8,$3(()=>{let e=$(e=>(0,R.jsxs)(`td`,{children:[`Item $`,e]})),t=$(null),n=$(e=>(0,R.jsxs)(`td`,{colSpan:1e3,children:[`Group `,e]})),r=$(null),i=$(null),a=$({}),o=$(M8),s=$(j3),c=(e,t=null)=>X3(Q(a,W3(t=>t[e]),H3()),t);return{components:a,computeItemKey:o,context:t,EmptyPlaceholder:c(`EmptyPlaceholder`),FillerRow:c(`FillerRow`),fixedFooterContent:i,fixedHeaderContent:r,itemContent:e,groupContent:n,ScrollerComponent:c(`Scroller`,`div`),scrollerRef:s,ScrollSeekPlaceholder:c(`ScrollSeekPlaceholder`),TableBodyComponent:c(`TableBody`,`tbody`),TableComponent:c(`Table`,`table`),TableFooterComponent:c(`TableFoot`,`tfoot`),TableHeadComponent:c(`TableHead`,`thead`),TableRowComponent:c(`TableRow`,`tr`),GroupComponent:c(`Group`,`tr`)}}))),Pge=({height:e})=>(0,R.jsx)(`tr`,{children:(0,R.jsx)(`td`,{style:{height:e}})}),Fge=({height:e})=>(0,R.jsx)(`tr`,{children:(0,R.jsx)(`td`,{style:{border:0,height:e,padding:0}})}),Ige={overflowAnchor:`none`},W8={position:O8(),zIndex:2,overflowAnchor:`none`},G8=L.memo(function({showTopList:e=!1}){let t=q8(`listState`),n=q8(`computeItemKey`),r=q8(`firstItemIndex`),i=q8(`context`),a=q8(`isSeeking`),o=q8(`fixedHeaderHeight`),s=q8(`groupIndices`).length>0,c=q8(`itemContent`),l=q8(`groupContent`),u=q8(`ScrollSeekPlaceholder`)??Pge,d=q8(`GroupComponent`),f=q8(`TableRowComponent`),p=(e?t.topItems:[]).reduce((e,t,n)=>(n===0?e.push(t.size):e.push(e[n-1]+t.size),e),[]);return(e?t.topItems:t.items).map(t=>{let m=t.originalIndex,h=n(m+r,t.data,i),g=e?m===0?0:p[m-1]:0;return a?(0,L.createElement)(u,{...L8(u,i),height:t.size,index:t.index,key:h,type:t.type||`item`}):t.type===`group`?(0,L.createElement)(d,{...L8(d,i),"data-index":m,"data-item-index":t.index,"data-known-size":t.size,key:h,style:{...W8,top:o}},l(t.index,i)):(0,L.createElement)(f,{...L8(f,i),...R8(f,t.data),"data-index":m,"data-item-index":t.index,"data-known-size":t.size,"data-item-group-index":t.groupIndex,key:h,style:e?{...W8,top:o+g}:Ige},s?c(t.index,t.groupIndex,t.data,i):c(t.index,t.data,i))})}),Lge=L.memo(function(){let e=q8(`listState`),t=q8(`topItemsIndexes`).length>0,n=J8(`sizeRanges`),r=q8(`useWindowScroll`),i=q8(`customScrollParent`),a=J8(`windowScrollContainerState`),o=J8(`scrollContainerState`),s=i||r?a:o,c=q8(`trackItemSizes`),{callbackRef:l,ref:u}=s6(n,q8(`itemSize`),c,s,q8(`log`),void 0,i,!1,q8(`skipAnimationFrameInResizeObserver`)),[d,f]=L.useState(0);K8(`deviation`,e=>{d!==e&&(u.current.style.marginTop=`${e}px`,f(e))});let p=q8(`EmptyPlaceholder`),m=q8(`FillerRow`)??Fge,h=q8(`TableBodyComponent`),g=q8(`paddingTopAddition`),_=q8(`statefulTotalCount`),v=q8(`context`);if(_===0&&p!=null)return(0,R.jsx)(p,{...L8(p,v)});let y=(t?e.topItems:[]).reduce((e,t)=>e+t.size,0),b=e.offsetTop+g+d-y,x=e.offsetBottom,S=b>0?(0,R.jsx)(m,{context:v,height:b},`padding-top`):null,C=x>0?(0,R.jsx)(m,{context:v,height:x},`padding-bottom`):null;return(0,R.jsxs)(h,{"data-testid":`virtuoso-item-list`,ref:l,...L8(h,v),children:[S,t&&(0,R.jsx)(G8,{showTopList:!0}),(0,R.jsx)(G8,{}),C]})}),Rge=({children:e})=>{let t=L.useContext(w8),n=J8(`viewportHeight`),r=J8(`fixedItemHeight`),i=a6(L.useMemo(()=>k3(n,e=>I6(e,`height`)),[n]),!0,q8(`skipAnimationFrameInResizeObserver`));return L.useEffect(()=>{t&&(n(t.viewportHeight),r(t.itemHeight))},[t,n,r]),(0,R.jsx)(`div`,{"data-viewport-type":`element`,ref:i,style:F8(!1),children:e})},zge=({children:e})=>{let t=L.useContext(w8),n=J8(`windowViewportRect`),r=J8(`fixedItemHeight`),i=q8(`customScrollParent`),a=q8(`useWindowScroll`),o=l6(n,i,q8(`skipAnimationFrameInResizeObserver`));return L.useEffect(()=>{t&&(r(t.itemHeight),n({listHeight:0,offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:100}))},[t,n,r]),(0,R.jsx)(`div`,{"data-viewport-type":`window`,ref:o,style:I8(!1,a),children:e})},{Component:Bge,useEmitter:K8,useEmitterValue:q8,usePublisher:J8}=C8(Nge,{optional:{restoreStateFrom:`restoreStateFrom`,context:`context`,followOutput:`followOutput`,firstItemIndex:`firstItemIndex`,itemContent:`itemContent`,groupContent:`groupContent`,fixedHeaderContent:`fixedHeaderContent`,fixedFooterContent:`fixedFooterContent`,overscan:`overscan`,increaseViewportBy:`increaseViewportBy`,minOverscanItemCount:`minOverscanItemCount`,totalCount:`totalCount`,topItemCount:`topItemCount`,initialTopMostItemIndex:`initialTopMostItemIndex`,components:`components`,groupCounts:`groupCounts`,atBottomThreshold:`atBottomThreshold`,atTopThreshold:`atTopThreshold`,computeItemKey:`computeItemKey`,defaultItemHeight:`defaultItemHeight`,fixedGroupHeight:`fixedGroupHeight`,fixedItemHeight:`fixedItemHeight`,itemSize:`itemSize`,scrollSeekConfiguration:`scrollSeekConfiguration`,data:`data`,initialItemCount:`initialItemCount`,initialScrollTop:`initialScrollTop`,alignToBottom:`alignToBottom`,useWindowScroll:`useWindowScroll`,customScrollParent:`customScrollParent`,scrollerRef:`scrollerRef`,logLevel:`logLevel`},methods:{scrollToIndex:`scrollToIndex`,scrollIntoView:`scrollIntoView`,scrollTo:`scrollTo`,scrollBy:`scrollBy`,getState:`getState`},events:{isScrolling:`isScrolling`,endReached:`endReached`,startReached:`startReached`,rangeChanged:`rangeChanged`,atBottomStateChange:`atBottomStateChange`,atTopStateChange:`atTopStateChange`,totalListHeightChanged:`totalListHeightChanged`,itemsRendered:`itemsRendered`,groupIndices:`groupIndices`}},L.memo(function(e){let t=q8(`useWindowScroll`),n=q8(`customScrollParent`),r=J8(`fixedHeaderHeight`),i=J8(`fixedFooterHeight`),a=q8(`fixedHeaderContent`),o=q8(`fixedFooterContent`),s=q8(`context`),c=a6(L.useMemo(()=>k3(r,e=>I6(e,`height`)),[r]),!0,q8(`skipAnimationFrameInResizeObserver`)),l=a6(L.useMemo(()=>k3(i,e=>I6(e,`height`)),[i]),!0,q8(`skipAnimationFrameInResizeObserver`)),u=n||t?Hge:Vge,d=n||t?zge:Rge,f=q8(`TableComponent`),p=q8(`TableHeadComponent`),m=q8(`TableFooterComponent`),h=a?(0,R.jsx)(p,{ref:c,style:{position:`sticky`,top:0,zIndex:2},...L8(p,s),children:a()},`TableHead`):null,g=o?(0,R.jsx)(m,{ref:l,style:{bottom:0,position:`sticky`,zIndex:1},...L8(m,s),children:o()},`TableFoot`):null;return(0,R.jsx)(u,{...e,...L8(u,s),children:(0,R.jsx)(d,{children:(0,R.jsxs)(f,{style:{borderSpacing:0,overflowAnchor:`none`},...L8(f,s),children:[h,(0,R.jsx)(Lge,{},`TableBody`),g]})})})})),Vge=z8({useEmitter:K8,useEmitterValue:q8,usePublisher:J8}),Hge=B8({useEmitter:K8,useEmitterValue:q8,usePublisher:J8}),Y8={bottom:0,itemHeight:0,items:[],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},Uge={bottom:0,itemHeight:0,items:[{index:0}],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},{ceil:X8,floor:Z8,max:Q8,min:$8,round:e5}=Math;function t5(e,t,n){return Array.from({length:t-e+1}).map((t,r)=>({data:n===null?null:n[r+e],index:r+e}))}function Wge(e){return{...Uge,items:e}}function n5(e,t){return e!==void 0&&e.width===t.width&&e.height===t.height}function Gge(e,t){return e!==void 0&&e.column===t.column&&e.row===t.row}var Kge=$3(([{increaseViewportBy:e,listBoundary:t,overscan:n,visibleRange:r},{footerHeight:i,headerHeight:a,scrollBy:o,scrollContainerState:s,scrollTo:c,scrollTop:l,smoothScrollTargetReached:u,viewportHeight:d},f,p,{didMount:m,propsReady:h},{customScrollParent:g,useWindowScroll:_,windowScrollContainerState:v,windowScrollTo:y,windowViewportRect:b},x])=>{let S=$(0),C=$(0),w=$(Y8),T=$({height:0,width:0}),E=$({height:0,width:0}),D=Z3(),O=Z3(),k=$(0),A=$(null),j=$({column:0,row:0}),M=Z3(),N=Z3(),P=$(!1),ee=$(0),te=$(!0),ne=$(!1),F=$(!1);P3(Q(m,Y3(ee),U3(([e,t])=>t!==0)),()=>{F3(te,!1)}),P3(Q(e6(m,te,E,T,ee,ne),U3(([e,t,n,r,,i])=>e&&!t&&n.height!==0&&r.height!==0&&!i)),([,,,,e])=>{F3(ne,!0),Y6(1,()=>{F3(D,e)}),z3(Q(l),()=>{F3(t,[0,0]),F3(te,!0)})}),R3(Q(N,U3(e=>e!=null&&e.scrollTop>0),G3(0)),C),P3(Q(m,Y3(N),U3(([,e])=>e!=null)),([,e])=>{e&&(F3(T,e.viewport),F3(E,e.item),F3(j,e.gap),e.scrollTop>0&&(F3(P,!0),z3(Q(l,q3(1)),e=>{F3(P,!1)}),F3(c,{top:e.scrollTop})))}),R3(Q(T,W3(({height:e})=>e)),d),R3(Q(e6(t6(T,n5),t6(E,n5),t6(j,(e,t)=>e!==void 0&&e.column===t.column&&e.row===t.row),t6(l)),W3(([e,t,n,r])=>({gap:n,item:t,scrollTop:r,viewport:e}))),M),R3(Q(e6(t6(S),r,t6(j,Gge),t6(E,n5),t6(T,n5),t6(A),t6(C),t6(P),t6(te),t6(ee)),U3(([,,,,,,,e])=>!e),W3(([e,[t,n],r,i,a,o,s,,c,l])=>{let{column:u,row:d}=r,{height:f,width:p}=i,{width:m}=a;if(s===0&&(e===0||m===0))return Y8;if(p===0){let t=X6(l,e);return Wge(t5(t,t+Math.max(s-1,0),o))}let h=r5(m,p,u),g,_;c?t===0&&n===0&&s>0?(g=0,_=s-1):(g=h*Z8((t+d)/(f+d)),_=h*X8((n+d)/(f+d))-1,_=$8(e-1,Q8(_,h-1)),g=$8(_,Q8(0,g))):(g=0,_=-1);let v=t5(g,_,o),{bottom:y,top:b}=i5(a,r,i,v),x=X8(e/h);return{bottom:y,itemHeight:f,items:v,itemWidth:p,offsetBottom:x*f+(x-1)*d-y,offsetTop:b,top:b}})),w),R3(Q(A,U3(e=>e!==null),W3(e=>e.length)),S),R3(Q(e6(T,E,w,j),U3(([e,t,{items:n}])=>n.length>0&&t.height!==0&&e.height!==0),W3(([e,t,{items:n},r])=>{let{bottom:i,top:a}=i5(e,r,t,n);return[a,i]}),H3(M6)),t);let re=$(!1);R3(Q(l,Y3(re),W3(([e,t])=>t||e!==0)),re);let I=Q3(Q(e6(w,S),U3(([{items:e}])=>e.length>0),Y3(re),U3(([[e,t],n])=>{let r=e.items[e.items.length-1].index===t-1;return(n||e.bottom>0&&e.itemHeight>0&&e.offsetBottom===0&&e.items.length===t)&&r}),W3(([[,e]])=>e-1),H3())),ie=Q3(Q(t6(w),U3(({items:e})=>e.length>0&&e[0].index===0),G3(0),H3())),ae=Q3(Q(t6(w),Y3(P),U3(([{items:e},t])=>e.length>0&&!t),W3(([{items:e}])=>({endIndex:e[e.length-1].index,startIndex:e[0].index})),H3(j6),J3(0)));R3(ae,p.scrollSeekRangeChanged),R3(Q(D,Y3(T,E,S,j),W3(([e,t,n,r,i])=>{let a=q6(e),{align:o,behavior:s,offset:c}=a,l=a.index;l===`LAST`&&(l=r-1),l=Q8(0,l,$8(r-1,l));let u=a5(t,i,n,l);return o===`end`?u=e5(u-t.height+n.height):o===`center`&&(u=e5(u-t.height/2+n.height/2)),c!==void 0&&c!==0&&(u+=c),{behavior:s,top:u}})),c);let oe=X3(Q(w,W3(e=>e.offsetBottom+e.bottom)),0);return R3(Q(b,W3(e=>({height:e.visibleHeight,width:e.visibleWidth}))),T),{customScrollParent:g,data:A,deviation:k,footerHeight:i,gap:j,headerHeight:a,increaseViewportBy:e,initialItemCount:C,itemDimensions:E,overscan:n,restoreStateFrom:N,scrollBy:o,scrollContainerState:s,scrollHeight:O,scrollTo:c,scrollToIndex:D,scrollTop:l,smoothScrollTargetReached:u,totalCount:S,useWindowScroll:_,viewportDimensions:T,windowScrollContainerState:v,windowScrollTo:y,windowViewportRect:b,...p,gridState:w,horizontalDirection:F,initialTopMostItemIndex:ee,totalListHeight:oe,...f,endReached:I,propsReady:h,rangeChanged:ae,startReached:ie,stateChanged:M,stateRestoreInProgress:P,...x}},N3(s8,u6,t8,v8,K6,y8,i6));function r5(e,t,n){return Q8(1,Z8((e+n)/(Z8(t)+n)))}function i5(e,t,n,r){let{height:i}=n;if(i===void 0||r.length===0)return{bottom:0,top:0};let a=a5(e,t,n,r[0].index);return{bottom:a5(e,t,n,r[r.length-1].index)+i,top:a}}function a5(e,t,n,r){let i=Z8(r/r5(e.width,n.width,t.column)),a=i*n.height+Q8(0,i-1)*t.row;return a>0?a+t.row:a}var qge=$3(([e,t])=>({...e,...t}),N3(Kge,$3(()=>{let e=$(e=>`Item ${e}`),t=$({}),n=$(null),r=$(`virtuoso-grid-item`),i=$(`virtuoso-grid-list`),a=$(M8),o=$(`div`),s=$(j3),c=(e,n=null)=>X3(Q(t,W3(t=>t[e]),H3()),n),l=$(!1),u=$(!1);return R3(t6(u),l),{components:t,computeItemKey:a,context:n,FooterComponent:c(`Footer`),HeaderComponent:c(`Header`),headerFooterTag:o,itemClassName:r,ItemComponent:c(`Item`,`div`),itemContent:e,listClassName:i,ListComponent:c(`List`,`div`),readyStateChanged:l,reportReadyState:u,ScrollerComponent:c(`Scroller`,`div`),scrollerRef:s,ScrollSeekPlaceholder:c(`ScrollSeekPlaceholder`,`div`)}}))),Jge=L.memo(function(){let e=s5(`gridState`),t=s5(`listClassName`),n=s5(`itemClassName`),r=s5(`itemContent`),i=s5(`computeItemKey`),a=s5(`isSeeking`),o=c5(`scrollHeight`),s=s5(`ItemComponent`),c=s5(`ListComponent`),l=s5(`ScrollSeekPlaceholder`),u=s5(`context`),d=c5(`itemDimensions`),f=c5(`gap`),p=s5(`log`),m=s5(`stateRestoreInProgress`),h=c5(`reportReadyState`),g=a6(L.useMemo(()=>e=>{let t=e.parentElement.parentElement.scrollHeight;o(t);let n=e.firstChild;if(n!==null){let{height:e,width:t}=n.getBoundingClientRect();d({height:e,width:t})}f({column:l5(`column-gap`,getComputedStyle(e).columnGap,p),row:l5(`row-gap`,getComputedStyle(e).rowGap,p)})},[o,d,f,p]),!0,!1);return k8(()=>{e.itemHeight>0&&e.itemWidth>0&&h(!0)},[e]),m?null:(0,R.jsx)(c,{className:t,ref:g,...L8(c,u),"data-testid":`virtuoso-item-list`,style:{paddingBottom:e.offsetBottom,paddingTop:e.offsetTop},children:e.items.map(t=>{let o=i(t.index,t.data,u);return a?(0,R.jsx)(l,{...L8(l,u),height:e.itemHeight,index:t.index,width:e.itemWidth},o):(0,L.createElement)(s,{...L8(s,u),className:n,"data-index":t.index,key:o},r(t.index,t.data,u))})})}),Yge=L.memo(function(){let e=s5(`HeaderComponent`),t=c5(`headerHeight`),n=s5(`headerFooterTag`),r=a6(L.useMemo(()=>e=>{t(I6(e,`height`))},[t]),!0,!1),i=s5(`context`);return e==null?null:(0,R.jsx)(n,{ref:r,children:(0,R.jsx)(e,{...L8(e,i)})})}),Xge=L.memo(function(){let e=s5(`FooterComponent`),t=c5(`footerHeight`),n=s5(`headerFooterTag`),r=a6(L.useMemo(()=>e=>{t(I6(e,`height`))},[t]),!0,!1),i=s5(`context`);return e==null?null:(0,R.jsx)(n,{ref:r,children:(0,R.jsx)(e,{...L8(e,i)})})}),Zge=({children:e})=>{let t=L.useContext(T8),n=c5(`itemDimensions`),r=c5(`viewportDimensions`),i=a6(L.useMemo(()=>e=>{r(e.getBoundingClientRect())},[r]),!0,!1);return L.useEffect(()=>{t&&(r({height:t.viewportHeight,width:t.viewportWidth}),n({height:t.itemHeight,width:t.itemWidth}))},[t,r,n]),(0,R.jsx)(`div`,{ref:i,style:F8(!1),children:e})},Qge=({children:e})=>{let t=L.useContext(T8),n=c5(`windowViewportRect`),r=c5(`itemDimensions`),i=s5(`customScrollParent`),a=s5(`useWindowScroll`),o=l6(n,i,!1);return L.useEffect(()=>{t&&(r({height:t.itemHeight,width:t.itemWidth}),n({listHeight:0,offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:t.viewportWidth}))},[t,n,r]),(0,R.jsx)(`div`,{ref:o,style:I8(!1,a),children:e})},{Component:$ge,useEmitter:o5,useEmitterValue:s5,usePublisher:c5}=C8(qge,{optional:{context:`context`,totalCount:`totalCount`,overscan:`overscan`,itemContent:`itemContent`,components:`components`,computeItemKey:`computeItemKey`,data:`data`,initialItemCount:`initialItemCount`,scrollSeekConfiguration:`scrollSeekConfiguration`,headerFooterTag:`headerFooterTag`,listClassName:`listClassName`,itemClassName:`itemClassName`,useWindowScroll:`useWindowScroll`,customScrollParent:`customScrollParent`,scrollerRef:`scrollerRef`,logLevel:`logLevel`,restoreStateFrom:`restoreStateFrom`,initialTopMostItemIndex:`initialTopMostItemIndex`,increaseViewportBy:`increaseViewportBy`},methods:{scrollTo:`scrollTo`,scrollBy:`scrollBy`,scrollToIndex:`scrollToIndex`},events:{isScrolling:`isScrolling`,endReached:`endReached`,startReached:`startReached`,rangeChanged:`rangeChanged`,atBottomStateChange:`atBottomStateChange`,atTopStateChange:`atTopStateChange`,stateChanged:`stateChanged`,readyStateChanged:`readyStateChanged`}},L.memo(function({...e}){let t=s5(`useWindowScroll`),n=s5(`customScrollParent`),r=n||t?t_e:e_e,i=n||t?Qge:Zge,a=s5(`context`);return(0,R.jsx)(r,{...e,...L8(r,a),children:(0,R.jsxs)(i,{children:[(0,R.jsx)(Yge,{}),(0,R.jsx)(Jge,{}),(0,R.jsx)(Xge,{})]})})})),e_e=z8({useEmitter:o5,useEmitterValue:s5,usePublisher:c5}),t_e=B8({useEmitter:o5,useEmitterValue:s5,usePublisher:c5});function l5(e,t,n){return t!==`normal`&&t?.endsWith(`px`)!==!0&&n(`${e} was not resolved to pixel value correctly`,t,r6.WARN),t===`normal`?0:parseInt(t??`0`,10)}var n_e=24,r_e=700,i_e=3;function a_e({itemCount:e,resetKey:t,contentKey:n,atBottomThreshold:r=n_e}){let i=(0,L.useRef)(null),a=(0,L.useRef)(e),o=(0,L.useRef)(!0),s=(0,L.useRef)(void 0),c=(0,L.useRef)(!1),l=(0,L.useRef)(void 0),u=(0,L.useRef)(void 0),[d,f]=(0,L.useState)(!0),[p,m]=(0,L.useState)(null);(0,L.useLayoutEffect)(()=>{a.current=e},[e]);let h=(0,L.useCallback)(e=>{o.current=e,f(e)},[]),g=(0,L.useCallback)(()=>{s.current!==void 0&&(cancelAnimationFrame(s.current),s.current=void 0)},[]),_=(0,L.useCallback)((e=`auto`)=>{g(),s.current=requestAnimationFrame(()=>{if(s.current=void 0,!o.current)return;let t=a.current-1;t<0||(i.current?.autoscrollToBottom(),i.current?.scrollToIndex({index:t,align:`end`,behavior:e}),requestAnimationFrame(()=>{o.current&&i.current?.autoscrollToBottom()}))})},[g]),v=(0,L.useCallback)((e=`auto`)=>{h(!0),_(e)},[_,h]),y=(0,L.useCallback)((e,t=`center`,n=`auto`,r={})=>{h(!1),g(),requestAnimationFrame(()=>{if(n!==`fast-smooth`){i.current?.scrollToIndex({index:e,align:t,behavior:n});return}if(r.stagingAlign){i.current?.scrollToIndex({index:e,align:r.stagingAlign,behavior:`auto`}),requestAnimationFrame(()=>{requestAnimationFrame(()=>{i.current?.scrollToIndex({index:e,align:t,behavior:`smooth`})})});return}let o=r.fromIndex,s=Math.abs(typeof o==`number`?o-e:0),c=r.stagingDistance??i_e;if(typeof o!=`number`||s<=c){i.current?.scrollToIndex({index:e,align:t,behavior:`smooth`});return}let l=a.current-1,u=e<o?Math.min(l,e+c):Math.max(0,e-c);i.current?.scrollToIndex({index:u,align:t,behavior:`auto`}),requestAnimationFrame(()=>{i.current?.scrollToIndex({index:e,align:t,behavior:`smooth`})})})},[g,h]),b=(0,L.useCallback)(e=>{c.current=!0;let t=e instanceof WheelEvent&&e.deltaY<0;t&&g(),(t||p&&!u5(p,r))&&h(!1),l.current!==void 0&&window.clearTimeout(l.current),l.current=window.setTimeout(()=>{c.current=!1,l.current=void 0},r_e)},[r,g,p,h]),x=(0,L.useCallback)(()=>{if(!p)return;let e=o_e(p),t=u.current;if(u.current=e,u5(p,r)){c.current||h(!0);return}let n=t!==void 0&&e<t-1;(c.current||n)&&h(!1)},[r,p,h]);return(0,L.useEffect)(()=>{if(!p)return;let e=p,t=e=>{let t=e instanceof KeyboardEvent?e.key:``;[`ArrowUp`,`ArrowDown`,`PageUp`,`PageDown`,`Home`,`End`,` `].includes(t)&&b()},n=t=>{t.target===e&&b()};return e.addEventListener(`wheel`,b,{passive:!0}),e.addEventListener(`touchmove`,b,{passive:!0}),e.addEventListener(`pointerdown`,n,{passive:!0}),e.addEventListener(`keydown`,t),e.addEventListener(`scroll`,x,{passive:!0}),()=>{e.removeEventListener(`wheel`,b),e.removeEventListener(`touchmove`,b),e.removeEventListener(`pointerdown`,n),e.removeEventListener(`keydown`,t),e.removeEventListener(`scroll`,x)}},[b,p,x]),(0,L.useLayoutEffect)(()=>{u.current=void 0,h(!0),_(`auto`)},[t,_,h]),(0,L.useLayoutEffect)(()=>{o.current&&_(`auto`)},[n,e,_]),(0,L.useEffect)(()=>()=>{g(),l.current!==void 0&&window.clearTimeout(l.current)},[g]),{virtuosoRef:i,isSticky:d,stickToBottom:v,scrollToIndex:y,scrollerRef:m,atBottomStateChange:(0,L.useCallback)(e=>{if(e){c.current||h(!0);return}c.current&&h(!1)},[h]),atBottomThreshold:r,followOutput:(0,L.useCallback)(()=>o.current?`auto`:!1,[]),totalListHeightChanged:(0,L.useCallback)(()=>{o.current&&_(`auto`)},[_])}}function u5(e,t){let n=e instanceof Window?document.scrollingElement:e;return n?n.scrollHeight-n.scrollTop-n.clientHeight<=t:!0}function o_e(e){return(e instanceof Window?document.scrollingElement:e)?.scrollTop??0}var d5={"agent.run":{color:`text-[#11a4d4]`,bgColor:`bg-[#11a4d4]/20`,borderColor:`border-[#11a4d4]`,label:`Agent Run`},"tool.call":{color:`text-purple-500`,bgColor:`bg-purple-500/20`,borderColor:`border-purple-500`,label:`Tool Call`},"tool.result":{color:`text-green-500`,bgColor:`bg-green-500/20`,borderColor:`border-green-500`,label:`Tool Result`},"model.request":{color:`text-blue-500`,bgColor:`bg-blue-500/20`,borderColor:`border-blue-500`,label:`Model Request`},"model.response":{color:`text-[#0bda57]`,bgColor:`bg-[#0bda57]/20`,borderColor:`border-[#0bda57]`,label:`Model Response`},"model.reasoning":{color:`text-amber-500`,bgColor:`bg-amber-500/20`,borderColor:`border-amber-500`,label:`Reasoning`},"agent.delegation":{color:`text-orange-500`,bgColor:`bg-orange-500/20`,borderColor:`border-orange-500`,label:`Agent Delegation`},"agent.async":{color:`text-orange-500`,bgColor:`bg-orange-500/20`,borderColor:`border-orange-500`,label:`Async Agent`},"yielded.run":{color:`text-[#11a4d4]`,bgColor:`bg-[#11a4d4]/20`,borderColor:`border-[#11a4d4]`,label:`Yielded Run`},"user.prompt":{color:`text-cyan-500`,bgColor:`bg-cyan-500/20`,borderColor:`border-cyan-500`,label:`User Prompt`},user_input:{color:`text-slate-500`,bgColor:`bg-slate-800`,borderColor:`border-slate-600`,label:`User Input`},"execution.command":{color:`text-yellow-500`,bgColor:`bg-yellow-500/20`,borderColor:`border-yellow-500`,label:`Command`}},f5=12;function p5(e,t){return t===`all`||e<t}(0,L.memo)(function e({span:t,startTime:n,depth:r=0,expansionDepth:i,expansionSignal:a,expandThinking:o,onFork:s,onOpenSession:c}){let[l,u]=(0,L.useState)(()=>p5(r,i)),[d,f]=(0,L.useState)(()=>t.spanType===`model.reasoning`?o:p5(r,i));(0,L.useEffect)(()=>{let e=p5(r,i);u(e),f(t.spanType===`model.reasoning`?o:e)},[r,i,a,o,t.spanType]),d5[t.spanType]||d5[`agent.run`],t.status,t.status,t.spanType===`user.prompt`||t.spanType;let p=!!t.children?.length;return g5(t.startTime,n),t.durationUs?`${(t.durationUs/1e3).toFixed(1)}`:t.endTime&&`${((t.endTime-t.startTime)/1e3).toFixed(1)}`,(0,R.jsx)(s_e,{span:t,startTime:n,depth:r,contentExpanded:d,childrenExpanded:l,onToggle:(0,L.useCallback)(()=>{f(e=>!e),p&&u(e=>!e)},[p]),onFork:s,onOpenSession:c,childrenContent:p?t.children?.map(t=>(0,R.jsx)(e,{span:t,startTime:n,depth:r+1,expansionDepth:i,expansionSignal:a,expandThinking:o,onFork:s,onOpenSession:c},t.id)):void 0})});var s_e=(0,L.memo)(function({span:e,startTime:t,depth:n=0,contentExpanded:r,childrenExpanded:i,onToggle:a,onFork:o,onOpenSession:s,childrenContent:c}){let l=d5[e.spanType]||d5[`agent.run`],u=e.status===`UNSET`,d=h_e(e.status,u),f=e.spanType===`user.prompt`||e.spanType===`user_input`,p=!!e.children?.length,m=g5(e.startTime,t),h=e.durationUs?`${(e.durationUs/1e3).toFixed(1)}ms`:e.endTime?`${((e.endTime-e.startTime)/1e3).toFixed(1)}ms`:null;return(0,R.jsx)(`div`,{className:`relative mb-4 group`,style:{marginLeft:n>0?f5:0,width:n>0?`calc(100% - ${f5}px)`:`var(--trace-readable-width)`,maxWidth:`100%`},children:(0,R.jsxs)(`div`,{className:`min-w-0 ${f?`bg-[#11a4d4]/10`:`bg-white dark:bg-[#1a262b]`} border ${d.cardClass} rounded-sm shadow-sm transition-all hover:border-opacity-70 focus:outline-none focus:ring-1 focus:ring-[#11a4d4]/50 ${u?d.glowClass:``}`,onDoubleClick:e=>{m5(e)||a()},onKeyDown:e=>{m5(e)||(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),a())},role:`button`,tabIndex:0,"aria-expanded":r,children:[(0,R.jsx)(c_e,{span:e,config:l,statusStyles:d,isActive:u,contentExpanded:r,duration:h,relativeTime:m,onToggle:a,onFork:o,onOpenSession:s}),r?(0,R.jsx)(d_e,{span:e}):null,p&&i&&r?(0,R.jsx)(`div`,{className:`min-w-0 border-t border-slate-700 bg-slate-900/50 py-4`,children:c}):null]})})});function m5(e){let t=e.target;if(!(t instanceof Element)||t===e.currentTarget)return!1;let n=t.closest(`button, a, input, textarea, select, summary, [role='button'], [tabindex]:not([tabindex='-1'])`);return!!(n&&n!==e.currentTarget)}function c_e({span:e,config:t,statusStyles:n,isActive:r,contentExpanded:i,duration:a,relativeTime:o,onToggle:s,onFork:c,onOpenSession:l}){let u=e.spanType===`user.prompt`||e.spanType===`user_input`?`bg-[#11a4d4]/10`:n.headerClass;return(0,R.jsx)(`div`,{className:`${i?`border-b ${t.borderColor}/20`:``} ${u}`,children:(0,R.jsxs)(`div`,{className:`box-border flex w-full min-w-0 items-center`,style:{maxWidth:`100%`},children:[(0,R.jsx)(`div`,{className:`min-w-0 flex-1 px-4 py-2 text-left`,children:(0,R.jsxs)(`span`,{className:`min-w-0 text-xs font-bold ${t.color} uppercase tracking-wider flex items-center gap-2`,children:[i?(0,R.jsx)(Bo,{size:12}):(0,R.jsx)(Vo,{size:12}),(0,R.jsx)(l_e,{spanType:e.spanType,config:t,isActive:r}),(0,R.jsx)(`span`,{className:`shrink-0`,children:t.label}),e.name?(0,R.jsxs)(`span`,{className:`min-w-0 truncate font-normal text-slate-500 dark:text-slate-400 normal-case`,children:[`: `,e.name]}):null,r?(0,R.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full bg-[#11a4d4] animate-pulse`}):null]})}),(0,R.jsx)(f_e,{forkEntryId:e.pibo?.traceNodeType===`user.message`?e.pibo.entryId:void 0,linkedPiboSessionId:e.pibo?.linkedPiboSessionId,onFork:c,onOpenSession:l}),(0,R.jsx)(u_e,{duration:a,relativeTime:o})]})})}function l_e({spanType:e,config:t,isActive:n}){return(0,R.jsxs)(`span`,{className:`relative inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-full ${t.bgColor} border-2 ${t.borderColor} ${n?`shadow-[0_0_10px_rgba(17,164,212,0.4)]`:``}`,children:[(0,R.jsx)(m_e,{type:e,className:t.color}),n?(0,R.jsx)(`span`,{className:`absolute -right-0.5 -top-0.5 h-1.5 w-1.5 rounded-full bg-[#11a4d4] animate-pulse`}):null]})}function u_e({duration:e,relativeTime:t}){return(0,R.jsxs)(`div`,{className:`ml-2 mr-4 flex w-36 shrink-0 items-center justify-end gap-2 font-mono tabular-nums`,children:[e?(0,R.jsx)(`span`,{className:`text-[10px] text-slate-500 dark:text-slate-400`,children:e}):null,(0,R.jsx)(`span`,{className:`text-xs text-slate-400 dark:text-slate-500`,children:t})]})}var d_e=(0,L.memo)(function({span:e}){let[t,n]=(0,L.useState)(!1),{spanType:r,attributes:i,name:a}=e,o=i.content||i.input||i.output||i.message,s=i.tool_name||i.tool?.name||i[`tool.name`],c=typeof s==`string`?s:null,l=i.output||i.result||i[`tool.result`],u=i.arguments||i.args||i[`tool.arguments`],d=e.status===`ERROR`?(0,R.jsxs)(`div`,{className:`mx-4 mt-4 p-3 bg-red-500/10 border border-red-500/20 rounded-sm text-xs`,children:[(0,R.jsx)(`div`,{className:`flex items-center gap-2 font-semibold text-red-500 mb-1`,children:`Error`}),e.statusMessage?(0,R.jsx)(`div`,{className:`font-mono text-red-400 mb-2`,children:e.statusMessage}):null]}):null;if(r===`user.prompt`||r===`user_input`)return(0,R.jsxs)(`div`,{className:`flex flex-col`,children:[d,(0,R.jsx)(`div`,{className:`min-w-0 break-words p-4 font-mono text-sm text-slate-300 whitespace-pre-wrap`,children:typeof o==`string`?o:JSON.stringify(o)})]});if(r===`model.response`)return(0,R.jsxs)(`div`,{className:`flex flex-col`,children:[d,(0,R.jsx)(`div`,{className:`model-response-markdown min-w-0 p-4 text-sm text-slate-200 leading-relaxed`,children:typeof o==`string`?(0,R.jsx)(nQ,{children:o}):(0,R.jsx)(z1,{value:o})})]});if(r===`tool.result`)return(0,R.jsxs)(`div`,{className:`flex flex-col`,children:[d,(0,R.jsxs)(`div`,{className:`p-4 bg-green-500/5 border-t border-green-500/20`,children:[(0,R.jsxs)(`div`,{className:`text-xs font-medium text-green-400 mb-2`,children:[`Returned from `,c||a,`:`]}),(0,R.jsx)(z1,{value:l??o})]})]});if(r===`tool.call`){let e=_5(u)?u:{},r=Object.keys(e).length>0;return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`div`,{className:`p-4 bg-[#0e1116] border-b border-slate-800`,children:(0,R.jsx)(p_e,{name:c??a,args:e})}),l==null?null:(0,R.jsxs)(`div`,{className:`px-4 py-2 bg-[#1a262b] flex items-center gap-2`,children:[(0,R.jsx)(Do,{size:14,className:`text-slate-400`}),(0,R.jsx)(`span`,{className:`text-xs font-mono text-slate-500`,children:`Output:`}),(0,R.jsx)(`code`,{className:`min-w-0 max-w-md truncate text-xs font-mono text-slate-300`,children:typeof l==`string`?l.slice(0,100):JSON.stringify(l).slice(0,100)})]}),(0,R.jsxs)(`button`,{type:`button`,onClick:()=>n(e=>!e),className:`w-full px-4 py-1.5 flex items-center gap-1.5 text-[11px] font-medium text-slate-400 hover:text-slate-200 bg-slate-900/40 hover:bg-slate-800/60 border-t border-slate-700/40 transition-colors`,children:[t?(0,R.jsx)(is,{size:12}):(0,R.jsx)(as,{size:12}),t?`Hide Details`:`Show Details`]}),t?(0,R.jsxs)(`div`,{className:`border-t border-slate-700/40 bg-[#0e1116]`,children:[r?(0,R.jsxs)(`div`,{className:`px-4 pt-3 pb-2`,children:[(0,R.jsx)(`div`,{className:`text-[10px] font-semibold text-blue-400 uppercase tracking-wider mb-1.5`,children:`Input`}),(0,R.jsx)(z1,{value:e})]}):null,l==null?null:(0,R.jsxs)(`div`,{className:`px-4 pt-2 pb-3 border-t border-slate-700/30`,children:[(0,R.jsx)(`div`,{className:`text-[10px] font-semibold text-green-400 uppercase tracking-wider mb-1.5`,children:`Output`}),(0,R.jsx)(z1,{value:l})]})]}):null,d]})}if(r===`yielded.run`){let e=_5(l)?l:_5(o)?o:{};return(0,R.jsxs)(`div`,{className:`flex flex-col`,children:[d,(0,R.jsxs)(`div`,{className:`p-4 border-b border-[#11a4d4]/20 bg-[#11a4d4]/5`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2 mb-2`,children:[(0,R.jsx)(ko,{size:14,className:`text-[#11a4d4]`}),(0,R.jsx)(`span`,{className:`text-sm font-medium text-[#11a4d4]`,children:`Run notification`}),(0,R.jsx)(`span`,{className:`text-xs font-mono text-slate-400`,children:typeof i.content==`string`?i.content:a})]}),(0,R.jsx)(g_e,{notification:e})]}),(0,R.jsxs)(`button`,{type:`button`,onClick:()=>n(e=>!e),className:`w-full px-4 py-1.5 flex items-center gap-1.5 text-[11px] font-medium text-slate-400 hover:text-slate-200 bg-slate-900/40 hover:bg-slate-800/60 border-t border-slate-700/40 transition-colors`,children:[t?(0,R.jsx)(is,{size:12}):(0,R.jsx)(as,{size:12}),t?`Hide Details`:`Show Details`]}),t?(0,R.jsx)(`div`,{className:`border-t border-slate-700/40 bg-[#0e1116] px-4 py-3`,children:(0,R.jsx)(z1,{value:e})}):null]})}if(r===`model.reasoning`){let e=i.reasoning||i[`model.reasoning`]||o;return(0,R.jsxs)(`div`,{className:`flex flex-col`,children:[d,(0,R.jsxs)(`div`,{className:`min-w-0 break-words p-4 font-mono text-sm text-slate-300 bg-amber-500/5 leading-relaxed whitespace-pre-wrap`,children:[(0,R.jsx)(`span`,{className:`text-amber-500 opacity-60`,children:`// Model reasoning`}),(0,R.jsx)(`br`,{}),typeof e==`string`?e:JSON.stringify(e,null,2)]})]})}if(r===`agent.delegation`){let e=i[`delegation.target_agent`],t=i[`delegation.query`],n=i[`result.status`];return(0,R.jsxs)(R.Fragment,{children:[d,(0,R.jsxs)(`div`,{className:`p-4 border-b border-orange-500/20 bg-orange-500/5`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2 mb-2`,children:[(0,R.jsx)(fs,{size:14,className:`text-orange-500`}),(0,R.jsx)(`span`,{className:`text-sm font-medium text-orange-500`,children:`Delegated to:`}),(0,R.jsxs)(`span`,{className:`text-sm font-semibold text-slate-200`,children:[e||`unknown`,` agent`]}),n?(0,R.jsx)(`span`,{className:`ml-2 px-2 py-0.5 text-[10px] font-bold rounded-sm bg-green-500/20 text-green-500`,children:n.toUpperCase()}):null]}),t?(0,R.jsxs)(`div`,{className:`text-xs text-slate-400 font-mono italic line-clamp-2`,children:[`"`,v5(t),`"`]}):null]})]})}if(r===`agent.async`){let e=i[`async_agent.target_agent`],t=i[`async_agent.query`],n=i[`async_agent.started_by`],r=i.run_id,a=i[`result.status`];return(0,R.jsxs)(R.Fragment,{children:[d,(0,R.jsxs)(`div`,{className:`p-4 border-b border-orange-500/20 bg-orange-500/5`,children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 mb-2`,children:[(0,R.jsx)(fs,{size:14,className:`text-orange-500`}),(0,R.jsx)(`span`,{className:`text-sm font-medium text-orange-500`,children:`Async agent started:`}),(0,R.jsxs)(`span`,{className:`text-sm font-semibold text-slate-200`,children:[e||`unknown`,` agent`]}),a?(0,R.jsx)(`span`,{className:`px-2 py-0.5 text-[10px] font-bold rounded-sm bg-orange-500/15 text-orange-400`,children:a.toUpperCase()}):null]}),(0,R.jsxs)(`div`,{className:`mb-2 flex flex-wrap gap-x-3 gap-y-1 font-mono text-[11px] text-slate-500`,children:[(0,R.jsxs)(`span`,{children:[`Started by `,n||`pibo_run_start`]}),r?(0,R.jsx)(`span`,{children:r}):null]}),t?(0,R.jsxs)(`div`,{className:`text-xs text-slate-400 font-mono italic line-clamp-2`,children:[`"`,v5(t),`"`]}):null]})]})}return r===`agent.run`?(0,R.jsx)(`div`,{className:`flex flex-col`,children:d}):(0,R.jsxs)(`div`,{className:`flex flex-col`,children:[d,(0,R.jsx)(`div`,{className:`p-4 font-mono text-sm text-slate-300`,children:(0,R.jsx)(z1,{value:i})})]})});function f_e({forkEntryId:e,linkedPiboSessionId:t,onFork:n,onOpenSession:r}){let i=e&&n?e:void 0,a=t&&r?t:void 0;return!i&&!a?null:(0,R.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[i?(0,R.jsx)(`button`,{type:`button`,onClick:()=>n?.(i),className:`inline-flex h-8 w-8 items-center justify-center rounded-sm border border-slate-700 bg-[#151f24]/80 text-slate-400 transition-colors hover:border-[#11a4d4] hover:text-[#11a4d4]`,title:`Fork user message`,"aria-label":`Fork user message`,children:(0,R.jsx)(fs,{size:14})}):null,a?(0,R.jsx)(`button`,{type:`button`,onClick:()=>r?.(a),className:`inline-flex h-8 w-8 items-center justify-center rounded-sm border border-slate-700 bg-[#151f24]/80 text-slate-400 transition-colors hover:border-[#11a4d4] hover:text-[#11a4d4]`,title:`Open child session`,"aria-label":`Open child session`,children:(0,R.jsx)(rs,{size:14})}):null]})}function p_e({name:e,args:t}){return(0,R.jsxs)(`code`,{className:`font-mono text-xs text-green-400`,children:[(0,R.jsx)(`span`,{className:`text-purple-400`,children:`def`}),` `,(0,R.jsx)(`span`,{className:`text-yellow-300`,children:e}),(0,R.jsxs)(`span`,{children:[`(`,Object.entries(t).map(([e,t],n)=>(0,R.jsxs)(`span`,{children:[n>0?`, `:null,(0,R.jsx)(`span`,{className:`text-blue-400`,children:e}),`=`,(0,R.jsx)(`span`,{className:`text-green-300`,children:typeof t==`string`?`'${t.slice(0,50)}${t.length>50?`...`:``}'`:v5(t).slice(0,50)})]},e)),`)`]})]})}function m_e({type:e,className:t}){let n={size:14,className:t};switch(e){case`agent.run`:return(0,R.jsx)(Fo,{...n});case`tool.call`:return(0,R.jsx)(Ao,{...n});case`tool.result`:return(0,R.jsx)(Do,{...n});case`model.request`:return(0,R.jsx)(No,{...n});case`model.response`:return(0,R.jsx)(Do,{...n});case`model.reasoning`:return(0,R.jsx)(ys,{...n});case`agent.delegation`:return(0,R.jsx)(fs,{...n});case`agent.async`:return(0,R.jsx)(fs,{...n});case`yielded.run`:return(0,R.jsx)(ko,{...n});case`user.prompt`:return(0,R.jsx)(Ds,{...n});case`user_input`:return(0,R.jsx)(qs,{...n});case`execution.command`:return(0,R.jsx)(Ao,{...n});default:return(0,R.jsx)(zo,{...n})}}function h_e(e,t){return e===`ERROR`?{cardClass:`border-[#ff6b00]/50`,headerClass:`bg-[#ff6b00]/5`,glowClass:``}:e===`OK`?{cardClass:`border-[#0bda57]/30`,headerClass:`bg-[#0bda57]/5`,glowClass:``}:t?{cardClass:`border-[#11a4d4]/50`,headerClass:`bg-[#11a4d4]/5`,glowClass:`shadow-[0_0_10px_rgba(17,164,212,0.1)]`}:{cardClass:`border-slate-700`,headerClass:`bg-[#151f24]`,glowClass:``}}function g_e({notification:e}){let t=[[`completed`,`text-green-500`,e.completed],[`failed`,`text-red-400`,e.failed],[`cancelled`,`text-slate-400`,e.cancelled],[`running`,`text-[#11a4d4]`,e.running]].map(([e,t,n])=>({name:e,color:t,runs:Array.isArray(n)?n.filter(_5):[]})).filter(e=>e.runs.length>0);return t.length===0?(0,R.jsx)(`div`,{className:`text-xs text-slate-400`,children:`No yielded run updates.`}):(0,R.jsx)(`div`,{className:`grid gap-2`,children:t.map(e=>(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{className:`mb-1 text-[10px] font-bold uppercase tracking-wider ${e.color}`,children:e.name}),(0,R.jsx)(`div`,{className:`grid gap-1`,children:e.runs.map((t,n)=>(0,R.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)_auto] gap-2 rounded-sm border border-slate-700/60 bg-[#0e1116]/60 px-2 py-1.5`,children:[(0,R.jsxs)(`div`,{className:`min-w-0`,children:[(0,R.jsx)(`div`,{className:`truncate font-mono text-xs text-slate-200`,children:h5(t.toolName)||`yielded tool`}),(0,R.jsx)(`div`,{className:`truncate font-mono text-[10px] text-slate-500`,children:h5(t.runId)})]}),(0,R.jsx)(`div`,{className:`font-mono text-[10px] uppercase text-slate-400`,children:h5(t.status)||e.name})]},`${e.name}-${n}`))})]},e.name))})}function h5(e){return typeof e==`string`?e:``}function g5(e,t){let n=(e-t)/1e3,r=Math.floor(n/6e4),i=Math.floor(n%6e4/1e3),a=Math.floor(n%1e3);return`${String(r).padStart(2,`0`)}:${String(i).padStart(2,`0`)}.${String(a).padStart(3,`0`)}`}function _5(e){return!!e&&typeof e==`object`&&!Array.isArray(e)}function v5(e){if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}function y5(e){if(e==null)return{kind:`empty`};let t=b5(e);return t===void 0?{kind:`json`,value:e}:{kind:`text`,text:t}}function b5(e){if(typeof e==`string`)return e;if(Array.isArray(e)){let t=e.map(b5).filter(e=>e!==void 0);return t.length===e.length&&t.length>0?t.join(``):void 0}if(!x5(e))return;let t=typeof e.type==`string`?e.type:void 0;if(t===`text`&&typeof e.text==`string`)return e.text;if(t===`text`&&typeof e.content==`string`)return e.content;if(t===`output_text`&&typeof e.text==`string`)return e.text;let n=b5(e.content);if(n!==void 0&&__e(e))return n;let r=x5(e.message)?b5(e.message.content):void 0;if(r!==void 0)return r}function __e(e){let t=Object.keys(e).filter(t=>e[t]!==void 0);return t.length===1&&t[0]===`content`||t.every(e=>e===`content`||e===`type`)||t.every(e=>e===`content`||e===`details`||e===`type`)?!0:typeof e.type==`string`&&e.type.includes(`text`)}function x5(e){return!!e&&typeof e==`object`&&!Array.isArray(e)}function v_e({row:e,onOpenSession:t}){return(0,R.jsx)(`div`,{className:`mt-2 border border-[#2a2a2a] bg-[#111111] px-3 py-2 text-[12px] text-[#d4d4d4]`,"data-shared-terminal-details":e.kind,children:e.detailItems?.length?(0,R.jsx)(`div`,{className:`space-y-3`,children:e.detailItems.map(e=>(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px]`,children:[(0,R.jsx)(`span`,{className:`font-semibold text-[#d4d4d4]`,children:e.label}),e.linkedPiboSessionId?(0,R.jsx)(`button`,{type:`button`,onClick:()=>t(e.linkedPiboSessionId),className:`border border-[#3a3a3a] px-2 py-0.5 text-[#38bdf8] hover:border-[#38bdf8]`,children:`Open Session`}):null]}),(0,R.jsx)(S5,{label:`Input`,value:e.input}),(0,R.jsx)(S5,{label:`Output`,value:e.output}),(0,R.jsx)(C5,{value:e.output}),e.error?(0,R.jsx)(T5,{label:`Error`,value:e.error,tone:`red`}):null]},e.id))}):(0,R.jsxs)(`div`,{className:`space-y-3`,children:[(0,R.jsx)(S5,{label:`Input`,value:e.input}),(0,R.jsx)(S5,{label:`Output`,value:e.output}),(0,R.jsx)(C5,{value:e.output}),e.error?(0,R.jsx)(T5,{label:`Error`,value:e.error,tone:`red`}):null,e.linkedPiboSessionId?(0,R.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px]`,children:[(0,R.jsx)(`span`,{className:`text-[#737373]`,children:`Child session`}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>t(e.linkedPiboSessionId),className:`border border-[#3a3a3a] px-2 py-0.5 text-[#38bdf8] hover:border-[#38bdf8]`,children:e.linkedPiboSessionId})]}):null]})})}function S5({label:e,value:t}){let n=y5(t);if(n.kind===`empty`)return null;if(n.kind===`text`){let t=E5(n.text);return t?.kind===`json`?(0,R.jsx)(w5,{label:e,value:t.value,meta:t.meta}):t?.kind===`text`?(0,R.jsx)(T5,{label:e,value:t.text}):(0,R.jsx)(T5,{label:e,value:n.text})}return(0,R.jsx)(w5,{label:e,value:n.value})}function C5({value:e}){let t=y_e(e);return t?(0,R.jsxs)(`details`,{className:`space-y-1 border border-[#2a2a2a] bg-[#0b0b0b] p-2`,children:[(0,R.jsxs)(`summary`,{className:`cursor-pointer text-[11px] font-semibold text-[#38bdf8]`,children:[`Show full output (`,t.originalLines,` lines)`]}),t.fullOutput?(0,R.jsx)(`pre`,{className:`mt-2 max-h-[520px] overflow-auto whitespace-pre-wrap break-words font-mono text-[12px] leading-[1.45] text-[#d4d4d4]`,children:t.fullOutput}):t.fullOutputPath?(0,R.jsxs)(`div`,{className:`mt-2 min-w-0 break-words font-mono text-[12px] text-[#d4d4d4]`,children:[`Full output file: `,t.fullOutputPath]}):null]}):null}function y_e(e){if(!k5(e))return;let t=k5(e.details)?e.details.piboBashOutputCompaction:void 0;if(!k5(t)||t.kind!==`validation-output`)return;let n=typeof t.originalLines==`number`?t.originalLines:void 0;if(n!==void 0)return{originalLines:n,fullOutput:typeof t.fullOutput==`string`?t.fullOutput:void 0,fullOutputPath:typeof t.fullOutputPath==`string`?t.fullOutputPath:void 0}}function w5({label:e,value:t,meta:n}){return(0,R.jsxs)(`div`,{className:`space-y-1`,"data-shared-terminal-detail-json":e,children:[(0,R.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,R.jsx)(`div`,{className:`text-[11px] font-semibold text-[#737373]`,"data-shared-terminal-detail-label":e,children:e}),n?(0,R.jsxs)(`div`,{className:`min-w-0 break-words text-[11px] text-[#737373]`,children:[`Status: `,n]}):null]}),(0,R.jsx)(`div`,{className:`compact-terminal-json border border-[#2a2a2a] bg-[#0b0b0b] p-2`,children:(0,R.jsx)(z1,{value:t,showControls:!1})})]})}function T5({label:e,value:t,tone:n=`default`}){return(0,R.jsxs)(`div`,{className:`space-y-1`,"data-shared-terminal-detail-text":e,children:[(0,R.jsx)(`div`,{className:`text-[11px] font-semibold text-[#737373]`,"data-shared-terminal-detail-label":e,children:e}),(0,R.jsx)(`pre`,{className:`m-0 whitespace-pre-wrap break-words border border-[#2a2a2a] bg-[#0b0b0b] p-2 font-mono text-[12px] leading-[1.45] ${n===`red`?`text-[#ef4444]`:`text-[#d4d4d4]`}`,children:t})]})}function E5(e){let t=e.trim();if(!t)return;let n=O5(t);if(n!==void 0)return D5(n);let r=t.split(/\r?\n/);for(let e=1;e<r.length;e+=1){let t=r.slice(e).join(`
157
+ `).trim();if(!t.startsWith(`{`)&&!t.startsWith(`[`))continue;let n=O5(t);if(n!==void 0)return D5(n,r.slice(0,e).join(` `).trim()||void 0)}}function D5(e,t){let n=y5(e);if(n.kind===`text`){let e=E5(n.text);return e?.kind===`json`?{...e,meta:e.meta??t}:{kind:`text`,text:n.text}}return{kind:`json`,value:e,meta:t}}function O5(e){if(!(!e.startsWith(`{`)&&!e.startsWith(`[`)))try{let t=JSON.parse(e);return typeof t==`object`&&t?t:void 0}catch{return}}function k5(e){return!!e&&typeof e==`object`&&!Array.isArray(e)}function b_e({name:e,input:t}){return(0,R.jsxs)(`span`,{className:`compact-terminal-function-call`,children:[(0,R.jsx)(`span`,{className:`text-[#facc15] font-semibold`,children:e}),(0,R.jsx)(`span`,{className:`text-[#d4d4d4]`,children:`(`}),t===void 0?null:(0,R.jsx)(x_e,{value:t}),(0,R.jsx)(`span`,{className:`text-[#d4d4d4]`,children:`)`})]})}function x_e({value:e}){let[t,n]=(0,L.useState)(()=>new Set([`$`])),[r,i]=(0,L.useState)(()=>new Set);return(0,R.jsx)(A5,{value:e,path:`$`,expandedPaths:t,expandedStrings:r,onTogglePath:e=>{n(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},onToggleString:e=>{i(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}})}function A5({value:e,path:t,expandedPaths:n,expandedStrings:r,onTogglePath:i,onToggleString:a}){if(Array.isArray(e))return(0,R.jsx)(j5,{value:e,path:t,open:`[`,close:`]`,expandedPaths:n,expandedStrings:r,onTogglePath:i,onToggleString:a});if(C_e(e))return(0,R.jsx)(j5,{value:e,path:t,open:`{`,close:`}`,expandedPaths:n,expandedStrings:r,onTogglePath:i,onToggleString:a});if(typeof e==`string`){let n=r.has(t),i=e.length>140&&!n,o=i?`${e.slice(0,140)}...`:e,s=(0,R.jsx)(`span`,{className:`text-[#fb923c]`,children:JSON.stringify(o)});return!i&&e.length<=140?s:(0,R.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),a(t)},className:`compact-terminal-json-toggle text-left align-baseline`,title:n?`Collapse string`:`Expand string`,children:s})}return typeof e==`number`||typeof e==`boolean`||e===null?(0,R.jsx)(`span`,{className:`text-[#60a5fa]`,children:String(e)}):(0,R.jsx)(`span`,{className:`text-[#737373]`,children:JSON.stringify(String(e))})}function j5({value:e,path:t,open:n,close:r,expandedPaths:i,expandedStrings:a,onTogglePath:o,onToggleString:s}){let c=Array.isArray(e)?e.map((e,t)=>[String(t),e]):Object.entries(e);return i.has(t)?(0,R.jsxs)(`span`,{children:[(0,R.jsxs)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),o(t)},className:`compact-terminal-json-toggle align-baseline text-[#737373]`,title:`Collapse JSON`,"aria-label":`Collapse JSON at ${t}`,"data-inline-json-path":t,children:[(0,R.jsx)(`span`,{className:`compact-terminal-json-caret`,children:`▾`}),n]}),c.map(([n,r],c)=>{let l=`${t}.${S_e(n)}`;return(0,R.jsxs)(`span`,{children:[c>0?(0,R.jsx)(`span`,{className:`text-[#737373]`,children:`, `}):null,Array.isArray(e)?null:(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`span`,{className:`text-[#d4d4d4]`,children:JSON.stringify(n)}),(0,R.jsx)(`span`,{className:`text-[#737373]`,children:`:`})]}),(0,R.jsx)(A5,{value:r,path:l,expandedPaths:i,expandedStrings:a,onTogglePath:o,onToggleString:s})]},l)}),(0,R.jsx)(`span`,{className:`text-[#737373]`,children:r})]}):(0,R.jsxs)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),o(t)},className:`compact-terminal-json-toggle align-baseline text-[#737373]`,title:`Expand JSON`,"aria-label":`Expand JSON at ${t}`,"data-inline-json-path":t,children:[(0,R.jsx)(`span`,{className:`compact-terminal-json-caret`,children:`▸`}),n,`...`,r]})}function S_e(e){return e.replaceAll(`\\`,`\\\\`).replaceAll(`.`,`\\.`)}function C_e(e){return!!e&&typeof e==`object`&&!Array.isArray(e)}function w_e({line:e,status:t,clampLines:n}){let r=`min-w-0 whitespace-pre-wrap break-words ${n?`block overflow-hidden`:``}`;return(0,R.jsxs)(`div`,{className:`grid grid-cols-[1.9rem_minmax(0,1fr)] gap-2 leading-[1.45]`,children:[(0,R.jsx)(`span`,{className:`whitespace-pre ${E_e(e.prefix,t)}`,children:T_e(e.prefix)}),(0,R.jsxs)(`span`,{className:r,style:n?{maxHeight:`${n*1.45}em`}:void 0,children:[e.tokens.map((e,t)=>(0,R.jsx)(`span`,{className:D_e(e),children:e.text},`${t}:${e.text}`)),e.functionCall?(0,R.jsx)(b_e,{name:e.functionCall.name,input:e.functionCall.input}):null]})]})}function T_e(e=`none`){switch(e){case`bullet`:return`•`;case`detail`:return`└`;case`continuation`:return` `;case`prompt`:return`›`;default:return` `}}function E_e(e=`none`,t){if(e===`bullet`){if(t===`running`)return`text-[#38bdf8]`;if(t===`error`)return`text-[#ef4444]`;if(t===`done`)return`text-[#22c55e]`}return`text-[#737373]`}function D_e(e){return`${e.tone===`dim`?`text-[#737373]`:e.tone===`cyan`?`text-[#38bdf8]`:e.tone===`green`?`text-[#22c55e]`:e.tone===`red`?`text-[#ef4444]`:e.tone===`magenta`?`text-[#d946ef]`:e.tone===`yellow`?`text-[#facc15]`:e.tone===`blue`?`text-[#60a5fa]`:e.tone===`amber`?`text-[#f59e0b]`:`text-[#d4d4d4]`} ${e.weight===`bold`?`font-bold`:e.weight===`semibold`?`font-semibold`:`font-normal`} ${e.italic?`italic`:``}`.trim()}async function O_e(){await fetch(`/api/auth/sign-out`,{method:`POST`,credentials:`same-origin`,headers:{"content-type":`application/json`},body:`{}`})}async function k_e(){let e=location.pathname.startsWith(`/apps/chat`)?`${location.pathname}${location.search}`:`/apps/chat`,t=await fetch(`/api/auth/sign-in/social`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({provider:`google`,callbackURL:e,disableRedirect:!0})}),n=await t.json();if(!t.ok||!n.url)throw Error(n.message||n.error||`Could not start Google sign in.`);location.href=n.url}async function A_e(e,t,n){return B(`/api/chat/projects/${encodeURIComponent(e)}/workflow-sessions/${encodeURIComponent(t)}/human-actions`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(n)})}function j_e(e){if(typeof e!=`object`||!e||Array.isArray(e))return!1;let t=e;return t.action===`show_login_menu`&&Array.isArray(t.providers)}function M_e(e){if(typeof e!=`object`||!e||Array.isArray(e))return!1;let t=e;return t.action===`show_model_menu`&&Array.isArray(t.providers)}function M5(e){return N_e(e)?e.result:e}function N_e(e){return!!e&&typeof e==`object`&&!Array.isArray(e)&&e.type===`execution_result`}var P_e={device_code:`Device code`,api_key:`API key`,oauth:`Browser OAuth`};function F_e({row:e,piboSessionId:t}){let n=j_e(e.output)?e.output:void 0,r=(0,L.useMemo)(()=>n?.providers??[],[n?.providers]),[i,a]=(0,L.useState)({type:`select_provider`}),[o,s]=(0,L.useState)(!1),[c,l]=(0,L.useState)(``),[u,d]=(0,L.useState)(``),[f,p]=(0,L.useState)(null),m=(0,L.useCallback)(()=>{a({type:`select_provider`}),l(``),d(``)},[]),h=(0,L.useCallback)(async e=>{try{await navigator.clipboard.writeText(e),p(e),window.setTimeout(()=>p(t=>t===e?null:t),1600)}catch{}},[]),g=(0,L.useCallback)(async e=>{if(!t){a({type:`error`,provider:e,message:`Select a chat session before starting login.`});return}s(!0),a({type:`device_starting`,provider:e});try{let n=M5(await gc(t,`login.start`,{provider:e.id}));if(!n?.url){a({type:`error`,provider:e,message:`No login URL returned.`});return}a({type:`device_flow`,provider:e,url:n.url,state:n.state,userCode:n.userCode,instructions:n.instructions})}catch(t){a({type:`error`,provider:e,message:t instanceof Error?t.message:String(t)})}finally{s(!1)}},[t]),_=(0,L.useCallback)(async(e,n,r)=>{if(t){s(!0);try{await gc(t,`login.complete`,{provider:e.id,state:n??``,...r?{code:r}:{}}),a({type:`success`,provider:e,message:`${e.name} login completed.`})}catch(t){a({type:`error`,provider:e,message:t instanceof Error?t.message:String(t)})}finally{s(!1)}}},[t]),v=(0,L.useCallback)(async e=>{if(!t)return;let n=c.trim();if(n){s(!0);try{await gc(t,`login.apikey`,{provider:e.id,apiKey:n}),l(``),a({type:`success`,provider:e,message:`${e.name} API key saved.`})}catch(t){a({type:`error`,provider:e,message:t instanceof Error?t.message:String(t)})}finally{s(!1)}}},[c,t]);return n?(0,R.jsx)(N5,{title:i.type===`select_provider`?`Login`:L_e(i),tone:i.type===`error`?`red`:i.type===`success`?`green`:`cyan`,action:i.type===`select_provider`?void 0:(0,R.jsx)(I_e,{onClick:m,disabled:o}),children:i.type===`select_provider`?(0,R.jsxs)(`div`,{className:`grid gap-2`,children:[(0,R.jsxs)(`div`,{className:`text-[11px] text-[#737373]`,children:[`Choose a provider. Use `,(0,R.jsx)(`span`,{className:`text-[#38bdf8]`,children:`/login`}),` anytime.`]}),(0,R.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:r.map(e=>(0,R.jsxs)(`button`,{type:`button`,onClick:()=>a({type:`select_method`,provider:e}),className:`inline-flex items-center gap-1 border border-[#3a3a3a] bg-transparent px-2 py-1 text-[11px] text-[#d4d4d4] hover:border-[#38bdf8] hover:text-[#38bdf8]`,children:[(0,R.jsx)(`span`,{children:e.name}),e.configured?(0,R.jsx)(`span`,{className:`text-[#22c55e]`,children:`●`}):null]},e.id))})]}):i.type===`select_method`?(0,R.jsxs)(`div`,{className:`grid gap-2`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px]`,children:[(0,R.jsx)(`span`,{className:`text-[#737373]`,children:`Provider:`}),(0,R.jsx)(`span`,{className:`text-[#d4d4d4]`,children:i.provider.name}),i.provider.configured?(0,R.jsx)(P5,{tone:`green`,children:`Configured`}):(0,R.jsx)(P5,{tone:`neutral`,children:`Not configured`})]}),(0,R.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:i.provider.authMethods.map(e=>(0,R.jsxs)(`button`,{type:`button`,onClick:()=>e===`api_key`?a({type:`api_key`,provider:i.provider}):void g(i.provider),className:`inline-flex items-center gap-1 border border-[#3a3a3a] bg-transparent px-2 py-1 text-[11px] text-[#d4d4d4] hover:border-[#38bdf8] hover:text-[#38bdf8]`,children:[e===`api_key`?(0,R.jsx)(gs,{size:11}):(0,R.jsx)(ws,{size:11}),P_e[e]]},e))})]}):i.type===`device_starting`?(0,R.jsxs)(`div`,{className:`inline-flex items-center gap-2 text-[11px] text-[#38bdf8]`,children:[(0,R.jsx)(Ss,{size:13,className:`animate-spin`}),` Starting device login...`]}):i.type===`device_flow`?(0,R.jsxs)(`div`,{className:`grid gap-2 text-[11px]`,children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,R.jsx)(`span`,{className:`text-[#737373]`,children:`Open:`}),(0,R.jsxs)(`a`,{href:i.url,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1 text-[#38bdf8] hover:underline`,children:[R_e(i.url),` `,(0,R.jsx)(rs,{size:11})]}),(0,R.jsxs)(`button`,{type:`button`,onClick:()=>void h(i.url),className:`inline-flex items-center gap-1 border border-[#3a3a3a] px-1.5 py-0.5 text-[#737373] hover:border-[#38bdf8] hover:text-[#38bdf8]`,children:[f===i.url?(0,R.jsx)(Jo,{size:10}):(0,R.jsx)($o,{size:10}),` `,f===i.url?`Copied`:`Copy`]})]}),i.userCode?(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,R.jsx)(`span`,{className:`text-[#737373]`,children:`Code:`}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>void h(i.userCode),className:`border border-[#1f4960] px-2 py-0.5 font-semibold tracking-widest text-[#38bdf8] hover:border-[#38bdf8]`,children:i.userCode}),(0,R.jsx)(`span`,{className:`text-[#737373]`,children:`then`}),(0,R.jsxs)(`button`,{type:`button`,disabled:o,onClick:()=>void _(i.provider,i.state),className:`inline-flex items-center gap-1 border border-[#3a3a3a] px-2 py-0.5 text-[#d4d4d4] hover:border-[#38bdf8] hover:text-[#38bdf8] disabled:opacity-50`,children:[o?(0,R.jsx)(Ss,{size:11,className:`animate-spin`}):(0,R.jsx)(Jo,{size:11}),` Complete`]})]}):(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,R.jsx)(`input`,{value:u,onChange:e=>d(e.target.value),placeholder:`authorization code`,className:`min-w-0 flex-1 border border-[#2a2a2a] bg-[#0b0b0b] px-2 py-1 text-[11px] text-[#d4d4d4] outline-none focus:border-[#38bdf8]`}),(0,R.jsxs)(`button`,{type:`button`,disabled:o||!u.trim(),onClick:()=>void _(i.provider,i.state,u.trim()),className:`inline-flex items-center gap-1 border border-[#3a3a3a] px-2 py-1 text-[#d4d4d4] hover:border-[#38bdf8] hover:text-[#38bdf8] disabled:opacity-50`,children:[o?(0,R.jsx)(Ss,{size:11,className:`animate-spin`}):(0,R.jsx)(Jo,{size:11}),` Complete`]})]}),i.instructions?(0,R.jsx)(`div`,{className:`text-[#737373]`,children:i.instructions}):null]}):i.type===`api_key`?(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 text-[11px]`,children:[(0,R.jsx)(`span`,{className:`text-[#737373]`,children:`API key:`}),(0,R.jsx)(`input`,{type:`password`,value:c,onChange:e=>l(e.target.value),onKeyDown:e=>{e.key===`Enter`&&v(i.provider)},placeholder:`sk-...`,className:`min-w-[12rem] flex-1 border border-[#2a2a2a] bg-[#0b0b0b] px-2 py-1 text-[11px] text-[#d4d4d4] outline-none focus:border-[#38bdf8]`}),(0,R.jsxs)(`button`,{type:`button`,disabled:o||!c.trim(),onClick:()=>void v(i.provider),className:`inline-flex items-center gap-1 border border-[#3a3a3a] px-2 py-1 text-[#d4d4d4] hover:border-[#38bdf8] hover:text-[#38bdf8] disabled:opacity-50`,children:[o?(0,R.jsx)(Ss,{size:11,className:`animate-spin`}):(0,R.jsx)(Jo,{size:11}),` Save`]})]}):i.type===`success`?(0,R.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] text-[#22c55e]`,children:[(0,R.jsx)(Jo,{size:13}),` `,i.message]}):(0,R.jsxs)(`div`,{className:`flex items-start gap-2 text-[11px] text-[#ef4444]`,children:[(0,R.jsx)(Ko,{size:13,className:`mt-0.5 shrink-0`}),` `,(0,R.jsx)(`span`,{children:i.message})]})}):(0,R.jsx)(N5,{title:`Login`,tone:`red`,children:`Unparseable login payload.`})}function N5({title:e,tone:t,action:n,children:r}){return(0,R.jsxs)(`div`,{className:`mt-2 border border-[#2a2a2a] bg-[#111111] px-3 py-2 text-[12px] text-[#d4d4d4]`,"data-shared-terminal-card":`login`,children:[(0,R.jsxs)(`div`,{className:`mb-2 flex items-center gap-2`,children:[(0,R.jsx)(ws,{size:14,className:t===`red`?`text-[#ef4444]`:t===`green`?`text-[#22c55e]`:`text-[#38bdf8]`}),(0,R.jsx)(`span`,{className:`font-semibold text-[#d4d4d4]`,children:e}),n?(0,R.jsx)(`div`,{className:`ml-auto`,children:n}):null]}),r]})}function I_e({onClick:e,disabled:t}){return(0,R.jsxs)(`button`,{type:`button`,disabled:t,onClick:e,className:`inline-flex items-center gap-1 border border-[#3a3a3a] bg-transparent px-1.5 py-0.5 text-[11px] text-[#737373] hover:border-[#38bdf8] hover:text-[#38bdf8] disabled:opacity-50`,children:[(0,R.jsx)(Oo,{size:10}),` Back`]})}function P5({tone:e,children:t}){return(0,R.jsx)(`span`,{className:`border px-1.5 py-0.5 text-[10px] ${e===`green`?`border-[#14532d] text-[#22c55e]`:`border-[#3a3a3a] text-[#737373]`}`,children:t})}function L_e(e){return`provider`in e&&e.provider?e.provider.name:`Login`}function R_e(e){try{let t=new URL(e);return`${t.host}${t.pathname}`}catch{return e.length>42?`${e.slice(0,39)}...`:e}}function z_e({row:e,piboSessionId:t,onModelChanged:n}){let r=M5(e.output),i=(M_e(r)?r:void 0)?.providers??[],a=(0,L.useMemo)(()=>i.flatMap(e=>e.models.map(t=>({...t,providerLabel:e.label}))),[i]),[o,s]=(0,L.useState)(``),[c,l]=(0,L.useState)(null),[u,d]=(0,L.useState)(!1),[f,p]=(0,L.useState)(null),m=(0,L.useMemo)(()=>{let e=o.trim().toLowerCase();return e?a.filter(t=>`${t.providerLabel} ${t.provider} ${t.label} ${t.id}`.toLowerCase().includes(e)):a},[a,o]),h=async e=>{if(!(!t||u)){d(!0),l(e),p(null);try{await pc(t,{activeModel:{provider:e.provider,id:e.id}}),p(`Selected ${e.provider}/${e.id}.`),await n?.()}catch(e){p(e instanceof Error?e.message:String(e))}finally{d(!1)}}};return(0,R.jsxs)(`div`,{className:`ml-[1.9rem] max-w-3xl border border-[#3a3a3a] bg-[#111111] text-[12px] shadow-lg`,"data-shared-terminal-card":`model`,children:[(0,R.jsx)(`div`,{className:`flex items-center justify-between gap-3 border-b border-[#2a2a2a] px-3 py-2`,children:(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{className:`text-[#d4d4d4]`,children:`Model`}),(0,R.jsxs)(`div`,{className:`text-[11px] text-[#737373]`,children:[`Choose a model from authenticated providers. Use `,(0,R.jsx)(`span`,{className:`text-[#38bdf8]`,children:`/login`}),` to add providers.`]})]})}),(0,R.jsxs)(`div`,{className:`space-y-2 p-3`,children:[i.length?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`label`,{className:`flex items-center gap-2 border border-[#2a2a2a] bg-[#0b0b0b] px-2 py-1 text-[#737373]`,children:[(0,R.jsx)(Rs,{size:13}),(0,R.jsx)(`input`,{value:o,onChange:e=>s(e.target.value),placeholder:`Search models`,className:`min-w-0 flex-1 bg-transparent text-[#d4d4d4] outline-none placeholder:text-[#525252]`})]}),(0,R.jsx)(`div`,{className:`max-h-72 overflow-auto border border-[#2a2a2a]`,children:m.length?m.map(e=>(0,R.jsxs)(`button`,{type:`button`,disabled:u,onClick:()=>void h(e),className:`grid w-full grid-cols-[150px_1fr_auto] gap-2 border-b border-[#1f1f1f] px-3 py-2 text-left hover:bg-[#38bdf8]/10 disabled:opacity-50`,children:[(0,R.jsx)(`span`,{className:`truncate text-[#737373]`,children:e.providerLabel}),(0,R.jsxs)(`span`,{className:`min-w-0`,children:[(0,R.jsx)(`span`,{className:`block truncate text-[#d4d4d4]`,children:e.label}),(0,R.jsxs)(`span`,{className:`block truncate text-[11px] text-[#737373]`,children:[e.provider,`/`,e.id]})]}),c?.provider===e.provider&&c?.id===e.id?(0,R.jsx)(zo,{size:14,className:`text-[#22c55e]`}):null]},`${e.provider}:${e.id}`)):(0,R.jsx)(`div`,{className:`px-3 py-2 text-[#737373]`,children:`No matching models.`})})]}):(0,R.jsxs)(`div`,{className:`text-[#737373]`,children:[`No authenticated model providers found. Run `,(0,R.jsx)(`span`,{className:`text-[#38bdf8]`,children:`/login`}),` first.`]}),f?(0,R.jsx)(`div`,{className:`text-[11px] text-[#a3a3a3]`,children:f}):null]})]})}function B_e(e={}){let t=[],n=[],r=L5(e.warnings),i=L5(e.errors);(e.session?.id||e.session?.title)&&t.push({id:`session`,label:`Session`,value:F5([e.session?.title,e.session?.id].filter(Boolean).join(` | `))}),e.session?.profile&&t.push({id:`profile`,label:`Profile`,value:F5(e.session.profile)}),e.session?.status&&t.push({id:`session-status`,label:`Session status`,value:F5(e.session.status),tone:e.session.status===`error`||e.session.status===`disposed`?`red`:`neutral`}),(e.model?.provider||e.model?.id||e.model?.label)&&t.push({id:`model`,label:`Model`,value:F5(e.model.label??[e.model.provider,e.model.id].filter(Boolean).join(`/`))}),e.runtime?.state&&t.push({id:`runtime`,label:`Runtime`,value:F5(e.runtime.state),tone:e.runtime.connected===!1||e.runtime.disposed?`red`:`green`}),e.runtime?.disposed!==void 0&&t.push({id:`disposed`,label:`Disposed`,value:e.runtime.disposed?`yes`:`no`,tone:e.runtime.disposed?`red`:`neutral`}),typeof e.runtime?.queuedMessages==`number`&&t.push({id:`queue`,label:`Queue`,value:String(e.runtime.queuedMessages)}),e.runtime?.processing!==void 0&&t.push({id:`processing`,label:`Processing`,value:e.runtime.processing?`yes`:`no`,tone:e.runtime.processing?`cyan`:`neutral`}),e.runtime?.streaming!==void 0&&t.push({id:`streaming`,label:`Streaming`,value:e.runtime.streaming?`yes`:`no`,tone:e.runtime.streaming?`cyan`:`neutral`}),e.cwd&&t.push({id:`cwd`,label:`CWD`,value:F5(e.cwd)});let a=typeof e.thinking==`string`?{level:e.thinking}:e.thinking;(a?.level||a?.supported!==void 0)&&t.push({id:`thinking`,label:`Thinking`,value:F5(a.level??(a.supported===!1?`unsupported`:`available`)),tone:a.supported===!1?`red`:`yellow`}),e.fastMode!==void 0&&t.push({id:`fast-mode`,label:`Fast mode`,value:typeof e.fastMode==`string`?F5(e.fastMode):e.fastMode?`on`:`off`,tone:e.fastMode?`green`:`neutral`});let o=L5(e.tools?.enabled),s=L5(e.tools?.active);o.length&&t.push({id:`enabled-tools`,label:`Enabled tools`,value:`${o.length}${o.length<=4?` (${o.join(`, `)})`:``}`}),s.length&&t.push({id:`active-tools`,label:`Active tools`,value:`${s.length}${s.length<=4?` (${s.join(`, `)})`:``}`,tone:`cyan`}),e.providerUsage?.planType&&t.push({id:`provider-plan`,label:`Provider plan`,value:F5(e.providerUsage.planType)}),e.providerUsage?.credits&&t.push({id:`provider-credits`,label:`Credits`,value:e.providerUsage.credits.unlimited?`unlimited`:F5(e.providerUsage.credits.balance??`available`)}),e.message&&t.push({id:`message`,label:`Message`,value:F5(e.message)}),n.push(V_e(e.contextUsage));for(let t of H_e(e.providerUsage))n.push(t);return{kind:`status`,title:`Status`,fields:t,progress:n,warnings:r,errors:i}}function F5(e){return e.replace(/\b([A-Z0-9_]*(?:API[_-]?KEY|TOKEN|SECRET|PASSWORD)[A-Z0-9_]*)\s*=\s*([^\s]+)/gi,`$1=[redacted]`).replace(/\b(api[_-]?key|token|secret|password)\s*[:=]\s*([^\s]+)/gi,`$1=[redacted]`).replace(/\b(?:sk|pk|pibo|ghp|github_pat)_[A-Za-z0-9_\-]{8,}\b/g,`[redacted]`)}function V_e(e){if(!e||e.tokens===void 0&&e.contextWindow===void 0&&e.percent===void 0)return{id:`context`,label:`Context`,state:`unavailable`,text:`Context usage unavailable`,tone:`neutral`};let t=I5(e.percent??(e.tokens!==void 0&&e.contextWindow?e.tokens/e.contextWindow*100:void 0));return{id:`context`,label:`Context`,state:t===void 0?`unavailable`:`available`,value:e.tokens,max:e.contextWindow,percent:t,text:t===void 0?`Context usage unavailable`:`${e.tokens??`?`}/${e.contextWindow??`?`} tokens (${t.toFixed(1)}%)`,tone:U_e(t)}}function H_e(e){return e?.limits?.length?e.limits.map((t,n)=>{let r=I5(t.usedPercent),i=I5(t.remainingPercent??(r===void 0?void 0:100-r)),a=e.provider?`${e.provider} `:``,o=[i===void 0?void 0:`${i.toFixed(1)}% remaining`,t.resetsAt?`resets ${F5(t.resetsAt)}`:void 0].filter(Boolean).join(`, `);return{id:`provider-${n}`,label:`${a}${t.label??`quota`}`.trim(),state:i===void 0?`unavailable`:`available`,percent:i,text:i===void 0?`Provider usage unavailable`:o,tone:W_e(i)}}):[{id:`provider`,label:`Provider quota`,state:`unavailable`,text:`Provider usage unavailable`,tone:`neutral`}]}function I5(e){if(!(typeof e!=`number`||!Number.isFinite(e)))return Math.max(0,Math.min(100,e))}function U_e(e){return e===void 0?`neutral`:e>=80?`red`:e>=50?`yellow`:`green`}function W_e(e){return e===void 0?`neutral`:e<=20?`red`:e<=50?`yellow`:`green`}function L5(e){return(e??[]).map(e=>F5(e)).filter(e=>e.length>0)}function G_e(e){switch(e.kind){case`tool.status`:return K_e(e);case`tool.thinking`:return q_e(e);case`tool.model`:return J_e(e);case`tool.login`:return Y_e(e);case`tool.call`:case`tool.image`:case`tool.group.exploring`:case`tool.group.images`:return X_e(e);case`yielded.run`:return R5(e,`yielded-run`,`Yielded run`,e.status===`error`?`red`:e.status===`running`?`cyan`:`green`);case`execution.compaction`:return R5(e,`compaction`,e.status===`error`?`Compaction failed`:e.status===`running`?`Compacting`:`Compaction`,e.status===`error`?`red`:`magenta`);case`execution.command`:return R5(e,`command`,`Command`,e.status===`error`?`red`:`yellow`);case`error`:return R5(e,`error`,`Error`,`red`);default:return}}function K_e(e){let t=z5(e.output),n=B5(t,`activeModel`)??B5(t,`model`),r=B_e({session:{id:U5(t,`piboSessionId`)??U5(t,`sessionId`),title:U5(t,`sessionTitle`)??U5(t,`title`),profile:U5(t,`profile`)??U5(t,`activeAgentId`)??U5(t,`agentId`),status:W5(t,`disposed`)?`disposed`:U5(t,`sessionStatus`)},model:n?{provider:U5(n,`provider`),id:U5(n,`id`),label:U5(n,`label`)}:void 0,runtime:{state:W5(t,`disposed`)?`disposed`:W5(t,`processing`)?`processing`:W5(t,`streaming`)?`streaming`:U5(t,`mode`)??`idle`,connected:W5(t,`connected`),queuedMessages:Q_e(t,`queuedMessages`),processing:W5(t,`processing`),streaming:W5(t,`streaming`),disposed:W5(t,`disposed`)},cwd:U5(t,`cwd`),contextUsage:B5(t,`contextUsage`),providerUsage:B5(t,`providerUsage`),tools:{enabled:H5(t,`enabledTools`),active:H5(t,`activeTools`)},thinking:U5(t,`thinkingLevel`)?{level:U5(t,`thinkingLevel`)}:void 0,fastMode:W5(t,`fastMode`),warnings:H5(t,`warnings`),errors:H5(t,`errors`),message:U5(t,`message`)});return{id:e.id,kind:`status`,title:`Status`,status:e.status,tone:e.status===`error`?`red`:`green`,rows:r.fields.map(e=>({label:e.label,value:e.value,tone:e.tone})),statusView:r,sourceRowKind:e.kind}}function q_e(e){let t=z5(e.output),n=U5(t,`level`)??`unknown`,r=t?.supported!==!1,i=H5(t,`availableLevels`);return{id:e.id,kind:`thinking`,title:`Thinking`,status:e.status,tone:r?`yellow`:`red`,rows:[{label:`Current`,value:F5(n)},{label:`Supported`,value:r?`yes`:`no`,tone:r?`green`:`red`}],actions:i.map(e=>({id:`thinking:${e}`,label:e,action:`thinking.set`,value:e,disabled:!r})),sourceRowKind:e.kind}}function J_e(e){let t=V5(z5(e.output),`providers`),n=t.flatMap(e=>{let t=U5(e,`id`)??U5(e,`provider`)??`provider`,n=U5(e,`label`)??U5(e,`name`)??t;return V5(e,`models`).map(e=>{let r=U5(e,`id`)??`model`,i=U5(e,`label`)??r;return{id:`model:${t}:${r}`,label:`${n} / ${i}`,action:`model.select`,value:`${t}/${r}`}})});return{id:e.id,kind:`model`,title:`Model`,status:e.status,tone:n.length?`cyan`:`neutral`,rows:[{label:`Providers`,value:String(t.length)},{label:`Models`,value:String(n.length)}],actions:n,sourceRowKind:e.kind}}function Y_e(e){let t=V5(z5(e.output),`providers`),n=t.map(e=>{let t=U5(e,`id`)??`provider`;return{id:`login:${t}`,label:U5(e,`name`)??U5(e,`label`)??t,action:`login.selectProvider`,value:t,description:H5(e,`authMethods`).join(`, `)}});return{id:e.id,kind:`login`,title:`Login`,status:e.status,tone:n.length?`cyan`:`neutral`,rows:[{label:`Providers`,value:String(t.length)}],actions:n,sourceRowKind:e.kind}}function X_e(e){return R5(e,`tool`,e.kind===`tool.group.exploring`?`Exploring`:e.kind===`tool.image`||e.kind===`tool.group.images`?`Image`:`Tool`,e.status===`error`?`red`:e.status===`running`?`cyan`:`green`)}function R5(e,t,n,r){let i=e.lines.flatMap(e=>{let t=`${e.tokens.map(e=>e.text).join(``)}${e.functionCall?`${e.functionCall.name}${e.functionCall.input===void 0?``:` ${Z_e(e.functionCall.input)}`}`:``}`.trim();return t?[{value:F5(t)}]:[]}),a=e.lines.length===0&&typeof e.output==`string`&&e.output.trim()?[{value:F5(e.output.trim())}]:[],o=[e.error?{label:`Error`,value:F5(e.error),tone:`red`}:void 0].filter(e=>!!e);return{id:e.id,kind:t,title:n,status:e.status,tone:r,rows:[...i,...a,...o],sourceRowKind:e.kind}}function Z_e(e){try{return JSON.stringify(e)}catch{return String(e)}}function z5(e){if(e){if(typeof e==`string`)try{let t=JSON.parse(e);return t&&typeof t==`object`&&!Array.isArray(t)?t:void 0}catch{return}return typeof e==`object`&&!Array.isArray(e)?e:void 0}}function B5(e,t){let n=e?.[t];return n&&typeof n==`object`&&!Array.isArray(n)?n:void 0}function V5(e,t){let n=e?.[t];return Array.isArray(n)?n.filter(e=>!!e&&typeof e==`object`&&!Array.isArray(e)):[]}function H5(e,t){let n=e?.[t];return Array.isArray(n)?n.filter(e=>typeof e==`string`):[]}function U5(e,t){let n=e?.[t];return typeof n==`string`?n:void 0}function Q_e(e,t){let n=e?.[t];return typeof n==`number`&&Number.isFinite(n)?n:void 0}function W5(e,t){let n=e?.[t];return typeof n==`boolean`?n:void 0}function $_e(e,t){return e?Dve(wve(G5(e.nodes).sort((e,t)=>a4(e.node,t.node)).filter(e=>e.node.type!==`agent.turn`&&(t.showThinking||e.node.type!==`model.reasoning`)).map(e=>eve(e.node,e.turnId)))).map(e=>e.row):[]}function G5(e,t){let n=[];for(let r of e)r.type!==`agent.turn`&&n.push({node:r,turnId:t}),n.push(...G5(r.children,r.type===`agent.turn`?r.id:t));return n}function eve(e,t){let n;switch(e.type){case`user.message`:n={row:nve(e),turnId:t};break;case`assistant.message`:n={row:rve(e),turnId:t};break;case`model.reasoning`:n={row:ive(e),turnId:t};break;case`tool.call`:n=ave(e,t);break;case`tool.result`:n=ove(e,t);break;case`agent.delegation`:n={row:cve(e),turnId:t};break;case`agent.async`:n={row:lve(e),turnId:t};break;case`yielded.run`:n={row:uve(e),turnId:t};break;case`execution.command`:n={row:fve(e),turnId:t};break;case`execution.compaction`:n={row:dve(e),turnId:t};break;case`error`:n={row:Sve(e),turnId:t};break;case`agent.turn`:n={row:{id:e.id,kind:`error`,status:`neutral`,lines:[],sourceNodeIds:[e.id]},turnId:t};break}return{...n,row:{...n.row,...tve(e)}}}function tve(e){return{eventId:e.eventId,runId:e.runId,orderSource:e.source,orderStreamId:e.orderKey?.streamId,orderStreamFrameIndex:e.orderKey?.streamFrameIndex}}function nve(e){let t=u7(e.output)||u7(e.summary)||e.title;return{id:e.id,kind:`message.user`,status:s7(e.status),lines:[{prefix:`prompt`,tokens:[l7(t)]}],sourceNodeIds:[e.id],forkEntryId:e.entryId,output:t}}function rve(e){return{id:e.id,kind:`message.assistant`,status:s7(e.status),lines:[],sourceNodeIds:[e.id],output:u7(e.output)||u7(e.summary)||``,error:e.error}}function ive(e){let t=i7(e.output??e.summary);return{id:e.id,kind:`reasoning`,status:s7(e.status),lines:[{prefix:`bullet`,tokens:[l7(e.status===`running`?`Thinking`:`Thought`,`amber`,`semibold`)]}],sourceNodeIds:[e.id],markdown:t}}function ave(e,t){let n=o7(e.input);if(n&&Ive(e.title))return{row:xve(e,n),turnId:t,exploring:void 0};let r=Y5(e);if(r)return{row:K5(e,r),turnId:t,image:r.groupable?r.detail:void 0};let i=n7(e.error??e.output,5,e.error?`red`:`dim`);return{row:{id:e.id,kind:`tool.call`,status:s7(e.status),errorKind:e.status===`error`?`tool`:void 0,lines:[{prefix:`bullet`,tokens:[l7(Rve(e.status),c7(e.status),`semibold`),l7(` `)],functionCall:{name:e.title,input:e.input}},...i.lines],sourceNodeIds:[e.id],input:e.input,output:e.output,error:e.error,expandable:e.input!==void 0||e.output!==void 0||!!e.error,previewOmission:r7(i,e.error?`error`:`output`)},turnId:t,exploring:Fve(e)}}function K5(e,t){let n=s7(e.status),r=t.path?`Path: ${t.path}`:t.artifactId?`Artifact: ${t.artifactId}`:t.query?`Query: ${t.query}`:t.mimeType?`Type: ${t.mimeType}`:`Image content returned`;return{id:e.id,kind:`tool.image`,status:n,errorKind:e.status===`error`?`tool`:void 0,lines:[{prefix:`bullet`,tokens:[l7(t.verb,c7(e.status),`semibold`)]},{prefix:`detail`,tokens:[l7(r,e.status===`error`?`red`:`cyan`)]}],sourceNodeIds:[e.id],input:Z5(e.input),output:t.summary,error:e.error,expandable:e.input!==void 0||t.summary!==void 0||!!e.error}}function ove(e,t){let n=Y5(e);return n?{row:K5(e,n),turnId:t,image:n.groupable?n.detail:void 0}:{row:sve(e),turnId:t}}function sve(e){let t=n7(e.error??e.output,5,e.error?`red`:`dim`);return{id:e.id,kind:`tool.call`,status:s7(e.status),errorKind:e.status===`error`?`tool`:void 0,lines:[{prefix:`bullet`,tokens:[l7(e.status===`error`?`Tool failed`:`Returned`,c7(e.status),`semibold`),l7(` ${e.title}`)]},...t.lines],sourceNodeIds:[e.id],output:e.output,error:e.error,expandable:e.output!==void 0||!!e.error,previewOmission:r7(t,e.error?`error`:`output`)}}function cve(e){let t=u7(d7(e.input)?e.input.subagentName:void 0)||e.summary||e.title,n=a7((d7(e.input)?e.input.arguments:void 0)??e.input),r=n?[{prefix:`detail`,tokens:[l7(n,`dim`)]}]:[];return{id:e.id,kind:`agent.delegation`,status:s7(e.status),lines:[{prefix:`bullet`,tokens:[l7(zve(e.status),c7(e.status),`semibold`),l7(` ${t}`,`cyan`)]},...r],sourceNodeIds:[e.id],linkedPiboSessionId:e.linkedPiboSessionId,input:e.input,output:e.output,error:e.error,expandable:e.input!==void 0||e.output!==void 0||!!e.error}}function lve(e){let t=n7(e.error??e.output,5,e.error?`red`:`dim`);return{id:e.id,kind:`agent.async`,status:s7(e.status),lines:[{prefix:`bullet`,tokens:[l7(Bve(e.status),c7(e.status),`semibold`),l7(` ${e.title}`,`cyan`)]},...t.lines],sourceNodeIds:[e.id],linkedPiboSessionId:e.linkedPiboSessionId,input:e.input,output:e.output,error:e.error,expandable:e.input!==void 0||e.output!==void 0||!!e.error,previewOmission:r7(t,e.error?`error`:`output`)}}function uve(e){let t=n7(e.output,5);return{id:e.id,kind:`yielded.run`,status:s7(e.status),errorKind:e.status===`error`?`tool`:void 0,lines:[{prefix:`bullet`,tokens:[l7(e.status===`running`?`Waiting on runs`:`Run update`,c7(e.status),`semibold`),l7(e.summary?` ${e.summary}`:``)]},...t.lines],sourceNodeIds:[e.id],output:e.output,error:e.error,expandable:e.output!==void 0||!!e.error,previewOmission:r7(t,`output`)}}function dve(e){let t=e.status===`running`?`Compacting`:e.status===`error`?`Compaction failed`:u7(e.summary)||`Compacted`;return{id:e.id,kind:`execution.compaction`,status:s7(e.status),lines:[{prefix:`bullet`,tokens:[l7(t,c7(e.status),e.status===`error`?`bold`:`semibold`)]}],sourceNodeIds:[e.id],input:e.input,output:e.output,error:e.error,expandable:e.input!==void 0||e.output!==void 0||!!e.error}}function fve(e){if(e.title===`status`)return pve(e);if(e.title===`thinking`)return Eve(e.output)?hve(e):mve(e);if(e.title===`fast_mode`)return gve(e);if(e.title===`login`&&yve(e.output))return _ve(e);if(e.title===`model`&&bve(e.output))return vve(e);o7(e.output)??o7(e.input)??e.title;let t=n7(e.error??e.output,5,e.error?`red`:`dim`,180);return{id:e.id,kind:`execution.command`,status:s7(e.status),lines:[{prefix:`bullet`,tokens:[l7(`Command`,`yellow`,`semibold`),l7(` /${e.title}`,`yellow`)]},...t.lines],sourceNodeIds:[e.id],input:e.input,output:e.output,error:e.error,expandable:e.input!==void 0||e.output!==void 0||!!e.error,previewOmission:r7(t,e.error?`error`:`output`)}}function pve(e){return{id:e.id,kind:`tool.status`,status:s7(e.status),lines:[],sourceNodeIds:[e.id],input:e.input,output:e.output,error:e.error,expandable:!1}}function mve(e){return{id:e.id,kind:`tool.thinking`,status:s7(e.status),lines:[],sourceNodeIds:[e.id],input:e.input,output:e.output,error:e.error,expandable:!1}}function hve(e){let t=d7(e.output)?e.output:void 0,n=u7(t?.level),r=t?.changed!==!1,i=t?.supported!==!1,a=i?n?r?`Thinking level set to ${n}.`:`Thinking level is already ${n}.`:`Thinking level updated.`:`Thinking level is not supported by this model.`;return{id:e.id,kind:`execution.command`,status:s7(e.status),lines:[{prefix:`bullet`,tokens:[l7(a,i?`green`:`dim`,`semibold`)]}],sourceNodeIds:[e.id],input:e.input,output:e.output,error:e.error,expandable:!1}}function gve(e){let t=d7(e.output)?e.output:void 0,n=t?.mode===`fast`?`fast`:t?.mode===`normal`?`normal`:void 0,r=t?.changed!==!1,i=t?.supported!==!1,a=i?n===`fast`?r?`Switched to Fast mode.`:`Fast mode is already on.`:n===`normal`?r?`Switched to Normal mode.`:`Normal mode is already on.`:`Fast mode updated.`:`Fast mode is not supported by this model.`;return{id:e.id,kind:`execution.command`,status:s7(e.status),lines:[{prefix:`bullet`,tokens:[l7(a,i?`green`:`dim`,`semibold`)]}],sourceNodeIds:[e.id],input:e.input,output:e.output,error:e.error,expandable:!1}}function _ve(e){return{id:e.id,kind:`tool.login`,status:s7(e.status),lines:[],sourceNodeIds:[e.id],input:e.input,output:e.output,error:e.error,expandable:!1}}function vve(e){return{id:e.id,kind:`tool.model`,status:s7(e.status),lines:[],sourceNodeIds:[e.id],input:e.input,output:e.output,error:e.error,expandable:!1}}function yve(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;return t.action===`show_login_menu`&&Array.isArray(t.providers)}function bve(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;return t.action===`show_model_menu`&&Array.isArray(t.providers)}function xve(e,t){let n=n7(e.error??e.output,5,e.error?`red`:`dim`,180);return{id:e.id,kind:`execution.command`,status:s7(e.status),errorKind:e.status===`error`?`tool`:void 0,lines:[{prefix:`bullet`,tokens:[l7(e.status===`running`?`Running`:`Ran`,c7(e.status),`semibold`),l7(` `),...Lve(t)]},...n.lines],sourceNodeIds:[e.id],input:e.input,output:e.output,error:e.error,expandable:e.input!==void 0||e.output!==void 0||!!e.error,previewOmission:r7(n,e.error?`error`:`output`)}}function Sve(e){return{id:e.id,kind:`error`,status:`error`,errorKind:`system`,lines:[{prefix:`bullet`,tokens:[l7(e.title||`Error`,`red`,`bold`),l7(e.error?` ${e.error}`:``,`red`)]},...Cve(e.input)],sourceNodeIds:[e.id],input:e.input,error:e.error,output:e.output,expandable:e.input!==void 0||e.output!==void 0||!!e.error}}function Cve(e){return d7(e)?[[`Class`,u7(e.errorClass)??u7(e.category)],[`Code`,u7(e.code)??u7(e.providerCode)],[`Origin`,u7(e.origin)],[`Provider`,[u7(e.api),u7(e.provider),u7(e.model)].filter(Boolean).join(` / `)||void 0],[`Retryable`,typeof e.retryable==`boolean`?e.retryable?`yes`:`no`:void 0]].filter(e=>typeof e[1]==`string`&&e[1].length>0).map(([e,t],n)=>({prefix:n===0?`detail`:`continuation`,tokens:[l7(`${e}: `,`dim`),l7(t,`red`)]})):[]}function wve(e){let t=e.map(e=>e.row.output).filter(Tve).at(-1);return t?e.map(e=>e.row.kind!==`tool.thinking`||!d7(e.row.output)?e:{...e,row:{...e.row,output:{...e.row.output,level:t.level,availableLevels:t.availableLevels,supported:t.supported}}}):[...e]}function Tve(e){return d7(e)&&typeof e.level==`string`&&Array.isArray(e.availableLevels)}function Eve(e){return d7(e)&&e.action===`set_thinking_level`}function Dve(e){let t=[];for(let n=0;n<e.length;n+=1){let r=e[n],i=q5(r);if(!i){t.push(r);continue}let a=[r],o=n+1;for(;o<e.length&&q5(e[o])===i&&e[o].turnId===r.turnId;)a.push(e[o]),o+=1;if(a.length===1){t.push(r);continue}t.push({row:i===`images`?kve(a):Ove(a),turnId:r.turnId}),n=o-1}return t}function q5(e){if(e.image)return`images`;if(e.exploring)return`exploring`}function Ove(e){let t=J5(e,`exploring`),n=t.slice(0,6),r=Math.max(0,t.length-n.length),i=e[0]?.row,a=i?.id??`exploring`,o=e[e.length-1]?.row.id??a,s=e.some(e=>e.row.status===`running`)?`running`:e.some(e=>e.row.status===`error`)?`error`:`done`;return{id:`group:exploring:${a}:${o}`,kind:`tool.group.exploring`,status:s,errorKind:s===`error`?`tool`:void 0,lines:[{prefix:`bullet`,tokens:[l7(s===`running`?`Exploring`:s===`error`?`Exploring failed`:`Explored`,c7(s),`semibold`)]},...n.map((e,t)=>({prefix:t===0?`detail`:`continuation`,tokens:[l7(e.label,e.status===`error`?`red`:`dim`)]})),...r>0?[{prefix:`continuation`,tokens:[l7(`+${r} more explorations`,`dim`,`normal`,!0)]}]:[]],sourceNodeIds:e.flatMap(e=>e.row.sourceNodeIds),eventId:i?.eventId,runId:i?.runId,orderSource:i?.orderSource,orderStreamId:i?.orderStreamId,orderStreamFrameIndex:i?.orderStreamFrameIndex,detailItems:t,expandable:t.some(e=>e.input!==void 0||e.output!==void 0||!!e.error),previewOmission:r>0?{source:`details`,visibleLineCount:n.length,omittedLineCount:r,totalLineCount:t.length,maxVisibleLineCount:6}:void 0}}function kve(e){let t=J5(e,`images`),n=t.slice(0,6),r=Math.max(0,t.length-n.length),i=e[0]?.row,a=i?.id??`images`,o=e[e.length-1]?.row.id??a,s=e.some(e=>e.row.status===`running`)?`running`:e.some(e=>e.row.status===`error`)?`error`:`done`;return{id:`group:images:${a}:${o}`,kind:`tool.group.images`,status:s,errorKind:s===`error`?`tool`:void 0,lines:[{prefix:`bullet`,tokens:[l7(s===`running`?`Viewing images`:s===`error`?`Image reads failed`:`Viewed images`,c7(s),`semibold`)]},...n.map((e,t)=>({prefix:t===0?`detail`:`continuation`,tokens:[l7(e.label,e.status===`error`?`red`:`cyan`)]})),...r>0?[{prefix:`continuation`,tokens:[l7(`+${r} more image reads`,`dim`,`normal`,!0)]}]:[]],sourceNodeIds:e.flatMap(e=>e.row.sourceNodeIds),eventId:i?.eventId,runId:i?.runId,orderSource:i?.orderSource,orderStreamId:i?.orderStreamId,orderStreamFrameIndex:i?.orderStreamFrameIndex,detailItems:t,expandable:t.some(e=>e.input!==void 0||e.output!==void 0||!!e.error),previewOmission:r>0?{source:`details`,visibleLineCount:n.length,omittedLineCount:r,totalLineCount:t.length,maxVisibleLineCount:6}:void 0}}function J5(e,t){return e.map(e=>{let n=t===`images`?e.image:e.exploring;return{id:e.row.id,label:n?.label??e.row.lines[0]?.tokens.map(e=>e.text).join(``)??e.row.id,status:e.row.status,input:e.row.input,output:e.row.output,error:e.row.error,linkedPiboSessionId:e.row.linkedPiboSessionId,previewOmission:e.row.previewOmission}})}function Y5(e){let t=(e.title??``).trim().toLowerCase(),n=d7(e.input)?e.input:void 0,r=d7(e.output)?e.output:void 0,i=Pve(r,`details`),a=t===`codex_image_generation`?jve(i)??Mve(n):void 0,o=a?u7(i?.savedPath)??$5(i):$5(n)??$5(i)??$5(r),s=a?u7(i?.artifactId):void 0,c=e7(n),l=X5(e.output),u=Q5(t,[`view_image`,`image`,`screenshot`]);if(!l.length&&!u&&!a)return;let d=l.map(e=>e.mimeType).find(e=>!!e),f=Math.max(1,l.length),p={type:l.length>1?`images`:l.length===1?`image`:`image_reference`,toolName:a?e.title:void 0,operation:a,path:o,savedPath:a?o:void 0,artifactId:s,model:a?u7(i?.model):void 0,referencedImageCount:a?t7(i?.referencedImageCount):void 0,query:c,mimeType:d,count:f>1?f:void 0,detail:l.length?`Image data hidden in terminal view.`:`Image path only; binary data is hidden in terminal view.`},m=o??s??c??d??`image`,h=a?Nve(e.status,a):Ave(e.status,f);return{count:f,path:o,artifactId:s,query:c,mimeType:d,verb:h,groupable:!a,summary:p,detail:{id:e.id,label:`${h} ${m}`,status:s7(e.status),input:Z5(e.input),output:p,error:e.error}}}function X5(e,t=0,n=new Set){if(t>5||typeof e!=`object`||!e||n.has(e))return[];if(n.add(e),Array.isArray(e))return e.flatMap(e=>X5(e,t+1,n));let r=e,i=typeof r.type==`string`?r.type.toLowerCase():void 0,a=typeof r.mimeType==`string`?r.mimeType:typeof r.mime_type==`string`?r.mime_type:void 0,o=typeof r.data==`string`||typeof r.image_url==`string`||d7(r.image_url);if((i===`image`||i===`input_image`||i===`output_image`||i===`image_url`)&&(o||a?.startsWith(`image/`))||a?.startsWith(`image/`)&&o)return[{mimeType:a}];let s=[];return`content`in r&&s.push(r.content),`message`in r&&s.push(r.message),`result`in r&&s.push(r.result),`output`in r&&s.push(r.output),s.flatMap(e=>X5(e,t+1,n))}function Z5(e){if(Array.isArray(e))return e.map(Z5);if(!d7(e))return e;let t={};for(let[n,r]of Object.entries(e)){if((n===`data`||n===`image_url`)&&typeof r==`string`&&r.length>120){t[n]=`[hidden ${n}]`;continue}t[n]=Z5(r)}return t}function Ave(e,t){return e===`running`?t>1?`Viewing images`:`Viewing image`:e===`error`?t>1?`Image reads failed`:`Image read failed`:t>1?`Viewed images`:`Viewed image`}function jve(e){let t=u7(e?.operation);return t===`generate`||t===`edit`?t:void 0}function Mve(e){if(!e)return;let t=e.referenced_image_paths;return Array.isArray(t)&&t.length>0||t7(e.num_last_images_to_include)!==void 0?`edit`:`generate`}function Nve(e,t){return t===`edit`?e===`running`?`Editing image`:e===`error`?`Image edit failed`:`Edited image`:e===`running`?`Generating image`:e===`error`?`Image generation failed`:`Generated image`}function Pve(e,t){let n=e?.[t];return d7(n)?n:void 0}function Fve(e){let t=(e.title??``).trim().toLowerCase(),n=d7(e.input)?e.input:void 0;if(Q5(t,[`read`,`open`]))return{id:e.id,label:`Read ${$5(n)??a7(e.input)}`,status:s7(e.status),input:e.input,output:e.output,error:e.error};if(Q5(t,[`list`,`ls`,`glob`]))return{id:e.id,label:`List ${$5(n)??a7(e.input)}`,status:s7(e.status),input:e.input,output:e.output,error:e.error};if(Q5(t,[`search`,`find`,`grep`,`rg`])){let t=e7(n),r=$5(n);return{id:e.id,label:`Search ${t??a7(e.input)}${r?` in ${r}`:``}`,status:s7(e.status),input:e.input,output:e.output,error:e.error}}}function Q5(e,t){return t.some(t=>e===t||e.startsWith(`${t}_`)||e.endsWith(`_${t}`)||e.includes(t))}function $5(e){if(e)for(let t of[`path`,`file`,`filePath`,`filepath`,`url`,`uri`,`cwd`,`pattern`,`glob`]){let n=u7(e[t]);if(n)return n}}function e7(e){if(e)for(let t of[`query`,`pattern`,`text`,`name`,`q`,`regex`]){let n=u7(e[t]);if(n)return n}}function t7(e){return typeof e==`number`&&Number.isFinite(e)?e:void 0}function n7(e,t,n=`dim`,r=160){let i={lines:[],visibleLineCount:0,omittedLineCount:0,totalLineCount:0,maxVisibleLineCount:t},a=i7(e);if(!a)return i;let o=a.split(/\r?\n/).map(e=>e.trimEnd()).filter((e,t,n)=>e.length>0||n.length===1);if(!o.length)return i;let s=o.slice(0,t),c=Math.max(0,o.length-s.length),l=s.map((e,t)=>({prefix:t===0?`detail`:`continuation`,tokens:[l7(e,n)]}));return c>0&&l.push({prefix:`continuation`,tokens:[l7(`+${c} more lines`,`dim`,`normal`,!0)]}),{lines:l,visibleLineCount:s.length,omittedLineCount:c,totalLineCount:o.length,maxVisibleLineCount:t}}function r7(e,t){if(!(e.omittedLineCount<=0))return{source:t,visibleLineCount:e.visibleLineCount,omittedLineCount:e.omittedLineCount,totalLineCount:e.totalLineCount,maxVisibleLineCount:e.maxVisibleLineCount}}function i7(e){let t=b5(e);if(t!==void 0)return t.trim();if(typeof e==`string`)return e.trim();if(e==null)return``;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function a7(e){return(typeof e==`string`?e:i7(e)).replace(/\s+/g,` `).trim()}function Ive(e){let t=(e??``).trim().toLowerCase();return t===`shell`||t===`bash`||t===`terminal`}function o7(e){if(d7(e))for(let t of[`cmd`,`command`,`script`]){let n=u7(e[t]);if(n)return n}}function Lve(e){let t=e.match(/\s+|"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|[^\s]+/g)??[e],n=!1;return t.map(e=>/^\s+$/.test(e)?l7(e):/^(?:&&|\|\||[|;<>]|2>&1)$/.test(e)?l7(e,`red`,`semibold`):e.startsWith(`-`)?l7(e,`magenta`):e.startsWith(`$`)||e.includes(`=`)?l7(e,`yellow`):/^['"]/.test(e)?l7(e,`green`):n?e.includes(`/`)||e.startsWith(`.`)?l7(e,`cyan`):l7(e,`default`):(n=!0,l7(e,`green`,`semibold`)))}function Rve(e){return e===`running`?`Calling`:e===`error`?`Call failed`:`Called`}function zve(e){return e===`running`?`Spawning`:e===`error`?`Spawn failed`:`Spawned`}function Bve(e){return e===`running`?`Waiting for`:`Finished waiting for`}function s7(e){return e===`running`?`running`:e===`error`?`error`:`done`}function c7(e){return e===`running`?`cyan`:e===`error`?`red`:e===`done`?`green`:`default`}function l7(e,t=`default`,n=`normal`,r=!1){return{text:e,tone:t,weight:n,italic:r}}function u7(e){return typeof e==`string`&&e.trim().length?e:void 0}function d7(e){return!!e&&typeof e==`object`&&!Array.isArray(e)}function Vve(e){if(!e)return;let t;if(typeof e==`string`)try{t=JSON.parse(e)}catch{return}else typeof e==`object`&&!Array.isArray(e)&&(t=e);if(!t)return;let n=typeof t.contextUsage==`object`&&t.contextUsage!==null?t.contextUsage:void 0,r=typeof t.providerUsage==`object`&&t.providerUsage!==null?t.providerUsage:void 0,i=Array.isArray(r?.limits)?r.limits.filter(e=>!!e&&typeof e==`object`&&!Array.isArray(e)).map(e=>{let t=typeof e.usedPercent==`number`?e.usedPercent:void 0,n=typeof e.remainingPercent==`number`?e.remainingPercent:t===void 0?0:Math.max(0,Math.min(100,100-t));return{label:typeof e.label==`string`?e.label:`limit`,usedPercent:t??0,remainingPercent:n,resetsAt:typeof e.resetsAt==`string`?e.resetsAt:void 0}}):[],a=typeof r?.credits==`object`&&r.credits!==null?r.credits:void 0;return{piboSessionId:typeof t.piboSessionId==`string`?t.piboSessionId:void 0,queuedMessages:typeof t.queuedMessages==`number`?t.queuedMessages:void 0,processing:typeof t.processing==`boolean`?t.processing:void 0,streaming:typeof t.streaming==`boolean`?t.streaming:void 0,enabledTools:Array.isArray(t.enabledTools)?t.enabledTools.filter(e=>typeof e==`string`):Array.isArray(t.activeTools)?t.activeTools.filter(e=>typeof e==`string`):void 0,activeTools:Array.isArray(t.activeTools)?t.activeTools.filter(e=>typeof e==`string`):void 0,cwd:typeof t.cwd==`string`?t.cwd:void 0,disposed:typeof t.disposed==`boolean`?t.disposed:void 0,contextUsage:n?{tokens:typeof n.tokens==`number`?n.tokens:void 0,contextWindow:typeof n.contextWindow==`number`?n.contextWindow:void 0,percent:typeof n.percent==`number`?n.percent:void 0}:void 0,providerUsage:r&&(i.length>0||a)?{provider:typeof r.provider==`string`?r.provider:void 0,planType:typeof r.planType==`string`?r.planType:void 0,fetchedAt:typeof r.fetchedAt==`string`?r.fetchedAt:void 0,limits:i,credits:a?{unlimited:a.unlimited===!0,balance:typeof a.balance==`string`?a.balance:void 0}:void 0}:void 0}}function f7(e,t,n){return n?{id:e,label:t,value:n}:void 0}function p7({field:e,icon:t}){let n=t===`session`?ms:us;return(0,R.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px]`,"data-shared-status-field":e.id,children:[(0,R.jsx)(n,{size:11,className:`shrink-0 text-[#737373]`}),(0,R.jsxs)(`span`,{className:`shrink-0 text-[#737373]`,children:[e.label,`:`]}),(0,R.jsx)(`span`,{className:`truncate font-mono ${e.id===`session`?`text-[#38bdf8]`:`text-[#d4d4d4]`}`,children:e.value})]})}function m7({progress:e,label:t}){let n=e.percent??0,r=e.tone===`red`?`bg-[#ef4444]`:e.tone===`yellow`?`bg-[#facc15]`:e.tone===`cyan`?`bg-[#38bdf8]`:`bg-[#22c55e]`;return(0,R.jsxs)(`div`,{className:`mt-3 space-y-1`,"data-shared-progress":e.id,"data-shared-progress-state":e.state,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between text-[11px]`,children:[(0,R.jsx)(`span`,{className:`text-[#737373]`,children:t??e.label}),(0,R.jsx)(`span`,{className:`font-mono text-[#d4d4d4]`,children:e.state===`available`?e.text:`unavailable`})]}),e.state===`available`?(0,R.jsx)(`div`,{className:`h-1.5 w-full overflow-hidden rounded-full bg-[#2a2a2a]`,children:(0,R.jsx)(`div`,{className:`h-full rounded-full ${r} transition-all`,style:{width:`${Math.min(Math.max(n,0),100)}%`}})}):null]})}function Hve(e){if(!e)return;let t=new Date(e);if(!Number.isNaN(t.getTime()))return t.toLocaleString(void 0,{weekday:`short`,hour:`2-digit`,minute:`2-digit`})}function Uve({row:e}){let t=Vve(e.output),n=G_e(e),r=n?.kind===`status`?n.statusView:void 0,[i,a]=(0,L.useState)(!1);if(!t||!r)return(0,R.jsx)(`div`,{className:`mt-2 border border-[#2a2a2a] bg-[#111111] px-3 py-2 text-[12px] text-[#d4d4d4]`,"data-pibo-component":`TerminalStatusCard`,"data-pibo-debug":`terminal-status-card`,"data-shared-terminal-card":`status`,children:(0,R.jsx)(`div`,{className:`text-[#737373]`,children:`Status (unparseable)`})});let o=new Map(r.fields.map(e=>[e.id,e])),s=o.get(`session`)??f7(`session`,`Session`,t.piboSessionId),c=o.get(`cwd`)??f7(`cwd`,`CWD`,t.cwd),l=r.progress.find(e=>e.id===`context`),u=r.progress.filter(e=>e.id.startsWith(`provider`)),d=t.providerUsage?.limits.length?t.providerUsage.limits:void 0,f=t.enabledTools??t.activeTools??[],p=r.fields.filter(e=>!new Set([`session`,`cwd`]).has(e.id)),m=t.providerUsage?.provider?`${t.providerUsage.provider} quota`:`Provider quota`;return(0,R.jsxs)(`div`,{className:`mt-2 border border-[#2a2a2a] bg-[#111111] px-3 py-2 text-[12px] text-[#d4d4d4]`,"data-pibo-component":`TerminalStatusCard`,"data-pibo-debug":`terminal-status-card`,"data-shared-terminal-card":`status`,children:[(0,R.jsxs)(`div`,{className:`mb-2 flex items-center gap-2`,children:[(0,R.jsx)(wo,{size:14,className:`text-[#22c55e]`}),(0,R.jsx)(`span`,{className:`font-semibold text-[#d4d4d4]`,children:r.title})]}),(0,R.jsxs)(`div`,{className:`grid grid-cols-1 gap-1.5 sm:grid-cols-2`,children:[s?(0,R.jsx)(p7,{field:s,icon:`session`}):null,c?(0,R.jsx)(p7,{field:c,icon:`cwd`}):null,p.slice(0,8).map(e=>(0,R.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px]`,"data-shared-status-field":e.id,children:[(0,R.jsxs)(`span`,{className:`shrink-0 text-[#737373]`,children:[e.label,`:`]}),(0,R.jsx)(`span`,{className:`truncate font-mono text-[#d4d4d4]`,children:e.value})]},e.id))]}),(0,R.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:[t.processing?(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-1 border border-[#1f4960] px-1.5 py-0.5 text-[11px] text-[#38bdf8]`,children:[(0,R.jsx)(es,{size:10}),` Processing`]}):null,t.streaming?(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-1 border border-[#1f4960] px-1.5 py-0.5 text-[11px] text-[#38bdf8]`,children:[(0,R.jsx)(wo,{size:10}),` Streaming`]}):null,typeof t.queuedMessages==`number`&&t.queuedMessages>0?(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-1 border border-[#3a3a3a] px-1.5 py-0.5 text-[11px] text-[#d4d4d4]`,children:[(0,R.jsx)(vs,{size:10}),` Queued: `,t.queuedMessages]}):null,t.disposed?(0,R.jsx)(`span`,{className:`inline-flex items-center gap-1 border border-[#5f2222] px-1.5 py-0.5 text-[11px] text-[#ef4444]`,children:`Disposed`}):null]}),l?(0,R.jsx)(m7,{progress:l,label:`Context Usage`}):null,u.length?(0,R.jsxs)(`div`,{className:`mt-3 space-y-1.5 border-t border-[#2a2a2a] pt-2`,"data-shared-provider-progress":u.length,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px] text-[#737373]`,"data-shared-status-field":`provider-quota`,children:[(0,R.jsx)(ds,{size:11}),(0,R.jsxs)(`span`,{children:[m,t.providerUsage?.planType?` (${t.providerUsage.planType})`:``]})]}),d?d.map(e=>{let t=Hve(e.resetsAt);return(0,R.jsxs)(`div`,{className:`space-y-1`,"data-shared-progress":`provider-limit:${e.label}`,"data-shared-progress-state":`available`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-2 text-[11px]`,children:[(0,R.jsx)(`span`,{className:`text-[#a3a3a3]`,children:e.label}),(0,R.jsxs)(`span`,{className:`shrink-0 font-mono text-[#d4d4d4]`,children:[e.remainingPercent.toFixed(0),`% left`,t?` · resets ${t}`:``]})]}),(0,R.jsx)(`div`,{className:`h-1.5 w-full overflow-hidden rounded-full bg-[#2a2a2a]`,children:(0,R.jsx)(`div`,{className:`h-full rounded-full bg-[#38bdf8] transition-all`,style:{width:`${Math.min(Math.max(e.remainingPercent,0),100)}%`}})})]},`${e.label}-${e.resetsAt??``}`)}):u.map(e=>(0,R.jsx)(m7,{progress:e},e.id)),t.providerUsage?.credits?(0,R.jsxs)(`div`,{className:`text-[11px] text-[#a3a3a3]`,"data-shared-status-field":`provider-credits`,children:[`Credits: `,t.providerUsage.credits.unlimited?`unlimited`:t.providerUsage.credits.balance??`available`]}):null]}):null,r.warnings.length||r.errors.length?(0,R.jsxs)(`div`,{className:`mt-3 space-y-1 border-t border-[#2a2a2a] pt-2`,children:[r.warnings.map((e,t)=>(0,R.jsxs)(`div`,{"data-shared-status-warning":!0,className:`text-[11px] text-[#facc15]`,children:[`⚠ `,e]},`warning-${t}`)),r.errors.map((e,t)=>(0,R.jsxs)(`div`,{"data-shared-status-error":!0,className:`text-[11px] text-[#ef4444]`,children:[`✕ `,e]},`error-${t}`))]}):null,f.length>0?(0,R.jsxs)(`div`,{className:`mt-3`,children:[(0,R.jsxs)(`button`,{type:`button`,onClick:()=>a(e=>!e),className:`flex items-center gap-1.5 text-[11px] text-[#737373] hover:text-[#d4d4d4]`,children:[(0,R.jsx)(`span`,{className:`text-[#d4d4d4]`,children:i?`▾`:`▸`}),(0,R.jsxs)(`span`,{children:[`Enabled tools (`,f.length,`)`]})]}),i?(0,R.jsx)(`div`,{className:`mt-1.5 flex flex-wrap gap-1`,children:f.map(e=>(0,R.jsx)(`span`,{className:`inline-block rounded-sm border border-[#2a2a2a] bg-[#0b0b0b] px-1.5 py-0.5 font-mono text-[11px] text-[#a3a3a3]`,children:e},e))}):null]}):null]})}function Wve(e){let t;if(typeof e==`string`)try{t=JSON.parse(e)}catch{return}else e&&typeof e==`object`&&!Array.isArray(e)&&(t=e);if(t)return{level:typeof t.level==`string`?t.level:void 0,availableLevels:Array.isArray(t.availableLevels)?t.availableLevels.filter(e=>typeof e==`string`):[],supported:typeof t.supported==`boolean`?t.supported:void 0}}function Gve(e){return _0.includes(e)?e:void 0}function Kve({row:e,onLevelSelect:t}){let n=Wve(e.output);return n?(0,R.jsxs)(`div`,{className:`mt-2 border border-[#2a2a2a] bg-[#111111] px-3 py-2 text-[12px] text-[#d4d4d4]`,"data-shared-terminal-card":`thinking`,children:[(0,R.jsxs)(`div`,{className:`mb-2 flex items-center gap-2`,children:[(0,R.jsx)(Fo,{size:14,className:`text-[#f59e0b]`}),(0,R.jsx)(`span`,{className:`font-semibold text-[#d4d4d4]`,children:`Thinking`}),n.supported===!1?(0,R.jsxs)(`span`,{className:`ml-auto inline-flex items-center gap-1 border border-[#5f2222] px-1.5 py-0.5 text-[11px] text-[#ef4444]`,children:[(0,R.jsx)(Ys,{size:10}),` Unsupported`]}):(0,R.jsxs)(`span`,{className:`ml-auto inline-flex items-center gap-1 border border-[#1f4960] px-1.5 py-0.5 text-[11px] text-[#38bdf8]`,children:[(0,R.jsx)(zo,{size:10}),` Supported`]})]}),(0,R.jsxs)(`div`,{className:`grid gap-1.5 text-[11px]`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(`span`,{className:`text-[#737373]`,children:`Current:`}),(0,R.jsx)(`span`,{className:`font-mono font-semibold text-[#f59e0b]`,children:n.level??`unknown`})]}),n.availableLevels.length?(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,R.jsx)(`span`,{className:`mr-1 text-[#737373]`,children:`Available:`}),n.availableLevels.map(e=>{let r=Gve(e),i=n.supported===!1||!r||!t;return(0,R.jsx)(`button`,{type:`button`,disabled:i,onClick:()=>{r&&t?.(r)},className:`border bg-transparent px-1.5 py-0.5 ${e===n.level?`border-[#f59e0b] text-[#f59e0b]`:`border-[#3a3a3a] text-[#d4d4d4]`} ${i?`cursor-default`:`cursor-pointer`}`,children:e},e)})]}):null,(0,R.jsxs)(`div`,{className:`text-[#737373]`,children:[`Click a level or use `,(0,R.jsx)(`span`,{className:`text-[#f59e0b]`,children:`/thinking <level>`}),`.`]})]})]}):(0,R.jsx)(`div`,{className:`mt-2 border border-[#2a2a2a] bg-[#111111] px-3 py-2 text-[12px] text-[#d4d4d4]`,"data-shared-terminal-card":`thinking`,children:(0,R.jsx)(`div`,{className:`text-[#737373]`,children:`Thinking (unparseable)`})})}var qve=180,Jve={index:`LAST`,align:`end`},Yve={top:2400,bottom:2400},Xve=84,Zve=6;function Qve({traceView:e,selectedTrace:t,isLoading:n,showThinking:r,expandThinking:i,sessionAgentProfile:a,sessionActiveModel:o,selectedSessionStatus:s,selectedSessionSignal:c,sessionBreadcrumbs:l,originSession:u,derivedSessions:d,agentProfiles:f,sessionProfileChangeDisabled:p,onSessionAgentProfileChange:m,onFork:h,onOpenSession:g,onThinkingLevelChange:_,onModelChanged:v}){let y=(0,L.useMemo)(()=>$_e(e,{showThinking:r}),[r,e]),[b,x]=(0,L.useState)(new Set),[S,C]=(0,L.useState)(null),w=(0,L.useRef)({}),T=y.filter(e=>e.status===`running`).length,E=y.filter(e=>_7(e,`user`)).length,D=y.filter(e=>_7(e,`tool`)).length,O=y.filter(e=>_7(e,`system`)).length,k=c?c.isTreeActive:s===`running`||T>0||t?.status===`UNSET`,A=a_e({itemCount:y.length,resetKey:e?.piboSessionId,contentKey:y,atBottomThreshold:qve});(0,L.useEffect)(()=>{x(e=>iye(e,y,i))},[i,y]),(0,L.useEffect)(()=>{let e=new Set(y.map(e=>e.id));C(t=>t&&e.has(t)?t:null);for(let t of[`system`,`tool`,`user`]){let n=w.current[t];n&&!e.has(n)&&delete w.current[t]}},[y]);let j=(0,L.useCallback)(e=>{let t=aye(y,e,w.current[e]);t&&(w.current[e]=t.row.id,C(t.row.id),A.scrollToIndex(t.index,`start`,`fast-smooth`,{fromIndex:t.fromIndex,stagingAlign:e===`tool`?`end`:void 0}),oye(t.row.id))},[y,A]),M=e=>{e.expandable&&x(t=>{let n=new Set(t);return n.has(e.id)?n.delete(e.id):n.add(e.id),n})},N=(0,L.useCallback)((t,n)=>(0,R.jsx)(`div`,{className:`px-4`,children:(0,R.jsx)(eye,{row:n,expanded:b.has(n.id),focused:S===n.id,piboSessionId:e?.piboSessionId??``,onToggle:()=>M(n),onFork:h,onOpenSession:g,onThinkingLevelChange:_,onModelChanged:v})}),[b,S,h,v,g,_,e?.piboSessionId]),P=(0,L.useMemo)(()=>({Footer:k?dye:void 0}),[k]);return(0,R.jsxs)(`section`,{className:`relative min-w-0 flex-1 flex flex-col overflow-hidden bg-[#0b0b0b] text-[#d4d4d4]`,"data-pibo-component":`CompactTerminalSessionView`,"data-pibo-debug":`compact-terminal-session-view`,"data-pibo-session-id":e?.piboSessionId??void 0,children:[(0,R.jsx)($ve,{errorCount:O,toolErrorCount:D,userMessageCount:E,onNavigate:j,sessionAgentProfile:a,sessionActiveModel:o,sessionBreadcrumbs:l,originSession:u,derivedSessions:d,onOpenSession:g}),(0,R.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:e?y.length?(0,R.jsx)(Mge,{ref:A.virtuosoRef,data:y,initialTopMostItemIndex:Jve,increaseViewportBy:Yve,defaultItemHeight:Xve,className:`min-h-0 h-full overflow-x-hidden font-mono text-[12px] leading-[1.45]`,computeItemKey:(e,t)=>t.id,scrollerRef:A.scrollerRef,atBottomStateChange:A.atBottomStateChange,atBottomThreshold:A.atBottomThreshold,followOutput:A.followOutput,totalListHeightChanged:A.totalListHeightChanged,alignToBottom:!0,components:P,itemContent:N},e.piboSessionId):(0,R.jsx)(E7,{isLoading:n,agentProfiles:f,disabled:p,onSelectAgentProfile:m,message:`No visible trace rows yet.`}):(0,R.jsx)(E7,{isLoading:n,agentProfiles:f,disabled:p,onSelectAgentProfile:m})}),A.isSticky?null:(0,R.jsx)(`button`,{type:`button`,onClick:()=>A.stickToBottom(`auto`),title:`Scroll to latest`,"aria-label":`Scroll to latest`,className:`absolute right-4 bottom-4 z-30 inline-flex h-9 w-9 items-center justify-center rounded-sm border border-[#38bdf8] bg-[#111111]/95 text-[#38bdf8] shadow-lg shadow-black/30 hover:bg-[#161616]`,children:(0,R.jsx)(Bo,{size:18})})]})}function $ve({errorCount:e,toolErrorCount:t,userMessageCount:n,onNavigate:r,sessionAgentProfile:i,sessionActiveModel:a,sessionBreadcrumbs:o,originSession:s,derivedSessions:c,onOpenSession:l}){return(0,R.jsxs)(`div`,{className:`border-b border-[#2a2a2a] bg-[#111111] px-4 py-2 text-[11px]`,children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[i?(0,R.jsx)(w7,{tone:`neutral`,children:i}):null,a?(0,R.jsx)(w7,{tone:`purple`,children:a}):null,n>0?(0,R.jsxs)(w7,{tone:`cyan`,label:`${n} user messages · jump to previous user message`,onClick:()=>r(`user`),children:[n,(0,R.jsx)(Ds,{size:12})]}):null,e>0?(0,R.jsxs)(w7,{tone:`red`,label:`${e} errors · jump to previous error`,onClick:()=>r(`system`),children:[e,(0,R.jsx)(Yo,{size:12})]}):null,t>0?(0,R.jsxs)(w7,{tone:`amber`,label:`${t} tool call errors · jump to previous tool error`,onClick:()=>r(`tool`),children:[t,(0,R.jsx)(ps,{size:12})]}):null,s?(0,R.jsxs)(h7,{onClick:()=>l(s.piboSessionId),children:[`Origin `,s.label]}):null,c.map(e=>(0,R.jsxs)(h7,{onClick:()=>l(e.piboSessionId),children:[`Derived `,e.label]},e.piboSessionId))]}),o.length?(0,R.jsx)(`div`,{className:`mt-2 flex flex-wrap items-center gap-1 text-[#737373]`,children:o.map((e,t)=>(0,R.jsxs)(`div`,{className:`flex items-center gap-1`,children:[t>0?(0,R.jsx)(Vo,{size:12,className:`text-[#525252]`}):null,(0,R.jsx)(`button`,{type:`button`,onClick:()=>l(e.piboSessionId),className:`hover:text-[#38bdf8]`,children:e.label})]},e.piboSessionId))}):null]})}function h7({children:e,onClick:t}){return(0,R.jsx)(`button`,{type:`button`,onClick:t,className:`border border-[#3a3a3a] px-2 py-0.5 text-[#38bdf8] hover:border-[#38bdf8]`,children:e})}function eye({row:e,expanded:t,focused:n,piboSessionId:r,onToggle:i,onFork:a,onOpenSession:o,onThinkingLevelChange:s,onModelChanged:c}){let l=!t&&cye(e),u=l?sye(e):e.lines;return(0,R.jsxs)(`div`,{className:rye(e,n),"data-pibo-component":`TerminalRow`,"data-pibo-debug":`terminal-row`,"data-pibo-terminal-row":`true`,"data-row-id":e.id,"data-row-kind":e.kind,"data-row-status":e.status,"data-trace-node-id":e.sourceNodeIds.join(` `),"data-event-id":e.eventId,"data-run-id":e.runId,"data-order-source":e.orderSource,"data-order-stream-id":e.orderStreamId,"data-order-frame-index":e.orderStreamFrameIndex,onDoubleClick:e.expandable?t=>{!e.expandable||v7(t)||i()}:void 0,onKeyDown:e.expandable?t=>{!e.expandable||v7(t)||(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),i())}:void 0,role:e.expandable?`button`:void 0,tabIndex:e.expandable||n?0:void 0,"aria-expanded":e.expandable?t:void 0,"aria-current":n?`true`:void 0,children:[(0,R.jsxs)(`div`,{className:`flex gap-3`,children:[(0,R.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,R.jsx)(tye,{row:e,visibleLines:u,collapseToolCallPreview:l,piboSessionId:r,onThinkingLevelChange:s,onModelChanged:c})}),(0,R.jsx)(nye,{row:e,onFork:a,onOpenSession:o})]}),t?(0,R.jsx)(v_e,{row:e,onOpenSession:o}):null]})}function tye({row:e,visibleLines:t,collapseToolCallPreview:n,piboSessionId:r,onThinkingLevelChange:i,onModelChanged:a}){return e.kind===`message.assistant`?(0,R.jsx)(`div`,{className:`ml-[1.9rem] min-w-0`,"data-pibo-component":`TerminalAssistantMessage`,children:(0,R.jsx)(`div`,{className:`compact-terminal-markdown`,"data-pibo-component":`MarkdownRendererHost`,"data-pibo-markdown-kind":`assistant-message`,children:(0,R.jsx)(nQ,{streaming:e.status===`running`,children:typeof e.output==`string`?e.output:``})})}):e.kind===`tool.status`?(0,R.jsx)(Uve,{row:e}):e.kind===`tool.thinking`?(0,R.jsx)(Kve,{row:e,onLevelSelect:i}):e.kind===`tool.login`?(0,R.jsx)(F_e,{row:e,piboSessionId:r}):e.kind===`tool.model`?(0,R.jsx)(z_e,{row:e,piboSessionId:r,onModelChanged:a}):e.kind===`execution.compaction`&&e.status===`running`?(0,R.jsx)(pye,{}):e.kind===`reasoning`&&e.markdown?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(g7,{lines:t,status:e.status,clampPreview:n}),(0,R.jsx)(`div`,{className:`ml-[1.9rem] min-w-0`,"data-pibo-component":`TerminalReasoningMarkdown`,children:(0,R.jsx)(`div`,{className:`compact-terminal-markdown compact-terminal-reasoning`,"data-pibo-component":`MarkdownRendererHost`,"data-pibo-markdown-kind":`reasoning`,children:(0,R.jsx)(nQ,{streaming:e.status===`running`,children:e.markdown})})})]}):(0,R.jsx)(g7,{lines:t,status:e.status,clampPreview:n})}function g7({lines:e,status:t,clampPreview:n}){return e.map((e,r)=>(0,R.jsx)(w_e,{line:e,status:t,clampLines:n&&r===0?5:void 0},r))}function nye({row:e,onFork:t,onOpenSession:n}){return(0,R.jsxs)(`div`,{className:`flex shrink-0 items-start gap-1 transition-opacity ${e.forkEntryId?`opacity-100`:`opacity-0 group-hover:opacity-100 group-focus-within:opacity-100`}`,children:[e.linkedPiboSessionId?(0,R.jsx)(T7,{label:`Open linked session`,onClick:()=>n(e.linkedPiboSessionId),children:`Open`}):null,e.forkEntryId?(0,R.jsxs)(T7,{label:`Fork from this user message`,onClick:()=>t(e.forkEntryId),children:[(0,R.jsx)(fs,{size:13}),`Fork`]}):null]})}function rye(e,t=!1){let n=e.kind===`message.user`?`group border-b border-[#141414] bg-[#11a4d4]/10 py-2 last:border-b-0 hover:bg-[#11a4d4]/15`:e.kind===`execution.command`?`group border-b border-[#141414] bg-[#f59e0b]/5 py-2 last:border-b-0 hover:bg-[#f59e0b]/10`:`group border-b border-[#141414] py-2 last:border-b-0 hover:bg-[#161616]`,r=e.expandable||t?` focus:outline-none focus:ring-1 focus:ring-[#38bdf8]/50`:``;return t?`${n}${r} ring-1 ring-[#38bdf8] bg-[#123040]`:`${n}${r}`}function iye(e,t,n){let r=new Set;for(let i of t)e.has(i.id)&&r.add(i.id),n&&i.kind===`reasoning`&&i.expandable&&r.add(i.id);return hye(e,r)?e:r}function _7(e,t){return t===`user`?e.kind===`message.user`:e.status===`error`?t===`tool`?e.errorKind===`tool`:e.errorKind!==`tool`:!1}function aye(e,t,n){let r=e.map((e,t)=>({row:e,index:t})).filter(({row:e})=>_7(e,t));if(!r.length)return;let i=n?e.findIndex(e=>e.id===n):-1,a=i>=0?i:e.length;return{...r.filter(e=>e.index<a).at(-1)??r[r.length-1],fromIndex:a}}function oye(e){let t=0,n=()=>{let r=Array.from(document.querySelectorAll(`[data-pibo-component="TerminalRow"]`)).find(t=>t.dataset.rowId===e);if(r){r.scrollIntoView({block:`start`,inline:`nearest`,behavior:`smooth`}),r.focus({preventScroll:!0});return}t+=1,t<8&&requestAnimationFrame(n)};requestAnimationFrame(()=>requestAnimationFrame(n))}function sye(e){return e.kind===`tool.group.exploring`||e.kind===`tool.group.images`?e.lines.slice(0,Zve):e.lines}function cye(e){return!!e.expandable&&(e.kind===`tool.call`||e.kind===`tool.image`||e.kind===`tool.group.exploring`||e.kind===`tool.group.images`||e.kind===`agent.delegation`||e.kind===`agent.async`||e.kind===`yielded.run`||e.kind===`execution.command`||e.kind===`execution.compaction`)}function v7(e){let t=e.target;if(!(t instanceof Element)||t===e.currentTarget)return!1;let n=t.closest(`button, a, input, textarea, select, summary, [role='button'], [tabindex]:not([tabindex='-1'])`);return!!(n&&n!==e.currentTarget)}var lye=`Working...`,y7=33,uye=126;function dye(){let{chars:e,activeIndex:t}=fye(lye);return(0,R.jsx)(`div`,{className:`border-t border-[#141414] px-4 py-2`,role:`status`,"aria-live":`polite`,"aria-label":`Working`,children:(0,R.jsxs)(`div`,{className:`grid grid-cols-[1.9rem_minmax(0,1fr)] gap-2 whitespace-pre-wrap break-words`,children:[(0,R.jsx)(`span`,{className:`whitespace-pre text-[#737373]`,children:`•`}),(0,R.jsx)(`span`,{className:`compact-terminal-working-scramble`,"aria-hidden":`true`,children:e.map((e,n)=>(0,R.jsx)(`span`,{className:n===t?`compact-terminal-working-scramble-active`:void 0,children:e},n))})]})})}function fye(e){let t=(0,L.useMemo)(()=>Array.from(e),[e]),[n,r]=(0,L.useState)(()=>x7(t)),[i,a]=(0,L.useState)(0);return(0,L.useEffect)(()=>{let e=0,n=0,i=C7(),o=0;r(x7(t));let s=window.setInterval(()=>{if(o>0){o--;return}if(e>=t.length){e=0,n=0,i=C7(),r(x7(t)),a(0);return}let s=e,c=t[s]??` `;if(a(s),n++,n<i){r(e=>b7(e,s,S7(c)));return}r(e=>b7(e,s,c)),e++,n=0,i=C7(),e>=t.length&&(r(t),a(-1),o=18)},55);return()=>window.clearInterval(s)},[t]),{chars:n,activeIndex:i}}function b7(e,t,n){let r=[...e];return r[t]=n,r}function x7(e){return e.map(e=>S7(e))}function S7(e){let t=``;do{let e=y7+Math.floor(Math.random()*(uye-y7+1));t=String.fromCharCode(e)}while(t===e);return t}function C7(){return 2+Math.floor(Math.random()*11)}function pye(){let e=mye();return(0,R.jsxs)(`div`,{className:`grid grid-cols-[1.9rem_minmax(0,1fr)] gap-2 whitespace-pre-wrap break-words`,children:[(0,R.jsx)(`span`,{className:`whitespace-pre text-[#38bdf8]`,children:`•`}),(0,R.jsxs)(`span`,{className:`min-w-0`,children:[(0,R.jsx)(`span`,{className:`font-semibold text-[#38bdf8]`,children:`Compacting`}),(0,R.jsx)(`span`,{className:`text-[#38bdf8]`,children:e})]})]})}function mye(){let[e,t]=(0,L.useState)(0);return(0,L.useEffect)(()=>{let e=window.setInterval(()=>t(e=>(e+1)%4),400);return()=>window.clearInterval(e)},[]),`.`.repeat(e)}function w7({tone:e,label:t,onClick:n,children:r}){let i=`inline-flex items-center gap-1 border px-2 py-0.5 ${e===`cyan`?`border-[#1f4960] text-[#38bdf8]`:e===`red`?`border-[#5f2222] text-[#ef4444]`:e===`amber`?`border-[#6b4e16] text-[#f59e0b]`:e===`purple`?`border-purple-500/40 text-purple-300`:`border-[#3a3a3a] text-[#d4d4d4]`}`;return n?(0,R.jsx)(`button`,{type:`button`,onClick:n,className:`${i} hover:bg-white/5 focus:outline-none focus:ring-1 focus:ring-[#38bdf8]`,title:t,"aria-label":t,children:r}):(0,R.jsx)(`span`,{className:i,title:t,"aria-label":t,children:r})}function T7({label:e,onClick:t,children:n}){return(0,R.jsx)(`button`,{type:`button`,onClick:t,"aria-label":e,title:e,className:`inline-flex min-h-7 min-w-7 items-center gap-1 border border-[#3a3a3a] px-2 text-[11px] text-[#737373] hover:border-[#38bdf8] hover:text-[#38bdf8]`,children:n})}function E7({isLoading:e,agentProfiles:t,disabled:n,onSelectAgentProfile:r,message:i}){return(0,R.jsxs)(`div`,{className:`flex min-h-full flex-col items-center justify-center gap-4 px-6 py-10 text-center text-[12px] text-[#737373]`,children:[(0,R.jsx)(`div`,{children:e?`Loading trace…`:i??`No trace selected.`}),t.length?(0,R.jsx)(`div`,{className:`flex flex-wrap items-center justify-center gap-2`,children:t.map(e=>(0,R.jsx)(`button`,{type:`button`,disabled:n,onClick:()=>r(e.name),className:`border border-[#3a3a3a] px-2 py-1 text-[#d4d4d4] hover:border-[#38bdf8] hover:text-[#38bdf8] disabled:opacity-50`,children:e.name},e.name))}):null]})}function hye(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function gye({traceView:e,isLoading:t,selectedSessionStatus:n,selectedSessionSignal:r,workflowProjectSession:i,workflowLifecycleEvents:a,sessionNodes:o,onOpenSession:s,onRefreshBootstrap:c,onError:l}){let u=i?Oye(i,e,n,r,a??[],o):null;return u?(0,R.jsx)(`section`,{className:`min-w-0 flex-1 overflow-auto bg-[#0b0f14] p-4 text-slate-300`,children:(0,R.jsxs)(`div`,{className:`mx-auto flex max-w-6xl flex-col gap-4`,children:[(0,R.jsx)(_ye,{model:u}),(0,R.jsx)(D7,{}),(0,R.jsx)(vye,{model:u,onRefreshBootstrap:c,onError:l}),(0,R.jsx)(bye,{model:u}),(0,R.jsx)(xye,{model:u,onOpenSession:s}),(0,R.jsx)(Sye,{nodes:u.nodes,edges:u.edges}),(0,R.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-[minmax(0,1fr)_360px]`,children:[(0,R.jsx)(wye,{model:u}),(0,R.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-4`,children:[(0,R.jsx)(Tye,{model:u}),(0,R.jsx)(Eye,{model:u}),(0,R.jsx)(Dye,{model:u})]})]})]})}):(0,R.jsx)(`section`,{className:`min-w-0 flex-1 overflow-auto bg-[#0b0f14] p-4 text-slate-300`,children:(0,R.jsxs)(`div`,{className:`mx-auto flex max-w-4xl flex-col gap-4`,children:[(0,R.jsxs)(`div`,{className:`rounded-sm border border-slate-800 bg-[#111820] p-4`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-slate-100`,children:[(0,R.jsx)(vs,{size:16,className:`text-[#11a4d4]`}),`Workflow / XState`]}),(0,R.jsx)(`p`,{className:`mt-2 text-sm text-slate-400`,children:t?`Loading session trace…`:`This session is not linked to a workflow run, so no Workflow/XState projection is available.`})]}),(0,R.jsx)(D7,{})]})})}function _ye({model:e}){return(0,R.jsxs)(`div`,{className:`rounded-sm border border-slate-800 bg-[#111820] p-4`,children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,R.jsxs)(`div`,{className:`min-w-0`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-slate-100`,children:[(0,R.jsx)(vs,{size:16,className:`text-[#11a4d4]`}),`Workflow / XState Projection`]}),(0,R.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-xs`,children:[(0,R.jsx)(X7,{tone:`blue`,children:e.workflowId}),e.workflowRunId?(0,R.jsxs)(X7,{tone:`slate`,children:[`run `,$7(e.workflowRunId)]}):null,(0,R.jsx)(X7,{tone:Yye(e.status),children:e.state})]})]}),(0,R.jsxs)(`div`,{className:`min-w-0 text-right font-mono text-[11px] text-slate-500`,children:[(0,R.jsxs)(`div`,{className:`truncate`,children:[`session `,$7(e.piboSessionId)]}),e.latestStreamId===void 0?null:(0,R.jsxs)(`div`,{children:[`stream `,e.latestStreamId]})]})]}),(0,R.jsx)(`p`,{className:`mt-3 text-sm text-slate-400`,children:`Dedicated Project workflow execution surface. This view derives the current XState-style UI snapshot from project-session workflow linkage and live session state while keeping kernel records as durable truth.`})]})}function D7(){return(0,R.jsx)(`div`,{className:`rounded-sm border border-amber-500/30 bg-amber-500/10 p-4 text-sm`,children:(0,R.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,R.jsxs)(`div`,{className:`min-w-0`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-bold uppercase tracking-wider text-amber-200`,children:[(0,R.jsx)(Gs,{size:14}),`Workflow IR source-of-truth boundary`]}),(0,R.jsx)(`p`,{className:`mt-2 max-w-3xl text-xs leading-5 text-amber-100/80`,children:`Projects inspect configured sessions, workflow runs, and the XState-style projection derived from Pibo Workflow IR. Authoring stays in the Workflows tab; raw XState editing and inline executable code are not exposed here.`})]}),(0,R.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:[(0,R.jsx)(`span`,{className:`rounded border border-amber-500/40 bg-[#0b0f14]/50 px-2 py-1 text-[10px] uppercase tracking-wide text-amber-100/80`,children:`IR: source of truth`}),(0,R.jsx)(`span`,{className:`rounded border border-amber-500/40 bg-[#0b0f14]/50 px-2 py-1 text-[10px] uppercase tracking-wide text-amber-100/80`,children:`XState: projection only`})]})]})})}function vye({model:e,onRefreshBootstrap:t,onError:n}){let r=e.workflowRunId?N7(e):void 0,i=`${e.workflowId}${e.workflowVersion?`@${e.workflowVersion}`:``}`;return(0,R.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-3`,"aria-label":`Projects workflow execution shell`,children:[(0,R.jsx)(j7,{title:`Workflow configured-session view`,icon:(0,R.jsx)(bs,{size:14}),children:(0,R.jsxs)(`div`,{className:`space-y-3 text-xs text-slate-400`,children:[(0,R.jsx)(M7,{label:`selected workflow`,value:i}),(0,R.jsx)(M7,{label:`session state`,value:e.workflowRunId?`started`:`configured/not-started`}),(0,R.jsx)(M7,{label:`input keys`,value:String(e.configuration.inputKeys.length)}),(0,R.jsx)(M7,{label:`prompt overrides`,value:String(e.configuration.promptOverrideNodeIds.length)}),(0,R.jsx)(`p`,{className:`leading-5 text-slate-500`,children:`Saved configuration is reviewed here before Start. Workflow selection and session overrides remain immutable for this configured Project session.`})]})}),(0,R.jsx)(j7,{title:`Workflow run view`,icon:(0,R.jsx)(wo,{size:14}),children:(0,R.jsxs)(`div`,{className:`space-y-3 text-xs text-slate-400`,children:[(0,R.jsx)(M7,{label:`run id`,value:e.workflowRunId?$7(e.workflowRunId):`not started`}),(0,R.jsx)(M7,{label:`status`,value:e.state}),(0,R.jsx)(M7,{label:`current node`,value:r?.label??`none`}),(0,R.jsx)(M7,{label:`output`,value:e.finalOutput?`available`:`empty`}),(0,R.jsx)(M7,{label:`error`,value:e.runtimeErrors.length?`${e.runtimeErrors.length} runtime errors`:e.validationErrors.length?`${e.validationErrors.length} validation diagnostics`:`none`}),(0,R.jsx)(`p`,{className:`leading-5 text-slate-500`,children:`This workflow run view container is the stable Project home for status, current node, output, and error sections.`})]})}),(0,R.jsx)(j7,{title:`Human action area`,icon:(0,R.jsx)(Zo,{size:14}),children:(0,R.jsx)(yye,{model:e,onRefreshBootstrap:t,onError:n})})]})}function yye({model:e,onRefreshBootstrap:t,onError:n}){let[r,i]=(0,L.useState)({}),[a,o]=(0,L.useState)(null),[s,c]=(0,L.useState)({}),[l,u]=(0,L.useState)({}),d=(e,t)=>{i(n=>({...n,[e]:t}))},f=async(i,a)=>{if(!i.waitTokenId||!a.registered)return;let s=`${i.waitTokenId}:${a.id}`,l=a.kind??`resume`,d;if(l===`resume`){let e=r[i.waitTokenId]??(i.payloadRequirements?.required?`{}`:``);if(e.trim())try{d=JSON.parse(e)}catch{let e=[{code:`WorkflowRuntimeError.invalidHumanActionPayload`,message:`Resume payload must be valid JSON before it can be submitted.`,severity:`error`,path:`$.payload`,hint:`Enter JSON such as {"comment":"Approved"}.`}];c(t=>({...t,[i.waitTokenId]:e})),n?.(`Resume payload must be valid JSON.`);return}}o(s),c(e=>({...e,[i.waitTokenId]:[]}));try{await A_e(e.projectId,e.piboSessionId,{waitTokenId:i.waitTokenId,actionId:a.id,...a.kind?{kind:a.kind}:{},...d===void 0?{}:{payload:d}}),u(e=>({...e,[i.waitTokenId]:`${a.displayName} submitted.`})),n?.(null),await t?.()}catch(e){let t=Uye(e);c(e=>({...e,[i.waitTokenId]:t})),n?.(t[0]?.message??W7(e))}finally{o(null)}};return(0,R.jsxs)(`div`,{className:`space-y-3 text-xs text-slate-400`,children:[e.pendingHumanActions.length?(0,R.jsx)(`div`,{className:`space-y-3`,children:e.pendingHumanActions.map(e=>{let t=[...e.diagnostics,...e.waitTokenId?s[e.waitTokenId]??[]:[]];return(0,R.jsxs)(`div`,{className:`rounded-sm border border-amber-500/40 bg-amber-500/10 p-3 text-amber-100`,"aria-label":`Pending workflow human action wait token`,children:[(0,R.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,R.jsxs)(`div`,{className:`min-w-0`,children:[(0,R.jsx)(`div`,{className:`font-semibold`,children:e.label}),(0,R.jsx)(`div`,{className:`mt-1 break-words text-[11px] leading-5 text-amber-100/80`,children:e.prompt})]}),(0,R.jsx)(`span`,{className:`shrink-0 rounded border border-amber-400/40 bg-[#0b0f14]/40 px-1.5 py-0.5 font-mono text-[10px] text-amber-100/70`,children:e.waitTokenId?$7(e.waitTokenId):e.source})]}),(0,R.jsxs)(`div`,{className:`mt-2 grid gap-2 text-[11px] text-amber-100/75`,children:[(0,R.jsx)(M7,{label:`human node`,value:e.humanNodeId??`unspecified`}),(0,R.jsx)(M7,{label:`payload`,value:e.payloadRequirements?.description??`No persisted payload schema.`}),e.expiresAt?(0,R.jsx)(M7,{label:`expires`,value:e.expiresAt}):null]}),e.payloadRequirements?.schema?(0,R.jsxs)(`div`,{className:`mt-2 rounded-sm border border-amber-400/25 bg-[#0b0f14]/50 p-2`,children:[(0,R.jsx)(`div`,{className:`mb-1 text-[10px] font-bold uppercase tracking-wider text-amber-100/70`,children:`Resume payload schema`}),(0,R.jsx)(z1,{value:e.payloadRequirements.schema,defaultExpandLevel:1,maxHeight:`10rem`,showControls:!1})]}):null,e.availableActions.some(e=>e.kind===`resume`)?(0,R.jsxs)(`label`,{className:`mt-3 block text-[11px] text-amber-100/80`,children:[(0,R.jsx)(`span`,{className:`mb-1 block font-semibold`,children:`Resume payload JSON`}),(0,R.jsx)(`textarea`,{className:`min-h-20 w-full rounded-sm border border-amber-500/30 bg-[#0b0f14] px-2 py-1.5 font-mono text-[11px] text-amber-50 outline-none focus:border-[#11a4d4]`,value:r[e.waitTokenId??e.id]??(e.payloadRequirements?.required?`{}`:``),onChange:t=>d(e.waitTokenId??e.id,t.target.value),placeholder:`{"comment":"Approved"}`})]}):null,(0,R.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-2`,"aria-label":`Workflow wait token actions`,children:e.availableActions.length?e.availableActions.map(t=>{let n=`${e.waitTokenId}:${t.id}`;return(0,R.jsx)(`button`,{type:`button`,disabled:!e.waitTokenId||!t.registered||a!==null,onClick:()=>void f(e,t),className:`rounded-sm border border-amber-400/40 bg-[#0b0f14]/70 px-2.5 py-1 text-[11px] font-semibold text-amber-100 transition hover:border-[#11a4d4] hover:text-[#8bdcf4] disabled:cursor-not-allowed disabled:opacity-50`,title:t.description??t.id,children:a===n?`Submitting…`:t.displayName},t.id)}):(0,R.jsx)(`span`,{className:`text-amber-100/60`,children:`No registered human actions are available for this wait token.`})}),e.waitTokenId&&l[e.waitTokenId]?(0,R.jsx)(`div`,{className:`mt-2 text-[11px] text-emerald-200`,children:l[e.waitTokenId]}):null,t.length?(0,R.jsx)(`div`,{className:`mt-2 space-y-1`,"aria-label":`Human action diagnostics`,children:t.map((e,t)=>(0,R.jsxs)(`div`,{className:`rounded border border-red-400/35 bg-red-500/15 p-2 text-[11px] leading-5 text-red-100`,children:[(0,R.jsx)(`div`,{children:e.message}),(0,R.jsxs)(`div`,{className:`mt-1 font-mono text-[10px] text-red-100/70`,children:[e.code,e.path?` · ${e.path}`:``]})]},`${e.code}:${t}`))}):null]},e.id)})}):(0,R.jsx)(`div`,{className:`rounded-sm border border-slate-800 bg-[#0b0f14] p-3 text-slate-500`,children:`No pending human action. Approval, rejection, resume, and cancel controls render here when a persisted workflow wait token exists.`}),(0,R.jsx)(`p`,{className:`leading-5 text-slate-500`,children:`This human action area lives inside the workflow run context, validates wait-token state and resume payloads, and stays separate from normal Terminal chat controls.`})]})}function bye({model:e}){let t=e.workflowRunId?N7(e):void 0,n=[...e.runtimeErrors.map(e=>({...e,source:e.source??`runtime`})),...e.validationErrors.map(e=>({...e,source:e.source??`validation`}))].slice(0,8);return(0,R.jsxs)(`section`,{className:`rounded-sm border border-slate-800 bg-[#111820] p-4 text-sm`,"aria-label":`Workflow run inspection panel`,children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,R.jsxs)(`div`,{className:`min-w-0`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-bold uppercase tracking-wider text-slate-500`,children:[(0,R.jsx)(ts,{size:14}),`Workflow run inspection`]}),(0,R.jsx)(`p`,{className:`mt-2 max-w-3xl text-xs leading-5 text-slate-500`,children:`Status, current node, history, attempts, transfers, output, and errors are rendered from Project session and workflow run facts when a run is linked. The XState graph remains a visualization projection only.`})]}),(0,R.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-2 text-[10px] uppercase tracking-wide`,children:[(0,R.jsx)(`span`,{className:`rounded border border-emerald-500/40 bg-emerald-500/10 px-2 py-1 text-emerald-200`,children:`kernel/run records: truth`}),(0,R.jsx)(`span`,{className:`rounded border border-amber-500/40 bg-amber-500/10 px-2 py-1 text-amber-100`,children:`XState projection only`})]})]}),(0,R.jsxs)(`div`,{className:`mt-4 grid gap-3 lg:grid-cols-3`,children:[(0,R.jsxs)(O7,{title:`Status`,badge:e.state,icon:(0,R.jsx)(wo,{size:14}),children:[(0,R.jsx)(k7,{label:`run id`,value:e.workflowRunId?$7(e.workflowRunId):`not started`}),(0,R.jsx)(k7,{label:`status`,value:e.state}),(0,R.jsx)(k7,{label:`record source`,value:e.workflowRunId?`Project workflow run id`:`no run record yet`})]}),(0,R.jsxs)(O7,{title:`Current node`,badge:t?.status??`none`,icon:(0,R.jsx)(Fs,{size:14}),children:[(0,R.jsx)(k7,{label:`node`,value:t?.label??`none`}),(0,R.jsx)(k7,{label:`node id`,value:t?.id??`none`}),(0,R.jsx)(k7,{label:`source`,value:`project/session run cursor`})]}),(0,R.jsx)(O7,{title:`Run history`,badge:`${e.runHistory.length}`,icon:(0,R.jsx)(hs,{size:14}),children:e.runHistory.length?(0,R.jsx)(`div`,{className:`space-y-2`,children:e.runHistory.map(e=>(0,R.jsxs)(`div`,{className:`rounded-sm border border-slate-800 bg-[#0b0f14] p-2`,children:[(0,R.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,R.jsx)(`div`,{className:`min-w-0 truncate font-mono text-xs text-slate-200`,children:$7(e.id)}),(0,R.jsx)(`span`,{className:`rounded border px-1.5 py-0.5 text-[10px] uppercase tracking-wide ${Q7(e.status)}`,children:e.status})]}),(0,R.jsxs)(`div`,{className:`mt-1 text-[11px] text-slate-500`,children:[e.currentNodeId?`current ${e.currentNodeId}`:`no current node`,` · `,e.source]}),(0,R.jsxs)(`div`,{className:`mt-1 font-mono text-[10px] text-slate-600`,children:[`updated `,e.updatedAt]})]},e.id))}):(0,R.jsx)(A7,{children:e.workflowRunId?`No workflow run history for this selected Project session yet.`:`No current run attempts; this configured Project session has not been started.`})})]}),(0,R.jsxs)(`div`,{className:`mt-3 grid gap-3 lg:grid-cols-2`,children:[(0,R.jsx)(O7,{title:`Node attempts`,badge:`${e.nodeAttempts.length}`,icon:(0,R.jsx)(bs,{size:14}),children:e.nodeAttempts.length?(0,R.jsx)(`div`,{className:`space-y-2`,children:e.nodeAttempts.map(e=>(0,R.jsxs)(`div`,{className:`rounded-sm border border-slate-800 bg-[#0b0f14] p-2`,children:[(0,R.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,R.jsxs)(`div`,{className:`min-w-0`,children:[(0,R.jsx)(`div`,{className:`truncate text-xs font-semibold text-slate-200`,children:e.label}),(0,R.jsxs)(`div`,{className:`mt-1 font-mono text-[10px] text-slate-500`,children:[e.nodeId,` · attempt `,e.attempt]})]}),(0,R.jsx)(`span`,{className:`rounded border px-1.5 py-0.5 text-[10px] uppercase tracking-wide ${Q7(e.status)}`,children:e.status})]}),(0,R.jsxs)(`div`,{className:`mt-1 text-[11px] text-slate-500`,children:[e.kind,` · `,e.source]})]},e.id))}):(0,R.jsx)(A7,{children:e.workflowRunId?`No node attempts recorded for this workflow run yet.`:`No current node attempts; Start has not created a workflow run.`})}),(0,R.jsx)(O7,{title:`Edge transfers`,badge:`${e.edgeTransfers.length}`,icon:(0,R.jsx)(fs,{size:14}),children:e.edgeTransfers.length?(0,R.jsx)(`div`,{className:`space-y-2`,children:e.edgeTransfers.map(e=>(0,R.jsxs)(`div`,{className:`rounded-sm border border-slate-800 bg-[#0b0f14] p-2`,children:[(0,R.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,R.jsx)(`div`,{className:`min-w-0 truncate font-mono text-xs text-slate-200`,children:e.edgeId}),(0,R.jsx)(`span`,{className:`rounded border px-1.5 py-0.5 text-[10px] uppercase tracking-wide ${Q7(e.status)}`,children:e.status})]}),(0,R.jsxs)(`div`,{className:`mt-1 text-[11px] text-slate-500`,children:[e.source,e.createdAt?` · ${e.createdAt}`:``]})]},e.id))}):(0,R.jsx)(A7,{children:`No edge transfers recorded for this workflow run yet.`})}),(0,R.jsx)(O7,{title:`Output`,badge:e.finalOutput?`available`:`empty`,icon:(0,R.jsx)(qo,{size:14}),children:e.finalOutput?(0,R.jsxs)(`div`,{className:`rounded-sm border border-slate-800 bg-[#0b0f14] p-2`,children:[(0,R.jsx)(`div`,{className:`mb-2 font-mono text-[10px] text-slate-500`,children:e.finalOutput.source}),(0,R.jsx)(z1,{value:e.finalOutput.value,defaultExpandLevel:1,maxHeight:`12rem`,showControls:!1})]}):(0,R.jsx)(A7,{children:`No workflow output has been recorded for this run yet.`})}),(0,R.jsx)(O7,{title:`Error`,badge:n.length?`${n.length}`:`none`,icon:(0,R.jsx)(Gs,{size:14}),children:n.length?(0,R.jsx)(`div`,{className:`space-y-2`,children:n.map(e=>(0,R.jsxs)(`div`,{className:`rounded-sm border border-red-500/35 bg-red-500/10 p-2 text-xs text-red-100`,children:[(0,R.jsx)(`div`,{className:`break-words`,children:e.message}),(0,R.jsxs)(`div`,{className:`mt-1 flex flex-wrap gap-1 font-mono text-[10px] text-red-200/70`,children:[e.code?(0,R.jsx)(`span`,{children:e.code}):null,e.source?(0,R.jsx)(`span`,{children:e.source}):null]})]},e.id))}):(0,R.jsx)(A7,{children:`No workflow run errors are recorded.`})})]})]})}function xye({model:e,onOpenSession:t}){let n=I7(e.definitionLink);return(0,R.jsxs)(`section`,{className:`rounded-sm border border-slate-800 bg-[#111820] p-4 text-sm`,"aria-label":`Workflow navigation links`,children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,R.jsxs)(`div`,{className:`min-w-0`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-bold uppercase tracking-wider text-slate-500`,children:[(0,R.jsx)(rs,{size:14}),`Workflow navigation links`]}),(0,R.jsx)(`p`,{className:`mt-2 max-w-3xl text-xs leading-5 text-slate-500`,children:`Use these run-view links to move between real nested workflow sessions and the Workflows tab definition. Snapshot-only history is shown when the live definition is deleted or unavailable.`})]}),e.definitionLink.status===`live`&&n?(0,R.jsxs)(`a`,{className:`inline-flex shrink-0 items-center justify-center gap-1 rounded-sm border border-[#11a4d4]/50 px-3 py-1.5 text-xs font-semibold text-[#8bdcf4] transition hover:border-[#11a4d4] hover:text-slate-100`,href:n,children:[(0,R.jsx)(rs,{size:13}),`Open live workflow definition`]}):null]}),(0,R.jsxs)(`div`,{className:`mt-4 grid gap-3 lg:grid-cols-2`,children:[(0,R.jsxs)(`div`,{className:`rounded-sm border border-slate-800 bg-[#0f171e] p-3`,"aria-label":`Nested workflow child session links`,children:[(0,R.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-2`,children:[(0,R.jsx)(`div`,{className:`text-xs font-bold uppercase tracking-wider text-slate-500`,children:`Nested workflow child sessions`}),(0,R.jsx)(`span`,{className:`rounded border border-slate-700 bg-[#0b0f14] px-1.5 py-0.5 font-mono text-[10px] text-slate-400`,children:e.nestedSessionLinks.length})]}),e.nestedSessionLinks.length?(0,R.jsx)(`div`,{className:`space-y-2`,children:e.nestedSessionLinks.map(e=>(0,R.jsx)(`button`,{type:`button`,onClick:()=>t(e.piboSessionId),className:`w-full rounded-sm border border-slate-800 bg-[#0b0f14] p-2 text-left transition hover:border-[#11a4d4]/60 hover:bg-[#102331]`,children:(0,R.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,R.jsxs)(`div`,{className:`min-w-0`,children:[(0,R.jsx)(`div`,{className:`truncate text-xs font-semibold text-slate-200`,children:e.title}),(0,R.jsx)(`div`,{className:`mt-1 font-mono text-[10px] text-slate-500`,children:$7(e.piboSessionId)})]}),(0,R.jsx)(`span`,{className:`rounded border border-[#11a4d4]/40 bg-[#11a4d4]/10 px-1.5 py-0.5 text-[10px] uppercase tracking-wide text-[#8bdcf4]`,children:`open session`})]})},e.piboSessionId))}):(0,R.jsx)(A7,{children:`No nested workflow child sessions are linked under this selected Project session yet.`})]}),(0,R.jsxs)(`div`,{className:`rounded-sm border border-slate-800 bg-[#0f171e] p-3`,"aria-label":`Workflow definition link state`,children:[(0,R.jsx)(`div`,{className:`mb-3 text-xs font-bold uppercase tracking-wider text-slate-500`,children:`Workflow definition link`}),e.definitionLink.status===`live`&&n?(0,R.jsxs)(`div`,{className:`rounded-sm border border-emerald-500/35 bg-emerald-500/10 p-3 text-xs leading-5 text-emerald-100`,children:[(0,R.jsx)(`div`,{className:`font-semibold`,children:`Live workflow definition exists`}),(0,R.jsx)(`div`,{className:`mt-1 font-mono text-[11px] text-emerald-100/80`,children:R7(e.definitionLink)}),e.definitionLink.definitionHash?(0,R.jsxs)(`div`,{className:`mt-1 font-mono text-[10px] text-emerald-100/60`,children:[`snapshot `,$7(e.definitionLink.definitionHash)]}):null]}):(0,R.jsxs)(`div`,{className:`rounded-sm border border-amber-500/40 bg-amber-500/10 p-3 text-xs leading-5 text-amber-100`,children:[(0,R.jsx)(`div`,{className:`font-semibold`,children:`Definition deleted — snapshot-only definition-deleted state`}),(0,R.jsx)(`div`,{className:`mt-1 font-mono text-[11px] text-amber-100/80`,children:R7(e.definitionLink)}),(0,R.jsx)(`div`,{className:`mt-1 text-amber-100/80`,children:e.definitionLink.tombstoneLabel??`Historical run inspection uses the immutable Project session snapshot instead of a broken live definition link.`}),e.definitionLink.definitionHash?(0,R.jsxs)(`div`,{className:`mt-1 font-mono text-[10px] text-amber-100/60`,children:[`snapshot `,$7(e.definitionLink.definitionHash)]}):null]})]})]})]})}function O7({title:e,badge:t,icon:n,children:r}){return(0,R.jsxs)(`section`,{className:`min-w-0 rounded-sm border border-slate-800 bg-[#0f171e] p-3`,"aria-label":e,children:[(0,R.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[(0,R.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 text-xs font-bold uppercase tracking-wider text-slate-500`,children:[(0,R.jsx)(`span`,{className:`text-[#11a4d4]`,children:n}),e]}),(0,R.jsx)(`span`,{className:`shrink-0 rounded border border-slate-700 bg-[#0b0f14] px-1.5 py-0.5 font-mono text-[10px] text-slate-400`,children:t})]}),r]})}function k7({label:e,value:t}){return(0,R.jsxs)(`div`,{className:`flex items-start justify-between gap-3 border-b border-slate-800/70 py-2 first:pt-0 last:border-b-0 last:pb-0`,children:[(0,R.jsx)(`span`,{className:`text-[10px] uppercase tracking-wide text-slate-500`,children:e}),(0,R.jsx)(`span`,{className:`min-w-0 max-w-[14rem] truncate text-right font-mono text-xs text-slate-300`,title:t,children:t})]})}function A7({children:e}){return(0,R.jsx)(`div`,{className:`rounded-sm border border-dashed border-slate-800 bg-[#0b0f14] p-3 text-xs leading-5 text-slate-500`,children:e})}function j7({title:e,icon:t,children:n}){return(0,R.jsxs)(`section`,{className:`rounded-sm border border-slate-800 bg-[#111820] p-4`,"aria-label":e,children:[(0,R.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 text-xs font-bold uppercase tracking-wider text-slate-500`,children:[(0,R.jsx)(`span`,{className:`text-[#11a4d4]`,children:t}),e]}),n]})}function M7({label:e,value:t}){return(0,R.jsxs)(`div`,{className:`flex items-start justify-between gap-3 border-b border-slate-800/70 pb-2 last:border-b-0 last:pb-0`,children:[(0,R.jsx)(`span`,{className:`uppercase tracking-wide text-slate-500`,children:e}),(0,R.jsx)(`span`,{className:`min-w-0 max-w-[12rem] truncate text-right font-mono text-slate-300`,title:t,children:t})]})}function N7(e){return e.nodes.find(e=>e.status===`active`||e.status===`waiting`)??e.nodes[0]}function Sye({nodes:e,edges:t}){return(0,R.jsxs)(`div`,{className:`rounded-sm border border-slate-800 bg-[#0f171e] p-4`,children:[(0,R.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 text-xs font-bold uppercase tracking-wider text-slate-500`,children:[(0,R.jsx)(Fs,{size:14}),`Visual State Flow`]}),(0,R.jsx)(`div`,{className:`grid gap-3 md:grid-cols-[1fr_auto_1fr_auto_1fr]`,children:e.map((e,n)=>(0,R.jsx)(Cye,{node:e,edge:t[n]},e.id))})]})}function Cye({node:e,edge:t}){return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`div`,{className:`rounded-sm border p-3 ${Z7(e.status)}`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,R.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,R.jsx)(Y7,{status:e.status}),(0,R.jsx)(`div`,{className:`min-w-0 truncate text-sm font-semibold text-slate-100`,children:e.label})]}),(0,R.jsx)(`span`,{className:`rounded border border-slate-700 px-1.5 py-0.5 text-[10px] uppercase tracking-wide text-slate-400`,children:e.kind})]}),(0,R.jsx)(`p`,{className:`mt-2 text-xs text-slate-400`,children:e.description})]}),t?(0,R.jsx)(`div`,{className:`hidden items-center justify-center text-center text-[10px] uppercase tracking-wide text-slate-500 md:flex`,children:(0,R.jsxs)(`div`,{children:[(0,R.jsx)(fs,{size:14,className:`mx-auto mb-1 text-[#11a4d4]`}),t.label]})}):null]})}function wye({model:e}){return(0,R.jsxs)(`div`,{className:`rounded-sm border border-slate-800 bg-[#111820] p-4`,children:[(0,R.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 text-xs font-bold uppercase tracking-wider text-slate-500`,children:[(0,R.jsx)(wo,{size:14}),`Current UI Snapshot`]}),(0,R.jsx)(z1,{value:e.snapshot,showControls:!1})]})}function Tye({model:e}){return(0,R.jsxs)(`div`,{className:`rounded-sm border border-slate-800 bg-[#111820] p-4 text-sm`,children:[(0,R.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-bold uppercase tracking-wider text-slate-500`,children:[(0,R.jsx)(bs,{size:14}),`Node Statuses`]}),(0,R.jsxs)(`span`,{className:`font-mono text-[11px] text-slate-500`,children:[e.nodes.length,` nodes`]})]}),(0,R.jsx)(`div`,{className:`space-y-2`,children:e.nodes.map(e=>(0,R.jsxs)(`div`,{className:`rounded-sm border px-3 py-2 ${Z7(e.status)}`,children:[(0,R.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-3`,children:[(0,R.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2`,children:[(0,R.jsx)(`span`,{className:`mt-0.5 shrink-0`,children:(0,R.jsx)(Y7,{status:e.status})}),(0,R.jsxs)(`div`,{className:`min-w-0`,children:[(0,R.jsx)(`div`,{className:`truncate text-sm font-semibold text-slate-100`,children:e.label}),(0,R.jsx)(`div`,{className:`mt-0.5 truncate font-mono text-[11px] text-slate-500`,children:e.id})]})]}),(0,R.jsxs)(`div`,{className:`flex shrink-0 flex-col items-end gap-1`,children:[(0,R.jsx)(`span`,{className:`rounded border px-1.5 py-0.5 text-[10px] uppercase tracking-wide ${Xye(e.status)}`,children:e.status}),(0,R.jsx)(`span`,{className:`rounded border border-slate-700 px-1.5 py-0.5 text-[10px] uppercase tracking-wide text-slate-400`,children:e.kind})]})]}),(0,R.jsx)(`p`,{className:`mt-2 text-xs text-slate-400`,children:e.description})]},e.id))}),(0,R.jsx)(`p`,{className:`mt-3 text-xs text-slate-500`,children:`Node status is reconstructed from the workflow run linkage and live session state; persisted kernel records remain the durable source of truth.`})]})}function Eye({model:e}){return(0,R.jsxs)(`div`,{className:`rounded-sm border border-slate-800 bg-[#111820] p-4 text-sm`,children:[(0,R.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 text-xs font-bold uppercase tracking-wider text-slate-500`,children:[(0,R.jsx)(qo,{size:14}),`Final Output & Validation`]}),(0,R.jsxs)(`div`,{className:`space-y-4`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2`,children:[(0,R.jsx)(`div`,{className:`text-xs font-semibold uppercase tracking-wide text-slate-400`,children:`Final output`}),e.finalOutput?(0,R.jsx)(`span`,{className:`rounded border border-slate-700 px-1.5 py-0.5 font-mono text-[10px] text-slate-500`,children:e.finalOutput.source}):null]}),e.finalOutput?(0,R.jsx)(`div`,{className:`rounded-sm border border-slate-800 bg-[#0b0f14] p-2`,children:(0,R.jsx)(z1,{value:e.finalOutput.value,defaultExpandLevel:1,maxHeight:`14rem`,showControls:!1})}):(0,R.jsx)(`div`,{className:`rounded-sm border border-slate-800 bg-[#0b0f14] p-3 text-xs text-slate-500`,children:`No final workflow output is available yet. Completed workflow-backed sessions show the final assistant output here.`})]}),(0,R.jsxs)(`div`,{children:[(0,R.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2`,children:[(0,R.jsx)(`div`,{className:`text-xs font-semibold uppercase tracking-wide text-slate-400`,children:`Validation errors`}),(0,R.jsx)(`span`,{className:`rounded border px-1.5 py-0.5 font-mono text-[10px] ${e.validationErrors.length?`border-red-500/40 bg-red-500/10 text-red-300`:`border-emerald-500/40 bg-emerald-500/10 text-emerald-300`}`,children:e.validationErrors.length?`${e.validationErrors.length} found`:`none`})]}),e.validationErrors.length?(0,R.jsx)(`div`,{className:`space-y-2`,children:e.validationErrors.map(e=>(0,R.jsx)(`div`,{className:`rounded-sm border border-red-500/35 bg-red-500/10 p-2`,children:(0,R.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2 text-xs text-red-200`,children:[(0,R.jsx)(Gs,{size:14,className:`mt-0.5 shrink-0 text-red-300`}),(0,R.jsxs)(`div`,{className:`min-w-0`,children:[(0,R.jsx)(`div`,{className:`break-words`,children:e.message}),(0,R.jsxs)(`div`,{className:`mt-1 flex flex-wrap gap-1 font-mono text-[10px] text-red-200/70`,children:[e.code?(0,R.jsx)(`span`,{children:e.code}):null,e.path?(0,R.jsx)(`span`,{children:e.path}):null,e.source?(0,R.jsx)(`span`,{children:e.source}):null]})]})]})},e.id))}):(0,R.jsx)(`div`,{className:`rounded-sm border border-slate-800 bg-[#0b0f14] p-3 text-xs text-slate-500`,children:`No workflow validation diagnostics were found in the current session trace.`})]})]})]})}function Dye({model:e}){return(0,R.jsxs)(`div`,{className:`rounded-sm border border-slate-800 bg-[#111820] p-4 text-sm`,children:[(0,R.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 text-xs font-bold uppercase tracking-wider text-slate-500`,children:[(0,R.jsx)(Xo,{size:14}),`Projection Facts`]}),(0,R.jsxs)(`dl`,{className:`space-y-3`,children:[(0,R.jsx)(P7,{label:`projection kind`,value:`pibo.workflow.xstateUiModel`}),(0,R.jsx)(P7,{label:`schema`,value:`v1`}),(0,R.jsx)(P7,{label:`durable truth`,value:`kernel`}),(0,R.jsx)(P7,{label:`private payloads`,value:`not exposed`}),(0,R.jsx)(P7,{label:`states`,value:String(e.nodes.length)}),(0,R.jsx)(P7,{label:`transitions`,value:String(e.edges.length)}),(0,R.jsx)(P7,{label:`trace`,value:e.traceVersion??`pending`})]})]})}function P7({label:e,value:t}){return(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-slate-800/70 pb-2 last:border-b-0 last:pb-0`,children:[(0,R.jsx)(`dt`,{className:`text-xs uppercase tracking-wide text-slate-500`,children:e}),(0,R.jsx)(`dd`,{className:`min-w-0 truncate text-right font-mono text-xs text-slate-300`,children:t})]})}function Oye(e,t,n,r,i,a){if(!Wye(e))return null;let o=q7(e,n),s=Gye(e,n),c=Kye(s),l=Bye(t,s),u=[...Hye(t),...Vye(e,i)],d=Nye(e,o,c),f=Pye(t,e.workflowRunId),p=Lye(t,e.workflowRunId),m=Rye(t,r),h=kye(e),g=Aye(a,e.piboSessionId),_=[{id:`workflow.entry`,label:`workflow entry`,kind:`initial`,status:s===`idle`?`active`:`completed`,description:`Project session is linked to a workflow-capable route.`},{id:`node.session`,label:t?.title??`pibo session actor`,kind:`agent`,status:c===`node.session`?s:s===`completed`?`completed`:`idle`,description:`Normal Pibo routed session used as the visible workflow actor.`},{id:J7(s),label:qye(s),kind:`terminal`,status:c.startsWith(`workflow.`)?s:`idle`,description:`Terminal state projected from the current workflow/session state.`}];return{projectId:e.projectId,workflowId:e.workflowId,...e.workflowVersion?{workflowVersion:e.workflowVersion}:{},...e.workflowRunId?{workflowRunId:e.workflowRunId}:{},piboSessionId:e.piboSessionId,state:o,status:s,traceTitle:t?.title,traceVersion:t?.version,latestStreamId:t?.latestStreamId,nodes:_,edges:[{id:`workflow.transition.entry.session`,source:`workflow.entry`,target:`node.session`,label:`WORKFLOW.START`},{id:`workflow.transition.session.terminal`,source:`node.session`,target:J7(s),label:Jye(s)}],configuration:jye(e),definitionLink:h,nestedSessionLinks:g,pendingHumanActions:Mye(e,r),runHistory:d,nodeAttempts:f,edgeTransfers:p,runtimeErrors:m,...l?{finalOutput:l}:{},validationErrors:u,snapshot:{kind:`pibo.workflow.xstateUiModel`,schemaVersion:1,projection:{workflowId:e.workflowId,initialStateId:`workflow.entry`,durableTruth:`kernel`,exposesPrivatePayloads:!1},authoring:{location:`workflows_tab`,rawXStateEditingUi:`not_exposed`,inlineExecutableCodeUi:`not_exposed`},current:{snapshotKind:`ui`,...e.workflowRunId?{runId:e.workflowRunId}:{},status:o,stateIds:[c],nodeId:c===`node.session`?`session`:void 0},nodeStatuses:_.map(e=>({id:e.id,kind:e.kind,status:e.status})),runInspection:{durableTruth:`kernel_run_records`,xstateProjectionOnly:!0,runHistoryCount:d.length,nodeAttemptCount:f.length,edgeTransferCount:p.length,runtimeErrorCount:m.length},result:{hasFinalOutput:!!l,validationErrorCount:u.length},actors:[{id:`workflow.actor.session`,kind:`agent`,piboSessionId:e.piboSessionId}],definitionLink:{status:h.status,workflowId:h.workflowId,workflowVersion:h.workflowVersion,hasLiveLink:h.status===`live`&&!!I7(h)},nestedWorkflowSessionCount:g.length}}}function kye(e){return e.workflowDefinitionLink?e.workflowDefinitionLink:e.workflowVersion?{status:`live`,workflowId:e.workflowId,workflowVersion:e.workflowVersion,title:e.title??e.workflowId,href:L7(e.workflowId,e.workflowVersion)}:{status:`snapshot_only_definition_deleted`,workflowId:e.workflowId,title:e.title??e.workflowId,tombstoneLabel:`Historical run inspection uses the immutable Project session snapshot instead of a broken live definition link.`}}function Aye(e,t){let n=F7(e,t);if(!n)return[];let r=[],i=e=>{for(let t of e)t.workflowSessionKind===`nested_workflow`&&r.push({piboSessionId:t.piboSessionId,title:t.title,kind:t.workflowSessionKind??t.profile??`workflow`,...t.workflowSessionKind?{workflowSessionKind:t.workflowSessionKind}:{}}),i(t.children)};return i(n.children),r}function F7(e,t){for(let n of e){if(n.piboSessionId===t)return n;let e=F7(n.children,t);if(e)return e}}function I7(e){if(e.status===`live`){if(e.href)return e.href;if(e.workflowVersion)return L7(e.workflowId,e.workflowVersion)}}function L7(e,t){return`/apps/chat/workflows/view/${encodeURIComponent(e)}/${encodeURIComponent(t)}`}function R7(e){return`${e.workflowId}${e.workflowVersion?`@${e.workflowVersion}`:``}`}function jye(e){let t=e.configuration;return{inputKeys:Object.keys(t?.inputValues??{}).sort(),promptOverrideNodeIds:Object.keys(t?.promptOverrides??{}).sort()}}function Mye(e,t){if(e.pendingHumanActions?.length)return e.pendingHumanActions.map(e=>({id:`wait-token:${e.waitTokenId}`,waitTokenId:e.waitTokenId,workflowRunId:e.workflowRunId,...e.nodeAttemptId?{nodeAttemptId:e.nodeAttemptId}:{},...e.humanNodeId?{humanNodeId:e.humanNodeId}:{},prompt:e.prompt,label:`Pending registered human action`,source:`persisted wait token`,...e.schema?{schema:e.schema}:{},payloadRequirements:e.payloadRequirements,availableActions:e.availableActions,diagnostics:e.diagnostics,createdAt:e.createdAt,...e.expiresAt?{expiresAt:e.expiresAt}:{}}));let n=q7(e,void 0).toLowerCase(),r=[t?.aggregateStatus,t?.localStatus].filter(e=>typeof e==`string`).join(` `).toLowerCase();return n.includes(`waiting`)||n.includes(`blocked`)||r.includes(`waiting`)||r.includes(`blocked`)||t?.hasBlockedDescendant?[{id:`human-action:${e.piboSessionId}`,prompt:`Session signal indicates a wait, but no persisted workflow wait token is available in the Project run store.`,label:`Awaiting human action`,source:t?`session signal`:`project session state`,availableActions:[],diagnostics:[]}]:[]}function Nye(e,t,n){return e.workflowRunId?[{id:e.workflowRunId,status:t,currentNodeId:n,updatedAt:e.updatedAt,source:`project session run record`}]:[]}function Pye(e,t){return!t||!e?[]:z7(e.nodes).filter(Fye).slice(0,8).map((e,t)=>({id:e.id,nodeId:e.stableKey??e.entryId??e.type,label:e.title||e.type,kind:e.type,status:Iye(e.status),attempt:t+1,source:`session trace fact`,...e.startedAt?{startedAt:e.startedAt}:{},...e.completedAt?{completedAt:e.completedAt}:{}}))}function Fye(e){return e.type===`agent.turn`||e.type===`tool.call`||e.type===`execution.command`||e.type===`agent.delegation`||e.type===`agent.async`||e.type===`yielded.run`||e.type===`error`}function Iye(e){return e===`done`?`completed`:e===`error`?`failed`:`running`}function Lye(e,t){if(!t||!e)return[];let n=[];for(let r of e.rawEvents){if(!K7(r.payload))continue;let e=G7(r.payload.type),i=G7(r.payload.runId);if(e!==`edge.transferred`||i&&i!==t)continue;let a=G7(r.payload.edgeId);a&&n.push({id:G7(r.payload.edgeTransferId)??r.id,edgeId:a,status:`transferred`,source:r.type,createdAt:r.createdAt})}return n.slice(0,8)}function Rye(e,t){let n=[];for(let e of t?.errors??[])n.push({id:`signal:${n.length}`,message:e.message,...e.code?{code:e.code}:{},source:e.source??`session signal`});if(e){for(let t of z7(e.nodes)){let e=t.error??(t.status===`error`?V7(t.output)??V7(t.summary):void 0);e&&n.push({id:`node:${t.id}`,message:e,source:t.type})}for(let t of e.rawEvents){if(!K7(t.payload))continue;let e=t.payload.error,r=K7(e)?G7(e.message):G7(e),i=K7(e)?G7(e.code):void 0;r&&n.push({id:`event:${t.id}`,message:r,...i?{code:i}:{},source:t.type})}}return zye(n).slice(0,8)}function zye(e){let t=new Set;return e.filter(e=>{let n=`${e.code??``}:${e.message}:${e.source??``}`;return t.has(n)?!1:(t.add(n),!0)})}function Bye(e,t){if(t!==`completed`||!e)return;let n=z7(e.nodes),r=[...n].reverse().find(e=>e.type===`assistant.message`&&e.status===`done`&&(e.output!==void 0||e.summary));if(r)return{value:r.output??r.summary??``,source:`assistant.message`};let i=[...n].reverse().find(e=>e.status===`done`&&e.type!==`user.message`&&e.type!==`model.reasoning`&&e.output!==void 0);return i?{value:i.output,source:i.type}:void 0}function Vye(e,t){let n=[];for(let r of t)if(r.piboSessionId===e.piboSessionId&&!(r.type!==`project.workflow_start.blocked`&&r.validation?.trigger!==`before_workflow_start`))for(let e of r.diagnostics)e.severity===`error`&&n.push({id:`lifecycle:${r.id}:${n.length}`,message:e.message,code:e.code,path:e.path,source:`start lifecycle event`});return U7(n).slice(0,8)}function Hye(e){if(!e)return[];let t=[];for(let n of z7(e.nodes)){let e=n.error??V7(n.output)??V7(n.summary);e&&(!H7([n.title,n.summary,n.error,n.type].filter(e=>typeof e==`string`).join(` `))&&!H7(e)||t.push({id:`node:${n.id}`,message:e,...n.type?{source:n.type}:{}}))}for(let n of e.rawEvents)B7(n.payload,`event:${n.id}`,t);return U7(t).slice(0,8)}function z7(e){let t=[],n=e=>{for(let r of e)t.push(r),n(r.children)};return n(e),t}function B7(e,t,n,r=0){if(r>4||!K7(e))return;let i=Array.isArray(e.diagnostics)?e.diagnostics:void 0;if(i)for(let e of i){if(!K7(e))continue;let r=G7(e.message)??V7(e);r&&n.push({id:`${t}:diagnostic:${n.length}`,message:r,...G7(e.code)?{code:G7(e.code)}:{},...G7(e.path)?{path:G7(e.path)}:{},source:`workflow.diagnostic`})}let a=e.error;if(K7(a)){let e=G7(a.code),r=G7(a.message)??V7(a);r&&H7([e,r].filter(Boolean).join(` `))&&n.push({id:`${t}:error:${n.length}`,message:r,...e?{code:e}:{},source:`workflow.error`})}else typeof a==`string`&&H7(a)&&n.push({id:`${t}:error:${n.length}`,message:a,source:`workflow.error`});for(let[i,a]of Object.entries(e))i===`diagnostics`||i===`error`||i!==`payload`&&i!==`output`&&i!==`result`&&i!==`data`||B7(a,`${t}:${i}`,n,r+1)}function V7(e){if(typeof e==`string`)return e;if(K7(e))return G7(e.message)??G7(e.error)??G7(e.summary)}function H7(e){let t=e.toLowerCase();return t.includes(`validation`)||t.includes(`validate`)||t.includes(`diagnostic`)||t.includes(`workflowinterfaceerror`)||t.includes(`workflowruntimeerror.validation`)}function U7(e){let t=new Set;return e.filter(e=>{let n=`${e.code??``}:${e.path??``}:${e.message}`;return t.has(n)?!1:(t.add(n),!0)})}function Uye(e){return K7(e)&&K7(e.data)&&Array.isArray(e.data.diagnostics)?e.data.diagnostics.filter(K7).map(t=>({code:G7(t.code)??`WorkflowRuntimeError.humanActionRejected`,message:G7(t.message)??W7(e),severity:t.severity===`info`||t.severity===`warning`||t.severity===`error`?t.severity:`error`,...G7(t.path)?{path:G7(t.path)}:{},...G7(t.registryRef)?{registryRef:G7(t.registryRef)}:{},...G7(t.hint)?{hint:G7(t.hint)}:{}})):[{code:`WorkflowRuntimeError.humanActionRejected`,message:W7(e),severity:`error`}]}function W7(e){return e instanceof Error?e.message:String(e)}function G7(e){return typeof e==`string`&&e.trim()?e:void 0}function K7(e){return!!e&&typeof e==`object`&&!Array.isArray(e)}function Wye(e){return!!e.workflowRunId||e.state===`workflow`||e.workflowId!==`simple-chat`}function q7(e,t){return e.archived?`archived`:e.state&&e.state!==`workflow`?e.state.replace(/_/g,` `):t===`running`?`running`:t===`error`?`failed`:e.workflowRunId?`workflow`:e.kind}function Gye(e,t){let n=q7(e,t).toLowerCase();return e.archived?`cancelled`:n.includes(`complete`)||n.includes(`done`)?`completed`:n.includes(`fail`)||n.includes(`error`)?`failed`:n.includes(`cancel`)?`cancelled`:n.includes(`wait`)||n.includes(`blocked`)?`waiting`:!e.workflowRunId&&n.includes(`configured`)?`idle`:`active`}function Kye(e){return e===`completed`?`workflow.completed`:e===`failed`?`workflow.failed`:e===`cancelled`?`workflow.cancelled`:`node.session`}function J7(e){return e===`failed`?`workflow.failed`:e===`cancelled`?`workflow.cancelled`:`workflow.completed`}function qye(e){return e===`failed`?`failed`:e===`cancelled`?`cancelled`:`completed`}function Jye(e){return e===`failed`?`WORKFLOW.FAIL`:e===`cancelled`?`WORKFLOW.CANCEL`:`WORKFLOW.NODE.DONE`}function Y7({status:e}){return e===`completed`?(0,R.jsx)(qo,{size:16,className:`text-emerald-300`}):e===`failed`?(0,R.jsx)(Yo,{size:16,className:`text-red-300`}):e===`cancelled`?(0,R.jsx)(Gs,{size:16,className:`text-slate-400`}):e===`waiting`?(0,R.jsx)(Zo,{size:16,className:`text-amber-300`}):e===`active`?(0,R.jsx)(wo,{size:16,className:`text-[#11a4d4]`}):(0,R.jsx)(Xo,{size:16,className:`text-slate-500`})}function X7({tone:e,children:t}){return(0,R.jsx)(`span`,{className:`rounded border px-2 py-1 font-mono ${{blue:`border-[#11a4d4]/40 bg-[#11a4d4]/10 text-[#11a4d4]`,slate:`border-slate-700 bg-slate-900/50 text-slate-300`,green:`border-emerald-500/40 bg-emerald-500/10 text-emerald-300`,amber:`border-amber-500/40 bg-amber-500/10 text-amber-300`,red:`border-red-500/40 bg-red-500/10 text-red-300`}[e]}`,children:t})}function Yye(e){return e===`completed`?`green`:e===`failed`||e===`cancelled`?`red`:e===`waiting`?`amber`:`blue`}function Z7(e){return e===`completed`?`border-emerald-500/40 bg-emerald-500/10`:e===`failed`?`border-red-500/40 bg-red-500/10`:e===`cancelled`?`border-slate-600 bg-slate-800/40`:e===`waiting`?`border-amber-500/40 bg-amber-500/10`:e===`active`?`border-[#11a4d4]/50 bg-[#11a4d4]/10 shadow-[0_0_0_1px_rgba(17,164,212,0.18)]`:`border-slate-800 bg-[#111820]`}function Xye(e){return e===`completed`?`border-emerald-500/40 bg-emerald-500/10 text-emerald-300`:e===`failed`||e===`cancelled`?`border-red-500/40 bg-red-500/10 text-red-300`:e===`waiting`?`border-amber-500/40 bg-amber-500/10 text-amber-300`:e===`active`?`border-[#11a4d4]/40 bg-[#11a4d4]/10 text-[#11a4d4]`:`border-slate-700 bg-slate-900/50 text-slate-400`}function Q7(e){let t=e.toLowerCase();return t.includes(`complete`)||t.includes(`done`)||t.includes(`transferred`)?`border-emerald-500/40 bg-emerald-500/10 text-emerald-300`:t.includes(`fail`)||t.includes(`error`)||t.includes(`cancel`)?`border-red-500/40 bg-red-500/10 text-red-300`:t.includes(`wait`)||t.includes(`blocked`)?`border-amber-500/40 bg-amber-500/10 text-amber-300`:t.includes(`run`)||t.includes(`active`)||t.includes(`workflow`)?`border-[#11a4d4]/40 bg-[#11a4d4]/10 text-[#11a4d4]`:`border-slate-700 bg-slate-900/50 text-slate-400`}function $7(e){return e.length>18?`${e.slice(0,10)}…${e.slice(-6)}`:e}var e9=[{id:`terminal`,label:`Terminal`,description:`Compact Codex-style terminal transcript.`,render:e=>(0,R.jsx)(Qve,{...e})},{id:`workflow`,label:`Workflow`,description:`Workflow/XState visualization for workflow-backed project sessions.`,render:e=>(0,R.jsx)(gye,{...e})}],t9=new Map(e9.map(e=>[e.id,e]));function Zye(){return e9}function n9(e){return t9.get(e)??t9.get(`terminal`)}function r9(e,t){return{localBootstrap:t,queryData:e.getQueriesData({queryKey:[`chat`,`bootstrap`]})}}function i9(e,t){return g9(e.sessions,t.piboSessionId)?e:{...e,sessions:[t,...e.sessions]}}function Qye(e,t){let n=a9(e.sessions,t),r=t.has(e.selectedPiboSessionId);return{...e,selectedPiboSessionId:r?``:e.selectedPiboSessionId,sessions:n}}function a9(e,t){let n=!1,r=[];for(let i of e){if(t.has(i.piboSessionId)){n=!0;continue}let e=a9(i.children,t);e===i.children?r.push(i):(n=!0,r.push({...i,children:e}))}return n?r:e}function o9(e){let t=new Set([e.piboSessionId]);for(let n of e.children)for(let e of o9(n))t.add(e);return t}function $ye(e,t,n){if(!t)return i9(e,n);let r=!1,i=p9(e.sessions,t,()=>(r=!0,n));return{...e,selectedPiboSessionId:e.selectedPiboSessionId===t?n.piboSessionId:e.selectedPiboSessionId,session:e.session.id===t?h9(n,e.session):e.session,sessions:r?i:[n,...i]}}function s9(e,t){let n=typeof t.metadata?.chatWebArchivedAt==`string`;return{...e,session:e.session.id===t.id?t:e.session,sessions:p9(e.sessions,t.id,e=>({...e,profile:t.profile,activeModel:t.activeModel,title:t.title||e.title||`Untitled Session`,archived:n}))}}function c9(e,t,n){let r=e.session.id===t?h9(n(m9(e.session)),e.session):e.session;return{...e,session:r,sessions:p9(e.sessions,t,n)}}function ebe(e,t){return h3(e.rooms,t.id)?e:{...e,room:t,selectedRoomId:t.id,selectedPiboSessionId:``,rooms:[t,...e.rooms]}}function tbe(e,t,n){return{...e,room:e.room?.id===t?n:e.room,selectedRoomId:e.selectedRoomId===t?n.id:e.selectedRoomId,rooms:u9(e.rooms,t,()=>n)}}function l9(e,t,n){return{...e,room:e.room?.id===t?n(e.room):e.room,rooms:u9(e.rooms,t,n)}}function nbe(e,t){let n=t.has(e.selectedRoomId);return{...e,room:e.room&&t.has(e.room.id)?void 0:e.room,selectedRoomId:n?``:e.selectedRoomId,selectedPiboSessionId:n?``:e.selectedPiboSessionId,rooms:d9(e.rooms,t)}}function u9(e,t,n){let r=!1,i=e.map(e=>{if(e.id===t)return r=!0,n(e);let i=e.children??[],a=u9(i,t,n);return a===i?e:(r=!0,{...e,children:a})});return r?i:e}function d9(e,t){let n=!1,r=[];for(let i of e){if(t.has(i.id)){n=!0;continue}let e=i.children??[],a=d9(e,t);a===e?r.push(i):(n=!0,r.push({...i,children:a}))}return n?r:e}function rbe(e,t){let n=new Date().toISOString();return{id:e,name:t,type:`chat`,createdAt:n,updatedAt:n,metadata:{},children:[]}}function ibe(e,t){let n={...e.metadata};return t?n.chatRoomArchivedAt=new Date().toISOString():delete n.chatRoomArchivedAt,{...e,metadata:n,updatedAt:new Date().toISOString()}}function f9(e){let t=new Set([e.id]);for(let n of e.children??[])for(let e of f9(n))t.add(e);return t}function p9(e,t,n){let r=!1,i=e.map(e=>{if(e.piboSessionId===t)return r=!0,n(e);let i=p9(e.children,t,n);return i===e.children?e:(r=!0,{...e,children:i})});return r?i:e}function abe(e,t){return{piboSessionId:e,piSessionId:`pending`,profile:t,title:`New Session`,status:`idle`,lastActivityAt:new Date().toISOString(),derivedSessions:[],children:[]}}function m9(e){return{piboSessionId:e.id,piSessionId:e.piSessionId,profile:e.profile,activeModel:e.activeModel,title:e.title||`Untitled Session`,archived:typeof e.metadata?.chatWebArchivedAt==`string`,status:`idle`,lastActivityAt:e.updatedAt,derivedSessions:[],children:[]}}function h9(e,t){return{...t,id:e.piboSessionId,piSessionId:e.piSessionId,profile:e.profile,activeModel:e.activeModel,title:d3(e),updatedAt:e.lastActivityAt??t.updatedAt}}function g9(e,t){for(let n of e){if(n.piboSessionId===t)return n;let e=g9(n.children,t);if(e)return e}}function obe(e){let t=e.trim();if(t.length>=2){let e=t[0],n=t[t.length-1];if(e===`"`&&n===`"`||e===`'`&&n===`'`)return t.slice(1,-1).trim()}return t}function sbe(e,t){if(e===`thinking`&&t)return{level:t.split(/\s+/,1)[0]};if(e===`compact`&&t)return{customInstructions:t}}function cbe(e){return!_9(e)||!_9(e.result)?null:e}function lbe(e){if(!(!_9(e)||!_9(e.result)))return typeof e.result.piboSessionId==`string`?e.result.piboSessionId:void 0}function _9(e){return!!e&&typeof e==`object`&&!Array.isArray(e)}function ube(e){let t=e.flatMap(e=>e.slashCommands.filter(e=>e!==`tree`).map(t=>({slash:`/${t}`,action:e.name,description:e.name===`thinking`&&t===`thinking`?`Show thinking level or use /thinking <level>.`:e.description??e.name})));return t.push({slash:`/download`,action:`download`,description:`Download a file by absolute path or relative to the current working directory.`},{slash:`/upload`,action:`upload`,description:`Upload one or more files to ~/.pibo/uploads.`},{slash:`/thinking-show`,action:`thinking-show`,description:`Toggle historical thinking display in this browser.`}),t}function dbe(e,t){if(!e)return[];let n=e.agentCatalog?.skills??[],r=e.agentCatalog?.userSkills??[],i=[...n,...r],a=t3(e),o=t?r3(e.sessions,t)?.profile??a:a,s=[...e.agents.map(e=>({name:e.name,skills:e.skills})),...e.customAgents.map(e=>({name:e.profileName,skills:e.skills}))].find(e=>e.name===o),c=new Set(s?.skills??[]);return i.filter(e=>c.has(e.name))}function fbe(e,t){let n=e.area===`sessions`?e.roomId:void 0,r=e.area===`sessions`||e.area===`projects`||e.area===`context`?e.piboSessionId:void 0,i=n?t.sessionsByRoom?.[n]:t.piboSessionId;return{requestedRoomId:e.area===`sessions`?n??(r?void 0:t.roomId):e.area===`context`&&r?void 0:t.roomId,requestedPiboSessionId:e.area===`sessions`?r??(r?void 0:i):e.area===`context`?r:t.piboSessionId}}function pbe(e){let{bootstrap:t,creatingSession:n,route:r}=e,i=r.area===`sessions`||r.area===`projects`||r.area===`context`?r.piboSessionId:void 0;return t&&r.area!==`sessions`&&(r.area!==`context`||!i||t.selectedPiboSessionId===i)||n?!0:!!(t&&r.area===`sessions`&&r.piboSessionId&&t.selectedPiboSessionId===r.piboSessionId&&t.selectedRoomId===r.roomId)}function mbe(e,t){if(e.area===`sessions`&&t.selectedPiboSessionId&&!(e.roomId===t.selectedRoomId&&e.piboSessionId===t.selectedPiboSessionId))return t}function hbe(e){return e.area===`sessions`&&!!(e.roomId||e.piboSessionId)}function gbe({activePanel:e,onSelect:t,piPackageCount:n,userSkillCount:r}){return(0,R.jsx)(`div`,{className:`p-2`,children:(0,R.jsxs)(`div`,{className:`mb-4`,children:[(0,R.jsx)(`div`,{className:`px-1 pb-1 text-[10px] font-bold uppercase tracking-wider text-slate-500`,children:`Settings`}),(0,R.jsxs)(`button`,{type:`button`,onClick:()=>t(`general`),className:`mb-1 flex w-full items-center gap-2 border p-2 text-left ${e===`general`?`border-[#11a4d4] bg-[#11a4d4]/10`:`border-slate-800 bg-[#151f24] hover:border-slate-700`}`,children:[(0,R.jsx)(Vs,{size:13,className:`text-[#11a4d4]`}),(0,R.jsxs)(`div`,{className:`min-w-0`,children:[(0,R.jsx)(`span`,{className:`block truncate text-sm text-slate-200`,children:`General`}),(0,R.jsx)(`span`,{className:`block truncate font-mono text-[10px] text-slate-500`,children:`browser + runtime`})]})]}),(0,R.jsxs)(`button`,{type:`button`,onClick:()=>t(`shortcuts`),className:`mb-1 flex w-full items-center gap-2 border p-2 text-left ${e===`shortcuts`?`border-[#11a4d4] bg-[#11a4d4]/10`:`border-slate-800 bg-[#151f24] hover:border-slate-700`}`,children:[(0,R.jsx)(_s,{size:13,className:`text-[#11a4d4]`}),(0,R.jsxs)(`div`,{className:`min-w-0`,children:[(0,R.jsx)(`span`,{className:`block truncate text-sm text-slate-200`,children:`Shortcuts`}),(0,R.jsx)(`span`,{className:`block truncate font-mono text-[10px] text-slate-500`,children:`keyboard`})]})]}),(0,R.jsxs)(`button`,{type:`button`,onClick:()=>t(`maintenance`),className:`mb-1 flex w-full items-center gap-2 border p-2 text-left ${e===`maintenance`?`border-[#11a4d4] bg-[#11a4d4]/10`:`border-slate-800 bg-[#151f24] hover:border-slate-700`}`,children:[(0,R.jsx)(ts,{size:13,className:`text-[#11a4d4]`}),(0,R.jsxs)(`div`,{className:`min-w-0`,children:[(0,R.jsx)(`span`,{className:`block truncate text-sm text-slate-200`,children:`Maintenance`}),(0,R.jsx)(`span`,{className:`block truncate font-mono text-[10px] text-slate-500`,children:`telemetry retention`})]})]}),(0,R.jsxs)(`button`,{type:`button`,onClick:()=>t(`pi-packages`),className:`mb-1 flex w-full items-center gap-2 border p-2 text-left ${e===`pi-packages`?`border-[#11a4d4] bg-[#11a4d4]/10`:`border-slate-800 bg-[#151f24] hover:border-slate-700`}`,children:[(0,R.jsx)(vs,{size:13,className:`text-[#11a4d4]`}),(0,R.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,R.jsx)(`span`,{className:`block truncate text-sm text-slate-200`,children:`Pi Packages`}),(0,R.jsx)(`span`,{className:`block truncate font-mono text-[10px] text-slate-500`,children:`runtime-packages`})]}),(0,R.jsx)(`span`,{className:`inline-flex min-w-6 items-center justify-center border border-slate-700 bg-[#101d22] px-1.5 py-0.5 text-[10px] font-mono text-slate-400`,children:n})]}),(0,R.jsxs)(`button`,{type:`button`,onClick:()=>t(`skills`),className:`mb-1 flex w-full items-center gap-2 border p-2 text-left ${e===`skills`?`border-[#11a4d4] bg-[#11a4d4]/10`:`border-slate-800 bg-[#151f24] hover:border-slate-700`}`,children:[(0,R.jsx)(Js,{size:13,className:`text-[#11a4d4]`}),(0,R.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,R.jsx)(`span`,{className:`block truncate text-sm text-slate-200`,children:`Skills`}),(0,R.jsx)(`span`,{className:`block truncate font-mono text-[10px] text-slate-500`,children:`user-managed`})]}),(0,R.jsx)(`span`,{className:`inline-flex min-w-6 items-center justify-center border border-slate-700 bg-[#101d22] px-1.5 py-0.5 text-[10px] font-mono text-slate-400`,children:r})]}),(0,R.jsxs)(`button`,{type:`button`,onClick:()=>t(`providers`),className:`flex w-full items-center gap-2 border p-2 text-left ${e===`providers`?`border-[#11a4d4] bg-[#11a4d4]/10`:`border-slate-800 bg-[#151f24] hover:border-slate-700`}`,children:[(0,R.jsx)(gs,{size:13,className:`text-[#11a4d4]`}),(0,R.jsxs)(`div`,{className:`min-w-0`,children:[(0,R.jsx)(`span`,{className:`block truncate text-sm text-slate-200`,children:`Providers`}),(0,R.jsx)(`span`,{className:`block truncate font-mono text-[10px] text-slate-500`,children:`auth + api keys`})]})]})]})})}var v9=[{id:`openai-codex`,name:`OpenAI (ChatGPT Plus/Pro)`,authMethod:`oauth`},{id:`openai`,name:`OpenAI (API Key)`,authMethod:`api_key`},{id:`anthropic`,name:`Anthropic (Claude)`,authMethod:`oauth`},{id:`github-copilot`,name:`GitHub Copilot`,authMethod:`oauth`},{id:`kimi-coding`,name:`Kimi for Coding`,authMethod:`api_key`},{id:`google`,name:`Google (Gemini)`,authMethod:`api_key`},{id:`groq`,name:`Groq`,authMethod:`api_key`},{id:`ollama`,name:`Ollama`,authMethod:`api_key`},{id:`minimax`,name:`MiniMax`,authMethod:`api_key`},{id:`minimax-cn`,name:`MiniMax (China)`,authMethod:`api_key`},{id:`glm`,name:`GLM (Z.ai)`,authMethod:`api_key`}];function _be({piboSessionId:e,onProviderAuthChanged:t}){let[n,r]=(0,L.useState)({}),[i,a]=(0,L.useState)(!1),[o,s]=(0,L.useState)(null),[c,l]=(0,L.useState)(null),[u,d]=(0,L.useState)({}),[f,p]=(0,L.useState)({}),[m,h]=(0,L.useState)({}),[g,_]=(0,L.useState)({}),[v,y]=(0,L.useState)(null),[b,x]=(0,L.useState)({}),S=(0,L.useCallback)(async()=>{if(e){a(!0),s(null);try{let t=y9(await gc(e,`login.status`,{})),n={};if(Array.isArray(t?.providers))for(let e of t.providers){let t=e.id??e.provider;t&&(n[t]=e.configured)}r(n)}catch(e){s(e instanceof Error?e.message:String(e))}finally{a(!1)}}},[e]);(0,L.useEffect)(()=>{S()},[S]);let C=(0,L.useCallback)(async t=>{if(e){x(e=>({...e,[t]:!0})),s(null),l(null),d(e=>({...e,[t]:{type:`oauth_starting`}}));try{let n=y9(await gc(e,`login.start`,{provider:t})),r=n.url,i=n.state;r?d(e=>({...e,[t]:{type:`oauth_flow`,url:r,state:i,userCode:n.userCode,instructions:n.instructions,flow:n.type}})):(s(`No URL returned from login start.`),d(e=>({...e,[t]:{type:`collapsed`}})))}catch(e){s(e instanceof Error?e.message:String(e)),d(e=>({...e,[t]:{type:`collapsed`}}))}finally{x(e=>({...e,[t]:!1}))}}},[e]),w=(0,L.useCallback)(async(n,i,a)=>{if(e){x(e=>({...e,[n]:!0})),s(null),l(null);try{await gc(e,`login.complete`,{provider:n,...i?{code:i}:{},state:a??``});let o=b9(n);l(`${o} login completed.`),r(e=>({...e,[n]:!0})),d(e=>({...e,[n]:{type:`collapsed`}})),p(e=>({...e,[n]:``})),await t?.(),window.setTimeout(()=>l(e=>e===`${o} login completed.`?null:e),5e3)}catch(e){s(e instanceof Error?e.message:String(e))}finally{x(e=>({...e,[n]:!1}))}}},[t,e]),T=(0,L.useCallback)(async(n,i)=>{if(e){x(e=>({...e,[n]:!0})),s(null),l(null);try{await gc(e,`login.apikey`,{provider:n,apiKey:i});let a=b9(n);l(`${a} API key saved.`),r(e=>({...e,[n]:!0})),d(e=>({...e,[n]:{type:`collapsed`}})),h(e=>({...e,[n]:``})),await t?.(),window.setTimeout(()=>l(e=>e===`${a} API key saved.`?null:e),5e3)}catch(e){s(e instanceof Error?e.message:String(e))}finally{x(e=>({...e,[n]:!1}))}}},[t,e]),E=(0,L.useCallback)(async n=>{if(e){x(e=>({...e,[n]:!0})),s(null),l(null);try{await gc(e,`logout`,{provider:n}),r(e=>({...e,[n]:!1})),await t?.()}catch(e){s(e instanceof Error?e.message:String(e))}finally{x(e=>({...e,[n]:!1}))}}},[t,e]),D=async e=>{try{await navigator.clipboard.writeText(e),y(e),setTimeout(()=>y(null),2e3)}catch{}};return e?(0,R.jsxs)(`div`,{className:`grid gap-4`,children:[o?(0,R.jsxs)(`div`,{className:`flex items-center gap-2 rounded-sm border border-red-500/30 bg-red-500/10 px-3 py-2 text-xs text-red-300`,children:[(0,R.jsx)(Ko,{size:14}),o]}):null,c?(0,R.jsxs)(`div`,{className:`flex items-center gap-2 rounded-sm border border-[#0bda57]/30 bg-[#0bda57]/10 px-3 py-2 text-xs text-[#7cf2a2]`,children:[(0,R.jsx)(Jo,{size:14}),c]}):null,i?(0,R.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-[#11a4d4]`,children:[(0,R.jsx)(Ss,{size:14,className:`animate-spin`}),`Loading provider status...`]}):null,v9.map(e=>{let t=n[e.id]??!1,r=u[e.id]??{type:`collapsed`},i=b[e.id]??!1;return(0,R.jsxs)(`div`,{className:`border rounded-sm ${r.type===`collapsed`?t?`border-[#0bda57]/20 bg-[#151f24]`:`border-[#334155] bg-[#151f24] hover:border-slate-600`:`border-[#11a4d4]/50 bg-[#151f24]`}`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-3 p-3`,children:[(0,R.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(`span`,{className:`text-sm font-medium text-slate-200`,children:e.name}),(0,R.jsx)(`span`,{className:`shrink-0 border px-1.5 py-0.5 text-[10px] font-mono uppercase tracking-wider ${e.authMethod===`oauth`?`border-purple-500/40 text-purple-300`:`border-amber-500/40 text-amber-300`}`,children:e.authMethod===`oauth`?`OAuth`:`API Key`})]}),(0,R.jsx)(`div`,{className:`mt-1 flex items-center gap-1.5 text-xs`,children:t?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(Jo,{size:12,className:`text-[#0bda57]`}),(0,R.jsx)(`span`,{className:`text-[#0bda57]`,children:`Configured`})]}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(ws,{size:12,className:`text-slate-500`}),(0,R.jsx)(`span`,{className:`text-slate-500`,children:`Not configured`})]})})]}),(0,R.jsx)(`div`,{className:`flex items-center gap-2`,children:t?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`button`,{type:`button`,disabled:i,onClick:()=>d(t=>({...t,[e.id]:t[e.id]?.type===`collapsed`?e.authMethod===`oauth`?{type:`oauth_starting`}:{type:`api_key`}:{type:`collapsed`}})),className:`inline-flex items-center gap-1 rounded-sm border border-slate-700 bg-[#0e1116] px-2.5 py-1.5 text-[11px] text-slate-300 hover:border-[#11a4d4] hover:text-[#11a4d4] disabled:opacity-50`,children:[i?(0,R.jsx)(Ss,{size:12,className:`animate-spin`}):(0,R.jsx)(gs,{size:12}),`Reconfigure`]}),(0,R.jsxs)(`button`,{type:`button`,disabled:i,onClick:()=>void E(e.id),className:`inline-flex items-center gap-1 rounded-sm border border-slate-700 bg-[#0e1116] px-2.5 py-1.5 text-[11px] text-slate-300 hover:border-red-500 hover:text-red-300 disabled:opacity-50`,children:[(0,R.jsx)(Ws,{size:12}),`Remove`]})]}):(0,R.jsxs)(`button`,{type:`button`,disabled:i,onClick:()=>e.authMethod===`oauth`?void C(e.id):d(t=>({...t,[e.id]:{type:`api_key`}})),className:`inline-flex items-center gap-1 rounded-sm border border-slate-700 bg-[#0e1116] px-2.5 py-1.5 text-[11px] text-slate-300 hover:border-[#11a4d4] hover:text-[#11a4d4] disabled:opacity-50`,children:[i?(0,R.jsx)(Ss,{size:12,className:`animate-spin`}):(0,R.jsx)(gs,{size:12}),`Configure`]})})]}),r.type===`collapsed`?null:(0,R.jsx)(`div`,{className:`border-t border-slate-800 p-3`,children:r.type===`oauth_starting`?(0,R.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-[#11a4d4]`,children:[(0,R.jsx)(Ss,{size:14,className:`animate-spin`}),`Starting OAuth flow...`]}):r.type===`oauth_flow`?(0,R.jsxs)(`div`,{className:`grid gap-3`,children:[(0,R.jsxs)(`div`,{className:`grid gap-2`,children:[(0,R.jsx)(`div`,{className:`text-[10px] font-bold uppercase tracking-wider text-slate-500`,children:`Step 1: Open URL`}),(0,R.jsx)(`div`,{className:`break-all rounded-sm border border-slate-700 bg-[#0e1116] p-2 font-mono text-[11px] text-slate-300`,children:r.url}),(0,R.jsxs)(`div`,{className:`flex gap-2`,children:[(0,R.jsxs)(`button`,{type:`button`,onClick:()=>void D(r.url),className:`inline-flex items-center gap-1 rounded-sm border border-slate-700 bg-[#0e1116] px-2 py-1 text-[11px] text-slate-300 hover:border-[#11a4d4] hover:text-[#11a4d4]`,children:[v===r.url?(0,R.jsx)(Jo,{size:12}):(0,R.jsx)($o,{size:12}),v===r.url?`Copied`:`Copy URL`]}),(0,R.jsxs)(`a`,{href:r.url,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1 rounded-sm border border-slate-700 bg-[#0e1116] px-2 py-1 text-[11px] text-slate-300 hover:border-[#11a4d4] hover:text-[#11a4d4]`,children:[(0,R.jsx)(rs,{size:12}),`Open in Browser`]})]})]}),r.userCode?(0,R.jsxs)(`div`,{className:`grid gap-2`,children:[(0,R.jsx)(`div`,{className:`text-[10px] font-bold uppercase tracking-wider text-slate-500`,children:`Step 2: Enter Code`}),(0,R.jsx)(`div`,{className:`rounded-sm border border-slate-700 bg-[#0e1116] p-3 text-center font-mono text-[20px] font-bold tracking-widest text-[#11a4d4]`,children:r.userCode}),r.instructions?(0,R.jsx)(`div`,{className:`text-[11px] leading-relaxed text-slate-500`,children:r.instructions}):null,(0,R.jsxs)(`button`,{type:`button`,disabled:i,onClick:()=>void w(e.id,void 0,r.state),className:`inline-flex items-center gap-1 rounded-sm border border-slate-700 bg-[#0e1116] px-3 py-1.5 text-[11px] text-slate-300 hover:border-[#11a4d4] hover:text-[#11a4d4] disabled:opacity-50`,children:[i?(0,R.jsx)(Ss,{size:12,className:`animate-spin`}):(0,R.jsx)(ws,{size:12}),`Complete Login`]})]}):(0,R.jsxs)(`div`,{className:`grid gap-2`,children:[(0,R.jsx)(`div`,{className:`text-[10px] font-bold uppercase tracking-wider text-slate-500`,children:`Step 2: Paste Code`}),(0,R.jsx)(`input`,{type:`text`,value:f[e.id]??``,onChange:t=>p(n=>({...n,[e.id]:t.target.value})),onKeyDown:t=>{t.key===`Enter`&&(f[e.id]??``).trim()&&w(e.id,f[e.id].trim(),r.state)},placeholder:`Paste authorization code...`,className:`w-full rounded-sm border border-slate-700 bg-[#0e1116] px-2 py-1.5 font-mono text-[12px] text-slate-300 placeholder-slate-600 outline-none focus:border-[#11a4d4]`}),(0,R.jsxs)(`button`,{type:`button`,disabled:i||!(f[e.id]??``).trim(),onClick:()=>void w(e.id,f[e.id].trim(),r.state),className:`inline-flex items-center gap-1 rounded-sm border border-slate-700 bg-[#0e1116] px-3 py-1.5 text-[11px] text-slate-300 hover:border-[#11a4d4] hover:text-[#11a4d4] disabled:opacity-50`,children:[i?(0,R.jsx)(Ss,{size:12,className:`animate-spin`}):(0,R.jsx)(ws,{size:12}),`Complete Login`]})]}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>d(t=>({...t,[e.id]:{type:`collapsed`}})),className:`text-[11px] text-slate-500 hover:text-[#11a4d4]`,children:`← Cancel`})]}):r.type===`api_key`?(0,R.jsxs)(`div`,{className:`grid gap-3`,children:[(0,R.jsx)(`div`,{className:`text-[10px] font-bold uppercase tracking-wider text-slate-500`,children:`Enter API Key`}),(0,R.jsxs)(`div`,{className:`relative`,children:[(0,R.jsx)(`input`,{type:g[e.id]?`text`:`password`,value:m[e.id]??``,onChange:t=>h(n=>({...n,[e.id]:t.target.value})),onKeyDown:t=>{t.key===`Enter`&&(m[e.id]??``).trim()&&T(e.id,m[e.id].trim())},placeholder:`sk-...`,className:`w-full rounded-sm border border-slate-700 bg-[#0e1116] px-2 py-1.5 pr-8 font-mono text-[12px] text-slate-300 placeholder-slate-600 outline-none focus:border-[#11a4d4]`}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>_(t=>({...t,[e.id]:!t[e.id]})),className:`absolute right-2 top-1/2 -translate-y-1/2 text-slate-500 hover:text-[#11a4d4]`,title:g[e.id]?`Hide`:`Show`,children:g[e.id]?(0,R.jsx)(is,{size:14}):(0,R.jsx)(as,{size:14})})]}),(0,R.jsxs)(`button`,{type:`button`,disabled:i||!(m[e.id]??``).trim(),onClick:()=>void T(e.id,m[e.id].trim()),className:`inline-flex items-center gap-1 rounded-sm border border-slate-700 bg-[#0e1116] px-3 py-1.5 text-[11px] text-slate-300 hover:border-[#11a4d4] hover:text-[#11a4d4] disabled:opacity-50`,children:[i?(0,R.jsx)(Ss,{size:12,className:`animate-spin`}):(0,R.jsx)(ws,{size:12}),`Save API Key`]}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>d(t=>({...t,[e.id]:{type:`collapsed`}})),className:`text-[11px] text-slate-500 hover:text-[#11a4d4]`,children:`← Cancel`})]}):null})]},e.id)})]}):(0,R.jsx)(`div`,{className:`border border-slate-700 bg-[#1a262b] rounded-sm p-4 text-sm text-slate-400`,children:`Select a chat session to manage provider authentication.`})}function y9(e){return vbe(e)?e.result:e}function vbe(e){return!!e&&typeof e==`object`&&!Array.isArray(e)&&e.type===`execution_result`}function b9(e){return v9.find(t=>t.id===e)?.name??e}function ybe({activePanel:e,showThinking:t,setShowThinking:n,expandThinking:r,setExpandThinking:i,modelDefaults:a,modelCatalog:o,onModelDefaultsChanged:s,piPackages:c,onPiPackageChanged:l,onPiPackageRemoved:u,userSkills:d,onUserSkillChanged:f,onUserSkillRemoved:p,piboSessionId:m,onProviderAuthChanged:h}){return e===`pi-packages`?(0,R.jsxs)(`div`,{className:`p-6 overflow-auto`,children:[(0,R.jsxs)(`h1`,{className:`text-sm font-bold uppercase tracking-wider mb-4 flex items-center gap-2`,children:[(0,R.jsx)(vs,{size:16}),`Pi Packages`]}),(0,R.jsx)(kbe,{packages:c,onPackageChanged:l,onPackageRemoved:u})]}):e===`skills`?(0,R.jsxs)(`div`,{className:`overflow-auto p-6 max-[640px]:p-3`,children:[(0,R.jsxs)(`h1`,{className:`mb-4 flex items-center gap-2 text-sm font-bold uppercase tracking-wider`,children:[(0,R.jsx)(Js,{size:16}),`Skills`]}),(0,R.jsx)(Abe,{skills:d,onSkillChanged:f,onSkillRemoved:p})]}):e===`providers`?(0,R.jsxs)(`div`,{className:`p-6 overflow-auto`,children:[(0,R.jsxs)(`h1`,{className:`text-sm font-bold uppercase tracking-wider mb-4 flex items-center gap-2`,children:[(0,R.jsx)(gs,{size:16}),`Providers`]}),(0,R.jsx)(_be,{piboSessionId:m,onProviderAuthChanged:h})]}):e===`shortcuts`?(0,R.jsxs)(`div`,{className:`p-6 overflow-auto`,children:[(0,R.jsxs)(`h1`,{className:`text-sm font-bold uppercase tracking-wider mb-4 flex items-center gap-2`,children:[(0,R.jsx)(_s,{size:16}),`Shortcuts`]}),(0,R.jsx)(Cbe,{})]}):e===`maintenance`?(0,R.jsxs)(`div`,{className:`p-6 overflow-auto`,children:[(0,R.jsxs)(`h1`,{className:`text-sm font-bold uppercase tracking-wider mb-4 flex items-center gap-2`,children:[(0,R.jsx)(Vs,{size:16}),`Maintenance`]}),(0,R.jsx)(Sbe,{})]}):(0,R.jsxs)(`div`,{className:`p-6 overflow-auto`,children:[(0,R.jsxs)(`h1`,{className:`text-sm font-bold uppercase tracking-wider mb-4 flex items-center gap-2`,children:[(0,R.jsx)(Vs,{size:16}),`General`]}),(0,R.jsxs)(z0,{title:`General`,children:[(0,R.jsx)(xbe,{}),(0,R.jsx)(W0,{checked:t,title:`Show thinking blocks`,onToggle:()=>{let e=!t;n(e),p2(e)}}),(0,R.jsx)(W0,{checked:r,disabled:!t,title:`Expand thinking blocks`,onToggle:()=>{let e=!r;i(e),m2(e)}}),(0,R.jsx)(Obe,{modelDefaults:a,modelCatalog:o,onChanged:s})]})]})}var bbe=`UTC.Europe/Berlin.Europe/London.Europe/Paris.Europe/Madrid.Europe/Rome.Europe/Amsterdam.Europe/Vienna.Europe/Zurich.Europe/Warsaw.Europe/Istanbul.America/New_York.America/Chicago.America/Denver.America/Los_Angeles.America/Toronto.America/Sao_Paulo.America/Mexico_City.Asia/Dubai.Asia/Jerusalem.Asia/Kolkata.Asia/Bangkok.Asia/Singapore.Asia/Shanghai.Asia/Tokyo.Asia/Seoul.Australia/Sydney.Australia/Melbourne.Pacific/Auckland`.split(`.`);function xbe(){let e=Xt(),{data:t,isLoading:n}=fn({queryKey:[`user-settings`],queryFn:uK}),r=(0,L.useMemo)(()=>Tbe(t?.timezone),[t?.timezone]),[i,a]=(0,L.useState)(`UTC`),[o,s]=(0,L.useState)(!1),[c,l]=(0,L.useState)(null);(0,L.useEffect)(()=>{t?.timezone&&a(t.timezone)},[t?.timezone]);let u=async(t=i)=>{s(!0),l(null);try{let n=await dK({timezone:t});a(n.timezone),e.setQueryData([`user-settings`],n)}catch(e){l(e instanceof Error?e.message:String(e))}finally{s(!1)}};return(0,R.jsxs)(`div`,{className:`border-b border-slate-800 pb-4 mb-4`,children:[(0,R.jsx)(`div`,{className:`mb-2 text-xs font-semibold uppercase tracking-wider text-slate-400`,children:`App timezone`}),(0,R.jsx)(`div`,{className:`max-w-xl`,children:(0,R.jsx)(`select`,{value:i,disabled:n||o,onChange:e=>{let t=e.target.value;a(t),u(t)},className:`w-full min-w-0 rounded-sm border border-slate-700 bg-[#0e1116] px-3 py-2 text-sm outline-none focus:border-[#11a4d4] disabled:opacity-60`,children:r.map(e=>(0,R.jsx)(`option`,{value:e.value,children:e.label},e.value))})}),(0,R.jsx)(`div`,{className:`mt-2 text-[11px] text-slate-500`,children:`Choose a city-based timezone. Changes are saved automatically and loaded into every runtime context together with the current Pibo Session ID.`}),o?(0,R.jsx)(`div`,{className:`mt-2 text-xs text-slate-400`,children:`Saving…`}):null,c?(0,R.jsx)(`div`,{className:`mt-2 text-xs text-red-300`,children:c}):null]})}function Sbe(){let e=Xt(),{data:t,isLoading:n}=fn({queryKey:[`user-settings`],queryFn:uK}),[r,i]=(0,L.useState)(30),[a,o]=(0,L.useState)(!0),[s,c]=(0,L.useState)(10),[l,u]=(0,L.useState)(!1),[d,f]=(0,L.useState)(!1),[p,m]=(0,L.useState)(null),[h,g]=(0,L.useState)(null),_=t?.telemetryRetention?.lastPrunedAt;(0,L.useEffect)(()=>{t?.telemetryRetention&&(o(t.telemetryRetention.enabled),i(t.telemetryRetention.days),c(t.telemetryRetention.days))},[t?.telemetryRetention]);let v=async t=>{let n=t.enabled??a,s=x9(t.days??r);o(n),i(s),u(!0),g(null),m(null);try{let t=await dK({telemetryRetention:{enabled:n,days:s}});e.setQueryData([`user-settings`],t),o(t.telemetryRetention.enabled),i(t.telemetryRetention.days),m(`Telemetry retention settings saved.`)}catch(e){g(e instanceof Error?e.message:String(e))}finally{u(!1)}},y=async()=>{let t=x9(s);c(t),f(!0),g(null),m(null);try{let n=await fK({days:t}),r=await uK();e.setQueryData([`user-settings`],r),m(`Deleted ${n.rowsDeleted.toLocaleString()} telemetry rows older than ${t} days. Cutoff: ${n.cutoff}.`)}catch(e){g(e instanceof Error?e.message:String(e))}finally{f(!1)}};return(0,R.jsx)(z0,{title:`Telemetry retention`,children:(0,R.jsxs)(`div`,{className:`space-y-5`,children:[(0,R.jsxs)(`div`,{className:`rounded-sm border border-slate-800 bg-[#101d22] p-4`,children:[(0,R.jsx)(`div`,{className:`mb-2 text-xs font-semibold uppercase tracking-wider text-slate-300`,children:`Automatic cleanup`}),(0,R.jsx)(`p`,{className:`mb-4 max-w-2xl text-xs leading-5 text-slate-400`,children:`Pibo keeps sessions, rooms, chat messages, and renderable trace events. This retention policy deletes only runtime telemetry/debug rows older than the configured age.`}),(0,R.jsxs)(`label`,{className:`mb-4 flex items-center gap-3 text-sm text-slate-200`,children:[(0,R.jsx)(`input`,{type:`checkbox`,checked:a,disabled:n||l,onChange:e=>void v({enabled:e.target.checked}),className:`h-4 w-4 accent-[#11a4d4]`}),`Enable automatic telemetry retention`]}),(0,R.jsxs)(`div`,{className:`max-w-xs`,children:[(0,R.jsx)(`label`,{className:`mb-1 block text-[11px] font-semibold uppercase tracking-wider text-slate-500`,children:`Delete telemetry older than`}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(`input`,{type:`number`,min:1,max:365,value:r,disabled:n||l,onChange:e=>i(Number(e.target.value)),onBlur:()=>void v({days:r}),className:`w-24 rounded-sm border border-slate-700 bg-[#0e1116] px-3 py-2 text-sm outline-none focus:border-[#11a4d4] disabled:opacity-60`}),(0,R.jsx)(`span`,{className:`text-xs text-slate-400`,children:`days`})]})]}),(0,R.jsx)(`div`,{className:`mt-3 text-[11px] text-slate-500`,children:`Default is 30 days. Automatic cleanup skips runs while runtime sessions are processing or streaming.`}),(0,R.jsxs)(`div`,{className:`mt-2 text-[11px] text-slate-500`,children:[`Last prune: `,_?new Date(_).toLocaleString():`never`]})]}),(0,R.jsxs)(`div`,{className:`rounded-sm border border-slate-800 bg-[#101d22] p-4`,children:[(0,R.jsx)(`div`,{className:`mb-2 text-xs font-semibold uppercase tracking-wider text-slate-300`,children:`Manual cleanup`}),(0,R.jsx)(`p`,{className:`mb-4 max-w-2xl text-xs leading-5 text-slate-400`,children:`Run retention now with a custom cutoff. This affects telemetry tables only and never deletes sessions, rooms, chat messages, or trace-render events.`}),(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,R.jsx)(`input`,{type:`number`,min:1,max:365,value:s,disabled:d,onChange:e=>c(Number(e.target.value)),className:`w-24 rounded-sm border border-slate-700 bg-[#0e1116] px-3 py-2 text-sm outline-none focus:border-[#11a4d4] disabled:opacity-60`}),(0,R.jsx)(`span`,{className:`text-xs text-slate-400`,children:`days`}),(0,R.jsxs)(`button`,{type:`button`,disabled:d,onClick:()=>void y(),className:`inline-flex items-center justify-center gap-2 rounded-sm border border-red-900/70 bg-red-950/30 px-3 py-2 text-xs font-semibold text-red-100 transition hover:border-red-500 disabled:cursor-not-allowed disabled:opacity-60`,children:[(0,R.jsx)(Ws,{size:13}),d?`Deleting…`:`Delete old telemetry now`]})]})]}),(0,R.jsx)(`div`,{className:`rounded-sm border border-amber-900/50 bg-amber-950/20 p-3 text-[11px] leading-5 text-amber-100`,children:`Detailed provider-event capture is intentionally off by default because it can be high-volume. Use the dedicated debug flag only for short incident windows.`}),l?(0,R.jsx)(`div`,{className:`text-xs text-slate-400`,children:`Saving…`}):null,p?(0,R.jsx)(`div`,{className:`text-xs text-emerald-300`,children:p}):null,h?(0,R.jsx)(`div`,{className:`text-xs text-red-300`,children:h}):null]})})}function x9(e){return Number.isFinite(e)?Math.max(1,Math.min(365,Math.trunc(e))):30}function Cbe(){let e=Xt(),{data:t,isLoading:n}=fn({queryKey:[`user-settings`],queryFn:uK}),[r,i]=(0,L.useState)(N2),[a,o]=(0,L.useState)(!1),[s,c]=(0,L.useState)(!1),[l,u]=(0,L.useState)(null);(0,L.useEffect)(()=>{let e=t?.shortcuts?.webAnnotationsToggle||P2();i(e),F2(e),I2(e)},[t?.shortcuts?.webAnnotationsToggle]);let d=async t=>{let n=L2(t)||`Alt+Shift+A`;i(n),c(!0),u(null);try{let t=await dK({shortcuts:{webAnnotationsToggle:n}});e.setQueryData([`user-settings`],t),F2(t.shortcuts.webAnnotationsToggle),I2(t.shortcuts.webAnnotationsToggle)}catch(e){u(e instanceof Error?e.message:String(e))}finally{c(!1)}};return(0,R.jsx)(z0,{title:`Shortcuts`,children:(0,R.jsxs)(`div`,{className:`grid max-w-2xl gap-3 rounded-sm border border-slate-800 bg-[#151f24] p-3`,children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-slate-200`,children:[(0,R.jsx)(jo,{size:15}),` Toggle annotation mode`]}),(0,R.jsx)(`div`,{className:`mt-1 text-xs text-slate-500`,children:`Toggles the Web Annotation element mode with the pencil button.`})]}),(0,R.jsx)(`kbd`,{className:`rounded-sm border border-slate-700 bg-[#0e1116] px-2 py-1 font-mono text-xs text-[#7dd3fc]`,children:r})]}),(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,R.jsx)(`button`,{type:`button`,disabled:n||s,"aria-pressed":a,onClick:()=>o(e=>!e),onKeyDown:e=>{if(!a)return;let t=wbe(e);t&&(e.preventDefault(),e.stopPropagation(),o(!1),d(t))},className:`rounded-sm border px-3 py-2 text-xs font-medium ${a?`border-[#11a4d4] bg-[#11a4d4]/10 text-sky-100`:`border-slate-700 text-slate-300 hover:border-[#11a4d4] hover:text-[#7dd3fc]`} disabled:opacity-50`,children:a?`Press shortcut…`:`Record shortcut`}),(0,R.jsx)(`button`,{type:`button`,disabled:s||r===`Alt+Shift+A`,onClick:()=>void d(N2),className:`rounded-sm border border-slate-700 px-3 py-2 text-xs text-slate-300 hover:border-[#11a4d4] hover:text-[#7dd3fc] disabled:opacity-50`,children:`Reset`}),s?(0,R.jsx)(`span`,{className:`text-xs text-slate-400`,children:`Saving…`}):null]}),(0,R.jsxs)(`div`,{className:`text-[11px] text-slate-500`,children:[`Default: `,N2,`. Use a modifier combination to avoid conflicts with normal typing.`]}),l?(0,R.jsx)(`div`,{className:`text-xs text-red-300`,children:l}):null]})})}function wbe(e){if([`Alt`,`Control`,`Meta`,`Shift`].includes(e.key))return null;let t=e.code?.match(/^Key[A-Z]$/)?e.code.slice(3):e.key===` `?`Space`:e.key.length===1?e.key.toUpperCase():e.key,n=[];return e.ctrlKey&&n.push(`Ctrl`),e.altKey&&n.push(`Alt`),e.shiftKey&&n.push(`Shift`),e.metaKey&&n.push(`Meta`),n.push(t),n.join(`+`)}function Tbe(e){let t=new Set([`UTC`,...Intl.supportedValuesOf?.(`timeZone`)??bbe]);return e&&t.add(e),[...t].map(e=>({value:e,label:Ebe(e),offset:Dbe(e)})).sort((e,t)=>e.offset-t.offset||e.label.localeCompare(t.label)).map(({value:e,label:t})=>({value:e,label:t}))}function Ebe(e){let t=e===`UTC`?`UTC`:e.split(`/`).pop()?.replaceAll(`_`,` `)??e,n=e.includes(`/`)?e.split(`/`)[0].replaceAll(`_`,` `):void 0,r=S9(e);return`${t}${n?` (${n})`:``} — ${r}`}function S9(e){try{return new Intl.DateTimeFormat(`en-US`,{timeZone:e,timeZoneName:`shortOffset`}).formatToParts(new Date).find(e=>e.type===`timeZoneName`)?.value.replace(`GMT`,`UTC`)??e}catch{return e}}function Dbe(e){let t=S9(e),n=/^UTC(?:(?<sign>[+-])(?<hours>\d{1,2})(?::(?<minutes>\d{2}))?)?$/.exec(t);return n?.groups?.sign?(n.groups.sign===`-`?-1:1)*(Number(n.groups.hours)*60+Number(n.groups.minutes??0)):0}function Obe({modelDefaults:e,modelCatalog:t,onChanged:n}){let[r,i]=(0,L.useState)(e??{}),[a,o]=(0,L.useState)(!1),[s,c]=(0,L.useState)(null);(0,L.useEffect)(()=>{i(e??{})},[e]);let l=async e=>{i(e),o(!0);try{n(await lK(e)),c(null)}catch(e){c(e instanceof Error?e.message:String(e))}finally{o(!1)}};return(0,R.jsxs)(`div`,{className:`grid gap-3 border-t border-slate-800 pt-3`,children:[(0,R.jsx)(`div`,{className:`text-[10px] font-bold uppercase tracking-wider text-slate-500`,children:`Runtime Model Defaults`}),(0,R.jsx)(q0,{title:`Main Agent`,modelTitle:`Main Agent Default`,model:r.main,thinking:r.mainThinking,fast:r.mainFast??!1,modelCatalog:t,readOnly:a,modelHint:`Unset to use provider fallback.`,configuredProvidersOnly:!0,onModelChange:e=>void l({...r,main:e}),onThinkingChange:e=>void l({...r,mainThinking:e}),onFastChange:e=>void l({...r,mainFast:e})}),(0,R.jsx)(q0,{title:`Subagent`,modelTitle:`Subagent Default`,model:r.subagent,thinking:r.subagentThinking,fast:r.subagentFast??!1,modelCatalog:t,readOnly:a,modelHint:`Unset to use provider fallback.`,configuredProvidersOnly:!0,onModelChange:e=>void l({...r,subagent:e}),onThinkingChange:e=>void l({...r,subagentThinking:e}),onFastChange:e=>void l({...r,subagentFast:e})}),s?(0,R.jsx)(`div`,{className:`text-xs text-amber-100`,children:s}):null]})}function kbe({packages:e,onPackageChanged:t,onPackageRemoved:n}){let[r,i]=(0,L.useState)(``),[a,o]=(0,L.useState)(null),[s,c]=(0,L.useState)(null),[l,u]=(0,L.useState)(()=>new Set),d=e??[],f=d.filter(e=>e.installStatus===`installed`).length,p=d.filter(e=>e.enabled).length,m=async()=>{if(!a){o(`add`);try{let e=await lQ(r);t(e),i(``),u(t=>new Set(t).add(e.id)),c(null)}catch(e){c(e instanceof Error?e.message:String(e))}finally{o(null)}}},h=async e=>{if(!a){o(`${e.id}:enabled`);try{t(await uQ(e.id,{enabled:!e.enabled})),c(null)}catch(e){c(e instanceof Error?e.message:String(e))}finally{o(null)}}},g=async e=>{if(!a&&window.confirm(`Unregister Pi package "${e.name}"?`)){o(`${e.id}:delete`);try{n(await dQ(e.id)),u(t=>{let n=new Set(t);return n.delete(e.id),n}),c(null)}catch(e){c(e instanceof Error?e.message:String(e))}finally{o(null)}}},_=e=>{u(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})};return(0,R.jsxs)(z0,{title:`Pi Package Management`,children:[(0,R.jsxs)(`div`,{className:`grid gap-2`,children:[(0,R.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)_auto] gap-2`,children:[(0,R.jsx)(`input`,{value:r,disabled:!e||a===`add`,onChange:e=>i(e.target.value),className:`min-w-0 bg-[#0e1116] border border-slate-700 rounded-sm px-3 py-2 text-sm outline-none focus:border-[#11a4d4] disabled:opacity-60`,placeholder:`https://pi.dev/packages/package-name`}),(0,R.jsx)(`button`,{type:`button`,disabled:!e||a===`add`||!r.trim(),onClick:()=>void m(),title:`Add Pi Package`,"aria-label":`Add Pi Package`,className:`h-9 w-9 inline-flex items-center justify-center border border-[#11a4d4] rounded-sm text-[#11a4d4] bg-[#11a4d4]/10 disabled:opacity-50`,children:(0,R.jsx)(js,{size:14})})]}),(0,R.jsx)(`div`,{className:`text-[11px] text-slate-500`,children:`Extensions execute code in the Pi runtime. Review package source before adding it.`}),s?(0,R.jsx)(`div`,{className:`border border-red-500/60 bg-red-500/10 text-red-200 px-3 py-2 text-sm rounded-sm`,children:s}):null,(0,R.jsxs)(`div`,{className:`font-mono text-[10px] uppercase tracking-wider text-slate-500`,children:[d.length,` registered / `,f,` installed / `,p,` enabled`]})]}),e?d.length?(0,R.jsx)(`div`,{className:`grid gap-2`,children:d.map(e=>(0,R.jsx)(Mbe,{pkg:e,expanded:l.has(e.id),busy:a?.startsWith(`${e.id}:`)??!1,onToggleExpanded:()=>_(e.id),onToggleEnabled:()=>void h(e),onUnregister:()=>void g(e)},e.id))}):(0,R.jsx)(K0,{message:`No Pi packages registered`}):(0,R.jsx)(K0,{})]})}function Abe({skills:e,onSkillChanged:t,onSkillRemoved:n}){let[r,i]=(0,L.useState)(!1),[a,o]=(0,L.useState)(!1),[s,c]=(0,L.useState)(null),[l,u]=(0,L.useState)(``),[d,f]=(0,L.useState)(null),[p,m]=(0,L.useState)(null),h=e??[],g=h.filter(e=>e.enabled).length,_=async e=>{if(!d){f(`${e.id}:enabled`);try{t(await mQ(e.id,{enabled:!e.enabled})),m(null)}catch(e){m(e instanceof Error?e.message:String(e))}finally{f(null)}}},v=async e=>{if(!d&&window.confirm(`Delete skill "${e.name}"?`)){f(`${e.id}:delete`);try{await hQ(e.id),n(e.id),m(null)}catch(e){m(e instanceof Error?e.message:String(e))}finally{f(null)}}},y=async e=>{f(`create`);try{t(await pQ(e)),i(!1),m(null)}catch(e){m(e instanceof Error?e.message:String(e))}finally{f(null)}},b=async e=>{f(`install`);try{t(await gQ(e)),o(!1),m(null)}catch(e){m(e instanceof Error?e.message:String(e))}finally{f(null)}},x=async(e,n)=>{f(`edit`);try{t(await mQ(e,n)),c(null),m(null)}catch(e){m(e instanceof Error?e.message:String(e))}finally{f(null)}};return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(z0,{title:`Skill Management`,children:[(0,R.jsxs)(`div`,{className:`grid gap-2`,children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,R.jsxs)(`button`,{type:`button`,disabled:d===`create`,onClick:()=>i(!0),className:`inline-flex items-center gap-2 border border-[#11a4d4] rounded-sm px-3 py-2 text-sm text-[#11a4d4] bg-[#11a4d4]/10 disabled:opacity-50`,children:[(0,R.jsx)(js,{size:14}),`Create Skill`]}),(0,R.jsxs)(`button`,{type:`button`,disabled:d===`install`,onClick:()=>o(!0),className:`inline-flex items-center gap-2 border border-slate-700 rounded-sm px-3 py-2 text-sm text-slate-300 hover:border-[#11a4d4] hover:text-[#11a4d4] disabled:opacity-50`,children:[(0,R.jsx)(rs,{size:14}),`Install from URL`]})]}),p?(0,R.jsx)(`div`,{className:`border border-red-500/60 bg-red-500/10 text-red-200 px-3 py-2 text-sm rounded-sm`,children:p}):null,(0,R.jsxs)(`div`,{className:`font-mono text-[10px] uppercase tracking-wider text-slate-500`,children:[h.length,` skills / `,g,` enabled`]})]}),e?h.length?(0,R.jsx)(`div`,{className:`grid gap-2`,children:h.map(e=>(0,R.jsx)(`div`,{className:`border rounded-sm p-2 ${e.enabled?`border-slate-800 bg-[#151f24]`:`border-slate-800 bg-[#151f24] opacity-75`}`,children:(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-2 max-[640px]:items-start`,children:[(0,R.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,R.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,R.jsx)(`span`,{className:`min-w-0 truncate text-sm text-slate-200`,children:e.name}),(0,R.jsx)(`span`,{className:`shrink-0 border px-1.5 py-0.5 font-mono text-[10px] uppercase tracking-wider ${e.enabled?`border-[#11a4d4]/60 text-[#7dd3fc]`:`border-slate-700 text-slate-500`}`,children:e.enabled?`enabled`:`disabled`}),(0,R.jsx)(`span`,{className:`shrink-0 border px-1.5 py-0.5 font-mono text-[10px] uppercase tracking-wider border-slate-700 text-slate-500`,children:e.source})]}),(0,R.jsx)(`div`,{className:`truncate text-xs text-slate-500`,children:e.description||e.path})]}),(0,R.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,R.jsx)(`button`,{type:`button`,disabled:d?.startsWith(`${e.id}:`)??!1,onClick:()=>void _(e),className:`h-7 w-7 inline-flex items-center justify-center border border-slate-700 rounded-sm text-slate-400 hover:border-[#11a4d4] hover:text-[#11a4d4] disabled:opacity-50`,children:e.enabled?(0,R.jsx)(Ms,{size:13}):(0,R.jsx)(Ns,{size:13})}),(0,R.jsx)(`button`,{type:`button`,disabled:d?.startsWith(`${e.id}:`)??!1,onClick:async()=>{try{let t=await fQ(e.id);c(e),u(t.markdown)}catch{c(e),u(``)}},className:`h-7 w-7 inline-flex items-center justify-center border border-slate-700 rounded-sm text-slate-400 hover:border-[#11a4d4] hover:text-[#11a4d4] disabled:opacity-50`,children:(0,R.jsx)(ks,{size:13})}),(0,R.jsx)(`button`,{type:`button`,disabled:d?.startsWith(`${e.id}:`)??!1,onClick:()=>void v(e),className:`h-7 w-7 inline-flex items-center justify-center border border-slate-700 rounded-sm text-slate-400 hover:border-red-500 hover:text-red-400 disabled:opacity-50`,children:(0,R.jsx)(Ws,{size:13})})]})]})},e.id))}):(0,R.jsx)(K0,{message:`No user skills`}):(0,R.jsx)(K0,{})]}),r?(0,R.jsx)(w9,{title:`Create Skill`,onSave:y,onClose:()=>i(!1),busy:d===`create`}):null,a?(0,R.jsx)(jbe,{onInstall:b,onClose:()=>o(!1),busy:d===`install`}):null,s?(0,R.jsx)(w9,{title:`Edit Skill`,initialName:s.name,initialDescription:s.description,initialMarkdown:l,onSave:e=>void x(s.id,e),onClose:()=>c(null),busy:d===`edit`}):null]})}function C9({children:e,onClose:t}){return(0,R.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/70 p-4`,children:[(0,R.jsx)(`div`,{className:`w-full max-w-2xl rounded-sm border border-slate-700 bg-[#151f24] shadow-2xl`,children:e}),(0,R.jsx)(`button`,{type:`button`,className:`absolute inset-0 -z-10`,onClick:t,"aria-label":`Close modal`})]})}function w9({title:e,initialName:t=``,initialDescription:n=``,initialMarkdown:r=``,onSave:i,onClose:a,busy:o}){let[s,c]=(0,L.useState)(t),[l,u]=(0,L.useState)(n),[d,f]=(0,L.useState)(r);return(0,R.jsxs)(C9,{onClose:a,children:[(0,R.jsxs)(`h2`,{className:`flex items-center gap-2 border-b border-slate-800 px-4 py-3 text-sm font-bold uppercase tracking-wider`,children:[(0,R.jsx)(ks,{size:16}),e]}),(0,R.jsxs)(`div`,{className:`grid gap-3 p-4`,children:[(0,R.jsx)(`input`,{value:s,onChange:e=>c(e.target.value),placeholder:`Skill name (kebab-case)`,className:`min-w-0 bg-[#0e1116] border border-slate-700 rounded-sm px-3 py-2 text-sm outline-none focus:border-[#11a4d4]`}),(0,R.jsx)(`input`,{value:l,onChange:e=>u(e.target.value),placeholder:`Short description`,className:`min-w-0 bg-[#0e1116] border border-slate-700 rounded-sm px-3 py-2 text-sm outline-none focus:border-[#11a4d4]`}),(0,R.jsx)(`textarea`,{value:d,onChange:e=>f(e.target.value),placeholder:`Markdown instructions...`,rows:10,className:`min-w-0 bg-[#0e1116] border border-slate-700 rounded-sm px-3 py-2 text-sm outline-none focus:border-[#11a4d4] resize-vertical`}),(0,R.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,R.jsx)(`button`,{type:`button`,onClick:a,className:`px-3 py-2 text-sm border border-slate-700 rounded-sm hover:border-slate-500`,children:`Cancel`}),(0,R.jsx)(`button`,{type:`button`,disabled:o||!s.trim(),onClick:()=>i({name:s,description:l,markdown:d}),className:`px-3 py-2 text-sm border border-[#11a4d4] rounded-sm bg-[#11a4d4]/10 text-[#11a4d4] disabled:opacity-50`,children:o?`Saving...`:`Save`})]})]})]})}function jbe({onInstall:e,onClose:t,busy:n}){let[r,i]=(0,L.useState)(``);return(0,R.jsxs)(C9,{onClose:t,children:[(0,R.jsxs)(`h2`,{className:`flex items-center gap-2 border-b border-slate-800 px-4 py-3 text-sm font-bold uppercase tracking-wider`,children:[(0,R.jsx)(rs,{size:16}),`Install Skill`]}),(0,R.jsxs)(`div`,{className:`grid gap-3 p-4`,children:[(0,R.jsx)(`input`,{value:r,onChange:e=>i(e.target.value),placeholder:`https://skills.sh/account/skills/skill-name`,className:`min-w-0 bg-[#0e1116] border border-slate-700 rounded-sm px-3 py-2 text-sm outline-none focus:border-[#11a4d4]`}),(0,R.jsx)(`div`,{className:`text-[11px] text-slate-500`,children:`Supports skills.sh URLs, GitHub tree URLs, or account/repo shorthand.`}),(0,R.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,R.jsx)(`button`,{type:`button`,onClick:t,className:`px-3 py-2 text-sm border border-slate-700 rounded-sm hover:border-slate-500`,children:`Cancel`}),(0,R.jsx)(`button`,{type:`button`,disabled:n||!r.trim(),onClick:()=>e(r),className:`px-3 py-2 text-sm border border-[#11a4d4] rounded-sm bg-[#11a4d4]/10 text-[#11a4d4] disabled:opacity-50`,children:n?`Installing...`:`Install`})]})]})]})}function Mbe({pkg:e,expanded:t,busy:n,onToggleExpanded:r,onToggleEnabled:i,onUnregister:a}){let o=e.diagnostics.some(e=>e.type===`error`);return(0,R.jsxs)(`div`,{className:`border rounded-sm ${e.enabled?`border-slate-800 bg-[#151f24]`:`border-slate-800 bg-[#151f24] opacity-75`}`,children:[(0,R.jsxs)(`div`,{className:`grid grid-cols-[1fr_auto] gap-2 p-2`,children:[(0,R.jsxs)(`div`,{className:`min-w-0`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(`span`,{className:`min-w-0 truncate text-sm text-slate-200`,children:e.name}),(0,R.jsx)(`span`,{className:`shrink-0 border px-1.5 py-0.5 font-mono text-[10px] uppercase tracking-wider ${e.enabled?`border-[#11a4d4]/60 text-[#7dd3fc]`:`border-slate-700 text-slate-500`}`,children:e.enabled?`enabled`:`disabled`}),(0,R.jsx)(`span`,{className:`shrink-0 border px-1.5 py-0.5 font-mono text-[10px] uppercase tracking-wider ${e.installStatus===`installed`?`border-[#0bda57]/50 text-green-300`:`border-[#f59e0b]/50 text-amber-100`}`,children:e.installStatus})]}),(0,R.jsx)(`div`,{className:`truncate text-xs text-slate-500`,children:e.description??e.source}),(0,R.jsx)(`div`,{className:`font-mono text-[10px] mt-1 ${o?`text-[#f59e0b]`:`text-[#11a4d4]`}`,children:L0(e)})]}),(0,R.jsxs)(`div`,{className:`flex items-start gap-1`,children:[(0,R.jsx)(`button`,{type:`button`,onClick:r,title:t?`Hide Details`:`Show Details`,"aria-label":t?`Hide Details`:`Show Details`,className:`h-7 w-7 inline-flex items-center justify-center border border-slate-700 rounded-sm text-slate-400 hover:border-[#11a4d4] hover:text-[#11a4d4]`,children:t?(0,R.jsx)(Bo,{size:13}):(0,R.jsx)(Vo,{size:13})}),(0,R.jsx)(`button`,{type:`button`,disabled:n,onClick:i,title:e.enabled?`Disable Package`:`Enable Package`,"aria-label":e.enabled?`Disable Package`:`Enable Package`,className:`h-7 w-7 inline-flex items-center justify-center border border-slate-700 rounded-sm text-slate-400 hover:border-[#11a4d4] hover:text-[#11a4d4] disabled:opacity-50`,children:e.enabled?(0,R.jsx)(Ms,{size:13}):(0,R.jsx)(Ns,{size:13})}),(0,R.jsx)(`button`,{type:`button`,disabled:n,onClick:a,title:`Unregister Package`,"aria-label":`Unregister Package`,className:`h-7 w-7 inline-flex items-center justify-center border border-slate-700 rounded-sm text-slate-400 hover:border-red-400 hover:text-red-300 disabled:opacity-50`,children:(0,R.jsx)(Ws,{size:13})})]})]}),t?(0,R.jsx)(H0,{pkg:e}):null]})}function Nbe({data:e,selectedProject:t,selectedPiboSessionId:n,activeProjects:r,archivedProjects:i,sessionGroups:a,selectedSessionPathIds:o,autoRenameSessionId:s,creatingSession:c,showArchivedProjects:l,showArchivedSessions:u,mobileSidebarOpen:d,onRefresh:f,onCloseMobileSidebar:p,onCreateProject:m,onToggleArchivedProjects:h,onSelectProject:g,onRenameProject:_,onSetProjectArchived:v,onDeleteArchivedProject:y,onCreateProjectSession:b,onToggleArchivedSessions:x,onSelectSession:S,onRenameSession:C,onArchiveSession:w,onDeleteSession:T,onViewContext:E,onAutoRenameConsumed:D}){let O=Date.now();return(0,R.jsxs)(`aside`,{className:`min-h-0 overflow-auto bg-[#1a262b] border-r border-slate-800 max-[980px]:fixed max-[980px]:left-0 max-[980px]:top-0 max-[980px]:bottom-0 max-[980px]:z-40 max-[980px]:w-[280px] max-[980px]:transition-transform max-[980px]:duration-200 ${d?`max-[980px]:translate-x-0`:`max-[980px]:-translate-x-full`}`,children:[(0,R.jsxs)(`div`,{className:`h-11 px-3 border-b border-slate-800 flex items-center justify-between text-xs font-bold uppercase tracking-wider max-[980px]:h-auto max-[980px]:py-2`,children:[(0,R.jsx)(`span`,{children:`projects`}),(0,R.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,R.jsx)(`button`,{type:`button`,onClick:f,title:`Refresh`,"aria-label":`Refresh`,className:`p-1 border border-slate-700 rounded-sm text-slate-400 hover:border-[#11a4d4] hover:text-[#11a4d4]`,children:(0,R.jsx)(Ps,{size:13})}),(0,R.jsx)(`button`,{type:`button`,onClick:p,title:`Close sidebar`,"aria-label":`Close sidebar`,className:`min-[981px]:hidden p-1 border border-slate-700 rounded-sm text-slate-400 hover:border-[#11a4d4] hover:text-[#11a4d4]`,children:(0,R.jsx)(Ys,{size:13})})]})]}),(0,R.jsxs)(`div`,{className:`p-2 space-y-3`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{className:`px-1 pb-1 text-[10px] font-bold uppercase tracking-wider text-slate-500`,children:`Shared Project`}),(0,R.jsx)(T9,{project:e.sharedDefaultProject,selected:t?.id===e.sharedDefaultProject.id,onSelect:()=>g(e.sharedDefaultProject.id)})]}),(0,R.jsxs)(`div`,{children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-1 pb-1`,children:[(0,R.jsx)(`div`,{className:`text-[10px] font-bold uppercase tracking-wider text-slate-500`,children:`Projects`}),(0,R.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,R.jsx)(`button`,{type:`button`,onClick:m,title:`New Project`,"aria-label":`New Project`,className:`h-6 w-6 inline-flex items-center justify-center border border-slate-700 rounded-sm text-slate-400 hover:border-[#11a4d4] hover:text-[#11a4d4]`,children:(0,R.jsx)(js,{size:14})}),(0,R.jsx)(`button`,{type:`button`,onClick:h,title:`Archived Projects`,"aria-label":`Archived Projects`,className:`h-6 w-6 inline-flex items-center justify-center border rounded-sm hover:border-[#11a4d4] hover:text-[#11a4d4] ${l?`border-[#11a4d4] text-[#11a4d4]`:`border-slate-700 text-slate-400`}`,children:l?(0,R.jsx)(To,{size:14}):(0,R.jsx)(Eo,{size:14})})]})]}),r.map(e=>(0,R.jsx)(T9,{project:e,selected:t?.id===e.id,onSelect:()=>g(e.id),onRename:t=>_(e,t),onArchive:()=>v(e,!0)},e.id)),r.length===0?(0,R.jsx)(`div`,{className:`px-2 py-3 text-xs text-slate-500 border border-dashed border-slate-700 rounded-sm`,children:`No projects`}):null,l?(0,R.jsxs)(`div`,{className:`mt-3`,children:[(0,R.jsx)(`div`,{className:`px-1 pb-1 text-[10px] font-bold uppercase tracking-wider text-slate-500`,children:`Archived Projects`}),i.map(e=>(0,R.jsx)(T9,{project:e,selected:t?.id===e.id,onSelect:()=>g(e.id),onRename:t=>_(e,t),onArchive:()=>v(e,!1),onDelete:()=>y(e),archived:!0},e.id))]}):null]}),(0,R.jsxs)(`div`,{children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-1 pb-1`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{className:`text-[10px] font-bold uppercase tracking-wider text-slate-500`,children:`Project Sessions`}),(0,R.jsx)(`div`,{className:`text-[10px] text-slate-500`,children:`Sessions run in the project workspace`})]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,R.jsx)(`button`,{type:`button`,onClick:b,disabled:c||!t,title:`New Project Session`,"aria-label":`New Project Session`,className:`h-6 w-6 inline-flex items-center justify-center border border-slate-700 rounded-sm text-slate-400 hover:border-[#11a4d4] hover:text-[#11a4d4] disabled:opacity-50`,children:(0,R.jsx)(js,{size:14})}),(0,R.jsx)(`button`,{type:`button`,onClick:x,title:u?`Hide Archived Project Sessions`:`Show Archived Project Sessions`,"aria-label":u?`Hide Archived Project Sessions`:`Show Archived Project Sessions`,className:`h-6 w-6 inline-flex items-center justify-center border rounded-sm hover:border-[#11a4d4] hover:text-[#11a4d4] ${u?`border-[#11a4d4] text-[#11a4d4]`:`border-slate-700 text-slate-400`}`,children:u?(0,R.jsx)(To,{size:14}):(0,R.jsx)(Eo,{size:14})})]})]}),a.active.map(e=>(0,R.jsx)(y3,{node:e,signalNow:O,selectedPiboSessionId:n,selectedSessionPathIds:o,onSelect:S,onRename:C,onArchive:w,onDelete:T,onViewContext:E,loadingPiboSessionId:null,autoRename:s===e.piboSessionId,onAutoRenameConsumed:D},e.piboSessionId)),a.active.length===0?(0,R.jsx)(`div`,{className:`px-2 py-3 text-xs text-slate-500 border border-dashed border-slate-700 rounded-sm`,children:`No active project sessions`}):null,u?(0,R.jsxs)(`div`,{className:`mt-3`,children:[(0,R.jsx)(`div`,{className:`px-1 pb-1 text-[10px] font-bold uppercase tracking-wider text-slate-500`,children:`Archived Project Sessions`}),a.archived.map(e=>(0,R.jsx)(y3,{node:e,signalNow:O,selectedPiboSessionId:n,selectedSessionPathIds:o,onSelect:S,onRename:C,onArchive:w,onDelete:T,onViewContext:E,loadingPiboSessionId:null},e.piboSessionId)),a.archived.length===0?(0,R.jsx)(`div`,{className:`px-2 py-3 text-xs text-slate-500 border border-dashed border-slate-700 rounded-sm`,children:`No archived project sessions`}):null]}):null]})]})]})}function T9({project:e,selected:t,archived:n,onSelect:r,onRename:i,onArchive:a,onDelete:o}){let s=e.metadata?.default===!0||e.metadata?.personal===!0,[c,l]=(0,L.useState)(!1),[u,d]=(0,L.useState)(e.name),[f,p]=(0,L.useState)(!1),m=(0,L.useRef)(null),h=(0,L.useRef)(null);(0,L.useEffect)(()=>{c||d(e.name)},[c,e.name]),(0,L.useEffect)(()=>{if(!f)return;let e=e=>{h.current&&!h.current.contains(e.target)&&p(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[f]),(0,L.useLayoutEffect)(()=>{c&&(m.current?.focus(),m.current?.select())},[c]);let g=()=>{let t=u.trim();t&&t!==e.name&&i?.(t),l(!1)};return(0,R.jsxs)(`div`,{className:`group flex items-center gap-2 rounded-sm border px-2 py-2 text-sm ${s?t?`border-[#0bda57] bg-[#0bda57]/10 text-green-100`:`border-[#0bda57]/50 bg-[#0bda57]/5 text-slate-300 hover:border-[#0bda57]`:t?`border-[#11a4d4] bg-[#11a4d4]/10 text-sky-100`:`border-transparent text-slate-300 hover:border-slate-700 hover:bg-slate-900/40`}`,children:[(0,R.jsx)(`span`,{className:`h-6 w-6 shrink-0 inline-flex items-center justify-center rounded-sm ${s?`bg-[#0bda57]/15 text-[#0bda57]`:n?`bg-[#f59e0b]/15 text-[#f59e0b]`:`bg-[#151f24] text-slate-500`}`,children:s?(0,R.jsx)(ws,{size:13}):n?(0,R.jsx)(Eo,{size:13}):(0,R.jsx)(ls,{size:13})}),c?(0,R.jsxs)(`form`,{className:`min-w-0 flex-1 grid grid-cols-[1fr_auto_auto] gap-1`,onSubmit:e=>{e.preventDefault(),g()},children:[(0,R.jsx)(`input`,{ref:m,value:u,onChange:e=>d(e.target.value),onKeyDown:t=>{t.key===`Escape`&&(t.preventDefault(),l(!1),d(e.name))},className:`min-w-0 bg-[#0e1116] border border-slate-700 rounded-sm px-2 py-1 text-sm outline-none focus:border-[#11a4d4]`}),(0,R.jsx)(`button`,{type:`submit`,title:`Save Project Name`,"aria-label":`Save Project Name`,className:`h-7 w-7 inline-flex items-center justify-center border border-slate-700 rounded-sm text-slate-400 hover:border-[#11a4d4] hover:text-[#11a4d4]`,children:(0,R.jsx)(zo,{size:13})}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>{l(!1),d(e.name)},title:`Cancel Rename`,"aria-label":`Cancel Rename`,className:`h-7 w-7 inline-flex items-center justify-center border border-slate-700 rounded-sm text-slate-400 hover:border-[#11a4d4] hover:text-[#11a4d4]`,children:(0,R.jsx)(Ys,{size:13})})]}):(0,R.jsxs)(`button`,{type:`button`,onClick:r,className:`min-w-0 flex-1 text-left`,children:[(0,R.jsx)(`span`,{className:`block truncate font-medium`,children:e.name}),(0,R.jsx)(`span`,{className:`block truncate text-[11px] text-slate-500`,children:s?`shared default project chat`:e.projectFolder})]}),s?(0,R.jsx)(`span`,{title:`Shared Project is locked`,"aria-label":`Shared Project is locked`,className:`h-7 w-7 max-[980px]:h-9 max-[980px]:w-9 inline-flex items-center justify-center border border-[#0bda57]/50 rounded-sm text-[#0bda57]`,children:(0,R.jsx)(ws,{size:24,className:`w-3.5 h-3.5 max-[980px]:w-5 max-[980px]:h-5`})}):c?null:(0,R.jsxs)(`div`,{className:`relative opacity-0 group-hover:opacity-100 group-focus-within:opacity-100 transition-opacity max-[980px]:opacity-100`,ref:h,children:[(0,R.jsx)(`button`,{type:`button`,onClick:()=>p(e=>!e),title:`Project actions`,"aria-label":`Project actions`,className:`h-7 w-7 max-[980px]:h-9 max-[980px]:w-9 inline-flex items-center justify-center border border-slate-700 rounded-sm text-slate-400 hover:border-[#11a4d4] hover:text-[#11a4d4]`,children:(0,R.jsx)(ns,{size:24,className:`w-3.5 h-3.5 max-[980px]:w-5 max-[980px]:h-5`})}),f?(0,R.jsxs)(`div`,{className:`absolute right-0 top-full z-50 mt-1 w-48 bg-[#1a262b] border border-slate-700 rounded-sm shadow-lg py-1`,children:[i?(0,R.jsxs)(`button`,{type:`button`,onClick:()=>{p(!1),l(!0)},className:`w-full text-left px-3 py-2.5 text-sm text-slate-300 hover:bg-[#11a4d4]/10 hover:text-[#11a4d4] flex items-center gap-2`,children:[(0,R.jsx)(ks,{size:16}),` Rename Project`]}):null,a?(0,R.jsxs)(`button`,{type:`button`,onClick:()=>{p(!1),a()},className:`w-full text-left px-3 py-2.5 text-sm text-slate-300 hover:bg-[#11a4d4]/10 hover:text-[#11a4d4] flex items-center gap-2`,children:[n?(0,R.jsx)(To,{size:16}):(0,R.jsx)(Eo,{size:16}),` `,n?`Restore Project`:`Archive Project`]}):null,o?(0,R.jsxs)(`button`,{type:`button`,onClick:()=>{p(!1),o()},className:`w-full text-left px-3 py-2.5 text-sm text-red-300 hover:bg-red-500/10 flex items-center gap-2`,children:[(0,R.jsx)(Ws,{size:16}),` Delete Project`]}):null]}):null]})]})}function Pbe(e){let t=[],n=[];for(let r of e??[])r.archivedAt?n.push(r):t.push(r);return{active:t,archived:n}}function Fbe(e,t){return{...e,...t?.session?{session:t.session}:{},agents:t?.agents??e.agents,customAgents:t?.customAgents??e.customAgents,modelDefaults:t?.modelDefaults??e.modelDefaults,modelCatalog:t?.modelCatalog??e.modelCatalog,agentCatalog:t?.agentCatalog??e.agentCatalog,capabilities:t?.capabilities??e.capabilities,sessions:t?.sessions??[]}}var Ibe=[{id:`sessions`,label:`Sessions`,routeSegment:`sessions`,enabled:!0,description:`Room-like chat sessions that always run in the project workspace.`},{id:`workflows`,label:`Workflows`,routeSegment:`workflows`,enabled:!1,description:`Workflow runs and graph authoring will return as a project module after the redesign.`},{id:`todos`,label:`Todos / Kanban`,routeSegment:`todos`,enabled:!1,description:`Project-scoped planning views are reserved for a later module.`},{id:`knowledge`,label:`Knowledge`,routeSegment:`knowledge`,enabled:!1,description:`Project-scoped knowledge, skills, MCPs, hooks, and heartbeat modules are deferred.`}],Lbe=new Set;function Rbe({baseBootstrap:e,routeProjectId:t,routePiboSessionId:n,sessionViews:r,showRawEvents:i,showThinking:a,expandThinking:o,commands:s,skills:c,onNavigate:l,onViewContext:u,onSelectSessionView:d,onToggleRawEvents:f,onToggleThinking:p,onToggleExpandThinking:m,onThinkingLevelChange:h,mobileSidebarOpen:g,onCloseMobileSidebar:_,onError:v}){let[y,b]=(0,L.useState)(null),[x,S]=(0,L.useState)(!0),[C,w]=(0,L.useState)(()=>localStorage.getItem(`pibo.chat.projects.showArchivedProjects`)===`true`),[T,E]=(0,L.useState)(()=>localStorage.getItem(`pibo.chat.projects.showArchivedSessions`)===`true`),[D,O]=(0,L.useState)(!1),[k,A]=(0,L.useState)(null),[j,M]=(0,L.useState)(null),[N,P]=(0,L.useState)(()=>n?l2(n):``),[ee,te]=(0,L.useState)(0),ne=(0,L.useCallback)(async(e={})=>{S(!0);try{let r=await $s({projectId:e.projectId??t,piboSessionId:e.piboSessionId??n,includeArchived:C||T});return b(r),(!t||r.selectedProjectId!==t||r.selectedPiboSessionId&&r.selectedPiboSessionId!==n)&&l(r.selectedProjectId,r.selectedPiboSessionId,!0,{closeMobileSidebar:!1}),v(null),r}catch(e){throw v(c3(e)),e}finally{S(!1)}},[v,l,n,t,C,T]);(0,L.useEffect)(()=>{ne()},[ne]),(0,L.useEffect)(()=>{P(n?l2(n):``)},[n]);let F=y?.project,re=y?.selectedPiboSessionId??null,I=re&&y?r3(y.sessions,re):void 0,ie=I?.profile??t3(e),ae=y?.projectSessions??[],oe=Pbe(y?.projects),se=oe.active,ce=oe.archived,le=(0,L.useMemo)(()=>y?p3(y.sessions,T):{active:[],archived:[]},[y,T]),ue=(0,L.useMemo)(()=>re&&y?new Set(i3(y.sessions,re).map(e=>e.piboSessionId)):Lbe,[y,re]),de=(0,L.useMemo)(()=>Fbe(e,y),[e,y]),fe=(0,L.useMemo)(()=>n9(`terminal`),[]),pe=k===`info`&&F?(0,R.jsx)(zbe,{project:F,sessionCount:ae.length}):null,me=(0,L.useMemo)(()=>[{id:`project-info`,label:`Info`,description:`Project workspace and project-scoped module overview.`,active:k===`info`,onSelect:()=>A(`info`)},{id:`project-workflows`,label:`Workflows`,description:`Project workflows will return as a dedicated project view after the redesign.`,disabled:!0,onSelect:()=>void 0}],[k]),he=e=>{A(null),d(e)},ge=async()=>{let e=window.prompt(`Project name`);if(!e)return;let t=window.prompt(`Project folder path (absolute path, e.g. ~/code/my-project or /home/me/code/my-project)`);if(!t)return;let n=window.prompt(`Description (optional)`)??void 0;try{let{project:r}=await ec({name:e,projectFolder:t,createFolder:!0,...n?{description:n}:{}});await ne({projectId:r.id}),l(r.id,void 0)}catch(e){v(c3(e))}},_e=async()=>{if(F){O(!0);try{let e=await rc(F.id,{profile:ie,workflowId:`simple-chat`});M(e.session.id),l(F.id,e.session.id,!1,{closeMobileSidebar:!1}),await ne({projectId:F.id,piboSessionId:e.session.id})}catch(e){v(c3(e))}finally{O(!1)}}},ve=async(e,t)=>{try{await ic(e,{title:t}),await ne({projectId:F?.id,piboSessionId:e})}catch(e){v(c3(e))}},ye=async(e,t)=>{try{await tc(e.id,{name:t}),await ne({projectId:F?.id,piboSessionId:re??void 0})}catch(e){v(c3(e))}},be=async(e,t)=>{try{await tc(e.id,{archived:t});let n=await ne({projectId:t?void 0:e.id});t&&F?.id===e.id&&l(n.selectedProjectId,n.selectedPiboSessionId)}catch(e){v(c3(e))}},xe=async e=>{let t=window.prompt(`Type the project name to permanently delete "${e.name}".`);if(t===null)return;let n=window.confirm(`Also delete the real project folder?\n\n${e.projectFolder}`);try{await nc(e.id,{confirmName:t,deleteFiles:n});let r=await ne({projectId:F?.id===e.id?void 0:F?.id});F?.id===e.id&&l(r.selectedProjectId,r.selectedPiboSessionId)}catch(e){v(c3(e))}};return x&&!y?(0,R.jsx)(`main`,{className:`min-h-0 grid place-items-center text-slate-400`,children:`Loading Projects...`}):y?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`div`,{className:`fixed inset-0 z-30 bg-black/60 min-[981px]:hidden transition-opacity duration-200 ${g?`opacity-100 pointer-events-auto`:`opacity-0 pointer-events-none`}`,onClick:_}),(0,R.jsx)(Nbe,{data:y,selectedProject:F,selectedPiboSessionId:re,activeProjects:se,archivedProjects:ce,sessionGroups:le,selectedSessionPathIds:ue,autoRenameSessionId:j,creatingSession:D,showArchivedProjects:C,showArchivedSessions:T,mobileSidebarOpen:g,onRefresh:()=>void ne(),onCloseMobileSidebar:_,onCreateProject:()=>void ge(),onToggleArchivedProjects:()=>{let e=!C;w(e),localStorage.setItem(`pibo.chat.projects.showArchivedProjects`,String(e))},onSelectProject:e=>l(e,void 0),onRenameProject:(e,t)=>void ye(e,t),onSetProjectArchived:(e,t)=>void be(e,t),onDeleteArchivedProject:e=>void xe(e),onCreateProjectSession:()=>void _e(),onToggleArchivedSessions:()=>{let e=!T;E(e),localStorage.setItem(`pibo.chat.projects.showArchivedSessions`,String(e))},onSelectSession:e=>l(F?.id,e),onRenameSession:(e,t)=>void ve(e,t),onArchiveSession:(e,t)=>void ic(e,{archived:t}).then(()=>ne({projectId:F?.id})),onDeleteSession:e=>void ic(e.piboSessionId,{archived:!0}).then(()=>ne({projectId:F?.id})),onViewContext:u,onAutoRenameConsumed:()=>M(null)}),(0,R.jsx)(l3,{bootstrap:de,selectedPiboSessionId:re,selectedRoomId:null,selectedRoomArchived:!!F?.archivedAt,selectedSessionProfile:ie,selectedSessionActiveModel:n3(de,I??{profile:ie}),selectedSessionStatus:I?.status,sessionViewId:`terminal`,sessionViews:r,currentSessionView:fe,allowedSessionViewIds:[`terminal`],extraViewTabs:me,activeViewId:k?`project-${k}`:`terminal`,projectModulePanel:pe,creatingSession:D,showRawEvents:i,showThinking:a,expandThinking:o,commands:s,skills:c,composerText:N,composerFocusSignal:ee,onComposerTextChange:e=>P(t=>typeof e==`function`?e(t):e),onToggleRawEvents:f,onToggleThinking:p,onToggleExpandThinking:m,onSessionAgentProfileChange:async e=>{re&&await pc(re,{profile:e})},onFork:()=>void 0,onOpenSession:e=>l(F?.id,e),onSelectSessionView:he,onCommand:async e=>{if(!re)return!1;let t=e.trim().split(/\s+/)[0],n=s.find(e=>e.slash===t);return n?(await gc(re,n.action),await ne({projectId:F?.id,piboSessionId:re}),!0):!1},onThinkingLevelChange:h,onRefreshTrace:async()=>void 0,onRefreshBootstrap:async()=>{await ne({projectId:F?.id,piboSessionId:re??void 0})},onSend:async(e,t,n,r)=>{re&&await ac(re,e,r)},onError:v})]}):(0,R.jsx)(`main`,{className:`min-h-0 grid place-items-center bg-[#101d22] p-6 text-slate-300`,children:(0,R.jsxs)(`div`,{className:`max-w-lg rounded-sm border border-red-900/70 bg-red-950/30 p-4 text-sm leading-6 text-red-100`,role:`alert`,children:[(0,R.jsx)(`div`,{className:`font-bold`,children:`Projects could not be loaded`}),(0,R.jsx)(`div`,{className:`mt-1 text-xs text-red-100/80`,children:`The Projects bootstrap response was empty or unavailable. Refresh to try again.`}),(0,R.jsx)(`button`,{type:`button`,className:`mt-3 rounded-sm border border-red-400/60 px-3 py-1.5 text-xs font-semibold text-red-100 hover:border-red-300`,onClick:()=>void ne(),children:`Refresh Projects`})]})})}function zbe({project:e,sessionCount:t}){return(0,R.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto bg-[#0e1116] p-4 text-sm text-slate-300`,children:(0,R.jsxs)(`div`,{className:`mx-auto max-w-5xl space-y-4`,children:[(0,R.jsxs)(`section`,{className:`rounded-sm border border-slate-800 bg-[#151f24] p-4`,children:[(0,R.jsx)(`div`,{className:`text-[10px] font-bold uppercase tracking-[0.18em] text-[#11a4d4]`,children:`Project Info`}),(0,R.jsx)(`h2`,{className:`mt-1 text-lg font-bold text-slate-100`,children:e.name}),(0,R.jsxs)(`div`,{className:`mt-3 grid gap-3 text-xs md:grid-cols-2`,children:[(0,R.jsx)(E9,{label:`Workspace`,value:e.projectFolder,monospace:!0}),(0,R.jsx)(E9,{label:`Sessions`,value:String(t)}),(0,R.jsx)(E9,{label:`Status`,value:e.archivedAt?`archived`:`active`}),(0,R.jsx)(E9,{label:`Project id`,value:e.id,monospace:!0})]})]}),(0,R.jsxs)(`section`,{className:`rounded-sm border border-slate-800 bg-[#151f24] p-4`,children:[(0,R.jsx)(`div`,{className:`text-[10px] font-bold uppercase tracking-[0.18em] text-slate-500`,children:`Project views`}),(0,R.jsx)(`p`,{className:`mt-2 max-w-2xl text-xs leading-5 text-slate-400`,children:`Project-scoped capabilities live in top-level view tabs, not in the sidebar. Terminal stays a clean session view; future views can be enabled here without becoming session rows.`}),(0,R.jsx)(`div`,{className:`mt-4 grid gap-2 md:grid-cols-2 xl:grid-cols-4`,children:Ibe.map(e=>(0,R.jsxs)(`div`,{className:`rounded-sm border px-3 py-3 text-xs ${e.enabled?`border-[#11a4d4] bg-[#11a4d4]/10 text-[#8bdcf4]`:`border-slate-800 bg-[#101d22]/60 text-slate-500`}`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,R.jsx)(`span`,{className:`font-semibold`,children:e.label}),(0,R.jsx)(`span`,{className:`text-[10px] uppercase tracking-wider`,children:e.enabled?`active`:`later`})]}),(0,R.jsx)(`div`,{className:`mt-2 text-[11px] leading-5 opacity-80`,children:e.description})]},e.id))})]})]})})}function E9({label:e,value:t,monospace:n}){return(0,R.jsxs)(`div`,{className:`rounded-sm border border-slate-800 bg-[#101d22] p-3`,children:[(0,R.jsx)(`div`,{className:`text-[10px] font-bold uppercase tracking-[0.16em] text-slate-500`,children:e}),(0,R.jsx)(`div`,{className:`mt-1 break-words text-slate-200 ${n?`font-mono text-[11px]`:`text-xs`}`,children:t})]})}var D9=`Delete this session`;function Bbe({session:e,confirmText:t,deleting:n,onConfirmTextChange:r,onCancel:i,onDelete:a}){return(0,R.jsx)(`div`,{className:`fixed inset-0 z-50 bg-black/70 grid place-items-center p-4`,children:(0,R.jsxs)(`div`,{className:`w-full max-w-lg border border-red-500/70 bg-[#1a262b] rounded-sm shadow-xl`,children:[(0,R.jsxs)(`div`,{className:`px-4 py-3 border-b border-red-500/50 flex items-center justify-between gap-3`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h2`,{className:`text-sm font-bold uppercase tracking-wider text-red-200`,children:`Delete Session`}),(0,R.jsx)(`div`,{className:`font-mono text-[11px] text-slate-500 truncate`,children:e.piboSessionId})]}),(0,R.jsx)(`button`,{type:`button`,onClick:i,disabled:n,title:`Cancel`,"aria-label":`Cancel`,className:`h-8 w-8 inline-flex items-center justify-center border border-slate-700 rounded-sm text-slate-400 hover:border-[#11a4d4] hover:text-[#11a4d4] disabled:opacity-50`,children:(0,R.jsx)(Ys,{size:14})})]}),(0,R.jsxs)(`div`,{className:`p-4 grid gap-3`,children:[(0,R.jsx)(`div`,{className:`border border-red-500/60 bg-red-500/10 text-red-100 rounded-sm p-3 text-sm`,children:`This permanently deletes the archived session, its child sessions, and their Chat events. This cannot be undone.`}),(0,R.jsxs)(`div`,{className:`text-sm text-slate-300`,children:[`Type `,(0,R.jsx)(`span`,{className:`font-mono text-red-200`,children:D9}),` to confirm.`]}),(0,R.jsx)(`input`,{value:t,onChange:e=>r(e.target.value),className:`min-w-0 bg-[#0e1116] border border-slate-700 rounded-sm px-3 py-2 text-sm outline-none focus:border-red-500`,placeholder:D9,autoFocus:!0}),(0,R.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,R.jsx)(`button`,{type:`button`,onClick:i,disabled:n,className:`h-8 inline-flex items-center border border-slate-700 rounded-sm px-3 text-slate-300 hover:border-[#11a4d4] hover:text-[#11a4d4] disabled:opacity-50`,children:`Cancel`}),(0,R.jsxs)(`button`,{type:`button`,onClick:a,disabled:n||t!==D9,className:`h-8 inline-flex items-center gap-2 border border-red-500 rounded-sm px-3 text-red-200 bg-red-500/10 disabled:opacity-50`,children:[(0,R.jsx)(Ws,{size:14}),`Delete permanently`]})]})]})]})})}function Vbe({room:e,confirmName:t,deleting:n,onConfirmNameChange:r,onCancel:i,onDelete:a}){return(0,R.jsx)(`div`,{className:`fixed inset-0 z-50 bg-black/70 grid place-items-center p-4`,children:(0,R.jsxs)(`div`,{className:`w-full max-w-lg border border-red-500/70 bg-[#1a262b] rounded-sm shadow-xl`,children:[(0,R.jsxs)(`div`,{className:`px-4 py-3 border-b border-red-500/50 flex items-center justify-between gap-3`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h2`,{className:`text-sm font-bold uppercase tracking-wider text-red-200`,children:`Delete Room`}),(0,R.jsx)(`div`,{className:`font-mono text-[11px] text-slate-500 truncate`,children:e.id})]}),(0,R.jsx)(`button`,{type:`button`,onClick:i,disabled:n,title:`Cancel`,"aria-label":`Cancel`,className:`h-8 w-8 inline-flex items-center justify-center border border-slate-700 rounded-sm text-slate-400 hover:border-[#11a4d4] hover:text-[#11a4d4] disabled:opacity-50`,children:(0,R.jsx)(Ys,{size:14})})]}),(0,R.jsxs)(`div`,{className:`p-4 grid gap-3`,children:[(0,R.jsx)(`div`,{className:`border border-red-500/60 bg-red-500/10 text-red-100 rounded-sm p-3 text-sm`,children:`This permanently deletes the archived room, child rooms, all contained sessions, subagent sessions, and their Chat events. This cannot be undone.`}),(0,R.jsxs)(`div`,{className:`text-sm text-slate-300`,children:[`Type `,(0,R.jsx)(`span`,{className:`font-mono text-red-200`,children:e.name}),` to confirm.`]}),(0,R.jsx)(`input`,{value:t,onChange:e=>r(e.target.value),className:`min-w-0 bg-[#0e1116] border border-slate-700 rounded-sm px-3 py-2 text-sm outline-none focus:border-red-500`,placeholder:e.name,autoFocus:!0}),(0,R.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,R.jsx)(`button`,{type:`button`,onClick:i,disabled:n,className:`h-8 inline-flex items-center border border-slate-700 rounded-sm px-3 text-slate-300 hover:border-[#11a4d4] hover:text-[#11a4d4] disabled:opacity-50`,children:`Cancel`}),(0,R.jsxs)(`button`,{type:`button`,onClick:a,disabled:n||t!==e.name,className:`h-8 inline-flex items-center gap-2 border border-red-500 rounded-sm px-3 text-red-200 bg-red-500/10 disabled:opacity-50`,children:[(0,R.jsx)(Ws,{size:14}),`Delete permanently`]})]})]})]})})}var O9=[`sessions`,`projects`,`cron`,`ralph`,`agents`,`context`,`settings`];function Hbe(){return(0,R.jsxs)(`div`,{className:`fixed top-0 left-0 right-0 z-50 bg-red-600 text-white text-center text-sm font-bold py-1.5 px-4 flex items-center justify-center gap-2 shadow-lg`,children:[(0,R.jsx)(Gs,{size:16}),`Recovery Mode: Main gateway is down. You are connected to a fallback instance.`]})}function Ube({area:e,identity:t,mobileAreaMenuOpen:n,mobileAreaMenuRef:r,totalRoomUnreadCount:i,onOpenMobileSidebar:a,onSelectMainNavArea:o,onToggleMobileAreaMenu:s}){let c=t.email||t.name||t.userId;return(0,R.jsxs)(`header`,{className:`relative flex items-center gap-3 px-4 bg-[#1a262b] border-b border-slate-800 min-h-14 max-[980px]:px-3`,children:[(0,R.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,R.jsx)(`button`,{type:`button`,onClick:a,className:`min-[981px]:hidden shrink-0 p-1.5 border border-slate-700 rounded-sm text-slate-400 hover:border-[#11a4d4] hover:text-[#11a4d4]`,title:`Open sidebar`,"aria-label":`Open sidebar`,children:(0,R.jsx)(Ts,{size:16})}),(0,R.jsx)(`img`,{src:`/apps/chat/assets/pwa-images/android/launchericon-512x512.png`,alt:`Logo`,className:`h-5 w-auto shrink-0`}),(0,R.jsx)(`div`,{className:`truncate font-extrabold tracking-[0.08em] uppercase text-lg max-[420px]:text-base`,children:`Pibo Chat`})]}),(0,R.jsx)(`nav`,{className:`flex gap-1 max-[1200px]:hidden min-[1201px]:absolute min-[1201px]:left-1/2 min-[1201px]:-translate-x-1/2`,children:O9.map(t=>(0,R.jsx)(`button`,{type:`button`,onClick:()=>o(t),className:`h-8 px-3 border rounded-sm text-xs uppercase tracking-wider ${e===t?`border-[#11a4d4] text-[#11a4d4] bg-[#11a4d4]/10`:`border-slate-700 text-slate-400`}`,children:(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,R.jsx)(`span`,{children:t}),t===`sessions`?(0,R.jsx)(k9,{count:i}):null]})},t))}),(0,R.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center justify-end gap-2 text-xs text-slate-400 min-[1201px]:ml-0`,children:[(0,R.jsx)(Ks,{size:14}),(0,R.jsx)(`span`,{className:`truncate max-[600px]:hidden`,children:c}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>void O_e().then(()=>location.reload()),className:`p-1 border border-slate-700 rounded-sm hover:border-[#11a4d4] hover:text-[#11a4d4]`,title:`Sign out`,"aria-label":`Sign out`,children:(0,R.jsx)(Cs,{size:14})}),(0,R.jsxs)(`div`,{className:`relative min-[1201px]:hidden`,ref:r,children:[(0,R.jsx)(`button`,{type:`button`,onClick:s,className:`p-1 border rounded-sm hover:border-[#11a4d4] hover:text-[#11a4d4] ${n?`border-[#11a4d4] text-[#11a4d4] bg-[#11a4d4]/10`:`border-slate-700 text-slate-400`}`,title:`Open navigation menu`,"aria-label":`Open navigation menu`,"aria-expanded":n,children:(0,R.jsx)(xs,{size:14})}),n?(0,R.jsx)(`div`,{className:`absolute right-0 top-full z-50 mt-2 w-52 rounded-sm border border-slate-700 bg-[#1a262b] p-1 shadow-xl`,role:`menu`,"aria-label":`Main navigation`,children:O9.map(t=>(0,R.jsxs)(`button`,{type:`button`,onClick:()=>o(t),className:`flex w-full items-center justify-between gap-2 rounded-sm px-3 py-2 text-left text-xs uppercase tracking-wider ${e===t?`bg-[#11a4d4]/10 text-[#11a4d4]`:`text-slate-300 hover:bg-slate-800/80 hover:text-[#11a4d4]`}`,role:`menuitem`,children:[(0,R.jsx)(`span`,{children:t}),t===`sessions`?(0,R.jsx)(k9,{count:i}):null]},t))}):null]})]})]})}function Wbe({message:e,onDismiss:t}){return(0,R.jsxs)(`div`,{className:`border-b border-red-500/40 bg-red-500/10 px-4 py-2 text-sm text-red-100 flex items-start justify-between gap-3`,children:[(0,R.jsxs)(`div`,{className:`min-w-0 flex items-start gap-2`,children:[(0,R.jsx)(Gs,{size:16,className:`mt-0.5 shrink-0 text-red-300`}),(0,R.jsxs)(`div`,{className:`min-w-0`,children:[(0,R.jsx)(`div`,{className:`text-[11px] font-bold uppercase tracking-wider text-red-300`,children:`Session Error`}),(0,R.jsx)(`div`,{className:`break-words`,children:e})]})]}),(0,R.jsx)(`button`,{type:`button`,onClick:t,className:`shrink-0 rounded-sm border border-red-500/40 px-2 py-1 text-[11px] uppercase tracking-wider text-red-200 hover:border-red-300 hover:text-red-100`,children:`Dismiss`})]})}function Gbe({message:e}){return(0,R.jsx)(`div`,{className:`min-h-screen bg-[#101d22] text-slate-300 grid place-items-center`,children:(0,R.jsxs)(`div`,{className:`border border-slate-700 bg-[#1a262b] p-5 rounded-sm`,children:[(0,R.jsx)(`div`,{className:`mb-4 text-sm text-slate-400`,children:e}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>void k_e(),className:`px-3 py-2 bg-[#11a4d4] rounded-sm`,children:`Sign in with Google`})]})})}function Kbe(e){return e>99?`99+`:String(e)}function k9({count:e}){return!e||e<=0?null:(0,R.jsx)(`span`,{className:`min-w-5 h-5 px-1.5 inline-flex items-center justify-center rounded-full bg-[#38bdf8] text-[#0e1116] text-[10px] font-bold tabular-nums leading-none`,"aria-label":`${e} unread messages across all rooms`,title:`${e} unread messages across all rooms`,children:Kbe(e)})}function A9(e,t){return j9(e,e=>F9(t.sessions[e]))}function qbe(e,t){let n=new Map(t.sessionSnapshots.map(e=>[e.piboSessionId,F9(e)]));return j9(e,e=>n.get(e))}function j9(e,t){return{...e,sessions:e.sessions.map(e=>M9(e,t))}}function M9(e,t){let n=t(e.piboSessionId),r=P9(n,N9(e)),i=r&&r!==e.status?L9(e.lastActivityAt,n?.updatedAt,new Date().toISOString()):L9(e.lastActivityAt,n?.updatedAt);return{...e,status:r??e.status,lastActivityAt:i,children:e.children.map(e=>M9(e,t)),derivedSessions:e.derivedSessions.map(e=>{let n=t(e.piboSessionId),r=P9(n,0),i=!!(r&&r!==e.status);return{...e,status:r??e.status,lastActivityAt:i?L9(e.lastActivityAt,n?.updatedAt,new Date().toISOString()):L9(e.lastActivityAt,n?.updatedAt)}})}}function N9(e){return(e.unreadCount??0)+e.children.reduce((e,t)=>e+N9(t),0)}function P9(e,t){return e?.status===`error`?t>0?`error`:e.isTreeActive?`running`:`idle`:e?.status}function F9(e){let t=I9(e);if(!(!e&&!t))return{status:t,updatedAt:e?.updatedAt,isTreeActive:e?.isTreeActive}}function I9(e){if(e)return e.hasError||e.hasErrorDescendant||e.aggregateStatus===`error`?`error`:e.isTreeActive?`running`:`idle`}function L9(...e){let t,n=-1/0;for(let r of e){if(!r)continue;let e=Date.parse(r);!Number.isFinite(e)||e<n||(t=r,n=e)}return t}function Jbe(e,t){if(!e||e.rootPiboSessionId!==t.rootPiboSessionId||e.version!==t.fromVersion)return e;let n={...e.nodes};for(let e of t.removes)delete n[e];for(let e of t.upserts)n[e.id]=e;let r={...e.sessions};for(let e of t.sessionSnapshots)r[e.piboSessionId]=e;return{...e,version:t.toVersion,generatedAt:t.generatedAt,nodes:n,sessions:r}}function R9(e,t,n={}){let r=n.readSessionId?Ybe(e.sessions,n.readSessionId):new Set,i=new Map;z9(e.sessions,i);let a=[...r].reduce((e,t)=>e+(i.get(t)??0),0);return{...e,identity:t.identity,session:t.session,room:t.room,selectedRoomId:t.selectedRoomId,selectedPiboSessionId:t.selectedPiboSessionId,latestRoomStreamId:t.latestRoomStreamId,rooms:Xbe(e.rooms,t.rooms,t.selectedRoomId,a),sessions:V9(t.sessions,r,i)}}function z9(e,t){for(let n of e)t.set(n.piboSessionId,n.unreadCount??0),z9(n.children,t)}function Ybe(e,t){let n=new Set,r=e=>e.piboSessionId===t?(B9(e,n),!0):e.children.some(e=>r(e));for(let t of e)r(t);return n}function B9(e,t){t.add(e.piboSessionId);for(let n of e.children)B9(n,t)}function V9(e,t,n){return e.map(e=>{let r=n.get(e.piboSessionId),i=t.has(e.piboSessionId)?0:e.unreadCount??r??0;return{...e,...i>0?{unreadCount:i}:{unreadCount:void 0},children:V9(e.children,t,n)}})}function Xbe(e,t,n,r){let i=new Map;return H9(e,i),U9(t,i,n,r).rooms}function H9(e,t){for(let n of e)t.set(n.id,n.unreadCount??0),H9(n.children??[],t)}function U9(e,t,n,r){let i=!1;return{rooms:e.map(e=>{let a=U9(e.children??[],t,n,r),o=e.id===n||a.selectedRoomFound;i||=o;let s=e.unreadCount??t.get(e.id)??0,c=o&&r>0?Math.max(0,s-r):s;return{...e,...c>0?{unreadCount:c}:{unreadCount:void 0},...e.children?{children:a.rooms}:{}}}),selectedRoomFound:i}}function Zbe(e,t){if(!t.length)return e;let n=new Set(e.map(e=>e.piboSessionId)),r=t.filter(e=>!n.has(e.piboSessionId));return r.length?[...e,...r]:e}function Qbe(e,t){return e.agentCatalog?{...e,agentCatalog:{...e.agentCatalog,mcpServers:e.agentCatalog.mcpServers.map(e=>e.name===t.name?t:e)}}:e}function W9(e,t){if(!e.agentCatalog)return e;let n=e.agentCatalog.piPackages.filter(e=>e.id!==t.id);return{...e,agentCatalog:{...e.agentCatalog,piPackages:J9([...n,t])}}}function G9(e,t){return e.agentCatalog?{...e,agentCatalog:{...e.agentCatalog,piPackages:e.agentCatalog.piPackages.filter(e=>e.id!==t)}}:e}function K9(e,t){if(!e.agentCatalog)return e;let n=e.agentCatalog.userSkills.filter(e=>e.id!==t.id);return{...e,agentCatalog:{...e.agentCatalog,userSkills:J9([...n,t])}}}function q9(e,t){return e.agentCatalog?{...e,agentCatalog:{...e.agentCatalog,userSkills:e.agentCatalog.userSkills.filter(e=>e.id!==t)}}:e}function J9(e){return e.sort((e,t)=>e.name.localeCompare(t.name))}function $be(e,t){let n=o9(e);return{deletedSessionIds:n,selectedSessionDeleted:t?n.has(t):!1,restoreSelectedPiboSessionId:t}}function exe(e,t,n){return t?e.includes(t):n}function txe(e,t){return t?void 0:e??void 0}function nxe(e,t,n){let r=f9(e);return{deletedRoomIds:r,selectedRoomDeleted:t?r.has(t):!1,restoreSelectedRoomId:t,restoreSelectedPiboSessionId:n}}function rxe(e,t){return t===e}function ixe({queryClient:e,bootstrap:t,selectedPiboSessionId:n,selectedRoomId:r,showArchivedRef:i,isSessionsArea:a,loadBootstrap:o,navigateToSelectedSession:s,updateBootstrapCache:c,restoreBootstrapSnapshot:l,setSelectedPiboSessionId:u,setSelectedRoomId:d,setError:f}){let[p,m]=(0,L.useState)(null),[h,g]=(0,L.useState)(``),[_,v]=(0,L.useState)(!1),[y,b]=(0,L.useState)(null),[x,S]=(0,L.useState)(``),[C,w]=(0,L.useState)(!1),T=e=>{b(e),S(``)},E=()=>{b(null),S(``)},D=async()=>{if(!y)return;w(!0),await e.cancelQueries({queryKey:[`chat`,`bootstrap`]});let d=r9(e,t),p=$be(y,n);p.selectedSessionDeleted&&u(null),c(e=>Qye(e,p.deletedSessionIds));try{let e=exe((await mc(y.piboSessionId,x)).deletedSessionIds,n,p.selectedSessionDeleted);e&&u(null);let t=await o(txe(n,e),i.current,r??void 0,{force:!0});a&&s(t.selectedRoomId,t.selectedPiboSessionId,!1,{closeMobileSidebar:!1}),E(),f(null)}catch(e){l(d),p.selectedSessionDeleted&&u(p.restoreSelectedPiboSessionId),f(e instanceof Error?e.message:String(e))}finally{w(!1)}},O=e=>{m(e),g(``)},k=()=>{m(null),g(``)};return{deleteRoomTarget:p,deleteRoomConfirmName:h,deletingRoom:_,setDeleteRoomConfirmName:g,requestRoomDelete:O,cancelRoomDelete:k,permanentlyDeleteRoom:async()=>{if(!p)return;v(!0),await e.cancelQueries({queryKey:[`chat`,`bootstrap`]});let m=r9(e,t),g=nxe(p,r,n);g.selectedRoomDeleted&&(d(null),u(null)),c(e=>nbe(e,g.deletedRoomIds));try{await fc(p.id,h),rxe(p.id,r)&&(d(null),u(null));let e=await o(void 0,i.current,void 0,{force:!0});a&&s(e.selectedRoomId,e.selectedPiboSessionId,!1,{closeMobileSidebar:!1}),k(),f(null)}catch(e){l(m),g.selectedRoomDeleted&&(d(g.restoreSelectedRoomId),u(g.restoreSelectedPiboSessionId)),f(e instanceof Error?e.message:String(e))}finally{v(!1)}},deleteSessionTarget:y,deleteSessionConfirmText:x,deletingSession:C,setDeleteSessionConfirmText:S,requestSessionDelete:T,cancelSessionDelete:E,permanentlyDeleteSession:D}}var axe=750,Y9=120,X9=60,oxe=new Set;async function sxe(e,t){let n=Tme(t.piboSessionId,t.includeArchived,t.roomId);return await e.removeQueries({queryKey:n,exact:!0}),Zs(t.piboSessionId,t.includeArchived,t.roomId,!!t.markRead)}async function Z9(e,t){let n=Eme(t.includeArchived,t.roomId,t.piboSessionId);return await e.removeQueries({queryKey:n,exact:!0}),Qs(t.piboSessionId,t.includeArchived,t.roomId)}function cxe({route:e}){let t=Ma(),n=Xt(),r=e.area,i=e.area===`sessions`?e.roomId:void 0,a=e.area===`projects`?e.projectId:void 0,o=e.area===`sessions`||e.area===`projects`||e.area===`context`?e.piboSessionId:void 0,s=e.area===`sessions`||e.area===`projects`?e.sessionViewId:void 0,c=e.area===`settings`?e.panel??`general`:`general`,[l,u]=(0,L.useState)(null),[d,f]=(0,L.useState)(null),[p,m]=(0,L.useState)(null),[h,g]=(0,L.useState)(null),[_,v]=(0,L.useState)(Pfe),[y,b]=(0,L.useState)(Ffe),[x,S]=(0,L.useState)(Ife),[C,w]=(0,L.useState)(Lfe),[T,E]=(0,L.useState)(zfe),[D,O]=(0,L.useState)(Bfe),[k,A]=(0,L.useState)(()=>s??f2()),[j,M]=(0,L.useState)(``),[N,P]=(0,L.useState)(0),[ee,te]=(0,L.useState)(!1),ne=(0,L.useRef)(!1),[F,re]=(0,L.useState)(!1),[I,ie]=(0,L.useState)(!1),[ae,oe]=(0,L.useState)(Y9),[se,ce]=(0,L.useState)(X9),[le,ue]=(0,L.useState)(null),[de,fe]=(0,L.useState)(null),[pe,me]=(0,L.useState)(`build-context`),[he,ge]=(0,L.useState)(null),[_e,ve]=(0,L.useState)(null),[ye,be]=(0,L.useState)(!1),[xe,Se]=(0,L.useState)(!1),[Ce,we]=(0,L.useState)(!1),Te=(0,L.useRef)(null),[Ee,De]=(0,L.useState)(null),[Oe,ke]=(0,L.useState)(null),[Ae,je]=(0,L.useState)(()=>Date.now()),Me=(0,L.useRef)(C),Ne=(0,L.useRef)(null),Pe=(0,L.useRef)(null),Fe=(0,L.useRef)(0),Ie=p??l?.selectedRoomId??null,Le=Ie&&l?h3(l.rooms,Ie)??l.room:void 0,Re=Le?v3(Le):!1;(0,L.useEffect)(()=>{Me.current=C},[C]),(0,L.useEffect)(()=>{if(!Ce)return;let e=e=>{Te.current&&!Te.current.contains(e.target)&&we(!1)},t=e=>{e.key===`Escape`&&we(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`touchstart`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`touchstart`,e),document.removeEventListener(`keydown`,t)}},[Ce]),(0,L.useEffect)(()=>{Pe.current=l},[l]),(0,L.useEffect)(()=>{oe(Y9),ce(X9)},[p,C]),(0,L.useEffect)(()=>{je(Date.now())},[l]),(0,L.useEffect)(()=>{if(r!==`sessions`||!d){ke(null);return}let e,t=t=>{e&&clearTimeout(e),e=setTimeout(()=>{e=void 0,Fc(d).then(e=>{ke(e),u(t=>t&&A9(t,e))}).catch(()=>void 0)},t)},n=Ic(d,{onSnapshot:t=>{e&&=(clearTimeout(e),void 0),ke(t),u(e=>e&&A9(e,t))},onPatch:e=>{ke(n=>{let r=Jbe(n,e);return n&&r===n&&t(0),r}),u(t=>t&&qbe(t,e))},onError:()=>t(axe)});return()=>{e&&clearTimeout(e),n()}},[r,d]),(0,L.useEffect)(()=>{let e=l?ghe(l.sessions,Ae):void 0;if(e===void 0)return;let t=setTimeout(()=>je(Date.now()),Math.max(50,e));return()=>clearTimeout(t)},[l,Ae]),(0,L.useEffect)(()=>{let e=async()=>{try{let e=await fetch(`/health`,{signal:AbortSignal.timeout(3e3)});e.ok?De((await e.json()).mode===`fallback`?`fallback`:`main`):De(null)}catch{De(null)}};e();let t=setInterval(e,5e3);return()=>clearInterval(t)},[]),(0,L.useEffect)(()=>{if(r!==`sessions`&&r!==`projects`)return;let e=s??f2();A(t=>t===e?t:e)},[r,s]),(0,L.useEffect)(()=>{Nfe(k)},[k]);let ze=(0,L.useCallback)((e,n=!1,r=k,i={})=>{i.closeMobileSidebar!==!1&&Se(!1),Ec(t,e,n,r)},[t,k]),Be=(0,L.useCallback)((e,t,n=!1,r={})=>{if(!t){ze({area:`sessions`,...e?{roomId:e}:{}},n,k,r);return}ze({area:`sessions`,...e?{roomId:e}:{},piboSessionId:t},n,k,r)},[ze,k]),Ve=(0,L.useCallback)((e,t,n=!1,r={})=>{if(!t){ze({area:`projects`,...e?{projectId:e}:{}},n,k,r);return}ze({area:`projects`,...e?{projectId:e}:{},piboSessionId:t},n,k,r)},[ze,k]),He=(0,L.useCallback)(e=>{me(`build-context`),ze({area:`context`,piboSessionId:e})},[ze]),Ue=(0,L.useCallback)(e=>{ge(e),me(`context-files`),ze({area:`context`})},[ze]),We=(0,L.useCallback)(e=>{ve(e),me(`mcp-tools`),ze({area:`context`})},[ze]),Ge=(0,L.useCallback)(e=>{u(t=>t&&Qbe(t,e))},[]),Ke=(0,L.useCallback)(e=>{u(t=>t&&W9(t,e)),n.setQueriesData({queryKey:[`chat`,`bootstrap`]},t=>t&&W9(t,e))},[n]),qe=(0,L.useCallback)(e=>{u(t=>t&&G9(t,e.id)),n.setQueriesData({queryKey:[`chat`,`bootstrap`]},t=>t&&G9(t,e.id))},[n]),Je=(0,L.useCallback)(e=>{u(t=>t&&K9(t,e)),n.setQueriesData({queryKey:[`chat`,`bootstrap`]},t=>t&&K9(t,e))},[n]),Ye=(0,L.useCallback)(e=>{u(t=>t&&q9(t,e)),n.setQueriesData({queryKey:[`chat`,`bootstrap`]},t=>t&&q9(t,e))},[n]),Xe=(0,L.useCallback)(async(e,t=Me.current,r,i={})=>{let a=Pe.current;if(a&&i.selectSession!==!1&&!i.force){e&&await cc(e);let i=Fe.current+1;Fe.current=i;let o=R9(a,await Z9(n,{piboSessionId:e,includeArchived:t,roomId:r}),{readSessionId:e});return i===Fe.current?(u(o),f(o.selectedPiboSessionId),m(o.selectedRoomId),o):o}let o=Fe.current+1;Fe.current=o;let s=await sxe(n,{piboSessionId:e,includeArchived:t,roomId:r,markRead:i.selectSession!==!1,force:i.force});return o===Fe.current?(u(s),i.selectSession!==!1&&f(s.selectedPiboSessionId),m(s.selectedRoomId),s):s},[n]),Ze=(0,L.useCallback)(async(e,t=Me.current,r,i={})=>{let a=Pe.current;if(!a)return Xe(e,t,r,{force:i.force});let o=Fe.current+1;Fe.current=o;let s=R9(a,await Z9(n,{piboSessionId:e,includeArchived:t,roomId:r,force:i.force}),{readSessionId:i.readSessionId});return o===Fe.current?(u(s),f(s.selectedPiboSessionId),m(s.selectedRoomId),s):s},[Xe,n]);(0,L.useEffect)(()=>{if(r!==`sessions`)return;let e=!1,t=window.setInterval(()=>{e||document.hidden||!Pe.current||Ze(d??void 0,Me.current,Ie??void 0,{force:!0}).catch(()=>void 0)},2500);return()=>{e=!0,window.clearInterval(t)}},[Ie,r,Ze,d]),(0,L.useEffect)(()=>{let{requestedRoomId:t,requestedPiboSessionId:n}=fbe(e,s2()),r=(t,n=!0)=>{let r=mbe(e,t);r&&Be(r.selectedRoomId,r.selectedPiboSessionId,n)};if(pbe({bootstrap:l,creatingSession:ne.current,route:e}))return;let a=l?Ze:Xe;a(n,Me.current,t).then(e=>{r(e),g(null)}).catch(s=>{if(e.area===`sessions`&&i&&!o&&n){c2(i),a(void 0,Me.current,i).then(e=>{r(e),g(null)}).catch(e=>g(e instanceof Error?e.message:String(e)));return}if(hbe(e)||!n&&!t){g(s instanceof Error?s.message:String(s));return}Vfe(),a().then(e=>{r(e),g(null)}).catch(e=>g(e instanceof Error?e.message:String(e)))})},[l,Xe,Ze,Be,e.area,o,i]),(0,L.useEffect)(()=>{!p&&!d||jfe({roomId:p??void 0,piboSessionId:d??void 0})},[d,p]),(0,L.useEffect)(()=>{M(d?l2(d):``)},[d]);let Qe=(0,L.useCallback)(e=>{M(t=>{let n=typeof e==`function`?e(t):e;return d&&u2(d,n),n})},[d]),$e=(0,L.useMemo)(()=>Zye(),[]),et=(0,L.useMemo)(()=>n9(k),[k]);(0,L.useEffect)(()=>{if(!l?.agents.length)return;let e=t3(l),t=D||e,n=Q9(l.agents,t);if(n){D!==n.name&&(O(n.name),_2(n.name));return}let r=Q9(l.agents,e)?.name??l.agents[0].name;O(r),_2(r)},[l,D]);let tt=(0,L.useCallback)(e=>{O(e),_2(e)},[]),nt=(0,L.useCallback)(async e=>{let t=dZ(e),r=!1;try{await Promise.all([n.invalidateQueries({queryKey:U4(e),refetchType:`none`}),n.invalidateQueries({queryKey:W4(e),refetchType:`none`})]),await Promise.all([n.refetchQueries({queryKey:U4(e),type:`active`}),n.refetchQueries({queryKey:W4(e),type:`active`})])}catch(e){throw r=!0,e}finally{fZ(e,t,r)}},[n]),rt=(0,L.useCallback)(()=>d?nt(d):Promise.resolve(),[nt,d]),it=(0,L.useCallback)(()=>Ze(d??void 0,Me.current,p??void 0,{force:!0}),[Ze,d,p]),at=(0,L.useCallback)(async()=>{g(null);let e=d??void 0;await Xe(e,Me.current,p??void 0,{force:!0,selectSession:!1}),e&&await nt(e)},[Xe,nt,d,p]),ot=(0,L.useCallback)(e=>{u(t=>t&&e(t)),n.setQueriesData({queryKey:[`chat`,`bootstrap`]},t=>t&&e(t))},[n]),st=l?.latestRoomStreamId;(0,L.useEffect)(()=>{if(r!==`sessions`||!Ie)return;let e=new URLSearchParams({roomId:Ie});e.set(`mode`,`summary`),e.set(`since`,`${st??0}:999999`);let t=new EventSource(`/api/chat/events?${e.toString()}`),n,i=()=>{n&&clearTimeout(n),n=setTimeout(()=>{n=void 0,Xe(d??void 0,Me.current,Ie,{force:!0,selectSession:!1}).catch(e=>g(c3(e)))},900)};return t.addEventListener(`pibo`,e=>{let t=Kc(e);if(!t||t.type===`ready`)return;let n=t.piboSessionId,r=rl(t);if(n&&r){let e=new Date().toISOString();ot(t=>c9(t,n,t=>({...t,status:r,lastActivityAt:e})))}Zc(t)&&i()}),()=>{n&&clearTimeout(n),t.close()}},[Ie,r,st,Xe,d,ot]);let ct=(0,L.useCallback)(e=>{if(e){u(e.localBootstrap);for(let[t,r]of e.queryData)n.setQueryData(t,r)}},[n]),{deleteRoomTarget:lt,deleteRoomConfirmName:ut,deletingRoom:dt,setDeleteRoomConfirmName:ft,requestRoomDelete:pt,cancelRoomDelete:mt,permanentlyDeleteRoom:ht,deleteSessionTarget:gt,deleteSessionConfirmText:_t,deletingSession:vt,setDeleteSessionConfirmText:yt,requestSessionDelete:bt,cancelSessionDelete:xt,permanentlyDeleteSession:St}=ixe({queryClient:n,bootstrap:l,selectedPiboSessionId:d,selectedRoomId:p,showArchivedRef:Me,isSessionsArea:r===`sessions`,loadBootstrap:Xe,navigateToSelectedSession:Be,updateBootstrapCache:ot,restoreBootstrapSnapshot:ct,setSelectedPiboSessionId:f,setSelectedRoomId:m,setError:g}),Ct=pn({mutationFn:({profile:e,roomId:t})=>sc(e||void 0,t),onMutate:async({profile:e})=>{await n.cancelQueries({queryKey:[`chat`,`bootstrap`]});let t=r9(n,l),r=d,i=`optimistic-session-${a3()}`;return f(i),ot(t=>({...i9(t,abe(i,e||t3(t))),selectedPiboSessionId:i})),{snapshot:t,tempId:i,previousSelectedPiboSessionId:r}},onError:(e,t,n)=>{ct(n?.snapshot),f(n?.previousSelectedPiboSessionId??null)},onSuccess:(e,t,n)=>{f(e.session.id),ot(t=>$ye(t,n?.tempId,m9(e.session)))}}),wt=pn({mutationFn:({piboSessionId:e,title:t})=>pc(e,{title:t}),onMutate:async({piboSessionId:e,title:t})=>{await n.cancelQueries({queryKey:[`chat`,`bootstrap`]});let r=r9(n,l);return ot(n=>c9(n,e,e=>({...e,title:t||`Untitled Session`}))),{snapshot:r}},onError:(e,t,n)=>ct(n?.snapshot),onSuccess:({session:e})=>ot(t=>s9(t,e))}),Tt=pn({mutationFn:({piboSessionId:e,archived:t})=>pc(e,{archived:t}),onMutate:async({piboSessionId:e,archived:t})=>{await n.cancelQueries({queryKey:[`chat`,`bootstrap`]});let r=r9(n,l);return ot(n=>c9(n,e,e=>({...e,archived:t,unreadCount:t?0:e.unreadCount}))),{snapshot:r}},onError:(e,t,n)=>ct(n?.snapshot),onSuccess:({session:e})=>ot(t=>s9(t,e))}),Et=pn({mutationFn:({piboSessionId:e,text:t,clientTxnId:n,roomId:r,webAnnotationIds:i,fileAttachmentPaths:a})=>hc(e,t,n,r,i,a),onMutate:async({piboSessionId:e})=>{await n.cancelQueries({queryKey:W4(e)}),ot(t=>c9(t,e,e=>({...e,status:`running`,lastActivityAt:new Date().toISOString()})))},onError:(e,t)=>{ot(e=>c9(e,t.piboSessionId,e=>({...e,status:`error`})))}}),Dt=(0,L.useCallback)(async e=>{if(!(!d||!l||e===t3(l)))try{await pc(d,{profile:e}),tt(e);let t=await Xe(d,Me.current,p??void 0);r===`sessions`&&Be(t.selectedRoomId,t.selectedPiboSessionId),await nt(d),g(null)}catch(e){g(e instanceof Error?e.message:String(e))}},[r,l,Xe,Be,nt,d,p,tt]),Ot=(0,L.useMemo)(()=>ube(l?.capabilities.actions??[]),[l]),kt=(0,L.useMemo)(()=>dbe(l,d),[l,d]),At=(0,L.useCallback)(async e=>{(0,Pa.flushSync)(()=>{f(e),ue(e),Se(!1)}),Be(p??l?.selectedRoomId,e,!1,{closeMobileSidebar:!1});try{await cc(e);let t=await Ze(e,Me.current,p??l?.selectedRoomId,{readSessionId:e});Be(t.selectedRoomId,t.selectedPiboSessionId,!0,{closeMobileSidebar:!1})}finally{ue(t=>t===e?null:t)}},[l?.selectedRoomId,Ze,Be,p]),jt=(0,L.useCallback)(async(e,t={})=>{let n={...t,closeMobileSidebar:!1},r=s2().sessionsByRoom?.[e];m(e),f(r??null);try{let t=await Ze(r,Me.current,e);Be(t.selectedRoomId,t.selectedPiboSessionId,!1,n)}catch(t){if(!r)throw t;c2(e),f(null);let i=await Ze(void 0,Me.current,e);Be(i.selectedRoomId,i.selectedPiboSessionId,!1,n)}},[Ze,Be]),Mt=async(e=D)=>{if(!(ee||Re)){ne.current=!0,te(!0);try{let t=await Ct.mutateAsync({profile:e,roomId:p??void 0});f(t.session.id),fe(t.session.id),Be(p??l?.selectedRoomId??void 0,t.session.id,!1,{closeMobileSidebar:!1});let n=await Xe(t.session.id,Me.current,p??void 0,{force:!0});Be(n.selectedRoomId,n.selectedPiboSessionId,!1,{closeMobileSidebar:!1}),g(null)}catch(e){g(e instanceof Error?e.message:String(e))}finally{ne.current=!1,te(!1)}}},Nt=async()=>{let e=!C;if(w(e),Rfe(e),!e){ie(!1),g(null);return}ie(!0);try{let e=await Ze(d??void 0,!0,p??void 0);r===`sessions`&&Be(e.selectedRoomId,e.selectedPiboSessionId,!1,{closeMobileSidebar:!1}),g(null)}catch(e){g(e instanceof Error?e.message:String(e))}finally{ie(!1)}},Pt=async(e,t)=>{try{await wt.mutateAsync({piboSessionId:e,title:t});let n=await Xe(d??void 0,Me.current,p??void 0,{force:!0});r===`sessions`&&await nt(n.selectedPiboSessionId),r===`sessions`&&Be(n.selectedRoomId,n.selectedPiboSessionId,!1,{closeMobileSidebar:!1}),g(null)}catch(e){g(e instanceof Error?e.message:String(e))}},Ft=async(e,t)=>{try{await Tt.mutateAsync({piboSessionId:e,archived:t});let n=await Xe(t&&!C&&d===e?void 0:d??void 0,Me.current,p??void 0,{force:!0});r===`sessions`&&Be(n.selectedRoomId,n.selectedPiboSessionId,!1,{closeMobileSidebar:!1}),g(null)}catch(e){g(e instanceof Error?e.message:String(e))}},It=async()=>{if(ye)return;be(!0),await n.cancelQueries({queryKey:[`chat`,`bootstrap`]});let e=r9(n,l),t=`optimistic-room-${a3()}`,r=rbe(t,`New Chat`);m(t),f(null),ot(e=>ebe(e,r));try{let e=await uc({name:`New Chat`});ot(n=>tbe(n,t,e.room)),await jt(e.room.id,{closeMobileSidebar:!1}),g(null)}catch(t){ct(e),m(p),f(d),g(t instanceof Error?t.message:String(t))}finally{be(!1)}},Lt=async(e,t)=>{await n.cancelQueries({queryKey:[`chat`,`bootstrap`]});let i=r9(n,l);ot(n=>l9(n,e,e=>({...e,...t.name===void 0?{}:{name:t.name},...t.topic===void 0?{}:{topic:t.topic??void 0},...t.workspace===void 0?{}:{workspace:t.workspace??void 0},updatedAt:new Date().toISOString()})));try{let{room:n}=await dc(e,t);ot(t=>l9(t,e,()=>n));let i=await Xe(d??void 0,Me.current,e,{force:!0});r===`sessions`&&Be(i.selectedRoomId,i.selectedPiboSessionId,!1,{closeMobileSidebar:!1}),g(null)}catch(e){ct(i),g(e instanceof Error?e.message:String(e))}},Rt=async e=>{try{await lc(e);let t=await Xe(d??void 0,Me.current,p??void 0,{force:!0,selectSession:!1});r===`sessions`&&Be(t.selectedRoomId,t.selectedPiboSessionId,!1,{closeMobileSidebar:!1}),g(null)}catch(e){g(e instanceof Error?e.message:String(e))}},zt=async(e,t)=>{await n.cancelQueries({queryKey:[`chat`,`bootstrap`]});let i=r9(n,l);t&&(E(!0),g2(!0)),ot(n=>l9(n,e,e=>ibe(e,t)));try{let{room:n}=await dc(e,{archived:t});ot(t=>l9(t,e,()=>n));let i=await Xe(d??void 0,Me.current,p??void 0,{force:!0});r===`sessions`&&Be(i.selectedRoomId,i.selectedPiboSessionId,!1,{closeMobileSidebar:!1}),g(null)}catch(e){ct(i),g(e instanceof Error?e.message:String(e))}},Bt=(0,L.useCallback)(async e=>{if(!d||Re)return!1;let t=e.trim().split(/\s+/)[0],n=Ot.find(e=>e.slash===t);if(!n)return!1;if(n.action===`thinking-show`){let e=!_;return v(e),p2(e),!0}if(n.action===`download`){let n=obe(e.slice(t.length));if(!n)return g(`Usage: /download <path>`),!0;try{await jc(n,{piboSessionId:d,roomId:p??void 0}),g(null)}catch(e){g(e instanceof Error?e.message:String(e))}return!0}let i=sbe(n.action,e.slice(t.length).trim()),a=lbe(await gc(d,n.action,i));if((n.action===`session.clone`||n.action===`session.fork`)&&a)await At(a);else{let e=await Xe(d,Me.current,p??void 0);r===`sessions`&&Be(e.selectedRoomId,e.selectedPiboSessionId),await nt(d)}return!0},[r,Xe,Be,nt,At,d,Re,p,_,Ot]),Vt=(0,L.useCallback)(async e=>{if(!d||Re)return;let t=cbe(await gc(d,`session.fork`,{entryId:e}));if(t?.result.cancelled)return;if(!t)throw Error(`Unexpected fork action response`);let n=typeof t.result.selectedText==`string`?t.result.selectedText:void 0;n!==void 0&&t.result.piboSessionId&&u2(t.result.piboSessionId,n),t.result.piboSessionId&&await At(t.result.piboSessionId),n!==void 0&&(M(n),P(e=>e+1))},[At,d,Re]),Ht=(0,L.useCallback)(e=>void At(e),[At]),Ut=(0,L.useCallback)(e=>{if(A(e),r===`projects`){ze({area:`projects`,...a?{projectId:a}:{},...o?{piboSessionId:o}:{}},!1,e);return}r===`sessions`&&ze({area:`sessions`,...p?{roomId:p}:{},...d?{piboSessionId:d}:{}},!1,e)},[r,ze,o,a,d,p]),Wt=(0,L.useMemo)(()=>l?p3(l.sessions,C):{active:[],archived:[]},[l?.sessions,C]),Gt=(0,L.useMemo)(()=>_he(Wt.active,ae,d),[Wt.active,d,ae]),Kt=(0,L.useMemo)(()=>C?Wt.archived.slice(0,se):[],[Wt.archived,C,se]),qt=Wt.active.length>Gt.length,Jt=C&&Wt.archived.length>Kt.length,Yt=(0,L.useMemo)(()=>d?new Set(i3(l?.sessions??[],d).map(e=>e.piboSessionId)):oxe,[l?.sessions,d]),Zt=(0,L.useCallback)(async e=>{if(!Ie)return;let t=(e?Kt:Gt).at(-1)?.piboSessionId;e?ie(!0):re(!0);try{let r=e?X9:Y9,i=await n.fetchQuery({queryKey:Ome(Ie,e,t,r),queryFn:()=>oc({roomId:Ie,piboSessionId:d??void 0,archived:e,cursor:t,limit:r}),staleTime:3e4,gcTime:30*6e4});u(e=>e&&{...e,sessions:Zbe(e.sessions,i.sessions)}),e?ce(e=>e+r):oe(e=>e+r)}finally{e?ie(!1):re(!1)}},[Ie,n,d,Gt,Kt]);if(h&&!l)return(0,R.jsx)(Gbe,{message:h});if(!l)return(0,R.jsx)(`div`,{className:`min-h-screen bg-[#101d22] text-slate-300 grid place-items-center`,children:`Loading Pibo Chat...`});let Qt=d?r3(l.sessions,d):void 0,$t=d?Oe?.sessions[d]:void 0,en=Oe?.rootPiboSessionId?Oe.sessions[Oe.rootPiboSessionId]:void 0,tn=n3(l,Qt??{profile:t3(l),parentId:l.session?.parentId}),nn=vhe(l.rooms),rn=[...new Set([...l.agents.map(e=>e.name),...l.customAgents.map(e=>e.profileName)])],an=Yme(l);return(0,R.jsxs)(R.Fragment,{children:[Ee===`fallback`?(0,R.jsx)(Hbe,{}):null,(0,R.jsxs)(`div`,{"data-pibo-debug":`chat-app`,"data-pibo-area":r,"data-pibo-room-id":p??l.selectedRoomId??void 0,"data-pibo-selected-session-id":d??l.selectedPiboSessionId??void 0,className:`h-dvh overflow-hidden bg-[#101d22] text-slate-200 grid grid-rows-[auto_auto_1fr]`,children:[(0,R.jsx)(Ube,{area:r,identity:an,mobileAreaMenuOpen:Ce,mobileAreaMenuRef:Te,totalRoomUnreadCount:nn,onOpenMobileSidebar:()=>Se(!0),onSelectMainNavArea:e=>{if(we(!1),e===`sessions`){Be(p??l.selectedRoomId,d??l.selectedPiboSessionId);return}if(e===`projects`){ze({area:`projects`});return}ze({area:e})},onToggleMobileAreaMenu:()=>we(e=>!e)}),(0,R.jsx)(`div`,{children:h?(0,R.jsx)(Wbe,{message:h,onDismiss:()=>g(null)}):null}),(0,R.jsx)(`div`,{"data-pibo-debug":`route-shell`,"data-pibo-area":r,"data-pibo-room-id":p??l.selectedRoomId??void 0,"data-pibo-selected-session-id":d??void 0,className:`min-h-0 ${r===`agents`||r===`workflows`||r===`cron`||r===`ralph`?`h-full overflow-hidden`:`grid ${(r===`sessions`||r===`projects`)&&x?`grid-cols-[300px_minmax(0,1fr)_320px] max-[980px]:grid-cols-1`:`grid-cols-[300px_minmax(0,1fr)] max-[980px]:grid-cols-1`}`}`,children:r===`cron`?(0,R.jsx)(hde,{bootstrap:l,mobileSidebarOpen:xe,onCloseMobileSidebar:()=>Se(!1)}):r===`ralph`?(0,R.jsx)(Hde,{bootstrap:l,mobileSidebarOpen:xe,onCloseMobileSidebar:()=>Se(!1)}):r===`agents`?(0,R.jsx)(Tfe,{agents:l.agents,initialCustomAgents:l.customAgents,initialCatalog:l.agentCatalog,modelCatalog:l.modelCatalog,onSelect:tt,onCreateSession:e=>void Mt(e),onEditContextFile:Ue,onEditMcpServer:We,onAgentsChanged:()=>void Xe(d??void 0,Me.current,p??void 0,{selectSession:!1}),creatingSession:ee||Re}):r===`workflows`?(0,R.jsx)(lxe,{}):r===`projects`?(0,R.jsx)(Rbe,{baseBootstrap:l,routeProjectId:a,routePiboSessionId:o,sessionViews:$e,showRawEvents:x,showThinking:_,expandThinking:y,commands:Ot,skills:kt,mobileSidebarOpen:xe,onCloseMobileSidebar:()=>Se(!1),onNavigate:Ve,onViewContext:He,onSelectSessionView:Ut,onToggleRawEvents:()=>{let e=!x;S(e),h2(e)},onToggleThinking:()=>{let e=!_;v(e),p2(e)},onToggleExpandThinking:()=>{let e=!y;b(e),m2(e)},onThinkingLevelChange:e=>void gc(o??``,`thinking`,{level:e}),onError:g}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`div`,{className:`fixed inset-0 z-30 bg-black/60 min-[981px]:hidden transition-opacity duration-200 ${xe?`opacity-100 pointer-events-auto`:`opacity-0 pointer-events-none`}`,onClick:()=>Se(!1)}),(0,R.jsxs)(`aside`,{"data-pibo-debug":`sidebar-shell`,"data-pibo-area":r,"data-pibo-room-id":p??l.selectedRoomId??void 0,"data-pibo-selected-session-id":d??void 0,"data-pibo-state":xe?`open`:`closed`,className:`min-h-0 overflow-hidden flex flex-col bg-[#1a262b] border-r border-slate-800 max-[980px]:fixed max-[980px]:left-0 max-[980px]:top-0 max-[980px]:bottom-0 max-[980px]:z-40 max-[980px]:w-[280px] max-[980px]:transition-transform max-[980px]:duration-200 ${xe?`max-[980px]:translate-x-0`:`max-[980px]:-translate-x-full`}`,children:[(0,R.jsxs)(`div`,{className:`h-11 px-3 border-b border-slate-800 flex items-center justify-between text-xs font-bold uppercase tracking-wider max-[980px]:h-auto max-[980px]:py-2 max-[980px]:flex-wrap`,children:[(0,R.jsx)(`span`,{children:r}),(0,R.jsxs)(`div`,{className:`flex items-center gap-1`,children:[r===`sessions`?(0,R.jsx)(`button`,{type:`button`,onClick:()=>void Xe(d??void 0,Me.current,p??void 0,{force:!0}).then(e=>{d&&nt(d),r===`sessions`&&Be(e.selectedRoomId,e.selectedPiboSessionId)}),title:`Refresh`,"aria-label":`Refresh`,className:`p-1 border border-slate-700 rounded-sm text-slate-400 hover:border-[#11a4d4] hover:text-[#11a4d4]`,children:(0,R.jsx)(Ps,{size:13})}):null,(0,R.jsx)(`button`,{type:`button`,onClick:()=>Se(!1),className:`min-[981px]:hidden p-1 border border-slate-700 rounded-sm text-slate-400 hover:border-[#11a4d4] hover:text-[#11a4d4]`,title:`Close sidebar`,"aria-label":`Close sidebar`,children:(0,R.jsx)(Ys,{size:13})})]})]}),r===`sessions`?(0,R.jsx)(whe,{bootstrap:l,selectedRoomId:p,selectedPiboSessionId:d,showArchivedRooms:T,onToggleArchivedRooms:()=>{let e=!T;E(e),g2(e)},creatingRoom:ye,onCreateRoom:()=>It(),onSelectRoom:jt,onUpdateRoom:Lt,onArchiveRoom:zt,onReadAllRoom:Rt,onDeleteRoom:pt,newSessionProfile:D,onNewSessionProfileChange:tt,selectedRoomArchived:Re,creatingSession:ee,onCreateSession:()=>Mt(),showArchived:C,onToggleArchivedSessions:Nt,loadingArchivedSessions:I,visibleActiveSessions:Gt,visibleArchivedSessions:Kt,totalActiveSessionCount:Wt.active.length,totalArchivedSessionCount:Wt.archived.length,hasMoreActiveSessions:qt,hasMoreArchivedSessions:Jt,loadingActiveSessions:F,sessionListScrollRef:Ne,onLoadMoreSessions:Zt,signalNow:Ae,selectedSessionPathIds:Yt,onSelectSession:At,onRenameSession:Pt,onArchiveSession:Ft,onDeleteSession:bt,onViewContext:He,loadingPiboSessionId:le,autoRenameSessionId:de,onAutoRenameConsumed:()=>fe(null)}):r===`context`?(0,R.jsx)(sde,{activePanel:pe,onSelect:me,toolCount:l.agentCatalog?.piboTools.length??0,mcpServerCount:l.agentCatalog?.mcpServers.length??0}):(0,R.jsx)(gbe,{activePanel:c,onSelect:e=>ze({area:`settings`,panel:e}),piPackageCount:l.agentCatalog?.piPackages.length??0,userSkillCount:l.agentCatalog?.userSkills.length??0})]}),r===`sessions`?(0,R.jsx)(l3,{bootstrap:l,selectedPiboSessionId:d,selectedRoomId:p,selectedRoomArchived:Re,selectedSessionProfile:Qt?.profile??t3(l),selectedSessionActiveModel:tn,selectedSessionStatus:I9($t??en)??Qt?.status,selectedSessionSignal:$t,sessionViewId:k,sessionViews:$e,currentSessionView:et,creatingSession:ee,showRawEvents:x,showThinking:_,expandThinking:y,commands:Ot,skills:kt,composerText:j,composerFocusSignal:N,onComposerTextChange:Qe,onToggleRawEvents:()=>{let e=!x;S(e),h2(e)},onToggleThinking:()=>{let e=!_;v(e),p2(e)},onToggleExpandThinking:()=>{let e=!y;b(e),m2(e)},onSessionAgentProfileChange:e=>void Dt(e),onFork:Vt,onOpenSession:Ht,onSelectSessionView:Ut,onCommand:Bt,onThinkingLevelChange:e=>void Bt(`/thinking ${e}`),onRefreshTrace:rt,onRefreshBootstrap:it,onSend:async(e,t,n,r)=>{if(!(!d||Re))try{await Et.mutateAsync({piboSessionId:d,text:e,clientTxnId:r??a3(),roomId:p??void 0,webAnnotationIds:t,fileAttachmentPaths:n}),await Xe(d,Me.current,p??void 0,{force:!0}),g(null)}catch(e){g(e instanceof Error?e.message:String(e))}},onError:g}):(0,R.jsx)(`main`,{className:`min-h-0 flex flex-col`,children:r===`context`?pe===`pibo-tools`?(0,R.jsx)(rQ,{tools:l.agentCatalog?.piboTools??[]}):pe===`mcp-tools`?(0,R.jsx)(_Q,{servers:l.agentCatalog?.mcpServers??[],selectedServerName:_e,onServerSaved:Ge}):pe===`build-context`?(0,R.jsx)(Xue,{piboSessionId:o??null}):pe===`base-prompt`?(0,R.jsx)(pK,{}):pe===`compaction-prompt`?(0,R.jsx)(gK,{}):(0,R.jsx)(HG,{agentProfiles:rn,selectedFileKey:he}):(0,R.jsx)(ybe,{activePanel:c,showThinking:_,setShowThinking:v,expandThinking:y,setExpandThinking:b,modelDefaults:l.modelDefaults,modelCatalog:l.modelCatalog,onModelDefaultsChanged:e=>{u(t=>t&&{...t,modelDefaults:e})},piPackages:l.agentCatalog?.piPackages,onPiPackageChanged:Ke,onPiPackageRemoved:qe,userSkills:l.agentCatalog?.userSkills,onUserSkillChanged:Je,onUserSkillRemoved:Ye,piboSessionId:d,onProviderAuthChanged:at})}),lt?(0,R.jsx)(Vbe,{room:lt,confirmName:ut,deleting:dt,onConfirmNameChange:ft,onCancel:mt,onDelete:()=>void ht()}):null,gt?(0,R.jsx)(Bbe,{session:gt,confirmText:_t,deleting:vt,onConfirmTextChange:yt,onCancel:xt,onDelete:()=>void St()}):null]})})]})]})}function Q9(e,t){return e.find(e=>e.name===t||e.aliases.includes(t))}function lxe(){return(0,R.jsx)(`main`,{className:`h-full min-h-0 overflow-auto bg-[#101d22] p-6 text-slate-300`,children:(0,R.jsxs)(`section`,{className:`mx-auto max-w-3xl rounded-sm border border-slate-800 bg-[#151f24] p-5 shadow-lg shadow-black/20`,children:[(0,R.jsx)(`div`,{className:`text-[10px] font-bold uppercase tracking-[0.18em] text-[#11a4d4]`,children:`Workflow redesign`}),(0,R.jsx)(`h1`,{className:`mt-2 text-2xl font-extrabold tracking-tight text-slate-100`,children:`Workflows are temporarily disconnected`}),(0,R.jsx)(`p`,{className:`mt-3 text-sm leading-6 text-slate-400`,children:`The previous workflow builder, graph canvas, and runtime experiments are preserved in the codebase, but they are no longer part of the default Chat Web product surface while Projects are rebuilt around Room-like sessions.`}),(0,R.jsx)(`p`,{className:`mt-3 text-sm leading-6 text-slate-400`,children:`Workflows will return later as a Project module after the Projects foundation is stable. For now, use Projects to create normal sessions that run in the selected project workspace.`})]})})}var uxe=new Kt({defaultOptions:{queries:{refetchOnWindowFocus:!1,retry:1}}});function dxe(){let e=go({select:e=>({pathname:e.location.pathname,search:e.location.search})});return(0,R.jsx)(cxe,{route:wc(e.pathname,e.search)})}var $9=Za({component:dxe}),fxe=Ya({getParentRoute:()=>$9,path:`/`}),pxe=Ya({getParentRoute:()=>$9,path:`sessions/$piboSessionId`}),mxe=Ya({getParentRoute:()=>$9,path:`rooms/$roomId`}),hxe=Ya({getParentRoute:()=>$9,path:`rooms/$roomId/sessions/$piboSessionId`}),gxe=Ya({getParentRoute:()=>$9,path:`projects`}),_xe=Ya({getParentRoute:()=>$9,path:`projects/$projectId`}),vxe=Ya({getParentRoute:()=>$9,path:`projects/$projectId/sessions/$piboSessionId`}),yxe=Ya({getParentRoute:()=>$9,path:`workflows`}),bxe=Ya({getParentRoute:()=>$9,path:`workflows/drafts/$draftId`}),xxe=Ya({getParentRoute:()=>$9,path:`workflows/view/$workflowId/$workflowVersion`}),Sxe=Ya({getParentRoute:()=>$9,path:`agents`}),Cxe=Ya({getParentRoute:()=>$9,path:`cron`}),wxe=Ya({getParentRoute:()=>$9,path:`ralph`}),Txe=Ya({getParentRoute:()=>$9,path:`context`}),Exe=Ya({getParentRoute:()=>$9,path:`settings`}),Dxe=Ya({getParentRoute:()=>$9,path:`settings/shortcuts`}),Oxe=Ya({getParentRoute:()=>$9,path:`settings/maintenance`}),kxe=Ya({getParentRoute:()=>$9,path:`settings/pi-packages`}),Axe=Ya({getParentRoute:()=>$9,path:`settings/skills`}),jxe=Ya({getParentRoute:()=>$9,path:`settings/providers`}),Mxe=fo({routeTree:$9.addChildren([fxe,pxe,mxe,hxe,gxe,_xe,vxe,yxe,bxe,xxe,Sxe,Cxe,wxe,Txe,Exe,Dxe,Oxe,kxe,Axe,jxe]),basepath:`/apps/chat`});`serviceWorker`in navigator&&window.addEventListener(`load`,()=>{navigator.serviceWorker.register(`/apps/chat/sw.js`).catch(()=>{})}),(0,Xs.createRoot)(document.getElementById(`root`)).render((0,R.jsx)(L.StrictMode,{children:(0,R.jsx)(Zt,{client:uxe,children:(0,R.jsx)(ho,{router:Mxe})})}));export{yce as i,FL as n,Lse as r,NL as t};