cctally 1.31.1 → 1.32.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.
@@ -0,0 +1,57 @@
1
+ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},c=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},l=(n,r,a)=>(a=n==null?{}:e(i(n)),c(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),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 u=o((e=>{var t=Symbol.for(`react.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.provider`),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.iterator;function p(e){return typeof e!=`object`||!e?null:(e=f&&e[f]||e[`@@iterator`],typeof e==`function`?e:null)}var m={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},h=Object.assign,g={};function _(e,t,n){this.props=e,this.context=t,this.refs=g,this.updater=n||m}_.prototype.isReactComponent={},_.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`setState(...): 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`)},_.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function v(){}v.prototype=_.prototype;function y(e,t,n){this.props=e,this.context=t,this.refs=g,this.updater=n||m}var b=y.prototype=new v;b.constructor=y,h(b,_.prototype),b.isPureReactComponent=!0;var x=Array.isArray,S=Object.prototype.hasOwnProperty,C={current:null},w={key:!0,ref:!0,__self:!0,__source:!0};function T(e,n,r){var i,a={},o=null,s=null;if(n!=null)for(i in n.ref!==void 0&&(s=n.ref),n.key!==void 0&&(o=``+n.key),n)S.call(n,i)&&!w.hasOwnProperty(i)&&(a[i]=n[i]);var c=arguments.length-2;if(c===1)a.children=r;else if(1<c){for(var l=Array(c),u=0;u<c;u++)l[u]=arguments[u+2];a.children=l}if(e&&e.defaultProps)for(i in c=e.defaultProps,c)a[i]===void 0&&(a[i]=c[i]);return{$$typeof:t,type:e,key:o,ref:s,props:a,_owner:C.current}}function E(e,n){return{$$typeof:t,type:e.type,key:n,ref:e.ref,props:e.props,_owner:e._owner}}function D(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function O(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var k=/\/+/g;function A(e,t){return typeof e==`object`&&e&&e.key!=null?O(``+e.key):t.toString(36)}function j(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`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0}}if(c)return c=e,o=o(c),e=a===``?`.`+A(c,0):a,x(o)?(i=``,e!=null&&(i=e.replace(k,`$&/`)+`/`),j(o,r,i,``,function(e){return e})):o!=null&&(D(o)&&(o=E(o,i+(!o.key||c&&c.key===o.key?``:(``+o.key).replace(k,`$&/`)+`/`)+e)),r.push(o)),1;if(c=0,a=a===``?`.`:a+`:`,x(e))for(var l=0;l<e.length;l++){s=e[l];var u=a+A(s,l);c+=j(s,r,i,u,o)}else if(u=p(e),typeof u==`function`)for(e=u.call(e),l=0;!(s=e.next()).done;)s=s.value,u=a+A(s,l++),c+=j(s,r,i,u,o);else if(s===`object`)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 M(e,t,n){if(e==null)return e;var r=[],i=0;return j(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function N(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 P={current:null},ee={transition:null},te={ReactCurrentDispatcher:P,ReactCurrentBatchConfig:ee,ReactCurrentOwner:C};function ne(){throw Error(`act(...) is not supported in production builds of React.`)}e.Children={map:M,forEach:function(e,t,n){M(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return M(e,function(){t++}),t},toArray:function(e){return M(e,function(e){return e})||[]},only:function(e){if(!D(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}},e.Component=_,e.Fragment=r,e.Profiler=a,e.PureComponent=y,e.StrictMode=i,e.Suspense=l,e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=te,e.act=ne,e.cloneElement=function(e,n,r){if(e==null)throw Error(`React.cloneElement(...): The argument must be a React element, but you passed `+e+`.`);var i=h({},e.props),a=e.key,o=e.ref,s=e._owner;if(n!=null){if(n.ref!==void 0&&(o=n.ref,s=C.current),n.key!==void 0&&(a=``+n.key),e.type&&e.type.defaultProps)var c=e.type.defaultProps;for(l in n)S.call(n,l)&&!w.hasOwnProperty(l)&&(i[l]=n[l]===void 0&&c!==void 0?c[l]:n[l])}var l=arguments.length-2;if(l===1)i.children=r;else if(1<l){c=Array(l);for(var u=0;u<l;u++)c[u]=arguments[u+2];i.children=c}return{$$typeof:t,type:e.type,key:a,ref:o,props:i,_owner:s}},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:o,_context:e},e.Consumer=e},e.createElement=T,e.createFactory=function(e){var t=T.bind(null,e);return t.type=e,t},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=D,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:N}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=ee.transition;ee.transition={};try{e()}finally{ee.transition=t}},e.unstable_act=ne,e.useCallback=function(e,t){return P.current.useCallback(e,t)},e.useContext=function(e){return P.current.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e){return P.current.useDeferredValue(e)},e.useEffect=function(e,t){return P.current.useEffect(e,t)},e.useId=function(){return P.current.useId()},e.useImperativeHandle=function(e,t,n){return P.current.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return P.current.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return P.current.useLayoutEffect(e,t)},e.useMemo=function(e,t){return P.current.useMemo(e,t)},e.useReducer=function(e,t,n){return P.current.useReducer(e,t,n)},e.useRef=function(e){return P.current.useRef(e)},e.useState=function(e){return P.current.useState(e)},e.useSyncExternalStore=function(e,t,n){return P.current.useSyncExternalStore(e,t,n)},e.useTransition=function(){return P.current.useTransition()},e.version=`18.3.1`})),d=o(((e,t)=>{t.exports=u()})),f=o((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(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=typeof setTimeout==`function`?setTimeout:null,_=typeof clearTimeout==`function`?clearTimeout:null,v=typeof setImmediate<`u`?setImmediate:null;typeof navigator<`u`&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function y(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 b(e){if(h=!1,y(e),!m)if(n(c)!==null)m=!0,M(x);else{var t=n(l);t!==null&&N(b,t.startTime-e)}}function x(t,i){m=!1,h&&(h=!1,_(w),w=-1),p=!0;var a=f;try{for(y(i),d=n(c);d!==null&&(!(d.expirationTime>i)||t&&!D());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=i);i=e.unstable_now(),typeof s==`function`?d.callback=s:d===n(c)&&r(c),y(i)}else r(c);d=n(c)}if(d!==null)var u=!0;else{var g=n(l);g!==null&&N(b,g.startTime-i),u=!1}return u}finally{d=null,f=a,p=!1}}var S=!1,C=null,w=-1,T=5,E=-1;function D(){return!(e.unstable_now()-E<T)}function O(){if(C!==null){var t=e.unstable_now();E=t;var n=!0;try{n=C(!0,t)}finally{n?k():(S=!1,C=null)}}else S=!1}var k;if(typeof v==`function`)k=function(){v(O)};else if(typeof MessageChannel<`u`){var A=new MessageChannel,j=A.port2;A.port1.onmessage=O,k=function(){j.postMessage(null)}}else k=function(){g(O,0)};function M(e){C=e,S||(S=!0,k())}function N(t,n){w=g(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_continueExecution=function(){m||p||(m=!0,M(x))},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`):T=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_getFirstCallbackNode=function(){return n(c)},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_pauseExecution=function(){},e.unstable_requestPaint=function(){},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?(_(w),w=-1):h=!0,N(b,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,M(x))),r},e.unstable_shouldYield=D,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),p=o(((e,t)=>{t.exports=f()})),m=o((e=>{var t=d(),n=p();function r(e){for(var t=`https://reactjs.org/docs/error-decoder.html?invariant=`+e,n=1;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.`}var i=new Set,a={};function o(e,t){s(e,t),s(e+`Capture`,t)}function s(e,t){for(a[e]=t,e=0;e<t.length;e++)i.add(t[e])}var c=!(typeof window>`u`||window.document===void 0||window.document.createElement===void 0),l=Object.prototype.hasOwnProperty,u=/^[: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]*$/,f={},m={};function h(e){return l.call(m,e)?!0:l.call(f,e)?!1:u.test(e)?m[e]=!0:(f[e]=!0,!1)}function g(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case`function`:case`symbol`:return!0;case`boolean`:return r?!1:n===null?(e=e.toLowerCase().slice(0,5),e!==`data-`&&e!==`aria-`):!n.acceptsBooleans;default:return!1}}function _(e,t,n,r){if(t==null||g(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return!1===t;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function v(e,t,n,r,i,a,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=a,this.removeEmptyString=o}var y={};`children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style`.split(` `).forEach(function(e){y[e]=new v(e,0,!1,e,null,!1,!1)}),[[`acceptCharset`,`accept-charset`],[`className`,`class`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`]].forEach(function(e){var t=e[0];y[t]=new v(t,1,!1,e[1],null,!1,!1)}),[`contentEditable`,`draggable`,`spellCheck`,`value`].forEach(function(e){y[e]=new v(e,2,!1,e.toLowerCase(),null,!1,!1)}),[`autoReverse`,`externalResourcesRequired`,`focusable`,`preserveAlpha`].forEach(function(e){y[e]=new v(e,2,!1,e,null,!1,!1)}),`allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope`.split(` `).forEach(function(e){y[e]=new v(e,3,!1,e.toLowerCase(),null,!1,!1)}),[`checked`,`multiple`,`muted`,`selected`].forEach(function(e){y[e]=new v(e,3,!0,e,null,!1,!1)}),[`capture`,`download`].forEach(function(e){y[e]=new v(e,4,!1,e,null,!1,!1)}),[`cols`,`rows`,`size`,`span`].forEach(function(e){y[e]=new v(e,6,!1,e,null,!1,!1)}),[`rowSpan`,`start`].forEach(function(e){y[e]=new v(e,5,!1,e.toLowerCase(),null,!1,!1)});var b=/[\-:]([a-z])/g;function x(e){return e[1].toUpperCase()}`accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height`.split(` `).forEach(function(e){var t=e.replace(b,x);y[t]=new v(t,1,!1,e,null,!1,!1)}),`xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type`.split(` `).forEach(function(e){var t=e.replace(b,x);y[t]=new v(t,1,!1,e,`http://www.w3.org/1999/xlink`,!1,!1)}),[`xml:base`,`xml:lang`,`xml:space`].forEach(function(e){var t=e.replace(b,x);y[t]=new v(t,1,!1,e,`http://www.w3.org/XML/1998/namespace`,!1,!1)}),[`tabIndex`,`crossOrigin`].forEach(function(e){y[e]=new v(e,1,!1,e.toLowerCase(),null,!1,!1)}),y.xlinkHref=new v(`xlinkHref`,1,!1,`xlink:href`,`http://www.w3.org/1999/xlink`,!0,!1),[`src`,`href`,`action`,`formAction`].forEach(function(e){y[e]=new v(e,1,!1,e.toLowerCase(),null,!0,!0)});function S(e,t,n,r){var i=y.hasOwnProperty(t)?y[t]:null;(i===null?r||!(2<t.length)||t[0]!==`o`&&t[0]!==`O`||t[1]!==`n`&&t[1]!==`N`:i.type!==0)&&(_(t,n,i,r)&&(n=null),r||i===null?h(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,``+n)):i.mustUseProperty?e[i.propertyName]=n===null?i.type===3?!1:``:n:(t=i.attributeName,r=i.attributeNamespace,n===null?e.removeAttribute(t):(i=i.type,n=i===3||i===4&&!0===n?``:``+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}var C=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,w=Symbol.for(`react.element`),T=Symbol.for(`react.portal`),E=Symbol.for(`react.fragment`),D=Symbol.for(`react.strict_mode`),O=Symbol.for(`react.profiler`),k=Symbol.for(`react.provider`),A=Symbol.for(`react.context`),j=Symbol.for(`react.forward_ref`),M=Symbol.for(`react.suspense`),N=Symbol.for(`react.suspense_list`),P=Symbol.for(`react.memo`),ee=Symbol.for(`react.lazy`),te=Symbol.for(`react.offscreen`),ne=Symbol.iterator;function re(e){return typeof e!=`object`||!e?null:(e=ne&&e[ne]||e[`@@iterator`],typeof e==`function`?e:null)}var F=Object.assign,ie;function ae(e){if(ie===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);ie=t&&t[1]||``}return`
2
+ `+ie+e}var oe=!1;function se(e,t){if(!e||oe)return``;oe=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,`props`,{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(t,[])}catch(e){var r=e}Reflect.construct(e,[],t)}else{try{t.call()}catch(e){r=e}e.call(t.prototype)}else{try{throw Error()}catch(e){r=e}e()}}catch(t){if(t&&r&&typeof t.stack==`string`){for(var i=t.stack.split(`
3
+ `),a=r.stack.split(`
4
+ `),o=i.length-1,s=a.length-1;1<=o&&0<=s&&i[o]!==a[s];)s--;for(;1<=o&&0<=s;o--,s--)if(i[o]!==a[s]){if(o!==1||s!==1)do if(o--,s--,0>s||i[o]!==a[s]){var c=`
5
+ `+i[o].replace(` at new `,` at `);return e.displayName&&c.includes(`<anonymous>`)&&(c=c.replace(`<anonymous>`,e.displayName)),c}while(1<=o&&0<=s);break}}}finally{oe=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:``)?ae(e):``}function ce(e){switch(e.tag){case 5:return ae(e.type);case 16:return ae(`Lazy`);case 13:return ae(`Suspense`);case 19:return ae(`SuspenseList`);case 0:case 2:case 15:return e=se(e.type,!1),e;case 11:return e=se(e.type.render,!1),e;case 1:return e=se(e.type,!0),e;default:return``}}function I(e){if(e==null)return null;if(typeof e==`function`)return e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case E:return`Fragment`;case T:return`Portal`;case O:return`Profiler`;case D:return`StrictMode`;case M:return`Suspense`;case N:return`SuspenseList`}if(typeof e==`object`)switch(e.$$typeof){case A:return(e.displayName||`Context`)+`.Consumer`;case k:return(e._context.displayName||`Context`)+`.Provider`;case j:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case P:return t=e.displayName||null,t===null?I(e.type)||`Memo`:t;case ee:t=e._payload,e=e._init;try{return I(e(t))}catch{}}return null}function le(e){var t=e.type;switch(e.tag){case 24:return`Cache`;case 9:return(t.displayName||`Context`)+`.Consumer`;case 10:return(t._context.displayName||`Context`)+`.Provider`;case 18:return`DehydratedFragment`;case 11:return e=t.render,e=e.displayName||e.name||``,t.displayName||(e===``?`ForwardRef`:`ForwardRef(`+e+`)`);case 7:return`Fragment`;case 5:return t;case 4:return`Portal`;case 3:return`Root`;case 6:return`Text`;case 16:return I(t);case 8:return t===D?`StrictMode`:`Mode`;case 22:return`Offscreen`;case 12:return`Profiler`;case 21:return`Scope`;case 13:return`Suspense`;case 19:return`SuspenseList`;case 25:return`TracingMarker`;case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t==`function`)return t.displayName||t.name||null;if(typeof t==`string`)return t}return null}function ue(e){switch(typeof e){case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function de(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function fe(e){var t=de(e)?`checked`:`value`,n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=``+e[t];if(!e.hasOwnProperty(t)&&n!==void 0&&typeof n.get==`function`&&typeof n.set==`function`){var i=n.get,a=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){r=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(e){r=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function L(e){e._valueTracker||=fe(e)}function pe(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=de(e)?e.checked?`true`:`false`:e.value),e=r,e===n?!1:(t.setValue(e),!0)}function me(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}function he(e,t){var n=t.checked;return F({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function ge(e,t){var n=t.defaultValue==null?``:t.defaultValue,r=t.checked==null?t.defaultChecked:t.checked;n=ue(t.value==null?n:t.value),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type===`checkbox`||t.type===`radio`?t.checked!=null:t.value!=null}}function _e(e,t){t=t.checked,t!=null&&S(e,`checked`,t,!1)}function ve(e,t){_e(e,t);var n=ue(t.value),r=t.type;if(n!=null)r===`number`?(n===0&&e.value===``||e.value!=n)&&(e.value=``+n):e.value!==``+n&&(e.value=``+n);else if(r===`submit`||r===`reset`){e.removeAttribute(`value`);return}t.hasOwnProperty(`value`)?be(e,t.type,n):t.hasOwnProperty(`defaultValue`)&&be(e,t.type,ue(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function ye(e,t,n){if(t.hasOwnProperty(`value`)||t.hasOwnProperty(`defaultValue`)){var r=t.type;if(!(r!==`submit`&&r!==`reset`||t.value!==void 0&&t.value!==null))return;t=``+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==``&&(e.name=``),e.defaultChecked=!!e._wrapperState.initialChecked,n!==``&&(e.name=n)}function be(e,t,n){(t!==`number`||me(e.ownerDocument)!==e)&&(n==null?e.defaultValue=``+e._wrapperState.initialValue:e.defaultValue!==``+n&&(e.defaultValue=``+n))}var xe=Array.isArray;function Se(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=``+ue(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 Ce(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(r(91));return F({},t,{value:void 0,defaultValue:void 0,children:``+e._wrapperState.initialValue})}function we(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(r(92));if(xe(n)){if(1<n.length)throw Error(r(93));n=n[0]}t=n}t??=``,n=t}e._wrapperState={initialValue:ue(n)}}function Te(e,t){var n=ue(t.value),r=ue(t.defaultValue);n!=null&&(n=``+n,n!==e.value&&(e.value=n),t.defaultValue==null&&e.defaultValue!==n&&(e.defaultValue=n)),r!=null&&(e.defaultValue=``+r)}function Ee(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==``&&t!==null&&(e.value=t)}function De(e){switch(e){case`svg`:return`http://www.w3.org/2000/svg`;case`math`:return`http://www.w3.org/1998/Math/MathML`;default:return`http://www.w3.org/1999/xhtml`}}function Oe(e,t){return e==null||e===`http://www.w3.org/1999/xhtml`?De(t):e===`http://www.w3.org/2000/svg`&&t===`foreignObject`?`http://www.w3.org/1999/xhtml`:e}var ke,Ae=function(e){return typeof MSApp<`u`&&MSApp.execUnsafeLocalFunction?function(t,n,r,i){MSApp.execUnsafeLocalFunction(function(){return e(t,n,r,i)})}:e}(function(e,t){if(e.namespaceURI!==`http://www.w3.org/2000/svg`||`innerHTML`in e)e.innerHTML=t;else{for(ke||=document.createElement(`div`),ke.innerHTML=`<svg>`+t.valueOf().toString()+`</svg>`,t=ke.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function R(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var je={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Me=[`Webkit`,`ms`,`Moz`,`O`];Object.keys(je).forEach(function(e){Me.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),je[t]=je[e]})});function Ne(e,t,n){return t==null||typeof t==`boolean`||t===``?``:n||typeof t!=`number`||t===0||je.hasOwnProperty(e)&&je[e]?(``+t).trim():t+`px`}function z(e,t){for(var n in e=e.style,t)if(t.hasOwnProperty(n)){var r=n.indexOf(`--`)===0,i=Ne(n,t[n],r);n===`float`&&(n=`cssFloat`),r?e.setProperty(n,i):e[n]=i}}var B=F({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Pe(e,t){if(t){if(B[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(r(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(r(60));if(typeof t.dangerouslySetInnerHTML!=`object`||!(`__html`in t.dangerouslySetInnerHTML))throw Error(r(61))}if(t.style!=null&&typeof t.style!=`object`)throw Error(r(62))}}function Fe(e,t){if(e.indexOf(`-`)===-1)return typeof t.is==`string`;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 Ie=null;function Le(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Re=null,V=null,ze=null;function H(e){if(e=zi(e)){if(typeof Re!=`function`)throw Error(r(280));var t=e.stateNode;t&&(t=Vi(t),Re(e.stateNode,e.type,t))}}function Be(e){V?ze?ze.push(e):ze=[e]:V=e}function Ve(){if(V){var e=V,t=ze;if(ze=V=null,H(e),t)for(e=0;e<t.length;e++)H(t[e])}}function He(e,t){return e(t)}function Ue(){}var We=!1;function Ge(e,t,n){if(We)return e(t,n);We=!0;try{return He(e,t,n)}finally{We=!1,(V!==null||ze!==null)&&(Ue(),Ve())}}function Ke(e,t){var n=e.stateNode;if(n===null)return null;var i=Vi(n);if(i===null)return null;n=i[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`:(i=!i.disabled)||(e=e.type,i=!(e===`button`||e===`input`||e===`select`||e===`textarea`)),e=!i;break a;default:e=!1}if(e)return null;if(n&&typeof n!=`function`)throw Error(r(231,t,typeof n));return n}var qe=!1;if(c)try{var Je={};Object.defineProperty(Je,`passive`,{get:function(){qe=!0}}),window.addEventListener(`test`,Je,Je),window.removeEventListener(`test`,Je,Je)}catch{qe=!1}function Ye(e,t,n,r,i,a,o,s,c){var l=Array.prototype.slice.call(arguments,3);try{t.apply(n,l)}catch(e){this.onError(e)}}var Xe=!1,Ze=null,Qe=!1,$e=null,et={onError:function(e){Xe=!0,Ze=e}};function tt(e,t,n,r,i,a,o,s,c){Xe=!1,Ze=null,Ye.apply(et,arguments)}function nt(e,t,n,i,a,o,s,c,l){if(tt.apply(this,arguments),Xe){if(Xe){var u=Ze;Xe=!1,Ze=null}else throw Error(r(198));Qe||(Qe=!0,$e=u)}}function rt(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 it(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 at(e){if(rt(e)!==e)throw Error(r(188))}function ot(e){var t=e.alternate;if(!t){if(t=rt(e),t===null)throw Error(r(188));return t===e?e:null}for(var n=e,i=t;;){var a=n.return;if(a===null)break;var o=a.alternate;if(o===null){if(i=a.return,i!==null){n=i;continue}break}if(a.child===o.child){for(o=a.child;o;){if(o===n)return at(a),e;if(o===i)return at(a),t;o=o.sibling}throw Error(r(188))}if(n.return!==i.return)n=a,i=o;else{for(var s=!1,c=a.child;c;){if(c===n){s=!0,n=a,i=o;break}if(c===i){s=!0,i=a,n=o;break}c=c.sibling}if(!s){for(c=o.child;c;){if(c===n){s=!0,n=o,i=a;break}if(c===i){s=!0,i=o,n=a;break}c=c.sibling}if(!s)throw Error(r(189))}}if(n.alternate!==i)throw Error(r(190))}if(n.tag!==3)throw Error(r(188));return n.stateNode.current===n?e:t}function st(e){return e=ot(e),e===null?null:ct(e)}function ct(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=ct(e);if(t!==null)return t;e=e.sibling}return null}var lt=n.unstable_scheduleCallback,ut=n.unstable_cancelCallback,dt=n.unstable_shouldYield,ft=n.unstable_requestPaint,pt=n.unstable_now,mt=n.unstable_getCurrentPriorityLevel,ht=n.unstable_ImmediatePriority,gt=n.unstable_UserBlockingPriority,_t=n.unstable_NormalPriority,vt=n.unstable_LowPriority,yt=n.unstable_IdlePriority,bt=null,xt=null;function St(e){if(xt&&typeof xt.onCommitFiberRoot==`function`)try{xt.onCommitFiberRoot(bt,e,void 0,(e.current.flags&128)==128)}catch{}}var Ct=Math.clz32?Math.clz32:Et,wt=Math.log,Tt=Math.LN2;function Et(e){return e>>>=0,e===0?32:31-(wt(e)/Tt|0)|0}var Dt=64,Ot=4194304;function kt(e){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: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 e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function At(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,a=e.pingedLanes,o=n&268435455;if(o!==0){var s=o&~i;s===0?(a&=o,a!==0&&(r=kt(a))):r=kt(s)}else o=n&~i,o===0?a!==0&&(r=kt(a)):r=kt(o);if(r===0)return 0;if(t!==0&&t!==r&&(t&i)===0&&(i=r&-r,a=t&-t,i>=a||i===16&&a&4194240))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0<t;)n=31-Ct(t),i=1<<n,r|=e[n],t&=~i;return r}function jt(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64: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:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Mt(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes;0<a;){var o=31-Ct(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=jt(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}}function Nt(e){return e=e.pendingLanes&-1073741825,e===0?e&1073741824?1073741824:0:e}function Pt(){var e=Dt;return Dt<<=1,!(Dt&4194240)&&(Dt=64),e}function Ft(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function It(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Ct(t),e[t]=n}function Lt(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0<n;){var i=31-Ct(n),a=1<<i;t[i]=0,r[i]=-1,e[i]=-1,n&=~a}}function Rt(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Ct(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}var U=0;function zt(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var Bt,Vt,Ht,Ut,Wt,Gt=!1,Kt=[],qt=null,Jt=null,Yt=null,Xt=new Map,Zt=new Map,Qt=[],$t=`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 submit`.split(` `);function en(e,t){switch(e){case`focusin`:case`focusout`:qt=null;break;case`dragenter`:case`dragleave`:Jt=null;break;case`mouseover`:case`mouseout`:Yt=null;break;case`pointerover`:case`pointerout`:Xt.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:Zt.delete(t.pointerId)}}function tn(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=zi(t),t!==null&&Vt(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function nn(e,t,n,r,i){switch(t){case`focusin`:return qt=tn(qt,e,t,n,r,i),!0;case`dragenter`:return Jt=tn(Jt,e,t,n,r,i),!0;case`mouseover`:return Yt=tn(Yt,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return Xt.set(a,tn(Xt.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,Zt.set(a,tn(Zt.get(a)||null,e,t,n,r,i)),!0}return!1}function rn(e){var t=Ri(e.target);if(t!==null){var n=rt(t);if(n!==null){if(t=n.tag,t===13){if(t=it(n),t!==null){e.blockedOn=t,Wt(e.priority,function(){Ht(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 an(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=gn(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Ie=r,n.target.dispatchEvent(r),Ie=null}else return t=zi(n),t!==null&&Vt(t),e.blockedOn=n,!1;t.shift()}return!0}function on(e,t,n){an(e)&&n.delete(t)}function sn(){Gt=!1,qt!==null&&an(qt)&&(qt=null),Jt!==null&&an(Jt)&&(Jt=null),Yt!==null&&an(Yt)&&(Yt=null),Xt.forEach(on),Zt.forEach(on)}function cn(e,t){e.blockedOn===t&&(e.blockedOn=null,Gt||(Gt=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,sn)))}function ln(e){function t(t){return cn(t,e)}if(0<Kt.length){cn(Kt[0],e);for(var n=1;n<Kt.length;n++){var r=Kt[n];r.blockedOn===e&&(r.blockedOn=null)}}for(qt!==null&&cn(qt,e),Jt!==null&&cn(Jt,e),Yt!==null&&cn(Yt,e),Xt.forEach(t),Zt.forEach(t),n=0;n<Qt.length;n++)r=Qt[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<Qt.length&&(n=Qt[0],n.blockedOn===null);)rn(n),n.blockedOn===null&&Qt.shift()}var un=C.ReactCurrentBatchConfig,dn=!0;function fn(e,t,n,r){var i=U,a=un.transition;un.transition=null;try{U=1,mn(e,t,n,r)}finally{U=i,un.transition=a}}function pn(e,t,n,r){var i=U,a=un.transition;un.transition=null;try{U=4,mn(e,t,n,r)}finally{U=i,un.transition=a}}function mn(e,t,n,r){if(dn){var i=gn(e,t,n,r);if(i===null)ui(e,t,r,hn,n),en(e,r);else if(nn(i,e,t,n,r))r.stopPropagation();else if(en(e,r),t&4&&-1<$t.indexOf(e)){for(;i!==null;){var a=zi(i);if(a!==null&&Bt(a),a=gn(e,t,n,r),a===null&&ui(e,t,r,hn,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else ui(e,t,r,null,n)}}var hn=null;function gn(e,t,n,r){if(hn=null,e=Le(r),e=Ri(e),e!==null)if(t=rt(e),t===null)e=null;else if(n=t.tag,n===13){if(e=it(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 hn=e,null}function _n(e){switch(e){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`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 1;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`toggle`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 4;case`message`:switch(mt()){case ht:return 1;case gt:return 4;case _t:case vt:return 16;case yt:return 536870912;default:return 16}default:return 16}}var vn=null,yn=null,bn=null;function xn(){if(bn)return bn;var e,t=yn,n=t.length,r,i=`value`in vn?vn.value:vn.textContent,a=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===i[a-r];r++);return bn=i.slice(e,1<r?1-r:void 0)}function Sn(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 Cn(){return!0}function wn(){return!1}function Tn(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)?Cn:wn,this.isPropagationStopped=wn,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=Cn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=Cn)},persist:function(){},isPersistent:Cn}),t}var En={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Dn=Tn(En),On=F({},En,{view:0,detail:0}),kn=Tn(On),An,jn,Mn,Nn=F({},On,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Wn,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!==Mn&&(Mn&&e.type===`mousemove`?(An=e.screenX-Mn.screenX,jn=e.screenY-Mn.screenY):jn=An=0,Mn=e),An)},movementY:function(e){return`movementY`in e?e.movementY:jn}}),Pn=Tn(Nn),Fn=Tn(F({},Nn,{dataTransfer:0})),In=Tn(F({},On,{relatedTarget:0})),Ln=Tn(F({},En,{animationName:0,elapsedTime:0,pseudoElement:0})),Rn=Tn(F({},En,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),zn=Tn(F({},En,{data:0})),Bn={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},Vn={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`},Hn={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function Un(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Hn[e])?!!t[e]:!1}function Wn(){return Un}var Gn=Tn(F({},On,{key:function(e){if(e.key){var t=Bn[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=Sn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?Vn[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Wn,charCode:function(e){return e.type===`keypress`?Sn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?Sn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),Kn=Tn(F({},Nn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),qn=Tn(F({},On,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Wn})),Jn=Tn(F({},En,{propertyName:0,elapsedTime:0,pseudoElement:0})),Yn=Tn(F({},Nn,{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})),Xn=[9,13,27,32],Zn=c&&`CompositionEvent`in window,Qn=null;c&&`documentMode`in document&&(Qn=document.documentMode);var $n=c&&`TextEvent`in window&&!Qn,er=c&&(!Zn||Qn&&8<Qn&&11>=Qn),tr=` `,nr=!1;function rr(e,t){switch(e){case`keyup`:return Xn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function ir(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var ar=!1;function or(e,t){switch(e){case`compositionend`:return ir(t);case`keypress`:return t.which===32?(nr=!0,tr):null;case`textInput`:return e=t.data,e===tr&&nr?null:e;default:return null}}function sr(e,t){if(ar)return e===`compositionend`||!Zn&&rr(e,t)?(e=xn(),bn=yn=vn=null,ar=!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 er&&t.locale!==`ko`?null:t.data;default:return null}}var cr={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 lr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!cr[e.type]:t===`textarea`}function ur(e,t,n,r){Be(r),t=fi(t,`onChange`),0<t.length&&(n=new Dn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var dr=null,fr=null;function pr(e){ii(e,0)}function mr(e){if(pe(Bi(e)))return e}function hr(e,t){if(e===`change`)return t}var gr=!1;if(c){var _r;if(c){var vr=`oninput`in document;if(!vr){var yr=document.createElement(`div`);yr.setAttribute(`oninput`,`return;`),vr=typeof yr.oninput==`function`}_r=vr}else _r=!1;gr=_r&&(!document.documentMode||9<document.documentMode)}function br(){dr&&(dr.detachEvent(`onpropertychange`,xr),fr=dr=null)}function xr(e){if(e.propertyName===`value`&&mr(fr)){var t=[];ur(t,fr,e,Le(e)),Ge(pr,t)}}function Sr(e,t,n){e===`focusin`?(br(),dr=t,fr=n,dr.attachEvent(`onpropertychange`,xr)):e===`focusout`&&br()}function Cr(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return mr(fr)}function wr(e,t){if(e===`click`)return mr(t)}function Tr(e,t){if(e===`input`||e===`change`)return mr(t)}function Er(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var Dr=typeof Object.is==`function`?Object.is:Er;function Or(e,t){if(Dr(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(!l.call(t,i)||!Dr(e[i],t[i]))return!1}return!0}function kr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Ar(e,t){var n=kr(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=kr(n)}}function jr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?jr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Mr(){for(var e=window,t=me();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=me(e.document)}return t}function Nr(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`)}function Pr(e){var t=Mr(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&jr(n.ownerDocument.documentElement,n)){if(r!==null&&Nr(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),`selectionStart`in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var i=n.textContent.length,a=Math.min(r.start,i);r=r.end===void 0?a:Math.min(r.end,i),!e.extend&&a>r&&(i=r,r=a,a=i),i=Ar(n,a);var o=Ar(n,r);i&&o&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),a>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus==`function`&&n.focus(),n=0;n<t.length;n++)e=t[n],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var Fr=c&&`documentMode`in document&&11>=document.documentMode,Ir=null,Lr=null,Rr=null,zr=!1;function Br(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;zr||Ir==null||Ir!==me(r)||(r=Ir,`selectionStart`in r&&Nr(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}),Rr&&Or(Rr,r)||(Rr=r,r=fi(Lr,`onSelect`),0<r.length&&(t=new Dn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=Ir)))}function Vr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var Hr={animationend:Vr(`Animation`,`AnimationEnd`),animationiteration:Vr(`Animation`,`AnimationIteration`),animationstart:Vr(`Animation`,`AnimationStart`),transitionend:Vr(`Transition`,`TransitionEnd`)},Ur={},Wr={};c&&(Wr=document.createElement(`div`).style,`AnimationEvent`in window||(delete Hr.animationend.animation,delete Hr.animationiteration.animation,delete Hr.animationstart.animation),`TransitionEvent`in window||delete Hr.transitionend.transition);function Gr(e){if(Ur[e])return Ur[e];if(!Hr[e])return e;var t=Hr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Wr)return Ur[e]=t[n];return e}var Kr=Gr(`animationend`),qr=Gr(`animationiteration`),Jr=Gr(`animationstart`),Yr=Gr(`transitionend`),Xr=new Map,Zr=`abort auxClick 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(` `);function Qr(e,t){Xr.set(e,t),o(t,[e])}for(var $r=0;$r<Zr.length;$r++){var ei=Zr[$r];Qr(ei.toLowerCase(),`on`+(ei[0].toUpperCase()+ei.slice(1)))}Qr(Kr,`onAnimationEnd`),Qr(qr,`onAnimationIteration`),Qr(Jr,`onAnimationStart`),Qr(`dblclick`,`onDoubleClick`),Qr(`focusin`,`onFocus`),Qr(`focusout`,`onBlur`),Qr(Yr,`onTransitionEnd`),s(`onMouseEnter`,[`mouseout`,`mouseover`]),s(`onMouseLeave`,[`mouseout`,`mouseover`]),s(`onPointerEnter`,[`pointerout`,`pointerover`]),s(`onPointerLeave`,[`pointerout`,`pointerover`]),o(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),o(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),o(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),o(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),o(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),o(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var ti=`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(` `),ni=new Set(`cancel close invalid load scroll toggle`.split(` `).concat(ti));function ri(e,t,n){var r=e.type||`unknown-event`;e.currentTarget=n,nt(r,t,void 0,e),e.currentTarget=null}function ii(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;ri(i,s,l),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;ri(i,s,l),a=c}}}if(Qe)throw e=$e,Qe=!1,$e=null,e}function ai(e,t){var n=t[Fi];n===void 0&&(n=t[Fi]=new Set);var r=e+`__bubble`;n.has(r)||(li(t,e,2,!1),n.add(r))}function oi(e,t,n){var r=0;t&&(r|=4),li(n,e,r,t)}var si=`_reactListening`+Math.random().toString(36).slice(2);function ci(e){if(!e[si]){e[si]=!0,i.forEach(function(t){t!==`selectionchange`&&(ni.has(t)||oi(t,!1,e),oi(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[si]||(t[si]=!0,oi(`selectionchange`,!1,t))}}function li(e,t,n,r){switch(_n(t)){case 1:var i=fn;break;case 4:i=pn;break;default:i=mn}n=i.bind(null,t,n,e),i=void 0,!qe||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 ui(e,t,n,r,i){var a=r;if(!(t&1)&&!(t&2)&&r!==null)a:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var s=r.stateNode.containerInfo;if(s===i||s.nodeType===8&&s.parentNode===i)break;if(o===4)for(o=r.return;o!==null;){var c=o.tag;if((c===3||c===4)&&(c=o.stateNode.containerInfo,c===i||c.nodeType===8&&c.parentNode===i))return;o=o.return}for(;s!==null;){if(o=Ri(s),o===null)return;if(c=o.tag,c===5||c===6){r=a=o;continue a}s=s.parentNode}}r=r.return}Ge(function(){var r=a,i=Le(n),o=[];a:{var s=Xr.get(e);if(s!==void 0){var c=Dn,l=e;switch(e){case`keypress`:if(Sn(n)===0)break a;case`keydown`:case`keyup`:c=Gn;break;case`focusin`:l=`focus`,c=In;break;case`focusout`:l=`blur`,c=In;break;case`beforeblur`:case`afterblur`:c=In;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`:c=Pn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:c=Fn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:c=qn;break;case Kr:case qr:case Jr:c=Ln;break;case Yr:c=Jn;break;case`scroll`:c=kn;break;case`wheel`:c=Yn;break;case`copy`:case`cut`:case`paste`:c=Rn;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:c=Kn}var u=(t&4)!=0,d=!u&&e===`scroll`,f=u?s===null?null:s+`Capture`:s;u=[];for(var p=r,m;p!==null;){m=p;var h=m.stateNode;if(m.tag===5&&h!==null&&(m=h,f!==null&&(h=Ke(p,f),h!=null&&u.push(di(p,h,m)))),d)break;p=p.return}0<u.length&&(s=new c(s,l,null,n,i),o.push({event:s,listeners:u}))}}if(!(t&7)){a:{if(s=e===`mouseover`||e===`pointerover`,c=e===`mouseout`||e===`pointerout`,s&&n!==Ie&&(l=n.relatedTarget||n.fromElement)&&(Ri(l)||l[Pi]))break a;if((c||s)&&(s=i.window===i?i:(s=i.ownerDocument)?s.defaultView||s.parentWindow:window,c?(l=n.relatedTarget||n.toElement,c=r,l=l?Ri(l):null,l!==null&&(d=rt(l),l!==d||l.tag!==5&&l.tag!==6)&&(l=null)):(c=null,l=r),c!==l)){if(u=Pn,h=`onMouseLeave`,f=`onMouseEnter`,p=`mouse`,(e===`pointerout`||e===`pointerover`)&&(u=Kn,h=`onPointerLeave`,f=`onPointerEnter`,p=`pointer`),d=c==null?s:Bi(c),m=l==null?s:Bi(l),s=new u(h,p+`leave`,c,n,i),s.target=d,s.relatedTarget=m,h=null,Ri(i)===r&&(u=new u(f,p+`enter`,l,n,i),u.target=m,u.relatedTarget=d,h=u),d=h,c&&l)b:{for(u=c,f=l,p=0,m=u;m;m=pi(m))p++;for(m=0,h=f;h;h=pi(h))m++;for(;0<p-m;)u=pi(u),p--;for(;0<m-p;)f=pi(f),m--;for(;p--;){if(u===f||f!==null&&u===f.alternate)break b;u=pi(u),f=pi(f)}u=null}else u=null;c!==null&&mi(o,s,c,u,!1),l!==null&&d!==null&&mi(o,d,l,u,!0)}}a:{if(s=r?Bi(r):window,c=s.nodeName&&s.nodeName.toLowerCase(),c===`select`||c===`input`&&s.type===`file`)var g=hr;else if(lr(s))if(gr)g=Tr;else{g=Cr;var _=Sr}else (c=s.nodeName)&&c.toLowerCase()===`input`&&(s.type===`checkbox`||s.type===`radio`)&&(g=wr);if(g&&=g(e,r)){ur(o,g,n,i);break a}_&&_(e,s,r),e===`focusout`&&(_=s._wrapperState)&&_.controlled&&s.type===`number`&&be(s,`number`,s.value)}switch(_=r?Bi(r):window,e){case`focusin`:(lr(_)||_.contentEditable===`true`)&&(Ir=_,Lr=r,Rr=null);break;case`focusout`:Rr=Lr=Ir=null;break;case`mousedown`:zr=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:zr=!1,Br(o,n,i);break;case`selectionchange`:if(Fr)break;case`keydown`:case`keyup`:Br(o,n,i)}var v;if(Zn)b:{switch(e){case`compositionstart`:var y=`onCompositionStart`;break b;case`compositionend`:y=`onCompositionEnd`;break b;case`compositionupdate`:y=`onCompositionUpdate`;break b}y=void 0}else ar?rr(e,n)&&(y=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(y=`onCompositionStart`);y&&(er&&n.locale!==`ko`&&(ar||y!==`onCompositionStart`?y===`onCompositionEnd`&&ar&&(v=xn()):(vn=i,yn=`value`in vn?vn.value:vn.textContent,ar=!0)),_=fi(r,y),0<_.length&&(y=new zn(y,e,null,n,i),o.push({event:y,listeners:_}),v?y.data=v:(v=ir(n),v!==null&&(y.data=v)))),(v=$n?or(e,n):sr(e,n))&&(r=fi(r,`onBeforeInput`),0<r.length&&(i=new zn(`onBeforeInput`,`beforeinput`,null,n,i),o.push({event:i,listeners:r}),i.data=v))}ii(o,t)})}function di(e,t,n){return{instance:e,listener:t,currentTarget:n}}function fi(e,t){for(var n=t+`Capture`,r=[];e!==null;){var i=e,a=i.stateNode;i.tag===5&&a!==null&&(i=a,a=Ke(e,n),a!=null&&r.unshift(di(e,a,i)),a=Ke(e,t),a!=null&&r.push(di(e,a,i))),e=e.return}return r}function pi(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function mi(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(c!==null&&c===r)break;s.tag===5&&l!==null&&(s=l,i?(c=Ke(n,a),c!=null&&o.unshift(di(n,c,s))):i||(c=Ke(n,a),c!=null&&o.push(di(n,c,s)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var hi=/\r\n?/g,gi=/\u0000|\uFFFD/g;function _i(e){return(typeof e==`string`?e:``+e).replace(hi,`
6
+ `).replace(gi,``)}function vi(e,t,n){if(t=_i(t),_i(e)!==t&&n)throw Error(r(425))}function yi(){}var bi=null,xi=null;function Si(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Ci=typeof setTimeout==`function`?setTimeout:void 0,wi=typeof clearTimeout==`function`?clearTimeout:void 0,Ti=typeof Promise==`function`?Promise:void 0,Ei=typeof queueMicrotask==`function`?queueMicrotask:Ti===void 0?Ci:function(e){return Ti.resolve(null).then(e).catch(Di)};function Di(e){setTimeout(function(){throw e})}function Oi(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===`/$`){if(r===0){e.removeChild(i),ln(t);return}r--}else n!==`$`&&n!==`$?`&&n!==`$!`||r++;n=i}while(n);ln(t)}function ki(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===`$?`)break;if(t===`/$`)return null}}return e}function Ai(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`){if(t===0)return e;t--}else n===`/$`&&t++}e=e.previousSibling}return null}var ji=Math.random().toString(36).slice(2),Mi=`__reactFiber$`+ji,Ni=`__reactProps$`+ji,Pi=`__reactContainer$`+ji,Fi=`__reactEvents$`+ji,Ii=`__reactListeners$`+ji,Li=`__reactHandles$`+ji;function Ri(e){var t=e[Mi];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Pi]||n[Mi]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Ai(e);e!==null;){if(n=e[Mi])return n;e=Ai(e)}return t}e=n,n=e.parentNode}return null}function zi(e){return e=e[Mi]||e[Pi],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Bi(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(r(33))}function Vi(e){return e[Ni]||null}var Hi=[],Ui=-1;function Wi(e){return{current:e}}function W(e){0>Ui||(e.current=Hi[Ui],Hi[Ui]=null,Ui--)}function G(e,t){Ui++,Hi[Ui]=e.current,e.current=t}var Gi={},Ki=Wi(Gi),qi=Wi(!1),Ji=Gi;function Yi(e,t){var n=e.type.contextTypes;if(!n)return Gi;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},a;for(a in n)i[a]=t[a];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function Xi(e){return e=e.childContextTypes,e!=null}function Zi(){W(qi),W(Ki)}function Qi(e,t,n){if(Ki.current!==Gi)throw Error(r(168));G(Ki,t),G(qi,n)}function $i(e,t,n){var i=e.stateNode;if(t=t.childContextTypes,typeof i.getChildContext!=`function`)return n;for(var a in i=i.getChildContext(),i)if(!(a in t))throw Error(r(108,le(e)||`Unknown`,a));return F({},n,i)}function ea(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Gi,Ji=Ki.current,G(Ki,e),G(qi,qi.current),!0}function ta(e,t,n){var i=e.stateNode;if(!i)throw Error(r(169));n?(e=$i(e,t,Ji),i.__reactInternalMemoizedMergedChildContext=e,W(qi),W(Ki),G(Ki,e)):W(qi),G(qi,n)}var na=null,ra=!1,ia=!1;function aa(e){na===null?na=[e]:na.push(e)}function oa(e){ra=!0,aa(e)}function sa(){if(!ia&&na!==null){ia=!0;var e=0,t=U;try{var n=na;for(U=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}na=null,ra=!1}catch(t){throw na!==null&&(na=na.slice(e+1)),lt(ht,sa),t}finally{U=t,ia=!1}}return null}var ca=[],la=0,ua=null,da=0,fa=[],pa=0,ma=null,ha=1,ga=``;function _a(e,t){ca[la++]=da,ca[la++]=ua,ua=e,da=t}function va(e,t,n){fa[pa++]=ha,fa[pa++]=ga,fa[pa++]=ma,ma=e;var r=ha;e=ga;var i=32-Ct(r)-1;r&=~(1<<i),n+=1;var a=32-Ct(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,ha=1<<32-Ct(t)+i|n<<i|r,ga=a+e}else ha=1<<a|n<<i|r,ga=e}function ya(e){e.return!==null&&(_a(e,1),va(e,1,0))}function ba(e){for(;e===ua;)ua=ca[--la],ca[la]=null,da=ca[--la],ca[la]=null;for(;e===ma;)ma=fa[--pa],fa[pa]=null,ga=fa[--pa],fa[pa]=null,ha=fa[--pa],fa[pa]=null}var xa=null,Sa=null,Ca=!1,wa=null;function Ta(e,t){var n=Ql(5,null,null,0);n.elementType=`DELETED`,n.stateNode=t,n.return=e,t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)}function Ea(e,t){switch(e.tag){case 5:var n=e.type;return t=t.nodeType!==1||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t===null?!1:(e.stateNode=t,xa=e,Sa=ki(t.firstChild),!0);case 6:return t=e.pendingProps===``||t.nodeType!==3?null:t,t===null?!1:(e.stateNode=t,xa=e,Sa=null,!0);case 13:return t=t.nodeType===8?t:null,t===null?!1:(n=ma===null?null:{id:ha,overflow:ga},e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=Ql(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,xa=e,Sa=null,!0);default:return!1}}function Da(e){return(e.mode&1)!=0&&(e.flags&128)==0}function Oa(e){if(Ca){var t=Sa;if(t){var n=t;if(!Ea(e,t)){if(Da(e))throw Error(r(418));t=ki(n.nextSibling);var i=xa;t&&Ea(e,t)?Ta(i,n):(e.flags=e.flags&-4097|2,Ca=!1,xa=e)}}else{if(Da(e))throw Error(r(418));e.flags=e.flags&-4097|2,Ca=!1,xa=e}}}function ka(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;xa=e}function Aa(e){if(e!==xa)return!1;if(!Ca)return ka(e),Ca=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!==`head`&&t!==`body`&&!Si(e.type,e.memoizedProps)),t&&=Sa){if(Da(e))throw ja(),Error(r(418));for(;t;)Ta(e,t),t=ki(t.nextSibling)}if(ka(e),e.tag===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(r(317));a:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`){if(t===0){Sa=ki(e.nextSibling);break a}t--}else n!==`$`&&n!==`$!`&&n!==`$?`||t++}e=e.nextSibling}Sa=null}}else Sa=xa?ki(e.stateNode.nextSibling):null;return!0}function ja(){for(var e=Sa;e;)e=ki(e.nextSibling)}function Ma(){Sa=xa=null,Ca=!1}function Na(e){wa===null?wa=[e]:wa.push(e)}var Pa=C.ReactCurrentBatchConfig;function Fa(e,t,n){if(e=n.ref,e!==null&&typeof e!=`function`&&typeof e!=`object`){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(r(309));var i=n.stateNode}if(!i)throw Error(r(147,e));var a=i,o=``+e;return t!==null&&t.ref!==null&&typeof t.ref==`function`&&t.ref._stringRef===o?t.ref:(t=function(e){var t=a.refs;e===null?delete t[o]:t[o]=e},t._stringRef=o,t)}if(typeof e!=`string`)throw Error(r(284));if(!n._owner)throw Error(r(290,e))}return e}function Ia(e,t){throw e=Object.prototype.toString.call(t),Error(r(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e))}function La(e){var t=e._init;return t(e._payload)}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 i(e,t){for(e=new Map;t!==null;)t.key===null?e.set(t.index,t):e.set(t.key,t),t=t.sibling;return e}function a(e,t){return e=tu(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|=2,n):(r=r.index,r<n?(t.flags|=2,n):r)):(t.flags|=1048576,n)}function s(t){return e&&t.alternate===null&&(t.flags|=2),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=J(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===E?d(e,t,n.props.children,r,n.key):t!==null&&(t.elementType===i||typeof i==`object`&&i&&i.$$typeof===ee&&La(i)===t.type)?(r=a(t,n.props),r.ref=Fa(e,t,n),r.return=e,r):(r=nu(n.type,n.key,n.props,null,e.mode,r),r.ref=Fa(e,t,n),r.return=e,r)}function u(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=au(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=ru(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`)return t=J(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case w:return n=nu(t.type,t.key,t.props,null,e.mode,n),n.ref=Fa(e,null,t),n.return=e,n;case T:return t=au(t,e.mode,n),t.return=e,t;case ee:var r=t._init;return f(e,r(t._payload),n)}if(xe(t)||re(t))return t=ru(t,e.mode,n,null),t.return=e,t;Ia(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`)return i===null?c(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case w:return n.key===i?l(e,t,n,r):null;case T:return n.key===i?u(e,t,n,r):null;case ee:return i=n._init,p(e,t,i(n._payload),r)}if(xe(n)||re(n))return i===null?d(e,t,n,r,null):null;Ia(e,n)}return null}function m(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`)return e=e.get(n)||null,c(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case w:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case T:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case ee:var a=r._init;return m(e,t,n,a(r._payload),i)}if(xe(r)||re(r))return e=e.get(n)||null,d(t,e,r,i,null);Ia(t,r)}return null}function h(r,a,s,c){for(var l=null,u=null,d=a,h=a=0,g=null;d!==null&&h<s.length;h++){d.index>h?(g=d,d=null):g=d.sibling;var _=p(r,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(r,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(r,d),Ca&&_a(r,h),l;if(d===null){for(;h<s.length;h++)d=f(r,s[h],c),d!==null&&(a=o(d,a,h),u===null?l=d:u.sibling=d,u=d);return Ca&&_a(r,h),l}for(d=i(r,d);h<s.length;h++)g=m(d,r,h,s[h],c),g!==null&&(e&&g.alternate!==null&&d.delete(g.key===null?h:g.key),a=o(g,a,h),u===null?l=g:u.sibling=g,u=g);return e&&d.forEach(function(e){return t(r,e)}),Ca&&_a(r,h),l}function g(a,s,c,l){var u=re(c);if(typeof u!=`function`)throw Error(r(150));if(c=u.call(c),c==null)throw Error(r(151));for(var d=u=null,h=s,g=s=0,_=null,v=c.next();h!==null&&!v.done;g++,v=c.next()){h.index>g?(_=h,h=null):_=h.sibling;var y=p(a,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(a,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(a,h),Ca&&_a(a,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return Ca&&_a(a,g),u}for(h=i(a,h);!v.done;g++,v=c.next())v=m(h,a,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(a,e)}),Ca&&_a(a,g),u}function _(e,r,i,o){if(typeof i==`object`&&i&&i.type===E&&i.key===null&&(i=i.props.children),typeof i==`object`&&i){switch(i.$$typeof){case w:a:{for(var c=i.key,l=r;l!==null;){if(l.key===c){if(c=i.type,c===E){if(l.tag===7){n(e,l.sibling),r=a(l,i.props.children),r.return=e,e=r;break a}}else if(l.elementType===c||typeof c==`object`&&c&&c.$$typeof===ee&&La(c)===l.type){n(e,l.sibling),r=a(l,i.props),r.ref=Fa(e,l,i),r.return=e,e=r;break a}n(e,l);break}else t(e,l);l=l.sibling}i.type===E?(r=ru(i.props.children,e.mode,o,i.key),r.return=e,e=r):(o=nu(i.type,i.key,i.props,null,e.mode,o),o.ref=Fa(e,r,i),o.return=e,e=o)}return s(e);case T:a:{for(l=i.key;r!==null;){if(r.key===l)if(r.tag===4&&r.stateNode.containerInfo===i.containerInfo&&r.stateNode.implementation===i.implementation){n(e,r.sibling),r=a(r,i.children||[]),r.return=e,e=r;break a}else{n(e,r);break}else t(e,r);r=r.sibling}r=au(i,e.mode,o),r.return=e,e=r}return s(e);case ee:return l=i._init,_(e,r,l(i._payload),o)}if(xe(i))return h(e,r,i,o);if(re(i))return g(e,r,i,o);Ia(e,i)}return typeof i==`string`&&i!==``||typeof i==`number`?(i=``+i,r!==null&&r.tag===6?(n(e,r.sibling),r=a(r,i),r.return=e,e=r):(n(e,r),r=J(i,e.mode,o),r.return=e,e=r),s(e)):n(e,r)}return _}var za=Ra(!0),Ba=Ra(!1),Va=Wi(null),Ha=null,Ua=null,Wa=null;function Ga(){Wa=Ua=Ha=null}function Ka(e){var t=Va.current;W(Va),e._currentValue=t}function qa(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 Ja(e,t){Ha=e,Wa=Ua=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(Rs=!0),e.firstContext=null)}function Ya(e){var t=e._currentValue;if(Wa!==e)if(e={context:e,memoizedValue:t,next:null},Ua===null){if(Ha===null)throw Error(r(308));Ua=e,Ha.dependencies={lanes:0,firstContext:e}}else Ua=Ua.next=e;return t}var Xa=null;function Za(e){Xa===null?Xa=[e]:Xa.push(e)}function Qa(e,t,n,r){var i=t.interleaved;return i===null?(n.next=n,Za(t)):(n.next=i.next,i.next=n),t.interleaved=n,$a(e,r)}function $a(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var eo=!1;function to(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function no(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function ro(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function io(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,q&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,$a(e,n)}return i=r.interleaved,i===null?(t.next=t,Za(r)):(t.next=i.next,i.next=t),r.interleaved=t,$a(e,n)}function ao(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194240)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Rt(e,n)}}function oo(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={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,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,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function so(e,t,n,r){var i=e.updateQueue;eo=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane,p=s.eventTime;if((r&f)===f){u!==null&&(u=u.next={eventTime:p,lane:0,tag:s.tag,payload:s.payload,callback:s.callback,next:null});a:{var m=e,h=s;switch(f=t,p=n,h.tag){case 1:if(m=h.payload,typeof m==`function`){d=m.call(p,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=h.payload,f=typeof m==`function`?m.call(p,d,f):m,f==null)break a;d=F({},d,f);break a;case 2:eo=!0}}s.callback!==null&&s.lane!==0&&(e.flags|=64,f=i.effects,f===null?i.effects=[s]:f.push(s))}else p={eventTime:p,lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;f=s,s=f.next,f.next=null,i.lastBaseUpdate=f,i.shared.pending=null}}while(1);if(u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,t=i.shared.interleaved,t!==null){i=t;do o|=i.lane,i=i.next;while(i!==t)}else a===null&&(i.shared.lanes=0);el|=o,e.lanes=o,e.memoizedState=d}}function co(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var i=e[t],a=i.callback;if(a!==null){if(i.callback=null,i=n,typeof a!=`function`)throw Error(r(191,a));a.call(i)}}}var lo={},uo=Wi(lo),fo=Wi(lo),po=Wi(lo);function mo(e){if(e===lo)throw Error(r(174));return e}function ho(e,t){switch(G(po,t),G(fo,e),G(uo,lo),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Oe(null,``);break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=Oe(t,e)}W(uo),G(uo,t)}function go(){W(uo),W(fo),W(po)}function _o(e){mo(po.current);var t=mo(uo.current),n=Oe(t,e.type);t!==n&&(G(fo,e),G(uo,n))}function vo(e){fo.current===e&&(W(uo),W(fo))}var yo=Wi(0);function bo(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data===`$?`||n.data===`$!`))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){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 xo=[];function So(){for(var e=0;e<xo.length;e++)xo[e]._workInProgressVersionPrimary=null;xo.length=0}var Co=C.ReactCurrentDispatcher,wo=C.ReactCurrentBatchConfig,To=0,Eo=null,Do=null,Oo=null,ko=!1,Ao=!1,jo=0,Mo=0;function No(){throw Error(r(321))}function Po(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Dr(e[n],t[n]))return!1;return!0}function Fo(e,t,n,i,a,o){if(To=o,Eo=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Co.current=e===null||e.memoizedState===null?vs:ys,e=n(i,a),Ao){o=0;do{if(Ao=!1,jo=0,25<=o)throw Error(r(301));o+=1,Oo=Do=null,t.updateQueue=null,Co.current=bs,e=n(i,a)}while(Ao)}if(Co.current=_s,t=Do!==null&&Do.next!==null,To=0,Oo=Do=Eo=null,ko=!1,t)throw Error(r(300));return e}function Io(){var e=jo!==0;return jo=0,e}function Lo(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Oo===null?Eo.memoizedState=Oo=e:Oo=Oo.next=e,Oo}function Ro(){if(Do===null){var e=Eo.alternate;e=e===null?null:e.memoizedState}else e=Do.next;var t=Oo===null?Eo.memoizedState:Oo.next;if(t!==null)Oo=t,Do=e;else{if(e===null)throw Error(r(310));Do=e,e={memoizedState:Do.memoizedState,baseState:Do.baseState,baseQueue:Do.baseQueue,queue:Do.queue,next:null},Oo===null?Eo.memoizedState=Oo=e:Oo=Oo.next=e}return Oo}function zo(e,t){return typeof t==`function`?t(e):t}function Bo(e){var t=Ro(),n=t.queue;if(n===null)throw Error(r(311));n.lastRenderedReducer=e;var i=Do,a=i.baseQueue,o=n.pending;if(o!==null){if(a!==null){var s=a.next;a.next=o.next,o.next=s}i.baseQueue=a=o,n.pending=null}if(a!==null){o=a.next,i=i.baseState;var c=s=null,l=null,u=o;do{var d=u.lane;if((To&d)===d)l!==null&&(l=l.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),i=u.hasEagerState?u.eagerState:e(i,u.action);else{var f={lane:d,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};l===null?(c=l=f,s=i):l=l.next=f,Eo.lanes|=d,el|=d}u=u.next}while(u!==null&&u!==o);l===null?s=i:l.next=c,Dr(i,t.memoizedState)||(Rs=!0),t.memoizedState=i,t.baseState=s,t.baseQueue=l,n.lastRenderedState=i}if(e=n.interleaved,e!==null){a=e;do o=a.lane,Eo.lanes|=o,el|=o,a=a.next;while(a!==e)}else a===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function Vo(e){var t=Ro(),n=t.queue;if(n===null)throw Error(r(311));n.lastRenderedReducer=e;var i=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);Dr(o,t.memoizedState)||(Rs=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,i]}function Ho(){}function Uo(e,t){var n=Eo,i=Ro(),a=t(),o=!Dr(i.memoizedState,a);if(o&&(i.memoizedState=a,Rs=!0),i=i.queue,ts(Ko.bind(null,n,i,e),[e]),i.getSnapshot!==t||o||Oo!==null&&Oo.memoizedState.tag&1){if(n.flags|=2048,Xo(9,Go.bind(null,n,i,a,t),void 0,null),qc===null)throw Error(r(349));To&30||Wo(n,t,a)}return a}function Wo(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Eo.updateQueue,t===null?(t={lastEffect:null,stores:null},Eo.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!Dr(e,n)}catch{return!0}}function Jo(e){var t=$a(e,1);t!==null&&bl(t,e,1,-1)}function Yo(e){var t=Lo();return typeof e==`function`&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:zo,lastRenderedState:e},t.queue=e,e=e.dispatch=ps.bind(null,Eo,e),[t.memoizedState,e]}function Xo(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=Eo.updateQueue,t===null?(t={lastEffect:null,stores:null},Eo.updateQueue=t,t.lastEffect=e.next=e):(n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e)),e}function Zo(){return Ro().memoizedState}function Qo(e,t,n,r){var i=Lo();Eo.flags|=e,i.memoizedState=Xo(1|t,n,void 0,r===void 0?null:r)}function $o(e,t,n,r){var i=Ro();r=r===void 0?null:r;var a=void 0;if(Do!==null){var o=Do.memoizedState;if(a=o.destroy,r!==null&&Po(r,o.deps)){i.memoizedState=Xo(t,n,a,r);return}}Eo.flags|=e,i.memoizedState=Xo(1|t,n,a,r)}function es(e,t){return Qo(8390656,8,e,t)}function ts(e,t){return $o(2048,8,e,t)}function ns(e,t){return $o(4,2,e,t)}function rs(e,t){return $o(4,4,e,t)}function is(e,t){if(typeof t==`function`)return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function as(e,t,n){return n=n==null?null:n.concat([e]),$o(4,4,is.bind(null,t,e),n)}function os(){}function ss(e,t){var n=Ro();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Po(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function cs(e,t){var n=Ro();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Po(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function ls(e,t,n){return To&21?(Dr(n,t)||(n=Pt(),Eo.lanes|=n,el|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Rs=!0),e.memoizedState=n)}function us(e,t){var n=U;U=n!==0&&4>n?n:4,e(!0);var r=wo.transition;wo.transition={};try{e(!1),t()}finally{U=n,wo.transition=r}}function ds(){return Ro().memoizedState}function fs(e,t,n){var r=yl(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},ms(e))hs(t,n);else if(n=Qa(e,t,n,r),n!==null){var i=vl();bl(n,e,r,i),gs(n,t,r)}}function ps(e,t,n){var r=yl(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(ms(e))hs(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,Dr(s,o)){var c=t.interleaved;c===null?(i.next=i,Za(t)):(i.next=c.next,c.next=i),t.interleaved=i;return}}catch{}n=Qa(e,t,i,r),n!==null&&(i=vl(),bl(n,e,r,i),gs(n,t,r))}}function ms(e){var t=e.alternate;return e===Eo||t!==null&&t===Eo}function hs(e,t){Ao=ko=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function gs(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Rt(e,n)}}var _s={readContext:Ya,useCallback:No,useContext:No,useEffect:No,useImperativeHandle:No,useInsertionEffect:No,useLayoutEffect:No,useMemo:No,useReducer:No,useRef:No,useState:No,useDebugValue:No,useDeferredValue:No,useTransition:No,useMutableSource:No,useSyncExternalStore:No,useId:No,unstable_isNewReconciler:!1},vs={readContext:Ya,useCallback:function(e,t){return Lo().memoizedState=[e,t===void 0?null:t],e},useContext:Ya,useEffect:es,useImperativeHandle:function(e,t,n){return n=n==null?null:n.concat([e]),Qo(4194308,4,is.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Qo(4194308,4,e,t)},useInsertionEffect:function(e,t){return Qo(4,2,e,t)},useMemo:function(e,t){var n=Lo();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Lo();return t=n===void 0?t:n(t),r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=fs.bind(null,Eo,e),[r.memoizedState,e]},useRef:function(e){var t=Lo();return e={current:e},t.memoizedState=e},useState:Yo,useDebugValue:os,useDeferredValue:function(e){return Lo().memoizedState=e},useTransition:function(){var e=Yo(!1),t=e[0];return e=us.bind(null,e[1]),Lo().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var i=Eo,a=Lo();if(Ca){if(n===void 0)throw Error(r(407));n=n()}else{if(n=t(),qc===null)throw Error(r(349));To&30||Wo(i,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,es(Ko.bind(null,i,o,e),[e]),i.flags|=2048,Xo(9,Go.bind(null,i,o,n,t),void 0,null),n},useId:function(){var e=Lo(),t=qc.identifierPrefix;if(Ca){var n=ga,r=ha;n=(r&~(1<<32-Ct(r)-1)).toString(32)+n,t=`:`+t+`R`+n,n=jo++,0<n&&(t+=`H`+n.toString(32)),t+=`:`}else n=Mo++,t=`:`+t+`r`+n.toString(32)+`:`;return e.memoizedState=t},unstable_isNewReconciler:!1},ys={readContext:Ya,useCallback:ss,useContext:Ya,useEffect:ts,useImperativeHandle:as,useInsertionEffect:ns,useLayoutEffect:rs,useMemo:cs,useReducer:Bo,useRef:Zo,useState:function(){return Bo(zo)},useDebugValue:os,useDeferredValue:function(e){return ls(Ro(),Do.memoizedState,e)},useTransition:function(){return[Bo(zo)[0],Ro().memoizedState]},useMutableSource:Ho,useSyncExternalStore:Uo,useId:ds,unstable_isNewReconciler:!1},bs={readContext:Ya,useCallback:ss,useContext:Ya,useEffect:ts,useImperativeHandle:as,useInsertionEffect:ns,useLayoutEffect:rs,useMemo:cs,useReducer:Vo,useRef:Zo,useState:function(){return Vo(zo)},useDebugValue:os,useDeferredValue:function(e){var t=Ro();return Do===null?t.memoizedState=e:ls(t,Do.memoizedState,e)},useTransition:function(){return[Vo(zo)[0],Ro().memoizedState]},useMutableSource:Ho,useSyncExternalStore:Uo,useId:ds,unstable_isNewReconciler:!1};function xs(e,t){if(e&&e.defaultProps){for(var n in t=F({},t),e=e.defaultProps,e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function Ss(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 Cs={isMounted:function(e){return(e=e._reactInternals)?rt(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=vl(),i=yl(e),a=ro(r,i);a.payload=t,n!=null&&(a.callback=n),t=io(e,a,i),t!==null&&(bl(t,e,i,r),ao(t,e,i))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=vl(),i=yl(e),a=ro(r,i);a.tag=1,a.payload=t,n!=null&&(a.callback=n),t=io(e,a,i),t!==null&&(bl(t,e,i,r),ao(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=vl(),r=yl(e),i=ro(n,r);i.tag=2,t!=null&&(i.callback=t),t=io(e,i,r),t!==null&&(bl(t,e,r,n),ao(t,e,r))}};function ws(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?!Or(n,r)||!Or(i,a):!0}function Ts(e,t,n){var r=!1,i=Gi,a=t.contextType;return typeof a==`object`&&a?a=Ya(a):(i=Xi(t)?Ji:Ki.current,r=t.contextTypes,a=(r=r!=null)?Yi(e,i):Gi),t=new t(n,a),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=Cs,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=i,e.__reactInternalMemoizedMaskedChildContext=a),t}function Es(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&&Cs.enqueueReplaceState(t,t.state,null)}function Ds(e,t,n,r){var i=e.stateNode;i.props=n,i.state=e.memoizedState,i.refs={},to(e);var a=t.contextType;typeof a==`object`&&a?i.context=Ya(a):(a=Xi(t)?Ji:Ki.current,i.context=Yi(e,a)),i.state=e.memoizedState,a=t.getDerivedStateFromProps,typeof a==`function`&&(Ss(e,t,a,n),i.state=e.memoizedState),typeof t.getDerivedStateFromProps==`function`||typeof i.getSnapshotBeforeUpdate==`function`||typeof i.UNSAFE_componentWillMount!=`function`&&typeof i.componentWillMount!=`function`||(t=i.state,typeof i.componentWillMount==`function`&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount==`function`&&i.UNSAFE_componentWillMount(),t!==i.state&&Cs.enqueueReplaceState(i,i.state,null),so(e,n,i,r),i.state=e.memoizedState),typeof i.componentDidMount==`function`&&(e.flags|=4194308)}function Os(e,t){try{var n=``,r=t;do n+=ce(r),r=r.return;while(r);var i=n}catch(e){i=`
7
+ Error generating stack: `+e.message+`
8
+ `+e.stack}return{value:e,source:t,stack:i,digest:null}}function ks(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function As(e,t){try{console.error(t.value)}catch(e){setTimeout(function(){throw e})}}var js=typeof WeakMap==`function`?WeakMap:Map;function Ms(e,t,n){n=ro(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){cl||(cl=!0,ll=r),As(e,t)},n}function Ns(e,t,n){n=ro(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r==`function`){var i=t.value;n.payload=function(){return r(i)},n.callback=function(){As(e,t)}}var a=e.stateNode;return a!==null&&typeof a.componentDidCatch==`function`&&(n.callback=function(){As(e,t),typeof r!=`function`&&(ul===null?ul=new Set([this]):ul.add(this));var n=t.stack;this.componentDidCatch(t.value,{componentStack:n===null?``:n})}),n}function Ps(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new js;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)||(i.add(n),e=Gl.bind(null,e,t,n),t.then(e,e))}function Fs(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t===null?!0:t.dehydrated!==null),t)return e;e=e.return}while(e!==null);return null}function Is(e,t,n,r,i){return e.mode&1?(e.flags|=65536,e.lanes=i,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=ro(-1,1),t.tag=2,io(n,t,1))),n.lanes|=1),e)}var Ls=C.ReactCurrentOwner,Rs=!1;function zs(e,t,n,r){t.child=e===null?Ba(t,null,n,r):za(t,e.child,n,r)}function Bs(e,t,n,r,i){n=n.render;var a=t.ref;return Ja(t,i),r=Fo(e,t,n,r,a,i),n=Io(),e!==null&&!Rs?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,oc(e,t,i)):(Ca&&n&&ya(t),t.flags|=1,zs(e,t,r,i),t.child)}function Vs(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!$l(a)&&a.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=a,Hs(e,t,a,r,i)):(e=nu(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,(e.lanes&i)===0){var o=a.memoizedProps;if(n=n.compare,n=n===null?Or:n,n(o,r)&&e.ref===t.ref)return oc(e,t,i)}return t.flags|=1,e=tu(a,r),e.ref=t.ref,e.return=t,t.child=e}function Hs(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(Or(a,r)&&e.ref===t.ref)if(Rs=!1,t.pendingProps=r=a,(e.lanes&i)!==0)e.flags&131072&&(Rs=!0);else return t.lanes=e.lanes,oc(e,t,i)}return Gs(e,t,n,r,i)}function Us(e,t,n){var r=t.pendingProps,i=r.children,a=e===null?null:e.memoizedState;if(r.mode===`hidden`)if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},G(Zc,Xc),Xc|=n;else{if(!(n&1073741824))return e=a===null?n:a.baseLanes|n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,G(Zc,Xc),Xc|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=a===null?n:a.baseLanes,G(Zc,Xc),Xc|=r}else a===null?r=n:(r=a.baseLanes|n,t.memoizedState=null),G(Zc,Xc),Xc|=r;return zs(e,t,i,n),t.child}function Ws(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Gs(e,t,n,r,i){var a=Xi(n)?Ji:Ki.current;return a=Yi(t,a),Ja(t,i),n=Fo(e,t,n,r,a,i),r=Io(),e!==null&&!Rs?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,oc(e,t,i)):(Ca&&r&&ya(t),t.flags|=1,zs(e,t,n,i),t.child)}function Ks(e,t,n,r,i){if(Xi(n)){var a=!0;ea(t)}else a=!1;if(Ja(t,i),t.stateNode===null)ac(e,t),Ts(t,n,r),Ds(t,n,r,i),r=!0;else if(e===null){var o=t.stateNode,s=t.memoizedProps;o.props=s;var c=o.context,l=n.contextType;typeof l==`object`&&l?l=Ya(l):(l=Xi(n)?Ji:Ki.current,l=Yi(t,l));var u=n.getDerivedStateFromProps,d=typeof u==`function`||typeof o.getSnapshotBeforeUpdate==`function`;d||typeof o.UNSAFE_componentWillReceiveProps!=`function`&&typeof o.componentWillReceiveProps!=`function`||(s!==r||c!==l)&&Es(t,o,r,l),eo=!1;var f=t.memoizedState;o.state=f,so(t,r,o,i),c=t.memoizedState,s!==r||f!==c||qi.current||eo?(typeof u==`function`&&(Ss(t,n,u,r),c=t.memoizedState),(s=eo||ws(t,n,s,r,f,c,l))?(d||typeof o.UNSAFE_componentWillMount!=`function`&&typeof o.componentWillMount!=`function`||(typeof o.componentWillMount==`function`&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount==`function`&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount==`function`&&(t.flags|=4194308)):(typeof o.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=c),o.props=r,o.state=c,o.context=l,r=s):(typeof o.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{o=t.stateNode,no(e,t),s=t.memoizedProps,l=t.type===t.elementType?s:xs(t.type,s),o.props=l,d=t.pendingProps,f=o.context,c=n.contextType,typeof c==`object`&&c?c=Ya(c):(c=Xi(n)?Ji:Ki.current,c=Yi(t,c));var p=n.getDerivedStateFromProps;(u=typeof p==`function`||typeof o.getSnapshotBeforeUpdate==`function`)||typeof o.UNSAFE_componentWillReceiveProps!=`function`&&typeof o.componentWillReceiveProps!=`function`||(s!==d||f!==c)&&Es(t,o,r,c),eo=!1,f=t.memoizedState,o.state=f,so(t,r,o,i);var m=t.memoizedState;s!==d||f!==m||qi.current||eo?(typeof p==`function`&&(Ss(t,n,p,r),m=t.memoizedState),(l=eo||ws(t,n,l,r,f,m,c)||!1)?(u||typeof o.UNSAFE_componentWillUpdate!=`function`&&typeof o.componentWillUpdate!=`function`||(typeof o.componentWillUpdate==`function`&&o.componentWillUpdate(r,m,c),typeof o.UNSAFE_componentWillUpdate==`function`&&o.UNSAFE_componentWillUpdate(r,m,c)),typeof o.componentDidUpdate==`function`&&(t.flags|=4),typeof o.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof o.componentDidUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=m),o.props=r,o.state=m,o.context=c,r=l):(typeof o.componentDidUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return qs(e,t,n,r,a,i)}function qs(e,t,n,r,i,a){Ws(e,t);var o=(t.flags&128)!=0;if(!r&&!o)return i&&ta(t,n,!1),oc(e,t,a);r=t.stateNode,Ls.current=t;var s=o&&typeof n.getDerivedStateFromError!=`function`?null:r.render();return t.flags|=1,e!==null&&o?(t.child=za(t,e.child,null,a),t.child=za(t,null,s,a)):zs(e,t,s,a),t.memoizedState=r.state,i&&ta(t,n,!0),t.child}function Js(e){var t=e.stateNode;t.pendingContext?Qi(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Qi(e,t.context,!1),ho(e,t.containerInfo)}function Ys(e,t,n,r,i){return Ma(),Na(i),t.flags|=256,zs(e,t,n,r),t.child}var Xs={dehydrated:null,treeContext:null,retryLane:0};function Zs(e){return{baseLanes:e,cachePool:null,transitions:null}}function Qs(e,t,n){var r=t.pendingProps,i=yo.current,a=!1,o=(t.flags&128)!=0,s;if((s=o)||(s=e!==null&&e.memoizedState===null?!1:(i&2)!=0),s?(a=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(i|=1),G(yo,i&1),e===null)return Oa(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data===`$!`?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(o=r.children,e=r.fallback,a?(r=t.mode,a=t.child,o={mode:`hidden`,children:o},!(r&1)&&a!==null?(a.childLanes=0,a.pendingProps=o):a=iu(o,r,0,null),e=ru(e,r,n,null),a.return=t,e.return=t,a.sibling=e,t.child=a,t.child.memoizedState=Zs(n),t.memoizedState=Xs,e):$s(t,o));if(i=e.memoizedState,i!==null&&(s=i.dehydrated,s!==null))return tc(e,t,o,r,s,i,n);if(a){a=r.fallback,o=t.mode,i=e.child,s=i.sibling;var c={mode:`hidden`,children:r.children};return!(o&1)&&t.child!==i?(r=t.child,r.childLanes=0,r.pendingProps=c,t.deletions=null):(r=tu(i,c),r.subtreeFlags=i.subtreeFlags&14680064),s===null?(a=ru(a,o,n,null),a.flags|=2):a=tu(s,a),a.return=t,r.return=t,r.sibling=a,t.child=r,r=a,a=t.child,o=e.child.memoizedState,o=o===null?Zs(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},a.memoizedState=o,a.childLanes=e.childLanes&~n,t.memoizedState=Xs,r}return a=e.child,e=a.sibling,r=tu(a,{mode:`visible`,children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function $s(e,t){return t=iu({mode:`visible`,children:t},e.mode,0,null),t.return=e,e.child=t}function ec(e,t,n,r){return r!==null&&Na(r),za(t,e.child,null,n),e=$s(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function tc(e,t,n,i,a,o,s){if(n)return t.flags&256?(t.flags&=-257,i=ks(Error(r(422))),ec(e,t,s,i)):t.memoizedState===null?(o=i.fallback,a=t.mode,i=iu({mode:`visible`,children:i.children},a,0,null),o=ru(o,a,s,null),o.flags|=2,i.return=t,o.return=t,i.sibling=o,t.child=i,t.mode&1&&za(t,e.child,null,s),t.child.memoizedState=Zs(s),t.memoizedState=Xs,o):(t.child=e.child,t.flags|=128,null);if(!(t.mode&1))return ec(e,t,s,null);if(a.data===`$!`){if(i=a.nextSibling&&a.nextSibling.dataset,i)var c=i.dgst;return i=c,o=Error(r(419)),i=ks(o,i,void 0),ec(e,t,s,i)}if(c=(s&e.childLanes)!==0,Rs||c){if(i=qc,i!==null){switch(s&-s){case 4:a=2;break;case 16:a=8;break;case 64: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:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:a=32;break;case 536870912:a=268435456;break;default:a=0}a=(a&(i.suspendedLanes|s))===0?a:0,a!==0&&a!==o.retryLane&&(o.retryLane=a,$a(e,a),bl(i,e,a,-1))}return Pl(),i=ks(Error(r(421))),ec(e,t,s,i)}return a.data===`$?`?(t.flags|=128,t.child=e.child,t=ql.bind(null,e),a._reactRetry=t,null):(e=o.treeContext,Sa=ki(a.nextSibling),xa=t,Ca=!0,wa=null,e!==null&&(fa[pa++]=ha,fa[pa++]=ga,fa[pa++]=ma,ha=e.id,ga=e.overflow,ma=t),t=$s(t,i.children),t.flags|=4096,t)}function nc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),qa(e.return,t,n)}function rc(e,t,n,r,i){var a=e.memoizedState;a===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i}:(a.isBackwards=t,a.rendering=null,a.renderingStartTime=0,a.last=r,a.tail=n,a.tailMode=i)}function ic(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;if(zs(e,t,r.children,n),r=yo.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&nc(e,n,t);else if(e.tag===19)nc(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}r&=1}if(G(yo,r),!(t.mode&1))t.memoizedState=null;else switch(i){case`forwards`:for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&bo(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),rc(t,!1,i,n,a);break;case`backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&bo(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}rc(t,!0,n,null,a);break;case`together`:rc(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function ac(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function oc(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),el|=t.lanes,(n&t.childLanes)===0)return null;if(e!==null&&t.child!==e.child)throw Error(r(153));if(t.child!==null){for(e=t.child,n=tu(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=tu(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function sc(e,t,n){switch(t.tag){case 3:Js(t),Ma();break;case 5:_o(t);break;case 1:Xi(t.type)&&ea(t);break;case 4:ho(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,i=t.memoizedProps.value;G(Va,r._currentValue),r._currentValue=i;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(G(yo,yo.current&1),e=oc(e,t,n),e===null?null:e.sibling):Qs(e,t,n):(G(yo,yo.current&1),t.flags|=128,null);G(yo,yo.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return ic(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),G(yo,yo.current),r)break;return null;case 22:case 23:return t.lanes=0,Us(e,t,n)}return oc(e,t,n)}var cc=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}},lc=function(e,t,n,r){var i=e.memoizedProps;if(i!==r){e=t.stateNode,mo(uo.current);var o=null;switch(n){case`input`:i=he(e,i),r=he(e,r),o=[];break;case`select`:i=F({},i,{value:void 0}),r=F({},r,{value:void 0}),o=[];break;case`textarea`:i=Ce(e,i),r=Ce(e,r),o=[];break;default:typeof i.onClick!=`function`&&typeof r.onClick==`function`&&(e.onclick=yi)}Pe(n,r);var s;for(u in n=null,i)if(!r.hasOwnProperty(u)&&i.hasOwnProperty(u)&&i[u]!=null)if(u===`style`){var c=i[u];for(s in c)c.hasOwnProperty(s)&&(n||={},n[s]=``)}else u!==`dangerouslySetInnerHTML`&&u!==`children`&&u!==`suppressContentEditableWarning`&&u!==`suppressHydrationWarning`&&u!==`autoFocus`&&(a.hasOwnProperty(u)?o||=[]:(o||=[]).push(u,null));for(u in r){var l=r[u];if(c=i?.[u],r.hasOwnProperty(u)&&l!==c&&(l!=null||c!=null))if(u===`style`)if(c){for(s in c)!c.hasOwnProperty(s)||l&&l.hasOwnProperty(s)||(n||={},n[s]=``);for(s in l)l.hasOwnProperty(s)&&c[s]!==l[s]&&(n||={},n[s]=l[s])}else n||(o||=[],o.push(u,n)),n=l;else u===`dangerouslySetInnerHTML`?(l=l?l.__html:void 0,c=c?c.__html:void 0,l!=null&&c!==l&&(o||=[]).push(u,l)):u===`children`?typeof l!=`string`&&typeof l!=`number`||(o||=[]).push(u,``+l):u!==`suppressContentEditableWarning`&&u!==`suppressHydrationWarning`&&(a.hasOwnProperty(u)?(l!=null&&u===`onScroll`&&ai(`scroll`,e),o||c===l||(o=[])):(o||=[]).push(u,l))}n&&(o||=[]).push(`style`,n);var u=o;(t.updateQueue=u)&&(t.flags|=4)}},uc=function(e,t,n,r){n!==r&&(t.flags|=4)};function dc(e,t){if(!Ca)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 fc(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&14680064,r|=i.flags&14680064,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 pc(e,t,n){var i=t.pendingProps;switch(ba(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return fc(t),null;case 1:return Xi(t.type)&&Zi(),fc(t),null;case 3:return i=t.stateNode,go(),W(qi),W(Ki),So(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(e===null||e.child===null)&&(Aa(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,wa!==null&&(wl(wa),wa=null))),fc(t),null;case 5:vo(t);var o=mo(po.current);if(n=t.type,e!==null&&t.stateNode!=null)lc(e,t,n,i,o),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!i){if(t.stateNode===null)throw Error(r(166));return fc(t),null}if(e=mo(uo.current),Aa(t)){i=t.stateNode,n=t.type;var s=t.memoizedProps;switch(i[Mi]=t,i[Ni]=s,e=(t.mode&1)!=0,n){case`dialog`:ai(`cancel`,i),ai(`close`,i);break;case`iframe`:case`object`:case`embed`:ai(`load`,i);break;case`video`:case`audio`:for(o=0;o<ti.length;o++)ai(ti[o],i);break;case`source`:ai(`error`,i);break;case`img`:case`image`:case`link`:ai(`error`,i),ai(`load`,i);break;case`details`:ai(`toggle`,i);break;case`input`:ge(i,s),ai(`invalid`,i);break;case`select`:i._wrapperState={wasMultiple:!!s.multiple},ai(`invalid`,i);break;case`textarea`:we(i,s),ai(`invalid`,i)}for(var c in Pe(n,s),o=null,s)if(s.hasOwnProperty(c)){var l=s[c];c===`children`?typeof l==`string`?i.textContent!==l&&(!0!==s.suppressHydrationWarning&&vi(i.textContent,l,e),o=[`children`,l]):typeof l==`number`&&i.textContent!==``+l&&(!0!==s.suppressHydrationWarning&&vi(i.textContent,l,e),o=[`children`,``+l]):a.hasOwnProperty(c)&&l!=null&&c===`onScroll`&&ai(`scroll`,i)}switch(n){case`input`:L(i),ye(i,s,!0);break;case`textarea`:L(i),Ee(i);break;case`select`:case`option`:break;default:typeof s.onClick==`function`&&(i.onclick=yi)}i=o,t.updateQueue=i,i!==null&&(t.flags|=4)}else{c=o.nodeType===9?o:o.ownerDocument,e===`http://www.w3.org/1999/xhtml`&&(e=De(n)),e===`http://www.w3.org/1999/xhtml`?n===`script`?(e=c.createElement(`div`),e.innerHTML=`<script><\/script>`,e=e.removeChild(e.firstChild)):typeof i.is==`string`?e=c.createElement(n,{is:i.is}):(e=c.createElement(n),n===`select`&&(c=e,i.multiple?c.multiple=!0:i.size&&(c.size=i.size))):e=c.createElementNS(e,n),e[Mi]=t,e[Ni]=i,cc(e,t,!1,!1),t.stateNode=e;a:{switch(c=Fe(n,i),n){case`dialog`:ai(`cancel`,e),ai(`close`,e),o=i;break;case`iframe`:case`object`:case`embed`:ai(`load`,e),o=i;break;case`video`:case`audio`:for(o=0;o<ti.length;o++)ai(ti[o],e);o=i;break;case`source`:ai(`error`,e),o=i;break;case`img`:case`image`:case`link`:ai(`error`,e),ai(`load`,e),o=i;break;case`details`:ai(`toggle`,e),o=i;break;case`input`:ge(e,i),o=he(e,i),ai(`invalid`,e);break;case`option`:o=i;break;case`select`:e._wrapperState={wasMultiple:!!i.multiple},o=F({},i,{value:void 0}),ai(`invalid`,e);break;case`textarea`:we(e,i),o=Ce(e,i),ai(`invalid`,e);break;default:o=i}for(s in Pe(n,o),l=o,l)if(l.hasOwnProperty(s)){var u=l[s];s===`style`?z(e,u):s===`dangerouslySetInnerHTML`?(u=u?u.__html:void 0,u!=null&&Ae(e,u)):s===`children`?typeof u==`string`?(n!==`textarea`||u!==``)&&R(e,u):typeof u==`number`&&R(e,``+u):s!==`suppressContentEditableWarning`&&s!==`suppressHydrationWarning`&&s!==`autoFocus`&&(a.hasOwnProperty(s)?u!=null&&s===`onScroll`&&ai(`scroll`,e):u!=null&&S(e,s,u,c))}switch(n){case`input`:L(e),ye(e,i,!1);break;case`textarea`:L(e),Ee(e);break;case`option`:i.value!=null&&e.setAttribute(`value`,``+ue(i.value));break;case`select`:e.multiple=!!i.multiple,s=i.value,s==null?i.defaultValue!=null&&Se(e,!!i.multiple,i.defaultValue,!0):Se(e,!!i.multiple,s,!1);break;default:typeof o.onClick==`function`&&(e.onclick=yi)}switch(n){case`button`:case`input`:case`select`:case`textarea`:i=!!i.autoFocus;break a;case`img`:i=!0;break a;default:i=!1}}i&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return fc(t),null;case 6:if(e&&t.stateNode!=null)uc(e,t,e.memoizedProps,i);else{if(typeof i!=`string`&&t.stateNode===null)throw Error(r(166));if(n=mo(po.current),mo(uo.current),Aa(t)){if(i=t.stateNode,n=t.memoizedProps,i[Mi]=t,(s=i.nodeValue!==n)&&(e=xa,e!==null))switch(e.tag){case 3:vi(i.nodeValue,n,(e.mode&1)!=0);break;case 5:!0!==e.memoizedProps.suppressHydrationWarning&&vi(i.nodeValue,n,(e.mode&1)!=0)}s&&(t.flags|=4)}else i=(n.nodeType===9?n:n.ownerDocument).createTextNode(i),i[Mi]=t,t.stateNode=i}return fc(t),null;case 13:if(W(yo),i=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(Ca&&Sa!==null&&t.mode&1&&!(t.flags&128))ja(),Ma(),t.flags|=98560,s=!1;else if(s=Aa(t),i!==null&&i.dehydrated!==null){if(e===null){if(!s)throw Error(r(318));if(s=t.memoizedState,s=s===null?null:s.dehydrated,!s)throw Error(r(317));s[Mi]=t}else Ma(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;fc(t),s=!1}else wa!==null&&(wl(wa),wa=null),s=!0;if(!s)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(i=i!==null,i!==(e!==null&&e.memoizedState!==null)&&i&&(t.child.flags|=8192,t.mode&1&&(e===null||yo.current&1?Qc===0&&(Qc=3):Pl())),t.updateQueue!==null&&(t.flags|=4),fc(t),null);case 4:return go(),e===null&&ci(t.stateNode.containerInfo),fc(t),null;case 10:return Ka(t.type._context),fc(t),null;case 17:return Xi(t.type)&&Zi(),fc(t),null;case 19:if(W(yo),s=t.memoizedState,s===null)return fc(t),null;if(i=(t.flags&128)!=0,c=s.rendering,c===null)if(i)dc(s,!1);else{if(Qc!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(c=bo(e),c!==null){for(t.flags|=128,dc(s,!1),i=c.updateQueue,i!==null&&(t.updateQueue=i,t.flags|=4),t.subtreeFlags=0,i=n,n=t.child;n!==null;)s=n,e=i,s.flags&=14680066,c=s.alternate,c===null?(s.childLanes=0,s.lanes=e,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=c.childLanes,s.lanes=c.lanes,s.child=c.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=c.memoizedProps,s.memoizedState=c.memoizedState,s.updateQueue=c.updateQueue,s.type=c.type,e=c.dependencies,s.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return G(yo,yo.current&1|2),t.child}e=e.sibling}s.tail!==null&&pt()>ol&&(t.flags|=128,i=!0,dc(s,!1),t.lanes=4194304)}else{if(!i)if(e=bo(c),e!==null){if(t.flags|=128,i=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),dc(s,!0),s.tail===null&&s.tailMode===`hidden`&&!c.alternate&&!Ca)return fc(t),null}else 2*pt()-s.renderingStartTime>ol&&n!==1073741824&&(t.flags|=128,i=!0,dc(s,!1),t.lanes=4194304);s.isBackwards?(c.sibling=t.child,t.child=c):(n=s.last,n===null?t.child=c:n.sibling=c,s.last=c)}return s.tail===null?(fc(t),null):(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=pt(),t.sibling=null,n=yo.current,G(yo,i?n&1|2:n&1),t);case 22:case 23:return Al(),i=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==i&&(t.flags|=8192),i&&t.mode&1?Xc&1073741824&&(fc(t),t.subtreeFlags&6&&(t.flags|=8192)):fc(t),null;case 24:return null;case 25:return null}throw Error(r(156,t.tag))}function mc(e,t){switch(ba(t),t.tag){case 1:return Xi(t.type)&&Zi(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return go(),W(qi),W(Ki),So(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return vo(t),null;case 13:if(W(yo),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(r(340));Ma()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return W(yo),null;case 4:return go(),null;case 10:return Ka(t.type._context),null;case 22:case 23:return Al(),null;case 24:return null;default:return null}}var hc=!1,gc=!1,_c=typeof WeakSet==`function`?WeakSet:Set,K=null;function vc(e,t){var n=e.ref;if(n!==null)if(typeof n==`function`)try{n(null)}catch(n){Wl(e,t,n)}else n.current=null}function yc(e,t,n){try{n()}catch(n){Wl(e,t,n)}}var bc=!1;function xc(e,t){if(bi=dn,e=Mr(),Nr(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var i=n.getSelection&&n.getSelection();if(i&&i.rangeCount!==0){n=i.anchorNode;var a=i.anchorOffset,o=i.focusNode;i=i.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||i!==0&&f.nodeType!==3||(l=s+i),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===a&&(c=s),p===o&&++d===i&&(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(xi={focusedElem:e,selectionRange:n},dn=!1,K=t;K!==null;)if(t=K,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,K=e;else for(;K!==null;){t=K;try{var h=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(h!==null){var g=h.memoizedProps,_=h.memoizedState,v=t.stateNode;v.__reactInternalSnapshotBeforeUpdate=v.getSnapshotBeforeUpdate(t.elementType===t.type?g:xs(t.type,g),_)}break;case 3:var y=t.stateNode.containerInfo;y.nodeType===1?y.textContent=``:y.nodeType===9&&y.documentElement&&y.removeChild(y.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(e){Wl(t,t.return,e)}if(e=t.sibling,e!==null){e.return=t.return,K=e;break}K=t.return}return h=bc,bc=!1,h}function Sc(e,t,n){var r=t.updateQueue;if(r=r===null?null:r.lastEffect,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var a=i.destroy;i.destroy=void 0,a!==void 0&&yc(t,n,a)}i=i.next}while(i!==r)}}function Cc(e,t){if(t=t.updateQueue,t=t===null?null:t.lastEffect,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function wc(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t==`function`?t(e):t.current=e}}function Tc(e){var t=e.alternate;t!==null&&(e.alternate=null,Tc(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Mi],delete t[Ni],delete t[Fi],delete t[Ii],delete t[Li])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Ec(e){return e.tag===5||e.tag===3||e.tag===4}function Dc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Ec(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.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 Oc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=yi));else if(r!==4&&(e=e.child,e!==null))for(Oc(e,t,n),e=e.sibling;e!==null;)Oc(e,t,n),e=e.sibling}function kc(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&&(e=e.child,e!==null))for(kc(e,t,n),e=e.sibling;e!==null;)kc(e,t,n),e=e.sibling}var Ac=null,jc=!1;function Mc(e,t,n){for(n=n.child;n!==null;)Nc(e,t,n),n=n.sibling}function Nc(e,t,n){if(xt&&typeof xt.onCommitFiberUnmount==`function`)try{xt.onCommitFiberUnmount(bt,n)}catch{}switch(n.tag){case 5:gc||vc(n,t);case 6:var r=Ac,i=jc;Ac=null,Mc(e,t,n),Ac=r,jc=i,Ac!==null&&(jc?(e=Ac,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Ac.removeChild(n.stateNode));break;case 18:Ac!==null&&(jc?(e=Ac,n=n.stateNode,e.nodeType===8?Oi(e.parentNode,n):e.nodeType===1&&Oi(e,n),ln(e)):Oi(Ac,n.stateNode));break;case 4:r=Ac,i=jc,Ac=n.stateNode.containerInfo,jc=!0,Mc(e,t,n),Ac=r,jc=i;break;case 0:case 11:case 14:case 15:if(!gc&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var a=i,o=a.destroy;a=a.tag,o!==void 0&&(a&2||a&4)&&yc(n,t,o),i=i.next}while(i!==r)}Mc(e,t,n);break;case 1:if(!gc&&(vc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(e){Wl(n,t,e)}Mc(e,t,n);break;case 21:Mc(e,t,n);break;case 22:n.mode&1?(gc=(r=gc)||n.memoizedState!==null,Mc(e,t,n),gc=r):Mc(e,t,n);break;default:Mc(e,t,n)}}function Pc(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new _c),t.forEach(function(t){var r=Jl.bind(null,e,t);n.has(t)||(n.add(t),t.then(r,r))})}}function Fc(e,t){var n=t.deletions;if(n!==null)for(var i=0;i<n.length;i++){var a=n[i];try{var o=e,s=t,c=s;a:for(;c!==null;){switch(c.tag){case 5:Ac=c.stateNode,jc=!1;break a;case 3:Ac=c.stateNode.containerInfo,jc=!0;break a;case 4:Ac=c.stateNode.containerInfo,jc=!0;break a}c=c.return}if(Ac===null)throw Error(r(160));Nc(o,s,a),Ac=null,jc=!1;var l=a.alternate;l!==null&&(l.return=null),a.return=null}catch(e){Wl(a,t,e)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)Ic(t,e),t=t.sibling}function Ic(e,t){var n=e.alternate,i=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Fc(t,e),Lc(e),i&4){try{Sc(3,e,e.return),Cc(3,e)}catch(t){Wl(e,e.return,t)}try{Sc(5,e,e.return)}catch(t){Wl(e,e.return,t)}}break;case 1:Fc(t,e),Lc(e),i&512&&n!==null&&vc(n,n.return);break;case 5:if(Fc(t,e),Lc(e),i&512&&n!==null&&vc(n,n.return),e.flags&32){var a=e.stateNode;try{R(a,``)}catch(t){Wl(e,e.return,t)}}if(i&4&&(a=e.stateNode,a!=null)){var o=e.memoizedProps,s=n===null?o:n.memoizedProps,c=e.type,l=e.updateQueue;if(e.updateQueue=null,l!==null)try{c===`input`&&o.type===`radio`&&o.name!=null&&_e(a,o),Fe(c,s);var u=Fe(c,o);for(s=0;s<l.length;s+=2){var d=l[s],f=l[s+1];d===`style`?z(a,f):d===`dangerouslySetInnerHTML`?Ae(a,f):d===`children`?R(a,f):S(a,d,f,u)}switch(c){case`input`:ve(a,o);break;case`textarea`:Te(a,o);break;case`select`:var p=a._wrapperState.wasMultiple;a._wrapperState.wasMultiple=!!o.multiple;var m=o.value;m==null?p!==!!o.multiple&&(o.defaultValue==null?Se(a,!!o.multiple,o.multiple?[]:``,!1):Se(a,!!o.multiple,o.defaultValue,!0)):Se(a,!!o.multiple,m,!1)}a[Ni]=o}catch(t){Wl(e,e.return,t)}}break;case 6:if(Fc(t,e),Lc(e),i&4){if(e.stateNode===null)throw Error(r(162));a=e.stateNode,o=e.memoizedProps;try{a.nodeValue=o}catch(t){Wl(e,e.return,t)}}break;case 3:if(Fc(t,e),Lc(e),i&4&&n!==null&&n.memoizedState.isDehydrated)try{ln(t.containerInfo)}catch(t){Wl(e,e.return,t)}break;case 4:Fc(t,e),Lc(e);break;case 13:Fc(t,e),Lc(e),a=e.child,a.flags&8192&&(o=a.memoizedState!==null,a.stateNode.isHidden=o,!o||a.alternate!==null&&a.alternate.memoizedState!==null||(al=pt())),i&4&&Pc(e);break;case 22:if(d=n!==null&&n.memoizedState!==null,e.mode&1?(gc=(u=gc)||d,Fc(t,e),gc=u):Fc(t,e),Lc(e),i&8192){if(u=e.memoizedState!==null,(e.stateNode.isHidden=u)&&!d&&e.mode&1)for(K=e,d=e.child;d!==null;){for(f=K=d;K!==null;){switch(p=K,m=p.child,p.tag){case 0:case 11:case 14:case 15:Sc(4,p,p.return);break;case 1:vc(p,p.return);var h=p.stateNode;if(typeof h.componentWillUnmount==`function`){i=p,n=p.return;try{t=i,h.props=t.memoizedProps,h.state=t.memoizedState,h.componentWillUnmount()}catch(e){Wl(i,n,e)}}break;case 5:vc(p,p.return);break;case 22:if(p.memoizedState!==null){Vc(f);continue}}m===null?Vc(f):(m.return=p,K=m)}d=d.sibling}a:for(d=null,f=e;;){if(f.tag===5){if(d===null){d=f;try{a=f.stateNode,u?(o=a.style,typeof o.setProperty==`function`?o.setProperty(`display`,`none`,`important`):o.display=`none`):(c=f.stateNode,l=f.memoizedProps.style,s=l!=null&&l.hasOwnProperty(`display`)?l.display:null,c.style.display=Ne(`display`,s))}catch(t){Wl(e,e.return,t)}}}else if(f.tag===6){if(d===null)try{f.stateNode.nodeValue=u?``:f.memoizedProps}catch(t){Wl(e,e.return,t)}}else if((f.tag!==22&&f.tag!==23||f.memoizedState===null||f===e)&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===e)break a;for(;f.sibling===null;){if(f.return===null||f.return===e)break a;d===f&&(d=null),f=f.return}d===f&&(d=null),f.sibling.return=f.return,f=f.sibling}}break;case 19:Fc(t,e),Lc(e),i&4&&Pc(e);break;case 21:break;default:Fc(t,e),Lc(e)}}function Lc(e){var t=e.flags;if(t&2){try{a:{for(var n=e.return;n!==null;){if(Ec(n)){var i=n;break a}n=n.return}throw Error(r(160))}switch(i.tag){case 5:var a=i.stateNode;i.flags&32&&(R(a,``),i.flags&=-33),kc(e,Dc(e),a);break;case 3:case 4:var o=i.stateNode.containerInfo;Oc(e,Dc(e),o);break;default:throw Error(r(161))}}catch(t){Wl(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Rc(e,t,n){K=e,zc(e,t,n)}function zc(e,t,n){for(var r=(e.mode&1)!=0;K!==null;){var i=K,a=i.child;if(i.tag===22&&r){var o=i.memoizedState!==null||hc;if(!o){var s=i.alternate,c=s!==null&&s.memoizedState!==null||gc;s=hc;var l=gc;if(hc=o,(gc=c)&&!l)for(K=i;K!==null;)o=K,c=o.child,o.tag===22&&o.memoizedState!==null||c===null?Hc(i):(c.return=o,K=c);for(;a!==null;)K=a,zc(a,t,n),a=a.sibling;K=i,hc=s,gc=l}Bc(e,t,n)}else i.subtreeFlags&8772&&a!==null?(a.return=i,K=a):Bc(e,t,n)}}function Bc(e){for(;K!==null;){var t=K;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:gc||Cc(5,t);break;case 1:var i=t.stateNode;if(t.flags&4&&!gc)if(n===null)i.componentDidMount();else{var a=t.elementType===t.type?n.memoizedProps:xs(t.type,n.memoizedProps);i.componentDidUpdate(a,n.memoizedState,i.__reactInternalSnapshotBeforeUpdate)}var o=t.updateQueue;o!==null&&co(t,o,i);break;case 3:var s=t.updateQueue;if(s!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}co(t,s,n)}break;case 5:var c=t.stateNode;if(n===null&&t.flags&4){n=c;var l=t.memoizedProps;switch(t.type){case`button`:case`input`:case`select`:case`textarea`:l.autoFocus&&n.focus();break;case`img`:l.src&&(n.src=l.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var u=t.alternate;if(u!==null){var d=u.memoizedState;if(d!==null){var f=d.dehydrated;f!==null&&ln(f)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(r(163))}gc||t.flags&512&&wc(t)}catch(e){Wl(t,t.return,e)}}if(t===e){K=null;break}if(n=t.sibling,n!==null){n.return=t.return,K=n;break}K=t.return}}function Vc(e){for(;K!==null;){var t=K;if(t===e){K=null;break}var n=t.sibling;if(n!==null){n.return=t.return,K=n;break}K=t.return}}function Hc(e){for(;K!==null;){var t=K;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{Cc(4,t)}catch(e){Wl(t,n,e)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount==`function`){var i=t.return;try{r.componentDidMount()}catch(e){Wl(t,i,e)}}var a=t.return;try{wc(t)}catch(e){Wl(t,a,e)}break;case 5:var o=t.return;try{wc(t)}catch(e){Wl(t,o,e)}}}catch(e){Wl(t,t.return,e)}if(t===e){K=null;break}var s=t.sibling;if(s!==null){s.return=t.return,K=s;break}K=t.return}}var Uc=Math.ceil,Wc=C.ReactCurrentDispatcher,Gc=C.ReactCurrentOwner,Kc=C.ReactCurrentBatchConfig,q=0,qc=null,Jc=null,Yc=0,Xc=0,Zc=Wi(0),Qc=0,$c=null,el=0,tl=0,nl=0,rl=null,il=null,al=0,ol=1/0,sl=null,cl=!1,ll=null,ul=null,dl=!1,fl=null,pl=0,ml=0,hl=null,gl=-1,_l=0;function vl(){return q&6?pt():gl===-1?gl=pt():gl}function yl(e){return e.mode&1?q&2&&Yc!==0?Yc&-Yc:Pa.transition===null?(e=U,e===0?(e=window.event,e=e===void 0?16:_n(e.type),e):e):(_l===0&&(_l=Pt()),_l):1}function bl(e,t,n,i){if(50<ml)throw ml=0,hl=null,Error(r(185));It(e,n,i),(!(q&2)||e!==qc)&&(e===qc&&(!(q&2)&&(tl|=n),Qc===4&&El(e,Yc)),xl(e,i),n===1&&q===0&&!(t.mode&1)&&(ol=pt()+500,ra&&sa()))}function xl(e,t){var n=e.callbackNode;Mt(e,t);var r=At(e,e===qc?Yc:0);if(r===0)n!==null&&ut(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&ut(n),t===1)e.tag===0?oa(Dl.bind(null,e)):aa(Dl.bind(null,e)),Ei(function(){!(q&6)&&sa()}),n=null;else{switch(zt(r)){case 1:n=ht;break;case 4:n=gt;break;case 16:n=_t;break;case 536870912:n=yt;break;default:n=_t}n=Xl(n,Sl.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function Sl(e,t){if(gl=-1,_l=0,q&6)throw Error(r(327));var n=e.callbackNode;if(Hl()&&e.callbackNode!==n)return null;var i=At(e,e===qc?Yc:0);if(i===0)return null;if(i&30||(i&e.expiredLanes)!==0||t)t=Fl(e,i);else{t=i;var a=q;q|=2;var o=Nl();(qc!==e||Yc!==t)&&(sl=null,ol=pt()+500,jl(e,t));do try{Ll();break}catch(t){Ml(e,t)}while(1);Ga(),Wc.current=o,q=a,Jc===null?(qc=null,Yc=0,t=Qc):t=0}if(t!==0){if(t===2&&(a=Nt(e),a!==0&&(i=a,t=Cl(e,a))),t===1)throw n=$c,jl(e,0),El(e,i),xl(e,pt()),n;if(t===6)El(e,i);else{if(a=e.current.alternate,!(i&30)&&!Tl(a)&&(t=Fl(e,i),t===2&&(o=Nt(e),o!==0&&(i=o,t=Cl(e,o))),t===1))throw n=$c,jl(e,0),El(e,i),xl(e,pt()),n;switch(e.finishedWork=a,e.finishedLanes=i,t){case 0:case 1:throw Error(r(345));case 2:Bl(e,il,sl);break;case 3:if(El(e,i),(i&130023424)===i&&(t=al+500-pt(),10<t)){if(At(e,0)!==0)break;if(a=e.suspendedLanes,(a&i)!==i){vl(),e.pingedLanes|=e.suspendedLanes&a;break}e.timeoutHandle=Ci(Bl.bind(null,e,il,sl),t);break}Bl(e,il,sl);break;case 4:if(El(e,i),(i&4194240)===i)break;for(t=e.eventTimes,a=-1;0<i;){var s=31-Ct(i);o=1<<s,s=t[s],s>a&&(a=s),i&=~o}if(i=a,i=pt()-i,i=(120>i?120:480>i?480:1080>i?1080:1920>i?1920:3e3>i?3e3:4320>i?4320:1960*Uc(i/1960))-i,10<i){e.timeoutHandle=Ci(Bl.bind(null,e,il,sl),i);break}Bl(e,il,sl);break;case 5:Bl(e,il,sl);break;default:throw Error(r(329))}}}return xl(e,pt()),e.callbackNode===n?Sl.bind(null,e):null}function Cl(e,t){var n=rl;return e.current.memoizedState.isDehydrated&&(jl(e,t).flags|=256),e=Fl(e,t),e!==2&&(t=il,il=n,t!==null&&wl(t)),e}function wl(e){il===null?il=e:il.push.apply(il,e)}function Tl(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(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(!Dr(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 El(e,t){for(t&=~nl,t&=~tl,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-Ct(t),r=1<<n;e[n]=-1,t&=~r}}function Dl(e){if(q&6)throw Error(r(327));Hl();var t=At(e,0);if(!(t&1))return xl(e,pt()),null;var n=Fl(e,t);if(e.tag!==0&&n===2){var i=Nt(e);i!==0&&(t=i,n=Cl(e,i))}if(n===1)throw n=$c,jl(e,0),El(e,t),xl(e,pt()),n;if(n===6)throw Error(r(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Bl(e,il,sl),xl(e,pt()),null}function Ol(e,t){var n=q;q|=1;try{return e(t)}finally{q=n,q===0&&(ol=pt()+500,ra&&sa())}}function kl(e){fl!==null&&fl.tag===0&&!(q&6)&&Hl();var t=q;q|=1;var n=Kc.transition,r=U;try{if(Kc.transition=null,U=1,e)return e()}finally{U=r,Kc.transition=n,q=t,!(q&6)&&sa()}}function Al(){Xc=Zc.current,W(Zc)}function jl(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,wi(n)),Jc!==null)for(n=Jc.return;n!==null;){var r=n;switch(ba(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&Zi();break;case 3:go(),W(qi),W(Ki),So();break;case 5:vo(r);break;case 4:go();break;case 13:W(yo);break;case 19:W(yo);break;case 10:Ka(r.type._context);break;case 22:case 23:Al()}n=n.return}if(qc=e,Jc=e=tu(e.current,null),Yc=Xc=t,Qc=0,$c=null,nl=tl=el=0,il=rl=null,Xa!==null){for(t=0;t<Xa.length;t++)if(n=Xa[t],r=n.interleaved,r!==null){n.interleaved=null;var i=r.next,a=n.pending;if(a!==null){var o=a.next;a.next=i,r.next=o}n.pending=r}Xa=null}return e}function Ml(e,t){do{var n=Jc;try{if(Ga(),Co.current=_s,ko){for(var i=Eo.memoizedState;i!==null;){var a=i.queue;a!==null&&(a.pending=null),i=i.next}ko=!1}if(To=0,Oo=Do=Eo=null,Ao=!1,jo=0,Gc.current=null,n===null||n.return===null){Qc=1,$c=t,Jc=null;break}a:{var o=e,s=n.return,c=n,l=t;if(t=Yc,c.flags|=32768,typeof l==`object`&&l&&typeof l.then==`function`){var u=l,d=c,f=d.tag;if(!(d.mode&1)&&(f===0||f===11||f===15)){var p=d.alternate;p?(d.updateQueue=p.updateQueue,d.memoizedState=p.memoizedState,d.lanes=p.lanes):(d.updateQueue=null,d.memoizedState=null)}var m=Fs(s);if(m!==null){m.flags&=-257,Is(m,s,c,o,t),m.mode&1&&Ps(o,u,t),t=m,l=u;var h=t.updateQueue;if(h===null){var g=new Set;g.add(l),t.updateQueue=g}else h.add(l);break a}else{if(!(t&1)){Ps(o,u,t),Pl();break a}l=Error(r(426))}}else if(Ca&&c.mode&1){var _=Fs(s);if(_!==null){!(_.flags&65536)&&(_.flags|=256),Is(_,s,c,o,t),Na(Os(l,c));break a}}o=l=Os(l,c),Qc!==4&&(Qc=2),rl===null?rl=[o]:rl.push(o),o=s;do{switch(o.tag){case 3:o.flags|=65536,t&=-t,o.lanes|=t;var v=Ms(o,l,t);oo(o,v);break a;case 1:c=l;var y=o.type,b=o.stateNode;if(!(o.flags&128)&&(typeof y.getDerivedStateFromError==`function`||b!==null&&typeof b.componentDidCatch==`function`&&(ul===null||!ul.has(b)))){o.flags|=65536,t&=-t,o.lanes|=t;var x=Ns(o,c,t);oo(o,x);break a}}o=o.return}while(o!==null)}zl(n)}catch(e){t=e,Jc===n&&n!==null&&(Jc=n=n.return);continue}break}while(1)}function Nl(){var e=Wc.current;return Wc.current=_s,e===null?_s:e}function Pl(){(Qc===0||Qc===3||Qc===2)&&(Qc=4),qc===null||!(el&268435455)&&!(tl&268435455)||El(qc,Yc)}function Fl(e,t){var n=q;q|=2;var i=Nl();(qc!==e||Yc!==t)&&(sl=null,jl(e,t));do try{Il();break}catch(t){Ml(e,t)}while(1);if(Ga(),q=n,Wc.current=i,Jc!==null)throw Error(r(261));return qc=null,Yc=0,Qc}function Il(){for(;Jc!==null;)Rl(Jc)}function Ll(){for(;Jc!==null&&!dt();)Rl(Jc)}function Rl(e){var t=Yl(e.alternate,e,Xc);e.memoizedProps=e.pendingProps,t===null?zl(e):Jc=t,Gc.current=null}function zl(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=mc(n,t),n!==null){n.flags&=32767,Jc=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Qc=6,Jc=null;return}}else if(n=pc(n,t,Xc),n!==null){Jc=n;return}if(t=t.sibling,t!==null){Jc=t;return}Jc=t=e}while(t!==null);Qc===0&&(Qc=5)}function Bl(e,t,n){var r=U,i=Kc.transition;try{Kc.transition=null,U=1,Vl(e,t,n,r)}finally{Kc.transition=i,U=r}return null}function Vl(e,t,n,i){do Hl();while(fl!==null);if(q&6)throw Error(r(327));n=e.finishedWork;var a=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(r(177));e.callbackNode=null,e.callbackPriority=0;var o=n.lanes|n.childLanes;if(Lt(e,o),e===qc&&(Jc=qc=null,Yc=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||dl||(dl=!0,Xl(_t,function(){return Hl(),null})),o=(n.flags&15990)!=0,n.subtreeFlags&15990||o){o=Kc.transition,Kc.transition=null;var s=U;U=1;var c=q;q|=4,Gc.current=null,xc(e,n),Ic(n,e),Pr(xi),dn=!!bi,xi=bi=null,e.current=n,Rc(n,e,a),ft(),q=c,U=s,Kc.transition=o}else e.current=n;if(dl&&(dl=!1,fl=e,pl=a),o=e.pendingLanes,o===0&&(ul=null),St(n.stateNode,i),xl(e,pt()),t!==null)for(i=e.onRecoverableError,n=0;n<t.length;n++)a=t[n],i(a.value,{componentStack:a.stack,digest:a.digest});if(cl)throw cl=!1,e=ll,ll=null,e;return pl&1&&e.tag!==0&&Hl(),o=e.pendingLanes,o&1?e===hl?ml++:(ml=0,hl=e):ml=0,sa(),null}function Hl(){if(fl!==null){var e=zt(pl),t=Kc.transition,n=U;try{if(Kc.transition=null,U=16>e?16:e,fl===null)var i=!1;else{if(e=fl,fl=null,pl=0,q&6)throw Error(r(331));var a=q;for(q|=4,K=e.current;K!==null;){var o=K,s=o.child;if(K.flags&16){var c=o.deletions;if(c!==null){for(var l=0;l<c.length;l++){var u=c[l];for(K=u;K!==null;){var d=K;switch(d.tag){case 0:case 11:case 15:Sc(8,d,o)}var f=d.child;if(f!==null)f.return=d,K=f;else for(;K!==null;){d=K;var p=d.sibling,m=d.return;if(Tc(d),d===u){K=null;break}if(p!==null){p.return=m,K=p;break}K=m}}}var h=o.alternate;if(h!==null){var g=h.child;if(g!==null){h.child=null;do{var _=g.sibling;g.sibling=null,g=_}while(g!==null)}}K=o}}if(o.subtreeFlags&2064&&s!==null)s.return=o,K=s;else b:for(;K!==null;){if(o=K,o.flags&2048)switch(o.tag){case 0:case 11:case 15:Sc(9,o,o.return)}var v=o.sibling;if(v!==null){v.return=o.return,K=v;break b}K=o.return}}var y=e.current;for(K=y;K!==null;){s=K;var b=s.child;if(s.subtreeFlags&2064&&b!==null)b.return=s,K=b;else b:for(s=y;K!==null;){if(c=K,c.flags&2048)try{switch(c.tag){case 0:case 11:case 15:Cc(9,c)}}catch(e){Wl(c,c.return,e)}if(c===s){K=null;break b}var x=c.sibling;if(x!==null){x.return=c.return,K=x;break b}K=c.return}}if(q=a,sa(),xt&&typeof xt.onPostCommitFiberRoot==`function`)try{xt.onPostCommitFiberRoot(bt,e)}catch{}i=!0}return i}finally{U=n,Kc.transition=t}}return!1}function Ul(e,t,n){t=Os(n,t),t=Ms(e,t,1),e=io(e,t,1),t=vl(),e!==null&&(It(e,1,t),xl(e,t))}function Wl(e,t,n){if(e.tag===3)Ul(e,e,n);else for(;t!==null;){if(t.tag===3){Ul(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(ul===null||!ul.has(r))){e=Os(n,e),e=Ns(t,e,1),t=io(t,e,1),e=vl(),t!==null&&(It(t,1,e),xl(t,e));break}}t=t.return}}function Gl(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=vl(),e.pingedLanes|=e.suspendedLanes&n,qc===e&&(Yc&n)===n&&(Qc===4||Qc===3&&(Yc&130023424)===Yc&&500>pt()-al?jl(e,0):nl|=n),xl(e,t)}function Kl(e,t){t===0&&(e.mode&1?(t=Ot,Ot<<=1,!(Ot&130023424)&&(Ot=4194304)):t=1);var n=vl();e=$a(e,t),e!==null&&(It(e,t,n),xl(e,n))}function ql(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Kl(e,n)}function Jl(e,t){var n=0;switch(e.tag){case 13:var i=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:i=e.stateNode;break;default:throw Error(r(314))}i!==null&&i.delete(t),Kl(e,n)}var Yl=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||qi.current)Rs=!0;else{if((e.lanes&n)===0&&!(t.flags&128))return Rs=!1,sc(e,t,n);Rs=!!(e.flags&131072)}else Rs=!1,Ca&&t.flags&1048576&&va(t,da,t.index);switch(t.lanes=0,t.tag){case 2:var i=t.type;ac(e,t),e=t.pendingProps;var a=Yi(t,Ki.current);Ja(t,n),a=Fo(null,t,i,e,a,n);var o=Io();return t.flags|=1,typeof a==`object`&&a&&typeof a.render==`function`&&a.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Xi(i)?(o=!0,ea(t)):o=!1,t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,to(t),a.updater=Cs,t.stateNode=a,a._reactInternals=t,Ds(t,i,e,n),t=qs(null,t,i,!0,o,n)):(t.tag=0,Ca&&o&&ya(t),zs(null,t,a,n),t=t.child),t;case 16:i=t.elementType;a:{switch(ac(e,t),e=t.pendingProps,a=i._init,i=a(i._payload),t.type=i,a=t.tag=eu(i),e=xs(i,e),a){case 0:t=Gs(null,t,i,e,n);break a;case 1:t=Ks(null,t,i,e,n);break a;case 11:t=Bs(null,t,i,e,n);break a;case 14:t=Vs(null,t,i,xs(i.type,e),n);break a}throw Error(r(306,i,``))}return t;case 0:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:xs(i,a),Gs(e,t,i,a,n);case 1:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:xs(i,a),Ks(e,t,i,a,n);case 3:a:{if(Js(t),e===null)throw Error(r(387));i=t.pendingProps,o=t.memoizedState,a=o.element,no(e,t),so(t,i,null,n);var s=t.memoizedState;if(i=s.element,o.isDehydrated)if(o={element:i,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){a=Os(Error(r(423)),t),t=Ys(e,t,i,n,a);break a}else if(i!==a){a=Os(Error(r(424)),t),t=Ys(e,t,i,n,a);break a}else for(Sa=ki(t.stateNode.containerInfo.firstChild),xa=t,Ca=!0,wa=null,n=Ba(t,null,i,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Ma(),i===a){t=oc(e,t,n);break a}zs(e,t,i,n)}t=t.child}return t;case 5:return _o(t),e===null&&Oa(t),i=t.type,a=t.pendingProps,o=e===null?null:e.memoizedProps,s=a.children,Si(i,a)?s=null:o!==null&&Si(i,o)&&(t.flags|=32),Ws(e,t),zs(e,t,s,n),t.child;case 6:return e===null&&Oa(t),null;case 13:return Qs(e,t,n);case 4:return ho(t,t.stateNode.containerInfo),i=t.pendingProps,e===null?t.child=za(t,null,i,n):zs(e,t,i,n),t.child;case 11:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:xs(i,a),Bs(e,t,i,a,n);case 7:return zs(e,t,t.pendingProps,n),t.child;case 8:return zs(e,t,t.pendingProps.children,n),t.child;case 12:return zs(e,t,t.pendingProps.children,n),t.child;case 10:a:{if(i=t.type._context,a=t.pendingProps,o=t.memoizedProps,s=a.value,G(Va,i._currentValue),i._currentValue=s,o!==null)if(Dr(o.value,s)){if(o.children===a.children&&!qi.current){t=oc(e,t,n);break a}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var c=o.dependencies;if(c!==null){s=o.child;for(var l=c.firstContext;l!==null;){if(l.context===i){if(o.tag===1){l=ro(-1,n&-n),l.tag=2;var u=o.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?l.next=l:(l.next=d.next,d.next=l),u.pending=l}}o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),qa(o.return,n,t),c.lanes|=n;break}l=l.next}}else if(o.tag===10)s=o.type===t.type?null:o.child;else if(o.tag===18){if(s=o.return,s===null)throw Error(r(341));s.lanes|=n,c=s.alternate,c!==null&&(c.lanes|=n),qa(s,n,t),s=o.sibling}else s=o.child;if(s!==null)s.return=o;else for(s=o;s!==null;){if(s===t){s=null;break}if(o=s.sibling,o!==null){o.return=s.return,s=o;break}s=s.return}o=s}zs(e,t,a.children,n),t=t.child}return t;case 9:return a=t.type,i=t.pendingProps.children,Ja(t,n),a=Ya(a),i=i(a),t.flags|=1,zs(e,t,i,n),t.child;case 14:return i=t.type,a=xs(i,t.pendingProps),a=xs(i.type,a),Vs(e,t,i,a,n);case 15:return Hs(e,t,t.type,t.pendingProps,n);case 17:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:xs(i,a),ac(e,t),t.tag=1,Xi(i)?(e=!0,ea(t)):e=!1,Ja(t,n),Ts(t,i,a),Ds(t,i,a,n),qs(null,t,i,!0,e,n);case 19:return ic(e,t,n);case 22:return Us(e,t,n)}throw Error(r(156,t.tag))};function Xl(e,t){return lt(e,t)}function Zl(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.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 Ql(e,t,n,r){return new Zl(e,t,n,r)}function $l(e){return e=e.prototype,!(!e||!e.isReactComponent)}function eu(e){if(typeof e==`function`)return+!!$l(e);if(e!=null){if(e=e.$$typeof,e===j)return 11;if(e===P)return 14}return 2}function tu(e,t){var n=e.alternate;return n===null?(n=Ql(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&14680064,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}function nu(e,t,n,i,a,o){var s=2;if(i=e,typeof e==`function`)$l(e)&&(s=1);else if(typeof e==`string`)s=5;else a:switch(e){case E:return ru(n.children,a,o,t);case D:s=8,a|=8;break;case O:return e=Ql(12,n,t,a|2),e.elementType=O,e.lanes=o,e;case M:return e=Ql(13,n,t,a),e.elementType=M,e.lanes=o,e;case N:return e=Ql(19,n,t,a),e.elementType=N,e.lanes=o,e;case te:return iu(n,a,o,t);default:if(typeof e==`object`&&e)switch(e.$$typeof){case k:s=10;break a;case A:s=9;break a;case j:s=11;break a;case P:s=14;break a;case ee:s=16,i=null;break a}throw Error(r(130,e==null?e:typeof e,``))}return t=Ql(s,n,t,a),t.elementType=e,t.type=i,t.lanes=o,t}function ru(e,t,n,r){return e=Ql(7,e,r,t),e.lanes=n,e}function iu(e,t,n,r){return e=Ql(22,e,r,t),e.elementType=te,e.lanes=n,e.stateNode={isHidden:!1},e}function J(e,t,n){return e=Ql(6,e,null,t),e.lanes=n,e}function au(e,t,n){return t=Ql(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function ou(e,t,n,r,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Ft(0),this.expirationTimes=Ft(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ft(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function Y(e,t,n,r,i,a,o,s,c){return e=new ou(e,t,n,s,c),t===1?(t=1,!0===a&&(t|=8)):t=0,a=Ql(3,null,null,t),e.current=a,a.stateNode=e,a.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},to(a),e}function X(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:T,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}function su(e){if(!e)return Gi;e=e._reactInternals;a:{if(rt(e)!==e||e.tag!==1)throw Error(r(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break a;case 1:if(Xi(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break a}}t=t.return}while(t!==null);throw Error(r(171))}if(e.tag===1){var n=e.type;if(Xi(n))return $i(e,n,t)}return t}function cu(e,t,n,r,i,a,o,s,c){return e=Y(n,r,!0,e,i,a,o,s,c),e.context=su(null),n=e.current,r=vl(),i=yl(n),a=ro(r,i),a.callback=t??null,io(n,a,i),e.current.lanes=i,It(e,i,r),xl(e,r),e}function lu(e,t,n,r){var i=t.current,a=vl(),o=yl(i);return n=su(n),t.context===null?t.context=n:t.pendingContext=n,t=ro(a,o),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=io(i,t,o),e!==null&&(bl(e,i,o,a),ao(e,i,o)),o}function uu(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function du(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function fu(e,t){du(e,t),(e=e.alternate)&&du(e,t)}function pu(){return null}var mu=typeof reportError==`function`?reportError:function(e){console.error(e)};function hu(e){this._internalRoot=e}gu.prototype.render=hu.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(r(409));lu(e,t,null,null)},gu.prototype.unmount=hu.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;kl(function(){lu(null,e,null,null)}),t[Pi]=null}};function gu(e){this._internalRoot=e}gu.prototype.unstable_scheduleHydration=function(e){if(e){var t=Ut();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Qt.length&&t!==0&&t<Qt[n].priority;n++);Qt.splice(n,0,e),n===0&&rn(e)}};function _u(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function vu(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==` react-mount-point-unstable `))}function yu(){}function bu(e,t,n,r,i){if(i){if(typeof r==`function`){var a=r;r=function(){var e=uu(o);a.call(e)}}var o=cu(t,r,e,0,null,!1,!1,``,yu);return e._reactRootContainer=o,e[Pi]=o.current,ci(e.nodeType===8?e.parentNode:e),kl(),o}for(;i=e.lastChild;)e.removeChild(i);if(typeof r==`function`){var s=r;r=function(){var e=uu(c);s.call(e)}}var c=Y(e,0,!1,null,null,!1,!1,``,yu);return e._reactRootContainer=c,e[Pi]=c.current,ci(e.nodeType===8?e.parentNode:e),kl(function(){lu(t,c,n,r)}),c}function xu(e,t,n,r,i){var a=n._reactRootContainer;if(a){var o=a;if(typeof i==`function`){var s=i;i=function(){var e=uu(o);s.call(e)}}lu(t,o,e,i)}else o=bu(n,t,e,i,r);return uu(o)}Bt=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=kt(t.pendingLanes);n!==0&&(Rt(t,n|1),xl(t,pt()),!(q&6)&&(ol=pt()+500,sa()))}break;case 13:kl(function(){var t=$a(e,1);t!==null&&bl(t,e,1,vl())}),fu(e,1)}},Vt=function(e){if(e.tag===13){var t=$a(e,134217728);t!==null&&bl(t,e,134217728,vl()),fu(e,134217728)}},Ht=function(e){if(e.tag===13){var t=yl(e),n=$a(e,t);n!==null&&bl(n,e,t,vl()),fu(e,t)}},Ut=function(){return U},Wt=function(e,t){var n=U;try{return U=e,t()}finally{U=n}},Re=function(e,t,n){switch(t){case`input`:if(ve(e,n),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name=`+JSON.stringify(``+t)+`][type="radio"]`),t=0;t<n.length;t++){var i=n[t];if(i!==e&&i.form===e.form){var a=Vi(i);if(!a)throw Error(r(90));pe(i),ve(i,a)}}}break;case`textarea`:Te(e,n);break;case`select`:t=n.value,t!=null&&Se(e,!!n.multiple,t,!1)}},He=Ol,Ue=kl;var Su={usingClientEntryPoint:!1,Events:[zi,Bi,Vi,Be,Ve,Ol]},Cu={findFiberByHostInstance:Ri,bundleType:0,version:`18.3.1`,rendererPackageName:`react-dom`},wu={bundleType:Cu.bundleType,version:Cu.version,rendererPackageName:Cu.rendererPackageName,rendererConfig:Cu.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:C.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=st(e),e===null?null:e.stateNode},findFiberByHostInstance:Cu.findFiberByHostInstance||pu,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:`18.3.1-next-f1338f8080-20240426`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var Tu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Tu.isDisabled&&Tu.supportsFiber)try{bt=Tu.inject(wu),xt=Tu}catch{}}e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Su,e.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!_u(t))throw Error(r(200));return X(e,t,null,n)},e.createRoot=function(e,t){if(!_u(e))throw Error(r(299));var n=!1,i=``,a=mu;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(i=t.identifierPrefix),t.onRecoverableError!==void 0&&(a=t.onRecoverableError)),t=Y(e,1,!1,null,null,n,!1,i,a),e[Pi]=t.current,ci(e.nodeType===8?e.parentNode:e),new hu(t)},e.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(r(188)):(e=Object.keys(e).join(`,`),Error(r(268,e)));return e=st(t),e=e===null?null:e.stateNode,e},e.flushSync=function(e){return kl(e)},e.hydrate=function(e,t,n){if(!vu(t))throw Error(r(200));return xu(null,e,t,!0,n)},e.hydrateRoot=function(e,t,n){if(!_u(e))throw Error(r(405));var i=n!=null&&n.hydratedSources||null,a=!1,o=``,s=mu;if(n!=null&&(!0===n.unstable_strictMode&&(a=!0),n.identifierPrefix!==void 0&&(o=n.identifierPrefix),n.onRecoverableError!==void 0&&(s=n.onRecoverableError)),t=cu(t,null,e,1,n??null,a,!1,o,s),e[Pi]=t.current,ci(e),i)for(e=0;e<i.length;e++)n=i[e],a=n._getVersion,a=a(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,a]:t.mutableSourceEagerHydrationData.push(n,a);return new gu(t)},e.render=function(e,t,n){if(!vu(t))throw Error(r(200));return xu(null,e,t,!1,n)},e.unmountComponentAtNode=function(e){if(!vu(e))throw Error(r(40));return e._reactRootContainer?(kl(function(){xu(null,null,e,!1,function(){e._reactRootContainer=null,e[Pi]=null})}),!0):!1},e.unstable_batchedUpdates=Ol,e.unstable_renderSubtreeIntoContainer=function(e,t,n,i){if(!vu(n))throw Error(r(200));if(e==null||e._reactInternals===void 0)throw Error(r(38));return xu(e,t,n,!1,i)},e.version=`18.3.1-next-f1338f8080-20240426`})),h=o(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=m()})),g=o((e=>{var t=h();e.createRoot=t.createRoot,e.hydrateRoot=t.hydrateRoot})),_=l(d(),1),v=g(),y=e=>String(e).padStart(2,`0`);function b(e){if(!e)return null;let t=new Date(e);return isNaN(t.getTime())?null:t}function x(e,t,n){let r=new Intl.DateTimeFormat(`en-US`,{...n,timeZone:t}),i={};for(let t of r.formatToParts(e))i[t.type]=t.value;return i}function S(e,t){let n=x(e,t,{timeZoneName:`short`}).timeZoneName??``;if(n===`GMT`)return`UTC`;let r=n.replace(/^GMT/,``);return r===``?n:r.replace(/^([+-])(\d)$/,`$10$2`)}function C(e,t){let n=b(e);if(!n)return`—`;let r=x(n,t.tz,{month:`short`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,hour12:!1});return`${r.month} ${r.day} ${r.hour}:${r.minute} ${S(n,t.tz)}`}function w(e,t){let n=b(e);if(!n)return`—`;let r=x(n,t.tz,{month:`short`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,hour12:!1,timeZoneName:`shortOffset`}),i=(r.timeZoneName??``).replace(/^GMT/,``).replace(/^([+-])(\d)$/,`$10$2`);return`${r.month} ${r.day} ${r.hour}:${r.minute}${i||``}`}function T(e,t){let n=b(e);if(!n)return null;let r=x(n,t.tz,{month:`short`,day:`2-digit`});return`${r.month} ${r.day}`}function E(e){if(!e)return null;let t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e);if(!t)return null;let n=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],r=t[2]-1;return r<0||r>11?null:`${n[r]} ${t[3]}`}function D(e,t,n={}){let r=b(e);if(!r)return`—`;let i=x(r,t.tz,{year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,hour12:!1}),a=`${i.year}-${i.month}-${i.day} ${i.hour}:${i.minute}`;return n.noSuffix?a:`${a} ${S(r,t.tz)}`}function O(e,t,n=Date.now()){let r=b(e);if(!r)return`—`;let i=n-r.getTime();if(i<6e4)return`just now`;if(i<36e5)return`${Math.floor(i/6e4)}m ago`;if(i<864e5)return`${Math.floor(i/36e5)}h ago`;let a=x(new Date(n),t.tz,{year:`numeric`,month:`2-digit`,day:`2-digit`}),o=x(r,t.tz,{year:`numeric`,month:`2-digit`,day:`2-digit`}),s=`${a.year}-${a.month}-${a.day}`,c=`${o.year}-${o.month}-${o.day}`;if(s!==c&&i<1728e5){let e=x(new Date(n-864e5),t.tz,{year:`numeric`,month:`2-digit`,day:`2-digit`});if(c===`${e.year}-${e.month}-${e.day}`)return`Yesterday`}return T(e,t)??`—`}function k(e,t,n={}){let r=b(e);if(!r)return`—`;let i=x(r,t.tz,{hour:`2-digit`,minute:`2-digit`,hour12:!1}),a=`${i.hour}:${i.minute}`;return n.noSuffix?a:`${a} ${S(r,t.tz)}`}var A={pct0(e){return e==null?`—`:`${Math.round(e)}%`},pct1(e){return e==null?`—`:`${(+e).toFixed(1)}%`},usd2(e){return e==null?`—`:`$${(+e).toFixed(2)}`},usdSigned(e){return e==null?`—`:`${e>=0?`+`:`−`}$${Math.abs(+e).toFixed(2)}`},pctFloor(e){return Math.floor(e+1e-9)},usd3(e){return e==null?`—`:`$${(+e).toFixed(3)}`},usd2PerDay(e){return e==null?`—`:`$${(+e).toFixed(2)} / day`},hours1(e){return e==null?`—`:`${(+e).toFixed(1)} h`},ratePctPerHour(e){return e==null?`—`:`from ${(+e).toFixed(4)} %/h`},agoSec(e){return e==null?`—`:`${Math.max(0,e|0)}s ago`},hhmm(e){return e==null?`—`:`${e/3600|0}h ${y(e%3600/60|0)}m`},durationMs(e){if(e==null||!isFinite(e))return`—`;let t=Math.round(e/1e3);if(t<60)return`${(e/1e3).toFixed(1)}s`;let n=Math.floor(t/60),r=t-n*60;return r?`${n}m ${r}s`:`${n}m`},ddhh(e){return e==null?`—`:`${e/86400|0}d ${e%86400/3600|0}h`},elapsedHm(e){return e==null?`—`:e<=0?`just now`:`${e/3600|0}h ${e%3600/60|0}m`},datetimeShort:C,datetimeShortZ:w,dateShort:T,startedShort:D,timeHHmm:k,weekStart:(e,t)=>E(e),timeOnly:k,relativeOrAbsolute:O,delta(e){if(e==null)return`—`;let t=e>0?`↑`:e<0?`↓`:`·`;return`${e>0?`+`:``}${e.toFixed(2)} ${t}`},pp(e){return e==null?`—`:Math.abs(e)<.05?`±0.0pp`:`${e>0?`+`:`−`}${Math.abs(e).toFixed(1)}pp`},deltaPct(e){if(e==null)return`—`;let t=Math.round(e*100);return t===0?`0%`:t>0?`+${t}%`:`−${Math.abs(t)}%`},compact(e,t={}){if(e==null)return`—`;let n=Math.abs(e),r;if(n>=1e9)r=(e/1e9).toFixed(1)+`B`;else if(n>=1e6){let t=e/1e6;r=(t>=100?t.toFixed(0):t.toFixed(1))+`M`}else if(n>=1e3){let t=e/1e3;r=(t>=100?t.toFixed(0):t.toFixed(1))+`k`}else return String(e|0);return r=r.replace(/\.0(?=[kMB]$)/,``),t.upper&&(r=r.replace(/k$/,`K`)),r},deltaCls(e,t){return e==null||t?``:e>0?`delta-pos`:e<0?`delta-neg`:``}},j={tz:`Etc/UTC`,offsetLabel:`UTC`};function M(e){return e?.display?{tz:e.display.resolved_tz,offsetLabel:e.display.offset_label}:j}function N(e){let t=e=>(t,n)=>(e(n)??0)-(e(t)??0),n=e=>(t,n)=>{let r=(e(t)||``).toString(),i=(e(n)||``).toString();return r<i?-1:+(r>i)};switch(e){case`cost desc`:return t(e=>e.cost_usd??0);case`duration desc`:return t(e=>e.duration_min);case`model asc`:return n(e=>e.model);case`project asc`:return n(e=>e.project);default:return t(e=>e.started_utc?Date.parse(e.started_utc):0)}}function P(e,t){let n=(t||``).toLowerCase();return n?e.filter(e=>(e.project||``).toLowerCase().includes(n)||(e.project_key||``).toLowerCase().includes(n)||(e.model||``).toLowerCase().includes(n)):e}function ee(e,t=j){let n=e.started_utc?A.startedShort(e.started_utc,t,{noSuffix:!0}):``,r=e.duration_min==null?``:`${e.duration_min}m`,i=e.cost_usd==null?``:`$${e.cost_usd.toFixed(2)}`;return[n===`—`?``:n,r,e.model||``,e.project||``,e.project_key||``,i].join(` `).toLowerCase()}function te(e,t,n=j){let r=(t||``).toLowerCase();if(!r)return[];let i=[];for(let t=0;t<e.length;t++)ee(e[t],n).includes(r)&&i.push(t);return i}function ne(e){let t=e?.trend;return t?(t.spark_heights&&t.spark_heights.length!==t.weeks.length&&console.warn(`cctally dashboard: spark_heights length ${t.spark_heights.length} != weeks ${t.weeks.length}`),t.weeks.map((e,n)=>({label:e.label,used_pct:e.used_pct,dollar_per_pct:e.dollar_per_pct,delta:e.delta,is_current:e.is_current,spark_height:t.spark_heights?.[n]}))):[]}function re(e){let t=e?.trend;return t?t.history.map(e=>({label:e.label,used_pct:e.used_pct,dollar_per_pct:e.dollar_per_pct,delta:e.delta,is_current:e.is_current})):[]}var F=[`current-week`,`forecast`,`trend`,`sessions`,`projects`,`weekly`,`monthly`,`blocks`,`daily`,`alerts`,`cache-report`],ie=new Set([`current-week`,`forecast`,`trend`,`sessions`,`projects`,`weekly`,`monthly`,`blocks`,`daily`]),ae=4;function oe(e,t){if(t>=2)return{panels:e??[],newVersion:t};if(!e||e.length===0)return{panels:[],newVersion:2};if(e.includes(`projects`))return{panels:e,newVersion:2};let n=[...e],r=Math.min(ae,n.length);return n.splice(r,0,`projects`),{panels:n,newVersion:2}}function se(e,t){if(!e||!Array.isArray(e)||e.length===0)return[...t];let n=new Set(t),r=new Set,i=[];for(let t of e)n.has(t)&&(r.has(t)||(r.add(t),i.push(t)));for(let e of t)r.has(e)||i.push(e);return i}function ce(e,t,n){if(!n)return e;let r=t.find(e=>e.id===n.column);if(!r)return e;let i=n.direction===`desc`?-1:1,a=r.nullKey;return e.slice().sort((e,t)=>{if(a){let n=a(e)==null,r=a(t)==null;if(n&&r)return 0;if(n)return 1;if(r)return-1}return i*r.compare(e,t)})}function I(e,t){return!e||e.column!==t.id?{column:t.id,direction:t.defaultDirection}:e.direction===t.defaultDirection?{column:t.id,direction:e.direction===`asc`?`desc`:`asc`}:null}function le(e){if(typeof e!=`object`||!e||Array.isArray(e))return null;let t=e;return typeof t.column!=`string`||t.direction!==`asc`&&t.direction!==`desc`?null:{column:t.column,direction:t.direction}}var ue=[{id:`started`,label:`Started`,defaultDirection:`desc`,compare:(e,t)=>(Date.parse(e.started_utc??``)||0)-(Date.parse(t.started_utc??``)||0)},{id:`duration`,label:`Dur`,defaultDirection:`desc`,compare:(e,t)=>(e.duration_min??0)-(t.duration_min??0)},{id:`model`,label:`Model`,defaultDirection:`asc`,compare:(e,t)=>(e.model||``).localeCompare(t.model||``)},{id:`project`,label:`Project`,defaultDirection:`asc`,compare:(e,t)=>(e.project||``).localeCompare(t.project||``)},{id:`cost`,label:`Cost`,defaultDirection:`desc`,numeric:!0,compare:(e,t)=>(e.cost_usd??0)-(t.cost_usd??0)}],de={shareModal:null,composerModal:null};function fe(e,t){switch(t.type){case`OPEN_SHARE`:{let n=t.params===void 0?{panel:t.panel,triggerId:t.triggerId}:{panel:t.panel,triggerId:t.triggerId,params:t.params};return{...e,shareModal:n}}case`CLOSE_SHARE`:return{...e,shareModal:null};case`OPEN_COMPOSER`:return{...e,composerModal:{open:!0}};case`CLOSE_COMPOSER`:return{...e,composerModal:null};default:return e}}function L(e,t,n){return n===void 0?{type:`OPEN_SHARE`,panel:e,triggerId:t}:{type:`OPEN_SHARE`,panel:e,triggerId:t,params:n}}function pe(){return{type:`CLOSE_SHARE`}}function me(){return{type:`OPEN_COMPOSER`}}function he(){return{type:`CLOSE_COMPOSER`}}var ge=`cctally:share:basket`;function _e(e,t){switch(t.type){case`BASKET_ADD`:return e.items.length>=20?{...e,rejectedReason:`capacity`}:{items:[...e.items,t.item],rejectedReason:null};case`BASKET_REMOVE`:return{...e,items:e.items.filter(e=>e.id!==t.id)};case`BASKET_REORDER`:{if(t.fromIdx===t.toIdx||t.fromIdx<0||t.toIdx<0||t.fromIdx>=e.items.length||t.toIdx>=e.items.length)return e;let n=e.items.slice(),[r]=n.splice(t.fromIdx,1);return n.splice(t.toIdx,0,r),{...e,items:n}}case`BASKET_CLEAR`:return{items:[],rejectedReason:null};case`BASKET_CLEAR_REJECTED`:return e.rejectedReason==null?e:{...e,rejectedReason:null};case`BASKET_HYDRATE`:return{items:t.items,rejectedReason:null};default:return e}}function ve(e){return{id:e.id??Se(),panel:e.panel,template_id:e.template_id,options:e.options,added_at:e.added_at,data_digest_at_add:e.data_digest_at_add,kernel_version:e.kernel_version,label_hint:e.label_hint}}function ye(){try{let e=localStorage.getItem(ge);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t.filter(xe):[]}catch{return[]}}function be(e){try{localStorage.setItem(ge,JSON.stringify(e))}catch{}}function xe(e){if(typeof e!=`object`||!e)return!1;let t=e;return typeof t.id==`string`&&typeof t.panel==`string`&&typeof t.template_id==`string`&&typeof t.added_at==`string`&&typeof t.data_digest_at_add==`string`&&typeof t.kernel_version==`number`&&typeof t.label_hint==`string`&&typeof t.options==`object`&&t.options!==null}function Se(){let e=new Uint8Array(16);return crypto.getRandomValues(e),Array.from(e,e=>e.toString(16).padStart(2,`0`)).join(``).slice(0,26)}var Ce=`ccusage.dashboard.prefs`,we=`ccusage.dashboard.filter`,Te=`ccusage.dashboard.sort`;function Ee(){return{state:null,suppress:{skipped_versions:[],remind_after:null},modalOpen:!1,runId:null,status:`idle`,stream:[],errorMessage:null,startedAt:null}}var De=[{key:`started desc`,label:`Started (newest first)`},{key:`cost desc`,label:`Cost (highest first)`},{key:`duration desc`,label:`Duration (longest first)`},{key:`model asc`,label:`Model (A→Z)`},{key:`project asc`,label:`Project (A→Z)`}];function Oe(){return{sortDefault:`started desc`,sessionsPerPage:100,sessionsCollapsed:!0,blocksCollapsed:!0,dailyCollapsed:!0,alertsCollapsed:!1,panelOrder:[...F],onboardingToastSeen:!1,mobileOnboardingToastSeen:!1,trendSortOverride:null,sessionsSortOverride:null,projectsWindowWeeks:4,projectsTrendYMode:`absolute`,projectsSortOverride:null,panelOrderSchemaVersion:1}}function ke(){return{enabled:!1,weekly_thresholds:[90,95],five_hour_thresholds:[90,95],budget_thresholds:[90,100],budget_enabled:!1,projected_weekly_enabled:!1,projected_budget_enabled:!1,project_alerts_enabled:!1,codex_budget_configured:!1,codex_budget_alerts_enabled:!1,codex_projected_enabled:!1}}function Ae(){let e=Oe(),t=localStorage.getItem(Ce),n=localStorage.getItem(Te);if(t){try{let n=JSON.parse(t);e={...Oe(),...n};let r=typeof n.panelOrderSchemaVersion==`number`?n.panelOrderSchemaVersion:1,i=oe(n.panelOrder??null,r);e.panelOrderSchemaVersion=i.newVersion,e.panelOrder=se(i.panels,F),e.trendSortOverride=le(e.trendSortOverride??null),e.sessionsSortOverride=le(e.sessionsSortOverride??null),e.projectsSortOverride=le(e.projectsSortOverride??null),r!==i.newVersion&&localStorage.setItem(Ce,JSON.stringify(e))}catch{e=Oe(),e.panelOrderSchemaVersion=2}n!=null&&localStorage.removeItem(Te)}else n?(e={...Oe(),sortDefault:n,panelOrderSchemaVersion:2},localStorage.setItem(Ce,JSON.stringify(e)),localStorage.removeItem(Te)):e.panelOrderSchemaVersion=2;return{snapshot:null,view:`dashboard`,selectedConversationId:null,conversationSearch:``,conversationJump:null,openModal:null,openSessionId:null,openBlockStartAt:null,openDailyDate:null,openProjectKey:null,sessionsSort:e.sortDefault,filterText:localStorage.getItem(we)??``,searchText:``,searchMatches:[],searchIndex:-1,inputMode:null,prefs:e,syncErrorFloorUntil:0,syncBusy:!1,syncSuccessFlashUntil:0,toast:null,alerts:[],seenAlertIds:new Set,alertsConfig:ke(),alertToastQueue:[],dragPreviewOrder:null,update:Ee(),...de,basket:{items:ye(),rejectedReason:null},doctor:null,doctorModalOpen:!1}}var R=Ae(),je=new Set,Me=``;function Ne(){je.forEach(e=>{try{e()}catch(e){console.error(`subscriber error:`,e)}})}function z(){return R}function B(e){return je.add(e),()=>{je.delete(e)}}function Pe(e=R){let t=P(e.snapshot?.sessions?.rows??[],e.filterText),n=e.prefs.sessionsSortOverride;return(n?ce(t,ue,n):t.slice().sort(N(e.sessionsSort))).slice(0,e.prefs.sessionsPerPage)}function Fe(e){if(!e.searchText)return{searchMatches:[],searchIndex:-1};let t=te(Pe(e),e.searchText,M(e.snapshot));return t.length===0?{searchMatches:[],searchIndex:-1}:{searchMatches:t,searchIndex:e.searchIndex<0||e.searchIndex>=t.length?0:e.searchIndex}}function Ie(e){let t=e?.generated_at??``;if(t&&Me&&t<Me)return!1;t&&(Me=t);let n={...R,snapshot:e};return R={...n,...Fe(n)},Ne(),!0}function Le(){Me=``}var Re={openModal:null,openSessionId:null,openBlockStartAt:null,openDailyDate:null,openProjectKey:null,shareModal:null,composerModal:null};function V(e){switch(e.type){case`OPEN_MODAL`:R={...R,openModal:e.kind,openSessionId:e.sessionId??null,openBlockStartAt:e.blockStartAt??null,openDailyDate:e.dailyDate??null,openProjectKey:e.projectKey??null};break;case`CLOSE_MODAL`:R={...R,openModal:null,openSessionId:null,openBlockStartAt:null,openDailyDate:null,openProjectKey:null};break;case`SET_VIEW`:R={...R,view:e.view,...Re,...e.view===`dashboard`?{selectedConversationId:null,conversationJump:null,conversationSearch:``}:{}};break;case`OPEN_CONVERSATION`:R={...R,view:`conversations`,...Re,selectedConversationId:e.sessionId,conversationJump:e.jump??null};break;case`SELECT_CONVERSATION`:R={...R,selectedConversationId:e.sessionId,conversationJump:null};break;case`SET_CONVERSATION_SEARCH`:R={...R,conversationSearch:e.text};break;case`CLEAR_CONVERSATION_JUMP`:R={...R,conversationJump:null};break;case`SET_FILTER`:{e.text?localStorage.setItem(we,e.text):localStorage.removeItem(we);let t={...R,filterText:e.text};R={...t,...Fe(t)};break}case`SET_SEARCH`:{let t={...R,searchText:e.text,searchIndex:0};R={...t,...Fe(t)};break}case`SET_SEARCH_MATCHES`:R={...R,searchMatches:e.matches,searchIndex:e.index};break;case`SET_SORT`:{let t={...R,sessionsSort:e.key};R={...t,...Fe(t)};break}case`SET_INPUT_MODE`:R={...R,inputMode:e.mode};break;case`SAVE_PREFS`:{let t={...R.prefs,...e.patch};localStorage.setItem(Ce,JSON.stringify(t));let n={...R,prefs:t};R={...n,...Fe(n)};break}case`RESET_PREFS`:{let e=R.prefs.onboardingToastSeen,t=R.prefs.mobileOnboardingToastSeen;localStorage.removeItem(Ce),localStorage.removeItem(we);let n=Oe();n.onboardingToastSeen=e,n.mobileOnboardingToastSeen=t,localStorage.setItem(Ce,JSON.stringify(n)),R={...R,prefs:n,filterText:``,searchText:``,searchMatches:[],searchIndex:-1,sessionsSort:n.sortDefault};break}case`RESET_PANEL_ORDER`:{let e={...R.prefs,panelOrder:[...F],panelOrderSchemaVersion:2};localStorage.setItem(Ce,JSON.stringify(e)),R={...R,prefs:e};break}case`REORDER_PANELS`:{let{from:t,to:n}=e,r=R.prefs.panelOrder;if(t===n||t<0||t>=r.length||n<0||n>=r.length)break;let i=r.slice(),[a]=i.splice(t,1);i.splice(n,0,a);let o={...R.prefs,panelOrder:i};localStorage.setItem(Ce,JSON.stringify(o)),R={...R,prefs:o};break}case`SET_DRAG_PREVIEW`:R={...R,dragPreviewOrder:e.order};break;case`COMMIT_DRAG_PREVIEW`:{let e=R.dragPreviewOrder;if(!e)break;let t={...R.prefs,panelOrder:e};localStorage.setItem(Ce,JSON.stringify(t)),R={...R,prefs:t,dragPreviewOrder:null};break}case`CLEAR_DRAG_PREVIEW`:if(R.dragPreviewOrder==null)break;R={...R,dragPreviewOrder:null};break;case`SWAP_PANELS`:{let{index:t,direction:n}=e,r=R.prefs.panelOrder,i=t+n;if(i<0||i>=r.length||t<0||t>=r.length)break;let a=r.slice();[a[t],a[i]]=[a[i],a[t]];let o={...R.prefs,panelOrder:a};localStorage.setItem(Ce,JSON.stringify(o)),R={...R,prefs:o};break}case`MARK_ONBOARDING_TOAST_SEEN`:{if(R.prefs.onboardingToastSeen)break;let e={...R.prefs,onboardingToastSeen:!0};localStorage.setItem(Ce,JSON.stringify(e)),R={...R,prefs:e};break}case`MARK_MOBILE_ONBOARDING_TOAST_SEEN`:{if(R.prefs.mobileOnboardingToastSeen)break;let e={...R.prefs,mobileOnboardingToastSeen:!0};localStorage.setItem(Ce,JSON.stringify(e)),R={...R,prefs:e};break}case`SET_SYNC_ERROR_FLOOR`:R={...R,syncErrorFloorUntil:e.untilMs};break;case`SET_SYNC_BUSY`:R={...R,syncBusy:e.busy};break;case`SET_SYNC_SUCCESS_FLASH`:R={...R,syncSuccessFlashUntil:e.untilMs};break;case`SHOW_STATUS_TOAST`:R={...R,toast:{kind:`status`,text:e.text}};break;case`SHOW_ALERT_TOAST`:R={...R,toast:{kind:`alert`,payload:e.alert}};break;case`HIDE_TOAST`:if(R.toast?.kind===`alert`&&R.alertToastQueue.length>0){let[e,...t]=R.alertToastQueue;R={...R,toast:{kind:`alert`,payload:e},alertToastQueue:t}}else R={...R,toast:null};break;case`INGEST_SNAPSHOT_ALERTS`:{let t=new Set(R.seenAlertIds);if(e.isFirstTick){for(let n of e.alerts)t.add(n.id);R={...R,alerts:e.alerts,seenAlertIds:t,alertsConfig:e.alertsSettings,alertToastQueue:[]};break}let n=e.alerts.filter(e=>!t.has(e.id));for(let e of n)t.add(e.id);let r=R.toast,i=R.alertToastQueue;n.length>0&&(!r||r.kind!==`alert`?(r={kind:`alert`,payload:n[0]},i=[...i,...n.slice(1)]):i=[...i,...n]),R={...R,alerts:e.alerts,seenAlertIds:t,alertsConfig:e.alertsSettings,alertToastQueue:i,toast:r};break}case`SET_TABLE_SORT`:{let t=e.table===`trend`?`trendSortOverride`:e.table===`projects`?`projectsSortOverride`:`sessionsSortOverride`,n={...R.prefs,[t]:e.override};localStorage.setItem(Ce,JSON.stringify(n));let r={...R,prefs:n};R={...r,...Fe(r)};break}case`CLEAR_TABLE_SORTS`:{let e={...R.prefs,trendSortOverride:null,sessionsSortOverride:null,projectsSortOverride:null};localStorage.setItem(Ce,JSON.stringify(e));let t={...R,prefs:e};R={...t,...Fe(t)};break}case`OPEN_UPDATE_MODAL`:R={...R,update:{...R.update,modalOpen:!0}};break;case`CLOSE_UPDATE_MODAL`:R={...R,update:{...R.update,modalOpen:!1}};break;case`SET_UPDATE_STATE`:R={...R,update:{...R.update,state:e.state,suppress:e.suppress}};break;case`SET_UPDATE_STATUS`:R={...R,update:{...R.update,status:e.status,errorMessage:e.errorMessage===void 0?R.update.errorMessage:e.errorMessage}};break;case`SET_UPDATE_RUN_ID`:R={...R,update:{...R.update,runId:e.runId,startedAt:e.startedAt===void 0?R.update.startedAt:e.startedAt}};break;case`APPEND_UPDATE_STREAM`:R={...R,update:{...R.update,stream:[...R.update.stream,e.event]}};break;case`RESET_UPDATE_RUN`:R={...R,update:{...R.update,status:`idle`,runId:null,stream:[],errorMessage:null,startedAt:null}};break;case`OPEN_SHARE`:case`CLOSE_SHARE`:case`OPEN_COMPOSER`:case`CLOSE_COMPOSER`:{let t=fe({shareModal:R.shareModal,composerModal:R.composerModal},e);R={...R,...t};break}case`BASKET_ADD`:case`BASKET_REMOVE`:case`BASKET_REORDER`:case`BASKET_CLEAR`:case`BASKET_CLEAR_REJECTED`:case`BASKET_HYDRATE`:{let t=_e(R.basket,e);if(t===R.basket)break;let n=t.items!==R.basket.items;R={...R,basket:t},n&&be(t.items),e.type===`BASKET_ADD`&&t.rejectedReason===`capacity`&&(R={...R,toast:{kind:`status`,text:`Basket is full (20 sections). Remove one to add another.`}});break}case`SET_DOCTOR_AGGREGATE`:R={...R,doctor:e.doctor};break;case`OPEN_DOCTOR_MODAL`:R={...R,doctorModalOpen:!0};break;case`CLOSE_DOCTOR_MODAL`:R={...R,doctorModalOpen:!1};break}Ne()}var ze=o((e=>{var t=d(),n=Symbol.for(`react.element`),r=Symbol.for(`react.fragment`),i=Object.prototype.hasOwnProperty,a=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};function s(e,t,r){var s,c={},l=null,u=null;for(s in r!==void 0&&(l=``+r),t.key!==void 0&&(l=``+t.key),t.ref!==void 0&&(u=t.ref),t)i.call(t,s)&&!o.hasOwnProperty(s)&&(c[s]=t[s]);if(e&&e.defaultProps)for(s in t=e.defaultProps,t)c[s]===void 0&&(c[s]=t[s]);return{$$typeof:n,type:e,key:l,ref:u,props:c,_owner:a.current}}e.Fragment=r,e.jsx=s,e.jsxs=s})),H=o(((e,t)=>{t.exports=ze()}))(),Be=320;function Ve(){return z().basket}function He(){let e=(0,_.useSyncExternalStore)(B,Ve).items.length,[t,n]=(0,_.useState)(!1),r=(0,_.useRef)(e);if((0,_.useEffect)(()=>{if(e>r.current){n(!0);let t=setTimeout(()=>n(!1),Be);return r.current=e,()=>clearTimeout(t)}r.current=e},[e]),e===0)return null;let i=e===1?`section`:`sections`;return(0,H.jsxs)(`button`,{type:`button`,className:`basket-chip${t?` basket-chip-pulse`:``}`,"aria-label":`Open basket (${e} ${i}). Click to compose.`,title:`Basket — ${e} ${i}. Click to compose.`,onClick:()=>V(me()),children:[(0,H.jsxs)(`svg`,{className:`basket-chip-icon`,width:`14`,height:`14`,viewBox:`0 0 14 14`,"aria-hidden":`true`,focusable:`false`,children:[(0,H.jsx)(`rect`,{x:`2.75`,y:`2`,width:`8.5`,height:`10.5`,rx:`1`,fill:`none`,stroke:`currentColor`,strokeWidth:`1`}),(0,H.jsx)(`rect`,{x:`4.5`,y:`0.75`,width:`5`,height:`2.5`,rx:`0.5`,fill:`none`,stroke:`currentColor`,strokeWidth:`1`})]}),(0,H.jsx)(`span`,{className:`basket-chip-count`,children:e})]})}var Ue={ok:`OK`,warn:`WARN`,fail:`FAIL`};function We(){let e=(0,_.useSyncExternalStore)(B,()=>z().doctor);if(!e)return null;let{severity:t,counts:n,generated_at:r}=e,i=`Doctor`;n.fail>0?i=`Doctor · ${n.fail} fail`:t===`warn`&&n.warn>0&&(i=`Doctor · ${n.warn} warn`);let a=`Doctor diagnostic: ${Ue[t]} — ${n.ok} OK, ${n.warn} warn, ${n.fail} fail`,o=`Doctor · ${Ue[t]} (click for report)`;try{let e=new Date(r).toLocaleTimeString();o=`Doctor · ${Ue[t]} · checked ${e} (click for report)`}catch{}return(0,H.jsxs)(`button`,{type:`button`,className:`doctor-chip doctor-chip--${t}`,title:o,"aria-label":a,onClick:()=>V({type:`OPEN_DOCTOR_MODAL`}),children:[(0,H.jsx)(`span`,{className:`doctor-chip__dot`,"aria-hidden":`true`,children:`●`}),(0,H.jsx)(`span`,{className:`doctor-chip__label`,children:i})]})}function Ge(){return(0,_.useSyncExternalStore)(B,()=>z().snapshot)}var Ke=`/api/update/status`,qe=`/api/update`,Je=`/api/update/dismiss`;function Ye(e,t=null){return e===`brew`?`brew update --quiet && brew upgrade cctally`:e===`npm`?`npm install -g cctally@${t??`latest`}`:null}function Xe(e){return!e||!e.includes(`-`)?null:`You're on prerelease ${e}; this banner suggests stable.\nTo track prereleases, manage manually: npm install -g cctally@next`}function Ze(e,t){if(!e||typeof e!=`object`)return null;let n=e;if(typeof n._error==`string`)return{current_version:null,latest_version:null,available:!1,method:`unknown`,update_command:null,release_notes_url:null,check_status:`unavailable`,checked_at_utc:null,prerelease_note:null};let r=typeof n.current_version==`string`?n.current_version:null,i=typeof n.latest_version==`string`?n.latest_version:null,a=n.install,o=a&&typeof a==`object`?a:{},s=typeof o.method==`string`?o.method:`unknown`,c=s===`brew`||s===`npm`?s:`unknown`,l=typeof n.check_status==`string`?n.check_status:null,u=l&&[`ok`,`rate_limited`,`fetch_failed`,`parse_failed`,`unavailable`].includes(l)?l:null,d=typeof n.checked_at_utc==`string`?n.checked_at_utc:null,f=typeof n.latest_version_url==`string`?n.latest_version_url:null;return{current_version:r,latest_version:i,available:$e(r,i,t),method:c,update_command:Ye(c,null),release_notes_url:f,check_status:u,checked_at_utc:d,prerelease_note:Xe(r)}}function Qe(e){if(!e||typeof e!=`object`)return{skipped_versions:[],remind_after:null};let t=e,n=Array.isArray(t.skipped_versions)?t.skipped_versions.filter(e=>typeof e==`string`):[],r=null;if(t.remind_after&&typeof t.remind_after==`object`){let e=t.remind_after;typeof e.version==`string`&&typeof e.until_utc==`string`&&(r={version:e.version,until_utc:e.until_utc})}return{skipped_versions:n,remind_after:r}}function $e(e,t,n){if(!e||!t||!et(t,e)||n.skipped_versions.includes(t))return!1;let r=n.remind_after;if(r&&r.version&&r.until_utc)try{if(!et(t,r.version)){let e=Date.parse(r.until_utc);if(Number.isFinite(e)&&Date.now()<e)return!1}}catch{}return!0}function et(e,t){let n=e=>{let[t,n=``]=e.split(`-`,2),r=t.split(`.`).map(e=>parseInt(e,10));for(;r.length<3;)r.push(0);return[r[0]||0,r[1]||0,r[2]||0,n]},[r,i,a,o]=n(e),[s,c,l,u]=n(t);return r===s?i===c?a===l?!o&&u?!0:o&&!u?!1:o>u:a>l:i>c:r>s}async function tt(){try{let e=await fetch(Ke);if(!e.ok)return;let t=await e.json(),n=Qe(t?.suppress),r=Ze(t?.state,n);V({type:`SET_UPDATE_STATE`,state:r,suppress:n}),z().update.status===`success`&&r?.current_version&&r.current_version===r.latest_version&&(V({type:`CLOSE_UPDATE_MODAL`}),V({type:`RESET_UPDATE_RUN`}))}catch{}}async function nt(e){V({type:`RESET_UPDATE_RUN`}),V({type:`SET_UPDATE_STATUS`,status:`running`,errorMessage:null}),V({type:`SET_UPDATE_RUN_ID`,runId:null,startedAt:Date.now()});try{let t=e?JSON.stringify({version:e}):`{}`,n=await fetch(qe,{method:`POST`,headers:{"Content-Type":`application/json`},body:t}),r=await n.json().catch(()=>({}));if(n.status===202&&typeof r.run_id==`string`){V({type:`SET_UPDATE_RUN_ID`,runId:r.run_id});return}if(n.status===409&&typeof r.run_id_in_progress==`string`){V({type:`SET_UPDATE_RUN_ID`,runId:r.run_id_in_progress});return}V({type:`SET_UPDATE_STATUS`,status:`failed`,errorMessage:typeof r.error==`string`?r.error:`failed to start update (HTTP ${n.status})`})}catch(e){V({type:`SET_UPDATE_STATUS`,status:`failed`,errorMessage:`network error: `+e.message})}}async function rt(e){if(e){try{if((await fetch(Je,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:`skip`,version:e})})).ok){let t=z().update;t.state&&V({type:`SET_UPDATE_STATE`,state:{...t.state,available:!1},suppress:{...t.suppress,skipped_versions:t.suppress.skipped_versions.includes(e)?t.suppress.skipped_versions:[...t.suppress.skipped_versions,e]}}),V({type:`CLOSE_UPDATE_MODAL`})}}catch{}await tt()}}async function it(e){try{if((await fetch(Je,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:`remind`,days:e})})).ok){let e=z().update;e.state&&V({type:`SET_UPDATE_STATE`,state:{...e.state,available:!1},suppress:e.suppress}),V({type:`CLOSE_UPDATE_MODAL`})}}catch{}await tt()}var at={refreshState:tt,start:nt,skip:rt,remind:it,open:()=>V({type:`OPEN_UPDATE_MODAL`}),close:()=>V({type:`CLOSE_UPDATE_MODAL`})},ot=null,st=!1,ct=new Set,lt=!0;function ut(){return st}function dt(e){return ct.add(e),()=>{ct.delete(e)}}function ft(){ct.forEach(e=>{try{e()}catch(e){console.error(`status subscriber error:`,e)}})}function pt(e={}){ot&&=(ot.close(),null),st=!1,lt=!0,ft(),Le(),(async()=>{try{let t=await(await fetch(`/api/data`)).json();Ie(t)&&(ht(t),gt(t),_t(t)),e.onConnect?.()}catch(e){console.error(`initial snapshot failed:`,e)}})(),ot=new EventSource(`/api/events`),ot.addEventListener(`update`,t=>{try{let n=JSON.parse(t.data);Ie(n)&&(ht(n),gt(n),_t(n)),st&&(st=!1,ft(),e.onConnect?.())}catch(e){console.error(`SSE parse failed:`,e)}}),ot.onerror=()=>{st||(st=!0,lt=!0,ft(),e.onDisconnect?.())}}var mt={enabled:!1,weekly_thresholds:[90,95],five_hour_thresholds:[90,95],budget_thresholds:[],budget_enabled:!1,projected_weekly_enabled:!1,projected_budget_enabled:!1,project_alerts_enabled:!1,codex_budget_configured:!1,codex_budget_alerts_enabled:!1,codex_projected_enabled:!1};function ht(e){V({type:`INGEST_SNAPSHOT_ALERTS`,alerts:e.alerts??[],alertsSettings:e.alerts_settings??mt,isFirstTick:lt}),lt=!1}function gt(e){if(!e.update)return;let t=Qe(e.update.suppress);V({type:`SET_UPDATE_STATE`,state:Ze(e.update.state,t),suppress:t})}function _t(e){e.doctor&&V({type:`SET_DOCTOR_AGGREGATE`,doctor:e.doctor})}function vt(){return{disconnected:(0,_.useSyncExternalStore)(dt,()=>ut())}}function yt(){let e=Ge(),{disconnected:t}=vt(),n=(0,_.useSyncExternalStore)(B,()=>z().syncErrorFloorUntil),r=(0,_.useSyncExternalStore)(B,()=>z().syncBusy),i=(0,_.useSyncExternalStore)(B,()=>z().syncSuccessFlashUntil),[a,o]=(0,_.useState)(`sync paused`),[s,c]=(0,_.useState)(``),l=(0,_.useRef)(0),[,u]=(0,_.useState)(0),[,d]=(0,_.useState)(0),f=Date.now(),p=f<n,m=f<i;return(0,_.useEffect)(()=>{if(!(p||m)){if(t){o(`disconnected`),c(`var(--accent-red)`);return}if(e){if(e.last_sync_error){o(`⚠ sync error`),c(`var(--accent-red)`);return}if(e.sync_age_s==null){o(`sync paused`),c(``),l.current=0;return}c(``),l.current=e.sync_age_s|0,o(`synced ${l.current}s ago`)}}},[e,t,p,m]),(0,_.useEffect)(()=>{let n=window.setInterval(()=>{t||Date.now()<z().syncErrorFloorUntil||!e||e.sync_age_s==null||e.last_sync_error||(l.current+=1,o(`synced ${l.current}s ago`))},1e3);return()=>window.clearInterval(n)},[e,t]),(0,_.useEffect)(()=>{if(!p)return;let e=n-Date.now();if(e<=0)return;let t=window.setTimeout(()=>u(e=>e+1),e);return()=>window.clearTimeout(t)},[n,p]),(0,_.useEffect)(()=>{if(!m)return;let e=i-Date.now();if(e<=0)return;let t=window.setTimeout(()=>d(e=>e+1),e);return()=>window.clearTimeout(t)},[i,m]),r?(0,H.jsx)(`span`,{className:`sync-chip mute syncing`,id:`sync-chip`,"aria-busy":`true`,"aria-live":`polite`,children:`syncing…`}):p?(0,H.jsx)(`span`,{className:`sync-chip mute sync-error`,id:`sync-chip`,"aria-live":`polite`,style:{color:`var(--accent-red)`},children:`⚠ sync failed`}):m?(0,H.jsx)(`span`,{className:`sync-chip mute sync-success`,id:`sync-chip`,"aria-live":`polite`,children:`✓ updated`}):(0,H.jsx)(`span`,{className:`sync-chip mute`,id:`sync-chip`,"aria-live":`polite`,style:{color:s},children:a})}function bt(){let e=(0,_.useSyncExternalStore)(B,()=>z().update).state;if(!e||!e.available||!e.latest_version)return null;let t=e.current_version??`?`,n=e.latest_version;return(0,H.jsxs)(`button`,{type:`button`,className:`badge-update`,title:`Update available · ${t} → ${n} · click to view`,"aria-label":`Update available, current version ${t}, latest ${n}`,onClick:()=>at.open(),children:[(0,H.jsx)(`span`,{className:`badge-update-arrow`,"aria-hidden":`true`,children:`↑`}),(0,H.jsxs)(`span`,{className:`badge-update-version`,children:[`v`,n]})]})}function xt(e){return e?.transcriptsEnabled===!0}function St(){let e=(0,_.useSyncExternalStore)(B,()=>z().view);return xt(Ge())?(0,H.jsxs)(`div`,{className:`view-switcher`,role:`tablist`,"aria-label":`Workspace`,children:[(0,H.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":e===`dashboard`,className:`view-seg${e===`dashboard`?` is-active`:``}`,onClick:()=>V({type:`SET_VIEW`,view:`dashboard`}),children:`Dashboard`}),(0,H.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":e===`conversations`,className:`view-seg${e===`conversations`?` is-active`:``}`,onClick:()=>V({type:`SET_VIEW`,view:`conversations`}),children:`Conversations`})]}):null}var Ct={capped:{label:`OVER`,cls:`over`,warn:!0,accent:`accent-red`,glyph:`⛔`},cap:{label:`WARN`,cls:`warn`,warn:!0,accent:`accent-amber`,glyph:`⚠`},ok:{label:`OK`,cls:`good`,warn:!1,accent:`accent-green`,glyph:`✓`}};function wt(e){return e==null?null:Ct[e]??null}var Tt=3e3,Et=1200,Dt=300;async function Ot(){if(z().syncBusy)return;let e=Date.now();V({type:`SET_SYNC_BUSY`,busy:!0});let t=!1;try{let e=await fetch(`/api/sync`,{method:`POST`,headers:{"Content-Type":`application/json`},body:`{}`});if(e.status===503)return;if(e.ok){if(e.status===200){let t=await e.json().catch(()=>({})),n=(Array.isArray(t.warnings)?t.warnings:[]).filter(e=>e?.code&&e.code!==`rate_limited`);if(n.length>0){console.error(`/api/sync warnings:`,n.map(e=>e.code).join(`, `)),V({type:`SET_SYNC_ERROR_FLOOR`,untilMs:Date.now()+Tt});return}}t=!0;return}console.error(`/api/sync failed: ${e.status}`),V({type:`SET_SYNC_ERROR_FLOOR`,untilMs:Date.now()+Tt})}catch(e){console.error(`/api/sync failed:`,e),V({type:`SET_SYNC_ERROR_FLOOR`,untilMs:Date.now()+Tt})}finally{let n=Date.now()-e;n<Dt&&await new Promise(e=>setTimeout(e,Dt-n)),t&&V({type:`SET_SYNC_SUCCESS_FLASH`,untilMs:Date.now()+Et}),V({type:`SET_SYNC_BUSY`,busy:!1})}}function kt(e){document.dispatchEvent(new KeyboardEvent(`keydown`,{key:e}))}function At(){let e=Ge()?.header,t=wt(e?.forecast_verdict??null),n=t?.warn??!1,r=(0,_.useSyncExternalStore)(B,()=>z().update).state?.current_version??null;return(0,H.jsxs)(`div`,{className:`topbar`,children:[(0,H.jsxs)(`div`,{className:`stat topbar-brand`,"data-mobile-keep":`primary`,"data-stat":`brand`,children:[(0,H.jsx)(`span`,{className:`brand-name`,children:`cctally`}),r?(0,H.jsxs)(`span`,{className:`brand-version`,children:[`v`,r]}):null,(0,H.jsx)(bt,{})]}),(0,H.jsx)(St,{}),(0,H.jsxs)(`div`,{className:`stat`,"data-mobile-keep":`primary`,"data-stat":`week`,children:[(0,H.jsx)(`svg`,{className:`icon`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#calendar`})}),(0,H.jsx)(`span`,{className:`k`,children:`Week`}),(0,H.jsx)(`span`,{className:`v`,children:e?.week_label??`—`})]}),(0,H.jsxs)(`div`,{className:`stat`,"data-mobile-keep":`primary`,"data-stat":`used`,children:[(0,H.jsx)(`span`,{className:`k`,children:`Used`}),(0,H.jsx)(`span`,{className:`hi-green`,children:A.pct1(e?.used_pct)}),(0,H.jsxs)(`span`,{className:`mute`,"data-mobile-keep":`secondary`,"data-stat":`five-hour`,children:[`(5h `,(0,H.jsx)(`span`,{children:A.pct0(e?.five_hour_pct)}),`)`]})]}),(0,H.jsxs)(`div`,{className:`stat`,"data-mobile-keep":`primary`,"data-stat":`dollar-per-pct`,children:[(0,H.jsx)(`span`,{className:`k`,children:`$/1%`}),(0,H.jsx)(`span`,{className:`hi-cyan`,children:A.usd2(e?.dollar_per_pct)})]}),(0,H.jsxs)(`div`,{className:`stat`,"data-mobile-keep":`primary`,"data-stat":`forecast`,children:[(0,H.jsx)(`span`,{className:`k`,children:`Fcst`}),(0,H.jsx)(`span`,{className:`hi-amber`,children:A.pct0(e?.forecast_pct)}),n?(0,H.jsx)(`span`,{className:`pill-warn`,children:t?.label??`WARN`}):null]}),(0,H.jsxs)(`div`,{className:`stat`,"data-mobile-keep":`secondary`,"data-stat":`vs-last-week`,children:[(0,H.jsx)(`svg`,{className:`icon`,style:{color:`var(--accent-green)`},children:(0,H.jsx)(`use`,{href:`/static/icons.svg#trending-up`})}),(0,H.jsx)(`span`,{className:`mute`,children:`vs last week`})]}),(0,H.jsxs)(`div`,{className:`topbar-actions`,children:[(0,H.jsx)(We,{}),(0,H.jsx)(He,{}),(0,H.jsx)(`button`,{type:`button`,className:`topbar-icon-btn topbar-settings`,"aria-label":`Open settings`,onClick:()=>kt(`s`),children:(0,H.jsx)(`svg`,{className:`icon`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#settings`})})}),(0,H.jsx)(`button`,{type:`button`,className:`topbar-icon-btn topbar-help`,"aria-label":`Open help`,onClick:()=>kt(`?`),children:(0,H.jsx)(`svg`,{className:`icon`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#help-circle`})})}),(0,H.jsxs)(`button`,{type:`button`,className:`topbar-sync`,onClick:()=>Ot(),title:`Sync now (r)`,"aria-label":`Sync now`,children:[(0,H.jsx)(`svg`,{className:`icon`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#refresh`})}),(0,H.jsx)(yt,{})]})]})]})}function jt(){let e=(z().snapshot?.sessions?.rows??[])[0]?.session_id;e&&V({type:`OPEN_MODAL`,kind:`session`,sessionId:e})}function Mt(){let e=z().snapshot?.blocks?.rows??[];e.length!==0&&V({type:`OPEN_MODAL`,kind:`block`,blockStartAt:(e.find(e=>e.is_active)??e[0]).start_at})}function Nt(e){let{searchMatches:t,searchIndex:n}=z();if(t.length===0)return;let r=t.length;V({type:`SET_SEARCH_MATCHES`,matches:t,index:((n<0?0:n)+e+r)%r})}var Pt=`Can't close this tab — use your browser to close it.`;function Ft(){try{window.close()}catch{}window.setTimeout(()=>{window.closed||V({type:`SHOW_STATUS_TOAST`,text:Pt})},100)}function It(){return(0,H.jsxs)(`div`,{className:`footer`,children:[(0,H.jsxs)(`span`,{className:`kb`,children:[(0,H.jsx)(`kbd`,{children:`↑/↓`}),` scroll`]}),(0,H.jsxs)(`span`,{className:`kb`,children:[(0,H.jsx)(`kbd`,{className:`accent-green`,children:`tab`}),` next panel`]}),(0,H.jsxs)(`button`,{className:`kb-btn`,id:`footer-r`,type:`button`,onClick:()=>Ot(),children:[(0,H.jsx)(`kbd`,{className:`accent-purple`,children:`r`}),` refresh`]}),(0,H.jsxs)(`button`,{className:`kb-btn`,id:`footer-s`,type:`button`,onClick:()=>document.dispatchEvent(new KeyboardEvent(`keydown`,{key:`s`})),children:[(0,H.jsx)(`kbd`,{children:`s`}),` settings`]}),(0,H.jsxs)(`button`,{className:`kb-btn`,id:`footer-help`,type:`button`,onClick:()=>document.dispatchEvent(new KeyboardEvent(`keydown`,{key:`?`})),children:[(0,H.jsx)(`kbd`,{className:`accent-amber`,children:`?`}),` help`]}),(0,H.jsxs)(`button`,{className:`kb-btn`,id:`footer-q`,type:`button`,onClick:()=>Ft(),children:[(0,H.jsx)(`kbd`,{children:`q`}),` quit`]})]})}var Lt=new Set,Rt=null,U={overlay:0,modal:1,sessions:2,global:3};function zt(e){return e===`modal`||e===`overlay`?`any`:`dashboard`}function Bt(e){if(!e||!(e instanceof Element))return!1;let t=e.tagName;if(t===`INPUT`||t===`TEXTAREA`)return!0;if(e instanceof HTMLElement){if(e.isContentEditable)return!0;let t=e.getAttribute(`contenteditable`);if(t===``||t===`true`||t===`plaintext-only`)return!0}return!1}function Vt(e){return e.forEach(e=>Lt.add(e)),()=>e.forEach(e=>Lt.delete(e))}function Ht(){Rt||(Rt=e=>{if(e.ctrlKey||e.metaKey||e.altKey||Bt(e.target)&&e.key.length===1)return;let t=z().view,n=[...Lt].sort((e,t)=>{let n=U[e.scope]-U[t.scope];return n===0?(t.layer??0)-(e.layer??0):n});for(let r of n){if(r.key!==e.key)continue;let n=r.view??zt(r.scope);if(!(n!==`any`&&n!==t)&&!(r.when&&!r.when())){r.action(),e.preventDefault();return}}},document.addEventListener(`keydown`,Rt))}function Ut(e){(0,_.useEffect)(()=>Vt(e),[e])}var Wt={tz:`local`,resolvedTz:`Etc/UTC`,offsetLabel:`UTC`,offsetSeconds:0,pinned:!1};function Gt(){let e=Ge();return e?.display?{tz:e.display.tz,resolvedTz:e.display.resolved_tz,offsetLabel:e.display.offset_label,offsetSeconds:e.display.offset_seconds,pinned:e.display.pinned??!1}:Wt}function Kt({percent:e,cells:t=30}){let n=Math.max(0,Math.min(t,Math.round((e??0)/100*t)));return(0,H.jsx)(`div`,{id:`cw-progress`,className:`progress`,children:Array.from({length:t},(e,t)=>(0,H.jsx)(`div`,{className:`cell`+(t<n?` on`:``)},t))})}function qt(){return(0,H.jsx)(`span`,{className:`panel-grip`,"aria-hidden":`true`,children:`⋮⋮`})}function Jt({panel:e,panelLabel:t,onClick:n,triggerId:r,dataTestId:i}){return(0,H.jsx)(`button`,{type:`button`,className:`share-icon`,"data-share-panel":e,"aria-label":`Share ${t} report`,onClick:e=>{e.stopPropagation(),n()},title:`Share (S)`,...r?{id:r}:{},...i?{"data-testid":i}:{},children:(0,H.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 14 14`,"aria-hidden":`true`,children:[(0,H.jsx)(`path`,{d:`M3 7h6m0 0L6.5 4.5M9 7L6.5 9.5`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,H.jsx)(`rect`,{x:`0.75`,y:`0.75`,width:`12.5`,height:`12.5`,rx:`1.5`,fill:`none`,stroke:`currentColor`,strokeWidth:`1`})]})})}function Yt(e){if(!e)return null;let t=new Date(e);if(isNaN(t.getTime()))return null;let n=e=>String(e).padStart(2,`0`);return`${n(t.getHours())}:${n(t.getMinutes())}:${n(t.getSeconds())}`}function Xt(e){if(e==null)return`text-dim`;let t=Math.abs(e);return t<=1?`delta-low`:t<=3?`delta-moderate`:t<=5?`delta-elevated`:`delta-high`}function Zt(e,t){if(!e||!t)return null;let n=new Date(e),r=new Date(t);return isNaN(n.getTime())||isNaN(r.getTime())?null:Math.floor((n.getTime()-r.getTime())/1e3)}function Qt(){let e=Ge(),t=Gt(),n={tz:t.resolvedTz,offsetLabel:t.offsetLabel},r=e?.current_week??null,i=r?.freshness??null,a=r?.five_hour_block??null,o=i!==null&&i.label!==`fresh`;return(0,H.jsxs)(`section`,{className:`panel accent-green`,id:`panel-current-week`,tabIndex:0,role:`region`,"aria-label":`Current Week panel`,"data-panel-kind":`current-week`,onClick:()=>V({type:`OPEN_MODAL`,kind:`current-week`}),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),V({type:`OPEN_MODAL`,kind:`current-week`}))},children:[(0,H.jsxs)(`div`,{className:`panel-header`,children:[(0,H.jsx)(`svg`,{className:`icon`,style:{color:`var(--accent-green)`},children:(0,H.jsx)(`use`,{href:`/static/icons.svg#trending-up`})}),(0,H.jsx)(`h3`,{style:{color:`var(--accent-green)`},children:`Current Week`}),o&&i&&(0,H.jsxs)(`span`,{className:i.label===`aging`?`chip chip-aging`:`chip chip-stale`,"data-freshness":i.label,title:`Captured ${i.captured_at}`,children:[`as of `,Yt(i.captured_at)??i.captured_at,` · `,i.age_seconds,`s ago`]}),(0,H.jsx)(Jt,{panel:`current-week`,panelLabel:`Current week`,triggerId:`current-week-panel`,onClick:()=>V(L(`current-week`,`current-week-panel`))}),(0,H.jsx)(qt,{})]}),(0,H.jsx)(`div`,{className:`panel-body`,children:(0,H.jsxs)(`div`,{className:`cw-body`,children:[(0,H.jsx)(`div`,{className:`cw-left`,children:(0,H.jsxs)(`div`,{className:`cw-big`,children:[(0,H.jsx)(`div`,{className:`label`,children:`Used (7d)`}),(0,H.jsx)(`div`,{className:`num`,children:A.pct1(r?.used_pct)}),(0,H.jsx)(Kt,{percent:r?.used_pct,cells:30}),(0,H.jsxs)(`div`,{className:`progress-scale`,children:[(0,H.jsx)(`span`,{children:`0%`}),(0,H.jsx)(`span`,{children:`50%`}),(0,H.jsx)(`span`,{children:`100%`})]})]})}),(0,H.jsxs)(`div`,{className:`cw-right`,children:[(0,H.jsxs)(`div`,{className:`cw-kv kv-spent`,children:[(0,H.jsx)(`svg`,{className:`icon`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#dollar`})}),(0,H.jsxs)(`div`,{className:`body`,children:[(0,H.jsxs)(`div`,{className:`row1`,children:[(0,H.jsx)(`span`,{className:`k`,children:`Spent`}),(0,H.jsx)(`span`,{className:`v magenta`,children:A.usd2(r?.spent_usd)})]}),(0,H.jsxs)(`div`,{className:`sub`,children:[(0,H.jsx)(`span`,{className:`mute`,children:`$/1%:`}),` `,(0,H.jsx)(`span`,{className:`magenta`,children:A.usd2(r?.dollar_per_pct)})]})]})]}),(0,H.jsxs)(`div`,{className:`cw-kv kv-reset`,children:[(0,H.jsx)(`svg`,{className:`icon`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#refresh`})}),(0,H.jsxs)(`div`,{className:`body`,children:[(0,H.jsxs)(`div`,{className:`row1`,children:[(0,H.jsx)(`span`,{className:`k`,children:`Reset`}),(0,H.jsx)(`span`,{className:`v amber`,children:A.datetimeShort(r?.reset_at_utc,n)})]}),(0,H.jsxs)(`div`,{className:`sub`,children:[`in `,(0,H.jsx)(`span`,{children:A.ddhh(r?.reset_in_sec)})]})]})]}),(0,H.jsxs)(`div`,{className:`cw-kv kv-five-hour`,children:[(0,H.jsx)(`svg`,{className:`icon`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#activity`})}),(0,H.jsxs)(`div`,{className:`body`,children:[(0,H.jsxs)(`div`,{className:`row1`,children:[(0,H.jsx)(`span`,{className:`k`,children:`5-hour`}),(0,H.jsx)(`span`,{className:`v cyan`,children:A.pct1(r?.five_hour_pct)}),a&&Array.isArray(a.credits)&&a.credits.length>0&&(0,H.jsxs)(`span`,{className:`sub credit-chip`,"data-credit-count":a.credits.length,children:[` `,`⚡ credited`,` `,a.credits.map((e,t)=>(0,H.jsxs)(`span`,{children:[t>0?`, `:``,e.delta_pp>0?`+`:``,e.delta_pp.toFixed(0),`pp`]},t))]})]}),a?(0,H.jsxs)(`div`,{className:`sub cw-delta-row ${Xt(a.seven_day_pct_delta_pp)}`,children:[a.crossed_seven_day_reset?`⚡ `:``,`Δ `,A.pp(a.seven_day_pct_delta_pp),` this block`]}):(0,H.jsxs)(`div`,{className:`sub`,children:[`resets in `,(0,H.jsx)(`span`,{children:A.hhmm(r?.five_hour_resets_in_sec)})]})]})]}),a&&(0,H.jsxs)(`div`,{className:`cw-kv kv-block`,children:[(0,H.jsx)(`svg`,{className:`icon`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#clock`})}),(0,H.jsxs)(`div`,{className:`body`,children:[(0,H.jsxs)(`div`,{className:`row1`,children:[(0,H.jsx)(`span`,{className:`k`,children:`Block`}),(0,H.jsx)(`span`,{className:`v`,children:Yt(a.block_start_at)??a.block_start_at})]}),(0,H.jsx)(`div`,{className:`sub`,children:(()=>{let t=Zt(e?.generated_at,a.block_start_at);return t==null?(0,H.jsxs)(H.Fragment,{children:[`started `,(0,H.jsx)(`span`,{children:`—`})]}):t<=0?(0,H.jsxs)(H.Fragment,{children:[`started `,(0,H.jsx)(`span`,{children:`just now`})]}):(0,H.jsxs)(H.Fragment,{children:[`started `,(0,H.jsx)(`span`,{children:A.elapsedHm(t)}),` ago`]})})()})]})]})]})]})}),(0,H.jsxs)(`div`,{className:`panel-foot cw-foot`,children:[(0,H.jsx)(`svg`,{className:`icon`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#clock`})}),`Last snapshot: `,(0,H.jsx)(`span`,{children:A.agoSec(r?.last_snapshot_age_sec)})]})]})}function $t({n:e}){let t=Math.max(0,Math.min(7,(e??0)|0));return(0,H.jsx)(`div`,{className:`dots`,id:`fc-dots`,children:Array.from({length:7},(e,n)=>(0,H.jsx)(`span`,{className:`d`+(n<t?` on`:``)},n))})}function en(){let e=Ge()?.forecast??null,t=wt(e?.verdict??null);return(0,H.jsxs)(`section`,{className:`panel accent-purple`,id:`panel-forecast`,tabIndex:0,role:`region`,"aria-label":`Forecast panel`,"data-panel-kind":`forecast`,onClick:()=>V({type:`OPEN_MODAL`,kind:`forecast`}),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),V({type:`OPEN_MODAL`,kind:`forecast`}))},children:[(0,H.jsxs)(`div`,{className:`panel-header`,children:[(0,H.jsx)(`svg`,{className:`icon`,style:{color:`var(--accent-pink)`},children:(0,H.jsx)(`use`,{href:`/static/icons.svg#crystal-ball`})}),(0,H.jsx)(`h3`,{style:{color:`var(--accent-pink)`},children:`Forecast`}),(0,H.jsx)(Jt,{panel:`forecast`,panelLabel:`Forecast`,triggerId:`forecast-panel`,onClick:()=>V(L(`forecast`,`forecast-panel`))}),(0,H.jsx)(qt,{})]}),(0,H.jsxs)(`div`,{className:`panel-body`,children:[(0,H.jsxs)(`div`,{id:`fc-banner`,className:`warn-banner`+(t?` `+t.cls:``),style:{display:t?``:`none`},children:[(0,H.jsx)(`svg`,{width:`20`,height:`20`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#warn-triangle`})}),(0,H.jsx)(`span`,{id:`fc-verdict-label`,children:t?.label??`—`})]}),(0,H.jsxs)(`div`,{className:`fc-row fc-wkavg`,children:[(0,H.jsxs)(`div`,{className:`left`,children:[(0,H.jsx)(`div`,{className:`icon-box`,children:(0,H.jsx)(`svg`,{className:`icon`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#trending-up`})})}),(0,H.jsx)(`span`,{children:`Week-avg projection`})]}),(0,H.jsxs)(`div`,{className:`right`,children:[(0,H.jsx)(`span`,{className:`num`,children:A.pct0(e?.week_avg_projection_pct)}),(0,H.jsx)(`span`,{className:`at`,children:`@ reset`})]})]}),(0,H.jsxs)(`div`,{className:`fc-row fc-24h`,children:[(0,H.jsxs)(`div`,{className:`left`,children:[(0,H.jsx)(`div`,{className:`icon-box`,children:(0,H.jsx)(`svg`,{className:`icon`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#flame`})})}),(0,H.jsx)(`span`,{children:`Recent-24h projection`})]}),(0,H.jsxs)(`div`,{className:`right`,children:[(0,H.jsx)(`span`,{className:`num`,children:A.pct0(e?.recent_24h_projection_pct)}),(0,H.jsx)(`span`,{className:`at`,children:`@ reset`})]})]}),(0,H.jsx)(`div`,{className:`fc-divider`}),(0,H.jsxs)(`div`,{className:`fc-row fc-budget-100`,children:[(0,H.jsxs)(`div`,{className:`left`,children:[(0,H.jsx)(`div`,{className:`icon-box`,children:(0,H.jsx)(`svg`,{className:`icon`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#dollar`})})}),(0,H.jsx)(`span`,{children:`Budget to stay ≤100%`})]}),(0,H.jsxs)(`div`,{className:`right`,children:[(0,H.jsx)(`span`,{className:`num`,children:A.usd2(e?.budget_100_per_day_usd)}),(0,H.jsx)(`span`,{className:`per`,children:`/day`})]})]}),(0,H.jsxs)(`div`,{className:`fc-row fc-budget-90`,children:[(0,H.jsxs)(`div`,{className:`left`,children:[(0,H.jsx)(`div`,{className:`icon-box`,children:(0,H.jsx)(`svg`,{className:`icon`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#dollar`})})}),(0,H.jsx)(`span`,{children:`Budget to stay ≤90%`})]}),(0,H.jsxs)(`div`,{className:`right`,children:[(0,H.jsx)(`span`,{className:`num`,children:A.usd2(e?.budget_90_per_day_usd)}),(0,H.jsx)(`span`,{className:`per`,children:`/day`})]})]})]}),(0,H.jsxs)(`div`,{className:`panel-foot fc-conf`,children:[(0,H.jsxs)(`div`,{className:`lbl`,children:[(0,H.jsx)(`svg`,{className:`icon`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#clock`})}),`Confidence:`,(0,H.jsx)(`span`,{className:`val`,children:e?.confidence??`—`})]}),(0,H.jsx)($t,{n:e?.confidence_score})]})]})}function tn({data:e}){let t=e.map(e=>e.spark_height??0),n=Math.max(1,...t);return(0,H.jsx)(H.Fragment,{children:t.map((r,i)=>{let a=i===t.length-1,o={height:`${Math.max(6,r/n*100)}%`};return a&&(o.background=`color-mix(in srgb, var(--accent-purple) 70%, white 30%)`),(0,H.jsx)(`div`,{className:`bar`,style:o},e[i].label+`|`+i)})})}function nn(e,t){return!e||!t?``:t===`asc`?`▲`:`▼`}function rn(e,t){return!e||!t?`none`:t===`asc`?`ascending`:`descending`}function an({columns:e,override:t,onChange:n,accentVar:r}){let i=e=>n(I(t,e)),a=e=>t=>{t.stopPropagation(),i(e)},o=e=>t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),t.stopPropagation(),i(e))};return(0,H.jsx)(`thead`,{children:(0,H.jsx)(`tr`,{children:e.map(e=>{let n=t?.column===e.id,i=n?t.direction:null,s=[`th-sortable`,e.className??``,e.numeric?`num`:``,n?`is-sorted`:``].filter(Boolean).join(` `),c=r&&n?{"--th-accent":`var(${r})`}:void 0;return(0,H.jsx)(`th`,{className:s,role:`columnheader`,"aria-sort":rn(n,i),tabIndex:0,"data-col":e.id,style:c,onClick:a(e),onKeyDown:o(e),children:(0,H.jsxs)(`button`,{type:`button`,className:`th-sort-btn`,tabIndex:-1,children:[(0,H.jsx)(`span`,{className:`th-label`,children:e.label}),(0,H.jsx)(`span`,{className:`th-caret`,"aria-hidden":`true`,children:nn(n,i)})]})},e.id)})})})}var on=[{id:`week`,label:`Week`,defaultDirection:`desc`,compare:(e,t)=>e._chronoIdx-t._chronoIdx,className:`c-week`},{id:`used_pct`,label:`Used%`,defaultDirection:`desc`,numeric:!0,compare:(e,t)=>(e.used_pct??0)-(t.used_pct??0),className:`c-used`},{id:`dollar_per_pct`,label:`$/1%`,defaultDirection:`desc`,numeric:!0,compare:(e,t)=>(e.dollar_per_pct??0)-(t.dollar_per_pct??0),className:`c-dollar`},{id:`delta`,label:`Δ (vs prior)`,defaultDirection:`desc`,numeric:!0,compare:(e,t)=>(e.delta??0)-(t.delta??0),className:`c-delta`}];function sn(){let e=ne(Ge()),t=(0,_.useSyncExternalStore)(B,()=>z().prefs.trendSortOverride),n=e.map((e,t)=>({...e,_chronoIdx:t})),r=t?ce(n,on,t):n;return(0,H.jsxs)(`section`,{className:`panel accent-amber`,id:`panel-trend`,tabIndex:0,role:`region`,"aria-label":`$/1% Trend panel`,"data-panel-kind":`trend`,onClick:()=>V({type:`OPEN_MODAL`,kind:`trend`}),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),V({type:`OPEN_MODAL`,kind:`trend`}))},children:[(0,H.jsxs)(`div`,{className:`panel-header`,children:[(0,H.jsx)(`svg`,{className:`icon`,style:{color:`var(--accent-amber)`},children:(0,H.jsx)(`use`,{href:`/static/icons.svg#bar-chart`})}),(0,H.jsxs)(`h3`,{style:{color:`var(--accent-amber)`},children:[`$/1% Trend `,(0,H.jsx)(`span`,{className:`sub`,children:`(8 weeks)`})]}),(0,H.jsx)(Jt,{panel:`trend`,panelLabel:`Trend`,triggerId:`trend-panel`,onClick:()=>V(L(`trend`,`trend-panel`))}),(0,H.jsx)(qt,{})]}),(0,H.jsxs)(`div`,{className:`panel-body`,children:[(0,H.jsxs)(`table`,{className:`trend-table`,children:[(0,H.jsx)(an,{columns:on,override:t,onChange:e=>V({type:`SET_TABLE_SORT`,table:`trend`,override:e}),accentVar:`--accent-amber`}),(0,H.jsx)(`tbody`,{id:`trend-rows`,children:r.map(e=>(0,H.jsxs)(`tr`,{className:e.is_current?`current`:void 0,children:[(0,H.jsx)(`td`,{children:e.label}),(0,H.jsx)(`td`,{className:`num`,children:A.pct0(e.used_pct)}),(0,H.jsx)(`td`,{className:`num`+(e.is_current?``:` dollar`),children:A.usd2(e.dollar_per_pct)}),(0,H.jsx)(`td`,{className:`num `+A.deltaCls(e.delta,e.is_current),children:A.delta(e.delta)})]},e.label))})]}),(0,H.jsx)(`div`,{className:`trend-spark-title`,children:`$/1% trend:`}),(0,H.jsx)(`div`,{className:`trend-spark`,id:`trend-spark`,children:(0,H.jsx)(tn,{data:e})}),(0,H.jsxs)(`div`,{className:`trend-spark-legend`,children:[(0,H.jsx)(`span`,{children:`older`}),(0,H.jsx)(`span`,{className:`line`}),(0,H.jsx)(`span`,{children:`▶ newer`})]})]})]})}var cn=`(max-width: 640px)`;function ln(){let[e,t]=(0,_.useState)(()=>typeof window>`u`||!window.matchMedia?!1:window.matchMedia(cn).matches);return(0,_.useEffect)(()=>{if(typeof window>`u`||!window.matchMedia)return;let e=window.matchMedia(cn),n=e=>{t(e.matches)};return e.addEventListener(`change`,n),t(e.matches),()=>{e.removeEventListener(`change`,n)}},[]),e}function un(e){let t=De.findIndex(t=>t.key===e);return De[(t===-1?0:t+1)%De.length].key}function dn(){let e=(0,_.useSyncExternalStore)(B,()=>z().filterText),t=(0,_.useSyncExternalStore)(B,()=>z().searchText),n=(0,_.useSyncExternalStore)(B,()=>z().searchMatches),r=(0,_.useSyncExternalStore)(B,()=>z().searchIndex),i=(0,_.useSyncExternalStore)(B,()=>z().sessionsSort),a=(0,_.useSyncExternalStore)(B,()=>z().prefs.sessionsSortOverride),o=ln(),[s,c]=(0,_.useState)(!1),[l,u]=(0,_.useState)(!1),d=(0,_.useRef)(null),f=(0,_.useRef)(null),p=l||o,m=l||t.length>0,h=()=>c(!0),g=e=>{e?.clear&&V({type:`SET_FILTER`,text:``}),c(!1),V({type:`SET_INPUT_MODE`,mode:null})},v=()=>u(!0),y=e=>{e?.clear&&V({type:`SET_SEARCH`,text:``}),u(!1),V({type:`SET_INPUT_MODE`,mode:null})};(0,_.useEffect)(()=>{s&&(d.current?.focus(),d.current?.select(),V({type:`SET_INPUT_MODE`,mode:`filter`}))},[s]),(0,_.useEffect)(()=>{l&&(f.current?.focus(),f.current?.select(),V({type:`SET_INPUT_MODE`,mode:`search`}))},[l]),Ut([{key:`f`,scope:`sessions`,action:h,when:()=>!z().openModal&&!s},{key:`/`,scope:`sessions`,action:v,when:()=>!z().openModal&&!l}]);let b=n.length,x=b>0?`${r+1} / ${b}`:`0 / 0`,S=e=>{b!==0&&V({type:`SET_SEARCH_MATCHES`,matches:n,index:((r+e)%b+b)%b})};return(0,H.jsxs)(`div`,{className:`sessions-ctrls`,id:`sessions-ctrls`,children:[s?(0,H.jsx)(`input`,{type:`search`,className:`ctrl-input`,id:`filter-input`,placeholder:`filter project|model…`,ref:d,value:e,onChange:e=>V({type:`SET_FILTER`,text:e.target.value}),onKeyDown:e=>{e.key===`Enter`?g():e.key===`Escape`&&g({clear:!0})},onBlur:()=>g()}):e?(0,H.jsxs)(`button`,{className:`ctrl-btn as-chip`,id:`filter-btn`,type:`button`,"aria-label":`Filter: ${e}. Press Esc to clear.`,onClick:e=>{if(e.target.classList.contains(`chip-x`)){V({type:`SET_FILTER`,text:``});return}h()},children:[(0,H.jsxs)(`span`,{className:`chip`,children:[`filter: `,e]}),(0,H.jsx)(`span`,{className:`chip-x`,title:`Clear`,children:`×`})]}):(0,H.jsx)(`button`,{className:`ctrl-btn`,id:`filter-btn`,type:`button`,title:`Filter (f)`,onClick:h,children:(0,H.jsx)(`svg`,{className:`icon`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#funnel`})})}),p?(0,H.jsxs)(`div`,{className:`search-container`,id:`search-container`,children:[(0,H.jsx)(`input`,{type:`search`,className:`ctrl-input`,id:`search-input`,placeholder:`search…`,ref:f,value:t,onChange:e=>V({type:`SET_SEARCH`,text:e.target.value}),onFocus:()=>{l||u(!0)},onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),S(1)):e.key===`Escape`&&y({clear:!0})},onBlur:()=>y()}),m&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{className:`match-count`,id:`search-count`,children:x}),(0,H.jsx)(`button`,{className:`ctrl-btn`,id:`search-prev`,type:`button`,title:`Prev (N)`,onMouseDown:e=>e.preventDefault(),onClick:()=>S(-1),children:`↑`}),(0,H.jsx)(`button`,{className:`ctrl-btn`,id:`search-next`,type:`button`,title:`Next (n)`,onMouseDown:e=>e.preventDefault(),onClick:()=>S(1),children:`↓`})]})]}):(0,H.jsx)(`button`,{className:`ctrl-btn`,id:`search-btn`,type:`button`,title:`Search (/)`,onClick:v,children:(0,H.jsx)(`svg`,{className:`icon`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#magnifier`})})}),(0,H.jsxs)(`button`,{className:`ctrl-btn`,id:`sort-pill`,type:`button`,title:`Cycle sort`,onClick:()=>{z().prefs.sessionsSortOverride&&V({type:`SET_TABLE_SORT`,table:`sessions`,override:null}),V({type:`SET_SORT`,key:un(i)})},children:[(0,H.jsx)(`svg`,{className:`icon`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#sort-updown`})}),(0,H.jsxs)(`span`,{className:`label`,children:[`sort: `,a?`${a.column} ${a.direction}`:i]})]})]})}function fn(e){return e?e.includes(`opus`)?`opus`:e.includes(`haiku`)?`haiku`:`sonnet`:`sonnet`}function pn(e){return e==null?`cost-low`:e<.25?`cost-xs`:e<1?`cost-low`:e<3?`cost-mid`:`cost-high`}function mn(){let e=Ge(),t=Gt(),n={tz:t.resolvedTz,offsetLabel:t.offsetLabel},r=(0,_.useMemo)(()=>ue.map(e=>e.id===`started`?{...e,label:`Started (${t.offsetLabel})`}:e),[t.offsetLabel]);(0,_.useSyncExternalStore)(B,()=>z().filterText),(0,_.useSyncExternalStore)(B,()=>z().sessionsSort),(0,_.useSyncExternalStore)(B,()=>z().prefs.sessionsPerPage);let i=(0,_.useSyncExternalStore)(B,()=>z().searchMatches),a=(0,_.useSyncExternalStore)(B,()=>z().searchIndex),o=(0,_.useSyncExternalStore)(B,()=>z().prefs.sessionsCollapsed),s=(0,_.useSyncExternalStore)(B,()=>z().prefs.sessionsSortOverride),c=ln(),l=e?.sessions?.total??0,u=xt(e),d=Pe(),f=new Set(i.map(e=>d[e]?.session_id).filter(e=>!!e));return(0,_.useEffect)(()=>{if(a<0)return;let e=d[i[a]]?.session_id;e&&document.querySelector(`[data-session-id="${CSS.escape(e)}"]`)?.scrollIntoView({block:`nearest`})},[a,i,d]),(0,H.jsxs)(`section`,{className:`panel accent-orange`+(o?` sessions-collapsed`:``),id:`panel-sessions`,tabIndex:0,role:`region`,"aria-label":`Recent Sessions panel`,"data-panel-kind":`sessions`,onKeyDown:e=>{e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),V({type:`OPEN_MODAL`,kind:`session`}))},children:[(0,H.jsxs)(`div`,{className:`panel-header`,style:{justifyContent:`space-between`},children:[(0,H.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`10px`},children:[(0,H.jsx)(`svg`,{className:`icon`,style:{color:`var(--accent-orange)`},children:(0,H.jsx)(`use`,{href:`/static/icons.svg#clock`})}),(0,H.jsxs)(`h3`,{style:{color:`var(--accent-orange)`},children:[`Recent Sessions `,(0,H.jsxs)(`span`,{className:`sub`,children:[`(`,l,` total)`]})]})]}),(0,H.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`8px`},children:[!c&&(0,H.jsx)(dn,{}),(0,H.jsx)(Jt,{panel:`sessions`,panelLabel:`Sessions`,triggerId:`sessions-panel`,onClick:()=>V(L(`sessions`,`sessions-panel`))}),(0,H.jsx)(`button`,{type:`button`,className:`panel-collapse-toggle`,"aria-expanded":!o,"aria-controls":`panel-sessions-body`,"aria-label":o?`Expand Recent Sessions`:`Collapse Recent Sessions`,title:o?`Expand (c)`:`Collapse (c)`,onClick:e=>{e.stopPropagation(),V({type:`SAVE_PREFS`,patch:{sessionsCollapsed:!o}})},children:(0,H.jsx)(`svg`,{className:`icon`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#${o?`chevron-down`:`chevron-up`}`})})}),(0,H.jsx)(qt,{})]})]}),c&&(0,H.jsx)(dn,{}),(0,H.jsx)(`div`,{className:`panel-body`,id:`panel-sessions-body`,children:(0,H.jsxs)(`table`,{className:`sess-table`,children:[(0,H.jsx)(an,{columns:r,override:s,onChange:e=>V({type:`SET_TABLE_SORT`,table:`sessions`,override:e})}),(0,H.jsx)(`tbody`,{id:`sess-rows`,children:d.map(e=>{let t=e.session_id?f.has(e.session_id):!1,r=fn(e.model),i=pn(e.cost_usd??null),a=e.model?`Filter by ${e.model}`:`Filter by model`;return(0,H.jsxs)(`tr`,{className:`session-row`+(t?` search-match`:``),"data-session-id":e.session_id,onClick:()=>e.session_id&&V({type:`OPEN_MODAL`,kind:`session`,sessionId:e.session_id}),children:[(0,H.jsxs)(`td`,{className:`started`,children:[u&&e.session_id&&(0,H.jsx)(`button`,{type:`button`,className:`sess-open-conv`,title:`Open conversation`,"aria-label":`Open conversation`,onClick:t=>{t.stopPropagation(),V({type:`OPEN_CONVERSATION`,sessionId:e.session_id})},children:(0,H.jsx)(`svg`,{className:`icon`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#file-text`})})}),A.startedShort(e.started_utc,n,{noSuffix:!0})]}),(0,H.jsxs)(`td`,{children:[e.duration_min,`m`]}),(0,H.jsx)(`td`,{onClick:e=>e.stopPropagation(),children:(0,H.jsx)(`span`,{className:`chip model-chip ${r}`,role:`button`,tabIndex:-1,"aria-label":a,onClick:()=>V({type:`SET_FILTER`,text:e.model}),children:e.model})}),(0,H.jsx)(`td`,{className:`project`,children:e.project_key&&e.project_key!==`(unknown)`?(0,H.jsx)(`button`,{type:`button`,className:`project-cell-link`,"aria-label":`Open Projects modal for ${e.project_key}`,onClick:t=>{t.stopPropagation(),V({type:`OPEN_MODAL`,kind:`projects`,projectKey:e.project_key??void 0})},children:e.project}):(0,H.jsx)(`span`,{title:`Project still resolving`,children:e.project})}),(0,H.jsx)(`td`,{className:`num ${i}`,children:A.usd2(e.cost_usd)})]},e.session_id||`${e.started_utc}-${e.model}`)})})]})})]})}var hn=5;function gn(){let e=Ge(),t=e?.projects?.current_week?.rows??[],n=e?.projects==null,r=(0,H.jsxs)(`div`,{className:`panel-header`,style:{justifyContent:`space-between`},children:[(0,H.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`10px`},children:[(0,H.jsx)(`svg`,{className:`icon`,style:{color:`var(--accent-magenta)`},children:(0,H.jsx)(`use`,{href:`/static/icons.svg#folder`})}),(0,H.jsxs)(`h3`,{style:{color:`var(--accent-magenta)`},children:[`Projects`,` `,(0,H.jsx)(`span`,{className:`sub`,children:n?`(unavailable)`:`(${t.length} this week)`})]})]}),(0,H.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`8px`},children:[(0,H.jsx)(Jt,{panel:`projects`,panelLabel:`Projects`,triggerId:`projects-panel`,onClick:()=>V(L(`projects`,`projects-panel`))}),(0,H.jsx)(qt,{})]})]});if(n)return(0,H.jsxs)(`section`,{className:`panel accent-magenta`,id:`panel-projects`,"data-panel-kind":`projects`,role:`region`,"aria-label":`Projects panel`,tabIndex:0,children:[r,(0,H.jsx)(`div`,{className:`panel-body projects-body`,children:(0,H.jsx)(`div`,{className:`panel-empty`,children:`Projects data unavailable — restart the dashboard.`})})]});let i=t.slice(0,hn),a=t.slice(hn),o=a.reduce((e,t)=>e+t.cost_usd,0),s=a.reduce((e,t)=>e+(t.attributed_pct??0),0),c=i[0]?.cost_usd||1,l=()=>V({type:`OPEN_MODAL`,kind:`projects`}),u=e=>t=>{t.stopPropagation(),V({type:`OPEN_MODAL`,kind:`projects`,projectKey:e})};return(0,H.jsxs)(`section`,{className:`panel accent-magenta`,id:`panel-projects`,"data-panel-kind":`projects`,role:`region`,"aria-label":`Projects panel`,tabIndex:0,onClick:l,onKeyDown:e=>{e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),l())},children:[r,(0,H.jsx)(`div`,{className:`panel-body projects-body`,children:t.length===0?(0,H.jsx)(`div`,{className:`panel-empty`,children:`No project activity yet this week.`}):(0,H.jsxs)(H.Fragment,{children:[i.map(e=>{let t={"--w":`${e.cost_usd/c*100}%`};return(0,H.jsxs)(`div`,{className:`projects-row`,role:`button`,tabIndex:0,"aria-label":`Open Projects modal for ${e.key}`,onClick:u(e.key),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),t.stopPropagation(),V({type:`OPEN_MODAL`,kind:`projects`,projectKey:e.key}))},title:e.key,children:[(0,H.jsx)(`span`,{className:`name`,children:e.key}),(0,H.jsx)(`div`,{className:`lb-bar`,style:t}),(0,H.jsx)(`span`,{className:`cost`,children:A.usd2(e.cost_usd)}),(0,H.jsx)(`span`,{className:`pct`,children:e.attributed_pct==null?`—`:A.pct0(e.attributed_pct)})]},e.key)}),a.length>0&&(0,H.jsxs)(`div`,{className:`projects-row tail`,"aria-label":`${a.length} more projects`,children:[(0,H.jsxs)(`span`,{className:`name muted`,children:[`+`,a.length,` more`]}),(0,H.jsx)(`div`,{className:`lb-bar muted`,style:{"--w":`${o/c*100}%`}}),(0,H.jsx)(`span`,{className:`cost muted`,children:A.usd2(o)}),(0,H.jsx)(`span`,{className:`pct muted`,children:s===0?`—`:A.pct0(s)})]})]})})]})}var _n=8;function vn({r:e,isFirstMount:t}){let n=e.delta_cost_pct==null?`flat`:e.delta_cost_pct>0?`up`:e.delta_cost_pct<0?`down`:`flat`;return(0,H.jsxs)(`div`,{className:`period`,children:[(0,H.jsxs)(`div`,{className:`meta`,children:[(0,H.jsxs)(`span`,{className:`label`,children:[e.label,e.is_current&&(0,H.jsx)(`span`,{className:`pill-current`,children:`Now`})]}),(0,H.jsxs)(`span`,{className:`right`,children:[(0,H.jsx)(`span`,{className:`cost`,children:A.usd2(e.cost_usd)}),(0,H.jsx)(`span`,{className:`delta ${n}`,children:A.deltaPct(e.delta_cost_pct)})]})]}),(0,H.jsx)(`div`,{className:`model-stack`,role:`presentation`,children:e.models.map(e=>(0,H.jsx)(`span`,{className:e.chip,style:{width:t?`0%`:`${e.cost_pct}%`},title:`${e.display} ${A.usd2(e.cost_usd)} (${e.cost_pct.toFixed(0)}%)`},e.model))})]})}function yn(){let e=Ge(),t=(e?.weekly?.rows??[]).slice(0,_n),n=e?.weekly?.total_cost_usd??0,r=(0,_.useRef)(new Set),[,i]=(0,_.useState)(0);return(0,_.useLayoutEffect)(()=>{let e=t.filter(e=>!r.current.has(e.label));if(e.length===0)return;e.forEach(e=>r.current.add(e.label));let n=requestAnimationFrame(()=>i(e=>e+1));return()=>cancelAnimationFrame(n)},[t]),(0,H.jsxs)(`section`,{className:`panel accent-cyan`,id:`panel-weekly`,tabIndex:0,role:`region`,"aria-label":`Weekly usage panel`,"data-panel-kind":`weekly`,onClick:()=>V({type:`OPEN_MODAL`,kind:`weekly`}),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),V({type:`OPEN_MODAL`,kind:`weekly`}))},children:[(0,H.jsxs)(`div`,{className:`panel-header`,children:[(0,H.jsx)(`svg`,{className:`icon`,style:{color:`var(--accent-cyan)`},children:(0,H.jsx)(`use`,{href:`/static/icons.svg#bar-chart`})}),(0,H.jsxs)(`h3`,{style:{color:`var(--accent-cyan)`},children:[`Weekly `,(0,H.jsx)(`span`,{className:`sub`,children:`(model split · 8 weeks)`})]}),(0,H.jsx)(Jt,{panel:`weekly`,panelLabel:`Weekly`,triggerId:`weekly-panel`,onClick:()=>V(L(`weekly`,`weekly-panel`))}),(0,H.jsx)(qt,{})]}),(0,H.jsx)(`div`,{className:`panel-body`,children:t.length===0?(0,H.jsx)(`div`,{className:`panel-empty`,children:`No usage history yet.`}):t.map(e=>(0,H.jsx)(vn,{r:e,isFirstMount:!r.current.has(e.label)},e.label))}),t.length>0&&(0,H.jsx)(`div`,{className:`panel-foot period-foot`,children:(0,H.jsxs)(`span`,{children:[t.length,`w total`,(0,H.jsx)(`span`,{className:`sep`,"aria-hidden":`true`,children:` · `}),(0,H.jsx)(`span`,{className:`total`,children:A.usd2(n)})]})})]})}var bn=6;function xn({r:e,isFirstMount:t}){let n=e.delta_cost_pct==null?`flat`:e.delta_cost_pct>0?`up`:e.delta_cost_pct<0?`down`:`flat`;return(0,H.jsxs)(`div`,{className:`period`,children:[(0,H.jsxs)(`div`,{className:`meta`,children:[(0,H.jsxs)(`span`,{className:`label`,children:[e.label,e.is_current&&(0,H.jsx)(`span`,{className:`pill-current`,children:`Now`})]}),(0,H.jsxs)(`span`,{className:`right`,children:[(0,H.jsx)(`span`,{className:`cost`,children:A.usd2(e.cost_usd)}),(0,H.jsx)(`span`,{className:`delta ${n}`,children:A.deltaPct(e.delta_cost_pct)})]})]}),(0,H.jsx)(`div`,{className:`model-stack`,role:`presentation`,children:e.models.map(e=>(0,H.jsx)(`span`,{className:e.chip,style:{width:t?`0%`:`${e.cost_pct}%`},title:`${e.display} ${A.usd2(e.cost_usd)} (${e.cost_pct.toFixed(0)}%)`},e.model))})]})}function Sn(){let e=Ge(),t=(e?.monthly?.rows??[]).slice(0,bn),n=e?.monthly?.total_cost_usd??0,r=(0,_.useRef)(new Set),[,i]=(0,_.useState)(0);return(0,_.useLayoutEffect)(()=>{let e=t.filter(e=>!r.current.has(e.label));if(e.length===0)return;e.forEach(e=>r.current.add(e.label));let n=requestAnimationFrame(()=>i(e=>e+1));return()=>cancelAnimationFrame(n)},[t]),(0,H.jsxs)(`section`,{className:`panel accent-pink`,id:`panel-monthly`,tabIndex:0,role:`region`,"aria-label":`Monthly usage panel`,"data-panel-kind":`monthly`,onClick:()=>V({type:`OPEN_MODAL`,kind:`monthly`}),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),V({type:`OPEN_MODAL`,kind:`monthly`}))},children:[(0,H.jsxs)(`div`,{className:`panel-header`,children:[(0,H.jsx)(`svg`,{className:`icon`,style:{color:`var(--accent-pink)`},children:(0,H.jsx)(`use`,{href:`/static/icons.svg#calendar`})}),(0,H.jsxs)(`h3`,{style:{color:`var(--accent-pink)`},children:[`Monthly `,(0,H.jsx)(`span`,{className:`sub`,children:`(model split · 6 months)`})]}),(0,H.jsx)(Jt,{panel:`monthly`,panelLabel:`Monthly`,triggerId:`monthly-panel`,onClick:()=>V(L(`monthly`,`monthly-panel`))}),(0,H.jsx)(qt,{})]}),(0,H.jsx)(`div`,{className:`panel-body`,children:t.length===0?(0,H.jsx)(`div`,{className:`panel-empty`,children:`No usage history yet.`}):t.map(e=>(0,H.jsx)(xn,{r:e,isFirstMount:!r.current.has(e.label)},e.label))}),t.length>0&&(0,H.jsx)(`div`,{className:`panel-foot period-foot`,children:(0,H.jsxs)(`span`,{children:[t.length,`mo total`,(0,H.jsx)(`span`,{className:`sep`,"aria-hidden":`true`,children:` · `}),(0,H.jsx)(`span`,{className:`total`,children:A.usd2(n)})]})})]})}function Cn({r:e,maxCost:t,isFirstMount:n}){let r=t>0?e.cost_usd/t*100:0,i=()=>V({type:`OPEN_MODAL`,kind:`block`,blockStartAt:e.start_at});return(0,H.jsxs)(`div`,{className:`blocks-row`,role:`button`,tabIndex:0,"aria-label":`Open detail for block starting ${e.label}`,onClick:i,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),i())},children:[(0,H.jsxs)(`div`,{className:`meta`,children:[(0,H.jsxs)(`span`,{className:`label`,children:[e.anchor===`heuristic`&&(0,H.jsx)(`span`,{className:`anchor-marker`,"aria-label":`approximate start`,children:`~`}),e.label,e.is_active&&(0,H.jsx)(`span`,{className:`pill-active`,children:`Active`})]}),(0,H.jsx)(`span`,{className:`cost`,children:A.usd2(e.cost_usd)})]}),(0,H.jsx)(`div`,{className:`gauge-track`,children:(0,H.jsx)(`div`,{className:`gauge-fill`,style:{width:n?`0%`:`${r}%`},children:e.models.map(e=>(0,H.jsx)(`span`,{className:`seg-${e.chip}`,style:{width:`${e.cost_pct}%`},title:`${e.display} ${A.usd2(e.cost_usd)} (${e.cost_pct.toFixed(0)}%)`},e.model))})})]})}function wn(){let e=Ge(),t=(0,_.useSyncExternalStore)(B,()=>z().prefs.blocksCollapsed),n=e?.blocks?.rows??[],r=n.length>0?Math.max(...n.map(e=>e.cost_usd),0):0,i=e?.blocks?.total_cost_usd??0,a=n.some(e=>e.anchor===`heuristic`),o=(0,_.useRef)(new Set),[,s]=(0,_.useState)(0);return(0,_.useLayoutEffect)(()=>{let e=n.filter(e=>!o.current.has(e.start_at));if(e.length===0)return;e.forEach(e=>o.current.add(e.start_at));let t=requestAnimationFrame(()=>s(e=>e+1));return()=>cancelAnimationFrame(t)},[n]),(0,H.jsxs)(`section`,{className:`panel accent-blue`+(t?` blocks-collapsed`:``),id:`panel-blocks`,tabIndex:0,role:`region`,"aria-label":`Blocks panel`,"data-panel-kind":`blocks`,children:[(0,H.jsxs)(`div`,{className:`panel-header`,style:{justifyContent:`space-between`},children:[(0,H.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`10px`},children:[(0,H.jsx)(`svg`,{className:`icon`,style:{color:`var(--accent-blue)`},children:(0,H.jsx)(`use`,{href:`/static/icons.svg#layers`})}),(0,H.jsxs)(`h3`,{style:{color:`var(--accent-blue)`},children:[`Blocks `,(0,H.jsx)(`span`,{className:`sub`,children:`(5h · current week)`})]})]}),(0,H.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`4px`},children:[(0,H.jsx)(Jt,{panel:`blocks`,panelLabel:`5-hour blocks`,triggerId:`blocks-panel`,onClick:()=>V(L(`blocks`,`blocks-panel`))}),(0,H.jsx)(`button`,{type:`button`,className:`panel-collapse-toggle`,"aria-expanded":!t,"aria-controls":`panel-blocks-body`,"aria-label":t?`Expand Blocks`:`Collapse Blocks`,title:t?`Expand`:`Collapse`,onClick:e=>{e.stopPropagation(),V({type:`SAVE_PREFS`,patch:{blocksCollapsed:!t}})},children:(0,H.jsx)(`svg`,{className:`icon`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#${t?`chevron-down`:`chevron-up`}`})})}),(0,H.jsx)(qt,{})]})]}),(0,H.jsx)(`div`,{className:`panel-body`,id:`panel-blocks-body`,children:n.length===0?(0,H.jsx)(`div`,{className:`panel-empty`,children:`No activity blocks this week yet.`}):n.map(e=>(0,H.jsx)(Cn,{r:e,maxCost:r,isFirstMount:!o.current.has(e.start_at)},e.start_at))}),n.length>0&&(0,H.jsx)(`div`,{className:`panel-foot`,children:(0,H.jsxs)(`span`,{children:[n.length,` blocks`,(0,H.jsx)(`span`,{className:`sep`,"aria-hidden":`true`,children:` · `}),(0,H.jsx)(`span`,{className:`total`,children:A.usd2(i)}),a&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{className:`sep`,"aria-hidden":`true`,children:` · `}),(0,H.jsx)(`span`,{className:`legend-anchor`,children:`~ = approximate start`})]})]})})]})}var Tn=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`];function En(e,t){let n=[];for(let r=0;r<e.length;r+=t)n.push(e.slice(r,r+t));return n}function Dn(e){let t=e.split(`-`).map(Number);return`${Tn[t[1]-1]} ${t[2]}`}function On(e,t){let n=e.split(`-`).map(Number),r=t.split(`-`).map(Number),i=n[1],a=n[2],o=r[1],s=r[2];return i===o?`${Tn[i-1]} ${a} - ${s}`:`${Tn[i-1]} ${a} - ${Tn[o-1]} ${s}`}function kn({r:e,staggerIndex:t,isMobile:n}){let r=e.date.slice(8,10),i=e.cost_usd>0?n?`${Math.ceil(e.cost_usd)}`:A.usd2(e.cost_usd):`—`,a=[`${e.label} · ${e.cost_usd>0?A.usd2(e.cost_usd):`—`}`,...e.models.map(e=>`${e.display} ${e.cost_pct.toFixed(0)}%`)].join(` · `);return(0,H.jsxs)(`button`,{type:`button`,"data-cell-date":e.date,className:`daily-cell h${e.intensity_bucket}${e.is_today?` is-today`:``} first-mount`,title:a,style:{"--daily-stagger":`${t*30}ms`},onClick:()=>V({type:`OPEN_MODAL`,kind:`daily`,dailyDate:e.date}),children:[(0,H.jsx)(`span`,{className:`d`,children:r}),(0,H.jsx)(`span`,{className:`c`,children:i})]})}function An(){let e=Ge(),t=ln(),n=(0,_.useSyncExternalStore)(B,()=>z().prefs.dailyCollapsed),r=e?.daily?.rows??[],i=En([...r].reverse(),7),a=e?.daily?.total_cost_usd??0,o=e?.daily?.peak??null;return(0,H.jsxs)(`section`,{className:`panel accent-indigo`+(n?` daily-collapsed`:``),id:`panel-daily`,tabIndex:0,role:`region`,"aria-label":`Daily heatmap panel`,"data-panel-kind":`daily`,children:[(0,H.jsxs)(`div`,{className:`panel-header`,style:{justifyContent:`space-between`},children:[(0,H.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`10px`},children:[(0,H.jsx)(`svg`,{className:`icon`,style:{color:`var(--accent-indigo)`},children:(0,H.jsx)(`use`,{href:`/static/icons.svg#grid`})}),(0,H.jsxs)(`h3`,{style:{color:`var(--accent-indigo)`},children:[`Daily `,(0,H.jsx)(`span`,{className:`sub`,children:`heatmap · 30 days`})]})]}),(0,H.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`4px`},children:[(0,H.jsx)(Jt,{panel:`daily`,panelLabel:`Daily`,triggerId:`daily-panel`,onClick:()=>V(L(`daily`,`daily-panel`))}),(0,H.jsx)(`button`,{type:`button`,className:`panel-collapse-toggle`,"aria-expanded":!n,"aria-controls":`panel-daily-body`,"aria-label":n?`Expand Daily`:`Collapse Daily`,title:n?`Expand`:`Collapse`,onClick:e=>{e.stopPropagation(),V({type:`SAVE_PREFS`,patch:{dailyCollapsed:!n}})},children:(0,H.jsx)(`svg`,{className:`icon`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#${n?`chevron-down`:`chevron-up`}`})})}),(0,H.jsx)(qt,{})]})]}),(0,H.jsx)(`div`,{className:`panel-body`,id:`panel-daily-body`,children:r.length===0?(0,H.jsx)(`div`,{className:`panel-empty`,children:`No usage history yet.`}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`daily-legend`,"aria-label":`Color intensity legend`,children:[(0,H.jsx)(`span`,{children:`Less`}),(0,H.jsxs)(`span`,{className:`scale`,children:[(0,H.jsx)(`span`,{className:`h0`}),(0,H.jsx)(`span`,{className:`h1`}),(0,H.jsx)(`span`,{className:`h2`}),(0,H.jsx)(`span`,{className:`h3`}),(0,H.jsx)(`span`,{className:`h4`}),(0,H.jsx)(`span`,{className:`h5`})]}),(0,H.jsx)(`span`,{children:`More`})]}),(0,H.jsx)(`div`,{className:`daily-cal-grid`,children:i.map((e,n)=>(0,H.jsxs)(_.Fragment,{children:[(0,H.jsxs)(`div`,{className:`daily-week-label`,children:[(0,H.jsxs)(`span`,{className:`wk`,children:[`W`,n+1]}),(0,H.jsx)(`span`,{className:`rng`,children:On(e[0].date,e[e.length-1].date)})]}),e.map((e,r)=>(0,H.jsx)(kn,{r:e,staggerIndex:n*7+r,isMobile:t},e.date)),e.length<7&&(0,H.jsx)(`div`,{className:`daily-month-continues`,style:{gridColumn:`span ${7-e.length}`},"aria-hidden":`true`,children:`Month continues`})]},n))}),(0,H.jsxs)(`div`,{className:`daily-foot`,children:[(0,H.jsxs)(`div`,{className:`daily-foot-col`,"data-total-cell":!0,children:[(0,H.jsx)(`svg`,{className:`daily-foot-icon icon-total`,"aria-hidden":`true`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#pie-chart`})}),(0,H.jsxs)(`div`,{className:`daily-foot-text`,children:[(0,H.jsxs)(`span`,{className:`lbl`,children:[`Total (`,r.length,` days)`]}),(0,H.jsx)(`span`,{className:`val`,children:A.usd2(a)})]})]}),o&&(0,H.jsxs)(`button`,{type:`button`,className:`daily-foot-col daily-foot-peak`,"data-peak-trigger":!0,title:`Click to open Daily modal at peak day`,onClick:()=>V({type:`OPEN_MODAL`,kind:`daily`,dailyDate:o.date}),children:[(0,H.jsx)(`svg`,{className:`daily-foot-icon icon-peak`,"aria-hidden":`true`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#trending-up`})}),(0,H.jsxs)(`div`,{className:`daily-foot-text`,children:[(0,H.jsx)(`span`,{className:`lbl`,children:`Peak day`}),(0,H.jsxs)(`span`,{className:`val`,children:[(0,H.jsx)(`span`,{className:`d`,children:Dn(o.date)}),(0,H.jsx)(`span`,{className:`a`,children:A.usd2(o.cost_usd)})]})]})]})]})]})})]})}var jn={weekly:`WEEKLY`,five_hour:`5H-BLOCK`,budget:`BUDGET`,projected:`PROJECTED`,project_budget:`PROJECT`,codex_budget:`CODEX`},Mn={weekly:`Weekly`,five_hour:`5h-block`,budget:`Budget`,projected:`Projected`,project_budget:`Project budget`,codex_budget:`Codex budget`};function Nn(e){return e===`calendar-month`?`Month`:e===`calendar-week`?`Calendar week`:`Week`}function Pn(e){let t=e.severity;return t===`info`||t===`warn`||t===`critical`?t:t===`amber`?`warn`:t===`red`||e.threshold>=100?`critical`:e.threshold>=90?`warn`:`info`}function Fn(e){if(e.axis!==`projected`)return null;let t=e.metric??e.context.metric,n=e.context.projected_value;if(t==null||n==null)return null;if(t===`weekly_pct`)return`projected ${Math.round(n)}% of cap`;if(t===`codex_budget_usd`){let t=e.context.denominator;return t==null?null:`projected $${Math.round(n)} of $${Math.round(t)} · Codex`}let r=e.context.denominator;return r==null?null:`projected $${Math.round(n)} of $${Math.round(r)}`}function In(){let e=(0,_.useSyncExternalStore)(B,()=>z().alerts),t=(0,_.useSyncExternalStore)(B,()=>z().prefs.alertsCollapsed),n=Gt(),r={tz:n.resolvedTz,offsetLabel:n.offsetLabel},i=e.slice(0,10),a=e.length,o=()=>{Kn.alerts.openAction()};return(0,H.jsxs)(`section`,{className:`panel accent-amber`+(t?` alerts-collapsed`:``),id:`panel-alerts`,tabIndex:0,role:`region`,"aria-label":`Recent alerts panel`,"data-panel-kind":`alerts`,onClick:o,onKeyDown:e=>{e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),o())},children:[(0,H.jsxs)(`div`,{className:`panel-header`,style:{justifyContent:`space-between`},children:[(0,H.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`10px`},children:[(0,H.jsx)(`svg`,{className:`icon`,style:{color:`var(--accent-amber)`},children:(0,H.jsx)(`use`,{href:`/static/icons.svg#bell`})}),(0,H.jsxs)(`h3`,{style:{color:`var(--accent-amber)`},children:[`Recent alerts `,(0,H.jsx)(`span`,{className:`sub`,children:`(last 10)`})]})]}),(0,H.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`4px`},children:[(0,H.jsx)(`button`,{type:`button`,className:`panel-collapse-toggle`,"aria-expanded":!t,"aria-controls":`panel-alerts-body`,"aria-label":t?`Expand Recent alerts`:`Collapse Recent alerts`,title:t?`Expand`:`Collapse`,onClick:e=>{e.stopPropagation(),V({type:`SAVE_PREFS`,patch:{alertsCollapsed:!t}})},children:(0,H.jsx)(`svg`,{className:`icon`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#${t?`chevron-down`:`chevron-up`}`})})}),(0,H.jsx)(qt,{})]})]}),(0,H.jsx)(`div`,{className:`panel-body`,id:`panel-alerts-body`,children:i.length===0?(0,H.jsx)(`div`,{className:`alerts-empty panel-empty`,children:`No alerts yet. Alerts appear when usage crosses 90% or 95%.`}):(0,H.jsx)(`ul`,{className:`alerts-list`,children:i.map(e=>{let t=Pn(e);return(0,H.jsxs)(`li`,{className:`alert-row`,children:[(0,H.jsxs)(`span`,{className:`alert-threshold severity-${t} ${t}`,children:[e.threshold,`%`]}),(0,H.jsx)(`span`,{className:`chip chip--${e.axis}`,children:jn[e.axis]}),(0,H.jsx)(`span`,{className:`alert-when`,children:A.relativeOrAbsolute(e.alerted_at,r)})]},e.id)})})}),a>0&&(0,H.jsxs)(`div`,{className:`panel-foot alerts-foot`,children:[i.length,` of `,a,` shown`]})]})}var Ln={mini:{width:272,height:32,padTop:4,padBot:4},large:{width:800,height:90,padTop:6,padBot:6}},Rn=[0,25,50,75,100];function zn({days:e,baseline_median_percent:t,today_marker_color:n,size:r}){let i=Ln[r],a=r===`large`,o=[...e].reverse(),s=a?{width:`100%`}:{width:`100%`,height:i.height,preserveAspectRatio:`none`};if(o.length===0){let e=(0,H.jsx)(`svg`,{className:`cr-spark`,...s,viewBox:`0 0 ${i.width} ${i.height}`,"aria-label":`no data`});return a?(0,H.jsxs)(`div`,{className:`cr-spark-wrap`,children:[(0,H.jsx)(`span`,{className:`cr-spark-axis cr-spark-axis-top`,children:`100%`}),e,(0,H.jsx)(`span`,{className:`cr-spark-axis cr-spark-axis-bot`,children:`0%`})]}):e}let c=e=>{let t=Math.max(0,Math.min(100,e))/100;return i.padTop+(1-t)*(i.height-i.padTop-i.padBot)},l=e=>o.length===1?i.width/2:e/(o.length-1)*i.width,u=o.map((e,t)=>`${l(t).toFixed(1)},${c(e.cache_hit_percent).toFixed(1)}`).join(` `),d=o.length-1,f=l(d),p=c(o[d].cache_hit_percent),m=(0,H.jsxs)(`svg`,{className:`cr-spark`,...s,viewBox:`0 0 ${i.width} ${i.height}`,"aria-label":`Cache hit % timeline, ${o.length} days`,children:[a&&Rn.map(e=>{let t=e===0||e===100;return(0,H.jsx)(`line`,{x1:0,x2:i.width,y1:c(e),y2:c(e),stroke:t?`rgba(255,255,255,0.45)`:`rgba(255,255,255,0.18)`,strokeWidth:t?1:.5,strokeDasharray:t?void 0:`4,3`,opacity:1,"data-testid":`cr-spark-gridline-${e}`},`grid-${e}`)}),t!==null&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`rect`,{x:0,y:c(t+5),width:i.width,height:c(t-5)-c(t+5),fill:`var(--accent-cyan)`,opacity:.1}),(0,H.jsx)(`line`,{x1:0,x2:i.width,y1:c(t),y2:c(t),stroke:`var(--accent-cyan)`,strokeWidth:.5,strokeDasharray:`3,3`,opacity:.6})]}),(0,H.jsx)(`polyline`,{points:u,fill:`none`,stroke:`var(--accent-cyan)`,strokeWidth:a?2:1.5}),(0,H.jsx)(`circle`,{cx:f,cy:p,r:a?5:3.5,fill:n,"data-testid":`cr-spark-today-marker`})]});return a?(0,H.jsxs)(`div`,{className:`cr-spark-wrap`,children:[(0,H.jsx)(`span`,{className:`cr-spark-axis cr-spark-axis-top`,children:`100%`}),m,(0,H.jsx)(`span`,{className:`cr-spark-axis cr-spark-axis-bot`,children:`0%`})]}):m}var Bn={mini:{width:272,height:28,padX:0,padTop:2,padBot:2,barGap:1},large:{width:800,height:110,padX:28,padTop:28,padBot:28,barGap:4}};function Vn({days:e,size:t}){let n=Bn[t],r=t===`large`,i=[...e].reverse();if(i.length===0)return r?(0,H.jsxs)(`div`,{className:`crm-section`,children:[(0,H.jsxs)(`div`,{className:`crm-section-head crm-sh-net`,children:[`Net $ per day`,(0,H.jsx)(`span`,{className:`meta`,children:`no data`})]}),(0,H.jsx)(`div`,{className:`crm-chart-frame netbars`,children:(0,H.jsx)(`div`,{style:{color:`var(--text-dim)`,fontSize:11,padding:`8px 4px`},children:`No daily activity to render.`})})]}):(0,H.jsx)(`svg`,{className:`cr-netbars-mini`,width:`100%`,height:`100%`,viewBox:`0 0 ${n.width} ${n.height}`,preserveAspectRatio:`none`,"aria-label":`no data`});if(r){let e=Math.max(1e-9,...i.map(e=>Math.max(e.saved_usd+e.wasted_usd,Math.abs(e.net_usd)))),t=(n.height-n.padTop-n.padBot)/2/e,r=n.padTop+(n.height-n.padTop-n.padBot)/2,a=(n.width-n.padX*2)/i.length-n.barGap;return(0,H.jsxs)(`div`,{className:`crm-section`,children:[(0,H.jsxs)(`div`,{className:`crm-section-head crm-sh-net`,children:[`Net $ per day · saved (green) − wasted (red)`,(0,H.jsx)(`span`,{className:`meta`,children:`positive bars = caching helped`})]}),(0,H.jsx)(`div`,{className:`crm-chart-frame netbars`,children:(0,H.jsxs)(`svg`,{viewBox:`0 0 ${n.width} ${n.height}`,width:`100%`,height:n.height,"aria-label":`Per-day net dollar chart, ${i.length} days`,children:[(0,H.jsx)(`line`,{x1:n.padX,x2:n.width-n.padX,y1:r,y2:r,stroke:`var(--border-soft)`,strokeWidth:1}),i.map((e,i)=>{let o=n.padX+i*(a+n.barGap);if(e.net_usd>=0){let n=e.saved_usd*t,i=e.wasted_usd*t;return(0,H.jsxs)(`g`,{"data-testid":`crm-netbar`,"data-date":e.date,"data-sign":`pos`,children:[(0,H.jsx)(`rect`,{x:o,y:r-n,width:a,height:n,fill:`var(--accent-green)`,rx:2}),i>0&&(0,H.jsx)(`rect`,{x:o,y:r-n-i,width:a,height:i,fill:`var(--accent-red)`,opacity:.75,rx:2})]},e.date)}let s=Math.abs(e.net_usd)*t;return(0,H.jsx)(`rect`,{"data-testid":`crm-netbar`,"data-date":e.date,"data-sign":`neg`,x:o,y:r,width:a,height:s,fill:`var(--accent-amber)`,rx:2},e.date)}),i.map((e,t)=>{let r=n.padX+t*(a+n.barGap)+a/2,o=t===i.length-1?`Today`:e.date.slice(5);return(0,H.jsx)(`text`,{x:r,y:n.height-6,fill:`var(--text-dim)`,fontSize:9,textAnchor:`middle`,children:o},`l-${e.date}`)})]})})]})}let a=n.height-n.padTop-n.padBot,o=Math.max(1e-9,...i.map(e=>Math.abs(e.net_usd))),s=(n.width-n.padX*2)/i.length-n.barGap;return(0,H.jsx)(`svg`,{className:`cr-netbars-mini`,width:`100%`,height:`100%`,viewBox:`0 0 ${n.width} ${n.height}`,preserveAspectRatio:`none`,"aria-label":`14-day net dollar bars, ${i.length} days`,children:i.map((e,t)=>{let r=n.padX+t*(s+n.barGap),i=Math.max(1,Math.abs(e.net_usd)/o*a),c=n.height-n.padBot-i,l=e.net_usd>=0?`var(--accent-green)`:`var(--accent-amber)`;return(0,H.jsx)(`rect`,{"data-testid":`crm-netbar-mini`,"data-date":e.date,"data-sign":e.net_usd>=0?`pos`:`neg`,x:r,y:c,width:s,height:i,fill:l,rx:1},e.date)})})}var Hn=`var(--accent-teal)`,Un=`var(--accent-amber)`,Wn=`var(--accent-green)`;function Gn(){let e=Ge()?.cache_report,t=ln()?` cache-report-collapsed`:``,n=()=>V({type:`OPEN_MODAL`,kind:`cache-report`}),r=e=>{e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),n())};if(!e)return(0,H.jsx)(`section`,{className:`panel accent-teal${t}`,id:`panel-cache-report`,"data-panel-kind":`cache-report`,role:`region`,"aria-label":`Cache Report`,tabIndex:0,onClick:n,onKeyDown:r,style:{cursor:`pointer`},children:(0,H.jsxs)(`div`,{className:`panel-header`,style:{justifyContent:`space-between`},children:[(0,H.jsx)(`div`,{className:`cr-panel-header-inner`,children:(0,H.jsxs)(`h3`,{style:{color:Hn},children:[`Cache Report `,(0,H.jsx)(`span`,{className:`sub`,children:`(loading)`})]})}),(0,H.jsx)(qt,{})]})});if(e.is_empty)return(0,H.jsxs)(`section`,{className:`panel accent-teal${t}`,id:`panel-cache-report`,"data-panel-kind":`cache-report`,role:`region`,"aria-label":`Cache Report`,tabIndex:0,onClick:n,onKeyDown:r,style:{cursor:`pointer`},children:[(0,H.jsxs)(`div`,{className:`panel-header`,style:{justifyContent:`space-between`},children:[(0,H.jsx)(`div`,{className:`cr-panel-header-inner`,children:(0,H.jsx)(`h3`,{style:{color:Hn},children:`Cache Report`})}),(0,H.jsx)(qt,{})]}),(0,H.jsxs)(`div`,{className:`cr-status-row`,children:[(0,H.jsx)(`span`,{className:`cr-glyph thin`,children:`−`}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`cr-headline`,children:`No Claude activity yet`}),(0,H.jsx)(`div`,{className:`cr-subline`,children:`Run a session to start tracking`})]})]})]});let i=e.today.anomaly_triggered,a=e.today.baseline_daily_row_count<5,o=i&&!a,s=o?`accent-amber`:`accent-teal`,c=o?Un:Hn,l=o?Un:Wn,u,d,f=null;if(a){u={icon:`~`,cls:`thin`};let t=e.today.baseline_daily_row_count;d=(0,H.jsxs)(H.Fragment,{children:[`Building baseline · `,t,`/`,5,` days`]}),f=(0,H.jsxs)(H.Fragment,{children:[`Today: cache hit `,A.pctFloor(e.today.cache_hit_percent),`% · net`,` `,A.usdSigned(e.today.net_usd)]})}else i?(u={icon:`⚠`,cls:`warn`},d=e.today.anomaly_reasons.includes(`cache_drop`)&&e.today.delta_pp!==null?(0,H.jsxs)(H.Fragment,{children:[`Today: cache hit `,(0,H.jsxs)(`span`,{className:`delta-bad`,children:[`↓ `,A.pctFloor(Math.abs(e.today.delta_pp)),`pp`]})]}):(0,H.jsxs)(H.Fragment,{children:[`Today: net`,` `,(0,H.jsx)(`span`,{className:`delta-bad`,children:A.usdSigned(e.today.net_usd)})]}),f=(0,H.jsxs)(H.Fragment,{children:[`vs 14d median`,` `,e.today.baseline_median_percent===null?`—`:A.pctFloor(e.today.baseline_median_percent)+`%`,` `,`· net`,` `,(0,H.jsx)(`span`,{className:`warn`,children:A.usdSigned(e.today.net_usd)})]})):(u={icon:`✓`,cls:`ok`},d=(0,H.jsxs)(H.Fragment,{children:[`Today: cache hit`,` `,(0,H.jsxs)(`span`,{className:`delta-good`,children:[A.pctFloor(e.today.cache_hit_percent),`%`]})]}),f=(0,H.jsxs)(H.Fragment,{children:[`vs 14d median`,` `,e.today.baseline_median_percent===null?`—`:A.pctFloor(e.today.baseline_median_percent)+`%`,` `,`· net`,` `,(0,H.jsx)(`span`,{className:`ok`,children:A.usdSigned(e.today.net_usd)})]}));let p=e.days.reduce((e,t)=>e+t.net_usd,0),m=a?(0,H.jsxs)(H.Fragment,{children:[`Watchdog activates at `,5,` days of history`]}):(0,H.jsxs)(H.Fragment,{children:[`14d net:`,` `,(0,H.jsx)(`span`,{className:p>=0?`ok`:`warn`,children:A.usdSigned(p)})]});return(0,H.jsxs)(`section`,{className:`panel ${s}${t}`,id:`panel-cache-report`,"data-panel-kind":`cache-report`,role:`region`,"aria-label":`Cache Report`,tabIndex:0,onClick:n,onKeyDown:r,style:{cursor:`pointer`},children:[(0,H.jsxs)(`div`,{className:`panel-header`,style:{justifyContent:`space-between`},children:[(0,H.jsx)(`div`,{className:`cr-panel-header-inner`,children:(0,H.jsxs)(`h3`,{style:{color:c},children:[`Cache Report`,o&&(0,H.jsx)(`span`,{className:`sub`,children:`⚠ Today`})]})}),(0,H.jsx)(qt,{})]}),(0,H.jsxs)(`div`,{className:`cr-status-row`,children:[(0,H.jsx)(`span`,{className:`cr-glyph ${u.cls}`,children:u.icon}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`cr-headline`,children:d}),(0,H.jsx)(`div`,{className:`cr-subline`,children:f})]})]}),!a&&e.days.length>0&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(zn,{days:e.days,baseline_median_percent:e.today.baseline_median_percent,today_marker_color:l,size:`mini`}),(0,H.jsx)(`div`,{className:`cr-netbars-mini-wrap`,children:(0,H.jsx)(Vn,{days:e.days,size:`mini`})})]}),(0,H.jsx)(`div`,{className:`cr-subline second`,children:m})]})}var Kn={"current-week":{id:`current-week`,label:`Current Week`,Component:Qt,openAction:()=>V({type:`OPEN_MODAL`,kind:`current-week`})},forecast:{id:`forecast`,label:`Forecast`,Component:en,openAction:()=>V({type:`OPEN_MODAL`,kind:`forecast`})},trend:{id:`trend`,label:`Trend`,Component:sn,openAction:()=>V({type:`OPEN_MODAL`,kind:`trend`})},sessions:{id:`sessions`,label:`Sessions`,Component:mn,openAction:jt},projects:{id:`projects`,label:`Projects`,Component:gn,openAction:()=>V({type:`OPEN_MODAL`,kind:`projects`})},weekly:{id:`weekly`,label:`Weekly`,Component:yn,openAction:()=>V({type:`OPEN_MODAL`,kind:`weekly`})},monthly:{id:`monthly`,label:`Monthly`,Component:Sn,openAction:()=>V({type:`OPEN_MODAL`,kind:`monthly`})},blocks:{id:`blocks`,label:`Blocks`,Component:wn,openAction:Mt},daily:{id:`daily`,label:`Daily`,Component:An,openAction:()=>V({type:`OPEN_MODAL`,kind:`daily`})},alerts:{id:`alerts`,label:`Recent alerts`,Component:In,openAction:()=>V({type:`OPEN_MODAL`,kind:`alerts`})},"cache-report":{id:`cache-report`,label:`Cache Report`,Component:Gn,openAction:()=>V({type:`OPEN_MODAL`,kind:`cache-report`})}};function qn({panelOrder:e}){return(0,H.jsx)(`table`,{children:(0,H.jsxs)(`tbody`,{children:[e.map((e,t)=>(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`td`,{children:t<9?(0,H.jsx)(`kbd`,{children:String(t+1)}):t===9?(0,H.jsx)(`kbd`,{children:`0`}):(0,H.jsx)(`span`,{"aria-hidden":`true`,children:`—`})}),(0,H.jsxs)(`td`,{children:[`Open `,Kn[e]?.label??e,` modal`]})]},e)),(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`td`,{children:(0,H.jsx)(`kbd`,{children:`r`})}),(0,H.jsx)(`td`,{children:`force refresh`})]}),(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`td`,{children:(0,H.jsx)(`kbd`,{children:`s`})}),(0,H.jsx)(`td`,{children:`open Settings`})]}),(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`td`,{children:`Hold + drag a card`}),(0,H.jsx)(`td`,{children:`rearrange the dashboard`})]}),(0,H.jsxs)(`tr`,{children:[(0,H.jsxs)(`td`,{children:[(0,H.jsx)(`kbd`,{children:`Shift`}),`+`,(0,H.jsx)(`kbd`,{children:`↑`}),`/`,(0,H.jsx)(`kbd`,{children:`↓`})]}),(0,H.jsx)(`td`,{children:`swap focused card with neighbor`})]}),(0,H.jsxs)(`tr`,{children:[(0,H.jsxs)(`td`,{children:[(0,H.jsx)(`kbd`,{children:`↑`}),`/`,(0,H.jsx)(`kbd`,{children:`↓`})]}),(0,H.jsx)(`td`,{children:`Select period (Weekly/Monthly/Daily modal)`})]}),(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`td`,{children:(0,H.jsx)(`kbd`,{children:`?`})}),(0,H.jsx)(`td`,{children:`toggle this help`})]}),(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`td`,{children:(0,H.jsx)(`kbd`,{children:`Esc`})}),(0,H.jsx)(`td`,{children:`close`})]})]})})}function Jn(){return(0,H.jsx)(`table`,{className:`help-conversations`,children:(0,H.jsxs)(`tbody`,{children:[(0,H.jsx)(`tr`,{children:(0,H.jsx)(`td`,{colSpan:2,children:(0,H.jsx)(`strong`,{children:`Conversations`})})}),(0,H.jsxs)(`tr`,{children:[(0,H.jsxs)(`td`,{children:[(0,H.jsx)(`kbd`,{children:`j`}),` / `,(0,H.jsx)(`kbd`,{children:`k`})]}),(0,H.jsx)(`td`,{children:`move turns`})]}),(0,H.jsxs)(`tr`,{children:[(0,H.jsxs)(`td`,{children:[(0,H.jsx)(`kbd`,{children:`[`}),` / `,(0,H.jsx)(`kbd`,{children:`]`})]}),(0,H.jsx)(`td`,{children:`collapse / expand all`})]}),(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`td`,{children:(0,H.jsx)(`kbd`,{children:`g`})}),(0,H.jsx)(`td`,{children:`jump to top`})]}),(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`td`,{children:(0,H.jsx)(`kbd`,{children:`/`})}),(0,H.jsx)(`td`,{children:`search conversations`})]}),(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`td`,{children:(0,H.jsx)(`kbd`,{children:`Esc`})}),(0,H.jsx)(`td`,{children:`close`})]})]})})}function Yn(){return(0,H.jsxs)(`ul`,{className:`help-gesture-list`,children:[(0,H.jsxs)(`li`,{children:[(0,H.jsx)(`strong`,{children:`Tap the chevron`}),` — expand or collapse a panel`]}),(0,H.jsxs)(`li`,{children:[(0,H.jsx)(`strong`,{children:`Long-press a panel`}),` — drag to rearrange the dashboard`]}),(0,H.jsxs)(`li`,{children:[(0,H.jsx)(`strong`,{children:`Tap ✕ or the dim backdrop`}),` — close a sheet (or `,(0,H.jsx)(`kbd`,{children:`Esc`}),` on tablets)`]}),(0,H.jsxs)(`li`,{children:[(0,H.jsx)(`strong`,{children:`Tap a model chip`}),` — filter Sessions by that model`]}),(0,H.jsxs)(`li`,{children:[(0,H.jsx)(`strong`,{children:`Tap the sync chip`}),` — force a fresh refresh`]})]})}function Xn(){let[e,t]=(0,_.useState)(!1),n=ln(),r=(0,_.useSyncExternalStore)(B,()=>z().prefs.panelOrder),i=(0,_.useSyncExternalStore)(B,()=>z().view);return Ut([{key:`?`,scope:`global`,view:`any`,action:()=>t(e=>!e)},{key:`Escape`,scope:`overlay`,layer:1e3,action:()=>t(!1),when:()=>e}]),e?(0,H.jsx)(`div`,{id:`help-overlay`,onClick:()=>t(!1),children:(0,H.jsxs)(`div`,{className:`help-card`,onClick:e=>e.stopPropagation(),children:[(0,H.jsxs)(`div`,{className:`help-header`,children:[(0,H.jsx)(`h2`,{children:n?`Help`:`Keybindings`}),(0,H.jsx)(`button`,{className:`modal-close`,type:`button`,"aria-label":`Close`,onClick:()=>t(!1),children:`×`})]}),n?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Yn,{}),(0,H.jsxs)(`details`,{className:`help-keyboard-disclosure`,children:[(0,H.jsx)(`summary`,{children:`Keyboard shortcuts ▾`}),(0,H.jsx)(qn,{panelOrder:r}),i===`conversations`&&(0,H.jsx)(Jn,{})]})]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(qn,{panelOrder:r}),i===`conversations`&&(0,H.jsx)(Jn,{})]}),(0,H.jsxs)(`p`,{className:`meta`,children:[`cctally · `,(0,H.jsx)(`span`,{id:`help-server-url`,children:window.location.origin})]})]})}):null}var Zn={weekly_pct:`Weekly %`,budget_usd:`Budget $`,codex_budget_usd:`Codex $`};function Qn(e){if(!e)return!1;try{return new Intl.DateTimeFormat(`en-US`,{timeZone:e}).format(new Date),!0}catch{return!1}}function $n(e){try{return`${e} (${new Intl.DateTimeFormat(`en-US`,{timeZone:e,timeZoneName:`shortOffset`}).formatToParts(new Date).find(e=>e.type===`timeZoneName`)?.value??``})`}catch{return e}}function er(e){return e===`local`?`local`:e===`utc`?`utc`:`custom`}function tr(){let[e,t]=(0,_.useState)(!1),n=(0,_.useSyncExternalStore)(B,()=>z().prefs),[r,i]=(0,_.useState)(n.sortDefault),[a,o]=(0,_.useState)(n.sessionsPerPage),s=(0,_.useSyncExternalStore)(B,()=>z().filterText),[c,l]=(0,_.useState)(s),u=Gt(),[d,f]=(0,_.useState)(er(u.tz)),[p,m]=(0,_.useState)(er(u.tz)===`custom`?u.tz:``),[h,g]=(0,_.useState)(!1),[v,y]=(0,_.useState)(null),b=(0,_.useSyncExternalStore)(B,()=>z().alertsConfig),[x,S]=(0,_.useState)(b.enabled),[C,w]=(0,_.useState)(b.projected_weekly_enabled??!1),[T,E]=(0,_.useState)(b.projected_budget_enabled??!1),[D,O]=(0,_.useState)(b.project_alerts_enabled??!1),[k,A]=(0,_.useState)(b.codex_budget_alerts_enabled??!1),[j,M]=(0,_.useState)(b.codex_projected_enabled??!1),[N,P]=(0,_.useState)(b.notifier??`auto`),[ee,te]=(0,_.useState)(!1),[ne,re]=(0,_.useState)(null),[F,ie]=(0,_.useState)(`weekly`),[ae,oe]=(0,_.useState)(`weekly_pct`);if((0,_.useEffect)(()=>{f(er(u.tz)),m(er(u.tz)===`custom`?u.tz:``)},[u.tz]),(0,_.useEffect)(()=>{S(b.enabled),w(b.projected_weekly_enabled??!1),E(b.projected_budget_enabled??!1),O(b.project_alerts_enabled??!1),A(b.codex_budget_alerts_enabled??!1),M(b.codex_projected_enabled??!1),P(b.notifier??`auto`)},[b.enabled,b.projected_weekly_enabled,b.projected_budget_enabled,b.project_alerts_enabled,b.codex_budget_alerts_enabled,b.codex_projected_enabled,b.notifier]),Ut([{key:`s`,scope:`global`,view:`any`,action:()=>t(!0),when:()=>!z().openModal},{key:`Escape`,scope:`modal`,action:()=>t(!1),when:()=>e},{key:`0`,scope:`modal`,action:()=>{},when:()=>e},{key:`1`,scope:`modal`,action:()=>{},when:()=>e},{key:`2`,scope:`modal`,action:()=>{},when:()=>e},{key:`3`,scope:`modal`,action:()=>{},when:()=>e},{key:`4`,scope:`modal`,action:()=>{},when:()=>e},{key:`5`,scope:`modal`,action:()=>{},when:()=>e},{key:`6`,scope:`modal`,action:()=>{},when:()=>e},{key:`7`,scope:`modal`,action:()=>{},when:()=>e},{key:`8`,scope:`modal`,action:()=>{},when:()=>e},{key:`9`,scope:`modal`,action:()=>{},when:()=>e}]),(0,_.useEffect)(()=>{e&&(i(n.sortDefault),o(n.sessionsPerPage),l(s),S(b.enabled),w(b.projected_weekly_enabled??!1),E(b.projected_budget_enabled??!1),O(b.project_alerts_enabled??!1),A(b.codex_budget_alerts_enabled??!1),M(b.codex_projected_enabled??!1),P(b.notifier??`auto`),re(null),ie(`weekly`))},[e,n.sortDefault,n.sessionsPerPage,s,b.enabled,b.projected_weekly_enabled,b.projected_budget_enabled,b.project_alerts_enabled,b.codex_budget_alerts_enabled,b.codex_projected_enabled,b.notifier]),!e)return null;let se=d===`local`?`local`:d===`utc`?`utc`:p.trim(),ce=d!==`custom`||Qn(p.trim()),I=se!==u.tz,le=x!==b.enabled,ue=C!==(b.projected_weekly_enabled??!1),de=T!==(b.projected_budget_enabled??!1),fe=D!==(b.project_alerts_enabled??!1),L=k!==(b.codex_budget_alerts_enabled??!1),pe=j!==(b.codex_projected_enabled??!1),me=N!==(b.notifier??`auto`),he=b.command_configured??!1,ge=h||I&&d===`custom`&&!ce,_e=()=>t(!1);return(0,H.jsxs)(`div`,{id:`settings-root`,children:[(0,H.jsx)(`div`,{className:`modal-backdrop`,onClick:_e}),(0,H.jsxs)(`div`,{className:`modal-card accent-orange`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`settings-title`,children:[(0,H.jsxs)(`header`,{className:`modal-header`,children:[(0,H.jsx)(`h2`,{id:`settings-title`,children:`Settings`}),(0,H.jsx)(`button`,{className:`modal-close`,type:`button`,"aria-label":`Close`,onClick:_e,children:`×`})]}),(0,H.jsxs)(`div`,{className:`modal-body`,children:[(0,H.jsxs)(`fieldset`,{className:`settings-fs`,children:[(0,H.jsx)(`legend`,{children:`Display timezone`}),u.pinned&&(0,H.jsx)(`small`,{children:`Pinned by --tz flag — restart the server without --tz to change here.`}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`input`,{type:`radio`,name:`tz-mode`,value:`local`,checked:d===`local`,onChange:()=>f(`local`),disabled:u.pinned}),` `,`Local (`,u.resolvedTz,`)`]}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`input`,{type:`radio`,name:`tz-mode`,value:`utc`,checked:d===`utc`,onChange:()=>f(`utc`),disabled:u.pinned}),` `,`UTC`]}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`input`,{type:`radio`,name:`tz-mode`,value:`custom`,checked:d===`custom`,onChange:()=>f(`custom`),disabled:u.pinned}),` `,`Custom:`,` `,(0,H.jsx)(`input`,{type:`text`,value:p,onChange:e=>m(e.target.value),disabled:d!==`custom`||u.pinned,placeholder:`America/New_York`,"aria-invalid":d===`custom`&&!ce})]}),d===`custom`&&p.trim()&&(ce?(0,H.jsxs)(`small`,{children:[`resolves to: `,$n(p.trim())]}):(0,H.jsx)(`div`,{className:`modal-error`,children:`Invalid IANA zone`})),v&&(0,H.jsxs)(`div`,{className:`modal-error`,children:[`Failed: `,v]})]}),(0,H.jsxs)(`fieldset`,{className:`settings-fs alerts-fs`,children:[(0,H.jsx)(`legend`,{children:`Alerts`}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`input`,{type:`checkbox`,name:`alerts-enabled`,checked:x,onChange:e=>S(e.target.checked)}),` `,`Enable threshold alerts`]}),(0,H.jsxs)(`label`,{className:`settings-row`,children:[`Notifier`,` `,(0,H.jsxs)(`select`,{className:`settings-btn settings-select`,value:N,"aria-label":`Alert notifier`,onChange:e=>P(e.target.value),children:[(0,H.jsx)(`option`,{value:`auto`,children:`Auto-detect`}),(0,H.jsx)(`option`,{value:`osascript`,children:`macOS (osascript)`}),(0,H.jsx)(`option`,{value:`notify-send`,children:`Linux (notify-send)`}),(0,H.jsxs)(`option`,{value:`command`,disabled:!he,children:[`Custom command`,he?``:` (set via CLI)`]}),(0,H.jsx)(`option`,{value:`none`,children:`None (log only)`})]})]}),he&&(0,H.jsx)(`p`,{className:`settings-hint`,children:`Custom command configured (edit via CLI).`}),(0,H.jsxs)(`p`,{className:`alerts-summary settings-hint`,children:[`Weekly: `,b.weekly_thresholds.map(e=>`${e}%`).join(`, `),` · `,`5h-block: `,b.five_hour_thresholds.map(e=>`${e}%`).join(`, `),` · `,`Budget: `,(b.budget_thresholds??[]).map(e=>`${e}%`).join(`, `)||`—`]}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`input`,{type:`checkbox`,name:`projected-weekly-enabled`,checked:C,onChange:e=>w(e.target.checked)}),` `,`Projected weekly-% pace alerts`]}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`input`,{type:`checkbox`,name:`projected-budget-enabled`,checked:T,onChange:e=>E(e.target.checked)}),` `,`Projected budget-$ pace alerts`]}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`input`,{type:`checkbox`,name:`project-alerts-enabled`,checked:D,onChange:e=>O(e.target.checked)}),` `,`Per-project budget alerts`]}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`input`,{type:`checkbox`,name:`codex-budget-alerts-enabled`,checked:k,disabled:!b.codex_budget_configured,onChange:e=>A(e.target.checked)}),` `,`Codex budget alerts`]}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`input`,{type:`checkbox`,name:`codex-projected-enabled`,checked:j,disabled:!b.codex_budget_configured,onChange:e=>M(e.target.checked)}),` `,`Codex projected-pace alerts`]}),!b.codex_budget_configured&&(0,H.jsxs)(`p`,{className:`settings-hint`,children:[`Set a Codex budget via the CLI first:`,` `,(0,H.jsx)(`code`,{children:`cctally budget set 200 --vendor codex`})]}),(0,H.jsxs)(`div`,{className:`alerts-test-row`,children:[(0,H.jsxs)(`label`,{children:[`Axis`,` `,(0,H.jsx)(`select`,{className:`settings-btn settings-select`,value:F,disabled:ee,"aria-label":`Test alert axis`,onChange:e=>ie(e.target.value),children:Object.keys(Mn).map(e=>(0,H.jsx)(`option`,{value:e,children:Mn[e]},e))})]}),` `,F===`projected`&&(0,H.jsxs)(`label`,{children:[`Metric`,` `,(0,H.jsx)(`select`,{className:`settings-btn settings-select`,value:ae,disabled:ee,"aria-label":`Test alert projected metric`,onChange:e=>oe(e.target.value),children:Object.keys(Zn).map(e=>(0,H.jsx)(`option`,{value:e,children:Zn[e]},e))})]}),` `,(0,H.jsx)(`button`,{className:`settings-btn`,type:`button`,disabled:ee,onClick:async()=>{te(!0),re(null);try{let e=await fetch(`/api/alerts/test`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({axis:F,threshold:90,...F===`projected`?{metric:ae}:{}})}),t=await e.json().catch(()=>({}));t.alert&&V({type:`SHOW_ALERT_TOAST`,alert:t.alert}),t.dispatch!==`queued`&&re(t.dispatch??t.reason??`HTTP ${e.status}`)}catch(e){re(e instanceof Error?e.message:`unknown error`)}te(!1)},children:ee?`Sending…`:`Send test alert`}),(0,H.jsx)(`p`,{className:`settings-hint`,children:`Sends a synthetic alert through the dispatch pipeline so you can verify the toast and log path. Does not write to the database or update the Recent alerts panel. Independent of the Enabled toggle — fire-and-test before flipping production alerts on.`}),ne&&(0,H.jsxs)(`div`,{className:`modal-error`,children:[`Test failed: `,ne]})]})]}),(0,H.jsxs)(`fieldset`,{className:`settings-fs`,children:[(0,H.jsx)(`legend`,{children:`Sort default`}),De.map(({key:e,label:t})=>(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`input`,{type:`radio`,name:`sort-default`,value:e,checked:r===e,onChange:()=>i(e)}),` `,t]},e))]}),(0,H.jsxs)(`fieldset`,{className:`settings-fs`,children:[(0,H.jsx)(`legend`,{children:`Remembered filter term`}),(0,H.jsx)(`input`,{type:`text`,placeholder:`(none)`,value:c,onChange:e=>l(e.target.value)})]}),(0,H.jsxs)(`fieldset`,{className:`settings-fs`,children:[(0,H.jsx)(`legend`,{children:`Sessions per page`}),(0,H.jsx)(`input`,{type:`number`,min:10,max:1e3,value:a,onChange:e=>o(Number(e.target.value))})]}),(0,H.jsxs)(`fieldset`,{className:`settings-fs sorting-fs`,children:[(0,H.jsx)(`legend`,{children:`Table sorting`}),(0,H.jsx)(`button`,{className:`settings-btn`,type:`button`,disabled:!n.trendSortOverride&&!n.sessionsSortOverride,onClick:()=>{V({type:`CLEAR_TABLE_SORTS`}),_e()},children:`Reset table sorting`}),(0,H.jsx)(`p`,{className:`settings-hint`,children:`Clears column-click sorting on the $/1% Trend and Recent Sessions tables.`})]}),(0,H.jsxs)(`fieldset`,{className:`settings-fs layout-fs`,children:[(0,H.jsx)(`legend`,{children:`Layout`}),(0,H.jsx)(`button`,{className:`settings-btn`,type:`button`,onClick:()=>{V({type:`RESET_PANEL_ORDER`}),_e()},children:`Reset card order`})]}),(0,H.jsxs)(`div`,{className:`settings-actions`,children:[(0,H.jsx)(`button`,{className:`settings-btn`,type:`button`,onClick:async()=>{let e={};if(I&&!u.pinned){if(!ce){y(`Invalid IANA zone`);return}e.display={tz:se}}if(le||ue||me){let t={};le&&(t.enabled=x),ue&&(t.projected_enabled=C),me&&(t.notifier=N),e.alerts=t}if(de||fe){let t={};de&&(t.projected_enabled=T),fe&&(t.project_alerts_enabled=D),e.budget=t}if(L||pe){let t={};L&&(t.alerts_enabled=k),pe&&(t.projected_enabled=j),e.budget={...e.budget??{},codex:t}}if(Object.keys(e).length>0){g(!0),y(null);try{let t=await fetch(`/api/settings`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.error??`HTTP ${t.status}`)}}catch(e){y(e instanceof Error?e.message:`unknown error`),g(!1);return}g(!1)}V({type:`SAVE_PREFS`,patch:{sortDefault:r,sessionsPerPage:Number.isFinite(a)&&a>0?Math.min(1e3,Math.max(10,Math.round(a))):n.sessionsPerPage}}),V({type:`SET_SORT`,key:r}),V({type:`SET_FILTER`,text:c}),V({type:`SET_TABLE_SORT`,table:`sessions`,override:null}),_e()},disabled:ge,children:h?`Saving…`:`Save`}),(0,H.jsx)(`button`,{className:`settings-btn`,type:`button`,onClick:()=>{V({type:`RESET_PREFS`}),V({type:`SET_FILTER`,text:``}),_e()},children:`Reset to defaults`}),(0,H.jsx)(`button`,{className:`settings-btn`,type:`button`,onClick:_e,children:`Cancel`})]})]})]})]})}var nr=8e3,rr=`New: hold any card to rearrange the dashboard.`,ir=`Tap to drill in · long-press to rearrange · ⟳ to refresh`;function ar(){let e=ln(),t=(0,_.useSyncExternalStore)(B,()=>z().prefs.onboardingToastSeen),n=(0,_.useSyncExternalStore)(B,()=>z().prefs.mobileOnboardingToastSeen),r=e?n:t,i=e?`MARK_MOBILE_ONBOARDING_TOAST_SEEN`:`MARK_ONBOARDING_TOAST_SEEN`,a=e?ir:rr;return(0,_.useEffect)(()=>{if(r)return;let e=setTimeout(()=>V({type:i}),nr);return()=>clearTimeout(e)},[r,i]),r?null:(0,H.jsxs)(`div`,{className:`onboarding-toast`,role:`status`,"aria-live":`polite`,children:[(0,H.jsx)(`span`,{className:`onboarding-toast-msg`,children:a}),(0,H.jsx)(`button`,{className:`onboarding-toast-dismiss`,type:`button`,"aria-label":`Dismiss`,onClick:()=>V({type:i}),children:`×`})]})}var or=2500,sr=8e3;function cr(){let e=(0,_.useSyncExternalStore)(B,()=>z().toast),t=Gt(),n={tz:t.resolvedTz,offsetLabel:t.offsetLabel};return(0,_.useEffect)(()=>{if(e==null)return;let t=e.kind===`alert`?sr:or,n=window.setTimeout(()=>V({type:`HIDE_TOAST`}),t);return()=>window.clearTimeout(n)},[e]),(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(ar,{}),e?.kind===`status`&&(0,H.jsx)(`div`,{className:`toast`,role:`status`,"aria-live":`polite`,children:e.text}),e?.kind===`alert`&&(0,H.jsxs)(`div`,{className:`toast toast--alert toast--severity-${Pn(e.payload)}`,role:`alert`,onClick:()=>V({type:`HIDE_TOAST`}),children:[(0,H.jsxs)(`div`,{className:`toast--alert-head`,children:[(0,H.jsx)(`span`,{className:`chip chip--${e.payload.axis}`,children:jn[e.payload.axis]}),(0,H.jsxs)(`span`,{className:`toast--alert-threshold num`,children:[e.payload.threshold,`%`]}),(0,H.jsx)(`span`,{className:`toast--alert-dismiss-hint`,children:`click to dismiss`})]}),(0,H.jsx)(`div`,{className:`toast--alert-title`,children:e.payload.axis===`projected`?(0,H.jsxs)(H.Fragment,{children:[Mn.projected,` to reach`,` `,e.payload.threshold,`%`]}):e.payload.axis===`project_budget`?(0,H.jsxs)(H.Fragment,{children:[e.payload.context.project??`Project`,` `,`budget `,e.payload.threshold,`% reached`]}):e.payload.axis===`codex_budget`?(0,H.jsxs)(H.Fragment,{children:[Mn.codex_budget,` `,e.payload.threshold,`% reached`]}):(0,H.jsxs)(H.Fragment,{children:[Mn[e.payload.axis],` usage`,` `,e.payload.threshold,`% reached`]})}),e.payload.context.week_start_date&&(0,H.jsxs)(`div`,{className:`toast--alert-sub`,children:[`Week starting`,` `,A.weekStart(e.payload.context.week_start_date,n)??`—`]}),e.payload.context.block_start_at&&(0,H.jsxs)(`div`,{className:`toast--alert-sub`,children:[`Block started `,A.timeOnly(e.payload.context.block_start_at,n)]}),(e.payload.axis===`budget`||e.payload.axis===`project_budget`||e.payload.axis===`codex_budget`)&&(e.payload.context.period_start_at??e.payload.context.week_start_at)&&(0,H.jsxs)(`div`,{className:`toast--alert-sub`,children:[Nn(e.payload.context.period),` starting`,` `,A.weekStart((e.payload.context.period_start_at??e.payload.context.week_start_at??``).slice(0,10),n)??`—`]}),(0,H.jsxs)(`div`,{className:`toast--alert-body`,children:[e.payload.context.cumulative_cost_usd!=null&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`span`,{className:`num`,children:[`$`,e.payload.context.cumulative_cost_usd.toFixed(2)]}),` `,`spent`,e.payload.context.dollars_per_percent!=null&&(0,H.jsxs)(H.Fragment,{children:[` `,`·`,` `,(0,H.jsxs)(`span`,{className:`num`,children:[`$`,e.payload.context.dollars_per_percent.toFixed(2)]}),` `,`per 1%`]})]}),e.payload.context.block_cost_usd!=null&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`span`,{className:`num`,children:[`$`,e.payload.context.block_cost_usd.toFixed(2)]}),` `,`in this block`,e.payload.context.primary_model&&(0,H.jsxs)(H.Fragment,{children:[` · model: `,e.payload.context.primary_model]})]}),(e.payload.axis===`budget`||e.payload.axis===`codex_budget`)&&e.payload.context.spent_usd!=null&&e.payload.context.budget_usd!=null&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`span`,{className:`num`,children:[`$`,e.payload.context.spent_usd.toFixed(2)]}),` `,`of`,` `,(0,H.jsxs)(`span`,{className:`num`,children:[`$`,e.payload.context.budget_usd.toFixed(2)]}),` `,`budget`]}),e.payload.axis===`projected`&&(0,H.jsx)(`span`,{className:`num`,children:Fn(e.payload)??`—`}),e.payload.axis===`project_budget`&&e.payload.context.spent_usd!=null&&e.payload.context.budget_usd!=null&&(0,H.jsxs)(H.Fragment,{children:[e.payload.context.project&&(0,H.jsxs)(H.Fragment,{children:[e.payload.context.project,`: `]}),(0,H.jsxs)(`span`,{className:`num`,children:[`$`,e.payload.context.spent_usd.toFixed(2)]}),` `,`of`,` `,(0,H.jsxs)(`span`,{className:`num`,children:[`$`,e.payload.context.budget_usd.toFixed(2)]}),` `,`budget`]})]})]})]})}var lr=h();function ur(){var e=[...arguments];return(0,_.useMemo)(()=>t=>{e.forEach(e=>e(t))},e)}var dr=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function fr(e){let t=Object.prototype.toString.call(e);return t===`[object Window]`||t===`[object global]`}function pr(e){return`nodeType`in e}function mr(e){return e?fr(e)?e:pr(e)?e.ownerDocument?.defaultView??window:window:window}function hr(e){let{Document:t}=mr(e);return e instanceof t}function gr(e){return fr(e)?!1:e instanceof mr(e).HTMLElement}function _r(e){return e instanceof mr(e).SVGElement}function vr(e){return e?fr(e)?e.document:pr(e)?hr(e)?e:gr(e)||_r(e)?e.ownerDocument:document:document:document}var yr=dr?_.useLayoutEffect:_.useEffect;function br(e){let t=(0,_.useRef)(e);return yr(()=>{t.current=e}),(0,_.useCallback)(function(){var e=[...arguments];return t.current==null?void 0:t.current(...e)},[])}function xr(){let e=(0,_.useRef)(null);return[(0,_.useCallback)((t,n)=>{e.current=setInterval(t,n)},[]),(0,_.useCallback)(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[])]}function Sr(e,t){t===void 0&&(t=[e]);let n=(0,_.useRef)(e);return yr(()=>{n.current!==e&&(n.current=e)},t),n}function Cr(e,t){let n=(0,_.useRef)();return(0,_.useMemo)(()=>{let t=e(n.current);return n.current=t,t},[...t])}function wr(e){let t=br(e),n=(0,_.useRef)(null);return[n,(0,_.useCallback)(e=>{e!==n.current&&t?.(e,n.current),n.current=e},[])]}function Tr(e){let t=(0,_.useRef)();return(0,_.useEffect)(()=>{t.current=e},[e]),t.current}var Er={};function Dr(e,t){return(0,_.useMemo)(()=>{if(t)return t;let n=Er[e]==null?0:Er[e]+1;return Er[e]=n,e+`-`+n},[e,t])}function Or(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>{let r=Object.entries(n);for(let[n,i]of r){let r=t[n];r!=null&&(t[n]=r+e*i)}return t},{...t})}}var kr=Or(1),Ar=Or(-1);function jr(e){return`clientX`in e&&`clientY`in e}function Mr(e){if(!e)return!1;let{KeyboardEvent:t}=mr(e.target);return t&&e instanceof t}function Nr(e){if(!e)return!1;let{TouchEvent:t}=mr(e.target);return t&&e instanceof t}function Pr(e){if(Nr(e)){if(e.touches&&e.touches.length){let{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){let{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return jr(e)?{x:e.clientX,y:e.clientY}:null}var Fr=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:n}=e;return`translate3d(`+(t?Math.round(t):0)+`px, `+(n?Math.round(n):0)+`px, 0)`}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:n}=e;return`scaleX(`+t+`) scaleY(`+n+`)`}},Transform:{toString(e){if(e)return[Fr.Translate.toString(e),Fr.Scale.toString(e)].join(` `)}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+` `+n+`ms `+r}}}),Ir=`a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]`;function Lr(e){return e.matches(Ir)?e:e.querySelector(Ir)}var Rr={display:`none`};function zr(e){let{id:t,value:n}=e;return _.createElement(`div`,{id:t,style:Rr},n)}function Br(e){let{id:t,announcement:n,ariaLiveType:r=`assertive`}=e;return _.createElement(`div`,{id:t,style:{position:`fixed`,top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0 0 0 0)`,clipPath:`inset(100%)`,whiteSpace:`nowrap`},role:`status`,"aria-live":r,"aria-atomic":!0},n)}function Vr(){let[e,t]=(0,_.useState)(``);return{announce:(0,_.useCallback)(e=>{e!=null&&t(e)},[]),announcement:e}}var Hr=(0,_.createContext)(null);function Ur(e){let t=(0,_.useContext)(Hr);(0,_.useEffect)(()=>{if(!t)throw Error(`useDndMonitor must be used within a children of <DndContext>`);return t(e)},[e,t])}function Wr(){let[e]=(0,_.useState)(()=>new Set),t=(0,_.useCallback)(t=>(e.add(t),()=>e.delete(t)),[e]);return[(0,_.useCallback)(t=>{let{type:n,event:r}=t;e.forEach(e=>e[n]?.call(e,r))},[e]),t]}var Gr={draggable:`
9
+ To pick up a draggable item, press the space bar.
10
+ While dragging, use the arrow keys to move the item.
11
+ Press space again to drop the item in its new position, or press escape to cancel.
12
+ `},Kr={onDragStart(e){let{active:t}=e;return`Picked up draggable item `+t.id+`.`},onDragOver(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was moved over droppable area `+n.id+`.`:`Draggable item `+t.id+` is no longer over a droppable area.`},onDragEnd(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was dropped over droppable area `+n.id:`Draggable item `+t.id+` was dropped.`},onDragCancel(e){let{active:t}=e;return`Dragging was cancelled. Draggable item `+t.id+` was dropped.`}};function qr(e){let{announcements:t=Kr,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=Gr}=e,{announce:a,announcement:o}=Vr(),s=Dr(`DndLiveRegion`),[c,l]=(0,_.useState)(!1);if((0,_.useEffect)(()=>{l(!0)},[]),Ur((0,_.useMemo)(()=>({onDragStart(e){let{active:n}=e;a(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:r}=e;t.onDragMove&&a(t.onDragMove({active:n,over:r}))},onDragOver(e){let{active:n,over:r}=e;a(t.onDragOver({active:n,over:r}))},onDragEnd(e){let{active:n,over:r}=e;a(t.onDragEnd({active:n,over:r}))},onDragCancel(e){let{active:n,over:r}=e;a(t.onDragCancel({active:n,over:r}))}}),[a,t])),!c)return null;let u=_.createElement(_.Fragment,null,_.createElement(zr,{id:r,value:i.draggable}),_.createElement(Br,{id:s,announcement:o}));return n?(0,lr.createPortal)(u,n):u}var Jr;(function(e){e.DragStart=`dragStart`,e.DragMove=`dragMove`,e.DragEnd=`dragEnd`,e.DragCancel=`dragCancel`,e.DragOver=`dragOver`,e.RegisterDroppable=`registerDroppable`,e.SetDroppableDisabled=`setDroppableDisabled`,e.UnregisterDroppable=`unregisterDroppable`})(Jr||={});function Yr(){}function Xr(e,t){return(0,_.useMemo)(()=>({sensor:e,options:t??{}}),[e,t])}function Zr(){var e=[...arguments];return(0,_.useMemo)(()=>[...e].filter(e=>e!=null),[...e])}var Qr=Object.freeze({x:0,y:0});function $r(e,t){return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)}function ei(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function ti(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function ni(e){let{left:t,top:n,height:r,width:i}=e;return[{x:t,y:n},{x:t+i,y:n},{x:t,y:n+r},{x:t+i,y:n+r}]}function ri(e,t){if(!e||e.length===0)return null;let[n]=e;return t?n[t]:n}function ii(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}var ai=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=ii(t,t.left,t.top),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=$r(ii(r),i);a.push({id:t,data:{droppableContainer:e,value:n}})}}return a.sort(ei)},oi=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=ni(t),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=ni(r),o=i.reduce((e,t,r)=>e+$r(n[r],t),0),s=Number((o/4).toFixed(4));a.push({id:t,data:{droppableContainer:e,value:s}})}}return a.sort(ei)};function si(e,t){let n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),o=i-r,s=a-n;if(r<i&&n<a){let n=t.width*t.height,r=e.width*e.height,i=o*s,a=i/(n+r-i);return Number(a.toFixed(4))}return 0}var ci=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=[];for(let e of r){let{id:r}=e,a=n.get(r);if(a){let n=si(a,t);n>0&&i.push({id:r,data:{droppableContainer:e,value:n}})}}return i.sort(ti)};function li(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function ui(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Qr}function di(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>({...t,top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x}),{...t})}}var fi=di(1);function pi(e){if(e.startsWith(`matrix3d(`)){let t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith(`matrix(`)){let t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function mi(e,t,n){let r=pi(t);if(!r)return e;let{scaleX:i,scaleY:a,x:o,y:s}=r,c=e.left-o-(1-i)*parseFloat(n),l=e.top-s-(1-a)*parseFloat(n.slice(n.indexOf(` `)+1)),u=i?e.width/i:e.width,d=a?e.height/a:e.height;return{width:u,height:d,top:l,right:c+u,bottom:l+d,left:c}}var hi={ignoreTransform:!1};function gi(e,t){t===void 0&&(t=hi);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:t,transformOrigin:r}=mr(e).getComputedStyle(e);t&&(n=mi(n,t,r))}let{top:r,left:i,width:a,height:o,bottom:s,right:c}=n;return{top:r,left:i,width:a,height:o,bottom:s,right:c}}function _i(e){return gi(e,{ignoreTransform:!0})}function vi(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function yi(e,t){return t===void 0&&(t=mr(e).getComputedStyle(e)),t.position===`fixed`}function bi(e,t){t===void 0&&(t=mr(e).getComputedStyle(e));let n=/(auto|scroll|overlay)/;return[`overflow`,`overflowX`,`overflowY`].some(e=>{let r=t[e];return typeof r==`string`?n.test(r):!1})}function xi(e,t){let n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(hr(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!gr(i)||_r(i)||n.includes(i))return n;let a=mr(e).getComputedStyle(i);return i!==e&&bi(i,a)&&n.push(i),yi(i,a)?n:r(i.parentNode)}return e?r(e):n}function Si(e){let[t]=xi(e,1);return t??null}function Ci(e){return!dr||!e?null:fr(e)?e:pr(e)?hr(e)||e===vr(e).scrollingElement?window:gr(e)?e:null:null}function wi(e){return fr(e)?e.scrollX:e.scrollLeft}function Ti(e){return fr(e)?e.scrollY:e.scrollTop}function Ei(e){return{x:wi(e),y:Ti(e)}}var Di;(function(e){e[e.Forward=1]=`Forward`,e[e.Backward=-1]=`Backward`})(Di||={});function Oi(e){return!dr||!e?!1:e===document.scrollingElement}function ki(e){let t={x:0,y:0},n=Oi(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}var Ai={x:.2,y:.2};function ji(e,t,n,r,i){let{top:a,left:o,right:s,bottom:c}=n;r===void 0&&(r=10),i===void 0&&(i=Ai);let{isTop:l,isBottom:u,isLeft:d,isRight:f}=ki(e),p={x:0,y:0},m={x:0,y:0},h={height:t.height*i.y,width:t.width*i.x};return!l&&a<=t.top+h.height?(p.y=Di.Backward,m.y=r*Math.abs((t.top+h.height-a)/h.height)):!u&&c>=t.bottom-h.height&&(p.y=Di.Forward,m.y=r*Math.abs((t.bottom-h.height-c)/h.height)),!f&&s>=t.right-h.width?(p.x=Di.Forward,m.x=r*Math.abs((t.right-h.width-s)/h.width)):!d&&o<=t.left+h.width&&(p.x=Di.Backward,m.x=r*Math.abs((t.left+h.width-o)/h.width)),{direction:p,speed:m}}function Mi(e){if(e===document.scrollingElement){let{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}let{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function Ni(e){return e.reduce((e,t)=>kr(e,Ei(t)),Qr)}function Pi(e){return e.reduce((e,t)=>e+wi(t),0)}function Fi(e){return e.reduce((e,t)=>e+Ti(t),0)}function Ii(e,t){if(t===void 0&&(t=gi),!e)return;let{top:n,left:r,bottom:i,right:a}=t(e);Si(e)&&(i<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:`center`,inline:`center`})}var Li=[[`x`,[`left`,`right`],Pi],[`y`,[`top`,`bottom`],Fi]],Ri=class{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;let n=xi(t),r=Ni(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[e,t,i]of Li)for(let a of t)Object.defineProperty(this,a,{get:()=>{let t=i(n),o=r[e]-t;return this.rect[a]+o},enumerable:!0});Object.defineProperty(this,`rect`,{enumerable:!1})}},zi=class{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>this.target?.removeEventListener(...e))},this.target=e}add(e,t,n){var r;(r=this.target)==null||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}};function Bi(e){let{EventTarget:t}=mr(e);return e instanceof t?e:vr(e)}function Vi(e,t){let n=Math.abs(e.x),r=Math.abs(e.y);return typeof t==`number`?Math.sqrt(n**2+r**2)>t:`x`in t&&`y`in t?n>t.x&&r>t.y:`x`in t?n>t.x:`y`in t?r>t.y:!1}var Hi;(function(e){e.Click=`click`,e.DragStart=`dragstart`,e.Keydown=`keydown`,e.ContextMenu=`contextmenu`,e.Resize=`resize`,e.SelectionChange=`selectionchange`,e.VisibilityChange=`visibilitychange`})(Hi||={});function Ui(e){e.preventDefault()}function Wi(e){e.stopPropagation()}var W;(function(e){e.Space=`Space`,e.Down=`ArrowDown`,e.Right=`ArrowRight`,e.Left=`ArrowLeft`,e.Up=`ArrowUp`,e.Esc=`Escape`,e.Enter=`Enter`,e.Tab=`Tab`})(W||={});var G={start:[W.Space,W.Enter],cancel:[W.Esc],end:[W.Space,W.Enter,W.Tab]},Gi=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case W.Right:return{...n,x:n.x+25};case W.Left:return{...n,x:n.x-25};case W.Down:return{...n,y:n.y+25};case W.Up:return{...n,y:n.y-25}}},Ki=class{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;let{event:{target:t}}=e;this.props=e,this.listeners=new zi(vr(t)),this.windowListeners=new zi(mr(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Hi.Resize,this.handleCancel),this.windowListeners.add(Hi.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Hi.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&Ii(n),t(Qr)}handleKeyDown(e){if(Mr(e)){let{active:t,context:n,options:r}=this.props,{keyboardCodes:i=G,coordinateGetter:a=Gi,scrollBehavior:o=`smooth`}=r,{code:s}=e;if(i.end.includes(s)){this.handleEnd(e);return}if(i.cancel.includes(s)){this.handleCancel(e);return}let{collisionRect:c}=n.current,l=c?{x:c.left,y:c.top}:Qr;this.referenceCoordinates||=l;let u=a(e,{active:t,context:n.current,currentCoordinates:l});if(u){let t=Ar(u,l),r={x:0,y:0},{scrollableAncestors:i}=n.current;for(let n of i){let i=e.code,{isTop:a,isRight:s,isLeft:c,isBottom:l,maxScroll:d,minScroll:f}=ki(n),p=Mi(n),m={x:Math.min(i===W.Right?p.right-p.width/2:p.right,Math.max(i===W.Right?p.left:p.left+p.width/2,u.x)),y:Math.min(i===W.Down?p.bottom-p.height/2:p.bottom,Math.max(i===W.Down?p.top:p.top+p.height/2,u.y))},h=i===W.Right&&!s||i===W.Left&&!c,g=i===W.Down&&!l||i===W.Up&&!a;if(h&&m.x!==u.x){let e=n.scrollLeft+t.x,a=i===W.Right&&e<=d.x||i===W.Left&&e>=f.x;if(a&&!t.y){n.scrollTo({left:e,behavior:o});return}a?r.x=n.scrollLeft-e:r.x=i===W.Right?n.scrollLeft-d.x:n.scrollLeft-f.x,r.x&&n.scrollBy({left:-r.x,behavior:o});break}else if(g&&m.y!==u.y){let e=n.scrollTop+t.y,a=i===W.Down&&e<=d.y||i===W.Up&&e>=f.y;if(a&&!t.x){n.scrollTo({top:e,behavior:o});return}a?r.y=n.scrollTop-e:r.y=i===W.Down?n.scrollTop-d.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:o});break}}this.handleMove(e,kr(Ar(u,this.referenceCoordinates),r))}}}handleMove(e,t){let{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){let{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){let{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}};Ki.activators=[{eventName:`onKeyDown`,handler:(e,t,n)=>{let{keyboardCodes:r=G,onActivation:i}=t,{active:a}=n,{code:o}=e.nativeEvent;if(r.start.includes(o)){let t=a.activatorNode.current;return t&&e.target!==t?!1:(e.preventDefault(),i?.({event:e.nativeEvent}),!0)}return!1}}];function qi(e){return!!(e&&`distance`in e)}function Ji(e){return!!(e&&`delay`in e)}var Yi=class{constructor(e,t,n){n===void 0&&(n=Bi(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;let{event:r}=e,{target:i}=r;this.props=e,this.events=t,this.document=vr(i),this.documentListeners=new zi(this.document),this.listeners=new zi(n),this.windowListeners=new zi(mr(i)),this.initialCoordinates=Pr(r)??Qr,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){let{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(Hi.Resize,this.handleCancel),this.windowListeners.add(Hi.DragStart,Ui),this.windowListeners.add(Hi.VisibilityChange,this.handleCancel),this.windowListeners.add(Hi.ContextMenu,Ui),this.documentListeners.add(Hi.Keydown,this.handleKeydown),t){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Ji(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(qi(t)){this.handlePending(t);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,t){let{active:n,onPending:r}=this.props;r(n,e,this.initialCoordinates,t)}handleStart(){let{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(Hi.Click,Wi,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Hi.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){let{activated:t,initialCoordinates:n,props:r}=this,{onMove:i,options:{activationConstraint:a}}=r;if(!n)return;let o=Pr(e)??Qr,s=Ar(n,o);if(!t&&a){if(qi(a)){if(a.tolerance!=null&&Vi(s,a.tolerance))return this.handleCancel();if(Vi(s,a.distance))return this.handleStart()}if(Ji(a)&&Vi(s,a.tolerance))return this.handleCancel();this.handlePending(a,s);return}e.cancelable&&e.preventDefault(),i(o)}handleEnd(){let{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){let{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===W.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},Xi={cancel:{name:`pointercancel`},move:{name:`pointermove`},end:{name:`pointerup`}},Zi=class extends Yi{constructor(e){let{event:t}=e,n=vr(t.target);super(e,Xi,n)}};Zi.activators=[{eventName:`onPointerDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];var Qi={move:{name:`mousemove`},end:{name:`mouseup`}},$i;(function(e){e[e.RightClick=2]=`RightClick`})($i||={});var ea=class extends Yi{constructor(e){super(e,Qi,vr(e.event.target))}};ea.activators=[{eventName:`onMouseDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===$i.RightClick?!1:(r?.({event:n}),!0)}}];var ta={cancel:{name:`touchcancel`},move:{name:`touchmove`},end:{name:`touchend`}},na=class extends Yi{constructor(e){super(e,ta)}static setup(){return window.addEventListener(ta.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(ta.move.name,e)};function e(){}}};na.activators=[{eventName:`onTouchStart`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t,{touches:i}=n;return i.length>1?!1:(r?.({event:n}),!0)}}];var ra;(function(e){e[e.Pointer=0]=`Pointer`,e[e.DraggableRect=1]=`DraggableRect`})(ra||={});var ia;(function(e){e[e.TreeOrder=0]=`TreeOrder`,e[e.ReversedTreeOrder=1]=`ReversedTreeOrder`})(ia||={});function aa(e){let{acceleration:t,activator:n=ra.Pointer,canScroll:r,draggingRect:i,enabled:a,interval:o=5,order:s=ia.TreeOrder,pointerCoordinates:c,scrollableAncestors:l,scrollableAncestorRects:u,delta:d,threshold:f}=e,p=sa({delta:d,disabled:!a}),[m,h]=xr(),g=(0,_.useRef)({x:0,y:0}),v=(0,_.useRef)({x:0,y:0}),y=(0,_.useMemo)(()=>{switch(n){case ra.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case ra.DraggableRect:return i}},[n,i,c]),b=(0,_.useRef)(null),x=(0,_.useCallback)(()=>{let e=b.current;if(!e)return;let t=g.current.x*v.current.x,n=g.current.y*v.current.y;e.scrollBy(t,n)},[]),S=(0,_.useMemo)(()=>s===ia.TreeOrder?[...l].reverse():l,[s,l]);(0,_.useEffect)(()=>{if(!a||!l.length||!y){h();return}for(let e of S){if(r?.(e)===!1)continue;let n=u[l.indexOf(e)];if(!n)continue;let{direction:i,speed:a}=ji(e,n,y,t,f);for(let e of[`x`,`y`])p[e][i[e]]||(a[e]=0,i[e]=0);if(a.x>0||a.y>0){h(),b.current=e,m(x,o),g.current=a,v.current=i;return}}g.current={x:0,y:0},v.current={x:0,y:0},h()},[t,x,r,h,a,o,JSON.stringify(y),JSON.stringify(p),m,l,S,u,JSON.stringify(f)])}var oa={x:{[Di.Backward]:!1,[Di.Forward]:!1},y:{[Di.Backward]:!1,[Di.Forward]:!1}};function sa(e){let{delta:t,disabled:n}=e,r=Tr(t);return Cr(e=>{if(n||!r||!e)return oa;let i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[Di.Backward]:e.x[Di.Backward]||i.x===-1,[Di.Forward]:e.x[Di.Forward]||i.x===1},y:{[Di.Backward]:e.y[Di.Backward]||i.y===-1,[Di.Forward]:e.y[Di.Forward]||i.y===1}}},[n,t,r])}function ca(e,t){let n=t==null?void 0:e.get(t),r=n?n.node.current:null;return Cr(e=>t==null?null:r??e??null,[r,t])}function la(e,t){return(0,_.useMemo)(()=>e.reduce((e,n)=>{let{sensor:r}=n,i=r.activators.map(e=>({eventName:e.eventName,handler:t(e.handler,n)}));return[...e,...i]},[]),[e,t])}var ua;(function(e){e[e.Always=0]=`Always`,e[e.BeforeDragging=1]=`BeforeDragging`,e[e.WhileDragging=2]=`WhileDragging`})(ua||={});var da;(function(e){e.Optimized=`optimized`})(da||={});var fa=new Map;function pa(e,t){let{dragging:n,dependencies:r,config:i}=t,[a,o]=(0,_.useState)(null),{frequency:s,measure:c,strategy:l}=i,u=(0,_.useRef)(e),d=g(),f=Sr(d),p=(0,_.useCallback)(function(e){e===void 0&&(e=[]),!f.current&&o(t=>t===null?e:t.concat(e.filter(e=>!t.includes(e))))},[f]),m=(0,_.useRef)(null),h=Cr(t=>{if(d&&!n)return fa;if(!t||t===fa||u.current!==e||a!=null){let t=new Map;for(let n of e){if(!n)continue;if(a&&a.length>0&&!a.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}let e=n.node.current,r=e?new Ri(c(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t},[e,a,n,d,c]);return(0,_.useEffect)(()=>{u.current=e},[e]),(0,_.useEffect)(()=>{d||p()},[n,d]),(0,_.useEffect)(()=>{a&&a.length>0&&o(null)},[JSON.stringify(a)]),(0,_.useEffect)(()=>{d||typeof s!=`number`||m.current!==null||(m.current=setTimeout(()=>{p(),m.current=null},s))},[s,d,p,...r]),{droppableRects:h,measureDroppableContainers:p,measuringScheduled:a!=null};function g(){switch(l){case ua.Always:return!1;case ua.BeforeDragging:return n;default:return!n}}}function ma(e,t){return Cr(n=>e?n||(typeof t==`function`?t(e):e):null,[t,e])}function ha(e,t){return ma(e,t)}function ga(e){let{callback:t,disabled:n}=e,r=br(t),i=(0,_.useMemo)(()=>{if(n||typeof window>`u`||window.MutationObserver===void 0)return;let{MutationObserver:e}=window;return new e(r)},[r,n]);return(0,_.useEffect)(()=>()=>i?.disconnect(),[i]),i}function _a(e){let{callback:t,disabled:n}=e,r=br(t),i=(0,_.useMemo)(()=>{if(n||typeof window>`u`||window.ResizeObserver===void 0)return;let{ResizeObserver:e}=window;return new e(r)},[n]);return(0,_.useEffect)(()=>()=>i?.disconnect(),[i]),i}function va(e){return new Ri(gi(e),e)}function ya(e,t,n){t===void 0&&(t=va);let[r,i]=(0,_.useState)(null);function a(){i(r=>{if(!e)return null;if(e.isConnected===!1)return r??n??null;let i=t(e);return JSON.stringify(r)===JSON.stringify(i)?r:i})}let o=ga({callback(t){if(e)for(let n of t){let{type:t,target:r}=n;if(t===`childList`&&r instanceof HTMLElement&&r.contains(e)){a();break}}}}),s=_a({callback:a});return yr(()=>{a(),e?(s?.observe(e),o?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),o?.disconnect())},[e]),r}function ba(e){return ui(e,ma(e))}var xa=[];function Sa(e){let t=(0,_.useRef)(e),n=Cr(n=>e?n&&n!==xa&&e&&t.current&&e.parentNode===t.current.parentNode?n:xi(e):xa,[e]);return(0,_.useEffect)(()=>{t.current=e},[e]),n}function Ca(e){let[t,n]=(0,_.useState)(null),r=(0,_.useRef)(e),i=(0,_.useCallback)(e=>{let t=Ci(e.target);t&&n(e=>e?(e.set(t,Ei(t)),new Map(e)):null)},[]);return(0,_.useEffect)(()=>{let t=r.current;if(e!==t){a(t);let o=e.map(e=>{let t=Ci(e);return t?(t.addEventListener(`scroll`,i,{passive:!0}),[t,Ei(t)]):null}).filter(e=>e!=null);n(o.length?new Map(o):null),r.current=e}return()=>{a(e),a(t)};function a(e){e.forEach(e=>{Ci(e)?.removeEventListener(`scroll`,i)})}},[i,e]),(0,_.useMemo)(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>kr(e,t),Qr):Ni(e):Qr,[e,t])}function wa(e,t){t===void 0&&(t=[]);let n=(0,_.useRef)(null);return(0,_.useEffect)(()=>{n.current=null},t),(0,_.useEffect)(()=>{let t=e!==Qr;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)},[e]),n.current?Ar(e,n.current):Qr}function Ta(e){(0,_.useEffect)(()=>{if(!dr)return;let t=e.map(e=>{let{sensor:t}=e;return t.setup==null?void 0:t.setup()});return()=>{for(let e of t)e?.()}},e.map(e=>{let{sensor:t}=e;return t}))}function Ea(e,t){return(0,_.useMemo)(()=>e.reduce((e,n)=>{let{eventName:r,handler:i}=n;return e[r]=e=>{i(e,t)},e},{}),[e,t])}function Da(e){return(0,_.useMemo)(()=>e?vi(e):null,[e])}var Oa=[];function ka(e,t){t===void 0&&(t=gi);let[n]=e,r=Da(n?mr(n):null),[i,a]=(0,_.useState)(Oa);function o(){a(()=>e.length?e.map(e=>Oi(e)?r:new Ri(t(e),e)):Oa)}let s=_a({callback:o});return yr(()=>{s?.disconnect(),o(),e.forEach(e=>s?.observe(e))},[e]),i}function Aa(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return gr(t)?t:e}function ja(e){let{measure:t}=e,[n,r]=(0,_.useState)(null),i=_a({callback:(0,_.useCallback)(e=>{for(let{target:n}of e)if(gr(n)){r(e=>{let r=t(n);return e?{...e,width:r.width,height:r.height}:r});break}},[t])}),[a,o]=wr((0,_.useCallback)(e=>{let n=Aa(e);i?.disconnect(),n&&i?.observe(n),r(n?t(n):null)},[t,i]));return(0,_.useMemo)(()=>({nodeRef:a,rect:n,setRef:o}),[n,a,o])}var Ma=[{sensor:Zi,options:{}},{sensor:Ki,options:{}}],Na={current:{}},Pa={draggable:{measure:_i},droppable:{measure:_i,strategy:ua.WhileDragging,frequency:da.Optimized},dragOverlay:{measure:gi}},Fa=class extends Map{get(e){return e==null?void 0:super.get(e)??void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:t}=e;return!t})}getNodeFor(e){return this.get(e)?.node.current??void 0}},Ia={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Fa,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Yr},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Pa,measureDroppableContainers:Yr,windowRect:null,measuringScheduled:!1},La={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:``},dispatch:Yr,draggableNodes:new Map,over:null,measureDroppableContainers:Yr},Ra=(0,_.createContext)(La),za=(0,_.createContext)(Ia);function Ba(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Fa}}}function Va(e,t){switch(t.type){case Jr.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Jr.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case Jr.DragEnd:case Jr.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Jr.RegisterDroppable:{let{element:n}=t,{id:r}=n,i=new Fa(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case Jr.SetDroppableDisabled:{let{id:n,key:r,disabled:i}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;let o=new Fa(e.droppable.containers);return o.set(n,{...a,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case Jr.UnregisterDroppable:{let{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;let a=new Fa(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function Ha(e){let{disabled:t}=e,{active:n,activatorEvent:r,draggableNodes:i}=(0,_.useContext)(Ra),a=Tr(r),o=Tr(n?.id);return(0,_.useEffect)(()=>{if(!t&&!r&&a&&o!=null){if(!Mr(a)||document.activeElement===a.target)return;let e=i.get(o);if(!e)return;let{activatorNode:t,node:n}=e;if(!t.current&&!n.current)return;requestAnimationFrame(()=>{for(let e of[t.current,n.current]){if(!e)continue;let t=Lr(e);if(t){t.focus();break}}})}},[r,t,i,o,a]),null}function Ua(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}function Wa(e){return(0,_.useMemo)(()=>({draggable:{...Pa.draggable,...e?.draggable},droppable:{...Pa.droppable,...e?.droppable},dragOverlay:{...Pa.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function Ga(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e,a=(0,_.useRef)(!1),{x:o,y:s}=typeof i==`boolean`?{x:i,y:i}:i;yr(()=>{if(!o&&!s||!t){a.current=!1;return}if(a.current||!r)return;let e=t?.node.current;if(!e||e.isConnected===!1)return;let i=ui(n(e),r);if(o||(i.x=0),s||(i.y=0),a.current=!0,Math.abs(i.x)>0||Math.abs(i.y)>0){let t=Si(e);t&&t.scrollBy({top:i.y,left:i.x})}},[t,o,s,r,n])}var Ka=(0,_.createContext)({...Qr,scaleX:1,scaleY:1}),qa;(function(e){e[e.Uninitialized=0]=`Uninitialized`,e[e.Initializing=1]=`Initializing`,e[e.Initialized=2]=`Initialized`})(qa||={});var Ja=(0,_.memo)(function(e){let{id:t,accessibility:n,autoScroll:r=!0,children:i,sensors:a=Ma,collisionDetection:o=ci,measuring:s,modifiers:c,...l}=e,[u,d]=(0,_.useReducer)(Va,void 0,Ba),[f,p]=Wr(),[m,h]=(0,_.useState)(qa.Uninitialized),g=m===qa.Initialized,{draggable:{active:v,nodes:y,translate:b},droppable:{containers:x}}=u,S=v==null?null:y.get(v),C=(0,_.useRef)({initial:null,translated:null}),w=(0,_.useMemo)(()=>v==null?null:{id:v,data:S?.data??Na,rect:C},[v,S]),T=(0,_.useRef)(null),[E,D]=(0,_.useState)(null),[O,k]=(0,_.useState)(null),A=Sr(l,Object.values(l)),j=Dr(`DndDescribedBy`,t),M=(0,_.useMemo)(()=>x.getEnabled(),[x]),N=Wa(s),{droppableRects:P,measureDroppableContainers:ee,measuringScheduled:te}=pa(M,{dragging:g,dependencies:[b.x,b.y],config:N.droppable}),ne=ca(y,v),re=(0,_.useMemo)(()=>O?Pr(O):null,[O]),F=je(),ie=ha(ne,N.draggable.measure);Ga({activeNode:v==null?null:y.get(v),config:F.layoutShiftCompensation,initialRect:ie,measure:N.draggable.measure});let ae=ya(ne,N.draggable.measure,ie),oe=ya(ne?ne.parentElement:null),se=(0,_.useRef)({activatorEvent:null,active:null,activeNode:ne,collisionRect:null,collisions:null,droppableRects:P,draggableNodes:y,draggingNode:null,draggingNodeRect:null,droppableContainers:x,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ce=x.getNodeFor(se.current.over?.id),I=ja({measure:N.dragOverlay.measure}),le=I.nodeRef.current??ne,ue=g?I.rect??ae:null,de=!!(I.nodeRef.current&&I.rect),fe=ba(de?null:ae),L=Da(le?mr(le):null),pe=Sa(g?ce??ne:null),me=ka(pe),he=Ua(c,{transform:{x:b.x-fe.x,y:b.y-fe.y,scaleX:1,scaleY:1},activatorEvent:O,active:w,activeNodeRect:ae,containerNodeRect:oe,draggingNodeRect:ue,over:se.current.over,overlayNodeRect:I.rect,scrollableAncestors:pe,scrollableAncestorRects:me,windowRect:L}),ge=re?kr(re,b):null,_e=Ca(pe),ve=wa(_e),ye=wa(_e,[ae]),be=kr(he,ve),xe=ue?fi(ue,he):null,Se=w&&xe?o({active:w,collisionRect:xe,droppableRects:P,droppableContainers:M,pointerCoordinates:ge}):null,Ce=ri(Se,`id`),[we,Te]=(0,_.useState)(null),Ee=li(de?he:kr(he,ye),we?.rect??null,ae),De=(0,_.useRef)(null),Oe=(0,_.useCallback)((e,t)=>{let{sensor:n,options:r}=t;if(T.current==null)return;let i=y.get(T.current);if(!i)return;let a=e.nativeEvent;De.current=new n({active:T.current,activeNode:i,event:a,options:r,context:se,onAbort(e){if(!y.get(e))return;let{onDragAbort:t}=A.current,n={id:e};t?.(n),f({type:`onDragAbort`,event:n})},onPending(e,t,n,r){if(!y.get(e))return;let{onDragPending:i}=A.current,a={id:e,constraint:t,initialCoordinates:n,offset:r};i?.(a),f({type:`onDragPending`,event:a})},onStart(e){let t=T.current;if(t==null)return;let n=y.get(t);if(!n)return;let{onDragStart:r}=A.current,i={activatorEvent:a,active:{id:t,data:n.data,rect:C}};(0,lr.unstable_batchedUpdates)(()=>{r?.(i),h(qa.Initializing),d({type:Jr.DragStart,initialCoordinates:e,active:t}),f({type:`onDragStart`,event:i}),D(De.current),k(a)})},onMove(e){d({type:Jr.DragMove,coordinates:e})},onEnd:o(Jr.DragEnd),onCancel:o(Jr.DragCancel)});function o(e){return async function(){let{active:t,collisions:n,over:r,scrollAdjustedTranslate:i}=se.current,o=null;if(t&&i){let{cancelDrop:s}=A.current;o={activatorEvent:a,active:t,collisions:n,delta:i,over:r},e===Jr.DragEnd&&typeof s==`function`&&await Promise.resolve(s(o))&&(e=Jr.DragCancel)}T.current=null,(0,lr.unstable_batchedUpdates)(()=>{d({type:e}),h(qa.Uninitialized),Te(null),D(null),k(null),De.current=null;let t=e===Jr.DragEnd?`onDragEnd`:`onDragCancel`;if(o){let e=A.current[t];e?.(o),f({type:t,event:o})}})}}},[y]),ke=la(a,(0,_.useCallback)((e,t)=>(n,r)=>{let i=n.nativeEvent,a=y.get(r);if(T.current!==null||!a||i.dndKit||i.defaultPrevented)return;let o={active:a};e(n,t.options,o)===!0&&(i.dndKit={capturedBy:t.sensor},T.current=r,Oe(n,t))},[y,Oe]));Ta(a),yr(()=>{ae&&m===qa.Initializing&&h(qa.Initialized)},[ae,m]),(0,_.useEffect)(()=>{let{onDragMove:e}=A.current,{active:t,activatorEvent:n,collisions:r,over:i}=se.current;if(!t||!n)return;let a={active:t,activatorEvent:n,collisions:r,delta:{x:be.x,y:be.y},over:i};(0,lr.unstable_batchedUpdates)(()=>{e?.(a),f({type:`onDragMove`,event:a})})},[be.x,be.y]),(0,_.useEffect)(()=>{let{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:i}=se.current;if(!e||T.current==null||!t||!i)return;let{onDragOver:a}=A.current,o=r.get(Ce),s=o&&o.rect.current?{id:o.id,rect:o.rect.current,data:o.data,disabled:o.disabled}:null,c={active:e,activatorEvent:t,collisions:n,delta:{x:i.x,y:i.y},over:s};(0,lr.unstable_batchedUpdates)(()=>{Te(s),a?.(c),f({type:`onDragOver`,event:c})})},[Ce]),yr(()=>{se.current={activatorEvent:O,active:w,activeNode:ne,collisionRect:xe,collisions:Se,droppableRects:P,draggableNodes:y,draggingNode:le,draggingNodeRect:ue,droppableContainers:x,over:we,scrollableAncestors:pe,scrollAdjustedTranslate:be},C.current={initial:ue,translated:xe}},[w,ne,Se,xe,y,le,ue,P,x,we,pe,be]),aa({...F,delta:b,draggingRect:xe,pointerCoordinates:ge,scrollableAncestors:pe,scrollableAncestorRects:me});let Ae=(0,_.useMemo)(()=>({active:w,activeNode:ne,activeNodeRect:ae,activatorEvent:O,collisions:Se,containerNodeRect:oe,dragOverlay:I,draggableNodes:y,droppableContainers:x,droppableRects:P,over:we,measureDroppableContainers:ee,scrollableAncestors:pe,scrollableAncestorRects:me,measuringConfiguration:N,measuringScheduled:te,windowRect:L}),[w,ne,ae,O,Se,oe,I,y,x,P,we,ee,pe,me,N,te,L]),R=(0,_.useMemo)(()=>({activatorEvent:O,activators:ke,active:w,activeNodeRect:ae,ariaDescribedById:{draggable:j},dispatch:d,draggableNodes:y,over:we,measureDroppableContainers:ee}),[O,ke,w,ae,d,j,y,we,ee]);return _.createElement(Hr.Provider,{value:p},_.createElement(Ra.Provider,{value:R},_.createElement(za.Provider,{value:Ae},_.createElement(Ka.Provider,{value:Ee},i)),_.createElement(Ha,{disabled:n?.restoreFocus===!1})),_.createElement(qr,{...n,hiddenTextDescribedById:j}));function je(){let e=E?.autoScrollEnabled===!1,t=typeof r==`object`?r.enabled===!1:r===!1,n=g&&!e&&!t;return typeof r==`object`?{...r,enabled:n}:{enabled:n}}}),Ya=(0,_.createContext)(null),Xa=`button`,Za=`Draggable`;function Qa(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e,a=Dr(Za),{activators:o,activatorEvent:s,active:c,activeNodeRect:l,ariaDescribedById:u,draggableNodes:d,over:f}=(0,_.useContext)(Ra),{role:p=Xa,roleDescription:m=`draggable`,tabIndex:h=0}=i??{},g=c?.id===t,v=(0,_.useContext)(g?Ka:Ya),[y,b]=wr(),[x,S]=wr(),C=Ea(o,t),w=Sr(n);return yr(()=>(d.set(t,{id:t,key:a,node:y,activatorNode:x,data:w}),()=>{let e=d.get(t);e&&e.key===a&&d.delete(t)}),[d,t]),{active:c,activatorEvent:s,activeNodeRect:l,attributes:(0,_.useMemo)(()=>({role:p,tabIndex:h,"aria-disabled":r,"aria-pressed":g&&p===Xa?!0:void 0,"aria-roledescription":m,"aria-describedby":u.draggable}),[r,p,h,g,m,u.draggable]),isDragging:g,listeners:r?void 0:C,node:y,over:f,setNodeRef:b,setActivatorNodeRef:S,transform:v}}function $a(){return(0,_.useContext)(za)}var eo=`Droppable`,to={timeout:25};function no(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e,a=Dr(eo),{active:o,dispatch:s,over:c,measureDroppableContainers:l}=(0,_.useContext)(Ra),u=(0,_.useRef)({disabled:n}),d=(0,_.useRef)(!1),f=(0,_.useRef)(null),p=(0,_.useRef)(null),{disabled:m,updateMeasurementsFor:h,timeout:g}={...to,...i},v=Sr(h??r),y=_a({callback:(0,_.useCallback)(()=>{if(!d.current){d.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{l(Array.isArray(v.current)?v.current:[v.current]),p.current=null},g)},[g]),disabled:m||!o}),[b,x]=wr((0,_.useCallback)((e,t)=>{y&&(t&&(y.unobserve(t),d.current=!1),e&&y.observe(e))},[y])),S=Sr(t);return(0,_.useEffect)(()=>{!y||!b.current||(y.disconnect(),d.current=!1,y.observe(b.current))},[b,y]),(0,_.useEffect)(()=>(s({type:Jr.RegisterDroppable,element:{id:r,key:a,disabled:n,node:b,rect:f,data:S}}),()=>s({type:Jr.UnregisterDroppable,key:a,id:r})),[r]),(0,_.useEffect)(()=>{n!==u.current.disabled&&(s({type:Jr.SetDroppableDisabled,id:r,key:a,disabled:n}),u.current.disabled=n)},[r,a,n,s]),{active:o,rect:f,isOver:c?.id===r,node:b,over:c,setNodeRef:x}}function ro(e,t,n){let r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function io(e,t){return e.reduce((e,n,r)=>{let i=t.get(n);return i&&(e[r]=i),e},Array(e.length))}function ao(e){return e!==null&&e>=0}function oo(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 so(e){return typeof e==`boolean`?{draggable:e,droppable:e}:e}var co=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e,a=ro(t,r,n),o=t[i],s=a[i];return!s||!o?null:{x:s.left-o.left,y:s.top-o.top,scaleX:s.width/o.width,scaleY:s.height/o.height}},lo=`Sortable`,uo=_.createContext({activeIndex:-1,containerId:lo,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:co,disabled:{draggable:!1,droppable:!1}});function fo(e){let{children:t,id:n,items:r,strategy:i=co,disabled:a=!1}=e,{active:o,dragOverlay:s,droppableRects:c,over:l,measureDroppableContainers:u}=$a(),d=Dr(lo,n),f=s.rect!==null,p=(0,_.useMemo)(()=>r.map(e=>typeof e==`object`&&`id`in e?e.id:e),[r]),m=o!=null,h=o?p.indexOf(o.id):-1,g=l?p.indexOf(l.id):-1,v=(0,_.useRef)(p),y=!oo(p,v.current),b=g!==-1&&h===-1||y,x=so(a);yr(()=>{y&&m&&u(p)},[y,p,m,u]),(0,_.useEffect)(()=>{v.current=p},[p]);let S=(0,_.useMemo)(()=>({activeIndex:h,containerId:d,disabled:x,disableTransforms:b,items:p,overIndex:g,useDragOverlay:f,sortedRects:io(p,c),strategy:i}),[h,d,x.draggable,x.droppable,b,p,g,c,f,i]);return _.createElement(uo.Provider,{value:S},t)}var po=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return ro(n,r,i).indexOf(t)},mo=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:i,items:a,newIndex:o,previousItems:s,previousContainerId:c,transition:l}=e;return!l||!r||s!==a&&i===o?!1:n?!0:o!==i&&t===c},ho={duration:200,easing:`ease`},go=`transform`,_o=Fr.Transition.toString({property:go,duration:0,easing:`linear`}),vo={roleDescription:`sortable`};function yo(e){let{disabled:t,index:n,node:r,rect:i}=e,[a,o]=(0,_.useState)(null),s=(0,_.useRef)(n);return yr(()=>{if(!t&&n!==s.current&&r.current){let e=i.current;if(e){let t=gi(r.current,{ignoreTransform:!0}),n={x:e.left-t.left,y:e.top-t.top,scaleX:e.width/t.width,scaleY:e.height/t.height};(n.x||n.y)&&o(n)}}n!==s.current&&(s.current=n)},[t,n,r,i]),(0,_.useEffect)(()=>{a&&o(null)},[a]),a}function bo(e){let{animateLayoutChanges:t=mo,attributes:n,disabled:r,data:i,getNewIndex:a=po,id:o,strategy:s,resizeObserverConfig:c,transition:l=ho}=e,{items:u,containerId:d,activeIndex:f,disabled:p,disableTransforms:m,sortedRects:h,overIndex:g,useDragOverlay:v,strategy:y}=(0,_.useContext)(uo),b=xo(r,p),x=u.indexOf(o),S=(0,_.useMemo)(()=>({sortable:{containerId:d,index:x,items:u},...i}),[d,i,x,u]),C=(0,_.useMemo)(()=>u.slice(u.indexOf(o)),[u,o]),{rect:w,node:T,isOver:E,setNodeRef:D}=no({id:o,data:S,disabled:b.droppable,resizeObserverConfig:{updateMeasurementsFor:C,...c}}),{active:O,activatorEvent:k,activeNodeRect:A,attributes:j,setNodeRef:M,listeners:N,isDragging:P,over:ee,setActivatorNodeRef:te,transform:ne}=Qa({id:o,data:S,attributes:{...vo,...n},disabled:b.draggable}),re=ur(D,M),F=!!O,ie=F&&!m&&ao(f)&&ao(g),ae=!v&&P,oe=ie?(ae&&ie?ne:null)??(s??y)({rects:h,activeNodeRect:A,activeIndex:f,overIndex:g,index:x}):null,se=ao(f)&&ao(g)?a({id:o,items:u,activeIndex:f,overIndex:g}):x,ce=O?.id,I=(0,_.useRef)({activeId:ce,items:u,newIndex:se,containerId:d}),le=u!==I.current.items,ue=t({active:O,containerId:d,isDragging:P,isSorting:F,id:o,index:x,items:u,newIndex:I.current.newIndex,previousItems:I.current.items,previousContainerId:I.current.containerId,transition:l,wasDragging:I.current.activeId!=null}),de=yo({disabled:!ue,index:x,node:T,rect:w});return(0,_.useEffect)(()=>{F&&I.current.newIndex!==se&&(I.current.newIndex=se),d!==I.current.containerId&&(I.current.containerId=d),u!==I.current.items&&(I.current.items=u)},[F,se,d,u]),(0,_.useEffect)(()=>{if(ce===I.current.activeId)return;if(ce!=null&&I.current.activeId==null){I.current.activeId=ce;return}let e=setTimeout(()=>{I.current.activeId=ce},50);return()=>clearTimeout(e)},[ce]),{active:O,activeIndex:f,attributes:j,data:S,rect:w,index:x,newIndex:se,items:u,isOver:E,isSorting:F,isDragging:P,listeners:N,node:T,overIndex:g,over:ee,setNodeRef:re,setActivatorNodeRef:te,setDroppableNodeRef:D,setDraggableNodeRef:M,transform:de??oe,transition:fe()};function fe(){if(de||le&&I.current.newIndex===x)return _o;if(!(ae&&!Mr(k)||!l)&&(F||ue))return Fr.Transition.toString({...l,property:go})}}function xo(e,t){return typeof e==`boolean`?{draggable:e,droppable:!1}:{draggable:e?.draggable??t.draggable,droppable:e?.droppable??t.droppable}}function So(e){if(!e)return!1;let t=e.data.current;return!!(t&&`sortable`in t&&typeof t.sortable==`object`&&`containerId`in t.sortable&&`items`in t.sortable&&`index`in t.sortable)}var Co=[W.Down,W.Right,W.Up,W.Left],wo=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:i,droppableContainers:a,over:o,scrollableAncestors:s}}=t;if(Co.includes(e.code)){if(e.preventDefault(),!n||!r)return;let t=[];a.getEnabled().forEach(n=>{if(!n||n!=null&&n.disabled)return;let a=i.get(n.id);if(a)switch(e.code){case W.Down:r.top<a.top&&t.push(n);break;case W.Up:r.top>a.top&&t.push(n);break;case W.Left:r.left>a.left&&t.push(n);break;case W.Right:r.left<a.left&&t.push(n);break}});let c=oi({active:n,collisionRect:r,droppableRects:i,droppableContainers:t,pointerCoordinates:null}),l=ri(c,`id`);if(l===o?.id&&c.length>1&&(l=c[1].id),l!=null){let e=a.get(n.id),t=a.get(l),o=t?i.get(t.id):null,c=t?.node.current;if(c&&o&&e&&t){let n=xi(c).some((e,t)=>s[t]!==e),i=To(e,t),a=Eo(e,t),l=n||!i?{x:0,y:0}:{x:a?r.width-o.width:0,y:a?r.height-o.height:0},u={x:o.left,y:o.top};return l.x&&l.y?u:Ar(u,l)}}}};function To(e,t){return!So(e)||!So(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function Eo(e,t){return!So(e)||!So(t)||!To(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}var Do=!1;function Oo(){return Do}function ko(){Do=!0,setTimeout(()=>{Do=!1},0)}var Ao=`(prefers-reduced-motion: reduce)`;function jo(){return(0,_.useSyncExternalStore)(e=>{if(typeof window>`u`||!window.matchMedia)return()=>{};let t=window.matchMedia(Ao);return t.addEventListener(`change`,e),()=>t.removeEventListener(`change`,e)},()=>typeof window>`u`||!window.matchMedia?!1:window.matchMedia(Ao).matches,()=>!1)}function Mo({id:e,index:t}){let n=Kn[e],r=(0,_.useSyncExternalStore)(B,()=>z().openModal!=null),i=jo(),{listeners:a,setNodeRef:o,transform:s,transition:c,isDragging:l}=bo({id:e,disabled:r});if(!n)return null;let{Component:u,label:d}=n;return(0,H.jsxs)(`div`,{ref:o,style:{transform:Fr.Transform.toString(s),transition:i?void 0:c},className:`panel-host${l?` is-dragging`:``}`,"data-panel-host":e,"data-panel-index":t,"aria-label":`Reorder ${d}`,onKeyDown:e=>{if(!e.shiftKey)return;let n=e.target;if(typeof n.matches==`function`&&n.matches(`input, textarea, select, [contenteditable="true"]`))return;let r=0;e.key===`ArrowDown`||e.key===`ArrowRight`?r=1:(e.key===`ArrowUp`||e.key===`ArrowLeft`)&&(r=-1),r!==0&&(typeof e.preventDefault==`function`&&e.preventDefault(),V({type:`SWAP_PANELS`,index:t,direction:r}))},onClickCapture:e=>{Oo()&&e.stopPropagation()},...a,children:[(0,H.jsx)(`span`,{className:`panel-grip-hint`,"aria-hidden":`true`,children:`hold to rearrange`}),(0,H.jsx)(u,{})]})}var No=250,Po=5;function Fo(){ko()}function Io(e,t){if(ko(),!t||e===t)return;let n=z().prefs.panelOrder,r=n.indexOf(e),i=n.indexOf(t);r<0||i<0||r===i||V({type:`REORDER_PANELS`,from:r,to:i})}function Lo(){ko()}function Ro({items:e,children:t}){return(0,H.jsx)(Ja,{sensors:Zr(Xr(Zi,{activationConstraint:{delay:No,tolerance:Po}})),onDragStart:()=>Fo(),onDragEnd:e=>{let t=e.active.id;Io(t,e.over?e.over.id:null)},onDragCancel:()=>Lo(),children:(0,H.jsx)(fo,{items:(0,_.useMemo)(()=>e.slice(),[e]),strategy:co,children:t})})}function zo(){let[e,t]=(0,_.useState)(null),[n,r]=(0,_.useState)(!1),[i,a]=(0,_.useState)(null);return{report:e,loading:n,error:i,refresh:(0,_.useCallback)(async()=>{r(!0),a(null);try{let e=await fetch(`/api/doctor`);if(!e.ok)throw Error(`HTTP ${e.status}`);t(await e.json())}catch(e){a(e instanceof Error?e.message:String(e))}finally{r(!1)}},[])}}var Bo={ok:`✓`,warn:`⚠`,fail:`✗`};function Vo(){let e=(0,_.useSyncExternalStore)(B,()=>z().doctorModalOpen),{report:t,loading:n,error:r,refresh:i}=zo(),a=()=>{V({type:`CLOSE_DOCTOR_MODAL`})};return Ut((0,_.useMemo)(()=>[{key:`Escape`,scope:`modal`,action:a,when:()=>z().doctorModalOpen}],[])),(0,_.useEffect)(()=>{e&&i()},[e,i]),e?(0,H.jsxs)(`div`,{className:`update-modal-root`,onClick:a,children:[(0,H.jsx)(`div`,{className:`modal-backdrop`}),(0,H.jsxs)(`div`,{className:`modal-card doctor-modal-card`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`doctor-modal-title`,onClick:e=>e.stopPropagation(),children:[(0,H.jsxs)(`header`,{className:`modal-header`,children:[(0,H.jsx)(`h2`,{id:`doctor-modal-title`,children:`Doctor`}),(0,H.jsxs)(`div`,{className:`doctor-modal__header-actions`,children:[(0,H.jsx)(`button`,{type:`button`,className:`doctor-modal__refresh`,onClick:()=>{i()},disabled:n,"aria-label":`Refresh doctor report`,children:n?`refreshing…`:`↻ refresh`}),(0,H.jsx)(`button`,{type:`button`,className:`modal-close`,"aria-label":`Close`,onClick:a,children:`×`})]})]}),(0,H.jsxs)(`div`,{className:`modal-body`,children:[n&&!t&&(0,H.jsx)(`p`,{children:`Loading…`}),r&&(0,H.jsxs)(`p`,{className:`doctor-modal__error`,children:[`Error loading report: `,r]}),t&&(0,H.jsx)(Ho,{report:t})]})]})]}):null}function Ho({report:e}){let{counts:t}=e.overall;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`p`,{className:`doctor-modal__summary`,children:[t.ok,` OK · `,t.warn,` WARN · `,t.fail,` FAIL`]}),e.categories.map(e=>(0,H.jsx)(Uo,{cat:e,defaultOpen:e.severity!==`ok`},e.id))]})}function Uo({cat:e,defaultOpen:t}){let[n,r]=(0,_.useState)(t);return(0,H.jsxs)(`section`,{className:`doctor-modal__category doctor-modal__category--${e.severity}`,children:[(0,H.jsxs)(`button`,{type:`button`,className:`doctor-modal__category-header`,onClick:()=>r(e=>!e),"aria-expanded":n,children:[(0,H.jsx)(`span`,{className:`doctor-modal__glyph`,"aria-hidden":`true`,children:Bo[e.severity]}),(0,H.jsx)(`span`,{children:e.title})]}),n&&e.checks.map(e=>(0,H.jsx)(Wo,{c:e},e.id))]})}function Wo({c:e}){let[t,n]=(0,_.useState)(!1),r=e.details&&Object.keys(e.details).length>0;return(0,H.jsxs)(`div`,{className:`doctor-modal__check doctor-modal__check--${e.severity}`,children:[(0,H.jsxs)(`p`,{children:[(0,H.jsx)(`span`,{className:`doctor-modal__glyph`,"aria-label":e.severity,children:Bo[e.severity]}),` `,(0,H.jsx)(`strong`,{children:e.title}),`: `,e.summary]}),e.remediation&&(0,H.jsxs)(`p`,{className:`doctor-modal__remediation`,children:[`→ `,e.remediation]}),r&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`button`,{type:`button`,className:`doctor-modal__details-toggle`,onClick:()=>n(e=>!e),"aria-expanded":t,children:[t?`▼`:`▶`,` details`]}),t&&(0,H.jsx)(`pre`,{className:`doctor-modal__details`,children:JSON.stringify(e.details,null,2)})]})]})}var Go={brew:`Homebrew`,npm:`npm`,unknown:`unknown`};function Ko(){let e=(0,_.useSyncExternalStore)(B,()=>z().update).state;if(!e)return null;let t=e.method,n=Go[t]??t,r=e.update_command??``,i=t===`unknown`||!r;return(0,H.jsxs)(`div`,{className:`update-modal-body`,children:[(0,H.jsxs)(`div`,{className:`update-kv`,children:[(0,H.jsx)(`span`,{className:`k`,children:`Current`}),(0,H.jsx)(`span`,{className:`v`,children:e.current_version??`—`}),(0,H.jsx)(`span`,{className:`k`,children:`Latest`}),(0,H.jsx)(`span`,{className:`v`,children:e.latest_version??`—`}),(0,H.jsx)(`span`,{className:`k`,children:`Method`}),(0,H.jsxs)(`span`,{className:`v`,children:[n,(0,H.jsx)(`span`,{className:`muted`,children:` (auto-detected)`})]})]}),i?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{className:`update-row-label`,children:`Update manually`}),(0,H.jsxs)(`p`,{className:`update-manual-note`,children:[`Couldn't auto-detect this install's package manager. See `,(0,H.jsx)(`a`,{href:`https://github.com/omrikais/cctally#updating`,target:`_blank`,rel:`noopener noreferrer`,children:`Updating`}),` for the manual recipe.`]})]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{className:`update-row-label`,children:`Will run`}),(0,H.jsx)(`code`,{className:`update-cmd`,children:r})]}),e.release_notes_url?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{className:`update-row-label`,children:`Release notes`}),(0,H.jsx)(`div`,{className:`update-link`,children:(0,H.jsxs)(`a`,{href:e.release_notes_url,target:`_blank`,rel:`noopener noreferrer`,children:[`↗ `,e.release_notes_url.replace(/^https?:\/\//,``)]})})]}):null,e.prerelease_note?(0,H.jsx)(`div`,{className:`update-prerelease-note`,role:`note`,"aria-label":`Prerelease note`,children:e.prerelease_note}):null,(0,H.jsxs)(`div`,{className:`update-actions`,children:[(0,H.jsx)(`button`,{type:`button`,className:`update-btn update-btn-primary`,disabled:i,onClick:()=>at.start(),children:`Update now`}),(0,H.jsx)(`button`,{type:`button`,className:`update-btn`,disabled:!e.latest_version,onClick:()=>at.skip(e.latest_version),children:`Skip this version`}),(0,H.jsx)(`button`,{type:`button`,className:`update-btn`,onClick:()=>at.remind(7),children:`Remind in 7 days`})]})]})}function qo({events:e,maxLines:t=500}){let n=(0,_.useRef)(null),r=(0,_.useRef)(!0),i=e.filter(e=>e.type===`stdout`||e.type===`stderr`||e.type===`step`||e.type===`exit`),a=i.slice(-t),o=i.length-a.length;(0,_.useEffect)(()=>{let e=n.current;e&&r.current&&(e.scrollTop=e.scrollHeight)},[e.length]);function s(e){let t=e.currentTarget;r.current=t.scrollHeight-t.scrollTop-t.clientHeight<8}return a.length===0?(0,H.jsx)(`pre`,{className:`update-stream`,ref:n,onScroll:s,"aria-live":`polite`,"aria-label":`Update output`,children:(0,H.jsx)(`span`,{className:`update-stream-empty`,children:`Waiting for output…`})}):(0,H.jsxs)(`pre`,{className:`update-stream`,ref:n,onScroll:s,"aria-live":`polite`,"aria-label":`Update output`,children:[o>0?(0,H.jsxs)(`span`,{className:`update-stream-trunc`,children:[`(… `,o,` earlier line`,o===1?``:`s`,` truncated)`,`
13
+ `]}):null,a.map((e,t)=>e.type===`step`?(0,H.jsxs)(`span`,{className:`update-stream-step`,children:[`==> `,e.name??e.step??e.data??``,`
14
+ `]},t):e.type===`stderr`?(0,H.jsxs)(`span`,{className:`update-stream-line err`,children:[e.data??``,`
15
+ `]},t):e.type===`exit`?(0,H.jsxs)(`span`,{className:`update-stream-exit`,children:[`(exited rc=${e.rc??`?`})`,`
16
+ `]},t):(0,H.jsxs)(`span`,{className:`update-stream-line`,children:[e.data??``,`
17
+ `]},t))]})}var Jo=3e3,Yo=1e3;function Xo(e){if(e==null)return`0s`;let t=Math.max(0,Math.round((Date.now()-e)/1e3));return t<60?`${t}s`:`${Math.floor(t/60)}m ${t%60}s`}function Zo(){let e=(0,_.useSyncExternalStore)(B,()=>z().update),t=e.runId,n=e.startedAt,r=e.state?.update_command??``,i=e.state?.latest_version??``,[,a]=(0,_.useState)(0);(0,_.useEffect)(()=>{let e=window.setInterval(()=>a(e=>e+1),1e3);return()=>window.clearInterval(e)},[]);let o=(0,_.useRef)(!1);return(0,_.useEffect)(()=>{if(!t)return;let e=null,n=null,r=null,i=!1;o.current=!0;function a(){r!=null&&(window.clearTimeout(r),r=null),o.current=!1}function s(t,n){a();let r={};try{t instanceof MessageEvent&&typeof t.data==`string`&&(r=JSON.parse(t.data))}catch{}if(V({type:`APPEND_UPDATE_STREAM`,event:{type:n,data:typeof r.data==`string`?r.data:void 0,name:typeof r.name==`string`?r.name:void 0,rc:typeof r.rc==`number`?r.rc:void 0,step:typeof r.step==`string`?r.step:void 0,message:typeof r.message==`string`?r.message:void 0,ts:typeof r.ts==`number`?r.ts:void 0}}),n===`exit`){let e=typeof r.rc==`number`?r.rc:-1;e!==0&&V({type:`SET_UPDATE_STATUS`,status:`failed`,errorMessage:`subprocess exited with rc=${e}`})}else n===`execvp`?V({type:`SET_UPDATE_STATUS`,status:`success`}):n===`error_event`?V({type:`SET_UPDATE_STATUS`,status:`failed`,errorMessage:typeof r.message==`string`?r.message:`update worker error`}):n===`done`&&(e&&=(e.close(),null))}function c(){n??=window.setInterval(async()=>{if(!i)try{let e=await fetch(`/api/update/status`);if(!e.ok)return;let t=await e.json(),r=t?.current_run_id??null,i=t?.state??{};if(r===null){let e=i?.current_version,t=i?.latest_version,r=z().update;typeof e==`string`&&typeof t==`string`&&e===t?V({type:`SET_UPDATE_STATUS`,status:`success`}):r.status===`running`&&V({type:`SET_UPDATE_STATUS`,status:`failed`,errorMessage:`update worker exited (stream unavailable)`}),r.stream.length===0&&V({type:`APPEND_UPDATE_STREAM`,event:{type:`stdout`,data:`(SSE stream unavailable; install completed in background — see ~/.local/share/cctally/update.log for full output)`}}),n!=null&&(window.clearInterval(n),n=null)}}catch{}},Yo)}r=window.setTimeout(()=>{i||o.current&&(o.current=!1,e&&=(e.close(),null),c())},Jo);try{e=new EventSource(`/api/update/stream/${encodeURIComponent(t)}`),e.addEventListener(`message`,e=>s(e,`stdout`)),[`stdout`,`stderr`,`step`,`exit`,`execvp`,`error_event`,`done`,`heartbeat`].forEach(t=>{e.addEventListener(t,e=>s(e,t))}),e.onerror=()=>{o.current&&(a(),e&&=(e.close(),null),c())}}catch{a(),c()}return()=>{i=!0,r!=null&&(window.clearTimeout(r),r=null),n!=null&&(window.clearInterval(n),n=null),e&&=(e.close(),null),o.current=!1,tt()}},[t]),(0,H.jsxs)(`div`,{className:`update-modal-body`,children:[(0,H.jsxs)(`div`,{className:`update-running-row`,children:[(0,H.jsx)(`span`,{className:`update-spinner`,"aria-hidden":`true`,children:`⟳`}),(0,H.jsx)(`code`,{className:`update-cmd update-cmd-inline`,children:r||`updating cctally`}),(0,H.jsxs)(`span`,{className:`update-elapsed`,children:[Xo(n),` elapsed`]})]}),(0,H.jsx)(qo,{events:e.stream}),(0,H.jsxs)(`p`,{className:`update-stream-cap`,children:[`Output streams over SSE · press Esc to hide (install continues to `,i||`latest`,`)`]})]})}var Qo=1500;function $o(e){if(e==null)return`—`;let t=Math.max(0,Math.round((Date.now()-e)/1e3));return t<60?`${t}s`:`${Math.floor(t/60)}m ${t%60}s`}function es(){let e=(0,_.useSyncExternalStore)(B,()=>z().update),t=e.startedAt,n=e.state?.update_command??``,r=e.state?.latest_version??``;return(0,_.useEffect)(()=>{let e=window.setInterval(()=>{tt()},Qo);return()=>window.clearInterval(e)},[]),(0,H.jsxs)(`div`,{className:`update-modal-body`,children:[(0,H.jsxs)(`div`,{className:`update-running-row update-running-row-success`,children:[(0,H.jsx)(`span`,{className:`update-check`,"aria-hidden":`true`,children:`✓`}),(0,H.jsx)(`code`,{className:`update-cmd update-cmd-inline`,children:n||`cctally`}),(0,H.jsxs)(`span`,{className:`update-elapsed`,children:[`finished in `,$o(t)]})]}),(0,H.jsxs)(`div`,{className:`update-row-label`,children:[`Restarting dashboard on the new code`,r?` (${r})`:``,`…`]}),(0,H.jsxs)(`div`,{className:`update-running-row`,children:[(0,H.jsx)(`span`,{className:`update-spinner`,"aria-hidden":`true`,children:`⟳`}),(0,H.jsx)(`span`,{className:`update-success-reconnect`,children:`reconnecting (this page will refresh in a moment)`})]})]})}var ts=12;function ns(e,t){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n.type===`exit`&&typeof n.rc==`number`)return`exited rc=${n.rc}`;if(n.type===`error_event`)return n.message??`worker error`}return t??`unknown failure`}function rs(){let e=(0,_.useSyncExternalStore)(B,()=>z().update),[t,n]=(0,_.useState)(`idle`),r=e.state?.update_command??``,i=e.stream.filter(e=>e.type===`stderr`&&e.data).map(e=>e.data).slice(-ts),a=ns(e.stream,e.errorMessage);function o(){V({type:`RESET_UPDATE_RUN`}),nt()}async function s(){if(r)try{await navigator.clipboard.writeText(r),n(`ok`),window.setTimeout(()=>n(`idle`),1500)}catch{n(`err`),window.setTimeout(()=>n(`idle`),1500)}}return(0,H.jsxs)(`div`,{className:`update-modal-body`,children:[(0,H.jsxs)(`div`,{className:`update-running-row update-running-row-failed`,children:[(0,H.jsx)(`span`,{className:`update-x`,"aria-hidden":`true`,children:`✗`}),(0,H.jsx)(`code`,{className:`update-cmd update-cmd-inline`,children:r||`cctally update`}),(0,H.jsx)(`span`,{className:`update-elapsed`,children:a})]}),i.length>0?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`update-row-label`,children:[`stderr (last `,i.length,` line`,i.length===1?``:`s`,`)`]}),(0,H.jsx)(`pre`,{className:`update-stream update-stream-fail`,children:i.map((e,t)=>(0,H.jsxs)(`span`,{className:`update-stream-line err`,children:[e,`
18
+ `]},t))})]}):(0,H.jsx)(`p`,{className:`update-manual-note`,children:e.errorMessage??`See ~/.local/share/cctally/update.log for the full failure log.`}),(0,H.jsxs)(`p`,{className:`update-stream-cap`,children:[`Full log: `,(0,H.jsx)(`code`,{children:`~/.local/share/cctally/update.log`})]}),(0,H.jsxs)(`div`,{className:`update-actions`,children:[(0,H.jsx)(`button`,{type:`button`,className:`update-btn update-btn-primary`,onClick:o,children:`Retry`}),(0,H.jsx)(`button`,{type:`button`,className:`update-btn`,onClick:s,disabled:!r,children:t===`ok`?`Copied!`:t===`err`?`Copy failed`:`Copy command`}),(0,H.jsx)(`button`,{type:`button`,className:`update-btn`,onClick:()=>at.close(),children:`Close`})]})]})}var is={idle:`Update available`,running:`Updating cctally`,success:`Update complete`,failed:`Update failed`},as={idle:`accent-amber`,running:`accent-amber`,success:`accent-green`,failed:`accent-red`};function os(){let e=(0,_.useSyncExternalStore)(B,()=>z().update),t=()=>V({type:`CLOSE_UPDATE_MODAL`});if(Ut((0,_.useMemo)(()=>[{key:`Escape`,scope:`modal`,action:t,when:()=>z().update.modalOpen}],[])),!e.modalOpen||!e.state)return null;let n=e.status,r=as[n]??`accent-amber`,i=is[n]??`Update`;n===`running`&&e.state.latest_version?i=`Updating cctally → ${e.state.latest_version}`:n===`success`&&e.state.latest_version&&(i=`Update complete → ${e.state.latest_version}`);let a;switch(n){case`running`:a=(0,H.jsx)(Zo,{});break;case`success`:a=(0,H.jsx)(es,{});break;case`failed`:a=(0,H.jsx)(rs,{});break;default:a=(0,H.jsx)(Ko,{});break}return(0,H.jsxs)(`div`,{id:`update-modal-root`,className:`update-modal-root`,children:[(0,H.jsx)(`div`,{className:`modal-backdrop`,onClick:t}),(0,H.jsxs)(`div`,{className:`modal-card update-modal-card ${r}`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`update-modal-title`,children:[(0,H.jsx)(`div`,{className:`modal-handle`,"aria-hidden":`true`}),(0,H.jsxs)(`header`,{className:`modal-header`,children:[(0,H.jsx)(`h2`,{id:`update-modal-title`,children:i}),(0,H.jsx)(`button`,{className:`modal-close`,"aria-label":`Close`,onClick:t,children:`×`})]}),(0,H.jsx)(`div`,{className:`modal-body`,children:a})]})]})}function ss({title:e,accentClass:t,children:n,headerExtras:r}){let i=()=>V({type:`CLOSE_MODAL`});return Ut((0,_.useMemo)(()=>[{key:`Escape`,scope:`modal`,action:i}],[])),(0,H.jsxs)(`div`,{id:`modal-root`,children:[(0,H.jsx)(`div`,{className:`modal-backdrop`,onClick:i}),(0,H.jsxs)(`div`,{className:`modal-card ${t}`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`modal-title`,children:[(0,H.jsx)(`div`,{className:`modal-handle`,"aria-hidden":`true`}),(0,H.jsxs)(`header`,{className:`modal-header`,children:[(0,H.jsx)(`h2`,{id:`modal-title`,children:e}),r,(0,H.jsx)(`button`,{className:`modal-close`,"aria-label":`Close`,onClick:i,children:`×`})]}),(0,H.jsx)(`div`,{id:`modal-body`,className:`modal-body`,children:n})]})]})}function cs(e){return e==null||!isFinite(e)?0:Math.max(0,Math.min(100,e))}function ls(e,t,n){let r=A.dateShort(t,n);return e&&r?`${e} → ${r}`:e||(r?`→ ${r}`:`—`)}function us(e){if(e==null||!isFinite(e))return[`—`,``];let t=(+e).toFixed(1),n=t.indexOf(`.`);return n===-1?[t,`.0%`]:[t.slice(0,n),t.slice(n)+`%`]}function ds(e){let t=[],n=[...e].sort((e,t)=>(e.percent??0)-(t.percent??0));for(let e of n)e.percent!=null&&(t.length&&e.percent-(t[t.length-1].percent??0)<3||t.push(e));return t}function fs(e){if(!Array.isArray(e)||e.length<2)return null;let t=e.map(e=>e.marginal_usd).filter(e=>e!=null&&isFinite(e)),n=t.length?t.reduce((e,t)=>e+t,0)/t.length:null,r=e[e.length-1].percent,i=[];return n!=null&&i.push(`avg marginal $`+n.toFixed(2)),r!=null&&i.push(`latest at `+r+`%`),i.length?i.join(` · `):null}function ps(e,t){let n=[];for(let t of e)n.push({kind:`milestone`,ts:t.captured_at_utc,data:t});for(let e of t)n.push({kind:`credit`,ts:e.effective_reset_at_utc,data:e});return n.sort((e,t)=>e.ts.localeCompare(t.ts)),n}function ms(){let e=Ge(),t=Gt(),n={tz:t.resolvedTz,offsetLabel:t.offsetLabel},r=e?.current_week??null,i=e?.header??null,a=Array.isArray(r?.milestones)?r.milestones:[],o=Array.isArray(r?.five_hour_milestones)?r.five_hour_milestones:[],s=ps(o,Array.isArray(r?.five_hour_block?.credits)?r.five_hour_block.credits:[]),c=cs(r?.used_pct),[l,u]=us(r?.used_pct),d=r?ls(i?.week_label,r.reset_at_utc,n):`—`,f=ds(a),p=fs(a);return(0,H.jsx)(ss,{title:`Current Week — per-percent milestones`,accentClass:`accent-green`,headerExtras:(0,H.jsx)(Jt,{panel:`current-week`,panelLabel:`Current week`,triggerId:`current-week-modal`,onClick:()=>V(L(`current-week`,`current-week-modal`))}),children:(0,H.jsxs)(`section`,{className:`modal-current-week`,children:[(0,H.jsx)(`div`,{className:`m-chipstrip`,id:`mcw-badges`,children:(0,H.jsx)(`span`,{className:`m-pill accent-green`,id:`mcw-week-pill`,children:d})}),(0,H.jsxs)(`div`,{className:`mcw-herobar`,children:[(0,H.jsxs)(`div`,{className:`mcw-bignum`,id:`mcw-bignum`,children:[(0,H.jsx)(`span`,{className:`int`,children:l}),(0,H.jsx)(`span`,{className:`unit`,children:u})]}),(0,H.jsxs)(`div`,{className:`mcw-pbar-wrap`,children:[(0,H.jsxs)(`div`,{className:`mcw-pbar`,children:[(0,H.jsx)(`div`,{className:`fill`,id:`mcw-fill`,style:{width:c+`%`}}),(0,H.jsx)(`div`,{className:`ticks`,id:`mcw-ticks`,children:f.map(e=>(0,H.jsx)(`div`,{className:`tick`,"data-p":String(e.percent),style:{left:cs(e.percent)+`%`}},e.percent))}),(0,H.jsx)(`div`,{className:`marker`,id:`mcw-marker`,style:{left:c+`%`}})]}),(0,H.jsxs)(`div`,{className:`mcw-pscale`,children:[(0,H.jsx)(`span`,{children:`0%`}),(0,H.jsx)(`span`,{children:`25%`}),(0,H.jsx)(`span`,{children:`50%`}),(0,H.jsx)(`span`,{children:`75%`}),(0,H.jsx)(`span`,{children:`100%`})]})]}),(0,H.jsxs)(`div`,{className:`mcw-mini`,id:`mcw-mini`,children:[(0,H.jsxs)(`div`,{className:`s`,children:[(0,H.jsx)(`span`,{className:`k`,children:`spent`}),(0,H.jsx)(`span`,{className:`v v-magenta`,id:`mcw-spent`,children:A.usd2(r?.spent_usd)})]}),(0,H.jsxs)(`div`,{className:`s`,children:[(0,H.jsx)(`span`,{className:`k`,children:`$ / 1%`}),(0,H.jsx)(`span`,{className:`v v-cyan`,id:`mcw-dpp`,children:A.usd3(r?.dollar_per_pct)})]}),(0,H.jsxs)(`div`,{className:`s`,children:[(0,H.jsx)(`span`,{className:`k`,children:`reset`}),(0,H.jsx)(`span`,{className:`v`,id:`mcw-reset`,children:A.datetimeShortZ(r?.reset_at_utc,n)})]})]})]}),(0,H.jsxs)(`h3`,{className:`m-sec sec-ms`,children:[(0,H.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#hash`})}),`Milestones`]}),(0,H.jsxs)(`div`,{className:`mcw-mshead`,children:[(0,H.jsxs)(`span`,{className:`m-pill accent-purple`,id:`mcw-ms-count`,children:[a.length,` crossed`]}),(0,H.jsx)(`span`,{className:`mcw-ms-sub`,id:`mcw-ms-sub`,hidden:!p,children:p??``})]}),a.length===0?(0,H.jsx)(`p`,{className:`empty-state`,id:`mcw-empty`,children:`No milestones yet — earliest crosses at 1\xA0%.`}):(0,H.jsxs)(`table`,{className:`m-histable`,id:`mcw-table`,children:[(0,H.jsx)(`thead`,{children:(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`th`,{children:`%`}),(0,H.jsxs)(`th`,{children:[`Crossed (`,t.offsetLabel,`)`]}),(0,H.jsx)(`th`,{className:`num`,children:`Cumulative $`}),(0,H.jsx)(`th`,{className:`num`,children:`Marginal $`}),(0,H.jsx)(`th`,{className:`num`,children:`5h %`})]})}),(0,H.jsx)(`tbody`,{id:`mcw-rows`,children:a.map(e=>(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`td`,{children:(0,H.jsx)(`span`,{className:`m-pill accent-purple pct-cell`,children:e.percent??`—`})}),(0,H.jsx)(`td`,{className:`d`,children:A.startedShort(e.crossed_at_utc,n,{noSuffix:!0})}),(0,H.jsx)(`td`,{className:`num`,children:e.cumulative_usd==null?`—`:`$`+e.cumulative_usd.toFixed(2)}),(0,H.jsx)(`td`,{className:`num`,children:(0,H.jsx)(`span`,{className:`m-marginal`,children:e.marginal_usd==null?`—`:`$`+e.marginal_usd.toFixed(2)})}),(0,H.jsx)(`td`,{className:`num`,children:(0,H.jsx)(`span`,{className:`m-fh`,children:e.five_hour_pct_at_cross==null?`—`:Math.round(e.five_hour_pct_at_cross)+`%`})})]},e.percent))})]}),s.length>0&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`h3`,{className:`m-sec sec-ms sec-5h`,children:[(0,H.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#activity`})}),`5h milestones`]}),(0,H.jsx)(`div`,{className:`mcw-mshead`,children:(0,H.jsxs)(`span`,{className:`m-pill accent-purple`,id:`mcw-5h-count`,children:[o.length,` crossed`]})}),(0,H.jsxs)(`table`,{className:`m-histable mcw-5h-table`,id:`mcw-5h-table`,children:[(0,H.jsx)(`thead`,{children:(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`th`,{children:`%`}),(0,H.jsxs)(`th`,{children:[`When (`,t.offsetLabel,`)`]}),(0,H.jsx)(`th`,{className:`num`,children:`Block $`}),(0,H.jsx)(`th`,{className:`num`,children:`Marginal $`}),(0,H.jsx)(`th`,{className:`num`,children:`7d %`})]})}),(0,H.jsx)(`tbody`,{children:s.map((e,t)=>{if(e.kind===`credit`)return(0,H.jsx)(`tr`,{className:`mcw-5h-credit-row`,children:(0,H.jsxs)(`td`,{colSpan:5,className:`mcw-5h-credit-cell`,children:[`⚡ CREDIT\xA0`,` `,e.data.delta_pp>0?`+`:``,e.data.delta_pp.toFixed(0),`pp\xA0@`,` `,A.startedShort(e.ts,n,{noSuffix:!0})]})},`credit-${t}-${e.ts}`);let r=e.data;return(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`td`,{children:(0,H.jsx)(`span`,{className:`m-pill accent-purple pct-cell`,children:r.percent_threshold})}),(0,H.jsx)(`td`,{className:`d`,children:A.startedShort(r.captured_at_utc,n,{noSuffix:!0})}),(0,H.jsx)(`td`,{className:`num`,children:`$`+r.block_cost_usd.toFixed(2)}),(0,H.jsx)(`td`,{className:`num`,children:(0,H.jsx)(`span`,{className:`m-marginal`,children:r.marginal_cost_usd==null?`—`:`$`+r.marginal_cost_usd.toFixed(2)})}),(0,H.jsx)(`td`,{className:`num`,children:(0,H.jsx)(`span`,{className:`m-fh`,children:r.seven_day_pct_at_crossing==null?`—`:Math.round(r.seven_day_pct_at_crossing)+`%`})})]},`fhms-${r.percent_threshold}-${r.reset_event_id}`)})})]})]})]})})}function hs(e){if(!e)return`—`;let t=e.elapsed_hours,n=e.remaining_hours;if(t==null||n==null)return`—`;let r=t+n;if(r<=0)return`—`;let i=t/r*100;return Math.min(100,i).toFixed(1)+`%`}function gs(e){return e==null||!isFinite(e)?null:e<0?0:e>110?110:e}function _s(e){return e==null||!isFinite(e)?`—`:e<0?`~`+(+e).toFixed(1)+`%`:(+e).toFixed(1)+`%`}function vs(e,t){for(let t of e)t.trueXPct=t.pos/110*100;if(e.length<2||t<=0){for(let t of e)t.resolvedXPct=t.trueXPct;return}let n=e.slice().sort((e,t)=>e.trueXPct-t.trueXPct),r=n[0],i=n[1],a=r.pillWidthPx/2/t*100,o=i.pillWidthPx/2/t*100,s=8/t*100,c=a+o+s,l=2*c;if(i.trueXPct-r.trueXPct<c){let e=(r.trueXPct+i.trueXPct)/2;r.resolvedXPct=e-l/2,i.resolvedXPct=e+l/2;let t=a,n=100-o;r.resolvedXPct<t&&(r.resolvedXPct=t,i.resolvedXPct-r.resolvedXPct<l&&(i.resolvedXPct=Math.min(n,r.resolvedXPct+l))),i.resolvedXPct>n&&(i.resolvedXPct=n,i.resolvedXPct-r.resolvedXPct<l&&(r.resolvedXPct=Math.max(t,i.resolvedXPct-l)))}else r.resolvedXPct=r.trueXPct,i.resolvedXPct=i.trueXPct}function ys(e,t,n){(0,_.useEffect)(()=>{let r=e.current,i=t.current;if(!r||!i||!n)return;let a=r.querySelector(`.mfc-pills`),o=r.querySelector(`.mfc-leaders`),s=i.querySelector(`.mfc-rangeband`);if(!a||!o)return;let c=n.week_avg_projection_pct,l=n.recent_24h_projection_pct,u=gs(c),d=gs(l),f=[];u!=null&&c!=null&&f.push({kind:`wa`,pos:u,raw:c}),d!=null&&l!=null&&f.push({kind:`r24`,pos:d,raw:l});let p=new Set(f.map(e=>e.kind));i.querySelectorAll(`.mfc-chev`).forEach(e=>{let t=e.dataset.kind;(!t||!p.has(t))&&e.remove()}),a.querySelectorAll(`.mfc-pill`).forEach(e=>{let t=e.dataset.kind;(!t||!p.has(t))&&e.remove()});let m=f.map(e=>({...e,trueXPct:0,resolvedXPct:0,pillWidthPx:0}));for(let e of m){let t=e.pos/110*100,n=i.querySelector(`.mfc-chev[data-kind="${e.kind}"]`);n||(n=document.createElement(`div`),n.className=`mfc-chev `+e.kind,n.dataset.kind=e.kind,i.appendChild(n)),n.style.left=t+`%`;let r=a.querySelector(`.mfc-pill[data-kind="${e.kind}"]`),o=_s(e.raw);r?r.textContent!==o&&(r.textContent=o):(r=document.createElement(`div`),r.className=`mfc-pill `+e.kind,r.dataset.kind=e.kind,r.textContent=o,a.appendChild(r)),e.pillEl=r}if(s){let e=!1;if(m.length===2){let t=m[0].pos/110*100,n=m[1].pos/110*100,r=Math.min(t,n),i=Math.max(t,n)-r;i>=.5&&(s.style.left=r+`%`,s.style.width=i+`%`,e=!0)}s.hidden=!e}let h=()=>{for(let e of m)if(!e.pillEl||!e.pillEl.isConnected)return;let e=r.clientWidth;if(e<=0){requestAnimationFrame(h);return}for(let e of m)e.pillWidthPx=e.pillEl.getBoundingClientRect().width;vs(m,e);for(let e of m)e.pillEl.style.left=e.resolvedXPct+`%`;for(;o.firstChild;)o.removeChild(o.firstChild);for(let e of m){let t=document.createElementNS(`http://www.w3.org/2000/svg`,`path`);t.setAttribute(`class`,e.kind),t.setAttribute(`vector-effect`,`non-scaling-stroke`),t.setAttribute(`d`,`M ${e.resolvedXPct} 0 C ${e.resolvedXPct} 10, ${e.trueXPct} 8, ${e.trueXPct} 18`),o.appendChild(t)}};h()},[e,t,n])}function bs(){let e=Ge()?.forecast??null,t=e?.explain??null,n=(0,_.useRef)(null),r=(0,_.useRef)(null);ys(n,r,e);let i=(0,H.jsx)(Jt,{panel:`forecast`,panelLabel:`Forecast`,triggerId:`forecast-modal`,onClick:()=>V(L(`forecast`,`forecast-modal`))});if(!e)return(0,H.jsx)(ss,{title:`Forecast — explain`,accentClass:`accent-purple`,headerExtras:i,children:(0,H.jsx)(`section`,{className:`modal-forecast`,children:(0,H.jsx)(`p`,{className:`empty-state`,id:`mfc-empty`,children:`No forecast data yet.`})})});let a=wt(e.verdict),o=a?`m-pill ${a.accent}`:`m-pill`,s=a?`${a.glyph} ${a.label}`:`—`,c=`m-pill`,l=`—`,u=!0;e.confidence===`high`?(c=`m-pill accent-blue`,l=`high confidence`,u=!1):e.confidence===`low`&&(c=`m-pill accent-red`,l=`low confidence`,u=!1);let d=t?.rates,f=t?.week;return(0,H.jsx)(ss,{title:`Forecast — explain`,accentClass:`accent-purple`,headerExtras:i,children:(0,H.jsxs)(`section`,{className:`modal-forecast`,children:[(0,H.jsxs)(`div`,{className:`m-chipstrip`,id:`mfc-chips`,children:[(0,H.jsx)(`span`,{className:o,id:`mfc-verdict`,children:s}),(0,H.jsx)(`span`,{className:c,id:`mfc-confidence`,hidden:u,children:l})]}),(0,H.jsxs)(`div`,{className:`m-hero cols-2`,children:[(0,H.jsxs)(`div`,{className:`m-kv kv-wa`,children:[(0,H.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#gauge`})}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`v`,id:`mfc-wa-pct`,children:A.pct1(e.week_avg_projection_pct)}),(0,H.jsx)(`div`,{className:`lbl`,children:`Week-avg projection`}),(0,H.jsx)(`div`,{className:`sub`,id:`mfc-wa-sub`,children:A.ratePctPerHour(d?.week_average_pct_per_hour)})]})]}),(0,H.jsxs)(`div`,{className:`m-kv kv-r24`,children:[(0,H.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#zap`})}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`v`,id:`mfc-r24-pct`,children:A.pct1(e.recent_24h_projection_pct)}),(0,H.jsx)(`div`,{className:`lbl`,children:`Recent-24h projection`}),(0,H.jsx)(`div`,{className:`sub`,id:`mfc-r24-sub`,children:A.ratePctPerHour(d?.recent_24h_pct_per_hour)})]})]})]}),(0,H.jsxs)(`h3`,{className:`m-sec sec-range`,children:[(0,H.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#bar-chart`})}),`Range vs. caps`]}),(0,H.jsxs)(`div`,{className:`mfc-rangewrap`,id:`mfc-rangewrap`,ref:n,children:[(0,H.jsx)(`div`,{className:`mfc-pills`,id:`mfc-pills`}),(0,H.jsx)(`svg`,{className:`mfc-leaders`,id:`mfc-leaders`,viewBox:`0 0 100 18`,preserveAspectRatio:`none`,"aria-hidden":`true`}),(0,H.jsxs)(`div`,{className:`mfc-rangetrack`,id:`mfc-rangetrack`,ref:r,children:[(0,H.jsx)(`div`,{className:`mfc-zone safe`}),(0,H.jsx)(`div`,{className:`mfc-zone warn`}),(0,H.jsx)(`div`,{className:`mfc-zone over`}),(0,H.jsx)(`div`,{className:`mfc-rangeband`,id:`mfc-rangeband`,hidden:!0}),(0,H.jsx)(`div`,{className:`mfc-bound b90`,children:(0,H.jsx)(`div`,{className:`lbl`,children:`90%`})}),(0,H.jsx)(`div`,{className:`mfc-bound b100`,children:(0,H.jsx)(`div`,{className:`lbl`,children:`100%`})})]})]}),(0,H.jsxs)(`h3`,{className:`m-sec sec-rates`,children:[(0,H.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#activity`})}),`Rates`]}),(0,H.jsxs)(`div`,{className:`mfc-kvgrid`,children:[(0,H.jsxs)(`div`,{className:`mfc-krow`,children:[(0,H.jsx)(`span`,{className:`l`,children:`$ / 1%`}),(0,H.jsx)(`span`,{className:`v v-cyan`,id:`mfc-dpp`,children:A.usd3(d?.dollars_per_percent)})]}),(0,H.jsxs)(`div`,{className:`mfc-krow`,children:[(0,H.jsx)(`span`,{className:`l`,children:`week done`}),(0,H.jsx)(`span`,{className:`v v-green`,id:`mfc-wkdone`,children:hs(f)})]}),(0,H.jsxs)(`div`,{className:`mfc-krow`,children:[(0,H.jsx)(`span`,{className:`l`,children:`elapsed`}),(0,H.jsx)(`span`,{className:`v v-green`,id:`mfc-elapsed`,children:A.hours1(f?.elapsed_hours)})]}),(0,H.jsxs)(`div`,{className:`mfc-krow`,children:[(0,H.jsx)(`span`,{className:`l`,children:`remaining`}),(0,H.jsx)(`span`,{className:`v`,id:`mfc-remain`,children:A.hours1(f?.remaining_hours)})]})]}),(0,H.jsxs)(`h3`,{className:`m-sec sec-bud`,children:[(0,H.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#dollar`})}),`Daily budgets to stay under`]}),(0,H.jsxs)(`div`,{className:`mfc-kvgrid mfc-kvgrid-single`,children:[(0,H.jsxs)(`div`,{className:`mfc-krow`,children:[(0,H.jsx)(`span`,{className:`l`,children:`@ 100% cap`}),(0,H.jsx)(`span`,{className:`v v-magenta`,id:`mfc-bud100`,children:A.usd2PerDay(e.budget_100_per_day_usd)})]}),(0,H.jsxs)(`div`,{className:`mfc-krow`,children:[(0,H.jsx)(`span`,{className:`l`,children:`@ 90% cap`}),(0,H.jsx)(`span`,{className:`v v-amber`,id:`mfc-bud90`,children:A.usd2PerDay(e.budget_90_per_day_usd)})]})]})]})})}function xs(e){let t=Math.max(1,Math.round(e/4));return`${e} week${e===1?``:`s`} · ${t} month${t===1?``:`s`}`}function Ss(e){let t=e.findIndex(e=>e&&e.is_current);return t>=0?t:e.length-1}function Cs(e,t){let n=e.filter((e,n)=>n!==t).map(e=>e.dollar_per_pct).filter(e=>e!=null&&isFinite(e));if(n.length<4)return null;let r=n.slice(-4).sort((e,t)=>e-t);return(r[1]+r[2])/2}function ws(e){if(!e.length)return null;let t=[...e].sort((e,t)=>e-t),n=Math.floor(t.length/2);return t.length%2?t[n]:(t[n-1]+t[n])/2}function Ts(e,t){let n=[];if(!e.length)return n;let r={left:44,right:14,top:12,bottom:22},i=600-r.left-r.right,a=140-r.top-r.bottom,o=e.length,s=e=>r.left+(o===1?i:e/(o-1)*i),c=e.map(e=>e.dollar_per_pct).filter(e=>e!=null&&isFinite(e)),l=c.length?Math.min(...c)*.96:0,u=c.length?Math.max(...c)*1.04:1;u-l<1e-6&&(l-=.01,u+=.01);let d=e=>r.top+a*(1-(e-l)/(u-l)),f=e.map(e=>e.used_pct).filter(e=>e!=null&&isFinite(e)),p=f.length?Math.min(...f)*.96:0,m=f.length?Math.max(...f)*1.04:100;m-p<1e-6&&(--p,m+=1);let h=e=>r.top+a*(1-(e-p)/(m-p));if(n.push({el:`line`,attrs:{class:`mtr-axis`,x1:r.left,y1:r.top+a,x2:600-r.right,y2:r.top+a},key:`axis`}),c.length){let e=ws(c);e!=null&&(n.push({el:`line`,attrs:{class:`mtr-hl`,x1:r.left,y1:d(e),x2:600-r.right,y2:d(e)},key:`med-line`}),n.push({el:`text`,attrs:{class:`mtr-medlabel`,x:r.left+2,y:d(e)-3},text:`median $`+e.toFixed(2),key:`med-label`}))}{let t=[];e.forEach((e,n)=>{e.used_pct!=null&&isFinite(e.used_pct)&&t.push(`${s(n)},${h(e.used_pct)}`)}),t.length>=2&&n.push({el:`polyline`,attrs:{class:`mtr-trendline-dim`,points:t.join(` `)},key:`poly-used`})}{let t=[];e.forEach((e,n)=>{e.dollar_per_pct!=null&&isFinite(e.dollar_per_pct)&&t.push(`${s(n)},${d(e.dollar_per_pct)}`)}),t.length>=2&&n.push({el:`polyline`,attrs:{class:`mtr-trendline`,points:t.join(` `)},key:`poly-dpp`})}e.forEach((e,r)=>{if(e.dollar_per_pct==null||!isFinite(e.dollar_per_pct))return;let i=r===t;n.push({el:`circle`,attrs:{class:`mtr-trenddot`+(i?` cur`:``),cx:s(r),cy:d(e.dollar_per_pct),r:i?5:3},key:`dot-${r}`})}),c.length&&(n.push({el:`text`,attrs:{class:`mtr-ylabel`,x:3,y:r.top+8},text:`$`+(u/1.04).toFixed(2),key:`ymax`}),n.push({el:`text`,attrs:{class:`mtr-ylabel`,x:3,y:r.top+a},text:`$`+(l/.96).toFixed(2),key:`ymin`}));let g=e[t];return g&&g.dollar_per_pct!=null&&isFinite(g.dollar_per_pct)&&n.push({el:`text`,attrs:{class:`mtr-curlabel`,x:Math.max(r.left+4,s(t)-22),y:Math.min(138,d(g.dollar_per_pct)+16)},text:`$`+g.dollar_per_pct.toFixed(2),key:`curlabel`}),n}function Es(e,t){return t===0?`Now`+(e.label?` · `+e.label:``):`W−`+t+(e.label?` · `+e.label:``)}function Ds(e){return e==null||!isFinite(e)?{cls:`flat`,text:`—`}:e>5e-4?{cls:`up`,text:`+`+e.toFixed(2)}:e<-5e-4?{cls:`down`,text:e.toFixed(2)}:{cls:`flat`,text:`0.00`}}function Os(e){return e==null||!isFinite(e)?{cls:`delta-flat`,iconHref:`/static/icons.svg#minus`,text:`—`}:e<-5e-4?{cls:`delta-down`,iconHref:`/static/icons.svg#trending-down`,text:`−$`+Math.abs(e).toFixed(3)}:e>5e-4?{cls:`delta-up`,iconHref:`/static/icons.svg#trending-up`,text:`+$`+e.toFixed(3)}:{cls:`delta-flat`,iconHref:`/static/icons.svg#minus`,text:`$0.000`}}function ks(){let e=Ge(),t=re(e),n=(0,H.jsx)(Jt,{panel:`trend`,panelLabel:`Trend`,triggerId:`trend-modal`,onClick:()=>V(L(`trend`,`trend-modal`))});if(!t.length)return(0,H.jsx)(ss,{title:`Trend — 12-week history`,accentClass:`accent-amber`,headerExtras:n,children:(0,H.jsx)(`section`,{className:`modal-trend`,children:(0,H.jsx)(`p`,{className:`empty-state`,id:`mtr-empty`,children:`No history data yet.`})})});let r=Ss(t),i=t[r],a=e?.trend?.history_median_dpp,o=a!=null&&isFinite(a)?a:Cs(t,r),s=Os(i&&i.dollar_per_pct!=null&&o!=null?i.dollar_per_pct-o:null),c=Ts(t,r),l=t.some(e=>e.used_pct!=null&&isFinite(e.used_pct)),u=t.length;return(0,H.jsx)(ss,{title:`Trend — 12-week history`,accentClass:`accent-amber`,headerExtras:n,children:(0,H.jsxs)(`section`,{className:`modal-trend`,children:[(0,H.jsx)(`div`,{className:`m-chipstrip`,children:(0,H.jsx)(`span`,{className:`m-pill accent-amber`,id:`mtr-weeks-pill`,children:xs(u)})}),(0,H.jsxs)(`div`,{className:`m-hero cols-3`,children:[(0,H.jsxs)(`div`,{className:`m-kv kv-cur`,children:[(0,H.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#dollar`})}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`v`,id:`mtr-cur`,children:i&&i.dollar_per_pct!=null?`$`+i.dollar_per_pct.toFixed(3):`—`}),(0,H.jsx)(`div`,{className:`lbl`,children:`Current $ / 1%`})]})]}),(0,H.jsxs)(`div`,{className:`m-kv kv-med`,children:[(0,H.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#minus`})}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`v`,id:`mtr-med`,children:o==null?`—`:`$`+o.toFixed(3)}),(0,H.jsx)(`div`,{className:`lbl`,children:`4-week median`})]})]}),(0,H.jsxs)(`div`,{className:`m-kv kv-delta ${s.cls}`,id:`mtr-delta-kv`,children:[(0,H.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,H.jsx)(`use`,{href:s.iconHref})}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`v`,id:`mtr-delta`,children:s.text}),(0,H.jsx)(`div`,{className:`lbl`,children:`vs median`})]})]})]}),(0,H.jsxs)(`h3`,{className:`m-sec sec-spark`,children:[(0,H.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#trending-down`})}),`12-week history · $/1%`,(0,H.jsxs)(`span`,{className:`mtr-legend`+(l?``:` legend-no-used`),"aria-hidden":`true`,children:[(0,H.jsx)(`span`,{className:`sw sw-dpp`}),(0,H.jsx)(`span`,{className:`sw-lbl`,children:`$/1%`}),(0,H.jsx)(`span`,{className:`sw sw-used`}),(0,H.jsx)(`span`,{className:`sw-lbl`,children:`used %`})]})]}),(0,H.jsxs)(`div`,{className:`mtr-sparkhero`,children:[(0,H.jsx)(`svg`,{id:`mtr-svg`,viewBox:`0 0 600 140`,preserveAspectRatio:`none`,"aria-hidden":`true`,children:c.map(e=>{let{el:t,attrs:n,text:r,key:i}=e,a={};for(let e in n)a[e===`class`?`className`:e]=n[e];return t===`line`?(0,H.jsx)(`line`,{...a},i):t===`polyline`?(0,H.jsx)(`polyline`,{...a},i):t===`circle`?(0,H.jsx)(`circle`,{...a},i):(0,H.jsx)(`text`,{...a,children:r},i)})}),(0,H.jsx)(`div`,{className:`mtr-sparkaxis`,id:`mtr-sparkaxis`,children:u>0?(0,H.jsxs)(_.Fragment,{children:[(0,H.jsxs)(`span`,{children:[`W−`,u-1]}),(0,H.jsxs)(`span`,{children:[`W−`,Math.floor((u-1)/2)]}),(0,H.jsx)(`span`,{children:`Now`})]}):null})]}),(0,H.jsxs)(`h3`,{className:`m-sec sec-tbl`,children:[(0,H.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#hash`})}),`Weekly detail`]}),(0,H.jsxs)(`div`,{className:`mtr-tbl-head`,children:[(0,H.jsxs)(`span`,{className:`m-pill accent-purple`,id:`mtr-tbl-count`,children:[u,` weeks`]}),(0,H.jsx)(`span`,{className:`mtr-tbl-sub`,children:`current row highlighted · negative Δ = $/1% down vs prior week`})]}),(0,H.jsxs)(`table`,{className:`m-histable`,id:`mtr-table`,children:[(0,H.jsx)(`thead`,{children:(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`th`,{children:`Week`}),(0,H.jsx)(`th`,{className:`num`,children:`Used %`}),(0,H.jsx)(`th`,{className:`num`,children:`$ / 1%`}),(0,H.jsx)(`th`,{className:`num`,children:`Δ $/1%`})]})}),(0,H.jsx)(`tbody`,{id:`mtr-rows`,children:t.map((e,t)=>{let n=Es(e,u-1-t),r=e.used_pct==null?`—`:Math.round(e.used_pct)+`%`,i=e.dollar_per_pct==null?`—`:`$`+e.dollar_per_pct.toFixed(2),a=Ds(e.delta);return(0,H.jsxs)(`tr`,{className:e.is_current?`cur`:void 0,children:[(0,H.jsx)(`td`,{children:(0,H.jsx)(`span`,{className:`wlab`,children:n})}),(0,H.jsx)(`td`,{className:`num usedpct`,children:r}),(0,H.jsx)(`td`,{className:`num dpp`,children:i}),(0,H.jsx)(`td`,{className:`num delta ${a.cls}`,children:a.text})]},e.label+`|`+t)})})]})]})})}var As=/(^|\/)(subagents\/|agent-)/;function js(){return(0,_.useSyncExternalStore)(B,()=>z().snapshot?.generated_at??``)}function Ms(){let e=(0,_.useSyncExternalStore)(B,()=>z().openSessionId),t=js(),[n,r]=(0,_.useState)(null),[i,a]=(0,_.useState)(!0),[o,s]=(0,_.useState)(null),c=(0,_.useRef)(null),l=(0,_.useRef)(!1),u=(0,_.useRef)(null);return(0,_.useEffect)(()=>{u.current=e??z().snapshot?.sessions?.rows?.[0]?.session_id??null,l.current=!1},[e]),(0,_.useEffect)(()=>{let e=u.current;if(!e){a(!1),s(`No session available.`),r(null),c.current=null;return}let t=c.current!==e||n==null;c.current=e,t&&(a(!0),s(null),r(null));let i=new AbortController;return fetch(`/api/session/${encodeURIComponent(e)}`,{signal:i.signal}).then(async e=>{if(e.status===404){(t||l.current)&&(a(!1),s(`Session not found (the cache may have rolled forward).`),r(null)),l.current=!0;return}if(!e.ok)throw Error(`HTTP `+e.status);let n=await e.json();l.current=!1,r(n),s(null),a(!1)}).catch(e=>{e.name!==`AbortError`&&(l.current=!1,t&&(s(`Failed to load: `+e.message),a(!1)))}),()=>i.abort()},[e,t]),(0,H.jsx)(ss,{title:`Session detail`,accentClass:`accent-orange`,headerExtras:(0,H.jsx)(Jt,{panel:`sessions`,panelLabel:`Session`,triggerId:`session-modal`,onClick:()=>V(L(`sessions`,`session-modal`))}),children:(0,H.jsxs)(`section`,{className:`modal-sessions`,children:[i?(0,H.jsx)(`div`,{className:`modal-loading`,id:`msess-loading`,children:`Loading session detail…`}):null,o?(0,H.jsx)(`div`,{className:`modal-error`,id:`msess-error`,children:o}):null,!i&&!o&&n?(0,H.jsx)(Ns,{detail:n}):null]})})}function Ns({detail:e}){let t=Array.isArray(e.source_paths)?e.source_paths:[],n=[],r=[];t.forEach(e=>{As.test(e)?r.push(e):n.push(e)});let i=e.cost_total_usd??0,a=[[`Input`,e.input_tokens,null],[`Output`,e.output_tokens,null],[`Cache creation`,e.cache_creation_tokens,null],[`Cache read`,e.cache_read_tokens,null],[`Cache hit %`,e.cache_hit_pct,`cache-hit`]].filter(e=>e[1]!=null),o=!e.models||e.models.length===0,s=!e.cost_per_model||e.cost_per_model.length===0;return(0,H.jsxs)(`div`,{className:`modal-content`,id:`msess-content`,children:[(0,H.jsx)(`div`,{className:`m-chipstrip`,children:(0,H.jsx)(`span`,{className:`msess-badge`,id:`msess-id`,"aria-label":`Session ID`,children:e.session_id??`—`})}),(0,H.jsxs)(`div`,{className:`m-hero cols-3`,children:[(0,H.jsxs)(`div`,{className:`m-kv kv-cost`,children:[(0,H.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#dollar`})}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`v`,id:`msess-cost`,children:e.cost_total_usd==null?`—`:`$`+e.cost_total_usd.toFixed(2)}),(0,H.jsx)(`div`,{className:`lbl`,children:`Total cost`})]})]}),(0,H.jsxs)(`div`,{className:`m-kv kv-dur`,children:[(0,H.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#clock`})}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`v`,id:`msess-dur`,children:e.duration_min==null?`—`:e.duration_min+` min`}),(0,H.jsx)(`div`,{className:`lbl`,children:`Duration`})]})]}),(0,H.jsxs)(`div`,{className:`m-kv kv-proj`,children:[(0,H.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#folder`})}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`v`,id:`msess-project`,title:e.project_path??``,"aria-label":`Project`,children:e.project_label??e.project_path??`—`}),(0,H.jsx)(`div`,{className:`lbl`,children:`Project`})]})]})]}),(0,H.jsxs)(`div`,{className:`msess-ts`,children:[(0,H.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#calendar`})}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`span`,{className:`k`,children:`started`}),(0,H.jsx)(`span`,{className:`v`,id:`msess-started`,children:e.started_utc??`—`})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`span`,{className:`k`,children:`last activity`}),(0,H.jsx)(`span`,{className:`v`,id:`msess-last`,children:e.last_activity_utc??`—`})]})]}),(0,H.jsxs)(`h3`,{className:`m-sec sec-tok`,children:[(0,H.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#hash`})}),`Tokens`]}),(0,H.jsx)(`div`,{className:`msess-tok-grid`,id:`msess-tokens`,children:a.map(([e,t,n])=>(0,H.jsxs)(`div`,{className:`msess-tok-tile`+(n?` `+n:``),children:[(0,H.jsx)(`div`,{className:`lbl`,children:e}),(0,H.jsx)(`div`,{className:`n`,children:n===`cache-hit`?t.toFixed(1)+`%`:t.toLocaleString(`en-US`)}),n===`cache-hit`?(0,H.jsx)(`div`,{className:`bar`,children:(0,H.jsx)(`div`,{className:`fill`,style:{width:Math.max(0,Math.min(t,100))+`%`}})}):null]},e))}),o?null:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`h3`,{className:`m-sec sec-mod`,children:[(0,H.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#sparkles`})}),`Models`]}),(0,H.jsx)(`div`,{className:`m-chipstrip`,id:`msess-models`,children:(e.models||[]).map(e=>(0,H.jsx)(`span`,{className:`chip `+fn(e.name),children:e.name},e.name))})]}),s?null:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`h3`,{className:`m-sec sec-costm`,children:[(0,H.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#pie-chart`})}),`Cost by model`]}),(0,H.jsxs)(`div`,{className:`msess-costm`,children:[(0,H.jsx)(`div`,{className:`bar`,id:`msess-cost-bar`,children:(e.cost_per_model||[]).map(e=>{let t=i>0&&e.cost_usd!=null?e.cost_usd/i*100:0;return(0,H.jsx)(`div`,{className:`seg `+fn(e.model),style:{width:t+`%`}},e.model)})}),(0,H.jsx)(`div`,{className:`legend`,id:`msess-cost-legend`,children:(e.cost_per_model||[]).map(e=>{let t=i>0&&e.cost_usd!=null?e.cost_usd/i*100:0;return(0,H.jsxs)(`div`,{className:`lg`,children:[(0,H.jsx)(`span`,{className:`sw `+fn(e.model)}),(0,H.jsx)(`span`,{className:`name`,children:e.model}),(0,H.jsx)(`span`,{className:`v`,children:e.cost_usd==null?`—`:`$`+e.cost_usd.toFixed(3)}),(0,H.jsxs)(`span`,{className:`pct`,children:[Math.round(t),`%`]})]},e.model)})})]})]}),t.length>0?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`h3`,{className:`m-sec sec-src`,children:[(0,H.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#file-text`})}),`Source files`]}),(0,H.jsxs)(`div`,{className:`msess-src`,id:`msess-src`,children:[(0,H.jsxs)(`div`,{className:`src-head`,children:[(0,H.jsxs)(`span`,{className:`count-pill`,children:[t.length,` file`,t.length===1?``:`s`]}),(0,H.jsxs)(`span`,{className:`sub`,children:[n.length,` primary`,r.length>0?(0,H.jsxs)(H.Fragment,{children:[` `,(0,H.jsx)(`span`,{className:`dot`,children:`·`}),` `,(0,H.jsxs)(`span`,{className:`subcount`,children:[r.length,` subagent`,r.length===1?``:`s`]})]}):null]})]}),n.length>0?n.map(e=>(0,H.jsx)(`div`,{className:`primary-path`,children:e},e)):r.length>0?(0,H.jsxs)(`div`,{className:`src-empty-primary`,children:[`No primary path resolved · `,r.length,` subagent path`,r.length===1?``:`s`,` below`]}):null,r.length>0?(0,H.jsxs)(`details`,{className:`subagents`,open:n.length===0,children:[(0,H.jsxs)(`summary`,{children:[`Show `,r.length,` subagent path`,r.length===1?``:`s`]}),(0,H.jsx)(`ul`,{className:`paths`,children:r.map(e=>(0,H.jsx)(`li`,{children:e},e))})]}):null]})]}):null]})}function Ps({row:e,variant:t,accentClass:n}){let r=Gt(),i={tz:r.resolvedTz,offsetLabel:r.offsetLabel},a=(e,t)=>`${A.datetimeShort(e,i)} → ${A.datetimeShort(t,i)}`,o=e.delta_cost_pct==null?`flat`:e.delta_cost_pct>0?`up`:e.delta_cost_pct<0?`down`:`flat`,s=t===`weekly`?`week`:t===`monthly`?`month`:`day`,c=t===`daily`?`Today`:`Now`;return(0,H.jsxs)(`div`,{className:`detail-card ${n}`,children:[(0,H.jsxs)(`div`,{className:`head`,children:[(0,H.jsxs)(`div`,{className:`big`,children:[e.label,e.is_current&&(0,H.jsx)(`span`,{className:`pill-current`,children:c})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`span`,{className:`cost`,style:{color:`var(--text)`,fontWeight:700},children:A.usd2(e.cost_usd)}),` `,e.delta_cost_pct==null?(0,H.jsx)(`span`,{className:`delta flat`,children:`—`}):(0,H.jsxs)(`span`,{className:`delta ${o}`,children:[A.deltaPct(e.delta_cost_pct),` vs prior `,s]})]})]}),t===`weekly`&&e.week_start_at&&e.week_end_at&&(0,H.jsxs)(`div`,{className:`window`,children:[`Subscription window: `,a(e.week_start_at,e.week_end_at)]}),(0,H.jsx)(`div`,{className:`model-stack`,role:`presentation`,children:e.models.map(e=>(0,H.jsx)(`span`,{className:e.chip,style:{width:`${e.cost_pct}%`}},e.model))}),(0,H.jsx)(`div`,{className:`chips`,children:e.models.map(e=>(0,H.jsxs)(`span`,{className:`chip ${e.chip}`,children:[e.display,` `,Math.round(e.cost_pct),`% · `,A.usd2(e.cost_usd)]},e.model))}),(0,H.jsxs)(`div`,{className:`tokens-row`,children:[(0,H.jsxs)(`div`,{className:`t`,children:[(0,H.jsx)(`span`,{className:`k`,children:`Input`}),(0,H.jsx)(`span`,{className:`v`,children:A.compact(e.input_tokens)})]}),(0,H.jsxs)(`div`,{className:`t`,children:[(0,H.jsx)(`span`,{className:`k`,children:`Output`}),(0,H.jsx)(`span`,{className:`v`,children:A.compact(e.output_tokens)})]}),(0,H.jsxs)(`div`,{className:`t`,children:[(0,H.jsx)(`span`,{className:`k`,children:`Cache+`}),(0,H.jsx)(`span`,{className:`v`,children:A.compact(e.cache_creation_tokens)})]}),(0,H.jsxs)(`div`,{className:`t`,children:[(0,H.jsx)(`span`,{className:`k`,children:`Cache-read`}),(0,H.jsx)(`span`,{className:`v`,children:A.compact(e.cache_read_tokens)})]}),(0,H.jsxs)(`div`,{className:`t`,children:[(0,H.jsx)(`span`,{className:`k`,children:`Total`}),(0,H.jsx)(`span`,{className:`v`,children:A.compact(e.total_tokens)})]}),e.cache_hit_pct!=null&&(0,H.jsxs)(`div`,{className:`t cache`,children:[(0,H.jsx)(`span`,{className:`k`,children:`Cache hit`}),(0,H.jsxs)(`span`,{className:`v`,children:[e.cache_hit_pct.toFixed(1),`%`]}),(0,H.jsx)(`div`,{className:`bar`,children:(0,H.jsx)(`div`,{className:`fill`,style:{width:`${Math.min(100,Math.max(0,e.cache_hit_pct))}%`}})})]})]}),t===`weekly`&&(0,H.jsxs)(`div`,{className:`stats2`,children:[(0,H.jsxs)(`div`,{className:`s`,children:[(0,H.jsx)(`span`,{className:`k`,children:`Used %`}),(0,H.jsx)(`span`,{className:`v`,children:A.pct0(e.used_pct)})]}),(0,H.jsxs)(`div`,{className:`s`,children:[(0,H.jsx)(`span`,{className:`k`,children:`$/1%`}),(0,H.jsx)(`span`,{className:`v`,children:A.usd2(e.dollar_per_pct)})]})]})]})}function Fs(e){return e==null||e===0?`num`:e>0?`num delta-up`:`num delta-down`}function Is(e){let t=new Set,n=[];for(let r of e.models)t.has(r.chip)||(t.add(r.chip),n.push(r.chip));return n}function Ls({row:e}){let t=Is(e),n=t.slice(0,3),r=t.length>3?t.length-3:0;return(0,H.jsxs)(`span`,{className:`models-chips`,children:[n.map(e=>(0,H.jsx)(`span`,{className:`chip ${e}`,children:e},e)),r>0&&(0,H.jsxs)(`span`,{className:`models-chips-more`,children:[`…+`,r]})]})}function Rs({rows:e,variant:t,accentClass:n,selectedIndex:r,onSelect:i}){return(0,H.jsxs)(`table`,{className:`history-table history-table--${t} ${n}`,role:`grid`,"aria-rowcount":e.length,children:[(0,H.jsx)(`thead`,{children:(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`th`,{children:t===`weekly`?`Week`:`Month`}),(0,H.jsx)(`th`,{children:`Models`}),(0,H.jsx)(`th`,{className:`num`,children:`Cost (USD)`}),t===`weekly`&&(0,H.jsx)(`th`,{className:`num`,children:`Used %`}),t===`weekly`&&(0,H.jsx)(`th`,{className:`num`,children:`$/1%`}),(0,H.jsx)(`th`,{className:`num`,children:`Δ`})]})}),(0,H.jsx)(`tbody`,{children:e.map((e,n)=>(0,H.jsxs)(`tr`,{className:n===r?`selected`:void 0,"aria-rowindex":n+1,"aria-selected":n===r,onClick:()=>i(n),children:[(0,H.jsxs)(`td`,{children:[e.label,n===r?` ▶`:``]}),(0,H.jsx)(`td`,{children:(0,H.jsx)(Ls,{row:e})}),(0,H.jsx)(`td`,{className:`num`,children:A.usd2(e.cost_usd)}),t===`weekly`&&(0,H.jsx)(`td`,{className:`num`,children:A.pct0(e.used_pct)}),t===`weekly`&&(0,H.jsx)(`td`,{className:`num`,children:A.usd2(e.dollar_per_pct)}),(0,H.jsx)(`td`,{className:Fs(e.delta_cost_pct),children:A.deltaPct(e.delta_cost_pct)})]},e.label))})]})}function zs(){let e=Ge()?.weekly?.rows??[],[t,n]=(0,_.useState)(0),r=e.length;(0,_.useEffect)(()=>Vt([{key:`ArrowDown`,scope:`modal`,when:()=>z().openModal===`weekly`,action:()=>n(e=>Math.min(e+1,Math.max(0,r-1)))},{key:`ArrowUp`,scope:`modal`,when:()=>z().openModal===`weekly`,action:()=>n(e=>Math.max(e-1,0))}]),[r]);let i=(0,H.jsx)(Jt,{panel:`weekly`,panelLabel:`Weekly`,triggerId:`weekly-modal`,onClick:()=>V(L(`weekly`,`weekly-modal`))});if(r===0)return(0,H.jsx)(ss,{title:`Weekly history · last 12`,accentClass:`accent-cyan`,headerExtras:i,children:(0,H.jsx)(`div`,{className:`panel-empty`,children:`No usage history yet.`})});let a=e[Math.min(t,r-1)];return(0,H.jsxs)(ss,{title:`Weekly history · last 12`,accentClass:`accent-cyan`,headerExtras:i,children:[(0,H.jsx)(Ps,{row:a,variant:`weekly`,accentClass:`accent-cyan`}),(0,H.jsx)(Rs,{rows:e,variant:`weekly`,accentClass:`accent-cyan`,selectedIndex:t,onSelect:n})]})}function Bs(){let e=Ge()?.monthly?.rows??[],[t,n]=(0,_.useState)(0),r=e.length;(0,_.useEffect)(()=>Vt([{key:`ArrowDown`,scope:`modal`,when:()=>z().openModal===`monthly`,action:()=>n(e=>Math.min(e+1,Math.max(0,r-1)))},{key:`ArrowUp`,scope:`modal`,when:()=>z().openModal===`monthly`,action:()=>n(e=>Math.max(e-1,0))}]),[r]);let i=(0,H.jsx)(Jt,{panel:`monthly`,panelLabel:`Monthly`,triggerId:`monthly-modal`,onClick:()=>V(L(`monthly`,`monthly-modal`))});if(r===0)return(0,H.jsx)(ss,{title:`Monthly history · last 12`,accentClass:`accent-pink`,headerExtras:i,children:(0,H.jsx)(`div`,{className:`panel-empty`,children:`No usage history yet.`})});let a=e[Math.min(t,r-1)];return(0,H.jsxs)(ss,{title:`Monthly history · last 12`,accentClass:`accent-pink`,headerExtras:i,children:[(0,H.jsx)(Ps,{row:a,variant:`monthly`,accentClass:`accent-pink`}),(0,H.jsx)(Rs,{rows:e,variant:`monthly`,accentClass:`accent-pink`,selectedIndex:t,onSelect:n})]})}var Vs=720,Hs=180,Us={left:46,right:20,top:18,bottom:20};function Ws(e){return e===0?`$0`:e<10?`$`+e.toFixed(2):`$`+Math.round(e).toString()}function Gs(){return(0,_.useSyncExternalStore)(B,()=>z().snapshot?.generated_at??``)}function Ks({detail:e}){let t=Gs(),n=Gt(),r={tz:n.resolvedTz,offsetLabel:n.offsetLabel},i=Date.parse(e.start_at),a=Date.parse(e.end_at)-i||1,o=e=>Us.left+(Date.parse(e)-i)/a*(Vs-Us.left-Us.right),s=Math.max(e.cost_usd,e.projection?.total_cost_usd??0),c=e=>{let t=Us.top,n=Hs-Us.bottom;return s<=0?n:n-e/s*(n-t)},l=[];for(let e=0;e<=5;e++)l.push(new Date(i+e*36e5).toISOString());let u=e.samples.length>0?e.samples[e.samples.length-1].cum:0,d=e.is_active?t||new Date().toISOString():null,f=[];if(e.samples.length>0){f.push([o(e.start_at),c(0)]);for(let t of e.samples)f.push([o(t.t),c(t.cum)]);d&&f.push([o(d),c(u)])}let p=f.map(([e,t])=>`${e.toFixed(1)},${t.toFixed(1)}`).join(` `),m=f.length>0?`M ${p.replace(/ /g,` L `)} L ${f[f.length-1][0].toFixed(1)},${c(0).toFixed(1)} Z`:``,h=s<=0?[0]:[0,s/2,s];return(0,H.jsx)(`div`,{className:`mblock-timeline`,children:(0,H.jsxs)(`svg`,{viewBox:`0 0 ${Vs} ${Hs}`,style:{width:`100%`,height:`auto`},role:`img`,"aria-label":`Cumulative cost over the 5-hour block window`,children:[h.map(e=>(0,H.jsx)(`text`,{x:8,y:c(e)+4,fill:`var(--text-dim)`,fontSize:10,children:Ws(e)},e)),(0,H.jsx)(`line`,{x1:Us.left,y1:Us.top,x2:Us.left,y2:Hs-Us.bottom,stroke:`var(--border-soft)`,strokeWidth:.8}),(0,H.jsx)(`line`,{x1:Us.left,y1:Hs-Us.bottom,x2:Vs-Us.right,y2:Hs-Us.bottom,stroke:`var(--border-soft)`,strokeWidth:.8}),l.slice(1,-1).map(e=>(0,H.jsx)(`line`,{x1:o(e),y1:Us.top,x2:o(e),y2:Hs-Us.bottom,stroke:`var(--border-soft)`,strokeDasharray:`2 3`,strokeWidth:.5},e)),l.map(e=>(0,H.jsx)(`text`,{x:o(e)-14,y:Hs-5,fill:`var(--text-dim)`,fontSize:9,children:A.timeHHmm(e,r,{noSuffix:!0})},e)),f.length>0?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`path`,{d:m,fill:`var(--accent-green)`,opacity:.12}),(0,H.jsx)(`polyline`,{points:p,fill:`none`,stroke:`var(--accent-green)`,strokeWidth:2}),(0,H.jsx)(`circle`,{cx:f[f.length-1][0],cy:f[f.length-1][1],r:3,fill:`var(--accent-green)`})]}):(0,H.jsx)(`text`,{x:Vs/2,y:Hs/2,fill:`var(--text-faint)`,fontSize:11,textAnchor:`middle`,children:`No spend recorded yet in this block.`}),e.is_active&&e.projection&&d&&f.length>0?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`polyline`,{points:`${o(d).toFixed(1)},${c(u).toFixed(1)} ${o(e.end_at).toFixed(1)},${c(e.projection.total_cost_usd).toFixed(1)}`,fill:`none`,stroke:`var(--accent-amber)`,strokeWidth:1.5,strokeDasharray:`5 4`,opacity:.85}),(0,H.jsx)(`circle`,{cx:o(e.end_at),cy:c(e.projection.total_cost_usd),r:3,fill:`var(--accent-amber)`,opacity:.85}),(0,H.jsxs)(`text`,{x:o(e.end_at)-50,y:c(e.projection.total_cost_usd)-6,fill:`var(--accent-amber)`,fontSize:9,children:[`proj $`,e.projection.total_cost_usd.toFixed(2)]}),(0,H.jsx)(`line`,{x1:o(d),y1:Us.top,x2:o(d),y2:Hs-Us.bottom,stroke:`var(--accent-amber)`,strokeWidth:1.2}),(0,H.jsx)(`text`,{x:o(d)+4,y:Us.top+10,fill:`var(--accent-amber)`,fontSize:9,children:`now`})]}):null]})})}function qs(){return(0,_.useSyncExternalStore)(B,()=>z().snapshot?.generated_at??``)}function Js(e,t){let n=Date.parse(e.start_at),r=e.is_active?Date.parse(t)||Date.now():e.actual_end_at?Date.parse(e.actual_end_at):Date.parse(e.end_at),i=Math.max(0,Math.floor((r-n)/6e4)),a=Math.floor(i/60),o=i%60;return`${a}h ${String(o).padStart(2,`0`)}m`}function Ys(e,t,n){return`${A.timeHHmm(e,n)} → ${A.timeHHmm(t,n)}`}function Xs(){let e=(0,_.useSyncExternalStore)(B,()=>z().openBlockStartAt),t=qs(),n=Gt(),r={tz:n.resolvedTz,offsetLabel:n.offsetLabel},[i,a]=(0,_.useState)(null),[o,s]=(0,_.useState)(!0),[c,l]=(0,_.useState)(null),u=(0,_.useRef)(null),d=(0,_.useRef)(!1),f=(0,_.useRef)(null);return(0,_.useEffect)(()=>{f.current=e??null,d.current=!1},[e]),(0,_.useEffect)(()=>{let e=f.current;if(!e){s(!1),l(`No block bound.`),a(null),u.current=null;return}let t=u.current!==e||i==null;u.current=e,t&&(s(!0),l(null),a(null));let n=new AbortController;return fetch(`/api/block/${encodeURIComponent(e)}`,{signal:n.signal}).then(async e=>{if(e.status===404){(t||d.current)&&(s(!1),l(`Block not found (the cache may have rolled forward).`),a(null)),d.current=!0;return}if(!e.ok)throw Error(`HTTP `+e.status);let n=await e.json();d.current=!1,a(n),l(null),s(!1)}).catch(e=>{e.name!==`AbortError`&&(d.current=!1,t&&(l(`Failed to load: `+e.message),s(!1)))}),()=>n.abort()},[e,t]),(0,H.jsx)(ss,{title:i?`${i.anchor===`heuristic`?`~ `:``}Block · ${i.label}`:`Block`,accentClass:`accent-blue`,headerExtras:(0,H.jsx)(Jt,{panel:`blocks`,panelLabel:`5-hour block`,triggerId:`block-modal`,onClick:()=>V(L(`blocks`,`block-modal`))}),children:(0,H.jsxs)(`section`,{className:`modal-block`,children:[o?(0,H.jsx)(`div`,{className:`modal-loading`,children:`Loading block detail…`}):null,c?(0,H.jsx)(`div`,{className:`modal-error`,children:c}):null,!o&&!c&&i?(0,H.jsx)(Zs,{detail:i,generatedAt:t,ctx:r}):null]})})}function Zs({detail:e,generatedAt:t,ctx:n}){let r=e.cost_usd??0;return(0,H.jsxs)(`div`,{className:`modal-content`,children:[(0,H.jsxs)(`div`,{className:`m-chipstrip`,children:[e.is_active?(0,H.jsx)(`span`,{className:`m-pill accent-green`,children:`● Active`}):null,e.anchor===`heuristic`?(0,H.jsx)(`span`,{className:`m-pill accent-amber`,children:`~ heuristic anchor`}):null,(0,H.jsx)(`span`,{className:`m-pill accent-blue`,children:Ys(e.start_at,e.end_at,n)}),(0,H.jsxs)(`span`,{className:`m-pill`,children:[e.entries_count.toLocaleString(`en-US`),` `,e.entries_count===1?`entry`:`entries`]})]}),(0,H.jsxs)(`div`,{className:`m-hero `+(e.is_active?`cols-4`:`cols-3`),children:[(0,H.jsxs)(`div`,{className:`m-kv kv-cost`,children:[(0,H.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#dollar`})}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`v`,children:A.usd2(e.cost_usd)}),(0,H.jsx)(`div`,{className:`lbl`,children:`Total cost`})]})]}),(0,H.jsxs)(`div`,{className:`m-kv kv-dur`,children:[(0,H.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#clock`})}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`v`,children:Js(e,t)}),(0,H.jsx)(`div`,{className:`lbl`,children:`Elapsed`})]})]}),(0,H.jsxs)(`div`,{className:`m-kv`,children:[(0,H.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#hash`})}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`v`,children:e.total_tokens.toLocaleString(`en-US`)}),(0,H.jsx)(`div`,{className:`lbl`,children:`Total tokens`})]})]}),e.is_active?(0,H.jsxs)(`div`,{className:`m-kv kv-proj`,children:[(0,H.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#crystal-ball`})}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`v`,children:e.projection?A.usd2(e.projection.total_cost_usd):`—`}),(0,H.jsxs)(`div`,{className:`lbl`,children:[`Projected`,e.projection?` · ${e.projection.remaining_minutes}m left`:``]})]})]}):null]}),(0,H.jsx)(Ks,{detail:e}),(0,H.jsxs)(`h3`,{className:`m-sec sec-tok`,children:[(0,H.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#hash`})}),`Tokens`]}),(0,H.jsxs)(`div`,{className:`msess-tok-grid mblock-tok-grid`,children:[(0,H.jsxs)(`div`,{className:`msess-tok-tile`,children:[(0,H.jsx)(`div`,{className:`lbl`,children:`Input`}),(0,H.jsx)(`div`,{className:`n`,children:e.input_tokens.toLocaleString(`en-US`)})]}),(0,H.jsxs)(`div`,{className:`msess-tok-tile`,children:[(0,H.jsx)(`div`,{className:`lbl`,children:`Output`}),(0,H.jsx)(`div`,{className:`n`,children:e.output_tokens.toLocaleString(`en-US`)})]}),(0,H.jsxs)(`div`,{className:`msess-tok-tile`,children:[(0,H.jsx)(`div`,{className:`lbl`,children:`Cache create`}),(0,H.jsx)(`div`,{className:`n`,children:e.cache_creation_tokens.toLocaleString(`en-US`)})]}),(0,H.jsxs)(`div`,{className:`msess-tok-tile`,children:[(0,H.jsx)(`div`,{className:`lbl`,children:`Cache read`}),(0,H.jsx)(`div`,{className:`n`,children:e.cache_read_tokens.toLocaleString(`en-US`)})]}),e.cache_hit_pct==null?null:(0,H.jsxs)(`div`,{className:`msess-tok-tile cache-hit`,children:[(0,H.jsx)(`div`,{className:`lbl`,children:`Cache hit %`}),(0,H.jsxs)(`div`,{className:`n`,children:[e.cache_hit_pct.toFixed(1),`%`]}),(0,H.jsx)(`div`,{className:`bar`,children:(0,H.jsx)(`div`,{className:`fill`,style:{width:Math.min(100,Math.max(0,e.cache_hit_pct))+`%`}})})]})]}),e.models.length>0?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`h3`,{className:`m-sec sec-costm`,children:[(0,H.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#pie-chart`})}),`Cost by model`]}),(0,H.jsxs)(`div`,{className:`msess-costm`,children:[(0,H.jsx)(`div`,{className:`bar`,children:e.models.map(e=>{let t=r>0?e.cost_usd/r*100:0;return(0,H.jsx)(`div`,{className:`seg `+fn(e.model),style:{width:t+`%`}},e.model)})}),(0,H.jsx)(`div`,{className:`legend`,children:e.models.map(e=>{let t=r>0?e.cost_usd/r*100:0;return(0,H.jsxs)(`div`,{className:`lg`,children:[(0,H.jsx)(`span`,{className:`sw `+fn(e.model)}),(0,H.jsx)(`span`,{className:`name`,children:e.display}),(0,H.jsxs)(`span`,{className:`v`,children:[`$`,e.cost_usd.toFixed(2)]}),(0,H.jsxs)(`span`,{className:`pct`,children:[Math.round(t),`%`]})]},e.model)})})]})]}):null,e.is_active&&e.burn_rate&&e.projection?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`h3`,{className:`m-sec sec-burn`,children:[(0,H.jsx)(`svg`,{className:`icon`,"aria-hidden":`true`,children:(0,H.jsx)(`use`,{href:`/static/icons.svg#crystal-ball`})}),`Burn rate & projection`]}),(0,H.jsxs)(`div`,{className:`mblock-burn`,children:[(0,H.jsxs)(`div`,{className:`row`,children:[(0,H.jsx)(`span`,{className:`k`,children:`Burn rate`}),(0,H.jsx)(`span`,{className:`v amber`,children:A.usd2(e.burn_rate.cost_per_hour)}),(0,H.jsx)(`span`,{className:`dim`,children:`/ hr`}),(0,H.jsx)(`span`,{className:`sep`,children:`·`}),(0,H.jsx)(`span`,{className:`v cyan`,children:Math.round(e.burn_rate.tokens_per_minute).toLocaleString(`en-US`)}),(0,H.jsx)(`span`,{className:`dim`,children:`tok / min`})]}),(0,H.jsxs)(`div`,{className:`row`,children:[(0,H.jsx)(`span`,{className:`k`,children:`Projection`}),(0,H.jsx)(`span`,{className:`v amber`,children:A.usd2(e.projection.total_cost_usd)}),(0,H.jsx)(`span`,{className:`dim`,children:`total`}),(0,H.jsx)(`span`,{className:`sep`,children:`·`}),(0,H.jsx)(`span`,{className:`v cyan`,children:e.projection.total_tokens.toLocaleString(`en-US`)}),(0,H.jsx)(`span`,{className:`dim`,children:`tok`}),(0,H.jsx)(`span`,{className:`sep`,children:`·`}),(0,H.jsxs)(`span`,{className:`v`,children:[e.projection.remaining_minutes,` min`]}),(0,H.jsx)(`span`,{className:`dim`,children:`remaining`})]})]})]}):null]})}function Qs({rows:e,selectedDate:t,onSelect:n}){let r=[...e].reverse(),i=r.reduce((e,t)=>Math.max(e,t.cost_usd),0),a=r.length>0?$s(r[0].date):``,o=r.length>0?$s(r[r.length-1].date):``,s=r.find(e=>e.is_today),c=s?`${$s(s.date)} · today`:``;return(0,H.jsxs)(`section`,{className:`daily-modal-bars`,"aria-label":`30-day cost`,children:[(0,H.jsxs)(`div`,{className:`daily-modal-bars-head`,children:[(0,H.jsxs)(`span`,{children:[`30-day cost · selected: `,t?$s(t):`—`]}),(0,H.jsx)(`span`,{className:`hint`,children:`↑↓ navigate · click any bar`})]}),(0,H.jsx)(`div`,{className:`daily-modal-bars-grid`,role:`img`,"aria-label":`30-day cost histogram`,children:r.map(e=>{let r=e.cost_usd<=0,a=e.date===t,o=r?4:i>0?e.cost_usd/i*100:0,s=[`bar`,r?`zero`:``,a?`sel`:``,e.is_today?`today`:``].filter(Boolean).join(` `);return(0,H.jsx)(`button`,{"data-date":e.date,className:s,style:{height:`${o}%`},disabled:r,"aria-pressed":a,"aria-label":`${e.label} cost ${e.cost_usd>0?A.usd2(e.cost_usd):`no usage`}`,title:e.cost_usd>0?`${e.label} · ${A.usd2(e.cost_usd)}`:`${e.label} · —`,onClick:()=>{r||n(e.date)}},e.date)})}),r.length>0&&(0,H.jsxs)(`div`,{className:`daily-modal-bars-axis`,children:[(0,H.jsx)(`span`,{children:a}),c&&(0,H.jsx)(`span`,{children:c}),(0,H.jsx)(`span`,{children:o})]})]})}function $s(e){let t=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],n=e.split(`-`).map(Number);return`${t[n[1]-1]} ${n[2]}`}function ec(){let e=Ge()?.daily?.rows??[],t=(0,_.useSyncExternalStore)(B,()=>z().openDailyDate),[n,r]=(0,_.useState)(null);(0,_.useEffect)(()=>{t&&r(t)},[]);let i=new Set(e.map(e=>e.date)),a=e[0]?.date??null,o=n&&i.has(n)?n:a;(0,_.useEffect)(()=>Vt([{key:`ArrowDown`,scope:`modal`,when:()=>z().openModal===`daily`,action:()=>{let t=o;if(!t)return;let n=e.findIndex(e=>e.date===t);n<0||n>=e.length-1||r(e[n+1].date)}},{key:`ArrowUp`,scope:`modal`,when:()=>z().openModal===`daily`,action:()=>{let t=o;if(!t)return;let n=e.findIndex(e=>e.date===t);n<=0||r(e[n-1].date)}}]),[e,o]);let s=(0,H.jsx)(Jt,{panel:`daily`,panelLabel:`Daily`,triggerId:`daily-modal`,onClick:()=>V(L(`daily`,`daily-modal`))});if(e.length===0)return(0,H.jsx)(ss,{title:`Daily history · last 30`,accentClass:`accent-indigo`,headerExtras:s,children:(0,H.jsx)(`div`,{className:`panel-empty`,children:`No usage history yet.`})});let c=e.findIndex(e=>e.date===o),l=c>=0?c:0,u=e[l],d=e[l+1],f=tc(u,d);return(0,H.jsxs)(ss,{title:`Daily history · last 30`,accentClass:`accent-indigo`,headerExtras:s,children:[(0,H.jsx)(Qs,{rows:e,selectedDate:o,onSelect:r}),(0,H.jsx)(Ps,{row:f,variant:`daily`,accentClass:`accent-indigo`})]})}function tc(e,t){let n=t&&t.cost_usd>0?(e.cost_usd-t.cost_usd)/t.cost_usd:null;return{label:e.label,cost_usd:e.cost_usd,total_tokens:e.total_tokens,input_tokens:e.input_tokens,output_tokens:e.output_tokens,cache_creation_tokens:e.cache_creation_tokens,cache_read_tokens:e.cache_read_tokens,used_pct:null,dollar_per_pct:null,delta_cost_pct:n,is_current:e.is_today,models:e.models,cache_hit_pct:e.cache_hit_pct}}var nc=[`#d946ef`,`#c084fc`,`#60a5fa`,`#fbbf24`,`#22d3ee`],rc=`#64748b`,ic=5,ac=400,oc=150;function sc({trend:e,yMode:t,windowWeeks:n,onProjectSelect:r}){let i=(0,_.useMemo)(()=>{let t=Math.max(0,Math.min(n,e.window_weeks)),r=e.weeks.slice(-t),i=e.projects.map(e=>{let n=e.weekly_cost.slice(-t),r=n.reduce((e,t)=>e+t,0);return{key:e.key,weekly:n,cost:r,color:``}}).sort((e,t)=>t.cost-e.cost),a=i.slice(0,ic).map((e,t)=>({...e,color:nc[t]??rc})),o=i.slice(ic),s=r.map((e,t)=>o.reduce((e,n)=>e+(n.weekly[t]??0),0)),c=s.reduce((e,t)=>e+t,0),l=[...a];return o.length>0&&c>0&&l.push({key:`(other)`,weekly:s,cost:c,color:rc}),{weeks:r,series:l}},[e,n]),a=ln();if(i.weeks.length===0||i.series.length===0)return(0,H.jsxs)(`div`,{className:`panel-empty`,children:[`No project activity in the last `,n,` week`,n===1?``:`s`,`.`]});let o=i.weeks.length,s=i.weeks.map((e,t)=>i.series.reduce((e,n)=>e+(n.weekly[t]??0),0)),c=t===`share`?100:Math.max(...s,.01),l=(e,t=`left`)=>o<=1?t===`left`?ac*.1:ac*.9:e/(o-1)*ac,u=Array(o).fill(0),d=i.series.map(e=>{let n=[];for(let e=0;e<o;e++){let t=oc-u[e]/c*oc;n.push(`${l(e,`left`).toFixed(2)},${t.toFixed(2)}`),o===1&&n.push(`${l(e,`right`).toFixed(2)},${t.toFixed(2)}`)}for(let r=o-1;r>=0;r--){let i=s[r]??0,a=t===`share`?i>0?(e.weekly[r]??0)/i*100:0:e.weekly[r]??0;u[r]+=a;let d=oc-u[r]/c*oc;o===1&&n.push(`${l(r,`right`).toFixed(2)},${d.toFixed(2)}`),n.push(`${l(r,`left`).toFixed(2)},${d.toFixed(2)}`)}return{color:e.color,key:e.key,points:n.join(` `)}}),f=i.weeks.map(e=>(0,H.jsx)(`span`,{children:e.week_label},e.week_start_date));return(0,H.jsxs)(`div`,{className:`projects-trend`,children:[(0,H.jsx)(`svg`,{viewBox:`0 0 ${ac} ${oc}`,preserveAspectRatio:`none`,role:`img`,"aria-label":`Stacked area: project ${t===`share`?`share %`:`cost`} over ${o} weeks`,children:d.map(e=>{let t=e.key===`(other)`;return(0,H.jsx)(`polygon`,{fill:e.color,opacity:t?.5:.65,points:e.points,"data-series-key":e.key,onClick:()=>{t||r?.(e.key)},style:{cursor:t?`default`:`pointer`}},e.key)})}),(0,H.jsx)(`div`,{className:`projects-trend-xaxis`,children:f}),(0,H.jsx)(`div`,{className:`projects-trend-legend`,children:i.series.map(e=>{let t=e.key===`(other)`,n=(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{className:`sw`,style:{background:e.color}}),e.key]});return a&&!t?(0,H.jsx)(`button`,{type:`button`,className:`projects-trend-legend-item`,"data-series-key":e.key,onClick:()=>r?.(e.key),children:n},e.key):(0,H.jsx)(`span`,{className:`projects-trend-legend-item`,"data-series-key":e.key,children:n},e.key)})})]})}function cc(e,t){let[n,r]=(0,_.useState)(null),[i,a]=(0,_.useState)(!1),[o,s]=(0,_.useState)(null),c=Ge()?.generated_at??``,l=(0,_.useRef)(0),u=(0,_.useRef)(null),d=(0,_.useRef)(null),f=(0,_.useRef)(!1);return(0,_.useEffect)(()=>{if(!e){r(null),a(!1),s(null),l.current=0,u.current=null,d.current=null,f.current=!1;return}let i=u.current!==e||d.current!==t,o=i||n==null;if(o&&f.current&&!i)return;o&&(a(!0),s(null)),i&&(l.current=0),u.current=e,d.current=t,f.current=!0;let c=new AbortController,p=`/api/project/${encodeURIComponent(e)}?weeks=${t}`;return fetch(p,{signal:c.signal}).then(async e=>{if(e.status===404){l.current+=1,l.current>=2?(r(null),s(`Project no longer in cache — close this drill.`),a(!1)):o&&(s(`Couldn't load project detail — will retry on next tick.`),a(!1));return}if(!e.ok){o&&(s(`Couldn't load project detail — will retry on next tick.`),a(!1));return}l.current=0,r(await e.json()),s(null),a(!1)}).catch(e=>{e?.name!==`AbortError`&&o&&(s(`Couldn't load project detail — will retry on next tick.`),a(!1))}).finally(()=>{f.current=!1}),()=>c.abort()},[e,t,c]),{data:n,loading:i,error:o}}function lc({projectKey:e,windowWeeks:t}){let{data:n,loading:r,error:i}=cc(e,t),a=Gt(),o={tz:a.resolvedTz,offsetLabel:a.offsetLabel},s=n!=null&&(n.key!==e||n.window_weeks!==t);if(r&&!n||s)return(0,H.jsx)(`div`,{className:`panel-empty`,children:`Loading…`});if(i&&!n)return(0,H.jsx)(`div`,{className:`panel-empty`,children:i});if(!n)return null;let c=n.models[0]?.cost_usd??0,l=c>0?c:1,u=Math.max(0,n.sessions_total-n.sessions.length);return(0,H.jsxs)(`div`,{className:`projects-drill`,"data-testid":`projects-drill`,"aria-live":`polite`,children:[(0,H.jsx)(`div`,{className:`projects-drill-head`,children:(0,H.jsxs)(`span`,{className:`title`,children:[`▾ `,n.key,` · `,n.sessions_total,` session`,n.sessions_total===1?``:`s`,` · `,A.usd2(n.window_cost_usd),` (`,t,`w)`]})}),(0,H.jsxs)(`div`,{className:`projects-drill-grid`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`section-label`,children:`Models (this project)`}),n.models.length===0?(0,H.jsx)(`div`,{className:`muted`,children:`No model data for this window.`}):n.models.map(e=>{let t={"--w":`${e.cost_usd/l*100}%`};return(0,H.jsxs)(`div`,{className:`drill-bar-row`,children:[(0,H.jsx)(`span`,{className:`chip ${fn(e.model)}`,children:e.model}),(0,H.jsx)(`div`,{className:`drill-bar`,style:t}),(0,H.jsx)(`span`,{className:`cost ${pn(e.cost_usd)}`,children:A.usd2(e.cost_usd)})]},e.model)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`section-label`,children:`Recent sessions →`}),n.sessions.length===0?(0,H.jsx)(`div`,{className:`muted`,children:`No sessions for this window.`}):n.sessions.map((e,t)=>(0,H.jsxs)(`button`,{"data-testid":`drill-session-${t}`,className:`drill-session-row`,onClick:()=>V({type:`OPEN_MODAL`,kind:`session`,sessionId:e.session_id}),children:[(0,H.jsx)(`span`,{className:`started`,children:A.datetimeShort(e.last_activity_at,o)}),(0,H.jsx)(`span`,{className:`chip ${fn(e.primary_model)}`,children:e.primary_model}),(0,H.jsx)(`span`,{className:`cost ${pn(e.cost_usd)}`,children:A.usd2(e.cost_usd)})]},e.session_id)),(0,H.jsxs)(`div`,{className:`drill-session-footer`,children:[u>0&&(0,H.jsxs)(`span`,{className:`muted`,children:[`+`,u,` more`]}),(0,H.jsx)(`button`,{type:`button`,"data-testid":`drill-show-in-sessions`,className:`drill-show-in-sessions`,onClick:()=>{V({type:`SET_FILTER`,text:n.key}),V({type:`CLOSE_MODAL`})},children:`Show in Sessions →`})]})]})]})]})}var uc=(e,t)=>e<t?-1:+(e>t),dc=[{id:`project`,label:`Project`,defaultDirection:`asc`,compare:(e,t)=>uc(e.key,t.key),className:`project`},{id:`sessions`,label:`Sessions`,defaultDirection:`desc`,numeric:!0,compare:(e,t)=>e.sessionsCount-t.sessionsCount},{id:`first_seen`,label:`First seen`,defaultDirection:`asc`,nullKey:e=>e.firstSeenAt,compare:(e,t)=>uc(e.firstSeenAt,t.firstSeenAt),className:`started`},{id:`last_seen`,label:`Last seen`,defaultDirection:`desc`,nullKey:e=>e.lastSeenAt,compare:(e,t)=>uc(e.lastSeenAt,t.lastSeenAt),className:`started`},{id:`cost`,label:`Cost`,defaultDirection:`desc`,numeric:!0,compare:(e,t)=>e.windowCost-t.windowCost},{id:`used_pct`,label:`Used %`,defaultDirection:`desc`,numeric:!0,nullKey:e=>e.windowPct,compare:(e,t)=>e.windowPct-t.windowPct},{id:`share_of_window`,label:`% of week`,defaultDirection:`desc`,numeric:!0,nullKey:e=>e.shareOfWindow,compare:(e,t)=>e.shareOfWindow-t.shareOfWindow}],fc=[{column:`cost`,direction:`desc`,label:`cost`,arrow:`↓`},{column:`sessions`,direction:`desc`,label:`sessions`,arrow:`↓`},{column:`used_pct`,direction:`desc`,label:`used`,arrow:`↓`},{column:`share_of_window`,direction:`desc`,label:`share`,arrow:`↓`},{column:`first_seen`,direction:`asc`,label:`first`,arrow:`↑`},{column:`last_seen`,direction:`desc`,label:`last`,arrow:`↓`},{column:`project`,direction:`asc`,label:`project`,arrow:`↑`}],pc=[1,4,8,12];function mc(){let e=Ge(),t=Gt(),n={tz:t.resolvedTz,offsetLabel:t.offsetLabel},r=(0,_.useSyncExternalStore)(B,()=>z().openProjectKey),i=(0,_.useSyncExternalStore)(B,()=>z().prefs.projectsWindowWeeks),a=(0,_.useSyncExternalStore)(B,()=>z().prefs.projectsTrendYMode),o=(0,_.useSyncExternalStore)(B,()=>z().prefs.projectsSortOverride),[s,c]=(0,_.useState)(r??null),[l,u]=(0,_.useState)(!1);(0,_.useEffect)(()=>{if(r){c(r);return}s||c(e?.projects?.current_week?.rows?.[0]?.key??null)},[r,e?.projects?.current_week?.rows]),(0,_.useEffect)(()=>{r||s&&((e?.projects?.trend?.projects??[]).some(e=>e.key===s)||c(e?.projects?.current_week?.rows?.[0]?.key??null))},[r,s,e?.projects?.trend?.projects,e?.projects?.current_week?.rows]);let d=e?.projects?.trend??null,f=i,p=d?.window_weeks??0,m=(e,t)=>{V({type:`SAVE_PREFS`,patch:{[e]:t}})},h=e=>{c(t=>t===e?null:e)},g=(d?.projects??[]).map(e=>{let t=e.weekly_cost.slice(-i),n=e.weekly_pct.slice(-i),r=e.sessions_per_week.slice(-i),a=e.first_seen_per_week.slice(-i),o=e.last_seen_per_week.slice(-i),s=t.reduce((e,t)=>e+t,0),c=n.reduce((e,t)=>t==null?e:(e??0)+t,null),l=r.reduce((e,t)=>e+t,0),u=a.reduce((e,t)=>t==null?e:e==null||t<e?t:e,null),d=o.reduce((e,t)=>t==null?e:e==null||t>e?t:e,null);return{key:e.key,sessionsCount:l,firstSeenAt:u,lastSeenAt:d,windowCost:s,windowPct:c,shareOfWindow:null}}),v=g.reduce((e,t)=>e+t.windowCost,0);for(let e of g)e.shareOfWindow=v>0?e.windowCost/v*100:null;let y=o?ce(g,dc,o):ce(g,dc,{column:`cost`,direction:`desc`}),b=y.filter(e=>e.windowCost>0).slice(0,10),x=y.length-b.length,S=l?y:b,C=x>0,w=ln(),T=(()=>{if(!o)return 0;let e=fc.findIndex(e=>e.column===o.column&&e.direction===o.direction);return e===-1?0:e})(),E=()=>{let e=fc[(T+1)%fc.length];V({type:`SET_TABLE_SORT`,table:`projects`,override:{column:e.column,direction:e.direction}})},D=fc[T],O=()=>z().shareModal===null&&z().composerModal===null;return Ut([{key:`1`,scope:`modal`,when:O,action:()=>m(`projectsWindowWeeks`,1)},{key:`4`,scope:`modal`,when:O,action:()=>m(`projectsWindowWeeks`,4)},{key:`8`,scope:`modal`,when:O,action:()=>m(`projectsWindowWeeks`,8)},{key:`0`,scope:`modal`,when:O,action:()=>m(`projectsWindowWeeks`,12)},{key:`s`,scope:`modal`,when:O,action:()=>m(`projectsTrendYMode`,a===`share`?`absolute`:`share`)},{key:`ArrowUp`,scope:`modal`,when:O,action:()=>{if(S.length===0)return;let e=S.findIndex(e=>e.key===s);c(S[e<=0?S.length-1:e-1].key)}},{key:`ArrowDown`,scope:`modal`,when:O,action:()=>{if(S.length===0)return;let e=S.findIndex(e=>e.key===s);c(S[e===-1||e===S.length-1?0:e+1].key)}},{key:`Enter`,scope:`modal`,when:O,action:()=>{s?c(null):S.length>0&&c(S[0].key)}}]),(0,H.jsx)(ss,{title:`Projects · last ${i}w`,accentClass:`accent-magenta`,headerExtras:(0,H.jsx)(Jt,{panel:`projects`,panelLabel:`Projects`,triggerId:`projects-modal`,dataTestId:`share-icon-projects-modal`,onClick:()=>V(L(`projects`,`projects-modal`,{windowWeeks:i}))}),children:(0,H.jsxs)(`div`,{className:`projects-modal-body`,children:[(0,H.jsxs)(`div`,{className:`projects-controls`,role:`radiogroup`,"aria-label":`Window`,children:[pc.map(e=>(0,H.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":i===e,className:`pill ${i===e?`on`:``}`,onClick:()=>m(`projectsWindowWeeks`,e),children:[e,`w`]},`window-${e}`)),(0,H.jsx)(`span`,{className:`sep`,"aria-hidden":`true`,children:`|`}),(0,H.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":a===`share`,className:`pill ${a===`share`?`on`:``}`,onClick:()=>m(`projectsTrendYMode`,`share`),children:`share %`}),(0,H.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":a===`absolute`,className:`pill ${a===`absolute`?`on`:``}`,onClick:()=>m(`projectsTrendYMode`,`absolute`),children:`$ absolute`})]}),p>0&&p<f&&(0,H.jsxs)(`div`,{className:`projects-notice`,children:[`Showing `,p,` week`,p===1?``:`s`,` (need more history for the full window).`]}),d?(0,H.jsx)(sc,{trend:d,yMode:a,windowWeeks:i,onProjectSelect:e=>c(e)}):(0,H.jsx)(`div`,{className:`panel-empty`,children:`Projects trend unavailable.`}),w&&(0,H.jsxs)(`button`,{type:`button`,className:`projects-mobile-sort`,"data-testid":`projects-mobile-sort`,onClick:E,"aria-label":`Cycle sort column`,children:[`Sort: `,D.label,` `,D.arrow]}),(0,H.jsxs)(`table`,{className:`projects-table`,children:[(0,H.jsx)(an,{columns:dc,override:o,onChange:e=>V({type:`SET_TABLE_SORT`,table:`projects`,override:e}),accentVar:`--accent-magenta`}),(0,H.jsx)(`tbody`,{children:S.map(e=>(0,H.jsxs)(_.Fragment,{children:[(0,H.jsxs)(`tr`,{"data-testid":`projects-table-row`,"data-cost":e.windowCost,"data-sessions":e.sessionsCount,"aria-expanded":s===e.key,className:s===e.key?`selected`:``,onClick:()=>h(e.key),children:[(0,H.jsx)(`td`,{className:`project`,children:e.key}),(0,H.jsx)(`td`,{children:e.sessionsCount}),(0,H.jsx)(`td`,{className:`started first-seen`,children:A.dateShort(e.firstSeenAt,n)??`—`}),(0,H.jsx)(`td`,{className:`started last-seen`,children:A.dateShort(e.lastSeenAt,n)??`—`}),(0,H.jsx)(`td`,{className:pn(e.windowCost),children:A.usd2(e.windowCost)}),(0,H.jsx)(`td`,{children:e.windowPct==null?`—`:A.pct0(e.windowPct)}),(0,H.jsx)(`td`,{children:e.shareOfWindow==null?`—`:A.pct0(e.shareOfWindow)})]}),w&&s===e.key&&(0,H.jsx)(`tr`,{className:`projects-drill-row`,"aria-hidden":`false`,children:(0,H.jsx)(`td`,{colSpan:7,children:(0,H.jsx)(lc,{projectKey:e.key,windowWeeks:i})})})]},e.key))})]}),C&&(0,H.jsx)(`button`,{type:`button`,className:`projects-table-toggle`,"data-testid":`projects-table-toggle`,"aria-expanded":l,onClick:()=>u(e=>!e),children:l?`Show top 10 active`:`Show all ${y.length} projects (+${x})`}),!w&&s&&(0,H.jsx)(lc,{projectKey:s,windowWeeks:i}),(0,H.jsxs)(`div`,{className:`projects-modal-footer-hint`,"data-testid":`projects-modal-footer-hint`,"aria-live":`off`,children:[(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`kbd`,{children:`1`}),`/`,(0,H.jsx)(`kbd`,{children:`4`}),`/`,(0,H.jsx)(`kbd`,{children:`8`}),`/`,(0,H.jsx)(`kbd`,{children:`0`}),` window`]}),(0,H.jsx)(`span`,{className:`sep`,"aria-hidden":`true`,children:`·`}),(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`kbd`,{children:`↑↓`}),` row`]}),(0,H.jsx)(`span`,{className:`sep`,"aria-hidden":`true`,children:`·`}),(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`kbd`,{children:`Enter`}),` drill`]}),(0,H.jsx)(`span`,{className:`sep`,"aria-hidden":`true`,children:`·`}),(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`kbd`,{children:`s`}),` share/$`]}),(0,H.jsx)(`span`,{className:`sep`,"aria-hidden":`true`,children:`·`}),(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`kbd`,{children:`Esc`}),` close`]}),(0,H.jsx)(`span`,{className:`sep`,"aria-hidden":`true`,children:`·`}),(0,H.jsx)(yt,{})]})]})})}function hc({cr:e}){let t=e.today.baseline_daily_row_count<5,n=e.today.anomaly_triggered&&!t,r;r=t?{text:`~ Building baseline · ${e.today.baseline_daily_row_count}/5 days`,cls:`thin`}:n?{text:`⚠ Anomaly`,cls:``}:{text:`✓ Healthy`,cls:`ok`};let i=e.today.baseline_median_percent,a=e.today.delta_pp,o;if(a===null)o=`—`;else{let e=A.pctFloor(Math.abs(a));o=`${a<0?`−`:`+`}${e}pp`}return(0,H.jsxs)(`div`,{className:`crm-section`,children:[(0,H.jsxs)(`div`,{className:`crm-section-head crm-sh-spotlight`,children:[`Today's spotlight`,(0,H.jsxs)(`span`,{className:`meta`,children:[e.today.date,` · `,e.days.length,` days observed`]})]}),(0,H.jsxs)(`div`,{className:`crm-spotlight${n?` anom`:``}`,children:[(0,H.jsxs)(`div`,{className:`crm-spotlight-row`,children:[(0,H.jsx)(`span`,{className:`pill${r.cls?` `+r.cls:``}`,children:r.text}),(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`span`,{className:`k`,children:`Cache hit`}),` `,(0,H.jsxs)(`strong`,{children:[A.pctFloor(e.today.cache_hit_percent),`%`]})]}),(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`span`,{className:`k`,children:`14d median`}),` `,(0,H.jsx)(`strong`,{children:i===null?`—`:`${A.pctFloor(i)}%`})]}),(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`span`,{className:`k`,children:`Δ`}),` `,(0,H.jsx)(`strong`,{children:o})]}),(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`span`,{className:`k`,children:`Net`}),` `,(0,H.jsx)(`strong`,{children:A.usdSigned(e.today.net_usd)})]}),(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`span`,{className:`k`,children:`Saved / Wasted`}),` `,(0,H.jsxs)(`strong`,{children:[`$`,e.today.saved_usd.toFixed(2),` / $`,e.today.wasted_usd.toFixed(2)]})]})]}),n&&e.today.anomaly_reasons.length>0&&(0,H.jsxs)(`div`,{className:`reasons`,children:[`Reasons:`,` `,e.today.anomaly_reasons.map((e,t)=>(0,H.jsxs)(`span`,{children:[t>0&&` · `,(0,H.jsx)(`code`,{children:e})]},e)),` | `,`thresholds: `,e.anomaly_threshold_pp,`pp drop, net < 0`]})]})]})}function gc(e,t=28){if(e.length<=t)return e;let n=e.split(`/`).filter(Boolean);if(n.length<=2)return e;let r=`/`+n[0],i=`${r}/…/${n.slice(-2).join(`/`)}`;return i.length<=t||(i=`${r}/…/${n[n.length-1]}`,i.length<=t)?i:`…/${n[n.length-1]}`}function _c({kind:e,rows:t}){let n=e===`projects`?`bd-projects`:`bd-models`,r=e===`projects`?`By project`:`By model`,i=e===`projects`?`No project activity in this window`:`No model activity in this window`,a=e===`projects`;return(0,H.jsxs)(`div`,{className:`crm-bd-card ${n}`,"data-bd-kind":e,children:[(0,H.jsx)(`div`,{className:`crm-bd-head`,children:r}),t.length===0?(0,H.jsx)(`div`,{className:`empty`,children:i}):(0,H.jsx)(`table`,{children:(0,H.jsx)(`tbody`,{children:t.map(e=>{let t=a?gc(e.key):e.key,n=t!==e.key;return(0,H.jsxs)(`tr`,{"data-testid":`crm-bd-row`,"data-bd-key":e.key,children:[(0,H.jsx)(`td`,{className:`bd-key`,title:n?e.key:void 0,children:t}),(0,H.jsxs)(`td`,{children:[A.pctFloor(e.cache_hit_percent),`%`]}),(0,H.jsx)(`td`,{className:e.net_usd>=0?`net-pos`:`net-neg`,children:A.usdSigned(e.net_usd)})]},e.key)})})})]})}function K({current_threshold_pp:e,onClose:t}){let[n,r]=(0,_.useState)(String(e)),[i,a]=(0,_.useState)(null),[o,s]=(0,_.useState)(!1),[c,l]=(0,_.useState)(!1),u=(0,_.useRef)(null);(0,_.useEffect)(()=>{function e(e){let n=e.target;n&&n.closest(`[data-cr-settings-toggle]`)||u.current&&!u.current.contains(e.target)&&t()}return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[t]),(0,_.useEffect)(()=>{function e(e){e.key===`Escape`&&(e.stopPropagation(),t())}return document.addEventListener(`keydown`,e,!0),()=>document.removeEventListener(`keydown`,e,!0)},[t]);async function d(){l(!1);let e=n.trim(),t=/^-?\d+$/.test(e)?parseInt(e,10):NaN;if(!Number.isInteger(t)||t<1||t>100){a(`Must be an integer between 1 and 100`);return}s(!0),a(null);try{let e=await fetch(`/api/settings`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({cache_report:{anomaly_threshold_pp:t}})});if(e.ok)l(!0),setTimeout(()=>l(!1),1500);else{let t=await e.json().catch(()=>({}));a(typeof t.error==`string`?t.error:`HTTP ${e.status}`)}}catch(e){a(String(e))}finally{s(!1)}}return(0,H.jsxs)(`div`,{ref:u,className:`crm-settings-popover`,role:`dialog`,"aria-label":`Cache Report settings`,children:[(0,H.jsx)(`h4`,{children:`Cache Report settings`}),(0,H.jsx)(`label`,{htmlFor:`cr-threshold`,children:`Anomaly threshold (pp)`}),(0,H.jsx)(`input`,{id:`cr-threshold`,type:`number`,inputMode:`numeric`,min:1,max:100,value:n,onChange:e=>{r(e.target.value),a(null),l(!1)},className:i?`invalid`:``}),i&&(0,H.jsx)(`div`,{className:`err`,children:i}),c&&(0,H.jsx)(`div`,{className:`saved`,children:`Saved · next sync will re-evaluate`}),(0,H.jsxs)(`div`,{className:`actions`,children:[(0,H.jsx)(`button`,{onClick:t,type:`button`,children:`Close`}),(0,H.jsx)(`button`,{className:`primary`,onClick:d,disabled:o,type:`button`,children:o?`Saving…`:`Save`})]})]})}function vc(){let e=Ge()?.cache_report,[t,n]=(0,_.useState)(!1);if(!e)return(0,H.jsx)(ss,{title:`Cache Report`,accentClass:`accent-teal`,children:(0,H.jsx)(`div`,{style:{color:`var(--text-dim)`,padding:`20px 0`},children:`Loading…`})});if(e.is_empty)return(0,H.jsx)(ss,{title:`Cache Report`,accentClass:`accent-teal`,children:(0,H.jsxs)(`div`,{style:{color:`var(--text-dim)`,padding:`20px 0`},children:[`No Claude activity in the last `,e.window_days,` days.`]})});let r=(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`span`,{className:`sub`,style:{marginRight:12,color:`var(--text-dim)`},children:[`Last `,e.window_days,` days · `,e.anomaly_window_days,`d baseline · Claude only`]}),(0,H.jsx)(`button`,{type:`button`,"aria-label":`Cache Report settings`,"data-cr-settings-toggle":!0,onClick:e=>{e.stopPropagation(),n(e=>!e)},style:{background:`transparent`,border:0,color:`var(--text-dim)`,cursor:`pointer`,fontSize:18,padding:`0 8px`},children:`⚙`})]}),i=e.today.baseline_daily_row_count<5,a=e.today.anomaly_triggered&&!i,o=a?`var(--accent-amber)`:`var(--accent-green)`,s=a?`accent-amber`:`accent-teal`,c=Math.round(e.fourteen_day_efficiency_ratio*100);return(0,H.jsxs)(ss,{title:`Cache Report`,accentClass:s,headerExtras:r,children:[t&&(0,H.jsx)(K,{current_threshold_pp:e.anomaly_threshold_pp,onClose:()=>n(!1)}),(0,H.jsx)(hc,{cr:e}),(0,H.jsxs)(`div`,{className:`crm-section`,children:[(0,H.jsxs)(`div`,{className:`crm-section-head crm-sh-timeline`,children:[`Cache hit % — `,e.window_days,`-day timeline`,(0,H.jsxs)(`span`,{className:`meta`,children:[`band = `,e.anomaly_window_days,`d median ±`,5,`pp`]})]}),(0,H.jsx)(`div`,{className:`crm-chart-frame timeline`,children:(0,H.jsx)(zn,{days:e.days,baseline_median_percent:e.today.baseline_median_percent,today_marker_color:o,size:`large`})})]}),(0,H.jsx)(Vn,{days:e.days,size:`large`}),(0,H.jsxs)(`div`,{className:`crm-counterfactual`,children:[`Without caching, you'd have paid`,` `,(0,H.jsxs)(`strong`,{children:[`+$`,e.fourteen_day_counterfactual_usd.toFixed(2),` more`]}),` `,`over the last `,e.window_days,` days · cache efficiency`,` `,(0,H.jsxs)(`span`,{title:`saved / (saved + |wasted|) = ${c}%`,children:[c,`%`]})]}),(0,H.jsxs)(`div`,{className:`crm-section`,children:[(0,H.jsxs)(`div`,{className:`crm-section-head crm-sh-table`,children:[`Daily rows · `,e.window_days,` days`,(0,H.jsxs)(`span`,{className:`meta`,children:[e.days.length,` days observed`]})]}),(0,H.jsxs)(`table`,{className:`ch-table`,children:[(0,H.jsx)(`thead`,{children:(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`th`,{className:`c-date`,children:`Date`}),(0,H.jsx)(`th`,{className:`c-hit num`,children:`Cache %`}),(0,H.jsx)(`th`,{className:`c-tokens num`,children:`Tok In`}),(0,H.jsx)(`th`,{className:`c-tokens num`,children:`Tok Out`}),(0,H.jsx)(`th`,{className:`c-saved num`,children:`Saved`}),(0,H.jsx)(`th`,{className:`c-wasted num`,children:`Wasted`}),(0,H.jsx)(`th`,{className:`c-net num`,children:`Net`}),(0,H.jsx)(`th`,{className:`c-flag num`,children:`Flag`})]})}),(0,H.jsx)(`tbody`,{children:e.days.map(t=>{let n=t.date===e.today.date,r=e.today.baseline_median_percent!==null,i=r&&e.today.baseline_median_percent!==null&&t.cache_hit_percent<e.today.baseline_median_percent-5,a=t.net_usd<0;return(0,H.jsxs)(`tr`,{className:n?`cur`:``,"data-testid":`crm-daily-row`,"data-date":t.date,children:[(0,H.jsx)(`td`,{children:t.date}),(0,H.jsxs)(`td`,{className:`num ${r?i?`hit-bad`:`hit-good`:``}`.trim(),children:[A.pctFloor(t.cache_hit_percent),`%`]}),(0,H.jsx)(`td`,{className:`num`,children:A.compact(t.input_tokens,{upper:!0})}),(0,H.jsx)(`td`,{className:`num`,children:A.compact(t.output_tokens,{upper:!0})}),(0,H.jsx)(`td`,{className:`num`,children:A.usd2(t.saved_usd)}),(0,H.jsx)(`td`,{className:`num`,children:A.usd2(t.wasted_usd)}),(0,H.jsx)(`td`,{className:`num ${a?`net-neg`:`net-pos`}`,children:A.usdSigned(t.net_usd)}),(0,H.jsx)(`td`,{className:`num ${t.anomaly_triggered?`flag-warn`:`flag-ok`}`,children:t.anomaly_triggered?`⚠`:`✓`})]},t.date)})})]})]}),(0,H.jsx)(`div`,{className:`crm-section`,children:(0,H.jsxs)(`div`,{className:`crm-breakdowns`,children:[(0,H.jsx)(_c,{kind:`projects`,rows:e.by_project}),(0,H.jsx)(_c,{kind:`models`,rows:e.by_model})]})})]})}var yc=100;function bc({alert:e,ctx:t}){if(e.axis===`weekly`){let n=e.context.week_start_date?A.weekStart(e.context.week_start_date,t):null,r=e.context.dollars_per_percent;return(0,H.jsxs)(`span`,{className:`alert-context alert-context--weekly`,children:[n?`Week of ${n}`:`Week —`,r!=null&&(0,H.jsxs)(H.Fragment,{children:[` · `,(0,H.jsxs)(`span`,{className:`num`,children:[`$`,r.toFixed(2),`/1%`]})]})]})}if(e.axis===`budget`){let n=Nn(e.context.period),r=e.context.period_start_at??e.context.week_start_at,i=r?A.weekStart(r.slice(0,10),t):null,a=e.context.consumption_pct;return(0,H.jsxs)(`span`,{className:`alert-context alert-context--budget`,children:[i?`${n} of ${i}`:`${n} —`,a!=null&&(0,H.jsxs)(H.Fragment,{children:[` · `,(0,H.jsxs)(`span`,{className:`num`,children:[Math.round(a),`% of budget`]})]})]})}if(e.axis===`codex_budget`){let n=Nn(e.context.period),r=e.context.period_start_at,i=r?A.weekStart(r.slice(0,10),t):null,a=e.context.consumption_pct;return(0,H.jsxs)(`span`,{className:`alert-context alert-context--codex_budget`,children:[i?`${n} of ${i}`:`${n} —`,a!=null&&(0,H.jsxs)(H.Fragment,{children:[` · `,(0,H.jsxs)(`span`,{className:`num`,children:[Math.round(a),`% of budget`]})]})]})}if(e.axis===`project_budget`){let t=e.context.project??`(project)`,n=e.context.consumption_pct;return(0,H.jsxs)(`span`,{className:`alert-context alert-context--project_budget`,children:[t,n!=null&&(0,H.jsxs)(H.Fragment,{children:[` · `,(0,H.jsxs)(`span`,{className:`num`,children:[Math.round(n),`% of budget`]})]})]})}return e.axis===`projected`?(0,H.jsx)(`span`,{className:`alert-context alert-context--projected`,children:Fn(e)??`Projected —`}):(0,H.jsxs)(`span`,{className:`alert-context alert-context--five-hour`,children:[`Block `,e.context.block_start_at?A.timeOnly(e.context.block_start_at,t):`—`]})}function xc({alert:e}){if(e.axis===`projected`)return(0,H.jsx)(`span`,{className:`num`,children:`—`});let t;return t=e.axis===`weekly`?e.context.cumulative_cost_usd:e.axis===`budget`||e.axis===`project_budget`||e.axis===`codex_budget`?e.context.spent_usd:e.context.block_cost_usd,(0,H.jsx)(`span`,{className:`num`,children:A.usd2(t??null)})}function Sc(){let e=(0,_.useSyncExternalStore)(B,()=>z().alerts),t=Gt(),n={tz:t.resolvedTz,offsetLabel:t.offsetLabel},r=e.slice(0,yc);return r.length===0?(0,H.jsx)(ss,{title:`Recent alerts`,accentClass:`accent-amber`,children:(0,H.jsx)(`div`,{className:`panel-empty`,children:`No alerts yet. Alerts appear when usage crosses 90% or 95%.`})}):(0,H.jsx)(ss,{title:`Recent alerts`,accentClass:`accent-amber`,children:(0,H.jsxs)(`div`,{className:`alerts-modal-body`,children:[(0,H.jsxs)(`table`,{className:`alerts-table`,children:[(0,H.jsx)(`thead`,{children:(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`th`,{scope:`col`,children:`%`}),(0,H.jsx)(`th`,{scope:`col`,children:`Axis`}),(0,H.jsx)(`th`,{scope:`col`,children:`Cost`}),(0,H.jsx)(`th`,{scope:`col`,children:`Context`}),(0,H.jsx)(`th`,{scope:`col`,children:`Alerted`})]})}),(0,H.jsx)(`tbody`,{children:r.map(e=>{let t=Pn(e);return(0,H.jsxs)(`tr`,{className:`alert-modal-row`,children:[(0,H.jsxs)(`td`,{className:`alert-threshold severity-${t} ${t} num`,children:[e.threshold,`%`]}),(0,H.jsx)(`td`,{children:(0,H.jsx)(`span`,{className:`chip chip--${e.axis}`,children:jn[e.axis]})}),(0,H.jsx)(`td`,{className:`num`,children:(0,H.jsx)(xc,{alert:e})}),(0,H.jsx)(`td`,{children:(0,H.jsx)(bc,{alert:e,ctx:n})}),(0,H.jsx)(`td`,{className:`alert-when`,children:A.relativeOrAbsolute(e.alerted_at,n)})]},e.id)})})]}),e.length>yc&&(0,H.jsxs)(`div`,{className:`alerts-modal-foot`,children:[`Showing `,yc,` of `,e.length,` most recent`]})]})})}function Cc(){let e=(0,_.useSyncExternalStore)(B,()=>z().openModal);if(!e)return null;switch(e){case`current-week`:return(0,H.jsx)(ms,{});case`forecast`:return(0,H.jsx)(bs,{});case`trend`:return(0,H.jsx)(ks,{});case`session`:return(0,H.jsx)(Ms,{});case`weekly`:return(0,H.jsx)(zs,{});case`monthly`:return(0,H.jsx)(Bs,{});case`block`:return(0,H.jsx)(Xs,{});case`daily`:return(0,H.jsx)(ec,{});case`projects`:return(0,H.jsx)(mc,{});case`alerts`:return(0,H.jsx)(Sc,{});case`cache-report`:return(0,H.jsx)(vc,{})}}var wc=class extends Error{code;constructor(e,t,n,r){super(n),this.status=e,this.field=t,this.code=r}};async function Tc(e){if(!e.ok){let t={};try{t=await e.json()}catch{}throw new wc(e.status,t.field,t.error??`HTTP ${e.status}`,t.code)}return e.json()}async function Ec(e,t){return Tc(await fetch(`/api/share/templates?panel=${encodeURIComponent(e)}`,{signal:t?.signal}))}async function Dc(e,t){return Tc(await fetch(`/api/share/render`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e),signal:t?.signal}))}var Oc=[{id:`recap`,label:`Recap`,placeholderDescription:`Text + tiny chart`},{id:`visual`,label:`Visual`,placeholderDescription:`Coming in M2`},{id:`detail`,label:`Detail`,placeholderDescription:`Coming in M2`}];function kc(e){return e.endsWith(`-recap`)?`recap`:e.endsWith(`-visual`)?`visual`:e.endsWith(`-detail`)?`detail`:null}function Ac({panel:e,templates:t,error:n,selectedTemplateId:r,onSelect:i}){if(n)return(0,H.jsx)(`div`,{className:`share-gallery-error`,role:`alert`,children:n});let a={};for(let e of t??[]){let t=kc(e.id);t&&(a[t]=e)}return(0,H.jsx)(`div`,{className:`share-gallery`,role:`radiogroup`,"aria-label":`Report template`,children:Oc.map(e=>{let n=a[e.id];if(t==null)return(0,H.jsxs)(`div`,{className:`share-tile share-tile-skeleton`,"aria-hidden":`true`,children:[(0,H.jsx)(`div`,{className:`share-tile-skeleton-bar`}),(0,H.jsx)(`div`,{className:`share-tile-skeleton-bar short`})]},e.id);if(!n)return(0,H.jsxs)(`button`,{type:`button`,className:`share-tile share-tile-disabled`,disabled:!0,"aria-disabled":`true`,role:`radio`,"aria-checked":`false`,title:`${e.label} — ${e.placeholderDescription}`,children:[(0,H.jsx)(`div`,{className:`share-tile-label`,children:e.label}),(0,H.jsx)(`div`,{className:`share-tile-desc`,children:e.placeholderDescription})]},e.id);let o=n.id===r;return(0,H.jsxs)(`button`,{type:`button`,className:`share-tile`+(o?` share-tile-selected`:``),role:`radio`,"aria-checked":o,"data-template-id":n.id,onClick:()=>i(n.id),children:[(0,H.jsx)(`div`,{className:`share-tile-label`,children:n.label}),(0,H.jsx)(`div`,{className:`share-tile-desc`,children:n.description})]},e.id)})})}function jc({options:e,onChange:t}){let n=n=>t({...e,...n}),r=n=>t({...e,period:{...e.period,...n}}),i=e=>{if(e===``){n({top_n:null});return}let t=Number.parseInt(e,10);Number.isNaN(t)||n({top_n:Math.max(1,t)})};return(0,H.jsxs)(`div`,{className:`share-knobs`,children:[(0,H.jsxs)(`div`,{className:`share-knob`,children:[(0,H.jsx)(`label`,{htmlFor:`share-knob-period`,children:`Period`}),(0,H.jsxs)(`select`,{id:`share-knob-period`,value:e.period.kind,onChange:e=>r({kind:e.target.value}),children:[(0,H.jsx)(`option`,{value:`current`,children:`This week`}),(0,H.jsx)(`option`,{value:`previous`,children:`Previous week`}),(0,H.jsx)(`option`,{value:`custom`,children:`Custom`})]}),e.period.kind===`custom`?(0,H.jsxs)(`div`,{className:`share-knob-period-custom`,children:[(0,H.jsxs)(`label`,{className:`share-knob-sublabel`,children:[(0,H.jsx)(`span`,{children:`Start`}),(0,H.jsx)(`input`,{type:`date`,value:e.period.start?.slice(0,10)??``,onChange:e=>r({start:e.target.value}),"aria-label":`Custom period start date`})]}),(0,H.jsxs)(`label`,{className:`share-knob-sublabel`,children:[(0,H.jsx)(`span`,{children:`End`}),(0,H.jsx)(`input`,{type:`date`,value:e.period.end?.slice(0,10)??``,onChange:e=>r({end:e.target.value}),"aria-label":`Custom period end date`})]})]}):null]}),(0,H.jsxs)(`div`,{className:`share-knob`,children:[(0,H.jsx)(`span`,{className:`share-knob-label`,children:`Theme`}),(0,H.jsxs)(`div`,{className:`share-knob-radiogroup`,role:`radiogroup`,"aria-label":`Theme`,children:[(0,H.jsxs)(`label`,{className:`share-knob-radio`,children:[(0,H.jsx)(`input`,{type:`radio`,name:`share-theme`,value:`light`,checked:e.theme===`light`,onChange:()=>n({theme:`light`})}),(0,H.jsx)(`span`,{children:`Light`})]}),(0,H.jsxs)(`label`,{className:`share-knob-radio`,children:[(0,H.jsx)(`input`,{type:`radio`,name:`share-theme`,value:`dark`,checked:e.theme===`dark`,onChange:()=>n({theme:`dark`})}),(0,H.jsx)(`span`,{children:`Dark`})]})]})]}),(0,H.jsxs)(`div`,{className:`share-knob`,children:[(0,H.jsx)(`label`,{htmlFor:`share-knob-topn`,children:`Top-N`}),(0,H.jsx)(`input`,{id:`share-knob-topn`,type:`number`,min:1,step:1,inputMode:`numeric`,value:e.top_n??``,onChange:e=>i(e.target.value),"aria-label":`Top-N`})]}),(0,H.jsxs)(`div`,{className:`share-knob`,children:[(0,H.jsx)(`span`,{className:`share-knob-label`,children:`Projects`}),(0,H.jsx)(`button`,{type:`button`,className:`share-knob-allowlist-stub`,disabled:!0,"aria-disabled":`true`,title:`Project allowlist — coming in M3+`,children:`All projects`})]}),(0,H.jsx)(`div`,{className:`share-knob`,children:(0,H.jsxs)(`label`,{className:`share-knob-checkbox`,children:[(0,H.jsx)(`input`,{type:`checkbox`,checked:e.show_chart,onChange:e=>n({show_chart:e.target.checked}),"aria-label":`Include chart in export`}),(0,H.jsx)(`span`,{children:`Show chart`})]})}),(0,H.jsx)(`div`,{className:`share-knob`,children:(0,H.jsxs)(`label`,{className:`share-knob-checkbox`,children:[(0,H.jsx)(`input`,{type:`checkbox`,checked:e.show_table,onChange:e=>n({show_table:e.target.checked}),"aria-label":`Include table in export`}),(0,H.jsx)(`span`,{children:`Show table`})]})}),(0,H.jsx)(`div`,{className:`share-knob`,children:(0,H.jsxs)(`label`,{className:`share-knob-checkbox`,children:[(0,H.jsx)(`input`,{type:`checkbox`,checked:!e.reveal_projects,onChange:e=>n({reveal_projects:!e.target.checked}),"aria-label":`Anonymize project names on export`}),(0,H.jsx)(`span`,{children:`Anon on export`})]})})]})}var Mc=200,Nc={status:`idle`,body:``,contentType:``,errorMessage:null,errorField:null};function Pc({panel:e,templateId:t,options:n}){let[r,i]=(0,_.useState)(Nc),a=(0,_.useRef)(null),o=(0,_.useRef)(0);return(0,_.useEffect)(()=>{if(!t){i(Nc);return}i(e=>({...e,status:`loading`}));let r=++o.current,s=setTimeout(()=>{a.current?.abort();let s=new AbortController;a.current=s,Dc({panel:e,template_id:t,options:{...n,reveal_projects:!0}},{signal:s.signal}).then(e=>{r===o.current&&i({status:`ready`,body:e.body,contentType:e.content_type,errorMessage:null,errorField:null})}).catch(e=>{if(r===o.current&&!(e&&typeof e==`object`&&e.name===`AbortError`)){if(e instanceof wc){i({status:`error`,body:``,contentType:``,errorMessage:e.message??`HTTP ${e.status}`,errorField:e.field??null});return}i({status:`error`,body:``,contentType:``,errorMessage:e.message??`Unknown error`,errorField:null})}})},Mc);return()=>{clearTimeout(s)}},[e,t,n]),(0,_.useEffect)(()=>()=>{a.current?.abort()},[]),t?r.status===`error`?(0,H.jsxs)(`div`,{className:`share-preview share-preview-error`,role:`alert`,children:[(0,H.jsx)(`div`,{className:`share-preview-error-title`,children:`Preview failed`}),(0,H.jsxs)(`div`,{className:`share-preview-error-message`,children:[r.errorMessage,r.errorField?(0,H.jsxs)(`span`,{className:`share-preview-error-field`,children:[` `,`(field: `,r.errorField,`)`]}):null]})]}):r.status===`loading`||r.status===`idle`?(0,H.jsx)(`div`,{className:`share-preview share-preview-loading`,"aria-busy":`true`,children:`Rendering preview…`}):n.format===`md`?(0,H.jsx)(`pre`,{className:`share-preview share-preview-md`,"aria-label":`Markdown preview`,children:r.body}):(0,H.jsx)(`iframe`,{className:`share-preview share-preview-iframe`,title:`Report preview (decorative)`,tabIndex:-1,sandbox:`allow-same-origin`,srcDoc:r.body}):(0,H.jsx)(`div`,{className:`share-preview share-preview-empty`,children:`Select a template to preview.`})}var Fc={"current-week":`Current week`,trend:`Trend`,weekly:`Weekly`,daily:`Daily`,monthly:`Monthly`,blocks:`5-hour blocks`,forecast:`Forecast`,sessions:`Sessions`,projects:`Projects`};function Ic(e){return Fc[e]}function Lc(e){switch(e){case`md`:return`md`;case`html`:return`html`;case`svg`:return`svg`}}async function Rc(e){if(!e.ok){let t={};try{t=await e.json()}catch{}throw new wc(e.status,t.field,t.error??`HTTP ${e.status}`)}return e.json()}async function zc(e){return Rc(await fetch(`/api/share/presets`,{signal:e?.signal}))}async function Bc(e,t){return Rc(await fetch(`/api/share/presets`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e),signal:t?.signal}))}async function Vc(e,t,n){let r=await fetch(`/api/share/presets/${encodeURIComponent(e)}/${encodeURIComponent(t)}`,{method:`DELETE`,signal:n?.signal});if(!r.ok){let e={};try{e=await r.json()}catch{}throw new wc(r.status,void 0,e.error??`HTTP ${r.status}`)}}async function Hc(e){return Rc(await fetch(`/api/share/history`,{signal:e?.signal}))}async function Uc(e,t){return Rc(await fetch(`/api/share/history`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e),signal:t?.signal}))}function Wc({panel:e,templateId:t,options:n,onSaved:r,onCancel:i}){let[a,o]=(0,_.useState)(``),[s,c]=(0,_.useState)(!1),[l,u]=(0,_.useState)(null);async function d(){let i=a.trim();if(!i){u(`Name is required`);return}if(i.length>64){u(`Name must be 64 characters or fewer`);return}if(i.includes(`/`)){u(`Name cannot contain '/'`);return}c(!0),u(null);try{await Bc({panel:e,name:i,template_id:t,options:n}),V({type:`SHOW_STATUS_TOAST`,text:`Saved preset "${i}"`}),r()}catch(e){u((e instanceof wc?e.message??`HTTP ${e.status}`:e.message)??`Save failed`)}finally{c(!1)}}return(0,H.jsxs)(`div`,{className:`share-save-popover`,role:`dialog`,"aria-label":`Save preset`,children:[(0,H.jsxs)(`label`,{className:`share-save-label`,children:[`Preset name`,(0,H.jsx)(`input`,{type:`text`,className:`share-save-input`,autoFocus:!0,value:a,maxLength:64,disabled:s,onChange:e=>o(e.target.value),onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),e.stopPropagation(),d()):e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),i())}})]}),l?(0,H.jsx)(`div`,{className:`share-save-error`,role:`alert`,children:l}):null,(0,H.jsxs)(`div`,{className:`share-save-actions`,children:[(0,H.jsx)(`button`,{type:`button`,onClick:i,disabled:s,children:`Cancel`}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>void d(),disabled:s,children:s?`Saving…`:`Save`})]})]})}async function Gc(e,t,n){let r=new Blob([e],{type:`image/svg+xml`}),i=URL.createObjectURL(r);try{let e=new Image;e.src=i,await e.decode();let r=document.createElement(`canvas`);r.width=e.naturalWidth*t,r.height=e.naturalHeight*t;let a=r.getContext(`2d`);if(!a)throw Error(`Could not acquire 2D canvas context`);a.fillStyle=n,a.fillRect(0,0,r.width,r.height),a.scale(t,t),a.drawImage(e,0,0);let o=await new Promise(e=>{r.toBlob(t=>e(t),`image/png`)});if(o)return o;let s=r.toDataURL(`image/png`);return(await fetch(s)).blob()}finally{URL.revokeObjectURL(i)}}function Kc(e){let t=document.createElement(`iframe`);t.setAttribute(`aria-hidden`,`true`),t.style.cssText=`position:fixed;right:0;bottom:0;width:0;height:0;border:0`,document.body.appendChild(t);let n=t.contentDocument;if(!n)throw Error(`iframe contentDocument unavailable`);n.open(),n.write(e),n.close();try{t.contentWindow?.focus(),t.contentWindow?.print()}catch{let t=window.open(``,`_blank`,`noopener,noreferrer`);t&&(t.document.open(),t.document.write(e),t.document.close())}setTimeout(()=>t.remove(),1e3)}function q(e){Uc({panel:e.panel,template_id:e.template_id,options:e.options,format:e.options.format,destination:e.destination}).catch(()=>{})}function qc(e){return e===`light`?`#ffffff`:`#0f172a`}function Jc(e,t){return`cctally-${e}-${new Date().toISOString().slice(0,10).replaceAll(`-`,``)}.${Lc(t)}`}function Yc(e){switch(e){case`md`:return`text/markdown;charset=utf-8`;case`html`:return`text/html;charset=utf-8`;case`svg`:return`image/svg+xml;charset=utf-8`}}function Xc(e,t){let n=URL.createObjectURL(t),r=document.createElement(`a`);r.href=n,r.download=e,r.style.display=`none`,document.body.appendChild(r),r.click(),document.body.removeChild(r),setTimeout(()=>URL.revokeObjectURL(n),0)}function Zc({panel:e,templateId:t,options:n,onOptionsChange:r}){let[i,a]=(0,_.useState)(null),[o,s]=(0,_.useState)(null),[c,l]=(0,_.useState)(!1),u=(0,_.useRef)(null);(0,_.useEffect)(()=>()=>{u.current!=null&&clearTimeout(u.current)},[]);let[d,f]=(0,_.useState)(!1),p=(0,_.useRef)(null);(0,_.useEffect)(()=>{if(!d)return;function e(e){let t=p.current;t&&(t.contains(e.target)||f(!1))}return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[d]),(0,_.useEffect)(()=>{s(null)},[n.format,t]);let m=t==null||i!=null,h=e=>V({type:`SHOW_STATUS_TOAST`,text:e}),g=async()=>{if(!t)throw Error(`no template selected`);return{body:(await Dc({panel:e,template_id:t,options:n})).body,format:n.format}},v=async()=>{if(!(m||!t)){a(`copy`),s(null);try{let{body:r}=await g();if(!navigator.clipboard||typeof navigator.clipboard.writeText!=`function`)throw Error(`Clipboard API unavailable in this browser`);await navigator.clipboard.writeText(r),h(`Copied`),q({panel:e,template_id:t,options:n,destination:`copy`})}catch(e){s(`Copy failed: ${e instanceof wc?e.message??`HTTP ${e.status}`:e.message}`)}finally{a(null)}}},y=async()=>{if(!(m||!t)){a(`download`),s(null);try{let{body:r,format:i}=await g(),a=new Blob([r],{type:Yc(i)});Xc(Jc(e,i),a),h(`Downloaded`),q({panel:e,template_id:t,options:n,destination:`download`})}catch(e){s(`Download failed: ${e instanceof wc?e.message??`HTTP ${e.status}`:e.message}`)}finally{a(null)}}},b=async()=>{if(!(m||!t)){a(`basket`),s(null);try{let r=await Dc({panel:e,template_id:t,options:n}),i=ve({panel:e,template_id:t,options:n,added_at:new Date().toISOString(),data_digest_at_add:r.snapshot.data_digest,kernel_version:r.snapshot.kernel_version,label_hint:Ic(e)});V({type:`BASKET_ADD`,item:i});let a=z().basket;if(a.rejectedReason===`capacity`)return;l(!0),u.current!=null&&clearTimeout(u.current),u.current=setTimeout(()=>l(!1),800),V({type:`SHOW_STATUS_TOAST`,text:`Added ${i.label_hint} to basket (${a.items.length})`})}catch(e){s(`Add to basket failed: ${e instanceof wc?e.message??`HTTP ${e.status}`:e.message}`)}finally{a(null)}}},x=async()=>{if(!(m||!t)){a(`open`),s(null);try{let{body:r,format:i}=await g(),a=new Blob([r],{type:Yc(i)}),o=URL.createObjectURL(a);window.open(o,`_blank`,`noopener,noreferrer`),q({panel:e,template_id:t,options:n,destination:`open`})}catch(e){s(`Open failed: ${e instanceof wc?e.message??`HTTP ${e.status}`:e.message}`)}finally{a(null)}}},S=async()=>{if(!(!t||n.format!==`svg`||m)){a(`png`),s(null);try{let{body:r}=await g(),i=await Gc(r,2,qc(n.theme));Xc(Jc(e,`svg`).replace(/\.svg$/,`.png`),i),h(`PNG downloaded`),q({panel:e,template_id:t,options:n,destination:`png`})}catch(e){s(`PNG export failed: ${e instanceof wc?e.message??`HTTP ${e.status}`:e.message}`)}finally{a(null)}}},C=async()=>{if(!(!t||n.format!==`html`||m)){a(`print`),s(null);try{let{body:r}=await g();Kc(r),q({panel:e,template_id:t,options:n,destination:`print`})}catch(e){s(`Print failed: ${e instanceof wc?e.message??`HTTP ${e.status}`:e.message}`)}finally{a(null)}}},w=n.format===`md`&&!m,T=(n.format===`html`||n.format===`svg`)&&!m,E=n.format===`svg`&&!m,D=n.format===`html`&&!m;return(0,H.jsxs)(`div`,{className:`share-actions`,children:[(0,H.jsxs)(`div`,{className:`share-format-row`,role:`radiogroup`,"aria-label":`Export format`,children:[(0,H.jsx)(`span`,{className:`share-format-label`,children:`Format:`}),[`md`,`html`,`svg`].map(e=>(0,H.jsxs)(`label`,{className:`share-format-radio`,children:[(0,H.jsx)(`input`,{type:`radio`,name:`share-format`,value:e,checked:n.format===e,onChange:()=>r({...n,format:e})}),(0,H.jsx)(`span`,{children:e})]},e))]}),(0,H.jsxs)(`div`,{className:`share-action-row`,children:[(0,H.jsx)(`button`,{type:`button`,className:`share-action share-action-copy`,onClick:v,disabled:!w,title:n.format===`md`?i===`copy`?`Copying…`:`Copy to clipboard`:`Copy is available for Markdown only`,children:i===`copy`?`Copying…`:`Copy`}),(0,H.jsx)(`button`,{type:`button`,className:`share-action share-action-download`,onClick:y,disabled:m,title:i===`download`?`Downloading…`:`Download file`,children:i===`download`?`Downloading…`:`Download`}),(0,H.jsx)(`button`,{type:`button`,className:`share-action share-action-open`,onClick:x,disabled:!T,title:n.format===`html`||n.format===`svg`?i===`open`?`Opening…`:`Open in new tab`:`Open is available for HTML/SVG`,children:i===`open`?`Opening…`:`Open`}),(0,H.jsx)(`button`,{type:`button`,className:`share-action share-action-png`,onClick:S,disabled:!E,title:n.format===`svg`?i===`png`?`Rasterizing…`:`Download PNG (rasterized from SVG)`:`PNG export — available for SVG format only`,children:i===`png`?`Rasterizing…`:`PNG`}),(0,H.jsx)(`button`,{type:`button`,className:`share-action share-action-print`,onClick:C,disabled:!D,title:n.format===`html`?i===`print`?`Opening print dialog…`:`Open the browser print dialog (save as PDF)`:`Print → PDF — available for HTML format only`,children:i===`print`?`Printing…`:`Print → PDF`}),(0,H.jsx)(`button`,{type:`button`,className:`share-action share-action-basket${c?` share-action-basket-added`:``}`,onClick:b,disabled:m,title:m&&t==null?`Pick a template first`:i===`basket`?`Adding to basket…`:`Add this section to the report basket`,children:c?`✓ Added`:i===`basket`?`Adding…`:`+ Basket`})]}),(0,H.jsxs)(`div`,{className:`share-save-preset-row`,ref:p,children:[(0,H.jsx)(`button`,{type:`button`,className:`share-save-preset`,disabled:t==null||i!=null,onClick:()=>f(e=>!e),"aria-haspopup":`dialog`,"aria-expanded":d,title:t==null?`Pick a template first`:`Save the current recipe as a named preset`,children:`Save preset…`}),d&&t?(0,H.jsx)(Wc,{panel:e,templateId:t,options:n,onSaved:()=>f(!1),onCancel:()=>f(!1)}):null]}),o?(0,H.jsx)(`div`,{className:`share-action-error`,role:`alert`,children:o}):null]})}function Qc(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()}function $c({panel:e,onPick:t,onManage:n}){let[r,i]=(0,_.useState)(!1),[a,o]=(0,_.useState)({}),[s,c]=(0,_.useState)([]),[l,u]=(0,_.useState)(null),d=(0,_.useRef)(null);(0,_.useEffect)(()=>{if(!r)return;let t=new AbortController;return u(null),Promise.all([zc({signal:t.signal}),Hc({signal:t.signal})]).then(([t,n])=>{o(t.presets[e]??{}),c(n.history.filter(t=>t.panel===e).slice().reverse())}).catch(e=>{e?.name!==`AbortError`&&u((e instanceof wc?e.message??`HTTP ${e.status}`:e.message)??`Failed to load presets`)}),()=>t.abort()},[r,e]),(0,_.useEffect)(()=>{if(!r)return;function e(e){let t=d.current;t&&(t.contains(e.target)||i(!1))}return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[r]);let f=Object.keys(a).sort();return(0,H.jsxs)(`div`,{className:`share-presets-dropdown`,ref:d,children:[(0,H.jsx)(`button`,{type:`button`,className:`share-presets-trigger`,"aria-haspopup":`menu`,"aria-expanded":r,onClick:()=>i(e=>!e),children:`presets ▾`}),r?(0,H.jsxs)(`div`,{className:`share-presets-menu`,role:`menu`,children:[l?(0,H.jsx)(`div`,{className:`share-presets-error`,role:`alert`,children:l}):null,f.length===0&&!l?(0,H.jsx)(`div`,{className:`share-presets-empty`,children:`No saved presets yet.`}):null,f.length>0?(0,H.jsx)(`ul`,{className:`share-presets-list`,children:f.map(e=>(0,H.jsx)(`li`,{children:(0,H.jsx)(`button`,{type:`button`,role:`menuitem`,className:`share-presets-item`,onClick:()=>{t(a[e].template_id,a[e].options),i(!1)},children:e})},e))}):null,s.length>0?(0,H.jsxs)(`div`,{className:`share-presets-history`,children:[(0,H.jsx)(`div`,{className:`share-presets-history-heading`,role:`presentation`,children:`Recent shares`}),(0,H.jsx)(`ul`,{className:`share-presets-history-list`,children:s.map(e=>(0,H.jsx)(`li`,{children:(0,H.jsxs)(`button`,{type:`button`,role:`menuitem`,className:`share-presets-history-item`,onClick:()=>{t(e.template_id,e.options),i(!1)},title:`${e.template_id} · ${e.format??`unknown`} · ${e.exported_at}`,children:[(0,H.jsx)(`span`,{className:`share-presets-history-template`,children:e.template_id}),(0,H.jsxs)(`span`,{className:`share-presets-history-meta`,children:[` · `,e.format??`unknown`,` · `,Qc(e.exported_at)]})]})},e.recipe_id))})]}):null,(0,H.jsx)(`div`,{className:`share-presets-footer`,children:(0,H.jsx)(`button`,{type:`button`,role:`menuitem`,className:`share-presets-manage`,onClick:()=>{n(),i(!1)},children:`Manage presets…`})})]}):null]})}var el=`share-manage-presets-title`;function tl({open:e,onClose:t}){let[n,r]=(0,_.useState)([]),[i,a]=(0,_.useState)(!1),[o,s]=(0,_.useState)(null);Ut((0,_.useMemo)(()=>e?[{key:`Escape`,scope:`modal`,action:t}]:[],[e,t]));let c=(0,_.useRef)(null),l=(0,_.useRef)(!1);(0,_.useEffect)(()=>{if(e)l.current||(l.current=!0,c.current=document.activeElement);else if(l.current){l.current=!1;let e=c.current;if(c.current=null,e&&typeof e.focus==`function`&&document.contains(e))e.focus();else{let e=document.activeElement;e&&typeof e.blur==`function`&&e.blur(),document.body.focus()}}},[e]),(0,_.useEffect)(()=>{if(!e)return;let t=!1;return s(null),(async()=>{try{let e=await zc();if(t)return;let n=[];for(let[t,r]of Object.entries(e.presets))for(let[e,i]of Object.entries(r))n.push({panel:t,name:e,record:i});n.sort((e,t)=>e.panel===t.panel?e.name.localeCompare(t.name):e.panel.localeCompare(t.panel)),r(n)}catch(e){if(t)return;s((e instanceof wc?e.message??`HTTP ${e.status}`:e.message)??`Failed to load presets`)}})(),()=>{t=!0}},[e]);async function u(e){a(!0),s(null);try{await Vc(e.panel,e.name),r(t=>t.filter(t=>!(t.panel===e.panel&&t.name===e.name))),V({type:`SHOW_STATUS_TOAST`,text:`Deleted preset "${e.name}"`})}catch(e){s((e instanceof wc?e.message??`HTTP ${e.status}`:e.message)??`Delete failed`)}finally{a(!1)}}async function d(e,t){a(!0),s(null);try{await Bc({panel:e.panel,name:t,template_id:e.record.template_id,options:e.record.options}),await Vc(e.panel,e.name),r(n=>n.map(n=>n.panel===e.panel&&n.name===e.name?{...n,name:t}:n)),V({type:`SHOW_STATUS_TOAST`,text:`Renamed to "${t}"`})}catch(e){s((e instanceof wc?e.message??`HTTP ${e.status}`:e.message)??`Rename failed`)}finally{a(!1)}}return e?(0,H.jsxs)(`div`,{className:`share-manage-modal`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":el,onClick:e=>e.stopPropagation(),children:[(0,H.jsxs)(`div`,{className:`share-manage-header`,children:[(0,H.jsx)(`h2`,{id:el,children:`Manage presets`}),(0,H.jsx)(`button`,{type:`button`,onClick:t,"aria-label":`Close`,className:`share-manage-close`,children:`⤬`})]}),o?(0,H.jsx)(`div`,{className:`share-manage-error`,role:`alert`,children:o}):null,n.length===0&&!o?(0,H.jsx)(`p`,{className:`share-manage-empty`,children:`No saved presets yet.`}):null,n.length>0?(0,H.jsxs)(`table`,{className:`share-manage-table`,children:[(0,H.jsx)(`thead`,{children:(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`th`,{children:`Panel`}),(0,H.jsx)(`th`,{children:`Name`}),(0,H.jsx)(`th`,{children:`Saved at`}),(0,H.jsx)(`th`,{})]})}),(0,H.jsx)(`tbody`,{children:n.map(e=>(0,H.jsx)(nl,{row:e,busy:i,onDelete:()=>void u(e),onRename:t=>void d(e,t)},`${e.panel}/${e.name}`))})]}):null]}):null}function nl({row:e,busy:t,onDelete:n,onRename:r}){let[i,a]=(0,_.useState)(!1),[o,s]=(0,_.useState)(e.name),c=()=>{let t=o.trim();if(!t||t===e.name){s(e.name),a(!1);return}r(t),a(!1)};return(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`td`,{children:Ic(e.panel)}),(0,H.jsx)(`td`,{children:i?(0,H.jsx)(`input`,{className:`share-manage-name-input`,autoFocus:!0,value:o,disabled:t,maxLength:64,onChange:e=>s(e.target.value),onKeyDown:t=>{t.key===`Enter`?(t.preventDefault(),c()):t.key===`Escape`&&(t.preventDefault(),t.stopPropagation(),s(e.name),a(!1))}}):(0,H.jsx)(`span`,{children:e.name})}),(0,H.jsx)(`td`,{children:e.record.saved_at}),(0,H.jsxs)(`td`,{className:`share-manage-actions`,children:[(0,H.jsx)(`button`,{type:`button`,disabled:t,onClick:()=>{i?(s(e.name),a(!1)):a(!0)},children:i?`Cancel`:`Rename`}),(0,H.jsx)(`button`,{type:`button`,disabled:t,onClick:n,children:`Delete`})]})]})}function rl(){return{format:`md`,theme:`light`,reveal_projects:!1,no_branding:!1,top_n:5,period:{kind:`current`},project_allowlist:null,show_chart:!0,show_table:!0}}function il(e,t){if(!t)return e;let n={...e,...t};return t.period&&(n.period={...e.period,...t.period}),n}function al({panel:e,onClose:t,initialParams:n}){let r=Ic(e),[i,a]=(0,_.useState)(null),[o,s]=(0,_.useState)(null),[c,l]=(0,_.useState)(null),[u,d]=(0,_.useState)(()=>{let e=rl();return n?.windowWeeks==null?e:{...e,windowWeeks:n.windowWeeks}}),f=(0,_.useRef)(!1),[p,m]=(0,_.useState)(!1),h=`share-modal-title`;Ut((0,_.useMemo)(()=>[{key:`Escape`,scope:`overlay`,layer:200,when:()=>!p&&z().composerModal===null,action:t}],[t,p])),(0,_.useEffect)(()=>{let t=!1;return a(null),s(null),Ec(e).then(e=>{if(t)return;a(e.templates);let n=e.templates[0];n&&(l(n.id),f.current||d(e=>il(e,n.default_options)))}).catch(e=>{t||s(e instanceof wc?`Couldn't load templates: ${e.message??`HTTP ${e.status}`}`:`Couldn't load templates: ${e.message}`)}),()=>{t=!0}},[e]),(0,_.useEffect)(()=>{if(!i||!c||f.current)return;let e=i.find(e=>e.id===c);e&&d(t=>il(t,e.default_options))},[c,i]);let g=e=>{f.current=!0,d(e)};return(0,H.jsxs)(`div`,{className:`share-modal`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":h,onClick:e=>e.stopPropagation(),children:[(0,H.jsx)(`header`,{className:`share-modal-header`,children:(0,H.jsxs)(`h2`,{id:h,children:[`Share `,r,` report`]})}),(0,H.jsxs)(`div`,{className:`share-modal-body`,children:[(0,H.jsxs)(`section`,{className:`share-section share-gallery-section`,"aria-label":`Template gallery`,children:[(0,H.jsx)(`div`,{className:`share-gallery-header`,children:(0,H.jsx)($c,{panel:e,onPick:(e,t)=>{l(e),f.current=!0,d(e=>({...e,...t}))},onManage:()=>m(!0)})}),(0,H.jsx)(Ac,{panel:e,templates:i,error:o,selectedTemplateId:c,onSelect:e=>l(e)})]}),(0,H.jsxs)(`section`,{className:`share-section share-main-section`,children:[(0,H.jsx)(`div`,{className:`share-knobs-col`,"aria-label":`Render options`,children:(0,H.jsx)(jc,{options:u,onChange:g})}),(0,H.jsx)(`div`,{className:`share-preview-col`,"aria-label":`Live preview`,children:(0,H.jsx)(Pc,{panel:e,templateId:c,options:u})})]})]}),(0,H.jsx)(`footer`,{className:`share-modal-footer`,children:(0,H.jsx)(Zc,{panel:e,templateId:c,options:u,onOptionsChange:g})}),(0,H.jsx)(`button`,{type:`button`,className:`share-modal-close`,"aria-label":`Close share modal`,onClick:t,children:`⤬`}),(0,H.jsx)(tl,{open:p,onClose:()=>m(!1)})]})}function ol(e,t){return{title:t.title,theme:t.theme,format:t.format,no_branding:t.no_branding,reveal_projects:t.reveal_projects,sections:e.map(e=>({snapshot:{panel:e.panel,template_id:e.template_id,options:e.options,data_digest_at_add:e.data_digest_at_add,kernel_version:e.kernel_version}}))}}async function sl(e,t){let n=await fetch(`/api/share/compose`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e),signal:t?.signal});if(!n.ok){let e={};try{e=await n.json()}catch{}throw new wc(n.status,e.field,e.error??`HTTP ${n.status}`,e.code)}return n.json()}function cl({items:e,results:t,kernelVersion:n,onRefresh:r,onRemove:i,onPreviewOnly:a}){let o=Zr(Xr(Zi,{activationConstraint:{distance:4}}),Xr(Ki,{coordinateGetter:wo}));function s(t){if(!t.over||t.active.id===t.over.id)return;let n=e.findIndex(e=>e.id===t.active.id),r=e.findIndex(e=>e.id===t.over.id);n<0||r<0||V({type:`BASKET_REORDER`,fromIdx:n,toIdx:r})}return(0,H.jsx)(Ja,{sensors:o,collisionDetection:ai,onDragEnd:s,children:(0,H.jsx)(fo,{items:e.map(e=>e.id),strategy:co,children:(0,H.jsx)(`ul`,{className:`composer-section-list`,children:e.map((e,o)=>(0,H.jsx)(ll,{item:e,result:t[o],kernelVersion:n,onRefresh:r,onRemove:i,onPreviewOnly:a},e.id))})})})}function ll({item:e,result:t,kernelVersion:n,onRefresh:r,onRemove:i,onPreviewOnly:a}){let{attributes:o,listeners:s,setNodeRef:c,transform:l,transition:u,isDragging:d}=bo({id:e.id}),f=jo(),p={transform:Fr.Transform.toString(l),transition:f?void 0:u,opacity:d?.4:1},[m,h]=(0,_.useState)(!1),g=t?.drift_detected,v=e.kernel_version!==n,y=!!(g||v);return(0,H.jsxs)(`li`,{ref:c,style:p,className:`composer-section-row`,children:[(0,H.jsx)(`button`,{className:`composer-drag-handle`,"aria-label":`Reorder ${e.label_hint}`,type:`button`,...o,...s,children:`≡`}),(0,H.jsx)(`span`,{className:`composer-section-label`,children:e.label_hint}),y?(0,H.jsx)(`span`,{className:`composer-outdated-badge`,title:g&&v?`Data and kernel both shifted since add-time. Refresh to update.`:g?`Data has changed since this section was added. Refresh to update.`:`Kernel updated since this section was added. Refresh to re-render at the new version.`,children:`Outdated`}):null,(0,H.jsxs)(`div`,{className:`composer-section-actions`,children:[(0,H.jsx)(`button`,{type:`button`,"aria-haspopup":`menu`,"aria-expanded":m,onClick:()=>h(e=>!e),"aria-label":`Actions for ${e.label_hint}`,children:`⋯`}),m?(0,H.jsxs)(`ul`,{role:`menu`,className:`composer-section-menu`,children:[(0,H.jsx)(`li`,{children:(0,H.jsx)(`button`,{type:`button`,onClick:()=>{a(e.id),h(!1)},children:`Preview only this`})}),(0,H.jsx)(`li`,{children:(0,H.jsx)(`button`,{type:`button`,onClick:()=>{r(e.id),h(!1)},children:`Refresh from current data`})}),(0,H.jsx)(`li`,{children:(0,H.jsx)(`button`,{type:`button`,onClick:()=>{i(e.id),h(!1)},"aria-label":`Remove ${e.label_hint}`,children:`Remove`})})]}):null]})]})}function ul(e,t){return t&&e>0}function dl(e){return`cctally-report-${new Date().toISOString().slice(0,10).replaceAll(`-`,``)}.${e===`md`?`md`:e}`}function fl(e){switch(e){case`md`:return`text/markdown;charset=utf-8`;case`html`:return`text/html;charset=utf-8`;case`svg`:return`image/svg+xml;charset=utf-8`}}function pl(e){return e===`light`?`#ffffff`:`#0f172a`}function ml(e,t){let n=URL.createObjectURL(t),r=document.createElement(`a`);r.href=n,r.download=e,r.style.display=`none`,document.body.appendChild(r),r.click(),document.body.removeChild(r),setTimeout(()=>URL.revokeObjectURL(n),0)}var hl=200;function gl(){return z().composerModal}function _l(){return z().basket}var vl=`composer-modal-title`;function yl(){let e=(0,_.useSyncExternalStore)(B,gl),t=(0,_.useSyncExternalStore)(B,_l),n=ln(),r=(0,_.useRef)(null),i=(0,_.useRef)(!1),[a,o]=(0,_.useState)(``),[s,c]=(0,_.useState)(`light`),[l,u]=(0,_.useState)(`html`),[d,f]=(0,_.useState)(!0),[p,m]=(0,_.useState)(!1),[h,g]=(0,_.useState)(null),[v,y]=(0,_.useState)(null),[b,x]=(0,_.useState)(!1),S=(0,_.useRef)(null),[C,w]=(0,_.useState)(null),[T,E]=(0,_.useState)(null);(0,_.useEffect)(()=>{E(null)},[l,s,d,p]),Ut((0,_.useMemo)(()=>[{key:`Escape`,scope:`overlay`,layer:210,when:()=>z().composerModal!==null,action:()=>V(he())}],[])),(0,_.useEffect)(()=>{e?.open&&a===``&&o(`cctally report — ${new Date().toISOString().slice(0,10)}`)},[e?.open,a]),(0,_.useEffect)(()=>{if(e?.open)i.current||(i.current=!0,r.current=document.activeElement);else if(i.current){i.current=!1;let e=r.current;if(r.current=null,e&&typeof e.focus==`function`&&document.contains(e))e.focus();else{let e=document.activeElement;e&&typeof e.blur==`function`&&e.blur(),document.body.focus()}}},[e?.open]),(0,_.useEffect)(()=>{if(!e?.open||t.items.length===0||a===``)return;let n=setTimeout(()=>{S.current?.abort();let e=new AbortController;S.current=e,x(!0),y(null),sl(ol(t.items,{title:a,theme:s,format:l,no_branding:p,reveal_projects:!d}),{signal:e.signal}).then(t=>{e.signal.aborted||g(t)}).catch(t=>{t?.name!==`AbortError`&&(e.signal.aborted||y(t instanceof wc?t.message??`HTTP ${t.status}`:t.message))}).finally(()=>{e.signal.aborted||x(!1)})},hl);return()=>clearTimeout(n)},[e?.open,t.items,a,s,l,d,p]);async function D(e){let n=t.items.findIndex(t=>t.id===e);if(n<0)return;let r=t.items[n];try{let t=await Dc({panel:r.panel,template_id:r.template_id,options:{...r.options,reveal_projects:!d}}),i=ve({panel:r.panel,template_id:r.template_id,options:r.options,added_at:new Date().toISOString(),data_digest_at_add:t.snapshot.data_digest,kernel_version:t.snapshot.kernel_version,label_hint:r.label_hint,id:r.id});V({type:`BASKET_REMOVE`,id:e}),V({type:`BASKET_ADD`,item:i});let a=z().basket.items.length-1;a!==n&&V({type:`BASKET_REORDER`,fromIdx:a,toIdx:n})}catch(e){y(`Refresh failed: ${e instanceof wc?e.message??`HTTP ${e.status}`:e.message}`)}}let O=async e=>{let n=await sl(ol(t.items,{title:a,theme:s,format:e,no_branding:p,reveal_projects:!d}));return{body:n.body,content_type:n.content_type}},k=e=>V({type:`SHOW_STATUS_TOAST`,text:e}),A=async(e,t,n)=>{if(C==null){w(e),E(null);try{await t()}catch(e){E(`${n} failed: ${e instanceof wc?e.message??`HTTP ${e.status}`:e.message}`)}finally{w(null)}}},j=()=>A(`copy`,async()=>{let{body:e}=await O(`md`);if(!navigator.clipboard||typeof navigator.clipboard.writeText!=`function`)throw Error(`Clipboard API unavailable in this browser`);await navigator.clipboard.writeText(e),k(`Copied`)},`Copy`),M=()=>A(`download`,async()=>{let{body:e}=await O(l),t=new Blob([e],{type:fl(l)});ml(dl(l),t),k(`Downloaded`)},`Download`),N=()=>A(`open`,async()=>{let{body:e}=await O(l),t=new Blob([e],{type:fl(l)}),n=URL.createObjectURL(t);window.open(n,`_blank`,`noopener,noreferrer`)},`Open`),P=()=>A(`png`,async()=>{let{body:e}=await O(`svg`),t=await Gc(e,2,pl(s));ml(dl(`svg`).replace(/\.svg$/,`.png`),t),k(`PNG downloaded`)},`PNG export`),ee=()=>A(`print`,async()=>{let{body:e}=await O(`html`);Kc(e)},`Print`),te=C==null&&l===`md`&&t.items.length>0,ne=C==null&&t.items.length>0,re=C==null&&(l===`html`||l===`svg`)&&t.items.length>0,F=C==null&&l===`svg`&&t.items.length>0,ie=C==null&&l===`html`&&t.items.length>0,ae=!d,oe=ul(t.items.length,ae),se=ae?t.items.length:0;return e?.open?t.items.length===0?(0,H.jsxs)(`div`,{className:`composer-modal composer-modal-empty${n?` composer-modal-mobile`:``}`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":vl,children:[(0,H.jsxs)(`header`,{className:`composer-modal-header`,children:[(0,H.jsx)(`h2`,{id:vl,children:`Compose report`}),(0,H.jsx)(`button`,{type:`button`,className:`composer-modal-close`,onClick:()=>V(he()),"aria-label":`Close`,children:`⤬`})]}),(0,H.jsx)(`p`,{className:`composer-empty-message`,children:`Basket is empty. Open any panel's share menu and pick + Basket to add a section.`})]}):(0,H.jsxs)(`div`,{className:`composer-modal${n?` composer-modal-mobile`:``}`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":vl,children:[(0,H.jsxs)(`header`,{className:`composer-modal-header`,children:[(0,H.jsx)(`h2`,{id:vl,children:`Compose report`}),(0,H.jsx)(`button`,{type:`button`,className:`composer-modal-close`,onClick:()=>V(he()),"aria-label":`Close`,children:`⤬`})]}),(0,H.jsxs)(`div`,{className:`composer-knobs`,children:[(0,H.jsxs)(`label`,{children:[`Title`,(0,H.jsx)(`input`,{type:`text`,value:a,onChange:e=>o(e.target.value)})]}),(0,H.jsxs)(`label`,{children:[`Theme`,(0,H.jsxs)(`select`,{value:s,onChange:e=>c(e.target.value),children:[(0,H.jsx)(`option`,{value:`light`,children:`light`}),(0,H.jsx)(`option`,{value:`dark`,children:`dark`})]})]}),(0,H.jsxs)(`label`,{children:[`Format`,(0,H.jsxs)(`select`,{value:l,onChange:e=>u(e.target.value),children:[(0,H.jsx)(`option`,{value:`html`,children:`html`}),(0,H.jsx)(`option`,{value:`md`,children:`md`}),(0,H.jsx)(`option`,{value:`svg`,children:`svg`})]})]}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`input`,{type:`checkbox`,checked:d,onChange:e=>f(e.target.checked)}),`Anon on export`]}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`input`,{type:`checkbox`,checked:p,onChange:e=>m(e.target.checked)}),`No branding`]})]}),oe?(0,H.jsxs)(`div`,{className:`composer-anon-banner`,role:`status`,"aria-live":`polite`,children:[(0,H.jsxs)(`span`,{children:[se,` section`,se===1?``:`s`,` contain real project names. They will appear in the export.`]}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>f(!0),children:`Anonymize all`})]}):null,(0,H.jsxs)(`div`,{className:`composer-body`,children:[(0,H.jsx)(cl,{items:t.items,results:h?.snapshot.section_results??[],kernelVersion:h?.snapshot.kernel_version??1,onRefresh:e=>{D(e)},onRemove:e=>V({type:`BASKET_REMOVE`,id:e}),onPreviewOnly:e=>{}}),(0,H.jsx)(`iframe`,{className:`composer-preview`,title:`Combined preview`,tabIndex:-1,sandbox:`allow-same-origin`,srcDoc:h?.body??`<p>Composing&hellip;</p>`})]}),b?(0,H.jsx)(`div`,{className:`composer-busy`,children:`Composing…`}):null,v?(0,H.jsx)(`div`,{className:`composer-error`,role:`alert`,children:v}):null,T?(0,H.jsx)(`div`,{className:`composer-error`,role:`alert`,children:T}):null,(0,H.jsxs)(`footer`,{className:`composer-actions`,children:[(0,H.jsxs)(`div`,{className:`composer-export-row`,children:[(0,H.jsx)(`button`,{type:`button`,className:`share-action share-action-copy`,onClick:j,disabled:!te,title:l===`md`?C===`copy`?`Copying…`:`Copy composed report to clipboard`:`Copy is available for Markdown only`,children:C===`copy`?`Copying…`:`Copy`}),(0,H.jsx)(`button`,{type:`button`,className:`share-action share-action-download`,onClick:M,disabled:!ne,title:C===`download`?`Downloading…`:`Download composed report`,children:C===`download`?`Downloading…`:`Download`}),(0,H.jsx)(`button`,{type:`button`,className:`share-action share-action-open`,onClick:N,disabled:!re,title:l===`html`||l===`svg`?C===`open`?`Opening…`:`Open composed report in new tab`:`Open is available for HTML/SVG`,children:C===`open`?`Opening…`:`Open`}),(0,H.jsx)(`button`,{type:`button`,className:`share-action share-action-png`,onClick:P,disabled:!F,title:l===`svg`?C===`png`?`Rasterizing…`:`Download composed report as PNG`:`PNG export — available for SVG format only`,children:C===`png`?`Rasterizing…`:`PNG`}),(0,H.jsx)(`button`,{type:`button`,className:`share-action share-action-print`,onClick:ee,disabled:!ie,title:l===`html`?C===`print`?`Opening print dialog…`:`Open the browser print dialog (save as PDF)`:`Print → PDF — available for HTML format only`,children:C===`print`?`Printing…`:`Print → PDF`})]}),(0,H.jsx)(`button`,{type:`button`,className:`composer-clear-all`,onClick:()=>V({type:`BASKET_CLEAR`}),children:`Clear all`})]})]}):null}function bl(){let e=(0,_.useSyncExternalStore)(B,()=>z().shareModal),t=(0,_.useRef)(null),n=(0,_.useRef)(!1);(0,_.useEffect)(()=>{if(e)n.current||(n.current=!0,t.current=(e.triggerId?document.getElementById(e.triggerId):null)??document.activeElement);else if(n.current){n.current=!1;let e=t.current;if(t.current=null,e&&typeof e.focus==`function`&&document.contains(e))e.focus();else{let e=document.activeElement;e&&typeof e.blur==`function`&&e.blur(),document.body.focus()}}},[e]);let r=()=>V(pe());return(0,H.jsxs)(H.Fragment,{children:[e?(0,H.jsx)(`div`,{id:`share-modal-root`,className:`share-overlay`,onClick:e=>{e.stopPropagation(),e.target===e.currentTarget&&r()},children:(0,H.jsx)(al,{panel:e.panel,initialParams:e.params,onClose:r})}):null,(0,H.jsx)(yl,{})]})}var xl=class extends Error{constructor(e){super(`HTTP ${e}`),this.status=e,this.name=`HttpError`}};function Sl(e){return e?.name===`AbortError`}async function Cl(e,t){let n=await fetch(e,t?{signal:t}:void 0);if(!n.ok)throw new xl(n.status);return await n.json()}var wl=50;function Tl(){let[e,t]=(0,_.useState)([]),[n,r]=(0,_.useState)(!0),[i,a]=(0,_.useState)(null),[o,s]=(0,_.useState)(0),c=Ge()?.generated_at??``,l=(0,_.useRef)(!1);(0,_.useEffect)(()=>{if(l.current||e.length>wl)return;let n=new AbortController;return Cl(`/api/conversations?sort=recent&limit=${wl}&offset=0`,n.signal).then(e=>{t(e.conversations),s(e.page.next_offset),a(null),r(!1)}).catch(e=>{Sl(e)||(a(`Couldn't load conversations.`),r(!1))}),()=>n.abort()},[c]);let u=(0,_.useCallback)(async()=>{if(!(o==null||l.current)){l.current=!0;try{let e=await Cl(`/api/conversations?sort=recent&limit=${wl}&offset=${o}`);t(t=>[...t,...e.conversations]),s(e.page.next_offset)}catch{}finally{l.current=!1}}},[o]);return{rows:e,loading:n,error:i,hasMore:o!=null,loadMore:u}}function El(e,t,n=e){let[r,i]=(0,_.useState)(n);return(0,_.useEffect)(()=>{let n=setTimeout(()=>i(e),t);return()=>clearTimeout(n)},[e,t]),r}var Dl=200;function Ol(e){let[t,n]=(0,_.useState)([]),[r,i]=(0,_.useState)(null),[a,o]=(0,_.useState)(0),[s,c]=(0,_.useState)(!1),[l,u]=(0,_.useState)(null),d=e.trim(),f=El(d,Dl,``),p=(0,_.useRef)(null);return(0,_.useEffect)(()=>(d||(n([]),i(null),o(0),u(null)),()=>{p.current?.abort()}),[d]),(0,_.useEffect)(()=>{if(!f){c(!1);return}let e=new AbortController;return p.current=e,c(!0),Cl(`/api/conversation/search?q=${encodeURIComponent(f)}&limit=50&offset=0`,e.signal).then(e=>{n(e.hits),i(e.mode),o(e.total),u(null),c(!1)}).catch(e=>{Sl(e)||(u(`Search failed.`),c(!1))}),()=>e.abort()},[f]),{hits:t,mode:r,total:a,loading:d!==``&&(d!==f||s),error:l}}function kl(e){let t=[],n=0,r=0;for(;n<e.length;){let i=e.indexOf(`[`,n);if(i===-1){t.push((0,H.jsx)(_.Fragment,{children:e.slice(n)},r++));break}let a=e.indexOf(`]`,i+1);if(a===-1){t.push((0,H.jsx)(_.Fragment,{children:e.slice(n)},r++));break}i>n&&t.push((0,H.jsx)(_.Fragment,{children:e.slice(n,i)},r++)),t.push((0,H.jsx)(`mark`,{children:e.slice(i+1,a)},r++)),n=a+1}return(0,H.jsx)(H.Fragment,{children:t})}var Al=864e5;function jl(e,t){let[n,r,i]=new Intl.DateTimeFormat(`en-CA`,{timeZone:t,year:`numeric`,month:`2-digit`,day:`2-digit`}).format(new Date(e)).split(`-`).map(Number);return{y:n,m:r,d:i}}function Ml(e,t,n){let r=Date.parse(e),i=jl(r,t),a=jl(n,t),o=Date.UTC(i.y,i.m-1,i.d),s=Date.UTC(a.y,a.m-1,a.d),c=Math.round((s-o)/Al);return c<=0?`Today`:c===1?`Yesterday`:c<7?`This Week`:i.y===a.y&&i.m===a.m?`This Month`:new Intl.DateTimeFormat(`en-US`,{timeZone:t,month:`long`,year:`numeric`}).format(new Date(r))}function Nl(){let e=(0,_.useSyncExternalStore)(B,()=>z().conversationSearch),t=(0,_.useSyncExternalStore)(B,()=>z().selectedConversationId),n=Gt(),r={tz:n.resolvedTz,offsetLabel:n.offsetLabel},i=(0,_.useRef)(null),a=e.trim()!==``;return(0,H.jsxs)(`aside`,{className:`conv-rail`,children:[(0,H.jsx)(`div`,{className:`conv-rail-search`,children:(0,H.jsx)(`input`,{ref:i,type:`search`,className:`conv-rail-search-input`,placeholder:`search all conversations…`,value:e,onChange:e=>V({type:`SET_CONVERSATION_SEARCH`,text:e.target.value}),onFocus:()=>V({type:`SET_INPUT_MODE`,mode:`search`}),onBlur:()=>V({type:`SET_INPUT_MODE`,mode:null}),onKeyDown:e=>{e.key===`Escape`&&(V({type:`SET_CONVERSATION_SEARCH`,text:``}),i.current?.blur())}})}),a?(0,H.jsx)(Il,{needle:e,ctx:r}):(0,H.jsx)(Pl,{selectedId:t,ctx:r})]})}function Pl({selectedId:e,ctx:t}){let{rows:n,loading:r,error:i,hasMore:a,loadMore:o}=Tl();if(i)return(0,H.jsx)(`div`,{className:`conv-rail-list`,children:(0,H.jsx)(`div`,{className:`conv-rail-empty`,children:i})});if(r&&n.length===0)return(0,H.jsx)(`div`,{className:`conv-rail-list`,children:(0,H.jsx)(`div`,{className:`conv-rail-empty`,children:`Loading…`})});if(n.length===0)return(0,H.jsx)(`div`,{className:`conv-rail-list`,children:(0,H.jsx)(`div`,{className:`conv-rail-empty`,children:`No conversations.`})});let s=null,c=Date.now();return(0,H.jsxs)(`div`,{className:`conv-rail-list`,children:[n.map(n=>{let r=Ml(n.started_utc,t.tz,c),i=r!==s;return i&&(s=r),(0,H.jsxs)(_.Fragment,{children:[i&&(0,H.jsx)(`div`,{className:`conv-rail-sec`,children:r}),(0,H.jsx)(Fl,{row:n,ctx:t,active:n.session_id===e})]},n.session_id)}),a&&(0,H.jsx)(`button`,{type:`button`,className:`conv-rail-more`,onClick:()=>void o(),children:`Load more`})]})}function Fl({row:e,ctx:t,active:n}){return(0,H.jsxs)(`button`,{type:`button`,className:`conv-rail-row${n?` is-active`:``}`,onClick:()=>V({type:`SELECT_CONVERSATION`,sessionId:e.session_id}),children:[(0,H.jsx)(`div`,{className:`conv-rail-row-title`,children:e.title}),(0,H.jsxs)(`div`,{className:`conv-rail-row-meta`,children:[(0,H.jsx)(`span`,{className:`conv-rail-row-project`,children:e.project_label||`—`}),(0,H.jsx)(`span`,{className:`conv-rail-row-branch`,children:e.git_branch??`—`}),(0,H.jsx)(`span`,{className:`conv-rail-row-when`,children:A.startedShort(e.started_utc,t,{noSuffix:!0})}),(0,H.jsx)(`span`,{className:`conv-rail-row-cost`,children:A.usd2(e.cost_usd)}),(0,H.jsxs)(`span`,{className:`conv-rail-row-msgs`,children:[e.msg_count,` msgs`]})]})]})}function Il({needle:e,ctx:t}){let{hits:n,mode:r,loading:i,error:a}=Ol(e);return a?(0,H.jsx)(`div`,{className:`conv-rail-list`,children:(0,H.jsx)(`div`,{className:`conv-rail-empty`,children:a})}):i&&n.length===0?(0,H.jsx)(`div`,{className:`conv-rail-list`,children:(0,H.jsx)(`div`,{className:`conv-rail-empty`,children:`Searching…`})}):n.length===0?(0,H.jsx)(`div`,{className:`conv-rail-list`,children:(0,H.jsx)(`div`,{className:`conv-rail-empty`,children:`No matches.`})}):(0,H.jsxs)(`div`,{className:`conv-rail-list`,children:[r===`like`&&(0,H.jsx)(`div`,{className:`conv-rail-hint`,children:`(basic search)`}),n.map((e,n)=>(0,H.jsx)(Ll,{hit:e,ctx:t},`${e.session_id}-${e.uuid}-${n}`))]})}function Ll({hit:e,ctx:t}){return(0,H.jsxs)(`button`,{type:`button`,className:`conv-rail-row conv-rail-row--hit`,onClick:()=>V({type:`OPEN_CONVERSATION`,sessionId:e.session_id,jump:{session_id:e.session_id,uuid:e.uuid}}),children:[(0,H.jsx)(`div`,{className:`conv-rail-row-title`,children:e.title}),(0,H.jsxs)(`div`,{className:`conv-rail-row-meta`,children:[(0,H.jsx)(`span`,{className:`conv-rail-row-project`,children:e.project_label||`—`}),(0,H.jsx)(`span`,{className:`conv-rail-row-when`,children:A.startedShort(e.ts,t,{noSuffix:!0})}),(0,H.jsx)(`span`,{className:`conv-rail-row-cost`,children:A.usd2(e.cost_usd)})]}),(0,H.jsx)(`div`,{className:`conv-rail-row-snippet`,children:kl(e.snippet)})]})}var Rl=500;function zl(e){let[t,n]=(0,_.useState)(null),[r,i]=(0,_.useState)(!1),[a,o]=(0,_.useState)(null),s=(0,_.useRef)(null),c=(0,_.useRef)(!1),l=(0,_.useRef)(null),u=(0,_.useRef)(null),d=(0,_.useCallback)(e=>{n(t=>{let n=typeof e==`function`?e(t):e;return u.current=n,n})},[]);(0,_.useEffect)(()=>{if(l.current=e,!e){d(null),i(!1),o(null),s.current=null;return}i(!0),o(null),d(null),s.current=null;let t=new AbortController;return Cl(`/api/conversation/${encodeURIComponent(e)}?limit=${Rl}`,t.signal).then(e=>{d(e),s.current=e.page.next_after,i(!1)}).catch(e=>{if(!Sl(e)){if(e instanceof xl&&e.status===404){o(`Conversation not found.`),i(!1);return}o(`Couldn't load the conversation.`),i(!1)}}),()=>t.abort()},[e,d]);let f=(0,_.useCallback)(async()=>{let e=s.current,t=l.current;if(e==null||t==null||c.current)return!1;c.current=!0;try{let n;try{n=await Cl(`/api/conversation/${encodeURIComponent(t)}?limit=${Rl}&after=${e}`)}catch{return!1}return l.current===t?(d(e=>e?{...e,items:[...e.items,...n.items],page:n.page,subagent_meta:n.subagent_meta??e.subagent_meta}:n),s.current=n.page.next_after,n.page.next_after!=null):!1}finally{c.current=!1}},[d]),p=(0,_.useCallback)(async()=>{await f()},[f]),m=(0,_.useCallback)(async e=>{let t=()=>{let t=u.current;return!!t&&t.items.some(t=>t.member_uuids.includes(e))};for(let e=0;e<20;e++)if(t()||!await f())return},[f]);return{detail:t,loading:r,error:a,hasMore:t?.page?.next_after!=null,loadMore:p,loadUntil:m}}function Bl(e){let t=[],n=[],r=()=>{n.length>=2?t.push({kind:`tool_result_run`,items:n}):n.length===1&&t.push({kind:`item`,item:n[0]}),n=[]};for(let i of e){if(i.kind===`item`&&i.item.kind===`tool_result`){n.push(i.item);continue}r(),t.push(i)}return r(),t}function Vl(e){let t=new Map,n=new Map;for(let r of e){let e=r.subagent_key;if(e!=null){let n=t.get(e);n?n.push(r):t.set(e,[r])}else for(let e of r.member_uuids)n.set(e,r)}let r=new Set,i=new Map;for(let[e,a]of t){let t=(a.find(e=>e.kind!==`meta`)??a[0]).parent_uuid,o=t==null?void 0:n.get(t);if(o){r.add(e);let t=o.anchor.uuid,n=i.get(t);n?n.push(e):i.set(t,[e])}}let a=[],o=new Set,s=e=>{a.push({kind:`subagent`,subagentKey:e,items:t.get(e),nested:r.has(e)}),o.add(e)};for(let t of e)if(t.subagent_key==null){a.push({kind:`item`,item:t});let e=i.get(t.anchor.uuid);if(e)for(let t of e)o.has(t)||s(t)}else{let e=t.subagent_key;if(o.has(e)||r.has(e))continue;s(e)}for(let e of t.keys())o.has(e)||s(e);return Bl(a)}var Hl=RegExp(`^\\s*(?:<(${[`command-name`,`command-message`,`command-args`,`local-command-caveat`].join(`|`)})>(?:(?!</\\1>)[\\s\\S])*</\\1>\\s*)+$`);function Ul(e){return e?Hl.test(e):!1}function Wl(e){let t=[],n=String(e||``),r=n.indexOf(`,`),i=0,a=!1;for(;!a;){r===-1&&(r=n.length,a=!0);let e=n.slice(i,r).trim();(e||!a)&&t.push(e),i=r+1,r=n.indexOf(`,`,i)}return t}function Gl(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var Kl=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,ql=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Jl={};function Yl(e,t){return((t||Jl).jsx?ql:Kl).test(e)}var Xl=/[ \t\n\f\r]/g;function Zl(e){return typeof e==`object`?e.type===`text`?Ql(e.value):!1:Ql(e)}function Ql(e){return e.replace(Xl,``)===``}var $l=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};$l.prototype.normal={},$l.prototype.property={},$l.prototype.space=void 0;function eu(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new $l(n,r,t)}function tu(e){return e.toLowerCase()}var nu=class{constructor(e,t){this.attribute=t,this.property=e}};nu.prototype.attribute=``,nu.prototype.booleanish=!1,nu.prototype.boolean=!1,nu.prototype.commaOrSpaceSeparated=!1,nu.prototype.commaSeparated=!1,nu.prototype.defined=!1,nu.prototype.mustUseProperty=!1,nu.prototype.number=!1,nu.prototype.overloadedBoolean=!1,nu.prototype.property=``,nu.prototype.spaceSeparated=!1,nu.prototype.space=void 0;var ru=s({boolean:()=>J,booleanish:()=>au,commaOrSpaceSeparated:()=>cu,commaSeparated:()=>su,number:()=>Y,overloadedBoolean:()=>ou,spaceSeparated:()=>X}),iu=0,J=lu(),au=lu(),ou=lu(),Y=lu(),X=lu(),su=lu(),cu=lu();function lu(){return 2**++iu}var uu=Object.keys(ru),du=class extends nu{constructor(e,t,n,r){let i=-1;if(super(e,t),fu(this,`space`,r),typeof n==`number`)for(;++i<uu.length;){let e=uu[i];fu(this,uu[i],(n&ru[e])===ru[e])}}};du.prototype.defined=!0;function fu(e,t,n){n&&(e[t]=n)}function pu(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new du(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[tu(r)]=r,n[tu(a.attribute)]=r}return new $l(t,n,e.space)}var mu=pu({properties:{ariaActiveDescendant:null,ariaAtomic:au,ariaAutoComplete:null,ariaBusy:au,ariaChecked:au,ariaColCount:Y,ariaColIndex:Y,ariaColSpan:Y,ariaControls:X,ariaCurrent:null,ariaDescribedBy:X,ariaDetails:null,ariaDisabled:au,ariaDropEffect:X,ariaErrorMessage:null,ariaExpanded:au,ariaFlowTo:X,ariaGrabbed:au,ariaHasPopup:null,ariaHidden:au,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:X,ariaLevel:Y,ariaLive:null,ariaModal:au,ariaMultiLine:au,ariaMultiSelectable:au,ariaOrientation:null,ariaOwns:X,ariaPlaceholder:null,ariaPosInSet:Y,ariaPressed:au,ariaReadOnly:au,ariaRelevant:null,ariaRequired:au,ariaRoleDescription:X,ariaRowCount:Y,ariaRowIndex:Y,ariaRowSpan:Y,ariaSelected:au,ariaSetSize:Y,ariaSort:null,ariaValueMax:Y,ariaValueMin:Y,ariaValueNow:Y,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function hu(e,t){return t in e?e[t]:t}function gu(e,t){return hu(e,t.toLowerCase())}var _u=pu({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:su,acceptCharset:X,accessKey:X,action:null,allow:null,allowFullScreen:J,allowPaymentRequest:J,allowUserMedia:J,alpha:J,alt:null,as:null,async:J,autoCapitalize:null,autoComplete:X,autoFocus:J,autoPlay:J,blocking:X,capture:null,charSet:null,checked:J,cite:null,className:X,closedBy:null,colorSpace:null,cols:Y,colSpan:Y,command:null,commandFor:null,content:null,contentEditable:au,controls:J,controlsList:X,coords:Y|su,crossOrigin:null,data:null,dateTime:null,decoding:null,default:J,defer:J,dir:null,dirName:null,disabled:J,download:ou,draggable:au,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:J,formTarget:null,headers:X,height:Y,hidden:ou,high:Y,href:null,hrefLang:null,htmlFor:X,httpEquiv:X,id:null,imageSizes:null,imageSrcSet:null,inert:J,inputMode:null,integrity:null,is:null,isMap:J,itemId:null,itemProp:X,itemRef:X,itemScope:J,itemType:X,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:J,low:Y,manifest:null,max:null,maxLength:Y,media:null,method:null,min:null,minLength:Y,multiple:J,muted:J,name:null,nonce:null,noModule:J,noValidate:J,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:J,optimum:Y,pattern:null,ping:X,placeholder:null,playsInline:J,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:J,referrerPolicy:null,rel:X,required:J,reversed:J,rows:Y,rowSpan:Y,sandbox:X,scope:null,scoped:J,seamless:J,selected:J,shadowRootClonable:J,shadowRootCustomElementRegistry:J,shadowRootDelegatesFocus:J,shadowRootMode:null,shadowRootSerializable:J,shape:null,size:Y,sizes:null,slot:null,span:Y,spellCheck:au,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Y,step:null,style:null,tabIndex:Y,target:null,title:null,translate:null,type:null,typeMustMatch:J,useMap:null,value:au,width:Y,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:X,axis:null,background:null,bgColor:null,border:Y,borderColor:null,bottomMargin:Y,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:J,declare:J,event:null,face:null,frame:null,frameBorder:null,hSpace:Y,leftMargin:Y,link:null,longDesc:null,lowSrc:null,marginHeight:Y,marginWidth:Y,noResize:J,noHref:J,noShade:J,noWrap:J,object:null,profile:null,prompt:null,rev:null,rightMargin:Y,rules:null,scheme:null,scrolling:au,standby:null,summary:null,text:null,topMargin:Y,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Y,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:J,disablePictureInPicture:J,disableRemotePlayback:J,exportParts:su,part:X,prefix:null,property:null,results:Y,security:null,unselectable:null},space:`html`,transform:gu}),vu=pu({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`,maskType:`mask-type`,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:cu,accentHeight:Y,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Y,amplitude:Y,arabicForm:null,ascent:Y,attributeName:null,attributeType:null,azimuth:Y,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Y,by:null,calcMode:null,capHeight:Y,className:X,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:Y,diffuseConstant:Y,direction:null,display:null,dur:null,divisor:Y,dominantBaseline:null,download:J,dx:null,dy:null,edgeMode:null,editable:null,elevation:Y,enableBackground:null,end:null,event:null,exponent:Y,externalResourcesRequired:null,fill:null,fillOpacity:Y,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:su,g2:su,glyphName:su,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Y,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Y,horizOriginX:Y,horizOriginY:Y,id:null,ideographic:Y,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Y,k:Y,k1:Y,k2:Y,k3:Y,k4:Y,kernelMatrix:cu,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Y,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Y,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:Y,overlineThickness:Y,paintOrder:null,panose1:null,path:null,pathLength:Y,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:X,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Y,pointsAtY:Y,pointsAtZ:Y,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:cu,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:cu,rev:cu,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:cu,requiredFeatures:cu,requiredFonts:cu,requiredFormats:cu,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:Y,specularExponent:Y,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Y,strikethroughThickness:Y,string:null,stroke:null,strokeDashArray:cu,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Y,strokeOpacity:Y,strokeWidth:null,style:null,surfaceScale:Y,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:cu,tabIndex:Y,tableValues:null,target:null,targetX:Y,targetY:Y,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:cu,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Y,underlineThickness:Y,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Y,values:null,vAlphabetic:Y,vMathematical:Y,vectorEffect:null,vHanging:Y,vIdeographic:Y,version:null,vertAdvY:Y,vertOriginX:Y,vertOriginY:Y,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Y,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:hu}),yu=pu({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()}}),bu=pu({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:gu}),xu=pu({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),Su={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`},Cu=/[A-Z]/g,wu=/-[a-z]/g,Tu=/^data[-\w.:]+$/i;function Eu(e,t){let n=tu(t),r=t,i=nu;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&Tu.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(wu,Ou);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!wu.test(e)){let n=e.replace(Cu,Du);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=du}return new i(r,t)}function Du(e){return`-`+e.toLowerCase()}function Ou(e){return e.charAt(1).toUpperCase()}var ku=eu([mu,_u,yu,bu,xu],`html`),Au=eu([mu,vu,yu,bu,xu],`svg`);function ju(e){let t=String(e||``).trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function Mu(e){return e.join(` `).trim()}var Nu=o(((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=`
19
+ `,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})),Pu=o((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(Nu());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}})),Fu=o((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))}})),Iu=o(((e,t)=>{var n=(e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(Pu()),r=Fu();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})),Lu=zu(`end`),Ru=zu(`start`);function zu(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 Bu(e){let t=Ru(e),n=Lu(e);if(t&&n)return{start:t,end:n}}function Vu(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?Uu(e.position):`start`in e||`end`in e?Uu(e):`line`in e||`column`in e?Hu(e):``}function Hu(e){return Wu(e&&e.line)+`:`+Wu(e&&e.column)}function Uu(e){return Hu(e&&e.start)+`-`+Hu(e&&e.end)}function Wu(e){return e&&typeof e==`number`?e:1}var Gu=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=Vu(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}};Gu.prototype.file=``,Gu.prototype.name=``,Gu.prototype.reason=``,Gu.prototype.message=``,Gu.prototype.stack=``,Gu.prototype.column=void 0,Gu.prototype.line=void 0,Gu.prototype.ancestors=void 0,Gu.prototype.cause=void 0,Gu.prototype.fatal=void 0,Gu.prototype.place=void 0,Gu.prototype.ruleId=void 0,Gu.prototype.source=void 0;var Ku=l(Iu(),1),qu={}.hasOwnProperty,Ju=new Map,Yu=/[A-Z]/g,Xu=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),Zu=new Set([`td`,`th`]),Qu=`https://github.com/syntax-tree/hast-util-to-jsx-runtime`;function $u(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=ud(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=ld(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`?Au:ku,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=ed(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function ed(e,t,n){if(t.type===`element`)return td(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return nd(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return id(e,t,n);if(t.type===`mdxjsEsm`)return rd(e,t);if(t.type===`root`)return ad(e,t,n);if(t.type===`text`)return od(e,t)}function td(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=Au,e.schema=i),e.ancestors.push(t);let a=gd(e,t.tagName,!1),o=dd(e,t),s=pd(e,t);return Xu.has(t.tagName)&&(s=s.filter(function(e){return typeof e==`string`?!Zl(e):!0})),sd(e,o,a,t),cd(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function nd(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)}_d(e,t.position)}function rd(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);_d(e,t.position)}function id(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=Au,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:gd(e,t.name,!0),o=fd(e,t),s=pd(e,t);return sd(e,o,a,t),cd(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function ad(e,t,n){let r={};return cd(r,pd(e,t)),e.create(t,e.Fragment,r,n)}function od(e,t){return t.value}function sd(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function cd(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function ld(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 ud(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=Ru(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 dd(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&qu.call(t.properties,i)){let a=md(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&Zu.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 fd(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 _d(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 _d(e,t.position);else a=r.value===null?!0:r.value;n[i]=a}return n}function pd(e,t){let n=[],r=-1,i=e.passKeys?new Map:Ju;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=ed(e,a,o);s!==void 0&&n.push(s)}return n}function md(e,t,n){let r=Eu(e.schema,t);if(!(n==null||typeof n==`number`&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?Gl(n):Mu(n)),r.property===`style`){let t=typeof n==`object`?n:hd(e,String(n));return e.stylePropertyNameCase===`css`&&(t=vd(t)),[`style`,t]}return[e.elementAttributeNameCase===`react`&&r.space?Su[r.property]||r.property:r.attribute,n]}}function hd(e,t){try{return(0,Ku.default)(t,{reactCompat:!0})}catch(t){if(e.ignoreInvalidStyle)return{};let n=t,r=new Gu("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=Qu+`#cannot-parse-style-attribute`,r}}function gd(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=Yl(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=Yl(t)&&!/^[a-z]/.test(t)?{type:`Identifier`,name:t}:{type:`Literal`,value:t};if(r.type===`Literal`){let t=r.value;return qu.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);_d(e)}function _d(e,t){let n=new Gu("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=Qu+`#cannot-handle-mdx-estrees-without-createevaluater`,n}function vd(e){let t={},n;for(n in e)qu.call(e,n)&&(t[yd(n)]=e[n]);return t}function yd(e){let t=e.replace(Yu,bd);return t.slice(0,3)===`ms-`&&(t=`-`+t),t}function bd(e){return`-`+e.toLowerCase()}var xd={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`]},Sd={};function Cd(e,t){let n=t||Sd;return wd(e,typeof n.includeImageAlt==`boolean`?n.includeImageAlt:!0,typeof n.includeHtml==`boolean`?n.includeHtml:!0)}function wd(e,t,n){if(Ed(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 Td(e.children,t,n)}return Array.isArray(e)?Td(e,t,n):``}function Td(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=wd(e[i],t,n);return r.join(``)}function Ed(e){return!!(e&&typeof e==`object`)}var Dd=document.createElement(`i`);function Od(e){let t=`&`+e+`;`;Dd.innerHTML=t;let n=Dd.textContent;return n.charCodeAt(n.length-1)===59&&e!==`semi`||n===t?!1:n}function kd(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 Ad(e,t){return e.length>0?(kd(e,e.length,0,t),e):t}var jd={}.hasOwnProperty;function Md(e){let t={},n=-1;for(;++n<e.length;)Nd(t,e[n]);return t}function Nd(e,t){let n;for(n in t){let r=(jd.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],a;if(i)for(a in i){jd.call(r,a)||(r[a]=[]);let e=i[a];Pd(r[a],Array.isArray(e)?e:e?[e]:[])}}}function Pd(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add===`after`?e:r).push(t[n]);kd(e,0,0,r)}function Fd(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)}function Id(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}var Ld=qd(/[A-Za-z]/),Rd=qd(/[\dA-Za-z]/),zd=qd(/[#-'*+\--9=?A-Z^-~]/);function Bd(e){return e!==null&&(e<32||e===127)}var Vd=qd(/\d/),Hd=qd(/[\dA-Fa-f]/),Ud=qd(/[!-/:-@[-`{-~]/);function Z(e){return e!==null&&e<-2}function Wd(e){return e!==null&&(e<0||e===32)}function Q(e){return e===-2||e===-1||e===32}var Gd=qd(/\p{P}|\p{S}/u),Kd=qd(/\s/);function qd(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function Jd(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let a=e.charCodeAt(n),o=``;if(a===37&&Rd(e.charCodeAt(n+1))&&Rd(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)}function $(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return Q(r)?(e.enter(n),s(r)):t(r)}function s(r){return Q(r)&&a++<i?(e.consume(r),s):(e.exit(n),t(r))}}var Yd={tokenize:Xd};function Xd(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`),$(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 Z(t)?(e.consume(t),e.exit(`chunkText`),a):(e.consume(t),o)}}var Zd={tokenize:$d},Qd={tokenize:ef};function $d(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 kd(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(Qd,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(Qd,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 Z(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++;kd(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 ef(e,t,n){return $(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}function tf(e){if(e===null||Wd(e)||Kd(e))return 1;if(Gd(e))return 2}function nf(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}var rf={name:`attention`,resolveAll:af,tokenize:of};function af(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};sf(d,-c),sf(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=Ad(l,[[`enter`,e[r][1],t],[`exit`,e[r][1],t]])),l=Ad(l,[[`enter`,i,t],[`enter`,o,t],[`exit`,o,t],[`enter`,a,t]]),l=Ad(l,nf(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),l=Ad(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=Ad(l,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])):u=0,kd(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 of(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=tf(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=tf(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 sf(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var cf={name:`autolink`,tokenize:lf};function lf(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 Ld(t)?(e.consume(t),o):t===64?n(t):l(t)}function o(e){return e===43||e===45||e===46||Rd(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||Rd(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||Bd(r)?n(r):(e.consume(r),c)}function l(t){return t===64?(e.consume(t),u):zd(t)?(e.consume(t),l):n(t)}function u(e){return Rd(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||Rd(t))&&r++<63){let n=t===45?f:d;return e.consume(t),n}return n(t)}}var uf={partial:!0,tokenize:df};function df(e,t,n){return r;function r(t){return Q(t)?$(e,i,`linePrefix`)(t):i(t)}function i(e){return e===null||Z(e)?t(e):n(e)}}var ff={continuation:{tokenize:mf},exit:hf,name:`blockQuote`,tokenize:pf};function pf(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 Q(n)?(e.enter(`blockQuotePrefixWhitespace`),e.consume(n),e.exit(`blockQuotePrefixWhitespace`),e.exit(`blockQuotePrefix`),t):(e.exit(`blockQuotePrefix`),t(n))}}function mf(e,t,n){let r=this;return i;function i(t){return Q(t)?$(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):a(t)}function a(r){return e.attempt(ff,t,n)(r)}}function hf(e){e.exit(`blockQuote`)}var gf={name:`characterEscape`,tokenize:_f};function _f(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 Ud(r)?(e.enter(`characterEscapeValue`),e.consume(r),e.exit(`characterEscapeValue`),e.exit(`characterEscape`),t):n(r)}}var vf={name:`characterReference`,tokenize:yf};function yf(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=Rd,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=Hd,u):(e.enter(`characterReferenceValue`),a=7,o=Vd,u(t))}function u(s){if(s===59&&i){let i=e.exit(`characterReferenceValue`);return o===Rd&&!Od(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 bf={partial:!0,tokenize:Cf},xf={concrete:!0,name:`codeFenced`,tokenize:Sf};function Sf(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`),Q(t)?$(e,d,`whitespace`)(t):d(t))}function d(n){return n===null||Z(n)?(e.exit(`codeFencedFence`),r.interrupt?t(n):e.check(bf,h,b)(n)):(e.enter(`codeFencedFenceInfo`),e.enter(`chunkString`,{contentType:`string`}),f(n))}function f(t){return t===null||Z(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),d(t)):Q(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),$(e,p,`whitespace`)(t)):t===96&&t===s?n(t):(e.consume(t),f)}function p(t){return t===null||Z(t)?d(t):(e.enter(`codeFencedFenceMeta`),e.enter(`chunkString`,{contentType:`string`}),m(t))}function m(t){return t===null||Z(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&&Q(t)?$(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||Z(t)?e.check(bf,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||Z(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`),Q(t)?$(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`),Q(t)?$(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||Z(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}function Cf(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 wf={name:`codeIndented`,tokenize:Ef},Tf={partial:!0,tokenize:Df};function Ef(e,t,n){let r=this;return i;function i(t){return e.enter(`codeIndented`),$(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):Z(t)?e.attempt(Tf,o,c)(t):(e.enter(`codeFlowValue`),s(t))}function s(t){return t===null||Z(t)?(e.exit(`codeFlowValue`),o(t)):(e.consume(t),s)}function c(n){return e.exit(`codeIndented`),t(n)}}function Df(e,t,n){let r=this;return i;function i(t){return r.parser.lazy[r.now().line]?n(t):Z(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),i):$(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):Z(e)?i(e):n(e)}}var Of={name:`codeText`,previous:Af,resolve:kf,tokenize:jf};function kf(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 Af(e){return e!==96||this.events[this.events.length-1][1].type===`characterEscape`}function jf(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)):Z(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||Z(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 Mf=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&&Nf(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),Nf(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),Nf(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);Nf(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);Nf(this.left,t.reverse())}}};function Nf(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 Pf(e){let t={},n=-1,r,i,a,o,s,c,l,u=new Mf(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,Ff(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 kd(e,0,1/0,u.slice(0)),!l}function Ff(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 If={resolve:Rf,tokenize:zf},Lf={partial:!0,tokenize:Bf};function Rf(e){return Pf(e),e}function zf(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):Z(t)?e.check(Lf,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 Bf(e,t,n){let r=this;return i;function i(t){return e.exit(`chunkContent`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),$(e,a,`linePrefix`)}function a(i){if(i===null||Z(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 Vf(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||Bd(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||Z(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||Wd(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||Bd(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 Hf(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):Z(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||Z(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!Q(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function Uf(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):Z(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),$(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||Z(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 Wf(e,t){let n;return r;function r(i){return Z(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):Q(i)?$(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var Gf={name:`definition`,tokenize:qf},Kf={partial:!0,tokenize:Jf};function qf(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return Hf.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=Id(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 Wd(t)?Wf(e,l)(t):l(t)}function l(t){return Vf(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(Kf,d,d)(t)}function d(t){return Q(t)?$(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||Z(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function Jf(e,t,n){return r;function r(t){return Wd(t)?Wf(e,i)(t):n(t)}function i(t){return Uf(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return Q(t)?$(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||Z(e)?t(e):n(e)}}var Yf={name:`hardBreakEscape`,tokenize:Xf};function Xf(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return Z(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}var Zf={name:`headingAtx`,resolve:Qf,tokenize:$f};function Qf(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`},kd(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])),e}function $f(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||Wd(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||Z(n)?(e.exit(`atxHeading`),t(n)):Q(n)?$(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||Wd(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var ep=`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(`.`),tp=[`pre`,`script`,`style`,`textarea`],np={concrete:!0,name:`htmlFlow`,resolveTo:ap,tokenize:op},rp={partial:!0,tokenize:cp},ip={partial:!0,tokenize:sp};function ap(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 op(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):Ld(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):Ld(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 Ld(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||Wd(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&tp.includes(l)?(i=1,r.interrupt?t(s):O(s)):ep.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||Rd(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 Q(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||Ld(t)?(e.consume(t),b):Q(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||Rd(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):Q(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):Q(t)?(e.consume(t),S):w(t)}function C(t){return t===c?(e.consume(t),c=null,T):t===null||Z(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||Wd(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||Q(e)?y(e):n(e)}function E(t){return t===62?(e.consume(t),D):n(t)}function D(t){return t===null||Z(t)?O(t):Q(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):Z(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(rp,re,k)(t)):t===null||Z(t)?(e.exit(`htmlFlowData`),k(t)):(e.consume(t),O)}function k(t){return e.check(ip,A,re)(t)}function A(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),j}function j(t){return t===null||Z(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 tp.includes(n)?(e.consume(t),ne):O(t)}return Ld(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||Z(t)?(e.exit(`htmlFlowData`),re(t)):(e.consume(t),ne)}function re(n){return e.exit(`htmlFlow`),t(n)}}function sp(e,t,n){let r=this;return i;function i(t){return Z(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 cp(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(uf,t,n)}}var lp={name:`htmlText`,tokenize:up};function up(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):Ld(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):Ld(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):Z(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):Z(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):Z(t)?(o=v,N(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):Z(t)?(o=y,N(t)):(e.consume(t),y)}function b(e){return e===62?M(e):y(e)}function x(t){return Ld(t)?(e.consume(t),S):n(t)}function S(t){return t===45||Rd(t)?(e.consume(t),S):C(t)}function C(t){return Z(t)?(o=C,N(t)):Q(t)?(e.consume(t),C):M(t)}function w(t){return t===45||Rd(t)?(e.consume(t),w):t===47||t===62||Wd(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),M):t===58||t===95||Ld(t)?(e.consume(t),E):Z(t)?(o=T,N(t)):Q(t)?(e.consume(t),T):M(t)}function E(t){return t===45||t===46||t===58||t===95||Rd(t)?(e.consume(t),E):D(t)}function D(t){return t===61?(e.consume(t),O):Z(t)?(o=D,N(t)):Q(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):Z(t)?(o=O,N(t)):Q(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):Z(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||Wd(t)?T(t):(e.consume(t),A)}function j(e){return e===47||e===62||Wd(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 Q(t)?$(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 dp={name:`labelEnd`,resolveAll:hp,resolveTo:gp,tokenize:_p},fp={tokenize:vp},pp={tokenize:yp},mp={tokenize:bp};function hp(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&&kd(e,0,e.length,n),e}function gp(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=Ad(s,e.slice(a+1,a+r+3)),s=Ad(s,[[`enter`,u,t]]),s=Ad(s,nf(t.parser.constructs.insideSpan.null,e.slice(a+r+4,o-3),t)),s=Ad(s,[[`exit`,u,t],e[o-2],e[o-1],[`exit`,l,t]]),s=Ad(s,e.slice(o+1)),s=Ad(s,[[`exit`,c,t]]),kd(e,a,e.length,s),e}function _p(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(Id(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(fp,u,o?u:d)(t):t===91?e.attempt(pp,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(mp,u,d)(t)}function u(e){return t(e)}function d(e){return a._balanced=!0,n(e)}}function vp(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 Wd(t)?Wf(e,a)(t):a(t)}function a(t){return t===41?u(t):Vf(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return Wd(t)?Wf(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?Uf(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return Wd(t)?Wf(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 yp(e,t,n){let r=this;return i;function i(t){return Hf.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(Id(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function bp(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 xp={name:`labelStartImage`,resolveAll:dp.resolveAll,tokenize:Sp};function Sp(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 Cp={name:`labelStartLink`,resolveAll:dp.resolveAll,tokenize:wp};function wp(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 Tp={name:`lineEnding`,tokenize:Ep};function Ep(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),$(e,t,`linePrefix`)}}var Dp={name:`thematicBreak`,tokenize:Op};function Op(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||Z(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),Q(t)?$(e,s,`whitespace`)(t):s(t))}}var kp={continuation:{tokenize:Np},exit:Fp,name:`list`,tokenize:Mp},Ap={partial:!0,tokenize:Ip},jp={partial:!0,tokenize:Pp};function Mp(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:Vd(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(Dp,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 Vd(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(uf,r.interrupt?n:u,e.attempt(Ap,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return Q(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 Np(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(uf,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,$(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!Q(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(jp,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,$(e,e.attempt(kp,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function Pp(e,t,n){let r=this;return $(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 Fp(e){e.exit(this.containerState.type)}function Ip(e,t,n){let r=this;return $(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!Q(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var Lp={name:`setextUnderline`,resolveTo:Rp,tokenize:zp};function Rp(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 zp(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`),Q(t)?$(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||Z(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var Bp={tokenize:Vp};function Vp(e){let t=this,n=e.attempt(uf,r,e.attempt(this.parser.constructs.flowInitial,i,$(e,e.attempt(this.parser.constructs.flow,i,e.attempt(If,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 Hp={resolveAll:Kp()},Up=Gp(`string`),Wp=Gp(`text`);function Gp(e){return{resolveAll:Kp(e===`text`?qp: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 Kp(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 qp(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 Jp=s({attentionMarkers:()=>nm,contentInitial:()=>Xp,disable:()=>rm,document:()=>Yp,flow:()=>Qp,flowInitial:()=>Zp,insideSpan:()=>tm,string:()=>$p,text:()=>em}),Yp={42:kp,43:kp,45:kp,48:kp,49:kp,50:kp,51:kp,52:kp,53:kp,54:kp,55:kp,56:kp,57:kp,62:ff},Xp={91:Gf},Zp={[-2]:wf,[-1]:wf,32:wf},Qp={35:Zf,42:Dp,45:[Lp,Dp],60:np,61:Lp,95:Dp,96:xf,126:xf},$p={38:vf,92:gf},em={[-5]:Tp,[-4]:Tp,[-3]:Tp,33:xp,38:vf,42:rf,60:[cf,lp],91:Cp,92:[Yf,gf],93:dp,95:rf,96:Of},tm={null:[rf,Hp]},nm={null:[42,95]},rm={null:[]};function im(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=Ad(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=nf(a,l.events,l),l.events):[]}function f(e,t){return om(p(e),t)}function p(e){return am(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){Z(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&&kd(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 am(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 om(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=`
20
+ `;break;case-3:o=`\r
21
+ `;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 sm(e){let t={constructs:Md([Jp,...(e||{}).extensions||[]]),content:n(Yd),defined:[],document:n(Zd),flow:n(Bp),lazy:{},string:n(Up),text:n(Wp)};return t;function n(e){return n;function n(n){return im(t,e,n)}}}function cm(e){for(;!Pf(e););return e}var lm=/[\0\t\n\r]/g;function um(){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(lm.lastIndex=u,c=lm.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 dm=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function fm(e){return e.replace(dm,pm)}function pm(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){let e=n.charCodeAt(1),t=e===120||e===88;return Fd(n.slice(t?2:1),t?16:10)}return Od(n)||e}var mm={}.hasOwnProperty;function hm(e,t,n){return t&&typeof t==`object`&&(n=t,t=void 0),gm(n)(cm(sm(n).document().write(um()(e,t,!0))))}function gm(e){let t={transforms:[],canContainEols:[`emphasis`,`fragment`,`heading`,`paragraph`,`strong`],enter:{autolink:a(_e),autolinkProtocol:T,autolinkEmail:T,atxHeading:a(pe),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(L),hardBreakEscape:a(me),hardBreakTrailing:a(me),htmlFlow:a(he,o),htmlFlowData:T,htmlText:a(he,o),htmlTextData:T,image:a(ge),label:o,link:a(_e),listItem:a(ye),listItemValue:f,listOrdered:a(ve,d),listUnordered:a(ve),paragraph:a(be),reference:F,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:a(pe),strong:a(xe),thematicBreak:a(Ce)},exit:{atxHeading:c(),atxHeadingSequence:x,autolink:c(),autolinkEmail:I,autolinkProtocol:ce,blockQuote:c(),characterEscapeValue:E,characterReferenceMarkerHexadecimal:ae,characterReferenceMarkerNumeric:ae,characterReferenceValue:oe,characterReference:se,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:ie,resourceDestinationString:te,resourceTitleString:ne,resource:re,setextHeading:c(w),setextHeadingLineSequence:C,setextHeadingText:S,strong:c(),thematicBreak:c()}};vm(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]];mm.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]||bm).call(a,void 0,e[0])}for(r.position={start:_m(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:_m(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:_m(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]||bm).call(this,e,r[0]));else throw Error("Cannot close `"+e.type+"` ("+Vu({start:e.start,end:e.end})+`): it’s not open`);n.position.end=_m(e.end)}function u(){return Cd(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=Id(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=Se(),n.position={start:_m(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=_m(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=_m(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=fm(t),n.identifier=Id(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 re(){this.data.inReference=void 0}function F(){this.data.referenceType=`collapsed`}function ie(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=Id(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType=`full`}function ae(e){this.data.characterReferenceType=e.type}function oe(e){let t=this.sliceSerialize(e),n=this.data.characterReferenceType,r;n?(r=Fd(t,n===`characterReferenceMarkerNumeric`?10:16),this.data.characterReferenceType=void 0):r=Od(t);let i=this.stack[this.stack.length-1];i.value+=r}function se(e){let t=this.stack.pop();t.position.end=_m(e.end)}function ce(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=this.sliceSerialize(e)}function I(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 L(){return{type:`emphasis`,children:[]}}function pe(){return{type:`heading`,depth:0,children:[]}}function me(){return{type:`break`}}function he(){return{type:`html`,value:``}}function ge(){return{type:`image`,title:null,url:``,alt:null}}function _e(){return{type:`link`,title:null,url:``,children:[]}}function ve(e){return{type:`list`,ordered:e.type===`listOrdered`,start:null,spread:e._spread,children:[]}}function ye(e){return{type:`listItem`,spread:e._spread,checked:null,children:[]}}function be(){return{type:`paragraph`,children:[]}}function xe(){return{type:`strong`,children:[]}}function Se(){return{type:`text`,value:``}}function Ce(){return{type:`thematicBreak`}}}function _m(e){return{line:e.line,column:e.column,offset:e.offset}}function vm(e,t){let n=-1;for(;++n<t.length;){let r=t[n];Array.isArray(r)?vm(e,r):ym(e,r)}}function ym(e,t){let n;for(n in t)if(mm.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 bm(e,t){throw Error(e?"Cannot close `"+e.type+"` ("+Vu({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Vu({start:t.start,end:t.end})+`) is open`:"Cannot close document, a token (`"+t.type+"`, "+Vu({start:t.start,end:t.end})+`) is still open`)}function xm(e){let t=this;t.parser=n;function n(n){return hm(n,{...t.data(`settings`),...e,extensions:t.data(`micromarkExtensions`)||[],mdastExtensions:t.data(`fromMarkdownExtensions`)||[]})}}function Sm(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 Cm(e,t){let n={type:`element`,tagName:`br`,properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:`text`,value:`
22
+ `}]}function wm(e,t){let n=t.value?t.value+`
23
+ `:``,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 Tm(e,t){let n={type:`element`,tagName:`del`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Em(e,t){let n={type:`element`,tagName:`em`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Dm(e,t){let n=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,r=String(t.identifier).toUpperCase(),i=Jd(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 Om(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 km(e,t){if(e.options.allowDangerousHtml){let n={type:`raw`,value:t.value};return e.patch(t,n),e.applyData(t,n)}}function Am(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 jm(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Am(e,t);let i={src:Jd(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 Mm(e,t){let n={src:Jd(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 Nm(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 Pm(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Am(e,t);let i={href:Jd(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 Fm(e,t){let n={href:Jd(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 Im(e,t,n){let r=e.all(t),i=n?Lm(n):Rm(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:`
24
+ `}),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:`
25
+ `});let l={type:`element`,tagName:`li`,properties:a,children:o};return e.patch(t,l),e.applyData(t,l)}function Lm(e){let t=!1;if(e.type===`list`){t=e.spread||!1;let n=e.children,r=-1;for(;!t&&++r<n.length;)t=Rm(n[r])}return t}function Rm(e){return e.spread??e.children.length>1}function zm(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 Bm(e,t){let n={type:`element`,tagName:`p`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Vm(e,t){let n={type:`root`,children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function Hm(e,t){let n={type:`element`,tagName:`strong`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Um(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=Ru(t.children[1]),o=Lu(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 Wm(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 Gm(e,t){let n={type:`element`,tagName:`td`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}var Km=9,qm=32;function Jm(e){let t=String(e),n=/\r?\n|\r/g,r=n.exec(t),i=0,a=[];for(;r;)a.push(Ym(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return a.push(Ym(t.slice(i),i>0,!1)),a.join(``)}function Ym(e,t,n){let r=0,i=e.length;if(t){let t=e.codePointAt(r);for(;t===Km||t===qm;)r++,t=e.codePointAt(r)}if(n){let t=e.codePointAt(i-1);for(;t===Km||t===qm;)i--,t=e.codePointAt(i-1)}return i>r?e.slice(r,i):``}function Xm(e,t){let n={type:`text`,value:Jm(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function Zm(e,t){let n={type:`element`,tagName:`hr`,properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}var Qm={blockquote:Sm,break:Cm,code:wm,delete:Tm,emphasis:Em,footnoteReference:Dm,heading:Om,html:km,imageReference:jm,image:Mm,inlineCode:Nm,linkReference:Pm,link:Fm,listItem:Im,list:zm,paragraph:Bm,root:Vm,strong:Hm,table:Um,tableCell:Gm,tableRow:Wm,text:Xm,thematicBreak:Zm,toml:$m,yaml:$m,definition:$m,footnoteDefinition:$m};function $m(){}var eh=typeof self==`object`?self:globalThis,th=(e,t)=>{switch(e){case`Function`:case`SharedWorker`:case`Worker`:case`eval`:case`setInterval`:case`setTimeout`:throw TypeError(`unable to deserialize `+e)}return new eh[e](t)},nh=(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(th(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(th(a,o),i)};return r},rh=e=>nh(new Map,e)(0),ih=``,{toString:ah}={},{keys:oh}=Object,sh=e=>{let t=typeof e;if(t!==`object`||!e)return[0,t];let n=ah.call(e).slice(8,-1);switch(n){case`Array`:return[1,ih];case`Object`:return[2,ih];case`Date`:return[3,ih];case`RegExp`:return[4,ih];case`Map`:return[5,ih];case`Set`:return[6,ih];case`DataView`:return[1,n]}return n.includes(`Array`)?[1,n]:n.includes(`Error`)?[7,n]:[2,n]},ch=([e,t])=>e===0&&(t===`function`||t===`symbol`),lh=(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]=sh(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 oh(r))(e||!ch(sh(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||!(ch(sh(n))||ch(sh(i))))&&t.push([a(n),a(i)]);return n}case 6:{let t=[],n=i([o,t],r);for(let n of r)(e||!ch(sh(n)))&&t.push(a(n));return n}}let{message:c}=r;return i([o,{name:s,message:c}],r)};return a},uh=(e,{json:t,lossy:n}={})=>{let r=[];return lh(!(t||n),!!t,new Map,r)(e),r},dh=typeof structuredClone==`function`?(e,t)=>t&&(`json`in t||`lossy`in t)?rh(uh(e,t)):structuredClone(e):(e,t)=>rh(uh(e,t));function fh(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 ph(e,t){return`Back to reference `+(e+1)+(t>1?`-`+t:``)}function mh(e){let t=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,n=e.options.footnoteBackContent||fh,r=e.options.footnoteBackLabel||ph,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=Jd(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:{...dh(o),id:`footnote-label`},children:[{type:`text`,value:i}]},{type:`text`,value:`
26
+ `},{type:`element`,tagName:`ol`,properties:{},children:e.wrap(s,!0)},{type:`text`,value:`
27
+ `}]}}var hh=(function(e){if(e==null)return bh;if(typeof e==`function`)return yh(e);if(typeof e==`object`)return Array.isArray(e)?gh(e):_h(e);if(typeof e==`string`)return vh(e);throw Error(`Expected function, string, or object as test`)});function gh(e){let t=[],n=-1;for(;++n<e.length;)t[n]=hh(e[n]);return yh(r);function r(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1}}function _h(e){let t=e;return yh(n);function n(n){let r=n,i;for(i in e)if(r[i]!==t[i])return!1;return!0}}function vh(e){return yh(t);function t(t){return t&&t.type===e}}function yh(e){return t;function t(t,n,r){return!!(xh(t)&&e.call(this,t,typeof n==`number`?n:void 0,r||void 0))}}function bh(){return!0}function xh(e){return typeof e==`object`&&!!e&&`type`in e}function Sh(e){return e}var Ch=[];function wh(e,t,n,r){let i;typeof t==`function`&&typeof n!=`function`?(r=n,n=t):i=t;let a=hh(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 (`+Sh(e.type+(t?`<`+t+`>`:``))+`)`})}return u;function u(){let l=Ch,u,d,f;if((!t||a(e,i,c[c.length-1]||void 0))&&(l=Th(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 Th(e){return Array.isArray(e)?e:typeof e==`number`?[!0,e]:e==null?Ch:[e]}function Eh(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),wh(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 Dh={}.hasOwnProperty,Oh={};function kh(e,t){let n=t||Oh,r=new Map,i=new Map,a={all:s,applyData:jh,definitionById:r,footnoteById:i,footnoteCounts:new Map,footnoteOrder:[],handlers:{...Qm,...n.handlers},one:o,options:n,patch:Ah,wrap:Nh};return Eh(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(Dh.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=dh(n);return r.children=a.all(e),r}return dh(e)}return(a.options.unknownHandler||Mh)(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=Ph(i.value)),!Array.isArray(i)&&i.type===`element`)){let e=i.children[0];e&&e.type===`text`&&(e.value=Ph(e.value))}Array.isArray(i)?t.push(...i):t.push(i)}}}return t}}function Ah(e,t){e.position&&(t.position=Bu(e))}function jh(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,dh(i)),`children`in n&&n.children&&r!=null&&(n.children=r)}return n}function Mh(e,t){let n=t.data||{},r=`value`in t&&!(Dh.call(n,`hProperties`)||Dh.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 Nh(e,t){let n=[],r=-1;for(t&&n.push({type:`text`,value:`
28
+ `});++r<e.length;)r&&n.push({type:`text`,value:`
29
+ `}),n.push(e[r]);return t&&e.length>0&&n.push({type:`text`,value:`
30
+ `}),n}function Ph(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function Fh(e,t){let n=kh(e,t),r=n.one(e,void 0),i=mh(n),a=Array.isArray(r)?{type:`root`,children:r}:r||{type:`root`,children:[]};return i&&(`children`in a,a.children.push({type:`text`,value:`
31
+ `},i)),a}function Ih(e,t){return e&&`run`in e?async function(n,r){let i=Fh(n,{file:r,...t});await e.run(i,r)}:function(n,r){return Fh(n,{file:r,...e||t})}}function Lh(e){if(e)throw e}var Rh=o(((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 zh(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 Bh(){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?Vh(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 Vh(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 Hh={basename:Uh,dirname:Wh,extname:Gh,join:Kh,sep:`/`};function Uh(e,t){if(t!==void 0&&typeof t!=`string`)throw TypeError(`"ext" argument must be a string`);Yh(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 Wh(e){if(Yh(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 Gh(e){Yh(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 Kh(...e){let t=-1,n;for(;++t<e.length;)Yh(e[t]),e[t]&&(n=n===void 0?e[t]:n+`/`+e[t]);return n===void 0?`.`:qh(n)}function qh(e){Yh(e);let t=e.codePointAt(0)===47,n=Jh(e,!t);return n.length===0&&!t&&(n=`.`),n.length>0&&e.codePointAt(e.length-1)===47&&(n+=`/`),t?`/`+n:n}function Jh(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 Yh(e){if(typeof e!=`string`)throw TypeError(`Path must be a string. Received `+JSON.stringify(e))}var Xh={cwd:Zh};function Zh(){return`/`}function Qh(e){return!!(typeof e==`object`&&e&&`href`in e&&e.href&&`protocol`in e&&e.protocol&&e.auth===void 0)}function $h(e){if(typeof e==`string`)e=new URL(e);else if(!Qh(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 eg(e)}function eg(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 tg=[`history`,`path`,`basename`,`stem`,`extname`,`dirname`],ng=class{constructor(e){let t;t=e?Qh(e)?{path:e}:typeof e==`string`||og(e)?{value:e}:e:{},this.cwd=`cwd`in t?``:Xh.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<tg.length;){let e=tg[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)tg.includes(r)||(this[r]=t[r])}get basename(){return typeof this.path==`string`?Hh.basename(this.path):void 0}set basename(e){ig(e,`basename`),rg(e,`basename`),this.path=Hh.join(this.dirname||``,e)}get dirname(){return typeof this.path==`string`?Hh.dirname(this.path):void 0}set dirname(e){ag(this.basename,`dirname`),this.path=Hh.join(e||``,this.basename)}get extname(){return typeof this.path==`string`?Hh.extname(this.path):void 0}set extname(e){if(rg(e,`extname`),ag(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=Hh.join(this.dirname,this.stem+(e||``))}get path(){return this.history[this.history.length-1]}set path(e){Qh(e)&&(e=$h(e)),ig(e,`path`),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path==`string`?Hh.basename(this.path,this.extname):void 0}set stem(e){ig(e,`stem`),rg(e,`stem`),this.path=Hh.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 Gu(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 rg(e,t){if(e&&e.includes(Hh.sep))throw Error("`"+t+"` cannot be a path: did not expect `"+Hh.sep+"`")}function ig(e,t){if(!e)throw Error("`"+t+"` cannot be empty")}function ag(e,t){if(!e)throw Error("Setting `"+t+"` requires `path` to be set too")}function og(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var sg=(function(e){let t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r}),cg=l(Rh(),1),lg={}.hasOwnProperty,ug=new class e extends sg{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=Bh()}copy(){let t=new e,n=-1;for(;++n<this.attachers.length;){let e=this.attachers[n];t.use(...e)}return t.data((0,cg.default)(!0,{},this.namespace)),t}data(e,t){return typeof e==`string`?arguments.length===2?(pg(`data`,this.frozen),this.namespace[e]=t,this):lg.call(this.namespace,e)&&this.namespace[e]||void 0:e?(pg(`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=gg(e),n=this.parser||this.Parser;return dg(`parse`,n),n(String(t),t)}process(e,t){let n=this;return this.freeze(),dg(`process`,this.parser||this.Parser),fg(`process`,this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,i){let a=gg(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);vg(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(),dg(`processSync`,this.parser||this.Parser),fg(`processSync`,this.compiler||this.Compiler),this.process(e,r),hg(`processSync`,`process`,t),n;function r(e,r){t=!0,Lh(e),n=r}}run(e,t,n){mg(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=gg(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),hg(`runSync`,`run`,n),r;function i(e,t){Lh(e),r=t,n=!0}}stringify(e,t){this.freeze();let n=gg(t),r=this.compiler||this.Compiler;return fg(`stringify`,r),mg(e),r(e,n)}use(e,...t){let n=this.attachers,r=this.namespace;if(pg(`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,cg.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];zh(o)&&zh(r)&&(r=(0,cg.default)(!0,o,r)),n[i]=[e,r,...a]}}}}().freeze();function dg(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `parser`")}function fg(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `compiler`")}function pg(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 mg(e){if(!zh(e)||typeof e.type!=`string`)throw TypeError("Expected node, got `"+e+"`")}function hg(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function gg(e){return _g(e)?e:new ng(e)}function _g(e){return!!(e&&typeof e==`object`&&`message`in e&&`messages`in e)}function vg(e){return typeof e==`string`||yg(e)}function yg(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var bg=[],xg={allowDangerousHtml:!0},Sg=/^(https?|ircs?|mailto|xmpp)$/i,Cg=[{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:`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 wg(e){let t=Tg(e),n=Eg(e);return Dg(t.runSync(t.parse(n),n),e)}function Tg(e){let t=e.rehypePlugins||bg,n=e.remarkPlugins||bg,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...xg}:xg;return ug().use(xm).use(n).use(Ih,r).use(t)}function Eg(e){let t=e.children||``,n=new ng;return typeof t==`string`?n.value=t:``+t,n}function Dg(e,t){let n=t.allowedElements,r=t.allowElement,i=t.components,a=t.disallowedElements,o=t.skipHtml,s=t.unwrapDisallowed,c=t.urlTransform||Og;for(let e of Cg)Object.hasOwn(t,e.from)&&``+e.from+(e.to?"use `"+e.to+"` instead":`remove it`)+e.id;return t.className&&(e={type:`element`,tagName:`div`,properties:{className:t.className},children:e.type===`root`?e.children:[e]}),Eh(e,l),$u(e,{Fragment:H.Fragment,components:i,ignoreInvalidStyle:!0,jsx:H.jsx,jsxs:H.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 xd)if(Object.hasOwn(xd,t)&&Object.hasOwn(e.properties,t)){let n=e.properties[t],r=xd[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 Og(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||Sg.test(e.slice(0,t))?e:``}function kg(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}function Ag(e){if(typeof e!=`string`)throw TypeError(`Expected a string`);return e.replace(/[|\\{}()[\]^$+*?.]/g,`\\$&`).replace(/-/g,`\\x2d`)}function jg(e,t,n){let r=hh((n||{}).ignore||[]),i=Mg(t),a=-1;for(;++a<i.length;)wh(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 Mg(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([Ng(e[0]),Pg(e[1])])}return t}function Ng(e){return typeof e==`string`?new RegExp(Ag(e),`g`):e}function Pg(e){return typeof e==`function`?e:function(){return e}}var Fg=`phrasing`,Ig=[`autolink`,`link`,`image`,`label`];function Lg(){return{transforms:[Gg],enter:{literalAutolink:zg,literalAutolinkEmail:Bg,literalAutolinkHttp:Bg,literalAutolinkWww:Bg},exit:{literalAutolink:Wg,literalAutolinkEmail:Ug,literalAutolinkHttp:Vg,literalAutolinkWww:Hg}}}function Rg(){return{unsafe:[{character:`@`,before:`[+\\-.\\w]`,after:`[\\-.\\w]`,inConstruct:Fg,notInConstruct:Ig},{character:`.`,before:`[Ww]`,after:`[\\-.\\w]`,inConstruct:Fg,notInConstruct:Ig},{character:`:`,before:`[ps]`,after:`\\/`,inConstruct:Fg,notInConstruct:Ig}]}}function zg(e){this.enter({type:`link`,title:null,url:``,children:[]},e)}function Bg(e){this.config.enter.autolinkProtocol.call(this,e)}function Vg(e){this.config.exit.autolinkProtocol.call(this,e)}function Hg(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 Ug(e){this.config.exit.autolinkEmail.call(this,e)}function Wg(e){this.exit(e)}function Gg(e){jg(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,Kg],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,qg]],{ignore:[`link`,`linkReference`]})}function Kg(e,t,n,r,i){let a=``;if(!Xg(i)||(/^w/i.test(t)&&(n=t+n,t=``,a=`http://`),!Jg(n)))return!1;let o=Yg(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 qg(e,t,n,r){return!Xg(r,!0)||/[-\d_]$/.test(n)?!1:{type:`link`,title:null,url:`mailto:`+t+`@`+n,children:[{type:`text`,value:t+`@`+n}]}}function Jg(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 Yg(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=kg(e,`(`),a=kg(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 Xg(e,t){let n=e.input.charCodeAt(e.index-1);return(e.index===0||Kd(n)||Gd(n))&&(!t||n!==47)}o_.peek=a_;function Zg(){this.buffer()}function Qg(e){this.enter({type:`footnoteReference`,identifier:``,label:``},e)}function $g(){this.buffer()}function e_(e){this.enter({type:`footnoteDefinition`,identifier:``,label:``,children:[]},e)}function t_(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Id(this.sliceSerialize(e)).toLowerCase(),n.label=t}function n_(e){this.exit(e)}function r_(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Id(this.sliceSerialize(e)).toLowerCase(),n.label=t}function i_(e){this.exit(e)}function a_(){return`[`}function o_(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 s_(){return{enter:{gfmFootnoteCallString:Zg,gfmFootnoteCall:Qg,gfmFootnoteDefinitionLabelString:$g,gfmFootnoteDefinition:e_},exit:{gfmFootnoteCallString:t_,gfmFootnoteCall:n_,gfmFootnoteDefinitionLabelString:r_,gfmFootnoteDefinition:i_}}}function c_(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:o_},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?`
32
+ `:` `)+r.indentLines(r.containerFlow(e,a.current()),t?u_:l_))),s(),o}}function l_(e,t,n){return t===0?e:u_(e,t,n)}function u_(e,t,n){return(n?``:` `)+e}var d_=[`autolink`,`destinationLiteral`,`destinationRaw`,`reference`,`titleQuote`,`titleApostrophe`];g_.peek=__;function f_(){return{canContainEols:[`delete`],enter:{strikethrough:m_},exit:{strikethrough:h_}}}function p_(){return{unsafe:[{character:`~`,inConstruct:`phrasing`,notInConstruct:d_}],handlers:{delete:g_}}}function m_(e){this.enter({type:`delete`,children:[]},e)}function h_(e){this.exit(e)}function g_(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 __(){return`~`}function v_(e){return e.length}function y_(e,t){let n=t||{},r=(n.align||[]).concat(),i=n.stringLength||v_,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=b_(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]=x_(r[d]);else{let e=x_(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(`
33
+ `)}function b_(e){return e==null?``:String(e)}function x_(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 S_(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()),C_);return i(),o}function C_(e,t,n){return`>`+(n?``:` `)+e}function w_(e,t){return T_(e,t.inConstruct,!0)&&!T_(e,t.notInConstruct,!1)}function T_(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 E_(e,t,n,r){let i=-1;for(;++i<n.unsafe.length;)if(n.unsafe[i].character===`
34
+ `&&w_(n.stack,n.unsafe[i]))return/[ \t]/.test(r.before)?``:` `;return`\\
35
+ `}function D_(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 O_(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 k_(e){let t=e.options.fence||"`";if(t!=="`"&&t!==`~`)throw Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function A_(e,t,n,r){let i=k_(n),a=e.value||``,o=i==="`"?`GraveAccent`:`Tilde`;if(O_(e,n)){let e=n.enter(`codeIndented`),t=n.indentLines(a,j_);return e(),t}let s=n.createTracker(r),c=i.repeat(Math.max(D_(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:`
36
+ `,encode:["`"],...s.current()})),t()}return u+=s.move(`
37
+ `),a&&(u+=s.move(a+`
38
+ `)),u+=s.move(c),l(),u}function j_(e,t,n){return(n?``:` `)+e}function M_(e){let t=e.options.quote||`"`;if(t!==`"`&&t!==`'`)throw Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function N_(e,t,n,r){let i=M_(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?` `:`
39
+ `,...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 P_(e){let t=e.options.emphasis||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function F_(e){return`&#x`+e.toString(16).toUpperCase()+`;`}function I_(e,t,n){let r=tf(e),i=tf(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}}L_.peek=R_;function L_(e,t,n,r){let i=P_(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=I_(r.before.charCodeAt(r.before.length-1),l,i);u.inside&&(c=F_(l)+c.slice(1));let d=c.charCodeAt(c.length-1),f=I_(r.after.charCodeAt(0),d,i);f.inside&&(c=c.slice(0,-1)+F_(d));let p=o.move(i);return a(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},s+c+p}function R_(e,t,n){return n.options.emphasis||`*`}function z_(e,t){let n=!1;return Eh(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)&&Cd(e)&&(t.options.setext||n))}function B_(e,t,n,r){let i=Math.max(Math.min(6,e.depth||1),1),a=n.createTracker(r);if(z_(e,n)){let t=n.enter(`headingSetext`),r=n.enter(`phrasing`),o=n.containerPhrasing(e,{...a.current(),before:`
40
+ `,after:`
41
+ `});return r(),t(),o+`
42
+ `+(i===1?`=`:`-`).repeat(o.length-(Math.max(o.lastIndexOf(`\r`),o.lastIndexOf(`
43
+ `))+1))}let o=`#`.repeat(i),s=n.enter(`headingAtx`),c=n.enter(`phrasing`);a.move(o+` `);let l=n.containerPhrasing(e,{before:`# `,after:`
44
+ `,...a.current()});return/^[\t ]/.test(l)&&(l=F_(l.charCodeAt(0))+l.slice(1)),l=l?o+` `+l:o,n.options.closeAtx&&(l+=` `+o),c(),s(),l}V_.peek=H_;function V_(e){return e.value||``}function H_(){return`<`}U_.peek=W_;function U_(e,t,n,r){let i=M_(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 W_(){return`!`}G_.peek=K_;function G_(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 K_(){return`!`}q_.peek=J_;function q_(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 J_(){return"`"}function Y_(e,t){let n=Cd(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))}X_.peek=Z_;function X_(e,t,n,r){let i=M_(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.createTracker(r),s,c;if(Y_(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 Z_(e,t,n){return Y_(e,n)?`<`:`[`}Q_.peek=$_;function Q_(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 $_(){return`[`}function ev(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 tv(e){let t=ev(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 nv(e){let t=e.options.bulletOrdered||`.`;if(t!==`.`&&t!==`)`)throw Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function rv(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 iv(e,t,n,r){let i=n.enter(`list`),a=n.bulletCurrent,o=e.ordered?nv(n):ev(n),s=e.ordered?o===`.`?`)`:`.`:tv(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),rv(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 av(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 ov(e,t,n,r){let i=av(n),a=n.bulletCurrent||ev(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 sv(e,t,n,r){let i=n.enter(`paragraph`),a=n.enter(`phrasing`),o=n.containerPhrasing(e,r);return a(),i(),o}var cv=hh([`break`,`delete`,`emphasis`,`footnote`,`footnoteReference`,`image`,`imageReference`,`inlineCode`,`inlineMath`,`link`,`linkReference`,`mdxJsxTextElement`,`mdxTextExpression`,`strong`,`text`,`textDirective`]);function lv(e,t,n,r){return(e.children.some(function(e){return cv(e)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function uv(e){let t=e.options.strong||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}dv.peek=fv;function dv(e,t,n,r){let i=uv(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=I_(r.before.charCodeAt(r.before.length-1),l,i);u.inside&&(c=F_(l)+c.slice(1));let d=c.charCodeAt(c.length-1),f=I_(r.after.charCodeAt(0),d,i);f.inside&&(c=c.slice(0,-1)+F_(d));let p=o.move(i+i);return a(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},s+c+p}function fv(e,t,n){return n.options.strong||`*`}function pv(e,t,n,r){return n.safe(e.value,r)}function mv(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 hv(e,t,n){let r=(rv(n)+(n.options.ruleSpaces?` `:``)).repeat(mv(n));return n.options.ruleSpaces?r.slice(0,-1):r}var gv={blockquote:S_,break:E_,code:A_,definition:N_,emphasis:L_,hardBreak:E_,heading:B_,html:V_,image:U_,imageReference:G_,inlineCode:q_,link:X_,linkReference:Q_,list:iv,listItem:ov,paragraph:sv,root:lv,strong:dv,text:pv,thematicBreak:hv};function _v(){return{enter:{table:vv,tableData:Sv,tableHeader:Sv,tableRow:bv},exit:{codeText:Cv,table:yv,tableData:xv,tableHeader:xv,tableRow:xv}}}function vv(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 yv(e){this.exit(e),this.data.inTable=void 0}function bv(e){this.enter({type:`tableRow`,children:[]},e)}function xv(e){this.exit(e)}function Sv(e){this.enter({type:`tableCell`,children:[]},e)}function Cv(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,wv));let n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function wv(e,t){return t===`|`?t:e}function Tv(e){let t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,a=n?` `:`|`;return{unsafe:[{character:`\r`,inConstruct:`tableCell`},{character:`
45
+ `,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(`
46
+ `))}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 y_(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=gv.inlineCode(e,t,n);return n.stack.includes(`tableCell`)&&(r=r.replace(/\|/g,`\\$&`)),r}}function Ev(){return{exit:{taskListCheckValueChecked:Ov,taskListCheckValueUnchecked:Ov,paragraph:kv}}}function Dv(){return{unsafe:[{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{listItem:Av}}}function Ov(e){let t=this.stack[this.stack.length-2];t.type,t.checked=e.type===`taskListCheckValueChecked`}function kv(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 Av(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=gv.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}}function jv(){return[Lg(),s_(),f_(),_v(),Ev()]}function Mv(e){return{extensions:[Rg(),c_(e),p_(),Tv(e),Dv()]}}var Nv={tokenize:qv,partial:!0},Pv={tokenize:Jv,partial:!0},Fv={tokenize:Yv,partial:!0},Iv={tokenize:Xv,partial:!0},Lv={tokenize:Zv,partial:!0},Rv={name:`wwwAutolink`,tokenize:Gv,previous:Qv},zv={name:`protocolAutolink`,tokenize:Kv,previous:$v},Bv={name:`emailAutolink`,tokenize:Wv,previous:ey},Vv={};function Hv(){return{text:Vv}}for(var Uv=48;Uv<123;)Vv[Uv]=Bv,Uv++,Uv===58?Uv=65:Uv===91&&(Uv=97);Vv[43]=Bv,Vv[45]=Bv,Vv[46]=Bv,Vv[95]=Bv,Vv[72]=[Bv,zv],Vv[104]=[Bv,zv],Vv[87]=[Bv,Rv],Vv[119]=[Bv,Rv];function Wv(e,t,n){let r=this,i,a;return o;function o(t){return!ty(t)||!ey.call(r,r.previous)||ny(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkEmail`),s(t))}function s(t){return ty(t)?(e.consume(t),s):t===64?(e.consume(t),c):n(t)}function c(t){return t===46?e.check(Lv,u,l)(t):t===45||t===95||Rd(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&&Ld(r.previous)?(e.exit(`literalAutolinkEmail`),e.exit(`literalAutolink`),t(o)):n(o)}}function Gv(e,t,n){let r=this;return i;function i(t){return t!==87&&t!==119||!Qv.call(r,r.previous)||ny(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkWww`),e.check(Nv,e.attempt(Pv,e.attempt(Fv,a),n),n)(t))}function a(n){return e.exit(`literalAutolinkWww`),e.exit(`literalAutolink`),t(n)}}function Kv(e,t,n){let r=this,i=``,a=!1;return o;function o(t){return(t===72||t===104)&&$v.call(r,r.previous)&&!ny(r.events)?(e.enter(`literalAutolink`),e.enter(`literalAutolinkHttp`),i+=String.fromCodePoint(t),e.consume(t),s):n(t)}function s(t){if(Ld(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||Bd(t)||Wd(t)||Kd(t)||Gd(t)?n(t):e.attempt(Pv,e.attempt(Fv,u),n)(t)}function u(n){return e.exit(`literalAutolinkHttp`),e.exit(`literalAutolink`),t(n)}}function qv(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 Jv(e,t,n){let r,i,a;return o;function o(t){return t===46||t===95?e.check(Iv,c,s)(t):t===null||Wd(t)||Kd(t)||t!==45&&Gd(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 Yv(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(Iv,t,a)(o):o===null||Wd(o)||Kd(o)?t(o):(e.consume(o),i)}function a(t){return t===41&&r++,e.consume(t),i}}function Xv(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||Wd(o)||Kd(o)?t(o):n(o)}function i(e){return e===null||e===40||e===91||Wd(e)||Kd(e)?t(e):r(e)}function a(e){return Ld(e)?o(e):n(e)}function o(t){return t===59?(e.consume(t),r):Ld(t)?(e.consume(t),o):n(t)}}function Zv(e,t,n){return r;function r(t){return e.consume(t),i}function i(e){return Rd(e)?n(e):t(e)}}function Qv(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Wd(e)}function $v(e){return!Ld(e)}function ey(e){return!(e===47||ty(e))}function ty(e){return e===43||e===45||e===46||e===95||Rd(e)}function ny(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 ry={tokenize:dy,partial:!0};function iy(){return{document:{91:{name:`gfmFootnoteDefinition`,tokenize:cy,continuation:{tokenize:ly},exit:uy}},text:{91:{name:`gfmFootnoteCall`,tokenize:sy},93:{name:`gfmPotentialFootnoteCall`,add:`after`,tokenize:ay,resolveTo:oy}}}}function ay(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=Id(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 oy(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 sy(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||Wd(s))return n(s);if(s===93){e.exit(`chunkString`);let a=e.exit(`gfmFootnoteCallString`);return i.includes(Id(r.sliceSerialize(a)))?(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(s),e.exit(`gfmFootnoteCallLabelMarker`),e.exit(`gfmFootnoteCall`),t):n(s)}return Wd(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 cy(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||Wd(t))return n(t);if(t===93){e.exit(`chunkString`);let n=e.exit(`gfmFootnoteDefinitionLabelString`);return a=Id(r.sliceSerialize(n)),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),e.exit(`gfmFootnoteDefinitionLabel`),f}return Wd(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),$(e,p,`gfmFootnoteDefinitionWhitespace`)):n(t)}function p(e){return t(e)}}function ly(e,t,n){return e.check(uf,t,e.attempt(ry,t,n))}function uy(e){e.exit(`gfmFootnoteDefinition`)}function dy(e,t,n){let r=this;return $(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 fy(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&&kd(o,o.length,0,nf(s,e.slice(r+1,n),t)),kd(o,o.length,0,[[`exit`,a,t],[`enter`,e[n][1],t],[`exit`,e[n][1],t],[`exit`,i,t]]),kd(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=tf(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=tf(a);return l._open=!u||u===2&&!!s,l._close=!s||s===2&&!!u,n(a)}}}var py=class{constructor(){this.map=[]}add(e,t,n){my(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 my(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 hy(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 gy(){return{flow:{null:{name:`table`,tokenize:_y,resolveAll:vy}}}}function _y(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):Z(t)?a>1?(a=0,r.interrupt=!0,e.exit(`tableRow`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),p):n(t):Q(t)?$(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||Wd(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,Q(t)?$(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 Q(t)?$(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||Z(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 Q(t)?$(e,b,`whitespace`)(t):b(t)}function b(n){return n===124?m(n):n===null||Z(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||Z(n)?(e.exit(`tableRow`),t(n)):Q(n)?$(e,C,`whitespace`)(n):(e.enter(`data`),w(n))}function w(t){return t===null||t===124||Wd(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 vy(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 py;for(;++n<e.length;){let p=e[n],m=p[1];p[0]===`enter`?m.type===`tableHead`?(s=!1,c!==0&&(by(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=yy(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=yy(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=yy(f,t,o,i,n,d)):(o[0]=o[1],d=yy(f,t,a,i,n,d)),i=0):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)&&(o[3]=n)}for(c!==0&&by(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=hy(t.events,n))}return e}function yy(e,t,n,r,i,a){let o=r===1?`tableHeader`:r===2?`tableDelimiter`:`tableData`;n[0]!==0&&(a.end=Object.assign({},xy(t.events,n[0])),e.add(n[0],0,[[`exit`,a,t]]));let s=xy(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=xy(t.events,n[2]),a=xy(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({},xy(t.events,i)),e.add(i,0,[[`exit`,a,t]]),a=void 0),a}function by(e,t,n,r,i){let a=[],o=xy(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 xy(e,t){let n=e[t],r=n[0]===`enter`?`start`:`end`;return n[1][r]}var Sy={name:`tasklistCheck`,tokenize:wy};function Cy(){return{text:{91:Sy}}}function wy(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 Wd(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 Z(r)?t(r):Q(r)?e.check({tokenize:Ty},t,n)(r):n(r)}}function Ty(e,t,n){return $(e,r,`whitespace`);function r(e){return e===null?n(e):t(e)}}function Ey(e){return Md([Hv(),iy(),fy(e),gy(),Cy()])}var Dy={};function Oy(e){let t=this,n=e||Dy,r=t.data(),i=r.micromarkExtensions||=[],a=r.fromMarkdownExtensions||=[],o=r.toMarkdownExtensions||=[];i.push(Ey(n)),a.push(jv()),o.push(Mv(n))}var ky=/[#.]/g;function Ay(e,t){let n=e||``,r={},i=0,a,o;for(;i<n.length;){ky.lastIndex=i;let e=ky.exec(n),t=n.slice(i,e?e.index:n.length);t&&(a?a===`#`?r.id=t:Array.isArray(r.className)?r.className.push(t):r.className=[t]:o=t,i+=t.length),e&&(a=e[0],i++)}return{type:`element`,tagName:o||t||`div`,properties:r,children:[]}}function jy(e,t,n){let r=n?Ly(n):void 0;function i(n,i,...a){let o;if(n==null){o={type:`root`,children:[]};let e=i;a.unshift(e)}else{o=Ay(n,t);let s=o.tagName.toLowerCase(),c=r?r.get(s):void 0;if(o.tagName=c||s,My(i))a.unshift(i);else for(let[t,n]of Object.entries(i))Ny(e,o.properties,t,n)}for(let e of a)Py(o.children,e);return o.type===`element`&&o.tagName===`template`&&(o.content={type:`root`,children:o.children},o.children=[]),o}return i}function My(e){if(typeof e!=`object`||!e||Array.isArray(e))return!0;if(typeof e.type!=`string`)return!1;let t=e,n=Object.keys(e);for(let e of n){let n=t[e];if(n&&typeof n==`object`){if(!Array.isArray(n))return!0;let e=n;for(let t of e)if(typeof t!=`number`&&typeof t!=`string`)return!0}}return!!(`children`in e&&Array.isArray(e.children))}function Ny(e,t,n,r){let i=Eu(e,n),a;if(r!=null){if(typeof r==`number`){if(Number.isNaN(r))return;a=r}else a=typeof r==`boolean`?r:typeof r==`string`?i.spaceSeparated?ju(r):i.commaSeparated?Wl(r):i.commaOrSpaceSeparated?ju(Wl(r).join(` `)):Fy(i,i.property,r):Array.isArray(r)?[...r]:i.property===`style`?Iy(r):String(r);if(Array.isArray(a)){let e=[];for(let t of a)e.push(Fy(i,i.property,t));a=e}i.property===`className`&&Array.isArray(t.className)&&(a=t.className.concat(a)),t[i.property]=a}}function Py(e,t){if(t!=null)if(typeof t==`number`||typeof t==`string`)e.push({type:`text`,value:String(t)});else if(Array.isArray(t))for(let n of t)Py(e,n);else if(typeof t==`object`&&`type`in t)t.type===`root`?Py(e,t.children):e.push(t);else throw Error("Expected node, nodes, or string, got `"+t+"`")}function Fy(e,t,n){if(typeof n==`string`){if(e.number&&n&&!Number.isNaN(Number(n)))return Number(n);if((e.boolean||e.overloadedBoolean)&&(n===``||tu(n)===tu(t)))return!0}return n}function Iy(e){let t=[];for(let[n,r]of Object.entries(e))t.push([n,r].join(`: `));return t.join(`; `)}function Ly(e){let t=new Map;for(let n of e)t.set(n.toLowerCase(),n);return t}var Ry=`altGlyph.altGlyphDef.altGlyphItem.animateColor.animateMotion.animateTransform.clipPath.feBlend.feColorMatrix.feComponentTransfer.feComposite.feConvolveMatrix.feDiffuseLighting.feDisplacementMap.feDistantLight.feDropShadow.feFlood.feFuncA.feFuncB.feFuncG.feFuncR.feGaussianBlur.feImage.feMerge.feMergeNode.feMorphology.feOffset.fePointLight.feSpecularLighting.feSpotLight.feTile.feTurbulence.foreignObject.glyphRef.linearGradient.radialGradient.solidColor.textArea.textPath`.split(`.`),zy=jy(ku,`div`);jy(Au,`g`,Ry);var By=`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(`.`),Vy={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 Hy(e){let t=typeof e==`string`?e.charCodeAt(0):e;return t>=48&&t<=57}function Uy(e){let t=typeof e==`string`?e.charCodeAt(0):e;return t>=97&&t<=102||t>=65&&t<=70||t>=48&&t<=57}function Wy(e){let t=typeof e==`string`?e.charCodeAt(0):e;return t>=97&&t<=122||t>=65&&t<=90}function Gy(e){return Wy(e)||Hy(e)}var Ky=[``,`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 qy(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`?Gy:u===`decimal`?Hy:Uy;for(l--;++l<=e.length;){let t=e.charCodeAt(l);if(!b(t))break;y+=String.fromCharCode(t),u===`named`&&By.includes(y)&&(_=y,v=Od(y))}let x=e.charCodeAt(l)===59;if(x){l++;let e=u===`named`?Od(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=``):Gy(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(Jy(e))h(7,S),C=`�`;else if(e in Vy)h(6,S),C=Vy[e];else{let t=``;Yy(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,Ky[e],r,e))}function g(){s&&=(i.push(s),n.text&&n.text.call(n.textContext||void 0,s,{start:f,end:m()}),``)}}function Jy(e){return e>=55296&&e<=57343||e>1114111}function Yy(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 Xy=0,Zy={},Qy={util:{type:function(e){return Object.prototype.toString.call(e).slice(8,-1)},objId:function(e){return e.__id||Object.defineProperty(e,`__id`,{value:++Xy}),e.__id},clone:function e(t,n){n||={};var r,i;switch(Qy.util.type(t)){case`Object`:if(i=Qy.util.objId(t),n[i])return n[i];for(var a in r={},n[i]=r,t)t.hasOwnProperty(a)&&(r[a]=e(t[a],n));return r;case`Array`:return i=Qy.util.objId(t),n[i]?n[i]:(r=[],n[i]=r,t.forEach(function(t,i){r[i]=e(t,n)}),r);default:return t}}},languages:{plain:Zy,plaintext:Zy,text:Zy,txt:Zy,extend:function(e,t){var n=Qy.util.clone(Qy.languages[e]);for(var r in t)n[r]=t[r];return n},insertBefore:function(e,t,n,r){r||=Qy.languages;var i=r[e],a={};for(var o in i)if(i.hasOwnProperty(o)){if(o==t)for(var s in n)n.hasOwnProperty(s)&&(a[s]=n[s]);n.hasOwnProperty(o)||(a[o]=i[o])}var c=r[e];return r[e]=a,Qy.languages.DFS(Qy.languages,function(t,n){n===c&&t!=e&&(this[t]=a)}),a},DFS:function e(t,n,r,i){i||={};var a=Qy.util.objId;for(var o in t)if(t.hasOwnProperty(o)){n.call(t,o,t[o],r||o);var s=t[o],c=Qy.util.type(s);c===`Object`&&!i[a(s)]?(i[a(s)]=!0,e(s,n,null,i)):c===`Array`&&!i[a(s)]&&(i[a(s)]=!0,e(s,n,o,i))}}},plugins:{},highlight:function(e,t,n){var r={code:e,grammar:t,language:n};if(Qy.hooks.run(`before-tokenize`,r),!r.grammar)throw Error(`The language "`+r.language+`" has no grammar.`);return r.tokens=Qy.tokenize(r.code,r.grammar),Qy.hooks.run(`after-tokenize`,r),$y.stringify(Qy.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 nb;return rb(i,i.head,e),tb(e,i,t,i.head,0),ab(i)},hooks:{all:{},add:function(e,t){var n=Qy.hooks.all;n[e]=n[e]||[],n[e].push(t)},run:function(e,t){var n=Qy.hooks.all[e];if(!(!n||!n.length))for(var r=0,i;i=n[r++];)i(t)}},Token:$y};function $y(e,t,n,r){this.type=e,this.content=t,this.alias=n,this.length=(r||``).length|0}function eb(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 tb(e,t,n,r,i,a){for(var o in n)if(!(!n.hasOwnProperty(o)||!n[o])){var s=n[o];s=Array.isArray(s)?s:[s];for(var c=0;c<s.length;++c){if(a&&a.cause==o+`,`+c)return;var l=s[c],u=l.inside,d=!!l.lookbehind,f=!!l.greedy,p=l.alias;if(f&&!l.pattern.global){var m=l.pattern.toString().match(/[imsuy]*$/)[0];l.pattern=RegExp(l.pattern.source,m+`g`)}for(var h=l.pattern||l,g=r.next,_=i;g!==t.tail&&!(a&&_>=a.reach);_+=g.value.length,g=g.next){var v=g.value;if(t.length>e.length)return;if(!(v instanceof $y)){var y=1,b;if(f){if(b=eb(h,_,e,d),!b||b.index>=e.length)break;var x=b.index,S=b.index+b[0].length,C=_;for(C+=g.value.length;x>=C;)g=g.next,C+=g.value.length;if(C-=g.value.length,_=C,g.value instanceof $y)continue;for(var w=g;w!==t.tail&&(C<S||typeof w.value==`string`);w=w.next)y++,C+=w.value.length;y--,v=e.slice(_,C),b.index-=_}else if(b=eb(h,0,v,d),!b)continue;var x=b.index,T=b[0],E=v.slice(0,x),D=v.slice(x+T.length),O=_+v.length;a&&O>a.reach&&(a.reach=O);var k=g.prev;E&&(k=rb(t,k,E),_+=E.length),ib(t,k,y);var A=new $y(o,u?Qy.tokenize(T,u):T,p,T);if(g=rb(t,k,A),D&&rb(t,g,D),y>1){var j={cause:o+`,`+c,reach:O};tb(e,t,n,g.prev,_,j),a&&j.reach>a.reach&&(a.reach=j.reach)}}}}}}function nb(){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 rb(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 ib(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 ab(e){for(var t=[],n=e.head.next;n!==e.tail;)t.push(n.value),n=n.next;return t}var ob=Qy;function sb(){}sb.prototype=ob;var cb=new sb;cb.highlight=lb,cb.register=ub,cb.alias=db,cb.registered=fb,cb.listLanguages=pb,cb.util.encode=hb,cb.Token.stringify=mb;function lb(e,t){if(typeof e!=`string`)throw TypeError("Expected `string` for `value`, got `"+e+"`");let n,r;if(t&&typeof t==`object`)n=t;else{if(r=t,typeof r!=`string`)throw TypeError("Expected `string` for `name`, got `"+r+"`");if(Object.hasOwn(cb.languages,r))n=cb.languages[r];else throw Error("Unknown language: `"+r+"` is not registered")}return{type:`root`,children:ob.highlight.call(cb,e,n,r)}}function ub(e){if(typeof e!=`function`||!e.displayName)throw Error("Expected `function` for `syntax`, got `"+e+"`");Object.hasOwn(cb.languages,e.displayName)||e(cb)}function db(e,t){let n=cb.languages,r={};typeof e==`string`?t&&(r[e]=t):r=e;let i;for(i in r)if(Object.hasOwn(r,i)){let e=r[i],t=typeof e==`string`?[e]:e,a=-1;for(;++a<t.length;)n[t[a]]=n[i]}}function fb(e){if(typeof e!=`string`)throw TypeError("Expected `string` for `aliasOrLanguage`, got `"+e+"`");return Object.hasOwn(cb.languages,e)}function pb(){let e=cb.languages,t=[],n;for(n in e)Object.hasOwn(e,n)&&typeof e[n]==`object`&&t.push(n);return t}function mb(e,t){if(typeof e==`string`)return{type:`text`,value:e};if(Array.isArray(e)){let n=[],r=-1;for(;++r<e.length;)e[r]!==null&&e[r]!==void 0&&e[r]!==``&&n.push(mb(e[r],t));return n}let n={attributes:{},classes:[`token`,e.type],content:mb(e.content,t),language:t,tag:`span`,type:e.type};return e.alias&&n.classes.push(...typeof e.alias==`string`?[e.alias]:e.alias),cb.hooks.run(`wrap`,n),zy(n.tag+`.`+n.classes.join(`.`),gb(n.attributes),n.content)}function hb(e){return e}function gb(e){let t;for(t in e)Object.hasOwn(e,t)&&(e[t]=qy(e[t]));return e}_b.displayName=`clike`,_b.aliases=[];function _b(e){e.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:/[{}[\];(),.:]/}}vb.displayName=`javascript`,vb.aliases=[`js`];function vb(e){e.register(_b),e.languages.javascript=e.languages.extend(`clike`,{"class-name":[e.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}|\?\?=?|\?\.?|[~:]/}),e.languages.javascript[`class-name`][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,e.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:e.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:e.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:e.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:e.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:e.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),e.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:e.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`}}),e.languages.insertBefore(`javascript`,`operator`,{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:`property`}}),e.languages.markup&&(e.languages.markup.tag.addInlined(`script`,`javascript`),e.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`)),e.languages.js=e.languages.javascript}yb.displayName=`markup`,yb.aliases=[`atom`,`html`,`mathml`,`rss`,`ssml`,`svg`,`xml`];function yb(e){e.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]},e.languages.markup.tag.inside[`attr-value`].inside.entity=e.languages.markup.entity,e.languages.markup.doctype.inside[`internal-subset`].inside=e.languages.markup,e.hooks.add(`wrap`,function(e){e.type===`entity`&&(e.attributes.title=e.content.value.replace(/&amp;/,`&`))}),Object.defineProperty(e.languages.markup.tag,`addInlined`,{value:function(t,n){var r={};r[`language-`+n]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:e.languages[n]},r.cdata=/^<!\[CDATA\[|\]\]>$/i;var i={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:r}};i[`language-`+n]={pattern:/[\s\S]+/,inside:e.languages[n]};var a={};a[t]={pattern:RegExp(`(<__[^>]*>)(?:<!\\[CDATA\\[(?:[^\\]]|\\](?!\\]>))*\\]\\]>|(?!<!\\[CDATA\\[)[\\s\\S])*?(?=<\\/__>)`.replace(/__/g,function(){return t}),`i`),lookbehind:!0,greedy:!0,inside:i},e.languages.insertBefore(`markup`,`cdata`,a)}}),Object.defineProperty(e.languages.markup.tag,`addAttribute`,{value:function(t,n){e.languages.markup.tag.inside[`special-attr`].push({pattern:RegExp(`(^|["'\\s])(?:`+t+`)\\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:[n,`language-`+n],inside:e.languages[n]},punctuation:[{pattern:/^=/,alias:`attr-equals`},/"|'/]}}}})}}),e.languages.html=e.languages.markup,e.languages.mathml=e.languages.markup,e.languages.svg=e.languages.markup,e.languages.xml=e.languages.extend(`markup`,{}),e.languages.ssml=e.languages.xml,e.languages.atom=e.languages.xml,e.languages.rss=e.languages.xml}bb.displayName=`jsx`,bb.aliases=[];function bb(e){e.register(vb),e.register(yb),(function(e){var t=e.util.clone(e.languages.javascript),n=`(?:\\s|\\/\\/.*(?!.)|\\/\\*(?:[^*]|\\*(?!\\/))\\*\\/)`,r=`(?:\\{(?:\\{(?:\\{[^{}]*\\}|[^{}])*\\}|[^{}])*\\})`,i=`(?:\\{<S>*\\.{3}(?:[^{}]|<BRACES>)*\\})`;function a(e,t){return e=e.replace(/<S>/g,function(){return n}).replace(/<BRACES>/g,function(){return r}).replace(/<SPREAD>/g,function(){return i}),RegExp(e,t)}i=a(i).source,e.languages.jsx=e.languages.extend(`markup`,t),e.languages.jsx.tag.pattern=a(`<\\/?(?:[\\w.:-]+(?:<S>+(?:[\\w.:$-]+(?:=(?:"(?:\\\\[\\s\\S]|[^\\\\"])*"|'(?:\\\\[\\s\\S]|[^\\\\'])*'|[^\\s{'"/>=]+|<BRACES>))?|<SPREAD>))*<S>*\\/?)?>`),e.languages.jsx.tag.inside.tag.pattern=/^<\/?[^\s>\/]*/,e.languages.jsx.tag.inside[`attr-value`].pattern=/=(?!\{)(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s'">]+)/,e.languages.jsx.tag.inside.tag.inside[`class-name`]=/^[A-Z]\w*(?:\.[A-Z]\w*)*$/,e.languages.jsx.tag.inside.comment=t.comment,e.languages.insertBefore(`inside`,`attr-name`,{spread:{pattern:a(`<SPREAD>`),inside:e.languages.jsx}},e.languages.jsx.tag),e.languages.insertBefore(`inside`,`special-attr`,{script:{pattern:a(`=<BRACES>`),alias:`language-javascript`,inside:{"script-punctuation":{pattern:/^=(?=\{)/,alias:`punctuation`},rest:e.languages.jsx}}},e.languages.jsx.tag);var o=function(e){return e?typeof e==`string`?e:typeof e.content==`string`?e.content:e.content.map(o).join(``):``},s=function(t){for(var n=[],r=0;r<t.length;r++){var i=t[r],a=!1;if(typeof i!=`string`&&(i.type===`tag`&&i.content[0]&&i.content[0].type===`tag`?i.content[0].content[0].content===`</`?n.length>0&&n[n.length-1].tagName===o(i.content[0].content[1])&&n.pop():i.content[i.content.length-1].content===`/>`||n.push({tagName:o(i.content[0].content[1]),openedBraces:0}):n.length>0&&i.type===`punctuation`&&i.content===`{`?n[n.length-1].openedBraces++:n.length>0&&n[n.length-1].openedBraces>0&&i.type===`punctuation`&&i.content===`}`?n[n.length-1].openedBraces--:a=!0),(a||typeof i==`string`)&&n.length>0&&n[n.length-1].openedBraces===0){var c=o(i);r<t.length-1&&(typeof t[r+1]==`string`||t[r+1].type===`plain-text`)&&(c+=o(t[r+1]),t.splice(r+1,1)),r>0&&(typeof t[r-1]==`string`||t[r-1].type===`plain-text`)&&(c=o(t[r-1])+c,t.splice(r-1,1),r--),t[r]=new e.Token(`plain-text`,c,null,c)}i.content&&typeof i.content!=`string`&&s(i.content)}};e.hooks.add(`after-tokenize`,function(e){e.language!==`jsx`&&e.language!==`tsx`||s(e.tokens)})})(e)}xb.displayName=`typescript`,xb.aliases=[`ts`];function xb(e){e.register(vb),(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})(e)}Sb.displayName=`tsx`,Sb.aliases=[];function Sb(e){e.register(bb),e.register(xb),(function(e){var t=e.util.clone(e.languages.typescript);e.languages.tsx=e.languages.extend(`jsx`,t),delete e.languages.tsx.parameter,delete e.languages.tsx[`literal-property`];var n=e.languages.tsx.tag;n.pattern=RegExp(`(^|[^\\w$]|(?=<\\/))(?:`+n.pattern.source+`)`,n.pattern.flags),n.lookbehind=!0})(e)}Cb.displayName=`json`,Cb.aliases=[`webmanifest`];function Cb(e){e.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`}},e.languages.webmanifest=e.languages.json}wb.displayName=`bash`,wb.aliases=[`sh`,`shell`];function wb(e){(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})(e)}Tb.displayName=`python`,Tb.aliases=[`py`];function Tb(e){e.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:/[{}[\];(),.:]/},e.languages.python[`string-interpolation`].inside.interpolation.inside.rest=e.languages.python,e.languages.py=e.languages.python}Eb.displayName=`css`,Eb.aliases=[];function Eb(e){(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`))})(e)}Db.displayName=`diff`,Db.aliases=[];function Db(e){(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
47
+ ?|
48
+ |(?![\\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})})(e)}Ob.displayName=`markdown`,Ob.aliases=[`md`];function Ob(e){e.register(yb),(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(t.content.value,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))})}}}),RegExp(e.languages.markup.tag.pattern.source,`gi`),String.fromCodePoint||String.fromCharCode,e.languages.md=e.languages.markdown})(e)}kb.displayName=`yaml`,kb.aliases=[`yml`];function kb(e){(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})(e)}function Ab(){let[e,t]=(0,_.useState)(!1),n=(0,_.useRef)(null),r=(0,_.useRef)(!0);return(0,_.useEffect)(()=>()=>{r.current=!1,n.current!=null&&window.clearTimeout(n.current)},[]),{copied:e,copy:(0,_.useCallback)(e=>{let i=()=>{r.current&&(t(!0),n.current!=null&&window.clearTimeout(n.current),n.current=window.setTimeout(()=>{t(!1),n.current=null},1100))};if(navigator.clipboard?.writeText){navigator.clipboard.writeText(e).then(i).catch(()=>{});return}try{let t=document.createElement(`textarea`);t.value=e,t.style.position=`fixed`,t.style.opacity=`0`,document.body.appendChild(t),t.select(),document.execCommand(`copy`),document.body.removeChild(t),i()}catch{}},[])}}function jb({children:e,...t}){return(0,H.jsx)(`svg`,{className:`conv-ico`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,...t,children:e})}function Mb(){return(0,H.jsx)(jb,{children:(0,H.jsx)(`path`,{d:`M9 18h6M10 22h4M12 2a7 7 0 0 0-4 12.7c.6.5 1 1.3 1 2.1h6c0-.8.4-1.6 1-2.1A7 7 0 0 0 12 2Z`})})}function Nb(){return(0,H.jsxs)(jb,{children:[(0,H.jsx)(`path`,{d:`M3 7l9-4 9 4-9 4-9-4Z`}),(0,H.jsx)(`path`,{d:`M3 7v10l9 4 9-4V7`})]})}function Pb(){return(0,H.jsxs)(jb,{children:[(0,H.jsx)(`circle`,{cx:`12`,cy:`7`,r:`3`}),(0,H.jsx)(`path`,{d:`M5.5 21a6.5 6.5 0 0 1 13 0`}),(0,H.jsx)(`path`,{d:`M19 8.5 21 7M19 11l2.4.6`})]})}function Fb(){return(0,H.jsx)(jb,{children:(0,H.jsx)(`path`,{d:`M4 6h16M4 12h16M4 18h10`})})}function Ib(){return(0,H.jsx)(jb,{children:(0,H.jsx)(`path`,{d:`M15.5 3.5a2 2 0 1 0-3.9.5H8a1 1 0 0 0-1 1v3.6a2 2 0 1 1 0 3.8V19a1 1 0 0 0 1 1h3.6a2 2 0 1 0 3.8 0H19a1 1 0 0 0 1-1v-3.6a2 2 0 1 1 0-3.8V5a1 1 0 0 0-1-1h-3.5Z`})})}function Lb(){return(0,H.jsxs)(jb,{children:[(0,H.jsx)(`path`,{d:`M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h6`}),(0,H.jsx)(`path`,{d:`M14 3v5h5`}),(0,H.jsx)(`circle`,{cx:`16.5`,cy:`16.5`,r:`3`}),(0,H.jsx)(`path`,{d:`M21 21l-2.1-2.1`})]})}function Rb(){return(0,H.jsxs)(jb,{children:[(0,H.jsx)(`path`,{d:`M12 20h9`}),(0,H.jsx)(`path`,{d:`M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4Z`})]})}function zb(){return(0,H.jsxs)(jb,{children:[(0,H.jsx)(`path`,{d:`M4 6l5 6-5 6`}),(0,H.jsx)(`path`,{d:`M12 18h8`})]})}function Bb(){return(0,H.jsxs)(jb,{children:[(0,H.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,H.jsx)(`path`,{d:`M3 12h18M12 3c2.5 2.5 2.5 15.5 0 18M12 3c-2.5 2.5-2.5 15.5 0 18`})]})}function Vb(){return(0,H.jsxs)(jb,{children:[(0,H.jsx)(`path`,{d:`M9 6h11M9 12h11M9 18h11`}),(0,H.jsx)(`path`,{d:`M4 6l1 1 2-2M4 12l1 1 2-2M4 18l1 1 2-2`})]})}function Hb(){return(0,H.jsxs)(jb,{children:[(0,H.jsx)(`path`,{d:`M4 14v4a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-4`}),(0,H.jsx)(`path`,{d:`M12 3v11M8 10l4 4 4-4`})]})}function Ub(){return(0,H.jsxs)(jb,{children:[(0,H.jsx)(`path`,{d:`M9 10l-5 5 5 5`}),(0,H.jsx)(`path`,{d:`M4 15h11a5 5 0 0 0 5-5V4`})]})}function Wb(){return(0,H.jsxs)(jb,{children:[(0,H.jsx)(`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`}),(0,H.jsx)(`circle`,{cx:`8.5`,cy:`8.5`,r:`1.5`}),(0,H.jsx)(`path`,{d:`M21 15l-5-5L5 21`})]})}function Gb(){return(0,H.jsxs)(jb,{children:[(0,H.jsx)(`path`,{d:`M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8Z`}),(0,H.jsx)(`path`,{d:`M14 3v5h5`})]})}function Kb(){return(0,H.jsxs)(jb,{children:[(0,H.jsx)(`rect`,{x:`9`,y:`9`,width:`11`,height:`11`,rx:`2`}),(0,H.jsx)(`path`,{d:`M5 15V5a2 2 0 0 1 2-2h8`})]})}function qb(){return(0,H.jsx)(jb,{children:(0,H.jsx)(`path`,{d:`M5 13l4 4 10-10`})})}function Jb(){return(0,H.jsx)(jb,{children:(0,H.jsx)(`path`,{d:`M6 4h12M6 20h12M8 4c0 4 8 6 8 8s-8 4-8 8M16 4c0 4-8 6-8 8`})})}function Yb(){return(0,H.jsxs)(jb,{children:[(0,H.jsx)(`path`,{d:`M12 3l9 16H3Z`}),(0,H.jsx)(`path`,{d:`M12 9v5M12 17v.5`})]})}function Xb(){return(0,H.jsx)(jb,{children:(0,H.jsx)(`path`,{d:`M21 12a8 8 0 0 1-11.6 7.1L3 21l1.9-6.4A8 8 0 1 1 21 12Z`})})}function Zb(e){let t=(e??``).toLowerCase();return t===`read`||t===`grep`||t===`glob`||t===`ls`?(0,H.jsx)(Lb,{}):t===`edit`||t===`write`||t===`notebookedit`||t===`multiedit`?(0,H.jsx)(Rb,{}):t===`bash`?(0,H.jsx)(zb,{}):t===`task`||t===`agent`?(0,H.jsx)(Pb,{}):t===`skill`?(0,H.jsx)(Ib,{}):t===`webfetch`||t===`websearch`?(0,H.jsx)(Bb,{}):t===`todowrite`||t===`taskcreate`?(0,H.jsx)(Vb,{}):(0,H.jsx)(Nb,{})}function Qb({text:e,className:t}){let{copied:n,copy:r}=Ab();return(0,H.jsx)(`button`,{type:`button`,className:`conv-copy-btn ${t??``}`.trim(),"aria-label":n?`Copied`:`Copy`,onClick:t=>{t.stopPropagation(),r(e)},children:n?(0,H.jsx)(qb,{}):(0,H.jsx)(Kb,{})})}[xb,Sb,vb,bb,Cb,wb,Tb,Eb,Db,Ob,kb].forEach(e=>cb.register(e));var $b={ts:`typescript`,js:`javascript`,sh:`bash`,shell:`bash`,yml:`yaml`,py:`python`};function ex(e){let t=$b[e]??e;return cb.registered(t)}function tx(e,t){let n=$b[t]??t;if(cb.registered(n))try{return $u(cb.highlight(e,n),{Fragment:H.Fragment,jsx:H.jsx,jsxs:H.jsxs})}catch{return e}return e}function nx({lang:e,filename:t,code:n}){return(0,H.jsxs)(`div`,{className:`codeblock`,children:[(0,H.jsxs)(`div`,{className:`cb-head`,children:[(0,H.jsx)(`span`,{className:`cb-lang`,children:e}),t&&(0,H.jsx)(`span`,{className:`cb-file`,children:t}),(0,H.jsx)(Qb,{text:n,className:`cb-copy`})]}),(0,H.jsx)(`pre`,{className:`conv-code conv-code--hl`,children:tx(n,e)})]})}function rx({href:e,children:t,...n}){return(0,H.jsx)(`a`,{...n,href:e,target:`_blank`,rel:`noopener noreferrer`,children:t})}function ix(e){return(e?.children??[]).map(e=>e.type===`text`?e.value:``).join(``)}function ax({node:e,children:t}){let n=e?.children?.find(e=>e.type===`element`&&e.tagName===`code`),r=n?.properties?.className,i=Array.isArray(r)?r.join(` `):String(r??``),a=/language-(\w+)/.exec(i)?.[1];return a&&ex(a)?(0,H.jsx)(nx,{lang:a,filename:void 0,code:ix(n)}):(0,H.jsx)(`pre`,{className:`conv-code`,children:t})}function ox({children:e}){return(0,H.jsx)(`div`,{className:`md`,children:(0,H.jsx)(wg,{remarkPlugins:[Oy],components:{a:rx,pre:ax},children:e})})}function sx(e){return e.split(`
49
+ `).map(e=>{let t=/^\s*(\d+)\t(.*)$/.exec(e);return t?{num:t[1],content:t[2]}:{num:``,content:e}})}function cx({code:e,lang:t}){let n=sx(e);if(!n.some(e=>e.num))return(0,H.jsx)(`pre`,{className:`conv-code conv-code--result`,children:e});let r=n.map(e=>e.content).join(`
50
+ `);return(0,H.jsxs)(`div`,{className:`conv-code--numbered`,children:[(0,H.jsx)(`span`,{className:`cb-gutter`,"aria-hidden":`true`,children:n.map(e=>e.num).join(`
51
+ `)}),(0,H.jsx)(`pre`,{className:`conv-code conv-code--hl`,children:tx(r,t)})]})}var lx={py:`python`,ts:`typescript`,tsx:`tsx`,js:`javascript`,mjs:`javascript`,cjs:`javascript`,jsx:`jsx`,json:`json`,sh:`bash`,bash:`bash`,zsh:`bash`,css:`css`,md:`markdown`,markdown:`markdown`,yaml:`yaml`,yml:`yaml`,diff:`diff`,patch:`diff`};function ux(e){let t=e.split(`/`).pop()??e,n=t.lastIndexOf(`.`);return n<=0?``:lx[t.slice(n+1).toLowerCase()]??``}function dx(e,t){return e===`Read`?ux(t):``}function fx({blocks:e}){let t=[],n=0,r=[],i=()=>{r.length&&(t.push((0,H.jsx)(ox,{children:r.join(`
52
+
53
+ `)},`t${t.length}`)),r=[])};for(;n<e.length;){let a=e[n];if(a.kind===`text`){r.push(a.text),n++;continue}if(i(),a.kind===`tool_call`){let r=[];for(;n<e.length&&e[n].kind===`tool_call`;)r.push(e[n]),n++;t.push((0,H.jsx)(px,{calls:r},`r${t.length}`));continue}t.push((0,H.jsx)(_x,{block:a},`c${t.length}`)),n++}return i(),t.length===0?null:(0,H.jsx)(`div`,{className:`conv-blocks`,children:t})}function px({calls:e}){return(0,H.jsxs)(`div`,{className:`conv-toolrun`,children:[e.length>=2&&(0,H.jsxs)(`div`,{className:`conv-toolrun-head`,children:[`tool run · `,e.length,` actions`]}),e.map((e,t)=>(0,H.jsx)(hx,{call:e},t))]})}function mx({result:e,name:t,preview:n}){let r=t===`Read`&&!e.is_error?dx(`Read`,n):``;return r?(0,H.jsx)(cx,{code:e.text,lang:r}):(0,H.jsx)(`pre`,{className:`conv-code conv-code--result`,children:e.text})}function hx({call:e}){let t=e.result?.is_error?` · error`:e.result?.truncated?` · truncated`:``;return(0,H.jsxs)(`details`,{className:`conv-chip conv-chip--tool`,children:[(0,H.jsxs)(`summary`,{children:[(0,H.jsx)(`span`,{className:`conv-chev`,"aria-hidden":`true`}),Zb(e.name),` `,(0,H.jsx)(`span`,{className:`conv-chip-name`,children:e.name??`tool`}),(0,H.jsx)(`span`,{className:`conv-chip-preview`,children:e.preview}),t&&(0,H.jsx)(`span`,{className:`conv-chip-status`,children:t})]}),(0,H.jsxs)(`div`,{className:`conv-chip-body conv-chip-body--io`,children:[(0,H.jsxs)(`div`,{className:`conv-tool-io`,children:[(0,H.jsx)(`div`,{className:`conv-tool-io-label`,children:`request`}),(0,H.jsx)(Qb,{text:e.input_summary}),(0,H.jsx)(`pre`,{className:`conv-code conv-code--hl`,children:tx(e.input_summary,`json`)})]}),e.result?(0,H.jsxs)(`div`,{className:`conv-tool-io`,children:[(0,H.jsxs)(`div`,{className:`conv-tool-io-label`,children:[`result`,e.result.is_error?` · error`:` · ok`,e.result.truncated?` · truncated`:``]}),(0,H.jsx)(Qb,{text:e.result.text}),(0,H.jsx)(mx,{result:e.result,name:e.name,preview:e.preview})]}):(0,H.jsx)(`div`,{className:`conv-tool-io`,children:(0,H.jsx)(`div`,{className:`conv-tool-io-label conv-tool-io-label--none`,children:`no result`})})]})]})}function gx(e){let t=e.split(`
54
+ `).map(e=>e.trim()).find(e=>e.length>0)??``;return t.length>80?`${t.slice(0,80).trimEnd()}…`:t}function _x({block:e}){switch(e.kind){case`thinking`:return(0,H.jsxs)(`details`,{className:`conv-chip conv-chip--thinking`,children:[(0,H.jsxs)(`summary`,{children:[(0,H.jsx)(`span`,{className:`conv-chev`,"aria-hidden":`true`}),(0,H.jsx)(Mb,{}),` `,(0,H.jsx)(`span`,{className:`conv-chip-name`,children:`Thinking`}),(0,H.jsx)(`span`,{className:`conv-chip-preview`,children:gx(e.text)})]}),(0,H.jsx)(`div`,{className:`conv-chip-body`,children:(0,H.jsx)(ox,{children:e.text})})]});case`tool_use`:return(0,H.jsxs)(`details`,{className:`conv-chip conv-chip--tool`,children:[(0,H.jsxs)(`summary`,{children:[(0,H.jsx)(`span`,{className:`conv-chev`,"aria-hidden":`true`}),Zb(e.name),` `,(0,H.jsx)(`span`,{className:`conv-chip-name`,children:e.name??`tool`})]}),(0,H.jsxs)(`div`,{className:`conv-chip-body conv-tool-io`,children:[(0,H.jsx)(Qb,{text:e.input_summary}),(0,H.jsx)(`pre`,{className:`conv-code`,children:e.input_summary})]})]});case`tool_result`:return(0,H.jsxs)(`details`,{className:`conv-chip conv-chip--result`,children:[(0,H.jsxs)(`summary`,{children:[(0,H.jsx)(`span`,{className:`conv-chev`,"aria-hidden":`true`}),(0,H.jsx)(Hb,{}),` `,(0,H.jsx)(`span`,{className:`conv-chip-name`,children:`Result`}),(0,H.jsx)(`span`,{className:`conv-chip-preview`,children:gx(e.text)}),e.is_error&&(0,H.jsx)(`span`,{className:`conv-chip-status`,children:` · error`}),e.truncated&&(0,H.jsx)(`span`,{className:`conv-chip-status`,children:` · truncated`})]}),(0,H.jsxs)(`div`,{className:`conv-chip-body conv-tool-io`,children:[(0,H.jsx)(Qb,{text:e.text}),(0,H.jsx)(`pre`,{className:`conv-code`,children:e.text})]})]});case`image`:return(0,H.jsxs)(`span`,{className:`conv-chip conv-chip--media`,children:[(0,H.jsx)(Wb,{}),` `,e.media_type??`image`,` · `,e.bytes,` B`]});case`document`:return(0,H.jsxs)(`span`,{className:`conv-chip conv-chip--media`,children:[(0,H.jsx)(Gb,{}),` `,e.media_type??`document`,` · `,e.bytes,` B`]});case`tool_reference`:return(0,H.jsxs)(`span`,{className:`conv-chip conv-chip--ref`,children:[(0,H.jsx)(Ub,{}),` `,e.name??`tool`]});default:return null}}function vx(e){let t=e.split(`
55
+ `).map(e=>e.trim()).find(e=>e.length>0)??``;return t.length>80?`${t.slice(0,80).trimEnd()}…`:t}function yx({item:e,className:t=``,style:n},r){let i=e=>`conv-item ${e}${t?` ${t}`:``}`;if(e.kind===`tool_result`)return(0,H.jsx)(`div`,{ref:r,className:i(`conv-item--tool_result`),style:n,"data-uuid":e.anchor.uuid,children:(0,H.jsxs)(`details`,{className:`conv-chip conv-chip--result`,children:[(0,H.jsxs)(`summary`,{children:[(0,H.jsx)(`span`,{className:`conv-chev`,"aria-hidden":`true`}),(0,H.jsx)(Hb,{}),` Tool result`]}),(0,H.jsx)(`div`,{className:`conv-chip-body`,children:(0,H.jsx)(fx,{blocks:e.blocks})})]})});if(e.kind===`assistant`){let t=typeof e.cost_usd==`number`&&e.cost_usd>0;return(0,H.jsxs)(`div`,{ref:r,className:i(`conv-item--assistant`),style:n,"data-uuid":e.anchor.uuid,children:[(0,H.jsxs)(`div`,{className:`conv-item-head`,children:[(0,H.jsx)(`span`,{className:`conv-item-label`,children:`Assistant`}),(0,H.jsx)(`span`,{className:`conv-item-model`,children:e.model??`—`})]}),(0,H.jsx)(fx,{blocks:e.blocks}),e.text&&(0,H.jsx)(`div`,{className:`conv-item-actions`,children:(0,H.jsx)(Qb,{text:e.text})}),t&&(0,H.jsxs)(`div`,{className:`conv-item-cost`,children:[`$`,e.cost_usd.toFixed(4)]})]})}if(e.kind===`meta`){let t=e.meta_kind,a=t===`skill`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Ib,{}),` `,(0,H.jsx)(`span`,{className:`conv-meta-label`,children:`Skill content`}),e.skill_name&&(0,H.jsxs)(`span`,{className:`conv-meta-name`,children:[`· `,e.skill_name]})]}):t===`command`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Fb,{}),` `,(0,H.jsx)(`span`,{className:`conv-meta-label`,children:`System marker`})]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Fb,{}),` `,(0,H.jsx)(`span`,{className:`conv-meta-label`,children:`Injected context`}),(0,H.jsx)(`span`,{className:`conv-meta-preview`,children:vx(e.text)})]});return(0,H.jsx)(`div`,{ref:r,className:i(`conv-item--meta`),style:n,"data-uuid":e.anchor.uuid,children:(0,H.jsxs)(`details`,{className:`conv-meta conv-meta--${t}`,children:[(0,H.jsxs)(`summary`,{children:[(0,H.jsx)(`span`,{className:`conv-chev`,"aria-hidden":`true`}),a]}),t===`command`?(0,H.jsx)(`pre`,{className:`conv-meta-body conv-meta-body--pre`,children:e.text}):(0,H.jsxs)(`div`,{className:`conv-meta-body`,children:[(0,H.jsx)(fx,{blocks:e.blocks}),t===`skill`&&e.text&&(0,H.jsx)(`div`,{className:`conv-item-actions`,children:(0,H.jsx)(Qb,{text:e.text})})]})]})})}return Ul(e.text)&&e.blocks.every(e=>e.kind===`text`)?(0,H.jsx)(`div`,{ref:r,className:i(`conv-item--system`),style:n,"data-uuid":e.anchor.uuid,children:(0,H.jsxs)(`details`,{className:`conv-system-marker`,children:[(0,H.jsxs)(`summary`,{children:[(0,H.jsx)(`span`,{className:`conv-chev`,"aria-hidden":`true`}),(0,H.jsx)(Fb,{}),` System marker`]}),(0,H.jsx)(`pre`,{className:`conv-system-marker-body`,children:e.text})]})}):(0,H.jsxs)(`div`,{ref:r,className:i(`conv-item--human`),style:n,"data-uuid":e.anchor.uuid,children:[(0,H.jsx)(`div`,{className:`conv-item-head`,children:(0,H.jsx)(`span`,{className:`conv-item-label`,children:`You`})}),e.text&&(0,H.jsx)(ox,{children:e.text}),(0,H.jsx)(fx,{blocks:e.blocks.filter(e=>e.kind!==`text`)}),e.text&&(0,H.jsx)(`div`,{className:`conv-item-actions`,children:(0,H.jsx)(Qb,{text:e.text})})]})}var bx=(0,_.memo)((0,_.forwardRef)(yx)),xx=60;function Sx(e){return e==null?null:e===`completed`?(0,H.jsx)(`span`,{className:`conv-subagent-ok`,"aria-label":`completed`,title:`completed`,children:`✓`}):e===`error`?(0,H.jsxs)(`span`,{className:`conv-subagent-err`,children:[(0,H.jsx)(`span`,{"aria-hidden":`true`,children:`✕`}),` error`]}):(0,H.jsxs)(`span`,{className:`conv-subagent-warn`,children:[(0,H.jsx)(`span`,{"aria-hidden":`true`,children:`⚠`}),` `,e]})}function Cx(e,t){let n=((e.find(e=>e.kind!==`meta`)??e[0])?.text??``).split(`
56
+ `).map(e=>e.trim()).find(e=>e.length>0)??``;return n?n.length>xx?`${n.slice(0,xx).trimEnd()}…`:n:`Subagent ${t}`}function wx({subagentKey:e,items:t,nested:n,meta:r,getItemRef:i,forceOpen:a=!1,riseClassName:o=``,riseStyle:s}){let[c,l]=(0,_.useState)(!1),u=c||a;(0,_.useEffect)(()=>{a&&l(!0)},[a]);let d=Cx(t,e),f=t.reduce((e,t)=>e+(`cost_usd`in t?t.cost_usd??0:0),0),p=[...new Set(t.map(e=>`model`in e?e.model:null).filter(Boolean))];return(0,H.jsxs)(`details`,{className:[n?`conv-sidechain conv-sidechain--nested`:`conv-sidechain`,a?`conv-sidechain--force`:``,o].filter(Boolean).join(` `),style:s,open:u,onToggle:e=>l(e.currentTarget.open),children:[(0,H.jsxs)(`summary`,{className:`conv-sidechain-head`,children:[(0,H.jsx)(`span`,{className:`conv-sidechain-glyph`,"aria-hidden":`true`,children:(0,H.jsx)(Pb,{})}),(0,H.jsxs)(`span`,{className:`conv-sidechain-headtext`,children:[(0,H.jsxs)(`span`,{className:`conv-sidechain-kind`,children:[`Subagent`,r?.kind?(0,H.jsxs)(`span`,{className:`conv-sidechain-kindname`,children:[` · `,r.kind]}):null]}),(0,H.jsx)(`span`,{className:`conv-sidechain-title`,children:d}),r&&(r.total_tokens!=null||r.total_duration_ms!=null||r.total_tool_use_count!=null||r.status!=null)&&(0,H.jsxs)(`span`,{className:`conv-sidechain-submeta`,children:[r.total_tokens!=null&&(0,H.jsxs)(`span`,{children:[A.compact(r.total_tokens),` tok`]}),r.total_duration_ms!=null&&(0,H.jsx)(`span`,{children:A.durationMs(r.total_duration_ms)}),r.total_tool_use_count!=null&&(0,H.jsxs)(`span`,{children:[r.total_tool_use_count,` `,r.total_tool_use_count===1?`tool`:`tools`]}),Sx(r.status)]})]}),(0,H.jsxs)(`span`,{className:`conv-sidechain-meta`,children:[p.length>0&&(0,H.jsx)(`span`,{className:`conv-sidechain-model`,children:p.join(`, `)}),(0,H.jsxs)(`span`,{children:[t.length,` msgs`]}),(0,H.jsx)(`span`,{className:`conv-sidechain-cost`,children:A.usd2(f)}),(0,H.jsx)(`span`,{className:`conv-chev`,"aria-hidden":`true`})]})]}),(0,H.jsx)(`div`,{className:`conv-sidechain-body`,children:t.map(e=>(0,H.jsx)(bx,{item:e,ref:u&&i?i(e):void 0},e.anchor.uuid))})]})}function Tx(e){for(let t of e.items)if(t.kind===`human`&&!t.is_sidechain&&t.text.trim()&&!Ul(t.text)){let e=t.text.split(`
57
+ `).map(e=>e.trim()).find(Boolean);if(e)return e.length>120?e.slice(0,120).trimEnd()+`…`:e}return e.project_label||e.session_id}function Ex({sessionId:e,mobileBack:t}){let{detail:n,loading:r,error:i,hasMore:a,loadMore:o,loadUntil:s}=zl(e),c=(0,_.useSyncExternalStore)(B,()=>z().conversationJump),l=jo(),u=(0,_.useRef)(null),d=(0,_.useRef)(new Map),f=(0,_.useRef)(new Map),p=(0,_.useRef)(null),[m,h]=(0,_.useState)(null),g=(0,_.useRef)(new Set),[v,y]=(0,_.useState)(0),b=(0,_.useRef)(0);b.current=v;let x=(0,_.useRef)(null),S=(0,_.useRef)(null),C=(0,_.useRef)(a);C.current=a;let w=(0,_.useRef)(o);w.current=o;let T=(0,_.useRef)(l);T.current=l;let E=(0,_.useMemo)(()=>Vl(n?.items??[]),[n?.items]),D=(0,_.useMemo)(()=>n?Tx(n):``,[n]);(0,_.useEffect)(()=>{if(!u.current||!a)return;let e=new IntersectionObserver(e=>{e[0].isIntersecting&&o()});return e.observe(u.current),()=>e.disconnect()},[a,o]),(0,_.useEffect)(()=>{if(!c||c.session_id!==e){m!==null&&h(null);return}if(!n||n.session_id!==e)return;let t=!1;return(async()=>{if(await s(c.uuid),t)return;let e=d.current.get(c.uuid);if(e){e.scrollIntoView({behavior:l?`auto`:`smooth`,block:`center`}),e.classList.add(`conv-item--jumped`),p.current!=null&&window.clearTimeout(p.current),p.current=window.setTimeout(()=>{e.classList.remove(`conv-item--jumped`),p.current=null},2e3),V({type:`CLEAR_CONVERSATION_JUMP`}),h(null);return}let r=n.items.find(e=>e.member_uuids.includes(c.uuid));if(r&&r.subagent_key!=null&&m!==r.subagent_key){h(r.subagent_key);return}a||V({type:`CLEAR_CONVERSATION_JUMP`})})(),()=>{t=!0}},[c,e,n?.items.length,a,m]),(0,_.useEffect)(()=>()=>{p.current!=null&&window.clearTimeout(p.current)},[]),(0,_.useEffect)(()=>()=>{f.current.clear()},[e]),(0,_.useEffect)(()=>{h(null)},[e]),(0,_.useEffect)(()=>{g.current.clear()},[e]),(0,_.useEffect)(()=>{for(let e of E){let t=e.kind===`subagent`||e.kind===`tool_result_run`?e.items[0]?.anchor.uuid:e.item.anchor.uuid;t&&g.current.add(t)}},[E]);let O=(0,_.useCallback)((t,n,r)=>l||g.current.has(t)||c!=null&&c.session_id===e&&n.includes(c.uuid)?[``,void 0]:[`conv-rise`,{animationDelay:g.current.size===0?`${r*40}ms`:`0ms`}],[l,c,e]),k=(0,_.useCallback)(e=>{let t=f.current,n=e.anchor.uuid,r=t.get(n);return r||(r=t=>{for(let n of e.member_uuids)t?d.current.set(n,t):d.current.delete(n)},t.set(n,r)),r},[]);(0,_.useEffect)(()=>{y(0)},[e]),(0,_.useEffect)(()=>{let e=x.current;if(!e)return;let t=e.children;for(let e=0;e<t.length;e++)t[e].classList.toggle(`conv-item--focused`,e===v)},[v,E]);let j=(0,_.useCallback)(e=>{let t=x.current;if(!t)return;let n=t.children.length-1;if(n<0)return;let r=b.current,i=Math.max(0,Math.min(n,r+e));if(e>0&&r===n&&C.current){w.current();return}i!==r&&(y(i),t.children[i]?.scrollIntoView({block:`nearest`,behavior:T.current?`auto`:`smooth`}))},[]),M=(0,_.useCallback)(e=>{let t=x.current;if(!t)return;t.classList.add(`conv-reader-thread--bulk`),t.querySelectorAll(`details`).forEach(t=>{t.open=e});let n=()=>t.classList.remove(`conv-reader-thread--bulk`);typeof requestAnimationFrame==`function`?requestAnimationFrame(n):n()},[]),N=(0,_.useCallback)(()=>{S.current?.scrollTo({top:0,behavior:T.current?`auto`:`smooth`}),y(0)},[]);return Ut((0,_.useMemo)(()=>{let e=()=>!z().openModal&&z().inputMode===null,t=(t,n)=>({key:t,scope:`global`,view:`conversations`,when:e,action:n});return[t(`j`,()=>j(1)),t(`k`,()=>j(-1)),t(`[`,()=>M(!1)),t(`]`,()=>M(!0)),t(`g`,()=>N())]},[])),r&&!n?(0,H.jsx)(`div`,{className:`conv-reader conv-reader--loading`,children:(0,H.jsxs)(`div`,{className:`conv-state`,children:[(0,H.jsx)(`span`,{className:`conv-state-glyph`,"aria-hidden":`true`,children:(0,H.jsx)(Jb,{})}),(0,H.jsx)(`div`,{className:`conv-state-title`,children:`Loading conversation…`})]})}):i?(0,H.jsx)(`div`,{className:`conv-reader conv-reader--error`,children:(0,H.jsxs)(`div`,{className:`conv-state`,children:[(0,H.jsx)(`span`,{className:`conv-state-glyph`,"aria-hidden":`true`,children:(0,H.jsx)(Yb,{})}),(0,H.jsx)(`div`,{className:`conv-state-title`,children:i})]})}):n?(0,H.jsxs)(`div`,{className:`conv-reader`,children:[(0,H.jsxs)(`div`,{className:`conv-reader-head`,children:[t&&(0,H.jsx)(`button`,{type:`button`,className:`conv-back`,onClick:()=>V({type:`SELECT_CONVERSATION`,sessionId:null}),children:`← Back`}),(0,H.jsx)(`div`,{className:`conv-reader-title`,children:D||n.session_id}),(0,H.jsxs)(`div`,{className:`conv-reader-meta`,children:[n.project_label||`—`,` · `,n.git_branch??`—`,` · `,A.usd2(n.cost_usd),` · `,n.models.join(`, `)]})]}),(0,H.jsxs)(`div`,{className:`conv-reader-body`,ref:S,children:[(0,H.jsx)(`div`,{className:`conv-reader-thread`,ref:x,children:E.map((t,r)=>{if(t.kind===`subagent`){let i=t.items.flatMap(e=>e.member_uuids),[a,o]=O(t.items[0].anchor.uuid,i,r);return(0,H.jsx)(wx,{subagentKey:t.subagentKey,items:t.items,nested:t.nested,meta:n.subagent_meta?.[t.subagentKey],getItemRef:k,forceOpen:n.session_id===e&&t.subagentKey===m,riseClassName:a,riseStyle:o},`sc-${t.subagentKey}`)}if(t.kind===`tool_result_run`){let e=t.items.flatMap(e=>e.member_uuids),[n,i]=O(t.items[0].anchor.uuid,e,r);return(0,H.jsxs)(`details`,{className:[`conv-toolresult-run`,n].filter(Boolean).join(` `),style:i,open:!0,children:[(0,H.jsxs)(`summary`,{children:[(0,H.jsx)(`span`,{className:`conv-chev`,"aria-hidden":`true`}),(0,H.jsx)(Hb,{}),` `,t.items.length,` tool results`]}),(0,H.jsx)(`div`,{className:`conv-toolresult-run-body`,children:t.items.map(e=>(0,H.jsx)(bx,{item:e,ref:k(e)},e.anchor.uuid))})]},`trr-${t.items[0].anchor.uuid}`)}let[i,a]=O(t.item.anchor.uuid,t.item.member_uuids,r);return(0,H.jsx)(bx,{item:t.item,ref:k(t.item),className:i,style:a},t.item.anchor.uuid)})}),a&&(0,H.jsx)(`div`,{ref:u,className:`conv-load-sentinel`,children:`Loading more…`})]})]}):(0,H.jsx)(`div`,{className:`conv-reader conv-reader--empty`,children:(0,H.jsxs)(`div`,{className:`conv-state`,children:[(0,H.jsx)(`span`,{className:`conv-state-glyph`,"aria-hidden":`true`,children:(0,H.jsx)(Xb,{})}),(0,H.jsx)(`div`,{className:`conv-state-title`,children:`Select a conversation`}),(0,H.jsx)(`div`,{className:`conv-state-hint`,children:`Choose one from the list to start reading.`})]})})}function Dx(){let e=(0,_.useSyncExternalStore)(B,()=>z().selectedConversationId),t=Ge(),n=ln();return Ut(Ox),xt(t)?n?(0,H.jsx)(`div`,{className:`conv-view conv-view--mobile`,children:e==null?(0,H.jsx)(Nl,{}):(0,H.jsx)(Ex,{sessionId:e,mobileBack:!0})}):(0,H.jsxs)(`div`,{className:`conv-view`,children:[(0,H.jsx)(Nl,{}),e==null?(0,H.jsx)(`div`,{className:`conv-reader conv-reader--empty`,children:(0,H.jsxs)(`div`,{className:`conv-state`,children:[(0,H.jsx)(`span`,{className:`conv-state-glyph`,"aria-hidden":`true`,children:(0,H.jsx)(Xb,{})}),(0,H.jsx)(`div`,{className:`conv-state-title`,children:`Select a conversation`}),(0,H.jsx)(`div`,{className:`conv-state-hint`,children:`Choose one from the list to start reading.`})]})}):(0,H.jsx)(Ex,{sessionId:e})]}):(0,H.jsxs)(`div`,{className:`conv-disabled`,children:[`Transcript viewing is disabled. Enable it with`,` `,(0,H.jsx)(`code`,{children:`cctally config set dashboard.expose_transcripts true`}),` `,`(loopback is always allowed; restart the dashboard to apply).`]})}var Ox=[{key:`/`,scope:`global`,view:`conversations`,when:()=>!z().openModal&&z().inputMode===null,action:()=>{let e=document.querySelector(`.conv-rail-search input`);e?.focus(),e?.select()}},{key:`Escape`,scope:`global`,view:`conversations`,when:()=>!z().openModal,action:()=>{if(z().conversationSearch){V({type:`SET_CONVERSATION_SEARCH`,text:``});return}V({type:`SET_VIEW`,view:`dashboard`})}}];function kx(){let e=(0,_.useSyncExternalStore)(B,()=>z().prefs.panelOrder),t=(0,_.useSyncExternalStore)(B,()=>z().view);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(At,{}),t===`conversations`?(0,H.jsx)(Dx,{}):(0,H.jsx)(Ro,{items:e,children:(0,H.jsx)(`div`,{className:`grid`,children:e.map((e,t)=>(0,H.jsx)(Mo,{id:e,index:t},e))})}),(0,H.jsx)(It,{}),(0,H.jsx)(Xn,{}),(0,H.jsx)(tr,{}),(0,H.jsx)(Cc,{}),(0,H.jsx)(bl,{}),(0,H.jsx)(os,{}),(0,H.jsx)(Vo,{}),(0,H.jsx)(cr,{})]})}function Ax(e){let t=z().prefs.panelOrder,n=e-1;if(n<0||n>=t.length)return;let r=Kn[t[n]];r&&r.openAction()}var jx=`Click a panel first, then press S to share it.`;function Mx(){return typeof window>`u`||!window.matchMedia?!1:window.matchMedia(cn).matches}function Nx(){if(typeof document>`u`)return null;let e=document.activeElement;if(!e||!(e instanceof Element))return null;let t=e.closest(`[data-panel-kind]`);return t?t.getAttribute(`data-panel-kind`):null}function Px(){return{key:`S`,scope:`global`,when:()=>{let e=z();return!(Mx()||e.shareModal!==null||e.composerModal!==null||e.openModal!==null||e.update.modalOpen||e.inputMode!==null)},action:()=>{let e=Nx();if(e===null){V({type:`SHOW_STATUS_TOAST`,text:jx});return}if(!ie.has(e))return;let t=e;V(L(t,`${t}-panel`))}}}function Fx(){return typeof window>`u`||!window.matchMedia?!1:window.matchMedia(cn).matches}function Ix(){return{key:`B`,scope:`global`,when:()=>{let e=z();return!(Fx()||e.shareModal!==null||e.composerModal!==null||e.openModal!==null||e.update.modalOpen||e.inputMode!==null)},action:()=>V(me())}}function Lx(){return[Ix()]}pt(),tt(),Ht();var Rx=()=>{let e=z();return!e.update.modalOpen&&!e.doctorModalOpen};Vt([{key:`1`,scope:`global`,when:Rx,action:()=>Ax(1)},{key:`2`,scope:`global`,when:Rx,action:()=>Ax(2)},{key:`3`,scope:`global`,when:Rx,action:()=>Ax(3)},{key:`4`,scope:`global`,when:Rx,action:()=>Ax(4)},{key:`5`,scope:`global`,when:Rx,action:()=>Ax(5)},{key:`6`,scope:`global`,when:Rx,action:()=>Ax(6)},{key:`7`,scope:`global`,when:Rx,action:()=>Ax(7)},{key:`8`,scope:`global`,when:Rx,action:()=>Ax(8)},{key:`9`,scope:`global`,when:Rx,action:()=>Ax(9)},{key:`0`,scope:`global`,when:Rx,action:()=>Ax(10)},{key:`r`,scope:`global`,when:Rx,action:()=>Ot()},{key:`q`,scope:`global`,when:Rx,action:Ft},{key:`n`,scope:`global`,when:Rx,action:()=>Nt(1)},{key:`N`,scope:`global`,when:Rx,action:()=>Nt(-1)},{key:`d`,scope:`global`,view:`any`,when:()=>{let e=z();return!(e.openModal!==null||e.update.modalOpen||e.inputMode!==null)},action:()=>V({type:`OPEN_DOCTOR_MODAL`})},Px(),...Lx(),{key:`c`,scope:`sessions`,when:()=>!z().openModal,action:()=>{let e=z().prefs.sessionsCollapsed;V({type:`SAVE_PREFS`,patch:{sessionsCollapsed:!e}})}}]);var zx=document.getElementById(`root`);if(!zx)throw Error(`missing #root`);(0,v.createRoot)(zx).render((0,H.jsx)(_.StrictMode,{children:(0,H.jsx)(kx,{})}));